@fpkit/acss 0.5.4 → 0.5.6

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 (158) hide show
  1. package/libs/chunk-PWVRDQ3R.js +8 -0
  2. package/libs/chunk-PWVRDQ3R.js.map +1 -0
  3. package/libs/chunk-SVS4MX3U.cjs +31 -0
  4. package/libs/chunk-SVS4MX3U.cjs.map +1 -0
  5. package/libs/{icons-2f29127c.d.ts → icons-31ace3de.d.ts} +87 -81
  6. package/libs/icons.cjs +2 -2
  7. package/libs/icons.d.cts +1 -1
  8. package/libs/icons.d.ts +1 -1
  9. package/libs/icons.js +1 -1
  10. package/libs/index.cjs +42 -42
  11. package/libs/index.cjs.map +1 -1
  12. package/libs/index.d.cts +59 -29
  13. package/libs/index.d.ts +59 -29
  14. package/libs/index.js +7 -7
  15. package/libs/index.js.map +1 -1
  16. package/package.json +4 -3
  17. package/src/components/README.mdx +84 -0
  18. package/src/components/alert/README.mdx +86 -0
  19. package/src/components/alert/alert.mdx +74 -0
  20. package/src/components/alert/alert.scss +80 -0
  21. package/src/components/alert/alert.stories.tsx +132 -0
  22. package/src/components/alert/alert.tsx +154 -0
  23. package/src/components/alert/elements/README.mdx +77 -0
  24. package/src/components/alert/elements/dismiss-button.stories.tsx +31 -0
  25. package/src/components/alert/elements/dismiss-button.tsx +28 -0
  26. package/src/components/badge/badge.mdx +124 -0
  27. package/src/components/badge/badge.scss +4 -4
  28. package/src/components/badge/badge.stories.tsx +21 -23
  29. package/src/components/breadcrumbs/breadcrumb.scss +2 -2
  30. package/src/components/breadcrumbs/breadcrumb.stories.tsx +42 -47
  31. package/src/components/buttons/button.scss +41 -15
  32. package/src/components/buttons/button.stories.tsx +8 -1
  33. package/src/components/buttons/button.test.tsx +72 -72
  34. package/src/components/cards/card.stories.tsx +15 -15
  35. package/src/components/details/details.scss +26 -6
  36. package/src/components/details/details.stories.tsx +33 -30
  37. package/src/components/details/details.tsx +17 -17
  38. package/src/components/dialog/README.mdx +187 -0
  39. package/src/components/dialog/dialog-modal.stories.tsx +113 -0
  40. package/src/components/dialog/dialog-modal.tsx +111 -0
  41. package/src/components/dialog/dialog.scss +76 -0
  42. package/src/components/dialog/dialog.stories.tsx +116 -0
  43. package/src/components/dialog/dialog.tsx +128 -0
  44. package/src/components/dialog/hooks/useClickOutside.ts +33 -0
  45. package/src/components/dialog/views/README.mdx +182 -0
  46. package/src/components/dialog/views/dialog-footer.tsx +45 -0
  47. package/src/components/dialog/views/dialog-header.stories.tsx +42 -0
  48. package/src/components/dialog/views/dialog-header.tsx +61 -0
  49. package/src/components/form/form.stories.tsx +16 -16
  50. package/src/components/form/input.stories.tsx +62 -62
  51. package/src/components/form/select.stories.tsx +22 -15
  52. package/src/components/heading/heading.stories.tsx +32 -33
  53. package/src/components/heading/heading.tsx +1 -1
  54. package/src/components/icons/components/add.tsx +14 -14
  55. package/src/components/icons/components/alert-solid.tsx +36 -0
  56. package/src/components/icons/components/alert-square-solid.tsx +36 -0
  57. package/src/components/icons/components/info-solid.tsx +40 -0
  58. package/src/components/icons/components/info.tsx +36 -0
  59. package/src/components/icons/components/question-solid.tsx +36 -0
  60. package/src/components/icons/components/success-solid.tsx +36 -0
  61. package/src/components/icons/components/svg.tsx +0 -1
  62. package/src/components/icons/components/warn-solid.tsx +36 -0
  63. package/src/components/icons/icon.scss +1 -3
  64. package/src/components/icons/icon.stories.tsx +87 -78
  65. package/src/components/icons/icon.tsx +57 -52
  66. package/src/components/icons/index.ts +36 -29
  67. package/src/components/icons/types.ts +1 -1
  68. package/src/components/images/figure.stories.tsx +13 -13
  69. package/src/components/images/img.stories.tsx +12 -12
  70. package/src/components/link/link.stories.tsx +32 -35
  71. package/src/components/link/link.tsx +27 -14
  72. package/src/components/list/list.stories.tsx +16 -16
  73. package/src/components/modal/dialog.tsx +13 -12
  74. package/src/components/modal/modal.tsx +28 -30
  75. package/src/components/nav/nav.stories.tsx +25 -24
  76. package/src/components/popover/popover.stories.tsx +17 -18
  77. package/src/components/progress/progress.stories.tsx +14 -20
  78. package/src/components/tag/tag.stories.tsx +17 -18
  79. package/src/components/text/text.stories.tsx +28 -29
  80. package/src/components/text-to-speech/TextToSpeech.stories.tsx +100 -101
  81. package/src/components/ui.tsx +28 -25
  82. package/src/decorators/instructions.tsx +44 -0
  83. package/src/hooks/useDialogClickHandler.ts +26 -0
  84. package/src/index.scss +23 -22
  85. package/src/index.ts +31 -30
  86. package/src/patterns/page/page-header.stories.tsx +17 -21
  87. package/src/sass/_globals.scss +14 -32
  88. package/src/sass/_styles.scss +2 -1
  89. package/src/sass/styles/_colors.scss +13 -0
  90. package/src/styles/alert/alert.css +68 -0
  91. package/src/styles/alert/alert.css.map +1 -0
  92. package/src/styles/badge/badge.css +3 -3
  93. package/src/styles/breadcrumbs/breadcrumb.css +1 -1
  94. package/src/styles/buttons/button.css +25 -2
  95. package/src/styles/buttons/button.css.map +1 -1
  96. package/src/styles/details/details.css +19 -4
  97. package/src/styles/details/details.css.map +1 -1
  98. package/src/styles/dialog/dialog.css +76 -0
  99. package/src/styles/dialog/dialog.css.map +1 -0
  100. package/src/styles/icons/icon.css +1 -3
  101. package/src/styles/icons/icon.css.map +1 -1
  102. package/src/styles/index.css +213 -60
  103. package/src/styles/index.css.map +1 -1
  104. package/libs/chunk-TBM2QIVT.js +0 -8
  105. package/libs/chunk-TBM2QIVT.js.map +0 -1
  106. package/libs/chunk-VAH6X2DZ.cjs +0 -31
  107. package/libs/chunk-VAH6X2DZ.cjs.map +0 -1
  108. package/libs/components/badge/badge.css +0 -1
  109. package/libs/components/badge/badge.css.map +0 -1
  110. package/libs/components/badge/badge.min.css +0 -3
  111. package/libs/components/breadcrumbs/breadcrumb.css +0 -1
  112. package/libs/components/breadcrumbs/breadcrumb.css.map +0 -1
  113. package/libs/components/breadcrumbs/breadcrumb.min.css +0 -3
  114. package/libs/components/buttons/button.css +0 -1
  115. package/libs/components/buttons/button.css.map +0 -1
  116. package/libs/components/buttons/button.min.css +0 -3
  117. package/libs/components/cards/card-style.css +0 -1
  118. package/libs/components/cards/card-style.css.map +0 -1
  119. package/libs/components/cards/card-style.min.css +0 -3
  120. package/libs/components/cards/card.css +0 -1
  121. package/libs/components/cards/card.css.map +0 -1
  122. package/libs/components/cards/card.min.css +0 -3
  123. package/libs/components/details/details.css +0 -1
  124. package/libs/components/details/details.css.map +0 -1
  125. package/libs/components/details/details.min.css +0 -3
  126. package/libs/components/form/form.css +0 -1
  127. package/libs/components/form/form.css.map +0 -1
  128. package/libs/components/form/form.min.css +0 -3
  129. package/libs/components/icons/icon.css +0 -1
  130. package/libs/components/icons/icon.css.map +0 -1
  131. package/libs/components/icons/icon.min.css +0 -3
  132. package/libs/components/images/img.css +0 -1
  133. package/libs/components/images/img.css.map +0 -1
  134. package/libs/components/images/img.min.css +0 -3
  135. package/libs/components/layout/landmarks.css +0 -1
  136. package/libs/components/layout/landmarks.css.map +0 -1
  137. package/libs/components/layout/landmarks.min.css +0 -3
  138. package/libs/components/link/link.css +0 -1
  139. package/libs/components/link/link.css.map +0 -1
  140. package/libs/components/link/link.min.css +0 -3
  141. package/libs/components/nav/nav.css +0 -1
  142. package/libs/components/nav/nav.css.map +0 -1
  143. package/libs/components/nav/nav.min.css +0 -3
  144. package/libs/components/progress/progress.css +0 -1
  145. package/libs/components/progress/progress.css.map +0 -1
  146. package/libs/components/progress/progress.min.css +0 -3
  147. package/libs/components/styles/index.css +0 -1
  148. package/libs/components/styles/index.css.map +0 -1
  149. package/libs/components/styles/index.min.css +0 -3
  150. package/libs/components/tag/tag.css +0 -1
  151. package/libs/components/tag/tag.css.map +0 -1
  152. package/libs/components/tag/tag.min.css +0 -3
  153. package/libs/components/text-to-speech/text-to-speech.css +0 -1
  154. package/libs/components/text-to-speech/text-to-speech.css.map +0 -1
  155. package/libs/components/text-to-speech/text-to-speech.min.css +0 -3
  156. package/libs/index.css +0 -1
  157. package/libs/index.css.map +0 -1
  158. package/src/components/readme.stories.mdx +0 -7
