@timmo001/groundwork-ui 0.8.0 → 0.9.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/custom-elements.json +13 -2
- package/package.json +1 -1
- package/src/layout.ts +34 -2
package/custom-elements.json
CHANGED
|
@@ -21389,13 +21389,17 @@
|
|
|
21389
21389
|
},
|
|
21390
21390
|
{
|
|
21391
21391
|
"kind": "class",
|
|
21392
|
-
"description": "Fills as many columns as fit, each at least `--gw-grid-min` wide.",
|
|
21392
|
+
"description": "Fills as many columns as fit, each at least `--gw-grid-min` wide, and at\nmost `max` of them when it's set.",
|
|
21393
21393
|
"name": "GwGrid",
|
|
21394
21394
|
"cssProperties": [
|
|
21395
21395
|
{
|
|
21396
21396
|
"description": "The narrowest a column gets. Defaults to `18rem`.",
|
|
21397
21397
|
"name": "--gw-grid-min"
|
|
21398
21398
|
},
|
|
21399
|
+
{
|
|
21400
|
+
"description": "The most columns it shows, as a number. Unset by default, so as many fit as the width allows.",
|
|
21401
|
+
"name": "--gw-grid-max"
|
|
21402
|
+
},
|
|
21399
21403
|
{
|
|
21400
21404
|
"description": "The gap. Defaults to `--gw-space-3`.",
|
|
21401
21405
|
"name": "--gw-gap"
|
|
@@ -21415,7 +21419,7 @@
|
|
|
21415
21419
|
"text": "readonly CSSStyleSheet[]"
|
|
21416
21420
|
},
|
|
21417
21421
|
"static": true,
|
|
21418
|
-
"default": "[ base, gaps, css` :host { display: grid; grid-template-columns: repeat( auto-fill, minmax(min(100%, var(--gw-grid-min, 18rem)), 1fr) ); gap: var(--gw-gap, var(--gw-space-3)); } `, ]",
|
|
21422
|
+
"default": "[ base, gaps, css` :host { /* A column's width at the cap. Invalid while --gw-grid-max is unset, so the var() below falls back to 0px and the cap does nothing */ --_gw-grid-cap: calc( (100% - (var(--gw-grid-max) - 1) * var(--gw-gap, var(--gw-space-3))) / var(--gw-grid-max) ); display: grid; grid-template-columns: repeat( auto-fill, minmax( min(100%, max(var(--gw-grid-min, 18rem), var(--_gw-grid-cap, 0px))), 1fr ) ); gap: var(--gw-gap, var(--gw-space-3)); } :host([max=\"2\"]) { --gw-grid-max: 2; } :host([max=\"3\"]) { --gw-grid-max: 3; } :host([max=\"4\"]) { --gw-grid-max: 4; } :host([max=\"5\"]) { --gw-grid-max: 5; } :host([max=\"6\"]) { --gw-grid-max: 6; } `, ]",
|
|
21419
21423
|
"inheritedFrom": {
|
|
21420
21424
|
"name": "GwElement",
|
|
21421
21425
|
"module": "src/element.ts"
|
|
@@ -21753,6 +21757,13 @@
|
|
|
21753
21757
|
},
|
|
21754
21758
|
"description": "A smaller or larger gap.",
|
|
21755
21759
|
"name": "gap"
|
|
21760
|
+
},
|
|
21761
|
+
{
|
|
21762
|
+
"type": {
|
|
21763
|
+
"text": "\"2\"|\"3\"|\"4\"|\"5\"|\"6\""
|
|
21764
|
+
},
|
|
21765
|
+
"description": "The most columns it shows. Sets `--gw-grid-max`.",
|
|
21766
|
+
"name": "max"
|
|
21756
21767
|
}
|
|
21757
21768
|
],
|
|
21758
21769
|
"superclass": {
|
package/package.json
CHANGED
package/src/layout.ts
CHANGED
|
@@ -138,16 +138,19 @@ export class GwRow extends GwSlotted {
|
|
|
138
138
|
}
|
|
139
139
|
|
|
140
140
|
/**
|
|
141
|
-
* Fills as many columns as fit, each at least `--gw-grid-min` wide
|
|
141
|
+
* Fills as many columns as fit, each at least `--gw-grid-min` wide, and at
|
|
142
|
+
* most `max` of them when it's set.
|
|
142
143
|
*
|
|
143
144
|
* @element gw-grid
|
|
144
145
|
* @summary Children in responsive columns.
|
|
145
146
|
*
|
|
146
147
|
* @attr {"s"|"l"} gap - A smaller or larger gap.
|
|
148
|
+
* @attr {"2"|"3"|"4"|"5"|"6"} max - The most columns it shows. Sets `--gw-grid-max`.
|
|
147
149
|
*
|
|
148
150
|
* @slot - The children.
|
|
149
151
|
*
|
|
150
152
|
* @cssprop --gw-grid-min - The narrowest a column gets. Defaults to `18rem`.
|
|
153
|
+
* @cssprop --gw-grid-max - The most columns it shows, as a number. Unset by default, so as many fit as the width allows.
|
|
151
154
|
* @cssprop --gw-gap - The gap. Defaults to `--gw-space-3`.
|
|
152
155
|
*/
|
|
153
156
|
export class GwGrid extends GwSlotted {
|
|
@@ -156,13 +159,42 @@ export class GwGrid extends GwSlotted {
|
|
|
156
159
|
gaps,
|
|
157
160
|
css`
|
|
158
161
|
:host {
|
|
162
|
+
/* A column's width at the cap. Invalid while --gw-grid-max is unset,
|
|
163
|
+
so the var() below falls back to 0px and the cap does nothing */
|
|
164
|
+
--_gw-grid-cap: calc(
|
|
165
|
+
(100% - (var(--gw-grid-max) - 1) * var(--gw-gap, var(--gw-space-3))) /
|
|
166
|
+
var(--gw-grid-max)
|
|
167
|
+
);
|
|
159
168
|
display: grid;
|
|
160
169
|
grid-template-columns: repeat(
|
|
161
170
|
auto-fill,
|
|
162
|
-
minmax(
|
|
171
|
+
minmax(
|
|
172
|
+
min(100%, max(var(--gw-grid-min, 18rem), var(--_gw-grid-cap, 0px))),
|
|
173
|
+
1fr
|
|
174
|
+
)
|
|
163
175
|
);
|
|
164
176
|
gap: var(--gw-gap, var(--gw-space-3));
|
|
165
177
|
}
|
|
178
|
+
|
|
179
|
+
:host([max="2"]) {
|
|
180
|
+
--gw-grid-max: 2;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
:host([max="3"]) {
|
|
184
|
+
--gw-grid-max: 3;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
:host([max="4"]) {
|
|
188
|
+
--gw-grid-max: 4;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
:host([max="5"]) {
|
|
192
|
+
--gw-grid-max: 5;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
:host([max="6"]) {
|
|
196
|
+
--gw-grid-max: 6;
|
|
197
|
+
}
|
|
166
198
|
`,
|
|
167
199
|
];
|
|
168
200
|
}
|