@midas-ds/components 15.1.3 → 15.2.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 +43 -0
- package/{CharacterCounter-CTpQ12f7.cjs → CharacterCounter-BjOzWOoN.cjs} +1 -1
- package/{CharacterCounter-gbDGfize.js → CharacterCounter-b6RpXKDF.js} +5 -5
- package/Checkbox-D9X5vM4a.cjs +6 -0
- package/Checkbox-ujNi8mrO.js +288 -0
- package/{CheckboxGroup-BkzQi1FB.js → CheckboxGroup-BeBThHOu.js} +16 -13
- package/CheckboxGroup-BmEiqFKx.cjs +1 -0
- package/{ComboBox-t1RVXiiQ.js → ComboBox-BGXUTKrW.js} +138 -142
- package/{ComboBox-BISNYEw3.cjs → ComboBox-lteAZwCb.cjs} +1 -1
- package/DateField-ZPcapPji.cjs +1 -0
- package/DateField-snXaUoBR.js +45 -0
- package/{DateInputDivider-DOHpVaNE.js → DateInputDivider-BjVsNVEk.js} +1 -1
- package/{DateInputDivider-CCrXjsUB.cjs → DateInputDivider-YOvEmapQ.cjs} +1 -1
- package/{DateRangePicker-mlnh0C1A.cjs → DateRangePicker-Biwt-Q8X.cjs} +2 -2
- package/{DateRangePicker-ezrFzzrO.js → DateRangePicker-CgvPZfMd.js} +168 -165
- package/{FieldError-JWxR_EqN.cjs → FieldError-DHzrxRPt.cjs} +1 -1
- package/{FieldError-CIxlNQCM.js → FieldError-DtEDCIQK.js} +1 -1
- package/{Label-C3ZSrB04.cjs → Label-Cbp1q387.cjs} +1 -1
- package/{Label-BqvFQoEF.js → Label-DH4JI6a4.js} +5 -5
- package/Layout-DQiqgjqR.cjs +16 -0
- package/{Layout-Hd1e_MEA.js → Layout-FveYuBny.js} +59 -58
- package/{ListBox-Rke-lL0z.cjs → ListBox-CMM6O46x.cjs} +1 -1
- package/{ListBox-BP_jDOdE.js → ListBox-CfzKpJFW.js} +26 -26
- package/{ListBoxLoadMoreItem-8dHDWs3w.cjs → ListBoxLoadMoreItem-10BeO9ux.cjs} +1 -1
- package/{ListBoxLoadMoreItem-BE5zpVVP.js → ListBoxLoadMoreItem-k-uwDi4f.js} +1 -1
- package/ListBoxSection-B5l2LIMZ.cjs +1 -0
- package/ListBoxSection-XoMfdRLd.js +51 -0
- package/{ProgressBar-BrtaxoR8.cjs → ProgressBar-C6ExqGom.cjs} +1 -1
- package/{ProgressBar-DhVQOs4P.js → ProgressBar-CePyiuw1.js} +1 -1
- package/{Radio-DClH8mWz.js → Radio-CNO4IHkf.js} +28 -28
- package/{Radio-VFIiuJIR.cjs → Radio-bfeheQ39.cjs} +1 -1
- package/{RangeCalendar-CH0CyBui.cjs → RangeCalendar-D7xj3ObC.cjs} +2 -2
- package/{RangeCalendar-DT_KVd80.js → RangeCalendar-DKsuoiPF.js} +101 -92
- package/{SearchField-Cd6X2rY4.js → SearchField-3XoN9q0k.js} +2 -2
- package/{SearchField-Cz5Pb0XE.cjs → SearchField-ClK2IHpM.cjs} +1 -1
- package/{Select-DL5Mvadi.cjs → Select-C1rNC9sy.cjs} +1 -1
- package/Select-CCyvb02g.cjs +1 -0
- package/{Select-zDwMkzOI.js → Select-mz65sX1p.js} +7 -8
- package/{Select-D4xRL7l2.js → Select-oiNYST-S.js} +5 -5
- package/{Table-DxqKDp7N.js → Table-3x_iGkVe.js} +1 -1
- package/{Table-B1nxmW14.cjs → Table-BKbmV4Yp.cjs} +1 -1
- package/{Text-BBFWBNAH.js → Text-CnY7jiPS.js} +9 -9
- package/Text-DUIBTA3N.cjs +1 -0
- package/{TextArea-CcKY4TI2.js → TextArea-Bzgu6xU_.js} +6 -6
- package/{TextArea-D68vGjYJ.cjs → TextArea-DPeIoF7V.cjs} +1 -1
- package/{TextField-DtD9-arA.cjs → TextField-CdhdTYjC.cjs} +1 -1
- package/{TextField-DyR61bjZ.js → TextField-DFMRyd9V.js} +1 -1
- package/TextField.module-D9xjQoiS.js +13 -0
- package/TextField.module-gwQfMD2x.cjs +1 -0
- package/assets/CharacterCounter.css +1 -1
- package/assets/Checkbox.css +1 -1
- package/assets/ComboBox.css +1 -1
- package/assets/DateField.css +1 -1
- package/assets/DateRangePicker.css +1 -1
- package/assets/Label.css +1 -1
- package/assets/ListBox.css +1 -1
- package/assets/Radio.css +1 -1
- package/assets/RangeCalendar.css +1 -1
- package/assets/Text.css +1 -1
- package/assets/TextField.css +1 -1
- package/assets/default.css +1 -1
- package/calendar/CalendarGrid.d.ts +1 -0
- package/calendar/CalendarHeader.d.ts +3 -1
- package/calendar/index.cjs +1 -1
- package/calendar/index.js +1 -1
- package/character-counter/index.cjs +1 -1
- package/character-counter/index.js +1 -1
- package/checkbox/index.cjs +1 -1
- package/checkbox/index.js +2 -2
- package/combobox/ComboBox.d.ts +10 -3
- package/combobox/index.cjs +1 -1
- package/combobox/index.js +1 -1
- package/combobox/utils.d.ts +12 -3
- package/date-field/index.cjs +1 -1
- package/date-field/index.js +2 -2
- package/date-picker/DatePicker.d.ts +1 -2
- package/date-picker/DatePickerInputField.d.ts +2 -5
- package/date-picker/index.cjs +1 -1
- package/date-picker/index.js +1 -1
- package/field-error/index.cjs +1 -1
- package/field-error/index.js +1 -1
- package/index.cjs +1 -1
- package/index.js +22 -22
- package/label/index.cjs +1 -1
- package/label/index.js +1 -1
- package/layout/index.cjs +1 -1
- package/layout/index.js +1 -1
- package/legacy-select/Select.d.ts +1 -1
- package/legacy-select/index.cjs +1 -1
- package/legacy-select/index.js +1 -1
- package/legacy-select/types.d.ts +3 -0
- package/list-box/ListBoxItem.d.ts +3 -9
- package/list-box/ListBoxSection.d.ts +6 -3
- package/list-box/index.cjs +1 -1
- package/list-box/index.js +3 -3
- package/list-box/types.d.ts +6 -0
- package/package.json +2 -2
- package/progress-bar/index.cjs +1 -1
- package/progress-bar/index.js +1 -1
- package/radio/index.cjs +1 -1
- package/radio/index.js +1 -1
- package/search-field/index.cjs +1 -1
- package/search-field/index.js +1 -1
- package/select/index.cjs +1 -1
- package/select/index.js +1 -1
- package/table/index.cjs +1 -1
- package/table/index.js +1 -1
- package/text/index.cjs +1 -1
- package/text/index.js +1 -1
- package/textfield/index.cjs +1 -1
- package/textfield/index.js +1 -1
- package/variables-BkqZ2WGF.js +5 -0
- package/variables-CVumCR9l.cjs +1 -0
- package/Checkbox-BgrLxY6P.cjs +0 -1
- package/Checkbox-CdN1D5pD.js +0 -282
- package/CheckboxGroup-BdRG71EM.cjs +0 -1
- package/DateField-B9Yxknuy.cjs +0 -1
- package/DateField-BUZ7i9eS.js +0 -47
- package/Layout-BrEuHajQ.cjs +0 -16
- package/ListBoxSection-7Xzi-bqq.cjs +0 -1
- package/ListBoxSection-AIWxdu1v.js +0 -53
- package/Select-CHJefc5g.cjs +0 -1
- package/Text-D5OSv6Uv.cjs +0 -1
- package/TextField.module-BndKUn-7.js +0 -13
- package/TextField.module-Du0bmSGZ.cjs +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,46 @@
|
|
|
1
|
+
## 15.2.1 (2025-11-10)
|
|
2
|
+
|
|
3
|
+
### 🩹 Fixes
|
|
4
|
+
|
|
5
|
+
- **combobox:** use common ListBox component ([9bd9854d92](https://github.com/migrationsverket/midas/commit/9bd9854d92))
|
|
6
|
+
- **select:** deprecate legacy component and types ([7230bef1be](https://github.com/migrationsverket/midas/commit/7230bef1be))
|
|
7
|
+
- **list-box:** deprecate custom item and section types ([e5a415eb03](https://github.com/migrationsverket/midas/commit/e5a415eb03))
|
|
8
|
+
|
|
9
|
+
## 15.2.0 (2025-11-07)
|
|
10
|
+
|
|
11
|
+
### 🚀 Features
|
|
12
|
+
|
|
13
|
+
- **label:** add styling for read-only state ([9422f77547](https://github.com/migrationsverket/midas/commit/9422f77547))
|
|
14
|
+
- **text:** add styling for read-only state ([76d1f9c655](https://github.com/migrationsverket/midas/commit/76d1f9c655))
|
|
15
|
+
- **calendar:** add styling for read-only state ([53dadfad5c](https://github.com/migrationsverket/midas/commit/53dadfad5c))
|
|
16
|
+
- **date-picker:** add styling for read-only state ([d9d3856259](https://github.com/migrationsverket/midas/commit/d9d3856259))
|
|
17
|
+
- **date-field:** add styling for read-only state ([9cdfb7b8cc](https://github.com/migrationsverket/midas/commit/9cdfb7b8cc))
|
|
18
|
+
- **checkbox:** add styling for read-only state ([fc34e942be](https://github.com/migrationsverket/midas/commit/fc34e942be))
|
|
19
|
+
- **radio:** add styling for read-only state ([bb69e7e7ac](https://github.com/migrationsverket/midas/commit/bb69e7e7ac))
|
|
20
|
+
- **combobox:** add styling for read-only state ([65fe61058d](https://github.com/migrationsverket/midas/commit/65fe61058d))
|
|
21
|
+
- **textfield:** add styling for read-only state ([a25bce820a](https://github.com/migrationsverket/midas/commit/a25bce820a))
|
|
22
|
+
|
|
23
|
+
### 🩹 Fixes
|
|
24
|
+
|
|
25
|
+
- **checkbox:** set correct indeterminate icon and refactor styles ([baf09f4d11](https://github.com/migrationsverket/midas/commit/baf09f4d11))
|
|
26
|
+
|
|
27
|
+
### 🏭 Refactoring
|
|
28
|
+
|
|
29
|
+
- **textfield:** move data attributes from template to css ([387113c52d](https://github.com/migrationsverket/midas/commit/387113c52d))
|
|
30
|
+
- **date-field:** move data attributes from template to css ([3ad82fb182](https://github.com/migrationsverket/midas/commit/3ad82fb182))
|
|
31
|
+
|
|
32
|
+
### 🔧 Maintenance
|
|
33
|
+
|
|
34
|
+
- **theme:** revert read-only border color token (same as subtle) ([c42f60935b](https://github.com/migrationsverket/midas/commit/c42f60935b))
|
|
35
|
+
|
|
36
|
+
### 🧪 Tests updated
|
|
37
|
+
|
|
38
|
+
- update baseline snapshots ([015a9af328](https://github.com/migrationsverket/midas/commit/015a9af328))
|
|
39
|
+
|
|
40
|
+
### 🧱 Updated Dependencies
|
|
41
|
+
|
|
42
|
+
- Updated theme to 3.2.0
|
|
43
|
+
|
|
1
44
|
## 15.1.3 (2025-11-06)
|
|
2
45
|
|
|
3
46
|
### 🩹 Fixes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";require('./assets/CharacterCounter.css');const s=require("react/jsx-runtime"),u=require("react"),i=require("./utils-CtICjCYt.cjs"),d=require("./Input-Bda0PCu5.cjs");function f(e){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,r.get?r:{enumerable:!0,get:()=>e[t]})}}return n.default=e,Object.freeze(n)}const l=f(u),$="
|
|
1
|
+
"use strict";require('./assets/CharacterCounter.css');const s=require("react/jsx-runtime"),u=require("react"),i=require("./utils-CtICjCYt.cjs"),d=require("./Input-Bda0PCu5.cjs");function f(e){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,r.get?r:{enumerable:!0,get:()=>e[t]})}}return n.default=e,Object.freeze(n)}const l=f(u),$="_characterCounter_1f0mh_1",b={characterCounter:$},h=l.forwardRef((e,n)=>{[e]=i.$64fa3d84918910a7$export$29f1550f4b0d4415(e,n,d.$3985021b0ad6602f$export$37fb8590cf2c088c);const{maxLength:t,value:r,isLonely:o}=e,{length:c}=(r==null?void 0:r.toString())??"",a=t!==void 0;return s.jsx("span",{className:b.characterCounter,"data-exceeded":a&&c>t||void 0,"data-lonely":o||void 0,children:a?`${c} / ${t}`:c})});exports.CharacterCounter=h;
|
|
@@ -2,17 +2,17 @@ import { jsx as s } from "react/jsx-runtime";
|
|
|
2
2
|
import * as d from "react";
|
|
3
3
|
import { $ as f } from "./utils-D2iKpxcZ.js";
|
|
4
4
|
import { $ as i } from "./Input-CQzv-D9g.js";
|
|
5
|
-
import './assets/CharacterCounter.css';const $ = "
|
|
5
|
+
import './assets/CharacterCounter.css';const $ = "_characterCounter_1f0mh_1", m = {
|
|
6
6
|
characterCounter: $
|
|
7
|
-
}, l = d.forwardRef((t,
|
|
8
|
-
[t] = f(t,
|
|
9
|
-
const { maxLength: r, value: e, isLonely:
|
|
7
|
+
}, l = d.forwardRef((t, c) => {
|
|
8
|
+
[t] = f(t, c, i);
|
|
9
|
+
const { maxLength: r, value: e, isLonely: n } = t, { length: a } = (e == null ? void 0 : e.toString()) ?? "", o = r !== void 0;
|
|
10
10
|
return /* @__PURE__ */ s(
|
|
11
11
|
"span",
|
|
12
12
|
{
|
|
13
13
|
className: m.characterCounter,
|
|
14
14
|
"data-exceeded": o && a > r || void 0,
|
|
15
|
-
"data-lonely":
|
|
15
|
+
"data-lonely": n || void 0,
|
|
16
16
|
children: o ? `${a} / ${r}` : a
|
|
17
17
|
}
|
|
18
18
|
);
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";require('./assets/Checkbox.css');const c=require("react/jsx-runtime"),k=require("react"),T=require("./RSPContexts-XUvspq3j.cjs"),V=require("./utils-CtICjCYt.cjs"),W=require("./Form-BuOomA4T.cjs"),D=require("./clsx-C11secjj.cjs"),O=require("./variables-CVumCR9l.cjs"),y=require("./mergeProps-Du5A8xi8.cjs"),J=require("./createLucideIcon-CTVXwe6i.cjs"),K=require("./check-B0aKTFe5.cjs"),Q=require("./VisuallyHidden-BMelU6B0.cjs"),m=require("./useFormValidation-DV2Ioblb.cjs"),I=require("./usePress-DmU79HEg.cjs"),X=require("./filterDOMProps-RRlKPKX0.cjs"),Y=require("./useFocusable-M4se1KJt.cjs"),_=require("./useToggleState-DaxmInOW.cjs"),Z=require("./useHover-DULSfLuK.cjs"),ee=require("./useFocusRing-C-XVcAE5.cjs");function ie(e){const i=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const a in e)if(a!=="default"){const n=Object.getOwnPropertyDescriptor(e,a);Object.defineProperty(i,a,n.get?n:{enumerable:!0,get:()=>e[a]})}}return i.default=e,Object.freeze(i)}const g=ie(k);function ae(e,i,a){let{isDisabled:n=!1,isReadOnly:d=!1,value:s,name:r,form:l,children:o,"aria-label":b,"aria-labelledby":x,validationState:$="valid",isInvalid:v,onPressStart:h,onPressEnd:P,onPressChange:u,onPress:f,onPressUp:t,onClick:C}=e,E=R=>{R.stopPropagation(),i.setSelected(R.target.checked)},M=o!=null,G=b!=null||x!=null;!M&&!G&&process.env.NODE_ENV!=="production"&&console.warn("If you do not provide children, you must specify an aria-label for accessibility");let{pressProps:N,isPressed:F}=I.$f6c31cce2adf654f$export$45712eceda6fad21({onPressStart:h,onPressEnd:P,onPressChange:u,onPress:f,onPressUp:t,onClick:C,isDisabled:n}),{pressProps:L,isPressed:U}=I.$f6c31cce2adf654f$export$45712eceda6fad21({onPressStart:h,onPressEnd:P,onPressChange:u,onPressUp:t,onClick:C,onPress(R){var S;f==null||f(R),i.toggle(),(S=a.current)===null||S===void 0||S.focus()},isDisabled:n||d}),{focusableProps:z}=Y.$f645667febf57a63$export$4c014de7c8940b4c(e,a),A=y.$3ef42575df84b30b$export$9d1611c77c2fe928(N,z),H=X.$65484d02dcb7eb3e$export$457c3d6518dd4c6f(e,{labelable:!0});return m.$99facab73266f662$export$5add1d006293d136(a,i.defaultSelected,i.setSelected),{labelProps:y.$3ef42575df84b30b$export$9d1611c77c2fe928(L,{onClick:R=>R.preventDefault()}),inputProps:y.$3ef42575df84b30b$export$9d1611c77c2fe928(H,{"aria-invalid":v||$==="invalid"||void 0,"aria-errormessage":e["aria-errormessage"],"aria-controls":e["aria-controls"],"aria-readonly":d||void 0,onChange:E,disabled:n,...s==null?{}:{value:s},name:r,form:l,type:"checkbox",...A}),isSelected:i.isSelected,isPressed:F||U,isDisabled:n,isReadOnly:d,isInvalid:v||$==="invalid"}}function j(e,i,a){let n=m.$e5be200c675c3b3a$export$fc1a364ae1f3ff10({...e,value:i.isSelected}),{isInvalid:d,validationErrors:s,validationDetails:r}=n.displayValidation,{labelProps:l,inputProps:o,isSelected:b,isPressed:x,isDisabled:$,isReadOnly:v}=ae({...e,isInvalid:d},i,a);m.$e93e671b31057976$export$b8473d3665f3a75a(e,n,a);let{isIndeterminate:h,isRequired:P,validationBehavior:u="aria"}=e;k.useEffect(()=>{a.current&&(a.current.indeterminate=!!h)});let{pressProps:f}=I.$f6c31cce2adf654f$export$45712eceda6fad21({isDisabled:$||v,onPress(){let{[m.$e5be200c675c3b3a$export$a763b9476acd3eb]:t}=e,{commitValidation:C}=t||n;C()}});return{labelProps:y.$3ef42575df84b30b$export$9d1611c77c2fe928(l,f,k.useMemo(()=>({onMouseDown:t=>t.preventDefault()}),[])),inputProps:{...o,checked:b,"aria-required":P&&u==="aria"||void 0,required:P&&u==="native"},isSelected:b,isPressed:x,isDisabled:$,isReadOnly:v,isInvalid:d,validationErrors:s,validationDetails:r}}const p=new WeakMap;function ne(e,i,a){const n=_.$3017fa7ffdddec74$export$8042c6c013fd5226({isReadOnly:e.isReadOnly||i.isReadOnly,isSelected:i.isSelected(e.value),defaultSelected:i.defaultValue.includes(e.value),onChange(t){t?i.addValue(e.value):i.removeValue(e.value),e.onChange&&e.onChange(t)}});let{name:d,form:s,descriptionId:r,errorMessageId:l,validationBehavior:o}=p.get(i);var b;o=(b=e.validationBehavior)!==null&&b!==void 0?b:o;let{realtimeValidation:x}=m.$e5be200c675c3b3a$export$fc1a364ae1f3ff10({...e,value:n.isSelected,name:void 0,validationBehavior:"aria"}),$=k.useRef(m.$e5be200c675c3b3a$export$dad6ae84456c676a),v=()=>{i.setInvalid(e.value,x.isInvalid?x:$.current)};k.useEffect(v);let h=i.realtimeValidation.isInvalid?i.realtimeValidation:x,P=o==="native"?i.displayValidation:h;var u;let f=j({...e,isReadOnly:e.isReadOnly||i.isReadOnly,isDisabled:e.isDisabled||i.isDisabled,name:e.name||d,form:e.form||s,isRequired:(u=e.isRequired)!==null&&u!==void 0?u:i.isRequired,validationBehavior:o,[m.$e5be200c675c3b3a$export$a763b9476acd3eb]:{realtimeValidation:h,displayValidation:P,resetValidation:i.resetValidation,commitValidation:i.commitValidation,updateValidation(t){$.current=t,v()}}},n,a);return{...f,inputProps:{...f.inputProps,"aria-describedby":[e["aria-describedby"],i.isInvalid?l:null,r].filter(Boolean).join(" ")||void 0}}}/**
|
|
2
|
+
* @license lucide-react v0.525.0 - ISC
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the ISC license.
|
|
5
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/const de=[["path",{d:"M5 12h14",key:"1ays0h"}]],oe=J.createLucideIcon("minus",de),B=k.createContext(null),te="_checkboxInner_nh1pw_1",se="_checkbox_nh1pw_1",re="_checkboxGroup_nh1pw_146",q={checkboxInner:te,checkbox:se,checkboxGroup:re},w=g.forwardRef((e,i)=>{const{hoverProps:a,isHovered:n}=e.hoverResult,{pressProps:d,isPressed:s}=e.pressResult,{isFocused:r,isFocusVisible:l,focusProps:o}=e.focusRingAria;return c.jsxs("label",{ref:i,...y.$3ef42575df84b30b$export$9d1611c77c2fe928(a,d,e.labelProps),slot:e.slot||void 0,className:D.clsx(q.checkbox,e.className),"data-hovered":n||void 0,"data-selected":e.isSelected||void 0,"data-indeterminate":e.isIndeterminate||void 0,"data-pressed":s||void 0,"data-disabled":e.isDisabled||void 0,"data-readonly":e.isReadOnly||void 0,"data-invalid":e.isInvalid||void 0,"data-focused":r||void 0,"data-focus-visible":l||void 0,"data-required":e.isRequired||void 0,children:[c.jsx("div",{className:D.clsx(q.checkboxInner),children:e.isIndeterminate?c.jsx(oe,{size:16,viewBox:"0 0 24 24",color:O.iconOnColor}):c.jsx(K.Check,{size:16,viewBox:"0 0 24 24",color:O.iconOnColor})}),c.jsx(Q.$5c3e21d68f1c4674$export$439d29a4e110a164,{children:c.jsx("input",{...y.$3ef42575df84b30b$export$9d1611c77c2fe928(e.inputProps,o),ref:e.inputRef})}),e.children]})}),le=g.forwardRef((e,i)=>{const a=ne({...e,value:e.value||""},e.state,e.inputRef);return c.jsx(w,{...e,...a,ref:i})}),ce=g.forwardRef((e,i)=>{const a=j(e,_.$3017fa7ffdddec74$export$8042c6c013fd5226(e),e.inputRef);return c.jsx(w,{...e,...a,ref:i})}),ue=g.forwardRef((e,i)=>{[e,i]=V.$64fa3d84918910a7$export$29f1550f4b0d4415(e,i,T.$4e85f108e88277b8$export$b085522c77523c51);const a=V.$64fa3d84918910a7$export$fabf2dc03a41866e(W.$d3e0e05bdfcf66bd$export$c24727297075ec6a),n=e.validationBehavior??(a==null?void 0:a.validationBehavior)??"native",d=g.useContext(B),s=g.useRef(null),r=Z.$6179b936705e76d3$export$ae780daf29e6d456(e),l=I.$f6c31cce2adf654f$export$45712eceda6fad21({ref:i,isDisabled:e.isDisabled}),o=ee.$f7dceffc5ad7768b$export$4e328f61c538687f();return d?c.jsx(le,{...e,state:d,inputRef:s,hoverResult:r,pressResult:l,focusRingAria:o,validationBehavior:n}):c.jsx(ce,{...e,inputRef:s,hoverResult:r,pressResult:l,focusRingAria:o,validationBehavior:n})});exports.$1ae600c947479353$export$ec98120685d4f57d=p;exports.Checkbox=ue;exports.CheckboxGroupContext=B;exports.styles=q;
|
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
import { jsxs as F, jsx as u } from "react/jsx-runtime";
|
|
2
|
+
import * as R from "react";
|
|
3
|
+
import H, { useEffect as D, useMemo as W, useRef as J } from "react";
|
|
4
|
+
import { c as K } from "./RSPContexts-B0lEq7qq.js";
|
|
5
|
+
import { $ as Q, c as T } from "./utils-D2iKpxcZ.js";
|
|
6
|
+
import { $ as X } from "./Form-CXcEMuBf.js";
|
|
7
|
+
import { c as S } from "./clsx-OuTLNxxd.js";
|
|
8
|
+
import { i as V } from "./variables-BkqZ2WGF.js";
|
|
9
|
+
import { a as y } from "./mergeProps-Ct8m5-xW.js";
|
|
10
|
+
import { c as Y } from "./createLucideIcon-XRdN60yz.js";
|
|
11
|
+
import { C as Z } from "./check-B5h1DvDs.js";
|
|
12
|
+
import { $ as ee } from "./VisuallyHidden-DuW70K-5.js";
|
|
13
|
+
import { a as ae, $ as _, b as ie, d as p, e as oe } from "./useFormValidation-By7G-T7y.js";
|
|
14
|
+
import { b as k } from "./usePress-BqQIhkNY.js";
|
|
15
|
+
import { $ as de } from "./filterDOMProps-wsa9OcNI.js";
|
|
16
|
+
import { a as ne } from "./useFocusable-BJj-Bkig.js";
|
|
17
|
+
import { $ as B } from "./useToggleState-BVOqL4hI.js";
|
|
18
|
+
import { $ as se } from "./useHover-DkC5FyNd.js";
|
|
19
|
+
import { $ as le } from "./useFocusRing-CcxI7nbg.js";
|
|
20
|
+
import './assets/Checkbox.css';function re(e, a, i) {
|
|
21
|
+
let { isDisabled: o = !1, isReadOnly: d = !1, value: l, name: r, form: t, children: n, "aria-label": v, "aria-labelledby": $, validationState: b = "valid", isInvalid: m, onPressStart: h, onPressEnd: P, onPressChange: c, onPress: f, onPressUp: s, onClick: I } = e, q = (x) => {
|
|
22
|
+
x.stopPropagation(), a.setSelected(x.target.checked);
|
|
23
|
+
}, E = n != null, M = v != null || $ != null;
|
|
24
|
+
!E && !M && process.env.NODE_ENV !== "production" && console.warn("If you do not provide children, you must specify an aria-label for accessibility");
|
|
25
|
+
let { pressProps: G, isPressed: N } = k({
|
|
26
|
+
onPressStart: h,
|
|
27
|
+
onPressEnd: P,
|
|
28
|
+
onPressChange: c,
|
|
29
|
+
onPress: f,
|
|
30
|
+
onPressUp: s,
|
|
31
|
+
onClick: I,
|
|
32
|
+
isDisabled: o
|
|
33
|
+
}), { pressProps: L, isPressed: U } = k({
|
|
34
|
+
onPressStart: h,
|
|
35
|
+
onPressEnd: P,
|
|
36
|
+
onPressChange: c,
|
|
37
|
+
onPressUp: s,
|
|
38
|
+
onClick: I,
|
|
39
|
+
onPress(x) {
|
|
40
|
+
var C;
|
|
41
|
+
f == null || f(x), a.toggle(), (C = i.current) === null || C === void 0 || C.focus();
|
|
42
|
+
},
|
|
43
|
+
isDisabled: o || d
|
|
44
|
+
}), { focusableProps: j } = ne(e, i), A = y(G, j), z = de(e, {
|
|
45
|
+
labelable: !0
|
|
46
|
+
});
|
|
47
|
+
return ae(i, a.defaultSelected, a.setSelected), {
|
|
48
|
+
labelProps: y(L, {
|
|
49
|
+
onClick: (x) => x.preventDefault()
|
|
50
|
+
}),
|
|
51
|
+
inputProps: y(z, {
|
|
52
|
+
"aria-invalid": m || b === "invalid" || void 0,
|
|
53
|
+
"aria-errormessage": e["aria-errormessage"],
|
|
54
|
+
"aria-controls": e["aria-controls"],
|
|
55
|
+
"aria-readonly": d || void 0,
|
|
56
|
+
onChange: q,
|
|
57
|
+
disabled: o,
|
|
58
|
+
...l == null ? {} : {
|
|
59
|
+
value: l
|
|
60
|
+
},
|
|
61
|
+
name: r,
|
|
62
|
+
form: t,
|
|
63
|
+
type: "checkbox",
|
|
64
|
+
...A
|
|
65
|
+
}),
|
|
66
|
+
isSelected: a.isSelected,
|
|
67
|
+
isPressed: N || U,
|
|
68
|
+
isDisabled: o,
|
|
69
|
+
isReadOnly: d,
|
|
70
|
+
isInvalid: m || b === "invalid"
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
function O(e, a, i) {
|
|
74
|
+
let o = _({
|
|
75
|
+
...e,
|
|
76
|
+
value: a.isSelected
|
|
77
|
+
}), { isInvalid: d, validationErrors: l, validationDetails: r } = o.displayValidation, { labelProps: t, inputProps: n, isSelected: v, isPressed: $, isDisabled: b, isReadOnly: m } = re({
|
|
78
|
+
...e,
|
|
79
|
+
isInvalid: d
|
|
80
|
+
}, a, i);
|
|
81
|
+
ie(e, o, i);
|
|
82
|
+
let { isIndeterminate: h, isRequired: P, validationBehavior: c = "aria" } = e;
|
|
83
|
+
D(() => {
|
|
84
|
+
i.current && (i.current.indeterminate = !!h);
|
|
85
|
+
});
|
|
86
|
+
let { pressProps: f } = k({
|
|
87
|
+
isDisabled: b || m,
|
|
88
|
+
onPress() {
|
|
89
|
+
let { [p]: s } = e, { commitValidation: I } = s || o;
|
|
90
|
+
I();
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
return {
|
|
94
|
+
labelProps: y(t, f, W(() => ({
|
|
95
|
+
// Prevent label from being focused when mouse down on it.
|
|
96
|
+
// Note, this does not prevent the input from being focused in the `click` event.
|
|
97
|
+
onMouseDown: (s) => s.preventDefault()
|
|
98
|
+
}), [])),
|
|
99
|
+
inputProps: {
|
|
100
|
+
...n,
|
|
101
|
+
checked: v,
|
|
102
|
+
"aria-required": P && c === "aria" || void 0,
|
|
103
|
+
required: P && c === "native"
|
|
104
|
+
},
|
|
105
|
+
isSelected: v,
|
|
106
|
+
isPressed: $,
|
|
107
|
+
isDisabled: b,
|
|
108
|
+
isReadOnly: m,
|
|
109
|
+
isInvalid: d,
|
|
110
|
+
validationErrors: l,
|
|
111
|
+
validationDetails: r
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
const te = /* @__PURE__ */ new WeakMap();
|
|
115
|
+
function ce(e, a, i) {
|
|
116
|
+
const o = B({
|
|
117
|
+
isReadOnly: e.isReadOnly || a.isReadOnly,
|
|
118
|
+
isSelected: a.isSelected(e.value),
|
|
119
|
+
defaultSelected: a.defaultValue.includes(e.value),
|
|
120
|
+
onChange(s) {
|
|
121
|
+
s ? a.addValue(e.value) : a.removeValue(e.value), e.onChange && e.onChange(s);
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
let { name: d, form: l, descriptionId: r, errorMessageId: t, validationBehavior: n } = te.get(a);
|
|
125
|
+
var v;
|
|
126
|
+
n = (v = e.validationBehavior) !== null && v !== void 0 ? v : n;
|
|
127
|
+
let { realtimeValidation: $ } = _({
|
|
128
|
+
...e,
|
|
129
|
+
value: o.isSelected,
|
|
130
|
+
// Server validation is handled at the group level.
|
|
131
|
+
name: void 0,
|
|
132
|
+
validationBehavior: "aria"
|
|
133
|
+
}), b = J(oe), m = () => {
|
|
134
|
+
a.setInvalid(e.value, $.isInvalid ? $ : b.current);
|
|
135
|
+
};
|
|
136
|
+
D(m);
|
|
137
|
+
let h = a.realtimeValidation.isInvalid ? a.realtimeValidation : $, P = n === "native" ? a.displayValidation : h;
|
|
138
|
+
var c;
|
|
139
|
+
let f = O({
|
|
140
|
+
...e,
|
|
141
|
+
isReadOnly: e.isReadOnly || a.isReadOnly,
|
|
142
|
+
isDisabled: e.isDisabled || a.isDisabled,
|
|
143
|
+
name: e.name || d,
|
|
144
|
+
form: e.form || l,
|
|
145
|
+
isRequired: (c = e.isRequired) !== null && c !== void 0 ? c : a.isRequired,
|
|
146
|
+
validationBehavior: n,
|
|
147
|
+
[p]: {
|
|
148
|
+
realtimeValidation: h,
|
|
149
|
+
displayValidation: P,
|
|
150
|
+
resetValidation: a.resetValidation,
|
|
151
|
+
commitValidation: a.commitValidation,
|
|
152
|
+
updateValidation(s) {
|
|
153
|
+
b.current = s, m();
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}, o, i);
|
|
157
|
+
return {
|
|
158
|
+
...f,
|
|
159
|
+
inputProps: {
|
|
160
|
+
...f.inputProps,
|
|
161
|
+
"aria-describedby": [
|
|
162
|
+
e["aria-describedby"],
|
|
163
|
+
a.isInvalid ? t : null,
|
|
164
|
+
r
|
|
165
|
+
].filter(Boolean).join(" ") || void 0
|
|
166
|
+
}
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* @license lucide-react v0.525.0 - ISC
|
|
171
|
+
*
|
|
172
|
+
* This source code is licensed under the ISC license.
|
|
173
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
174
|
+
*/
|
|
175
|
+
const fe = [["path", { d: "M5 12h14", key: "1ays0h" }]], ue = Y("minus", fe), ve = H.createContext(null), be = "_checkboxInner_nh1pw_1", me = "_checkbox_nh1pw_1", $e = "_checkboxGroup_nh1pw_146", g = {
|
|
176
|
+
checkboxInner: be,
|
|
177
|
+
checkbox: me,
|
|
178
|
+
checkboxGroup: $e
|
|
179
|
+
}, w = R.forwardRef((e, a) => {
|
|
180
|
+
const { hoverProps: i, isHovered: o } = e.hoverResult, { pressProps: d, isPressed: l } = e.pressResult, { isFocused: r, isFocusVisible: t, focusProps: n } = e.focusRingAria;
|
|
181
|
+
return /* @__PURE__ */ F(
|
|
182
|
+
"label",
|
|
183
|
+
{
|
|
184
|
+
ref: a,
|
|
185
|
+
...y(i, d, e.labelProps),
|
|
186
|
+
slot: e.slot || void 0,
|
|
187
|
+
className: S(g.checkbox, e.className),
|
|
188
|
+
"data-hovered": o || void 0,
|
|
189
|
+
"data-selected": e.isSelected || void 0,
|
|
190
|
+
"data-indeterminate": e.isIndeterminate || void 0,
|
|
191
|
+
"data-pressed": l || void 0,
|
|
192
|
+
"data-disabled": e.isDisabled || void 0,
|
|
193
|
+
"data-readonly": e.isReadOnly || void 0,
|
|
194
|
+
"data-invalid": e.isInvalid || void 0,
|
|
195
|
+
"data-focused": r || void 0,
|
|
196
|
+
"data-focus-visible": t || void 0,
|
|
197
|
+
"data-required": e.isRequired || void 0,
|
|
198
|
+
children: [
|
|
199
|
+
/* @__PURE__ */ u("div", { className: S(g.checkboxInner), children: e.isIndeterminate ? /* @__PURE__ */ u(
|
|
200
|
+
ue,
|
|
201
|
+
{
|
|
202
|
+
size: 16,
|
|
203
|
+
viewBox: "0 0 24 24",
|
|
204
|
+
color: V
|
|
205
|
+
}
|
|
206
|
+
) : /* @__PURE__ */ u(
|
|
207
|
+
Z,
|
|
208
|
+
{
|
|
209
|
+
size: 16,
|
|
210
|
+
viewBox: "0 0 24 24",
|
|
211
|
+
color: V
|
|
212
|
+
}
|
|
213
|
+
) }),
|
|
214
|
+
/* @__PURE__ */ u(ee, { children: /* @__PURE__ */ u(
|
|
215
|
+
"input",
|
|
216
|
+
{
|
|
217
|
+
...y(e.inputProps, n),
|
|
218
|
+
ref: e.inputRef
|
|
219
|
+
}
|
|
220
|
+
) }),
|
|
221
|
+
e.children
|
|
222
|
+
]
|
|
223
|
+
}
|
|
224
|
+
);
|
|
225
|
+
}), he = R.forwardRef((e, a) => {
|
|
226
|
+
const i = ce(
|
|
227
|
+
{
|
|
228
|
+
...e,
|
|
229
|
+
value: e.value || ""
|
|
230
|
+
},
|
|
231
|
+
e.state,
|
|
232
|
+
e.inputRef
|
|
233
|
+
);
|
|
234
|
+
return /* @__PURE__ */ u(
|
|
235
|
+
w,
|
|
236
|
+
{
|
|
237
|
+
...e,
|
|
238
|
+
...i,
|
|
239
|
+
ref: a
|
|
240
|
+
}
|
|
241
|
+
);
|
|
242
|
+
}), Pe = R.forwardRef((e, a) => {
|
|
243
|
+
const i = O(e, B(e), e.inputRef);
|
|
244
|
+
return /* @__PURE__ */ u(
|
|
245
|
+
w,
|
|
246
|
+
{
|
|
247
|
+
...e,
|
|
248
|
+
...i,
|
|
249
|
+
ref: a
|
|
250
|
+
}
|
|
251
|
+
);
|
|
252
|
+
}), Ge = R.forwardRef(
|
|
253
|
+
(e, a) => {
|
|
254
|
+
[e, a] = Q(e, a, K);
|
|
255
|
+
const i = T(X), o = e.validationBehavior ?? (i == null ? void 0 : i.validationBehavior) ?? "native", d = R.useContext(ve), l = R.useRef(null), r = se(e), t = k({
|
|
256
|
+
ref: a,
|
|
257
|
+
isDisabled: e.isDisabled
|
|
258
|
+
}), n = le();
|
|
259
|
+
return d ? /* @__PURE__ */ u(
|
|
260
|
+
he,
|
|
261
|
+
{
|
|
262
|
+
...e,
|
|
263
|
+
state: d,
|
|
264
|
+
inputRef: l,
|
|
265
|
+
hoverResult: r,
|
|
266
|
+
pressResult: t,
|
|
267
|
+
focusRingAria: n,
|
|
268
|
+
validationBehavior: o
|
|
269
|
+
}
|
|
270
|
+
) : /* @__PURE__ */ u(
|
|
271
|
+
Pe,
|
|
272
|
+
{
|
|
273
|
+
...e,
|
|
274
|
+
inputRef: l,
|
|
275
|
+
hoverResult: r,
|
|
276
|
+
pressResult: t,
|
|
277
|
+
focusRingAria: n,
|
|
278
|
+
validationBehavior: o
|
|
279
|
+
}
|
|
280
|
+
);
|
|
281
|
+
}
|
|
282
|
+
);
|
|
283
|
+
export {
|
|
284
|
+
te as $,
|
|
285
|
+
Ge as C,
|
|
286
|
+
ve as a,
|
|
287
|
+
g as s
|
|
288
|
+
};
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { jsx as s, jsxs as g } from "react/jsx-runtime";
|
|
2
|
-
import { a as P, L as V } from "./Label-
|
|
3
|
-
import { T as
|
|
2
|
+
import { a as P, L as V } from "./Label-DH4JI6a4.js";
|
|
3
|
+
import { T as y } from "./Text-CnY7jiPS.js";
|
|
4
4
|
import * as m from "react";
|
|
5
|
-
import { useState as
|
|
6
|
-
import { $ as
|
|
7
|
-
import { $ as
|
|
5
|
+
import { useState as S, useRef as C } from "react";
|
|
6
|
+
import { $ as R, C as v, s as D, a as I } from "./Checkbox-ujNi8mrO.js";
|
|
7
|
+
import { $ as O, F as k } from "./FieldError-DtEDCIQK.js";
|
|
8
8
|
import { $ as F, c as A } from "./useFormValidation-By7G-T7y.js";
|
|
9
9
|
import { $ as E } from "./useControlledState-u436Wbp1.js";
|
|
10
10
|
import { a as M } from "./mergeProps-Ct8m5-xW.js";
|
|
11
|
-
import { $ as
|
|
12
|
-
import { $ as
|
|
11
|
+
import { $ as W } from "./filterDOMProps-wsa9OcNI.js";
|
|
12
|
+
import { $ as p } from "./useField-Bx76iuoW.js";
|
|
13
13
|
import { $ as B } from "./useFocusWithin-DhXBuB2O.js";
|
|
14
14
|
import { u as L } from "./useLocalizedStringFormatter-aOhh7wdl.js";
|
|
15
15
|
function G(e, a) {
|
|
16
|
-
let { isDisabled: t, name: c, form: f, validationBehavior: n = "aria" } = e, { isInvalid: r, validationErrors: d, validationDetails: l } = a.displayValidation, { labelProps: u, fieldProps: $, descriptionProps: i, errorMessageProps: o } =
|
|
16
|
+
let { isDisabled: t, name: c, form: f, validationBehavior: n = "aria" } = e, { isInvalid: r, validationErrors: d, validationDetails: l } = a.displayValidation, { labelProps: u, fieldProps: $, descriptionProps: i, errorMessageProps: o } = p({
|
|
17
17
|
...e,
|
|
18
18
|
// Checkbox group is not an HTML input element so it
|
|
19
19
|
// shouldn't be labeled by a <label> element.
|
|
@@ -21,14 +21,14 @@ function G(e, a) {
|
|
|
21
21
|
isInvalid: r,
|
|
22
22
|
errorMessage: e.errorMessage || d
|
|
23
23
|
});
|
|
24
|
-
|
|
24
|
+
R.set(a, {
|
|
25
25
|
name: c,
|
|
26
26
|
form: f,
|
|
27
27
|
descriptionId: i.id,
|
|
28
28
|
errorMessageId: o.id,
|
|
29
29
|
validationBehavior: n
|
|
30
30
|
});
|
|
31
|
-
let b =
|
|
31
|
+
let b = W(e, {
|
|
32
32
|
labelable: !0
|
|
33
33
|
}), { focusWithinProps: x } = B({
|
|
34
34
|
onBlurWithin: e.onBlur,
|
|
@@ -51,7 +51,7 @@ function G(e, a) {
|
|
|
51
51
|
};
|
|
52
52
|
}
|
|
53
53
|
function _(e = {}) {
|
|
54
|
-
let [a, t] = E(e.value, e.defaultValue || [], e.onChange), [c] =
|
|
54
|
+
let [a, t] = E(e.value, e.defaultValue || [], e.onChange), [c] = S(a), f = !!e.isRequired && a.length === 0, n = C(/* @__PURE__ */ new Map()), r = F({
|
|
55
55
|
...e,
|
|
56
56
|
value: a
|
|
57
57
|
}), d = r.displayValidation.isInvalid;
|
|
@@ -95,7 +95,7 @@ const j = (e, { value: a }) => {
|
|
|
95
95
|
someSelected: !n && !r,
|
|
96
96
|
checkboxValues: f
|
|
97
97
|
};
|
|
98
|
-
}, h = ({ state: e, errorMessage: a }) => /* @__PURE__ */ s(
|
|
98
|
+
}, h = ({ state: e, errorMessage: a }) => /* @__PURE__ */ s(O.Provider, { value: e.displayValidation, children: /* @__PURE__ */ s(k, { children: a }) }), q = { selectAll: "Select all" }, w = { selectAll: "Välj alla" }, T = {
|
|
99
99
|
en: q,
|
|
100
100
|
sv: w
|
|
101
101
|
};
|
|
@@ -114,10 +114,12 @@ function le(e) {
|
|
|
114
114
|
{
|
|
115
115
|
...c,
|
|
116
116
|
className: D.checkboxGroup,
|
|
117
|
+
"data-readonly": e.isReadOnly || void 0,
|
|
118
|
+
"data-disabled": e.isDisabled || void 0,
|
|
117
119
|
children: [
|
|
118
120
|
/* @__PURE__ */ s(P, { popover: e.popover, children: e.label && /* @__PURE__ */ s(V, { ...f, children: e.label }) }),
|
|
119
121
|
e.description && /* @__PURE__ */ s(
|
|
120
|
-
|
|
122
|
+
y,
|
|
121
123
|
{
|
|
122
124
|
slot: "description",
|
|
123
125
|
...n,
|
|
@@ -136,6 +138,7 @@ function le(e) {
|
|
|
136
138
|
{
|
|
137
139
|
isSelected: r,
|
|
138
140
|
isIndeterminate: d,
|
|
141
|
+
isReadOnly: e.isReadOnly,
|
|
139
142
|
onChange: u,
|
|
140
143
|
children: e.selectAllLabel || t.format("selectAll")
|
|
141
144
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const s=require("react/jsx-runtime"),m=require("./Label-Cbp1q387.cjs"),S=require("./Text-DUIBTA3N.cjs"),$=require("react"),h=require("./Checkbox-D9X5vM4a.cjs"),g=require("./FieldError-DHzrxRPt.cjs"),P=require("./useFormValidation-DV2Ioblb.cjs"),C=require("./useControlledState-D0L6S_5r.cjs"),j=require("./mergeProps-Du5A8xi8.cjs"),q=require("./filterDOMProps-RRlKPKX0.cjs"),O=require("./useField-DvszkIMx.cjs"),R=require("./useFocusWithin-GBjoTL5o.cjs"),D=require("./useLocalizedStringFormatter-BSac43NO.cjs");function k(e){const i=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const a in e)if(a!=="default"){const n=Object.getOwnPropertyDescriptor(e,a);Object.defineProperty(i,a,n.get?n:{enumerable:!0,get:()=>e[a]})}}return i.default=e,Object.freeze(i)}const v=k($);function F(e,i){let{isDisabled:a,name:n,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});h.$1ae600c947479353$export$ec98120685d4f57d.set(i,{name:n,form:u,descriptionId:t.id,errorMessageId:o.id,validationBehavior:d});let b=q.$65484d02dcb7eb3e$export$457c3d6518dd4c6f(e,{labelable:!0}),{focusWithinProps:y}=R.$9ab94262bd0047c7$export$420e68273165f4ec({onBlurWithin:e.onBlur,onFocusWithin:e.onFocus,onFocusWithinChange:e.onFocusChange});return{groupProps:j.$3ef42575df84b30b$export$9d1611c77c2fe928(b,{role:"group","aria-disabled":a||void 0,...x,...y}),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),[n]=$.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:n,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 b=new Map(d.current);o.isInvalid?b.set(t,o):b.delete(t),d.current=b,r.updateValidation(P.$e5be200c675c3b3a$export$75ee7c75d68f5b0e(...b.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===h.Checkbox),n=v.Children.count(a),u=v.Children.toArray(e).filter(l=>v.isValidElement(l)).filter(l=>!!l&&l.type===h.Checkbox).map(l=>l.props.value),d=i.length===0,r=i.length===n;return{allSelected:r,someSelected:!d&&!r,checkboxValues:u}},V=({state:e,errorMessage:i})=>s.jsx(g.$ee014567cb39d3f0$export$ff05c3ac10437e03.Provider,{value:e.displayValidation,children:s.jsx(g.FieldError,{children:i})}),E={selectAll:"Select all"},A={selectAll:"Välj alla"},W={en:E,sv:A};function _(e){const i=I(e),a=D.useLocalizedStringFormatter(W),{groupProps:n,labelProps:u,descriptionProps:d}=F(e,i),{allSelected:r,someSelected:c,checkboxValues:l}=M(e.children,i),f=x=>{i.setValue(x?l:[])};return s.jsxs("div",{...n,className:h.styles.checkboxGroup,"data-readonly":e.isReadOnly||void 0,"data-disabled":e.isDisabled||void 0,children:[s.jsx(m.LabelWrapper,{popover:e.popover,children:e.label&&s.jsx(m.Label,{...u,children:e.label})}),e.description&&s.jsx(S.Text,{slot:"description",...d,children:e.description}),e.errorPosition==="top"&&s.jsx(V,{...e,state:i}),e.showSelectAll&&s.jsx(h.Checkbox,{isSelected:r,isIndeterminate:c,isReadOnly:e.isReadOnly,onChange:f,children:e.selectAllLabel||a.format("selectAll")}),s.jsx(h.CheckboxGroupContext.Provider,{value:i,children:e.children}),e.errorPosition==="bottom"&&s.jsx(V,{...e,state:i})]})}exports.CheckboxGroup=_;
|