@elliemae/ds-system 2.2.0-alpha.4 → 3.0.0-next.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/cjs/arithmetic.js +30 -42
- package/cjs/constants.js +15 -43
- package/cjs/globalStyles.js +22 -44
- package/cjs/index.js +83 -42
- package/cjs/mobileUtilities.js +26 -57
- package/cjs/spaceUtilities.js +46 -72
- package/cjs/styled/index.d.js +2 -27
- package/cjs/styled/index.js +93 -57
- package/cjs/styled/styleGetters.js +30 -42
- package/cjs/styled/types.js +11 -34
- package/cjs/styled/utils.js +23 -46
- package/cjs/th.js +29 -49
- package/cjs/theme.js +9 -36
- package/cjs/themeProviderHOC.js +29 -42
- package/cjs/utils.js +146 -256
- package/esm/arithmetic.js +25 -13
- package/esm/constants.js +9 -14
- package/esm/globalStyles.js +15 -16
- package/esm/index.js +11 -14
- package/esm/mobileUtilities.js +17 -26
- package/esm/spaceUtilities.js +35 -43
- package/esm/styled/index.d.js +1 -2
- package/esm/styled/index.js +79 -23
- package/esm/styled/styleGetters.js +23 -12
- package/esm/styled/types.js +1 -6
- package/esm/styled/utils.js +16 -16
- package/esm/th.js +25 -20
- package/esm/theme.js +4 -6
- package/esm/themeProviderHOC.js +20 -13
- package/esm/utils.js +98 -227
- package/package.json +5 -5
- package/types/styled/types.d.ts +2 -1
- package/types/utils.d.ts +2 -1
- package/cjs/arithmetic.js.map +0 -7
- package/cjs/constants.js.map +0 -7
- package/cjs/globalStyles.js.map +0 -7
- package/cjs/index.js.map +0 -7
- package/cjs/mobileUtilities.js.map +0 -7
- package/cjs/spaceUtilities.js.map +0 -7
- package/cjs/styled/index.d.js.map +0 -7
- package/cjs/styled/index.js.map +0 -7
- package/cjs/styled/styleGetters.js.map +0 -7
- package/cjs/styled/types.js.map +0 -7
- package/cjs/styled/utils.js.map +0 -7
- package/cjs/th.js.map +0 -7
- package/cjs/theme.js.map +0 -7
- package/cjs/themeProviderHOC.js.map +0 -7
- package/cjs/utils.js.map +0 -7
- package/esm/arithmetic.js.map +0 -7
- package/esm/constants.js.map +0 -7
- package/esm/globalStyles.js.map +0 -7
- package/esm/index.js.map +0 -7
- package/esm/mobileUtilities.js.map +0 -7
- package/esm/spaceUtilities.js.map +0 -7
- package/esm/styled/index.d.js.map +0 -7
- package/esm/styled/index.js.map +0 -7
- package/esm/styled/styleGetters.js.map +0 -7
- package/esm/styled/types.js.map +0 -7
- package/esm/styled/utils.js.map +0 -7
- package/esm/th.js.map +0 -7
- package/esm/theme.js.map +0 -7
- package/esm/themeProviderHOC.js.map +0 -7
- package/esm/utils.js.map +0 -7
package/cjs/arithmetic.js
CHANGED
|
@@ -1,55 +1,43 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __reExport = (target, module2, copyDefault, desc) => {
|
|
13
|
-
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(module2))
|
|
15
|
-
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
16
|
-
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return target;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (module2, isNodeMode) => {
|
|
21
|
-
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
22
|
-
};
|
|
23
|
-
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
24
|
-
return (module2, temp) => {
|
|
25
|
-
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
26
|
-
};
|
|
27
|
-
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
28
|
-
var arithmetic_exports = {};
|
|
29
|
-
__export(arithmetic_exports, {
|
|
30
|
-
getNumberAndUnit: () => getNumberAndUnit,
|
|
31
|
-
op: () => op
|
|
32
|
-
});
|
|
33
|
-
var React = __toESM(require("react"));
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
require('core-js/modules/web.dom-collections.iterator.js');
|
|
6
|
+
|
|
34
7
|
function getNumberAndUnit(numberStrWithUnit) {
|
|
35
8
|
const [number, unit] = String(numberStrWithUnit).match(/[a-z]+|[(/^\-?\d*.\d+|\d+),?]+/gi);
|
|
36
|
-
return {
|
|
9
|
+
return {
|
|
10
|
+
number,
|
|
11
|
+
unit
|
|
12
|
+
};
|
|
37
13
|
}
|
|
38
14
|
function op(operator, n1, n2) {
|
|
39
|
-
const {
|
|
40
|
-
|
|
15
|
+
const {
|
|
16
|
+
number,
|
|
17
|
+
unit
|
|
18
|
+
} = getNumberAndUnit(n1);
|
|
19
|
+
const {
|
|
20
|
+
number: number2,
|
|
21
|
+
unit: unit2
|
|
22
|
+
} = getNumberAndUnit(n2);
|
|
23
|
+
|
|
41
24
|
switch (operator) {
|
|
42
|
-
case
|
|
25
|
+
case '*':
|
|
43
26
|
return Number(number) * Number(number2) + (unit || unit2);
|
|
44
|
-
|
|
27
|
+
|
|
28
|
+
case '+':
|
|
45
29
|
return Number(number) + Number(number2) + (unit || unit2);
|
|
46
|
-
|
|
30
|
+
|
|
31
|
+
case '-':
|
|
47
32
|
return Number(number) - Number(number2) + (unit || unit2);
|
|
48
|
-
|
|
33
|
+
|
|
34
|
+
case '/':
|
|
49
35
|
return Number(number) / Number(number2) + (unit || unit2);
|
|
36
|
+
|
|
50
37
|
default:
|
|
51
38
|
return Number(number) + Number(number2) + (unit || unit2);
|
|
52
39
|
}
|
|
53
40
|
}
|
|
54
|
-
|
|
55
|
-
|
|
41
|
+
|
|
42
|
+
exports.getNumberAndUnit = getNumberAndUnit;
|
|
43
|
+
exports.op = op;
|
package/cjs/constants.js
CHANGED
|
@@ -1,47 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __reExport = (target, module2, copyDefault, desc) => {
|
|
13
|
-
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(module2))
|
|
15
|
-
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
16
|
-
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return target;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (module2, isNodeMode) => {
|
|
21
|
-
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
22
|
-
};
|
|
23
|
-
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
24
|
-
return (module2, temp) => {
|
|
25
|
-
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
26
|
-
};
|
|
27
|
-
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
28
|
-
var constants_exports = {};
|
|
29
|
-
__export(constants_exports, {
|
|
30
|
-
desktopBaseFont: () => desktopBaseFont,
|
|
31
|
-
mobileBaseFont: () => mobileBaseFont,
|
|
32
|
-
translateUnits: () => translateUnits
|
|
33
|
-
});
|
|
34
|
-
var React = __toESM(require("react"));
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
35
5
|
const desktopBaseFont = 13;
|
|
36
6
|
const mobileBaseFont = 16;
|
|
37
7
|
const translateUnits = {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
8
|
+
'8px': '4px',
|
|
9
|
+
'16px': '8px',
|
|
10
|
+
'32px': '16px',
|
|
11
|
+
'48px': '24px',
|
|
12
|
+
'56px': '32px',
|
|
13
|
+
'64px': '48px',
|
|
14
|
+
'72px': '64px'
|
|
45
15
|
};
|
|
46
|
-
|
|
47
|
-
|
|
16
|
+
|
|
17
|
+
exports.desktopBaseFont = desktopBaseFont;
|
|
18
|
+
exports.mobileBaseFont = mobileBaseFont;
|
|
19
|
+
exports.translateUnits = translateUnits;
|
package/cjs/globalStyles.js
CHANGED
|
@@ -1,47 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __reExport = (target, module2, copyDefault, desc) => {
|
|
13
|
-
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(module2))
|
|
15
|
-
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
16
|
-
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return target;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (module2, isNodeMode) => {
|
|
21
|
-
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
22
|
-
};
|
|
23
|
-
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
24
|
-
return (module2, temp) => {
|
|
25
|
-
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
26
|
-
};
|
|
27
|
-
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
28
|
-
var globalStyles_exports = {};
|
|
29
|
-
__export(globalStyles_exports, {
|
|
30
|
-
GlobalStyles: () => GlobalStyles
|
|
31
|
-
});
|
|
32
|
-
var React = __toESM(require("react"));
|
|
33
|
-
var import_utils = require("./utils");
|
|
34
|
-
const GlobalStyles = import_utils.createGlobalStyle`
|
|
35
|
-
:root, body {
|
|
36
|
-
overscroll-behavior-y: none;
|
|
1
|
+
'use strict';
|
|
37
2
|
|
|
38
|
-
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
39
4
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
5
|
+
var _taggedTemplateLiteral = require('@babel/runtime/helpers/taggedTemplateLiteral');
|
|
6
|
+
require('polished');
|
|
7
|
+
require('lodash');
|
|
8
|
+
require('./theme.js');
|
|
9
|
+
require('core-js/modules/web.dom-collections.iterator.js');
|
|
10
|
+
require('react');
|
|
11
|
+
var styled_component = require('styled-components');
|
|
43
12
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
13
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
14
|
+
|
|
15
|
+
var _taggedTemplateLiteral__default = /*#__PURE__*/_interopDefaultLegacy(_taggedTemplateLiteral);
|
|
16
|
+
|
|
17
|
+
var _templateObject;
|
|
18
|
+
const GlobalStyles = styled_component.createGlobalStyle(_templateObject || (_templateObject = _taggedTemplateLiteral__default["default"](["\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 => {
|
|
19
|
+
let {
|
|
20
|
+
theme
|
|
21
|
+
} = _ref;
|
|
22
|
+
return theme.breakpoints.small;
|
|
23
|
+
}, props => props.device === 'mobile' ? '16px' : '13px');
|
|
24
|
+
|
|
25
|
+
exports.GlobalStyles = GlobalStyles;
|
package/cjs/index.js
CHANGED
|
@@ -1,43 +1,84 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
var
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var globalStyles = require('./globalStyles.js');
|
|
6
|
+
var spaceUtilities = require('./spaceUtilities.js');
|
|
7
|
+
var mobileUtilities = require('./mobileUtilities.js');
|
|
8
|
+
var utils = require('./utils.js');
|
|
9
|
+
var arithmetic = require('./arithmetic.js');
|
|
10
|
+
var th = require('./th.js');
|
|
11
|
+
var theme = require('./theme.js');
|
|
12
|
+
var index = require('./styled/index.js');
|
|
13
|
+
var themeProviderHOC = require('./themeProviderHOC.js');
|
|
14
|
+
var styled_component = require('styled-components');
|
|
15
|
+
var polished = require('polished');
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
exports.GlobalStyles = globalStyles.GlobalStyles;
|
|
20
|
+
exports.fixSpace = spaceUtilities.fixSpace;
|
|
21
|
+
exports.fixSpaceGutter = spaceUtilities.fixSpaceGutter;
|
|
22
|
+
exports.mapGap = spaceUtilities.mapGap;
|
|
23
|
+
exports.mapGrid = spaceUtilities.mapGrid;
|
|
24
|
+
exports.mapGutter = spaceUtilities.mapGutter;
|
|
25
|
+
exports.mapSpace = spaceUtilities.mapSpace;
|
|
26
|
+
exports.mapTemplateGrid = spaceUtilities.mapTemplateGrid;
|
|
27
|
+
exports.numbersToFr = spaceUtilities.numbersToFr;
|
|
28
|
+
exports.__UNSAFE_SPACE_TO_DIMSUM = mobileUtilities.__UNSAFE_SPACE_TO_DIMSUM;
|
|
29
|
+
exports.isMobile = mobileUtilities.isMobile;
|
|
30
|
+
exports.toMobile = mobileUtilities.toMobile;
|
|
31
|
+
exports.useIsMobile = mobileUtilities.useIsMobile;
|
|
32
|
+
exports.active = utils.active;
|
|
33
|
+
exports.animation = utils.animation;
|
|
34
|
+
exports.border = utils.border;
|
|
35
|
+
exports.boxShadow = utils.boxShadow;
|
|
36
|
+
exports.buttonLink = utils.buttonLink;
|
|
37
|
+
exports.clearFocus = utils.clearFocus;
|
|
38
|
+
exports.color = utils.color;
|
|
39
|
+
exports.disabled = utils.disabled;
|
|
40
|
+
exports.fakeActive = utils.fakeActive;
|
|
41
|
+
exports.fakeBorder = utils.fakeBorder;
|
|
42
|
+
exports.flexCenter = utils.flexCenter;
|
|
43
|
+
exports.focus = utils.focus;
|
|
44
|
+
exports.focusAfter = utils.focusAfter;
|
|
45
|
+
exports.hover = utils.hover;
|
|
46
|
+
exports.iconColor = utils.iconColor;
|
|
47
|
+
exports.keyframes = utils.keyframes;
|
|
48
|
+
exports.onlyFirefox = utils.onlyFirefox;
|
|
49
|
+
exports.onlySafari = utils.onlySafari;
|
|
50
|
+
exports.onlySafariAndFirefox = utils.onlySafariAndFirefox;
|
|
51
|
+
exports.safariAndFirefoxBold = utils.safariAndFirefoxBold;
|
|
52
|
+
exports.textStyle = utils.textStyle;
|
|
53
|
+
exports.transition = utils.transition;
|
|
54
|
+
exports.truncate = utils.truncate;
|
|
55
|
+
exports.getNumberAndUnit = arithmetic.getNumberAndUnit;
|
|
56
|
+
exports.op = arithmetic.op;
|
|
57
|
+
exports.th = th.th;
|
|
58
|
+
exports.theme = theme.theme;
|
|
59
|
+
exports.styled = index.styled;
|
|
60
|
+
exports.themeProviderHOC = themeProviderHOC.themeProviderHOC;
|
|
61
|
+
Object.defineProperty(exports, 'createGlobalStyle', {
|
|
62
|
+
enumerable: true,
|
|
63
|
+
get: function () { return styled_component.createGlobalStyle; }
|
|
64
|
+
});
|
|
65
|
+
Object.defineProperty(exports, 'css', {
|
|
66
|
+
enumerable: true,
|
|
67
|
+
get: function () { return styled_component.css; }
|
|
68
|
+
});
|
|
69
|
+
Object.defineProperty(exports, 'kfrm', {
|
|
70
|
+
enumerable: true,
|
|
71
|
+
get: function () { return styled_component.keyframes; }
|
|
72
|
+
});
|
|
73
|
+
Object.defineProperty(exports, 'useTheme', {
|
|
74
|
+
enumerable: true,
|
|
75
|
+
get: function () { return styled_component.useTheme; }
|
|
76
|
+
});
|
|
77
|
+
Object.defineProperty(exports, 'withTheme', {
|
|
78
|
+
enumerable: true,
|
|
79
|
+
get: function () { return styled_component.withTheme; }
|
|
80
|
+
});
|
|
81
|
+
Object.defineProperty(exports, 'rgba', {
|
|
82
|
+
enumerable: true,
|
|
83
|
+
get: function () { return polished.rgba; }
|
|
31
84
|
});
|
|
32
|
-
var React = __toESM(require("react"));
|
|
33
|
-
__reExport(src_exports, require("./globalStyles"));
|
|
34
|
-
__reExport(src_exports, require("./spaceUtilities"));
|
|
35
|
-
__reExport(src_exports, require("./mobileUtilities"));
|
|
36
|
-
__reExport(src_exports, require("./utils"));
|
|
37
|
-
__reExport(src_exports, require("./arithmetic"));
|
|
38
|
-
__reExport(src_exports, require("./th"));
|
|
39
|
-
__reExport(src_exports, require("./theme"));
|
|
40
|
-
__reExport(src_exports, require("./styled"));
|
|
41
|
-
var import_themeProviderHOC = require("./themeProviderHOC");
|
|
42
|
-
module.exports = __toCommonJS(src_exports);
|
|
43
|
-
//# sourceMappingURL=index.js.map
|
package/cjs/mobileUtilities.js
CHANGED
|
@@ -1,72 +1,41 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
var
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __reExport = (target, module2, copyDefault, desc) => {
|
|
13
|
-
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(module2))
|
|
15
|
-
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
16
|
-
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return target;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (module2, isNodeMode) => {
|
|
21
|
-
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
22
|
-
};
|
|
23
|
-
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
24
|
-
return (module2, temp) => {
|
|
25
|
-
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
26
|
-
};
|
|
27
|
-
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
28
|
-
var mobileUtilities_exports = {};
|
|
29
|
-
__export(mobileUtilities_exports, {
|
|
30
|
-
__UNSAFE_SPACE_TO_DIMSUM: () => __UNSAFE_SPACE_TO_DIMSUM,
|
|
31
|
-
isMobile: () => isMobile,
|
|
32
|
-
toMobile: () => toMobile,
|
|
33
|
-
useIsMobile: () => useIsMobile
|
|
34
|
-
});
|
|
35
|
-
var React = __toESM(require("react"));
|
|
36
|
-
var import_react = require("react");
|
|
37
|
-
var import_theme = require("./theme");
|
|
38
|
-
var import_constants = require("./constants");
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
require('core-js/modules/web.dom-collections.iterator.js');
|
|
6
|
+
var react = require('react');
|
|
7
|
+
var theme = require('./theme.js');
|
|
8
|
+
var constants = require('./constants.js');
|
|
9
|
+
|
|
39
10
|
function __UNSAFE_SPACE_TO_DIMSUM(unit) {
|
|
40
|
-
if (
|
|
41
|
-
|
|
42
|
-
return `${parseFloat(unit) * (import_constants.mobileBaseFont / import_constants.desktopBaseFont) / 2}px`;
|
|
11
|
+
if (constants.translateUnits[unit]) return constants.translateUnits[unit];
|
|
12
|
+
return "".concat(parseFloat(unit) * (constants.mobileBaseFont / constants.desktopBaseFont) / 2, "px");
|
|
43
13
|
}
|
|
44
14
|
function toMobile(unit) {
|
|
45
|
-
if (!isMobile())
|
|
46
|
-
|
|
47
|
-
return `${parseFloat(unit) * (import_constants.desktopBaseFont / import_constants.mobileBaseFont)}rem`;
|
|
15
|
+
if (!isMobile()) return unit;
|
|
16
|
+
return "".concat(parseFloat(unit) * (constants.desktopBaseFont / constants.mobileBaseFont), "rem");
|
|
48
17
|
}
|
|
49
18
|
const useIsMobile = () => {
|
|
50
|
-
const [mobile, setMobile] =
|
|
51
|
-
|
|
19
|
+
const [mobile, setMobile] = react.useState(isMobile());
|
|
20
|
+
react.useEffect(() => {
|
|
52
21
|
function handleResize() {
|
|
53
22
|
setMobile(isMobile());
|
|
54
23
|
}
|
|
55
|
-
|
|
56
|
-
|
|
24
|
+
|
|
25
|
+
if (window) window.addEventListener('resize', handleResize);
|
|
57
26
|
return () => {
|
|
58
|
-
if (window)
|
|
59
|
-
window.removeEventListener("resize", handleResize);
|
|
27
|
+
if (window) window.removeEventListener('resize', handleResize);
|
|
60
28
|
};
|
|
61
29
|
}, []);
|
|
62
|
-
if (!window)
|
|
63
|
-
return false;
|
|
30
|
+
if (!window) return false;
|
|
64
31
|
return mobile;
|
|
65
32
|
};
|
|
66
33
|
const isMobile = () => {
|
|
67
|
-
if (!window)
|
|
68
|
-
|
|
69
|
-
return Number(import_theme.theme.breakpoints.medium.split("px")[0]) - window.innerWidth >= 0;
|
|
34
|
+
if (!window) return false;
|
|
35
|
+
return Number(theme.theme.breakpoints.medium.split('px')[0]) - window.innerWidth >= 0;
|
|
70
36
|
};
|
|
71
|
-
|
|
72
|
-
|
|
37
|
+
|
|
38
|
+
exports.__UNSAFE_SPACE_TO_DIMSUM = __UNSAFE_SPACE_TO_DIMSUM;
|
|
39
|
+
exports.isMobile = isMobile;
|
|
40
|
+
exports.toMobile = toMobile;
|
|
41
|
+
exports.useIsMobile = useIsMobile;
|
package/cjs/spaceUtilities.js
CHANGED
|
@@ -1,94 +1,68 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(module2))
|
|
15
|
-
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
16
|
-
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return target;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (module2, isNodeMode) => {
|
|
21
|
-
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
22
|
-
};
|
|
23
|
-
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
24
|
-
return (module2, temp) => {
|
|
25
|
-
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
26
|
-
};
|
|
27
|
-
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
28
|
-
var spaceUtilities_exports = {};
|
|
29
|
-
__export(spaceUtilities_exports, {
|
|
30
|
-
fixSpace: () => fixSpace,
|
|
31
|
-
fixSpaceGutter: () => fixSpaceGutter,
|
|
32
|
-
mapGap: () => mapGap,
|
|
33
|
-
mapGrid: () => mapGrid,
|
|
34
|
-
mapGutter: () => mapGutter,
|
|
35
|
-
mapSpace: () => mapSpace,
|
|
36
|
-
mapTemplateGrid: () => mapTemplateGrid,
|
|
37
|
-
numbersToFr: () => numbersToFr
|
|
38
|
-
});
|
|
39
|
-
var React = __toESM(require("react"));
|
|
40
|
-
var import_lodash = require("lodash");
|
|
41
|
-
var import_theme = require("./theme");
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
require('core-js/modules/esnext.async-iterator.map.js');
|
|
6
|
+
require('core-js/modules/esnext.iterator.map.js');
|
|
7
|
+
require('core-js/modules/esnext.async-iterator.some.js');
|
|
8
|
+
require('core-js/modules/esnext.iterator.constructor.js');
|
|
9
|
+
require('core-js/modules/esnext.iterator.some.js');
|
|
10
|
+
var lodash = require('lodash');
|
|
11
|
+
var theme = require('./theme.js');
|
|
12
|
+
|
|
42
13
|
function mapGap(gutter) {
|
|
43
|
-
if (!gutter)
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
return gutter;
|
|
47
|
-
return `${import_theme.theme.space[gutter]}`;
|
|
14
|
+
if (!gutter) return '0rem';
|
|
15
|
+
if (String(gutter).includes('rem') || String(gutter).includes('px')) return gutter;
|
|
16
|
+
return "".concat(theme.theme.space[gutter]);
|
|
48
17
|
}
|
|
49
18
|
function mapGutter(gutter) {
|
|
50
|
-
if (!gutter)
|
|
51
|
-
|
|
52
|
-
return `${import_theme.theme.space[gutter]} * 2`;
|
|
19
|
+
if (!gutter) return '0rem';
|
|
20
|
+
return "".concat(theme.theme.space[gutter], " * 2");
|
|
53
21
|
}
|
|
54
22
|
function mapSpace(width) {
|
|
55
|
-
if (typeof width ===
|
|
56
|
-
|
|
57
|
-
return `${width * 100}%`;
|
|
23
|
+
if (typeof width === 'string') return lodash.get(theme.theme, width) ? "".concat(lodash.get(theme.theme, width)) : width;
|
|
24
|
+
return "".concat(width * 100, "%");
|
|
58
25
|
}
|
|
59
26
|
function fixSpaceGutter(width, gutter) {
|
|
60
|
-
if (!width)
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
return width.map((w) => `calc(${mapSpace(w)} - (${mapGutter(gutter)}))`);
|
|
64
|
-
return `calc(${mapSpace(width)} - (${mapGutter(gutter)}))`;
|
|
27
|
+
if (!width) return '';
|
|
28
|
+
if (Array.isArray(width)) return width.map(w => "calc(".concat(mapSpace(w), " - (").concat(mapGutter(gutter), "))"));
|
|
29
|
+
return "calc(".concat(mapSpace(width), " - (").concat(mapGutter(gutter), "))");
|
|
65
30
|
}
|
|
66
31
|
function fixSpace(width) {
|
|
67
|
-
if (!width)
|
|
68
|
-
|
|
69
|
-
if (Array.isArray(width))
|
|
70
|
-
return width.map((w) => mapSpace(w));
|
|
32
|
+
if (!width) return '';
|
|
33
|
+
if (Array.isArray(width)) return width.map(w => mapSpace(w));
|
|
71
34
|
return mapSpace(width);
|
|
72
35
|
}
|
|
36
|
+
/**
|
|
37
|
+
* Grid
|
|
38
|
+
*
|
|
39
|
+
* @param grid
|
|
40
|
+
*/
|
|
41
|
+
|
|
73
42
|
function numbersToFr(grid) {
|
|
74
|
-
const den = grid.map(
|
|
75
|
-
return den.map(
|
|
43
|
+
const den = grid.map(f => f < 1 ? Math.floor(1 / f) : f);
|
|
44
|
+
return den.map(d => "".concat(d, "fr"));
|
|
76
45
|
}
|
|
77
46
|
function mapGrid(width) {
|
|
78
|
-
if ((
|
|
79
|
-
|
|
80
|
-
if (typeof width === "string")
|
|
81
|
-
return width;
|
|
47
|
+
if (lodash.get(theme.theme, width)) return "".concat(lodash.get(theme.theme, width));
|
|
48
|
+
if (typeof width === 'string') return width;
|
|
82
49
|
const den = width < 1 ? Math.floor(1 / width) : width;
|
|
83
|
-
return
|
|
50
|
+
return "".concat(den, "fr");
|
|
84
51
|
}
|
|
85
52
|
function mapTemplateGrid(grid) {
|
|
86
53
|
if (Array.isArray(grid)) {
|
|
87
|
-
if (grid.some(
|
|
88
|
-
return grid.map((w) => mapGrid(w));
|
|
54
|
+
if (grid.some(w => typeof w === 'string')) return grid.map(w => mapGrid(w));
|
|
89
55
|
return numbersToFr(grid);
|
|
90
56
|
}
|
|
57
|
+
|
|
91
58
|
return mapGrid(grid);
|
|
92
59
|
}
|
|
93
|
-
|
|
94
|
-
|
|
60
|
+
|
|
61
|
+
exports.fixSpace = fixSpace;
|
|
62
|
+
exports.fixSpaceGutter = fixSpaceGutter;
|
|
63
|
+
exports.mapGap = mapGap;
|
|
64
|
+
exports.mapGrid = mapGrid;
|
|
65
|
+
exports.mapGutter = mapGutter;
|
|
66
|
+
exports.mapSpace = mapSpace;
|
|
67
|
+
exports.mapTemplateGrid = mapTemplateGrid;
|
|
68
|
+
exports.numbersToFr = numbersToFr;
|
package/cjs/styled/index.d.js
CHANGED
|
@@ -1,27 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
8
|
-
var __reExport = (target, module2, copyDefault, desc) => {
|
|
9
|
-
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
10
|
-
for (let key of __getOwnPropNames(module2))
|
|
11
|
-
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
12
|
-
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
13
|
-
}
|
|
14
|
-
return target;
|
|
15
|
-
};
|
|
16
|
-
var __toESM = (module2, isNodeMode) => {
|
|
17
|
-
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
18
|
-
};
|
|
19
|
-
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
20
|
-
return (module2, temp) => {
|
|
21
|
-
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
22
|
-
};
|
|
23
|
-
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
24
|
-
var index_d_exports = {};
|
|
25
|
-
var React = __toESM(require("react"));
|
|
26
|
-
module.exports = __toCommonJS(index_d_exports);
|
|
27
|
-
//# sourceMappingURL=index.d.js.map
|
|
1
|
+
'use strict';
|
|
2
|
+
|