@marigold/system 0.6.0 → 0.9.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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2021 Marigold UI
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/dist/index.d.ts CHANGED
@@ -1,17 +1,14 @@
1
- import { PolymorphicPropsWithRef, PolymorphicComponentWithRef, ComponentProps } from '@marigold/types';
1
+ import { Simplify, PolymorphicPropsWithRef, PolymorphicComponentWithRef, ComponentProps } from '@marigold/types';
2
2
  import * as _theme_ui_css from '@theme-ui/css';
3
3
  import { ResponsiveStyleValue as ResponsiveStyleValue$1, ThemeUIStyleObject, ThemeUICSSObject, ThemeUICSSProperties, NestedScaleDict } from '@theme-ui/css';
4
- import React, { ElementType, ReactNode } from 'react';
4
+ import * as react from 'react';
5
+ import { ReactNode, ElementType } from 'react';
5
6
  import * as CSS from 'csstype';
6
7
 
7
- /**
8
- * Create type aliases for `theme-ui` so that it doesn't leak too much into our code.
9
- */
10
-
11
8
  declare type ResponsiveStyleValue<T> = ResponsiveStyleValue$1<T>;
12
9
  declare type StyleObject = ThemeUIStyleObject;
13
- declare type CSSObject = ThemeUICSSObject;
14
- declare type CSSProperties = ThemeUICSSProperties;
10
+ declare type CSSObject = Simplify<ThemeUICSSObject>;
11
+ declare type CSSProperties = Simplify<ThemeUICSSProperties>;
15
12
 
16
13
  interface StyleProps extends Pick<CSSObject, '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'> {
17
14
  }
@@ -30,160 +27,52 @@ declare const Box: PolymorphicComponentWithRef<BoxOwnProps, 'div'>;
30
27
 
31
28
  declare const Global: () => JSX.Element;
32
29
 
30
+ interface SVGProps extends ComponentProps<'svg'> {
31
+ size?: number | string | number[] | string[];
32
+ }
33
+ declare const SVG: ({ size, fill, children, ...props }: SVGProps) => react.ReactSVGElement;
34
+
33
35
  /**
34
- * Normalize styling of certain elements between browsers.
35
- * Based on https://www.joshwcomeau.com/css/custom-css-reset/
36
+ * Props that every component should accepts to change the styling
36
37
  */
