@repobit/dex-system-design 2.6.0 → 2.7.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/CHANGELOG.md +7 -0
- package/package.json +2 -2
- package/schemas/component-manifest.json +8 -1
- package/src/components/footer/footer.css.js +0 -10
- package/src/components/grid/grid.css.js +47 -70
- package/src/components/grid/grid.js +20 -15
- package/src/components/grid/grid.stories.js +39 -11
- package/src/components/shared/fill-width.css.js +4 -8
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,13 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [2.7.0](https://github.com/bitdefender/dex-core/compare/@repobit/dex-system-design@2.6.0...@repobit/dex-system-design@2.7.0) (2026-10-29)
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* **DEX-29014:** bd-grid steps with the screen again; min-col-width for collections
|
|
11
|
+
|
|
12
|
+
|
|
6
13
|
## [2.6.0](https://github.com/bitdefender/dex-core/compare/@repobit/dex-system-design@2.5.1...@repobit/dex-system-design@2.6.0) (2026-10-29)
|
|
7
14
|
|
|
8
15
|
### Features
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@repobit/dex-system-design",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.7.0",
|
|
4
4
|
"description": "Design system based on Web Components.",
|
|
5
5
|
"author": "Iordache Matei Cezar <miordache@bitdefender.com>",
|
|
6
6
|
"homepage": "https://github.com/bitdefender/dex-core#readme",
|
|
@@ -180,5 +180,5 @@
|
|
|
180
180
|
"volta": {
|
|
181
181
|
"node": "24.22.1"
|
|
182
182
|
},
|
|
183
|
-
"gitHead": "
|
|
183
|
+
"gitHead": "a088b0f4c0e8f7bc64459aa8d5fd9a546a629dc0"
|
|
184
184
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"manifestVersion": 1,
|
|
3
3
|
"package": "@repobit/dex-system-design",
|
|
4
|
-
"packageVersion": "2.
|
|
4
|
+
"packageVersion": "2.7.0",
|
|
5
5
|
"generatedFrom": [
|
|
6
6
|
"package.json exports",
|
|
7
7
|
"Lit static properties",
|
|
@@ -1892,6 +1892,13 @@
|
|
|
1892
1892
|
"4xl",
|
|
1893
1893
|
"5xl"
|
|
1894
1894
|
]
|
|
1895
|
+
},
|
|
1896
|
+
{
|
|
1897
|
+
"name": "minColWidth",
|
|
1898
|
+
"type": "number",
|
|
1899
|
+
"attributeName": "min-col-width",
|
|
1900
|
+
"default": 0,
|
|
1901
|
+
"description": "The narrowest a column may be, in px at the default text size (laid out in rem, so it grows with the reader's text). Set, each step's cols is the most columns there will be, and the grid takes fewer where that many would not fit. Unset (0), cols is the count."
|
|
1895
1902
|
}
|
|
1896
1903
|
],
|
|
1897
1904
|
"notes": [
|
|
@@ -151,16 +151,6 @@ padding-bottom: var(--spacing-12);
|
|
|
151
151
|
gap: var(--spacing-32);
|
|
152
152
|
}
|
|
153
153
|
|
|
154
|
-
/* bd-grid is a size container, and a container cannot take its width from
|
|
155
|
-
its content. These groups hug theirs in a flex row, so the grid steps
|
|
156
|
-
with the screen, as it did before it read its own width: without this
|
|
157
|
-
it filled the row and spread the groups across it (the second group at
|
|
158
|
-
x 608 rather than 316 at 1440). */
|
|
159
|
-
.footer-links-left bd-grid {
|
|
160
|
-
--bd-grid-container-type: normal;
|
|
161
|
-
--bd-grid-width: auto;
|
|
162
|
-
}
|
|
163
|
-
|
|
164
154
|
.footer-links-right {
|
|
165
155
|
display: flex;
|
|
166
156
|
align-items: center;
|
|
@@ -1,102 +1,79 @@
|
|
|
1
1
|
import { css, unsafeCSS } from "lit";
|
|
2
2
|
import { above } from "../shared/token-scales.js";
|
|
3
|
-
import { hostFillsWidth } from "../shared/fill-width.css.js";
|
|
4
3
|
|
|
5
|
-
/* The column steps follow the
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
/* The column steps follow the screen: cols, then cols-sm, cols-md and
|
|
5
|
+
cols-lg from 576, 768 and 992 -- the sm, md and lg every other breakpoint
|
|
6
|
+
in this package means. A grid's steps are a page's structure, and that is
|
|
7
|
+
a question about the screen; it can answer differently at the same width
|
|
8
|
+
in two places -- a 492 grid across a 600 screen and a 518 one beside the
|
|
9
|
+
stat highlight at 1280 hold different layouts on the homepage.
|
|
9
10
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
11
|
+
2.6.0 stepped by the grid's own width instead, at the page column's widths
|
|
12
|
+
(492, 656, 880). A grid as wide as the page stepped where it always had; a
|
|
13
|
+
narrower one never reached its upper steps, so the homepage's stat tiles,
|
|
14
|
+
two across beside the highlight since they were drawn, stacked one a row
|
|
15
|
+
on every desktop, and bd-footer opted its grid out to keep its layout.
|
|
16
|
+
Nothing that was measured gained from it, so the steps read the screen
|
|
17
|
+
again.
|
|
17
18
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
19
|
+
What reading its own width was for -- a 3-column step taken at a 992
|
|
20
|
+
screen gave a 360 column 104px cells -- is min-col-width's: each step's
|
|
21
|
+
count becomes the most columns there will be, and a column is never
|
|
22
|
+
narrower than min-col-width, so a grid in a narrow column takes fewer,
|
|
23
|
+
wider ones, wherever it is laid out. It asks the cells, which is the
|
|
24
|
+
question a collection has, where the page's widths could only be answered
|
|
25
|
+
by a grid as wide as the page. */
|
|
25
26
|
export default css`
|
|
26
|
-
|
|
27
|
+
:host {
|
|
27
28
|
display: block;
|
|
28
|
-
container-name: bd-grid;
|
|
29
|
-
container-type: var(--bd-grid-container-type, inline-size);
|
|
30
|
-
box-sizing: border-box;
|
|
31
29
|
}
|
|
32
30
|
|
|
33
|
-
|
|
34
|
-
|
|
31
|
+
/* Each step below says only which columns and which gap apply; they are
|
|
32
|
+
laid out here, once, so that min-col-width reads the same two. */
|
|
35
33
|
.grid {
|
|
36
34
|
display: grid;
|
|
37
|
-
gap: var(--spacing-24);
|
|
38
35
|
align-items: stretch;
|
|
39
36
|
justify-items: start;
|
|
37
|
+
--grid-cols-active: var(--grid-cols);
|
|
38
|
+
--grid-gap-active: var(--grid-gap, var(--spacing-24));
|
|
39
|
+
grid-template-columns: repeat(var(--grid-cols-active), 1fr);
|
|
40
|
+
gap: var(--grid-gap-active);
|
|
40
41
|
}
|
|
41
42
|
|
|
42
|
-
/*
|
|
43
|
-
|
|
44
|
-
grid-template-columns: repeat(var(--grid-cols), 1fr);
|
|
45
|
-
gap: var(--grid-gap, var(--spacing-24));
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
/* Responsive overrides: the columns and the gap step together; a gap
|
|
49
|
-
left unset carries the one below it up.
|
|
50
|
-
|
|
51
|
-
By the screen: only where the page has opted the grid out of being a
|
|
52
|
-
container, since the container rules after these always win. */
|
|
43
|
+
/* The columns and the gap step together; a gap left unset carries the
|
|
44
|
+
one below it up. */
|
|
53
45
|
@media ${unsafeCSS(above('sm'))} {
|
|
54
46
|
.grid {
|
|
55
|
-
grid-
|
|
56
|
-
gap: var(--grid-gap-sm, var(--spacing-24));
|
|
47
|
+
--grid-cols-active: var(--grid-cols-sm);
|
|
48
|
+
--grid-gap-active: var(--grid-gap-sm, var(--spacing-24));
|
|
57
49
|
}
|
|
58
50
|
}
|
|
59
51
|
|
|
60
52
|
@media ${unsafeCSS(above('md'))} {
|
|
61
53
|
.grid {
|
|
62
|
-
grid-
|
|
63
|
-
gap: var(--grid-gap-md, var(--spacing-24));
|
|
54
|
+
--grid-cols-active: var(--grid-cols-md);
|
|
55
|
+
--grid-gap-active: var(--grid-gap-md, var(--spacing-24));
|
|
64
56
|
}
|
|
65
57
|
}
|
|
66
58
|
|
|
67
59
|
@media ${unsafeCSS(above('lg'))} {
|
|
68
60
|
.grid {
|
|
69
|
-
grid-
|
|
70
|
-
gap: var(--grid-gap-lg, var(--spacing-24));
|
|
61
|
+
--grid-cols-active: var(--grid-cols-lg);
|
|
62
|
+
--grid-gap-active: var(--grid-gap-lg, var(--spacing-24));
|
|
71
63
|
}
|
|
72
64
|
}
|
|
73
65
|
|
|
74
|
-
/*
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
grid-
|
|
85
|
-
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
@container bd-grid (656px <= width < 880px) {
|
|
90
|
-
.grid {
|
|
91
|
-
grid-template-columns: repeat(var(--grid-cols-md), 1fr);
|
|
92
|
-
gap: var(--grid-gap-md, var(--spacing-24));
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
@container bd-grid (width >= 880px) {
|
|
97
|
-
.grid {
|
|
98
|
-
grid-template-columns: repeat(var(--grid-cols-lg), 1fr);
|
|
99
|
-
gap: var(--grid-gap-lg, var(--spacing-24));
|
|
100
|
-
}
|
|
66
|
+
/* min-col-width: as many columns as fit at min-col-width, up to the
|
|
67
|
+
step's count. auto-fill takes as many as fit; the second term of max()
|
|
68
|
+
is what holds it to the count -- a column at least the grid less the
|
|
69
|
+
count's gaps, over the count, leaves no room for one more, with a gap
|
|
70
|
+
to spare so rounding cannot drop one either; and min(100%, ...) keeps
|
|
71
|
+
one column inside a grid narrower than the floor. The columns then
|
|
72
|
+
share what is left, as 1fr always has. */
|
|
73
|
+
.grid.grid--fit {
|
|
74
|
+
grid-template-columns: repeat(auto-fill, minmax(min(100%, max(
|
|
75
|
+
var(--grid-min-col-width),
|
|
76
|
+
(100% - var(--grid-cols-active) * var(--grid-gap-active)) / var(--grid-cols-active)
|
|
77
|
+
)), 1fr));
|
|
101
78
|
}
|
|
102
79
|
`;
|
|
@@ -46,18 +46,23 @@ class BdGrid extends LitElement {
|
|
|
46
46
|
the ones that were already there, and this adds no smartness to a layout
|
|
47
47
|
primitive -- it only lets the primitive hear what it is told. */
|
|
48
48
|
static properties = {
|
|
49
|
-
cols
|
|
50
|
-
colsSm
|
|
51
|
-
colsMd
|
|
52
|
-
colsLg
|
|
53
|
-
gap
|
|
54
|
-
gapSm
|
|
55
|
-
gapMd
|
|
56
|
-
gapLg
|
|
57
|
-
align
|
|
58
|
-
justify: { type: String }, // start, center, end, space-between
|
|
59
|
-
padding: { type: String } // e.g., 'none', 'sm', 'md', 'lg'
|
|
60
|
-
|
|
49
|
+
cols : { type: Number }, // default cols
|
|
50
|
+
colsSm : { type: Number, attribute: "cols-sm" }, // optional cols on small screens
|
|
51
|
+
colsMd : { type: Number, attribute: "cols-md" }, // optional cols on medium
|
|
52
|
+
colsLg : { type: Number, attribute: "cols-lg" }, // optional cols on large
|
|
53
|
+
gap : { type: String }, // e.g., 'sm', 'md'
|
|
54
|
+
gapSm : { type: String, attribute: "gap-sm" }, // optional gap from sm; unset keeps the step below
|
|
55
|
+
gapMd : { type: String, attribute: "gap-md" }, // optional gap from md
|
|
56
|
+
gapLg : { type: String, attribute: "gap-lg" }, // optional gap from lg
|
|
57
|
+
align : { type: String }, // start, center, end, stretch
|
|
58
|
+
justify : { type: String }, // start, center, end, space-between
|
|
59
|
+
padding : { type: String }, // e.g., 'none', 'sm', 'md', 'lg'
|
|
60
|
+
/* The narrowest a column may be. Unset, each step's count is the
|
|
61
|
+
columns there are; set, it is the most there will be, and the grid
|
|
62
|
+
takes fewer, wider ones where that many would not fit (grid.css.js).
|
|
63
|
+
A number of px at the default text size, laid out in rem: a cell holds
|
|
64
|
+
text, so its floor grows with the reader's text, as the gaps do. */
|
|
65
|
+
minColWidth: { type: Number, attribute: "min-col-width" }
|
|
61
66
|
};
|
|
62
67
|
|
|
63
68
|
constructor() {
|
|
@@ -73,14 +78,14 @@ class BdGrid extends LitElement {
|
|
|
73
78
|
this.align = "stretch";
|
|
74
79
|
this.justify = "start";
|
|
75
80
|
this.padding = "none";
|
|
76
|
-
|
|
81
|
+
this.minColWidth = 0;
|
|
77
82
|
}
|
|
78
83
|
|
|
79
84
|
|
|
80
85
|
render() {
|
|
81
86
|
return html`
|
|
82
87
|
<div
|
|
83
|
-
class="grid"
|
|
88
|
+
class="grid ${this.minColWidth > 0 ? "grid--fit" : ""}"
|
|
84
89
|
style="
|
|
85
90
|
--grid-cols: ${this.cols};
|
|
86
91
|
--grid-cols-sm: ${this.colsSm};
|
|
@@ -93,7 +98,7 @@ class BdGrid extends LitElement {
|
|
|
93
98
|
align-items: ${this.align};
|
|
94
99
|
justify-items: ${this.justify};
|
|
95
100
|
padding: ${space(this.padding)};
|
|
96
|
-
|
|
101
|
+
${this.minColWidth > 0 ? `--grid-min-col-width: ${this.minColWidth / 16}rem;` : ""}
|
|
97
102
|
"
|
|
98
103
|
>
|
|
99
104
|
<slot></slot>
|
|
@@ -20,23 +20,31 @@ Columns are set per breakpoint and the component steps between them on its own:
|
|
|
20
20
|
The gap steps the same way: \`gap\` below 576, then \`gap-sm\`, \`gap-md\` and
|
|
21
21
|
\`gap-lg\`, each one left out keeping the step below it.
|
|
22
22
|
|
|
23
|
+
The steps are the page's structure, so they read the screen. A grid that holds
|
|
24
|
+
a collection -- tiles, cards -- in whatever column it lands in sets
|
|
25
|
+
\`min-col-width\` as well: each step's count becomes the most columns there will
|
|
26
|
+
be, and a column is never narrower than \`min-col-width\` (px at the default text
|
|
27
|
+
size; it grows with the reader's text), so in a narrow column the grid takes
|
|
28
|
+
fewer, wider columns.
|
|
29
|
+
|
|
23
30
|
Its one consumer today is the footer's link columns.
|
|
24
31
|
`
|
|
25
32
|
}
|
|
26
33
|
}
|
|
27
34
|
},
|
|
28
35
|
argTypes: {
|
|
29
|
-
cols
|
|
30
|
-
colsSm
|
|
31
|
-
colsMd
|
|
32
|
-
colsLg
|
|
33
|
-
gap
|
|
34
|
-
gapSm
|
|
35
|
-
gapMd
|
|
36
|
-
gapLg
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
36
|
+
cols : { control: { type: "number", min: 1, max: 6 }, description: "Columns below 576px." },
|
|
37
|
+
colsSm : { name: "cols-sm", control: { type: "number", min: 1, max: 6 }, description: "Columns from 576px." },
|
|
38
|
+
colsMd : { name: "cols-md", control: { type: "number", min: 1, max: 6 }, description: "Columns from 768px." },
|
|
39
|
+
colsLg : { name: "cols-lg", control: { type: "number", min: 1, max: 6 }, description: "Columns from 992px." },
|
|
40
|
+
gap : { control: "select", options: ["none", "2xs", "xs", "sm", "md", "lg", "xl"], description: "Space step between cells, below 576px." },
|
|
41
|
+
gapSm : { name: "gap-sm", control: "select", options: ["", "none", "2xs", "xs", "sm", "md", "lg", "xl"], description: "Space step between cells from 576px; unset keeps the step below." },
|
|
42
|
+
gapMd : { name: "gap-md", control: "select", options: ["", "none", "2xs", "xs", "sm", "md", "lg", "xl"], description: "Space step between cells from 768px; unset keeps the step below." },
|
|
43
|
+
gapLg : { name: "gap-lg", control: "select", options: ["", "none", "2xs", "xs", "sm", "md", "lg", "xl"], description: "Space step between cells from 992px; unset keeps the step below." },
|
|
44
|
+
minColWidth: { name: "min-col-width", control: { type: "number", min: 0, step: 20 }, description: "The narrowest a column may be, in px at the default text size. Set, each step's count is the most columns there will be. 0 (unset) leaves the count as it is." },
|
|
45
|
+
padding : { control: "select", options: ["none", "xs", "sm", "md", "lg"], description: "Space step inside the grid." },
|
|
46
|
+
align : { control: "select", options: ["start", "center", "end", "stretch"] },
|
|
47
|
+
justify : { control: "select", options: ["start", "center", "end", "stretch"] }
|
|
40
48
|
}
|
|
41
49
|
};
|
|
42
50
|
|
|
@@ -114,3 +122,23 @@ export const Alignment = {
|
|
|
114
122
|
</div>`,
|
|
115
123
|
parameters: { docs: { description: { story: "justify sets justify-items on the cells. stretch is the default the footer relies on." } } }
|
|
116
124
|
};
|
|
125
|
+
|
|
126
|
+
/* Three tiles' worth of column: a phone's (343) and two halves of a desktop
|
|
127
|
+
row (428 at a 992 screen, 588 at 1440). The steps alone would give every
|
|
128
|
+
one the screen's count -- three columns of 98px in the first. */
|
|
129
|
+
export const MinimumColumnWidth = {
|
|
130
|
+
name : "Minimum column width",
|
|
131
|
+
render: () => html`
|
|
132
|
+
<div style="display: grid; gap: var(--spacing-32)">
|
|
133
|
+
${[343, 428, 588].map((w) => html`
|
|
134
|
+
<div style="max-width: ${w}px">
|
|
135
|
+
<p style="margin: 0 0 var(--spacing-8); font-family: var(--typography-fontFamily-mono); font-size: var(--typography-fontSize-xs); color: var(--color-text-muted)">
|
|
136
|
+
${w}px column · cols="3" … min-col-width="160"
|
|
137
|
+
</p>
|
|
138
|
+
<bd-grid cols="3" cols-sm="3" cols-md="3" cols-lg="3" gap="md" min-col-width="160">${cells(6)}</bd-grid>
|
|
139
|
+
</div>`)}
|
|
140
|
+
</div>`,
|
|
141
|
+
parameters: {
|
|
142
|
+
docs: { description: { story: "The same grid, three columns at most and none narrower than 160px, in three columns: one column at 343, two at 428, three at 588. Without min-col-width every one of them would take three." } }
|
|
143
|
+
}
|
|
144
|
+
};
|
|
@@ -20,14 +20,10 @@ import { unsafeCSS } from "lit";
|
|
|
20
20
|
*
|
|
21
21
|
* :host { display: block; container-type: inline-size; }
|
|
22
22
|
* ${hostFillsWidth()}
|
|
23
|
-
* ${hostFillsWidth("--bd-grid-width")} a page may still set the width
|
|
24
23
|
*/
|
|
25
24
|
const KEYWORDS = ["-moz-available", "-webkit-fill-available", "stretch"];
|
|
26
25
|
|
|
27
|
-
export const hostFillsWidth = (
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
...KEYWORDS.map(keyword => `@supports (width: ${keyword}) { :host { width: ${width(keyword)}; } }`)
|
|
32
|
-
].join("\n"));
|
|
33
|
-
};
|
|
26
|
+
export const hostFillsWidth = () => unsafeCSS([
|
|
27
|
+
":host { width: 100%; }",
|
|
28
|
+
...KEYWORDS.map(keyword => `@supports (width: ${keyword}) { :host { width: ${keyword}; } }`)
|
|
29
|
+
].join("\n"));
|