@fpkit/acss 0.5.9 → 0.5.11
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/libs/components/buttons/button.css +1 -1
- package/libs/components/buttons/button.css.map +1 -1
- package/libs/components/buttons/button.min.css +2 -2
- package/libs/index.cjs.map +1 -1
- package/libs/index.css +1 -1
- package/libs/index.css.map +1 -1
- package/libs/index.d.cts +16 -22
- package/libs/index.d.ts +16 -22
- package/libs/index.js.map +1 -1
- package/package.json +6 -2
- package/src/components/README.mdx +1 -1
- package/src/components/alert/README.mdx +1 -1
- package/src/components/alert/alert.stories.tsx +2 -2
- package/src/components/alert/elements/README.mdx +1 -1
- package/src/components/alert/elements/dismiss-button.stories.tsx +2 -2
- package/src/components/badge/badge.mdx +1 -1
- package/src/components/badge/badge.stories.tsx +2 -2
- package/src/components/badge/badge.tsx +11 -19
- package/src/components/breadcrumbs/README.mdx +1 -1
- package/src/components/breadcrumbs/breadcrumb.stories.tsx +2 -2
- package/src/components/buttons/README.mdx +1 -1
- package/src/components/buttons/button.scss +11 -11
- package/src/components/buttons/button.stories.tsx +2 -2
- package/src/components/buttons/button.test.tsx +1 -1
- package/src/components/cards/README.md +80 -0
- package/src/components/cards/card.stories.tsx +2 -2
- package/src/components/details/README.mdx +1 -1
- package/src/components/details/details.stories.tsx +2 -2
- package/src/components/details/details.tsx +11 -18
- package/src/components/dialog/README.mdx +1 -1
- package/src/components/dialog/dialog-modal.stories.tsx +2 -2
- package/src/components/dialog/dialog-modal.tsx +1 -1
- package/src/components/dialog/dialog.stories.tsx +2 -2
- package/src/components/dialog/views/README.mdx +1 -1
- package/src/components/dialog/views/dialog-header.stories.tsx +2 -2
- package/src/components/form/form.stories.tsx +2 -2
- package/src/components/form/input.stories.tsx +2 -2
- package/src/components/form/select.stories.tsx +2 -2
- package/src/components/fp.test.tsx +52 -50
- package/src/components/heading/heading.stories.tsx +2 -2
- package/src/components/heading/heading.tsx +12 -24
- package/src/components/icons/icon.stories.tsx +1 -1
- package/src/components/images/figure.stories.tsx +2 -2
- package/src/components/images/img.stories.tsx +2 -2
- package/src/components/layout/footer.stories.tsx +10 -19
- package/src/components/layout/landmarks.stories.tsx +22 -24
- package/src/components/layout/main.stories.tsx +21 -25
- package/src/components/link/link.stories.tsx +2 -2
- package/src/components/list/list.stories.tsx +2 -2
- package/src/components/nav/nav.stories.tsx +2 -2
- package/src/components/popover/popover.stories.tsx +2 -2
- package/src/components/progress/progress.stories.tsx +1 -1
- package/src/components/tag/tag.stories.tsx +2 -2
- package/src/components/text/text.stories.tsx +2 -2
- package/src/components/text/text.tsx +50 -49
- package/src/components/text-to-speech/TextToSpeech.stories.tsx +1 -1
- package/src/decorators/instructions.tsx +2 -1
- package/src/patterns/page/page-header.stories.tsx +2 -2
- package/src/styles/buttons/button.css +11 -11
- package/src/styles/index.css +11 -11
- package/src/components/cards/README.mdx +0 -133
- package/src/components/text/README.mdx +0 -98
|
@@ -1,38 +1,35 @@
|
|
|
1
|
-
import { StoryObj, Meta } from
|
|
1
|
+
import { StoryObj, Meta } from "@storybook/react-vite";
|
|
2
2
|
/**
|
|
3
3
|
* Import testing library dependencies
|
|
4
4
|
*/
|
|
5
|
-
import { within,
|
|
5
|
+
import { within, expect } from "storybook/test";
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Import jest matchers
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
import { Main } from './landmarks'
|
|
11
|
+
import { Main } from "./landmarks";
|
|
13
12
|
|
|
14
13
|
const meta: Meta<typeof Main> = {
|
|
15
|
-
title:
|
|
14
|
+
title: "FP.React Components/Layout/Landmarks",
|
|
16
15
|
component: Main,
|
|
17
16
|
args: {
|
|
18
|
-
// @ts-ignore
|
|
19
17
|
children: (
|
|
20
18
|
<section>
|
|
21
19
|
The main HTML element represents the dominant content of the body of a
|
|
22
20
|
document.
|
|
23
21
|
</section>
|
|
24
22
|
),
|
|
25
|
-
|
|
26
|
-
'data-testid': 'main',
|
|
23
|
+
"data-testid": "main",
|
|
27
24
|
},
|
|
28
25
|
decorators: [
|
|
29
26
|
(Story) => (
|
|
30
|
-
<div style={{ minHeight:
|
|
27
|
+
<div style={{ minHeight: "80vh", display: "flex" }}>
|
|
31
28
|
<Story />
|
|
32
29
|
</div>
|
|
33
30
|
),
|
|
34
31
|
],
|
|
35
|
-
} as Meta
|
|
32
|
+
} as Meta;
|
|
36
33
|
|
|
37
34
|
const mainChildren = () => (
|
|
38
35
|
<>
|
|
@@ -61,30 +58,29 @@ const mainChildren = () => (
|
|
|
61
58
|
</aside>
|
|
62
59
|
</section>
|
|
63
60
|
</>
|
|
64
|
-
)
|
|
61
|
+
);
|
|
65
62
|
|
|
66
|
-
export default meta
|
|
67
|
-
type Story = StoryObj<typeof Main
|
|
63
|
+
export default meta;
|
|
64
|
+
type Story = StoryObj<typeof Main>;
|
|
68
65
|
|
|
69
66
|
export const MainLandmark: Story = {
|
|
70
67
|
play: async ({ canvasElement }) => {
|
|
71
|
-
const canvas = within(canvasElement)
|
|
72
|
-
const main = canvas.getByRole(
|
|
73
|
-
expect(main).toBeInTheDocument()
|
|
68
|
+
const canvas = within(canvasElement);
|
|
69
|
+
const main = canvas.getByRole("main");
|
|
70
|
+
expect(main).toBeInTheDocument();
|
|
74
71
|
},
|
|
75
|
-
}
|
|
72
|
+
};
|
|
76
73
|
|
|
77
74
|
export const MainArticles: Story = {
|
|
78
75
|
args: {
|
|
79
|
-
// @ts-ignore
|
|
80
76
|
children: mainChildren(),
|
|
81
77
|
},
|
|
82
78
|
play: async ({ canvasElement }) => {
|
|
83
|
-
const canvas = within(canvasElement)
|
|
84
|
-
const main = canvas.getByRole(
|
|
85
|
-
expect(main).toBeInTheDocument()
|
|
86
|
-
const title = canvas.getByRole(
|
|
87
|
-
expect(title).toBeInTheDocument()
|
|
88
|
-
expect(title).toHaveTextContent(
|
|
79
|
+
const canvas = within(canvasElement);
|
|
80
|
+
const main = canvas.getByRole("main");
|
|
81
|
+
expect(main).toBeInTheDocument();
|
|
82
|
+
const title = canvas.getByRole("heading");
|
|
83
|
+
expect(title).toBeInTheDocument();
|
|
84
|
+
expect(title).toHaveTextContent("Header Title");
|
|
89
85
|
},
|
|
90
|
-
}
|
|
86
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { StoryObj, Meta } from "@storybook/react";
|
|
1
|
+
import { StoryObj, Meta } from "@storybook/react-vite";
|
|
2
2
|
|
|
3
|
-
import { within, expect } from "
|
|
3
|
+
import { within, expect } from "storybook/test";
|
|
4
4
|
|
|
5
5
|
import Link from "./link";
|
|
6
6
|
import "../../styles/link/link.css";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
|
|
3
|
-
import { StoryObj, Meta } from "@storybook/react";
|
|
3
|
+
import { StoryObj, Meta } from "@storybook/react-vite";
|
|
4
4
|
|
|
5
|
-
// import { within, userEvent } from "
|
|
5
|
+
// import { within, userEvent } from "storybook/test";
|
|
6
6
|
|
|
7
7
|
import List from "./list";
|
|
8
8
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { StoryObj, Meta } from "@storybook/react";
|
|
2
|
-
import { within, expect, userEvent } from "
|
|
1
|
+
import { StoryObj, Meta } from "@storybook/react-vite";
|
|
2
|
+
import { within, expect, userEvent } from "storybook/test";
|
|
3
3
|
|
|
4
4
|
import Popover from "./popover";
|
|
5
5
|
|
|
@@ -1,53 +1,54 @@
|
|
|
1
1
|
// import FP from '../fp'
|
|
2
|
-
import React from
|
|
3
|
-
import UI from
|
|
2
|
+
import React from 'react'
|
|
3
|
+
import UI from '#components/ui'
|
|
4
4
|
|
|
5
|
-
type InheritedProps = React.ComponentProps<typeof UI
|
|
5
|
+
type InheritedProps = React.ComponentProps<typeof UI>
|
|
6
6
|
|
|
7
7
|
type TextElements =
|
|
8
|
-
|
|
|
9
|
-
|
|
|
10
|
-
|
|
|
11
|
-
|
|
|
12
|
-
|
|
|
13
|
-
|
|
|
14
|
-
|
|
|
15
|
-
|
|
|
16
|
-
|
|
|
17
|
-
|
|
|
18
|
-
|
|
|
19
|
-
|
|
|
20
|
-
|
|
|
21
|
-
|
|
|
22
|
-
|
|
|
23
|
-
|
|
|
24
|
-
|
|
|
25
|
-
|
|
|
26
|
-
|
|
|
27
|
-
|
|
|
28
|
-
|
|
|
29
|
-
|
|
|
30
|
-
|
|
|
31
|
-
|
|
|
32
|
-
|
|
|
33
|
-
|
|
|
34
|
-
|
|
|
35
|
-
|
|
|
36
|
-
|
|
|
37
|
-
|
|
|
38
|
-
|
|
|
8
|
+
| 'a'
|
|
9
|
+
| 'b'
|
|
10
|
+
| 'blockquote'
|
|
11
|
+
| 'b'
|
|
12
|
+
| 'blockquote'
|
|
13
|
+
| 'cite'
|
|
14
|
+
| 'code'
|
|
15
|
+
| 'em'
|
|
16
|
+
| 'i'
|
|
17
|
+
| 'em'
|
|
18
|
+
| 'i'
|
|
19
|
+
| 'kbd'
|
|
20
|
+
| 'mark'
|
|
21
|
+
| 'p'
|
|
22
|
+
| 's'
|
|
23
|
+
| 'small'
|
|
24
|
+
| 'span'
|
|
25
|
+
| 'span'
|
|
26
|
+
| 'strong'
|
|
27
|
+
| 'mark'
|
|
28
|
+
| 'p'
|
|
29
|
+
| 's'
|
|
30
|
+
| 'small'
|
|
31
|
+
| 'span'
|
|
32
|
+
| 'span'
|
|
33
|
+
| 'strong'
|
|
34
|
+
| 'sub'
|
|
35
|
+
| 'sup'
|
|
36
|
+
| 'time'
|
|
37
|
+
| 'time'
|
|
38
|
+
| 'u'
|
|
39
39
|
|
|
40
40
|
export type TextProps = {
|
|
41
41
|
/**
|
|
42
|
-
*
|
|
42
|
+
* Text element to to use
|
|
43
|
+
* Text element to to use
|
|
43
44
|
*/
|
|
44
|
-
elm?: TextElements
|
|
45
|
+
elm?: TextElements
|
|
45
46
|
/** Pass a text element or string */
|
|
46
|
-
text?: string
|
|
47
|
-
} & InheritedProps
|
|
47
|
+
text?: string
|
|
48
|
+
} & InheritedProps
|
|
48
49
|
|
|
49
50
|
export const Text = ({
|
|
50
|
-
elm =
|
|
51
|
+
elm = 'p',
|
|
51
52
|
id,
|
|
52
53
|
text,
|
|
53
54
|
styles,
|
|
@@ -61,18 +62,18 @@ export const Text = ({
|
|
|
61
62
|
{children || text}
|
|
62
63
|
</UI>
|
|
63
64
|
</UI>
|
|
64
|
-
)
|
|
65
|
-
}
|
|
65
|
+
)
|
|
66
|
+
}
|
|
66
67
|
|
|
67
68
|
type TitleProps = {
|
|
68
69
|
/**
|
|
69
70
|
* HTML headings
|
|
70
71
|
*/
|
|
71
|
-
elm?:
|
|
72
|
-
} & InheritedProps
|
|
72
|
+
elm?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6'
|
|
73
|
+
} & InheritedProps
|
|
73
74
|
|
|
74
75
|
export const Title = ({
|
|
75
|
-
elm =
|
|
76
|
+
elm = 'h3',
|
|
76
77
|
id,
|
|
77
78
|
children,
|
|
78
79
|
styles,
|
|
@@ -83,10 +84,10 @@ export const Title = ({
|
|
|
83
84
|
<Text as={elm} id={id} styles={styles} className={classes} {...props}>
|
|
84
85
|
{children}
|
|
85
86
|
</Text>
|
|
86
|
-
)
|
|
87
|
-
}
|
|
87
|
+
)
|
|
88
|
+
}
|
|
88
89
|
|
|
89
|
-
export default Text
|
|
90
|
+
export default Text
|
|
90
91
|
|
|
91
|
-
Text.displayName =
|
|
92
|
-
Title.displayName =
|
|
92
|
+
Text.displayName = 'Text'
|
|
93
|
+
Title.displayName = 'Title'
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { StoryFn } from "@storybook/react";
|
|
1
|
+
import { StoryFn } from "@storybook/react-vite";
|
|
2
2
|
import UI from "#components/ui";
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -42,3 +42,4 @@ export const WithInstructions =
|
|
|
42
42
|
};
|
|
43
43
|
|
|
44
44
|
export default WithInstructions;
|
|
45
|
+
WithInstructions.displayName = "WithInstructions";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { StoryObj, Meta } from "@storybook/react";
|
|
2
|
-
// import { within, userEvent, screen } from "
|
|
1
|
+
import { StoryObj, Meta } from "@storybook/react-vite";
|
|
2
|
+
// import { within, userEvent, screen } from "storybook/test";
|
|
3
3
|
|
|
4
4
|
import PageHeader, { HeaderVariants } from "./page-header.js";
|
|
5
5
|
import { Img } from "#components/images/img";
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
button {
|
|
2
|
-
--btn-xs: 0.
|
|
3
|
-
--btn-sm: 0.
|
|
4
|
-
--btn-md: 0.
|
|
2
|
+
--btn-xs: 0.7rem;
|
|
3
|
+
--btn-sm: 0.8rem;
|
|
4
|
+
--btn-md: 0.95rem;
|
|
5
5
|
--btn-lg: 1.3125rem;
|
|
6
6
|
--btn-pill: 100rem;
|
|
7
|
-
--btn-height:
|
|
7
|
+
--btn-height: 1.8rem;
|
|
8
8
|
--fs: 0.95rem;
|
|
9
9
|
--btn-fs: 0.9375rem;
|
|
10
10
|
--btn-bg: lightgray;
|
|
11
11
|
--btn-width: max-content;
|
|
12
|
-
--btn-calc-height: var(--btn-height, calc(
|
|
12
|
+
--btn-calc-height: var(--btn-height, calc(36rem / 16));
|
|
13
13
|
font-size: var(--btn-fs);
|
|
14
14
|
font-weight: var(--btn-fw, 500);
|
|
15
|
-
height: var(--btn-height,
|
|
15
|
+
height: var(--btn-height, 1.55rem);
|
|
16
16
|
max-height: var(--btn-calc-height);
|
|
17
|
-
min-height:
|
|
17
|
+
min-height: 0.8rem;
|
|
18
18
|
place-items: var(--btn-place, center);
|
|
19
19
|
padding-inline: var(--btn-px, calc(var(--btn-fs) + 1.1%));
|
|
20
20
|
padding-block: var(--btn-py, calc(var(--btn-fs) + 0.75%));
|
|
@@ -75,20 +75,20 @@ button[data-fp-btn~=pill], button[data-btn~=pill], button[data-style~=pill] {
|
|
|
75
75
|
button[data-btn~=xs] {
|
|
76
76
|
padding-inline: var(--btn-xs);
|
|
77
77
|
--btn-fs: var(--btn-xs);
|
|
78
|
-
--btn-height:
|
|
78
|
+
--btn-height: 0.5rem;
|
|
79
79
|
text-transform: uppercase;
|
|
80
80
|
}
|
|
81
81
|
button[data-btn~=sm] {
|
|
82
82
|
--btn-fs: var(--btn-sm);
|
|
83
|
-
--btn-height:
|
|
83
|
+
--btn-height: 0.8rem;
|
|
84
84
|
}
|
|
85
85
|
button[data-btn~=md] {
|
|
86
86
|
--btn-fs: var(--btn-md);
|
|
87
|
-
--btn-height:
|
|
87
|
+
--btn-height: 1.3rem;
|
|
88
88
|
}
|
|
89
89
|
button[data-btn~=lg] {
|
|
90
90
|
--btn-fs: var(--btn-lg);
|
|
91
|
-
--btn-height:
|
|
91
|
+
--btn-height: 1.8rem;
|
|
92
92
|
}
|
|
93
93
|
button[data-btn~=icon] {
|
|
94
94
|
padding: unset;
|
package/src/styles/index.css
CHANGED
|
@@ -428,22 +428,22 @@ h6:has(span:first-of-type) > span {
|
|
|
428
428
|
}
|
|
429
429
|
|
|
430
430
|
button {
|
|
431
|
-
--btn-xs: 0.
|
|
432
|
-
--btn-sm: 0.
|
|
433
|
-
--btn-md: 0.
|
|
431
|
+
--btn-xs: 0.7rem;
|
|
432
|
+
--btn-sm: 0.8rem;
|
|
433
|
+
--btn-md: 0.95rem;
|
|
434
434
|
--btn-lg: 1.3125rem;
|
|
435
435
|
--btn-pill: 100rem;
|
|
436
|
-
--btn-height:
|
|
436
|
+
--btn-height: 1.8rem;
|
|
437
437
|
--fs: 0.95rem;
|
|
438
438
|
--btn-fs: 0.9375rem;
|
|
439
439
|
--btn-bg: lightgray;
|
|
440
440
|
--btn-width: max-content;
|
|
441
|
-
--btn-calc-height: var(--btn-height, calc(
|
|
441
|
+
--btn-calc-height: var(--btn-height, calc(36rem / 16));
|
|
442
442
|
font-size: var(--btn-fs);
|
|
443
443
|
font-weight: var(--btn-fw, 500);
|
|
444
|
-
height: var(--btn-height,
|
|
444
|
+
height: var(--btn-height, 1.55rem);
|
|
445
445
|
max-height: var(--btn-calc-height);
|
|
446
|
-
min-height:
|
|
446
|
+
min-height: 0.8rem;
|
|
447
447
|
place-items: var(--btn-place, center);
|
|
448
448
|
padding-inline: var(--btn-px, calc(var(--btn-fs) + 1.1%));
|
|
449
449
|
padding-block: var(--btn-py, calc(var(--btn-fs) + 0.75%));
|
|
@@ -504,20 +504,20 @@ button[data-fp-btn~=pill], button[data-btn~=pill], button[data-style~=pill] {
|
|
|
504
504
|
button[data-btn~=xs] {
|
|
505
505
|
padding-inline: var(--btn-xs);
|
|
506
506
|
--btn-fs: var(--btn-xs);
|
|
507
|
-
--btn-height:
|
|
507
|
+
--btn-height: 0.5rem;
|
|
508
508
|
text-transform: uppercase;
|
|
509
509
|
}
|
|
510
510
|
button[data-btn~=sm] {
|
|
511
511
|
--btn-fs: var(--btn-sm);
|
|
512
|
-
--btn-height:
|
|
512
|
+
--btn-height: 0.8rem;
|
|
513
513
|
}
|
|
514
514
|
button[data-btn~=md] {
|
|
515
515
|
--btn-fs: var(--btn-md);
|
|
516
|
-
--btn-height:
|
|
516
|
+
--btn-height: 1.3rem;
|
|
517
517
|
}
|
|
518
518
|
button[data-btn~=lg] {
|
|
519
519
|
--btn-fs: var(--btn-lg);
|
|
520
|
-
--btn-height:
|
|
520
|
+
--btn-height: 1.8rem;
|
|
521
521
|
}
|
|
522
522
|
button[data-btn~=icon] {
|
|
523
523
|
padding: unset;
|
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
import { Meta } from "@storybook/blocks";
|
|
2
|
-
|
|
3
|
-
<Meta title="FP.REACT Components/Card/Readme" />
|
|
4
|
-
|
|
5
|
-
# Card Component
|
|
6
|
-
|
|
7
|
-
The Card component is a versatile and reusable React component for creating
|
|
8
|
-
card-like UI elements. It's part of the FPKit React component library.
|
|
9
|
-
|
|
10
|
-
## Usage
|
|
11
|
-
|
|
12
|
-
```tsx
|
|
13
|
-
import Card from "@fpkit/cards";
|
|
14
|
-
|
|
15
|
-
<Card elm="div">
|
|
16
|
-
<Card.Title>Card Title</Card.Title>
|
|
17
|
-
<Card.Content
|
|
18
|
-
className="custom-card-content"
|
|
19
|
-
styles={{ color: "blue", padding: "1rem" }}
|
|
20
|
-
>
|
|
21
|
-
This is the content of the card.
|
|
22
|
-
</Card.Content>
|
|
23
|
-
</Card>;
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
## Components
|
|
27
|
-
|
|
28
|
-
### Card
|
|
29
|
-
|
|
30
|
-
The main container component for the card.
|
|
31
|
-
|
|
32
|
-
#### Props
|
|
33
|
-
|
|
34
|
-
- `elm?: 'div' | 'aside' | 'section' | 'article'` - HTML element to render as
|
|
35
|
-
(default: 'div')
|
|
36
|
-
- `title?: React.ReactNode` - Card title
|
|
37
|
-
- `footer?: React.ReactNode` - Card footer
|
|
38
|
-
- `styles?: React.CSSProperties` - Inline styles
|
|
39
|
-
- `classes?: string` - Additional CSS classes
|
|
40
|
-
- `id?: string` - Unique ID for the card
|
|
41
|
-
|
|
42
|
-
All other props, such as `aria-*` attributes, `data-*` attributes, and event
|
|
43
|
-
handlers (e.g., `onClick`, `onMouseEnter`), are passed through to the underlying
|
|
44
|
-
UI component. This allows you to customize the behavior and accessibility of the
|
|
45
|
-
Card component as needed.
|
|
46
|
-
|
|
47
|
-
### Card.Title
|
|
48
|
-
|
|
49
|
-
A sub-component for rendering the card's title.
|
|
50
|
-
|
|
51
|
-
#### Props
|
|
52
|
-
|
|
53
|
-
- `as?: React.ElementType` - HTML element to render as (default: 'h3')
|
|
54
|
-
- `className?: string` - Additional CSS classes
|
|
55
|
-
- `styles?: React.CSSProperties` - Inline styles
|
|
56
|
-
|
|
57
|
-
#### Example
|
|
58
|
-
|
|
59
|
-
### Card.Content
|
|
60
|
-
|
|
61
|
-
A sub-component for rendering the card's main content.
|
|
62
|
-
|
|
63
|
-
#### Props
|
|
64
|
-
|
|
65
|
-
- `className?: string` - Additional CSS classes
|
|
66
|
-
- `styles?: React.CSSProperties` - Inline styles
|
|
67
|
-
|
|
68
|
-
## Styling
|
|
69
|
-
|
|
70
|
-
The component uses CSS classes for styling:
|
|
71
|
-
|
|
72
|
-
- `.card-title` for the title
|
|
73
|
-
- `.card-content` for the content
|
|
74
|
-
|
|
75
|
-
To integrate these styles with CSS Modules or SASS/SCSS:
|
|
76
|
-
|
|
77
|
-
1. Create a CSS Module file (e.g., `Card.module.scss`) or a SASS/SCSS file
|
|
78
|
-
(e.g., `Card.scss`).
|
|
79
|
-
|
|
80
|
-
## Accessibility
|
|
81
|
-
|
|
82
|
-
The Card component is designed with accessibility in mind:
|
|
83
|
-
|
|
84
|
-
- It uses semantic HTML elements (`div`, `aside`, `section`, or `article`) for
|
|
85
|
-
the main container.
|
|
86
|
-
- The Title component defaults to using an `h3` element, which can be changed if
|
|
87
|
-
needed.
|
|
88
|
-
- The Content component uses an `article` element for semantic structure.
|
|
89
|
-
|
|
90
|
-
### Example with ARIA Attributes
|
|
91
|
-
|
|
92
|
-
```tsx
|
|
93
|
-
<Card classes={styles.card}>
|
|
94
|
-
<Card.Title className={styles.cardTitle}>Card Title</Card.Title>
|
|
95
|
-
<Card.Content className={styles.cardContent}>
|
|
96
|
-
This is the content of the card.
|
|
97
|
-
</Card.Content>
|
|
98
|
-
</Card>
|
|
99
|
-
```
|
|
100
|
-
|
|
101
|
-
You can override these classes or provide additional styling through the
|
|
102
|
-
`className` and `styles` props.
|
|
103
|
-
|
|
104
|
-
## Accessibility
|
|
105
|
-
|
|
106
|
-
The Card component is designed with accessibility in mind:
|
|
107
|
-
|
|
108
|
-
- It uses semantic HTML elements (`div`, `aside`, `section`, or `article`) for
|
|
109
|
-
the main container.
|
|
110
|
-
- The Title component defaults to using an `h3` element, which can be changed if
|
|
111
|
-
needed.
|
|
112
|
-
- The Content component uses an `article` element for semantic structure.
|
|
113
|
-
|
|
114
|
-
## TypeScript
|
|
115
|
-
|
|
116
|
-
This component is written in TypeScript and provides type definitions for all
|
|
117
|
-
props and sub-components.
|
|
118
|
-
|
|
119
|
-
## Contributing
|
|
120
|
-
|
|
121
|
-
When contributing to this component, please follow the established code style
|
|
122
|
-
and conventions. Ensure all changes are well-tested using **Vitest** and
|
|
123
|
-
documented. Additionally, use **ESLint** and **Prettier** for code formatting
|
|
124
|
-
and linting to maintain consistency.
|
|
125
|
-
|
|
126
|
-
This README provides an overview of the Card component, its usage, available
|
|
127
|
-
props, styling information, and accessibility considerations. It also mentions
|
|
128
|
-
that the component is written in TypeScript and provides guidance for
|
|
129
|
-
contributors.
|
|
130
|
-
|
|
131
|
-
```
|
|
132
|
-
|
|
133
|
-
```
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
import { Meta } from "@storybook/blocks";
|
|
2
|
-
|
|
3
|
-
<Meta title="FP.REACT Components/Text/Readme" />
|
|
4
|
-
|
|
5
|
-
# Text Component
|
|
6
|
-
|
|
7
|
-
## Summary
|
|
8
|
-
|
|
9
|
-
The `Text` component is a flexible wrapper for rendering various text elements
|
|
10
|
-
such as paragraphs, spans, and other inline or block-level elements. It supports
|
|
11
|
-
customization through props like `elm`, `text`, and additional styles or
|
|
12
|
-
classes.
|
|
13
|
-
|
|
14
|
-
The `Title` component is a specialized version of `Text` for rendering HTML
|
|
15
|
-
headings (`h1` to `h6`).
|
|
16
|
-
|
|
17
|
-
## Features
|
|
18
|
-
|
|
19
|
-
- Render any valid HTML text element.
|
|
20
|
-
- Pass text content directly or use children for nested elements.
|
|
21
|
-
- Fully customizable with styles and classes.
|
|
22
|
-
- Supports accessibility with `id` and other attributes.
|
|
23
|
-
|
|
24
|
-
## Props
|
|
25
|
-
|
|
26
|
-
### Text Props
|
|
27
|
-
|
|
28
|
-
| Name | Type | Default | Description |
|
|
29
|
-
| ---------- | --------------------- | ------- | ----------------------------------- |
|
|
30
|
-
| `elm` | `TextElements` | `'p'` | The HTML element to render. |
|
|
31
|
-
| `text` | `string` | `''` | Text content to display. |
|
|
32
|
-
| `id` | `string` | `''` | Unique identifier for the element. |
|
|
33
|
-
| `styles` | `React.CSSProperties` | `null` | Inline styles for the element. |
|
|
34
|
-
| `classes` | `string` | `''` | Additional CSS classes for styling. |
|
|
35
|
-
| `children` | `React.ReactNode` | `null` | Nested content inside the element. |
|
|
36
|
-
|
|
37
|
-
### Title Props
|
|
38
|
-
|
|
39
|
-
| Name | Type | Default | Description |
|
|
40
|
-
| ---------- | ---------------------------------------------- | ------- | ----------------------------------- |
|
|
41
|
-
| `elm` | `'h1' \| 'h2' \| 'h3' \| 'h4' \| 'h5' \| 'h6'` | `'h3'` | The HTML heading element to render. |
|
|
42
|
-
| `id` | `string` | `''` | Unique identifier for the element. |
|
|
43
|
-
| `styles` | `React.CSSProperties` | `null` | Inline styles for the element. |
|
|
44
|
-
| `classes` | `string` | `''` | Additional CSS classes for styling. |
|
|
45
|
-
| `children` | `React.ReactNode` | `null` | Nested content inside the element. |
|
|
46
|
-
|
|
47
|
-
## Technical Details
|
|
48
|
-
|
|
49
|
-
- The `Text` component uses the `UI` component internally to render the
|
|
50
|
-
specified element.
|
|
51
|
-
- The `Title` component is a wrapper around `Text` with default settings for
|
|
52
|
-
headings.
|
|
53
|
-
- Both components support additional props inherited from the `UI` component.
|
|
54
|
-
|
|
55
|
-
## Usage Examples
|
|
56
|
-
|
|
57
|
-
### Basic Usage
|
|
58
|
-
|
|
59
|
-
```tsx
|
|
60
|
-
import { Text, Title } from "./text";
|
|
61
|
-
|
|
62
|
-
const App = () => (
|
|
63
|
-
<>
|
|
64
|
-
<Text elm="p" text="This is a paragraph." />
|
|
65
|
-
<Text elm="span" text="This is a span." />
|
|
66
|
-
<Title elm="h1">This is a heading</Title>
|
|
67
|
-
</>
|
|
68
|
-
);
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
### Advanced Usage
|
|
72
|
-
|
|
73
|
-
```tsx
|
|
74
|
-
import { Text, Title } from "./text";
|
|
75
|
-
|
|
76
|
-
const App = () => (
|
|
77
|
-
<>
|
|
78
|
-
<Text
|
|
79
|
-
elm="blockquote"
|
|
80
|
-
styles={{ fontStyle: "italic", color: "gray" }}
|
|
81
|
-
text="This is a blockquote."
|
|
82
|
-
/>
|
|
83
|
-
<Title
|
|
84
|
-
elm="h2"
|
|
85
|
-
classes="custom-heading"
|
|
86
|
-
styles={{ fontWeight: "bold", fontSize: "2rem" }}
|
|
87
|
-
>
|
|
88
|
-
Custom Heading
|
|
89
|
-
</Title>
|
|
90
|
-
</>
|
|
91
|
-
);
|
|
92
|
-
```
|
|
93
|
-
|
|
94
|
-
### Additional Notes
|
|
95
|
-
|
|
96
|
-
- Use the `elm` prop to specify the desired HTML element.
|
|
97
|
-
- Combine `styles` and `classes` for advanced styling.
|
|
98
|
-
- Use `children` for nested content when `text` is not sufficient.
|