@sudobility/subscription-components-rn 1.0.2 → 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/SegmentedControl.d.ts.map +1 -1
- package/dist/index.js +139 -51
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +140 -52
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -4
- package/src/SegmentedControl.tsx +143 -70
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SegmentedControl.d.ts","sourceRoot":"","sources":["../src/SegmentedControl.tsx"],"names":[],"mappings":"AAEA,MAAM,WAAW,sBAAsB,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM;IAC/D,4BAA4B;IAC5B,KAAK,EAAE,CAAC,CAAC;IACT,oBAAoB;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,6CAA6C;IAC7C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,sCAAsC;IACtC,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,qBAAqB,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM;IAC9D,wBAAwB;IACxB,OAAO,EAAE,sBAAsB,CAAC,CAAC,CAAC,EAAE,CAAC;IACrC,+BAA+B;IAC/B,KAAK,EAAE,CAAC,CAAC;IACT,+BAA+B;IAC/B,QAAQ,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,CAAC;IAC7B,sDAAsD;IACtD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,sCAAsC;IACtC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,mBAAmB;IACnB,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IAC1B,sBAAsB;IACtB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,0BAA0B;IAC1B,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B;
|
|
1
|
+
{"version":3,"file":"SegmentedControl.d.ts","sourceRo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AE,SAAS,GAAG,QAAQ,KAAK,IAAI,CAAC;IACvD,oBAAoB;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,mBAAmB;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,2BAA2B;IAC3B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,mBAAmB;IACnB,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IAC1B,mBAAmB;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,qBAAqB;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,wBAAgB,cAAc,CAAC,EAC7B,MAAM,EACN,cAAc,EACd,YAAwB,EACxB,WAAsB,EACtB,aAAa,EACb,IAAW,EACX,SAAc,EACd,QAAgB,GACjB,EAAE,mBAAmB,2CAiBrB;AAED,eAAe,gBAAgB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1357,26 +1357,6 @@ function SubscriptionFooter({
|
|
|
1357
1357
|
/* @__PURE__ */ jsxRuntimeExports.jsx(reactNative.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." })
|
|
1358
1358
|
] });
|
|
1359
1359
|
}
|
|
1360
|
-
const sizeClasses = {
|
|
1361
|
-
sm: {
|
|
1362
|
-
container: "p-1 rounded-lg",
|
|
1363
|
-
segment: "px-3 py-1.5 rounded-md",
|
|
1364
|
-
text: "text-xs",
|
|
1365
|
-
badge: "text-xs px-1.5 py-0.5"
|
|
1366
|
-
},
|
|
1367
|
-
md: {
|
|
1368
|
-
container: "p-1 rounded-lg",
|
|
1369
|
-
segment: "px-4 py-2 rounded-md",
|
|
1370
|
-
text: "text-sm",
|
|
1371
|
-
badge: "text-xs px-2 py-0.5"
|
|
1372
|
-
},
|
|
1373
|
-
lg: {
|
|
1374
|
-
container: "p-1 rounded-lg",
|
|
1375
|
-
segment: "px-6 py-3 rounded-lg",
|
|
1376
|
-
text: "text-base",
|
|
1377
|
-
badge: "text-sm px-2 py-1"
|
|
1378
|
-
}
|
|
1379
|
-
};
|
|
1380
1360
|
function SegmentedControl({
|
|
1381
1361
|
options,
|
|
1382
1362
|
value,
|
|
@@ -1387,34 +1367,22 @@ function SegmentedControl({
|
|
|
1387
1367
|
fullWidth = true,
|
|
1388
1368
|
accessibilityLabel
|
|
1389
1369
|
}) {
|
|
1390
|
-
const sizes = sizeClasses[size];
|
|
1391
|
-
const containerClasses = [
|
|
1392
|
-
"flex-row bg-gray-100 dark:bg-gray-800",
|
|
1393
|
-
sizes.container,
|
|
1394
|
-
fullWidth ? "w-full" : "",
|
|
1395
|
-
disabled ? "opacity-50" : "",
|
|
1396
|
-
className
|
|
1397
|
-
].filter(Boolean).join(" ");
|
|
1398
1370
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1399
1371
|
reactNative.View,
|
|
1400
1372
|
{
|
|
1401
|
-
|
|
1373
|
+
style: [
|
|
1374
|
+
styles.container,
|
|
1375
|
+
fullWidth && styles.fullWidth,
|
|
1376
|
+
disabled && styles.disabled,
|
|
1377
|
+
size === "sm" && styles.containerSm,
|
|
1378
|
+
size === "md" && styles.containerMd,
|
|
1379
|
+
size === "lg" && styles.containerLg
|
|
1380
|
+
],
|
|
1402
1381
|
accessibilityRole: "tablist",
|
|
1403
1382
|
accessibilityLabel,
|
|
1404
1383
|
children: options.map((option) => {
|
|
1405
1384
|
const isSelected = value === option.value;
|
|
1406
1385
|
const isDisabled = disabled || option.disabled;
|
|
1407
|
-
const segmentClasses = [
|
|
1408
|
-
sizes.segment,
|
|
1409
|
-
"flex-1 items-center justify-center flex-row gap-2",
|
|
1410
|
-
isSelected ? "bg-white dark:bg-gray-700 shadow-sm" : "bg-transparent",
|
|
1411
|
-
isDisabled ? "opacity-50" : ""
|
|
1412
|
-
].filter(Boolean).join(" ");
|
|
1413
|
-
const textClasses = [
|
|
1414
|
-
sizes.text,
|
|
1415
|
-
"font-medium",
|
|
1416
|
-
isSelected ? "text-gray-900 dark:text-white" : "text-gray-600 dark:text-gray-400"
|
|
1417
|
-
].join(" ");
|
|
1418
1386
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
1419
1387
|
reactNative.Pressable,
|
|
1420
1388
|
{
|
|
@@ -1426,24 +1394,45 @@ function SegmentedControl({
|
|
|
1426
1394
|
disabled: isDisabled
|
|
1427
1395
|
},
|
|
1428
1396
|
accessibilityLabel: option.label + (option.badge ? ", " + option.badge : ""),
|
|
1429
|
-
|
|
1397
|
+
style: [
|
|
1398
|
+
styles.segment,
|
|
1399
|
+
size === "sm" && styles.segmentSm,
|
|
1400
|
+
size === "md" && styles.segmentMd,
|
|
1401
|
+
size === "lg" && styles.segmentLg,
|
|
1402
|
+
isSelected && styles.segmentSelected,
|
|
1403
|
+
isDisabled && styles.disabled
|
|
1404
|
+
],
|
|
1430
1405
|
children: [
|
|
1431
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1406
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1407
|
+
reactNative.Text,
|
|
1408
|
+
{
|
|
1409
|
+
style: [
|
|
1410
|
+
styles.text,
|
|
1411
|
+
size === "sm" && styles.textSm,
|
|
1412
|
+
size === "md" && styles.textMd,
|
|
1413
|
+
size === "lg" && styles.textLg,
|
|
1414
|
+
isSelected ? styles.textSelected : styles.textUnselected
|
|
1415
|
+
],
|
|
1416
|
+
children: option.label
|
|
1417
|
+
}
|
|
1418
|
+
),
|
|
1432
1419
|
option.badge && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1433
1420
|
reactNative.View,
|
|
1434
1421
|
{
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
"
|
|
1438
|
-
|
|
1439
|
-
|
|
1422
|
+
style: [
|
|
1423
|
+
styles.badge,
|
|
1424
|
+
size === "sm" && styles.badgeSm,
|
|
1425
|
+
size === "md" && styles.badgeMd,
|
|
1426
|
+
size === "lg" && styles.badgeLg,
|
|
1427
|
+
isSelected ? styles.badgeSelected : styles.badgeUnselected
|
|
1428
|
+
],
|
|
1440
1429
|
children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1441
1430
|
reactNative.Text,
|
|
1442
1431
|
{
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
isSelected ?
|
|
1446
|
-
]
|
|
1432
|
+
style: [
|
|
1433
|
+
styles.badgeText,
|
|
1434
|
+
isSelected ? styles.badgeTextSelected : styles.badgeTextUnselected
|
|
1435
|
+
],
|
|
1447
1436
|
children: option.badge
|
|
1448
1437
|
}
|
|
1449
1438
|
)
|
|
@@ -1484,6 +1473,105 @@ function PeriodSelector({
|
|
|
1484
1473
|
}
|
|
1485
1474
|
);
|
|
1486
1475
|
}
|
|
1476
|
+
const styles = reactNative.StyleSheet.create({
|
|
1477
|
+
container: {
|
|
1478
|
+
flexDirection: "row",
|
|
1479
|
+
backgroundColor: "#f3f4f6",
|
|
1480
|
+
borderRadius: 8,
|
|
1481
|
+
padding: 4
|
|
1482
|
+
},
|
|
1483
|
+
fullWidth: {
|
|
1484
|
+
width: "100%"
|
|
1485
|
+
},
|
|
1486
|
+
disabled: {
|
|
1487
|
+
opacity: 0.5
|
|
1488
|
+
},
|
|
1489
|
+
containerSm: {
|
|
1490
|
+
borderRadius: 8
|
|
1491
|
+
},
|
|
1492
|
+
containerMd: {
|
|
1493
|
+
borderRadius: 8
|
|
1494
|
+
},
|
|
1495
|
+
containerLg: {
|
|
1496
|
+
borderRadius: 12
|
|
1497
|
+
},
|
|
1498
|
+
segment: {
|
|
1499
|
+
flex: 1,
|
|
1500
|
+
alignItems: "center",
|
|
1501
|
+
justifyContent: "center",
|
|
1502
|
+
flexDirection: "row"
|
|
1503
|
+
},
|
|
1504
|
+
segmentSm: {
|
|
1505
|
+
paddingHorizontal: 12,
|
|
1506
|
+
paddingVertical: 6,
|
|
1507
|
+
borderRadius: 6,
|
|
1508
|
+
gap: 8
|
|
1509
|
+
},
|
|
1510
|
+
segmentMd: {
|
|
1511
|
+
paddingHorizontal: 16,
|
|
1512
|
+
paddingVertical: 8,
|
|
1513
|
+
borderRadius: 6,
|
|
1514
|
+
gap: 8
|
|
1515
|
+
},
|
|
1516
|
+
segmentLg: {
|
|
1517
|
+
paddingHorizontal: 24,
|
|
1518
|
+
paddingVertical: 12,
|
|
1519
|
+
borderRadius: 8,
|
|
1520
|
+
gap: 8
|
|
1521
|
+
},
|
|
1522
|
+
segmentSelected: {
|
|
1523
|
+
backgroundColor: "#ffffff"
|
|
1524
|
+
},
|
|
1525
|
+
text: {
|
|
1526
|
+
fontWeight: "500"
|
|
1527
|
+
},
|
|
1528
|
+
textSm: {
|
|
1529
|
+
fontSize: 12
|
|
1530
|
+
},
|
|
1531
|
+
textMd: {
|
|
1532
|
+
fontSize: 14
|
|
1533
|
+
},
|
|
1534
|
+
textLg: {
|
|
1535
|
+
fontSize: 16
|
|
1536
|
+
},
|
|
1537
|
+
textSelected: {
|
|
1538
|
+
color: "#111827"
|
|
1539
|
+
},
|
|
1540
|
+
textUnselected: {
|
|
1541
|
+
color: "#4b5563"
|
|
1542
|
+
},
|
|
1543
|
+
badge: {
|
|
1544
|
+
borderRadius: 999
|
|
1545
|
+
},
|
|
1546
|
+
badgeSm: {
|
|
1547
|
+
paddingHorizontal: 6,
|
|
1548
|
+
paddingVertical: 2
|
|
1549
|
+
},
|
|
1550
|
+
badgeMd: {
|
|
1551
|
+
paddingHorizontal: 8,
|
|
1552
|
+
paddingVertical: 2
|
|
1553
|
+
},
|
|
1554
|
+
badgeLg: {
|
|
1555
|
+
paddingHorizontal: 8,
|
|
1556
|
+
paddingVertical: 4
|
|
1557
|
+
},
|
|
1558
|
+
badgeSelected: {
|
|
1559
|
+
backgroundColor: "#dcfce7"
|
|
1560
|
+
},
|
|
1561
|
+
badgeUnselected: {
|
|
1562
|
+
backgroundColor: "#e5e7eb"
|
|
1563
|
+
},
|
|
1564
|
+
badgeText: {
|
|
1565
|
+
fontSize: 12,
|
|
1566
|
+
fontWeight: "600"
|
|
1567
|
+
},
|
|
1568
|
+
badgeTextSelected: {
|
|
1569
|
+
color: "#15803d"
|
|
1570
|
+
},
|
|
1571
|
+
badgeTextUnselected: {
|
|
1572
|
+
color: "#4b5563"
|
|
1573
|
+
}
|
|
1574
|
+
});
|
|
1487
1575
|
const SubscriptionContext = require$$0.createContext(
|
|
1488
1576
|
void 0
|
|
1489
1577
|
);
|