jfs-components 0.1.30 → 0.1.32

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.
Files changed (41) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/lib/commonjs/components/CategoryCard/CategoryCard.js +264 -0
  3. package/lib/commonjs/components/CompareTable/CompareTable.js +140 -84
  4. package/lib/commonjs/components/ContentSheet/ContentSheet.js +28 -5
  5. package/lib/commonjs/components/CounterBadge/CounterBadge.js +78 -0
  6. package/lib/commonjs/components/FavoriteToggle/FavoriteToggle.js +180 -0
  7. package/lib/commonjs/components/HelloJioInput/HelloJioInput.js +287 -0
  8. package/lib/commonjs/components/ValueBackMetric/ValueBackMetric.js +219 -0
  9. package/lib/commonjs/components/index.js +35 -0
  10. package/lib/commonjs/design-tokens/figma-modes.generated.js +3 -0
  11. package/lib/commonjs/icons/registry.js +1 -1
  12. package/lib/module/components/CategoryCard/CategoryCard.js +258 -0
  13. package/lib/module/components/CompareTable/CompareTable.js +140 -84
  14. package/lib/module/components/ContentSheet/ContentSheet.js +29 -6
  15. package/lib/module/components/CounterBadge/CounterBadge.js +73 -0
  16. package/lib/module/components/FavoriteToggle/FavoriteToggle.js +174 -0
  17. package/lib/module/components/HelloJioInput/HelloJioInput.js +281 -0
  18. package/lib/module/components/ValueBackMetric/ValueBackMetric.js +214 -0
  19. package/lib/module/components/index.js +6 -1
  20. package/lib/module/design-tokens/figma-modes.generated.js +3 -0
  21. package/lib/module/icons/registry.js +1 -1
  22. package/lib/typescript/src/components/CategoryCard/CategoryCard.d.ts +72 -0
  23. package/lib/typescript/src/components/CompareTable/CompareTable.d.ts +16 -1
  24. package/lib/typescript/src/components/ContentSheet/ContentSheet.d.ts +7 -1
  25. package/lib/typescript/src/components/CounterBadge/CounterBadge.d.ts +19 -0
  26. package/lib/typescript/src/components/FavoriteToggle/FavoriteToggle.d.ts +66 -0
  27. package/lib/typescript/src/components/HelloJioInput/HelloJioInput.d.ts +111 -0
  28. package/lib/typescript/src/components/ValueBackMetric/ValueBackMetric.d.ts +86 -0
  29. package/lib/typescript/src/components/index.d.ts +5 -0
  30. package/lib/typescript/src/icons/registry.d.ts +1 -1
  31. package/package.json +1 -1
  32. package/src/components/CategoryCard/CategoryCard.tsx +404 -0
  33. package/src/components/CompareTable/CompareTable.tsx +201 -101
  34. package/src/components/ContentSheet/ContentSheet.tsx +40 -11
  35. package/src/components/CounterBadge/CounterBadge.tsx +95 -0
  36. package/src/components/FavoriteToggle/FavoriteToggle.tsx +243 -0
  37. package/src/components/HelloJioInput/HelloJioInput.tsx +513 -0
  38. package/src/components/ValueBackMetric/ValueBackMetric.tsx +298 -0
  39. package/src/components/index.ts +5 -0
  40. package/src/design-tokens/figma-modes.generated.ts +3 -0
  41. package/src/icons/registry.ts +1 -1
