@veracity/vui 2.18.3 → 2.19.1
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/dist/cjs/button/button.d.ts.map +1 -1
- package/dist/cjs/button/button.js +3 -2
- package/dist/cjs/button/button.js.map +1 -1
- package/dist/cjs/checkbox/checkbox.js +3 -3
- package/dist/cjs/checkbox/checkbox.js.map +1 -1
- package/dist/cjs/checkbox/consts.d.ts +4 -3
- package/dist/cjs/checkbox/consts.d.ts.map +1 -1
- package/dist/cjs/checkbox/consts.js +4 -3
- package/dist/cjs/checkbox/consts.js.map +1 -1
- package/dist/cjs/checkbox/theme.d.ts +2 -2
- package/dist/cjs/input/consts.d.ts +27 -21
- package/dist/cjs/input/consts.d.ts.map +1 -1
- package/dist/cjs/input/consts.js +8 -2
- package/dist/cjs/input/consts.js.map +1 -1
- package/dist/cjs/input/helpText.d.ts +1 -1
- package/dist/cjs/input/helpText.d.ts.map +1 -1
- package/dist/cjs/input/helpText.js +2 -2
- package/dist/cjs/input/helpText.js.map +1 -1
- package/dist/cjs/input/input.d.ts.map +1 -1
- package/dist/cjs/input/input.js +3 -2
- package/dist/cjs/input/input.js.map +1 -1
- package/dist/cjs/input/input.types.d.ts +5 -3
- package/dist/cjs/input/input.types.d.ts.map +1 -1
- package/dist/cjs/input/inputInput.js +3 -2
- package/dist/cjs/input/inputInput.js.map +1 -1
- package/dist/cjs/input/theme.d.ts +8 -8
- package/dist/cjs/input/theme.js +1 -1
- package/dist/cjs/list/list.d.ts.map +1 -1
- package/dist/cjs/list/list.js +64 -2
- package/dist/cjs/list/list.js.map +1 -1
- package/dist/cjs/menu/menuItem.d.ts.map +1 -1
- package/dist/cjs/menu/menuItem.js +1 -1
- package/dist/cjs/menu/menuItem.js.map +1 -1
- package/dist/cjs/menu/menuList.d.ts.map +1 -1
- package/dist/cjs/menu/menuList.js +1 -1
- package/dist/cjs/menu/menuList.js.map +1 -1
- package/dist/cjs/radio/consts.d.ts +4 -3
- package/dist/cjs/radio/consts.d.ts.map +1 -1
- package/dist/cjs/radio/consts.js +4 -3
- package/dist/cjs/radio/consts.js.map +1 -1
- package/dist/cjs/radio/radio.js +1 -1
- package/dist/cjs/radio/radio.js.map +1 -1
- package/dist/cjs/radio/theme.d.ts +2 -2
- package/dist/cjs/select/selectButton.d.ts.map +1 -1
- package/dist/cjs/select/selectButton.js +14 -5
- package/dist/cjs/select/selectButton.js.map +1 -1
- package/dist/cjs/tabs/tabsNavBar.d.ts.map +1 -1
- package/dist/cjs/tabs/tabsNavBar.js +5 -1
- package/dist/cjs/tabs/tabsNavBar.js.map +1 -1
- package/dist/cjs/textarea/textarea.d.ts.map +1 -1
- package/dist/cjs/textarea/textarea.js +7 -4
- package/dist/cjs/textarea/textarea.js.map +1 -1
- package/dist/cjs/textarea/textarea.types.d.ts +6 -0
- package/dist/cjs/textarea/textarea.types.d.ts.map +1 -1
- package/dist/cjs/textarea/theme.d.ts +8 -8
- package/dist/cjs/textarea/theme.js +1 -1
- package/dist/cjs/theme/components.d.ts +20 -20
- package/dist/cjs/theme/defaultTheme.d.ts +20 -20
- package/dist/esm/button/button.d.ts.map +1 -1
- package/dist/esm/button/button.js +3 -2
- package/dist/esm/button/button.js.map +1 -1
- package/dist/esm/checkbox/checkbox.js +3 -3
- package/dist/esm/checkbox/checkbox.js.map +1 -1
- package/dist/esm/checkbox/consts.d.ts +4 -3
- package/dist/esm/checkbox/consts.d.ts.map +1 -1
- package/dist/esm/checkbox/consts.js +4 -3
- package/dist/esm/checkbox/consts.js.map +1 -1
- package/dist/esm/checkbox/theme.d.ts +2 -2
- package/dist/esm/input/consts.d.ts +27 -21
- package/dist/esm/input/consts.d.ts.map +1 -1
- package/dist/esm/input/consts.js +7 -1
- package/dist/esm/input/consts.js.map +1 -1
- package/dist/esm/input/helpText.d.ts +1 -1
- package/dist/esm/input/helpText.d.ts.map +1 -1
- package/dist/esm/input/helpText.js +2 -2
- package/dist/esm/input/helpText.js.map +1 -1
- package/dist/esm/input/input.d.ts.map +1 -1
- package/dist/esm/input/input.js +4 -3
- package/dist/esm/input/input.js.map +1 -1
- package/dist/esm/input/input.types.d.ts +5 -3
- package/dist/esm/input/input.types.d.ts.map +1 -1
- package/dist/esm/input/inputInput.js +3 -2
- package/dist/esm/input/inputInput.js.map +1 -1
- package/dist/esm/input/theme.d.ts +8 -8
- package/dist/esm/input/theme.js +1 -1
- package/dist/esm/list/list.d.ts.map +1 -1
- package/dist/esm/list/list.js +40 -2
- package/dist/esm/list/list.js.map +1 -1
- package/dist/esm/menu/menuItem.d.ts.map +1 -1
- package/dist/esm/menu/menuItem.js +1 -1
- package/dist/esm/menu/menuItem.js.map +1 -1
- package/dist/esm/menu/menuList.d.ts.map +1 -1
- package/dist/esm/menu/menuList.js +1 -1
- package/dist/esm/menu/menuList.js.map +1 -1
- package/dist/esm/radio/consts.d.ts +4 -3
- package/dist/esm/radio/consts.d.ts.map +1 -1
- package/dist/esm/radio/consts.js +4 -3
- package/dist/esm/radio/consts.js.map +1 -1
- package/dist/esm/radio/radio.js +1 -1
- package/dist/esm/radio/radio.js.map +1 -1
- package/dist/esm/radio/theme.d.ts +2 -2
- package/dist/esm/select/selectButton.d.ts.map +1 -1
- package/dist/esm/select/selectButton.js +14 -5
- package/dist/esm/select/selectButton.js.map +1 -1
- package/dist/esm/tabs/tabsNavBar.d.ts.map +1 -1
- package/dist/esm/tabs/tabsNavBar.js +4 -1
- package/dist/esm/tabs/tabsNavBar.js.map +1 -1
- package/dist/esm/textarea/textarea.d.ts.map +1 -1
- package/dist/esm/textarea/textarea.js +8 -5
- package/dist/esm/textarea/textarea.js.map +1 -1
- package/dist/esm/textarea/textarea.types.d.ts +6 -0
- package/dist/esm/textarea/textarea.types.d.ts.map +1 -1
- package/dist/esm/textarea/theme.d.ts +8 -8
- package/dist/esm/textarea/theme.js +1 -1
- package/dist/esm/theme/components.d.ts +20 -20
- package/dist/esm/theme/defaultTheme.d.ts +20 -20
- package/dist/tsconfig.legacy.tsbuildinfo +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/button/button.tsx +11 -6
- package/src/checkbox/checkbox.tsx +3 -3
- package/src/checkbox/consts.ts +5 -4
- package/src/input/consts.ts +12 -5
- package/src/input/helpText.tsx +2 -2
- package/src/input/input.tsx +10 -4
- package/src/input/input.types.ts +5 -4
- package/src/input/inputInput.tsx +2 -2
- package/src/input/theme.ts +1 -1
- package/src/list/list.tsx +44 -3
- package/src/menu/menuItem.tsx +1 -10
- package/src/menu/menuList.tsx +1 -0
- package/src/radio/consts.ts +5 -4
- package/src/radio/radio.tsx +1 -1
- package/src/select/selectButton.tsx +16 -5
- package/src/tabs/tabsNavBar.tsx +4 -1
- package/src/textarea/textarea.tsx +16 -4
- package/src/textarea/textarea.types.ts +6 -0
- package/src/textarea/theme.ts +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@veracity/vui",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.19.1",
|
|
4
4
|
"description": "Veracity UI is a React component library crafted for use within Veracity applications and pages. Based on Styled Components and @xstyled.",
|
|
5
5
|
"module": "./dist/esm/index.js",
|
|
6
6
|
"main": "./dist/cjs/index.js",
|
package/src/button/button.tsx
CHANGED
|
@@ -55,7 +55,7 @@ export const Button = vui<'button', ButtonProps>((props, ref) => {
|
|
|
55
55
|
dropDownIcon = 'falAngleDown',
|
|
56
56
|
icon,
|
|
57
57
|
iconLeft,
|
|
58
|
-
iconRight,
|
|
58
|
+
iconRight: iconRightProp,
|
|
59
59
|
isActive,
|
|
60
60
|
isDropDown,
|
|
61
61
|
isElevated,
|
|
@@ -77,6 +77,8 @@ export const Button = vui<'button', ButtonProps>((props, ref) => {
|
|
|
77
77
|
|
|
78
78
|
const { iconProps: stateIconProps, ...stateProps } = states[state] ?? {}
|
|
79
79
|
|
|
80
|
+
const iconRight = isDropDown ? 'falAngleDown' : iconRightProp
|
|
81
|
+
|
|
80
82
|
const variant = filterUndefined({
|
|
81
83
|
variant: states[state]?.variant ?? variantProp,
|
|
82
84
|
})
|
|
@@ -138,7 +140,7 @@ export const Button = vui<'button', ButtonProps>((props, ref) => {
|
|
|
138
140
|
focusRing={3}
|
|
139
141
|
h={h}
|
|
140
142
|
pl={pl}
|
|
141
|
-
pr={
|
|
143
|
+
pr={pr}
|
|
142
144
|
ref={ref}
|
|
143
145
|
title={title || ariaLabel}
|
|
144
146
|
type="button"
|
|
@@ -159,19 +161,22 @@ export const Button = vui<'button', ButtonProps>((props, ref) => {
|
|
|
159
161
|
{!icon && (
|
|
160
162
|
<>
|
|
161
163
|
{isLoading ? (
|
|
162
|
-
<ButtonIcon mr={
|
|
164
|
+
<ButtonIcon mr={iconLeftMr} {...loadingIconProps} />
|
|
163
165
|
) : isString(iconLeft) ? (
|
|
164
|
-
<ButtonIcon mr={
|
|
166
|
+
<ButtonIcon mr={iconLeftMr} name={iconLeft} />
|
|
165
167
|
) : (
|
|
166
168
|
iconLeft
|
|
167
169
|
)}
|
|
168
170
|
|
|
169
171
|
{children ?? (isReactText(text) ? <ButtonText {...{ isTruncated, text }} /> : text)}
|
|
170
172
|
|
|
171
|
-
{isString(iconRight) ?
|
|
173
|
+
{isString(iconRight) ? (
|
|
174
|
+
<ButtonIcon ml={!children && !text ? 0 : iconRightMl} name={iconRight} />
|
|
175
|
+
) : (
|
|
176
|
+
iconRight
|
|
177
|
+
)}
|
|
172
178
|
</>
|
|
173
179
|
)}
|
|
174
|
-
{isDropDown && <ButtonIcon name={dropDownIcon} />}
|
|
175
180
|
</Content>
|
|
176
181
|
</ButtonBase>
|
|
177
182
|
</ButtonProvider>
|
|
@@ -39,11 +39,11 @@ export const CheckboxBase = styled.labelBox<CheckboxStyleProps>`
|
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
&[aria-disabled='true'] {
|
|
42
|
-
color: ${checkboxColors.
|
|
42
|
+
color: ${checkboxColors.disabledText};
|
|
43
43
|
cursor: not-allowed;
|
|
44
44
|
|
|
45
45
|
.vui-checkboxControl {
|
|
46
|
-
color: ${checkboxColors.
|
|
46
|
+
color: ${checkboxColors.disabledText};
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
49
|
`
|
|
@@ -81,7 +81,7 @@ export const Checkbox = vui<'span', CheckboxProps>((props, ref) => {
|
|
|
81
81
|
const { color: controlColor, hoverColor, ...controlStyles } = styles.control
|
|
82
82
|
|
|
83
83
|
const icon = isIndeterminate ? iconIndeterminate : isChecked ? iconChecked : iconProp
|
|
84
|
-
const controlMr = children || label ?
|
|
84
|
+
const controlMr = children || label ? 1 : 0
|
|
85
85
|
const color = controlColor ? controlColor : checkboxColors.main
|
|
86
86
|
const controlHoverColor = hoverColor ? hoverColor : checkboxColors.hover
|
|
87
87
|
const isLongLabel = label && label?.length >= 60
|
package/src/checkbox/consts.ts
CHANGED
package/src/input/consts.ts
CHANGED
|
@@ -7,17 +7,17 @@ export const inputColors = {
|
|
|
7
7
|
helpText: 'sandstone.30',
|
|
8
8
|
icons: 'seaBlue.main',
|
|
9
9
|
disabled: 'sandstone.95',
|
|
10
|
-
focus: '
|
|
10
|
+
focus: 'focusColor',
|
|
11
11
|
error: 'energyRed.45',
|
|
12
12
|
loading: 'seaBlue.80',
|
|
13
13
|
success: 'landGreen.35',
|
|
14
|
-
}
|
|
14
|
+
} as const
|
|
15
15
|
|
|
16
16
|
export const stateIcons = {
|
|
17
17
|
error: 'falExclamationTriangle',
|
|
18
18
|
loading: 'fadSpinnerThird',
|
|
19
19
|
success: 'falCheck',
|
|
20
|
-
}
|
|
20
|
+
} as const
|
|
21
21
|
|
|
22
22
|
export const inputStateMapping: InputStateMapping = {
|
|
23
23
|
error: {
|
|
@@ -49,11 +49,18 @@ export const displayValueOnlyTextSize = {
|
|
|
49
49
|
md: 'sm',
|
|
50
50
|
lg: 'md',
|
|
51
51
|
xl: 'lg',
|
|
52
|
-
}
|
|
52
|
+
} as const
|
|
53
53
|
|
|
54
54
|
export const clearIconSize = {
|
|
55
55
|
sm: 'sm',
|
|
56
56
|
md: 'sm',
|
|
57
57
|
lg: 'sm',
|
|
58
58
|
xl: 'md',
|
|
59
|
-
}
|
|
59
|
+
} as const
|
|
60
|
+
|
|
61
|
+
export const helpTextSize = {
|
|
62
|
+
sm: 'sm',
|
|
63
|
+
md: 'sm',
|
|
64
|
+
lg: 'md',
|
|
65
|
+
xl: 'md',
|
|
66
|
+
} as const
|
package/src/input/helpText.tsx
CHANGED
|
@@ -8,7 +8,7 @@ import { inputColors } from './consts'
|
|
|
8
8
|
import { useInputContext } from './context'
|
|
9
9
|
import { HelpTextProps } from './input.types'
|
|
10
10
|
|
|
11
|
-
/** Displaying help text
|
|
11
|
+
/** Displaying help text below the input. */
|
|
12
12
|
export const HelpText = vui<'div', HelpTextProps>((props, ref) => {
|
|
13
13
|
const { className, children, isError, ...rest } = props
|
|
14
14
|
const inputProps = useInputContext()
|
|
@@ -23,7 +23,7 @@ export const HelpText = vui<'div', HelpTextProps>((props, ref) => {
|
|
|
23
23
|
className={cs('vui-inputHelpText', className)}
|
|
24
24
|
color={color}
|
|
25
25
|
display="flex"
|
|
26
|
-
|
|
26
|
+
pt={0.5}
|
|
27
27
|
ref={ref}
|
|
28
28
|
{...styles.helpText}
|
|
29
29
|
{...rest}
|
package/src/input/input.tsx
CHANGED
|
@@ -5,7 +5,7 @@ import { styled, useStyleConfig, vui, VuiComponent } from '../core'
|
|
|
5
5
|
import { T } from '../t'
|
|
6
6
|
import { ChangeEvent, cs, filterUndefined, isString } from '../utils'
|
|
7
7
|
import AutoCompletePopover from './autoCompletePopover'
|
|
8
|
-
import { clearIconSize, displayValueOnlyTextSize, inputColors, inputStateMapping } from './consts'
|
|
8
|
+
import { clearIconSize, displayValueOnlyTextSize, helpTextSize, inputColors, inputStateMapping } from './consts'
|
|
9
9
|
import { InputProvider } from './context'
|
|
10
10
|
import { getInitialCount } from './helpers'
|
|
11
11
|
import HelpText from './helpText'
|
|
@@ -47,6 +47,7 @@ export const Input = vui<'div', InputProps>((props, ref) => {
|
|
|
47
47
|
autoCompleteOptions,
|
|
48
48
|
autoCompleteMaxHeight,
|
|
49
49
|
autoFocus,
|
|
50
|
+
ariaLabel,
|
|
50
51
|
children,
|
|
51
52
|
className,
|
|
52
53
|
defaultValue,
|
|
@@ -151,6 +152,7 @@ export const Input = vui<'div', InputProps>((props, ref) => {
|
|
|
151
152
|
ref={inputRef}
|
|
152
153
|
{...{
|
|
153
154
|
autoFocus,
|
|
155
|
+
ariaLabel,
|
|
154
156
|
defaultValue,
|
|
155
157
|
disabled,
|
|
156
158
|
id,
|
|
@@ -182,7 +184,7 @@ export const Input = vui<'div', InputProps>((props, ref) => {
|
|
|
182
184
|
icon="falTimes"
|
|
183
185
|
mr={0.5}
|
|
184
186
|
onClick={onClear}
|
|
185
|
-
size={clearIconSize[size]
|
|
187
|
+
size={clearIconSize[size]}
|
|
186
188
|
title="Clear"
|
|
187
189
|
/>
|
|
188
190
|
)}
|
|
@@ -202,8 +204,12 @@ export const Input = vui<'div', InputProps>((props, ref) => {
|
|
|
202
204
|
</AutoCompletePopover>
|
|
203
205
|
)}
|
|
204
206
|
|
|
205
|
-
{!!helpText && <HelpText>{helpText}</HelpText>}
|
|
206
|
-
{!!errorText &&
|
|
207
|
+
{!!helpText && <HelpText size={helpTextSize[size]}>{helpText}</HelpText>}
|
|
208
|
+
{!!errorText && (
|
|
209
|
+
<HelpText isError size={helpTextSize[size]}>
|
|
210
|
+
{errorText}
|
|
211
|
+
</HelpText>
|
|
212
|
+
)}
|
|
207
213
|
</InputProvider>
|
|
208
214
|
)
|
|
209
215
|
}) as VuiComponent<'div', InputProps> & {
|
package/src/input/input.types.ts
CHANGED
|
@@ -7,7 +7,6 @@ import { ThemingProps } from '../theme'
|
|
|
7
7
|
import { ChangeEventHandler, FocusEventHandler, PropsOf } from '../utils'
|
|
8
8
|
|
|
9
9
|
export type InputInputProps = PropsOf<'input', SystemProps>
|
|
10
|
-
|
|
11
10
|
export type InputProps = SystemProps &
|
|
12
11
|
ThemingProps<'Input'> & {
|
|
13
12
|
/** Allow to remove input content with clear icon. */
|
|
@@ -20,14 +19,18 @@ export type InputProps = SystemProps &
|
|
|
20
19
|
autoCompleteMaxHeight?: number
|
|
21
20
|
/** Passed to the inner input. */
|
|
22
21
|
autoFocus?: boolean
|
|
22
|
+
/** ARIA label for the input element. */
|
|
23
|
+
ariaLabel?: string
|
|
23
24
|
/** Deprecated. Please use variant instead. @deprecated */
|
|
24
25
|
colorScheme?: 'green' | 'grey' | 'red'
|
|
25
26
|
/** Passed to the inner input. */
|
|
26
27
|
defaultValue?: number | string
|
|
27
28
|
/** Passed to the inner input. */
|
|
28
29
|
disabled?: boolean
|
|
29
|
-
/** Socket displaying error text
|
|
30
|
+
/** Socket displaying error text below an input. */
|
|
30
31
|
errorText?: string | React.ReactNode
|
|
32
|
+
/** Socket displaying help text below an input. */
|
|
33
|
+
helpText?: React.ReactNode | string
|
|
31
34
|
/** Socket displaying an icon on the left. */
|
|
32
35
|
iconLeft?: IconProp | JSX.Element
|
|
33
36
|
/** Socket displaying an icon on the right. */
|
|
@@ -44,8 +47,6 @@ export type InputProps = SystemProps &
|
|
|
44
47
|
itemLeft?: React.ReactNode
|
|
45
48
|
/** Socket displaying a custom element on the right. */
|
|
46
49
|
itemRight?: React.ReactNode
|
|
47
|
-
/** Socket displaying help text bellow an input. */
|
|
48
|
-
helpText?: React.ReactNode | string
|
|
49
50
|
/** Passed to the inner input. */
|
|
50
51
|
max?: number | string
|
|
51
52
|
/** Passed to the inner input. */
|
package/src/input/inputInput.tsx
CHANGED
|
@@ -25,18 +25,18 @@ export const InputInputBase = styled.input`
|
|
|
25
25
|
|
|
26
26
|
/** Displays an input element within the Input component. */
|
|
27
27
|
export const InputInput = vui<'input', InputInputProps>((props, ref) => {
|
|
28
|
-
const { className, autoComplete, ...rest } = props
|
|
28
|
+
const { type, className, autoComplete, ...rest } = props
|
|
29
29
|
const inputProps = useInputContext()
|
|
30
30
|
const mergedProps = { ...inputProps, ...props }
|
|
31
31
|
const styles = useStyleConfig('Input', mergedProps)
|
|
32
32
|
|
|
33
33
|
const aliasedProps = filterUndefined({
|
|
34
34
|
'aria-disabled': mergedProps.disabled,
|
|
35
|
+
'aria-label': mergedProps.ariaLabel,
|
|
35
36
|
})
|
|
36
37
|
|
|
37
38
|
return (
|
|
38
39
|
<InputInputBase
|
|
39
|
-
aria-label="input-text"
|
|
40
40
|
autoComplete={autoComplete}
|
|
41
41
|
className={cs('vui-inputInput', className)}
|
|
42
42
|
ref={ref}
|
package/src/input/theme.ts
CHANGED
package/src/list/list.tsx
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { is } from '@xstyled/util'
|
|
2
|
+
import React, { useEffect, useMemo, useRef } from 'react'
|
|
2
3
|
|
|
3
4
|
import { styled, useStyleConfig, vui, VuiComponent } from '../core'
|
|
4
5
|
import { cs, filterUndefined, isArray, isReactText } from '../utils'
|
|
@@ -10,6 +11,10 @@ import ListIcon from './listIcon'
|
|
|
10
11
|
import ListItem from './listItem'
|
|
11
12
|
import ListText from './listText'
|
|
12
13
|
|
|
14
|
+
const clickKeys = ['Enter', ' ']
|
|
15
|
+
const nextKeys = ['ArrowDown', 'Tab']
|
|
16
|
+
const prevKeys = ['ArrowUp']
|
|
17
|
+
|
|
13
18
|
export const ListBase = styled.ulBox``
|
|
14
19
|
|
|
15
20
|
/** Displays a list of list link items and optional heading. Exposes some props to the children via context. */
|
|
@@ -19,11 +24,47 @@ export const List = vui<'ul', ListProps>((props, ref) => {
|
|
|
19
24
|
|
|
20
25
|
const context = useMemo(() => filterUndefined({ isInteractive, size, variant }), [isInteractive, size, variant])
|
|
21
26
|
|
|
27
|
+
const listRef = useRef<HTMLUListElement>(null)
|
|
28
|
+
|
|
29
|
+
const [_, setActive] = React.useState(-1)
|
|
30
|
+
|
|
31
|
+
const onKeydown = (event: KeyboardEvent) => {
|
|
32
|
+
if ([...prevKeys, ...nextKeys, ...clickKeys].includes(event.key)) {
|
|
33
|
+
event.preventDefault()
|
|
34
|
+
setActive((a: number) => {
|
|
35
|
+
let active = a
|
|
36
|
+
if (listRef.current) {
|
|
37
|
+
const allChildren = Array.from(listRef.current.childNodes)
|
|
38
|
+
const tabIndexedChildren = allChildren.filter(child => (child as HTMLElement).tabIndex === 0)
|
|
39
|
+
|
|
40
|
+
if (nextKeys.includes(event.key) && active < tabIndexedChildren.length - 1) active++
|
|
41
|
+
if (prevKeys.includes(event.key)) active = active > 0 ? active - 1 : 0
|
|
42
|
+
|
|
43
|
+
tabIndexedChildren.forEach((node, index) => {
|
|
44
|
+
if (index === active) {
|
|
45
|
+
if (clickKeys.includes(event.key)) (node as HTMLElement)?.click()
|
|
46
|
+
else (node as HTMLElement)?.focus()
|
|
47
|
+
}
|
|
48
|
+
})
|
|
49
|
+
}
|
|
50
|
+
return active
|
|
51
|
+
})
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
useEffect(() => {
|
|
56
|
+
if (listRef.current && isInteractive) {
|
|
57
|
+
listRef.current.addEventListener('keydown', onKeydown)
|
|
58
|
+
return () => {
|
|
59
|
+
listRef.current?.removeEventListener('keydown', onKeydown)
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}, [listRef.current, isInteractive])
|
|
63
|
+
|
|
22
64
|
return (
|
|
23
65
|
<ListProvider value={context}>
|
|
24
|
-
<ListBase className={cs('vui-list', className)} ref={ref} {...styles.container} {...rest}>
|
|
66
|
+
<ListBase className={cs('vui-list', className)} ref={ref || listRef} {...styles.container} {...rest}>
|
|
25
67
|
{isReactText(heading) ? <ListHeading text={heading} /> : heading}
|
|
26
|
-
|
|
27
68
|
{children ??
|
|
28
69
|
(isArray<ListItemProps>(items)
|
|
29
70
|
? items.map(({ key, ...props }, index) => <ListItem key={key ?? index} {...props} />)
|
package/src/menu/menuItem.tsx
CHANGED
|
@@ -18,16 +18,7 @@ export const MenuItem = vui<'li', ListItemProps>((props, ref) => {
|
|
|
18
18
|
closeOnSelect && instance?.hide()
|
|
19
19
|
})
|
|
20
20
|
|
|
21
|
-
return (
|
|
22
|
-
<ListItem
|
|
23
|
-
className={cs('vui-menuItem', className)}
|
|
24
|
-
isInteractive
|
|
25
|
-
onClick={onClick}
|
|
26
|
-
ref={ref}
|
|
27
|
-
{...styles.item}
|
|
28
|
-
{...rest}
|
|
29
|
-
/>
|
|
30
|
-
)
|
|
21
|
+
return <ListItem className={cs('vui-menuItem', className)} onClick={onClick} ref={ref} {...styles.item} {...rest} />
|
|
31
22
|
})
|
|
32
23
|
|
|
33
24
|
MenuItem.displayName = 'MenuItem'
|
package/src/menu/menuList.tsx
CHANGED
package/src/radio/consts.ts
CHANGED
package/src/radio/radio.tsx
CHANGED
|
@@ -18,8 +18,16 @@ export const SelectButton = vui<'button', SelectButtonProps>((props, ref) => {
|
|
|
18
18
|
const styles = useStyleConfig('Select', useSelectContext())
|
|
19
19
|
|
|
20
20
|
const text = valueText || placeholder
|
|
21
|
-
|
|
22
|
-
const
|
|
21
|
+
|
|
22
|
+
const disabledProps = disabled
|
|
23
|
+
? {
|
|
24
|
+
activeBg: 'sandstone.79',
|
|
25
|
+
cursor: 'not-allowed',
|
|
26
|
+
backgroundColor: 'sandstone.79',
|
|
27
|
+
borderColor: 'sandstone.79',
|
|
28
|
+
hoverBg: 'sandstone.79',
|
|
29
|
+
}
|
|
30
|
+
: undefined
|
|
23
31
|
|
|
24
32
|
const readOnlyProps = readOnly
|
|
25
33
|
? {
|
|
@@ -31,14 +39,17 @@ export const SelectButton = vui<'button', SelectButtonProps>((props, ref) => {
|
|
|
31
39
|
hoverBg: 'sandstone.95',
|
|
32
40
|
opacity: 1,
|
|
33
41
|
}
|
|
34
|
-
:
|
|
42
|
+
: undefined
|
|
35
43
|
|
|
36
44
|
const isInvalidProps = isInvalid
|
|
37
45
|
? {
|
|
38
46
|
borderColor: 'energyRed.45',
|
|
39
47
|
hoverBorderColor: 'energyRed.45',
|
|
40
48
|
}
|
|
41
|
-
:
|
|
49
|
+
: undefined
|
|
50
|
+
|
|
51
|
+
const textColor = valueText ? undefined : 'sandstone.10'
|
|
52
|
+
const iconColor = disabled ? 'sandstone.10' : 'seaBlue.main'
|
|
42
53
|
|
|
43
54
|
return (
|
|
44
55
|
<PopoverTrigger
|
|
@@ -59,6 +70,7 @@ export const SelectButton = vui<'button', SelectButtonProps>((props, ref) => {
|
|
|
59
70
|
}
|
|
60
71
|
userSelect="text"
|
|
61
72
|
{...styles.button}
|
|
73
|
+
{...disabledProps}
|
|
62
74
|
{...readOnlyProps}
|
|
63
75
|
{...isInvalidProps}
|
|
64
76
|
{...rest}
|
|
@@ -67,5 +79,4 @@ export const SelectButton = vui<'button', SelectButtonProps>((props, ref) => {
|
|
|
67
79
|
})
|
|
68
80
|
|
|
69
81
|
SelectButton.displayName = 'SelectButton'
|
|
70
|
-
|
|
71
82
|
export default SelectButton
|
package/src/tabs/tabsNavBar.tsx
CHANGED
|
@@ -66,7 +66,10 @@ export const TabsNavBar = vui<'div', TabNavBarProps>((props, ref) => {
|
|
|
66
66
|
hoverColor="seaBlue.main"
|
|
67
67
|
isRound={false}
|
|
68
68
|
ml={1}
|
|
69
|
-
onClick={e =>
|
|
69
|
+
onClick={e => {
|
|
70
|
+
e.stopPropagation()
|
|
71
|
+
tab?.onDelete?.(e)
|
|
72
|
+
}}
|
|
70
73
|
title="Delete"
|
|
71
74
|
/>
|
|
72
75
|
)}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { useEffect, useState } from 'react'
|
|
2
2
|
|
|
3
3
|
import { omitThemingProps, styled, useStyleConfig, vui } from '../core'
|
|
4
|
-
import { inputColors } from '../input/consts'
|
|
4
|
+
import { helpTextSize, inputColors } from '../input/consts'
|
|
5
|
+
import HelpText from '../input/helpText'
|
|
5
6
|
import T from '../t'
|
|
6
7
|
import { ChangeEvent, cs, filterUndefined } from '../utils'
|
|
7
8
|
import { getInitialCount } from './helpers'
|
|
@@ -13,6 +14,7 @@ const TextareaTextarea = styled.textareaBox`
|
|
|
13
14
|
outline: none;
|
|
14
15
|
padding: 1;
|
|
15
16
|
resize: none;
|
|
17
|
+
min-height: 80px;
|
|
16
18
|
transition-duration: fast;
|
|
17
19
|
width: 100%;
|
|
18
20
|
|
|
@@ -26,7 +28,7 @@ const TextareaTextarea = styled.textareaBox`
|
|
|
26
28
|
|
|
27
29
|
export const TextareaBase = styled.divBox`
|
|
28
30
|
display: flex;
|
|
29
|
-
|
|
31
|
+
flex-direction: column;
|
|
30
32
|
position: relative;
|
|
31
33
|
width: 100%;
|
|
32
34
|
`
|
|
@@ -38,12 +40,15 @@ export const TextareaBase = styled.divBox`
|
|
|
38
40
|
export const Textarea = vui<'div', TextareaProps>((props, ref) => {
|
|
39
41
|
const {
|
|
40
42
|
autoFocus,
|
|
43
|
+
ariaLabel,
|
|
41
44
|
className,
|
|
42
45
|
colorScheme: colorSchemeProp,
|
|
43
46
|
cols,
|
|
44
47
|
defaultValue,
|
|
45
48
|
disabled,
|
|
49
|
+
errorText,
|
|
46
50
|
id,
|
|
51
|
+
helpText,
|
|
47
52
|
maxLength,
|
|
48
53
|
name,
|
|
49
54
|
onBlur,
|
|
@@ -78,6 +83,7 @@ export const Textarea = vui<'div', TextareaProps>((props, ref) => {
|
|
|
78
83
|
|
|
79
84
|
const textareaAliasedProps = filterUndefined({
|
|
80
85
|
'aria-disabled': disabled,
|
|
86
|
+
'aria-label': ariaLabel,
|
|
81
87
|
bg: readOnly ? 'sandstone.97' : undefined,
|
|
82
88
|
borderColor: readOnly ? 'sandstone.55' : undefined,
|
|
83
89
|
focusWithinBorderColor: !readOnly ? 'transparent' : undefined,
|
|
@@ -92,7 +98,6 @@ export const Textarea = vui<'div', TextareaProps>((props, ref) => {
|
|
|
92
98
|
return (
|
|
93
99
|
<TextareaBase className={cs('vui-textarea', className)} ref={ref} {...styles.container} {...aliasedProps} {...rest}>
|
|
94
100
|
<TextareaTextarea
|
|
95
|
-
aria-label="input-textarea"
|
|
96
101
|
className="vui-textareaTextarea"
|
|
97
102
|
ref={textareaRef}
|
|
98
103
|
{...{
|
|
@@ -130,6 +135,13 @@ export const Textarea = vui<'div', TextareaProps>((props, ref) => {
|
|
|
130
135
|
{count} {maxLength ? `/ ${maxLength}` : null}
|
|
131
136
|
</T>
|
|
132
137
|
)}
|
|
138
|
+
|
|
139
|
+
{!!helpText && <HelpText size={helpTextSize['lg']}>{helpText}</HelpText>}
|
|
140
|
+
{!!errorText && (
|
|
141
|
+
<HelpText isError size={helpTextSize['lg']}>
|
|
142
|
+
{errorText}
|
|
143
|
+
</HelpText>
|
|
144
|
+
)}
|
|
133
145
|
</TextareaBase>
|
|
134
146
|
)
|
|
135
147
|
})
|
|
@@ -6,6 +6,8 @@ export type TextareaProps = SystemProps &
|
|
|
6
6
|
ThemingProps<'Textarea'> & {
|
|
7
7
|
/** Passed to the inner input. */
|
|
8
8
|
autoFocus?: boolean
|
|
9
|
+
/** ARIA label for the input element. */
|
|
10
|
+
ariaLabel?: string
|
|
9
11
|
/** Children are disabled for this component. */
|
|
10
12
|
children?: never
|
|
11
13
|
/** Deprecated. Please use variant instead. @deprecated */
|
|
@@ -16,6 +18,10 @@ export type TextareaProps = SystemProps &
|
|
|
16
18
|
defaultValue?: number | string
|
|
17
19
|
/** Passed to the inner input. */
|
|
18
20
|
disabled?: boolean
|
|
21
|
+
/** Socket displaying error text below an input. */
|
|
22
|
+
errorText?: string | React.ReactNode
|
|
23
|
+
/** Socket displaying help text below an input. */
|
|
24
|
+
helpText?: React.ReactNode | string
|
|
19
25
|
/** Deprecated. Please use variant="red" instead. @deprecated*/
|
|
20
26
|
isInvalid?: boolean
|
|
21
27
|
/** Passed to the inner input. */
|