@@ -1,29 +1,36 @@
1
- export * from './types'
2
- export * from './components/code'
3
- export * from './components/home'
4
- export * from './components/add'
5
- export * from './components/arrow-left'
6
- export * from './components/chat'
7
- export * from './components/arrow-down'
8
- export * from './components/arrow-left'
9
- export * from './components/arrow-up'
10
- export * from './components/arrow-right'
11
- export * from './components/user'
12
- export * from './components/right'
13
- export * from './components/left'
14
- export * from './components/minus'
15
- export * from './components/remove'
16
- export * from './components/copy'
17
- export * from './components/svg'
18
- export * from './components/up'
19
- export * from './components/down'
20
- export * from './components/star'
21
- export * from './components/user'
22
- export * from './components/play'
23
- export * from './components/pause'
24
- export * from './components/resume'
25
- export * from './components/stop'
26
- export * from './components/stop-solid'
27
- export * from './components/play-solid'
28
- export * from './components/pause-solid'
29
- export * from './components/resume-solid'
1
+ export * from "./types";
2
+ export * from "./components/code";
3
+ export * from "./components/home";
4
+ export * from "./components/add";
5
+ export * from "./components/arrow-left";
6
+ export * from "./components/chat";
7
+ export * from "./components/arrow-down";
8
+ export * from "./components/arrow-left";
9
+ export * from "./components/arrow-up";
10
+ export * from "./components/arrow-right";
11
+ export * from "./components/user";
12
+ export * from "./components/right";
13
+ export * from "./components/left";
14
+ export * from "./components/minus";
15
+ export * from "./components/remove";
16
+ export * from "./components/copy";
17
+ export * from "./components/svg";
18
+ export * from "./components/up";
19
+ export * from "./components/down";
20
+ export * from "./components/star";
21
+ export * from "./components/user";
22
+ export * from "./components/play";
23
+ export * from "./components/pause";
24
+ export * from "./components/resume";
25
+ export * from "./components/stop";
26
+ export * from "./components/stop-solid";
27
+ export * from "./components/play-solid";
28
+ export * from "./components/pause-solid";
29
+ export * from "./components/resume-solid";
30
+ export * from "./components/info";
31
+ export * from "./components/alert-solid";
32
+ export * from "./components/info-solid";
33
+ export * from "./components/question-solid";
34
+ export * from "./components/warn-solid";
35
+ export * from "./components/success-solid";
36
+ export * from "./components/alert-square-solid";
@@ -2,7 +2,7 @@ import { ComponentProps } from '#/types'
2
2
 
