@utilitywarehouse/hearth-react-native 0.35.6 → 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 (187) 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/Flex/Flex.props.d.ts +2 -2
  55. package/build/components/FormField/FormField.figma.d.ts +15 -0
  56. package/build/components/FormField/FormField.figma.js +27 -0
  57. package/build/components/Helper/HelperText.figma.d.ts +13 -0
  58. package/build/components/Helper/HelperText.figma.js +12 -0
  59. package/build/components/HighlightBanner/HighlightBanner.figma.d.ts +19 -0
  60. package/build/components/HighlightBanner/HighlightBanner.figma.js +45 -0
  61. package/build/components/IconButton/IconButton.figma.d.ts +22 -0
  62. package/build/components/IconButton/IconButton.figma.js +47 -0
  63. package/build/components/IconContainer/IconContainer.figma.d.ts +20 -0
  64. package/build/components/IconContainer/IconContainer.figma.js +43 -0
  65. package/build/components/IndicatorIconButton/IndicatorIconButton.figma.d.ts +17 -0
  66. package/build/components/IndicatorIconButton/IndicatorIconButton.figma.js +23 -0
  67. package/build/components/InlineLink/InlineLink.d.ts +1 -1
  68. package/build/components/InlineLink/InlineLink.js +7 -2
  69. package/build/components/InlineLink/InlineLink.props.d.ts +2 -0
  70. package/build/components/InlineLink/InlineLinkRoot.d.ts +1 -1
  71. package/build/components/InlineLink/InlineLinkRoot.js +8 -3
  72. package/build/components/Input/Input.figma.d.ts +28 -0
  73. package/build/components/Input/Input.figma.js +67 -0
  74. package/build/components/Input/Input_1.figma.d.ts +22 -0
  75. package/build/components/Input/Input_1.figma.js +54 -0
  76. package/build/components/Input/Input_2.figma.d.ts +17 -0
  77. package/build/components/Input/Input_2.figma.js +34 -0
  78. package/build/components/Label/Label.figma.d.ts +14 -0
  79. package/build/components/Label/Label.figma.js +19 -0
  80. package/build/components/Link/Link.d.ts +1 -1
  81. package/build/components/Link/Link.figma.d.ts +27 -0
  82. package/build/components/Link/Link.figma.js +45 -0
  83. package/build/components/Link/Link.js +7 -2
  84. package/build/components/Link/Link.props.d.ts +2 -0
  85. package/build/components/Link/LinkRoot.d.ts +1 -1
  86. package/build/components/Link/LinkRoot.js +8 -3
  87. package/build/components/List/List.figma.d.ts +21 -0
  88. package/build/components/List/List.figma.js +49 -0
  89. package/build/components/List/ListAction/ListAction.figma.d.ts +15 -0
  90. package/build/components/List/ListAction/ListAction.figma.js +17 -0
  91. package/build/components/List/ListItem/ListItem.figma.d.ts +33 -0
  92. package/build/components/List/ListItem/ListItem.figma.js +83 -0
  93. package/build/components/List/ListItem/ListItemLeadingContent.figma.d.ts +14 -0
  94. package/build/components/List/ListItem/ListItemLeadingContent.figma.js +17 -0
  95. package/build/components/List/ListItem/ListItemTrailingContent.figma.d.ts +13 -0
  96. package/build/components/List/ListItem/ListItemTrailingContent.figma.js +14 -0
  97. package/build/components/Menu/Menu.figma.d.ts +14 -0
  98. package/build/components/Menu/Menu.figma.js +33 -0
  99. package/build/components/Menu/MenuItem.figma.d.ts +29 -0
  100. package/build/components/Menu/MenuItem.figma.js +45 -0
  101. package/build/components/Modal/Modal.figma.d.ts +24 -0
  102. package/build/components/Modal/Modal.figma.js +64 -0
  103. package/build/components/NavModal/NavModal.figma.d.ts +19 -0
  104. package/build/components/NavModal/NavModal.figma.js +42 -0
  105. package/build/components/Pagination/Pagination.figma.d.ts +16 -0
  106. package/build/components/Pagination/Pagination.figma.js +20 -0
  107. package/build/components/PillGroup/Pill.figma.d.ts +17 -0
  108. package/build/components/PillGroup/Pill.figma.js +21 -0
  109. package/build/components/PillGroup/PillGroup.figma.d.ts +13 -0
  110. package/build/components/PillGroup/PillGroup.figma.js +18 -0
  111. package/build/components/ProgressBar/ProgressBar.circular.figma.d.ts +16 -0
  112. package/build/components/ProgressBar/ProgressBar.circular.figma.js +35 -0
  113. package/build/components/ProgressBar/ProgressBar.figma.d.ts +15 -0
  114. package/build/components/ProgressBar/ProgressBar.figma.js +31 -0
  115. package/build/components/ProgressStepper/ProgressStep.figma.d.ts +15 -0
  116. package/build/components/ProgressStepper/ProgressStep.figma.js +17 -0
  117. package/build/components/ProgressStepper/ProgressStepper.figma.d.ts +13 -0
  118. package/build/components/ProgressStepper/ProgressStepper.figma.js +14 -0
  119. package/build/components/Radio/Radio.figma.d.ts +15 -0
  120. package/build/components/Radio/Radio.figma.js +17 -0
  121. package/build/components/Radio/RadioGroup.figma.d.ts +19 -0
  122. package/build/components/Radio/RadioGroup.figma.js +45 -0
  123. package/build/components/Radio/RadioImage.figma.d.ts +11 -0
  124. package/build/components/Radio/RadioImage.figma.js +10 -0
  125. package/build/components/Radio/RadioTile.figma.d.ts +16 -0
  126. package/build/components/Radio/RadioTile.figma.js +23 -0
  127. package/build/components/RadioCard/RadioCard.figma.d.ts +16 -0
  128. package/build/components/RadioCard/RadioCard.figma.js +22 -0
  129. package/build/components/Rating/Rating.figma.d.ts +12 -0
  130. package/build/components/Rating/Rating.figma.js +18 -0
  131. package/build/components/Roundel/Roundel.figma.d.ts +13 -0
  132. package/build/components/Roundel/Roundel.figma.js +15 -0
  133. package/build/components/SectionHeader/SectionHeader.figma.d.ts +21 -0
  134. package/build/components/SectionHeader/SectionHeader.figma.js +50 -0
  135. package/build/components/SegmentedControl/SegmentedControl.figma.d.ts +16 -0
  136. package/build/components/SegmentedControl/SegmentedControl.figma.js +20 -0
  137. package/build/components/SegmentedControl/SegmentedControlOption.figma.d.ts +17 -0
  138. package/build/components/SegmentedControl/SegmentedControlOption.figma.js +23 -0
  139. package/build/components/Select/Select.figma.d.ts +24 -0
  140. package/build/components/Select/Select.figma.js +65 -0
  141. package/build/components/Select/SelectOption.figma.d.ts +15 -0
  142. package/build/components/Select/SelectOption.figma.js +27 -0
  143. package/build/components/Spinner/Spinner.figma.d.ts +13 -0
  144. package/build/components/Spinner/Spinner.figma.js +16 -0
  145. package/build/components/Spinner/Spinner.js +1 -1
  146. package/build/components/Spinner/Spinner.web.js +1 -1
  147. package/build/components/StepperInput/StepperInput.figma.d.ts +25 -0
  148. package/build/components/StepperInput/StepperInput.figma.js +32 -0
  149. package/build/components/Switch/Switch.figma.d.ts +15 -0
  150. package/build/components/Switch/Switch.figma.js +18 -0
  151. package/build/components/Table/Table.figma.d.ts +14 -0
  152. package/build/components/Table/Table.figma.js +38 -0
  153. package/build/components/Table/TableHeaderCell.figma.d.ts +15 -0
  154. package/build/components/Table/TableHeaderCell.figma.js +31 -0
  155. package/build/components/Tabs/Tab.figma.d.ts +14 -0
  156. package/build/components/Tabs/Tab.figma.js +14 -0
  157. package/build/components/Tabs/Tab.js +1 -1
  158. package/build/components/Tabs/Tabs.figma.d.ts +14 -0
  159. package/build/components/Tabs/Tabs.figma.js +21 -0
  160. package/build/components/Textarea/Textarea.figma.d.ts +27 -0
  161. package/build/components/Textarea/Textarea.figma.js +53 -0
  162. package/build/components/TimePicker/TimePicker.figma.d.ts +16 -0
  163. package/build/components/TimePicker/TimePicker.figma.js +30 -0
  164. package/build/components/TimePickerInput/TimePickerInput.figma.d.ts +29 -0
  165. package/build/components/TimePickerInput/TimePickerInput.figma.js +53 -0
  166. package/build/components/Timeline/Timeline.figma.d.ts +14 -0
  167. package/build/components/Timeline/Timeline.figma.js +23 -0
  168. package/build/components/Timeline/TimelineItemProgress.figma.d.ts +16 -0
  169. package/build/components/Timeline/TimelineItemProgress.figma.js +30 -0
  170. package/build/components/Timeline/TimelineItemStatic.figma.d.ts +16 -0
  171. package/build/components/Timeline/TimelineItemStatic.figma.js +30 -0
  172. package/build/components/Toast/ToastItem.figma.d.ts +20 -0
  173. package/build/components/Toast/ToastItem.figma.js +42 -0
  174. package/build/components/ToggleButtonCard/ToggleButtonCard.figma.d.ts +14 -0
  175. package/build/components/ToggleButtonCard/ToggleButtonCard.figma.js +28 -0
  176. package/build/components/ToggleButtonCard/ToggleButtonCardRoot.js +16 -3
  177. package/build/components/UnstyledIconButton/UnstyledIconButton.figma.d.ts +21 -0
  178. package/build/components/UnstyledIconButton/UnstyledIconButton.figma.js +32 -0
  179. package/build/components/VerificationInput/VerificationInput.figma.d.ts +19 -0
  180. package/build/components/VerificationInput/VerificationInput.figma.js +22 -0
  181. package/build/components/index.d.ts +1 -0
  182. package/build/components/index.js +1 -0
  183. package/build/types/utilityProps.d.ts +1 -1
  184. package/package.json +5 -4
  185. package/public/llms/components/list.md +6 -11
  186. package/public/llms/docs/ai-tooling.md +27 -5
  187. package/public/llms/docs/introduction.md +1 -1
