@blockscout/ui-toolkit 0.0.1-alpha.2 → 0.0.1-alpha.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.
Files changed (103) hide show
  1. package/README.md +125 -62
  2. package/dist/chakra/select.d.ts +4 -1
  3. package/dist/components/AdaptiveTabs/index.d.ts +3 -0
  4. package/dist/components/Hint/Hint.d.ts +11 -0
  5. package/dist/components/RoutedTabs/index.d.ts +3 -0
  6. package/dist/components/buttons/BackToButton.d.ts +7 -0
  7. package/dist/components/buttons/ClearButton.d.ts +6 -0
  8. package/dist/components/{Filter → filters}/FilterInput.d.ts +2 -3
  9. package/dist/components/forms/components/FormFieldError.d.ts +7 -0
  10. package/dist/components/forms/components/index.d.ts +1 -0
  11. package/dist/components/forms/fields/FormFieldAddress.d.ts +5 -0
  12. package/dist/components/forms/fields/FormFieldCheckbox.d.ts +9 -0
  13. package/dist/components/forms/fields/FormFieldColor.d.ts +9 -0
  14. package/dist/components/forms/fields/FormFieldEmail.d.ts +5 -0
  15. package/dist/components/forms/fields/FormFieldSelect.d.ts +7 -0
  16. package/dist/components/forms/fields/FormFieldSelectAsync.d.ts +7 -0
  17. package/dist/components/forms/fields/FormFieldText.d.ts +8 -0
  18. package/dist/components/forms/fields/FormFieldUrl.d.ts +4 -0
  19. package/dist/components/forms/fields/image/FormFieldImagePreview.d.ts +13 -0
  20. package/dist/components/forms/fields/image/useImageField.d.ts +25 -0
  21. package/dist/components/forms/fields/index.d.ts +10 -0
  22. package/dist/components/forms/fields/types.d.ts +19 -0
  23. package/dist/components/forms/inputs/file/DragAndDropArea.d.ts +11 -0
  24. package/dist/components/forms/inputs/file/FileInput.d.ts +13 -0
  25. package/dist/components/forms/inputs/file/FileSnippet.d.ts +11 -0
  26. package/dist/components/forms/inputs/file/utils.d.ts +2 -0
  27. package/dist/components/forms/inputs/index.d.ts +3 -0
  28. package/dist/components/forms/utils/getFormFieldErrorText.d.ts +2 -0
  29. package/dist/components/forms/utils/index.d.ts +1 -0
  30. package/dist/components/forms/validators/address.d.ts +3 -0
  31. package/dist/components/forms/validators/color.d.ts +2 -0
  32. package/dist/components/forms/validators/email.d.ts +2 -0
  33. package/dist/components/forms/validators/index.d.ts +7 -0
  34. package/dist/components/forms/validators/signature.d.ts +1 -0
  35. package/dist/components/forms/validators/text.d.ts +1 -0
  36. package/dist/components/forms/validators/transaction.d.ts +2 -0
  37. package/dist/components/forms/validators/url.d.ts +3 -0
  38. package/dist/components/truncation/TruncatedTextTooltip.d.ts +8 -0
  39. package/dist/hooks/useClipboard.d.ts +1 -1
  40. package/dist/hooks/useFirstMountState.d.ts +1 -0
  41. package/dist/hooks/useIsSticky.d.ts +2 -0
  42. package/dist/hooks/useUpdateEffect.d.ts +2 -0
  43. package/dist/hooks/useViewportSize.d.ts +1 -1
  44. package/dist/index.js +4246 -3097
  45. package/dist/package/src/index.d.ts +24 -3
  46. package/dist/theme/theme.d.ts +1 -0
  47. package/dist/utils/consts.d.ts +15 -0
  48. package/dist/utils/guards.d.ts +2 -0
  49. package/dist/utils/htmlEntities.d.ts +26 -0
  50. package/dist/utils/isBrowser.d.ts +1 -0
  51. package/dist/utils/regexp.d.ts +6 -0
  52. package/dist/utils/url.d.ts +6 -0
  53. package/package.json +33 -3
  54. package/dist/components/ButtonBackTo.d.ts +0 -8
  55. package/dist/components/TruncatedTextTooltip.d.ts +0 -9
  56. package/dist/components/index.d.ts +0 -1
  57. package/dist/theme/foundations/animations.ts +0 -12
  58. package/dist/theme/foundations/borders.ts +0 -13
  59. package/dist/theme/foundations/breakpoints.ts +0 -10
  60. package/dist/theme/foundations/colors.ts +0 -162
  61. package/dist/theme/foundations/durations.ts +0 -15
  62. package/dist/theme/foundations/semanticTokens.ts +0 -471
  63. package/dist/theme/foundations/shadows.ts +0 -19
  64. package/dist/theme/foundations/typography.ts +0 -93
  65. package/dist/theme/foundations/zIndex.ts +0 -20
  66. package/dist/theme/globalCss.ts +0 -57
  67. package/dist/theme/globals/address-entity.ts +0 -33
  68. package/dist/theme/globals/recaptcha.ts +0 -20
  69. package/dist/theme/globals/scrollbar.ts +0 -32
  70. package/dist/theme/recipes/accordion.recipe.ts +0 -145
  71. package/dist/theme/recipes/alert.recipe.ts +0 -135
  72. package/dist/theme/recipes/badge.recipe.ts +0 -83
  73. package/dist/theme/recipes/button.recipe.ts +0 -285
  74. package/dist/theme/recipes/checkbox.recipe.ts +0 -56
  75. package/dist/theme/recipes/checkmark.recipe.ts +0 -73
  76. package/dist/theme/recipes/close-button.recipe.ts +0 -34
  77. package/dist/theme/recipes/dialog.recipe.ts +0 -213
  78. package/dist/theme/recipes/drawer.recipe.ts +0 -173
  79. package/dist/theme/recipes/field.recipe.ts +0 -175
  80. package/dist/theme/recipes/index.ts +0 -68
  81. package/dist/theme/recipes/input.recipe.ts +0 -119
  82. package/dist/theme/recipes/link.recipe.ts +0 -78
  83. package/dist/theme/recipes/list.recipe.ts +0 -67
  84. package/dist/theme/recipes/menu.recipe.ts +0 -105
  85. package/dist/theme/recipes/pin-input.recipe.ts +0 -35
  86. package/dist/theme/recipes/popover.recipe.ts +0 -71
  87. package/dist/theme/recipes/progress-circle.recipe.ts +0 -74
  88. package/dist/theme/recipes/radio-group.recipe.ts +0 -73
  89. package/dist/theme/recipes/radiomark.recipe.ts +0 -91
  90. package/dist/theme/recipes/rating-group.recipe.ts +0 -93
  91. package/dist/theme/recipes/select.recipe.ts +0 -277
  92. package/dist/theme/recipes/skeleton.recipe.ts +0 -56
  93. package/dist/theme/recipes/spinner.recipe.ts +0 -31
  94. package/dist/theme/recipes/stat.recipe.ts +0 -101
  95. package/dist/theme/recipes/switch.recipe.ts +0 -130
  96. package/dist/theme/recipes/table.recipe.ts +0 -84
  97. package/dist/theme/recipes/tabs.recipe.ts +0 -219
  98. package/dist/theme/recipes/tag.recipe.ts +0 -145
  99. package/dist/theme/recipes/textarea.recipe.ts +0 -86
  100. package/dist/theme/recipes/toast.recipe.ts +0 -97
  101. package/dist/theme/recipes/tooltip.recipe.ts +0 -85
  102. package/dist/theme/theme.ts +0 -41
  103. package/dist/theme/utils/entries.ts +0 -12
