@verifiedinc-public/shared-ui-elements 1.3.3 → 2.0.0

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 (116) hide show
  1. package/README.md +3 -29
  2. package/dist/components/index.mjs +1 -0
  3. package/dist/hooks/index.mjs +1 -0
  4. package/dist/index.mjs +1 -0
  5. package/dist/shared/index-CTvz4BbG.mjs +105 -0
  6. package/dist/shared/phone.schema-XBbyizhq.mjs +1 -0
  7. package/dist/shared/shadows-fgmuXym6.mjs +1 -0
  8. package/dist/shared/unix.schema-CMYTtXco.mjs +1 -0
  9. package/dist/shared/useQRCode-DXiPIj-D.mjs +1 -0
  10. package/dist/shared/useSearchParams-CW9y02Ym.mjs +1 -0
  11. package/dist/styles/index.mjs +1 -0
  12. package/dist/utils/masks/index.mjs +1 -0
  13. package/dist/utils/string/index.mjs +1 -0
  14. package/dist/validations/index.mjs +1 -0
  15. package/package.json +29 -8
  16. package/dist/shared-ui-elements.mjs +0 -105
  17. package/src/components/Alert/Alert.tsx +0 -8
  18. package/src/components/Alert/FullWidthAlert.tsx +0 -27
  19. package/src/components/Alert/index.ts +0 -2
  20. package/src/components/Backdrop/index.tsx +0 -34
  21. package/src/components/Banners/Banner.tsx +0 -42
  22. package/src/components/Banners/ExactBirthdayBanner.tsx +0 -18
  23. package/src/components/Banners/ResendPhoneBanner.tsx +0 -55
  24. package/src/components/Banners/TestPhoneNumbersBanner.tsx +0 -25
  25. package/src/components/Banners/index.tsx +0 -4
  26. package/src/components/Button/index.tsx +0 -8
  27. package/src/components/CredentialRequestsEditor/CredentialRequestsEditor.context.tsx +0 -98
  28. package/src/components/CredentialRequestsEditor/components/CredentialRequestsField.tsx +0 -103
  29. package/src/components/CredentialRequestsEditor/components/DataFieldAccordion.tsx +0 -337
  30. package/src/components/CredentialRequestsEditor/components/DataFieldDeleteModal.tsx +0 -64
  31. package/src/components/CredentialRequestsEditor/components/DataFieldDescription.tsx +0 -68
  32. package/src/components/CredentialRequestsEditor/components/DataFieldMandatory.tsx +0 -84
  33. package/src/components/CredentialRequestsEditor/components/DataFieldMulti.tsx +0 -74
  34. package/src/components/CredentialRequestsEditor/components/DataFieldOptionType.tsx +0 -84
  35. package/src/components/CredentialRequestsEditor/components/DataFieldSection.tsx +0 -48
  36. package/src/components/CredentialRequestsEditor/components/DataFieldUserInput.tsx +0 -71
  37. package/src/components/CredentialRequestsEditor/components/RadioOption.tsx +0 -89
  38. package/src/components/CredentialRequestsEditor/contexts/CredentialRequestFieldContext.tsx +0 -36
  39. package/src/components/CredentialRequestsEditor/index.tsx +0 -15
  40. package/src/components/CredentialRequestsEditor/types/compositeCredentialSchema.ts +0 -1
  41. package/src/components/CredentialRequestsEditor/types/credentialSchemasDto.ts +0 -3
  42. package/src/components/CredentialRequestsEditor/types/form.ts +0 -28
  43. package/src/components/CredentialRequestsEditor/types/mandatoryEnum.ts +0 -5
  44. package/src/components/CredentialRequestsEditor/utils/buildDataFieldValue.ts +0 -65
  45. package/src/components/CredentialRequestsEditor/utils/prettyField.ts +0 -16
  46. package/src/components/Image.tsx +0 -10
  47. package/src/components/QRCodeDisplay/index.tsx +0 -50
  48. package/src/components/RequiredLabel/index.tsx +0 -15
  49. package/src/components/Snackbar/index.tsx +0 -156
  50. package/src/components/TextField/index.tsx +0 -8
  51. package/src/components/Tip/index.tsx +0 -18
  52. package/src/components/Typography/index.tsx +0 -8
  53. package/src/components/When.tsx +0 -28
  54. package/src/components/form/CountrySelector.tsx +0 -96
  55. package/src/components/form/DataFieldClearAdornment.tsx +0 -28
  56. package/src/components/form/DateInput.tsx +0 -78
  57. package/src/components/form/DefaultInput.tsx +0 -26
  58. package/src/components/form/InputMask.tsx +0 -41
  59. package/src/components/form/OTPInput.tsx +0 -254
  60. package/src/components/form/PhoneInput.tsx +0 -152
  61. package/src/components/form/SSNInput.tsx +0 -99
  62. package/src/components/form/SelectInput.tsx +0 -101
  63. package/src/components/form/TextMaskCustom.tsx +0 -48
  64. package/src/components/form/index.ts +0 -5
  65. package/src/components/index.ts +0 -13
  66. package/src/components/terms/AcceptTermsNotice.tsx +0 -27
  67. package/src/components/terms/LegalLink.tsx +0 -22
  68. package/src/components/verified/VerifiedImage.tsx +0 -272
  69. package/src/components/verified/VerifiedIncLogo.tsx +0 -11
  70. package/src/components/verified/index.ts +0 -2
  71. package/src/hooks/index.ts +0 -6
  72. package/src/hooks/useCallbackRef.ts +0 -22
  73. package/src/hooks/useCopyToClipboard.ts +0 -76
  74. package/src/hooks/useDisclosure.ts +0 -96
  75. package/src/hooks/useLocalStorage.ts +0 -24
  76. package/src/hooks/usePrevious.ts +0 -17
  77. package/src/hooks/useQRCode.ts +0 -62
  78. package/src/hooks/useSearchParams.ts +0 -7
  79. package/src/index.ts +0 -13
  80. package/src/stories/components/Alert.stories.tsx +0 -41
  81. package/src/stories/components/Button.stories.ts +0 -49
  82. package/src/stories/components/CredentialRequestsEditor.stories.tsx +0 -98
  83. package/src/stories/components/QRCodeDisplay.stories.tsx +0 -60
  84. package/src/stories/components/TextField.stories.ts +0 -59
  85. package/src/stories/components/Typography.stories.ts +0 -140
  86. package/src/stories/components/VerifiedImage.stories.tsx +0 -32
  87. package/src/stories/components/form/DateInput.stories.ts +0 -36
  88. package/src/stories/components/form/OTPInput.stories.tsx +0 -90
  89. package/src/stories/components/form/PhoneInput.stories.tsx +0 -34
  90. package/src/stories/components/form/SSNInput.stories.ts +0 -30
  91. package/src/stories/components/form/SelectInput.stories.ts +0 -39
  92. package/src/stories/hooks/useCopyToClipboard.stories.tsx +0 -45
  93. package/src/styles/colors.ts +0 -60
  94. package/src/styles/index.ts +0 -3
  95. package/src/styles/shadows.ts +0 -6
  96. package/src/styles/theme.ts +0 -257
  97. package/src/styles/typography.ts +0 -86
  98. package/src/utils/date.ts +0 -32
  99. package/src/utils/index.ts +0 -6
  100. package/src/utils/masks/index.ts +0 -6
  101. package/src/utils/omitProperty.ts +0 -19
  102. package/src/utils/phone.ts +0 -76
  103. package/src/utils/ssn.ts +0 -8
  104. package/src/utils/string/index.ts +0 -2
  105. package/src/utils/string/toCapitalize.ts +0 -13
  106. package/src/utils/string/toSentenceCase.ts +0 -7
  107. package/src/utils/wrapPromise.ts +0 -19
  108. package/src/validations/date.schema.ts +0 -18
  109. package/src/validations/description.schema.ts +0 -5
  110. package/src/validations/email.schema.ts +0 -3
  111. package/src/validations/field.schema.ts +0 -3
  112. package/src/validations/index.ts +0 -8
  113. package/src/validations/phone.schema.ts +0 -6
  114. package/src/validations/ssn.schema.ts +0 -24
  115. package/src/validations/state.schema.ts +0 -3
  116. package/src/validations/unix.schema.ts +0 -11
