@navikt/ds-react 8.8.0 → 8.9.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/data/drag-and-drop/drag-handler/DragAndDropDragHandler.d.ts +13 -0
- package/cjs/data/drag-and-drop/drag-handler/DragAndDropDragHandler.js +59 -0
- package/cjs/data/drag-and-drop/drag-handler/DragAndDropDragHandler.js.map +1 -0
- package/cjs/data/drag-and-drop/item/DragAndDropItem.d.ts +31 -0
- package/cjs/data/drag-and-drop/item/DragAndDropItem.js +48 -0
- package/cjs/data/drag-and-drop/item/DragAndDropItem.js.map +1 -0
- package/cjs/data/drag-and-drop/root/DragAndDrop.context.d.ts +17 -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/DragAndDropRoot.d.ts +38 -0
- package/cjs/data/drag-and-drop/root/DragAndDropRoot.js +219 -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 +26 -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 +23 -11
- 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/table/td/DataTableTd.d.ts +4 -0
- package/cjs/data/table/td/DataTableTd.js +4 -2
- package/cjs/data/table/td/DataTableTd.js.map +1 -1
- package/cjs/data/table/th/DataTableTh.d.ts +4 -0
- package/cjs/data/table/th/DataTableTh.js +6 -3
- package/cjs/data/table/th/DataTableTh.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/FilterChip.d.ts +10 -0
- package/cjs/data/token-filter/FilterChip.js +65 -0
- package/cjs/data/token-filter/FilterChip.js.map +1 -0
- package/cjs/data/token-filter/TokenFilter.d.ts +1 -0
- package/cjs/data/token-filter/TokenFilter.js +4 -10
- 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/form/checkbox/Checkbox.js +19 -33
- package/cjs/form/checkbox/Checkbox.js.map +1 -1
- package/cjs/form/checkbox/checkbox-input/CheckboxInput.d.ts +21 -0
- package/cjs/form/checkbox/checkbox-input/CheckboxInput.js +65 -0
- package/cjs/form/checkbox/checkbox-input/CheckboxInput.js.map +1 -0
- package/cjs/form/checkbox/types.d.ts +1 -1
- package/cjs/form/fieldset/Fieldset.js +2 -6
- package/cjs/form/fieldset/Fieldset.js.map +1 -1
- package/cjs/form/radio/Radio.js +9 -7
- package/cjs/form/radio/Radio.js.map +1 -1
- package/cjs/form/radio/radio-input/RadioInput.d.ts +19 -0
- package/cjs/{data/drag-and-drop/root/DataDragAndDropRoot.js → form/radio/radio-input/RadioInput.js} +17 -23
- package/cjs/form/radio/radio-input/RadioInput.js.map +1 -0
- 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 +13 -0
- package/esm/data/drag-and-drop/drag-handler/DragAndDropDragHandler.js +53 -0
- package/esm/data/drag-and-drop/drag-handler/DragAndDropDragHandler.js.map +1 -0
- package/esm/data/drag-and-drop/item/DragAndDropItem.d.ts +31 -0
- package/esm/data/drag-and-drop/item/DragAndDropItem.js +42 -0
- package/esm/data/drag-and-drop/item/DragAndDropItem.js.map +1 -0
- package/esm/data/drag-and-drop/root/DragAndDrop.context.d.ts +17 -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/DragAndDropRoot.d.ts +38 -0
- package/esm/data/drag-and-drop/root/DragAndDropRoot.js +179 -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 +24 -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 +23 -11
- 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/table/td/DataTableTd.d.ts +4 -0
- package/esm/data/table/td/DataTableTd.js +4 -2
- package/esm/data/table/td/DataTableTd.js.map +1 -1
- package/esm/data/table/th/DataTableTh.d.ts +4 -0
- package/esm/data/table/th/DataTableTh.js +6 -3
- package/esm/data/table/th/DataTableTh.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/FilterChip.d.ts +10 -0
- package/esm/data/token-filter/FilterChip.js +30 -0
- package/esm/data/token-filter/FilterChip.js.map +1 -0
- package/esm/data/token-filter/TokenFilter.d.ts +1 -0
- package/esm/data/token-filter/TokenFilter.js +4 -10
- 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/form/checkbox/Checkbox.js +19 -33
- package/esm/form/checkbox/Checkbox.js.map +1 -1
- package/esm/form/checkbox/checkbox-input/CheckboxInput.d.ts +21 -0
- package/esm/form/checkbox/checkbox-input/CheckboxInput.js +29 -0
- package/esm/form/checkbox/checkbox-input/CheckboxInput.js.map +1 -0
- package/esm/form/checkbox/types.d.ts +1 -1
- package/esm/form/fieldset/Fieldset.js +2 -6
- package/esm/form/fieldset/Fieldset.js.map +1 -1
- package/esm/form/radio/Radio.js +9 -7
- package/esm/form/radio/Radio.js.map +1 -1
- package/esm/form/radio/radio-input/RadioInput.d.ts +19 -0
- package/esm/form/radio/radio-input/RadioInput.js +19 -0
- package/esm/form/radio/radio-input/RadioInput.js.map +1 -0
- 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 +94 -0
- package/src/data/drag-and-drop/item/DragAndDropItem.tsx +75 -0
- package/src/data/drag-and-drop/root/DragAndDrop.context.tsx +27 -0
- package/src/data/drag-and-drop/root/DragAndDropRoot.tsx +294 -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 +36 -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 +58 -25
- package/src/data/table/root/DataTableRoot.tsx +2 -2
- package/src/data/table/td/DataTableTd.tsx +15 -2
- package/src/data/table/th/DataTableTh.tsx +13 -2
- package/src/data/token-filter/AutoSuggest.tsx +65 -3
- package/src/data/token-filter/FilterChip.tsx +100 -0
- package/src/data/token-filter/TokenFilter.tsx +9 -24
- 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/form/checkbox/Checkbox.tsx +37 -64
- package/src/form/checkbox/checkbox-input/CheckboxInput.tsx +69 -0
- package/src/form/checkbox/types.ts +1 -1
- package/src/form/fieldset/Fieldset.tsx +4 -6
- package/src/form/radio/Radio.tsx +43 -38
- package/src/form/radio/radio-input/RadioInput.tsx +32 -0
- 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.d.ts +0 -34
- 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.d.ts +0 -34
- 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
|
@@ -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
|
};
|
|
@@ -3,93 +3,66 @@ import { BodyShort } from "../../typography";
|
|
|
3
3
|
import { omit, useId } from "../../utils-external";
|
|
4
4
|
import { cl } from "../../utils/helpers";
|
|
5
5
|
import { ReadOnlyIconWithTitle } from "../ReadOnlyIcon";
|
|
6
|
+
import { CheckboxInput } from "./checkbox-input/CheckboxInput";
|
|
6
7
|
import { CheckboxProps } from "./types";
|
|
7
8
|
import useCheckbox from "./useCheckbox";
|
|
8
9
|
|
|
9
10
|
export const Checkbox = forwardRef<HTMLInputElement, CheckboxProps>(
|
|
10
|
-
(props,
|
|
11
|
+
(props: CheckboxProps, forwardedRef) => {
|
|
11
12
|
const { inputProps, hasError, size, readOnly, nested } = useCheckbox(props);
|
|
12
13
|
const descriptionId = useId();
|
|
13
14
|
|
|
15
|
+
const { className, description, children, indeterminate, hideLabel } =
|
|
16
|
+
props;
|
|
17
|
+
|
|
14
18
|
return (
|
|
15
19
|
<div
|
|
16
|
-
className={cl(
|
|
17
|
-
|
|
18
|
-
"aksel-checkbox",
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
"aksel-checkbox--error": hasError,
|
|
22
|
-
"aksel-checkbox--disabled": inputProps.disabled,
|
|
23
|
-
"aksel-checkbox--readonly": readOnly,
|
|
24
|
-
},
|
|
25
|
-
)}
|
|
20
|
+
className={cl(className, "aksel-checkbox", `aksel-checkbox--${size}`, {
|
|
21
|
+
"aksel-checkbox--error": hasError,
|
|
22
|
+
"aksel-checkbox--disabled": inputProps.disabled,
|
|
23
|
+
"aksel-checkbox--readonly": readOnly,
|
|
24
|
+
})}
|
|
26
25
|
data-color={hasError ? "danger" : props["data-color"]}
|
|
27
26
|
>
|
|
28
|
-
<
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
if (el) {
|
|
50
|
-
el.indeterminate = props.indeterminate ?? false;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
if (typeof ref === "function") {
|
|
54
|
-
ref(el);
|
|
55
|
-
} else if (ref != null) {
|
|
56
|
-
ref.current = el;
|
|
57
|
-
}
|
|
58
|
-
}}
|
|
59
|
-
/>
|
|
60
|
-
<svg
|
|
61
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
62
|
-
viewBox="0 0 13 10"
|
|
63
|
-
fill="none"
|
|
64
|
-
focusable={false}
|
|
65
|
-
role="img"
|
|
66
|
-
aria-hidden
|
|
67
|
-
className="aksel-checkbox__icon"
|
|
68
|
-
>
|
|
69
|
-
<path
|
|
70
|
-
d="M4.03524 6.41478L10.4752 0.404669C11.0792 -0.160351 12.029 -0.130672 12.5955 0.47478C13.162 1.08027 13.1296 2.03007 12.5245 2.59621L5.02111 9.59934C4.74099 9.85904 4.37559 10 4.00025 10C3.60651 10 3.22717 9.84621 2.93914 9.56111L0.439143 7.06111C-0.146381 6.47558 -0.146381 5.52542 0.439143 4.93989C1.02467 4.35437 1.97483 4.35437 2.56036 4.93989L4.03524 6.41478Z"
|
|
71
|
-
fill="currentColor"
|
|
72
|
-
/>
|
|
73
|
-
</svg>
|
|
74
|
-
</div>
|
|
27
|
+
<CheckboxInput
|
|
28
|
+
ref={forwardedRef}
|
|
29
|
+
{...omit(props, [
|
|
30
|
+
"children",
|
|
31
|
+
"size",
|
|
32
|
+
"error",
|
|
33
|
+
"description",
|
|
34
|
+
"hideLabel",
|
|
35
|
+
"indeterminate",
|
|
36
|
+
"errorId",
|
|
37
|
+
"readOnly",
|
|
38
|
+
])}
|
|
39
|
+
{...omit(inputProps, ["aria-invalid", "aria-describedby"])}
|
|
40
|
+
aria-describedby={
|
|
41
|
+
cl(inputProps["aria-describedby"], {
|
|
42
|
+
[descriptionId]: description,
|
|
43
|
+
}) || undefined
|
|
44
|
+
}
|
|
45
|
+
indeterminate={indeterminate ?? false}
|
|
46
|
+
standalone={false}
|
|
47
|
+
/>
|
|
75
48
|
<BodyShort
|
|
76
49
|
as="label"
|
|
77
50
|
htmlFor={inputProps.id}
|
|
78
51
|
size={size}
|
|
79
|
-
className=
|
|
80
|
-
|
|
81
|
-
})}
|
|
52
|
+
className="aksel-checkbox__label"
|
|
53
|
+
visuallyHidden={hideLabel}
|
|
82
54
|
>
|
|
83
55
|
{!nested && readOnly && <ReadOnlyIconWithTitle />}
|
|
84
|
-
{
|
|
56
|
+
{children}
|
|
85
57
|
</BodyShort>
|
|
86
|
-
{
|
|
58
|
+
{description && (
|
|
87
59
|
<BodyShort
|
|
88
60
|
id={descriptionId}
|
|
89
61
|
size={size}
|
|
90
62
|
className="aksel-form-field__subdescription aksel-checkbox__description"
|
|
63
|
+
visuallyHidden={hideLabel}
|
|
91
64
|
>
|
|
92
|
-
{
|
|
65
|
+
{description}
|
|
93
66
|
</BodyShort>
|
|
94
67
|
)}
|
|
95
68
|
</div>
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import React, { forwardRef, useCallback } from "react";
|
|
2
|
+
import { cl } from "../../../utils/helpers";
|
|
3
|
+
import { useMergeRefs } from "../../../utils/hooks";
|
|
4
|
+
|
|
5
|
+
type CheckboxInputProps = React.InputHTMLAttributes<HTMLInputElement> & {
|
|
6
|
+
indeterminate?: boolean;
|
|
7
|
+
children?: never;
|
|
8
|
+
standalone?: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Reduces pseudo-element target-size.
|
|
11
|
+
*/
|
|
12
|
+
compact?: boolean;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
const CheckboxInput = forwardRef<HTMLInputElement, CheckboxInputProps>(
|
|
16
|
+
(
|
|
17
|
+
{
|
|
18
|
+
className,
|
|
19
|
+
indeterminate,
|
|
20
|
+
standalone = true,
|
|
21
|
+
compact,
|
|
22
|
+
...rest
|
|
23
|
+
}: CheckboxInputProps,
|
|
24
|
+
forwardedRef,
|
|
25
|
+
) => {
|
|
26
|
+
const indeterminateRef = useCallback(
|
|
27
|
+
(el: HTMLInputElement | null) => {
|
|
28
|
+
if (el) {
|
|
29
|
+
el.indeterminate = indeterminate ?? false;
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
[indeterminate],
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
const mergedRef = useMergeRefs(indeterminateRef, forwardedRef);
|
|
36
|
+
|
|
37
|
+
return (
|
|
38
|
+
<div
|
|
39
|
+
className="aksel-checkbox__input-wrapper"
|
|
40
|
+
data-standalone={standalone}
|
|
41
|
+
data-compact={compact}
|
|
42
|
+
>
|
|
43
|
+
<input
|
|
44
|
+
{...rest}
|
|
45
|
+
className={cl("aksel-checkbox__input", className)}
|
|
46
|
+
type="checkbox"
|
|
47
|
+
ref={mergedRef}
|
|
48
|
+
/>
|
|
49
|
+
<svg
|
|
50
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
51
|
+
viewBox="0 0 13 10"
|
|
52
|
+
fill="none"
|
|
53
|
+
focusable={false}
|
|
54
|
+
role="img"
|
|
55
|
+
aria-hidden
|
|
56
|
+
className="aksel-checkbox__icon"
|
|
57
|
+
>
|
|
58
|
+
<path
|
|
59
|
+
d="M4.03524 6.41478L10.4752 0.404669C11.0792 -0.160351 12.029 -0.130672 12.5955 0.47478C13.162 1.08027 13.1296 2.03007 12.5245 2.59621L5.02111 9.59934C4.74099 9.85904 4.37559 10 4.00025 10C3.60651 10 3.22717 9.84621 2.93914 9.56111L0.439143 7.06111C-0.146381 6.47558 -0.146381 5.52542 0.439143 4.93989C1.02467 4.35437 1.97483 4.35437 2.56036 4.93989L4.03524 6.41478Z"
|
|
60
|
+
fill="currentColor"
|
|
61
|
+
/>
|
|
62
|
+
</svg>
|
|
63
|
+
</div>
|
|
64
|
+
);
|
|
65
|
+
},
|
|
66
|
+
);
|
|
67
|
+
|
|
68
|
+
export { CheckboxInput };
|
|
69
|
+
export type { CheckboxInputProps };
|
|
@@ -19,7 +19,7 @@ export interface CheckboxProps
|
|
|
19
19
|
*/
|
|
20
20
|
children: React.ReactNode;
|
|
21
21
|
/**
|
|
22
|
-
*
|
|
22
|
+
* Visually hides label and description, and makes it viewable for screen-readers only.
|
|
23
23
|
*/
|
|
24
24
|
hideLabel?: boolean;
|
|
25
25
|
/**
|
|
@@ -108,9 +108,8 @@ export const Fieldset = forwardRef<HTMLFieldSetElement, FieldsetProps>(
|
|
|
108
108
|
id={legendId}
|
|
109
109
|
size={size}
|
|
110
110
|
as="legend"
|
|
111
|
-
className=
|
|
112
|
-
|
|
113
|
-
})}
|
|
111
|
+
className="aksel-fieldset__legend"
|
|
112
|
+
visuallyHidden={!!hideLegend}
|
|
114
113
|
>
|
|
115
114
|
{readOnly &&
|
|
116
115
|
(_fieldsSupportNativeReadOnly ? (
|
|
@@ -122,9 +121,8 @@ export const Fieldset = forwardRef<HTMLFieldSetElement, FieldsetProps>(
|
|
|
122
121
|
</Label>
|
|
123
122
|
{!!description && (
|
|
124
123
|
<BodyShort
|
|
125
|
-
className=
|
|
126
|
-
|
|
127
|
-
})}
|
|
124
|
+
className="aksel-fieldset__description"
|
|
125
|
+
visuallyHidden={!!hideLegend}
|
|
128
126
|
id={inputDescriptionId}
|
|
129
127
|
size={size ?? "medium"}
|
|
130
128
|
as="div"
|
package/src/form/radio/Radio.tsx
CHANGED
|
@@ -2,52 +2,57 @@ import React, { forwardRef } from "react";
|
|
|
2
2
|
import { BodyShort } from "../../typography";
|
|
3
3
|
import { omit, useId } from "../../utils-external";
|
|
4
4
|
import { cl } from "../../utils/helpers";
|
|
5
|
+
import { RadioInput } from "./radio-input/RadioInput";
|
|
5
6
|
import { RadioProps } from "./types";
|
|
6
7
|
import { useRadio } from "./useRadio";
|
|
7
8
|
|
|
8
|
-
export const Radio = forwardRef<HTMLInputElement, RadioProps>(
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
export const Radio = forwardRef<HTMLInputElement, RadioProps>(
|
|
10
|
+
(props: RadioProps, forwardedRef) => {
|
|
11
|
+
const { inputProps, size, hasError, readOnly } = useRadio(props);
|
|
12
|
+
const descriptionId = useId();
|
|
11
13
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
"aksel-radio
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
{...omit(props, ["children", "size", "description", "readOnly"])}
|
|
23
|
-
{...omit(inputProps, ["aria-invalid", "aria-describedby"])}
|
|
24
|
-
aria-describedby={
|
|
25
|
-
cl(inputProps["aria-describedby"], {
|
|
26
|
-
[descriptionId]: props.description,
|
|
27
|
-
}) || undefined
|
|
28
|
-
}
|
|
29
|
-
className="aksel-radio__input"
|
|
30
|
-
ref={ref}
|
|
31
|
-
/>
|
|
32
|
-
<BodyShort
|
|
33
|
-
as="label"
|
|
34
|
-
htmlFor={inputProps.id}
|
|
35
|
-
className="aksel-radio__label"
|
|
36
|
-
size={size}
|
|
14
|
+
const { className, description, children } = props;
|
|
15
|
+
|
|
16
|
+
return (
|
|
17
|
+
<div
|
|
18
|
+
className={cl(className, "aksel-radio", `aksel-radio--${size}`, {
|
|
19
|
+
"aksel-radio--error": hasError,
|
|
20
|
+
"aksel-radio--disabled": inputProps.disabled,
|
|
21
|
+
"aksel-radio--readonly": readOnly,
|
|
22
|
+
})}
|
|
23
|
+
data-color={hasError ? "danger" : props["data-color"]}
|
|
37
24
|
>
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
25
|
+
<RadioInput
|
|
26
|
+
ref={forwardedRef}
|
|
27
|
+
{...omit(props, ["children", "size", "description", "readOnly"])}
|
|
28
|
+
{...omit(inputProps, ["aria-invalid", "aria-describedby"])}
|
|
29
|
+
aria-describedby={
|
|
30
|
+
cl(inputProps["aria-describedby"], {
|
|
31
|
+
[descriptionId]: description,
|
|
32
|
+
}) || undefined
|
|
33
|
+
}
|
|
34
|
+
standalone={false}
|
|
35
|
+
/>
|
|
41
36
|
<BodyShort
|
|
42
|
-
|
|
37
|
+
as="label"
|
|
38
|
+
htmlFor={inputProps.id}
|
|
39
|
+
className="aksel-radio__label"
|
|
43
40
|
size={size}
|
|
44
|
-
className="aksel-form-field__subdescription aksel-radio__description"
|
|
45
41
|
>
|
|
46
|
-
{
|
|
42
|
+
{children}
|
|
47
43
|
</BodyShort>
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}
|
|
44
|
+
{description && (
|
|
45
|
+
<BodyShort
|
|
46
|
+
id={descriptionId}
|
|
47
|
+
size={size}
|
|
48
|
+
className="aksel-form-field__subdescription aksel-radio__description"
|
|
49
|
+
>
|
|
50
|
+
{description}
|
|
51
|
+
</BodyShort>
|
|
52
|
+
)}
|
|
53
|
+
</div>
|
|
54
|
+
);
|
|
55
|
+
},
|
|
56
|
+
);
|
|
52
57
|
|
|
53
58
|
export default Radio;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import React, { forwardRef } from "react";
|
|
2
|
+
import { cl } from "../../../utils/helpers";
|
|
3
|
+
|
|
4
|
+
type RadioInputProps = React.InputHTMLAttributes<HTMLInputElement> & {
|
|
5
|
+
children?: never;
|
|
6
|
+
standalone?: boolean;
|
|
7
|
+
/**
|
|
8
|
+
* Reduces pseudo-element target-size.
|
|
9
|
+
*/
|
|
10
|
+
compact?: boolean;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
const RadioInput = forwardRef<HTMLInputElement, RadioInputProps>(
|
|
14
|
+
(
|
|
15
|
+
{ className, standalone = true, compact, ...rest }: RadioInputProps,
|
|
16
|
+
forwardedRef,
|
|
17
|
+
) => {
|
|
18
|
+
return (
|
|
19
|
+
<input
|
|
20
|
+
{...rest}
|
|
21
|
+
ref={forwardedRef}
|
|
22
|
+
className={cl("aksel-radio__input", className)}
|
|
23
|
+
data-standalone={standalone}
|
|
24
|
+
data-compact={compact}
|
|
25
|
+
type="radio"
|
|
26
|
+
/>
|
|
27
|
+
);
|
|
28
|
+
},
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
export { RadioInput };
|
|
32
|
+
export type { RadioInputProps };
|
|
@@ -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 };
|