package/README.md CHANGED
@@ -1,28 +1,93 @@
1
- <!-- TODO @tom2drum rewrite README -->
2
- <!-- TODO @tom2drum add build check to CI workflow -->
3
- <!-- TODO @tom2drum add publish workflow -->
4
- <!-- TODO @tom2drum add eslint rules (?) to discourage use of IconSvg -->
5
- <!-- TODO @tom2drum tree shake project files (e.g config) -->
6
- <!-- TODO @tom2drum try to put all project deps to the toolkit folder -->
7
- <!-- TODO @tom2drum clean up tsconfig and vite config -->
1
+ # Blockscout UI Toolkit
8
2
 
9
- # Your Organization's UI Toolkit
3
+ A comprehensive collection of reusable Chakra UI components and theme system for Blockscout's projects. This toolkit provides a consistent design system and UI components to maintain visual consistency across Blockscout applications.
10
4
 
11
- A collection of reusable Chakra UI components and theme for your organization's projects.
5
+ ## Features
6
+
7
+ - 🎨 Pre-configured Chakra UI theme with Blockscout's design system
8
+ - 🧩 Reusable UI components built on Chakra UI
9
+ - 🌓 Built-in dark mode support
10
+ - 📱 Responsive and accessible components
11
+ - 🔍 TypeScript support with proper type definitions
12
12
 
