@midas-ds/components 17.24.0 → 17.25.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 +6 -0
- package/assets/checkbox.css +1 -1
- package/checkbox/Checkbox.d.ts +6 -5
- package/checkbox/Checkbox.stories.d.ts +1 -6
- package/checkbox/CheckboxButton.d.ts +3 -0
- package/checkbox/CheckboxField.d.ts +3 -0
- package/checkbox/CheckboxGroup.d.ts +5 -4
- package/checkbox/CheckboxGroup.stories.d.ts +1 -1
- package/checkbox/SelectAllCheckbox.d.ts +6 -0
- package/checkbox/index.d.ts +3 -2
- package/checkbox/index.js +2 -2
- package/checkbox/useSelectAll.d.ts +1 -1
- package/chunks/checkbox-ivInWvEp.js +105 -0
- package/chunks/{select-CZklrPAQ.js → select-LjjT_7hr.js} +1 -1
- package/chunks/{table-BrA5r_BP.js → table-O7Ht2ilY.js} +1 -1
- package/index.js +40 -40
- package/package.json +1 -1
- package/select/index.js +1 -1
- package/table/index.js +1 -1
- package/textfield/TextArea.stories.d.ts +1 -1
- package/checkbox/CheckboxGroupFieldError.d.ts +0 -8
- package/checkbox/CheckboxGroupItem.d.ts +0 -2
- package/checkbox/CheckboxInner.d.ts +0 -1
- package/checkbox/SingleCheckbox.d.ts +0 -2
- package/checkbox/context.d.ts +0 -3
- package/checkbox/types.d.ts +0 -19
- package/chunks/checkbox-BjPgN3h_.js +0 -200
package/CHANGELOG.md
CHANGED
package/assets/checkbox.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
._indicator_3jfn4_1{--border-color:var(--midas-border-color-primary);width:var(--midas-size-icon-sm);height:var(--midas-size-icon-sm);box-sizing:border-box;border:1px solid var(--border-color);transition:background-color 50ms,border-color 50ms;display:flex}._indicator_3jfn4_1[data-readonly]{--border-color:var(--midas-border-color-subtle)}._indicator_3jfn4_1 svg path{stroke-dasharray:24;stroke-dashoffset:24px;transition:stroke-dashoffset var(--midas-transition-duration-quick) var(--midas-transition-timing-ease-in-out)}._checkboxButton_3jfn4_27[data-selected] svg path,._checkboxButton_3jfn4_27[data-indeterminate] svg path{stroke-dashoffset:0}._checkboxButton_3jfn4_27{--checkbox-base-color:var(--midas-button-background-primary-base);--checkbox-hover-color:var(--midas-button-background-primary-hover);--checkbox-active-color:var(--midas-button-background-primary-active);--checkbox-disabled-border:var(--midas-border-color-disabled);--checkbox-disabled-background:var(--midas-field-disabled,var(--midas-field-01-disabled));--checkbox-readonly-border:var(--midas-border-color-subtle);--checkbox-warning-border:var(--midas-support-border-warning);font-family:var(--midas-typography-font-family);font-weight:var(--midas-typography-weight-regular);gap:var(--midas-space-small);cursor:pointer;width:max-content;color:var(--midas-text-primary);line-height:var(--midas-typography-line-height-30);align-items:center;display:flex}._checkboxButton_3jfn4_27[data-focus-visible],._checkboxButton_3jfn4_27:focus-visible{box-shadow:var(--midas-state-focus);outline:none}@media (forced-colors:active){._checkboxButton_3jfn4_27[data-focus-visible],._checkboxButton_3jfn4_27:focus-visible{outline:var(--midas-state-focus-contrast-mode-outline) solid;outline-offset:var(--midas-state-focus-contrast-mode-offset)}}._checkboxButton_3jfn4_27[data-hovered] ._indicator_3jfn4_1{border-color:var(--checkbox-hover-color)}._checkboxButton_3jfn4_27[data-pressed] ._indicator_3jfn4_1{border-color:var(--checkbox-active-color)}._checkboxButton_3jfn4_27[data-selected] ._indicator_3jfn4_1,._checkboxButton_3jfn4_27[data-indeterminate] ._indicator_3jfn4_1{background:var(--checkbox-base-color);border-color:var(--checkbox-base-color)}._checkboxButton_3jfn4_27[data-selected][data-hovered] ._indicator_3jfn4_1,._checkboxButton_3jfn4_27[data-indeterminate][data-hovered] ._indicator_3jfn4_1{background:var(--checkbox-hover-color);border-color:var(--checkbox-hover-color)}._checkboxButton_3jfn4_27[data-selected][data-pressed] ._indicator_3jfn4_1,._checkboxButton_3jfn4_27[data-indeterminate][data-pressed] ._indicator_3jfn4_1{background:var(--checkbox-active-color);border-color:var(--checkbox-active-color)}._checkboxButton_3jfn4_27[data-invalid] ._indicator_3jfn4_1{outline:2px solid var(--checkbox-warning-border);outline-offset:-2px}._checkboxButton_3jfn4_27[data-invalid][data-hovered] ._indicator_3jfn4_1{opacity:.5;transition:opacity 50ms}._checkboxButton_3jfn4_27[data-disabled]{color:var(--midas-text-disabled);cursor:not-allowed}._checkboxButton_3jfn4_27[data-disabled] ._indicator_3jfn4_1{pointer-events:none;border:1px solid var(--checkbox-disabled-border)}._checkboxButton_3jfn4_27[data-disabled][data-selected] ._indicator_3jfn4_1,._checkboxButton_3jfn4_27[data-disabled][data-indeterminate] ._indicator_3jfn4_1{background:var(--checkbox-disabled-background)}._checkboxButton_3jfn4_27[data-readonly],._checkboxButton_3jfn4_27[data-readonly][data-indeterminate],._checkboxButton_3jfn4_27[data-readonly][data-selected]{pointer-events:none;border-color:var(--checkbox-readonly-border);background-color:#0000}:is(._checkboxButton_3jfn4_27[data-readonly],._checkboxButton_3jfn4_27[data-readonly][data-indeterminate],._checkboxButton_3jfn4_27[data-readonly][data-selected]) ._indicator_3jfn4_1{border-color:var(--checkbox-readonly-border);background:0 0}:is(._checkboxButton_3jfn4_27[data-readonly],._checkboxButton_3jfn4_27[data-readonly][data-indeterminate],._checkboxButton_3jfn4_27[data-readonly][data-selected]) svg{stroke:currentColor}._checkboxField_3jfn4_144{align-items:flex-start;gap:var(--midas-space-05);flex-direction:column;width:100%;display:flex}._checkboxGroup_3jfn4_155{font-family:var(--midas-typography-font-family);font-size:var(--midas-typography-font-size-30);flex-direction:column;min-width:150px;display:flex}._checkboxGroup_3jfn4_155[data-disabled]{color:var(--midas-text-disabled)}._checkboxGroup_3jfn4_155 ._checkboxList_3jfn4_166{gap:var(--midas-space-small);flex-direction:column;display:flex}@media (width<=479px){._checkboxGroup_3jfn4_155 ._checkboxButton_3jfn4_27{padding:var(--midas-space-70) var(--midas-space-medium);border:1px solid var(--midas-border-color-primary);width:auto}._checkboxGroup_3jfn4_155 ._checkboxButton_3jfn4_27[data-hovered]{background-color:var(--midas-layer-01-hover)}._checkboxGroup_3jfn4_155 ._checkboxButton_3jfn4_27[data-invalid]{border:2px solid var(--checkbox-warning-border)}._checkboxGroup_3jfn4_155 ._checkboxButton_3jfn4_27[data-disabled]{border-color:var(--checkbox-disabled-border);pointer-events:none}._checkboxGroup_3jfn4_155 ._checkboxButton_3jfn4_27[data-readonly]{border-color:var(--checkbox-readonly-border)}}@media (forced-colors:active){._checkboxButton_3jfn4_27[data-hovered] ._indicator_3jfn4_1,._checkboxButton_3jfn4_27[data-selected] ._indicator_3jfn4_1,._checkboxButton_3jfn4_27[data-indeterminate] ._indicator_3jfn4_1{border-color:selecteditem}._checkboxButton_3jfn4_27[data-selected] ._indicator_3jfn4_1,._checkboxButton_3jfn4_27[data-indeterminate] ._indicator_3jfn4_1{background:selecteditem}._checkboxButton_3jfn4_27[data-disabled]{color:graytext}._checkboxButton_3jfn4_27[data-disabled] ._indicator_3jfn4_1{border-color:graytext}._checkboxButton_3jfn4_27[data-disabled][data-selected] ._indicator_3jfn4_1,._checkboxButton_3jfn4_27[data-disabled][data-indeterminate] ._indicator_3jfn4_1{background:graytext}}@media (prefers-reduced-motion){._indicator_3jfn4_1 svg path{transition:none}}
|
package/checkbox/Checkbox.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { CheckboxFieldProps as AriaCheckboxFieldProps, ValidationResult } from 'react-aria-components';
|
|
2
|
+
export interface CheckboxProps extends AriaCheckboxFieldProps {
|
|
3
3
|
description?: string;
|
|
4
|
-
errorMessage?: string | ((validation:
|
|
5
|
-
errorPosition?:
|
|
6
|
-
}
|
|
4
|
+
errorMessage?: string | ((validation: ValidationResult) => string);
|
|
5
|
+
errorPosition?: 'top' | 'bottom';
|
|
6
|
+
}
|
|
7
|
+
export declare const Checkbox: import('react').ForwardRefExoticComponent<CheckboxProps & import('react').RefAttributes<HTMLLabelElement>>;
|
|
@@ -2,12 +2,7 @@ import { StoryObj } from '@storybook/react-vite';
|
|
|
2
2
|
import { Checkbox } from './Checkbox';
|
|
3
3
|
type Story = StoryObj<typeof Checkbox>;
|
|
4
4
|
declare const _default: {
|
|
5
|
-
component: import('react').ForwardRefExoticComponent<import('
|
|
6
|
-
className?: string;
|
|
7
|
-
description?: string;
|
|
8
|
-
errorMessage?: string | ((validation: import('react-aria-components').ValidationResult) => string);
|
|
9
|
-
errorPosition?: "top" | "bottom";
|
|
10
|
-
} & import('react').RefAttributes<HTMLLabelElement>>;
|
|
5
|
+
component: import('react').ForwardRefExoticComponent<import('./Checkbox').CheckboxProps & import('react').RefAttributes<HTMLLabelElement>>;
|
|
11
6
|
title: string;
|
|
12
7
|
tags: string[];
|
|
13
8
|
parameters: {
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { CheckboxButtonProps as AriaCheckboxButtonProps } from 'react-aria-components';
|
|
2
|
+
export type CheckboxButtonProps = AriaCheckboxButtonProps;
|
|
3
|
+
export declare const CheckboxButton: import('react').ForwardRefExoticComponent<AriaCheckboxButtonProps & import('react').RefAttributes<HTMLLabelElement>>;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { AriaCheckboxGroupProps } from 'react-aria';
|
|
1
|
+
import { CheckboxGroupProps as AriaCheckboxGroupProps, ValidationResult } from 'react-aria-components';
|
|
2
2
|
import { InfoPopoverProps } from '../label';
|
|
3
|
-
import * as React from 'react';
|
|
4
3
|
export interface CheckboxGroupProps extends AriaCheckboxGroupProps {
|
|
5
|
-
|
|
4
|
+
label?: string;
|
|
5
|
+
description?: string;
|
|
6
|
+
errorMessage?: string | ((validation: ValidationResult) => string);
|
|
6
7
|
showSelectAll?: boolean;
|
|
7
8
|
selectAllLabel?: string;
|
|
8
9
|
errorPosition?: 'top' | 'bottom';
|
|
9
10
|
popover?: InfoPopoverProps;
|
|
10
11
|
}
|
|
11
|
-
export declare
|
|
12
|
+
export declare const CheckboxGroup: ({ label, description, errorMessage, errorPosition, popover, showSelectAll, selectAllLabel, className, children, ...props }: CheckboxGroupProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -3,7 +3,7 @@ import { CheckboxGroup } from './CheckboxGroup';
|
|
|
3
3
|
type Story = StoryObj<typeof CheckboxGroup>;
|
|
4
4
|
declare const _default: {
|
|
5
5
|
title: string;
|
|
6
|
-
component:
|
|
6
|
+
component: ({ label, description, errorMessage, errorPosition, popover, showSelectAll, selectAllLabel, className, children, ...props }: import('./CheckboxGroup').CheckboxGroupProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
7
|
parameters: {
|
|
8
8
|
layout: string;
|
|
9
9
|
};
|
package/checkbox/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
export { Checkbox } from './Checkbox';
|
|
1
|
+
export { type CheckboxProps, Checkbox } from './Checkbox';
|
|
2
|
+
export { type CheckboxButtonProps, CheckboxButton } from './CheckboxButton';
|
|
3
|
+
export { type CheckboxFieldProps, CheckboxField } from './CheckboxField';
|
|
2
4
|
export { type CheckboxGroupProps, CheckboxGroup } from './CheckboxGroup';
|
|
3
|
-
export type { CheckboxProps } from './types';
|
package/checkbox/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
1
|
+
import { i as e, n as t, r as n, t as r } from "../chunks/checkbox-ivInWvEp.js";
|
|
2
|
+
export { t as Checkbox, n as CheckboxButton, e as CheckboxField, r as CheckboxGroup };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CheckboxGroupState } from 'react-stately';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
export declare const useSelectAll: (children: React.ReactNode,
|
|
3
|
+
export declare const useSelectAll: (children: React.ReactNode, state: CheckboxGroupState | null) => {
|
|
4
4
|
allSelected: boolean;
|
|
5
5
|
someSelected: boolean;
|
|
6
6
|
checkboxValues: string[];
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { t as e } from "./clsx-B1NYyfch.js";
|
|
3
|
+
import { t } from "./createLucideIcon-BgluSHFG.js";
|
|
4
|
+
import { t as n } from "./check-DV00NPU0.js";
|
|
5
|
+
import { t as r } from "./useLocalizedStringFormatter-CeyBc0x0.js";
|
|
6
|
+
import { t as i } from "./text-EUdAWwZz.js";
|
|
7
|
+
import { t as a } from "./field-error-pJiSw4PN.js";
|
|
8
|
+
import { n as o, t as s } from "./label-CEYHiWSa.js";
|
|
9
|
+
import * as c from "react";
|
|
10
|
+
import { forwardRef as l, useContext as u } from "react";
|
|
11
|
+
import { CheckboxButton as d, CheckboxField as f, CheckboxGroup as p, CheckboxGroupStateContext as m, composeRenderProps as h } from "react-aria-components";
|
|
12
|
+
import { Fragment as g, jsx as _, jsxs as v } from "react/jsx-runtime";
|
|
13
|
+
import { variables as y } from "@midas-ds/theme";
|
|
14
|
+
import '../assets/checkbox.css';var b = t("minus", [["path", {
|
|
15
|
+
d: "M5 12h14",
|
|
16
|
+
key: "1ays0h"
|
|
17
|
+
}]]), x = {
|
|
18
|
+
indicator: "_indicator_3jfn4_1",
|
|
19
|
+
checkboxButton: "_checkboxButton_3jfn4_27",
|
|
20
|
+
checkboxField: "_checkboxField_3jfn4_144",
|
|
21
|
+
checkboxGroup: "_checkboxGroup_3jfn4_155",
|
|
22
|
+
checkboxList: "_checkboxList_3jfn4_166"
|
|
23
|
+
}, S = ({ className: t, ...n }) => /* @__PURE__ */ _(f, {
|
|
24
|
+
className: e(x.checkboxField, t),
|
|
25
|
+
...n
|
|
26
|
+
}), C = l(({ className: t, ...n }, r) => /* @__PURE__ */ _(d, {
|
|
27
|
+
className: e(x.checkboxButton, t),
|
|
28
|
+
ref: r,
|
|
29
|
+
...n
|
|
30
|
+
})), w = l(({ className: e, description: t, errorMessage: r, errorPosition: o = "top", children: s, ...c }, l) => /* @__PURE__ */ v(S, {
|
|
31
|
+
...c,
|
|
32
|
+
children: [
|
|
33
|
+
t && /* @__PURE__ */ _(i, {
|
|
34
|
+
slot: "description",
|
|
35
|
+
children: t
|
|
36
|
+
}),
|
|
37
|
+
o === "top" && /* @__PURE__ */ _(a, { children: r }),
|
|
38
|
+
/* @__PURE__ */ _(C, {
|
|
39
|
+
ref: l,
|
|
40
|
+
className: e,
|
|
41
|
+
children: ({ isIndeterminate: e }) => /* @__PURE__ */ v(g, { children: [/* @__PURE__ */ _("div", {
|
|
42
|
+
className: x.indicator,
|
|
43
|
+
children: _(e ? b : n, {
|
|
44
|
+
size: 14,
|
|
45
|
+
color: y.iconOnColor
|
|
46
|
+
})
|
|
47
|
+
}), s] })
|
|
48
|
+
}),
|
|
49
|
+
o === "bottom" && /* @__PURE__ */ _(a, { children: r })
|
|
50
|
+
]
|
|
51
|
+
}));
|
|
52
|
+
w.displayName = "Checkbox";
|
|
53
|
+
//#endregion
|
|
54
|
+
//#region src/checkbox/useSelectAll.ts
|
|
55
|
+
var T = (e, t) => {
|
|
56
|
+
let n = t?.value ?? [], r = c.Children.toArray(e).filter((e) => c.isValidElement(e) && e.type === w), i = r.filter((e) => !e.props.isDisabled).map((e) => e.props.value || ""), a = r.filter((e) => e.props.isDisabled).map((e) => e.props.value || "").filter((e) => n.includes(e)), o = n.filter((e) => i.includes(e)).length, s = o === 0, l = o === i.length;
|
|
57
|
+
return {
|
|
58
|
+
allSelected: l,
|
|
59
|
+
someSelected: !s && !l,
|
|
60
|
+
checkboxValues: i,
|
|
61
|
+
disabledSelectedValues: a
|
|
62
|
+
};
|
|
63
|
+
}, E = {
|
|
64
|
+
en: { selectAll: "Select all" },
|
|
65
|
+
sv: { selectAll: "Välj alla" }
|
|
66
|
+
}, D = ({ checkboxes: e, label: t }) => {
|
|
67
|
+
let n = u(m), i = r(E), { allSelected: a, someSelected: o, checkboxValues: s, disabledSelectedValues: c } = T(e, n);
|
|
68
|
+
return /* @__PURE__ */ _(m.Provider, {
|
|
69
|
+
value: null,
|
|
70
|
+
children: /* @__PURE__ */ _(w, {
|
|
71
|
+
isSelected: a,
|
|
72
|
+
isIndeterminate: o,
|
|
73
|
+
isReadOnly: n?.isReadOnly,
|
|
74
|
+
isDisabled: n?.isDisabled,
|
|
75
|
+
onChange: (e) => {
|
|
76
|
+
n?.setValue(e ? [...s, ...c] : c);
|
|
77
|
+
},
|
|
78
|
+
children: t || i.format("selectAll")
|
|
79
|
+
})
|
|
80
|
+
});
|
|
81
|
+
}, O = ({ label: t, description: n, errorMessage: r, errorPosition: c = "top", popover: l, showSelectAll: u, selectAllLabel: d, className: f, children: m, ...y }) => /* @__PURE__ */ _(p, {
|
|
82
|
+
...y,
|
|
83
|
+
className: e(x.checkboxGroup, f),
|
|
84
|
+
children: h(m, (e) => /* @__PURE__ */ v(g, { children: [
|
|
85
|
+
/* @__PURE__ */ _(o, {
|
|
86
|
+
popover: l,
|
|
87
|
+
children: t && /* @__PURE__ */ _(s, { children: t })
|
|
88
|
+
}),
|
|
89
|
+
n && /* @__PURE__ */ _(i, {
|
|
90
|
+
slot: "description",
|
|
91
|
+
children: n
|
|
92
|
+
}),
|
|
93
|
+
c === "top" && r && /* @__PURE__ */ _(a, { children: r }),
|
|
94
|
+
/* @__PURE__ */ v("div", {
|
|
95
|
+
className: x.checkboxList,
|
|
96
|
+
children: [u && /* @__PURE__ */ _(D, {
|
|
97
|
+
label: d,
|
|
98
|
+
checkboxes: e
|
|
99
|
+
}), e]
|
|
100
|
+
}),
|
|
101
|
+
c === "bottom" && r && /* @__PURE__ */ _(a, { children: r })
|
|
102
|
+
] }))
|
|
103
|
+
});
|
|
104
|
+
//#endregion
|
|
105
|
+
export { S as i, w as n, C as r, O as t };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { n as e, t } from "./clsx-B1NYyfch.js";
|
|
2
2
|
import { t as n } from "./chevron-down-CP7nEDei.js";
|
|
3
|
-
import { n as r } from "./checkbox-
|
|
3
|
+
import { n as r } from "./checkbox-ivInWvEp.js";
|
|
4
4
|
import { t as i } from "./x-BJAOO5a5.js";
|
|
5
5
|
import { t as a } from "./useLocalizedStringFormatter-CeyBc0x0.js";
|
|
6
6
|
import { t as o } from "./text-EUdAWwZz.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { t as e } from "./clsx-B1NYyfch.js";
|
|
3
3
|
import { t } from "./createLucideIcon-BgluSHFG.js";
|
|
4
|
-
import { n } from "./checkbox-
|
|
4
|
+
import { n } from "./checkbox-ivInWvEp.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,49 +5,49 @@ import { t as n } from "./chunks/clsx-B1NYyfch.js";
|
|
|
5
5
|
import { t as r } from "./chunks/spinner-DMR5G-6u.js";
|
|
6
6
|
import { a as i, i as a, n as o, r as s, t as c } from "./chunks/layout-DVj8wSj3.js";
|
|
7
7
|
import { n as l, t as u } from "./chunks/link-CQoSw1Pv.js";
|
|
8
|
-
import { a as d, i as f, n as p, o as m, r as h, t as g } from "./chunks/table-
|
|
8
|
+
import { a as d, i as f, n as p, o as m, r as h, t as g } from "./chunks/table-O7Ht2ilY.js";
|
|
9
9
|
import { t as _ } from "./chunks/link-button-BMFzCHH8.js";
|
|
10
10
|
import { n as v, t as y } from "./chunks/date-picker-1W7OmCT0.js";
|
|
11
11
|
import { n as b, t as x } from "./chunks/calendar-R7x0m8ch.js";
|
|
12
|
-
import {
|
|
13
|
-
import { n as
|
|
14
|
-
import { t as
|
|
15
|
-
import { n as
|
|
16
|
-
import { t as
|
|
17
|
-
import { n as
|
|
18
|
-
import { t as
|
|
19
|
-
import { n as
|
|
20
|
-
import { n as
|
|
21
|
-
import { t as
|
|
22
|
-
import { t as
|
|
23
|
-
import { a as
|
|
24
|
-
import { t as
|
|
25
|
-
import { t as
|
|
26
|
-
import { t as
|
|
27
|
-
import { n as
|
|
28
|
-
import { t as
|
|
29
|
-
import { n as
|
|
30
|
-
import { a as
|
|
31
|
-
import { t as
|
|
32
|
-
import { a as
|
|
33
|
-
import { i as
|
|
34
|
-
import { n as
|
|
35
|
-
import { n as
|
|
36
|
-
import { t as
|
|
37
|
-
import { n as
|
|
38
|
-
import { n as
|
|
39
|
-
import { t as
|
|
40
|
-
import { i as
|
|
41
|
-
import { t as
|
|
42
|
-
import { n as
|
|
43
|
-
import { t as
|
|
44
|
-
import { i as
|
|
45
|
-
import { i as
|
|
46
|
-
import { t as
|
|
47
|
-
import { a as
|
|
12
|
+
import { i as S, n as C, r as w, t as T } from "./chunks/checkbox-ivInWvEp.js";
|
|
13
|
+
import { n as E, t as D } from "./chunks/color-scheme-switch-jgoxUu3x.js";
|
|
14
|
+
import { t as O } from "./chunks/search-field-d7FV4Kuv.js";
|
|
15
|
+
import { n as k, t as A } from "./chunks/file-list-DM1Vtkun.js";
|
|
16
|
+
import { t as j } from "./chunks/useLocalizedStringFormatter-CeyBc0x0.js";
|
|
17
|
+
import { n as M, t as N } from "./chunks/button-Ch860h28.js";
|
|
18
|
+
import { t as P } from "./chunks/heading-bnDePIbv.js";
|
|
19
|
+
import { n as F, t as I } from "./chunks/badge-BplGU5BS.js";
|
|
20
|
+
import { n as L, t as R } from "./chunks/breadcrumbs-C-Z6UlQn.js";
|
|
21
|
+
import { t as z } from "./chunks/text-EUdAWwZz.js";
|
|
22
|
+
import { t as B } from "./chunks/field-error-pJiSw4PN.js";
|
|
23
|
+
import { a as V, c as H, i as U, l as W, n as G, o as K, r as q, s as J, t as Y } from "./chunks/card-Bzc8kToe.js";
|
|
24
|
+
import { t as X } from "./chunks/character-counter-CSoVSrxZ.js";
|
|
25
|
+
import { t as Z } from "./chunks/label-CEYHiWSa.js";
|
|
26
|
+
import { t as Q } from "./chunks/popover-wAwxm_cM.js";
|
|
27
|
+
import { n as $, r as ee, t as te } from "./chunks/modal-C-xHt7Ds.js";
|
|
28
|
+
import { t as ne } from "./chunks/icons-UBHIX2oV.js";
|
|
29
|
+
import { n as re, t as ie } from "./chunks/toggle-button-BgUQKcK-.js";
|
|
30
|
+
import { a as ae, i as oe, n as se, o as ce, r as le, t as ue } from "./chunks/menu-CPCGm0MC.js";
|
|
31
|
+
import { t as de } from "./chunks/combobox-DDO4fEtI.js";
|
|
32
|
+
import { a as fe, c as pe, i as me, n as he, o as ge, r as _e, s as ve, t as ye } from "./chunks/list-box-VdBVTwZK.js";
|
|
33
|
+
import { i as be, n as xe, r as Se, t as Ce } from "./chunks/date-field-DG5TYsTF.js";
|
|
34
|
+
import { n as we, t as Te } from "./chunks/file-upload-DInuSFCB.js";
|
|
35
|
+
import { n as Ee, t as De } from "./chunks/grid-DZB3GGDg.js";
|
|
36
|
+
import { t as Oe } from "./chunks/info-banner-DnFNZ1_o.js";
|
|
37
|
+
import { n as ke, t as Ae } from "./chunks/tooltip-D7LYQwj0.js";
|
|
38
|
+
import { n as je, t as Me } from "./chunks/logo-CDxNjDeI.js";
|
|
39
|
+
import { t as Ne } from "./chunks/progress-bar-Cft_RPHz.js";
|
|
40
|
+
import { i as Pe, n as Fe, r as Ie, t as Le } from "./chunks/radio-W0YqY7lo.js";
|
|
41
|
+
import { t as Re } from "./chunks/select-LjjT_7hr.js";
|
|
42
|
+
import { n as ze, r as Be, t as Ve } from "./chunks/tag-mzNjP8EX.js";
|
|
43
|
+
import { t as He } from "./chunks/skeleton-DWmvym7R.js";
|
|
44
|
+
import { i as Ue, n as We, r as Ge, t as Ke } from "./chunks/tabs-BFFTnO4i.js";
|
|
45
|
+
import { i as qe, n as Je, r as Ye, t as Xe } from "./chunks/textfield-BsijPPRD.js";
|
|
46
|
+
import { t as Ze } from "./chunks/time-field-BlNUOjUJ.js";
|
|
47
|
+
import { a as Qe, i as $e, n as et, o as tt, r as nt, t as rt } from "./chunks/toast-Cz0JDIr1.js";
|
|
48
48
|
//#endregion
|
|
49
49
|
//#region src/version.ts
|
|
50
|
-
var
|
|
50
|
+
var it = {
|
|
51
51
|
name: "@midas-ds/components",
|
|
52
52
|
author: { name: "Migrationsverket" },
|
|
53
53
|
keywords: [
|
|
@@ -59,7 +59,7 @@ var nt = {
|
|
|
59
59
|
description: "Midas Components",
|
|
60
60
|
homepage: "https://designsystem.migrationsverket.se/",
|
|
61
61
|
license: "CC0-1.0",
|
|
62
|
-
version: "17.
|
|
62
|
+
version: "17.25.0",
|
|
63
63
|
module: "./index.js",
|
|
64
64
|
type: "module",
|
|
65
65
|
main: "./index.js",
|
|
@@ -91,4 +91,4 @@ var nt = {
|
|
|
91
91
|
}
|
|
92
92
|
}.version;
|
|
93
93
|
//#endregion
|
|
94
|
-
export { e as Accordion, t as AccordionItem,
|
|
94
|
+
export { e as Accordion, t as AccordionItem, F as Badge, I as BadgeContainer, R as Breadcrumb, L as Breadcrumbs, M as Button, N as ButtonGroup, b as Calendar, q as Card, U as CardActionArea, V as CardActions, G as CardBody, K as CardContent, Y as CardHeader, J as CardImage, H as CardLink, W as CardTitle, g as Cell, X as CharacterCounter, C as Checkbox, w as CheckboxButton, S as CheckboxField, T as CheckboxGroup, E as ColorSchemeSwitch, D as ColorSchemeSwitchMenu, p as Column, de as ComboBox, ne as ContrastFilled, be as DateField, xe as DateInput, Ce as DateInputDivider, v as DatePicker, y as DateRangePicker, Se as DateSegment, te as DialogTrigger, Te as DropZone, B as FieldError, k as FileList, A as FileListItem, we as FileTrigger, rt as GlobalToastRegion, Ee as Grid, De as GridItem, s as Header, P as Heading, Oe as InfoBanner, Ye as Input, Z as Label, c as Layout, u as Link, _ as LinkButton, pe as ListBox, ve as ListBoxButton, ye as ListBoxEmptyState, he as ListBoxHeader, ge as ListBoxItem, _e as ListBoxLoadMoreItem, fe as ListBoxPopover, me as ListBoxSection, Me as Logo, je as LogoContext, ae as Menu, oe as MenuItem, le as MenuPopover, se as MenuSection, ce as MenuTrigger, $ as Modal, ee as ModalOverlay, o as Navbar, Q as Popover, Ne as ProgressBar, Fe as Radio, Ie as RadioButton, Pe as RadioField, Le as RadioGroup, x as RangeCalendar, l as RouterProvider, h as Row, O as SearchField, Re as Select, ue as Separator, a as Sidebar, i as SidebarLink, He as Skeleton, r as Spinner, Ge as Tab, Ke as TabList, We as TabPanel, f as Table, d as TableBody, m as TableHeader, Ue as Tabs, Be as Tag, Ve as TagGroup, ze as TagList, z as Text, Xe as TextArea, Je as TextField, qe as TextFieldBase, Ze as TimeField, et as Toast, nt as ToastProvider, $e as ToastRegion, re as ToggleButton, ie as ToggleButtonGroup, Ae as Tooltip, ke as TooltipTrigger, it as VERSION, n as clsx, Qe as toastQueue, j as useLocalizedStringFormatter, tt as useToastState };
|
package/package.json
CHANGED
package/select/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as e } from "../chunks/select-
|
|
1
|
+
import { t as e } from "../chunks/select-LjjT_7hr.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-
|
|
1
|
+
import { a as e, i as t, n, o as r, r as i, t as a } from "../chunks/table-O7Ht2ilY.js";
|
|
2
2
|
export { a as Cell, n as Column, i as Row, t as Table, e as TableBody, r as TableHeader };
|
|
@@ -144,8 +144,8 @@ export declare const Disabled: {
|
|
|
144
144
|
autoComplete?: string;
|
|
145
145
|
maxLength?: number;
|
|
146
146
|
minLength?: number;
|
|
147
|
-
isRequired?: boolean;
|
|
148
147
|
validationBehavior?: "native" | "aria";
|
|
148
|
+
isRequired?: boolean;
|
|
149
149
|
validate?: ((value: string) => import('@react-types/shared').ValidationError | true | null | undefined) | undefined;
|
|
150
150
|
errorPosition?: "top" | "bottom";
|
|
151
151
|
showCounter?: boolean;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { CheckboxGroupState } from 'react-stately';
|
|
2
|
-
import { CheckboxGroupProps } from './CheckboxGroup';
|
|
3
|
-
import * as React from 'react';
|
|
4
|
-
interface CheckboxGroupFieldErrorProps extends CheckboxGroupProps {
|
|
5
|
-
state: CheckboxGroupState;
|
|
6
|
-
}
|
|
7
|
-
export declare const CheckboxGroupFieldError: React.FC<CheckboxGroupFieldErrorProps>;
|
|
8
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const CheckboxInner: import('react').ForwardRefExoticComponent<import('./types').CheckboxComponentProps & import('react-aria').CheckboxAria & import('react').RefAttributes<HTMLLabelElement>>;
|
package/checkbox/context.d.ts
DELETED
package/checkbox/types.d.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { AriaCheckboxProps, CheckboxAria, FocusRingAria, HoverResult, PressResult } from 'react-aria';
|
|
2
|
-
import { SlotProps, ValidationResult } from 'react-aria-components';
|
|
3
|
-
import { CheckboxGroupState } from 'react-stately';
|
|
4
|
-
export type CheckboxProps = AriaCheckboxProps & SlotProps & {
|
|
5
|
-
className?: string;
|
|
6
|
-
description?: string;
|
|
7
|
-
errorMessage?: string | ((validation: ValidationResult) => string);
|
|
8
|
-
errorPosition?: 'top' | 'bottom';
|
|
9
|
-
};
|
|
10
|
-
export interface CheckboxComponentProps extends CheckboxProps {
|
|
11
|
-
focusRingAria: FocusRingAria;
|
|
12
|
-
pressResult: PressResult;
|
|
13
|
-
hoverResult: HoverResult;
|
|
14
|
-
inputRef: React.RefObject<HTMLInputElement | null>;
|
|
15
|
-
}
|
|
16
|
-
export interface CheckboxGroupItemProps extends CheckboxComponentProps {
|
|
17
|
-
state: CheckboxGroupState;
|
|
18
|
-
}
|
|
19
|
-
export type CheckboxInnerProps = CheckboxComponentProps & CheckboxAria;
|
|
@@ -1,200 +0,0 @@
|
|
|
1
|
-
import { n as e } from "./clsx-B1NYyfch.js";
|
|
2
|
-
import { t } from "./createLucideIcon-BgluSHFG.js";
|
|
3
|
-
import { t as n } from "./check-DV00NPU0.js";
|
|
4
|
-
import { t as r } from "./useLocalizedStringFormatter-CeyBc0x0.js";
|
|
5
|
-
import { t as i } from "./text-EUdAWwZz.js";
|
|
6
|
-
import { t as a } from "./field-error-pJiSw4PN.js";
|
|
7
|
-
import { n as o, t as s } from "./label-CEYHiWSa.js";
|
|
8
|
-
import * as c from "react";
|
|
9
|
-
import l, { forwardRef as u, useContext as d, useRef as f } from "react";
|
|
10
|
-
import { CheckboxContext as p, FieldErrorContext as m, FormContext as h, useContextProps as g, useSlottedContext as _ } from "react-aria-components";
|
|
11
|
-
import { jsx as v, jsxs as y } from "react/jsx-runtime";
|
|
12
|
-
import { VisuallyHidden as b, mergeProps as x, useCheckbox as S, useCheckboxGroup as C, useCheckboxGroupItem as w, useFocusRing as T, useHover as E, usePress as D } from "react-aria";
|
|
13
|
-
import { variables as O } from "@midas-ds/theme";
|
|
14
|
-
import { useCheckboxGroupState as k, useToggleState as A } from "react-stately";
|
|
15
|
-
import '../assets/checkbox.css';var j = t("minus", [["path", {
|
|
16
|
-
d: "M5 12h14",
|
|
17
|
-
key: "1ays0h"
|
|
18
|
-
}]]), M = l.createContext(null), N = {
|
|
19
|
-
checkboxInner: "_checkboxInner_klbao_1",
|
|
20
|
-
checkbox: "_checkbox_klbao_1",
|
|
21
|
-
checkboxWrapper: "_checkboxWrapper_klbao_144",
|
|
22
|
-
checkboxGroup: "_checkboxGroup_klbao_155",
|
|
23
|
-
checkboxList: "_checkboxList_klbao_166"
|
|
24
|
-
}, P = u(({ hoverResult: t, pressResult: r, focusRingAria: o, labelProps: s, slot: c, className: l, isSelected: u, isIndeterminate: d, isDisabled: f, isInvalid: p, isReadOnly: h, isRequired: g, inputProps: _, inputRef: S, children: C, description: w, errorMessage: T, errorPosition: E = "top", descriptionProps: D, errorMessageProps: k, validationErrors: A, validationDetails: M }, P) => {
|
|
25
|
-
let { hoverProps: F, isHovered: I } = t, { pressProps: L, isPressed: R } = r, { isFocused: z, isFocusVisible: B, focusProps: V } = o, H = /* @__PURE__ */ y("label", {
|
|
26
|
-
ref: P,
|
|
27
|
-
...x(F, L, s),
|
|
28
|
-
slot: w || T ? void 0 : c || void 0,
|
|
29
|
-
className: e(N.checkbox, l),
|
|
30
|
-
"data-hovered": I || void 0,
|
|
31
|
-
"data-selected": u || void 0,
|
|
32
|
-
"data-indeterminate": d || void 0,
|
|
33
|
-
"data-pressed": R || void 0,
|
|
34
|
-
"data-disabled": f || void 0,
|
|
35
|
-
"data-readonly": h || void 0,
|
|
36
|
-
"data-invalid": p || void 0,
|
|
37
|
-
"data-focused": z || void 0,
|
|
38
|
-
"data-focus-visible": B || void 0,
|
|
39
|
-
"data-required": g || void 0,
|
|
40
|
-
children: [
|
|
41
|
-
/* @__PURE__ */ v("div", {
|
|
42
|
-
className: e(N.checkboxInner),
|
|
43
|
-
children: v(d ? j : n, {
|
|
44
|
-
size: 14,
|
|
45
|
-
color: O.iconOnColor
|
|
46
|
-
})
|
|
47
|
-
}),
|
|
48
|
-
/* @__PURE__ */ v(b, { children: /* @__PURE__ */ v("input", {
|
|
49
|
-
...x(_, V),
|
|
50
|
-
ref: S
|
|
51
|
-
}) }),
|
|
52
|
-
C
|
|
53
|
-
]
|
|
54
|
-
});
|
|
55
|
-
if (!w && !T) return H;
|
|
56
|
-
let U = T && /* @__PURE__ */ v(m.Provider, {
|
|
57
|
-
value: {
|
|
58
|
-
isInvalid: !!p,
|
|
59
|
-
validationErrors: A,
|
|
60
|
-
validationDetails: M
|
|
61
|
-
},
|
|
62
|
-
children: /* @__PURE__ */ v(a, {
|
|
63
|
-
...k,
|
|
64
|
-
children: T
|
|
65
|
-
})
|
|
66
|
-
});
|
|
67
|
-
return /* @__PURE__ */ y("div", {
|
|
68
|
-
className: N.checkboxWrapper,
|
|
69
|
-
slot: c || void 0,
|
|
70
|
-
children: [
|
|
71
|
-
w && /* @__PURE__ */ v(i, {
|
|
72
|
-
slot: "description",
|
|
73
|
-
...D,
|
|
74
|
-
children: w
|
|
75
|
-
}),
|
|
76
|
-
E === "top" && U,
|
|
77
|
-
H,
|
|
78
|
-
E === "bottom" && U
|
|
79
|
-
]
|
|
80
|
-
});
|
|
81
|
-
});
|
|
82
|
-
P.displayName = "CheckboxInner";
|
|
83
|
-
//#endregion
|
|
84
|
-
//#region src/checkbox/CheckboxGroupItem.tsx
|
|
85
|
-
var F = u((e, t) => {
|
|
86
|
-
let n = w({
|
|
87
|
-
...e,
|
|
88
|
-
value: e.value || ""
|
|
89
|
-
}, e.state, e.inputRef);
|
|
90
|
-
return /* @__PURE__ */ v(P, {
|
|
91
|
-
...e,
|
|
92
|
-
...n,
|
|
93
|
-
ref: t
|
|
94
|
-
});
|
|
95
|
-
});
|
|
96
|
-
F.displayName = "CheckBoxGroupItem";
|
|
97
|
-
//#endregion
|
|
98
|
-
//#region src/checkbox/SingleCheckbox.tsx
|
|
99
|
-
var I = u((e, t) => {
|
|
100
|
-
let n = S(e, A(e), e.inputRef);
|
|
101
|
-
return /* @__PURE__ */ v(P, {
|
|
102
|
-
...e,
|
|
103
|
-
...n,
|
|
104
|
-
ref: t
|
|
105
|
-
});
|
|
106
|
-
});
|
|
107
|
-
I.displayName = "SingleCheckbox";
|
|
108
|
-
//#endregion
|
|
109
|
-
//#region src/checkbox/Checkbox.tsx
|
|
110
|
-
var L = u((e, t) => {
|
|
111
|
-
[e, t] = g(e, t, p);
|
|
112
|
-
let n = _(h), r = e.validationBehavior ?? n?.validationBehavior ?? "native", i = d(M), a = f(null), o = E(e), s = D({
|
|
113
|
-
ref: t,
|
|
114
|
-
isDisabled: e.isDisabled
|
|
115
|
-
}), c = T();
|
|
116
|
-
return i ? /* @__PURE__ */ v(F, {
|
|
117
|
-
...e,
|
|
118
|
-
state: i,
|
|
119
|
-
inputRef: a,
|
|
120
|
-
hoverResult: o,
|
|
121
|
-
pressResult: s,
|
|
122
|
-
focusRingAria: c,
|
|
123
|
-
validationBehavior: r
|
|
124
|
-
}) : /* @__PURE__ */ v(I, {
|
|
125
|
-
...e,
|
|
126
|
-
inputRef: a,
|
|
127
|
-
hoverResult: o,
|
|
128
|
-
pressResult: s,
|
|
129
|
-
focusRingAria: c,
|
|
130
|
-
validationBehavior: r
|
|
131
|
-
});
|
|
132
|
-
});
|
|
133
|
-
L.displayName = "Checkbox";
|
|
134
|
-
//#endregion
|
|
135
|
-
//#region src/checkbox/useSelectAll.ts
|
|
136
|
-
var R = (e, { value: t }) => {
|
|
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
|
-
return {
|
|
139
|
-
allSelected: s,
|
|
140
|
-
someSelected: !o && !s,
|
|
141
|
-
checkboxValues: r,
|
|
142
|
-
disabledSelectedValues: i
|
|
143
|
-
};
|
|
144
|
-
}, z = ({ state: e, errorMessage: t }) => /* @__PURE__ */ v(m.Provider, {
|
|
145
|
-
value: e.displayValidation,
|
|
146
|
-
children: /* @__PURE__ */ v(a, { children: t })
|
|
147
|
-
}), B = {
|
|
148
|
-
en: { selectAll: "Select all" },
|
|
149
|
-
sv: { selectAll: "Välj alla" }
|
|
150
|
-
};
|
|
151
|
-
//#endregion
|
|
152
|
-
//#region src/checkbox/CheckboxGroup.tsx
|
|
153
|
-
function V(e) {
|
|
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);
|
|
156
|
-
};
|
|
157
|
-
return /* @__PURE__ */ y("div", {
|
|
158
|
-
...a,
|
|
159
|
-
className: N.checkboxGroup,
|
|
160
|
-
"data-readonly": e.isReadOnly || void 0,
|
|
161
|
-
"data-disabled": e.isDisabled || void 0,
|
|
162
|
-
children: [
|
|
163
|
-
/* @__PURE__ */ v(o, {
|
|
164
|
-
popover: e.popover,
|
|
165
|
-
children: e.label && /* @__PURE__ */ v(s, {
|
|
166
|
-
...c,
|
|
167
|
-
children: e.label
|
|
168
|
-
})
|
|
169
|
-
}),
|
|
170
|
-
e.description && /* @__PURE__ */ v(i, {
|
|
171
|
-
slot: "description",
|
|
172
|
-
...l,
|
|
173
|
-
children: e.description
|
|
174
|
-
}),
|
|
175
|
-
e.errorPosition === "top" && /* @__PURE__ */ v(z, {
|
|
176
|
-
...e,
|
|
177
|
-
state: t
|
|
178
|
-
}),
|
|
179
|
-
/* @__PURE__ */ y("div", {
|
|
180
|
-
className: N.checkboxList,
|
|
181
|
-
children: [e.showSelectAll && /* @__PURE__ */ v(L, {
|
|
182
|
-
isSelected: u,
|
|
183
|
-
isIndeterminate: d,
|
|
184
|
-
isReadOnly: e.isReadOnly,
|
|
185
|
-
onChange: m,
|
|
186
|
-
children: e.selectAllLabel || n.format("selectAll")
|
|
187
|
-
}), /* @__PURE__ */ v(M.Provider, {
|
|
188
|
-
value: t,
|
|
189
|
-
children: e.children
|
|
190
|
-
})]
|
|
191
|
-
}),
|
|
192
|
-
e.errorPosition === "bottom" && /* @__PURE__ */ v(z, {
|
|
193
|
-
...e,
|
|
194
|
-
state: t
|
|
195
|
-
})
|
|
196
|
-
]
|
|
197
|
-
});
|
|
198
|
-
}
|
|
199
|
-
//#endregion
|
|
200
|
-
export { L as n, V as t };
|