UNPKG

18.8 kBJavaScriptView Raw
1(function (global, factory) {
2 typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('react'), require('styled-system'), require('styled-components'), require('rebass')) :
3 typeof define === 'function' && define.amd ? define(['react', 'styled-system', 'styled-components', 'rebass'], factory) :
4 (global = global || self, global['@edenhealth/eve'] = factory(global.React, global.styledSystem, global.styled, global.rebass));
5}(this, function (React, styledSystem, styled, rebass) { 'use strict';
6
7 React = React && React.hasOwnProperty('default') ? React['default'] : React;
8 var styledSystem__default = 'default' in styledSystem ? styledSystem['default'] : styledSystem;
9 var styled__default = 'default' in styled ? styled['default'] : styled;
10
11 function styleInject(css, ref) {
12 if ( ref === void 0 ) ref = {};
13 var insertAt = ref.insertAt;
14
15 if (!css || typeof document === 'undefined') { return; }
16
17 var head = document.head || document.getElementsByTagName('head')[0];
18 var style = document.createElement('style');
19 style.type = 'text/css';
20
21 if (insertAt === 'top') {
22 if (head.firstChild) {
23 head.insertBefore(style, head.firstChild);
24 } else {
25 head.appendChild(style);
26 }
27 } else {
28 head.appendChild(style);
29 }
30
31 if (style.styleSheet) {
32 style.styleSheet.cssText = css;
33 } else {
34 style.appendChild(document.createTextNode(css));
35 }
36 }
37
38 var css = "/* open-sans-300normal - latin */\n@font-face {\n font-family: 'Open Sans';\n font-style: normal;\n font-display: swap;\n font-weight: 300;\n src:\n local('Open Sans Light '),\n local('Open Sans-Light'),\n url('./files/open-sans-latin-300.woff2') format('woff2'), /* Super Modern Browsers */\n url('./files/open-sans-latin-300.woff') format('woff'); /* Modern Browsers */\n}\n/* open-sans-300italic - latin */\n@font-face {\n font-family: 'Open Sans';\n font-style: italic;\n font-display: swap;\n font-weight: 300;\n src:\n local('Open Sans Light italic'),\n local('Open Sans-Lightitalic'),\n url('./files/open-sans-latin-300italic.woff2') format('woff2'), /* Super Modern Browsers */\n url('./files/open-sans-latin-300italic.woff') format('woff'); /* Modern Browsers */\n}\n/* open-sans-400normal - latin */\n@font-face {\n font-family: 'Open Sans';\n font-style: normal;\n font-display: swap;\n font-weight: 400;\n src:\n local('Open Sans Regular '),\n local('Open Sans-Regular'),\n url('./files/open-sans-latin-400.woff2') format('woff2'), /* Super Modern Browsers */\n url('./files/open-sans-latin-400.woff') format('woff'); /* Modern Browsers */\n}\n/* open-sans-400italic - latin */\n@font-face {\n font-family: 'Open Sans';\n font-style: italic;\n font-display: swap;\n font-weight: 400;\n src:\n local('Open Sans Regular italic'),\n local('Open Sans-Regularitalic'),\n url('./files/open-sans-latin-400italic.woff2') format('woff2'), /* Super Modern Browsers */\n url('./files/open-sans-latin-400italic.woff') format('woff'); /* Modern Browsers */\n}\n/* open-sans-600normal - latin */\n@font-face {\n font-family: 'Open Sans';\n font-style: normal;\n font-display: swap;\n font-weight: 600;\n src:\n local('Open Sans SemiBold '),\n local('Open Sans-SemiBold'),\n url('./files/open-sans-latin-600.woff2') format('woff2'), /* Super Modern Browsers */\n url('./files/open-sans-latin-600.woff') format('woff'); /* Modern Browsers */\n}\n/* open-sans-600italic - latin */\n@font-face {\n font-family: 'Open Sans';\n font-style: italic;\n font-display: swap;\n font-weight: 600;\n src:\n local('Open Sans SemiBold italic'),\n local('Open Sans-SemiBolditalic'),\n url('./files/open-sans-latin-600italic.woff2') format('woff2'), /* Super Modern Browsers */\n url('./files/open-sans-latin-600italic.woff') format('woff'); /* Modern Browsers */\n}\n/* open-sans-700normal - latin */\n@font-face {\n font-family: 'Open Sans';\n font-style: normal;\n font-display: swap;\n font-weight: 700;\n src:\n local('Open Sans Bold '),\n local('Open Sans-Bold'),\n url('./files/open-sans-latin-700.woff2') format('woff2'), /* Super Modern Browsers */\n url('./files/open-sans-latin-700.woff') format('woff'); /* Modern Browsers */\n}\n/* open-sans-700italic - latin */\n@font-face {\n font-family: 'Open Sans';\n font-style: italic;\n font-display: swap;\n font-weight: 700;\n src:\n local('Open Sans Bold italic'),\n local('Open Sans-Bolditalic'),\n url('./files/open-sans-latin-700italic.woff2') format('woff2'), /* Super Modern Browsers */\n url('./files/open-sans-latin-700italic.woff') format('woff'); /* Modern Browsers */\n}\n/* open-sans-800normal - latin */\n@font-face {\n font-family: 'Open Sans';\n font-style: normal;\n font-display: swap;\n font-weight: 800;\n src:\n local('Open Sans ExtraBold '),\n local('Open Sans-ExtraBold'),\n url('./files/open-sans-latin-800.woff2') format('woff2'), /* Super Modern Browsers */\n url('./files/open-sans-latin-800.woff') format('woff'); /* Modern Browsers */\n}\n/* open-sans-800italic - latin */\n@font-face {\n font-family: 'Open Sans';\n font-style: italic;\n font-display: swap;\n font-weight: 800;\n src:\n local('Open Sans ExtraBold italic'),\n local('Open Sans-ExtraBolditalic'),\n url('./files/open-sans-latin-800italic.woff2') format('woff2'), /* Super Modern Browsers */\n url('./files/open-sans-latin-800italic.woff') format('woff'); /* Modern Browsers */\n}\n\n";
39 styleInject(css);
40
41 var css$1 = ":root {\n /* Primary brand colors. */\n --primary: #4dbd8f;\n --primary-light: #82f0bf;\n --primary-dark: #028c61;\n\n /* Secondary colors */\n --secondary: #2d4147;\n --secondary-900: #1d2c31;\n --secondary-800: #2d4147;\n --secondary-700: #3a545b;\n --secondary-600: #486870;\n --secondary-500: #537680;\n --secondary-400: #6d8a93;\n --secondary-300: #869fa6;\n --secondary-200: #a8babf;\n --secondary-100: #cad6d9;\n --secondary-50: #e9eef0;\n\n /* Neutral colors */\n --white: #ffffff;\n --surface-light: #ffffff;\n --surface-dark: var(--secondary-50);\n\n /* Error colors */\n --error: #e25c6c;\n --error-light: #ff8d9a;\n --error-dark: #ab2941;\n\n /* Alert colors */\n --alert: #ffe04a;\n --alert-light: #ffff7d;\n --alert-dark: #c8af03;\n\n /* Shades of black/gray (translucent). */\n --black-90: rgba(0, 0, 0, 0.9);\n --black-80: rgba(0, 0, 0, 0.8);\n --black-70: rgba(0, 0, 0, 0.7);\n --black-60: rgba(0, 0, 0, 0.6);\n --black-50: rgba(0, 0, 0, 0.5);\n --black-40: rgba(0, 0, 0, 0.4);\n --black-30: rgba(0, 0, 0, 0.3);\n --black-20: rgba(0, 0, 0, 0.2);\n --black-10: rgba(0, 0, 0, 0.1);\n --black-05: rgba(0, 0, 0, 0.05);\n --black-025: rgba(0, 0, 0, 0.025);\n --black-0125: rgba(0, 0, 0, 0.0125);\n\n /* Shades of gray (opaque) */\n --grey-100: #333333;\n --grey-90: #444444;\n --grey-80: #555555;\n --grey-70: #666666;\n --grey-60: #777777;\n --grey-50: #888888;\n --grey-40: #999999;\n --grey-30: #aaaaaa;\n --grey-20: #bbbbbb;\n --grey-10: #cccccc;\n --grey-05: #dddddd;\n --grey-0: #eeeeee;\n --near-white: #f5f5f5;\n\n /* DEPRECATED */\n --text-dark: var(--black-90);\n --text-muted: var(--black-60);\n --eden-green: #6fbe9a;\n --eden-pink: #ff4557;\n --eden-shale: #2d4147;\n}\n";
42 styleInject(css$1);
43
44 /*! *****************************************************************************
45 Copyright (c) Microsoft Corporation. All rights reserved.
46 Licensed under the Apache License, Version 2.0 (the "License"); you may not use
47 this file except in compliance with the License. You may obtain a copy of the
48 License at http://www.apache.org/licenses/LICENSE-2.0
49
50 THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
51 KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
52 WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
53 MERCHANTABLITY OR NON-INFRINGEMENT.
54
55 See the Apache Version 2.0 License for specific language governing permissions
56 and limitations under the License.
57 ***************************************************************************** */
58
59 var __assign = function() {
60 __assign = Object.assign || function __assign(t) {
61 for (var s, i = 1, n = arguments.length; i < n; i++) {
62 s = arguments[i];
63 for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
64 }
65 return t;
66 };
67 return __assign.apply(this, arguments);
68 };
69
70 function __makeTemplateObject(cooked, raw) {
71 if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
72 return cooked;
73 }
74
75 function unwrapExports (x) {
76 return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x.default : x;
77 }
78
79 function createCommonjsModule(fn, module) {
80 return module = { exports: {} }, fn(module, module.exports), module.exports;
81 }
82
83 var dist = createCommonjsModule(function (module, exports) {
84
85 Object.defineProperty(exports, "__esModule", {
86 value: true
87 });
88
89 var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
90
91 var _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; };
92
93
94
95 var _react2 = _interopRequireDefault(React);
96
97
98
99
100
101 var _styledComponents2 = _interopRequireDefault(styled__default);
102
103 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
104
105 function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
106
107 function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
108
109 var css = function css(props) {
110 return props.css;
111 };
112
113 var omit = function omit(obj, blacklist) {
114 var next = {};
115 for (var key in obj) {
116 if (blacklist.indexOf(key) > -1) continue;
117 next[key] = obj[key];
118 }
119 return next;
120 };
121
122 var styleKeys = Object.keys(styledSystem__default.styles).filter(function (key) {
123 return typeof styledSystem__default.styles[key] === 'function';
124 });
125
126 var propNames = styleKeys.reduce(function (a, key) {
127 var names = Object.keys(styledSystem__default.styles[key].propTypes);
128 return [].concat(_toConsumableArray(a), _toConsumableArray(names));
129 }, []);
130
131 // private blacklist
132 var _blacklist = ['css', 'is', 'tag', 'extend'].concat(_toConsumableArray(propNames));
133
134 var tag = _react2.default.forwardRef(function (_ref, ref) {
135 var _ref$blacklist = _ref.blacklist,
136 blacklist = _ref$blacklist === undefined ? [] : _ref$blacklist,
137 props = _objectWithoutProperties(_ref, ['blacklist']);
138
139 var Base = props.extend || props.tag || props.is || 'div';
140 var next = omit(props, typeof Base === 'string' ? [].concat(_toConsumableArray(_blacklist), _toConsumableArray(blacklist)) : ['extend']);
141 return _react2.default.createElement(Base, _extends({}, next, { ref: ref }));
142 });
143
144 var getPropTypes = function getPropTypes(funcs) {
145 return funcs.filter(function (fn) {
146 return typeof fn === 'function' && _typeof(fn.propTypes) === 'object';
147 }).reduce(function (a, fn) {
148 return _extends({}, a, fn.propTypes);
149 }, {});
150 };
151
152 var system = function system() {
153 for (var _len = arguments.length, keysOrStyles = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
154 keysOrStyles[_key - 1] = arguments[_key];
155 }
156
157 var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
158
159 var funcs = keysOrStyles.map(function (key) {
160 return styledSystem__default.styles[key] || key;
161 });
162 var propTypes = getPropTypes(funcs);
163
164 var Component = (0, _styledComponents2.default)(tag).apply(undefined, [[]].concat(_toConsumableArray(funcs), [css]));
165
166 var baseProps = styledSystem__default.util.get(props, 'extend.defaultProps') || {};
167
168 Component.defaultProps = _extends({}, baseProps, props);
169
170 Component.propTypes = getPropTypes(funcs);
171 Component.systemComponent = true;
172
173 return Component;
174 };
175
176 exports.default = system;
177 });
178
179 var system = unwrapExports(dist);
180
181 /* tslint:disable object-literal-sort-keys */
182 /* Primary brand colors. */
183 var PrimaryColors = {
184 Primary: '#4dbd8f',
185 PrimaryLight: '#82f0bf',
186 PrimaryDark: '#028c61',
187 };
188 /* Secondary colors */
189 var SecondaryColors = {
190 Secondary: '#2d4147',
191 Secondary900: '#1d2c31',
192 Secondary800: '#2d4147',
193 Secondary700: '#3a545b',
194 Secondary600: '#486870',
195 Secondary500: '#537680',
196 Secondary400: '#6d8a93',
197 Secondary300: '#869fa6',
198 Secondary200: '#a8babf',
199 Secondary100: '#cad6d9',
200 Secondary50: '#e9eef0',
201 };
202 /* Neutral colors */
203 var NeutralColors = {
204 White: '#ffffff',
205 SurfaceLight: '#ffffff',
206 SurfaceDark: SecondaryColors.Secondary500,
207 };
208 /* Error colors */
209 var ErrorColors = {
210 Error: '#e25c6c',
211 ErrorLight: '#ff8d9a',
212 ErrorDark: '#ab2941',
213 };
214 /* Alert colors */
215 var AlertColors = {
216 Alert: '#ffe04a',
217 AlertLight: '#ffff7d',
218 AlertDark: '#c8af03',
219 };
220 /* Shades of black/gray (translucent). */
221 var BlackColors = {
222 Black900: 'rgba(0, 0, 0, 0.9)',
223 Black800: 'rgba(0, 0, 0, 0.8)',
224 Black700: 'rgba(0, 0, 0, 0.7)',
225 Black600: 'rgba(0, 0, 0, 0.6)',
226 Black500: 'rgba(0, 0, 0, 0.5)',
227 Black400: 'rgba(0, 0, 0, 0.4)',
228 Black300: 'rgba(0, 0, 0, 0.3)',
229 Black200: 'rgba(0, 0, 0, 0.2)',
230 Black100: 'rgba(0, 0, 0, 0.1)',
231 Black050: 'rgba(0, 0, 0, 0.05)',
232 Black025: 'rgba(0, 0, 0, 0.025)',
233 Black0125: 'rgba(0, 0, 0, 0.0125)',
234 };
235 /* Shades of gray (opaque) */
236 var GreyColors = {
237 Grey900: '#333333',
238 Grey800: '#444444',
239 Grey700: '#555555',
240 Grey600: '#666666',
241 Grey500: '#777777',
242 Grey400: '#888888',
243 Grey300: '#999999',
244 Grey200: '#aaaaaa',
245 Grey100: '#bbbbbb',
246 Grey050: '#cccccc',
247 Grey025: '#dddddd',
248 Grey0125: '#e0e0e0',
249 NearWhite: '#f7f7f7',
250 };
251 var BrandColors = __assign({}, AlertColors, ErrorColors, NeutralColors, PrimaryColors, SecondaryColors);
252 var Colors = __assign({}, AlertColors, BlackColors, ErrorColors, GreyColors, NeutralColors, PrimaryColors, SecondaryColors);
253
254 var BorderRadius = {
255 Base: 4,
256 Large: 8,
257 };
258 var SpacerSize;
259 (function (SpacerSize) {
260 SpacerSize[SpacerSize["Large"] = 0] = "Large";
261 SpacerSize[SpacerSize["Medium"] = 1] = "Medium";
262 SpacerSize[SpacerSize["Small"] = 2] = "Small";
263 SpacerSize[SpacerSize["Tiny"] = 3] = "Tiny";
264 })(SpacerSize || (SpacerSize = {}));
265 var Spacing = {
266 Large: 24,
267 Medium: 16,
268 Small: 8,
269 Tiny: 4,
270 };
271
272 var Box = system({
273 p: 3,
274 space: styledSystem.space,
275 });
276 var Box$1 = styled__default(Box)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n background: ", ";\n border-radius: ", ";\n box-shadow: 0 2px 4px 2px rgba(29, 44, 49, 0.1);\n display: flex;\n flex-direction: column;\n justify-content: center;\n ", ";\n"], ["\n background: ", ";\n border-radius: ", ";\n box-shadow: 0 2px 4px 2px rgba(29, 44, 49, 0.1);\n display: flex;\n flex-direction: column;\n justify-content: center;\n ", ";\n"])), Colors.White, BorderRadius.Large, styledSystem.space);
277 var templateObject_1;
278
279 var Separator = styled__default(system({ space: styledSystem.space, width: styledSystem.width }))(templateObject_1$1 || (templateObject_1$1 = __makeTemplateObject(["\n border: 1px solid ", ";\n border-bottom-width: 0;\n ", ";\n ", ";\n"], ["\n border: 1px solid ", ";\n border-bottom-width: 0;\n ", ";\n ", ";\n"])), Colors.Grey025, styledSystem.space, styledSystem.width);
280 Separator.defaultProps = {
281 width: '100%',
282 };
283 var templateObject_1$1;
284
285 /* tslint:disable object-literal-sort-keys */
286 // =========
287 // Font size
288 // =========
289 var FontSize = {
290 Base: 16,
291 BaseLarge: 18,
292 BaseSmall: 14,
293 HeaderBase: 20,
294 };
295 // ===========
296 // Font Weight
297 // ===========
298 var FontWeightType;
299 (function (FontWeightType) {
300 FontWeightType[FontWeightType["Light"] = 0] = "Light";
301 FontWeightType[FontWeightType["Regular"] = 1] = "Regular";
302 FontWeightType[FontWeightType["Medium"] = 2] = "Medium";
303 FontWeightType[FontWeightType["SemiBold"] = 3] = "SemiBold";
304 FontWeightType[FontWeightType["Bold"] = 4] = "Bold";
305 })(FontWeightType || (FontWeightType = {}));
306 var FontWeight = Object.freeze({
307 Light: '300',
308 Regular: '400',
309 Medium: '500',
310 SemiBold: '600',
311 Bold: '700',
312 });
313 var FontFamily;
314 (function (FontFamily) {
315 FontFamily["OpenSans"] = "Open Sans";
316 FontFamily["Merriweather"] = "Merriweather";
317 })(FontFamily || (FontFamily = {}));
318
319 var Sans = (function (props) { return (React.createElement(rebass.Text, { fontFamily: props.fontFamily || FontFamily.OpenSans, fontSize: props.size, fontWeight: "" + FontWeight[props.weight] }, props.children)); });
320
321 var Theme = {
322 colors: {
323 primary: Colors.Primary,
324 secondary: Colors.Secondary,
325 },
326 fontSizes: [12, 14, 16, 18, 20, 24, 32, 48, 64],
327 styles: {
328 body: {
329 fontFamily: "'Open Sans', Helvetica, sans-serif",
330 },
331 html: {
332 fontFamily: "'Open Sans', Helvetica, sans-serif",
333 },
334 },
335 };
336 var Theme$1 = (function (props) { return (React.createElement(styled.ThemeProvider, { theme: Theme }, props.children)); });
337
338 var index = {
339 BorderRadius: BorderRadius,
340 Box: Box$1,
341 Colors: Colors,
342 FontFamily: FontFamily,
343 FontSize: FontSize,
344 FontWeight: FontWeight,
345 Sans: Sans,
346 Separator: Separator,
347 Spacing: Spacing,
348 Theme: Theme$1,
349 };
350
351 return index;
352
353}));
354//# sourceMappingURL=eve.js.map