@royaloperahouse/chord 2.11.2 → 2.11.3-dev

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.
Files changed (28) hide show
  1. package/README.md +255 -40
  2. package/dist/chord.cjs.development.js +406 -156
  3. package/dist/chord.cjs.development.js.map +1 -1
  4. package/dist/chord.cjs.production.min.js +1 -1
  5. package/dist/chord.cjs.production.min.js.map +1 -1
  6. package/dist/chord.esm.js +406 -156
  7. package/dist/chord.esm.js.map +1 -1
  8. package/dist/components/atoms/AriaAlternativeDescription/AriaAlternative.d.ts +5 -0
  9. package/dist/components/atoms/AriaAlternativeDescription/AriaAlternative.style.d.ts +3 -0
  10. package/dist/components/atoms/AriaAlternativeDescription/index.d.ts +2 -0
  11. package/dist/components/atoms/Grid/GridItemLegacy.d.ts +8 -0
  12. package/dist/components/atoms/Grid/index.d.ts +2 -1
  13. package/dist/components/atoms/Icons/SvgIcons/Payment/ApplePay.svg.d.ts +4 -0
  14. package/dist/components/atoms/Icons/SvgIcons/Payment/GooglePay.svg.d.ts +4 -0
  15. package/dist/components/atoms/Icons/SvgIcons/Payment/PayPal.svg.d.ts +4 -0
  16. package/dist/components/atoms/Icons/SvgIcons/index.d.ts +3 -0
  17. package/dist/components/atoms/index.d.ts +2 -2
  18. package/dist/components/molecules/Accordion/Accordion.style.d.ts +3 -1
  19. package/dist/components/molecules/PageHeading/index.d.ts +1 -1
  20. package/dist/components/molecules/PeopleListing/CreditListing/CreditListing.style.d.ts +1 -0
  21. package/dist/components/molecules/Table/Table.style.d.ts +1 -1
  22. package/dist/components/molecules/index.d.ts +1 -1
  23. package/dist/types/ariaAlternative.d.ts +34 -0
  24. package/dist/types/formTypes.d.ts +12 -9
  25. package/dist/types/iconTypes.d.ts +2 -0
  26. package/dist/types/types.d.ts +4 -0
  27. package/package.json +2 -2
  28. package/README.GIT +0 -282
@@ -0,0 +1,5 @@
1
+ import { FunctionComponent } from 'react';
2
+ import { IAriaAlternativeProps, IAriaHideProps } from '../../../types/ariaAlternative';
3
+ /** A temporary screen-reader accessibility workaround for components with issues that can't be resolved quickly. Allows us to use aria-hidden on components with stuctural HTML markup issues until they can be rebuilt to be screen-reader compatible, or on components whose data does not translate well to screen-reader users. **/
4
+ export declare const AriaHide: FunctionComponent<IAriaHideProps>;
5
+ export declare const AriaAlternative: FunctionComponent<IAriaAlternativeProps>;
@@ -0,0 +1,3 @@
1
+ import { IAriaHideProps } from '../../../types/ariaAlternative';
2
+ export declare const AriaAlternativeDescription: import("styled-components").StyledComponent<"a", any, {}, never>;
3
+ export declare const AriaHideOnDevice: import("styled-components").StyledComponent<"div", any, IAriaHideProps, never>;
@@ -0,0 +1,2 @@
1
+ import { AriaAlternative, AriaHide } from './AriaAlternative';
2
+ export { AriaAlternative, AriaHide };
@@ -0,0 +1,8 @@
1
+ import { IGridItemProps } from '../../../types/types';
2
+ /**
3
+ * # IMPORTANT
4
+ * Please use the `<GridItem />` component instead of this component if possible.
5
+ * This component was introduced due to incompatibilities between versions of the Chord library.
6
+ */
7
+ declare const GridItemLegacy: import("styled-components").StyledComponent<"div", any, IGridItemProps, never>;
8
+ export default GridItemLegacy;
@@ -1,3 +1,4 @@
1
1
  import Grid from './Grid';
2
2
  import GridItem from './GridItem';
