mitre-form-component 0.0.1
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/README.md +54 -0
- package/eslint.config.js +28 -0
- package/index.html +13 -0
- package/package.json +44 -0
- package/src/App.tsx +33 -0
- package/src/components/Alert/index.tsx +59 -0
- package/src/components/Alert/styles.ts +95 -0
- package/src/components/Button/index.tsx +51 -0
- package/src/components/Button/styles.ts +147 -0
- package/src/components/Form/index.tsx +215 -0
- package/src/components/Form/styles.ts +99 -0
- package/src/components/Input/index.tsx +132 -0
- package/src/components/Input/masks.ts +52 -0
- package/src/components/Input/styles.ts +201 -0
- package/src/components/hooks/useError.ts +15 -0
- package/src/components/styles/global.ts +165 -0
- package/src/components/styles/utils.ts +56 -0
- package/src/index.ts +4 -0
- package/src/main.tsx +12 -0
- package/src/registry.tsx +14 -0
- package/src/vite-env.d.ts +1 -0
- package/tsconfig.build.json +29 -0
- package/tsconfig.json +22 -0
- package/tsup.config.ts +28 -0
- package/vite.config.ts +7 -0
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { createGlobalStyle } from "styled-components";
|
|
4
|
+
import React, { useEffect } from "react";
|
|
5
|
+
|
|
6
|
+
export const GlobalStyles = createGlobalStyle`
|
|
7
|
+
:root {
|
|
8
|
+
--red: #e52e4d;
|
|
9
|
+
--white: #FFF;
|
|
10
|
+
--black: #2F2F2F;
|
|
11
|
+
--black-2:#1E1E1E;
|
|
12
|
+
--alphaBlack: #000000;
|
|
13
|
+
--black-2:#1E1E1E;
|
|
14
|
+
--black-3:#353535;
|
|
15
|
+
|
|
16
|
+
--yellow-400:#FFD789;
|
|
17
|
+
--yellow-500: #F6C76B;
|
|
18
|
+
--gray-40:#F0F0F0;
|
|
19
|
+
--gray-45:#767676;
|
|
20
|
+
--gray-50: #686A69;
|
|
21
|
+
--gray-60: #8F8F8F;
|
|
22
|
+
--gray-100: #B6B6B6;
|
|
23
|
+
--gray-150: #B9B9B9;
|
|
24
|
+
--gray-200: #D2D2D2;
|
|
25
|
+
--gray-300: #EBEBEB;
|
|
26
|
+
--gray-400: #ECECEC;
|
|
27
|
+
--gray-500: #F4F4F4;
|
|
28
|
+
--gray-550:#6F6F6F;
|
|
29
|
+
--gray-600:#686868;
|
|
30
|
+
--gray-700: #535353;
|
|
31
|
+
--gray-800:#9D9D9D;
|
|
32
|
+
--shadow-500: 0px 4px 8px rgba(91, 91, 91, 0.2);
|
|
33
|
+
--green:#57C06E;
|
|
34
|
+
--green-2:#2DCE68;
|
|
35
|
+
--blue:#007BFF;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
* {
|
|
39
|
+
margin: 0;
|
|
40
|
+
padding: 0;
|
|
41
|
+
box-sizing: border-box;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
html {
|
|
45
|
+
scroll-behavior: smooth;
|
|
46
|
+
|
|
47
|
+
@media (max-width: 1080px) {
|
|
48
|
+
font-size: 93.75%;
|
|
49
|
+
}
|
|
50
|
+
@media (max-width: 720px) {
|
|
51
|
+
font-size: 87.5%;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
body {
|
|
56
|
+
background: var(--white);
|
|
57
|
+
-webkit-font-smoothing: antialiased;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
body, input, textarea, select, button {
|
|
61
|
+
font-family: "Montserrat", sans-serif;
|
|
62
|
+
font-weight: 400;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
h1, h2, h3, h4, h5, h6, strong {
|
|
66
|
+
font-weight: 600;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
button {
|
|
70
|
+
cursor: pointer;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
[disabled] {
|
|
74
|
+
opacity: 0.6;
|
|
75
|
+
cursor: not-allowed;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.hidden {
|
|
79
|
+
overflow: hidden;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
::-webkit-scrollbar {
|
|
83
|
+
-webkit-appearance: none;
|
|
84
|
+
background: var(--gray-500);
|
|
85
|
+
width: 6px;
|
|
86
|
+
height: 10px;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
::-webkit-scrollbar-thumb {
|
|
90
|
+
background-color: var(--gray-50);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.aligncenter {
|
|
94
|
+
text-align: center;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.width-190px {
|
|
98
|
+
width:190px;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.hidden-content {
|
|
102
|
+
display:none !important;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.global-margin-bottom {
|
|
106
|
+
margin-bottom:20px;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.background-light-gray {
|
|
110
|
+
background:#F4F4F4;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.full-width-and-height {
|
|
114
|
+
height:100%;
|
|
115
|
+
width:100%;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.flex-direction-column {
|
|
119
|
+
flex-direction:column;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.bold {
|
|
123
|
+
font-weight:700;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.margin-center-x {
|
|
127
|
+
margin:0 auto;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
.border-none {
|
|
131
|
+
border:none;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
.text-center {
|
|
135
|
+
text-align:center;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.relative {
|
|
139
|
+
position:relative;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/* accessibility */
|
|
143
|
+
body ._access-menu p._text-center{
|
|
144
|
+
font-family: "Montserrat", sans-serif;
|
|
145
|
+
font-style: italic;
|
|
146
|
+
font-size: 1.2rem!important;
|
|
147
|
+
margin-top: 6px;
|
|
148
|
+
margin-bottom: 3px;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
`;
|
|
152
|
+
|
|
153
|
+
const FontLoader: React.FC = () => {
|
|
154
|
+
useEffect(() => {
|
|
155
|
+
const link = document.createElement("link");
|
|
156
|
+
link.href =
|
|
157
|
+
"https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;700&display=swap";
|
|
158
|
+
link.rel = "stylesheet";
|
|
159
|
+
document.head.appendChild(link);
|
|
160
|
+
}, []);
|
|
161
|
+
|
|
162
|
+
return null;
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
export default FontLoader;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
type directionType = "column" | "row";
|
|
2
|
+
type alignItemsType = "center" | "flex-start";
|
|
3
|
+
|
|
4
|
+
type jutifyContentType = "center" | "space-between";
|
|
5
|
+
|
|
6
|
+
export function flex(
|
|
7
|
+
direction: directionType = "row",
|
|
8
|
+
alignItems?: alignItemsType,
|
|
9
|
+
justifyContent?: jutifyContentType
|
|
10
|
+
) {
|
|
11
|
+
return `
|
|
12
|
+
align-items:${alignItems || null};
|
|
13
|
+
display:flex;
|
|
14
|
+
flex-direction:${direction};
|
|
15
|
+
justify-content:${justifyContent || null};
|
|
16
|
+
`;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export const alignX = `
|
|
20
|
+
left:50%;
|
|
21
|
+
transform:translateX(-50%);
|
|
22
|
+
`;
|
|
23
|
+
|
|
24
|
+
export const alignXAndY = `
|
|
25
|
+
left:50%;
|
|
26
|
+
top:50%;
|
|
27
|
+
transform:translate(-50%, -50%);
|
|
28
|
+
`;
|
|
29
|
+
|
|
30
|
+
export const darkEffect = `
|
|
31
|
+
&:hover {
|
|
32
|
+
cursor:pointer;
|
|
33
|
+
filter:brightness(98%);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
&:active {
|
|
37
|
+
filter:brightness(95%);
|
|
38
|
+
}
|
|
39
|
+
`;
|
|
40
|
+
|
|
41
|
+
export const opacityEffect = `
|
|
42
|
+
&:hover {
|
|
43
|
+
cursor:pointer;
|
|
44
|
+
opacity:.9;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
&:active {
|
|
48
|
+
opacity:.7;
|
|
49
|
+
}
|
|
50
|
+
`;
|
|
51
|
+
|
|
52
|
+
export const modalZIndex = 9999;
|
|
53
|
+
|
|
54
|
+
export const breakpoints = {
|
|
55
|
+
tablet: "1024px",
|
|
56
|
+
};
|
package/src/index.ts
ADDED
package/src/main.tsx
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { StrictMode } from 'react'
|
|
2
|
+
import { createRoot } from 'react-dom/client'
|
|
3
|
+
import App from './App.tsx'
|
|
4
|
+
import StyledComponentsRegistry from './registry'
|
|
5
|
+
|
|
6
|
+
createRoot(document.getElementById('root')!).render(
|
|
7
|
+
<StrictMode>
|
|
8
|
+
<StyledComponentsRegistry>
|
|
9
|
+
<App />
|
|
10
|
+
</StyledComponentsRegistry>
|
|
11
|
+
</StrictMode>,
|
|
12
|
+
)
|
package/src/registry.tsx
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { StyleSheetManager } from 'styled-components'
|
|
3
|
+
|
|
4
|
+
export default function StyledComponentsRegistry({
|
|
5
|
+
children,
|
|
6
|
+
}: {
|
|
7
|
+
children: React.ReactNode
|
|
8
|
+
}) {
|
|
9
|
+
return (
|
|
10
|
+
<StyleSheetManager>
|
|
11
|
+
{children}
|
|
12
|
+
</StyleSheetManager>
|
|
13
|
+
)
|
|
14
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/// <reference types="vite/client" />
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "./tsconfig.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"outDir": "dist",
|
|
5
|
+
"declaration": true,
|
|
6
|
+
"declarationMap": true,
|
|
7
|
+
"sourceMap": true,
|
|
8
|
+
"rootDir": "src",
|
|
9
|
+
"module": "ESNext",
|
|
10
|
+
"target": "ES2020",
|
|
11
|
+
"jsx": "react-jsx",
|
|
12
|
+
"moduleResolution": "node",
|
|
13
|
+
"allowSyntheticDefaultImports": true,
|
|
14
|
+
"esModuleInterop": true,
|
|
15
|
+
"skipLibCheck": true,
|
|
16
|
+
"forceConsistentCasingInFileNames": true,
|
|
17
|
+
"composite": true,
|
|
18
|
+
"incremental": true
|
|
19
|
+
},
|
|
20
|
+
"include": ["src/**/*"],
|
|
21
|
+
"exclude": [
|
|
22
|
+
"node_modules",
|
|
23
|
+
"dist",
|
|
24
|
+
"**/*.test.ts",
|
|
25
|
+
"**/*.test.tsx",
|
|
26
|
+
"**/__tests__/**",
|
|
27
|
+
"src/app/**"
|
|
28
|
+
]
|
|
29
|
+
}
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2020",
|
|
4
|
+
"lib": ["DOM", "DOM.Iterable", "ESNext"],
|
|
5
|
+
"module": "ESNext",
|
|
6
|
+
"moduleResolution": "Node",
|
|
7
|
+
"allowJs": false,
|
|
8
|
+
"skipLibCheck": true,
|
|
9
|
+
"strict": true,
|
|
10
|
+
"noEmit": true,
|
|
11
|
+
"esModuleInterop": true,
|
|
12
|
+
"allowSyntheticDefaultImports": true,
|
|
13
|
+
"resolveJsonModule": true,
|
|
14
|
+
"isolatedModules": true,
|
|
15
|
+
"jsx": "react-jsx",
|
|
16
|
+
"paths": {
|
|
17
|
+
"@/*": ["./src/*"]
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"include": ["src"],
|
|
21
|
+
"exclude": ["node_modules", "dist"]
|
|
22
|
+
}
|
package/tsup.config.ts
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { defineConfig } from "tsup";
|
|
2
|
+
import { dependencies, peerDependencies } from "./package.json";
|
|
3
|
+
|
|
4
|
+
export default defineConfig({
|
|
5
|
+
entry: ["src/index.ts"],
|
|
6
|
+
format: ["cjs", "esm"],
|
|
7
|
+
dts: {
|
|
8
|
+
compilerOptions: {
|
|
9
|
+
incremental: false,
|
|
10
|
+
skipLibCheck: true,
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
sourcemap: true,
|
|
14
|
+
clean: true,
|
|
15
|
+
loader: {
|
|
16
|
+
".svg": "dataurl",
|
|
17
|
+
},
|
|
18
|
+
external: [
|
|
19
|
+
...Object.keys(dependencies ?? {}),
|
|
20
|
+
...Object.keys(peerDependencies ?? {}),
|
|
21
|
+
],
|
|
22
|
+
esbuildOptions: (options) => {
|
|
23
|
+
(options.jsx = "automatic"), (options.treeShaking = true);
|
|
24
|
+
},
|
|
25
|
+
target: "es2020",
|
|
26
|
+
minify: process.env.NODE_ENV === "production",
|
|
27
|
+
splitting: false,
|
|
28
|
+
});
|