@marigold/system 1.2.2 → 1.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 (3) hide show
  1. package/dist/index.js +147 -109
  2. package/dist/index.mjs +143 -108
  3. package/package.json +3 -4
package/dist/index.js CHANGED
@@ -17,7 +17,10 @@ var __copyProps = (to, from, except, desc) => {
17
17
  }
18
18
  return to;
19
19
  };
20
- 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));
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
22
+ mod
23
+ ));
21
24
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
22
25
 
23
26
  // src/index.ts
@@ -43,7 +46,9 @@ var import_deepmerge = __toESM(require("deepmerge"));
43
46
 
44
47
  // src/components/Box/selector.ts
45
48
  var createteSelector = (selectors, states, suffix = "") => {
46
- return selectors.map((selector2) => states.map((state2) => `${selector2}${state2}${suffix ? ` ${suffix}` : ""}`)).flat().join(", ");
49
+ return selectors.map(
50
+ (selector2) => states.map((state2) => `${selector2}${state2}${suffix ? ` ${suffix}` : ""}`)
51
+ ).flat().join(", ");
47
52
  };
48
53
  var selector = {
49
54
  self: "&",
@@ -76,10 +81,26 @@ var pseudos = {
76
81
  "&:error": createteSelector([selector.self], state.error),
77
82
  "&:expanded": createteSelector([selector.self], state.expanded),
78
83
  "&:in-group": createteSelector(selector.grouped, state.none, selector.self),
79
- "&:hover-group": createteSelector(selector.grouped, state.hover, selector.self),
80
- "&:focus-group": createteSelector(selector.grouped, state.focus, selector.self),
81
- "&:active-group": createteSelector(selector.grouped, state.active, selector.self),
82
- "&:error-group": createteSelector(selector.grouped, state.error, selector.self)
84
+ "&:hover-group": createteSelector(
85
+ selector.grouped,
86
+ state.hover,
87
+ selector.self
88
+ ),
89
+ "&:focus-group": createteSelector(
90
+ selector.grouped,
91
+ state.focus,
92
+ selector.self
93
+ ),
94
+ "&:active-group": createteSelector(
95
+ selector.grouped,
96
+ state.active,
97
+ selector.self
98
+ ),
99
+ "&:error-group": createteSelector(
100
+ selector.grouped,
101
+ state.error,
102
+ selector.self
103
+ )
83
104
  };
84
105
  var transformPseudos = (styles) => {
85
106
  let result = {};
@@ -106,99 +127,105 @@ var createThemedStyle = ({ as, __baseCSS, styles, css }) => (theme) => {
106
127
  ]);
107
128
  return transformPseudos(themedStyles);
108
129
  };
