@midas-ds/components 15.2.11 → 15.2.13

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.
Files changed (97) hide show
  1. package/AccordionItem-BC1ogvtn.cjs +1 -0
  2. package/{AccordionItem-B_49vBml.js → AccordionItem-DDqHaLf6.js} +89 -89
  3. package/Button-CPtsYcdR.cjs +1 -0
  4. package/Button-aWvg3R6-.js +46 -0
  5. package/CHANGELOG.md +16 -0
  6. package/{CheckboxGroup-Cn5j_R5a.js → CheckboxGroup-D2Sa6zYI.js} +1 -1
  7. package/{CheckboxGroup-BdcEnLWf.cjs → CheckboxGroup-D9L7J0yo.cjs} +1 -1
  8. package/{ComboBox-_fqwvHy1.cjs → ComboBox-Bt1MZeC4.cjs} +1 -1
  9. package/{ComboBox-BFfUWFb-.js → ComboBox-DxQw26od.js} +1 -1
  10. package/{DateField-CJkMWNOU.js → DateField-DVpB3_an.js} +1 -1
  11. package/{DateField-CuEzECWT.cjs → DateField-gQBrgakI.cjs} +1 -1
  12. package/{DateRangePicker-BleP75yR.cjs → DateRangePicker-BRZ3oWKb.cjs} +1 -1
  13. package/{DateRangePicker-Dwd6n5Ep.js → DateRangePicker-MaeJ1k92.js} +2 -2
  14. package/{Dialog-OKCVfgWq.js → Dialog-BicjIcni.js} +5 -5
  15. package/{Dialog-DOXrOfUr.cjs → Dialog-C_PfYd4_.cjs} +1 -1
  16. package/{Dropdown-yIguICs_.js → Dropdown-BnJHvNQx.js} +1 -1
  17. package/{Dropdown-C-2k1le5.cjs → Dropdown-C2aoQ_Pv.cjs} +1 -1
  18. package/{InfoBanner-DU8GMggz.js → InfoBanner-CgSm9bjk.js} +1 -1
  19. package/{InfoBanner-BY-ATC3B.cjs → InfoBanner-Dc5gf1JR.cjs} +1 -1
  20. package/{Label-knQhhLVp.js → Label-AgADiPwL.js} +1 -1
  21. package/{Label-DkNtFYv5.cjs → Label-Dn9QqKX8.cjs} +1 -1
  22. package/{Layout-B6EeXI6A.cjs → Layout-3vZ97J1E.cjs} +1 -1
  23. package/{Layout-DTTpCtPx.js → Layout-CSujs98x.js} +1 -1
  24. package/{ListBoxLoadMoreItem-z7Cpu0NS.js → ListBoxLoadMoreItem-495VPa51.js} +1 -1
  25. package/{ListBoxLoadMoreItem-Bpp_Sab2.cjs → ListBoxLoadMoreItem-B31-J1-a.cjs} +1 -1
  26. package/{ProgressBar-DkpC1juo.cjs → ProgressBar-B6xscMY3.cjs} +1 -1
  27. package/{ProgressBar-Cp0-AYZG.js → ProgressBar-YITQVXp6.js} +1 -1
  28. package/README.md +1 -1
  29. package/{Radio-BxWwVigT.cjs → Radio-BrzLuRFq.cjs} +1 -1
  30. package/{Radio-BPNKJKOP.js → Radio-UKurdI_v.js} +1 -1
  31. package/{RangeCalendar-vgnMNbq9.js → RangeCalendar-DzXoUxRH.js} +1 -1
  32. package/{RangeCalendar-BNrmWgzG.cjs → RangeCalendar-HOQvYbbb.cjs} +1 -1
  33. package/{SearchField-DJ6Az-eH.js → SearchField-CNR3stL5.js} +1 -1
  34. package/{SearchField-BD32iJE6.cjs → SearchField-DV2ul88x.cjs} +1 -1
  35. package/{Select-OsoFMf4S.js → Select-AxHoF7DD.js} +2 -2
  36. package/{Select-Cdiwvk1H.cjs → Select-BATiN27h.cjs} +1 -1
  37. package/{Select-D-_4SqEp.cjs → Select-CniABLmk.cjs} +1 -1
  38. package/{Select-BpaxqFKH.js → Select-QS3jUbq8.js} +2 -2
  39. package/{Spinner-Diy-6pvn.cjs → Spinner-6nei2CMj.cjs} +1 -1
  40. package/{Spinner-BY-ql54i.js → Spinner-C29Pyxlj.js} +6 -6
  41. package/{Tag-DbNUEevV.js → Tag-CMciiehF.js} +1 -1
  42. package/{Tag-Bd8ql_zX.cjs → Tag-DsmOy4f_.cjs} +1 -1
  43. package/{TextArea-Cua7fm2Z.js → TextArea-BO8a85PU.js} +2 -2
  44. package/{TextArea-Cm2_pPET.cjs → TextArea-DWVTIHGF.cjs} +1 -1
  45. package/{Toast-_qUnywNt.js → Toast-CAgEwr7H.js} +1 -1
  46. package/{Toast-Ds5Fo6h5.cjs → Toast-CUMy7sPq.cjs} +1 -1
  47. package/accordion/index.cjs +1 -1
  48. package/accordion/index.js +1 -1
  49. package/assets/AccordionItem.css +1 -1
  50. package/button/index.cjs +1 -1
  51. package/button/index.js +1 -1
  52. package/calendar/index.cjs +1 -1
  53. package/calendar/index.js +1 -1
  54. package/checkbox/index.cjs +1 -1
  55. package/checkbox/index.js +1 -1
  56. package/combobox/index.cjs +1 -1
  57. package/combobox/index.js +1 -1
  58. package/date-field/index.cjs +1 -1
  59. package/date-field/index.js +1 -1
  60. package/date-picker/index.cjs +1 -1
  61. package/date-picker/index.js +1 -1
  62. package/dropdown/index.cjs +1 -1
  63. package/dropdown/index.js +1 -1
  64. package/index.cjs +1 -1
  65. package/index.js +22 -22
  66. package/info-banner/index.cjs +1 -1
  67. package/info-banner/index.js +1 -1
  68. package/label/index.cjs +1 -1
  69. package/label/index.js +1 -1
  70. package/layout/index.cjs +1 -1
  71. package/layout/index.js +1 -1
  72. package/legacy-select/index.cjs +1 -1
  73. package/legacy-select/index.js +1 -1
  74. package/list-box/index.cjs +1 -1
  75. package/list-box/index.js +1 -1
  76. package/modal/index.cjs +1 -1
  77. package/modal/index.js +1 -1
  78. package/package.json +1 -1
  79. package/progress-bar/index.cjs +1 -1
  80. package/progress-bar/index.js +1 -1
  81. package/radio/index.cjs +1 -1
  82. package/radio/index.js +1 -1
  83. package/search-field/index.cjs +1 -1
  84. package/search-field/index.js +1 -1
  85. package/select/index.cjs +1 -1
  86. package/select/index.js +1 -1
  87. package/spinner/index.cjs +1 -1
  88. package/spinner/index.js +1 -1
  89. package/tag/index.cjs +1 -1
  90. package/tag/index.js +1 -1
  91. package/textfield/index.cjs +1 -1
  92. package/textfield/index.js +1 -1
  93. package/toast/index.cjs +1 -1
  94. package/toast/index.js +1 -1
  95. package/AccordionItem-C-gkv3jn.cjs +0 -1
  96. package/Button-Bb0wSnh4.js +0 -44
  97. package/Button-CaPoPCq8.cjs +0 -1
