carbon-react 114.18.2 → 115.0.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/esm/__internal__/checkable-input/checkable-input.component.d.ts +1 -1
- package/esm/__internal__/checkable-input/checkable-input.component.js +3 -4
- package/esm/__internal__/checkable-input/hidden-checkable-input.component.d.ts +2 -0
- package/esm/__internal__/checkable-input/hidden-checkable-input.component.js +5 -5
- package/esm/__internal__/input/input.component.js +2 -1
- package/esm/__internal__/input-behaviour/input-behaviour.component.js +2 -7
- package/esm/__internal__/input-behaviour/useInputBehaviour.d.ts +0 -1
- package/esm/components/action-popover/action-popover-item/action-popover-item.component.js +2 -6
- package/esm/components/action-popover/action-popover.component.js +9 -0
- package/esm/components/checkbox/checkbox.component.d.ts +2 -0
- package/esm/components/checkbox/checkbox.component.js +2 -0
- package/esm/components/draggable/draggable-container.component.d.ts +17 -0
- package/esm/components/draggable/draggable-container.component.js +174 -61
- package/esm/components/draggable/draggable-item.component.d.ts +30 -0
- package/esm/components/draggable/draggable-item.component.js +180 -36
- package/esm/components/draggable/draggable-item.style.d.ts +9 -0
- package/esm/components/draggable/index.d.ts +4 -2
- package/esm/components/draggable/internal/drop-target.component.d.ts +8 -0
- package/esm/components/draggable/internal/drop-target.component.js +187 -0
- package/esm/components/grouped-character/grouped-character.component.js +0 -1
- package/esm/components/inline-inputs/index.d.ts +1 -1
- package/esm/components/inline-inputs/index.js +1 -1
- package/esm/components/inline-inputs/inline-inputs.component.d.ts +6 -5
- package/esm/components/inline-inputs/inline-inputs.component.js +8 -13
- package/esm/components/number/number.component.js +0 -1
- package/esm/components/select/filterable-select/filterable-select.component.js +11 -4
- package/esm/components/select/multi-select/multi-select.component.js +13 -4
- package/esm/components/select/select-textbox/select-textbox.component.js +2 -0
- package/esm/components/select/simple-select/simple-select.component.js +13 -4
- package/esm/components/settings-row/index.d.ts +2 -1
- package/esm/components/settings-row/settings-row.component.d.ts +22 -0
- package/esm/components/settings-row/settings-row.component.js +165 -23
- package/esm/components/settings-row/settings-row.style.d.ts +7 -0
- package/esm/components/textarea/textarea.component.d.ts +2 -0
- package/esm/components/textarea/textarea.component.js +2 -2
- package/esm/components/textbox/textbox.component.d.ts +7 -3
- package/esm/components/textbox/textbox.component.js +3 -5
- package/esm/hooks/__internal__/useInputAccessibility/useInputAccessibility.d.ts +0 -1
- package/esm/hooks/__internal__/useInputAccessibility/useInputAccessibility.js +1 -3
- package/lib/__internal__/checkable-input/checkable-input.component.d.ts +1 -1
- package/lib/__internal__/checkable-input/checkable-input.component.js +3 -4
- package/lib/__internal__/checkable-input/hidden-checkable-input.component.d.ts +2 -0
- package/lib/__internal__/checkable-input/hidden-checkable-input.component.js +5 -5
- package/lib/__internal__/input/input.component.js +2 -1
- package/lib/__internal__/input-behaviour/input-behaviour.component.js +2 -12
- package/lib/__internal__/input-behaviour/useInputBehaviour.d.ts +0 -1
- package/lib/components/action-popover/action-popover-item/action-popover-item.component.js +2 -6
- package/lib/components/action-popover/action-popover.component.js +10 -0
- package/lib/components/checkbox/checkbox.component.d.ts +2 -0
- package/lib/components/checkbox/checkbox.component.js +2 -0
- package/lib/components/draggable/draggable-container.component.d.ts +17 -0
- package/lib/components/draggable/draggable-container.component.js +174 -64
- package/lib/components/draggable/draggable-item.component.d.ts +30 -0
- package/lib/components/draggable/draggable-item.component.js +179 -37
- package/lib/components/draggable/draggable-item.style.d.ts +9 -0
- package/lib/components/draggable/index.d.ts +4 -2
- package/lib/components/draggable/internal/drop-target.component.d.ts +8 -0
- package/lib/components/draggable/internal/drop-target.component.js +200 -0
- package/lib/components/grouped-character/grouped-character.component.js +0 -1
- package/lib/components/inline-inputs/index.d.ts +1 -1
- package/lib/components/inline-inputs/index.js +2 -10
- package/lib/components/inline-inputs/inline-inputs.component.d.ts +6 -5
- package/lib/components/inline-inputs/inline-inputs.component.js +11 -20
- package/lib/components/number/number.component.js +0 -1
- package/lib/components/select/filterable-select/filterable-select.component.js +12 -4
- package/lib/components/select/multi-select/multi-select.component.js +14 -4
- package/lib/components/select/select-textbox/select-textbox.component.js +2 -0
- package/lib/components/select/simple-select/simple-select.component.js +14 -4
- package/lib/components/settings-row/index.d.ts +2 -1
- package/lib/components/settings-row/settings-row.component.d.ts +22 -0
- package/lib/components/settings-row/settings-row.component.js +166 -26
- package/lib/components/settings-row/settings-row.style.d.ts +7 -0
- package/lib/components/textarea/textarea.component.d.ts +2 -0
- package/lib/components/textarea/textarea.component.js +2 -2
- package/lib/components/textbox/textbox.component.d.ts +7 -3
- package/lib/components/textbox/textbox.component.js +3 -5
- package/lib/hooks/__internal__/useInputAccessibility/useInputAccessibility.d.ts +0 -1
- package/lib/hooks/__internal__/useInputAccessibility/useInputAccessibility.js +1 -3
- package/package.json +1 -1
- package/esm/components/draggable/draggable-container.d.ts +0 -28
- package/esm/components/draggable/draggable-item.d.ts +0 -18
- package/esm/components/settings-row/settings-row.d.ts +0 -21
- package/lib/components/draggable/draggable-container.d.ts +0 -28
- package/lib/components/draggable/draggable-item.d.ts +0 -18
- package/lib/components/settings-row/settings-row.d.ts +0 -21
|
@@ -29,7 +29,7 @@ export interface CommonCheckableInputProps extends ValidationProps, CommonHidden
|
|
|
29
29
|
reverse?: boolean;
|
|
30
30
|
/** Size of the component */
|
|
31
31
|
size?: "small" | "large";
|
|
32
|
-
/**
|
|
32
|
+
/** Prop to specify the aria-labelledby attribute of the input */
|
|
33
33
|
ariaLabelledBy?: string;
|
|
34
34
|
/** When true, displays validation icon on label */
|
|
35
35
|
validationOnLabel?: boolean;
|
|
@@ -9,7 +9,7 @@ import HiddenCheckableInput from "./hidden-checkable-input.component";
|
|
|
9
9
|
import guid from "../utils/helpers/guid";
|
|
10
10
|
import useInputAccessibility from "../../hooks/__internal__/useInputAccessibility";
|
|
11
11
|
const CheckableInput = /*#__PURE__*/React.forwardRef(({
|
|
12
|
-
ariaLabelledBy
|
|
12
|
+
ariaLabelledBy,
|
|
13
13
|
autoFocus,
|
|
14
14
|
checked,
|
|
15
15
|
children,
|
|
@@ -45,8 +45,7 @@ const CheckableInput = /*#__PURE__*/React.forwardRef(({
|
|
|
45
45
|
labelId,
|
|
46
46
|
fieldHelpId,
|
|
47
47
|
validationIconId,
|
|
48
|
-
ariaDescribedBy
|
|
49
|
-
ariaLabelledBy
|
|
48
|
+
ariaDescribedBy
|
|
50
49
|
} = useInputAccessibility({
|
|
51
50
|
id,
|
|
52
51
|
error,
|
|
@@ -82,7 +81,7 @@ const CheckableInput = /*#__PURE__*/React.forwardRef(({
|
|
|
82
81
|
};
|
|
83
82
|
const inputProps = {
|
|
84
83
|
"aria-describedby": ariaDescribedBy,
|
|
85
|
-
"aria-labelledby":
|
|
84
|
+
"aria-labelledby": ariaLabelledBy,
|
|
86
85
|
"aria-invalid": !!error,
|
|
87
86
|
autoFocus,
|
|
88
87
|
checked,
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
export interface CommonHiddenCheckableInputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, "value" | "size" | "type"> {
|
|
3
|
+
/** Prop to specify the aria-labelledby attribute of the input */
|
|
4
|
+
ariaLabelledBy?: string;
|
|
3
5
|
/** If true the Component will be focused when page load */
|
|
4
6
|
autoFocus?: boolean;
|
|
5
7
|
/** Checked state of the input */
|
|
@@ -5,6 +5,7 @@ import PropTypes from "prop-types";
|
|
|
5
5
|
import HiddenCheckableInputStyle from "./hidden-checkable-input.style";
|
|
6
6
|
import { InputContext, InputGroupContext } from "../input-behaviour";
|
|
7
7
|
const HiddenCheckableInput = /*#__PURE__*/React.forwardRef(({
|
|
8
|
+
ariaLabelledBy,
|
|
8
9
|
name,
|
|
9
10
|
checked,
|
|
10
11
|
type,
|
|
@@ -18,8 +19,7 @@ const HiddenCheckableInput = /*#__PURE__*/React.forwardRef(({
|
|
|
18
19
|
onBlur,
|
|
19
20
|
onFocus,
|
|
20
21
|
onMouseEnter,
|
|
21
|
-
onMouseLeave
|
|
22
|
-
ariaLabelledBy
|
|
22
|
+
onMouseLeave
|
|
23
23
|
} = useContext(InputContext);
|
|
24
24
|
const {
|
|
25
25
|
onBlur: onBlurGroup,
|
|
@@ -53,6 +53,7 @@ const HiddenCheckableInput = /*#__PURE__*/React.forwardRef(({
|
|
|
53
53
|
};
|
|
54
54
|
|
|
55
55
|
return /*#__PURE__*/React.createElement(HiddenCheckableInputStyle, _extends({
|
|
56
|
+
"aria-labelledby": ariaLabelledBy,
|
|
56
57
|
autoFocus: autoFocus,
|
|
57
58
|
"aria-checked": checked,
|
|
58
59
|
checked: checked,
|
|
@@ -60,9 +61,7 @@ const HiddenCheckableInput = /*#__PURE__*/React.forwardRef(({
|
|
|
60
61
|
role: role || type,
|
|
61
62
|
type: type,
|
|
62
63
|
value: value
|
|
63
|
-
}, props,
|
|
64
|
-
"aria-labelledby": ariaLabelledBy
|
|
65
|
-
}, {
|
|
64
|
+
}, props, {
|
|
66
65
|
onFocus: handleFocus,
|
|
67
66
|
onBlur: handleBlur,
|
|
68
67
|
onMouseEnter: handleMouseEnter,
|
|
@@ -124,6 +123,7 @@ HiddenCheckableInput.propTypes = {
|
|
|
124
123
|
"aria-valuemin": PropTypes.number,
|
|
125
124
|
"aria-valuenow": PropTypes.number,
|
|
126
125
|
"aria-valuetext": PropTypes.string,
|
|
126
|
+
"ariaLabelledBy": PropTypes.string,
|
|
127
127
|
"autoCapitalize": PropTypes.string,
|
|
128
128
|
"autoComplete": PropTypes.string,
|
|
129
129
|
"autoCorrect": PropTypes.string,
|
|
@@ -29,6 +29,7 @@ function selectTextOnFocus(input) {
|
|
|
29
29
|
|
|
30
30
|
const Input = /*#__PURE__*/React.forwardRef(({
|
|
31
31
|
align,
|
|
32
|
+
"aria-labelledby": ariaLabelledBy,
|
|
32
33
|
placeholder,
|
|
33
34
|
disabled,
|
|
34
35
|
readOnly,
|
|
@@ -145,7 +146,7 @@ const Input = /*#__PURE__*/React.forwardRef(({
|
|
|
145
146
|
};
|
|
146
147
|
|
|
147
148
|
return /*#__PURE__*/React.createElement(StyledInput, _extends({}, rest, {
|
|
148
|
-
"aria-labelledby":
|
|
149
|
+
"aria-labelledby": ariaLabelledBy,
|
|
149
150
|
align: align,
|
|
150
151
|
placeholder: placeholder,
|
|
151
152
|
disabled: disabled,
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from "react";
|
|
2
2
|
import PropTypes from "prop-types";
|
|
3
|
-
import { InlineInputsContext } from "../../components/inline-inputs";
|
|
4
3
|
import useInputBehaviour from "./useInputBehaviour";
|
|
5
4
|
const InputContext = /*#__PURE__*/React.createContext({});
|
|
6
5
|
|
|
@@ -8,12 +7,8 @@ const InputBehaviour = ({
|
|
|
8
7
|
children
|
|
9
8
|
}) => {
|
|
10
9
|
const contextValue = useInputBehaviour();
|
|
11
|
-
const {
|
|
12
|
-
ariaLabelledBy
|
|
13
|
-
} = useContext(InlineInputsContext);
|
|
14
10
|
return /*#__PURE__*/React.createElement(InputContext.Provider, {
|
|
15
|
-
value: { ...contextValue
|
|
16
|
-
ariaLabelledBy
|
|
11
|
+
value: { ...contextValue
|
|
17
12
|
}
|
|
18
13
|
}, children);
|
|
19
14
|
};
|
|
@@ -9,7 +9,6 @@ export interface InputContextProps {
|
|
|
9
9
|
inputRef?: (input: {
|
|
10
10
|
current: HTMLInputElement | HTMLTextAreaElement | null;
|
|
11
11
|
}) => void;
|
|
12
|
-
ariaLabelledBy?: string;
|
|
13
12
|
}
|
|
14
13
|
declare const useInputBehaviour: (blockGroupBehaviour?: boolean | undefined) => InputContextProps;
|
|
15
14
|
export default useInputBehaviour;
|
|
@@ -129,11 +129,7 @@ const ActionPopoverItem = ({
|
|
|
129
129
|
}
|
|
130
130
|
}, [disabled, focusButton, onClickProp, setOpenPopover]);
|
|
131
131
|
const onKeyDown = useCallback(e => {
|
|
132
|
-
if (Events.
|
|
133
|
-
e.stopPropagation();
|
|
134
|
-
setOpenPopover(false);
|
|
135
|
-
focusButton();
|
|
136
|
-
} else if (Events.isSpaceKey(e)) {
|
|
132
|
+
if (Events.isSpaceKey(e)) {
|
|
137
133
|
e.preventDefault();
|
|
138
134
|
e.stopPropagation();
|
|
139
135
|
} else if (!disabled) {
|
|
@@ -182,7 +178,7 @@ const ActionPopoverItem = ({
|
|
|
182
178
|
} else if (Events.isEnterKey(e)) {
|
|
183
179
|
e.stopPropagation();
|
|
184
180
|
}
|
|
185
|
-
}, [disabled, download,
|
|
181
|
+
}, [disabled, download, isHref, isLeftAligned, onClick, submenu]);
|
|
186
182
|
const itemSubmenuProps = { ...(!disabled && {
|
|
187
183
|
onMouseEnter: e => {
|
|
188
184
|
if (mouseEnterTimer.current) clearTimeout(mouseEnterTimer.current);
|
|
@@ -12,6 +12,7 @@ import ActionPopoverMenu from "./action-popover-menu/action-popover-menu.compone
|
|
|
12
12
|
import ActionPopoverItem from "./action-popover-item/action-popover-item.component";
|
|
13
13
|
import ActionPopoverDivider from "./action-popover-divider/action-popover-divider.component";
|
|
14
14
|
import ActionPopoverContext from "./action-popover-context";
|
|
15
|
+
import useModalManager from "../../hooks/__internal__/useModalManager";
|
|
15
16
|
|
|
16
17
|
const onOpenDefault = () => {};
|
|
17
18
|
|
|
@@ -107,6 +108,14 @@ const ActionPopover = ({
|
|
|
107
108
|
setOpen(true);
|
|
108
109
|
}
|
|
109
110
|
}, [itemCount, setOpen]);
|
|
111
|
+
const handleEscapeKey = useCallback(e => {
|
|
112
|
+
/* istanbul ignore else */
|
|
113
|
+
if (Events.isEscKey(e)) {
|
|
114
|
+
setOpen(false);
|
|
115
|
+
focusButton();
|
|
116
|
+
}
|
|
117
|
+
}, [setOpen, focusButton]);
|
|
118
|
+
useModalManager(isOpen, handleEscapeKey, buttonRef);
|
|
110
119
|
useEffect(() => {
|
|
111
120
|
const handler = ({
|
|
112
121
|
target
|
|
@@ -4,6 +4,8 @@ import { CommonCheckableInputProps } from "../../__internal__/checkable-input/ch
|
|
|
4
4
|
export interface CheckboxProps extends CommonCheckableInputProps, MarginProps {
|
|
5
5
|
/** Breakpoint for adaptive spacing (left margin changes to 0). Enables the adaptive behaviour when set */
|
|
6
6
|
adaptiveSpacingBreakpoint?: number;
|
|
7
|
+
/** Prop to specify the aria-labelledby property of the input */
|
|
8
|
+
"aria-labelledby"?: string;
|
|
7
9
|
/** Identifier used for testing purposes, applied to the root element of the component. */
|
|
8
10
|
"data-component"?: string;
|
|
9
11
|
/** Identifier used for testing purposes, applied to the root element of the component. */
|
|
@@ -12,6 +12,7 @@ import Logger from "../../__internal__/utils/logger";
|
|
|
12
12
|
import useFormSpacing from "../../hooks/__internal__/useFormSpacing";
|
|
13
13
|
let deprecateInputRefWarnTriggered = false;
|
|
14
14
|
const Checkbox = /*#__PURE__*/React.forwardRef(({
|
|
15
|
+
"aria-labelledby": ariaLabelledBy,
|
|
15
16
|
id,
|
|
16
17
|
label,
|
|
17
18
|
onChange,
|
|
@@ -61,6 +62,7 @@ const Checkbox = /*#__PURE__*/React.forwardRef(({
|
|
|
61
62
|
}
|
|
62
63
|
|
|
63
64
|
const inputProps = {
|
|
65
|
+
ariaLabelledBy,
|
|
64
66
|
onClick,
|
|
65
67
|
onChange,
|
|
66
68
|
onBlur,
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { MarginProps } from "styled-system";
|
|
3
|
+
export interface DraggableContainerProps extends MarginProps {
|
|
4
|
+
/** Callback fired when order is changed */
|
|
5
|
+
getOrder?: (draggableItemIds?: (string | number | undefined)[], movedItemId?: string | number | undefined) => void;
|
|
6
|
+
/**
|
|
7
|
+
* The content of the component
|
|
8
|
+
*
|
|
9
|
+
* `<DraggableItem />` is required to make `Draggable` works
|
|
10
|
+
*/
|
|
11
|
+
children?: React.ReactNode;
|
|
12
|
+
}
|
|
13
|
+
declare const DraggableContainer: {
|
|
14
|
+
({ children, getOrder, ...rest }: DraggableContainerProps): JSX.Element;
|
|
15
|
+
displayName: string;
|
|
16
|
+
};
|
|
17
|
+
export default DraggableContainer;
|
|
@@ -1,32 +1,13 @@
|
|
|
1
1
|
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
2
|
|
|
3
|
-
import React, { useEffect, useState, useRef } from "react";
|
|
4
|
-
import { DndProvider, useDrop } from "react-dnd";
|
|
5
|
-
import { HTML5Backend } from "react-dnd-html5-backend";
|
|
3
|
+
import React, { useEffect, useState, useRef, useMemo } from "react";
|
|
6
4
|
import PropTypes from "prop-types";
|
|
7
|
-
import
|
|
5
|
+
import { DndProvider } from "react-dnd";
|
|
6
|
+
import { HTML5Backend } from "react-dnd-html5-backend";
|
|
7
|
+
import invariant from "invariant";
|
|
8
8
|
import { filterStyledSystemMarginProps } from "../../style/utils";
|
|
9
9
|
import DraggableItem from "./draggable-item.component";
|
|
10
|
-
import
|
|
11
|
-
const marginPropTypes = filterStyledSystemMarginProps(styledSystemPropTypes);
|
|
12
|
-
|
|
13
|
-
const DropTarget = ({
|
|
14
|
-
children,
|
|
15
|
-
getOrder,
|
|
16
|
-
...rest
|
|
17
|
-
}) => {
|
|
18
|
-
const [, drop] = useDrop({
|
|
19
|
-
accept: "draggableItem",
|
|
20
|
-
|
|
21
|
-
drop(item) {
|
|
22
|
-
getOrder(item === null || item === void 0 ? void 0 : item.id);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
});
|
|
26
|
-
return /*#__PURE__*/React.createElement(StyledDraggableContainer, _extends({
|
|
27
|
-
ref: drop
|
|
28
|
-
}, rest), children);
|
|
29
|
-
};
|
|
10
|
+
import DropTarget from "./internal/drop-target.component";
|
|
30
11
|
|
|
31
12
|
const DraggableContainer = ({
|
|
32
13
|
children,
|
|
@@ -34,6 +15,9 @@ const DraggableContainer = ({
|
|
|
34
15
|
...rest
|
|
35
16
|
}) => {
|
|
36
17
|
const [draggableItems, setDraggableItems] = useState(React.Children.toArray(children));
|
|
18
|
+
const hasProperChildren = useMemo(() => React.Children.toArray(children).every(child => /*#__PURE__*/React.isValidElement(child) && child.type.displayName === DraggableItem.displayName), [children]); // `<DraggableItem />` is required to make `Draggable` work
|
|
19
|
+
|
|
20
|
+
!hasProperChildren ? process.env.NODE_ENV !== "production" ? invariant(false, `\`${DraggableContainer.displayName}\` only accepts children of type \`${DraggableItem.displayName}\`.`) : invariant(false) : void 0;
|
|
37
21
|
const isFirstRender = useRef(true);
|
|
38
22
|
useEffect(() => {
|
|
39
23
|
if (!isFirstRender.current) {
|
|
@@ -45,7 +29,7 @@ const DraggableContainer = ({
|
|
|
45
29
|
|
|
46
30
|
const findItem = id => {
|
|
47
31
|
const draggableItem = draggableItems.filter(item => {
|
|
48
|
-
return `${item.props.id}` === id;
|
|
32
|
+
return /*#__PURE__*/React.isValidElement(item) && `${item.props.id}` === id;
|
|
49
33
|
})[0];
|
|
50
34
|
return {
|
|
51
35
|
draggableItem,
|
|
@@ -79,43 +63,172 @@ const DraggableContainer = ({
|
|
|
79
63
|
backend: HTML5Backend
|
|
80
64
|
}, /*#__PURE__*/React.createElement(DropTarget, _extends({
|
|
81
65
|
getOrder: getItemsId
|
|
82
|
-
}, marginProps), draggableItems.map(item =>
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
})]))));
|
|
66
|
+
}, marginProps), draggableItems.map(item => {
|
|
67
|
+
return /*#__PURE__*/React.isValidElement(item) && /*#__PURE__*/React.cloneElement(item, {
|
|
68
|
+
id: `${item.props.id}`,
|
|
69
|
+
findItem,
|
|
70
|
+
moveItem
|
|
71
|
+
}, [item.props.children]);
|
|
72
|
+
})));
|
|
90
73
|
};
|
|
91
74
|
|
|
92
|
-
DraggableContainer.propTypes = {
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
75
|
+
DraggableContainer.propTypes = {
|
|
76
|
+
"children": PropTypes.node,
|
|
77
|
+
"getOrder": PropTypes.func,
|
|
78
|
+
"m": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
79
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
80
|
+
"description": PropTypes.string,
|
|
81
|
+
"toString": PropTypes.func.isRequired,
|
|
82
|
+
"valueOf": PropTypes.func.isRequired
|
|
83
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
84
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
85
|
+
"description": PropTypes.string,
|
|
86
|
+
"toString": PropTypes.func.isRequired,
|
|
87
|
+
"valueOf": PropTypes.func.isRequired
|
|
88
|
+
}), PropTypes.string]),
|
|
89
|
+
"margin": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
90
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
91
|
+
"description": PropTypes.string,
|
|
92
|
+
"toString": PropTypes.func.isRequired,
|
|
93
|
+
"valueOf": PropTypes.func.isRequired
|
|
94
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
95
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
96
|
+
"description": PropTypes.string,
|
|
97
|
+
"toString": PropTypes.func.isRequired,
|
|
98
|
+
"valueOf": PropTypes.func.isRequired
|
|
99
|
+
}), PropTypes.string]),
|
|
100
|
+
"marginBottom": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
101
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
102
|
+
"description": PropTypes.string,
|
|
103
|
+
"toString": PropTypes.func.isRequired,
|
|
104
|
+
"valueOf": PropTypes.func.isRequired
|
|
105
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
106
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
107
|
+
"description": PropTypes.string,
|
|
108
|
+
"toString": PropTypes.func.isRequired,
|
|
109
|
+
"valueOf": PropTypes.func.isRequired
|
|
110
|
+
}), PropTypes.string]),
|
|
111
|
+
"marginLeft": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
112
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
113
|
+
"description": PropTypes.string,
|
|
114
|
+
"toString": PropTypes.func.isRequired,
|
|
115
|
+
"valueOf": PropTypes.func.isRequired
|
|
116
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
117
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
118
|
+
"description": PropTypes.string,
|
|
119
|
+
"toString": PropTypes.func.isRequired,
|
|
120
|
+
"valueOf": PropTypes.func.isRequired
|
|
121
|
+
}), PropTypes.string]),
|
|
122
|
+
"marginRight": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
123
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
124
|
+
"description": PropTypes.string,
|
|
125
|
+
"toString": PropTypes.func.isRequired,
|
|
126
|
+
"valueOf": PropTypes.func.isRequired
|
|
127
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
128
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
129
|
+
"description": PropTypes.string,
|
|
130
|
+
"toString": PropTypes.func.isRequired,
|
|
131
|
+
"valueOf": PropTypes.func.isRequired
|
|
132
|
+
}), PropTypes.string]),
|
|
133
|
+
"marginTop": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
134
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
135
|
+
"description": PropTypes.string,
|
|
136
|
+
"toString": PropTypes.func.isRequired,
|
|
137
|
+
"valueOf": PropTypes.func.isRequired
|
|
138
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
139
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
140
|
+
"description": PropTypes.string,
|
|
141
|
+
"toString": PropTypes.func.isRequired,
|
|
142
|
+
"valueOf": PropTypes.func.isRequired
|
|
143
|
+
}), PropTypes.string]),
|
|
144
|
+
"marginX": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
145
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
146
|
+
"description": PropTypes.string,
|
|
147
|
+
"toString": PropTypes.func.isRequired,
|
|
148
|
+
"valueOf": PropTypes.func.isRequired
|
|
149
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
150
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
151
|
+
"description": PropTypes.string,
|
|
152
|
+
"toString": PropTypes.func.isRequired,
|
|
153
|
+
"valueOf": PropTypes.func.isRequired
|
|
154
|
+
}), PropTypes.string]),
|
|
155
|
+
"marginY": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
156
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
157
|
+
"description": PropTypes.string,
|
|
158
|
+
"toString": PropTypes.func.isRequired,
|
|
159
|
+
"valueOf": PropTypes.func.isRequired
|
|
160
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
161
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
162
|
+
"description": PropTypes.string,
|
|
163
|
+
"toString": PropTypes.func.isRequired,
|
|
164
|
+
"valueOf": PropTypes.func.isRequired
|
|
165
|
+
}), PropTypes.string]),
|
|
166
|
+
"mb": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
167
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
168
|
+
"description": PropTypes.string,
|
|
169
|
+
"toString": PropTypes.func.isRequired,
|
|
170
|
+
"valueOf": PropTypes.func.isRequired
|
|
171
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
172
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
173
|
+
"description": PropTypes.string,
|
|
174
|
+
"toString": PropTypes.func.isRequired,
|
|
175
|
+
"valueOf": PropTypes.func.isRequired
|
|
176
|
+
}), PropTypes.string]),
|
|
177
|
+
"ml": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
178
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
179
|
+
"description": PropTypes.string,
|
|
180
|
+
"toString": PropTypes.func.isRequired,
|
|
181
|
+
"valueOf": PropTypes.func.isRequired
|
|
182
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
183
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
184
|
+
"description": PropTypes.string,
|
|
185
|
+
"toString": PropTypes.func.isRequired,
|
|
186
|
+
"valueOf": PropTypes.func.isRequired
|
|
187
|
+
}), PropTypes.string]),
|
|
188
|
+
"mr": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
189
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
190
|
+
"description": PropTypes.string,
|
|
191
|
+
"toString": PropTypes.func.isRequired,
|
|
192
|
+
"valueOf": PropTypes.func.isRequired
|
|
193
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
194
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
195
|
+
"description": PropTypes.string,
|
|
196
|
+
"toString": PropTypes.func.isRequired,
|
|
197
|
+
"valueOf": PropTypes.func.isRequired
|
|
198
|
+
}), PropTypes.string]),
|
|
199
|
+
"mt": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
200
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
201
|
+
"description": PropTypes.string,
|
|
202
|
+
"toString": PropTypes.func.isRequired,
|
|
203
|
+
"valueOf": PropTypes.func.isRequired
|
|
204
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
205
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
206
|
+
"description": PropTypes.string,
|
|
207
|
+
"toString": PropTypes.func.isRequired,
|
|
208
|
+
"valueOf": PropTypes.func.isRequired
|
|
209
|
+
}), PropTypes.string]),
|
|
210
|
+
"mx": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
211
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
212
|
+
"description": PropTypes.string,
|
|
213
|
+
"toString": PropTypes.func.isRequired,
|
|
214
|
+
"valueOf": PropTypes.func.isRequired
|
|
215
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
216
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
217
|
+
"description": PropTypes.string,
|
|
218
|
+
"toString": PropTypes.func.isRequired,
|
|
219
|
+
"valueOf": PropTypes.func.isRequired
|
|
220
|
+
}), PropTypes.string]),
|
|
221
|
+
"my": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
222
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
223
|
+
"description": PropTypes.string,
|
|
224
|
+
"toString": PropTypes.func.isRequired,
|
|
225
|
+
"valueOf": PropTypes.func.isRequired
|
|
226
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
227
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
228
|
+
"description": PropTypes.string,
|
|
229
|
+
"toString": PropTypes.func.isRequired,
|
|
230
|
+
"valueOf": PropTypes.func.isRequired
|
|
231
|
+
}), PropTypes.string])
|
|
120
232
|
};
|
|
233
|
+
DraggableContainer.displayName = "DraggableContainer";
|
|
121
234
|
export default DraggableContainer;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { PaddingProps } from "styled-system";
|
|
3
|
+
export interface DraggableItemProps extends PaddingProps {
|
|
4
|
+
/**
|
|
5
|
+
* The id of the `DraggableItem`.
|
|
6
|
+
*
|
|
7
|
+
* Use this prop to make `Draggable` work
|
|
8
|
+
*/
|
|
9
|
+
id: number | string;
|
|
10
|
+
/** The content of the component. */
|
|
11
|
+
children: React.ReactNode;
|
|
12
|
+
/**
|
|
13
|
+
* @private
|
|
14
|
+
* @ignore
|
|
15
|
+
*/
|
|
16
|
+
findItem?: (id: string | number) => {
|
|
17
|
+
DraggableItemProps: React.ReactElement;
|
|
18
|
+
index: number;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* @private
|
|
22
|
+
* @ignore
|
|
23
|
+
*/
|
|
24
|
+
moveItem?: (droppedId: string | number, overIndex: number | undefined) => void;
|
|
25
|
+
}
|
|
26
|
+
declare const DraggableItem: {
|
|
27
|
+
({ id, findItem, moveItem, children, py, ...rest }: DraggableItemProps): JSX.Element;
|
|
28
|
+
displayName: string;
|
|
29
|
+
};
|
|
30
|
+
export default DraggableItem;
|