jfs-components 0.1.50 → 0.1.54

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 (93) hide show
  1. package/.cursor/D2C-FLOW.md +94 -0
  2. package/.cursor/D2C-SCREEN.md +119 -0
  3. package/.cursor/commands/D2C.md +101 -0
  4. package/CHANGELOG.md +18 -0
  5. package/lib/commonjs/components/ActionFooter/ActionFooter.js +319 -135
  6. package/lib/commonjs/components/Badge/Badge.js +20 -1
  7. package/lib/commonjs/components/Button/Button.js +139 -47
  8. package/lib/commonjs/components/ButtonGroup/ButtonGroup.js +1 -1
  9. package/lib/commonjs/components/Card/Card.js +151 -112
  10. package/lib/commonjs/components/Card/assets/gold-logo-mark.png +0 -0
  11. package/lib/commonjs/components/CategoryCard/CategoryCard.js +97 -63
  12. package/lib/commonjs/components/CategoryCard/assets/sample.png +0 -0
  13. package/lib/commonjs/components/CheckboxItem/CheckboxItem.js +59 -10
  14. package/lib/commonjs/components/ExpandableCheckbox/ExpandableCheckbox.js +132 -49
  15. package/lib/commonjs/components/HelloJioInput/HelloJioInput.js +56 -14
  16. package/lib/commonjs/components/IconCapsule/IconCapsule.js +1 -1
  17. package/lib/commonjs/components/MetricData/MetricData.js +26 -13
  18. package/lib/commonjs/components/MoneyValue/MoneyValue.js +1 -1
  19. package/lib/commonjs/components/Nudge/Nudge.js +1 -1
  20. package/lib/commonjs/components/PdpCcCard/PdpCcCard.js +47 -91
  21. package/lib/commonjs/components/PlanComparisonCard/PlanComparisonCard.js +52 -45
  22. package/lib/commonjs/components/PortfolioHero/PortfolioHero.js +1 -1
  23. package/lib/commonjs/components/Slider/Slider.js +3 -3
  24. package/lib/commonjs/components/TextInput/TextInput.js +26 -8
  25. package/lib/commonjs/components/Tooltip/Tooltip.js +3 -5
  26. package/lib/commonjs/components/index.js +7 -1
  27. package/lib/commonjs/design-tokens/Coin Variables-variables-full.json +1 -1
  28. package/lib/commonjs/design-tokens/figma-modes.generated.js +13 -13
  29. package/lib/commonjs/icons/registry.js +1 -1
  30. package/lib/module/components/ActionFooter/ActionFooter.js +322 -138
  31. package/lib/module/components/Badge/Badge.js +20 -1
  32. package/lib/module/components/Button/Button.js +140 -48
  33. package/lib/module/components/ButtonGroup/ButtonGroup.js +1 -1
  34. package/lib/module/components/Card/Card.js +152 -114
  35. package/lib/module/components/Card/assets/gold-logo-mark.png +0 -0
  36. package/lib/module/components/CategoryCard/CategoryCard.js +97 -63
  37. package/lib/module/components/CategoryCard/assets/sample.png +0 -0
  38. package/lib/module/components/CheckboxItem/CheckboxItem.js +59 -10
  39. package/lib/module/components/ExpandableCheckbox/ExpandableCheckbox.js +135 -52
  40. package/lib/module/components/HelloJioInput/HelloJioInput.js +56 -14
  41. package/lib/module/components/IconCapsule/IconCapsule.js +1 -1
  42. package/lib/module/components/MetricData/MetricData.js +26 -14
  43. package/lib/module/components/MoneyValue/MoneyValue.js +1 -1
  44. package/lib/module/components/Nudge/Nudge.js +1 -1
  45. package/lib/module/components/PdpCcCard/PdpCcCard.js +48 -92
  46. package/lib/module/components/PlanComparisonCard/PlanComparisonCard.js +52 -45
  47. package/lib/module/components/PortfolioHero/PortfolioHero.js +1 -1
  48. package/lib/module/components/Slider/Slider.js +3 -3
  49. package/lib/module/components/TextInput/TextInput.js +27 -9
  50. package/lib/module/components/Tooltip/Tooltip.js +3 -5
  51. package/lib/module/components/index.js +1 -1
  52. package/lib/module/design-tokens/Coin Variables-variables-full.json +1 -1
  53. package/lib/module/design-tokens/figma-modes.generated.js +13 -13
  54. package/lib/module/icons/registry.js +1 -1
  55. package/lib/typescript/src/components/ActionFooter/ActionFooter.d.ts +50 -21
  56. package/lib/typescript/src/components/Button/Button.d.ts +24 -1
  57. package/lib/typescript/src/components/ButtonGroup/ButtonGroup.d.ts +2 -2
  58. package/lib/typescript/src/components/Card/Card.d.ts +54 -25
  59. package/lib/typescript/src/components/CategoryCard/CategoryCard.d.ts +29 -12
  60. package/lib/typescript/src/components/CheckboxItem/CheckboxItem.d.ts +27 -9
  61. package/lib/typescript/src/components/ExpandableCheckbox/ExpandableCheckbox.d.ts +37 -12
  62. package/lib/typescript/src/components/IconCapsule/IconCapsule.d.ts +1 -1
  63. package/lib/typescript/src/components/MetricData/MetricData.d.ts +7 -5
  64. package/lib/typescript/src/components/PdpCcCard/PdpCcCard.d.ts +16 -6
  65. package/lib/typescript/src/components/PlanComparisonCard/PlanComparisonCard.d.ts +9 -2
  66. package/lib/typescript/src/components/index.d.ts +2 -2
  67. package/lib/typescript/src/icons/registry.d.ts +1 -1
  68. package/package.json +4 -2
  69. package/src/components/ActionFooter/ActionFooter.tsx +375 -141
  70. package/src/components/Badge/Badge.tsx +21 -1
  71. package/src/components/Button/Button.tsx +192 -44
  72. package/src/components/ButtonGroup/ButtonGroup.tsx +2 -2
  73. package/src/components/Card/Card.tsx +370 -212
  74. package/src/components/Card/assets/gold-logo-mark.png +0 -0
  75. package/src/components/CategoryCard/CategoryCard.tsx +130 -84
  76. package/src/components/CategoryCard/assets/sample.png +0 -0
  77. package/src/components/CheckboxItem/CheckboxItem.tsx +72 -12
  78. package/src/components/ExpandableCheckbox/ExpandableCheckbox.tsx +186 -67
  79. package/src/components/HelloJioInput/HelloJioInput.tsx +58 -17
  80. package/src/components/IconCapsule/IconCapsule.tsx +1 -1
  81. package/src/components/MetricData/MetricData.tsx +39 -22
  82. package/src/components/MoneyValue/MoneyValue.tsx +1 -1
  83. package/src/components/Nudge/Nudge.tsx +1 -1
  84. package/src/components/PdpCcCard/PdpCcCard.tsx +41 -92
  85. package/src/components/PlanComparisonCard/PlanComparisonCard.tsx +73 -58
  86. package/src/components/PortfolioHero/PortfolioHero.tsx +1 -1
  87. package/src/components/Slider/Slider.tsx +3 -3
  88. package/src/components/TextInput/TextInput.tsx +26 -9
  89. package/src/components/Tooltip/Tooltip.tsx +3 -5
  90. package/src/components/index.ts +9 -2
  91. package/src/design-tokens/Coin Variables-variables-full.json +1 -1
  92. package/src/design-tokens/figma-modes.generated.ts +13 -13
  93. package/src/icons/registry.ts +1 -1