3
- export { Grid, GridItem };
3
+ import GridItemLegacy from './GridItemLegacy';
4
+ export { Grid, GridItem, GridItemLegacy };
@@ -0,0 +1,4 @@
1
+ import * as React from 'react';
2
+ import { IconSVGProps } from '../../../../../types/iconTypes';
3
+ declare const _default: ({ ariaLabel }: IconSVGProps) => React.ReactElement;
4
+ export default _default;
@@ -0,0 +1,4 @@
1
+ import * as React from 'react';
2
+ import { IconSVGProps } from '../../../../../types/iconTypes';
3
+ declare const _default: ({ ariaLabel }: IconSVGProps) => React.ReactElement;
4
+ export default _default;
@@ -0,0 +1,4 @@
1
+ import * as React from 'react';
2
+ import { IconSVGProps } from '../../../../../types/iconTypes';
3
+ declare const _default: ({ ariaLabel }: IconSVGProps) => React.ReactElement;
4
+ export default _default;
@@ -1,6 +1,7 @@
1
1
  /// <reference types="react" />
2
2
  export declare const IconLibrary: {
3
3
  AddToMyList: ({ color, ariaLabel }: import("../../../../types/iconTypes").IconSVGProps) => import("react").ReactElement<any, string | ((props: any) => import("react").ReactElement<any, any> | null) | (new (props: any) => import("react").Component<any, any, any>)>;
4
+ ApplePay: ({ ariaLabel }: import("../../../../types/iconTypes").IconSVGProps) => import("react").ReactElement<any, string | ((props: any) => import("react").ReactElement<any, any> | null) | (new (props: any) => import("react").Component<any, any, any>)>;
4
5
  Arrow: ({ color, ariaLabel }: import("../../../../types/iconTypes").IconSVGProps) => import("react").ReactElement<any, string | ((props: any) => import("react").ReactElement<any, any> | null) | (new (props: any) => import("react").Component<any, any, any>)>;
5
6
  AudioDescription: ({ color, ariaLabel }: import("../../../../types/iconTypes").IconSVGProps) => import("react").ReactElement<any, string | ((props: any) => import("react").ReactElement<any, any> | null) | (new (props: any) => import("react").Component<any, any, any>)>;
6
7
  Back10: ({ color, ariaLabel }: import("../../../../types/iconTypes").IconSVGProps) => import("react").ReactElement<any, string | ((props: any) => import("react").ReactElement<any, any> | null) | (new (props: any) => import("react").Component<any, any, any>)>;
@@ -31,6 +32,7 @@ export declare const IconLibrary: {
31
32
  FindAScreening: ({ color, ariaLabel }: import("../../../../types/iconTypes").IconSVGProps) => import("react").ReactElement<any, string | ((props: any) => import("react").ReactElement<any, any> | null) | (new (props: any) => import("react").Component<any, any, any>)>;
32
33
  Forward10: ({ color, ariaLabel }: import("../../../../types/iconTypes").IconSVGProps) => import("react").ReactElement<any, string | ((props: any) => import("react").ReactElement<any, any> | null) | (new (props: any) => import("react").Component<any, any, any>)>;
33
34
  FullScreen: ({ color, ariaLabel }: import("../../../../types/iconTypes").IconSVGProps) => import("react").ReactElement<any, string | ((props: any) => import("react").ReactElement<any, any> | null) | (new (props: any) => import("react").Component<any, any, any>)>;
35
+ GooglePay: ({ ariaLabel }: import("../../../../types/iconTypes").IconSVGProps) => import("react").ReactElement<any, string | ((props: any) => import("react").ReactElement<any, any> | null) | (new (props: any) => import("react").Component<any, any, any>)>;
34
36
  GridView: ({ color, ariaLabel }: import("../../../../types/iconTypes").IconSVGProps) => import("react").ReactElement<any, string | ((props: any) => import("react").ReactElement<any, any> | null) | (new (props: any) => import("react").Component<any, any, any>)>;
35
37
  Home: ({ color, ariaLabel }: import("../../../../types/iconTypes").IconSVGProps) => import("react").ReactElement<any, string | ((props: any) => import("react").ReactElement<any, any> | null) | (new (props: any) => import("react").Component<any, any, any>)>;
36
38
  Info: ({ color, ariaLabel }: import("../../../../types/iconTypes").IconSVGProps) => import("react").ReactElement<any, string | ((props: any) => import("react").ReactElement<any, any> | null) | (new (props: any) => import("react").Component<any, any, any>)>;
@@ -45,6 +47,7 @@ export declare const IconLibrary: {
45
47
  OnMyList: ({ color, ariaLabel }: import("../../../../types/iconTypes").IconSVGProps) => import("react").ReactElement<any, string | ((props: any) => import("react").ReactElement<any, any> | null) | (new (props: any) => import("react").Component<any, any, any>)>;
46
48
  OperaAndMusic: ({ color, ariaLabel }: import("../../../../types/iconTypes").IconSVGProps) => import("react").ReactElement<any, string | ((props: any) => import("react").ReactElement<any, any> | null) | (new (props: any) => import("react").Component<any, any, any>)>;
47
49
  Pause: ({ color, ariaLabel }: import("../../../../types/iconTypes").IconSVGProps) => import("react").ReactElement<any, string | ((props: any) => import("react").ReactElement<any, any> | null) | (new (props: any) => import("react").Component<any, any, any>)>;
50
+ PayPal: ({ ariaLabel }: import("../../../../types/iconTypes").IconSVGProps) => import("react").ReactElement<any, string | ((props: any) => import("react").ReactElement<any, any> | null) | (new (props: any) => import("react").Component<any, any, any>)>;
48
51
  PDF: ({ color, ariaLabel }: import("../../../../types/iconTypes").IconSVGProps) => import("react").ReactElement<any, string | ((props: any) => import("react").ReactElement<any, any> | null) | (new (props: any) => import("react").Component<any, any, any>)>;
49
52
  Phone: ({ color, ariaLabel }: import("../../../../types/iconTypes").IconSVGProps) => import("react").ReactElement<any, string | ((props: any) => import("react").ReactElement<any, any> | null) | (new (props: any) => import("react").Component<any, any, any>)>;
50
53
  Play: ({ color, ariaLabel }: import("../../../../types/iconTypes").IconSVGProps) => import("react").ReactElement<any, string | ((props: any) => import("react").ReactElement<any, any> | null) | (new (props: any) => import("react").Component<any, any, any>)>;
@@ -1,7 +1,7 @@
1
1
  import { CinemaBadge, StreamBadge } from './Badge';
2
2
  import { PrimaryButton, SecondaryButton, TertiaryButton } from './Buttons';
3
3
  import ControlledDropdown from './ControlledDropdown';
4
- import { Grid, GridItem } from './Grid';
4
+ import { Grid, GridItem, GridItemLegacy } from './Grid';
5
5
  import { Icon } from './Icons';
6
6
  import ImageAspectRatioWrapper from './ImageAspectRatioWrapper';
7
7
  import Progress from './Progress';
@@ -26,4 +26,4 @@ import { AltHeader, BodyText, Header, Overline, Subtitle } from './Typography';
26
26
  import VideoControls from './VideoControls';
27
27
  import { Stepper } from './Stepper';
28
28
  import ToggleButton from './ToggleButton/ToggleButton';
29
- export { AltHeader, BodyText, CinemaBadge, ControlledDropdown, Grid, GridItem, Header, Icon, ImageAspectRatioWrapper, Overline, Progress, PrimaryButton, Radio, Radio2, RotatorButtons, SecondaryButton, SecondaryLogo, SectionSplitter, SponsorLogo, Sponsorship, Stepper, StreamBadge, Subtitle, Tab, TabLink, TertiaryButton, TextArea, TextField, TextFieldLegacy, TextLink, TextLogo, Tickbox, Tickbox2, Timer, TypeTags, VideoControls, ToggleButton, };
29
+ export { AltHeader, BodyText, CinemaBadge, ControlledDropdown, Grid, GridItem, GridItemLegacy, Header, Icon, ImageAspectRatioWrapper, Overline, Progress, PrimaryButton, Radio, Radio2, RotatorButtons, SecondaryButton, SecondaryLogo, SectionSplitter, SponsorLogo, Sponsorship, Stepper, StreamBadge, Subtitle, Tab, TabLink, TertiaryButton, TextArea, TextField, TextFieldLegacy, TextLink, TextLogo, Tickbox, Tickbox2, Timer, TypeTags, VideoControls, ToggleButton, };
@@ -3,8 +3,10 @@ export declare const LineContainer: import("styled-components").StyledComponent<
3
3
  export declare const ChildrenContainer: import("styled-components").StyledComponent<"div", any, {
4
4
  isVisible: boolean;
5
5
  }, never>;
6
+ export declare const IconGroup: import("styled-components").StyledComponent<"div", any, {}, never>;
7
+ export declare const DisplayIconWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
8
+ export declare const PrintHideWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
6
9
  export declare const TitleContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
7
10
  export declare const ContentContainer: import("styled-components").StyledComponent<"div", any, {
8
11
  textHeight?: string | undefined;
9
12
  }, never>;
10
- export declare const PrintHideWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
@@ -4,4 +4,4 @@ import PageHeadingImpact from './Impact';
4
4
  import PageHeadingPanel from './Panel';
5
5
  import PageHeadingStream from './Stream';
6
6
  import PageHeadingCompact from './Compact/Compact';
7
- export { PageHeadingCinema, PageHeadingCore, PageHeadingImpact, PageHeadingStream, PageHeadingCompact, PageHeadingPanel, };
7
+ export { PageHeadingCinema, PageHeadingCore, PageHeadingImpact, PageHeadingPanel, PageHeadingStream, PageHeadingCompact, };
@@ -5,3 +5,4 @@ export declare const CreditListingWrapper: import("styled-components").StyledCom
5
5
  export declare const DescriptionWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
6
6
  export declare const RoleWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
7
7
  export declare const CreditWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
8
+ export declare const CreditBodyWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
@@ -16,4 +16,4 @@ export declare const PageNumber: import("styled-components").StyledComponent<"bu
16
16
  }, never>;
17
17
  export declare const Next: import("styled-components").StyledComponent<"span", any, {}, never>;
18
18
  export declare const ScrollButtons: import("styled-components").StyledComponent<"div", any, {}, never>;
19
- export declare const AriaDescription: import("styled-components").StyledComponent<"span", any, {}, never>;
19
+ export declare const AriaDescription: import("styled-components").StyledComponent<"div", any, {}, never>;
@@ -27,8 +27,8 @@ import ImageWithCaption from './ImageWithCaption';
27
27
  import Quote from './Quote';
28
28
  import MiniCard from './MiniCard';
29
29
  import ReadMore from './ReadMore';
30
- import AuxiliaryNav from './AuxiliaryNav';
31
30
  import PasswordStrength from './PasswordStrength';
31
+ import AuxiliaryNav from './AuxiliaryNav';
32
32
  import Table from './Table';
33
33
  import VideoWithControls from './VideoWithControls';
34
34
  import SignUpForm from './SignUpForm';
@@ -0,0 +1,34 @@
1
+ export interface IAriaAlternativeProps {
2
+ /**
3
+ * A temporary screen-reader accessibility workaround for components with issues that can't be resolved quickly.
4
+ * Allows us to use aria-hidden on components with stuctural HTML markup issues until they can be rebuilt to be screen-reader compatible.
5
+ */
6
+ /**
7
+ * Description of the content being communicated by this component.
8
+ */
9
+ description: string;
10
+ /**
11
+ * originalContent - parse in the data from the original component / response object.
12
+ */
13
+ originalContent: Array<{
14
+ key: string;
15
+ value: string;
16
+ }>;
17
+ /**
18
+ * speechValues - input contextual speech values here to build a sentence, e.g. "you have" , "tickets for" , etc.
19
+ */
20
+ speechValues: Array<{
21
+ key: string;
22
+ value: string;
23
+ }>;
24
+ /**
25
+ * Disable this component (for testing purposes).
26
+ */
27
+ disabled?: boolean;
28
+ }
29
+ export interface IAriaHideProps {
30
+ /**
31
+ * Inert - disables all focusable child elements, necessary if using aria-hidden
32
+ */
33
+ inert: boolean;
34
+ }
@@ -265,17 +265,8 @@ export interface IStepperProps {
265
265
  step?: number;
266
266
  /** An error message to be shown below the stepper.
267
267
  *
268
- * Default: `undefined`
269
268
  */
270
269
  error?: string;
271
- /**
272
- * A style prop that allows us to change what colours to
273
- * use for light or dark mode (e.g. text color, border color, etc...)
274
- * based on the background color.
275
- *
276
- * Defaults to `false`.
277
- */
278
- darkMode?: boolean;
279
270
  /**
280
271
  * Set disapled state
281
272
  */
@@ -284,6 +275,18 @@ export interface IStepperProps {
284
275
  * Minimum value allowed in the stepper
285
276
  */
286
277
  min?: number;
278
+ /**
279
+ * A style prop that allows us to change what colours to
280
+ * use for light or dark mode (e.g. text color, border color, etc...)
281
+ * based on the background color.
282
+ *
283
+ * Defaults to `false`.
284
+ * Specify whether or not the containing element has a dark background.
285
+ * This property affects the border colours for focused and error states.
286
+ *
287
+ * Default: `false`
288
+ */
289
+ darkMode?: boolean;
287
290
  /**
288
291
  * Maximum value allowed in the stepper
289
292
  */
@@ -2,9 +2,11 @@ import { Directions } from '../components/atoms/Icons/Icons.style';
2
2
  import { IconLibrary } from '../components/atoms/Icons/SvgIcons';
3
3
  export declare type DirectionType = keyof typeof Directions;
4
4
  export declare type IconNameType = keyof typeof IconLibrary;
5
+ export declare const multicolorIcons: readonly IconNameType[];
5
6
  export interface IIconStyledProps {
6
7
  color?: string;
7
8
  direction?: DirectionType;
9
+ monochrome?: boolean;
8
10
  ariaLabel?: string;
9
11
  }
10
12
  export interface IconSVGProps {
@@ -508,6 +508,10 @@ export interface IAccordionProps {
508
508
  * Set semantic level - not to be used for aesthetic
509
509
  */
510
510
  semanticLevel?: TypographyLevel;
511
+ /**
512
+ * Optional icon to display next to the trigger, e.g. a payment method logo
513
+ */
514
+ icon?: IconNameType;
511
515
  }
512
516
  export interface IAccordionsProps {
513
517
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@royaloperahouse/chord",
3
- "version": "2.11.2",
3
+ "version": "2.11.3-dev",
4
4
  "author": "Royal Opera House",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -23,7 +23,7 @@
23
23
  "storybook": "start-storybook -s ./external -p 6006",
24
24
  "build-storybook-dev": "build-storybook",
25
25
  "build-storybook": "rm -rf ./storybook-static; build-storybook -s ./src -o ./storybook-static; cp -r ./external/ ./storybook-static/",
26
- "deploy-storybook-dev": "chromatic --build-script-name build-storybook-dev",
26
+ "deploy-storybook-dev": "CHROMATIC_PROJECT_TOKEN=2b8c0fada9f2 chromatic --build-script-name build-storybook-dev",
27
27
  "deploy-storybook": "storybook-to-aws-s3 --bucket-path=chord.roh.org.uk --aws-profile=parent --existing-output-dir=storybook-static --s3-sync-options=--acl=public-read",
28
28
  "test-storybook": "tsdx test --json --passWithNoTests --outputFile=./test/jest-test-results.json",
29
29
  "publish-release": "make prepare-release-candidate; make publish-release",
package/README.GIT DELETED
@@ -1,282 +0,0 @@
1
- # Royal Opera House Chord - Front End Design System
2
-
3
- Welcome to The Royal Opera House Front End Design System, `@royaloperahouse/chord`
4
-
5
- This package is a library of UI components intended to be used in the ROH website.
6
-
7
- It uses React, TypeScript, TSDX and Storybook.
8
-
9
- The NPM packages are published at [https://www.npmjs.com/package/@royaloperahouse/chord](https://www.npmjs.com/package/@royaloperahouse/chord)
10
-
11
- The Storybook for the latest version of the library is hosted at [chord.roh.org.uk](chord.roh.org.uk)
12
-
13
-
14
- ## Prerequisites
15
- ---
16
-
17
- * Use a node version of 16 at the highest to run the storybook locally
18
-
19
- * Make sure the required package dependencies are installed using `yarn install`
20
-
21
- * If this is the first time you are working on Chord, make sure to run `yarn build` to build all the modules.
22
-
23
- * **To deploy the storybook publicly** you will need credentials for the **parent** 'Royal Opera House' AWS account in your `~/.aws/credentials` file.
24
- * The deploy script expects these to be called `[parent]`.
25
-
26
- * You can find these values at:
27
-
28
- *AWS 'Your Applications' page -> 'Royal Opera House' -> 'Developer Access' -> 'Command line or programmatic access'*
29
-
30
- * **To deploy a preview** for demo / QA you will need the `CHROMATIC_PROJECT_TOKEN` -- find this in 1Password
31
-
32
-
33
- * **To publish the NPM package** you will need the ROH `NPM_TOKEN` -- find this in 1Password
34
-
35
-
36
- ## Versioning
37
- ---
38
-
39
- We use [Semantic Versioning](https://semver.org/) for Chord.
40
-
41
- Given a version number MAJOR.MINOR.PATCH, increment the:
42
-
43
- * MAJOR version when you make incompatible library changes
44
- * MINOR version when you add functionality in a backwards compatible manner
45
- * PATCH version when you make backwards compatible bug fixes
46
-
47
- When you create a new release always update the `CHANGELOG` and `package.json`
48
-
49
- Increment your version from the latest stable version on `main`
50
-
51
-
52
- ## Deploying the Storybook
53
- ---
54
-
55
- ### **1. To build and deploy locally**
56
-
57
- You can quickly build and serve the contents of `/storybook-static` from your local machine, for development and manual testing. To do this run:
58
-
59
- ```bash
60
- yarn storybook
61
- ```
62
- Try to use this script if you have issues running it locally
63
- ```bash
64
- NODE_OPTIONS=--openssl-legacy-provider yarn storybook
65
- ```
66
-
67
- By default the storybook will be accessible at
68
- [http://localhost:6006/](http://localhost:6006/)
69
-
70
- The server will hot-reload on most changes.
71
-
72
- ### **2. To deploy a preview version remotely**
73
-
74
- You can deploy a release candidate, or work-in-progress to [Chromatic](https://www.chromatic.com/) for showcase or QA.
75
-
76
- **NOTE:** you will need the `CHROMATIC_PROJECT_TOKEN` as described in *Prerequisites* above.
77
-
78
- Either set the token as a shell variable or use a `.env` file in the chord root directory containing the token, as so:
79
-
80
- ```
81
- CHROMATIC_PROJECT_TOKEN=tokengoeshere
82
- ```
83
-
84
- Run:
85
-
86
- ```
87
- yarn deploy-storybook-dev
88
- ```
89
-
90
- to build and deploy the storybook from your repo to Chromatic.
91
-
92
- You will find the address of your deployed storybook in the console output, looking something like this:
93
-
94
- `→ View your Storybook at https://randomHexString-randomAlphabeticalString.chromatic.com`
95
-
96
- ### **3. To deploy a release version**
97
-
98
- You can deploy the contents of `./storybook-static` to S3 as a static site, which is permanently accessible at [chord.roh.org.uk](chord.roh.org.uk)
99
-
100
- **NOTE:** To do this you will need the correct `AWS` credentials set up, as described in *Prerequisites* above.
101
-
102
- First build the storybook using:
103
-
104
- ```
105
- yarn build-storybook
106
- ```
107
-
108
- then run:
109
-
110
- ```bash
111
- yarn deploy-storybook
112
- ```
113
-
114
- > **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*.
115
-
116
-
117
- ## Releasing a New Package Version
118
- ---
119
-
120
- This is the procedure for releasing a new Chord NPM package.
121
-
122
- There are two types of package:
123
-
124
- A **snapshot** can be published to use a development version of the Chord library in our frontend staging environments, to perform integrated, manual testing.
125
-
126
- A **stable** package is published for use in production.
127
-
128
- **NOTE:** You will need the `NPM_TOKEN`, as described in 'Prerequisites' above.
129
-
130
- ### **1. To release a snapshot version**
131
-
132
- > **IMPORTANT:** Make sure you always publish your **snapshots** from `development` after merging in your feature branch.
133
-
134
- 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.
135
-
136
- 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`
137
-
138
- To publish a snapshot use:
139
-
140
- ```bash
141
- NPM_ROH_TOKEN={NPM_TOKEN} RELEASE_VERSION={RELEASE_VERSION} yarn publish-snapshot
142
- ```
143
-
144
- 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.
145
-
146
- ### **2. To release a stable version**
147
-
148
- > **IMPORTANT:** Make sure you always publish your **stable** packages from `main` after merging in your feature branch.
149
-
150
- 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`!)
151
-
152
- To publish a stable package use:
153
-
154
- ```bash
155
- NPM_ROH_TOKEN={NPM_TOKEN} RELEASE_VERSION={RELEASE_VERSION} yarn publish-release
156
- ```
157
-
158
-
159
- ## Using the Package
160
- ---
161
-
162
- The package is deployed to NPM, and can be installed using yarn or npm:
163
-
164
- ```bash
165
- npm i --save @royaloperahouse/chord
166
- ```
167
- ```bash
168
- yarn add @royaloperahouse/chord
169
- ```
170
-
171
-
172
- ## Testing
173
- ---
174
-
175
- To **Lint** the package use:
176
-
177
- ```bash
178
- yarn lint
179
- # Use the --fix option to perform automatic fixes
180
- ```
181
-
182
- To run the **unit tests** (using Jest) use:
183
-
184
- ```bash
185
- yarn test
186
-
187
- # Use the -u option to update snapshots if needed
188
- # Run `yarn test:watch` to re-run tests on changes
189
- ```
190
-
191
- To **run and and store the unit tests** for display in storybook use:
192
-
193
- ```bash
194
- yarn test-storybook
195
- # Use the -u option to update snapshots if needed
196
- ```
197
-
198
-
199
- ## Development Process
200
- ---
201
-
202
- ### **1. Branching Model**
203
- * The Chord project source can be found at [https://bitbucket.org/rohorguk/harmonic-library](https://bitbucket.org/rohorguk/harmonic-library) in the `chord` directory
204
- * The Chord **development** branch is currently `development`
205
- * The Chord **main** branch is currently `main`
206
- * 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`
207
- * Always create your feature branch FROM, and submit pull requests TO, the **main** branch
208
- * 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
209
- * For releasing an **NPM snapshot**: merge your feature branch into the **development** branch and publish the NPM snapshot from there
210
-
211
- ### **2. Detailed Workflow**
212
-
213
- #### **Before review:**
214
-
215
- * Git pull the latest version of `main`
216
- * Checkout a new, correctly-named feature branch from `main`
217
- * Do your work on this feature branch
218
- * Run: `yarn lint`
219
- * Run: `yarn test`
220
- * Commit your changes
221
- * Create a pull request from your feature branch to `main`
222
- * Add the appropriate reviewers
223
-
224
- #### **Before QA / UAT:**
225
-
226
- After your PR is approved, you have two options:
227
-
228
- **i.** For QA of a component in isolation:
229
-
230
- * Follow the steps above in *Deploying the Storybook -> 2. Deploying a preview version remotely*
231
- * Share the generated Chromatic URL with the appropriate people for QA / UAT
232
-
233
- **ii.** For integrated testing of a component in the frontend staging environments:
234
-
235
- * Check out the `development` branch
236
- * Merge your work in to `development`
237
- * Follow the steps above under *Publishing a New Package Version -> 1. To release a snapshot version*
238
- * Git push the updated `development` branch to remote
239
- * Finally, in the frontend repo:
240
-
241
- 1. Update the `package.json` to reference the new snapshot version
242
- 2. Run: `yarn install`
243
- 3. Deploy the frontend to a staging environment
244
-
245
- #### **When ready for production:**
246
-
247
- * Return to your chord **feature branch**
248
- * 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
249
- * Update `CHANGELOG.md`, adding the new version number and a short description of your changes
250
- * Run: `yarn lint`
251
- * Run: `yarn test`
252
- * Run: `yarn test-storybook -u`
253
- * Run: `yarn build-storybook`
254
- * Git commit, push, and update your PR for final approval
255
- * Merge your approved PR to `main`
256
- * Follow the steps in *Publishing a New Package Version -> 2. To release a stable version* to publish the NPM package
257
- * Finally, follow the steps in *Deploying The Storybook -> 3. To deploy a release version*, to update the public Chord Storybook page
258
-
259
- Once you have successfully published a new release version, you can open a ticket to update to this version in any of the frontend repos.
260
-
261
-
262
- ## Notes
263
- ---
264
- ### The `storybook-static` folder
265
-
266
- This folder contains all the HTML / JS required to deploy the Storybook as a static site. It's autogenerated whenever the Storybook is built and therefore will show up a lot of merge conflicts when you merge other branches into your feature branch. It is best to leave generating the storybook until the later part of your workflow, but in case you run into conflicts earlier, it's ok to just delete the folder and regenerate using:
267
-
268
- ```bash
269
- yarn build-storybook
270
- ```
271
-
272
- For the same reason changes to this folder will cause a lot of big diffs, when looking at a PR, but can mostly be skimmed over unless something looks unusual.
273
-
274
- ---
275
- ### Examples
276
-
277
- There is an example implementation in the example folder. Alternatively there are also integration examples in storybook. Make sure to keep these updated so as to showcase the current components available.
278
-
279
- ---
280
- ### Bundle analysis
281
-
282
- Calculate the real cost of your library using [size-limit](https://github.com/ai/size-limit) with `yarn size` and visualize it with `yarn analyze`.