@newskit-render/shared-components 2.1.2-alpha.2 → 2.1.2-alpha.3
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/README.md +826 -25
- package/dist/cjs/ButtonGroup/ButtonGroup.js +11 -31
- package/dist/cjs/ButtonGroup/ButtonGroup.js.map +1 -1
- package/dist/cjs/ButtonGroup/components/BreakpointWrapper.d.ts +9 -0
- package/dist/cjs/ButtonGroup/components/BreakpointWrapper.js +14 -0
- package/dist/cjs/ButtonGroup/components/BreakpointWrapper.js.map +1 -0
- package/dist/cjs/ButtonGroup/components/PrimaryButton.d.ts +3 -0
- package/dist/cjs/ButtonGroup/components/PrimaryButton.js +27 -0
- package/dist/cjs/ButtonGroup/components/PrimaryButton.js.map +1 -0
- package/dist/cjs/ButtonGroup/components/SecondaryButton.d.ts +3 -0
- package/dist/cjs/ButtonGroup/components/SecondaryButton.js +27 -0
- package/dist/cjs/ButtonGroup/components/SecondaryButton.js.map +1 -0
- package/dist/cjs/ButtonGroup/defaults.d.ts +4 -0
- package/dist/cjs/ButtonGroup/defaults.js +31 -0
- package/dist/cjs/ButtonGroup/defaults.js.map +1 -0
- package/dist/cjs/ButtonGroup/index.d.ts +2 -1
- package/dist/cjs/ButtonGroup/index.js +2 -1
- package/dist/cjs/ButtonGroup/index.js.map +1 -1
- package/dist/cjs/ButtonGroup/{presets.d.ts → style-presets.d.ts} +0 -0
- package/dist/cjs/ButtonGroup/{presets.js → style-presets.js} +1 -1
- package/dist/cjs/ButtonGroup/style-presets.js.map +1 -0
- package/dist/cjs/ButtonGroup/styled.d.ts +10 -0
- package/dist/cjs/ButtonGroup/styled.js +13 -0
- package/dist/cjs/ButtonGroup/styled.js.map +1 -0
- package/dist/cjs/ButtonGroup/types.d.ts +1 -2
- package/dist/cjs/Calendar/{presets.d.ts → style-presets.d.ts} +0 -0
- package/dist/cjs/Calendar/{presets.js → style-presets.js} +1 -1
- package/dist/cjs/Calendar/style-presets.js.map +1 -0
- package/dist/cjs/ContentListView/ContentListView.d.ts +1 -0
- package/dist/cjs/ContentListView/ContentListView.js +8 -6
- package/dist/cjs/ContentListView/ContentListView.js.map +1 -1
- package/dist/cjs/ContentListView/DateItemButtons.js +2 -2
- package/dist/cjs/ContentListView/DateItemButtons.js.map +1 -1
- package/dist/cjs/ContentListView/defaults.d.ts +3 -0
- package/dist/cjs/ContentListView/defaults.js +7 -0
- package/dist/cjs/ContentListView/defaults.js.map +1 -0
- package/dist/cjs/ContentListView/index.d.ts +2 -0
- package/dist/cjs/ContentListView/index.js +2 -0
- package/dist/cjs/ContentListView/index.js.map +1 -1
- package/dist/cjs/ContentListView/style-presets.d.ts +21 -0
- package/dist/cjs/ContentListView/style-presets.js +25 -0
- package/dist/cjs/ContentListView/style-presets.js.map +1 -0
- package/dist/cjs/CorePackageContent/CorePackageContent.js +7 -7
- package/dist/cjs/CorePackageContent/CorePackageContent.js.map +1 -1
- package/dist/cjs/ExpandSection/ExpandSection.js +9 -40
- package/dist/cjs/ExpandSection/ExpandSection.js.map +1 -1
- package/dist/cjs/ExpandSection/defaults.d.ts +38 -0
- package/dist/cjs/ExpandSection/defaults.js +39 -0
- package/dist/cjs/ExpandSection/defaults.js.map +1 -0
- package/dist/cjs/LayoutGrid/LayoutGrid.js +1 -0
- package/dist/cjs/LayoutGrid/LayoutGrid.js.map +1 -1
- package/dist/cjs/Modal/ModalContent.js +5 -5
- package/dist/cjs/Modal/ModalContent.js.map +1 -1
- package/dist/cjs/Modal/index.d.ts +1 -1
- package/dist/cjs/Modal/index.js +1 -1
- package/dist/cjs/Modal/index.js.map +1 -1
- package/dist/cjs/Modal/{presets.d.ts → style-presets.d.ts} +0 -0
- package/dist/cjs/Modal/{presets.js → style-presets.js} +1 -1
- package/dist/cjs/Modal/style-presets.js.map +1 -0
- package/dist/cjs/NavigationFooter/NavigationFooter.js +3 -4
- package/dist/cjs/NavigationFooter/NavigationFooter.js.map +1 -1
- package/dist/cjs/NavigationFooter/index.d.ts +1 -0
- package/dist/cjs/NavigationFooter/index.js +15 -0
- package/dist/cjs/NavigationFooter/index.js.map +1 -1
- package/dist/cjs/NavigationFooter/stories/NavigationFooter.stories.js +1 -1
- package/dist/cjs/NavigationFooter/stories/NavigationFooter.stories.js.map +1 -1
- package/dist/cjs/NavigationFooter/style-presets.d.ts +16 -0
- package/dist/cjs/NavigationFooter/style-presets.js +20 -0
- package/dist/cjs/NavigationFooter/style-presets.js.map +1 -0
- package/dist/cjs/NavigationPrimary/NavigationPrimary.js +12 -23
- package/dist/cjs/NavigationPrimary/NavigationPrimary.js.map +1 -1
- package/dist/cjs/NavigationPrimary/index.d.ts +1 -0
- package/dist/cjs/NavigationPrimary/index.js +1 -0
- package/dist/cjs/NavigationPrimary/index.js.map +1 -1
- package/dist/cjs/NavigationPrimary/renderLinks.d.ts +3 -0
- package/dist/cjs/NavigationPrimary/renderLinks.js +27 -0
- package/dist/cjs/NavigationPrimary/renderLinks.js.map +1 -0
- package/dist/cjs/NavigationPrimary/style-presets.d.ts +14 -0
- package/dist/cjs/NavigationPrimary/style-presets.js +18 -0
- package/dist/cjs/NavigationPrimary/style-presets.js.map +1 -0
- package/dist/cjs/PastDueBanner/Notice.js +1 -1
- package/dist/cjs/PastDueBanner/helpers.js +6 -6
- package/dist/cjs/PastDueBanner/index.d.ts +1 -0
- package/dist/cjs/PastDueBanner/index.js +3 -1
- package/dist/cjs/PastDueBanner/index.js.map +1 -1
- package/dist/cjs/PastDueBanner/style-presets.d.ts +23 -0
- package/dist/cjs/PastDueBanner/style-presets.js +27 -0
- package/dist/cjs/PastDueBanner/style-presets.js.map +1 -0
- package/dist/cjs/PastDueBanner/types.d.ts +1 -1
- package/dist/cjs/RadioForm/RadioForm.js +13 -11
- package/dist/cjs/RadioForm/RadioForm.js.map +1 -1
- package/dist/cjs/RadioForm/defaults.d.ts +12 -0
- package/dist/cjs/RadioForm/defaults.js +16 -0
- package/dist/cjs/RadioForm/defaults.js.map +1 -0
- package/dist/cjs/SecureFlag/SecureFlag.d.ts +1 -0
- package/dist/cjs/SecureFlag/SecureFlag.js +19 -13
- package/dist/cjs/SecureFlag/SecureFlag.js.map +1 -1
- package/dist/cjs/SecureFlag/defaults.d.ts +13 -0
- package/dist/cjs/SecureFlag/defaults.js +20 -0
- package/dist/cjs/SecureFlag/defaults.js.map +1 -0
- package/dist/cjs/SecureFlag/index.d.ts +2 -0
- package/dist/cjs/SecureFlag/index.js +2 -0
- package/dist/cjs/SecureFlag/index.js.map +1 -1
- package/dist/cjs/SecureFlag/style-presets.d.ts +9 -0
- package/dist/cjs/SecureFlag/style-presets.js +13 -0
- package/dist/cjs/SecureFlag/style-presets.js.map +1 -0
- package/dist/cjs/TitleBar/TitleBar.js +5 -12
- package/dist/cjs/TitleBar/TitleBar.js.map +1 -1
- package/dist/cjs/TitleBar/componentDefaults.d.ts +9 -0
- package/dist/cjs/TitleBar/componentDefaults.js +13 -0
- package/dist/cjs/TitleBar/componentDefaults.js.map +1 -0
- package/dist/cjs/TitleBar/index.d.ts +1 -0
- package/dist/cjs/TitleBar/index.js +1 -0
- package/dist/cjs/TitleBar/index.js.map +1 -1
- package/dist/cjs/helpers/baseContext.d.ts +0 -16
- package/dist/cjs/helpers/baseContext.js +1 -11
- package/dist/cjs/helpers/baseContext.js.map +1 -1
- package/dist/cjs/theme/sharedPresets.js +5 -0
- package/dist/cjs/theme/sharedPresets.js.map +1 -1
- package/dist/cjs/theme/sharedTheme/componentDefaults.d.ts +9 -0
- package/dist/cjs/theme/sharedTheme/componentDefaults.js +14 -0
- package/dist/cjs/theme/sharedTheme/componentDefaults.js.map +1 -0
- package/dist/cjs/theme/sharedTheme/index.js +9 -2
- package/dist/cjs/theme/sharedTheme/index.js.map +1 -1
- package/dist/cjs/theme/sharedTheme/stylePresets.d.ts +0 -58
- package/dist/cjs/theme/sharedTheme/stylePresets.js +4 -58
- package/dist/cjs/theme/sharedTheme/stylePresets.js.map +1 -1
- package/dist/cjs/theme/sunTheme/index.js +1 -1
- package/dist/cjs/theme/sunTheme/index.js.map +1 -1
- package/dist/cjs/theme/timesTheme/stylePresets.d.ts +1 -1
- package/dist/cjs/theme/timesTheme/stylePresets.js +1 -1
- package/dist/cjs/theme/timesTheme/stylePresets.js.map +1 -1
- package/dist/cjs/theme/virginTheme/stylePresets.d.ts +1 -1
- package/dist/cjs/theme/virginTheme/stylePresets.js +1 -1
- package/dist/cjs/theme/virginTheme/stylePresets.js.map +1 -1
- package/dist/esm/ButtonGroup/ButtonGroup.js +12 -31
- package/dist/esm/ButtonGroup/ButtonGroup.js.map +1 -1
- package/dist/esm/ButtonGroup/components/BreakpointWrapper.d.ts +9 -0
- package/dist/esm/ButtonGroup/components/BreakpointWrapper.js +7 -0
- package/dist/esm/ButtonGroup/components/BreakpointWrapper.js.map +1 -0
- package/dist/esm/ButtonGroup/components/PrimaryButton.d.ts +3 -0
- package/dist/esm/ButtonGroup/components/PrimaryButton.js +21 -0
- package/dist/esm/ButtonGroup/components/PrimaryButton.js.map +1 -0
- package/dist/esm/ButtonGroup/components/SecondaryButton.d.ts +3 -0
- package/dist/esm/ButtonGroup/components/SecondaryButton.js +21 -0
- package/dist/esm/ButtonGroup/components/SecondaryButton.js.map +1 -0
- package/dist/esm/ButtonGroup/defaults.d.ts +4 -0
- package/dist/esm/ButtonGroup/defaults.js +28 -0
- package/dist/esm/ButtonGroup/defaults.js.map +1 -0
- package/dist/esm/ButtonGroup/index.d.ts +2 -1
- package/dist/esm/ButtonGroup/index.js +2 -1
- package/dist/esm/ButtonGroup/index.js.map +1 -1
- package/dist/esm/ButtonGroup/{presets.d.ts → style-presets.d.ts} +0 -0
- package/dist/esm/ButtonGroup/{presets.js → style-presets.js} +1 -1
- package/dist/esm/ButtonGroup/style-presets.js.map +1 -0
- package/dist/esm/ButtonGroup/styled.d.ts +10 -0
- package/dist/esm/ButtonGroup/styled.js +10 -0
- package/dist/esm/ButtonGroup/styled.js.map +1 -0
- package/dist/esm/ButtonGroup/types.d.ts +1 -2
- package/dist/esm/Calendar/{presets.d.ts → style-presets.d.ts} +0 -0
- package/dist/esm/Calendar/{presets.js → style-presets.js} +1 -1
- package/dist/esm/Calendar/style-presets.js.map +1 -0
- package/dist/esm/ContentListView/ContentListView.d.ts +1 -0
- package/dist/esm/ContentListView/ContentListView.js +7 -5
- package/dist/esm/ContentListView/ContentListView.js.map +1 -1
- package/dist/esm/ContentListView/DateItemButtons.js +2 -2
- package/dist/esm/ContentListView/DateItemButtons.js.map +1 -1
- package/dist/esm/ContentListView/defaults.d.ts +3 -0
- package/dist/esm/ContentListView/defaults.js +4 -0
- package/dist/esm/ContentListView/defaults.js.map +1 -0
- package/dist/esm/ContentListView/index.d.ts +2 -0
- package/dist/esm/ContentListView/index.js +2 -0
- package/dist/esm/ContentListView/index.js.map +1 -1
- package/dist/esm/ContentListView/style-presets.d.ts +21 -0
- package/dist/esm/ContentListView/style-presets.js +22 -0
- package/dist/esm/ContentListView/style-presets.js.map +1 -0
- package/dist/esm/CorePackageContent/CorePackageContent.js +7 -7
- package/dist/esm/CorePackageContent/CorePackageContent.js.map +1 -1
- package/dist/esm/ExpandSection/ExpandSection.js +9 -40
- package/dist/esm/ExpandSection/ExpandSection.js.map +1 -1
- package/dist/esm/ExpandSection/defaults.d.ts +38 -0
- package/dist/esm/ExpandSection/defaults.js +36 -0
- package/dist/esm/ExpandSection/defaults.js.map +1 -0
- package/dist/esm/LayoutGrid/LayoutGrid.js +1 -0
- package/dist/esm/LayoutGrid/LayoutGrid.js.map +1 -1
- package/dist/esm/Modal/ModalContent.js +5 -5
- package/dist/esm/Modal/ModalContent.js.map +1 -1
- package/dist/esm/Modal/index.d.ts +1 -1
- package/dist/esm/Modal/index.js +1 -1
- package/dist/esm/Modal/index.js.map +1 -1
- package/dist/esm/Modal/{presets.d.ts → style-presets.d.ts} +0 -0
- package/dist/esm/Modal/{presets.js → style-presets.js} +1 -1
- package/dist/esm/Modal/style-presets.js.map +1 -0
- package/dist/esm/NavigationFooter/NavigationFooter.js +3 -4
- package/dist/esm/NavigationFooter/NavigationFooter.js.map +1 -1
- package/dist/esm/NavigationFooter/index.d.ts +1 -0
- package/dist/esm/NavigationFooter/index.js +1 -0
- package/dist/esm/NavigationFooter/index.js.map +1 -1
- package/dist/esm/NavigationFooter/stories/NavigationFooter.stories.js +1 -1
- package/dist/esm/NavigationFooter/stories/NavigationFooter.stories.js.map +1 -1
- package/dist/esm/NavigationFooter/style-presets.d.ts +16 -0
- package/dist/esm/NavigationFooter/style-presets.js +17 -0
- package/dist/esm/NavigationFooter/style-presets.js.map +1 -0
- package/dist/esm/NavigationPrimary/NavigationPrimary.js +11 -22
- package/dist/esm/NavigationPrimary/NavigationPrimary.js.map +1 -1
- package/dist/esm/NavigationPrimary/index.d.ts +1 -0
- package/dist/esm/NavigationPrimary/index.js +1 -0
- package/dist/esm/NavigationPrimary/index.js.map +1 -1
- package/dist/esm/NavigationPrimary/renderLinks.d.ts +3 -0
- package/dist/esm/NavigationPrimary/renderLinks.js +20 -0
- package/dist/esm/NavigationPrimary/renderLinks.js.map +1 -0
- package/dist/esm/NavigationPrimary/style-presets.d.ts +14 -0
- package/dist/esm/NavigationPrimary/style-presets.js +15 -0
- package/dist/esm/NavigationPrimary/style-presets.js.map +1 -0
- package/dist/esm/PastDueBanner/Notice.js +1 -1
- package/dist/esm/PastDueBanner/helpers.js +6 -6
- package/dist/esm/PastDueBanner/index.d.ts +1 -0
- package/dist/esm/PastDueBanner/index.js +1 -0
- package/dist/esm/PastDueBanner/index.js.map +1 -1
- package/dist/esm/PastDueBanner/style-presets.d.ts +23 -0
- package/dist/esm/PastDueBanner/style-presets.js +24 -0
- package/dist/esm/PastDueBanner/style-presets.js.map +1 -0
- package/dist/esm/PastDueBanner/types.d.ts +1 -1
- package/dist/esm/RadioForm/RadioForm.js +13 -11
- package/dist/esm/RadioForm/RadioForm.js.map +1 -1
- package/dist/esm/RadioForm/defaults.d.ts +12 -0
- package/dist/esm/RadioForm/defaults.js +13 -0
- package/dist/esm/RadioForm/defaults.js.map +1 -0
- package/dist/esm/SecureFlag/SecureFlag.d.ts +1 -0
- package/dist/esm/SecureFlag/SecureFlag.js +18 -12
- package/dist/esm/SecureFlag/SecureFlag.js.map +1 -1
- package/dist/esm/SecureFlag/defaults.d.ts +13 -0
- package/dist/esm/SecureFlag/defaults.js +17 -0
- package/dist/esm/SecureFlag/defaults.js.map +1 -0
- package/dist/esm/SecureFlag/index.d.ts +2 -0
- package/dist/esm/SecureFlag/index.js +2 -0
- package/dist/esm/SecureFlag/index.js.map +1 -1
- package/dist/esm/SecureFlag/style-presets.d.ts +9 -0
- package/dist/esm/SecureFlag/style-presets.js +10 -0
- package/dist/esm/SecureFlag/style-presets.js.map +1 -0
- package/dist/esm/TitleBar/TitleBar.js +5 -12
- package/dist/esm/TitleBar/TitleBar.js.map +1 -1
- package/dist/esm/TitleBar/componentDefaults.d.ts +9 -0
- package/dist/esm/TitleBar/componentDefaults.js +10 -0
- package/dist/esm/TitleBar/componentDefaults.js.map +1 -0
- package/dist/esm/TitleBar/index.d.ts +1 -0
- package/dist/esm/TitleBar/index.js +1 -0
- package/dist/esm/TitleBar/index.js.map +1 -1
- package/dist/esm/helpers/baseContext.d.ts +0 -16
- package/dist/esm/helpers/baseContext.js +1 -11
- package/dist/esm/helpers/baseContext.js.map +1 -1
- package/dist/esm/theme/sharedPresets.js +5 -0
- package/dist/esm/theme/sharedPresets.js.map +1 -1
- package/dist/esm/theme/sharedTheme/componentDefaults.d.ts +9 -0
- package/dist/esm/theme/sharedTheme/componentDefaults.js +11 -0
- package/dist/esm/theme/sharedTheme/componentDefaults.js.map +1 -0
- package/dist/esm/theme/sharedTheme/index.js +9 -2
- package/dist/esm/theme/sharedTheme/index.js.map +1 -1
- package/dist/esm/theme/sharedTheme/stylePresets.d.ts +0 -58
- package/dist/esm/theme/sharedTheme/stylePresets.js +4 -58
- package/dist/esm/theme/sharedTheme/stylePresets.js.map +1 -1
- package/dist/esm/theme/sunTheme/index.js +1 -1
- package/dist/esm/theme/sunTheme/index.js.map +1 -1
- package/dist/esm/theme/timesTheme/stylePresets.d.ts +1 -1
- package/dist/esm/theme/timesTheme/stylePresets.js +1 -1
- package/dist/esm/theme/timesTheme/stylePresets.js.map +1 -1
- package/dist/esm/theme/virginTheme/stylePresets.d.ts +1 -1
- package/dist/esm/theme/virginTheme/stylePresets.js +1 -1
- package/dist/esm/theme/virginTheme/stylePresets.js.map +1 -1
- package/package.json +1 -1
- package/dist/cjs/ButtonGroup/presets.js.map +0 -1
- package/dist/cjs/Calendar/presets.js.map +0 -1
- package/dist/cjs/Modal/presets.js.map +0 -1
- package/dist/esm/ButtonGroup/presets.js.map +0 -1
- package/dist/esm/Calendar/presets.js.map +0 -1
- package/dist/esm/Modal/presets.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,50 +1,82 @@
|
|
|
1
1
|
# @newskit-render/shared-components
|
|
2
2
|
|
|
3
|
-
#
|
|
3
|
+
# sharedTheme
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Based on the Newskit Light Theme, the Shared Theme can be used as a base for every Newskit Solutions application. It overrides the brand color, adds custom presets and/or componentDefaults to some of the components in `shared-components`. You can extend it in the same way it extends Newskit Light theme.
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
To add a hyperlink to the banner's message, pass a link prop to the banner in the context. The link prop has this shape :
|
|
7
|
+
# Back Button
|
|
9
8
|
|
|
10
|
-
|
|
11
|
-
link: {
|
|
9
|
+
The Back Button is a Next.js's `next/link` wrapper for a Newskit Button or link. It enables native Next.js routing.
|
|
12
10
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
linkText: string, // example: 'click here'
|
|
11
|
+
- Props:
|
|
16
12
|
|
|
17
|
-
},
|
|
18
13
|
```
|
|
14
|
+
interface BackButtonProps {
|
|
15
|
+
backButton?: TBackButton
|
|
16
|
+
backButtonOverrides?: BackButtonOverrides
|
|
17
|
+
}
|
|
19
18
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
interface TBackButton {
|
|
20
|
+
text: string
|
|
21
|
+
href: string
|
|
22
|
+
'aria-label': string
|
|
23
|
+
}
|
|
23
24
|
|
|
25
|
+
export interface BackButtonOverrides {
|
|
26
|
+
stylePreset?: MQ<string>
|
|
27
|
+
typographyPreset?: MQ<string>
|
|
28
|
+
spaceInset?: MQ<string>
|
|
29
|
+
spaceStack?: MQ<string>
|
|
30
|
+
iconSize?: MQ<string>
|
|
31
|
+
size?: 'small' | 'medium' | 'large'
|
|
32
|
+
asLink?: boolean
|
|
33
|
+
}
|
|
24
34
|
```
|
|
25
|
-
terminated: {
|
|
26
35
|
|
|
27
|
-
|
|
36
|
+
# ButtonGroup
|
|
28
37
|
|
|
29
|
-
|
|
38
|
+
The group is a component that combines a standard group of Primary and Secondary button. The group can also contain a flag, marking a secure operation.
|
|
39
|
+
The ButtonGroup can have only one button, (either Primery or Secondary), or both buttons. Each button is a separate component with the following props:
|
|
30
40
|
|
|
31
|
-
|
|
41
|
+
- <PrimaryButton />
|
|
42
|
+
- <SecondaryButton />
|
|
32
43
|
|
|
33
|
-
|
|
44
|
+
```
|
|
45
|
+
type ButtonProps = Omit<NewkitButtonProps, 'children' | 'size'> & {
|
|
46
|
+
ariaLabel?: string
|
|
47
|
+
text?: string
|
|
48
|
+
href?: string
|
|
49
|
+
onClick?: (e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void
|
|
50
|
+
size?: ButtonSize
|
|
51
|
+
}
|
|
52
|
+
```
|
|
34
53
|
|
|
35
|
-
|
|
54
|
+
Each button is styled independetly and has its own componentDefaults in the theme. You can override those by passing your own `size` and `overrides` props to each button via the context.
|
|
36
55
|
|
|
37
|
-
|
|
56
|
+
The ButtonGroup also has it's own stylePreset, that is used as a componentDefault in the theme.
|
|
57
|
+
The ButtonGroup component takes the following:
|
|
38
58
|
|
|
39
|
-
|
|
59
|
+
- Props:
|
|
40
60
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
61
|
+
```
|
|
62
|
+
type ButtonGroupProps = {
|
|
63
|
+
loading?: boolean
|
|
64
|
+
secureFlag?: boolean
|
|
65
|
+
secureFlagOverrides?: SecureFlagProps
|
|
66
|
+
primaryButton?: ButtonProps
|
|
67
|
+
secondaryButton?: ButtonProps
|
|
68
|
+
stylePreset?: MQ<string>
|
|
69
|
+
keepFixed?: boolean
|
|
70
|
+
breakPoint?: BreakpointKeys
|
|
71
|
+
}
|
|
44
72
|
|
|
45
|
-
},
|
|
46
73
|
```
|
|
47
74
|
|
|
75
|
+
The `stylePreset` is used to override the default stylePreset of the ButtonGroup.
|
|
76
|
+
The `primaryButton` and `secondaryButton` are used to pass context (props) to the `<PrimaryButton />` and `<SecondaryButton />`:
|
|
77
|
+
The `keepFixed` property is used to tell the group if it should be kept at a fixed position at the bottom of the screen on mobile / smaller screens.
|
|
78
|
+
The `secureFlag` property is used to tell the group if it should display the flag, that indicates secure operations. The `SecureFlag` is it's own component, exported from `shared-components`. [go to SecureFlag](#secureflag)
|
|
79
|
+
|
|
48
80
|
# Calendar
|
|
49
81
|
|
|
50
82
|
This component is based on the Airbnb's react-dates calendar picker, enhanced with the ablity to be customized by using newskit design tokens. The end user can select a range of dates.
|
|
@@ -167,3 +199,772 @@ interface CalendarStylesProps {
|
|
|
167
199
|
- startDate: Date | null | mandatory. Passed by a parent component or a hook, in order to be accessible for further use.
|
|
168
200
|
- endDate: Date | null | mandatory. Passed by a parent component or a hook, in order to be accessible for further use.
|
|
169
201
|
- setDates: (start: null | Date, end: null | Date) => void | mandatory. Passed by a parent component or a hook, in order to set the two dates above. This is most likely to be a setState() hook, but any function that manages state and returns void is valid.
|
|
202
|
+
|
|
203
|
+
# ContentListView
|
|
204
|
+
|
|
205
|
+
This component is a highly flexible wrapper around the Newskit's `StructuredList component`. The content in each list item looks like a table structure, can have multiple cells, can contain buttons, links. The component is used in `my-account` package to display the sections in Personal details, Subscription and billing and Newsletters and alerts pages, as well as the Holiday stops page.
|
|
206
|
+
|
|
207
|
+
The ContentListView component takes the following
|
|
208
|
+
|
|
209
|
+
- Props:
|
|
210
|
+
|
|
211
|
+
```
|
|
212
|
+
interface ContentListViewProps {
|
|
213
|
+
children: React.ReactNode
|
|
214
|
+
introductionProps?: IntroductionProps & {
|
|
215
|
+
extendTitleOverrides: TitleOverrides
|
|
216
|
+
extendDescriptionOverrides: DescriptionOverrides
|
|
217
|
+
}
|
|
218
|
+
link?: boolean
|
|
219
|
+
ariaLabel?: string
|
|
220
|
+
spaceStack?: MQ<string>
|
|
221
|
+
stylePreset?: MQ<string>
|
|
222
|
+
showDividerByBreakpoint?: boolean
|
|
223
|
+
}
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
`ContentListView` uses some components internally and exports 3 additional components: `ListItem`, `DateItemButtons` and `DateItemStatus`.
|
|
227
|
+
|
|
228
|
+
## ListItem
|
|
229
|
+
|
|
230
|
+
This is the regular list item. It is used in `my-account` main pages and takes the following
|
|
231
|
+
|
|
232
|
+
- Props:
|
|
233
|
+
|
|
234
|
+
```
|
|
235
|
+
interface ListItemComponentProps {
|
|
236
|
+
item: ListItemType
|
|
237
|
+
listCellProps?: ListCellProps
|
|
238
|
+
listItemProps: ListItemProps
|
|
239
|
+
}
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
## DateItemButtons
|
|
243
|
+
|
|
244
|
+
This is used when the list item must contain a date and a button. It is used in the Holiday Stops page, when displaying the list of upcoming holiday stops.
|
|
245
|
+
It takes the following
|
|
246
|
+
|
|
247
|
+
- Props:
|
|
248
|
+
|
|
249
|
+
```
|
|
250
|
+
interface DateItemComponentProps {
|
|
251
|
+
item: DateItemType
|
|
252
|
+
listItemProps: ListItemProps
|
|
253
|
+
listCellProps?: Partial<ListCellProps> & {
|
|
254
|
+
statusOverrides?: {
|
|
255
|
+
typographyPreset?: MQ<string>
|
|
256
|
+
stylePreset?: MQ<string>
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
redirectUrl?: string
|
|
260
|
+
onCancel?: () => void
|
|
261
|
+
children?: React.FunctionComponent
|
|
262
|
+
}
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
## DateItemStatus
|
|
266
|
+
|
|
267
|
+
This is used in the holiday stops list, when displaying the current or past holiday stops - the list item displays a date but instad of an edit button, it only displays the status of the holiday stop. The component takes the type of props as the DateItemButtons.
|
|
268
|
+
|
|
269
|
+
The difference is made by the item's status, which is part of the DateItemType itself and has the following shape:
|
|
270
|
+
|
|
271
|
+
```
|
|
272
|
+
interface DateItemType {
|
|
273
|
+
id: string
|
|
274
|
+
startDate: string
|
|
275
|
+
endDate: string
|
|
276
|
+
status: string | null
|
|
277
|
+
}
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
# CorePackageContent
|
|
281
|
+
|
|
282
|
+
This component is used to display the core content of a 'subscription package'. It is meant to display the title of the package, an image, a list of benefits for that package, description, payment details. price, promotions etc. It takes the following
|
|
283
|
+
|
|
284
|
+
- Props:
|
|
285
|
+
|
|
286
|
+
```
|
|
287
|
+
interface CorePackageContentProps {
|
|
288
|
+
titleBar?: TitleBarProps
|
|
289
|
+
image?:
|
|
290
|
+
| (ImageProps & {
|
|
291
|
+
spaceStack?: MQ<string>
|
|
292
|
+
})
|
|
293
|
+
| false
|
|
294
|
+
benifitList?: Omit<UnorderedListProps, 'children'> & {
|
|
295
|
+
spaceStack?: MQ<string>
|
|
296
|
+
icon?: NewsKitIcon
|
|
297
|
+
}
|
|
298
|
+
benifitItems?: string[]
|
|
299
|
+
divider?: {
|
|
300
|
+
spaceStack?: MQ<string>
|
|
301
|
+
}
|
|
302
|
+
promo?: string
|
|
303
|
+
promoOverrides?: Omit<TextBlockProps, 'children'> & {
|
|
304
|
+
spaceStack?: MQ<string>
|
|
305
|
+
}
|
|
306
|
+
paymentKey?: string
|
|
307
|
+
paymentValue?: string
|
|
308
|
+
paymentOverrides?: Omit<TextBlockProps, 'children'> & {
|
|
309
|
+
spaceStack?: MQ<string>
|
|
310
|
+
}
|
|
311
|
+
description?: string
|
|
312
|
+
descriptionOverrides?: Omit<TextBlockProps, 'children'> & {
|
|
313
|
+
spaceStack?: MQ<string>
|
|
314
|
+
}
|
|
315
|
+
billingDetails?: string
|
|
316
|
+
billingDetailsOverrides?: Omit<TextBlockProps, 'children'> & {
|
|
317
|
+
spaceStack?: MQ<string>
|
|
318
|
+
}
|
|
319
|
+
backgroundColor?: string
|
|
320
|
+
padding?: string
|
|
321
|
+
}
|
|
322
|
+
```
|
|
323
|
+
|
|
324
|
+
# ExpandSection
|
|
325
|
+
|
|
326
|
+
This component is used when we need to partially hide a part of some text, that is too long to display at once. It contains a button that allows the contend to be expanded and collaped as needed. It's initial state, the text of the buttons, and the styling of the content can be controlled using the following
|
|
327
|
+
|
|
328
|
+
- Props:
|
|
329
|
+
|
|
330
|
+
```
|
|
331
|
+
interface ExpandSectionProps {
|
|
332
|
+
data: {
|
|
333
|
+
textList: string[]
|
|
334
|
+
moreInfo: {
|
|
335
|
+
text: string
|
|
336
|
+
textList: string[]
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
expanded?: boolean
|
|
340
|
+
expandButton?: { expand: string; collapse: string }
|
|
341
|
+
unorderedListOverrides?: {
|
|
342
|
+
content?: {
|
|
343
|
+
stylePreset?: MQ<string>
|
|
344
|
+
typographyPreset?: MQ<string>
|
|
345
|
+
}
|
|
346
|
+
spaceStack?: MQ<string>
|
|
347
|
+
}
|
|
348
|
+
textOverrides?: {
|
|
349
|
+
typographyPreset?: MQ<string>
|
|
350
|
+
stylePreset?: MQ<string>
|
|
351
|
+
marginBlockEnd?: MQ<string>
|
|
352
|
+
}
|
|
353
|
+
buttonOverrides?: {
|
|
354
|
+
stylePreset?: MQ<string>
|
|
355
|
+
spaceInset?: MQ<string>
|
|
356
|
+
minHeight?: MQ<string>
|
|
357
|
+
minWidth?: MQ<string>
|
|
358
|
+
width?: MQ<string>
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
```
|
|
362
|
+
|
|
363
|
+
# FormComponent
|
|
364
|
+
|
|
365
|
+
This component is a wrapper around the Newskit's Form component and is used to display the forms that edit Name, Display Name and email in `my-account`. It takes the following
|
|
366
|
+
|
|
367
|
+
- Props:
|
|
368
|
+
|
|
369
|
+
```
|
|
370
|
+
interface FormProps extends FormWrapperProps {
|
|
371
|
+
validation?: Record<string, any>
|
|
372
|
+
validationSchemaKey?: string
|
|
373
|
+
fields: EditFieldType[]
|
|
374
|
+
disable?: boolean
|
|
375
|
+
handleError?: (
|
|
376
|
+
type: string,
|
|
377
|
+
errorMessage?: ErrorMessage,
|
|
378
|
+
genericErrorMessage?: GenericErrorMessage,
|
|
379
|
+
message?: string
|
|
380
|
+
) => void
|
|
381
|
+
handleLoading?: (
|
|
382
|
+
type: string,
|
|
383
|
+
errorMessage?: ErrorMessage,
|
|
384
|
+
genericErrorMessage?: GenericErrorMessage
|
|
385
|
+
) => void
|
|
386
|
+
handleSuccess?: () => void
|
|
387
|
+
baseUrl?: string
|
|
388
|
+
errorMessages?: ErrorMessage
|
|
389
|
+
genericErrorMessage?: GenericErrorMessage
|
|
390
|
+
onSubmit?: (
|
|
391
|
+
e: {
|
|
392
|
+
[x: string]: any
|
|
393
|
+
},
|
|
394
|
+
validationSchemaKey: string | unknown,
|
|
395
|
+
router?: any,
|
|
396
|
+
handleError?: ((overrideMessage?: string) => void) | undefined,
|
|
397
|
+
handleSuccess?: (() => void) | undefined,
|
|
398
|
+
redirectUrl?: string | undefined
|
|
399
|
+
) => Promise<Response>
|
|
400
|
+
}
|
|
401
|
+
```
|
|
402
|
+
|
|
403
|
+
The form is based on `react-hook-form` and uses yup validation.
|
|
404
|
+
|
|
405
|
+
# Header
|
|
406
|
+
|
|
407
|
+
This component is used to form the upper part of the page, below the navigation header. It contains the title of the page's cpntent, and other elements that might be used as the page's heading.
|
|
408
|
+
|
|
409
|
+
- Props:
|
|
410
|
+
|
|
411
|
+
```
|
|
412
|
+
type HeaderProps = IntroductionProps & {
|
|
413
|
+
backButton?: TBackButton
|
|
414
|
+
backButtonOverrides?: BackButtonOverrides
|
|
415
|
+
image?: EnhancedImageProps | false
|
|
416
|
+
spaceStack?: MQ<string>
|
|
417
|
+
showDivider?: boolean
|
|
418
|
+
fullWidthTitle?: boolean
|
|
419
|
+
imageCell?: CellProps
|
|
420
|
+
introductionCell?: CellProps
|
|
421
|
+
backButtonCell?: CellProps
|
|
422
|
+
}
|
|
423
|
+
```
|
|
424
|
+
|
|
425
|
+
# Image
|
|
426
|
+
|
|
427
|
+
The image component is a wrapper around `next/image`.
|
|
428
|
+
|
|
429
|
+
- Props:
|
|
430
|
+
|
|
431
|
+
```
|
|
432
|
+
type ImageProps = {
|
|
433
|
+
aspectRatio?: string | number
|
|
434
|
+
href?: string
|
|
435
|
+
width?: number
|
|
436
|
+
} & NextImageProps
|
|
437
|
+
```
|
|
438
|
+
|
|
439
|
+
# Introduction
|
|
440
|
+
|
|
441
|
+
This component is used to diplay the headline and description of the page or modal. It is used in both `Header` and `Modal` components.
|
|
442
|
+
|
|
443
|
+
- Props:
|
|
444
|
+
|
|
445
|
+
```
|
|
446
|
+
interface IntroductionProps {
|
|
447
|
+
title?: string
|
|
448
|
+
titleOverrides?: TitleOverrides
|
|
449
|
+
description?: string | string[]
|
|
450
|
+
descriptionOverrides?: DescriptionOverrides
|
|
451
|
+
overline?: string
|
|
452
|
+
overlineOverrides?: OverlineOverrides
|
|
453
|
+
center?: boolean
|
|
454
|
+
innerHTML?: string
|
|
455
|
+
makeBoldText?: string
|
|
456
|
+
}
|
|
457
|
+
```
|
|
458
|
+
|
|
459
|
+
# Link
|
|
460
|
+
|
|
461
|
+
The eventContext interface is not exported
|
|
462
|
+
|
|
463
|
+
- Props:
|
|
464
|
+
|
|
465
|
+
```
|
|
466
|
+
interface EventContext {
|
|
467
|
+
event_navigation_action: string
|
|
468
|
+
event_navigation_name: string
|
|
469
|
+
event_navigation_browsing_method: EventTrigger
|
|
470
|
+
event_navigation_label?: string
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
interface LinkProps
|
|
474
|
+
extends React.AnchorHTMLAttributes<HTMLAnchorElement> {
|
|
475
|
+
href: string
|
|
476
|
+
type: 'standalone' | 'inline'
|
|
477
|
+
eventContext?: EventContext
|
|
478
|
+
external?: boolean
|
|
479
|
+
overrides?: {
|
|
480
|
+
stylePreset?: MQ<string>
|
|
481
|
+
typographyPreset?: MQ<string>
|
|
482
|
+
spaceInline?: MQ<string>
|
|
483
|
+
externalIcon?: {
|
|
484
|
+
size?: string
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
```
|
|
489
|
+
|
|
490
|
+
# Modal
|
|
491
|
+
|
|
492
|
+
This component is a wrapper around the Newskit's Modal. The modal content can contain other components from `shared-components`:
|
|
493
|
+
[Image](#image), [Introduction](#introduction), [CorePackageContent](#corepackagecontent) and [ButtonGroup](#buttongroup)
|
|
494
|
+
|
|
495
|
+
- Props:
|
|
496
|
+
|
|
497
|
+
```
|
|
498
|
+
interface ModalProps
|
|
499
|
+
extends Omit<MKModalProps, 'children'>,
|
|
500
|
+
ModalContentProps {
|
|
501
|
+
closePosition?: 'left' | 'right' | 'none'
|
|
502
|
+
onOpen?: () => void
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
interface ModalContentProps {
|
|
506
|
+
spaceInset?: MQ<string>
|
|
507
|
+
image?: ImageProps & {
|
|
508
|
+
spaceStack?: MQ<string>
|
|
509
|
+
}
|
|
510
|
+
introduction?: IntroductionProps
|
|
511
|
+
inlineMessage?: Omit<InlineMessageProps, 'children'> & {
|
|
512
|
+
message?: string
|
|
513
|
+
spaceStack?: MQ<string>
|
|
514
|
+
}
|
|
515
|
+
corePackageContent?: CorePackageContentProps
|
|
516
|
+
buttonGroup?: ButtonGroupProps & {
|
|
517
|
+
spaceInset?: MQ<string>
|
|
518
|
+
}
|
|
519
|
+
centeredButton?: ButtonProps & {
|
|
520
|
+
spaceInset?: MQ<string>
|
|
521
|
+
}
|
|
522
|
+
modalLink?: ModalLinkProps
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
interface ModalLinkProps {
|
|
526
|
+
links?: Array<LinkProps & { text: string }> | (LinkProps & { text: string })
|
|
527
|
+
introduction?: IntroductionProps
|
|
528
|
+
}
|
|
529
|
+
```
|
|
530
|
+
|
|
531
|
+
# NavigationFooter
|
|
532
|
+
|
|
533
|
+
- Props:
|
|
534
|
+
|
|
535
|
+
```
|
|
536
|
+
interface FooterProps {
|
|
537
|
+
footer: FooterContext
|
|
538
|
+
footerOverrides: FooterContextOverrides
|
|
539
|
+
margin?: {
|
|
540
|
+
xsMargin?: string
|
|
541
|
+
smMargin?: string
|
|
542
|
+
mdMargin?: string
|
|
543
|
+
lgMargin?: string
|
|
544
|
+
}
|
|
545
|
+
gutter?: {
|
|
546
|
+
xsColumnGutter?: string
|
|
547
|
+
smColumnGutter?: string
|
|
548
|
+
mdColumnGutter?: string
|
|
549
|
+
lgColumnGutter?: string
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
interface FooterContext {
|
|
554
|
+
helpChat?: React.ComponentType<{
|
|
555
|
+
chatHelpOverrides?: Record<string, unknown>
|
|
556
|
+
}>
|
|
557
|
+
|
|
558
|
+
menuItemArray: {
|
|
559
|
+
text: string
|
|
560
|
+
href: string
|
|
561
|
+
id: string | number
|
|
562
|
+
}[]
|
|
563
|
+
legalText: string
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
interface FooterContextOverrides {
|
|
567
|
+
ariaLabel?: string
|
|
568
|
+
menuItemOverrides?: {
|
|
569
|
+
stylePreset?: MQ<string>
|
|
570
|
+
typographyPreset?: MQ<string>
|
|
571
|
+
spaceInset?: MQ<string>
|
|
572
|
+
}
|
|
573
|
+
menuOverrides?: {
|
|
574
|
+
spaceStack?: MQ<string>
|
|
575
|
+
backgroundColor?: string
|
|
576
|
+
borderColorTop?: string
|
|
577
|
+
borderColorBottom?: string
|
|
578
|
+
padding?: {
|
|
579
|
+
xs: string
|
|
580
|
+
md: string
|
|
581
|
+
}
|
|
582
|
+
}
|
|
583
|
+
legalTextOverrides?: {
|
|
584
|
+
spaceStack?: MQ<string>
|
|
585
|
+
stylePreset?: MQ<string>
|
|
586
|
+
typographyPreset?: MQ<string>
|
|
587
|
+
padding?: {
|
|
588
|
+
xs: string
|
|
589
|
+
md: string
|
|
590
|
+
}
|
|
591
|
+
}
|
|
592
|
+
chatHelpOverrides?: Record<string, unknown>
|
|
593
|
+
}
|
|
594
|
+
```
|
|
595
|
+
|
|
596
|
+
# NavigationPrimary
|
|
597
|
+
|
|
598
|
+
This component is a wrapper around a `<header>` tag and contains the primary navigation, the logo, and can also display additional item, depending on the route. For example /account route displays the word Account next to the logo and the navigation lead to either the main page or logout. The / route displays links to index pages and only displays Account link and icon if the visitor is loggged in.
|
|
599
|
+
The component takes the following
|
|
600
|
+
|
|
601
|
+
- Props:
|
|
602
|
+
|
|
603
|
+
```
|
|
604
|
+
interface NavigationPrimaryProps extends NavigationPrimaryThemeProps {
|
|
605
|
+
children?: React.ReactNode
|
|
606
|
+
nav?: NavigationPrimaryInterface[] | false
|
|
607
|
+
title?: string
|
|
608
|
+
logoSrc?: string
|
|
609
|
+
logoWidth?: string
|
|
610
|
+
logoHeight?: string
|
|
611
|
+
titlePosition?: string
|
|
612
|
+
loggedInUser?: boolean
|
|
613
|
+
gridOverrides?: {
|
|
614
|
+
width?: MQ<string>
|
|
615
|
+
minWidth?: MQ<string>
|
|
616
|
+
maxWidth?: MQ<string>
|
|
617
|
+
height?: MQ<string>
|
|
618
|
+
minHeight?: MQ<string>
|
|
619
|
+
maxHeight?: MQ<string>
|
|
620
|
+
} & {
|
|
621
|
+
marginInlineStart?: MQ<string>
|
|
622
|
+
marginInlineEnd?: MQ<string>
|
|
623
|
+
marginInline?: MQ<string>
|
|
624
|
+
marginBlockStart?: MQ<string>
|
|
625
|
+
marginBlockEnd?: MQ<string>
|
|
626
|
+
marginBlock?: MQ<string>
|
|
627
|
+
}
|
|
628
|
+
}
|
|
629
|
+
```
|
|
630
|
+
|
|
631
|
+
and uses the following interfaces:
|
|
632
|
+
|
|
633
|
+
```
|
|
634
|
+
interface NavigationPrimaryInterface {
|
|
635
|
+
text: string
|
|
636
|
+
link: string
|
|
637
|
+
icon: React.ReactElement<NewsKitIconProps> | null
|
|
638
|
+
ariaLabel?: string
|
|
639
|
+
}
|
|
640
|
+
|
|
641
|
+
interface NavigationPrimaryThemeProps {
|
|
642
|
+
customTheme?: UncompiledTheme
|
|
643
|
+
}
|
|
644
|
+
|
|
645
|
+
type Logo =
|
|
646
|
+
| {
|
|
647
|
+
src?: string
|
|
648
|
+
width?: string
|
|
649
|
+
height?: string
|
|
650
|
+
top?: string
|
|
651
|
+
}
|
|
652
|
+
| undefined
|
|
653
|
+
```
|
|
654
|
+
|
|
655
|
+
# PastDueBanner, PastDueBannerExternal and pastDuebannerDefaultContext
|
|
656
|
+
|
|
657
|
+
PastDueBanner is the component, used to display the notification message when a user's subscription is no longer active or soon to be deactivated. There are several different states of deactivation, each one represented by a slightly different banner. The differences are passed to the component through a context object. In both PastDueBanner and PastDueBannerExternal the context is passed through the `pastDueBanner` prop. The components's props are as follows:
|
|
658
|
+
|
|
659
|
+
- PastDueBanner props:
|
|
660
|
+
|
|
661
|
+
```
|
|
662
|
+
type PastDueBannerProps = {
|
|
663
|
+
className?: string
|
|
664
|
+
pastDueBanner: PastDueBannerType
|
|
665
|
+
userData: Partial<UserData>
|
|
666
|
+
url: string
|
|
667
|
+
}
|
|
668
|
+
```
|
|
669
|
+
|
|
670
|
+
- PastDueBannerExternal props:
|
|
671
|
+
|
|
672
|
+
```
|
|
673
|
+
type PastDueBannerExternalProps = {
|
|
674
|
+
className?: string
|
|
675
|
+
pastDueBanner?: PastDueBannerType
|
|
676
|
+
user: UserData
|
|
677
|
+
wrapper?: React.ComponentType
|
|
678
|
+
theme?: UncompiledTheme
|
|
679
|
+
}
|
|
680
|
+
```
|
|
681
|
+
|
|
682
|
+
If no context is passed to the components, a default context (called pastDueBannerDefaultContext) is used:
|
|
683
|
+
|
|
684
|
+
- the context type is as follows:
|
|
685
|
+
|
|
686
|
+
```
|
|
687
|
+
interface PastDueBannerType {
|
|
688
|
+
firstNotice: Notice
|
|
689
|
+
secondNotice: Notice
|
|
690
|
+
terminated: Notice
|
|
691
|
+
toBeCancelled: Notice
|
|
692
|
+
toBeCancelledWithRefund: Notice
|
|
693
|
+
cancelled: Notice
|
|
694
|
+
treshold: PastDueBannerTreshold
|
|
695
|
+
}
|
|
696
|
+
|
|
697
|
+
type Notice = {
|
|
698
|
+
title: string
|
|
699
|
+
text: string
|
|
700
|
+
dismissDays?: number
|
|
701
|
+
phoneNumber?: string
|
|
702
|
+
button?: string
|
|
703
|
+
link?: {
|
|
704
|
+
linkLocation: string
|
|
705
|
+
linkText: string
|
|
706
|
+
}
|
|
707
|
+
}
|
|
708
|
+
```
|
|
709
|
+
|
|
710
|
+
In this context object parts of the banner's message are placeholders. The placeholders are dynamically replaced with an actual value.
|
|
711
|
+
To add a hyperlink to the banner's message, pass a link prop to the banner in the context. The link prop has this shape :
|
|
712
|
+
|
|
713
|
+
```
|
|
714
|
+
link: {
|
|
715
|
+
|
|
716
|
+
linkLocation: string, // example: 'https://someurl.com'
|
|
717
|
+
|
|
718
|
+
linkText: string, // example: 'click here'
|
|
719
|
+
|
|
720
|
+
},
|
|
721
|
+
```
|
|
722
|
+
|
|
723
|
+
In the text prop, add a ##LINK## placeholder where the hyperlink should be.
|
|
724
|
+
|
|
725
|
+
The `pastDueBannerDefaultContext` contains an example of this in its "terminated" banner:
|
|
726
|
+
|
|
727
|
+
```
|
|
728
|
+
terminated: {
|
|
729
|
+
|
|
730
|
+
title: 'Your subscription has been terminated',
|
|
731
|
+
|
|
732
|
+
phoneNumber: 'XXXX-XXX-XXXX',
|
|
733
|
+
|
|
734
|
+
text:
|
|
735
|
+
|
|
736
|
+
'We didn’t receive payment for your subscription. To reactivate it, please call ##PHONE_NUMBER##. Or click ##LINK##.',
|
|
737
|
+
|
|
738
|
+
dismissDays: 7,
|
|
739
|
+
|
|
740
|
+
link: {
|
|
741
|
+
|
|
742
|
+
linkLocation: 'http://localhost:3000/account',
|
|
743
|
+
|
|
744
|
+
linkText: 'here',
|
|
745
|
+
|
|
746
|
+
},
|
|
747
|
+
|
|
748
|
+
},
|
|
749
|
+
```
|
|
750
|
+
|
|
751
|
+
# RadioForm
|
|
752
|
+
|
|
753
|
+
The RadioForm component combines several Newskit components in a single choice form, including validation. The validation is based on `react-hook-form`. A textarea field can be added to one or more of the radio buttons in the form, in case some extra information needs to be provided with the choice. The form takes the following:
|
|
754
|
+
|
|
755
|
+
- Props:
|
|
756
|
+
|
|
757
|
+
```
|
|
758
|
+
interface RadioFormProps {
|
|
759
|
+
onSubmit: (response: RadioFormResponse) => void
|
|
760
|
+
introductionProps?: Omit<IntroductionProps, 'title' | 'titleOverrides'>
|
|
761
|
+
radioInputList: RadioFormInput[]
|
|
762
|
+
radioInputName?: string
|
|
763
|
+
size?: 'small' | 'medium' | 'large'
|
|
764
|
+
resolver: Resolver
|
|
765
|
+
radioInputListOverrides?: Overrides
|
|
766
|
+
errorOverrides?: Overrides
|
|
767
|
+
inputTextAreaOverrides?: Omit<Overrides, 'marginBlockEnd'> & {
|
|
768
|
+
marginBlockStart?: MQ<string>
|
|
769
|
+
}
|
|
770
|
+
inputAssistiveTextOverrides?: Overrides
|
|
771
|
+
characterCountOverrides?: Overrides
|
|
772
|
+
marginBlockEnd?: MQ<string>
|
|
773
|
+
buttonGroupProps?: ButtonGroupProps
|
|
774
|
+
introductionInlineMessage?: string
|
|
775
|
+
introductionInlineMessageOverrides?: Omit<InlineMessageProps, 'children'> & {
|
|
776
|
+
marginBlockEnd?: MQ<string>
|
|
777
|
+
}
|
|
778
|
+
gridProps?: {
|
|
779
|
+
xsMargin: string
|
|
780
|
+
xsColumnGutter: string
|
|
781
|
+
xsRowGutter: string
|
|
782
|
+
}
|
|
783
|
+
}
|
|
784
|
+
```
|
|
785
|
+
|
|
786
|
+
# SecureFlag
|
|
787
|
+
|
|
788
|
+
SecureFlag is a simple component, used to mark a payment operation as secure. It takes the following:
|
|
789
|
+
|
|
790
|
+
- Props:
|
|
791
|
+
|
|
792
|
+
```
|
|
793
|
+
const props: SecureFlagProps = {
|
|
794
|
+
size,
|
|
795
|
+
overrides,
|
|
796
|
+
iconOverrides,
|
|
797
|
+
icon,
|
|
798
|
+
}
|
|
799
|
+
|
|
800
|
+
interface SecureFlagProps extends FlagProps {
|
|
801
|
+
iconOverrides?: {
|
|
802
|
+
spaceInset?: MQ<string>
|
|
803
|
+
spaceInline?: MQ<string>
|
|
804
|
+
size?: MQ<string>
|
|
805
|
+
stylePreset?: MQ<string>
|
|
806
|
+
}
|
|
807
|
+
icon?: ReactElement<NewsKitIcon>
|
|
808
|
+
}
|
|
809
|
+
```
|
|
810
|
+
|
|
811
|
+
The component has a default styling in the theme, consisting of `size`, `overrides` and `iconOverrides`:
|
|
812
|
+
|
|
813
|
+
```
|
|
814
|
+
const secureFlagDefaultOverrides = {
|
|
815
|
+
stylePreset: 'secureFlagStylePresets',
|
|
816
|
+
typographyPreset: 'utilityLabel010',
|
|
817
|
+
spaceInset: 'space000',
|
|
818
|
+
spaceInline: 'space020',
|
|
819
|
+
}
|
|
820
|
+
|
|
821
|
+
const secureFlagIconDefaultOverrides = {
|
|
822
|
+
spaceInset: 'space000',
|
|
823
|
+
spaceInline: 'space020',
|
|
824
|
+
size: 'iconSize020',
|
|
825
|
+
}
|
|
826
|
+
|
|
827
|
+
const secureFlagComponentDefaults: SecureFlagProps = {
|
|
828
|
+
size: 'small',
|
|
829
|
+
overrides: secureFlagDefaultOverrides,
|
|
830
|
+
iconOverrides: secureFlagIconDefaultOverrides,
|
|
831
|
+
}
|
|
832
|
+
```
|
|
833
|
+
|
|
834
|
+
These are going to be used if no values are passed from the context.
|
|
835
|
+
|
|
836
|
+
# Seo
|
|
837
|
+
|
|
838
|
+
The Seo component is a wrapper around the Next.js native Head component, used to build the `<head>` section of the document. It is used to gurantee a certain minimal level of SEO and takes the following:
|
|
839
|
+
|
|
840
|
+
- Props:
|
|
841
|
+
|
|
842
|
+
```
|
|
843
|
+
const seoProps: SEOProps = {
|
|
844
|
+
title,
|
|
845
|
+
description,
|
|
846
|
+
url,
|
|
847
|
+
siteHost,
|
|
848
|
+
hrefLang = 'en',
|
|
849
|
+
maxImagePreview = 'large',
|
|
850
|
+
gscId,
|
|
851
|
+
fbTitle,
|
|
852
|
+
fbType,
|
|
853
|
+
fbImageUrl,
|
|
854
|
+
twUsername,
|
|
855
|
+
twTitle,
|
|
856
|
+
twDescription,
|
|
857
|
+
twImageUrl,
|
|
858
|
+
twImageAlt,
|
|
859
|
+
}
|
|
860
|
+
|
|
861
|
+
type SEOProps {
|
|
862
|
+
title: string
|
|
863
|
+
description: string
|
|
864
|
+
url: string
|
|
865
|
+
siteHost: string
|
|
866
|
+
hrefLang?: string
|
|
867
|
+
maxImagePreview?: 'none' | 'standard' | 'large'
|
|
868
|
+
gscId?: string
|
|
869
|
+
fbTitle?: string
|
|
870
|
+
fbType: string
|
|
871
|
+
fbImageUrl: string
|
|
872
|
+
twUsername?: string
|
|
873
|
+
twTitle?: string
|
|
874
|
+
twDescription?: string
|
|
875
|
+
twImageUrl?: string
|
|
876
|
+
twImageAlt?: string
|
|
877
|
+
}
|
|
878
|
+
```
|
|
879
|
+
|
|
880
|
+
# SkipToContent
|
|
881
|
+
|
|
882
|
+
A small component, used for accesibility purposes. Allows the page's visitor to use the Tab bitton to skip to the content of the page, and move around it.
|
|
883
|
+
|
|
884
|
+
# SubscriptionDetails
|
|
885
|
+
|
|
886
|
+
The component is a small wrapper around the Newskit'a banner.It's maent to display the name and price of a user's subscription, as well as a button, which reveals the full details on click. The component is used in the mobile/smaller screens view in the payment-details page of the `checkout` package.
|
|
887
|
+
|
|
888
|
+
- Props:
|
|
889
|
+
|
|
890
|
+
```
|
|
891
|
+
interface SubscriptionDetailsProps {
|
|
892
|
+
banner?: {
|
|
893
|
+
buttonText: string
|
|
894
|
+
message: string
|
|
895
|
+
title: string
|
|
896
|
+
onClick?: () => void
|
|
897
|
+
}
|
|
898
|
+
bannerOverrides?: {
|
|
899
|
+
stylePreset: MQ<string>
|
|
900
|
+
spaceInset: MQ<string>
|
|
901
|
+
maxWidth: string
|
|
902
|
+
minHeight: MQ<string>
|
|
903
|
+
content: {
|
|
904
|
+
title: {
|
|
905
|
+
stylePreset: MQ<string>
|
|
906
|
+
}
|
|
907
|
+
message: {
|
|
908
|
+
typographyPreset: MQ<string>
|
|
909
|
+
stylePreset: MQ<string>
|
|
910
|
+
}
|
|
911
|
+
}
|
|
912
|
+
}
|
|
913
|
+
containerOverrides?: {
|
|
914
|
+
stylePreset: MQ<string>
|
|
915
|
+
spaceStack: MQ<string>
|
|
916
|
+
}
|
|
917
|
+
margin?: {
|
|
918
|
+
xsMargin?: string
|
|
919
|
+
smMargin?: string
|
|
920
|
+
mdMargin?: string
|
|
921
|
+
lgMargin?: string
|
|
922
|
+
}
|
|
923
|
+
gutter?: {
|
|
924
|
+
xsColumnGutter?: string
|
|
925
|
+
smColumnGutter?: string
|
|
926
|
+
mdColumnGutter?: string
|
|
927
|
+
lgColumnGutter?: string
|
|
928
|
+
}
|
|
929
|
+
}
|
|
930
|
+
```
|
|
931
|
+
|
|
932
|
+
# SubscriptionDrawer
|
|
933
|
+
|
|
934
|
+
This component uses the Newskit's Drawer component and the [CorePackageContent](#corepackagecontent) to display the full details of a user's subscription on a mobile screen. This is the component that is displayed if the button in SubscriptionDetails is clicked. It takes the following
|
|
935
|
+
|
|
936
|
+
- Props:
|
|
937
|
+
|
|
938
|
+
```
|
|
939
|
+
interface SubscriptionDrawerProps
|
|
940
|
+
extends CorePackageContentProps,
|
|
941
|
+
Omit<DrawerProps, 'children'> {
|
|
942
|
+
size?: string
|
|
943
|
+
}
|
|
944
|
+
```
|
|
945
|
+
|
|
946
|
+
# TitleBar
|
|
947
|
+
|
|
948
|
+
This component displays the title of the CorePackageContent and takes the following
|
|
949
|
+
|
|
950
|
+
- Props:
|
|
951
|
+
|
|
952
|
+
```
|
|
953
|
+
interface TitleBarProps
|
|
954
|
+
extends Omit<NKTitleBarProps, 'children' | 'actionItem'> {
|
|
955
|
+
text: string
|
|
956
|
+
spaceStack?: MQ<string>
|
|
957
|
+
link?: {
|
|
958
|
+
text: string
|
|
959
|
+
href: string
|
|
960
|
+
'aria-label'?: string
|
|
961
|
+
}
|
|
962
|
+
linkOverriders?: {
|
|
963
|
+
stylePreset?: MQ<string>
|
|
964
|
+
typographyPreset?: MQ<string>
|
|
965
|
+
spaceInset?: MQ<string>
|
|
966
|
+
spaceStack?: MQ<string>
|
|
967
|
+
iconSize?: MQ<string>
|
|
968
|
+
}
|
|
969
|
+
}
|
|
970
|
+
```
|