boxwood 2.4.3 → 2.4.5
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 +14 -1
- package/package.json +1 -1
- package/ui/grid/index.js +18 -4
package/index.js
CHANGED
|
@@ -320,7 +320,20 @@ const attributes = (options) => {
|
|
|
320
320
|
continue
|
|
321
321
|
}
|
|
322
322
|
const result = value[param]
|
|
323
|
-
if (
|
|
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
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)
|
|
@@ -17,11 +24,18 @@ function Grid({ className, columns = 3, gap, breakpoint, style }, children) {
|
|
|
17
24
|
}),
|
|
18
25
|
...(typeof columns === "object" &&
|
|
19
26
|
Object.keys(columns).reduce((object, key) => {
|
|
27
|
+
const value =
|
|
28
|
+
typeof columns[key] === "number"
|
|
29
|
+
? `repeat(${columns[key]}, 1fr)`
|
|
30
|
+
: columns[key]
|
|
20
31
|
if (key === "default") {
|
|
21
|
-
object["grid-template-columns"] =
|
|
22
|
-
} else {
|
|
23
|
-
|
|
24
|
-
"
|
|
32
|
+
object["grid-template-columns"] = value
|
|
33
|
+
} else if (typeof key === "string") {
|
|
34
|
+
const maxWidth =
|
|
35
|
+
BREAKPOINTS[key] || (key.endsWith("px") ? key : `${key}px`)
|
|
36
|
+
|
|
37
|
+
object[`@media (max-width: ${maxWidth})`] = {
|
|
38
|
+
"grid-template-columns": value,
|
|
25
39
|
}
|
|
26
40
|
}
|
|
27
41
|
return object
|