@fpkit/acss 0.4.4

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 (297) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +52 -0
  3. package/dist/chunk-77CZU5XZ.cjs +9 -0
  4. package/dist/chunk-77CZU5XZ.cjs.map +1 -0
  5. package/dist/chunk-D43FJIRQ.cjs +31 -0
  6. package/dist/chunk-D43FJIRQ.cjs.map +1 -0
  7. package/dist/chunk-GJWMCDFS.js +9 -0
  8. package/dist/chunk-GJWMCDFS.js.map +1 -0
  9. package/dist/chunk-PCDUGD3C.js +5 -0
  10. package/dist/chunk-PCDUGD3C.js.map +1 -0
  11. package/dist/hooks.cjs +10 -0
  12. package/dist/hooks.cjs.map +1 -0
  13. package/dist/hooks.d.cts +32 -0
  14. package/dist/hooks.d.ts +32 -0
  15. package/dist/hooks.js +8 -0
  16. package/dist/hooks.js.map +1 -0
  17. package/dist/icon-e6044c73.d.ts +227 -0
  18. package/dist/icons.cjs +73 -0
  19. package/dist/icons.cjs.map +1 -0
  20. package/dist/icons.d.cts +252 -0
  21. package/dist/icons.d.ts +252 -0
  22. package/dist/icons.js +4 -0
  23. package/dist/icons.js.map +1 -0
  24. package/dist/index.cjs +59 -0
  25. package/dist/index.cjs.map +1 -0
  26. package/dist/index.d.cts +566 -0
  27. package/dist/index.d.ts +566 -0
  28. package/dist/index.js +11 -0
  29. package/dist/index.js.map +1 -0
  30. package/libs/chunk-GCGKYLDG.js +7 -0
  31. package/libs/chunk-GCGKYLDG.js.map +1 -0
  32. package/libs/chunk-PDD4N5P5.cjs +10 -0
  33. package/libs/chunk-PDD4N5P5.cjs.map +1 -0
  34. package/libs/chunk-QHIABQNQ.js +8 -0
  35. package/libs/chunk-QHIABQNQ.js.map +1 -0
  36. package/libs/chunk-ZOHIKF6I.cjs +31 -0
  37. package/libs/chunk-ZOHIKF6I.cjs.map +1 -0
  38. package/libs/components/badge/badge.css +1 -0
  39. package/libs/components/badge/badge.css.map +1 -0
  40. package/libs/components/badge/badge.min.css +3 -0
  41. package/libs/components/breadcrumbs/breadcrumb.css +1 -0
  42. package/libs/components/breadcrumbs/breadcrumb.css.map +1 -0
  43. package/libs/components/breadcrumbs/breadcrumb.min.css +3 -0
  44. package/libs/components/buttons/button.css +1 -0
  45. package/libs/components/buttons/button.css.map +1 -0
  46. package/libs/components/buttons/button.min.css +3 -0
  47. package/libs/components/cards/card-style.css +1 -0
  48. package/libs/components/cards/card-style.css.map +1 -0
  49. package/libs/components/cards/card-style.min.css +3 -0
  50. package/libs/components/cards/card.css +1 -0
  51. package/libs/components/cards/card.css.map +1 -0
  52. package/libs/components/cards/card.min.css +3 -0
  53. package/libs/components/details/details.css +1 -0
  54. package/libs/components/details/details.css.map +1 -0
  55. package/libs/components/details/details.min.css +3 -0
  56. package/libs/components/form/form.css +1 -0
  57. package/libs/components/form/form.css.map +1 -0
  58. package/libs/components/form/form.min.css +3 -0
  59. package/libs/components/icons/icon.css +1 -0
  60. package/libs/components/icons/icon.css.map +1 -0
  61. package/libs/components/icons/icon.min.css +3 -0
  62. package/libs/components/images/img.css +1 -0
  63. package/libs/components/images/img.css.map +1 -0
  64. package/libs/components/images/img.min.css +3 -0
  65. package/libs/components/layout/landmarks.css +1 -0
  66. package/libs/components/layout/landmarks.css.map +1 -0
  67. package/libs/components/layout/landmarks.min.css +3 -0
  68. package/libs/components/link/link.css +1 -0
  69. package/libs/components/link/link.css.map +1 -0
  70. package/libs/components/link/link.min.css +3 -0
  71. package/libs/components/nav/nav.css +1 -0
  72. package/libs/components/nav/nav.css.map +1 -0
  73. package/libs/components/nav/nav.min.css +3 -0
  74. package/libs/components/progress/progress.css +1 -0
  75. package/libs/components/progress/progress.css.map +1 -0
  76. package/libs/components/progress/progress.min.css +3 -0
  77. package/libs/components/styles/index.css +1 -0
  78. package/libs/components/styles/index.css.map +1 -0
  79. package/libs/components/styles/index.min.css +3 -0
  80. package/libs/components/tag/tag.css +1 -0
  81. package/libs/components/tag/tag.css.map +1 -0
  82. package/libs/components/tag/tag.min.css +3 -0
  83. package/libs/components/text-to-speech/text-to-speech.css +1 -0
  84. package/libs/components/text-to-speech/text-to-speech.css.map +1 -0
  85. package/libs/components/text-to-speech/text-to-speech.min.css +3 -0
  86. package/libs/hooks.cjs +12 -0
  87. package/libs/hooks.cjs.map +1 -0
  88. package/libs/hooks.d.cts +32 -0
  89. package/libs/hooks.d.ts +32 -0
  90. package/libs/hooks.js +3 -0
  91. package/libs/hooks.js.map +1 -0
  92. package/libs/icons-1f5afc0c.d.ts +318 -0
  93. package/libs/icons.cjs +12 -0
  94. package/libs/icons.cjs.map +1 -0
  95. package/libs/icons.d.cts +2 -0
  96. package/libs/icons.d.ts +2 -0
  97. package/libs/icons.js +3 -0
  98. package/libs/icons.js.map +1 -0
  99. package/libs/index.cjs +71 -0
  100. package/libs/index.cjs.map +1 -0
  101. package/libs/index.css +1 -0
  102. package/libs/index.css.map +1 -0
  103. package/libs/index.d.cts +551 -0
  104. package/libs/index.d.ts +551 -0
  105. package/libs/index.js +11 -0
  106. package/libs/index.js.map +1 -0
  107. package/package.json +125 -0
  108. package/src/App.css +42 -0
  109. package/src/App.tsx +35 -0
  110. package/src/__snapshots__/App.test.tsx.snap +56 -0
  111. package/src/components/.gitkeep +0 -0
  112. package/src/components/__snapshots__/fp.test.tsx.snap +3 -0
  113. package/src/components/badge/badge.scss +20 -0
  114. package/src/components/badge/badge.stories.tsx +54 -0
  115. package/src/components/badge/badge.tsx +17 -0
  116. package/src/components/breadcrumbs/bc-item.tsx +20 -0
  117. package/src/components/breadcrumbs/breadcrumb.scss +35 -0
  118. package/src/components/breadcrumbs/breadcrumb.stories.tsx +92 -0
  119. package/src/components/breadcrumbs/breadcrumb.tsx +218 -0
  120. package/src/components/buttons/button.scss +115 -0
  121. package/src/components/buttons/button.stories.tsx +57 -0
  122. package/src/components/buttons/button.test.tsx +104 -0
  123. package/src/components/buttons/button.tsx +64 -0
  124. package/src/components/cards/card-style.scss +0 -0
  125. package/src/components/cards/card.scss +43 -0
  126. package/src/components/cards/card.stories.tsx +114 -0
  127. package/src/components/cards/card.test.tsx +30 -0
  128. package/src/components/cards/card.tsx +135 -0
  129. package/src/components/cards/flex-card.tsx +15 -0
  130. package/src/components/details/details.scss +75 -0
  131. package/src/components/details/details.stories.tsx +122 -0
  132. package/src/components/details/details.tsx +77 -0
  133. package/src/components/form/README.mdx +70 -0
  134. package/src/components/form/fields.tsx +45 -0
  135. package/src/components/form/form.scss +87 -0
  136. package/src/components/form/form.stories.tsx +49 -0
  137. package/src/components/form/form.tsx +71 -0
  138. package/src/components/form/input.stories.tsx +155 -0
  139. package/src/components/form/inputs.tsx +84 -0
  140. package/src/components/form/select.stories.tsx +38 -0
  141. package/src/components/form/select.tsx +112 -0
  142. package/src/components/form/textarea.tsx +87 -0
  143. package/src/components/fp.test.tsx +56 -0
  144. package/src/components/fp.tsx +78 -0
  145. package/src/components/heading/heading.stories.tsx +75 -0
  146. package/src/components/heading/heading.tsx +27 -0
  147. package/src/components/icons/components/add.tsx +42 -0
  148. package/src/components/icons/components/arrow-down.tsx +52 -0
  149. package/src/components/icons/components/arrow-left.tsx +49 -0
  150. package/src/components/icons/components/arrow-right.tsx +52 -0
  151. package/src/components/icons/components/arrow-up.tsx +49 -0
  152. package/src/components/icons/components/chat.tsx +44 -0
  153. package/src/components/icons/components/code.tsx +50 -0
  154. package/src/components/icons/components/copy.tsx +51 -0
  155. package/src/components/icons/components/down.tsx +33 -0
  156. package/src/components/icons/components/home.tsx +57 -0
  157. package/src/components/icons/components/left.tsx +43 -0
  158. package/src/components/icons/components/minus.tsx +42 -0
  159. package/src/components/icons/components/pause-solid.tsx +48 -0
  160. package/src/components/icons/components/pause.tsx +63 -0
  161. package/src/components/icons/components/play-solid.tsx +44 -0
  162. package/src/components/icons/components/play.tsx +51 -0
  163. package/src/components/icons/components/remove.tsx +42 -0
  164. package/src/components/icons/components/resume-solid.tsx +52 -0
  165. package/src/components/icons/components/resume.tsx +57 -0
  166. package/src/components/icons/components/right.tsx +43 -0
  167. package/src/components/icons/components/star.tsx +38 -0
  168. package/src/components/icons/components/stop-solid.tsx +44 -0
  169. package/src/components/icons/components/stop.tsx +54 -0
  170. package/src/components/icons/components/svg.tsx +44 -0
  171. package/src/components/icons/components/up.tsx +31 -0
  172. package/src/components/icons/components/user.tsx +46 -0
  173. package/src/components/icons/icon.scss +15 -0
  174. package/src/components/icons/icon.stories.tsx +208 -0
  175. package/src/components/icons/icon.tsx +100 -0
  176. package/src/components/icons/index.ts +29 -0
  177. package/src/components/icons/types.ts +12 -0
  178. package/src/components/images/README.mdx +43 -0
  179. package/src/components/images/figure.stories.tsx +34 -0
  180. package/src/components/images/figure.tsx +44 -0
  181. package/src/components/images/img.scss +43 -0
  182. package/src/components/images/img.stories.tsx +24 -0
  183. package/src/components/images/img.test.tsx +43 -0
  184. package/src/components/images/img.tsx +93 -0
  185. package/src/components/images/place-holder.png +0 -0
  186. package/src/components/kit.tsx +56 -0
  187. package/src/components/layout/_header.scss +72 -0
  188. package/src/components/layout/footer.stories.tsx +34 -0
  189. package/src/components/layout/landmarks.scss +51 -0
  190. package/src/components/layout/landmarks.stories.tsx +54 -0
  191. package/src/components/layout/landmarks.tsx +149 -0
  192. package/src/components/layout/main.stories.tsx +90 -0
  193. package/src/components/link/link.scss +92 -0
  194. package/src/components/link/link.stories.tsx +74 -0
  195. package/src/components/link/link.tsx +48 -0
  196. package/src/components/list/list.stories.tsx +52 -0
  197. package/src/components/list/list.tsx +74 -0
  198. package/src/components/modal/dialog.tsx +50 -0
  199. package/src/components/modal/modal.tsx +85 -0
  200. package/src/components/nav/nav.scss +90 -0
  201. package/src/components/nav/nav.stories.tsx +96 -0
  202. package/src/components/nav/nav.tsx +76 -0
  203. package/src/components/popover/node_modules/.vitest/results.json +1 -0
  204. package/src/components/popover/popover.stories.tsx +31 -0
  205. package/src/components/popover/popover.test.tsx +39 -0
  206. package/src/components/popover/popover.tsx +85 -0
  207. package/src/components/progress/progress.scss +70 -0
  208. package/src/components/progress/progress.stories.tsx +51 -0
  209. package/src/components/progress/progress.tsx +82 -0
  210. package/src/components/readme.stories.mdx +7 -0
  211. package/src/components/styles/index.css +520 -0
  212. package/src/components/styles/index.css.map +1 -0
  213. package/src/components/tables/table-elements.tsx +57 -0
  214. package/src/components/tables/table.tsx +57 -0
  215. package/src/components/tag/tag.scss +56 -0
  216. package/src/components/tag/tag.stories.tsx +39 -0
  217. package/src/components/tag/tag.tsx +25 -0
  218. package/src/components/text/text.stories.tsx +67 -0
  219. package/src/components/text/text.tsx +93 -0
  220. package/src/components/text-to-speech/README.mdx +192 -0
  221. package/src/components/text-to-speech/TextInput.tsx +19 -0
  222. package/src/components/text-to-speech/TextToSpeech.stories.tsx +145 -0
  223. package/src/components/text-to-speech/TextToSpeech.tsx +94 -0
  224. package/src/components/text-to-speech/text-to-speech.scss +31 -0
  225. package/src/components/text-to-speech/useTextToSpeech.mdx +182 -0
  226. package/src/components/text-to-speech/useTextToSpeech.tsx +176 -0
  227. package/src/components/text-to-speech/views/TextToSpeechControls.tsx +117 -0
  228. package/src/components/ui.tsx +67 -0
  229. package/src/favicon.svg +15 -0
  230. package/src/hooks/popover/__snapshots__/popover.test.tsx.snap +88 -0
  231. package/src/hooks/popover/node_modules/.vitest/results.json +1 -0
  232. package/src/hooks/popover/popover.tsx +71 -0
  233. package/src/hooks/popover/use-popover.tsx +83 -0
  234. package/src/hooks.ts +1 -0
  235. package/src/icons.ts +1 -0
  236. package/src/index.css +13 -0
  237. package/src/index.scss +19 -0
  238. package/src/index.ts +35 -0
  239. package/src/libs/content.ts +30 -0
  240. package/src/logo.svg +7 -0
  241. package/src/main.tsx +10 -0
  242. package/src/patterns/.gitkeep +0 -0
  243. package/src/patterns/page/page-header.stories.tsx +44 -0
  244. package/src/patterns/page/page-header.tsx +78 -0
  245. package/src/sass/_elements.scss +17 -0
  246. package/src/sass/_globals.scss +162 -0
  247. package/src/sass/_layout.scss +51 -0
  248. package/src/sass/_loading-animation.scss +35 -0
  249. package/src/sass/_mixins.scss +10 -0
  250. package/src/sass/_properties.scss +106 -0
  251. package/src/sass/_reset.scss +183 -0
  252. package/src/sass/_type.scss +43 -0
  253. package/src/setupTest.ts +1 -0
  254. package/src/styles/badge/badge.css +22 -0
  255. package/src/styles/badge/badge.css.map +1 -0
  256. package/src/styles/breadcrumbs/breadcrumb.css +42 -0
  257. package/src/styles/breadcrumbs/breadcrumb.css.map +1 -0
  258. package/src/styles/buttons/button.css +93 -0
  259. package/src/styles/buttons/button.css.map +1 -0
  260. package/src/styles/cards/card-style.css +3 -0
  261. package/src/styles/cards/card-style.css.map +1 -0
  262. package/src/styles/cards/card.css +48 -0
  263. package/src/styles/cards/card.css.map +1 -0
  264. package/src/styles/details/details.css +69 -0
  265. package/src/styles/details/details.css.map +1 -0
  266. package/src/styles/dropdowns/dropdown.css.map +1 -0
  267. package/src/styles/form/form.css +93 -0
  268. package/src/styles/form/form.css.map +1 -0
  269. package/src/styles/form/style.css.map +1 -0
  270. package/src/styles/icons/icon.css +16 -0
  271. package/src/styles/icons/icon.css.map +1 -0
  272. package/src/styles/images/img.css +42 -0
  273. package/src/styles/images/img.css.map +1 -0
  274. package/src/styles/index.css +1330 -0
  275. package/src/styles/index.css.map +1 -0
  276. package/src/styles/layout/landmarks.css +155 -0
  277. package/src/styles/layout/landmarks.css.map +1 -0
  278. package/src/styles/link/link.css +88 -0
  279. package/src/styles/link/link.css.map +1 -0
  280. package/src/styles/nav/nav.css +85 -0
  281. package/src/styles/nav/nav.css.map +1 -0
  282. package/src/styles/progress/progress.css +54 -0
  283. package/src/styles/progress/progress.css.map +1 -0
  284. package/src/styles/progress/sass/progress.css.map +1 -0
  285. package/src/styles/styles/index.css +562 -0
  286. package/src/styles/styles/index.css.map +1 -0
  287. package/src/styles/tag/badge.css.map +1 -0
  288. package/src/styles/tag/tag.css +71 -0
  289. package/src/styles/tag/tag.css.map +1 -0
  290. package/src/styles/text-to-speech/text-to-speech.css +32 -0
  291. package/src/styles/text-to-speech/text-to-speech.css.map +1 -0
  292. package/src/test/setup.ts +6 -0
  293. package/src/types/component-props.ts +36 -0
  294. package/src/types/index.ts +2 -0
  295. package/src/types/input-props.ts +28 -0
  296. package/src/types/shared.ts +57 -0
  297. package/src/vite-env.d.ts +1 -0
