@veracity/vui 2.5.0-beta.1 → 2.5.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 (169) hide show
  1. package/dist/cjs/checkbox/checkbox.types.d.ts +1 -1
  2. package/dist/cjs/checkbox/checkbox.types.d.ts.map +1 -1
  3. package/dist/cjs/checkbox/checkboxGroup.types.d.ts +1 -1
  4. package/dist/cjs/checkbox/checkboxGroup.types.d.ts.map +1 -1
  5. package/dist/cjs/core/vuiProvider/globalStyle.d.ts.map +1 -1
  6. package/dist/cjs/core/vuiProvider/globalStyle.js +5 -2
  7. package/dist/cjs/icons/baseIcons/fal/falClockRotateLeft.d.ts +4 -0
  8. package/dist/cjs/icons/baseIcons/fal/falClockRotateLeft.d.ts.map +1 -0
  9. package/dist/cjs/icons/baseIcons/fal/falClockRotateLeft.js +7 -0
  10. package/dist/cjs/icons/baseIcons/icons.d.ts +1 -0
  11. package/dist/cjs/icons/baseIcons/icons.d.ts.map +1 -1
  12. package/dist/cjs/icons/baseIcons/icons.js +7 -5
  13. package/dist/cjs/icons/baseIcons/types.d.ts +1 -1
  14. package/dist/cjs/icons/baseIcons/types.d.ts.map +1 -1
  15. package/dist/cjs/input/inputInput.d.ts.map +1 -1
  16. package/dist/cjs/input/inputInput.js +0 -5
  17. package/dist/cjs/panel/theme.js +1 -1
  18. package/dist/cjs/progress/progress.js +2 -2
  19. package/dist/cjs/progress/theme.d.ts +15 -1
  20. package/dist/cjs/progress/theme.d.ts.map +1 -1
  21. package/dist/cjs/progress/theme.js +16 -2
  22. package/dist/cjs/progressCircular/progressCircular.d.ts.map +1 -1
  23. package/dist/cjs/progressCircular/progressCircular.js +7 -9
  24. package/dist/cjs/progressCircular/theme.d.ts +24 -2
  25. package/dist/cjs/progressCircular/theme.d.ts.map +1 -1
  26. package/dist/cjs/progressCircular/theme.js +26 -3
  27. package/dist/cjs/radio/radio.types.d.ts +1 -1
  28. package/dist/cjs/radio/radio.types.d.ts.map +1 -1
  29. package/dist/cjs/radio/radioGroup.types.d.ts +1 -1
  30. package/dist/cjs/radio/radioGroup.types.d.ts.map +1 -1
  31. package/dist/cjs/switch/consts.d.ts +9 -0
  32. package/dist/cjs/switch/consts.d.ts.map +1 -0
  33. package/dist/cjs/switch/consts.js +11 -0
  34. package/dist/cjs/switch/switch.types.d.ts +2 -2
  35. package/dist/cjs/switch/switch.types.d.ts.map +1 -1
  36. package/dist/cjs/switch/switchButton.d.ts.map +1 -1
  37. package/dist/cjs/switch/switchButton.js +19 -21
  38. package/dist/cjs/switch/switchMain.d.ts.map +1 -1
  39. package/dist/cjs/switch/switchMain.js +2 -3
  40. package/dist/cjs/switch/theme.d.ts +30 -14
  41. package/dist/cjs/switch/theme.d.ts.map +1 -1
  42. package/dist/cjs/switch/theme.js +33 -17
  43. package/dist/cjs/textarea/textarea.d.ts.map +1 -1
  44. package/dist/cjs/textarea/textarea.js +8 -17
  45. package/dist/cjs/textarea/textarea.types.d.ts +2 -2
  46. package/dist/cjs/textarea/textarea.types.d.ts.map +1 -1
  47. package/dist/cjs/textarea/theme.d.ts +29 -12
  48. package/dist/cjs/textarea/theme.d.ts.map +1 -1
  49. package/dist/cjs/textarea/theme.js +28 -17
  50. package/dist/cjs/theme/components.d.ts +87 -14
  51. package/dist/cjs/theme/components.d.ts.map +1 -1
  52. package/dist/cjs/theme/defaultTheme.d.ts +87 -14
  53. package/dist/cjs/theme/defaultTheme.d.ts.map +1 -1
  54. package/dist/cjs/tutorial/consts.d.ts +6 -0
  55. package/dist/cjs/tutorial/consts.d.ts.map +1 -0
  56. package/dist/cjs/tutorial/consts.js +8 -0
  57. package/dist/cjs/tutorial/tutorial.d.ts +1 -1
  58. package/dist/cjs/tutorial/tutorial.d.ts.map +1 -1
  59. package/dist/cjs/tutorial/tutorial.js +2 -2
  60. package/dist/cjs/tutorial/tutorial.types.d.ts +20 -12
  61. package/dist/cjs/tutorial/tutorial.types.d.ts.map +1 -1
  62. package/dist/cjs/tutorial/tutorialCard.d.ts +1 -1
  63. package/dist/cjs/tutorial/tutorialCard.d.ts.map +1 -1
  64. package/dist/cjs/tutorial/tutorialCard.js +19 -18
  65. package/dist/cjs/tutorial/tutorialStep.d.ts +1 -1
  66. package/dist/cjs/tutorial/tutorialStep.d.ts.map +1 -1
  67. package/dist/cjs/tutorial/tutorialStep.js +4 -5
  68. package/dist/esm/checkbox/checkbox.types.d.ts +1 -1
  69. package/dist/esm/checkbox/checkbox.types.d.ts.map +1 -1
  70. package/dist/esm/checkbox/checkboxGroup.types.d.ts +1 -1
  71. package/dist/esm/checkbox/checkboxGroup.types.d.ts.map +1 -1
  72. package/dist/esm/core/vuiProvider/globalStyle.d.ts.map +1 -1
  73. package/dist/esm/core/vuiProvider/globalStyle.js +5 -2
  74. package/dist/esm/icons/baseIcons/fal/falClockRotateLeft.d.ts +4 -0
  75. package/dist/esm/icons/baseIcons/fal/falClockRotateLeft.d.ts.map +1 -0
  76. package/dist/esm/icons/baseIcons/fal/falClockRotateLeft.js +5 -0
  77. package/dist/esm/icons/baseIcons/icons.d.ts +1 -0
  78. package/dist/esm/icons/baseIcons/icons.d.ts.map +1 -1
  79. package/dist/esm/icons/baseIcons/icons.js +1 -0
  80. package/dist/esm/icons/baseIcons/types.d.ts +1 -1
  81. package/dist/esm/icons/baseIcons/types.d.ts.map +1 -1
  82. package/dist/esm/input/inputInput.d.ts.map +1 -1
  83. package/dist/esm/input/inputInput.js +0 -5
  84. package/dist/esm/panel/theme.js +1 -1
  85. package/dist/esm/progress/progress.js +2 -2
  86. package/dist/esm/progress/theme.d.ts +15 -1
  87. package/dist/esm/progress/theme.d.ts.map +1 -1
  88. package/dist/esm/progress/theme.js +16 -2
  89. package/dist/esm/progressCircular/progressCircular.d.ts.map +1 -1
  90. package/dist/esm/progressCircular/progressCircular.js +7 -9
  91. package/dist/esm/progressCircular/theme.d.ts +24 -2
  92. package/dist/esm/progressCircular/theme.d.ts.map +1 -1
  93. package/dist/esm/progressCircular/theme.js +26 -3
  94. package/dist/esm/radio/radio.types.d.ts +1 -1
  95. package/dist/esm/radio/radio.types.d.ts.map +1 -1
  96. package/dist/esm/radio/radioGroup.types.d.ts +1 -1
  97. package/dist/esm/radio/radioGroup.types.d.ts.map +1 -1
  98. package/dist/esm/switch/consts.d.ts +9 -0
  99. package/dist/esm/switch/consts.d.ts.map +1 -0
  100. package/dist/esm/switch/consts.js +8 -0
  101. package/dist/esm/switch/switch.types.d.ts +2 -2
  102. package/dist/esm/switch/switch.types.d.ts.map +1 -1
  103. package/dist/esm/switch/switchButton.d.ts.map +1 -1
  104. package/dist/esm/switch/switchButton.js +19 -21
  105. package/dist/esm/switch/switchMain.d.ts.map +1 -1
  106. package/dist/esm/switch/switchMain.js +2 -3
  107. package/dist/esm/switch/theme.d.ts +30 -14
  108. package/dist/esm/switch/theme.d.ts.map +1 -1
  109. package/dist/esm/switch/theme.js +33 -17
  110. package/dist/esm/textarea/textarea.d.ts.map +1 -1
  111. package/dist/esm/textarea/textarea.js +8 -17
  112. package/dist/esm/textarea/textarea.types.d.ts +2 -2
  113. package/dist/esm/textarea/textarea.types.d.ts.map +1 -1
  114. package/dist/esm/textarea/theme.d.ts +29 -12
  115. package/dist/esm/textarea/theme.d.ts.map +1 -1
  116. package/dist/esm/textarea/theme.js +28 -17
  117. package/dist/esm/theme/components.d.ts +87 -14
  118. package/dist/esm/theme/components.d.ts.map +1 -1
  119. package/dist/esm/theme/defaultTheme.d.ts +87 -14
  120. package/dist/esm/theme/defaultTheme.d.ts.map +1 -1
  121. package/dist/esm/tutorial/consts.d.ts +6 -0
  122. package/dist/esm/tutorial/consts.d.ts.map +1 -0
  123. package/dist/esm/tutorial/consts.js +5 -0
  124. package/dist/esm/tutorial/tutorial.d.ts +1 -1
  125. package/dist/esm/tutorial/tutorial.d.ts.map +1 -1
  126. package/dist/esm/tutorial/tutorial.js +2 -2
  127. package/dist/esm/tutorial/tutorial.types.d.ts +20 -12
  128. package/dist/esm/tutorial/tutorial.types.d.ts.map +1 -1
  129. package/dist/esm/tutorial/tutorialCard.d.ts +1 -1
  130. package/dist/esm/tutorial/tutorialCard.d.ts.map +1 -1
  131. package/dist/esm/tutorial/tutorialCard.js +20 -19
  132. package/dist/esm/tutorial/tutorialStep.d.ts +1 -1
  133. package/dist/esm/tutorial/tutorialStep.d.ts.map +1 -1
  134. package/dist/esm/tutorial/tutorialStep.js +5 -6
  135. package/package.json +1 -1
  136. package/src/checkbox/checkbox.types.ts +1 -1
  137. package/src/checkbox/checkboxGroup.types.ts +1 -1
  138. package/src/core/vuiProvider/globalStyle.tsx +5 -2
  139. package/src/icons/baseIcons/fal/falClockRotateLeft.ts +8 -0
  140. package/src/icons/baseIcons/icons.ts +1 -0
  141. package/src/icons/baseIcons/types.ts +1 -0
  142. package/src/input/inputInput.tsx +0 -5
  143. package/src/panel/theme.ts +1 -1
  144. package/src/progress/progress.tsx +2 -2
  145. package/src/progress/theme.ts +16 -2
  146. package/src/progressCircular/progressCircular.tsx +14 -7
  147. package/src/progressCircular/theme.ts +27 -3
  148. package/src/radio/radio.types.ts +1 -1
  149. package/src/radio/radioGroup.types.ts +1 -1
  150. package/src/switch/consts.ts +8 -0
  151. package/src/switch/switch.types.ts +2 -2
  152. package/src/switch/switchButton.tsx +20 -20
  153. package/src/switch/switchMain.tsx +1 -3
  154. package/src/switch/theme.ts +34 -22
  155. package/src/textarea/textarea.tsx +7 -17
  156. package/src/textarea/textarea.types.ts +2 -2
  157. package/src/textarea/theme.ts +28 -23
  158. package/src/tutorial/consts.ts +5 -0
  159. package/src/tutorial/tutorial.tsx +7 -5
  160. package/src/tutorial/tutorial.types.ts +20 -12
  161. package/src/tutorial/tutorialCard.tsx +71 -80
  162. package/src/tutorial/tutorialStep.tsx +5 -11
  163. package/dist/cjs/textarea/consts.d.ts +0 -4
  164. package/dist/cjs/textarea/consts.d.ts.map +0 -1
  165. package/dist/cjs/textarea/consts.js +0 -6
  166. package/dist/esm/textarea/consts.d.ts +0 -4
  167. package/dist/esm/textarea/consts.d.ts.map +0 -1
  168. package/dist/esm/textarea/consts.js +0 -3
  169. package/src/textarea/consts.ts +0 -3
