@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,31 +1,30 @@
1
- import { StoryObj, Meta } from '@storybook/react'
2
- import { within, expect, userEvent } from '@storybook/test'
1
+ import { StoryObj, Meta } from "@storybook/react";
2
+ import { within, expect, userEvent } from "@storybook/test";
3
3
 
4
-
5
- import Popover from './popover'
6
- import { getByText } from '@testing-library/react'
4
+ import Popover from "./popover";
7
5
 
8
6
  const meta: Meta<typeof Popover> = {
9
- title: 'FP.React Components/Basic Popover',
7
+ title: "FP.React Components/Basic Popover",
10
8
  component: Popover,
9
+ tags: ["experimental"],
11
10
  args: {
12
- children: 'Hi, I am a popover.',
13
- popoverTrigger: 'Hover here',
11
+ children: "Hi, I am a popover.",
12
+ popoverTrigger: "Hover here",
14
13
  styles: Popover.styles,
15
14
  },
16
- } as Meta
15
+ } as Meta;
17
16
 
18
- export default meta
19
- type Story = StoryObj<typeof Popover>
17
+ export default meta;
18
+ type Story = StoryObj<typeof Popover>;
20
19
 
21
20
  export const PopoverComponent: Story = {
22
21
  args: {},
23
22
  play: async ({ canvasElement }) => {
24
- const canvas = within(canvasElement)
25
- expect(await canvas.queryByText('Hover here')).toBeInTheDocument()
26
- userEvent.hover(canvas.getByText('Hover here'))
27
- expect(await canvas.findByText('Hi, I am a popover.')).toBeInTheDocument()
28
- await userEvent.unhover(canvas.getByText('Hover here'))
29
- expect(canvas.queryByText('Hi, I am a popover.')).not.toBeInTheDocument()
23
+ const canvas = within(canvasElement);
24
+ expect(await canvas.queryByText("Hover here")).toBeInTheDocument();
25
+ userEvent.hover(canvas.getByText("Hover here"));
26
+ expect(await canvas.findByText("Hi, I am a popover.")).toBeInTheDocument();
27
+ await userEvent.unhover(canvas.getByText("Hover here"));
28
+ expect(canvas.queryByText("Hi, I am a popover.")).not.toBeInTheDocument();
30
29
  },
31
- }
30
+ };
@@ -1,51 +1,45 @@
1
- import { StoryObj, Meta } from '@storybook/react'
2
- import { within, userEvent, screen } from '@storybook/test'
1
+ import { StoryObj, Meta } from "@storybook/react";
3
2
 
3
+ import "../../styles/progress/progress.css";
4
4
 
5
- import '../../styles/progress/progress.css'
6
-
7
- import Progress from './progress'
5
+ import Progress from "./progress";
8
6
 
9
7
  const meta: Meta<typeof Progress> = {
10
- title: 'FP.React Components/Progress',
8
+ title: "FP.React Components/Progress",
11
9
  component: Progress,
12
- args: {},
10
+ tags: ["experimental"],
13
11
  decorators: [
14
12
  (Story) => (
15
- <div style={{ minWidth: '500px', height: '100%' }}>
13
+ <div style={{ minWidth: "500px", height: "100%" }}>
16
14
  <Story />
17
15
  </div>
18
16
  ),
19
17
  ],
20
- } as Meta
18
+ } as Meta;
21
19
 
22
- export default meta
23
- type Story = StoryObj<typeof Progress>
20
+ export default meta;
21
+ type Story = StoryObj<typeof Progress>;
24
22
 
25
23
  export const ProgressComponent: Story = {
26
- name: 'Progress Bar',
24
+ name: "Progress Bar",
27
25
  args: {
28
26
  isBusy: true,
29
27
  },
30
- play: async ({ canvasElement }) => {
31
- const canvas = within(canvasElement)
32
- //expect(canvas).toBeInTheDocument()
33
- },
34
- } as Story
28
+ } as Story;
35
29
 
