@royaloperahouse/chord 2.2.4 → 2.2.5-b-select-test
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 +250 -40
- package/dist/chord.cjs.development.js +197 -526
- 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 +196 -527
- package/dist/chord.esm.js.map +1 -1
- package/dist/components/index.d.ts +2 -2
- package/dist/components/molecules/Select/Select.d.ts +1 -97
- package/dist/components/molecules/Select/Select.style.d.ts +4 -13
- package/dist/components/molecules/StatusBanner/StatusBanner.d.ts +4 -0
- package/dist/components/molecules/StatusBanner/StatusBanner.style.d.ts +3 -0
- package/dist/components/molecules/StatusBanner/index.d.ts +2 -0
- package/dist/components/molecules/index.d.ts +2 -1
- package/dist/index.d.ts +2 -2
- package/dist/types/formTypes.d.ts +19 -28
- package/dist/types/types.d.ts +10 -0
- package/package.json +3 -2
- package/README.GIT +0 -277
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AltHeader, BodyText, CinemaBadge, ControlledDropdown, Grid, GridItem, Header, Icon, ImageAspectRatioWrapper, Overline, PrimaryButton, Progress, Radio, RotatorButtons, SecondaryButton, SecondaryLogo, TertiaryButton, SectionSplitter, Sponsorship, Stepper, StreamBadge, Subtitle, Tab, TabLink, TextLogo, TextArea, TextField, TextLink, Tickbox, Timer, TypeTags, VideoControls } from './atoms';
|
|
2
2
|
import { AnchorTabBar, Footer, LiveChat, Navigation, StickyBar, TitleWithCTA, UpsellSection } from './organisms';
|
|
3
|
-
import { Accordion, Accordions, AnnouncementBanner, AuxiliaryNav, Card, Cards, ContactCard, ContentSummary, CreditListing, Editorial, ImageWithCaption, Information, PageHeadingCinema, PageHeadingCompact, PageHeadingCore, PageHeadingImpact, PageHeadingPanel, PageHeadingStream, PasswordStrength, Pagination, PeopleListing, PromoWithTags, PromoWithTitle, RadioGroup, ReadMore, SearchBar, SectionTitle, Select, Tabs, TextOnly, UpsellCard, Quote } from './molecules';
|
|
3
|
+
import { Accordion, Accordions, AnnouncementBanner, AuxiliaryNav, Card, Cards, ContactCard, ContentSummary, CreditListing, Editorial, ImageWithCaption, Information, PageHeadingCinema, PageHeadingCompact, PageHeadingCore, PageHeadingImpact, PageHeadingPanel, PageHeadingStream, PasswordStrength, Pagination, PeopleListing, PromoWithTags, PromoWithTitle, RadioGroup, ReadMore, StatusBanner, SearchBar, SectionTitle, Select, Tabs, TextOnly, UpsellCard, Quote } from './molecules';
|
|
4
4
|
import ThemeProvider from '../styles/ThemeProvider';
|
|
5
5
|
import GlobalStyles from '../styles/GlobalStyles';
|
|
6
|
-
export { Accordion, Accordions, AnnouncementBanner, AltHeader, AnchorTabBar, AuxiliaryNav, BodyText, Card, Cards, ContactCard, ContentSummary, CinemaBadge, ControlledDropdown, CreditListing, Editorial, Footer, GlobalStyles, Grid, GridItem, Header, Icon, ImageAspectRatioWrapper, ImageWithCaption, Information, Navigation, Overline, PageHeadingCinema, PageHeadingCompact, PageHeadingCore, PageHeadingImpact, PageHeadingPanel, PageHeadingStream, Pagination, PasswordStrength, PeopleListing, PrimaryButton, Progress, PromoWithTags, PromoWithTitle, Radio, RadioGroup, ReadMore, RotatorButtons, SecondaryButton, SecondaryLogo, SearchBar, SectionTitle, Select, Sponsorship, Stepper, StickyBar, StreamBadge, Subtitle, TertiaryButton, TextOnly, ThemeProvider, TitleWithCTA, SectionSplitter, Tab, TabLink, Tabs, TextArea, TextField, TextLink, TextLogo, Tickbox, Timer, TypeTags, UpsellCard, UpsellSection, Quote, LiveChat, VideoControls, };
|
|
6
|
+
export { Accordion, Accordions, AnnouncementBanner, AltHeader, AnchorTabBar, AuxiliaryNav, BodyText, Card, Cards, ContactCard, ContentSummary, CinemaBadge, ControlledDropdown, CreditListing, Editorial, Footer, GlobalStyles, Grid, GridItem, Header, Icon, ImageAspectRatioWrapper, ImageWithCaption, Information, Navigation, Overline, PageHeadingCinema, PageHeadingCompact, PageHeadingCore, PageHeadingImpact, PageHeadingPanel, PageHeadingStream, Pagination, PasswordStrength, PeopleListing, PrimaryButton, Progress, PromoWithTags, PromoWithTitle, Radio, RadioGroup, ReadMore, RotatorButtons, SecondaryButton, SecondaryLogo, StatusBanner, SearchBar, SectionTitle, Select, Sponsorship, Stepper, StickyBar, StreamBadge, Subtitle, TertiaryButton, TextOnly, ThemeProvider, TitleWithCTA, SectionSplitter, Tab, TabLink, Tabs, TextArea, TextField, TextLink, TextLogo, Tickbox, Timer, TypeTags, UpsellCard, UpsellSection, Quote, LiveChat, VideoControls, };
|
|
@@ -1,99 +1,3 @@
|
|
|
1
1
|
import { ISelectProps } from '../../../types/formTypes';
|
|
2
|
-
|
|
3
|
-
* A select component, created using <ul> and <li> elements, with bespoke accessibility
|
|
4
|
-
* logic.
|
|
5
|
-
*
|
|
6
|
-
* # Usage
|
|
7
|
-
* ## Defining a component that uses a typical Select element
|
|
8
|
-
* ```tsx
|
|
9
|
-
* const MyComponent = () => {
|
|
10
|
-
* const handleSelect = (value: number, text: string) => {
|
|
11
|
-
* console.log("Selected", value);
|
|
12
|
-
* };
|
|
13
|
-
*
|
|
14
|
-
* return <>
|
|
15
|
-
* <Select
|
|
16
|
-
* label="This is a label"
|
|
17
|
-
* options={[
|
|
18
|
-
* { text: "Option 1", value: 1 },
|
|
19
|
-
* { text: "Option 2", value: 2 },
|
|
20
|
-
* ]}
|
|
21
|
-
* onSelect={handleSelect}
|
|
22
|
-
* />
|
|
23
|
-
* </>
|
|
24
|
-
* }
|
|
25
|
-
* ```
|
|
26
|
-
*
|
|
27
|
-
* ## Defining a component that uses a disabled Select element
|
|
28
|
-
* ```tsx
|
|
29
|
-
* const MyComponent = () => {
|
|
30
|
-
* const handleSelect = (value: number, text: string) => {
|
|
31
|
-
* console.log("Selected", value);
|
|
32
|
-
* };
|
|
33
|
-
*
|
|
34
|
-
* return <>
|
|
35
|
-
* <Select
|
|
36
|
-
* disabled // Select component disabled explicitely
|
|
37
|
-
* label="This is a label"
|
|
38
|
-
* options={[
|
|
39
|
-
* { text: "Option 1", value: 1 },
|
|
40
|
-
* { text: "Option 2", value: 2 },
|
|
41
|
-
* ]}
|
|
42
|
-
* onSelect={handleSelect}
|
|
43
|
-
* />
|
|
44
|
-
* <Select
|
|
45
|
-
* label="This is a label"
|
|
46
|
-
* options={[]} // Select component disabled implicitely by passing an empty array of options
|
|
47
|
-
* onSelect={handleSelect}
|
|
48
|
-
* />
|
|
49
|
-
* </>
|
|
50
|
-
* }
|
|
51
|
-
* ```
|
|
52
|
-
*
|
|
53
|
-
* ## Defining a component with a non-labelled Select element
|
|
54
|
-
* ```tsx
|
|
55
|
-
* const MyComponent = () => {
|
|
56
|
-
* const handleSelect = (value: number, text: string) => {
|
|
57
|
-
* console.log("Selected", value);
|
|
58
|
-
* };
|
|
59
|
-
*
|
|
60
|
-
* return <>
|
|
61
|
-
* <Select
|
|
62
|
-
* label=""
|
|
63
|
-
* options={[
|
|
64
|
-
* { text: "Option 1", value: 1 },
|
|
65
|
-
* { text: "Option 2", value: 2 },
|
|
66
|
-
* ]}
|
|
67
|
-
* onSelect={handleSelect}
|
|
68
|
-
* />
|
|
69
|
-
* </>
|
|
70
|
-
* }
|
|
71
|
-
* ```
|
|
72
|
-
*
|
|
73
|
-
* ## Changing the dimensions of a Select element (px)
|
|
74
|
-
* ```tsx
|
|
75
|
-
* const MyComponent = () => {
|
|
76
|
-
* const handleSelect = (value: number, text: string) => {
|
|
77
|
-
* console.log("Selected", value);
|
|
78
|
-
* };
|
|
79
|
-
*
|
|
80
|
-
* const selectWidthPx = 100;
|
|
81
|
-
* const selectHeightPx = 27;
|
|
82
|
-
*
|
|
83
|
-
* return <>
|
|
84
|
-
* <Select
|
|
85
|
-
* label="This is a label"
|
|
86
|
-
* options={[
|
|
87
|
-
* { text: "Option 1", value: 1 },
|
|
88
|
-
* { text: "Option 2", value: 2 },
|
|
89
|
-
* ]}
|
|
90
|
-
* onSelect={handleSelect}
|
|
91
|
-
* width={selectWidthPx}
|
|
92
|
-
* height={selectHeightPx}
|
|
93
|
-
* />
|
|
94
|
-
* </>
|
|
95
|
-
* }
|
|
96
|
-
* ```
|
|
97
|
-
*/
|
|
98
|
-
declare function Select<T>({ label, options, onSelect, disabled, resetWhenOptionsUpdate, width, height, }: ISelectProps<T>): JSX.Element;
|
|
2
|
+
declare function Select({ label, darkMode, width, error, isSearchable, ...selectProps }: ISelectProps): JSX.Element;
|
|
99
3
|
export default Select;
|
|
@@ -1,14 +1,5 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { ISelectProps } from '../../../types/formTypes';
|
|
3
|
-
export declare const
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}, "title" | "color" | "iconName">;
|
|
8
|
-
export declare const Wrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
9
|
-
export declare const SelectWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
10
|
-
export declare const Options: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
11
|
-
export declare const Option: import("styled-components").StyledComponent<"li", any, {
|
|
12
|
-
hover: boolean;
|
|
13
|
-
}, never>;
|
|
14
|
-
export declare const SelectList: import("styled-components").StyledComponent<"ul", any, Pick<Required<ISelectProps<unknown>>, "height" | "width">, never>;
|
|
2
|
+
export declare const Container: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
3
|
+
export declare const SelectWrapper: import("styled-components").StyledComponent<"div", any, Pick<ISelectProps, "width" | "darkMode" | "error">, never>;
|
|
4
|
+
export declare const TextLabel: import("styled-components").StyledComponent<"p", any, Pick<ISelectProps, "darkMode">, never>;
|
|
5
|
+
export declare const ErrorLabel: import("styled-components").StyledComponent<"p", any, Pick<ISelectProps, "darkMode">, never>;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export declare const StatusBannerWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
2
|
+
export declare const ContentContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
3
|
+
export declare const SvgContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
@@ -13,6 +13,7 @@ import { PeopleListing, CreditListing } from './PeopleListing';
|
|
|
13
13
|
import PromoWithTags from './PromoWithTags';
|
|
14
14
|
import PromoWithTitle from './PromoWithTitle';
|
|
15
15
|
import RadioGroup from './RadioGroup';
|
|
16
|
+
import StatusBanner from './StatusBanner';
|
|
16
17
|
import SearchBar from './SearchBar';
|
|
17
18
|
import SectionTitle from './SectionTitle';
|
|
18
19
|
import Select from './Select';
|
|
@@ -25,4 +26,4 @@ import MiniCard from './MiniCard';
|
|
|
25
26
|
import ReadMore from './ReadMore';
|
|
26
27
|
import AuxiliaryNav from './AuxiliaryNav';
|
|
27
28
|
import PasswordStrength from './PasswordStrength';
|
|
28
|
-
export { Accordion, Accordions, AnnouncementBanner, AuxiliaryNav, Card, Cards, ContactCard, ContentSummary, CreditListing, Editorial, ImageWithCaption, Information, MiniCard, PageHeadingCinema, PageHeadingCompact, PageHeadingCore, PageHeadingImpact, PageHeadingPanel, PageHeadingStream, PasswordStrength, Pagination, PeopleListing, PromoWithTags, PromoWithTitle, RadioGroup, ReadMore, Quote, SectionTitle, SearchBar, Select, Tabs, TextOnly, UpsellCard, };
|
|
29
|
+
export { Accordion, Accordions, AnnouncementBanner, AuxiliaryNav, Card, Cards, ContactCard, ContentSummary, CreditListing, Editorial, ImageWithCaption, Information, MiniCard, PageHeadingCinema, PageHeadingCompact, PageHeadingCore, PageHeadingImpact, PageHeadingPanel, PageHeadingStream, PasswordStrength, Pagination, PeopleListing, PromoWithTags, PromoWithTitle, RadioGroup, ReadMore, Quote, StatusBanner, SectionTitle, SearchBar, Select, Tabs, TextOnly, UpsellCard, };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Accordion, Accordions, AnnouncementBanner, AltHeader, AnchorTabBar, AuxiliaryNav, BodyText, Card, Cards, CinemaBadge, ContactCard, ContentSummary, ControlledDropdown, CreditListing, Editorial, Footer, GlobalStyles, Grid, GridItem, Header, Icon, ImageAspectRatioWrapper, ImageWithCaption, Information, LiveChat, Navigation, Overline, PageHeadingCinema, PageHeadingCompact, PageHeadingCore, PageHeadingImpact, PageHeadingPanel, PageHeadingStream, Pagination, PasswordStrength, PeopleListing, PrimaryButton, Progress, PromoWithTags, PromoWithTitle, Radio, RadioGroup, ReadMore, RotatorButtons, SearchBar, SecondaryButton, SecondaryLogo, SectionSplitter, SectionTitle, Select, Sponsorship, StickyBar, Stepper, StreamBadge, Subtitle, TertiaryButton, TextOnly, ThemeProvider, TitleWithCTA, Tab, TabLink, Tabs, TextArea, TextField, TextLink, Tickbox, Timer, TypeTags, UpsellCard, UpsellSection, Quote } from './components';
|
|
1
|
+
import { Accordion, Accordions, AnnouncementBanner, AltHeader, AnchorTabBar, AuxiliaryNav, BodyText, Card, Cards, CinemaBadge, ContactCard, ContentSummary, ControlledDropdown, CreditListing, Editorial, Footer, GlobalStyles, Grid, GridItem, Header, Icon, ImageAspectRatioWrapper, ImageWithCaption, Information, LiveChat, Navigation, Overline, PageHeadingCinema, PageHeadingCompact, PageHeadingCore, PageHeadingImpact, PageHeadingPanel, PageHeadingStream, Pagination, PasswordStrength, PeopleListing, PrimaryButton, Progress, PromoWithTags, PromoWithTitle, Radio, RadioGroup, ReadMore, RotatorButtons, StatusBanner, SearchBar, SecondaryButton, SecondaryLogo, SectionSplitter, SectionTitle, Select, Sponsorship, StickyBar, Stepper, StreamBadge, Subtitle, TertiaryButton, TextOnly, ThemeProvider, TitleWithCTA, Tab, TabLink, Tabs, TextArea, TextField, TextLink, Tickbox, Timer, TypeTags, UpsellCard, UpsellSection, Quote } from './components';
|
|
2
2
|
import { devices, breakpoints } from './styles/viewports';
|
|
3
3
|
import zIndexes from './styles/zIndexes';
|
|
4
4
|
import { AspectRatio, ButtonType, CarouselType, Colors, IconNameType, IntegratedTimerProps, ITimerProps, TickboxMode, ThemeType, EditorialLink } from './types';
|
|
5
5
|
import { MiniCard } from './components/molecules';
|
|
6
6
|
import { ModalWindow } from './components/organisms';
|
|
7
|
-
export { Accordion, Accordions, AnnouncementBanner, AltHeader, AnchorTabBar, AuxiliaryNav, AspectRatio, BodyText, breakpoints, ButtonType, Card, Cards, CarouselType, CinemaBadge, Colors, ContactCard, ContentSummary, ControlledDropdown, CreditListing, devices, Editorial, EditorialLink, Footer, GlobalStyles, Grid, GridItem, Header, Icon, IconNameType, ImageAspectRatioWrapper, ImageWithCaption, Information, ITimerProps, IntegratedTimerProps, LiveChat, MiniCard, ModalWindow, Navigation, Overline, PageHeadingCinema, PageHeadingCompact, PageHeadingCore, PageHeadingImpact, PageHeadingPanel, PageHeadingStream, Pagination, PasswordStrength, PeopleListing, PrimaryButton, Progress, PromoWithTags, PromoWithTitle, Radio, RadioGroup, ReadMore, RotatorButtons, SearchBar, SecondaryButton, SecondaryLogo, SectionSplitter, SectionTitle, Select, Sponsorship, StickyBar, Stepper, StreamBadge, Subtitle, Tab, TabLink, Tabs, TertiaryButton, TextArea, TextField, TextLink, TextOnly, ThemeProvider, ThemeType, TitleWithCTA, Tickbox, TickboxMode, Timer, TypeTags, UpsellCard, UpsellSection, Quote, zIndexes, };
|
|
7
|
+
export { Accordion, Accordions, AnnouncementBanner, AltHeader, AnchorTabBar, AuxiliaryNav, AspectRatio, BodyText, breakpoints, ButtonType, Card, Cards, CarouselType, CinemaBadge, Colors, ContactCard, ContentSummary, ControlledDropdown, CreditListing, devices, Editorial, EditorialLink, Footer, GlobalStyles, Grid, GridItem, Header, Icon, IconNameType, ImageAspectRatioWrapper, ImageWithCaption, Information, ITimerProps, IntegratedTimerProps, LiveChat, MiniCard, ModalWindow, Navigation, Overline, PageHeadingCinema, PageHeadingCompact, PageHeadingCore, PageHeadingImpact, PageHeadingPanel, PageHeadingStream, Pagination, PasswordStrength, PeopleListing, PrimaryButton, Progress, PromoWithTags, PromoWithTitle, Radio, RadioGroup, ReadMore, RotatorButtons, StatusBanner, SearchBar, SecondaryButton, SecondaryLogo, SectionSplitter, SectionTitle, Select, Sponsorship, StickyBar, Stepper, StreamBadge, Subtitle, Tab, TabLink, Tabs, TertiaryButton, TextArea, TextField, TextLink, TextOnly, ThemeProvider, ThemeType, TitleWithCTA, Tickbox, TickboxMode, Timer, TypeTags, UpsellCard, UpsellSection, Quote, zIndexes, };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { InputHTMLAttributes } from 'react';
|
|
2
2
|
import { IGridItemProps } from './types';
|
|
3
|
+
import { Props as SelectProps } from 'react-select';
|
|
3
4
|
export interface ITextAreaProps extends Partial<IGridItemProps>, InputHTMLAttributes<HTMLTextAreaElement> {
|
|
4
5
|
/**
|
|
5
6
|
* A text label to be shown above the text area input box.
|
|
@@ -70,41 +71,31 @@ export interface ITextFieldProps extends InputHTMLAttributes<HTMLInputElement> {
|
|
|
70
71
|
*/
|
|
71
72
|
width?: number;
|
|
72
73
|
}
|
|
73
|
-
export interface
|
|
74
|
-
text: string;
|
|
75
|
-
readonly value: T;
|
|
76
|
-
}
|
|
77
|
-
export interface ISelectProps<T = unknown> {
|
|
78
|
-
/** The text label to be shown above the select component. */
|
|
79
|
-
label: string;
|
|
80
|
-
/**
|
|
81
|
-
* The options of the select component.
|
|
82
|
-
* If not provided OR provided an empty array,
|
|
83
|
-
* the component will be disabled.
|
|
84
|
-
*/
|
|
85
|
-
options: readonly IOption<T>[];
|
|
86
|
-
/**
|
|
87
|
-
* Function to be ran when an option is selected.
|
|
88
|
-
*/
|
|
89
|
-
onSelect: (value: IOption<T>['value'], text: IOption<T>['text']) => void;
|
|
74
|
+
export interface ISelectProps extends SelectProps {
|
|
90
75
|
/**
|
|
91
|
-
*
|
|
76
|
+
* A text label to be shown above the text input field.
|
|
92
77
|
*/
|
|
93
|
-
|
|
78
|
+
label?: string;
|
|
94
79
|
/**
|
|
95
|
-
*
|
|
80
|
+
* An error label to be shown below the text input field.
|
|
81
|
+
* Input will be rendered with a red border if this prop exist.
|
|
82
|
+
* Empty string can be passed to render only error state without
|
|
83
|
+
* error message.
|
|
96
84
|
*/
|
|
97
|
-
|
|
85
|
+
error?: string;
|
|
98
86
|
/**
|
|
99
|
-
*
|
|
87
|
+
* Width in pixels.
|
|
88
|
+
* This will limit the maximum width of input element.
|
|
89
|
+
* By default it will take all available space.
|
|
100
90
|
*/
|
|
101
|
-
|
|
91
|
+
width?: number;
|
|
102
92
|
/**
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
93
|
+
* Specify whether or not the containing element has a dark background.
|
|
94
|
+
* This property affects the border colours for focused and error states.
|
|
95
|
+
*
|
|
96
|
+
* Default: `false`
|
|
97
|
+
*/
|
|
98
|
+
darkMode?: boolean;
|
|
108
99
|
}
|
|
109
100
|
export interface IStepperProps {
|
|
110
101
|
/** The initial value to display in the center of the element */
|
package/dist/types/types.d.ts
CHANGED
|
@@ -531,4 +531,14 @@ export interface IReadMoreProps {
|
|
|
531
531
|
*/
|
|
532
532
|
truncate?: boolean;
|
|
533
533
|
}
|
|
534
|
+
export interface IStatusBannerProps {
|
|
535
|
+
/**
|
|
536
|
+
* Status banner text
|
|
537
|
+
*/
|
|
538
|
+
statusText: string;
|
|
539
|
+
/**
|
|
540
|
+
* Set init visibility
|
|
541
|
+
*/
|
|
542
|
+
visibility: boolean;
|
|
543
|
+
}
|
|
534
544
|
export declare type Image = Pick<HTMLImageElement, 'alt' | 'src'>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@royaloperahouse/chord",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.5-b-select-test",
|
|
4
4
|
"author": "Royal Opera House",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -113,6 +113,7 @@
|
|
|
113
113
|
"dependencies": {
|
|
114
114
|
"moment": "^2.29.4",
|
|
115
115
|
"react-modal": "^3.16.1",
|
|
116
|
-
"react-scrolllock": "^5.0.1"
|
|
116
|
+
"react-scrolllock": "^5.0.1",
|
|
117
|
+
"react-select": "^5.8.0"
|
|
117
118
|
}
|
|
118
119
|
}
|
package/README.GIT
DELETED
|
@@ -1,277 +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
|
-
* Make sure the required package dependencies are installed using `yarn install`
|
|
18
|
-
|
|
19
|
-
* If this is the first time you are working on Chord, make sure to run `yarn build` to build all the modules.
|
|
20
|
-
|
|
21
|
-
* **To deploy the storybook publicly** you will need credentials for the **parent** 'Royal Opera House' AWS account in your `~/.aws/credentials` file.
|
|
22
|
-
* The deploy script expects these to be called `[parent]`.
|
|
23
|
-
|
|
24
|
-
* You can find these values at:
|
|
25
|
-
|
|
26
|
-
*AWS 'Your Applications' page -> 'Royal Opera House' -> 'Developer Access' -> 'Command line or programmatic access'*
|
|
27
|
-
|
|
28
|
-
* **To deploy a preview** for demo / QA you will need the `CHROMATIC_PROJECT_TOKEN` -- find this in 1Password
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
* **To publish the NPM package** you will need the ROH `NPM_TOKEN` -- find this in 1Password
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
## Versioning
|
|
35
|
-
---
|
|
36
|
-
|
|
37
|
-
We use [Semantic Versioning](https://semver.org/) for Chord.
|
|
38
|
-
|
|
39
|
-
Given a version number MAJOR.MINOR.PATCH, increment the:
|
|
40
|
-
|
|
41
|
-
* MAJOR version when you make incompatible library changes
|
|
42
|
-
* MINOR version when you add functionality in a backwards compatible manner
|
|
43
|
-
* PATCH version when you make backwards compatible bug fixes
|
|
44
|
-
|
|
45
|
-
When you create a new release always update the `CHANGELOG` and `package.json`
|
|
46
|
-
|
|
47
|
-
Increment your version from the latest stable version on `chord-releases`
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
## Deploying the Storybook
|
|
51
|
-
---
|
|
52
|
-
|
|
53
|
-
### **1. To build and deploy locally**
|
|
54
|
-
|
|
55
|
-
You can quickly build and serve the contents of `/storybook-static` from your local machine, for development and manual testing. To do this run:
|
|
56
|
-
|
|
57
|
-
```bash
|
|
58
|
-
yarn storybook
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
By default the storybook will be accessible at
|
|
62
|
-
[http://localhost:6006/]()
|
|
63
|
-
|
|
64
|
-
The server will hot-reload on most changes.
|
|
65
|
-
|
|
66
|
-
### **2. To deploy a preview version remotely**
|
|
67
|
-
|
|
68
|
-
You can deploy a release candidate, or work-in-progress to [Chromatic](https://www.chromatic.com/) for showcase or QA.
|
|
69
|
-
|
|
70
|
-
**NOTE:** you will need the `CHROMATIC_PROJECT_TOKEN` as described in *Prerequisites* above.
|
|
71
|
-
|
|
72
|
-
Either set the token as a shell variable or use a `.env` file in the chord root directory containing the token, as so:
|
|
73
|
-
|
|
74
|
-
```
|
|
75
|
-
CHROMATIC_PROJECT_TOKEN=tokengoeshere
|
|
76
|
-
```
|
|
77
|
-
|
|
78
|
-
Run:
|
|
79
|
-
|
|
80
|
-
```
|
|
81
|
-
yarn deploy-storybook-dev
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
to build and deploy the storybook from your repo to Chromatic.
|
|
85
|
-
|
|
86
|
-
You will find the address of your deployed storybook in the console output, looking something like this:
|
|
87
|
-
|
|
88
|
-
`→ View your Storybook at https://randomHexString-randomAlphabeticalString.chromatic.com`
|
|
89
|
-
|
|
90
|
-
### **3. To deploy a release version**
|
|
91
|
-
|
|
92
|
-
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)
|
|
93
|
-
|
|
94
|
-
**NOTE:** To do this you will need the correct `AWS` credentials set up, as described in *Prerequisites* above.
|
|
95
|
-
|
|
96
|
-
First build the storybook using:
|
|
97
|
-
|
|
98
|
-
```
|
|
99
|
-
yarn build-storybook
|
|
100
|
-
```
|
|
101
|
-
|
|
102
|
-
then run:
|
|
103
|
-
|
|
104
|
-
```bash
|
|
105
|
-
yarn deploy-storybook
|
|
106
|
-
```
|
|
107
|
-
|
|
108
|
-
> **IMPORTANT:** This URL is intended to showcase the latest stable version of Chord, it should be kept up to date with the main `chord-releases` 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
|
-
|
|
110
|
-
|
|
111
|
-
## Releasing a New Package Version
|
|
112
|
-
---
|
|
113
|
-
|
|
114
|
-
This is the procedure for releasing a new Chord NPM package.
|
|
115
|
-
|
|
116
|
-
There are two types of package:
|
|
117
|
-
|
|
118
|
-
A **snapshot** can be published to use a development version of the Chord library in our frontend staging environments, to perform integrated, manual testing.
|
|
119
|
-
|
|
120
|
-
A **stable** package is published for use in production.
|
|
121
|
-
|
|
122
|
-
**NOTE:** You will need the `NPM_TOKEN`, as described in 'Prerequisites' above.
|
|
123
|
-
|
|
124
|
-
### **1. To release a snapshot version**
|
|
125
|
-
|
|
126
|
-
> **IMPORTANT:** Make sure you always publish your **snapshots** from `chord-development` after merging in your feature branch.
|
|
127
|
-
|
|
128
|
-
For snapshots, `RELEASE_VERSION` should be the same as the latest **stable** version of the Chord Library, as found in `chord-releases`, followed by an **unused** lowercase letter.
|
|
129
|
-
|
|
130
|
-
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
|
-
|
|
132
|
-
To publish a snapshot use:
|
|
133
|
-
|
|
134
|
-
```bash
|
|
135
|
-
NPM_ROH_TOKEN={NPM_TOKEN} RELEASE_VERSION={RELEASE_VERSION} yarn publish-snapshot
|
|
136
|
-
```
|
|
137
|
-
|
|
138
|
-
The version published to NPM will be named, e.g. `1.42.0-a-chord-development`, use this to install the snapshot package in the frontend repos.
|
|
139
|
-
|
|
140
|
-
### **2. To release a stable version**
|
|
141
|
-
|
|
142
|
-
> **IMPORTANT:** Make sure you always publish your **stable** packages from `chord-releases` after merging in your feature branch.
|
|
143
|
-
|
|
144
|
-
For stable releases, increment your version from the latest **stable** version found on `chord-releases`, 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
|
-
|
|
146
|
-
To publish a stable package use:
|
|
147
|
-
|
|
148
|
-
```bash
|
|
149
|
-
NPM_ROH_TOKEN={NPM_TOKEN} RELEASE_VERSION={RELEASE_VERSION} yarn publish-release
|
|
150
|
-
```
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
## Using the Package
|
|
154
|
-
---
|
|
155
|
-
|
|
156
|
-
The package is deployed to NPM, and can be installed using yarn or npm:
|
|
157
|
-
|
|
158
|
-
```bash
|
|
159
|
-
npm i --save @royaloperahouse/chord
|
|
160
|
-
```
|
|
161
|
-
```bash
|
|
162
|
-
yarn add @royaloperahouse/chord
|
|
163
|
-
```
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
## Testing
|
|
167
|
-
---
|
|
168
|
-
|
|
169
|
-
To **Lint** the package use:
|
|
170
|
-
|
|
171
|
-
```bash
|
|
172
|
-
yarn lint
|
|
173
|
-
# Use the --fix option to perform automatic fixes
|
|
174
|
-
```
|
|
175
|
-
|
|
176
|
-
To run the **unit tests** (using Jest) use:
|
|
177
|
-
|
|
178
|
-
```bash
|
|
179
|
-
yarn test
|
|
180
|
-
|
|
181
|
-
# Use the -u option to update snapshots if needed
|
|
182
|
-
# Run `yarn test:watch` to re-run tests on changes
|
|
183
|
-
```
|
|
184
|
-
|
|
185
|
-
To **run and and store the unit tests** for display in storybook use:
|
|
186
|
-
|
|
187
|
-
```bash
|
|
188
|
-
yarn test-storybook
|
|
189
|
-
# Use the -u option to update snapshots if needed
|
|
190
|
-
```
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
## Development Process
|
|
194
|
-
---
|
|
195
|
-
|
|
196
|
-
### **1. Branching Model**
|
|
197
|
-
* The Chord project lives in the `roh-components` *monorepo*
|
|
198
|
-
* When working on Chord, treat the `roh-components/packages/chord` directory as your root
|
|
199
|
-
* The Chord **development** branch is currently `chord-development`
|
|
200
|
-
* The Chord **main** branch is currently `chord-releases`
|
|
201
|
-
* 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
|
-
* Always create your feature branch FROM, and submit pull requests TO, the **main** branch
|
|
203
|
-
* 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
|
|
204
|
-
* For releasing an **NPM snapshot**: merge your feature branch into the **development** branch and publish the NPM snapshot from there
|
|
205
|
-
|
|
206
|
-
### **2. Detailed Workflow**
|
|
207
|
-
|
|
208
|
-
#### **Before review:**
|
|
209
|
-
|
|
210
|
-
* Git pull the latest version of `chord-releases`
|
|
211
|
-
* Checkout a new, correctly-named feature branch from `chord releases`
|
|
212
|
-
* Do your work on this feature branch
|
|
213
|
-
* Run: `yarn lint`
|
|
214
|
-
* Run: `yarn test`
|
|
215
|
-
* Commit your changes
|
|
216
|
-
* Create a pull request from your feature branch to `chord-releases`
|
|
217
|
-
* Add the appropriate reviewers
|
|
218
|
-
|
|
219
|
-
#### **Before QA / UAT:**
|
|
220
|
-
|
|
221
|
-
After your PR is approved, you have two options:
|
|
222
|
-
|
|
223
|
-
**i.** For QA of a component in isolation:
|
|
224
|
-
|
|
225
|
-
* Follow the steps above in *Deploying the Storybook -> 2. Deploying a preview version remotely*
|
|
226
|
-
* Share the generated Chromatic URL with the appropriate people for QA / UAT
|
|
227
|
-
|
|
228
|
-
**ii.** For integrated testing of a component in the frontend staging environments:
|
|
229
|
-
|
|
230
|
-
* Check out the `chord-development` branch
|
|
231
|
-
* Merge your work in to `chord-development`
|
|
232
|
-
* Follow the steps above under *Publishing a New Package Version -> 1. To release a snapshot version*
|
|
233
|
-
* Git push the updated `chord-development` branch to remote
|
|
234
|
-
* Finally, in the frontend repo:
|
|
235
|
-
|
|
236
|
-
1. Update the `package.json` to reference the new snapshot version
|
|
237
|
-
2. Run: `yarn install`
|
|
238
|
-
3. Deploy the frontend to a staging environment
|
|
239
|
-
|
|
240
|
-
#### **When ready for production:**
|
|
241
|
-
|
|
242
|
-
* Return to your chord **feature branch**
|
|
243
|
-
* Update the chord version in `package.json`, incrementing from the last **stable** release, found in `chord-releases`, and following the rules described in the *Versioning* section
|
|
244
|
-
* Update `CHANGELOG.md`, adding the new version number and a short description of your changes
|
|
245
|
-
* Run: `yarn lint`
|
|
246
|
-
* Run: `yarn test`
|
|
247
|
-
* Run: `yarn test-storybook -u`
|
|
248
|
-
* Run: `yarn build-storybook`
|
|
249
|
-
* Git commit, push, and update your PR for final approval
|
|
250
|
-
* Merge your approved PR to `chord-releases`
|
|
251
|
-
* Follow the steps in *Publishing a New Package Version -> 2. To release a stable version* to publish the NPM package
|
|
252
|
-
* Finally, follow the steps in *Deploying The Storybook -> 3. To deploy a release version*, to update the public Chord Storybook page
|
|
253
|
-
|
|
254
|
-
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.
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
## Notes
|
|
258
|
-
---
|
|
259
|
-
### The `storybook-static` folder
|
|
260
|
-
|
|
261
|
-
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:
|
|
262
|
-
|
|
263
|
-
```bash
|
|
264
|
-
yarn build-storybook
|
|
265
|
-
```
|
|
266
|
-
|
|
267
|
-
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.
|
|
268
|
-
|
|
269
|
-
---
|
|
270
|
-
### Examples
|
|
271
|
-
|
|
272
|
-
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.
|
|
273
|
-
|
|
274
|
-
---
|
|
275
|
-
### Bundle analysis
|
|
276
|
-
|
|
277
|
-
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`.
|