Skip to content

Commit 8ca88a8

Browse files
Merging form-block with aem-boilerplate-forms
1 parent 1ef3a74 commit 8ca88a8

File tree

205 files changed

+15529
-5590
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

205 files changed

+15529
-5590
lines changed

.circleci/config.yml

+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
version: 2.1
2+
orbs:
3+
node: circleci/node@5
4+
browser-tools: circleci/browser-tools@1.2.3
5+
jobs:
6+
lint:
7+
executor: node/default
8+
steps:
9+
- checkout
10+
- node/install-packages:
11+
pkg-manager: npm
12+
- run:
13+
name: Run lint
14+
command: npm run lint
15+
test-node:
16+
# Install node dependencies and run tests
17+
executor: node/default
18+
steps:
19+
- checkout
20+
- node/install-packages:
21+
pkg-manager: npm
22+
- run:
23+
name: Print node install help instructions
24+
command: |-
25+
echo "One cause for node package install failure is if you have private repositories that it can't reach
26+
One way to fix this for private npm packages:
27+
1. Use the npm CLI's \"login\" command to create a token (usually saved in your user's \"~/.npmrc\" file)
28+
For more info, see https://circleci.com/blog/publishing-npm-packages-using-circleci-2-0/#:~:text=set%20the%20%24npm_token%20environment%20variable%20in%20circleci
29+
2. Add a NPM_TOKEN to an org context
30+
For info on how to use contexts, see https://circleci.com/docs/contexts/
31+
3. Add a .circleci/config.yml to your repository or use this config.yml as a starting template
32+
4. Configure the jobs to use the context that includes NPM_TOKEN
33+
5. Add a step to inject your NPM_TOKEN environment variable into npm before \"install-packages\"
34+
For an example, see https://circleci.com/blog/publishing-npm-packages-using-circleci-2-0/#:~:text=the%20deploy%20job%20has%20several%20steps%20that%20run%20to%20authenticate%20with%20and%20publish%20to"
35+
when: on_fail
36+
- run:
37+
name: Run tests
38+
command: npm test --passWithNoTests
39+
check-coverage:
40+
executor: node/default
41+
steps:
42+
- checkout
43+
- node/install-packages:
44+
pkg-manager: npm
45+
- run:
46+
name : check coverage
47+
command: npm run coverage
48+
- store_artifacts:
49+
path: coverage
50+
workflows:
51+
lint:
52+
jobs:
53+
- lint
54+
build-and-test:
55+
jobs:
56+
- test-node
57+
check-coverage:
58+
jobs:
59+
- check-coverage
60+
61+

