@sproutsocial/racine 12.21.0 → 12.21.2

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 CHANGED
@@ -1,5 +1,17 @@
1
1
  # Change Log
2
2
 
3
+ ## 12.21.2
4
+
5
+ ### Patch Changes
6
+
7
+ - 8461abb8: Fixed the Checkbox SVG, which became broken during the addition of new prettier rules.
8
+
9
+ ## 12.21.1
10
+
11
+ ### Patch Changes
12
+
13
+ - e0e4fc78: Storybook addon-essentials has been moved to devDependencies rather than dependencies since it is only used for development and isn't required in production.
14
+
3
15
  ## 12.21.0
4
16
 
5
17
  ### Minor Changes
@@ -1,4 +1,6 @@
1
1
  //@flow
2
+ import * as React from 'react';
3
+ import {renderToStaticMarkup} from 'react-dom/server';
2
4
  import styled, {css, type StyledComponent} from 'styled-components';
3
5
  import {COMMON} from '../utils/system-props';
4
6
  import {focusRing, pill} from '../utils/mixins';
@@ -164,14 +166,22 @@ export const LabelText = styled<typeof Text, TypeTheme, any>(Text)`
164
166
 
165
167
  LabelText.displayName = 'LabelText';
166
168
 
167
- const checkSVG = (color) =>
168
- `<svg width='14' height='14' xmlns='http://www.w3.org/2000/svg'><path d='M5.378 11.37L2 7.59l1.438-1.286L5.374 8.47l5.185-5.84L12 3.91l-6.622 7.46' fill='${color}'/></svg>`;
169
-
170
- const indeterminateSVG = (color) =>
171
- `<svg width='14' height='14' xmlns='http://www.w3.org/2000/svg'><rect width='10' height='2' x='2' y='6' rx='1' ry='1' fill='${color}'/></svg>`;
169
+ const checkSVG = (color) => (
170
+ <svg width="14" height="14" xmlns="http://www.w3.org/2000/svg">
171
+ <path
172
+ d="M5.378 11.37L2 7.59l1.438-1.286L5.374 8.47l5.185-5.84L12 3.91l-6.622 7.46"
173
+ fill={color}
174
+ />
175
+ </svg>
176
+ );
177
+ const indeterminateSVG = (color) => (
178
+ <svg width="14" height="14" xmlns="http://www.w3.org/2000/svg">
179
+ <rect width="10" height="2" x="2" y="6" rx="1" ry="1" fill={color} />
180
+ </svg>
181
+ );
172
182
 
173
183
  const getIcon = (type, color) => {
174
- const escapedColor = color.replace('#', '%23');
184
+ const escapedColor = encodeURIComponent(color);
175
185
  const icon =
176
186
  type === 'indeterminate'
177
187
  ? indeterminateSVG(escapedColor)
@@ -191,12 +201,13 @@ export const CheckboxContainer: StyledComponent<any, TypeTheme, *> =
191
201
  @supports (-webkit-appearance: none) {
192
202
  &:before {
193
203
  /* stylelint-disable */
194
- content: url('data:image/svg+xml;utf8,${getIcon(
195
- props.indeterminate ? 'indeterminate' : 'check',
196
-
197
- props.checked
198
- ? props.theme.colors.form.background.base
199
- : props.theme.colors.form.border.base
204
+ content: url('data:image/svg+xml;utf8,${renderToStaticMarkup(
205
+ getIcon(
206
+ props.indeterminate ? 'indeterminate' : 'check',
207
+ props.checked
208
+ ? props.theme.colors.form.background.base
209
+ : props.theme.colors.form.border.base
210
+ )
200
211
  )}');
201
212
  opacity: ${props.checked ? 1 : 0};
202
213
  position: absolute;
@@ -2,6 +2,8 @@
2
2
 
3
3
  exports.__esModule = true;
4
4
  exports.default = exports.PillInput = exports.LabelText = exports.InputWrapper = exports.CheckboxContainer = exports.CheckboxBox = exports.CheckIcon = void 0;
5
+ var React = _interopRequireWildcard(require("react"));
6
+ var _server = require("react-dom/server");
5
7
  var _styledComponents = _interopRequireWildcard(require("styled-components"));
6
8
  var _systemProps = require("../utils/system-props");
7
9
  var _mixins = require("../utils/mixins");
@@ -98,13 +100,32 @@ var LabelText = (0, _styledComponents.default)(_Text.default).withConfig({
98
100
  exports.LabelText = LabelText;
99
101
  LabelText.displayName = 'LabelText';
100
102
  var checkSVG = function checkSVG(color) {
101
- return "<svg width='14' height='14' xmlns='http://www.w3.org/2000/svg'><path d='M5.378 11.37L2 7.59l1.438-1.286L5.374 8.47l5.185-5.84L12 3.91l-6.622 7.46' fill='" + color + "'/></svg>";
103
+ return /*#__PURE__*/React.createElement("svg", {
104
+ width: "14",
105
+ height: "14",
106
+ xmlns: "http://www.w3.org/2000/svg"
107
+ }, /*#__PURE__*/React.createElement("path", {
108
+ d: "M5.378 11.37L2 7.59l1.438-1.286L5.374 8.47l5.185-5.84L12 3.91l-6.622 7.46",
109
+ fill: color
110
+ }));
102
111
  };
103
112
  var indeterminateSVG = function indeterminateSVG(color) {
104
- return "<svg width='14' height='14' xmlns='http://www.w3.org/2000/svg'><rect width='10' height='2' x='2' y='6' rx='1' ry='1' fill='" + color + "'/></svg>";
113
+ return /*#__PURE__*/React.createElement("svg", {
114
+ width: "14",
115
+ height: "14",
116
+ xmlns: "http://www.w3.org/2000/svg"
117
+ }, /*#__PURE__*/React.createElement("rect", {
118
+ width: "10",
119
+ height: "2",
120
+ x: "2",
121
+ y: "6",
122
+ rx: "1",
123
+ ry: "1",
124
+ fill: color
125
+ }));
105
126
  };
106
127
  var getIcon = function getIcon(type, color) {
107
- var escapedColor = color.replace('#', '%23');
128
+ var escapedColor = encodeURIComponent(color);
108
129
  var icon = type === 'indeterminate' ? indeterminateSVG(escapedColor) : checkSVG(escapedColor);
109
130
  return icon;
110
131
  };
@@ -112,7 +133,7 @@ var CheckboxContainer = _styledComponents.default.span.withConfig({
112
133
  displayName: "styles__CheckboxContainer",
113
134
  componentId: "sc-59uw8o-6"
114
135
  })(function (props) {
115
- return (0, _styledComponents.css)(["display:inline-flex;align-items:center;box-sizing:border-box;position:relative;transition:all ", " ", ";@supports (-webkit-appearance:none){&:before{content:url('data:image/svg+xml;utf8,", "');opacity:", ";position:absolute;width:", ";height:", ";text-align:center;transform:translateY(1px);line-height:1;margin:auto;pointer-events:none;transition:", " ", ";}&:hover:before{opacity:", ";}", " input[type='checkbox']{box-sizing:border-box;appearance:none;margin:0;padding:0;width:", ";height:", ";border:1px solid ", ";border-radius:4px;background-color:", ";transition:all ", " ", ";cursor:", ";flex-shrink:0;&:not(:checked){", "}&:checked{border-color:", ";background-color:", ";}", " &:focus{", "}}}", ""], props.theme.duration.fast, props.theme.easing.ease_in, getIcon(props.indeterminate ? 'indeterminate' : 'check', props.checked ? props.theme.colors.form.background.base : props.theme.colors.form.border.base), props.checked ? 1 : 0, props.theme.space[400], props.theme.space[400], props.theme.duration.fast, props.theme.easing.ease_inout, props.disabled && !props.checked ? 0 : 1, props.disabled && (0, _styledComponents.css)(["opacity:0.4;"]), props.theme.space[400], props.theme.space[400], props.theme.colors.form.border.base, props.theme.colors.form.background.base, props.theme.duration.fast, props.theme.easing.ease_in, props.disabled ? 'not-allowed' : 'pointer', !props.indeterminate && (0, _styledComponents.css)(["border-color:", " !important;background-color:", ";"], props.theme.colors.neutral[300], props.theme.colors.form.background.base), props.theme.colors.form.border.selected, props.theme.colors.form.background.selected, props.indeterminate && props.checked && (0, _styledComponents.css)(["border-color:", " !important;background-color:", " !important;"], props.theme.colors.form.border.selected, props.theme.colors.form.background.selected), _mixins.focusRing, _systemProps.COMMON);
136
+ return (0, _styledComponents.css)(["display:inline-flex;align-items:center;box-sizing:border-box;position:relative;transition:all ", " ", ";@supports (-webkit-appearance:none){&:before{content:url('data:image/svg+xml;utf8,", "');opacity:", ";position:absolute;width:", ";height:", ";text-align:center;transform:translateY(1px);line-height:1;margin:auto;pointer-events:none;transition:", " ", ";}&:hover:before{opacity:", ";}", " input[type='checkbox']{box-sizing:border-box;appearance:none;margin:0;padding:0;width:", ";height:", ";border:1px solid ", ";border-radius:4px;background-color:", ";transition:all ", " ", ";cursor:", ";flex-shrink:0;&:not(:checked){", "}&:checked{border-color:", ";background-color:", ";}", " &:focus{", "}}}", ""], props.theme.duration.fast, props.theme.easing.ease_in, (0, _server.renderToStaticMarkup)(getIcon(props.indeterminate ? 'indeterminate' : 'check', props.checked ? props.theme.colors.form.background.base : props.theme.colors.form.border.base)), props.checked ? 1 : 0, props.theme.space[400], props.theme.space[400], props.theme.duration.fast, props.theme.easing.ease_inout, props.disabled && !props.checked ? 0 : 1, props.disabled && (0, _styledComponents.css)(["opacity:0.4;"]), props.theme.space[400], props.theme.space[400], props.theme.colors.form.border.base, props.theme.colors.form.background.base, props.theme.duration.fast, props.theme.easing.ease_in, props.disabled ? 'not-allowed' : 'pointer', !props.indeterminate && (0, _styledComponents.css)(["border-color:", " !important;background-color:", ";"], props.theme.colors.neutral[300], props.theme.colors.form.background.base), props.theme.colors.form.border.selected, props.theme.colors.form.background.selected, props.indeterminate && props.checked && (0, _styledComponents.css)(["border-color:", " !important;background-color:", " !important;"], props.theme.colors.form.border.selected, props.theme.colors.form.background.selected), _mixins.focusRing, _systemProps.COMMON);
116
137
  });
117
138
  exports.CheckboxContainer = CheckboxContainer;
118
139
  var _default = Container;
@@ -1,4 +1,6 @@
1
1
 
2
+ import * as React from 'react';
3
+ import { renderToStaticMarkup } from 'react-dom/server';
2
4
  import styled, { css } from 'styled-components';
3
5
  import { COMMON } from '../utils/system-props';
4
6
  import { focusRing, pill } from '../utils/mixins';
@@ -86,13 +88,32 @@ export var LabelText = styled(Text).withConfig({
86
88
  });
87
89
  LabelText.displayName = 'LabelText';
88
90
  var checkSVG = function checkSVG(color) {
89
- return "<svg width='14' height='14' xmlns='http://www.w3.org/2000/svg'><path d='M5.378 11.37L2 7.59l1.438-1.286L5.374 8.47l5.185-5.84L12 3.91l-6.622 7.46' fill='" + color + "'/></svg>";
91
+ return /*#__PURE__*/React.createElement("svg", {
92
+ width: "14",
93
+ height: "14",
94
+ xmlns: "http://www.w3.org/2000/svg"
95
+ }, /*#__PURE__*/React.createElement("path", {
96
+ d: "M5.378 11.37L2 7.59l1.438-1.286L5.374 8.47l5.185-5.84L12 3.91l-6.622 7.46",
97
+ fill: color
98
+ }));
90
99
  };
91
100
  var indeterminateSVG = function indeterminateSVG(color) {
92
- return "<svg width='14' height='14' xmlns='http://www.w3.org/2000/svg'><rect width='10' height='2' x='2' y='6' rx='1' ry='1' fill='" + color + "'/></svg>";
101
+ return /*#__PURE__*/React.createElement("svg", {
102
+ width: "14",
103
+ height: "14",
104
+ xmlns: "http://www.w3.org/2000/svg"
105
+ }, /*#__PURE__*/React.createElement("rect", {
106
+ width: "10",
107
+ height: "2",
108
+ x: "2",
109
+ y: "6",
110
+ rx: "1",
111
+ ry: "1",
112
+ fill: color
113
+ }));
93
114
  };
94
115
  var getIcon = function getIcon(type, color) {
95
- var escapedColor = color.replace('#', '%23');
116
+ var escapedColor = encodeURIComponent(color);
96
117
  var icon = type === 'indeterminate' ? indeterminateSVG(escapedColor) : checkSVG(escapedColor);
97
118
  return icon;
98
119
  };
@@ -100,6 +121,6 @@ export var CheckboxContainer = styled.span.withConfig({
100
121
  displayName: "styles__CheckboxContainer",
101
122
  componentId: "sc-59uw8o-6"
102
123
  })(function (props) {
103
- return css(["display:inline-flex;align-items:center;box-sizing:border-box;position:relative;transition:all ", " ", ";@supports (-webkit-appearance:none){&:before{content:url('data:image/svg+xml;utf8,", "');opacity:", ";position:absolute;width:", ";height:", ";text-align:center;transform:translateY(1px);line-height:1;margin:auto;pointer-events:none;transition:", " ", ";}&:hover:before{opacity:", ";}", " input[type='checkbox']{box-sizing:border-box;appearance:none;margin:0;padding:0;width:", ";height:", ";border:1px solid ", ";border-radius:4px;background-color:", ";transition:all ", " ", ";cursor:", ";flex-shrink:0;&:not(:checked){", "}&:checked{border-color:", ";background-color:", ";}", " &:focus{", "}}}", ""], props.theme.duration.fast, props.theme.easing.ease_in, getIcon(props.indeterminate ? 'indeterminate' : 'check', props.checked ? props.theme.colors.form.background.base : props.theme.colors.form.border.base), props.checked ? 1 : 0, props.theme.space[400], props.theme.space[400], props.theme.duration.fast, props.theme.easing.ease_inout, props.disabled && !props.checked ? 0 : 1, props.disabled && css(["opacity:0.4;"]), props.theme.space[400], props.theme.space[400], props.theme.colors.form.border.base, props.theme.colors.form.background.base, props.theme.duration.fast, props.theme.easing.ease_in, props.disabled ? 'not-allowed' : 'pointer', !props.indeterminate && css(["border-color:", " !important;background-color:", ";"], props.theme.colors.neutral[300], props.theme.colors.form.background.base), props.theme.colors.form.border.selected, props.theme.colors.form.background.selected, props.indeterminate && props.checked && css(["border-color:", " !important;background-color:", " !important;"], props.theme.colors.form.border.selected, props.theme.colors.form.background.selected), focusRing, COMMON);
124
+ return css(["display:inline-flex;align-items:center;box-sizing:border-box;position:relative;transition:all ", " ", ";@supports (-webkit-appearance:none){&:before{content:url('data:image/svg+xml;utf8,", "');opacity:", ";position:absolute;width:", ";height:", ";text-align:center;transform:translateY(1px);line-height:1;margin:auto;pointer-events:none;transition:", " ", ";}&:hover:before{opacity:", ";}", " input[type='checkbox']{box-sizing:border-box;appearance:none;margin:0;padding:0;width:", ";height:", ";border:1px solid ", ";border-radius:4px;background-color:", ";transition:all ", " ", ";cursor:", ";flex-shrink:0;&:not(:checked){", "}&:checked{border-color:", ";background-color:", ";}", " &:focus{", "}}}", ""], props.theme.duration.fast, props.theme.easing.ease_in, renderToStaticMarkup(getIcon(props.indeterminate ? 'indeterminate' : 'check', props.checked ? props.theme.colors.form.background.base : props.theme.colors.form.border.base)), props.checked ? 1 : 0, props.theme.space[400], props.theme.space[400], props.theme.duration.fast, props.theme.easing.ease_inout, props.disabled && !props.checked ? 0 : 1, props.disabled && css(["opacity:0.4;"]), props.theme.space[400], props.theme.space[400], props.theme.colors.form.border.base, props.theme.colors.form.background.base, props.theme.duration.fast, props.theme.easing.ease_in, props.disabled ? 'not-allowed' : 'pointer', !props.indeterminate && css(["border-color:", " !important;background-color:", ";"], props.theme.colors.neutral[300], props.theme.colors.form.background.base), props.theme.colors.form.border.selected, props.theme.colors.form.background.selected, props.indeterminate && props.checked && css(["border-color:", " !important;background-color:", " !important;"], props.theme.colors.form.border.selected, props.theme.colors.form.background.selected), focusRing, COMMON);
104
125
  });
105
126
  export default Container;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sproutsocial/racine",
3
- "version": "12.21.0",
3
+ "version": "12.21.2",
4
4
  "license": "MIT",
5
5
  "files": [
6
6
  "__flow__",
@@ -63,7 +63,6 @@
63
63
  ]
64
64
  },
65
65
  "dependencies": {
66
- "@storybook/addon-essentials": "^6.5.12",
67
66
  "@styled-system/theme-get": "^5.1.2",
68
67
  "classnames": "^2.2.6",
69
68
  "lodash.curry": "^4.1.1",
@@ -102,6 +101,7 @@
102
101
  "@storybook/addon-a11y": "^6.4.19",
103
102
  "@storybook/addon-actions": "^6.4.19",
104
103
  "@storybook/addon-controls": "^6.4.19",
104
+ "@storybook/addon-essentials": "^6.5.12",
105
105
  "@storybook/addon-storysource": "^6.4.19",
106
106
  "@storybook/addon-viewport": "^6.4.19",
107
107
  "@storybook/addons": "^6.4.19",