@marigold/system 0.2.0 → 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 (48) 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 +6 -4
  6. package/dist/normalize.d.ts +101 -67
  7. package/dist/system.cjs.development.js +299 -294
  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 +291 -289
  12. package/dist/system.esm.js.map +1 -1
  13. package/dist/theme.d.ts +136 -0
  14. package/dist/types.d.ts +1 -2
  15. package/dist/useTheme.d.ts +11 -5
  16. package/dist/variant.d.ts +29 -0
  17. package/package.json +4 -5
  18. package/src/Box.test.tsx +308 -0
  19. package/src/Box.tsx +199 -0
  20. package/src/Colors.stories.mdx +332 -456
  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/index.ts +6 -4
  27. package/src/normalize.test.tsx +9 -36
  28. package/src/normalize.ts +51 -82
  29. package/src/theme.ts +157 -0
  30. package/src/types.ts +0 -2
  31. package/src/useTheme.test.tsx +22 -14
  32. package/src/useTheme.tsx +37 -9
  33. package/src/variant.test.ts +93 -0
  34. package/src/variant.ts +54 -0
  35. package/dist/Element.d.ts +0 -8
  36. package/dist/cache.d.ts +0 -4
  37. package/dist/reset.d.ts +0 -24
  38. package/dist/useClassname.d.ts +0 -2
  39. package/dist/useStyles.d.ts +0 -15
  40. package/src/Element.test.tsx +0 -203
  41. package/src/Element.tsx +0 -59
  42. package/src/cache.ts +0 -4
  43. package/src/reset.ts +0 -108
  44. package/src/useClassname.test.tsx +0 -70
  45. package/src/useClassname.ts +0 -23
  46. package/src/useStyles.stories.mdx +0 -24
  47. package/src/useStyles.test.tsx +0 -286
  48. package/src/useStyles.ts +0 -63
