@utilitywarehouse/hearth-react-native 0.35.7 → 0.35.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 (185) hide show
  1. package/SKILL.md +129 -3
  2. package/build/components/Accordion/Accordion.figma.d.ts +15 -0
  3. package/build/components/Accordion/Accordion.figma.js +20 -0
  4. package/build/components/Accordion/AccordionItem.figma.d.ts +17 -0
  5. package/build/components/Accordion/AccordionItem.figma.js +26 -0
  6. package/build/components/Alert/Alert.figma.d.ts +33 -0
  7. package/build/components/Alert/Alert.figma.js +40 -0
  8. package/build/components/Avatar/Avatar.figma.d.ts +16 -0
  9. package/build/components/Avatar/Avatar.figma.js +29 -0
  10. package/build/components/Badge/Badge.figma.d.ts +21 -0
  11. package/build/components/Badge/Badge.figma.js +47 -0
  12. package/build/components/Banner/Banner.figma.d.ts +26 -0
  13. package/build/components/Banner/Banner.figma.js +47 -0
  14. package/build/components/Banner/BannerIllustration.figma.d.ts +11 -0
  15. package/build/components/Banner/BannerIllustration.figma.js +13 -0
  16. package/build/components/BottomSheet/BottomSheetModal.figma.d.ts +11 -0
  17. package/build/components/BottomSheet/BottomSheetModal.figma.js +11 -0
  18. package/build/components/Button/Button.figma.d.ts +38 -0
  19. package/build/components/Button/Button.figma.js +84 -0
  20. package/build/components/Card/Card.figma.d.ts +16 -0
  21. package/build/components/Card/Card.figma.js +49 -0
  22. package/build/components/Card/CardAction/CardAction.figma.d.ts +35 -0
  23. package/build/components/Card/CardAction/CardAction.figma.js +104 -0
  24. package/build/components/Carousel/Carousel.figma.d.ts +17 -0
  25. package/build/components/Carousel/Carousel.figma.js +18 -0
  26. package/build/components/Checkbox/Checkbox.figma.d.ts +22 -0
  27. package/build/components/Checkbox/Checkbox.figma.js +29 -0
  28. package/build/components/Checkbox/CheckboxGroup.figma.d.ts +26 -0
  29. package/build/components/Checkbox/CheckboxGroup.figma.js +46 -0
  30. package/build/components/Checkbox/CheckboxImage.figma.d.ts +11 -0
  31. package/build/components/Checkbox/CheckboxImage.figma.js +10 -0
  32. package/build/components/Checkbox/CheckboxTileRoot.figma.d.ts +20 -0
  33. package/build/components/Checkbox/CheckboxTileRoot.figma.js +22 -0
  34. package/build/components/Combobox/Combobox.figma.d.ts +23 -0
  35. package/build/components/Combobox/Combobox.figma.js +69 -0
  36. package/build/components/CurrencyInput/CurrencyInput.figma.d.ts +31 -0
  37. package/build/components/CurrencyInput/CurrencyInput.figma.js +51 -0
  38. package/build/components/DateInput/DateInput.figma.d.ts +41 -0
  39. package/build/components/DateInput/DateInput.figma.js +87 -0
  40. package/build/components/DatePicker/DatePicker.figma.d.ts +25 -0
  41. package/build/components/DatePicker/DatePicker.figma.js +23 -0
  42. package/build/components/DatePickerInput/DatePickerInput.figma.d.ts +25 -0
  43. package/build/components/DatePickerInput/DatePickerInput.figma.js +52 -0
  44. package/build/components/DescriptionList/DescriptionList.figma.d.ts +26 -0
  45. package/build/components/DescriptionList/DescriptionList.figma.js +59 -0
  46. package/build/components/DescriptionList/DescriptionListItem.figma.d.ts +22 -0
  47. package/build/components/DescriptionList/DescriptionListItem.figma.js +42 -0
  48. package/build/components/Divider/Divider.figma.d.ts +13 -0
  49. package/build/components/Divider/Divider.figma.js +14 -0
  50. package/build/components/ExpandableCard/ExpandableCard.figma.d.ts +28 -0
  51. package/build/components/ExpandableCard/ExpandableCard.figma.js +52 -0
  52. package/build/components/ExpandableCard/ExpandableCardGroup.figma.d.ts +23 -0
  53. package/build/components/ExpandableCard/ExpandableCardGroup.figma.js +55 -0
  54. package/build/components/FormField/FormField.figma.d.ts +15 -0
  55. package/build/components/FormField/FormField.figma.js +27 -0
  56. package/build/components/Helper/HelperText.figma.d.ts +13 -0
  57. package/build/components/Helper/HelperText.figma.js +12 -0
  58. package/build/components/HighlightBanner/HighlightBanner.figma.d.ts +19 -0
  59. package/build/components/HighlightBanner/HighlightBanner.figma.js +45 -0
  60. package/build/components/IconButton/IconButton.figma.d.ts +22 -0
  61. package/build/components/IconButton/IconButton.figma.js +47 -0
  62. package/build/components/IconContainer/IconContainer.figma.d.ts +20 -0
  63. package/build/components/IconContainer/IconContainer.figma.js +43 -0
  64. package/build/components/IndicatorIconButton/IndicatorIconButton.figma.d.ts +17 -0
  65. package/build/components/IndicatorIconButton/IndicatorIconButton.figma.js +23 -0
  66. package/build/components/InlineLink/InlineLink.d.ts +1 -1
  67. package/build/components/InlineLink/InlineLink.js +7 -2
  68. package/build/components/InlineLink/InlineLink.props.d.ts +2 -0
  69. package/build/components/InlineLink/InlineLinkRoot.d.ts +1 -1
  70. package/build/components/InlineLink/InlineLinkRoot.js +8 -3
  71. package/build/components/Input/Input.figma.d.ts +28 -0
  72. package/build/components/Input/Input.figma.js +67 -0
  73. package/build/components/Input/Input_1.figma.d.ts +22 -0
  74. package/build/components/Input/Input_1.figma.js +54 -0
  75. package/build/components/Input/Input_2.figma.d.ts +17 -0
  76. package/build/components/Input/Input_2.figma.js +34 -0
  77. package/build/components/Label/Label.figma.d.ts +14 -0
  78. package/build/components/Label/Label.figma.js +19 -0
  79. package/build/components/Link/Link.d.ts +1 -1
  80. package/build/components/Link/Link.figma.d.ts +27 -0
  81. package/build/components/Link/Link.figma.js +45 -0
  82. package/build/components/Link/Link.js +7 -2
  83. package/build/components/Link/Link.props.d.ts +2 -0
  84. package/build/components/Link/LinkRoot.d.ts +1 -1
  85. package/build/components/Link/LinkRoot.js +8 -3
  86. package/build/components/List/List.figma.d.ts +21 -0
  87. package/build/components/List/List.figma.js +49 -0
  88. package/build/components/List/ListAction/ListAction.figma.d.ts +15 -0
  89. package/build/components/List/ListAction/ListAction.figma.js +17 -0
  90. package/build/components/List/ListItem/ListItem.figma.d.ts +33 -0
  91. package/build/components/List/ListItem/ListItem.figma.js +83 -0
  92. package/build/components/List/ListItem/ListItemLeadingContent.figma.d.ts +14 -0
  93. package/build/components/List/ListItem/ListItemLeadingContent.figma.js +17 -0
  94. package/build/components/List/ListItem/ListItemTrailingContent.figma.d.ts +13 -0
  95. package/build/components/List/ListItem/ListItemTrailingContent.figma.js +14 -0
  96. package/build/components/Menu/Menu.figma.d.ts +14 -0
  97. package/build/components/Menu/Menu.figma.js +33 -0
  98. package/build/components/Menu/MenuItem.figma.d.ts +29 -0
  99. package/build/components/Menu/MenuItem.figma.js +45 -0
  100. package/build/components/Modal/Modal.figma.d.ts +24 -0
  101. package/build/components/Modal/Modal.figma.js +64 -0
  102. package/build/components/NavModal/NavModal.figma.d.ts +19 -0
  103. package/build/components/NavModal/NavModal.figma.js +42 -0
  104. package/build/components/Pagination/Pagination.figma.d.ts +16 -0
  105. package/build/components/Pagination/Pagination.figma.js +20 -0
  106. package/build/components/PillGroup/Pill.figma.d.ts +17 -0
  107. package/build/components/PillGroup/Pill.figma.js +21 -0
  108. package/build/components/PillGroup/PillGroup.figma.d.ts +13 -0
  109. package/build/components/PillGroup/PillGroup.figma.js +18 -0
  110. package/build/components/ProgressBar/ProgressBar.circular.figma.d.ts +16 -0
  111. package/build/components/ProgressBar/ProgressBar.circular.figma.js +35 -0
  112. package/build/components/ProgressBar/ProgressBar.figma.d.ts +15 -0
  113. package/build/components/ProgressBar/ProgressBar.figma.js +31 -0
  114. package/build/components/ProgressStepper/ProgressStep.figma.d.ts +15 -0
  115. package/build/components/ProgressStepper/ProgressStep.figma.js +17 -0
  116. package/build/components/ProgressStepper/ProgressStepper.figma.d.ts +13 -0
  117. package/build/components/ProgressStepper/ProgressStepper.figma.js +14 -0
  118. package/build/components/Radio/Radio.figma.d.ts +15 -0
  119. package/build/components/Radio/Radio.figma.js +17 -0
  120. package/build/components/Radio/RadioGroup.figma.d.ts +19 -0
  121. package/build/components/Radio/RadioGroup.figma.js +45 -0
  122. package/build/components/Radio/RadioImage.figma.d.ts +11 -0
  123. package/build/components/Radio/RadioImage.figma.js +10 -0
  124. package/build/components/Radio/RadioTile.figma.d.ts +16 -0
  125. package/build/components/Radio/RadioTile.figma.js +23 -0
  126. package/build/components/RadioCard/RadioCard.figma.d.ts +16 -0
  127. package/build/components/RadioCard/RadioCard.figma.js +22 -0
  128. package/build/components/Rating/Rating.figma.d.ts +12 -0
  129. package/build/components/Rating/Rating.figma.js +18 -0
  130. package/build/components/Roundel/Roundel.figma.d.ts +13 -0
  131. package/build/components/Roundel/Roundel.figma.js +15 -0
  132. package/build/components/SectionHeader/SectionHeader.figma.d.ts +21 -0
  133. package/build/components/SectionHeader/SectionHeader.figma.js +50 -0
  134. package/build/components/SegmentedControl/SegmentedControl.figma.d.ts +16 -0
  135. package/build/components/SegmentedControl/SegmentedControl.figma.js +20 -0
  136. package/build/components/SegmentedControl/SegmentedControlOption.figma.d.ts +17 -0
  137. package/build/components/SegmentedControl/SegmentedControlOption.figma.js +23 -0
  138. package/build/components/Select/Select.figma.d.ts +24 -0
  139. package/build/components/Select/Select.figma.js +65 -0
  140. package/build/components/Select/SelectOption.figma.d.ts +15 -0
  141. package/build/components/Select/SelectOption.figma.js +27 -0
  142. package/build/components/Spinner/Spinner.figma.d.ts +13 -0
  143. package/build/components/Spinner/Spinner.figma.js +16 -0
  144. package/build/components/Spinner/Spinner.js +1 -1
  145. package/build/components/Spinner/Spinner.web.js +1 -1
  146. package/build/components/StepperInput/StepperInput.figma.d.ts +25 -0
  147. package/build/components/StepperInput/StepperInput.figma.js +32 -0
  148. package/build/components/Switch/Switch.figma.d.ts +15 -0
  149. package/build/components/Switch/Switch.figma.js +18 -0
  150. package/build/components/Table/Table.figma.d.ts +14 -0
  151. package/build/components/Table/Table.figma.js +38 -0
  152. package/build/components/Table/TableHeaderCell.figma.d.ts +15 -0
  153. package/build/components/Table/TableHeaderCell.figma.js +31 -0
  154. package/build/components/Tabs/Tab.figma.d.ts +14 -0
  155. package/build/components/Tabs/Tab.figma.js +14 -0
  156. package/build/components/Tabs/Tab.js +1 -1
  157. package/build/components/Tabs/Tabs.figma.d.ts +14 -0
  158. package/build/components/Tabs/Tabs.figma.js +21 -0
  159. package/build/components/Textarea/Textarea.figma.d.ts +27 -0
  160. package/build/components/Textarea/Textarea.figma.js +53 -0
  161. package/build/components/TimePicker/TimePicker.figma.d.ts +16 -0
  162. package/build/components/TimePicker/TimePicker.figma.js +30 -0
  163. package/build/components/TimePickerInput/TimePickerInput.figma.d.ts +29 -0
  164. package/build/components/TimePickerInput/TimePickerInput.figma.js +53 -0
  165. package/build/components/Timeline/Timeline.figma.d.ts +14 -0
  166. package/build/components/Timeline/Timeline.figma.js +23 -0
  167. package/build/components/Timeline/TimelineItemProgress.figma.d.ts +16 -0
  168. package/build/components/Timeline/TimelineItemProgress.figma.js +30 -0
  169. package/build/components/Timeline/TimelineItemStatic.figma.d.ts +16 -0
  170. package/build/components/Timeline/TimelineItemStatic.figma.js +30 -0
  171. package/build/components/Toast/ToastItem.figma.d.ts +20 -0
  172. package/build/components/Toast/ToastItem.figma.js +42 -0
  173. package/build/components/ToggleButtonCard/ToggleButtonCard.figma.d.ts +14 -0
  174. package/build/components/ToggleButtonCard/ToggleButtonCard.figma.js +28 -0
  175. package/build/components/ToggleButtonCard/ToggleButtonCardRoot.js +16 -3
  176. package/build/components/UnstyledIconButton/UnstyledIconButton.figma.d.ts +21 -0
  177. package/build/components/UnstyledIconButton/UnstyledIconButton.figma.js +32 -0
  178. package/build/components/VerificationInput/VerificationInput.figma.d.ts +19 -0
  179. package/build/components/VerificationInput/VerificationInput.figma.js +22 -0
  180. package/build/components/index.d.ts +1 -0
  181. package/build/components/index.js +1 -0
  182. package/package.json +5 -4
  183. package/public/llms/components/list.md +6 -11
  184. package/public/llms/docs/ai-tooling.md +27 -5
  185. package/public/llms/docs/introduction.md +1 -1
