no-frills-ui 0.0.14-alpha.0 → 0.0.14-alpha.2
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/README.md +63 -24
- package/dist/index.js +931 -2035
- package/dist/index.js.map +1 -1
- package/lib-esm/components/Accordion/Accordion.d.ts +2 -3
- package/lib-esm/components/Accordion/Accordion.js +6 -3
- package/lib-esm/components/Accordion/Accordion.js.map +1 -1
- package/lib-esm/components/Accordion/AccordionStep.d.ts +2 -2
- package/lib-esm/components/Accordion/AccordionStep.js +31 -22
- package/lib-esm/components/Accordion/AccordionStep.js.map +1 -1
- package/lib-esm/components/Accordion/index.js.map +1 -1
- package/lib-esm/components/Badge/Badge.js +5 -6
- package/lib-esm/components/Badge/Badge.js.map +1 -1
- package/lib-esm/components/Button/LinkButton.js +2 -1
- package/lib-esm/components/Button/LinkButton.js.map +1 -1
- package/lib-esm/components/Card/Card.js +1 -1
- package/lib-esm/components/Card/Card.js.map +1 -1
- package/lib-esm/components/Chip/Chip.d.ts +2 -0
- package/lib-esm/components/Chip/Chip.js +4 -3
- package/lib-esm/components/Chip/Chip.js.map +1 -1
- package/lib-esm/components/ChipInput/ChipInput.d.ts +33 -0
- package/lib-esm/components/ChipInput/ChipInput.js +225 -0
- package/lib-esm/components/ChipInput/ChipInput.js.map +1 -0
- package/lib-esm/components/ChipInput/index.d.ts +1 -0
- package/lib-esm/components/ChipInput/index.js +2 -0
- package/lib-esm/components/ChipInput/index.js.map +1 -0
- package/lib-esm/components/Dialog/AlertDialog.js +3 -3
- package/lib-esm/components/Dialog/AlertDialog.js.map +1 -1
- package/lib-esm/components/Dialog/ConfirmDialog.js +8 -3
- package/lib-esm/components/Dialog/ConfirmDialog.js.map +1 -1
- package/lib-esm/components/Dialog/Dialog.d.ts +2 -2
- package/lib-esm/components/Dialog/Dialog.js +6 -4
- package/lib-esm/components/Dialog/Dialog.js.map +1 -1
- package/lib-esm/components/Dialog/PromptDialog.js +2 -2
- package/lib-esm/components/Dialog/PromptDialog.js.map +1 -1
- package/lib-esm/components/DragAndDrop/DragAndDrop.d.ts +28 -1
- package/lib-esm/components/DragAndDrop/DragAndDrop.js +41 -3
- package/lib-esm/components/DragAndDrop/DragAndDrop.js.map +1 -1
- package/lib-esm/components/DragAndDrop/DragItem.d.ts +37 -0
- package/lib-esm/components/DragAndDrop/DragItem.js +160 -14
- package/lib-esm/components/DragAndDrop/DragItem.js.map +1 -1
- package/lib-esm/components/DragAndDrop/types.d.ts +3 -0
- package/lib-esm/components/DragAndDrop/types.js +1 -1
- package/lib-esm/components/DragAndDrop/types.js.map +1 -1
- package/lib-esm/components/Drawer/Drawer.js +10 -8
- package/lib-esm/components/Drawer/Drawer.js.map +1 -1
- package/lib-esm/components/Drawer/index.d.ts +1 -1
- package/lib-esm/components/Drawer/index.js +1 -1
- package/lib-esm/components/Drawer/index.js.map +1 -1
- package/lib-esm/components/Groups/Group.js +26 -14
- package/lib-esm/components/Groups/Group.js.map +1 -1
- package/lib-esm/components/Input/Checkbox.js +11 -8
- package/lib-esm/components/Input/Checkbox.js.map +1 -1
- package/lib-esm/components/Input/Dropdown.d.ts +2 -2
- package/lib-esm/components/Input/Dropdown.js +22 -22
- package/lib-esm/components/Input/Dropdown.js.map +1 -1
- package/lib-esm/components/Input/Input.js +20 -11
- package/lib-esm/components/Input/Input.js.map +1 -1
- package/lib-esm/components/Input/Radio.js +4 -3
- package/lib-esm/components/Input/Radio.js.map +1 -1
- package/lib-esm/components/Input/RadioButton.js +1 -1
- package/lib-esm/components/Input/RadioButton.js.map +1 -1
- package/lib-esm/components/Input/Select.js +17 -9
- package/lib-esm/components/Input/Select.js.map +1 -1
- package/lib-esm/components/Input/TextArea.js +17 -9
- package/lib-esm/components/Input/TextArea.js.map +1 -1
- package/lib-esm/components/Input/Toggle.js +5 -5
- package/lib-esm/components/Input/Toggle.js.map +1 -1
- package/lib-esm/components/Menu/Menu.d.ts +1 -1
- package/lib-esm/components/Menu/Menu.js +3 -2
- package/lib-esm/components/Menu/Menu.js.map +1 -1
- package/lib-esm/components/Menu/MenuContext.d.ts +11 -5
- package/lib-esm/components/Menu/MenuContext.js.map +1 -1
- package/lib-esm/components/Menu/MenuItem.d.ts +2 -2
- package/lib-esm/components/Menu/MenuItem.js +9 -5
- package/lib-esm/components/Menu/MenuItem.js.map +1 -1
- package/lib-esm/components/Modal/Modal.js +6 -4
- package/lib-esm/components/Modal/Modal.js.map +1 -1
- package/lib-esm/components/Notification/Notification.js +8 -4
- package/lib-esm/components/Notification/Notification.js.map +1 -1
- package/lib-esm/components/Notification/NotificationManager.js +11 -9
- package/lib-esm/components/Notification/NotificationManager.js.map +1 -1
- package/lib-esm/components/Notification/style.js +10 -8
- package/lib-esm/components/Notification/style.js.map +1 -1
- package/lib-esm/components/Notification/types.js +0 -1
- package/lib-esm/components/Notification/types.js.map +1 -1
- package/lib-esm/components/Popover/Popover.js +20 -17
- package/lib-esm/components/Popover/Popover.js.map +1 -1
- package/lib-esm/components/Popover/index.js.map +1 -1
- package/lib-esm/components/Spinner/Spinner.js +10 -6
- package/lib-esm/components/Spinner/Spinner.js.map +1 -1
- package/lib-esm/components/Stepper/Step.js +1 -0
- package/lib-esm/components/Stepper/Step.js.map +1 -1
- package/lib-esm/components/Stepper/Stepper.d.ts +3 -3
- package/lib-esm/components/Stepper/Stepper.js +17 -9
- package/lib-esm/components/Stepper/Stepper.js.map +1 -1
- package/lib-esm/components/Stepper/index.js.map +1 -1
- package/lib-esm/components/Tabs/Tab.js.map +1 -1
- package/lib-esm/components/Tabs/Tabs.d.ts +5 -5
- package/lib-esm/components/Tabs/Tabs.js +12 -9
- package/lib-esm/components/Tabs/Tabs.js.map +1 -1
- package/lib-esm/components/Toast/Toast.d.ts +1 -0
- package/lib-esm/components/Toast/Toast.js +9 -8
- package/lib-esm/components/Toast/Toast.js.map +1 -1
- package/lib-esm/components/Toast/ToastStory.js +1 -1
- package/lib-esm/components/Toast/ToastStory.js.map +1 -1
- package/lib-esm/components/Tooltip/Tooltip.js +5 -6
- package/lib-esm/components/Tooltip/Tooltip.js.map +1 -1
- package/lib-esm/components/index.d.ts +1 -0
- package/lib-esm/components/index.js +1 -0
- package/lib-esm/components/index.js.map +1 -1
- package/lib-esm/icons/CheckCircle.d.ts +1 -1
- package/lib-esm/icons/CheckCircle.js +1 -1
- package/lib-esm/icons/CheckCircle.js.map +1 -1
- package/lib-esm/icons/Close.d.ts +1 -1
- package/lib-esm/icons/Close.js +1 -1
- package/lib-esm/icons/Close.js.map +1 -1
- package/lib-esm/icons/DragIndicator.d.ts +1 -1
- package/lib-esm/icons/DragIndicator.js +1 -1
- package/lib-esm/icons/DragIndicator.js.map +1 -1
- package/lib-esm/icons/ErrorOutline.d.ts +1 -1
- package/lib-esm/icons/ErrorOutline.js +1 -1
- package/lib-esm/icons/ErrorOutline.js.map +1 -1
- package/lib-esm/icons/ExpandMore.d.ts +1 -1
- package/lib-esm/icons/ExpandMore.js +1 -1
- package/lib-esm/icons/ExpandMore.js.map +1 -1
- package/lib-esm/icons/FiberManualRecord.d.ts +1 -1
- package/lib-esm/icons/FiberManualRecord.js +1 -1
- package/lib-esm/icons/FiberManualRecord.js.map +1 -1
- package/lib-esm/icons/Info.d.ts +1 -1
- package/lib-esm/icons/Info.js +1 -1
- package/lib-esm/icons/Info.js.map +1 -1
- package/lib-esm/icons/ReportProblem.d.ts +1 -1
- package/lib-esm/icons/ReportProblem.js +1 -1
- package/lib-esm/icons/ReportProblem.js.map +1 -1
- package/lib-esm/shared/LayerManager.d.ts +2 -2
- package/lib-esm/shared/LayerManager.js +18 -14
- package/lib-esm/shared/LayerManager.js.map +1 -1
- package/lib-esm/shared/constants.js.map +1 -1
- package/package.json +93 -72
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AlertDialog.js","sourceRoot":"","sources":["../../../src/components/Dialog/AlertDialog.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OA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EAAE,IAAI,CAAC,KAAK,YAAG,IAAI,CAAC,KAAK,CAAC,UAAU,GAAU,GAClD,KACV,CACZ,CAAC;IACN,CAAC;;AAvCM,qBAAS,GAAG;IACf,oCAAoC;IACpC,MAAM,EAAE,SAAS,CAAC,MAAM;IACxB,4BAA4B;IAC5B,IAAI,EAAE,SAAS,CAAC,GAAG,CAAC,UAAU;IAC9B,gDAAgD;IAChD,UAAU,EAAE,SAAS,CAAC,MAAM;IAC5B,2BAA2B;IAC3B,WAAW,EAAE,SAAS,CAAC,MAAM;CAChC,AATe,CASd;AAEK,wBAAY,GAAG;IAClB,UAAU,EAAE,IAAI;CACnB,AAFkB,CAEjB;eAhBe,WAAW"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
2
2
|
import React, { createRef } from 'react';
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
|
-
import Dialog, { DialogBody, DialogFooter, DialogHeader } from './Dialog';
|
|
5
4
|
import { Button, ActionButton } from '../Button';
|
|
5
|
+
import Dialog, { DialogBody, DialogFooter, DialogHeader } from './Dialog';
|
|
6
6
|
class ConfirmDialog extends React.Component {
|
|
7
7
|
constructor() {
|
|
8
8
|
super(...arguments);
|
|
@@ -10,7 +10,12 @@ class ConfirmDialog extends React.Component {
|
|
|
10
10
|
this.show = () => {
|
|
11
11
|
return new Promise((resolve, reject) => {
|
|
12
12
|
const onClose = (resp) => {
|
|
13
|
-
|
|
13
|
+
if (resp) {
|
|
14
|
+
resolve(null);
|
|
15
|
+
}
|
|
16
|
+
else {
|
|
17
|
+
reject();
|
|
18
|
+
}
|
|
14
19
|
};
|
|
15
20
|
this.dialog.current.open(onClose);
|
|
16
21
|
});
|
|
@@ -37,7 +42,7 @@ ConfirmDialog.propTypes = {
|
|
|
37
42
|
};
|
|
38
43
|
ConfirmDialog.defaultProps = {
|
|
39
44
|
yesText: 'Yes',
|
|
40
|
-
noText: 'No'
|
|
45
|
+
noText: 'No',
|
|
41
46
|
};
|
|
42
47
|
export default ConfirmDialog;
|
|
43
48
|
//# sourceMappingURL=ConfirmDialog.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConfirmDialog.js","sourceRoot":"","sources":["../../../src/components/Dialog/ConfirmDialog.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACzC,OAAO,SAAS,MAAM,YAAY,CAAC;AACnC,OAAO,
|
|
1
|
+
{"version":3,"file":"ConfirmDialog.js","sourceRoot":"","sources":["../../../src/components/Dialog/ConfirmDialog.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACzC,OAAO,SAAS,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,MAAM,EAAE,EAAE,UAAU,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAI1E,MAAqB,aAAc,SAAQ,KAAK,CAAC,SAAwB;IAAzE;;QACY,WAAM,GAAG,SAAS,EAAU,CAAC;QAoB9B,SAAI,GAAG,GAAG,EAAE;YACf,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;gBACnC,MAAM,OAAO,GAAG,CAAC,IAAa,EAAE,EAAE;oBAC9B,IAAI,IAAI,EAAE,CAAC;wBACP,OAAO,CAAC,IAAI,CAAC,CAAC;oBAClB,CAAC;yBAAM,CAAC;wBACJ,MAAM,EAAE,CAAC;oBACb,CAAC;gBACL,CAAC,CAAC;gBACF,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YACtC,CAAC,CAAC,CAAC;QACP,CAAC,CAAC;QAEM,WAAM,GAAG,GAAG,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAChD,YAAO,GAAG,GAAG,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAoB5D,CAAC;IAlBG,MAAM;QACF,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC;QAClE,OAAO,CACH,MAAC,MAAM,oBACC,WAAW,IACf,GAAG,EAAE,IAAI,CAAC,MAAM,EAChB,UAAU,EAAE,KAAK,EACjB,mBAAmB,EAAE,KAAK,aAEzB,MAAM,IAAI,KAAC,YAAY,cAAE,MAAM,GAAgB,EAChD,KAAC,UAAU,cAAE,IAAI,GAAc,EAC/B,MAAC,YAAY,eACT,KAAC,MAAM,IAAC,OAAO,EAAE,IAAI,CAAC,MAAM,YAAG,MAAM,GAAU,EAC/C,KAAC,YAAY,IAAC,OAAO,EAAE,IAAI,CAAC,OAAO,YAAG,OAAO,GAAgB,IAClD,KACV,CACZ,CAAC;IACN,CAAC;;AAnDM,uBAAS,GAAG;IACf,oCAAoC;IACpC,MAAM,EAAE,SAAS,CAAC,MAAM;IACxB,qCAAqC;IACrC,IAAI,EAAE,SAAS,CAAC,MAAM,CAAC,UAAU;IACjC,yBAAyB;IACzB,OAAO,EAAE,SAAS,CAAC,MAAM;IACzB,yBAAyB;IACzB,MAAM,EAAE,SAAS,CAAC,MAAM;IACxB,2BAA2B;IAC3B,WAAW,EAAE,SAAS,CAAC,MAAM;CAChC,AAXe,CAWd;AAEK,0BAAY,GAAG;IAClB,OAAO,EAAE,KAAK;IACd,MAAM,EAAE,IAAI;CACf,AAHkB,CAGjB;eAnBe,aAAa"}
|
|
@@ -28,8 +28,8 @@ declare class Dialog extends React.Component<React.PropsWithChildren<DialogOptio
|
|
|
28
28
|
show: boolean;
|
|
29
29
|
};
|
|
30
30
|
shouldComponentUpdate(nextProps: DialogOptions, nextState: DialogState): boolean;
|
|
31
|
-
open: (closeCallback?: (resp:
|
|
32
|
-
close: (resp?:
|
|
31
|
+
open: (closeCallback?: (resp: unknown) => void) => void;
|
|
32
|
+
close: (resp?: unknown) => void;
|
|
33
33
|
private closeCallback;
|
|
34
34
|
render(): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
35
35
|
}
|
|
@@ -20,7 +20,7 @@ export const DialogContainer = styled(Card) `
|
|
|
20
20
|
max-height: 80vh;
|
|
21
21
|
transform: scale(0);
|
|
22
22
|
opacity: 0;
|
|
23
|
-
transition: all .3s ease;
|
|
23
|
+
transition: all 0.3s ease;
|
|
24
24
|
|
|
25
25
|
.nf-layer-enter & {
|
|
26
26
|
opacity: 1;
|
|
@@ -46,13 +46,15 @@ class Dialog extends React.Component {
|
|
|
46
46
|
this.onCloseFn = closeCallback;
|
|
47
47
|
};
|
|
48
48
|
this.close = (resp) => {
|
|
49
|
-
|
|
49
|
+
var _a;
|
|
50
|
+
(_a = this.closeDialog) === null || _a === void 0 ? void 0 : _a.call(this, resp);
|
|
50
51
|
};
|
|
51
52
|
this.closeCallback = (resp) => {
|
|
53
|
+
var _a;
|
|
52
54
|
this.setState({
|
|
53
55
|
show: false,
|
|
54
56
|
});
|
|
55
|
-
this.onCloseFn
|
|
57
|
+
(_a = this.onCloseFn) === null || _a === void 0 ? void 0 : _a.call(this, resp);
|
|
56
58
|
};
|
|
57
59
|
}
|
|
58
60
|
shouldComponentUpdate(nextProps, nextState) {
|
|
@@ -68,7 +70,7 @@ class Dialog extends React.Component {
|
|
|
68
70
|
closeCallback: this.closeCallback,
|
|
69
71
|
closeOnOverlayClick,
|
|
70
72
|
position: LAYER_POSITION.DIALOG,
|
|
71
|
-
component: (_jsx(DialogContainer, Object.assign({}, rest, { onClick: e => e.stopPropagation(), elevated: true, children: children })))
|
|
73
|
+
component: (_jsx(DialogContainer, Object.assign({}, rest, { onClick: (e) => e.stopPropagation(), elevated: true, children: children }))),
|
|
72
74
|
});
|
|
73
75
|
this.closeDialog = closeFn;
|
|
74
76
|
return _jsx(Component, {});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Dialog.js","sourceRoot":"","sources":["../../../src/components/Dialog/Dialog.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,SAAS,MAAM,YAAY,CAAC;AACnC,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,YAAY,EAAE,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AACzE,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAE/B,MAAM,CAAC,MAAM,eAAe,GAAG,MAAM,CAAC,IAAI,CAAC,CAAA;;;;;;;;;;;;;;;;CAgB1C,CAAC;AAEF,OAAO,EACH,MAAM,IAAI,YAAY,EACtB,IAAI,IAAI,UAAU,EAClB,MAAM,IAAI,YAAY,GACzB,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"Dialog.js","sourceRoot":"","sources":["../../../src/components/Dialog/Dialog.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,SAAS,MAAM,YAAY,CAAC;AACnC,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,YAAY,EAAE,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AACzE,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAE/B,MAAM,CAAC,MAAM,eAAe,GAAG,MAAM,CAAC,IAAI,CAAC,CAAA;;;;;;;;;;;;;;;;CAgB1C,CAAC;AAEF,OAAO,EACH,MAAM,IAAI,YAAY,EACtB,IAAI,IAAI,UAAU,EAClB,MAAM,IAAI,YAAY,GACzB,MAAM,qBAAqB,CAAC;AAQ7B,MAAM,MAAO,SAAQ,KAAK,CAAC,SAA8D;IAAzF;;QAgBI,UAAK,GAAG;YACJ,IAAI,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ACJ,CAAC,CAAC;YACH,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC;YAC3B,OAAO,KAAC,SAAS,KAAG,CAAC;QACzB,CAAC;aAAM,CAAC;YACJ,OAAO,IAAI,CAAC;QAChB,CAAC;IACL,CAAC;;AA/DM,gBAAS,GAAG;IACf,kEAAkE;IAClE,UAAU,EAAE,SAAS,CAAC,IAAI;IAC1B,6DAA6D;IAC7D,mBAAmB,EAAE,SAAS,CAAC,IAAI;CACtC,AALe,CAKd;AAEK,mBAAY,GAAG;IAClB,UAAU,EAAE,IAAI;IAChB,mBAAmB,EAAE,IAAI;CAC5B,AAHkB,CAGjB;AAwDN,eAAe,MAAM,CAAC"}
|
|
@@ -2,9 +2,9 @@ import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
|
2
2
|
import React, { createRef } from 'react';
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
4
|
import styled from '@emotion/styled';
|
|
5
|
-
import Dialog, { DialogHeader, DialogBody, DialogFooter } from './Dialog';
|
|
6
5
|
import { Button, ActionButton } from '../Button';
|
|
7
6
|
import { Input } from '../Input';
|
|
7
|
+
import Dialog, { DialogHeader, DialogBody, DialogFooter } from './Dialog';
|
|
8
8
|
const BodyText = styled.p `
|
|
9
9
|
margin-top: 0;
|
|
10
10
|
`;
|
|
@@ -44,7 +44,7 @@ class PromptDialog extends React.Component {
|
|
|
44
44
|
}
|
|
45
45
|
render() {
|
|
46
46
|
const { header, body, inputProps, submitText, cancelText, dialogProps } = this.props;
|
|
47
|
-
return (_jsx(Dialog, Object.assign({}, dialogProps, { ref: this.dialog, closeOnEsc: false, closeOnOverlayClick: false, children: _jsxs("form", { onSubmit: this.submit, children: [header && _jsx(DialogHeader, { children: header }), _jsxs(DialogBody, { children: [_jsx(BodyText, { children: body }), _jsx("div", { style: { display: 'flex' }, children: _jsx(Input, Object.assign({ style: { width: 'auto', flex: '1' }, value: this.state.value, onChange: this.valueChange
|
|
47
|
+
return (_jsx(Dialog, Object.assign({}, dialogProps, { ref: this.dialog, closeOnEsc: false, closeOnOverlayClick: false, children: _jsxs("form", { onSubmit: this.submit, children: [header && _jsx(DialogHeader, { children: header }), _jsxs(DialogBody, { children: [_jsx(BodyText, { children: body }), _jsx("div", { style: { display: 'flex' }, children: _jsx(Input, Object.assign({ style: { width: 'auto', flex: '1' }, value: this.state.value, onChange: this.valueChange }, inputProps)) })] }), _jsxs(DialogFooter, { children: [_jsx(Button, { type: "button", onClick: this.cancel, children: cancelText }), _jsx(ActionButton, { children: submitText })] })] }) })));
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
50
|
PromptDialog.propTypes = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PromptDialog.js","sourceRoot":"","sources":["../../../src/components/Dialog/PromptDialog.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACzC,OAAO,SAAS,MAAM,YAAY,CAAC;AACnC,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"PromptDialog.js","sourceRoot":"","sources":["../../../src/components/Dialog/PromptDialog.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACzC,OAAO,SAAS,MAAM,YAAY,CAAC;AACnC,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACjC,OAAO,MAAM,EAAE,EAAE,YAAY,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAI1E,MAAM,QAAQ,GAAG,MAAM,CAAC,CAAC,CAAA;;CAExB,CAAC;AAEF,MAAqB,YAAa,SAAQ,KAAK,CAAC,SAA0C;IAwBtF,YAAY,KAAm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E;CACnB,AAJkB,CAIjB;eAtBe,YAAY"}
|
|
@@ -7,11 +7,38 @@ type DragAndDropProps = {
|
|
|
7
7
|
onDrop: (start: number, end: number) => void;
|
|
8
8
|
/** Shows drag indicator against each list item */
|
|
9
9
|
showIndicator: boolean;
|
|
10
|
-
} & PropsWithChildren<
|
|
10
|
+
} & PropsWithChildren<unknown>;
|
|
11
|
+
/**
|
|
12
|
+
* A drag and drop container component that enables reordering of child elements.
|
|
13
|
+
*
|
|
14
|
+
* @component
|
|
15
|
+
* @example
|
|
16
|
+
* ```tsx
|
|
17
|
+
* <DragAndDrop
|
|
18
|
+
* orientation={ORIENTATION.VERTICAL}
|
|
19
|
+
* onDrop={(start, end) => handleReorder(start, end)}
|
|
20
|
+
* showIndicator={true}
|
|
21
|
+
* >
|
|
22
|
+
* <div>Item 1</div>
|
|
23
|
+
* <div>Item 2</div>
|
|
24
|
+
* <div>Item 3</div>
|
|
25
|
+
* </DragAndDrop>
|
|
26
|
+
* ```
|
|
27
|
+
*
|
|
28
|
+
* @param {DragAndDropProps} props - The component props
|
|
29
|
+
* @param {ORIENTATION} props.orientation - Determines the layout direction (horizontal or vertical). Defaults to VERTICAL.
|
|
30
|
+
* @param {(start: number, end: number) => void} props.onDrop - Callback fired when an item is dropped, receives the start and end indices
|
|
31
|
+
* @param {boolean} props.showIndicator - Whether to display drag indicators for each list item. Defaults to false.
|
|
32
|
+
* @param {React.ReactNode} props.children - Child elements to be rendered as draggable items
|
|
33
|
+
*
|
|
34
|
+
* @returns {JSX.Element} A draggable container with reorderable items
|
|
35
|
+
*/
|
|
11
36
|
declare function DragAndDrop(props: DragAndDropProps): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
12
37
|
declare namespace DragAndDrop {
|
|
13
38
|
var defaultProps: {
|
|
39
|
+
/** Orientation of the list layout */
|
|
14
40
|
orientation: ORIENTATION;
|
|
41
|
+
/** Whether to display drag indicators for each list item */
|
|
15
42
|
showIndicator: boolean;
|
|
16
43
|
};
|
|
17
44
|
}
|
|
@@ -3,23 +3,61 @@ import React, { useState } from 'react';
|
|
|
3
3
|
import styled from '@emotion/styled';
|
|
4
4
|
import DragItem from './DragItem';
|
|
5
5
|
import { ORIENTATION, DragContext } from './types';
|
|
6
|
+
/** Container Component */
|
|
6
7
|
const Container = styled.div `
|
|
7
8
|
flex: 1;
|
|
8
9
|
display: flex;
|
|
9
10
|
position: relative;
|
|
10
|
-
flex-
|
|
11
|
+
flex-wrap: wrap;
|
|
12
|
+
flex-direction: ${(props) => (props.orientation === ORIENTATION.HORIZONTAL ? 'row' : 'column')};
|
|
11
13
|
`;
|
|
14
|
+
/**
|
|
15
|
+
* A drag and drop container component that enables reordering of child elements.
|
|
16
|
+
*
|
|
17
|
+
* @component
|
|
18
|
+
* @example
|
|
19
|
+
* ```tsx
|
|
20
|
+
* <DragAndDrop
|
|
21
|
+
* orientation={ORIENTATION.VERTICAL}
|
|
22
|
+
* onDrop={(start, end) => handleReorder(start, end)}
|
|
23
|
+
* showIndicator={true}
|
|
24
|
+
* >
|
|
25
|
+
* <div>Item 1</div>
|
|
26
|
+
* <div>Item 2</div>
|
|
27
|
+
* <div>Item 3</div>
|
|
28
|
+
* </DragAndDrop>
|
|
29
|
+
* ```
|
|
30
|
+
*
|
|
31
|
+
* @param {DragAndDropProps} props - The component props
|
|
32
|
+
* @param {ORIENTATION} props.orientation - Determines the layout direction (horizontal or vertical). Defaults to VERTICAL.
|
|
33
|
+
* @param {(start: number, end: number) => void} props.onDrop - Callback fired when an item is dropped, receives the start and end indices
|
|
34
|
+
* @param {boolean} props.showIndicator - Whether to display drag indicators for each list item. Defaults to false.
|
|
35
|
+
* @param {React.ReactNode} props.children - Child elements to be rendered as draggable items
|
|
36
|
+
*
|
|
37
|
+
* @returns {JSX.Element} A draggable container with reorderable items
|
|
38
|
+
*/
|
|
12
39
|
export default function DragAndDrop(props) {
|
|
13
40
|
const { orientation, children, onDrop, showIndicator } = props;
|
|
14
41
|
const [startIndex, setStartIndex] = useState(null);
|
|
42
|
+
const [isDragging, setIsDragging] = useState(false);
|
|
43
|
+
const [dragOver, setDragOver] = useState(null);
|
|
44
|
+
/**
|
|
45
|
+
* Drop handler invoked when a draggable item is released.
|
|
46
|
+
* @param index
|
|
47
|
+
*/
|
|
15
48
|
const drop = (index) => {
|
|
16
|
-
startIndex !== null
|
|
49
|
+
if (startIndex !== null) {
|
|
50
|
+
onDrop === null || onDrop === void 0 ? void 0 : onDrop(startIndex, index);
|
|
51
|
+
}
|
|
17
52
|
setStartIndex(null);
|
|
53
|
+
setIsDragging(false);
|
|
18
54
|
};
|
|
19
|
-
return (_jsx(DragContext.Provider, { value: { startIndex, setStartIndex, drop }, children: _jsx(Container, { orientation: orientation, children: React.Children.map(children, (child, index) => (_jsx(DragItem, { index: index, orientation: orientation, showIndicator: showIndicator, children: child }))) }) }));
|
|
55
|
+
return (_jsx(DragContext.Provider, { value: { startIndex, setStartIndex, drop, isDragging, setIsDragging, setDragOver }, children: _jsx(Container, { orientation: orientation, children: React.Children.map(children, (child, index) => (_jsx(DragItem, { index: index, orientation: orientation, showIndicator: showIndicator, dragOver: dragOver, children: child }))) }) }));
|
|
20
56
|
}
|
|
21
57
|
DragAndDrop.defaultProps = {
|
|
58
|
+
/** Orientation of the list layout */
|
|
22
59
|
orientation: ORIENTATION.VERTICAL,
|
|
60
|
+
/** Whether to display drag indicators for each list item */
|
|
23
61
|
showIndicator: false,
|
|
24
62
|
};
|
|
25
63
|
//# sourceMappingURL=DragAndDrop.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DragAndDrop.js","sourceRoot":"","sources":["../../../src/components/DragAndDrop/DragAndDrop.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,EAAqB,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC3D,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,QAAQ,MAAM,YAAY,CAAC;AAClC,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE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ACpB,aAAa,CAAC,KAAK,CAAC,CAAC;IACzB,CAAC,CAAC;IAEF,OAAO,CACH,KAAC,WAAW,CAAC,QAAQ,IACjB,KAAK,EAAE,EAAE,UAAU,EAAE,aAAa,EAAE,IAAI,EAAE,UAAU,EAAE,aAAa,EAAE,WAAW,EAAE,YAElF,KAAC,SAAS,IAAC,WAAW,EAAE,WAAW,YAC9B,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,CAAC,CAC5C,KAAC,QAAQ,IACL,KAAK,EAAE,KAAK,EACZ,WAAW,EAAE,WAAW,EACxB,aAAa,EAAE,aAAa,EAC5B,QAAQ,EAAE,QAAQ,YAEjB,KAAK,GACC,CACd,CAAC,GACM,GACO,CAC1B,CAAC;AACN,CAAC;AAED,WAAW,CAAC,YAAY,GAAG;IACvB,qCAAqC;IACrC,WAAW,EAAE,WAAW,CAAC,QAAQ;IACjC,4DAA4D;IAC5D,aAAa,EAAE,KAAK;CACvB,CAAC"}
|
|
@@ -1,9 +1,46 @@
|
|
|
1
1
|
import { PropsWithChildren } from 'react';
|
|
2
2
|
import { ORIENTATION } from './types';
|
|
3
3
|
interface DragItemProps {
|
|
4
|
+
/** Position index of the draggable item */
|
|
4
5
|
index: number;
|
|
6
|
+
/** Orientation of the drag operation (VERTICAL or HORIZONTAL) */
|
|
5
7
|
orientation: ORIENTATION;
|
|
8
|
+
/** Whether to show a drag handle indicator instead of making the entire item draggable */
|
|
6
9
|
showIndicator: boolean;
|
|
10
|
+
/** The index of the item currently being dragged over */
|
|
11
|
+
dragOver: number;
|
|
7
12
|
}
|
|
13
|
+
/**
|
|
14
|
+
* A draggable item component that supports both mouse and touch interactions for drag-and-drop functionality.
|
|
15
|
+
*
|
|
16
|
+
* @component
|
|
17
|
+
* @example
|
|
18
|
+
* ```tsx
|
|
19
|
+
* <DragItem
|
|
20
|
+
* index={0}
|
|
21
|
+
* orientation={ORIENTATION.VERTICAL}
|
|
22
|
+
* showIndicator={true}
|
|
23
|
+
* dragOver={-1}
|
|
24
|
+
* >
|
|
25
|
+
* <div>Draggable content</div>
|
|
26
|
+
* </DragItem>
|
|
27
|
+
* ```
|
|
28
|
+
*
|
|
29
|
+
* @param props - The component props
|
|
30
|
+
* @param props.index - The position index of this item in the draggable list
|
|
31
|
+
* @param props.orientation - The orientation of the drag operation (VERTICAL or HORIZONTAL)
|
|
32
|
+
* @param props.showIndicator - Whether to show a drag handle indicator instead of making the entire item draggable
|
|
33
|
+
* @param props.dragOver - The index of the item currently being dragged over
|
|
34
|
+
* @param props.children - The content to be rendered inside the draggable item
|
|
35
|
+
*
|
|
36
|
+
* @remarks
|
|
37
|
+
* - Uses the DragContext to manage drag state across items
|
|
38
|
+
* - Provides visual feedback with borders during drag operations
|
|
39
|
+
* - Supports haptic feedback (vibration) on touch devices
|
|
40
|
+
* - For touch devices, requires a 200ms hold before drag starts
|
|
41
|
+
* - When showIndicator is true, only the drag handle can initiate drag operations
|
|
42
|
+
*
|
|
43
|
+
* @returns A draggable item with optional drag indicator and visual feedback
|
|
44
|
+
*/
|
|
8
45
|
export default function DragItem(props: PropsWithChildren<DragItemProps>): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
9
46
|
export {};
|
|
@@ -1,49 +1,195 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
2
|
-
import { useContext, useState } from 'react';
|
|
2
|
+
import { useContext, useState, useEffect, } from 'react';
|
|
3
3
|
import styled from '@emotion/styled';
|
|
4
|
+
import { DragIndicator } from '../../icons';
|
|
4
5
|
import constants from '../../shared/constants';
|
|
5
6
|
import { ORIENTATION, DragContext } from './types';
|
|
6
|
-
|
|
7
|
+
/** Styled component for the draggable item container */
|
|
7
8
|
const Item = styled.div `
|
|
8
|
-
cursor: ${props => props.showIndicator ? 'default' : 'move'};
|
|
9
|
+
cursor: ${(props) => (props.showIndicator ? 'default' : 'move')};
|
|
9
10
|
display: flex;
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
? constants.PRIMARY
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
? constants.PRIMARY
|
|
11
|
+
user-select: ${(props) => (props.showIndicator ? 'auto' : 'none')};
|
|
12
|
+
border-top: 2px solid
|
|
13
|
+
${(props) => props.orientation === ORIENTATION.VERTICAL && props.active > 0
|
|
14
|
+
? constants.PRIMARY
|
|
15
|
+
: 'transparent'};
|
|
16
|
+
border-bottom: 2px solid
|
|
17
|
+
${(props) => props.orientation === ORIENTATION.VERTICAL && props.active < 0
|
|
18
|
+
? constants.PRIMARY
|
|
19
|
+
: 'transparent'};
|
|
20
|
+
border-left: 2px solid
|
|
21
|
+
${(props) => props.orientation === ORIENTATION.HORIZONTAL && props.active > 0
|
|
22
|
+
? constants.PRIMARY
|
|
23
|
+
: 'transparent'};
|
|
24
|
+
border-right: 2px solid
|
|
25
|
+
${(props) => props.orientation === ORIENTATION.HORIZONTAL && props.active < 0
|
|
26
|
+
? constants.PRIMARY
|
|
27
|
+
: 'transparent'};
|
|
28
|
+
opacity: ${(props) => (props.dragging ? 0.5 : 1)};
|
|
18
29
|
`;
|
|
30
|
+
/** Styled component for the drag handle indicator */
|
|
19
31
|
const DragKnob = styled.div `
|
|
20
32
|
padding-top: 8px;
|
|
21
33
|
cursor: move;
|
|
34
|
+
touch-action: none;
|
|
22
35
|
color: var(--disabled, ${constants.DISABLED});
|
|
23
36
|
`;
|
|
37
|
+
/** Container for the children */
|
|
24
38
|
const Container = styled.div `
|
|
25
39
|
flex: 1;
|
|
26
40
|
`;
|
|
41
|
+
/**
|
|
42
|
+
* A draggable item component that supports both mouse and touch interactions for drag-and-drop functionality.
|
|
43
|
+
*
|
|
44
|
+
* @component
|
|
45
|
+
* @example
|
|
46
|
+
* ```tsx
|
|
47
|
+
* <DragItem
|
|
48
|
+
* index={0}
|
|
49
|
+
* orientation={ORIENTATION.VERTICAL}
|
|
50
|
+
* showIndicator={true}
|
|
51
|
+
* dragOver={-1}
|
|
52
|
+
* >
|
|
53
|
+
* <div>Draggable content</div>
|
|
54
|
+
* </DragItem>
|
|
55
|
+
* ```
|
|
56
|
+
*
|
|
57
|
+
* @param props - The component props
|
|
58
|
+
* @param props.index - The position index of this item in the draggable list
|
|
59
|
+
* @param props.orientation - The orientation of the drag operation (VERTICAL or HORIZONTAL)
|
|
60
|
+
* @param props.showIndicator - Whether to show a drag handle indicator instead of making the entire item draggable
|
|
61
|
+
* @param props.dragOver - The index of the item currently being dragged over
|
|
62
|
+
* @param props.children - The content to be rendered inside the draggable item
|
|
63
|
+
*
|
|
64
|
+
* @remarks
|
|
65
|
+
* - Uses the DragContext to manage drag state across items
|
|
66
|
+
* - Provides visual feedback with borders during drag operations
|
|
67
|
+
* - Supports haptic feedback (vibration) on touch devices
|
|
68
|
+
* - For touch devices, requires a 200ms hold before drag starts
|
|
69
|
+
* - When showIndicator is true, only the drag handle can initiate drag operations
|
|
70
|
+
*
|
|
71
|
+
* @returns A draggable item with optional drag indicator and visual feedback
|
|
72
|
+
*/
|
|
27
73
|
export default function DragItem(props) {
|
|
28
|
-
const { index, orientation, children, showIndicator } = props;
|
|
74
|
+
const { index, orientation, children, showIndicator, dragOver } = props;
|
|
29
75
|
const [active, setActive] = useState(0);
|
|
76
|
+
const [touchTimer, setTouchTimer] = useState(null);
|
|
30
77
|
const context = useContext(DragContext);
|
|
31
|
-
|
|
78
|
+
/**
|
|
79
|
+
* Vibrate the device for haptic feedback
|
|
80
|
+
* @param duration Duration of the vibration in milliseconds
|
|
81
|
+
*/
|
|
82
|
+
const vibrate = (duration) => {
|
|
83
|
+
if (navigator.vibrate) {
|
|
84
|
+
navigator.vibrate(duration);
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
/**
|
|
88
|
+
* Drag start event handler
|
|
89
|
+
* @param e Event
|
|
90
|
+
*/
|
|
91
|
+
const dragStartHandler = () => {
|
|
32
92
|
context.setStartIndex(index);
|
|
93
|
+
context.setIsDragging(true);
|
|
33
94
|
};
|
|
95
|
+
/**
|
|
96
|
+
* Drag over event handler
|
|
97
|
+
* @param e Event
|
|
98
|
+
*/
|
|
34
99
|
const dragOverHandler = (e) => {
|
|
35
100
|
e.preventDefault();
|
|
36
101
|
e.stopPropagation();
|
|
37
102
|
setActive(context.startIndex - index);
|
|
38
103
|
};
|
|
104
|
+
/**
|
|
105
|
+
* Drag leave event handler
|
|
106
|
+
*/
|
|
39
107
|
const dragExitHandler = () => {
|
|
40
108
|
setActive(0);
|
|
41
109
|
};
|
|
110
|
+
/**
|
|
111
|
+
* Drop event handler
|
|
112
|
+
* @param e Event
|
|
113
|
+
*/
|
|
42
114
|
const dropHandler = (e) => {
|
|
43
115
|
e.preventDefault();
|
|
44
116
|
setActive(0);
|
|
45
117
|
context.drop(index);
|
|
118
|
+
context.setIsDragging(false);
|
|
119
|
+
};
|
|
120
|
+
/**
|
|
121
|
+
* Touch start event handler
|
|
122
|
+
* @param e Event
|
|
123
|
+
*/
|
|
124
|
+
const touchStartHandler = () => {
|
|
125
|
+
const timer = setTimeout(() => {
|
|
126
|
+
context.setStartIndex(index);
|
|
127
|
+
context.setIsDragging(true);
|
|
128
|
+
context.setDragOver(index);
|
|
129
|
+
document.body.style.overflow = 'hidden';
|
|
130
|
+
vibrate(50);
|
|
131
|
+
}, 200);
|
|
132
|
+
setTouchTimer(timer);
|
|
133
|
+
};
|
|
134
|
+
/**
|
|
135
|
+
* Touch move event handler
|
|
136
|
+
* @param e Event
|
|
137
|
+
* @returns void
|
|
138
|
+
*/
|
|
139
|
+
const touchMoveHandler = (e) => {
|
|
140
|
+
var _a;
|
|
141
|
+
const touch = e.touches[0];
|
|
142
|
+
if (!touch)
|
|
143
|
+
return;
|
|
144
|
+
if (context.isDragging) {
|
|
145
|
+
e.preventDefault();
|
|
146
|
+
// get the element under the touch point
|
|
147
|
+
const el = document.elementFromPoint(touch.clientX, touch.clientY);
|
|
148
|
+
const overAttr = (_a = el === null || el === void 0 ? void 0 : el.closest('[data-drag-index]')) === null || _a === void 0 ? void 0 : _a.getAttribute('data-drag-index');
|
|
149
|
+
const overIndex = overAttr != null ? parseInt(overAttr, 10) : null;
|
|
150
|
+
// if we know which index we're over, update visual state
|
|
151
|
+
if (overIndex !== null) {
|
|
152
|
+
context.setDragOver(overIndex);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
else if (touchTimer) {
|
|
156
|
+
clearTimeout(touchTimer);
|
|
157
|
+
setTouchTimer(null);
|
|
158
|
+
}
|
|
159
|
+
};
|
|
160
|
+
/**
|
|
161
|
+
* Touch end event handler
|
|
162
|
+
* @param e Event
|
|
163
|
+
*/
|
|
164
|
+
const touchEndHandler = () => {
|
|
165
|
+
if (touchTimer) {
|
|
166
|
+
clearTimeout(touchTimer);
|
|
167
|
+
setTouchTimer(null);
|
|
168
|
+
}
|
|
169
|
+
if (context.isDragging) {
|
|
170
|
+
context.drop(dragOver);
|
|
171
|
+
vibrate(50);
|
|
172
|
+
context.setIsDragging(false);
|
|
173
|
+
document.body.style.overflow = 'auto';
|
|
174
|
+
}
|
|
46
175
|
};
|
|
47
|
-
|
|
176
|
+
/** Cleanup touch timer on unmount */
|
|
177
|
+
useEffect(() => {
|
|
178
|
+
return () => {
|
|
179
|
+
if (touchTimer)
|
|
180
|
+
clearTimeout(touchTimer);
|
|
181
|
+
document.body.style.overflow = 'auto';
|
|
182
|
+
};
|
|
183
|
+
}, [touchTimer]);
|
|
184
|
+
/** Update active state based on dragOver changes */
|
|
185
|
+
useEffect(() => {
|
|
186
|
+
if (context.isDragging && dragOver === index) {
|
|
187
|
+
setActive(context.startIndex - index);
|
|
188
|
+
}
|
|
189
|
+
else {
|
|
190
|
+
setActive(0);
|
|
191
|
+
}
|
|
192
|
+
}, [dragOver, context.startIndex, index, context.isDragging]);
|
|
193
|
+
return (_jsxs(Item, { draggable: !showIndicator, showIndicator: showIndicator, active: active, dragging: context.isDragging && context.startIndex === index, orientation: orientation, "data-drag-index": index, onDragStart: !showIndicator ? dragStartHandler : undefined, onDragOver: dragOverHandler, onDragLeave: dragExitHandler, onDrop: dropHandler, onTouchStart: !showIndicator ? touchStartHandler : undefined, onTouchMove: touchMoveHandler, onTouchEnd: touchEndHandler, onTouchCancel: touchEndHandler, children: [showIndicator && (_jsx(DragKnob, { draggable: true, onDragStart: dragStartHandler, onTouchStart: touchStartHandler, children: _jsx(DragIndicator, {}) })), _jsx(Container, { children: children })] }));
|
|
48
194
|
}
|
|
49
195
|
//# sourceMappingURL=DragItem.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DragItem.js","sourceRoot":"","sources":["../../../src/components/DragAndDrop/DragItem.tsx"],"names":[],"mappings":";AAAA,
|
|
1
|
+
{"version":3,"file":"DragItem.js","sourceRoot":"","sources":["../../../src/components/DragAndDrop/DragItem.tsx"],"names":[],"mappings":";AAAA,OAAO,EAGH,UAAU,EACV,QAAQ,EACR,SAAS,GAEZ,MAAM,OAAO,CAAC;AACf,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,SAAS,MAAM,wBAAwB,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAanD,wDAAwD;AACxD,MAAM,IAAI,GAAG,MAAM,CAAC,GAAG,CAKrB;cACY,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC;;mBAEhD,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC;;UAE3D,CAAC,KAAK,EAAE,EAAE,CACR,KAAK,CAAC,WAAW,KAAK,WAAW,CAAC,QAAQ,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC;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C1D,UAAU,EAAE,eAAe,EAC3B,WAAW,EAAE,eAAe,EAC5B,MAAM,EAAE,WAAW,EACnB,YAAY,EAAE,CAAC,aAAa,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,SAAS,EAC5D,WAAW,EAAE,gBAAgB,EAC7B,UAAU,EAAE,eAAe,EAC3B,aAAa,EAAE,eAAe,aAE7B,aAAa,IAAI,CACd,KAAC,QAAQ,IAAC,SAAS,QAAC,WAAW,EAAE,gBAAgB,EAAE,YAAY,EAAE,iBAAiB,YAC9E,KAAC,aAAa,KAAG,GACV,CACd,EACD,KAAC,SAAS,cAAE,QAAQ,GAAa,IAC9B,CACV,CAAC;AACN,CAAC"}
|
|
@@ -6,4 +6,7 @@ export declare const DragContext: import("react").Context<{
|
|
|
6
6
|
startIndex: number;
|
|
7
7
|
setStartIndex: (value: number) => void;
|
|
8
8
|
drop: (index: number) => void;
|
|
9
|
+
isDragging: boolean;
|
|
10
|
+
setIsDragging: (value: boolean) => void;
|
|
11
|
+
setDragOver: (value: number) => void;
|
|
9
12
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/components/DragAndDrop/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAEtC,MAAM,CAAN,IAAY,WAGX;AAHD,WAAY,WAAW;IACnB,
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/components/DragAndDrop/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAEtC,MAAM,CAAN,IAAY,WAGX;AAHD,WAAY,WAAW;IACnB,wCAAyB,CAAA;IACzB,oCAAqB,CAAA;AACzB,CAAC,EAHW,WAAW,KAAX,WAAW,QAGtB;AAED,MAAM,CAAC,MAAM,WAAW,GAAG,aAAa,CAOrC,IAAI,CAAC,CAAC"}
|
|
@@ -13,8 +13,8 @@ import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
|
13
13
|
import React from 'react';
|
|
14
14
|
import PropTypes from 'prop-types';
|
|
15
15
|
import styled from '@emotion/styled';
|
|
16
|
-
import LayerManager, { LAYER_POSITION } from '../../shared/LayerManager';
|
|
17
16
|
import constants from '../../shared/constants';
|
|
17
|
+
import LayerManager, { LAYER_POSITION } from '../../shared/LayerManager';
|
|
18
18
|
export { Header as DrawerHeader, Body as DrawerBody, Footer as DrawerFooter, } from '../../shared/styles';
|
|
19
19
|
export var DRAWER_POSITION;
|
|
20
20
|
(function (DRAWER_POSITION) {
|
|
@@ -47,13 +47,13 @@ const DrawerDiv = styled.div `
|
|
|
47
47
|
display: flex;
|
|
48
48
|
flex-direction: column;
|
|
49
49
|
background-color: #fff;
|
|
50
|
-
transition: transform .3s ease;
|
|
50
|
+
transition: transform 0.3s ease;
|
|
51
51
|
box-shadow: var(--modal-shadow, ${constants.MODAL_SHADOW});
|
|
52
|
-
${props => positionStyle(props.size)[props.position].before}
|
|
52
|
+
${(props) => positionStyle(props.size)[props.position].before}
|
|
53
53
|
|
|
54
54
|
.nf-layer-enter & {
|
|
55
55
|
transform: translateX(0%);
|
|
56
|
-
${props => positionStyle(props.size)[props.position].after}
|
|
56
|
+
${(props) => positionStyle(props.size)[props.position].after}
|
|
57
57
|
}
|
|
58
58
|
`;
|
|
59
59
|
const positionMap = {
|
|
@@ -68,10 +68,11 @@ class Drawer extends React.Component {
|
|
|
68
68
|
open: false,
|
|
69
69
|
};
|
|
70
70
|
this.onClose = () => {
|
|
71
|
+
var _a, _b;
|
|
71
72
|
this.setState({
|
|
72
73
|
open: false,
|
|
73
74
|
});
|
|
74
|
-
this.props.onClose
|
|
75
|
+
(_b = (_a = this.props).onClose) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
75
76
|
this.closeCallback = null;
|
|
76
77
|
this.layer = null;
|
|
77
78
|
};
|
|
@@ -85,9 +86,10 @@ class Drawer extends React.Component {
|
|
|
85
86
|
return null;
|
|
86
87
|
}
|
|
87
88
|
getSnapshotBeforeUpdate(prevProps) {
|
|
88
|
-
|
|
89
|
+
var _a;
|
|
90
|
+
const _b = this.props, { open, closeOnEsc, closeOnOverlayClick, overlay, position, children, size } = _b, rest = __rest(_b, ["open", "closeOnEsc", "closeOnOverlayClick", "overlay", "position", "children", "size"]);
|
|
89
91
|
if (prevProps.open && !open) {
|
|
90
|
-
this.closeCallback
|
|
92
|
+
(_a = this.closeCallback) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
91
93
|
}
|
|
92
94
|
if (!prevProps.open && open) {
|
|
93
95
|
this.layer = LayerManager.renderLayer({
|
|
@@ -97,7 +99,7 @@ class Drawer extends React.Component {
|
|
|
97
99
|
closeCallback: this.onClose,
|
|
98
100
|
closeOnEsc,
|
|
99
101
|
closeOnOverlayClick,
|
|
100
|
-
component: (_jsx(DrawerDiv, Object.assign({}, rest, { position: position, size: size, onClick: e => e.stopPropagation(), children: children })))
|
|
102
|
+
component: (_jsx(DrawerDiv, Object.assign({}, rest, { position: position, size: size, onClick: (e) => e.stopPropagation(), children: children }))),
|
|
101
103
|
});
|
|
102
104
|
this.closeCallback = this.layer[1];
|
|
103
105
|
this.forceUpdate();
|