@ankhorage/zora 1.0.5 → 1.0.7

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 (128) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +284 -0
  3. package/dist/components/media-card/MediaCard.d.ts +4 -0
  4. package/dist/components/media-card/MediaCard.d.ts.map +1 -0
  5. package/dist/components/media-card/MediaCard.js +64 -0
  6. package/dist/components/media-card/MediaCard.js.map +1 -0
  7. package/dist/components/media-card/index.d.ts +3 -0
  8. package/dist/components/media-card/index.d.ts.map +1 -0
  9. package/dist/components/media-card/index.js +2 -0
  10. package/dist/components/media-card/index.js.map +1 -0
  11. package/dist/components/media-card/types.d.ts +36 -0
  12. package/dist/components/media-card/types.d.ts.map +1 -0
  13. package/dist/components/media-card/types.js +2 -0
  14. package/dist/components/media-card/types.js.map +1 -0
  15. package/dist/components/metric-card/MetricCard.d.ts +4 -0
  16. package/dist/components/metric-card/MetricCard.d.ts.map +1 -0
  17. package/dist/components/metric-card/MetricCard.js +43 -0
  18. package/dist/components/metric-card/MetricCard.js.map +1 -0
  19. package/dist/components/metric-card/index.d.ts +3 -0
  20. package/dist/components/metric-card/index.d.ts.map +1 -0
  21. package/dist/components/metric-card/index.js +2 -0
  22. package/dist/components/metric-card/index.js.map +1 -0
  23. package/dist/components/metric-card/types.d.ts +17 -0
  24. package/dist/components/metric-card/types.d.ts.map +1 -0
  25. package/dist/components/metric-card/types.js +2 -0
  26. package/dist/components/metric-card/types.js.map +1 -0
  27. package/dist/components/progress/Progress.d.ts +4 -0
  28. package/dist/components/progress/Progress.d.ts.map +1 -0
  29. package/dist/components/progress/Progress.js +28 -0
  30. package/dist/components/progress/Progress.js.map +1 -0
  31. package/dist/components/progress/index.d.ts +3 -0
  32. package/dist/components/progress/index.d.ts.map +1 -0
  33. package/dist/components/progress/index.js +2 -0
  34. package/dist/components/progress/index.js.map +1 -0
  35. package/dist/components/progress/resolveProgressFraction.d.ts +5 -0
  36. package/dist/components/progress/resolveProgressFraction.d.ts.map +1 -0
  37. package/dist/components/progress/resolveProgressFraction.js +14 -0
  38. package/dist/components/progress/resolveProgressFraction.js.map +1 -0
  39. package/dist/components/progress/types.d.ts +11 -0
  40. package/dist/components/progress/types.d.ts.map +1 -0
  41. package/dist/components/progress/types.js +16 -0
  42. package/dist/components/progress/types.js.map +1 -0
  43. package/dist/components/rating/Rating.d.ts +4 -0
  44. package/dist/components/rating/Rating.d.ts.map +1 -0
  45. package/dist/components/rating/Rating.js +23 -0
  46. package/dist/components/rating/Rating.js.map +1 -0
  47. package/dist/components/rating/index.d.ts +3 -0
  48. package/dist/components/rating/index.d.ts.map +1 -0
  49. package/dist/components/rating/index.js +2 -0
  50. package/dist/components/rating/index.js.map +1 -0
  51. package/dist/components/rating/resolveRatingSegments.d.ts +7 -0
  52. package/dist/components/rating/resolveRatingSegments.d.ts.map +1 -0
  53. package/dist/components/rating/resolveRatingSegments.js +22 -0
  54. package/dist/components/rating/resolveRatingSegments.js.map +1 -0
  55. package/dist/components/rating/types.d.ts +11 -0
  56. package/dist/components/rating/types.d.ts.map +1 -0
  57. package/dist/components/rating/types.js +16 -0
  58. package/dist/components/rating/types.js.map +1 -0
  59. package/dist/index.d.ts +12 -0
  60. package/dist/index.d.ts.map +1 -1
  61. package/dist/index.js +6 -0
  62. package/dist/index.js.map +1 -1
  63. package/dist/patterns/list/List.d.ts +4 -0
  64. package/dist/patterns/list/List.d.ts.map +1 -0
  65. package/dist/patterns/list/List.js +35 -0
  66. package/dist/patterns/list/List.js.map +1 -0
  67. package/dist/patterns/list/ListRow.d.ts +4 -0
  68. package/dist/patterns/list/ListRow.d.ts.map +1 -0
  69. package/dist/patterns/list/ListRow.js +108 -0
  70. package/dist/patterns/list/ListRow.js.map +1 -0
  71. package/dist/patterns/list/ListSection.d.ts +4 -0
  72. package/dist/patterns/list/ListSection.d.ts.map +1 -0
  73. package/dist/patterns/list/ListSection.js +14 -0
  74. package/dist/patterns/list/ListSection.js.map +1 -0
  75. package/dist/patterns/list/index.d.ts +5 -0
  76. package/dist/patterns/list/index.d.ts.map +1 -0
  77. package/dist/patterns/list/index.js +4 -0
  78. package/dist/patterns/list/index.js.map +1 -0
  79. package/dist/patterns/list/resolveListSeparator.d.ts +5 -0
  80. package/dist/patterns/list/resolveListSeparator.d.ts.map +1 -0
  81. package/dist/patterns/list/resolveListSeparator.js +6 -0
  82. package/dist/patterns/list/resolveListSeparator.js.map +1 -0
  83. package/dist/patterns/list/types.d.ts +55 -0
  84. package/dist/patterns/list/types.d.ts.map +1 -0
  85. package/dist/patterns/list/types.js +2 -0
  86. package/dist/patterns/list/types.js.map +1 -0
  87. package/dist/patterns/timeline/Timeline.d.ts +4 -0
  88. package/dist/patterns/timeline/Timeline.d.ts.map +1 -0
  89. package/dist/patterns/timeline/Timeline.js +59 -0
  90. package/dist/patterns/timeline/Timeline.js.map +1 -0
  91. package/dist/patterns/timeline/index.d.ts +3 -0
  92. package/dist/patterns/timeline/index.d.ts.map +1 -0
  93. package/dist/patterns/timeline/index.js +2 -0
  94. package/dist/patterns/timeline/index.js.map +1 -0
  95. package/dist/patterns/timeline/types.d.ts +18 -0
  96. package/dist/patterns/timeline/types.d.ts.map +1 -0
  97. package/dist/patterns/timeline/types.js +2 -0
  98. package/dist/patterns/timeline/types.js.map +1 -0
  99. package/package.json +1 -1
  100. package/src/components/media-card/MediaCard.tsx +120 -0
  101. package/src/components/media-card/index.ts +2 -0
  102. package/src/components/media-card/types.ts +44 -0
  103. package/src/components/metric-card/MetricCard.tsx +84 -0
  104. package/src/components/metric-card/index.ts +2 -0
  105. package/src/components/metric-card/types.ts +18 -0
  106. package/src/components/progress/Progress.tsx +50 -0
  107. package/src/components/progress/index.ts +2 -0
  108. package/src/components/progress/resolveProgressFraction.test.ts +23 -0
  109. package/src/components/progress/resolveProgressFraction.ts +17 -0
  110. package/src/components/progress/types.ts +27 -0
  111. package/src/components/rating/Rating.tsx +38 -0
  112. package/src/components/rating/index.ts +2 -0
  113. package/src/components/rating/resolveRatingSegments.test.ts +60 -0
  114. package/src/components/rating/resolveRatingSegments.ts +34 -0
  115. package/src/components/rating/types.ts +27 -0
  116. package/src/index.ts +19 -0
  117. package/src/patterns/list/List.tsx +72 -0
  118. package/src/patterns/list/ListRow.tsx +193 -0
  119. package/src/patterns/list/ListSection.tsx +36 -0
  120. package/src/patterns/list/index.ts +11 -0
  121. package/src/patterns/list/resolveListSeparator.test.ts +18 -0
  122. package/src/patterns/list/resolveListSeparator.ts +8 -0
  123. package/src/patterns/list/types.ts +67 -0
  124. package/src/patterns/timeline/Timeline.tsx +104 -0
  125. package/src/patterns/timeline/index.ts +2 -0
  126. package/src/patterns/timeline/types.ts +20 -0
  127. package/src/showcaseCoverage.test.ts +8 -0
  128. package/src/theme/themeScopeStructure.test.ts +14 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.0.7
