@digdir/designsystemet-react 1.0.0-next.49 → 1.0.0-next.51

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.
@@ -34,9 +34,8 @@ const Suggestion = react.forwardRef(function Suggestion({ className, filter = tr
34
34
  // Handle custom filter
35
35
  if (filter !== false) {
36
36
  let index = 0;
37
- for (const option of list.children) {
38
- // Skip <datalist> children that are not <option>
39
- if ('value' in option)
37
+ for (const option of list.getElementsByTagName('u-option')) {
38
+ if (!option.hasAttribute('data-empty'))
40
39
  option.disabled = !filter({
41
40
  index: index++, // Increment index for each <option>
42
41
  input,
@@ -2,7 +2,6 @@
2
2
  'use strict';
3
3
 
4
4
  var jsxRuntime = require('react/jsx-runtime');
5
- var reactSlot = require('@radix-ui/react-slot');
6
5
  var react = require('react');
7
6
 
8
7
  /**
@@ -15,9 +14,10 @@ var react = require('react');
15
14
  * <Suggestion.Empty>Tomt</Suggestion.Empty>
16
15
  * </Suggestion.List>
17
16
  */
18
- const SuggestionEmpty = react.forwardRef(function SuggestionEmpty({ asChild, ...rest }, ref) {
19
- const Component = asChild ? reactSlot.Slot : 'div';
20
- return (jsxRuntime.jsx(Component, { "aria-disabled": 'true', ref: ref, role: 'option', tabIndex: 0, ...rest }));
17
+ const SuggestionEmpty = react.forwardRef(function SuggestionEmpty(rest, ref) {
18
+ return (
19
+ // biome-ignore lint/a11y/noInteractiveElementToNoninteractiveRole: Empty option shoult not be interactive
20
+ jsxRuntime.jsx("u-option", { "data-empty": true, role: 'none', ref: ref, ...rest }));
21
21
  });
22
22
 
23
23
  exports.SuggestionEmpty = SuggestionEmpty;
@@ -32,9 +32,8 @@ const Suggestion = forwardRef(function Suggestion({ className, filter = true, as
32
32
  // Handle custom filter
33
33
  if (filter !== false) {
34
34
  let index = 0;
35
- for (const option of list.children) {
36
- // Skip <datalist> children that are not <option>
37
- if ('value' in option)
35
+ for (const option of list.getElementsByTagName('u-option')) {
36
+ if (!option.hasAttribute('data-empty'))
38
37
  option.disabled = !filter({
39
38
  index: index++, // Increment index for each <option>
40
39
  input,
@@ -1,6 +1,5 @@
1
1
  'use client';
2
2
  import { jsx } from 'react/jsx-runtime';
3
- import { Slot } from '@radix-ui/react-slot';
4
3
  import { forwardRef } from 'react';
5
4
 
6
5
  /**
@@ -13,9 +12,10 @@ import { forwardRef } from 'react';
13
12
  * <Suggestion.Empty>Tomt</Suggestion.Empty>
14
13
  * </Suggestion.List>
15
14
  */
16
- const SuggestionEmpty = forwardRef(function SuggestionEmpty({ asChild, ...rest }, ref) {
17
- const Component = asChild ? Slot : 'div';
18
- return (jsx(Component, { "aria-disabled": 'true', ref: ref, role: 'option', tabIndex: 0, ...rest }));
15
+ const SuggestionEmpty = forwardRef(function SuggestionEmpty(rest, ref) {
16
+ return (
17
+ // biome-ignore lint/a11y/noInteractiveElementToNoninteractiveRole: Empty option shoult not be interactive
18
+ jsx("u-option", { "data-empty": true, role: 'none', ref: ref, ...rest }));
19
19
  });
20
20
 
21
21
  export { SuggestionEmpty };
@@ -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,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,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;IAClB;;;OAGG;cACO,OAAO;wCAiEpB,CAAC"}
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,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;IAClB;;;OAGG;cACO,OAAO;wCAgEpB,CAAC"}
@@ -1,13 +1,6 @@
1
- import type { HTMLAttributes } from 'react';
1
+ import type { OptionHTMLAttributes } from 'react';
2
2
  import type { DefaultProps } from '../../types';
3
- import type { MergeRight } from '../../utilities';
4
- export type SuggestionEmptyProps = MergeRight<DefaultProps & HTMLAttributes<HTMLDivElement>, {
5
- /**
6
- * Change the default rendered element for the one passed as a child, merging their props and behavior.
7
- * @default false
8
- */
9
- asChild?: boolean;
10
- }>;
3
+ export type SuggestionEmptyProps = DefaultProps & OptionHTMLAttributes<HTMLOptionElement>;
11
4
  /**
12
5
  * Component that provides an empty suggestion list.
13
6
  *
@@ -18,11 +11,5 @@ export type SuggestionEmptyProps = MergeRight<DefaultProps & HTMLAttributes<HTML
18
11
  * <Suggestion.Empty>Tomt</Suggestion.Empty>
19
12
  * </Suggestion.List>
20
13
  */
21
- export declare const SuggestionEmpty: React.ForwardRefExoticComponent<Omit<DefaultProps & HTMLAttributes<HTMLDivElement>, "asChild"> & {
22
- /**
23
- * Change the default rendered element for the one passed as a child, merging their props and behavior.
24
- * @default false
25
- */
26
- asChild?: boolean;
27
- } & React.RefAttributes<HTMLDivElement>>;
14
+ export declare const SuggestionEmpty: React.ForwardRefExoticComponent<DefaultProps & OptionHTMLAttributes<HTMLOptionElement> & React.RefAttributes<HTMLOptionElement>>;
28
15
  //# sourceMappingURL=SuggestionEmpty.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"SuggestionEmpty.d.ts","sourceRoot":"","sources":["../../../src/components/Suggestion/SuggestionEmpty.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAE5C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAElD,MAAM,MAAM,oBAAoB,GAAG,UAAU,CAC3C,YAAY,GAAG,cAAc,CAAC,cAAc,CAAC,EAC7C;IACE;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CACF,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,eAAe;IAlBxB;;;OAGG;cACO,OAAO;wCA4BpB,CAAC"}
1
+ {"version":3,"file":"SuggestionEmpty.d.ts","sourceRoot":"","sources":["../../../src/components/Suggestion/SuggestionEmpty.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,OAAO,CAAC;AAElD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEhD,MAAM,MAAM,oBAAoB,GAAG,YAAY,GAC7C,oBAAoB,CAAC,iBAAiB,CAAC,CAAC;AAE1C;;;;;;;;;GASG;AACH,eAAO,MAAM,eAAe,kIAQ1B,CAAC"}
@@ -38,9 +38,7 @@ declare const EXPERIMENTAL_Suggestion: React.ForwardRefExoticComponent<Omit<impo
38
38
  readOnly?: boolean;
39
39
  role?: React.AriaRole | undefined;
40
40
  } & React.RefAttributes<HTMLInputElement>>;
41
- Empty: React.ForwardRefExoticComponent<Omit<import("../../types").DefaultProps & React.HTMLAttributes<HTMLDivElement>, "asChild"> & {
42
- asChild?: boolean;
43
- } & React.RefAttributes<HTMLDivElement>>;
41
+ Empty: React.ForwardRefExoticComponent<import("../../types").DefaultProps & React.OptionHTMLAttributes<HTMLOptionElement> & React.RefAttributes<HTMLOptionElement>>;
44
42
  Option: React.ForwardRefExoticComponent<React.OptionHTMLAttributes<HTMLOptionElement> & import("../../types").DefaultProps & React.RefAttributes<HTMLOptionElement>>;
45
43
  Clear: React.ForwardRefExoticComponent<Omit<import("..").ButtonProps, "children" | "variant"> & {
46
44
  'aria-label'?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Suggestion/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,O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CAAC;AACF,YAAY,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACpD,YAAY,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAC5D,YAAY,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAC9D,YAAY,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAC9D,YAAY,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAChE,YAAY,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@digdir/designsystemet-react",
3
3
  "type": "module",
4
- "version": "1.0.0-next.49",
4
+ "version": "1.0.0-next.51",
5
5
  "description": "React components for Designsystemet",
6
6
  "author": "Designsystemet team",
7
7
  "repository": {
@@ -20,7 +20,7 @@
20
20
  "./colors": {
21
21
  "types": "./dist/types/colors.d.ts"
22
22
  },
23
- "./react-types.d.ts": {
23
+ "./react-types": {
24
24
  "types": "./dist/react-types.d.ts"
25
25
  }
26
26
  },
@@ -47,7 +47,7 @@
47
47
  "@navikt/aksel-icons": "^7.0.0",
48
48
  "@radix-ui/react-slot": "^1.1.1",
49
49
  "@tanstack/react-virtual": "^3.11.2",
50
- "@u-elements/u-datalist": "^0.1.2",
50
+ "@u-elements/u-datalist": "^0.1.3",
51
51
  "@u-elements/u-details": "^0.1.0",
52
52
  "clsx": "^2.1.1"
53
53
  },