@smudi/designsystem 1.5.2 → 2.0.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/@smudi/components/button/button.d.ts +19 -1
- package/@smudi/components/button/button.d.ts.map +1 -1
- package/@smudi/components/button/button.js +16 -15
- package/@smudi/components/card/card-icon-block.d.ts +18 -0
- package/@smudi/components/card/card-icon-block.d.ts.map +1 -1
- package/@smudi/components/card/card.d.ts +13 -0
- package/@smudi/components/card/card.d.ts.map +1 -1
- package/@smudi/components/dialog/dialog.d.ts +12 -0
- package/@smudi/components/dialog/dialog.d.ts.map +1 -1
- package/@smudi/components/dropdown/dropdown-button.d.ts +15 -6
- package/@smudi/components/dropdown/dropdown-button.d.ts.map +1 -1
- package/@smudi/components/dropdown/dropdown-item.d.ts +11 -1
- package/@smudi/components/dropdown/dropdown-item.d.ts.map +1 -1
- package/@smudi/components/dropdown/dropdown-list.d.ts +11 -1
- package/@smudi/components/dropdown/dropdown-list.d.ts.map +1 -1
- package/@smudi/components/dropdown/dropdown.d.ts +16 -1
- package/@smudi/components/dropdown/dropdown.d.ts.map +1 -1
- package/@smudi/components/file-upload/file-upload.d.ts +6 -0
- package/@smudi/components/file-upload/file-upload.d.ts.map +1 -0
- package/@smudi/components/file-upload/file-upload.js +7 -0
- package/@smudi/components/header/header-content.d.ts +11 -0
- package/@smudi/components/header/header-content.d.ts.map +1 -1
- package/@smudi/components/header/header-divider.d.ts +14 -0
- package/@smudi/components/header/header-divider.d.ts.map +1 -1
- package/@smudi/components/header/header-menu/header-menu-button.d.ts +9 -0
- package/@smudi/components/header/header-menu/header-menu-button.d.ts.map +1 -1
- package/@smudi/components/header/header-menu/header-menu-content.d.ts +13 -0
- package/@smudi/components/header/header-menu/header-menu-content.d.ts.map +1 -1
- package/@smudi/components/header/header-menu/header-menu-group.d.ts +10 -0
- package/@smudi/components/header/header-menu/header-menu-group.d.ts.map +1 -1
- package/@smudi/components/header/header-menu/header-menu-item.d.ts +16 -0
- package/@smudi/components/header/header-menu/header-menu-item.d.ts.map +1 -1
- package/@smudi/components/header/header-menu/header-menu.d.ts +15 -0
- package/@smudi/components/header/header-menu/header-menu.d.ts.map +1 -1
- package/@smudi/components/header/header-search/header-search-button.d.ts +17 -0
- package/@smudi/components/header/header-search/header-search-button.d.ts.map +1 -1
- package/@smudi/components/header/header-search/header-search.d.ts +18 -0
- package/@smudi/components/header/header-search/header-search.d.ts.map +1 -1
- package/@smudi/components/header/header.d.ts +65 -23
- package/@smudi/components/header/header.d.ts.map +1 -1
- package/@smudi/components/layout-components/cluster-layouts/cluster-layout.module.css.js +1 -1
- package/@smudi/components/layout-components/split-view/index.d.ts +8 -0
- package/@smudi/components/layout-components/split-view/index.d.ts.map +1 -0
- package/@smudi/components/layout-components/split-view/index.js +10 -0
- package/@smudi/components/layout-components/split-view/split-view-divider.d.ts +8 -0
- package/@smudi/components/layout-components/split-view/split-view-divider.d.ts.map +1 -0
- package/@smudi/components/layout-components/split-view/split-view-divider.js +44 -0
- package/@smudi/components/layout-components/split-view/split-view-divider.module.css.js +9 -0
- package/@smudi/components/layout-components/split-view/split-view-panel.d.ts +23 -0
- package/@smudi/components/layout-components/split-view/split-view-panel.d.ts.map +1 -0
- package/@smudi/components/layout-components/split-view/split-view-panel.js +8 -0
- package/@smudi/components/layout-components/split-view/split-view.d.ts +14 -0
- package/@smudi/components/layout-components/split-view/split-view.d.ts.map +1 -0
- package/@smudi/components/layout-components/split-view/split-view.js +67 -0
- package/@smudi/components/layout-components/split-view/split-view.module.css.js +8 -0
- package/@smudi/components/layout-components/split-view/use-resize.d.ts +34 -0
- package/@smudi/components/layout-components/split-view/use-resize.d.ts.map +1 -0
- package/@smudi/components/layout-components/split-view/use-resize.js +67 -0
- package/@smudi/components/select/select.d.ts +7 -0
- package/@smudi/components/select/select.d.ts.map +1 -1
- package/@smudi/components/select/select.js +13 -6
- package/@smudi/components/suggestion/smudi-suggestion/smudi-suggestion-list.d.ts +4 -0
- package/@smudi/components/suggestion/smudi-suggestion/smudi-suggestion-list.d.ts.map +1 -1
- package/@smudi/components/suggestion/smudi-suggestion/smudi-suggestion.d.ts +17 -0
- package/@smudi/components/suggestion/smudi-suggestion/smudi-suggestion.d.ts.map +1 -1
- package/@smudi/components/suggestion/smudi-suggestion/smudi-suggestion.js +43 -82
- package/@smudi/components/suggestion/suggestion-no-chips/suggestion-no-chips.d.ts +10 -0
- package/@smudi/components/suggestion/suggestion-no-chips/suggestion-no-chips.d.ts.map +1 -1
- package/@smudi/components/suggestion/suggestion-no-chips/suggestion-no-chips.js +44 -33
- package/@smudi/components/suggestion/suggestion.d.ts +1 -0
- package/@smudi/components/suggestion/suggestion.d.ts.map +1 -1
- package/@smudi/components/table/table.d.ts +25 -3
- package/@smudi/components/table/table.d.ts.map +1 -1
- package/@smudi/components/table/table.js +21 -3
- package/@smudi/components/toast/toast.d.ts +45 -0
- package/@smudi/components/toast/toast.d.ts.map +1 -1
- package/@smudi/components/toast/toast.js +144 -141
- package/@smudi/icons/generated/index.js +11 -0
- package/@smudi/react.js +94 -94
- package/@smudi/smudi/icons/metadata.d.ts +9 -9
- package/@smudi/smudi/react.d.ts +3 -2
- package/@smudi/smudi/react.d.ts.map +1 -1
- package/@smudi/styles.css +1 -1
- package/@smudi/types/modular-scale.type.d.ts +1 -1
- package/README.md +33 -0
- package/package.json +11 -10
- package/@smudi/components/stepper/index.js +0 -17
- package/@smudi/components/stepper/step/step-list.js +0 -40
- package/@smudi/components/stepper/step/step-list.module.css.js +0 -7
- package/@smudi/components/stepper/step/step.js +0 -86
- package/@smudi/components/stepper/step/step.module.css.js +0 -10
- package/@smudi/components/stepper/step-content/step-content-list.js +0 -25
- package/@smudi/components/stepper/step-content/step-content-list.module.css.js +0 -7
- package/@smudi/components/stepper/step-content/step-content.js +0 -28
- package/@smudi/components/stepper/step-content/step-content.module.css.js +0 -7
- package/@smudi/components/stepper/stepper-context.js +0 -23
- package/@smudi/components/stepper/stepper.js +0 -62
- package/@smudi/components/stepper/stepper.module.css.js +0 -7
- package/@smudi/components/stepper/use-stepper-state.js +0 -17
|
@@ -10,7 +10,7 @@ import { CoerceStringToNumber } from './utils/coerce-string-to-number';
|
|
|
10
10
|
* (see `package.json` `files`), and referencing it from here would break
|
|
11
11
|
* type resolution for consumers installing `@smudi/designsystem`.
|
|
12
12
|
*
|
|
13
|
-
* For
|
|
13
|
+
* For more info on what a modular scale is: https://every-layout.dev/rudiments/modular-scale/
|
|
14
14
|
*/
|
|
15
15
|
type ModularScaleStep = "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | "10" | "11" | "12" | "13" | "14" | "15" | "18" | "22" | "26" | "30";
|
|
16
16
|
export type ModularScaleValue = ModularScaleStep | CoerceStringToNumber<ModularScaleStep>;
|
package/README.md
CHANGED
|
@@ -78,6 +78,39 @@ Vi er i tidlig fase av release av Smudi og vil gjerne ha dine tilbakemeldinger!
|
|
|
78
78
|
- @digdir/designsystemet-types og @digdir/designsystemet-react - grunnlaget for visuelle komponenter og typer
|
|
79
79
|
- Vitest + Playwright - for testing
|
|
80
80
|
|
|
81
|
+
## Unit testing
|
|
82
|
+
|
|
83
|
+
Repoet bruker Vitest med to separate prosjekter, definert i [vitest.config.js](vitest.config.js):
|
|
84
|
+
|
|
85
|
+
- **unit** – enhets-/integrasjonstester i filer som følger mønsteret `*.test.ts`/`*.test.tsx` (f.eks. [utils/append-class-name.test.ts](utils/append-class-name.test.ts)).
|
|
86
|
+
|
|
87
|
+
CI ("CI - Build & Deploy Storybook") kjører `pnpm test` (unit-testene) og deretter en Storybook-build (`pnpm run build-storybook`) automatisk på hver pull request mot `dev`/`main`, samt ved push til `dev`/`main`. Feiler `pnpm test`, stopper workflowen før Storybook bygges. Storybook-testene (`pnpm test:storybook`) kjøres foreløpig ikke automatisk i CI, så husk å kjøre disse lokalt ved behov før du åpner PR.
|
|
88
|
+
|
|
89
|
+
## Teste pakken før publisering
|
|
90
|
+
|
|
91
|
+
Vi har en egen Next test-app i prosjektet, hvor du i page.tsx kan teste komponentene. Kjør med pnpm run dev.
|
|
92
|
+
Test gjerne pakken i en ekstern test-app og/eller be et annet team teste pakken slik:
|
|
93
|
+
|
|
94
|
+
1. Vær i main-branch etter du er ferdig med å merge all ny funksjonalitet
|
|
95
|
+
2. pnpm build - bygg build-output mappen
|
|
96
|
+
3. pnpm pack - pakker buildmappen til en .zip-fil.
|
|
97
|
+
4. Enten i din lokale test-app eller hos en konsument, legg filen inn i prosjektet
|
|
98
|
+
5. I package.json, oppdater filpath: "@smudi/designsystem": "PATH-TIL-ZIP"
|
|
99
|
+
6. Importer komponenter o.l. som normalt fra "@smudi/designsystem"
|
|
100
|
+
|
|
101
|
+
## Publisering (prodsetting)
|
|
102
|
+
|
|
103
|
+
Smudi publiseres som en offentlig pakke til npm under `@smudi/designsystem`. Publisering skjer ikke automatisk ved push/merge- den trigges manuelt av Smudi-teamet:
|
|
104
|
+
|
|
105
|
+
1. Sett ny versjon i `package.json` manuelt, i tråd med semver (`fix` → PATCH, `feat` → MINOR, `BREAKING CHANGE` → MAJOR).
|
|
106
|
+
2. Merge endringene inn i `main`.
|
|
107
|
+
3. Trigg workflowen **"Publish to npm"** ([.github/workflows/publish-npm.yml](.github/workflows/publish-npm.yml)) manuelt fra Actions-fanen på GitHub (`workflow_dispatch`).
|
|
108
|
+
4. Workflowen installerer avhengigheter, kjører `pnpm run build` (som først kjører `tsc --noEmit`, deretter `vite build`) og publiserer resultatet med `npm publish --access public` mot det offentlige npm-registeret.
|
|
109
|
+
|
|
110
|
+
Storybook-dokumentasjonen (denne finner du på [smudi.udi.no](https://smudi.udi.no/)) er en egen, uavhengig prosess: den bygges og deployes automatisk til Azure Web App via workflowen **"CI - Build & Deploy Storybook"** ved push til `dev` (dev-miljø) og `main` (prod-miljø) – dette skjer altså uavhengig av npm-publisering.
|
|
111
|
+
|
|
112
|
+
Se [DEVELOPMENT.md](.github/DEVELOPMENT.md) for mer om lokalt utviklingsoppsett og branching/commit-konvensjoner.
|
|
113
|
+
|
|
81
114
|
## Ønsker du å bidra til Designsystemet?
|
|
82
115
|
|
|
83
116
|
- Ta kontakt med Smudi-teamet på teams :-)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@smudi/designsystem",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"packageManager": "pnpm@10.17.1",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
}
|
|
29
29
|
},
|
|
30
30
|
"scripts": {
|
|
31
|
-
"prepare": "husky
|
|
31
|
+
"prepare": "husky ./husky",
|
|
32
32
|
"test": "vitest run --project unit",
|
|
33
33
|
"test:watch": "vitest --project unit --watch",
|
|
34
34
|
"test:ui": "vitest --ui --project unit",
|
|
@@ -44,12 +44,12 @@
|
|
|
44
44
|
"icons:generate": "svgr --config-file .svgrrc.json --out-dir ./smudi/icons/generated ./smudi/icons/svg"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@digdir/designsystemet-react": "1.
|
|
48
|
-
"@digdir/designsystemet-types": "1.
|
|
47
|
+
"@digdir/designsystemet-react": "1.20.0",
|
|
48
|
+
"@digdir/designsystemet-types": "1.20.0"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@chromatic-com/storybook": "5.0.1",
|
|
52
|
-
"@digdir/designsystemet-css": "1.
|
|
52
|
+
"@digdir/designsystemet-css": "1.20.0",
|
|
53
53
|
"@navikt/aksel-icons": "7.38.0",
|
|
54
54
|
"@storybook/addon-a11y": "10.2.10",
|
|
55
55
|
"@storybook/addon-docs": "10.2.10",
|
|
@@ -58,9 +58,10 @@
|
|
|
58
58
|
"@svgr/cli": "8.1.0",
|
|
59
59
|
"@types/react": "19.2.2",
|
|
60
60
|
"@types/react-dom": "19.2.2",
|
|
61
|
-
"@
|
|
62
|
-
"@vitest/
|
|
63
|
-
"@vitest/
|
|
61
|
+
"@types/node": "22.20.1",
|
|
62
|
+
"@vitest/browser": "3.2.7",
|
|
63
|
+
"@vitest/coverage-v8": "3.2.7",
|
|
64
|
+
"@vitest/ui": "3.2.7",
|
|
64
65
|
"jsdom": "29.1.1",
|
|
65
66
|
"husky": "9.1.7",
|
|
66
67
|
"playwright": "1.56.1",
|
|
@@ -69,9 +70,9 @@
|
|
|
69
70
|
"react-dom": "19.2.1",
|
|
70
71
|
"storybook": "10.2.10",
|
|
71
72
|
"typescript": "5.9.3",
|
|
72
|
-
"vite": "7.3.
|
|
73
|
+
"vite": "7.3.6",
|
|
73
74
|
"vite-plugin-dts": "4.5.4",
|
|
74
|
-
"vitest": "3.2.
|
|
75
|
+
"vitest": "3.2.7"
|
|
75
76
|
},
|
|
76
77
|
"peerDependencies": {
|
|
77
78
|
"react": ">=18",
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { StepContent as t } from "./step-content/step-content.js";
|
|
3
|
-
import { StepContentList as e } from "./step-content/step-content-list.js";
|
|
4
|
-
import { Step as p } from "./step/step.js";
|
|
5
|
-
import { StepList as o } from "./step/step-list.js";
|
|
6
|
-
import { Stepper as r } from "./stepper.js";
|
|
7
|
-
import "react";
|
|
8
|
-
const a = Object.assign(r, {
|
|
9
|
-
displayName: "Stepper",
|
|
10
|
-
Step: p,
|
|
11
|
-
StepList: o,
|
|
12
|
-
Content: t,
|
|
13
|
-
ContentList: e
|
|
14
|
-
});
|
|
15
|
-
export {
|
|
16
|
-
a as Stepper
|
|
17
|
-
};
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsx as a } from "react/jsx-runtime";
|
|
3
|
-
import { forwardRef as y, Children as w, isValidElement as A } from "react";
|
|
4
|
-
import { useStepper as h, StepOrderContext as E, STEP_TRIGGER_ATTR as S } from "../stepper-context.js";
|
|
5
|
-
import v from "./step-list.module.css.js";
|
|
6
|
-
import { classNames as x } from "../../utils/class-names.js";
|
|
7
|
-
const H = y(function({ children: i, className: f, onKeyDown: c, ...m }, u) {
|
|
8
|
-
const { orientation: n } = h();
|
|
9
|
-
function d(e) {
|
|
10
|
-
if (c?.(e), e.defaultPrevented) return;
|
|
11
|
-
const l = n === "vertical" ? "ArrowDown" : "ArrowRight", g = n === "vertical" ? "ArrowUp" : "ArrowLeft", { key: t } = e;
|
|
12
|
-
if (t !== l && t !== g && t !== "Home" && t !== "End")
|
|
13
|
-
return;
|
|
14
|
-
const r = Array.from(
|
|
15
|
-
e.currentTarget.querySelectorAll(
|
|
16
|
-
`[${S}]`
|
|
17
|
-
)
|
|
18
|
-
);
|
|
19
|
-
if (r.length === 0) return;
|
|
20
|
-
e.preventDefault();
|
|
21
|
-
const s = r.indexOf(document.activeElement);
|
|
22
|
-
let o;
|
|
23
|
-
t === "Home" ? o = 0 : t === "End" ? o = r.length - 1 : o = ((s === -1 ? 0 : s) + (t === l ? 1 : -1) + r.length) % r.length, r[o]?.focus();
|
|
24
|
-
}
|
|
25
|
-
const p = w.toArray(i).filter(A).map((e) => e.props.value).filter((e) => typeof e == "string");
|
|
26
|
-
return /* @__PURE__ */ a(
|
|
27
|
-
"ol",
|
|
28
|
-
{
|
|
29
|
-
...m,
|
|
30
|
-
ref: u,
|
|
31
|
-
"data-orientation": n,
|
|
32
|
-
onKeyDown: d,
|
|
33
|
-
className: x(v["smudi-list"], f),
|
|
34
|
-
children: /* @__PURE__ */ a(E.Provider, { value: p, children: i })
|
|
35
|
-
}
|
|
36
|
-
);
|
|
37
|
-
});
|
|
38
|
-
export {
|
|
39
|
-
H as StepList
|
|
40
|
-
};
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsx as n, jsxs as a } from "react/jsx-runtime";
|
|
3
|
-
import { ExclamationmarkTriangleIcon as j, XMarkIcon as w, CheckmarkIcon as G } from "@navikt/aksel-icons";
|
|
4
|
-
import { forwardRef as L } from "react";
|
|
5
|
-
import { useStepper as P, useStepOrder as M, stepId as U, STEP_TRIGGER_ATTR as V } from "../stepper-context.js";
|
|
6
|
-
import r from "./step.module.css.js";
|
|
7
|
-
import { classNames as X } from "../../utils/class-names.js";
|
|
8
|
-
const q = {
|
|
9
|
-
completed: /* @__PURE__ */ n(G, {}),
|
|
10
|
-
error: /* @__PURE__ */ n(w, {}),
|
|
11
|
-
warning: /* @__PURE__ */ n(j, {})
|
|
12
|
-
};
|
|
13
|
-
function z({
|
|
14
|
-
value: e,
|
|
15
|
-
children: g,
|
|
16
|
-
status: t,
|
|
17
|
-
icon: h,
|
|
18
|
-
as: I,
|
|
19
|
-
className: N,
|
|
20
|
-
onClick: S,
|
|
21
|
-
...k
|
|
22
|
-
}, x) {
|
|
23
|
-
const {
|
|
24
|
-
value: d,
|
|
25
|
-
onChange: T,
|
|
26
|
-
baseId: v,
|
|
27
|
-
orientation: y,
|
|
28
|
-
statusLabels: C,
|
|
29
|
-
variant: l,
|
|
30
|
-
lockedLabel: O
|
|
31
|
-
} = P(), s = M(), i = d === e, m = l !== "readonly", o = s.indexOf(d), p = l === "linear" && o !== -1 && s.indexOf(e) > o, c = m && !p, u = m && p, b = c ? I ?? "button" : "span", R = i || o === -1 && s[0] === e ? 0 : -1, A = c ? {
|
|
32
|
-
// Roving tabindex: only the current step is tabbable; arrow keys
|
|
33
|
-
// move focus between steps (handled by StepList).
|
|
34
|
-
[V]: "",
|
|
35
|
-
tabIndex: R,
|
|
36
|
-
onClick: E
|
|
37
|
-
} : {};
|
|
38
|
-
function E(_) {
|
|
39
|
-
T?.(e), S?.(_);
|
|
40
|
-
}
|
|
41
|
-
return /* @__PURE__ */ n(
|
|
42
|
-
"li",
|
|
43
|
-
{
|
|
44
|
-
"data-orientation": y,
|
|
45
|
-
"data-status": t,
|
|
46
|
-
"data-selected": i || void 0,
|
|
47
|
-
"data-navigable": c || void 0,
|
|
48
|
-
className: X(r["smudi-step"], N),
|
|
49
|
-
children: /* @__PURE__ */ a(
|
|
50
|
-
b,
|
|
51
|
-
{
|
|
52
|
-
...k,
|
|
53
|
-
ref: x,
|
|
54
|
-
id: U(v, e),
|
|
55
|
-
className: r["smudi-trigger"],
|
|
56
|
-
"aria-current": i ? "step" : void 0,
|
|
57
|
-
"aria-disabled": u ? !0 : void 0,
|
|
58
|
-
...A,
|
|
59
|
-
...b === "button" ? { type: "button" } : {},
|
|
60
|
-
children: [
|
|
61
|
-
/* @__PURE__ */ n("span", { className: r["smudi-step-indicator"], "aria-hidden": "true", children: h ?? q[t] }),
|
|
62
|
-
/* @__PURE__ */ a("span", { className: r["smudi-step-label"], children: [
|
|
63
|
-
g,
|
|
64
|
-
t && /* @__PURE__ */ a("span", { className: "ds-sr-only", children: [
|
|
65
|
-
"- ",
|
|
66
|
-
C[t]
|
|
67
|
-
] }),
|
|
68
|
-
u && /* @__PURE__ */ a("span", { className: "ds-sr-only", children: [
|
|
69
|
-
" - ",
|
|
70
|
-
O
|
|
71
|
-
] })
|
|
72
|
-
] })
|
|
73
|
-
]
|
|
74
|
-
}
|
|
75
|
-
)
|
|
76
|
-
}
|
|
77
|
-
);
|
|
78
|
-
}
|
|
79
|
-
const f = L(
|
|
80
|
-
z
|
|
81
|
-
);
|
|
82
|
-
f.displayName = "Step";
|
|
83
|
-
const Q = f;
|
|
84
|
-
export {
|
|
85
|
-
Q as Step
|
|
86
|
-
};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsx as n } from "react/jsx-runtime";
|
|
3
|
-
import { forwardRef as s } from "react";
|
|
4
|
-
import { useStepper as m } from "../stepper-context.js";
|
|
5
|
-
import a from "./step-content-list.module.css.js";
|
|
6
|
-
import { classNames as p } from "../../utils/class-names.js";
|
|
7
|
-
const v = s(
|
|
8
|
-
function({ children: t, className: o, ...e }, i) {
|
|
9
|
-
const { orientation: r } = m();
|
|
10
|
-
return /* @__PURE__ */ n(
|
|
11
|
-
"div",
|
|
12
|
-
{
|
|
13
|
-
ref: i,
|
|
14
|
-
"aria-live": "polite",
|
|
15
|
-
"data-orientation": r,
|
|
16
|
-
className: p(a["smudi-content-list"], o),
|
|
17
|
-
...e,
|
|
18
|
-
children: t
|
|
19
|
-
}
|
|
20
|
-
);
|
|
21
|
-
}
|
|
22
|
-
);
|
|
23
|
-
export {
|
|
24
|
-
v as StepContentList
|
|
25
|
-
};
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsx as m } from "react/jsx-runtime";
|
|
3
|
-
import { forwardRef as a } from "react";
|
|
4
|
-
import { useStepper as d, stepId as c, panelId as l } from "../stepper-context.js";
|
|
5
|
-
import f from "./step-content.module.css.js";
|
|
6
|
-
import { classNames as u } from "../../utils/class-names.js";
|
|
7
|
-
const C = a(
|
|
8
|
-
function({ value: e, children: o, className: r, ...s }, n) {
|
|
9
|
-
const { value: i, baseId: t } = d(), p = i === e;
|
|
10
|
-
return /* @__PURE__ */ m(
|
|
11
|
-
"div",
|
|
12
|
-
{
|
|
13
|
-
...s,
|
|
14
|
-
ref: n,
|
|
15
|
-
id: l(t, e),
|
|
16
|
-
role: "group",
|
|
17
|
-
"aria-labelledby": c(t, e),
|
|
18
|
-
tabIndex: -1,
|
|
19
|
-
hidden: !p,
|
|
20
|
-
className: u(f["smudi-step-content"], r),
|
|
21
|
-
children: o
|
|
22
|
-
}
|
|
23
|
-
);
|
|
24
|
-
}
|
|
25
|
-
);
|
|
26
|
-
export {
|
|
27
|
-
C as StepContent
|
|
28
|
-
};
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { createContext as n, useContext as r } from "react";
|
|
3
|
-
const o = n(null);
|
|
4
|
-
function u() {
|
|
5
|
-
const t = r(o);
|
|
6
|
-
if (!t)
|
|
7
|
-
throw new Error("useStepper must be used within a <Stepper>");
|
|
8
|
-
return t;
|
|
9
|
-
}
|
|
10
|
-
const p = n([]);
|
|
11
|
-
function c() {
|
|
12
|
-
return r(p);
|
|
13
|
-
}
|
|
14
|
-
const i = (t, e) => `${t}-step-${e}`, S = (t, e) => `${t}-panel-${e}`, a = "data-step-trigger";
|
|
15
|
-
export {
|
|
16
|
-
a as STEP_TRIGGER_ATTR,
|
|
17
|
-
p as StepOrderContext,
|
|
18
|
-
o as StepperContext,
|
|
19
|
-
S as panelId,
|
|
20
|
-
i as stepId,
|
|
21
|
-
c as useStepOrder,
|
|
22
|
-
u as useStepper
|
|
23
|
-
};
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsx as s } from "react/jsx-runtime";
|
|
3
|
-
import { forwardRef as b, useId as F, useState as N } from "react";
|
|
4
|
-
import { StepperContext as T } from "./stepper-context.js";
|
|
5
|
-
import U from "./stepper.module.css.js";
|
|
6
|
-
import { classNames as w } from "../utils/class-names.js";
|
|
7
|
-
const x = {
|
|
8
|
-
completed: "Fullført",
|
|
9
|
-
error: "Feil",
|
|
10
|
-
warning: "Advarsel"
|
|
11
|
-
};
|
|
12
|
-
function y({
|
|
13
|
-
id: e,
|
|
14
|
-
value: t,
|
|
15
|
-
defaultValue: a,
|
|
16
|
-
onChange: p,
|
|
17
|
-
orientation: o = "horizontal",
|
|
18
|
-
statusLabels: i,
|
|
19
|
-
variant: c = "linear",
|
|
20
|
-
lockedLabel: d = "Låst",
|
|
21
|
-
children: m,
|
|
22
|
-
className: u,
|
|
23
|
-
...f
|
|
24
|
-
}, S) {
|
|
25
|
-
const v = F(), h = e ?? v, I = { ...x, ...i }, [L, g] = N(
|
|
26
|
-
a
|
|
27
|
-
), r = t !== void 0, A = (r ? t : L) ?? "";
|
|
28
|
-
function C(n) {
|
|
29
|
-
r || g(n), p?.(n);
|
|
30
|
-
}
|
|
31
|
-
return /* @__PURE__ */ s(
|
|
32
|
-
"div",
|
|
33
|
-
{
|
|
34
|
-
id: e,
|
|
35
|
-
ref: S,
|
|
36
|
-
"data-orientation": o,
|
|
37
|
-
className: w(U["smudi-stepper"], u),
|
|
38
|
-
...f,
|
|
39
|
-
children: /* @__PURE__ */ s(
|
|
40
|
-
T.Provider,
|
|
41
|
-
{
|
|
42
|
-
value: {
|
|
43
|
-
value: A,
|
|
44
|
-
onChange: C,
|
|
45
|
-
baseId: h,
|
|
46
|
-
orientation: o,
|
|
47
|
-
statusLabels: I,
|
|
48
|
-
variant: c,
|
|
49
|
-
lockedLabel: d
|
|
50
|
-
},
|
|
51
|
-
children: m
|
|
52
|
-
}
|
|
53
|
-
)
|
|
54
|
-
}
|
|
55
|
-
);
|
|
56
|
-
}
|
|
57
|
-
const l = b(y);
|
|
58
|
-
l.displayName = "Stepper";
|
|
59
|
-
const D = l;
|
|
60
|
-
export {
|
|
61
|
-
D as Stepper
|
|
62
|
-
};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { useState as u, useRef as a, useCallback as o } from "react";
|
|
3
|
-
function d({
|
|
4
|
-
defaultValue: t,
|
|
5
|
-
mountStrategy: s = "all"
|
|
6
|
-
}) {
|
|
7
|
-
const [e, r] = u(t), l = a(/* @__PURE__ */ new Set([t]));
|
|
8
|
-
l.current.add(e);
|
|
9
|
-
const c = o(
|
|
10
|
-
(n) => s === "all" || n === e || s === "lazy" && l.current.has(n),
|
|
11
|
-
[s, e]
|
|
12
|
-
);
|
|
13
|
-
return { value: e, setValue: r, shouldRender: c };
|
|
14
|
-
}
|
|
15
|
-
export {
|
|
16
|
-
d as useStepperState
|
|
17
|
-
};
|