@@ -0,0 +1,78 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _react = _interopRequireDefault(require("react"));
8
+ var _reactNative = require("react-native");
9
+ var _figmaVariablesResolver = require("../../design-tokens/figma-variables-resolver");
10
+ var _reactUtils = require("../../utils/react-utils");
11
+ var _jsxRuntime = require("react/jsx-runtime");
12
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
13
+ /**
14
+ * Counter Badge — a small token-driven pill that displays a value.
15
+ *
16
+ * All visual attributes resolve from the Figma `counterBadge/*` tokens via
17
+ * `getVariableByName`.
18
+ */
19
+ function CounterBadge({
20
+ value = '99',
21
+ modes = _reactUtils.EMPTY_MODES,
22
+ style,
23
+ ...rest
24
+ }) {
25
+ // Resolve token values (fall back to the Figma defaults for the single
26
+ // `Default` mode so the badge still renders if a token is missing).
27
+ const backgroundColor = (0, _figmaVariablesResolver.getVariableByName)('counterBadge/background', modes) ?? '#ebebec';
28
+ const foreground = (0, _figmaVariablesResolver.getVariableByName)('counterBadge/foreground', modes) ?? '#0c0d10';
29
+ const fontFamily = (0, _figmaVariablesResolver.getVariableByName)('counterBadge/fontFamily', modes) ?? 'JioType Var';
30
+ const fontWeightRaw = (0, _figmaVariablesResolver.getVariableByName)('counterBadge/fontWeight', modes) ?? 500;
31
+ const fontWeight = typeof fontWeightRaw === 'number' ? String(fontWeightRaw) : fontWeightRaw;
32
+ const fontSize = Number((0, _figmaVariablesResolver.getVariableByName)('counterBadge/fontSize', modes) ?? 8);
33
+ const lineHeight = Number((0, _figmaVariablesResolver.getVariableByName)('counterBadge/lineHeight', modes) ?? 8);
34
+ const paddingHorizontal = Number((0, _figmaVariablesResolver.getVariableByName)('counterBadge/padding/horizontal', modes) ?? 4);
35
+ // The Figma design pins vertical padding to 4px (matching horizontal), but the
36
+ // committed variables snapshot resolves `counterBadge/padding/vertical` to 5px
37
+ // (a stale export). Figma is the source of truth here, so hardcode 4px rather
38
+ // than trust the token, keeping the badge one pixel shorter to match the design.
39
+ const paddingVertical = 4;
40
+ const borderRadius = Number((0, _figmaVariablesResolver.getVariableByName)('counterBadge/radius', modes) ?? 999);
41
+ const containerStyle = {
42
+ backgroundColor,
43
+ paddingHorizontal,
44
+ paddingVertical,
45
+ borderRadius,
46
+ alignSelf: 'flex-start',
47
+ alignItems: 'center',
48
+ justifyContent: 'center',
49
+ ...(style || {})
50
+ };
51
+ const textStyle = {
52
+ color: foreground,
53
+ fontFamily,
54
+ fontWeight: fontWeight,
55
+ fontSize,
56
+ lineHeight,
57
+ textAlign: 'center'
58
+ };
59
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
60
+ style: containerStyle,
61
+ ...rest,
62
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
63
+ style: WRAP_STYLE,
64
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
65
+ style: textStyle,
66
+ children: value
67
+ })
68
+ })
69
+ });
70
+ }
71
+
72
+ // Figma `wrap` node (data-node-id 7701:10879): min-width 10, centered.
73
+ const WRAP_STYLE = {
74
+ minWidth: 10,
75
+ alignItems: 'center',
76
+ justifyContent: 'center'
77
+ };
78
+ var _default = exports.default = CounterBadge;
@@ -0,0 +1,180 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _react = _interopRequireWildcard(require("react"));
8
+ var _reactNative = require("react-native");
9
+ var _figmaVariablesResolver = require("../../design-tokens/figma-variables-resolver");
10
+ var _Icon = _interopRequireDefault(require("../../icons/Icon"));
11
+ var _GlassFill = _interopRequireDefault(require("../../utils/GlassFill/GlassFill"));
12
+ var _webPlatformUtils = require("../../utils/web-platform-utils");
13
+ var _reactUtils = require("../../utils/react-utils");
14
+ var _Skeleton = _interopRequireDefault(require("../../skeleton/Skeleton"));
15
+ var _SkeletonGroup = require("../../skeleton/SkeletonGroup");
16
+ var _jsxRuntime = require("react/jsx-runtime");
17
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
18
+ 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); }
19
+ const IS_WEB = _reactNative.Platform.OS === 'web';
20
+ const IS_IOS = _reactNative.Platform.OS === 'ios';
21
+ const PRESS_DELAY = IS_IOS ? 130 : 0;
22
+ const pressedOverlayStyle = {
23
+ opacity: 0.7
24
+ };
25
+ // The `favoriteToggle/*` tokens are not yet in the committed variables snapshot,
26
+ // so `getVariableByName` returns undefined and these Figma-node values are used
27
+ // as fallbacks. Once the token export is re-synced the resolver takes over.
28
+ function resolveTokens(modes, isActive) {
29
+ const width = Number((0, _figmaVariablesResolver.getVariableByName)('favoriteToggle/width', modes) ?? 29);
30
+ const height = Number((0, _figmaVariablesResolver.getVariableByName)('favoriteToggle/height', modes) ?? 29);
31
+ const radiusRaw = Number((0, _figmaVariablesResolver.getVariableByName)('favoriteToggle/icon/radius', modes) ?? 9999);
32
+ const iconSize = Number((0, _figmaVariablesResolver.getVariableByName)('favoriteToggle/icon/width', modes) ?? 20);
33
+ // 9999 is the design-token sentinel for "perfect circle".
34
+ const size = Math.max(width, height);
35
+ const borderRadius = radiusRaw >= 9999 ? size / 2 : radiusRaw;
36
+
37
+ // Background + icon color differ per variant. In Figma this is driven by the
38
+ // `isActive` collection (modes `'False'` / `'True'`), so we pass that mode
39
+ // through by its string name. Until the `color/favoriteToggle/*` tokens are
40
+ // exported the resolver returns undefined and the fallbacks below — which
41
+ // encode the two Figma variants directly — take over.
42
+ const isActiveMode = {
43
+ ...modes,
44
+ isActive: isActive ? 'True' : 'False'
45
+ };
46
+ const backgroundColor = (0, _figmaVariablesResolver.getVariableByName)('color/favoriteToggle/background/color', isActiveMode) ?? (isActive ? '#ffffff' : '#ffffff33');
47
+ const iconColor = (0, _figmaVariablesResolver.getVariableByName)('color/favoriteToggle/icon/color', isActiveMode) ?? (isActive ? '#cea15a' : '#ffffff');
48
+
49
+ // Figma `blur/minimal` (px radius) -> GlassFill's 0-100 intensity scale, the
50
+ // same mapping Badge's glass path uses.
51
+ const blurRaw = Number((0, _figmaVariablesResolver.getVariableByName)('blur/minimal', modes) ?? 29);
52
+ const blurIntensity = Math.max(0, Math.min(100, Math.round(blurRaw)));
53
+ return {
54
+ size,
55
+ borderRadius,
56
+ backgroundColor,
57
+ iconColor,
58
+ iconSize,
59
+ blurIntensity
60
+ };
61
+ }
62
+
63
+ /**
64
+ * Circular glass favorite (heart) toggle, mirroring the Figma `Favorite Toggle`
65
+ * component set's boolean `isActive` variant:
66
+ * - inactive: translucent frosted circle (`#ffffff33` over a `blur/minimal`
67
+ * backdrop) with a white heart.
68
+ * - active: solid white circle with a gold (`#cea15a`) heart.
69
+ * Both variants share the identical filled-heart glyph; only the background and
70
+ * icon colors change between states.
71
+ *
72
+ * Controlled or uncontrolled: pass `isActive` (+ `onChange`) to control it, or
73
+ * omit `isActive` and use `defaultActive` to let the component own the state.
74
+ *
75
+ * Visual attributes resolve from the `favoriteToggle/*` / `color/favoriteToggle/*`
76
+ * tokens via `getVariableByName`. Those tokens are not yet in the committed
77
+ * variables snapshot, so the component currently runs on the Figma-node values
78
+ * as fallbacks; once the tokens are exported (under the `isActive` collection,
79
+ * modes `False`/`True`) the resolver takes over.
80
+ */
81
+ function FavoriteToggle({
82
+ isActive: controlledActive,
83
+ defaultActive = false,
84
+ icon = 'ic_favorite',
85
+ onChange,
86
+ onPress,
87
+ modes = _reactUtils.EMPTY_MODES,
88
+ disabled = false,
89
+ accessibilityLabel,
90
+ accessibilityHint,
91
+ accessibilityState,
92
+ webAccessibilityProps,
93
+ style,
94
+ loading,
95
+ ...rest
96
+ }) {
97
+ // Controlled when `isActive` is supplied; otherwise own the state internally
98
+ // (mirrors the Toggle / SegmentedControl controlled-or-uncontrolled pattern).
99
+ const isControlled = controlledActive !== undefined;
100
+ const [internalActive, setInternalActive] = (0, _react.useState)(defaultActive);
101
+ const isActive = isControlled ? controlledActive : internalActive;
102
+ const tokens = (0, _react.useMemo)(() => resolveTokens(modes, isActive), [modes, isActive]);
103
+ const {
104
+ active: groupActive
105
+ } = (0, _SkeletonGroup.useSkeleton)();
106
+ const isLoading = loading ?? groupActive;
107
+ const handlePress = (0, _react.useCallback)(() => {
108
+ const next = !isActive;
109
+ if (!isControlled) {
110
+ setInternalActive(next);
111
+ }
112
+ onChange?.(next);
113
+ onPress?.();
114
+ }, [isActive, isControlled, onChange, onPress]);
115
+ const label = accessibilityLabel || 'Favorite';
116
+ const webProps = (0, _webPlatformUtils.usePressableWebSupport)({
117
+ restProps: rest,
118
+ onPress: disabled ? undefined : handlePress,
119
+ disabled,
120
+ accessibilityLabel: label,
121
+ webAccessibilityProps
122
+ });
123
+ const baseContainerStyle = {
124
+ width: tokens.size,
125
+ height: tokens.size,
126
+ borderRadius: tokens.borderRadius,
127
+ // Active is opaque white, so no glass is drawn and the background paints
128
+ // directly. Inactive keeps the container transparent so the GlassFill blur
129
+ // (clipped by overflow:hidden) shows through.
130
+ backgroundColor: isActive ? tokens.backgroundColor : 'transparent',
131
+ overflow: 'hidden',
132
+ alignItems: 'center',
133
+ justifyContent: 'center',
134
+ opacity: disabled ? 0.5 : 1
135
+ };
136
+
137
+ // Declared before the loading short-circuit so hook order stays stable.
138
+ const styleCallback = (0, _react.useCallback)(({
139
+ pressed
140
+ }) => [baseContainerStyle, style, pressed && !disabled ? pressedOverlayStyle : null], [baseContainerStyle, style, disabled]);
141
+ if (isLoading) {
142
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Skeleton.default, {
143
+ kind: "other",
144
+ width: tokens.size,
145
+ height: tokens.size,
146
+ style: [{
147
+ borderRadius: tokens.borderRadius
148
+ }, style],
149
+ modes: modes
150
+ });
151
+ }
152
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.Pressable, {
153
+ accessibilityRole: IS_WEB ? 'switch' : 'button',
154
+ accessibilityLabel: undefined,
155
+ accessibilityHint: accessibilityHint,
156
+ accessibilityState: {
157
+ disabled,
158
+ checked: isActive,
159
+ ...accessibilityState
160
+ },
161
+ onPress: disabled ? undefined : handlePress,
162
+ disabled: disabled,
163
+ unstable_pressDelay: PRESS_DELAY,
164
+ style: styleCallback,
165
+ ...webProps,
166
+ children: [!isActive ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_GlassFill.default, {
167
+ tint: "light",
168
+ intensity: tokens.blurIntensity,
169
+ overlayColor: tokens.backgroundColor,
170
+ androidTintWash: false
171
+ }) : null, /*#__PURE__*/(0, _jsxRuntime.jsx)(_Icon.default, {
172
+ name: icon,
173
+ size: tokens.iconSize,
174
+ color: tokens.iconColor,
175
+ accessibilityElementsHidden: true,
176
+ importantForAccessibility: "no"
177
+ })]
178
+ });
179
+ }
180
+ var _default = exports.default = /*#__PURE__*/_react.default.memo(FavoriteToggle);
@@ -0,0 +1,287 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _react = _interopRequireWildcard(require("react"));
8
+ var _reactNative = require("react-native");
9
+ var _figmaVariablesResolver = require("../../design-tokens/figma-variables-resolver");
10
+ var _JFSThemeProvider = require("../../design-tokens/JFSThemeProvider");
11
+ var _Icon = _interopRequireDefault(require("../../icons/Icon"));
12
+ var _reactUtils = require("../../utils/react-utils");
13
+ var _GlassFill = _interopRequireDefault(require("../../utils/GlassFill/GlassFill"));
14
+ var _IconButton = _interopRequireDefault(require("../IconButton/IconButton"));
15
+ var _jsxRuntime = require("react/jsx-runtime");
16
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
17
+ 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); }
18
+ const IS_WEB = _reactNative.Platform.OS === 'web';
19
+ const STATE_COLLECTION = 'HelloJioInput State';
20
+
21
+ /** Default IconButton modes matching the Figma send control. */
22
+ const DEFAULT_SEND_BUTTON_MODES = Object.freeze({
23
+ AppearanceBrand: 'Primary',
24
+ 'Button / Size': 'S'
25
+ });
26
+ const toNumber = (value, fallback) => {
27
+ if (typeof value === 'number') {
28
+ return Number.isFinite(value) ? value : fallback;
29
+ }
30
+ if (typeof value === 'string') {
31
+ const parsed = Number(value);
32
+ return Number.isFinite(parsed) ? parsed : fallback;
33
+ }
34
+ return fallback;
35
+ };
36
+ const toFontWeight = (value, fallback) => {
37
+ if (typeof value === 'number') return String(value);
38
+ if (typeof value === 'string') return value;
39
+ return fallback;
40
+ };
41
+ /**
42
+ * Fallback values from the Figma `HelloJioInput` component when local token
43
+ * JSON has not been synced yet. Mode-driven `getVariableByName` wins when
44
+ * tokens resolve.
45
+ */
46
+ const STATE_FALLBACKS = {
47
+ Idle: {
48
+ background: '#f5f5f5',
49
+ borderColor: '#f5f5f5',
50
+ labelColor: '#545961',
51
+ iconColor: '#545961'
52
+ },
53
+ Active: {
54
+ background: '#ffffff',
55
+ borderColor: '#b5b5b5',
56
+ labelColor: '#24262b',
57
+ iconColor: '#24262b'
58
+ },
59
+ IdleJioPlus: {
60
+ background: '#f5f5f5',
61
+ borderColor: '#f5f5f5',
62
+ labelColor: '#545961',
63
+ iconColor: '#545961'
64
+ }
65
+ };
66
+ function resolveHelloJioInputTokens(modes, visualState) {
67
+ const fallback = STATE_FALLBACKS[visualState];
68
+ const background = (0, _figmaVariablesResolver.getVariableByName)('helloJioInput/background', modes) ?? fallback.background;
69
+ const borderColor = (0, _figmaVariablesResolver.getVariableByName)('helloJioInput/border/color', modes) ?? fallback.borderColor;
70
+ const strokeWidth = toNumber((0, _figmaVariablesResolver.getVariableByName)('helloJioInput/strokeWidth', modes), 1);
71
+ const gap = toNumber((0, _figmaVariablesResolver.getVariableByName)('helloJioInput/gap', modes), 8);
72
+ const paddingLeft = toNumber((0, _figmaVariablesResolver.getVariableByName)('helloJioInput/padding/left', modes), 12);
73
+ const paddingRight = toNumber((0, _figmaVariablesResolver.getVariableByName)('helloJioInput/padding/right', modes), 4);
74
+ const paddingTop = toNumber((0, _figmaVariablesResolver.getVariableByName)('helloJioInput/padding/top', modes), 4);
75
+ const paddingBottom = toNumber((0, _figmaVariablesResolver.getVariableByName)('helloJioInput/padding/bottom', modes), 4);
76
+ const height = toNumber((0, _figmaVariablesResolver.getVariableByName)('helloJioInput/height', modes), 36);
77
+ const radiusRaw = toNumber((0, _figmaVariablesResolver.getVariableByName)('helloJioInput/radius', modes), 99999);
78
+ const borderRadius = radiusRaw >= 9999 ? 99999 : radiusRaw;
79
+ const labelColor = (0, _figmaVariablesResolver.getVariableByName)('helloJioInput/label/color', modes) ?? fallback.labelColor;
80
+ const fontSize = toNumber((0, _figmaVariablesResolver.getVariableByName)('helloJioInput/fontSize', modes), 14);
81
+ const lineHeight = toNumber((0, _figmaVariablesResolver.getVariableByName)('helloJioInput/lineHeight', modes), 18);
82
+ const fontFamily = (0, _figmaVariablesResolver.getVariableByName)('helloJioInput/fontFamily', modes) ?? 'JioType Var';
83
+ const fontWeight = toFontWeight((0, _figmaVariablesResolver.getVariableByName)('helloJioInput/fontWeight', modes), '400');
84
+ const iconColor = (0, _figmaVariablesResolver.getVariableByName)('helloJioInput/icon/color', modes) ?? fallback.iconColor;
85
+ const iconSize = toNumber((0, _figmaVariablesResolver.getVariableByName)('textInput/icon/size', modes) ?? (0, _figmaVariablesResolver.getVariableByName)('helloJioInput/icon/size', modes), 18);
86
+ const blurMinimal = toNumber((0, _figmaVariablesResolver.getVariableByName)('blur/minimal', modes), 29);
87
+ const blurIntensity = Math.max(0, Math.min(100, Math.round(blurMinimal)));
88
+ const useGlass = visualState === 'IdleJioPlus';
89
+ return {
90
+ containerStyle: {
91
+ position: 'relative',
92
+ flexDirection: 'row',
93
+ alignItems: 'center',
94
+ // Glass keeps the container transparent so GlassFill shows through.
95
+ backgroundColor: useGlass ? 'transparent' : background,
96
+ borderColor,
97
+ borderWidth: strokeWidth,
98
+ borderStyle: 'solid',
99
+ borderRadius,
100
+ paddingLeft,
101
+ paddingRight,
102
+ paddingTop,
103
+ paddingBottom,
104
+ gap,
105
+ height,
106
+ overflow: 'hidden',
107
+ width: '100%'
108
+ },
109
+ inputStyle: {
110
+ flex: 1,
111
+ color: labelColor,
112
+ fontSize,
113
+ fontFamily,
114
+ fontWeight,
115
+ // iOS single-line TextInput + explicit lineHeight sits below center —
116
+ // same quirk TextInput works around. Omit on iOS.
117
+ ...(_reactNative.Platform.OS === 'ios' ? null : {
118
+ lineHeight
119
+ }),
120
+ padding: 0,
121
+ margin: 0,
122
+ minHeight: lineHeight,
123
+ outlineStyle: 'none',
124
+ outlineWidth: 0,
125
+ outlineColor: 'transparent'
126
+ },
127
+ iconColor,
128
+ iconSize,
129
+ blurIntensity,
130
+ useGlass
131
+ };
132
+ }
133
+
134
+ /**
135
+ * `HelloJioInput` is the pill-shaped HelloJio prompt field: leading brand
136
+ * icon, single-line text input, and a gold send `IconButton` on the right.
137
+ *
138
+ * Visual state is derived automatically:
139
+ * - **Idle** — gray fill, gray label (default)
140
+ * - **Active** — white fill + border while focused
141
+ * - **IdleJioPlus** — frosted glass when `jioPlus` and unfocused
142
+ *
143
+ * @component
144
+ */
145
+ const HelloJioInput = /*#__PURE__*/(0, _react.forwardRef)(function HelloJioInput({
146
+ placeholder = 'Ask me anything',
147
+ value,
148
+ defaultValue = '',
149
+ onChangeText,
150
+ onSubmit,
151
+ leadingIconName = 'ic_hellojio',
152
+ leading,
153
+ trailing,
154
+ sendIconName = 'ic_send_message',
155
+ jioPlus = false,
156
+ disabled = false,
157
+ modes: propModes = _reactUtils.EMPTY_MODES,
158
+ style,
159
+ inputStyle,
160
+ accessibilityLabel,
161
+ accessibilityHint,
162
+ testID,
163
+ onFocus,
164
+ onBlur,
165
+ returnKeyType = 'send',
166
+ ...rest
167
+ }, ref) {
168
+ const {
169
+ modes: globalModes
170
+ } = (0, _JFSThemeProvider.useTokens)();
171
+ const inputRef = (0, _react.useRef)(null);
172
+ const [isFocused, setIsFocused] = (0, _react.useState)(false);
173
+ const [isHovered, setIsHovered] = (0, _react.useState)(false);
174
+ const [uncontrolledValue, setUncontrolledValue] = (0, _react.useState)(defaultValue);
175
+ const isControlled = value !== undefined;
176
+ const currentValue = isControlled ? value : uncontrolledValue;
177
+ const visualState = isFocused ? 'Active' : jioPlus ? 'IdleJioPlus' : 'Idle';
178
+ const modes = (0, _react.useMemo)(() => ({
179
+ ...globalModes,
180
+ ...propModes,
181
+ [STATE_COLLECTION]: visualState
182
+ }), [globalModes, propModes, visualState]);
183
+ const sendButtonModes = (0, _react.useMemo)(() => ({
184
+ ...DEFAULT_SEND_BUTTON_MODES,
185
+ ...modes
186
+ }), [modes]);
187
+ const tokens = (0, _react.useMemo)(() => resolveHelloJioInputTokens(modes, visualState), [modes, visualState]);
188
+ const handleChangeText = (0, _react.useCallback)(text => {
189
+ if (!isControlled) setUncontrolledValue(text);
190
+ onChangeText?.(text);
191
+ }, [isControlled, onChangeText]);
192
+ const handleSubmit = (0, _react.useCallback)(() => {
193
+ if (disabled) return;
194
+ onSubmit?.(currentValue);
195
+ }, [disabled, onSubmit, currentValue]);
196
+ const handleFocus = (0, _react.useCallback)(e => {
197
+ setIsFocused(true);
198
+ onFocus?.(e);
199
+ }, [onFocus]);
200
+ const handleBlur = (0, _react.useCallback)(e => {
201
+ setIsFocused(false);
202
+ onBlur?.(e);
203
+ }, [onBlur]);
204
+ const leadingElement = leading ?? (leadingIconName ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_Icon.default, {
205
+ name: leadingIconName,
206
+ size: tokens.iconSize,
207
+ color: tokens.iconColor
208
+ }) : null);
209
+ const processedLeading = leadingElement ? (0, _reactUtils.cloneChildrenWithModes)(_react.default.Children.toArray(leadingElement), modes) : null;
210
+ const defaultTrailing = /*#__PURE__*/(0, _jsxRuntime.jsx)(_IconButton.default, {
211
+ iconName: sendIconName,
212
+ modes: sendButtonModes,
213
+ onPress: handleSubmit,
214
+ disabled: disabled,
215
+ accessibilityLabel: "Send"
216
+ });
217
+ const trailingElement = trailing === undefined ? defaultTrailing : trailing === null ? null : trailing;
218
+ const processedTrailing = trailingElement ? (0, _reactUtils.cloneChildrenWithModes)(_react.default.Children.toArray(trailingElement), modes) : null;
219
+ const a11yLabel = accessibilityLabel ?? (placeholder || 'HelloJio input');
220
+ const hoverStyle = isHovered && !disabled && !isFocused ? {
221
+ opacity: 0.95
222
+ } : {};
223
+ const containerStyleArray = [tokens.containerStyle, hoverStyle, disabled ? {
224
+ opacity: 0.5
225
+ } : null, style];
226
+ const glassOverlay = (0, _figmaVariablesResolver.getVariableByName)('helloJioInput/background', modes) ?? STATE_FALLBACKS.IdleJioPlus.background;
227
+ const inner = /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
228
+ children: [tokens.useGlass ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_GlassFill.default, {
229
+ tint: "light",
230
+ intensity: tokens.blurIntensity,
231
+ overlayColor: glassOverlay,
232
+ androidTintWash: false
233
+ }) : null, processedLeading ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
234
+ accessibilityElementsHidden: true,
235
+ importantForAccessibility: "no",
236
+ style: SLOT_CENTER,
237
+ children: processedLeading
238
+ }) : null, /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.TextInput, {
239
+ ref: (0, _reactUtils.mergeRefs)(inputRef, ref),
240
+ accessibilityLabel: a11yLabel,
241
+ accessibilityHint: accessibilityHint,
242
+ placeholder: isFocused ? '' : placeholder,
243
+ placeholderTextColor: tokens.inputStyle.color,
244
+ value: currentValue,
245
+ onChangeText: handleChangeText,
246
+ onFocus: handleFocus,
247
+ onBlur: handleBlur,
248
+ onSubmitEditing: handleSubmit,
249
+ returnKeyType: returnKeyType,
250
+ editable: !disabled,
251
+ style: [tokens.inputStyle, inputStyle],
252
+ testID: testID,
253
+ ...rest
254
+ }), processedTrailing ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View
255
+ // Keep the send button in the a11y tree — it has its own label.
256
+ , {
257
+ style: SLOT_CENTER,
258
+ children: processedTrailing
259
+ }) : null]
260
+ });
261
+
262
+ // Same Android focus rule as TextInput: never wrap native TextInput in
263
+ // Pressable on native (steals the first tap). Web keeps Pressable for
264
+ // hover + click-anywhere-to-focus.
265
+ if (IS_WEB) {
266
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Pressable, {
267
+ style: containerStyleArray,
268
+ onHoverIn: () => setIsHovered(true),
269
+ onHoverOut: () => setIsHovered(false),
270
+ onPress: () => {
271
+ if (!disabled) inputRef.current?.focus();
272
+ },
273
+ accessible: false,
274
+ disabled: disabled,
275
+ children: inner
276
+ });
277
+ }
278
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
279
+ style: containerStyleArray,
280
+ children: inner
281
+ });
282
+ });
283
+ const SLOT_CENTER = {
284
+ justifyContent: 'center',
285
+ alignItems: 'center'
286
+ };
287
+ var _default = exports.default = /*#__PURE__*/_react.default.memo(HelloJioInput);