3
3
  export interface IconProps extends Partial<ComponentProps> {
4
4
  fill?: string
5
- size?: | 16 | 24 | 32 | 48 | 64 | 96 | 128
5
+ size?: number
6
6
  strokeColor?: string
7
7
  strokeWidth?: string
8
8
  role?: string
@@ -1,31 +1,31 @@
1
- import { StoryObj, Meta } from '@storybook/react'
2
- import { within, expect } from '@storybook/test'
1
+ import { StoryObj, Meta } from "@storybook/react";
2
+ import { within, expect } from "@storybook/test";
3
3
 
4
-
5
- import Figure from './figure'
4
+ import Figure from "./figure";
6
5
 
7
6
  const meta: Meta<typeof Figure> = {
8
- title: 'FP.REACT Components/Figure',
7
+ title: "FP.REACT Components/Figure",
9
8
  component: Figure,
9
+ tags: ["version:1.0.0"],
10
10
  parameters: {
11
- actions: { argTypesRegex: '^on.*' },
11
+ actions: { argTypesRegex: "^on.*" },
12
12
  docs: {
13
13
  description: {
14
- component: 'Figure description here...',
14
+ component: "Figure description here...",
15
15
  },
16
16
  },
17
17
  },
18
18
  args: {},
19
- } as Story
19
+ } as Story;
20
20
 
