@rehagro/ui 1.0.39 → 1.0.41
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/dist/index.d.mts +8 -5
- package/dist/index.d.ts +8 -5
- package/dist/index.js +34 -13
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +34 -13
- package/dist/index.mjs.map +1 -1
- package/dist/native.d.mts +24 -1
- package/dist/native.d.ts +24 -1
- package/dist/native.js +118 -0
- package/dist/native.js.map +1 -1
- package/dist/native.mjs +118 -1
- package/dist/native.mjs.map +1 -1
- package/dist/styles.css +3 -3
- package/package.json +1 -1
package/dist/native.mjs
CHANGED
|
@@ -1498,7 +1498,124 @@ var RadioGroup = forwardRef(function RadioGroup2({
|
|
|
1498
1498
|
}
|
|
1499
1499
|
);
|
|
1500
1500
|
});
|
|
1501
|
+
var THICKNESS_MAP = {
|
|
1502
|
+
xs: 2,
|
|
1503
|
+
sm: 4,
|
|
1504
|
+
md: 8,
|
|
1505
|
+
lg: 12,
|
|
1506
|
+
xl: 16
|
|
1507
|
+
};
|
|
1508
|
+
var PRESET_COLORS5 = /* @__PURE__ */ new Set([
|
|
1509
|
+
"primary",
|
|
1510
|
+
"secondary",
|
|
1511
|
+
"danger",
|
|
1512
|
+
"warning",
|
|
1513
|
+
"success",
|
|
1514
|
+
"info"
|
|
1515
|
+
]);
|
|
1516
|
+
var isPresetColor5 = (color) => PRESET_COLORS5.has(color);
|
|
1517
|
+
var resolveColor2 = (color, theme) => {
|
|
1518
|
+
if (isPresetColor5(color)) {
|
|
1519
|
+
return theme[color] ?? "#538CC6";
|
|
1520
|
+
}
|
|
1521
|
+
return color;
|
|
1522
|
+
};
|
|
1523
|
+
var resolveThickness = (thickness) => typeof thickness === "number" ? thickness : THICKNESS_MAP[thickness];
|
|
1524
|
+
var ProgressBar = forwardRef(function ProgressBar2({
|
|
1525
|
+
value,
|
|
1526
|
+
label,
|
|
1527
|
+
variant = "inline",
|
|
1528
|
+
thickness = "sm",
|
|
1529
|
+
showPercentage = true,
|
|
1530
|
+
color = "primary",
|
|
1531
|
+
bgColor,
|
|
1532
|
+
style
|
|
1533
|
+
}, ref) {
|
|
1534
|
+
const theme = useRehagroTheme();
|
|
1535
|
+
const clampedValue = Math.min(100, Math.max(0, value));
|
|
1536
|
+
const heightPx = resolveThickness(thickness);
|
|
1537
|
+
const resolvedBarColor = resolveColor2(color, theme);
|
|
1538
|
+
const resolvedBgColor = bgColor ?? theme.border ?? "#E5E7EB";
|
|
1539
|
+
const trackStyle = {
|
|
1540
|
+
width: "100%",
|
|
1541
|
+
height: heightPx,
|
|
1542
|
+
borderRadius: 40,
|
|
1543
|
+
overflow: "hidden",
|
|
1544
|
+
backgroundColor: resolvedBgColor
|
|
1545
|
+
};
|
|
1546
|
+
const fillStyle = {
|
|
1547
|
+
width: `${clampedValue}%`,
|
|
1548
|
+
height: "100%",
|
|
1549
|
+
borderRadius: 40,
|
|
1550
|
+
backgroundColor: resolvedBarColor
|
|
1551
|
+
};
|
|
1552
|
+
const percentageTextStyle = {
|
|
1553
|
+
fontSize: theme.fontSizeSm ?? 14,
|
|
1554
|
+
color: theme.textMuted ?? "#9CA3AF",
|
|
1555
|
+
...theme.fontFamilyBody ? { fontFamily: theme.fontFamilyBody } : {}
|
|
1556
|
+
};
|
|
1557
|
+
if (variant === "stacked") {
|
|
1558
|
+
return /* @__PURE__ */ jsxs(
|
|
1559
|
+
View,
|
|
1560
|
+
{
|
|
1561
|
+
ref,
|
|
1562
|
+
accessibilityRole: "progressbar",
|
|
1563
|
+
accessibilityValue: { now: clampedValue, min: 0, max: 100 },
|
|
1564
|
+
style: [{ flexDirection: "column", alignItems: "stretch", gap: 8 }, style],
|
|
1565
|
+
children: [
|
|
1566
|
+
(label || showPercentage) && /* @__PURE__ */ jsxs(
|
|
1567
|
+
View,
|
|
1568
|
+
{
|
|
1569
|
+
style: {
|
|
1570
|
+
flexDirection: "row",
|
|
1571
|
+
justifyContent: "space-between",
|
|
1572
|
+
alignItems: "flex-start",
|
|
1573
|
+
width: "100%"
|
|
1574
|
+
},
|
|
1575
|
+
children: [
|
|
1576
|
+
label ? /* @__PURE__ */ jsx(
|
|
1577
|
+
Text,
|
|
1578
|
+
{
|
|
1579
|
+
style: {
|
|
1580
|
+
flex: 1,
|
|
1581
|
+
fontSize: theme.fontSizeMd ?? 16,
|
|
1582
|
+
fontWeight: "700",
|
|
1583
|
+
color: theme.text ?? "#374151",
|
|
1584
|
+
...theme.fontFamilyDisplay ? { fontFamily: theme.fontFamilyDisplay } : {}
|
|
1585
|
+
},
|
|
1586
|
+
children: label
|
|
1587
|
+
}
|
|
1588
|
+
) : /* @__PURE__ */ jsx(View, { style: { flex: 1 } }),
|
|
1589
|
+
showPercentage && /* @__PURE__ */ jsxs(Text, { style: [percentageTextStyle, { textAlign: "right" }], children: [
|
|
1590
|
+
clampedValue,
|
|
1591
|
+
"%"
|
|
1592
|
+
] })
|
|
1593
|
+
]
|
|
1594
|
+
}
|
|
1595
|
+
),
|
|
1596
|
+
/* @__PURE__ */ jsx(View, { style: trackStyle, children: /* @__PURE__ */ jsx(View, { style: fillStyle }) })
|
|
1597
|
+
]
|
|
1598
|
+
}
|
|
1599
|
+
);
|
|
1600
|
+
}
|
|
1601
|
+
return /* @__PURE__ */ jsxs(
|
|
1602
|
+
View,
|
|
1603
|
+
{
|
|
1604
|
+
ref,
|
|
1605
|
+
accessibilityRole: "progressbar",
|
|
1606
|
+
accessibilityValue: { now: clampedValue, min: 0, max: 100 },
|
|
1607
|
+
style: [{ flexDirection: "row", alignItems: "center", gap: 8 }, style],
|
|
1608
|
+
children: [
|
|
1609
|
+
/* @__PURE__ */ jsx(View, { style: [trackStyle, { flex: 1, width: void 0 }], children: /* @__PURE__ */ jsx(View, { style: fillStyle }) }),
|
|
1610
|
+
showPercentage && /* @__PURE__ */ jsxs(Text, { style: [percentageTextStyle, { minWidth: 40, textAlign: "right" }], children: [
|
|
1611
|
+
clampedValue,
|
|
1612
|
+
"%"
|
|
1613
|
+
] })
|
|
1614
|
+
]
|
|
1615
|
+
}
|
|
1616
|
+
);
|
|
1617
|
+
});
|
|
1501
1618
|
|
|
1502
|
-
export { ActivityIndicator3 as ActivityIndicator, Avatar, Button, Card2 as Card, CardContent, CardFooter, CardHeader, Checkbox, IconButton, Radio, RadioGroup, RadioOption, RehagroNativeProvider, Select, Tag, Text5 as Text, TextInput, useRehagroTheme };
|
|
1619
|
+
export { ActivityIndicator3 as ActivityIndicator, Avatar, Button, Card2 as Card, CardContent, CardFooter, CardHeader, Checkbox, IconButton, ProgressBar, Radio, RadioGroup, RadioOption, RehagroNativeProvider, Select, Tag, Text5 as Text, TextInput, useRehagroTheme };
|
|
1503
1620
|
//# sourceMappingURL=native.mjs.map
|
|
1504
1621
|
//# sourceMappingURL=native.mjs.map
|