@royaloperahouse/chord 2.7.0-b-development → 2.7.0-d-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 +170 -45
- 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 +170 -45
- 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 +2 -2
- package/dist/helpers/arrays.d.ts +1 -1
- package/dist/helpers/forms.d.ts +5 -0
- package/dist/helpers/theme.d.ts +2 -0
- package/dist/types/creditListing.d.ts +3 -0
- package/dist/types/signUpForm.d.ts +2 -6
- 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;
|
|
@@ -11247,7 +11296,7 @@ var Table = function Table(_ref) {
|
|
|
11247
11296
|
};
|
|
11248
11297
|
|
|
11249
11298
|
var _templateObject$1k, _templateObject2$Z, _templateObject3$P, _templateObject4$E, _templateObject5$x, _templateObject6$p, _templateObject7$h, _templateObject8$d, _templateObject9$8, _templateObject10$8;
|
|
11250
|
-
var Wrapper$8 = /*#__PURE__*/styled__default('div')(_templateObject$1k || (_templateObject$1k = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n position: relative;\n
|
|
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 + ")";
|
|
11253
11302
|
}, function (_ref2) {
|
|
@@ -11255,14 +11304,14 @@ var Wrapper$8 = /*#__PURE__*/styled__default('div')(_templateObject$1k || (_temp
|
|
|
11255
11304
|
return "var(--base-color-" + theme + ")";
|
|
11256
11305
|
});
|
|
11257
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"])));
|
|
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
|
|
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 background: var(--base-color-white);\n display: inline-block;\n padding: 0 20px;\n\n @media ", " {\n top: -18px;\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
11309
|
var Form = /*#__PURE__*/styled__default.form(_templateObject5$x || (_templateObject5$x = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n margin-top: 20px;\n align-items: center;\n ", " {\n margin-top: -20px;\n }\n a[href] {\n color: inherit;\n }\n"])), Error$1);
|
|
11261
|
-
var FormFooterWrapper = /*#__PURE__*/styled__default.div(_templateObject6$p || (_templateObject6$p = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n margin-top: 32px;\n display: flex;\n gap: 21px;\n align-items: center;\n
|
|
11310
|
+
var FormFooterWrapper = /*#__PURE__*/styled__default.div(_templateObject6$p || (_templateObject6$p = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n margin-top: 32px;\n display: flex;\n gap: 21px;\n align-items: center;\n\n @media ", " {\n flex-direction: column-reverse;\n align-items: flex-start;\n margin-bottom: 20px;\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);
|
|
11266
11315
|
|
|
11267
11316
|
var regex = {
|
|
11268
11317
|
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 +11321,61 @@ var regex = {
|
|
|
11272
11321
|
var formValidationMessages = {
|
|
11273
11322
|
requiredFieldMessage: 'Please complete this field',
|
|
11274
11323
|
firstName: {
|
|
11275
|
-
invalid: 'Please enter your first name'
|
|
11324
|
+
invalid: 'Please enter your full first name',
|
|
11325
|
+
required: 'Please enter a first name'
|
|
11326
|
+
},
|
|
11327
|
+
lastName: {
|
|
11328
|
+
required: 'Please enter a last name'
|
|
11276
11329
|
},
|
|
11277
11330
|
email: {
|
|
11278
11331
|
required: 'Please enter an email address',
|
|
11279
11332
|
invalid: 'Enter an email address in the correct format, like name@example.com'
|
|
11280
11333
|
}
|
|
11281
11334
|
};
|
|
11335
|
+
var getFormErrorMessage = function getFormErrorMessage(field, value) {
|
|
11336
|
+
var errorMessage;
|
|
11337
|
+
|
|
11338
|
+
if (!value) {
|
|
11339
|
+
switch (field) {
|
|
11340
|
+
case 'firstName':
|
|
11341
|
+
errorMessage = formValidationMessages.firstName.required;
|
|
11342
|
+
break;
|
|
11343
|
+
|
|
11344
|
+
case 'lastName':
|
|
11345
|
+
errorMessage = formValidationMessages.lastName.required;
|
|
11346
|
+
break;
|
|
11347
|
+
|
|
11348
|
+
case 'email':
|
|
11349
|
+
errorMessage = formValidationMessages.email.required;
|
|
11350
|
+
break;
|
|
11351
|
+
|
|
11352
|
+
default:
|
|
11353
|
+
errorMessage = formValidationMessages.requiredFieldMessage;
|
|
11354
|
+
}
|
|
11355
|
+
} else if (field === 'email' && !regex.signInEmail.test(value)) {
|
|
11356
|
+
errorMessage = formValidationMessages.email.invalid;
|
|
11357
|
+
} else if (field === 'firstName' && !regex.firstName.test(value)) {
|
|
11358
|
+
errorMessage = formValidationMessages.firstName.invalid;
|
|
11359
|
+
}
|
|
11360
|
+
|
|
11361
|
+
return errorMessage;
|
|
11362
|
+
};
|
|
11363
|
+
|
|
11364
|
+
var themeToColor = function themeToColor(theme) {
|
|
11365
|
+
switch (theme) {
|
|
11366
|
+
case exports.ThemeType.Core:
|
|
11367
|
+
return exports.Colors.Core;
|
|
11368
|
+
|
|
11369
|
+
case exports.ThemeType.Stream:
|
|
11370
|
+
return exports.Colors.Stream;
|
|
11371
|
+
|
|
11372
|
+
case exports.ThemeType.Cinema:
|
|
11373
|
+
return exports.Colors.Cinema;
|
|
11374
|
+
|
|
11375
|
+
default:
|
|
11376
|
+
return exports.Colors.Core;
|
|
11377
|
+
}
|
|
11378
|
+
};
|
|
11282
11379
|
|
|
11283
11380
|
var SignUpForm = function SignUpForm(_ref) {
|
|
11284
11381
|
var initialState = _ref.initialState,
|
|
@@ -11323,6 +11420,21 @@ var SignUpForm = function SignUpForm(_ref) {
|
|
|
11323
11420
|
};
|
|
11324
11421
|
};
|
|
11325
11422
|
|
|
11423
|
+
var handleBlur = function handleBlur(field) {
|
|
11424
|
+
return function () {
|
|
11425
|
+
var value = formValues[field];
|
|
11426
|
+
var formErrorMessage = getFormErrorMessage(field, value);
|
|
11427
|
+
|
|
11428
|
+
if (formErrorMessage) {
|
|
11429
|
+
setErrors(function (prev) {
|
|
11430
|
+
var _extends4;
|
|
11431
|
+
|
|
11432
|
+
return _extends({}, prev, (_extends4 = {}, _extends4[field] = formErrorMessage, _extends4));
|
|
11433
|
+
});
|
|
11434
|
+
}
|
|
11435
|
+
};
|
|
11436
|
+
};
|
|
11437
|
+
|
|
11326
11438
|
var handleFormSubmit = /*#__PURE__*/function () {
|
|
11327
11439
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(e) {
|
|
11328
11440
|
var formErrors, response;
|
|
@@ -11344,13 +11456,13 @@ var SignUpForm = function SignUpForm(_ref) {
|
|
|
11344
11456
|
|
|
11345
11457
|
if (!isLoggedIn) {
|
|
11346
11458
|
if (!formValues.firstName) {
|
|
11347
|
-
formErrors.firstName = formValidationMessages.
|
|
11459
|
+
formErrors.firstName = formValidationMessages.firstName.required;
|
|
11348
11460
|
} else if (!regex.firstName.test(formValues.firstName)) {
|
|
11349
11461
|
formErrors.firstName = formValidationMessages.firstName.invalid;
|
|
11350
11462
|
}
|
|
11351
11463
|
|
|
11352
11464
|
if (!formValues.lastName) {
|
|
11353
|
-
formErrors.lastName = formValidationMessages.
|
|
11465
|
+
formErrors.lastName = formValidationMessages.lastName.required;
|
|
11354
11466
|
}
|
|
11355
11467
|
|
|
11356
11468
|
if (!formValues.email) {
|
|
@@ -11399,7 +11511,7 @@ var SignUpForm = function SignUpForm(_ref) {
|
|
|
11399
11511
|
}();
|
|
11400
11512
|
|
|
11401
11513
|
return /*#__PURE__*/React__default.createElement(Wrapper$8, {
|
|
11402
|
-
theme:
|
|
11514
|
+
theme: themeToColor(theme)
|
|
11403
11515
|
}, /*#__PURE__*/React__default.createElement(SignUpFormWrapper, null, /*#__PURE__*/React__default.createElement(GridItem, {
|
|
11404
11516
|
columnStartDesktop: 3,
|
|
11405
11517
|
columnSpanDesktop: 10,
|
|
@@ -11434,6 +11546,10 @@ var SignUpForm = function SignUpForm(_ref) {
|
|
|
11434
11546
|
maxLength: 20,
|
|
11435
11547
|
error: errors.firstName,
|
|
11436
11548
|
onChange: handleChange('firstName'),
|
|
11549
|
+
onBlur: handleBlur('firstName'),
|
|
11550
|
+
"aria-required": "true",
|
|
11551
|
+
"aria-invalid": !!errors.firstName,
|
|
11552
|
+
"aria-describedby": errors.firstName ? 'firstName-error' : undefined,
|
|
11437
11553
|
autoComplete: "given-name"
|
|
11438
11554
|
}), /*#__PURE__*/React__default.createElement(TextField, {
|
|
11439
11555
|
label: "Last name",
|
|
@@ -11443,6 +11559,10 @@ var SignUpForm = function SignUpForm(_ref) {
|
|
|
11443
11559
|
value: formValues.lastName,
|
|
11444
11560
|
error: errors.lastName,
|
|
11445
11561
|
onChange: handleChange('lastName'),
|
|
11562
|
+
onBlur: handleBlur('lastName'),
|
|
11563
|
+
"aria-required": "true",
|
|
11564
|
+
"aria-invalid": !!errors.lastName,
|
|
11565
|
+
"aria-describedby": errors.lastName ? 'lastName-error' : undefined,
|
|
11446
11566
|
autoComplete: "family-name"
|
|
11447
11567
|
}), /*#__PURE__*/React__default.createElement(TextField, {
|
|
11448
11568
|
label: "Email",
|
|
@@ -11451,24 +11571,29 @@ var SignUpForm = function SignUpForm(_ref) {
|
|
|
11451
11571
|
value: formValues.email,
|
|
11452
11572
|
error: errors.email || errors.serverError,
|
|
11453
11573
|
onChange: handleChange('email'),
|
|
11574
|
+
onBlur: handleBlur('email'),
|
|
11575
|
+
"aria-required": "true",
|
|
11576
|
+
"aria-invalid": !!errors.email,
|
|
11577
|
+
"aria-describedby": errors.email ? 'email-error' : undefined,
|
|
11454
11578
|
maxLength: 80
|
|
11455
11579
|
})), isLoggedIn && !!errors.serverError && /*#__PURE__*/React__default.createElement(GridItem, {
|
|
11456
11580
|
columnStartDesktop: 2,
|
|
11457
11581
|
columnSpanDesktop: 12,
|
|
11458
|
-
columnStartTablet: 2,
|
|
11459
|
-
columnSpanTablet: 12,
|
|
11460
11582
|
columnStartDevice: 2,
|
|
11461
11583
|
columnSpanDevice: 12
|
|
11462
|
-
}, /*#__PURE__*/React__default.createElement(ServerError,
|
|
11584
|
+
}, /*#__PURE__*/React__default.createElement(ServerError, {
|
|
11585
|
+
role: "alert",
|
|
11586
|
+
"aria-live": "assertive"
|
|
11587
|
+
}, /*#__PURE__*/React__default.createElement(AltHeader, {
|
|
11463
11588
|
level: 6
|
|
11464
11589
|
}, errors.serverError))), /*#__PURE__*/React__default.createElement(FormFooterWrapper, null, /*#__PURE__*/React__default.createElement(ButtonWrapper$3, {
|
|
11465
11590
|
type: "submit"
|
|
11466
11591
|
}, /*#__PURE__*/React__default.createElement(PrimaryButton, {
|
|
11467
|
-
bgColor:
|
|
11592
|
+
bgColor: themeToColor(theme)
|
|
11468
11593
|
}, "Sign up")), /*#__PURE__*/React__default.createElement(CTALinkWrapper, {
|
|
11469
11594
|
href: ctaPrivacy.link
|
|
11470
11595
|
}, /*#__PURE__*/React__default.createElement(BodyText, {
|
|
11471
|
-
level:
|
|
11596
|
+
level: 1
|
|
11472
11597
|
}, ctaPrivacy.text)))))));
|
|
11473
11598
|
};
|
|
11474
11599
|
|