@@ -1,7 +1,12 @@
1
- const baseStyle = {}
1
+ import { darkBlue, energyRed, landGreen } from '../theme/foundations/colors'
2
+
3
+ const baseStyle = {
4
+ color: 'darkBlue.main'
5
+ }
2
6
 
3
7
  const defaultProps = {
4
- size: 'md'
8
+ size: 'md',
9
+ variant: 'primary'
5
10
  }
6
11
 
7
12
  const sizes = {
@@ -16,7 +21,26 @@ const sizes = {
16
21
  xl: { strokeWidth: 7, width: 160, top: 64, fontSize: 22 }
17
22
  }
18
23
 
19
- const variants = {}
24
+ const variants = {
25
+ primary: {
26
+ stroke: {
27
+ main: darkBlue[95],
28
+ progress: darkBlue.main
29
+ }
30
+ },
31
+ green: {
32
+ stroke: {
33
+ main: landGreen[95],
34
+ progress: landGreen.main
35
+ }
36
+ },
37
+ red: {
38
+ stroke: {
39
+ main: energyRed[95],
40
+ progress: energyRed.main
41
+ }
42
+ }
43
+ }
20
44
 
21
45
  export default {
22
46
  baseStyle,
@@ -9,7 +9,7 @@ export type RadioProps = SystemProps &
9
9
  ThemingProps<'Radio'> & {
10
10
  /** Provides value to radio in controlled mode. */
11
11
  checked?: boolean
12
- /** @deprecated Available theme colors for this component. */
12
+ /** Deprecated. Please use variant instead. @deprecated */
13
13
  colorScheme?: 'blue' | 'prussian'
14
14
  /** Disables radio and related elements with the right styling. */
15
15
  disabled?: boolean
@@ -4,7 +4,7 @@ import { ChangeEventHandler, FocusEventHandler } from '../utils'
4
4
 
5
5
  export type RadioGroupProps = SystemProps &
6
6
  ThemingProps<'Radio'> & {
7
- /** @deprecated Available theme colors for this component. */
7
+ /** Deprecated. Please use variant instead. @deprecated */
8
8
  colorScheme?: 'blue' | 'prussian'
9
9
  /** Passes the prop to each radio. */
10
10
  disabled?: boolean
@@ -0,0 +1,8 @@
1
+ export const switchColors = {
2
+ main: 'seaBlue.main',
3
+ hover: 'seaBlue.40',
4
+ disabled: 'sandstone.main',
5
+ disabledBg: 'sandstone.95',
6
+ green: 'landGreen.main',
7
+ red: 'energyRed.main'
8
+ }
@@ -8,7 +8,7 @@ export type SwitchButtonProps = SystemProps &
8
8
  ThemingProps<'Switch'> & {
9
9
  /** Provides value to switch in controlled mode. */
10
10
  checked?: boolean
11
- /** Available theme colors for this component. */
11
+ /** Deprecated. Please use variant instead. @deprecated */
12
12
  colorScheme?: 'blue' | 'green' | 'prussian'
13
13
  /** Disables switch and related elements with the right styling. */
14
14
  disabled?: boolean
@@ -57,7 +57,7 @@ export type SwitchProps = SystemProps &
57
57
  button?: ReactNode
58
58
  /** Provides value to switch button in controlled mode. */
59
59
  checked?: boolean
60
- /** Available theme colors for this component. @default blue */
60
+ /** Deprecated. Please use variant instead. @deprecated */
61
61
  colorScheme?: 'blue' | 'green' | 'prussian'
62
62
  /** Disables switch and related elements with the right styling. */
63
63
  disabled?: boolean
@@ -2,6 +2,7 @@ import React, { useEffect, useRef, useState } from 'react'
2
2
 
3
3
  import { omitThemingProps, styled, useStyleConfig, vui } from '../core'
4
4
  import { ChangeEvent, cs, filterUndefined, FocusEvent } from '../utils'
5
+ import { switchColors } from './consts'
5
6
  import { useSwitchContext } from './context'
6
7
  import { SwitchButtonProps } from './switch.types'
7
8
 
@@ -18,43 +19,41 @@ const SwitchInput = styled.inputBox`
18
19
  z-index: 1;
19
20
  `
20
21
 
21
- /** Circular element that moves along the track when toggled. */
22
- const SwitchThumb = styled.spanBox`
23
- border-radius: round;
22
+ const SwitchFoundation = styled.spanBox`
23
+ border-radius: 100px;
24
24
  display: inline-flex;
25
25
  flex-shrink: 0;
26
- position: absolute;
27
26
  transition-duration: fast;
27
+ position: relative;
28
+ `
29
+
30
+ /** Circular element that moves along the track when toggled. */
31
+ const SwitchThumb = styled(SwitchFoundation)`
32
+ position: absolute;
28
33
  `
29
34
 
30
35
  /** Track element along which the thumb moves when toggled. */
31
- const SwitchTrack = styled.spanBox`
36
+ const SwitchTrack = styled(SwitchFoundation)`
32
37
  align-items: center;
33
- border-radius: round;
34
- display: inline-flex;
35
38
  flex: 1;
36
- position: relative;
37
- transition-duration: fast;
38
39
  `
39
40
 
40
- export const SwitchButtonBase = styled.spanBox`
41
+ export const SwitchButtonBase = styled(SwitchFoundation)`
41
42
  color: white;
42
43
  cursor: pointer;
43
- display: inline-flex;
44
- flex-shrink: 0;
45
- position: relative;
44
+ --x-ring-color: green;
46
45
 
47
46
  &[aria-disabled='true'] {
48
47
  cursor: not-allowed;
49
48
 
50
49
  .vui-switchThumb {
51
- background-color: disabled.color;
50
+ background-color: ${switchColors.disabled};
52
51
  }
53
52
 
54
53
  .vui-switchTrack {
55
- // Using ring instead of border when disabled, because it's easier
56
- --x-ring-color: var(--vui-colors-disabled-border);
57
- background-color: disabled.bg;
54
+ --x-ring-color: ${switchColors.disabled};
55
+ background-color: ${switchColors.disabledBg};
56
+ color: ${switchColors.disabled};
58
57
  }
59
58
  }
60
59
  `
@@ -124,10 +123,10 @@ export const SwitchButton = vui<'span', SwitchButtonProps>((props, ref) => {
124
123
  })
125
124
 
126
125
  const trackAliasedProps = filterUndefined({
127
- bg: isChecked ? trackStyles.bg : 'grey.50',
126
+ bg: isChecked ? trackStyles.bg : switchColors.disabled,
128
127
  pl: isChecked ? 1 : labelOffset,
129
128
  pr: isChecked ? labelOffset : 1,
130
- ring: !disabled ? (isFocused ? trackStyles.ring : 0) : 1
129
+ ring: !disabled ? (isFocused ? trackStyles.ring : 0) : 3
131
130
  })
132
131
 
133
132
  return (
@@ -144,12 +143,13 @@ export const SwitchButton = vui<'span', SwitchButtonProps>((props, ref) => {
144
143
  onChange={handleOnChange}
145
144
  onFocus={handleOnFocus}
146
145
  ref={inputRef}
146
+ tabIndex={-1}
147
147
  type="checkbox"
148
148
  {...{ checked, defaultChecked, disabled, id, name, required, value }}
149
149
  {...inputProps}
150
150
  />
151
151
 
152
- <SwitchTrack className="vui-switchTrack" {...trackStyles} {...trackAliasedProps}>
152
+ <SwitchTrack className="vui-switchTrack" tabIndex={0} {...trackStyles} {...trackAliasedProps}>
153
153
  {!isChecked && innerLabelOff}
154
154
 
155
155
  <SwitchThumb className="vui-switchThumb" {...thumbStyles} {...thumbAliasedProps} />
@@ -33,7 +33,6 @@ export const Switch = vui<'label', SwitchProps>((props, ref) => {
33
33
  checked,
34
34
  children,
35
35
  className,
36
- colorScheme,
37
36
  defaultChecked,
38
37
  disabled,
39
38
  id,
@@ -59,7 +58,6 @@ export const Switch = vui<'label', SwitchProps>((props, ref) => {
59
58
  () =>
60
59
  filterUndefined({
61
60
  checked,
62
- colorScheme,
63
61
  defaultChecked,
64
62
  disabled,
65
63
  name,
@@ -71,7 +69,7 @@ export const Switch = vui<'label', SwitchProps>((props, ref) => {
71
69
  value,
72
70
  variant
73
71
  }),
74
- [checked, colorScheme, defaultChecked, disabled, name, onBlur, onChange, onFocus, required, size, value, variant]
72
+ [checked, defaultChecked, disabled, name, onBlur, onChange, onFocus, required, size, value, variant]
75
73
  )
76
74
 
77
75
  const aliasedProps = filterUndefined({
@@ -1,4 +1,15 @@
1
- import { Dict } from '../utils'
1
+ import { switchColors } from './consts'
2
+
3
+ const baseStyle = {
4
+ button: {
5
+ thumb: {
6
+ bg: 'white'
7
+ },
8
+ track: {
9
+ ring: 3
10
+ }
11
+ }
12
+ }
2
13
 
3
14
  function sizeLg() {
4
15
  const button = {
@@ -60,28 +71,9 @@ function sizeSm() {
60
71
  return { button, label }
61
72
  }
62
73
 
63
- function variantContained(props: Dict) {
64
- const { colorScheme: c } = props
65
-
66
- const button = {
67
- thumb: {
68
- bg: 'white'
69
- },
70
- track: {
71
- bg: `${c}.80`,
72
- ring: 3
73
- }
74
- }
75
-
76
- return { button }
77
- }
78
-
79
- const baseStyle = {}
80
-
81
74
  const defaultProps = {
82
- colorScheme: 'blue',
83
75
  size: 'md',
84
- variant: 'contained'
76
+ variant: 'primary'
85
77
  }
86
78
 
87
79
  const parts = ['container', 'button', 'label']
@@ -93,7 +85,27 @@ const sizes = {
93
85
  }
94
86
 
95
87
  const variants = {
96
- contained: variantContained
88
+ primary: {
89
+ button: {
90
+ track: {
91
+ bg: switchColors.main
92
+ }
93
+ }
94
+ },
95
+ green: {
96
+ button: {
97
+ track: {
98
+ bg: switchColors.green
99
+ }
100
+ }
101
+ },
102
+ red: {
103
+ button: {
104
+ track: {
105
+ bg: switchColors.red
106
+ }
107
+ }
108
+ }
97
109
  }
98
110
 
99
111
  export default {
@@ -1,9 +1,9 @@
1
1
  import React, { useEffect, useState } from 'react'
2
2
 
3
3
  import { omitThemingProps, styled, useStyleConfig, vui } from '../core'
4
+ import { inputColors } from '../input/consts'
4
5
  import T from '../t'
5
6
  import { ChangeEvent, cs, filterUndefined } from '../utils'
6
- import { greyColor, greyLightColor, redColor } from './consts'
7
7
  import { getInitialCount } from './helpers'
8
8
  import { TextareaProps } from './textarea.types'
9
9
 
@@ -16,15 +16,9 @@ const TextareaTextarea = styled.textareaBox`
16
16
  transition-duration: fast;
17
17
  width: 100%;
18
18
 
19
- &::placeholder {
20
- color: grey.60;
21
- }
22
-
23
19
  &[aria-disabled='true'],
24
20
  &[aria-disabled='true']::placeholder {
25
- background-color: disabled.bg;
26
- border-color: disabled.border;
27
- color: disabled.color;
21
+ opacity: 0.5;
28
22
  cursor: not-allowed;
29
23
  }
30
24
  `
@@ -49,7 +43,6 @@ export const Textarea = vui<'div', TextareaProps>((props, ref) => {
49
43
  defaultValue,
50
44
  disabled,
51
45
  id,
52
- isInvalid,
53
46
  maxLength,
54
47
  name,
55
48
  onBlur,
@@ -70,10 +63,7 @@ export const Textarea = vui<'div', TextareaProps>((props, ref) => {
70
63
  const [count, setCount] = useState(getInitialCount(props))
71
64
  const [valueInternal, setValueInternal] = useState(defaultValue)
72
65
 
73
- const colorProps = filterUndefined({
74
- colorScheme: colorSchemeProp ?? (isInvalid ? 'red' : undefined)
75
- })
76
- const styles = useStyleConfig('Textarea', { ...colorProps, ...props })
66
+ const styles = useStyleConfig('Textarea', props)
77
67
 
78
68
  function onChange(e: ChangeEvent<HTMLTextAreaElement>) {
79
69
  setValueInternal(e.target.value)
@@ -87,9 +77,9 @@ export const Textarea = vui<'div', TextareaProps>((props, ref) => {
87
77
 
88
78
  const textareaAliasedProps = filterUndefined({
89
79
  'aria-disabled': disabled,
90
- bg: readOnly ? greyLightColor : undefined,
91
- focusBorderColor: !readOnly ? 'transparent' : undefined,
92
- focusRing: readOnly ? 0 : undefined
80
+ bg: readOnly ? inputColors.disabled : undefined,
81
+ focusWithinBorderColor: !readOnly ? 'transparent' : undefined,
82
+ focusWithinRingColor: readOnly ? 'transparent' : undefined
93
83
  })
94
84
 
95
85
  useEffect(() => {
@@ -128,7 +118,7 @@ export const Textarea = vui<'div', TextareaProps>((props, ref) => {
128
118
  {showCount && (
129
119
  <T
130
120
  className="vui-textareaCount"
131
- color={maxLength && count > maxLength ? redColor : greyColor}
121
+ color={maxLength && count > maxLength ? inputColors.error : inputColors.helpText}
132
122
  position="absolute"
133
123
  right={0}
134
124
  size="sm"
@@ -8,7 +8,7 @@ export type TextareaProps = SystemProps &
8
8
  autoFocus?: boolean
9
9
  /** Children are disabled for this component. */
10
10
  children?: never
11
- /** Available theme colors for this component. @default grey */
11
+ /** Deprecated. Please use variant instead. @deprecated */
12
12
  colorScheme?: 'green' | 'grey' | 'red'
13
13
  /** Passed to the inner input. */
14
14
  cols?: number
@@ -16,7 +16,7 @@ export type TextareaProps = SystemProps &
16
16
  defaultValue?: number | string
17
17
  /** Passed to the inner input. */
18
18
  disabled?: boolean
19
- /** Styles the textarea in invalid state. */
19
+ /** Deprecated. Please use variant="red" instead. @deprecated*/
20
20
  isInvalid?: boolean
21
21
  /** Passed to the inner input. */
22
22
  maxLength?: number
@@ -1,29 +1,17 @@
1
- import { Dict } from '../utils'
2
-
3
- function variantDefault(props: Dict) {
4
- const { colorScheme: c } = props
5
-
6
- const container = {}
7
-
8
- const textarea = {
9
- borderColor: `${c}.80`,
10
- focusRing: 2,
11
- focusRingColor: `${c}.80`
12
- }
13
-
14
- if (c === 'grey') {
15
- textarea.borderColor = `${c}.60`
16
- textarea.focusRingColor = 'blue.50'
1
+ import { inputColors } from '../input/consts'
2
+
3
+ const baseStyle = {
4
+ textarea: {
5
+ focusWithinRing: 2,
6
+ color: inputColors.inputText
7
+ },
8
+ input: {
9
+ color: { placeholder: inputColors.placeholder }
17
10
  }
18
-
19
- return { container, textarea }
20
11
  }
21
12
 
22
- const baseStyle = {}
23
-
24
13
  const defaultProps = {
25
- colorScheme: 'grey',
26
- variant: 'default'
14
+ variant: 'grey'
27
15
  }
28
16
 
29
17
  const parts = ['container', 'textarea']
@@ -31,7 +19,24 @@ const parts = ['container', 'textarea']
31
19
  const sizes = {}
32
20
 
33
21
  const variants = {
34
- default: variantDefault
22
+ grey: {
23
+ textarea: {
24
+ borderColor: inputColors.border,
25
+ focusWithinRingColor: inputColors.focus
26
+ }
27
+ },
28
+ green: {
29
+ textarea: {
30
+ borderColor: inputColors.success,
31
+ focusWithinRingColor: inputColors.success
32
+ }
33
+ },
34
+ red: {
35
+ textarea: {
36
+ borderColor: inputColors.error,
37
+ focusWithinRingColor: inputColors.error
38
+ }
39
+ }
35
40
  }
36
41
 
37
42
  export default {
@@ -0,0 +1,5 @@
1
+ export const tutorialColors = {
2
+ bg: 'darkBlue.main',
3
+ buttonColor: 'digiGreen.main',
4
+ color: 'white'
5
+ }
@@ -8,16 +8,17 @@ import { useTutorial } from './useTutorial'
8
8
 
9
9
  /** [Beta] Popover Tutorial is used to display information about a new, or existing feature. */
10
10
  export function Tutorial({
11
+ actionLabel,
11
12
  children,
12
13
  className,
13
- description,
14
+ onAction,
14
15
  onDismiss,
15
16
  onFinish,
16
- readMoreLink,
17
17
  steps,
18
18
  title,
19
19
  id,
20
- placement = 'right'
20
+ placement = 'right',
21
+ showSkipButton
21
22
  }: TutorialProps) {
22
23
  const { isVisible, setIsVisible, saveDisplayed } = useTutorial(id)
23
24
 
@@ -32,11 +33,12 @@ export function Tutorial({
32
33
  <Tippy
33
34
  content={
34
35
  <TutorialCard
36
+ actionLabel={actionLabel}
35
37
  className={cs('vui-tutorial', className)}
36
- description={description}
38
+ onAction={onAction}
37
39
  onDismiss={() => onClose('dismissed')}
38
40
  onFinish={() => onClose('finished')}
39
- readMoreLink={readMoreLink}
41
+ showSkipButton={showSkipButton}
40
42
  steps={steps}
41
43
  title={title}
42
44
  />
@@ -4,50 +4,58 @@ import { Placement } from 'tippy.js'
4
4
  export type TutorialDataStep = {
5
5
  /** title of step */
6
6
  title: string
7
- /** description of step */
8
- description: string
9
- /** Read more link */
7
+ /** Content */
8
+ content?: string
9
+ /** Link to page where they can read more */
10
10
  readMoreLink?: string
11
11
  }
12
12
 
13
13
  export type TutorialProps = {
14
+ /** Label for the action button @default `Action` */
15
+ actionLabel?: string
14
16
  /** Target element for the tutorial */
15
17
  children: React.ReactNode
16
18
  /** Custom class name */
17
19
  className?: string
18
20
  /** An id for further handling with localStorage */
19
21
  id: string
20
- /** A general tutorial description */
21
- description?: string
22
+ /** Invoked once the action button clicked. */
23
+ onAction?: () => void
22
24
  /** Invoked once the dismiss button clicked. */
23
25
  onDismiss?: () => void
24
26
  /** Invoked once the finish button clicked. */
25
27
  onFinish?: () => void
26
28
  /** Popover placement */
27
29
  placement?: Placement
28
- /** Link to page where user can read more */
29
- readMoreLink?: string
30
30
  /** An array of steps */
31
31
  steps: TutorialDataStep[]
32
- /** A general tutorial title */
32
+ /** Show the Skip button */
33
+ showSkipButton?: boolean
34
+ /** General tutorial title */
33
35
  title: string
36
+ /** Link to page where they can read more */
37
+ readMoreLink?: string
34
38
  }
35
39
 
36
40
  export type TutorialCardProps = {
41
+ /** Label for the action button @default `Action` */
42
+ actionLabel?: string
37
43
  /** Custom class name */
38
44
  className?: string
39
45
  /** The card title */
40
46
  title: string
41
47
  /** Steps of the card */
42
48
  steps: TutorialDataStep[]
49
+ /** Invoked once the action button clicked. */
50
+ onAction?: () => void
43
51
  /** Callback for the dismiss button click. */
44
52
  onDismiss?: () => void
45
53
  /** Callback for the finish button click. */
46
54
  onFinish?: () => void
47
- /** Description of feature */
48
- description?: string
49
55
  /** Link to page where they can read more */
50
56
  readMoreLink?: string
57
+ /** Show the Skip button */
58
+ showSkipButton?: boolean
51
59
  }
52
60
 
53
61
  export type TutorialStepProps = {
@@ -55,8 +63,8 @@ export type TutorialStepProps = {
55
63
  active: boolean
56
64
  /** Title of step */
57
65
  title: string
58
- /** Description of step */
59
- description: string
66
+ /** Step content */
67
+ content?: string
60
68
  /** Link to page where user can read more */
61
69
  readMoreLink?: string
62
70
  }