@fpkit/acss 0.5.9 → 0.5.10

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 (62) hide show
  1. package/libs/components/buttons/button.css +1 -1
  2. package/libs/components/buttons/button.css.map +1 -1
  3. package/libs/components/buttons/button.min.css +2 -2
  4. package/libs/index.cjs.map +1 -1
  5. package/libs/index.css +1 -1
  6. package/libs/index.css.map +1 -1
  7. package/libs/index.d.cts +16 -22
  8. package/libs/index.d.ts +16 -22
  9. package/libs/index.js.map +1 -1
  10. package/package.json +6 -2
  11. package/src/components/README.mdx +1 -1
  12. package/src/components/alert/README.mdx +1 -1
  13. package/src/components/alert/alert.stories.tsx +2 -2
  14. package/src/components/alert/elements/README.mdx +1 -1
  15. package/src/components/alert/elements/dismiss-button.stories.tsx +2 -2
  16. package/src/components/badge/badge.mdx +1 -1
  17. package/src/components/badge/badge.stories.tsx +2 -2
  18. package/src/components/badge/badge.tsx +11 -19
  19. package/src/components/breadcrumbs/README.mdx +1 -1
  20. package/src/components/breadcrumbs/breadcrumb.stories.tsx +2 -2
  21. package/src/components/buttons/README.mdx +1 -1
  22. package/src/components/buttons/button.scss +3 -3
  23. package/src/components/buttons/button.stories.tsx +2 -2
  24. package/src/components/buttons/button.test.tsx +1 -1
  25. package/src/components/cards/README.md +80 -0
  26. package/src/components/cards/card.stories.tsx +2 -2
  27. package/src/components/details/README.mdx +1 -1
  28. package/src/components/details/details.stories.tsx +2 -2
  29. package/src/components/details/details.tsx +11 -18
  30. package/src/components/dialog/README.mdx +1 -1
  31. package/src/components/dialog/dialog-modal.stories.tsx +2 -2
  32. package/src/components/dialog/dialog-modal.tsx +1 -1
  33. package/src/components/dialog/dialog.stories.tsx +2 -2
  34. package/src/components/dialog/views/README.mdx +1 -1
  35. package/src/components/dialog/views/dialog-header.stories.tsx +2 -2
  36. package/src/components/form/form.stories.tsx +2 -2
  37. package/src/components/form/input.stories.tsx +2 -2
  38. package/src/components/form/select.stories.tsx +2 -2
  39. package/src/components/fp.test.tsx +52 -50
  40. package/src/components/heading/heading.stories.tsx +2 -2
  41. package/src/components/heading/heading.tsx +12 -24
  42. package/src/components/icons/icon.stories.tsx +1 -1
  43. package/src/components/images/figure.stories.tsx +2 -2
  44. package/src/components/images/img.stories.tsx +2 -2
  45. package/src/components/layout/footer.stories.tsx +10 -19
  46. package/src/components/layout/landmarks.stories.tsx +22 -24
  47. package/src/components/layout/main.stories.tsx +21 -25
  48. package/src/components/link/link.stories.tsx +2 -2
  49. package/src/components/list/list.stories.tsx +2 -2
  50. package/src/components/nav/nav.stories.tsx +2 -2
  51. package/src/components/popover/popover.stories.tsx +2 -2
  52. package/src/components/progress/progress.stories.tsx +1 -1
  53. package/src/components/tag/tag.stories.tsx +2 -2
  54. package/src/components/text/text.stories.tsx +2 -2
  55. package/src/components/text/text.tsx +50 -49
  56. package/src/components/text-to-speech/TextToSpeech.stories.tsx +1 -1
  57. package/src/decorators/instructions.tsx +2 -1
  58. package/src/patterns/page/page-header.stories.tsx +2 -2
  59. package/src/styles/buttons/button.css +3 -3
  60. package/src/styles/index.css +3 -3
  61. package/src/components/cards/README.mdx +0 -133
  62. package/src/components/text/README.mdx +0 -98
@@ -1,38 +1,35 @@
1
- import { StoryObj, Meta } from '@storybook/react'
1
+ import { StoryObj, Meta } from "@storybook/react-vite";
2
2
  /**
3
3
  * Import testing library dependencies
4
4
  */
5
- import { within, userEvent, expect } from '@storybook/test'
5
+ import { within, expect } from "storybook/test";
6
6
 
