orcs-design-system 3.3.71 → 3.3.72
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/es/components/ActionsMenu/index.js +59 -4
- package/es/components/Breadcrumbs/index.js +26 -23
- package/es/components/Button/index.js +233 -145
- package/es/components/Card/index.js +97 -12
- package/es/components/Checkbox/index.js +186 -17
- package/es/components/HeaderSimple/index.js +4 -0
- package/es/components/Icon/index.js +14 -4
- package/es/components/Loading/index.js +7 -1
- package/es/components/Notification/index.js +61 -21
- package/es/components/SideNavV2/NavItem.js +3 -2
- package/es/components/SideNavV2/SideNavV2.stories.js +82 -0
- package/es/components/SideNavV2/components/BaseSection.js +3 -2
- package/es/components/SideNavV2/sections/SideNavCurrentViewSection.js +2 -1
- package/es/components/SideNavV2/styles/sharedHoverStyles.js +33 -0
- package/es/components/Spacer/index.js +3 -0
- package/es/components/Tabs/Tabs.stories.js +67 -0
- package/es/components/Tabs/index.js +142 -42
- package/es/components/TabsAlt/index.js +25 -3
- package/package.json +5 -4
|
@@ -2,7 +2,7 @@ import React, { useState, useImperativeHandle, createContext, useContext, useMem
|
|
|
2
2
|
import styled, { css, ThemeProvider } from "styled-components";
|
|
3
3
|
import PropTypes from "prop-types";
|
|
4
4
|
import { NavLink } from "react-router-dom";
|
|
5
|
-
import { space, layout } from "styled-system";
|
|
5
|
+
import { space, layout, variant } from "styled-system";
|
|
6
6
|
import { themeGet } from "@styled-system/theme-get";
|
|
7
7
|
import { commonKeys } from "../../hooks/keypress";
|
|
8
8
|
import useActionMenu from "./useActionMenu";
|
|
@@ -22,15 +22,70 @@ const Wrapper = /*#__PURE__*/styled.div.withConfig({
|
|
|
22
22
|
const Control = /*#__PURE__*/styled.button.withConfig({
|
|
23
23
|
displayName: "Control",
|
|
24
24
|
componentId: "sc-yvbni2-2"
|
|
25
|
-
})(["position:relative;display:flex;align-items:center;justify-content:center;-moz-appearance:none;-webkit-appearance:none;appearance:none;box-shadow:none;text-decoration:none;text-align:center;
|
|
25
|
+
})(["position:relative;display:flex;align-items:center;justify-content:center;-moz-appearance:none;-webkit-appearance:none;appearance:none;box-shadow:none;text-decoration:none;text-align:center;transition:", ";cursor:", ";", " &[data-state=\"open\"] .actionsMenu__dots{&:before{animation:500ms ", " cubic-bezier(0.68,-0.6,0.32,1.6) forwards;}&:after{animation:500ms ", " cubic-bezier(0.68,-0.6,0.32,1.6) forwards;}}&[data-state=\"open\"] .actionsMenu__cross{&:before{animation:500ms ", " cubic-bezier(0.68,-0.6,0.32,1.6) forwards;}&:after{animation:500ms ", " cubic-bezier(0.68,-0.6,0.32,1.6) forwards;}}&[data-state=\"closed\"] .actionsMenu__dots{&:before{animation:500ms ", " cubic-bezier(0.68,-0.6,0.32,1.6) forwards;}&:after{animation:500ms ", " cubic-bezier(0.68,-0.6,0.32,1.6) forwards;}}&[data-state=\"closed\"] .actionsMenu__cross{&:before{animation:500ms ", " cubic-bezier(0.68,-0.6,0.32,1.6) forwards;}&:after{animation:500ms ", " cubic-bezier(0.68,-0.6,0.32,1.6) forwards;}}"], props => themeGet("transition.transitionDefault")(props), props => props.disabled ? "not-allowed" : "pointer", props => variant({
|
|
26
|
+
variants: {
|
|
27
|
+
default: {
|
|
28
|
+
width: "30px",
|
|
29
|
+
height: "30px",
|
|
30
|
+
borderRadius: themeGet("radii.2")(props),
|
|
31
|
+
border: "solid 1px",
|
|
32
|
+
backgroundColor: props.disabled ? themeGet("colors.greyLighter")(props) : "white",
|
|
33
|
+
borderColor: props.disabled ? themeGet("colors.greyLighter")(props) : themeGet("colors.greyLight")(props),
|
|
34
|
+
"&:hover, &:focus": {
|
|
35
|
+
outline: 0,
|
|
36
|
+
borderColor: props.disabled ? themeGet("colors.greyLighter")(props) : themeGet("colors.primary")(props)
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
circle: {
|
|
40
|
+
width: "35px",
|
|
41
|
+
height: "35px",
|
|
42
|
+
borderRadius: "50%",
|
|
43
|
+
border: "solid 2px",
|
|
44
|
+
backgroundColor: props.disabled ? themeGet("colors.greyLighter")(props) : themeGet("colors.greyDarkest")(props),
|
|
45
|
+
borderColor: props.disabled ? themeGet("colors.greyLighter")(props) : themeGet("colors.greyDarkest")(props),
|
|
46
|
+
"&:hover, &:focus": {
|
|
47
|
+
outline: 0,
|
|
48
|
+
borderColor: props.disabled ? themeGet("colors.greyLighter")(props) : themeGet("colors.primary")(props)
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}), beforeDotCollapsing, afterDotCollapsing, beforeCrossExpanding, afterCrossExpanding, beforeDotExpanding, afterDotExpanding, beforeCrossCollapsing, afterCrossCollapsing);
|
|
26
53
|
const Dots = /*#__PURE__*/styled.div.withConfig({
|
|
27
54
|
displayName: "Dots",
|
|
28
55
|
componentId: "sc-yvbni2-3"
|
|
29
|
-
})(["border-radius:2px;height:4px;width:4px
|
|
56
|
+
})(["border-radius:2px;height:4px;width:4px;&:before,&:after{content:\"\";display:block;position:absolute;border-radius:2px;height:4px;width:4px;}&:before{transform:translate(0,-6px);}&:after{transform:translate(0,6px);}", ""], props => variant({
|
|
57
|
+
variants: {
|
|
58
|
+
default: {
|
|
59
|
+
backgroundColor: themeGet("colors.greyDarker")(props),
|
|
60
|
+
"&:before, &:after": {
|
|
61
|
+
backgroundColor: themeGet("colors.greyDarker")(props)
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
circle: {
|
|
65
|
+
backgroundColor: themeGet("colors.white")(props),
|
|
66
|
+
"&:before, &:after": {
|
|
67
|
+
backgroundColor: themeGet("colors.white")(props)
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}));
|
|
30
72
|
const Cross = /*#__PURE__*/styled.div.withConfig({
|
|
31
73
|
displayName: "Cross",
|
|
32
74
|
componentId: "sc-yvbni2-4"
|
|
33
|
-
})(["animation:1500ms ", " ease-in-out forwards;opacity:0;position:absolute;left:calc(50% - 2px);top:calc(50% - 2px);&:before,&:after{content:\"\";display:block;position:absolute;border-radius:2px;height:4px;width:4px;
|
|
75
|
+
})(["animation:1500ms ", " ease-in-out forwards;opacity:0;position:absolute;left:calc(50% - 2px);top:calc(50% - 2px);&:before,&:after{content:\"\";display:block;position:absolute;border-radius:2px;height:4px;width:4px;}&:before{transform:rotate(-45deg);}&:after{transform:rotate(45deg);}", ""], crossFadeIn, props => variant({
|
|
76
|
+
variants: {
|
|
77
|
+
default: {
|
|
78
|
+
"&:before, &:after": {
|
|
79
|
+
backgroundColor: themeGet("colors.greyDarker")(props)
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
circle: {
|
|
83
|
+
"&:before, &:after": {
|
|
84
|
+
backgroundColor: themeGet("colors.white")(props)
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}));
|
|
34
89
|
const Menu = /*#__PURE__*/styled.div.withConfig({
|
|
35
90
|
displayName: "Menu",
|
|
36
91
|
componentId: "sc-yvbni2-5"
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import PropTypes from "prop-types";
|
|
3
3
|
import styled from "styled-components";
|
|
4
|
-
import { space, layout, typography } from "styled-system";
|
|
4
|
+
import { space, layout, typography, variant } from "styled-system";
|
|
5
5
|
import { themeGet } from "@styled-system/theme-get";
|
|
6
6
|
import StyledLink from "../StyledLink";
|
|
7
7
|
import Popover from "../Popover";
|
|
@@ -17,45 +17,48 @@ const List = /*#__PURE__*/styled("ol").withConfig({
|
|
|
17
17
|
}).withConfig({
|
|
18
18
|
displayName: "List",
|
|
19
19
|
componentId: "sc-qbw4kn-1"
|
|
20
|
-
})(["display:flex;flex-direction:", ";flex-wrap:wrap;list-style:none;margin:0;padding:0;gap:5px;
|
|
20
|
+
})(["display:flex;flex-direction:", ";flex-wrap:wrap;list-style:none;margin:0;padding:0;gap:5px;", " ", ""], _ref => {
|
|
21
21
|
let {
|
|
22
22
|
showAsIconTooltip
|
|
23
23
|
} = _ref;
|
|
24
24
|
return showAsIconTooltip ? "column" : "row";
|
|
25
|
-
},
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
25
|
+
}, variant({
|
|
26
|
+
variants: {
|
|
27
|
+
default: {
|
|
28
|
+
textShadow: "none"
|
|
29
|
+
},
|
|
30
|
+
white: {
|
|
31
|
+
textShadow: "0 0px 5px rgba(0,0,0,0.2)"
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}), space);
|
|
31
35
|
const Item = /*#__PURE__*/styled("li").withConfig({
|
|
32
36
|
shouldForwardProp: prop => !["variant", "isLast"].includes(prop)
|
|
33
37
|
}).withConfig({
|
|
34
38
|
displayName: "Item",
|
|
35
39
|
componentId: "sc-qbw4kn-2"
|
|
36
|
-
})(["display:flex;gap:5px;align-items:center;
|
|
37
|
-
let {
|
|
38
|
-
variant,
|
|
39
|
-
theme
|
|
40
|
-
} = _ref3;
|
|
41
|
-
return variant === "white" ? themeGet("colors.white")({
|
|
42
|
-
theme
|
|
43
|
-
}) : themeGet("colors.greyDarker")({
|
|
44
|
-
theme
|
|
45
|
-
});
|
|
46
|
-
}, themeGet("fontSizes.0"), _ref4 => {
|
|
40
|
+
})(["display:flex;gap:5px;align-items:center;font-size:", ";line-height:1.5;font-weight:", ";& > a{color:inherit;text-decoration:none;&:hover{text-decoration:underline;}}", " ", ""], themeGet("fontSizes.0"), _ref2 => {
|
|
47
41
|
let {
|
|
48
42
|
isLast
|
|
49
|
-
} =
|
|
43
|
+
} = _ref2;
|
|
50
44
|
return isLast ? themeGet("fontWeights.2") : "normal";
|
|
51
|
-
},
|
|
52
|
-
|
|
45
|
+
}, props => variant({
|
|
46
|
+
variants: {
|
|
47
|
+
default: {
|
|
48
|
+
color: themeGet("colors.greyDarker")(props)
|
|
49
|
+
},
|
|
50
|
+
white: {
|
|
51
|
+
color: themeGet("colors.white")(props)
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}), typography);
|
|
55
|
+
const Breadcrumbs = _ref3 => {
|
|
53
56
|
let {
|
|
54
57
|
config,
|
|
55
58
|
variant = "default",
|
|
56
59
|
showAsIconTooltip,
|
|
57
60
|
...props
|
|
58
|
-
} =
|
|
61
|
+
} = _ref3;
|
|
59
62
|
if (showAsIconTooltip) {
|
|
60
63
|
return /*#__PURE__*/_jsx(Popover, {
|
|
61
64
|
text: /*#__PURE__*/_jsx(List, {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import styled, { ThemeProvider, css } from "styled-components";
|
|
3
3
|
import PropTypes from "prop-types";
|
|
4
|
-
import { space, layout, color, background, border, compose } from "styled-system";
|
|
4
|
+
import { space, layout, color, background, border, compose, variant } from "styled-system";
|
|
5
5
|
import shouldForwardProp from "@styled-system/should-forward-prop";
|
|
6
6
|
import Icon from "../Icon";
|
|
7
7
|
import Loading from "../Loading";
|
|
@@ -18,160 +18,152 @@ const customShouldForwardProp = prop => {
|
|
|
18
18
|
}
|
|
19
19
|
return shouldForwardProp(prop);
|
|
20
20
|
};
|
|
21
|
-
export const VARIANT_COLORS = {
|
|
22
|
-
default: {
|
|
23
|
-
background: "colors.primary",
|
|
24
|
-
color: "colors.white",
|
|
25
|
-
borderColor: "colors.primary",
|
|
26
|
-
hovered: {
|
|
27
|
-
background: "colors.primaryDark",
|
|
28
|
-
color: "colors.white",
|
|
29
|
-
borderColor: "colors.primaryDark"
|
|
30
|
-
}
|
|
31
|
-
},
|
|
32
|
-
success: {
|
|
33
|
-
background: "colors.success",
|
|
34
|
-
color: "colors.white",
|
|
35
|
-
borderColor: "colors.success",
|
|
36
|
-
hovered: {
|
|
37
|
-
background: "colors.successDark",
|
|
38
|
-
color: "colors.white",
|
|
39
|
-
borderColor: "colors.successDark"
|
|
40
|
-
},
|
|
41
|
-
focused: {
|
|
42
|
-
outline: "colors.successDarker"
|
|
43
|
-
}
|
|
44
|
-
},
|
|
45
|
-
successAlternate: {
|
|
46
|
-
background: "colors.greyLightest",
|
|
47
|
-
color: "colors.success",
|
|
48
|
-
borderColor: "colors.greyLightest",
|
|
49
|
-
hovered: {
|
|
50
|
-
background: "colors.greyLighter",
|
|
51
|
-
color: "colors.success",
|
|
52
|
-
borderColor: "colors.greyLighter"
|
|
53
|
-
},
|
|
54
|
-
focused: {
|
|
55
|
-
outline: "colors.successLight"
|
|
56
|
-
}
|
|
57
|
-
},
|
|
58
|
-
danger: {
|
|
59
|
-
background: "colors.danger",
|
|
60
|
-
color: "colors.white",
|
|
61
|
-
borderColor: "colors.danger",
|
|
62
|
-
hovered: {
|
|
63
|
-
background: "colors.dangerDark",
|
|
64
|
-
color: "colors.white",
|
|
65
|
-
borderColor: "colors.dangerDark"
|
|
66
|
-
},
|
|
67
|
-
focused: {
|
|
68
|
-
outline: "colors.dangerDarker"
|
|
69
|
-
}
|
|
70
|
-
},
|
|
71
|
-
dangerAlternate: {
|
|
72
|
-
background: "colors.greyLightest",
|
|
73
|
-
color: "colors.danger",
|
|
74
|
-
borderColor: "colors.greyLightest",
|
|
75
|
-
hovered: {
|
|
76
|
-
background: "colors.greyLighter",
|
|
77
|
-
color: "colors.danger",
|
|
78
|
-
borderColor: "colors.greyLighter"
|
|
79
|
-
},
|
|
80
|
-
focused: {
|
|
81
|
-
outline: "colors.dangerLight"
|
|
82
|
-
}
|
|
83
|
-
},
|
|
84
|
-
disabled: {
|
|
85
|
-
background: "colors.greyLighter",
|
|
86
|
-
color: "colors.grey",
|
|
87
|
-
borderColor: "colors.greyLighter",
|
|
88
|
-
hovered: {
|
|
89
|
-
background: "colors.greyLighter",
|
|
90
|
-
color: "colors.grey",
|
|
91
|
-
borderColor: "colors.greyLighter"
|
|
92
|
-
}
|
|
93
|
-
},
|
|
94
|
-
ghost: {
|
|
95
|
-
background: "colors.primaryLightest",
|
|
96
|
-
color: "colors.primaryDark",
|
|
97
|
-
borderColor: "colors.primaryLightest",
|
|
98
|
-
hovered: {
|
|
99
|
-
background: "colors.primaryLighter",
|
|
100
|
-
color: "colors.primaryDarker",
|
|
101
|
-
borderColor: "colors.primaryLighter"
|
|
102
|
-
},
|
|
103
|
-
focused: {
|
|
104
|
-
outline: "colors.primaryLight"
|
|
105
|
-
}
|
|
106
|
-
},
|
|
107
|
-
borderBlue: {
|
|
108
|
-
background: "colors.white",
|
|
109
|
-
color: "colors.primary",
|
|
110
|
-
borderColor: "colors.primary",
|
|
111
|
-
hovered: {
|
|
112
|
-
background: "colors.primaryLightest",
|
|
113
|
-
color: "colors.primaryDark",
|
|
114
|
-
borderColor: "colors.primaryDark"
|
|
115
|
-
},
|
|
116
|
-
focused: {
|
|
117
|
-
outline: "colors.primaryDark"
|
|
118
|
-
}
|
|
119
|
-
},
|
|
120
|
-
borderGrey: {
|
|
121
|
-
background: "colors.white",
|
|
122
|
-
color: "colors.greyDarkest",
|
|
123
|
-
borderColor: "colors.greyDarkest",
|
|
124
|
-
hovered: {
|
|
125
|
-
background: "colors.primaryLightest",
|
|
126
|
-
color: "colors.greyDarkest",
|
|
127
|
-
borderColor: "colors.greyDarkest"
|
|
128
|
-
},
|
|
129
|
-
focused: {
|
|
130
|
-
outline: "colors.greyDarkest"
|
|
131
|
-
}
|
|
132
|
-
},
|
|
133
|
-
ai: {
|
|
134
|
-
background: "colors.secondaryLight",
|
|
135
|
-
// Not used for AI variant, handled specially
|
|
136
|
-
color: "colors.white",
|
|
137
|
-
borderColor: "colors.secondaryLight",
|
|
138
|
-
hovered: {
|
|
139
|
-
background: "colors.secondary",
|
|
140
|
-
// Not used for AI variant, handled specially
|
|
141
|
-
color: "colors.white",
|
|
142
|
-
borderColor: "colors.secondary"
|
|
143
|
-
},
|
|
144
|
-
focused: {
|
|
145
|
-
outline: "colors.secondary"
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
};
|
|
149
21
|
const getOutlineStyle = color => css(["outline:0;box-shadow:", ";"], props => [themeGet("shadows.thinOutline")(props), themeGet(color)(props)].join(" "));
|
|
150
|
-
const
|
|
151
|
-
|
|
22
|
+
const getVariantStyles = props => {
|
|
23
|
+
// Handle disabled state - override variant if disabled
|
|
24
|
+
if (props.disabled) {
|
|
25
|
+
return css(["background:", ";color:", ";border-color:", ";&:hover{background:", ";color:", ";border-color:", ";}"], themeGet("colors.greyLighter")(props), themeGet("colors.grey")(props), themeGet("colors.greyLighter")(props), themeGet("colors.greyLighter")(props), themeGet("colors.grey")(props), themeGet("colors.greyLighter")(props));
|
|
26
|
+
}
|
|
152
27
|
|
|
153
28
|
// Special handling for AI variant with gradient
|
|
154
|
-
if (
|
|
155
|
-
return css(["background:linear-gradient( 135deg,", " 0%,", " 100% );color:", ";border-color:", ";&:hover{background:linear-gradient( 135deg,", " 0%,", " 100% );color:", ";border-color:", ";}", ""], themeGet("colors.primaryLight"), themeGet("colors.secondaryLight"), themeGet(
|
|
29
|
+
if (props.variant === "ai") {
|
|
30
|
+
return css(["background:linear-gradient( 135deg,", " 0%,", " 100% );color:", ";border-color:", ";&:hover{background:linear-gradient( 135deg,", " 0%,", " 100% );color:", ";border-color:", ";}&:focus{", "}"], themeGet("colors.primaryLight"), themeGet("colors.secondaryLight"), themeGet("colors.white"), themeGet("colors.secondaryLight"), themeGet("colors.primary"), themeGet("colors.secondary"), themeGet("colors.white"), themeGet("colors.secondary"), getOutlineStyle("colors.secondary"));
|
|
156
31
|
}
|
|
157
|
-
return
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
32
|
+
return variant({
|
|
33
|
+
variants: {
|
|
34
|
+
default: {
|
|
35
|
+
background: themeGet("colors.primary")(props),
|
|
36
|
+
color: themeGet("colors.white")(props),
|
|
37
|
+
borderColor: themeGet("colors.primary")(props),
|
|
38
|
+
"&:hover": {
|
|
39
|
+
background: themeGet("colors.primaryDark")(props),
|
|
40
|
+
color: themeGet("colors.white")(props),
|
|
41
|
+
borderColor: themeGet("colors.primaryDark")(props)
|
|
42
|
+
},
|
|
43
|
+
"&:focus": {
|
|
44
|
+
outline: 0,
|
|
45
|
+
boxShadow: `${themeGet("shadows.thinOutline")(props)} ${themeGet("colors.primaryDarker")(props)}`
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
success: {
|
|
49
|
+
background: themeGet("colors.success")(props),
|
|
50
|
+
color: themeGet("colors.white")(props),
|
|
51
|
+
borderColor: themeGet("colors.success")(props),
|
|
52
|
+
"&:hover": {
|
|
53
|
+
background: themeGet("colors.successDark")(props),
|
|
54
|
+
color: themeGet("colors.white")(props),
|
|
55
|
+
borderColor: themeGet("colors.successDark")(props)
|
|
56
|
+
},
|
|
57
|
+
"&:focus": {
|
|
58
|
+
outline: 0,
|
|
59
|
+
boxShadow: `${themeGet("shadows.thinOutline")(props)} ${themeGet("colors.successDarker")(props)}`
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
successAlternate: {
|
|
63
|
+
background: themeGet("colors.greyLightest")(props),
|
|
64
|
+
color: themeGet("colors.success")(props),
|
|
65
|
+
borderColor: themeGet("colors.greyLightest")(props),
|
|
66
|
+
"&:hover": {
|
|
67
|
+
background: themeGet("colors.greyLighter")(props),
|
|
68
|
+
color: themeGet("colors.success")(props),
|
|
69
|
+
borderColor: themeGet("colors.greyLighter")(props)
|
|
70
|
+
},
|
|
71
|
+
"&:focus": {
|
|
72
|
+
outline: 0,
|
|
73
|
+
boxShadow: `${themeGet("shadows.thinOutline")(props)} ${themeGet("colors.successLight")(props)}`
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
danger: {
|
|
77
|
+
background: themeGet("colors.danger")(props),
|
|
78
|
+
color: themeGet("colors.white")(props),
|
|
79
|
+
borderColor: themeGet("colors.danger")(props),
|
|
80
|
+
"&:hover": {
|
|
81
|
+
background: themeGet("colors.dangerDark")(props),
|
|
82
|
+
color: themeGet("colors.white")(props),
|
|
83
|
+
borderColor: themeGet("colors.dangerDark")(props)
|
|
84
|
+
},
|
|
85
|
+
"&:focus": {
|
|
86
|
+
outline: 0,
|
|
87
|
+
boxShadow: `${themeGet("shadows.thinOutline")(props)} ${themeGet("colors.dangerDarker")(props)}`
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
dangerAlternate: {
|
|
91
|
+
background: themeGet("colors.greyLightest")(props),
|
|
92
|
+
color: themeGet("colors.danger")(props),
|
|
93
|
+
borderColor: themeGet("colors.greyLightest")(props),
|
|
94
|
+
"&:hover": {
|
|
95
|
+
background: themeGet("colors.greyLighter")(props),
|
|
96
|
+
color: themeGet("colors.danger")(props),
|
|
97
|
+
borderColor: themeGet("colors.greyLighter")(props)
|
|
98
|
+
},
|
|
99
|
+
"&:focus": {
|
|
100
|
+
outline: 0,
|
|
101
|
+
boxShadow: `${themeGet("shadows.thinOutline")(props)} ${themeGet("colors.dangerLight")(props)}`
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
ghost: {
|
|
105
|
+
background: themeGet("colors.primaryLightest")(props),
|
|
106
|
+
color: themeGet("colors.primaryDark")(props),
|
|
107
|
+
borderColor: themeGet("colors.primaryLightest")(props),
|
|
108
|
+
"&:hover": {
|
|
109
|
+
background: themeGet("colors.primaryLighter")(props),
|
|
110
|
+
color: themeGet("colors.primaryDarker")(props),
|
|
111
|
+
borderColor: themeGet("colors.primaryLighter")(props)
|
|
112
|
+
},
|
|
113
|
+
"&:focus": {
|
|
114
|
+
outline: 0,
|
|
115
|
+
boxShadow: `${themeGet("shadows.thinOutline")(props)} ${themeGet("colors.primaryLight")(props)}`
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
borderBlue: {
|
|
119
|
+
background: themeGet("colors.white")(props),
|
|
120
|
+
color: themeGet("colors.primary")(props),
|
|
121
|
+
borderColor: themeGet("colors.primary")(props),
|
|
122
|
+
"&:hover": {
|
|
123
|
+
background: themeGet("colors.primaryLightest")(props),
|
|
124
|
+
color: themeGet("colors.primaryDark")(props),
|
|
125
|
+
borderColor: themeGet("colors.primaryDark")(props)
|
|
126
|
+
},
|
|
127
|
+
"&:focus": {
|
|
128
|
+
outline: 0,
|
|
129
|
+
boxShadow: `${themeGet("shadows.thinOutline")(props)} ${themeGet("colors.primaryDark")(props)}`
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
borderGrey: {
|
|
133
|
+
background: themeGet("colors.white")(props),
|
|
134
|
+
color: themeGet("colors.greyDarkest")(props),
|
|
135
|
+
borderColor: themeGet("colors.greyDarkest")(props),
|
|
136
|
+
"&:hover": {
|
|
137
|
+
background: themeGet("colors.primaryLightest")(props),
|
|
138
|
+
color: themeGet("colors.greyDarkest")(props),
|
|
139
|
+
borderColor: themeGet("colors.greyDarkest")(props)
|
|
140
|
+
},
|
|
141
|
+
"&:focus": {
|
|
142
|
+
outline: 0,
|
|
143
|
+
boxShadow: `${themeGet("shadows.thinOutline")(props)} ${themeGet("colors.greyDarkest")(props)}`
|
|
144
|
+
}
|
|
145
|
+
},
|
|
146
|
+
disabled: {
|
|
147
|
+
background: themeGet("colors.greyLighter")(props),
|
|
148
|
+
color: themeGet("colors.grey")(props),
|
|
149
|
+
borderColor: themeGet("colors.greyLighter")(props),
|
|
150
|
+
"&:hover": {
|
|
151
|
+
background: themeGet("colors.greyLighter")(props),
|
|
152
|
+
color: themeGet("colors.grey")(props),
|
|
153
|
+
borderColor: themeGet("colors.greyLighter")(props)
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
})(props);
|
|
166
158
|
};
|
|
167
159
|
const getSpace = getter => props => themeGet(`space.${getter(props)}`)(props);
|
|
168
|
-
const buttonStyles = /*#__PURE__*/css(["background:", ";color:", ";border-color:", ";display:flex;align-items:center;justify-content:center;appearance:none;box-shadow:none;margin:0;text-decoration:none;text-align:center;font-family:", ";font-weight:", ";border-radius:", ";transition:", ";border-width:", ";cursor:", ";width:", ";height:auto;font-size:", ";padding:", " ", ";svg{margin-right:", ";margin-left:", ";}&:hover{background:", ";border-color:", ";border-width:", ";border-style:solid;}&:focus{outline:0;box-shadow:", " ", ";}", " ", ""], themeGet(
|
|
160
|
+
const buttonStyles = /*#__PURE__*/css(["background:", ";color:", ";border-color:", ";display:flex;align-items:center;justify-content:center;appearance:none;box-shadow:none;margin:0;text-decoration:none;text-align:center;font-family:", ";font-weight:", ";border-radius:", ";transition:", ";border-width:", ";cursor:", ";width:", ";height:auto;font-size:", ";padding:", " ", ";svg{margin-right:", ";margin-left:", ";}&:hover{background:", ";border-color:", ";border-width:", ";border-style:solid;}&:focus{outline:0;box-shadow:", " ", ";}", " ", ""], themeGet("colors.primary"), themeGet("colors.white"), themeGet("colors.primary"), themeGet("fonts.main"), themeGet("fontWeights.2"), themeGet("radii.2"), themeGet("transition.transitionDefault"), themeGet("borderWidths.1"), props => props.disabled ? "not-allowed" : props.isLoading ? "progress" : "pointer", props => props.fullWidth ? "100%" : "auto", props => {
|
|
169
161
|
let fontSize = 2;
|
|
170
162
|
if (props.large && props.iconOnly) fontSize = 5;
|
|
171
163
|
if (props.large) fontSize = 3;
|
|
172
164
|
if (props.small) fontSize = 1;
|
|
173
165
|
return themeGet(`fontSizes.${fontSize}`)(props);
|
|
174
|
-
}, getSpace(props => props.large ? "s" : props.small ? "xxs" : "xs"), getSpace(props => props.large ? "r" : props.small ? "s" : "between"), getSpace(props => !props.iconLeft ? "" : props.small ? "xs" : "s"), getSpace(props => !props.iconRight ? "" : props.small ? "xs" : "s"), themeGet(
|
|
166
|
+
}, getSpace(props => props.large ? "s" : props.small ? "xxs" : "xs"), getSpace(props => props.large ? "r" : props.small ? "s" : "between"), getSpace(props => !props.iconLeft ? "" : props.small ? "xs" : "s"), getSpace(props => !props.iconRight ? "" : props.small ? "xs" : "s"), themeGet("colors.primaryDark"), themeGet("colors.primaryDark"), themeGet("borderWidths.1"), themeGet("shadows.thinOutline"), themeGet("colors.primaryDarker"), getVariantStyles, compose(space, layout, color, background, border));
|
|
175
167
|
const attrs = props => ({
|
|
176
168
|
"data-testid": props.dataTestId || props["data-testid"],
|
|
177
169
|
disabled: props.disabled || props.variant == "disabled",
|
|
@@ -202,7 +194,7 @@ const buttonPropTypes = {
|
|
|
202
194
|
/** Small button */
|
|
203
195
|
small: PropTypes.bool,
|
|
204
196
|
/** Specifies alternate button colours/styles. */
|
|
205
|
-
variant: PropTypes.oneOf(["success", "successAlternate", "danger", "dangerAlternate", "ghost", "disabled", "default", "ai"]),
|
|
197
|
+
variant: PropTypes.oneOf(["success", "successAlternate", "danger", "dangerAlternate", "ghost", "disabled", "default", "ai", "borderBlue", "borderGrey"]),
|
|
206
198
|
/** Full width button that takes up all available space of parent */
|
|
207
199
|
fullWidth: PropTypes.bool,
|
|
208
200
|
/** Adds a spinner animation to indicate loading or processing */
|
|
@@ -238,6 +230,90 @@ const buttonPropTypes = {
|
|
|
238
230
|
/** Specifies the color theme object. */
|
|
239
231
|
theme: PropTypes.object
|
|
240
232
|
};
|
|
233
|
+
|
|
234
|
+
// Export variant colors for use in stories and other components
|
|
235
|
+
export const VARIANT_COLORS = {
|
|
236
|
+
default: {
|
|
237
|
+
color: "colors.white",
|
|
238
|
+
background: "colors.primary",
|
|
239
|
+
hovered: {
|
|
240
|
+
color: "colors.white",
|
|
241
|
+
background: "colors.primaryDark"
|
|
242
|
+
}
|
|
243
|
+
},
|
|
244
|
+
success: {
|
|
245
|
+
color: "colors.white",
|
|
246
|
+
background: "colors.success",
|
|
247
|
+
hovered: {
|
|
248
|
+
color: "colors.white",
|
|
249
|
+
background: "colors.successDark"
|
|
250
|
+
}
|
|
251
|
+
},
|
|
252
|
+
successAlternate: {
|
|
253
|
+
color: "colors.success",
|
|
254
|
+
background: "colors.greyLightest",
|
|
255
|
+
hovered: {
|
|
256
|
+
color: "colors.success",
|
|
257
|
+
background: "colors.greyLighter"
|
|
258
|
+
}
|
|
259
|
+
},
|
|
260
|
+
danger: {
|
|
261
|
+
color: "colors.white",
|
|
262
|
+
background: "colors.danger",
|
|
263
|
+
hovered: {
|
|
264
|
+
color: "colors.white",
|
|
265
|
+
background: "colors.dangerDark"
|
|
266
|
+
}
|
|
267
|
+
},
|
|
268
|
+
dangerAlternate: {
|
|
269
|
+
color: "colors.danger",
|
|
270
|
+
background: "colors.greyLightest",
|
|
271
|
+
hovered: {
|
|
272
|
+
color: "colors.danger",
|
|
273
|
+
background: "colors.greyLighter"
|
|
274
|
+
}
|
|
275
|
+
},
|
|
276
|
+
ghost: {
|
|
277
|
+
color: "colors.primaryDark",
|
|
278
|
+
background: "colors.primaryLightest",
|
|
279
|
+
hovered: {
|
|
280
|
+
color: "colors.primaryDarker",
|
|
281
|
+
background: "colors.primaryLighter"
|
|
282
|
+
}
|
|
283
|
+
},
|
|
284
|
+
disabled: {
|
|
285
|
+
color: "colors.grey",
|
|
286
|
+
background: "colors.greyLighter",
|
|
287
|
+
hovered: {
|
|
288
|
+
color: "colors.grey",
|
|
289
|
+
background: "colors.greyLighter"
|
|
290
|
+
}
|
|
291
|
+
},
|
|
292
|
+
ai: {
|
|
293
|
+
color: "colors.white",
|
|
294
|
+
background: "colors.primaryLight",
|
|
295
|
+
hovered: {
|
|
296
|
+
color: "colors.white",
|
|
297
|
+
background: "colors.primary"
|
|
298
|
+
}
|
|
299
|
+
},
|
|
300
|
+
borderBlue: {
|
|
301
|
+
color: "colors.primary",
|
|
302
|
+
background: "colors.white",
|
|
303
|
+
hovered: {
|
|
304
|
+
color: "colors.primaryDark",
|
|
305
|
+
background: "colors.primaryLightest"
|
|
306
|
+
}
|
|
307
|
+
},
|
|
308
|
+
borderGrey: {
|
|
309
|
+
color: "colors.greyDarkest",
|
|
310
|
+
background: "colors.white",
|
|
311
|
+
hovered: {
|
|
312
|
+
color: "colors.greyDarkest",
|
|
313
|
+
background: "colors.primaryLightest"
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
};
|
|
241
317
|
const renderButton = (ButtonComponent, _ref) => {
|
|
242
318
|
let {
|
|
243
319
|
ariaLabel,
|
|
@@ -333,6 +409,12 @@ Button.__docgenInfo = {
|
|
|
333
409
|
}, {
|
|
334
410
|
"value": "\"ai\"",
|
|
335
411
|
"computed": false
|
|
412
|
+
}, {
|
|
413
|
+
"value": "\"borderBlue\"",
|
|
414
|
+
"computed": false
|
|
415
|
+
}, {
|
|
416
|
+
"value": "\"borderGrey\"",
|
|
417
|
+
"computed": false
|
|
336
418
|
}]
|
|
337
419
|
},
|
|
338
420
|
"required": false
|
|
@@ -498,6 +580,12 @@ ButtonLink.__docgenInfo = {
|
|
|
498
580
|
}, {
|
|
499
581
|
"value": "\"ai\"",
|
|
500
582
|
"computed": false
|
|
583
|
+
}, {
|
|
584
|
+
"value": "\"borderBlue\"",
|
|
585
|
+
"computed": false
|
|
586
|
+
}, {
|
|
587
|
+
"value": "\"borderGrey\"",
|
|
588
|
+
"computed": false
|
|
501
589
|
}]
|
|
502
590
|
},
|
|
503
591
|
"required": false
|