@krapwoo/ds-viewer 0.4.7 → 0.4.8

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 (58) hide show
  1. package/README.md +21 -6
  2. package/dist/cli/doctor.js +4 -2
  3. package/dist/cli/init.js +5 -8
  4. package/dist/native/catalog/comparison.js +17 -8
  5. package/native/catalog/CatalogShell.tsx +5 -1
  6. package/native/catalog/ComparisonGrid.tsx +5 -1
  7. package/native/catalog/ComparisonGroups.tsx +7 -1
  8. package/native/catalog/ComparisonList.tsx +7 -1
  9. package/native/catalog/PhoneFrame.tsx +108 -24
  10. package/native/catalog/ReferenceDetails.tsx +8 -0
  11. package/native/catalog/SectionBlock.tsx +10 -4
  12. package/native/catalog/SpecimenAddress.tsx +15 -0
  13. package/native/catalog/SpecimenSurface.tsx +66 -4
  14. package/native/catalog/comparison.ts +21 -8
  15. package/native/catalog/deviceFrame.ts +14 -0
  16. package/native/catalog/overlayViewport.ts +4 -2
  17. package/native/catalog/specimenSurfaceStyle.ts +54 -0
  18. package/package.json +5 -4
  19. package/starter-kit/components/AnimatedChevron/AnimatedChevron.catalog.tsx +1 -1
  20. package/starter-kit/components/Avatar/Avatar.catalog.tsx +1 -1
  21. package/starter-kit/components/Badge/Badge.catalog.tsx +1 -1
  22. package/starter-kit/components/Banner/Banner.catalog.tsx +2 -1
  23. package/starter-kit/components/BottomSheet/BottomSheet.catalog.tsx +5 -1
  24. package/starter-kit/components/Button/Button.catalog.tsx +1 -1
  25. package/starter-kit/components/ButtonGroup/ButtonGroup.catalog.tsx +8 -1
  26. package/starter-kit/components/Card/Card.catalog.tsx +2 -1
  27. package/starter-kit/components/Checkbox/Checkbox.catalog.tsx +2 -2
  28. package/starter-kit/components/Dialog/Dialog.catalog.tsx +1 -1
  29. package/starter-kit/components/Divider/Divider.catalog.tsx +2 -1
  30. package/starter-kit/components/Dock/Dock.catalog.tsx +4 -1
  31. package/starter-kit/components/Dropdown/Dropdown.catalog.tsx +1 -1
  32. package/starter-kit/components/EmptyState/EmptyState.catalog.tsx +2 -1
  33. package/starter-kit/components/FieldContainer/FieldContainer.catalog.tsx +5 -1
  34. package/starter-kit/components/InputClearButton/InputClearButton.catalog.tsx +1 -1
  35. package/starter-kit/components/InputField/InputField.catalog.tsx +3 -1
  36. package/starter-kit/components/List/List.catalog.tsx +2 -1
  37. package/starter-kit/components/ListItem/ListItem.catalog.tsx +7 -1
  38. package/starter-kit/components/Loading/Loading.catalog.tsx +2 -1
  39. package/starter-kit/components/Pill/Pill.catalog.tsx +1 -1
  40. package/starter-kit/components/PillRow/PillRow.catalog.tsx +1 -1
  41. package/starter-kit/components/ProgressDots/ProgressDots.catalog.tsx +1 -1
  42. package/starter-kit/components/Radio/Radio.catalog.tsx +2 -2
  43. package/starter-kit/components/SearchField/SearchField.catalog.tsx +2 -1
  44. package/starter-kit/components/SectionHeader/SectionHeader.catalog.tsx +2 -1
  45. package/starter-kit/components/SegmentedToggle/SegmentedToggle.catalog.tsx +1 -3
  46. package/starter-kit/components/Shimmer/Breathing.catalog.tsx +2 -1
  47. package/starter-kit/components/Shimmer/Shimmer.catalog.tsx +2 -1
  48. package/starter-kit/components/Shimmer/SkeletonGroup.catalog.tsx +5 -1
  49. package/starter-kit/components/Surface/Surface.catalog.tsx +2 -1
  50. package/starter-kit/components/Switch/Switch.catalog.tsx +2 -2
  51. package/starter-kit/components/TextArea/TextArea.catalog.tsx +2 -1
  52. package/starter-kit/components/Toast/Toast.catalog.tsx +2 -1
  53. package/starter-kit/components/Tooltip/Tooltip.catalog.tsx +2 -1
  54. package/starter-kit/components/TopNav/TopNav.catalog.tsx +4 -1
  55. package/starter-kit/components/UnderlineTabs/UnderlineTabs.catalog.tsx +1 -3
  56. package/starter-kit/pages/ReportIssue.catalog.tsx +18 -1
  57. package/starter-kit/pages/SavedTrips.catalog.tsx +27 -6
  58. package/starter-kit/pages/TripPlannerForm.catalog.tsx +7 -1
