jfs-components 0.0.40 → 0.0.43

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 (109) hide show
  1. package/lib/commonjs/components/Form/Form.js +83 -0
  2. package/lib/commonjs/components/FormField/FormField.js +228 -0
  3. package/lib/commonjs/components/Toast/Toast.js +93 -0
  4. package/lib/commonjs/components/Toast/ToastProvider.js +61 -0
  5. package/lib/commonjs/components/Toast/useToast.js +61 -0
  6. package/lib/commonjs/components/index.js +60 -0
  7. package/lib/commonjs/design-tokens/JFS Variables-variables-full.json +1 -1
  8. package/lib/commonjs/icons/registry.js +1 -1
  9. package/lib/module/components/Form/Form.js +77 -0
  10. package/lib/module/components/FormField/FormField.js +222 -0
  11. package/lib/module/components/Toast/Toast.js +88 -0
  12. package/lib/module/components/Toast/ToastProvider.js +55 -0
  13. package/lib/module/components/Toast/useToast.js +54 -0
  14. package/lib/module/components/index.js +7 -1
  15. package/lib/module/design-tokens/JFS Variables-variables-full.json +1 -1
  16. package/lib/module/icons/registry.js +1 -1
  17. package/lib/typescript/App.d.ts +2 -0
  18. package/lib/typescript/babel.config.d.ts +6 -0
  19. package/lib/typescript/build/bundle.d.ts +2 -0
  20. package/lib/typescript/debug-gap.d.ts +2 -0
  21. package/lib/typescript/index.d.ts +1 -4
  22. package/lib/typescript/metro.config.d.ts +78 -0
  23. package/lib/typescript/react-native.config.d.ts +4 -0
  24. package/lib/typescript/scripts/extract-component-tokens.d.ts +9 -0
  25. package/lib/typescript/scripts/generate-component-docs.d.ts +9 -0
  26. package/lib/typescript/scripts/generate-icon-registry.d.ts +3 -0
  27. package/lib/typescript/src/components/Form/Form.d.ts +19 -0
  28. package/lib/typescript/src/components/FormField/FormField.d.ts +27 -0
  29. package/lib/typescript/src/components/Toast/Toast.d.ts +14 -0
  30. package/lib/typescript/src/components/Toast/ToastProvider.d.ts +11 -0
  31. package/lib/typescript/src/components/Toast/useToast.d.ts +24 -0
  32. package/lib/typescript/{components → src/components}/index.d.ts +6 -0
  33. package/lib/typescript/{icons → src/icons}/registry.d.ts +1 -1
  34. package/lib/typescript/src/index.d.ts +5 -0
  35. package/lib/typescript/webpack.config.d.ts +35 -0
  36. package/package.json +3 -1
  37. package/src/components/Form/Form.tsx +97 -0
  38. package/src/components/FormField/FormField.tsx +265 -0
  39. package/src/components/Toast/Toast.tsx +105 -0
  40. package/src/components/Toast/ToastProvider.tsx +75 -0
  41. package/src/components/Toast/useToast.ts +80 -0
  42. package/src/components/index.ts +6 -1
  43. package/src/design-tokens/JFS Variables-variables-full.json +1 -1
  44. package/src/icons/registry.ts +1 -1
  45. /package/lib/typescript/{Containers.d.ts → src/Containers.d.ts} +0 -0
  46. /package/lib/typescript/{components → src/components}/Accordion/Accordion.d.ts +0 -0
  47. /package/lib/typescript/{components → src/components}/ActionFooter/ActionFooter.d.ts +0 -0
  48. /package/lib/typescript/{components → src/components}/ActionTile/ActionTile.d.ts +0 -0
  49. /package/lib/typescript/{components → src/components}/ActionTile/index.d.ts +0 -0
  50. /package/lib/typescript/{components → src/components}/AppBar/AppBar.d.ts +0 -0
  51. /package/lib/typescript/{components → src/components}/Avatar/Avatar.d.ts +0 -0
  52. /package/lib/typescript/{components → src/components}/AvatarGroup/AvatarGroup.d.ts +0 -0
  53. /package/lib/typescript/{components → src/components}/Badge/Badge.d.ts +0 -0
  54. /package/lib/typescript/{components → src/components}/Balance/Balance.d.ts +0 -0
  55. /package/lib/typescript/{components → src/components}/BottomNav/BottomNav.d.ts +0 -0
  56. /package/lib/typescript/{components → src/components}/BottomNavItem/BottomNavItem.d.ts +0 -0
  57. /package/lib/typescript/{components → src/components}/Button/Button.d.ts +0 -0
  58. /package/lib/typescript/{components → src/components}/ButtonGroup/ButtonGroup.d.ts +0 -0
  59. /package/lib/typescript/{components → src/components}/Card/Card.d.ts +0 -0
  60. /package/lib/typescript/{components → src/components}/CardFeedback/CardFeedback.d.ts +0 -0
  61. /package/lib/typescript/{components → src/components}/Carousel/Carousel.d.ts +0 -0
  62. /package/lib/typescript/{components → src/components}/ChipGroup/ChipGroup.d.ts +0 -0
  63. /package/lib/typescript/{components → src/components}/ChipSelect/ChipSelect.d.ts +0 -0
  64. /package/lib/typescript/{components → src/components}/CtaCard/CtaCard.d.ts +0 -0
  65. /package/lib/typescript/{components → src/components}/CtaCard/index.d.ts +0 -0
  66. /package/lib/typescript/{components → src/components}/Disclaimer/Disclaimer.d.ts +0 -0
  67. /package/lib/typescript/{components → src/components}/Divider/Divider.d.ts +0 -0
  68. /package/lib/typescript/{components → src/components}/Drawer/Drawer.d.ts +0 -0
  69. /package/lib/typescript/{components → src/components}/EmptyState/EmptyState.d.ts +0 -0
  70. /package/lib/typescript/{components → src/components}/FilterBar/FilterBar.d.ts +0 -0
  71. /package/lib/typescript/{components → src/components}/HStack/HStack.d.ts +0 -0
  72. /package/lib/typescript/{components → src/components}/IconButton/IconButton.d.ts +0 -0
  73. /package/lib/typescript/{components → src/components}/IconCapsule/IconCapsule.d.ts +0 -0
  74. /package/lib/typescript/{components → src/components}/InputSearch/InputSearch.d.ts +0 -0
  75. /package/lib/typescript/{components → src/components}/LazyList/LazyList.d.ts +0 -0
  76. /package/lib/typescript/{components → src/components}/LinearMeter/LinearMeter.d.ts +0 -0
  77. /package/lib/typescript/{components → src/components}/LinearMeter/index.d.ts +0 -0
  78. /package/lib/typescript/{components → src/components}/ListGroup/ListGroup.d.ts +0 -0
  79. /package/lib/typescript/{components → src/components}/ListItem/ListItem.d.ts +0 -0
  80. /package/lib/typescript/{components → src/components}/MediaCard/MediaCard.d.ts +0 -0
  81. /package/lib/typescript/{components → src/components}/MerchantProfile/MerchantProfile.d.ts +0 -0
  82. /package/lib/typescript/{components → src/components}/MoneyValue/MoneyValue.d.ts +0 -0
  83. /package/lib/typescript/{components → src/components}/NavArrow/NavArrow.d.ts +0 -0
  84. /package/lib/typescript/{components → src/components}/PageTitle/PageTitle.d.ts +0 -0
  85. /package/lib/typescript/{components → src/components}/RadioButton/RadioButton.d.ts +0 -0
  86. /package/lib/typescript/{components → src/components}/RechargeCard/RechargeCard.d.ts +0 -0
  87. /package/lib/typescript/{components → src/components}/Screen/Screen.d.ts +0 -0
  88. /package/lib/typescript/{components → src/components}/Section/Section.d.ts +0 -0
  89. /package/lib/typescript/{components → src/components}/Stepper/Step.d.ts +0 -0
  90. /package/lib/typescript/{components → src/components}/Stepper/StepLabel.d.ts +0 -0
  91. /package/lib/typescript/{components → src/components}/Stepper/Stepper.d.ts +0 -0
  92. /package/lib/typescript/{components → src/components}/SupportText/SupportText.d.ts +0 -0
  93. /package/lib/typescript/{components → src/components}/SupportText/SupportTextIcon.d.ts +0 -0
  94. /package/lib/typescript/{components → src/components}/SupportText/index.d.ts +0 -0
  95. /package/lib/typescript/{components → src/components}/TextInput/TextInput.d.ts +0 -0
  96. /package/lib/typescript/{components → src/components}/ThreadHero/ThreadHero.d.ts +0 -0
  97. /package/lib/typescript/{components → src/components}/Tooltip/Tooltip.d.ts +0 -0
  98. /package/lib/typescript/{components → src/components}/TransactionDetails/TransactionDetails.d.ts +0 -0
  99. /package/lib/typescript/{components → src/components}/TransactionStatus/TransactionStatus.d.ts +0 -0
  100. /package/lib/typescript/{components → src/components}/UpiHandle/UpiHandle.d.ts +0 -0
  101. /package/lib/typescript/{components → src/components}/VStack/VStack.d.ts +0 -0
  102. /package/lib/typescript/{components → src/components}/docs/DocSections.d.ts +0 -0
  103. /package/lib/typescript/{design-tokens → src/design-tokens}/JFSThemeProvider.d.ts +0 -0
  104. /package/lib/typescript/{design-tokens → src/design-tokens}/figma-variables-resolver.d.ts +0 -0
  105. /package/lib/typescript/{design-tokens → src/design-tokens}/index.d.ts +0 -0
  106. /package/lib/typescript/{icons → src/icons}/Icon.d.ts +0 -0
  107. /package/lib/typescript/{icons → src/icons}/index.d.ts +0 -0
  108. /package/lib/typescript/{utils → src/utils}/react-utils.d.ts +0 -0
  109. /package/lib/typescript/{utils → src/utils}/web-platform-utils.d.ts +0 -0
