@veracity/vui 1.9.1 → 2.0.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/dist/cjs/avatar/avatar.js +1 -1
- package/dist/cjs/badge/badge.d.ts +9 -0
- package/dist/cjs/badge/badge.d.ts.map +1 -0
- package/dist/cjs/badge/badge.js +35 -0
- package/dist/cjs/badge/badge.types.d.ts +17 -0
- package/dist/cjs/badge/badge.types.d.ts.map +1 -0
- package/dist/cjs/badge/badge.types.js +2 -0
- package/dist/cjs/badge/index.d.ts +3 -0
- package/dist/cjs/badge/index.d.ts.map +1 -0
- package/dist/cjs/badge/index.js +23 -0
- package/dist/cjs/badge/theme.d.ts +130 -0
- package/dist/cjs/badge/theme.d.ts.map +1 -0
- package/dist/cjs/badge/theme.js +135 -0
- package/dist/cjs/button/button.d.ts +1 -1
- package/dist/cjs/button/button.d.ts.map +1 -1
- package/dist/cjs/button/button.js +16 -23
- package/dist/cjs/button/button.types.d.ts +3 -4
- package/dist/cjs/button/button.types.d.ts.map +1 -1
- package/dist/cjs/button/buttons.js +8 -8
- package/dist/cjs/button/consts.js +3 -3
- package/dist/cjs/button/theme.d.ts +204 -44
- package/dist/cjs/button/theme.d.ts.map +1 -1
- package/dist/cjs/button/theme.js +220 -54
- package/dist/cjs/buttonGroup/buttonGroup.d.ts.map +1 -1
- package/dist/cjs/buttonGroup/buttonGroup.js +5 -5
- package/dist/cjs/buttonGroup/buttonGroup.types.d.ts +2 -3
- package/dist/cjs/buttonGroup/buttonGroup.types.d.ts.map +1 -1
- package/dist/cjs/buttonGroup/helpers.d.ts.map +1 -1
- package/dist/cjs/buttonGroup/helpers.js +2 -3
- package/dist/cjs/buttonToggleGroup/buttonToggleGroup.d.ts.map +1 -1
- package/dist/cjs/buttonToggleGroup/buttonToggleGroup.js +1 -1
- package/dist/cjs/checkbox/checkbox.js +1 -1
- package/dist/cjs/copyToClipboard/copyToClipboard.js +1 -1
- package/dist/cjs/core/vuiProvider/globalStyle.d.ts.map +1 -1
- package/dist/cjs/core/vuiProvider/globalStyle.js +55 -38
- package/dist/cjs/footer/footerTrademark.js +1 -1
- package/dist/cjs/heading/heading.d.ts.map +1 -1
- package/dist/cjs/heading/heading.js +7 -1
- package/dist/cjs/heading/heading.types.d.ts +1 -0
- package/dist/cjs/heading/heading.types.d.ts.map +1 -1
- package/dist/cjs/heading/theme.d.ts +67 -9
- package/dist/cjs/heading/theme.d.ts.map +1 -1
- package/dist/cjs/heading/theme.js +69 -11
- package/dist/cjs/icon/icon.types.d.ts +1 -1
- package/dist/cjs/icon/icon.types.d.ts.map +1 -1
- package/dist/cjs/icon/theme.d.ts +5 -0
- package/dist/cjs/icon/theme.d.ts.map +1 -1
- package/dist/cjs/icon/theme.js +5 -0
- package/dist/cjs/index.d.ts +1 -0
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +1 -0
- package/dist/cjs/input/input.js +1 -1
- package/dist/cjs/input/inputInput.js +1 -1
- package/dist/cjs/link/link.d.ts.map +1 -1
- package/dist/cjs/link/link.js +3 -3
- package/dist/cjs/link/link.types.d.ts +1 -1
- package/dist/cjs/link/link.types.d.ts.map +1 -1
- package/dist/cjs/link/theme.d.ts +21 -4
- package/dist/cjs/link/theme.d.ts.map +1 -1
- package/dist/cjs/link/theme.js +30 -17
- package/dist/cjs/list/listItem.d.ts.map +1 -1
- package/dist/cjs/list/listItem.js +6 -2
- package/dist/cjs/notification/consts.js +10 -10
- package/dist/cjs/notification/notification.d.ts.map +1 -1
- package/dist/cjs/notification/notification.js +10 -8
- package/dist/cjs/notification/notification.types.d.ts +2 -2
- package/dist/cjs/notification/notification.types.d.ts.map +1 -1
- package/dist/cjs/notification/notificationButton.d.ts.map +1 -1
- package/dist/cjs/notification/notificationButton.js +5 -1
- package/dist/cjs/notification/notificationIcon.d.ts.map +1 -1
- package/dist/cjs/notification/notificationIcon.js +3 -2
- package/dist/cjs/notification/notificationText.d.ts.map +1 -1
- package/dist/cjs/notification/notificationText.js +1 -1
- package/dist/cjs/notification/notificationTitle.d.ts +2 -2
- package/dist/cjs/notification/notificationTitle.d.ts.map +1 -1
- package/dist/cjs/notification/notificationTitle.js +2 -2
- package/dist/cjs/notification/theme.d.ts +31 -16
- package/dist/cjs/notification/theme.d.ts.map +1 -1
- package/dist/cjs/notification/theme.js +32 -26
- package/dist/cjs/onedesign-tokens/dist/js/es6/rem/button.d.ts +85 -0
- package/dist/cjs/onedesign-tokens/dist/js/es6/rem/button.d.ts.map +1 -0
- package/dist/cjs/onedesign-tokens/dist/js/es6/rem/button.js +88 -0
- package/dist/cjs/p/theme.d.ts +0 -8
- package/dist/cjs/p/theme.d.ts.map +1 -1
- package/dist/cjs/p/theme.js +3 -11
- package/dist/cjs/progress/progress.js +1 -1
- package/dist/cjs/select/selectButton.js +1 -1
- package/dist/cjs/sidemenu/sidemenu.js +1 -1
- package/dist/cjs/sidemenu/sidemenuItem.js +2 -2
- package/dist/cjs/t/theme.d.ts +10 -1
- package/dist/cjs/t/theme.d.ts.map +1 -1
- package/dist/cjs/t/theme.js +10 -1
- package/dist/cjs/table/tbody.d.ts.map +1 -1
- package/dist/cjs/table/tbody.js +4 -0
- package/dist/cjs/table/theme.d.ts +5 -0
- package/dist/cjs/table/theme.d.ts.map +1 -1
- package/dist/cjs/table/theme.js +6 -1
- package/dist/cjs/tabs/tabs.types.d.ts +2 -2
- package/dist/cjs/tabs/tabs.types.d.ts.map +1 -1
- package/dist/cjs/tabs/tabsNavBar.d.ts.map +1 -1
- package/dist/cjs/tabs/tabsNavBar.js +13 -5
- package/dist/cjs/tabs/theme.d.ts +40 -4
- package/dist/cjs/tabs/theme.d.ts.map +1 -1
- package/dist/cjs/tabs/theme.js +41 -4
- package/dist/cjs/tag/tag.js +9 -6
- package/dist/cjs/tag/tag.types.d.ts +4 -3
- package/dist/cjs/tag/tag.types.d.ts.map +1 -1
- package/dist/cjs/tag/tagButton.d.ts.map +1 -1
- package/dist/cjs/tag/tagButton.js +1 -1
- package/dist/cjs/tag/theme.d.ts +178 -32
- package/dist/cjs/tag/theme.d.ts.map +1 -1
- package/dist/cjs/tag/theme.js +182 -65
- package/dist/cjs/textarea/textarea.js +1 -1
- package/dist/cjs/theme/components.d.ts +624 -47
- package/dist/cjs/theme/components.d.ts.map +1 -1
- package/dist/cjs/theme/components.js +76 -74
- package/dist/cjs/theme/defaultTheme.d.ts +916 -48
- package/dist/cjs/theme/defaultTheme.d.ts.map +1 -1
- package/dist/cjs/theme/foundations/colors.d.ts +523 -0
- package/dist/cjs/theme/foundations/colors.d.ts.map +1 -1
- package/dist/cjs/theme/foundations/colors.js +389 -1
- package/dist/cjs/theme/foundations/fontWeights.d.ts +0 -1
- package/dist/cjs/theme/foundations/fontWeights.d.ts.map +1 -1
- package/dist/cjs/theme/foundations/fontWeights.js +1 -2
- package/dist/cjs/theme/foundations/index.d.ts +292 -1
- package/dist/cjs/theme/foundations/index.d.ts.map +1 -1
- package/dist/cjs/theme/foundations/radii.d.ts +5 -0
- package/dist/cjs/theme/foundations/radii.d.ts.map +1 -1
- package/dist/cjs/theme/foundations/radii.js +8 -3
- package/dist/cjs/toast/useToast.d.ts.map +1 -1
- package/dist/cjs/toast/useToast.js +1 -1
- package/dist/cjs/tutorial/tutorialCard.d.ts.map +1 -1
- package/dist/cjs/tutorial/tutorialCard.js +3 -3
- package/dist/esm/avatar/avatar.js +1 -1
- package/dist/esm/badge/badge.d.ts +9 -0
- package/dist/esm/badge/badge.d.ts.map +1 -0
- package/dist/esm/badge/badge.js +17 -0
- package/dist/esm/badge/badge.types.d.ts +17 -0
- package/dist/esm/badge/badge.types.d.ts.map +1 -0
- package/dist/esm/badge/badge.types.js +1 -0
- package/dist/esm/badge/index.d.ts +3 -0
- package/dist/esm/badge/index.d.ts.map +1 -0
- package/dist/esm/badge/index.js +2 -0
- package/dist/esm/badge/theme.d.ts +130 -0
- package/dist/esm/badge/theme.d.ts.map +1 -0
- package/dist/esm/badge/theme.js +133 -0
- package/dist/esm/button/button.d.ts +1 -1
- package/dist/esm/button/button.d.ts.map +1 -1
- package/dist/esm/button/button.js +16 -23
- package/dist/esm/button/button.types.d.ts +3 -4
- package/dist/esm/button/button.types.d.ts.map +1 -1
- package/dist/esm/button/buttons.js +8 -8
- package/dist/esm/button/consts.js +3 -3
- package/dist/esm/button/theme.d.ts +204 -44
- package/dist/esm/button/theme.d.ts.map +1 -1
- package/dist/esm/button/theme.js +220 -58
- package/dist/esm/buttonGroup/buttonGroup.d.ts.map +1 -1
- package/dist/esm/buttonGroup/buttonGroup.js +6 -6
- package/dist/esm/buttonGroup/buttonGroup.types.d.ts +2 -3
- package/dist/esm/buttonGroup/buttonGroup.types.d.ts.map +1 -1
- package/dist/esm/buttonGroup/helpers.d.ts.map +1 -1
- package/dist/esm/buttonGroup/helpers.js +2 -3
- package/dist/esm/buttonToggleGroup/buttonToggleGroup.d.ts.map +1 -1
- package/dist/esm/buttonToggleGroup/buttonToggleGroup.js +1 -1
- package/dist/esm/checkbox/checkbox.js +1 -1
- package/dist/esm/copyToClipboard/copyToClipboard.js +1 -1
- package/dist/esm/core/vuiProvider/globalStyle.d.ts.map +1 -1
- package/dist/esm/core/vuiProvider/globalStyle.js +55 -38
- package/dist/esm/footer/footerTrademark.js +1 -1
- package/dist/esm/heading/heading.d.ts.map +1 -1
- package/dist/esm/heading/heading.js +8 -2
- package/dist/esm/heading/heading.types.d.ts +1 -0
- package/dist/esm/heading/heading.types.d.ts.map +1 -1
- package/dist/esm/heading/theme.d.ts +67 -9
- package/dist/esm/heading/theme.d.ts.map +1 -1
- package/dist/esm/heading/theme.js +69 -11
- package/dist/esm/icon/icon.types.d.ts +1 -1
- package/dist/esm/icon/icon.types.d.ts.map +1 -1
- package/dist/esm/icon/theme.d.ts +5 -0
- package/dist/esm/icon/theme.d.ts.map +1 -1
- package/dist/esm/icon/theme.js +5 -0
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +1 -0
- package/dist/esm/input/input.js +1 -1
- package/dist/esm/input/inputInput.js +1 -1
- package/dist/esm/link/link.d.ts.map +1 -1
- package/dist/esm/link/link.js +3 -3
- package/dist/esm/link/link.types.d.ts +1 -1
- package/dist/esm/link/link.types.d.ts.map +1 -1
- package/dist/esm/link/theme.d.ts +21 -4
- package/dist/esm/link/theme.d.ts.map +1 -1
- package/dist/esm/link/theme.js +30 -17
- package/dist/esm/list/listItem.d.ts.map +1 -1
- package/dist/esm/list/listItem.js +6 -2
- package/dist/esm/notification/consts.js +10 -10
- package/dist/esm/notification/notification.d.ts.map +1 -1
- package/dist/esm/notification/notification.js +11 -9
- package/dist/esm/notification/notification.types.d.ts +2 -2
- package/dist/esm/notification/notification.types.d.ts.map +1 -1
- package/dist/esm/notification/notificationButton.d.ts.map +1 -1
- package/dist/esm/notification/notificationButton.js +4 -1
- package/dist/esm/notification/notificationIcon.d.ts.map +1 -1
- package/dist/esm/notification/notificationIcon.js +3 -2
- package/dist/esm/notification/notificationText.d.ts.map +1 -1
- package/dist/esm/notification/notificationText.js +1 -1
- package/dist/esm/notification/notificationTitle.d.ts +2 -2
- package/dist/esm/notification/notificationTitle.d.ts.map +1 -1
- package/dist/esm/notification/notificationTitle.js +2 -2
- package/dist/esm/notification/theme.d.ts +31 -16
- package/dist/esm/notification/theme.d.ts.map +1 -1
- package/dist/esm/notification/theme.js +32 -26
- package/dist/esm/onedesign-tokens/dist/js/es6/rem/button.d.ts +85 -0
- package/dist/esm/onedesign-tokens/dist/js/es6/rem/button.d.ts.map +1 -0
- package/dist/esm/onedesign-tokens/dist/js/es6/rem/button.js +84 -0
- package/dist/esm/p/theme.d.ts +0 -8
- package/dist/esm/p/theme.d.ts.map +1 -1
- package/dist/esm/p/theme.js +3 -11
- package/dist/esm/progress/progress.js +1 -1
- package/dist/esm/select/selectButton.js +1 -1
- package/dist/esm/sidemenu/sidemenu.js +1 -1
- package/dist/esm/sidemenu/sidemenuItem.js +2 -2
- package/dist/esm/t/theme.d.ts +10 -1
- package/dist/esm/t/theme.d.ts.map +1 -1
- package/dist/esm/t/theme.js +10 -1
- package/dist/esm/table/tbody.d.ts.map +1 -1
- package/dist/esm/table/tbody.js +4 -0
- package/dist/esm/table/theme.d.ts +5 -0
- package/dist/esm/table/theme.d.ts.map +1 -1
- package/dist/esm/table/theme.js +6 -1
- package/dist/esm/tabs/tabs.types.d.ts +2 -2
- package/dist/esm/tabs/tabs.types.d.ts.map +1 -1
- package/dist/esm/tabs/tabsNavBar.d.ts.map +1 -1
- package/dist/esm/tabs/tabsNavBar.js +12 -4
- package/dist/esm/tabs/theme.d.ts +40 -4
- package/dist/esm/tabs/theme.d.ts.map +1 -1
- package/dist/esm/tabs/theme.js +41 -4
- package/dist/esm/tag/tag.js +9 -6
- package/dist/esm/tag/tag.types.d.ts +4 -3
- package/dist/esm/tag/tag.types.d.ts.map +1 -1
- package/dist/esm/tag/tagButton.d.ts.map +1 -1
- package/dist/esm/tag/tagButton.js +1 -1
- package/dist/esm/tag/theme.d.ts +178 -32
- package/dist/esm/tag/theme.d.ts.map +1 -1
- package/dist/esm/tag/theme.js +182 -65
- package/dist/esm/textarea/textarea.js +1 -1
- package/dist/esm/theme/components.d.ts +624 -47
- package/dist/esm/theme/components.d.ts.map +1 -1
- package/dist/esm/theme/components.js +2 -0
- package/dist/esm/theme/defaultTheme.d.ts +916 -48
- package/dist/esm/theme/defaultTheme.d.ts.map +1 -1
- package/dist/esm/theme/foundations/colors.d.ts +523 -0
- package/dist/esm/theme/foundations/colors.d.ts.map +1 -1
- package/dist/esm/theme/foundations/colors.js +365 -0
- package/dist/esm/theme/foundations/fontWeights.d.ts +0 -1
- package/dist/esm/theme/foundations/fontWeights.d.ts.map +1 -1
- package/dist/esm/theme/foundations/fontWeights.js +1 -2
- package/dist/esm/theme/foundations/index.d.ts +292 -1
- package/dist/esm/theme/foundations/index.d.ts.map +1 -1
- package/dist/esm/theme/foundations/radii.d.ts +5 -0
- package/dist/esm/theme/foundations/radii.d.ts.map +1 -1
- package/dist/esm/theme/foundations/radii.js +8 -3
- package/dist/esm/toast/useToast.d.ts.map +1 -1
- package/dist/esm/toast/useToast.js +1 -1
- package/dist/esm/tutorial/tutorialCard.d.ts.map +1 -1
- package/dist/esm/tutorial/tutorialCard.js +3 -3
- package/package.json +1 -1
- package/src/avatar/avatar.tsx +1 -1
- package/src/badge/badge.tsx +36 -0
- package/src/badge/badge.types.ts +17 -0
- package/src/badge/index.ts +2 -0
- package/src/badge/theme.ts +140 -0
- package/src/button/button.tsx +19 -28
- package/src/button/button.types.ts +4 -8
- package/src/button/buttons.tsx +8 -8
- package/src/button/consts.ts +3 -3
- package/src/button/theme.ts +229 -71
- package/src/buttonGroup/buttonGroup.tsx +6 -9
- package/src/buttonGroup/buttonGroup.types.ts +2 -3
- package/src/buttonGroup/helpers.ts +2 -4
- package/src/buttonToggleGroup/buttonToggleGroup.tsx +0 -2
- package/src/checkbox/checkbox.tsx +1 -1
- package/src/copyToClipboard/copyToClipboard.tsx +1 -1
- package/src/core/vuiProvider/globalStyle.tsx +55 -38
- package/src/footer/footerTrademark.tsx +1 -1
- package/src/heading/heading.tsx +19 -2
- package/src/heading/heading.types.ts +2 -0
- package/src/heading/theme.ts +69 -11
- package/src/icon/icon.types.ts +1 -1
- package/src/icon/theme.ts +5 -0
- package/src/index.ts +1 -0
- package/src/input/input.tsx +1 -1
- package/src/input/inputInput.tsx +1 -1
- package/src/link/link.tsx +2 -3
- package/src/link/link.types.ts +1 -1
- package/src/link/theme.ts +30 -20
- package/src/list/listItem.tsx +6 -2
- package/src/notification/consts.ts +10 -10
- package/src/notification/notification.tsx +16 -11
- package/src/notification/notification.types.ts +2 -2
- package/src/notification/notificationButton.tsx +10 -5
- package/src/notification/notificationIcon.tsx +6 -3
- package/src/notification/notificationText.tsx +2 -1
- package/src/notification/notificationTitle.tsx +3 -9
- package/src/notification/theme.ts +32 -34
- package/src/onedesign-tokens/dist/js/es6/rem/button.js +85 -0
- package/src/p/theme.ts +3 -11
- package/src/progress/progress.tsx +1 -1
- package/src/select/selectButton.tsx +1 -1
- package/src/sidemenu/sidemenu.tsx +1 -1
- package/src/sidemenu/sidemenuItem.tsx +3 -3
- package/src/t/theme.ts +10 -1
- package/src/table/tbody.tsx +4 -0
- package/src/table/theme.ts +6 -1
- package/src/tabs/tabs.types.ts +2 -2
- package/src/tabs/tabsNavBar.tsx +23 -6
- package/src/tabs/theme.ts +41 -4
- package/src/tag/tag.tsx +11 -11
- package/src/tag/tag.types.ts +32 -31
- package/src/tag/tagButton.tsx +1 -2
- package/src/tag/theme.ts +183 -80
- package/src/textarea/textarea.tsx +1 -1
- package/src/theme/components.ts +2 -0
- package/src/theme/foundations/colors.ts +401 -0
- package/src/theme/foundations/fontWeights.ts +1 -2
- package/src/theme/foundations/radii.ts +8 -3
- package/src/toast/useToast.tsx +2 -1
- package/src/tutorial/tutorialCard.tsx +10 -3
package/src/button/button.tsx
CHANGED
|
@@ -24,7 +24,7 @@ const StateWrapper = styled.span`
|
|
|
24
24
|
|
|
25
25
|
export const ButtonBase = styled.buttonBox<ButtonProps>`
|
|
26
26
|
align-items: center;
|
|
27
|
-
border-radius:
|
|
27
|
+
border-radius: none;
|
|
28
28
|
display: inline-flex;
|
|
29
29
|
flex-shrink: 0;
|
|
30
30
|
font-weight: medium;
|
|
@@ -35,13 +35,6 @@ export const ButtonBase = styled.buttonBox<ButtonProps>`
|
|
|
35
35
|
transition-duration: fast;
|
|
36
36
|
user-select: none;
|
|
37
37
|
width: fit-content;
|
|
38
|
-
|
|
39
|
-
&:focus,
|
|
40
|
-
&:focus:hover {
|
|
41
|
-
border-color: transparent;
|
|
42
|
-
outline: none;
|
|
43
|
-
z-index: 1;
|
|
44
|
-
}
|
|
45
38
|
`
|
|
46
39
|
/**
|
|
47
40
|
* Triggers given actions on click. Supports multiple states, sizes and variants.
|
|
@@ -57,7 +50,7 @@ export const Button = vui<'button', ButtonProps>((props, ref) => {
|
|
|
57
50
|
borderWidth: borderWidthProp,
|
|
58
51
|
children,
|
|
59
52
|
className,
|
|
60
|
-
colorScheme
|
|
53
|
+
colorScheme,
|
|
61
54
|
disabled,
|
|
62
55
|
dropDownIcon = 'falAngleDown',
|
|
63
56
|
icon,
|
|
@@ -67,7 +60,7 @@ export const Button = vui<'button', ButtonProps>((props, ref) => {
|
|
|
67
60
|
isDropDown,
|
|
68
61
|
isElevated,
|
|
69
62
|
isFullWidth,
|
|
70
|
-
|
|
63
|
+
isLoading, // eslint-disable-line
|
|
71
64
|
isRound,
|
|
72
65
|
isSplit,
|
|
73
66
|
isTruncated,
|
|
@@ -75,28 +68,27 @@ export const Button = vui<'button', ButtonProps>((props, ref) => {
|
|
|
75
68
|
state = props.isLoading ? 'loading' : '',
|
|
76
69
|
stateMapping,
|
|
77
70
|
text,
|
|
78
|
-
variant,
|
|
71
|
+
variant: variantProp,
|
|
79
72
|
...rest
|
|
80
73
|
} = mergedProps
|
|
81
74
|
const hasState = Boolean(state) && state !== 'idle'
|
|
82
75
|
const states = { ...buttonStateMapping, ...stateMapping }
|
|
76
|
+
|
|
83
77
|
const { iconProps: stateIconProps, ...stateProps } = states[state] ?? {}
|
|
84
|
-
|
|
85
|
-
|
|
78
|
+
|
|
79
|
+
const variant = filterUndefined({
|
|
80
|
+
variant: states[state]?.variant ?? variantProp
|
|
86
81
|
})
|
|
87
82
|
|
|
88
|
-
const styles = useStyleConfig('Button', { ...mergedProps, ...
|
|
83
|
+
const styles = useStyleConfig('Button', { ...mergedProps, ...variant })
|
|
89
84
|
const { borderWidth, h, spaceX = 0, ...buttonStyles } = styles.container
|
|
90
85
|
|
|
91
|
-
const context = useMemo(
|
|
92
|
-
() => filterUndefined({ colorScheme, disabled, size, variant }),
|
|
93
|
-
[colorScheme, disabled, size, variant]
|
|
94
|
-
)
|
|
86
|
+
const context = useMemo(() => filterUndefined({ disabled, size, variant }), [disabled, size, variant])
|
|
95
87
|
|
|
96
88
|
const Content = hasState ? ContentWrapper : React.Fragment
|
|
97
89
|
|
|
98
90
|
// Apply more space for text and less space for icons
|
|
99
|
-
const border = borderWidthProp ?? borderWidth ??
|
|
91
|
+
const border = borderWidthProp ?? borderWidth ?? 1
|
|
100
92
|
const spaceXItem = spaceX - border
|
|
101
93
|
const spaceXText = spaceX * 2 - border
|
|
102
94
|
const iconLeftMr = spaceXItem + 1 + 'px'
|
|
@@ -104,23 +96,22 @@ export const Button = vui<'button', ButtonProps>((props, ref) => {
|
|
|
104
96
|
const pl = (icon || iconLeft ? spaceXItem : spaceXText) + 'px'
|
|
105
97
|
const pr = (icon || iconRight ? spaceXItem : spaceXText) + 'px'
|
|
106
98
|
|
|
107
|
-
const disabledBorderColor = variant === 'outlined' ? 'disabled.border' : 'disabled.bg'
|
|
108
|
-
|
|
109
99
|
const disabledProps = disabled
|
|
110
100
|
? {
|
|
111
101
|
'aria-disabled': disabled,
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
102
|
+
disabledBg: 'bg',
|
|
103
|
+
disabledBorderColor: 'borderColor',
|
|
104
|
+
disabledColor: 'color',
|
|
105
|
+
hoverBg: 'bg',
|
|
106
|
+
hoverBorderColor: 'borderColor',
|
|
107
|
+
activeBg: 'bg',
|
|
117
108
|
cursor: 'not-allowed',
|
|
118
|
-
|
|
109
|
+
opacity: 0.5
|
|
119
110
|
}
|
|
120
111
|
: {}
|
|
121
112
|
|
|
122
113
|
const aliasedProps = filterUndefined({
|
|
123
|
-
borderRadius: isRound ? h / 2 :
|
|
114
|
+
borderRadius: isRound ? h / 2 : 0,
|
|
124
115
|
boxShadow: isElevated ? '2' : undefined,
|
|
125
116
|
minW: icon ? 0 : undefined,
|
|
126
117
|
pointerEvents: hasState ? 'none' : undefined,
|
|
@@ -3,12 +3,10 @@ import { SystemProps } from '../system'
|
|
|
3
3
|
import { ThemingProps } from '../theme'
|
|
4
4
|
import { AnyString } from '../utils'
|
|
5
5
|
|
|
6
|
-
export type ButtonColorScheme = 'blue' | 'green' | 'pink' | 'prussian' | 'red'
|
|
7
|
-
|
|
8
6
|
export type ButtonProps = SystemProps &
|
|
9
7
|
ThemingProps<'Button'> & {
|
|
10
|
-
/** Available theme colors for this component. @
|
|
11
|
-
colorScheme?:
|
|
8
|
+
/** Available theme colors for this component. @deprecated */
|
|
9
|
+
colorScheme?: string
|
|
12
10
|
/** Icon for the drop-down element. @default falAngleDown */
|
|
13
11
|
dropDownIcon?: IconProp
|
|
14
12
|
/** Icon that replaces any other content. */
|
|
@@ -38,12 +36,10 @@ export type ButtonProps = SystemProps &
|
|
|
38
36
|
/** Socket placing text as alternative to children. */
|
|
39
37
|
text?: React.ReactNode
|
|
40
38
|
}
|
|
39
|
+
|
|
41
40
|
export type ButtonState = 'error' | 'idle' | 'loading' | 'success' | AnyString
|
|
42
41
|
|
|
43
|
-
export type ButtonStateMapping = Record<
|
|
44
|
-
string,
|
|
45
|
-
SystemProps & { colorScheme: ButtonProps['colorScheme']; iconProps: IconProps }
|
|
46
|
-
>
|
|
42
|
+
export type ButtonStateMapping = Record<string, SystemProps & { variant: ButtonProps['variant']; iconProps: IconProps }>
|
|
47
43
|
|
|
48
44
|
/** Narrower prop definition for IconButton component */
|
|
49
45
|
export type IconButtonProps = Omit<ButtonProps, 'iconLeft' | 'iconRight' | 'text'>
|
package/src/button/buttons.tsx
CHANGED
|
@@ -5,33 +5,33 @@ import Button from './button'
|
|
|
5
5
|
import { ButtonProps, IconButtonProps } from './button.types'
|
|
6
6
|
|
|
7
7
|
export const AppButton = vui<'button', ButtonProps>((props, ref) => (
|
|
8
|
-
<Button
|
|
8
|
+
<Button ref={ref} variant="primaryDark" {...props} />
|
|
9
9
|
))
|
|
10
10
|
|
|
11
11
|
export const BackButton = vui<'button', IconButtonProps>((props, ref) => (
|
|
12
|
-
<IconButton
|
|
12
|
+
<IconButton icon="falArrowLeft" ref={ref} variant="tertiaryDark" {...props} />
|
|
13
13
|
))
|
|
14
14
|
|
|
15
15
|
export const CloseButton = vui<'button', IconButtonProps>((props, ref) => (
|
|
16
|
-
<IconButton
|
|
16
|
+
<IconButton icon="falTimes" ref={ref} variant="tertiaryDark" {...props} />
|
|
17
17
|
))
|
|
18
18
|
|
|
19
19
|
export const CTAButton = vui<'button', ButtonProps>((props, ref) => (
|
|
20
|
-
<Button
|
|
20
|
+
<Button ref={ref} variant="solidGreen" {...props} />
|
|
21
21
|
))
|
|
22
22
|
|
|
23
23
|
export const DangerButton = vui<'button', ButtonProps>((props, ref) => (
|
|
24
|
-
<Button
|
|
24
|
+
<Button ref={ref} variant="solidRed" {...props} />
|
|
25
25
|
))
|
|
26
26
|
|
|
27
27
|
export const IconButton = vui<'button', IconButtonProps>((props, ref) => (
|
|
28
|
-
<Button
|
|
28
|
+
<Button ref={ref} variant="tertiaryDark" {...props} />
|
|
29
29
|
))
|
|
30
30
|
|
|
31
31
|
export const LineButton = vui<'button', ButtonProps>((props, ref) => (
|
|
32
|
-
<Button
|
|
32
|
+
<Button ref={ref} variant="secondaryDark" {...props} />
|
|
33
33
|
))
|
|
34
34
|
|
|
35
35
|
export const TextButton = vui<'button', ButtonProps>((props, ref) => (
|
|
36
|
-
<Button
|
|
36
|
+
<Button ref={ref} variant="tertiaryDark" {...props} />
|
|
37
37
|
))
|
package/src/button/consts.ts
CHANGED
|
@@ -2,14 +2,14 @@ import { ButtonStateMapping } from './button.types'
|
|
|
2
2
|
|
|
3
3
|
export const buttonStateMapping: ButtonStateMapping = {
|
|
4
4
|
error: {
|
|
5
|
-
|
|
5
|
+
variant: 'solidRed',
|
|
6
6
|
iconProps: {
|
|
7
7
|
animation: 'fadeDown',
|
|
8
8
|
icon: 'falTimesCircle'
|
|
9
9
|
}
|
|
10
10
|
},
|
|
11
11
|
loading: {
|
|
12
|
-
|
|
12
|
+
variant: 'primaryDark',
|
|
13
13
|
iconProps: {
|
|
14
14
|
animation: 'vui-spin 0.6s linear infinite',
|
|
15
15
|
name: 'fadSpinnerThird',
|
|
@@ -17,7 +17,7 @@ export const buttonStateMapping: ButtonStateMapping = {
|
|
|
17
17
|
}
|
|
18
18
|
},
|
|
19
19
|
success: {
|
|
20
|
-
|
|
20
|
+
variant: 'solidGreen',
|
|
21
21
|
iconProps: {
|
|
22
22
|
animation: 'fadeDown',
|
|
23
23
|
icon: 'falCheckCircle'
|
package/src/button/theme.ts
CHANGED
|
@@ -1,77 +1,14 @@
|
|
|
1
|
-
import { Dict } from '../utils'
|
|
2
|
-
|
|
3
|
-
function variantOutlined(props: Dict) {
|
|
4
|
-
const { colorScheme: c } = props
|
|
5
|
-
|
|
6
|
-
const container = {
|
|
7
|
-
...variantText(props)?.container,
|
|
8
|
-
borderColor: `${c}.80`,
|
|
9
|
-
hoverBorderColor: `${c}.80`,
|
|
10
|
-
focusRing: 3
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
return { container }
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
function variantSolid(props: Dict) {
|
|
17
|
-
const { colorScheme: c } = props
|
|
18
|
-
|
|
19
|
-
const container = {
|
|
20
|
-
hoverBg: `${c}.90`,
|
|
21
|
-
hoverBorderColor: `${c}.90`,
|
|
22
|
-
activeBg: `${c}.100`,
|
|
23
|
-
bg: `${c}.80`,
|
|
24
|
-
borderColor: `${c}.80`,
|
|
25
|
-
borderWidth: 1,
|
|
26
|
-
color: 'white'
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
// Special cases
|
|
30
|
-
if (c === 'prussian') {
|
|
31
|
-
container.activeBg = 'prussian.50'
|
|
32
|
-
container.hoverBg = 'prussian.60'
|
|
33
|
-
container.hoverBorderColor = 'prussian.60'
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
return { container }
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
function variantText(props: Dict) {
|
|
40
|
-
const { colorScheme: c } = props
|
|
41
|
-
|
|
42
|
-
const container = {
|
|
43
|
-
hoverBg: `${c}.20`,
|
|
44
|
-
hoverBorderColor: `${c}.20`,
|
|
45
|
-
activeBg: `${c}.30`,
|
|
46
|
-
bg: 'transparent',
|
|
47
|
-
borderColor: 'transparent',
|
|
48
|
-
borderWidth: 1,
|
|
49
|
-
color: `${c}.80`,
|
|
50
|
-
focusRing: 2
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
// Special cases
|
|
54
|
-
if (c === 'prussian') {
|
|
55
|
-
container.activeBg = 'blue.30'
|
|
56
|
-
container.hoverBg = 'blue.20'
|
|
57
|
-
container.hoverBorderColor = 'blue.20'
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
return { container }
|
|
61
|
-
}
|
|
62
|
-
|
|
63
1
|
const baseStyle = {}
|
|
64
2
|
|
|
65
3
|
const defaultProps = {
|
|
66
|
-
colorScheme: 'prussian',
|
|
67
4
|
size: 'md',
|
|
68
|
-
variant: '
|
|
5
|
+
variant: 'primaryDark'
|
|
69
6
|
}
|
|
70
7
|
|
|
71
8
|
const parts = ['container', 'icon', 'text']
|
|
72
9
|
|
|
73
10
|
const sizes = {
|
|
74
|
-
|
|
11
|
+
sm: {
|
|
75
12
|
container: {
|
|
76
13
|
fontSize: 'sm',
|
|
77
14
|
h: 24,
|
|
@@ -83,7 +20,7 @@ const sizes = {
|
|
|
83
20
|
},
|
|
84
21
|
text: {}
|
|
85
22
|
},
|
|
86
|
-
|
|
23
|
+
md: {
|
|
87
24
|
container: {
|
|
88
25
|
fontSize: 'sm',
|
|
89
26
|
h: 32,
|
|
@@ -95,7 +32,7 @@ const sizes = {
|
|
|
95
32
|
},
|
|
96
33
|
text: {}
|
|
97
34
|
},
|
|
98
|
-
|
|
35
|
+
lg: {
|
|
99
36
|
container: {
|
|
100
37
|
fontSize: 'md',
|
|
101
38
|
h: 40,
|
|
@@ -107,7 +44,7 @@ const sizes = {
|
|
|
107
44
|
},
|
|
108
45
|
text: {}
|
|
109
46
|
},
|
|
110
|
-
|
|
47
|
+
xl: {
|
|
111
48
|
container: {
|
|
112
49
|
fontSize: 'lg',
|
|
113
50
|
h: 48,
|
|
@@ -122,9 +59,230 @@ const sizes = {
|
|
|
122
59
|
}
|
|
123
60
|
|
|
124
61
|
const variants = {
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
62
|
+
primaryDark: {
|
|
63
|
+
container: {
|
|
64
|
+
bg: 'buttonTypePrimaryDefaultBackgroundColorDark',
|
|
65
|
+
borderColor: 'buttonTypePrimaryDefaultBorderColorDark',
|
|
66
|
+
color: 'buttonTypePrimaryDefaultTextColorDark',
|
|
67
|
+
hoverBg: 'buttonTypePrimaryHoverBackgroundColorDark',
|
|
68
|
+
hoverBorderColor: 'buttonTypePrimaryHoverBorderColorDark',
|
|
69
|
+
hoverColor: 'buttonTypePrimaryHoverTextColorDark',
|
|
70
|
+
activeBg: 'buttonTypePrimaryActiveBackgroundColorDark',
|
|
71
|
+
activeBorderColor: 'buttonTypePrimaryActiveBorderColorDark',
|
|
72
|
+
activeColor: 'buttonTypePrimaryActiveTextColorDark'
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
primaryLight: {
|
|
76
|
+
container: {
|
|
77
|
+
bg: 'buttonTypePrimaryDefaultBackgroundColorLight',
|
|
78
|
+
borderColor: 'buttonTypePrimaryDefaultBorderColorLight',
|
|
79
|
+
color: 'buttonTypePrimaryDefaultTextColorLight',
|
|
80
|
+
hoverBg: 'buttonTypePrimaryHoverBackgroundColorLight',
|
|
81
|
+
hoverBorderColor: 'buttonTypePrimaryHoverBorderColorLight',
|
|
82
|
+
hoverColor: 'buttonTypePrimaryHoverTextColorLight',
|
|
83
|
+
activeBg: 'buttonTypePrimaryActiveBackgroundColorLight',
|
|
84
|
+
activeBorderColor: 'buttonTypePrimaryActiveBorderColorLight',
|
|
85
|
+
activeColor: 'buttonTypePrimaryActiveTextColorLight'
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
secondaryDark: {
|
|
89
|
+
container: {
|
|
90
|
+
bg: 'buttonTypeSecondaryDefaultBackgroundColorDark',
|
|
91
|
+
borderColor: 'buttonTypeSecondaryDefaultBorderColorDark',
|
|
92
|
+
color: 'buttonTypeSecondaryDefaultTextColorDark',
|
|
93
|
+
// discussed with Jesus, the decision was made on 2-may-2022 that OneDesign designers will update to VUI shade
|
|
94
|
+
// hover will change from 90 to 85
|
|
95
|
+
hoverBg: 'buttonTypeSecondaryHoverBackgroundColorDark',
|
|
96
|
+
hoverBorderColor: 'buttonTypeSecondaryHoverBorderColorDark',
|
|
97
|
+
hoverColor: 'buttonTypeSecondaryHoverTextColorDark',
|
|
98
|
+
// discussed with Jesus, the decision was made on 2-may-2022 that OneDesign designers will update to VUI shade
|
|
99
|
+
// active will change from 95% to 90%
|
|
100
|
+
activeBg: 'buttonTypeSecondaryActiveBackgroundColorDark',
|
|
101
|
+
activeBorderColor: 'buttonTypeSecondaryActiveBorderColorDark',
|
|
102
|
+
activeColor: 'buttonTypeSecondaryActiveTextColorDark'
|
|
103
|
+
}
|
|
104
|
+
},
|
|
105
|
+
secondaryLight: {
|
|
106
|
+
container: {
|
|
107
|
+
bg: 'buttonTypeSecondaryDefaultBackgroundColorLight',
|
|
108
|
+
borderColor: 'buttonTypeSecondaryDefaultBorderColorLight',
|
|
109
|
+
color: 'buttonTypeSecondaryDefaultTextColorLight',
|
|
110
|
+
hoverBg: 'buttonTypeSecondaryHoverBackgroundColorLight',
|
|
111
|
+
hoverBorderColor: 'buttonTypeSecondaryHoverBorderColorLight',
|
|
112
|
+
hoverColor: 'buttonTypeSecondaryHoverTextColorLight',
|
|
113
|
+
activeBg: 'buttonTypeSecondaryActiveBackgroundColorLight',
|
|
114
|
+
activeBorderColor: 'buttonTypeSecondaryActiveBorderColorLight',
|
|
115
|
+
activeColor: 'buttonTypeSecondaryActiveTextColorLight'
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
tertiaryDark: {
|
|
119
|
+
container: {
|
|
120
|
+
bg: 'buttonTypeTertiaryDefaultBackgroundColorDark',
|
|
121
|
+
borderColor: 'buttonTypeTertiaryDefaultBorderColorDark',
|
|
122
|
+
color: 'buttonTypeTertiaryDefaultTextColorDark',
|
|
123
|
+
hoverBg: 'buttonTypeTertiaryHoverBackgroundColorDark',
|
|
124
|
+
hoverBorderColor: 'buttonTypeTertiaryHoverBorderColorDark',
|
|
125
|
+
hoverColor: 'buttonTypeTertiaryHoverTextColorDark',
|
|
126
|
+
activeBg: 'buttonTypeTertiaryActiveBackgroundColorDark',
|
|
127
|
+
activeBorderColor: 'buttonTypeTertiaryActiveBorderColorDark',
|
|
128
|
+
activeColor: 'buttonTypeTertiaryActiveTextColorDark'
|
|
129
|
+
}
|
|
130
|
+
},
|
|
131
|
+
tertiaryLight: {
|
|
132
|
+
container: {
|
|
133
|
+
bg: 'buttonTypeTertiaryDefaultBackgroundColorLight',
|
|
134
|
+
borderColor: 'buttonTypeTertiaryDefaultBorderColorLight',
|
|
135
|
+
color: 'buttonTypeTertiaryDefaultTextColorLight',
|
|
136
|
+
hoverBg: 'buttonTypeTertiaryHoverBackgroundColorLight',
|
|
137
|
+
hoverBorderColor: 'buttonTypeTertiaryHoverBorderColorLight',
|
|
138
|
+
hoverColor: 'buttonTypeTertiaryHoverTextColorLight',
|
|
139
|
+
activeBg: 'buttonTypeTertiaryActiveBackgroundColorLight',
|
|
140
|
+
activeBorderColor: 'buttonTypeTertiaryActiveBorderColorLight',
|
|
141
|
+
activeColor: 'buttonTypeTertiaryActiveTextColorLight'
|
|
142
|
+
}
|
|
143
|
+
},
|
|
144
|
+
|
|
145
|
+
solidBlue: {
|
|
146
|
+
container: {
|
|
147
|
+
bg: 'seaBlue.28',
|
|
148
|
+
borderColor: 'seaBlue.28',
|
|
149
|
+
color: 'white',
|
|
150
|
+
disabledBg: 'darkBlue.75',
|
|
151
|
+
disabledBorderColor: 'darkBlue.75',
|
|
152
|
+
disabledColor: 'white',
|
|
153
|
+
// proper order next: hover, focus, active
|
|
154
|
+
hoverBg: 'seaBlue.20',
|
|
155
|
+
hoverBorderColor: 'seaBlue.20',
|
|
156
|
+
focusBg: 'seaBlue.28',
|
|
157
|
+
activeBg: 'seaBlue.35',
|
|
158
|
+
activeBorderColor: 'seaBlue.35'
|
|
159
|
+
}
|
|
160
|
+
},
|
|
161
|
+
|
|
162
|
+
blueOutlined: {
|
|
163
|
+
container: {
|
|
164
|
+
bg: 'white',
|
|
165
|
+
borderColor: 'seaBlue.28',
|
|
166
|
+
color: 'seaBlue.28',
|
|
167
|
+
disabledBg: 'white',
|
|
168
|
+
disabledBorderColor: 'darkBlue.75',
|
|
169
|
+
disabledColor: 'darkBlue.75',
|
|
170
|
+
hoverBg: 'skyBlue.85',
|
|
171
|
+
hoverBorderColor: 'seaBlue.35',
|
|
172
|
+
// focusBg: 'white',
|
|
173
|
+
activeBg: 'skyBlue.90',
|
|
174
|
+
activeBorderColor: 'seaBlue.35'
|
|
175
|
+
}
|
|
176
|
+
},
|
|
177
|
+
|
|
178
|
+
blueText: {
|
|
179
|
+
container: {
|
|
180
|
+
bg: 'transparent',
|
|
181
|
+
borderColor: 'transparent',
|
|
182
|
+
color: 'seaBlue.28',
|
|
183
|
+
disabledBg: 'white',
|
|
184
|
+
disabledBorderColor: 'white',
|
|
185
|
+
disabledColor: 'darkBlue.75',
|
|
186
|
+
hoverBg: 'skyBlue.85',
|
|
187
|
+
hoverBorderColor: 'skyBlue.85',
|
|
188
|
+
focusBg: 'transparent',
|
|
189
|
+
activeBg: 'skyBlue.90',
|
|
190
|
+
activeBorderColor: 'skyBlue.90'
|
|
191
|
+
}
|
|
192
|
+
},
|
|
193
|
+
|
|
194
|
+
solidGreen: {
|
|
195
|
+
container: {
|
|
196
|
+
bg: 'landGreen.35',
|
|
197
|
+
borderColor: 'landGreen.35',
|
|
198
|
+
color: 'white',
|
|
199
|
+
disabledBg: 'landGreen.70',
|
|
200
|
+
disabledBorderColor: 'landGreen.70',
|
|
201
|
+
disabledColor: 'white',
|
|
202
|
+
hoverBg: 'landGreen.25',
|
|
203
|
+
hoverBorderColor: 'landGreen.25',
|
|
204
|
+
focusBg: 'landGreen.35',
|
|
205
|
+
activeBg: 'landGreen.41',
|
|
206
|
+
activeBorderColor: 'landGreen.41'
|
|
207
|
+
}
|
|
208
|
+
},
|
|
209
|
+
|
|
210
|
+
solidRed: {
|
|
211
|
+
container: {
|
|
212
|
+
bg: 'energyRed.45',
|
|
213
|
+
borderColor: 'energyRed.45',
|
|
214
|
+
color: 'white',
|
|
215
|
+
disabledBg: 'energyRed.80',
|
|
216
|
+
disabledBorderColor: 'energyRed.80',
|
|
217
|
+
disabledColor: 'white',
|
|
218
|
+
// proper order is important next: hover > focus > active
|
|
219
|
+
hoverBg: 'energyRed.35',
|
|
220
|
+
hoverBorderColor: 'energyRed.35',
|
|
221
|
+
focusBg: 'energyRed.45',
|
|
222
|
+
activeBg: 'energyRed.50',
|
|
223
|
+
activeBorderColor: 'energyRed.50'
|
|
224
|
+
}
|
|
225
|
+
},
|
|
226
|
+
|
|
227
|
+
// subtleBlue is an internal variant, used in notification; based on primaryDark
|
|
228
|
+
subtleBlue: {
|
|
229
|
+
container: {
|
|
230
|
+
bg: 'transparent',
|
|
231
|
+
borderColor: 'transparent',
|
|
232
|
+
color: 'seaBlue.28',
|
|
233
|
+
disabledBg: 'white',
|
|
234
|
+
disabledBorderColor: 'darkBlue.75',
|
|
235
|
+
disabledColor: 'darkBlue.75',
|
|
236
|
+
// proper order is important next: hover > focus > active
|
|
237
|
+
hoverBg: 'skyBlue.90',
|
|
238
|
+
hoverBorderColor: 'skyBlue.90',
|
|
239
|
+
focusBg: 'transparent',
|
|
240
|
+
activeBg: 'skyBlue.85',
|
|
241
|
+
activeBorderColor: 'skyBlue.85'
|
|
242
|
+
}
|
|
243
|
+
},
|
|
244
|
+
|
|
245
|
+
// subtleRed is an internal variant, used in notification; based on primaryDark
|
|
246
|
+
subtleRed: {
|
|
247
|
+
container: {
|
|
248
|
+
bg: 'transparent',
|
|
249
|
+
borderColor: 'transparent',
|
|
250
|
+
// proper order is important next: hover > focus > active
|
|
251
|
+
hoverBg: 'energyRed.90',
|
|
252
|
+
hoverBorderColor: 'energyRed.90',
|
|
253
|
+
focusBg: 'transparent',
|
|
254
|
+
activeBg: 'energyRed.85',
|
|
255
|
+
color: 'energyRed.45'
|
|
256
|
+
}
|
|
257
|
+
},
|
|
258
|
+
|
|
259
|
+
// subtleYellow is an internal variant, used in notification; based on primaryDark
|
|
260
|
+
subtleYellow: {
|
|
261
|
+
container: {
|
|
262
|
+
bg: 'transparent',
|
|
263
|
+
borderColor: 'transparent',
|
|
264
|
+
// proper order is important next: hover > focus > active
|
|
265
|
+
hoverBg: 'sunflower.70',
|
|
266
|
+
hoverBorderColor: 'sunflower.70',
|
|
267
|
+
focusBg: 'transparent',
|
|
268
|
+
activeBg: 'sunflower.65',
|
|
269
|
+
color: 'sunflower.15'
|
|
270
|
+
}
|
|
271
|
+
},
|
|
272
|
+
|
|
273
|
+
// subtleGreen is an internal variant, used in notification; based on primaryDark
|
|
274
|
+
subtleGreen: {
|
|
275
|
+
container: {
|
|
276
|
+
bg: 'transparent',
|
|
277
|
+
borderColor: 'transparent',
|
|
278
|
+
// proper order is important next: hover > focus > active
|
|
279
|
+
hoverBg: 'landGreen.90',
|
|
280
|
+
hoverBorderColor: 'landGreen.90',
|
|
281
|
+
focusBg: 'transparent',
|
|
282
|
+
activeBg: 'landGreen.85',
|
|
283
|
+
color: 'landGreen.30'
|
|
284
|
+
}
|
|
285
|
+
}
|
|
128
286
|
}
|
|
129
287
|
|
|
130
288
|
export default {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useMemo } from 'react'
|
|
2
2
|
|
|
3
3
|
import { styled, th, vui } from '../core'
|
|
4
|
-
import { activeClassName,
|
|
4
|
+
import { activeClassName, cs, filterUndefined } from '../utils'
|
|
5
5
|
import { ButtonGroupProps } from './buttonGroup.types'
|
|
6
6
|
import { ButtonGroupProvider } from './context'
|
|
7
7
|
import { getInnerBorderColor } from './helpers'
|
|
@@ -42,12 +42,12 @@ export const ButtonGroupBase = styled.divBox<{ colorScheme?: string; innerBorder
|
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
> *:disabled {
|
|
45
|
-
border-color: disabled.border;
|
|
45
|
+
border-color: disabled .border;
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
//
|
|
49
49
|
> .${activeClassName} {
|
|
50
|
-
background-color: ${p => th.color(
|
|
50
|
+
background-color: ${p => th.color('skyBlue.90')};
|
|
51
51
|
}
|
|
52
52
|
`
|
|
53
53
|
|
|
@@ -56,18 +56,15 @@ export const ButtonGroupBase = styled.divBox<{ colorScheme?: string; innerBorder
|
|
|
56
56
|
* Exposes some props to the children via context.
|
|
57
57
|
*/
|
|
58
58
|
export const ButtonGroup = vui<'div', ButtonGroupProps>((props, ref) => {
|
|
59
|
-
const { className,
|
|
59
|
+
const { className, disabled, innerBorderColor, size, variant = 'secondaryDark', ...rest } = props
|
|
60
60
|
|
|
61
|
-
const context = useMemo(
|
|
62
|
-
() => filterUndefined({ colorScheme, disabled, size, variant }),
|
|
63
|
-
[colorScheme, disabled, size, variant]
|
|
64
|
-
)
|
|
61
|
+
const context = useMemo(() => filterUndefined({ disabled, size, variant }), [disabled, size, variant])
|
|
65
62
|
|
|
66
63
|
return (
|
|
67
64
|
<ButtonGroupProvider value={context}>
|
|
68
65
|
<ButtonGroupBase
|
|
69
66
|
className={cs('vui-buttonGroup', className)}
|
|
70
|
-
{...{
|
|
67
|
+
{...{ innerBorderColor: innerBorderColor ? innerBorderColor : getInnerBorderColor(props), ref }}
|
|
71
68
|
{...rest}
|
|
72
69
|
/>
|
|
73
70
|
</ButtonGroupProvider>
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { ButtonColorScheme } from '../button/button.types'
|
|
2
1
|
import { SystemProps } from '../system'
|
|
3
2
|
import { ThemingProps } from '../theme'
|
|
4
3
|
|
|
5
4
|
export type ButtonGroupProps = SystemProps &
|
|
6
5
|
ThemingProps<'ButtonGroup'> & {
|
|
7
|
-
/** Available theme colors for this component. */
|
|
8
|
-
colorScheme?:
|
|
6
|
+
/** Available theme colors for this component. @deprecated */
|
|
7
|
+
colorScheme?: string
|
|
9
8
|
/** Makes all wrapped buttons disabled. */
|
|
10
9
|
disabled?: boolean
|
|
11
10
|
/** Border color between the buttons. */
|
|
@@ -2,11 +2,9 @@ import { ButtonGroupProps } from './buttonGroup.types'
|
|
|
2
2
|
|
|
3
3
|
/** Returns appropriate color for the border between the buttons. */
|
|
4
4
|
export function getInnerBorderColor(props: ButtonGroupProps): string {
|
|
5
|
-
const {
|
|
5
|
+
const { disabled, variant } = props
|
|
6
6
|
|
|
7
7
|
if (disabled) return 'disabled.border'
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
return `${colorScheme}.${shade}`
|
|
9
|
+
return `${variant}`
|
|
12
10
|
}
|
|
@@ -13,9 +13,7 @@ export const ButtonToggleGroup = (props: ButtonToggleGroupProps) => {
|
|
|
13
13
|
return (
|
|
14
14
|
<ButtonGroup
|
|
15
15
|
className={cs('vui-buttonToggleGroup', className)}
|
|
16
|
-
colorScheme="blue"
|
|
17
16
|
innerBorderColor={isDimmedBorder ? dimmedBorderColor : ''}
|
|
18
|
-
variant="outlined"
|
|
19
17
|
{...props}
|
|
20
18
|
/>
|
|
21
19
|
)
|
|
@@ -8,7 +8,7 @@ import { CheckboxProps, CheckboxStyleProps } from './checkbox.types'
|
|
|
8
8
|
import { useCheckboxGroupContext } from './context'
|
|
9
9
|
|
|
10
10
|
const CheckboxControl = styled.spanBox`
|
|
11
|
-
border-radius:
|
|
11
|
+
border-radius: none;
|
|
12
12
|
display: inline-flex;
|
|
13
13
|
flex-shrink: 0;
|
|
14
14
|
position: relative;
|
|
@@ -15,7 +15,7 @@ import { useCopyToClipboard } from './useCopyToClipboard'
|
|
|
15
15
|
*
|
|
16
16
|
*/
|
|
17
17
|
export const CopyToClipboard = vui<'button', CopyToClipboardProps>((props, ref) => {
|
|
18
|
-
const { disabled, copyText, className, size = '
|
|
18
|
+
const { disabled, copyText, className, size = 'sm', variant = 'tertiaryDark', ...rest } = props
|
|
19
19
|
|
|
20
20
|
const { copy, isCopyDisabled } = useCopyToClipboard(copyText)
|
|
21
21
|
|