@navikt/ds-react 5.11.0 → 5.11.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/Switch.js +3 -3
- package/esm/form/Switch.js +3 -3
- package/esm/form/Switch.js.map +1 -1
- package/package.json +3 -3
- package/src/form/Switch.tsx +7 -3
package/cjs/form/Switch.js
CHANGED
|
@@ -40,11 +40,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
40
40
|
exports.Switch = void 0;
|
|
41
41
|
const clsx_1 = __importDefault(require("clsx"));
|
|
42
42
|
const react_1 = __importStar(require("react"));
|
|
43
|
-
const useFormField_1 = require("./useFormField");
|
|
44
|
-
const ReadOnlyIcon_1 = require("./ReadOnlyIcon");
|
|
45
43
|
const loader_1 = require("../loader");
|
|
46
44
|
const typography_1 = require("../typography");
|
|
47
45
|
const util_1 = require("../util");
|
|
46
|
+
const ReadOnlyIcon_1 = require("./ReadOnlyIcon");
|
|
47
|
+
const useFormField_1 = require("./useFormField");
|
|
48
48
|
const SelectedIcon = () => (react_1.default.createElement("svg", { width: "12", height: "10", viewBox: "0 0 12 10", fill: "none", xmlns: "http://www.w3.org/2000/svg", focusable: false, role: "img", "aria-hidden": true, "aria-label": "Deaktiver valg" },
|
|
49
49
|
react_1.default.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M11.2674 0.647802C11.8762 1.20971 11.9141 2.1587 11.3522 2.76743L5.35221 9.26743C5.07531 9.56739 4.68813 9.74155 4.27998 9.74971C3.87184 9.75787 3.478 9.59933 3.18934 9.31067L0.68934 6.81067C0.103553 6.22488 0.103553 5.27513 0.68934 4.68935C1.27513 4.10356 2.22487 4.10356 2.81066 4.68935L4.20673 6.08541L9.14779 0.732587C9.7097 0.123856 10.6587 0.0858967 11.2674 0.647802Z", fill: "currentColor" })));
|
|
50
50
|
/**
|
|
@@ -86,7 +86,7 @@ exports.Switch = (0, react_1.forwardRef)((props, ref) => {
|
|
|
86
86
|
(_a = props === null || props === void 0 ? void 0 : props.onClick) === null || _a === void 0 ? void 0 : _a.call(props, e);
|
|
87
87
|
}, className: (0, clsx_1.default)(className, "navds-switch__input") })),
|
|
88
88
|
react_1.default.createElement("span", { className: "navds-switch__track" },
|
|
89
|
-
react_1.default.createElement("span", { className: "navds-switch__thumb" }, loading ? (react_1.default.createElement(loader_1.Loader, { size: "xsmall", "aria-live": "polite" })) : checked ? (react_1.default.createElement(SelectedIcon, null)) : null)),
|
|
89
|
+
react_1.default.createElement("span", { className: "navds-switch__thumb" }, loading ? (react_1.default.createElement(loader_1.Loader, { size: "xsmall", "aria-live": "polite", variant: checked ? "interaction" : "neutral" })) : checked ? (react_1.default.createElement(SelectedIcon, null)) : null)),
|
|
90
90
|
react_1.default.createElement("label", { htmlFor: inputProps.id, className: "navds-switch__label-wrapper" },
|
|
91
91
|
react_1.default.createElement("div", { className: (0, clsx_1.default)("navds-switch__content", {
|
|
92
92
|
"navds-sr-only": hideLabel,
|
package/esm/form/Switch.js
CHANGED
|
@@ -11,11 +11,11 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
11
11
|
};
|
|
12
12
|
import cl from "clsx";
|
|
13
13
|
import React, { forwardRef, useEffect, useState, } from "react";
|
|
14
|
-
import { useFormField } from "./useFormField";
|
|
15
|
-
import { ReadOnlyIcon } from "./ReadOnlyIcon";
|
|
16
14
|
import { Loader } from "../loader";
|
|
17
15
|
import { BodyShort } from "../typography";
|
|
18
16
|
import { omit } from "../util";
|
|
17
|
+
import { ReadOnlyIcon } from "./ReadOnlyIcon";
|
|
18
|
+
import { useFormField } from "./useFormField";
|
|
19
19
|
const SelectedIcon = () => (React.createElement("svg", { width: "12", height: "10", viewBox: "0 0 12 10", fill: "none", xmlns: "http://www.w3.org/2000/svg", focusable: false, role: "img", "aria-hidden": true, "aria-label": "Deaktiver valg" },
|
|
20
20
|
React.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M11.2674 0.647802C11.8762 1.20971 11.9141 2.1587 11.3522 2.76743L5.35221 9.26743C5.07531 9.56739 4.68813 9.74155 4.27998 9.74971C3.87184 9.75787 3.478 9.59933 3.18934 9.31067L0.68934 6.81067C0.103553 6.22488 0.103553 5.27513 0.68934 4.68935C1.27513 4.10356 2.22487 4.10356 2.81066 4.68935L4.20673 6.08541L9.14779 0.732587C9.7097 0.123856 10.6587 0.0858967 11.2674 0.647802Z", fill: "currentColor" })));
|
|
21
21
|
/**
|
|
@@ -57,7 +57,7 @@ export const Switch = forwardRef((props, ref) => {
|
|
|
57
57
|
(_a = props === null || props === void 0 ? void 0 : props.onClick) === null || _a === void 0 ? void 0 : _a.call(props, e);
|
|
58
58
|
}, className: cl(className, "navds-switch__input") })),
|
|
59
59
|
React.createElement("span", { className: "navds-switch__track" },
|
|
60
|
-
React.createElement("span", { className: "navds-switch__thumb" }, loading ? (React.createElement(Loader, { size: "xsmall", "aria-live": "polite" })) : checked ? (React.createElement(SelectedIcon, null)) : null)),
|
|
60
|
+
React.createElement("span", { className: "navds-switch__thumb" }, loading ? (React.createElement(Loader, { size: "xsmall", "aria-live": "polite", variant: checked ? "interaction" : "neutral" })) : checked ? (React.createElement(SelectedIcon, null)) : null)),
|
|
61
61
|
React.createElement("label", { htmlFor: inputProps.id, className: "navds-switch__label-wrapper" },
|
|
62
62
|
React.createElement("div", { className: cl("navds-switch__content", {
|
|
63
63
|
"navds-sr-only": hideLabel,
|
package/esm/form/Switch.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Switch.js","sourceRoot":"","sources":["../../src/form/Switch.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,EAAE,MAAM,MAAM,CAAC;AACtB,OAAO,KAAK,EAAE,EACZ,UAAU,EAEV,SAAS,EACT,QAAQ,GACT,MAAM,OAAO,CAAC;AACf,OAAO,
|
|
1
|
+
{"version":3,"file":"Switch.js","sourceRoot":"","sources":["../../src/form/Switch.tsx"],"names":[],"mappings":";;;;;;;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AE,qBAAqB,CAAC,IAC/C;QACF,8BAAM,SAAS,EAAC,qBAAqB;YACnC,8BAAM,SAAS,EAAC,qBAAqB,IAClC,OAAO,CAAC,CAAC,CAAC,CACT,oBAAC,MAAM,IACL,IAAI,EAAC,QAAQ,eACH,QAAQ,EAClB,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,SAAS,GAC5C,CACH,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CACZ,oBAAC,YAAY,OAAG,CACjB,CAAC,CAAC,CAAC,IAAI,CACH,CACF;QACP,+BAAO,OAAO,EAAE,UAAU,CAAC,EAAE,EAAE,SAAS,EAAC,6BAA6B;YACpE,6BACE,SAAS,EAAE,EAAE,CAAC,uBAAuB,EAAE;oBACrC,eAAe,EAAE,SAAS;oBAC1B,gCAAgC,EAAE,CAAC,CAAC,WAAW,IAAI,CAAC,SAAS;iBAC9D,CAAC;gBAEF,oBAAC,SAAS,IAAC,EAAE,EAAC,KAAK,EAAC,IAAI,EAAE,IAAI,EAAE,SAAS,EAAC,qBAAqB;oBAC7D,oBAAC,YAAY,IAAC,QAAQ,EAAE,QAAQ,EAAE,cAAc,EAAE,KAAK,GAAI;oBAC1D,QAAQ,CACC;gBACX,WAAW,IAAI,CACd,oBAAC,SAAS,IACR,IAAI,EAAE,IAAI,EACV,EAAE,EAAC,KAAK,EACR,SAAS,EAAC,4DAA4D,IAErE,WAAW,CACF,CACb,CACG,CACA,CACJ,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": "5.11.
|
|
3
|
+
"version": "5.11.1",
|
|
4
4
|
"description": "Aksel react-components for NAV designsystem",
|
|
5
5
|
"author": "Aksel | NAV designsystem team",
|
|
6
6
|
"license": "MIT",
|
|
@@ -38,8 +38,8 @@
|
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"@floating-ui/react": "0.25.4",
|
|
41
|
-
"@navikt/aksel-icons": "^5.11.
|
|
42
|
-
"@navikt/ds-tokens": "^5.11.
|
|
41
|
+
"@navikt/aksel-icons": "^5.11.1",
|
|
42
|
+
"@navikt/ds-tokens": "^5.11.1",
|
|
43
43
|
"@radix-ui/react-tabs": "1.0.0",
|
|
44
44
|
"@radix-ui/react-toggle-group": "1.0.0",
|
|
45
45
|
"clsx": "^1.2.1",
|
package/src/form/Switch.tsx
CHANGED
|
@@ -5,11 +5,11 @@ import React, {
|
|
|
5
5
|
useEffect,
|
|
6
6
|
useState,
|
|
7
7
|
} from "react";
|
|
8
|
-
import { FormFieldProps, useFormField } from "./useFormField";
|
|
9
|
-
import { ReadOnlyIcon } from "./ReadOnlyIcon";
|
|
10
8
|
import { Loader } from "../loader";
|
|
11
9
|
import { BodyShort } from "../typography";
|
|
12
10
|
import { omit } from "../util";
|
|
11
|
+
import { ReadOnlyIcon } from "./ReadOnlyIcon";
|
|
12
|
+
import { FormFieldProps, useFormField } from "./useFormField";
|
|
13
13
|
|
|
14
14
|
const SelectedIcon = () => (
|
|
15
15
|
<svg
|
|
@@ -134,7 +134,11 @@ export const Switch = forwardRef<HTMLInputElement, SwitchProps>(
|
|
|
134
134
|
<span className="navds-switch__track">
|
|
135
135
|
<span className="navds-switch__thumb">
|
|
136
136
|
{loading ? (
|
|
137
|
-
<Loader
|
|
137
|
+
<Loader
|
|
138
|
+
size="xsmall"
|
|
139
|
+
aria-live="polite"
|
|
140
|
+
variant={checked ? "interaction" : "neutral"}
|
|
141
|
+
/>
|
|
138
142
|
) : checked ? (
|
|
139
143
|
<SelectedIcon />
|
|
140
144
|
) : null}
|