@digdir/designsystemet-react 0.58.0 → 0.59.1-alpha.0

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.
Files changed (107) hide show
  1. package/dist/cjs/components/Alert/Alert.js +2 -2
  2. package/dist/cjs/components/Button/Button.js +1 -2
  3. package/dist/cjs/components/DropdownMenu/DropdownMenuContent.js +4 -4
  4. package/dist/cjs/components/DropdownMenu/DropdownMenuTrigger.js +1 -1
  5. package/dist/cjs/components/Modal/ModalDialog.js +1 -1
  6. package/dist/cjs/components/Popover/PopoverContent.js +6 -6
  7. package/dist/cjs/components/Popover/PopoverTrigger.js +1 -1
  8. package/dist/cjs/components/SkipLink/SkipLink.js +1 -2
  9. package/dist/cjs/components/Tooltip/Tooltip.js +6 -6
  10. package/dist/cjs/components/form/Checkbox/Checkbox.js +1 -1
  11. package/dist/cjs/components/form/Combobox/Combobox.js +60 -177
  12. package/dist/cjs/components/form/Combobox/ComboboxContext.js +8 -0
  13. package/dist/cjs/components/form/Combobox/ComboboxIdContext.js +42 -0
  14. package/dist/cjs/components/form/Combobox/Custom/Custom.js +14 -9
  15. package/dist/cjs/components/form/Combobox/Empty/Empty.js +4 -4
  16. package/dist/cjs/components/form/Combobox/Option/Option.js +15 -33
  17. package/dist/cjs/components/form/Combobox/Option/useComboboxOption.js +47 -0
  18. package/dist/cjs/components/form/Combobox/internal/ComboboxChips.js +14 -6
  19. package/dist/cjs/components/form/Combobox/internal/ComboboxClearButton.js +4 -4
  20. package/dist/cjs/components/form/Combobox/internal/ComboboxInput.js +40 -35
  21. package/dist/cjs/components/form/Combobox/internal/ComboboxNative.js +2 -2
  22. package/dist/cjs/components/form/Combobox/useCombobox.js +46 -32
  23. package/dist/cjs/components/form/Combobox/useComboboxKeyboard.js +79 -0
  24. package/dist/cjs/components/form/Combobox/useFloatingCombobox.js +78 -0
  25. package/dist/cjs/components/form/Search/Search.js +1 -1
  26. package/dist/cjs/node_modules/@floating-ui/utils/{dom/dist → dist}/floating-ui.utils.dom.js +7 -4
  27. package/dist/cjs/node_modules/@floating-ui/utils/dist/floating-ui.utils.js +5 -0
  28. package/dist/cjs/{node_modules → packages/react/node_modules}/@floating-ui/core/dist/floating-ui.core.js +40 -16
  29. package/dist/cjs/{node_modules → packages/react/node_modules}/@floating-ui/dom/dist/floating-ui.dom.js +83 -31
  30. package/dist/cjs/{node_modules → packages/react/node_modules}/@floating-ui/react/dist/floating-ui.react.js +307 -157
  31. package/dist/cjs/{node_modules/@floating-ui/react/utils → packages/react/node_modules/@floating-ui/react}/dist/floating-ui.react.utils.js +9 -4
  32. package/dist/cjs/{node_modules → packages/react/node_modules}/@floating-ui/react-dom/dist/floating-ui.react-dom.js +22 -18
  33. package/dist/{esm → cjs/packages/react}/node_modules/tabbable/dist/index.esm.js +59 -13
  34. package/dist/cjs/react-css-modules.css +0 -315
  35. package/dist/cjs/utilities/RovingTabIndex/RovingTabindexItem.js +1 -1
  36. package/dist/cjs/utilities/RovingTabIndex/RovingTabindexRoot.js +1 -1
  37. package/dist/esm/components/Alert/Alert.js +2 -2
  38. package/dist/esm/components/Button/Button.js +1 -2
  39. package/dist/esm/components/DropdownMenu/DropdownMenuContent.js +3 -3
  40. package/dist/esm/components/DropdownMenu/DropdownMenuTrigger.js +1 -1
  41. package/dist/esm/components/Modal/ModalDialog.js +1 -1
  42. package/dist/esm/components/Popover/PopoverContent.js +4 -4
  43. package/dist/esm/components/Popover/PopoverTrigger.js +1 -1
  44. package/dist/esm/components/SkipLink/SkipLink.js +1 -2
  45. package/dist/esm/components/Tooltip/Tooltip.js +4 -4
  46. package/dist/esm/components/form/Checkbox/Checkbox.js +1 -1
  47. package/dist/esm/components/form/Combobox/Combobox.js +65 -182
  48. package/dist/esm/components/form/Combobox/ComboboxContext.js +6 -0
  49. package/dist/esm/components/form/Combobox/ComboboxIdContext.js +35 -0
  50. package/dist/esm/components/form/Combobox/Custom/Custom.js +13 -8
  51. package/dist/esm/components/form/Combobox/Empty/Empty.js +3 -3
  52. package/dist/esm/components/form/Combobox/Option/Option.js +15 -33
  53. package/dist/esm/components/form/Combobox/Option/useComboboxOption.js +45 -0
  54. package/dist/esm/components/form/Combobox/internal/ComboboxChips.js +13 -5
  55. package/dist/esm/components/form/Combobox/internal/ComboboxClearButton.js +3 -3
  56. package/dist/esm/components/form/Combobox/internal/ComboboxInput.js +39 -34
  57. package/dist/esm/components/form/Combobox/internal/ComboboxNative.js +2 -2
  58. package/dist/esm/components/form/Combobox/useCombobox.js +46 -32
  59. package/dist/esm/components/form/Combobox/useComboboxKeyboard.js +77 -0
  60. package/dist/esm/components/form/Combobox/useFloatingCombobox.js +76 -0
  61. package/dist/esm/components/form/Search/Search.js +1 -1
  62. package/dist/esm/node_modules/@floating-ui/utils/{dom/dist → dist}/floating-ui.utils.dom.js +7 -4
  63. package/dist/esm/node_modules/@floating-ui/utils/dist/floating-ui.utils.js +5 -0
  64. package/dist/esm/{node_modules → packages/react/node_modules}/@floating-ui/core/dist/floating-ui.core.js +40 -16
  65. package/dist/esm/{node_modules → packages/react/node_modules}/@floating-ui/dom/dist/floating-ui.dom.js +82 -30
  66. package/dist/esm/{node_modules → packages/react/node_modules}/@floating-ui/react/dist/floating-ui.react.js +282 -135
  67. package/dist/esm/{node_modules/@floating-ui/react/utils → packages/react/node_modules/@floating-ui/react}/dist/floating-ui.react.utils.js +9 -5
  68. package/dist/esm/{node_modules → packages/react/node_modules}/@floating-ui/react-dom/dist/floating-ui.react-dom.js +19 -14
  69. package/dist/{cjs → esm/packages/react}/node_modules/tabbable/dist/index.esm.js +55 -15
  70. package/dist/esm/react-css-modules.css +0 -315
  71. package/dist/esm/utilities/RovingTabIndex/RovingTabindexItem.js +1 -1
  72. package/dist/esm/utilities/RovingTabIndex/RovingTabindexRoot.js +1 -1
  73. package/dist/types/components/Alert/Alert.d.ts +12 -0
  74. package/dist/types/components/Alert/Alert.d.ts.map +1 -1
  75. package/dist/types/components/Button/Button.d.ts.map +1 -1
  76. package/dist/types/components/SkipLink/SkipLink.d.ts.map +1 -1
  77. package/dist/types/components/form/Combobox/Combobox.d.ts +104 -39
  78. package/dist/types/components/form/Combobox/Combobox.d.ts.map +1 -1
  79. package/dist/types/components/form/Combobox/ComboboxContext.d.ts +48 -0
  80. package/dist/types/components/form/Combobox/ComboboxContext.d.ts.map +1 -0
  81. package/dist/types/components/form/Combobox/ComboboxIdContext.d.ts +19 -0
  82. package/dist/types/components/form/Combobox/ComboboxIdContext.d.ts.map +1 -0
  83. package/dist/types/components/form/Combobox/Custom/Custom.d.ts.map +1 -1
  84. package/dist/types/components/form/Combobox/Option/Option.d.ts +2 -2
  85. package/dist/types/components/form/Combobox/Option/Option.d.ts.map +1 -1
  86. package/dist/types/components/form/Combobox/Option/useComboboxOption.d.ts +14 -0
  87. package/dist/types/components/form/Combobox/Option/useComboboxOption.d.ts.map +1 -0
  88. package/dist/types/components/form/Combobox/internal/ComboboxChips.d.ts.map +1 -1
  89. package/dist/types/components/form/Combobox/internal/ComboboxInput.d.ts +0 -1
  90. package/dist/types/components/form/Combobox/internal/ComboboxInput.d.ts.map +1 -1
  91. package/dist/types/components/form/Combobox/internal/ComboboxNative.d.ts +3 -1
  92. package/dist/types/components/form/Combobox/internal/ComboboxNative.d.ts.map +1 -1
  93. package/dist/types/components/form/Combobox/useCombobox.d.ts +13 -5
  94. package/dist/types/components/form/Combobox/useCombobox.d.ts.map +1 -1
  95. package/dist/types/components/form/Combobox/useComboboxKeyboard.d.ts +20 -0
  96. package/dist/types/components/form/Combobox/useComboboxKeyboard.d.ts.map +1 -0
  97. package/dist/types/components/form/Combobox/useFloatingCombobox.d.ts +41 -0
  98. package/dist/types/components/form/Combobox/useFloatingCombobox.d.ts.map +1 -0
  99. package/package.json +3 -3
  100. package/dist/cjs/components/Button/Button.module.css.js +0 -6
  101. package/dist/cjs/components/SkipLink/SkipLink.module.css.js +0 -6
  102. package/dist/cjs/node_modules/@floating-ui/react/node_modules/@floating-ui/utils/dist/floating-ui.utils.js +0 -6
  103. package/dist/cjs/node_modules/@floating-ui/react/node_modules/@floating-ui/utils/dom/dist/floating-ui.utils.dom.js +0 -68
  104. package/dist/esm/components/Button/Button.module.css.js +0 -4
  105. package/dist/esm/components/SkipLink/SkipLink.module.css.js +0 -4
  106. package/dist/esm/node_modules/@floating-ui/react/node_modules/@floating-ui/utils/dist/floating-ui.utils.js +0 -4
  107. package/dist/esm/node_modules/@floating-ui/react/node_modules/@floating-ui/utils/dom/dist/floating-ui.utils.dom.js +0 -57