package/SKILL.md CHANGED
@@ -62,6 +62,12 @@ Whatever source you use, review what is available before writing any code.
62
62
  The library is broad — always check whether an existing component covers the
63
63
  need before implementing anything custom.
64
64
 
65
+ When reusing an existing local pattern for a Hearth component, still check
66
+ that component's own doc page — a local pattern may predate a more direct
67
+ prop the library added later (e.g. `List`'s own `heading`/`helperText` props
68
+ vs. a sibling `SectionHeader` or `Heading`). Prefer the documented, current shorthand over
69
+ an older local convention when they diverge.
70
+
65
71
  ### Raw markdown files
66
72
 
67
73
  Full component API reference is available in the installed package. First,
@@ -129,6 +135,54 @@ pairing with someone, ask for it here too.
129
135
 
130
136
  # Critical Rules
131
137
 
138
+ ## Figma-to-code fidelity
139
+
140
+ These apply whenever you're translating `get_design_context`/`get_metadata`
141
+ output into code — they're easy to get right in principle and wrong in
142
+ practice, so treat them as mechanical checks rather than judgment calls:
143
+
144
+ - **Respect hidden-node flags.** Check a node's `hidden` flag before
145
+ implementing it — a hidden node is not part of the default/visible state,
146
+ so don't render it unconditionally just because its content was returned to
147
+ you. If you deliberately want to reuse hidden content for a different state
148
+ (e.g. an alternate variant), say so explicitly in a code comment and
149
+ confirm the condition with the user rather than silently flattening it into
150
+ the default view.
151
+ - **Don't invent style variants beyond what's in the design.** When a text
152
+ node's colour variable isn't visible in the response, default to the
153
+ base/primary token rather than adding a muted/secondary colour or other
154
+ visual hierarchy that isn't actually specified.
155
+ - **Verify each component instance individually.** When a design uses the
156
+ same component more than once with potentially different configurations
157
+ (variants, direction, size, etc.), check each instance against its own
158
+ region of the screenshot — don't assume the first instance's props apply
159
+ uniformly to the rest just because the component name matches. This
160
+ matters most for variant props (like `Flex`/`DescriptionList`'s
161
+ `direction`) that `get_metadata` doesn't expose at all, where the
162
+ screenshot is the only available ground truth.
163
+
164
+ ## Typography
165
+
166
+ Map a text node's Figma **text style name** directly to a component + `size`
167
+ (and `weight`, where present) — don't guess the size from screenshot
168
+ proportions. `get_design_context` surfaces the style name verbatim in its
169
+ "styles contained in the design" list, in the form
170
+ `<Category>/<Style Name> <SIZE>[ <Weight>]`, e.g.:
171
+
172
+ | Figma text style | Component + props |
173
+ | ------------------------------ | -------------------------------------- |
174
+ | `Headings/Heading MD` | `<Heading size="md">` |
175
+ | `Detail/Detail Text 3XL` | `<DetailText size="3xl">` |
176
+ | `Body/Body Text MD` | `<BodyText size="md">` |
177
+ | `Body/Body Text MD SemiBold` | `<BodyText size="md" weight="semibold">` |
178
+
179
+ The prefix before the slash (`Headings`/`Detail`/`Body`) names the
180
+ component (`Heading`/`DetailText`/`BodyText`); the last token is the `size`
181
+ value (lowercased); a trailing weight modifier (`SemiBold`, `Bold`) maps to
182
+ `BodyText`'s `weight` prop, lowercased. This is a direct, mechanical lookup —
183
+ if a style name is present in the response, use it instead of picking a size
184
+ by eye from the screenshot.
185
+
132
186
  ## Use layout components