4
+
5
+ ### Patch Changes
6
+
7
+ - 8795a20: Add common product-facing primitives: `MediaCard`, `MetricCard`, `Progress` (linear v1), `Rating` (readonly v1), and the `Timeline` pattern (vertical-only v1).
8
+
9
+ ## 1.0.6
10
+
11
+ ### Patch Changes
12
+
13
+ - 9d9f997: Add common UI primitives: `Avatar`, `AvatarGroup`, `Chip`, `ChipGroup`, `SearchBar`, and `FilterBar`. Add list building blocks: `List`, `ListRow`, and `ListSection`. Also add `InputTrailingAction` / `trailingAction` support to `Input`.
14
+
3
15
  ## 1.0.5
4
16
 
5
17
  ### Patch Changes
package/README.md CHANGED
@@ -442,6 +442,145 @@ Inherits all Surface `CardProps` except `children`, `p`, `radius`, `variant`, an
442
442
 
443
443
  </details>
444
444
 
445
+ ### `MediaCard`
446
+
447
+ Media-first card surface for listings, content previews, and catalog items.
448
+
449
+ ```tsx
450
+ <MediaCard
451
+ imageSource={require('./cover.png')}
452
+ imageLabel="Cover image"
453
+ title="MediaCard"
454
+ description="Composes an image slot, header content, badges, actions, and footer metadata."
455
+ badges={<Badge tone="primary">Featured</Badge>}
456
+ footer={<Rating value={4.5} />}
457
+ onPress={() => undefined}
458
+ />
459
+ ```
460
+
461
+ <details>
462
+ <summary>Props</summary>
463
+
464
+ ZORA props:
465
+
466
+ | Prop | Type | Default | Notes |
467
+ | ------------------ | --------------------- | ----------- | ---------------------------------------------------------- |
468
+ | `imageSource` | `ImageSourcePropType` | - | Image source (mutually exclusive with `image`). |
469
+ | `imageLabel` | `string` | - | Accessibility label for `imageSource`. |
470
+ | `image` | `React.ReactNode` | - | Custom image slot (mutually exclusive with `imageSource`). |
471
+ | `imageAspectRatio` | `number` | `16 / 9` | Aspect ratio used when rendering `imageSource`. |
472
+ | `title` | `React.ReactNode` | - | Required title. |
473
+ | `description` | `React.ReactNode` | - | Optional description under the title. |
474
+ | `eyebrow` | `React.ReactNode` | - | Optional caption above the title. |
475
+ | `badges` | `React.ReactNode` | - | Optional badge/tags region near the title. |
476
+ | `actions` | `React.ReactNode` | - | Optional trailing action area; disables `onPress`. |
477
+ | `footer` | `React.ReactNode` | - | Optional footer content under the body. |
478
+ | `children` | `React.ReactNode` | - | Optional body content. |
479
+ | `tone` | `ZoraCardTone` | `'default'` | Passed to the underlying `Card`. |
480
+ | `compact` | `boolean` | `false` | Uses tighter spacing. |
481
+ | `onPress` | `() => void` | - | Makes the card pressable when no `actions` are present. |
482
+ | `testID` | `string` | - | Forwarded to the underlying `Card`. |
483
+
484
+ Inherited props:
485
+
486
+ No inherited props. `MediaCardProps` is declared directly by ZORA.
487
+
488
+ </details>
489
+
490
+ ### `MetricCard`
491
+
492
+ Compact metric surface for dashboards, stats, and summary cards.
493
+
494
+ ```tsx
495
+ <MetricCard
496
+ label="Monthly active users"
497
+ value="14.2k"
498
+ delta="+4.1%"
499
+ deltaTone="success"
500
+ description="Last 30 days"
501
+ />
502
+ ```
503
+
504
+ <details>
505
+ <summary>Props</summary>
506
+
507
+ ZORA props:
508
+
509
+ | Prop | Type | Default | Notes |
510
+ | ------------- | ----------------- | ----------- | ------------------------------------------------------- |
511
+ | `label` | `React.ReactNode` | - | Required label above the value. |
512
+ | `value` | `React.ReactNode` | - | Required metric value. |
513
+ | `description` | `React.ReactNode` | - | Optional supporting copy. |
514
+ | `icon` | `ButtonIconSpec` | - | Optional icon shown next to the label. |
515
+ | `delta` | `React.ReactNode` | - | Optional delta badge content. |
516
+ | `deltaTone` | `ZoraTone` | `'neutral'` | Tone used for the delta `Badge`. |
517
+ | `actions` | `React.ReactNode` | - | Optional trailing action area; disables `onPress`. |
518
+ | `tone` | `ZoraCardTone` | `'default'` | Passed to the underlying `Card`. |
519
+ | `compact` | `boolean` | `false` | Uses tighter spacing. |
520
+ | `onPress` | `() => void` | - | Makes the card pressable when no `actions` are present. |
521
+ | `testID` | `string` | - | Forwarded to the underlying `Card`. |
522
+
523
+ Inherited props:
524
+
525
+ No inherited props. `MetricCardProps` is declared directly by ZORA.
526
+
527
+ </details>
528
+
529
+ ### `Progress`
530
+
531
+ Linear progress bar with semantic tone.
532
+
533
+ ```tsx
534
+ <Progress value={72} />
535
+ <Progress tone="success" value={38} />
536
+ ```
537
+
538
+ <details>
539
+ <summary>Props</summary>
540
+
541
+ ZORA props:
542
+
543
+ | Prop | Type | Default | Notes |
544
+ | -------- | ----------------- | ----------- | ----------------------------- |
545
+ | `value` | `number` | - | Current progress value. |
546
+ | `max` | `number` | `100` | Maximum value for completion. |
547
+ | `tone` | `ZoraTone` | `'primary'` | Fill tone. |
548
+ | `size` | `ZoraControlSize` | `'m'` | Controls bar height. |
549
+ | `testID` | `string` | - | Test id. |
550
+
551
+ Inherited props:
552
+
553
+ No inherited props. `ProgressProps` is declared directly by ZORA.
554
+
555
+ </details>
556
+
557
+ ### `Rating`
558
+
559
+ Readonly rating display rendered as star icons.
560
+
561
+ ```tsx
562
+ <Rating value={4.5} />
563
+ ```
564
+
565
+ <details>
566
+ <summary>Props</summary>
567
+
568
+ ZORA props:
569
+
570
+ | Prop | Type | Default | Notes |
571
+ | -------- | ----------------- | ----------- | ---------------------- |
572
+ | `value` | `number` | - | Current rating value. |
573
+ | `max` | `number` | `5` | Maximum rating value. |
574
+ | `tone` | `ZoraTone` | `'warning'` | Tone for filled icons. |
575
+ | `size` | `ZoraControlSize` | `'m'` | Icon sizing preset. |
576
+ | `testID` | `string` | - | Test id. |
577
+
578
+ Inherited props:
579
+
580
+ No inherited props. `RatingProps` is declared directly by ZORA.
581
+
582
+ </details>
583
+
445
584
  ### `Input`