21
- export default meta
22
- type Story = StoryObj<typeof Figure>
21
+ export default meta;
22
+ type Story = StoryObj<typeof Figure>;
23
23
 
24
24
  export const FigureComponent: Story = {
25
25
  args: {},
26
26
  play: async ({ canvasElement }) => {
27
- const canvas = within(canvasElement)
27
+ const canvas = within(canvasElement);
28
28
  // await expect(canvas.getByRole('img')).toBeInTheDocument()
29
- expect(canvas.getByRole('figure')).toBeInTheDocument()
29
+ expect(canvas.getByRole("figure")).toBeInTheDocument();
30
30
  },
31
- }
31
+ };
@@ -1,24 +1,24 @@
1
- import { StoryObj, Meta } from '@storybook/react'
2
- import { within, expect } from '@storybook/test'
1
+ import { StoryObj, Meta } from "@storybook/react";
2
+ import { within, expect } from "@storybook/test";
3
3
 
4
-
5
- import Img from './img'
4
+ import Img from "./img";
6
5
 
7
6
  const meta: Meta<typeof Img> = {
8
- title: 'FP.REACT Components/Img',
7
+ title: "FP.REACT Components/Img",
9
8
  component: Img,
9
+ tags: ["version:1.0.0"],
10
10
  args: {
11
- src: '//',
11
+ src: "//",
12
12
  },
13
- } as Story
13
+ } as Story;
14
14
 
15
- export default meta
16
- type Story = StoryObj<typeof Img>
15
+ export default meta;
16
+ type Story = StoryObj<typeof Img>;
17
17
 
18
18
  export const ImgComponent: Story = {
19
19
  args: {},
20
20
  play: async ({ canvasElement }) => {
21
- const canvas = within(canvasElement)
22
- await expect(canvas.getByRole('img')).toBeInTheDocument()
21
+ const canvas = within(canvasElement);
22
+ await expect(canvas.getByRole("img")).toBeInTheDocument();
23
23
  },
24
- }
24
+ };
@@ -1,74 +1,71 @@
1
- import { StoryObj, Meta } from '@storybook/react'
1
+ import { StoryObj, Meta } from "@storybook/react";
2
2
 
3
- import { within, expect } from '@storybook/test'
3
+ import { within, expect } from "@storybook/test";
4
4
 
5
-
6
-
7
- import Link from './link'
8
- import '../../styles/link/link.css'
5
+ import Link from "./link";
6
+ import "../../styles/link/link.css";
9
7
 
