@politiet/sheriff-web-components 2.13.0 → 2.13.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/custom-elements.json +173 -7
- package/dist/mixins/sds-dialog-target-mixin.d.ts.map +1 -1
- package/dist/mixins/sds-dialog-target-mixin.js +10 -0
- package/dist/mixins/sds-dialog-target-mixin.js.map +1 -1
- package/dist/sds-button/sds-button.styles.d.ts.map +1 -1
- package/dist/sds-button/sds-button.styles.js +7 -2
- package/dist/sds-button/sds-button.styles.js.map +1 -1
- package/dist/sds-radio/sds-radio.d.ts +53 -1
- package/dist/sds-radio/sds-radio.d.ts.map +1 -1
- package/dist/sds-radio/sds-radio.js +218 -41
- package/dist/sds-radio/sds-radio.js.map +1 -1
- package/dist/sds-radio/sds-radio.styles.js +36 -36
- package/dist/sds-radio/sds-radio.styles.js.map +1 -1
- package/dist/sds-radio-group/sds-radio-group.d.ts +4 -2
- package/dist/sds-radio-group/sds-radio-group.d.ts.map +1 -1
- package/dist/sds-radio-group/sds-radio-group.js +10 -3
- package/dist/sds-radio-group/sds-radio-group.js.map +1 -1
- package/dist/sheriff-web-components.js +188 -180
- package/dist/skill/SKILL.md +127 -41
- package/dist/skill/references/components.md +247 -35
- package/dist/skill/references/react-wrappers.md +34 -9
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/version.js.map +1 -1
- package/package.json +1 -1
- package/web-types.json +133 -40
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
# Component Reference
|
|
2
2
|
|
|
3
|
-
Full API for each SDS web component.
|
|
3
|
+
Full API for each SDS web component.
|
|
4
|
+
|
|
5
|
+
Sizes used by components are `"lg"` | `"md"` | `"sm"` with default `"md"`, except:
|
|
6
|
+
|
|
7
|
+
- `sds-button` — defaults to `"lg"`
|
|
8
|
+
- `sds-heading` / `sds-text` — use `"xl" | "lg" | "md" | "sm" | "xs"`
|
|
9
|
+
- `sds-icon` — `"sm" | "md" | "lg"`
|
|
10
|
+
|
|
11
|
+
`data-palette` works on every component and inherits from ancestor containers. Exceptions: `sds-alert` (own typed property, must be set on the element), `sds-tooltip` and `sds-environment-banner` (no palette support). See the `@politiet/sheriff-css-framework` skill for palette values.
|
|
4
12
|
|
|
5
13
|
---
|
|
6
14
|
|
|
@@ -33,9 +41,10 @@ Contextual alert/message banner. Source: `sds-alert.component.ts`.
|
|
|
33
41
|
</sds-alert>
|
|
34
42
|
```
|
|
35
43
|
|
|
36
|
-
**Props:** `variant` (`"primary"` | `"secondary"`, default `"primary"`), `size` (`"lg"` | `"md"` | `"sm"`), `removable-label` (string — shows close button
|
|
44
|
+
**Props:** `variant` (`"primary"` | `"secondary"`, default `"primary"`), `size` (`"lg"` | `"md"` | `"sm"`, default `"md"`), `removable-label` (string — shows close button, **primary variant only**), `data-palette` (`"info"` | `"success"` | `"attention"` | `"danger"`, default `"info"`)
|
|
37
45
|
**Slots:** `title` (heading element), `message` (`<p>`)
|
|
38
46
|
**Events:** `sds-remove` (close button clicked)
|
|
47
|
+
**Note:** `data-palette` also selects the status icon (info → `InformationSquareFill-aksel-filled`, success → `check_circle-material-filled`, attention → `warning-material-filled`, danger → `dangerous-material-filled`). Because it is a typed property rather than plain CSS, it must be set on the `sds-alert` itself — an ancestor `data-palette` will not reach it, and `warning` is not a valid value here.
|
|
39
48
|
|
|
40
49
|
---
|
|
41
50
|
|
|
@@ -49,9 +58,9 @@ Button or link-styled-as-button. Source: `sds-button.component.ts`.
|
|
|
49
58
|
<sds-button variant="tertiary">Learn more</sds-button>
|
|
50
59
|
<sds-button href="https://example.com" target="_blank">Visit site</sds-button>
|
|
51
60
|
|
|
52
|
-
<!-- Icon-only -->
|
|
53
|
-
<sds-button variant="primary" icon>
|
|
54
|
-
<sds-icon name="search-material-outlined"
|
|
61
|
+
<!-- Icon-only: accessible name via `label` on the button -->
|
|
62
|
+
<sds-button variant="primary" icon label="Search">
|
|
63
|
+
<sds-icon name="search-material-outlined"></sds-icon>
|
|
55
64
|
</sds-button>
|
|
56
65
|
|
|
57
66
|
<!-- With leading/trailing icons -->
|
|
@@ -67,12 +76,20 @@ Button or link-styled-as-button. Source: `sds-button.component.ts`.
|
|
|
67
76
|
|
|
68
77
|
<sds-button variant="primary" loading>Saving...</sds-button>
|
|
69
78
|
<sds-button variant="primary" type="submit">Submit</sds-button>
|
|
79
|
+
|
|
80
|
+
<!-- On a dark or palette-coloured surface -->
|
|
81
|
+
<div class="sds-color-accent-action-default sds-spacing-p-md">
|
|
82
|
+
<sds-button inverted>Inverted</sds-button>
|
|
83
|
+
</div>
|
|
70
84
|
```
|
|
71
85
|
|
|
72
|
-
**Props:** `variant` (`"primary"` | `"secondary"` | `"tertiary"`, default `"primary"`), `size` (`"lg"` | `"md"` | `"sm"`, default `"lg"`), `type` (`"button"` | `"submit"` | `"reset"`, default `"button"`), `disabled`, `loading`, `icon` (compact icon-only mode), `href`, `target`, `name`, `value`, `form`
|
|
86
|
+
**Props:** `variant` (`"primary"` | `"secondary"` | `"tertiary"`, default `"primary"`), `size` (`"lg"` | `"md"` | `"sm"`, default `"lg"`), `type` (`"button"` | `"submit"` | `"reset"`, default `"button"`), `disabled`, `loading`, `icon` (compact icon-only mode), `inverted` (for dark/coloured backgrounds), `label` (sets `aria-label` on the internal button — use for icon-only buttons), `href`, `target`, `name`, `value`, `form`
|
|
87
|
+
**Dialog targeting:** `command` (`"show-modal"` | `"close"` | `"request-close"`) + `commandfor` (dialog `id`). Legacy aliases `data-command` / `data-commandfor` also work.
|
|
88
|
+
**Popover targeting:** `popovertarget` (popover `id`), `popovertargetaction` (`"show"` | `"hide"` | `"toggle"`)
|
|
73
89
|
**Slots:** default (label), `before`, `after`
|
|
74
90
|
**Events:** `click`, `submit`, `reset`
|
|
75
91
|
**Danger pattern:** `<sds-button variant="primary" data-palette="danger">Delete</sds-button>`
|
|
92
|
+
**Notes:** Form-associated. When `href` is set the component renders an `<a>` instead of a `<button>`, so `type`, `disabled`, `loading`, and `label` do not apply. `loading` replaces the `before` and `after` slots with a spinner.
|
|
76
93
|
|
|
77
94
|
---
|
|
78
95
|
|
|
@@ -93,8 +110,8 @@ Content container card. Renders as `<a>` with arrow icon when `link` is set.
|
|
|
93
110
|
```
|
|
94
111
|
|
|
95
112
|
**Props:** `link` (URL — renders as anchor)
|
|
96
|
-
**Slots:** `heading` (`<h2>`–`<h6>`
|
|
97
|
-
**Note:**
|
|
113
|
+
**Slots:** `heading` (one of `<h2>`–`<h6>`), `text` (`<p>` only, no nested elements)
|
|
114
|
+
**Note:** Slot content is validated on render — invalid content still renders but logs a `console.warn`. Use native heading/paragraph elements.
|
|
98
115
|
|
|
99
116
|
---
|
|
100
117
|
|
|
@@ -108,10 +125,17 @@ Single checkbox input.
|
|
|
108
125
|
<sds-checkbox label="Remember me" name="remember" help-text="Stay logged in for 30 days"></sds-checkbox>
|
|
109
126
|
<sds-checkbox label="Required option" name="required" error></sds-checkbox>
|
|
110
127
|
<sds-checkbox label="Locked choice" name="locked" checked readonly></sds-checkbox>
|
|
128
|
+
|
|
129
|
+
<!-- Label with markup -->
|
|
130
|
+
<sds-checkbox name="terms">
|
|
131
|
+
<span slot="label">I accept the <a href="/terms">terms</a></span>
|
|
132
|
+
</sds-checkbox>
|
|
111
133
|
```
|
|
112
134
|
|
|
113
135
|
**Props:** `label`, `name`, `value`, `checked`, `disabled`, `required`, `readonly`, `error` (boolean — use checkbox-group for text error messages), `help-text`, `size`
|
|
136
|
+
**Slots:** `label` (alternative to the `label` attribute)
|
|
114
137
|
**Events:** `change`, `focus`, `blur`
|
|
138
|
+
**Note:** Form-associated. Setting `disabled` explicitly makes the checkbox self-controlled — a parent `sds-checkbox-group` will no longer override it.
|
|
115
139
|
|
|
116
140
|
---
|
|
117
141
|
|
|
@@ -154,11 +178,18 @@ Form-associated chip/pill. Two variants: `selectable` (toggle) and `removable` (
|
|
|
154
178
|
Locked
|
|
155
179
|
<sds-icon size="sm" name="lock-material-outlined"></sds-icon>
|
|
156
180
|
</sds-chip>
|
|
181
|
+
|
|
182
|
+
<!-- Palette theming (works on the chip or any ancestor) -->
|
|
183
|
+
<sds-chip data-palette="danger" name="risk" value="high">High risk</sds-chip>
|
|
184
|
+
<div data-palette="success">
|
|
185
|
+
<sds-chip name="status" value="ok" checked>Approved</sds-chip>
|
|
186
|
+
</div>
|
|
157
187
|
```
|
|
158
188
|
|
|
159
|
-
**Props:** `variant` (`"selectable"` | `"removable"`, default `"selectable"`), `checked`, `name`, `value`, `disabled`, `readonly`, `size`
|
|
189
|
+
**Props:** `variant` (`"selectable"` | `"removable"`, default `"selectable"`), `checked`, `name`, `value`, `disabled`, `readonly`, `size`, `data-palette`
|
|
160
190
|
**Slots:** default (label, can include `sds-icon`)
|
|
161
191
|
**Events:** `change` (selectable), `sds-remove` (removable)
|
|
192
|
+
**Note:** Form-associated — the chip submits `value` only while `checked`.
|
|
162
193
|
|
|
163
194
|
---
|
|
164
195
|
|
|
@@ -190,7 +221,41 @@ Expandable/collapsible accordion. Summary text is a slot.
|
|
|
190
221
|
|
|
191
222
|
**Props:** `open`, `standalone` (rounded corners + border), `name` (exclusive accordion group)
|
|
192
223
|
**Slots:** `summary` (always visible), default (expandable content)
|
|
193
|
-
**Events:** `
|
|
224
|
+
**Events:** `toggle` (detail: `{ open: boolean }`) — **not** `sds-toggle`
|
|
225
|
+
|
|
226
|
+
---
|
|
227
|
+
|
|
228
|
+
## sds-details-group
|
|
229
|
+
|
|
230
|
+
Wraps sibling `sds-details` into one visually joined accordion. Set `name` to make the group exclusive — the group copies its `name` onto every child and closes the others when one opens.
|
|
231
|
+
|
|
232
|
+
```html
|
|
233
|
+
<sds-details-group>
|
|
234
|
+
<sds-details>
|
|
235
|
+
<span slot="summary">Hva er Sheriff?</span>
|
|
236
|
+
<p>Sheriff er politiet sitt designsystem</p>
|
|
237
|
+
</sds-details>
|
|
238
|
+
<sds-details>
|
|
239
|
+
<span slot="summary">Hvordan kommer jeg i gang?</span>
|
|
240
|
+
<p>Start med å lese dokumentasjonen.</p>
|
|
241
|
+
</sds-details>
|
|
242
|
+
</sds-details-group>
|
|
243
|
+
|
|
244
|
+
<sds-details-group outlined name="faq">
|
|
245
|
+
<sds-details>
|
|
246
|
+
<span slot="summary">Question 1</span>
|
|
247
|
+
<p>Answer 1</p>
|
|
248
|
+
</sds-details>
|
|
249
|
+
<sds-details>
|
|
250
|
+
<span slot="summary">Question 2</span>
|
|
251
|
+
<p>Answer 2</p>
|
|
252
|
+
</sds-details>
|
|
253
|
+
</sds-details-group>
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
**Props:** `outlined` (adds a border around the group), `name` (exclusive group — propagates to children)
|
|
257
|
+
**Slots:** default (`sds-details` children)
|
|
258
|
+
**Note:** Do not set `name` on the children when using a group `name`; the group overwrites it.
|
|
194
259
|
|
|
195
260
|
---
|
|
196
261
|
|
|
@@ -199,21 +264,42 @@ Expandable/collapsible accordion. Summary text is a slot.
|
|
|
199
264
|
Modal/dialog wrapping native `<dialog>`.
|
|
200
265
|
|
|
201
266
|
```html
|
|
202
|
-
<sds-
|
|
267
|
+
<sds-button command="show-modal" commandfor="confirm">Delete…</sds-button>
|
|
268
|
+
|
|
269
|
+
<sds-dialog id="confirm" modal closedby="any">
|
|
203
270
|
<sds-heading level="h2" size="md" slot="header">Confirm Action</sds-heading>
|
|
204
271
|
<sds-text>Are you sure you want to proceed?</sds-text>
|
|
205
|
-
<div slot="footer"
|
|
206
|
-
<sds-button size="md">Confirm</sds-button>
|
|
207
|
-
<sds-button size="md" variant="secondary"
|
|
272
|
+
<div slot="footer" class="sds-stack-x-2xs">
|
|
273
|
+
<sds-button size="md" data-palette="danger">Confirm</sds-button>
|
|
274
|
+
<sds-button size="md" variant="secondary" command="close">Cancel</sds-button>
|
|
208
275
|
</div>
|
|
209
276
|
</sds-dialog>
|
|
210
277
|
```
|
|
211
278
|
|
|
212
|
-
**Props:** `open`, `modal`, `closedby` (`"none"` | `"closerequest"` | `"any"`, default `"closerequest"`), `close-button-label` (default `"Lukk dialogvindu"`, empty string hides button)
|
|
279
|
+
**Props:** `open`, `modal`, `closedby` (`"none"` | `"closerequest"` | `"any"`, default `"closerequest"`), `close-button-label` (default `"Lukk dialogvindu"`, empty string hides the built-in close button)
|
|
213
280
|
**Slots:** `header`, default (body), `footer`
|
|
214
|
-
**Events:** `close`
|
|
215
|
-
**Methods:** `show()`, `showModal()
|
|
216
|
-
**
|
|
281
|
+
**Events:** `close`. `sds-close` still fires but is **deprecated** — listening for it logs a console warning and it is removed in the next major.
|
|
282
|
+
**Methods:** `show()`, `showModal()` (also sets `modal`), `close()`, `requestClose()`
|
|
283
|
+
**Notes:**
|
|
284
|
+
|
|
285
|
+
- `command="close"` or `data-command="close"` on any button inside the dialog closes it, no `commandfor` needed.
|
|
286
|
+
- `command="show-modal"` requires `commandfor="{dialog id}"` and wires `aria-haspopup`/`aria-expanded`/`aria-controls` on the trigger.
|
|
287
|
+
- `closedby="any"` includes a Safari polyfill for outside clicks.
|
|
288
|
+
- An element in the default slot carrying `autofocus` receives focus once the open animation ends.
|
|
289
|
+
|
|
290
|
+
---
|
|
291
|
+
|
|
292
|
+
## sds-environment-banner
|
|
293
|
+
|
|
294
|
+
Thin strip identifying the running environment and build, for internal apps. Source: `sds-environment-banner.component.ts`.
|
|
295
|
+
|
|
296
|
+
```html
|
|
297
|
+
<sds-environment-banner env="test" build="2026.9.1-rc3"></sds-environment-banner> <sds-environment-banner env="dev"></sds-environment-banner>
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
**Props:** `env` (`"opplaering"` | `"local"` | `"dev"` | `"test"` | `"stage"` | `"prod"`), `build` (free-text build identifier)
|
|
301
|
+
**Slots:** none
|
|
302
|
+
**Note:** Renders the Norwegian label for `env` (`opplaering` → "Opplæring"). Colors are fixed per environment — `data-palette` has no effect. Both props are optional; omitting `env` hides the label and omitting `build` hides the build text.
|
|
217
303
|
|
|
218
304
|
---
|
|
219
305
|
|
|
@@ -227,7 +313,7 @@ Semantic heading. Source: `sds-heading.component.ts`.
|
|
|
227
313
|
<sds-heading level="h2" data-palette="accent">Accent heading</sds-heading>
|
|
228
314
|
```
|
|
229
315
|
|
|
230
|
-
**Props:** `level` (`"h1"`–`"h6"`, default `"h1"`), `size` (`"xl"` | `"lg"` | `"md"` | `"sm"` | `"xs"` — visual override)
|
|
316
|
+
**Props:** `level` (`"h1"`–`"h6"`, default `"h1"`), `size` (`"xl"` | `"lg"` | `"md"` | `"sm"` | `"xs"` — visual override; `"l"`/`"m"`/`"s"` are deprecated v1 aliases)
|
|
231
317
|
**Slots:** default
|
|
232
318
|
|
|
233
319
|
---
|
|
@@ -249,14 +335,38 @@ Dynamic SVG icon. Source: `sds-icon.component.ts`.
|
|
|
249
335
|
</sds-icon>
|
|
250
336
|
```
|
|
251
337
|
|
|
252
|
-
**Props:** `name` (`{icon}-{source}-{variant}`), `size` (`"sm"` | `"md"` | `"lg"`), `label` (sets `role="img"` + `aria-label
|
|
338
|
+
**Props:** `name` (`{icon}-{source}-{variant}`; typed as `string`, not the `IconName` union), `size` (`"sm"` | `"md"` | `"lg"`; `"s"`/`"m"` are deprecated aliases), `label` (sets `role="img"` + `aria-label`; omit for decorative icons), `color` (any CSS color, applied inline)
|
|
253
339
|
**Slots:** default (custom `<svg>` — use instead of `name`)
|
|
340
|
+
**Static methods:** `SDSIcon.setLoadLocal(boolean)`, `SDSIcon.registerResolver(fn)`
|
|
254
341
|
**CSS vars:** `--sds-icon-size`, `--sds-icon-color`, `--sds-icon-display`
|
|
255
342
|
|
|
256
343
|
For icon naming, loading, and resolvers, see `@politiet/sheriff-icons` package skill.
|
|
257
344
|
|
|
258
345
|
---
|
|
259
346
|
|
|
347
|
+
## sds-internal-header
|
|
348
|
+
|
|
349
|
+
App header for internal (non-public) applications. Renders the internal Sheriff mark plus optional app name and two content slots. Source: `sds-internal-header.component.ts`.
|
|
350
|
+
|
|
351
|
+
```html
|
|
352
|
+
<sds-internal-header app-name="Saksbehandling" home-href="/">
|
|
353
|
+
<nav slot="start">
|
|
354
|
+
<a href="/oversikt">Oversikt</a>
|
|
355
|
+
<a href="/oppgaver">Oppgaver</a>
|
|
356
|
+
</nav>
|
|
357
|
+
<div slot="end" class="sds-stack-x-3xs">
|
|
358
|
+
<sds-button inverted>Søk</sds-button>
|
|
359
|
+
<sds-button inverted variant="tertiary">Logg ut</sds-button>
|
|
360
|
+
</div>
|
|
361
|
+
</sds-internal-header>
|
|
362
|
+
```
|
|
363
|
+
|
|
364
|
+
**Props:** `app-name` (title text), `home-href` (wraps the app name in a link to this URL)
|
|
365
|
+
**Slots:** `start` (primary navigation), `end` (actions / user menu)
|
|
366
|
+
**Note:** Renders a `<header>` internally, so do not wrap it in another `<header>`. Use `inverted` on nested `sds-button`s.
|
|
367
|
+
|
|
368
|
+
---
|
|
369
|
+
|
|
260
370
|
## sds-loader
|
|
261
371
|
|
|
262
372
|
Loading spinner with built-in `aria-label="Laster"`.
|
|
@@ -264,11 +374,18 @@ Loading spinner with built-in `aria-label="Laster"`.
|
|
|
264
374
|
```html
|
|
265
375
|
<sds-loader></sds-loader>
|
|
266
376
|
<sds-loader size="lg"></sds-loader>
|
|
267
|
-
|
|
268
|
-
|
|
377
|
+
|
|
378
|
+
<!-- On a palette-coloured surface -->
|
|
379
|
+
<div data-palette="accent" class="sds-color-action-default sds-spacing-p-md">
|
|
380
|
+
<sds-loader></sds-loader>
|
|
381
|
+
</div>
|
|
382
|
+
|
|
383
|
+
<!-- Palette colours, plain background -->
|
|
384
|
+
<sds-loader data-palette="accent" contrast></sds-loader>
|
|
269
385
|
```
|
|
270
386
|
|
|
271
|
-
**Props:** `size`, `contrast`
|
|
387
|
+
**Props:** `size`, `contrast`
|
|
388
|
+
**Note:** With `data-palette` the spinner switches to the palette's _contrast_ colour, i.e. it is meant to sit **on** a palette-coloured surface. Add `contrast` to flip it back to the palette's action colour for a plain background.
|
|
272
389
|
|
|
273
390
|
---
|
|
274
391
|
|
|
@@ -283,9 +400,71 @@ Loading spinner with built-in `aria-label="Laster"`.
|
|
|
283
400
|
</sds-notification>
|
|
284
401
|
```
|
|
285
402
|
|
|
286
|
-
**Props:** `variant` (`"info"` | `"success"` | `"attention"` | `"danger"`), `removable-label`
|
|
403
|
+
**Props:** `variant` (`"info"` | `"success"` | `"attention"` | `"danger"`, default `"info"`; `"warning"` and `"critical"` are deprecated aliases for `attention` and `danger`), `removable-label`
|
|
287
404
|
**Slots:** `title`, `message`
|
|
288
405
|
**Events:** `sds-remove`
|
|
406
|
+
**Note:** Constructing one logs a deprecation warning. The nearest `sds-alert` equivalent maps `variant` onto `data-palette`.
|
|
407
|
+
|
|
408
|
+
---
|
|
409
|
+
|
|
410
|
+
## sds-popover
|
|
411
|
+
|
|
412
|
+
Anchored popover built on the native Popover API. The element sets `popover="auto"` on itself unless you provide your own `popover` value, and is opened by a trigger with `popovertarget`.
|
|
413
|
+
|
|
414
|
+
```html
|
|
415
|
+
<sds-button popovertarget="filters">Filters</sds-button>
|
|
416
|
+
|
|
417
|
+
<sds-popover id="filters" placement="bottom-start">
|
|
418
|
+
<div class="sds-stack-y-3xs">
|
|
419
|
+
<sds-checkbox label="Open cases" name="open"></sds-checkbox>
|
|
420
|
+
<sds-checkbox label="Closed cases" name="closed"></sds-checkbox>
|
|
421
|
+
</div>
|
|
422
|
+
</sds-popover>
|
|
423
|
+
|
|
424
|
+
<!-- Long content: make the popover scrollable instead of overflowing -->
|
|
425
|
+
<sds-popover id="long" placement="bottom" overscroll="contain">…</sds-popover>
|
|
426
|
+
```
|
|
427
|
+
|
|
428
|
+
**Props:** `placement` (`"top"` | `"bottom"` | `"left"` | `"right"`, each also with `-start` / `-end`, or `"none"`; default `"top"`), `autoplacement` (`"true"` | `"false"`, default behaviour is to flip when there is no room), `overscroll` (`"contain"` — makes the popover scrollable)
|
|
429
|
+
**Native attribute:** `popover` (`"auto"` | `"manual"`, defaults to `"auto"`)
|
|
430
|
+
**Slots:** default (popover content)
|
|
431
|
+
**Events:** `toggle` (native `ToggleEvent` — check `newState`)
|
|
432
|
+
**Methods:** `showPopover()`, `hidePopover()` (native Popover API)
|
|
433
|
+
**Note:** A trigger using `popovertarget` automatically gets `aria-haspopup`, `aria-expanded`, and `aria-controls`. The popover needs an `id`.
|
|
434
|
+
|
|
435
|
+
---
|
|
436
|
+
|
|
437
|
+
## sds-process
|
|
438
|
+
|
|
439
|
+
Timeline / process list. Renders with `role="list"`; each `sds-process-step` is a `listitem`.
|
|
440
|
+
|
|
441
|
+
```html
|
|
442
|
+
<sds-process heading-level="h3">
|
|
443
|
+
<sds-process-step heading="14:41"> Fører som ikke klarte å stanse var ruset og er anmeldt. </sds-process-step>
|
|
444
|
+
<sds-process-step heading="13:48">Veien er ryddet og vi har avsluttet på stedet.</sds-process-step>
|
|
445
|
+
</sds-process>
|
|
446
|
+
|
|
447
|
+
<!-- Numbered / custom markers -->
|
|
448
|
+
<sds-process heading-level="h3">
|
|
449
|
+
<sds-process-step heading="Send inn søknad" timestamp="1. mars">
|
|
450
|
+
<span slot="marker">1</span>
|
|
451
|
+
Fyll ut skjemaet.
|
|
452
|
+
</sds-process-step>
|
|
453
|
+
<sds-process-step heading="Behandling" timestamp="2.–14. mars">
|
|
454
|
+
<span slot="marker">2</span>
|
|
455
|
+
Vi behandler søknaden.
|
|
456
|
+
</sds-process-step>
|
|
457
|
+
</sds-process>
|
|
458
|
+
```
|
|
459
|
+
|
|
460
|
+
**Props:** `heading-level` (`"h2"`–`"h6"`, default `"h2"`) — applied to every child step's heading
|
|
461
|
+
**Slots:** default (`sds-process-step` children)
|
|
462
|
+
|
|
463
|
+
### sds-process-step
|
|
464
|
+
|
|
465
|
+
**Props:** `heading` (rendered at the parent's `heading-level`), `timestamp`
|
|
466
|
+
**Slots:** default (step body), `marker` (leading marker content — a number, icon, or label)
|
|
467
|
+
**Note:** A step with an empty `marker` slot renders in a compact "sub-step" style.
|
|
289
468
|
|
|
290
469
|
---
|
|
291
470
|
|
|
@@ -301,6 +480,7 @@ Single radio button.
|
|
|
301
480
|
```
|
|
302
481
|
|
|
303
482
|
**Props:** `label`, `name`, `value` (default `"on"`), `checked`, `disabled`, `required`, `readonly`, `error`, `hide-label`, `help-text`, `size`
|
|
483
|
+
**Slots:** `label` (alternative to the `label` attribute)
|
|
304
484
|
**Events:** `change`, `focus`, `blur`
|
|
305
485
|
|
|
306
486
|
---
|
|
@@ -326,7 +506,7 @@ Groups radio buttons with shared legend and validation.
|
|
|
326
506
|
</sds-radio-group>
|
|
327
507
|
```
|
|
328
508
|
|
|
329
|
-
**Props:** `legend`, `disabled` (propagates), `required` (propagates), `readonly` (propagates), `direction` (`"column"` | `"row"`), `error-message`, `help-text`, `size` (propagates)
|
|
509
|
+
**Props:** `legend`, `disabled` (propagates), `required` (propagates), `readonly` (propagates), `direction` (`"column"` | `"row"`, default `"column"`), `error-message`, `help-text`, `size` (propagates)
|
|
330
510
|
**Slots:** default (`sds-radio` children)
|
|
331
511
|
**Events:** `sds-update`
|
|
332
512
|
|
|
@@ -360,15 +540,16 @@ Dropdown select using native `<option>`/`<optgroup>` elements.
|
|
|
360
540
|
</sds-select>
|
|
361
541
|
```
|
|
362
542
|
|
|
363
|
-
**Props:** `label`, `name`, `value` (property only), `default-value` (attribute), `disabled`, `required`, `readonly`, `error-message`, `help-text`, `size`
|
|
364
|
-
**Slots:** default (`<option>` / `<optgroup>` / `<hr>`)
|
|
543
|
+
**Props:** `label`, `name`, `value` (property only — no attribute), `default-value` (attribute), `disabled`, `required`, `readonly`, `error-message`, `help-text`, `size`
|
|
544
|
+
**Slots:** default (`<option>` / `<optgroup>` / `<hr>`), `label` (alternative to the `label` attribute)
|
|
365
545
|
**Events:** `input`, `change`, `focus`, `blur`
|
|
546
|
+
**Note:** Options are projected from light DOM and mirrored into the shadow `<select>`, so adding, removing, or relabelling options at runtime is picked up automatically. `readonly` renders a lock icon next to the label.
|
|
366
547
|
|
|
367
548
|
---
|
|
368
549
|
|
|
369
550
|
## sds-stepper
|
|
370
551
|
|
|
371
|
-
Step indicator for multi-step flows. Contains `sds-stepper-step` children.
|
|
552
|
+
Step indicator for multi-step flows. Contains `sds-stepper-step` children. Gets `aria-label="Steg"` unless you set your own.
|
|
372
553
|
|
|
373
554
|
```html
|
|
374
555
|
<sds-stepper>
|
|
@@ -387,12 +568,13 @@ Step indicator for multi-step flows. Contains `sds-stepper-step` children.
|
|
|
387
568
|
**Props:** `orientation` (`"horizontal"` | `"vertical"`, default `"horizontal"`)
|
|
388
569
|
**Slots:** default (`sds-stepper-step` children)
|
|
389
570
|
**Events:** `change` (detail: `{ index: number }`)
|
|
390
|
-
**Methods:** `getActiveStep()` (returns index or -1), `goToStep(index)`
|
|
571
|
+
**Methods:** `getActiveStep()` (returns index or -1), `goToStep(index)` (out-of-range indices are ignored)
|
|
391
572
|
|
|
392
573
|
### sds-stepper-step
|
|
393
574
|
|
|
394
575
|
**Props:** `complete`, `interactive` (clickable), `active` (current step)
|
|
395
576
|
**Slots:** default (label text)
|
|
577
|
+
**Note:** Step numbers are generated automatically from the child order.
|
|
396
578
|
|
|
397
579
|
---
|
|
398
580
|
|
|
@@ -409,8 +591,9 @@ Toggle switch input.
|
|
|
409
591
|
```
|
|
410
592
|
|
|
411
593
|
**Props:** `label`, `name`, `checked`, `disabled`, `readonly`, `reverse` (flip order), `hide-label`, `size`
|
|
594
|
+
**Slots:** `label` (alternative to the `label` attribute)
|
|
412
595
|
**Events:** `change`, `focus`, `blur`
|
|
413
|
-
**Note:** No `error-message`, `help-text`, or `required`.
|
|
596
|
+
**Note:** No `error-message`, `help-text`, or `required`. The `value` getter returns `"on"` | `"off"`, and `type` reports `"checkbox"`.
|
|
414
597
|
|
|
415
598
|
---
|
|
416
599
|
|
|
@@ -422,11 +605,13 @@ Non-interactive label/badge.
|
|
|
422
605
|
<sds-tag>Default</sds-tag>
|
|
423
606
|
<sds-tag data-palette="success">Approved</sds-tag>
|
|
424
607
|
<sds-tag data-palette="danger">Rejected</sds-tag>
|
|
608
|
+
<sds-tag data-palette="danger-action">Kritisk</sds-tag>
|
|
425
609
|
<sds-tag size="sm">Small</sds-tag>
|
|
426
610
|
```
|
|
427
611
|
|
|
428
|
-
**Props:** `size`
|
|
612
|
+
**Props:** `size`, `data-palette`
|
|
429
613
|
**Slots:** default
|
|
614
|
+
**Note:** In addition to the framework palettes, `sds-tag` accepts `data-palette="danger-action"` — a deep red that is not a general palette value.
|
|
430
615
|
|
|
431
616
|
---
|
|
432
617
|
|
|
@@ -437,10 +622,11 @@ Text container with typography styling. Source: `sds-text.component.ts`.
|
|
|
437
622
|
```html
|
|
438
623
|
<sds-text>Regular body text.</sds-text>
|
|
439
624
|
<sds-text size="lg" strong tall>Large bold text with tall line height.</sds-text>
|
|
625
|
+
<sds-text subtle>De-emphasised text.</sds-text>
|
|
440
626
|
<sds-text data-palette="danger">Red danger text.</sds-text>
|
|
441
627
|
```
|
|
442
628
|
|
|
443
|
-
**Props:** `size` (`"xl"` | `"lg"` | `"md"` | `"sm"` | `"xs"`), `strong` (bold), `tall` (increased line height)
|
|
629
|
+
**Props:** `size` (`"xl"` | `"lg"` | `"md"` | `"sm"` | `"xs"`), `strong` (bold), `subtle` (de-emphasised colour), `tall` (increased line height)
|
|
444
630
|
**Slots:** default
|
|
445
631
|
|
|
446
632
|
---
|
|
@@ -454,9 +640,11 @@ Multi-line text input.
|
|
|
454
640
|
<sds-textarea label="Comments" name="comments" required error-message="Required"></sds-textarea>
|
|
455
641
|
<sds-textarea label="Bio" name="bio" counter="500"></sds-textarea>
|
|
456
642
|
<sds-textarea label="Address" name="address" rows="4" wrap="soft"></sds-textarea>
|
|
643
|
+
<sds-textarea label="Notes" name="notes" autosize></sds-textarea>
|
|
457
644
|
```
|
|
458
645
|
|
|
459
|
-
**Props:** `label`, `name`, `value`, `placeholder`, `disabled`, `readonly`, `required`, `rows`, `cols`, `wrap` (`"hard"` | `"soft"`), `minlength`, `maxlength`, `counter` (shows character count), `autocomplete`, `help-text`, `error-message`, `size`
|
|
646
|
+
**Props:** `label`, `name`, `value`, `placeholder`, `disabled`, `readonly`, `required`, `rows`, `cols`, `wrap` (`"hard"` | `"soft"`), `minlength`, `maxlength`, `counter` (shows character count), `autosize` (grows with content), `autocomplete`, `help-text`, `error-message`, `size`
|
|
647
|
+
**Slots:** `label` (alternative to the `label` attribute)
|
|
460
648
|
**Events:** `input`, `change`, `select`, `focus`, `blur`
|
|
461
649
|
|
|
462
650
|
---
|
|
@@ -469,6 +657,7 @@ Single-line text input.
|
|
|
469
657
|
<sds-textfield label="Email" name="email" type="email" placeholder="you@example.com"></sds-textfield>
|
|
470
658
|
<sds-textfield label="Username" name="username" required help-text="3-20 characters" minlength="3" maxlength="20"></sds-textfield>
|
|
471
659
|
<sds-textfield label="Phone" name="phone" type="tel" error-message="Invalid phone"></sds-textfield>
|
|
660
|
+
<sds-textfield label="Amount" name="amount" type="number" min="0" max="100"></sds-textfield>
|
|
472
661
|
<sds-textfield label="Search" name="search" type="search">
|
|
473
662
|
<sds-icon name="search-material-filled" slot="after"></sds-icon>
|
|
474
663
|
</sds-textfield>
|
|
@@ -476,6 +665,29 @@ Single-line text input.
|
|
|
476
665
|
<sds-textfield label="ID" name="id" value="12345" readonly></sds-textfield>
|
|
477
666
|
```
|
|
478
667
|
|
|
479
|
-
**Props:** `label`, `name`, `value`, `type` (HTML input types), `placeholder`, `disabled`, `readonly`, `required`, `autocomplete`, `pattern`, `minlength`, `maxlength`, `help-text`, `error-message`, `size`
|
|
480
|
-
**Slots:** `after` (e.g., icon)
|
|
668
|
+
**Props:** `label`, `name`, `value`, `type` (HTML input types), `placeholder`, `disabled`, `readonly`, `required`, `autocomplete`, `pattern`, `minlength`, `maxlength`, `min`, `max`, `help-text`, `error-message`, `size`
|
|
669
|
+
**Slots:** `after` (e.g., icon), `label` (alternative to the `label` attribute)
|
|
481
670
|
**Events:** `input`, `change`, `select`, `focus`, `blur`, `keydown`
|
|
671
|
+
**Note:** When both `error-message` and `help-text` are set, `aria-describedby` lists the error first, then the help text. `readonly` renders a lock icon next to the label.
|
|
672
|
+
|
|
673
|
+
---
|
|
674
|
+
|
|
675
|
+
## sds-tooltip
|
|
676
|
+
|
|
677
|
+
Hover/focus tooltip. The tooltip is a sibling of its trigger, and the trigger points at it with `aria-describedby` — the tooltip itself is `aria-hidden`, and its text is mirrored onto the trigger for screen readers.
|
|
678
|
+
|
|
679
|
+
```html
|
|
680
|
+
<span style="position: relative; display: inline-block;">
|
|
681
|
+
<sds-button aria-describedby="orgnr-tip" variant="secondary" icon label="Om org.nr">
|
|
682
|
+
<sds-icon name="info-material-outlined"></sds-icon>
|
|
683
|
+
</sds-button>
|
|
684
|
+
<sds-tooltip id="orgnr-tip">Organisasjonsnummer</sds-tooltip>
|
|
685
|
+
</span>
|
|
686
|
+
|
|
687
|
+
<sds-tooltip id="tip-right" placement="right">Vises til høyre</sds-tooltip>
|
|
688
|
+
```
|
|
689
|
+
|
|
690
|
+
**Props:** `id` (**required** — the value the trigger's `aria-describedby` references), `placement` (`"top"` | `"bottom"` | `"left"` | `"right"`, each also with `-start` / `-end`, or `"none"`; default `"top"`)
|
|
691
|
+
**Slots:** default (tooltip text — keep it to plain text)
|
|
692
|
+
**Events:** `toggle` (detail: the trigger element that opened it)
|
|
693
|
+
**Notes:** Sets `role="tooltip"` and `popover="manual"` on itself. Multiple triggers may reference the same tooltip. Give the trigger and tooltip a `position: relative` wrapper. `data-palette` has no effect — tooltip colours are fixed.
|
|
@@ -3,10 +3,12 @@
|
|
|
3
3
|
React 18 does not natively support web component events. Use these wrappers instead of bare web components.
|
|
4
4
|
Import components from `@politiet/sheriff-web-components/react-wrappers`.
|
|
5
5
|
|
|
6
|
-
React 19+ supports custom elements natively
|
|
6
|
+
React 19+ supports custom elements natively and may use web components directly without wrappers. For typed custom elements without wrappers, reference `@politiet/sheriff-web-components/framework/react`.
|
|
7
7
|
|
|
8
8
|
## Available Wrappers
|
|
9
9
|
|
|
10
|
+
All 29 components have a wrapper:
|
|
11
|
+
|
|
10
12
|
```tsx
|
|
11
13
|
import {
|
|
12
14
|
SDSAlertWrapper,
|
|
@@ -16,11 +18,17 @@ import {
|
|
|
16
18
|
SDSCheckboxGroupWrapper,
|
|
17
19
|
SDSChipWrapper,
|
|
18
20
|
SDSDetailsWrapper,
|
|
21
|
+
SDSDetailsGroupWrapper,
|
|
19
22
|
SDSDialogWrapper,
|
|
23
|
+
SDSEnvironmentBannerWrapper,
|
|
20
24
|
SDSHeadingWrapper,
|
|
21
25
|
SDSIconWrapper,
|
|
26
|
+
SDSInternalHeaderWrapper,
|
|
22
27
|
SDSLoaderWrapper,
|
|
23
28
|
SDSNotificationWrapper,
|
|
29
|
+
SDSPopoverWrapper,
|
|
30
|
+
SDSProcessWrapper,
|
|
31
|
+
SDSProcessStepWrapper,
|
|
24
32
|
SDSRadioWrapper,
|
|
25
33
|
SDSRadioGroupWrapper,
|
|
26
34
|
SDSSelectWrapper,
|
|
@@ -31,6 +39,7 @@ import {
|
|
|
31
39
|
SDSTextWrapper,
|
|
32
40
|
SDSTextAreaWrapper,
|
|
33
41
|
SDSTextFieldWrapper,
|
|
42
|
+
SDSTooltipWrapper,
|
|
34
43
|
} from '@politiet/sheriff-web-components/react-wrappers';
|
|
35
44
|
```
|
|
36
45
|
|
|
@@ -54,13 +63,29 @@ function MyForm() {
|
|
|
54
63
|
}
|
|
55
64
|
```
|
|
56
65
|
|
|
57
|
-
## Event Mapping
|
|
66
|
+
## Event Mapping
|
|
67
|
+
|
|
68
|
+
Handler names follow React idioms and **drop the `sds-` prefix** — the DOM event `sds-remove` becomes `onRemove`, not `onSdsRemove`.
|
|
69
|
+
|
|
70
|
+
| Wrapper | React prop | DOM event |
|
|
71
|
+
| ------------------------------------------------- | ------------------------------------------------------------------- | ---------------------------------------------------------- |
|
|
72
|
+
| `SDSAlertWrapper`, `SDSNotificationWrapper` | `onRemove` | `sds-remove` |
|
|
73
|
+
| `SDSButtonWrapper` | `onClick`, `onSubmit`, `onReset` | `click`, `submit`, `reset` |
|
|
74
|
+
| `SDSCheckboxWrapper`, `SDSRadioWrapper` | `onChange`, `onFocus`, `onBlur` | `change`, `focus`, `blur` |
|
|
75
|
+
| `SDSCheckboxGroupWrapper`, `SDSRadioGroupWrapper` | `onUpdate`, `onChange` | `sds-update`, `change` |
|
|
76
|
+
| `SDSChipWrapper` | `onChange`, `onRemove` | `change`, `sds-remove` |
|
|
77
|
+
| `SDSDetailsWrapper`, `SDSTooltipWrapper` | `onToggle` | `toggle` |
|
|
78
|
+
| `SDSPopoverWrapper` | `onToggle` | `toggle` (native `ToggleEvent`) |
|
|
79
|
+
| `SDSDialogWrapper` | `onClose` | `close` |
|
|
80
|
+
| `SDSSelectWrapper`, `SDSSwitchWrapper` | `onChange`, `onFocus`, `onBlur` | `change`, `focus`, `blur` |
|
|
81
|
+
| `SDSStepperWrapper` | `onChange` | `change` (detail `{ index }`) |
|
|
82
|
+
| `SDSTextFieldWrapper` | `onInput`, `onChange`, `onSelect`, `onFocus`, `onBlur`, `onKeyDown` | `input`, **`input`**, `select`, `focus`, `blur`, `keydown` |
|
|
83
|
+
| `SDSTextAreaWrapper` | `onInput`, `onChange`, `onSelect`, `onFocus`, `onBlur` | `input`, **`input`**, `select`, `focus`, `blur` |
|
|
84
|
+
|
|
85
|
+
Wrappers with no event mappings (presentational only): `SDSCardWrapper`, `SDSDetailsGroupWrapper`, `SDSEnvironmentBannerWrapper`, `SDSHeadingWrapper`, `SDSIconWrapper`, `SDSInternalHeaderWrapper`, `SDSLoaderWrapper`, `SDSProcessWrapper`, `SDSProcessStepWrapper`, `SDSStepperStepWrapper`, `SDSTagWrapper`, `SDSTextWrapper`.
|
|
58
86
|
|
|
59
|
-
|
|
87
|
+
## Gotchas
|
|
60
88
|
|
|
61
|
-
-
|
|
62
|
-
- `
|
|
63
|
-
- `
|
|
64
|
-
- `SDSDetailsWrapper`: `onSdsToggle` → `sds-toggle`
|
|
65
|
-
- `SDSDialogWrapper`: `onClose` → `close`
|
|
66
|
-
- `SDSCheckboxGroupWrapper` / `SDSRadioGroupWrapper`: `onSdsUpdate` → `sds-update`
|
|
89
|
+
- On `SDSTextFieldWrapper` and `SDSTextAreaWrapper`, **`onChange` is wired to the `input` event**, so it fires on every keystroke like React's own `onChange` — not on blur like the native DOM `change` event. Use `onBlur` if you need commit-on-blur semantics.
|
|
90
|
+
- `onKeyDown` (capital D) is the correct casing on `SDSTextFieldWrapper`; there is no `onKeydown`.
|
|
91
|
+
- Wrappers forward all other props straight through as attributes, so kebab-case component attributes (`help-text`, `error-message`, `removable-label`, `app-name`) keep their kebab-case names in JSX.
|
package/dist/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const SDS_VERSION = "2.13.
|
|
1
|
+
export declare const SDS_VERSION = "2.13.1";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/dist/version.js
CHANGED
package/dist/version.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA,gEAAgE;AAChE,MAAM,CAAC,MAAM,WAAW,GAAG,QAAQ,CAAC","sourcesContent":["// Auto-generated by generate-version.cjs — do not edit manually\nexport const SDS_VERSION = '2.13.
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA,gEAAgE;AAChE,MAAM,CAAC,MAAM,WAAW,GAAG,QAAQ,CAAC","sourcesContent":["// Auto-generated by generate-version.cjs — do not edit manually\nexport const SDS_VERSION = '2.13.1';\n"]}
|