13
13
  ## Installation
14
14
 
15
+ ### Package Installation
16
+
17
+ Install the package using your preferred package manager:
18
+
15
19
  ```bash
16
- npm install @your-org/toolkit
17
- # or
18
- yarn add @your-org/toolkit
20
+ # Using npm
21
+ npm install @blockscout/ui-toolkit
22
+
23
+ # Using yarn
24
+ yarn add @blockscout/ui-toolkit
25
+ ```
26
+
27
+ ### Required Dependencies
28
+
29
+ Ensure you have the following peer dependencies installed:
30
+
31
+ ```json
32
+ {
33
+ "dependencies": {
34
+ "@blockscout/ui-toolkit": "latest",
35
+ "@chakra-ui/react": ">=3.15.0",
36
+ "@emotion/react": ">=11.14.0",
37
+ "next": ">=15.2.3",
38
+ "next-themes": ">=0.4.4",
39
+ "react": ">=18.3.1",
40
+ "react-dom": ">=18.3.1",
41
+ "react-hook-form": ">=7.52.1"
42
+ },
43
+ "devDependencies": {
44
+ "@chakra-ui/cli": ">=3.15.0",
45
+ "@types/node": "^20",
46
+ "@types/react": "18.3.12",
47
+ "@types/react-dom": "18.3.1",
48
+ "typescript": "5.4.2"
49
+ }
50
+ }
51
+ ```
52
+
53
+ ## Quick Start
54
+
55
+ ### 1. Theme Setup
56
+
57
+ Create a `theme.ts` file in your project and configure the Blockscout theme:
58
+
59
+ ```tsx
60
+ // Basic setup
61
+ import { theme } from '@blockscout/ui-toolkit';
62
+ export default theme;
63
+ ```
64
+
65
+ Or extend the theme with custom overrides:
66
+
67
+ ```tsx
68
+ import { createSystem } from '@chakra-ui/react';
69
+ import { themeConfig } from '@blockscout/ui-toolkit';
70
+
71
+ const customOverrides = {
72
+ // Add your custom theme overrides here
73
+ colors: {
74
+ brand: {
75
+ primary: '#your-color',
76
+ },
77
+ },
78
+ };
79
+
80
+ export default createSystem(themeConfig, customOverrides);
19
81
  ```
20
82
 
21
- ## Usage
83
+ ### 2. Provider Setup
84
+
85
+ Wrap your application with the ChakraProvider:
22
86
 
23
87
  ```tsx
24
- import { Button, theme } from '@your-org/toolkit';
25
88
  import { ChakraProvider } from '@chakra-ui/react';
89
+ import { Button } from '@blockscout/ui-toolkit';
90
+ import theme from './theme';
26
91
 
27
92
  function App() {
28
93
  return (
@@ -33,75 +98,73 @@ function App() {
33
98
  }
34
99
  ```
35
100
 
101
+ ### 3. TypeScript Support
102
+
103
+ Add the following script to your `package.json` to generate Chakra UI type definitions:
104
+
105
+ ```json
106
+ {
107
+ "scripts": {
108
+ "chakra:typegen": "chakra typegen ./src/theme.ts"
109
+ }
110
+ }
111
+ ```
112
+
36
113
  ## Development
37
114
 
38
- 1. Install dependencies:
115
+ ### Local Development
116
+
117
+ 1. Clone the repository and install dependencies:
39
118
  ```bash
40
- npm install
41
- # or
42
119
  yarn
43
120
  ```
44
121
 
