@royaloperahouse/chord 2.2.5-a-chord-development → 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.
@@ -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, PageHeadingPanel, PageHeadingStream, PageHeadingCompact, };
7
+ export { PageHeadingCinema, PageHeadingCore, PageHeadingImpact, PageHeadingStream, PageHeadingCompact, PageHeadingPanel, };
@@ -3,4 +3,3 @@ export declare const CreditListingWrapper: import("styled-components").StyledCom
3
3
  export declare const DescriptionWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
4
4
  export declare const RoleWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
5
5
  export declare const CreditWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
6
- export declare const CreditBodyWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
@@ -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 ArrowIcon: import("styled-components").StyledComponent<import("react").MemoExoticComponent<({ className, color, iconName, title, direction }: import("../../../types/iconTypes").IIconProps) => import("react").ReactElement<any, string | ((props: any) => import("react").ReactElement<any, any> | null) | (new (props: any) => import("react").Component<any, any, any>)>>, any, {
4
- iconName: "DropdownArrow";
5
- color: string;
6
- title: "Select Arrow";
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>;
@@ -24,6 +24,6 @@ import ImageWithCaption from './ImageWithCaption';
24
24
  import Quote from './Quote';
25
25
  import MiniCard from './MiniCard';
26
26
  import ReadMore from './ReadMore';
27
- import PasswordStrength from './PasswordStrength';
28
27
  import AuxiliaryNav from './AuxiliaryNav';
28
+ import PasswordStrength from './PasswordStrength';
29
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,8 +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, StatusBanner, SearchBar, SecondaryButton, SecondaryLogo, SectionSplitter, SectionTitle, Select, Sponsorship, Stepper, StickyBar, 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
- import { BrandingStyle } from './types/impactHeader';
7
6
  import { ModalWindow } from './components/organisms';
8
- export { Accordion, Accordions, AnnouncementBanner, AltHeader, AnchorTabBar, AuxiliaryNav, AspectRatio, BodyText, BrandingStyle, 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, Stepper, StickyBar, 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 IOption<T> {
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
- * Disables the select component
76
+ * A text label to be shown above the text input field.
92
77
  */
93
- disabled?: boolean;
78
+ label?: string;
94
79
  /**
95
- * Style prop - sets the width of the select component in px.
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
- width?: number | 'default';
85
+ error?: string;
98
86
  /**
99
- * Style prop - sets the height of the select component in px.
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
- height?: number | 'default';
91
+ width?: number;
102
92
  /**
103
- * Opt-in to resetting the selected value to the first option,
104
- * when the options change.
105
- * Defaults to `false`;
106
- */
107
- resetWhenOptionsUpdate?: boolean;
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 */
@@ -123,28 +114,25 @@ export interface IStepperProps {
123
114
  step?: number;
124
115
  /** An error message to be shown below the stepper.
125
116
  *
117
+ * Default: `undefined`
126
118
  */
127
119
  error?: string;
128
- /**
129
- * Set disapled state
130
- */
131
- disabled?: boolean;
132
- /**
133
- * Minimum value allowed in the stepper
134
- */
135
- min?: number;
136
120
  /**
137
121
  * A style prop that allows us to change what colours to
138
122
  * use for light or dark mode (e.g. text color, border color, etc...)
139
123
  * based on the background color.
140
124
  *
141
125
  * Defaults to `false`.
142
- * Specify whether or not the containing element has a dark background.
143
- * This property affects the border colours for focused and error states.
144
- *
145
- * Default: `false`
146
126
  */
147
127
  darkMode?: boolean;
128
+ /**
129
+ * Set disapled state
130
+ */
131
+ disabled?: boolean;
132
+ /**
133
+ * Minimum value allowed in the stepper
134
+ */
135
+ min?: number;
148
136
  /**
149
137
  * Maximum value allowed in the stepper
150
138
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@royaloperahouse/chord",
3
- "version": "2.2.5-a-chord-development",
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
  }