10
8
  const meta: Meta<typeof Link> = {
11
- title: 'FP.React Components/Links',
9
+ title: "FP.React Components/Links",
10
+ tags: ["version:1.0.0"],
12
11
  component: Link,
13
12
  args: {
14
- // @ts-ignore
15
- href: '/',
16
- children: 'Link',
13
+ href: "/",
14
+ children: "Link",
17
15
  },
18
- } as Meta
16
+ } as Meta;
19
17
 
20
- export default meta
21
- type Story = StoryObj<typeof Link>
18
+ export default meta;
19
+ type Story = StoryObj<typeof Link>;
22
20
 
23
21
  export const LinkComponent: Story = {
24
22
  args: {},
25
23
  play: async ({ canvasElement }) => {
26
- const canvas = within(canvasElement)
27
- const link = canvas.getByRole('link')
28
- expect(link).toBeInTheDocument()
29
- expect(link).toHaveTextContent('Link')
24
+ const canvas = within(canvasElement);
25
+ const link = canvas.getByRole("link");
26
+ expect(link).toBeInTheDocument();
27
+ expect(link).toHaveTextContent("Link");
30
28
  },
31
- }
29
+ };
32
30
 
33
31
  export const ExternalLink: Story = {
34
32
  args: {
35
- // @ts-ignore
36
- href: 'https://www.google.com',
37
- target: '_blank',
38
- rel: 'noopener noreferrer',
33
+ href: "https://www.google.com",
34
+ target: "_blank",
35
+ rel: "noopener noreferrer",
39
36
  prefetch: true,
40
- children: 'Google',
37
+ children: "Google",
41
38
  },
42
39
  play: async ({ canvasElement }) => {
43
- const canvas = within(canvasElement)
44
- const link = canvas.getByRole('link')
45
- expect(link).toBeInTheDocument()
46
- expect(link).toHaveTextContent('Google')
47
- expect(link).toHaveAttribute('href', 'https://www.google.com')
48
- expect(link).toHaveAttribute('target', '_blank')
49
- expect(link).toHaveAttribute('rel', 'noopener noreferrer prefetch')
40
+ const canvas = within(canvasElement);
41
+ const link = canvas.getByRole("link");
42
+ expect(link).toBeInTheDocument();
43
+ expect(link).toHaveTextContent("Google");
44
+ expect(link).toHaveAttribute("href", "https://www.google.com");
45
+ expect(link).toHaveAttribute("target", "_blank");
46
+ expect(link).toHaveAttribute("rel", "noopener noreferrer prefetch");
50
47
  },
51
- }
48
+ } as Story;
52
49
 
53
50
  export const ButtonLink: Story = {
54
51
  args: {
55
52
  ...LinkComponent.args,
56
53
  children: <b>Button Link</b>,
57
54
  },
58
- } as Story
55
+ } as Story;
59
56
 
60
57
  export const ButtonPill: Story = {
61
58
  args: {
62
59
  ...LinkComponent.args,
63
60
  children: <i>Button Link</i>,
64
61
  },
65
- } as Story
62
+ } as Story;
66
63
 
67
64
  export const ButtonRounded: Story = {
68
65
  args: {
69
66
  ...ButtonLink.args,
70
67
  styles: {
71
- '--link-radius': 'initial',
68
+ "--link-radius": "initial",
72
69
  },
73
70
  },
74
- } as Story
71
+ } as Story;
@@ -1,11 +1,24 @@
1
- import UI from '../ui'
2
- import React from 'react'
1
+ import UI from "../ui";
2
+ import React from "react";
3
3
 
4
4
  export type LinkProps = {
5
- /** Applies button styling to the link */
6
- btnStyle?: boolean
5
+ href?: string;
6
+
7
+ target?: string;
8
+
9
+ rel?: string;
10
+
11
+ children: React.ReactNode;
12
+
13
+ styles?: React.CSSProperties;
14
+
15
+ prefetch?: boolean;
16
+
17
+ btnStyle?: string;
18
+
19
+ onPointerDown?: (event: React.PointerEvent<HTMLAnchorElement>) => void;
7
20
  } & React.ComponentProps<typeof UI> &
8
- React.ComponentProps<'a'>
21
+ React.ComponentProps<"a">;
9
22
 