@@ -0,0 +1,19 @@
1
+ // url=https://www.figma.com/design/6NKZXZhFSExXrcbBgc6zTR?node-id=8145%3A617
2
+ // source=https://github.com/utilitywarehouse/hearth/blob/main/packages/react-native/src/components/Label/Label.tsx
3
+ // component=Label
4
+ import figma from 'figma';
5
+ const instance = figma.selectedInstance;
6
+ const label = instance.getString('Label');
7
+ const optional = instance.getBoolean('Optional?');
8
+ export default {
9
+ id: 'label',
10
+ imports: ['import { Label } from "@utilitywarehouse/hearth-react-native";'],
11
+ example: figma.code `<Label>${figma.helpers.react.renderChildren(label)}${optional ? ' (optional)' : ''}</Label>`,
12
+ metadata: {
13
+ nestable: true,
14
+ props: {
15
+ label,
16
+ optional,
17
+ },
18
+ },
19
+ };
@@ -1,7 +1,7 @@
1
1
  import type { LinkProps } from './Link.props';
2
2
  export declare const LinkText: import("react").ForwardRefExoticComponent<import("react-native/types").TextProps & import("react").RefAttributes<import("react-native/types").TextProps>>;
3
3
  declare const Link: {
4
- ({ children, icon, disabled, target, iconPosition, showIcon, textStyle, iconStyle, ...props }: LinkProps): import("react/jsx-runtime").JSX.Element;
4
+ ({ children, icon, disabled, target, rel, iconPosition, showIcon, textStyle, iconStyle, ...props }: LinkProps): import("react/jsx-runtime").JSX.Element;
5
5
  displayName: string;
6
6
  };