@@ -0,0 +1 @@
1
+ "use strict";require('./assets/AccordionItem.css');const p=require("react/jsx-runtime"),E=require("./clsx-DKOfLqne.cjs"),K=require("./icon-map-BzhRRdiZ.cjs"),d=require("react"),v=require("./Button-BuelSBWx.cjs"),x=require("./utils-ZN3Na38z.cjs"),b=require("./mergeProps-D9EPHb19.cjs"),y=require("./filterDOMProps-WUskt27c.cjs"),C=require("./useControlledState-D0L6S_5r.cjs"),M=require("react-dom"),N=require("./useEvent-DnWDW9C-.cjs"),j=require("./SSRProvider-DZRLwxPS.cjs"),w=require("./useFocusRing-BV6zA8CX.cjs"),B=require("./Button-CPtsYcdR.cjs"),F=require("./Heading-DWSQCI4U.cjs"),W=require("./chevron-down-DyBh7agb.cjs"),k="_root_17bdp_1",T="_contained_17bdp_5",_={root:k,contained:T};function V(i,e,s){let{isDisabled:n}=i,a=b.$bdb11010cef70236$export$f680877a34711e37(),o=b.$bdb11010cef70236$export$f680877a34711e37(),r=j.$b5e257d569688ac6$export$535bd6ca7f90a273(),l=d.useRef(null),u=d.useCallback(()=>{l.current=requestAnimationFrame(()=>{s.current&&s.current.setAttribute("hidden","until-found")}),M.flushSync(()=>{e.toggle()})},[s,e]);N.$e9faafb641e167db$export$90fc3a17d93f704c(s,"beforematch",u);let f=d.useRef(null);return b.$f0a04ccd8dbdd83b$export$e5c5a5f917a5871c(()=>{if(l.current&&cancelAnimationFrame(l.current),s.current&&!n&&!r){let t=s.current;f.current==null||typeof t.getAnimations!="function"?e.isExpanded?(t.removeAttribute("hidden"),t.style.setProperty("--disclosure-panel-width","auto"),t.style.setProperty("--disclosure-panel-height","auto")):(t.setAttribute("hidden","until-found"),t.style.setProperty("--disclosure-panel-width","0px"),t.style.setProperty("--disclosure-panel-height","0px")):e.isExpanded!==f.current&&(e.isExpanded?(t.removeAttribute("hidden"),t.style.setProperty("--disclosure-panel-width",t.scrollWidth+"px"),t.style.setProperty("--disclosure-panel-height",t.scrollHeight+"px"),Promise.all(t.getAnimations().map($=>$.finished)).then(()=>{t.style.setProperty("--disclosure-panel-width","auto"),t.style.setProperty("--disclosure-panel-height","auto")}).catch(()=>{})):(t.style.setProperty("--disclosure-panel-width",t.scrollWidth+"px"),t.style.setProperty("--disclosure-panel-height",t.scrollHeight+"px"),window.getComputedStyle(t).height,t.style.setProperty("--disclosure-panel-width","0px"),t.style.setProperty("--disclosure-panel-height","0px"),Promise.all(t.getAnimations().map($=>$.finished)).then(()=>t.setAttribute("hidden","until-found")).catch(()=>{}))),f.current=e.isExpanded}},[n,s,e.isExpanded,r]),d.useEffect(()=>()=>{l.current&&cancelAnimationFrame(l.current)},[]),{buttonProps:{id:a,"aria-expanded":e.isExpanded,"aria-controls":o,onPress:t=>{!n&&t.pointerType!=="keyboard"&&e.toggle()},isDisabled:n,onPressStart(t){t.pointerType==="keyboard"&&!n&&e.toggle()}},panelProps:{id:o,role:"group","aria-labelledby":a,"aria-hidden":!e.isExpanded,hidden:r||n?n||!e.isExpanded:void 0}}}function z(i){let[e,s]=C.$458b0a5536c1a7cf$export$40bfa8c7b0832715(i.isExpanded,i.defaultExpanded||!1,i.onExpandedChange);const n=d.useCallback(()=>{s(!0)},[s]),a=d.useCallback(()=>{s(!1)},[s]),o=d.useCallback(()=>{s(!e)},[s,e]);return{isExpanded:e,setExpanded:s,expand:n,collapse:a,toggle:o}}function H(i){let{allowsMultipleExpanded:e=!1,isDisabled:s=!1}=i,[n,a]=C.$458b0a5536c1a7cf$export$40bfa8c7b0832715(d.useMemo(()=>i.expandedKeys?new Set(i.expandedKeys):void 0,[i.expandedKeys]),d.useMemo(()=>i.defaultExpandedKeys?new Set(i.defaultExpandedKeys):new Set,[i.defaultExpandedKeys]),i.onExpandedChange);return d.useEffect(()=>{if(!e&&n.size>1){let o=n.values().next().value;o!=null&&a(new Set([o]))}}),{allowsMultipleExpanded:e,isDisabled:s,expandedKeys:n,setExpandedKeys:a,toggleKey(o){let r;e?(r=new Set(n),r.has(o)?r.delete(o):r.add(o)):r=new Set(n.has(o)?[]:[o]),a(r)}}}const D=d.createContext(null),O=d.forwardRef(function(e,s){let n=H(e),a=x.$64fa3d84918910a7$export$4d86445c2cf5e3({...e,defaultClassName:"react-aria-DisclosureGroup",values:{isDisabled:n.isDisabled,state:n}}),o=y.$65484d02dcb7eb3e$export$457c3d6518dd4c6f(e,{global:!0});return d.createElement("div",{...o,...a,ref:s,"data-disabled":e.isDisabled||void 0},d.createElement(D.Provider,{value:n},a.children))}),G=d.createContext(null),J=d.createContext(null),A=d.createContext(null),L=d.forwardRef(function(e,s){[e,s]=x.$64fa3d84918910a7$export$29f1550f4b0d4415(e,s,G);let n=d.useContext(D),{id:a,...o}=e,r=b.$bdb11010cef70236$export$f680877a34711e37();a||(a=r);let l=n?n.expandedKeys.has(a):e.isExpanded,u=z({...e,isExpanded:l,onExpandedChange(S){var h;n&&n.toggleKey(a),(h=e.onExpandedChange)===null||h===void 0||h.call(e,S)}}),f=d.useRef(null),t=e.isDisabled||n?.isDisabled||!1,{buttonProps:$,panelProps:g}=V({...e,isExpanded:l,isDisabled:t},u,f),{isFocusVisible:m,focusProps:R}=w.$f7dceffc5ad7768b$export$4e328f61c538687f({within:!0}),P=x.$64fa3d84918910a7$export$4d86445c2cf5e3({...e,id:void 0,defaultClassName:"react-aria-Disclosure",values:{isExpanded:u.isExpanded,isDisabled:t,isFocusVisibleWithin:m,state:u}}),q=y.$65484d02dcb7eb3e$export$457c3d6518dd4c6f(o,{global:!0});return d.createElement(x.$64fa3d84918910a7$export$2881499e37b75b9a,{values:[[v.$d2b4bc8c273e7be6$export$24d547caef80ccd1,{slots:{[x.$64fa3d84918910a7$export$c62b8e45d58ddad9]:{},trigger:$}}],[A,{panelProps:g,panelRef:f}],[J,u]]},d.createElement("div",{...b.$3ef42575df84b30b$export$9d1611c77c2fe928(q,P,R),ref:s,"data-expanded":u.isExpanded||void 0,"data-disabled":t||void 0,"data-focus-visible-within":m||void 0},P.children))}),Q=d.forwardRef(function(e,s){let{role:n="group"}=e,{panelProps:a,panelRef:o}=d.useContext(A),{isFocusVisible:r,focusProps:l}=w.$f7dceffc5ad7768b$export$4e328f61c538687f({within:!0}),u=x.$64fa3d84918910a7$export$4d86445c2cf5e3({...e,defaultClassName:"react-aria-DisclosurePanel",values:{isFocusVisibleWithin:r}}),f=y.$65484d02dcb7eb3e$export$457c3d6518dd4c6f(e,{global:!0});return d.createElement("div",{...b.$3ef42575df84b30b$export$9d1611c77c2fe928(f,u,a,l),ref:x.$5dc95899b306f630$export$c9058316764c140e(s,o),role:n,"data-focus-visible-within":r||void 0},d.createElement(x.$64fa3d84918910a7$export$2881499e37b75b9a,{values:[[v.$d2b4bc8c273e7be6$export$24d547caef80ccd1,null]]},e.children))}),I=d.createContext(void 0),U=({variant:i,children:e,className:s,isContained:n,size:a="large",...o})=>{const r=n||i==="contained";return p.jsx(I.Provider,{value:{isContained:r,size:a},children:p.jsx(O,{className:E.clsx(_.root,r?_.contained:_.uncontained,s),...o,children:e})})},X="_item_1em4f_1",Y="_contained_1em4f_18",Z="_medium_1em4f_28",ee="_success_1em4f_33",te="_warning_1em4f_39",ne="_info_1em4f_45",se="_important_1em4f_51",de="_triggerButton_1em4f_62",ae="_triggerText_1em4f_66",ie="_trigger_1em4f_62",oe="_triggerMainContent_1em4f_77",re="_chevronIcon_1em4f_94",ce="_statusIcon_1em4f_100",le="_panel_1em4f_122",ue="_content_1em4f_130",fe="_hasBackground_1em4f_135",pe="_header_1em4f_139",c={item:X,contained:Y,medium:Z,success:ee,warning:te,info:ne,important:se,triggerButton:de,triggerText:ae,trigger:ie,triggerMainContent:oe," ":"_ _1em4f_1",chevronIcon:re,statusIcon:ce,panel:le,content:ue,hasBackground:fe,header:pe},xe=({title:i,children:e,className:s,headingLevel:n="h2",type:a,hasBackground:o=!0,size:r="large",isContained:l,...u})=>{const f=d.useContext(I),t=l??f?.isContained??!1,$=typeof i=="object";d.useEffect(()=>{a&&!t&&console.warn("AccordionItem: When 'type' is set, it is recommended to also set 'isContained' to true for visual consistency.")},[a,t]);const g=a?K.iconMap[a]:null,m=g?p.jsx(g,{size:20,className:c.statusIcon}):null;return p.jsxs(L,{...u,className:E.clsx(c.item,a&&c[a],(r==="medium"||f?.size==="medium")&&c.medium,t&&c.contained,s),children:[p.jsx("div",{className:c.trigger,children:p.jsxs(B.Button,{className:c.triggerButton,slot:"trigger",variant:"icon",children:[p.jsx(W.ChevronDown,{size:20,className:c.chevronIcon}),p.jsx("div",{className:c.triggerMainContent,children:$?i:p.jsx(F.Heading,{level:3,elementType:n,className:c.triggerText,children:i})}),m]})}),p.jsx(Q,{className:c.panel,children:p.jsx("div",{className:E.clsx(c.content,o&&c.hasBackground),children:e})})]})};exports.Accordion=U;exports.AccordionItem=xe;
@@ -1,17 +1,17 @@
1
- import { jsx as f, jsxs as I } from "react/jsx-runtime";
1
+ import { jsx as u, jsxs as A } from "react/jsx-runtime";
2
2
  import { c as y } from "./clsx-jbLnTBqA.js";
