@utilitywarehouse/hearth-react-native 0.19.0 → 0.20.0

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 (54) hide show
  1. package/.storybook/preview.tsx +1 -0
  2. package/.turbo/turbo-build.log +1 -1
  3. package/.turbo/turbo-lint.log +16 -16
  4. package/CHANGELOG.md +74 -2
  5. package/build/components/Menu/Menu.d.ts +1 -1
  6. package/build/components/Menu/Menu.js +2 -2
  7. package/build/components/Menu/Menu.props.d.ts +2 -6
  8. package/build/components/Modal/Modal.d.ts +1 -1
  9. package/build/components/Modal/Modal.js +2 -2
  10. package/build/components/Modal/Modal.props.d.ts +1 -0
  11. package/build/components/Modal/Modal.web.d.ts +1 -1
  12. package/build/components/Modal/Modal.web.js +2 -2
  13. package/build/components/Select/Select.d.ts +1 -1
  14. package/build/components/Select/Select.js +9 -10
  15. package/build/components/Select/Select.props.d.ts +16 -0
  16. package/build/components/Toast/ToastItem.js +3 -1
  17. package/docs/changelog.mdx +687 -0
  18. package/package.json +6 -6
  19. package/scripts/copyChangelog.js +50 -0
  20. package/src/components/Checkbox/CheckboxGroup.figma.tsx +21 -1
  21. package/src/components/Menu/Menu.docs.mdx +8 -5
  22. package/src/components/Menu/Menu.figma.tsx +27 -27
  23. package/src/components/Menu/Menu.props.ts +2 -6
  24. package/src/components/Menu/Menu.tsx +3 -6
  25. package/src/components/Menu/MenuItem.figma.tsx +26 -18
  26. package/src/components/Modal/Modal.docs.mdx +22 -21
  27. package/src/components/Modal/Modal.figma.tsx +58 -47
  28. package/src/components/Modal/Modal.props.ts +1 -0
  29. package/src/components/Modal/Modal.stories.tsx +4 -0
  30. package/src/components/Modal/Modal.tsx +2 -1
  31. package/src/components/Modal/Modal.web.tsx +2 -1
  32. package/src/components/PillGroup/Pill.figma.tsx +4 -17
  33. package/src/components/PillGroup/PillGroup.figma.tsx +8 -9
  34. package/src/components/ProgressStepper/ProgressStep.figma.tsx +4 -15
  35. package/src/components/ProgressStepper/ProgressStepper.figma.tsx +9 -16
  36. package/src/components/Radio/Radio.figma.tsx +35 -22
  37. package/src/components/Radio/RadioGroup.figma.tsx +69 -41
  38. package/src/components/Radio/RadioTile.figma.tsx +34 -0
  39. package/src/components/RadioCard/RadioCard.figma.tsx +24 -0
  40. package/src/components/SectionHeader/SectionHeader.figma.tsx +31 -25
  41. package/src/components/Select/Select.docs.mdx +76 -28
  42. package/src/components/Select/Select.figma.tsx +44 -43
  43. package/src/components/Select/Select.props.ts +16 -0
  44. package/src/components/Select/Select.tsx +42 -35
  45. package/src/components/Select/SelectOption.figma.tsx +3 -21
  46. package/src/components/Spinner/Spinner.figma.tsx +12 -25
  47. package/src/components/Switch/Switch.figma.tsx +2 -23
  48. package/src/components/Tabs/Tab.figma.tsx +21 -0
  49. package/src/components/Tabs/Tabs.figma.tsx +18 -27
  50. package/src/components/Textarea/Textarea.figma.tsx +64 -0
  51. package/src/components/Toast/ToastItem.tsx +3 -1
  52. package/src/components/ToggleButtonCard/ToggleButtonCard.figma.tsx +24 -0
  53. package/src/components/VerificationInput/VerificationInput.figma.tsx +53 -0
  54. package/src/components/Radio/RadioTileRoot.figma.tsx +0 -31
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@utilitywarehouse/hearth-react-native",
3
- "version": "0.19.0",
3
+ "version": "0.20.0",
4
4
  "description": "Utility Warehouse React Native UI library",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",
