jfs-components 0.1.23 → 0.1.28
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/CHANGELOG.md +40 -0
- package/lib/commonjs/components/AutoplayControl/AutoplayControl.js +66 -0
- package/lib/commonjs/components/CardCTA/CardCTA.js +32 -25
- package/lib/commonjs/components/Carousel/Carousel.js +112 -19
- package/lib/commonjs/components/ChipSelect/ChipSelect.js +2 -1
- package/lib/commonjs/components/ContentSheet/ContentSheet.js +39 -5
- package/lib/commonjs/components/FormUpload/Additem.js +168 -0
- package/lib/commonjs/components/FormUpload/FormUpload.js +198 -0
- package/lib/commonjs/components/Grid/Grid.js +206 -0
- package/lib/commonjs/components/ListItem/ListItem.js +11 -4
- package/lib/commonjs/components/MetricData/MetricData.js +132 -0
- package/lib/commonjs/components/NumberPagination/NumberPagination.js +144 -0
- package/lib/commonjs/components/ProfileCard/ProfileCard.js +208 -0
- package/lib/commonjs/components/Rating/Rating.js +137 -0
- package/lib/commonjs/components/UpiHandle/UpiHandle.js +23 -11
- package/lib/commonjs/components/index.js +42 -0
- package/lib/commonjs/design-tokens/Coin Variables-variables-full.json +1 -1
- package/lib/commonjs/design-tokens/figma-modes.generated.js +23 -10
- package/lib/commonjs/icons/components/IconBrokenimage.js +19 -0
- package/lib/commonjs/icons/components/IconImage.js +19 -0
- package/lib/commonjs/icons/components/IconMic.js +19 -0
- package/lib/commonjs/icons/components/IconMicoff.js +19 -0
- package/lib/commonjs/icons/components/IconPause.js +19 -0
- package/lib/commonjs/icons/components/IconPlay.js +19 -0
- package/lib/commonjs/icons/components/index.js +66 -0
- package/lib/commonjs/icons/registry.js +2 -2
- package/lib/module/components/AutoplayControl/AutoplayControl.js +60 -0
- package/lib/module/components/CardCTA/CardCTA.js +32 -25
- package/lib/module/components/Carousel/Carousel.js +111 -19
- package/lib/module/components/ChipSelect/ChipSelect.js +2 -1
- package/lib/module/components/ContentSheet/ContentSheet.js +41 -7
- package/lib/module/components/FormUpload/Additem.js +162 -0
- package/lib/module/components/FormUpload/FormUpload.js +192 -0
- package/lib/module/components/Grid/Grid.js +201 -0
- package/lib/module/components/ListItem/ListItem.js +11 -4
- package/lib/module/components/MetricData/MetricData.js +127 -0
- package/lib/module/components/NumberPagination/NumberPagination.js +138 -0
- package/lib/module/components/ProfileCard/ProfileCard.js +202 -0
- package/lib/module/components/Rating/Rating.js +132 -0
- package/lib/module/components/UpiHandle/UpiHandle.js +23 -11
- package/lib/module/components/index.js +7 -1
- package/lib/module/design-tokens/Coin Variables-variables-full.json +1 -1
- package/lib/module/design-tokens/figma-modes.generated.js +23 -10
- package/lib/module/icons/components/IconBrokenimage.js +12 -0
- package/lib/module/icons/components/IconImage.js +12 -0
- package/lib/module/icons/components/IconMic.js +12 -0
- package/lib/module/icons/components/IconMicoff.js +12 -0
- package/lib/module/icons/components/IconPause.js +12 -0
- package/lib/module/icons/components/IconPlay.js +12 -0
- package/lib/module/icons/components/index.js +6 -0
- package/lib/module/icons/registry.js +2 -2
- package/lib/typescript/src/components/AutoplayControl/AutoplayControl.d.ts +15 -0
- package/lib/typescript/src/components/Carousel/Carousel.d.ts +8 -1
- package/lib/typescript/src/components/ChipSelect/ChipSelect.d.ts +6 -1
- package/lib/typescript/src/components/ContentSheet/ContentSheet.d.ts +7 -1
- package/lib/typescript/src/components/FormUpload/Additem.d.ts +96 -0
- package/lib/typescript/src/components/FormUpload/FormUpload.d.ts +85 -0
- package/lib/typescript/src/components/Grid/Grid.d.ts +87 -0
- package/lib/typescript/src/components/MetricData/MetricData.d.ts +53 -0
- package/lib/typescript/src/components/NumberPagination/NumberPagination.d.ts +21 -0
- package/lib/typescript/src/components/ProfileCard/ProfileCard.d.ts +89 -0
- package/lib/typescript/src/components/Rating/Rating.d.ts +30 -0
- package/lib/typescript/src/components/UpiHandle/UpiHandle.d.ts +7 -1
- package/lib/typescript/src/components/index.d.ts +34 -28
- package/lib/typescript/src/design-tokens/figma-modes.generated.d.ts +10 -4
- package/lib/typescript/src/icons/components/IconBrokenimage.d.ts +3 -0
- package/lib/typescript/src/icons/components/IconImage.d.ts +3 -0
- package/lib/typescript/src/icons/components/IconMic.d.ts +3 -0
- package/lib/typescript/src/icons/components/IconMicoff.d.ts +3 -0
- package/lib/typescript/src/icons/components/IconPause.d.ts +3 -0
- package/lib/typescript/src/icons/components/IconPlay.d.ts +3 -0
- package/lib/typescript/src/icons/components/index.d.ts +6 -0
- package/lib/typescript/src/icons/registry.d.ts +1 -1
- package/package.json +1 -1
- package/src/components/AutoplayControl/AutoplayControl.tsx +77 -0
- package/src/components/CardCTA/CardCTA.tsx +30 -15
- package/src/components/Carousel/Carousel.tsx +133 -23
- package/src/components/ChipSelect/ChipSelect.tsx +7 -1
- package/src/components/ContentSheet/ContentSheet.tsx +50 -0
- package/src/components/FormUpload/Additem.tsx +262 -0
- package/src/components/FormUpload/FormUpload.tsx +313 -0
- package/src/components/Grid/Grid.tsx +368 -0
- package/src/components/ListItem/ListItem.tsx +11 -4
- package/src/components/MetricData/MetricData.tsx +185 -0
- package/src/components/NumberPagination/NumberPagination.tsx +170 -0
- package/src/components/ProfileCard/ProfileCard.tsx +268 -0
- package/src/components/Rating/Rating.tsx +174 -0
- package/src/components/UpiHandle/UpiHandle.tsx +35 -24
- package/src/components/index.ts +329 -182
- package/src/design-tokens/Coin Variables-variables-full.json +1 -1
- package/src/design-tokens/figma-modes.generated.ts +23 -10
- package/src/icons/components/IconBrokenimage.tsx +11 -0
- package/src/icons/components/IconImage.tsx +11 -0
- package/src/icons/components/IconMic.tsx +11 -0
- package/src/icons/components/IconMicoff.tsx +11 -0
- package/src/icons/components/IconPause.tsx +11 -0
- package/src/icons/components/IconPlay.tsx +11 -0
- package/src/icons/components/index.ts +6 -0
- package/src/icons/registry.ts +25 -1
|
@@ -0,0 +1,132 @@
|
|
|
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 _Icon = _interopRequireDefault(require("../Icon/Icon"));
|
|
12
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
13
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
|
+
const LINE_HEIGHT_RATIO = 1.2;
|
|
15
|
+
const ICON_SIZE = 18;
|
|
16
|
+
// Figma renders the value-row icon with no surrounding padding; the shared Icon
|
|
17
|
+
// component pulls padding from `icon/padding/*` tokens, so we zero it here.
|
|
18
|
+
const ICON_PADDING_RESET = {
|
|
19
|
+
paddingLeft: 0,
|
|
20
|
+
paddingRight: 0,
|
|
21
|
+
paddingTop: 0,
|
|
22
|
+
paddingBottom: 0
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* MetricData — a compact, centered metric block.
|
|
26
|
+
*
|
|
27
|
+
* Stacks a small `title`, a prominent `value` (with an optional leading
|
|
28
|
+
* `icon`), and a muted `caption`. Typography, colours, gaps and padding all
|
|
29
|
+
* resolve from the `metricdata/*` design tokens. `title`, `caption` and `icon`
|
|
30
|
+
* are optional; only `value` is shown by default.
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```tsx
|
|
34
|
+
* <MetricData title="Balance" value="₹1,20,000" caption="as of today" />
|
|
35
|
+
* <MetricData title="Cards" value="12" icon="ic_card" caption="active" />
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
function MetricData({
|
|
39
|
+
title,
|
|
40
|
+
value,
|
|
41
|
+
caption,
|
|
42
|
+
icon,
|
|
43
|
+
modes = _reactUtils.EMPTY_MODES,
|
|
44
|
+
style,
|
|
45
|
+
titleStyle,
|
|
46
|
+
valueStyle,
|
|
47
|
+
captionStyle,
|
|
48
|
+
accessibilityLabel
|
|
49
|
+
}) {
|
|
50
|
+
const titleColor = (0, _figmaVariablesResolver.getVariableByName)('metricdata/title/color', modes) ?? '#000000';
|
|
51
|
+
const titleFontFamily = (0, _figmaVariablesResolver.getVariableByName)('metricdata/title/fontfamily', modes) ?? 'JioType Var';
|
|
52
|
+
const titleFontSize = (0, _figmaVariablesResolver.getVariableByName)('metricdata/title/fontsize', modes) ?? 12;
|
|
53
|
+
const titleFontWeight = String((0, _figmaVariablesResolver.getVariableByName)('metricdata/title/fontweight', modes) ?? 400);
|
|
54
|
+
const valueColor = (0, _figmaVariablesResolver.getVariableByName)('metricdata/value/color', modes) ?? '#000000';
|
|
55
|
+
const valueFontFamily = (0, _figmaVariablesResolver.getVariableByName)('metricdata/value/fontfamily', modes) ?? 'JioType Var';
|
|
56
|
+
const valueFontSize = (0, _figmaVariablesResolver.getVariableByName)('metricdata/value/fontsize', modes) ?? 20;
|
|
57
|
+
const valueFontWeight = String((0, _figmaVariablesResolver.getVariableByName)('metricdata/value/fontweight', modes) ?? 700);
|
|
58
|
+
const captionColor = (0, _figmaVariablesResolver.getVariableByName)('metricdata/caption/color', modes) ?? '#777777';
|
|
59
|
+
const captionFontFamily = (0, _figmaVariablesResolver.getVariableByName)('metricdata/caption/fontfamily', modes) ?? 'JioType Var';
|
|
60
|
+
const captionFontSize = (0, _figmaVariablesResolver.getVariableByName)('metricdata/caption/fontsize', modes) ?? 12;
|
|
61
|
+
const captionFontWeight = String((0, _figmaVariablesResolver.getVariableByName)('metricdata/caption/fontweight', modes) ?? 500);
|
|
62
|
+
const gap = (0, _figmaVariablesResolver.getVariableByName)('metricdata/gap', modes) ?? 4;
|
|
63
|
+
const valueWrapGap = (0, _figmaVariablesResolver.getVariableByName)('metricdata/valueWrap/gap', modes) ?? 4;
|
|
64
|
+
const paddingHorizontal = (0, _figmaVariablesResolver.getVariableByName)('metricdata/padding/horizontal', modes) ?? 10;
|
|
65
|
+
const paddingVertical = (0, _figmaVariablesResolver.getVariableByName)('metricdata/padding/vertical', modes) ?? 10;
|
|
66
|
+
const containerStyle = {
|
|
67
|
+
flexDirection: 'column',
|
|
68
|
+
alignItems: 'center',
|
|
69
|
+
justifyContent: 'center',
|
|
70
|
+
gap,
|
|
71
|
+
paddingHorizontal,
|
|
72
|
+
paddingVertical
|
|
73
|
+
};
|
|
74
|
+
const titleTextStyle = {
|
|
75
|
+
color: titleColor,
|
|
76
|
+
fontFamily: titleFontFamily,
|
|
77
|
+
fontSize: titleFontSize,
|
|
78
|
+
fontWeight: titleFontWeight,
|
|
79
|
+
lineHeight: titleFontSize * LINE_HEIGHT_RATIO,
|
|
80
|
+
textAlign: 'center'
|
|
81
|
+
};
|
|
82
|
+
const valueTextStyle = {
|
|
83
|
+
color: valueColor,
|
|
84
|
+
fontFamily: valueFontFamily,
|
|
85
|
+
fontSize: valueFontSize,
|
|
86
|
+
fontWeight: valueFontWeight,
|
|
87
|
+
lineHeight: valueFontSize * LINE_HEIGHT_RATIO,
|
|
88
|
+
textAlign: 'center'
|
|
89
|
+
};
|
|
90
|
+
const captionTextStyle = {
|
|
91
|
+
color: captionColor,
|
|
92
|
+
fontFamily: captionFontFamily,
|
|
93
|
+
fontSize: captionFontSize,
|
|
94
|
+
fontWeight: captionFontWeight,
|
|
95
|
+
lineHeight: captionFontSize * LINE_HEIGHT_RATIO,
|
|
96
|
+
textAlign: 'center'
|
|
97
|
+
};
|
|
98
|
+
const iconNode = icon == null ? null : typeof icon === 'string' ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_Icon.default, {
|
|
99
|
+
iconName: icon,
|
|
100
|
+
size: ICON_SIZE,
|
|
101
|
+
color: valueColor,
|
|
102
|
+
modes: modes,
|
|
103
|
+
style: ICON_PADDING_RESET
|
|
104
|
+
}) : icon;
|
|
105
|
+
const resolvedLabel = accessibilityLabel ?? ([title, typeof value === 'string' ? value : undefined, caption].filter(Boolean).join(', ') || undefined);
|
|
106
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
107
|
+
style: [containerStyle, style],
|
|
108
|
+
accessible: true,
|
|
109
|
+
...(resolvedLabel !== undefined ? {
|
|
110
|
+
accessibilityLabel: resolvedLabel
|
|
111
|
+
} : null),
|
|
112
|
+
children: [title !== undefined && title !== '' ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
113
|
+
style: [titleTextStyle, titleStyle],
|
|
114
|
+
children: title
|
|
115
|
+
}) : null, /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
116
|
+
style: {
|
|
117
|
+
flexDirection: 'row',
|
|
118
|
+
alignItems: 'center',
|
|
119
|
+
justifyContent: 'center',
|
|
120
|
+
gap: valueWrapGap
|
|
121
|
+
},
|
|
122
|
+
children: [iconNode, typeof value === 'string' ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
123
|
+
style: [valueTextStyle, valueStyle],
|
|
124
|
+
children: value
|
|
125
|
+
}) : value]
|
|
126
|
+
}), caption !== undefined && caption !== '' ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
127
|
+
style: [captionTextStyle, captionStyle],
|
|
128
|
+
children: caption
|
|
129
|
+
}) : null]
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
var _default = exports.default = /*#__PURE__*/_react.default.memo(MetricData);
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = NumberPagination;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _reactNative = require("react-native");
|
|
9
|
+
var _figmaVariablesResolver = require("../../design-tokens/figma-variables-resolver");
|
|
10
|
+
var _GlassFill = _interopRequireDefault(require("../../utils/GlassFill/GlassFill"));
|
|
11
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
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
|
+
function resolveNumberPaginationTokens(modes) {
|
|
15
|
+
const horizontalPadding = (0, _figmaVariablesResolver.getVariableByName)('numberPagination/padding/horizontal', modes) ?? 4;
|
|
16
|
+
const verticalPadding = (0, _figmaVariablesResolver.getVariableByName)('numberPagination/padding/vertical', modes) ?? 4;
|
|
17
|
+
const radiusRaw = (0, _figmaVariablesResolver.getVariableByName)('numberPagination/radius', modes) ?? 9999;
|
|
18
|
+
const backgroundColor = (0, _figmaVariablesResolver.getVariableByName)('numberPagination/background/color', modes) ?? 'rgba(141, 141, 141, 0.4)';
|
|
19
|
+
const borderColor = (0, _figmaVariablesResolver.getVariableByName)('numberPagination/border/color', modes) ?? 'rgba(255, 255, 255, 0.15)';
|
|
20
|
+
|
|
21
|
+
// control number variables
|
|
22
|
+
const itemWidth = (0, _figmaVariablesResolver.getVariableByName)('controlNumber/width', modes) ?? 32;
|
|
23
|
+
const itemHeight = (0, _figmaVariablesResolver.getVariableByName)('controlNumber/height', modes) ?? 32;
|
|
24
|
+
const itemRadiusRaw = (0, _figmaVariablesResolver.getVariableByName)('controlNumber/radius', modes) ?? 9999;
|
|
25
|
+
const activeBgColor = (0, _figmaVariablesResolver.getVariableByName)('control/active/background/color', modes) ?? '#ffffff';
|
|
26
|
+
const activeTextColor = (0, _figmaVariablesResolver.getVariableByName)('control/active/text/color', modes) ?? '#000000';
|
|
27
|
+
const inactiveTextColor = (0, _figmaVariablesResolver.getVariableByName)('control/text/default', modes) ?? '#ffffff';
|
|
28
|
+
|
|
29
|
+
// typography variables
|
|
30
|
+
const fontFamily = (0, _figmaVariablesResolver.getVariableByName)('numberPagination/fontFamily', modes) ?? 'JioType';
|
|
31
|
+
const fontSize = (0, _figmaVariablesResolver.getVariableByName)('numberPagination/fontSize', modes) ?? 16;
|
|
32
|
+
const fontWeight = String((0, _figmaVariablesResolver.getVariableByName)('numberPagination/fontWeight', modes) ?? '500');
|
|
33
|
+
const lineHeight = (0, _figmaVariablesResolver.getVariableByName)('numberPagination/lineHeight', modes) ?? 18;
|
|
34
|
+
const blurMinimal = (0, _figmaVariablesResolver.getVariableByName)('blur/minimal', modes) ?? 29;
|
|
35
|
+
const blurIntensity = Math.max(0, Math.min(100, Math.round(Number(blurMinimal))));
|
|
36
|
+
const borderRadius = radiusRaw === 9999 ? 39 / 2 : radiusRaw;
|
|
37
|
+
const itemRadius = itemRadiusRaw === 9999 ? itemWidth / 2 : itemRadiusRaw;
|
|
38
|
+
return {
|
|
39
|
+
containerStyle: {
|
|
40
|
+
height: 39,
|
|
41
|
+
borderRadius,
|
|
42
|
+
borderWidth: 1,
|
|
43
|
+
borderColor,
|
|
44
|
+
backgroundColor: 'transparent',
|
|
45
|
+
overflow: 'hidden',
|
|
46
|
+
flexDirection: 'row',
|
|
47
|
+
alignItems: 'center',
|
|
48
|
+
paddingHorizontal: horizontalPadding,
|
|
49
|
+
paddingVertical: verticalPadding
|
|
50
|
+
},
|
|
51
|
+
activeItemStyle: {
|
|
52
|
+
width: itemWidth,
|
|
53
|
+
height: itemHeight,
|
|
54
|
+
borderRadius: itemRadius,
|
|
55
|
+
backgroundColor: activeBgColor,
|
|
56
|
+
alignItems: 'center',
|
|
57
|
+
justifyContent: 'center'
|
|
58
|
+
},
|
|
59
|
+
inactiveItemStyle: {
|
|
60
|
+
width: itemWidth,
|
|
61
|
+
height: itemHeight,
|
|
62
|
+
borderRadius: itemRadius,
|
|
63
|
+
backgroundColor: 'transparent',
|
|
64
|
+
alignItems: 'center',
|
|
65
|
+
justifyContent: 'center'
|
|
66
|
+
},
|
|
67
|
+
activeTextStyle: {
|
|
68
|
+
fontFamily,
|
|
69
|
+
fontSize,
|
|
70
|
+
fontWeight,
|
|
71
|
+
lineHeight,
|
|
72
|
+
color: activeTextColor,
|
|
73
|
+
textAlign: 'center'
|
|
74
|
+
},
|
|
75
|
+
inactiveTextStyle: {
|
|
76
|
+
fontFamily,
|
|
77
|
+
fontSize,
|
|
78
|
+
fontWeight,
|
|
79
|
+
lineHeight,
|
|
80
|
+
color: inactiveTextColor,
|
|
81
|
+
textAlign: 'center'
|
|
82
|
+
},
|
|
83
|
+
blurIntensity,
|
|
84
|
+
backgroundColor
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* NumberPagination component displays a horizontal list of page numbers on a frosted glass surface.
|
|
90
|
+
* All styling is driven by Figma design tokens with support for custom children slot.
|
|
91
|
+
*/
|
|
92
|
+
function NumberPagination({
|
|
93
|
+
activePage = 1,
|
|
94
|
+
totalPages = 1,
|
|
95
|
+
onPageChange,
|
|
96
|
+
children,
|
|
97
|
+
modes,
|
|
98
|
+
style
|
|
99
|
+
}) {
|
|
100
|
+
const tokens = (0, _react.useMemo)(() => resolveNumberPaginationTokens(modes ?? {}), [modes]);
|
|
101
|
+
const renderPages = () => {
|
|
102
|
+
if (children) {
|
|
103
|
+
return children;
|
|
104
|
+
}
|
|
105
|
+
const pages = [];
|
|
106
|
+
for (let i = 1; i <= totalPages; i++) {
|
|
107
|
+
const active = i === activePage;
|
|
108
|
+
pages.push(/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Pressable, {
|
|
109
|
+
onPress: () => onPageChange?.(i),
|
|
110
|
+
style: ({
|
|
111
|
+
pressed
|
|
112
|
+
}) => [active ? tokens.activeItemStyle : tokens.inactiveItemStyle, pressed && {
|
|
113
|
+
opacity: 0.7
|
|
114
|
+
}],
|
|
115
|
+
accessibilityRole: "button",
|
|
116
|
+
accessibilityState: {
|
|
117
|
+
selected: active
|
|
118
|
+
},
|
|
119
|
+
accessibilityLabel: `Page ${i}`,
|
|
120
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
121
|
+
style: active ? tokens.activeTextStyle : tokens.inactiveTextStyle,
|
|
122
|
+
children: i
|
|
123
|
+
})
|
|
124
|
+
}, i));
|
|
125
|
+
}
|
|
126
|
+
return pages;
|
|
127
|
+
};
|
|
128
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
129
|
+
style: [tokens.containerStyle, style],
|
|
130
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_GlassFill.default, {
|
|
131
|
+
tint: "light",
|
|
132
|
+
intensity: tokens.blurIntensity,
|
|
133
|
+
overlayColor: tokens.backgroundColor,
|
|
134
|
+
androidTintWash: false
|
|
135
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
136
|
+
style: {
|
|
137
|
+
flexDirection: 'row',
|
|
138
|
+
alignItems: 'center',
|
|
139
|
+
height: '100%'
|
|
140
|
+
},
|
|
141
|
+
children: renderPages()
|
|
142
|
+
})]
|
|
143
|
+
});
|
|
144
|
+
}
|
|
@@ -0,0 +1,208 @@
|
|
|
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 _reactUtils = require("../../utils/react-utils");
|
|
12
|
+
var _Avatar = _interopRequireDefault(require("../Avatar/Avatar"));
|
|
13
|
+
var _Attached = _interopRequireDefault(require("../Attached/Attached"));
|
|
14
|
+
var _IconCapsule = _interopRequireDefault(require("../IconCapsule/IconCapsule"));
|
|
15
|
+
var _ListItem = _interopRequireDefault(require("../ListItem/ListItem"));
|
|
16
|
+
var _UpiHandle = _interopRequireDefault(require("../UpiHandle/UpiHandle"));
|
|
17
|
+
var _Divider = _interopRequireDefault(require("../Divider/Divider"));
|
|
18
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
19
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
20
|
+
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); }
|
|
21
|
+
/**
|
|
22
|
+
* A single UPI handle pill rendered under the profile name.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
// Forced modes for everything rendered inside the card — the profile card is
|
|
26
|
+
// an on-dark (jioPlus) surface, so child components (Avatar, UpiHandle,
|
|
27
|
+
// ListItem, Divider, Text, Button, …) must resolve their tokens through the
|
|
28
|
+
// `context 10: jioPlus` mode. Consumer modes are spread first so appearance
|
|
29
|
+
// modes (e.g. `Profile Card Appearance: Premium`) still cascade through.
|
|
30
|
+
const CARD_CONTEXT = Object.freeze({
|
|
31
|
+
'context 10': 'jioPlus'
|
|
32
|
+
});
|
|
33
|
+
const DEFAULT_UPI_HANDLES = [{
|
|
34
|
+
label: 'username@jio',
|
|
35
|
+
iconName: 'ic_copy'
|
|
36
|
+
}, {
|
|
37
|
+
label: '9999999999',
|
|
38
|
+
iconName: 'ic_confirm'
|
|
39
|
+
}];
|
|
40
|
+
function resolveProfileCardTokens(modes) {
|
|
41
|
+
const backgroundColor = (0, _figmaVariablesResolver.getVariableByName)('profileCard/bg', modes) ?? '#00065a';
|
|
42
|
+
const gap = (0, _figmaVariablesResolver.getVariableByName)('profileCard/gap', modes) ?? 12;
|
|
43
|
+
const borderRadius = (0, _figmaVariablesResolver.getVariableByName)('profileCard/radius', modes) ?? 12;
|
|
44
|
+
const paddingHorizontal = (0, _figmaVariablesResolver.getVariableByName)('profileCard/padding/horizontal', modes) ?? 20;
|
|
45
|
+
const paddingVertical = (0, _figmaVariablesResolver.getVariableByName)('profileCard/padding/vertical', modes) ?? 20;
|
|
46
|
+
const childModes = {
|
|
47
|
+
...modes,
|
|
48
|
+
...CARD_CONTEXT
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
// The UPI handle pills sit in the header ListItem's support slot, whose row
|
|
52
|
+
// gap is the `slot/gap` token in the ListItem context.
|
|
53
|
+
const handlesGap = (0, _figmaVariablesResolver.getVariableByName)('slot/gap', {
|
|
54
|
+
...childModes,
|
|
55
|
+
Context: 'ListItem'
|
|
56
|
+
}) ?? 2;
|
|
57
|
+
|
|
58
|
+
// The avatar badge is a white circle: the fill comes from the Attached
|
|
59
|
+
// slot's background token (the IconCapsule itself resolves transparent).
|
|
60
|
+
const badgeBackground = (0, _figmaVariablesResolver.getVariableByName)('attached/slot/background', childModes) ?? '#ffffff';
|
|
61
|
+
return {
|
|
62
|
+
containerStyle: {
|
|
63
|
+
backgroundColor,
|
|
64
|
+
borderRadius,
|
|
65
|
+
paddingHorizontal,
|
|
66
|
+
paddingVertical,
|
|
67
|
+
gap,
|
|
68
|
+
flexDirection: 'column',
|
|
69
|
+
alignItems: 'stretch'
|
|
70
|
+
},
|
|
71
|
+
handlesRowStyle: {
|
|
72
|
+
flexDirection: 'row',
|
|
73
|
+
flexWrap: 'wrap',
|
|
74
|
+
alignItems: 'center',
|
|
75
|
+
alignSelf: 'flex-start',
|
|
76
|
+
gap: handlesGap
|
|
77
|
+
},
|
|
78
|
+
badgeBackground,
|
|
79
|
+
childModes,
|
|
80
|
+
// XS capsule per the Figma spec; consumers can still override the size
|
|
81
|
+
// through their own modes.
|
|
82
|
+
badgeModes: {
|
|
83
|
+
'Icon Capsule Size': 'XS',
|
|
84
|
+
...modes,
|
|
85
|
+
...CARD_CONTEXT
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* ProfileCard — Figma node 6914:38498 ("Profile Card").
|
|
92
|
+
*
|
|
93
|
+
* A dark, rounded profile summary card composed from the shared primitives:
|
|
94
|
+
*
|
|
95
|
+
* - **Header** — a {@link ListItem} whose leading slot is an {@link Attached}
|
|
96
|
+
* monogram {@link Avatar} with a small {@link IconCapsule} badge at its
|
|
97
|
+
* bottom-right, the user's name as the title, and a row of
|
|
98
|
+
* {@link UpiHandle} pills in the support slot.
|
|
99
|
+
* - **Divider** — separates the header from the body.
|
|
100
|
+
* - **Body slot** — arbitrary children (typically `ListItem`s separated by
|
|
101
|
+
* `Divider`s). All profile-card context modes cascade into the slot, so
|
|
102
|
+
* nested components automatically resolve their on-dark token values.
|
|
103
|
+
*
|
|
104
|
+
* The card supports the `Profile Card Appearance` collection
|
|
105
|
+
* (`Default` | `Premium`) via the `modes` prop, which recolors the container,
|
|
106
|
+
* avatar, pills and divider in one go.
|
|
107
|
+
*
|
|
108
|
+
* @example
|
|
109
|
+
* ```tsx
|
|
110
|
+
* <ProfileCard
|
|
111
|
+
* name="Shruti Chandarshekhar Rai"
|
|
112
|
+
* monogram="SR"
|
|
113
|
+
* upiHandles={[
|
|
114
|
+
* { label: 'shrutirai-1@jio', iconName: 'ic_copy', onPress: copyHandle },
|
|
115
|
+
* { label: '9184844184', iconName: 'ic_confirm' },
|
|
116
|
+
* ]}
|
|
117
|
+
* >
|
|
118
|
+
* <ListItem layout="Horizontal" title="JioFinance+" navArrow={false} />
|
|
119
|
+
* </ProfileCard>
|
|
120
|
+
* ```
|
|
121
|
+
*/
|
|
122
|
+
function ProfileCard({
|
|
123
|
+
name = 'Name',
|
|
124
|
+
monogram = 'MS',
|
|
125
|
+
avatarSource,
|
|
126
|
+
badgeIcon = 'ic_qr_code',
|
|
127
|
+
upiHandles = DEFAULT_UPI_HANDLES,
|
|
128
|
+
header,
|
|
129
|
+
children,
|
|
130
|
+
showDivider = true,
|
|
131
|
+
width = 344,
|
|
132
|
+
modes: propModes = _reactUtils.EMPTY_MODES,
|
|
133
|
+
style,
|
|
134
|
+
accessibilityLabel
|
|
135
|
+
}) {
|
|
136
|
+
const {
|
|
137
|
+
modes: globalModes
|
|
138
|
+
} = (0, _JFSThemeProvider.useTokens)();
|
|
139
|
+
const modes = (0, _react.useMemo)(() => globalModes === _reactUtils.EMPTY_MODES && propModes === _reactUtils.EMPTY_MODES ? _reactUtils.EMPTY_MODES : {
|
|
140
|
+
...globalModes,
|
|
141
|
+
...propModes
|
|
142
|
+
}, [globalModes, propModes]);
|
|
143
|
+
const tokens = (0, _react.useMemo)(() => resolveProfileCardTokens(modes), [modes]);
|
|
144
|
+
|
|
145
|
+
// ---- Header -------------------------------------------------------------
|
|
146
|
+
const headerNode = (0, _react.useMemo)(() => {
|
|
147
|
+
if (header) return (0, _reactUtils.cloneChildrenWithModes)(header, tokens.childModes);
|
|
148
|
+
const avatar = /*#__PURE__*/(0, _jsxRuntime.jsx)(_Attached.default, {
|
|
149
|
+
position: "bottom-right",
|
|
150
|
+
modes: tokens.childModes,
|
|
151
|
+
badge: badgeIcon != null ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_IconCapsule.default, {
|
|
152
|
+
iconName: badgeIcon,
|
|
153
|
+
modes: tokens.badgeModes,
|
|
154
|
+
style: {
|
|
155
|
+
backgroundColor: tokens.badgeBackground
|
|
156
|
+
}
|
|
157
|
+
}) : null,
|
|
158
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Avatar.default, {
|
|
159
|
+
monogram: monogram,
|
|
160
|
+
style: avatarSource ? 'Image' : 'Monogram',
|
|
161
|
+
...(avatarSource != null ? {
|
|
162
|
+
imageSource: avatarSource
|
|
163
|
+
} : {}),
|
|
164
|
+
modes: tokens.childModes
|
|
165
|
+
})
|
|
166
|
+
});
|
|
167
|
+
const handles = upiHandles.length > 0 ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
168
|
+
style: tokens.handlesRowStyle,
|
|
169
|
+
children: upiHandles.map((handle, index) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_UpiHandle.default, {
|
|
170
|
+
label: handle.label,
|
|
171
|
+
...(handle.iconName != null ? {
|
|
172
|
+
iconName: handle.iconName
|
|
173
|
+
} : {}),
|
|
174
|
+
showIcon: handle.showIcon ?? true,
|
|
175
|
+
...(handle.onPress != null ? {
|
|
176
|
+
onPress: handle.onPress
|
|
177
|
+
} : {}),
|
|
178
|
+
modes: tokens.childModes
|
|
179
|
+
}, `${handle.label}-${index}`))
|
|
180
|
+
}) : null;
|
|
181
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ListItem.default, {
|
|
182
|
+
layout: "Horizontal",
|
|
183
|
+
title: name,
|
|
184
|
+
navArrow: false,
|
|
185
|
+
showSupportText: handles != null,
|
|
186
|
+
supportSlot: handles,
|
|
187
|
+
leading: avatar,
|
|
188
|
+
modes: tokens.childModes
|
|
189
|
+
});
|
|
190
|
+
}, [header, name, monogram, avatarSource, badgeIcon, upiHandles, tokens]);
|
|
191
|
+
|
|
192
|
+
// ---- Body slot ----------------------------------------------------------
|
|
193
|
+
const bodyChildren = (0, _react.useMemo)(() => children != null ? (0, _reactUtils.cloneChildrenWithModes)(children, tokens.childModes) : null, [children, tokens.childModes]);
|
|
194
|
+
const hasBody = bodyChildren != null && bodyChildren.length > 0;
|
|
195
|
+
const containerStyle = (0, _react.useMemo)(() => ({
|
|
196
|
+
...tokens.containerStyle,
|
|
197
|
+
width
|
|
198
|
+
}), [tokens.containerStyle, width]);
|
|
199
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
200
|
+
style: [containerStyle, style],
|
|
201
|
+
accessibilityLabel: accessibilityLabel,
|
|
202
|
+
children: [headerNode, hasBody && showDivider ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_Divider.default, {
|
|
203
|
+
direction: "horizontal",
|
|
204
|
+
modes: tokens.childModes
|
|
205
|
+
}) : null, bodyChildren]
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
var _default = exports.default = /*#__PURE__*/_react.default.memo(ProfileCard);
|
|
@@ -0,0 +1,137 @@
|
|
|
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 _reactNativeSvg = _interopRequireWildcard(require("react-native-svg"));
|
|
10
|
+
var _figmaVariablesResolver = require("../../design-tokens/figma-variables-resolver");
|
|
11
|
+
var _JFSThemeProvider = require("../../design-tokens/JFSThemeProvider");
|
|
12
|
+
var _reactUtils = require("../../utils/react-utils");
|
|
13
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
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
|
+
/**
|
|
16
|
+
* Star glyph taken directly from the Figma `Rating` component. Filled and empty
|
|
17
|
+
* stars share this shape and differ only by fill color, so a single path keeps
|
|
18
|
+
* the row perfectly aligned.
|
|
19
|
+
*/
|
|
20
|
+
const STAR_PATH = 'M40.7187 15.3334C40.4728 14.6159 40.0426 13.9805 39.4688 13.4885C38.8951 12.9965 38.1985 12.689 37.4403 12.566L28.3018 11.1721L24.2038 2.35741C23.8759 1.66044 23.3432 1.06596 22.6875 0.635476C22.0318 0.225491 21.2737 0 20.4951 0C19.7165 0 18.9583 0.225491 18.3027 0.635476C17.647 1.04546 17.1142 1.63994 16.7864 2.35741L12.6884 11.1721L3.4679 12.566C2.73026 12.689 2.01311 12.9965 1.43939 13.4885C0.865675 13.9805 0.435385 14.6159 0.189505 15.3334C-0.0358854 16.0304 -0.0563753 16.7889 0.107545 17.5063C0.271465 18.2238 0.640285 18.9003 1.15254 19.4333L7.89374 26.362L6.29552 36.1811C6.17258 36.9396 6.27503 37.7186 6.56189 38.4156C6.84875 39.1125 7.34051 39.7275 7.9757 40.1785C8.65187 40.691 9.49196 40.978 10.3525 40.9985C11.0697 40.9985 11.7664 40.8345 12.4015 40.486L20.5771 35.9761L28.7526 40.486C29.3673 40.8345 30.0844 41.019 30.8016 40.9985C31.6621 40.9985 32.4817 40.732 33.1784 40.24C33.7931 39.789 34.2849 39.1945 34.5922 38.4771C34.8791 37.7801 34.9815 37.0011 34.8586 36.2426L33.2604 26.4235L40.0016 19.4948C40.4933 18.9413 40.8007 18.2443 40.9441 17.5063C41.0671 16.7684 40.9851 16.0099 40.7187 15.3334Z';
|
|
21
|
+
const STAR_VIEWBOX = '0 0 41 41';
|
|
22
|
+
|
|
23
|
+
// Fallbacks mirror the Figma `Rating Star / Output` + `Rating Star State` tokens.
|
|
24
|
+
const DEFAULT_STAR_SIZE = 41;
|
|
25
|
+
const DEFAULT_GAP = 12;
|
|
26
|
+
const SELECTED_FALLBACK = '#5D00B5';
|
|
27
|
+
const IDLE_FALLBACK = '#F6F3FF';
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* `ratingStar/background` is state-driven: the same token resolves to the filled
|
|
31
|
+
* color when `Rating Star State = selected` and to the empty color when `idle`.
|
|
32
|
+
*/
|
|
33
|
+
const RATING_STATE_COLLECTION = 'Rating Star State';
|
|
34
|
+
const toNumber = (value, fallback) => {
|
|
35
|
+
const n = typeof value === 'string' ? Number(value) : value;
|
|
36
|
+
return typeof n === 'number' && Number.isFinite(n) ? n : fallback;
|
|
37
|
+
};
|
|
38
|
+
function Star({
|
|
39
|
+
width,
|
|
40
|
+
height,
|
|
41
|
+
color
|
|
42
|
+
}) {
|
|
43
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNativeSvg.default, {
|
|
44
|
+
width: width,
|
|
45
|
+
height: height,
|
|
46
|
+
viewBox: STAR_VIEWBOX,
|
|
47
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNativeSvg.Path, {
|
|
48
|
+
d: STAR_PATH,
|
|
49
|
+
fill: color
|
|
50
|
+
})
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
function Rating({
|
|
54
|
+
value = 0,
|
|
55
|
+
max = 5,
|
|
56
|
+
onChange,
|
|
57
|
+
readOnly = false,
|
|
58
|
+
starSize,
|
|
59
|
+
gap,
|
|
60
|
+
modes: propModes = _reactUtils.EMPTY_MODES,
|
|
61
|
+
style,
|
|
62
|
+
accessibilityLabel,
|
|
63
|
+
...rest
|
|
64
|
+
}) {
|
|
65
|
+
const {
|
|
66
|
+
modes: globalModes
|
|
67
|
+
} = (0, _JFSThemeProvider.useTokens)();
|
|
68
|
+
const modes = (0, _react.useMemo)(() => globalModes === _reactUtils.EMPTY_MODES && propModes === _reactUtils.EMPTY_MODES ? _reactUtils.EMPTY_MODES : {
|
|
69
|
+
...globalModes,
|
|
70
|
+
...propModes
|
|
71
|
+
}, [globalModes, propModes]);
|
|
72
|
+
const {
|
|
73
|
+
selectedColor,
|
|
74
|
+
idleColor,
|
|
75
|
+
starWidth,
|
|
76
|
+
starHeight,
|
|
77
|
+
resolvedGap
|
|
78
|
+
} = (0, _react.useMemo)(() => {
|
|
79
|
+
const selected = (0, _figmaVariablesResolver.getVariableByName)('ratingStar/background', {
|
|
80
|
+
...modes,
|
|
81
|
+
[RATING_STATE_COLLECTION]: 'selected'
|
|
82
|
+
});
|
|
83
|
+
const idle = (0, _figmaVariablesResolver.getVariableByName)('ratingStar/background', {
|
|
84
|
+
...modes,
|
|
85
|
+
[RATING_STATE_COLLECTION]: 'idle'
|
|
86
|
+
});
|
|
87
|
+
return {
|
|
88
|
+
selectedColor: selected ?? SELECTED_FALLBACK,
|
|
89
|
+
idleColor: idle ?? IDLE_FALLBACK,
|
|
90
|
+
starWidth: starSize ?? toNumber((0, _figmaVariablesResolver.getVariableByName)('ratingStar/width', modes), DEFAULT_STAR_SIZE),
|
|
91
|
+
starHeight: starSize ?? toNumber((0, _figmaVariablesResolver.getVariableByName)('ratingStar/height', modes), DEFAULT_STAR_SIZE),
|
|
92
|
+
resolvedGap: gap ?? toNumber((0, _figmaVariablesResolver.getVariableByName)('rating/gap', modes), DEFAULT_GAP)
|
|
93
|
+
};
|
|
94
|
+
}, [modes, starSize, gap]);
|
|
95
|
+
const total = Math.max(0, Math.round(max));
|
|
96
|
+
const filledCount = Math.max(0, Math.min(total, Math.round(value)));
|
|
97
|
+
const interactive = !readOnly && typeof onChange === 'function';
|
|
98
|
+
const label = accessibilityLabel ?? `${filledCount} of ${total} stars`;
|
|
99
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
100
|
+
...rest,
|
|
101
|
+
style: [{
|
|
102
|
+
flexDirection: 'row',
|
|
103
|
+
alignItems: 'center',
|
|
104
|
+
gap: resolvedGap
|
|
105
|
+
}, style],
|
|
106
|
+
accessibilityRole: interactive ? 'adjustable' : 'image',
|
|
107
|
+
accessibilityLabel: label,
|
|
108
|
+
accessibilityValue: interactive ? {
|
|
109
|
+
min: 0,
|
|
110
|
+
max: total,
|
|
111
|
+
now: filledCount
|
|
112
|
+
} : undefined,
|
|
113
|
+
children: Array.from({
|
|
114
|
+
length: total
|
|
115
|
+
}, (_, index) => {
|
|
116
|
+
const color = index < filledCount ? selectedColor : idleColor;
|
|
117
|
+
const star = /*#__PURE__*/(0, _jsxRuntime.jsx)(Star, {
|
|
118
|
+
width: starWidth,
|
|
119
|
+
height: starHeight,
|
|
120
|
+
color: color
|
|
121
|
+
});
|
|
122
|
+
if (!interactive) {
|
|
123
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_react.default.Fragment, {
|
|
124
|
+
children: star
|
|
125
|
+
}, index);
|
|
126
|
+
}
|
|
127
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Pressable, {
|
|
128
|
+
onPress: () => onChange?.(index + 1),
|
|
129
|
+
accessibilityRole: "button",
|
|
130
|
+
accessibilityLabel: `Rate ${index + 1} of ${total} stars`,
|
|
131
|
+
hitSlop: 8,
|
|
132
|
+
children: star
|
|
133
|
+
}, index);
|
|
134
|
+
})
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
var _default = exports.default = /*#__PURE__*/_react.default.memo(Rating);
|