3
3
  import { i as j } from "./icon-map-Ckc-nEUA.js";
4
- import b, { useRef as A, useCallback as h, useEffect as P, useMemo as K, forwardRef as v, createContext as m, useContext as w } from "react";
5
- import { e as N } from "./Button-DQKRTkoz.js";
6
- import { $ as G, a as C, f as S, g as q, h as O } from "./utils-BJ6_Ry69.js";
7
- import { c as E, $ as J, a as B } from "./mergeProps-oYrDoKjU.js";
4
+ import m, { useRef as K, useCallback as $, useEffect as P, useMemo as N, forwardRef as v, createContext as x, useContext as w } from "react";
5
+ import { e as S } from "./Button-DQKRTkoz.js";
6
+ import { $ as G, a as C, f as B, g as q, h as O } from "./utils-BJ6_Ry69.js";
7
+ import { c as E, $ as J, a as M } from "./mergeProps-oYrDoKjU.js";
8
8
  import { $ as D } from "./filterDOMProps-BSVCO5jK.js";
9
- import { $ as M } from "./useControlledState-u436Wbp1.js";
9
+ import { $ as R } from "./useControlledState-u436Wbp1.js";
10
10
  import { flushSync as L } from "react-dom";
11
11
  import { $ as Q } from "./useEvent-ChPThFqF.js";
12
12
  import { $ as U } from "./SSRProvider-D8lZ0o6A.js";
13
- import { $ as R } from "./useFocusRing-DAZgolYd.js";
14
- import { B as X } from "./Button-Bb0wSnh4.js";
13
+ import { $ as F } from "./useFocusRing-DAZgolYd.js";
14
+ import { B as X } from "./Button-aWvg3R6-.js";
15
15
  import { H as Y } from "./Heading-BRErvUe8.js";
16
16
  import { C as Z } from "./chevron-down-DgT-uSF9.js";