@@ -56,10 +56,10 @@
56
56
  "vite-plugin-svgr": "^4.5.0",
57
57
  "vitest": "^3.2.4",
58
58
  "@utilitywarehouse/hearth-fonts": "^0.0.4",
59
+ "@utilitywarehouse/hearth-tokens": "^0.2.2",
59
60
  "@utilitywarehouse/hearth-react-icons": "^0.8.0",
60
61
  "@utilitywarehouse/hearth-react-native-icons": "^0.8.0",
61
- "@utilitywarehouse/hearth-svg-assets": "^0.3.0",
62
- "@utilitywarehouse/hearth-tokens": "^0.2.2"
62
+ "@utilitywarehouse/hearth-svg-assets": "^0.3.0"
63
63
  },
64
64
  "peerDependencies": {
65
65
  "@gorhom/bottom-sheet": "^5.0.0",
@@ -76,6 +76,7 @@
76
76
  "clean": "rm -rf node_modules rm -rf build .turbo",
77
77
  "generateColours": "node ./scripts/generateColours.js",
78
78
  "copyTokens": "node ./scripts/copyTokens.js",
79
+ "copyChangelog": "node ./scripts/copyChangelog.js",
79
80
  "lint:fix": "TIMING=1 eslint --fix .",
80
81
  "lint": "TIMING=1 eslint .",
81
82
  "build": "tsc",
@@ -83,9 +84,8 @@
83
84
  "figma:create": "figma connect create",
84
85
  "figma:publish": "figma connect publish",
85
86
  "test": "echo \"Error: no test specified\" && exit 1",
86
- "dev": "storybook dev -p 6006",
87
- "build:storybook": "storybook build",
88
- "build-storybook": "storybook build",
87
+ "dev": "npm run copyChangelog && storybook dev -p 6006",
88
+ "build:storybook": "npm run copyChangelog && storybook build",
89
89
  "chromatic": "npx chromatic --project-token=chpt_cce0fb1ebd95d2a --build-script-name build:storybook"
90
90
  }
91
91
  }
@@ -0,0 +1,50 @@
1
+ /**
2
+ * Script to copy CHANGELOG.md to docs folder and convert it to changelog.mdx
3
+ * with proper Meta and BackToTopButton components
4
+ */
5
+
6
+ import fs from 'fs';
7
+ import path from 'path';
8
+ import { fileURLToPath } from 'url';
9
+
10
+ // Get the directory name in ES modules
11
+ const __filename = fileURLToPath(import.meta.url);
12
+ const __dirname = path.dirname(__filename);
13
+
14
+ // Define paths
15
+ const sourceFile = path.resolve(__dirname, '../CHANGELOG.md');
16
+ const targetFile = path.resolve(__dirname, '../docs/changelog.mdx');
17
+
18
+ // Read the changelog content
19
+ console.log('Reading CHANGELOG.md...');
20
+ if (!fs.existsSync(sourceFile)) {
21
+ console.error('Error: CHANGELOG.md not found at', sourceFile);
22
+ process.exit(1);
23
+ }
24
+
25
+ let changelogContent = fs.readFileSync(sourceFile, 'utf-8');
26
+
27
+ // Remove the first line (package name heading)
28
+ changelogContent = changelogContent.split('\n').slice(1).join('\n');
29
+
30
+ // Create the MDX content with imports and components
31
+ const mdxContent = `import { Meta } from '@storybook/addon-docs/blocks';
32
+ import { BackToTopButton } from './components';
33
+
34
+ <Meta title="Changelog" />
35
+ <BackToTopButton />
36
+
37
+ # Changelog - ${'`@utilitywarehouse/hearth-react-native`'}
38
+
39
+ The changelog for the Hearth React Native library. Here you can find all the changes, improvements, and bug fixes for each version.
40
+
41
+ ${changelogContent}
42
+ `;
43
+
44
+ // Write the new MDX file
45
+ console.log('Writing changelog.mdx...');
46
+ fs.writeFileSync(targetFile, mdxContent);
47
+
48
+ console.log('✅ Changelog copied and transformed successfully!');
49
+ console.log(` Source: ${sourceFile}`);
50
+ console.log(` Target: ${targetFile}`);
@@ -3,6 +3,10 @@ import { CheckboxGroup } from '../';
3
3
 
