@digdir/designsystemet-react 1.0.2 → 1.0.3
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/dist/cjs/components/Dropdown/DropdownButton.js +1 -1
- package/dist/cjs/components/Field/fieldObserver.js +0 -4
- package/dist/cjs/components/Suggestion/Suggestion.js +0 -1
- package/dist/esm/components/Dropdown/DropdownButton.js +1 -1
- package/dist/esm/components/Field/fieldObserver.js +0 -4
- package/dist/esm/components/Suggestion/Suggestion.js +0 -1
- package/dist/types/components/Field/fieldObserver.d.ts.map +1 -1
- package/dist/types/components/Suggestion/Suggestion.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -5,7 +5,7 @@ var jsxRuntime = require('react/jsx-runtime');
|
|
|
5
5
|
var react = require('react');
|
|
6
6
|
var Button = require('../Button/Button.js');
|
|
7
7
|
|
|
8
|
-
const DropdownButton = react.forwardRef(function DropdownButton({
|
|
8
|
+
const DropdownButton = react.forwardRef(function DropdownButton({ ...rest }, ref) {
|
|
9
9
|
return jsxRuntime.jsx(Button.Button, { ref: ref, variant: 'tertiary', ...rest });
|
|
10
10
|
});
|
|
11
11
|
|
|
@@ -38,7 +38,6 @@ function fieldObserver(fieldElement) {
|
|
|
38
38
|
if (input === el)
|
|
39
39
|
input = null;
|
|
40
40
|
if (elements.has(el)) {
|
|
41
|
-
setAttr(el, 'aria-disabled', null); // Reset disabled state
|
|
42
41
|
setAttr(el, isLabel(el) ? 'for' : 'id', elements.get(el));
|
|
43
42
|
elements.delete(el);
|
|
44
43
|
}
|
|
@@ -46,12 +45,9 @@ function fieldObserver(fieldElement) {
|
|
|
46
45
|
// Connect elements
|
|
47
46
|
const describedbyIds = [describedby]; // Keep original aria-describedby
|
|
48
47
|
const inputId = input?.id || uuid;
|
|
49
|
-
const isDisabled = input?.hasAttribute('disabled') ||
|
|
50
|
-
input?.getAttribute('aria-disabled') === 'true';
|
|
51
48
|
for (const [el, value] of elements) {
|
|
52
49
|
const descriptionType = el.getAttribute('data-field');
|
|
53
50
|
const id = descriptionType ? `${inputId}:${descriptionType}` : inputId;
|
|
54
|
-
setAttr(el, 'aria-disabled', isDisabled ? 'true' : null); // Forward inputs disabled state to related elements to make axe tests happy
|
|
55
51
|
if (!value)
|
|
56
52
|
setAttr(el, isLabel(el) ? 'for' : 'id', id); // Ensure we have a value
|
|
57
53
|
if (descriptionType === 'validation')
|
|
@@ -31,7 +31,6 @@ const Suggestion = react.forwardRef(function Suggestion({ className, filter = tr
|
|
|
31
31
|
// Let <datalist> handle filtering if filter is true
|
|
32
32
|
if (filter === true || !list)
|
|
33
33
|
return;
|
|
34
|
-
console.log(list);
|
|
35
34
|
// Handle custom filter
|
|
36
35
|
if (filter !== false) {
|
|
37
36
|
let index = 0;
|
|
@@ -3,7 +3,7 @@ import { jsx } from 'react/jsx-runtime';
|
|
|
3
3
|
import { forwardRef } from 'react';
|
|
4
4
|
import { Button } from '../Button/Button.js';
|
|
5
5
|
|
|
6
|
-
const DropdownButton = forwardRef(function DropdownButton({
|
|
6
|
+
const DropdownButton = forwardRef(function DropdownButton({ ...rest }, ref) {
|
|
7
7
|
return jsx(Button, { ref: ref, variant: 'tertiary', ...rest });
|
|
8
8
|
});
|
|
9
9
|
|
|
@@ -36,7 +36,6 @@ function fieldObserver(fieldElement) {
|
|
|
36
36
|
if (input === el)
|
|
37
37
|
input = null;
|
|
38
38
|
if (elements.has(el)) {
|
|
39
|
-
setAttr(el, 'aria-disabled', null); // Reset disabled state
|
|
40
39
|
setAttr(el, isLabel(el) ? 'for' : 'id', elements.get(el));
|
|
41
40
|
elements.delete(el);
|
|
42
41
|
}
|
|
@@ -44,12 +43,9 @@ function fieldObserver(fieldElement) {
|
|
|
44
43
|
// Connect elements
|
|
45
44
|
const describedbyIds = [describedby]; // Keep original aria-describedby
|
|
46
45
|
const inputId = input?.id || uuid;
|
|
47
|
-
const isDisabled = input?.hasAttribute('disabled') ||
|
|
48
|
-
input?.getAttribute('aria-disabled') === 'true';
|
|
49
46
|
for (const [el, value] of elements) {
|
|
50
47
|
const descriptionType = el.getAttribute('data-field');
|
|
51
48
|
const id = descriptionType ? `${inputId}:${descriptionType}` : inputId;
|
|
52
|
-
setAttr(el, 'aria-disabled', isDisabled ? 'true' : null); // Forward inputs disabled state to related elements to make axe tests happy
|
|
53
49
|
if (!value)
|
|
54
50
|
setAttr(el, isLabel(el) ? 'for' : 'id', id); // Ensure we have a value
|
|
55
51
|
if (descriptionType === 'validation')
|
|
@@ -29,7 +29,6 @@ const Suggestion = forwardRef(function Suggestion({ className, filter = true, as
|
|
|
29
29
|
// Let <datalist> handle filtering if filter is true
|
|
30
30
|
if (filter === true || !list)
|
|
31
31
|
return;
|
|
32
|
-
console.log(list);
|
|
33
32
|
// Handle custom filter
|
|
34
33
|
if (filter !== false) {
|
|
35
34
|
let index = 0;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fieldObserver.d.ts","sourceRoot":"","sources":["../../../src/components/Field/fieldObserver.ts"],"names":[],"mappings":"AAAA,wBAAgB,aAAa,CAAC,YAAY,EAAE,WAAW,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"fieldObserver.d.ts","sourceRoot":"","sources":["../../../src/components/Field/fieldObserver.ts"],"names":[],"mappings":"AAAA,wBAAgB,aAAa,CAAC,YAAY,EAAE,WAAW,GAAG,IAAI,4BAuE7D;AAGD,eAAO,MAAM,SAAS,GAAI,MAAM,IAAI,oBAA4B,CAAC;AACjE,eAAO,MAAM,OAAO,GAAI,MAAM,IAAI,6BAAqC,CAAC;AACxE,eAAO,MAAM,WAAW,GAAI,MAAM,OAAO,KAAG,IAAI,IAAI,gBAGd,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Suggestion.d.ts","sourceRoot":"","sources":["../../../src/components/Suggestion/Suggestion.tsx"],"names":[],"mappings":"AAGA,OAAO,EACL,KAAK,cAAc,EAOpB,MAAM,OAAO,CAAC;AACf,OAAO,K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AgB,CAAC;KACzB,KAAK,OAAO,CAAC;IAClB;;;OAGG;cACO,OAAO;
|
|
1
|
+
{"version":3,"file":"Suggestion.d.ts","sourceRoot":"","sources":["../../../src/components/Suggestion/Suggestion.tsx"],"names":[],"mappings":"AAGA,OAAO,EACL,KAAK,cAAc,EAOpB,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAElD,KAAK,qBAAqB,GAAG;IAC3B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,gBAAgB,GAAG,IAAI,CAAC,CAAC;IACpD,SAAS,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IACjC,YAAY,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,gBAAgB,GAAG,IAAI,KAAK,IAAI,CAAC;CAC1D,CAAC;AAEF,eAAO,MAAM,iBAAiB,sCAA2C,CAAC;AAE1E,MAAM,MAAM,eAAe,GAAG,UAAU,CACtC,YAAY,GAAG,cAAc,CAAC,cAAc,CAAC,EAC7C;IACE;;;;;;;;OAQG;IACH,MAAM,CAAC,EACH,OAAO,GACP,CAAC,CAAC,IAAI,EAAE;QACN;;WAEG;QACH,KAAK,EAAE,MAAM,CAAC;QACd;;WAEG;QACH,IAAI,EAAE,MAAM,CAAC;QACb;;WAEG;QACH,KAAK,EAAE,MAAM,CAAC;QACd;;WAEG;QACH,aAAa,EAAE,iBAAiB,CAAC;QACjC;;WAEG;QACH,KAAK,EAAE,gBAAgB,CAAC;KACzB,KAAK,OAAO,CAAC,CAAC;IACnB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CACF,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,UAAU;IAvDnB;;;;;;;;OAQG;aAEC,OAAO,GACP,C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