@@ -11,7 +11,10 @@ const styles = StyleSheet.create({
11
11
 
12
12
  export default defineCatalogPage({
13
13
  component: 'TopNav',
14
- group: 'Navigation',
14
+ group: 'Components',
15
+ composedOf: [
16
+ { component: 'Button', role: "The leading and trailing slots, typically small icon Buttons (back, close, an action).", relationship: 'slot' },
17
+ ],
15
18
  description: 'A screen\'s top bar — fixed-width leading/trailing slots flanking a centered title (or custom center content). Slots reserve their layout space even when empty, so the title stays centered no matter which sides are populated.',
16
19
  a11y: 'The title renders with accessibilityRole="header". Slot content (typically icon-only Buttons) carries its own accessibilityLabel.',
17
20
  // No `variant` prop exists on TopNav — its "Variants" column just shows the one default look,
@@ -20,9 +20,7 @@ function UnderlineTabsDemo() {
20
20
 
21
21
  export default defineCatalogPage({
22
22
  component: 'UnderlineTabs',
23
- group: 'Selection',
24
- // Phone width plus a small phone, where long labels truncate.
25
- previewWidths: [402, 320],
23
+ group: 'Components',
26
24
  description: 'A quieter tab switcher — left-aligned labels over a hairline rule, with a sliding underline indicator. Same options/value/onChange API as SegmentedToggle.',
27
25
  whenToUse: "Quiet, secondary navigation within a screen that already has a clear primary focus. For a prominent, primary choice, use SegmentedToggle.",
28
26
  a11y: 'Each tab is a Pressable label; the underline is a visual indicator only, so selection is also conveyed by the active label weight.',
@@ -140,7 +140,24 @@ function ReportIssueDemo() {
140
140
  }
141
141
 
142
142
  export default defineCatalogPage({
143
- group: 'Recipes',
143
+ group: 'Patterns',
144
+ composedOf: [
145
+ { component: 'BottomSheet', role: "Holds the whole report flow, opened from the Report an issue button.", relationship: 'built-in' },
146
+ { component: 'TopNav', role: "The sheet header with a Close button.", relationship: 'built-in' },
147
+ { component: 'ProgressDots', role: "The step indicator.", relationship: 'built-in' },
148
+ { component: 'Banner', role: "The Delays reported near 14 St service alert.", relationship: 'built-in' },
149
+ { component: 'PillRow', role: "The issue-type and line pickers.", relationship: 'built-in' },
150
+ { component: 'TextArea', role: "Free-text details.", relationship: 'built-in' },
151
+ { component: 'Checkbox', role: "Marks the report urgent.", relationship: 'built-in' },
152
+ { component: 'Radio', role: "Chooses between sharing publicly and reporting anonymously.", relationship: 'built-in' },
153
+ { component: 'Switch', role: "Notify me when resolved.", relationship: 'built-in' },
154
+ { component: 'SkeletonGroup', role: "Groups the loading lines for Recent reports near you into one loading region.", relationship: 'built-in' },
155
+ { component: 'Shimmer', role: "The loading lines themselves.", relationship: 'built-in' },
156
+ { component: 'Dock', role: "The sheet footer holding Submit report.", relationship: 'built-in' },
157
+ { component: 'Dialog', role: "Confirms discarding the report on close.", relationship: 'built-in' },
158
+ { component: 'ButtonGroup', role: "The dialog's Keep editing and Discard buttons.", relationship: 'built-in' },
159
+ { component: 'Button', role: "Report an issue, Close, Submit report, and the dialog's actions.", relationship: 'built-in' },
160
+ ],
144
161
  description: 'A composed real screen — a "report an issue" flow opened from a BottomSheet, combining a step indicator, a service-alert banner, a Pill-based issue-type and line picker (a data choice, not a view switch, so Pill rather than SegmentedToggle), free-text and toggle inputs, and a loading skeleton for recent reports. Dismissing with unsaved changes opens a confirmation Dialog.',
145
162
  tokenGallery: true,
146
163
  fullWidthLabel: 'Preview',
@@ -27,10 +27,11 @@ const styles = StyleSheet.create({
27
27
  // fixed TopNav header and Dock footer around a scrollable middle, the same fixed-header/
28
28
  // scrollable-body/fixed-footer shape a real screen would use.
29
29
  savedTripsScreen: { flex: 1, alignSelf: 'stretch' },
30
- // A fixed cap (not `flex: 1`) — sidesteps a web-only flexbox quirk where a `flex: 1` ScrollView
31
- // nested inside PhoneFrame's own fixed height doesn't actually shrink to the space left after
32
- // TopNav/Dock, and grows PhoneFrame itself past its intended 480px instead of scrolling.
33
- savedTripsScroll: { maxHeight: 320 },
30
+ // Takes the space between the TopNav and the Dock and scrolls (`minHeight: 0` lets a flex child
31
+ // shrink below its content on the web).
32
+ savedTripsScroll: { flex: 1, minHeight: 0 },
33
+ // The muted area between TopNav and Dock takes the remaining height, so the list scrolls there.
34
+ savedTripsBody: { flex: 1, minHeight: 0 },
34
35
  savedTripsScrollContent: { padding: DS_SPACING[800], gap: DS_SPACING[600] },
35
36
  // Shared by SavedTrips' small inline rows — the "Updating arrival times…" loading row and each
36
37
  // list row's trailing badge+button cluster (identical layout, one key).
@@ -127,7 +128,7 @@ function SavedTripsDemo() {
127
128
  </Tooltip>
128
129
  }
129
130
  />
130
- <Surface tone="muted">
131
+ <Surface tone="muted" style={styles.savedTripsBody}>
131
132
  <ScrollView style={styles.savedTripsScroll} contentContainerStyle={styles.savedTripsScrollContent}>
132
133
  <SearchField value={query} onChangeText={setQuery} placeholder="Search stations" />
133
134
  <SegmentedToggle
@@ -239,7 +240,27 @@ function SavedTripsDemo() {
239
240
  }
240
241
 
241
242
  export default defineCatalogPage({
242
- group: 'Recipes',
243
+ group: 'Patterns',
244
+ composedOf: [
245
+ { component: 'TopNav', role: "The screen header, titled Saved trips, with a Filters button.", relationship: 'built-in' },
246
+ { component: 'Tooltip', role: "The Filter by mode hint on the Filters button.", relationship: 'built-in' },
247
+ { component: 'Surface', role: "The muted background behind the search, toggles and list.", relationship: 'built-in' },
248
+ { component: 'SearchField', role: "Searches stations.", relationship: 'built-in' },
249
+ { component: 'SegmentedToggle', role: "Switches between List and Map views.", relationship: 'built-in' },
250
+ { component: 'UnderlineTabs', role: "The All, Nearby and Favorites tabs.", relationship: 'built-in' },
251
+ { component: 'PillRow', role: "Mode filter pills.", relationship: 'built-in' },
252
+ { component: 'Loading', role: "The small spinner beside Updating arrival times.", relationship: 'built-in' },
253
+ { component: 'Dropdown', role: "The Sort by picker.", relationship: 'built-in' },
254
+ { component: 'SectionHeader', role: "The Nearby stations heading.", relationship: 'built-in' },
255
+ { component: 'List', role: "Holds the saved-trip rows with dividers.", relationship: 'built-in' },
256
+ { component: 'ListItem', role: "Each saved trip row.", relationship: 'built-in' },
257
+ { component: 'Avatar', role: "Each row's mode icon.", relationship: 'built-in' },
258
+ { component: 'Badge', role: "Each row's status, e.g. delays.", relationship: 'built-in' },
259
+ { component: 'Button', role: "The Filters button, each row's remove button, and Plan a new trip.", relationship: 'built-in' },
260
+ { component: 'EmptyState', role: "Shown instead of the list on an empty tab (Favorites, or after removing every row).", relationship: 'built-in' },
261
+ { component: 'Toast', role: "Confirms a removed trip, with Undo.", relationship: 'built-in' },
262
+ { component: 'Dock', role: "The bottom bar holding Plan a new trip.", relationship: 'built-in' },
263
+ ],
243
264
  description: 'A composed real screen — a saved-trips list with a search bar, tab switcher, mode filter pills, a sort Dropdown, and a bottom action bar. Switch to the "Favorites" tab (or remove every row) to see the EmptyState alternative to the list; tap the header icon to see its Tooltip; tap a row\'s trailing × to see the Toast, which only appears after that real action and auto-dismisses (or Undo) — remove two rows back-to-back and each removal gets its own stacked toast on its own clock.',
244
265
  tokenGallery: true,
245
266
  fullWidthLabel: 'Preview',
@@ -40,7 +40,13 @@ function TripPlannerFormDemo() {
40
40
  }
41
41
 
42
42
  export default defineCatalogPage({
43
- group: 'Recipes',
43
+ group: 'Patterns',
44
+ composedOf: [
45
+ { component: 'Card', role: "Frames the whole form.", relationship: 'built-in' },
46
+ { component: 'InputField', role: "The From and To fields.", relationship: 'built-in' },
47
+ { component: 'Divider', role: "Separates the fields from the actions.", relationship: 'built-in' },
48
+ { component: 'Button', role: "Add stop (tertiary) and Continue (primary, disabled until To is filled).", relationship: 'built-in' },
49
+ ],
44
50
  description: 'A composed real screen — not one component in isolation — showing how Card, InputField, Divider, and Button actually fit together: a From/To trip form with a secondary "Add stop" action and a primary "Continue" that\'s disabled until a destination is entered.',
45
51
  tokenGallery: true,
46
52
  fullWidthLabel: 'Preview',