boxwood 2.4.3 → 2.4.4

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/index.js CHANGED
@@ -320,7 +320,20 @@ const attributes = (options) => {
320
320
  continue
321
321
  }
322
322
  const result = value[param]
323
- if (result) {
323
+ if (
324
+ (param === "padding" || param === "margin") &&
325
+ typeof result === "object"
326
+ ) {
327
+ const top = result.top || "0"
328
+ const right = result.right || "0"
329
+ const bottom = result.bottom || "0"
330
+ const left = result.left || "0"
331
+ styles.push(
332
+ `${decamelize(param)}:${escapeHTML(
333
+ `${top} ${right} ${bottom} ${left}`
334
+ )}`
335
+ )
336
+ } else if (typeof result === "string" || typeof result === "number") {
324
337
  styles.push(`${decamelize(param)}:${escapeHTML(result)}`)
325
338
  }
326
339
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "boxwood",
3
- "version": "2.4.3",
3
+ "version": "2.4.4",
4
4
  "description": "Compile HTML templates into JS",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
package/ui/grid/index.js CHANGED
@@ -1,6 +1,13 @@
1
1
  const { component, css, Div } = require("../..")
2
2
  const { normalizeGap, normalizeBreakpoint } = require("../normalize")
3
3
 
4
+ const BREAKPOINTS = {
5
+ xl: "1199px",
6
+ lg: "1023px",
7
+ md: "767px",
8
+ sm: "575px",
9
+ }
10
+
4
11
  function Grid({ className, columns = 3, gap, breakpoint, style }, children) {
5
12
  gap = normalizeGap(gap)
6
13
  breakpoint = normalizeBreakpoint(breakpoint)
@@ -19,8 +26,10 @@ function Grid({ className, columns = 3, gap, breakpoint, style }, children) {
19
26
  Object.keys(columns).reduce((object, key) => {
20
27
  if (key === "default") {
21
28
  object["grid-template-columns"] = columns[key]
22
- } else {
23
- object[`@media (min-width: ${key}px)`] = {
29
+ } else if (typeof key === "string") {
30
+ const value =
31
+ BREAKPOINTS[key] || (key.endsWith("px") ? key : `${key}px`)
32
+ object[`@media (max-width: ${value})`] = {
24
33
  "grid-template-columns": columns[key],
25
34
  }
26
35
  }