@digdir/designsystemet-react 0.0.0-test-20250715110951 → 0.0.0-test-20250715115803

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.
@@ -28,10 +28,66 @@ const EXPERIMENTAL_Suggestion = Object.assign(suggestion.Suggestion, {
28
28
  * @deprecated Suggestion.Chips is deprecated, use `renderSelected` on `Suggestion` instead
29
29
  */
30
30
  Chips: suggestionChips.SuggestionChips,
31
+ /**
32
+ * Component that provides a Suggestion list.
33
+ *
34
+ * Place as a descendant of `Suggestion`
35
+ *
36
+ * @example
37
+ * <Suggestion>
38
+ * <Suggestion.Input />
39
+ * <Suggestion.List />
40
+ * </Suggestion>
41
+ */
31
42
  List: suggestionList.SuggestionList,
43
+ /**
44
+ * Component that provides an input field for the Suggestion list.
45
+ *
46
+ * Place as a descendant of `Suggestion`
47
+ *
48
+ * @example
49
+ * <Suggestion>
50
+ * <Suggestion.Input />
51
+ * <Suggestion.List />
52
+ * </Suggestion>
53
+ */
32
54
  Input: suggestionInput.SuggestionInput,
55
+ /**
56
+ * Component that provides an empty Suggestion list.
57
+ *
58
+ * Place as a descendant of `Suggestion.List`
59
+ *
60
+ * @example
61
+ * <Suggestion.List>
62
+ * <Suggestion.Empty>Tomt</Suggestion.Empty>
63
+ * </Suggestion.List>
64
+ */
33
65
  Empty: suggestionEmpty.SuggestionEmpty,
66
+ /**
67
+ * A component for rendering individual options in the Suggestion list.
68
+ *
69
+ * @example
70
+ * <Suggestion>
71
+ * <Suggestion.Input />
72
+ * <Suggestion.List>
73
+ * <Suggestion.Option value='Option 1'>Option 1</Suggestion.Option>
74
+ * <Suggestion.Option value='Option 2'>Option 2</Suggestion.Option>
75
+ * </Suggestion.List>
76
+ * </Suggestion>
77
+ */
34
78
  Option: suggestionOption.SuggestionOption,
79
+ /**
80
+ * Component that provides a clear button for the Suggestion input.
81
+ *
82
+ * Place as a descendant of `Suggestion`
83
+ *
84
+ * @example
85
+ * <Suggestion>
86
+ * <Suggestion.Input />
87
+ * <Suggestion.Clear />
88
+ * <Suggestion.List />
89
+ * </Suggestion>
90
+ */
35
91
  Clear: suggestionClear.SuggestionClear,
36
92
  });
37
93
  EXPERIMENTAL_Suggestion.displayName = 'EXPERIMENTAL_Suggestion';
@@ -4,6 +4,18 @@
4
4
  var jsxRuntime = require('react/jsx-runtime');
5
5
  var react = require('react');
6
6
 
7
+ /**
8
+ * A component for rendering individual options in the Suggestion list.
9
+ *
10
+ * @example
11
+ * <Suggestion>
12
+ * <Suggestion.Input />
13
+ * <Suggestion.List>
14
+ * <Suggestion.Option value='Option 1'>Option 1</Suggestion.Option>
15
+ * <Suggestion.Option value='Option 2'>Option 2</Suggestion.Option>
16
+ * </Suggestion.List>
17
+ * </Suggestion>
18
+ */
7
19
  const SuggestionOption = react.forwardRef(function SuggestionOption({ className, ...rest }, ref) {
8
20
  return (jsxRuntime.jsx("u-option", { class: className, ref: ref, ...rest }));
9
21
  });