446
585
 
447
586
  Text input wrapper with ZORA sizing and optional Surface icon specs.
@@ -1273,6 +1412,151 @@ No inherited props. `FilterBarProps` is declared directly by ZORA.
1273
1412
 
1274
1413
  </details>
1275
1414
 
1415
+ ### `List`
1416
+
1417
+ List wrapper that renders `ListRow` items with dividers or spacing, or accepts custom children.
1418
+
1419
+ ```tsx
1420
+ <List
1421
+ items={[
1422
+ { title: 'Account', description: 'Profile and security', onPress: () => undefined },
1423
+ { title: 'Notifications', trailing: <Badge>On</Badge> },
1424
+ ]}
1425
+ />
1426
+ ```
1427
+
1428
+ <details>
1429
+ <summary>Props</summary>
1430
+
1431
+ ZORA props:
1432
+
1433
+ | Prop | Type | Default | Notes |
1434
+ | ------------ | ----------------- | ----------- | ----------------------------------------------------- |
1435
+ | `items` | `ListRowProps[]` | - | Items mode. Mutually exclusive with `children`. |
1436
+ | `children` | `React.ReactNode` | - | Custom children mode. |
1437
+ | `rowVariant` | `ListRowVariant` | `'divider'` | Default variant applied when an item omits `variant`. |
1438
+ | `compact` | `boolean` | `false` | Default compact value applied to rows. |
1439
+ | `testID` | `string` | - | Test id. |
1440
+
1441
+ Behavior notes:
1442
+
1443
+ - In items mode, ZORA inserts `Divider` between `variant="divider"` rows and `Spacer` between `variant="card"` rows.
1444
+
1445
+ Inherited props:
1446
+
1447
+ No inherited props. `ListProps` is declared directly by ZORA.
1448
+
1449
+ </details>
1450
+
1451
+ ### `ListRow`
1452
+
1453
+ Single list row with leading/trailing slots, optional metadata, and a structured action model.
1454
+
1455
+ ```tsx
1456
+ <ListRow title="Profile" description="Update your details" onPress={() => undefined} />
1457
+ ```
1458
+
1459
+ <details>
1460
+ <summary>Props</summary>
1461
+
1462
+ ZORA props:
1463
+
1464
+ | Prop | Type | Default | Notes |
1465
+ | ------------- | ----------------- | ----------- | ---------------------------------------------------------------- |
1466
+ | `title` | `React.ReactNode` | - | Required row title. |
1467
+ | `description` | `React.ReactNode` | - | Supporting description. |
1468
+ | `meta` | `React.ReactNode` | - | Small secondary metadata below description. |
1469
+ | `leading` | `React.ReactNode` | - | Leading slot (icon/avatar/media). |
1470
+ | `trailing` | `React.ReactNode` | - | Trailing slot (badges/meta). |
1471
+ | `variant` | `ListRowVariant` | `'divider'` | `divider` or `card`. |
1472
+ | `compact` | `boolean` | `false` | Uses tighter padding and typography spacing. |
1473
+ | `selected` | `boolean` | `false` | Selected styling state. |
1474
+ | `disabled` | `boolean` | `false` | Disables interaction and mutes presentation. |
1475
+ | `onPress` | `() => void` | - | Makes the row pressable. Mutually exclusive with `action`. |
1476
+ | `action` | `React.ReactNode` | - | Trailing interactive content. Mutually exclusive with `onPress`. |
1477
+ | `testID` | `string` | - | Test id. |
1478
+
1479
+ Inherited props:
1480
+
1481
+ No inherited props. `ListRowProps` is declared directly by ZORA.
1482
+
1483
+ </details>
1484
+
1485
+ ### `ListSection`
1486
+
1487
+ Section wrapper for list content with an optional `SectionHeader`.
1488
+
1489
+ ```tsx
1490
+ <ListSection title="Settings" items={[{ title: 'Account' }]} />
1491
+ ```
1492
+
1493
+ <details>
1494
+ <summary>Props</summary>
1495
+
1496
+ ZORA props:
1497
+
1498
+ | Prop | Type | Default | Notes |
1499
+ | ------------- | ----------------- | ----------- | ----------------------------------------------------- |
1500
+ | `title` | `React.ReactNode` | - | Optional section title (renders `SectionHeader`). |
1501
+ | `description` | `React.ReactNode` | - | Optional section description. |
1502
+ | `eyebrow` | `React.ReactNode` | - | Optional eyebrow above the title. |
1503
+ | `actions` | `React.ReactNode` | - | Optional trailing header actions. |
1504
+ | `items` | `ListRowProps[]` | - | Items mode list content. |
1505
+ | `children` | `React.ReactNode` | - | Custom children mode list content. |
1506
+ | `rowVariant` | `ListRowVariant` | `'divider'` | Default variant applied when an item omits `variant`. |
1507
+ | `compact` | `boolean` | `false` | Default compact value applied to rows. |
1508
+ | `testID` | `string` | - | Test id. |
1509
+
1510
+ Inherited props:
1511
+
1512
+ No inherited props. `ListSectionProps` is declared directly by ZORA.
1513
+
1514
+ </details>
1515
+
1516
+ ### `Timeline`
1517
+
1518
+ Vertical-only timeline pattern for onboarding steps, order tracking, and activity sequences.
1519
+
1520
+ ```tsx
1521
+ <Timeline
1522
+ items={[
1523
+ { id: '1', title: 'Order placed', meta: '09:15', status: 'success' },
1524
+ { id: '2', title: 'In transit', meta: '11:42', status: 'primary' },
1525
+ { id: '3', title: 'Requires attention', meta: 'Today', status: 'warning' },
1526
+ ]}
1527
+ />
1528
+ ```
1529
+
1530
+ <details>
1531
+ <summary>Props</summary>
1532
+
1533
+ ZORA props:
1534
+
1535
+ | Prop | Type | Default | Notes |
1536
+ | --------- | ---------------- | ------- | --------------------------------------------- |
1537
+ | `items` | `TimelineItem[]` | - | Ordered timeline items (vertical-only in v1). |
1538
+ | `compact` | `boolean` | `false` | Uses tighter spacing between items. |
1539
+ | `testID` | `string` | - | Test id. |
1540
+
1541
+ Item shape:
1542
+
1543
+ ```ts
1544
+ type TimelineItem = {
1545
+ id: string;
1546
+ title: React.ReactNode;
1547
+ description?: React.ReactNode;
1548
+ meta?: React.ReactNode;
1549
+ status?: ZoraTone;
1550
+ icon?: ButtonIconSpec;
1551
+ };
1552
+ ```
1553
+
1554
+ Inherited props:
1555
+
1556
+ No inherited props. `TimelineProps` is declared directly by ZORA.
1557
+
1558
+ </details>
1559
+
1276
1560
  ### `SettingsRow`
