@carissa-io/components-email 0.0.0-stage → 0.1.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 +11 -2
- package/dist/index.js +20 -0
- package/package.json +56 -4
- package/scss/index.scss +1 -0
package/README.md
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @carissa-io/components-email
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Input of type email, validated by hand.
|
|
4
|
+
|
|
5
|
+
```jsx
|
|
6
|
+
import { Email } from '@carissa-io/components-email'
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
Error code `invalid_email`. `validate` (optional) runs after the email check. `isEmail(value)` is exported.
|
|
10
|
+
|
|
11
|
+
Takes every prop of [`Input`](../components-input/README.md) (`label`, `required`, `min_length`, `messages`, `onValidate(isValid, errorCode)`, `error`, …).
|
|
12
|
+
Depends on `@carissa-io/components-input`; styles: `@use '@carissa-io/components-email/scss' with (...)` forwards the input's SCSS variables.
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// src/Email.jsx
|
|
2
|
+
import { Input } from "@carissa-io/components-input";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
var EMAIL = /^[^\s@]+@[^\s@.]+(\.[^\s@.]+)+$/;
|
|
5
|
+
var isEmail = (value) => EMAIL.test(String(value ?? "").trim());
|
|
6
|
+
function Email({ validate, autoComplete = "email", ...props }) {
|
|
7
|
+
return /* @__PURE__ */ jsx(
|
|
8
|
+
Input,
|
|
9
|
+
{
|
|
10
|
+
...props,
|
|
11
|
+
type: "email",
|
|
12
|
+
autoComplete,
|
|
13
|
+
validate: (value) => isEmail(value) ? validate?.(value) : "invalid_email"
|
|
14
|
+
}
|
|
15
|
+
);
|
|
16
|
+
}
|
|
17
|
+
export {
|
|
18
|
+
Email,
|
|
19
|
+
isEmail
|
|
20
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,58 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@carissa-io/components-email",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "Fluxio UI: email input with email validation, built on components-input",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"files": [
|
|
8
|
+
"dist",
|
|
9
|
+
"scss"
|
|
10
|
+
],
|
|
11
|
+
"exports": {
|
|
12
|
+
".": "./dist/index.js",
|
|
13
|
+
"./scss": "./scss/index.scss",
|
|
14
|
+
"./scss/*": "./scss/*"
|
|
15
|
+
},
|
|
16
|
+
"sideEffects": false,
|
|
17
|
+
"scripts": {
|
|
18
|
+
"build": "esbuild src/index.js --bundle --packages=external --format=esm --jsx=automatic --outfile=dist/index.js",
|
|
19
|
+
"test": "vitest run",
|
|
20
|
+
"lint": "eslint .",
|
|
21
|
+
"prepublishOnly": "node -e \"if (!process.env.GITHUB_ACTIONS) { console.error('Refusing to publish outside GitHub Actions CI: commit and push to main instead.'); process.exit(1); }\" && npm run build"
|
|
22
|
+
},
|
|
23
|
+
"repository": {
|
|
24
|
+
"type": "git",
|
|
25
|
+
"url": "git+https://github.com/carissa-io/components-email.git"
|
|
26
|
+
},
|
|
27
|
+
"license": "UNLICENSED",
|
|
28
|
+
"engines": {
|
|
29
|
+
"node": ">=24"
|
|
30
|
+
},
|
|
31
|
+
"dependencies": {
|
|
32
|
+
"@carissa-io/components-input": "^0.1.1"
|
|
33
|
+
},
|
|
34
|
+
"peerDependencies": {
|
|
35
|
+
"react": ">=18"
|
|
36
|
+
},
|
|
37
|
+
"devDependencies": {
|
|
38
|
+
"@eslint/js": "^10.0.1",
|
|
39
|
+
"@testing-library/jest-dom": "^7.0.1",
|
|
40
|
+
"@testing-library/react": "^16.3.3",
|
|
41
|
+
"@testing-library/user-event": "^14.6.7",
|
|
42
|
+
"@vitejs/plugin-react": "^6.1.1",
|
|
43
|
+
"esbuild": "^0.28.0",
|
|
44
|
+
"eslint": "^10.12.0",
|
|
45
|
+
"eslint-plugin-react-hooks": "^7.1.1",
|
|
46
|
+
"globals": "^17.13.0",
|
|
47
|
+
"jsdom": "^29.1.1",
|
|
48
|
+
"react": "^19.3.0",
|
|
49
|
+
"react-dom": "^19.3.0",
|
|
50
|
+
"sass-embedded": "^1.105.1",
|
|
51
|
+
"vite": "^8.3.2",
|
|
52
|
+
"vitest": "^4.1.11"
|
|
53
|
+
},
|
|
54
|
+
"publishConfig": {
|
|
55
|
+
"registry": "https://registry.npmjs.org",
|
|
56
|
+
"access": "public"
|
|
57
|
+
}
|
|
58
|
+
}
|
package/scss/index.scss
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@forward '@carissa-io/components-input/scss';
|