@sproutsocial/racine 11.7.0 → 11.9.0-typescript.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 +25 -0
- package/__flow__/Button/{index.js → index.tsx} +20 -21
- package/__flow__/Button/{styles.js → styles.ts} +1 -1
- package/__flow__/Checkbox/index.stories.js +73 -56
- package/__flow__/Checkbox/styles.js +75 -75
- package/__flow__/Collapsible/index.js +3 -2
- package/__flow__/EnumIconNames.js +1 -1
- package/__flow__/Icon/index.stories.js +41 -36
- package/__flow__/IconViewBoxes.js +1 -1
- package/__flow__/Image/index.js +10 -2
- package/__flow__/Input/index.js +47 -23
- package/__flow__/Input/index.stories.js +59 -33
- package/__flow__/Input/index.test.js +20 -0
- package/__flow__/Input/styles.js +2 -2
- package/__flow__/Loader/index.stories.js +18 -14
- package/__flow__/Numeral/index.stories.js +109 -50
- package/__flow__/Radio/index.stories.js +41 -26
- package/__flow__/SegmentedControl/index.js +3 -2
- package/__flow__/Switch/index.stories.js +26 -18
- package/__flow__/TableCell/index.js +9 -2
- package/__flow__/ToggleHint/index.js +9 -2
- package/__flow__/systemProps/color.js +1 -2
- package/__flow__/utils/responsiveProps/index.test.js +10 -2
- package/commonjs/IconViewBoxes.js +2 -0
- package/commonjs/Input/index.js +42 -22
- package/commonjs/Input/styles.js +2 -2
- package/commonjs/include-icons.js +1 -1
- package/dist/iconList.js +1 -1
- package/dist/icons.svg +1 -1
- package/icons/help-alt.svg +3 -0
- package/icons/plug.svg +3 -0
- package/includeIcons.js +1 -1
- package/lib/IconViewBoxes.js +2 -0
- package/lib/Input/index.js +42 -22
- package/lib/Input/styles.js +2 -2
- package/lib/include-icons.js +1 -1
- package/package.json +6 -1
- package/commonjs/Button/index.js +0 -70
- package/commonjs/Button/styles.js +0 -66
- package/lib/Button/index.js +0 -57
- package/lib/Button/styles.js +0 -48
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sproutsocial/racine",
|
|
3
|
-
"version": "11.
|
|
3
|
+
"version": "11.9.0-typescript.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"files": [
|
|
6
6
|
"__flow__",
|
|
@@ -66,6 +66,10 @@
|
|
|
66
66
|
},
|
|
67
67
|
"dependencies": {
|
|
68
68
|
"@styled-system/theme-get": "^5.1.2",
|
|
69
|
+
"@types/jest": "^27.5.1",
|
|
70
|
+
"@types/node": "^17.0.38",
|
|
71
|
+
"@types/react": "^18.0.10",
|
|
72
|
+
"@types/react-dom": "^18.0.5",
|
|
69
73
|
"classnames": "^2.2.6",
|
|
70
74
|
"lodash.curry": "^4.1.1",
|
|
71
75
|
"lodash.uniqueid": "^4.0.1",
|
|
@@ -81,6 +85,7 @@
|
|
|
81
85
|
"react-virtualized": "9.18.5",
|
|
82
86
|
"scroll-into-view-if-needed": "1.1.0",
|
|
83
87
|
"styled-system": "^5.1.5",
|
|
88
|
+
"typescript": "^4.7.2",
|
|
84
89
|
"use-measure": "^0.2.2"
|
|
85
90
|
},
|
|
86
91
|
"devDependencies": {
|
package/commonjs/Button/index.js
DELETED
|
@@ -1,70 +0,0 @@
|
|
|
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;
|
|
@@ -1,66 +0,0 @@
|
|
|
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/lib/Button/index.js
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
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;
|
package/lib/Button/styles.js
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
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"}
|