1277
1561
 
1278
1562
  Compact settings row with optional metadata, control, and press handling.
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import type { MediaCardProps } from './types';
3
+ export declare const MediaCard: (props: MediaCardProps) => React.ReactElement | null;
4
+ //# sourceMappingURL=MediaCard.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MediaCard.d.ts","sourceRoot":"","sources":["../../../src/components/media-card/MediaCard.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAS1B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AA8G9C,eAAO,MAAM,SAAS,sDAAqC,CAAC"}
@@ -0,0 +1,64 @@
1
+ import React from 'react';
2
+ import { Image } from 'react-native';
3
+ import { Box, Stack } from '../../foundation';
4
+ import { useZoraTheme } from '../../theme/useZoraTheme';
5
+ import { withZoraThemeScope } from '../../theme/withZoraThemeScope';
6
+ import { Card } from '../card';
7
+ import { Heading } from '../heading';
8
+ import { Text } from '../text';
9
+ function resolveImageAspectRatio(imageAspectRatio) {
10
+ if (!Number.isFinite(imageAspectRatio) || imageAspectRatio <= 0) {
11
+ return 16 / 9;
12
+ }
13
+ return imageAspectRatio;
14
+ }
15
+ function MediaCardInner({ themeId: _themeId, mode: _mode, testID, imageSource, imageLabel, image, imageAspectRatio = 16 / 9, title, description, eyebrow, badges, actions, footer, children, tone = 'default', compact = false, onPress, }) {
16
+ const { theme } = useZoraTheme();
17
+ const gap = compact ? 's' : 'm';
18
+ const isInteractive = Boolean(onPress) && !actions;
19
+ const resolvedAspectRatio = resolveImageAspectRatio(imageAspectRatio);
20
+ const renderImage = () => {
21
+ if (image) {
22
+ return (<Box radius="m" style={{ overflow: 'hidden' }}>
23
+ {image}
24
+ </Box>);
25
+ }
26
+ if (!imageSource) {
27
+ return null;
28
+ }
29
+ return (<Box bg={theme.semantics.neutral.surface} radius="m" style={{ overflow: 'hidden' }}>
30
+ <Box style={{ aspectRatio: resolvedAspectRatio, width: '100%' }}>
31
+ <Image accessibilityLabel={imageLabel} source={imageSource} style={{ height: '100%', width: '100%' }}/>
32
+ </Box>
33
+ </Box>);
34
+ };
35
+ const hasHeader = [eyebrow, title, description, badges, actions].some((item) => item != null);
36
+ return (<Card compact={compact} onPress={isInteractive ? onPress : undefined} testID={testID} tone={tone}>
37
+ <Stack gap={gap}>
38
+ {renderImage()}
39
+
40
+ {hasHeader ? (<Stack align={{ base: 'flex-start', md: 'center' }} direction={{ base: 'column', md: 'row' }} gap="m" justify="space-between">
41
+ <Box flex={1}>
42
+ <Stack gap="xs">
43
+ {eyebrow ? (<Text tone="muted" variant="caption" weight="semiBold">
44
+ {eyebrow}
45
+ </Text>) : null}
46
+ <Stack gap="xs">
47
+ <Heading level={compact ? 4 : 3}>{title}</Heading>
48
+ {badges ? <Box>{badges}</Box> : null}
49
+ </Stack>
50
+ {description ? (<Text tone="muted" variant="bodySmall">
51
+ {description}
52
+ </Text>) : null}
53
+ </Stack>
54
+ </Box>
55
+ {actions ? <Box>{actions}</Box> : null}
56
+ </Stack>) : null}
57
+
58
+ {children ? <Box>{children}</Box> : null}
59
+ {footer ? <Box pt="xs">{footer}</Box> : null}
60
+ </Stack>
61
+ </Card>);
62
+ }
63
+ export const MediaCard = withZoraThemeScope(MediaCardInner);
64
+ //# sourceMappingURL=MediaCard.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MediaCard.js","sourceRoot":"","sources":["../../../src/components/media-card/MediaCard.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAErC,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAG/B,SAAS,uBA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AAI,CAAC,CAAC,MAAM,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAC9C;MAAA,EAAE,KAAK,CACT;IAAA,EAAE,IAAI,CAAC,CACR,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,SAAS,GAAG,kBAAkB,CAAC,cAAc,CAAC,CAAC","sourcesContent":["import React from 'react';\nimport { Image } from 'react-native';\n\nimport { Box, Stack } from '../../foundation';\nimport { useZoraTheme } from '../../theme/useZoraTheme';\nimport { withZoraThemeScope } from '../../theme/withZoraThemeScope';\nimport { Card } from '../card';\nimport { Heading } from '../heading';\nimport { Text } from '../text';\nimport type { MediaCardProps } from './types';\n\nfunction resolveImageAspectRatio(\n imageAspectRatio: NonNullable<MediaCardProps['imageAspectRatio']>,\n) {\n if (!Number.isFinite(imageAspectRatio) || imageAspectRatio <= 0) {\n return 16 / 9;\n }\n\n return imageAspectRatio;\n}\n\nfunction MediaCardInner({\n themeId: _themeId,\n mode: _mode,\n testID,\n imageSource,\n imageLabel,\n image,\n imageAspectRatio = 16 / 9,\n title,\n description,\n eyebrow,\n badges,\n actions,\n footer,\n children,\n tone = 'default',\n compact = false,\n onPress,\n}: MediaCardProps) {\n const { theme } = useZoraTheme();\n const gap = compact ? 's' : 'm';\n const isInteractive = Boolean(onPress) && !actions;\n const resolvedAspectRatio = resolveImageAspectRatio(imageAspectRatio);\n\n const renderImage = () => {\n if (image) {\n return (\n <Box radius=\"m\" style={{ overflow: 'hidden' }}>\n {image}\n </Box>\n );\n }\n\n if (!imageSource) {\n return null;\n }\n\n return (\n <Box bg={theme.semantics.neutral.surface} radius=\"m\" style={{ overflow: 'hidden' }}>\n <Box style={{ aspectRatio: resolvedAspectRatio, width: '100%' }}>\n <Image\n accessibilityLabel={imageLabel}\n source={imageSource}\n style={{ height: '100%', width: '100%' }}\n />\n </Box>\n </Box>\n );\n };\n\n const hasHeader = [eyebrow, title, description, badges, actions].some((item) => item != null);\n\n return (\n <Card\n compact={compact}\n onPress={isInteractive ? onPress : undefined}\n testID={testID}\n tone={tone}\n >\n <Stack gap={gap}>\n {renderImage()}\n\n {hasHeader ? (\n <Stack\n align={{ base: 'flex-start', md: 'center' }}\n direction={{ base: 'column', md: 'row' }}\n gap=\"m\"\n justify=\"space-between\"\n >\n <Box flex={1}>\n <Stack gap=\"xs\">\n {eyebrow ? (\n <Text tone=\"muted\" variant=\"caption\" weight=\"semiBold\">\n {eyebrow}\n </Text>\n ) : null}\n <Stack gap=\"xs\">\n <Heading level={compact ? 4 : 3}>{title}</Heading>\n {badges ? <Box>{badges}</Box> : null}\n </Stack>\n {description ? (\n <Text tone=\"muted\" variant=\"bodySmall\">\n {description}\n </Text>\n ) : null}\n </Stack>\n </Box>\n {actions ? <Box>{actions}</Box> : null}\n </Stack>\n ) : null}\n\n {children ? <Box>{children}</Box> : null}\n {footer ? <Box pt=\"xs\">{footer}</Box> : null}\n </Stack>\n </Card>\n );\n}\n\nexport const MediaCard = withZoraThemeScope(MediaCardInner);\n"]}
@@ -0,0 +1,3 @@
1
+ export { MediaCard } from './MediaCard';
2
+ export type { MediaCardImageProps, MediaCardProps } from './types';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/media-card/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,YAAY,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { MediaCard } from './MediaCard';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/media-card/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC","sourcesContent":["export { MediaCard } from './MediaCard';\nexport type { MediaCardImageProps, MediaCardProps } from './types';\n"]}
@@ -0,0 +1,36 @@
1
+ import type React from 'react';
2
+ import type { ImageSourcePropType } from 'react-native';
3
+ import type { ZoraCardTone } from '../../internal/recipes';
4
+ import type { ZoraBaseProps } from '../../theme/ZoraBaseProps';
5
+ interface MediaCardWithImageSource {
6
+ imageSource: ImageSourcePropType;
7
+ imageLabel?: string;
8
+ image?: never;
9
+ }
10
+ interface MediaCardWithImageSlot {
11
+ image: React.ReactNode;
12
+ imageSource?: never;
13
+ imageLabel?: never;
14
+ }
15
+ interface MediaCardWithoutImage {
16
+ image?: never;
17
+ imageSource?: never;
18
+ imageLabel?: never;
19
+ }
20
+ export type MediaCardImageProps = MediaCardWithImageSource | MediaCardWithImageSlot | MediaCardWithoutImage;
21
+ interface MediaCardBaseProps extends ZoraBaseProps {
22
+ title: React.ReactNode;
23
+ description?: React.ReactNode;
24
+ eyebrow?: React.ReactNode;
25
+ badges?: React.ReactNode;
26
+ actions?: React.ReactNode;
27
+ footer?: React.ReactNode;
28
+ children?: React.ReactNode;
29
+ tone?: ZoraCardTone;
30
+ compact?: boolean;
31
+ onPress?: () => void;
32
+ imageAspectRatio?: number;
33
+ }
34
+ export type MediaCardProps = MediaCardBaseProps & MediaCardImageProps;
35
+ export {};
36
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/media-card/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAExD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAE/D,UAAU,wBAAwB;IAChC,WAAW,EAAE,mBAAmB,CAAC;IACjC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,KAAK,CAAC;CACf;AAED,UAAU,sBAAsB;IAC9B,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB,WAAW,CAAC,EAAE,KAAK,CAAC;IACpB,UAAU,CAAC,EAAE,KAAK,CAAC;CACpB;AAED,UAAU,qBAAqB;IAC7B,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,WAAW,CAAC,EAAE,KAAK,CAAC;IACpB,UAAU,CAAC,EAAE,KAAK,CAAC;CACpB;AAED,MAAM,MAAM,mBAAmB,GAC3B,wBAAwB,GACxB,sBAAsB,GACtB,qBAAqB,CAAC;AAE1B,UAAU,kBAAmB,SAAQ,aAAa;IAChD,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC9B,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACzB,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACzB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,IAAI,CAAC,EAAE,YAAY,CAAC;IACpB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED,MAAM,MAAM,cAAc,GAAG,kBAAkB,GAAG,mBAAmB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/components/media-card/types.ts"],"names":[],"mappings":"","sourcesContent":["import type React from 'react';\nimport type { ImageSourcePropType } from 'react-native';\n\nimport type { ZoraCardTone } from '../../internal/recipes';\nimport type { ZoraBaseProps } from '../../theme/ZoraBaseProps';\n\ninterface MediaCardWithImageSource {\n imageSource: ImageSourcePropType;\n imageLabel?: string;\n image?: never;\n}\n\ninterface MediaCardWithImageSlot {\n image: React.ReactNode;\n imageSource?: never;\n imageLabel?: never;\n}\n\ninterface MediaCardWithoutImage {\n image?: never;\n imageSource?: never;\n imageLabel?: never;\n}\n\nexport type MediaCardImageProps =\n | MediaCardWithImageSource\n | MediaCardWithImageSlot\n | MediaCardWithoutImage;\n\ninterface MediaCardBaseProps extends ZoraBaseProps {\n title: React.ReactNode;\n description?: React.ReactNode;\n eyebrow?: React.ReactNode;\n badges?: React.ReactNode;\n actions?: React.ReactNode;\n footer?: React.ReactNode;\n children?: React.ReactNode;\n tone?: ZoraCardTone;\n compact?: boolean;\n onPress?: () => void;\n imageAspectRatio?: number;\n}\n\nexport type MediaCardProps = MediaCardBaseProps & MediaCardImageProps;\n"]}
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import type { MetricCardProps } from './types';
3
+ export declare const MetricCard: (props: MetricCardProps) => React.ReactElement | null;
4
+ //# sourceMappingURL=MetricCard.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MetricCard.d.ts","sourceRoot":"","sources":["../../../src/components/metric-card/MetricCard.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAW1B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAwE/C,eAAO,MAAM,UAAU,uDAAsC,CAAC"}
@@ -0,0 +1,43 @@
1
+ import React from 'react';
2
+ import { Box, Inline, Stack } from '../../foundation';
3
+ import { resolveBadgeRecipe, resolveIconSize } from '../../internal/recipes';
4
+ import { useZoraTheme } from '../../theme/useZoraTheme';
5
+ import { withZoraThemeScope } from '../../theme/withZoraThemeScope';
6
+ import { Badge } from '../badge';
7
+ import { Card } from '../card';
8
+ import { Heading } from '../heading';
9
+ import { Icon } from '../icon';
10
+ import { Text } from '../text';
11
+ function MetricCardInner({ themeId: _themeId, mode: _mode, testID, label, value, description, icon, delta, deltaTone = 'neutral', actions, tone = 'default', compact = false, onPress, }) {
12
+ const { theme } = useZoraTheme();
13
+ const isInteractive = Boolean(onPress) && !actions;
14
+ const badgeRecipe = resolveBadgeRecipe({ tone: deltaTone, emphasis: 'soft', size: 's' });
15
+ const iconColor = theme.semantics.content.muted;
16
+ return (<Card compact={compact} onPress={isInteractive ? onPress : undefined} testID={testID} tone={tone}>
17
+ <Stack gap={compact ? 's' : 'm'}>
18
+ <Inline align="flex-start" gap="m" justify="space-between">
19
+ <Stack flex={1} gap="xs">
20
+ <Inline align="center" gap="xs" wrap="wrap">
21
+ {icon ? (<Icon color={iconColor} name={icon.name} provider={icon.provider} size={resolveIconSize('s')}/>) : null}
22
+ <Text tone="muted" variant="caption" weight="semiBold">
23
+ {label}
24
+ </Text>
25
+ {delta != null ? (<Badge emphasis={badgeRecipe.variant} size={badgeRecipe.size} tone={badgeRecipe.tone}>
26
+ {delta}
27
+ </Badge>) : null}
28
+ </Inline>
29
+
30
+ <Heading level={compact ? 3 : 2}>{value}</Heading>
31
+
32
+ {description ? (<Text tone="muted" variant="bodySmall">
33
+ {description}
34
+ </Text>) : null}
35
+ </Stack>
36
+
37
+ {actions ? <Box>{actions}</Box> : null}
38
+ </Inline>
39
+ </Stack>
40
+ </Card>);
41
+ }
42
+ export const MetricCard = withZoraThemeScope(MetricCardInner);
43
+ //# sourceMappingURL=MetricCard.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MetricCard.js","sourceRoot":"","sources":["../../../src/components/metric-card/MetricCard.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAC7E,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAE,K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CAAC,CAAC,CAAC,IAAI,CACV;UAAA,EAAE,KAAK,CAEP;;UAAA,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CACxC;QAAA,EAAE,MAAM,CACV;MAAA,EAAE,KAAK,CACT;IAAA,EAAE,IAAI,CAAC,CACR,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,UAAU,GAAG,kBAAkB,CAAC,eAAe,CAAC,CAAC","sourcesContent":["import React from 'react';\n\nimport { Box, Inline, Stack } from '../../foundation';\nimport { resolveBadgeRecipe, resolveIconSize } from '../../internal/recipes';\nimport { useZoraTheme } from '../../theme/useZoraTheme';\nimport { withZoraThemeScope } from '../../theme/withZoraThemeScope';\nimport { Badge } from '../badge';\nimport { Card } from '../card';\nimport { Heading } from '../heading';\nimport { Icon } from '../icon';\nimport { Text } from '../text';\nimport type { MetricCardProps } from './types';\n\nfunction MetricCardInner({\n themeId: _themeId,\n mode: _mode,\n testID,\n label,\n value,\n description,\n icon,\n delta,\n deltaTone = 'neutral',\n actions,\n tone = 'default',\n compact = false,\n onPress,\n}: MetricCardProps) {\n const { theme } = useZoraTheme();\n const isInteractive = Boolean(onPress) && !actions;\n\n const badgeRecipe = resolveBadgeRecipe({ tone: deltaTone, emphasis: 'soft', size: 's' });\n const iconColor = theme.semantics.content.muted;\n\n return (\n <Card\n compact={compact}\n onPress={isInteractive ? onPress : undefined}\n testID={testID}\n tone={tone}\n >\n <Stack gap={compact ? 's' : 'm'}>\n <Inline align=\"flex-start\" gap=\"m\" justify=\"space-between\">\n <Stack flex={1} gap=\"xs\">\n <Inline align=\"center\" gap=\"xs\" wrap=\"wrap\">\n {icon ? (\n <Icon\n color={iconColor}\n name={icon.name}\n provider={icon.provider}\n size={resolveIconSize('s')}\n />\n ) : null}\n <Text tone=\"muted\" variant=\"caption\" weight=\"semiBold\">\n {label}\n </Text>\n {delta != null ? (\n <Badge\n emphasis={badgeRecipe.variant}\n size={badgeRecipe.size}\n tone={badgeRecipe.tone}\n >\n {delta}\n </Badge>\n ) : null}\n </Inline>\n\n <Heading level={compact ? 3 : 2}>{value}</Heading>\n\n {description ? (\n <Text tone=\"muted\" variant=\"bodySmall\">\n {description}\n </Text>\n ) : null}\n </Stack>\n\n {actions ? <Box>{actions}</Box> : null}\n </Inline>\n </Stack>\n </Card>\n );\n}\n\nexport const MetricCard = withZoraThemeScope(MetricCardInner);\n"]}
@@ -0,0 +1,3 @@
1
+ export { MetricCard } from './MetricCard';
2
+ export type { MetricCardProps } from './types';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/metric-card/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,YAAY,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { MetricCard } from './MetricCard';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/metric-card/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC","sourcesContent":["export { MetricCard } from './MetricCard';\nexport type { MetricCardProps } from './types';\n"]}
@@ -0,0 +1,17 @@
1
+ import type { ButtonIconSpec } from '@ankhorage/surface';
2
+ import type React from 'react';
3
+ import type { ZoraCardTone, ZoraTone } from '../../internal/recipes';
4
+ import type { ZoraBaseProps } from '../../theme/ZoraBaseProps';
5
+ export interface MetricCardProps extends ZoraBaseProps {
6
+ label: React.ReactNode;
7
+ value: React.ReactNode;
8
+ description?: React.ReactNode;
9
+ icon?: ButtonIconSpec;
10
+ delta?: React.ReactNode;
11
+ deltaTone?: ZoraTone;
12
+ actions?: React.ReactNode;
13
+ tone?: ZoraCardTone;
14
+ compact?: boolean;
15
+ onPress?: () => void;
16
+ }
17
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/metric-card/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AACrE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAE/D,MAAM,WAAW,eAAgB,SAAQ,aAAa;IACpD,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC9B,IAAI,CAAC,EAAE,cAAc,CAAC;IACtB,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACxB,SAAS,CAAC,EAAE,QAAQ,CAAC;IACrB,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,IAAI,CAAC,EAAE,YAAY,CAAC;IACpB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/components/metric-card/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ButtonIconSpec } from '@ankhorage/surface';\nimport type React from 'react';\n\nimport type { ZoraCardTone, ZoraTone } from '../../internal/recipes';\nimport type { ZoraBaseProps } from '../../theme/ZoraBaseProps';\n\nexport interface MetricCardProps extends ZoraBaseProps {\n label: React.ReactNode;\n value: React.ReactNode;\n description?: React.ReactNode;\n icon?: ButtonIconSpec;\n delta?: React.ReactNode;\n deltaTone?: ZoraTone;\n actions?: React.ReactNode;\n tone?: ZoraCardTone;\n compact?: boolean;\n onPress?: () => void;\n}\n"]}
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import { type ProgressProps } from './types';
3
+ export declare const Progress: (props: ProgressProps) => React.ReactElement | null;
4
+ //# sourceMappingURL=Progress.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Progress.d.ts","sourceRoot":"","sources":["../../../src/components/progress/Progress.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAM1B,OAAO,EAAE,KAAK,aAAa,EAAuB,MAAM,SAAS,CAAC;AA2ClE,eAAO,MAAM,QAAQ,qDAAoC,CAAC"}
@@ -0,0 +1,28 @@
1
+ import React from 'react';
2
+ import { Box } from '../../foundation';
3
+ import { useZoraTheme } from '../../theme/useZoraTheme';
4
+ import { withZoraThemeScope } from '../../theme/withZoraThemeScope';
5
+ import { resolveProgressFraction } from './resolveProgressFraction';
6
+ import { resolveProgressRole } from './types';
7
+ function resolveProgressHeight(size) {
8
+ switch (size) {
9
+ case 's':
10
+ return 4;
11
+ case 'm':
12
+ return 6;
13
+ case 'l':
14
+ default:
15
+ return 8;
16
+ }
17
+ }
18
+ function ProgressInner({ themeId: _themeId, mode: _mode, testID, value, max = 100, tone = 'primary', size = 'm', }) {
19
+ const { theme } = useZoraTheme();
20
+ const fraction = resolveProgressFraction({ value, max });
21
+ const height = resolveProgressHeight(size);
22
+ const role = resolveProgressRole(theme, tone);
23
+ return (<Box accessibilityRole="progressbar" bg={theme.semantics.neutral.surface} borderColor={theme.semantics.neutral.divider} borderWidth={1} radius="full" testID={testID} style={{ height, overflow: 'hidden' }}>
24
+ <Box bg={role.base} style={{ height: '100%', width: `${fraction * 100}%` }}/>
25
+ </Box>);
26
+ }
27
+ export const Progress = withZoraThemeScope(ProgressInner);
28
+ //# sourceMappingURL=Progress.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Progress.js","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CACf,MAAM,CAAC,MAAM,CACb,MAAM,CAAC,CAAC,MAAM,CAAC,CACf,KAAK,CAAC,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC,CAEtC;MAAA,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,QAAQ,GAAG,GAAG,GAAG,EAAE,CAAC,EAC7E;IAAA,EAAE,GAAG,CAAC,CACP,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,QAAQ,GAAG,kBAAkB,CAAC,aAAa,CAAC,CAAC","sourcesContent":["import React from 'react';\n\nimport { Box } from '../../foundation';\nimport { useZoraTheme } from '../../theme/useZoraTheme';\nimport { withZoraThemeScope } from '../../theme/withZoraThemeScope';\nimport { resolveProgressFraction } from './resolveProgressFraction';\nimport { type ProgressProps, resolveProgressRole } from './types';\n\nfunction resolveProgressHeight(size: NonNullable<ProgressProps['size']>): number {\n switch (size) {\n case 's':\n return 4;\n case 'm':\n return 6;\n case 'l':\n default:\n return 8;\n }\n}\n\nfunction ProgressInner({\n themeId: _themeId,\n mode: _mode,\n testID,\n value,\n max = 100,\n tone = 'primary',\n size = 'm',\n}: ProgressProps) {\n const { theme } = useZoraTheme();\n const fraction = resolveProgressFraction({ value, max });\n const height = resolveProgressHeight(size);\n const role = resolveProgressRole(theme, tone);\n\n return (\n <Box\n accessibilityRole=\"progressbar\"\n bg={theme.semantics.neutral.surface}\n borderColor={theme.semantics.neutral.divider}\n borderWidth={1}\n radius=\"full\"\n testID={testID}\n style={{ height, overflow: 'hidden' }}\n >\n <Box bg={role.base} style={{ height: '100%', width: `${fraction * 100}%` }} />\n </Box>\n );\n}\n\nexport const Progress = withZoraThemeScope(ProgressInner);\n"]}