36
30
  export const ProgressIndicator: Story = {
37
31
  args: {
38
32
  value: 3,
39
33
  max: 10,
40
34
  },
41
- } as Story
35
+ } as Story;
42
36
 
43
37
  export const RedProgress: Story = {
44
38
  args: {
45
39
  ...ProgressIndicator.args,
46
40
  styles: {
47
- '--progress-color': 'red',
41
+ "--progress-color": "red",
48
42
  },
49
43
  value: 7,
50
44
  },
51
- } as Story
45
+ } as Story;
@@ -1,39 +1,38 @@
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 Tag from './tag'
6
- import './tag.scss'
4
+ import Tag from "./tag";
5
+ import "./tag.scss";
7
6
 
8
7
  const meta: Meta<typeof Tag> = {
9
- title: 'FP.React Components/Tag',
8
+ title: "FP.React Components/Tag",
10
9
  component: Tag,
10
+ tags: ["beta"],
11
11
  args: {
12
- // @ts-ignore
13
- children: 'Basic Tag',
12
+ children: "Basic Tag",
14
13
  // styles: Tag.styles,
15
14
  },
16
- } as Meta
15
+ } as Meta;
17
16
 
18
- export default meta
19
- type Story = StoryObj<typeof Tag>
17
+ export default meta;
18
+ type Story = StoryObj<typeof Tag>;
20
19
 
21
20
  export const TagComponent: Story = {
22
21
  args: {},
23
22
  play: async ({ canvasElement }) => {
24
- const canvas = within(canvasElement)
25
- expect(canvas.queryByText(/basic tag/i)).toBeInTheDocument()
23
+ const canvas = within(canvasElement);
24
+ expect(canvas.queryByText(/basic tag/i)).toBeInTheDocument();
26
25
  },
27
- }
26
+ };
28
27
 
29
28
  export const Beta: Story = {
30
29
  args: {
31
- 'data-tag': 'beta',
30
+ "data-tag": "beta",
32
31
  },
33
- } as Story
32
+ } as Story;
34
33
 
35
34
  export const Production: Story = {
36
35
  args: {
37
- 'data-tag': 'production',
36
+ "data-tag": "production",
38
37
  },
39
- } as Story
38
+ } as Story;
@@ -1,21 +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
-
5
- import Text from './text'
4
+ import Text from "./text";
6
5
 
7
6
  const meta: Meta<typeof Text> = {
8
- title: 'FP.REACT Components/Text',
7
+ title: "FP.REACT Components/Text",
9
8
  component: Text,
9
+ tags: ["version:1.0.0"],
10
10
  args: {
11
- // @ts-ignore
12
11
  children:
13
- 'Exercitation non voluptate fugiat amet dolor tempor consectetur. Eu esse adipisicing laboris duis et velit in quis et sunt pariatur tempor laborum nisi. Et id amet ullamco culpa irure nulla esse dolore velit esse.',
12
+ "Exercitation non voluptate fugiat amet dolor tempor consectetur. Eu esse adipisicing laboris duis et velit in quis et sunt pariatur tempor laborum nisi. Et id amet ullamco culpa irure nulla esse dolore velit esse.",
14
13
  },
15
- } as Story
14
+ } as Story;
16
15
 
17
- export default meta
18
- type Story = StoryObj<typeof Text>
16
+ export default meta;
17
+ type Story = StoryObj<typeof Text>;
19
18
 
20
19
  export const ParagraphText: Story = {
21
20
  args: {},
@@ -23,45 +22,45 @@ export const ParagraphText: Story = {
23
22
  // const canvas = within(canvasElement)
24
23
  // expect(canvas.getByText(/link/i)).toBeInTheDocument()
25
24
  // },
26
- }
25
+ };
27
26
 
