@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.
- package/LICENSE +21 -0
- package/README.md +52 -0
- package/dist/chunk-77CZU5XZ.cjs +9 -0
- package/dist/chunk-77CZU5XZ.cjs.map +1 -0
- package/dist/chunk-D43FJIRQ.cjs +31 -0
- package/dist/chunk-D43FJIRQ.cjs.map +1 -0
- package/dist/chunk-GJWMCDFS.js +9 -0
- package/dist/chunk-GJWMCDFS.js.map +1 -0
- package/dist/chunk-PCDUGD3C.js +5 -0
- package/dist/chunk-PCDUGD3C.js.map +1 -0
- package/dist/hooks.cjs +10 -0
- package/dist/hooks.cjs.map +1 -0
- package/dist/hooks.d.cts +32 -0
- package/dist/hooks.d.ts +32 -0
- package/dist/hooks.js +8 -0
- package/dist/hooks.js.map +1 -0
- package/dist/icon-e6044c73.d.ts +227 -0
- package/dist/icons.cjs +73 -0
- package/dist/icons.cjs.map +1 -0
- package/dist/icons.d.cts +252 -0
- package/dist/icons.d.ts +252 -0
- package/dist/icons.js +4 -0
- package/dist/icons.js.map +1 -0
- package/dist/index.cjs +59 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +566 -0
- package/dist/index.d.ts +566 -0
- package/dist/index.js +11 -0
- package/dist/index.js.map +1 -0
- package/libs/chunk-GCGKYLDG.js +7 -0
- package/libs/chunk-GCGKYLDG.js.map +1 -0
- package/libs/chunk-PDD4N5P5.cjs +10 -0
- package/libs/chunk-PDD4N5P5.cjs.map +1 -0
- package/libs/chunk-QHIABQNQ.js +8 -0
- package/libs/chunk-QHIABQNQ.js.map +1 -0
- package/libs/chunk-ZOHIKF6I.cjs +31 -0
- package/libs/chunk-ZOHIKF6I.cjs.map +1 -0
- package/libs/components/badge/badge.css +1 -0
- package/libs/components/badge/badge.css.map +1 -0
- package/libs/components/badge/badge.min.css +3 -0
- package/libs/components/breadcrumbs/breadcrumb.css +1 -0
- package/libs/components/breadcrumbs/breadcrumb.css.map +1 -0
- package/libs/components/breadcrumbs/breadcrumb.min.css +3 -0
- package/libs/components/buttons/button.css +1 -0
- package/libs/components/buttons/button.css.map +1 -0
- package/libs/components/buttons/button.min.css +3 -0
- package/libs/components/cards/card-style.css +1 -0
- package/libs/components/cards/card-style.css.map +1 -0
- package/libs/components/cards/card-style.min.css +3 -0
- package/libs/components/cards/card.css +1 -0
- package/libs/components/cards/card.css.map +1 -0
- package/libs/components/cards/card.min.css +3 -0
- package/libs/components/details/details.css +1 -0
- package/libs/components/details/details.css.map +1 -0
- package/libs/components/details/details.min.css +3 -0
- package/libs/components/form/form.css +1 -0
- package/libs/components/form/form.css.map +1 -0
- package/libs/components/form/form.min.css +3 -0
- package/libs/components/icons/icon.css +1 -0
- package/libs/components/icons/icon.css.map +1 -0
- package/libs/components/icons/icon.min.css +3 -0
- package/libs/components/images/img.css +1 -0
- package/libs/components/images/img.css.map +1 -0
- package/libs/components/images/img.min.css +3 -0
- package/libs/components/layout/landmarks.css +1 -0
- package/libs/components/layout/landmarks.css.map +1 -0
- package/libs/components/layout/landmarks.min.css +3 -0
- package/libs/components/link/link.css +1 -0
- package/libs/components/link/link.css.map +1 -0
- package/libs/components/link/link.min.css +3 -0
- package/libs/components/nav/nav.css +1 -0
- package/libs/components/nav/nav.css.map +1 -0
- package/libs/components/nav/nav.min.css +3 -0
- package/libs/components/progress/progress.css +1 -0
- package/libs/components/progress/progress.css.map +1 -0
- package/libs/components/progress/progress.min.css +3 -0
- package/libs/components/styles/index.css +1 -0
- package/libs/components/styles/index.css.map +1 -0
- package/libs/components/styles/index.min.css +3 -0
- package/libs/components/tag/tag.css +1 -0
- package/libs/components/tag/tag.css.map +1 -0
- package/libs/components/tag/tag.min.css +3 -0
- package/libs/components/text-to-speech/text-to-speech.css +1 -0
- package/libs/components/text-to-speech/text-to-speech.css.map +1 -0
- package/libs/components/text-to-speech/text-to-speech.min.css +3 -0
- package/libs/hooks.cjs +12 -0
- package/libs/hooks.cjs.map +1 -0
- package/libs/hooks.d.cts +32 -0
- package/libs/hooks.d.ts +32 -0
- package/libs/hooks.js +3 -0
- package/libs/hooks.js.map +1 -0
- package/libs/icons-1f5afc0c.d.ts +318 -0
- package/libs/icons.cjs +12 -0
- package/libs/icons.cjs.map +1 -0
- package/libs/icons.d.cts +2 -0
- package/libs/icons.d.ts +2 -0
- package/libs/icons.js +3 -0
- package/libs/icons.js.map +1 -0
- package/libs/index.cjs +71 -0
- package/libs/index.cjs.map +1 -0
- package/libs/index.css +1 -0
- package/libs/index.css.map +1 -0
- package/libs/index.d.cts +551 -0
- package/libs/index.d.ts +551 -0
- package/libs/index.js +11 -0
- package/libs/index.js.map +1 -0
- package/package.json +125 -0
- package/src/App.css +42 -0
- package/src/App.tsx +35 -0
- package/src/__snapshots__/App.test.tsx.snap +56 -0
- package/src/components/.gitkeep +0 -0
- package/src/components/__snapshots__/fp.test.tsx.snap +3 -0
- package/src/components/badge/badge.scss +20 -0
- package/src/components/badge/badge.stories.tsx +54 -0
- package/src/components/badge/badge.tsx +17 -0
- package/src/components/breadcrumbs/bc-item.tsx +20 -0
- package/src/components/breadcrumbs/breadcrumb.scss +35 -0
- package/src/components/breadcrumbs/breadcrumb.stories.tsx +92 -0
- package/src/components/breadcrumbs/breadcrumb.tsx +218 -0
- package/src/components/buttons/button.scss +115 -0
- package/src/components/buttons/button.stories.tsx +57 -0
- package/src/components/buttons/button.test.tsx +104 -0
- package/src/components/buttons/button.tsx +64 -0
- package/src/components/cards/card-style.scss +0 -0
- package/src/components/cards/card.scss +43 -0
- package/src/components/cards/card.stories.tsx +114 -0
- package/src/components/cards/card.test.tsx +30 -0
- package/src/components/cards/card.tsx +135 -0
- package/src/components/cards/flex-card.tsx +15 -0
- package/src/components/details/details.scss +75 -0
- package/src/components/details/details.stories.tsx +122 -0
- package/src/components/details/details.tsx +77 -0
- package/src/components/form/README.mdx +70 -0
- package/src/components/form/fields.tsx +45 -0
- package/src/components/form/form.scss +87 -0
- package/src/components/form/form.stories.tsx +49 -0
- package/src/components/form/form.tsx +71 -0
- package/src/components/form/input.stories.tsx +155 -0
- package/src/components/form/inputs.tsx +84 -0
- package/src/components/form/select.stories.tsx +38 -0
- package/src/components/form/select.tsx +112 -0
- package/src/components/form/textarea.tsx +87 -0
- package/src/components/fp.test.tsx +56 -0
- package/src/components/fp.tsx +78 -0
- package/src/components/heading/heading.stories.tsx +75 -0
- package/src/components/heading/heading.tsx +27 -0
- package/src/components/icons/components/add.tsx +42 -0
- package/src/components/icons/components/arrow-down.tsx +52 -0
- package/src/components/icons/components/arrow-left.tsx +49 -0
- package/src/components/icons/components/arrow-right.tsx +52 -0
- package/src/components/icons/components/arrow-up.tsx +49 -0
- package/src/components/icons/components/chat.tsx +44 -0
- package/src/components/icons/components/code.tsx +50 -0
- package/src/components/icons/components/copy.tsx +51 -0
- package/src/components/icons/components/down.tsx +33 -0
- package/src/components/icons/components/home.tsx +57 -0
- package/src/components/icons/components/left.tsx +43 -0
- package/src/components/icons/components/minus.tsx +42 -0
- package/src/components/icons/components/pause-solid.tsx +48 -0
- package/src/components/icons/components/pause.tsx +63 -0
- package/src/components/icons/components/play-solid.tsx +44 -0
- package/src/components/icons/components/play.tsx +51 -0
- package/src/components/icons/components/remove.tsx +42 -0
- package/src/components/icons/components/resume-solid.tsx +52 -0
- package/src/components/icons/components/resume.tsx +57 -0
- package/src/components/icons/components/right.tsx +43 -0
- package/src/components/icons/components/star.tsx +38 -0
- package/src/components/icons/components/stop-solid.tsx +44 -0
- package/src/components/icons/components/stop.tsx +54 -0
- package/src/components/icons/components/svg.tsx +44 -0
- package/src/components/icons/components/up.tsx +31 -0
- package/src/components/icons/components/user.tsx +46 -0
- package/src/components/icons/icon.scss +15 -0
- package/src/components/icons/icon.stories.tsx +208 -0
- package/src/components/icons/icon.tsx +100 -0
- package/src/components/icons/index.ts +29 -0
- package/src/components/icons/types.ts +12 -0
- package/src/components/images/README.mdx +43 -0
- package/src/components/images/figure.stories.tsx +34 -0
- package/src/components/images/figure.tsx +44 -0
- package/src/components/images/img.scss +43 -0
- package/src/components/images/img.stories.tsx +24 -0
- package/src/components/images/img.test.tsx +43 -0
- package/src/components/images/img.tsx +93 -0
- package/src/components/images/place-holder.png +0 -0
- package/src/components/kit.tsx +56 -0
- package/src/components/layout/_header.scss +72 -0
- package/src/components/layout/footer.stories.tsx +34 -0
- package/src/components/layout/landmarks.scss +51 -0
- package/src/components/layout/landmarks.stories.tsx +54 -0
- package/src/components/layout/landmarks.tsx +149 -0
- package/src/components/layout/main.stories.tsx +90 -0
- package/src/components/link/link.scss +92 -0
- package/src/components/link/link.stories.tsx +74 -0
- package/src/components/link/link.tsx +48 -0
- package/src/components/list/list.stories.tsx +52 -0
- package/src/components/list/list.tsx +74 -0
- package/src/components/modal/dialog.tsx +50 -0
- package/src/components/modal/modal.tsx +85 -0
- package/src/components/nav/nav.scss +90 -0
- package/src/components/nav/nav.stories.tsx +96 -0
- package/src/components/nav/nav.tsx +76 -0
- package/src/components/popover/node_modules/.vitest/results.json +1 -0
- package/src/components/popover/popover.stories.tsx +31 -0
- package/src/components/popover/popover.test.tsx +39 -0
- package/src/components/popover/popover.tsx +85 -0
- package/src/components/progress/progress.scss +70 -0
- package/src/components/progress/progress.stories.tsx +51 -0
- package/src/components/progress/progress.tsx +82 -0
- package/src/components/readme.stories.mdx +7 -0
- package/src/components/styles/index.css +520 -0
- package/src/components/styles/index.css.map +1 -0
- package/src/components/tables/table-elements.tsx +57 -0
- package/src/components/tables/table.tsx +57 -0
- package/src/components/tag/tag.scss +56 -0
- package/src/components/tag/tag.stories.tsx +39 -0
- package/src/components/tag/tag.tsx +25 -0
- package/src/components/text/text.stories.tsx +67 -0
- package/src/components/text/text.tsx +93 -0
- package/src/components/text-to-speech/README.mdx +192 -0
- package/src/components/text-to-speech/TextInput.tsx +19 -0
- package/src/components/text-to-speech/TextToSpeech.stories.tsx +145 -0
- package/src/components/text-to-speech/TextToSpeech.tsx +94 -0
- package/src/components/text-to-speech/text-to-speech.scss +31 -0
- package/src/components/text-to-speech/useTextToSpeech.mdx +182 -0
- package/src/components/text-to-speech/useTextToSpeech.tsx +176 -0
- package/src/components/text-to-speech/views/TextToSpeechControls.tsx +117 -0
- package/src/components/ui.tsx +67 -0
- package/src/favicon.svg +15 -0
- package/src/hooks/popover/__snapshots__/popover.test.tsx.snap +88 -0
- package/src/hooks/popover/node_modules/.vitest/results.json +1 -0
- package/src/hooks/popover/popover.tsx +71 -0
- package/src/hooks/popover/use-popover.tsx +83 -0
- package/src/hooks.ts +1 -0
- package/src/icons.ts +1 -0
- package/src/index.css +13 -0
- package/src/index.scss +19 -0
- package/src/index.ts +35 -0
- package/src/libs/content.ts +30 -0
- package/src/logo.svg +7 -0
- package/src/main.tsx +10 -0
- package/src/patterns/.gitkeep +0 -0
- package/src/patterns/page/page-header.stories.tsx +44 -0
- package/src/patterns/page/page-header.tsx +78 -0
- package/src/sass/_elements.scss +17 -0
- package/src/sass/_globals.scss +162 -0
- package/src/sass/_layout.scss +51 -0
- package/src/sass/_loading-animation.scss +35 -0
- package/src/sass/_mixins.scss +10 -0
- package/src/sass/_properties.scss +106 -0
- package/src/sass/_reset.scss +183 -0
- package/src/sass/_type.scss +43 -0
- package/src/setupTest.ts +1 -0
- package/src/styles/badge/badge.css +22 -0
- package/src/styles/badge/badge.css.map +1 -0
- package/src/styles/breadcrumbs/breadcrumb.css +42 -0
- package/src/styles/breadcrumbs/breadcrumb.css.map +1 -0
- package/src/styles/buttons/button.css +93 -0
- package/src/styles/buttons/button.css.map +1 -0
- package/src/styles/cards/card-style.css +3 -0
- package/src/styles/cards/card-style.css.map +1 -0
- package/src/styles/cards/card.css +48 -0
- package/src/styles/cards/card.css.map +1 -0
- package/src/styles/details/details.css +69 -0
- package/src/styles/details/details.css.map +1 -0
- package/src/styles/dropdowns/dropdown.css.map +1 -0
- package/src/styles/form/form.css +93 -0
- package/src/styles/form/form.css.map +1 -0
- package/src/styles/form/style.css.map +1 -0
- package/src/styles/icons/icon.css +16 -0
- package/src/styles/icons/icon.css.map +1 -0
- package/src/styles/images/img.css +42 -0
- package/src/styles/images/img.css.map +1 -0
- package/src/styles/index.css +1330 -0
- package/src/styles/index.css.map +1 -0
- package/src/styles/layout/landmarks.css +155 -0
- package/src/styles/layout/landmarks.css.map +1 -0
- package/src/styles/link/link.css +88 -0
- package/src/styles/link/link.css.map +1 -0
- package/src/styles/nav/nav.css +85 -0
- package/src/styles/nav/nav.css.map +1 -0
- package/src/styles/progress/progress.css +54 -0
- package/src/styles/progress/progress.css.map +1 -0
- package/src/styles/progress/sass/progress.css.map +1 -0
- package/src/styles/styles/index.css +562 -0
- package/src/styles/styles/index.css.map +1 -0
- package/src/styles/tag/badge.css.map +1 -0
- package/src/styles/tag/tag.css +71 -0
- package/src/styles/tag/tag.css.map +1 -0
- package/src/styles/text-to-speech/text-to-speech.css +32 -0
- package/src/styles/text-to-speech/text-to-speech.css.map +1 -0
- package/src/test/setup.ts +6 -0
- package/src/types/component-props.ts +36 -0
- package/src/types/index.ts +2 -0
- package/src/types/input-props.ts +28 -0
- package/src/types/shared.ts +57 -0
- 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,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
|
+
}
|