@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,56 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { render, screen } from '@testing-library/react'
|
|
3
|
+
import FP from '../components/fp'
|
|
4
|
+
import jest from 'jest-mock'
|
|
5
|
+
import { userEvent } from '@storybook/testing-library'
|
|
6
|
+
|
|
7
|
+
describe('FP component', () => {
|
|
8
|
+
it('renders a div by default', () => {
|
|
9
|
+
const { container } = render(<FP />)
|
|
10
|
+
expect(container.firstChild).toMatchSnapshot()
|
|
11
|
+
})
|
|
12
|
+
|
|
13
|
+
it('renders a span when specified', () => {
|
|
14
|
+
const { container } = render(<FP as="span">Span</FP>)
|
|
15
|
+
const span = container.querySelector('span')
|
|
16
|
+
expect(span).toBeInTheDocument()
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
it('renders children', () => {
|
|
20
|
+
const { container } = render(<FP>Hello, world!</FP>)
|
|
21
|
+
expect(container.firstChild).toHaveTextContent('Hello, world!')
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
it('applies styles', () => {
|
|
25
|
+
const style = { backgroundColor: 'red;' }
|
|
26
|
+
const { container } = render(<FP styles={style}>Hello, world!</FP>)
|
|
27
|
+
expect(container.firstChild).toHaveStyle(style)
|
|
28
|
+
})
|
|
29
|
+
|
|
30
|
+
it('does not render styles when renderStyles is false', () => {
|
|
31
|
+
const { container } = render(
|
|
32
|
+
<FP renderStyles={false} styles={{ backgroundColor: 'red' }}>
|
|
33
|
+
Hello, world!
|
|
34
|
+
</FP>,
|
|
35
|
+
)
|
|
36
|
+
expect(container.firstChild).not.toHaveStyle('background-color: red;')
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
it('passes through props', async () => {
|
|
40
|
+
const handleClick = jest.fn()
|
|
41
|
+
const { container } = render(
|
|
42
|
+
<FP as="button" onClick={handleClick}>
|
|
43
|
+
Hello, world!
|
|
44
|
+
</FP>,
|
|
45
|
+
)
|
|
46
|
+
|
|
47
|
+
await userEvent.click(screen.getByRole('button'))
|
|
48
|
+
expect(handleClick).toHaveBeenCalled()
|
|
49
|
+
})
|
|
50
|
+
|
|
51
|
+
it('applies ref', () => {
|
|
52
|
+
const ref = React.createRef<HTMLDivElement>()
|
|
53
|
+
render(<FP ref={ref}>Hello, world!</FP>)
|
|
54
|
+
expect(ref.current).toBeTruthy()
|
|
55
|
+
})
|
|
56
|
+
})
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { ComponentProps } from '../types'
|
|
3
|
+
|
|
4
|
+
type PolymorphicRef<C extends React.ElementType> =
|
|
5
|
+
React.ComponentPropsWithRef<C>['ref']
|
|
6
|
+
|
|
7
|
+
type AsProp<C extends React.ElementType> = {
|
|
8
|
+
as?: C
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
type PropsToOmit<C extends React.ElementType, P> = keyof (AsProp<C> & P)
|
|
12
|
+
|
|
13
|
+
type PolymorphicComponentProp<
|
|
14
|
+
C extends React.ElementType,
|
|
15
|
+
Props = {},
|
|
16
|
+
> = React.PropsWithChildren<Props & AsProp<C>> &
|
|
17
|
+
Omit<React.ComponentPropsWithoutRef<C>, PropsToOmit<C, Props>>
|
|
18
|
+
|
|
19
|
+
type PolymorphicComponentPropWithRef<
|
|
20
|
+
C extends React.ElementType,
|
|
21
|
+
Props = {},
|
|
22
|
+
> = PolymorphicComponentProp<C, Props> & {
|
|
23
|
+
ref?: PolymorphicRef<C>
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
type FPProps<C extends React.ElementType> = PolymorphicComponentPropWithRef<
|
|
27
|
+
C,
|
|
28
|
+
{
|
|
29
|
+
renderStyles?: boolean
|
|
30
|
+
styles?: React.CSSProperties
|
|
31
|
+
classes?: string
|
|
32
|
+
}
|
|
33
|
+
>
|
|
34
|
+
|
|
35
|
+
/*
|
|
36
|
+
* FPComponent type definition
|
|
37
|
+
*
|
|
38
|
+
* Defines the component function signature for the FP component.
|
|
39
|
+
*
|
|
40
|
+
* @typeParam C - The HTML element type to render
|
|
41
|
+
* @param props - The component props
|
|
42
|
+
* @returns React component
|
|
43
|
+
*/
|
|
44
|
+
type FPComponent = <C extends React.ElementType = 'span'>(
|
|
45
|
+
props: FPProps<C>,
|
|
46
|
+
) => React.ReactElement | any
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* FP component is a polymorphic component that renders an HTML element with optional styles.
|
|
50
|
+
* @param {Object} props - Component props
|
|
51
|
+
* @param {React.ElementType} props.as - The HTML element to render. Defaults to 'div'.
|
|
52
|
+
* @param {boolean} props.renderStyles - Whether to render styles or not. Defaults to true.
|
|
53
|
+
* @param {Object} props.styles - The styles to apply to the component.
|
|
54
|
+
* @param {Object} props.defaultStyles - The default styles to apply to the component.
|
|
55
|
+
* @param {React.ReactNode} props.children - The children to render inside the component.
|
|
56
|
+
* @returns {React.ReactElement} - A React component that renders an HTML element with optional styles.
|
|
57
|
+
*/
|
|
58
|
+
const FP: FPComponent = React.forwardRef(
|
|
59
|
+
<C extends React.ElementType>(
|
|
60
|
+
{ as, styles, classes, children, defaultStyles, ...props }: FPProps<C>,
|
|
61
|
+
ref?: PolymorphicRef<C>,
|
|
62
|
+
) => {
|
|
63
|
+
const Component = as || 'div'
|
|
64
|
+
|
|
65
|
+
const styleObj = { ...defaultStyles, ...styles } as React.CSSProperties
|
|
66
|
+
|
|
67
|
+
return (
|
|
68
|
+
<Component ref={ref} style={styleObj} className={classes} {...props}>
|
|
69
|
+
{children}
|
|
70
|
+
</Component>
|
|
71
|
+
)
|
|
72
|
+
},
|
|
73
|
+
)
|
|
74
|
+
export interface BoxProps extends ComponentProps {
|
|
75
|
+
renderStyles: true
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export default FP
|
|
@@ -0,0 +1,75 @@
|
|
|
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 Heading from './heading'
|
|
6
|
+
|
|
7
|
+
const meta: Meta<typeof Heading> = {
|
|
8
|
+
title: 'FP.REACT Components/Heading',
|
|
9
|
+
component: Heading,
|
|
10
|
+
parameters: {
|
|
11
|
+
actions: { argTypesRegex: '^on.*' },
|
|
12
|
+
docs: {
|
|
13
|
+
description: {
|
|
14
|
+
component: 'Heading description here...',
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
args: {
|
|
19
|
+
// @ts-ignore
|
|
20
|
+
children: 'Default title',
|
|
21
|
+
},
|
|
22
|
+
} as Story
|
|
23
|
+
|
|
24
|
+
export default meta
|
|
25
|
+
type Story = StoryObj<typeof Heading>
|
|
26
|
+
|
|
27
|
+
export const HeadingComponent: Story = {
|
|
28
|
+
args: {},
|
|
29
|
+
play: async ({ canvasElement }) => {
|
|
30
|
+
const canvas = within(canvasElement)
|
|
31
|
+
expect(canvas.getByText(/default title/i)).toBeInTheDocument()
|
|
32
|
+
},
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export const HeadingOne: Story = {
|
|
36
|
+
args: {
|
|
37
|
+
type: 'h1',
|
|
38
|
+
children: 'Heading One',
|
|
39
|
+
},
|
|
40
|
+
} as Story
|
|
41
|
+
|
|
42
|
+
export const HeadingTwo: Story = {
|
|
43
|
+
args: {
|
|
44
|
+
type: 'h2',
|
|
45
|
+
children: 'Heading Two',
|
|
46
|
+
},
|
|
47
|
+
} as Story
|
|
48
|
+
|
|
49
|
+
export const HeadingThree: Story = {
|
|
50
|
+
args: {
|
|
51
|
+
type: 'h3',
|
|
52
|
+
children: 'Heading Three',
|
|
53
|
+
},
|
|
54
|
+
} as Story
|
|
55
|
+
|
|
56
|
+
export const HeadingFour: Story = {
|
|
57
|
+
args: {
|
|
58
|
+
type: 'h4',
|
|
59
|
+
children: 'Heading Four',
|
|
60
|
+
},
|
|
61
|
+
} as Story
|
|
62
|
+
|
|
63
|
+
export const HeadingFive: Story = {
|
|
64
|
+
args: {
|
|
65
|
+
type: 'h5',
|
|
66
|
+
children: 'Heading Five',
|
|
67
|
+
},
|
|
68
|
+
} as Story
|
|
69
|
+
|
|
70
|
+
export const HeadingSix: Story = {
|
|
71
|
+
args: {
|
|
72
|
+
type: 'h6',
|
|
73
|
+
children: 'Heading Six',
|
|
74
|
+
},
|
|
75
|
+
} as Story
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import UI from '#components/ui'
|
|
3
|
+
import { type } from 'os'
|
|
4
|
+
|
|
5
|
+
export type TitleProps = {
|
|
6
|
+
children: React.ReactNode
|
|
7
|
+
type: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6'
|
|
8
|
+
ui?: string
|
|
9
|
+
} & React.ComponentProps<typeof UI>
|
|
10
|
+
|
|
11
|
+
const Heading = ({
|
|
12
|
+
type = 'h3',
|
|
13
|
+
id,
|
|
14
|
+
styles,
|
|
15
|
+
ui = 'display',
|
|
16
|
+
children,
|
|
17
|
+
...props
|
|
18
|
+
}: TitleProps) => {
|
|
19
|
+
return (
|
|
20
|
+
<UI as={type} id={id} styles={styles} data-ui={ui} {...props}>
|
|
21
|
+
{children}
|
|
22
|
+
</UI>
|
|
23
|
+
)
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export default Heading
|
|
27
|
+
Heading.displayName = 'Heading'
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import * as React from 'react'
|
|
2
|
+
|
|
3
|
+
import { IconProps } from '../types'
|
|
4
|
+
import Svg from './svg'
|
|
5
|
+
|
|
6
|
+
const defaultStyles = {
|
|
7
|
+
...Svg.styles,
|
|
8
|
+
fill: 'currentColor',
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Add Icon component
|
|
13
|
+
* @param {string} fill - Icon fill color (default: 'currentColor')
|
|
14
|
+
* @param {string} size - Icon size (default: '24')
|
|
15
|
+
* @param {IconProps} props - Other icon properties
|
|
16
|
+
* @returns {JSX.Element} - Rendered component
|
|
17
|
+
*/
|
|
18
|
+
export const Add = ({
|
|
19
|
+
fill = 'currentColor',
|
|
20
|
+
size = 24,
|
|
21
|
+
role = 'img',
|
|
22
|
+
alt = 'Add icon',
|
|
23
|
+
...props
|
|
24
|
+
}: Pick<
|
|
25
|
+
IconProps,
|
|
26
|
+
'strokeColor' | 'fill' | 'styles' | 'size' | 'role' | 'alt'
|
|
27
|
+
>): JSX.Element => {
|
|
28
|
+
return (
|
|
29
|
+
<Svg size={size} role={role} alt={alt} {...props}>
|
|
30
|
+
<g fill={fill}>
|
|
31
|
+
<path
|
|
32
|
+
d="M17,11h-4V7c0-.553-.447-1-1-1s-1,.447-1,1v4H7c-.553,0-1,.447-1,1s.447,1,1,1h4v4c0,.553,.447,1,1,1s1-.447,1-1v-4h4c.553,0,1-.447,1-1s-.447-1-1-1Z"
|
|
33
|
+
fill={fill}
|
|
34
|
+
/>
|
|
35
|
+
</g>
|
|
36
|
+
</Svg>
|
|
37
|
+
)
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export default Add
|
|
41
|
+
Add.styles = defaultStyles
|
|
42
|
+
Add.displayName = 'Add'
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import * as React from 'react'
|
|
2
|
+
|
|
3
|
+
import { IconProps } from '../types'
|
|
4
|
+
import Svg from './svg'
|
|
5
|
+
|
|
6
|
+
const defaultStyles = { ...Svg.styles }
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* ArrowDown icon component
|
|
10
|
+
* @param fill - Icon fill color
|
|
11
|
+
* @param strokeColor - Icon stroke color
|
|
12
|
+
* @param styles - Icon styles
|
|
13
|
+
* @param size - Icon size
|
|
14
|
+
*/
|
|
15
|
+
export const ArrowDown = ({
|
|
16
|
+
fill = 'currentColor',
|
|
17
|
+
styles,
|
|
18
|
+
size = 16,
|
|
19
|
+
role = 'img',
|
|
20
|
+
alt = 'Down icon',
|
|
21
|
+
...props
|
|
22
|
+
}: Pick<IconProps, 'fill' | 'styles' | 'size' | 'role' | 'alt'>) => {
|
|
23
|
+
return (
|
|
24
|
+
<Svg size={size} role={role} styles={styles} alt={alt} {...props}>
|
|
25
|
+
<g fill={fill} strokeMiterlimit="10">
|
|
26
|
+
<line
|
|
27
|
+
fill="none"
|
|
28
|
+
stroke={fill}
|
|
29
|
+
strokeLinecap="butt"
|
|
30
|
+
strokeLinejoin="miter"
|
|
31
|
+
strokeWidth="2"
|
|
32
|
+
x1="12"
|
|
33
|
+
x2="12"
|
|
34
|
+
y1="2"
|
|
35
|
+
y2="22"
|
|
36
|
+
/>
|
|
37
|
+
<polyline
|
|
38
|
+
fill="none"
|
|
39
|
+
points="19,15 12,22 5,15 "
|
|
40
|
+
stroke={fill}
|
|
41
|
+
strokeLinecap="square"
|
|
42
|
+
strokeLinejoin="miter"
|
|
43
|
+
strokeWidth="2"
|
|
44
|
+
/>
|
|
45
|
+
</g>
|
|
46
|
+
</Svg>
|
|
47
|
+
)
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export default ArrowDown
|
|
51
|
+
ArrowDown.styles = defaultStyles
|
|
52
|
+
ArrowDown.displayName = 'ArrowDown'
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import * as React from 'react'
|
|
2
|
+
|
|
3
|
+
import { IconProps } from '../types'
|
|
4
|
+
import Svg from './svg'
|
|
5
|
+
|
|
6
|
+
const defaultStyles = { ...Svg.styles }
|
|
7
|
+
|
|
8
|
+
export const ArrowLeft = ({
|
|
9
|
+
strokeColor = 'currentColor',
|
|
10
|
+
fill = 'currentColor',
|
|
11
|
+
size = 16,
|
|
12
|
+
styles,
|
|
13
|
+
role = 'img',
|
|
14
|
+
alt = 'Arrow pointing left',
|
|
15
|
+
...props
|
|
16
|
+
}: Pick<
|
|
17
|
+
IconProps,
|
|
18
|
+
'strokeColor' | 'fill' | 'styles' | 'size' | 'role' | 'alt'
|
|
19
|
+
>) => {
|
|
20
|
+
return (
|
|
21
|
+
<Svg size={size} styles={styles} role={role} {...props} alt={alt}>
|
|
22
|
+
<g fill={fill} strokeMiterlimit="10">
|
|
23
|
+
<line
|
|
24
|
+
fill="none"
|
|
25
|
+
stroke={strokeColor}
|
|
26
|
+
strokeLinecap="butt"
|
|
27
|
+
strokeLinejoin="miter"
|
|
28
|
+
strokeWidth="2"
|
|
29
|
+
x1="22"
|
|
30
|
+
x2="2"
|
|
31
|
+
y1="12"
|
|
32
|
+
y2="12"
|
|
33
|
+
/>
|
|
34
|
+
<polyline
|
|
35
|
+
fill="none"
|
|
36
|
+
points="9,19 2,12 9,5 "
|
|
37
|
+
stroke={strokeColor}
|
|
38
|
+
strokeLinecap="square"
|
|
39
|
+
strokeLinejoin="miter"
|
|
40
|
+
strokeWidth="2"
|
|
41
|
+
/>
|
|
42
|
+
</g>
|
|
43
|
+
</Svg>
|
|
44
|
+
)
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export default ArrowLeft
|
|
48
|
+
ArrowLeft.styles = defaultStyles
|
|
49
|
+
ArrowLeft.displayName = 'ArrowLeft'
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { IconProps } from '../types'
|
|
2
|
+
import React from 'react'
|
|
3
|
+
import Svg from './svg'
|
|
4
|
+
|
|
5
|
+
const defaultStyles = {
|
|
6
|
+
...Svg.styles,
|
|
7
|
+
fill: 'currentColor',
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/*
|
|
11
|
+
* ArrowRight icon component.
|
|
12
|
+
*
|
|
13
|
+
* Renders a right arrow SVG icon.
|
|
14
|
+
*
|
|
15
|
+
* @param {IconProps} props - The component props
|
|
16
|
+
* @param {string} [props.size="24"] - Icon size
|
|
17
|
+
* @param {string} [props.fill="currentColor"] - Icon fill color
|
|
18
|
+
* @param {string} [props.strokeColor="currentColor"] - Stroke color
|
|
19
|
+
*
|
|
20
|
+
* @returns {React.ReactElement} - The rendered icon
|
|
21
|
+
*/
|
|
22
|
+
export const ArrowRight = ({
|
|
23
|
+
size = 16,
|
|
24
|
+
fill = 'currentColor',
|
|
25
|
+
strokeColor = 'currentColor',
|
|
26
|
+
styles,
|
|
27
|
+
role = 'img',
|
|
28
|
+
alt = 'Right arrow icon',
|
|
29
|
+
...props
|
|
30
|
+
}: Pick<
|
|
31
|
+
IconProps,
|
|
32
|
+
'strokeColor' | 'fill' | 'styles' | 'size' | 'role' | 'alt'
|
|
33
|
+
>) => {
|
|
34
|
+
return (
|
|
35
|
+
<Svg size={size} styles={styles} role={role} alt={alt} {...props}>
|
|
36
|
+
<g
|
|
37
|
+
fill={fill}
|
|
38
|
+
stroke={strokeColor}
|
|
39
|
+
strokeLinecap="square"
|
|
40
|
+
strokeLinejoin="miter"
|
|
41
|
+
strokeMiterlimit="10"
|
|
42
|
+
strokeWidth="2"
|
|
43
|
+
>
|
|
44
|
+
<line fill="none" strokeLinecap="butt" x1="2" x2="22" y1="12" y2="12" />
|
|
45
|
+
<polyline fill="none" points="15,5 22,12 15,19 " stroke={strokeColor} />
|
|
46
|
+
</g>
|
|
47
|
+
</Svg>
|
|
48
|
+
)
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export default ArrowRight
|
|
52
|
+
ArrowRight.displayName = 'ArrowRight'
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import * as React from 'react'
|
|
2
|
+
|
|
3
|
+
import { IconProps } from '../types'
|
|
4
|
+
import Svg from './svg'
|
|
5
|
+
|
|
6
|
+
const defaultStyles = {
|
|
7
|
+
...Svg.styles,
|
|
8
|
+
fill: 'none',
|
|
9
|
+
stroke: 'currentColor',
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* ArrowUp icon component
|
|
14
|
+
* @param fill - Icon fill color
|
|
15
|
+
* @param strokeColor - Icon stroke color
|
|
16
|
+
* @param styles - Icon styles
|
|
17
|
+
* @param size - Icon size
|
|
18
|
+
*/
|
|
19
|
+
export const ArrowUp = ({
|
|
20
|
+
strokeColor = 'currentColor',
|
|
21
|
+
styles,
|
|
22
|
+
size = 16,
|
|
23
|
+
role = 'img',
|
|
24
|
+
alt = 'Up arrow icon',
|
|
25
|
+
...props
|
|
26
|
+
}: Pick<
|
|
27
|
+
IconProps,
|
|
28
|
+
'strokeColor' | 'fill' | 'styles' | 'size' | 'role' | 'alt'
|
|
29
|
+
>) => {
|
|
30
|
+
return (
|
|
31
|
+
<Svg size={size} styles={styles} role={role} alt={alt} {...props}>
|
|
32
|
+
<g
|
|
33
|
+
fill="none"
|
|
34
|
+
stroke={strokeColor}
|
|
35
|
+
strokeLinecap="square"
|
|
36
|
+
strokeLinejoin="miter"
|
|
37
|
+
strokeMiterlimit="10"
|
|
38
|
+
strokeWidth="2"
|
|
39
|
+
>
|
|
40
|
+
<line fill="none" strokeLinecap="butt" x1="12" x2="12" y1="22" y2="2" />
|
|
41
|
+
<polyline fill="none" points="5,9 12,2 19,9 " stroke={strokeColor} />
|
|
42
|
+
</g>
|
|
43
|
+
</Svg>
|
|
44
|
+
)
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export default ArrowUp
|
|
48
|
+
ArrowUp.displayName = 'ArrowUp'
|
|
49
|
+
ArrowUp.style = defaultStyles
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import * as React from 'react'
|
|
2
|
+
|
|
3
|
+
import { IconProps } from '../types'
|
|
4
|
+
import Svg from './svg'
|
|
5
|
+
|
|
6
|
+
const defaultStyles = { ...Svg.styles }
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* @param {string} size - The width and height of the icon in pixels. Defaults to 24.
|
|
10
|
+
* @param {string} strokeColor - The color of the icon stroke. Defaults to 'currentcolor'.
|
|
11
|
+
* @param {React.CSSProperties} styles - Additional CSS styles to apply to the icon.
|
|
12
|
+
* @param {IconProps} props - Additional props to pass to the SVG element.
|
|
13
|
+
* @returns {JSX.Element} - A chat icon component that displays a speech bubble with lines representing text.
|
|
14
|
+
*/
|
|
15
|
+
export const Chat = ({
|
|
16
|
+
size = 16,
|
|
17
|
+
strokeColor = 'currentcolor',
|
|
18
|
+
styles,
|
|
19
|
+
role = 'img',
|
|
20
|
+
alt = 'Chat icon',
|
|
21
|
+
...props
|
|
22
|
+
}: Pick<
|
|
23
|
+
IconProps,
|
|
24
|
+
'strokeColor' | 'fill' | 'styles' | 'size' | 'role' | 'alt'
|
|
25
|
+
>): JSX.Element => {
|
|
26
|
+
return (
|
|
27
|
+
<Svg size={size} styles={styles} role={role} alt={alt} {...props}>
|
|
28
|
+
<g fill={strokeColor} strokeMiterlimit="10">
|
|
29
|
+
<path
|
|
30
|
+
d="M21,2H3c-1.105,0-2,.895-2,2V15c0,1.105,.895,2,2,2h5l4,5,4-5h5c1.105,0,2-.895,2-2V4c0-1.105-.895-2-2-2Z"
|
|
31
|
+
fill="none"
|
|
32
|
+
stroke={strokeColor}
|
|
33
|
+
strokeLinecap="square"
|
|
34
|
+
strokeLinejoin="miter"
|
|
35
|
+
strokeWidth="2"
|
|
36
|
+
/>
|
|
37
|
+
</g>
|
|
38
|
+
</Svg>
|
|
39
|
+
)
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export default Chat
|
|
43
|
+
Chat.styles = defaultStyles
|
|
44
|
+
Chat.displayName = 'Chat'
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import * as React from 'react'
|
|
2
|
+
|
|
3
|
+
import { IconProps } from '../types'
|
|
4
|
+
import Svg from './svg'
|
|
5
|
+
|
|
6
|
+
const defaultStyles = {
|
|
7
|
+
...Svg.styles,
|
|
8
|
+
fill: 'none',
|
|
9
|
+
stroke: 'currentColor',
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export const Code = ({
|
|
13
|
+
strokeColor = 'currentColor',
|
|
14
|
+
fill = 'none',
|
|
15
|
+
size = 16,
|
|
16
|
+
styles,
|
|
17
|
+
role = 'img',
|
|
18
|
+
alt = 'Code icon',
|
|
19
|
+
...props
|
|
20
|
+
}: Pick<
|
|
21
|
+
IconProps,
|
|
22
|
+
'strokeColor' | 'fill' | 'styles' | 'size' | 'role' | 'alt'
|
|
23
|
+
> = {}) => {
|
|
24
|
+
return (
|
|
25
|
+
<Svg size={size} role={role} alt={alt} styles={styles} {...props}>
|
|
26
|
+
<g
|
|
27
|
+
fill={fill}
|
|
28
|
+
stroke={strokeColor}
|
|
29
|
+
strokeLinecap="square"
|
|
30
|
+
strokeLinejoin="miter"
|
|
31
|
+
strokeMiterlimit="10"
|
|
32
|
+
strokeWidth="2"
|
|
33
|
+
>
|
|
34
|
+
<rect
|
|
35
|
+
height="22"
|
|
36
|
+
width="18"
|
|
37
|
+
fill="none"
|
|
38
|
+
stroke={strokeColor}
|
|
39
|
+
x="3"
|
|
40
|
+
y="1"
|
|
41
|
+
/>
|
|
42
|
+
<polyline fill="none" points="9 9 6 12 9 15" />
|
|
43
|
+
<polyline fill="none" points="15 15 18 12 15 9" />
|
|
44
|
+
</g>
|
|
45
|
+
</Svg>
|
|
46
|
+
)
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export default Code
|
|
50
|
+
Code.styles = defaultStyles
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { IconProps } from '../types'
|
|
2
|
+
import React from 'react'
|
|
3
|
+
import Svg from './svg'
|
|
4
|
+
|
|
5
|
+
const defaultStyles = {
|
|
6
|
+
...Svg.styles,
|
|
7
|
+
stroke: 'currentColor',
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Copy icon component
|
|
12
|
+
* @param {string} size - The width and height of the icon
|
|
13
|
+
* @param {string} strokeColor - The color of the icon stroke
|
|
14
|
+
* @param {IconProps} props - The icon component props
|
|
15
|
+
* @returns {JSX.Element} - A react JSX element representing the copy icon
|
|
16
|
+
*/
|
|
17
|
+
export const Copy = ({
|
|
18
|
+
size = 16,
|
|
19
|
+
strokeColor = 'currentColor',
|
|
20
|
+
styles,
|
|
21
|
+
role = 'img',
|
|
22
|
+
alt = 'Copy icon',
|
|
23
|
+
...props
|
|
24
|
+
}: Pick<
|
|
25
|
+
IconProps,
|
|
26
|
+
'strokeColor' | 'fill' | 'styles' | 'size' | 'role' | 'alt'
|
|
27
|
+
>): JSX.Element => {
|
|
28
|
+
return (
|
|
29
|
+
<Svg size={size} styles={styles} role={role} alt={alt} {...props}>
|
|
30
|
+
<g
|
|
31
|
+
fill="none"
|
|
32
|
+
stroke={strokeColor}
|
|
33
|
+
strokeLinecap="square"
|
|
34
|
+
strokeLinejoin="miter"
|
|
35
|
+
strokeMiterlimit="10"
|
|
36
|
+
strokeWidth="2"
|
|
37
|
+
>
|
|
38
|
+
<polyline
|
|
39
|
+
fill="none"
|
|
40
|
+
points="8 19 2 19 2 1 17 1 17 6"
|
|
41
|
+
stroke={strokeColor}
|
|
42
|
+
/>
|
|
43
|
+
<rect height="13" width="10" fill="none" x="12" y="10" />
|
|
44
|
+
</g>
|
|
45
|
+
</Svg>
|
|
46
|
+
)
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export default Copy
|
|
50
|
+
Copy.displayName = 'Copy'
|
|
51
|
+
Copy.styles = defaultStyles
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import * as React from 'react'
|
|
2
|
+
|
|
3
|
+
import { IconProps } from '../types'
|
|
4
|
+
import Svg from './svg'
|
|
5
|
+
|
|
6
|
+
const defaultStyles = { ...Svg.styles }
|
|
7
|
+
|
|
8
|
+
export const Down = ({
|
|
9
|
+
size = 16,
|
|
10
|
+
fill = 'currentColor',
|
|
11
|
+
styles,
|
|
12
|
+
role = 'img',
|
|
13
|
+
alt = 'Down arrow icon',
|
|
14
|
+
...props
|
|
15
|
+
}: Pick<
|
|
16
|
+
IconProps,
|
|
17
|
+
'strokeColor' | 'fill' | 'styles' | 'size' | 'role' | 'alt'
|
|
18
|
+
>) => {
|
|
19
|
+
return (
|
|
20
|
+
<Svg size={size} alt={alt} styles={styles} role={role} {...props}>
|
|
21
|
+
<g fill={fill}>
|
|
22
|
+
<path
|
|
23
|
+
d="M12,18a1,1,0,0,1-.707-.293l-10-10A1,1,0,0,1,2.707,6.293L12,15.586l9.293-9.293a1,1,0,1,1,1.414,1.414l-10,10A1,1,0,0,1,12,18Z"
|
|
24
|
+
fill={fill}
|
|
25
|
+
/>
|
|
26
|
+
</g>
|
|
27
|
+
</Svg>
|
|
28
|
+
)
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export default Down
|
|
32
|
+
Down.displayName = 'Down'
|
|
33
|
+
Down.styles = defaultStyles
|