28
27
  export const span: Story = {
29
28
  args: {
30
- as: 'span',
31
- children: 'Heading Text',
29
+ as: "span",
30
+ children: "Heading Text",
32
31
  },
33
32
  play: async ({ canvasElement }) => {
34
- const canvas = within(canvasElement)
35
- expect(canvas.getByText(/heading/i)).toBeInTheDocument()
33
+ const canvas = within(canvasElement);
34
+ expect(canvas.getByText(/heading/i)).toBeInTheDocument();
36
35
  },
37
- } as Story
36
+ } as Story;
38
37
 
39
38
  export const Blockquote: Story = {
40
39
  args: {
41
- as: 'blockquote',
40
+ as: "blockquote",
42
41
  children:
43
- 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor.',
42
+ "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor.",
44
43
  },
45
- } as Story
44
+ } as Story;
46
45
 
47
46
  export const Strong: Story = {
48
47
  args: {
49
- as: 'strong',
50
- children: 'Emphasis Text',
48
+ as: "strong",
49
+ children: "Emphasis Text",
51
50
  },
52
51
  play: async ({ canvasElement }) => {
53
- const canvas = within(canvasElement)
54
- expect(canvas.getByText(/emphasis/i)).toBeInTheDocument()
52
+ const canvas = within(canvasElement);
53
+ expect(canvas.getByText(/emphasis/i)).toBeInTheDocument();
55
54
  },
56
- } as Story
55
+ } as Story;
57
56
 
58
57
  export const Code: Story = {
59
58
  args: {
60
- as: 'code',
61
- children: 'Code Text',
59
+ as: "code",
60
+ children: "Code Text",
62
61
  },
63
62
  play: async ({ canvasElement }) => {
64
- const canvas = within(canvasElement)
65
- expect(canvas.getByText(/code/i)).toBeInTheDocument()
63
+ const canvas = within(canvasElement);
64
+ expect(canvas.getByText(/code/i)).toBeInTheDocument();
66
65
  },
67
- } as Story
66
+ } as Story;
@@ -1,35 +1,34 @@
1
- import React from 'react'
2
- import { Meta, StoryObj } from '@storybook/react'
3
- import TextToSpeech from './TextToSpeech'
4
- import './text-to-speech.scss'
1
+ import { Meta, StoryObj } from "@storybook/react";
2
+ import TextToSpeech from "./TextToSpeech";
3
+ import "./text-to-speech.scss";
5
4
 
6
5
  const meta: Meta<typeof TextToSpeech> = {
7
- title: 'FP.REACT Components/TextToSpeech',
6
+ title: "FP.REACT Components/TextToSpeech",
8
7
  component: TextToSpeech,
9
- tags: ['autodocs'],
8
+ tags: ["experimental"],
10
9
  argTypes: {
11
10
  voice: {
12
11
  control: {
13
- type: 'select',
12
+ type: "select",
14
13
  options: [
15
- 'Google US English',
16
- 'Google UK English Female',
17
- 'Google UK English Male',
14
+ "Google US English",
15
+ "Google UK English Female",
16
+ "Google UK English Male",
18
17
  ],
19
18
  },
20
19
  },
21
20
  },
22
- } as Story
21
+ } as Story;
23
22
 
24
- export default meta
23
+ export default meta;
25
24
 
26
- type Story = StoryObj<typeof TextToSpeech>
25
+ type Story = StoryObj<typeof TextToSpeech>;
27
26
 
28
27
  export const Default: Story = {
29
28
  args: {
30
- label: 'Read post',
29
+ label: "Read post",
31
30
  initialText:
32
- 'Hello, how are you? I am a Text to Speech (TTS) assistant! Update this text and click the [speak] button to hear the change.',
31
+ "Hello, how are you? I am a Text to Speech (TTS) assistant! Update this text and click the [speak] button to hear the change.",
33
32
  },
34
33
  parameters: {
35
34
  docs: {
@@ -39,13 +38,13 @@ export const Default: Story = {
39
38
  },
40
39
  },
41
40
  },
42
- } as Story
41
+ } as Story;
43
42
 
