@sproutsocial/racine 11.9.0-typescript.0 → 12.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/CHANGELOG.md +33 -0
- package/__flow__/Button/{index.tsx → index.js} +21 -20
- package/__flow__/Button/{styles.ts → styles.js} +1 -1
- package/__flow__/Checkbox/styles.js +75 -75
- package/__flow__/Collapsible/index.js +2 -3
- package/__flow__/Image/index.js +2 -10
- package/__flow__/Input/index.js +2 -2
- package/__flow__/SegmentedControl/index.js +2 -3
- package/__flow__/TableCell/index.js +2 -9
- package/__flow__/ToggleHint/index.js +2 -9
- package/__flow__/Token/styles.js +13 -12
- package/__flow__/index.js +1 -0
- package/__flow__/systemProps/color.js +2 -1
- package/__flow__/themes/dark/theme.js +0 -5
- package/__flow__/themes/extendedThemes/sproutTheme/dark/theme.js +9 -0
- package/__flow__/themes/extendedThemes/sproutTheme/light/theme.js +9 -0
- package/__flow__/themes/light/theme.js +0 -5
- package/__flow__/types/theme.flow.js +2 -2
- package/__flow__/utils/responsiveProps/index.test.js +2 -10
- package/__flow__/utils/useInteractiveColor.js +32 -0
- package/commonjs/Button/index.js +70 -0
- package/commonjs/Button/styles.js +66 -0
- package/commonjs/Input/index.js +3 -1
- package/commonjs/Token/styles.js +9 -7
- package/commonjs/index.js +6 -1
- package/commonjs/themes/dark/theme.js +0 -5
- package/commonjs/themes/extendedThemes/sproutTheme/dark/theme.js +11 -2
- package/commonjs/themes/extendedThemes/sproutTheme/light/theme.js +11 -2
- package/commonjs/themes/light/theme.js +0 -5
- package/commonjs/utils/useInteractiveColor.js +33 -0
- package/dist/themes/dark/theme.scss +0 -3
- package/dist/themes/extendedThemes/sproutTheme/dark/theme.scss +14 -3
- package/dist/themes/extendedThemes/sproutTheme/light/theme.scss +14 -3
- package/dist/themes/light/theme.scss +0 -3
- package/lib/Button/index.js +57 -0
- package/lib/Button/styles.js +48 -0
- package/lib/Input/index.js +2 -1
- package/lib/Token/styles.js +8 -7
- package/lib/index.js +1 -0
- package/lib/themes/dark/theme.js +0 -4
- package/lib/themes/extendedThemes/sproutTheme/dark/theme.js +9 -1
- package/lib/themes/extendedThemes/sproutTheme/light/theme.js +9 -1
- package/lib/themes/light/theme.js +0 -4
- package/lib/types/theme.flow.js +1 -1
- package/lib/utils/useInteractiveColor.js +27 -0
- package/package.json +1 -6
- package/__flow__/themes/utils/interact.js +0 -12
- package/commonjs/themes/utils/interact.js +0 -19
- package/lib/themes/utils/interact.js +0 -13
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.default = void 0;
|
|
5
|
+
|
|
6
|
+
var React = _interopRequireWildcard(require("react"));
|
|
7
|
+
|
|
8
|
+
var _styles = _interopRequireDefault(require("./styles"));
|
|
9
|
+
|
|
10
|
+
var _excluded = ["href", "appearance", "active", "disabled", "external", "children", "size", "innerRef", "onClick", "title", "qa", "as", "ariaLabel"];
|
|
11
|
+
|
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
+
|
|
14
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
15
|
+
|
|
16
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
17
|
+
|
|
18
|
+
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
19
|
+
|
|
20
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
21
|
+
|
|
22
|
+
var Button = function Button(_ref) {
|
|
23
|
+
var href = _ref.href,
|
|
24
|
+
_ref$appearance = _ref.appearance,
|
|
25
|
+
appearance = _ref$appearance === void 0 ? "unstyled" : _ref$appearance,
|
|
26
|
+
_ref$active = _ref.active,
|
|
27
|
+
active = _ref$active === void 0 ? false : _ref$active,
|
|
28
|
+
disabled = _ref.disabled,
|
|
29
|
+
external = _ref.external,
|
|
30
|
+
children = _ref.children,
|
|
31
|
+
_ref$size = _ref.size,
|
|
32
|
+
size = _ref$size === void 0 ? "default" : _ref$size,
|
|
33
|
+
innerRef = _ref.innerRef,
|
|
34
|
+
onClick = _ref.onClick,
|
|
35
|
+
title = _ref.title,
|
|
36
|
+
_ref$qa = _ref.qa,
|
|
37
|
+
qa = _ref$qa === void 0 ? {} : _ref$qa,
|
|
38
|
+
as = _ref.as,
|
|
39
|
+
ariaLabel = _ref.ariaLabel,
|
|
40
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
41
|
+
|
|
42
|
+
if (!href && external) {
|
|
43
|
+
console.warn("Warning: external prop cannot be set without a href declaration");
|
|
44
|
+
} // plans to properly deprecate captured in DS-1096
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
var appearanceCheck = appearance === "default" ? "unstyled" : appearance;
|
|
48
|
+
return /*#__PURE__*/React.createElement(_styles.default, _extends({
|
|
49
|
+
title: title,
|
|
50
|
+
active: active,
|
|
51
|
+
href: href,
|
|
52
|
+
target: external ? "_blank" : undefined,
|
|
53
|
+
rel: external ? "noopener noreferrer" : undefined,
|
|
54
|
+
as: as || (href ? "a" : "button"),
|
|
55
|
+
type: href ? undefined : "button",
|
|
56
|
+
"aria-disabled": disabled ? disabled : undefined,
|
|
57
|
+
disabled: disabled,
|
|
58
|
+
buttonSize: size,
|
|
59
|
+
appearance: appearanceCheck,
|
|
60
|
+
ref: innerRef,
|
|
61
|
+
onClick: onClick,
|
|
62
|
+
"data-qa-button": title || "",
|
|
63
|
+
"data-qa-button-isdisabled": disabled === true,
|
|
64
|
+
"aria-label": ariaLabel
|
|
65
|
+
}, qa, rest), children);
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
Button.displayName = "Button";
|
|
69
|
+
var _default = Button;
|
|
70
|
+
exports.default = _default;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.default = void 0;
|
|
5
|
+
|
|
6
|
+
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
7
|
+
|
|
8
|
+
var _systemProps = require("../utils/system-props");
|
|
9
|
+
|
|
10
|
+
var _mixins = require("../utils/mixins");
|
|
11
|
+
|
|
12
|
+
var _styles = _interopRequireDefault(require("../Icon/styles"));
|
|
13
|
+
|
|
14
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
+
|
|
16
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
17
|
+
|
|
18
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
19
|
+
|
|
20
|
+
var Container = _styledComponents.default.button.withConfig({
|
|
21
|
+
displayName: "styles__Container",
|
|
22
|
+
componentId: "sc-1juy94s-0"
|
|
23
|
+
})(["display:inline-block;box-sizing:border-box;text-align:center;font-family:", ";border:1px solid ", ";border-radius:", ";border-style:", ";background:", ";color:", ";cursor:pointer;text-decoration:none;line-height:16px;white-space:nowrap;font-weight:", ";transition:all ", " linear;margin:0;padding:", ";font-size:", ";&:visited{color:", ";}&:hover{color:", ";background:", ";text-decoration:none;box-shadow:", ";}&:active{color:", ";background:", ";transform:translateY(1px);}&:focus{", "}&:focus:active{box-shadow:none;}", " ", " ", " ", "{vertical-align:text-bottom;}", " ", ""], function (props) {
|
|
24
|
+
return props.theme.fontFamily;
|
|
25
|
+
}, function (props) {
|
|
26
|
+
return props.theme.colors.button[props.appearance].border.base;
|
|
27
|
+
}, function (props) {
|
|
28
|
+
return props.theme.radii[500];
|
|
29
|
+
}, function (props) {
|
|
30
|
+
return props.appearance === "placeholder" ? "dashed" : "solid";
|
|
31
|
+
}, function (props) {
|
|
32
|
+
return props.theme.colors.button[props.appearance].background.base;
|
|
33
|
+
}, function (props) {
|
|
34
|
+
return props.theme.colors.button[props.appearance].text.base;
|
|
35
|
+
}, function (props) {
|
|
36
|
+
return props.theme.fontWeights.bold;
|
|
37
|
+
}, function (props) {
|
|
38
|
+
return props.theme.duration.fast;
|
|
39
|
+
}, function (props) {
|
|
40
|
+
return props.buttonSize === "default" ? "" + props.theme.space[300] : "" + props.theme.space[350];
|
|
41
|
+
}, function (props) {
|
|
42
|
+
return props.buttonSize === "default" ? props.theme.typography[200].fontSize : props.theme.typography[300].fontSize;
|
|
43
|
+
}, function (props) {
|
|
44
|
+
return props.theme.colors.button[props.appearance].text.base;
|
|
45
|
+
}, function (props) {
|
|
46
|
+
return props.theme.colors.button[props.appearance].text.hover;
|
|
47
|
+
}, function (props) {
|
|
48
|
+
return props.theme.colors.button[props.appearance].background.hover;
|
|
49
|
+
}, function (props) {
|
|
50
|
+
return props.appearance === "placeholder" ? props.theme.shadows.low : "none";
|
|
51
|
+
}, function (props) {
|
|
52
|
+
return props.theme.colors.button[props.appearance].text.hover;
|
|
53
|
+
}, function (props) {
|
|
54
|
+
return props.theme.colors.button[props.appearance].background.active;
|
|
55
|
+
}, _mixins.focusRing, function (props) {
|
|
56
|
+
return props.active && (0, _styledComponents.css)(["color:", " !important;background:", " !important;"], props.theme.colors.button[props.appearance].text.hover, props.theme.colors.button[props.appearance].background.active);
|
|
57
|
+
}, function (props) {
|
|
58
|
+
return props.disabled && _mixins.disabled;
|
|
59
|
+
}, function (props) {
|
|
60
|
+
return props.appearance === "pill" && (0, _styledComponents.css)(["display:inline-flex;align-items:center;justify-content:center;mix-blend-mode:", ";", ""], props.theme.mode === "dark" ? "screen" : "multiply", _mixins.pill);
|
|
61
|
+
}, _styles.default, _systemProps.LAYOUT, _systemProps.COMMON);
|
|
62
|
+
|
|
63
|
+
Container.displayName = "Button-Container";
|
|
64
|
+
var _default = Container; //${props.theme.mode === "dark" ? "screen" : "multiply"}
|
|
65
|
+
|
|
66
|
+
exports.default = _default;
|
package/commonjs/Input/index.js
CHANGED
|
@@ -15,6 +15,8 @@ var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
|
15
15
|
|
|
16
16
|
var _utils = require("../utils");
|
|
17
17
|
|
|
18
|
+
var _useInteractiveColor = require("../utils/useInteractiveColor");
|
|
19
|
+
|
|
18
20
|
var _excluded = ["autoComplete", "autoFocus", "disabled", "readOnly", "isInvalid", "hasWarning", "id", "name", "placeholder", "type", "required", "value", "elemBefore", "elemAfter", "maxLength", "ariaLabel", "ariaDescribedby", "clearButtonLabel", "innerRef", "onBlur", "onChange", "onClear", "onFocus", "onKeyDown", "onKeyUp", "onPaste", "inputProps", "qa", "appearance", "size"];
|
|
19
21
|
|
|
20
22
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -36,7 +38,7 @@ var StyledButton = (0, _styledComponents.default)(_Button.default).withConfig({
|
|
|
36
38
|
displayName: "Input__StyledButton",
|
|
37
39
|
componentId: "sc-1ck1dnm-0"
|
|
38
40
|
})(["&:hover,&:active{color:", ";}"], function (props) {
|
|
39
|
-
return
|
|
41
|
+
return (0, _useInteractiveColor.useInteractiveColor)(props.theme.colors.icon.base);
|
|
40
42
|
});
|
|
41
43
|
|
|
42
44
|
var ClearButton = function ClearButton() {
|
package/commonjs/Token/styles.js
CHANGED
|
@@ -9,6 +9,8 @@ var _systemProps = require("../utils/system-props");
|
|
|
9
9
|
|
|
10
10
|
var _mixins = require("../utils/mixins");
|
|
11
11
|
|
|
12
|
+
var _useInteractiveColor = require("../utils/useInteractiveColor");
|
|
13
|
+
|
|
12
14
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
13
15
|
|
|
14
16
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
@@ -20,13 +22,13 @@ var Container = _styledComponents.default.button.withConfig({
|
|
|
20
22
|
var theme = _ref.theme;
|
|
21
23
|
return (0, _styledComponents.css)(["", " font-family:", ";font-weight:", ";border:1px solid ", ";border-radius:", ";color:", ";background:", ";padding:", " ", ";transition:all ", " ", ";"], theme.typography[200], theme.fontFamily, theme.fontWeights.normal, theme.colors.container.border.base, theme.radii[500], theme.colors.text.body, theme.colors.container.background.base, theme.space[200], theme.space[300], theme.duration.fast, theme.easing.ease_inout);
|
|
22
24
|
}, _mixins.focusRing, function (_ref2) {
|
|
23
|
-
var
|
|
24
|
-
|
|
25
|
-
return
|
|
25
|
+
var closeable = _ref2.closeable,
|
|
26
|
+
theme = _ref2.theme;
|
|
27
|
+
return closeable && (0, _styledComponents.css)(["cursor:pointer;&:hover,&:active{box-shadow:", ";border:1px solid ", ";}"], theme.shadows.low, (0, _useInteractiveColor.useInteractiveColor)(theme.colors.container.border.base));
|
|
26
28
|
}, function (_ref3) {
|
|
27
|
-
var
|
|
28
|
-
|
|
29
|
-
return
|
|
29
|
+
var theme = _ref3.theme,
|
|
30
|
+
palette = _ref3.palette;
|
|
31
|
+
return palette === "blue" && (0, _styledComponents.css)(["color:", ";background:", ";border:1px solid ", ";&:hover,&:active{cursor:pointer;box-shadow:", ";border:1px solid ", ";}"], theme.colors.text.body, theme.colors.container.background.decorative.blue, theme.colors.container.border.decorative.blue, theme.shadows.low, (0, _useInteractiveColor.useInteractiveColor)(theme.colors.container.border.decorative.blue));
|
|
30
32
|
}, function (_ref4) {
|
|
31
33
|
var disabled = _ref4.disabled,
|
|
32
34
|
theme = _ref4.theme;
|
|
@@ -34,7 +36,7 @@ var Container = _styledComponents.default.button.withConfig({
|
|
|
34
36
|
}, function (_ref5) {
|
|
35
37
|
var valid = _ref5.valid,
|
|
36
38
|
theme = _ref5.theme;
|
|
37
|
-
return !valid && (0, _styledComponents.css)(["color:", ";background:", ";border:1px solid ", ";&:hover{box-shadow:", ";border:1px solid ", ";}"], theme.colors.text.error, theme.colors.container.background.error, theme.colors.container.border.error, theme.shadows.low,
|
|
39
|
+
return !valid && (0, _styledComponents.css)(["color:", ";background:", ";border:1px solid ", ";&:hover{box-shadow:", ";border:1px solid ", ";}"], theme.colors.text.error, theme.colors.container.background.error, theme.colors.container.border.error, theme.shadows.low, (0, _useInteractiveColor.useInteractiveColor)(theme.colors.container.border.error));
|
|
38
40
|
}, _systemProps.COMMON);
|
|
39
41
|
|
|
40
42
|
var _default = Container;
|
package/commonjs/index.js
CHANGED
|
@@ -8,6 +8,7 @@ var _exportNames = {
|
|
|
8
8
|
useSelect: true,
|
|
9
9
|
useMultiselect: true,
|
|
10
10
|
useTextContent: true,
|
|
11
|
+
useInteractiveColor: true,
|
|
11
12
|
theme: true,
|
|
12
13
|
darkTheme: true,
|
|
13
14
|
Icon: true,
|
|
@@ -72,7 +73,7 @@ var _exportNames = {
|
|
|
72
73
|
DateRangePicker: true,
|
|
73
74
|
VisuallyHidden: true
|
|
74
75
|
};
|
|
75
|
-
exports.visuallyHidden = exports.useTextContent = exports.useSelect = exports.useMultiselect = exports.toast = exports.theme = exports.sproutLightTheme = exports.sproutDarkTheme = exports.focusRing = exports.disabled = exports.darkTheme = exports.VisuallyHidden = exports.Tooltip = exports.TokenInput = exports.Token = exports.ToggleHint = exports.ToastContainer = exports.ThemeProvider = exports.Textarea = exports.Text = exports.Tabs = exports.TableRowAccordion = exports.TableHeaderCell = exports.TableCell = exports.Table = exports.Switch = exports.Stack = exports.Skeleton = exports.SingleDatePicker = exports.Select = exports.SegmentedControl = exports.Radio = exports.Popout = exports.OverflowList = exports.Numeral = exports.Modal = exports.Message = exports.MenuItemContainer = exports.MenuButtonContext = exports.MenuButton = exports.Menu = exports.LoaderButton = exports.Loader = exports.ListboxButton = exports.Listbox = exports.Link = exports.Label = exports.KeyboardKey = exports.Input = exports.Indicator = exports.Image = exports.Icon = exports.FormField = exports.Fieldset = exports.EmptyState = exports.Drawer = exports.DateRangePicker = exports.Collapsible = exports.Checkbox = exports.ChartLegend = exports.CharacterCounter = exports.Card = exports.Button = exports.Breadcrumb = exports.Box = exports.Banner = exports.Badge = exports.Avatar = exports.Alert = void 0;
|
|
76
|
+
exports.visuallyHidden = exports.useTextContent = exports.useSelect = exports.useMultiselect = exports.useInteractiveColor = exports.toast = exports.theme = exports.sproutLightTheme = exports.sproutDarkTheme = exports.focusRing = exports.disabled = exports.darkTheme = exports.VisuallyHidden = exports.Tooltip = exports.TokenInput = exports.Token = exports.ToggleHint = exports.ToastContainer = exports.ThemeProvider = exports.Textarea = exports.Text = exports.Tabs = exports.TableRowAccordion = exports.TableHeaderCell = exports.TableCell = exports.Table = exports.Switch = exports.Stack = exports.Skeleton = exports.SingleDatePicker = exports.Select = exports.SegmentedControl = exports.Radio = exports.Popout = exports.OverflowList = exports.Numeral = exports.Modal = exports.Message = exports.MenuItemContainer = exports.MenuButtonContext = exports.MenuButton = exports.Menu = exports.LoaderButton = exports.Loader = exports.ListboxButton = exports.Listbox = exports.Link = exports.Label = exports.KeyboardKey = exports.Input = exports.Indicator = exports.Image = exports.Icon = exports.FormField = exports.Fieldset = exports.EmptyState = exports.Drawer = exports.DateRangePicker = exports.Collapsible = exports.Checkbox = exports.ChartLegend = exports.CharacterCounter = exports.Card = exports.Button = exports.Breadcrumb = exports.Box = exports.Banner = exports.Badge = exports.Avatar = exports.Alert = void 0;
|
|
76
77
|
|
|
77
78
|
var _systemProps = require("./systemProps");
|
|
78
79
|
|
|
@@ -95,6 +96,10 @@ exports.useSelect = _hooks.useSelect;
|
|
|
95
96
|
exports.useMultiselect = _hooks.useMultiselect;
|
|
96
97
|
exports.useTextContent = _hooks.useTextContent;
|
|
97
98
|
|
|
99
|
+
var _useInteractiveColor = require("./utils/useInteractiveColor");
|
|
100
|
+
|
|
101
|
+
exports.useInteractiveColor = _useInteractiveColor.useInteractiveColor;
|
|
102
|
+
|
|
98
103
|
var _theme = _interopRequireDefault(require("./themes/light/theme"));
|
|
99
104
|
|
|
100
105
|
exports.theme = _theme.default;
|
|
@@ -15,8 +15,6 @@ var _decorativePalettes = require("./decorative-palettes");
|
|
|
15
15
|
|
|
16
16
|
var _polished = require("polished");
|
|
17
17
|
|
|
18
|
-
var _interact = _interopRequireDefault(require("../utils/interact"));
|
|
19
|
-
|
|
20
18
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
19
|
|
|
22
20
|
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
@@ -234,9 +232,6 @@ var colors = _extends({}, _theme.default.colors, {
|
|
|
234
232
|
}, _datavizPalette.datavizPalette);
|
|
235
233
|
|
|
236
234
|
var darkTheme = _extends({}, _theme.default, {
|
|
237
|
-
utils: {
|
|
238
|
-
interact: (0, _interact.default)(MODE)
|
|
239
|
-
},
|
|
240
235
|
colors: colors,
|
|
241
236
|
shadows: shadows,
|
|
242
237
|
mode: MODE
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
|
-
exports.navigation = exports.default = exports.datePicker = void 0;
|
|
4
|
+
exports.navigation = exports.default = exports.datePicker = exports.analytics = void 0;
|
|
5
5
|
|
|
6
6
|
var _theme = _interopRequireDefault(require("../../../dark/theme"));
|
|
7
7
|
|
|
@@ -49,11 +49,20 @@ var datePicker = {
|
|
|
49
49
|
}
|
|
50
50
|
};
|
|
51
51
|
exports.datePicker = datePicker;
|
|
52
|
+
var analytics = {
|
|
53
|
+
trend: {
|
|
54
|
+
positive: _theme.default.colors.teal[500],
|
|
55
|
+
neutral: _theme.default.colors.neutral[100],
|
|
56
|
+
negative: _theme.default.colors.neutral[100]
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
exports.analytics = analytics;
|
|
52
60
|
|
|
53
61
|
var darkTheme = _extends({}, _theme.default, {
|
|
54
62
|
colors: _extends({}, _theme.default.colors, {
|
|
55
63
|
navigation: navigation,
|
|
56
|
-
datePicker: datePicker
|
|
64
|
+
datePicker: datePicker,
|
|
65
|
+
analytics: analytics
|
|
57
66
|
})
|
|
58
67
|
});
|
|
59
68
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
|
-
exports.navigation = exports.default = exports.datePicker = void 0;
|
|
4
|
+
exports.navigation = exports.default = exports.datePicker = exports.analytics = void 0;
|
|
5
5
|
|
|
6
6
|
var _theme = _interopRequireDefault(require("../../../light/theme"));
|
|
7
7
|
|
|
@@ -49,11 +49,20 @@ var datePicker = {
|
|
|
49
49
|
}
|
|
50
50
|
};
|
|
51
51
|
exports.datePicker = datePicker;
|
|
52
|
+
var analytics = {
|
|
53
|
+
trend: {
|
|
54
|
+
positive: _theme.default.colors.teal[800],
|
|
55
|
+
neutral: _theme.default.colors.neutral[800],
|
|
56
|
+
negative: _theme.default.colors.neutral[800]
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
exports.analytics = analytics;
|
|
52
60
|
|
|
53
61
|
var lightTheme = _extends({}, _theme.default, {
|
|
54
62
|
colors: _extends({}, _theme.default.colors, {
|
|
55
63
|
navigation: navigation,
|
|
56
|
-
datePicker: datePicker
|
|
64
|
+
datePicker: datePicker,
|
|
65
|
+
analytics: analytics
|
|
57
66
|
})
|
|
58
67
|
});
|
|
59
68
|
|
|
@@ -25,8 +25,6 @@ var _seedsBorder = _interopRequireDefault(require("@sproutsocial/seeds-border"))
|
|
|
25
25
|
|
|
26
26
|
var _polished = require("polished");
|
|
27
27
|
|
|
28
|
-
var _interact = _interopRequireDefault(require("../utils/interact"));
|
|
29
|
-
|
|
30
28
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
31
29
|
|
|
32
30
|
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
@@ -338,9 +336,6 @@ var duration = {
|
|
|
338
336
|
};
|
|
339
337
|
exports.duration = duration;
|
|
340
338
|
var theme = {
|
|
341
|
-
utils: {
|
|
342
|
-
interact: (0, _interact.default)(MODE)
|
|
343
|
-
},
|
|
344
339
|
breakpoints: breakpoints,
|
|
345
340
|
colors: colors,
|
|
346
341
|
typography: _extends({}, typography, {
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.useInteractiveColor = void 0;
|
|
5
|
+
|
|
6
|
+
var _polished = require("polished");
|
|
7
|
+
|
|
8
|
+
var _styledComponents = require("styled-components");
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* The useInteractiveColor hook has context of theme mode (light or dark)
|
|
12
|
+
* and can be used to lighten or darken a color dynamically
|
|
13
|
+
*
|
|
14
|
+
* note: colors are limited to our theme colors
|
|
15
|
+
*/
|
|
16
|
+
var useInteractiveColor = function useInteractiveColor(themeColor) {
|
|
17
|
+
// Throw error if used outside of a ThemeProvider (styled-components)
|
|
18
|
+
if (!(0, _styledComponents.useTheme)()) {
|
|
19
|
+
throw new Error("useInteractiveColor() must be used within a Styled Components ThemeProvider");
|
|
20
|
+
} // Get the current theme mode ie. 'light' or 'dark'
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
var themeMode = (0, _styledComponents.useTheme)().mode; // If the theme mode is dark, return a lightened version of the themeValue
|
|
24
|
+
|
|
25
|
+
if (themeMode === "dark") {
|
|
26
|
+
return (0, _polished.lighten)(0.2, themeColor);
|
|
27
|
+
} else {
|
|
28
|
+
// If the theme mode is light, return a darkened version of the themeValue
|
|
29
|
+
return (0, _polished.darken)(0.2, themeColor);
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
exports.useInteractiveColor = useInteractiveColor;
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
$theme: (
|
|
2
2
|
__esModule: true,
|
|
3
|
+
analytics: (
|
|
4
|
+
trend: (
|
|
5
|
+
positive: #08c4b2,
|
|
6
|
+
neutral: #f3f4f4,
|
|
7
|
+
negative: #f3f4f4
|
|
8
|
+
)
|
|
9
|
+
),
|
|
3
10
|
datePicker: (
|
|
4
11
|
comparison: (
|
|
5
12
|
background: (
|
|
@@ -11,9 +18,6 @@ $theme: (
|
|
|
11
18
|
)
|
|
12
19
|
),
|
|
13
20
|
default: (
|
|
14
|
-
utils: (
|
|
15
|
-
|
|
16
|
-
),
|
|
17
21
|
breakpoints: (900px, 1200px, 1500px, 1800px),
|
|
18
22
|
colors: (
|
|
19
23
|
app: (
|
|
@@ -478,6 +482,13 @@ $theme: (
|
|
|
478
482
|
base: #364141
|
|
479
483
|
)
|
|
480
484
|
)
|
|
485
|
+
),
|
|
486
|
+
analytics: (
|
|
487
|
+
trend: (
|
|
488
|
+
positive: #08c4b2,
|
|
489
|
+
neutral: #f3f4f4,
|
|
490
|
+
negative: #f3f4f4
|
|
491
|
+
)
|
|
481
492
|
)
|
|
482
493
|
),
|
|
483
494
|
typography: (
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
$theme: (
|
|
2
2
|
__esModule: true,
|
|
3
|
+
analytics: (
|
|
4
|
+
trend: (
|
|
5
|
+
positive: #067c7c,
|
|
6
|
+
neutral: #364141,
|
|
7
|
+
negative: #364141
|
|
8
|
+
)
|
|
9
|
+
),
|
|
3
10
|
datePicker: (
|
|
4
11
|
comparison: (
|
|
5
12
|
background: (
|
|
@@ -11,9 +18,6 @@ $theme: (
|
|
|
11
18
|
)
|
|
12
19
|
),
|
|
13
20
|
default: (
|
|
14
|
-
utils: (
|
|
15
|
-
|
|
16
|
-
),
|
|
17
21
|
breakpoints: (900px, 1200px, 1500px, 1800px),
|
|
18
22
|
colors: (
|
|
19
23
|
app: (
|
|
@@ -478,6 +482,13 @@ $theme: (
|
|
|
478
482
|
base: #364141
|
|
479
483
|
)
|
|
480
484
|
)
|
|
485
|
+
),
|
|
486
|
+
analytics: (
|
|
487
|
+
trend: (
|
|
488
|
+
positive: #067c7c,
|
|
489
|
+
neutral: #364141,
|
|
490
|
+
negative: #364141
|
|
491
|
+
)
|
|
481
492
|
)
|
|
482
493
|
),
|
|
483
494
|
typography: (
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
var _excluded = ["href", "appearance", "active", "disabled", "external", "children", "size", "innerRef", "onClick", "title", "qa", "as", "ariaLabel"];
|
|
2
|
+
|
|
3
|
+
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
4
|
+
|
|
5
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
6
|
+
|
|
7
|
+
import * as React from "react";
|
|
8
|
+
import Container from "./styles";
|
|
9
|
+
|
|
10
|
+
var Button = function Button(_ref) {
|
|
11
|
+
var href = _ref.href,
|
|
12
|
+
_ref$appearance = _ref.appearance,
|
|
13
|
+
appearance = _ref$appearance === void 0 ? "unstyled" : _ref$appearance,
|
|
14
|
+
_ref$active = _ref.active,
|
|
15
|
+
active = _ref$active === void 0 ? false : _ref$active,
|
|
16
|
+
disabled = _ref.disabled,
|
|
17
|
+
external = _ref.external,
|
|
18
|
+
children = _ref.children,
|
|
19
|
+
_ref$size = _ref.size,
|
|
20
|
+
size = _ref$size === void 0 ? "default" : _ref$size,
|
|
21
|
+
innerRef = _ref.innerRef,
|
|
22
|
+
onClick = _ref.onClick,
|
|
23
|
+
title = _ref.title,
|
|
24
|
+
_ref$qa = _ref.qa,
|
|
25
|
+
qa = _ref$qa === void 0 ? {} : _ref$qa,
|
|
26
|
+
as = _ref.as,
|
|
27
|
+
ariaLabel = _ref.ariaLabel,
|
|
28
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
29
|
+
|
|
30
|
+
if (!href && external) {
|
|
31
|
+
console.warn("Warning: external prop cannot be set without a href declaration");
|
|
32
|
+
} // plans to properly deprecate captured in DS-1096
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
var appearanceCheck = appearance === "default" ? "unstyled" : appearance;
|
|
36
|
+
return /*#__PURE__*/React.createElement(Container, _extends({
|
|
37
|
+
title: title,
|
|
38
|
+
active: active,
|
|
39
|
+
href: href,
|
|
40
|
+
target: external ? "_blank" : undefined,
|
|
41
|
+
rel: external ? "noopener noreferrer" : undefined,
|
|
42
|
+
as: as || (href ? "a" : "button"),
|
|
43
|
+
type: href ? undefined : "button",
|
|
44
|
+
"aria-disabled": disabled ? disabled : undefined,
|
|
45
|
+
disabled: disabled,
|
|
46
|
+
buttonSize: size,
|
|
47
|
+
appearance: appearanceCheck,
|
|
48
|
+
ref: innerRef,
|
|
49
|
+
onClick: onClick,
|
|
50
|
+
"data-qa-button": title || "",
|
|
51
|
+
"data-qa-button-isdisabled": disabled === true,
|
|
52
|
+
"aria-label": ariaLabel
|
|
53
|
+
}, qa, rest), children);
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
Button.displayName = "Button";
|
|
57
|
+
export default Button;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import styled, { css } from "styled-components";
|
|
2
|
+
import { COMMON, LAYOUT } from "../utils/system-props";
|
|
3
|
+
import { focusRing, disabled, pill } from "../utils/mixins";
|
|
4
|
+
import Icon from "../Icon/styles";
|
|
5
|
+
var Container = styled.button.withConfig({
|
|
6
|
+
displayName: "styles__Container",
|
|
7
|
+
componentId: "sc-1juy94s-0"
|
|
8
|
+
})(["display:inline-block;box-sizing:border-box;text-align:center;font-family:", ";border:1px solid ", ";border-radius:", ";border-style:", ";background:", ";color:", ";cursor:pointer;text-decoration:none;line-height:16px;white-space:nowrap;font-weight:", ";transition:all ", " linear;margin:0;padding:", ";font-size:", ";&:visited{color:", ";}&:hover{color:", ";background:", ";text-decoration:none;box-shadow:", ";}&:active{color:", ";background:", ";transform:translateY(1px);}&:focus{", "}&:focus:active{box-shadow:none;}", " ", " ", " ", "{vertical-align:text-bottom;}", " ", ""], function (props) {
|
|
9
|
+
return props.theme.fontFamily;
|
|
10
|
+
}, function (props) {
|
|
11
|
+
return props.theme.colors.button[props.appearance].border.base;
|
|
12
|
+
}, function (props) {
|
|
13
|
+
return props.theme.radii[500];
|
|
14
|
+
}, function (props) {
|
|
15
|
+
return props.appearance === "placeholder" ? "dashed" : "solid";
|
|
16
|
+
}, function (props) {
|
|
17
|
+
return props.theme.colors.button[props.appearance].background.base;
|
|
18
|
+
}, function (props) {
|
|
19
|
+
return props.theme.colors.button[props.appearance].text.base;
|
|
20
|
+
}, function (props) {
|
|
21
|
+
return props.theme.fontWeights.bold;
|
|
22
|
+
}, function (props) {
|
|
23
|
+
return props.theme.duration.fast;
|
|
24
|
+
}, function (props) {
|
|
25
|
+
return props.buttonSize === "default" ? "" + props.theme.space[300] : "" + props.theme.space[350];
|
|
26
|
+
}, function (props) {
|
|
27
|
+
return props.buttonSize === "default" ? props.theme.typography[200].fontSize : props.theme.typography[300].fontSize;
|
|
28
|
+
}, function (props) {
|
|
29
|
+
return props.theme.colors.button[props.appearance].text.base;
|
|
30
|
+
}, function (props) {
|
|
31
|
+
return props.theme.colors.button[props.appearance].text.hover;
|
|
32
|
+
}, function (props) {
|
|
33
|
+
return props.theme.colors.button[props.appearance].background.hover;
|
|
34
|
+
}, function (props) {
|
|
35
|
+
return props.appearance === "placeholder" ? props.theme.shadows.low : "none";
|
|
36
|
+
}, function (props) {
|
|
37
|
+
return props.theme.colors.button[props.appearance].text.hover;
|
|
38
|
+
}, function (props) {
|
|
39
|
+
return props.theme.colors.button[props.appearance].background.active;
|
|
40
|
+
}, focusRing, function (props) {
|
|
41
|
+
return props.active && css(["color:", " !important;background:", " !important;"], props.theme.colors.button[props.appearance].text.hover, props.theme.colors.button[props.appearance].background.active);
|
|
42
|
+
}, function (props) {
|
|
43
|
+
return props.disabled && disabled;
|
|
44
|
+
}, function (props) {
|
|
45
|
+
return props.appearance === "pill" && css(["display:inline-flex;align-items:center;justify-content:center;mix-blend-mode:", ";", ""], props.theme.mode === "dark" ? "screen" : "multiply", pill);
|
|
46
|
+
}, Icon, LAYOUT, COMMON);
|
|
47
|
+
Container.displayName = "Button-Container";
|
|
48
|
+
export default Container; //${props.theme.mode === "dark" ? "screen" : "multiply"}
|
package/lib/Input/index.js
CHANGED
|
@@ -14,12 +14,13 @@ import Button from "../Button";
|
|
|
14
14
|
import Icon from "../Icon";
|
|
15
15
|
import styled from "styled-components";
|
|
16
16
|
import { mergeRefs } from "../utils";
|
|
17
|
+
import { useInteractiveColor } from "../utils/useInteractiveColor";
|
|
17
18
|
var InputContext = /*#__PURE__*/React.createContext({});
|
|
18
19
|
var StyledButton = styled(Button).withConfig({
|
|
19
20
|
displayName: "Input__StyledButton",
|
|
20
21
|
componentId: "sc-1ck1dnm-0"
|
|
21
22
|
})(["&:hover,&:active{color:", ";}"], function (props) {
|
|
22
|
-
return
|
|
23
|
+
return useInteractiveColor(props.theme.colors.icon.base);
|
|
23
24
|
});
|
|
24
25
|
|
|
25
26
|
var ClearButton = function ClearButton() {
|
package/lib/Token/styles.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import styled, { css } from "styled-components";
|
|
2
2
|
import { COMMON } from "../utils/system-props";
|
|
3
3
|
import { focusRing } from "../utils/mixins";
|
|
4
|
+
import { useInteractiveColor } from "../utils/useInteractiveColor";
|
|
4
5
|
var Container = styled.button.withConfig({
|
|
5
6
|
displayName: "styles__Container",
|
|
6
7
|
componentId: "sc-nyn5zy-0"
|
|
@@ -8,13 +9,13 @@ var Container = styled.button.withConfig({
|
|
|
8
9
|
var theme = _ref.theme;
|
|
9
10
|
return css(["", " font-family:", ";font-weight:", ";border:1px solid ", ";border-radius:", ";color:", ";background:", ";padding:", " ", ";transition:all ", " ", ";"], theme.typography[200], theme.fontFamily, theme.fontWeights.normal, theme.colors.container.border.base, theme.radii[500], theme.colors.text.body, theme.colors.container.background.base, theme.space[200], theme.space[300], theme.duration.fast, theme.easing.ease_inout);
|
|
10
11
|
}, focusRing, function (_ref2) {
|
|
11
|
-
var
|
|
12
|
-
|
|
13
|
-
return
|
|
12
|
+
var closeable = _ref2.closeable,
|
|
13
|
+
theme = _ref2.theme;
|
|
14
|
+
return closeable && css(["cursor:pointer;&:hover,&:active{box-shadow:", ";border:1px solid ", ";}"], theme.shadows.low, useInteractiveColor(theme.colors.container.border.base));
|
|
14
15
|
}, function (_ref3) {
|
|
15
|
-
var
|
|
16
|
-
|
|
17
|
-
return
|
|
16
|
+
var theme = _ref3.theme,
|
|
17
|
+
palette = _ref3.palette;
|
|
18
|
+
return palette === "blue" && css(["color:", ";background:", ";border:1px solid ", ";&:hover,&:active{cursor:pointer;box-shadow:", ";border:1px solid ", ";}"], theme.colors.text.body, theme.colors.container.background.decorative.blue, theme.colors.container.border.decorative.blue, theme.shadows.low, useInteractiveColor(theme.colors.container.border.decorative.blue));
|
|
18
19
|
}, function (_ref4) {
|
|
19
20
|
var disabled = _ref4.disabled,
|
|
20
21
|
theme = _ref4.theme;
|
|
@@ -22,6 +23,6 @@ var Container = styled.button.withConfig({
|
|
|
22
23
|
}, function (_ref5) {
|
|
23
24
|
var valid = _ref5.valid,
|
|
24
25
|
theme = _ref5.theme;
|
|
25
|
-
return !valid && css(["color:", ";background:", ";border:1px solid ", ";&:hover{box-shadow:", ";border:1px solid ", ";}"], theme.colors.text.error, theme.colors.container.background.error, theme.colors.container.border.error, theme.shadows.low,
|
|
26
|
+
return !valid && css(["color:", ";background:", ";border:1px solid ", ";&:hover{box-shadow:", ";border:1px solid ", ";}"], theme.colors.text.error, theme.colors.container.background.error, theme.colors.container.border.error, theme.shadows.low, useInteractiveColor(theme.colors.container.border.error));
|
|
26
27
|
}, COMMON);
|
|
27
28
|
export default Container;
|
package/lib/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export * from "./systemProps";
|
|
2
2
|
export { visuallyHidden, focusRing, disabled } from "./utils/mixins";
|
|
3
3
|
export { useSelect, useMultiselect, useTextContent } from "./utils/hooks";
|
|
4
|
+
export { useInteractiveColor } from "./utils/useInteractiveColor";
|
|
4
5
|
export { default as theme } from "./themes/light/theme";
|
|
5
6
|
export { default as darkTheme } from "./themes/dark/theme";
|
|
6
7
|
export { sproutLightTheme, sproutDarkTheme } from "./themes/extendedThemes/sproutTheme";
|