@@ -1,62 +0,0 @@
1
- import { useMemo } from 'react';
2
-
3
- import * as QRCode from 'qrcode';
4
-
5
- type QRCodeHookOptions = {
6
- size: number;
7
- imageSize: number;
8
- data: string;
9
- fill?: string;
10
- };
11
-
12
- export function useQRCode(hookOptions: QRCodeHookOptions) {
13
- const qrcode = useMemo(
14
- () => QRCode.create(hookOptions.data),
15
- [hookOptions.data],
16
- );
17
-
18
- // Data array of 1s and 0s
19
- const dataArray = qrcode.modules.data;
20
-
21
- return useMemo(() => {
22
- // Size of each square in the grid
23
- const squareSize = hookOptions.size / Math.sqrt(dataArray.length);
24
-
25
- // Create an SVG element
26
- let svg = `<svg viewBox="0 0 ${hookOptions.size} ${hookOptions.size}" xmlns="http://www.w3.org/2000/svg">`;
27
-
28
- // Define the logo size and position
29
- const imageSize = hookOptions.imageSize;
30
- const logoX = (hookOptions.size - imageSize) / 2;
31
- const logoY = (hookOptions.size - imageSize) / 2;
32
-
33
- // Loop through the data array and draw rectangles based on the values
34
- for (let i = 0; i < dataArray.length; i++) {
35
- // Get position to draw the circle
36
- const x = (i % Math.sqrt(dataArray.length)) * squareSize;
37
- const y = Math.floor(i / Math.sqrt(dataArray.length)) * squareSize;
38
- // Calculate the radius
39
- const radius = squareSize / 2;
40
-
41
- // Check if the current position should be painted black
42
- const shouldPaint = dataArray[i] === 1;
43
-
44
- // Check if the current position is within the logo area
45
- const isLogoArea =
46
- x + squareSize >= logoX &&
47
- x < logoX + imageSize &&
48
- y + squareSize >= logoY &&
49
- y < logoY + imageSize;
50
-
51
- // No need to paint white, this will improve performance a lot.
52
- if (!shouldPaint || isLogoArea) continue;
53
-
54
- // Create a rounded rectangle element and append to svg string
55
- svg += `<rect x="${x}" y="${y}" width="${squareSize}" height="${squareSize}" rx="${radius}" ry="${radius}" fill='${hookOptions.fill || '#000000'}' />`;
56
- }
57
-
58
- svg += '</svg>';
59
-
60
- return svg;
61
- }, [dataArray, hookOptions]);
62
- }
@@ -1,7 +0,0 @@
1
- /**
2
- * Returns a URLSearchParams object for the current URL search params.
3
- * @param search
4
- */
5
- export function useSearchParams(search?: string | URLSearchParams) {
6
- return new URLSearchParams(search ?? window.location.search);
7
- }
package/src/index.ts DELETED
@@ -1,13 +0,0 @@
1
- /**
2
- * The shared-ui-elements library is a collection of reusable, customizable UI components developed for Verified Inc..
3
- *
4
- * @see https://github.com/VerifiedInc/shared-ui-elements
5
- *
6
- * @packageDocumentation
7
- */
8
-
9
- export * from './components';
10
- export * from './hooks';
11
- export * from './styles';
12
- export * from './utils';
13
- export * from './validations';
@@ -1,41 +0,0 @@
1
- import type { Meta, StoryObj } from '@storybook/react';
2
- import { type ReactNode } from 'react';
3
- import { Alert } from '../../components/Alert';
4
- import { Button } from '@mui/material';
5
-
6
- // Define the type of props this component receives
7
- type PropsAndCustomArgs = React.ComponentProps<typeof Alert> & {
8
- text?: string;
9
- withAction?: boolean;
10
- };
11
-
12
- const renderActions = (withAction: boolean): ReactNode => {
13
- return withAction ? <Button>Action</Button> : undefined;
14
- };
15
-
16
- const meta: Meta<PropsAndCustomArgs> = {
17
- title: 'Components/Alert',
18
- component: Alert,
19
- render: ({ withAction = false, text = 'A default alert', ...args }) => {
20
- return (
21
- <Alert action={renderActions(withAction)} {...args}>
22
- {text}
23
- </Alert>
24
- );
25
- },
26
- };
27
-
28
- export default meta;
29
- type Story = StoryObj<PropsAndCustomArgs>;
30
-
31
- // A default alert
32
- export const Default: Story = {};
33
-
34
- // An alert with an action Button
35
- export const WithButton: Story = {
36
- args: {
37
- withAction: true,
38
- severity: 'info',
39
- text: 'An alert with an action',
40
- },
41
- };
@@ -1,49 +0,0 @@
1
- import type { Meta, StoryObj } from '@storybook/react';
2
- import { fn } from '@storybook/test';
3
-
4
- import { Button } from '../../components/Button';
5
-
6
- // More on how to set up stories at: https://storybook.js.org/docs/writing-stories#default-export
7
- const meta = {
8
- title: 'Components/Button',
9
- component: Button,
10
- parameters: {
11
- // Optional parameter to center the component in the Canvas. More info: https://storybook.js.org/docs/configure/story-layout
12
- layout: 'centered',
13
- },
14
- // This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/writing-docs/autodocs
15
- tags: ['autodocs'],
16
- // More on argTypes: https://storybook.js.org/docs/api/argtypes
17
- argTypes: {
18
- variant: {
19
- options: ['contained', 'outlined', 'text'],
20
- control: { type: 'radio' },
21
- },
22
- color: {
23
- options: ['primary', 'secondary', 'warning', 'error', 'neutral'],
24
- control: { type: 'radio' },
25
- },
26
- },
27
- // Use `fn` to spy on the onClick arg, which will appear in the actions panel once invoked: https://storybook.js.org/docs/essentials/actions#action-args
28
- args: { onClick: fn() },
29
- } satisfies Meta<typeof Button>;
30
-
31
- export default meta;
32
- type Story = StoryObj<typeof meta>;
33
-
34
- // More on writing stories with args: https://storybook.js.org/docs/writing-stories/args
35
- export const Primary: Story = {
36
- args: {
37
- variant: 'contained',
38
- color: 'primary',
39
- children: 'Primary',
40
- },
41
- };
42
-
43
- export const Secondary: Story = {
44
- args: {
45
- variant: 'contained',
46
- color: 'secondary',
47
- children: 'Secondary',
48
- },
49
- };
@@ -1,98 +0,0 @@
1
- import type { Meta, StoryObj } from '@storybook/react';
2
- import { fn } from '@storybook/test';
3
- import { Box } from '@mui/material';
4
-
5
- import { buildDataFieldValue } from '../../components/CredentialRequestsEditor/utils/buildDataFieldValue';
6
- import { CredentialRequestsEditor } from '../../components/CredentialRequestsEditor';
7
-
8
- // More on how to set up stories at: https://storybook.js.org/docs/writing-stories#default-export
9
- const meta = {
10
- title: 'Components/CredentialRequestsEditor',
11
- component: CredentialRequestsEditor,
12
- render: (args: any, { loaded: { credentialRequests, schemas } }) => (
13
- <Box width={440}>
14
- <CredentialRequestsEditor
15
- {...args}
16
- credentialRequests={credentialRequests}
17
- schemas={schemas}
18
- />
19
- </Box>
20
- ),
21
- parameters: {
22
- // Optional parameter to center the component in the Canvas. More info: https://storybook.js.org/docs/configure/story-layout
23
- layout: 'centered',
24
- docs: {
25
- description: {
26
- component:
27
- '⚠️ REQUIRES schema resolver V2 to be running locally in order to fetch schemas.',
28
- },
29
- },
30
- },
31
- // This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/writing-docs/autodocs
32
- tags: ['autodocs'],
33
- // More on argTypes: https://storybook.js.org/docs/api/argtypes
34
- argTypes: {
35
- credentialRequests: {
36
- description: 'This props is used to populate the credential requests.',
37
- },
38
- schemas: {
39
- description:
40
- 'Schemas are being used to populate the field types, also it maps its children types to the parent.',
41
- },
42
- addButtonText: {
43
- type: 'string',
44
- description:
45
- 'This props is used to set the text of the button that adds a new credential request.',
46
- },
47
- features: {
48
- control: 'object',
49
- description: 'This props is used to enable or disable features.',
50
- },
51
- },
52
- } satisfies Meta<typeof CredentialRequestsEditor>;
53
-
54
- export default meta;
55
- type Story = StoryObj<typeof meta>;
56
-
57
- // More on writing stories with args: https://storybook.js.org/docs/writing-stories/args
58
- export const Default: Story = {
59
- loaders: [
60
- async () => {
61
- const schemas = await (
62
- await fetch('http://localhost:6061/jsonSchema')
63
- ).json();
64
-
65
- const credentialRequests = [
66
- buildDataFieldValue('FullNameCredential', schemas),
67
- buildDataFieldValue('PhoneCredential', schemas),
68
- buildDataFieldValue('AddressCredential', schemas),
69
- buildDataFieldValue('BirthDateCredential', schemas),
70
- buildDataFieldValue('SsnCredential', schemas),
71
- ];
72
-
73
- return {
74
- credentialRequests,
75
- schemas,
76
- };
77
- },
78
- ],
79
- args: {
80
- credentialRequests: [],
81
- schemas: {},
82
- onChange: fn() as any,
83
- features: {
84
- allowUserInput: {
85
- disabled: false,
86
- },
87
- description: {
88
- disabled: false,
89
- },
90
- mandatory: {
91
- disabled: false,
92
- },
93
- multi: {
94
- disabled: false,
95
- },
96
- },
97
- },
98
- };
@@ -1,60 +0,0 @@
1
- import type { Meta, StoryObj } from '@storybook/react';
2
- import { Box } from '@mui/material';
3
-
4
- import { QRCodeDisplay } from '../../components';
5
-
6
- // More on how to set up stories at: https://storybook.js.org/docs/writing-stories#default-export
7
- const meta = {
8
- title: 'Components/QRCodeDisplay',
9
- component: QRCodeDisplay,
10
- render: (args: any) => (
11
- <Box width={300} mx='auto'>
12
- <QRCodeDisplay {...args} />
13
- </Box>
14
- ),
15
- parameters: {
16
- // Optional parameter to center the component in the Canvas. More info: https://storybook.js.org/docs/configure/story-layout
17
- layout: 'centered',
18
- docs: {
19
- description: {
20
- component:
21
- 'Component that displays a QR code with a logo in the center.',
22
- },
23
- },
24
- },
25
- // This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/writing-docs/autodocs
26
- tags: ['autodocs'],
27
- // More on argTypes: https://storybook.js.org/docs/api/argtypes
28
- argTypes: {
29
- asset: {
30
- type: 'string',
31
- description: 'Asset url to be loaded within the logo of the QR code.',
32
- },
33
- data: {
34
- type: 'string',
35
- description: 'Data string contained within the QR code.',
36
- },
37
- svgSize: {
38
- type: 'number',
39
- description: 'Size of the SVG element.',
40
- },
41
- logoSize: {
42
- type: 'number',
43
- description: 'Size of the logo within the QR code.',
44
- },
45
- fill: {
46
- type: 'string',
47
- description: 'Fill color of the QR code squares.',
48
- },
49
- },
50
- } satisfies Meta<typeof QRCodeDisplay>;
51
-
52
- export default meta;
53
- type Story = StoryObj<typeof meta>;
54
-
55
- export const Default: Story = {
56
- args: {
57
- data: 'Some text encoded within a QR code.',
58
- asset: undefined,
59
- },
60
- };
@@ -1,59 +0,0 @@
1
- import type { Meta, StoryObj } from '@storybook/react';
2
-
3
- import { TextField } from '../../components/TextField';
4
-
5
- // More on how to set up stories at: https://storybook.js.org/docs/writing-stories#default-export
6
- const meta = {
7
- title: 'Components/TextField',
8
- component: TextField,
9
- parameters: {
10
- // Optional parameter to center the component in the Canvas. More info: https://storybook.js.org/docs/configure/story-layout
11
- layout: 'centered',
12
- },
13
- // This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/writing-docs/autodocs
14
- tags: ['autodocs'],
15
- // More on argTypes: https://storybook.js.org/docs/api/argtypes
16
- argTypes: {
17
- variant: {
18
- description: 'The variant to use.',
19
- type: { name: 'enum', value: ['outlined', 'standard', 'filled'] },
20
- table: {
21
- defaultValue: { summary: 'standard' },
22
- },
23
- },
24
- size: {
25
- description: 'The size of the component.',
26
- type: { name: 'enum', value: ['small', 'medium'] },
27
- table: {
28
- defaultValue: { summary: 'medium' },
29
- },
30
- },
31
- },
32
- args: {
33
- size: 'medium',
34
- variant: 'standard',
35
- },
36
- } satisfies Meta<typeof TextField>;
37
-
38
- export default meta;
39
- type Story = StoryObj<typeof meta>;
40
-
41
- // More on writing stories with args: https://storybook.js.org/docs/writing-stories/args
42
- export const Outlined: Story = {
43
- args: {
44
- label: 'Label',
45
- variant: 'outlined',
46
- placeholder: 'Placeholder',
47
- },
48
- };
49
-
50
- export const OutlinedFixedLabel: Story = {
51
- args: {
52
- label: 'Label',
53
- variant: 'outlined',
54
- placeholder: 'Placeholder',
55
- InputLabelProps: {
56
- shrink: true,
57
- },
58
- },
59
- };
@@ -1,140 +0,0 @@
1
- import type { Meta, StoryObj } from '@storybook/react';
2
-
3
- import { Typography } from '../../components/Typography';
4
-
5
- // More on how to set up stories at: https://storybook.js.org/docs/writing-stories#default-export
6
- const meta = {
7
- title: 'Components/Typography',
8
- component: Typography,
9
- parameters: {
10
- // Optional parameter to center the component in the Canvas. More info: https://storybook.js.org/docs/configure/story-layout
11
- layout: 'centered',
12
- },
13
- // This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/writing-docs/autodocs
14
- tags: ['autodocs'],
15
- // More on argTypes: https://storybook.js.org/docs/api/argtypes
16
- argTypes: {
17
- align: {
18
- options: ['center', 'inherit', 'justify', 'left', 'right'],
19
- control: { type: 'radio' },
20
- description: 'Set the text-align on the component.',
21
- table: {
22
- defaultValue: { summary: 'left' },
23
- },
24
- },
25
- variant: {
26
- options: [
27
- 'h1',
28
- 'h2',
29
- 'h3',
30
- 'h4',
31
- 'h5',
32
- 'h6',
33
- 'subtitle1',
34
- 'subtitle2',
35
- 'body1',
36
- 'body2',
37
- 'caption',
38
- 'button',
39
- 'overline',
40
- ],
41
- control: { type: 'radio' },
42
- description: 'Applies the theme typography styles.',
43
- table: {
44
- defaultValue: { summary: 'body1' },
45
- },
46
- },
47
- children: {
48
- description: 'The content of the component.',
49
- type: 'string',
50
- },
51
- },
52
- } satisfies Meta<typeof Typography>;
53
-
54
- export default meta;
55
- type Story = StoryObj<typeof meta>;
56
-
57
- // More on writing stories with args: https://storybook.js.org/docs/writing-stories/args
58
- export const Heading1: Story = {
59
- args: {
60
- variant: 'h1',
61
- children: 'Heading 1',
62
- },
63
- };
64
-
65
- export const Heading2: Story = {
66
- args: {
67
- variant: 'h2',
68
- children: 'Heading 2',
69
- },
70
- };
71
-
72
- export const Heading3: Story = {
73
- args: {
74
- variant: 'h3',
75
- children: 'Heading 3',
76
- },
77
- };
78
-
79
- export const Heading4: Story = {
80
- args: {
81
- variant: 'h4',
82
- children: 'Heading 4',
83
- },
84
- };
85
-
86
- export const Heading5: Story = {
87
- args: {
88
- variant: 'h5',
89
- children: 'Heading 5',
90
- },
91
- };
92
-
93
- export const Heading6: Story = {
94
- args: {
95
- variant: 'h6',
96
- children: 'Heading 6',
97
- },
98
- };
99
-
100
- export const Subtitle1: Story = {
101
- args: {
102
- variant: 'subtitle1',
103
- children: 'Subtitle 1',
104
- },
105
- };
106
-
107
- export const Subtitle2: Story = {
108
- args: {
109
- variant: 'subtitle2',
110
- children: 'Subtitle 2',
111
- },
112
- };
113
-
114
- export const Body1: Story = {
115
- args: {
116
- variant: 'body1',
117
- children: 'Body 1',
118
- },
119
- };
120
-
121
- export const Body2: Story = {
122
- args: {
123
- variant: 'body2',
124
- children: 'Body 2',
125
- },
126
- };
127
-
128
- export const Button: Story = {
129
- args: {
130
- variant: 'button',
131
- children: 'Button',
132
- },
133
- };
134
-
135
- export const Overline: Story = {
136
- args: {
137
- variant: 'overline',
138
- children: 'Overline',
139
- },
140
- };
@@ -1,32 +0,0 @@
1
- import { VerifiedImage } from '../../components/verified/VerifiedImage';
2
-
3
- // More on how to set up stories at: https://storybook.js.org/docs/writing-stories#default-export
4
- export default {
5
- title: 'Components/VerifiedImage',
6
- component: VerifiedImage,
7
- parameters: {
8
- // Optional parameter to center the component in the Canvas. More info: https://storybook.js.org/docs/configure/story-layout
9
- layout: 'centered',
10
- },
11
- argTypes: {
12
- themeLight: { control: { type: 'color' } },
13
- themeMain: { control: { type: 'color' } },
14
- themeDark: { control: { type: 'color' } },
15
- },
16
- // This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/writing-docs/autodocs
17
- tags: ['autodocs'],
18
- };
19
-
20
- const Template = ({ themeLight, themeMain, themeDark, ...args }: any) => (
21
- <VerifiedImage
22
- {...args}
23
- theme={{ light: themeLight, main: themeMain, dark: themeDark }}
24
- />
25
- );
26
-
27
- export const Default: any = Template.bind({});
28
- Default.args = {
29
- themeLight: '#0DBC3D',
30
- themeMain: '#0DBC3D',
31
- themeDark: '#0DBC3D',
32
- };
@@ -1,36 +0,0 @@
1
- import type { Meta, StoryObj } from '@storybook/react';
2
- import { fn } from '@storybook/test';
3
- import { DateInput } from '../../../components/form/DateInput';
4
-
5
- // More on how to set up stories at: https://storybook.js.org/docs/writing-stories#default-export
6
- const meta = {
7
- title: 'Components/DateInput',
8
- component: DateInput,
9
- parameters: {
10
- // Optional parameter to center the component in the Canvas. More info: https://storybook.js.org/docs/configure/story-layout
11
- layout: 'centered',
12
- },
13
- // This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/writing-docs/autodocs
14
- tags: ['autodocs'],
15
- argTypes: {
16
- size: { control: 'select', options: ['small', 'medium'] },
17
- value: { control: 'date' },
18
- },
19
- } satisfies Meta<typeof DateInput>;
20
-
21
- export default meta;
22
- type Story = StoryObj<typeof meta>;
23
-
24
- // More on writing stories with args: https://storybook.js.org/docs/writing-stories/args
25
- export const Default: Story = {
26
- args: {
27
- name: 'date',
28
- label: 'Label',
29
- onChange: fn(),
30
- disabled: false,
31
- error: false,
32
- size: 'small',
33
- helperText: 'Helper text',
34
- },
35
- argTypes: {},
36
- };
@@ -1,90 +0,0 @@
1
- import type { Meta, StoryObj } from '@storybook/react';
2
-
3
- import { Box } from '@mui/material';
4
- import { fn } from '@storybook/test';
5
- import {
6
- OTPInput,
7
- type OTPInputInstance,
8
- } from '../../../components/form/OTPInput';
9
- import { useRef } from 'react';
10
- import { Button } from '../../../components';
11
-
12
- // More on how to set up stories at: https://storybook.js.org/docs/writing-stories#default-export
13
-
14
- const meta = {
15
- title: 'Components/OTPInput',
16
-
17
- component: OTPInput,
18
- parameters: {
19
- // Optional parameter to center the component in the Canvas. More info: https://storybook.js.org/docs/configure/story-layout
20
- layout: 'centered',
21
- },
22
- // This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/writing-docs/autodocs
23
- tags: ['autodocs'],
24
- args: {
25
- name: 'otp',
26
- onChange: fn(),
27
- disabled: false,
28
- },
29
- argTypes: {
30
- ref: {
31
- description:
32
- 'Ref to the OTPInput instance. It can be used to control the input from outside. See the example OTPWithControls.',
33
- },
34
- },
35
- } satisfies Meta<typeof OTPInput>;
36
-
37
- export default meta;
38
- type Story = StoryObj<typeof OTPInput>;
39
-
40
- // More on writing stories with args: https://storybook.js.org/docs/writing-stories/args
41
- export const Default: Story = {};
42
-
43
- interface OTPWithControlsProps {
44
- name?: string;
45
- onChange?: (event: { target: { value: string } }) => void;
46
- disabled?: boolean;
47
- }
48
-
49
- /**
50
- *
51
- * This is a wrapper component for OTPInput
52
- * It was needed to demonstrate the focus, blur and clear functionality of OTPInput via useRef
53
- * It shows the OtpInput wrapped in a Box with 3 buttons to demonstrate focus, blur and clear functionality
54
- */
55
-
56
- export function OTPWithControls(
57
- OTPWithControlsProps: OTPWithControlsProps,
58
- ): React.JSX.Element {
59
- const oneClickSignupSubmitInputRef = useRef<OTPInputInstance | null>(null);
60
-
61
- return (
62
- <Box>
63
- <OTPInput {...OTPWithControlsProps} ref={oneClickSignupSubmitInputRef} />
64
- <Button
65
- onClick={() => {
66
- oneClickSignupSubmitInputRef.current?.focus();
67
- }}
68
- >
69
- Focus
70
- </Button>
71
-
72
- <Button
73
- color='secondary'
74
- onClick={() => {
75
- oneClickSignupSubmitInputRef.current?.blur();
76
- }}
77
- >
78
- Blur
79
- </Button>
80
- <Button
81
- color='error'
82
- onClick={() => {
83
- oneClickSignupSubmitInputRef.current?.clear();
84
- }}
85
- >
86
- Clear
87
- </Button>
88
- </Box>
89
- );
90
- }