45
- 2. Start development server:
122
+ 2. Start the development server:
46
123
  ```bash
47
- npm run dev
48
- # or
49
124
  yarn dev
50
125
  ```
51
126
 
52
127
  3. Build the package:
53
128
  ```bash
54
- npm run build
55
- # or
56
129
  yarn build
57
130
  ```
58
131
 
59
- ## Publishing
132
+ ### Publishing
133
+
134
+ #### Manual Publishing
135
+
136
+ 1. Update the package version:
137
+ ```bash
138
+ npm version <version-tag>
139
+ ```
60
140
 
61
- 1. Update the version in `package.json`
62
141
  2. Build the package:
63
142
  ```bash
64
143
  npm run build
65
144
  ```
145
+
66
146
  3. Publish to NPM:
67
147
  ```bash
68
- npm publish
148
+ npm publish --access public
69
149
  ```
70
150
 
71
- ## Available Components
72
-
73
- - Accordion
74
- - Alert
75
- - Avatar
76
- - Badge
77
- - Button
78
- - Checkbox
79
- - Close Button
80
- - Collapsible
81
- - Color Mode
82
- - Dialog
83
- - Drawer
84
- - Field
85
- - Heading
86
- - Icon Button
87
- - Image
88
- - Input
89
- - Input Group
90
- - Link
91
- - Menu
92
- - Pin Input
93
- - Popover
94
- - Progress Circle
95
- - Provider
96
- - Radio
97
- - Rating
98
- - Select
99
- - Skeleton
100
- - Slider
101
- - Switch
102
- - Table
103
- - Tabs
104
- - Tag
105
- - Textarea
106
- - Toaster
107
- - Tooltip
151
+ #### Automated Publishing
152
+
153
+ Use the `toolkit-npm-publisher.yml` GitHub Actions workflow for automated publishing.
154
+
155
+ ## Contributing
156
+
157
+ We welcome contributions! Please follow these steps:
158
+
159
+ 1. Fork the repository
160
+ 2. Create a feature branch
161
+ 3. Make your changes
162
+ 4. Submit a pull request
163
+
164
+ ## Support
165
+
166
+ For issues, feature requests, or questions, please open an issue in the repository.
167
+
168
+ ## License
169
+
170
+ This project is licensed under the GNU General Public License v3.
@@ -17,7 +17,10 @@ interface SelectContentProps extends ChakraSelect.ContentProps {
17
17
  portalRef?: React.RefObject<HTMLElement>;
18
18
  }
19
19
  export declare const SelectContent: React.ForwardRefExoticComponent<SelectContentProps & React.RefAttributes<HTMLDivElement>>;