10
23
  export const Link = ({
11
24
  href,
@@ -18,14 +31,14 @@ export const Link = ({
18
31
  onPointerDown,
19
32
  ...props
20
33
  }: LinkProps) => {
21
- let relValue = rel
34
+ let relValue = rel;
22
35
 
23
- if (target === '_blank')
24
- relValue = `noopener noreferrer ${prefetch ? 'prefetch' : ''}`
36
+ if (target === "_blank")
37
+ relValue = `noopener noreferrer ${prefetch ? "prefetch" : ""}`;
25
38
 
26
39
  const handleOnpointerDown = (e: React.PointerEvent<HTMLAnchorElement>) => {
27
- if (onPointerDown) onPointerDown?.(e)
28
- }
40
+ if (onPointerDown) onPointerDown?.(e);
41
+ };
29
42
 
30
43
  return (
31
44
  <UI
@@ -41,8 +54,8 @@ export const Link = ({
41
54
  >
42
55
  {children}
43
56
  </UI>
44
- )
45
- }
57
+ );
58
+ };
46
59
 
47
- export default Link
48
- Link.displayName = 'Link'
60
+ export default Link;
61
+ Link.displayName = "Link";
@@ -1,16 +1,16 @@
1
- import React from 'react'
1
+ import React from "react";
2
2
 
3
- import { StoryObj, Meta } from '@storybook/react'
3
+ import { StoryObj, Meta } from "@storybook/react";
4
4
 
5
- import { within, userEvent } from '@storybook/test'
5
+ // import { within, userEvent } from "@storybook/test";
6
6
 
7
-
8
- import List from './list'
7
+ import List from "./list";
9
8
 
10
9
  const meta: Meta<typeof List> = {
11
- title: 'FP.React Components/List',
10
+ title: "FP.React Components/List",
11
+ tags: ["version:1.0.0"],
12
12
  component: List,
13
- } as Meta
13
+ } as Meta;
14
14
 
15
15
  const listElm = (
16
16
  <>
@@ -18,10 +18,10 @@ const listElm = (
18
18
  <List.ListItem>About</List.ListItem>
19
19
  <List.ListItem>Contact</List.ListItem>
20
20
  </>
21
- )
21
+ );
22
22
 
23
- export default meta
24
- type Story = StoryObj<typeof List>
23
+ export default meta;
24
+ type Story = StoryObj<typeof List>;
25
25
 
26
26
  export const DefaultList: Story = {
27
27
  args: {
@@ -33,25 +33,25 @@ export const DefaultList: Story = {
33
33
  control: false,
34
34
  },
35
35
  },
36
- } as Story
36
+ } as Story;
37
37
 
38
38
  export const UnstyledList: Story = {
39
39
  args: {
40
40
  ...DefaultList.args,
41
- role: 'list',
41
+ role: "list",
42
42
  },
43
43
  parameters: {
44
44
  docs: {
45
45
  description: {
46
- story: 'Another description `on the story`, with some markdown',
46
+ story: "Another description `on the story`, with some markdown",
47
47
  },
48
48
  },
49
49
  },
50
- } as Story
50
+ } as Story;
51
51
 
52
52
  export const InlineList: Story = {
53
53
  args: {
54
54
  ...UnstyledList.args,
55
- 'data-list': 'inline',
55
+ "data-list": "inline",
56
56
  },
57
- } as Story
57
+ } as Story;
@@ -1,24 +1,24 @@
1
- import UI from '../ui'
2
- import React from 'react'
1
+ import UI from "../ui";
2
+ import React from "react";
3
3
 
4
4
  export type DialogProps = {
5
5
  /**
6
6
  * React ref for dialog element
7
7
  */
8
- modalRef: React.RefObject<HTMLDialogElement>
8
+ modalRef: React.RefObject<HTMLDialogElement>;
9
9
  /**
10
10
  * Handle close modal event
11
11
  */
12
- closeModal?: (e: React.SyntheticEvent<HTMLDialogElement>) => void
12
+ closeModal?: (e: React.SyntheticEvent<HTMLDialogElement>) => void;
13
13
  /**
14
14
  * open modal on mount
15
15
  */
16
- openOnMount?: boolean
17
- } & React.ComponentProps<typeof UI>
16
+ openOnMount?: boolean;
17
+ } & React.ComponentProps<typeof UI>;
18
18
  /**
19
19
  * Dialog component
20
20
  */
