@navikt/ds-react 8.8.0 → 8.9.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.
- package/cjs/data/drag-and-drop/drag-handler/DragAndDropDragHandler.d.ts +12 -0
- package/cjs/data/drag-and-drop/drag-handler/DragAndDropDragHandler.js +57 -0
- package/cjs/data/drag-and-drop/drag-handler/DragAndDropDragHandler.js.map +1 -0
- package/cjs/data/drag-and-drop/item/DragAndDropItem.d.ts +27 -0
- package/cjs/data/drag-and-drop/item/DragAndDropItem.js +52 -0
- package/cjs/data/drag-and-drop/item/DragAndDropItem.js.map +1 -0
- package/cjs/data/drag-and-drop/root/DragAndDrop.context.d.ts +16 -0
- package/cjs/data/drag-and-drop/root/DragAndDrop.context.js +10 -0
- package/cjs/data/drag-and-drop/root/DragAndDrop.context.js.map +1 -0
- package/cjs/data/drag-and-drop/root/{DataDragAndDropRoot.d.ts → DragAndDropRoot.d.ts} +11 -9
- package/cjs/data/drag-and-drop/root/DragAndDropRoot.js +187 -0
- package/cjs/data/drag-and-drop/root/DragAndDropRoot.js.map +1 -0
- package/cjs/data/drag-and-drop/types.d.ts +4 -0
- package/cjs/data/drag-and-drop/types.js +3 -0
- package/cjs/data/drag-and-drop/types.js.map +1 -0
- package/cjs/data/table/helpers/selection/getMultipleSelectProps.d.ts +14 -0
- package/cjs/data/table/helpers/selection/getMultipleSelectProps.js +48 -0
- package/cjs/data/table/helpers/selection/getMultipleSelectProps.js.map +1 -0
- package/cjs/data/table/helpers/selection/getSingleSelectProps.d.ts +10 -0
- package/cjs/data/table/helpers/selection/getSingleSelectProps.js +23 -0
- package/cjs/data/table/helpers/selection/getSingleSelectProps.js.map +1 -0
- package/cjs/data/table/helpers/selection/selection.types.d.ts +42 -0
- package/cjs/data/table/helpers/selection/selection.types.js +3 -0
- package/cjs/data/table/helpers/selection/selection.types.js.map +1 -0
- package/cjs/data/table/{root → hooks}/useTableKeyboardNav.js +1 -1
- package/cjs/data/table/hooks/useTableKeyboardNav.js.map +1 -0
- package/cjs/data/table/hooks/useTableSelection.d.ts +8 -0
- package/cjs/data/table/hooks/useTableSelection.js +49 -0
- package/cjs/data/table/hooks/useTableSelection.js.map +1 -0
- package/cjs/data/table/root/DataTableAuto.d.ts +4 -4
- package/cjs/data/table/root/DataTableAuto.js +24 -10
- package/cjs/data/table/root/DataTableAuto.js.map +1 -1
- package/cjs/data/table/root/DataTableRoot.d.ts +1 -1
- package/cjs/data/table/root/DataTableRoot.js +1 -1
- package/cjs/data/table/root/DataTableRoot.js.map +1 -1
- package/cjs/data/token-filter/AutoSuggest.js +37 -4
- package/cjs/data/token-filter/AutoSuggest.js.map +1 -1
- package/cjs/data/token-filter/TokenFilter.d.ts +1 -0
- package/cjs/data/token-filter/TokenFilter.js +1 -0
- package/cjs/data/token-filter/TokenFilter.js.map +1 -1
- package/cjs/data/toolbar/root/DataToolbarRoot.d.ts +6 -23
- package/cjs/data/toolbar/root/DataToolbarRoot.js +42 -7
- package/cjs/data/toolbar/root/DataToolbarRoot.js.map +1 -1
- package/cjs/date/Date.Input.js +8 -9
- package/cjs/date/Date.Input.js.map +1 -1
- package/cjs/date/datepicker/hooks/useDatepicker.js +4 -3
- package/cjs/date/datepicker/hooks/useDatepicker.js.map +1 -1
- package/cjs/date/monthpicker/hooks/useMonthPicker.js +3 -2
- package/cjs/date/monthpicker/hooks/useMonthPicker.js.map +1 -1
- package/cjs/internal-header/InternalHeaderButton.d.ts +5 -0
- package/cjs/internal-header/InternalHeaderButton.js +2 -2
- package/cjs/internal-header/InternalHeaderButton.js.map +1 -1
- package/cjs/utils/components/Listbox/group/ListboxGroup.js +2 -1
- package/cjs/utils/components/Listbox/group/ListboxGroup.js.map +1 -1
- package/esm/data/drag-and-drop/drag-handler/DragAndDropDragHandler.d.ts +12 -0
- package/esm/data/drag-and-drop/drag-handler/DragAndDropDragHandler.js +51 -0
- package/esm/data/drag-and-drop/drag-handler/DragAndDropDragHandler.js.map +1 -0
- package/esm/data/drag-and-drop/item/DragAndDropItem.d.ts +27 -0
- package/esm/data/drag-and-drop/item/DragAndDropItem.js +46 -0
- package/esm/data/drag-and-drop/item/DragAndDropItem.js.map +1 -0
- package/esm/data/drag-and-drop/root/DragAndDrop.context.d.ts +16 -0
- package/esm/data/drag-and-drop/root/DragAndDrop.context.js +6 -0
- package/esm/data/drag-and-drop/root/DragAndDrop.context.js.map +1 -0
- package/esm/data/drag-and-drop/root/{DataDragAndDropRoot.d.ts → DragAndDropRoot.d.ts} +11 -9
- package/esm/data/drag-and-drop/root/DragAndDropRoot.js +147 -0
- package/esm/data/drag-and-drop/root/DragAndDropRoot.js.map +1 -0
- package/esm/data/drag-and-drop/types.d.ts +4 -0
- package/esm/data/drag-and-drop/types.js +2 -0
- package/esm/data/drag-and-drop/types.js.map +1 -0
- package/esm/data/table/helpers/selection/getMultipleSelectProps.d.ts +14 -0
- package/esm/data/table/helpers/selection/getMultipleSelectProps.js +46 -0
- package/esm/data/table/helpers/selection/getMultipleSelectProps.js.map +1 -0
- package/esm/data/table/helpers/selection/getSingleSelectProps.d.ts +10 -0
- package/esm/data/table/helpers/selection/getSingleSelectProps.js +21 -0
- package/esm/data/table/helpers/selection/getSingleSelectProps.js.map +1 -0
- package/esm/data/table/helpers/selection/selection.types.d.ts +42 -0
- package/esm/data/table/helpers/selection/selection.types.js +2 -0
- package/esm/data/table/helpers/selection/selection.types.js.map +1 -0
- package/esm/data/table/{root → hooks}/useTableKeyboardNav.js +1 -1
- package/esm/data/table/hooks/useTableKeyboardNav.js.map +1 -0
- package/esm/data/table/hooks/useTableSelection.d.ts +8 -0
- package/esm/data/table/hooks/useTableSelection.js +47 -0
- package/esm/data/table/hooks/useTableSelection.js.map +1 -0
- package/esm/data/table/root/DataTableAuto.d.ts +4 -4
- package/esm/data/table/root/DataTableAuto.js +24 -10
- package/esm/data/table/root/DataTableAuto.js.map +1 -1
- package/esm/data/table/root/DataTableRoot.d.ts +1 -1
- package/esm/data/table/root/DataTableRoot.js +1 -1
- package/esm/data/table/root/DataTableRoot.js.map +1 -1
- package/esm/data/token-filter/AutoSuggest.js +38 -5
- package/esm/data/token-filter/AutoSuggest.js.map +1 -1
- package/esm/data/token-filter/TokenFilter.d.ts +1 -0
- package/esm/data/token-filter/TokenFilter.js +1 -0
- package/esm/data/token-filter/TokenFilter.js.map +1 -1
- package/esm/data/toolbar/root/DataToolbarRoot.d.ts +6 -23
- package/esm/data/toolbar/root/DataToolbarRoot.js +9 -7
- package/esm/data/toolbar/root/DataToolbarRoot.js.map +1 -1
- package/esm/date/Date.Input.js +9 -10
- package/esm/date/Date.Input.js.map +1 -1
- package/esm/date/datepicker/hooks/useDatepicker.js +4 -3
- package/esm/date/datepicker/hooks/useDatepicker.js.map +1 -1
- package/esm/date/monthpicker/hooks/useMonthPicker.js +3 -2
- package/esm/date/monthpicker/hooks/useMonthPicker.js.map +1 -1
- package/esm/internal-header/InternalHeaderButton.d.ts +5 -0
- package/esm/internal-header/InternalHeaderButton.js +2 -2
- package/esm/internal-header/InternalHeaderButton.js.map +1 -1
- package/esm/utils/components/Listbox/group/ListboxGroup.js +2 -1
- package/esm/utils/components/Listbox/group/ListboxGroup.js.map +1 -1
- package/package.json +4 -4
- package/src/data/drag-and-drop/drag-handler/DragAndDropDragHandler.tsx +90 -0
- package/src/data/drag-and-drop/item/DragAndDropItem.tsx +71 -0
- package/src/data/drag-and-drop/root/DragAndDrop.context.tsx +25 -0
- package/src/data/drag-and-drop/root/DragAndDropRoot.tsx +245 -0
- package/src/data/drag-and-drop/types.ts +4 -0
- package/src/data/table/helpers/selection/getMultipleSelectProps.ts +70 -0
- package/src/data/table/helpers/selection/getSingleSelectProps.ts +33 -0
- package/src/data/table/helpers/selection/selection.types.ts +56 -0
- package/src/data/table/hooks/__tests__/useTableSelection.test.ts +327 -0
- package/src/data/table/{root → hooks}/useTableKeyboardNav.ts +1 -1
- package/src/data/table/hooks/useTableSelection.ts +78 -0
- package/src/data/table/root/DataTableAuto.tsx +46 -23
- package/src/data/table/root/DataTableRoot.tsx +2 -2
- package/src/data/token-filter/AutoSuggest.tsx +65 -3
- package/src/data/token-filter/TokenFilter.tsx +1 -0
- package/src/data/toolbar/root/DataToolbarRoot.tsx +29 -32
- package/src/date/Date.Input.tsx +17 -16
- package/src/date/datepicker/hooks/useDatepicker.tsx +4 -5
- package/src/date/monthpicker/hooks/useMonthPicker.tsx +3 -4
- package/src/internal-header/InternalHeaderButton.tsx +18 -9
- package/src/utils/components/Listbox/group/ListboxGroup.tsx +9 -2
- package/cjs/data/action-bar/root/DataActionBarRoot.d.ts +0 -27
- package/cjs/data/action-bar/root/DataActionBarRoot.js +0 -49
- package/cjs/data/action-bar/root/DataActionBarRoot.js.map +0 -1
- package/cjs/data/drag-and-drop/drag-handler/DataDragAndDropDragHandler.d.ts +0 -21
- package/cjs/data/drag-and-drop/drag-handler/DataDragAndDropDragHandler.js +0 -24
- package/cjs/data/drag-and-drop/drag-handler/DataDragAndDropDragHandler.js.map +0 -1
- package/cjs/data/drag-and-drop/item/DataDragAndDropItem.d.ts +0 -27
- package/cjs/data/drag-and-drop/item/DataDragAndDropItem.js +0 -41
- package/cjs/data/drag-and-drop/item/DataDragAndDropItem.js.map +0 -1
- package/cjs/data/drag-and-drop/root/DataDragAndDrop.context.d.ts +0 -8
- package/cjs/data/drag-and-drop/root/DataDragAndDrop.context.js +0 -10
- package/cjs/data/drag-and-drop/root/DataDragAndDrop.context.js.map +0 -1
- package/cjs/data/drag-and-drop/root/DataDragAndDropRoot.js +0 -61
- package/cjs/data/drag-and-drop/root/DataDragAndDropRoot.js.map +0 -1
- package/cjs/data/table/root/useTableKeyboardNav.js.map +0 -1
- package/cjs/data/table/root/useTableSelection.d.ts +0 -55
- package/cjs/data/table/root/useTableSelection.js +0 -79
- package/cjs/data/table/root/useTableSelection.js.map +0 -1
- package/esm/data/action-bar/root/DataActionBarRoot.d.ts +0 -27
- package/esm/data/action-bar/root/DataActionBarRoot.js +0 -43
- package/esm/data/action-bar/root/DataActionBarRoot.js.map +0 -1
- package/esm/data/drag-and-drop/drag-handler/DataDragAndDropDragHandler.d.ts +0 -21
- package/esm/data/drag-and-drop/drag-handler/DataDragAndDropDragHandler.js +0 -18
- package/esm/data/drag-and-drop/drag-handler/DataDragAndDropDragHandler.js.map +0 -1
- package/esm/data/drag-and-drop/item/DataDragAndDropItem.d.ts +0 -27
- package/esm/data/drag-and-drop/item/DataDragAndDropItem.js +0 -35
- package/esm/data/drag-and-drop/item/DataDragAndDropItem.js.map +0 -1
- package/esm/data/drag-and-drop/root/DataDragAndDrop.context.d.ts +0 -8
- package/esm/data/drag-and-drop/root/DataDragAndDrop.context.js +0 -6
- package/esm/data/drag-and-drop/root/DataDragAndDrop.context.js.map +0 -1
- package/esm/data/drag-and-drop/root/DataDragAndDropRoot.js +0 -21
- package/esm/data/drag-and-drop/root/DataDragAndDropRoot.js.map +0 -1
- package/esm/data/table/root/useTableKeyboardNav.js.map +0 -1
- package/esm/data/table/root/useTableSelection.d.ts +0 -55
- package/esm/data/table/root/useTableSelection.js +0 -77
- package/esm/data/table/root/useTableSelection.js.map +0 -1
- package/src/data/action-bar/root/DataActionBarRoot.tsx +0 -59
- package/src/data/drag-and-drop/drag-handler/DataDragAndDropDragHandler.tsx +0 -63
- package/src/data/drag-and-drop/item/DataDragAndDropItem.tsx +0 -54
- package/src/data/drag-and-drop/root/DataDragAndDrop.context.tsx +0 -14
- package/src/data/drag-and-drop/root/DataDragAndDropRoot.tsx +0 -54
- package/src/data/table/root/useTableSelection.ts +0 -126
- /package/cjs/data/table/{root → hooks}/useTableKeyboardNav.d.ts +0 -0
- /package/esm/data/table/{root → hooks}/useTableKeyboardNav.d.ts +0 -0
|
@@ -9,6 +9,8 @@ import {
|
|
|
9
9
|
DataTableEmptyState,
|
|
10
10
|
type DataTableEmptyStateProps,
|
|
11
11
|
} from "../empty-state/DataTableEmptyState";
|
|
12
|
+
import { useTableKeyboardNav } from "../hooks/useTableKeyboardNav";
|
|
13
|
+
import { type SelectionProps } from "../hooks/useTableSelection";
|
|
12
14
|
import {
|
|
13
15
|
DataTableLoadingState,
|
|
14
16
|
type DataTableLoadingStateProps,
|
|
@@ -29,8 +31,6 @@ import {
|
|
|
29
31
|
} from "../thead/DataTableThead";
|
|
30
32
|
import { DataTableTr, type DataTableTrProps } from "../tr/DataTableTr";
|
|
31
33
|
import { DataTableContextProvider } from "./DataTableRoot.context";
|
|
32
|
-
import { useTableKeyboardNav } from "./useTableKeyboardNav";
|
|
33
|
-
import { type SelectionProps } from "./useTableSelection";
|
|
34
34
|
|
|
35
35
|
interface DataTableProps
|
|
36
36
|
extends React.HTMLAttributes<HTMLTableElement>, SelectionProps {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import React, { forwardRef, useState } from "react";
|
|
1
|
+
import React, { type JSX, forwardRef, useState } from "react";
|
|
2
2
|
import { Search } from "../../form/search";
|
|
3
3
|
import { VStack } from "../../primitives/stack";
|
|
4
|
-
import {
|
|
4
|
+
import { BodyShort, Detail } from "../../typography";
|
|
5
5
|
import Listbox from "../../utils/components/Listbox/root/ListboxRoot";
|
|
6
6
|
import { DismissableLayer } from "../../utils/components/dismissablelayer/DismissableLayer";
|
|
7
7
|
import { Floating } from "../../utils/components/floating/Floating";
|
|
@@ -63,6 +63,8 @@ const AutoSuggest = forwardRef<HTMLInputElement, AutoSuggestProps>(
|
|
|
63
63
|
setOpen(true);
|
|
64
64
|
}}
|
|
65
65
|
onFocus={() => setOpen(true)}
|
|
66
|
+
size="small"
|
|
67
|
+
autoComplete="off"
|
|
66
68
|
/* onKeyDown={(e) => {
|
|
67
69
|
if (e.key === "Enter") {
|
|
68
70
|
createToken(filterText);
|
|
@@ -79,6 +81,7 @@ const AutoSuggest = forwardRef<HTMLInputElement, AutoSuggestProps>(
|
|
|
79
81
|
setFocusedValue={setVirtuallyFocusedOptionId}
|
|
80
82
|
onClose={handleClose}
|
|
81
83
|
safeZoneAnchor={inputRef}
|
|
84
|
+
autoSuggestValue={value}
|
|
82
85
|
/>
|
|
83
86
|
)}
|
|
84
87
|
</Listbox>
|
|
@@ -94,6 +97,7 @@ type AutoSuggestPopupProps = {
|
|
|
94
97
|
setFocusedValue: (value: string) => void;
|
|
95
98
|
onClose: () => void;
|
|
96
99
|
safeZoneAnchor: HTMLInputElement | null;
|
|
100
|
+
autoSuggestValue: string;
|
|
97
101
|
};
|
|
98
102
|
|
|
99
103
|
const AutoSuggestPopup = forwardRef<HTMLDivElement, AutoSuggestPopupProps>(
|
|
@@ -105,6 +109,7 @@ const AutoSuggestPopup = forwardRef<HTMLDivElement, AutoSuggestPopupProps>(
|
|
|
105
109
|
setFocusedValue,
|
|
106
110
|
onClose,
|
|
107
111
|
safeZoneAnchor,
|
|
112
|
+
autoSuggestValue,
|
|
108
113
|
},
|
|
109
114
|
ref,
|
|
110
115
|
) => {
|
|
@@ -134,7 +139,12 @@ const AutoSuggestPopup = forwardRef<HTMLDivElement, AutoSuggestPopupProps>(
|
|
|
134
139
|
hasVirtualFocus={focusedValue === item.value}
|
|
135
140
|
>
|
|
136
141
|
<VStack gap="space-0">
|
|
137
|
-
<
|
|
142
|
+
<BodyShort as="div" size="small">
|
|
143
|
+
<HighlightText
|
|
144
|
+
text={item.label}
|
|
145
|
+
highlightText={autoSuggestValue}
|
|
146
|
+
/>
|
|
147
|
+
</BodyShort>
|
|
138
148
|
{item.description && (
|
|
139
149
|
<Detail as="div">{item.description}</Detail>
|
|
140
150
|
)}
|
|
@@ -158,4 +168,56 @@ const AutoSuggestPopup = forwardRef<HTMLDivElement, AutoSuggestPopupProps>(
|
|
|
158
168
|
},
|
|
159
169
|
);
|
|
160
170
|
|
|
171
|
+
function HighlightText({
|
|
172
|
+
text,
|
|
173
|
+
highlightText,
|
|
174
|
+
}: {
|
|
175
|
+
text: string;
|
|
176
|
+
highlightText: string;
|
|
177
|
+
}) {
|
|
178
|
+
if (!text || !highlightText) {
|
|
179
|
+
return <span>{text}</span>;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
if (text === highlightText) {
|
|
183
|
+
return <Highlight text={text} />;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
const { noMatches, matches } = highlightSplit(text, highlightText);
|
|
187
|
+
|
|
188
|
+
const highlighted: (string | JSX.Element)[] = [];
|
|
189
|
+
|
|
190
|
+
noMatches.forEach((noMatch, idx) => {
|
|
191
|
+
highlighted.push(<span key={`noMatch-${idx}`}>{noMatch}</span>);
|
|
192
|
+
|
|
193
|
+
if (matches && idx < matches.length) {
|
|
194
|
+
highlighted.push(<Highlight key={`match-${idx}`} text={matches[idx]} />);
|
|
195
|
+
}
|
|
196
|
+
});
|
|
197
|
+
|
|
198
|
+
return <span>{highlighted}</span>;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
function Highlight({ text }: { text: string }) {
|
|
202
|
+
return <mark className="aksel-listbox__highlight">{text}</mark>;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
function highlightSplit(text: string, highlightText: string) {
|
|
206
|
+
/* Skip loooong texts */
|
|
207
|
+
if (highlightText.length > 1000) {
|
|
208
|
+
return { noMatches: [text], matches: null };
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
/* Case insensitive filtering */
|
|
212
|
+
const filteringPattern = highlightText.replace(
|
|
213
|
+
/[-[\]/{}()*+?.\\^$|]/g,
|
|
214
|
+
"\\$&",
|
|
215
|
+
);
|
|
216
|
+
const regexp = new RegExp(filteringPattern, "gi");
|
|
217
|
+
const noMatches = text.split(regexp);
|
|
218
|
+
const matches = text.match(regexp);
|
|
219
|
+
|
|
220
|
+
return { noMatches, matches };
|
|
221
|
+
}
|
|
222
|
+
|
|
161
223
|
export { AutoSuggest };
|
|
@@ -28,6 +28,7 @@ type TokenFilterProps = {
|
|
|
28
28
|
* TODO:
|
|
29
29
|
* - Implement onChange handler to update query state when user selects an autocomplete option.
|
|
30
30
|
* - Handle token rendering and editing (e.g., show tokens for matched properties/operators/values, allow deleting tokens).
|
|
31
|
+
* - Writing "stance" still shows status and hostname options
|
|
31
32
|
*/
|
|
32
33
|
export const TokenFilter = forwardRef<HTMLDivElement, TokenFilterProps>(
|
|
33
34
|
({ query, className, propertyDefinitions, options, onChange }, ref) => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from "react";
|
|
1
|
+
import React, { forwardRef } from "react";
|
|
2
2
|
import { cl } from "../../../utils/helpers";
|
|
3
3
|
import DataToolbarButton, {
|
|
4
4
|
DataToolbarButtonProps,
|
|
@@ -12,23 +12,15 @@ import DataToolbarToggleButton, {
|
|
|
12
12
|
} from "../toggle-button/DataToolbarToggleButton";
|
|
13
13
|
|
|
14
14
|
interface DataToolbarProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
15
|
-
children
|
|
15
|
+
children?: never;
|
|
16
|
+
renderInput?: React.ReactNode;
|
|
17
|
+
renderPreferences?: React.ReactNode;
|
|
18
|
+
renderPagination?: React.ReactNode;
|
|
16
19
|
}
|
|
17
20
|
|
|
18
21
|
interface DataToolbarRootComponent extends React.ForwardRefExoticComponent<
|
|
19
22
|
DataToolbarProps & React.RefAttributes<HTMLDivElement>
|
|
20
23
|
> {
|
|
21
|
-
/**
|
|
22
|
-
* @see 🏷️ {@link DataToolbarSearchFieldProps}
|
|
23
|
-
* @example
|
|
24
|
-
* ```tsx
|
|
25
|
-
* <DataToolbar>
|
|
26
|
-
* <DataToolbar.SearchField />
|
|
27
|
-
* </DataToolbar>
|
|
28
|
-
* ```
|
|
29
|
-
*/
|
|
30
|
-
SearchField: typeof DataToolbarSearchField;
|
|
31
|
-
|
|
32
24
|
/**
|
|
33
25
|
* @see 🏷️ {@link DataToolbarButtonProps}
|
|
34
26
|
* @example
|
|
@@ -39,48 +31,53 @@ interface DataToolbarRootComponent extends React.ForwardRefExoticComponent<
|
|
|
39
31
|
* ```
|
|
40
32
|
*/
|
|
41
33
|
Button: typeof DataToolbarButton;
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* @see 🏷️ {@link DataToolbarToggleButtonProps}
|
|
45
|
-
* @example
|
|
46
|
-
* ```tsx
|
|
47
|
-
* <DataToolbar>
|
|
48
|
-
* <DataToolbar.ToggleButton />
|
|
49
|
-
* </DataToolbar>
|
|
50
|
-
* ```
|
|
51
|
-
*/
|
|
52
|
-
ToggleButton: typeof DataToolbarToggleButton;
|
|
53
34
|
}
|
|
54
35
|
|
|
55
|
-
const DataToolbar =
|
|
56
|
-
(
|
|
36
|
+
const DataToolbar = forwardRef<HTMLDivElement, DataToolbarProps>(
|
|
37
|
+
(
|
|
38
|
+
{ className, renderInput, renderPreferences, renderPagination, ...rest },
|
|
39
|
+
forwardedRef,
|
|
40
|
+
) => {
|
|
57
41
|
return (
|
|
58
42
|
<div
|
|
59
|
-
ref={
|
|
43
|
+
ref={forwardedRef}
|
|
60
44
|
{...rest}
|
|
61
45
|
className={cl("aksel-data-toolbar", className)}
|
|
62
46
|
role="toolbar"
|
|
63
47
|
>
|
|
64
|
-
{
|
|
48
|
+
{renderInput && (
|
|
49
|
+
<div className="aksel-data-toolbar__input">{renderInput}</div>
|
|
50
|
+
)}
|
|
51
|
+
|
|
52
|
+
<div className="aksel-data-toolbar__actions">
|
|
53
|
+
{renderPagination && (
|
|
54
|
+
<div className="aksel-data-toolbar__pagination">
|
|
55
|
+
{renderPagination}
|
|
56
|
+
</div>
|
|
57
|
+
)}
|
|
58
|
+
{renderPreferences && (
|
|
59
|
+
<div className="aksel-data-toolbar__preferences">
|
|
60
|
+
{renderPreferences}
|
|
61
|
+
</div>
|
|
62
|
+
)}
|
|
63
|
+
</div>
|
|
65
64
|
</div>
|
|
66
65
|
);
|
|
67
66
|
},
|
|
68
67
|
) as DataToolbarRootComponent;
|
|
69
68
|
|
|
70
|
-
DataToolbar.SearchField = DataToolbarSearchField;
|
|
71
69
|
DataToolbar.Button = DataToolbarButton;
|
|
72
|
-
DataToolbar.ToggleButton = DataToolbarToggleButton;
|
|
73
70
|
|
|
74
71
|
export {
|
|
75
72
|
DataToolbar,
|
|
76
|
-
DataToolbarSearchField,
|
|
77
73
|
DataToolbarButton,
|
|
74
|
+
DataToolbarSearchField,
|
|
78
75
|
DataToolbarToggleButton,
|
|
79
76
|
};
|
|
80
77
|
export default DataToolbar;
|
|
81
78
|
export type {
|
|
79
|
+
DataToolbarButtonProps,
|
|
82
80
|
DataToolbarProps,
|
|
83
81
|
DataToolbarSearchFieldProps,
|
|
84
|
-
DataToolbarButtonProps,
|
|
85
82
|
DataToolbarToggleButtonProps,
|
|
86
83
|
};
|
package/src/date/Date.Input.tsx
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import React, { InputHTMLAttributes, forwardRef
|
|
1
|
+
import React, { InputHTMLAttributes, forwardRef } from "react";
|
|
2
2
|
import { CalendarIcon } from "@navikt/aksel-icons";
|
|
3
|
+
import { Button } from "../button";
|
|
3
4
|
import { ReadOnlyIcon } from "../form/ReadOnlyIcon";
|
|
4
5
|
import { FormFieldProps, useFormField } from "../form/useFormField";
|
|
5
6
|
import { BodyShort, ErrorMessage, Label } from "../typography";
|
|
@@ -68,10 +69,10 @@ const DateInput = forwardRef<HTMLInputElement, DateInputProps>((props, ref) => {
|
|
|
68
69
|
description,
|
|
69
70
|
variant = "datepicker",
|
|
70
71
|
setAnchorRef,
|
|
72
|
+
"data-color": dataColor,
|
|
71
73
|
...rest
|
|
72
74
|
} = props;
|
|
73
75
|
|
|
74
|
-
const buttonRef = useRef<HTMLButtonElement>(null);
|
|
75
76
|
const translate = useDateTranslationContext().translate;
|
|
76
77
|
|
|
77
78
|
const isDatepickerVariant = variant === "datepicker";
|
|
@@ -113,6 +114,7 @@ const DateInput = forwardRef<HTMLInputElement, DateInputProps>((props, ref) => {
|
|
|
113
114
|
"aksel-date__field--readonly": readOnly,
|
|
114
115
|
},
|
|
115
116
|
)}
|
|
117
|
+
data-color={dataColor}
|
|
116
118
|
>
|
|
117
119
|
<Label
|
|
118
120
|
htmlFor={inputProps.id}
|
|
@@ -142,7 +144,7 @@ const DateInput = forwardRef<HTMLInputElement, DateInputProps>((props, ref) => {
|
|
|
142
144
|
{...omit(rest, ["error", "errorId", "size"])}
|
|
143
145
|
{...inputProps}
|
|
144
146
|
autoComplete="off"
|
|
145
|
-
aria-controls={context
|
|
147
|
+
aria-controls={context.open ? context.ariaId : undefined}
|
|
146
148
|
readOnly={readOnly}
|
|
147
149
|
className={cl(
|
|
148
150
|
"aksel-date__field-input",
|
|
@@ -152,23 +154,22 @@ const DateInput = forwardRef<HTMLInputElement, DateInputProps>((props, ref) => {
|
|
|
152
154
|
)}
|
|
153
155
|
size={isDatepickerVariant ? 11 : 14}
|
|
154
156
|
/>
|
|
155
|
-
<
|
|
157
|
+
<Button
|
|
156
158
|
disabled={inputProps.disabled || readOnly}
|
|
157
159
|
tabIndex={readOnly ? -1 : undefined}
|
|
158
|
-
onClick={
|
|
159
|
-
context?.onOpen();
|
|
160
|
-
setAnchorRef?.(buttonRef.current);
|
|
161
|
-
}}
|
|
160
|
+
onClick={context.onOpen}
|
|
162
161
|
type="button"
|
|
163
162
|
className="aksel-date__field-button"
|
|
164
|
-
ref={
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
163
|
+
ref={setAnchorRef}
|
|
164
|
+
icon={<CalendarIcon aria-hidden />}
|
|
165
|
+
// If we have the title on the icon, NVDA will read "close" when focusing
|
|
166
|
+
// the button after closing the popup, even if we wait a tick.
|
|
167
|
+
title={translate(
|
|
168
|
+
conditionalVariables.iconTitle[context.open ? "close" : "open"],
|
|
169
|
+
)}
|
|
170
|
+
variant="secondary"
|
|
171
|
+
size={size}
|
|
172
|
+
/>
|
|
172
173
|
</div>
|
|
173
174
|
<div
|
|
174
175
|
className="aksel-form-field__error"
|
|
@@ -248,7 +248,9 @@ export const useDatepicker = (
|
|
|
248
248
|
|
|
249
249
|
if (day && !selected) {
|
|
250
250
|
handleOpen(false);
|
|
251
|
-
|
|
251
|
+
// We use sync:false so that when Modal is used (see Date.Dialog.tsx), it is closed before
|
|
252
|
+
// we try to focus the open button (since native modal dialogs don't allow focus outside).
|
|
253
|
+
focusElement(anchorRef, { sync: false, preventScroll: true });
|
|
252
254
|
}
|
|
253
255
|
|
|
254
256
|
if (selected) {
|
|
@@ -326,10 +328,7 @@ export const useDatepicker = (
|
|
|
326
328
|
open,
|
|
327
329
|
onClose: () => {
|
|
328
330
|
handleOpen(false);
|
|
329
|
-
|
|
330
|
-
queueMicrotask(() =>
|
|
331
|
-
focusElement(anchorRef, { sync: false, preventScroll: true }),
|
|
332
|
-
);
|
|
331
|
+
focusElement(anchorRef, { sync: false, preventScroll: true });
|
|
333
332
|
},
|
|
334
333
|
onOpenToggle: () => handleOpen(!open),
|
|
335
334
|
disabled,
|
|
@@ -321,10 +321,9 @@ export const useMonthpicker = (
|
|
|
321
321
|
onOpenToggle: () => handleOpen(!open),
|
|
322
322
|
onClose: () => {
|
|
323
323
|
handleOpen(false);
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
);
|
|
324
|
+
// We use sync:false so that when Modal is used (see Date.Dialog.tsx), it is closed before
|
|
325
|
+
// we try to focus the open button (since native modal dialogs don't allow focus outside).
|
|
326
|
+
focusElement(anchorRef, { sync: false, preventScroll: true });
|
|
328
327
|
},
|
|
329
328
|
disabled,
|
|
330
329
|
};
|
|
@@ -7,18 +7,27 @@ export interface InternalHeaderButtonProps extends React.ButtonHTMLAttributes<HT
|
|
|
7
7
|
* Application Button
|
|
8
8
|
*/
|
|
9
9
|
children: React.ReactNode;
|
|
10
|
+
/**
|
|
11
|
+
* Active state for element.
|
|
12
|
+
* @default false
|
|
13
|
+
*/
|
|
14
|
+
isActive?: boolean;
|
|
10
15
|
}
|
|
11
16
|
export const InternalHeaderButton: OverridableComponent<
|
|
12
17
|
InternalHeaderButtonProps,
|
|
13
18
|
HTMLButtonElement
|
|
14
|
-
> = forwardRef(
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
19
|
+
> = forwardRef(
|
|
20
|
+
({ as: Component = "button", className, isActive = false, ...rest }, ref) => {
|
|
21
|
+
return (
|
|
22
|
+
<Component
|
|
23
|
+
aria-current={isActive || undefined}
|
|
24
|
+
{...rest}
|
|
25
|
+
ref={ref}
|
|
26
|
+
className={cl("aksel-internalheader__button", className)}
|
|
27
|
+
data-active={isActive}
|
|
28
|
+
/>
|
|
29
|
+
);
|
|
30
|
+
},
|
|
31
|
+
);
|
|
23
32
|
|
|
24
33
|
export default InternalHeaderButton;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
+
import { Label } from "../../../../typography";
|
|
2
3
|
import { useId } from "../../../../utils-external";
|
|
3
4
|
|
|
4
5
|
interface ListboxGroupProps {
|
|
@@ -15,9 +16,15 @@ function ListboxGroup({ label, children }: ListboxGroupProps) {
|
|
|
15
16
|
className="aksel-listbox__group"
|
|
16
17
|
aria-labelledby={labelId}
|
|
17
18
|
>
|
|
18
|
-
<
|
|
19
|
+
<Label
|
|
20
|
+
as="div"
|
|
21
|
+
size="small"
|
|
22
|
+
id={labelId}
|
|
23
|
+
aria-hidden
|
|
24
|
+
className="aksel-listbox__group-label"
|
|
25
|
+
>
|
|
19
26
|
{label}
|
|
20
|
-
</
|
|
27
|
+
</Label>
|
|
21
28
|
{children}
|
|
22
29
|
</div>
|
|
23
30
|
);
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
interface DataActionBarProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
3
|
-
children: React.ReactNode;
|
|
4
|
-
/**
|
|
5
|
-
* Number of selected rows
|
|
6
|
-
*/
|
|
7
|
-
numOfSelectedRows: number;
|
|
8
|
-
/**
|
|
9
|
-
* Callback for the clear button
|
|
10
|
-
*/
|
|
11
|
-
onClear: () => void;
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* TODO
|
|
15
|
-
*
|
|
16
|
-
* @see 🏷️ {@link DataActionBarProps}
|
|
17
|
-
* @example
|
|
18
|
-
* ```tsx
|
|
19
|
-
* <DataActionBar numOfSelectedRows={selectedRows.length} onClear={handleClear}>
|
|
20
|
-
* TODO
|
|
21
|
-
* </DataActionBar>
|
|
22
|
-
* ```
|
|
23
|
-
*/
|
|
24
|
-
declare const DataActionBar: React.ForwardRefExoticComponent<DataActionBarProps & React.RefAttributes<HTMLDivElement>>;
|
|
25
|
-
export default DataActionBar;
|
|
26
|
-
export { DataActionBar };
|
|
27
|
-
export type { DataActionBarProps };
|
|
@@ -1,49 +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.DataActionBar = void 0;
|
|
18
|
-
const react_1 = __importDefault(require("react"));
|
|
19
|
-
const button_1 = require("../../../button");
|
|
20
|
-
const box_1 = require("../../../primitives/box");
|
|
21
|
-
const stack_1 = require("../../../primitives/stack");
|
|
22
|
-
const typography_1 = require("../../../typography");
|
|
23
|
-
/**
|
|
24
|
-
* TODO
|
|
25
|
-
*
|
|
26
|
-
* @see 🏷️ {@link DataActionBarProps}
|
|
27
|
-
* @example
|
|
28
|
-
* ```tsx
|
|
29
|
-
* <DataActionBar numOfSelectedRows={selectedRows.length} onClear={handleClear}>
|
|
30
|
-
* TODO
|
|
31
|
-
* </DataActionBar>
|
|
32
|
-
* ```
|
|
33
|
-
*/
|
|
34
|
-
const DataActionBar = react_1.default.forwardRef((_a, forwardRef) => {
|
|
35
|
-
var { children, numOfSelectedRows, onClear } = _a, rest = __rest(_a, ["children", "numOfSelectedRows", "onClear"]);
|
|
36
|
-
return (react_1.default.createElement(box_1.Box, { asChild: true, borderWidth: "1", borderRadius: "16", borderColor: "neutral", background: "raised", padding: "space-16", "data-color": "neutral" },
|
|
37
|
-
react_1.default.createElement(stack_1.HStack, Object.assign({ gap: "space-16", align: "center", ref: forwardRef }, rest),
|
|
38
|
-
react_1.default.createElement(typography_1.BodyShort, { textColor: "subtle" },
|
|
39
|
-
numOfSelectedRows,
|
|
40
|
-
" rad",
|
|
41
|
-
numOfSelectedRows > 1 ? "er" : "",
|
|
42
|
-
" valgt"),
|
|
43
|
-
react_1.default.createElement(button_1.Button, { variant: "secondary", size: "small", onClick: onClear }, "Nullstill valg"),
|
|
44
|
-
react_1.default.createElement(stack_1.Spacer, null),
|
|
45
|
-
children)));
|
|
46
|
-
});
|
|
47
|
-
exports.DataActionBar = DataActionBar;
|
|
48
|
-
exports.default = DataActionBar;
|
|
49
|
-
//# sourceMappingURL=DataActionBarRoot.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DataActionBarRoot.js","sourceRoot":"","sources":["../../../../src/data/action-bar/root/DataActionBarRoot.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,kDAA0B;AAC1B,4CAAyC;AACzC,iDAA8C;AAC9C,qDAA2D;AAC3D,oDAAgD;AAchD;;;;;;;;;;GAUG;AACH,MAAM,aAAa,GAAG,eAAK,CAAC,UAAU,CACpC,CAAC,EAAiD,EAAE,UAAU,EAAE,EAAE;QAAjE,EAAE,QAAQ,EAAE,iBAAiB,EAAE,OAAO,OAAW,EAAN,IAAI,cAA/C,4CAAiD,CAAF;IAC9C,OAAO,CACL,8BAAC,SAAG,IACF,OAAO,QACP,WAAW,EAAC,GAAG,EACf,YAAY,EAAC,IAAI,EACjB,WAAW,EAAC,SAAS,EACrB,UAAU,EAAC,QAAQ,EACnB,OAAO,EAAC,UAAU,gBACP,SAAS;QAEpB,8BAAC,cAAM,kBAAC,GAAG,EAAC,UAAU,EAAC,KAAK,EAAC,QAAQ,EAAC,GAAG,EAAE,UAAU,IAAM,IAAI;YAC7D,8BAAC,sBAAS,IAAC,SAAS,EAAC,QAAQ;gBAC1B,iBAAiB;;gBAAM,iBAAiB,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE;yBAC/C;YACZ,8BAAC,eAAM,IAAC,OAAO,EAAC,WAAW,EAAC,IAAI,EAAC,OAAO,EAAC,OAAO,EAAE,OAAO,qBAEhD;YACT,8BAAC,cAAM,OAAG;YACT,QAAQ,CACF,CACL,CACP,CAAC;AACJ,CAAC,CACF,CAAC;AAGO,sCAAa;AADtB,kBAAe,aAAa,CAAC"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
export interface DataDragAndDropDragHandlerProps {
|
|
3
|
-
/**
|
|
4
|
-
* Whether the drag handler is disabled
|
|
5
|
-
*/
|
|
6
|
-
/**
|
|
7
|
-
* Wether dragging is done by keyboard. Used to conditionally render drag indicators.
|
|
8
|
-
*/
|
|
9
|
-
keyboardDragging?: boolean;
|
|
10
|
-
/**
|
|
11
|
-
* Handle ref is forwarded to the button element serving as drag handle.
|
|
12
|
-
*/
|
|
13
|
-
handleRef: React.Ref<HTMLDivElement>;
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* DataDragAndDropDragHandler
|
|
17
|
-
*
|
|
18
|
-
* A button component that serves as a drag handle for drag and drop operations.
|
|
19
|
-
* Can be used to initiate dragging of elements in a data table or list.
|
|
20
|
-
*/
|
|
21
|
-
export declare const DataDragAndDropDragHandler: React.ForwardRefExoticComponent<DataDragAndDropDragHandlerProps & React.RefAttributes<HTMLButtonElement>>;
|
|
@@ -1,24 +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
|
-
exports.DataDragAndDropDragHandler = void 0;
|
|
7
|
-
const react_1 = __importDefault(require("react"));
|
|
8
|
-
const aksel_icons_1 = require("@navikt/aksel-icons");
|
|
9
|
-
/**
|
|
10
|
-
* DataDragAndDropDragHandler
|
|
11
|
-
*
|
|
12
|
-
* A button component that serves as a drag handle for drag and drop operations.
|
|
13
|
-
* Can be used to initiate dragging of elements in a data table or list.
|
|
14
|
-
*/
|
|
15
|
-
exports.DataDragAndDropDragHandler = react_1.default.forwardRef(({ keyboardDragging, handleRef }) => {
|
|
16
|
-
return (react_1.default.createElement("div", { className: "aksel-data-drag-and-drop__drag-handler__alt" },
|
|
17
|
-
keyboardDragging && (react_1.default.createElement("span", { className: "aksel-data-drag-and-drop__drag-handler__arrow", "data-direction": "up" },
|
|
18
|
-
react_1.default.createElement(aksel_icons_1.CaretUpCircleFillIcon, { "aria-hidden": true, fontSize: "1.2rem" }))),
|
|
19
|
-
react_1.default.createElement("div", { ref: handleRef, className: "aksel-data-drag-and-drop__drag-handler__button" },
|
|
20
|
-
react_1.default.createElement(aksel_icons_1.DragVerticalIcon, { "aria-hidden": true, title: "Dra for \u00E5 flytte", fontSize: "1.5rem" })),
|
|
21
|
-
keyboardDragging && (react_1.default.createElement("span", { className: "aksel-data-drag-and-drop__drag-handler__arrow", "data-direction": "down" },
|
|
22
|
-
react_1.default.createElement(aksel_icons_1.CaretDownCircleFillIcon, { "aria-hidden": true, fontSize: "1.2rem" })))));
|
|
23
|
-
});
|
|
24
|
-
//# sourceMappingURL=DataDragAndDropDragHandler.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DataDragAndDropDragHandler.js","sourceRoot":"","sources":["../../../../src/data/drag-and-drop/drag-handler/DataDragAndDropDragHandler.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAC1B,qDAI6B;AAiB7B;;;;;GAKG;AACU,QAAA,0BAA0B,GAAG,eAAK,CAAC,UAAU,CAGxD,CAAC,EAAE,gBAAgB,EAAE,SAAS,EAAE,EAAE,EAAE;IACpC,OAAO,CACL,uCAAK,SAAS,EAAC,6CAA6C;QACzD,gBAAgB,IAAI,CACnB,wCACE,SAAS,EAAC,+CAA+C,oBAC1C,IAAI;YAEnB,8BAAC,mCAAqB,yBAAa,QAAQ,EAAC,QAAQ,GAAG,CAClD,CACR;QACD,uCACE,GAAG,EAAE,SAAS,EACd,SAAS,EAAC,gDAAgD;YAE1D,8BAAC,8BAAgB,yBAEf,KAAK,EAAC,uBAAkB,EACxB,QAAQ,EAAC,QAAQ,GACjB,CACE;QACL,gBAAgB,IAAI,CACnB,wCACE,SAAS,EAAC,+CAA+C,oBAC1C,MAAM;YAErB,8BAAC,qCAAuB,yBAAa,QAAQ,EAAC,QAAQ,GAAG,CACpD,CACR,CACG,CACP,CAAC;AACJ,CAAC,CAAC,CAAC"}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
interface DataDragAndDropItemProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
3
|
-
children: React.ReactNode;
|
|
4
|
-
/**
|
|
5
|
-
* Unique id
|
|
6
|
-
*/
|
|
7
|
-
id: string;
|
|
8
|
-
/**
|
|
9
|
-
* Index of the item being dragged
|
|
10
|
-
*/
|
|
11
|
-
index: number;
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* TODO
|
|
15
|
-
*
|
|
16
|
-
* @see 🏷️ {@link DataDragAndDropItemProps}
|
|
17
|
-
* @example
|
|
18
|
-
* ```tsx
|
|
19
|
-
* <DragAndDrop.Item numOfSelectedRows={selectedRows.length} onClear={handleClear}>
|
|
20
|
-
* TODO
|
|
21
|
-
* </DragAndDrop.Item>
|
|
22
|
-
* ```
|
|
23
|
-
*/
|
|
24
|
-
declare const DataDragAndDropItem: React.ForwardRefExoticComponent<DataDragAndDropItemProps & React.RefAttributes<HTMLDivElement>>;
|
|
25
|
-
export default DataDragAndDropItem;
|
|
26
|
-
export { DataDragAndDropItem };
|
|
27
|
-
export type { DataDragAndDropItemProps };
|
|
@@ -1,41 +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.DataDragAndDropItem = void 0;
|
|
18
|
-
const react_1 = __importDefault(require("react"));
|
|
19
|
-
const stack_1 = require("../../../primitives/stack");
|
|
20
|
-
const helpers_1 = require("../../../utils/helpers");
|
|
21
|
-
/**
|
|
22
|
-
* TODO
|
|
23
|
-
*
|
|
24
|
-
* @see 🏷️ {@link DataDragAndDropItemProps}
|
|
25
|
-
* @example
|
|
26
|
-
* ```tsx
|
|
27
|
-
* <DragAndDrop.Item numOfSelectedRows={selectedRows.length} onClear={handleClear}>
|
|
28
|
-
* TODO
|
|
29
|
-
* </DragAndDrop.Item>
|
|
30
|
-
* ```
|
|
31
|
-
*/
|
|
32
|
-
const DataDragAndDropItem = react_1.default.forwardRef((_a, forwardedRef) => {
|
|
33
|
-
// const context = useDataDragAndDropContext();
|
|
34
|
-
var { children, className } = _a, rest = __rest(_a, ["children", "className"]);
|
|
35
|
-
return (react_1.default.createElement(stack_1.HStack, { gap: "space-8", align: "center", wrap: false, asChild: true },
|
|
36
|
-
react_1.default.createElement("div", Object.assign({ ref: forwardedRef }, rest, { className: (0, helpers_1.cl)("aksel-data-table__drag-and-drop-item", className) }),
|
|
37
|
-
react_1.default.createElement("div", null, children))));
|
|
38
|
-
});
|
|
39
|
-
exports.DataDragAndDropItem = DataDragAndDropItem;
|
|
40
|
-
exports.default = DataDragAndDropItem;
|
|
41
|
-
//# sourceMappingURL=DataDragAndDropItem.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DataDragAndDropItem.js","sourceRoot":"","sources":["../../../../src/data/drag-and-drop/item/DataDragAndDropItem.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,kDAA0B;AAC1B,qDAAmD;AACnD,oDAA4C;AAc5C;;;;;;;;;;GAUG;AACH,MAAM,mBAAmB,GAAG,eAAK,CAAC,UAAU,CAG1C,CAAC,EAAgC,EAAE,YAAY,EAAE,EAAE;IACnD,+CAA+C;QAD9C,EAAE,QAAQ,EAAE,SAAS,OAAW,EAAN,IAAI,cAA9B,yBAAgC,CAAF;IAG/B,OAAO,CACL,8BAAC,cAAM,IAAC,GAAG,EAAC,SAAS,EAAC,KAAK,EAAC,QAAQ,EAAC,IAAI,EAAE,KAAK,EAAE,OAAO;QAEvD,qDACE,GAAG,EAAE,YAAY,IACb,IAAI,IACR,SAAS,EAAE,IAAA,YAAE,EAAC,sCAAsC,EAAE,SAAS,CAAC;YAMhE,2CAAM,QAAQ,CAAO,CACjB,CACC,CACV,CAAC;AACJ,CAAC,CAAC,CAAC;AAGM,kDAAmB;AAD5B,kBAAe,mBAAmB,CAAC"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
interface DataDragAndDropContextType {
|
|
2
|
-
inputMethod: "mouse" | "keyboard" | null;
|
|
3
|
-
}
|
|
4
|
-
export declare const DataDragAndDropProvider: import("react").FC<DataDragAndDropContextType & {
|
|
5
|
-
children: React.ReactNode;
|
|
6
|
-
ref?: never;
|
|
7
|
-
}>, useDataDragAndDropContext: <S extends boolean = true>(strict?: S | undefined) => S extends true ? DataDragAndDropContextType | undefined : DataDragAndDropContextType | undefined;
|
|
8
|
-
export {};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var _a;
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.useDataDragAndDropContext = exports.DataDragAndDropProvider = void 0;
|
|
5
|
-
const helpers_1 = require("../../../utils/helpers");
|
|
6
|
-
_a = (0, helpers_1.createStrictContext)({
|
|
7
|
-
errorMessage: "useDataDragAndDropContext must be used within a DataDragAndDropProvider",
|
|
8
|
-
name: "DataDragAndDropContext",
|
|
9
|
-
}), exports.DataDragAndDropProvider = _a.Provider, exports.useDataDragAndDropContext = _a.useContext;
|
|
10
|
-
//# sourceMappingURL=DataDragAndDrop.context.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DataDragAndDrop.context.js","sourceRoot":"","sources":["../../../../src/data/drag-and-drop/root/DataDragAndDrop.context.tsx"],"names":[],"mappings":";;;;AAAA,oDAA6D;AAMhD,KAGT,IAAA,6BAAmB,EAAyC;IAC9D,YAAY,EACV,yEAAyE;IAC3E,IAAI,EAAE,wBAAwB;CAC/B,CAAC,EANU,+BAAuB,gBACrB,iCAAyB,iBAKpC"}
|