20
- export declare const SelectItem: React.ForwardRefExoticComponent<ChakraSelect.ItemProps & React.RefAttributes<HTMLDivElement>>;
20
+ export interface SelectItemProps extends ChakraSelect.ItemProps {
21
+ item: SelectOption;
22
+ }
23
+ export declare const SelectItem: React.ForwardRefExoticComponent<SelectItemProps & React.RefAttributes<HTMLDivElement>>;
21
24
  interface SelectValueTextProps extends Omit<ChakraSelect.ValueTextProps, 'children'> {
22
25
  children?(items: Array<SelectOption>): React.ReactNode;
23
26
  size?: SelectRootProps['size'];
@@ -0,0 +1,3 @@
1
+ export type { TabItemRegular, TabItemMenu, SubTabItem } from './types';
2
+ export type { Props } from './AdaptiveTabs';
3
+ export { default } from './AdaptiveTabs';
@@ -0,0 +1,11 @@
1
+ import { default as React } from 'react';
2
+ import { IconButtonProps } from '../../chakra/icon-button';
3
+ import { TooltipProps } from '../../chakra/tooltip';
4
+ interface Props extends IconButtonProps {
5
+ label: string | React.ReactNode;
6
+ tooltipProps?: Partial<TooltipProps>;
7
+ isLoading?: boolean;
8
+ as?: React.ElementType;
9
+ }
10
+ export declare const Hint: React.MemoExoticComponent<({ label, tooltipProps, isLoading, ...rest }: Props) => React.JSX.Element>;
11
+ export {};
@@ -0,0 +1,3 @@
1
+ export { default as RoutedTabs } from './RoutedTabs';
2
+ export { default as RoutedTabsSkeleton } from './RoutedTabsSkeleton';
3
+ export { default as useActiveTabFromQuery } from './useActiveTabFromQuery';
@@ -0,0 +1,7 @@
1
+ import { default as React } from 'react';
2
+ import { IconButtonProps } from '../../chakra/icon-button';
3
+ export interface BackToButtonProps extends IconButtonProps {
4
+ href?: string;
5
+ hint?: string;
6
+ }
7
+ export declare const BackToButton: ({ href, hint, ...rest }: BackToButtonProps) => React.JSX.Element;
@@ -0,0 +1,6 @@
1
+ import { default as React } from 'react';
2
+ import { CloseButtonProps } from '../../chakra/close-button';
3
+ export interface ClearButtonProps extends CloseButtonProps {
4
+ visible?: boolean;
5
+ }
6
+ export declare const ClearButton: ({ disabled, visible, ...rest }: ClearButtonProps) => React.JSX.Element;
@@ -1,7 +1,7 @@
1
1
  import { default as React } from 'react';
2
2
  import { InputProps } from '../../chakra/input';
3
3
  import { SkeletonProps } from '../../chakra/skeleton';
4
- interface Props extends Omit<SkeletonProps, 'onChange' | 'loading'> {
4
+ export interface FilterInputProps extends Omit<SkeletonProps, 'onChange' | 'loading'> {
5
5
  onChange?: (searchTerm: string) => void;
6
6
  onFocus?: (event: React.FocusEvent<HTMLInputElement>) => void;
7
7
  onBlur?: (event: React.FocusEvent<HTMLInputElement>) => void;
@@ -13,5 +13,4 @@ interface Props extends Omit<SkeletonProps, 'onChange' | 'loading'> {
13
13
  name?: string;
14
14
  inputProps?: InputProps;
15
15
  }
16
- declare const FilterInput: ({ onChange, size, placeholder, initialValue, type, name, loading, onFocus, onBlur, inputProps, ...rest }: Props) => React.JSX.Element;
17
- export default FilterInput;
16
+ export declare const FilterInput: ({ onChange, size, placeholder, initialValue, type, name, loading, onFocus, onBlur, inputProps, ...rest }: FilterInputProps) => React.JSX.Element;
@@ -0,0 +1,7 @@
1
+ import { default as React } from 'react';
2
+ interface Props {
3
+ message: string;
4
+ className?: string;
5
+ }
6
+ export declare const FormFieldError: import('@chakra-ui/react').ChakraComponent<({ message, className }: Props) => React.JSX.Element, {}>;
7
+ export {};
@@ -0,0 +1 @@
1
+ export * from './FormFieldError';
@@ -0,0 +1,5 @@
1
+ import { default as React } from 'react';
2
+ import { FieldValues } from 'react-hook-form';
3
+ import { FormFieldPropsBase } from './types';
4
+ import { PartialBy } from '../../../../types/utils';
5
+ export declare const FormFieldAddress: <FormFields extends FieldValues>(props: PartialBy<FormFieldPropsBase<FormFields>, 'placeholder'>) => React.JSX.Element;
@@ -0,0 +1,9 @@
1
+ import { default as React } from 'react';
2
+ import { FieldValues, Path } from 'react-hook-form';
3
+ import { FormFieldPropsBase } from './types';
4
+ import { CheckboxProps } from '../../../chakra/checkbox';
5
+ interface Props<FormFields extends FieldValues, Name extends Path<FormFields> = Path<FormFields>> extends Pick<FormFieldPropsBase<FormFields, Name>, 'rules' | 'name' | 'onChange' | 'readOnly'>, Omit<CheckboxProps, 'name' | 'onChange'> {
6
+ label: string;
7
+ }
8
+ export declare const FormFieldCheckbox: <FormFields extends FieldValues, Name extends Path<FormFields> = Path<FormFields>>({ name, label, rules, onChange, readOnly, ...rest }: Props<FormFields, Name>) => React.JSX.Element;
9
+ export {};
@@ -0,0 +1,9 @@
1
+ import { BoxProps } from '@chakra-ui/react';
2
+ import { default as React } from 'react';
3
+ import { FieldValues, Path } from 'react-hook-form';
4
+ import { FormFieldPropsBase } from './types';
5
+ interface Props<FormFields extends FieldValues, Name extends Path<FormFields> = Path<FormFields>> extends FormFieldPropsBase<FormFields, Name> {
6
+ sampleDefaultBgColor?: BoxProps['bgColor'];
7
+ }
8
+ export declare const FormFieldColor: <FormFields extends FieldValues, Name extends Path<FormFields> = Path<FormFields>>({ name, placeholder, rules, onBlur, group, inputProps, size, disabled, sampleDefaultBgColor, ...restProps }: Props<FormFields, Name>) => React.JSX.Element;
9
+ export {};
@@ -0,0 +1,5 @@
1
+ import { default as React } from 'react';
2
+ import { FieldValues } from 'react-hook-form';
3
+ import { FormFieldPropsBase } from './types';
4
+ import { PartialBy } from '../../../../types/utils';
5
+ export declare const FormFieldEmail: <FormFields extends FieldValues>(props: PartialBy<FormFieldPropsBase<FormFields>, 'placeholder'>) => React.JSX.Element;
@@ -0,0 +1,7 @@
1
+ import { default as React } from 'react';
2
+ import { Path, FieldValues } from 'react-hook-form';
3
+ import { FormFieldPropsBase } from './types';
4
+ import { SelectProps } from '../../../chakra/select';
5
+ type Props<FormFields extends FieldValues, Name extends Path<FormFields>> = FormFieldPropsBase<FormFields, Name> & SelectProps;
6
+ export declare const FormFieldSelect: <FormFields extends FieldValues, Name extends Path<FormFields>>(props: Props<FormFields, Name>) => React.JSX.Element;
7
+ export {};
@@ -0,0 +1,7 @@
1
+ import { default as React } from 'react';
2
+ import { Path, FieldValues } from 'react-hook-form';
3
+ import { FormFieldPropsBase } from './types';
4
+ import { SelectAsyncProps } from '../../../chakra/select';
5
+ type Props<FormFields extends FieldValues, Name extends Path<FormFields>> = FormFieldPropsBase<FormFields, Name> & SelectAsyncProps;
6
+ export declare const FormFieldSelectAsync: <FormFields extends FieldValues, Name extends Path<FormFields>>(props: Props<FormFields, Name>) => React.JSX.Element;
7
+ export {};
@@ -0,0 +1,8 @@
1
+ import { default as React } from 'react';
2
+ import { FieldValues, Path } from 'react-hook-form';
3
+ import { FormFieldPropsBase } from './types';
4
+ interface Props<FormFields extends FieldValues, Name extends Path<FormFields> = Path<FormFields>> extends FormFieldPropsBase<FormFields, Name> {
5
+ asComponent?: 'Input' | 'Textarea';
6
+ }
7
+ export declare const FormFieldText: <FormFields extends FieldValues, Name extends Path<FormFields> = Path<FormFields>>({ name, placeholder, rules, onBlur, group, inputProps, asComponent, size: sizeProp, disabled, floating: floatingProp, ...restProps }: Props<FormFields, Name>) => React.JSX.Element;
8
+ export {};
@@ -0,0 +1,4 @@
1
+ import { default as React } from 'react';
2
+ import { FieldValues } from 'react-hook-form';
3
+ import { FormFieldPropsBase } from './types';
4
+ export declare const FormFieldUrl: <FormFields extends FieldValues>(props: FormFieldPropsBase<FormFields>) => React.JSX.Element;
@@ -0,0 +1,13 @@
1
+ import { default as React } from 'react';
2
+ import { ColorMode } from '../../../../chakra/color-mode';
3
+ interface Props {
4
+ src: string | undefined;
5
+ onLoad?: () => void;
6
+ onError?: () => void;
7
+ isInvalid: boolean;
8
+ className?: string;
9
+ fallback: React.ReactElement;
10
+ colorMode?: ColorMode;
11
+ }
12
+ export declare const FormFieldImagePreview: import('@chakra-ui/react').ChakraComponent<React.MemoExoticComponent<({ src, isInvalid, onError, onLoad, className, fallback: fallbackProp, colorMode, }: Props) => React.JSX.Element>, {}>;
13
+ export {};
@@ -0,0 +1,25 @@
1
+ import { FieldValues, Path } from 'react-hook-form';
2
+ interface Params<FormFields extends FieldValues, Name extends Path<FormFields>> {
3
+ name: Name;
4
+ isRequired?: boolean;
5
+ }
6
+ interface ReturnType {
7
+ input: {
8
+ rules: {
9
+ required?: boolean;
10
+ validate: {
11
+ preview: () => string | true;
12
+ };
13
+ };
14
+ isRequired?: boolean;
15
+ onBlur: () => void;
16
+ };
17
+ preview: {
18
+ src: string | undefined;
19
+ isInvalid: boolean;
20
+ onLoad: () => void;
21
+ onError: () => void;
22
+ };
23
+ }
24
+ export declare function useImageField<FormFields extends FieldValues, Name extends Path<FormFields>>({ name, isRequired, }: Params<FormFields, Name>): ReturnType;
25
+ export {};
@@ -0,0 +1,10 @@
1
+ export * from './image/FormFieldImagePreview';
2
+ export * from './image/useImageField';
3
+ export * from './FormFieldAddress';
4
+ export * from './FormFieldCheckbox';
5
+ export * from './FormFieldColor';
6
+ export * from './FormFieldEmail';
7
+ export * from './FormFieldSelect';
8
+ export * from './FormFieldSelectAsync';
9
+ export * from './FormFieldText';
10
+ export * from './FormFieldUrl';
@@ -0,0 +1,19 @@
1
+ import { default as React } from 'react';
2
+ import { ControllerRenderProps, FieldValues, Path, RegisterOptions } from 'react-hook-form';
3
+ import { FieldProps } from '../../../chakra/field';
4
+ import { InputProps } from '../../../chakra/input';
5
+ import { InputGroupProps } from '../../../chakra/input-group';
6
+ import { TextareaProps } from '../../../chakra/textarea';
7
+ export interface FormFieldPropsBase<FormFields extends FieldValues, Name extends Path<FormFields> = Path<FormFields>> extends Omit<FieldProps, 'children'> {
8
+ name: Name;
9
+ placeholder: string;
10
+ rules?: Omit<RegisterOptions<FormFields, Name>, 'valueAsNumber' | 'valueAsDate' | 'setValueAs' | 'disabled'>;
11
+ onBlur?: () => void;
12
+ onChange?: () => void;
13
+ inputProps?: InputProps | TextareaProps;
14
+ group?: Omit<InputGroupProps, 'children' | 'endElement'> & {
15
+ endElement?: React.ReactNode | (({ field }: {
16
+ field: ControllerRenderProps<FormFields, Name>;
17
+ }) => React.ReactNode);
18
+ };
19
+ }
@@ -0,0 +1,11 @@
1
+ import { default as React } from 'react';
2
+ interface Props {
3
+ children: React.ReactNode;
4
+ onDrop: (files: Array<File>) => void;
5
+ className?: string;
6
+ isDisabled?: boolean;
7
+ isInvalid?: boolean;
8
+ fullFilePath?: boolean;
9
+ }
10
+ export declare const DragAndDropArea: import('@chakra-ui/react').ChakraComponent<({ onDrop, children, className, isDisabled, fullFilePath, isInvalid }: Props) => React.JSX.Element, {}>;
11
+ export {};
@@ -0,0 +1,13 @@
1
+ import { default as React } from 'react';
2
+ import { ControllerRenderProps, FieldValues, Path } from 'react-hook-form';
3
+ interface InjectedProps {
4
+ onChange: (files: Array<File>) => void;
5
+ }
6
+ interface Props<V extends FieldValues, N extends Path<V>> {
7
+ children: React.ReactNode | ((props: InjectedProps) => React.ReactNode);
8
+ field: ControllerRenderProps<V, N>;
9
+ accept?: string;
10
+ multiple?: boolean;
11
+ }
12
+ export declare const FileInput: <Values extends FieldValues, Names extends Path<Values>>({ children, accept, multiple, field }: Props<Values, Names>) => React.JSX.Element;
13
+ export {};
@@ -0,0 +1,11 @@
1
+ import { default as React } from 'react';
2
+ interface Props {
3
+ file: File;
4
+ className?: string;
5
+ index?: number;
6
+ onRemove?: (index?: number) => void;
7
+ isDisabled?: boolean;
8
+ error?: string;
9
+ }
10
+ export declare const FileSnippet: import('@chakra-ui/react').ChakraComponent<({ file, className, index, onRemove, isDisabled, error }: Props) => React.JSX.Element, {}>;
11
+ export {};
@@ -0,0 +1,2 @@
1
+ export declare function getAllFileEntries(dataTransferItemList: DataTransferItemList): Promise<Array<FileSystemFileEntry>>;
2
+ export declare function convertFileEntryToFile(entry: FileSystemFileEntry, fullFilePath?: boolean): Promise<File>;
@@ -0,0 +1,3 @@
1
+ export * from './file/DragAndDropArea';
2
+ export * from './file/FileInput';
3
+ export * from './file/FileSnippet';
@@ -0,0 +1,2 @@
1
+ import { FieldError } from 'react-hook-form';
2
+ export declare function getFormFieldErrorText(error: FieldError | undefined): string | undefined;
@@ -0,0 +1 @@
1
+ export * from './getFormFieldErrorText';
@@ -0,0 +1,3 @@
1
+ export declare const ADDRESS_REGEXP: RegExp;
2
+ export declare const ADDRESS_LENGTH = 42;
3
+ export declare function addressValidator(value: string | undefined): true | "Incorrect address format";
@@ -0,0 +1,2 @@
1
+ export declare const COLOR_HEX_REGEXP: RegExp;
2
+ export declare const colorValidator: (value: unknown) => true | "Invalid length" | "Invalid hex code";
@@ -0,0 +1,2 @@
1
+ export declare const EMAIL_REGEXP: RegExp;
2
+ export declare const emailValidator: (value: string) => true | "Invalid email";
@@ -0,0 +1,7 @@
1
+ export * from './address';
2
+ export * from './color';
3
+ export * from './email';
4
+ export * from './signature';
5
+ export * from './text';
6
+ export * from './transaction';
7
+ export * from './url';
@@ -0,0 +1 @@
1
+ export declare const SIGNATURE_REGEXP: RegExp;
@@ -0,0 +1 @@
1
+ export declare const noWhitespaceValidator: (value: unknown) => true | "Should contain text";
@@ -0,0 +1,2 @@
1
+ export declare const TRANSACTION_HASH_REGEXP: RegExp;
2
+ export declare const TRANSACTION_HASH_LENGTH = 66;
@@ -0,0 +1,3 @@
1
+ export declare function urlValidator(value: string | undefined): true | "Incorrect URL";
2
+ export declare const DOMAIN_REGEXP: RegExp;
3
+ export declare function domainValidator(value: string | undefined): true | "Incorrect domain";
@@ -0,0 +1,8 @@
1
+ import { Placement } from '@floating-ui/dom';
2
+ import { default as React } from 'react';
3
+ export interface TruncatedTextTooltipProps {
4
+ children: React.ReactNode;
5
+ label: React.ReactNode;
6
+ placement?: Placement;
7
+ }
8
+ export declare const TruncatedTextTooltip: React.MemoExoticComponent<({ children, label, placement }: TruncatedTextTooltipProps) => React.JSX.Element>;
@@ -1,4 +1,4 @@
1
- export default function useClipboard(text: string, timeout?: number): {
1
+ export declare function useClipboard(text: string, timeout?: number): {
2
2
  hasCopied: boolean;
3
3
  copy: () => void;
4
4
  disclosure: {
@@ -0,0 +1 @@
1
+ export declare function useFirstMountState(): boolean;
@@ -0,0 +1,2 @@
1
+ import { default as React } from 'react';
2
+ export declare function useIsSticky(ref: React.RefObject<HTMLDivElement>, offset?: number, isEnabled?: boolean): boolean;
@@ -0,0 +1,2 @@
1
+ import { default as React } from 'react';
2
+ export declare const useUpdateEffect: typeof React.useEffect;
@@ -1,4 +1,4 @@
1
- export default function useViewportSize(debounceTime?: number): {
1
+ export declare function useViewportSize(debounceTime?: number): {
2
2
  width: number;
3
3
  height: number;
4
4
  };