7
7
  export default Link;
@@ -0,0 +1,27 @@
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
+ iconRight: boolean;
10
+ iconLeft: boolean;
11
+ inverted: figma.EnumOptionsValues<{
12
+ True: boolean;
13
+ False: boolean;
14
+ }> | undefined;
15
+ text: string;
16
+ showIcon: boolean;
17
+ iconPosition: string | undefined;
18
+ iconRightName: string | undefined;
19
+ iconLeftName: string | undefined;
20
+ icon: {
21
+ $value: string;
22
+ $type: "react-component";
23
+ } | undefined;
24
+ };
25
+ };
26
+ };
27
+ export default _default;
@@ -0,0 +1,45 @@
1
+ // url=https://www.figma.com/design/6NKZXZhFSExXrcbBgc6zTR?node-id=163%3A562
2
+ // source=https://github.com/utilitywarehouse/hearth/blob/main/packages/react-native/src/components/Link/Link.tsx
3
+ // component=Link
4
+ import figma from 'figma';
5
+ const iconRight = figma.selectedInstance.getBoolean('Icon right?');
6
+ const iconLeft = figma.selectedInstance.getBoolean('Icon left?');
7
+ const inverted = figma.selectedInstance.getEnum('Inverted?', {
8
+ True: true,
9
+ False: false,
10
+ });
11
+ const text = figma.selectedInstance.getString('Text');
12
+ const showIcon = iconRight || iconLeft;
13
+ const iconPosition = iconRight ? 'right' : iconLeft ? 'left' : undefined;
14
+ const iconRightName = figma.selectedInstance.getInstanceSwap('Icon right-20')?.executeTemplate()
15
+ .metadata?.props?.componentName;
16
+ const iconLeftName = figma.selectedInstance.getInstanceSwap('Icon left-20')?.executeTemplate()
17
+ .metadata?.props?.componentName;
18
+ const iconName = showIcon ? (iconRight ? iconRightName : iconLeftName) : undefined;
19
+ const icon = iconName ? figma.helpers.react.reactComponent(iconName) : undefined;
20
+ export default {
21
+ id: 'Link',
22
+ imports: [
23
+ "import { Link } from '@utilitywarehouse/hearth-react-native';",
24
+ ...(iconName
25
+ ? [`import { ${iconName} } from '@utilitywarehouse/hearth-react-native-icons';`]
26
+ : []),
27
+ ],
28
+ example: figma.code `<Link${figma.helpers.react.renderProp('inverted', inverted)}${figma.helpers.react.renderProp('showIcon', showIcon)}${figma.helpers.react.renderProp('iconPosition', iconPosition)}${figma.helpers.react.renderProp('icon', icon)}>
29
+ ${figma.helpers.react.renderChildren(text)}
30
+ </Link>`,
31
+ metadata: {
32
+ nestable: true,
33
+ props: {
34
+ iconRight,
35
+ iconLeft,
36
+ inverted,
37
+ text,
38
+ showIcon,
39
+ iconPosition,
40
+ iconRightName,
41
+ iconLeftName,
42
+ icon,
43
+ },
44
+ },
45
+ };
@@ -10,9 +10,14 @@ const LinkComponent = createLink({
10
10
  });
