@veracity/vui 1.2.2 → 1.3.0-rc.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/button/button.d.ts +2 -1
- package/dist/cjs/button/button.d.ts.map +1 -1
- package/dist/cjs/button/button.js +3 -3
- package/dist/cjs/button/button.types.d.ts +4 -1
- package/dist/cjs/button/button.types.d.ts.map +1 -1
- package/dist/cjs/buttonGroup/buttonGroup.d.ts +1 -0
- package/dist/cjs/buttonGroup/buttonGroup.d.ts.map +1 -1
- package/dist/cjs/buttonGroup/buttonGroup.js +13 -3
- package/dist/cjs/buttonGroup/buttonGroup.types.d.ts +4 -1
- package/dist/cjs/buttonGroup/buttonGroup.types.d.ts.map +1 -1
- package/dist/cjs/buttonGroup/helpers.d.ts.map +1 -1
- package/dist/cjs/buttonToggleGroup/buttonToggleGroup.d.ts +7 -0
- package/dist/cjs/buttonToggleGroup/buttonToggleGroup.d.ts.map +1 -0
- package/dist/cjs/buttonToggleGroup/buttonToggleGroup.js +18 -0
- package/dist/cjs/buttonToggleGroup/buttonToggleGroup.types.d.ts +10 -0
- package/dist/cjs/buttonToggleGroup/buttonToggleGroup.types.d.ts.map +1 -0
- package/dist/cjs/buttonToggleGroup/buttonToggleGroup.types.js +2 -0
- package/dist/cjs/buttonToggleGroup/index.d.ts +4 -0
- package/dist/cjs/buttonToggleGroup/index.d.ts.map +1 -0
- package/dist/cjs/buttonToggleGroup/index.js +24 -0
- package/dist/cjs/index.d.ts +2 -0
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +2 -0
- package/dist/cjs/message/consts.d.ts +13 -0
- package/dist/cjs/message/consts.d.ts.map +1 -0
- package/dist/cjs/message/consts.js +15 -0
- package/dist/cjs/message/index.d.ts +4 -0
- package/dist/cjs/message/index.d.ts.map +1 -0
- package/dist/cjs/message/index.js +24 -0
- package/dist/cjs/message/message.d.ts +6 -0
- package/dist/cjs/message/message.d.ts.map +1 -0
- package/dist/cjs/message/message.js +35 -0
- package/dist/cjs/message/message.types.d.ts +8 -0
- package/dist/cjs/message/message.types.d.ts.map +1 -0
- package/dist/cjs/message/message.types.js +2 -0
- package/dist/cjs/message/theme.d.ts +28 -0
- package/dist/cjs/message/theme.d.ts.map +1 -0
- package/dist/cjs/message/theme.js +32 -0
- package/dist/cjs/theme/components.d.ts +26 -0
- package/dist/cjs/theme/components.d.ts.map +1 -1
- package/dist/cjs/theme/components.js +36 -34
- package/dist/cjs/theme/defaultTheme.d.ts +26 -0
- package/dist/cjs/theme/defaultTheme.d.ts.map +1 -1
- package/dist/cjs/tooltip/tooltip.js +1 -1
- package/dist/cjs/utils/consts.d.ts +3 -0
- package/dist/cjs/utils/consts.d.ts.map +1 -1
- package/dist/cjs/utils/consts.js +4 -1
- package/dist/esm/button/button.d.ts +2 -1
- package/dist/esm/button/button.d.ts.map +1 -1
- package/dist/esm/button/button.js +3 -3
- package/dist/esm/button/button.types.d.ts +4 -1
- package/dist/esm/button/button.types.d.ts.map +1 -1
- package/dist/esm/buttonGroup/buttonGroup.d.ts +1 -0
- package/dist/esm/buttonGroup/buttonGroup.d.ts.map +1 -1
- package/dist/esm/buttonGroup/buttonGroup.js +14 -4
- package/dist/esm/buttonGroup/buttonGroup.types.d.ts +4 -1
- package/dist/esm/buttonGroup/buttonGroup.types.d.ts.map +1 -1
- package/dist/esm/buttonGroup/helpers.d.ts.map +1 -1
- package/dist/esm/buttonToggleGroup/buttonToggleGroup.d.ts +7 -0
- package/dist/esm/buttonToggleGroup/buttonToggleGroup.d.ts.map +1 -0
- package/dist/esm/buttonToggleGroup/buttonToggleGroup.js +11 -0
- package/dist/esm/buttonToggleGroup/buttonToggleGroup.types.d.ts +10 -0
- package/dist/esm/buttonToggleGroup/buttonToggleGroup.types.d.ts.map +1 -0
- package/dist/esm/buttonToggleGroup/buttonToggleGroup.types.js +1 -0
- package/dist/esm/buttonToggleGroup/index.d.ts +4 -0
- package/dist/esm/buttonToggleGroup/index.d.ts.map +1 -0
- package/dist/esm/buttonToggleGroup/index.js +3 -0
- package/dist/esm/index.d.ts +2 -0
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +2 -0
- package/dist/esm/message/consts.d.ts +13 -0
- package/dist/esm/message/consts.d.ts.map +1 -0
- package/dist/esm/message/consts.js +12 -0
- package/dist/esm/message/index.d.ts +4 -0
- package/dist/esm/message/index.d.ts.map +1 -0
- package/dist/esm/message/index.js +3 -0
- package/dist/esm/message/message.d.ts +6 -0
- package/dist/esm/message/message.d.ts.map +1 -0
- package/dist/esm/message/message.js +19 -0
- package/dist/esm/message/message.types.d.ts +8 -0
- package/dist/esm/message/message.types.d.ts.map +1 -0
- package/dist/esm/message/message.types.js +1 -0
- package/dist/esm/message/theme.d.ts +28 -0
- package/dist/esm/message/theme.d.ts.map +1 -0
- package/dist/esm/message/theme.js +30 -0
- package/dist/esm/theme/components.d.ts +26 -0
- 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 +26 -0
- package/dist/esm/theme/defaultTheme.d.ts.map +1 -1
- package/dist/esm/tooltip/tooltip.js +1 -1
- package/dist/esm/utils/consts.d.ts +3 -0
- package/dist/esm/utils/consts.d.ts.map +1 -1
- package/dist/esm/utils/consts.js +3 -0
- package/package.json +1 -1
- package/src/button/button.tsx +3 -2
- package/src/button/button.types.ts +5 -1
- package/src/buttonGroup/buttonGroup.tsx +19 -6
- package/src/buttonGroup/buttonGroup.types.ts +4 -1
- package/src/buttonGroup/helpers.ts +1 -1
- package/src/buttonToggleGroup/buttonToggleGroup.tsx +24 -0
- package/src/buttonToggleGroup/buttonToggleGroup.types.ts +12 -0
- package/src/buttonToggleGroup/index.ts +3 -0
- package/src/index.ts +2 -0
- package/src/message/consts.ts +13 -0
- package/src/message/index.ts +3 -0
- package/src/message/message.tsx +29 -0
- package/src/message/message.types.ts +10 -0
- package/src/message/theme.ts +34 -0
- package/src/theme/components.ts +2 -0
- package/src/tooltip/tooltip.tsx +1 -1
- package/src/utils/consts.ts +6 -0
|
@@ -608,6 +608,32 @@ declare const _default: {
|
|
|
608
608
|
};
|
|
609
609
|
variants: {};
|
|
610
610
|
};
|
|
611
|
+
Message: {
|
|
612
|
+
baseStyle: {};
|
|
613
|
+
defaultProps: {
|
|
614
|
+
variant: string;
|
|
615
|
+
};
|
|
616
|
+
sizes: {
|
|
617
|
+
xs: {};
|
|
618
|
+
sm: {};
|
|
619
|
+
md: {};
|
|
620
|
+
lg: {};
|
|
621
|
+
};
|
|
622
|
+
variants: {
|
|
623
|
+
info: {
|
|
624
|
+
color: string;
|
|
625
|
+
};
|
|
626
|
+
warning: {
|
|
627
|
+
color: string;
|
|
628
|
+
};
|
|
629
|
+
error: {
|
|
630
|
+
color: string;
|
|
631
|
+
};
|
|
632
|
+
success: {
|
|
633
|
+
color: string;
|
|
634
|
+
};
|
|
635
|
+
};
|
|
636
|
+
};
|
|
611
637
|
Modal: {
|
|
612
638
|
baseStyle: {};
|
|
613
639
|
defaultProps: {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"components.d.ts","sourceRoot":"","sources":["../../../src/theme/components.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"components.d.ts","sourceRoot":"","sources":["../../../src/theme/components.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoCA,wBAoCC"}
|
|
@@ -15,6 +15,7 @@ import Input from '../input/theme';
|
|
|
15
15
|
import Link from '../link/theme';
|
|
16
16
|
import List from '../list/theme';
|
|
17
17
|
import Menu from '../menu/theme';
|
|
18
|
+
import Message from '../message/theme';
|
|
18
19
|
import Modal from '../modal/theme';
|
|
19
20
|
import Notification from '../notification/theme';
|
|
20
21
|
import P from '../p/theme';
|
|
@@ -50,6 +51,7 @@ export default {
|
|
|
50
51
|
Link,
|
|
51
52
|
List,
|
|
52
53
|
Menu,
|
|
54
|
+
Message,
|
|
53
55
|
Modal,
|
|
54
56
|
Notification,
|
|
55
57
|
P,
|
|
@@ -804,6 +804,32 @@ declare const defaultTheme: {
|
|
|
804
804
|
};
|
|
805
805
|
variants: {};
|
|
806
806
|
};
|
|
807
|
+
Message: {
|
|
808
|
+
baseStyle: {};
|
|
809
|
+
defaultProps: {
|
|
810
|
+
variant: string;
|
|
811
|
+
};
|
|
812
|
+
sizes: {
|
|
813
|
+
xs: {};
|
|
814
|
+
sm: {};
|
|
815
|
+
md: {};
|
|
816
|
+
lg: {};
|
|
817
|
+
};
|
|
818
|
+
variants: {
|
|
819
|
+
info: {
|
|
820
|
+
color: string;
|
|
821
|
+
};
|
|
822
|
+
warning: {
|
|
823
|
+
color: string;
|
|
824
|
+
};
|
|
825
|
+
error: {
|
|
826
|
+
color: string;
|
|
827
|
+
};
|
|
828
|
+
success: {
|
|
829
|
+
color: string;
|
|
830
|
+
};
|
|
831
|
+
};
|
|
832
|
+
};
|
|
807
833
|
Modal: {
|
|
808
834
|
baseStyle: {};
|
|
809
835
|
defaultProps: {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defaultTheme.d.ts","sourceRoot":"","sources":["../../../src/theme/defaultTheme.ts"],"names":[],"mappings":"AAGA,QAAA,MAAM,YAAY
|
|
1
|
+
{"version":3,"file":"defaultTheme.d.ts","sourceRoot":"","sources":["../../../src/theme/defaultTheme.ts"],"names":[],"mappings":"AAGA,QAAA,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAGjB,CAAA;AAED,eAAe,YAAY,CAAA"}
|
|
@@ -12,7 +12,7 @@ import { TooltipContent } from './tooltipContent';
|
|
|
12
12
|
*
|
|
13
13
|
* */
|
|
14
14
|
export const Tooltip = (props) => {
|
|
15
|
-
const { children, fontSize = '16px', linkText, linkProps, maxWidth = '400px', text = '
|
|
15
|
+
const { children, fontSize = '16px', linkText, linkProps, maxWidth = '400px', text = 'Tooltip', placement = 'top' } = props;
|
|
16
16
|
const isDesktop = useUp('md');
|
|
17
17
|
return (React.createElement(Tippy, { content: React.createElement(TooltipContent, { fontSize: fontSize, maxWidth: maxWidth },
|
|
18
18
|
isDesktop && (React.createElement(Box, { bg: color, bottom: pointerPlacement[placement].bottom, h: `${pointerSize}px`, left: pointerPlacement[placement].left, position: "absolute", right: pointerPlacement[placement].right, top: pointerPlacement[placement].top, transform: `translate(${pointerPlacement[placement].translate}) rotate(45deg)`, w: `${pointerSize}px` })),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"consts.d.ts","sourceRoot":"","sources":["../../../src/utils/consts.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,SAAwC,CAAA"}
|
|
1
|
+
{"version":3,"file":"consts.d.ts","sourceRoot":"","sources":["../../../src/utils/consts.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,SAAwC,CAAA;AAE5D,eAAO,MAAM,eAAe,eAAe,CAAA;AAE3C,eAAO,MAAM,eAAe,KAAK,CAAA;AAEjC,eAAO,MAAM,iBAAiB,YAAY,CAAA"}
|
package/dist/esm/utils/consts.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@veracity/vui",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0-rc.0",
|
|
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
|
@@ -2,7 +2,7 @@ import React, { useMemo } from 'react'
|
|
|
2
2
|
|
|
3
3
|
import { useButtonGroupContext } from '../buttonGroup/context'
|
|
4
4
|
import { styled, useStyleConfig, vui, VuiComponent } from '../core'
|
|
5
|
-
import { cs, filterUndefined, isReactText, isString } from '../utils'
|
|
5
|
+
import { activeClassName, cs, filterUndefined, isReactText, isString } from '../utils'
|
|
6
6
|
import { ButtonProps } from './button.types'
|
|
7
7
|
import ButtonIcon from './buttonIcon'
|
|
8
8
|
import ButtonText from './buttonText'
|
|
@@ -62,6 +62,7 @@ export const Button = vui<'button', ButtonProps>((props, ref) => {
|
|
|
62
62
|
icon,
|
|
63
63
|
iconLeft,
|
|
64
64
|
iconRight,
|
|
65
|
+
isActive,
|
|
65
66
|
isElevated,
|
|
66
67
|
isFullWidth,
|
|
67
68
|
isLoading, // eslint-disable-line
|
|
@@ -128,7 +129,7 @@ export const Button = vui<'button', ButtonProps>((props, ref) => {
|
|
|
128
129
|
<ButtonProvider value={context}>
|
|
129
130
|
<ButtonBase
|
|
130
131
|
borderWidth={border}
|
|
131
|
-
className={cs('vui-button', className)}
|
|
132
|
+
className={cs('vui-button', className, isActive && activeClassName)}
|
|
132
133
|
disabled={disabled}
|
|
133
134
|
focusRing={3}
|
|
134
135
|
h={h}
|
|
@@ -3,16 +3,20 @@ 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
|
+
|
|
6
8
|
export type ButtonProps = SystemProps &
|
|
7
9
|
ThemingProps<'Button'> & {
|
|
8
10
|
/** Available theme colors for this component. @default prussian */
|
|
9
|
-
colorScheme?:
|
|
11
|
+
colorScheme?: ButtonColorScheme
|
|
10
12
|
/** Icon that replaces any other content. */
|
|
11
13
|
icon?: IconProp | JSX.Element
|
|
12
14
|
/** Socket displaying icon on the left side. */
|
|
13
15
|
iconLeft?: IconProp | JSX.Element
|
|
14
16
|
/** Socket displaying icon on the right side. */
|
|
15
17
|
iconRight?: IconProp | JSX.Element
|
|
18
|
+
/** Adds an active class name for further handling. */
|
|
19
|
+
isActive?: boolean
|
|
16
20
|
/** Adds box shadow style. @default false */
|
|
17
21
|
isElevated?: boolean
|
|
18
22
|
/** Makes the button take full width of the container. @deprecated */
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import React, { useMemo } from 'react'
|
|
2
2
|
|
|
3
3
|
import { styled, th, vui } from '../core'
|
|
4
|
-
import { cs, filterUndefined } from '../utils'
|
|
4
|
+
import { activeClassName, activeItemShade, cs, filterUndefined } from '../utils'
|
|
5
5
|
import { ButtonGroupProps } from './buttonGroup.types'
|
|
6
6
|
import { ButtonGroupProvider } from './context'
|
|
7
7
|
import { getInnerBorderColor } from './helpers'
|
|
8
8
|
|
|
9
|
-
export const ButtonGroupBase = styled.divBox<{ innerBorderColor: string }>`
|
|
9
|
+
export const ButtonGroupBase = styled.divBox<{ colorScheme?: string; innerBorderColor: string }>`
|
|
10
10
|
display: flex;
|
|
11
11
|
|
|
12
12
|
// Border color between Buttons
|
|
@@ -34,6 +34,17 @@ export const ButtonGroupBase = styled.divBox<{ innerBorderColor: string }>`
|
|
|
34
34
|
border-left-width: 0px;
|
|
35
35
|
border-top-left-radius: 0;
|
|
36
36
|
}
|
|
37
|
+
|
|
38
|
+
// Border color
|
|
39
|
+
> *,
|
|
40
|
+
*:hover {
|
|
41
|
+
border-color: ${p => th.color(p.innerBorderColor)};
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
//
|
|
45
|
+
> .${activeClassName} {
|
|
46
|
+
background-color: ${p => th.color(`${p.colorScheme}.${activeItemShade}`)};
|
|
47
|
+
}
|
|
37
48
|
`
|
|
38
49
|
|
|
39
50
|
/**
|
|
@@ -41,9 +52,7 @@ export const ButtonGroupBase = styled.divBox<{ innerBorderColor: string }>`
|
|
|
41
52
|
* Exposes some props to the children via context.
|
|
42
53
|
*/
|
|
43
54
|
export const ButtonGroup = vui<'div', ButtonGroupProps>((props, ref) => {
|
|
44
|
-
const { className, colorScheme, disabled, size, variant, ...rest } = props
|
|
45
|
-
|
|
46
|
-
const innerBorderColor = getInnerBorderColor(props)
|
|
55
|
+
const { className, colorScheme, disabled, innerBorderColor, size, variant, ...rest } = props
|
|
47
56
|
|
|
48
57
|
const context = useMemo(
|
|
49
58
|
() => filterUndefined({ colorScheme, disabled, size, variant }),
|
|
@@ -52,7 +61,11 @@ export const ButtonGroup = vui<'div', ButtonGroupProps>((props, ref) => {
|
|
|
52
61
|
|
|
53
62
|
return (
|
|
54
63
|
<ButtonGroupProvider value={context}>
|
|
55
|
-
<ButtonGroupBase
|
|
64
|
+
<ButtonGroupBase
|
|
65
|
+
className={cs('vui-buttonGroup', className)}
|
|
66
|
+
{...{ colorScheme, innerBorderColor: innerBorderColor ? innerBorderColor : getInnerBorderColor(props), ref }}
|
|
67
|
+
{...rest}
|
|
68
|
+
/>
|
|
56
69
|
</ButtonGroupProvider>
|
|
57
70
|
)
|
|
58
71
|
})
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
+
import { ButtonColorScheme } from '../button/button.types'
|
|
1
2
|
import { SystemProps } from '../system'
|
|
2
3
|
import { ThemingProps } from '../theme'
|
|
3
4
|
|
|
4
5
|
export type ButtonGroupProps = SystemProps &
|
|
5
6
|
ThemingProps<'ButtonGroup'> & {
|
|
6
7
|
/** Available theme colors for this component. */
|
|
7
|
-
colorScheme?:
|
|
8
|
+
colorScheme?: ButtonColorScheme
|
|
8
9
|
/** Makes all wrapped buttons disabled. */
|
|
9
10
|
disabled?: boolean
|
|
11
|
+
/** Border color between the buttons. */
|
|
12
|
+
innerBorderColor?: string
|
|
10
13
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ButtonGroupProps } from './buttonGroup.types'
|
|
2
2
|
|
|
3
3
|
/** Returns appropriate color for the border between the buttons. */
|
|
4
|
-
export function getInnerBorderColor(props: ButtonGroupProps) {
|
|
4
|
+
export function getInnerBorderColor(props: ButtonGroupProps): string {
|
|
5
5
|
const { colorScheme = 'prussian', disabled, variant = 'solid' } = props
|
|
6
6
|
|
|
7
7
|
if (disabled) return 'disabled.border'
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
|
|
3
|
+
import ButtonGroup from '../buttonGroup'
|
|
4
|
+
import { cs, dimmedBorderColor } from '../utils'
|
|
5
|
+
import { ButtonToggleGroupProps } from './buttonToggleGroup.types'
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Organizes layout and display of multiple buttons. Based on ButtonGroup and should be used to toggle options.
|
|
9
|
+
*/
|
|
10
|
+
export const ButtonToggleGroup = (props: ButtonToggleGroupProps) => {
|
|
11
|
+
const { className, isDimmedBorder } = props
|
|
12
|
+
|
|
13
|
+
return (
|
|
14
|
+
<ButtonGroup
|
|
15
|
+
className={cs('vui-buttonToggleGroup', className)}
|
|
16
|
+
colorScheme="blue"
|
|
17
|
+
innerBorderColor={isDimmedBorder ? dimmedBorderColor : ''}
|
|
18
|
+
variant="outlined"
|
|
19
|
+
{...props}
|
|
20
|
+
/>
|
|
21
|
+
)
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export default ButtonToggleGroup
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ReactNode } from 'react'
|
|
2
|
+
|
|
3
|
+
import { ButtonGroupProps } from '../buttonGroup'
|
|
4
|
+
import { ThemingProps } from '../theme'
|
|
5
|
+
|
|
6
|
+
export type ButtonToggleGroupProps = ButtonGroupProps &
|
|
7
|
+
ThemingProps<'ButtonToggleGroup'> & {
|
|
8
|
+
className?: string
|
|
9
|
+
/** Sets dimmed borders to the buttons. */
|
|
10
|
+
isDimmedBorder?: boolean
|
|
11
|
+
children: ReactNode
|
|
12
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -2,6 +2,7 @@ export * from './avatar'
|
|
|
2
2
|
export * from './box'
|
|
3
3
|
export * from './button'
|
|
4
4
|
export * from './buttonGroup'
|
|
5
|
+
export * from './buttonToggleGroup'
|
|
5
6
|
export * from './card'
|
|
6
7
|
export * from './checkbox'
|
|
7
8
|
export * from './core'
|
|
@@ -19,6 +20,7 @@ export * from './link'
|
|
|
19
20
|
export * from './list'
|
|
20
21
|
export * from './logo'
|
|
21
22
|
export * from './menu'
|
|
23
|
+
export * from './message'
|
|
22
24
|
export * from './modal'
|
|
23
25
|
export * from './notification'
|
|
24
26
|
export * from './p'
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
|
|
3
|
+
import { styled, useStyleConfig, vui } from '../core'
|
|
4
|
+
import { Icon } from '../icon'
|
|
5
|
+
import { T } from '../t'
|
|
6
|
+
import { cs } from '../utils'
|
|
7
|
+
import { iconDictionary, spacingDictionary } from './consts'
|
|
8
|
+
import { MessageProps } from './message.types'
|
|
9
|
+
|
|
10
|
+
export const MessageBase = styled.divBox`
|
|
11
|
+
transition-duration: fast;
|
|
12
|
+
`
|
|
13
|
+
|
|
14
|
+
/** Displays a simple message text. */
|
|
15
|
+
export const Message = vui<'span', MessageProps>((props, ref) => {
|
|
16
|
+
const { children, className, text, size = 'md', variant = 'info', ...rest } = props
|
|
17
|
+
const styles = useStyleConfig('Message', props)
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<MessageBase className={cs('vui-message', className)} ref={ref} {...styles} {...rest}>
|
|
21
|
+
<T centerV size={size}>
|
|
22
|
+
<Icon mr={`${spacingDictionary[size]}px`} name={iconDictionary[variant]} size={size} />
|
|
23
|
+
{children ?? text}
|
|
24
|
+
</T>
|
|
25
|
+
</MessageBase>
|
|
26
|
+
)
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
export default Message
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ReactText } from 'react'
|
|
2
|
+
|
|
3
|
+
import { SystemProps } from '../system'
|
|
4
|
+
import { ThemingProps } from '../theme'
|
|
5
|
+
|
|
6
|
+
export type MessageProps = SystemProps &
|
|
7
|
+
ThemingProps<'Message'> & {
|
|
8
|
+
/** Displays given text if no children are provided. */
|
|
9
|
+
text?: ReactText
|
|
10
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
const baseStyle = {}
|
|
2
|
+
|
|
3
|
+
const defaultProps = {
|
|
4
|
+
variant: 'info'
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
const sizes = {
|
|
8
|
+
xs: {},
|
|
9
|
+
sm: {},
|
|
10
|
+
md: {},
|
|
11
|
+
lg: {}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const variants = {
|
|
15
|
+
info: {
|
|
16
|
+
color: 'blue.80'
|
|
17
|
+
},
|
|
18
|
+
warning: {
|
|
19
|
+
color: 'yellow.90'
|
|
20
|
+
},
|
|
21
|
+
error: {
|
|
22
|
+
color: 'red.80'
|
|
23
|
+
},
|
|
24
|
+
success: {
|
|
25
|
+
color: 'green.80'
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export default {
|
|
30
|
+
baseStyle,
|
|
31
|
+
defaultProps,
|
|
32
|
+
sizes,
|
|
33
|
+
variants
|
|
34
|
+
}
|
package/src/theme/components.ts
CHANGED
|
@@ -15,6 +15,7 @@ import Input from '../input/theme'
|
|
|
15
15
|
import Link from '../link/theme'
|
|
16
16
|
import List from '../list/theme'
|
|
17
17
|
import Menu from '../menu/theme'
|
|
18
|
+
import Message from '../message/theme'
|
|
18
19
|
import Modal from '../modal/theme'
|
|
19
20
|
import Notification from '../notification/theme'
|
|
20
21
|
import P from '../p/theme'
|
|
@@ -51,6 +52,7 @@ export default {
|
|
|
51
52
|
Link,
|
|
52
53
|
List,
|
|
53
54
|
Menu,
|
|
55
|
+
Message,
|
|
54
56
|
Modal,
|
|
55
57
|
Notification,
|
|
56
58
|
P,
|
package/src/tooltip/tooltip.tsx
CHANGED