@midas-ds/components 17.14.8 → 17.15.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 +18 -0
- package/chunks/ColorSchemeSwitch-CjXb7w5A.js +118 -0
- package/color-scheme-switch/ColorSchemeSwitch.d.ts +4 -0
- package/color-scheme-switch/ColorSchemeSwitch.stories.d.ts +1 -0
- package/color-scheme-switch/index.js +1 -1
- package/index.js +2 -2
- package/package.json +2 -2
- package/chunks/ColorSchemeSwitch-Bp3PSGkA.js +0 -113
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,21 @@
|
|
|
1
|
+
## 17.15.1 (2026-06-01)
|
|
2
|
+
|
|
3
|
+
### 🧱 Updated Dependencies
|
|
4
|
+
|
|
5
|
+
- Updated theme to 3.14.9
|
|
6
|
+
|
|
7
|
+
## 17.15.0 (2026-05-21)
|
|
8
|
+
|
|
9
|
+
### 🚀 Features
|
|
10
|
+
|
|
11
|
+
- **components,color-scheme-switch:** add scheme and onSchemeChange props ([428780719c2](https://github.com/migrationsverket/midas/commit/428780719c2))
|
|
12
|
+
|
|
13
|
+
## 17.14.9 (2026-05-21)
|
|
14
|
+
|
|
15
|
+
### 🧱 Updated Dependencies
|
|
16
|
+
|
|
17
|
+
- Updated theme to 3.14.8
|
|
18
|
+
|
|
1
19
|
## 17.14.8 (2026-05-12)
|
|
2
20
|
|
|
3
21
|
### 🧱 Updated Dependencies
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsxs as s, jsx as e } from "react/jsx-runtime";
|
|
3
|
+
import * as p from "react";
|
|
4
|
+
import { VisuallyHidden as i } from "react-aria";
|
|
5
|
+
import { SelectionIndicator as d } from "react-aria-components";
|
|
6
|
+
import { a as M, T as m } from "./ToggleButtonGroup-DRnEEi5-.js";
|
|
7
|
+
import { c as h } from "./createLucideIcon-CP-mMPfa.js";
|
|
8
|
+
import { u as _ } from "./useLocalizedStringFormatter-BHvsRxDk.js";
|
|
9
|
+
import '../assets/ColorSchemeSwitch.css';const v = [
|
|
10
|
+
[
|
|
11
|
+
"path",
|
|
12
|
+
{
|
|
13
|
+
d: "M18 5a2 2 0 0 1 2 2v8.526a2 2 0 0 0 .212.897l1.068 2.127a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45l1.068-2.127A2 2 0 0 0 4 15.526V7a2 2 0 0 1 2-2z",
|
|
14
|
+
key: "1pdavp"
|
|
15
|
+
}
|
|
16
|
+
],
|
|
17
|
+
["path", { d: "M20.054 15.987H3.946", key: "14rxg9" }]
|
|
18
|
+
], N = h("laptop", v);
|
|
19
|
+
const I = [
|
|
20
|
+
[
|
|
21
|
+
"path",
|
|
22
|
+
{
|
|
23
|
+
d: "M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",
|
|
24
|
+
key: "kfwtm"
|
|
25
|
+
}
|
|
26
|
+
]
|
|
27
|
+
], b = h("moon", I);
|
|
28
|
+
const w = [
|
|
29
|
+
["circle", { cx: "12", cy: "12", r: "4", key: "4exip2" }],
|
|
30
|
+
["path", { d: "M12 2v2", key: "tus03m" }],
|
|
31
|
+
["path", { d: "M12 20v2", key: "1lh1kg" }],
|
|
32
|
+
["path", { d: "m4.93 4.93 1.41 1.41", key: "149t6j" }],
|
|
33
|
+
["path", { d: "m17.66 17.66 1.41 1.41", key: "ptbguv" }],
|
|
34
|
+
["path", { d: "M2 12h2", key: "1t8f8n" }],
|
|
35
|
+
["path", { d: "M20 12h2", key: "1q8mjw" }],
|
|
36
|
+
["path", { d: "m6.34 17.66-1.41 1.41", key: "1m8zz5" }],
|
|
37
|
+
["path", { d: "m19.07 4.93-1.41 1.41", key: "1shlcs" }]
|
|
38
|
+
], x = h("sun", w), j = "_button_1r8vq_1", C = "_selectionIndicator_1r8vq_14", o = {
|
|
39
|
+
button: j,
|
|
40
|
+
selectionIndicator: C
|
|
41
|
+
}, L = { darkMode: "Dark Mode", lightMode: "Light Mode", system: "System Setting" }, q = { darkMode: "Mörkt läge", lightMode: "Ljust läge", system: "Systeminställning" }, z = {
|
|
42
|
+
en: L,
|
|
43
|
+
sv: q
|
|
44
|
+
}, V = ({
|
|
45
|
+
selector: c = ":root",
|
|
46
|
+
defaultScheme: g = "light dark",
|
|
47
|
+
scheme: a,
|
|
48
|
+
onSchemeChange: y,
|
|
49
|
+
defaultValue: u,
|
|
50
|
+
className: k
|
|
51
|
+
}) => {
|
|
52
|
+
const [f, S] = p.useState(
|
|
53
|
+
u ?? /* @__PURE__ */ new Set([a ?? g])
|
|
54
|
+
), r = a ? /* @__PURE__ */ new Set([a]) : f;
|
|
55
|
+
p.useEffect(() => {
|
|
56
|
+
const t = document.querySelector(c);
|
|
57
|
+
if (t) {
|
|
58
|
+
const n = Array.from(r).join(" ");
|
|
59
|
+
t.style.removeProperty("color-scheme"), n === "light dark" ? delete t.dataset.colorScheme : t.dataset.colorScheme = n;
|
|
60
|
+
} else
|
|
61
|
+
console.warn(`No element found for selector: "${c}"`);
|
|
62
|
+
}, [r, c]);
|
|
63
|
+
const l = _(z);
|
|
64
|
+
return /* @__PURE__ */ s(
|
|
65
|
+
M,
|
|
66
|
+
{
|
|
67
|
+
selectionMode: "single",
|
|
68
|
+
selectedKeys: r,
|
|
69
|
+
onSelectionChange: (t) => {
|
|
70
|
+
const n = Array.from(t)[0];
|
|
71
|
+
S(t), y?.(n);
|
|
72
|
+
},
|
|
73
|
+
disallowEmptySelection: !0,
|
|
74
|
+
className: k,
|
|
75
|
+
children: [
|
|
76
|
+
/* @__PURE__ */ s(
|
|
77
|
+
m,
|
|
78
|
+
{
|
|
79
|
+
id: "light dark",
|
|
80
|
+
className: o.button,
|
|
81
|
+
children: [
|
|
82
|
+
/* @__PURE__ */ e(N, {}),
|
|
83
|
+
/* @__PURE__ */ e(i, { children: l.format("system") }),
|
|
84
|
+
/* @__PURE__ */ e(d, { className: o.selectionIndicator })
|
|
85
|
+
]
|
|
86
|
+
}
|
|
87
|
+
),
|
|
88
|
+
/* @__PURE__ */ s(
|
|
89
|
+
m,
|
|
90
|
+
{
|
|
91
|
+
id: "light",
|
|
92
|
+
className: o.button,
|
|
93
|
+
children: [
|
|
94
|
+
/* @__PURE__ */ e(x, {}),
|
|
95
|
+
/* @__PURE__ */ e(i, { children: l.format("lightMode") }),
|
|
96
|
+
/* @__PURE__ */ e(d, { className: o.selectionIndicator })
|
|
97
|
+
]
|
|
98
|
+
}
|
|
99
|
+
),
|
|
100
|
+
/* @__PURE__ */ s(
|
|
101
|
+
m,
|
|
102
|
+
{
|
|
103
|
+
id: "dark",
|
|
104
|
+
className: o.button,
|
|
105
|
+
children: [
|
|
106
|
+
/* @__PURE__ */ e(b, {}),
|
|
107
|
+
/* @__PURE__ */ e(i, { children: l.format("darkMode") }),
|
|
108
|
+
/* @__PURE__ */ e(d, { className: o.selectionIndicator })
|
|
109
|
+
]
|
|
110
|
+
}
|
|
111
|
+
)
|
|
112
|
+
]
|
|
113
|
+
}
|
|
114
|
+
);
|
|
115
|
+
};
|
|
116
|
+
export {
|
|
117
|
+
V as C
|
|
118
|
+
};
|
|
@@ -9,6 +9,10 @@ export interface ColorSchemeSwitchProps {
|
|
|
9
9
|
* @default 'light dark'
|
|
10
10
|
*/
|
|
11
11
|
defaultScheme?: ColorScheme;
|
|
12
|
+
/** The controlled color scheme. When provided, the component becomes controlled — pair with `onSchemeChange` to update it. */
|
|
13
|
+
scheme?: ColorScheme;
|
|
14
|
+
/** Called when the user selects a new color scheme. Use this to persist the selection, e.g. to `localStorage`. */
|
|
15
|
+
onSchemeChange?: (scheme: ColorScheme) => void;
|
|
12
16
|
/**
|
|
13
17
|
* @deprecated since v17.9.0 Use `defaultScheme` instead.
|
|
14
18
|
*/
|
package/index.js
CHANGED
|
@@ -9,7 +9,7 @@ import { C as b, a as S, b as D, c as I, d as F, e as R, f as G, g as P, h as k
|
|
|
9
9
|
import { C as M } from "./chunks/CharacterCounter-Dgnv-orm.js";
|
|
10
10
|
import { C as A } from "./chunks/Checkbox-CyamRrFD.js";
|
|
11
11
|
import { C as y } from "./chunks/CheckboxGroup-CmjQm14M.js";
|
|
12
|
-
import { C as N } from "./chunks/ColorSchemeSwitch-
|
|
12
|
+
import { C as N } from "./chunks/ColorSchemeSwitch-CjXb7w5A.js";
|
|
13
13
|
import { C as O } from "./chunks/ComboBox-BCfucCKv.js";
|
|
14
14
|
import { D as Q } from "./chunks/DateField-CpvZGNHu.js";
|
|
15
15
|
import { D as Z, a as j } from "./chunks/DateInput-NzWcnB4y.js";
|
|
@@ -52,7 +52,7 @@ import { c as Ko } from "./chunks/clsx-AexbMWKp.js";
|
|
|
52
52
|
import { DialogTrigger as Wo, MenuTrigger as Xo, RouterProvider as Yo } from "react-aria-components";
|
|
53
53
|
import { u as $o } from "./chunks/useLocalizedStringFormatter-BHvsRxDk.js";
|
|
54
54
|
import { useToastState as or } from "react-stately";
|
|
55
|
-
const a = "17.
|
|
55
|
+
const a = "17.15.1", o = {
|
|
56
56
|
version: a
|
|
57
57
|
}, r = o.version;
|
|
58
58
|
export {
|
package/package.json
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"description": "Midas Components",
|
|
15
15
|
"homepage": "https://designsystem.migrationsverket.se/",
|
|
16
16
|
"license": "CC0-1.0",
|
|
17
|
-
"version": "17.
|
|
17
|
+
"version": "17.15.1",
|
|
18
18
|
"module": "./index.js",
|
|
19
19
|
"type": "module",
|
|
20
20
|
"main": "./index.js",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"./*": "./*/index.js"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@midas-ds/theme": "3.14.
|
|
44
|
+
"@midas-ds/theme": "3.14.9",
|
|
45
45
|
"@react-aria/focus": "^3.21.5",
|
|
46
46
|
"@react-stately/toggle": "^3.9.5",
|
|
47
47
|
"@react-stately/utils": "^3.11.0",
|
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { jsxs as s, jsx as e } from "react/jsx-runtime";
|
|
3
|
-
import * as h from "react";
|
|
4
|
-
import { VisuallyHidden as r } from "react-aria";
|
|
5
|
-
import { SelectionIndicator as l } from "react-aria-components";
|
|
6
|
-
import { a as k, T as i } from "./ToggleButtonGroup-DRnEEi5-.js";
|
|
7
|
-
import { c as d } from "./createLucideIcon-CP-mMPfa.js";
|
|
8
|
-
import { u as f } from "./useLocalizedStringFormatter-BHvsRxDk.js";
|
|
9
|
-
import '../assets/ColorSchemeSwitch.css';const M = [
|
|
10
|
-
[
|
|
11
|
-
"path",
|
|
12
|
-
{
|
|
13
|
-
d: "M18 5a2 2 0 0 1 2 2v8.526a2 2 0 0 0 .212.897l1.068 2.127a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45l1.068-2.127A2 2 0 0 0 4 15.526V7a2 2 0 0 1 2-2z",
|
|
14
|
-
key: "1pdavp"
|
|
15
|
-
}
|
|
16
|
-
],
|
|
17
|
-
["path", { d: "M20.054 15.987H3.946", key: "14rxg9" }]
|
|
18
|
-
], S = d("laptop", M);
|
|
19
|
-
const _ = [
|
|
20
|
-
[
|
|
21
|
-
"path",
|
|
22
|
-
{
|
|
23
|
-
d: "M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",
|
|
24
|
-
key: "kfwtm"
|
|
25
|
-
}
|
|
26
|
-
]
|
|
27
|
-
], N = d("moon", _);
|
|
28
|
-
const v = [
|
|
29
|
-
["circle", { cx: "12", cy: "12", r: "4", key: "4exip2" }],
|
|
30
|
-
["path", { d: "M12 2v2", key: "tus03m" }],
|
|
31
|
-
["path", { d: "M12 20v2", key: "1lh1kg" }],
|
|
32
|
-
["path", { d: "m4.93 4.93 1.41 1.41", key: "149t6j" }],
|
|
33
|
-
["path", { d: "m17.66 17.66 1.41 1.41", key: "ptbguv" }],
|
|
34
|
-
["path", { d: "M2 12h2", key: "1t8f8n" }],
|
|
35
|
-
["path", { d: "M20 12h2", key: "1q8mjw" }],
|
|
36
|
-
["path", { d: "m6.34 17.66-1.41 1.41", key: "1m8zz5" }],
|
|
37
|
-
["path", { d: "m19.07 4.93-1.41 1.41", key: "1shlcs" }]
|
|
38
|
-
], I = d("sun", v), b = "_button_1r8vq_1", j = "_selectionIndicator_1r8vq_14", t = {
|
|
39
|
-
button: b,
|
|
40
|
-
selectionIndicator: j
|
|
41
|
-
}, w = { darkMode: "Dark Mode", lightMode: "Light Mode", system: "System Setting" }, x = { darkMode: "Mörkt läge", lightMode: "Ljust läge", system: "Systeminställning" }, L = {
|
|
42
|
-
en: w,
|
|
43
|
-
sv: x
|
|
44
|
-
}, $ = ({
|
|
45
|
-
selector: c = ":root",
|
|
46
|
-
defaultScheme: p = "light dark",
|
|
47
|
-
defaultValue: y,
|
|
48
|
-
className: g
|
|
49
|
-
}) => {
|
|
50
|
-
const [n, u] = h.useState(
|
|
51
|
-
y ?? /* @__PURE__ */ new Set([p])
|
|
52
|
-
);
|
|
53
|
-
h.useEffect(() => {
|
|
54
|
-
const o = document.querySelector(c);
|
|
55
|
-
if (o) {
|
|
56
|
-
const m = Array.from(n).join(" ");
|
|
57
|
-
o.style.removeProperty("color-scheme"), m === "light dark" ? delete o.dataset.colorScheme : o.dataset.colorScheme = m;
|
|
58
|
-
} else
|
|
59
|
-
console.warn(`No element found for selector: "${c}"`);
|
|
60
|
-
}, [n, c]);
|
|
61
|
-
const a = f(L);
|
|
62
|
-
return /* @__PURE__ */ s(
|
|
63
|
-
k,
|
|
64
|
-
{
|
|
65
|
-
selectionMode: "single",
|
|
66
|
-
selectedKeys: n,
|
|
67
|
-
onSelectionChange: u,
|
|
68
|
-
disallowEmptySelection: !0,
|
|
69
|
-
className: g,
|
|
70
|
-
children: [
|
|
71
|
-
/* @__PURE__ */ s(
|
|
72
|
-
i,
|
|
73
|
-
{
|
|
74
|
-
id: "light dark",
|
|
75
|
-
className: t.button,
|
|
76
|
-
children: [
|
|
77
|
-
/* @__PURE__ */ e(S, {}),
|
|
78
|
-
/* @__PURE__ */ e(r, { children: a.format("system") }),
|
|
79
|
-
/* @__PURE__ */ e(l, { className: t.selectionIndicator })
|
|
80
|
-
]
|
|
81
|
-
}
|
|
82
|
-
),
|
|
83
|
-
/* @__PURE__ */ s(
|
|
84
|
-
i,
|
|
85
|
-
{
|
|
86
|
-
id: "light",
|
|
87
|
-
className: t.button,
|
|
88
|
-
children: [
|
|
89
|
-
/* @__PURE__ */ e(I, {}),
|
|
90
|
-
/* @__PURE__ */ e(r, { children: a.format("lightMode") }),
|
|
91
|
-
/* @__PURE__ */ e(l, { className: t.selectionIndicator })
|
|
92
|
-
]
|
|
93
|
-
}
|
|
94
|
-
),
|
|
95
|
-
/* @__PURE__ */ s(
|
|
96
|
-
i,
|
|
97
|
-
{
|
|
98
|
-
id: "dark",
|
|
99
|
-
className: t.button,
|
|
100
|
-
children: [
|
|
101
|
-
/* @__PURE__ */ e(N, {}),
|
|
102
|
-
/* @__PURE__ */ e(r, { children: a.format("darkMode") }),
|
|
103
|
-
/* @__PURE__ */ e(l, { className: t.selectionIndicator })
|
|
104
|
-
]
|
|
105
|
-
}
|
|
106
|
-
)
|
|
107
|
-
]
|
|
108
|
-
}
|
|
109
|
-
);
|
|
110
|
-
};
|
|
111
|
-
export {
|
|
112
|
-
$ as C
|
|
113
|
-
};
|