atlantix-form-share 1.0.7
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 +135 -0
- package/assets/default-styles.png +0 -0
- package/assets/with-styles-preview-basic.png +0 -0
- package/assets/with-styles-preview.png +0 -0
- package/buildspec.yml +37 -0
- package/package.json +37 -0
- package/rollup.config.js +33 -0
- package/tsconfig.json +14 -0
- package/vite.config.ts +23 -0
package/README.md
ADDED
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
## Atlantix Form Share Web Component đą
|
|
2
|
+
This project exposes a web component with a very adaptable multi step form. The form will send a real loan application to our leads system.
|
|
3
|
+
|
|
4
|
+
### In this guide đ
|
|
5
|
+
1. How to install đšī¸
|
|
6
|
+
- CDN for static sites đ
|
|
7
|
+
- Type fix for typescript node based projects đ
|
|
8
|
+
2. How to style đ
|
|
9
|
+
|
|
10
|
+
### How to install đšī¸
|
|
11
|
+
### 1.1 Using CDN for static sites đ
|
|
12
|
+
|
|
13
|
+
First, place this script tag inside the `<head></head>` selector.
|
|
14
|
+
```html
|
|
15
|
+
<script async type="module" src="https://unpkg.com/atlantix-form-share"></script>
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
Then, place the web component wherever in your website inside the `<body></body>` tag.
|
|
19
|
+
|
|
20
|
+
```html
|
|
21
|
+
<atx-form-share token="your-token"></atx-form-share>
|
|
22
|
+
```
|
|
23
|
+
`your-token` is a required property for the web component. We will provide you with your own token value.
|
|
24
|
+
|
|
25
|
+
That's it. Here a full example.
|
|
26
|
+
|
|
27
|
+
```html
|
|
28
|
+
<!DOCTYPE html>
|
|
29
|
+
<html lang="en">
|
|
30
|
+
<head>
|
|
31
|
+
<meta charset="UTF-8">
|
|
32
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
33
|
+
<script async type="module" src="https://unpkg.com/atlantix-form-share"></script>
|
|
34
|
+
<title>Document</title>
|
|
35
|
+
</head>
|
|
36
|
+
<body>
|
|
37
|
+
<h1>This is your own website header title</h1>
|
|
38
|
+
<atx-form-share token="your-token"></atx-form-share>
|
|
39
|
+
</body>
|
|
40
|
+
</html>
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### 1.2 Type fix for typescript node based projects đ
|
|
44
|
+
In case your website is based on node you might have problems with types. Here a simple solution:
|
|
45
|
+
|
|
46
|
+
#### For react base projects â
|
|
47
|
+
In the root for your project, create a file called `additional-types.d.ts` and this content:
|
|
48
|
+
|
|
49
|
+
```ts
|
|
50
|
+
import type { DetailedHTMLProps, HTMLAttributes } from 'react';
|
|
51
|
+
|
|
52
|
+
declare module 'react/jsx-runtime' {
|
|
53
|
+
namespace JSX {
|
|
54
|
+
interface IntrinsicElements {
|
|
55
|
+
'atx-form-share': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement> & {
|
|
56
|
+
token?: string;
|
|
57
|
+
devMode?: string;
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
For older react versions, use this instead
|
|
65
|
+
```ts
|
|
66
|
+
import * as React from 'react';
|
|
67
|
+
|
|
68
|
+
declare global {
|
|
69
|
+
namespace JSX {
|
|
70
|
+
interface IntrinsicElements {
|
|
71
|
+
'atx-form-share': React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement> & {
|
|
72
|
+
token?: string;
|
|
73
|
+
devMode?: string;
|
|
74
|
+
}, HTMLElement>;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
This will avoid any type and build errors.
|
|
81
|
+
|
|
82
|
+
That's it. đ
|
|
83
|
+
|
|
84
|
+
### 2. How to style đ
|
|
85
|
+
Last, we also provide multiple options to style the web component so, it can be synchronized with your own project look and feel.
|
|
86
|
+
|
|
87
|
+
Firs, by default your web component will look like this.
|
|
88
|
+
|
|
89
|
+

|
|
90
|
+
|
|
91
|
+
Also, by default the web component will inherit from your website, like `color`, `font-family`, another `font-*` and also all custom properties `--*`
|
|
92
|
+
|
|
93
|
+
Now, we expose the following css properties so you can add your custom values:
|
|
94
|
+
|
|
95
|
+
- `--atx-border-radius`
|
|
96
|
+
- `--atx-button-radius`
|
|
97
|
+
- `--atx-background-color`
|
|
98
|
+
- `--atx-border-color`
|
|
99
|
+
- `--atx-secondary-color`
|
|
100
|
+
- `--atx-accent-color`
|
|
101
|
+
- `--atx-text-color`
|
|
102
|
+
- `--atx-next-button-color`
|
|
103
|
+
- `--atx-back-button-color`
|
|
104
|
+
- `--atx-error-color`
|
|
105
|
+
- `--atx-error-color-shadow`
|
|
106
|
+
|
|
107
|
+
For example, if we apply the following styles.
|
|
108
|
+
|
|
109
|
+
```css
|
|
110
|
+
body {
|
|
111
|
+
/* more styles here */
|
|
112
|
+
--atx-border-radius: 5px;
|
|
113
|
+
--atx-button-radius: 24px;
|
|
114
|
+
--atx-background-color: white;
|
|
115
|
+
--atx-border-color: #E5E3EA;
|
|
116
|
+
--atx-secondary-color: #d8b4fe;
|
|
117
|
+
--atx-accent-color: #581c87;
|
|
118
|
+
--atx-text-color: #581c87;
|
|
119
|
+
--atx-next-button-color: #581c87;
|
|
120
|
+
--atx-back-button-color: #581c87;
|
|
121
|
+
--atx-error-color: #e7000b;
|
|
122
|
+
--atx-error-color-shadow: #e1676e;
|
|
123
|
+
}
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
Will look something like this:
|
|
127
|
+
|
|
128
|
+

|
|
129
|
+
|
|
130
|
+
And here a basic explanation:
|
|
131
|
+
|
|
132
|
+

|
|
133
|
+
|
|
134
|
+
### About đ§âđģ
|
|
135
|
+
This repository is maintained by everyone at Atlantix Media Inc.
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/buildspec.yml
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
version: 0.2
|
|
2
|
+
|
|
3
|
+
phases:
|
|
4
|
+
install:
|
|
5
|
+
runtime-versions:
|
|
6
|
+
nodejs: 24
|
|
7
|
+
commands:
|
|
8
|
+
- echo "Navigating to web-component directory..."
|
|
9
|
+
- cd web-component
|
|
10
|
+
- echo "Installing dependencies with legacy peer deps"
|
|
11
|
+
- npm ci --legacy-peer-deps
|
|
12
|
+
|
|
13
|
+
pre_build:
|
|
14
|
+
commands:
|
|
15
|
+
- PACKAGE_VERSION=$(node -p "require('./package.json').version")
|
|
16
|
+
- echo "Starting build for web-component bundle for version $PACKAGE_VERSION"
|
|
17
|
+
|
|
18
|
+
build:
|
|
19
|
+
commands:
|
|
20
|
+
- echo "Building web-component bundle for version $PACKAGE_VERSION"
|
|
21
|
+
- npm run build
|
|
22
|
+
- echo "Built web-component bundle for version $PACKAGE_VERSION"
|
|
23
|
+
|
|
24
|
+
post_build:
|
|
25
|
+
commands:
|
|
26
|
+
- 'echo "Deploying to S3 : $S3_BUCKET_NAME, with version $PACKAGE_VERSION"'
|
|
27
|
+
- aws s3 sync dist/ s3://$S3_BUCKET_NAME/v/$PACKAGE_VERSION/ --delete
|
|
28
|
+
- aws s3 sync dist/ s3://$S3_BUCKET_NAME/ --exclude "v/*" --delete
|
|
29
|
+
- 'echo "deployed to S3 : $S3_BUCKET_NAME, with version $PACKAGE_VERSION"'
|
|
30
|
+
- 'echo "Invalidating CloudFront CDN cache : $CLOUDFRONT_DISTRIBUTION_ID"'
|
|
31
|
+
- aws cloudfront create-invalidation --distribution-id $CLOUDFRONT_DISTRIBUTION_ID --paths "/*"
|
|
32
|
+
- 'echo "invalidated CloudFront CDN cache : $CLOUDFRONT_DISTRIBUTION_ID"'
|
|
33
|
+
|
|
34
|
+
artifacts:
|
|
35
|
+
files:
|
|
36
|
+
- '**/*'
|
|
37
|
+
base-directory: 'web-component/dist'
|
package/package.json
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "atlantix-form-share",
|
|
3
|
+
"private": false,
|
|
4
|
+
"version": "1.0.7",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.bundle.js",
|
|
7
|
+
"module": "./dist/index.bundle.js",
|
|
8
|
+
"types": "./dist/types/index.d.ts",
|
|
9
|
+
"scripts": {
|
|
10
|
+
"dev": "vite",
|
|
11
|
+
"build": "rollup -c rollup.config.js",
|
|
12
|
+
"preview": "vite preview"
|
|
13
|
+
},
|
|
14
|
+
"exports": {
|
|
15
|
+
".": {
|
|
16
|
+
"types": "./dist/types/index.d.ts",
|
|
17
|
+
"default": "./dist/index.bundle.js"
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"dependencies": {
|
|
21
|
+
"lit": "^3.3.3"
|
|
22
|
+
},
|
|
23
|
+
"devDependencies": {
|
|
24
|
+
"@lit-labs/rollup-plugin-minify-html-literals": "^0.2.0",
|
|
25
|
+
"@rollup/plugin-node-resolve": "^16.0.3",
|
|
26
|
+
"@rollup/plugin-terser": "^1.0.0",
|
|
27
|
+
"@rollup/plugin-typescript": "^12.3.0",
|
|
28
|
+
"rollup": "^4.63.6",
|
|
29
|
+
"rollup-plugin-minify-html-literals": "^1.2.6",
|
|
30
|
+
"rollup-plugin-summary": "^3.0.1",
|
|
31
|
+
"rollup-plugin-terser": "^7.0.2",
|
|
32
|
+
"tslib": "^2.8.1",
|
|
33
|
+
"typescript": "~6.0.2",
|
|
34
|
+
"vite": "^8.3.0",
|
|
35
|
+
"vite-plugin-dts": "^5.1.0"
|
|
36
|
+
}
|
|
37
|
+
}
|
package/rollup.config.js
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import nodeResolve from '@rollup/plugin-node-resolve';
|
|
2
|
+
import typescript from '@rollup/plugin-typescript';
|
|
3
|
+
import terser from '@rollup/plugin-terser';
|
|
4
|
+
import minifyHTML from '@lit-labs/rollup-plugin-minify-html-literals';
|
|
5
|
+
import summary from 'rollup-plugin-summary';
|
|
6
|
+
|
|
7
|
+
export default {
|
|
8
|
+
input: 'src/index.ts',
|
|
9
|
+
output: {
|
|
10
|
+
file: 'dist/index.bundle.js',
|
|
11
|
+
format: 'esm',
|
|
12
|
+
sourcemap: true,
|
|
13
|
+
},
|
|
14
|
+
plugins: [
|
|
15
|
+
minifyHTML(),
|
|
16
|
+
typescript({
|
|
17
|
+
tsconfig: './tsconfig.json',
|
|
18
|
+
declarationDir: './dist/types'
|
|
19
|
+
}),
|
|
20
|
+
nodeResolve(),
|
|
21
|
+
terser({
|
|
22
|
+
ecma: 2020,
|
|
23
|
+
module: true,
|
|
24
|
+
warnings: true,
|
|
25
|
+
mangle: {
|
|
26
|
+
properties: {
|
|
27
|
+
regex: /^__/,
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
}),
|
|
31
|
+
summary(),
|
|
32
|
+
],
|
|
33
|
+
};
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2022",
|
|
4
|
+
"module": "ESNext",
|
|
5
|
+
"moduleResolution": "node",
|
|
6
|
+
"lib": ["es2022", "dom", "dom.iterable"],
|
|
7
|
+
"declaration": true, // Generates .d.ts files for typings
|
|
8
|
+
"experimentalDecorators": true, // Required for Lit decorators
|
|
9
|
+
"useDefineForClassFields": false, // CRITICAL: Must be false for Lit properties to work
|
|
10
|
+
"strict": true,
|
|
11
|
+
"skipLibCheck": true
|
|
12
|
+
},
|
|
13
|
+
"include": ["src/**/*.ts"]
|
|
14
|
+
}
|
package/vite.config.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { defineConfig } from 'vite';
|
|
2
|
+
import dts from 'vite-plugin-dts';
|
|
3
|
+
|
|
4
|
+
export default defineConfig({
|
|
5
|
+
plugins: [
|
|
6
|
+
dts()
|
|
7
|
+
],
|
|
8
|
+
build: {
|
|
9
|
+
lib: {
|
|
10
|
+
entry: 'src/index.ts',
|
|
11
|
+
formats: ['es'],
|
|
12
|
+
fileName: 'index',
|
|
13
|
+
name: 'AtxFormShare'
|
|
14
|
+
},
|
|
15
|
+
rollupOptions: {
|
|
16
|
+
// Don't bundle Lit; let the consumer's package manager manage it
|
|
17
|
+
external: ['lit', /^lit\/.*/]
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
resolve: {
|
|
21
|
+
preserveSymlinks: true
|
|
22
|
+
}
|
|
23
|
+
});
|