@midas-ds/components 17.21.1 → 17.21.2

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 CHANGED
@@ -1,3 +1,15 @@
1
+ ## 17.21.2 (2026-08-21)
2
+
3
+ ### 🩹 Fixes
4
+
5
+ - **components,checkbox:** apply same disabled-item rule to CheckboxGroup select-all ([6b77e5a6e43](https://github.com/migrationsverket/midas/commit/6b77e5a6e43))
6
+ - **components,select:** preserve disabled items' selection through select-all/clear-all ([7f5ab431c09](https://github.com/migrationsverket/midas/commit/7f5ab431c09))
7
+ - **components,select:** only select real items in SelectAll ([0cab89d4283](https://github.com/migrationsverket/midas/commit/0cab89d4283))
8
+
9
+ ### 🧪 Tests updated
10
+
11
+ - **components,select:** reproduce SelectAll bug with sections and disabled items ([458e1305dd6](https://github.com/migrationsverket/midas/commit/458e1305dd6))
12
+
1
13
  ## 17.21.1 (2026-08-18)
2
14
 
3
15
  ### 🩹 Fixes
@@ -24,6 +24,7 @@ export default _default;
24
24
  export declare const Primary: Story;
25
25
  export declare const ShowSelectAll: Story;
26
26
  export declare const SelectAllInteraction: Story;
27
+ export declare const SelectAllWithPreselectedDisabledItem: Story;
27
28
  export declare const Disabled: Story;
28
29
  export declare const ReadOnly: Story;
29
30
  export declare const Invalid: Story;
package/checkbox/index.js CHANGED
@@ -1,2 +1,2 @@
1
- import { n as e, t } from "../chunks/checkbox-DEN5T_Km.js";
1
+ import { n as e, t } from "../chunks/checkbox-DzDcMqzR.js";
2
2
  export { e as Checkbox, t as CheckboxGroup };
@@ -4,4 +4,5 @@ export declare const useSelectAll: (children: React.ReactNode, { value: selected
4
4
  allSelected: boolean;
5
5
  someSelected: boolean;
6
6
  checkboxValues: string[];
7
+ disabledSelectedValues: string[];
7
8
  };
@@ -134,11 +134,12 @@ L.displayName = "Checkbox";
134
134
  //#endregion
135
135
  //#region packages/components/src/checkbox/useSelectAll.ts
136
136
  var R = (e, { value: t }) => {
137
- let n = c.Children.toArray(e).filter((e) => c.isValidElement(e) && e.type === L), r = c.Children.count(n), i = c.Children.toArray(e).filter((e) => c.isValidElement(e)).filter((e) => !!e && e.type === L).map((e) => e.props.value || ""), a = t.length === 0, o = t.length === r;
137
+ let n = c.Children.toArray(e).filter((e) => c.isValidElement(e) && e.type === L), r = n.filter((e) => !e.props.isDisabled).map((e) => e.props.value || ""), i = n.filter((e) => e.props.isDisabled).map((e) => e.props.value || "").filter((e) => t.includes(e)), a = t.filter((e) => r.includes(e)).length, o = a === 0, s = a === r.length;
138
138
  return {
139
- allSelected: o,
140
- someSelected: !a && !o,
141
- checkboxValues: i
139
+ allSelected: s,
140
+ someSelected: !o && !s,
141
+ checkboxValues: r,
142
+ disabledSelectedValues: i
142
143
  };
143
144
  }, z = ({ state: e, errorMessage: t }) => /* @__PURE__ */ v(m.Provider, {
144
145
  value: e.displayValidation,
@@ -150,8 +151,8 @@ var R = (e, { value: t }) => {
150
151
  //#endregion
151
152
  //#region packages/components/src/checkbox/CheckboxGroup.tsx
152
153
  function V(e) {
153
- let t = k(e), n = r(B), { groupProps: a, labelProps: c, descriptionProps: l } = C(e, t), { allSelected: u, someSelected: d, checkboxValues: f } = R(e.children, t), p = (e) => {
154
- t.setValue(e ? f : []);
154
+ let t = k(e), n = r(B), { groupProps: a, labelProps: c, descriptionProps: l } = C(e, t), { allSelected: u, someSelected: d, checkboxValues: f, disabledSelectedValues: p } = R(e.children, t), m = (e) => {
155
+ t.setValue(e ? [...f, ...p] : p);
155
156
  };
156
157
  return /* @__PURE__ */ y("div", {
157
158
  ...a,
@@ -181,7 +182,7 @@ function V(e) {
181
182
  isSelected: u,
182
183
  isIndeterminate: d,
183
184
  isReadOnly: e.isReadOnly,
184
- onChange: p,
185
+ onChange: m,
185
186
  children: e.selectAllLabel || n.format("selectAll")
186
187
  }), /* @__PURE__ */ v(M.Provider, {
187
188
  value: t,
@@ -1,6 +1,6 @@
1
1
  import { n as e, t } from "./clsx-BtlV5Vo3.js";
2
2
  import { t as n } from "./chevron-down-Buf0eTzo.js";
3
- import { n as r } from "./checkbox-DEN5T_Km.js";
3
+ import { n as r } from "./checkbox-DzDcMqzR.js";
4
4
  import { t as i } from "./x-Bs_QW3q8.js";
5
5
  import { t as a } from "./useLocalizedStringFormatter-bRLuRzVD.js";
6
6
  import { t as o } from "./text-mAeDlv5N.js";
@@ -48,7 +48,9 @@ import '../assets/select.css';var E = {
48
48
  isIndeterminate: !e?.selectionManager.isSelectAll && !e?.selectionManager.isEmpty,
49
49
  isSelected: e?.selectionManager.isSelectAll,
50
50
  onChange: () => {
51
- e?.setValue(e?.selectionManager.isSelectAll ? null : Array.from(e.collection.getKeys())), e?.commitValidation();
51
+ if (!e) return;
52
+ let t = Array.from(e.collection.getKeys()).filter((t) => e.collection.getItem(t)?.type === "item" && e.selectionManager.canSelectItem(t)), n = Array.from(e.selectionManager.selectedKeys).filter((t) => !e.selectionManager.canSelectItem(t));
53
+ e.setValue(e.selectionManager.isSelectAll ? n : [...t, ...n]), e.commitValidation();
52
54
  },
53
55
  children: t.format("selectAll")
54
56
  });
@@ -1,7 +1,7 @@
1
1
  'use client';
2
2
  import { t as e } from "./clsx-BtlV5Vo3.js";
3
3
  import { t } from "./createLucideIcon-DhIhuN5D.js";
4
- import { n } from "./checkbox-DEN5T_Km.js";
4
+ import { n } from "./checkbox-DzDcMqzR.js";
5
5
  import { Button as r, Cell as i, Collection as a, Column as o, Row as s, Table as c, TableBody as l, TableHeader as u, useTableOptions as d } from "react-aria-components";
6
6
  import { Fragment as f, jsx as p, jsxs as m } from "react/jsx-runtime";
7
7
  import '../assets/table.css';var h = t("arrow-down", [["path", {
package/index.js CHANGED
@@ -5,11 +5,11 @@ import { t as n } from "./chunks/clsx-BtlV5Vo3.js";
5
5
  import { t as r } from "./chunks/spinner-C3WiZYld.js";
6
6
  import { a as i, i as a, n as o, r as s, t as c } from "./chunks/layout-DibnX6Za.js";
7
7
  import { t as l } from "./chunks/link-CZNuhFX6.js";
8
- import { a as u, i as d, n as f, o as p, r as m, t as h } from "./chunks/table-jarDZ4q4.js";
8
+ import { a as u, i as d, n as f, o as p, r as m, t as h } from "./chunks/table-DaRg-6YG.js";
9
9
  import { t as g } from "./chunks/link-button-ZsK6UGko.js";
10
10
  import { n as _, t as v } from "./chunks/date-picker-BQcIYROH.js";
11
11
  import { n as y, t as b } from "./chunks/calendar-C0rlcHfr.js";
12
- import { n as x, t as S } from "./chunks/checkbox-DEN5T_Km.js";
12
+ import { n as x, t as S } from "./chunks/checkbox-DzDcMqzR.js";
13
13
  import { n as C, t as w } from "./chunks/color-scheme-switch-FjmPZdE4.js";
14
14
  import { t as T } from "./chunks/search-field-lz0_j_HR.js";
15
15
  import { n as E, t as D } from "./chunks/file-list-DYOuch5G.js";
@@ -38,7 +38,7 @@ import { n as Ee, t as De } from "./chunks/tooltip-BE_r_CBm.js";
38
38
  import { n as Oe, t as ke } from "./chunks/logo-D7tz-4hp.js";
39
39
  import { t as Ae } from "./chunks/progress-bar-5H5WvG7R.js";
40
40
  import { n as je, t as Me } from "./chunks/radio-CsAvwCn2.js";
41
- import { t as Ne } from "./chunks/select-7z-x3crV.js";
41
+ import { t as Ne } from "./chunks/select-ChXob1uS.js";
42
42
  import { n as Pe, r as Fe, t as Ie } from "./chunks/tag-CELJrUEQ.js";
43
43
  import { t as Le } from "./chunks/skeleton-OqKFBcmO.js";
44
44
  import { i as Re, n as ze, r as Be, t as Ve } from "./chunks/tabs-eshGdQJJ.js";
@@ -59,7 +59,7 @@ var $e = {
59
59
  description: "Midas Components",
60
60
  homepage: "https://designsystem.migrationsverket.se/",
61
61
  license: "CC0-1.0",
62
- version: "17.21.1",
62
+ version: "17.21.2",
63
63
  module: "./index.js",
64
64
  type: "module",
65
65
  main: "./index.js",
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.21.1",
17
+ "version": "17.21.2",
18
18
  "module": "./index.js",
19
19
  "type": "module",
20
20
  "main": "./index.js",
@@ -39,6 +39,8 @@ export declare const DisabledOption: Story;
39
39
  export declare const Invalid: Story;
40
40
  export declare const WithTags: Story<Item, 'multiple'>;
41
41
  export declare const SelectAllEnabled: Story<Item, 'multiple'>;
42
+ export declare const SelectAllEnabledWithSections: Story<Item, 'multiple'>;
43
+ export declare const SelectAllEnabledWithPreselectedDisabledItem: Story<Item, 'multiple'>;
42
44
  export declare const DS872: Story;
43
45
  export declare const StaticSections: Story;
44
46
  export declare const NotVirtualized: Story;
package/select/index.js CHANGED
@@ -1,2 +1,2 @@
1
- import { t as e } from "../chunks/select-7z-x3crV.js";
1
+ import { t as e } from "../chunks/select-ChXob1uS.js";
2
2
  export { e as Select };
package/table/index.js CHANGED
@@ -1,2 +1,2 @@
1
- import { a as e, i as t, n, o as r, r as i, t as a } from "../chunks/table-jarDZ4q4.js";
1
+ import { a as e, i as t, n, o as r, r as i, t as a } from "../chunks/table-DaRg-6YG.js";
2
2
  export { a as Cell, n as Column, i as Row, t as Table, e as TableBody, r as TableHeader };