109
- var Box = (0, import_react.forwardRef)(({
110
- as = "div",
111
- children,
112
- __baseCSS,
113
- css,
114
- display,
115
- height,
116
- width,
117
- minWidth,
118
- maxWidth,
119
- position,
120
- top,
121
- bottom,
122
- right,
123
- left,
124
- zIndex,
125
- p,
126
- px,
127
- py,
128
- pt,
129
- pb,
130
- pl,
131
- pr,
132
- m,
133
- mx,
134
- my,
135
- mt,
136
- mb,
137
- ml,
138
- mr,
139
- flexDirection,
140
- flexWrap,
141
- flexShrink,
142
- flexGrow,
143
- alignItems,
144
- justifyContent,
145
- bg,
146
- border,
147
- borderRadius,
148
- boxShadow,
149
- opacity,
150
- overflow,
151
- transition,
152
- ...props
153
- }, ref) => (0, import_react2.jsx)(as, {
154
- ...props,
155
- css: createThemedStyle({
156
- as,
130
+ var Box = (0, import_react.forwardRef)(
131
+ ({
132
+ as = "div",
133
+ children,
157
134
  __baseCSS,
158
135
  css,
159
- styles: {
160
- display,
161
- height,
162
- width,
163
- minWidth,
164
- maxWidth,
165
- position,
166
- top,
167
- bottom,
168
- right,
169
- left,
170
- zIndex,
171
- p,
172
- px,
173
- py,
174
- pt,
175
- pb,
176
- pl,
177
- pr,
178
- m,
179
- mx,
180
- my,
181
- mt,
182
- mb,
183
- ml,
184
- mr,
185
- flexDirection,
186
- flexWrap,
187
- flexShrink,
188
- flexGrow,
189
- alignItems,
190
- justifyContent,
191
- bg,
192
- border,
193
- borderRadius,
194
- boxShadow,
195
- opacity,
196
- overflow,
197
- transition
198
- }
199
- }),
200
- ref
201
- }, children));
136
+ display,
137
+ height,
138
+ width,
139
+ minWidth,
140
+ maxWidth,
141
+ position,
142
+ top,
143
+ bottom,
144
+ right,
145
+ left,
146
+ zIndex,
147
+ p,
148
+ px,
149
+ py,
150
+ pt,
151
+ pb,
152
+ pl,
153
+ pr,
154
+ m,
155
+ mx,
156
+ my,
157
+ mt,
158
+ mb,
159
+ ml,
160
+ mr,
161
+ flexDirection,
162
+ flexWrap,
163
+ flexShrink,
164
+ flexGrow,
165
+ alignItems,
166
+ justifyContent,
167
+ bg,
168
+ border,
169
+ borderRadius,
170
+ boxShadow,
171
+ opacity,
172
+ overflow,
173
+ transition,
174
+ ...props
175
+ }, ref) => (0, import_react2.jsx)(
176
+ as,
177
+ {
178
+ ...props,
179
+ css: createThemedStyle({
180
+ as,
181
+ __baseCSS,
182
+ css,
183
+ styles: {
184
+ display,
185
+ height,
186
+ width,
187
+ minWidth,
188
+ maxWidth,
189
+ position,
190
+ top,
191
+ bottom,
192
+ right,
193
+ left,
194
+ zIndex,
195
+ p,
196
+ px,
197
+ py,
198
+ pt,
199
+ pb,
200
+ pl,
201
+ pr,
202
+ m,
203
+ mx,
204
+ my,
205
+ mt,
206
+ mb,
207
+ ml,
208
+ mr,
209
+ flexDirection,
210
+ flexWrap,
211
+ flexShrink,
212
+ flexGrow,
213
+ alignItems,
214
+ justifyContent,
215
+ bg,
216
+ border,
217
+ borderRadius,
218
+ boxShadow,
219
+ opacity,
220
+ overflow,
221
+ transition
222
+ }
223
+ }),
224
+ ref
225
+ },
226
+ children
227
+ )
228
+ );
202
229
 
203
230
  // src/components/Global/Global.tsx
204
231
  var import_react5 = __toESM(require("react"));
@@ -212,7 +239,10 @@ var __defaultTheme = {};
212
239
  var InternalContext = (0, import_react3.createContext)(__defaultTheme);
213
240
  var useTheme = () => {
214
241
  const theme = (0, import_react3.useContext)(InternalContext);
215
- const css = (0, import_react3.useCallback)((style) => (0, import_css2.css)(style)(theme), [theme]);
242
+ const css = (0, import_react3.useCallback)(
243
+ (style) => (0, import_css2.css)(style)(theme),
244
+ [theme]
245
+ );
216
246
  const get2 = (0, import_react3.useCallback)((path) => (0, import_css2.get)(theme, path), [theme]);
217
247
  return { theme, css, get: get2 };
218
248
  };
