@folkehelseinstituttet/designsystem 0.32.0 → 0.33.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 +19 -0
- package/fhi-grid.js +20 -17
- package/fhi-grid.js.map +1 -1
- package/package.json +2 -1
- package/web-types.json +11 -1
package/custom-elements.json
CHANGED
|
@@ -1155,6 +1155,16 @@
|
|
|
1155
1155
|
"default": "'medium'",
|
|
1156
1156
|
"description": "Sets the gap between items within the grid container. It can be one of the preset values, a rem or px value, or a number.\nIf you give a number, it will be treated as pixels.",
|
|
1157
1157
|
"attribute": "gap"
|
|
1158
|
+
},
|
|
1159
|
+
{
|
|
1160
|
+
"kind": "field",
|
|
1161
|
+
"name": "rows",
|
|
1162
|
+
"type": {
|
|
1163
|
+
"text": "number"
|
|
1164
|
+
},
|
|
1165
|
+
"default": "1",
|
|
1166
|
+
"description": "Sets the number of rows in the grid layout.",
|
|
1167
|
+
"attribute": "rows"
|
|
1158
1168
|
}
|
|
1159
1169
|
],
|
|
1160
1170
|
"attributes": [
|
|
@@ -1175,6 +1185,15 @@
|
|
|
1175
1185
|
"default": "'medium'",
|
|
1176
1186
|
"description": "Sets the gap between items within the grid container. It can be one of the preset values, a rem or px value, or a number.\nIf you give a number, it will be treated as pixels.",
|
|
1177
1187
|
"fieldName": "gap"
|
|
1188
|
+
},
|
|
1189
|
+
{
|
|
1190
|
+
"name": "rows",
|
|
1191
|
+
"type": {
|
|
1192
|
+
"text": "number"
|
|
1193
|
+
},
|
|
1194
|
+
"default": "1",
|
|
1195
|
+
"description": "Sets the number of rows in the grid layout.",
|
|
1196
|
+
"fieldName": "rows"
|
|
1178
1197
|
}
|
|
1179
1198
|
],
|
|
1180
1199
|
"superclass": {
|
package/fhi-grid.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { i as
|
|
2
|
-
var h = Object.defineProperty, c = Object.getOwnPropertyDescriptor,
|
|
3
|
-
for (var
|
|
4
|
-
(
|
|
5
|
-
return r &&
|
|
1
|
+
import { i as l, n as m, a as n, b as d, t as u } from "./property-DGdAXcEz.js";
|
|
2
|
+
var h = Object.defineProperty, c = Object.getOwnPropertyDescriptor, t = (s, a, p, r) => {
|
|
3
|
+
for (var i = r > 1 ? void 0 : r ? c(a, p) : a, g = s.length - 1, o; g >= 0; g--)
|
|
4
|
+
(o = s[g]) && (i = (r ? o(a, p, i) : o(i)) || i);
|
|
5
|
+
return r && i && h(a, p, i), i;
|
|
6
6
|
};
|
|
7
7
|
const f = "fhi-grid";
|
|
8
|
-
let e = class extends
|
|
8
|
+
let e = class extends n {
|
|
9
9
|
constructor() {
|
|
10
|
-
super(...arguments), this.gap = "medium", this.columns = 12;
|
|
10
|
+
super(...arguments), this.gap = "medium", this.columns = 12, this.rows = 1;
|
|
11
11
|
}
|
|
12
|
-
updated(
|
|
13
|
-
if (super.updated(
|
|
12
|
+
updated(s) {
|
|
13
|
+
if (super.updated(s), s.has("columns") && (this.style.gridTemplateColumns = `repeat( ${this.columns}, 1fr )`), s.has("rows") && (this.style.gridTemplateRows = `repeat( ${this.rows}, 1fr )`), s.has("gap"))
|
|
14
14
|
switch (this.gap) {
|
|
15
15
|
case "large":
|
|
16
16
|
case "medium":
|
|
@@ -18,8 +18,8 @@ let e = class extends o {
|
|
|
18
18
|
this.style.gap = "";
|
|
19
19
|
return;
|
|
20
20
|
default:
|
|
21
|
-
const
|
|
22
|
-
this.style.gap =
|
|
21
|
+
const a = Number(this.gap) ? `${this.gap}px` : this.gap;
|
|
22
|
+
this.style.gap = a;
|
|
23
23
|
return;
|
|
24
24
|
}
|
|
25
25
|
}
|
|
@@ -27,7 +27,7 @@ let e = class extends o {
|
|
|
27
27
|
return d`<slot></slot>`;
|
|
28
28
|
}
|
|
29
29
|
};
|
|
30
|
-
e.styles =
|
|
30
|
+
e.styles = l`
|
|
31
31
|
:host {
|
|
32
32
|
--dimension-grid-gap-small: var(--fhi-spacing-100);
|
|
33
33
|
--dimension-grid-gap-medium: var(--fhi-spacing-200);
|
|
@@ -49,13 +49,16 @@ e.styles = n`
|
|
|
49
49
|
gap: var(--dimension-grid-gap-large);
|
|
50
50
|
}
|
|
51
51
|
`;
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
t([
|
|
53
|
+
m({ type: String })
|
|
54
54
|
], e.prototype, "gap", 2);
|
|
55
|
-
|
|
56
|
-
|
|
55
|
+
t([
|
|
56
|
+
m({ type: Number })
|
|
57
57
|
], e.prototype, "columns", 2);
|
|
58
|
-
|
|
58
|
+
t([
|
|
59
|
+
m({ type: Number })
|
|
60
|
+
], e.prototype, "rows", 2);
|
|
61
|
+
e = t([
|
|
59
62
|
u(f)
|
|
60
63
|
], e);
|
|
61
64
|
export {
|
package/fhi-grid.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fhi-grid.js","sources":["../../src/components/fhi-grid/fhi-grid.component.ts"],"sourcesContent":["import { html, css, LitElement, PropertyValues } from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\n\nexport const FhiGridSelector = 'fhi-grid';\ntype FhiUnitType = 'px' | 'rem';\ntype FhiGapWidthUnit = `${number}${FhiUnitType}` | number;\n\n/**\n * ## FHI Grid\n *\n * {@link https://designsystem.fhi.no/?path=/docs/komponenter-grid--docs}\n *\n * The `<fhi-grid>` component is a grid container that uses CSS Grid Layout to organize its child elements into a structured grid format.\n * It allows for easy control over the number of columns and the spacing between grid items.\n *\n * @tag fhi-grid\n * @element fhi-grid\n *\n */\n@customElement(FhiGridSelector)\nexport class FhiGrid extends LitElement {\n /**\n * Sets the gap between items within the grid container. It can be one of the preset values, a rem or px value, or a number.\n * If you give a number, it will be treated as pixels.\n * @type {'small' | 'medium' | 'large' | number | string}\n */\n @property({ type: String }) gap:\n | 'small'\n | 'medium'\n | 'large'\n | FhiGapWidthUnit = 'medium';\n\n /**\n * Sets the number of columns in the grid layout.\n * @type {number}\n */\n @property({ type: Number }) columns = 12;\n\n updated(changedProperties: PropertyValues<this>) {\n super.updated(changedProperties);\n\n if (changedProperties.has('columns')) {\n this.style.gridTemplateColumns = `repeat( ${this.columns}, 1fr )`;\n }\n\n if (changedProperties.has('gap')) {\n switch (this.gap) {\n case 'large':\n case 'medium':\n case 'small':\n this.style.gap = '';\n return;\n default:\n const gapValue = Number(this.gap) ? `${this.gap}px` : this.gap;\n this.style.gap = gapValue as string;\n return;\n }\n }\n }\n\n render() {\n return html`<slot></slot>`;\n }\n\n static styles = css`\n :host {\n --dimension-grid-gap-small: var(--fhi-spacing-100);\n --dimension-grid-gap-medium: var(--fhi-spacing-200);\n --dimension-grid-gap-large: var(--fhi-spacing-300);\n }\n :host {\n display: grid;\n gap: var(--dimension-grid-gap-medium);\n }\n :host([gap='small']) {\n gap: var(--dimension-grid-gap-small);\n }\n\n :host([gap='medium']) {\n gap: var(--dimension-grid-gap-medium);\n }\n\n :host([gap='large']) {\n gap: var(--dimension-grid-gap-large);\n }\n `;\n}\n"],"names":["FhiGridSelector","FhiGrid","LitElement","changedProperties","gapValue","html","css","__decorateClass","property","customElement"],"mappings":";;;;;;AAGO,MAAMA,IAAkB;AAiBxB,IAAMC,IAAN,cAAsBC,EAAW;AAAA,EAAjC,cAAA;AAAA,UAAA,GAAA,SAAA,GAMuB,KAAA,MAIN,UAMM,KAAA,UAAU;AAAA,EAAA;AAAA,
|
|
1
|
+
{"version":3,"file":"fhi-grid.js","sources":["../../src/components/fhi-grid/fhi-grid.component.ts"],"sourcesContent":["import { html, css, LitElement, PropertyValues } from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\n\nexport const FhiGridSelector = 'fhi-grid';\ntype FhiUnitType = 'px' | 'rem';\ntype FhiGapWidthUnit = `${number}${FhiUnitType}` | number;\n\n/**\n * ## FHI Grid\n *\n * {@link https://designsystem.fhi.no/?path=/docs/komponenter-grid--docs}\n *\n * The `<fhi-grid>` component is a grid container that uses CSS Grid Layout to organize its child elements into a structured grid format.\n * It allows for easy control over the number of columns and the spacing between grid items.\n *\n * @tag fhi-grid\n * @element fhi-grid\n *\n */\n@customElement(FhiGridSelector)\nexport class FhiGrid extends LitElement {\n /**\n * Sets the gap between items within the grid container. It can be one of the preset values, a rem or px value, or a number.\n * If you give a number, it will be treated as pixels.\n * @type {'small' | 'medium' | 'large' | number | string}\n */\n @property({ type: String }) gap:\n | 'small'\n | 'medium'\n | 'large'\n | FhiGapWidthUnit = 'medium';\n\n /**\n * Sets the number of columns in the grid layout.\n * @type {number}\n */\n @property({ type: Number }) columns = 12;\n\n /**\n * Sets the number of rows in the grid layout.\n * @type {number}\n */\n @property({ type: Number }) rows = 1;\n\n updated(changedProperties: PropertyValues<this>) {\n super.updated(changedProperties);\n\n if (changedProperties.has('columns')) {\n this.style.gridTemplateColumns = `repeat( ${this.columns}, 1fr )`;\n }\n\n if (changedProperties.has('rows')) {\n this.style.gridTemplateRows = `repeat( ${this.rows}, 1fr )`;\n }\n\n if (changedProperties.has('gap')) {\n switch (this.gap) {\n case 'large':\n case 'medium':\n case 'small':\n this.style.gap = '';\n return;\n default:\n const gapValue = Number(this.gap) ? `${this.gap}px` : this.gap;\n this.style.gap = gapValue as string;\n return;\n }\n }\n }\n\n render() {\n return html`<slot></slot>`;\n }\n\n static styles = css`\n :host {\n --dimension-grid-gap-small: var(--fhi-spacing-100);\n --dimension-grid-gap-medium: var(--fhi-spacing-200);\n --dimension-grid-gap-large: var(--fhi-spacing-300);\n }\n :host {\n display: grid;\n gap: var(--dimension-grid-gap-medium);\n }\n :host([gap='small']) {\n gap: var(--dimension-grid-gap-small);\n }\n\n :host([gap='medium']) {\n gap: var(--dimension-grid-gap-medium);\n }\n\n :host([gap='large']) {\n gap: var(--dimension-grid-gap-large);\n }\n `;\n}\n"],"names":["FhiGridSelector","FhiGrid","LitElement","changedProperties","gapValue","html","css","__decorateClass","property","customElement"],"mappings":";;;;;;AAGO,MAAMA,IAAkB;AAiBxB,IAAMC,IAAN,cAAsBC,EAAW;AAAA,EAAjC,cAAA;AA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|
|
3
3
|
"author": "FHI Designsystem team",
|
|
4
4
|
"name": "@folkehelseinstituttet/designsystem",
|
|
5
|
-
"version": "0.
|
|
5
|
+
"version": "0.33.0",
|
|
6
6
|
"description": "The official design system for the Norwegian Institute of Public Health implemented as web components",
|
|
7
7
|
"keywords": [
|
|
8
8
|
"fhi",
|
|
@@ -71,6 +71,7 @@
|
|
|
71
71
|
"@storybook/web-components-vite": "^10.2.8",
|
|
72
72
|
"@types/mocha": "~10.0.10",
|
|
73
73
|
"@types/node": "~22.5.5",
|
|
74
|
+
"@types/react": "^19.2.14",
|
|
74
75
|
"@wc-toolkit/cem-sorter": "^1.0.1",
|
|
75
76
|
"@wc-toolkit/type-parser": "^1.2.0",
|
|
76
77
|
"@web/dev-server": "~0.4.6",
|
package/web-types.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://raw.githubusercontent.com/JetBrains/web-types/master/schema/web-types.json",
|
|
3
3
|
"name": "@folkehelseinstituttet/designsystem",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.33.0",
|
|
5
5
|
"description-markup": "markdown",
|
|
6
6
|
"contributions": {
|
|
7
7
|
"html": {
|
|
@@ -434,6 +434,11 @@
|
|
|
434
434
|
"type": "'small' | 'medium' | 'large' | number | string",
|
|
435
435
|
"default": "'medium'"
|
|
436
436
|
}
|
|
437
|
+
},
|
|
438
|
+
{
|
|
439
|
+
"name": "rows",
|
|
440
|
+
"description": "Sets the number of rows in the grid layout.",
|
|
441
|
+
"value": { "type": "number", "default": "1" }
|
|
437
442
|
}
|
|
438
443
|
],
|
|
439
444
|
"events": [],
|
|
@@ -448,6 +453,11 @@
|
|
|
448
453
|
"name": "gap",
|
|
449
454
|
"description": "Sets the gap between items within the grid container. It can be one of the preset values, a rem or px value, or a number.\nIf you give a number, it will be treated as pixels.",
|
|
450
455
|
"type": "'small' | 'medium' | 'large' | number | string"
|
|
456
|
+
},
|
|
457
|
+
{
|
|
458
|
+
"name": "rows",
|
|
459
|
+
"description": "Sets the number of rows in the grid layout.",
|
|
460
|
+
"type": "number"
|
|
451
461
|
}
|
|
452
462
|
],
|
|
453
463
|
"events": []
|