@elliemae/ds-system 2.4.1-rc.9 → 2.4.2-rc.1
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/cjs/globalStyles.js +2 -1
- package/cjs/index.js +2 -0
- package/cjs/th.js +44 -21
- package/cjs/utils.js +23 -1
- package/esm/globalStyles.js +2 -1
- package/esm/index.js +1 -1
- package/esm/th.js +44 -21
- package/esm/utils.js +24 -4
- package/package.json +2 -2
package/cjs/globalStyles.js
CHANGED
|
@@ -5,10 +5,11 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var _taggedTemplateLiteral = require('@babel/runtime/helpers/taggedTemplateLiteral');
|
|
6
6
|
require('polished');
|
|
7
7
|
require('lodash');
|
|
8
|
+
var styled_component = require('styled-components');
|
|
8
9
|
require('./theme.js');
|
|
9
10
|
require('core-js/modules/web.dom-collections.iterator.js');
|
|
10
11
|
require('react');
|
|
11
|
-
|
|
12
|
+
require('./th.js');
|
|
12
13
|
|
|
13
14
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
14
15
|
|
package/cjs/index.js
CHANGED
|
@@ -31,6 +31,7 @@ exports.toMobile = mobileUtilities.toMobile;
|
|
|
31
31
|
exports.useIsMobile = mobileUtilities.useIsMobile;
|
|
32
32
|
exports.active = utils.active;
|
|
33
33
|
exports.animation = utils.animation;
|
|
34
|
+
exports.backgroundColorSetter = utils.backgroundColorSetter;
|
|
34
35
|
exports.border = utils.border;
|
|
35
36
|
exports.boxShadow = utils.boxShadow;
|
|
36
37
|
exports.buttonLink = utils.buttonLink;
|
|
@@ -42,6 +43,7 @@ exports.fakeBorder = utils.fakeBorder;
|
|
|
42
43
|
exports.flexCenter = utils.flexCenter;
|
|
43
44
|
exports.focus = utils.focus;
|
|
44
45
|
exports.focusAfter = utils.focusAfter;
|
|
46
|
+
exports.hexToRgba = utils.hexToRgba;
|
|
45
47
|
exports.hover = utils.hover;
|
|
46
48
|
exports.iconColor = utils.iconColor;
|
|
47
49
|
exports.keyframes = utils.keyframes;
|
package/cjs/th.js
CHANGED
|
@@ -2,33 +2,56 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
+
require('core-js/modules/web.dom-collections.iterator.js');
|
|
5
6
|
require('core-js/modules/esnext.async-iterator.for-each.js');
|
|
6
7
|
require('core-js/modules/esnext.iterator.constructor.js');
|
|
7
8
|
require('core-js/modules/esnext.iterator.for-each.js');
|
|
9
|
+
var utils = require('./utils.js');
|
|
8
10
|
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
11
|
+
const colorGetter = value => _ref => {
|
|
12
|
+
let {
|
|
13
|
+
theme
|
|
14
|
+
} = _ref;
|
|
15
|
+
const colorValues = value.split('-');
|
|
16
|
+
if (colorValues.length === 1) return colorValues[0];
|
|
17
|
+
if (colorValues.length > 3) throw new Error('Invalid color value');
|
|
18
|
+
const [colorType, colorValue, alpha] = colorValues;
|
|
19
|
+
const themeColor = theme.colors[colorType][colorValue];
|
|
20
|
+
if (!themeColor) throw new Error('Invalid color value');
|
|
21
|
+
|
|
22
|
+
if (alpha) {
|
|
23
|
+
const alphaFloatingNumber = "0.".concat(alpha.slice(1));
|
|
24
|
+
return utils.hexToRgba(themeColor, alphaFloatingNumber);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
return themeColor;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
const genericGetter = property => function (value) {
|
|
31
|
+
let dfault = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
32
|
+
return _ref2 => {
|
|
33
|
+
var _ref3;
|
|
34
|
+
|
|
35
|
+
let {
|
|
36
|
+
theme
|
|
37
|
+
} = _ref2;
|
|
38
|
+
const parts = value.split('-');
|
|
39
|
+
let result = theme[property];
|
|
40
|
+
parts.forEach(part => {
|
|
41
|
+
if (result) result = result[part];
|
|
42
|
+
});
|
|
43
|
+
return (_ref3 = result) !== null && _ref3 !== void 0 ? _ref3 : dfault;
|
|
29
44
|
};
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
const th = property => {
|
|
48
|
+
switch (property) {
|
|
49
|
+
case 'colors':
|
|
50
|
+
return colorGetter;
|
|
30
51
|
|
|
31
|
-
|
|
52
|
+
default:
|
|
53
|
+
return genericGetter(property);
|
|
54
|
+
}
|
|
32
55
|
};
|
|
33
56
|
th.space = th('space');
|
|
34
57
|
th.fontSize = th('fontSizes');
|
package/cjs/utils.js
CHANGED
|
@@ -4,9 +4,10 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var polished = require('polished');
|
|
6
6
|
var lodash = require('lodash');
|
|
7
|
+
var styled_component = require('styled-components');
|
|
7
8
|
var theme = require('./theme.js');
|
|
8
9
|
var mobileUtilities = require('./mobileUtilities.js');
|
|
9
|
-
var
|
|
10
|
+
var th = require('./th.js');
|
|
10
11
|
|
|
11
12
|
/* eslint-disable no-shadow */
|
|
12
13
|
function truncate(width) {
|
|
@@ -134,6 +135,25 @@ const onlySafariAndFirefox = styles => styled_component.css(["@media not all and
|
|
|
134
135
|
const onlySafari = styles => "\n @media not all and (min-resolution: 0.001dpcm) {\n ".concat(styles, "\n }\n ");
|
|
135
136
|
const onlyFirefox = styles => "\n @media screen and (min--moz-device-pixel-ratio: 0) {\n ".concat(styles, "\n }\n ");
|
|
136
137
|
const safariAndFirefoxBold = color => "\n @media not all and (min-resolution: 0.001dpcm) {\n font-weight: 400;\n -webkit-font-smoothing: subpixel-antialiased;\n -webkit-text-stroke: 0.4px ".concat(color, ";\n }\n @media screen and (min--moz-device-pixel-ratio: 0) {\n font-weight: 400;\n -webkit-font-smoothing: subpixel-antialiased;\n -webkit-text-stroke: 0.4px ").concat(color, ";\n }\n");
|
|
138
|
+
const backgroundColorSetter = /*#__PURE__*/styled_component.css(["", "}"], _ref => {
|
|
139
|
+
let {
|
|
140
|
+
bg,
|
|
141
|
+
backgroundColor,
|
|
142
|
+
theme
|
|
143
|
+
} = _ref;
|
|
144
|
+
return bg || backgroundColor ? "background-color: ".concat(th.th.color(bg || backgroundColor, bg || backgroundColor)({
|
|
145
|
+
theme
|
|
146
|
+
}), ";") : "";
|
|
147
|
+
});
|
|
148
|
+
const hexToRgba = (hex, alpha) => {
|
|
149
|
+
const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
|
|
150
|
+
|
|
151
|
+
if (result) {
|
|
152
|
+
return "rgba(".concat(parseInt(result[1], 16), ", ").concat(parseInt(result[2], 16), ", ").concat(parseInt(result[3], 16), ", ").concat(alpha, ")");
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
return "";
|
|
156
|
+
};
|
|
137
157
|
|
|
138
158
|
Object.defineProperty(exports, 'rgba', {
|
|
139
159
|
enumerable: true,
|
|
@@ -161,6 +181,7 @@ Object.defineProperty(exports, 'withTheme', {
|
|
|
161
181
|
});
|
|
162
182
|
exports.active = active;
|
|
163
183
|
exports.animation = animation;
|
|
184
|
+
exports.backgroundColorSetter = backgroundColorSetter;
|
|
164
185
|
exports.border = border;
|
|
165
186
|
exports.boxShadow = boxShadow;
|
|
166
187
|
exports.buttonLink = buttonLink;
|
|
@@ -172,6 +193,7 @@ exports.fakeBorder = fakeBorder;
|
|
|
172
193
|
exports.flexCenter = flexCenter;
|
|
173
194
|
exports.focus = focus;
|
|
174
195
|
exports.focusAfter = focusAfter;
|
|
196
|
+
exports.hexToRgba = hexToRgba;
|
|
175
197
|
exports.hover = hover;
|
|
176
198
|
exports.iconColor = iconColor;
|
|
177
199
|
exports.keyframes = keyframes;
|
package/esm/globalStyles.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import _taggedTemplateLiteral from '@babel/runtime/helpers/esm/taggedTemplateLiteral';
|
|
2
2
|
import 'polished';
|
|
3
3
|
import 'lodash';
|
|
4
|
+
import { createGlobalStyle } from 'styled-components';
|
|
4
5
|
import './theme.js';
|
|
5
6
|
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
6
7
|
import 'react';
|
|
7
|
-
import
|
|
8
|
+
import './th.js';
|
|
8
9
|
|
|
9
10
|
var _templateObject;
|
|
10
11
|
const GlobalStyles = createGlobalStyle(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n :root, body {\n overscroll-behavior-y: none;\n\n font-size: ", ";\n\n @media(min-width: ", ") {\n font-size: ", ";\n }\n\n }\n"])), props => props.device === 'desktop' ? '13px' : '16px', _ref => {
|
package/esm/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { GlobalStyles } from './globalStyles.js';
|
|
2
2
|
export { fixSpace, fixSpaceGutter, mapGap, mapGrid, mapGutter, mapSpace, mapTemplateGrid, numbersToFr } from './spaceUtilities.js';
|
|
3
3
|
export { __UNSAFE_SPACE_TO_DIMSUM, isMobile, toMobile, useIsMobile } from './mobileUtilities.js';
|
|
4
|
-
export { active, animation, border, boxShadow, buttonLink, clearFocus, color, disabled, fakeActive, fakeBorder, flexCenter, focus, focusAfter, hover, iconColor, keyframes, onlyFirefox, onlySafari, onlySafariAndFirefox, safariAndFirefoxBold, textStyle, transition, truncate } from './utils.js';
|
|
4
|
+
export { active, animation, backgroundColorSetter, border, boxShadow, buttonLink, clearFocus, color, disabled, fakeActive, fakeBorder, flexCenter, focus, focusAfter, hexToRgba, hover, iconColor, keyframes, onlyFirefox, onlySafari, onlySafariAndFirefox, safariAndFirefoxBold, textStyle, transition, truncate } from './utils.js';
|
|
5
5
|
export { getNumberAndUnit, op } from './arithmetic.js';
|
|
6
6
|
export { th } from './th.js';
|
|
7
7
|
export { theme } from './theme.js';
|
package/esm/th.js
CHANGED
|
@@ -1,30 +1,53 @@
|
|
|
1
|
+
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
1
2
|
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
2
3
|
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
3
4
|
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
5
|
+
import { hexToRgba } from './utils.js';
|
|
4
6
|
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
7
|
+
const colorGetter = value => _ref => {
|
|
8
|
+
let {
|
|
9
|
+
theme
|
|
10
|
+
} = _ref;
|
|
11
|
+
const colorValues = value.split('-');
|
|
12
|
+
if (colorValues.length === 1) return colorValues[0];
|
|
13
|
+
if (colorValues.length > 3) throw new Error('Invalid color value');
|
|
14
|
+
const [colorType, colorValue, alpha] = colorValues;
|
|
15
|
+
const themeColor = theme.colors[colorType][colorValue];
|
|
16
|
+
if (!themeColor) throw new Error('Invalid color value');
|
|
17
|
+
|
|
18
|
+
if (alpha) {
|
|
19
|
+
const alphaFloatingNumber = "0.".concat(alpha.slice(1));
|
|
20
|
+
return hexToRgba(themeColor, alphaFloatingNumber);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
return themeColor;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const genericGetter = property => function (value) {
|
|
27
|
+
let dfault = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
28
|
+
return _ref2 => {
|
|
29
|
+
var _ref3;
|
|
30
|
+
|
|
31
|
+
let {
|
|
32
|
+
theme
|
|
33
|
+
} = _ref2;
|
|
34
|
+
const parts = value.split('-');
|
|
35
|
+
let result = theme[property];
|
|
36
|
+
parts.forEach(part => {
|
|
37
|
+
if (result) result = result[part];
|
|
38
|
+
});
|
|
39
|
+
return (_ref3 = result) !== null && _ref3 !== void 0 ? _ref3 : dfault;
|
|
25
40
|
};
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
const th = property => {
|
|
44
|
+
switch (property) {
|
|
45
|
+
case 'colors':
|
|
46
|
+
return colorGetter;
|
|
26
47
|
|
|
27
|
-
|
|
48
|
+
default:
|
|
49
|
+
return genericGetter(property);
|
|
50
|
+
}
|
|
28
51
|
};
|
|
29
52
|
th.space = th('space');
|
|
30
53
|
th.fontSize = th('fontSizes');
|
package/esm/utils.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { lighten } from 'polished';
|
|
2
2
|
export { rgba } from 'polished';
|
|
3
3
|
import { reduce } from 'lodash';
|
|
4
|
-
import { theme } from './theme.js';
|
|
5
|
-
import { toMobile } from './mobileUtilities.js';
|
|
6
4
|
import { css, keyframes as keyframes$1 } from 'styled-components';
|
|
7
5
|
export { createGlobalStyle, css, keyframes as kfrm, useTheme, withTheme } from 'styled-components';
|
|
6
|
+
import { theme } from './theme.js';
|
|
7
|
+
import { toMobile } from './mobileUtilities.js';
|
|
8
|
+
import { th } from './th.js';
|
|
8
9
|
|
|
9
10
|
/* eslint-disable no-shadow */
|
|
10
11
|
function truncate(width) {
|
|
@@ -132,5 +133,24 @@ const onlySafariAndFirefox = styles => css(["@media not all and (min-resolution:
|
|
|
132
133
|
const onlySafari = styles => "\n @media not all and (min-resolution: 0.001dpcm) {\n ".concat(styles, "\n }\n ");
|
|
133
134
|
const onlyFirefox = styles => "\n @media screen and (min--moz-device-pixel-ratio: 0) {\n ".concat(styles, "\n }\n ");
|
|
134
135
|
const safariAndFirefoxBold = color => "\n @media not all and (min-resolution: 0.001dpcm) {\n font-weight: 400;\n -webkit-font-smoothing: subpixel-antialiased;\n -webkit-text-stroke: 0.4px ".concat(color, ";\n }\n @media screen and (min--moz-device-pixel-ratio: 0) {\n font-weight: 400;\n -webkit-font-smoothing: subpixel-antialiased;\n -webkit-text-stroke: 0.4px ").concat(color, ";\n }\n");
|
|
135
|
-
|
|
136
|
-
|
|
136
|
+
const backgroundColorSetter = /*#__PURE__*/css(["", "}"], _ref => {
|
|
137
|
+
let {
|
|
138
|
+
bg,
|
|
139
|
+
backgroundColor,
|
|
140
|
+
theme
|
|
141
|
+
} = _ref;
|
|
142
|
+
return bg || backgroundColor ? "background-color: ".concat(th.color(bg || backgroundColor, bg || backgroundColor)({
|
|
143
|
+
theme
|
|
144
|
+
}), ";") : "";
|
|
145
|
+
});
|
|
146
|
+
const hexToRgba = (hex, alpha) => {
|
|
147
|
+
const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
|
|
148
|
+
|
|
149
|
+
if (result) {
|
|
150
|
+
return "rgba(".concat(parseInt(result[1], 16), ", ").concat(parseInt(result[2], 16), ", ").concat(parseInt(result[3], 16), ", ").concat(alpha, ")");
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
return "";
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
export { active, animation, backgroundColorSetter, border, boxShadow, buttonLink, clearFocus, color, disabled, fakeActive, fakeBorder, flexCenter, focus, focusAfter, hexToRgba, hover, iconColor, keyframes, onlyFirefox, onlySafari, onlySafariAndFirefox, safariAndFirefoxBold, textStyle, transition, truncate };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elliemae/ds-system",
|
|
3
|
-
"version": "2.4.
|
|
3
|
+
"version": "2.4.2-rc.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "ICE MT - Dimsum - System",
|
|
6
6
|
"module": "./esm/index.js",
|
|
@@ -89,7 +89,7 @@
|
|
|
89
89
|
"generateSubmodules": true
|
|
90
90
|
},
|
|
91
91
|
"dependencies": {
|
|
92
|
-
"@elliemae/ds-utilities": "2.4.
|
|
92
|
+
"@elliemae/ds-utilities": "2.4.2-rc.1",
|
|
93
93
|
"polished": "~3.6.7"
|
|
94
94
|
},
|
|
95
95
|
"devDependencies": {
|