@midas-ds/table-styles 2.1.5 → 2.2.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/CHANGELOG.md +17 -0
- package/index.mjs +47 -88
- package/package.json +4 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,20 @@
|
|
|
1
|
+
## 2.2.0 (2026-10-09)
|
|
2
|
+
|
|
3
|
+
### 🚀 Features
|
|
4
|
+
|
|
5
|
+
- **components,layout,table-styles:** depend on lucide-react ([#1405](https://github.com/migrationsverket/midas/pull/1405))
|
|
6
|
+
|
|
7
|
+
### 🧱 Updated Dependencies
|
|
8
|
+
|
|
9
|
+
- Updated components to 17.30.0
|
|
10
|
+
- Updated theme to 3.17.7
|
|
11
|
+
|
|
12
|
+
## 2.1.6 (2026-10-09)
|
|
13
|
+
|
|
14
|
+
### 🧱 Updated Dependencies
|
|
15
|
+
|
|
16
|
+
- Updated components to 17.29.0
|
|
17
|
+
|
|
1
18
|
## 2.1.5 (2026-10-08)
|
|
2
19
|
|
|
3
20
|
### 🧱 Updated Dependencies
|
package/index.mjs
CHANGED
|
@@ -1,49 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ChevronLeft as e, ChevronRight as t } from "lucide-react";
|
|
2
2
|
import { Button as n, ListBoxItem as r, Select as i, Text as a, useLocalizedStringFormatter as o } from "@midas-ds/components";
|
|
3
3
|
import { FocusScope as s, useFocusManager as c } from "react-aria";
|
|
4
4
|
import { Fragment as l, jsx as u, jsxs as d } from "react/jsx-runtime";
|
|
5
|
-
import './index.css'
|
|
6
|
-
var f = (...e) => e.filter((e, t, n) => !!e && e.trim() !== "" && n.indexOf(e) === t).join(" ").trim(), p = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), m = (e) => e.replace(/^([A-Z])|[\s-_]+(\w)/g, (e, t, n) => n ? n.toUpperCase() : t.toLowerCase()), h = (e) => {
|
|
7
|
-
let t = m(e);
|
|
8
|
-
return t.charAt(0).toUpperCase() + t.slice(1);
|
|
9
|
-
}, g = {
|
|
10
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
11
|
-
width: 24,
|
|
12
|
-
height: 24,
|
|
13
|
-
viewBox: "0 0 24 24",
|
|
14
|
-
fill: "none",
|
|
15
|
-
stroke: "currentColor",
|
|
16
|
-
strokeWidth: 2,
|
|
17
|
-
strokeLinecap: "round",
|
|
18
|
-
strokeLinejoin: "round"
|
|
19
|
-
}, _ = (e) => {
|
|
20
|
-
for (let t in e) if (t.startsWith("aria-") || t === "role" || t === "title") return !0;
|
|
21
|
-
return !1;
|
|
22
|
-
}, v = t(({ color: t = "currentColor", size: n = 24, strokeWidth: r = 2, absoluteStrokeWidth: i, className: a = "", children: o, iconNode: s, ...c }, l) => e("svg", {
|
|
23
|
-
ref: l,
|
|
24
|
-
...g,
|
|
25
|
-
width: n,
|
|
26
|
-
height: n,
|
|
27
|
-
stroke: t,
|
|
28
|
-
strokeWidth: i ? Number(r) * 24 / Number(n) : r,
|
|
29
|
-
className: f("lucide", a),
|
|
30
|
-
...!o && !_(c) && { "aria-hidden": "true" },
|
|
31
|
-
...c
|
|
32
|
-
}, [...s.map(([t, n]) => e(t, n)), ...Array.isArray(o) ? o : [o]])), y = (n, r) => {
|
|
33
|
-
let i = t(({ className: t, ...i }, a) => e(v, {
|
|
34
|
-
ref: a,
|
|
35
|
-
iconNode: r,
|
|
36
|
-
className: f(`lucide-${p(h(n))}`, `lucide-${n}`, t),
|
|
37
|
-
...i
|
|
38
|
-
}));
|
|
39
|
-
return i.displayName = h(n), i;
|
|
40
|
-
}, b = y("chevron-left", [["path", {
|
|
41
|
-
d: "m15 18-6-6 6-6",
|
|
42
|
-
key: "1wnfg3"
|
|
43
|
-
}]]), x = y("chevron-right", [["path", {
|
|
44
|
-
d: "m9 18 6-6-6-6",
|
|
45
|
-
key: "mthhwq"
|
|
46
|
-
}]]), S = {
|
|
5
|
+
import './index.css';var f = {
|
|
47
6
|
en: {
|
|
48
7
|
nextPage: "Next page",
|
|
49
8
|
previousPage: "Previous page",
|
|
@@ -66,7 +25,7 @@ var f = (...e) => e.filter((e, t, n) => !!e && e.trim() !== "" && n.indexOf(e) =
|
|
|
66
25
|
rows: "rader",
|
|
67
26
|
selectPage: "Välj sida"
|
|
68
27
|
}
|
|
69
|
-
},
|
|
28
|
+
}, p = {
|
|
70
29
|
pagination: "_pagination_1m98q_1",
|
|
71
30
|
separator: "_separator_1m98q_17",
|
|
72
31
|
select: "_select_1m98q_21",
|
|
@@ -78,113 +37,113 @@ var f = (...e) => e.filter((e, t, n) => !!e && e.trim() !== "" && n.indexOf(e) =
|
|
|
78
37
|
pageIndex: "_pageIndex_1m98q_85 _select_1m98q_21",
|
|
79
38
|
buttons: "_buttons_1m98q_108",
|
|
80
39
|
button: "_button_1m98q_108 _separator_1m98q_17"
|
|
81
|
-
},
|
|
82
|
-
let
|
|
40
|
+
}, m = ({ getCanNextPage: r, getCanPreviousPage: i, nextPage: a, previousPage: s }) => {
|
|
41
|
+
let m = c(), h = o(f), g = (e) => {
|
|
83
42
|
switch (e.key) {
|
|
84
43
|
case "ArrowRight":
|
|
85
|
-
|
|
44
|
+
m?.focusNext({ wrap: !0 });
|
|
86
45
|
break;
|
|
87
|
-
case "ArrowLeft":
|
|
46
|
+
case "ArrowLeft": m?.focusPrevious({ wrap: !0 });
|
|
88
47
|
}
|
|
89
48
|
};
|
|
90
49
|
return /* @__PURE__ */ d(l, { children: [/* @__PURE__ */ u(n, {
|
|
91
|
-
"aria-label":
|
|
92
|
-
className:
|
|
93
|
-
isDisabled: !
|
|
94
|
-
onKeyDown:
|
|
95
|
-
onPress:
|
|
50
|
+
"aria-label": h.format("previousPage"),
|
|
51
|
+
className: p.button,
|
|
52
|
+
isDisabled: !i(),
|
|
53
|
+
onKeyDown: g,
|
|
54
|
+
onPress: s,
|
|
96
55
|
variant: "icon",
|
|
97
|
-
children: /* @__PURE__ */ u(
|
|
56
|
+
children: /* @__PURE__ */ u(e, {})
|
|
98
57
|
}), /* @__PURE__ */ u(n, {
|
|
99
|
-
"aria-label":
|
|
100
|
-
className:
|
|
101
|
-
isDisabled: !
|
|
102
|
-
onKeyDown:
|
|
103
|
-
onPress:
|
|
58
|
+
"aria-label": h.format("nextPage"),
|
|
59
|
+
className: p.button,
|
|
60
|
+
isDisabled: !r(),
|
|
61
|
+
onKeyDown: g,
|
|
62
|
+
onPress: a,
|
|
104
63
|
variant: "icon",
|
|
105
|
-
children: /* @__PURE__ */ u(
|
|
64
|
+
children: /* @__PURE__ */ u(t, {})
|
|
106
65
|
})] });
|
|
107
|
-
},
|
|
108
|
-
let { getPageCount: t, getRowCount: n, pageIndex: c, pageSize: l, pageSizeOptions:
|
|
66
|
+
}, h = (e) => {
|
|
67
|
+
let { getPageCount: t, getRowCount: n, pageIndex: c, pageSize: l, pageSizeOptions: h = [
|
|
109
68
|
10,
|
|
110
69
|
20,
|
|
111
70
|
30,
|
|
112
71
|
40,
|
|
113
72
|
50
|
|
114
|
-
], setPageIndex:
|
|
73
|
+
], setPageIndex: g, setPageSize: _ } = e, v = o(f), y = t(), b = n(), x = (c + 1) * l, S = x - l + 1;
|
|
115
74
|
return /* @__PURE__ */ d("div", {
|
|
116
|
-
className:
|
|
75
|
+
className: p.pagination,
|
|
117
76
|
children: [
|
|
118
77
|
/* @__PURE__ */ u(i, {
|
|
119
|
-
className:
|
|
120
|
-
items:
|
|
78
|
+
className: p.pageSize,
|
|
79
|
+
items: h.map((e) => ({
|
|
121
80
|
id: e.toString(),
|
|
122
81
|
name: e
|
|
123
82
|
})),
|
|
124
|
-
label:
|
|
83
|
+
label: v.format("rowsPerPage"),
|
|
125
84
|
onChange: (e) => {
|
|
126
85
|
let t = e === null ? l : Number(e);
|
|
127
|
-
|
|
86
|
+
_(t);
|
|
128
87
|
},
|
|
129
88
|
value: l.toString(),
|
|
130
89
|
children: (e) => /* @__PURE__ */ u(r, {
|
|
131
|
-
className:
|
|
90
|
+
className: p.listBoxItem,
|
|
132
91
|
id: e.id,
|
|
133
92
|
textValue: e.id,
|
|
134
93
|
children: e.name
|
|
135
94
|
})
|
|
136
95
|
}),
|
|
137
96
|
/* @__PURE__ */ d(a, {
|
|
138
|
-
className:
|
|
97
|
+
className: p.result,
|
|
139
98
|
children: [
|
|
140
|
-
|
|
99
|
+
S,
|
|
141
100
|
" -",
|
|
142
101
|
" ",
|
|
143
|
-
|
|
102
|
+
x > b ? b : x,
|
|
144
103
|
" ",
|
|
145
|
-
|
|
104
|
+
v.format("of"),
|
|
146
105
|
" ",
|
|
147
|
-
|
|
106
|
+
b.toLocaleString(),
|
|
148
107
|
" ",
|
|
149
|
-
|
|
108
|
+
b === 1 ? v.format("row") : v.format("rows")
|
|
150
109
|
]
|
|
151
110
|
}),
|
|
152
111
|
/* @__PURE__ */ d("div", {
|
|
153
|
-
className:
|
|
112
|
+
className: p.pageIndexContainer,
|
|
154
113
|
children: [/* @__PURE__ */ u(i, {
|
|
155
|
-
"aria-label":
|
|
156
|
-
className:
|
|
157
|
-
items: Array.from({ length:
|
|
114
|
+
"aria-label": v.format("selectPage"),
|
|
115
|
+
className: p.pageIndex,
|
|
116
|
+
items: Array.from({ length: y }, (e, t) => ({
|
|
158
117
|
id: t.toString(),
|
|
159
118
|
name: t
|
|
160
119
|
})),
|
|
161
120
|
onChange: (e) => {
|
|
162
|
-
|
|
121
|
+
g(e === null ? 0 : Number(e));
|
|
163
122
|
},
|
|
164
123
|
value: c.toString(),
|
|
165
124
|
children: (e) => /* @__PURE__ */ u(r, {
|
|
166
|
-
className:
|
|
125
|
+
className: p.listBoxItem,
|
|
167
126
|
id: e.id,
|
|
168
127
|
textValue: (Number(e.id) + 1).toString(),
|
|
169
128
|
children: e.name + 1
|
|
170
129
|
})
|
|
171
130
|
}), /* @__PURE__ */ d(a, {
|
|
172
|
-
className:
|
|
131
|
+
className: p.label,
|
|
173
132
|
children: [
|
|
174
|
-
|
|
133
|
+
v.format("of"),
|
|
175
134
|
" ",
|
|
176
|
-
|
|
135
|
+
y,
|
|
177
136
|
" ",
|
|
178
|
-
|
|
137
|
+
y === 1 ? v.format("page") : v.format("pages")
|
|
179
138
|
]
|
|
180
139
|
})]
|
|
181
140
|
}),
|
|
182
141
|
/* @__PURE__ */ u("div", {
|
|
183
|
-
className:
|
|
184
|
-
children: /* @__PURE__ */ u(s, { children: /* @__PURE__ */ u(
|
|
142
|
+
className: p.buttons,
|
|
143
|
+
children: /* @__PURE__ */ u(s, { children: /* @__PURE__ */ u(m, { ...e }) })
|
|
185
144
|
})
|
|
186
145
|
]
|
|
187
146
|
});
|
|
188
147
|
};
|
|
189
148
|
//#endregion
|
|
190
|
-
export {
|
|
149
|
+
export { h as Pagination };
|
package/package.json
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"description": "Midas table components and styles for TanStack Table",
|
|
15
15
|
"homepage": "https://designsystem.migrationsverket.se/",
|
|
16
16
|
"license": "CC0-1.0",
|
|
17
|
-
"version": "2.
|
|
17
|
+
"version": "2.2.0",
|
|
18
18
|
"main": "./index.mjs",
|
|
19
19
|
"types": "./index.d.ts",
|
|
20
20
|
"files": [
|
|
@@ -31,8 +31,9 @@
|
|
|
31
31
|
}
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@midas-ds/components": "17.
|
|
35
|
-
"@midas-ds/theme": "3.17.
|
|
34
|
+
"@midas-ds/components": "17.30.0",
|
|
35
|
+
"@midas-ds/theme": "3.17.7",
|
|
36
|
+
"lucide-react": ">=0.563.0 <2.0.0",
|
|
36
37
|
"react-aria-components": "1.21.1",
|
|
37
38
|
"react-aria": "3.52.1"
|
|
38
39
|
},
|