@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.
Files changed (96) hide show
  1. package/.turbo/turbo-build.log +8 -8
  2. package/.turbo/turbo-lint.log +13 -0
  3. package/CHANGELOG.json +98 -1
  4. package/CHANGELOG.md +24 -2
  5. package/__tests__/FlexGrid/Row.test.jsx +100 -25
  6. package/__tests__/utils/containUniqueFields.test.js +25 -0
  7. package/component-docs.json +18 -2
  8. package/lib/Button/ButtonBase.js +1 -1
  9. package/lib/Button/ButtonGroup.js +20 -12
  10. package/lib/Card/PressableCardBase.js +1 -1
  11. package/lib/Checkbox/Checkbox.js +27 -16
  12. package/lib/Checkbox/CheckboxGroup.js +19 -5
  13. package/lib/ExpandCollapse/Panel.js +10 -10
  14. package/lib/FlexGrid/Col/Col.js +13 -3
  15. package/lib/FlexGrid/Row/Row.js +8 -2
  16. package/lib/InputLabel/InputLabel.js +27 -25
  17. package/lib/Link/LinkBase.js +19 -6
  18. package/lib/Modal/Modal.js +18 -18
  19. package/lib/Radio/Radio.js +23 -12
  20. package/lib/Radio/RadioGroup.js +12 -3
  21. package/lib/RadioCard/RadioCard.js +1 -1
  22. package/lib/RadioCard/RadioCardGroup.js +11 -2
  23. package/lib/Select/Select.js +2 -3
  24. package/lib/Tags/Tags.js +23 -17
  25. package/lib/TextInput/TextArea.js +2 -2
  26. package/lib/TextInput/TextInput.js +12 -2
  27. package/lib/TextInput/TextInputBase.js +1 -1
  28. package/lib/TextInput/propTypes.js +8 -1
  29. package/lib/ToggleSwitch/ToggleSwitch.js +5 -2
  30. package/lib/ToggleSwitch/ToggleSwitchGroup.js +20 -12
  31. package/lib/utils/containUniqueFields.js +34 -0
  32. package/lib/utils/index.js +10 -1
  33. package/lib/utils/props/handlerProps.js +72 -0
  34. package/lib/utils/props/index.js +14 -0
  35. package/lib/utils/props/inputSupportsProps.js +3 -5
  36. package/lib-module/Button/ButtonBase.js +2 -2
  37. package/lib-module/Button/ButtonGroup.js +15 -6
  38. package/lib-module/Card/PressableCardBase.js +2 -2
  39. package/lib-module/Checkbox/Checkbox.js +28 -17
  40. package/lib-module/Checkbox/CheckboxGroup.js +20 -7
  41. package/lib-module/ExpandCollapse/Panel.js +10 -10
  42. package/lib-module/FlexGrid/Col/Col.js +13 -3
  43. package/lib-module/FlexGrid/Row/Row.js +8 -2
  44. package/lib-module/InputLabel/InputLabel.js +28 -25
  45. package/lib-module/Link/LinkBase.js +19 -6
  46. package/lib-module/Modal/Modal.js +19 -19
  47. package/lib-module/Radio/Radio.js +24 -13
  48. package/lib-module/Radio/RadioGroup.js +13 -4
  49. package/lib-module/RadioCard/RadioCard.js +2 -2
  50. package/lib-module/RadioCard/RadioCardGroup.js +12 -3
  51. package/lib-module/Select/Select.js +2 -3
  52. package/lib-module/Tags/Tags.js +18 -11
  53. package/lib-module/TextInput/TextArea.js +3 -3
  54. package/lib-module/TextInput/TextInput.js +11 -3
  55. package/lib-module/TextInput/TextInputBase.js +2 -2
  56. package/lib-module/TextInput/propTypes.js +7 -1
  57. package/lib-module/ToggleSwitch/ToggleSwitch.js +6 -3
  58. package/lib-module/ToggleSwitch/ToggleSwitchGroup.js +15 -6
  59. package/lib-module/utils/containUniqueFields.js +26 -0
  60. package/lib-module/utils/index.js +2 -1
  61. package/lib-module/utils/props/handlerProps.js +59 -0
  62. package/lib-module/utils/props/index.js +1 -0
  63. package/lib-module/utils/props/inputSupportsProps.js +3 -5
  64. package/package.json +5 -5
  65. package/src/Button/ButtonBase.jsx +8 -2
  66. package/src/Button/ButtonGroup.jsx +51 -34
  67. package/src/Card/PressableCardBase.jsx +6 -1
  68. package/src/Checkbox/Checkbox.jsx +35 -23
  69. package/src/Checkbox/CheckboxGroup.jsx +52 -22
  70. package/src/ExpandCollapse/Panel.jsx +9 -9
  71. package/src/FlexGrid/Col/Col.jsx +11 -2
  72. package/src/FlexGrid/Row/Row.jsx +8 -2
  73. package/src/InputLabel/InputLabel.jsx +36 -27
  74. package/src/Link/LinkBase.jsx +20 -4
  75. package/src/Modal/Modal.jsx +30 -26
  76. package/src/Radio/Radio.jsx +26 -14
  77. package/src/Radio/RadioGroup.jsx +39 -21
  78. package/src/RadioCard/RadioCard.jsx +6 -1
  79. package/src/RadioCard/RadioCardGroup.jsx +17 -1
  80. package/src/Select/Select.jsx +2 -2
  81. package/src/Tags/Tags.jsx +23 -9
  82. package/src/TextInput/TextArea.jsx +5 -1
  83. package/src/TextInput/TextInput.jsx +13 -3
  84. package/src/TextInput/TextInputBase.jsx +6 -1
  85. package/src/TextInput/propTypes.js +7 -1
  86. package/src/ToggleSwitch/ToggleSwitch.jsx +11 -2
  87. package/src/ToggleSwitch/ToggleSwitchGroup.jsx +19 -6
  88. package/src/utils/containUniqueFields.js +32 -0
  89. package/src/utils/index.js +1 -0
  90. package/src/utils/props/handlerProps.js +47 -0
  91. package/src/utils/props/index.js +1 -0
  92. package/src/utils/props/inputSupportsProps.js +3 -4
  93. package/stories/InputLabel/InputLabel.stories.jsx +25 -28
  94. package/stories/Modal/Modal.stories.jsx +25 -0
  95. package/stories/Search/Search.stories.jsx +4 -1
  96. 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
  }
@@ -4,7 +4,10 @@ import { Search } from '../../src'
4
4
 
5
5
  export default {
6
6
  title: 'Search',
7
- component: Search
7
+ component: Search,
8
+ argTypes: {
9
+ onSubmit: { action: 'submitted' }
10
+ }
8
11
  }
9
12
 
10
13
  const Template = (args) => <Search {...args} />
@@ -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
+ }