.eslintignore

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
helix-importer-u
2-
1+
helix-importer-ui
2+
rollup/*
33
blocks/form/rules/formula/*
44
blocks/form/rules/model/*

.eslintrc.js .eslintrc.cjs

+2-1
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,6 @@ module.exports = {
1717
'import/extensions': ['error', {
1818
js: 'always',
1919
}],
20+
'no-console': 'on',
2021
},
21-
};
22+
};

.github/workflows/cleanup-on-create.yaml

+19-3
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,15 @@ on:
66
create:
77
branches:
88
- main
9+
workflow_dispatch:
910
jobs:
1011
cleanup:
1112
runs-on: ubuntu-latest
1213
permissions:
1314
contents: write
1415
actions: write
1516
# only run if commit message is "Initial commit" on main branch
16-
if: ${{ github.ref == 'refs/heads/main' && github.event.head_commit.message == 'Initial commit' }}
17+
if: ${{ github.event_name == 'workflow_dispatch' || ( github.ref == 'refs/heads/main' && !(contains(github.event, 'head_commit') || github.event.head_commit.message == 'Initial commit' )) }}
1718
steps:
1819
- name: Checkout
1920
uses: actions/checkout@v4
@@ -27,6 +28,21 @@ jobs:
2728
.github/workflows/cleanup-on-create.yaml \
2829
CHANGELOG.md
2930
31+
- name: Remove Form Developement Files
32+
run: |
33+
rm -rf \
34+
.circleci .npmrc test rollup
35+
36+
- name: Update .eslintignore
37+
run: |
38+
sed -i '/^rollup/d' .eslintignore
39+
sed -i '/^helix-importer-ui/d' .eslintignore
40+
41+
- name: Update Package.json
42+
run: |
43+
rm -rf package.json package-lock.json
44+
mv package-prod.json package.json
45+
3046
- name: Initialize README
3147
# replace {repo} and {owner} with the actual values
3248
run: |
@@ -42,7 +58,7 @@ jobs:
4258
- name: Commit changes
4359
run: |
4460
git config --local user.email "helix@adobe.com"
45-
git config --local user.name "Helix Bot"
61+
git config --local user.name "AEM Bot"
4662
git add .
4763
git commit -m "chore: cleanup repository template"
48-
git push
64+
git push

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,6 @@ helix-importer-ui
77
.DS_Store
88
*.bak
99
.idea
10+
11+
.env*
12+
.vscode

.npmrc

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
registry=https://registry.npmjs.org/
2+
@aemforms:registry=https://registry.npmjs.org/

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ npm run lint
1919

2020
## Local development
2121

22-
1. Create a new repository based on the `aem-boilerplate` template and add a mountpoint in the `fstab.yaml`
22+
1. Create a new repository based on the `aem-boilerplate-forms` template and add a mountpoint in the `fstab.yaml`
2323
1. Add the [AEM Code Sync GitHub App](https://github.com/apps/aem-code-sync) to the repository
2424
1. Install the [AEM CLI](https://github.com/adobe/helix-cli): `npm install -g @adobe/aem-cli`
2525
1. Start AEM Proxy: `aem up` (opens your browser at `http://localhost:3000`)

blocks/form/components/file.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -179,10 +179,11 @@ function createFileHandler(allFiles, input) {
179179

180180
attachFiles: (inputEl, files) => {
181181
const multiple = inputEl.hasAttribute('multiple');
182+
let newFiles = Array.from(files);
182183
if (!multiple) {
183184
allFiles.splice(0, allFiles.length);
185+
newFiles = [newFiles[0]];
184186
}
185-
const newFiles = Array.from(files);
186187
const currentLength = allFiles.length;
187188
allFiles.push(...newFiles);
188189
const newFileElements = newFiles

blocks/form/components/wizard.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ export class WizardLayout {
148148

149149
if (this.includeNextBtn && children.length) {
150150
this.addButton(wrapper, panel, {
151-
label: { value: 'NEXT' }, fieldType: 'button', name: 'next', id: 'wizard-button-next',
151+
label: { value: 'Next' }, fieldType: 'button', name: 'next', id: 'wizard-button-next',
152152
});
153153
}
154154

blocks/form/constant.js

+5
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,18 @@
11
export const fileAttachmentText = 'Attach';
22
export const dragDropText = 'Drag and Drop To Upload';
33

4+
export const DEFAULT_THANK_YOU_MESSAGE = 'Thank you for your submission.';
5+
46
export const defaultErrorMessages = {
57
accept: 'The specified file type not supported.',
68
maxFileSize: 'File too large. Reduce size and try again.',
79
maxItems: 'Specify a number of items equal to or less than $0.',
810
minItems: 'Specify a number of items equal to or greater than $0.',
911
};
1012

13+
// eslint-disable-next-line no-useless-escape
14+
export const emailPattern = '([A-Za-z0-9][._]?)+[A-Za-z0-9]@[A-Za-z0-9]+(\.?[A-Za-z0-9]){2}\.([A-Za-z0-9]{2,4})?';
15+
1116
let submitBaseUrl = '';
1217

1318
export function setSubmitBaseUrl(url) {

blocks/form/form.css

+33-7
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
--label-color: #666;
44
--border-color: #818a91;
55
--form-error-color: #ff5f3f;
6-
--button-primary-color: #035fe6;
6+
--button-primary-color: #5F8DDA;
77
--button-secondary-color: #666;
8-
--button-primary-hover-color: #5F8DDA;
8+
--button-primary-hover-color: #035fe6;
99
--form-font-size-m: 22px;
1010
--form-font-size-s: 18px;
1111
--form-font-size-xs: 16px;
@@ -68,7 +68,7 @@ form output {
6868
font-size: 1.625rem;
6969
}
7070

71-
form [data-visible="false"] {
71+
form:not(.edit-mode) [data-visible="false"] {
7272
display: none !important;
7373
}
7474

@@ -268,9 +268,17 @@ main .form form .item-remove {
268268
padding-left: 10px;
269269
}
270270

271+
main .form .file-description{
272+
display: flex;
273+
gap: 20px;
274+
align-items: center;
275+
margin-top: 5px;
276+
}
277+
271278
main .form .file-description .file-description-name {
272279
cursor: pointer;
273280
text-decoration: underline;
281+
flex: 1;
274282
}
275283

276284
main .form form .item-remove span {
@@ -283,10 +291,23 @@ main .form form .item-remove span {
283291
main .file-wrapper .file-description button {
284292
--form-button-padding: 15px;
285293

286-
background: url('/icons/delete.svg') no-repeat;
287-
width: unset;
288-
border: unset;
294+
width: 12px;
295+
height: 12px;
296+
border: none;
289297
text-align: center;
298+
background: var(--border-color);
299+
cursor: pointer;
300+
position: relative;
301+
border-radius: 3px;
302+
}
303+
304+
main .file-wrapper .file-description button::after{
305+
content: 'X';
306+
position: absolute;
307+
top: 50%;
308+
left: 50%;
309+
color: var(--background-color-primary);
310+
transform: translate(-50%, -50%);
290311
}
291312

292313
main .form .button-wrapper button {
@@ -516,7 +537,12 @@ main .form form .field-wrapper.col-1 {
516537
grid-column: span 1;
517538
}
518539

519-
main .form .form-image-wrapper img{
540+
main .form .form-image-wrapper img {
520541
max-width: 100%;
521542
height: auto;
522543
}
544+
545+
main form .wizard > .current-wizard-step.panel-wrapper:first-of-type ~ .wizard-button-wrapper > .wizard-button-prev,
546+
main form .wizard > .current-wizard-step.panel-wrapper:last-of-type ~ .wizard-button-wrapper > .wizard-button-next {
547+
display: none;
548+
}

0 commit comments

Comments
 (0)