@marigold/system 4.2.1 → 5.0.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/dist/index.d.ts CHANGED
@@ -1,26 +1,26 @@
1
- import { Simplify, PolymorphicPropsWithRef, PolymorphicComponentWithRef, ComponentProps, KebabCase } from '@marigold/types';
1
+ import { Simplify, PropsOf, PolymorphicComponent, HtmlProps, KebabCase } 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
4
  import * as react from 'react';
5
5
  import { ReactNode } from 'react';
6
6
  import * as CSS from 'csstype';
7
7
 
8
- declare type ResponsiveStyleValue<T> = ResponsiveStyleValue$1<T>;
9
- declare type StyleObject = ThemeUIStyleObject;
10
- declare type CSSObject = Simplify<ThemeUICSSObject>;
11
- declare type CSSProperties = Simplify<ThemeUICSSProperties>;
8
+ type ResponsiveStyleValue<T> = ResponsiveStyleValue$1<T>;
9
+ type StyleObject = ThemeUIStyleObject;
10
+ type CSSObject = Simplify<ThemeUICSSObject>;
11
+ type CSSProperties = Simplify<ThemeUICSSProperties>;
12
12
 
13
13
  /**
14
14
  * Props that every component should accepts to change the styling
15
15
  */
16
- declare type ThemeComponentProps = {
16
+ type ThemeComponentProps = {
17
17
  variant?: string;
18
18
  size?: string;
19
19
  };
20
20
  /**
21
21
  * Structure for component styles in a theme.
22
22
  */
23
- declare type ThemeExtension<ComponentName extends string> = {
23
+ type ThemeExtension<ComponentName extends string> = {
24
24
  [P in ComponentName]?: {
25
25
  base?: CSSObject;
26
26
  variant?: {
@@ -34,7 +34,7 @@ declare type ThemeExtension<ComponentName extends string> = {
34
34
  /**
35
35
  * Structure for component styles in a theme that consists of multiple parts.
36
36
  */
37
- declare type ThemeExtensionsWithParts<ComponentName extends string, Parts extends string[]> = {
37
+ type ThemeExtensionsWithParts<ComponentName extends string, Parts extends string[]> = {
38
38
  [P in ComponentName]?: {
39
39
  base?: {
40
40
  [Part in Parts[number]]?: CSSObject;
@@ -67,7 +67,7 @@ declare type ThemeExtensionsWithParts<ComponentName extends string, Parts extend
67
67
  * ```
68
68
  * `css{{ color: 'primary' }}` resolves to `color: #00f`.
69
69
  */
70
- declare type ScaleValue<T> = T | T[] | NestedScaleDict<T> | undefined;
70
+ type ScaleValue<T> = T | T[] | NestedScaleDict<T> | undefined;
71
71
  /**
72
72
  * Scales are a set of named, pre-defined CSS values which are used
73
73
  * to create consitency in sizing across visual elements. They give
@@ -205,9 +205,7 @@ interface Theme {
205
205
  transitions?: Scale<CSS.Property.Transition>;
206
206
  }
207
207
 
208
- 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'> {
209
- }
210
- interface BoxOwnProps extends StyleProps {
208
+ interface BoxOwnProps {
211
209
  css?: CSSObject | CSSObject[];
212
210
  /**
213
211
  * Use to set base styles for the component
@@ -215,11 +213,11 @@ interface BoxOwnProps extends StyleProps {
215
213
  */
216
214
  __baseCSS?: CSSObject;
217
215
  }
218
- interface BoxProps extends PolymorphicPropsWithRef<BoxOwnProps, 'div'> {
216
+ interface BoxProps extends PropsOf<typeof Box> {
219
217
  }
220
- declare const Box: PolymorphicComponentWithRef<BoxOwnProps, 'div'>;
218
+ declare const Box: PolymorphicComponent<"div", BoxOwnProps>;
221
219
 
222
- declare type GlobalProps = {
220
+ type GlobalProps = {
223
221
  /**
224
222
  * CSS Selector to change the element that the styles will be applied to.
225
223
  */
@@ -231,7 +229,7 @@ declare type GlobalProps = {
231
229
  };
232
230
  declare const Global: ({ normalizeDocument, selector }: GlobalProps) => JSX.Element;
233
231
 
234
- interface SVGProps extends ComponentProps<'svg'> {
232
+ interface SVGProps extends HtmlProps<'svg'> {
235
233
  size?: number | string | number[] | string[];
236
234
  css?: CSSObject;
237
235
  }
@@ -241,7 +239,7 @@ interface ComponentStylesProps {
241
239
  variant?: string;
242
240
  size?: string;
243
241
  }
244
- declare type ComponentStyleParts<Parts extends string[]> = {
242
+ type ComponentStyleParts<Parts extends string[]> = {
245
243
  [P in Parts[number]]: CSSObject;
246
244
  };
247
245
  declare function useComponentStyles(componentName: string, props?: ComponentStylesProps, options?: {
@@ -260,12 +258,12 @@ declare function useComponentStyles<Part extends string, Parts extends ReadonlyA
260
258
  */
261
259
  declare const useResponsiveValue: <T>(values: T[], defaultIndex?: number) => T;
262
260
 
263
- declare type ComponentState = 'hover' | 'focus' | 'focusVisible' | 'active' | 'visited' | 'disabled' | 'readOnly' | 'checked' | 'selected' | 'indeterminate' | 'expanded' | 'error';
264
- declare type StateAttrKeyProps = `data-${KebabCase<ComponentState>}`;
265
- declare type StateAttrProps = {
261
+ type ComponentState = 'hover' | 'focus' | 'focusVisible' | 'active' | 'visited' | 'disabled' | 'readOnly' | 'checked' | 'selected' | 'indeterminate' | 'expanded' | 'error';
262
+ type StateAttrKeyProps = `data-${KebabCase<ComponentState>}`;
263
+ type StateAttrProps = {
266
264
  [key in StateAttrKeyProps]?: '';
267
265
  };
268
- declare type UseStateProps = {
266
+ type UseStateProps = {
269
267
  [key in ComponentState]?: boolean;
270
268
  };
271
269
  /**
@@ -290,4 +288,4 @@ interface ThemeProviderProps<T extends Theme> {
290
288
  }
291
289
  declare function ThemeProvider<T extends Theme>({ theme, children, }: ThemeProviderProps<T>): JSX.Element;
292
290
 
293
- export { Box, BoxOwnProps, BoxProps, CSSObject, CSSProperties, ComponentState, ComponentStyleParts, ComponentStylesProps, Global, GlobalProps, ResponsiveStyleValue, SVG, SVGProps, Scale, ScaleValue, SizeScale, StateAttrKeyProps, StateAttrProps, StyleObject, StyleProps, Theme, ThemeComponentProps, ThemeExtension, ThemeExtensionsWithParts, ThemeProvider, ThemeProviderProps, UseStateProps, ZeroScale, ZeroSizeScale, __defaultTheme, useComponentStyles, useResponsiveValue, useStateProps, useTheme };
291
+ export { Box, BoxOwnProps, BoxProps, CSSObject, CSSProperties, ComponentState, ComponentStyleParts, ComponentStylesProps, Global, GlobalProps, ResponsiveStyleValue, SVG, SVGProps, Scale, ScaleValue, SizeScale, StateAttrKeyProps, StateAttrProps, StyleObject, Theme, ThemeComponentProps, ThemeExtension, ThemeExtensionsWithParts, ThemeProvider, ThemeProviderProps, UseStateProps, ZeroScale, ZeroSizeScale, __defaultTheme, useComponentStyles, useResponsiveValue, useStateProps, useTheme };
package/dist/index.js CHANGED
@@ -121,106 +121,21 @@ var transformPseudos = (styles) => {
121
121
  };
122
122
 
123
123
  // src/components/Box/Box.tsx
124
- var createThemedStyle = ({ __baseCSS, styles, css }) => (theme) => {
124
+ var createThemedStyle = ({ __baseCSS, css }) => (theme) => {
125
125
  const themedStyles = import_deepmerge.default.all([
126
126
  (0, import_css.css)(__baseCSS)(theme),
127
- (0, import_css.css)(styles)(theme),
128
127
  ...Array.isArray(css) ? css.map((c) => (0, import_css.css)(c)(theme)) : [(0, import_css.css)(css)(theme)]
129
128
  ]);
130
129
  return transformPseudos(themedStyles);
131
130
  };
132
131
  var Box = (0, import_react.forwardRef)(
133
- ({
134
- as = "div",
135
- children,
136
- __baseCSS,
137
- css,
138
- display,
139
- height,
140
- width,
141
- minWidth,
142
- maxWidth,
143
- position,
144
- top,
145
- bottom,
146
- right,
147
- left,
148
- zIndex,
149
- p,
150
- px,
151
- py,
152
- pt,
153
- pb,
154
- pl,
155
- pr,
156
- m,
157
- mx,
158
- my,
159
- mt,
160
- mb,
161
- ml,
162
- mr,
163
- flexDirection,
164
- flexWrap,
165
- flexShrink,
166
- flexGrow,
167
- alignItems,
168
- justifyContent,
169
- bg,
170
- border,
171
- borderRadius,
172
- boxShadow,
173
- opacity,
174
- overflow,
175
- transition,
176
- ...props
177
- }, ref) => (0, import_react2.jsx)(
132
+ ({ as = "div", children, __baseCSS, css, ...props }, ref) => (0, import_react2.jsx)(
178
133
  as,
179
134
  {
180
135
  ...props,
181
136
  css: createThemedStyle({
182
137
  __baseCSS,
183
- css,
184
- styles: {
185
- display,
186
- height,
187
- width,
188
- minWidth,
189
- maxWidth,
190
- position,
191
- top,
192
- bottom,
193
- right,
194
- left,
195
- zIndex,
196
- p,
197
- px,
198
- py,
199
- pt,
200
- pb,
201
- pl,
202
- pr,
203
- m,
204
- mx,
205
- my,
206
- mt,
207
- mb,
208
- ml,
209
- mr,
210
- flexDirection,
211
- flexWrap,
212
- flexShrink,
213
- flexGrow,
214
- alignItems,
215
- justifyContent,
216
- bg,
217
- border,
218
- borderRadius,
219
- boxShadow,
220
- opacity,
221
- overflow,
222
- transition
223
- }
138
+ css
224
139
  }),
225
140
  ref
226
141
  },
package/dist/index.mjs CHANGED
@@ -81,106 +81,21 @@ var transformPseudos = (styles) => {
81
81
  };
82
82
 
83
83
  // src/components/Box/Box.tsx
84
- var createThemedStyle = ({ __baseCSS, styles, css }) => (theme) => {
84
+ var createThemedStyle = ({ __baseCSS, css }) => (theme) => {
85
85
  const themedStyles = merge.all([
86
86
  transformStyleObject(__baseCSS)(theme),
87
- transformStyleObject(styles)(theme),
88
87
  ...Array.isArray(css) ? css.map((c) => transformStyleObject(c)(theme)) : [transformStyleObject(css)(theme)]
89
88
  ]);
90
89
  return transformPseudos(themedStyles);
91
90
  };
92
91
  var Box = forwardRef(
93
- ({
94
- as = "div",
95
- children,
96
- __baseCSS,
97
- css,
98
- display,
99
- height,
100
- width,
101
- minWidth,
102
- maxWidth,
103
- position,
104
- top,
105
- bottom,
106
- right,
107
- left,
108
- zIndex,
109
- p,
110
- px,
111
- py,
112
- pt,
113
- pb,
114
- pl,
115
- pr,
116
- m,
117
- mx,
118
- my,
119
- mt,
120
- mb,
121
- ml,
122
- mr,
123
- flexDirection,
124
- flexWrap,
125
- flexShrink,
126
- flexGrow,
127
- alignItems,
128
- justifyContent,
129
- bg,
130
- border,
131
- borderRadius,
132
- boxShadow,
133
- opacity,
134
- overflow,
135
- transition,
136
- ...props
137
- }, ref) => jsx(
92
+ ({ as = "div", children, __baseCSS, css, ...props }, ref) => jsx(
138
93
  as,
139
94
  {
140
95
  ...props,
141
96
  css: createThemedStyle({
142
97
  __baseCSS,
143
- css,
144
- styles: {
145
- display,
146
- height,
147
- width,
148
- minWidth,
149
- maxWidth,
150
- position,
151
- top,
152
- bottom,
153
- right,
154
- left,
155
- zIndex,
156
- p,
157
- px,
158
- py,
159
- pt,
160
- pb,
161
- pl,
162
- pr,
163
- m,
164
- mx,
165
- my,
166
- mt,
167
- mb,
168
- ml,
169
- mr,
170
- flexDirection,
171
- flexWrap,
172
- flexShrink,
173
- flexGrow,
174
- alignItems,
175
- justifyContent,
176
- bg,
177
- border,
178
- borderRadius,
179
- boxShadow,
180
- opacity,
181
- overflow,
182
- transition
183
- }
98
+ css
184
99
  }),
185
100
  ref
186
101
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marigold/system",
3
- "version": "4.2.1",
3
+ "version": "5.0.0",
4
4
  "description": "Marigold System Library",
5
5
  "license": "MIT",
6
6
  "keywords": [
@@ -27,21 +27,21 @@
27
27
  },
28
28
  "dependencies": {
29
29
  "@emotion/react": "11.10.5",
30
- "@marigold/types": "0.5.7",
31
30
  "@theme-ui/css": "0.15.4",
32
31
  "csstype": "3.1.1",
33
32
  "deepmerge": "^4.2.2",
34
- "react-fast-compare": "^3.2.0"
33
+ "react-fast-compare": "^3.2.0",
34
+ "@marigold/types": "1.0.0"
35
35
  },
36
36
  "peerDependencies": {
37
37
  "react": "16.x || 17.x || 18.x",
38
38
  "react-dom": "16.x || 17.x || 18.x"
39
39
  },
40
40
  "devDependencies": {
41
- "@babel/core": "7.20.5",
42
- "@marigold/tsconfig": "0.3.1",
41
+ "@babel/core": "7.20.12",
43
42
  "react": "18.2.0",
44
- "tsup": "6.4.0"
43
+ "tsup": "6.5.0",
44
+ "@marigold/tsconfig": "0.4.0"
45
45
  },
46
46
  "scripts": {
47
47
  "build": "tsup src/index.ts",