11
11
  export const LinkText = LinkComponent.Text;
12
12
  LinkText.displayName = 'LinkText';
13
- const Link = ({ children, icon = ChevronRightSmallIcon, disabled = false, target = '_self', iconPosition = 'right', showIcon = true, textStyle, iconStyle, ...props }) => {
13
+ const Link = ({ children, icon = ChevronRightSmallIcon, disabled = false, target = '_self', rel, iconPosition = 'right', showIcon = true, textStyle, iconStyle, ...props }) => {
14
14
  const LinkAny = LinkComponent;
15
- return (_jsxs(LinkAny, { ...props, isDisabled: disabled, isExternal: target === '_blank', children: [showIcon && icon && iconPosition === 'left' ? (_jsx(LinkIcon, { as: icon, style: iconStyle })) : null, _jsx(LinkText, { style: textStyle, children: children }), showIcon && icon && iconPosition === 'right' ? (_jsx(LinkIcon, { as: icon, style: iconStyle })) : null] }));
15
+ // `@gluestack-ui/link`'s `useLink` only ever applies `target`/`rel` via a ref
16
+ // mutation during render, before the ref is attached at commit - it never
17
+ // takes effect. Pass them through explicitly instead; LinkRoot forwards them
18
+ // to the underlying Pressable as `hrefAttrs`, which is how react-native-web
19
+ // actually applies them to the rendered `<a>`.
20
+ return (_jsxs(LinkAny, { ...props, target: target, rel: rel ?? (target === '_blank' ? 'noopener noreferrer' : undefined), isDisabled: disabled, isExternal: target === '_blank', children: [showIcon && icon && iconPosition === 'left' ? (_jsx(LinkIcon, { as: icon, style: iconStyle })) : null, _jsx(LinkText, { style: textStyle, children: children }), showIcon && icon && iconPosition === 'right' ? (_jsx(LinkIcon, { as: icon, style: iconStyle })) : null] }));
16
21
  };
17
22
  Link.displayName = 'Link';
18
23
  export default Link;
@@ -5,6 +5,8 @@ export interface LinkProps extends Omit<PressableProps, 'children'> {
5
5
  children: TextProps['children'];
6
6
  href?: string;
7
7
  target?: '_blank' | '_self' | '_parent' | '_top';
8
+ /** Defaults to `noopener noreferrer` when `target` is `_blank`. */
9
+ rel?: string;
8
10
  inverted?: boolean;
9
11
  disabled?: boolean;
10
12
  icon?: ComponentType;
@@ -1,6 +1,6 @@
1
1
  import LinkProps from './Link.props';
2
2
  declare const LinkRoot: {
3
- ({ children, inverted, states, ...props }: LinkProps & {
3
+ ({ children, inverted, states, target, rel, ...props }: LinkProps & {
4
4
  states?: {
5
5
  active?: boolean;
6
6
  disabled?: boolean;
@@ -1,13 +1,18 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { useMemo } from 'react';
3
- import { Pressable } from 'react-native';
3
+ import { Platform, Pressable } from 'react-native';
4
4
  import { StyleSheet } from 'react-native-unistyles';
5
5
  import { LinkContext } from './Link.context';
6
- const LinkRoot = ({ children, inverted = false, states, ...props }) => {
6
+ const LinkRoot = ({ children, inverted = false, states, target, rel, ...props }) => {
7
7
  const { active, disabled = false } = states || {};
8
8
  styles.useVariants({ disabled, inverted, active });
9
9
  const value = useMemo(() => ({ inverted, disabled, active }), [inverted, disabled, active]);
10
- return (_jsx(LinkContext.Provider, { value: value, children: _jsx(Pressable, { ...props, style: [styles.container, props.style], children: children }) }));
10
+ // react-native-web only applies `target`/`rel` to the rendered `<a>` via
11
+ // `hrefAttrs` - passing them as bare props is a no-op. Not typed on
12
+ // `PressableProps`, hence the spread rather than a named JSX attribute.
13
+ // Web-only prop, so it's gated to avoid an unknown-prop warning on native.
14
+ const hrefAttrsProp = Platform.OS === 'web' && (target || rel) ? { hrefAttrs: { target, rel } } : {};
15
+ return (_jsx(LinkContext.Provider, { value: value, children: _jsx(Pressable, { ...props, ...hrefAttrsProp, style: [styles.container, props.style], children: children }) }));
11
16
  };
12
17
  LinkRoot.displayName = 'LinkRoot';
13
18
  const styles = StyleSheet.create(theme => ({
@@ -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
+ container: string | undefined;
10
+ sectionHeader: {
11
+ heading: string | undefined;
12
+ helperText: string | undefined;
13
+ trailingContent: {
14
+ headerTrailingContent: figma.ResultSection[] | undefined;
15
+ } | undefined;
16
+ };
17
+ listContainer: figma.ResultSection[][];
18
+ };
19
+ };
20
+ };
21
+ export default _default;
@@ -0,0 +1,49 @@
1
+ // url=https://www.figma.com/design/6NKZXZhFSExXrcbBgc6zTR?node-id=2437%3A621
2
+ // source=https://github.com/utilitywarehouse/hearth/blob/main/packages/react-native/src/components/List/List.tsx
3
+ // component=List
4
+ import figma from 'figma';
5
+ const container = figma.selectedInstance.getEnum('Container', {
6
+ 'Subtle White': 'subtleWhite',
7
+ 'Emphasis White': 'emphasisWhite',
8
+ 'Subtle Warm White': 'subtleWarmWhite',
9
+ 'Emphasis Warm White': 'emphasisWarmWhite',
10
+ });
11
+ const sectionHeader = figma.selectedInstance.getBoolean('Section header?', {
12
+ true: (function () {
13
+ const nestedLayer0 = figma.selectedInstance.findInstance('Section Header');
14
+ return {
15
+ heading: nestedLayer0.type !== 'ERROR' ? nestedLayer0.getString('Heading') : undefined,
16
+ helperText: nestedLayer0.type !== 'ERROR'
17
+ ? nestedLayer0.getBoolean('Helper text?', {
18
+ true: nestedLayer0.getString('Helper text'),
19
+ })
20
+ : undefined,
21
+ trailingContent: nestedLayer0.type !== 'ERROR'
22
+ ? nestedLayer0.getBoolean('Trailing content?', {
23
+ true: (function () {
24
+ const nestedLayer1 = figma.selectedInstance.findInstance('Trailing content');
25
+ return {
26
+ headerTrailingContent: nestedLayer1.type !== 'ERROR'
27
+ ? nestedLayer1.getInstanceSwap('Variant')?.executeTemplate().example
28
+ : undefined,
29
+ };
30
+ })(),
31
+ })
32
+ : undefined,
33
+ };
34
+ })(),
35
+ });
36
+ const listContainer = figma.selectedInstance
37
+ .getSlot('List Container')
38
+ ?.connectedInstances.map(i => i.executeTemplate().example) ?? [];
39
+ export default {
40
+ id: 'List',
41
+ imports: ["import { List } from '@utilitywarehouse/hearth-react-native';"],
42
+ example: figma.code `<List${figma.helpers.react.renderProp('container', container)}${figma.helpers.react.renderProp('heading', sectionHeader?.heading)}${figma.helpers.react.renderProp('helperText', sectionHeader?.helperText)}${figma.helpers.react.renderProp('headerTrailingContent', sectionHeader?.trailingContent?.headerTrailingContent)}>
43
+ ${figma.helpers.react.renderChildren(listContainer.flat())}
44
+ </List>`,
45
+ metadata: {
46
+ nestable: true,
47
+ props: { container, sectionHeader, listContainer },
48
+ },
49
+ };
@@ -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;
10
+ disabled: boolean | undefined;
11
+ loading: boolean | undefined;
12
+ };
13
+ };
14
+ };
15
+ export default _default;
@@ -0,0 +1,17 @@
1
+ // url=https://www.figma.com/design/6NKZXZhFSExXrcbBgc6zTR?node-id=9661%3A5128
2
+ // source=https://github.com/utilitywarehouse/hearth/blob/main/packages/react-native/src/components/List/ListAction/ListAction.tsx
3
+ // component=ListAction
4
+ import figma from 'figma';
5
+ const heading = figma.selectedInstance.getString('Action heading');
6
+ const disabled = figma.selectedInstance.getEnum('State', {
7
+ Disabled: true,
8
+ });
9
+ const loading = figma.selectedInstance.getEnum('State', {
10
+ Loading: true,
11
+ });
12
+ export default {
13
+ id: 'ListAction',
14
+ imports: ["import { ListAction } from '@utilitywarehouse/hearth-react-native';"],
15
+ example: figma.code `<ListAction${figma.helpers.react.renderProp('heading', heading)}${figma.helpers.react.renderProp('disabled', disabled)}${figma.helpers.react.renderProp('loading', loading)}/>`,
16
+ metadata: { nestable: true, props: { heading, disabled, loading } },
17
+ };
@@ -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
+ loading: boolean | undefined;
10
+ disabled: boolean | undefined;
11
+ leadingContent: {
12
+ variant: figma.EnumOptionsValues<{
13
+ Icon: figma.ResultSection[] | undefined;
14
+ 'Icon Container': figma.ResultSection[] | undefined;
15
+ Avatar: figma.ResultSection[] | undefined;
16
+ Indicator: figma.ResultSection[] | undefined;
17
+ }>;
18
+ };
19
+ trailingContent: {
20
+ variant: figma.EnumOptionsValues<{
21
+ Link: figma.ResultSection[] | undefined;
22
+ Button: figma.ResultSection[] | undefined;
23
+ }>;
24
+ };
25
+ heading: string;
26
+ helperText: string;
27
+ badge: figma.ResultSection[] | undefined;
28
+ numericValue: string;
29
+ customContent: figma.ResultSection[][] | undefined;
30
+ };
31
+ };
32
+ };
33
+ export default _default;
@@ -0,0 +1,83 @@
1
+ // url=https://www.figma.com/design/6NKZXZhFSExXrcbBgc6zTR?node-id=2421%3A1628
2
+ // source=https://github.com/utilitywarehouse/hearth/blob/main/packages/react-native/src/components/List/ListItem/ListItem.tsx
3
+ // component=ListItem
4
+ import figma from 'figma';
5
+ const loading = figma.selectedInstance.getEnum('State', {
6
+ Loading: true,
7
+ });
8
+ const disabled = figma.selectedInstance.getEnum('State', {
9
+ Disabled: true,
10
+ });
11
+ // findLayers() returns a union that includes TextHandle, which has no executeTemplate() —
12
+ // guard on the INSTANCE type before calling it.
13
+ function executeFirstInstanceTemplate(layers) {
14
+ const layer = layers[0];
15
+ return layer && layer.type === 'INSTANCE' ? layer.executeTemplate().example : undefined;
16
+ }
17
+ const leadingContent = figma.selectedInstance.getBoolean('Leading content?', {
18
+ true: (function () {
19
+ const nestedLayer3 = figma.selectedInstance.findInstance('Leading content');
20
+ return {
21
+ variant: nestedLayer3.type !== 'ERROR'
22
+ ? nestedLayer3.getEnum('Variant', {
23
+ Icon: nestedLayer3.getInstanceSwap('Icon-24')?.executeTemplate().example,
24
+ 'Icon Container': executeFirstInstanceTemplate(nestedLayer3.findLayers(n => n.type === 'INSTANCE' && n.name === 'Icon Container')),
25
+ Avatar: executeFirstInstanceTemplate(nestedLayer3.findLayers(n => n.type === 'INSTANCE' && n.name === 'Avatar')),
26
+ Indicator: executeFirstInstanceTemplate(nestedLayer3.findLayers(n => n.type === 'INSTANCE' && n.name === 'Indicator')),
27
+ })
28
+ : undefined,
29
+ };
30
+ })(),
31
+ });
32
+ const trailingContent = figma.selectedInstance.getBoolean('Trailing Content?', {
33
+ true: (function () {
34
+ const nestedLayer4 = figma.selectedInstance.findInstance('Trailing content');
35
+ return {
36
+ variant: nestedLayer4.type !== 'ERROR'
37
+ ? nestedLayer4.getEnum('Variant', {
38
+ Link: executeFirstInstanceTemplate(nestedLayer4.findLayers(n => n.type === 'INSTANCE' && n.name === 'Link')),
39
+ Button: executeFirstInstanceTemplate(nestedLayer4.findLayers(n => n.type === 'INSTANCE' && n.name === 'Button')),
40
+ })
41
+ : undefined,
42
+ };
43
+ })(),
44
+ });
45
+ const heading = figma.selectedInstance.getString('List heading');
46
+ const helperText = figma.selectedInstance.getBoolean('Helper text?', {
47
+ true: figma.selectedInstance.getString('Helper text'),
48
+ });
49
+ const showBadge = figma.selectedInstance.getBoolean('Badge?');
50
+ const badgeInstance = figma.selectedInstance.findInstance('Badge');
51
+ const badge = showBadge && badgeInstance.type !== 'ERROR' ? badgeInstance.executeTemplate().example : undefined;
52
+ const numericValue = figma.selectedInstance.getBoolean('Numerical value?', {
53
+ true: figma.selectedInstance.getString('Numerical value'),
54
+ });
55
+ // "Slot" is a genuine slot property, only populated for the 'Custom' variant.
56
+ const customContent = figma.selectedInstance.getEnum('Variant', {
57
+ Custom: figma.selectedInstance
58
+ .getSlot('Slot')
59
+ ?.connectedInstances.map(i => i.executeTemplate().example) ?? [],
60
+ });
61
+ export default {
62
+ id: 'ListItem',
63
+ imports: ["import { ListItem } from '@utilitywarehouse/hearth-react-native';"],
64
+ example: customContent
65
+ ? figma.code `<ListItem${figma.helpers.react.renderProp('loading', loading)}${figma.helpers.react.renderProp('disabled', disabled)}>
66
+ ${figma.helpers.react.renderChildren(customContent.flat())}
67
+ </ListItem>`
68
+ : figma.code `<ListItem${figma.helpers.react.renderProp('heading', heading)}${figma.helpers.react.renderProp('helperText', helperText)}${figma.helpers.react.renderProp('badge', badge)}${figma.helpers.react.renderProp('numericValue', numericValue)}${figma.helpers.react.renderProp('loading', loading)}${figma.helpers.react.renderProp('disabled', disabled)}${figma.helpers.react.renderProp('leadingContent', leadingContent?.variant)}${figma.helpers.react.renderProp('trailingContent', trailingContent?.variant)}/>`,
69
+ metadata: {
70
+ nestable: true,
71
+ props: {
72
+ loading,
73
+ disabled,
74
+ leadingContent,
75
+ trailingContent,
76
+ heading,
77
+ helperText,
78
+ badge,
79
+ numericValue,
80
+ customContent,
81
+ },
82
+ },
83
+ };
@@ -0,0 +1,14 @@
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
+ icon: figma.InstanceHandle | figma.ErrorHandle | undefined;
11
+ };
12
+ };
13
+ };
14
+ export default _default;
@@ -0,0 +1,17 @@
1
+ // url=https://www.figma.com/design/6NKZXZhFSExXrcbBgc6zTR?node-id=6732%3A5792
2
+ // source=https://github.com/utilitywarehouse/hearth/blob/main/packages/react-native/src/components/List/ListItem/ListItemLeadingContent.tsx
3
+ // component=ListItemLeadingContent
4
+ import figma from 'figma';
5
+ const variant = figma.selectedInstance.getEnum('Variant', {
6
+ Icon: 'icon',
7
+ 'Icon Container': 'iconContainer',
8
+ Avatar: 'avatar',
9
+ Indicator: 'indicator',
10
+ });
11
+ const icon = figma.selectedInstance.getInstanceSwap('Icon-24');
12
+ export default {
13
+ id: 'ListItemLeadingContent',
14
+ imports: ["import { ListItemLeadingContent } from '@utilitywarehouse/hearth-react-native';"],
15
+ example: figma.code `<ListItemLeadingContent${figma.helpers.react.renderProp('variant', variant)} />`,
16
+ metadata: { nestable: true, props: { variant, icon } },
17
+ };
@@ -0,0 +1,13 @@
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
+ };
11
+ };
12
+ };
13
+ export default _default;
@@ -0,0 +1,14 @@
1
+ // url=https://www.figma.com/design/6NKZXZhFSExXrcbBgc6zTR?node-id=9852%3A9858
2
+ // source=https://github.com/utilitywarehouse/hearth/blob/main/packages/react-native/src/components/List/ListItem/ListItemTrailingContent.tsx
3
+ // component=ListItemTrailingContent
4
+ import figma from 'figma';
5
+ const variant = figma.selectedInstance.getEnum('Variant', {
6
+ Link: 'link',
7
+ Button: 'button',
8
+ });
9
+ export default {
10
+ id: 'ListItemTrailingContent',
11
+ imports: ["import { ListItemTrailingContent } from '@utilitywarehouse/hearth-react-native';"],
12
+ example: figma.code `<ListItemTrailingContent${figma.helpers.react.renderProp('variant', variant)} />`,
13
+ metadata: { nestable: true, props: { variant } },
14
+ };
@@ -0,0 +1,14 @@
1
+ import figma from 'figma';
2
+ declare const _default: {
3
+ id: string;
4
+ imports: string[];
5
+ example: figma.TemplateStringResult;
6
+ metadata: {
7
+ props: {
8
+ heading: string;
9
+ showHandle: boolean;
10
+ menuItems: figma.ResultSection[][];
11
+ };
12
+ };
13
+ };
14
+ export default _default;
@@ -0,0 +1,33 @@
1
+ // url=https://www.figma.com/design/6NKZXZhFSExXrcbBgc6zTR?node-id=3263%3A18832
2
+ // source=https://github.com/utilitywarehouse/hearth/blob/main/packages/react-native/src/components/Menu/Menu.tsx
3
+ // component=Menu
4
+ import figma from 'figma';
5
+ const heading = figma.selectedInstance.getBoolean('Heading?', {
6
+ true: figma.selectedInstance.getString('Heading'),
7
+ });
8
+ const showHandle = figma.selectedInstance.getBoolean('Grabber?', {
9
+ true: true,
10
+ });
11
+ const menuItemLayers = figma.selectedInstance.findConnectedInstances(n => n.hasCodeConnect());
12
+ const menuItems = menuItemLayers.map(layer => layer.executeTemplate().example) ?? [];
13
+ export default {
14
+ id: 'Menu',
15
+ imports: [
16
+ "import { Button, Menu, MenuTrigger } from '@utilitywarehouse/hearth-react-native';",
17
+ "import { useRef } from 'react';",
18
+ ],
19
+ example: figma.code `function Example() {
20
+ const menuRef = useRef(null);
21
+ return (<>
22
+ <MenuTrigger onPress={() => menuRef.current?.present()}>
23
+ <Button>Open Menu</Button>
24
+ </MenuTrigger>
25
+ <Menu ref={menuRef}${figma.helpers.react.renderProp('heading', heading)}${figma.helpers.react.renderProp('showHandle', showHandle)}>
26
+ ${figma.helpers.react.renderChildren(menuItems.flat())}
27
+ </Menu>
28
+ </>);
29
+ }`,
30
+ metadata: {
31
+ props: { heading, showHandle, menuItems },
32
+ },
33
+ };
@@ -0,0 +1,29 @@
1
+ import figma from 'figma';
2
+ declare const _default: {
3
+ id: string;
4
+ imports: string[];
5
+ example: figma.TemplateStringResult;
6
+ metadata: {
7
+ props: {
8
+ text: string;
9
+ icon: {
10
+ $value: string;
11
+ $type: "react-component";
12
+ } | undefined;
13
+ iconPosition: string;
14
+ colorScheme: figma.EnumOptionsValues<{
15
+ Destructive: string;
16
+ Functional: undefined;
17
+ }>;
18
+ disabled: figma.EnumOptionsValues<{
19
+ Disabled: boolean;
20
+ Default: undefined;
21
+ Hover: undefined;
22
+ Active: undefined;
23
+ Focus: undefined;
24
+ }>;
25
+ };
26
+ nestable: boolean;
27
+ };
28
+ };
29
+ export default _default;
@@ -0,0 +1,45 @@
1
+ // url=https://www.figma.com/design/6NKZXZhFSExXrcbBgc6zTR/Hearth-Components---Tokens?node-id=3253-8193
2
+ // source=https://github.com/utilitywarehouse/hearth/blob/main/packages/react-native/src/components/Menu/MenuItem.tsx
3
+ // component=MenuItem
4
+ import figma from 'figma';
5
+ const text = figma.selectedInstance.getString('Text');
6
+ const iconName = figma.selectedInstance.getBoolean('Icon left?', {
7
+ true: figma.selectedInstance.getInstanceSwap('Icon left-20')?.executeTemplate().metadata?.props
8
+ ?.componentName,
9
+ false: figma.selectedInstance.getBoolean('Icon right?', {
10
+ true: figma.selectedInstance.getInstanceSwap('Icon right-20')?.executeTemplate().metadata?.props
11
+ ?.componentName,
12
+ }),
13
+ });
14
+ const icon = iconName ? figma.helpers.react.reactComponent(iconName) : undefined;
15
+ const iconPosition = figma.selectedInstance.getBoolean('Icon left?', {
16
+ true: 'left',
17
+ false: figma.selectedInstance.getBoolean('Icon right?', {
18
+ true: 'right',
19
+ }),
20
+ });
21
+ const colorScheme = figma.selectedInstance.getEnum('Color Scheme', {
22
+ Destructive: 'destructive',
23
+ Functional: undefined,
24
+ });
25
+ const disabled = figma.selectedInstance.getEnum('State', {
26
+ Disabled: true,
27
+ Default: undefined,
28
+ Hover: undefined,
29
+ Active: undefined,
30
+ Focus: undefined,
31
+ });
32
+ export default {
33
+ id: 'MenuItem',
34
+ imports: [
35
+ "import { MenuItem } from '@utilitywarehouse/hearth-react-native';",
36
+ ...(iconName
37
+ ? [`import { ${iconName} } from '@utilitywarehouse/hearth-react-native-icons';`]
38
+ : []),
39
+ ],
40
+ example: figma.code `<MenuItem${figma.helpers.react.renderProp('text', text)}${figma.helpers.react.renderProp('disabled', disabled)}${figma.helpers.react.renderProp('colorScheme', colorScheme)}${figma.helpers.react.renderProp('icon', icon)}${figma.helpers.react.renderProp('iconPosition', iconPosition)}/>`,
41
+ metadata: {
42
+ props: { text, icon, iconPosition, colorScheme, disabled },
43
+ nestable: true,
44
+ },
45
+ };
@@ -0,0 +1,24 @@
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
+ loading: boolean | undefined;
10
+ heading: string;
11
+ description: string;
12
+ fullscreen: boolean;
13
+ showHandle: boolean;
14
+ close: boolean;
15
+ image: figma.ResultSection[] | undefined;
16
+ loadingHeading: string;
17
+ slotContent: figma.ResultSection[][];
18
+ buttons: {
19
+ primaryButtonText: string | undefined;
20
+ };
21
+ };
22
+ };
23
+ };
24
+ export default _default;