@royaloperahouse/chord 2.7.0-c-development → 2.7.0-e-development
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/CHANGELOG.md +3 -0
- package/README.md +21 -20
- package/dist/chord.cjs.development.js +157 -47
- package/dist/chord.cjs.development.js.map +1 -1
- package/dist/chord.cjs.production.min.js +1 -1
- package/dist/chord.cjs.production.min.js.map +1 -1
- package/dist/chord.esm.js +157 -47
- package/dist/chord.esm.js.map +1 -1
- package/dist/components/molecules/PeopleListing/CreditListing/CreditListing.d.ts +4 -3
- package/dist/components/molecules/SignUpForm/SignUpForm.style.d.ts +1 -0
- package/dist/helpers/arrays.d.ts +1 -1
- package/dist/helpers/forms.d.ts +5 -0
- package/dist/types/creditListing.d.ts +3 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -14,6 +14,8 @@ The Storybook for the latest version of the library is hosted at [chord.roh.org.
|
|
|
14
14
|
## Prerequisites
|
|
15
15
|
---
|
|
16
16
|
|
|
17
|
+
* Use a node version of 16 at the highest to run the storybook locally
|
|
18
|
+
|
|
17
19
|
* Make sure the required package dependencies are installed using `yarn install`
|
|
18
20
|
|
|
19
21
|
* If this is the first time you are working on Chord, make sure to run `yarn build` to build all the modules.
|
|
@@ -44,7 +46,7 @@ Given a version number MAJOR.MINOR.PATCH, increment the:
|
|
|
44
46
|
|
|
45
47
|
When you create a new release always update the `CHANGELOG` and `package.json`
|
|
46
48
|
|
|
47
|
-
Increment your version from the latest stable version on `
|
|
49
|
+
Increment your version from the latest stable version on `main`
|
|
48
50
|
|
|
49
51
|
|
|
50
52
|
## Deploying the Storybook
|
|
@@ -59,7 +61,7 @@ yarn storybook
|
|
|
59
61
|
```
|
|
60
62
|
|
|
61
63
|
By default the storybook will be accessible at
|
|
62
|
-
[http://localhost:6006/]()
|
|
64
|
+
[http://localhost:6006/](http://localhost:6006/)
|
|
63
65
|
|
|
64
66
|
The server will hot-reload on most changes.
|
|
65
67
|
|
|
@@ -105,7 +107,7 @@ then run:
|
|
|
105
107
|
yarn deploy-storybook
|
|
106
108
|
```
|
|
107
109
|
|
|
108
|
-
> **IMPORTANT:** This URL is intended to showcase the latest stable version of Chord, it should be kept up to date with the main
|
|
110
|
+
> **IMPORTANT:** This URL is intended to showcase the latest stable version of Chord, it should be kept up to date with the main branch and should **only** be used for release versions. If you want to deploy a development version follow the steps above under *To deploy a preview version remotely*.
|
|
109
111
|
|
|
110
112
|
|
|
111
113
|
## Releasing a New Package Version
|
|
@@ -123,9 +125,9 @@ A **stable** package is published for use in production.
|
|
|
123
125
|
|
|
124
126
|
### **1. To release a snapshot version**
|
|
125
127
|
|
|
126
|
-
> **IMPORTANT:** Make sure you always publish your **snapshots** from `
|
|
128
|
+
> **IMPORTANT:** Make sure you always publish your **snapshots** from `development` after merging in your feature branch.
|
|
127
129
|
|
|
128
|
-
For snapshots, `RELEASE_VERSION` should be the same as the latest **stable** version of the Chord Library, as found in `
|
|
130
|
+
For snapshots, `RELEASE_VERSION` should be the same as the latest **stable** version of the Chord Library, as found in `main`, followed by an **unused** lowercase letter.
|
|
129
131
|
|
|
130
132
|
For example, if the latest stable release was 1.42.0, and the last snapshot published to NPM was 1.42.0-w, you would use RELEASE_VERSION `1.42.0-x`
|
|
131
133
|
|
|
@@ -135,13 +137,13 @@ To publish a snapshot use:
|
|
|
135
137
|
NPM_ROH_TOKEN={NPM_TOKEN} RELEASE_VERSION={RELEASE_VERSION} yarn publish-snapshot
|
|
136
138
|
```
|
|
137
139
|
|
|
138
|
-
The version published to NPM will be named, e.g. `1.42.0-
|
|
140
|
+
The version published to NPM will be named, e.g. `1.42.0-x-development`, use this to install the snapshot package in the frontend repos.
|
|
139
141
|
|
|
140
142
|
### **2. To release a stable version**
|
|
141
143
|
|
|
142
|
-
> **IMPORTANT:** Make sure you always publish your **stable** packages from `
|
|
144
|
+
> **IMPORTANT:** Make sure you always publish your **stable** packages from `main` after merging in your feature branch.
|
|
143
145
|
|
|
144
|
-
For stable releases, increment your version from the latest **stable** version found on `
|
|
146
|
+
For stable releases, increment your version from the latest **stable** version found on `main`, following the rules described in *Versioning* above, and use this as `RELEASE_VERSION`. (Make sure it matches the version in your `package.json` and `CHANGELOG.md`!)
|
|
145
147
|
|
|
146
148
|
To publish a stable package use:
|
|
147
149
|
|
|
@@ -194,10 +196,9 @@ yarn test-storybook
|
|
|
194
196
|
---
|
|
195
197
|
|
|
196
198
|
### **1. Branching Model**
|
|
197
|
-
* The Chord project
|
|
198
|
-
*
|
|
199
|
-
* The Chord **
|
|
200
|
-
* The Chord **main** branch is currently `chord-releases`
|
|
199
|
+
* The Chord project source can be found at [https://bitbucket.org/rohorguk/harmonic-library](https://bitbucket.org/rohorguk/harmonic-library) in the `chord` directory
|
|
200
|
+
* The Chord **development** branch is currently `development`
|
|
201
|
+
* The Chord **main** branch is currently `main`
|
|
201
202
|
* All work should be done on a correctly named **feature branch** of the format: `issueType/ticketNumber-short-description-of-feature`, e.g. `feature/RD-1234-update-chord-documentation`
|
|
202
203
|
* Always create your feature branch FROM, and submit pull requests TO, the **main** branch
|
|
203
204
|
* For **QA / UAT** of a Chord component in isolation: following review you should deploy a preview version to Chromatic straight from your **feature branch** _without_ merging to development
|
|
@@ -207,13 +208,13 @@ yarn test-storybook
|
|
|
207
208
|
|
|
208
209
|
#### **Before review:**
|
|
209
210
|
|
|
210
|
-
* Git pull the latest version of `
|
|
211
|
-
* Checkout a new, correctly-named feature branch from `
|
|
211
|
+
* Git pull the latest version of `main`
|
|
212
|
+
* Checkout a new, correctly-named feature branch from `main`
|
|
212
213
|
* Do your work on this feature branch
|
|
213
214
|
* Run: `yarn lint`
|
|
214
215
|
* Run: `yarn test`
|
|
215
216
|
* Commit your changes
|
|
216
|
-
* Create a pull request from your feature branch to `
|
|
217
|
+
* Create a pull request from your feature branch to `main`
|
|
217
218
|
* Add the appropriate reviewers
|
|
218
219
|
|
|
219
220
|
#### **Before QA / UAT:**
|
|
@@ -227,10 +228,10 @@ After your PR is approved, you have two options:
|
|
|
227
228
|
|
|
228
229
|
**ii.** For integrated testing of a component in the frontend staging environments:
|
|
229
230
|
|
|
230
|
-
* Check out the `
|
|
231
|
-
* Merge your work in to `
|
|
231
|
+
* Check out the `development` branch
|
|
232
|
+
* Merge your work in to `development`
|
|
232
233
|
* Follow the steps above under *Publishing a New Package Version -> 1. To release a snapshot version*
|
|
233
|
-
* Git push the updated `
|
|
234
|
+
* Git push the updated `development` branch to remote
|
|
234
235
|
* Finally, in the frontend repo:
|
|
235
236
|
|
|
236
237
|
1. Update the `package.json` to reference the new snapshot version
|
|
@@ -240,14 +241,14 @@ After your PR is approved, you have two options:
|
|
|
240
241
|
#### **When ready for production:**
|
|
241
242
|
|
|
242
243
|
* Return to your chord **feature branch**
|
|
243
|
-
* Update the chord version in `package.json`, incrementing from the last **stable** release, found in `
|
|
244
|
+
* Update the chord version in `package.json`, incrementing from the last **stable** release, found in `main`, and following the rules described in the *Versioning* section
|
|
244
245
|
* Update `CHANGELOG.md`, adding the new version number and a short description of your changes
|
|
245
246
|
* Run: `yarn lint`
|
|
246
247
|
* Run: `yarn test`
|
|
247
248
|
* Run: `yarn test-storybook -u`
|
|
248
249
|
* Run: `yarn build-storybook`
|
|
249
250
|
* Git commit, push, and update your PR for final approval
|
|
250
|
-
* Merge your approved PR to `
|
|
251
|
+
* Merge your approved PR to `main`
|
|
251
252
|
* Follow the steps in *Publishing a New Package Version -> 2. To release a stable version* to publish the NPM package
|
|
252
253
|
* Finally, follow the steps in *Deploying The Storybook -> 3. To deploy a release version*, to update the public Chord Storybook page
|
|
253
254
|
|
|
@@ -4203,12 +4203,14 @@ var TextField = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
4203
4203
|
|
|
4204
4204
|
return /*#__PURE__*/React__default.createElement(Container$1, null, /*#__PURE__*/React__default.createElement("label", null, !!label && /*#__PURE__*/React__default.createElement(TextLabel$1, {
|
|
4205
4205
|
darkMode: darkMode,
|
|
4206
|
-
"data-testid": "text-field-text-label"
|
|
4206
|
+
"data-testid": "text-field-text-label",
|
|
4207
|
+
"aria-hidden": "true"
|
|
4207
4208
|
}, /*#__PURE__*/React__default.createElement(AltHeader, {
|
|
4208
4209
|
level: 6
|
|
4209
4210
|
}, label)), /*#__PURE__*/React__default.createElement(InputWrapper, {
|
|
4210
4211
|
width: width
|
|
4211
4212
|
}, /*#__PURE__*/React__default.createElement(Input, Object.assign({
|
|
4213
|
+
"aria-label": label,
|
|
4212
4214
|
isPasswordField: isPasswordField,
|
|
4213
4215
|
type: inputType,
|
|
4214
4216
|
error: error,
|
|
@@ -4222,7 +4224,10 @@ var TextField = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
4222
4224
|
level: 1
|
|
4223
4225
|
}, showHideButtonText)))), !!error && /*#__PURE__*/React__default.createElement(ErrorLabel$1, {
|
|
4224
4226
|
darkMode: darkMode,
|
|
4225
|
-
|
|
4227
|
+
id: inputProps.name + "-error",
|
|
4228
|
+
"data-testid": "text-field-error-label",
|
|
4229
|
+
role: "alert",
|
|
4230
|
+
"aria-live": "assertive"
|
|
4226
4231
|
}, /*#__PURE__*/React__default.createElement(AltHeader, {
|
|
4227
4232
|
level: 6
|
|
4228
4233
|
}, error)));
|
|
@@ -9100,32 +9105,43 @@ var getConcatenatedPropLength = function getConcatenatedPropLength(array, prop)
|
|
|
9100
9105
|
}, 0);
|
|
9101
9106
|
};
|
|
9102
9107
|
|
|
9103
|
-
var
|
|
9104
|
-
|
|
9105
|
-
|
|
9106
|
-
|
|
9107
|
-
|
|
9108
|
-
|
|
9109
|
-
|
|
9110
|
-
|
|
9111
|
-
|
|
9112
|
-
|
|
9108
|
+
var DEFAULT_COLUMN_COUNT = 4;
|
|
9109
|
+
var DEFAULT_LARGE_COLUMN_SPAN = 2;
|
|
9110
|
+
var DEFAULT_CHARACTER_THRESHOLD = 180;
|
|
9111
|
+
|
|
9112
|
+
var concatenateMusicTitle = function concatenateMusicTitle(musicTitle, index) {
|
|
9113
|
+
return /*#__PURE__*/React__default.createElement(React__default.Fragment, {
|
|
9114
|
+
key: "music-" + index
|
|
9115
|
+
}, musicTitle.map(function (title, idx) {
|
|
9116
|
+
if (musicTitle.length > 1 && idx === musicTitle.length - 1) {
|
|
9117
|
+
return /*#__PURE__*/React__default.createElement(React__default.Fragment, {
|
|
9118
|
+
key: "music-" + index + "-" + idx + "-" + title
|
|
9119
|
+
}, ' ', "and ", /*#__PURE__*/React__default.createElement("i", null, title));
|
|
9120
|
+
} else if (idx > 0) {
|
|
9121
|
+
return /*#__PURE__*/React__default.createElement(React__default.Fragment, {
|
|
9122
|
+
key: "music-" + index + "-" + idx + "-" + title
|
|
9123
|
+
}, /*#__PURE__*/React__default.createElement("i", null, ", ", title));
|
|
9113
9124
|
}
|
|
9114
9125
|
|
|
9115
|
-
return /*#__PURE__*/React__default.createElement(
|
|
9116
|
-
key: index
|
|
9117
|
-
}, title);
|
|
9126
|
+
return /*#__PURE__*/React__default.createElement(React__default.Fragment, {
|
|
9127
|
+
key: "music-" + index + "-" + idx + "-" + title
|
|
9128
|
+
}, /*#__PURE__*/React__default.createElement("i", null, title));
|
|
9118
9129
|
}));
|
|
9119
9130
|
};
|
|
9120
9131
|
|
|
9121
9132
|
var CreditListing = function CreditListing(_ref) {
|
|
9122
9133
|
var roles = _ref.roles,
|
|
9123
9134
|
_ref$columnCount = _ref.columnCount,
|
|
9124
|
-
columnCount = _ref$columnCount === void 0 ?
|
|
9125
|
-
|
|
9126
|
-
|
|
9127
|
-
|
|
9128
|
-
|
|
9135
|
+
columnCount = _ref$columnCount === void 0 ? DEFAULT_COLUMN_COUNT : _ref$columnCount,
|
|
9136
|
+
_ref$expandLargeEntri = _ref.expandLargeEntries,
|
|
9137
|
+
expandLargeEntries = _ref$expandLargeEntri === void 0 ? false : _ref$expandLargeEntri,
|
|
9138
|
+
_ref$largeColumnSpan = _ref.largeColumnSpan,
|
|
9139
|
+
largeColumnSpan = _ref$largeColumnSpan === void 0 ? DEFAULT_LARGE_COLUMN_SPAN : _ref$largeColumnSpan,
|
|
9140
|
+
_ref$characterThresho = _ref.characterThreshold,
|
|
9141
|
+
characterThreshold = _ref$characterThresho === void 0 ? DEFAULT_CHARACTER_THRESHOLD : _ref$characterThresho;
|
|
9142
|
+
var creditEntries = [];
|
|
9143
|
+
var nextColumnStart = 1;
|
|
9144
|
+
roles.forEach(function (_ref2, index) {
|
|
9129
9145
|
var name = _ref2.name,
|
|
9130
9146
|
people = _ref2.people,
|
|
9131
9147
|
description = _ref2.description,
|
|
@@ -9133,13 +9149,42 @@ var CreditListing = function CreditListing(_ref) {
|
|
|
9133
9149
|
replacement = _ref2.replacement,
|
|
9134
9150
|
additionalInfo = _ref2.additionalInfo,
|
|
9135
9151
|
dataROH = _ref2.dataROH;
|
|
9136
|
-
|
|
9137
|
-
var
|
|
9138
|
-
|
|
9139
|
-
|
|
9140
|
-
|
|
9141
|
-
|
|
9142
|
-
|
|
9152
|
+
|
|
9153
|
+
var _ref3 = function () {
|
|
9154
|
+
if (expandLargeEntries && columnCount > 1) {
|
|
9155
|
+
var namesLength = getConcatenatedPropLength(people, 'name');
|
|
9156
|
+
|
|
9157
|
+
var _columnSpan = namesLength > characterThreshold ? largeColumnSpan : 1;
|
|
9158
|
+
|
|
9159
|
+
var unboundedEnd = nextColumnStart + _columnSpan;
|
|
9160
|
+
|
|
9161
|
+
var _columnStart = unboundedEnd > columnCount + 1 ? 1 : nextColumnStart;
|
|
9162
|
+
|
|
9163
|
+
var columnEnd = _columnStart + _columnSpan;
|
|
9164
|
+
nextColumnStart = columnEnd % columnCount || columnCount;
|
|
9165
|
+
return {
|
|
9166
|
+
columnStart: _columnStart,
|
|
9167
|
+
columnSpan: _columnSpan
|
|
9168
|
+
};
|
|
9169
|
+
} else {
|
|
9170
|
+
return {
|
|
9171
|
+
columnStart: 0,
|
|
9172
|
+
columnSpan: 1
|
|
9173
|
+
};
|
|
9174
|
+
}
|
|
9175
|
+
}(),
|
|
9176
|
+
columnStart = _ref3.columnStart,
|
|
9177
|
+
columnSpan = _ref3.columnSpan;
|
|
9178
|
+
|
|
9179
|
+
creditEntries.push( /*#__PURE__*/React__default.createElement(GridItem, {
|
|
9180
|
+
columnStartDesktop: columnStart,
|
|
9181
|
+
columnSpanDesktop: columnSpan,
|
|
9182
|
+
columnStartDevice: 1,
|
|
9183
|
+
columnSpanDevice: 1,
|
|
9184
|
+
columnStartSmallDevice: 1,
|
|
9185
|
+
columnSpanSmallDevice: 1,
|
|
9186
|
+
key: "credit-entry-" + name + "-" + index,
|
|
9187
|
+
"data-testid": "credit-entry"
|
|
9143
9188
|
}, /*#__PURE__*/React__default.createElement(TextWrapper$2, null, /*#__PURE__*/React__default.createElement(RoleWrapper$1, {
|
|
9144
9189
|
title: "role",
|
|
9145
9190
|
"data-roh": dataROH
|
|
@@ -9163,12 +9208,16 @@ var CreditListing = function CreditListing(_ref) {
|
|
|
9163
9208
|
tag: "p"
|
|
9164
9209
|
}, replacement)), musicTitle && musicTitle.length > 0 && /*#__PURE__*/React__default.createElement(BodyText, {
|
|
9165
9210
|
level: 1,
|
|
9166
|
-
tag: "p"
|
|
9167
|
-
|
|
9211
|
+
tag: "p",
|
|
9212
|
+
key: "music-" + musicTitle + "-text"
|
|
9213
|
+
}, concatenateMusicTitle(musicTitle, index)), additionalInfo && /*#__PURE__*/React__default.createElement(BodyText, {
|
|
9168
9214
|
level: 1,
|
|
9169
9215
|
tag: "p"
|
|
9170
|
-
}, additionalInfo)));
|
|
9171
|
-
})
|
|
9216
|
+
}, additionalInfo))));
|
|
9217
|
+
});
|
|
9218
|
+
return /*#__PURE__*/React__default.createElement(CreditListingWrapper, {
|
|
9219
|
+
columnCount: columnCount
|
|
9220
|
+
}, creditEntries);
|
|
9172
9221
|
};
|
|
9173
9222
|
|
|
9174
9223
|
var _templateObject$13, _templateObject2$M, _templateObject3$D, _templateObject4$v, _templateObject5$p, _templateObject6$j, _templateObject7$d, _templateObject8$a, _templateObject9$5, _templateObject10$5, _templateObject11$2, _templateObject12$1, _templateObject13$1, _templateObject14$1, _templateObject15, _templateObject16, _templateObject17, _templateObject18, _templateObject19, _templateObject20, _templateObject21;
|
|
@@ -11246,7 +11295,7 @@ var Table = function Table(_ref) {
|
|
|
11246
11295
|
}))))))));
|
|
11247
11296
|
};
|
|
11248
11297
|
|
|
11249
|
-
var _templateObject$1k, _templateObject2$Z, _templateObject3$P, _templateObject4$E, _templateObject5$x, _templateObject6$p, _templateObject7$h, _templateObject8$d, _templateObject9$8, _templateObject10$8;
|
|
11298
|
+
var _templateObject$1k, _templateObject2$Z, _templateObject3$P, _templateObject4$E, _templateObject5$x, _templateObject6$p, _templateObject7$h, _templateObject8$d, _templateObject9$8, _templateObject10$8, _templateObject11$4;
|
|
11250
11299
|
var Wrapper$8 = /*#__PURE__*/styled__default('div')(_templateObject$1k || (_templateObject$1k = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n position: relative;\n border-top: 4px solid ", ";\n border-bottom: 4px solid ", ";\n"])), function (_ref) {
|
|
11251
11300
|
var theme = _ref.theme;
|
|
11252
11301
|
return "var(--base-color-" + theme + ")";
|
|
@@ -11254,15 +11303,16 @@ var Wrapper$8 = /*#__PURE__*/styled__default('div')(_templateObject$1k || (_temp
|
|
|
11254
11303
|
var theme = _ref2.theme;
|
|
11255
11304
|
return "var(--base-color-" + theme + ")";
|
|
11256
11305
|
});
|
|
11257
|
-
var SignUpFormWrapper = /*#__PURE__*/styled__default(Grid)(_templateObject2$Z || (_templateObject2$Z = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n gap: 0 var(--grid-column-gap);\n margin-bottom: 32px;\n"])));
|
|
11258
|
-
var SignUpTitleWrapper = /*#__PURE__*/styled__default('div')(_templateObject3$P || (_templateObject3$P = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n text-align: left;\n position: relative;\n top: -25px;\n left: -20px;\n background: var(--base-color-white);\n display: inline-block;\n padding: 0 20px;\n
|
|
11306
|
+
var SignUpFormWrapper = /*#__PURE__*/styled__default(Grid)(_templateObject2$Z || (_templateObject2$Z = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n gap: 0 var(--grid-column-gap);\n margin-bottom: 32px;\n\n @media ", " {\n margin-bottom: 30px;\n }\n"])), devices.mobile);
|
|
11307
|
+
var SignUpTitleWrapper = /*#__PURE__*/styled__default('div')(_templateObject3$P || (_templateObject3$P = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n text-align: left;\n position: relative;\n top: -25px;\n left: -20px;\n height: 52px;\n background: var(--base-color-white);\n display: inline-block;\n padding: 0 20px;\n\n @media ", " {\n top: -18px;\n height: 37px;\n padding: 0 13px;\n left: -13px;\n }\n"])), devices.mobile);
|
|
11259
11308
|
var Error$1 = /*#__PURE__*/styled__default.div(_templateObject4$E || (_templateObject4$E = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n margin-top: 20px;\n color: var(--base-color-errorstate);\n a {\n text-decoration: underline;\n color: inherit;\n }\n"])));
|
|
11260
|
-
var Form = /*#__PURE__*/styled__default.form(_templateObject5$x || (_templateObject5$x = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n margin-top:
|
|
11261
|
-
var FormFooterWrapper = /*#__PURE__*/styled__default.div(_templateObject6$p || (_templateObject6$p = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n margin-top: 32px;\n display: flex;\n gap:
|
|
11309
|
+
var Form = /*#__PURE__*/styled__default.form(_templateObject5$x || (_templateObject5$x = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n margin-top: 32px;\n align-items: center;\n ", " {\n margin-top: -20px;\n }\n a[href] {\n color: inherit;\n }\n"])), Error$1);
|
|
11310
|
+
var FormFooterWrapper = /*#__PURE__*/styled__default.div(_templateObject6$p || (_templateObject6$p = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n margin-top: 32px;\n display: flex;\n gap: 28px;\n align-items: center;\n\n @media ", " {\n flex-direction: column-reverse;\n align-items: flex-start;\n }\n"])), devices.mobile);
|
|
11262
11311
|
var ServerError = /*#__PURE__*/styled__default.div(_templateObject7$h || (_templateObject7$h = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n text-align: left;\n color: var(--base-color-errorstate);\n"])));
|
|
11263
|
-
var CTALinkWrapper = /*#__PURE__*/styled__default.a(_templateObject8$d || (_templateObject8$d = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n
|
|
11312
|
+
var CTALinkWrapper = /*#__PURE__*/styled__default.a(_templateObject8$d || (_templateObject8$d = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n color: var(--base-color-black);\n div {\n text-decoration: underline;\n }\n"])));
|
|
11264
11313
|
var ButtonWrapper$3 = /*#__PURE__*/styled__default.button(_templateObject9$8 || (_templateObject9$8 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n all: unset;\n width: fit-content;\n\n @media ", " {\n width: 100%;\n }\n &:focus {\n outline: 3px solid var(--base-color-lapislazuli);\n }\n"])), devices.mobile);
|
|
11265
|
-
var FieldsWrapper = /*#__PURE__*/styled__default.div(_templateObject10$8 || (_templateObject10$8 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: grid;\n grid-template-columns: repeat(3, 1fr);\n gap: 36px;\n\n @media ", " {\n grid-template-columns: 1fr;\n gap: 20px;\n }\n
|
|
11314
|
+
var FieldsWrapper = /*#__PURE__*/styled__default.div(_templateObject10$8 || (_templateObject10$8 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: grid;\n grid-template-columns: repeat(3, 1fr);\n gap: 36px;\n\n @media ", " {\n grid-template-columns: 1fr;\n gap: 20px;\n }\n"])), devices.mobile);
|
|
11315
|
+
var MessageWrapper$1 = /*#__PURE__*/styled__default.div(_templateObject11$4 || (_templateObject11$4 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n div > p {\n margin: 0;\n }\n"])));
|
|
11266
11316
|
|
|
11267
11317
|
var regex = {
|
|
11268
11318
|
signInEmail: /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,
|
|
@@ -11272,13 +11322,45 @@ var regex = {
|
|
|
11272
11322
|
var formValidationMessages = {
|
|
11273
11323
|
requiredFieldMessage: 'Please complete this field',
|
|
11274
11324
|
firstName: {
|
|
11275
|
-
invalid: 'Please enter your first name'
|
|
11325
|
+
invalid: 'Please enter your full first name',
|
|
11326
|
+
required: 'Please enter a first name'
|
|
11327
|
+
},
|
|
11328
|
+
lastName: {
|
|
11329
|
+
required: 'Please enter a last name'
|
|
11276
11330
|
},
|
|
11277
11331
|
email: {
|
|
11278
11332
|
required: 'Please enter an email address',
|
|
11279
11333
|
invalid: 'Enter an email address in the correct format, like name@example.com'
|
|
11280
11334
|
}
|
|
11281
11335
|
};
|
|
11336
|
+
var getFormErrorMessage = function getFormErrorMessage(field, value) {
|
|
11337
|
+
var errorMessage;
|
|
11338
|
+
|
|
11339
|
+
if (!value) {
|
|
11340
|
+
switch (field) {
|
|
11341
|
+
case 'firstName':
|
|
11342
|
+
errorMessage = formValidationMessages.firstName.required;
|
|
11343
|
+
break;
|
|
11344
|
+
|
|
11345
|
+
case 'lastName':
|
|
11346
|
+
errorMessage = formValidationMessages.lastName.required;
|
|
11347
|
+
break;
|
|
11348
|
+
|
|
11349
|
+
case 'email':
|
|
11350
|
+
errorMessage = formValidationMessages.email.required;
|
|
11351
|
+
break;
|
|
11352
|
+
|
|
11353
|
+
default:
|
|
11354
|
+
errorMessage = formValidationMessages.requiredFieldMessage;
|
|
11355
|
+
}
|
|
11356
|
+
} else if (field === 'email' && !regex.signInEmail.test(value)) {
|
|
11357
|
+
errorMessage = formValidationMessages.email.invalid;
|
|
11358
|
+
} else if (field === 'firstName' && !regex.firstName.test(value)) {
|
|
11359
|
+
errorMessage = formValidationMessages.firstName.invalid;
|
|
11360
|
+
}
|
|
11361
|
+
|
|
11362
|
+
return errorMessage;
|
|
11363
|
+
};
|
|
11282
11364
|
|
|
11283
11365
|
var themeToColor = function themeToColor(theme) {
|
|
11284
11366
|
switch (theme) {
|
|
@@ -11339,6 +11421,21 @@ var SignUpForm = function SignUpForm(_ref) {
|
|
|
11339
11421
|
};
|
|
11340
11422
|
};
|
|
11341
11423
|
|
|
11424
|
+
var handleBlur = function handleBlur(field) {
|
|
11425
|
+
return function () {
|
|
11426
|
+
var value = formValues[field];
|
|
11427
|
+
var formErrorMessage = getFormErrorMessage(field, value);
|
|
11428
|
+
|
|
11429
|
+
if (formErrorMessage) {
|
|
11430
|
+
setErrors(function (prev) {
|
|
11431
|
+
var _extends4;
|
|
11432
|
+
|
|
11433
|
+
return _extends({}, prev, (_extends4 = {}, _extends4[field] = formErrorMessage, _extends4));
|
|
11434
|
+
});
|
|
11435
|
+
}
|
|
11436
|
+
};
|
|
11437
|
+
};
|
|
11438
|
+
|
|
11342
11439
|
var handleFormSubmit = /*#__PURE__*/function () {
|
|
11343
11440
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(e) {
|
|
11344
11441
|
var formErrors, response;
|
|
@@ -11360,13 +11457,13 @@ var SignUpForm = function SignUpForm(_ref) {
|
|
|
11360
11457
|
|
|
11361
11458
|
if (!isLoggedIn) {
|
|
11362
11459
|
if (!formValues.firstName) {
|
|
11363
|
-
formErrors.firstName = formValidationMessages.
|
|
11460
|
+
formErrors.firstName = formValidationMessages.firstName.required;
|
|
11364
11461
|
} else if (!regex.firstName.test(formValues.firstName)) {
|
|
11365
11462
|
formErrors.firstName = formValidationMessages.firstName.invalid;
|
|
11366
11463
|
}
|
|
11367
11464
|
|
|
11368
11465
|
if (!formValues.lastName) {
|
|
11369
|
-
formErrors.lastName = formValidationMessages.
|
|
11466
|
+
formErrors.lastName = formValidationMessages.lastName.required;
|
|
11370
11467
|
}
|
|
11371
11468
|
|
|
11372
11469
|
if (!formValues.email) {
|
|
@@ -11428,13 +11525,13 @@ var SignUpForm = function SignUpForm(_ref) {
|
|
|
11428
11525
|
columnSpanDesktop: 10,
|
|
11429
11526
|
columnStartDevice: 2,
|
|
11430
11527
|
columnSpanDevice: 12
|
|
11431
|
-
}, /*#__PURE__*/React__default.createElement(AltHeader, {
|
|
11528
|
+
}, /*#__PURE__*/React__default.createElement(MessageWrapper$1, null, /*#__PURE__*/React__default.createElement(AltHeader, {
|
|
11432
11529
|
level: 6
|
|
11433
11530
|
}, /*#__PURE__*/React__default.createElement("div", {
|
|
11434
11531
|
dangerouslySetInnerHTML: {
|
|
11435
11532
|
__html: isSuccess ? submittedState.message : initialState.message
|
|
11436
11533
|
}
|
|
11437
|
-
}))), !isSuccess && /*#__PURE__*/React__default.createElement(GridItem, {
|
|
11534
|
+
})))), !isSuccess && /*#__PURE__*/React__default.createElement(GridItem, {
|
|
11438
11535
|
columnStartDesktop: 3,
|
|
11439
11536
|
columnSpanDesktop: 12,
|
|
11440
11537
|
columnStartDevice: 2,
|
|
@@ -11450,6 +11547,10 @@ var SignUpForm = function SignUpForm(_ref) {
|
|
|
11450
11547
|
maxLength: 20,
|
|
11451
11548
|
error: errors.firstName,
|
|
11452
11549
|
onChange: handleChange('firstName'),
|
|
11550
|
+
onBlur: handleBlur('firstName'),
|
|
11551
|
+
"aria-required": "true",
|
|
11552
|
+
"aria-invalid": !!errors.firstName,
|
|
11553
|
+
"aria-describedby": errors.firstName ? 'firstName-error' : undefined,
|
|
11453
11554
|
autoComplete: "given-name"
|
|
11454
11555
|
}), /*#__PURE__*/React__default.createElement(TextField, {
|
|
11455
11556
|
label: "Last name",
|
|
@@ -11459,6 +11560,10 @@ var SignUpForm = function SignUpForm(_ref) {
|
|
|
11459
11560
|
value: formValues.lastName,
|
|
11460
11561
|
error: errors.lastName,
|
|
11461
11562
|
onChange: handleChange('lastName'),
|
|
11563
|
+
onBlur: handleBlur('lastName'),
|
|
11564
|
+
"aria-required": "true",
|
|
11565
|
+
"aria-invalid": !!errors.lastName,
|
|
11566
|
+
"aria-describedby": errors.lastName ? 'lastName-error' : undefined,
|
|
11462
11567
|
autoComplete: "family-name"
|
|
11463
11568
|
}), /*#__PURE__*/React__default.createElement(TextField, {
|
|
11464
11569
|
label: "Email",
|
|
@@ -11467,15 +11572,20 @@ var SignUpForm = function SignUpForm(_ref) {
|
|
|
11467
11572
|
value: formValues.email,
|
|
11468
11573
|
error: errors.email || errors.serverError,
|
|
11469
11574
|
onChange: handleChange('email'),
|
|
11575
|
+
onBlur: handleBlur('email'),
|
|
11576
|
+
"aria-required": "true",
|
|
11577
|
+
"aria-invalid": !!errors.email,
|
|
11578
|
+
"aria-describedby": errors.email ? 'email-error' : undefined,
|
|
11470
11579
|
maxLength: 80
|
|
11471
11580
|
})), isLoggedIn && !!errors.serverError && /*#__PURE__*/React__default.createElement(GridItem, {
|
|
11472
11581
|
columnStartDesktop: 2,
|
|
11473
11582
|
columnSpanDesktop: 12,
|
|
11474
|
-
columnStartTablet: 2,
|
|
11475
|
-
columnSpanTablet: 12,
|
|
11476
11583
|
columnStartDevice: 2,
|
|
11477
11584
|
columnSpanDevice: 12
|
|
11478
|
-
}, /*#__PURE__*/React__default.createElement(ServerError,
|
|
11585
|
+
}, /*#__PURE__*/React__default.createElement(ServerError, {
|
|
11586
|
+
role: "alert",
|
|
11587
|
+
"aria-live": "assertive"
|
|
11588
|
+
}, /*#__PURE__*/React__default.createElement(AltHeader, {
|
|
11479
11589
|
level: 6
|
|
11480
11590
|
}, errors.serverError))), /*#__PURE__*/React__default.createElement(FormFooterWrapper, null, /*#__PURE__*/React__default.createElement(ButtonWrapper$3, {
|
|
11481
11591
|
type: "submit"
|
|
@@ -11484,7 +11594,7 @@ var SignUpForm = function SignUpForm(_ref) {
|
|
|
11484
11594
|
}, "Sign up")), /*#__PURE__*/React__default.createElement(CTALinkWrapper, {
|
|
11485
11595
|
href: ctaPrivacy.link
|
|
11486
11596
|
}, /*#__PURE__*/React__default.createElement(BodyText, {
|
|
11487
|
-
level:
|
|
11597
|
+
level: 1
|
|
11488
11598
|
}, ctaPrivacy.text)))))));
|
|
11489
11599
|
};
|
|
11490
11600
|
|