@marigold/system 0.0.2 → 0.3.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.
Files changed (47) hide show
  1. package/CHANGELOG.md +95 -0
  2. package/dist/Box.d.ts +14 -0
  3. package/dist/Global.d.ts +2 -0
  4. package/dist/SVG.d.ts +6 -0
  5. package/dist/index.d.ts +7 -4
  6. package/dist/normalize.d.ts +143 -5
  7. package/dist/system.cjs.development.js +334 -159
  8. package/dist/system.cjs.development.js.map +1 -1
  9. package/dist/system.cjs.production.min.js +1 -1
  10. package/dist/system.cjs.production.min.js.map +1 -1
  11. package/dist/system.esm.js +324 -156
  12. package/dist/system.esm.js.map +1 -1
  13. package/dist/theme.d.ts +136 -0
  14. package/dist/types.d.ts +8 -0
  15. package/dist/useTheme.d.ts +15 -5
  16. package/dist/variant.d.ts +29 -0
  17. package/package.json +6 -8
  18. package/src/Box.test.tsx +308 -0
  19. package/src/Box.tsx +199 -0
  20. package/src/Colors.stories.mdx +492 -448
  21. package/src/Global.test.tsx +57 -0
  22. package/src/Global.tsx +34 -0
  23. package/src/SVG.stories.mdx +55 -0
  24. package/src/SVG.test.tsx +82 -0
  25. package/src/SVG.tsx +24 -0
  26. package/src/concepts-principles.mdx +1 -1
  27. package/src/index.ts +7 -4
  28. package/src/normalize.test.tsx +15 -0
  29. package/src/normalize.ts +79 -93
  30. package/src/theme.ts +157 -0
  31. package/src/types.ts +14 -0
  32. package/src/useTheme.test.tsx +92 -17
  33. package/src/useTheme.tsx +45 -6
  34. package/src/variant.test.ts +93 -0
  35. package/src/variant.ts +54 -0
  36. package/dist/categories.d.ts +0 -169
  37. package/dist/system.d.ts +0 -37
  38. package/dist/useClassname.d.ts +0 -2
  39. package/dist/useStyles.d.ts +0 -10
  40. package/src/categories.ts +0 -203
  41. package/src/system.test.tsx +0 -84
  42. package/src/system.tsx +0 -55
  43. package/src/useClassname.test.tsx +0 -61
  44. package/src/useClassname.ts +0 -8
  45. package/src/useStyles.test.tsx +0 -313
  46. package/src/useStyles.ts +0 -56
  47. package/src/writeComponent.stories.mdx +0 -126
@@ -2,17 +2,11 @@
2
2
 
3
3
  function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
4
4
 
5
+ var react = require('@emotion/react');
6
+ var css$1 = require('@theme-ui/css');
5
7
  var React = require('react');
6
8
  var React__default = _interopDefault(React);
7
- var emotion = require('emotion');
8
- var css = require('@theme-ui/css');
9
-
10
- /**
11
- * System categories are based on https://primer.style/components/docs/system-props
12
- */
13
- // Spacing
14
- // ---------------
15
- var SPACE_PROPS = ['m', 'margin', 'mt', 'marginTop', 'mr', 'marginRight', 'mb', 'marginBottom', 'ml', 'marginLeft', 'mx', 'marginX', 'my', 'marginY', 'p', 'padding', 'pt', 'paddingTop', 'pr', 'paddingRight', 'pb', 'paddingBottom', 'pl', 'paddingLeft', 'px', 'paddingX', 'py', 'paddingY'];
9
+ var system = require('@marigold/system');
16
10
 