44
43
  export const WithText: Story = {
45
44
  args: {
46
45
  // Add props to simulate text input
47
46
  initialText:
48
- 'This is a test of the text to speech component. Here the test is passed as a prop and the text input is hidden.',
47
+ "This is a test of the text to speech component. Here the test is passed as a prop and the text input is hidden.",
49
48
  showTextInput: false,
50
49
  },
51
50
  parameters: {
@@ -56,90 +55,90 @@ export const WithText: Story = {
56
55
  },
57
56
  },
58
57
  },
59
- } as Story
58
+ } as Story;
60
59
 
61
- export const FullFeature: Story = {
62
- args: {
63
- initialText:
64
- 'Welcome to the full-featured Text-to-Speech component. You can modify this text, choose a voice, adjust pitch and rate, and then click the speak button to hear it.',
65
- showTextInput: true,
66
- pitch: 1,
67
- rate: 1,
68
- },
69
- parameters: {
70
- docs: {
71
- description: {
72
- story:
73
- "This story showcases all features of the TextToSpeechComponent, including text input, voice selection, pitch and rate adjustment. It provides a comprehensive demonstration of the component's capabilities.",
74
- },
75
- },
76
- },
77
- render: (args) => {
78
- const [selectedVoice, setSelectedVoice] = React.useState<
79
- SpeechSynthesisVoice | undefined
80
- >(undefined)
81
- const [pitch, setPitch] = React.useState(1)
82
- const [rate, setRate] = React.useState(1)
60
+ // export const FullFeature: Story = {
61
+ // args: {
62
+ // initialText:
63
+ // "Welcome to the full-featured Text-to-Speech component. You can modify this text, choose a voice, adjust pitch and rate, and then click the speak button to hear it.",
64
+ // showTextInput: true,
65
+ // pitch: 1,
66
+ // rate: 1,
67
+ // },
68
+ // parameters: {
69
+ // docs: {
70
+ // description: {
71
+ // story:
72
+ // "This story showcases all features of the TextToSpeechComponent, including text input, voice selection, pitch and rate adjustment. It provides a comprehensive demonstration of the component's capabilities.",
73
+ // },
74
+ // },
75
+ // },
76
+ // render: (args) => {
77
+ // const [selectedVoice, setSelectedVoice] = React.useState<
78
+ // SpeechSynthesisVoice | undefined
79
+ // >(undefined);
80
+ // const [pitch, setPitch] = React.useState(1);
81
+ // const [rate, setRate] = React.useState(1);
83
82
 
84
- React.useEffect(() => {
85
- const voices = window.speechSynthesis.getVoices()
86
- setSelectedVoice(
87
- voices.find((voice) => voice.name === 'Google US English') || voices[0],
88
- )
89
- }, [])
83
+ // React.useEffect(() => {
84
+ // const voices = window.speechSynthesis.getVoices();
85
+ // setSelectedVoice(
86
+ // voices.find((voice) => voice.name === "Google US English") || voices[0]
87
+ // );
88
+ // }, []);
90
89
 
91
- return (
92
- <div>
93
- <TextToSpeech
94
- {...args}
95
- voice={selectedVoice}
96
- pitch={pitch}
97
- rate={rate}
98
- />
99
- <div style={{ marginTop: '20px' }}>
100
- <label htmlFor="voice-select">Select Voice: </label>
101
- <select
102
- id="voice-select"
103
- onChange={(e) =>
104
- setSelectedVoice(
105
- window.speechSynthesis
106
- .getVoices()
107
- .find((v) => v.name === e.target.value),
108
- )
109
- }
110
- >
111
- {window.speechSynthesis.getVoices().map((voice) => (
112
- <option key={voice.name} value={voice.name}>
113
- {voice.name} ({voice.lang})
114
- </option>
115
- ))}
116
- </select>
117
- </div>
118
- <div style={{ marginTop: '10px' }}>
119
- <label htmlFor="pitch-range">Pitch: {pitch}</label>
120
- <input
121
- id="pitch-range"
122
- type="range"
123
- min="0.5"
124
- max="2"
125
- step="0.1"
126
- value={pitch}
127
- onChange={(e) => setPitch(parseFloat(e.target.value))}
128
- />
129
- </div>
130
- <div style={{ marginTop: '10px' }}>
131
- <label htmlFor="rate-range">Rate: {rate}</label>
132
- <input
133
- id="rate-range"
134
- type="range"
135
- min="0.5"
136
- max="2"
137
- step="0.1"
138
- value={rate}
139
- onChange={(e) => setRate(parseFloat(e.target.value))}
140
- />
141
- </div>
142
- </div>
143
- )
144
- },
145
- } as Story
90
+ // return (
91
+ // <div>
92
+ // <TextToSpeech
93
+ // {...args}
94
+ // voice={selectedVoice}
95
+ // pitch={pitch}
96
+ // rate={rate}
97
+ // />
98
+ // <div style={{ marginTop: "20px" }}>
99
+ // <label htmlFor="voice-select">Select Voice: </label>
100
+ // <select
101
+ // id="voice-select"
102
+ // onChange={(e) =>
103
+ // setSelectedVoice(
104
+ // window.speechSynthesis
105
+ // .getVoices()
106
+ // .find((v) => v.name === e.target.value)
107
+ // )
108
+ // }
109
+ // >
110
+ // {window.speechSynthesis.getVoices().map((voice) => (
111
+ // <option key={voice.name} value={voice.name}>
112
+ // {voice.name} ({voice.lang})
113
+ // </option>
114
+ // ))}
115
+ // </select>
116
+ // </div>
117
+ // <div style={{ marginTop: "10px" }}>
118
+ // <label htmlFor="pitch-range">Pitch: {pitch}</label>
119
+ // <input
120
+ // id="pitch-range"
121
+ // type="range"
122
+ // min="0.5"
123
+ // max="2"
124
+ // step="0.1"
125
+ // value={pitch}
126
+ // onChange={(e) => setPitch(parseFloat(e.target.value))}
127
+ // />
128
+ // </div>
129
+ // <div style={{ marginTop: "10px" }}>
130
+ // <label htmlFor="rate-range">Rate: {rate}</label>
131
+ // <input
132
+ // id="rate-range"
133
+ // type="range"
134
+ // min="0.5"
135
+ // max="2"
136
+ // step="0.1"
137
+ // value={rate}
138
+ // onChange={(e) => setRate(parseFloat(e.target.value))}
139
+ // />
140
+ // </div>
141
+ // </div>
142
+ // );
143
+ // },
144
+ // } as Story;
@@ -1,38 +1,39 @@
1
- /* eslint-enable react/display-name */
2
- import React from 'react'
1
+
2
+ /* eslint-disable */
3
+ import React from "react";
3
4
 
