@fpkit/acss 0.5.9 → 0.5.12

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 (250) hide show
  1. package/README.md +425 -18
  2. package/libs/chunk-23ANBDCR.js +8 -0
  3. package/libs/chunk-23ANBDCR.js.map +1 -0
  4. package/libs/chunk-5M57K4SW.js +8 -0
  5. package/libs/chunk-5M57K4SW.js.map +1 -0
  6. package/libs/chunk-5ZM4XL44.js +8 -0
  7. package/libs/chunk-5ZM4XL44.js.map +1 -0
  8. package/libs/chunk-6BVXFW7U.cjs +15 -0
  9. package/libs/chunk-6BVXFW7U.cjs.map +1 -0
  10. package/libs/chunk-6TE5QEVE.cjs +13 -0
  11. package/libs/chunk-6TE5QEVE.cjs.map +1 -0
  12. package/libs/chunk-7K76RW2A.cjs +18 -0
  13. package/libs/chunk-7K76RW2A.cjs.map +1 -0
  14. package/libs/chunk-BHRQBJRY.js +8 -0
  15. package/libs/chunk-BHRQBJRY.js.map +1 -0
  16. package/libs/chunk-BIP2NY53.js +8 -0
  17. package/libs/chunk-BIP2NY53.js.map +1 -0
  18. package/libs/chunk-BSPKFLO4.js +8 -0
  19. package/libs/chunk-BSPKFLO4.js.map +1 -0
  20. package/libs/chunk-BV5CLH44.cjs +18 -0
  21. package/libs/chunk-BV5CLH44.cjs.map +1 -0
  22. package/libs/chunk-DKGJHKGW.js +9 -0
  23. package/libs/chunk-DKGJHKGW.js.map +1 -0
  24. package/libs/chunk-DV56L5YX.cjs +18 -0
  25. package/libs/chunk-DV56L5YX.cjs.map +1 -0
  26. package/libs/chunk-E3XP6BEX.cjs +16 -0
  27. package/libs/chunk-E3XP6BEX.cjs.map +1 -0
  28. package/libs/chunk-ECLD37WN.cjs +16 -0
  29. package/libs/chunk-ECLD37WN.cjs.map +1 -0
  30. package/libs/chunk-EQ67LF46.js +9 -0
  31. package/libs/chunk-EQ67LF46.js.map +1 -0
  32. package/libs/chunk-G55UJ53G.cjs +16 -0
  33. package/libs/chunk-G55UJ53G.cjs.map +1 -0
  34. package/libs/chunk-HYBZBN4G.js +8 -0
  35. package/libs/chunk-HYBZBN4G.js.map +1 -0
  36. package/libs/chunk-ICCKQ2GC.cjs +15 -0
  37. package/libs/chunk-ICCKQ2GC.cjs.map +1 -0
  38. package/libs/chunk-IYUN2EW3.cjs +15 -0
  39. package/libs/chunk-IYUN2EW3.cjs.map +1 -0
  40. package/libs/chunk-KKLTUJFB.cjs +31 -0
  41. package/libs/chunk-KKLTUJFB.cjs.map +1 -0
  42. package/libs/chunk-LHVJKDMA.cjs +15 -0
  43. package/libs/chunk-LHVJKDMA.cjs.map +1 -0
  44. package/libs/chunk-LIQJ7ZZR.js +8 -0
  45. package/libs/chunk-LIQJ7ZZR.js.map +1 -0
  46. package/libs/chunk-LL7HTLMS.cjs +15 -0
  47. package/libs/chunk-LL7HTLMS.cjs.map +1 -0
  48. package/libs/chunk-LT5KZ2QW.cjs +22 -0
  49. package/libs/chunk-LT5KZ2QW.cjs.map +1 -0
  50. package/libs/chunk-M5QL5TAE.cjs +14 -0
  51. package/libs/chunk-M5QL5TAE.cjs.map +1 -0
  52. package/libs/chunk-NE6YXTMC.js +7 -0
  53. package/libs/chunk-NE6YXTMC.js.map +1 -0
  54. package/libs/chunk-NHYXGV3L.js +8 -0
  55. package/libs/chunk-NHYXGV3L.js.map +1 -0
  56. package/libs/chunk-O6QZBB6G.js +9 -0
  57. package/libs/chunk-O6QZBB6G.js.map +1 -0
  58. package/libs/chunk-P7TTEYCD.js +7 -0
  59. package/libs/chunk-P7TTEYCD.js.map +1 -0
  60. package/libs/chunk-PPOOBUOS.js +8 -0
  61. package/libs/chunk-PPOOBUOS.js.map +1 -0
  62. package/libs/chunk-QCMV4VQZ.js +8 -0
  63. package/libs/chunk-QCMV4VQZ.js.map +1 -0
  64. package/libs/chunk-QVV34QEH.cjs +32 -0
  65. package/libs/chunk-QVV34QEH.cjs.map +1 -0
  66. package/libs/chunk-S7BABR7Z.cjs +13 -0
  67. package/libs/chunk-S7BABR7Z.cjs.map +1 -0
  68. package/libs/chunk-SXVZSWX6.js +11 -0
  69. package/libs/chunk-SXVZSWX6.js.map +1 -0
  70. package/libs/chunk-X3EVB7VS.cjs +15 -0
  71. package/libs/chunk-X3EVB7VS.cjs.map +1 -0
  72. package/libs/chunk-YWOYVRFT.js +9 -0
  73. package/libs/chunk-YWOYVRFT.js.map +1 -0
  74. package/libs/component-props-a8a2f97e.d.ts +38 -0
  75. package/libs/components/breadcrumbs/breadcrumb.cjs +20 -0
  76. package/libs/components/breadcrumbs/breadcrumb.cjs.map +1 -0
  77. package/libs/components/breadcrumbs/breadcrumb.d.cts +51 -0
  78. package/libs/components/breadcrumbs/breadcrumb.d.ts +51 -0
  79. package/libs/components/breadcrumbs/breadcrumb.js +5 -0
  80. package/libs/components/breadcrumbs/breadcrumb.js.map +1 -0
  81. package/libs/components/button.cjs +19 -0
  82. package/libs/components/button.cjs.map +1 -0
  83. package/libs/components/button.d.cts +16 -0
  84. package/libs/components/button.d.ts +16 -0
  85. package/libs/components/button.js +4 -0
  86. package/libs/components/button.js.map +1 -0
  87. package/libs/components/card.cjs +31 -0
  88. package/libs/components/card.cjs.map +1 -0
  89. package/libs/components/card.d.cts +58 -0
  90. package/libs/components/card.d.ts +58 -0
  91. package/libs/components/card.js +4 -0
  92. package/libs/components/card.js.map +1 -0
  93. package/libs/components/details/details.css +1 -1
  94. package/libs/components/details/details.css.map +1 -1
  95. package/libs/components/details/details.min.css +2 -2
  96. package/libs/components/dialog/dialog.cjs +22 -0
  97. package/libs/components/dialog/dialog.cjs.map +1 -0
  98. package/libs/components/dialog/dialog.d.cts +51 -0
  99. package/libs/components/dialog/dialog.d.ts +51 -0
  100. package/libs/components/dialog/dialog.js +7 -0
  101. package/libs/components/dialog/dialog.js.map +1 -0
  102. package/libs/components/form/fields.cjs +19 -0
  103. package/libs/components/form/fields.cjs.map +1 -0
  104. package/libs/components/form/fields.d.cts +24 -0
  105. package/libs/components/form/fields.d.ts +24 -0
  106. package/libs/components/form/fields.js +4 -0
  107. package/libs/components/form/fields.js.map +1 -0
  108. package/libs/components/form/inputs.cjs +19 -0
  109. package/libs/components/form/inputs.cjs.map +1 -0
  110. package/libs/components/form/inputs.d.cts +2 -0
  111. package/libs/components/form/inputs.d.ts +2 -0
  112. package/libs/components/form/inputs.js +4 -0
  113. package/libs/components/form/inputs.js.map +1 -0
  114. package/libs/components/form/textarea.cjs +19 -0
  115. package/libs/components/form/textarea.cjs.map +1 -0
  116. package/libs/components/form/textarea.d.cts +29 -0
  117. package/libs/components/form/textarea.d.ts +29 -0
  118. package/libs/components/form/textarea.js +4 -0
  119. package/libs/components/form/textarea.js.map +1 -0
  120. package/libs/components/heading/heading.cjs +10 -0
  121. package/libs/components/heading/heading.cjs.map +1 -0
  122. package/libs/components/heading/heading.d.cts +14 -0
  123. package/libs/components/heading/heading.d.ts +14 -0
  124. package/libs/components/heading/heading.js +4 -0
  125. package/libs/components/heading/heading.js.map +1 -0
  126. package/libs/components/icons/icon.cjs +19 -0
  127. package/libs/components/icons/icon.cjs.map +1 -0
  128. package/libs/{icons-31ace3de.d.ts → components/icons/icon.d.cts} +4 -58
  129. package/libs/components/icons/icon.d.ts +301 -0
  130. package/libs/components/icons/icon.js +4 -0
  131. package/libs/components/icons/icon.js.map +1 -0
  132. package/libs/components/link/link.cjs +19 -0
  133. package/libs/components/link/link.cjs.map +1 -0
  134. package/libs/components/link/link.d.cts +19 -0
  135. package/libs/components/link/link.d.ts +19 -0
  136. package/libs/components/link/link.js +4 -0
  137. package/libs/components/link/link.js.map +1 -0
  138. package/libs/components/list/list.cjs +23 -0
  139. package/libs/components/list/list.cjs.map +1 -0
  140. package/libs/components/list/list.d.cts +39 -0
  141. package/libs/components/list/list.d.ts +39 -0
  142. package/libs/components/list/list.js +4 -0
  143. package/libs/components/list/list.js.map +1 -0
  144. package/libs/components/modal.cjs +14 -0
  145. package/libs/components/modal.cjs.map +1 -0
  146. package/libs/components/modal.d.cts +35 -0
  147. package/libs/components/modal.d.ts +35 -0
  148. package/libs/components/modal.js +5 -0
  149. package/libs/components/modal.js.map +1 -0
  150. package/libs/components/nav/nav.cjs +28 -0
  151. package/libs/components/nav/nav.cjs.map +1 -0
  152. package/libs/components/nav/nav.d.cts +44 -0
  153. package/libs/components/nav/nav.d.ts +44 -0
  154. package/libs/components/nav/nav.js +5 -0
  155. package/libs/components/nav/nav.js.map +1 -0
  156. package/libs/components/popover/popover.cjs +23 -0
  157. package/libs/components/popover/popover.cjs.map +1 -0
  158. package/libs/components/popover/popover.d.cts +40 -0
  159. package/libs/components/popover/popover.d.ts +40 -0
  160. package/libs/components/popover/popover.js +4 -0
  161. package/libs/components/popover/popover.js.map +1 -0
  162. package/libs/components/tables/table.cjs +21 -0
  163. package/libs/components/tables/table.cjs.map +1 -0
  164. package/libs/components/tables/table.d.cts +36 -0
  165. package/libs/components/tables/table.d.ts +36 -0
  166. package/libs/components/tables/table.js +4 -0
  167. package/libs/components/tables/table.js.map +1 -0
  168. package/libs/components/text/text.cjs +23 -0
  169. package/libs/components/text/text.cjs.map +1 -0
  170. package/libs/components/text/text.d.cts +30 -0
  171. package/libs/components/text/text.d.ts +30 -0
  172. package/libs/components/text/text.js +4 -0
  173. package/libs/components/text/text.js.map +1 -0
  174. package/libs/icons.cjs +3 -2
  175. package/libs/icons.d.cts +3 -1
  176. package/libs/icons.d.ts +3 -1
  177. package/libs/icons.js +2 -1
  178. package/libs/index.cjs +152 -61
  179. package/libs/index.cjs.map +1 -1
  180. package/libs/index.css +1 -1
  181. package/libs/index.css.map +1 -1
  182. package/libs/index.d.cts +65 -472
  183. package/libs/index.d.ts +65 -472
  184. package/libs/index.js +24 -7
  185. package/libs/index.js.map +1 -1
  186. package/libs/inputs-f3a216db.d.ts +45 -0
  187. package/libs/ui-9a6f9f8d.d.ts +24 -0
  188. package/package.json +87 -2
  189. package/src/components/README.mdx +1 -1
  190. package/src/components/alert/README.mdx +1 -1
  191. package/src/components/alert/alert.stories.tsx +2 -2
  192. package/src/components/alert/elements/README.mdx +1 -1
  193. package/src/components/alert/elements/dismiss-button.stories.tsx +2 -2
  194. package/src/components/badge/badge.mdx +1 -1
  195. package/src/components/badge/badge.stories.tsx +2 -2
  196. package/src/components/badge/badge.tsx +11 -19
  197. package/src/components/breadcrumbs/README.mdx +1 -1
  198. package/src/components/breadcrumbs/breadcrumb.stories.tsx +2 -2
  199. package/src/components/button.ts +2 -0
  200. package/src/components/buttons/README.mdx +1 -1
  201. package/src/components/buttons/button.stories.tsx +2 -2
  202. package/src/components/buttons/button.test.tsx +1 -1
  203. package/src/components/card.ts +2 -0
  204. package/src/components/cards/README.md +80 -0
  205. package/src/components/cards/card.stories.tsx +2 -2
  206. package/src/components/details/README.mdx +1 -1
  207. package/src/components/details/details.scss +7 -0
  208. package/src/components/details/details.stories.tsx +2 -2
  209. package/src/components/details/details.tsx +11 -18
  210. package/src/components/dialog/README.mdx +1 -1
  211. package/src/components/dialog/dialog-modal.stories.tsx +2 -2
  212. package/src/components/dialog/dialog-modal.tsx +1 -1
  213. package/src/components/dialog/dialog.stories.tsx +2 -2
  214. package/src/components/dialog/views/README.mdx +1 -1
  215. package/src/components/dialog/views/dialog-header.stories.tsx +2 -2
  216. package/src/components/form/form.stories.tsx +2 -2
  217. package/src/components/form/input.stories.tsx +2 -2
  218. package/src/components/form/select.stories.tsx +2 -2
  219. package/src/components/fp.test.tsx +52 -50
  220. package/src/components/heading/heading.stories.tsx +2 -2
  221. package/src/components/heading/heading.tsx +12 -24
  222. package/src/components/icons/icon.stories.tsx +1 -1
  223. package/src/components/images/figure.stories.tsx +2 -2
  224. package/src/components/images/img.stories.tsx +2 -2
  225. package/src/components/layout/footer.stories.tsx +10 -19
  226. package/src/components/layout/landmarks.stories.tsx +22 -24
  227. package/src/components/layout/main.stories.tsx +21 -25
  228. package/src/components/link/link.stories.tsx +2 -2
  229. package/src/components/list/list.stories.tsx +2 -2
  230. package/src/components/modal.ts +1 -0
  231. package/src/components/nav/nav.stories.tsx +2 -2
  232. package/src/components/popover/popover.stories.tsx +2 -2
  233. package/src/components/progress/progress.stories.tsx +1 -1
  234. package/src/components/tag/tag.stories.tsx +2 -2
  235. package/src/components/text/text.stories.tsx +2 -2
  236. package/src/components/text/text.tsx +50 -49
  237. package/src/components/text-to-speech/TextToSpeech.stories.tsx +1 -1
  238. package/src/decorators/instructions.tsx +2 -1
  239. package/src/index.ts +43 -19
  240. package/src/patterns/page/page-header.stories.tsx +2 -2
  241. package/src/styles/details/details.css +8 -0
  242. package/src/styles/details/details.css.map +1 -1
  243. package/src/styles/index.css +8 -0
  244. package/src/styles/index.css.map +1 -1
  245. package/libs/chunk-PWVRDQ3R.js +0 -8
  246. package/libs/chunk-PWVRDQ3R.js.map +0 -1
  247. package/libs/chunk-SVS4MX3U.cjs +0 -31
  248. package/libs/chunk-SVS4MX3U.cjs.map +0 -1
  249. package/src/components/cards/README.mdx +0 -133
  250. package/src/components/text/README.mdx +0 -98
