@sudobility/subscription-components-rn 1.0.3 → 1.0.4

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.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import require$$0, { createContext, useState, useCallback, useContext } from "react";
2
- import { Pressable, View, Text, ScrollView, ActivityIndicator } from "react-native";
2
+ import { Pressable, View, Text, ScrollView, ActivityIndicator, StyleSheet } from "react-native";
3
3
  var jsxRuntime = { exports: {} };
4
4
  var reactJsxRuntime_production_min = {};
5
5
  /**
@@ -1355,26 +1355,6 @@ function SubscriptionFooter({
1355
1355
  /* @__PURE__ */ jsxRuntimeExports.jsx(Text, { className: "text-xs text-gray-400 dark:text-gray-500 text-center px-4", children: "Subscriptions will automatically renew unless canceled at least 24 hours before the end of the current period." })
1356
1356
  ] });
1357
1357
  }
1358
- const sizeClasses = {
1359
- sm: {
1360
- container: "p-1 rounded-lg",
1361
- segment: "px-3 py-1.5 rounded-md",
1362
- text: "text-xs",
1363
- badge: "text-xs px-1.5 py-0.5"
1364
- },
1365
- md: {
1366
- container: "p-1 rounded-lg",
1367
- segment: "px-4 py-2 rounded-md",
1368
- text: "text-sm",
1369
- badge: "text-xs px-2 py-0.5"
1370
- },
1371
- lg: {
1372
- container: "p-1 rounded-lg",
1373
- segment: "px-6 py-3 rounded-lg",
1374
- text: "text-base",
1375
- badge: "text-sm px-2 py-1"
1376
- }
1377
- };
1378
1358
  function SegmentedControl({
1379
1359
  options,
1380
1360
  value,
@@ -1385,34 +1365,22 @@ function SegmentedControl({
1385
1365
  fullWidth = true,
1386
1366
  accessibilityLabel
1387
1367
  }) {
1388
- const sizes = sizeClasses[size];
1389
- const containerClasses = [
1390
- "flex-row bg-gray-100 dark:bg-gray-800",
1391
- sizes.container,
1392
- fullWidth ? "w-full" : "",
1393
- disabled ? "opacity-50" : "",
1394
- className
1395
- ].filter(Boolean).join(" ");
1396
1368
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
1397
1369
  View,
1398
1370
  {
1399
- className: containerClasses,
1371
+ style: [
1372
+ styles.container,
1373
+ fullWidth && styles.fullWidth,
1374
+ disabled && styles.disabled,
1375
+ size === "sm" && styles.containerSm,
1376
+ size === "md" && styles.containerMd,
1377
+ size === "lg" && styles.containerLg
1378
+ ],
1400
1379
  accessibilityRole: "tablist",
1401
1380
  accessibilityLabel,
1402
1381
  children: options.map((option) => {
1403
1382
  const isSelected = value === option.value;
1404
1383
  const isDisabled = disabled || option.disabled;
1405
- const segmentClasses = [
1406
- sizes.segment,
1407
- "flex-1 items-center justify-center flex-row gap-2",
1408
- isSelected ? "bg-white dark:bg-gray-700 shadow-sm" : "bg-transparent",
1409
- isDisabled ? "opacity-50" : ""
1410
- ].filter(Boolean).join(" ");
1411
- const textClasses = [
1412
- sizes.text,
1413
- "font-medium",
1414
- isSelected ? "text-gray-900 dark:text-white" : "text-gray-600 dark:text-gray-400"
1415
- ].join(" ");
1416
1384
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
1417
1385
  Pressable,
1418
1386
  {
@@ -1424,24 +1392,45 @@ function SegmentedControl({
1424
1392
  disabled: isDisabled
1425
1393
  },
1426
1394
  accessibilityLabel: option.label + (option.badge ? ", " + option.badge : ""),
1427
- className: segmentClasses,
1395
+ style: [
1396
+ styles.segment,
1397
+ size === "sm" && styles.segmentSm,
1398
+ size === "md" && styles.segmentMd,
1399
+ size === "lg" && styles.segmentLg,
1400
+ isSelected && styles.segmentSelected,
1401
+ isDisabled && styles.disabled
1402
+ ],
1428
1403
  children: [
1429
- /* @__PURE__ */ jsxRuntimeExports.jsx(Text, { className: textClasses, children: option.label }),
1404
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
1405
+ Text,
1406
+ {
1407
+ style: [
1408
+ styles.text,
1409
+ size === "sm" && styles.textSm,
1410
+ size === "md" && styles.textMd,
1411
+ size === "lg" && styles.textLg,
1412
+ isSelected ? styles.textSelected : styles.textUnselected
1413
+ ],
1414
+ children: option.label
1415
+ }
1416
+ ),
1430
1417
  option.badge && /* @__PURE__ */ jsxRuntimeExports.jsx(
1431
1418
  View,
1432
1419
  {
1433
- className: [
1434
- sizes.badge,
1435
- "rounded-full",
1436
- isSelected ? "bg-green-100 dark:bg-green-900" : "bg-gray-200 dark:bg-gray-700"
1437
- ].join(" "),
1420
+ style: [
1421
+ styles.badge,
1422
+ size === "sm" && styles.badgeSm,
1423
+ size === "md" && styles.badgeMd,
1424
+ size === "lg" && styles.badgeLg,
1425
+ isSelected ? styles.badgeSelected : styles.badgeUnselected
1426
+ ],
1438
1427
  children: /* @__PURE__ */ jsxRuntimeExports.jsx(
1439
1428
  Text,
1440
1429
  {
1441
- className: [
1442
- "text-xs font-semibold",
1443
- isSelected ? "text-green-700 dark:text-green-300" : "text-gray-600 dark:text-gray-400"
1444
- ].join(" "),
1430
+ style: [
1431
+ styles.badgeText,
1432
+ isSelected ? styles.badgeTextSelected : styles.badgeTextUnselected
1433
+ ],
1445
1434
  children: option.badge
1446
1435
  }
1447
1436
  )
@@ -1482,6 +1471,105 @@ function PeriodSelector({
1482
1471
  }
1483
1472
  );
1484
1473
  }
1474
+ const styles = StyleSheet.create({
1475
+ container: {
1476
+ flexDirection: "row",
1477
+ backgroundColor: "#f3f4f6",
1478
+ borderRadius: 8,
1479
+ padding: 4
1480
+ },
1481
+ fullWidth: {
1482
+ width: "100%"
1483
+ },
1484
+ disabled: {
1485
+ opacity: 0.5
1486
+ },
1487
+ containerSm: {
1488
+ borderRadius: 8
1489
+ },
1490
+ containerMd: {
1491
+ borderRadius: 8
1492
+ },
1493
+ containerLg: {
1494
+ borderRadius: 12
1495
+ },
1496
+ segment: {
1497
+ flex: 1,
1498
+ alignItems: "center",
1499
+ justifyContent: "center",
1500
+ flexDirection: "row"
1501
+ },
1502
+ segmentSm: {
1503
+ paddingHorizontal: 12,
1504
+ paddingVertical: 6,
1505
+ borderRadius: 6,
1506
+ gap: 8
1507
+ },
1508
+ segmentMd: {
1509
+ paddingHorizontal: 16,
1510
+ paddingVertical: 8,
1511
+ borderRadius: 6,
1512
+ gap: 8
1513
+ },
1514
+ segmentLg: {
1515
+ paddingHorizontal: 24,
1516
+ paddingVertical: 12,
1517
+ borderRadius: 8,
1518
+ gap: 8
1519
+ },
1520
+ segmentSelected: {
1521
+ backgroundColor: "#ffffff"
1522
+ },
1523
+ text: {
1524
+ fontWeight: "500"
1525
+ },
1526
+ textSm: {
1527
+ fontSize: 12
1528
+ },
1529
+ textMd: {
1530
+ fontSize: 14
1531
+ },
1532
+ textLg: {
1533
+ fontSize: 16
1534
+ },
1535
+ textSelected: {
1536
+ color: "#111827"
1537
+ },
1538
+ textUnselected: {
1539
+ color: "#4b5563"
1540
+ },
1541
+ badge: {
1542
+ borderRadius: 999
1543
+ },
1544
+ badgeSm: {
1545
+ paddingHorizontal: 6,
1546
+ paddingVertical: 2
1547
+ },
1548
+ badgeMd: {
1549
+ paddingHorizontal: 8,
1550
+ paddingVertical: 2
1551
+ },
1552
+ badgeLg: {
1553
+ paddingHorizontal: 8,
1554
+ paddingVertical: 4
1555
+ },
1556
+ badgeSelected: {
1557
+ backgroundColor: "#dcfce7"
1558
+ },
1559
+ badgeUnselected: {
1560
+ backgroundColor: "#e5e7eb"
1561
+ },
1562
+ badgeText: {
1563
+ fontSize: 12,
1564
+ fontWeight: "600"
1565
+ },
1566
+ badgeTextSelected: {
1567
+ color: "#15803d"
1568
+ },
1569
+ badgeTextUnselected: {
1570
+ color: "#4b5563"
1571
+ }
1572
+ });
1485
1573
  const SubscriptionContext = createContext(
1486
1574
  void 0
1487
1575
  );