@@ -26,10 +26,66 @@ const EXPERIMENTAL_Suggestion = Object.assign(Suggestion, {
26
26
  * @deprecated Suggestion.Chips is deprecated, use `renderSelected` on `Suggestion` instead
27
27
  */
28
28
  Chips: SuggestionChips,
29
+ /**
30
+ * Component that provides a Suggestion list.
31
+ *
32
+ * Place as a descendant of `Suggestion`
33
+ *
34
+ * @example
35
+ * <Suggestion>
36
+ * <Suggestion.Input />
37
+ * <Suggestion.List />
38
+ * </Suggestion>
39
+ */
29
40
  List: SuggestionList,
41
+ /**
42
+ * Component that provides an input field for the Suggestion list.
43
+ *
44
+ * Place as a descendant of `Suggestion`
45
+ *
46
+ * @example
47
+ * <Suggestion>
48
+ * <Suggestion.Input />
49
+ * <Suggestion.List />
50
+ * </Suggestion>
51
+ */
30
52
  Input: SuggestionInput,
53
+ /**
54
+ * Component that provides an empty Suggestion list.
55
+ *
56
+ * Place as a descendant of `Suggestion.List`
57
+ *
58
+ * @example
59
+ * <Suggestion.List>
60
+ * <Suggestion.Empty>Tomt</Suggestion.Empty>
61
+ * </Suggestion.List>
62
+ */
31
63
  Empty: SuggestionEmpty,
64
+ /**
65
+ * A component for rendering individual options in the Suggestion list.
66
+ *
67
+ * @example
68
+ * <Suggestion>
69
+ * <Suggestion.Input />
70
+ * <Suggestion.List>
71
+ * <Suggestion.Option value='Option 1'>Option 1</Suggestion.Option>
72
+ * <Suggestion.Option value='Option 2'>Option 2</Suggestion.Option>
73
+ * </Suggestion.List>
74
+ * </Suggestion>
75
+ */
32
76
  Option: SuggestionOption,
77
+ /**
78
+ * Component that provides a clear button for the Suggestion input.
79
+ *
80
+ * Place as a descendant of `Suggestion`
81
+ *
82
+ * @example
83
+ * <Suggestion>
84
+ * <Suggestion.Input />
85
+ * <Suggestion.Clear />
86
+ * <Suggestion.List />
87
+ * </Suggestion>
88
+ */
33
89
  Clear: SuggestionClear,
34
90
  });
35
91
  EXPERIMENTAL_Suggestion.displayName = 'EXPERIMENTAL_Suggestion';
@@ -2,6 +2,18 @@
2
2
  import { jsx } from 'react/jsx-runtime';
3
3
  import { forwardRef } from 'react';
4
4
 
5
+ /**
6
+ * A component for rendering individual options in the Suggestion list.
7
+ *
8
+ * @example
9
+ * <Suggestion>
10
+ * <Suggestion.Input />
11
+ * <Suggestion.List>
12
+ * <Suggestion.Option value='Option 1'>Option 1</Suggestion.Option>
13
+ * <Suggestion.Option value='Option 2'>Option 2</Suggestion.Option>
14
+ * </Suggestion.List>
15
+ * </Suggestion>
16
+ */
5
17
  const SuggestionOption = forwardRef(function SuggestionOption({ className, ...rest }, ref) {
6
18
  return (jsx("u-option", { class: className, ref: ref, ...rest }));
7
19
  });
@@ -1,9 +1,18 @@
1
+ import { Suggestion as SuggestionRoot } from './suggestion';
1
2
  import { SuggestionChips } from './suggestion-chips';
2
3
  import { SuggestionClear } from './suggestion-clear';
3
4
  import { SuggestionEmpty } from './suggestion-empty';
4
5
  import { SuggestionInput } from './suggestion-input';
5
6
  import { SuggestionList } from './suggestion-list';
6
7
  import { SuggestionOption } from './suggestion-option';
8
+ type SuggestionCompound = typeof SuggestionRoot & {
9
+ Chips: typeof SuggestionChips;
10
+ List: typeof SuggestionList;
11
+ Input: typeof SuggestionInput;
12
+ Empty: typeof SuggestionEmpty;
13
+ Option: typeof SuggestionOption;
14
+ Clear: typeof SuggestionClear;
15
+ };
7
16
  /**
8
17
  * A component that provides a suggestion list for an input field.
9
18
  *
@@ -18,67 +27,8 @@ import { SuggestionOption } from './suggestion-option';
18
27
  * </Suggestion.List>
19
28
  * </Suggestion>
20
29
  */