package/CHANGELOG.md ADDED
@@ -0,0 +1,95 @@
1
+ # @marigold/system
2
+
3
+ ## 0.3.0
4
+ ### Minor Changes
5
+
6
+
7
+
8
+ - [#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
9
+
10
+
11
+ ### Patch Changes
12
+
13
+
14
+
15
+ - [#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>
16
+
17
+
18
+
19
+ - [#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
20
+
21
+
22
+
23
+ - [#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
24
+
25
+
26
+
27
+ - [#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
28
+
29
+
30
+
31
+ - [#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
32
+
33
+
34
+
35
+ - [#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
36
+
37
+
38
+
39
+ - [#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
40
+
41
+
42
+
43
+ - [#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
44
+
45
+
46
+
47
+ - [#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
48
+
49
+
50
+
51
+ - [#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
52
+
53
+
54
+
55
+ - [#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
56
+
57
+
58
+
59
+ - [#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
60
+
61
+
62
+
63
+ - [#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
64
+
65
+
66
+
67
+ - [#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
68
+
69
+
70
+
71
+ - [#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
72
+
73
+
74
+
75
+ - [#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
76
+
77
+
78
+
79
+ - [#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
80
+
81
+
82
+
83
+ - [#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>`
84
+
85
+
86
+
87
+ - [#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
88
+
89
+
90
+
91
+ - [#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>
92
+
93
+
94
+
95
+ - [#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
package/dist/Box.d.ts ADDED
@@ -0,0 +1,14 @@
1
+ import { PolymorphicPropsWithRef, PolymorphicComponentWithRef } from '@marigold/types';
2
+ import { CSSObject } from './types';
3
+ export declare type StyleProps = 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'>;
4
+ export declare type BoxOwnProps = {
5
+ css?: CSSObject;
6
+ variant?: string | string[];
7
+ /**
8
+ * Use to set base styles for the component
9
+ * @internal Used to set default styles for Marigold components
10
+ */
11
+ __baseCSS?: CSSObject;
12
+ } & StyleProps;
13
+ export declare type BoxProps = PolymorphicPropsWithRef<BoxOwnProps, 'div'>;
14
+ export declare const Box: PolymorphicComponentWithRef<BoxOwnProps, 'div'>;
@@ -0,0 +1,2 @@
1
+ /// <reference types="react" />
2
+ export declare const Global: () => JSX.Element;
package/dist/SVG.d.ts ADDED
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ import { ComponentProps } from '@marigold/types';
3
+ export declare type SVGProps = {
4
+ size?: number;
5
+ } & ComponentProps<'svg'>;
6
+ export declare const SVG: React.FC<SVGProps>;
package/dist/index.d.ts CHANGED
@@ -1,6 +1,8 @@
1
- export * from './Element';
2
- export * from './cache';
1
+ export * from './Box';
2
+ export * from './Global';
3
+ export * from './normalize';
4
+ export * from './SVG';
5
+ export * from './theme';
3
6
  export * from './types';
4
- export * from './useClassname';
5
- export * from './useStyles';
6
7
  export * from './useTheme';
8
+ export * from './variant';
@@ -1,110 +1,144 @@
1
1
  /// <reference types="react" />
2
- declare const reset: {
3
- readonly article: {
4
- readonly display: "block";
2
+ export declare const normalize: {
3
+ readonly base: {
4
+ readonly boxSizing: "border-box";
5
+ readonly margin: 0;
6
+ readonly minWidth: 0;
5
7
  };
6
- readonly aside: {
7
- readonly display: "block";
8
+ readonly a: {
9
+ readonly textDecoration: "none";
10
+ readonly boxSizing: "border-box";
11
+ readonly margin: 0;
12
+ readonly minWidth: 0;
8
13
  };
9
- readonly details: {
10
- readonly display: "block";
14
+ readonly p: {
15
+ readonly overflowWrap: "break-word";
16
+ readonly boxSizing: "border-box";
17
+ readonly margin: 0;
18
+ readonly minWidth: 0;
11
19
  };
12
- readonly figcaption: {
13
- readonly display: "block";
20
+ readonly h1: {
21
+ readonly overflowWrap: "break-word";
22
+ readonly boxSizing: "border-box";
23
+ readonly margin: 0;
24
+ readonly minWidth: 0;
14
25
  };
15
- readonly figure: {
16
- readonly display: "block";
26
+ readonly h2: {
27
+ readonly overflowWrap: "break-word";
28
+ readonly boxSizing: "border-box";
29
+ readonly margin: 0;
30
+ readonly minWidth: 0;
17
31
  };
18
- readonly footer: {
19
- readonly display: "block";
32
+ readonly h3: {
33
+ readonly overflowWrap: "break-word";
34
+ readonly boxSizing: "border-box";
35
+ readonly margin: 0;
36
+ readonly minWidth: 0;
20
37
  };
21
- readonly header: {
22
- readonly display: "block";
38
+ readonly h4: {
39
+ readonly overflowWrap: "break-word";
40
+ readonly boxSizing: "border-box";
41
+ readonly margin: 0;
42
+ readonly minWidth: 0;
23
43
  };
24
- readonly hgroup: {
25
- readonly display: "block";
44
+ readonly h5: {
45
+ readonly overflowWrap: "break-word";
46
+ readonly boxSizing: "border-box";
47
+ readonly margin: 0;
48
+ readonly minWidth: 0;
26
49
  };
27
- readonly menu: {
28
- readonly display: "block";
50
+ readonly h6: {
51
+ readonly overflowWrap: "break-word";
52
+ readonly boxSizing: "border-box";
53
+ readonly margin: 0;
54
+ readonly minWidth: 0;
29
55
  };
30
- readonly nav: {
56
+ readonly img: {
31
57
  readonly display: "block";
58
+ readonly maxWidth: "100%";
59
+ readonly boxSizing: "border-box";
60
+ readonly margin: 0;
61
+ readonly minWidth: 0;
32
62
  };
33
- readonly section: {
63
+ readonly picture: {
34
64
  readonly display: "block";
65
+ readonly maxWidth: "100%";
66
+ readonly boxSizing: "border-box";
67
+ readonly margin: 0;
68
+ readonly minWidth: 0;
35
69
  };
36
- readonly ul: {};
37
- readonly ol: {};
38
- readonly blockquote: {
39
- readonly quotes: "none";
40
- readonly selectors: {
41
- readonly '&:before, &:after': {
42
- readonly content: "''";
43
- };
44
- };
45
- };
46
- readonly q: {
47
- readonly quotes: "none";
48
- readonly selectors: {
49
- readonly '&:before, &:after': {
50
- readonly content: "''";
51
- };
52
- };
53
- };
54
- readonly a: {
55
- readonly textDecoration: "none";
56
- readonly touchAction: "manipulation";
70
+ readonly video: {
71
+ readonly display: "block";
72
+ readonly maxWidth: "100%";
73
+ readonly boxSizing: "border-box";
74
+ readonly margin: 0;
75
+ readonly minWidth: 0;
57
76
  };
58
- readonly base: {
77
+ readonly canvas: {
78
+ readonly display: "block";
79
+ readonly maxWidth: "100%";
59
80
  readonly boxSizing: "border-box";
60
81
  readonly margin: 0;
61
- readonly padding: 0;
62
82
  readonly minWidth: 0;
63
- readonly fontSize: "100%";
64
- readonly fontFamily: "inherit";
65
- readonly verticalAlign: "baseline";
66
- readonly WebkitTapHighlightColor: "transparent";
67
83
  };
68
- readonly table: {
69
- readonly borderCollapse: "collapse";
70
- readonly borderSpacing: 0;
84
+ readonly svg: {
85
+ readonly display: "block";
86
+ readonly maxWidth: "100%";
87
+ readonly boxSizing: "border-box";
88
+ readonly margin: 0;
89
+ readonly minWidth: 0;
71
90
  };
72
91
  readonly select: {
73
92
  readonly display: "block";
74
93
  readonly appearance: "none";
75
- readonly selectors: {
76
- readonly '&::-ms-expand': {
77
- readonly display: "none";
78
- };
94
+ readonly font: "inherit";
95
+ readonly '&::-ms-expand': {
96
+ readonly display: "none";
79
97
  };
98
+ readonly boxSizing: "border-box";
99
+ readonly margin: 0;
100
+ readonly minWidth: 0;
80
101
  };
81
102
  readonly button: {
82
103
  readonly display: "block";
83
104
  readonly appearance: "none";
105
+ readonly font: "inherit";
84
106
  readonly background: "transparent";
85
107
  readonly textAlign: "center";
86
- readonly touchAction: "manipulation";
108
+ readonly boxSizing: "border-box";
109
+ readonly margin: 0;
110
+ readonly minWidth: 0;
87
111
  };
88
112
  readonly textarea: {
89
113
  readonly display: "block";
90
114
  readonly appearance: "none";
115
+ readonly font: "inherit";
116
+ readonly boxSizing: "border-box";
117
+ readonly margin: 0;
118
+ readonly minWidth: 0;
91
119
  };
92
120
  readonly input: {
93
121
  readonly display: "block";
94
122
  readonly appearance: "none";
95
- readonly selectors: {
96
- readonly '&::-ms-clear': {
97
- readonly display: "none";
98
- };
99
- readonly '&::-webkit-search-cancel-button': {
100
- readonly WebkitAppearance: "none";
101
- };
123
+ readonly font: "inherit";
124
+ readonly '&::-ms-clear': {
125
+ readonly display: "none";
126
+ };
127
+ readonly '&::-webkit-search-cancel-button': {
128
+ readonly WebkitAppearance: "none";
102
129
  };
130
+ readonly boxSizing: "border-box";
131
+ readonly margin: 0;
132
+ readonly minWidth: 0;
103
133
  };
104
134
  };
105
- export declare type NormalizedElement = keyof typeof reset;
135
+ export declare type NormalizedElement = keyof typeof normalize;
106
136
  /**
107
- * Helper to conveniently get reset styles.
137
+ * Type-safe helper to get normalization. If no normalization is found,
138
+ * returns the *base* normalization.
108
139
  */
109
- export declare const getNormalizedStyles: (input?: "symbol" | "object" | "article" | "aside" | "details" | "figcaption" | "figure" | "footer" | "header" | "hgroup" | "menu" | "nav" | "section" | "ul" | "ol" | "blockquote" | "q" | "a" | "base" | "table" | "select" | "button" | "textarea" | "input" | "abbr" | "address" | "area" | "audio" | "b" | "bdi" | "bdo" | "big" | "body" | "br" | "canvas" | "caption" | "cite" | "code" | "col" | "colgroup" | "data" | "datalist" | "dd" | "del" | "dfn" | "dialog" | "div" | "dl" | "dt" | "em" | "embed" | "fieldset" | "form" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "head" | "hr" | "html" | "i" | "iframe" | "img" | "ins" | "kbd" | "keygen" | "label" | "legend" | "li" | "link" | "main" | "map" | "mark" | "menuitem" | "meta" | "meter" | "noindex" | "noscript" | "optgroup" | "option" | "output" | "p" | "param" | "picture" | "pre" | "progress" | "rp" | "rt" | "ruby" | "s" | "samp" | "slot" | "script" | "small" | "source" | "span" | "strong" | "style" | "sub" | "summary" | "sup" | "template" | "tbody" | "td" | "tfoot" | "th" | "thead" | "time" | "title" | "tr" | "track" | "u" | "var" | "video" | "wbr" | "webview" | "svg" | "animate" | "animateMotion" | "animateTransform" | "circle" | "clipPath" | "defs" | "desc" | "ellipse" | "feBlend" | "feColorMatrix" | "feComponentTransfer" | "feComposite" | "feConvolveMatrix" | "feDiffuseLighting" | "feDisplacementMap" | "feDistantLight" | "feDropShadow" | "feFlood" | "feFuncA" | "feFuncB" | "feFuncG" | "feFuncR" | "feGaussianBlur" | "feImage" | "feMerge" | "feMergeNode" | "feMorphology" | "feOffset" | "fePointLight" | "feSpecularLighting" | "feSpotLight" | "feTile" | "feTurbulence" | "filter" | "foreignObject" | "g" | "image" | "line" | "linearGradient" | "marker" | "mask" | "metadata" | "mpath" | "path" | "pattern" | "polygon" | "polyline" | "radialGradient" | "rect" | "stop" | "switch" | "text" | "textPath" | "tspan" | "use" | "view" | import("react").ComponentClass<any, any> | import("react").FunctionComponent<any> | undefined) => object;
110
- export {};
140
+ export declare const getNormalizedStyles: (val?: "symbol" | "object" | "a" | "abbr" | "address" | "area" | "article" | "aside" | "audio" | "b" | "base" | "bdi" | "bdo" | "big" | "blockquote" | "body" | "br" | "button" | "canvas" | "caption" | "cite" | "code" | "col" | "colgroup" | "data" | "datalist" | "dd" | "del" | "details" | "dfn" | "dialog" | "div" | "dl" | "dt" | "em" | "embed" | "fieldset" | "figcaption" | "figure" | "footer" | "form" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "head" | "header" | "hgroup" | "hr" | "html" | "i" | "iframe" | "img" | "input" | "ins" | "kbd" | "keygen" | "label" | "legend" | "li" | "link" | "main" | "map" | "mark" | "menu" | "menuitem" | "meta" | "meter" | "nav" | "noindex" | "noscript" | "ol" | "optgroup" | "option" | "output" | "p" | "param" | "picture" | "pre" | "progress" | "q" | "rp" | "rt" | "ruby" | "s" | "samp" | "slot" | "script" | "section" | "select" | "small" | "source" | "span" | "strong" | "style" | "sub" | "summary" | "sup" | "table" | "template" | "tbody" | "td" | "textarea" | "tfoot" | "th" | "thead" | "time" | "title" | "tr" | "track" | "u" | "ul" | "var" | "video" | "wbr" | "webview" | "svg" | "animate" | "animateMotion" | "animateTransform" | "circle" | "clipPath" | "defs" | "desc" | "ellipse" | "feBlend" | "feColorMatrix" | "feComponentTransfer" | "feComposite" | "feConvolveMatrix" | "feDiffuseLighting" | "feDisplacementMap" | "feDistantLight" | "feDropShadow" | "feFlood" | "feFuncA" | "feFuncB" | "feFuncG" | "feFuncR" | "feGaussianBlur" | "feImage" | "feMerge" | "feMergeNode" | "feMorphology" | "feOffset" | "fePointLight" | "feSpecularLighting" | "feSpotLight" | "feTile" | "feTurbulence" | "filter" | "foreignObject" | "g" | "image" | "line" | "linearGradient" | "marker" | "mask" | "metadata" | "mpath" | "path" | "pattern" | "polygon" | "polyline" | "radialGradient" | "rect" | "stop" | "switch" | "text" | "textPath" | "tspan" | "use" | "view" | import("react").ComponentClass<any, any> | import("react").FunctionComponent<any> | undefined) => {
141
+ readonly boxSizing: "border-box";
142
+ readonly margin: 0;
143
+ readonly minWidth: 0;
144
+ };