21
- export const Dialog = ({
21
+ export const ModalDialog = ({
22
22
  id,
23
23
  children,
24
24
  classes,
@@ -28,9 +28,9 @@ export const Dialog = ({
28
28
  }: DialogProps) => {
29
29
  const handleCloseModal = (e: React.SyntheticEvent<HTMLDialogElement>) => {
30
30
  if (e.currentTarget === e.target) {
31
- e.currentTarget.close()
31
+ e.currentTarget.close();
32
32
  }
33
- }
33
+ };
34
34
 
35
35
  return (
36
36
  <UI
@@ -44,7 +44,8 @@ export const Dialog = ({
44
44
  >
45
45
  {children}
46
46
  </UI>
47
- )
48
- }
47
+ );
48
+ };
49
49
 
50
- Dialog.displayName = 'Dialog'
50
+ export default React.memo(ModalDialog);
51
+ ModalDialog.displayName = "Dialog";
@@ -1,33 +1,33 @@
1
- import React from 'react'
2
- import { ComponentProps } from '../../types'
3
- import { Button } from '../buttons/button'
4
- import { Dialog } from './dialog'
1
+ import React from "react";
2
+ import { ComponentProps } from "../../types";
3
+ import { Button } from "../buttons/button";
4
+ import { ModalDialog } from "./dialog";
5
5
 
6
6
  export interface ModalProps extends ComponentProps {
7
7
  /**
8
8
  * The child component/content for open button
9
9
  */
10
- openChild?: React.ReactNode
10
+ openChild?: React.ReactNode;
11
11
  /**
12
12
  * The child component/content for close button
13
13
  */
14
- closeChild?: React.ReactNode
14
+ closeChild?: React.ReactNode;
15
15
  /**
16
16
  * The child component/content for modal header
17
17
  */
18
- modalHeader?: React.ReactNode
18
+ modalHeader?: React.ReactNode;
19
19
  /**
20
20
  * The child component/content for modal footer
21
21
  */
22
- modalFooter?: React.ReactNode
22
+ modalFooter?: React.ReactNode;
23
23
  /**
24
24
  * The child component/content for modal body
25
25
  */
26
- children: React.ReactNode
26
+ children: React.ReactNode;
27
27
  /**
28
28
  * Open modal on mount when set to true
29
29
  */
30
- showOpen?: boolean
30
+ showOpen?: boolean;
31
31
  }
32
32
  export const Modal = ({
33
33
  openChild,
@@ -38,24 +38,22 @@ export const Modal = ({
38
38
  showOpen = false,
39
39
  ...props
40
40
  }: ModalProps) => {
41
- const dialogRef = React.useRef<HTMLDialogElement>(null)
41
+ const dialogRef = React.useRef<HTMLDialogElement>(null);
42
42
  const openModal = (): void => {
43
43
  if (dialogRef.current) {
44
- if(showOpen)
45
- dialogRef.current.show()
46
- else
47
- dialogRef.current.showModal()
44
+ if (showOpen) dialogRef.current.show();
45
+ else dialogRef.current.showModal();
48
46
  }
49
- }
47
+ };
50
48
  const closeModal = () => {
51
49
  if (dialogRef.current) {
52
- dialogRef.current.close()
50
+ dialogRef.current.close();
53
51
  }
54
- }
52
+ };
55
53
 
56
54
  return (
57
55
  <>
58
- <Dialog modalRef={dialogRef} openOnMount={showOpen} {...props}>
56
+ <ModalDialog modalRef={dialogRef} openOnMount={showOpen} {...props}>
59
57
  <section>
60
58
  {modalHeader}
61
59
  {children}
@@ -64,22 +62,22 @@ export const Modal = ({
64
62
  <Button
65
63
  type="button"
66
64
  pointerDown={() => {
67
- closeModal()
65
+ closeModal();
68
66
  }}
69
67
  >
70
- {closeChild || 'Close'}
71
- </Button>{' '}
68
+ {closeChild || "Close"}
69
+ </Button>{" "}
72
70
  </div>
73
71
  )}
74
72
  </section>
75
- </Dialog>
76
- { !showOpen && (
77
- <Button type="button" pointerDown={openModal}>
78
- {openChild || 'Open Modal'}
79
- </Button>
73
+ </ModalDialog>
74
+ {!showOpen && (
75
+ <Button type="button" pointerDown={openModal}>
76
+ {openChild || "Open Modal"}
77
+ </Button>
80
78
  )}
81
79
  </>
82
- )
83
- }
80
+ );
81
+ };
84
82
 
85
- Modal.displayName = 'Modal'
83
+ Modal.displayName = "Modal";
@@ -1,19 +1,20 @@
1
- import { StoryObj, Meta } from '@storybook/react'
2
- import { within, expect } from '@storybook/test'
1
+ import { StoryObj, Meta } from "@storybook/react";
2
+ import { within, expect } from "@storybook/test";
3
3
 
4
- import React from 'react'
4
+ import React from "react";
5
5
 
6
- import Nav from './nav'
7
- import Link from '../link/link'
6
+ import Nav from "./nav";
7
+ import Link from "../link/link";
8
8
 
9
9
  const meta: Meta<typeof Nav> = {
10
- title: 'FP.REACT Components/Nav',
10
+ title: "FP.REACT Components/Nav",
11
11
  component: Nav,
12
+ tags: ["rc"],
12
13
  parameters: {
13
- actions: { argTypesRegex: '^on.*' },
14
+ actions: { argTypesRegex: "^on.*" },
14
15
  docs: {
15
16
  description: {
16
- component: 'Nav description here...',
17
+ component: "Nav description here...",
17
18
  },
18
19
  },
19
20
  },
@@ -28,22 +29,22 @@ const meta: Meta<typeof Nav> = {
28
29
  </Nav.Item>
29
30
  </Nav.List>
30
31
  ),
31
- id: 'nav',
32
- classes: 'nav',
32
+ id: "nav",
33
+ classes: "nav",
33
34
  },
34
- } as Story
35
+ } as Story;
35
36
 
36
- export default meta
37
- type Story = StoryObj<typeof Nav>
37
+ export default meta;
38
+ type Story = StoryObj<typeof Nav>;
38
39
 
39
40
  export const NavComponent: Story = {
40
41
  args: {},
41
42
  play: async ({ canvasElement }) => {
42
- const canvas = within(canvasElement)
43
- expect(canvas.getAllByRole('link')).toHaveLength(2)
44
- expect(canvas.getByText(/link 1/i)).toBeInTheDocument()
43
+ const canvas = within(canvasElement);
44
+ expect(canvas.getAllByRole("link")).toHaveLength(2);
45
+ expect(canvas.getByText(/link 1/i)).toBeInTheDocument();
45
46
  },
46
- }
47
+ };
47
48
 