@@ -3,7 +3,7 @@ import { render, screen } from "@testing-library/react";
3
3
  import { Button } from "./button";
4
4
  // import user from '@testing-library/user-event'
5
5
  import jest from "jest-mock";
6
- import { userEvent } from "@storybook/test";
6
+ import { userEvent } from "storybook/test";
7
7
 
8
8
  describe("Button", () => {
9
9
  it("renders a button element with the correct label", () => {
@@ -0,0 +1,2 @@
1
+ export { Card, Title, Content, Footer, type CardProps } from "./cards/card";
2
+ export { default } from "./cards/card";
@@ -0,0 +1,80 @@
1
+
2
+ # Card Component
3
+
4
+ The Card component is a versatile and reusable React component for creating card-like UI elements. It's part of the FPKit React component library.
5
+
6
+ ## Usage
7
+
8
+ ```tsx
9
+ import Card from 'libs/react/fpkit/src/components/cards/card';
10
+
11
+ <Card>
12
+ <Card.Title>Card Title</Card.Title>
13
+ <Card.Content>
14
+ This is the content of the card.
15
+ </Card.Content>
16
+ </Card>
17
+ ```
18
+
19
+ ## Components
20
+
21
+ ### Card
22
+
23
+ The main container component for the card.
24
+
25
+ #### Props
26
+
27
+ - `elm?: 'div' | 'aside' | 'section' | 'article'` - HTML element to render as (default: 'div')
28
+ - `title?: React.ReactNode` - Card title
29
+ - `footer?: React.ReactNode` - Card footer
30
+ - `styles?: React.CSSProperties` - Inline styles
31
+ - `classes?: string` - Additional CSS classes
32
+ - `id?: string` - Unique ID for the card
33
+
34
+ All other props are passed through to the underlying UI component.
35
+
36
+ ### Card.Title
37
+
38
+ A sub-component for rendering the card's title.
39
+
40
+ #### Props
41
+
42
+ - `as?: React.ElementType` - HTML element to render as (default: 'h3')
43
+ - `className?: string` - Additional CSS classes
44
+ - `styles?: React.CSSProperties` - Inline styles
45
+
46
+ ### Card.Content
47
+
48
+ A sub-component for rendering the card's main content.
49
+
50
+ #### Props
51
+
52
+ - `className?: string` - Additional CSS classes
53
+ - `styles?: React.CSSProperties` - Inline styles
54
+
55
+ ## Styling
56
+
57
+ The component uses CSS classes for styling:
58
+
59
+ - `.card-title` for the title
60
+ - `.card-content` for the content
61
+
62
+ You can override these classes or provide additional styling through the `className` and `styles` props.
63
+
64
+ ## Accessibility
65
+
66
+ The Card component is designed with accessibility in mind:
67
+
68
+ - It uses semantic HTML elements (`div`, `aside`, `section`, or `article`) for the main container.
69
+ - The Title component defaults to using an `h3` element, which can be changed if needed.
70
+ - The Content component uses an `article` element for semantic structure.
71
+
72
+ ## TypeScript
73
+
74
+ This component is written in TypeScript and provides type definitions for all props and sub-components.
75
+
76
+ ## Contributing
77
+
78
+ When contributing to this component, please follow the established code style and conventions. Ensure all changes are well-tested and documented.
79
+
80
+ This README provides an overview of the Card component, its usage, available props, styling information, and accessibility considerations. It also mentions that the component is written in TypeScript and provides guidance for contributors.
@@ -1,5 +1,5 @@
1
- import { StoryObj, Meta } from "@storybook/react";
2
- // import { within, userEvent, screen } from "@storybook/test";
1
+ import { StoryObj, Meta } from "@storybook/react-vite";
2
+ // import { within, userEvent, screen } from "storybook/test";
3
3
 
4
4
  import Card from "./card";
5
5
  // import './card.scss'
@@ -1,4 +1,4 @@
1
- import { Meta } from "@storybook/blocks";
1
+ import { Meta } from "@storybook/addon-docs/blocks";
2
2
 
3
3
  <Meta title="FP.REACT Components/Details/Readme" />
4
4
 
@@ -64,6 +64,13 @@ details {
64
64
  border-top-right-radius: var(--details-radius);
65
65
  transition: var(--summary-transitions);
66
66
 
67
+ @supports (transition-behavior: allow-discrete) {
68
+ @starting-style {
69
+ border-bottom: none;
70
+ transition: var(--summary-transitions);
71
+ }
72
+ }
73
+
67
74
  &::-webkit-details-marker {
68
75
  display: none;
69
76
  }
@@ -1,5 +1,5 @@
1
- import { StoryObj, Meta } from "@storybook/react";
2
- import { within, expect, userEvent } from "@storybook/test";
1
+ import { StoryObj, Meta } from "@storybook/react-vite";
2
+ import { within, expect, userEvent } from "storybook/test";
3
3
 
4
4
  import Details from "./details";
5
5
  import Icons from "../icons/icon";
@@ -15,25 +15,18 @@ type DetailsProps = {
15
15
  } & React.ComponentProps<"details"> &
16
16
  Partial<React.ComponentProps<typeof UI>>;
17
17
 
18
- /**
19
- * A React component that renders a details element with a summary and content.
18
+ /**3
19
+ * Details component props interface.
20
20
  *
21
- * @param summary - The summary text shown for the details.
22
- * @param ariaLabel - The aria-label element for accessibility.
23
- * @param icon - An optional icon to display in the summary.
24
- * @param styles - Optional styles to apply to the details element.
25
- * @param classes - Optional CSS classes to apply to the details element.
26
- * @param name - An optional name for the details element.
27
- * @param open - Whether the details element should be initially open.
28
- * @param onPointerDown - A callback function to be called when the summary is clicked.
29
- * @param onToggle - A callback function to be called when the details element is toggled.
30
- * @param children - The content to be displayed inside the details element.
31
- * @param ref - A ref to the details element.
32
- * @param props - Additional props to be passed to the details element.
33
- * @example
34
- * <Details summary="Details" ariaLabel="Details">
35
- * <p>Details content</p>
36
- * </Details>
21
+ * @param {React.CSSProperties} [styles] - CSS styles object.
22
+ * @param {string} [classes] - Classnames string.
23
+ * @param {boolean} [open] - Whether the details is open.
24
+ * @param {(e: React.PointerEvent<HTMLDetailsElement>) => void} [onToggle] - onToggle callback.
25
+ * @param {(e: React.PointerEvent<HTMLDetailsElement>) => void} [onPointerDown] - onPointerDown callback.
26
+ * @param {ReactNode} children - The content inside the details.
27
+ * @param {string} [ariaLabel] - aria-label for accessibility.
28
+ * @param {React.Ref<any>} [ref] - Ref object.
29
+ * @param {Object} props - Other props.
37
30
  */
38
31
  export const Details = ({
39
32
  summary,
@@ -1,4 +1,4 @@
1
- import { Meta } from "@storybook/blocks";
1
+ import { Meta } from "@storybook/addon-docs/blocks";
2
2
 
3
3
  <Meta title="FP.REACT Components/Dialog/Readme" />
4
4
 
@@ -1,5 +1,5 @@
1
- import { StoryObj, Meta } from "@storybook/react";
2
- import { within, expect, userEvent, waitFor } from "@storybook/test";
1
+ import { StoryObj, Meta } from "@storybook/react-vite";
2
+ import { within, expect, userEvent, waitFor } from "storybook/test";
3
3
 
4
4
  import DialogModal from "./dialog-modal";
5
5
  import WithInstructions from "#/decorators/instructions";
@@ -108,4 +108,4 @@ export const DialogModal: React.FC<DialogModalProps> = ({
108
108
  );
109
109
  };
110
110
  export default DialogModal;
111
- DialogModal.displayName = "Dialog Modal";
111
+ DialogModal.displayName = "DialogModal";
@@ -1,5 +1,5 @@
1
- import { StoryObj, Meta, StoryFn } from "@storybook/react";
2
- import { within, expect, userEvent } from "@storybook/test";
1
+ import { StoryObj, Meta, StoryFn } from "@storybook/react-vite";
2
+ import { within, expect, userEvent } from "storybook/test";
3
3
 
4
4
  import Dialog from "./dialog";
5
5
  import React from "react";
@@ -1,4 +1,4 @@
1
- import { Meta } from "@storybook/blocks";
1
+ import { Meta } from "@storybook/addon-docs/blocks";
2
2
 
3
3
  <Meta title="FP.REACT Views/DialogHeader/Readme" />
4
4
 
@@ -1,5 +1,5 @@
1
- import { StoryObj, Meta } from "@storybook/react";
2
- import { within, expect } from "@storybook/test";
1
+ import { StoryObj, Meta } from "@storybook/react-vite";
2
+ import { within, expect } from "storybook/test";
3
3
 
4
4
  import DialogHeader from "./dialog-header";
5
5
 
@@ -1,5 +1,5 @@
1
- import { StoryObj, Meta } from "@storybook/react";
2
- import { within, expect } from "@storybook/test";
1
+ import { StoryObj, Meta } from "@storybook/react-vite";
2
+ import { within, expect } from "storybook/test";
3
3
 
4
4
  import Form from "./form";
5
5
  import "./form.scss";
@@ -1,5 +1,5 @@
1
- import { StoryObj, Meta } from "@storybook/react";
2
- import { within, userEvent, expect } from "@storybook/test";
1
+ import { StoryObj, Meta } from "@storybook/react-vite";
2
+ import { within, userEvent, expect } from "storybook/test";
3
3
 
4
4
  import Input from "./inputs";
5
5
  import "./form.scss";
@@ -1,5 +1,5 @@
1
- import { StoryObj, Meta } from "@storybook/react";
2
- import { within, expect } from "@storybook/test";
1
+ import { StoryObj, Meta } from "@storybook/react-vite";
2
+ import { within, expect } from "storybook/test";
3
3
 
4
4
  import Select from "./select";
5
5
  import React from "react";
@@ -1,56 +1,58 @@
1
- import React from 'react'
2
- import { render, screen } from '@testing-library/react'
3
- import FP from '../components/fp'
4
- import jest from 'jest-mock'
5
- import { userEvent } from '@storybook/test'
6
-
7
- describe('FP component', () => {
8
- it('renders a div by default', () => {
9
- const { container } = render(<FP />)
10
- expect(container.firstChild).toMatchSnapshot()
11
- })
12
-
13
- it('renders a span when specified', () => {
14
- const { container } = render(<FP as="span">Span</FP>)
15
- const span = container.querySelector('span')
16
- expect(span).toBeInTheDocument()
17
- })
18
-
19
- it('renders children', () => {
20
- const { container } = render(<FP>Hello, world!</FP>)
21
- expect(container.firstChild).toHaveTextContent('Hello, world!')
22
- })
23
-
24
- it('applies styles', () => {
25
- const style = { backgroundColor: 'red;' }
26
- const { container } = render(<FP styles={style}>Hello, world!</FP>)
27
- expect(container.firstChild).toHaveStyle(style)
28
- })
29
-
30
- it('does not render styles when renderStyles is false', () => {
1
+ import React from "react";
2
+ import { render, screen } from "@testing-library/react";
3
+ import FP from "../components/fp";
4
+ import jest from "jest-mock";
5
+ import { userEvent } from "storybook/test";
6
+
7
+ describe("FP component", () => {
8
+ it("renders a div by default", () => {
9
+ const { container } = render(<FP />);
10
+ expect(container.firstChild).toMatchSnapshot();
11
+ });
12
+
13
+ it("renders a span when specified", () => {
14
+ const { container } = render(<FP as="span">Span</FP>);
15
+ const span = container.querySelector("span");
16
+ expect(span).toBeInTheDocument();
17
+ });
18
+
19
+ it("renders children", () => {
20
+ const { container } = render(<FP>Hello, world!</FP>);
21
+ expect(container.firstChild).toHaveTextContent("Hello, world!");
22
+ });
23
+
24
+ it("applies styles", () => {
25
+ const style = { backgroundColor: "red;" };
26
+ const { container } = render(<FP styles={style}>Hello, world!</FP>);
27
+ expect(container.firstChild).toHaveStyle(style);
28
+ });
29
+
30
+ it("does not render styles when renderStyles is false", () => {
31
31
  const { container } = render(
32
- <FP renderStyles={false} styles={{ backgroundColor: 'red' }}>
32
+ <FP renderStyles={false} styles={{ backgroundColor: "red" }}>
33
33
  Hello, world!
34
- </FP>,
35
- )
36
- expect(container.firstChild).not.toHaveStyle('background-color: red;')
37
- })
34
+ </FP>
35
+ );
36
+ expect(container.firstChild).not.toHaveStyle("background-color: red;");
37
+ });
38
38
 
39
- it('passes through props', async () => {
40
- const handleClick = jest.fn()
39
+ it("passes through props", async () => {
40
+ const handleClick = jest.fn();
41
41
  const { container } = render(
42
42
  <FP as="button" onClick={handleClick}>
43
43
  Hello, world!
44
- </FP>,
45
- )
46
-
47
- await userEvent.click(screen.getByRole('button'))
48
- expect(handleClick).toHaveBeenCalled()
49
- })
50
-
51
- it('applies ref', () => {
52
- const ref = React.createRef<HTMLDivElement>()
53
- render(<FP ref={ref}>Hello, world!</FP>)
54
- expect(ref.current).toBeTruthy()
55
- })
56
- })
44
+ </FP>
45
+ );
46
+
47
+ expect(container.firstChild).toBeInTheDocument();
48
+
49
+ await userEvent.click(screen.getByRole("button"));
50
+ expect(handleClick).toHaveBeenCalled();
51
+ });
52
+
53
+ it("applies ref", () => {
54
+ const ref = React.createRef<HTMLDivElement>();
55
+ render(<FP ref={ref}>Hello, world!</FP>);
56
+ expect(ref.current).toBeTruthy();
57
+ });
58
+ });
@@ -1,5 +1,5 @@
1
- import { StoryObj, Meta } from "@storybook/react";
2
- import { within, expect } from "@storybook/test";
1
+ import { StoryObj, Meta } from "@storybook/react-vite";
2
+ import { within, expect } from "storybook/test";
3
3
 
4
4
  import Heading from "./heading";
5
5
 
@@ -1,27 +1,15 @@
1
- import React from "react";
2
- import UI from "#components/ui";
1
+ import React from 'react'
2
+ import UI from '#components/ui'
3
+ import { type } from 'os'
3
4
 
4
5
  export type TitleProps = {
5
- children: React.ReactNode;
6
- type: "h1" | "h2" | "h3" | "h4" | "h5" | "h6";
7
- ui?: string;
8
- } & React.ComponentProps<typeof UI>;
6
+ children: React.ReactNode
7
+ type: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6'
8
+ ui?: string
9
+ } & React.ComponentProps<typeof UI>
9
10
 
10
- /**
11
- * A flexible heading component that renders different heading levels.
12
- *
13
- * @component
14
- * @param {'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6'} [props.type='h3'] - The heading level to render
15
- * @param {string} [props.id] - Optional ID attribute for the heading
16
- * @param {React.CSSProperties} [props.styles] - Custom styles to apply to the heading
17
- * @param {string} [props.ui] - Custom UI modifier to be added as a data attribute
18
- * @param {ReactNode} props.children - The content to be rendered within the heading
19
- * @param {Object} [props] - Additional props to be spread onto the heading element
20
- *
21
- * @returns {JSX.Element} A heading element of the specified type
22
- */
23
11
  const Heading = ({
24
- type = "h3",
12
+ type = 'h3',
25
13
  id,
26
14
  styles,
27
15
  ui,
@@ -32,8 +20,8 @@ const Heading = ({
32
20
  <UI as={type} id={id} styles={styles} data-ui={ui} {...props}>
33
21
  {children}
34
22
  </UI>
35
- );
36
- };
23
+ )
24
+ }
37
25
 
38
- export default Heading;
39
- Heading.displayName = "Heading";
26
+ export default Heading
27
+ Heading.displayName = 'Heading'
@@ -1,6 +1,6 @@
1
1
  import * as React from "react";
2
2
 
3
- import { Meta, StoryObj } from "@storybook/react";
3
+ import { Meta, StoryObj } from "@storybook/react-vite";
4
4
 
5
5
  import { Button } from "#components/buttons/button";
6
6
  import { Icon } from "./icon";
@@ -1,5 +1,5 @@
1
- import { StoryObj, Meta } from "@storybook/react";
2
- import { within, expect } from "@storybook/test";
1
+ import { StoryObj, Meta } from "@storybook/react-vite";
2
+ import { within, expect } from "storybook/test";
3
3
 
4
4
  import Figure from "./figure";
5
5
 
@@ -1,5 +1,5 @@
1
- import { StoryObj, Meta } from "@storybook/react";
2
- import { within, expect } from "@storybook/test";
1
+ import { StoryObj, Meta } from "@storybook/react-vite";
2
+ import { within, expect } from "storybook/test";
3
3
 
4
4
  import Img from "./img";
5
5
 
@@ -1,34 +1,25 @@
1
- import { StoryObj, Meta } from '@storybook/react'
1
+ import { StoryObj, Meta } from "@storybook/react-vite";
2
2
  /**
3
3
  * Import testing library dependencies
4
4
  */
5
- import { within, userEvent } from '@storybook/test'
5
+ // import { within, userEvent } from "storybook/test";
6
6
 
7
7
  /**
8
8
  * Import jest matchers
9
9
  */
10
10
 
11
-
12
- import { Footer } from './landmarks'
11
+ import { Footer } from "./landmarks";
13
12
 
14
13
  const meta: Meta<typeof Footer> = {
15
- title: 'FP.React Components/Layout/Landmarks',
14
+ title: "FP.React Components/Layout/Landmarks",
16
15
  component: Footer,
17
16
  args: {
18
- children: 'Main Landmark',
19
- // @ts-ignore
20
- 'data-testid': 'main',
17
+ children: "Main Landmark",
18
+ "data-testid": "main",
21
19
  },
22
- } as Meta
23
-
24
- const mainChildren = () => (
25
- <>
26
- <h2>Header Title</h2>
27
- <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Vero, unde?</p>
28
- </>
29
- )
20
+ } as Meta;
30
21
 
31
- export default meta
32
- type Story = StoryObj<typeof Footer>
22
+ export default meta;
23
+ type Story = StoryObj<typeof Footer>;
33
24
 
34
- export const BasicFooter: Story = {}
25
+ export const BasicFooter: Story = {};
@@ -1,54 +1,52 @@
1
- import { StoryObj, Meta } from '@storybook/react'
1
+ import { StoryObj, Meta } from "@storybook/react-vite";
2
2
  /**
3
3
  * Import testing library dependencies
4
4
  */
5
- import { within, expect } from '@storybook/test'
5
+ import { within, expect } from "storybook/test";
6
6
 
7
7
  /**
8
8
  * Import jest matchers
9
9
  */
10
10
 
11
+ import { Header } from "./landmarks";
11
12
 
12
- import { Header } from './landmarks'
13
-
14
- import Img from '#components/images/img'
13
+ import Img from "#components/images/img";
15
14
 
16
15
  const meta: Meta<typeof Header> = {
17
- title: 'FP.React Components/Layout/Landmarks',
16
+ title: "FP.React Components/Layout/Landmarks",
18
17
  component: Header,
19
18
  args: {
20
- children: 'Default Header',
21
- // @ts-ignore
22
- 'data-testid': 'banner',
19
+ children: "Default Header",
20
+ "data-testid": "banner",
23
21
  },
24
- } as Meta
22
+ } as Meta;
25
23
 
26
24
  const headerChildren = () => (
27
25
  <>
28
26
  <h2>Header Title</h2>
29
27
  <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Vero, unde?</p>
30
28
  </>
31
- )
29
+ );
32
30
 
33
- export default meta
34
- type Story = StoryObj<typeof Header>
31
+ export default meta;
32
+ type Story = StoryObj<typeof Header>;
35
33
 
36
- export const LandmarkDefault: Story = {}
34
+ export const LandmarkDefault: Story = {};
37
35
 
38
36
  export const HeroHeader: Story = {
39
37
  args: {
40
38
  children: headerChildren(),
41
39
  headerBackground: <Img src="https://picsum.photos/2000/1000" alt="" />,
42
- styles: { color: 'red' },
43
- classNames: 'header-class',
44
- 'data-styles': 'blue',
40
+ styles: { color: "red" },
41
+ classNames: "header-class",
42
+ "data-styles": "blue",
45
43
  },
46
44
  play: async ({ canvasElement }) => {
47
- const canvas = within(canvasElement)
48
- const header = canvas.getByRole('banner')
49
- expect(header).toBeInTheDocument()
50
- const title = canvas.getByRole('heading')
51
- expect(title).toBeInTheDocument()
52
- expect(title).toHaveTextContent(/header title/i)
45
+ const canvas = within(canvasElement);
46
+ const header = canvas.getByRole("banner");
47
+ expect(header).toBeInTheDocument();
48
+ const title = canvas.getByRole("heading");
49
+ expect(title).toBeInTheDocument();
50
+ expect(title).toHaveTextContent(/header title/i);
53
51
  },
54
- } as Story
52
+ } as Story;