@@ -359,11 +389,15 @@ var useResponsiveValue = (values, defaultIndex = 0) => {
359
389
  const { theme } = useTheme();
360
390
  const breakpoints = theme.breakpoints || emptyBreakpoints;
361
391
  if (defaultIndex < 0 || defaultIndex >= breakpoints.length) {
362
- throw new RangeError(`Default breakpoint index is out of bounds. Theme has ${breakpoints.length} breakpoints, default is ${defaultIndex}.`);
392
+ throw new RangeError(
393
+ `Default breakpoint index is out of bounds. Theme has ${breakpoints.length} breakpoints, default is ${defaultIndex}.`
394
+ );
363
395
  }
364
396
  const [index, setIndex] = (0, import_react8.useState)(defaultIndex);
365
397
  (0, import_react8.useEffect)(() => {
366
- const getIndex = () => breakpoints.filter((breakpoint) => window.matchMedia(`screen and (min-width: ${breakpoint})`).matches).length;
398
+ const getIndex = () => breakpoints.filter(
399
+ (breakpoint) => window.matchMedia(`screen and (min-width: ${breakpoint})`).matches
400
+ ).length;
367
401
  const handleResize = () => {
368
402
  const newIndex = getIndex();
369
403
  if (index !== newIndex) {
@@ -407,15 +441,19 @@ var SVG = ({
407
441
  ...props
408
442
  }) => {
409
443
  const { css } = useTheme();
410
- return (0, import_react10.jsx)("svg", {
411
- viewBox: "0 0 24 24",
412
- css: css({
413
- fill,
414
- width: toDimension(props.width || size),
415
- height: toDimension(props.height || size)
416
- }),
417
- ...props
418
- }, children);
444
+ return (0, import_react10.jsx)(
445
+ "svg",
446
+ {
447
+ viewBox: "0 0 24 24",
448
+ css: css({
449
+ fill,
450
+ width: toDimension(props.width || size),
451
+ height: toDimension(props.height || size)
452
+ }),
453
+ ...props
454
+ },
455
+ children
456
+ );
419
457
  };
420
458
  // Annotate the CommonJS export names for ESM import in node:
421
459
  0 && (module.exports = {
package/dist/index.mjs CHANGED
@@ -6,7 +6,9 @@ import merge from "deepmerge";
6
6
 
7
7
  // src/components/Box/selector.ts
8
8
  var createteSelector = (selectors, states, suffix = "") => {
9
- return selectors.map((selector2) => states.map((state2) => `${selector2}${state2}${suffix ? ` ${suffix}` : ""}`)).flat().join(", ");
9
+ return selectors.map(
10
+ (selector2) => states.map((state2) => `${selector2}${state2}${suffix ? ` ${suffix}` : ""}`)
11
+ ).flat().join(", ");
10
12
  };
11
13
  var selector = {
12
14
  self: "&",
@@ -39,10 +41,26 @@ var pseudos = {
39
41
  "&:error": createteSelector([selector.self], state.error),
40
42
  "&:expanded": createteSelector([selector.self], state.expanded),
41
43
  "&:in-group": createteSelector(selector.grouped, state.none, selector.self),
42
- "&:hover-group": createteSelector(selector.grouped, state.hover, selector.self),
43
- "&:focus-group": createteSelector(selector.grouped, state.focus, selector.self),
44
- "&:active-group": createteSelector(selector.grouped, state.active, selector.self),
45
- "&:error-group": createteSelector(selector.grouped, state.error, selector.self)
44
+ "&:hover-group": createteSelector(
45
+ selector.grouped,
46
+ state.hover,
47
+ selector.self
48
+ ),
49
+ "&:focus-group": createteSelector(
50
+ selector.grouped,
51
+ state.focus,
52
+ selector.self
53
+ ),
54
+ "&:active-group": createteSelector(
55
+ selector.grouped,
56
+ state.active,
57
+ selector.self
58
+ ),
59
+ "&:error-group": createteSelector(
60
+ selector.grouped,
61
+ state.error,
62
+ selector.self
63
+ )
46
64
  };
47
65
  var transformPseudos = (styles) => {
48
66
  let result = {};
@@ -69,99 +87,105 @@ var createThemedStyle = ({ as, __baseCSS, styles, css }) => (theme) => {
69
87
  ]);
70
88
  return transformPseudos(themedStyles);
71
89
  };
72
- var Box = forwardRef(({
73
- as = "div",
74
- children,
75
- __baseCSS,
76
- css,
77
- display,
78
- height,
79
- width,
80
- minWidth,
81
- maxWidth,
82
- position,
83
- top,
84
- bottom,
85
- right,
86
- left,
87
- zIndex,
88
- p,
89
- px,
90
- py,
91
- pt,
92
- pb,
93
- pl,
94
- pr,
95
- m,
96
- mx,
97
- my,
98
- mt,
99
- mb,
100
- ml,
101
- mr,
102
- flexDirection,
103
- flexWrap,
104
- flexShrink,
105
- flexGrow,
106
- alignItems,
107
- justifyContent,
108
- bg,
109
- border,
110
- borderRadius,
111
- boxShadow,
112
- opacity,
113
- overflow,
114
- transition,
115
- ...props
116
- }, ref) => jsx(as, {
117
- ...props,
118
- css: createThemedStyle({
119
- as,
90
+ var Box = forwardRef(
91
+ ({
92
+ as = "div",
93
+ children,
120
94
  __baseCSS,
121
95
  css,
122
- styles: {
123
- display,
124
- height,
125
- width,
126
- minWidth,
127
- maxWidth,
128
- position,
129
- top,
130
- bottom,
131
- right,
132
- left,
133
- zIndex,
134
- p,
135
- px,
136
- py,
137
- pt,
138
- pb,
139
- pl,
140
- pr,
141
- m,
142
- mx,
143
- my,
144
- mt,
145
- mb,
146
- ml,
147
- mr,
148
- flexDirection,
149
- flexWrap,
150
- flexShrink,
151
- flexGrow,
152
- alignItems,
153
- justifyContent,
154
- bg,
155
- border,
156
- borderRadius,
157
- boxShadow,
158
- opacity,
159
- overflow,
160
- transition
161
- }
162
- }),
163
- ref
164
- }, children));
96
+ display,
97
+ height,
98
+ width,
99
+ minWidth,
100
+ maxWidth,
101
+ position,
102
+ top,
103
+ bottom,
104
+ right,
105
+ left,
106
+ zIndex,
107
+ p,
108
+ px,
109
+ py,
110
+ pt,
111
+ pb,
112
+ pl,
113
+ pr,
114
+ m,
115
+ mx,
116
+ my,
117
+ mt,
118
+ mb,
119
+ ml,
120
+ mr,
121
+ flexDirection,
122
+ flexWrap,
123
+ flexShrink,
124
+ flexGrow,
125
+ alignItems,
126
+ justifyContent,
127
+ bg,
128
+ border,
129
+ borderRadius,
130
+ boxShadow,
131
+ opacity,
132
+ overflow,
133
+ transition,
134
+ ...props
135
+ }, ref) => jsx(
136
+ as,
137
+ {
138
+ ...props,
139
+ css: createThemedStyle({
140
+ as,
141
+ __baseCSS,
142
+ css,
143
+ styles: {
144
+ display,
145
+ height,
146
+ width,
147
+ minWidth,
148
+ maxWidth,
149
+ position,
150
+ top,
151
+ bottom,
152
+ right,
153
+ left,
154
+ zIndex,
155
+ p,
156
+ px,
157
+ py,
158
+ pt,
159
+ pb,
160
+ pl,
161
+ pr,
162
+ m,
163
+ mx,
164
+ my,
165
+ mt,
166
+ mb,
167
+ ml,
168
+ mr,
169
+ flexDirection,
170
+ flexWrap,
171
+ flexShrink,
172
+ flexGrow,
173
+ alignItems,
174
+ justifyContent,
175
+ bg,
176
+ border,
177
+ borderRadius,
178
+ boxShadow,
179
+ opacity,
180
+ overflow,
181
+ transition
182
+ }
183
+ }),
184
+ ref
185
+ },
186
+ children
187
+ )
188
+ );
165
189
 
166
190
  // src/components/Global/Global.tsx
167
191
  import React2 from "react";
@@ -182,7 +206,10 @@ var __defaultTheme = {};
182
206
  var InternalContext = createContext(__defaultTheme);
183
207
  var useTheme = () => {
184
208
  const theme = useContext(InternalContext);
185
- const css = useCallback((style) => transformStyleObject2(style)(theme), [theme]);
209
+ const css = useCallback(
210
+ (style) => transformStyleObject2(style)(theme),
211
+ [theme]
212
+ );
186
213
  const get2 = useCallback((path) => getfromTheme(theme, path), [theme]);
187
214
  return { theme, css, get: get2 };
188
215
  };
@@ -329,11 +356,15 @@ var useResponsiveValue = (values, defaultIndex = 0) => {
329
356
  const { theme } = useTheme();
330
357
  const breakpoints = theme.breakpoints || emptyBreakpoints;
331
358
  if (defaultIndex < 0 || defaultIndex >= breakpoints.length) {
332
- throw new RangeError(`Default breakpoint index is out of bounds. Theme has ${breakpoints.length} breakpoints, default is ${defaultIndex}.`);
359
+ throw new RangeError(
360
+ `Default breakpoint index is out of bounds. Theme has ${breakpoints.length} breakpoints, default is ${defaultIndex}.`
361
+ );
333
362
  }
334
363
  const [index, setIndex] = useState(defaultIndex);
335
364
  useEffect(() => {
336
- const getIndex = () => breakpoints.filter((breakpoint) => window.matchMedia(`screen and (min-width: ${breakpoint})`).matches).length;
365
+ const getIndex = () => breakpoints.filter(
366
+ (breakpoint) => window.matchMedia(`screen and (min-width: ${breakpoint})`).matches
367
+ ).length;
337
368
  const handleResize = () => {
338
369
  const newIndex = getIndex();
339
370
  if (index !== newIndex) {
@@ -377,15 +408,19 @@ var SVG = ({
377
408
  ...props
378
409
  }) => {
379
410
  const { css } = useTheme();
380
- return jsx2("svg", {
381
- viewBox: "0 0 24 24",
382
- css: css({
383
- fill,
384
- width: toDimension(props.width || size),
385
- height: toDimension(props.height || size)
386
- }),
387
- ...props
388
- }, children);
411
+ return jsx2(
412
+ "svg",
413
+ {
414
+ viewBox: "0 0 24 24",
415
+ css: css({
416
+ fill,
417
+ width: toDimension(props.width || size),
418
+ height: toDimension(props.height || size)
419
+ }),
420
+ ...props
421
+ },
422
+ children
423
+ );
389
424
  };
390
425
  export {
391
426
  Box,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marigold/system",
3
- "version": "1.2.2",
3
+ "version": "1.3.0",
4
4
  "description": "Marigold System Library",
5
5
  "license": "MIT",
6
6
  "keywords": [
@@ -38,7 +38,7 @@
38
38
  "react-dom": "16.x || 17.x || 18.x"
39
39
  },
40
40
  "devDependencies": {
41
- "@babel/core": "7.18.6",
41
+ "@babel/core": "7.18.9",
42
42
  "@marigold/tsconfig": "0.3.0",
43
43
  "react": "18.2.0",
44
44
  "tsup": "6.1.3"
@@ -47,6 +47,5 @@
47
47
  "build": "tsup src/index.ts",
48
48
  "watch": "tsup src/index.ts --watch",
49
49
  "clean": "rm -rf node_modules && rm -rf dist"
50
- },
51
- "readme": "# `@marigold/system`\n\n> Marigold system\n"
50
+ }
52
51
  }