7
7
  /**
8
8
  * Import jest matchers
9
9
  */
10
10
 
11
-
12
- import { Main } from './landmarks'
11
+ import { Main } from "./landmarks";
13
12
 
14
13
  const meta: Meta<typeof Main> = {
15
- title: 'FP.React Components/Layout/Landmarks',
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
- // @ts-ignore
26
- 'data-testid': 'main',
23
+ "data-testid": "main",
27
24
  },
28
25
  decorators: [
29
26
  (Story) => (
30
- <div style={{ minHeight: '80vh', display: 'flex' }}>
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('main')
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('main')
85
- expect(main).toBeInTheDocument()
86
- const title = canvas.getByRole('heading')
87
- expect(title).toBeInTheDocument()
88
- expect(title).toHaveTextContent('Header Title')
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 "@storybook/test";
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 "@storybook/test";
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 } from "@storybook/test";
1
+ import { StoryObj, Meta } from "@storybook/react-vite";
2
+ import { within, expect } from "storybook/test";
3
3
 
4
4
  import React from "react";
5
5
 
@@ -1,5 +1,5 @@
1
- import { StoryObj, Meta } from "@storybook/react";
2
- import { within, expect, userEvent } from "@storybook/test";
1
+ import { StoryObj, Meta } from "@storybook/react-vite";
2
+ import { within, expect, userEvent } from "storybook/test";
3
3
 
4
4
  import Popover from "./popover";
5
5
 
@@ -1,4 +1,4 @@
1
- import { StoryObj, Meta } from "@storybook/react";
1
+ import { StoryObj, Meta } from "@storybook/react-vite";
2
2
 
3
3
  import "../../styles/progress/progress.css";
4
4
 
@@ -1,5 +1,5 @@
1
- import { StoryObj, Meta } from "@storybook/react";
2
- import { within, expect } from "@storybook/test";
1
+ import { StoryObj, Meta } from "@storybook/react-vite";
2
+ import { within, expect } from "storybook/test";
3
3
 
4
4
  import Tag from "./tag";
5
5
  import "./tag.scss";
@@ -1,5 +1,5 @@
1
- import { StoryObj, Meta } from "@storybook/react";
2
- import { within, expect } from "@storybook/test";
1
+ import { StoryObj, Meta } from "@storybook/react-vite";
2
+ import { within, expect } from "storybook/test";
3
3
 
4
4
  import Text from "./text";
5
5
 
@@ -1,53 +1,54 @@
1
1
  // import FP from '../fp'
2
- import React from "react";
3
- import UI from "#components/ui";
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
- | "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";
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
- * Pass a text element
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 = "p",
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?: "h1" | "h2" | "h3" | "h4" | "h5" | "h6";
72
- } & InheritedProps;
72
+ elm?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6'
73
+ } & InheritedProps
73
74
 
74
75
  export const Title = ({
75
- elm = "h3",
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 = "Text";
92
- Title.displayName = "Title";
92
+ Text.displayName = 'Text'
93
+ Title.displayName = 'Title'
@@ -1,4 +1,4 @@
1
- import { Meta, StoryObj } from "@storybook/react";
1
+ import { Meta, StoryObj } from "@storybook/react-vite";
2
2
  import TextToSpeech from "./TextToSpeech";
3
3
  import "./text-to-speech.scss";
4
4
 
@@ -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 "@storybook/test";
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,7 +1,7 @@
1
1
  button {
2
- --btn-xs: 0.6rem;
3
- --btn-sm: 0.7rem;
4
- --btn-md: 0.85rem;
2
+ --btn-xs: 0.5rem;
3
+ --btn-sm: 0.625rem;
4
+ --btn-md: 0.75rem;
5
5
  --btn-lg: 1.3125rem;
6
6
  --btn-pill: 100rem;
7
7
  --btn-height: 2.5rem;
@@ -428,9 +428,9 @@ h6:has(span:first-of-type) > span {
428
428
  }
429
429
 
430
430
  button {
431
- --btn-xs: 0.6rem;
432
- --btn-sm: 0.7rem;
433
- --btn-md: 0.85rem;
431
+ --btn-xs: 0.5rem;
432
+ --btn-sm: 0.625rem;
433
+ --btn-md: 0.75rem;
434
434
  --btn-lg: 1.3125rem;
435
435
  --btn-pill: 100rem;
436
436
  --btn-height: 2.5rem;
@@ -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.