17
11
  function _extends() {
18
12
  _extends = Object.assign || function (target) {
@@ -47,188 +41,369 @@ function _objectWithoutPropertiesLoose(source, excluded) {
47
41
  return target;
48
42
  }
49
43
 
50
- /**
51
- * Helper to write components that adhere to a common design system API,
52
- * which includes the `as` and `variant` prop.
53
- */
44
+ var base = {
45
+ boxSizing: 'border-box',
46
+ margin: 0,
47
+ minWidth: 0
48
+ };
54
49
 
55
- function system(render) {
56
- return React.forwardRef(function (props, ref) {
57
- return render(_extends({}, props, {
58
- ref: ref
59
- }));
60
- });
61
- }
50
+ var a = /*#__PURE__*/_extends({}, base, {
51
+ textDecoration: 'none'
52
+ });
62
53
 
63
- var Context = /*#__PURE__*/React.createContext({});
64
- var useTheme = function useTheme() {
65
- return React.useContext(Context);
66
- };
67
- var ThemeProvider = function ThemeProvider(_ref) {
68
- var theme = _ref.theme,
69
- children = _ref.children;
70
- return React__default.createElement(Context.Provider, {
71
- value: theme
72
- }, children);
73
- };
54
+ var text = /*#__PURE__*/_extends({}, base, {
55
+ overflowWrap: 'break-word'
56
+ });
74
57
 
75
- var useClassname = function useClassname() {
76
- var theme = useTheme();
58
+ var media = /*#__PURE__*/_extends({}, base, {
59
+ display: 'block',
60
+ maxWidth: '100%'
61
+ });
77
62
 
78
- for (var _len = arguments.length, styles = new Array(_len), _key = 0; _key < _len; _key++) {
79
- styles[_key] = arguments[_key];
80
- }
63
+ var button = /*#__PURE__*/_extends({}, base, {
64
+ display: 'block',
65
+ appearance: 'none',
66
+ font: 'inherit',
67
+ background: 'transparent',
68
+ textAlign: 'center'
69
+ });
81
70
 
82
- return styles.map(function (style) {
83
- return emotion.css(css.css(style)(theme));
84
- }).join(' ');
85
- };
71
+ var input = /*#__PURE__*/_extends({}, base, {
72
+ display: 'block',
73
+ appearance: 'none',
74
+ font: 'inherit',
75
+ '&::-ms-clear': {
76
+ display: 'none'
77
+ },
78
+ '&::-webkit-search-cancel-button': {
79
+ WebkitAppearance: 'none'
80
+ }
81
+ });
86
82
 
87
- var base = {
88
- boxSizing: 'border-box',
89
- margin: 0,
90
- padding: 0,
91
- minWidth: 0,
92
- fontSize: '100%',
83
+ var select = /*#__PURE__*/_extends({}, base, {
84
+ display: 'block',
85
+ appearance: 'none',
93
86
  font: 'inherit',
94
- verticalAlign: 'baseline',
95
- WebkitTapHighlightColor: 'transparent'
96
- };
97
- var block = {
98
- display: 'block'
99
- };
100
- var body = {
101
- lineHeight: 1
102
- };
103
- var list = {
104
- listStyle: 'none'
105
- };
106
- var quote = {
107
- quotes: 'none',
108
- selectors: {
109
- '&:before, &:after': {
110
- content: "''"
111
- }
87
+ '&::-ms-expand': {
88
+ display: 'none'
112
89
  }
90
+ });
91
+
92
+ var textarea = /*#__PURE__*/_extends({}, base, {
93
+ display: 'block',
94
+ appearance: 'none',
95
+ font: 'inherit'
96
+ }); // Normalize
97
+ // ---------------
98
+
99
+
100
+ var normalize = {
101
+ base: base,
102
+ a: a,
103
+ p: text,
104
+ h1: text,
105
+ h2: text,
106
+ h3: text,
107
+ h4: text,
108
+ h5: text,
109
+ h6: text,
110
+ img: media,
111
+ picture: media,
112
+ video: media,
113
+ canvas: media,
114
+ svg: media,
115
+ select: select,
116
+ button: button,
117
+ textarea: textarea,
118
+ input: input
113
119
  };
114
- var table = {
115
- borderCollapse: 'collapse',
116
- borderSpacing: 0
120
+ /**
121
+ * Type-safe helper to get normalization. If no normalization is found,
122
+ * returns the *base* normalization.
123
+ */
124
+
125
+ var getNormalizedStyles = function getNormalizedStyles(val) {
126
+ return typeof val === 'string' && val in normalize ? normalize[val] // Typescript doesn't infer this correctly
127
+ : normalize.base;
117
128
  };
118
- var appearance = {
119
- appearance: 'none'
129
+
130
+ var _excluded = ["disabled"];
131
+
132
+ var isNil = function isNil(value) {
133
+ return value === null || value === undefined;
120
134
  };
121
- var field = [block, appearance];
122
- var mark = {
123
- backgroundColor: 'transparent',
124
- color: 'inherit'
135
+ /**
136
+ * Ensures that the `val` is an array. Will return an empty array if `val` is falsy.
137
+ */
138
+
139
+
140
+ var ensureArray = function ensureArray(val) {
141
+ return isNil(val) ? [] : Array.isArray(val) ? val : [val];
125
142
  };
126
- var select = /*#__PURE__*/[].concat(field, [{
127
- selectors: {
128
- '&::-ms-expand': {
129
- display: 'none'
130
- }
131
- }
132
- }]);
133
- var input = /*#__PURE__*/[].concat(field, [{
134
- selectors: {
135
- '&::-ms-clear': {
136
- display: 'none'
137
- },
138
- '&::-webkit-search-cancel-button': {
139
- WebkitAppearance: 'none'
140
- }
141
- }
142
- }]);
143
- var button = {
144
- background: 'none'
143
+ /**
144
+ * Removes trailing dot from variant, if necessary. This is necessary to support
145
+ * `__default` styles. See https://github.com/system-ui/theme-ui/pull/951
146
+ */
147
+
148
+ var ensureVariantDefault = function ensureVariantDefault(val) {
149
+ return val.replace(/\.$/, '');
145
150
  };
146
- var a = {
147
- textDecoration: 'none'
151
+ /**
152
+ * Ensures that the `variant` is an array and supports the `__default` key.
153
+ */
154
+
155
+ var ensureArrayVariant = function ensureArrayVariant(variant) {
156
+ return ensureArray(variant).map(ensureVariantDefault);
148
157
  };
149
- var el = {
150
- article: block,
151
- aside: block,
152
- details: block,
153
- figcaption: block,
154
- figure: block,
155
- footer: block,
156
- header: block,
157
- hgroup: block,
158
- menu: block,
159
- nav: block,
160
- section: block,
161
- ul: list,
162
- ol: list,
163
- blockquote: quote,
164
- q: quote,
165
- body: body,
166
- a: a,
167
- base: base,
168
- table: table,
169
- mark: mark,
170
- select: select,
171
- p: list,
172
- button: button,
173
- textarea: field,
174
- input: input
158
+ /**
159
+ * Appends given `state` to a `variant`.
160
+ */
161
+
162
+ var appendVariantState = function appendVariantState(variant, state) {
163
+ return ensureVariantDefault(variant) + ".:" + state;
175
164
  };
165
+ /**
166
+ * Create a variant array from a `variant` and `state` containing
167
+ * passed states, if they are truthy.
168
+ */
169
+
170
+ var conditional = function conditional(variant, _ref) {
171
+ var _ref$disabled = _ref.disabled,
172
+ disabled = _ref$disabled === void 0 ? false : _ref$disabled,
173
+ states = _objectWithoutPropertiesLoose(_ref, _excluded);
176
174
 
175
+ var entries = [].concat(Object.entries(states), [['disabled', disabled]]);
176
+ var stateVariants = entries.filter(function (_ref2) {
177
+ var val = _ref2[1];
178
+ return Boolean(val);
179
+ }).map(function (_ref3) {
180
+ var key = _ref3[0];
181
+ return appendVariantState(variant, key);
182
+ });
183
+ return [variant].concat(stateVariants);
184
+ };
185
+
186
+ var _excluded$1 = ["as", "children", "__baseCSS", "variant", "css", "display", "height", "width", "minWidth", "maxWidth", "position", "top", "bottom", "right", "left", "zIndex", "p", "px", "py", "pt", "pb", "pl", "pr", "m", "mx", "my", "mt", "mb", "ml", "mr", "flexDirection", "flexWrap", "flexShrink", "flexGrow", "alignItems", "justifyContent", "bg", "border", "borderRadius", "boxShadow", "opacity", "overflow", "transition"];
177
187
  /**
178
- * Hook function that can add base styles, normalization, variant and custom styles
188
+ * Check if there is any falsy value or empty object
179
189
  */
180
190
 
181
- var useStyles = function useStyles(_ref, classNames) {
182
- var element = _ref.element,
191
+ var isNotEmpty = function isNotEmpty(val) {
192
+ return !(val && Object.keys(val).length === 0 && val.constructor === Object);
193
+ };
194
+
195
+ var createThemedStyle = function createThemedStyle(_ref) {
196
+ var as = _ref.as,
197
+ __baseCSS = _ref.__baseCSS,
183
198
  variant = _ref.variant,
184
- styles = _objectWithoutPropertiesLoose(_ref, ["element", "variant"]);
199
+ styles = _ref.styles,
200
+ css = _ref.css;
201
+ return function (theme) {
202
+ return [getNormalizedStyles(as), css$1.css(__baseCSS)(theme)].concat(ensureArrayVariant(variant).map(function (v) {
203
+ return css$1.css({
204
+ variant: v
205
+ })(theme);
206
+ }), [css$1.css(styles)(theme), css$1.css(css)(theme)]).filter(isNotEmpty);
207
+ };
208
+ };
185
209
 
210
+ var Box = /*#__PURE__*/React.forwardRef(function (_ref2, ref) {
211
+ var _ref2$as = _ref2.as,
212
+ as = _ref2$as === void 0 ? 'div' : _ref2$as,
213
+ children = _ref2.children,
214
+ __baseCSS = _ref2.__baseCSS,
215
+ variant = _ref2.variant,
216
+ _ref2$css = _ref2.css,
217
+ css = _ref2$css === void 0 ? {} : _ref2$css,
218
+ display = _ref2.display,
219
+ height = _ref2.height,
220
+ width = _ref2.width,
221
+ minWidth = _ref2.minWidth,
222
+ maxWidth = _ref2.maxWidth,
223
+ position = _ref2.position,
224
+ top = _ref2.top,
225
+ bottom = _ref2.bottom,
226
+ right = _ref2.right,
227
+ left = _ref2.left,
228
+ zIndex = _ref2.zIndex,
229
+ p = _ref2.p,
230
+ px = _ref2.px,
231
+ py = _ref2.py,
232
+ pt = _ref2.pt,
233
+ pb = _ref2.pb,
234
+ pl = _ref2.pl,
235
+ pr = _ref2.pr,
236
+ m = _ref2.m,
237
+ mx = _ref2.mx,
238
+ my = _ref2.my,
239
+ mt = _ref2.mt,
240
+ mb = _ref2.mb,
241
+ ml = _ref2.ml,
242
+ mr = _ref2.mr,
243
+ flexDirection = _ref2.flexDirection,
244
+ flexWrap = _ref2.flexWrap,
245
+ flexShrink = _ref2.flexShrink,
246
+ flexGrow = _ref2.flexGrow,
247
+ alignItems = _ref2.alignItems,
248
+ justifyContent = _ref2.justifyContent,
249
+ bg = _ref2.bg,
250
+ border = _ref2.border,
251
+ borderRadius = _ref2.borderRadius,
252
+ boxShadow = _ref2.boxShadow,
253
+ opacity = _ref2.opacity,
254
+ overflow = _ref2.overflow,
255
+ transition = _ref2.transition,
256
+ props = _objectWithoutPropertiesLoose(_ref2, _excluded$1);
257
+
258
+ return react.jsx(as, _extends({}, props, {
259
+ css: createThemedStyle({
260
+ as: as,
261
+ __baseCSS: __baseCSS,
262
+ variant: variant,
263
+ css: css,
264
+ styles: {
265
+ display: display,
266
+ height: height,
267
+ width: width,
268
+ minWidth: minWidth,
269
+ maxWidth: maxWidth,
270
+ position: position,
271
+ top: top,
272
+ bottom: bottom,
273
+ right: right,
274
+ left: left,
275
+ zIndex: zIndex,
276
+ p: p,
277
+ px: px,
278
+ py: py,
279
+ pt: pt,
280
+ pb: pb,
281
+ pl: pl,
282
+ pr: pr,
283
+ m: m,
284
+ mx: mx,
285
+ my: my,
286
+ mt: mt,
287
+ mb: mb,
288
+ ml: ml,
289
+ mr: mr,
290
+ flexDirection: flexDirection,
291
+ flexWrap: flexWrap,
292
+ flexShrink: flexShrink,
293
+ flexGrow: flexGrow,
294
+ alignItems: alignItems,
295
+ justifyContent: justifyContent,
296
+ bg: bg,
297
+ border: border,
298
+ borderRadius: borderRadius,
299
+ boxShadow: boxShadow,
300
+ opacity: opacity,
301
+ overflow: overflow,
302
+ transition: transition
303
+ }
304
+ }),
305
+ ref: ref
306
+ }), children);
307
+ });
308
+
309
+ /**
310
+ * @internal
311
+ */
312
+
313
+ var __defaultTheme = {};
314
+ var InternalContext = /*#__PURE__*/React.createContext(__defaultTheme);
315
+ var useTheme = function useTheme() {
316
+ var theme = React.useContext(InternalContext);
186
317
  /**
187
- * Normalization styles looked up by html tag name(s). Base normalization
188
- * is always applied.
318
+ * We cast the theme here to `any` since our subset is not
319
+ * compatible with the typings of `theme-ui`, since they
320
+ * also support arrays as scale values, while we don't.
189
321
  */
190
- var elementArray = [];
191
322
 
192
- if (element) {
193
- element.push('base'); // always apply base styles
323
+ var css = React.useCallback(function (style) {
324
+ return css$1.css(style)(theme);
325
+ }, [theme]);
326
+ return {
327
+ theme: theme,
328
+ css: css
329
+ };
330
+ };
331
+ function ThemeProvider(_ref) {
332
+ var theme = _ref.theme,
333
+ children = _ref.children;
334
+ return React__default.createElement(react.ThemeProvider, {
335
+ theme: theme
336
+ }, React__default.createElement(InternalContext.Provider, {
337
+ value: theme
338
+ }, children));
339
+ }
340
+
341
+ /**
342
+ * CSS snippet and idea from:
343
+ * https://css-tricks.com/revisiting-prefers-reduced-motion-the-reduced-motion-media-query/
344
+ */
194
345
 
195
- elementArray = element;
196
- } else {
197
- elementArray = ['base'];
346
+ var reduceMotionStyles = {
347
+ '@media screen and (prefers-reduced-motion: reduce), (update: slow)': {
348
+ '*': {
349
+ animationDuration: '0.001ms !important',
350
+ animationIterationCount: '1 !important',
351
+ transitionDuration: '0.001ms !important'
352
+ }
198
353
  }
354
+ };
355
+ var Global = function Global() {
356
+ var _useTheme = useTheme(),
357
+ css = _useTheme.css;
199
358
 
200
- var resetStyles = el;
201
- var elements = elementArray.map(function (styleObject) {
202
- return resetStyles[styleObject];
359
+ var styles = css({
360
+ html: {
361
+ height: '100%',
362
+ variant: 'root.html'
363
+ },
364
+ body: {
365
+ height: '100%',
366
+ lineHeight: 1.5,
367
+ WebkitFontSmoothing: 'antialiased',
368
+ variant: 'root.body'
369
+ }
203
370
  });
204
- var elementObject = Object.assign.apply(Object, [{}].concat(elements));
205
- var basedOnNormalize = useClassname(elementObject);
206
- /**
207
- * Variants are retrieved from the theme.
208
- */
371
+ return React__default.createElement(react.Global, {
372
+ styles: _extends({
373
+ reduceMotionStyles: reduceMotionStyles
374
+ }, styles)
375
+ });
376
+ };
209
377
 
210
- var variants = Array.isArray(variant) ? variant.map(function (v) {
211
- return {
212
- variant: v
213
- };
214
- }) : [{
215
- variant: variant
216
- }];
217
- var basedOnVariants = useClassname.apply(void 0, variants);
218
- /**
219
- * Custom styles are applied "on runtime". They are usually controlled via component
220
- * props and can change between component instances. They are more or less the `css`
221
- * prop of `emotion`.
222
- */
378
+ var _excluded$2 = ["size", "children"];
379
+ var css = /*#__PURE__*/system.getNormalizedStyles('svg');
380
+ var SVG = function SVG(_ref) {
381
+ var _ref$size = _ref.size,
382
+ size = _ref$size === void 0 ? 24 : _ref$size,
383
+ children = _ref.children,
384
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$2);
223
385
 
224
- var custom = useClassname(styles);
225
- return [basedOnNormalize, basedOnVariants, custom, classNames].join(' ');
386
+ return react.jsx('svg', _extends({
387
+ width: size,
388
+ height: size,
389
+ viewBox: '0 0 24 24',
390
+ fill: 'currentcolor'
391
+ }, props, {
392
+ css: css
393
+ }), children);
226
394
  };
227
395
 
228
- exports.SPACE_PROPS = SPACE_PROPS;
396
+ exports.Box = Box;
397
+ exports.Global = Global;
398
+ exports.SVG = SVG;
229
399
  exports.ThemeProvider = ThemeProvider;
230
- exports.system = system;
231
- exports.useClassname = useClassname;
232
- exports.useStyles = useStyles;
400
+ exports.__defaultTheme = __defaultTheme;
401
+ exports.appendVariantState = appendVariantState;
402
+ exports.conditional = conditional;
403
+ exports.ensureArray = ensureArray;
404
+ exports.ensureArrayVariant = ensureArrayVariant;
405
+ exports.ensureVariantDefault = ensureVariantDefault;
406
+ exports.getNormalizedStyles = getNormalizedStyles;
407
+ exports.normalize = normalize;
233
408
  exports.useTheme = useTheme;
234
409
  //# sourceMappingURL=system.cjs.development.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"system.cjs.development.js","sources":["../src/categories.ts","../src/system.tsx","../src/useTheme.tsx","../src/useClassname.ts","../src/normalize.ts","../src/useStyles.ts"],"sourcesContent":["import { PropertiesFallback } from 'csstype';\n\n/**\n * System categories are based on https://primer.style/components/docs/system-props\n */\n\n// Spacing\n// ---------------\nexport const SPACE_PROPS = [\n 'm',\n 'margin',\n 'mt',\n 'marginTop',\n 'mr',\n 'marginRight',\n 'mb',\n 'marginBottom',\n 'ml',\n 'marginLeft',\n 'mx',\n 'marginX',\n 'my',\n 'marginY',\n 'p',\n 'padding',\n 'pt',\n 'paddingTop',\n 'pr',\n 'paddingRight',\n 'pb',\n 'paddingBottom',\n 'pl',\n 'paddingLeft',\n 'px',\n 'paddingX',\n 'py',\n 'paddingY',\n];\n\ntype StandardCSSProperties = PropertiesFallback<number | string>;\n\nexport type SpacingProps = {\n /**\n * The **`margin`** CSS property sets the margin area on all four sides of an element. It is a shorthand for `margin-top`, `margin-right`, `margin-bottom`, and `margin-left`.\n *\n * @see https://developer.mozilla.org/docs/Web/CSS/margin\n */\n m?: StandardCSSProperties['margin'];\n /**\n * The **`margin-top`** CSS property sets the margin area on the top of an element. A positive value places it farther from its neighbors, while a negative value places it closer.\n *\n * **Initial value**: `0`\n *\n * @see https://developer.mozilla.org/docs/Web/CSS/margin-top\n */\n mt?: StandardCSSProperties['marginTop'];\n /**\n * The **`margin-right`** CSS property sets the margin area on the right side of an element. A positive value places it farther from its neighbors, while a negative value places it closer.\n *\n * **Initial value**: `0`\n *\n * @see https://developer.mozilla.org/docs/Web/CSS/margin-right\n */\n mr?: StandardCSSProperties['marginRight'];\n /**\n * The **`margin-bottom`** CSS property sets the margin area on the bottom of an element. A positive value places it farther from its neighbors, while a negative value places it closer.\n *\n * **Initial value**: `0`\n *\n * @see https://developer.mozilla.org/docs/Web/CSS/margin-bottom\n */\n mb?: StandardCSSProperties['marginBottom'];\n /**\n * The **`margin-left`** CSS property sets the margin area on the left side of an element. A positive value places it farther from its neighbors, while a negative value places it closer.\n *\n * **Initial value**: `0`\n *\n * @see https://developer.mozilla.org/docs/Web/CSS/margin-left\n */\n ml?: StandardCSSProperties['marginLeft'];\n /**\n * The **`mx`** is shorthand for using both **`margin-left`** and **`margin-right`** CSS properties. They set the margin area on the left and right side of an element. A positive value placesit\n * farther from its neighbors, while a negative value places it closer.\n *\n * **Initial value**: `0`\n *\n * @see https://styled-system.com/#margin-props\n * @see https://developer.mozilla.org/docs/Web/CSS/margin-left\n * @see https://developer.mozilla.org/docs/Web/CSS/margin-right\n */\n mx?: StandardCSSProperties['marginLeft'];\n /**\n * The **`marginX`** is shorthand for using both **`margin-left`** and **`margin-right`** CSS properties. They set the margin area on the left and right side of an element. A positive value\n * places it farther from its neighbors, while a negative value places it closer.\n *\n * **Initial value**: `0`\n *\n * @see https://styled-system.com/#margin-props\n * @see https://developer.mozilla.org/docs/Web/CSS/margin-left\n * @see https://developer.mozilla.org/docs/Web/CSS/margin-right\n */\n marginX?: StandardCSSProperties['marginLeft'];\n /**\n * The **`my`** is shorthard for using both **`margin-top`** and **`margin-bottom`** CSS properties. They set the margin area on the top and bottom of an element. A positive value places it\n * farther from its neighbors, while a negative value places it closer.\n *\n * **Initial value**: `0`\n *\n * @see https://styled-system.com/#margin-props\n * @see https://developer.mozilla.org/docs/Web/CSS/margin-top\n * @see https://developer.mozilla.org/docs/Web/CSS/margin-bottom\n */\n my?: StandardCSSProperties['marginTop'];\n /**\n * The **`marginY`** is shorthard for using both **`margin-top`** and **`margin-bottom`** CSS properties. They set the margin area on the top and bottom of an element. A positive value places\n * it farther from its neighbors, while a negative value places it closer.\n *\n * **Initial value**: `0`\n *\n * @see https://styled-system.com/#margin-props\n * @see https://developer.mozilla.org/docs/Web/CSS/margin-top\n * @see https://developer.mozilla.org/docs/Web/CSS/margin-bottom\n */\n marginY?: StandardCSSProperties['marginTop'];\n /**\n * The **`padding`** CSS property sets the padding area on all four sides of an element. It is a shorthand for `padding-top`, `padding-right`, `padding-bottom`, and `padding-left`.\n *\n * @see https://developer.mozilla.org/docs/Web/CSS/padding\n */\n p?: StandardCSSProperties['padding'];\n /**\n * The **`padding-top`** padding area on the top of an element.\n *\n * **Initial value**: `0`\n *\n * @see https://developer.mozilla.org/docs/Web/CSS/padding-top\n */\n pt?: StandardCSSProperties['paddingTop'];\n /**\n * The **`padding-right`** CSS property sets the width of the padding area on the right side of an element.\n *\n * **Initial value**: `0`\n *\n * @see https://developer.mozilla.org/docs/Web/CSS/padding-right\n */\n pr?: StandardCSSProperties['paddingRight'];\n /**\n * The **`padding-bottom`** CSS property sets the height of the padding area on the bottom of an element.\n *\n * **Initial value**: `0`\n *\n * @see https://developer.mozilla.org/docs/Web/CSS/padding-bottom\n */\n pb?: StandardCSSProperties['paddingBottom'];\n /**\n * The **`padding-left`** CSS property sets the width of the padding area on the left side of an element.\n *\n * **Initial value**: `0`\n *\n * @see https://developer.mozilla.org/docs/Web/CSS/padding-left\n */\n pl?: StandardCSSProperties['paddingLeft'];\n /**\n * The **`px`** is shorthand property for CSS properties **`padding-left`** and **`padding-right`**. They set the width of the padding area on the left and right side of an element.\n *\n * **Initial value**: `0`\n *\n * @see https://styled-system.com/#padding-props\n * @see https://developer.mozilla.org/docs/Web/CSS/padding-left\n * @see https://developer.mozilla.org/docs/Web/CSS/padding-right\n */\n px?: StandardCSSProperties['paddingLeft'];\n /**\n * The **`paddingX`** is shorthand property for CSS properties **`padding-left`** and **`padding-right`**. They set the width of the padding area on the left and right side of an element.\n *\n * **Initial value**: `0`\n *\n * @see https://styled-system.com/#padding-props\n * @see https://developer.mozilla.org/docs/Web/CSS/padding-left\n * @see https://developer.mozilla.org/docs/Web/CSS/padding-right\n */\n paddingX?: StandardCSSProperties['paddingLeft'];\n /**\n * The **`py`** is shorthand property for CSS properties **`padding-top`** and **`padding-bottom`**. They set the width of the padding area on the top and bottom of an element.\n *\n * **Initial value**: `0`\n *\n * @see https://styled-system.com/#padding-props\n * @see https://developer.mozilla.org/docs/Web/CSS/padding-top\n * @see https://developer.mozilla.org/docs/Web/CSS/padding-bottom\n */\n py?: StandardCSSProperties['paddingTop'];\n /**\n * The **`paddingY`** is shorthand property for CSS properties **`padding-top`** and **`padding-bottom`**. They set the width of the padding area on the top and bottom of an element.\n *\n * **Initial value**: `0`\n *\n * @see https://styled-system.com/#padding-props\n * @see https://developer.mozilla.org/docs/Web/CSS/padding-top\n * @see https://developer.mozilla.org/docs/Web/CSS/padding-bottom\n */\n paddingY?: StandardCSSProperties['paddingTop'];\n};\n","/**\n * Typings are based on [Reach UI](https://github.com/reach/reach-ui/blob/4cb497f530b0f83f80c6f6f2da46ab55b1160cb6/packages/utils/src/types.tsx).\n */\nimport {\n forwardRef,\n ComponentPropsWithRef,\n ElementType,\n ReactElement,\n ValidationMap,\n WeakValidationMap,\n} from 'react';\n\n/**\n * SystemProps support the `as` and `variant` prop. The former\n * is used to changed the rendered root element of a component.\n *\n * These props also infer additional allowed props based on the\n * value of the `as` prop. For example, setting `as=\"button\"` will\n * allow to use HTMLButtonAttributes on the component.\n */\nexport type SystemProps<P, T extends ElementType> = P &\n Omit<ComponentPropsWithRef<T>, 'as' | keyof P> & {\n as?: T;\n variant?: string;\n };\n\n/**\n * Enhanced version of `React.FunctionComponent` that accepts `SystemProps`\n * and infers allowed properties based on the `as` prop.\n */\nexport interface SystemComponent<P, T extends ElementType> {\n /**\n * These types are a bit of a hack, but cover us in cases where the `as` prop\n * is not a JSX string type. Makes the compiler happy so 🤷‍♂️\n */\n <TT extends ElementType>(props: SystemProps<P, TT>): ReactElement | null;\n (props: SystemProps<P, T>): ReactElement | null;\n\n displayName?: string;\n propTypes?: WeakValidationMap<SystemProps<P, T>>;\n contextTypes?: ValidationMap<any>;\n defaultProps?: Partial<SystemProps<P, T>>;\n}\n\n/**\n * Helper to write components that adhere to a common design system API,\n * which includes the `as` and `variant` prop.\n */\nexport function system<P, T extends ElementType>(\n render: (props: SystemProps<P, T>) => ReactElement | null\n) {\n return forwardRef((props: any, ref) =>\n render({ ...props, ref })\n ) as SystemComponent<P, T>;\n}\n","import React, { createContext, useContext } from 'react';\n\nconst Context = createContext({});\n\nexport const useTheme = () => useContext(Context);\n\nexport type ThemeProviderProps = { theme: any };\nexport const ThemeProvider: React.FC<ThemeProviderProps> = ({\n theme,\n children,\n}) => <Context.Provider value={theme}>{children}</Context.Provider>;\n","import { css as emotion } from 'emotion';\nimport { css, ThemeUIStyleObject } from '@theme-ui/css';\nimport { useTheme } from './useTheme';\n\nexport const useClassname = (...styles: ThemeUIStyleObject[]) => {\n const theme = useTheme();\n return styles.map(style => emotion(css(style)(theme))).join(' ');\n};\n","import { CSSObject } from '@marigold/components/src';\n\nconst base = {\n boxSizing: 'border-box',\n margin: 0,\n padding: 0,\n minWidth: 0,\n fontSize: '100%',\n font: 'inherit',\n verticalAlign: 'baseline',\n WebkitTapHighlightColor: 'transparent',\n};\n\nconst block = {\n display: 'block',\n};\n\nconst body = {\n lineHeight: 1,\n};\n\nconst list = {\n listStyle: 'none',\n};\n\nconst quote = {\n quotes: 'none',\n selectors: {\n '&:before, &:after': {\n content: \"''\",\n },\n },\n};\n\nconst table = {\n borderCollapse: 'collapse',\n borderSpacing: 0,\n};\n\nconst appearance = {\n appearance: 'none',\n};\n\nconst field = [block, appearance];\n\nconst mark = {\n backgroundColor: 'transparent',\n color: 'inherit',\n};\n\nconst select = [\n ...field,\n {\n selectors: {\n '&::-ms-expand': {\n display: 'none',\n },\n },\n },\n];\n\nconst input = [\n ...field,\n {\n selectors: {\n '&::-ms-clear': {\n display: 'none',\n },\n '&::-webkit-search-cancel-button': {\n WebkitAppearance: 'none',\n },\n },\n },\n];\n\nconst button = {\n background: 'none',\n};\n\nconst a = {\n textDecoration: 'none',\n};\n\nexport const el: BaseNormalization = {\n article: block,\n aside: block,\n details: block,\n figcaption: block,\n figure: block,\n footer: block,\n header: block,\n hgroup: block,\n menu: block,\n nav: block,\n section: block,\n ul: list,\n ol: list,\n blockquote: quote,\n q: quote,\n body,\n a,\n base,\n table,\n mark,\n select,\n p: list,\n button,\n textarea: field,\n input,\n};\n\ntype BaseNormalization = {\n [key: string]: CSSObject;\n};\n","import { useClassname } from './useClassname';\n\nimport * as resetStyleRefs from './normalize';\nimport { ElementType } from 'react';\n\nexport type StylesProps = {\n element?: ElementType[];\n variant?: string | string[];\n [key: string]: any;\n};\n\n/**\n * Hook function that can add base styles, normalization, variant and custom styles\n */\nexport const useStyles = (\n { element, variant, ...styles }: StylesProps,\n classNames?: string\n) => {\n /**\n * Normalization styles looked up by html tag name(s). Base normalization\n * is always applied.\n */\n var elementArray: ElementType[] = [];\n if (element) {\n element.push('base'); // always apply base styles\n elementArray = element;\n } else {\n elementArray = ['base'];\n }\n const resetStyles = resetStyleRefs.el;\n const elements: { [key: string]: any }[] = elementArray.map(\n styleObject => resetStyles[styleObject as keyof typeof resetStyleRefs.el]\n );\n\n const elementObject = Object.assign({}, ...elements);\n\n const basedOnNormalize = useClassname(elementObject);\n\n /**\n * Variants are retrieved from the theme.\n */\n const variants = Array.isArray(variant)\n ? variant.map(v => ({ variant: v }))\n : [{ variant }];\n\n const basedOnVariants = useClassname(...variants);\n\n /**\n * Custom styles are applied \"on runtime\". They are usually controlled via component\n * props and can change between component instances. They are more or less the `css`\n * prop of `emotion`.\n */\n const custom = useClassname(styles);\n\n return [basedOnNormalize, basedOnVariants, custom, classNames].join(' ');\n};\n"],"names":["SPACE_PROPS","system","render","forwardRef","props","ref","Context","createContext","useTheme","useContext","ThemeProvider","theme","children","React","Provider","value","useClassname","styles","map","style","emotion","css","join","base","boxSizing","margin","padding","minWidth","fontSize","font","verticalAlign","WebkitTapHighlightColor","block","display","body","lineHeight","list","listStyle","quote","quotes","selectors","content","table","borderCollapse","borderSpacing","appearance","field","mark","backgroundColor","color","select","input","WebkitAppearance","button","background","a","textDecoration","el","article","aside","details","figcaption","figure","footer","header","hgroup","menu","nav","section","ul","ol","blockquote","q","p","textarea","useStyles","classNames","element","variant","elementArray","push","resetStyles","resetStyleRefs","elements","styleObject","elementObject","Object","assign","basedOnNormalize","variants","Array","isArray","v","basedOnVariants","custom"],"mappings":";;;;;;;;;AAEA;;;AAIA;AACA;IACaA,WAAW,GAAG,CACzB,GADyB,EAEzB,QAFyB,EAGzB,IAHyB,EAIzB,WAJyB,EAKzB,IALyB,EAMzB,a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A,MAAI8D,YAAY,GAAkB,EAAlC;;AACA,MAAIF,OAAJ,EAAa;AACXA,IAAAA,OAAO,CAACG,IAAR,CAAa,MAAb,EADW;;AAEXD,IAAAA,YAAY,GAAGF,OAAf;AACD,GAHD,MAGO;AACLE,IAAAA,YAAY,GAAG,CAAC,MAAD,CAAf;AACD;;AACD,MAAME,WAAW,GAAGC,EAApB;AACA,MAAMC,QAAQ,GAA6BJ,YAAY,CAAC7D,GAAb,CACzC,UAAAkE,WAAW;AAAA,WAAIH,WAAW,CAACG,WAAD,CAAf;AAAA,GAD8B,CAA3C;AAIA,MAAMC,aAAa,GAAGC,MAAM,CAACC,MAAP,OAAAD,MAAM,GAAQ,EAAR,SAAeH,QAAf,EAA5B;AAEA,MAAMK,gBAAgB,GAAGxE,YAAY,CAACqE,aAAD,CAArC;AAEA;;;;AAGA,MAAMI,QAAQ,GAAGC,KAAK,CAACC,OAAN,CAAcb,OAAd,IACbA,OAAO,CAAC5D,GAAR,CAAY,UAAA0E,CAAC;AAAA,WAAK;AAAEd,MAAAA,OAAO,EAAEc;AAAX,KAAL;AAAA,GAAb,CADa,GAEb,CAAC;AAAEd,IAAAA,OAAO,EAAPA;AAAF,GAAD,CAFJ;AAIA,MAAMe,eAAe,GAAG7E,YAAY,MAAZ,SAAgByE,QAAhB,CAAxB;AAEA;;;;;;AAKA,MAAMK,MAAM,GAAG9E,YAAY,CAACC,MAAD,CAA3B;AAEA,SAAO,CAACuE,gBAAD,EAAmBK,eAAnB,EAAoCC,MAApC,EAA4ClB,UAA5C,EAAwDtD,IAAxD,CAA6D,GAA7D,CAAP;AACD,CAzCM;;;;;;;;;"}
1
+ {"version":3,"file":"system.cjs.development.js","sources":["../src/normalize.ts","../src/variant.ts","../src/Box.tsx","../src/useTheme.tsx","../src/Global.tsx","../src/SVG.tsx"],"sourcesContent":["/**\n * Normalize styling of certain elements between browsers.\n * Based on https://www.joshwcomeau.com/css/custom-css-reset/\n */\nimport { ElementType } from 'react';\n\nconst base = {\n boxSizing: 'border-box',\n margin: 0,\n minWidth: 0,\n} as const;\n\nconst a = {\n ...base,\n textDecoration: 'none',\n} as const;\n\nconst text = {\n ...base,\n overflowWrap: 'break-word',\n} as const;\n\nconst media = {\n ...base,\n display: 'block',\n maxWidth: '100%',\n} as const;\n\nconst button = {\n ...base,\n display: 'block',\n appearance: 'none',\n font: 'inherit',\n background: 'transparent',\n textAlign: 'center',\n} as const;\n\nconst input = {\n ...base,\n display: 'block',\n appearance: 'none',\n font: 'inherit',\n '&::-ms-clear': {\n display: 'none',\n },\n '&::-webkit-search-cancel-button': {\n WebkitAppearance: 'none',\n },\n} as const;\n\nconst select = {\n ...base,\n display: 'block',\n appearance: 'none',\n font: 'inherit',\n '&::-ms-expand': {\n display: 'none',\n },\n} as const;\n\nconst textarea = {\n ...base,\n display: 'block',\n appearance: 'none',\n font: 'inherit',\n} as const;\n\n// Normalize\n// ---------------\nexport const normalize = {\n base,\n a,\n p: text,\n h1: text,\n h2: text,\n h3: text,\n h4: text,\n h5: text,\n h6: text,\n img: media,\n picture: media,\n video: media,\n canvas: media,\n svg: media,\n select,\n button,\n textarea,\n input,\n} as const;\n\nexport type NormalizedElement = keyof typeof normalize;\n\n/**\n * Type-safe helper to get normalization. If no normalization is found,\n * returns the *base* normalization.\n */\nexport const getNormalizedStyles = (val?: ElementType) =>\n typeof val === 'string' && val in normalize\n ? normalize[val as NormalizedElement] // Typescript doesn't infer this correctly\n : normalize.base;\n","const isNil = (value: any): value is null | undefined =>\n value === null || value === undefined;\n\n/**\n * Ensures that the `val` is an array. Will return an empty array if `val` is falsy.\n */\nexport const ensureArray = <T>(val?: T | T[]) =>\n isNil(val) ? [] : Array.isArray(val) ? val : [val];\n\n/**\n * Removes trailing dot from variant, if necessary. This is necessary to support\n * `__default` styles. See https://github.com/system-ui/theme-ui/pull/951\n */\nexport const ensureVariantDefault = (val: string) => val.replace(/\\.$/, '');\n\n/**\n * Ensures that the `variant` is an array and supports the `__default` key.\n */\nexport const ensureArrayVariant = <T extends string>(variant?: T | T[]) =>\n ensureArray(variant).map(ensureVariantDefault);\n\nexport type State = {\n checked?: boolean;\n focus?: boolean;\n hover?: boolean;\n disabled?: boolean;\n error?: boolean;\n};\n\n/**\n * Appends given `state` to a `variant`.\n */\nexport const appendVariantState = (variant: string, state: keyof State) => {\n return `${ensureVariantDefault(variant)}.:${state}`;\n};\n\n/**\n * Create a variant array from a `variant` and `state` containing\n * passed states, if they are truthy.\n */\nexport const conditional = (\n variant: string,\n { disabled = false, ...states }: State\n) => {\n const entries = [...Object.entries(states), ['disabled', disabled]] as [\n keyof State,\n boolean\n ][];\n const stateVariants = entries\n .filter(([, val]) => Boolean(val))\n .map(([key]) => appendVariantState(variant, key));\n\n return [variant, ...stateVariants];\n};\n","import { jsx, Theme } from '@emotion/react';\nimport { css as transformStyleObject } from '@theme-ui/css';\nimport { forwardRef } from 'react';\nimport {\n PolymorphicPropsWithRef,\n PolymorphicComponentWithRef,\n} from '@marigold/types';\n\nimport { getNormalizedStyles } from './normalize';\nimport { CSSObject } from './types';\nimport { ensureArrayVariant } from './variant';\n\nexport type StyleProps = Pick<\n CSSObject,\n | 'display'\n | 'height'\n | 'width'\n | 'minWidth'\n | 'maxWidth'\n | 'position'\n | 'top'\n | 'bottom'\n | 'right'\n | 'left'\n | 'zIndex'\n | 'p'\n | 'px'\n | 'py'\n | 'pt'\n | 'pb'\n | 'pl'\n | 'pr'\n | 'm'\n | 'mx'\n | 'my'\n | 'mt'\n | 'mb'\n | 'ml'\n | 'mr'\n | 'flexDirection'\n | 'flexWrap'\n | 'flexShrink'\n | 'flexGrow'\n | 'alignItems'\n | 'justifyContent'\n | 'bg'\n | 'border'\n | 'borderRadius'\n | 'boxShadow'\n | 'opacity'\n | 'overflow'\n | 'transition'\n>;\n\nexport type BoxOwnProps = {\n css?: CSSObject;\n variant?: string | string[];\n /**\n * Use to set base styles for the component\n * @internal Used to set default styles for Marigold components\n */\n __baseCSS?: CSSObject;\n} & StyleProps;\n\nexport type BoxProps = PolymorphicPropsWithRef<BoxOwnProps, 'div'>;\n\n/**\n * Check if there is any falsy value or empty object\n */\nconst isNotEmpty = (val: any) =>\n !(val && Object.keys(val).length === 0 && val.constructor === Object);\n\ntype CreateStyleProps = {\n as?: BoxProps['as'];\n __baseCSS?: BoxOwnProps['__baseCSS'];\n variant?: BoxOwnProps['variant'];\n css?: BoxOwnProps['css'];\n styles?: StyleProps;\n};\n\nconst createThemedStyle =\n ({ as, __baseCSS, variant, styles, css }: CreateStyleProps) =>\n (theme: Theme) => {\n return [\n getNormalizedStyles(as),\n transformStyleObject(__baseCSS)(theme),\n ...ensureArrayVariant(variant).map(v =>\n transformStyleObject({ variant: v })(theme)\n ),\n transformStyleObject(styles)(theme),\n transformStyleObject(css)(theme),\n ].filter(isNotEmpty);\n };\n\nexport const Box: PolymorphicComponentWithRef<BoxOwnProps, 'div'> = forwardRef(\n (\n {\n as = 'div',\n children,\n __baseCSS,\n variant,\n css = {},\n display,\n height,\n width,\n minWidth,\n maxWidth,\n position,\n top,\n bottom,\n right,\n left,\n zIndex,\n p,\n px,\n py,\n pt,\n pb,\n pl,\n pr,\n m,\n mx,\n my,\n mt,\n mb,\n ml,\n mr,\n flexDirection,\n flexWrap,\n flexShrink,\n flexGrow,\n alignItems,\n justifyContent,\n bg,\n border,\n borderRadius,\n boxShadow,\n opacity,\n overflow,\n transition,\n ...props\n },\n ref\n ) =>\n jsx(\n as,\n {\n ...props,\n css: createThemedStyle({\n as,\n __baseCSS,\n variant,\n css,\n styles: {\n display,\n height,\n width,\n minWidth,\n maxWidth,\n position,\n top,\n bottom,\n right,\n left,\n zIndex,\n p,\n px,\n py,\n pt,\n pb,\n pl,\n pr,\n m,\n mx,\n my,\n mt,\n mb,\n ml,\n mr,\n flexDirection,\n flexWrap,\n flexShrink,\n flexGrow,\n alignItems,\n justifyContent,\n bg,\n border,\n borderRadius,\n boxShadow,\n opacity,\n overflow,\n transition,\n },\n }),\n ref,\n },\n children\n )\n);\n","import React, {\n createContext,\n ReactNode,\n useCallback,\n useContext,\n} from 'react';\nimport { css as transformStyleObject } from '@theme-ui/css';\nimport { ThemeProvider as EmotionProvider } from '@emotion/react';\n\nimport { Theme } from './theme';\nimport { StyleObject } from './types';\n\n/**\n * @internal\n */\nexport const __defaultTheme: Theme = {};\n\nconst InternalContext = createContext<Theme>(__defaultTheme);\n\nexport const useTheme = () => {\n const theme = useContext(InternalContext);\n /**\n * We cast the theme here to `any` since our subset is not\n * compatible with the typings of `theme-ui`, since they\n * also support arrays as scale values, while we don't.\n */\n const css = useCallback(\n (style: StyleObject) => transformStyleObject(style)(theme as any),\n [theme]\n );\n return { theme, css };\n};\n\nexport type ThemeProviderProps<T extends Theme> = {\n theme: T;\n children: ReactNode;\n};\n\nexport function ThemeProvider<T extends Theme>({\n theme,\n children,\n}: ThemeProviderProps<T>) {\n return (\n <EmotionProvider theme={theme}>\n <InternalContext.Provider value={theme}>\n {children}\n </InternalContext.Provider>\n </EmotionProvider>\n );\n}\n","import React from 'react';\nimport { Global as EmotionGlobal } from '@emotion/react';\nimport { useTheme } from './useTheme';\n\n/**\n * CSS snippet and idea from:\n * https://css-tricks.com/revisiting-prefers-reduced-motion-the-reduced-motion-media-query/\n */\nconst reduceMotionStyles = {\n '@media screen and (prefers-reduced-motion: reduce), (update: slow)': {\n '*': {\n animationDuration: '0.001ms !important',\n animationIterationCount: '1 !important',\n transitionDuration: '0.001ms !important',\n },\n },\n};\n\nexport const Global = () => {\n const { css } = useTheme();\n const styles = css({\n html: {\n height: '100%',\n variant: 'root.html',\n },\n body: {\n height: '100%',\n lineHeight: 1.5,\n WebkitFontSmoothing: 'antialiased',\n variant: 'root.body',\n },\n });\n return <EmotionGlobal styles={{ reduceMotionStyles, ...styles }} />;\n};\n","import React from 'react';\nimport { jsx } from '@emotion/react';\nimport { ComponentProps } from '@marigold/types';\nimport { getNormalizedStyles } from '@marigold/system';\n\nconst css = getNormalizedStyles('svg');\n\nexport type SVGProps = {\n size?: number;\n} & ComponentProps<'svg'>;\n\nexport const SVG: React.FC<SVGProps> = ({ size = 24, children, ...props }) =>\n jsx(\n 'svg',\n {\n width: size,\n height: size,\n viewBox: '0 0 24 24',\n fill: 'currentcolor',\n ...props,\n css,\n },\n children\n );\n"],"names":["base","boxSizing","margin","minWidth","a","textDecoration","text","overflowWrap","media","display","maxWidth","button","appearance","font","background","textAlign","input","WebkitAppearance","select","textarea","normalize","p","h1","h2","h3","h4","h5","h6","img","picture","video","canvas","svg","getNormalizedStyles","val","isNil","value","undefined","ensureArray","Array","isArray","ensureVariantDefault","replace","ensureArrayVariant","variant","map","appendVariantState","state","conditional","disabled","states","entries","Object","stateVariants","filter","Boolean","key","isNotEmpty","keys","length","constructor","createThemedStyle","as","__baseCSS","styles","css","theme","transformStyleObject","v","Box","forwardRef","ref","children","height","width","position","top","bottom","right","left","zIndex","px","py","pt","pb","pl","pr","m","mx","my","mt","mb","ml","mr","flexDirection","flexWrap","flexShrink","flexGrow","alignItems","justifyContent","bg","border","borderRadius","boxShadow","opacity","overflow","transition","props","jsx","__defaultTheme","InternalContext","createContext","useTheme","useContext","useCallback","style","ThemeProvider","React","EmotionProvider","Provider","reduceMotionStyles","animationDuration","animationIterationCount","transitionDuration","Global","html","body","lineHeight","WebkitFontSmoothing","EmotionGlobal","SVG","size","viewBox","fill"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA,IAAMA,IAAI,GAAG;AACXC,EAAAA,SAAS,EAAE,YADA;AAEXC,EAAAA,MAAM,EAAE,CAFG;AAGXC,EAAAA,QAAQ,EAAE;AAHC,CAAb;;AAMA,IAAMC,CAAC,6BACFJ,IADE;AAELK,EAAAA,cAAc,EAAE;AAFX,EAAP;;AAKA,IAAMC,IAAI,6BACLN,IADK;AAERO,EAAAA,YAAY,EAAE;AAFN,EAAV;;AAKA,IAAMC,KAAK,6BACNR,IADM;AAETS,EAAAA,OAAO,EAAE,OAFA;AAGTC,EAAAA,QAA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