@@ -0,0 +1,94 @@
1
+ # D2C multi-screen orchestration
2
+
3
+ Load only when scope discovery finds two or more `ScreenSpec`s. The main agent
4
+ is the orchestrator: it owns contracts, shared files, integration, and
5
+ end-to-end QA. Each implementation agent owns exactly one screen family.
6
+
7
+ ## 1. Prepare conflict-free contracts
8
+
9
+ Before launching agents:
10
+
11
+ 1. Define the transition graph and typed step model.
12
+ 2. Define shared props/callbacks, fake data, validation, timing, and persistence.
13
+ 3. Create the minimum scaffold: host/navigator, shared types, placeholders.
14
+ 4. Assign each family:
15
+ - one screen file;
16
+ - uniquely named mode file(s);
17
+ - `assets/<screen-key>/`.
18
+ 5. Only the orchestrator edits the host/shared types. Agents cannot edit other
19
+ screens or clear shared directories.
20
+
21
+ Typical recording-demo layout:
22
+
23
+ ```text
24
+ RecordingDemoScreen.tsx # orchestrator
25
+ types.ts # orchestrator
26
+ SignInScreen.tsx # Sign In agent
27
+ signInModes.json
28
+ assets/sign-in/
29
+ OtpScreen.tsx # OTP agent
30
+ otpModes.json
31
+ assets/otp/
32
+ ```
33
+
34
+ ## 2. Launch one agent per family
35
+
36
+ After shared ambiguities are resolved and the scaffold exists, launch all
37
+ independent agents in one parallel batch when possible; honor configured model
38
+ preferences. Do not create one agent per state or combine unrelated screens.
39
+
40
+ Each prompt is self-contained:
41
+
42
+ ```text
43
+ absolute repo path; platform/stack; recording-demo placement
44
+ owned files/directories + explicit do-not-edit list
45
+ original flow URL + parent node
46
+ primary node URL + all variant URLs/state meanings
47
+ purpose + relationship to preceding/following screens
48
+ shared TypeScript contract; input/output/persistence
49
+ resolved fake-data, validation, navigation, timing behavior
50
+ exact jfs-extract-modes commands + output paths
51
+ files/rules/examples to read, including .cursor/D2C-SCREEN.md
52
+ acceptance criteria + required completion summary
53
+ STOP-BEFORE-EDIT rule for material ambiguity
54
+ ```
55
+
56
+ Each agent independently executes `.cursor/D2C-SCREEN.md`, implements only its
57
+ family/local states, runs focused checks, and returns its report.
58
+
59
+ ## 3. Integrate actual deliverables
60
+
61
+ After all agents finish, inspect files—not only summaries:
62
+
63
+ 1. Confirm all placeholders are replaced and imports/modes/assets exist.
64
+ 2. Resolve conflicts, duplicates, missing assets, invalid props, and inconsistent
65
+ mode merging.
66
+ 3. Wire every transition and thread shared data/persistence.
67
+ 4. Keep variant states local to the correct family.
68
+ 5. Verify Back/Skip/Cancel/retry/resend, CTA states, and terminal paths.
69
+ 6. Keep fake flows local; do not add network/server dependencies.
70
+ 7. Re-run typecheck/lint/build; separate new failures from existing ones.
71
+
72
+ ## 4. End-to-end QA
73
+
74
+ Render the complete journey on the target platform:
75
+
76
+ - reach every terminal path from the intended start;
77
+ - test all forward, Back, Skip, and Cancel branches;
78
+ - test cross-screen validation, persistence, retry/resend, disabled/enabled
79
+ actions, transient timing, and repeated presses;
80
+ - capture every real screen and materially different state;
81
+ - verify keyboard/numpad, scrolling, sticky footers, and safe areas.
82
+
83
+ One successful screen is not proof of the flow. Fix integration differences and
84
+ recapture. If tooling is unavailable, report the exact remaining manual QA.
85
+
86
+ ## Completion report
87
+
88
+ Report briefly:
89
+
90
+ - detected families and grouped variants;
91
+ - final transition graph and shared/fake-data behavior;
92
+ - files, assets, and mode outputs per screen;
93
+ - checks, paths, and edge cases exercised;
94
+ - per-screen visual status and blockers.
@@ -0,0 +1,119 @@
1
+ # D2C per-screen execution
2
+
3
+ Load only after scope discovery provides a `ScreenSpec`. Applies to direct
4
+ single-screen work and each screen agent in a flow.
5
+
6
+ ## 1. Gather evidence
7
+
8
+ Read the Figma design-to-code skill before Figma calls.
9
+
10
+ 1. `get_design_context` for the primary node and variants needed to understand
11
+ visual/interactive differences.
12
+ 2. `get_screenshot` for the primary and materially different variants; retain
13
+ them for QA.
14
+ 3. `get_metadata` when hierarchy, visibility, assets, or duplicate names need
15
+ disambiguation.
16
+ 4. Follow Code Connect, component docs, annotations, and hidden-layer metadata.
17
+ 5. Use exact exported images/icons. Download them into the repository; never
18
+ commit expiring/localhost URLs, placeholders, hand-authored SVGs, or a new
19
+ icon package.
20
+
21
+ If MCP cannot read a required node, report the blocker and stop.
22
+
23
+ ## 2. Extract modes through Figma REST
24
+
25
+ From the consuming repository:
26
+
27
+ ```bash
28
+ npx jfs-extract-modes "<node-specific-figma-url>" --out "<unique-output>.json"
29
+ ```
30
+
31
+ Fallback:
32
+
33
+ ```bash
34
+ node node_modules/jfs-components/scripts/extract-figma-modes.js \
35
+ "<node-specific-figma-url>" --out "<unique-output>.json"
36
+ ```
37
+
38
+ Extract a variant separately if selected modes differ from the primary. The CLI
39
+ reads `FIGMA_ACCESS_TOKEN` from root `.env` (exported env wins). Never print it
40
+ or ask the user to paste it into chat. Required scope: `file_content:read`.
41
+
42
+ If missing, direct the user to `[Open .env](.env)` and add
43
+ `FIGMA_ACCESS_TOKEN=`. Creation path: Figma file browser → account menu →
44
+ Settings → Security → Personal access tokens → Generate; choose expiry and only
45
+ `file_content:read`; copy once into `.env`. Never create/overwrite it yourself.
46
+ [Official PAT docs](https://developers.figma.com/docs/rest-api/personal-access-tokens/).
47
+
48
+ Resolve modes:
49
+
50
+ 1. Start with `inheritedFromAncestors`.
51
+ 2. Collect entries for the component path and its ancestors.
52
+ 3. Merge root → leaf; deeper entries override.
53
+ 4. Match name/position; use `nodeId` for duplicates.
54
+
55
+ If `unresolved` exists, report every item/reason and stop:
56
+
57
+ - `local collection`: packaged data cannot resolve a file-local collection.
58
+ - `key not in variables JSON` / `mode not in collection`: packaged tokens stale.
59
+
60
+ ## 3. Implement
61
+
62
+ Inspect actual `jfs-components` exports/types and nearby project examples first.
63
+
64
+ - Implement one screen family; variants are local component state.
65
+ - Use user-specified fake data, validation, navigation, timing, and persistence.
66
+ - Prefer mapped components; primitives only for necessary layout.
67
+ - Apply modes to the closest represented component/subtree. Preserve parent
68
+ inheritance and child overrides; never flatten, move, substitute, or omit
69
+ selected modes.
70
+ - Match content, order, visibility, variants, spacing, and assets; omit hidden
71
+ layers.
72
+ - Never invent a component, prop, or icon.
73
+
74
+ Component contracts:
75
+
76
+ - Titles: reproduce line count with `numberOfLines`/`disableTruncation`.
77
+ - SubPage `AppBar`: trailing actions in a Fragment so action gaps apply.
78
+ - Consent + CTA `ActionFooter`: one column child:
79
+ `<View style={{ flexGrow: 1, minWidth: 0, gap: 8 }}>`.
80
+ - Multiple IMAGE fills: last fill is visually topmost.
81
+ - Icons: exact registry `ic_*` glyph when available; otherwise exact exported
82
+ asset. Use a packaged substitute only when it clearly matches.
83
+
84
+ Run focused type/lint checks.
85
+
86
+ ## 4. Visual and interaction QA
87
+
88
+ Render on the target platform. Recording-demo boots directly into its host.
89
+ Prefer `npm run simulator`, then capture device screenshots.
90
+
91
+ For the primary and every materially different variant, compare:
92
+
93
+ - component size, variant, emphasis, color, spacing, and alignment;
94
+ - text content, wrapping, and truncation;
95
+ - icons/images and visibility;
96
+ - AppBar safe area/actions;
97
+ - scrolling/below-fold content;
98
+ - keyboard/numpad and sticky footer/home-indicator clearance.
99
+
100
+ Exercise applicable behavior:
101
+
102
+ - empty/partial/complete inputs and validation boundaries;
103
+ - immutable formatting and disabled/enabled CTA;
104
+ - selection, retry/resend, persistence, transient timing, rapid presses;
105
+ - incoming/outgoing navigation callbacks.
106
+
107
+ Fix differences and recapture. If render tooling is unavailable, do not claim
108
+ visual completion; report the blocker and exact manual verification.
109
+
110
+ ## Return to orchestrator / completion report
111
+
112
+ Report briefly:
113
+
114
+ - files, mode outputs, and assets;
115
+ - effective modes;
116
+ - local states and behavior;
117
+ - navigation callbacks/data contract;
118
+ - checks and edge cases exercised;
119
+ - visual status and blockers.
@@ -0,0 +1,101 @@
1
+ # D2C — Figma to jfs-components
2
+
3
+ Build the supplied Figma node with `jfs-components`. The link may represent one
4
+ screen, states of one screen, or a complete flow. **Discover scope before
5
+ implementation.**
6
+
7
+ ## Invariants
8
+
9
+ - User-stated behavior is authoritative. Figma defines visuals and designed
10
+ states, not unspecified product logic.
11
+ - Use Figma MCP. Never recreate an unreadable design from assumptions.
12
+ - Use real package exports/props and extracted modes. Stop on unresolved modes.
13
+ - Fake demos stay local unless the user explicitly requests a service.
14
+ - This may be recorded: present a clean first implementation. Never mention
15
+ prior attempts, cached knowledge, mistakes, or “fixes.” Be concise:
16
+ discover → clarify → execute → verify.
17
+
18
+ ## 0. Input and placement
19
+
20
+ Use the Figma URL after `/D2C` or in the latest prompt; ask for it if absent.
21
+
22
+ On mobile, each root must be <Screen> wrapped in in `SafeAreaView`
23
+ (from `react-native-safe-area-context` when the project already uses it,
24
+ otherwise `react-native`) so notches and home indicators are respected — do not
25
+ rely on the host to add it.
26
+
27
+ ## 1. Discover screen families
28
+
29
+ On the linked node:
30
+
31
+ 1. Read the Figma design-to-code skill; call `get_design_context` with its
32
+ required skill logging parameter.
33
+ 2. Call `get_screenshot` for the complete overview.
34
+ 3. Call `get_metadata` to inventory visible screen-sized frames: IDs, names,
35
+ hierarchy, dimensions, order, and visibility.
36
+ 4. Inspect prototype links, annotations, titles, actions, repeated structure,
37
+ and spatial order. Never infer flow from left-to-right placement alone.
38
+
39
+ Group every frame into a **screen family**:
40
+
41
+ - Same family: same user goal/step, major layout, and data model; differences
42
+ are state (empty/filled/focused/disabled, selected, loading/success/error,
43
+ OTP progress/resend/invalid, expanded, toast/keyboard, scroll position).
44
+ - Different family: different goal/step, content model, primary interaction,
45
+ destination, or substantially different layout.
46
+ - If uncertain, inspect children/prototype links; frame names are weak evidence.
47
+
48
+ Create one internal `ScreenSpec` per family:
49
+
50
+ ```text
51
+ key + purpose
52
+ primary node ID + exact URL
53
+ variant node IDs/URLs + state meaning
54
+ incoming/outgoing transitions (Back/Skip/Cancel/retry included)f
55
+ input/output/shared data
56
+ user-specified behavior
57
+ material unknowns
58
+ ```
59
+
60
+ Before coding, briefly report the family count and grouped variants.
61
+
62
+ ## 2. Clarify once
63
+
64
+ Ask one consolidated question set only for material behavior not answered by
65
+ Figma, the prompt, or project conventions:
66
+
67
+ - validation/formatting/immutable prefixes/lengths;
68
+ - fake operation success/failure and error states;
69
+ - initial/terminal screens and Back/Skip/Cancel destinations;
70
+ - backward-navigation persistence;
71
+ - splash/loading/toast/resend/auto-advance timing;
72
+ - platform-specific behavior.
73
+
74
+ Default cosmetic details only; never invent product logic.
75
+
76
+ ## 3. Route
77
+
78
+ ### One family
79
+
80
+ Variants are local state, never separate routes.
81
+
82
+ 1. Read `.cursor/D2C-SCREEN.md`.
83
+ 2. Execute it directly for the `ScreenSpec`.
84
+
85
+ ### Two or more families
86
+
87
+ The linked node is a flow.
88
+
89
+ 1. Resolve shared material unknowns before implementation.
90
+ 2. Read `.cursor/D2C-FLOW.md`.
91
+ 3. Orchestrate one implementation agent per `ScreenSpec`.
92
+ 4. Every screen agent must read and execute `.cursor/D2C-SCREEN.md`.
93
+ 5. The orchestrator integrates and verifies the entire transition graph.
94
+
95
+ If a screen agent finds a material unknown, it stops before editing and reports
96
+ the precise question; the orchestrator asks the user and resumes it.
97
+
98
+ ## Completion
99
+
100
+ Follow the reporting contract in the loaded reference file(s). Keep the final
101
+ report factual and brief.
package/CHANGELOG.md CHANGED
@@ -4,6 +4,24 @@ All notable changes to this project are documented in this file.
4
4
 
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
6
6
 
7
+ ## [0.1.54] - 2026-07-27
8
+
9
+ - Token / mode resolution pass against Figma Code Connect + Coin Variables:
10
+ - Tooltip / Slider — `tooltip/radius` / `tooltip/maxWidth` → bound `radius` / `maxWidth`
11
+ - Nudge — `nudge/radius` → `nudge/borderRadius` (repaired alias target in Coin Variables)
12
+ - Badge — System intent label color uses published Emphasis tokens; size mode `Badge / Size` → `Badge Size`
13
+ - Remapped invalid mode keys across Accordion, ActionTile, Button, ButtonGroup, IconButton, IconCapsule, ListItem, PortfolioHero, Avatar consumers, and story Theme leftovers
14
+ - CategoryCard updates (stories / MDX / assets)
15
+
16
+ ---
17
+
18
+ ## [0.1.51] - 2026-07-26
19
+
20
+ - Packages the Cursor D2C playbooks with the npm release: `.cursor/commands/D2C.md`, `.cursor/D2C-FLOW.md`, and `.cursor/D2C-SCREEN.md` (replacing the removed root `D2C.md` entry in `package.json` `files`).
21
+ - D2C command — mobile roots must wrap `<Screen>` in `SafeAreaView` (no longer assumes a recording-demo host provides it).
22
+
23
+ ---
24
+
7
25
  ## [0.1.50] - 2026-07-25
8
26
 
9
27
  - Token resolution pass — remapped unresolved `getVariableByName` refs and bad mode keys against Figma Code Connect / Coin Variables (CardCTA, CategoryCard, Checkbox, CircularProgressBarDoted, DonutChartSummary, ProductMerchandisingCard, ProductOverview, Radio, SavingsGoalSummary, SegmentedControl, SegmentedTrack, Slider, Tooltip, StatusHero, CardFeedback).