48
49
  export const NavSection: Story = {
49
50
  args: {
@@ -57,11 +58,11 @@ export const NavSection: Story = {
57
58
  ),
58
59
  },
59
60
  play: async ({ canvasElement }) => {
60
- const canvas = within(canvasElement)
61
- expect(canvas.getByText('Link 1')).toBeInTheDocument()
62
- expect(canvas.getByText('Link 2')).toBeInTheDocument()
61
+ const canvas = within(canvasElement);
62
+ expect(canvas.getByText("Link 1")).toBeInTheDocument();
63
+ expect(canvas.getByText("Link 2")).toBeInTheDocument();
63
64
  },
64
- } as Story
65
+ } as Story;
65
66
 
66
67
  export const NavBlock: Story = {
67
68
  args: {
@@ -75,12 +76,12 @@ export const NavBlock: Story = {
75
76
  </>
76
77
  ),
77
78
  },
78
- } as Story
79
+ } as Story;
79
80
 
80
81
  export const MultipleNavs: Story = {
81
82
  args: {
82
83
  ...NavSection.args,
83
- classes: 'navbar',
84
+ classes: "navbar",
84
85
  children: (
85
86
  <>
86
87
  <Nav.List>
@@ -94,4 +95,4 @@ export const MultipleNavs: Story = {
94
95
  </>
95
96
  ),
96
97
  },
97
- } as Story
98
+ } as Story;