@telus-uds/components-base 1.5.0 → 1.6.0
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/.turbo/turbo-build.log +8 -8
- package/.turbo/turbo-lint.log +13 -0
- package/CHANGELOG.json +98 -1
- package/CHANGELOG.md +24 -2
- package/__tests__/FlexGrid/Row.test.jsx +100 -25
- package/__tests__/utils/containUniqueFields.test.js +25 -0
- package/component-docs.json +18 -2
- package/lib/Button/ButtonBase.js +1 -1
- package/lib/Button/ButtonGroup.js +20 -12
- package/lib/Card/PressableCardBase.js +1 -1
- package/lib/Checkbox/Checkbox.js +27 -16
- package/lib/Checkbox/CheckboxGroup.js +19 -5
- package/lib/ExpandCollapse/Panel.js +10 -10
- package/lib/FlexGrid/Col/Col.js +13 -3
- package/lib/FlexGrid/Row/Row.js +8 -2
- package/lib/InputLabel/InputLabel.js +27 -25
- package/lib/Link/LinkBase.js +19 -6
- package/lib/Modal/Modal.js +18 -18
- package/lib/Radio/Radio.js +23 -12
- package/lib/Radio/RadioGroup.js +12 -3
- package/lib/RadioCard/RadioCard.js +1 -1
- package/lib/RadioCard/RadioCardGroup.js +11 -2
- package/lib/Select/Select.js +2 -3
- package/lib/Tags/Tags.js +23 -17
- package/lib/TextInput/TextArea.js +2 -2
- package/lib/TextInput/TextInput.js +12 -2
- package/lib/TextInput/TextInputBase.js +1 -1
- package/lib/TextInput/propTypes.js +8 -1
- package/lib/ToggleSwitch/ToggleSwitch.js +5 -2
- package/lib/ToggleSwitch/ToggleSwitchGroup.js +20 -12
- package/lib/utils/containUniqueFields.js +34 -0
- package/lib/utils/index.js +10 -1
- package/lib/utils/props/handlerProps.js +72 -0
- package/lib/utils/props/index.js +14 -0
- package/lib/utils/props/inputSupportsProps.js +3 -5
- package/lib-module/Button/ButtonBase.js +2 -2
- package/lib-module/Button/ButtonGroup.js +15 -6
- package/lib-module/Card/PressableCardBase.js +2 -2
- package/lib-module/Checkbox/Checkbox.js +28 -17
- package/lib-module/Checkbox/CheckboxGroup.js +20 -7
- package/lib-module/ExpandCollapse/Panel.js +10 -10
- package/lib-module/FlexGrid/Col/Col.js +13 -3
- package/lib-module/FlexGrid/Row/Row.js +8 -2
- package/lib-module/InputLabel/InputLabel.js +28 -25
- package/lib-module/Link/LinkBase.js +19 -6
- package/lib-module/Modal/Modal.js +19 -19
- package/lib-module/Radio/Radio.js +24 -13
- package/lib-module/Radio/RadioGroup.js +13 -4
- package/lib-module/RadioCard/RadioCard.js +2 -2
- package/lib-module/RadioCard/RadioCardGroup.js +12 -3
- package/lib-module/Select/Select.js +2 -3
- package/lib-module/Tags/Tags.js +18 -11
- package/lib-module/TextInput/TextArea.js +3 -3
- package/lib-module/TextInput/TextInput.js +11 -3
- package/lib-module/TextInput/TextInputBase.js +2 -2
- package/lib-module/TextInput/propTypes.js +7 -1
- package/lib-module/ToggleSwitch/ToggleSwitch.js +6 -3
- package/lib-module/ToggleSwitch/ToggleSwitchGroup.js +15 -6
- package/lib-module/utils/containUniqueFields.js +26 -0
- package/lib-module/utils/index.js +2 -1
- package/lib-module/utils/props/handlerProps.js +59 -0
- package/lib-module/utils/props/index.js +1 -0
- package/lib-module/utils/props/inputSupportsProps.js +3 -5
- package/package.json +5 -5
- package/src/Button/ButtonBase.jsx +8 -2
- package/src/Button/ButtonGroup.jsx +51 -34
- package/src/Card/PressableCardBase.jsx +6 -1
- package/src/Checkbox/Checkbox.jsx +35 -23
- package/src/Checkbox/CheckboxGroup.jsx +52 -22
- package/src/ExpandCollapse/Panel.jsx +9 -9
- package/src/FlexGrid/Col/Col.jsx +11 -2
- package/src/FlexGrid/Row/Row.jsx +8 -2
- package/src/InputLabel/InputLabel.jsx +36 -27
- package/src/Link/LinkBase.jsx +20 -4
- package/src/Modal/Modal.jsx +30 -26
- package/src/Radio/Radio.jsx +26 -14
- package/src/Radio/RadioGroup.jsx +39 -21
- package/src/RadioCard/RadioCard.jsx +6 -1
- package/src/RadioCard/RadioCardGroup.jsx +17 -1
- package/src/Select/Select.jsx +2 -2
- package/src/Tags/Tags.jsx +23 -9
- package/src/TextInput/TextArea.jsx +5 -1
- package/src/TextInput/TextInput.jsx +13 -3
- package/src/TextInput/TextInputBase.jsx +6 -1
- package/src/TextInput/propTypes.js +7 -1
- package/src/ToggleSwitch/ToggleSwitch.jsx +11 -2
- package/src/ToggleSwitch/ToggleSwitchGroup.jsx +19 -6
- package/src/utils/containUniqueFields.js +32 -0
- package/src/utils/index.js +1 -0
- package/src/utils/props/handlerProps.js +47 -0
- package/src/utils/props/index.js +1 -0
- package/src/utils/props/inputSupportsProps.js +3 -4
- package/stories/InputLabel/InputLabel.stories.jsx +25 -28
- package/stories/Modal/Modal.stories.jsx +25 -0
- package/stories/Search/Search.stories.jsx +4 -1
- package/stories/TextInput/TextInput.stories.jsx +40 -2
|
@@ -10,6 +10,8 @@ export default {
|
|
|
10
10
|
export const Default = (args) => {
|
|
11
11
|
const [isOpen, setIsOpen] = useState(false)
|
|
12
12
|
const [isMaxWidthOpen, setIsMaxWidthOpen] = useState(false)
|
|
13
|
+
const [isCustomCloseOpen, setIsCustomCloseOpen] = useState(false)
|
|
14
|
+
const [isNoCloseOpen, setIsNoCloseOpen] = useState(false)
|
|
13
15
|
|
|
14
16
|
return (
|
|
15
17
|
<>
|
|
@@ -23,6 +25,29 @@ export const Default = (args) => {
|
|
|
23
25
|
<Typography variant={{ size: 'h2' }}>Test heading</Typography>
|
|
24
26
|
<Typography>Test content</Typography>
|
|
25
27
|
</Modal>
|
|
28
|
+
<Spacer space={3} />
|
|
29
|
+
<Button onPress={() => setIsCustomCloseOpen(true)}>Open custom close button modal</Button>
|
|
30
|
+
<Modal
|
|
31
|
+
{...args}
|
|
32
|
+
isOpen={isCustomCloseOpen}
|
|
33
|
+
onClose={() => setIsCustomCloseOpen(false)}
|
|
34
|
+
closeButton={<Button onPress={() => setIsCustomCloseOpen(false)}>Close</Button>}
|
|
35
|
+
>
|
|
36
|
+
<Typography variant={{ size: 'h2' }}>Test heading</Typography>
|
|
37
|
+
<Typography>Test content</Typography>
|
|
38
|
+
</Modal>
|
|
39
|
+
<Spacer space={3} />
|
|
40
|
+
<Button onPress={() => setIsNoCloseOpen(true)}>Open modal without close button</Button>
|
|
41
|
+
<Modal
|
|
42
|
+
{...args}
|
|
43
|
+
isOpen={isNoCloseOpen}
|
|
44
|
+
onClose={() => setIsNoCloseOpen(false)}
|
|
45
|
+
closeButton={null}
|
|
46
|
+
>
|
|
47
|
+
<Typography variant={{ size: 'h2' }}>Test heading</Typography>
|
|
48
|
+
<Typography>A custom close button is added in the modal content.</Typography>
|
|
49
|
+
<Button onPress={() => setIsNoCloseOpen(false)}>Close</Button>
|
|
50
|
+
</Modal>
|
|
26
51
|
</>
|
|
27
52
|
)
|
|
28
53
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import React, { useEffect, useState } from 'react'
|
|
1
|
+
import React, { useEffect, useState, useRef } from 'react'
|
|
2
|
+
import { Platform } from 'react-native'
|
|
2
3
|
|
|
3
|
-
import { TextInput } from '../../src'
|
|
4
|
+
import { TextInput, Typography } from '../../src'
|
|
4
5
|
import { Container } from '../supports'
|
|
5
6
|
|
|
6
7
|
export default {
|
|
@@ -101,3 +102,40 @@ export const Controlled = () => {
|
|
|
101
102
|
</>
|
|
102
103
|
)
|
|
103
104
|
}
|
|
105
|
+
|
|
106
|
+
export const WithPattern = (args) => {
|
|
107
|
+
const [value, setValue] = useState('')
|
|
108
|
+
const inputRef = useRef(null)
|
|
109
|
+
const isEmpty = value === ''
|
|
110
|
+
const isSuccess = !isEmpty && inputRef.current.checkValidity()
|
|
111
|
+
// eslint-disable-next-line no-nested-ternary
|
|
112
|
+
const validation = isEmpty ? undefined : isSuccess ? 'success' : 'error'
|
|
113
|
+
const { pattern } = args
|
|
114
|
+
// eslint-disable-next-line no-nested-ternary
|
|
115
|
+
const feedback = isEmpty
|
|
116
|
+
? `Enter value matching pattern: ${pattern}`
|
|
117
|
+
: isSuccess
|
|
118
|
+
? `Success! Value matches pattern: ${pattern}`
|
|
119
|
+
: `Error! Value must match pattern: ${pattern}`
|
|
120
|
+
if (Platform.OS !== 'web') {
|
|
121
|
+
return <Typography>Pattern prop is only supported on web</Typography>
|
|
122
|
+
}
|
|
123
|
+
return (
|
|
124
|
+
<>
|
|
125
|
+
<Container>
|
|
126
|
+
<TextInput
|
|
127
|
+
{...args}
|
|
128
|
+
ref={inputRef}
|
|
129
|
+
label="Pattern"
|
|
130
|
+
validation={validation}
|
|
131
|
+
feedback={feedback}
|
|
132
|
+
value={value}
|
|
133
|
+
onChange={setValue}
|
|
134
|
+
/>
|
|
135
|
+
</Container>
|
|
136
|
+
</>
|
|
137
|
+
)
|
|
138
|
+
}
|
|
139
|
+
WithPattern.args = {
|
|
140
|
+
pattern: '[1-9]{2}'
|
|
141
|
+
}
|