17
17
  import './assets/AccordionItem.css';const ee = "_root_17bdp_1", te = "_contained_17bdp_5", _ = {
@@ -19,7 +19,7 @@ import './assets/AccordionItem.css';const ee = "_root_17bdp_1", te = "_contained
19
19
  contained: te
20
20
  };
21
21
  function ne(i, e, a) {
22
- let { isDisabled: n } = i, s = E(), d = E(), r = U(), l = A(null), c = h(() => {
22
+ let { isDisabled: n } = i, s = E(), d = E(), o = U(), l = K(null), c = $(() => {
23
23
  l.current = requestAnimationFrame(() => {
24
24
  a.current && a.current.setAttribute("hidden", "until-found");
25
25
  }), L(() => {
@@ -30,21 +30,21 @@ function ne(i, e, a) {
30
30
  e
31
31
  ]);
32
32
  Q(a, "beforematch", c);
33
- let u = A(null);
33
+ let f = K(null);
34
34
  return J(() => {
35
- if (l.current && cancelAnimationFrame(l.current), a.current && !n && !r) {
35
+ if (l.current && cancelAnimationFrame(l.current), a.current && !n && !o) {
36
36
  let t = a.current;
37
- u.current == null || typeof t.getAnimations != "function" ? e.isExpanded ? (t.removeAttribute("hidden"), t.style.setProperty("--disclosure-panel-width", "auto"), t.style.setProperty("--disclosure-panel-height", "auto")) : (t.setAttribute("hidden", "until-found"), t.style.setProperty("--disclosure-panel-width", "0px"), t.style.setProperty("--disclosure-panel-height", "0px")) : e.isExpanded !== u.current && (e.isExpanded ? (t.removeAttribute("hidden"), t.style.setProperty("--disclosure-panel-width", t.scrollWidth + "px"), t.style.setProperty("--disclosure-panel-height", t.scrollHeight + "px"), Promise.all(t.getAnimations().map((p) => p.finished)).then(() => {
37
+ f.current == null || typeof t.getAnimations != "function" ? e.isExpanded ? (t.removeAttribute("hidden"), t.style.setProperty("--disclosure-panel-width", "auto"), t.style.setProperty("--disclosure-panel-height", "auto")) : (t.setAttribute("hidden", "until-found"), t.style.setProperty("--disclosure-panel-width", "0px"), t.style.setProperty("--disclosure-panel-height", "0px")) : e.isExpanded !== f.current && (e.isExpanded ? (t.removeAttribute("hidden"), t.style.setProperty("--disclosure-panel-width", t.scrollWidth + "px"), t.style.setProperty("--disclosure-panel-height", t.scrollHeight + "px"), Promise.all(t.getAnimations().map((p) => p.finished)).then(() => {
38
38
  t.style.setProperty("--disclosure-panel-width", "auto"), t.style.setProperty("--disclosure-panel-height", "auto");
39
39
  }).catch(() => {
40
40
  })) : (t.style.setProperty("--disclosure-panel-width", t.scrollWidth + "px"), t.style.setProperty("--disclosure-panel-height", t.scrollHeight + "px"), window.getComputedStyle(t).height, t.style.setProperty("--disclosure-panel-width", "0px"), t.style.setProperty("--disclosure-panel-height", "0px"), Promise.all(t.getAnimations().map((p) => p.finished)).then(() => t.setAttribute("hidden", "until-found")).catch(() => {
41
- }))), u.current = e.isExpanded;
41
+ }))), f.current = e.isExpanded;
42
42
  }
43
43
  }, [
44
44
  n,
45
45
  a,
46
46
  e.isExpanded,
47
- r
47
+ o
48
48
  ]), P(() => () => {
49
49
  l.current && cancelAnimationFrame(l.current);
50
50
  }, []), {
@@ -66,21 +66,21 @@ function ne(i, e, a) {
66
66
  role: "group",
67
67
  "aria-labelledby": s,
68
68
  "aria-hidden": !e.isExpanded,
69
- hidden: r || n ? n || !e.isExpanded : void 0
69
+ hidden: o || n ? n || !e.isExpanded : void 0
70
70
  }
71
71
  };
72
72
  }
73
73
  function ae(i) {
74
- let [e, a] = M(i.isExpanded, i.defaultExpanded || !1, i.onExpandedChange);
75
- const n = h(() => {
74
+ let [e, a] = R(i.isExpanded, i.defaultExpanded || !1, i.onExpandedChange);
75
+ const n = $(() => {
76
76
  a(!0);
77
77
  }, [
78
78
  a
79
- ]), s = h(() => {
79
+ ]), s = $(() => {
80
80
  a(!1);
81
81
  }, [
82
82
  a
83
- ]), d = h(() => {
83
+ ]), d = $(() => {
84
84
  a(!e);
85
85
  }, [
86
86
  a,
@@ -95,9 +95,9 @@ function ae(i) {
95
95
  };
96
96
  }
97
97
  function se(i) {
98
- let { allowsMultipleExpanded: e = !1, isDisabled: a = !1 } = i, [n, s] = M(K(() => i.expandedKeys ? new Set(i.expandedKeys) : void 0, [
98
+ let { allowsMultipleExpanded: e = !1, isDisabled: a = !1 } = i, [n, s] = R(N(() => i.expandedKeys ? new Set(i.expandedKeys) : void 0, [
99
99
  i.expandedKeys
100
- ]), K(() => i.defaultExpandedKeys ? new Set(i.defaultExpandedKeys) : /* @__PURE__ */ new Set(), [
100
+ ]), N(() => i.defaultExpandedKeys ? new Set(i.defaultExpandedKeys) : /* @__PURE__ */ new Set(), [
101
101
  i.defaultExpandedKeys
102
102
  ]), i.onExpandedChange);
103
103
  return P(() => {
@@ -113,14 +113,14 @@ function se(i) {
113
113
  expandedKeys: n,
114
114
  setExpandedKeys: s,
115
115
  toggleKey(d) {
116
- let r;
117
- e ? (r = new Set(n), r.has(d) ? r.delete(d) : r.add(d)) : r = new Set(n.has(d) ? [] : [
116
+ let o;
117
+ e ? (o = new Set(n), o.has(d) ? o.delete(d) : o.add(d)) : o = new Set(n.has(d) ? [] : [
118
118
  d
119
- ]), s(r);
119
+ ]), s(o);
120
120
  }
121
121
  };
122
122
  }
123
- const F = /* @__PURE__ */ m(null), ie = /* @__PURE__ */ v(function(e, a) {
123
+ const W = /* @__PURE__ */ x(null), ie = /* @__PURE__ */ v(function(e, a) {
124
124
  let n = se(e), s = C({
125
125
  ...e,
126
126
  defaultClassName: "react-aria-DisclosureGroup",
@@ -131,48 +131,48 @@ const F = /* @__PURE__ */ m(null), ie = /* @__PURE__ */ v(function(e, a) {
131
131
  }), d = D(e, {
132
132
  global: !0
133
133
  });
134
- return /* @__PURE__ */ b.createElement("div", {
134
+ return /* @__PURE__ */ m.createElement("div", {
135
135
  ...d,
136
136
  ...s,
137
137
  ref: a,
138
138
  "data-disabled": e.isDisabled || void 0
139
- }, /* @__PURE__ */ b.createElement(F.Provider, {
139
+ }, /* @__PURE__ */ m.createElement(W.Provider, {
140
140
  value: n
141
141
  }, s.children));
142
- }), de = /* @__PURE__ */ m(null), re = /* @__PURE__ */ m(null), W = /* @__PURE__ */ m(null), oe = /* @__PURE__ */ v(function(e, a) {
142
+ }), de = /* @__PURE__ */ x(null), oe = /* @__PURE__ */ x(null), T = /* @__PURE__ */ x(null), re = /* @__PURE__ */ v(function(e, a) {
143
143
  [e, a] = G(e, a, de);
144
- let n = w(F), { id: s, ...d } = e, r = E();
145
- s || (s = r);
144
+ let n = w(W), { id: s, ...d } = e, o = E();
145
+ s || (s = o);
146
146
  let l = n ? n.expandedKeys.has(s) : e.isExpanded, c = ae({
147
147
  ...e,
148
148
  isExpanded: l,
149
149
  onExpandedChange(H) {
150
- var $;
151
- n && n.toggleKey(s), ($ = e.onExpandedChange) === null || $ === void 0 || $.call(e, H);
150
+ var b;
151
+ n && n.toggleKey(s), (b = e.onExpandedChange) === null || b === void 0 || b.call(e, H);
152
152
  }
153
- }), u = b.useRef(null), t = e.isDisabled || n?.isDisabled || !1, { buttonProps: p, panelProps: x } = ne({
153
+ }), f = m.useRef(null), t = e.isDisabled || n?.isDisabled || !1, { buttonProps: p, panelProps: g } = ne({
154
154
  ...e,
155
155
  isExpanded: l,
156
156
  isDisabled: t
157
- }, c, u), { isFocusVisible: g, focusProps: V } = R({
157
+ }, c, f), { isFocusVisible: h, focusProps: k } = F({
158
158
  within: !0
159
- }), k = C({
159
+ }), I = C({
160
160
  ...e,
161
161
  id: void 0,
162
162
  defaultClassName: "react-aria-Disclosure",
163
163
  values: {
164
164
  isExpanded: c.isExpanded,
165
165
  isDisabled: t,
166
- isFocusVisibleWithin: g,
166
+ isFocusVisibleWithin: h,
167
167
  state: c
168
168
  }
169
169
  }), z = D(d, {
170
170
  global: !0
171
171
  });
172
- return /* @__PURE__ */ b.createElement(S, {
172
+ return /* @__PURE__ */ m.createElement(B, {
173
173
  values: [
174
174
  [
175
- N,
175
+ S,
176
176
  {
177
177
  slots: {
178
178
  [q]: {},
@@ -181,50 +181,50 @@ const F = /* @__PURE__ */ m(null), ie = /* @__PURE__ */ v(function(e, a) {
181
181
  }
182
182
  ],
183
183
  [
184
- W,
184
+ T,
185
185
  {
186
- panelProps: x,
187
- panelRef: u
186
+ panelProps: g,
187
+ panelRef: f
188
188
  }
189
189
  ],
190
190
  [
191
- re,
191
+ oe,
192
192
  c
193
193
  ]
194
194
  ]
195
- }, /* @__PURE__ */ b.createElement("div", {
196
- ...B(z, k, V),
195
+ }, /* @__PURE__ */ m.createElement("div", {
196
+ ...M(z, I, k),
197
197
  ref: a,
198
198
  "data-expanded": c.isExpanded || void 0,
199
199
  "data-disabled": t || void 0,
200
- "data-focus-visible-within": g || void 0
201
- }, k.children));
200
+ "data-focus-visible-within": h || void 0
201
+ }, I.children));
202
202
  }), le = /* @__PURE__ */ v(function(e, a) {
203
- let { role: n = "group" } = e, { panelProps: s, panelRef: d } = w(W), { isFocusVisible: r, focusProps: l } = R({
203
+ let { role: n = "group" } = e, { panelProps: s, panelRef: d } = w(T), { isFocusVisible: o, focusProps: l } = F({
204
204
  within: !0
205
205
  }), c = C({
206
206
  ...e,
207
207
  defaultClassName: "react-aria-DisclosurePanel",
208
208
  values: {
209
- isFocusVisibleWithin: r
209
+ isFocusVisibleWithin: o
210
210
  }
211
- }), u = D(e, {
211
+ }), f = D(e, {
212
212
  global: !0
213
213
  });
214
- return /* @__PURE__ */ b.createElement("div", {
215
- ...B(u, c, s, l),
214
+ return /* @__PURE__ */ m.createElement("div", {
215
+ ...M(f, c, s, l),
216
216
  ref: O(a, d),
217
217
  role: n,
218
- "data-focus-visible-within": r || void 0
219
- }, /* @__PURE__ */ b.createElement(S, {
218
+ "data-focus-visible-within": o || void 0
219
+ }, /* @__PURE__ */ m.createElement(B, {
220
220
  values: [
221
221
  [
222
- N,
222
+ S,
223
223
  null
224
224
  ]
225
225
  ]
226
226
  }, e.children));
227
- }), T = m(void 0), je = ({
227
+ }), V = x(void 0), je = ({
228
228
  variant: i,
229
229
  children: e,
230
230
  className: a,
@@ -232,32 +232,32 @@ const F = /* @__PURE__ */ m(null), ie = /* @__PURE__ */ v(function(e, a) {
232
232
  size: s = "large",
233
233
  ...d
234
234
  }) => {
235
- const r = n || i === "contained";
236
- return /* @__PURE__ */ f(T.Provider, { value: { isContained: r, size: s }, children: /* @__PURE__ */ f(
235
+ const o = n || i === "contained";
236
+ return /* @__PURE__ */ u(V.Provider, { value: { isContained: o, size: s }, children: /* @__PURE__ */ u(
237
237
  ie,
238
238
  {
239
239
  className: y(
240
240
  _.root,
241
- r ? _.contained : _.uncontained,
241
+ o ? _.contained : _.uncontained,
242
242
  a
243
243
  ),
244
244
  ...d,
245
245
  children: e
246
246
  }
247
247
  ) });
248
- }, ce = "_item_bbrk2_1", ue = "_contained_bbrk2_18", fe = "_medium_bbrk2_28", pe = "_success_bbrk2_33", be = "_warning_bbrk2_39", me = "_info_bbrk2_45", xe = "_important_bbrk2_51", ge = "_triggerButton_bbrk2_62", he = "_triggerText_bbrk2_66", $e = "_trigger_bbrk2_62", _e = "_triggerMainContent_bbrk2_79", ye = "_chevronIcon_bbrk2_96", Ee = "_statusIcon_bbrk2_102", Pe = "_panel_bbrk2_120", ve = "_content_bbrk2_128", we = "_hasBackground_bbrk2_133", Ce = "_header_bbrk2_137", o = {
248
+ }, ce = "_item_1em4f_1", fe = "_contained_1em4f_18", ue = "_medium_1em4f_28", pe = "_success_1em4f_33", me = "_warning_1em4f_39", xe = "_info_1em4f_45", ge = "_important_1em4f_51", he = "_triggerButton_1em4f_62", $e = "_triggerText_1em4f_66", be = "_trigger_1em4f_62", _e = "_triggerMainContent_1em4f_77", ye = "_chevronIcon_1em4f_94", Ee = "_statusIcon_1em4f_100", Pe = "_panel_1em4f_122", ve = "_content_1em4f_130", we = "_hasBackground_1em4f_135", Ce = "_header_1em4f_139", r = {
249
249
  item: ce,
250
- contained: ue,
251
- medium: fe,
250
+ contained: fe,
251
+ medium: ue,
252
252
  success: pe,
253
- warning: be,
254
- info: me,
255
- important: xe,
256
- triggerButton: ge,
257
- triggerText: he,
258
- trigger: $e,
253
+ warning: me,
254
+ info: xe,
255
+ important: ge,
256
+ triggerButton: he,
257
+ triggerText: $e,
258
+ trigger: be,
259
259
  triggerMainContent: _e,
260
- " ": "_ _bbrk2_1",
260
+ " ": "_ _1em4f_1",
261
261
  chevronIcon: ye,
262
262
  statusIcon: Ee,
263
263
  panel: Pe,
@@ -271,68 +271,68 @@ const F = /* @__PURE__ */ m(null), ie = /* @__PURE__ */ v(function(e, a) {
271
271
  headingLevel: n = "h2",
272
272
  type: s,
273
273
  hasBackground: d = !0,
274
- size: r = "large",
274
+ size: o = "large",
275
275
  isContained: l,
276
276
  ...c
277
277
  }) => {
278
- const u = w(T), t = l ?? u?.isContained ?? !1, p = typeof i == "object";
278
+ const f = w(V), t = l ?? f?.isContained ?? !1, p = typeof i == "object";
279
279
  P(() => {
280
280
  s && !t && console.warn(
281
281
  "AccordionItem: When 'type' is set, it is recommended to also set 'isContained' to true for visual consistency."
282
282
  );
283
283
  }, [s, t]);
284
- const x = s ? j[s] : null, g = x ? /* @__PURE__ */ f(
285
- x,
284
+ const g = s ? j[s] : null, h = g ? /* @__PURE__ */ u(
285
+ g,
286
286
  {
287
287
  size: 20,
288
- className: o.statusIcon
288
+ className: r.statusIcon
289
289
  }
290
290
  ) : null;
291
- return /* @__PURE__ */ I(
292
- oe,
291
+ return /* @__PURE__ */ A(
292
+ re,
293
293
  {
294
294
  ...c,
295
295
  className: y(
296
- o.item,
297
- s && o[s],
298
- (r === "medium" || u?.size === "medium") && o.medium,
299
- t && o.contained,
296
+ r.item,
297
+ s && r[s],
298
+ (o === "medium" || f?.size === "medium") && r.medium,
299
+ t && r.contained,
300
300
  a
301
301
  ),
302
302
  children: [
303
- /* @__PURE__ */ f("div", { className: o.trigger, children: /* @__PURE__ */ I(
303
+ /* @__PURE__ */ u("div", { className: r.trigger, children: /* @__PURE__ */ A(
304
304
  X,
305
305
  {
306
- className: o.triggerButton,
306
+ className: r.triggerButton,
307
307
  slot: "trigger",
308
308
  variant: "icon",
309
309
  children: [
310
- /* @__PURE__ */ f(
310
+ /* @__PURE__ */ u(
311
311
  Z,
312
312
  {
313
313
  size: 20,
314
- className: o.chevronIcon
314
+ className: r.chevronIcon
315
315
  }
316
316
  ),
317
- /* @__PURE__ */ f("div", { className: o.triggerMainContent, children: p ? i : /* @__PURE__ */ f(
317
+ /* @__PURE__ */ u("div", { className: r.triggerMainContent, children: p ? i : /* @__PURE__ */ u(
318
318
  Y,
319
319
  {
320
320
  level: 3,
321
321
  elementType: n,
322
- className: o.triggerText,
322
+ className: r.triggerText,
323
323
  children: i
324
324
  }
325
325
  ) }),
326
- g
326
+ h
327
327
  ]
328
328
  }
329
329
  ) }),
330
- /* @__PURE__ */ f(le, { className: o.panel, children: /* @__PURE__ */ f(
330
+ /* @__PURE__ */ u(le, { className: r.panel, children: /* @__PURE__ */ u(
331
331
  "div",
332
332
  {
333
333
  className: y(
334
- o.content,
335
- d && o.hasBackground
334
+ r.content,
335
+ d && r.hasBackground
336
336
  ),
337
337
  children: e
338
338
  }
@@ -0,0 +1 @@
1
+ "use strict";const n=require("react/jsx-runtime"),t=require("./Button.module-COONZqNU.cjs"),d=require("./Button-BuelSBWx.cjs"),y=require("./clsx-DKOfLqne.cjs"),B=require("./Spinner-6nei2CMj.cjs"),m=({variant:e="primary",fullwidth:i,className:u,iconPlacement:o,size:c="large",icon:s,iconSize:l,...r})=>n.jsx(d.$d2b4bc8c273e7be6$export$353f5b6fc5456de1,{className:y.clsx(t.ButtonStyles.button,e==="primary"&&t.ButtonStyles.primary,e==="secondary"&&t.ButtonStyles.secondary,e==="tertiary"&&t.ButtonStyles.tertiary,e==="danger"&&t.ButtonStyles.danger,e==="icon"&&t.ButtonStyles.iconBtn,i&&t.ButtonStyles.fullwidth,c==="medium"&&t.ButtonStyles.medium,o==="right"&&t.ButtonStyles.iconRight,u),...r,children:n.jsxs(n.Fragment,{children:[s&&!r.isPending&&n.jsx(s,{"aria-hidden":!0,size:l??20}),r.isPending&&n.jsx(B.Spinner,{small:!0}),r.children]})});exports.Button=m;
@@ -0,0 +1,46 @@
1
+ import { jsx as m, jsxs as a, Fragment as l } from "react/jsx-runtime";
2
+ import { B as r } from "./Button.module-Cm0H98vy.js";
3
+ import { $ as p } from "./Button-DQKRTkoz.js";
4
+ import { c as u } from "./clsx-jbLnTBqA.js";
5
+ import { S as f } from "./Spinner-C29Pyxlj.js";
6
+ const B = ({
7
+ variant: i = "primary",
8
+ fullwidth: t,
9
+ className: n,
10
+ iconPlacement: d,
11
+ size: s = "large",
12
+ icon: o,
13
+ iconSize: c,
14
+ ...e
15
+ }) => /* @__PURE__ */ m(
16
+ p,
17
+ {
18
+ className: u(
19
+ r.button,
20
+ i === "primary" && r.primary,
21
+ i === "secondary" && r.secondary,
22
+ i === "tertiary" && r.tertiary,
23
+ i === "danger" && r.danger,
24
+ i === "icon" && r.iconBtn,
25
+ t && r.fullwidth,
26
+ s === "medium" && r.medium,
27
+ d === "right" && r.iconRight,
28
+ n
29
+ ),
30
+ ...e,
31
+ children: /* @__PURE__ */ a(l, { children: [
32
+ o && !e.isPending && /* @__PURE__ */ m(
33
+ o,
34
+ {
35
+ "aria-hidden": !0,
36
+ size: c ?? 20
37
+ }
38
+ ),
39
+ e.isPending && /* @__PURE__ */ m(f, { small: !0 }),
40
+ e.children
41
+ ] })
42
+ }
43
+ );
44
+ export {
45
+ B
46
+ };
package/CHANGELOG.md CHANGED
@@ -1,3 +1,19 @@
1
+ ## 15.2.13 (2025-11-21)
2
+
3
+ ### 🩹 Fixes
4
+
5
+ - **accordion:** remove z-index ([09d96ce3ee](https://github.com/migrationsverket/midas/commit/09d96ce3ee))
6
+
7
+ ### 🔧 Maintenance
8
+
9
+ - **components:** update storybook link in README.md ([498c57be64](https://github.com/migrationsverket/midas/commit/498c57be64))
10
+
11
+ ## 15.2.12 (2025-11-18)
12
+
13
+ ### 🚀 Features
14
+
15
+ - **button:** add spinner to pending buttons ([a876074bac](https://github.com/migrationsverket/midas/commit/a876074bac))
16
+
1
17
  ## 15.2.11 (2025-11-18)
2
18
 
3
19
  ### 🚀 Features
@@ -1,5 +1,5 @@
1
1
  import { jsx as s, jsxs as h } from "react/jsx-runtime";
2
- import { a as V, L as y } from "./Label-knQhhLVp.js";
2
+ import { a as V, L as y } from "./Label-AgADiPwL.js";
3
3
  import { T as S } from "./Text-6Fdknq88.js";
4
4
  import * as m from "react";
5
5
  import { useState as C, useRef as R } from "react";
@@ -1 +1 @@
1
- "use strict";const n=require("react/jsx-runtime"),m=require("./Label-DkNtFYv5.cjs"),S=require("./Text-D29KP4_q.cjs"),$=require("react"),b=require("./Checkbox-LGIr8OfT.cjs"),g=require("./FieldError-DwYQXCwP.cjs"),P=require("./useFormValidation-pVNhWoaN.cjs"),C=require("./useControlledState-D0L6S_5r.cjs"),j=require("./mergeProps-D9EPHb19.cjs"),q=require("./filterDOMProps-WUskt27c.cjs"),O=require("./useField-yjDSH-M4.cjs"),R=require("./useFocusWithin-CrScjOpV.cjs"),k=require("./useLocalizedStringFormatter-Dfow0G-0.cjs");function D(e){const i=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const a in e)if(a!=="default"){const s=Object.getOwnPropertyDescriptor(e,a);Object.defineProperty(i,a,s.get?s:{enumerable:!0,get:()=>e[a]})}}return i.default=e,Object.freeze(i)}const v=D($);function F(e,i){let{isDisabled:a,name:s,form:u,validationBehavior:d="aria"}=e,{isInvalid:r,validationErrors:c,validationDetails:l}=i.displayValidation,{labelProps:f,fieldProps:x,descriptionProps:t,errorMessageProps:o}=O.$2baaea4c71418dea$export$294aa081a6c6f55d({...e,labelElementType:"span",isInvalid:r,errorMessage:e.errorMessage||c});b.$1ae600c947479353$export$ec98120685d4f57d.set(i,{name:s,form:u,descriptionId:t.id,errorMessageId:o.id,validationBehavior:d});let h=q.$65484d02dcb7eb3e$export$457c3d6518dd4c6f(e,{labelable:!0}),{focusWithinProps:V}=R.$9ab94262bd0047c7$export$420e68273165f4ec({onBlurWithin:e.onBlur,onFocusWithin:e.onFocus,onFocusWithinChange:e.onFocusChange});return{groupProps:j.$3ef42575df84b30b$export$9d1611c77c2fe928(h,{role:"group","aria-disabled":a||void 0,...x,...V}),labelProps:f,descriptionProps:t,errorMessageProps:o,isInvalid:r,validationErrors:c,validationDetails:l}}function I(e={}){let[i,a]=C.$458b0a5536c1a7cf$export$40bfa8c7b0832715(e.value,e.defaultValue||[],e.onChange),[s]=$.useState(i),u=!!e.isRequired&&i.length===0,d=$.useRef(new Map),r=P.$e5be200c675c3b3a$export$fc1a364ae1f3ff10({...e,value:i}),c=r.displayValidation.isInvalid;var l,f;return{...r,value:i,defaultValue:(l=e.defaultValue)!==null&&l!==void 0?l:s,setValue(t){e.isReadOnly||e.isDisabled||a(t)},isDisabled:e.isDisabled||!1,isReadOnly:e.isReadOnly||!1,isSelected(t){return i.includes(t)},addValue(t){e.isReadOnly||e.isDisabled||i.includes(t)||(i=i.concat(t),a(i))},removeValue(t){e.isReadOnly||e.isDisabled||i.includes(t)&&a(i.filter(o=>o!==t))},toggleValue(t){e.isReadOnly||e.isDisabled||(i.includes(t)?a(i.filter(o=>o!==t)):a(i.concat(t)))},setInvalid(t,o){let h=new Map(d.current);o.isInvalid?h.set(t,o):h.delete(t),d.current=h,r.updateValidation(P.$e5be200c675c3b3a$export$75ee7c75d68f5b0e(...h.values()))},validationState:(f=e.validationState)!==null&&f!==void 0?f:c?"invalid":null,isInvalid:c,isRequired:u}}const M=(e,{value:i})=>{const a=v.Children.toArray(e).filter(l=>v.isValidElement(l)&&l.type===b.Checkbox),s=v.Children.count(a),u=v.Children.toArray(e).filter(l=>v.isValidElement(l)).filter(l=>!!l&&l.type===b.Checkbox).map(l=>l.props.value),d=i.length===0,r=i.length===s;return{allSelected:r,someSelected:!d&&!r,checkboxValues:u}},y=({state:e,errorMessage:i})=>n.jsx(g.$ee014567cb39d3f0$export$ff05c3ac10437e03.Provider,{value:e.displayValidation,children:n.jsx(g.FieldError,{children:i})}),E={selectAll:"Select all"},A={selectAll:"Välj alla"},L={en:E,sv:A};function W(e){const i=I(e),a=k.useLocalizedStringFormatter(L),{groupProps:s,labelProps:u,descriptionProps:d}=F(e,i),{allSelected:r,someSelected:c,checkboxValues:l}=M(e.children,i),f=x=>{i.setValue(x?l:[])};return n.jsxs("div",{...s,className:b.styles.checkboxGroup,"data-readonly":e.isReadOnly||void 0,"data-disabled":e.isDisabled||void 0,children:[n.jsx(m.LabelWrapper,{popover:e.popover,children:e.label&&n.jsx(m.Label,{...u,children:e.label})}),e.description&&n.jsx(S.Text,{slot:"description",...d,children:e.description}),e.errorPosition==="top"&&n.jsx(y,{...e,state:i}),n.jsxs("div",{className:b.styles.checkboxList,children:[e.showSelectAll&&n.jsx(b.Checkbox,{isSelected:r,isIndeterminate:c,isReadOnly:e.isReadOnly,onChange:f,children:e.selectAllLabel||a.format("selectAll")}),n.jsx(b.CheckboxGroupContext.Provider,{value:i,children:e.children})]}),e.errorPosition==="bottom"&&n.jsx(y,{...e,state:i})]})}exports.CheckboxGroup=W;
1
+ "use strict";const n=require("react/jsx-runtime"),m=require("./Label-Dn9QqKX8.cjs"),S=require("./Text-D29KP4_q.cjs"),$=require("react"),b=require("./Checkbox-LGIr8OfT.cjs"),g=require("./FieldError-DwYQXCwP.cjs"),P=require("./useFormValidation-pVNhWoaN.cjs"),C=require("./useControlledState-D0L6S_5r.cjs"),j=require("./mergeProps-D9EPHb19.cjs"),q=require("./filterDOMProps-WUskt27c.cjs"),O=require("./useField-yjDSH-M4.cjs"),R=require("./useFocusWithin-CrScjOpV.cjs"),k=require("./useLocalizedStringFormatter-Dfow0G-0.cjs");function D(e){const i=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const a in e)if(a!=="default"){const s=Object.getOwnPropertyDescriptor(e,a);Object.defineProperty(i,a,s.get?s:{enumerable:!0,get:()=>e[a]})}}return i.default=e,Object.freeze(i)}const v=D($);function F(e,i){let{isDisabled:a,name:s,form:u,validationBehavior:d="aria"}=e,{isInvalid:r,validationErrors:c,validationDetails:l}=i.displayValidation,{labelProps:f,fieldProps:x,descriptionProps:t,errorMessageProps:o}=O.$2baaea4c71418dea$export$294aa081a6c6f55d({...e,labelElementType:"span",isInvalid:r,errorMessage:e.errorMessage||c});b.$1ae600c947479353$export$ec98120685d4f57d.set(i,{name:s,form:u,descriptionId:t.id,errorMessageId:o.id,validationBehavior:d});let h=q.$65484d02dcb7eb3e$export$457c3d6518dd4c6f(e,{labelable:!0}),{focusWithinProps:V}=R.$9ab94262bd0047c7$export$420e68273165f4ec({onBlurWithin:e.onBlur,onFocusWithin:e.onFocus,onFocusWithinChange:e.onFocusChange});return{groupProps:j.$3ef42575df84b30b$export$9d1611c77c2fe928(h,{role:"group","aria-disabled":a||void 0,...x,...V}),labelProps:f,descriptionProps:t,errorMessageProps:o,isInvalid:r,validationErrors:c,validationDetails:l}}function I(e={}){let[i,a]=C.$458b0a5536c1a7cf$export$40bfa8c7b0832715(e.value,e.defaultValue||[],e.onChange),[s]=$.useState(i),u=!!e.isRequired&&i.length===0,d=$.useRef(new Map),r=P.$e5be200c675c3b3a$export$fc1a364ae1f3ff10({...e,value:i}),c=r.displayValidation.isInvalid;var l,f;return{...r,value:i,defaultValue:(l=e.defaultValue)!==null&&l!==void 0?l:s,setValue(t){e.isReadOnly||e.isDisabled||a(t)},isDisabled:e.isDisabled||!1,isReadOnly:e.isReadOnly||!1,isSelected(t){return i.includes(t)},addValue(t){e.isReadOnly||e.isDisabled||i.includes(t)||(i=i.concat(t),a(i))},removeValue(t){e.isReadOnly||e.isDisabled||i.includes(t)&&a(i.filter(o=>o!==t))},toggleValue(t){e.isReadOnly||e.isDisabled||(i.includes(t)?a(i.filter(o=>o!==t)):a(i.concat(t)))},setInvalid(t,o){let h=new Map(d.current);o.isInvalid?h.set(t,o):h.delete(t),d.current=h,r.updateValidation(P.$e5be200c675c3b3a$export$75ee7c75d68f5b0e(...h.values()))},validationState:(f=e.validationState)!==null&&f!==void 0?f:c?"invalid":null,isInvalid:c,isRequired:u}}const M=(e,{value:i})=>{const a=v.Children.toArray(e).filter(l=>v.isValidElement(l)&&l.type===b.Checkbox),s=v.Children.count(a),u=v.Children.toArray(e).filter(l=>v.isValidElement(l)).filter(l=>!!l&&l.type===b.Checkbox).map(l=>l.props.value),d=i.length===0,r=i.length===s;return{allSelected:r,someSelected:!d&&!r,checkboxValues:u}},y=({state:e,errorMessage:i})=>n.jsx(g.$ee014567cb39d3f0$export$ff05c3ac10437e03.Provider,{value:e.displayValidation,children:n.jsx(g.FieldError,{children:i})}),E={selectAll:"Select all"},A={selectAll:"Välj alla"},L={en:E,sv:A};function W(e){const i=I(e),a=k.useLocalizedStringFormatter(L),{groupProps:s,labelProps:u,descriptionProps:d}=F(e,i),{allSelected:r,someSelected:c,checkboxValues:l}=M(e.children,i),f=x=>{i.setValue(x?l:[])};return n.jsxs("div",{...s,className:b.styles.checkboxGroup,"data-readonly":e.isReadOnly||void 0,"data-disabled":e.isDisabled||void 0,children:[n.jsx(m.LabelWrapper,{popover:e.popover,children:e.label&&n.jsx(m.Label,{...u,children:e.label})}),e.description&&n.jsx(S.Text,{slot:"description",...d,children:e.description}),e.errorPosition==="top"&&n.jsx(y,{...e,state:i}),n.jsxs("div",{className:b.styles.checkboxList,children:[e.showSelectAll&&n.jsx(b.Checkbox,{isSelected:r,isIndeterminate:c,isReadOnly:e.isReadOnly,onChange:f,children:e.selectAllLabel||a.format("selectAll")}),n.jsx(b.CheckboxGroupContext.Provider,{value:i,children:e.children})]}),e.errorPosition==="bottom"&&n.jsx(y,{...e,state:i})]})}exports.CheckboxGroup=W;