@navikt/ds-react 7.35.0 → 7.35.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/cjs/form/select/Select.d.ts +0 -4
- package/cjs/form/select/Select.js +2 -2
- package/cjs/form/select/Select.js.map +1 -1
- package/esm/form/select/Select.d.ts +0 -4
- package/esm/form/select/Select.js +2 -2
- package/esm/form/select/Select.js.map +1 -1
- package/package.json +3 -3
- package/src/form/combobox/__tests__/combobox.test.tsx +1 -2
- package/src/form/select/Select.tsx +0 -6
- package/src/tooltip/Tooltip.test.tsx +4 -8
|
@@ -5,10 +5,6 @@ export interface SelectProps extends FormFieldProps, Omit<SelectHTMLAttributes<H
|
|
|
5
5
|
* Collection of <option />-elements.
|
|
6
6
|
*/
|
|
7
7
|
children: React.ReactNode;
|
|
8
|
-
/**
|
|
9
|
-
* Exposes the HTML size attribute.
|
|
10
|
-
*/
|
|
11
|
-
htmlSize?: number;
|
|
12
8
|
/**
|
|
13
9
|
* Sets inline-style on select wrapper.
|
|
14
10
|
*/
|
|
@@ -70,7 +70,7 @@ const useFormField_1 = require("../useFormField");
|
|
|
70
70
|
*/
|
|
71
71
|
exports.Select = (0, react_1.forwardRef)((props, ref) => {
|
|
72
72
|
const { inputProps, errorId, showErrorMsg, hasError, size, inputDescriptionId, readOnly, } = (0, useFormField_1.useFormField)(props, "select");
|
|
73
|
-
const { children, label, className, description,
|
|
73
|
+
const { children, label, className, description, hideLabel = false, style } = props, rest = __rest(props, ["children", "label", "className", "description", "hideLabel", "style"]);
|
|
74
74
|
const { cn } = (0, Theme_1.useRenameCSS)();
|
|
75
75
|
const readOnlyEventHandlers = {
|
|
76
76
|
onMouseDown: (evt) => {
|
|
@@ -103,7 +103,7 @@ exports.Select = (0, react_1.forwardRef)((props, ref) => {
|
|
|
103
103
|
"navds-sr-only": hideLabel,
|
|
104
104
|
}), id: inputDescriptionId, size: size, as: "div" }, description)),
|
|
105
105
|
react_1.default.createElement("div", { className: cn("navds-select__container"), style: style },
|
|
106
|
-
react_1.default.createElement("select", Object.assign({}, (0, util_1.omit)(rest, ["error", "errorId", "size", "readOnly"]), inputProps, readOnlyEventHandlers, { ref: ref, className: cn("navds-select__input", "navds-body-short", `navds-body-short--${size !== null && size !== void 0 ? size : "medium"}`)
|
|
106
|
+
react_1.default.createElement("select", Object.assign({}, (0, util_1.omit)(rest, ["error", "errorId", "size", "readOnly"]), inputProps, readOnlyEventHandlers, { ref: ref, className: cn("navds-select__input", "navds-body-short", `navds-body-short--${size !== null && size !== void 0 ? size : "medium"}`) }), children),
|
|
107
107
|
react_1.default.createElement(aksel_icons_1.ChevronDownIcon, { className: cn("navds-select__chevron"), "aria-hidden": true })),
|
|
108
108
|
react_1.default.createElement("div", { className: cn("navds-form-field__error"), id: errorId, "aria-relevant": "additions removals", "aria-live": "polite" }, showErrorMsg && (react_1.default.createElement(typography_1.ErrorMessage, { size: size, showIcon: true }, props.error)))));
|
|
109
109
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Select.js","sourceRoot":"","sources":["../../../src/form/select/Select.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAgE;AAChE,qDAAsD;AACtD,6CAAiD;AACjD,iDAAkE;AAClE,qCAAkC;AAClC,kDAAwD;AACxD,kDAA+D;
|
|
1
|
+
{"version":3,"file":"Select.js","sourceRoot":"","sources":["../../../src/form/select/Select.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAgE;AAChE,qDAAsD;AACtD,6CAAiD;AACjD,iDAAkE;AAClE,qCAAkC;AAClC,kDAAwD;AACxD,kDAA+D;AAuB/D;;;;;;;;;;;;;;;GAeG;AACU,QAAA,MAAM,GAAG,IAAA,kBAAU,EAC9B,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;IACb,MAAM,EACJ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,EAAE,SAAS;aAC3B,CAAC;YAED,QAAQ,IAAI,8BAAC,oCAAqB,OAAG;YACrC,KAAK,CACA;QACP,CAAC,CAAC,WAAW,IAAI,CAChB,8BAAC,sBAAS,IACR,SAAS,EAAE,EAAE,CAAC,+BAA+B,EAAE;gBAC7C,eAAe,EAAE,SAAS;aAC3B,CAAC,EACF,EAAE,EAAE,kBAAkB,EACtB,IAAI,EAAE,IAAI,EACV,EAAE,EAAC,KAAK,IAEP,WAAW,CACF,CACb;QACD,uCAAK,SAAS,EAAE,EAAE,CAAC,yBAAyB,CAAC,EAAE,KAAK,EAAE,KAAK;YACzD,0DACM,IAAA,WAAI,EAAC,IAAI,EAAE,CAAC,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,UAAU,CAAC,CAAC,EACpD,UAAU,EACV,qBAAqB,IACzB,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,EAAE,CACX,qBAAqB,EACrB,kBAAkB,EAClB,qBAAqB,IAAI,aAAJ,IAAI,cAAJ,IAAI,GAAI,QAAQ,EAAE,CACxC,KAEA,QAAQ,CACF;YACT,8BAAC,6BAAe,IACd,SAAS,EAAE,EAAE,CAAC,uBAAuB,CAAC,wBAEtC,CACE;QACN,uCACE,SAAS,EAAE,EAAE,CAAC,yBAAyB,CAAC,EACxC,EAAE,EAAE,OAAO,mBACG,oBAAoB,eACxB,QAAQ,IAEjB,YAAY,IAAI,CACf,8BAAC,yBAAY,IAAC,IAAI,EAAE,IAAI,EAAE,QAAQ,UAC/B,KAAK,CAAC,KAAK,CACC,CAChB,CACG,CACF,CACP,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,kBAAe,cAAM,CAAC"}
|
|
@@ -5,10 +5,6 @@ export interface SelectProps extends FormFieldProps, Omit<SelectHTMLAttributes<H
|
|
|
5
5
|
* Collection of <option />-elements.
|
|
6
6
|
*/
|
|
7
7
|
children: React.ReactNode;
|
|
8
|
-
/**
|
|
9
|
-
* Exposes the HTML size attribute.
|
|
10
|
-
*/
|
|
11
|
-
htmlSize?: number;
|
|
12
8
|
/**
|
|
13
9
|
* Sets inline-style on select wrapper.
|
|
14
10
|
*/
|
|
@@ -34,7 +34,7 @@ import { useFormField } from "../useFormField.js";
|
|
|
34
34
|
*/
|
|
35
35
|
export const Select = forwardRef((props, ref) => {
|
|
36
36
|
const { inputProps, errorId, showErrorMsg, hasError, size, inputDescriptionId, readOnly, } = useFormField(props, "select");
|
|
37
|
-
const { children, label, className, description,
|
|
37
|
+
const { children, label, className, description, hideLabel = false, style } = props, rest = __rest(props, ["children", "label", "className", "description", "hideLabel", "style"]);
|
|
38
38
|
const { cn } = useRenameCSS();
|
|
39
39
|
const readOnlyEventHandlers = {
|
|
40
40
|
onMouseDown: (evt) => {
|
|
@@ -67,7 +67,7 @@ export const Select = forwardRef((props, ref) => {
|
|
|
67
67
|
"navds-sr-only": hideLabel,
|
|
68
68
|
}), id: inputDescriptionId, size: size, as: "div" }, description)),
|
|
69
69
|
React.createElement("div", { className: cn("navds-select__container"), style: style },
|
|
70
|
-
React.createElement("select", Object.assign({}, omit(rest, ["error", "errorId", "size", "readOnly"]), inputProps, readOnlyEventHandlers, { ref: ref, className: cn("navds-select__input", "navds-body-short", `navds-body-short--${size !== null && size !== void 0 ? size : "medium"}`)
|
|
70
|
+
React.createElement("select", Object.assign({}, omit(rest, ["error", "errorId", "size", "readOnly"]), inputProps, readOnlyEventHandlers, { ref: ref, className: cn("navds-select__input", "navds-body-short", `navds-body-short--${size !== null && size !== void 0 ? size : "medium"}`) }), children),
|
|
71
71
|
React.createElement(ChevronDownIcon, { className: cn("navds-select__chevron"), "aria-hidden": true })),
|
|
72
72
|
React.createElement("div", { className: cn("navds-form-field__error"), id: errorId, "aria-relevant": "additions removals", "aria-live": "polite" }, showErrorMsg && (React.createElement(ErrorMessage, { size: size, showIcon: true }, props.error)))));
|
|
73
73
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Select.js","sourceRoot":"","sources":["../../../src/form/select/Select.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,EAAE,EAAwB,UAAU,EAAE,MAAM,OAAO,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAClE,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAClC,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,EAAkB,YAAY,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"Select.js","sourceRoot":"","sources":["../../../src/form/select/Select.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,EAAE,EAAwB,UAAU,EAAE,MAAM,OAAO,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAClE,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAClC,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,EAAkB,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAuB/D;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,UAAU,CAC9B,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;IACb,MAAM,EACJ,UAAU,EACV,OAAO,EACP,YAAY,EACZ,QAAQ,EACR,IAAI,EACJ,kBAAkB,EAClB,QAAQ,GACT,GAAG,YAAY,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;IAElC,MAAM,EACJ,QAAQ,EACR,KAAK,EACL,SAAS,EACT,WAAW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,CAAC,EACF,EAAE,EAAE,kBAAkB,EACtB,IAAI,EAAE,IAAI,EACV,EAAE,EAAC,KAAK,IAEP,WAAW,CACF,CACb;QACD,6BAAK,SAAS,EAAE,EAAE,CAAC,yBAAyB,CAAC,EAAE,KAAK,EAAE,KAAK;YACzD,gDACM,IAAI,CAAC,IAAI,EAAE,CAAC,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,UAAU,CAAC,CAAC,EACpD,UAAU,EACV,qBAAqB,IACzB,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,EAAE,CACX,qBAAqB,EACrB,kBAAkB,EAClB,qBAAqB,IAAI,aAAJ,IAAI,cAAJ,IAAI,GAAI,QAAQ,EAAE,CACxC,KAEA,QAAQ,CACF;YACT,oBAAC,eAAe,IACd,SAAS,EAAE,EAAE,CAAC,uBAAuB,CAAC,wBAEtC,CACE;QACN,6BACE,SAAS,EAAE,EAAE,CAAC,yBAAyB,CAAC,EACxC,EAAE,EAAE,OAAO,mBACG,oBAAoB,eACxB,QAAQ,IAEjB,YAAY,IAAI,CACf,oBAAC,YAAY,IAAC,IAAI,EAAE,IAAI,EAAE,QAAQ,UAC/B,KAAK,CAAC,KAAK,CACC,CAChB,CACG,CACF,CACP,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@navikt/ds-react",
|
|
3
|
-
"version": "7.35.
|
|
3
|
+
"version": "7.35.1",
|
|
4
4
|
"description": "React components from the Norwegian Labour and Welfare Administration.",
|
|
5
5
|
"author": "Aksel, a team part of the Norwegian Labour and Welfare Administration.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -695,8 +695,8 @@
|
|
|
695
695
|
"dependencies": {
|
|
696
696
|
"@floating-ui/react": "0.27.8",
|
|
697
697
|
"@floating-ui/react-dom": "^2.1.6",
|
|
698
|
-
"@navikt/aksel-icons": "^7.35.
|
|
699
|
-
"@navikt/ds-tokens": "^7.35.
|
|
698
|
+
"@navikt/aksel-icons": "^7.35.1",
|
|
699
|
+
"@navikt/ds-tokens": "^7.35.1",
|
|
700
700
|
"clsx": "^2.1.0",
|
|
701
701
|
"date-fns": "^4.0.0",
|
|
702
702
|
"react-day-picker": "9.7.0"
|
|
@@ -177,8 +177,7 @@ describe("Render combobox", () => {
|
|
|
177
177
|
expect(onChange).toHaveBeenNthCalledWith(4, "Syke");
|
|
178
178
|
expect(onChange).toHaveBeenNthCalledWith(5, "Sykepenger [SYK]");
|
|
179
179
|
expect(onChange).toHaveBeenCalledWith("");
|
|
180
|
-
expect(onToggleSelected).
|
|
181
|
-
expect(onToggleSelected).toHaveBeenCalledWith(
|
|
180
|
+
expect(onToggleSelected).toHaveBeenCalledExactlyOnceWith(
|
|
182
181
|
"Sykepenger [SYK]",
|
|
183
182
|
true,
|
|
184
183
|
false,
|
|
@@ -13,10 +13,6 @@ export interface SelectProps
|
|
|
13
13
|
* Collection of <option />-elements.
|
|
14
14
|
*/
|
|
15
15
|
children: React.ReactNode;
|
|
16
|
-
/**
|
|
17
|
-
* Exposes the HTML size attribute.
|
|
18
|
-
*/
|
|
19
|
-
htmlSize?: number;
|
|
20
16
|
/**
|
|
21
17
|
* Sets inline-style on select wrapper.
|
|
22
18
|
*/
|
|
@@ -64,7 +60,6 @@ export const Select = forwardRef<HTMLSelectElement, SelectProps>(
|
|
|
64
60
|
label,
|
|
65
61
|
className,
|
|
66
62
|
description,
|
|
67
|
-
htmlSize,
|
|
68
63
|
hideLabel = false,
|
|
69
64
|
style,
|
|
70
65
|
...rest
|
|
@@ -140,7 +135,6 @@ export const Select = forwardRef<HTMLSelectElement, SelectProps>(
|
|
|
140
135
|
"navds-body-short",
|
|
141
136
|
`navds-body-short--${size ?? "medium"}`,
|
|
142
137
|
)}
|
|
143
|
-
size={htmlSize}
|
|
144
138
|
>
|
|
145
139
|
{children}
|
|
146
140
|
</select>
|
|
@@ -76,14 +76,10 @@ describe("Tooltip", () => {
|
|
|
76
76
|
</Tooltip>,
|
|
77
77
|
);
|
|
78
78
|
|
|
79
|
-
await
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
await new Promise((r) => setTimeout(r, 600));
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
expect(screen.getByRole("tooltip")).toBeVisible();
|
|
79
|
+
await user.hover(screen.getByRole("button"));
|
|
80
|
+
await new Promise((r) => setTimeout(r, 250));
|
|
81
|
+
expect(screen.queryByRole("tooltip")).toBeNull();
|
|
82
|
+
expect(await screen.findByRole("tooltip")).toBeVisible();
|
|
87
83
|
});
|
|
88
84
|
|
|
89
85
|
test("outsideClick", async () => {
|