4
4
  const props = {
5
5
  label: figma.string('Group label'),
6
+ labelVariant: figma.enum('Label variant', {
7
+ Heading: 'heading',
8
+ Body: 'body',
9
+ }),
6
10
  helperText: figma.boolean('Helper text?', {
7
11
  true: figma.string('Helper text'),
8
12
  false: undefined,
@@ -13,6 +17,12 @@ const props = {
13
17
  }),
14
18
  tiles: figma.children('Checkbox Tile'),
15
19
  checkboxes: figma.children('Checkbox'),
20
+ validationStatus: figma.enum('State', {
21
+ Invalid: 'invalid',
22
+ }),
23
+ invalidText: figma.enum('State', {
24
+ Invalid: figma.string('Validation text'),
25
+ }),
16
26
  };
17
27
 
18
28
  figma.connect(
@@ -27,8 +37,11 @@ figma.connect(
27
37
  <CheckboxGroup
28
38
  type="tile"
29
39
  label={props.label}
40
+ labelVariant={props.labelVariant}
30
41
  helperText={props.helperText}
31
42
  direction={props.direction}
43
+ validationStatus={props.validationStatus}
44
+ invalidText={props.invalidText}
32
45
  >
33
46
  {props.tiles}
34
47
  </CheckboxGroup>
@@ -45,7 +58,14 @@ figma.connect(
45
58
  },
46
59
  props,
47
60
  example: props => (
48
- <CheckboxGroup label={props.label} helperText={props.helperText} direction={props.direction}>
61
+ <CheckboxGroup
62
+ label={props.label}
63
+ labelVariant={props.labelVariant}
64
+ helperText={props.helperText}
65
+ direction={props.direction}
66
+ validationStatus={props.validationStatus}
67
+ invalidText={props.invalidText}
68
+ >
49
69
  {props.checkboxes}
50
70
  </CheckboxGroup>
51
71
  ),
@@ -67,11 +67,14 @@ const MyComponent = () => {
67
67
 
68
68
  ### Menu
69
69
 
70
- | Prop | Type | Default | Description |
71
- | ------------------ | -------------------------------- | ------- | --------------------------------------------------- |
72
- | `heading` | `string` | - | Heading text displayed at the top of the menu |
73
- | `children` | `ReactNode` | - | Menu items to display |
74
- | `bottomSheetProps` | `Partial<BottomSheetModalProps>` | - | Optional bottom sheet modal props for customization |
70
+ | Prop | Type | Default | Description |
71
+ | ---------- | ----------- | ------- | --------------------------------------------- |
72
+ | `heading` | `string` | - | Heading text displayed at the top of the menu |
73
+ | `children` | `ReactNode` | - | Menu items to display |
74
+
75
+ The rest of the props are passed down to the underlying `BottomSheetModal` component, so you can use any of its
76
+ props for additional configuration (e.g. `snapPoints`, `backgroundStyle`, etc.).
77
+ See the [BottomSheetModal docs](/?path=/docs/components-bottomsheet--docs) for more details.
75
78
 
76
79
  ### MenuItem
77
80
 
@@ -1,30 +1,30 @@
1
- import React from "react"
2
- import Menu from "./Menu"
3
- import figma from "@figma/code-connect"
1
+ import figma from '@figma/code-connect';
2
+ import { useRef } from 'react';
3
+ import { Button, Menu, MenuTrigger } from '../';
4
4
 
5
- /**
6
- * -- This file was auto-generated by Code Connect --
7
- * `props` includes a mapping from your code props to Figma properties.
8
- * You should check this is correct, and update the `example` function
9
- * to return the code example you'd like to see in Figma
10
- */
5
+ figma.connect(Menu, 'https://www.figma.com/design/6NKZXZhFSExXrcbBgc6zTR?node-id=3263%3A18832', {
6
+ props: {
7
+ menuItems: figma.children('Menu Item'),
8
+ heading: figma.boolean('Heading?', {
9
+ true: figma.string('Heading'),
10
+ }),
11
+ showHandle: figma.boolean('Grabber?', {
12
+ true: true,
13
+ }),
14
+ },
15
+ example: props => {
16
+ const menuRef = useRef(null);
17
+
18
+ return (
19
+ <>
20
+ <MenuTrigger onPress={() => menuRef.current?.present()}>
21
+ <Button>Open Menu</Button>
22
+ </MenuTrigger>
11
23
 
12
- figma.connect(
13
- Menu,
14
- "https://www.figma.com/design/6NKZXZhFSExXrcbBgc6zTR?node-id=3263%3A18832",
15
- {
16
- props: {
17
- // These props were automatically mapped based on your linked code:
18
- heading: figma.string("Heading"),
19
- // No matching props could be found for these Figma properties:
20
- // "heading": figma.string('Heading'),
21
- // "heading": figma.boolean('Heading?'),
22
- // "grabber": figma.boolean('Grabber?'),
23
- // "deviceType": figma.enum('Device type', {
24
- // "Web": "web",
25
- // "App": "app"
26
- // })
27
- },
28
- example: (props) => <Menu heading={props.heading} />,
24
+ <Menu ref={menuRef} heading={props.heading} showHandle={props.showHandle}>
25
+ {props.menuItems}
26
+ </Menu>
27
+ </>
28
+ );
29
29
  },
30
- )
30
+ });
@@ -1,12 +1,12 @@
1
- import type { BottomSheetModalProps } from '@gorhom/bottom-sheet';
2
1
  import type { ReactNode } from 'react';
2
+ import { BottomSheetProps } from '../BottomSheet';
3
3
 
4
4
  export interface MenuMethods {
5
5
  present: () => void;
6
6
  dismiss: () => void;
7
7
  }
8
8
 
9
- export interface MenuProps {
9
+ export interface MenuProps extends BottomSheetProps {
10
10
  /**
11
11
  * Heading text displayed at the top of the menu
12
12
  */
@@ -15,10 +15,6 @@ export interface MenuProps {
15
15
  * Menu items to display
16
16
  */
17
17
  children: ReactNode;
18
- /**
19
- * Optional bottom sheet modal props to customise the menu behavior
20
- */
21
- bottomSheetProps?: Partial<BottomSheetModalProps>;
22
18
  }
23
19
 
24
20
  export default MenuProps;
@@ -1,12 +1,12 @@
1
1
  import { forwardRef, useCallback, useImperativeHandle, useMemo, useRef } from 'react';
2
2
  import { StyleSheet } from 'react-native-unistyles';
3
3
  import { BodyText } from '../BodyText';
4
- import { BottomSheetModal, BottomSheetProps, BottomSheetScrollView } from '../BottomSheet';
4
+ import { BottomSheetModal, BottomSheetScrollView } from '../BottomSheet';
5
5
  import { MenuContext } from './Menu.context';
6
6
  import type MenuProps from './Menu.props';
7
7
  import type { MenuMethods } from './Menu.props';
8
8
 
9
- const Menu = forwardRef<MenuMethods, MenuProps>(({ heading, children, bottomSheetProps }, ref) => {
9
+ const Menu = forwardRef<MenuMethods, MenuProps>(({ heading, children, ...props }, ref) => {
10
10
  const bottomSheetModalRef = useRef<BottomSheetModal>(null);
11
11
 
12
12
  useImperativeHandle(
@@ -25,10 +25,7 @@ const Menu = forwardRef<MenuMethods, MenuProps>(({ heading, children, bottomShee
25
25
  const contextValue = useMemo(() => ({ close: handleClose }), [handleClose]);
26
26
 
27
27
  return (
28
- <BottomSheetModal
29
- ref={bottomSheetModalRef}
30
- {...(bottomSheetProps as Partial<BottomSheetProps>)}
31
- >
28
+ <BottomSheetModal ref={bottomSheetModalRef} {...props}>
32
29
  <BottomSheetScrollView contentContainerStyle={styles.container}>
33
30
  <MenuContext.Provider value={contextValue}>
34
31
  {heading && (
@@ -1,31 +1,39 @@
1
1
  import figma from '@figma/code-connect';
2
- import MenuItem from './MenuItem';
3
-
4
- /**
5
- * -- This file was auto-generated by Code Connect --
6
- * `props` includes a mapping from your code props to Figma properties.
7
- * You should check this is correct, and update the `example` function
8
- * to return the code example you'd like to see in Figma
9
- */
2
+ import { MenuItem } from '../';
10
3
 
11
4
  figma.connect(
12
5
  MenuItem,
13
- 'https://www.figma.com/design/6NKZXZhFSExXrcbBgc6zTR?node-id=6416%3A11142',
6
+ 'https://www.figma.com/design/6NKZXZhFSExXrcbBgc6zTR/Hearth-Components---Tokens?node-id=3253-8193',
14
7
  {
15
8
  props: {
16
- // These props were automatically mapped based on your linked code:
17
- disabled: figma.enum('State', {
18
- Active: true,
9
+ text: figma.string('Text'),
10
+ icon: figma.boolean('Icon left?', {
11
+ true: figma.instance('Icon left-20'),
12
+ false: figma.boolean('Icon right?', {
13
+ true: figma.instance('Icon right-20'),
14
+ }),
15
+ }),
16
+ iconPosition: figma.boolean('Icon left?', {
17
+ true: 'left',
18
+ false: figma.boolean('Icon right?', {
19
+ true: 'right',
20
+ }),
19
21
  }),
20
- focusable: figma.enum('State', {
21
- Focus: true,
22
+ colorScheme: figma.enum('Color Scheme', {
23
+ Destructive: 'destructive',
24
+ }),
25
+ disabled: figma.enum('State', {
26
+ Disabled: true,
22
27
  }),
23
- // No matching props could be found for these Figma properties:
24
- // "number": figma.string('Number'),
25
- // "selected": figma.boolean('Selected?')
26
28
  },
27
29
  example: props => (
28
- <MenuItem text={null} disabled={props.disabled} focusable={props.focusable} />
30
+ <MenuItem
31
+ text={props.text}
32
+ disabled={props.disabled}
33
+ colorScheme={props.colorScheme}
34
+ icon={props.icon}
35
+ iconPosition={props.iconPosition}
36
+ />
29
37
  ),
30
38
  }
31
39
  );
@@ -87,27 +87,28 @@ const MyComponent = () => {
87
87
 
88
88
  The Modal component extends the `BottomSheetModal` component and accepts all of its props, plus the following additional props:
89
89
 
90
- | Property | Type | Description | Default |
91
- | ----------------------------- | ------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------- | ------- |
92
- | `heading` | `string` | The heading text displayed at the top of the modal | - |
93
- | `description` | `string` | The description text displayed below the heading | - |
94
- | `showCloseButton` | `boolean` | Whether to show the close button in the top-right corner | `true` |
95
- | `primaryButtonText` | `string` | Text for the primary action button | - |
96
- | `secondaryButtonText` | `string` | Text for the secondary action button | - |
97
- | `onPressPrimaryButton` | `() => void` | Callback function called when the primary button is pressed | - |
98
- | `onPressSecondaryButton` | `() => void` | Callback function called when the secondary button is pressed | - |
99
- | `onPressCloseButton` | `() => void` | Callback function called when the close button is pressed | - |
100
- | `closeOnPrimaryButtonPress` | `boolean` | Whether to automatically close the modal when the primary button is pressed | `true` |
101
- | `closeOnSecondaryButtonPress` | `boolean` | Whether to automatically close the modal when the secondary button is pressed | `true` |
102
- | `onChange` | `(index: number, position: number, `<br />` type: number) => void` | Callback function called when the modal's position changes \* | - |
103
- | `loading` | `boolean` | Whether to show a loading state with spinner | `false` |
104
- | `image` | `ImageProps` | Image to display in the modal (shows as centered content with text below) | - |
105
- | `children` | `ReactNode` | Custom content to display in the modal body | - |
106
- | `primaryButtonProps` | `Omit<ButtonWithoutChildrenProps, 'children'>` | Additional props to pass to the primary button (colorScheme defaults to 'highlight', variant to 'solid') | - |
107
- | `secondaryButtonProps` | `Omit<ButtonWithoutChildrenProps, 'children'>` | Additional props to pass to the secondary button (colorScheme defaults to 'functional', variant to 'outline') | - |
108
- | `closeButtonProps` | `Omit<UnstyledIconButtonProps, 'children'>` | Additional props to pass to the close button | - |
109
- | `fullscreen` | `boolean` | Whether the modal should take up the full screen height | `false` |
110
- | `inNavModal` | `boolean` | Renders the modal correctly when used inside a navigation modal | `false` |
90
+ | Property | Type | Description | Default |
91
+ | ----------------------------- | ------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------- | -------------- |
92
+ | `heading` | `string` | The heading text displayed at the top of the modal | - |
93
+ | `description` | `string` | The description text displayed below the heading | - |
94
+ | `showCloseButton` | `boolean` | Whether to show the close button in the top-right corner | `true` |
95
+ | `primaryButtonText` | `string` | Text for the primary action button | - |
96
+ | `secondaryButtonText` | `string` | Text for the secondary action button | - |
97
+ | `onPressPrimaryButton` | `() => void` | Callback function called when the primary button is pressed | - |
98
+ | `onPressSecondaryButton` | `() => void` | Callback function called when the secondary button is pressed | - |
99
+ | `onPressCloseButton` | `() => void` | Callback function called when the close button is pressed | - |
100
+ | `closeOnPrimaryButtonPress` | `boolean` | Whether to automatically close the modal when the primary button is pressed | `true` |
101
+ | `closeOnSecondaryButtonPress` | `boolean` | Whether to automatically close the modal when the secondary button is pressed | `true` |
102
+ | `onChange` | `(index: number, position: number, `<br />` type: number) => void` | Callback function called when the modal's position changes \* | - |
103
+ | `loading` | `boolean` | Whether to show a loading state with spinner | `false` |
104
+ | `loadingHeading` | `string` | The heading text to be displayed when loading is true. If not provided, the regular heading will be shown. | `'Loading...'` |
105
+ | `image` | `ImageProps` | Image to display in the modal (shows as centered content with text below) | - |
106
+ | `children` | `ReactNode` | Custom content to display in the modal body | - |
107
+ | `primaryButtonProps` | `Omit<ButtonWithoutChildrenProps, 'children'>` | Additional props to pass to the primary button (colorScheme defaults to 'highlight', variant to 'solid') | - |
108
+ | `secondaryButtonProps` | `Omit<ButtonWithoutChildrenProps, 'children'>` | Additional props to pass to the secondary button (colorScheme defaults to 'functional', variant to 'outline') | - |
109
+ | `closeButtonProps` | `Omit<UnstyledIconButtonProps, 'children'>` | Additional props to pass to the close button | - |
110
+ | `fullscreen` | `boolean` | Whether the modal should take up the full screen height | `false` |
111
+ | `inNavModal` | `boolean` | Renders the modal correctly when used inside a navigation modal | `false` |
111
112
 
112
113
  \* use this to detect if the modal has been opened or closed, index 0 indicates open state and -1 indicates closed state
113
114
 
@@ -1,56 +1,67 @@
1
- import React from "react"
2
- import Modal from "./Modal"
3
- import figma from "@figma/code-connect"
4
-
5
- /**
6
- * -- This file was auto-generated by Code Connect --
7
- * `props` includes a mapping from your code props to Figma properties.
8
- * You should check this is correct, and update the `example` function
9
- * to return the code example you'd like to see in Figma
10
- */
1
+ import figma from '@figma/code-connect';
2
+ import { useCallback, useRef } from 'react';
3
+ import { BottomSheetModal, Button, Modal } from '../';
11
4
 
12
5
  figma.connect(
13
6
  Modal,
14
- "https://www.figma.com/design/6NKZXZhFSExXrcbBgc6zTR?node-id=6300%3A2825",
7
+ 'https://www.figma.com/design/6NKZXZhFSExXrcbBgc6zTR/Hearth-Components---Tokens?node-id=6300-2825',
15
8
  {
16
9
  props: {
17
- // These props were automatically mapped based on your linked code:
18
- loading: figma.enum("State", {
10
+ loading: figma.enum('State', {
19
11
  Loading: true,
20
12
  }),
21
- image: figma.enum("Image?", {
22
- False: false,
23
- True: true,
13
+ heading: figma.string('Heading'),
14
+ description: figma.string('Description'),
15
+ fullscreen: figma.boolean('Full screen?'),
16
+ showHandle: figma.boolean('Handle?'),
17
+ customContent: figma.boolean('Custom content?', {
18
+ true: figma.instance('Custom content'),
19
+ }),
20
+ buttons: figma.boolean('Buttons?', {
21
+ true: figma.nestedProps('Button', {
22
+ primaryButtonText: figma.string('Text'),
23
+ }),
24
24
  }),
25
- heading: figma.string("Heading"),
26
- description: figma.string("Description"),
27
- fullscreen: figma.boolean("Full screen?"),
28
- showHandle: figma.boolean("Handle?"),
29
- // No matching props could be found for these Figma properties:
30
- // "heading": figma.string('Heading'),
31
- // "description": figma.string('Description'),
32
- // "customContent": figma.boolean('Custom content?'),
33
- // "buttons": figma.boolean('Buttons?'),
34
- // "close": figma.boolean('Close?'),
35
- // "customContent": figma.instance('Custom content'),
36
- // "homeIndicator": figma.boolean('Home indicator?'),
37
- // "handle": figma.boolean('Handle?'),
38
- // "loadingHeading": figma.string('Loading heading'),
39
- // "deviceType": figma.enum('Device type', {
40
- // "Desktop": "desktop",
41
- // "Tablet": "tablet",
42
- // "Mobile": "mobile"
43
- // })
25
+ close: figma.boolean('Close?'),
26
+ image: figma.boolean('Image?', {
27
+ true: figma.instance('Modal illustration'),
28
+ }),
29
+ loadingHeading: figma.string('Loading heading'),
30
+ },
31
+ example: props => {
32
+ const modalRef = useRef<BottomSheetModal>(null);
33
+
34
+ const handleOpenModal = useCallback(() => {
35
+ modalRef.current?.present();
36
+ }, []);
37
+
38
+ const handleCloseModal = useCallback(() => {
39
+ modalRef.current?.dismiss();
40
+ }, []);
41
+
42
+ return (
43
+ <>
44
+ <Button onPress={handleOpenModal}>Open Modal</Button>
45
+
46
+ <Modal
47
+ ref={modalRef}
48
+ heading={props.heading}
49
+ description={props.description}
50
+ loading={props.loading}
51
+ loadingHeading={props.loadingHeading}
52
+ showCloseButton={props.close}
53
+ fullscreen={props.fullscreen}
54
+ image={props.image}
55
+ showHandle={props.showHandle}
56
+ primaryButtonText={props.buttons.primaryButtonText}
57
+ secondaryButtonText={props.buttons.primaryButtonText}
58
+ onPressPrimaryButton={handleCloseModal}
59
+ onPressSecondaryButton={handleCloseModal}
60
+ >
61
+ {props.customContent}
62
+ </Modal>
63
+ </>
64
+ );
44
65
  },
45
- example: (props) => (
46
- <Modal
47
- loading={props.loading}
48
- image={props.image}
49
- heading={props.heading}
50
- description={props.description}
51
- fullscreen={props.fullscreen}
52
- showHandle={props.showHandle}
53
- />
54
- ),
55
- },
56
- )
66
+ }
67
+ );
@@ -9,6 +9,7 @@ interface ModalProps extends Omit<BottomSheetProps, 'children'> {
9
9
  image?: ReactNode;
10
10
  showCloseButton?: boolean;
11
11
  heading?: string;
12
+ loadingHeading?: string;
12
13
  description?: string;
13
14
  inNavModal?: boolean;
14
15
  fullscreen?: boolean;
@@ -41,6 +41,10 @@ const meta = {
41
41
  control: 'boolean',
42
42
  description: 'Whether the modal is in a loading state.',
43
43
  },
44
+ loadingHeading: {
45
+ control: 'text',
46
+ description: 'The heading text to be displayed when loading is true.',
47
+ },
44
48
  fullscreen: {
45
49
  control: 'boolean',
46
50
  description: 'Whether the modal should take up the full screen height.',
@@ -42,6 +42,7 @@ const Modal = ({
42
42
  closeOnPrimaryButtonPress = true,
43
43
  closeOnSecondaryButtonPress = true,
44
44
  loading,
45
+ loadingHeading = 'Loading...',
45
46
  fullscreen = false,
46
47
  image,
47
48
  primaryButtonProps,
@@ -206,7 +207,7 @@ const Modal = ({
206
207
  >
207
208
  <Spinner size="lg" />
208
209
  <Heading size="lg" textAlign="center">
209
- Loading...
210
+ {loadingHeading}
210
211
  </Heading>
211
212
  </View>
212
213
  ) : (
@@ -37,6 +37,7 @@ const Modal = ({
37
37
  closeOnPrimaryButtonPress = true,
38
38
  closeOnSecondaryButtonPress = true,
39
39
  loading,
40
+ loadingHeading = 'Loading...',
40
41
  image,
41
42
  primaryButtonProps,
42
43
  secondaryButtonProps,
@@ -166,7 +167,7 @@ const Modal = ({
166
167
  >
167
168
  <Spinner size="lg" />
168
169
  <Heading size="lg" textAlign="center">
169
- Loading...
170
+ {loadingHeading}
170
171
  </Heading>
171
172
  </View>
172
173
  ) : (
@@ -1,25 +1,12 @@
1
1
  import figma from '@figma/code-connect';
2
- import { Pill } from './Pill';
3
-
4
- /**
5
- * -- This file was auto-generated by Code Connect --
6
- * `props` includes a mapping from your code props to Figma properties.
7
- * You should check this is correct, and update the `example` function
8
- * to return the code example you'd like to see in Figma
9
- */
2
+ import { Pill } from '../';
10
3
 
11
4
  figma.connect(Pill, 'https://www.figma.com/design/6NKZXZhFSExXrcbBgc6zTR?node-id=4348%3A15595', {
12
5
  props: {
13
- // These props were automatically mapped based on your linked code:
14
6
  label: figma.string('Label'),
15
- focusable: figma.enum('State', {
16
- Focus: true,
7
+ icon: figma.boolean('Icon?', {
8
+ true: figma.instance('Icon-20'),
17
9
  }),
18
- // No matching props could be found for these Figma properties:
19
- // "label": figma.string('Label'),
20
- // "icon": figma.boolean('Icon?'),
21
- // "icon20": figma.instance('Icon-20'),
22
- // "selected": figma.boolean('Selected?')
23
10
  },
24
- example: props => <Pill value={null} label={props.label} focusable={props.focusable} />,
11
+ example: props => <Pill value={props.label} label={props.label} />,
25
12
  });
@@ -1,21 +1,20 @@
1
1
  import figma from '@figma/code-connect';
2
- import { PillGroup } from './PillGroup';
2
+ import { PillGroup } from '../';
3
3
 
4
- /**
5
- * -- This file was auto-generated by Code Connect --
6
- * `props` includes a mapping from your code props to Figma properties.
7
- * You should check this is correct, and update the `example` function
8
- * to return the code example you'd like to see in Figma
9
- */
4
+ const value = '';
10
5
 
11
6
  figma.connect(
12
7
  PillGroup,
13
8
  'https://www.figma.com/design/6NKZXZhFSExXrcbBgc6zTR?node-id=4348%3A15988',
14
9
  {
15
10
  props: {
16
- // These props were automatically mapped based on your linked code:
17
11
  wrap: figma.boolean('Wrap?'),
12
+ pills: figma.children('Pill'),
18
13
  },
19
- example: props => <PillGroup value={null} wrap={props.wrap} />,
14
+ example: props => (
15
+ <PillGroup value={value} wrap={props.wrap}>
16
+ {props.pills}
17
+ </PillGroup>
18
+ ),
20
19
  }
21
20
  );