21
- declare const EXPERIMENTAL_Suggestion: React.ForwardRefExoticComponent<{
22
- filter?: boolean | ((args: {
23
- index: number;
24
- label: string;
25
- text: string;
26
- value: string;
27
- optionElement: HTMLOptionElement;
28
- input: HTMLInputElement;
29
- }) => boolean);
30
- creatable?: boolean;
31
- multiple?: boolean;
32
- selected?: import("./suggestion").SuggestionSelected;
33
- value?: import("./suggestion").SuggestionSelected;
34
- defaultSelected?: import("./suggestion").SuggestionSelected;
35
- defaultValue?: import("./suggestion").SuggestionSelected;
36
- onSelectedChange?: (value: {
37
- label: string;
38
- value: string;
39
- }[]) => void;
40
- onValueChange?: (value: {
41
- label: string;
42
- value: string;
43
- }[]) => void;
44
- onBeforeMatch?: (event: Omit<CustomEvent<HTMLOptionElement | undefined>, "currentTarget"> & {
45
- currentTarget: import("@u-elements/u-combobox").UHTMLComboboxElement;
46
- }) => void;
47
- name?: string;
48
- renderSelected?: (args: {
49
- label: string;
50
- value: string;
51
- }) => React.ReactNode;
52
- } & React.HTMLAttributes<import("@u-elements/u-combobox").UHTMLComboboxElement> & React.RefAttributes<import("@u-elements/u-combobox").UHTMLComboboxElement>> & {
53
- /**
54
- * @deprecated Suggestion.Chips is deprecated, use `renderSelected` on `Suggestion` instead
55
- */
56
- Chips: {
57
- (): null;
58
- displayName: string;
59
- };
60
- List: React.ForwardRefExoticComponent<Omit<import("../../types").DefaultProps & React.HTMLAttributes<HTMLDataListElement>, "singular" | "plural"> & {
61
- singular?: string;
62
- plural?: string;
63
- } & React.RefAttributes<HTMLDataListElement>>;
64
- Input: React.ForwardRefExoticComponent<Omit<import("../../types").DefaultProps & Omit<React.InputHTMLAttributes<HTMLInputElement>, "prefix" | "type">, "type" | "disabled" | "readOnly" | "size" | "role"> & {
65
- type?: "checkbox" | "color" | "date" | "datetime-local" | "email" | "file" | "hidden" | "month" | "number" | "password" | "radio" | "search" | "tel" | "text" | "time" | "url" | "week";
66
- size?: number;
67
- disabled?: boolean;
68
- readOnly?: boolean;
69
- role?: React.AriaRole | undefined;
70
- } & React.RefAttributes<HTMLInputElement>>;
71
- Empty: React.ForwardRefExoticComponent<import("../../types").DefaultProps & React.OptionHTMLAttributes<HTMLOptionElement> & React.RefAttributes<HTMLOptionElement>>;
72
- Option: React.ForwardRefExoticComponent<React.OptionHTMLAttributes<HTMLOptionElement> & import("../../types").DefaultProps & React.RefAttributes<HTMLOptionElement>>;
73
- Clear: React.ForwardRefExoticComponent<Omit<import("..").ButtonProps, "children" | "variant"> & {
74
- 'aria-label'?: string;
75
- } & React.RefAttributes<HTMLButtonElement>>;
76
- };
77
- export { EXPERIMENTAL_Suggestion,
78
- /**
79
- * @deprecated Suggestion.Chips is deprecated, use `renderSelected` on `Suggestion` instead
80
- */
81
- SuggestionChips as EXPERIMENTAL_SuggestionChips, SuggestionList as EXPERIMENTAL_SuggestionList, SuggestionInput as EXPERIMENTAL_SuggestionInput, SuggestionEmpty as EXPERIMENTAL_SuggestionEmpty, SuggestionOption as EXPERIMENTAL_SuggestionOption, SuggestionClear as EXPERIMENTAL_SuggestionClear, };
30
+ declare const EXPERIMENTAL_Suggestion: SuggestionCompound;
31
+ export { EXPERIMENTAL_Suggestion, SuggestionChips as EXPERIMENTAL_SuggestionChips, SuggestionList as EXPERIMENTAL_SuggestionList, SuggestionInput as EXPERIMENTAL_SuggestionInput, SuggestionEmpty as EXPERIMENTAL_SuggestionEmpty, SuggestionOption as EXPERIMENTAL_SuggestionOption, SuggestionClear as EXPERIMENTAL_SuggestionClear, };
82
32
  export type { SuggestionProps, SuggestionSelected, // Export SuggestionValues for easier useState
83
33
  SuggestionSelected as SuggestionValues, } from './suggestion';
84
34
  export type { SuggestionChipsProps } from './suggestion-chips';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/suggestion/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEvD;;;;;;;;;;;;;GAaG;AACH,QAAA,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAC3B;;OAEG;;;;;;;;;;;;;;;;;;;;;CAOH,CAAC;AAUH,OAAO,EACL,uBAAuB;AACvB;;GAEG;AACH,eAAe,IAAI,4BAA4B,EAC/C,cAAc,IAAI,2BAA2B,EAC7C,eAAe,IAAI,4BAA4B,EAC/C,eAAe,IAAI,4BAA4B,EAC/C,gBAAgB,IAAI,6BAA6B,EACjD,eAAe,IAAI,4BAA4B,GAChD,CAAC;AACF,YAAY,EACV,eAAe,EACf,kBAAkB,EAAE,8CAA8C;AAClE,kBAAkB,IAAI,gBAAgB,GACvC,MAAM,cAAc,CAAC;AACtB,YAAY,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC/D,YAAY,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC/D,YAAY,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC/D,YAAY,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC/D,YAAY,EAAE,mBAAmB,EAAE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AC;AAC/D,YAAY,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC/D,YAAY,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC/D,YAAY,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC/D,YAAY,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAC7D,YAAY,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC"}
@@ -1,5 +1,17 @@
1
1
  import type { OptionHTMLAttributes } from 'react';
2
2
  import type { DefaultProps } from '../../types';
3
3
  export type SuggestionOptionProps = OptionHTMLAttributes<HTMLOptionElement> & DefaultProps;
4
+ /**
5
+ * A component for rendering individual options in the Suggestion list.
6
+ *
7
+ * @example
8
+ * <Suggestion>
9
+ * <Suggestion.Input />
10
+ * <Suggestion.List>
11
+ * <Suggestion.Option value='Option 1'>Option 1</Suggestion.Option>
12
+ * <Suggestion.Option value='Option 2'>Option 2</Suggestion.Option>
13
+ * </Suggestion.List>
14
+ * </Suggestion>
15
+ */
4
16
  export declare const SuggestionOption: React.ForwardRefExoticComponent<OptionHTMLAttributes<HTMLOptionElement> & DefaultProps & React.RefAttributes<HTMLOptionElement>>;
5
17
  //# sourceMappingURL=suggestion-option.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"suggestion-option.d.ts","sourceRoot":"","sources":["../../../src/components/suggestion/suggestion-option.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,OAAO,CAAC;AAElD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEhD,MAAM,MAAM,qBAAqB,GAAG,oBAAoB,CAAC,iBAAiB,CAAC,GACzE,YAAY,CAAC;AAEf,eAAO,MAAM,gBAAgB,kIAW3B,CAAC"}
1
+ {"version":3,"file":"suggestion-option.d.ts","sourceRoot":"","sources":["../../../src/components/suggestion/suggestion-option.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,OAAO,CAAC;AAElD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEhD,MAAM,MAAM,qBAAqB,GAAG,oBAAoB,CAAC,iBAAiB,CAAC,GACzE,YAAY,CAAC;AAEf;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,gBAAgB,kIAW3B,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@digdir/designsystemet-react",
3
3
  "type": "module",
4
- "version": "0.0.0-test-20250715110951",
4
+ "version": "0.0.0-test-20250715115803",
5
5
  "description": "React components for Designsystemet",
6
6
  "author": "Designsystemet team",
7
7
  "repository": {
@@ -67,7 +67,7 @@
67
67
  "storybook": "^9.0.15",
68
68
  "tsx": "4.20.3",
69
69
  "typescript": "^5.8.3",
70
- "@digdir/designsystemet-css": "^0.0.0-test-20250715110951"
70
+ "@digdir/designsystemet-css": "^0.0.0-test-20250715115803"
71
71
  },
72
72
  "scripts": {
73
73
  "build": "pnpm run clean && tsc -b tsconfig.lib.json --emitDeclarationOnly false && rollup -c --bundleConfigAsCjs",