@navikt/ds-react 6.7.0 → 6.7.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/chat/Chat.d.ts +2 -1
- package/cjs/chat/Chat.js +2 -1
- package/cjs/chat/Chat.js.map +1 -1
- package/cjs/date/datepicker/parts/DropdownCaption.js +1 -1
- package/cjs/date/datepicker/parts/DropdownCaption.js.map +1 -1
- package/cjs/date/monthpicker/MonthCaption.js +1 -1
- package/cjs/date/utils/labels.d.ts +2 -2
- package/cjs/form/ReadOnlyIcon.d.ts +2 -2
- package/cjs/form/combobox/Combobox.js +7 -22
- package/cjs/form/combobox/Combobox.js.map +1 -1
- package/cjs/form/combobox/ComboboxProvider.js +2 -2
- package/cjs/form/combobox/ComboboxProvider.js.map +1 -1
- package/cjs/form/combobox/ComboboxWrapper.d.ts +1 -2
- package/cjs/form/combobox/ComboboxWrapper.js +4 -2
- package/cjs/form/combobox/ComboboxWrapper.js.map +1 -1
- package/cjs/form/combobox/FilteredOptions/FilteredOptions.js +4 -4
- package/cjs/form/combobox/FilteredOptions/FilteredOptions.js.map +1 -1
- package/cjs/form/combobox/FilteredOptions/filteredOptionsContext.d.ts +4 -4
- package/cjs/form/combobox/FilteredOptions/filteredOptionsContext.js +13 -15
- package/cjs/form/combobox/FilteredOptions/filteredOptionsContext.js.map +1 -1
- package/cjs/form/combobox/Input/{inputContext.d.ts → Input.context.d.ts} +7 -5
- package/cjs/form/combobox/Input/{inputContext.js → Input.context.js} +22 -22
- package/cjs/form/combobox/Input/Input.context.js.map +1 -0
- package/cjs/form/combobox/Input/Input.js +2 -2
- package/cjs/form/combobox/Input/Input.js.map +1 -1
- package/cjs/form/combobox/Input/InputController.d.ts +3 -0
- package/cjs/form/combobox/Input/InputController.js +70 -0
- package/cjs/form/combobox/Input/InputController.js.map +1 -0
- package/cjs/form/combobox/{ToggleListButton.js → Input/ToggleListButton.js} +1 -1
- package/cjs/form/combobox/Input/ToggleListButton.js.map +1 -0
- package/cjs/form/combobox/SelectedOptions/SelectedOptions.js +2 -2
- package/cjs/form/combobox/SelectedOptions/SelectedOptions.js.map +1 -1
- package/cjs/form/combobox/SelectedOptions/selectedOptionsContext.d.ts +4 -4
- package/cjs/form/combobox/SelectedOptions/selectedOptionsContext.js +7 -13
- package/cjs/form/combobox/SelectedOptions/selectedOptionsContext.js.map +1 -1
- package/cjs/form/combobox/customOptionsContext.d.ts +4 -4
- package/cjs/form/combobox/customOptionsContext.js +10 -13
- package/cjs/form/combobox/customOptionsContext.js.map +1 -1
- package/cjs/form/combobox/types.d.ts +1 -1
- package/cjs/help-text/HelpTextIcon.d.ts +1 -1
- package/cjs/overlay/dismiss/DismissableLayer.d.ts +70 -0
- package/cjs/overlay/dismiss/DismissableLayer.js +253 -0
- package/cjs/overlay/dismiss/DismissableLayer.js.map +1 -0
- package/cjs/overlay/dismiss/util/dispatchCustomEvent.d.ts +50 -0
- package/cjs/overlay/dismiss/util/dispatchCustomEvent.js +65 -0
- package/cjs/overlay/dismiss/util/dispatchCustomEvent.js.map +1 -0
- package/cjs/overlay/dismiss/util/useEscapeKeydown.d.ts +1 -0
- package/cjs/overlay/dismiss/util/useEscapeKeydown.js +19 -0
- package/cjs/overlay/dismiss/util/useEscapeKeydown.js.map +1 -0
- package/cjs/overlay/dismiss/util/useFocusOutside.d.ts +8 -0
- package/cjs/overlay/dismiss/util/useFocusOutside.js +42 -0
- package/cjs/overlay/dismiss/util/useFocusOutside.js.map +1 -0
- package/cjs/overlay/dismiss/util/usePointerDownOutside.d.ts +10 -0
- package/cjs/overlay/dismiss/util/usePointerDownOutside.js +84 -0
- package/cjs/overlay/dismiss/util/usePointerDownOutside.js.map +1 -0
- package/cjs/overlays/floating/Floating.d.ts +53 -0
- package/cjs/overlays/floating/Floating.js +215 -0
- package/cjs/overlays/floating/Floating.js.map +1 -0
- package/cjs/overlays/floating/Floating.utils.d.ts +18 -0
- package/cjs/overlays/floating/Floating.utils.js +52 -0
- package/cjs/overlays/floating/Floating.utils.js.map +1 -0
- package/cjs/popover/Popover.js +13 -28
- package/cjs/popover/Popover.js.map +1 -1
- package/cjs/progress-bar/ProgressBar.d.ts +20 -8
- package/cjs/progress-bar/ProgressBar.js +19 -9
- package/cjs/progress-bar/ProgressBar.js.map +1 -1
- package/cjs/tabs/Tabs.context.d.ts +7 -3
- package/cjs/tabs/Tabs.context.js +1 -0
- package/cjs/tabs/Tabs.context.js.map +1 -1
- package/cjs/timeline/AxisLabels.d.ts +1 -1
- package/cjs/toggle-group/ToggleGroup.context.d.ts +7 -3
- package/cjs/toggle-group/ToggleGroup.context.js +1 -0
- package/cjs/toggle-group/ToggleGroup.context.js.map +1 -1
- package/cjs/util/hooks/descendants/useDescendant.d.ts +2 -2
- package/cjs/util/hooks/descendants/useDescendant.js +49 -52
- package/cjs/util/hooks/descendants/useDescendant.js.map +1 -1
- package/cjs/util/types/AsChild.d.ts +14 -0
- package/cjs/util/types/AsChild.js +3 -0
- package/cjs/util/types/AsChild.js.map +1 -0
- package/esm/chat/Chat.d.ts +2 -1
- package/esm/chat/Chat.js +1 -0
- package/esm/chat/Chat.js.map +1 -1
- package/esm/date/datepicker/parts/DropdownCaption.js +1 -1
- package/esm/date/datepicker/parts/DropdownCaption.js.map +1 -1
- package/esm/date/monthpicker/MonthCaption.js +1 -1
- package/esm/date/utils/labels.d.ts +2 -2
- package/esm/form/ReadOnlyIcon.d.ts +2 -2
- package/esm/form/combobox/Combobox.js +8 -23
- package/esm/form/combobox/Combobox.js.map +1 -1
- package/esm/form/combobox/ComboboxProvider.js +1 -1
- package/esm/form/combobox/ComboboxProvider.js.map +1 -1
- package/esm/form/combobox/ComboboxWrapper.d.ts +1 -2
- package/esm/form/combobox/ComboboxWrapper.js +4 -2
- package/esm/form/combobox/ComboboxWrapper.js.map +1 -1
- package/esm/form/combobox/FilteredOptions/FilteredOptions.js +3 -3
- package/esm/form/combobox/FilteredOptions/FilteredOptions.js.map +1 -1
- package/esm/form/combobox/FilteredOptions/filteredOptionsContext.d.ts +4 -4
- package/esm/form/combobox/FilteredOptions/filteredOptionsContext.js +15 -16
- package/esm/form/combobox/FilteredOptions/filteredOptionsContext.js.map +1 -1
- package/esm/form/combobox/Input/{inputContext.d.ts → Input.context.d.ts} +7 -5
- package/esm/form/combobox/Input/{inputContext.js → Input.context.js} +22 -21
- package/esm/form/combobox/Input/Input.context.js.map +1 -0
- package/esm/form/combobox/Input/Input.js +1 -1
- package/esm/form/combobox/Input/Input.js.map +1 -1
- package/esm/form/combobox/Input/InputController.d.ts +3 -0
- package/esm/form/combobox/Input/InputController.js +41 -0
- package/esm/form/combobox/Input/InputController.js.map +1 -0
- package/esm/form/combobox/{ToggleListButton.js → Input/ToggleListButton.js} +1 -1
- package/esm/form/combobox/Input/ToggleListButton.js.map +1 -0
- package/esm/form/combobox/SelectedOptions/SelectedOptions.js +1 -1
- package/esm/form/combobox/SelectedOptions/SelectedOptions.js.map +1 -1
- package/esm/form/combobox/SelectedOptions/selectedOptionsContext.d.ts +4 -4
- package/esm/form/combobox/SelectedOptions/selectedOptionsContext.js +9 -14
- package/esm/form/combobox/SelectedOptions/selectedOptionsContext.js.map +1 -1
- package/esm/form/combobox/customOptionsContext.d.ts +4 -4
- package/esm/form/combobox/customOptionsContext.js +10 -12
- package/esm/form/combobox/customOptionsContext.js.map +1 -1
- package/esm/form/combobox/types.d.ts +1 -1
- package/esm/help-text/HelpTextIcon.d.ts +1 -1
- package/esm/overlay/dismiss/DismissableLayer.d.ts +70 -0
- package/esm/overlay/dismiss/DismissableLayer.js +226 -0
- package/esm/overlay/dismiss/DismissableLayer.js.map +1 -0
- package/esm/overlay/dismiss/util/dispatchCustomEvent.d.ts +50 -0
- package/esm/overlay/dismiss/util/dispatchCustomEvent.js +58 -0
- package/esm/overlay/dismiss/util/dispatchCustomEvent.js.map +1 -0
- package/esm/overlay/dismiss/util/useEscapeKeydown.d.ts +1 -0
- package/esm/overlay/dismiss/util/useEscapeKeydown.js +15 -0
- package/esm/overlay/dismiss/util/useEscapeKeydown.js.map +1 -0
- package/esm/overlay/dismiss/util/useFocusOutside.d.ts +8 -0
- package/esm/overlay/dismiss/util/useFocusOutside.js +38 -0
- package/esm/overlay/dismiss/util/useFocusOutside.js.map +1 -0
- package/esm/overlay/dismiss/util/usePointerDownOutside.d.ts +10 -0
- package/esm/overlay/dismiss/util/usePointerDownOutside.js +80 -0
- package/esm/overlay/dismiss/util/usePointerDownOutside.js.map +1 -0
- package/esm/overlays/floating/Floating.d.ts +53 -0
- package/esm/overlays/floating/Floating.js +188 -0
- package/esm/overlays/floating/Floating.js.map +1 -0
- package/esm/overlays/floating/Floating.utils.d.ts +18 -0
- package/esm/overlays/floating/Floating.utils.js +48 -0
- package/esm/overlays/floating/Floating.utils.js.map +1 -0
- package/esm/popover/Popover.js +16 -31
- package/esm/popover/Popover.js.map +1 -1
- package/esm/progress-bar/ProgressBar.d.ts +20 -8
- package/esm/progress-bar/ProgressBar.js +20 -10
- package/esm/progress-bar/ProgressBar.js.map +1 -1
- package/esm/tabs/Tabs.context.d.ts +7 -3
- package/esm/tabs/Tabs.context.js +1 -0
- package/esm/tabs/Tabs.context.js.map +1 -1
- package/esm/timeline/AxisLabels.d.ts +1 -1
- package/esm/toggle-group/ToggleGroup.context.d.ts +7 -3
- package/esm/toggle-group/ToggleGroup.context.js +1 -0
- package/esm/toggle-group/ToggleGroup.context.js.map +1 -1
- package/esm/util/hooks/descendants/useDescendant.d.ts +2 -2
- package/esm/util/hooks/descendants/useDescendant.js +49 -52
- package/esm/util/hooks/descendants/useDescendant.js.map +1 -1
- package/esm/util/types/AsChild.d.ts +14 -0
- package/esm/util/types/AsChild.js +2 -0
- package/esm/util/types/AsChild.js.map +1 -0
- package/package.json +6 -5
- package/src/chat/Chat.tsx +2 -1
- package/src/date/datepicker/parts/DropdownCaption.tsx +5 -1
- package/src/date/monthpicker/MonthCaption.tsx +1 -1
- package/src/form/combobox/Combobox.tsx +6 -76
- package/src/form/combobox/ComboboxProvider.tsx +1 -1
- package/src/form/combobox/ComboboxWrapper.tsx +4 -3
- package/src/form/combobox/FilteredOptions/FilteredOptions.tsx +3 -3
- package/src/form/combobox/FilteredOptions/filteredOptionsContext.tsx +19 -29
- package/src/form/combobox/Input/{inputContext.tsx → Input.context.tsx} +30 -33
- package/src/form/combobox/Input/Input.tsx +1 -1
- package/src/form/combobox/Input/InputController.tsx +102 -0
- package/src/form/combobox/{ToggleListButton.tsx → Input/ToggleListButton.tsx} +1 -1
- package/src/form/combobox/SelectedOptions/SelectedOptions.tsx +1 -1
- package/src/form/combobox/SelectedOptions/selectedOptionsContext.tsx +12 -26
- package/src/form/combobox/{combobox-utils.test.ts → __tests__/combobox-utils.test.ts} +1 -1
- package/src/form/combobox/{combobox.test.tsx → __tests__/combobox.test.tsx} +2 -3
- package/src/form/combobox/customOptionsContext.tsx +14 -18
- package/src/form/combobox/types.ts +3 -1
- package/src/overlay/README.md +5 -0
- package/src/overlay/dismiss/DismissableLayer.tsx +368 -0
- package/src/overlay/dismiss/util/dispatchCustomEvent.ts +77 -0
- package/src/overlay/dismiss/util/useEscapeKeydown.ts +21 -0
- package/src/overlay/dismiss/util/useFocusOutside.ts +52 -0
- package/src/overlay/dismiss/util/usePointerDownOutside.ts +95 -0
- package/src/overlays/floating/Floating.tsx +399 -0
- package/src/overlays/floating/Floating.utils.ts +63 -0
- package/src/popover/Popover.tsx +38 -70
- package/src/progress-bar/ProgressBar.tsx +45 -20
- package/src/tabs/Tabs.context.ts +2 -0
- package/src/toggle-group/ToggleGroup.context.ts +1 -0
- package/src/util/hooks/descendants/useDescendant.tsx +55 -68
- package/src/util/types/AsChild.ts +15 -0
- package/cjs/form/combobox/ClearButton.d.ts +0 -7
- package/cjs/form/combobox/ClearButton.js +0 -28
- package/cjs/form/combobox/ClearButton.js.map +0 -1
- package/cjs/form/combobox/FilteredOptions/CheckIcon.d.ts +0 -3
- package/cjs/form/combobox/FilteredOptions/CheckIcon.js +0 -12
- package/cjs/form/combobox/FilteredOptions/CheckIcon.js.map +0 -1
- package/cjs/form/combobox/Input/inputContext.js.map +0 -1
- package/cjs/form/combobox/ToggleListButton.js.map +0 -1
- package/esm/form/combobox/ClearButton.d.ts +0 -7
- package/esm/form/combobox/ClearButton.js +0 -21
- package/esm/form/combobox/ClearButton.js.map +0 -1
- package/esm/form/combobox/FilteredOptions/CheckIcon.d.ts +0 -3
- package/esm/form/combobox/FilteredOptions/CheckIcon.js +0 -7
- package/esm/form/combobox/FilteredOptions/CheckIcon.js.map +0 -1
- package/esm/form/combobox/Input/inputContext.js.map +0 -1
- package/esm/form/combobox/ToggleListButton.js.map +0 -1
- package/src/form/combobox/ClearButton.tsx +0 -29
- package/src/form/combobox/FilteredOptions/CheckIcon.tsx +0 -23
- /package/cjs/form/combobox/{ToggleListButton.d.ts → Input/ToggleListButton.d.ts} +0 -0
- /package/esm/form/combobox/{ToggleListButton.d.ts → Input/ToggleListButton.d.ts} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import cl from "clsx";
|
|
2
|
-
import React, { HTMLAttributes, forwardRef } from "react";
|
|
2
|
+
import React, { HTMLAttributes, forwardRef, useRef } from "react";
|
|
3
3
|
|
|
4
4
|
interface ProgressBarPropsBase
|
|
5
5
|
extends Omit<HTMLAttributes<HTMLDivElement>, "role"> {
|
|
@@ -9,7 +9,7 @@ interface ProgressBarPropsBase
|
|
|
9
9
|
*/
|
|
10
10
|
size?: "large" | "medium" | "small";
|
|
11
11
|
/**
|
|
12
|
-
* Current progress.
|
|
12
|
+
* Current progress. If set, the `simulated` prop overrides `value`.
|
|
13
13
|
*/
|
|
14
14
|
value?: number;
|
|
15
15
|
/**
|
|
@@ -18,13 +18,20 @@ interface ProgressBarPropsBase
|
|
|
18
18
|
*/
|
|
19
19
|
valueMax?: number;
|
|
20
20
|
/**
|
|
21
|
-
*
|
|
22
|
-
* ProgressBar grows with a preset animation for
|
|
23
|
-
*
|
|
24
|
-
* A duration of 0 will show an indeterminate animation immediately.
|
|
25
|
-
* Temporary removed to avoid conflicts when updating API
|
|
21
|
+
* Visually simulates loading.
|
|
22
|
+
* ProgressBar grows with a preset animation for set number of seconds,
|
|
23
|
+
* then shows an indeterminate animation on timeout.
|
|
26
24
|
*/
|
|
27
|
-
|
|
25
|
+
simulated?: {
|
|
26
|
+
/**
|
|
27
|
+
* Duration in seconds.
|
|
28
|
+
*/
|
|
29
|
+
seconds: number;
|
|
30
|
+
/**
|
|
31
|
+
* Callback function when progress is indeterminate.
|
|
32
|
+
*/
|
|
33
|
+
onTimeout: () => void;
|
|
34
|
+
};
|
|
28
35
|
/**
|
|
29
36
|
* String ID of the element that labels the progress bar.
|
|
30
37
|
* Not needed if `aria-label` is used.
|
|
@@ -40,7 +47,7 @@ interface ProgressBarPropsBase
|
|
|
40
47
|
export type ProgressBarProps = ProgressBarPropsBase &
|
|
41
48
|
(
|
|
42
49
|
| {
|
|
43
|
-
"aria-hidden":
|
|
50
|
+
"aria-hidden": true;
|
|
44
51
|
}
|
|
45
52
|
| {
|
|
46
53
|
"aria-labelledby": string;
|
|
@@ -61,7 +68,11 @@ export type ProgressBarProps = ProgressBarPropsBase &
|
|
|
61
68
|
*
|
|
62
69
|
* @example
|
|
63
70
|
* // For loading content with an approximate duration in sec.
|
|
64
|
-
* <ProgressBar
|
|
71
|
+
* <ProgressBar simulated={{
|
|
72
|
+
* seconds: 30,
|
|
73
|
+
* onTimeout: () => console.log("Oops, this is taking more time than expected!")
|
|
74
|
+
* }}
|
|
75
|
+
* />
|
|
65
76
|
*
|
|
66
77
|
* @example
|
|
67
78
|
* // As a step indicator for forms, questionnaires, etc.
|
|
@@ -76,12 +87,24 @@ export const ProgressBar = forwardRef<HTMLDivElement, ProgressBarProps>(
|
|
|
76
87
|
"aria-labelledby": ariaLabelledBy,
|
|
77
88
|
"aria-label": ariaLabel,
|
|
78
89
|
className,
|
|
90
|
+
simulated,
|
|
79
91
|
...rest
|
|
80
92
|
},
|
|
81
93
|
ref,
|
|
82
94
|
) => {
|
|
83
95
|
const translate = 100 - (Math.round(value) / valueMax) * 100;
|
|
84
|
-
const
|
|
96
|
+
const onTimeoutRef = useRef<() => void>();
|
|
97
|
+
onTimeoutRef.current = simulated?.onTimeout;
|
|
98
|
+
|
|
99
|
+
React.useEffect(() => {
|
|
100
|
+
if (simulated?.seconds && onTimeoutRef.current) {
|
|
101
|
+
const timeout = setTimeout(
|
|
102
|
+
onTimeoutRef.current,
|
|
103
|
+
simulated.seconds * 1000,
|
|
104
|
+
);
|
|
105
|
+
return () => clearTimeout(timeout);
|
|
106
|
+
}
|
|
107
|
+
}, [simulated?.seconds]);
|
|
85
108
|
|
|
86
109
|
return (
|
|
87
110
|
<div
|
|
@@ -91,11 +114,11 @@ export const ProgressBar = forwardRef<HTMLDivElement, ProgressBarProps>(
|
|
|
91
114
|
`navds-progress-bar--${size}`,
|
|
92
115
|
className,
|
|
93
116
|
)}
|
|
94
|
-
aria-valuemax={
|
|
95
|
-
aria-valuenow={
|
|
117
|
+
aria-valuemax={simulated?.seconds ? 0 : Math.round(valueMax)}
|
|
118
|
+
aria-valuenow={simulated?.seconds ? 0 : Math.round(value)}
|
|
96
119
|
aria-valuetext={
|
|
97
|
-
|
|
98
|
-
?
|
|
120
|
+
simulated?.seconds
|
|
121
|
+
? `Fremdrift kan ikke beregnes, antatt tid er: ${simulated?.seconds} sekunder`
|
|
99
122
|
: `${Math.round(value)} av ${Math.round(valueMax)}`
|
|
100
123
|
}
|
|
101
124
|
role="progressbar"
|
|
@@ -105,14 +128,16 @@ export const ProgressBar = forwardRef<HTMLDivElement, ProgressBarProps>(
|
|
|
105
128
|
>
|
|
106
129
|
<div
|
|
107
130
|
className={cl("navds-progress-bar__foreground", {
|
|
108
|
-
"navds-progress-bar__foreground--indeterminate":
|
|
109
|
-
|
|
131
|
+
"navds-progress-bar__foreground--indeterminate": Number.isInteger(
|
|
132
|
+
simulated?.seconds,
|
|
133
|
+
),
|
|
110
134
|
})}
|
|
111
135
|
style={{
|
|
112
|
-
"--__ac-progress-bar-
|
|
113
|
-
|
|
136
|
+
"--__ac-progress-bar-simulated": Number.isInteger(
|
|
137
|
+
simulated?.seconds,
|
|
138
|
+
)
|
|
139
|
+
? `${simulated?.seconds}s`
|
|
114
140
|
: undefined,
|
|
115
|
-
"--__ac-progress-bar-delay": `${duration === 0 ? 0 : 4}s`,
|
|
116
141
|
"--__ac-progress-bar-translate": `-${translate}%`,
|
|
117
142
|
}}
|
|
118
143
|
/>
|
package/src/tabs/Tabs.context.ts
CHANGED
|
@@ -21,4 +21,6 @@ export const [TabsProvider, useTabsContext] = createContext<TabsProviderProps>({
|
|
|
21
21
|
name: "TabsContext",
|
|
22
22
|
hookName: "useTabsContext",
|
|
23
23
|
providerName: "TabsProvider",
|
|
24
|
+
errorMessage:
|
|
25
|
+
"Tabs.List, Tabs.Tag and Tabs.Panel needs to be wrapped within <Tabs>",
|
|
24
26
|
});
|
|
@@ -8,68 +8,6 @@ import { mergeRefs } from "../useMergeRefs";
|
|
|
8
8
|
import { DescendantOptions, DescendantsManager } from "./descendant";
|
|
9
9
|
import { cast } from "./utils";
|
|
10
10
|
|
|
11
|
-
/**
|
|
12
|
-
* @internal
|
|
13
|
-
* Initializing DescendantsManager
|
|
14
|
-
*/
|
|
15
|
-
function useDescendants<
|
|
16
|
-
T extends HTMLElement = HTMLElement,
|
|
17
|
-
K extends Record<string, any> = object,
|
|
18
|
-
>() {
|
|
19
|
-
const descendants = useRef(new DescendantsManager<T, K>()).current;
|
|
20
|
-
|
|
21
|
-
return descendants;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
const [DescendantsContextProvider, useDescendantsContext] = createContext<
|
|
25
|
-
ReturnType<typeof useDescendants>
|
|
26
|
-
>({
|
|
27
|
-
name: "DescendantsProvider",
|
|
28
|
-
errorMessage: "useDescendantsContext must be used within DescendantsProvider",
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* @internal
|
|
33
|
-
* This hook provides information to descendant component:
|
|
34
|
-
* - Index compared to other descendants
|
|
35
|
-
* - ref callback to register the descendant
|
|
36
|
-
* - Its enabled index compared to other enabled descendants
|
|
37
|
-
*/
|
|
38
|
-
function useDescendant<
|
|
39
|
-
T extends HTMLElement = HTMLElement,
|
|
40
|
-
K extends Record<string, any> = object,
|
|
41
|
-
>(options?: DescendantOptions<K>) {
|
|
42
|
-
const descendants = useDescendantsContext();
|
|
43
|
-
const [index, setIndex] = useState(-1);
|
|
44
|
-
const ref = useRef<T>(null);
|
|
45
|
-
|
|
46
|
-
useClientLayoutEffect(() => {
|
|
47
|
-
return () => {
|
|
48
|
-
if (!ref.current) return;
|
|
49
|
-
descendants.unregister(ref.current);
|
|
50
|
-
};
|
|
51
|
-
}, []);
|
|
52
|
-
|
|
53
|
-
useClientLayoutEffect(() => {
|
|
54
|
-
if (!ref.current) return;
|
|
55
|
-
const dataIndex = Number(ref.current.dataset["index"]);
|
|
56
|
-
if (index != dataIndex && !Number.isNaN(dataIndex)) {
|
|
57
|
-
setIndex(dataIndex);
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
const refCallback = options
|
|
62
|
-
? cast<React.RefCallback<T>>(descendants.register(options))
|
|
63
|
-
: cast<React.RefCallback<T>>(descendants.register);
|
|
64
|
-
|
|
65
|
-
return {
|
|
66
|
-
descendants,
|
|
67
|
-
index,
|
|
68
|
-
enabledIndex: descendants.enabledIndexOf(ref.current),
|
|
69
|
-
register: mergeRefs([refCallback, ref]),
|
|
70
|
-
};
|
|
71
|
-
}
|
|
72
|
-
|
|
73
11
|
/**
|
|
74
12
|
* Provides strongly typed versions of the context provider and hooks above.
|
|
75
13
|
*/
|
|
@@ -77,6 +15,14 @@ export function createDescendantContext<
|
|
|
77
15
|
T extends HTMLElement = HTMLElement,
|
|
78
16
|
K extends Record<string, any> = object,
|
|
79
17
|
>() {
|
|
18
|
+
const [DescendantsContextProvider, useDescendantsContext] = createContext<
|
|
19
|
+
ReturnType<typeof _useDescendants>
|
|
20
|
+
>({
|
|
21
|
+
name: "DescendantsProvider",
|
|
22
|
+
errorMessage:
|
|
23
|
+
"useDescendantsContext must be used within DescendantsProvider",
|
|
24
|
+
});
|
|
25
|
+
|
|
80
26
|
const ContextProvider = cast<React.Provider<DescendantsManager<T, K>>>(
|
|
81
27
|
(props) => (
|
|
82
28
|
<DescendantsContextProvider {...props.value}>
|
|
@@ -85,19 +31,60 @@ export function createDescendantContext<
|
|
|
85
31
|
),
|
|
86
32
|
);
|
|
87
33
|
|
|
88
|
-
|
|
89
|
-
|
|
34
|
+
/**
|
|
35
|
+
* @internal
|
|
36
|
+
* This hook provides information to descendant component:
|
|
37
|
+
* - Index compared to other descendants
|
|
38
|
+
* - ref callback to register the descendant
|
|
39
|
+
* - Its enabled index compared to other enabled descendants
|
|
40
|
+
*/
|
|
41
|
+
function _useDescendant(options?: DescendantOptions<K>) {
|
|
42
|
+
const descendants = useDescendantsContext();
|
|
43
|
+
const [index, setIndex] = useState(-1);
|
|
44
|
+
const ref = useRef<T>(null);
|
|
45
|
+
|
|
46
|
+
useClientLayoutEffect(() => {
|
|
47
|
+
return () => {
|
|
48
|
+
if (!ref.current) return;
|
|
49
|
+
descendants.unregister(ref.current);
|
|
50
|
+
};
|
|
51
|
+
}, []);
|
|
52
|
+
|
|
53
|
+
useClientLayoutEffect(() => {
|
|
54
|
+
if (!ref.current) return;
|
|
55
|
+
const dataIndex = Number(ref.current.dataset["index"]);
|
|
56
|
+
if (index != dataIndex && !Number.isNaN(dataIndex)) {
|
|
57
|
+
setIndex(dataIndex);
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
const refCallback = options
|
|
62
|
+
? cast<React.RefCallback<T>>(descendants.register(options))
|
|
63
|
+
: cast<React.RefCallback<T>>(descendants.register);
|
|
64
|
+
|
|
65
|
+
return {
|
|
66
|
+
descendants,
|
|
67
|
+
index,
|
|
68
|
+
enabledIndex: descendants.enabledIndexOf(ref.current),
|
|
69
|
+
register: mergeRefs([refCallback, ref]),
|
|
70
|
+
};
|
|
71
|
+
}
|
|
90
72
|
|
|
91
|
-
|
|
92
|
-
|
|
73
|
+
/**
|
|
74
|
+
* @internal
|
|
75
|
+
* Initializing DescendantsManager
|
|
76
|
+
*/
|
|
77
|
+
function _useDescendants() {
|
|
78
|
+
const descendants = useRef(new DescendantsManager<T, K>()).current;
|
|
93
79
|
|
|
94
|
-
|
|
80
|
+
return descendants;
|
|
81
|
+
}
|
|
95
82
|
|
|
96
83
|
return [
|
|
97
84
|
// context provider
|
|
98
85
|
ContextProvider,
|
|
99
86
|
// call this when you need to read from context
|
|
100
|
-
|
|
87
|
+
useDescendantsContext,
|
|
101
88
|
// descendants state information, to be called and passed to `ContextProvider`
|
|
102
89
|
_useDescendants,
|
|
103
90
|
// descendant index information
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export type AsChild =
|
|
2
|
+
| {
|
|
3
|
+
children: React.ReactElement;
|
|
4
|
+
/**
|
|
5
|
+
* Renders the children as a child of the component. Merges the props of the component with the props of the child.
|
|
6
|
+
*/
|
|
7
|
+
asChild: true;
|
|
8
|
+
}
|
|
9
|
+
| {
|
|
10
|
+
children: React.ReactNode;
|
|
11
|
+
/**
|
|
12
|
+
* Renders the children as a child of the component. Merges the props of the component with the props of the child.
|
|
13
|
+
*/
|
|
14
|
+
asChild?: false;
|
|
15
|
+
};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
interface ClearButtonProps extends React.HTMLAttributes<HTMLButtonElement> {
|
|
3
|
-
handleClear: (event: any) => void;
|
|
4
|
-
clearButtonLabel?: string;
|
|
5
|
-
}
|
|
6
|
-
export declare const ClearButton: React.FC<ClearButtonProps>;
|
|
7
|
-
export default ClearButton;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
-
var t = {};
|
|
4
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
-
t[p] = s[p];
|
|
6
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
-
t[p[i]] = s[p[i]];
|
|
10
|
-
}
|
|
11
|
-
return t;
|
|
12
|
-
};
|
|
13
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.ClearButton = void 0;
|
|
18
|
-
const react_1 = __importDefault(require("react"));
|
|
19
|
-
const aksel_icons_1 = require("@navikt/aksel-icons");
|
|
20
|
-
const ClearButton = (_a) => {
|
|
21
|
-
var { handleClear, clearButtonLabel } = _a, rest = __rest(_a, ["handleClear", "clearButtonLabel"]);
|
|
22
|
-
return (react_1.default.createElement("button", Object.assign({ type: "button", onClick: handleClear, className: "navds-combobox__button-clear" }, rest),
|
|
23
|
-
react_1.default.createElement("span", { className: "navds-sr-only" }, clearButtonLabel ? clearButtonLabel : "Tøm"),
|
|
24
|
-
react_1.default.createElement(aksel_icons_1.XMarkIcon, { "aria-hidden": true })));
|
|
25
|
-
};
|
|
26
|
-
exports.ClearButton = ClearButton;
|
|
27
|
-
exports.default = exports.ClearButton;
|
|
28
|
-
//# sourceMappingURL=ClearButton.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ClearButton.js","sourceRoot":"","sources":["../../../src/form/combobox/ClearButton.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,kDAA0B;AAC1B,qDAAgD;AAOzC,MAAM,WAAW,GAA+B,CAAC,EAIvD,EAAE,EAAE;QAJmD,EACtD,WAAW,EACX,gBAAgB,OAEjB,EADI,IAAI,cAH+C,mCAIvD,CADQ;IAEP,OAAO,CACL,wDACE,IAAI,EAAC,QAAQ,EACb,OAAO,EAAE,WAAW,EACpB,SAAS,EAAC,8BAA8B,IACpC,IAAI;QAER,wCAAM,SAAS,EAAC,eAAe,IAC5B,gBAAgB,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,KAAK,CACvC;QACP,8BAAC,uBAAS,0BAAe,CAClB,CACV,CAAC;AACJ,CAAC,CAAC;AAlBW,QAAA,WAAW,eAkBtB;AAEF,kBAAe,mBAAW,CAAC"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const react_1 = __importDefault(require("react"));
|
|
7
|
-
const CheckIcon = () => {
|
|
8
|
-
return (react_1.default.createElement("svg", { width: "16", height: "13", viewBox: "0 0 16 13", fill: "none", xmlns: "http://www.w3.org/2000/svg", "aria-hidden": "true" },
|
|
9
|
-
react_1.default.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", fill: "#005B82", d: "M14.2014 0L16 1.89047L4.77943 13L0 8.39552L1.79361 6.5L4.77418 9.3019L14.2014 0Z" })));
|
|
10
|
-
};
|
|
11
|
-
exports.default = CheckIcon;
|
|
12
|
-
//# sourceMappingURL=CheckIcon.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CheckIcon.js","sourceRoot":"","sources":["../../../../src/form/combobox/FilteredOptions/CheckIcon.tsx"],"names":[],"mappings":";;;;;AAAA,kDAA0B;AAE1B,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,OAAO,CACL,uCACE,KAAK,EAAC,IAAI,EACV,MAAM,EAAC,IAAI,EACX,OAAO,EAAC,WAAW,EACnB,IAAI,EAAC,MAAM,EACX,KAAK,EAAC,4BAA4B,iBACtB,MAAM;QAElB,wCACE,QAAQ,EAAC,SAAS,EAClB,QAAQ,EAAC,SAAS,EAClB,IAAI,EAAC,SAAS,EACd,CAAC,EAAC,kFAAkF,GACpF,CACE,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAe,SAAS,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"inputContext.js","sourceRoot":"","sources":["../../../../src/form/combobox/Input/inputContext.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CASe;AACf,+CAA4D;AAC5D,qDAAiE;AAejE,MAAM,YAAY,GAAG,IAAA,qBAAa,EAAmB,EAAsB,CAAC,CAAC;AAEtE,MAAM,oBAAoB,GAAG,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,EAAE;IACjE,MAAM,EACJ,YAAY,GAAG,EAAE,EACjB,WAAW,EACX,QAAQ,EACR,KAAK,EACL,OAAO,EACP,EAAE,EAAE,UAAU,EACd,KAAK,EAAE,aAAa,EACpB,QAAQ,EAAE,gBAAgB,EAC1B,OAAO,EACP,kBAAkB,EAClB,IAAI,GACL,GAAG,KAAK,CAAC;IACV,MAAM,cAAc,GAAG,IAAA,2BAAY,EACjC;QACE,WAAW;QACX,QAAQ;QACR,KAAK;QACL,OAAO;QACP,EAAE,EAAE,UAAU;QACd,IAAI;KACL,EACD,eAAe,CAChB,CAAC;IACF,MAAM,QAAQ,GAAG,IAAA,cAAM,EAA0B,IAAI,CAAC,CAAC;IACvD,MAAM,CAAC,aAAa,EAAE,gBAAgB,CAAC,GAAG,IAAA,gBAAQ,EAAS,YAAY,CAAC,CAAC;IAEzE,MAAM,KAAK,GAAG,IAAA,eAAO,EACnB,GAAG,EAAE,CAAC,MAAM,CAAC,aAAa,aAAb,aAAa,cAAb,aAAa,GAAI,aAAa,CAAC,EAC5C,CAAC,aAAa,EAAE,aAAa,CAA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rC,SAAS,EAAE,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC,GAAG,KAAK,OAAO,IAAI,gBAAgB,EAAE,EAC7D,SAAS,EAAC,oCAAoC,mBAC/B,UAAU,EACzB,QAAQ,EAAE,CAAC,CAAC,EACZ,GAAG,EAAE,GAAG;QAER,wCAAM,SAAS,EAAC,eAAe,IAC5B,qBAAqB,aAArB,qBAAqB,cAArB,qBAAqB,GAAI,cAAc,CACnC;QACN,UAAU,CAAC,CAAC,CAAC,CACZ,8BAAC,2BAAa,0BAAe,CAC9B,CAAC,CAAC,CAAC,CACF,8BAAC,6BAAe,0BAAe,CAChC,CACM,CACV,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,kBAAe,wBAAgB,CAAC"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
interface ClearButtonProps extends React.HTMLAttributes<HTMLButtonElement> {
|
|
3
|
-
handleClear: (event: any) => void;
|
|
4
|
-
clearButtonLabel?: string;
|
|
5
|
-
}
|
|
6
|
-
export declare const ClearButton: React.FC<ClearButtonProps>;
|
|
7
|
-
export default ClearButton;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
-
var t = {};
|
|
3
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
-
t[p] = s[p];
|
|
5
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
-
t[p[i]] = s[p[i]];
|
|
9
|
-
}
|
|
10
|
-
return t;
|
|
11
|
-
};
|
|
12
|
-
import React from "react";
|
|
13
|
-
import { XMarkIcon } from "@navikt/aksel-icons";
|
|
14
|
-
export const ClearButton = (_a) => {
|
|
15
|
-
var { handleClear, clearButtonLabel } = _a, rest = __rest(_a, ["handleClear", "clearButtonLabel"]);
|
|
16
|
-
return (React.createElement("button", Object.assign({ type: "button", onClick: handleClear, className: "navds-combobox__button-clear" }, rest),
|
|
17
|
-
React.createElement("span", { className: "navds-sr-only" }, clearButtonLabel ? clearButtonLabel : "Tøm"),
|
|
18
|
-
React.createElement(XMarkIcon, { "aria-hidden": true })));
|
|
19
|
-
};
|
|
20
|
-
export default ClearButton;
|
|
21
|
-
//# sourceMappingURL=ClearButton.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ClearButton.js","sourceRoot":"","sources":["../../../src/form/combobox/ClearButton.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAOhD,MAAM,CAAC,MAAM,WAAW,GAA+B,CAAC,EAIvD,EAAE,EAAE;QAJmD,EACtD,WAAW,EACX,gBAAgB,OAEjB,EADI,IAAI,cAH+C,mCAIvD,CADQ;IAEP,OAAO,CACL,8CACE,IAAI,EAAC,QAAQ,EACb,OAAO,EAAE,WAAW,EACpB,SAAS,EAAC,8BAA8B,IACpC,IAAI;QAER,8BAAM,SAAS,EAAC,eAAe,IAC5B,gBAAgB,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,KAAK,CACvC;QACP,oBAAC,SAAS,0BAAe,CAClB,CACV,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,WAAW,CAAC"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
const CheckIcon = () => {
|
|
3
|
-
return (React.createElement("svg", { width: "16", height: "13", viewBox: "0 0 16 13", fill: "none", xmlns: "http://www.w3.org/2000/svg", "aria-hidden": "true" },
|
|
4
|
-
React.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", fill: "#005B82", d: "M14.2014 0L16 1.89047L4.77943 13L0 8.39552L1.79361 6.5L4.77418 9.3019L14.2014 0Z" })));
|
|
5
|
-
};
|
|
6
|
-
export default CheckIcon;
|
|
7
|
-
//# sourceMappingURL=CheckIcon.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CheckIcon.js","sourceRoot":"","sources":["../../../../src/form/combobox/FilteredOptions/CheckIcon.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,OAAO,CACL,6BACE,KAAK,EAAC,IAAI,EACV,MAAM,EAAC,IAAI,EACX,OAAO,EAAC,WAAW,EACnB,IAAI,EAAC,MAAM,EACX,KAAK,EAAC,4BAA4B,iBACtB,MAAM;QAElB,8BACE,QAAQ,EAAC,SAAS,EAClB,QAAQ,EAAC,SAAS,EAClB,IAAI,EAAC,SAAS,EACd,CAAC,EAAC,kFAAkF,GACpF,CACE,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,SAAS,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"inputContext.js","sourceRoot":"","sources":["../../../../src/form/combobox/Input/inputContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAGZ,aAAa,EACb,WAAW,EACX,UAAU,EACV,OAAO,EACP,MAAM,EACN,QAAQ,GACT,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,EAAiB,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAejE,MAAM,YAAY,GAAG,aAAa,CAAmB,EAAsB,CAAC,CAAC;AAE7E,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,EAAE;IACjE,MAAM,EACJ,YAAY,GAAG,EAAE,EACjB,WAAW,EACX,QAAQ,EACR,KAAK,EACL,OAAO,EACP,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
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ToggleListButton.js","sourceRoot":"","sources":["../../../src/form/combobox/ToggleListButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACrE,OAAO,EAAE,yBAAyB,EAAE,MAAM,0CAA0C,CAAC;AAMrF,MAAM,CAAC,MAAM,gBAAgB,GAAG,UAAU,CAGxC,CAAC,EAAE,qBAAqB,EAAE,EAAE,GAAG,EAAE,EAAE;IACnC,MAAM,EAAE,UAAU,EAAE,gBAAgB,EAAE,GAAG,yBAAyB,EAAE,CAAC;IACrE,OAAO,CACL,gCACE,IAAI,EAAC,QAAQ,EACb,WAAW,EAAE,GAAG,EAAE,CAAC,gBAAgB,EAAE,EACrC,SAAS,EAAE,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC,GAAG,KAAK,OAAO,IAAI,gBAAgB,EAAE,EAC7D,SAAS,EAAC,oCAAoC,mBAC/B,UAAU,EACzB,QAAQ,EAAE,CAAC,CAAC,EACZ,GAAG,EAAE,GAAG;QAER,8BAAM,SAAS,EAAC,eAAe,IAC5B,qBAAqB,aAArB,qBAAqB,cAArB,qBAAqB,GAAI,cAAc,CACnC;QACN,UAAU,CAAC,CAAC,CAAC,CACZ,oBAAC,aAAa,0BAAe,CAC9B,CAAC,CAAC,CAAC,CACF,oBAAC,eAAe,0BAAe,CAChC,CACM,CACV,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,gBAAgB,CAAC"}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { XMarkIcon } from "@navikt/aksel-icons";
|
|
3
|
-
|
|
4
|
-
interface ClearButtonProps extends React.HTMLAttributes<HTMLButtonElement> {
|
|
5
|
-
handleClear: (event: any) => void;
|
|
6
|
-
clearButtonLabel?: string;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export const ClearButton: React.FC<ClearButtonProps> = ({
|
|
10
|
-
handleClear,
|
|
11
|
-
clearButtonLabel,
|
|
12
|
-
...rest
|
|
13
|
-
}) => {
|
|
14
|
-
return (
|
|
15
|
-
<button
|
|
16
|
-
type="button"
|
|
17
|
-
onClick={handleClear}
|
|
18
|
-
className="navds-combobox__button-clear"
|
|
19
|
-
{...rest}
|
|
20
|
-
>
|
|
21
|
-
<span className="navds-sr-only">
|
|
22
|
-
{clearButtonLabel ? clearButtonLabel : "Tøm"}
|
|
23
|
-
</span>
|
|
24
|
-
<XMarkIcon aria-hidden />
|
|
25
|
-
</button>
|
|
26
|
-
);
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
export default ClearButton;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
|
|
3
|
-
const CheckIcon = () => {
|
|
4
|
-
return (
|
|
5
|
-
<svg
|
|
6
|
-
width="16"
|
|
7
|
-
height="13"
|
|
8
|
-
viewBox="0 0 16 13"
|
|
9
|
-
fill="none"
|
|
10
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
11
|
-
aria-hidden="true"
|
|
12
|
-
>
|
|
13
|
-
<path
|
|
14
|
-
fillRule="evenodd"
|
|
15
|
-
clipRule="evenodd"
|
|
16
|
-
fill="#005B82"
|
|
17
|
-
d="M14.2014 0L16 1.89047L4.77943 13L0 8.39552L1.79361 6.5L4.77418 9.3019L14.2014 0Z"
|
|
18
|
-
/>
|
|
19
|
-
</svg>
|
|
20
|
-
);
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
export default CheckIcon;
|
|
File without changes
|
|
File without changes
|