4
5
  type PolymorphicRef<C extends React.ElementType> =
5
- React.ComponentPropsWithRef<C>['ref']
6
+ React.ComponentPropsWithRef<C>["ref"];
6
7
 
7
8
  type AsProp<C extends React.ElementType> = {
8
- as?: C
9
- }
9
+ as?: C;
10
+ };
10
11
 
11
- type PropsToOmit<C extends React.ElementType, P> = keyof (AsProp<C> & P)
12
+ type PropsToOmit<C extends React.ElementType, P> = keyof (AsProp<C> & P);
12
13
 
13
14
  type PolymorphicComponentProp<
14
15
  C extends React.ElementType,
15
16
  Props = {},
16
17
  > = React.PropsWithChildren<Props & AsProp<C>> &
17
- Omit<React.ComponentPropsWithoutRef<C>, PropsToOmit<C, Props>>
18
+ Omit<React.ComponentPropsWithoutRef<C>, PropsToOmit<C, Props>>;
18
19
 
19
20
  type PolymorphicComponentPropWithRef<
20
21
  C extends React.ElementType,
21
22
  Props = {},
22
23
  > = PolymorphicComponentProp<C, Props> & {
23
- ref?: PolymorphicRef<C>
24
- }
24
+ ref?: PolymorphicRef<C>;
25
+ };
25
26
 
