@telus-uds/components-base 0.0.2-prerelease.4 → 0.0.2-prerelease.5
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 +17 -0
- package/__fixtures__/testTheme.js +83 -11
- package/__tests__/Divider/Divider.test.jsx +26 -5
- package/__tests__/Feedback/Feedback.test.jsx +42 -0
- package/__tests__/Spacer/Spacer.test.jsx +63 -0
- package/__tests__/StackView/StackView.test.jsx +242 -0
- package/__tests__/StackView/StackWrap.test.jsx +47 -0
- package/__tests__/StackView/getStackedContent.test.jsx +295 -0
- package/__tests__/TextInput/TextInput.test.jsx +146 -0
- package/__tests__/utils/useUniqueId.test.js +31 -0
- package/lib/Box/Box.js +7 -2
- package/lib/Button/ButtonBase.js +6 -16
- package/lib/Button/ButtonGroup.js +13 -22
- package/lib/Divider/Divider.js +40 -2
- package/lib/Feedback/Feedback.js +110 -0
- package/lib/Feedback/index.js +2 -0
- package/lib/Icon/Icon.js +1 -1
- package/lib/InputLabel/InputLabel.js +86 -0
- package/lib/InputLabel/LabelContent.native.js +8 -0
- package/lib/InputLabel/LabelContent.web.js +17 -0
- package/lib/InputLabel/index.js +2 -0
- package/lib/Link/LinkBase.js +9 -3
- package/lib/Spacer/Spacer.js +98 -0
- package/lib/Spacer/index.js +2 -0
- package/lib/StackView/StackView.js +105 -0
- package/lib/StackView/StackWrap.js +32 -0
- package/lib/StackView/StackWrap.native.js +3 -0
- package/lib/StackView/StackWrapBox.js +85 -0
- package/lib/StackView/StackWrapGap.js +45 -0
- package/lib/StackView/common.js +30 -0
- package/lib/StackView/getStackedContent.js +111 -0
- package/lib/StackView/index.js +5 -0
- package/lib/TextInput/TextInput.js +337 -0
- package/lib/TextInput/index.js +2 -0
- package/lib/Typography/Typography.js +0 -4
- package/lib/index.js +6 -1
- package/lib/utils/input.js +3 -1
- package/lib/utils/propTypes.js +9 -1
- package/lib/utils/useUniqueId.js +12 -0
- package/package.json +2 -2
- package/release-context.json +4 -4
- package/src/Box/Box.jsx +4 -2
- package/src/Button/ButtonBase.jsx +6 -18
- package/src/Button/ButtonGroup.jsx +13 -17
- package/src/Divider/Divider.jsx +38 -3
- package/src/Feedback/Feedback.jsx +99 -0
- package/src/Feedback/index.js +3 -0
- package/src/Icon/Icon.jsx +2 -1
- package/src/InputLabel/InputLabel.jsx +99 -0
- package/src/InputLabel/LabelContent.native.jsx +6 -0
- package/src/InputLabel/LabelContent.web.jsx +13 -0
- package/src/InputLabel/index.js +3 -0
- package/src/Link/LinkBase.jsx +9 -3
- package/src/Spacer/Spacer.jsx +91 -0
- package/src/Spacer/index.js +3 -0
- package/src/StackView/StackView.jsx +103 -0
- package/src/StackView/StackWrap.jsx +33 -0
- package/src/StackView/StackWrap.native.jsx +4 -0
- package/src/StackView/StackWrapBox.jsx +82 -0
- package/src/StackView/StackWrapGap.jsx +39 -0
- package/src/StackView/common.jsx +28 -0
- package/src/StackView/getStackedContent.jsx +106 -0
- package/src/StackView/index.js +6 -0
- package/src/TextInput/TextInput.jsx +325 -0
- package/src/TextInput/index.js +3 -0
- package/src/Typography/Typography.jsx +0 -4
- package/src/index.js +6 -1
- package/src/utils/input.js +2 -1
- package/src/utils/propTypes.js +9 -0
- package/src/utils/useUniqueId.js +14 -0
- package/stories/A11yText/A11yText.stories.jsx +11 -5
- package/stories/ActivityIndicator/ActivityIndicator.stories.jsx +11 -2
- package/stories/Box/Box.stories.jsx +29 -2
- package/stories/Button/Button.stories.jsx +17 -21
- package/stories/Button/ButtonGroup.stories.jsx +2 -1
- package/stories/Button/ButtonLink.stories.jsx +6 -4
- package/stories/Card/Card.stories.jsx +13 -1
- package/stories/Divider/Divider.stories.jsx +26 -2
- package/stories/ExpandCollapse/ExpandCollapse.stories.jsx +74 -79
- package/stories/Feedback/Feedback.stories.jsx +97 -0
- package/stories/FlexGrid/01 FlexGrid.stories.jsx +20 -7
- package/stories/Icon/Icon.stories.jsx +11 -3
- package/stories/InputLabel/InputLabel.stories.jsx +37 -0
- package/stories/Link/ChevronLink.stories.jsx +20 -4
- package/stories/Link/Link.stories.jsx +24 -2
- package/stories/Link/TextButton.stories.jsx +24 -2
- package/stories/Pagination/Pagination.stories.jsx +28 -14
- package/stories/SideNav/SideNav.stories.jsx +17 -2
- package/stories/Spacer/Spacer.stories.jsx +33 -0
- package/stories/StackView/StackView.stories.jsx +65 -0
- package/stories/StackView/StackWrap.stories.jsx +52 -0
- package/stories/TextInput/TextInput.stories.jsx +103 -0
- package/stories/ToggleSwitch/ToggleSwitch.stories.jsx +16 -3
- package/stories/Typography/Typography.stories.jsx +12 -3
- package/stories/platform-supports.web.jsx +1 -1
- package/stories/supports.jsx +109 -13
|
@@ -1,12 +1,17 @@
|
|
|
1
|
+
/* eslint-disable react/no-multi-comp */
|
|
1
2
|
import React from 'react'
|
|
2
3
|
import { View, StyleSheet } from 'react-native'
|
|
3
4
|
import { Divider, Typography } from '../../lib'
|
|
5
|
+
import { EachParentType, parentTypesParams } from '../supports'
|
|
4
6
|
|
|
5
7
|
export default {
|
|
6
8
|
title: 'Base/Divider',
|
|
7
9
|
component: Divider
|
|
8
10
|
}
|
|
9
11
|
|
|
12
|
+
export const Default = (args) => <Divider {...args} />
|
|
13
|
+
Default.storyName = 'Divider'
|
|
14
|
+
|
|
10
15
|
const Template = ({ vertical, ...rest }) => (
|
|
11
16
|
<View style={vertical ? styles.row : styles.column}>
|
|
12
17
|
<View style={vertical ? styles.contentRow : styles.contentColumn}>
|
|
@@ -24,8 +29,27 @@ const Template = ({ vertical, ...rest }) => (
|
|
|
24
29
|
|
|
25
30
|
Template.propTypes = Divider.propTypes
|
|
26
31
|
|
|
27
|
-
export const
|
|
28
|
-
|
|
32
|
+
export const Horizontal = Template.bind({})
|
|
33
|
+
|
|
34
|
+
export const Vertical = Template.bind({})
|
|
35
|
+
Vertical.args = { vertical: true }
|
|
36
|
+
|
|
37
|
+
export const ParentTypes = (args) => (
|
|
38
|
+
<EachParentType componentThemeName="Divider" {...args}>
|
|
39
|
+
{({ label, variant, index }) =>
|
|
40
|
+
label.match(/Row/) ? (
|
|
41
|
+
<Typography>{index ? '' : 'Skipping Row examples; see Vertical story. '}</Typography>
|
|
42
|
+
) : (
|
|
43
|
+
<>
|
|
44
|
+
<Typography>{`"${label}" is below this moderately lengthy text appearing before the Divider.`}</Typography>
|
|
45
|
+
<Divider {...args} variant={variant} />
|
|
46
|
+
<Typography>{`"${label}" is above.`}</Typography>
|
|
47
|
+
</>
|
|
48
|
+
)
|
|
49
|
+
}
|
|
50
|
+
</EachParentType>
|
|
51
|
+
)
|
|
52
|
+
ParentTypes.parameters = parentTypesParams
|
|
29
53
|
|
|
30
54
|
const styles = StyleSheet.create({
|
|
31
55
|
row: {
|
|
@@ -1,14 +1,8 @@
|
|
|
1
1
|
/* eslint-disable react/no-multi-comp */
|
|
2
2
|
import React from 'react'
|
|
3
3
|
import PropTypes from 'prop-types'
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
ButtonGroup,
|
|
7
|
-
Divider,
|
|
8
|
-
ExpandCollapse,
|
|
9
|
-
Typography
|
|
10
|
-
} from '../../lib'
|
|
11
|
-
import { Container } from '../supports'
|
|
4
|
+
import { Accordion, ButtonGroup, ExpandCollapse, StackView, Typography } from '../../lib'
|
|
5
|
+
import { Container, EachParentType, parentTypesParams } from '../supports'
|
|
12
6
|
import { useMultipleInputValues } from '../../lib/utils'
|
|
13
7
|
|
|
14
8
|
export default {
|
|
@@ -27,48 +21,42 @@ SimpleText.propTypes = {
|
|
|
27
21
|
children: PropTypes.node
|
|
28
22
|
}
|
|
29
23
|
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
<
|
|
33
|
-
{
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
panelId="third"
|
|
59
|
-
control={<SimpleText bold>Last panel</SimpleText>}
|
|
60
|
-
>
|
|
61
|
-
<SimpleText>Some content within the last panel</SimpleText>
|
|
62
|
-
</ExpandCollapse.Panel>
|
|
63
|
-
</>
|
|
64
|
-
)}
|
|
65
|
-
</ExpandComponent>
|
|
66
|
-
)
|
|
67
|
-
return Template
|
|
68
|
-
}
|
|
24
|
+
const exampleRenderFunction = (expandProps, label = 'Non-interactive item') => (
|
|
25
|
+
<StackView divider space={2}>
|
|
26
|
+
<ExpandCollapse.Panel
|
|
27
|
+
{...expandProps}
|
|
28
|
+
panelId="first"
|
|
29
|
+
control={<SimpleText bold>First panel</SimpleText>}
|
|
30
|
+
>
|
|
31
|
+
<SimpleText>Some content within the first panel</SimpleText>
|
|
32
|
+
</ExpandCollapse.Panel>
|
|
33
|
+
<ExpandCollapse.Panel
|
|
34
|
+
{...expandProps}
|
|
35
|
+
panelId="second"
|
|
36
|
+
control={<SimpleText bold>Second panel</SimpleText>}
|
|
37
|
+
>
|
|
38
|
+
<SimpleText>Some content within the second panel</SimpleText>
|
|
39
|
+
</ExpandCollapse.Panel>
|
|
40
|
+
<Container>
|
|
41
|
+
<SimpleText>{label}</SimpleText>
|
|
42
|
+
</Container>
|
|
43
|
+
<ExpandCollapse.Panel
|
|
44
|
+
{...expandProps}
|
|
45
|
+
panelId="third"
|
|
46
|
+
control={<SimpleText bold>Last panel</SimpleText>}
|
|
47
|
+
>
|
|
48
|
+
<SimpleText>Some content within the last panel</SimpleText>
|
|
49
|
+
</ExpandCollapse.Panel>
|
|
50
|
+
</StackView>
|
|
51
|
+
)
|
|
69
52
|
|
|
70
|
-
export const Default =
|
|
71
|
-
|
|
53
|
+
export const Default = (args) => <ExpandCollapse {...args} />
|
|
54
|
+
Default.storyName = 'ExpandCollapse'
|
|
55
|
+
Default.args = { children: exampleRenderFunction }
|
|
56
|
+
|
|
57
|
+
export const AccordionStory = (args) => <Accordion {...args} />
|
|
58
|
+
AccordionStory.storyName = 'Accordion'
|
|
59
|
+
AccordionStory.args = { children: exampleRenderFunction }
|
|
72
60
|
|
|
73
61
|
// This is an edge case but TDS's ExpandCollapse only worked in this externally-controlled
|
|
74
62
|
// way, so supporting it cleanly will make transition easier at low cost. Button group
|
|
@@ -79,39 +67,46 @@ export const Controlled = ({ maxOpen = null, ...args }) => {
|
|
|
79
67
|
})
|
|
80
68
|
const itemNames = ['one', 'two', 'three', 'four']
|
|
81
69
|
return (
|
|
82
|
-
|
|
83
|
-
<
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
<
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
}
|
|
109
|
-
</ExpandCollapse>
|
|
110
|
-
</Container>
|
|
111
|
-
</>
|
|
70
|
+
<StackView space={6}>
|
|
71
|
+
<ButtonGroup
|
|
72
|
+
items={itemNames.map((item) => ({
|
|
73
|
+
label: item
|
|
74
|
+
}))}
|
|
75
|
+
maxValues={null}
|
|
76
|
+
values={currentValues}
|
|
77
|
+
onChange={setValues}
|
|
78
|
+
/>
|
|
79
|
+
<ExpandCollapse {...args} open={currentValues} onChange={setValues} maxValues={maxOpen}>
|
|
80
|
+
{(expandProps) => (
|
|
81
|
+
<StackView divider>
|
|
82
|
+
{itemNames.map((itemName) => (
|
|
83
|
+
<ExpandCollapse.Panel
|
|
84
|
+
{...expandProps}
|
|
85
|
+
key={itemName}
|
|
86
|
+
panelId={itemName}
|
|
87
|
+
control={<SimpleText bold>{itemName}</SimpleText>}
|
|
88
|
+
>
|
|
89
|
+
<SimpleText>{`Some content within panel number ${itemName}`}</SimpleText>
|
|
90
|
+
</ExpandCollapse.Panel>
|
|
91
|
+
))}
|
|
92
|
+
</StackView>
|
|
93
|
+
)}
|
|
94
|
+
</ExpandCollapse>
|
|
95
|
+
</StackView>
|
|
112
96
|
)
|
|
113
97
|
}
|
|
114
98
|
Controlled.propTypes = {
|
|
115
99
|
maxOpen: PropTypes.number
|
|
116
100
|
}
|
|
117
101
|
Controlled.args = {}
|
|
102
|
+
|
|
103
|
+
export const ParentTypes = (args) => (
|
|
104
|
+
<EachParentType componentThemeName="ExpandCollapse" {...args}>
|
|
105
|
+
{({ label, variant }) => (
|
|
106
|
+
<ExpandCollapse {...args} variant={variant}>
|
|
107
|
+
{(expandProps) => exampleRenderFunction(expandProps, label)}
|
|
108
|
+
</ExpandCollapse>
|
|
109
|
+
)}
|
|
110
|
+
</EachParentType>
|
|
111
|
+
)
|
|
112
|
+
ParentTypes.parameters = parentTypesParams
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import React, { useEffect, useState } from 'react'
|
|
2
|
+
import { Text } from 'react-native'
|
|
3
|
+
|
|
4
|
+
import { Feedback, Typography } from '../../lib'
|
|
5
|
+
import { Container } from '../supports'
|
|
6
|
+
import TextInput from '../../lib/TextInput'
|
|
7
|
+
|
|
8
|
+
export default {
|
|
9
|
+
title: 'Base/Feedback',
|
|
10
|
+
component: Feedback
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/* eslint-disable react/no-multi-comp */
|
|
14
|
+
|
|
15
|
+
const Template = (args) => (
|
|
16
|
+
<Container>
|
|
17
|
+
<Feedback {...args} />
|
|
18
|
+
</Container>
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
export const Default = Template.bind({})
|
|
22
|
+
Default.args = { title: 'Title', children: 'String content' }
|
|
23
|
+
Default.storyName = 'Feedback'
|
|
24
|
+
|
|
25
|
+
export const RenderFunctionAndChildren = () => (
|
|
26
|
+
<>
|
|
27
|
+
<Container>
|
|
28
|
+
<Feedback title="Render function">
|
|
29
|
+
{({ textStyles }) => <Text style={textStyles}>Content from function</Text>}
|
|
30
|
+
</Feedback>
|
|
31
|
+
</Container>
|
|
32
|
+
<Container>
|
|
33
|
+
<Feedback title="Children">
|
|
34
|
+
<Typography>Content from children</Typography>
|
|
35
|
+
</Feedback>
|
|
36
|
+
</Container>
|
|
37
|
+
</>
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
export const Variants = () => (
|
|
41
|
+
<>
|
|
42
|
+
<Container>
|
|
43
|
+
<Feedback variant={{ state: 'success' }} title="Success">
|
|
44
|
+
{({ textStyles }) => <Text style={textStyles}>Content from function</Text>}
|
|
45
|
+
</Feedback>
|
|
46
|
+
</Container>
|
|
47
|
+
<Container>
|
|
48
|
+
<Feedback variant={{ state: 'success', icon: true }} title="Success with icon">
|
|
49
|
+
{({ textStyles }) => <Text style={textStyles}>Content from function</Text>}
|
|
50
|
+
</Feedback>
|
|
51
|
+
</Container>
|
|
52
|
+
<Container>
|
|
53
|
+
<Feedback variant={{ state: 'error' }} title="Error">
|
|
54
|
+
{({ textStyles }) => <Text style={textStyles}>Content from function</Text>}
|
|
55
|
+
</Feedback>
|
|
56
|
+
</Container>
|
|
57
|
+
<Container>
|
|
58
|
+
<Feedback variant={{ state: 'error', icon: true }} title="Error with icon">
|
|
59
|
+
{({ textStyles }) => <Text style={textStyles}>Content from function</Text>}
|
|
60
|
+
</Feedback>
|
|
61
|
+
</Container>
|
|
62
|
+
</>
|
|
63
|
+
)
|
|
64
|
+
|
|
65
|
+
export const WithinInput = () => {
|
|
66
|
+
const [value, setValue] = useState('')
|
|
67
|
+
const [validation, setValidation] = useState()
|
|
68
|
+
|
|
69
|
+
useEffect(() => {
|
|
70
|
+
if (value !== undefined && value.length > 0)
|
|
71
|
+
setValidation(value.length < 6 ? 'success' : 'error')
|
|
72
|
+
}, [value])
|
|
73
|
+
|
|
74
|
+
const defaultFeedbackContent =
|
|
75
|
+
'Will show an error if longer than 6 characters and success otherwise'
|
|
76
|
+
|
|
77
|
+
const feedbackContent = {
|
|
78
|
+
error: 'The value must be shorter than 6 characters',
|
|
79
|
+
success: 'Yay! The value has less than 6 characters'
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
const feedback = validation === undefined ? defaultFeedbackContent : feedbackContent[validation]
|
|
83
|
+
|
|
84
|
+
return (
|
|
85
|
+
<>
|
|
86
|
+
<Container>
|
|
87
|
+
<TextInput
|
|
88
|
+
label="Controlled"
|
|
89
|
+
validation={validation}
|
|
90
|
+
feedback={feedback}
|
|
91
|
+
value={value}
|
|
92
|
+
onChange={setValue}
|
|
93
|
+
/>
|
|
94
|
+
</Container>
|
|
95
|
+
</>
|
|
96
|
+
)
|
|
97
|
+
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
/* eslint-disable react/no-multi-comp */
|
|
1
2
|
import React from 'react'
|
|
2
3
|
|
|
3
4
|
import { FlexGrid } from '../../lib'
|
|
4
|
-
import { Placeholder } from '../supports'
|
|
5
|
+
import { Placeholder, EachParentType, parentTypesParams } from '../supports'
|
|
5
6
|
|
|
6
7
|
const { Row, Col } = FlexGrid
|
|
7
8
|
|
|
@@ -10,11 +11,11 @@ export default {
|
|
|
10
11
|
component: FlexGrid
|
|
11
12
|
}
|
|
12
13
|
|
|
13
|
-
const
|
|
14
|
-
|
|
14
|
+
const getContent = (label = '1/6') => (
|
|
15
|
+
<>
|
|
15
16
|
<Row>
|
|
16
17
|
<Col>
|
|
17
|
-
<Placeholder margin>
|
|
18
|
+
<Placeholder margin>{label}</Placeholder>
|
|
18
19
|
</Col>
|
|
19
20
|
<Col>
|
|
20
21
|
<Placeholder margin>2/6</Placeholder>
|
|
@@ -34,8 +35,20 @@ const Template = (args) => (
|
|
|
34
35
|
<Placeholder margin>6/6</Placeholder>
|
|
35
36
|
</Col>
|
|
36
37
|
</Row>
|
|
37
|
-
|
|
38
|
+
</>
|
|
38
39
|
)
|
|
39
40
|
|
|
40
|
-
export const
|
|
41
|
-
|
|
41
|
+
export const Default = (args) => <FlexGrid {...args} />
|
|
42
|
+
Default.storyName = 'FlexGrid'
|
|
43
|
+
Default.args = { children: getContent() }
|
|
44
|
+
|
|
45
|
+
export const ParentTypes = (args) => (
|
|
46
|
+
<EachParentType {...args}>
|
|
47
|
+
{({ label, variant }) => (
|
|
48
|
+
<FlexGrid {...args} variant={variant}>
|
|
49
|
+
{getContent(label)}
|
|
50
|
+
</FlexGrid>
|
|
51
|
+
)}
|
|
52
|
+
</EachParentType>
|
|
53
|
+
)
|
|
54
|
+
ParentTypes.parameters = parentTypesParams
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
/* eslint-disable react/no-multi-comp */
|
|
1
2
|
import React from 'react'
|
|
2
3
|
import { StyleSheet, Text } from 'react-native'
|
|
3
4
|
import AccessibleIcon from '../../__fixtures__/accessible.icon.svg'
|
|
4
|
-
import { Container, useVariants } from '../supports'
|
|
5
|
+
import { Container, useVariants, EachParentType, parentTypesParams } from '../supports'
|
|
5
6
|
|
|
6
7
|
export default {
|
|
7
8
|
title: 'Base/Icon',
|
|
@@ -29,7 +30,9 @@ export default {
|
|
|
29
30
|
}
|
|
30
31
|
}
|
|
31
32
|
|
|
32
|
-
const
|
|
33
|
+
export const ExampleIcon = (args) => <AccessibleIcon {...args} />
|
|
34
|
+
|
|
35
|
+
export const IconVariants = (args) => {
|
|
33
36
|
const variants = useVariants('Icon')
|
|
34
37
|
return variants.map(([key, value, label]) => (
|
|
35
38
|
<Container key={label} dark={value === 'white'}>
|
|
@@ -39,7 +42,12 @@ const Template = (args) => {
|
|
|
39
42
|
))
|
|
40
43
|
}
|
|
41
44
|
|
|
42
|
-
export const
|
|
45
|
+
export const ParentTypes = (args) => (
|
|
46
|
+
<EachParentType {...args}>
|
|
47
|
+
{({ label }) => <AccessibleIcon {...args} label={label} />}
|
|
48
|
+
</EachParentType>
|
|
49
|
+
)
|
|
50
|
+
ParentTypes.parameters = parentTypesParams
|
|
43
51
|
|
|
44
52
|
const styles = StyleSheet.create({
|
|
45
53
|
subtle: {
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/* eslint-disable react/no-multi-comp */
|
|
2
|
+
import React from 'react'
|
|
3
|
+
|
|
4
|
+
import InputLabel from '../../lib/InputLabel/InputLabel'
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
title: 'Base/InputLabel',
|
|
8
|
+
component: InputLabel
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export const Default = () => <InputLabel label="Test label" />
|
|
12
|
+
|
|
13
|
+
export const HintInline = () => (
|
|
14
|
+
<InputLabel label="Test label" hint="Short hint" hintPosition="inline" />
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
export const HintAndTooltip = () => (
|
|
18
|
+
<InputLabel label="Test label" hint="Short hint" hintPosition="inline" tooltip="?" />
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
export const HintInlineLong = () => (
|
|
22
|
+
<InputLabel
|
|
23
|
+
label="Test label"
|
|
24
|
+
hint="A rather long hint that won't actually fit"
|
|
25
|
+
hintPosition="inline"
|
|
26
|
+
tooltip="?"
|
|
27
|
+
/>
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
export const HintBelow = () => (
|
|
31
|
+
<InputLabel
|
|
32
|
+
label="Test label"
|
|
33
|
+
hint="A rather long hint that won't actually fit"
|
|
34
|
+
hintPosition="below"
|
|
35
|
+
tooltip="?"
|
|
36
|
+
/>
|
|
37
|
+
)
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
/* eslint-disable react/no-multi-comp */
|
|
1
2
|
import React from 'react'
|
|
2
3
|
|
|
3
4
|
import { ChevronLink } from '../../lib'
|
|
4
|
-
import { Container, useVariants } from '../supports'
|
|
5
|
+
import { Container, EachParentType, parentTypesParams, useVariants } from '../supports'
|
|
5
6
|
|
|
6
7
|
export default {
|
|
7
8
|
title: 'Base/ChevronLink',
|
|
@@ -26,7 +27,22 @@ const Template = (args) => {
|
|
|
26
27
|
.filter((exists) => exists)
|
|
27
28
|
}
|
|
28
29
|
|
|
29
|
-
export const
|
|
30
|
+
export const Default = (args) => <ChevronLink {...args} />
|
|
31
|
+
Default.storyName = 'ChevronLink'
|
|
32
|
+
Default.args = { children: "I'm a chevron link" }
|
|
30
33
|
|
|
31
|
-
export const
|
|
32
|
-
|
|
34
|
+
export const VariantsRight = Template.bind({})
|
|
35
|
+
|
|
36
|
+
export const VariantsLeft = Template.bind({})
|
|
37
|
+
VariantsLeft.args = { direction: 'left' }
|
|
38
|
+
|
|
39
|
+
export const ParentTypes = (args) => (
|
|
40
|
+
<EachParentType componentThemeName="Link" {...args}>
|
|
41
|
+
{({ label, variant }) => (
|
|
42
|
+
<ChevronLink {...args} variant={variant}>
|
|
43
|
+
{label}
|
|
44
|
+
</ChevronLink>
|
|
45
|
+
)}
|
|
46
|
+
</EachParentType>
|
|
47
|
+
)
|
|
48
|
+
ParentTypes.parameters = parentTypesParams
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* eslint-disable react/no-multi-comp */
|
|
1
2
|
import React from 'react'
|
|
2
3
|
import { View } from 'react-native'
|
|
3
4
|
|
|
@@ -6,7 +7,7 @@ import { View } from 'react-native'
|
|
|
6
7
|
import * as Icons from '@telus-uds/palette-allium/build/rn/icons'
|
|
7
8
|
|
|
8
9
|
import { Link, variantProp } from '../../lib'
|
|
9
|
-
import { Container, useVariants } from '../supports'
|
|
10
|
+
import { Container, EachParentType, parentTypesParams, useVariants } from '../supports'
|
|
10
11
|
|
|
11
12
|
export default {
|
|
12
13
|
title: 'Base/Link',
|
|
@@ -47,7 +48,11 @@ const EveryIconTemplate = (args) => (
|
|
|
47
48
|
</View>
|
|
48
49
|
)
|
|
49
50
|
|
|
50
|
-
export const
|
|
51
|
+
export const Default = (args) => <Link {...args} />
|
|
52
|
+
Default.storyName = 'Link'
|
|
53
|
+
Default.args = { children: "I'm a link" }
|
|
54
|
+
|
|
55
|
+
export const Variants = Template.bind({})
|
|
51
56
|
|
|
52
57
|
export const IconLeft = Template.bind({})
|
|
53
58
|
IconLeft.args = { icon: SampleIcon, iconPosition: 'left' }
|
|
@@ -56,3 +61,20 @@ export const IconRight = Template.bind({})
|
|
|
56
61
|
IconRight.args = { icon: SampleIcon, iconPosition: 'right' }
|
|
57
62
|
|
|
58
63
|
export const EveryIcon = EveryIconTemplate.bind({})
|
|
64
|
+
|
|
65
|
+
export const ParentTypes = (args) => (
|
|
66
|
+
<EachParentType componentThemeName="Link" {...args}>
|
|
67
|
+
{({ label, variant }) => (
|
|
68
|
+
<Link {...args} key={label} variant={variant}>
|
|
69
|
+
{label}
|
|
70
|
+
</Link>
|
|
71
|
+
)}
|
|
72
|
+
</EachParentType>
|
|
73
|
+
)
|
|
74
|
+
ParentTypes.parameters = parentTypesParams
|
|
75
|
+
|
|
76
|
+
export const IconLeftParentTypes = ParentTypes.bind({})
|
|
77
|
+
IconLeftParentTypes.args = { ...IconLeft.args }
|
|
78
|
+
|
|
79
|
+
export const IconRightParentTypes = ParentTypes.bind({})
|
|
80
|
+
IconRightParentTypes.args = { ...IconRight.args }
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* eslint-disable react/no-multi-comp */
|
|
1
2
|
import React from 'react'
|
|
2
3
|
import { View } from 'react-native'
|
|
3
4
|
|
|
@@ -6,7 +7,7 @@ import { View } from 'react-native'
|
|
|
6
7
|
import * as Icons from '@telus-uds/palette-allium/build/rn/icons'
|
|
7
8
|
|
|
8
9
|
import { TextButton, variantProp } from '../../lib'
|
|
9
|
-
import { Container, useVariants } from '../supports'
|
|
10
|
+
import { Container, EachParentType, useVariants, parentTypesParams } from '../supports'
|
|
10
11
|
|
|
11
12
|
export default {
|
|
12
13
|
title: 'Base/TextButton',
|
|
@@ -46,7 +47,11 @@ const EveryIconTemplate = (args) => (
|
|
|
46
47
|
</View>
|
|
47
48
|
)
|
|
48
49
|
|
|
49
|
-
export const
|
|
50
|
+
export const Default = (args) => <TextButton {...args} />
|
|
51
|
+
Default.storyName = 'TextButton'
|
|
52
|
+
Default.args = { children: "I'm a button that looks like a link" }
|
|
53
|
+
|
|
54
|
+
export const Variants = Template.bind({})
|
|
50
55
|
|
|
51
56
|
export const IconLeft = Template.bind({})
|
|
52
57
|
IconLeft.args = { icon: SampleIcon }
|
|
@@ -55,3 +60,20 @@ export const IconRight = Template.bind({})
|
|
|
55
60
|
IconRight.args = { icon: SampleIcon, iconPosition: 'right' }
|
|
56
61
|
|
|
57
62
|
export const EveryIcon = EveryIconTemplate.bind({})
|
|
63
|
+
|
|
64
|
+
export const ParentTypes = (args) => (
|
|
65
|
+
<EachParentType componentThemeName="Link" {...args}>
|
|
66
|
+
{({ label, variant }) => (
|
|
67
|
+
<TextButton {...args} key={label} variant={variant}>
|
|
68
|
+
{label}
|
|
69
|
+
</TextButton>
|
|
70
|
+
)}
|
|
71
|
+
</EachParentType>
|
|
72
|
+
)
|
|
73
|
+
ParentTypes.parameters = parentTypesParams
|
|
74
|
+
|
|
75
|
+
export const IconLeftParentTypes = ParentTypes.bind({})
|
|
76
|
+
IconLeftParentTypes.args = { ...IconLeft.args }
|
|
77
|
+
|
|
78
|
+
export const IconRightParentTypes = ParentTypes.bind({})
|
|
79
|
+
IconRightParentTypes.args = { ...IconRight.args }
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
+
/* eslint-disable react/no-multi-comp */
|
|
1
2
|
import React, { useState } from 'react'
|
|
3
|
+
import PropTypes from 'prop-types'
|
|
2
4
|
|
|
3
5
|
import { Pagination, Typography } from '../../lib'
|
|
4
|
-
import { Container } from '../supports'
|
|
6
|
+
import { Container, EachParentType, parentTypesParams } from '../supports'
|
|
5
7
|
|
|
6
8
|
export default {
|
|
7
9
|
title: 'Base/Pagination',
|
|
8
10
|
component: Pagination
|
|
9
11
|
}
|
|
10
12
|
|
|
11
|
-
export const Default = () => (
|
|
12
|
-
|
|
13
|
-
<Pagination
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
</Pagination>
|
|
19
|
-
</>
|
|
13
|
+
export const Default = (args) => (
|
|
14
|
+
<Pagination {...args}>
|
|
15
|
+
<Pagination.PageButton href="#test" hrefAttrs={{ target: '_blank' }} />
|
|
16
|
+
<Pagination.PageButton onPress={() => {}} isActive />
|
|
17
|
+
<Pagination.PageButton onPress={() => {}} />
|
|
18
|
+
<Pagination.PageButton onPress={() => {}} />
|
|
19
|
+
</Pagination>
|
|
20
20
|
)
|
|
21
|
+
Default.storyName = 'Pagination'
|
|
21
22
|
|
|
22
|
-
|
|
23
|
-
export const LocalTabs = () => {
|
|
23
|
+
export const LocalTabs = ({ label, ...args }) => {
|
|
24
24
|
const [activeItemIndex, setActiveItemIndex] = useState(0)
|
|
25
25
|
|
|
26
26
|
const items = []
|
|
@@ -29,13 +29,16 @@ export const LocalTabs = () => {
|
|
|
29
29
|
items.push(`Panel ${i + 1}`)
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
+
const activeItem = items[activeItemIndex]
|
|
33
|
+
const labelText = label ? `${activeItem} (${label}). ` : activeItem
|
|
34
|
+
|
|
32
35
|
/* eslint-disable react/no-array-index-key */
|
|
33
36
|
return (
|
|
34
37
|
<>
|
|
35
38
|
<Container>
|
|
36
|
-
<Typography>{
|
|
39
|
+
<Typography>{labelText}</Typography>
|
|
37
40
|
</Container>
|
|
38
|
-
<Pagination>
|
|
41
|
+
<Pagination {...args}>
|
|
39
42
|
{items.map((item, index) => (
|
|
40
43
|
<Pagination.PageButton
|
|
41
44
|
key={index}
|
|
@@ -48,3 +51,14 @@ export const LocalTabs = () => {
|
|
|
48
51
|
)
|
|
49
52
|
/* eslint-enable react/no-array-index-key */
|
|
50
53
|
}
|
|
54
|
+
LocalTabs.propTypes = {
|
|
55
|
+
...Pagination.propTypes,
|
|
56
|
+
label: PropTypes.string
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export const ParentTypes = (args) => (
|
|
60
|
+
<EachParentType componentThemeName="Pagination" {...args}>
|
|
61
|
+
{({ label, variant }) => <LocalTabs {...args} variant={variant} label={label} />}
|
|
62
|
+
</EachParentType>
|
|
63
|
+
)
|
|
64
|
+
ParentTypes.parameters = parentTypesParams
|