@midas-ds/components 17.8.3 β 17.9.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 +18 -0
- package/assets/SearchField.css +1 -1
- package/chunks/SearchField-VIMb28RB.js +118 -0
- package/index.js +2 -2
- package/package.json +1 -1
- package/search-field/SearchField.d.ts +22 -4
- package/search-field/SearchField.stories.d.ts +10 -1
- package/search-field/index.js +1 -1
- package/chunks/SearchField-C_wD8YuG.js +0 -128
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,21 @@
|
|
|
1
|
+
## 17.9.0 (2026-03-19)
|
|
2
|
+
|
|
3
|
+
### π Features
|
|
4
|
+
|
|
5
|
+
- **components,search-field:** deprecate built-in submit button, fix a11y ([717b9b34ab](https://github.com/migrationsverket/midas/commit/717b9b34ab))
|
|
6
|
+
|
|
7
|
+
### π©Ή Fixes
|
|
8
|
+
|
|
9
|
+
- **components,search-field:** make built-in button non-breaking, add future flag ([4c6a0b985e](https://github.com/migrationsverket/midas/commit/4c6a0b985e))
|
|
10
|
+
|
|
11
|
+
### π Refactoring
|
|
12
|
+
|
|
13
|
+
- **components,search-field:** rebuild on RAC SearchField component ([86de78182e](https://github.com/migrationsverket/midas/commit/86de78182e))
|
|
14
|
+
|
|
15
|
+
### π Documentation changes
|
|
16
|
+
|
|
17
|
+
- **components,search-field:** link v18 tracking issue from showButton JSDoc ([51c90e03b7](https://github.com/migrationsverket/midas/commit/51c90e03b7))
|
|
18
|
+
|
|
1
19
|
## 17.8.3 (2026-03-18)
|
|
2
20
|
|
|
3
21
|
### π§ Maintenance
|
package/assets/SearchField.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
._container_1msv3_1{font-family:var(--midas-typography-font-family);color:var(--midas-text-primary)}._container_1msv3_1[data-disabled]{cursor:not-allowed}._inner_1msv3_10{display:flex;width:100%}._inputContainer_1msv3_15{display:flex;position:relative;height:var(--midas-size-control);width:100%}._inputContainer_1msv3_15._medium_1msv3_21{height:var(--midas-size-control-md)}._icon_1msv3_26{color:var(--midas-icon-primary);position:absolute;left:var(--midas-space-70);top:50%;transform:translateY(-50%)}@media(forced-colors:active){._icon_1msv3_26{stroke:canvastext}}._clear_1msv3_38{display:flex;align-items:center;position:absolute;padding:var(--midas-space-70);border:none;right:0;top:50%;transform:translateY(-50%);background-color:transparent}._clear_1msv3_38._medium_1msv3_21{height:var(--midas-size-control-md);padding:var(--midas-space-50) var(--midas-space-70)}._input_1msv3_15{all:unset;color:var(--midas-text-primary);box-sizing:border-box;line-height:var(--midas-typography-line-height-10);appearance:none;background-color:var(--midas-field-01-base);width:100%;height:var(--midas-size-control);padding:var(--midas-space-70) 0 var(--midas-space-70) var(--midas-space-150);border-bottom:1px solid var(--midas-border-color-primary)}@media(forced-colors:active){._input_1msv3_15{border:1px solid}}._input_1msv3_15._medium_1msv3_21{height:var(--midas-size-control-md);padding:var(--midas-space-50) 0 var(--midas-space-50) var(--midas-space-150)}._input_1msv3_15:focus-visible{box-shadow:var(--midas-state-focus)}@media(forced-colors:active){._input_1msv3_15:focus-visible{outline:3px solid highlight;outline-offset:2px}}._input_1msv3_15[data-invalid]{border:none;box-shadow:var(--midas-state-invalid)}._input_1msv3_15[data-disabled]{pointer-events:none;background-color:var(--midas-field-disabled);border:none;border-bottom:1px solid var(--midas-border-color-disabled);color:var(--midas-text-disabled)}@media(forced-colors:active){._input_1msv3_15[data-disabled]{border:1px solid}}._input_1msv3_15::-webkit-search-decoration,._input_1msv3_15::-webkit-search-cancel-button,._input_1msv3_15::-webkit-search-results-button,._input_1msv3_15::-webkit-search-results-decoration{-webkit-appearance:none}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as i, jsxs as s, Fragment as F } from "react/jsx-runtime";
|
|
3
|
+
import { useSlottedContext as j, FormContext as N, SearchField as g, Input as y } from "react-aria-components";
|
|
4
|
+
import { s as B } from "./TextField.module-BDIbEV87.js";
|
|
5
|
+
import { B as u } from "./Button-GCROAMSl.js";
|
|
6
|
+
import { c as o } from "./clsx-AexbMWKp.js";
|
|
7
|
+
import { F as h } from "./FieldError-krpMBtie.js";
|
|
8
|
+
import { c as C } from "./createLucideIcon-CP-mMPfa.js";
|
|
9
|
+
import { X as k } from "./x-B9bYxG31.js";
|
|
10
|
+
import { u as I } from "./useLocalizedStringFormatter-BHvsRxDk.js";
|
|
11
|
+
import '../assets/SearchField.css';const D = [
|
|
12
|
+
["path", { d: "m21 21-4.34-4.34", key: "14j7rj" }],
|
|
13
|
+
["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }]
|
|
14
|
+
], E = C("search", D), L = "_container_1msv3_1", T = "_inner_1msv3_10", V = "_inputContainer_1msv3_15", $ = "_medium_1msv3_21", w = "_icon_1msv3_26", O = "_clear_1msv3_38", P = "_input_1msv3_15", n = {
|
|
15
|
+
container: L,
|
|
16
|
+
inner: T,
|
|
17
|
+
inputContainer: V,
|
|
18
|
+
medium: $,
|
|
19
|
+
icon: w,
|
|
20
|
+
clear: O,
|
|
21
|
+
input: P
|
|
22
|
+
}, X = { search: "Search" }, q = { search: "SΓΆk" }, A = {
|
|
23
|
+
en: X,
|
|
24
|
+
sv: q
|
|
25
|
+
};
|
|
26
|
+
function G(a) {
|
|
27
|
+
return !!a?.length;
|
|
28
|
+
}
|
|
29
|
+
const z = ({
|
|
30
|
+
errorPosition: a = "top",
|
|
31
|
+
size: r = "large",
|
|
32
|
+
showButton: _,
|
|
33
|
+
className: v,
|
|
34
|
+
errorMessage: m,
|
|
35
|
+
placeholder: l,
|
|
36
|
+
validationBehavior: f,
|
|
37
|
+
...e
|
|
38
|
+
}) => {
|
|
39
|
+
const S = I(A), b = j(N), p = f ?? b?.validationBehavior ?? "aria", x = _ !== !1, d = (t) => {
|
|
40
|
+
!t || e.isInvalid || e.validate && G(e.validate(t)) || e.onSubmit?.(t);
|
|
41
|
+
};
|
|
42
|
+
return /* @__PURE__ */ i(
|
|
43
|
+
g,
|
|
44
|
+
{
|
|
45
|
+
...e,
|
|
46
|
+
onSubmit: d,
|
|
47
|
+
"aria-label": e["aria-label"] ?? l,
|
|
48
|
+
className: o(n.container, v),
|
|
49
|
+
validationBehavior: p,
|
|
50
|
+
children: ({ state: t }) => /* @__PURE__ */ s(F, { children: [
|
|
51
|
+
a === "top" && /* @__PURE__ */ i(h, { children: ({ validationErrors: c }) => m ?? c.join(" ") }),
|
|
52
|
+
/* @__PURE__ */ s("div", { className: n.inner, children: [
|
|
53
|
+
/* @__PURE__ */ s(
|
|
54
|
+
"div",
|
|
55
|
+
{
|
|
56
|
+
className: o(n.inputContainer, {
|
|
57
|
+
[n.medium]: r === "medium"
|
|
58
|
+
}),
|
|
59
|
+
children: [
|
|
60
|
+
/* @__PURE__ */ i(
|
|
61
|
+
E,
|
|
62
|
+
{
|
|
63
|
+
size: 20,
|
|
64
|
+
className: n.icon
|
|
65
|
+
}
|
|
66
|
+
),
|
|
67
|
+
/* @__PURE__ */ i(
|
|
68
|
+
y,
|
|
69
|
+
{
|
|
70
|
+
placeholder: l,
|
|
71
|
+
className: o(
|
|
72
|
+
B.input,
|
|
73
|
+
n.input,
|
|
74
|
+
{ [n.medium]: r === "medium" }
|
|
75
|
+
)
|
|
76
|
+
}
|
|
77
|
+
),
|
|
78
|
+
t.value.length > 0 && /* @__PURE__ */ i(
|
|
79
|
+
u,
|
|
80
|
+
{
|
|
81
|
+
variant: "icon",
|
|
82
|
+
size: r,
|
|
83
|
+
className: o(n.clear, {
|
|
84
|
+
[n.medium]: r === "medium"
|
|
85
|
+
}),
|
|
86
|
+
children: /* @__PURE__ */ i(
|
|
87
|
+
k,
|
|
88
|
+
{
|
|
89
|
+
size: 20,
|
|
90
|
+
"aria-hidden": !0
|
|
91
|
+
}
|
|
92
|
+
)
|
|
93
|
+
}
|
|
94
|
+
)
|
|
95
|
+
]
|
|
96
|
+
}
|
|
97
|
+
),
|
|
98
|
+
x && /* @__PURE__ */ i(
|
|
99
|
+
u,
|
|
100
|
+
{
|
|
101
|
+
slot: null,
|
|
102
|
+
excludeFromTabOrder: !0,
|
|
103
|
+
size: r,
|
|
104
|
+
isDisabled: e.isDisabled,
|
|
105
|
+
type: "button",
|
|
106
|
+
onPress: () => d(t.value),
|
|
107
|
+
children: e.buttonText ?? S.format("search")
|
|
108
|
+
}
|
|
109
|
+
)
|
|
110
|
+
] }),
|
|
111
|
+
a === "bottom" && /* @__PURE__ */ i(h, { children: ({ validationErrors: c }) => m ?? c.join(" ") })
|
|
112
|
+
] })
|
|
113
|
+
}
|
|
114
|
+
);
|
|
115
|
+
};
|
|
116
|
+
export {
|
|
117
|
+
z as S
|
|
118
|
+
};
|
package/index.js
CHANGED
|
@@ -29,7 +29,7 @@ import { M as Do } from "./chunks/Dialog-BSWBlyJI.js";
|
|
|
29
29
|
import { P as Ro } from "./chunks/Popover-CjEPHe4A.js";
|
|
30
30
|
import { P as Po } from "./chunks/ProgressBar-CBz_dIOH.js";
|
|
31
31
|
import { R as vo, a as Fo } from "./chunks/Radio-CRHdSthr.js";
|
|
32
|
-
import { S as Ao } from "./chunks/SearchField-
|
|
32
|
+
import { S as Ao } from "./chunks/SearchField-VIMb28RB.js";
|
|
33
33
|
import { S as Ho } from "./chunks/Select-C01v_D--.js";
|
|
34
34
|
import { S as Eo } from "./chunks/Skeleton-tiP1Syzf.js";
|
|
35
35
|
import { S as wo } from "./chunks/Spinner-CfKMn18u.js";
|
|
@@ -49,7 +49,7 @@ import { c as wa } from "./chunks/clsx-AexbMWKp.js";
|
|
|
49
49
|
import { DialogTrigger as Oa, MenuTrigger as Qa, RouterProvider as Va } from "react-aria-components";
|
|
50
50
|
import { u as ja } from "./chunks/useLocalizedStringFormatter-BHvsRxDk.js";
|
|
51
51
|
import { useToastState as Ja } from "react-stately";
|
|
52
|
-
const o = "17.
|
|
52
|
+
const o = "17.9.0", a = {
|
|
53
53
|
version: o
|
|
54
54
|
}, r = a.version;
|
|
55
55
|
export {
|
package/package.json
CHANGED
|
@@ -1,13 +1,31 @@
|
|
|
1
1
|
import { SearchFieldProps as AriaSearchFieldProps } from 'react-aria-components';
|
|
2
2
|
import { Size } from '../common/types';
|
|
3
3
|
import * as React from 'react';
|
|
4
|
-
export interface SearchFieldProps extends AriaSearchFieldProps {
|
|
4
|
+
export interface SearchFieldProps extends Omit<AriaSearchFieldProps, 'children'> {
|
|
5
5
|
/** Placeholder text */
|
|
6
6
|
placeholder: string;
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
8
|
+
* Whether to render a built-in submit button.
|
|
9
|
+
*
|
|
10
|
+
* **Future flag:** pass `showButton={false}` to opt into the v18 default today.
|
|
11
|
+
* In v18 the button will no longer be shown by default β compose your own `Button`
|
|
12
|
+
* outside `SearchField` instead. This prop will be removed in v18.
|
|
13
|
+
*
|
|
14
|
+
* @see https://github.com/migrationsverket/midas/issues/1109
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* // Opt into v18 behavior now:
|
|
18
|
+
* <SearchField placeholder="SΓΆk" onSubmit={handleSubmit} />
|
|
19
|
+
* <Button onPress={() => handleSubmit(value)}>SΓΆk</Button>
|
|
20
|
+
*
|
|
21
|
+
* @default true
|
|
22
|
+
*/
|
|
23
|
+
showButton?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Text displayed on the built-in submit button.
|
|
26
|
+
*
|
|
27
|
+
* @deprecated since v17.9.0 β use your own `Button` instead. See `showButton`.
|
|
28
|
+
* @default 'SΓΆk'
|
|
11
29
|
*/
|
|
12
30
|
buttonText?: string;
|
|
13
31
|
/**
|
|
@@ -9,14 +9,23 @@ declare const _default: {
|
|
|
9
9
|
layout: string;
|
|
10
10
|
};
|
|
11
11
|
args: {
|
|
12
|
-
buttonText: string;
|
|
13
12
|
errorPosition: "top";
|
|
14
13
|
className: string;
|
|
15
14
|
size: "large";
|
|
16
15
|
};
|
|
17
16
|
};
|
|
18
17
|
export default _default;
|
|
18
|
+
/**
|
|
19
|
+
* Default behavior in v17 β the built-in submit button is shown.
|
|
20
|
+
* The button is not in the tab order; use Enter to submit or click the button.
|
|
21
|
+
*/
|
|
19
22
|
export declare const Primary: Story;
|
|
20
23
|
export declare const CustomValidation: Story;
|
|
21
24
|
export declare const Invalid: Story;
|
|
22
25
|
export declare const Disabled: Story;
|
|
26
|
+
/**
|
|
27
|
+
* Future default in v18 β opt in today with `showButton={false}`.
|
|
28
|
+
* Compose your own `Button` outside `SearchField` for explicit submit.
|
|
29
|
+
* Enter still works for keyboard submission.
|
|
30
|
+
*/
|
|
31
|
+
export declare const WithoutButton: Story;
|
package/search-field/index.js
CHANGED
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { jsxs as u, jsx as a } from "react/jsx-runtime";
|
|
3
|
-
import { s as y } from "./TextField.module-BDIbEV87.js";
|
|
4
|
-
import { B as C } from "./Button-GCROAMSl.js";
|
|
5
|
-
import { C as F } from "./ClearButton-DkC8PIMi.js";
|
|
6
|
-
import { c as l } from "./clsx-AexbMWKp.js";
|
|
7
|
-
import * as N from "react";
|
|
8
|
-
import { useSearchFieldState as x } from "react-stately";
|
|
9
|
-
import { useSearchField as j } from "react-aria";
|
|
10
|
-
import { F as f } from "./FieldError-krpMBtie.js";
|
|
11
|
-
import { c as p } from "./createLucideIcon-CP-mMPfa.js";
|
|
12
|
-
import { u as B } from "./useLocalizedStringFormatter-BHvsRxDk.js";
|
|
13
|
-
import '../assets/SearchField.css';const D = [
|
|
14
|
-
["path", { d: "m21 21-4.34-4.34", key: "14j7rj" }],
|
|
15
|
-
["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }]
|
|
16
|
-
], E = p("search", D), k = "_container_19q7q_1", P = "_inner_19q7q_10", T = "_inputContainer_19q7q_15", w = "_medium_19q7q_21", I = "_icon_19q7q_26", K = "_clear_19q7q_39", L = "_input_19q7q_15", n = {
|
|
17
|
-
container: k,
|
|
18
|
-
inner: P,
|
|
19
|
-
inputContainer: T,
|
|
20
|
-
medium: w,
|
|
21
|
-
icon: I,
|
|
22
|
-
clear: K,
|
|
23
|
-
input: L
|
|
24
|
-
}, M = { search: "Search" }, R = { search: "SΓΆk" }, V = {
|
|
25
|
-
en: M,
|
|
26
|
-
sv: R
|
|
27
|
-
};
|
|
28
|
-
function O(r) {
|
|
29
|
-
return !!r?.length;
|
|
30
|
-
}
|
|
31
|
-
const Z = ({
|
|
32
|
-
errorPosition: r = "top",
|
|
33
|
-
size: i = "large",
|
|
34
|
-
...e
|
|
35
|
-
}) => {
|
|
36
|
-
const { value: t, setValue: m } = x(e), b = B(V), d = N.useRef(null), { inputProps: o, isInvalid: c, validationErrors: h, clearButtonProps: q } = j(
|
|
37
|
-
{
|
|
38
|
-
...e,
|
|
39
|
-
label: e.placeholder,
|
|
40
|
-
validationBehavior: "native"
|
|
41
|
-
},
|
|
42
|
-
{ value: t, setValue: m },
|
|
43
|
-
d
|
|
44
|
-
), v = ({ target: s }) => m(s.value), S = () => m(""), _ = () => {
|
|
45
|
-
if (e.validate && O(e.validate(t)) || c || !t) {
|
|
46
|
-
d.current?.focus();
|
|
47
|
-
return;
|
|
48
|
-
}
|
|
49
|
-
e.onSubmit && e.onSubmit(t);
|
|
50
|
-
}, g = ({ key: s }) => {
|
|
51
|
-
s === "Enter" && _();
|
|
52
|
-
};
|
|
53
|
-
return /* @__PURE__ */ u(
|
|
54
|
-
"div",
|
|
55
|
-
{
|
|
56
|
-
className: l(n.container, e.className),
|
|
57
|
-
"data-disabled": o.disabled,
|
|
58
|
-
children: [
|
|
59
|
-
r === "top" && /* @__PURE__ */ a(f, { isInvalid: c, children: e.errorMessage ?? h.join(" ") }),
|
|
60
|
-
/* @__PURE__ */ u("div", { className: n.inner, children: [
|
|
61
|
-
/* @__PURE__ */ u(
|
|
62
|
-
"div",
|
|
63
|
-
{
|
|
64
|
-
className: l(n.inputContainer, {
|
|
65
|
-
[n.medium]: i === "medium"
|
|
66
|
-
}),
|
|
67
|
-
children: [
|
|
68
|
-
/* @__PURE__ */ a(
|
|
69
|
-
E,
|
|
70
|
-
{
|
|
71
|
-
size: 20,
|
|
72
|
-
className: n.icon
|
|
73
|
-
}
|
|
74
|
-
),
|
|
75
|
-
/* @__PURE__ */ a(
|
|
76
|
-
"input",
|
|
77
|
-
{
|
|
78
|
-
...o,
|
|
79
|
-
...o.disabled && { "data-disabled": !0 },
|
|
80
|
-
className: l(
|
|
81
|
-
y.input,
|
|
82
|
-
n.input,
|
|
83
|
-
o.className,
|
|
84
|
-
{ [n.medium]: i === "medium" }
|
|
85
|
-
),
|
|
86
|
-
ref: d,
|
|
87
|
-
onChange: v,
|
|
88
|
-
value: t,
|
|
89
|
-
"aria-invalid": c,
|
|
90
|
-
onKeyDown: g,
|
|
91
|
-
"aria-label": e.placeholder,
|
|
92
|
-
"aria-labelledby": ""
|
|
93
|
-
}
|
|
94
|
-
),
|
|
95
|
-
t.length > 0 && /* @__PURE__ */ a(
|
|
96
|
-
F,
|
|
97
|
-
{
|
|
98
|
-
...q,
|
|
99
|
-
onPress: S,
|
|
100
|
-
size: i,
|
|
101
|
-
className: l(n.clear, {
|
|
102
|
-
[n.medium]: i === "medium"
|
|
103
|
-
})
|
|
104
|
-
}
|
|
105
|
-
)
|
|
106
|
-
]
|
|
107
|
-
}
|
|
108
|
-
),
|
|
109
|
-
/* @__PURE__ */ a(
|
|
110
|
-
C,
|
|
111
|
-
{
|
|
112
|
-
size: i,
|
|
113
|
-
isDisabled: e.isDisabled,
|
|
114
|
-
excludeFromTabOrder: !0,
|
|
115
|
-
onPress: _,
|
|
116
|
-
type: "button",
|
|
117
|
-
children: e.buttonText ? e.buttonText : b.format("search")
|
|
118
|
-
}
|
|
119
|
-
)
|
|
120
|
-
] }),
|
|
121
|
-
r === "bottom" && /* @__PURE__ */ a(f, { isInvalid: c, children: e.errorMessage ?? h.join(" ") })
|
|
122
|
-
]
|
|
123
|
-
}
|
|
124
|
-
);
|
|
125
|
-
};
|
|
126
|
-
export {
|
|
127
|
-
Z as S
|
|
128
|
-
};
|