133
187
 
134
188
  (Source of truth: [`public/llms/docs/layout-components.md`](public/llms/docs/layout-components.md))
@@ -171,9 +225,44 @@ Five layout primitives, all built on design tokens:
171
225
  </Center>
172
226
  ```
173
227
 
174
- Use `gap` (or the `spacing`/`space` alias) on the parent `Flex`/`Grid` to space
175
- children. For distribution and alignment, use `justify`/`align` on `Flex`. Don't
176
- put margin on individual sibling components just for spacing.
228
+ **Default to `Container` for a screen's top-level scrollable content
229
+ wrapper** it auto-applies the exact responsive page margin/padding tokens
230
+ (mobile: 16px horizontal margin, 24px top padding, 32px bottom padding
231
+ scaling up at larger breakpoints) that `Box`/`Flex` have no dedicated
232
+ shortcut for, instead of a manually-guessed `p`/`px`/`py`:
233
+
234
+ ```tsx
235
+ <Container>
236
+ <Flex direction="column" spacing="2xl">
237
+ {...}
238
+ </Flex>
239
+ </Container>
240
+ ```
241
+
242
+ More generally: before picking a layout prop/component for **any** node, scan
243
+ the Figma variable paths bound to it. If any contain the segment `container`
244
+ (e.g. `layout/container/padding-top`), that's a direct signal to reach for
245
+ `Container`'s own padding/margin props (or the nearest container-aware
246
+ ancestor) rather than a bare `Flex`/`Box` — regardless of whether the node
247
+ happens to be the literal screen root.
248
+
249
+ `Flex`/`Grid` have two distinct props for spacing children — don't treat them
250
+ as interchangeable aliases:
251
+
252
+ - **`gap`** — a raw numeric space token (`'0'..'900'`), non-responsive.
253
+ - **`spacing`** (aliased as the deprecated `space`) — Hearth's semantic layout
254
+ scale (`'2xs'..'2xl'`). This is both the direct match for Figma's
255
+ `layout/spacing/*` variable names **and** automatically responsive per
256
+ breakpoint (e.g. `spacing="2xl"` resolves to 28px on mobile, 40px on
257
+ desktop).
258
+
259
+ **If a Figma variable path bound to a node contains the segment `spacing`**
260
+ (e.g. `layout/spacing/lg`), use the `spacing` prop with the matching value
261
+ (`lg`, `2xl`, etc.) — never `gap`. Reserve `gap` for adjustments that don't
262
+ correspond to any named Figma variable.
263
+
264
+ For distribution and alignment, use `justify`/`align` on `Flex`. Don't put
265
+ margin on individual sibling components just for spacing.
177
266
 
178
267
  ```tsx
179
268
  // ❌ WRONG — margin for spacing
@@ -377,6 +466,43 @@ Compound components share state via a `<Component>Context` (check for a
377
466
 
378
467
  ## Common patterns
379
468
 
469
+ ### Icon next to wrapping body text
470
+
471
+ A `Text`/`BodyText` child inside a `direction="row"` `Flex` has no inherent
472
+ width constraint in RN's layout engine — it lays out at its intrinsic
473
+ single-line width unless told to share the remaining row space, and will
474
+ overflow instead of wrapping. This is a general React Native flexbox gotcha,
475
+ not Hearth-specific, and easy to miss when translating from a Figma/web
476
+ reference where text wraps by default.
477
+
478
+ ```tsx
479
+ <Flex direction="row" align="flex-start" gap="100">
480
+ <CheckIcon />
481
+ <BodyText style={{ flex: 1 }}>{longWrappingCopy}</BodyText>
482
+ </Flex>
483
+ ```
484
+
485
+ Give the text `flex: 1` (or `flexShrink: 1`, or wrap it in its own `Box`) so
486
+ it wraps instead of overflowing, and use `align="flex-start"` on the row
487
+ rather than `"center"` once the text can span multiple lines.
488
+
489
+ ### Interactive rows auto-render their own trailing chevron
490
+
491
+ `ListItem` renders a trailing `ChevronRightSmallIcon` automatically whenever
492
+ `onPress` is set and `trailingContent` is omitted — passing
493
+ `trailingContent={<ListItemTrailingIcon as={ChevronRightSmallIcon} />}`
494
+ yourself is redundant. `CardAction` goes further: it defaults its trailing
495
+ icon to `ChevronRightSmallIcon` unconditionally unless `trailingContent` is
496
+ supplied. Only pass `trailingContent` when you need a **different** trailing
497
+ element (a `Switch`, a `Link`, a custom icon).
498
+
499
+ This isn't visible from a Figma screenshot or `get_design_context` alone — a
500
+ row with a chevron doesn't tell you whether the component renders it for you
501
+ or expects it explicitly. Default/automatic behaviour driven by props like
502
+ `onPress` (not just visual appearance) should be checked against the
503
+ component's own source/docs before manually replicating something that might
504
+ already be automatic.
505
+
380
506
  ### Themed images that adapt to light/dark mode
381
507
 
382
508
  (Source of truth: [`public/llms/docs/dark-mode-best-practice.md`](public/llms/docs/dark-mode-best-practice.md))
@@ -0,0 +1,15 @@
1
+ import figma from 'figma';
2
+ declare const _default: {
3
+ id: string;
4
+ imports: string[];
5
+ example: figma.TemplateStringResult;
6
+ metadata: {
7
+ nestable: boolean;
8
+ props: {
9
+ heading: string | undefined;
10
+ helperText: string | undefined;
11
+ items: figma.ResultSection[][];
12
+ };
13
+ };
14
+ };
15
+ export default _default;
@@ -0,0 +1,20 @@
1
+ // url=https://www.figma.com/design/6NKZXZhFSExXrcbBgc6zTR?node-id=3385%3A7751
2
+ // source=https://github.com/utilitywarehouse/hearth/blob/main/packages/react-native/src/components/Accordion/Accordion.tsx
3
+ // component=Accordion
4
+ import figma from 'figma';
5
+ const instance = figma.selectedInstance;
6
+ const sectionHeader = instance.findInstance('Section Header');
7
+ const heading = sectionHeader.type !== 'ERROR' ? sectionHeader.getString('Heading') : undefined;
8
+ const helperText = sectionHeader.type !== 'ERROR' ? sectionHeader.getString('Helper text') : undefined;
9
+ // "Accordion items" is a slot — connectedInstances only includes children with their own
10
+ // Code Connect definitions, i.e. AccordionItem once its .figma.ts is published.
11
+ const itemsSlot = instance.getSlot('Accordion items');
12
+ const items = itemsSlot?.connectedInstances.map(item => item.executeTemplate().example) ?? [];
13
+ export default {
14
+ id: 'Accordion',
15
+ imports: ["import { Accordion } from '@utilitywarehouse/hearth-react-native';"],
16
+ example: figma.code `<Accordion${figma.helpers.react.renderProp('heading', heading)}${figma.helpers.react.renderProp('helperText', helperText)}>
17
+ ${items.flat()}
18
+ </Accordion>`,
19
+ metadata: { nestable: true, props: { heading, helperText, items } },
20
+ };
@@ -0,0 +1,17 @@
1
+ import figma from 'figma';
2
+ declare const _default: {
3
+ id: string;
4
+ imports: string[];
5
+ example: figma.TemplateStringResult;
6
+ metadata: {
7
+ nestable: boolean;
8
+ props: {
9
+ title: string;
10
+ expanded: boolean;
11
+ description: string;
12
+ triggerContent: figma.ResultSection[] | undefined;
13
+ content: figma.ResultSection[][];
14
+ };
15
+ };
16
+ };
17
+ export default _default;
@@ -0,0 +1,26 @@
1
+ // url=https://www.figma.com/design/6NKZXZhFSExXrcbBgc6zTR?node-id=3390%3A6160
2
+ // source=https://github.com/utilitywarehouse/hearth/blob/main/packages/react-native/src/components/Accordion/Accordion.tsx
3
+ // component=AccordionItem
4
+ import figma from 'figma';
5
+ const instance = figma.selectedInstance;
6
+ const title = instance.getString('Title');
7
+ const expanded = instance.getBoolean('Expand?');
8
+ const description = instance.getString('Description');
9
+ // "Trigger custom content" and "Custom content" are slots — connectedInstances only includes
10
+ // children with their own Code Connect definitions.
11
+ const triggerSlot = instance.getSlot('Trigger custom content');
12
+ const triggerContent = triggerSlot?.connectedInstances[0]?.executeTemplate().example;
13
+ const contentSlot = instance.getSlot('Custom content');
14
+ const content = contentSlot?.connectedInstances.map(item => item.executeTemplate().example) ?? [];
15
+ export default {
16
+ id: 'AccordionItem',
17
+ imports: [
18
+ "import { BodyText } from '@utilitywarehouse/hearth-react-native';",
19
+ "import { AccordionItem } from '@utilitywarehouse/hearth-react-native';",
20
+ ],
21
+ example: figma.code `<AccordionItem${figma.helpers.react.renderProp('title', title)}${figma.helpers.react.renderProp('expanded', expanded)}${triggerContent ? figma.code ` triggerContent={${triggerContent}}` : ''}>
22
+ <BodyText>${figma.helpers.react.renderChildren(description)}</BodyText>
23
+ ${content.flat()}
24
+ </AccordionItem>`,
25
+ metadata: { nestable: true, props: { title, expanded, description, triggerContent, content } },
26
+ };
@@ -0,0 +1,33 @@
1
+ import figma from 'figma';
2
+ declare const _default: {
3
+ id: string;
4
+ imports: string[];
5
+ example: figma.TemplateStringResult;
6
+ metadata: {
7
+ nestable: boolean;
8
+ props: {
9
+ colorScheme: string | undefined;
10
+ onPressIconButton: {
11
+ $value: string;
12
+ $type: "function";
13
+ } | undefined;
14
+ text: string;
15
+ onClose: {
16
+ $value: string;
17
+ $type: "function";
18
+ } | undefined;
19
+ title: figma.EnumOptionsValues<{
20
+ true: string;
21
+ false: undefined;
22
+ }>;
23
+ onPressLink: {
24
+ $value: string;
25
+ $type: "function";
26
+ } | undefined;
27
+ link: {
28
+ text: string | undefined;
29
+ };
30
+ };
31
+ };
32
+ };
33
+ export default _default;
@@ -0,0 +1,40 @@
1
+ // url=https://www.figma.com/design/6NKZXZhFSExXrcbBgc6zTR?node-id=3288%3A4656
2
+ // source=https://github.com/utilitywarehouse/hearth/blob/main/packages/react-native/src/components/Alert/Alert.tsx
3
+ // component=Alert
4
+ import figma from 'figma';
5
+ const colorScheme = figma.selectedInstance.getEnum('Color Scheme', {
6
+ Info: 'info',
7
+ Positive: 'positive',
8
+ Warning: 'warning',
9
+ Danger: 'danger',
10
+ });
11
+ const showIconButton = figma.selectedInstance.getBoolean('Icon button?');
12
+ const onPressIconButton = showIconButton === true
13
+ ? figma.helpers.react.function("() => console.log('icon button pressed')")
14
+ : undefined;
15
+ const text = figma.selectedInstance.getString('Text');
16
+ const showClose = figma.selectedInstance.getBoolean('Close?');
17
+ const onClose = showClose === true ? figma.helpers.react.function("() => console.log('close')") : undefined;
18
+ const title = figma.selectedInstance.getBoolean('Title?', {
19
+ true: figma.selectedInstance.getString('Title'),
20
+ false: undefined,
21
+ });
22
+ const showLinkPress = figma.selectedInstance.getBoolean('Link?');
23
+ const onPressLink = showLinkPress === true
24
+ ? figma.helpers.react.function("() => console.log('link pressed')")
25
+ : undefined;
26
+ const link = (function () {
27
+ const nestedLayer0 = figma.selectedInstance.findInstance('Link');
28
+ return {
29
+ text: nestedLayer0.type !== 'ERROR' ? nestedLayer0.getString('Text') : undefined,
30
+ };
31
+ })();
32
+ export default {
33
+ id: 'Alert',
34
+ imports: ['import { Alert } from "@utilitywarehouse/hearth-react-native";'],
35
+ example: figma.code `<Alert${figma.helpers.react.renderProp('colorScheme', colorScheme)}${figma.helpers.react.renderProp('title', title)}${figma.helpers.react.renderProp('text', text)}${figma.helpers.react.renderProp('onClose', onClose)}${figma.helpers.react.renderProp('onPressIconButton', onPressIconButton)}${figma.helpers.react.renderProp('link', link.text)}${figma.helpers.react.renderProp('onPressLink', onPressLink)}/>`,
36
+ metadata: {
37
+ nestable: true,
38
+ props: { colorScheme, onPressIconButton, text, onClose, title, onPressLink, link },
39
+ },
40
+ };
@@ -0,0 +1,16 @@
1
+ import figma from 'figma';
2
+ declare const _default: {
3
+ id: string;
4
+ imports: string[];
5
+ example: figma.TemplateStringResult;
6
+ metadata: {
7
+ nestable: boolean;
8
+ props: {
9
+ size: string | undefined;
10
+ name: string;
11
+ src: figma.ResultSection[] | undefined;
12
+ variant: string | undefined;
13
+ };
14
+ };
15
+ };
16
+ export default _default;
@@ -0,0 +1,29 @@
1
+ // url=https://www.figma.com/design/6NKZXZhFSExXrcbBgc6zTR/Hearth-Components---Tokens?node-id=6790-14313
2
+ // source=https://github.com/utilitywarehouse/hearth/blob/main/packages/react-native/src/components/Avatar/Avatar.tsx
3
+ // component=Avatar
4
+ import figma from 'figma';
5
+ const size = figma.selectedInstance.getEnum('Size', {
6
+ 'SM-32': 'sm',
7
+ 'MD-48': 'md',
8
+ });
9
+ const name = figma.selectedInstance.getString('Initials');
10
+ const src = figma.selectedInstance.getInstanceSwap('Image')?.executeTemplate().example;
11
+ const variant = figma.selectedInstance.getEnum('Variant', {
12
+ Image: 'image',
13
+ Initials: 'initials',
14
+ Icon: 'icon',
15
+ });
16
+ export default {
17
+ id: 'Avatar',
18
+ imports: ["import { Avatar } from '@utilitywarehouse/hearth-react-native';"],
19
+ example: figma.code `<Avatar${figma.helpers.react.renderProp('size', size)}${figma.helpers.react.renderProp('name', name)}${figma.helpers.react.renderProp('src', src)}/>`,
20
+ metadata: {
21
+ nestable: true,
22
+ props: {
23
+ size,
24
+ name,
25
+ src,
26
+ variant,
27
+ },
28
+ },
29
+ };
@@ -0,0 +1,21 @@
1
+ import figma from 'figma';
2
+ declare const _default: {
3
+ id: string;
4
+ imports: string[];
5
+ example: figma.TemplateStringResult;
6
+ metadata: {
7
+ nestable: boolean;
8
+ props: {
9
+ variant: string | undefined;
10
+ colorScheme: string | undefined;
11
+ size: string | undefined;
12
+ flatBase: boolean;
13
+ icon: {
14
+ $value: string;
15
+ $type: "react-component";
16
+ } | undefined;
17
+ text: string;
18
+ };
19
+ };
20
+ };
21
+ export default _default;
@@ -0,0 +1,47 @@
1
+ // url=https://www.figma.com/design/6NKZXZhFSExXrcbBgc6zTR?node-id=61%3A652
2
+ // source=https://github.com/utilitywarehouse/hearth/blob/main/packages/react-native/src/components/Badge/Badge.tsx
3
+ // component=Badge
4
+ import figma from 'figma';
5
+ const instance = figma.selectedInstance;
6
+ const variant = instance.getEnum('Variant', {
7
+ 'Subtle - Default': 'subtle',
8
+ Emphasis: 'emphasis',
9
+ Outline: 'outline',
10
+ });
11
+ const colorScheme = instance.getEnum('Color Scheme', {
12
+ Info: 'info',
13
+ Positive: 'positive',
14
+ Danger: 'danger',
15
+ Warning: 'warning',
16
+ Functional: 'functional',
17
+ Energy: 'energy',
18
+ Broadband: 'broadband',
19
+ Mobile: 'mobile',
20
+ Insurance: 'insurance',
21
+ Cashback: 'cashback',
22
+ Pig: 'pig',
23
+ Highlight: 'highlight',
24
+ });
25
+ const size = instance.getEnum('Size', {
26
+ 'SM-24': 'sm',
27
+ 'MD-28': 'md',
28
+ });
29
+ const flatBase = instance.getBoolean('Flat Base?');
30
+ const iconName = instance.getBoolean('Icon?', {
31
+ true: instance.getInstanceSwap('Icon-20')?.executeTemplate().metadata?.props?.componentName,
32
+ });
33
+ const icon = iconName ? figma.helpers.react.reactComponent(iconName) : undefined;
34
+ const text = instance.getString('Text');
35
+ export default {
36
+ id: 'Badge',
37
+ imports: [
38
+ "import { Badge } from '@utilitywarehouse/hearth-react-native';",
39
+ ...(iconName
40
+ ? [`import { ${iconName} } from '@utilitywarehouse/hearth-react-native-icons';`]
41
+ : []),
42
+ ],
43
+ example: figma.code `<Badge${figma.helpers.react.renderProp('variant', variant)}${figma.helpers.react.renderProp('colorScheme', colorScheme)}${figma.helpers.react.renderProp('size', size)}${figma.helpers.react.renderProp('flatBase', flatBase)}${figma.helpers.react.renderProp('icon', icon)}>
44
+ ${figma.helpers.react.renderChildren(text)}
45
+ </Badge>`,
46
+ metadata: { nestable: true, props: { variant, colorScheme, size, flatBase, icon, text } },
47
+ };
@@ -0,0 +1,26 @@
1
+ import figma from 'figma';
2
+ declare const _default: {
3
+ id: string;
4
+ imports: string[];
5
+ example: figma.TemplateStringResult;
6
+ metadata: {
7
+ nestable: boolean;
8
+ props: {
9
+ heading: string;
10
+ description: string;
11
+ direction: string;
12
+ image: figma.ResultSection[] | undefined;
13
+ button: figma.ResultSection[] | undefined;
14
+ link: figma.ResultSection[] | undefined;
15
+ onPress: {
16
+ $value: string;
17
+ $type: "function";
18
+ } | undefined;
19
+ onClose: {
20
+ $value: string;
21
+ $type: "function";
22
+ } | undefined;
23
+ };
24
+ };
25
+ };
26
+ export default _default;
@@ -0,0 +1,47 @@
1
+ // url=https://www.figma.com/design/6NKZXZhFSExXrcbBgc6zTR/Hearth-Components---Tokens?node-id=8294-3905&m=dev
2
+ // source=https://github.com/utilitywarehouse/hearth/blob/main/packages/react-native/src/components/Banner/Banner.tsx
3
+ // component=Banner
4
+ import figma from 'figma';
5
+ const instance = figma.selectedInstance;
6
+ const headingText = instance.findText('Banner heading');
7
+ const heading = (headingText.type !== 'ERROR' ? headingText.textContent : undefined) || 'The banner heading';
8
+ const descriptionText = instance.findText('Description');
9
+ const description = (descriptionText.type !== 'ERROR' ? descriptionText.textContent : undefined) ||
10
+ 'The text in the banner';
11
+ const rawDirection = instance.getEnum('Direction', {
12
+ Horizontal: 'horizontal',
13
+ Vertical: 'vertical',
14
+ });
15
+ // getEnum() can resolve to a non-string sentinel when Direction can't be matched to either
16
+ // option — always fall back to the component's own default ('horizontal') rather than pass
17
+ // that sentinel through to renderProp, which renders it as broken, unparseable syntax.
18
+ const direction = typeof rawDirection === 'string' ? rawDirection : 'horizontal';
19
+ const imageSlot = instance.getSlot('Image');
20
+ const image2Slot = instance.getSlot('Image2');
21
+ const image = imageSlot?.connectedInstances[0]?.executeTemplate().example ??
22
+ image2Slot?.connectedInstances[0]?.executeTemplate().example;
23
+ const showClose = instance.getBoolean('Close?');
24
+ const onClose = showClose === true
25
+ ? figma.helpers.react.function("() => console.log('Close pressed')")
26
+ : undefined;
27
+ const showButton = instance.getBoolean('Button?');
28
+ const buttonInstance = instance.findInstance('Button');
29
+ const button = showButton && buttonInstance.type !== 'ERROR'
30
+ ? buttonInstance.executeTemplate().example
31
+ : undefined;
32
+ const showLink = instance.getBoolean('Link?');
33
+ const linkInstance = instance.findInstance('Link');
34
+ const link = showLink && linkInstance.type !== 'ERROR' ? linkInstance.executeTemplate().example : undefined;
35
+ const showChevron = instance.getBoolean('Chevron?');
36
+ const onPress = showChevron === true
37
+ ? figma.helpers.react.function("() => console.log('Banner pressed')")
38
+ : undefined;
39
+ export default {
40
+ id: 'Banner',
41
+ imports: ["import { Banner } from '@utilitywarehouse/hearth-react-native';"],
42
+ example: figma.code `<Banner${figma.helpers.react.renderProp('heading', heading)}${figma.helpers.react.renderProp('description', description)}${figma.helpers.react.renderProp('direction', direction)}${figma.helpers.react.renderProp('image', image)}${figma.helpers.react.renderProp('button', button)}${figma.helpers.react.renderProp('link', link)}${figma.helpers.react.renderProp('onPress', onPress)}${figma.helpers.react.renderProp('onClose', onClose)} />`,
43
+ metadata: {
44
+ nestable: true,
45
+ props: { heading, description, direction, image, button, link, onPress, onClose },
46
+ },
47
+ };
@@ -0,0 +1,11 @@
1
+ import figma from 'figma';
2
+ declare const _default: {
3
+ id: string;
4
+ imports: string[];
5
+ example: figma.TemplateStringResult;
6
+ metadata: {
7
+ nestable: boolean;
8
+ props: {};
9
+ };
10
+ };
11
+ export default _default;
@@ -0,0 +1,13 @@
1
+ // url=https://www.figma.com/design/6NKZXZhFSExXrcbBgc6zTR?node-id=10145%3A4877
2
+ // source=https://github.com/utilitywarehouse/hearth/blob/main/packages/react-native/src/components/Banner/BannerIllustration.tsx
3
+ // component=BannerIllustration
4
+ import figma from 'figma';
5
+ export default {
6
+ id: 'BannerIllustration',
7
+ imports: ["import { BannerIllustration } from '@utilitywarehouse/hearth-react-native'"],
8
+ example: figma.code `<BannerIllustration />`,
9
+ metadata: {
10
+ nestable: true,
11
+ props: {},
12
+ },
13
+ };
@@ -0,0 +1,11 @@
1
+ import figma from 'figma';
2
+ declare const _default: {
3
+ id: string;
4
+ imports: string[];
5
+ example: figma.TemplateStringResult;
6
+ metadata: {
7
+ nestable: boolean;
8
+ props: {};
9
+ };
10
+ };
11
+ export default _default;
@@ -0,0 +1,11 @@
1
+ // url=https://www.figma.com/design/6NKZXZhFSExXrcbBgc6zTR?node-id=4084%3A33378
2
+ // source=https://github.com/utilitywarehouse/hearth/blob/main/packages/react-native/src/components/BottomSheet/BottomSheetModal.tsx
3
+ // component=BottomSheetModal
4
+ import figma from 'figma';
5
+ const instance = figma.selectedInstance;
6
+ export default {
7
+ id: 'BottomSheetModal',
8
+ imports: ["import { BottomSheetModal } from '@utilitywarehouse/hearth-react-native';"],
9
+ example: figma.code `<BottomSheetModal />`,
10
+ metadata: { nestable: true, props: {} },
11
+ };
@@ -0,0 +1,38 @@
1
+ import figma from 'figma';
2
+ declare const _default: {
3
+ id: string;
4
+ imports: string[];
5
+ example: figma.TemplateStringResult;
6
+ metadata: {
7
+ nestable: boolean;
8
+ props: {
9
+ disabled: boolean | undefined;
10
+ size: string | undefined;
11
+ paddingNone: figma.EnumOptionsValues<{
12
+ True: boolean;
13
+ False: boolean;
14
+ }> | undefined;
15
+ colorScheme: string | undefined;
16
+ loading: boolean | undefined;
17
+ text: string;
18
+ ghostText: string;
19
+ iconPosition: figma.EnumOptionsValues<{
20
+ true: undefined;
21
+ false: figma.EnumOptionsValues<{
22
+ true: string;
23
+ false: undefined;
24
+ }>;
25
+ }>;
26
+ icon: {
27
+ $value: string;
28
+ $type: "react-component";
29
+ } | undefined;
30
+ variant: string | undefined;
31
+ inverted: figma.EnumOptionsValues<{
32
+ True: boolean;
33
+ False: boolean;
34
+ }> | undefined;
35
+ };
36
+ };
37
+ };
38
+ export default _default;