@@ -0,0 +1,83 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ exports.useFormContext = useFormContext;
8
+ var _react = _interopRequireWildcard(require("react"));
9
+ var _reactNative = require("react-native");
10
+ var _figmaVariablesResolver = require("../../design-tokens/figma-variables-resolver");
11
+ var _JFSThemeProvider = require("../../design-tokens/JFSThemeProvider");
12
+ var _jsxRuntime = require("react/jsx-runtime");
13
+ 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); }
14
+ const FormContext = /*#__PURE__*/(0, _react.createContext)(null);
15
+ function useFormContext() {
16
+ return (0, _react.useContext)(FormContext);
17
+ }
18
+ function Form({
19
+ children,
20
+ validationErrors: externalErrors,
21
+ onSubmit,
22
+ modes: propModes = {},
23
+ style,
24
+ accessibilityLabel,
25
+ testID
26
+ }) {
27
+ const {
28
+ modes: globalModes
29
+ } = (0, _JFSThemeProvider.useTokens)();
30
+ const modes = (0, _react.useMemo)(() => ({
31
+ ...globalModes,
32
+ ...propModes
33
+ }), [globalModes, propModes]);
34
+ const [clearedFields, setClearedFields] = (0, _react.useState)({});
35
+
36
+ // Re-sync cleared state when external errors change reference
37
+ const prevErrorsRef = _react.default.useRef(externalErrors);
38
+ if (externalErrors !== prevErrorsRef.current) {
39
+ prevErrorsRef.current = externalErrors;
40
+ setClearedFields({});
41
+ }
42
+ const validationErrors = (0, _react.useMemo)(() => {
43
+ if (!externalErrors) return {};
44
+ const result = {};
45
+ for (const key of Object.keys(externalErrors)) {
46
+ if (!clearedFields[key]) {
47
+ result[key] = externalErrors[key];
48
+ }
49
+ }
50
+ return result;
51
+ }, [externalErrors, clearedFields]);
52
+ const onFieldChange = (0, _react.useCallback)(name => {
53
+ if (externalErrors && name in externalErrors) {
54
+ setClearedFields(prev => ({
55
+ ...prev,
56
+ [name]: true
57
+ }));
58
+ }
59
+ }, [externalErrors]);
60
+ const contextValue = (0, _react.useMemo)(() => ({
61
+ validationErrors,
62
+ onFieldChange
63
+ }), [validationErrors, onFieldChange]);
64
+ const gap = parseInt((0, _figmaVariablesResolver.getVariableByName)('form/gap', modes), 10) || 12;
65
+ const paddingHorizontal = parseInt((0, _figmaVariablesResolver.getVariableByName)('form/padding/horizontal', modes), 10) || 0;
66
+ const paddingVertical = parseInt((0, _figmaVariablesResolver.getVariableByName)('form/padding/vertical', modes), 10) || 0;
67
+ const containerStyle = (0, _react.useMemo)(() => ({
68
+ gap,
69
+ paddingHorizontal,
70
+ paddingVertical
71
+ }), [gap, paddingHorizontal, paddingVertical]);
72
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(FormContext.Provider, {
73
+ value: contextValue,
74
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
75
+ style: [containerStyle, style],
76
+ accessibilityRole: "none",
77
+ accessibilityLabel: accessibilityLabel,
78
+ testID: testID,
79
+ children: children
80
+ })
81
+ });
82
+ }
83
+ var _default = exports.default = Form;
@@ -0,0 +1,228 @@
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 _TextInput = _interopRequireDefault(require("../TextInput/TextInput"));
12
+ var _SupportText = _interopRequireDefault(require("../SupportText/SupportText"));
13
+ var _jsxRuntime = require("react/jsx-runtime");
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
+ function useFormField(props) {
17
+ const {
18
+ type = 'text',
19
+ isDisabled = false,
20
+ isInvalid = false,
21
+ supportText,
22
+ errorMessage,
23
+ modes: propModes = {},
24
+ onFocus,
25
+ onBlur
26
+ } = props;
27
+ const {
28
+ modes: globalModes
29
+ } = (0, _JFSThemeProvider.useTokens)();
30
+ const baseModes = (0, _react.useMemo)(() => ({
31
+ ...globalModes,
32
+ ...propModes
33
+ }), [globalModes, propModes]);
34
+ const [isFocused, setIsFocused] = (0, _react.useState)(false);
35
+
36
+ // Merge FormField States collection based on focus
37
+ const modes = (0, _react.useMemo)(() => ({
38
+ ...baseModes,
39
+ 'FormField States': isFocused ? 'Active' : 'Idle'
40
+ }), [baseModes, isFocused]);
41
+
42
+ // -- Label tokens (from "FormField / Output" collection) --
43
+ const labelColor = (0, _figmaVariablesResolver.getVariableByName)('formField/label/color', modes) || '#0c0d10';
44
+ const labelFontFamily = (0, _figmaVariablesResolver.getVariableByName)('formField/label/fontFamily', modes) || 'JioType Var';
45
+ const labelFontSize = parseInt((0, _figmaVariablesResolver.getVariableByName)('formField/label/fontSize', modes), 10) || 14;
46
+ const labelLineHeight = parseInt((0, _figmaVariablesResolver.getVariableByName)('formField/label/lineHeight', modes), 10) || 17;
47
+ const labelFontWeight = (0, _figmaVariablesResolver.getVariableByName)('formField/label/fontWeight', modes) || '500';
48
+ const gap = parseInt((0, _figmaVariablesResolver.getVariableByName)('formField/gap', modes), 10) || 8;
49
+
50
+ // -- Input tokens (from "FormField / Output" + "FormField States" collections) --
51
+ const inputPaddingH = parseInt((0, _figmaVariablesResolver.getVariableByName)('formField/input/padding/horizontal', modes), 10) || 12;
52
+ const inputGap = parseInt((0, _figmaVariablesResolver.getVariableByName)('formField/input/gap', modes), 10) || 8;
53
+ const inputRadius = parseInt((0, _figmaVariablesResolver.getVariableByName)('formField/input/radius', modes), 10) || 8;
54
+ const inputBackground = (0, _figmaVariablesResolver.getVariableByName)('formField/input/background', modes) || '#ffffff';
55
+ const inputFontSize = parseInt((0, _figmaVariablesResolver.getVariableByName)('formField/input/label/fontSize', modes), 10) || 16;
56
+ const inputLineHeight = parseInt((0, _figmaVariablesResolver.getVariableByName)('formField/input/label/lineHeight', modes), 10) || 45;
57
+ const inputFontFamily = (0, _figmaVariablesResolver.getVariableByName)('formField/input/label/fontFamily', modes) || 'JioType Var';
58
+ const inputFontWeight = (0, _figmaVariablesResolver.getVariableByName)('formField/input/label/fontWeight', modes) || '400';
59
+ const inputTextColor = (0, _figmaVariablesResolver.getVariableByName)('states/formField/input/label/color', modes) || (0, _figmaVariablesResolver.getVariableByName)('formField/input/label/color', modes) || '#24262b';
60
+ const inputBorderColor = (0, _figmaVariablesResolver.getVariableByName)('states/formField/input/border/color', modes) || (0, _figmaVariablesResolver.getVariableByName)('formField/input/border/color', modes) || '#b5b6b7';
61
+ const inputBorderSize = parseInt((0, _figmaVariablesResolver.getVariableByName)('formField/input/border/size', modes), 10) || 1;
62
+
63
+ // -- Styles --
64
+ const labelStyle = (0, _react.useMemo)(() => ({
65
+ color: labelColor,
66
+ fontFamily: labelFontFamily,
67
+ fontSize: labelFontSize,
68
+ lineHeight: labelLineHeight,
69
+ fontWeight: labelFontWeight
70
+ }), [labelColor, labelFontFamily, labelFontSize, labelLineHeight, labelFontWeight]);
71
+ const wrapperStyle = (0, _react.useMemo)(() => ({
72
+ gap,
73
+ opacity: isDisabled ? 0.5 : 1
74
+ }), [gap, isDisabled]);
75
+ const requiredIndicatorStyle = (0, _react.useMemo)(() => ({
76
+ color: '#d93d3d',
77
+ fontFamily: labelFontFamily,
78
+ fontSize: labelFontSize,
79
+ lineHeight: labelLineHeight,
80
+ fontWeight: labelFontWeight
81
+ }), [labelFontFamily, labelFontSize, labelLineHeight, labelFontWeight]);
82
+
83
+ // Style overrides for the input row, sourced from formField/input/* tokens
84
+ const inputContainerStyle = (0, _react.useMemo)(() => ({
85
+ backgroundColor: inputBackground,
86
+ borderColor: inputBorderColor,
87
+ borderWidth: inputBorderSize,
88
+ borderRadius: inputRadius,
89
+ paddingHorizontal: inputPaddingH,
90
+ gap: inputGap
91
+ }), [inputBackground, inputBorderColor, inputBorderSize, inputRadius, inputPaddingH, inputGap]);
92
+ const inputTextStyle = (0, _react.useMemo)(() => ({
93
+ color: inputTextColor,
94
+ fontSize: inputFontSize,
95
+ lineHeight: inputLineHeight,
96
+ fontFamily: inputFontFamily,
97
+ fontWeight: inputFontWeight
98
+ }), [inputTextColor, inputFontSize, inputLineHeight, inputFontFamily, inputFontWeight]);
99
+
100
+ // -- Support text logic --
101
+ const supportStatus = isInvalid ? 'Error' : 'Neutral';
102
+ const supportLabel = isInvalid && errorMessage ? errorMessage : supportText;
103
+
104
+ // -- Input type derived props --
105
+ const secureTextEntry = type === 'password';
106
+ const keyboardType = type === 'email' ? 'email-address' : 'default';
107
+ const autoCapitalize = type === 'email' || type === 'password' ? 'none' : 'sentences';
108
+
109
+ // -- Event handlers --
110
+ const handleFocus = (0, _react.useCallback)(e => {
111
+ setIsFocused(true);
112
+ onFocus?.(e);
113
+ }, [onFocus]);
114
+ const handleBlur = (0, _react.useCallback)(e => {
115
+ setIsFocused(false);
116
+ onBlur?.(e);
117
+ }, [onBlur]);
118
+ return {
119
+ modes,
120
+ labelStyle,
121
+ wrapperStyle,
122
+ requiredIndicatorStyle,
123
+ inputContainerStyle,
124
+ inputTextStyle,
125
+ supportStatus,
126
+ supportLabel,
127
+ secureTextEntry,
128
+ keyboardType,
129
+ autoCapitalize,
130
+ handleFocus,
131
+ handleBlur
132
+ };
133
+ }
134
+ function FormField({
135
+ label,
136
+ placeholder,
137
+ value = '',
138
+ onChangeText,
139
+ type = 'text',
140
+ leading,
141
+ trailing,
142
+ leadingIconName,
143
+ isRequired = false,
144
+ isDisabled = false,
145
+ isInvalid = false,
146
+ supportText,
147
+ errorMessage,
148
+ modes = {},
149
+ style,
150
+ onFocus,
151
+ onBlur,
152
+ accessibilityLabel,
153
+ accessibilityHint
154
+ }) {
155
+ const {
156
+ modes: resolvedModes,
157
+ labelStyle,
158
+ wrapperStyle,
159
+ requiredIndicatorStyle,
160
+ inputContainerStyle,
161
+ inputTextStyle,
162
+ supportStatus,
163
+ supportLabel,
164
+ secureTextEntry,
165
+ keyboardType,
166
+ autoCapitalize,
167
+ handleFocus,
168
+ handleBlur
169
+ } = useFormField({
170
+ type,
171
+ isDisabled,
172
+ isInvalid,
173
+ supportText,
174
+ errorMessage,
175
+ modes,
176
+ onFocus,
177
+ onBlur
178
+ });
179
+ const resolvedA11yLabel = accessibilityLabel || label || placeholder || 'Form field';
180
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
181
+ style: [wrapperStyle, style],
182
+ pointerEvents: isDisabled ? 'none' : 'auto',
183
+ accessible: true,
184
+ accessibilityRole: "none",
185
+ accessibilityLabel: resolvedA11yLabel,
186
+ accessibilityState: {
187
+ disabled: isDisabled
188
+ },
189
+ children: [label != null && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
190
+ style: {
191
+ flexDirection: 'row',
192
+ alignItems: 'baseline'
193
+ },
194
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
195
+ style: labelStyle,
196
+ children: label
197
+ }), isRequired && /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
198
+ style: requiredIndicatorStyle,
199
+ children: " *"
200
+ })]
201
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_TextInput.default, {
202
+ placeholder: placeholder || '',
203
+ value: value,
204
+ ...(onChangeText ? {
205
+ onChangeText
206
+ } : {}),
207
+ leading: leading,
208
+ trailing: trailing,
209
+ leadingIconName: leadingIconName || 'ic_search',
210
+ modes: resolvedModes,
211
+ style: inputContainerStyle,
212
+ inputStyle: inputTextStyle,
213
+ onFocus: handleFocus,
214
+ onBlur: handleBlur,
215
+ secureTextEntry: secureTextEntry,
216
+ keyboardType: keyboardType,
217
+ autoCapitalize: autoCapitalize,
218
+ editable: !isDisabled,
219
+ accessibilityLabel: resolvedA11yLabel,
220
+ accessibilityHint: accessibilityHint || ''
221
+ }), supportLabel != null && /*#__PURE__*/(0, _jsxRuntime.jsx)(_SupportText.default, {
222
+ label: supportLabel,
223
+ status: supportStatus,
224
+ modes: resolvedModes
225
+ })]
226
+ });
227
+ }
228
+ var _default = exports.default = FormField;
@@ -0,0 +1,93 @@
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 _reactNativeReanimated = _interopRequireWildcard(require("react-native-reanimated"));
10
+ var _figmaVariablesResolver = require("../../design-tokens/figma-variables-resolver");
11
+ var _useToast = require("./useToast");
12
+ var _jsxRuntime = require("react/jsx-runtime");
13
+ 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); }
14
+ const ANIMATION_DURATION = 250;
15
+ function Toast({
16
+ id,
17
+ title,
18
+ timeout = 4000,
19
+ onClose,
20
+ modes = {},
21
+ placement = 'bottom',
22
+ style
23
+ }) {
24
+ const timerRef = (0, _react.useRef)(null);
25
+ (0, _react.useEffect)(() => {
26
+ if (timeout <= 0) return;
27
+ timerRef.current = setTimeout(() => (0, _useToast.closeToast)(id), timeout);
28
+ return () => {
29
+ if (timerRef.current) clearTimeout(timerRef.current);
30
+ };
31
+ }, [id, timeout]);
32
+ const backgroundColor = (0, _figmaVariablesResolver.getVariableByName)('toast/background', modes) || '#303338';
33
+ const foreground = (0, _figmaVariablesResolver.getVariableByName)('toast/foreground', modes) || '#ffffff';
34
+ const fontSize = (0, _figmaVariablesResolver.getVariableByName)('toast/fontSize', modes) || 14;
35
+ const fontFamily = (0, _figmaVariablesResolver.getVariableByName)('toast/fontFamily', modes) || undefined;
36
+ const fontWeight = (0, _figmaVariablesResolver.getVariableByName)('toast/fontWeight', modes) || '500';
37
+ const lineHeight = (0, _figmaVariablesResolver.getVariableByName)('toast/lineHeight', modes) || 18;
38
+ const radius = (0, _figmaVariablesResolver.getVariableByName)('toast/radius', modes) || 14;
39
+ const paddingHorizontal = (0, _figmaVariablesResolver.getVariableByName)('toast/padding/horizontal', modes) || 16;
40
+ const paddingVertical = (0, _figmaVariablesResolver.getVariableByName)('toast/padding/vertical', modes) || 14;
41
+ const gap = (0, _figmaVariablesResolver.getVariableByName)('toast/gap', modes) || 8;
42
+ const borderWidth = (0, _figmaVariablesResolver.getVariableByName)('toast/border/size', modes) || 1;
43
+ const borderColor = (0, _figmaVariablesResolver.getVariableByName)('toast/border/color', modes) || 'rgba(255,255,255,0.1)';
44
+ const shadowBlurPrimary = (0, _figmaVariablesResolver.getVariableByName)('toast/shadow/primary/blur', modes) || 48;
45
+ const shadowOffsetYPrimary = (0, _figmaVariablesResolver.getVariableByName)('toast/shadow/primary/offsetY', modes) || 16;
46
+ const shadowColorPrimary = (0, _figmaVariablesResolver.getVariableByName)('toast/shadow/primary/color', modes) || 'rgba(13,13,15,0.16)';
47
+ const enterAnimation = placement === 'top' ? _reactNativeReanimated.SlideInUp.duration(ANIMATION_DURATION) : _reactNativeReanimated.SlideInDown.duration(ANIMATION_DURATION);
48
+ const containerStyle = {
49
+ backgroundColor,
50
+ borderRadius: radius,
51
+ paddingHorizontal,
52
+ paddingVertical,
53
+ gap,
54
+ borderWidth,
55
+ borderColor,
56
+ shadowColor: shadowColorPrimary,
57
+ shadowOffset: {
58
+ width: 0,
59
+ height: shadowOffsetYPrimary
60
+ },
61
+ shadowOpacity: 1,
62
+ shadowRadius: shadowBlurPrimary / 2,
63
+ elevation: 8
64
+ };
65
+ const textStyle = {
66
+ color: foreground,
67
+ fontSize,
68
+ fontFamily,
69
+ fontWeight: String(fontWeight),
70
+ lineHeight
71
+ };
72
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNativeReanimated.default.View, {
73
+ entering: enterAnimation,
74
+ exiting: _reactNativeReanimated.FadeOut.duration(ANIMATION_DURATION),
75
+ style: [styles.toast, containerStyle, style],
76
+ accessibilityRole: "alert",
77
+ accessibilityLiveRegion: "assertive",
78
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
79
+ style: textStyle,
80
+ numberOfLines: 2,
81
+ children: title
82
+ })
83
+ });
84
+ }
85
+ const styles = _reactNative.StyleSheet.create({
86
+ toast: {
87
+ alignSelf: 'center',
88
+ maxWidth: '90%',
89
+ minWidth: 200,
90
+ overflow: 'hidden'
91
+ }
92
+ });
93
+ var _default = exports.default = Toast;
@@ -0,0 +1,61 @@
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 _reactNativeSafeAreaContext = require("react-native-safe-area-context");
10
+ var _useToast = require("./useToast");
11
+ var _Toast = _interopRequireDefault(require("./Toast"));
12
+ var _jsxRuntime = require("react/jsx-runtime");
13
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
14
+ 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); }
15
+ function ToastProvider({
16
+ children,
17
+ maxVisibleToasts = 3,
18
+ placement = 'bottom',
19
+ modes
20
+ }) {
21
+ const {
22
+ toasts
23
+ } = (0, _useToast.useToast)();
24
+ const insets = (0, _reactNativeSafeAreaContext.useSafeAreaInsets)();
25
+ const visibleToasts = (0, _react.useMemo)(() => toasts.slice(-maxVisibleToasts), [toasts, maxVisibleToasts]);
26
+ const regionStyle = (0, _react.useMemo)(() => [styles.region, placement === 'top' ? {
27
+ top: insets.top + 8
28
+ } : {
29
+ bottom: insets.bottom + 8
30
+ }], [placement, insets.top, insets.bottom]);
31
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
32
+ style: styles.container,
33
+ children: [children, visibleToasts.length > 0 && /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
34
+ style: regionStyle,
35
+ pointerEvents: "box-none",
36
+ children: visibleToasts.map(entry => /*#__PURE__*/(0, _jsxRuntime.jsx)(_Toast.default, {
37
+ id: entry.id,
38
+ title: entry.title,
39
+ timeout: entry.timeout,
40
+ onClose: entry.onClose,
41
+ modes: entry.modes ?? modes,
42
+ placement: placement
43
+ }, entry.id))
44
+ })]
45
+ });
46
+ }
47
+ const styles = _reactNative.StyleSheet.create({
48
+ container: {
49
+ flex: 1
50
+ },
51
+ region: {
52
+ position: 'absolute',
53
+ left: 0,
54
+ right: 0,
55
+ alignItems: 'center',
56
+ gap: 8,
57
+ zIndex: 9999,
58
+ pointerEvents: 'box-none'
59
+ }
60
+ });
61
+ var _default = exports.default = ToastProvider;
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.addToast = addToast;
7
+ exports.closeAll = closeAll;
8
+ exports.closeToast = closeToast;
9
+ exports.useToast = useToast;
10
+ var _react = require("react");
11
+ let idCounter = 0;
12
+ let toasts = [];
13
+ const listeners = new Set();
14
+ function emit() {
15
+ for (const listener of listeners) {
16
+ listener();
17
+ }
18
+ }
19
+ function getSnapshot() {
20
+ return toasts;
21
+ }
22
+ function subscribe(listener) {
23
+ listeners.add(listener);
24
+ return () => {
25
+ listeners.delete(listener);
26
+ };
27
+ }
28
+ function addToast(options) {
29
+ const id = `toast-${++idCounter}`;
30
+ const entry = {
31
+ id,
32
+ title: options.title,
33
+ timeout: options.timeout ?? 4000,
34
+ onClose: options.onClose,
35
+ modes: options.modes
36
+ };
37
+ toasts = [...toasts, entry];
38
+ emit();
39
+ return id;
40
+ }
41
+ function closeToast(id) {
42
+ const entry = toasts.find(t => t.id === id);
43
+ toasts = toasts.filter(t => t.id !== id);
44
+ emit();
45
+ entry?.onClose?.();
46
+ }
47
+ function closeAll() {
48
+ const prev = toasts;
49
+ toasts = [];
50
+ emit();
51
+ prev.forEach(t => t.onClose?.());
52
+ }
53
+ function useToast() {
54
+ const queue = (0, _react.useSyncExternalStore)(subscribe, getSnapshot, getSnapshot);
55
+ return {
56
+ toasts: queue,
57
+ addToast: (0, _react.useCallback)(addToast, []),
58
+ closeToast: (0, _react.useCallback)(closeToast, []),
59
+ closeAll: (0, _react.useCallback)(closeAll, [])
60
+ };
61
+ }
@@ -135,6 +135,18 @@ Object.defineProperty(exports, "FilterBar", {
135
135
  return _FilterBar.default;
136
136
  }
137
137
  });