@@ -1,7 +1,5 @@
1
1
  import type * as React from 'react';
2
- import type { UseFloatingReturn, UseListNavigationProps } from '@floating-ui/react';
3
2
  import type { FormFieldProps } from '../useFormField';
4
- import { useFormField } from '../useFormField';
5
3
  import type { PortalProps } from '../../../types/Portal';
6
4
  import type { Option } from './useCombobox';
7
5
  export type ComboboxProps = {
@@ -100,6 +98,110 @@ export type ComboboxProps = {
100
98
  */
101
99
  chipSrLabel?: (option: Option) => string;
102
100
  } & PortalProps & FormFieldProps & Omit<React.InputHTMLAttributes<HTMLInputElement>, 'size'>;
101
+ export declare const ComboboxComponent: React.ForwardRefExoticComponent<{
102
+ /**
103
+ * Label for the combobox
104
+ */
105
+ label?: string | undefined;
106
+ /**
107
+ * Visually hides `label` and `description` (still available for screen readers)
108
+ * @default false
109
+ */
110
+ hideLabel?: boolean | undefined;
111
+ /**
112
+ * String array of selected options. Contains only one option during single selection mode.
113
+ */
114
+ value?: string[] | undefined;
115
+ /**
116
+ * String array of initial selected options. Contains only one option during single selection mode.
117
+ */
118
+ initialValue?: string[] | undefined;
119
+ /**
120
+ * Callback function that is called when the value changes
121
+ */
122
+ onValueChange?: ((value: string[]) => void) | undefined;
123
+ /**
124
+ * Multiple options can be selected
125
+ * @default false
126
+ */
127
+ multiple?: boolean | undefined;
128
+ /**
129
+ * Name of the value when used in a form
130
+ */
131
+ name?: string | undefined;
132
+ /**
133
+ * Exposes the HTML `size` attribute.
134
+ * @default 0
135
+ */
136
+ htmlSize?: number | undefined;
137
+ /**
138
+ * Hides chips when multiple options are selected
139
+ * @default false
140
+ */
141
+ hideChips?: boolean | undefined;
142
+ /**
143
+ * Label for the clear button
144
+ * @default 'Fjern alt'
145
+ * @deprecated Use `clearButtonLabel` instead
146
+ */
147
+ cleanButtonLabel?: string | undefined;
148
+ /**
149
+ * Hides the clear button
150
+ * @default false
151
+ */
152
+ hideClearButton?: boolean | undefined;
153
+ /**
154
+ * Label for the clear button
155
+ * @default 'Fjern alt'
156
+ */
157
+ clearButtonLabel?: string | undefined;
158
+ /**
159
+ * Enables virtualizing of options list.
160
+ * @see https://tanstack.com/virtual
161
+ * @default false
162
+ */
163
+ virtual?: boolean | undefined;
164
+ /**
165
+ * Value of the input field
166
+ */
167
+ inputValue?: string | undefined;
168
+ /**
169
+ * Adds `aria-busy` and displays loading state for the Combobox
170
+ * All options will be hidden and replaced with a loading message.
171
+ * @default false
172
+ */
173
+ loading?: boolean | undefined;
174
+ /**
175
+ * Text to display when the combobox is loading
176
+ * @default 'Laster...'
177
+ */
178
+ loadingLabel?: string | undefined;
179
+ /**
180
+ * Filter function for filtering the list of options. Return `true` to show option, `false` to hide option.
181
+ * @param inputValue
182
+ * @param option
183
+ * @returns boolean
184
+ *
185
+ * @default (inputValue, option) => option.value.toLowerCase().startsWith(inputValue.toLowerCase())
186
+ */
187
+ filter?: ((inputValue: string, option: Option) => boolean) | undefined;
188
+ /**
189
+ * Add a screen reader label to the chips
190
+ * @param option
191
+ * @returns string
192
+ *
193
+ * @default (option) => 'Slett ' + option.label,
194
+ */
195
+ chipSrLabel?: ((option: Option) => string) | undefined;
196
+ } & PortalProps & {
197
+ error?: React.ReactNode;
198
+ errorId?: string | undefined;
199
+ disabled?: boolean | undefined;
200
+ description?: React.ReactNode;
201
+ id?: string | undefined;
202
+ readOnly?: boolean | undefined;
203
+ size?: "small" | "medium" | "large" | undefined;
204
+ } & Pick<React.HTMLAttributes<HTMLElement>, "aria-describedby"> & Omit<React.InputHTMLAttributes<HTMLInputElement>, "size"> & React.RefAttributes<HTMLInputElement>>;
103
205
  export declare const Combobox: React.ForwardRefExoticComponent<{
104
206
  /**
105
207
  * Label for the combobox
@@ -204,41 +306,4 @@ export declare const Combobox: React.ForwardRefExoticComponent<{
204
306
  readOnly?: boolean | undefined;
205
307
  size?: "small" | "medium" | "large" | undefined;
206
308
  } & Pick<React.HTMLAttributes<HTMLElement>, "aria-describedby"> & Omit<React.InputHTMLAttributes<HTMLInputElement>, "size"> & React.RefAttributes<HTMLInputElement>>;
207
- type ComboboxContextType = {
208
- multiple: NonNullable<ComboboxProps['multiple']>;
209
- disabled: NonNullable<ComboboxProps['disabled']>;
210
- readOnly: NonNullable<ComboboxProps['readOnly']>;
211
- name: ComboboxProps['name'];
212
- error: ComboboxProps['error'];
213
- htmlSize: ComboboxProps['htmlSize'];
214
- hideChips: NonNullable<ComboboxProps['hideChips']>;
215
- clearButtonLabel: NonNullable<ComboboxProps['clearButtonLabel']>;
216
- hideClearButton: NonNullable<ComboboxProps['hideClearButton']>;
217
- options: Option[];
218
- selectedOptions: Option[];
219
- size: NonNullable<ComboboxProps['size']>;
220
- formFieldProps: ReturnType<typeof useFormField>;
221
- refs: UseFloatingReturn['refs'];
222
- inputRef: React.RefObject<HTMLInputElement>;
223
- activeIndex: number | null;
224
- open: boolean;
225
- inputValue: string;
226
- activeDescendant: string | undefined;
227
- optionValues: string[];
228
- listId: string;
229
- setInputValue: React.Dispatch<React.SetStateAction<string>>;
230
- setOpen: (open: boolean) => void;
231
- handleKeyDown: (event: React.KeyboardEvent) => void;
232
- setActiveIndex: (index: number | null) => void;
233
- setActiveOption: (index: number, id: string) => void;
234
- getReferenceProps: (props?: Record<string, unknown>) => Record<string, unknown>;
235
- onOptionClick: (value: string) => void;
236
- setSelectedOptions: React.Dispatch<React.SetStateAction<Option[]>>;
237
- chipSrLabel: NonNullable<ComboboxProps['chipSrLabel']>;
238
- handleSelectOption: (option: Option) => void;
239
- listRef: UseListNavigationProps['listRef'];
240
- forwareddRef: React.Ref<HTMLInputElement>;
241
- };
242
- export declare const ComboboxContext: React.Context<ComboboxContextType | undefined>;
243
- export {};
244
309
  //# sourceMappingURL=Combobox.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Combobox.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/Combobox/Combobox.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,KAAK,KAAK,MAAM,OAAO,CAAC;AAepC,OAAO,KAAK,EACV,iBAAiB,EACjB,sBAAsB,EACvB,MAAM,oBAAoB,CAAC;AAK5B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAKzD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAY5C,MAAM,MAAM,aAAa,GAAG;IAC1B;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB;;OAEG;IACH,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;IAC1C;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B;;;OAGG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B;;;OAGG;IACH,gBAAgB,CAAC,EAAE,MA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C,CAAC;AAEF,eAAO,MAAM,QAAQ;IAhcnB;;OAEG;;IAEH;;;OAGG;;IAEH;;OAEG;;IAEH;;OAEG;;IAEH;;OAEG;6BACqB,MAAM,EAAE,KAAK,IAAI;IACzC;;;OAGG;;IAEH;;OAEG;;IAEH;;;OAGG;;IAEH;;;OAGG;;IAEH;;;;OAIG;;IAEH;;;OAGG;;IAEH;;;OAGG;;IAEH;;;;OAIG;;IAEH;;OAEG;;IAEH;;;;OAIG;;IAEH;;;OAGG;;IAEH;;;;;;;OAOG;2BACmB,MAAM,UAAU,MAAM,KAAK,OAAO;IACxD;;;;;;OAMG;4BACoB,MAAM,KAAK,MAAM;;;;;;;;;oKA4WzC,CAAC"}
@@ -0,0 +1,48 @@
1
+ import type { UseFloatingReturn, UseListNavigationProps, useInteractions } from '@floating-ui/react';
2
+ import type { useFormField } from '../useFormField';
3
+ import type { ComboboxProps } from './Combobox';
4
+ import type { Option } from './useCombobox';
5
+ import type useCombobox from './useCombobox';
6
+ type ComboboxContextType = {
7
+ multiple: NonNullable<ComboboxProps['multiple']>;
8
+ disabled: NonNullable<ComboboxProps['disabled']>;
9
+ readOnly: NonNullable<ComboboxProps['readOnly']>;
10
+ name: ComboboxProps['name'];
11
+ error: ComboboxProps['error'];
12
+ htmlSize: ComboboxProps['htmlSize'];
13
+ hideChips: NonNullable<ComboboxProps['hideChips']>;
14
+ clearButtonLabel: NonNullable<ComboboxProps['clearButtonLabel']>;
15
+ hideClearButton: NonNullable<ComboboxProps['hideClearButton']>;
16
+ filteredOptions: ReturnType<typeof useCombobox>['filteredOptions'];
17
+ options: {
18
+ [key: string]: Option;
19
+ };
20
+ selectedOptions: {
21
+ [key: string]: Option;
22
+ };
23
+ size: NonNullable<ComboboxProps['size']>;
24
+ formFieldProps: ReturnType<typeof useFormField>;
25
+ refs: UseFloatingReturn['refs'];
26
+ inputRef: React.RefObject<HTMLInputElement>;
27
+ open: boolean;
28
+ inputValue: string;
29
+ optionValues: string[];
30
+ listId: string;
31
+ customIds: string[];
32
+ setInputValue: React.Dispatch<React.SetStateAction<string>>;
33
+ setOpen: (open: boolean) => void;
34
+ handleKeyDown: (event: React.KeyboardEvent) => void;
35
+ getReferenceProps: (props?: Record<string, unknown>) => Record<string, unknown>;
36
+ getItemProps: ReturnType<typeof useInteractions>['getItemProps'];
37
+ onOptionClick: (value: string) => void;
38
+ setSelectedOptions: React.Dispatch<React.SetStateAction<{
39
+ [key: string]: Option;
40
+ }>>;
41
+ chipSrLabel: NonNullable<ComboboxProps['chipSrLabel']>;
42
+ handleSelectOption: (option: Option) => void;
43
+ listRef: UseListNavigationProps['listRef'];
44
+ forwareddRef: React.Ref<HTMLInputElement>;
45
+ };
46
+ export declare const ComboboxContext: import("react").Context<ComboboxContextType | undefined>;
47
+ export {};
48
+ //# sourceMappingURL=ComboboxContext.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ComboboxContext.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/Combobox/ComboboxContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,iBAAiB,EACjB,sBAAsB,EACtB,eAAe,EAChB,MAAM,oBAAoB,CAAC;AAG5B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAEpD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,KAAK,WAAW,MAAM,eAAe,CAAC;AAE7C,KAAK,mBAAmB,GAAG;IACzB,QAAQ,EAAE,WAAW,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC,CAAC;IACjD,QAAQ,EAAE,WAAW,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC,CAAC;IACjD,QAAQ,EAAE,WAAW,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC,CAAC;IACjD,IAAI,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IAC5B,KAAK,EAAE,aA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MAAM,EAAE,OAAO,CAAC,CAAC;IAC7B,YAAY,EAAE,UAAU,CAAC,OAAO,eAAe,CAAC,CAAC,cAAc,CAAC,CAAC;IACjE,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,kBAAkB,EAAE,KAAK,CAAC,QAAQ,CAChC,KAAK,CAAC,cAAc,CAAC;QACnB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC;KACvB,CAAC,CACH,CAAC;IACF,WAAW,EAAE,WAAW,CAAC,aAAa,CAAC,aAAa,CAAC,CAAC,CAAC;IACvD,kBAAkB,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7C,OAAO,EAAE,sBAAsB,CAAC,SAAS,CAAC,CAAC;IAC3C,YAAY,EAAE,KAAK,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;CAC3C,CAAC;AAEF,eAAO,MAAM,eAAe,0DAE3B,CAAC"}
@@ -0,0 +1,19 @@
1
+ import type { Dispatch } from 'react';
2
+ type ComboboxIdContextType = {
3
+ activeIndex: number;
4
+ };
5
+ export declare const ComboboxIdContext: import("react").Context<ComboboxIdContextType>;
6
+ type SetActiveIndexAction = {
7
+ type: 'SET_ACTIVE_INDEX';
8
+ payload: number;
9
+ };
10
+ type ComboboxIdReducerAction = SetActiveIndexAction;
11
+ export declare const ComboboxIdReducer: (state: ComboboxIdContextType, action: ComboboxIdReducerAction) => ComboboxIdContextType;
12
+ export declare const ComboboxIdDispatch: import("react").Context<Dispatch<SetActiveIndexAction>>;
13
+ export declare const ComboboxIdProvider: ({ children, }: {
14
+ children: React.ReactNode;
15
+ }) => import("react/jsx-runtime").JSX.Element;
16
+ export declare function useComboboxIdDispatch(): Dispatch<SetActiveIndexAction>;
17
+ export declare function useComboboxId(): ComboboxIdContextType;
18
+ export {};
19
+ //# sourceMappingURL=ComboboxIdContext.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ComboboxIdContext.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/Combobox/ComboboxIdContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAGtC,KAAK,qBAAqB,GAAG;IAC3B,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,eAAO,MAAM,iBAAiB,gDAE5B,CAAC;AAEH,KAAK,oBAAoB,GAAG;IAC1B,IAAI,EAAE,kBAAkB,CAAC;IACzB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,KAAK,uBAAuB,GAAG,oBAAoB,CAAC;AAEpD,eAAO,MAAM,iBAAiB,UACrB,qBAAqB,UACpB,uBAAuB,0BAWhC,CAAC;AAEF,eAAO,MAAM,kBAAkB,yDAI7B,CAAC;AAEH,eAAO,MAAM,kBAAkB;cAGnB,MAAM,SAAS;6CAa1B,CAAC;AAEF,wBAAgB,qBAAqB,mCAEpC;AAED,wBAAgB,aAAa,0BAE5B"}
@@ -1 +1 @@
1
- {"version":3,"file":"Custom.d.ts","sourceRoot":"","sources":["../../../../../../src/components/form/Combobox/Custom/Custom.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,KAAK,MAAM,OAAO,CAAC;AASpC,KAAK,gBAAgB,GAAG;IACtB,WAAW,EAAE,IAAI,CAAC;IAClB,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;AAEF,KAAK,mBAAmB,GAAG;IACzB,WAAW,CAAC,EAAE,KAAK,CAAC;IACpB,EAAE,CAAC,EAAE,MAAM,CAAC;CACb,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;OAEG;IACH,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,GAAG,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,GACtC,CAAC,gBAAgB,GAAG,mBAAmB,CAAC,CAAC;AAE3C,eAAO,MAAM,cAAc,4FAyC1B,CAAC;AAEF,eAAe,cAAc,CAAC"}
1
+ {"version":3,"file":"Custom.d.ts","sourceRoot":"","sources":["../../../../../../src/components/form/Combobox/Custom/Custom.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,KAAK,MAAM,OAAO,CAAC;AAWpC,KAAK,gBAAgB,GAAG;IACtB,WAAW,EAAE,IAAI,CAAC;IAClB,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;AAEF,KAAK,mBAAmB,GAAG;IACzB,WAAW,CAAC,EAAE,KAAK,CAAC;IACpB,EAAE,CAAC,EAAE,MAAM,CAAC;CACb,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;OAEG;IACH,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,GAAG,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,GACtC,CAAC,gBAAgB,GAAG,mBAAmB,CAAC,CAAC;AAE3C,eAAO,MAAM,cAAc,4FA6C1B,CAAC;AAEF,eAAe,cAAc,CAAC"}
@@ -14,7 +14,7 @@ export type ComboboxOptionProps = {
14
14
  */
15
15
  displayValue?: string;
16
16
  } & React.ButtonHTMLAttributes<HTMLButtonElement>;
17
- export declare const ComboboxOption: React.ForwardRefExoticComponent<{
17
+ export declare const ComboboxOption: React.MemoExoticComponent<React.ForwardRefExoticComponent<{
18
18
  /**
19
19
  * The value returned when the option is selected
20
20
  */
@@ -28,5 +28,5 @@ export declare const ComboboxOption: React.ForwardRefExoticComponent<{
28
28
  * Required if children is not composed of strings only.
29
29
  */
30
30
  displayValue?: string | undefined;
31
- } & React.ButtonHTMLAttributes<HTMLButtonElement> & React.RefAttributes<HTMLButtonElement>>;
31
+ } & React.ButtonHTMLAttributes<HTMLButtonElement> & React.RefAttributes<HTMLButtonElement>>>;
32
32
  //# sourceMappingURL=Option.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Option.d.ts","sourceRoot":"","sources":["../../../../../../src/components/form/Combobox/Option/Option.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,KAAK,MAAM,OAAO,CAAC;AAcpC,MAAM,MAAM,mBAAmB,GAAG;IAChC;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,GAAG,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,CAAC;AAElD,eAAO,MAAM,cAAc;IAfzB;;OAEG;WACI,MAAM;IACb;;OAEG;;IAEH;;;OAGG;;2FAuGH,CAAC"}
1
+ {"version":3,"file":"Option.d.ts","sourceRoot":"","sources":["../../../../../../src/components/form/Combobox/Option/Option.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,KAAK,MAAM,OAAO,CAAC;AAYpC,MAAM,MAAM,mBAAmB,GAAG;IAChC;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,GAAG,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,CAAC;AAElD,eAAO,MAAM,cAAc;IAfzB;;OAEG;WACI,MAAM;IACb;;OAEG;;IAEH;;;OAGG;;4FAyEJ,CAAC"}
@@ -0,0 +1,14 @@
1
+ type UseComboboxOptionProps = {
2
+ id?: string;
3
+ ref: React.Ref<HTMLButtonElement>;
4
+ value: string;
5
+ };
6
+ export default function useComboboxOption({ id, ref, value, }: UseComboboxOptionProps): {
7
+ id: string;
8
+ ref: ((instance: HTMLButtonElement | null) => void) | null;
9
+ selected: import("../useCombobox").Option;
10
+ active: boolean;
11
+ onOptionClick: (...args: never[]) => void;
12
+ };
13
+ export {};
14
+ //# sourceMappingURL=useComboboxOption.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useComboboxOption.d.ts","sourceRoot":"","sources":["../../../../../../src/components/form/Combobox/Option/useComboboxOption.tsx"],"names":[],"mappings":"AAOA,KAAK,sBAAsB,GAAG;IAC5B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,KAAK,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;IAClC,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAAC,EACxC,EAAE,EACF,GAAG,EACH,KAAK,GACN,EAAE,sBAAsB;;;;;;EAoDxB"}
@@ -1 +1 @@
1
- {"version":3,"file":"ComboboxChips.d.ts","sourceRoot":"","sources":["../../../../../../src/components/form/Combobox/internal/ComboboxChips.tsx"],"names":[],"mappings":"AAKA,eAAO,MAAM,aAAa;;;CAwDzB,CAAC;AAIF,eAAe,aAAa,CAAC"}
1
+ {"version":3,"file":"ComboboxChips.d.ts","sourceRoot":"","sources":["../../../../../../src/components/form/Combobox/internal/ComboboxChips.tsx"],"names":[],"mappings":"AAKA,eAAO,MAAM,aAAa;;;CA4DzB,CAAC;AAIF,eAAe,aAAa,CAAC"}
@@ -1,4 +1,3 @@
1
- import type * as React from 'react';
2
1
  export declare const ComboboxInput: {
3
2
  ({ ...rest }: Omit<React.InputHTMLAttributes<HTMLInputElement>, 'size'>): import("react/jsx-runtime").JSX.Element;
4
3
  displayName: string;
@@ -1 +1 @@
1
- {"version":3,"file":"ComboboxInput.d.ts","sourceRoot":"","sources":["../../../../../../src/components/form/Combobox/internal/ComboboxInput.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,KAAK,MAAM,OAAO,CAAC;AAcpC,eAAO,MAAM,aAAa;kBAEvB,KAAK,MAAM,mBAAmB,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC;;CA8K3D,CAAC;AAIF,eAAe,aAAa,CAAC"}
1
+ {"version":3,"file":"ComboboxInput.d.ts","sourceRoot":"","sources":["../../../../../../src/components/form/Combobox/internal/ComboboxInput.tsx"],"names":[],"mappings":"AAgBA,eAAO,MAAM,aAAa;kBAEvB,KAAK,MAAM,mBAAmB,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC;;CA+K3D,CAAC;AAIF,eAAe,aAAa,CAAC"}
@@ -1,7 +1,9 @@
1
1
  import type { Option } from '../useCombobox';
2
2
  import type { ComboboxProps } from '../Combobox';
3
3
  type ComboboxNativeProps = {
4
- selectedOptions: Option[];
4
+ selectedOptions: {
5
+ [key: string]: Option;
6
+ };
5
7
  multiple: NonNullable<ComboboxProps['multiple']>;
6
8
  name: ComboboxProps['name'];
7
9
  };
@@ -1 +1 @@
1
- {"version":3,"file":"ComboboxNative.d.ts","sourceRoot":"","sources":["../../../../../../src/components/form/Combobox/internal/ComboboxNative.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEjD,KAAK,mBAAmB,GAAG;IACzB,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,QAAQ,EAAE,WAAW,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC,CAAC;IACjD,IAAI,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;CAC7B,CAAC;AAEF,eAAO,MAAM,cAAc;2CAIxB,mBAAmB;;CAqBrB,CAAC;AAIF,eAAe,cAAc,CAAC"}
1
+ {"version":3,"file":"ComboboxNative.d.ts","sourceRoot":"","sources":["../../../../../../src/components/form/Combobox/internal/ComboboxNative.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEjD,KAAK,mBAAmB,GAAG;IACzB,eAAe,EAAE;QACf,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC;KACvB,CAAC;IACF,QAAQ,EAAE,WAAW,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC,CAAC;IACjD,IAAI,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;CAC7B,CAAC;AAEF,eAAO,MAAM,cAAc;2CAIxB,mBAAmB;;CAqBrB,CAAC;AAIF,eAAe,cAAc,CAAC"}
@@ -6,7 +6,7 @@ export type UseComboboxProps = {
6
6
  children: ReactNode;
7
7
  inputValue: string;
8
8
  multiple: boolean;
9
- filter: NonNullable<ComboboxProps['filter']>;
9
+ filter?: NonNullable<ComboboxProps['filter']>;
10
10
  initialValue?: string[];
11
11
  };
12
12
  export type Option = {
@@ -19,14 +19,22 @@ export declare function isComboboxOption(child: ReactNode): child is ReactElemen
19
19
  export declare function isComboboxCustom(child: ReactNode): child is ReactElement<ComboboxCustomProps>;
20
20
  export declare function isInteractiveComboboxCustom(child: ReactNode): child is ReactElement<ComboboxCustomProps>;
21
21
  export default function useCombobox({ children, inputValue, multiple, filter, initialValue, }: UseComboboxProps): {
22
- optionsChildren: ReactElement<ComboboxOptionProps, string | import("react").JSXElementConstructor<any>>[];
22
+ filteredOptionsChildren: (ReactElement<ComboboxOptionProps, string | import("react").JSXElementConstructor<any>> | undefined)[];
23
+ filteredOptions: string[];
23
24
  optionValues: string[];
24
25
  restChildren: (string | number | ReactElement<any, string | import("react").JSXElementConstructor<any>> | Iterable<ReactNode> | import("react").ReactPortal)[];
25
- options: Option[];
26
+ options: {
27
+ [key: string]: Option;
28
+ };
26
29
  customIds: string[];
27
- selectedOptions: Option[];
28
- setSelectedOptions: import("react").Dispatch<import("react").SetStateAction<Option[]>>;
30
+ selectedOptions: {
31
+ [key: string]: Option;
32
+ };
29
33
  prevSelectedHash: string;
34
+ interactiveChildren: ReactElement<ComboboxCustomProps, string | import("react").JSXElementConstructor<any>>[];
35
+ setSelectedOptions: import("react").Dispatch<import("react").SetStateAction<{
36
+ [key: string]: Option;
37
+ }>>;
30
38
  setPrevSelectedHash: import("react").Dispatch<import("react").SetStateAction<string>>;
31
39
  };
32
40
  //# sourceMappingURL=useCombobox.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useCombobox.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/Combobox/useCombobox.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAErD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAE3D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAG3D,MAAM,MAAM,gBAAgB,GAAG;IAC7B,QAAQ,EAAE,SAAS,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,OAAO,CAAC;IAClB,MAAM,EAAE,WAAW,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC,CAAC;IAC7C,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;CACzB,CAAC;AAEF,MAAM,MAAM,MAAM,GAAG;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAIF,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,SAAS,GACf,KAAK,IAAI,YAAY,CAAC,mBAAmB,CAAC,CAE5C;AAED,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,SAAS,GACf,KAAK,IAAI,YAAY,CAAC,mBAAmB,CAAC,CAE5C;AAED,wBAAgB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K,IAAI,YAAY,CAAC,mBAAmB,CAAC,CAE5C;AAED,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,EAClC,QAAQ,EACR,UAAU,EACV,QAAQ,EACR,MAEC,EACD,YAAY,GACb,EAAE,gBAAgB;;;;;;;;;;;;;;;;;;EA0IlB"}
@@ -0,0 +1,20 @@
1
+ import type useCombobox from './useCombobox';
2
+ import type { Option } from './useCombobox';
3
+ type UseComboboxKeyboardProps = {
4
+ filteredOptions: ReturnType<typeof useCombobox>['filteredOptions'];
5
+ selectedOptions: ReturnType<typeof useCombobox>['selectedOptions'];
6
+ interactiveChildren: ReturnType<typeof useCombobox>['interactiveChildren'];
7
+ options: ReturnType<typeof useCombobox>['options'];
8
+ readOnly: boolean;
9
+ disabled: boolean;
10
+ inputValue: string;
11
+ multiple: boolean;
12
+ open: boolean;
13
+ setOpen: (value: boolean) => void;
14
+ setSelectedOptions: ReturnType<typeof useCombobox>['setSelectedOptions'];
15
+ setInputValue: (value: string) => void;
16
+ handleSelectOption: (option: Option) => void;
17
+ };
18
+ export declare const useComboboxKeyboard: ({ readOnly, disabled, interactiveChildren, filteredOptions, inputValue, selectedOptions, multiple, open, options, setOpen, setInputValue, setSelectedOptions, handleSelectOption, }: UseComboboxKeyboardProps) => (...args: import("react").KeyboardEvent<Element>[]) => void;
19
+ export {};
20
+ //# sourceMappingURL=useComboboxKeyboard.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useComboboxKeyboard.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/Combobox/useComboboxKeyboard.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,WAAW,MAAM,eAAe,CAAC;AAC7C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAG5C,KAAK,wBAAwB,GAAG;IAC9B,eAAe,EAAE,UAAU,CAAC,OAAO,WAAW,CAAC,CAAC,iBAAiB,CAAC,CAAC;IACnE,eAAe,EAAE,UAAU,CAAC,OAAO,WAAW,CAAC,CAAC,iBAAiB,CAAC,CAAC;IACnE,mBAAmB,EAAE,UAAU,CAAC,OAAO,WAAW,CAAC,CAAC,qBAAqB,CAAC,CAAC;IAC3E,OAAO,EAAE,UAAU,CAAC,OAAO,WAAW,CAAC,CAAC,SAAS,CAAC,CAAC;IACnD,QAAQ,EAAE,OAAO,CAAC;IAClB,QAAQ,EAAE,OAAO,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,OAAO,CAAC;IAClB,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IAClC,kBAAkB,EAAE,UAAU,CAAC,OAAO,WAAW,CAAC,CAAC,oBAAoB,CAAC,CAAC;IACzE,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,kBAAkB,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;CAC9C,CAAC;AAEF,eAAO,MAAM,mBAAmB,wLAc7B,wBAAwB,gEAkF1B,CAAC"}
@@ -0,0 +1,41 @@
1
+ type UseFloatingComboboxProps = {
2
+ listRef: React.MutableRefObject<(HTMLElement | null)[]>;
3
+ };
4
+ export declare const useFloatingCombobox: ({ listRef }: UseFloatingComboboxProps) => {
5
+ open: boolean;
6
+ setOpen: import("react").Dispatch<import("react").SetStateAction<boolean>>;
7
+ activeIndex: number;
8
+ refs: {
9
+ reference: import("react").MutableRefObject<import("@floating-ui/react-dom").ReferenceType | null>;
10
+ floating: import("react").MutableRefObject<HTMLElement | null>;
11
+ setReference: (node: import("@floating-ui/react-dom").ReferenceType | null) => void;
12
+ setFloating: (node: HTMLElement | null) => void;
13
+ } & import("@floating-ui/react").ExtendedRefs<HTMLInputElement>;
14
+ floatingStyles: import("react").CSSProperties;
15
+ context: {
16
+ x: number;
17
+ y: number;
18
+ placement: import("@floating-ui/utils").Placement;
19
+ strategy: import("@floating-ui/utils").Strategy;
20
+ middlewareData: import("@floating-ui/core").MiddlewareData;
21
+ isPositioned: boolean;
22
+ update: () => void;
23
+ floatingStyles: import("react").CSSProperties;
24
+ open: boolean;
25
+ onOpenChange: (open: boolean, event?: Event | undefined, reason?: import("@floating-ui/react").OpenChangeReason | undefined) => void;
26
+ events: import("@floating-ui/react").FloatingEvents;
27
+ dataRef: import("react").MutableRefObject<import("@floating-ui/react").ContextData>;
28
+ nodeId: string | undefined;
29
+ floatingId: string;
30
+ refs: import("@floating-ui/react").ExtendedRefs<HTMLInputElement>;
31
+ elements: import("@floating-ui/react").ExtendedElements<HTMLInputElement>;
32
+ };
33
+ getReferenceProps: (userProps?: import("react").HTMLProps<Element> | undefined) => Record<string, unknown>;
34
+ getFloatingProps: (userProps?: import("react").HTMLProps<HTMLElement> | undefined) => Record<string, unknown>;
35
+ getItemProps: (userProps?: (Omit<import("react").HTMLProps<HTMLElement>, "selected" | "active"> & {
36
+ active?: boolean | undefined;
37
+ selected?: boolean | undefined;
38
+ }) | undefined) => Record<string, unknown>;
39
+ };
40
+ export {};
41
+ //# sourceMappingURL=useFloatingCombobox.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useFloatingCombobox.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/Combobox/useFloatingCombobox.tsx"],"names":[],"mappings":"AAgBA,KAAK,wBAAwB,GAAG;IAC9B,OAAO,EAAE,KAAK,CAAC,gBAAgB,CAAC,CAAC,WAAW,GAAG,IAAI,CAAC,EAAE,CAAC,CAAC;CACzD,CAAC;AAEF,eAAO,MAAM,mBAAmB,gBAAiB,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuExE,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digdir/designsystemet-react",
3
- "version": "0.58.0",
3
+ "version": "0.59.1-alpha.0",
4
4
  "description": "React components for Designsystemet",
5
5
  "author": "Designsystemet team",
6
6
  "repository": "https://github.com/digdir/designsystemet",
@@ -29,7 +29,7 @@
29
29
  "access": "public"
30
30
  },
31
31
  "dependencies": {
32
- "@floating-ui/react": "0.26.4",
32
+ "@floating-ui/react": "0.26.12",
33
33
  "@navikt/aksel-icons": "^5.12.2",
34
34
  "@radix-ui/react-slot": "^1.0.2",
35
35
  "@tanstack/react-virtual": "^3.2.0"
@@ -43,5 +43,5 @@
43
43
  "rollup": "^4.12.1",
44
44
  "typescript": "^5.4.2"
45
45
  },
46
- "gitHead": "a1ead4651e04770749e1d74f98db0fc093d78a34"
46
+ "gitHead": "0006fe3820b071bb4b1e948263072af46cf2c604"
47
47
  }
@@ -1,6 +0,0 @@
1
- 'use client';
2
- 'use strict';
3
-
4
- var classes = {"button":"fds-button-button-8fa00f0f","small":"fds-button-small-8fa00f0f","medium":"fds-button-medium-8fa00f0f","large":"fds-button-large-8fa00f0f","fullWidth":"fds-button-fullWidth-8fa00f0f","secondary":"fds-button-secondary-8fa00f0f","tertiary":"fds-button-tertiary-8fa00f0f","onlyIcon":"fds-button-onlyIcon-8fa00f0f","primary":"fds-button-primary-8fa00f0f","first":"fds-button-first-8fa00f0f","second":"fds-button-second-8fa00f0f","success":"fds-button-success-8fa00f0f","danger":"fds-button-danger-8fa00f0f"};
5
-
6
- module.exports = classes;
@@ -1,6 +0,0 @@
1
- 'use client';
2
- 'use strict';
3
-
4
- var classes = {"skiplink":"fds-skiplink-skiplink-d4abeaef"};
5
-
6
- module.exports = classes;
@@ -1,6 +0,0 @@
1
- 'use client';
2
- 'use strict';
3
-
4
- const floor = Math.floor;
5
-
6
- exports.floor = floor;
@@ -1,68 +0,0 @@
1
- 'use client';
2
- 'use strict';
3
-
4
- function getNodeName(node) {
5
- if (isNode(node)) {
6
- return (node.nodeName || '').toLowerCase();
7
- }
8
- // Mocked nodes in testing environments may not be instances of Node. By
9
- // returning `#document` an infinite loop won't occur.
10
- // https://github.com/floating-ui/floating-ui/issues/2317
11
- return '#document';
12
- }
13
- function getWindow(node) {
14
- var _node$ownerDocument;
15
- return (node == null ? void 0 : (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
16
- }
17
- function getDocumentElement(node) {
18
- var _ref;
19
- return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement;
20
- }
21
- function isNode(value) {
22
- return value instanceof Node || value instanceof getWindow(value).Node;
23
- }
24
- function isElement(value) {
25
- return value instanceof Element || value instanceof getWindow(value).Element;
26
- }
27
- function isHTMLElement(value) {
28
- return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement;
29
- }
30
- function isShadowRoot(value) {
31
- // Browsers without `ShadowRoot` support.
32
- if (typeof ShadowRoot === 'undefined') {
33
- return false;
34
- }
35
- return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;
36
- }
37
- function isLastTraversableNode(node) {
38
- return ['html', 'body', '#document'].includes(getNodeName(node));
39
- }
40
- function getComputedStyle(element) {
41
- return getWindow(element).getComputedStyle(element);
42
- }
43
- function getParentNode(node) {
44
- if (getNodeName(node) === 'html') {
45
- return node;
46
- }
47
- const result =
48
- // Step into the shadow DOM of the parent of a slotted node.
49
- node.assignedSlot ||
50
- // DOM Element detected.
51
- node.parentNode ||
52
- // ShadowRoot detected.
53
- isShadowRoot(node) && node.host ||
54
- // Fallback.
55
- getDocumentElement(node);
56
- return isShadowRoot(result) ? result.host : result;
57
- }
58
-
59
- exports.getComputedStyle = getComputedStyle;
60
- exports.getDocumentElement = getDocumentElement;
61
- exports.getNodeName = getNodeName;
62
- exports.getParentNode = getParentNode;
63
- exports.getWindow = getWindow;
64
- exports.isElement = isElement;
65
- exports.isHTMLElement = isHTMLElement;
66
- exports.isLastTraversableNode = isLastTraversableNode;
67
- exports.isNode = isNode;
68
- exports.isShadowRoot = isShadowRoot;
@@ -1,4 +0,0 @@
1
- 'use client';
2
- var classes = {"button":"fds-button-button-8fa00f0f","small":"fds-button-small-8fa00f0f","medium":"fds-button-medium-8fa00f0f","large":"fds-button-large-8fa00f0f","fullWidth":"fds-button-fullWidth-8fa00f0f","secondary":"fds-button-secondary-8fa00f0f","tertiary":"fds-button-tertiary-8fa00f0f","onlyIcon":"fds-button-onlyIcon-8fa00f0f","primary":"fds-button-primary-8fa00f0f","first":"fds-button-first-8fa00f0f","second":"fds-button-second-8fa00f0f","success":"fds-button-success-8fa00f0f","danger":"fds-button-danger-8fa00f0f"};
3
-
4
- export { classes as default };
@@ -1,4 +0,0 @@
1
- 'use client';
2
- var classes = {"skiplink":"fds-skiplink-skiplink-d4abeaef"};
3
-
4
- export { classes as default };
@@ -1,4 +0,0 @@
1
- 'use client';
2
- const floor = Math.floor;
3
-
4
- export { floor };