37
-
38
- declare const normalize: {
39
- readonly base: {
40
- readonly boxSizing: "border-box";
41
- readonly margin: 0;
42
- readonly minWidth: 0;
43
- };
44
- readonly a: {
45
- readonly textDecoration: "none";
46
- readonly boxSizing: "border-box";
47
- readonly margin: 0;
48
- readonly minWidth: 0;
49
- };
50
- readonly p: {
51
- readonly overflowWrap: "break-word";
52
- readonly boxSizing: "border-box";
53
- readonly margin: 0;
54
- readonly minWidth: 0;
55
- };
56
- readonly h1: {
57
- readonly overflowWrap: "break-word";
58
- readonly boxSizing: "border-box";
59
- readonly margin: 0;
60
- readonly minWidth: 0;
61
- };
62
- readonly h2: {
63
- readonly overflowWrap: "break-word";
64
- readonly boxSizing: "border-box";
65
- readonly margin: 0;
66
- readonly minWidth: 0;
67
- };
68
- readonly h3: {
69
- readonly overflowWrap: "break-word";
70
- readonly boxSizing: "border-box";
71
- readonly margin: 0;
72
- readonly minWidth: 0;
73
- };
74
- readonly h4: {
75
- readonly overflowWrap: "break-word";
76
- readonly boxSizing: "border-box";
77
- readonly margin: 0;
78
- readonly minWidth: 0;
79
- };
80
- readonly h5: {
81
- readonly overflowWrap: "break-word";
82
- readonly boxSizing: "border-box";
83
- readonly margin: 0;
84
- readonly minWidth: 0;
85
- };
86
- readonly h6: {
87
- readonly overflowWrap: "break-word";
88
- readonly boxSizing: "border-box";
89
- readonly margin: 0;
90
- readonly minWidth: 0;
91
- };
92
- readonly img: {
93
- readonly display: "block";
94
- readonly maxWidth: "100%";
95
- readonly boxSizing: "border-box";
96
- readonly margin: 0;
97
- readonly minWidth: 0;
98
- };
99
- readonly picture: {
100
- readonly display: "block";
101
- readonly maxWidth: "100%";
102
- readonly boxSizing: "border-box";
103
- readonly margin: 0;
104
- readonly minWidth: 0;
105
- };
106
- readonly video: {
107
- readonly display: "block";
108
- readonly maxWidth: "100%";
109
- readonly boxSizing: "border-box";
110
- readonly margin: 0;
111
- readonly minWidth: 0;
112
- };
113
- readonly canvas: {
114
- readonly display: "block";
115
- readonly maxWidth: "100%";
116
- readonly boxSizing: "border-box";
117
- readonly margin: 0;
118
- readonly minWidth: 0;
119
- };
120
- readonly svg: {
121
- readonly display: "block";
122
- readonly maxWidth: "100%";
123
- readonly boxSizing: "border-box";
124
- readonly margin: 0;
125
- readonly minWidth: 0;
126
- };
127
- readonly select: {
128
- readonly display: "block";
129
- readonly appearance: "none";
130
- readonly font: "inherit";
131
- readonly '&::-ms-expand': {
132
- readonly display: "none";
133
- };
134
- readonly boxSizing: "border-box";
135
- readonly margin: 0;
136
- readonly minWidth: 0;
137
- };
138
- readonly button: {
139
- readonly display: "block";
140
- readonly appearance: "none";
141
- readonly font: "inherit";
142
- readonly background: "transparent";
143
- readonly textAlign: "center";
144
- readonly boxSizing: "border-box";
145
- readonly margin: 0;
146
- readonly minWidth: 0;
147
- };
148
- readonly textarea: {
149
- readonly display: "block";
150
- readonly appearance: "none";
151
- readonly font: "inherit";
152
- readonly boxSizing: "border-box";
153
- readonly margin: 0;
154
- readonly minWidth: 0;
155
- };
156
- readonly input: {
157
- readonly display: "block";
158
- readonly appearance: "none";
159
- readonly font: "inherit";
160
- readonly '&::-ms-clear': {
161
- readonly display: "none";
38
+ declare type ThemeComponentProps = {
39
+ variant?: string;
40
+ size?: string;
41
+ };
42
+ /**
43
+ * Structure for component styles in a theme.
44
+ */
45
+ declare type ThemeExtension<ComponentName extends string> = {
46
+ [P in ComponentName]?: {
47
+ base?: CSSObject;
48
+ variant?: {
49
+ [key: string]: CSSObject;
162
50
  };
163
- readonly '&::-webkit-search-cancel-button': {
164
- readonly WebkitAppearance: "none";
51
+ size?: {
52
+ [key: string]: CSSObject;
165
53
  };
166
- readonly boxSizing: "border-box";
167
- readonly margin: 0;
168
- readonly minWidth: 0;
169
54
  };
170
55
  };
171
- declare type NormalizedElement = keyof typeof normalize;
172
56
  /**
173
- * Type-safe helper to get normalization. If no normalization is found,
174
- * returns the *base* normalization.
57
+ * Structure for component styles in a theme that consists of multiple parts.
175
58
  */
176
- declare const getNormalizedStyles: (val?: ElementType<any> | undefined) => {
177
- readonly boxSizing: "border-box";
178
- readonly margin: 0;
179
- readonly minWidth: 0;
59
+ declare type ThemeExtensionsWithParts<ComponentName extends string, Parts extends string[]> = {
60
+ [P in ComponentName]?: {
61
+ base?: {
62
+ [Part in Parts[number]]?: CSSObject;
63
+ };
64
+ variant?: {
65
+ [key: string]: {
66
+ [Part in Parts[number]]?: CSSObject;
67
+ };
68
+ };
69
+ size?: {
70
+ [key: string]: {
71
+ [Part in Parts[number]]?: CSSObject;
72
+ };
73
+ };
74
+ };
180
75
  };
181
-
182
- interface SVGProps extends ComponentProps<'svg'> {
183
- size?: number;
184
- }
185
- declare const SVG: React.FC<SVGProps>;
186
-
187
76
  /**
188
77
  * Value used to define a scale.
189
78
  *
@@ -330,6 +219,22 @@ interface Theme {
330
219
  transitions?: Scale<CSS.Property.Transition>;
331
220
  }
332
221
 
222
+ interface ComponentStylesProps {
223
+ variant?: string;
224
+ size?: string;
225
+ }
226
+ declare type ComponentStyleParts<Parts extends string[]> = {
227
+ [P in Parts[number]]: CSSObject;
228
+ };
229
+ declare function useComponentStyles(componentName: string, props?: ComponentStylesProps, options?: {
230
+ parts: never;
231
+ }): CSSObject;
232
+ declare function useComponentStyles<Part extends string, Parts extends ReadonlyArray<Part>>(componentName: string, props?: ComponentStylesProps, options?: {
233
+ parts: Parts;
234
+ }): {
235
+ [P in Parts[number]]: CSSObject;
236
+ };
237
+
333
238
  /**
334
239
  * Hook that can be used to return values based on the current screen size,
335
240
  * using breakpoints from the theme (`theme.breakpoints`). Note that this
@@ -337,6 +242,21 @@ interface Theme {
337
242
  */
338
243
  declare const useResponsiveValue: <T>(values: T[], defaultIndex?: number) => T;
339
244
 
245
+ declare type ComponentState = 'hover' | 'focus' | 'active' | 'visited' | 'disabled' | 'readOnly' | 'checked' | 'indeterminate' | 'error';
246
+ declare type StateAttrKeyProps = `data-${Lowercase<ComponentState>}`;
247
+ declare type StateAttrProps = {
248
+ [key in StateAttrKeyProps]?: '';
249
+ };
250
+ declare type UseStateProps = {
251
+ [key in ComponentState]?: boolean;
252
+ };
253
+ /**
254
+ * Given a map of states (e.g. `{ hover: true, focus: false }`) returns an
255
+ * object that can be used to set state props on a component
256
+ * (e.g. `[data-hover]` and `[data-focus]`).
257
+ */
258
+ declare const useStateProps: (states: UseStateProps) => StateAttrProps;
259
+
340
260
  /**
341
261
  * @internal
342
262
  */
@@ -344,6 +264,7 @@ declare const __defaultTheme: Theme;
344
264
  declare const useTheme: () => {
345
265
  theme: Theme;
346
266
  css: (style: StyleObject) => _theme_ui_css.CSSObject;
267
+ get: (path: string) => any;
347
268
  };
348
269
  interface ThemeProviderProps<T extends Theme> {
349
270
  theme: T;
@@ -351,6 +272,155 @@ interface ThemeProviderProps<T extends Theme> {
351
272
  }
352
273
  declare function ThemeProvider<T extends Theme>({ theme, children, }: ThemeProviderProps<T>): JSX.Element;
353
274
 
275
+ /**
276
+ * Normalize styling of certain elements between browsers.
277
+ * Based on https://www.joshwcomeau.com/css/custom-css-reset/
278
+ */
279
+
280
+ declare const normalize: {
281
+ readonly base: {
282
+ readonly boxSizing: "border-box";
283
+ readonly margin: 0;
284
+ readonly minWidth: 0;
285
+ };
286
+ readonly a: {
287
+ readonly textDecoration: "none";
288
+ readonly boxSizing: "border-box";
289
+ readonly margin: 0;
290
+ readonly minWidth: 0;
291
+ };
292
+ readonly p: {
293
+ readonly overflowWrap: "break-word";
294
+ readonly boxSizing: "border-box";
295
+ readonly margin: 0;
296
+ readonly minWidth: 0;
297
+ };
298
+ readonly h1: {
299
+ readonly overflowWrap: "break-word";
300
+ readonly boxSizing: "border-box";
301
+ readonly margin: 0;
302
+ readonly minWidth: 0;
303
+ };
304
+ readonly h2: {
305
+ readonly overflowWrap: "break-word";
306
+ readonly boxSizing: "border-box";
307
+ readonly margin: 0;
308
+ readonly minWidth: 0;
309
+ };
310
+ readonly h3: {
311
+ readonly overflowWrap: "break-word";
312
+ readonly boxSizing: "border-box";
313
+ readonly margin: 0;
314
+ readonly minWidth: 0;
315
+ };
316
+ readonly h4: {
317
+ readonly overflowWrap: "break-word";
318
+ readonly boxSizing: "border-box";
319
+ readonly margin: 0;
320
+ readonly minWidth: 0;
321
+ };
322
+ readonly h5: {
323
+ readonly overflowWrap: "break-word";
324
+ readonly boxSizing: "border-box";
325
+ readonly margin: 0;
326
+ readonly minWidth: 0;
327
+ };
328
+ readonly h6: {
329
+ readonly overflowWrap: "break-word";
330
+ readonly boxSizing: "border-box";
331
+ readonly margin: 0;
332
+ readonly minWidth: 0;
333
+ };
334
+ readonly img: {
335
+ readonly display: "block";
336
+ readonly maxWidth: "100%";
337
+ readonly boxSizing: "border-box";
338
+ readonly margin: 0;
339
+ readonly minWidth: 0;
340
+ };
341
+ readonly picture: {
342
+ readonly display: "block";
343
+ readonly maxWidth: "100%";
344
+ readonly boxSizing: "border-box";
345
+ readonly margin: 0;
346
+ readonly minWidth: 0;
347
+ };
348
+ readonly video: {
349
+ readonly display: "block";
350
+ readonly maxWidth: "100%";
351
+ readonly boxSizing: "border-box";
352
+ readonly margin: 0;
353
+ readonly minWidth: 0;
354
+ };
355
+ readonly canvas: {
356
+ readonly display: "block";
357
+ readonly maxWidth: "100%";
358
+ readonly boxSizing: "border-box";
359
+ readonly margin: 0;
360
+ readonly minWidth: 0;
361
+ };
362
+ readonly svg: {
363
+ readonly display: "block";
364
+ readonly maxWidth: "100%";
365
+ readonly boxSizing: "border-box";
366
+ readonly margin: 0;
367
+ readonly minWidth: 0;
368
+ };
369
+ readonly select: {
370
+ readonly display: "block";
371
+ readonly appearance: "none";
372
+ readonly font: "inherit";
373
+ readonly '&::-ms-expand': {
374
+ readonly display: "none";
375
+ };
376
+ readonly boxSizing: "border-box";
377
+ readonly margin: 0;
378
+ readonly minWidth: 0;
379
+ };
380
+ readonly button: {
381
+ readonly display: "block";
382
+ readonly appearance: "none";
383
+ readonly font: "inherit";
384
+ readonly background: "transparent";
385
+ readonly textAlign: "center";
386
+ readonly boxSizing: "border-box";
387
+ readonly margin: 0;
388
+ readonly minWidth: 0;
389
+ };
390
+ readonly textarea: {
391
+ readonly display: "block";
392
+ readonly appearance: "none";
393
+ readonly font: "inherit";
394
+ readonly boxSizing: "border-box";
395
+ readonly margin: 0;
396
+ readonly minWidth: 0;
397
+ };
398
+ readonly input: {
399
+ readonly display: "block";
400
+ readonly appearance: "none";
401
+ readonly font: "inherit";
402
+ readonly '&::-ms-clear': {
403
+ readonly display: "none";
404
+ };
405
+ readonly '&::-webkit-search-cancel-button': {
406
+ readonly WebkitAppearance: "none";
407
+ };
408
+ readonly boxSizing: "border-box";
409
+ readonly margin: 0;
410
+ readonly minWidth: 0;
411
+ };
412
+ };
413
+ declare type NormalizedElement = keyof typeof normalize;
414
+ /**
415
+ * Type-safe helper to get normalization. If no normalization is found,
416
+ * returns the *base* normalization.
417
+ */
418
+ declare const getNormalizedStyles: (val?: ElementType<any> | undefined) => {
419
+ readonly boxSizing: "border-box";
420
+ readonly margin: 0;
421
+ readonly minWidth: 0;
422
+ };
423
+
354
424
  /**
355
425
  * Ensures that the `val` is an array. Will return an empty array if `val` is falsy.
356
426
  */
@@ -381,4 +451,4 @@ declare const appendVariantState: (variant: string, state: keyof State) => strin
381
451
  */
382
452
  declare const conditional: (variant: string, { disabled, ...states }: State) => string[];
383
453
 
384
- export { Box, BoxOwnProps, BoxProps, CSSObject, CSSProperties, Global, NormalizedElement, ResponsiveStyleValue, SVG, SVGProps, Scale, ScaleValue, SizeScale, State, StyleObject, StyleProps, Theme, ThemeProvider, ThemeProviderProps, ZeroScale, ZeroSizeScale, __defaultTheme, appendVariantState, conditional, ensureArray, ensureArrayVariant, ensureVariantDefault, getNormalizedStyles, normalize, useResponsiveValue, useTheme };
454
+ export { Box, BoxOwnProps, BoxProps, CSSObject, CSSProperties, ComponentState, ComponentStyleParts, ComponentStylesProps, Global, NormalizedElement, ResponsiveStyleValue, SVG, SVGProps, Scale, ScaleValue, SizeScale, State, StateAttrKeyProps, StateAttrProps, StyleObject, StyleProps, Theme, ThemeComponentProps, ThemeExtension, ThemeExtensionsWithParts, ThemeProvider, ThemeProviderProps, UseStateProps, ZeroScale, ZeroSizeScale, __defaultTheme, appendVariantState, conditional, ensureArray, ensureArrayVariant, ensureVariantDefault, getNormalizedStyles, normalize, useComponentStyles, useResponsiveValue, useStateProps, useTheme };
package/dist/index.js CHANGED
@@ -21,7 +21,6 @@ var __spreadValues = (a2, b) => {
21
21
  return a2;
22
22
  };
23
23
  var __spreadProps = (a2, b) => __defProps(a2, __getOwnPropDescs(b));
24
- var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
25
24
  var __objRest = (source, exclude) => {
26
25
  var target = {};
27
26
  for (var prop in source)
@@ -38,22 +37,16 @@ var __export = (target, all) => {
38
37
  for (var name in all)
39
38
  __defProp(target, name, { get: all[name], enumerable: true });
40
39
  };
41
- var __reExport = (target, module2, copyDefault, desc) => {
42
- if (module2 && typeof module2 === "object" || typeof module2 === "function") {
43
- for (let key of __getOwnPropNames(module2))
44
- if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
45
- __defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
40
+ var __copyProps = (to, from, except, desc) => {
41
+ if (from && typeof from === "object" || typeof from === "function") {
42
+ for (let key of __getOwnPropNames(from))
43
+ if (!__hasOwnProp.call(to, key) && key !== except)
44
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
46
45
  }
47
- return target;
48
- };
49
- var __toESM = (module2, isNodeMode) => {
50
- return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
46
+ return to;
51
47
  };
52
- var __toCommonJS = /* @__PURE__ */ ((cache) => {
53
- return (module2, temp) => {
54
- return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
55
- };
56
- })(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
48
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
49
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
57
50
 
58
51
  // src/index.ts
59
52
  var src_exports = {};
@@ -70,14 +63,18 @@ __export(src_exports, {
70
63
  ensureVariantDefault: () => ensureVariantDefault,
71
64
  getNormalizedStyles: () => getNormalizedStyles,
72
65
  normalize: () => normalize,
66
+ useComponentStyles: () => useComponentStyles,
73
67
  useResponsiveValue: () => useResponsiveValue,
68
+ useStateProps: () => useStateProps,
74
69
  useTheme: () => useTheme
75
70
  });
71
+ module.exports = __toCommonJS(src_exports);
76
72
 
77
- // src/Box.tsx
78
- var import_react = require("@emotion/react");
73
+ // src/components/Box/Box.tsx
74
+ var import_react = require("react");
75
+ var import_react2 = require("@emotion/react");
79
76
  var import_css = require("@theme-ui/css");
80
- var import_react2 = require("react");
77
+ var import_deepmerge = __toESM(require("deepmerge"));
81
78
 
82
79
  // src/normalize.ts
83
80
  var base = {
@@ -163,18 +160,45 @@ var conditional = (variant, _a) => {
163
160
  return [variant, ...stateVariants];
164
161
  };
165
162
 
166
- // src/Box.tsx
167
- var isNotEmpty = (val) => !(val && Object.keys(val).length === 0 && val.constructor === Object);
163
+ // src/components/Box/utils.ts
164
+ var pseudos = {
165
+ "&:hover": "&:hover, &[data-hover]",
166
+ "&:focus": "&:focus, &[data-focus]",
167
+ "&:active": "&:active, &[data-active]",
168
+ "&:disabled": "&[disabled], &[aria-disabled=true], &[data-disabled]",
169
+ "&:read-only": "&[readonly], &[aria-readonly=true], &[data-readonly]",
170
+ "&:checked": "&[aria-checked=true], &[data-checked]",
171
+ "&:indeterminate": "&:indeterminate, &[aria-checked=mixed], &[data-indeterminate]",
172
+ "&:error": "&:invalid, &[aria-invalid=true], &[data-error]"
173
+ };
174
+ var transformPseudos = (styles) => {
175
+ let result = {};
176
+ for (let key in styles) {
177
+ const value = styles[key];
178
+ if (key in pseudos) {
179
+ key = pseudos[key];
180
+ }
181
+ if (typeof value === "object") {
182
+ result[key] = transformPseudos(value);
183
+ continue;
184
+ }
185
+ result[key] = value;
186
+ }
187
+ return result;
188
+ };
189
+
190
+ // src/components/Box/Box.tsx
168
191
  var createThemedStyle = ({ as, __baseCSS, variant, styles, css }) => (theme) => {
169
- return [
192
+ const themedStyles = import_deepmerge.default.all([
170
193
  getNormalizedStyles(as),
171
194
  (0, import_css.css)(__baseCSS)(theme),
172
195
  ...ensureArrayVariant(variant).map((v) => (0, import_css.css)({ variant: v })(theme)),
173
196
  (0, import_css.css)(styles)(theme),
174
197
  (0, import_css.css)(css)(theme)
175
- ].filter(isNotEmpty);
198
+ ]);
199
+ return transformPseudos(themedStyles);
176
200
  };
177
- var Box = (0, import_react2.forwardRef)((_a, ref) => {
201
+ var Box = (0, import_react.forwardRef)((_a, ref) => {
178
202
  var _b = _a, {
179
203
  as = "div",
180
204
  children,
@@ -264,7 +288,7 @@ var Box = (0, import_react2.forwardRef)((_a, ref) => {
264
288
  "overflow",
265
289
  "transition"
266
290
  ]);
267
- return (0, import_react.jsx)(as, __spreadProps(__spreadValues({}, props), {
291
+ return (0, import_react2.jsx)(as, __spreadProps(__spreadValues({}, props), {
268
292
  css: createThemedStyle({
269
293
  as,
270
294
  __baseCSS,
@@ -315,11 +339,16 @@ var Box = (0, import_react2.forwardRef)((_a, ref) => {
315
339
  }), children);
316
340
  });
317
341
 
318
- // src/Global.tsx
319
- var import_react5 = __toESM(require("react"));
320
- var import_react6 = require("@emotion/react");
342
+ // src/components/Global/Global.tsx
343
+ var import_react8 = __toESM(require("react"));
344
+ var import_react9 = require("@emotion/react");
345
+
346
+ // src/hooks/useComponentStyles.ts
347
+ var import_deepmerge2 = __toESM(require("deepmerge"));
348
+ var import_react5 = require("react");
349
+ var import_react_fast_compare = __toESM(require("react-fast-compare"));
321
350
 
322
- // src/useTheme.tsx
351
+ // src/hooks/useTheme.tsx
323
352
  var import_react3 = __toESM(require("react"));
324
353
  var import_css2 = require("@theme-ui/css");
325
354
  var import_react4 = require("@emotion/react");
@@ -328,7 +357,8 @@ var InternalContext = (0, import_react3.createContext)(__defaultTheme);
328
357
  var useTheme = () => {
329
358
  const theme = (0, import_react3.useContext)(InternalContext);
330
359
  const css = (0, import_react3.useCallback)((style) => (0, import_css2.css)(style)(theme), [theme]);
331
- return { theme, css };
360
+ const get2 = (0, import_react3.useCallback)((path) => (0, import_css2.get)(theme, path), [theme]);
361
+ return { theme, css, get: get2 };
332
362
  };
333
363
  function ThemeProvider({
334
364
  theme,
@@ -341,7 +371,84 @@ function ThemeProvider({
341
371
  }, children));
342
372
  }
343
373
 
344
- // src/Global.tsx
374
+ // src/hooks/useComponentStyles.ts
375
+ var get = (obj, path, fallback) => {
376
+ const key = path.split(".");
377
+ let result = obj;
378
+ for (let i = 0, length = key.length; i < length; i++) {
379
+ if (!result)
380
+ break;
381
+ result = result[key[i]];
382
+ }
383
+ return result === void 0 ? fallback : result;
384
+ };
385
+ function useComponentStyles(componentName, props = {}, options = {}) {
386
+ var _a, _b;
387
+ const { theme } = useTheme();
388
+ const componentStyles = get(theme, `components.${componentName}`);
389
+ const stylesRef = (0, import_react5.useRef)({});
390
+ if (componentStyles) {
391
+ const base2 = componentStyles.base || {};
392
+ const size = ((_a = componentStyles.size) == null ? void 0 : _a[props.size]) || {};
393
+ const variant = ((_b = componentStyles.variant) == null ? void 0 : _b[props.variant]) || {};
394
+ let styles = import_deepmerge2.default.all([base2, size, variant]);
395
+ if (options.parts) {
396
+ styles = options.parts.reduce((result, part) => {
397
+ result[part] = styles[part] || {};
398
+ return result;
399
+ }, {});
400
+ }
401
+ if (!(0, import_react_fast_compare.default)(stylesRef.current, styles)) {
402
+ stylesRef.current = styles;
403
+ }
404
+ }
405
+ return stylesRef.current;
406
+ }
407
+
408
+ // src/hooks/useResponsiveValue.ts
409
+ var import_react6 = require("react");
410
+ var emptyBreakpoints = ["40em", "52em", "64em"];
411
+ var useResponsiveValue = (values, defaultIndex = 0) => {
412
+ const { theme } = useTheme();
413
+ const breakpoints = theme.breakpoints || emptyBreakpoints;
414
+ if (defaultIndex < 0 || defaultIndex >= breakpoints.length) {
415
+ throw new RangeError(`Default breakpoint index is out of bounds. Theme has ${breakpoints.length} breakpoints, default is ${defaultIndex}.`);
416
+ }
417
+ const [index, setIndex] = (0, import_react6.useState)(defaultIndex);
418
+ (0, import_react6.useEffect)(() => {
419
+ const getIndex = () => breakpoints.filter((breakpoint) => window.matchMedia(`screen and (min-width: ${breakpoint})`).matches).length;
420
+ const handleResize = () => {
421
+ const newIndex = getIndex();
422
+ if (index !== newIndex) {
423
+ setIndex(newIndex);
424
+ }
425
+ };
426
+ handleResize();
427
+ window.addEventListener("resize", handleResize);
428
+ return () => window.removeEventListener("resize", handleResize);
429
+ }, [breakpoints, index]);
430
+ return values[index >= values.length ? values.length - 1 : index];
431
+ };
432
+
433
+ // src/hooks/useStateProps.ts
434
+ var import_react7 = require("react");
435
+ var import_react_fast_compare2 = __toESM(require("react-fast-compare"));
436
+ var useStateProps = (states) => {
437
+ const statePropsRef = (0, import_react7.useRef)({});
438
+ let stateProps = {};
439
+ for (let state in states) {
440
+ if (states[state]) {
441
+ const key = `data-${state.toLocaleLowerCase()}`;
442
+ stateProps[key] = "";
443
+ }
444
+ }
445
+ if (!(0, import_react_fast_compare2.default)(statePropsRef.current, stateProps)) {
446
+ statePropsRef.current = stateProps;
447
+ }
448
+ return statePropsRef.current;
449
+ };
450
+
451
+ // src/components/Global/Global.tsx
345
452
  var reduceMotionStyles = {
346
453
  "@media screen and (prefers-reduced-motion: reduce), (update: slow)": {
347
454
  "*": {
@@ -366,14 +473,16 @@ var Global = () => {
366
473
  variant: "root.body"
367
474
  }
368
475
  });
369
- return /* @__PURE__ */ import_react5.default.createElement(import_react6.Global, {
476
+ return /* @__PURE__ */ import_react8.default.createElement(import_react9.Global, {
370
477
  styles: __spreadValues({ reduceMotionStyles }, styles)
371
478
  });
372
479
  };
373
480
 
374
- // src/SVG.tsx
375
- var import_react7 = require("@emotion/react");
481
+ // src/components/SVG/SVG.tsx
482
+ var import_react10 = require("@emotion/react");
376
483
  var normalizedStyles = getNormalizedStyles("svg");
484
+ var toDimension = (value) => Array.isArray(value) ? value.map(ensureNumberOrToken) : ensureNumberOrToken(value);
485
+ var ensureNumberOrToken = (value) => typeof value === "string" && /[0-9]+/.test(value) ? Number(value) : value;
377
486
  var SVG = (_a) => {
378
487
  var _b = _a, {
379
488
  size = 24,
@@ -385,39 +494,15 @@ var SVG = (_a) => {
385
494
  "children"
386
495
  ]);
387
496
  const { css } = useTheme();
388
- return (0, import_react7.jsx)("svg", __spreadValues({
389
- width: size,
390
- height: size,
497
+ return (0, import_react10.jsx)("svg", __spreadValues({
391
498
  viewBox: "0 0 24 24",
392
- css: css(__spreadValues({ fill }, normalizedStyles))
499
+ css: css(__spreadProps(__spreadValues({}, normalizedStyles), {
500
+ fill,
501
+ width: toDimension(props.width || size),
502
+ height: toDimension(props.height || size)
503
+ }))
393
504
  }, props), children);
394
505
  };
395
-
396
- // src/useResponsiveValue.ts
397
- var import_react8 = require("react");
398
- var emptyBreakpoints = ["40em", "52em", "64em"];
399
- var useResponsiveValue = (values, defaultIndex = 0) => {
400
- const { theme } = useTheme();
401
- const breakpoints = theme.breakpoints || emptyBreakpoints;
402
- if (defaultIndex < 0 || defaultIndex >= breakpoints.length) {
403
- throw new RangeError(`Default breakpoint index is out of bounds. Theme has ${breakpoints.length} breakpoints, default is ${defaultIndex}.`);
404
- }
405
- const [index, setIndex] = (0, import_react8.useState)(defaultIndex);
406
- (0, import_react8.useEffect)(() => {
407
- const getIndex = () => breakpoints.filter((breakpoint) => window.matchMedia(`screen and (min-width: ${breakpoint})`).matches).length;
408
- const handleResize = () => {
409
- const newIndex = getIndex();
410
- if (index !== newIndex) {
411
- setIndex(newIndex);
412
- }
413
- };
414
- handleResize();
415
- window.addEventListener("resize", handleResize);
416
- return () => window.removeEventListener("resize", handleResize);
417
- }, [breakpoints, index]);
418
- return values[index >= values.length ? values.length - 1 : index];
419
- };
420
- module.exports = __toCommonJS(src_exports);
421
506
  // Annotate the CommonJS export names for ESM import in node:
422
507
  0 && (module.exports = {
423
508
  Box,
@@ -432,6 +517,8 @@ module.exports = __toCommonJS(src_exports);
432
517
  ensureVariantDefault,
433
518
  getNormalizedStyles,
434
519
  normalize,
520
+ useComponentStyles,
435
521
  useResponsiveValue,
522
+ useStateProps,
436
523
  useTheme
437
524
  });
package/dist/index.mjs CHANGED
@@ -30,10 +30,11 @@ var __objRest = (source, exclude) => {
30
30
  return target;
31
31
  };
32
32
 
33
- // src/Box.tsx
33
+ // src/components/Box/Box.tsx
34
+ import { forwardRef } from "react";
34
35
  import { jsx } from "@emotion/react";
35
36
  import { css as transformStyleObject } from "@theme-ui/css";
36
- import { forwardRef } from "react";
37
+ import merge from "deepmerge";
37
38
 
38
39
  // src/normalize.ts
39
40
  var base = {
@@ -119,16 +120,43 @@ var conditional = (variant, _a) => {
119
120
  return [variant, ...stateVariants];
120
121
  };
121
122
 
122
- // src/Box.tsx
123
- var isNotEmpty = (val) => !(val && Object.keys(val).length === 0 && val.constructor === Object);
123
+ // src/components/Box/utils.ts
124
+ var pseudos = {
125
+ "&:hover": "&:hover, &[data-hover]",
126
+ "&:focus": "&:focus, &[data-focus]",
127
+ "&:active": "&:active, &[data-active]",
128
+ "&:disabled": "&[disabled], &[aria-disabled=true], &[data-disabled]",
129
+ "&:read-only": "&[readonly], &[aria-readonly=true], &[data-readonly]",
130
+ "&:checked": "&[aria-checked=true], &[data-checked]",
131
+ "&:indeterminate": "&:indeterminate, &[aria-checked=mixed], &[data-indeterminate]",
132
+ "&:error": "&:invalid, &[aria-invalid=true], &[data-error]"
133
+ };
134
+ var transformPseudos = (styles) => {
135
+ let result = {};
136
+ for (let key in styles) {
137
+ const value = styles[key];
138
+ if (key in pseudos) {
139
+ key = pseudos[key];
140
+ }
141
+ if (typeof value === "object") {
142
+ result[key] = transformPseudos(value);
143
+ continue;
144
+ }
145
+ result[key] = value;
146
+ }
147
+ return result;
148
+ };
149
+
150
+ // src/components/Box/Box.tsx
124
151
  var createThemedStyle = ({ as, __baseCSS, variant, styles, css }) => (theme) => {
125
- return [
152
+ const themedStyles = merge.all([
126
153
  getNormalizedStyles(as),
127
154
  transformStyleObject(__baseCSS)(theme),
128
155
  ...ensureArrayVariant(variant).map((v) => transformStyleObject({ variant: v })(theme)),
129
156
  transformStyleObject(styles)(theme),
130
157
  transformStyleObject(css)(theme)
131
- ].filter(isNotEmpty);
158
+ ]);
159
+ return transformPseudos(themedStyles);
132
160
  };
133
161
  var Box = forwardRef((_a, ref) => {
134
162
  var _b = _a, {
@@ -271,24 +299,33 @@ var Box = forwardRef((_a, ref) => {
271
299
  }), children);
272
300
  });
273
301
 
274
- // src/Global.tsx
302
+ // src/components/Global/Global.tsx
275
303
  import React2 from "react";
276
304
  import { Global as EmotionGlobal } from "@emotion/react";
277
305
 
278
- // src/useTheme.tsx
306
+ // src/hooks/useComponentStyles.ts
307
+ import merge2 from "deepmerge";
308
+ import { useRef } from "react";
309
+ import isEqual from "react-fast-compare";
310
+
311
+ // src/hooks/useTheme.tsx
279
312
  import React, {
280
313
  createContext,
281
314
  useCallback,
282
315
  useContext
283
316
  } from "react";
284
- import { css as transformStyleObject2 } from "@theme-ui/css";
317
+ import {
318
+ css as transformStyleObject2,
319
+ get as getfromTheme
320
+ } from "@theme-ui/css";
285
321
  import { ThemeProvider as EmotionProvider } from "@emotion/react";
286
322
  var __defaultTheme = {};
287
323
  var InternalContext = createContext(__defaultTheme);
288
324
  var useTheme = () => {
289
325
  const theme = useContext(InternalContext);
290
326
  const css = useCallback((style) => transformStyleObject2(style)(theme), [theme]);
291
- return { theme, css };
327
+ const get2 = useCallback((path) => getfromTheme(theme, path), [theme]);
328
+ return { theme, css, get: get2 };
292
329
  };
293
330
  function ThemeProvider({
294
331
  theme,
@@ -301,7 +338,84 @@ function ThemeProvider({
301
338
  }, children));
302
339
  }
303
340
 
304
- // src/Global.tsx
341
+ // src/hooks/useComponentStyles.ts
342
+ var get = (obj, path, fallback) => {
343
+ const key = path.split(".");
344
+ let result = obj;
345
+ for (let i = 0, length = key.length; i < length; i++) {
346
+ if (!result)
347
+ break;
348
+ result = result[key[i]];
349
+ }
350
+ return result === void 0 ? fallback : result;
351
+ };
352
+ function useComponentStyles(componentName, props = {}, options = {}) {
353
+ var _a, _b;
354
+ const { theme } = useTheme();
355
+ const componentStyles = get(theme, `components.${componentName}`);
356
+ const stylesRef = useRef({});
357
+ if (componentStyles) {
358
+ const base2 = componentStyles.base || {};
359
+ const size = ((_a = componentStyles.size) == null ? void 0 : _a[props.size]) || {};
360
+ const variant = ((_b = componentStyles.variant) == null ? void 0 : _b[props.variant]) || {};
361
+ let styles = merge2.all([base2, size, variant]);
362
+ if (options.parts) {
363
+ styles = options.parts.reduce((result, part) => {
364
+ result[part] = styles[part] || {};
365
+ return result;
366
+ }, {});
367
+ }
368
+ if (!isEqual(stylesRef.current, styles)) {
369
+ stylesRef.current = styles;
370
+ }
371
+ }
372
+ return stylesRef.current;
373
+ }
374
+
375
+ // src/hooks/useResponsiveValue.ts
376
+ import { useEffect, useState } from "react";
377
+ var emptyBreakpoints = ["40em", "52em", "64em"];
378
+ var useResponsiveValue = (values, defaultIndex = 0) => {
379
+ const { theme } = useTheme();
380
+ const breakpoints = theme.breakpoints || emptyBreakpoints;
381
+ if (defaultIndex < 0 || defaultIndex >= breakpoints.length) {
382
+ throw new RangeError(`Default breakpoint index is out of bounds. Theme has ${breakpoints.length} breakpoints, default is ${defaultIndex}.`);
383
+ }
384
+ const [index, setIndex] = useState(defaultIndex);
385
+ useEffect(() => {
386
+ const getIndex = () => breakpoints.filter((breakpoint) => window.matchMedia(`screen and (min-width: ${breakpoint})`).matches).length;
387
+ const handleResize = () => {
388
+ const newIndex = getIndex();
389
+ if (index !== newIndex) {
390
+ setIndex(newIndex);
391
+ }
392
+ };
393
+ handleResize();
394
+ window.addEventListener("resize", handleResize);
395
+ return () => window.removeEventListener("resize", handleResize);
396
+ }, [breakpoints, index]);
397
+ return values[index >= values.length ? values.length - 1 : index];
398
+ };
399
+
400
+ // src/hooks/useStateProps.ts
401
+ import { useRef as useRef2 } from "react";
402
+ import isEqual2 from "react-fast-compare";
403
+ var useStateProps = (states) => {
404
+ const statePropsRef = useRef2({});
405
+ let stateProps = {};
406
+ for (let state in states) {
407
+ if (states[state]) {
408
+ const key = `data-${state.toLocaleLowerCase()}`;
409
+ stateProps[key] = "";
410
+ }
411
+ }
412
+ if (!isEqual2(statePropsRef.current, stateProps)) {
413
+ statePropsRef.current = stateProps;
414
+ }
415
+ return statePropsRef.current;
416
+ };
417
+
418
+ // src/components/Global/Global.tsx
305
419
  var reduceMotionStyles = {
306
420
  "@media screen and (prefers-reduced-motion: reduce), (update: slow)": {
307
421
  "*": {
@@ -331,9 +445,11 @@ var Global = () => {
331
445
  });
332
446
  };
333
447
 
334
- // src/SVG.tsx
448
+ // src/components/SVG/SVG.tsx
335
449
  import { jsx as jsx2 } from "@emotion/react";
336
450
  var normalizedStyles = getNormalizedStyles("svg");
451
+ var toDimension = (value) => Array.isArray(value) ? value.map(ensureNumberOrToken) : ensureNumberOrToken(value);
452
+ var ensureNumberOrToken = (value) => typeof value === "string" && /[0-9]+/.test(value) ? Number(value) : value;
337
453
  var SVG = (_a) => {
338
454
  var _b = _a, {
339
455
  size = 24,
@@ -346,37 +462,14 @@ var SVG = (_a) => {
346
462
  ]);
347
463
  const { css } = useTheme();
348
464
  return jsx2("svg", __spreadValues({
349
- width: size,
350
- height: size,
351
465
  viewBox: "0 0 24 24",
352
- css: css(__spreadValues({ fill }, normalizedStyles))
466
+ css: css(__spreadProps(__spreadValues({}, normalizedStyles), {
467
+ fill,
468
+ width: toDimension(props.width || size),
469
+ height: toDimension(props.height || size)
470
+ }))
353
471
  }, props), children);
354
472
  };
355
-
356
- // src/useResponsiveValue.ts
357
- import { useEffect, useState } from "react";
358
- var emptyBreakpoints = ["40em", "52em", "64em"];
359
- var useResponsiveValue = (values, defaultIndex = 0) => {
360
- const { theme } = useTheme();
361
- const breakpoints = theme.breakpoints || emptyBreakpoints;
362
- if (defaultIndex < 0 || defaultIndex >= breakpoints.length) {
363
- throw new RangeError(`Default breakpoint index is out of bounds. Theme has ${breakpoints.length} breakpoints, default is ${defaultIndex}.`);
364
- }
365
- const [index, setIndex] = useState(defaultIndex);
366
- useEffect(() => {
367
- const getIndex = () => breakpoints.filter((breakpoint) => window.matchMedia(`screen and (min-width: ${breakpoint})`).matches).length;
368
- const handleResize = () => {
369
- const newIndex = getIndex();
370
- if (index !== newIndex) {
371
- setIndex(newIndex);
372
- }
373
- };
374
- handleResize();
375
- window.addEventListener("resize", handleResize);
376
- return () => window.removeEventListener("resize", handleResize);
377
- }, [breakpoints, index]);
378
- return values[index >= values.length ? values.length - 1 : index];
379
- };
380
473
  export {
381
474
  Box,
382
475
  Global,
@@ -390,6 +483,8 @@ export {
390
483
  ensureVariantDefault,
391
484
  getNormalizedStyles,
392
485
  normalize,
486
+ useComponentStyles,
393
487
  useResponsiveValue,
488
+ useStateProps,
394
489
  useTheme
395
490
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marigold/system",
3
- "version": "0.6.0",
3
+ "version": "0.9.0",
4
4
  "description": "Marigold System Library",
5
5
  "license": "MIT",
6
6
  "keywords": [
@@ -26,10 +26,12 @@
26
26
  "directory": "packages/system"
27
27
  },
28
28
  "dependencies": {
29
- "@emotion/react": "11.7.1",
30
- "@marigold/types": "0.4.0",
31
- "@theme-ui/css": "0.13.1",
32
- "csstype": "3.0.11"
29
+ "@emotion/react": "11.8.2",
30
+ "@marigold/types": "0.4.1",
31
+ "@theme-ui/css": "0.14.2",
32
+ "csstype": "3.0.11",
33
+ "deepmerge": "^4.2.2",
34
+ "react-fast-compare": "^3.2.0"
33
35
  },
34
36
  "peerDependencies": {
35
37
  "react": "^16.x || ^17.0.0",
@@ -37,11 +39,12 @@
37
39
  },
38
40
  "devDependencies": {
39
41
  "@marigold/tsconfig": "0.3.0",
40
- "tsup": "5.11.13"
42
+ "tsup": "5.12.5"
41
43
  },
42
44
  "scripts": {
43
45
  "build": "tsup src/index.ts",
44
46
  "watch": "tsup src/index.ts --watch",
45
47
  "clean": "rm -rf node_modules && rm -rf dist"
46
- }
48
+ },
49
+ "readme": "# `@marigold/system`\n\n> Marigold system\n"
47
50
  }
package/CHANGELOG.md DELETED
@@ -1,94 +0,0 @@
1
- # @marigold/system
2
-
3
- ## 0.6.0
4
-
5
- ### Minor Changes
6
-
7
- - [#1817](https://github.com/marigold-ui/marigold/pull/1817) [`4cc0ad3b`](https://github.com/marigold-ui/marigold/commit/4cc0ad3b85b993e01b4d85b6f30b1a81cdee2351) Thanks [@sebald](https://github.com/sebald)! - feat(system): Add textSizeAdjust to globals
8
-
9
- * [#1842](https://github.com/marigold-ui/marigold/pull/1842) [`e053b7b9`](https://github.com/marigold-ui/marigold/commit/e053b7b903f02c56cf10e6b9aecbedd29399895d) Thanks [@ti10le](https://github.com/ti10le)! - feat: extend svg fill prop to handle theme color
10
-
11
- ### Patch Changes
12
-
13
- - [#1809](https://github.com/marigold-ui/marigold/pull/1809) [`539d4198`](https://github.com/marigold-ui/marigold/commit/539d41987118db125ee37a4a83231335ea15830a) Thanks [@sebald](https://github.com/sebald)! - feat(create-theme): Introduce helper package to create themes with sensible defaults
14
-
15
- ## 0.5.1
16
-
17
- ### Patch Changes
18
-
19
- - [#1795](https://github.com/marigold-ui/marigold/pull/1795) [`a178eafe`](https://github.com/marigold-ui/marigold/commit/a178eafe8c8380ee23b4587d953ee52b231414ff) Thanks [@ti10le](https://github.com/ti10le)! - refa: use interface instead of type
20
-
21
- ## 0.5.0
22
-
23
- ### Minor Changes
24
-
25
- - [#1723](https://github.com/marigold-ui/marigold/pull/1723) [`5936de75`](https://github.com/marigold-ui/marigold/commit/5936de75e5a0134584438117c53c5edfe15c6c5d) Thanks [@sebald](https://github.com/sebald)! - feat(system): add hook that allows to use values based on screen size
26
-
27
- ## 0.4.0
28
-
29
- ### Minor Changes
30
-
31
- - [`f9526234`](https://github.com/marigold-ui/marigold/commit/f9526234257a149b12c14191a524691470da3942) Thanks [@sebald](https://github.com/sebald)! - chore: Use `tsup` to build packages
32
-
33
- * [`f9526234`](https://github.com/marigold-ui/marigold/commit/f9526234257a149b12c14191a524691470da3942) Thanks [@sebald](https://github.com/sebald)! - Improved size in node_modules
34
-
35
- ### Patch Changes
36
-
37
- - Updated dependencies [[`f9526234`](https://github.com/marigold-ui/marigold/commit/f9526234257a149b12c14191a524691470da3942)]:
38
- - @marigold/types@0.4.0
39
-
40
- ## 0.3.1
41
-
42
- ### Patch Changes
43
-
44
- - [#1676](https://github.com/marigold-ui/marigold/pull/1676) [`379041bc`](https://github.com/marigold-ui/marigold/commit/379041bc7d4502bca98029a95afe43ce693222cd) Thanks [@ti10le](https://github.com/ti10le)! - remove the last mdx stories
45
-
46
- ## 0.3.0
47
-
48
- ### Minor Changes
49
-
50
- - [#1163](https://github.com/marigold-ui/marigold/pull/1163) [`51af6693`](https://github.com/marigold-ui/marigold/commit/51af669330fd52e4e31fe5ad71d2b202ab8d2231) Thanks [@sebald](https://github.com/sebald)! - feat(system): Expose helper to transpile style object
51
-
52
- ### Patch Changes
53
-
54
- - [#1549](https://github.com/marigold-ui/marigold/pull/1549) [`c030aa85`](https://github.com/marigold-ui/marigold/commit/c030aa85156356c294bafe9831024f6b6f2ce4db) Thanks [@sebald](https://github.com/sebald)! - refa: use emotion's theme function in <Element>
55
-
56
- * [#1515](https://github.com/marigold-ui/marigold/pull/1515) [`8eda245f`](https://github.com/marigold-ui/marigold/commit/8eda245f01a918fcdaa9f0ac211889ed869aa375) Thanks [@sebald](https://github.com/sebald)! - feat: add normalization for body and html & fix emotion leak
57
-
58
- - [#1491](https://github.com/marigold-ui/marigold/pull/1491) [`5a04de11`](https://github.com/marigold-ui/marigold/commit/5a04de110637d004f5824679697ee4d6a90eaf34) Thanks [@ti10le](https://github.com/ti10le)! - remove useStyles from Element
59
-
60
- * [#1440](https://github.com/marigold-ui/marigold/pull/1440) [`c1da52c0`](https://github.com/marigold-ui/marigold/commit/c1da52c0f035b141608fd606e6ba3bc2b5482dc1) Thanks [@ti10le](https://github.com/ti10le)! - feature: use Element in Box + necessary fix changes
61
-
62
- - [#1591](https://github.com/marigold-ui/marigold/pull/1591) [`1448ddca`](https://github.com/marigold-ui/marigold/commit/1448ddcaa0f647f48b018fa74a8686af30eccc53) Thanks [@sebald](https://github.com/sebald)! - feat(jest): Improve snapshot readability
63
-
64
- * [#1514](https://github.com/marigold-ui/marigold/pull/1514) [`5107b943`](https://github.com/marigold-ui/marigold/commit/5107b943cb3085eb3137d84e79966acad6173a26) Thanks [@sebald](https://github.com/sebald)! - feat(system): Use emotion's context
65
-
66
- - [#1647](https://github.com/marigold-ui/marigold/pull/1647) [`cd3a0d3e`](https://github.com/marigold-ui/marigold/commit/cd3a0d3edb3f2ddc1f561e8007e1c20000f7855a) Thanks [@ti10le](https://github.com/ti10le)! - feat: conditional function to allow state props in variants
67
-
68
- * [#1230](https://github.com/marigold-ui/marigold/pull/1230) [`ebd6e26f`](https://github.com/marigold-ui/marigold/commit/ebd6e26f71f675b98b663bc45c6a2d5badddcd47) Thanks [@viktoria-schwarz](https://github.com/viktoria-schwarz)! - feat: add GlobalStyles via theme
69
-
70
- - [#1563](https://github.com/marigold-ui/marigold/pull/1563) [`6e485f5a`](https://github.com/marigold-ui/marigold/commit/6e485f5a8800094fe54c075a2b21f8abe726b3cd) Thanks [@sebald](https://github.com/sebald)! - feat: Introduce a `Theme` with all available scales
71
-
72
- * [#1620](https://github.com/marigold-ui/marigold/pull/1620) [`80a2abe5`](https://github.com/marigold-ui/marigold/commit/80a2abe5804ba2c5a48cc6b05211245c37baf266) Thanks [@ti10le](https://github.com/ti10le)! - feat(comp): extend Box to handle \_\_default variants
73
-
74
- - [#1579](https://github.com/marigold-ui/marigold/pull/1579) [`e13e3cc1`](https://github.com/marigold-ui/marigold/commit/e13e3cc1fc66b261209973b1fc90eb48117076e9) Thanks [@ti10le](https://github.com/ti10le)! - feat: remove Heading from marigold
75
-
76
- * [#1622](https://github.com/marigold-ui/marigold/pull/1622) [`1829cf17`](https://github.com/marigold-ui/marigold/commit/1829cf17e16c574e5577b3e1709c34dc7ed4faaf) Thanks [@ti10le](https://github.com/ti10le)! - feat(comp): change Card default variant
77
-
78
- - [#1501](https://github.com/marigold-ui/marigold/pull/1501) [`1c1f8648`](https://github.com/marigold-ui/marigold/commit/1c1f864820a060214406ef711f4ed873746c16c4) Thanks [@ti10le](https://github.com/ti10le)! - feat(storybook): remove use styles stories
79
-
80
- * [#1190](https://github.com/marigold-ui/marigold/pull/1190) [`a00b7eb9`](https://github.com/marigold-ui/marigold/commit/a00b7eb971131634414d3912d059fb505bb7a370) Thanks [@sebald](https://github.com/sebald)! - fix(system): List reset should not remove the enumeration
81
-
82
- - [#1499](https://github.com/marigold-ui/marigold/pull/1499) [`ec5baf85`](https://github.com/marigold-ui/marigold/commit/ec5baf85a9a0f82a4fca5bbd1e1680316c186593) Thanks [@sebald](https://github.com/sebald)! - feat: Update and simplify normalization
83
-
84
- * [#1652](https://github.com/marigold-ui/marigold/pull/1652) [`0bb8f19e`](https://github.com/marigold-ui/marigold/commit/0bb8f19ebdec0e2f9dc3f6164f4373cac5c10880) Thanks [@sebald](https://github.com/sebald)! - refa(system): Groupt variant related fns in own file
85
-
86
- - [#1436](https://github.com/marigold-ui/marigold/pull/1436) [`c4ae5c5c`](https://github.com/marigold-ui/marigold/commit/c4ae5c5ca442f93034ff8f4c70adc295547951d4) Thanks [@ti10le](https://github.com/ti10le)! - create Element component + normalize file
87
-
88
- * [#1508](https://github.com/marigold-ui/marigold/pull/1508) [`a1ef2108`](https://github.com/marigold-ui/marigold/commit/a1ef2108dd6c8e6838b517dd58c82d38e71dae2b) Thanks [@sebald](https://github.com/sebald)! - feat: Add default styling to `<Element>`
89
-
90
- - [#1621](https://github.com/marigold-ui/marigold/pull/1621) [`2f7b936f`](https://github.com/marigold-ui/marigold/commit/2f7b936f5b07eade00a51cb138c3c492f1e08c9d) Thanks [@ti10le](https://github.com/ti10le)! - feat(comp): change Badge default variant
91
-
92
- * [#1550](https://github.com/marigold-ui/marigold/pull/1550) [`846eb640`](https://github.com/marigold-ui/marigold/commit/846eb640ad035c7f3410b4a8a451f8de56e62339) Thanks [@sebald](https://github.com/sebald)! - feat: Merge <Box> and <Element>
93
-
94
- - [#1614](https://github.com/marigold-ui/marigold/pull/1614) [`5d63cd9c`](https://github.com/marigold-ui/marigold/commit/5d63cd9c14578787083c82c85d93bbd2ff0efac6) Thanks [@ti10le](https://github.com/ti10le)! - remove all purple color things