@@ -0,0 +1,44 @@
1
+ import * as React from 'react'
2
+
3
+ import { IconProps } from '../types'
4
+
5
+ const defaultStyes = {
6
+ display: 'inline-flex',
7
+ alignItems: 'center',
8
+ width: 'auto',
9
+ }
10
+
11
+ export const Svg = ({
12
+ fill,
13
+ strokeColor,
14
+ styles,
15
+ size = 24,
16
+ role = 'img',
17
+ alt,
18
+ children,
19
+ ...props
20
+ }: Pick<
21
+ IconProps,
22
+ 'strokeColor' | 'fill' | 'styles' | 'size' | 'role' | 'alt' | 'children'
23
+ >) => {
24
+ return (
25
+ <svg
26
+ fill={fill}
27
+ stroke={strokeColor}
28
+ height={size}
29
+ width={size}
30
+ viewBox="0 0 24 24"
31
+ xmlns="http://www.w3.org/2000/svg"
32
+ style={styles}
33
+ role={role}
34
+ aria-label={alt}
35
+ {...props}
36
+ >
37
+ {children}
38
+ </svg>
39
+ )
40
+ }
41
+
42
+ export default Svg
43
+ Svg.displayName = 'Svg'
44
+ Svg.styles = defaultStyes
@@ -0,0 +1,31 @@
1
+ import { IconProps } from '../types'
2
+ import React from 'react'
3
+ import Svg from './svg'
4
+
5
+ const defaultStyles = { ...Svg.styles }
6
+ export const Up = ({
7
+ size = 16,
8
+ fill = 'currentColor',
9
+ styles,
10
+ role = 'img',
11
+ alt = 'Up arrow icon',
12
+ ...props
13
+ }: Pick<
14
+ IconProps,
15
+ 'strokeColor' | 'fill' | 'styles' | 'size' | 'role' | 'alt'
16
+ >) => {
17
+ return (
18
+ <Svg size={size} alt={alt} styles={styles} role={role} {...props}>
19
+ <g fill={fill}>
20
+ <path
21
+ d="M22,18a1,1,0,0,1-.707-.293L12,8.414,2.707,17.707a1,1,0,0,1-1.414-1.414l10-10a1,1,0,0,1,1.414,0l10,10A1,1,0,0,1,22,18Z"
22
+ fill={fill}
23
+ />
24
+ </g>
25
+ </Svg>
26
+ )
27
+ }
28
+
29
+ export default Up
30
+ Up.displayName = 'Up'
31
+ Up.styles = defaultStyles
@@ -0,0 +1,46 @@
1
+ import { IconProps } from '../types'
2
+ import React from 'react'
3
+ import Svg from './svg'
4
+
5
+ const defaultStyles = {
6
+ ...Svg.styles,
7
+ fill: 'none',
8
+ stroke: 'currentColor',
9
+ }
10
+
11
+ export const User = ({
12
+ size = 16,
13
+ fill = 'none',
14
+ strokeColor = 'currentColor',
15
+ styles,
16
+ alt = 'User Icon',
17
+ role,
18
+ ...props
19
+ }: Pick<
20
+ IconProps,
21
+ 'strokeColor' | 'fill' | 'styles' | 'size' | 'role' | 'alt'
22
+ >) => {
23
+ return (
24
+ <Svg size={size} role={role} alt={alt} styles={styles} {...props}>
25
+ <g
26
+ fill={fill}
27
+ stroke={strokeColor}
28
+ strokeLinecap="square"
29
+ strokeLinejoin="miter"
30
+ strokeMiterlimit="10"
31
+ strokeWidth="2"
32
+ >
33
+ <circle cx="12" cy="5.5" fill="none" r="4.5" />
34
+ <path
35
+ d="M12,14c-4.971,0-9,4.029-9,9H21c0-4.971-4.029-9-9-9Z"
36
+ fill="none"
37
+ stroke={strokeColor}
38
+ />
39
+ </g>
40
+ </Svg>
41
+ )
42
+ }
43
+
44
+ export default User
45
+ User.styles = defaultStyles
46
+ User.displayName = 'User'
@@ -0,0 +1,15 @@
1
+ [data-icon] {
2
+ --icon-display: inline-flex;
3
+ --icon-direction: row;
4
+ --icons-placement: center;
5
+ --icon-width: max-content;
6
+ --icon-gap: 0.2rem;
7
+ --icon-height: max-content;
8
+
9
+ display: var(--icon-display);
10
+ flex-direction: var(--icon-direction);
11
+ gap: var(--icon-gap);
12
+ place-items: var(--icons-placement);
13
+ width: var(--icon-width);
14
+ height: var(--icon-height);
15
+ }
@@ -0,0 +1,208 @@
1
+ import * as React from 'react'
2
+
3
+ import { Meta, StoryObj } from '@storybook/react'
4
+
5
+ import { Button } from '#components/buttons/button'
6
+ import { Icon } from './icon'
7
+ import './icon.scss'
8
+
9
+ const meta: Meta<typeof Icon> = {
10
+ component: Icon,
11
+ title: 'FP.React Components/Icons',
12
+ args: {
13
+ // styles: Icon.styles,
14
+ },
15
+ decorators: [
16
+ (Story) => (
17
+ <section style={{ minWidth: '60vw', textAlign: 'center' }}>
18
+ <Story />
19
+ </section>
20
+ ),
21
+ ],
22
+ } as Meta
23
+
24
+ export default meta
25
+ type Story = StoryObj<typeof Icon>
26
+
27
+ export const IconSet = {
28
+ args: {},
29
+ render: (...args: any) => {
30
+ return (
31
+ <Icon>
32
+ <Icon.Code styles={Icon.Code.styles} />
33
+ Code Icon{' '}
34
+ </Icon>
35
+ )
36
+ },
37
+ }
38
+
39
+ export const IconButton = {
40
+ args: {},
41
+ render: (...args: any) => {
42
+ return (
43
+ <>
44
+ <Button type="button">
45
+ <Icon>
46
+ <Icon.Code />
47
+ </Icon>
48
+ Click Me
49
+ </Button>
50
+ </>
51
+ )
52
+ },
53
+ }
54
+
55
+ export const Code: Story = {
56
+ args: {
57
+ children: <Icon.Code role="img" aria-label="code icon" />,
58
+ },
59
+ } as Story
60
+
61
+ export const Home: Story = {
62
+ args: {
63
+ styles: Icon.styles,
64
+ children: (
65
+ <>
66
+ <Icon.Home size={16} />
67
+ </>
68
+ ),
69
+ },
70
+ } as Story
71
+
72
+ export const Add: Story = {
73
+ args: {
74
+ children: <Icon.Add />,
75
+ },
76
+ } as Story
77
+
78
+ export const ArrowDown: Story = {
79
+ args: {
80
+ children: <Icon.ArrowDown />,
81
+ },
82
+ } as Story
83
+
84
+ export const ArrowLeft: Story = {
85
+ args: {
86
+ children: <Icon.ArrowLeft />,
87
+ },
88
+ } as Story
89
+
90
+ export const ArrowRight: Story = {
91
+ args: {
92
+ children: <Icon.ArrowRight />,
93
+ },
94
+ } as Story
95
+
96
+ export const ArrowUp: Story = {
97
+ args: {
98
+ children: <Icon.ArrowUp />,
99
+ },
100
+ } as Story
101
+
102
+ export const Chat: Story = {
103
+ args: {
104
+ children: <Icon.Chat />,
105
+ },
106
+ } as Story
107
+
108
+ export const User: Story = {
109
+ args: {
110
+ children: <Icon.User />,
111
+ },
112
+ } as Story
113
+
114
+ export const Left: Story = {
115
+ args: {
116
+ children: <Icon.Left />,
117
+ },
118
+ } as Story
119
+
120
+ export const Right: Story = {
121
+ args: {
122
+ children: <Icon.Right />,
123
+ },
124
+ } as Story
125
+
126
+ export const Up: Story = {
127
+ args: {
128
+ children: <Icon.Up />,
129
+ },
130
+ } as Story
131
+
132
+ export const Down: Story = {
133
+ args: {
134
+ children: <Icon.Down />,
135
+ },
136
+ } as Story
137
+
138
+ export const Minus: Story = {
139
+ args: {
140
+ children: <Icon.Minus />,
141
+ },
142
+ } as Story
143
+
144
+ export const Remove: Story = {
145
+ args: {
146
+ children: <Icon.Remove />,
147
+ },
148
+ } as Story
149
+
150
+ export const Star: Story = {
151
+ args: {
152
+ children: <Icon.Star />,
153
+ },
154
+ } as Story
155
+
156
+ export const Copy: Story = {
157
+ args: {
158
+ children: <Icon.Copy />,
159
+ },
160
+ } as Story
161
+
162
+ export const Play: Story = {
163
+ args: {
164
+ children: <Icon.Play />,
165
+ },
166
+ } as Story
167
+
168
+ export const Pause: Story = {
169
+ args: {
170
+ children: <Icon.Pause />,
171
+ },
172
+ } as Story
173
+
174
+ export const Resume: Story = {
175
+ args: {
176
+ children: <Icon.Resume />,
177
+ },
178
+ } as Story
179
+
180
+ export const Stop: Story = {
181
+ args: {
182
+ children: <Icon.Stop />,
183
+ },
184
+ } as Story
185
+
186
+ export const PlaySolid: Story = {
187
+ args: {
188
+ children: <Icon.PlaySolid />,
189
+ },
190
+ } as Story
191
+
192
+ export const PauseSolid: Story = {
193
+ args: {
194
+ children: <Icon.PauseSolid />,
195
+ },
196
+ } as Story
197
+
198
+ export const ResumeSolid: Story = {
199
+ args: {
200
+ children: <Icon.ResumeSolid />,
201
+ },
202
+ } as Story
203
+
204
+ export const StopSolid: Story = {
205
+ args: {
206
+ children: <Icon.StopSolid />,
207
+ },
208
+ } as Story
@@ -0,0 +1,100 @@
1
+ import {
2
+ Add,
3
+ ArrowDown,
4
+ ArrowLeft,
5
+ ArrowRight,
6
+ ArrowUp,
7
+ Chat,
8
+ Code,
9
+ Copy,
10
+ Down,
11
+ Home,
12
+ Left,
13
+ Minus,
14
+ Remove,
15
+ Right,
16
+ Star,
17
+ Up,
18
+ User,
19
+ Play,
20
+ Pause,
21
+ Stop,
22
+ Resume,
23
+ PlaySolid,
24
+ PauseSolid,
25
+ ResumeSolid,
26
+ StopSolid
27
+ } from './index'
28
+
29
+ import UI from '#components/ui'
30
+ import React from 'react'
31
+
32
+ /**
33
+ * The default styles object for the Icon component.
34
+ *
35
+ * @property {string} display - Sets display to 'inline-flex' to make Icon inline.
36
+ * @property {string} direction - Sets flex direction to 'row'.
37
+ * @property {string} gap - Sets gap between items to '.2rem'.
38
+ * @property {string} placeItems - Centers items vertically using 'center'.
39
+ * @property {string} width - Sets width to 'auto' for automatic sizing.
40
+ */
41
+ const defaultStyles = {
42
+ display: 'inline-flex',
43
+ direction: 'row',
44
+ gap: '.2rem',
45
+ placeItems: 'center',
46
+ width: 'auto',
47
+ }
48
+
49
+ export type IconProps = React.ComponentProps<typeof UI>
50
+
51
+ export const Icon = ({
52
+ id,
53
+ classes,
54
+ children,
55
+ styles,
56
+ ...props
57
+ }: IconProps) => {
58
+ return (
59
+ <UI
60
+ id={id}
61
+ as="span"
62
+ styles={styles}
63
+ className={classes}
64
+ data-icon
65
+ data-style="icons"
66
+ {...props}
67
+ >
68
+ {children}
69
+ </UI>
70
+ )
71
+ }
72
+
73
+ export default Icon
74
+ Icon.displayName = 'Icon'
75
+ Icon.styles = defaultStyles
76
+ Icon.Add = Add
77
+ Icon.ArrowDown = ArrowDown
78
+ Icon.ArrowLeft = ArrowLeft
79
+ Icon.ArrowRight = ArrowRight
80
+ Icon.ArrowUp = ArrowUp
81
+ Icon.Chat = Chat
82
+ Icon.Code = Code
83
+ Icon.Copy = Copy
84
+ Icon.Home = Home
85
+ Icon.Left = Left
86
+ Icon.Minus = Minus
87
+ Icon.Remove = Remove
88
+ Icon.Right = Right
89
+ Icon.Star = Star
90
+ Icon.Up = Up
91
+ Icon.Down = Down
92
+ Icon.User = User
93
+ Icon.Play = Play
94
+ Icon.Pause = Pause
95
+ Icon.Stop = Stop
96
+ Icon.Resume = Resume
97
+ Icon.ResumeSolid = ResumeSolid
98
+ Icon.PlaySolid = PlaySolid
99
+ Icon.PauseSolid = PauseSolid
100
+ Icon.StopSolid = StopSolid
@@ -0,0 +1,29 @@
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'
@@ -0,0 +1,12 @@
1
+ import { ComponentProps } from '#/types'
2
+
3
+ export interface IconProps extends Partial<ComponentProps> {
4
+ fill?: string
5
+ size?: number
6
+ strokeColor?: string
7
+ strokeWidth?: string
8
+ role?: string
9
+ alt?: string
10
+ width?: number
11
+ height?: number
12
+ }
@@ -0,0 +1,43 @@
1
+ # Images Directory
2
+
3
+ This directory contains React components and utilities related to rendering images in a web application. The key files and their purposes are as follows:
4
+
5
+ ## img.tsx
6
+
7
+ The `Img` component is a React component that renders an `<img>` element with additional props and functionality. It provides options to customize the image's source, alt text, dimensions, loading behavior, placeholder, fetch priority, and decoding method. It also supports callbacks for image load and error events.
8
+
9
+ ## img.scss
10
+
11
+ This file contains CSS styles for the `<img>` element and the `<figure>` element that can contain an image. It sets default styles for image sizing, aspect ratio, object fit, and positioning. It also styles the `<figure>` element to display the image and caption in a flex layout with a background color.
12
+
13
+ ## figure.tsx
14
+
15
+ The `Figure` component is a React component that renders a `<figure>` element with an image and an optional caption. It uses the `Img` component to render the image and provides props to set the image source, dimensions, and alt text, as well as the caption text.
16
+
17
+ ## img.test.tsx
18
+
19
+ This file contains unit tests for the `Img` component, ensuring it renders correctly with various props and handles image load and error events as expected.
20
+
21
+ ## img.stories.tsx and figure.stories.tsx
22
+
23
+ These files contain Storybook stories for the `Img` and `Figure` components, respectively. They provide examples and documentation for how to use the components with different props and configurations.
24
+
25
+ ## Usage
26
+
27
+ To use the `Img` or `Figure` components in your React application, import them from this directory and pass in the required props. For example:
28
+
29
+ ```jsx
30
+ import Img from './components/images/img';
31
+ import Figure from './components/images/figure';
32
+
33
+ function MyComponent() {
34
+ return (
35
+ <div>
36
+ <Img src="/path/to/image.jpg" alt="My Image" width={300} height={200} />
37
+ <Figure src="/path/to/image.jpg" alt="My Image" width={300} height={200} caption="This is a caption" />
38
+ </div>
39
+ );
40
+ }
41
+ ```
42
+
43
+ The components provide a consistent and extensible way to render images in your application, with additional features like placeholders, loading behavior, and error handling.
@@ -0,0 +1,34 @@
1
+ import { StoryObj, Meta } from '@storybook/react'
2
+ import { within, userEvent, screen } from '@storybook/testing-library'
3
+ import { expect } from '@storybook/jest'
4
+
5
+ import Figure from './figure'
6
+
7
+ const meta: Meta<typeof Figure> = {
8
+ title: 'FP.REACT Components/Figure',
9
+ component: Figure,
10
+ parameters: {
11
+ actions: { argTypesRegex: '^on.*' },
12
+ docs: {
13
+ description: {
14
+ component: 'Figure description here...',
15
+ },
16
+ },
17
+ },
18
+ args: {},
19
+ } as Story
20
+
21
+ export default meta
22
+ type Story = StoryObj<typeof Figure>
23
+
24
+ export const FigureComponent: Story = {
25
+ args: {},
26
+ play: async ({ canvasElement }) => {
27
+ const canvas = within(canvasElement)
28
+ expect(
29
+ canvas.getByText(/caption for the image here.../i),
30
+ ).toBeInTheDocument()
31
+ expect(canvas.getByRole('img')).toBeInTheDocument()
32
+ expect(canvas.getByRole('figure')).toBeInTheDocument()
33
+ },
34
+ }
@@ -0,0 +1,44 @@
1
+ import React from 'react'
2
+ import UI from '#components/ui'
3
+ import Img from './img'
4
+
5
+ export type FigureProps = {
6
+ /** Children nodes to render inside the figure */
7
+ children: React.ReactNode
8
+
9
+ /** The figure caption */
10
+ caption?: string
11
+ } & React.ComponentProps<typeof Img>
12
+
13
+ /**
14
+ * @description Figure component props.
15
+ *
16
+ * @param id - The id of the figure element.
17
+ * @param src - The image source url.
18
+ * @param width - The image width.
19
+ * @param height - The image height.
20
+ * @param alt - Alternative text for the image.
21
+ * @param caption - The figure caption text.
22
+ * @param styles - CSS styles object.
23
+ * @param props - Other props.
24
+ */
25
+ const Figure = ({
26
+ id,
27
+ src,
28
+ width,
29
+ height,
30
+ alt = '',
31
+ caption = 'Caption (caption) for the image here...',
32
+ styles,
33
+ ...props
34
+ }: FigureProps) => {
35
+ return (
36
+ <UI as="figure" id={id} {...props} styles={styles}>
37
+ <Img src={src} alt={alt} width={width} height={height} />
38
+ {caption.length ? <UI as="figcaption">{caption}</UI> : <></>}
39
+ </UI>
40
+ )
41
+ }
42
+
43
+ export default Figure
44
+ Figure.displayName = 'Figure'
@@ -0,0 +1,43 @@
1
+ img[alt] {
2
+ --img-max-width: 100%;
3
+ --img-height: auto;
4
+ --img-object-fit: cover;
5
+ --img-object-position: center;
6
+ --img-aspect-ratio: auto 2/3;
7
+ --img-display: inline-block;
8
+
9
+ max-width: var(--img-max-width);
10
+ max-inline-size: var(--img-max-width);
11
+ block-size: var(--img-height);
12
+ object-fit: var(--img-object-fit);
13
+ object-position: var(--img-object-position);
14
+ aspect-ratio: var(--img-aspect-ratio);
15
+ display: var(--img-display);
16
+ vertical-align: middle;
17
+ font-style: italic;
18
+ background-size: cover;
19
+ background-repeat: no-repeat;
20
+ shape-margin: var(--spc-3);
21
+ }
22
+
23
+ figure {
24
+ &:has(img[alt]) {
25
+ --fig-display: flex;
26
+ --fig-p: 0.5rem;
27
+ --fig-bg: rgba(245, 245, 245, 0.683);
28
+ --fig-w: fit-content;
29
+ display: var(--fig-display);
30
+ position: relative;
31
+ padding: var(--fig-p);
32
+ background-color: var(--fig-bg);
33
+ max-width: var(--fig-w);
34
+ > figcaption {
35
+ position: absolute;
36
+ bottom: var(--fig-bottom, var(--fig-p));
37
+ left: var(--fig-left, var(--fig-p));
38
+ right: var(--fig-right, var(--fig-p));
39
+ padding: var(--caption-p, var(--spc-3));
40
+ background-color: var(--fig-bg);
41
+ }
42
+ }
43
+ }
@@ -0,0 +1,24 @@
1
+ import { StoryObj, Meta } from '@storybook/react'
2
+ import { within, userEvent, screen } from '@storybook/testing-library'
3
+ import { expect } from '@storybook/jest'
4
+
5
+ import Img from './img'
6
+
7
+ const meta: Meta<typeof Img> = {
8
+ title: 'FP.REACT Components/Img',
9
+ component: Img,
10
+ args: {
11
+ src: '//',
12
+ },
13
+ } as Story
14
+
15
+ export default meta
16
+ type Story = StoryObj<typeof Img>
17
+
18
+ export const ImgComponent: Story = {
19
+ args: {},
20
+ play: async ({ canvasElement }) => {
21
+ const canvas = within(canvasElement)
22
+ expect(canvas.getByRole('img')).toBeInTheDocument()
23
+ },
24
+ }