dibk-designsystemet 1.0.0-rc.1
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 +32 -0
- package/LICENSE.md +13 -0
- package/README.md +365 -0
- package/dist/fonts.css +81 -0
- package/dist/icons.cjs +451 -0
- package/dist/icons.cjs.map +1 -0
- package/dist/icons.d.cts +33 -0
- package/dist/icons.d.ts +33 -0
- package/dist/icons.js +412 -0
- package/dist/icons.js.map +1 -0
- package/dist/index.cjs +706 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.css +886 -0
- package/dist/index.css.map +1 -0
- package/dist/index.d.cts +280 -0
- package/dist/index.d.ts +280 -0
- package/dist/index.js +666 -0
- package/dist/index.js.map +1 -0
- package/dist/layout.cjs +65 -0
- package/dist/layout.cjs.map +1 -0
- package/dist/layout.css +60 -0
- package/dist/layout.css.map +1 -0
- package/dist/layout.d.cts +42 -0
- package/dist/layout.d.ts +42 -0
- package/dist/layout.js +36 -0
- package/dist/layout.js.map +1 -0
- package/dist/styles.css +5 -0
- package/dist/swagger.css +213 -0
- package/dist/theme.css +982 -0
- package/icons/package.json +9 -0
- package/layout/package.json +9 -0
- package/package.json +106 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
Notable changes to `dibk-designsystemet`. Format follows
|
|
4
|
+
[Keep a Changelog](https://keepachangelog.com/en/1.1.0/); versioning is
|
|
5
|
+
[semver](https://semver.org/), where a minor release may adjust visual details and a
|
|
6
|
+
major release changes the component API.
|
|
7
|
+
|
|
8
|
+
## 1.0.0-rc.1
|
|
9
|
+
|
|
10
|
+
First release candidate.
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- Every `@digdir/designsystemet-react` component, re-exported and DIBK-themed.
|
|
15
|
+
- DIBK brand components: `DibkAppShell`, `DibkHeader`, `DibkMegaMenu`,
|
|
16
|
+
`DibkMenuSection`, `DibkSearch`, `DibkFooter`, `DibkLogo`, `DibkIconLinkList`,
|
|
17
|
+
`DibkSectionHeader`, `DibkFeedbackWidget`, `DibkAccountMenu`, `DibkMenuLogin`,
|
|
18
|
+
`DibkCopyButton`, `DibkCopyIconButton`, `DibkCodeBlock`.
|
|
19
|
+
- Layout primitives `Stack`, `Cluster`, `Sidebar` and `Grid` on the `./layout` subpath.
|
|
20
|
+
- Thirteen DIBK brand icons on the `./icons` subpath, plus the `dibkIcons` registry.
|
|
21
|
+
- CSS entries: `styles.css` (everything, in cascade order), `fonts.css` (Poppins
|
|
22
|
+
`@font-face`), and `theme.css` / `index.css` / `layout.css` for composing a custom
|
|
23
|
+
cascade.
|
|
24
|
+
- `swagger.css`, a standalone Swagger UI skin for hosts that serve static files with no
|
|
25
|
+
bundler.
|
|
26
|
+
- Dual ESM and CJS builds with sourcemaps and type declarations for both.
|
|
27
|
+
|
|
28
|
+
### Peer dependencies
|
|
29
|
+
|
|
30
|
+
`react`, `react-dom`, `@digdir/designsystemet-react`, `@digdir/designsystemet-css` and
|
|
31
|
+
`@fontsource/poppins`. Keep the two `@digdir/designsystemet-*` packages on the same
|
|
32
|
+
version; their CSS class contract is version-coupled upstream.
|
package/LICENSE.md
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
Copyright (c) 2026 Direktoratet for byggkvalitet. All rights reserved.
|
|
2
|
+
|
|
3
|
+
The source code is publicly available. Permission is granted to Direktoratet for
|
|
4
|
+
byggkvalitet and its suppliers to use this software in DIBK's own applications.
|
|
5
|
+
|
|
6
|
+
All other use, copying, modification, distribution and sublicensing requires
|
|
7
|
+
written agreement with Direktoratet for byggkvalitet.
|
|
8
|
+
|
|
9
|
+
This software builds on Designsystemet (https://designsystemet.no/), which is
|
|
10
|
+
licensed under the MIT license by Digitaliseringsdirektoratet, and is designed
|
|
11
|
+
for use with the Poppins typeface, licensed under the SIL Open Font License 1.1.
|
|
12
|
+
Both are declared as peer dependencies rather than redistributed here, and their
|
|
13
|
+
own license terms apply to them.
|
package/README.md
ADDED
|
@@ -0,0 +1,365 @@
|
|
|
1
|
+
# dibk-designsystemet
|
|
2
|
+
|
|
3
|
+
The DIBK design system. We take [Designsystemet](https://designsystemet.no/), Digdir's
|
|
4
|
+
Norwegian government design system, apply the DIBK theme (navy `#003045`, square corners,
|
|
5
|
+
Poppins) and add the brand components, brand icons and layout primitives that
|
|
6
|
+
Designsystemet has no equivalent for. One package, one install.
|
|
7
|
+
|
|
8
|
+
```tsx
|
|
9
|
+
import { Button, Card, Table, DibkHeader, DibkFooter } from "dibk-designsystemet";
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## Install
|
|
13
|
+
|
|
14
|
+
```sh
|
|
15
|
+
npm install dibk-designsystemet \
|
|
16
|
+
react react-dom @digdir/designsystemet-react @digdir/designsystemet-css @fontsource/poppins
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Everything after the package name is a peer dependency, so your app owns exactly one copy
|
|
20
|
+
of React, of Designsystemet and of the font. Keep the two `@digdir/designsystemet-*`
|
|
21
|
+
packages on the same version: their CSS class contract is version-coupled upstream, and npm
|
|
22
|
+
won't catch a mismatch for you.
|
|
23
|
+
|
|
24
|
+
We publish to public npmjs, so there's no registry configuration to do, and the package
|
|
25
|
+
ships both ESM and CJS.
|
|
26
|
+
|
|
27
|
+
## Setup
|
|
28
|
+
|
|
29
|
+
Two CSS imports at your app entry:
|
|
30
|
+
|
|
31
|
+
```ts
|
|
32
|
+
import "dibk-designsystemet/fonts.css"; // Poppins @font-face declarations
|
|
33
|
+
import "dibk-designsystemet/styles.css"; // everything else, in cascade order
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
`styles.css` pulls in Designsystemet's component CSS, the DIBK theme tokens, the brand base
|
|
37
|
+
(which puts the font on `<body>`), our component styles, our tailoring of Designsystemet's
|
|
38
|
+
components, and the layout primitives, in that order.
|
|
39
|
+
|
|
40
|
+
The JS entries import no CSS of their own, so Node can load them for SSR and so the CJS
|
|
41
|
+
build works. CSS delivery is always an explicit import, the same contract Designsystemet
|
|
42
|
+
uses.
|
|
43
|
+
|
|
44
|
+
Both stylesheets reference their dependencies by bare specifier, so you need a bundler that
|
|
45
|
+
resolves those inside CSS: Vite, webpack with css-loader, Next, Parcel or esbuild. A plain
|
|
46
|
+
`<link rel="stylesheet">` with no build step won't work.
|
|
47
|
+
|
|
48
|
+
## Usage
|
|
49
|
+
|
|
50
|
+
We re-export everything from `@digdir/designsystemet-react`, already themed, so import it
|
|
51
|
+
from here rather than from the base package:
|
|
52
|
+
|
|
53
|
+
```tsx
|
|
54
|
+
import { Heading, Paragraph, Button, Card, Alert, Details } from "dibk-designsystemet";
|
|
55
|
+
|
|
56
|
+
function Example() {
|
|
57
|
+
return (
|
|
58
|
+
<Card data-dibk-color="blue">
|
|
59
|
+
<Heading level={2} data-size="sm">Bygge, rive eller endre?</Heading>
|
|
60
|
+
<Paragraph>Finn ut om du må søke.</Paragraph>
|
|
61
|
+
<Button variant="primary">Start søknad</Button>
|
|
62
|
+
</Card>
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
Our own components are prefixed `Dibk`, so it stays obvious which are ours and which are
|
|
68
|
+
Designsystemet's:
|
|
69
|
+
|
|
70
|
+
```tsx
|
|
71
|
+
import { DibkHeader, DibkMegaMenu, DibkFooter } from "dibk-designsystemet";
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
| Component | What it is |
|
|
75
|
+
|-----------|------------|
|
|
76
|
+
| `DibkAppShell` | Page frame: header + mega-menu + content container + footer |
|
|
77
|
+
| `DibkHeader` | Top bar: logo, "Søk" and "Meny" toggles |
|
|
78
|
+
| `DibkMegaMenu` | Full-viewport navigation and search overlay |
|
|
79
|
+
| `DibkMenuSection` | One titled link column inside the mega-menu |
|
|
80
|
+
| `DibkSearch` | DIBK search widget: underlined field and magnifier in a quiet panel |
|
|
81
|
+
| `DibkFooter` | Navy four-column link footer |
|
|
82
|
+
| `DibkLogo` | DIBK roofline mark and wordmark (`variant="full" \| "mark"`) |
|
|
83
|
+
| `DibkIconLinkList` | Icon + bold-link list (`columns={1 \| 2 \| 3}`, `chevron={false}` to drop the arrows) |
|
|
84
|
+
| `DibkSectionHeader` | Large icon, `h1` and hairline divider |
|
|
85
|
+
| `DibkFeedbackWidget` | "Fant du det du lette etter?" Ja/Nei prompt |
|
|
86
|
+
| `DibkAccountMenu` | Header account control: initials avatar and dropdown (name, email, role, Logg ut) |
|
|
87
|
+
| `DibkMenuLogin` | "Logg inn" row for the mega-menu's `menuExtra` slot |
|
|
88
|
+
| `DibkCopyButton` / `DibkCopyIconButton` | "Kopier" button that flips to "✓ Kopiert!", plus a quiet icon-only variant |
|
|
89
|
+
| `DibkCodeBlock` | Labelled monospace block with an optional Kopier button |
|
|
90
|
+
|
|
91
|
+
All of them forward `className`, `style`, `ref`, `data-*` and the rest of their root
|
|
92
|
+
element's props, so they'll compose into whatever layout you have.
|
|
93
|
+
|
|
94
|
+
## Page layout
|
|
95
|
+
|
|
96
|
+
`DibkAppShell` is the page frame. It wires up the header, mega-menu, content container and
|
|
97
|
+
footer, and it owns the page width: children render inside the canonical container, so they
|
|
98
|
+
line up with the header and footer at every viewport width. Write one thin shell wrapper
|
|
99
|
+
for your app and let your pages render content only.
|
|
100
|
+
|
|
101
|
+
```tsx
|
|
102
|
+
<DibkAppShell
|
|
103
|
+
title="Min app"
|
|
104
|
+
shortcuts={[{ label: "Snarvei", href: "/snarvei" }]}
|
|
105
|
+
menuItems={menuItems}
|
|
106
|
+
footerColumns={footerColumns}
|
|
107
|
+
>
|
|
108
|
+
{/* page content, no max-widths, no side gutters */}
|
|
109
|
+
</DibkAppShell>
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
The page column is two tokens in `base.css`:
|
|
113
|
+
|
|
114
|
+
- `--dibk-container-max`, the container's max-width (`1400px`)
|
|
115
|
+
- `--dibk-container-pad`, the fluid side gutter inside it (`clamp(1.25rem, 6vw, 6rem)`)
|
|
116
|
+
|
|
117
|
+
`DibkHeader`, `DibkMegaMenu`, `DibkFooter` and the shell's content container all use this
|
|
118
|
+
geometry, which is what makes their content edges line up. Two things will break that, and
|
|
119
|
+
both are easy to do by accident:
|
|
120
|
+
|
|
121
|
+
1. Painting a background or border on an element that has the container geometry. The color
|
|
122
|
+
fills the gutter padding too, and the panel then reads as wider than the top bar.
|
|
123
|
+
Colored panels go *inside* the container: they span the content column, and their own
|
|
124
|
+
padding is the panel's inset.
|
|
125
|
+
2. Hand-rolling the page width. Inside the shell your sections need no `max-width`,
|
|
126
|
+
`margin: auto` or side padding. If some surface genuinely can't use the shell, copy the
|
|
127
|
+
geometry exactly (`max-width: var(--dibk-container-max); margin-inline: auto;
|
|
128
|
+
padding-inline: var(--dibk-container-pad)`). A fixed side padding lines up at one window
|
|
129
|
+
size and drifts at every other, because the gutter is fluid.
|
|
130
|
+
|
|
131
|
+
## Layout primitives
|
|
132
|
+
|
|
133
|
+
Four composable layout components, the [Every Layout](https://every-layout.dev/) patterns,
|
|
134
|
+
so you don't hand-roll flex and grid CSS or invent a spacing scale per app. Each one is a
|
|
135
|
+
thin element with a co-located CSS class (`l-*`) and no runtime, and spacing is a single
|
|
136
|
+
`gap` prop mapped onto the design tokens.
|
|
137
|
+
|
|
138
|
+
They're unprefixed, because layout is nobody's brand, and they live on their own subpath.
|
|
139
|
+
The main barrel star-exports `@digdir/designsystemet-react`, and a name that arrives through
|
|
140
|
+
two star-exports is dropped from both rather than shadowing, so if we put them in the barrel
|
|
141
|
+
an upstream release adding its own `Grid` or `Stack` would break your imports.
|
|
142
|
+
|
|
143
|
+
```tsx
|
|
144
|
+
import { Stack, Cluster, Sidebar, Grid } from "dibk-designsystemet/layout";
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
| Primitive | Use it for | Key props |
|
|
148
|
+
|-----------|-----------|-----------|
|
|
149
|
+
| `Stack` | Vertical flow. Owns the space *between* children (form fields, page sections, lists). | `gap`, `align="start" \| "center"`, `as` |
|
|
150
|
+
| `Cluster` | A horizontal group that wraps (tag rows, toolbars). | `gap`, `align="baseline"`, `justify="between"`, `wrap={false}`, `as` |
|
|
151
|
+
| `Sidebar` | A fixed side column and a fluid main that wraps to one column on its own, with no media query. | `gap`, `as` |
|
|
152
|
+
| `Grid` | An intrinsic responsive grid that fits as many columns as will fit. | `gap`, `as` |
|
|
153
|
+
|
|
154
|
+
`gap` is `"xs" | "sm" | "md" | "lg"`, defaults to `"md"`, and maps to `--ds-size-2 / 3 / 5 /
|
|
155
|
+
8`. Every primitive is polymorphic via `as` (`as="ul"`, `as="header"`, `as="section"`) and
|
|
156
|
+
forwards `ref` plus the element's own props.
|
|
157
|
+
|
|
158
|
+
Spacing belongs to the layout, not to the component. Rather than putting a `margin` on a
|
|
159
|
+
component to push it off its neighbour, wrap the group in a `Stack` and let `gap` do it.
|
|
160
|
+
One spacing scale, and no margin-collapsing surprises.
|
|
161
|
+
|
|
162
|
+
```tsx
|
|
163
|
+
// page sections
|
|
164
|
+
<Stack as="main" gap="lg">
|
|
165
|
+
<Heading level={1} data-size="lg">Tittel</Heading>
|
|
166
|
+
<Paragraph>Ingress…</Paragraph>
|
|
167
|
+
</Stack>
|
|
168
|
+
|
|
169
|
+
// a tag row (wraps)
|
|
170
|
+
<Cluster gap="xs">{tags.map((t) => <Tag key={t}>{t}</Tag>)}</Cluster>
|
|
171
|
+
|
|
172
|
+
// a tight, single-line control toolbar (Cluster wraps by default)
|
|
173
|
+
<Cluster justify="between">
|
|
174
|
+
<p>Viser 1-12 av 134</p>
|
|
175
|
+
<Cluster gap="sm" wrap={false}>
|
|
176
|
+
<label htmlFor="sort">Sorter:</label>
|
|
177
|
+
<Select id="sort">…</Select>
|
|
178
|
+
</Cluster>
|
|
179
|
+
</Cluster>
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
### Sidebar
|
|
183
|
+
|
|
184
|
+
Mark the narrow column with `data-side`; the other child is the fluid main. It reflows to a
|
|
185
|
+
single column when main can no longer keep its minimum width, so it's driven by content
|
|
186
|
+
rather than by a viewport breakpoint.
|
|
187
|
+
|
|
188
|
+
```tsx
|
|
189
|
+
<Sidebar gap="lg">
|
|
190
|
+
<nav data-side>…filters…</nav>
|
|
191
|
+
<Stack gap="md">…results…</Stack>
|
|
192
|
+
</Sidebar>
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
Tune it with `--l-sidebar-width` (side column, default `18rem`) and
|
|
196
|
+
`--l-sidebar-content-min` (main's minimum before wrapping, default `60%`).
|
|
197
|
+
|
|
198
|
+
### Grid
|
|
199
|
+
|
|
200
|
+
```tsx
|
|
201
|
+
<Grid gap="md">{cards}</Grid>
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
`--l-grid-min` sets the minimum column width (default `16rem`). The grid fits as many equal
|
|
205
|
+
columns as that allows and reflows down without breakpoints.
|
|
206
|
+
|
|
207
|
+
### Container queries
|
|
208
|
+
|
|
209
|
+
Because the primitives reflow by available space, most layouts need no media queries at
|
|
210
|
+
all. When a component does have to restyle by its own width rather than the screen's, give
|
|
211
|
+
it a container context and query that. It'll then behave whether it lands in a wide `Stack`
|
|
212
|
+
list, a narrow `Grid` cell or a `Sidebar`:
|
|
213
|
+
|
|
214
|
+
```css
|
|
215
|
+
.card-frame { container: card / inline-size; } /* a wrapper the component renders */
|
|
216
|
+
@container card (min-width: 30rem) {
|
|
217
|
+
.card { grid-template-columns: auto 1fr; } /* reads the slot, not the viewport */
|
|
218
|
+
}
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
Watch out for one thing: a `@container` query reads an ancestor marked `container-type`,
|
|
222
|
+
never the element itself. That's why the component renders `frame > content` and the content
|
|
223
|
+
queries the frame. Keep viewport media queries for genuine page-level chrome.
|
|
224
|
+
|
|
225
|
+
## Theming
|
|
226
|
+
|
|
227
|
+
The theme is a set of `--ds-*` and `--dibk-*` CSS custom properties. No runtime, no
|
|
228
|
+
provider. The DIBK signature:
|
|
229
|
+
|
|
230
|
+
- Accent navy `#003045` and `border-radius: 0` everywhere.
|
|
231
|
+
- Poppins, with the weight tokens toned down a notch, because Poppins renders heavy.
|
|
232
|
+
- Pale surface colors as `--dibk-surface-{blue,green,orange,grey,pink}`.
|
|
233
|
+
- Text and line colors: `--dibk-color-ink` for body ink, `--dibk-color-meta` for the warm
|
|
234
|
+
grey used on meta text, `--dibk-color-hairline` for subtle dividers.
|
|
235
|
+
|
|
236
|
+
### Card surfaces
|
|
237
|
+
|
|
238
|
+
Cards are flat, with no border. Pick the background with `data-dibk-color`, which tints the
|
|
239
|
+
panel and leaves buttons and headings navy. We use our own attribute here because
|
|
240
|
+
Designsystemet's `data-color` would cascade the whole color family and turn the buttons
|
|
241
|
+
blue too.
|
|
242
|
+
|
|
243
|
+
```tsx
|
|
244
|
+
<Card>…</Card> {/* white (default) */}
|
|
245
|
+
<Card data-dibk-color="blue">…</Card>
|
|
246
|
+
<Card data-dibk-color="green">…</Card>
|
|
247
|
+
<Card data-dibk-color="orange">…</Card>
|
|
248
|
+
<Card data-dibk-color="grey">…</Card>
|
|
249
|
+
<Card data-dibk-color="pink">…</Card>
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
### Changing the theme
|
|
253
|
+
|
|
254
|
+
`theme.css` is generated from a single brand color by `scripts/build-theme.mjs`, which calls
|
|
255
|
+
Designsystemet's `formatThemeCSS`. Change the script and run `pnpm theme`, don't edit the
|
|
256
|
+
generated file. Our tailoring of individual Designsystemet components lives in
|
|
257
|
+
`src/overrides.css` as plain unlayered rules, which win over Designsystemet's `@layer ds`
|
|
258
|
+
without needing `!important`.
|
|
259
|
+
|
|
260
|
+
## Icons
|
|
261
|
+
|
|
262
|
+
Thirteen DIBK brand illustrations as React components, on the `/icons` subpath. They're
|
|
263
|
+
multi-colour brand artwork (navy, orange, light blue, green), so they ignore `currentColor`
|
|
264
|
+
and you can't recolour them. For general UI iconography use Designsystemet's icons, which
|
|
265
|
+
come with `@digdir/designsystemet-react`.
|
|
266
|
+
|
|
267
|
+
```tsx
|
|
268
|
+
import { IconNabovarsel, dibkIcons } from "dibk-designsystemet/icons";
|
|
269
|
+
|
|
270
|
+
<IconNabovarsel width={40} height={40} />;
|
|
271
|
+
const Icon = dibkIcons["sentral-godkjenning"]; // name -> component, for data-driven lists
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
Available: `bygge-endre`, `byggevarer`, `byggteknisk`, `forskrift`, `forskrift-sak`,
|
|
275
|
+
`forskrift-tek`, `nabovarsel`, `peker-gronn`, `sentral-godkjenning`, `sentraltgodkjent`,
|
|
276
|
+
`skjema`, `skjema-og-soknadslosninger`, `tilsyn`. A named import is tree-shakeable; the
|
|
277
|
+
`dibkIcons` registry pulls in all thirteen.
|
|
278
|
+
|
|
279
|
+
## Fonts
|
|
280
|
+
|
|
281
|
+
The brand font is Poppins, delivered through `@fontsource/poppins` as a peer dependency. We
|
|
282
|
+
don't ship PP Mori, the font dibk.no uses.
|
|
283
|
+
|
|
284
|
+
`fonts.css` declares the latin and latin-ext subsets at weights 300 to 700 as woff2,
|
|
285
|
+
pointing at the font files in your own `@fontsource/poppins`. The `unicode-range`
|
|
286
|
+
declarations mean a browser only downloads the subsets and weights a page actually renders.
|
|
287
|
+
|
|
288
|
+
Want a different typeface? Skip `fonts.css`, import `styles.css` alone and set
|
|
289
|
+
`--ds-font-family` yourself.
|
|
290
|
+
|
|
291
|
+
## Swagger UI skin
|
|
292
|
+
|
|
293
|
+
`swagger.css` is a standalone DIBK skin for [Swagger UI](https://swagger.io/tools/swagger-ui/),
|
|
294
|
+
for apps that expose an API browser. Swagger UI brings its own DOM and its own bundle, so
|
|
295
|
+
this is plain static CSS targeting its class names rather than a bundled entry: your host
|
|
296
|
+
serves it as a static file and tells Swagger UI to inject it.
|
|
297
|
+
|
|
298
|
+
Two things have to end up on disk in this layout, because the stylesheet's `@font-face`
|
|
299
|
+
URLs are relative to the stylesheet:
|
|
300
|
+
|
|
301
|
+
```
|
|
302
|
+
<served-root>/swagger-theme.css <- dist/swagger.css from this package
|
|
303
|
+
<served-root>/fonts/poppins-latin-300-normal.woff2 <- from @fontsource/poppins
|
|
304
|
+
<served-root>/fonts/poppins-latin-400-normal.woff2
|
|
305
|
+
<served-root>/fonts/poppins-latin-500-normal.woff2
|
|
306
|
+
<served-root>/fonts/poppins-latin-600-normal.woff2
|
|
307
|
+
<served-root>/fonts/poppins-latin-700-normal.woff2
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
The fonts come from the `@fontsource/poppins` you already have as a peer dependency. We
|
|
311
|
+
don't bundle them, because Swagger UI has no bundler to resolve them through. Skip the
|
|
312
|
+
fonts and the skin still applies, it just falls back to system-ui.
|
|
313
|
+
|
|
314
|
+
Assemble the directory during your build, for example in a Docker stage that has already
|
|
315
|
+
run `npm ci`:
|
|
316
|
+
|
|
317
|
+
```dockerfile
|
|
318
|
+
RUN mkdir -p /assets/fonts \
|
|
319
|
+
&& cp node_modules/dibk-designsystemet/dist/swagger.css /assets/swagger-theme.css \
|
|
320
|
+
&& cp node_modules/@fontsource/poppins/files/poppins-latin-{300,400,500,600,700}-normal.woff2 \
|
|
321
|
+
/assets/fonts/
|
|
322
|
+
```
|
|
323
|
+
|
|
324
|
+
Then serve that directory and inject the stylesheet. In ASP.NET:
|
|
325
|
+
|
|
326
|
+
```csharp
|
|
327
|
+
app.UseStaticFiles(new StaticFileOptions
|
|
328
|
+
{
|
|
329
|
+
FileProvider = new PhysicalFileProvider("/assets"),
|
|
330
|
+
RequestPath = "/swagger-assets",
|
|
331
|
+
});
|
|
332
|
+
|
|
333
|
+
app.UseSwaggerUI(opts => opts.InjectStylesheet("/swagger-assets/swagger-theme.css"));
|
|
334
|
+
```
|
|
335
|
+
|
|
336
|
+
The `fonts/` directory resolves under the same prefix automatically, so there's nothing
|
|
337
|
+
else to configure.
|
|
338
|
+
|
|
339
|
+
## Package exports
|
|
340
|
+
|
|
341
|
+
| Entry | Contents |
|
|
342
|
+
|-------|----------|
|
|
343
|
+
| `dibk-designsystemet` | Components and types, ESM + CJS |
|
|
344
|
+
| `dibk-designsystemet/layout` | `Stack`, `Cluster`, `Sidebar`, `Grid` |
|
|
345
|
+
| `dibk-designsystemet/icons` | DIBK brand icons |
|
|
346
|
+
| `dibk-designsystemet/styles.css` | Everything: DS component CSS, theme, base, overrides, layout |
|
|
347
|
+
| `dibk-designsystemet/fonts.css` | Poppins `@font-face` declarations |
|
|
348
|
+
| `dibk-designsystemet/theme.css` | Theme tokens alone |
|
|
349
|
+
| `dibk-designsystemet/index.css` | Brand base, overrides and component CSS alone |
|
|
350
|
+
| `dibk-designsystemet/layout.css` | Layout primitive CSS alone |
|
|
351
|
+
| `dibk-designsystemet/swagger.css` | Standalone Swagger UI skin (see [above](#swagger-ui-skin)) |
|
|
352
|
+
|
|
353
|
+
Reach for `styles.css`. The granular CSS entries are there for the rare app that needs to
|
|
354
|
+
compose a different cascade.
|
|
355
|
+
|
|
356
|
+
## License
|
|
357
|
+
|
|
358
|
+
Copyright DIBK. All rights reserved. See `LICENSE.md`.
|
|
359
|
+
|
|
360
|
+
Missing a component, or fighting one? Open an
|
|
361
|
+
[issue](https://github.com/Arkitektum/dibk-designsystemet/issues).
|
|
362
|
+
|
|
363
|
+
`apps/demo` in the repository is a runnable app built on this package: an information page,
|
|
364
|
+
a component catalog and a full example site. The [repository
|
|
365
|
+
README](../../README.md) says how to run it.
|
package/dist/fonts.css
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/* dibk-designsystemet - generated by scripts/build-fonts-entry.mjs. Do not edit. */
|
|
2
|
+
@font-face {
|
|
3
|
+
font-family: 'Poppins';
|
|
4
|
+
font-style: normal;
|
|
5
|
+
font-display: swap;
|
|
6
|
+
font-weight: 300;
|
|
7
|
+
src: url("@fontsource/poppins/files/poppins-latin-ext-300-normal.woff2") format('woff2');
|
|
8
|
+
unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
|
|
9
|
+
}
|
|
10
|
+
@font-face {
|
|
11
|
+
font-family: 'Poppins';
|
|
12
|
+
font-style: normal;
|
|
13
|
+
font-display: swap;
|
|
14
|
+
font-weight: 300;
|
|
15
|
+
src: url("@fontsource/poppins/files/poppins-latin-300-normal.woff2") format('woff2');
|
|
16
|
+
unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
|
|
17
|
+
}
|
|
18
|
+
@font-face {
|
|
19
|
+
font-family: 'Poppins';
|
|
20
|
+
font-style: normal;
|
|
21
|
+
font-display: swap;
|
|
22
|
+
font-weight: 400;
|
|
23
|
+
src: url("@fontsource/poppins/files/poppins-latin-ext-400-normal.woff2") format('woff2');
|
|
24
|
+
unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
|
|
25
|
+
}
|
|
26
|
+
@font-face {
|
|
27
|
+
font-family: 'Poppins';
|
|
28
|
+
font-style: normal;
|
|
29
|
+
font-display: swap;
|
|
30
|
+
font-weight: 400;
|
|
31
|
+
src: url("@fontsource/poppins/files/poppins-latin-400-normal.woff2") format('woff2');
|
|
32
|
+
unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
|
|
33
|
+
}
|
|
34
|
+
@font-face {
|
|
35
|
+
font-family: 'Poppins';
|
|
36
|
+
font-style: normal;
|
|
37
|
+
font-display: swap;
|
|
38
|
+
font-weight: 500;
|
|
39
|
+
src: url("@fontsource/poppins/files/poppins-latin-ext-500-normal.woff2") format('woff2');
|
|
40
|
+
unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
|
|
41
|
+
}
|
|
42
|
+
@font-face {
|
|
43
|
+
font-family: 'Poppins';
|
|
44
|
+
font-style: normal;
|
|
45
|
+
font-display: swap;
|
|
46
|
+
font-weight: 500;
|
|
47
|
+
src: url("@fontsource/poppins/files/poppins-latin-500-normal.woff2") format('woff2');
|
|
48
|
+
unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
|
|
49
|
+
}
|
|
50
|
+
@font-face {
|
|
51
|
+
font-family: 'Poppins';
|
|
52
|
+
font-style: normal;
|
|
53
|
+
font-display: swap;
|
|
54
|
+
font-weight: 600;
|
|
55
|
+
src: url("@fontsource/poppins/files/poppins-latin-ext-600-normal.woff2") format('woff2');
|
|
56
|
+
unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
|
|
57
|
+
}
|
|
58
|
+
@font-face {
|
|
59
|
+
font-family: 'Poppins';
|
|
60
|
+
font-style: normal;
|
|
61
|
+
font-display: swap;
|
|
62
|
+
font-weight: 600;
|
|
63
|
+
src: url("@fontsource/poppins/files/poppins-latin-600-normal.woff2") format('woff2');
|
|
64
|
+
unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
|
|
65
|
+
}
|
|
66
|
+
@font-face {
|
|
67
|
+
font-family: 'Poppins';
|
|
68
|
+
font-style: normal;
|
|
69
|
+
font-display: swap;
|
|
70
|
+
font-weight: 700;
|
|
71
|
+
src: url("@fontsource/poppins/files/poppins-latin-ext-700-normal.woff2") format('woff2');
|
|
72
|
+
unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
|
|
73
|
+
}
|
|
74
|
+
@font-face {
|
|
75
|
+
font-family: 'Poppins';
|
|
76
|
+
font-style: normal;
|
|
77
|
+
font-display: swap;
|
|
78
|
+
font-weight: 700;
|
|
79
|
+
src: url("@fontsource/poppins/files/poppins-latin-700-normal.woff2") format('woff2');
|
|
80
|
+
unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
|
|
81
|
+
}
|