trepur_components 2.3.9 → 2.3.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.
- package/lib/_virtual/react.js +4 -0
- package/lib/components/Accordion/Accordion.stories.d.ts +47 -0
- package/lib/components/Accordion/const.d.ts +31 -0
- package/lib/components/Accordion/index.d.ts +5 -0
- package/lib/components/Accordion/index.js +9 -0
- package/lib/components/AlertBar/AlertBar.stories.d.ts +24 -0
- package/lib/components/AlertBar/index.d.ts +16 -0
- package/lib/components/AlertBar/index.js +36 -0
- package/lib/components/Avatar/Avatar.stories.d.ts +10 -0
- package/lib/components/Avatar/index.d.ts +3 -0
- package/lib/components/Breadcrumbs/Breadcrumbs.stories.d.ts +18 -0
- package/lib/components/Breadcrumbs/index.d.ts +17 -0
- package/lib/components/Breadcrumbs/index.js +16 -0
- package/lib/components/Button/Button.stories.d.ts +20 -0
- package/lib/components/Button/index.d.ts +13 -0
- package/lib/components/Button/index.js +30 -0
- package/lib/components/Calendar/Calendar.stories.d.ts +11 -0
- package/lib/components/Calendar/index.d.ts +14 -0
- package/lib/components/Calendar/index.js +49 -0
- package/lib/components/Calendar/style.css.js +1 -0
- package/lib/components/Card/Card.stories.d.ts +11 -0
- package/lib/components/Card/index.d.ts +2 -0
- package/lib/components/Card/index.js +25 -0
- package/lib/components/Carousel/Carousel.stories.d.ts +23 -0
- package/lib/components/Carousel/index.d.ts +70 -0
- package/lib/components/Carousel/index.js +159 -0
- package/lib/components/Carousel/utils.d.ts +1 -0
- package/lib/components/Carousel/utils.js +38 -0
- package/lib/components/CarouselThumbnail/CarouselThumbnail.stories.d.ts +22 -0
- package/lib/components/CarouselThumbnail/const.d.ts +1 -0
- package/lib/components/CarouselThumbnail/const.js +20 -0
- package/lib/components/CarouselThumbnail/index.d.ts +51 -0
- package/lib/components/CarouselThumbnail/index.js +74 -0
- package/lib/components/CarouselThumbnail/utils.d.ts +2 -0
- package/lib/components/CarouselThumbnail/utils.js +65 -0
- package/lib/components/Checkbox/Checkbox.stories.d.ts +17 -0
- package/lib/components/Checkbox/index.d.ts +11 -0
- package/lib/components/Checkbox/index.js +28 -0
- package/lib/components/Collapsible/Collapsible.stories.d.ts +57 -0
- package/lib/components/Collapsible/index.d.ts +19 -0
- package/lib/components/Collapsible/index.js +87 -0
- package/lib/components/Counter/Counter.stories.d.ts +17 -0
- package/lib/components/Counter/index.d.ts +14 -0
- package/lib/components/Counter/index.js +49 -0
- package/lib/components/DetailUpdater/DetailUpdater.stories.d.ts +20 -0
- package/lib/components/DetailUpdater/index.d.ts +18 -0
- package/lib/components/DetailUpdater/index.js +63 -0
- package/lib/components/Dialog/Dialog.stories.d.ts +15 -0
- package/lib/components/Dialog/index.d.ts +12 -0
- package/lib/components/Dialog/index.js +16 -0
- package/lib/components/Dropdown/Dropdown.stories.d.ts +17 -0
- package/lib/components/Dropdown/index.d.ts +13 -0
- package/lib/components/Dropdown/index.js +66 -0
- package/lib/components/Dropdown/utils.d.ts +1 -0
- package/lib/components/Dropdown/utils.js +14 -0
- package/lib/components/FileUploader/FilePreview.d.ts +8 -0
- package/lib/components/FileUploader/FileUploader.stories.d.ts +52 -0
- package/lib/components/FileUploader/index.d.ts +15 -0
- package/lib/components/Footer/Footer.stories.d.ts +19 -0
- package/lib/components/Footer/index.d.ts +16 -0
- package/lib/components/Footer/index.js +36 -0
- package/lib/components/FooterNav/FooterNav.stories.d.ts +22 -0
- package/lib/components/FooterNav/index.d.ts +15 -0
- package/lib/components/FooterNav/index.js +38 -0
- package/lib/components/Form/Form.stories.d.ts +117 -0
- package/lib/components/Form/index.d.ts +13 -0
- package/lib/components/Form/index.js +17 -0
- package/lib/components/Gallery/Gallery.stories.d.ts +16 -0
- package/lib/components/Gallery/index.d.ts +7 -0
- package/lib/components/Greeting/Greeting.stories.d.ts +13 -0
- package/lib/components/Greeting/index.d.ts +7 -0
- package/lib/components/Greeting/index.js +20 -0
- package/lib/components/HamburgerIcon/HamburgerIcon.stories.d.ts +10 -0
- package/lib/components/HamburgerIcon/index.d.ts +2 -0
- package/lib/components/HamburgerIcon/index.js +78 -0
- package/lib/components/Icon/Icon.stories.d.ts +16 -0
- package/lib/components/Icon/index.d.ts +10 -0
- package/lib/components/Icon/index.js +23 -0
- package/lib/components/Image/Image.stories.d.ts +13 -0
- package/lib/components/Image/index.d.ts +5 -0
- package/lib/components/Image/index.js +17 -0
- package/lib/components/ImageCard/ImageCard.stories.d.ts +19 -0
- package/lib/components/ImageCard/index.d.ts +11 -0
- package/lib/components/ImageCard/index.js +32 -0
- package/lib/components/Input/Input.stories.d.ts +22 -0
- package/lib/components/Input/index.d.ts +33 -0
- package/lib/components/Input/index.js +83 -0
- package/lib/components/MenuButton/MenuButton.stories.d.ts +76 -0
- package/lib/components/MenuButton/index.d.ts +14 -0
- package/lib/components/MenuButton/index.js +56 -0
- package/lib/components/Modal/Modal.stories.d.ts +67 -0
- package/lib/components/Modal/index.d.ts +10 -0
- package/lib/components/Modal/index.js +45 -0
- package/lib/components/Nav/Nav.stories.d.ts +32 -0
- package/lib/components/Nav/index.d.ts +21 -0
- package/lib/components/Nav/index.js +82 -0
- package/lib/components/NavItem/NavItem.stories.d.ts +18 -0
- package/lib/components/NavItem/index.d.ts +8 -0
- package/lib/components/NavItem/index.js +24 -0
- package/lib/components/Pill/Pill.stories.d.ts +22 -0
- package/lib/components/Pill/index.d.ts +17 -0
- package/lib/components/Pill/index.js +31 -0
- package/lib/components/Search/Search.stories.d.ts +86 -0
- package/lib/components/Search/index.d.ts +12 -0
- package/lib/components/Search/index.js +42 -0
- package/lib/components/Select/Select.stories.d.ts +56 -0
- package/lib/components/Select/index.d.ts +11 -0
- package/lib/components/Select/index.js +68 -0
- package/lib/components/Showcase/Showcase.stories.d.ts +55 -0
- package/lib/components/Showcase/index.d.ts +15 -0
- package/lib/components/SideNav/SideNav.stories.d.ts +80 -0
- package/lib/components/SideNav/index.d.ts +12 -0
- package/lib/components/SocialButton/SocialButton.stories.d.ts +130 -0
- package/lib/components/SocialButton/index.d.ts +12 -0
- package/lib/components/SplitCard/SplitCard.stories.d.ts +21 -0
- package/lib/components/SplitCard/index.d.ts +14 -0
- package/lib/components/Stars/Star.stories.d.ts +14 -0
- package/lib/components/Stars/index.d.ts +8 -0
- package/lib/components/Stars/index.js +22 -0
- package/lib/components/Testimonial/Testimonial.stories.d.ts +21 -0
- package/lib/components/Testimonial/index.d.ts +13 -0
- package/lib/components/Testimonial/index.js +42 -0
- package/lib/components/TextArea/TextArea.stories.d.ts +21 -0
- package/lib/components/TextArea/index.d.ts +33 -0
- package/lib/components/TextArea/index.js +76 -0
- package/lib/components/Timeline/Timeline.stories.d.ts +21 -0
- package/lib/components/Timeline/index.d.ts +11 -0
- package/lib/components/Timeline/index.js +31 -0
- package/lib/components/Tubestops/Tubestops.stories.d.ts +19 -0
- package/lib/components/Tubestops/index.d.ts +15 -0
- package/lib/components/Tubestops/index.js +77 -0
- package/lib/components/Video/Video.stories.d.ts +23 -0
- package/lib/components/Video/index.d.ts +18 -0
- package/lib/components/Video/index.js +32 -0
- package/{src/components/index.ts → lib/components/index.d.ts} +35 -71
- package/lib/documentation/assets/index.d.ts +3 -0
- package/lib/documentation/typography/Fonts/Fonts.d.ts +2 -0
- package/lib/documentation/typography/Fonts/Fonts.stories.d.ts +10 -0
- package/lib/index.js +72 -0
- package/lib/node_modules/keen-slider/keen-slider.min.css.js +1 -0
- package/lib/node_modules/keen-slider/react.js +591 -0
- package/lib/style.css +1 -0
- package/lib/utils/controls.d.ts +36 -0
- package/lib/utils/matchMedia.d.ts +2 -0
- package/lib/utils/screens.d.ts +7 -0
- package/package.json +4 -1
- package/.eslintrc.cjs +0 -72
- package/.husky/pre-commit +0 -4
- package/.prettierignore +0 -10
- package/.prettierrc.json +0 -22
- package/postcss.config.js +0 -8
- package/src/components/Accordion/Accordion.stories.tsx +0 -39
- package/src/components/Accordion/const.tsx +0 -34
- package/src/components/Accordion/index.tsx +0 -22
- package/src/components/AlertBar/AlertBar.stories.tsx +0 -89
- package/src/components/AlertBar/index.tsx +0 -82
- package/src/components/Avatar/Avatar.stories.tsx +0 -14
- package/src/components/Avatar/index.tsx +0 -492
- package/src/components/Breadcrumbs/Breadcrumbs.stories.tsx +0 -29
- package/src/components/Breadcrumbs/index.tsx +0 -89
- package/src/components/Button/Button.stories.tsx +0 -24
- package/src/components/Button/index.tsx +0 -59
- package/src/components/Calendar/Calendar.stories.tsx +0 -21
- package/src/components/Calendar/index.tsx +0 -92
- package/src/components/Calendar/style.css +0 -233
- package/src/components/Card/Card.stories.tsx +0 -14
- package/src/components/Card/index.tsx +0 -39
- package/src/components/Carousel/Carousel.stories.tsx +0 -44
- package/src/components/Carousel/index.tsx +0 -301
- package/src/components/Carousel/utils.ts +0 -53
- package/src/components/CarouselThumbnail/CarouselThumbnail.stories.tsx +0 -29
- package/src/components/CarouselThumbnail/const.ts +0 -17
- package/src/components/CarouselThumbnail/index.tsx +0 -169
- package/src/components/CarouselThumbnail/utils.ts +0 -87
- package/src/components/Checkbox/Checkbox.mdx +0 -33
- package/src/components/Checkbox/Checkbox.stories.tsx +0 -27
- package/src/components/Checkbox/index.tsx +0 -44
- package/src/components/Collapsible/Collapsible.stories.tsx +0 -67
- package/src/components/Collapsible/index.tsx +0 -169
- package/src/components/Counter/Counter.stories.tsx +0 -20
- package/src/components/Counter/index.tsx +0 -98
- package/src/components/DetailUpdater/DetailUpdater.stories.tsx +0 -37
- package/src/components/DetailUpdater/index.tsx +0 -107
- package/src/components/Dialog/Dialog.stories.tsx +0 -65
- package/src/components/Dialog/index.tsx +0 -29
- package/src/components/Dropdown/Dropdown.stories.tsx +0 -22
- package/src/components/Dropdown/index.tsx +0 -117
- package/src/components/Dropdown/utils.ts +0 -15
- package/src/components/FileUploader/FilePreview.tsx +0 -45
- package/src/components/FileUploader/FileUploader.stories.tsx +0 -28
- package/src/components/FileUploader/index.tsx +0 -177
- package/src/components/Footer/Footer.stories.tsx +0 -47
- package/src/components/Footer/index.tsx +0 -96
- package/src/components/FooterNav/FooterNav.stories.tsx +0 -32
- package/src/components/FooterNav/index.tsx +0 -75
- package/src/components/Form/Form.stories.tsx +0 -86
- package/src/components/Form/index.tsx +0 -41
- package/src/components/Gallery/Gallery.stories.tsx +0 -39
- package/src/components/Gallery/index.tsx +0 -31
- package/src/components/Greeting/Greeting.stories.tsx +0 -16
- package/src/components/Greeting/index.tsx +0 -49
- package/src/components/HamburgerIcon/HamburgerIcon.stories.tsx +0 -14
- package/src/components/HamburgerIcon/index.tsx +0 -75
- package/src/components/Icon/Icon.stories.tsx +0 -41
- package/src/components/Icon/index.tsx +0 -33
- package/src/components/Image/Image.stories.tsx +0 -17
- package/src/components/Image/index.tsx +0 -25
- package/src/components/ImageCard/ImageCard.stories.tsx +0 -29
- package/src/components/ImageCard/index.tsx +0 -75
- package/src/components/Input/Input.stories.tsx +0 -25
- package/src/components/Input/index.tsx +0 -139
- package/src/components/MenuButton/MenuButton.stories.tsx +0 -46
- package/src/components/MenuButton/index.tsx +0 -66
- package/src/components/Modal/Modal.stories.tsx +0 -82
- package/src/components/Modal/index.tsx +0 -71
- package/src/components/Nav/Nav.stories.tsx +0 -80
- package/src/components/Nav/index.tsx +0 -171
- package/src/components/NavItem/NavItem.stories.tsx +0 -17
- package/src/components/NavItem/index.tsx +0 -39
- package/src/components/Pill/Pill.stories.tsx +0 -51
- package/src/components/Pill/index.tsx +0 -69
- package/src/components/Search/Search.stories.tsx +0 -63
- package/src/components/Search/index.tsx +0 -64
- package/src/components/Select/Select.stories.tsx +0 -55
- package/src/components/Select/index.tsx +0 -97
- package/src/components/Showcase/Showcase.stories.tsx +0 -31
- package/src/components/Showcase/index.tsx +0 -62
- package/src/components/SideNav/SideNav.stories.tsx +0 -50
- package/src/components/SideNav/index.tsx +0 -39
- package/src/components/SocialButton/SocialButton.stories.tsx +0 -88
- package/src/components/SocialButton/index.tsx +0 -63
- package/src/components/SplitCard/SplitCard.stories.tsx +0 -34
- package/src/components/SplitCard/index.tsx +0 -132
- package/src/components/Stars/Star.stories.tsx +0 -18
- package/src/components/Stars/index.tsx +0 -38
- package/src/components/Testimonial/Testimonial.stories.tsx +0 -37
- package/src/components/Testimonial/index.tsx +0 -123
- package/src/components/TextArea/TextArea.stories.tsx +0 -24
- package/src/components/TextArea/index.tsx +0 -133
- package/src/components/Timeline/Timeline.stories.tsx +0 -45
- package/src/components/Timeline/index.tsx +0 -65
- package/src/components/Tubestops/Tubestops.stories.tsx +0 -22
- package/src/components/Tubestops/index.tsx +0 -132
- package/src/components/Video/Video.stories.tsx +0 -58
- package/src/components/Video/assets/example.mp4 +0 -0
- package/src/components/Video/assets/example.ogv +0 -0
- package/src/components/Video/assets/example.webm +0 -0
- package/src/components/Video/index.tsx +0 -92
- package/src/custom.d.ts +0 -14
- package/src/documentation/Colours.mdx +0 -192
- package/src/documentation/Introduction.mdx +0 -13
- package/src/documentation/assets/index.ts +0 -3
- package/src/documentation/assets/trepurComponentsLogo.svg +0 -32
- package/src/documentation/typography/Fonts/Fonts.stories.tsx +0 -14
- package/src/documentation/typography/Fonts/Fonts.tsx +0 -73
- package/src/fonts/Sora/OFL.txt +0 -93
- package/src/fonts/Sora/README.txt +0 -70
- package/src/fonts/Sora/Sora-VariableFont_wght.ttf +0 -0
- package/src/fonts/Sora/static/Sora-Bold.ttf +0 -0
- package/src/fonts/Sora/static/Sora-ExtraBold.ttf +0 -0
- package/src/fonts/Sora/static/Sora-ExtraLight.ttf +0 -0
- package/src/fonts/Sora/static/Sora-Light.ttf +0 -0
- package/src/fonts/Sora/static/Sora-Medium.ttf +0 -0
- package/src/fonts/Sora/static/Sora-Regular.ttf +0 -0
- package/src/fonts/Sora/static/Sora-SemiBold.ttf +0 -0
- package/src/fonts/Sora/static/Sora-Thin.ttf +0 -0
- package/src/utils/controls.ts +0 -44
- package/src/utils/matchMedia.ts +0 -9
- package/src/utils/screens.ts +0 -7
- package/tailwind.config.ts +0 -13
- package/tsconfig.json +0 -49
- package/tsconfig.node.json +0 -12
- package/vite.config.mjs +0 -64
- /package/{src/index.ts → lib/index.d.ts} +0 -0
- /package/{src → lib}/styles/global.css +0 -0
- /package/{src → lib}/styles/themes/local.css +0 -0
- /package/{src → lib}/styles/themes/test.css +0 -0
- /package/{tailwind → lib/tailwind}/boxShadow.ts +0 -0
- /package/{tailwind → lib/tailwind}/colors.ts +0 -0
- /package/{tailwind → lib/tailwind}/container.ts +0 -0
- /package/{tailwind → lib/tailwind}/preset.ts +0 -0
- /package/{tailwind → lib/tailwind}/spacing.ts +0 -0
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
import { action } from '@storybook/addon-actions';
|
|
2
|
-
import { Meta, StoryObj } from '@storybook/react';
|
|
3
|
-
import { idAndClassName } from '@utils/controls';
|
|
4
|
-
|
|
5
|
-
import { SocialButton } from '.';
|
|
6
|
-
|
|
7
|
-
const meta = {
|
|
8
|
-
title: 'Components/SocialButton',
|
|
9
|
-
component: SocialButton,
|
|
10
|
-
parameters: {
|
|
11
|
-
docs: {
|
|
12
|
-
description: {
|
|
13
|
-
component:
|
|
14
|
-
'A SocialButton which can either be internal, external or social as well as a standard design or a slide design.',
|
|
15
|
-
},
|
|
16
|
-
},
|
|
17
|
-
},
|
|
18
|
-
argTypes: {
|
|
19
|
-
...idAndClassName,
|
|
20
|
-
onClick: {
|
|
21
|
-
type: { name: 'function', required: false },
|
|
22
|
-
description: 'The action to perform when clicking on the component',
|
|
23
|
-
action: 'onClick',
|
|
24
|
-
table: {
|
|
25
|
-
type: {
|
|
26
|
-
summary: 'function',
|
|
27
|
-
},
|
|
28
|
-
defaultValue: { summary: 'undefined' },
|
|
29
|
-
},
|
|
30
|
-
},
|
|
31
|
-
type: {
|
|
32
|
-
type: {
|
|
33
|
-
name: 'string',
|
|
34
|
-
required: false,
|
|
35
|
-
},
|
|
36
|
-
options: ['facebook', 'instagram', 'github', 'linkedin'],
|
|
37
|
-
description: 'The type of SocialButton to render',
|
|
38
|
-
table: {
|
|
39
|
-
type: {
|
|
40
|
-
summary: 'default',
|
|
41
|
-
},
|
|
42
|
-
defaultValue: {
|
|
43
|
-
summary: 'default',
|
|
44
|
-
},
|
|
45
|
-
},
|
|
46
|
-
defaultValue: 'default',
|
|
47
|
-
control: { type: 'radio' },
|
|
48
|
-
},
|
|
49
|
-
href: {
|
|
50
|
-
type: { name: 'string', required: false },
|
|
51
|
-
description: 'The link attached to the component',
|
|
52
|
-
table: {
|
|
53
|
-
type: {
|
|
54
|
-
summary: 'default',
|
|
55
|
-
},
|
|
56
|
-
defaultValue: {
|
|
57
|
-
summary: 'undefined',
|
|
58
|
-
},
|
|
59
|
-
},
|
|
60
|
-
},
|
|
61
|
-
openInNewTab: {
|
|
62
|
-
type: { name: 'boolean', required: false },
|
|
63
|
-
description: 'Opens the link in a new tab when set to true',
|
|
64
|
-
defaultValue: 'false',
|
|
65
|
-
},
|
|
66
|
-
children: {
|
|
67
|
-
type: { name: 'other', value: 'string | React.ReactNode' },
|
|
68
|
-
description: 'The child elements to show in the component',
|
|
69
|
-
table: {
|
|
70
|
-
type: {
|
|
71
|
-
summary: 'Array',
|
|
72
|
-
},
|
|
73
|
-
defaultValue: { summary: 'undefined' },
|
|
74
|
-
},
|
|
75
|
-
},
|
|
76
|
-
},
|
|
77
|
-
args: {
|
|
78
|
-
type: 'facebook',
|
|
79
|
-
href: '/',
|
|
80
|
-
onClick: action('SocialButton clicked'),
|
|
81
|
-
},
|
|
82
|
-
};
|
|
83
|
-
|
|
84
|
-
export default meta;
|
|
85
|
-
|
|
86
|
-
type Story = StoryObj<typeof SocialButton>;
|
|
87
|
-
|
|
88
|
-
export const Default: Story = {};
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
|
|
3
|
-
import { Icon } from '@components/Icon';
|
|
4
|
-
import { faStar } from '@fortawesome/fontawesome-free-solid';
|
|
5
|
-
import { type Colours, type SocialTypes } from '@utils/controls';
|
|
6
|
-
import classNames from 'classnames';
|
|
7
|
-
|
|
8
|
-
export interface Props {
|
|
9
|
-
id?: string;
|
|
10
|
-
className?: string;
|
|
11
|
-
onClick?: React.MouseEventHandler;
|
|
12
|
-
type?: SocialTypes;
|
|
13
|
-
href?: string;
|
|
14
|
-
openInNewTab?: boolean;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export const SocialButton = ({
|
|
18
|
-
id,
|
|
19
|
-
className,
|
|
20
|
-
onClick,
|
|
21
|
-
type = 'facebook',
|
|
22
|
-
href,
|
|
23
|
-
openInNewTab = false,
|
|
24
|
-
}: Props) => {
|
|
25
|
-
const getColours = (type: Colours): Colours => {
|
|
26
|
-
const typeString: string = type;
|
|
27
|
-
const colour: string = `interactive-${typeString}`;
|
|
28
|
-
return colour as Colours;
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
const classList = classNames(
|
|
32
|
-
'flex h-16 w-16 transform rounded-full duration-500',
|
|
33
|
-
className,
|
|
34
|
-
{
|
|
35
|
-
'bg-facebook hover:bg-interactive-facebook': type === 'facebook',
|
|
36
|
-
'bg-github hover:bg-interactive-github': type === 'github',
|
|
37
|
-
'': type === 'instagram',
|
|
38
|
-
'bg-linkedin hover:bg-interactive-linkedin': type === 'linkedin',
|
|
39
|
-
},
|
|
40
|
-
);
|
|
41
|
-
|
|
42
|
-
const iconType = {
|
|
43
|
-
facebook: 'facebook-f',
|
|
44
|
-
instagram: 'instagram',
|
|
45
|
-
github: 'github',
|
|
46
|
-
linkedin: 'linkedin-in',
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
const typeString: string = type.toString();
|
|
50
|
-
return (
|
|
51
|
-
<a
|
|
52
|
-
className="rounded-full"
|
|
53
|
-
href={href}
|
|
54
|
-
aria-label={`view me on ${typeString}`}
|
|
55
|
-
onClick={onClick}
|
|
56
|
-
{...(openInNewTab && { target: '_blank' })}
|
|
57
|
-
>
|
|
58
|
-
<div id={id} className={classList}>
|
|
59
|
-
<Icon icon={faStar} size="2x" colour="white" />
|
|
60
|
-
</div>
|
|
61
|
-
</a>
|
|
62
|
-
);
|
|
63
|
-
};
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { Meta, StoryObj } from '@storybook/react';
|
|
2
|
-
|
|
3
|
-
import { SplitCard } from '.';
|
|
4
|
-
import { Image } from '..';
|
|
5
|
-
|
|
6
|
-
const meta = {
|
|
7
|
-
title: 'V2Components/Split Card',
|
|
8
|
-
component: SplitCard,
|
|
9
|
-
args: {
|
|
10
|
-
className: 'bg-info-light',
|
|
11
|
-
swapDesktop: true,
|
|
12
|
-
swapMobile: true,
|
|
13
|
-
children: [
|
|
14
|
-
<SplitCard.LeftContent>
|
|
15
|
-
<Image src="https://picsum.photos/200/200" />
|
|
16
|
-
</SplitCard.LeftContent>,
|
|
17
|
-
<SplitCard.RightContent className="flex flex-col justify-center p-8">
|
|
18
|
-
<SplitCard.Title>This is a title</SplitCard.Title>
|
|
19
|
-
<SplitCard.Text>
|
|
20
|
-
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Voluptatibus
|
|
21
|
-
non reprehenderit quaerat unde eius quisquam enim distinctio tempora
|
|
22
|
-
animi, rerum exercitationem asperiores, consequuntur fuga ex
|
|
23
|
-
cupiditate? Cumque laudantium laborum numquam!
|
|
24
|
-
</SplitCard.Text>
|
|
25
|
-
</SplitCard.RightContent>,
|
|
26
|
-
],
|
|
27
|
-
},
|
|
28
|
-
} satisfies Meta<typeof SplitCard>;
|
|
29
|
-
|
|
30
|
-
export default meta;
|
|
31
|
-
|
|
32
|
-
type Story = StoryObj<typeof SplitCard>;
|
|
33
|
-
|
|
34
|
-
export const Default: Story = {};
|
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
createContext,
|
|
3
|
-
forwardRef,
|
|
4
|
-
HTMLAttributes,
|
|
5
|
-
useContext,
|
|
6
|
-
useMemo,
|
|
7
|
-
} from 'react';
|
|
8
|
-
|
|
9
|
-
import MatchMedia from '@utils/matchMedia';
|
|
10
|
-
import { Screens } from '@utils/screens';
|
|
11
|
-
import clsx from 'clsx';
|
|
12
|
-
|
|
13
|
-
export interface SplitCardContextProps {
|
|
14
|
-
swapDesktop?: boolean;
|
|
15
|
-
swapMobile?: boolean;
|
|
16
|
-
isMd?: boolean;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
const SplitCardContext = createContext<SplitCardContextProps | null>(null);
|
|
20
|
-
|
|
21
|
-
const SplitCardComponent = forwardRef<
|
|
22
|
-
HTMLDivElement,
|
|
23
|
-
HTMLAttributes<HTMLDivElement> & SplitCardContextProps
|
|
24
|
-
>(({ id, className, children, swapDesktop, swapMobile, ...props }, ref) => {
|
|
25
|
-
const mediumScreen: string = Screens.md;
|
|
26
|
-
const mdScreenSize: string = `(min-width: ${mediumScreen})`;
|
|
27
|
-
const isMd: boolean = MatchMedia(mdScreenSize);
|
|
28
|
-
|
|
29
|
-
const state = useMemo(
|
|
30
|
-
() => ({
|
|
31
|
-
swapDesktop,
|
|
32
|
-
swapMobile,
|
|
33
|
-
isMd,
|
|
34
|
-
}),
|
|
35
|
-
[swapDesktop, swapMobile, isMd],
|
|
36
|
-
);
|
|
37
|
-
|
|
38
|
-
return (
|
|
39
|
-
<SplitCardContext.Provider value={state}>
|
|
40
|
-
<div
|
|
41
|
-
ref={ref}
|
|
42
|
-
{...props}
|
|
43
|
-
className={clsx('grid grid-cols-1 md:grid-cols-2', className)}
|
|
44
|
-
>
|
|
45
|
-
{children}
|
|
46
|
-
</div>
|
|
47
|
-
</SplitCardContext.Provider>
|
|
48
|
-
);
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
const SplitCardLeftContent = forwardRef<
|
|
52
|
-
HTMLDivElement,
|
|
53
|
-
HTMLAttributes<HTMLDivElement>
|
|
54
|
-
>(({ className, children, ...props }, ref) => {
|
|
55
|
-
const { swapDesktop, swapMobile, isMd } = useContext(SplitCardContext) || {};
|
|
56
|
-
|
|
57
|
-
return (
|
|
58
|
-
<div
|
|
59
|
-
ref={ref}
|
|
60
|
-
{...props}
|
|
61
|
-
className={clsx(
|
|
62
|
-
'flex h-full items-center text-center',
|
|
63
|
-
{
|
|
64
|
-
'md:order-last': swapDesktop,
|
|
65
|
-
'order-last': !isMd && swapMobile,
|
|
66
|
-
},
|
|
67
|
-
className,
|
|
68
|
-
)}
|
|
69
|
-
>
|
|
70
|
-
{children}
|
|
71
|
-
</div>
|
|
72
|
-
);
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
const SplitCardRightContent = forwardRef<
|
|
76
|
-
HTMLDivElement,
|
|
77
|
-
HTMLAttributes<HTMLDivElement>
|
|
78
|
-
>(({ className, children, ...props }, ref) => {
|
|
79
|
-
const { swapDesktop, swapMobile, isMd } = useContext(SplitCardContext) || {};
|
|
80
|
-
|
|
81
|
-
return (
|
|
82
|
-
<div
|
|
83
|
-
ref={ref}
|
|
84
|
-
{...props}
|
|
85
|
-
className={clsx(
|
|
86
|
-
'flex h-full items-center text-center',
|
|
87
|
-
{
|
|
88
|
-
'md:order-first': swapDesktop,
|
|
89
|
-
'order-first': !isMd && swapMobile,
|
|
90
|
-
},
|
|
91
|
-
className,
|
|
92
|
-
)}
|
|
93
|
-
>
|
|
94
|
-
{children}
|
|
95
|
-
</div>
|
|
96
|
-
);
|
|
97
|
-
});
|
|
98
|
-
|
|
99
|
-
const SplitCardTitle = forwardRef<
|
|
100
|
-
HTMLParagraphElement,
|
|
101
|
-
HTMLAttributes<HTMLParagraphElement>
|
|
102
|
-
>(({ id, children, ...props }, ref) => {
|
|
103
|
-
return (
|
|
104
|
-
<p ref={ref} className="items-center" {...props}>
|
|
105
|
-
{children}
|
|
106
|
-
</p>
|
|
107
|
-
);
|
|
108
|
-
});
|
|
109
|
-
|
|
110
|
-
const SplitCardText = forwardRef<
|
|
111
|
-
HTMLParagraphElement,
|
|
112
|
-
HTMLAttributes<HTMLParagraphElement>
|
|
113
|
-
>(({ id, children, ...props }, ref) => {
|
|
114
|
-
return (
|
|
115
|
-
<p ref={ref} className="" {...props}>
|
|
116
|
-
{children}
|
|
117
|
-
</p>
|
|
118
|
-
);
|
|
119
|
-
});
|
|
120
|
-
|
|
121
|
-
SplitCardComponent.displayName = 'SplitCard';
|
|
122
|
-
SplitCardLeftContent.displayName = 'SplitCard.LeftContent';
|
|
123
|
-
SplitCardRightContent.displayName = 'SplitCard.RightContent';
|
|
124
|
-
|
|
125
|
-
const SplitCard = Object.assign(SplitCardComponent, {
|
|
126
|
-
LeftContent: SplitCardLeftContent,
|
|
127
|
-
RightContent: SplitCardRightContent,
|
|
128
|
-
Title: SplitCardTitle,
|
|
129
|
-
Text: SplitCardText,
|
|
130
|
-
});
|
|
131
|
-
|
|
132
|
-
export { SplitCard };
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { Meta, StoryObj } from '@storybook/react';
|
|
2
|
-
|
|
3
|
-
import { Stars } from '.';
|
|
4
|
-
|
|
5
|
-
const meta = {
|
|
6
|
-
title: 'V2Components/Stars',
|
|
7
|
-
component: Stars,
|
|
8
|
-
args: {
|
|
9
|
-
stars: 3,
|
|
10
|
-
size: '2x',
|
|
11
|
-
},
|
|
12
|
-
} satisfies Meta<typeof Stars>;
|
|
13
|
-
|
|
14
|
-
export default meta;
|
|
15
|
-
|
|
16
|
-
type Story = StoryObj<typeof Stars>;
|
|
17
|
-
|
|
18
|
-
export const Default: Story = {};
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { forwardRef, HTMLAttributes } from 'react';
|
|
2
|
-
|
|
3
|
-
import { Icon } from '@components/Icon';
|
|
4
|
-
import { faStar } from '@fortawesome/fontawesome-free-solid';
|
|
5
|
-
import { SizeProp } from '@fortawesome/fontawesome-svg-core';
|
|
6
|
-
import clsx from 'clsx';
|
|
7
|
-
|
|
8
|
-
export interface StarProps {
|
|
9
|
-
stars?: 1 | 2 | 3 | 4 | 5;
|
|
10
|
-
size?: SizeProp;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
const StarComponent = forwardRef<
|
|
14
|
-
HTMLDivElement,
|
|
15
|
-
HTMLAttributes<HTMLDivElement> & StarProps
|
|
16
|
-
>(({ className, stars = 0, size }, ref) => {
|
|
17
|
-
const getStarsChecked = () =>
|
|
18
|
-
[...Array(5)].map((_, i) => (
|
|
19
|
-
<Icon
|
|
20
|
-
className={i < stars ? 'text-star' : ''}
|
|
21
|
-
key={`checked_star_${i}`}
|
|
22
|
-
icon={faStar}
|
|
23
|
-
size="2x"
|
|
24
|
-
/>
|
|
25
|
-
));
|
|
26
|
-
|
|
27
|
-
return (
|
|
28
|
-
<div ref={ref} className={clsx('flex', className)}>
|
|
29
|
-
{getStarsChecked()}
|
|
30
|
-
</div>
|
|
31
|
-
);
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
StarComponent.displayName = 'Stars';
|
|
35
|
-
|
|
36
|
-
const Stars = Object.assign(StarComponent);
|
|
37
|
-
|
|
38
|
-
export { Stars };
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { Meta, StoryObj } from '@storybook/react';
|
|
2
|
-
|
|
3
|
-
import { Testimonial } from '.';
|
|
4
|
-
|
|
5
|
-
const meta = {
|
|
6
|
-
title: 'V2Components/Testimonial',
|
|
7
|
-
component: Testimonial,
|
|
8
|
-
args: {
|
|
9
|
-
children: [
|
|
10
|
-
<Testimonial.Image src="https://picsum.photos/100/100" />,
|
|
11
|
-
<Testimonial.Title>This is a title</Testimonial.Title>,
|
|
12
|
-
<Testimonial.Section>
|
|
13
|
-
<Testimonial.Position>Position</Testimonial.Position>
|
|
14
|
-
<Testimonial.Date>This is a date</Testimonial.Date>
|
|
15
|
-
</Testimonial.Section>,
|
|
16
|
-
<Testimonial.Text>
|
|
17
|
-
Lorem ipsum dolor sit amet consectetur adipisicing elit. Facere delectus
|
|
18
|
-
soluta voluptas, minus sequi fuga facilis rem animi reprehenderit iusto
|
|
19
|
-
recusandae. Accusantium porro possimus id quas quis a soluta cum. Lorem,
|
|
20
|
-
ipsum dolor sit amet consectetur adipisicing elit. Facere odit rem quam
|
|
21
|
-
ullam! Ipsam dolorem libero exercitationem odio atque itaque
|
|
22
|
-
repudiandae? Amet est exercitationem quas iusto magni quod, molestiae
|
|
23
|
-
eaque. Lorem ipsum dolor sit amet consectetur adipisicing elit. Beatae
|
|
24
|
-
fuga quibusdam minima assumenda. Culpa ab ea sit molestias aspernatur
|
|
25
|
-
enim ducimus quis consequatur? Ab officiis, sequi reiciendis eos quaerat
|
|
26
|
-
quisquam?
|
|
27
|
-
</Testimonial.Text>,
|
|
28
|
-
<Testimonial.AuthorDetails>Authors Name</Testimonial.AuthorDetails>,
|
|
29
|
-
],
|
|
30
|
-
},
|
|
31
|
-
} satisfies Meta<typeof Testimonial>;
|
|
32
|
-
|
|
33
|
-
export default meta;
|
|
34
|
-
|
|
35
|
-
type Story = StoryObj<typeof Testimonial>;
|
|
36
|
-
|
|
37
|
-
export const Default: Story = {};
|
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
import { forwardRef, HTMLAttributes } from 'react';
|
|
2
|
-
|
|
3
|
-
import { Card } from '../';
|
|
4
|
-
import { Image, ImageProps } from '@components/Image';
|
|
5
|
-
import clsx from 'clsx';
|
|
6
|
-
|
|
7
|
-
const TestimonialComponent = forwardRef<
|
|
8
|
-
HTMLDivElement,
|
|
9
|
-
HTMLAttributes<HTMLDivElement>
|
|
10
|
-
>(({ className, children, ...props }, ref) => {
|
|
11
|
-
return (
|
|
12
|
-
<Card ref={ref} className={clsx('grid gap-4', className)} {...props}>
|
|
13
|
-
{children}
|
|
14
|
-
</Card>
|
|
15
|
-
);
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
const TestimonialImage = forwardRef<
|
|
19
|
-
HTMLImageElement,
|
|
20
|
-
HTMLAttributes<HTMLImageElement> & ImageProps
|
|
21
|
-
>(({ className, src, ...props }, ref) => {
|
|
22
|
-
return (
|
|
23
|
-
<div ref={ref} className="mx-auto w-40 ">
|
|
24
|
-
<Image className="rounded-full" src={src} {...props} />
|
|
25
|
-
</div>
|
|
26
|
-
);
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
const TestimonialTitle = forwardRef<
|
|
30
|
-
HTMLDivElement,
|
|
31
|
-
HTMLAttributes<HTMLDivElement>
|
|
32
|
-
>(({ className, children, ...props }, ref) => {
|
|
33
|
-
return (
|
|
34
|
-
<h3 ref={ref} className="text-center text-lg font-medium" {...props}>
|
|
35
|
-
{children}
|
|
36
|
-
</h3>
|
|
37
|
-
);
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
const TestimonialSection = forwardRef<
|
|
41
|
-
HTMLDivElement,
|
|
42
|
-
HTMLAttributes<HTMLDivElement>
|
|
43
|
-
>(({ className, children, ...props }, ref) => {
|
|
44
|
-
return (
|
|
45
|
-
<div ref={ref} className={clsx('text-center', className)} {...props}>
|
|
46
|
-
{children}
|
|
47
|
-
</div>
|
|
48
|
-
);
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
const TestimonialPosition = forwardRef<
|
|
52
|
-
HTMLDivElement,
|
|
53
|
-
HTMLAttributes<HTMLDivElement>
|
|
54
|
-
>(({ className, children, ...props }, ref) => {
|
|
55
|
-
return (
|
|
56
|
-
<p
|
|
57
|
-
ref={ref}
|
|
58
|
-
className={clsx('text-md font-regular text-sm', className)}
|
|
59
|
-
{...props}
|
|
60
|
-
>
|
|
61
|
-
{children}
|
|
62
|
-
</p>
|
|
63
|
-
);
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
const TestimonialDate = forwardRef<
|
|
67
|
-
HTMLDivElement,
|
|
68
|
-
HTMLAttributes<HTMLDivElement>
|
|
69
|
-
>(({ className, children, ...props }, ref) => {
|
|
70
|
-
return (
|
|
71
|
-
<p ref={ref} className="font-regular text-sm" {...props}>
|
|
72
|
-
{children}
|
|
73
|
-
</p>
|
|
74
|
-
);
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
const TestimonialText = forwardRef<
|
|
78
|
-
HTMLDivElement,
|
|
79
|
-
HTMLAttributes<HTMLDivElement>
|
|
80
|
-
>(({ className, children, ...props }, ref) => {
|
|
81
|
-
return (
|
|
82
|
-
<p className={clsx('text-md text-center font-light')} {...props}>
|
|
83
|
-
{children}
|
|
84
|
-
</p>
|
|
85
|
-
);
|
|
86
|
-
});
|
|
87
|
-
|
|
88
|
-
const TestimonialAuthorDetails = forwardRef<
|
|
89
|
-
HTMLDivElement,
|
|
90
|
-
HTMLAttributes<HTMLDivElement>
|
|
91
|
-
>(({ className, children, ...props }, ref) => {
|
|
92
|
-
return (
|
|
93
|
-
<p
|
|
94
|
-
ref={ref}
|
|
95
|
-
className={clsx('text-center text-sm font-medium', className)}
|
|
96
|
-
{...props}
|
|
97
|
-
>
|
|
98
|
-
{children}
|
|
99
|
-
</p>
|
|
100
|
-
);
|
|
101
|
-
});
|
|
102
|
-
|
|
103
|
-
TestimonialComponent.displayName = 'Testimonial';
|
|
104
|
-
|
|
105
|
-
TestimonialImage.displayName = 'Testimonial.Image';
|
|
106
|
-
TestimonialTitle.displayName = 'Testimonial.Title';
|
|
107
|
-
TestimonialSection.displayName = 'Testimonial.Section';
|
|
108
|
-
TestimonialPosition.displayName = 'Testimonial.Position';
|
|
109
|
-
TestimonialDate.displayName = 'Testimonial.Date';
|
|
110
|
-
TestimonialText.displayName = 'Testimonial.Text';
|
|
111
|
-
TestimonialAuthorDetails.displayName = 'Testimonial.AuthorDetails';
|
|
112
|
-
|
|
113
|
-
const Testimonial = Object.assign(TestimonialComponent, {
|
|
114
|
-
Image: TestimonialImage,
|
|
115
|
-
Title: TestimonialTitle,
|
|
116
|
-
Section: TestimonialSection,
|
|
117
|
-
Position: TestimonialPosition,
|
|
118
|
-
Date: TestimonialDate,
|
|
119
|
-
Text: TestimonialText,
|
|
120
|
-
AuthorDetails: TestimonialAuthorDetails,
|
|
121
|
-
});
|
|
122
|
-
|
|
123
|
-
export { Testimonial };
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { Meta, StoryObj } from '@storybook/react';
|
|
2
|
-
|
|
3
|
-
import { TextArea } from '.';
|
|
4
|
-
|
|
5
|
-
const meta = {
|
|
6
|
-
title: 'V2Components/Text Area',
|
|
7
|
-
component: TextArea,
|
|
8
|
-
args: {
|
|
9
|
-
placeholder: 'This is a text area placeholder',
|
|
10
|
-
children: [
|
|
11
|
-
<TextArea.Item>
|
|
12
|
-
<TextArea.Label required>This is a label</TextArea.Label>
|
|
13
|
-
<TextArea.Box />
|
|
14
|
-
<TextArea.Validation />
|
|
15
|
-
</TextArea.Item>,
|
|
16
|
-
],
|
|
17
|
-
},
|
|
18
|
-
} satisfies Meta<typeof TextArea>;
|
|
19
|
-
|
|
20
|
-
export default meta;
|
|
21
|
-
|
|
22
|
-
type Story = StoryObj<typeof TextArea>;
|
|
23
|
-
|
|
24
|
-
export const Default: Story = {};
|
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
createContext,
|
|
3
|
-
forwardRef,
|
|
4
|
-
HTMLAttributes,
|
|
5
|
-
useContext,
|
|
6
|
-
useMemo,
|
|
7
|
-
useRef,
|
|
8
|
-
} from 'react';
|
|
9
|
-
|
|
10
|
-
import clsx from 'clsx';
|
|
11
|
-
|
|
12
|
-
export interface TextAreaContextProps {
|
|
13
|
-
autoComplete?: string;
|
|
14
|
-
disabled?: boolean;
|
|
15
|
-
formId?: string;
|
|
16
|
-
height?: string;
|
|
17
|
-
maxLength?: number;
|
|
18
|
-
minLength?: number;
|
|
19
|
-
pattern?: string;
|
|
20
|
-
required?: boolean;
|
|
21
|
-
readOnly?: boolean;
|
|
22
|
-
label?: string;
|
|
23
|
-
type?: string;
|
|
24
|
-
name?: string;
|
|
25
|
-
placeholder?: string;
|
|
26
|
-
withValidation?: boolean;
|
|
27
|
-
onChange?: (e: any) => void;
|
|
28
|
-
onBlur?: () => void;
|
|
29
|
-
onFocus?: () => void;
|
|
30
|
-
onClick?: () => void;
|
|
31
|
-
errors?: string[];
|
|
32
|
-
value?: string;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
const TextAreaContext = createContext<TextAreaContextProps | null>(null);
|
|
36
|
-
|
|
37
|
-
const TextAreaComponent = forwardRef<
|
|
38
|
-
HTMLDivElement,
|
|
39
|
-
HTMLAttributes<HTMLDivElement> & TextAreaContextProps
|
|
40
|
-
>(({ children, errors, placeholder, ...props }, ref) => {
|
|
41
|
-
const state = useMemo(
|
|
42
|
-
() => ({
|
|
43
|
-
errors,
|
|
44
|
-
placeholder,
|
|
45
|
-
...props,
|
|
46
|
-
}),
|
|
47
|
-
[errors, props],
|
|
48
|
-
);
|
|
49
|
-
return (
|
|
50
|
-
<TextAreaContext.Provider value={state}>
|
|
51
|
-
<div ref={ref}>{children}</div>
|
|
52
|
-
</TextAreaContext.Provider>
|
|
53
|
-
);
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
const TextAreaItem = forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement>>(
|
|
57
|
-
({ children, ...props }, ref) => {
|
|
58
|
-
const btnRef = useRef<any>(null);
|
|
59
|
-
return (
|
|
60
|
-
<div
|
|
61
|
-
className="mt-4 w-full cursor-pointer bg-white"
|
|
62
|
-
onClick={() => btnRef.current?.focus()}
|
|
63
|
-
ref={ref}
|
|
64
|
-
{...props}
|
|
65
|
-
>
|
|
66
|
-
{children}
|
|
67
|
-
</div>
|
|
68
|
-
);
|
|
69
|
-
},
|
|
70
|
-
);
|
|
71
|
-
|
|
72
|
-
const TextAreaLabel = forwardRef<
|
|
73
|
-
HTMLDivElement,
|
|
74
|
-
HTMLAttributes<HTMLDivElement> & { required?: boolean }
|
|
75
|
-
>(({ children, required = false }, ref) => {
|
|
76
|
-
return (
|
|
77
|
-
<div
|
|
78
|
-
ref={ref}
|
|
79
|
-
className="font-regular absolute -mt-3 ml-3 flex rounded-2xl bg-white px-1 text-sm "
|
|
80
|
-
>
|
|
81
|
-
<p>{children}</p>
|
|
82
|
-
{required && (
|
|
83
|
-
<p className="font-semiBold text-lg text-error-default"> *</p>
|
|
84
|
-
)}
|
|
85
|
-
</div>
|
|
86
|
-
);
|
|
87
|
-
});
|
|
88
|
-
|
|
89
|
-
const TextAreaBox = forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement>>(
|
|
90
|
-
({ ...props }) => {
|
|
91
|
-
const { errors, placeholder } = useContext(TextAreaContext) || {};
|
|
92
|
-
|
|
93
|
-
return (
|
|
94
|
-
<textarea
|
|
95
|
-
className="text-ink text-md w-full cursor-pointer rounded-md border border-black bg-white py-2 pl-4"
|
|
96
|
-
placeholder={placeholder}
|
|
97
|
-
/>
|
|
98
|
-
);
|
|
99
|
-
},
|
|
100
|
-
);
|
|
101
|
-
|
|
102
|
-
const TextAreaValidation = forwardRef<
|
|
103
|
-
HTMLDivElement,
|
|
104
|
-
HTMLAttributes<HTMLDivElement>
|
|
105
|
-
>(({ children, ...props }, ref) => {
|
|
106
|
-
const { errors } = useContext(TextAreaContext) || {};
|
|
107
|
-
return (
|
|
108
|
-
<div
|
|
109
|
-
ref={ref}
|
|
110
|
-
className="font-regular gap-y-2 text-sm text-error-default"
|
|
111
|
-
{...props}
|
|
112
|
-
>
|
|
113
|
-
{errors?.map((error, i) => {
|
|
114
|
-
return <p key={`error-msg-${i + 1}`}>{error}</p>;
|
|
115
|
-
})}
|
|
116
|
-
</div>
|
|
117
|
-
);
|
|
118
|
-
});
|
|
119
|
-
|
|
120
|
-
TextAreaComponent.displayName = 'TextArea';
|
|
121
|
-
TextAreaItem.displayName = 'TextArea.Item';
|
|
122
|
-
TextAreaLabel.displayName = 'TextArea.Label';
|
|
123
|
-
TextAreaBox.displayName = 'TextArea.Box';
|
|
124
|
-
TextAreaValidation.displayName = 'TextArea.Validation';
|
|
125
|
-
|
|
126
|
-
const TextArea = Object.assign(TextAreaComponent, {
|
|
127
|
-
Item: TextAreaItem,
|
|
128
|
-
Label: TextAreaLabel,
|
|
129
|
-
Box: TextAreaBox,
|
|
130
|
-
Validation: TextAreaValidation,
|
|
131
|
-
});
|
|
132
|
-
|
|
133
|
-
export { TextArea };
|