26
27
  type FPProps<C extends React.ElementType> = PolymorphicComponentPropWithRef<
27
28
  C,
28
29
  {
29
- renderStyles?: boolean
30
- styles?: React.CSSProperties
31
- classes?: string
32
- id?: string
33
- children?: React.ReactNode
30
+ renderStyles?: boolean;
31
+ styles?: React.CSSProperties;
32
+ classes?: string;
33
+ id?: string;
34
+ children?: React.ReactNode;
34
35
  }
35
- >
36
+ >;
36
37
 
37
38
  /*
38
39
  * FPComponent type definition
@@ -43,25 +44,27 @@ type FPProps<C extends React.ElementType> = PolymorphicComponentPropWithRef<
43
44
  * @param props - The component props
44
45
  * @returns React component
45
46
  */
46
- type FPComponent = <C extends React.ElementType = 'span'>(
47
- props: FPProps<C>,
48
- ) => React.ReactElement | any
47
+ type FPComponent = <C extends React.ElementType = "span">(
48
+ props: FPProps<C>
49
+ ) => React.ReactElement | (any & { displayName?: String });
49
50
 
50
51
  const FP: FPComponent = React.forwardRef(
51
52
  <C extends React.ElementType>(
52
53
  { as, styles, classes, children, defaultStyles, ...props }: FPProps<C>,
53
- ref?: PolymorphicRef<C>,
54
+ ref?: PolymorphicRef<C>
54
55
  ) => {
55
- const Component = as || 'div'
56
+ const Component = as ?? "div";
56
57
 
57
- const styleObj: React.CSSProperties = { ...defaultStyles, ...styles }
58
+ const styleObj: React.CSSProperties = { ...defaultStyles, ...styles };
58
59
 
59
60
  return (
60
61
  <Component ref={ref} style={styleObj} className={classes} {...props}>
61
62
  {children}
62
63
  </Component>
63
- )
64
- },
65
- )
64
+ );
65
+ }
66
+ );
66
67
 
67
- export default FP
68
+ export default FP;
69
+ // @ts-expect-error -- React component displayName
70
+ FP.displayName = "FP";
@@ -0,0 +1,44 @@
1
+ import { StoryFn } from "@storybook/react";
2
+ import UI from "#components/ui";
3
+
4
+ /**
5
+ * A decorator that wraps a Storybook story with instructions and an optional title.
6
+ * This decorator creates a container that displays instructions above the story component.
7
+ *
8
+ * @param {React.ReactNode} [instructions] - Optional instructions to display above the story
9
+ * @param {string} [title] - Optional title for the instructions section. Defaults to "Story Instructions"
10
+ * @returns {Function} A decorator function that wraps the story component
11
+ *
12
+ * @example
13
+ * ```tsx
14
+ * export const MyStory = Template.bind({});
15
+ * MyStory.decorators = [
16
+ * WithInstructions(
17
+ * <p>Follow these steps to interact with the component...</p>,
18
+ * "Usage Instructions"
19
+ * )
20
+ * ];
21
+ * ```
22
+ */
23
+ export const WithInstructions =
24
+ (instructions?: React.ReactNode, title?: string) => (Story: StoryFn) => {
25
+ return (
26
+ <UI
27
+ style={{
28
+ paddingBlock: "2rem",
29
+ display: "flex",
30
+ flexDirection: "column",
31
+ gap: "3rem",
32
+ width: "max(320px, 90%)",
33
+ }}
34
+ >
35
+ <Story />
36
+ <div style={{ paddingInline: "1rem" }}>
37
+ <h3>{title || "Story Instructions"}</h3>
38
+ {instructions}
39
+ </div>
40
+ </UI>
41
+ );
42
+ };
43
+
44
+ export default WithInstructions;