138
+ Object.defineProperty(exports, "Form", {
139
+ enumerable: true,
140
+ get: function () {
141
+ return _Form.default;
142
+ }
143
+ });
144
+ Object.defineProperty(exports, "FormField", {
145
+ enumerable: true,
146
+ get: function () {
147
+ return _FormField.default;
148
+ }
149
+ });
138
150
  Object.defineProperty(exports, "HStack", {
139
151
  enumerable: true,
140
152
  get: function () {
@@ -267,6 +279,18 @@ Object.defineProperty(exports, "ThreadHero", {
267
279
  return _ThreadHero.default;
268
280
  }
269
281
  });
282
+ Object.defineProperty(exports, "Toast", {
283
+ enumerable: true,
284
+ get: function () {
285
+ return _Toast.default;
286
+ }
287
+ });
288
+ Object.defineProperty(exports, "ToastProvider", {
289
+ enumerable: true,
290
+ get: function () {
291
+ return _ToastProvider.default;
292
+ }
293
+ });
270
294
  Object.defineProperty(exports, "Tooltip", {
271
295
  enumerable: true,
272
296
  get: function () {
@@ -297,6 +321,36 @@ Object.defineProperty(exports, "VStack", {
297
321
  return _VStack.default;
298
322
  }
299
323
  });
324
+ Object.defineProperty(exports, "addToast", {
325
+ enumerable: true,
326
+ get: function () {
327
+ return _useToast.addToast;
328
+ }
329
+ });
330
+ Object.defineProperty(exports, "closeAll", {
331
+ enumerable: true,
332
+ get: function () {
333
+ return _useToast.closeAll;
334
+ }
335
+ });
336
+ Object.defineProperty(exports, "closeToast", {
337
+ enumerable: true,
338
+ get: function () {
339
+ return _useToast.closeToast;
340
+ }
341
+ });
342
+ Object.defineProperty(exports, "useFormContext", {
343
+ enumerable: true,
344
+ get: function () {
345
+ return _Form.useFormContext;
346
+ }
347
+ });
348
+ Object.defineProperty(exports, "useToast", {
349
+ enumerable: true,
350
+ get: function () {
351
+ return _useToast.useToast;
352
+ }
353
+ });
300
354
  var _ActionFooter = _interopRequireDefault(require("./ActionFooter/ActionFooter"));
301
355
  var _AppBar = _interopRequireDefault(require("./AppBar/AppBar"));
302
356
  var _Avatar = _interopRequireDefault(require("./Avatar/Avatar"));
@@ -312,6 +366,8 @@ var _Divider = _interopRequireDefault(require("./Divider/Divider"));
312
366
  var _Drawer = _interopRequireDefault(require("./Drawer/Drawer"));
313
367
  var _CtaCard = _interopRequireDefault(require("./CtaCard/CtaCard"));
314
368
  var _FilterBar = _interopRequireDefault(require("./FilterBar/FilterBar"));
369
+ var _Form = _interopRequireWildcard(require("./Form/Form"));
370
+ var _FormField = _interopRequireDefault(require("./FormField/FormField"));
315
371
  var _HStack = _interopRequireDefault(require("./HStack/HStack"));
316
372
  var _IconButton = _interopRequireDefault(require("./IconButton/IconButton"));
317
373
  var _IconCapsule = _interopRequireDefault(require("./IconCapsule/IconCapsule"));
@@ -346,4 +402,8 @@ var _InputSearch = _interopRequireDefault(require("./InputSearch/InputSearch"));
346
402
  var _SupportText = _interopRequireDefault(require("./SupportText/SupportText"));
347
403
  var _SupportTextIcon = _interopRequireDefault(require("./SupportText/SupportTextIcon"));
348
404
  var _RadioButton = _interopRequireDefault(require("./RadioButton/RadioButton"));
405
+ var _Toast = _interopRequireDefault(require("./Toast/Toast"));
406
+ var _ToastProvider = _interopRequireDefault(require("./Toast/ToastProvider"));
407
+ var _useToast = require("./Toast/useToast");
408
+ 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); }
349
409
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }