@darajs/components 1.24.1 → 1.24.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/dist/common/modal/modal.d.ts +10 -1
- package/dist/common/modal/modal.d.ts.map +1 -1
- package/dist/common/modal/modal.js +10 -3
- package/dist/common/modal/modal.js.map +1 -1
- package/dist/{dara_components-1.24.1-py3-none-any.whl → dara_components-1.24.2-py3-none-any.whl} +0 -0
- package/dist/umd/dara.components.umd.js +8 -1
- package/package.json +12 -12
|
@@ -1,9 +1,18 @@
|
|
|
1
|
-
import { type ComponentInstance, type LayoutComponentProps, type Variable } from '@darajs/core';
|
|
1
|
+
import { type Action, type ComponentInstance, type LayoutComponentProps, type Variable } from '@darajs/core';
|
|
2
2
|
interface ModalProps extends LayoutComponentProps {
|
|
3
3
|
/** The children to be rendered within the modal */
|
|
4
4
|
children: Array<ComponentInstance>;
|
|
5
5
|
/** The show flag, tells the modal whether or not to display */
|
|
6
6
|
show: Variable<boolean>;
|
|
7
|
+
/**
|
|
8
|
+
* An optional event listener for if an external event (e.g. esc key) tries to close the modal, it's up to the
|
|
9
|
+
* parent component to decide whether to close the modal
|
|
10
|
+
*/
|
|
11
|
+
on_attempt_close?: Action;
|
|
12
|
+
/**
|
|
13
|
+
* A handler that's called when the modal has finished closing and has unmounted
|
|
14
|
+
*/
|
|
15
|
+
on_closed?: Action;
|
|
7
16
|
}
|
|
8
17
|
/**
|
|
9
18
|
* The modal component accepts a set of children and renders them within a modal depending on the value of the render flag.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"modal.d.ts","sourceRoot":"","sources":["../../../js/common/modal/modal.tsx"],"names":[],"mappings":"AAAA,OAAO,EACH,KAAK,iBAAiB,EAEtB,KAAK,oBAAoB,EACzB,KAAK,QAAQ,
|
|
1
|
+
{"version":3,"file":"modal.d.ts","sourceRoot":"","sources":["../../../js/common/modal/modal.tsx"],"names":[],"mappings":"AAAA,OAAO,EACH,KAAK,MAAM,EACX,KAAK,iBAAiB,EAEtB,KAAK,oBAAoB,EACzB,KAAK,QAAQ,EAKhB,MAAM,cAAc,CAAC;AAGtB,UAAU,UAAW,SAAQ,oBAAoB;IAC7C,mDAAmD;IACnD,QAAQ,EAAE,KAAK,CAAC,iBAAiB,CAAC,CAAC;IACnC,+DAA+D;IAC/D,IAAI,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAC;IACxB;;;OAGG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB;AAID;;;;GAIG;AACH,iBAAS,KAAK,CAAC,KAAK,EAAE,UAAU,GAAG,GAAG,CAAC,OAAO,CA4B7C;AAED,eAAe,KAAK,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { DynamicComponent, injectCss, useComponentStyles, useVariable, } from '@darajs/core';
|
|
2
|
+
import { DynamicComponent, injectCss, useAction, useComponentStyles, useVariable, } from '@darajs/core';
|
|
3
3
|
import { Modal as UiModal } from '@darajs/ui-components';
|
|
4
4
|
const StyledModal = injectCss(UiModal);
|
|
5
5
|
/**
|
|
@@ -8,12 +8,19 @@ const StyledModal = injectCss(UiModal);
|
|
|
8
8
|
* @param props the component props
|
|
9
9
|
*/
|
|
10
10
|
function Modal(props) {
|
|
11
|
+
const onAttemptCloseAction = useAction(props.on_attempt_close);
|
|
12
|
+
const onClosedAction = useAction(props.on_closed);
|
|
11
13
|
const [style, css] = useComponentStyles(props, false);
|
|
12
14
|
const [show, setShow] = useVariable(props.show);
|
|
13
15
|
function onAttemptClose() {
|
|
14
|
-
|
|
16
|
+
if (props.on_attempt_close) {
|
|
17
|
+
onAttemptCloseAction();
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
setShow(false);
|
|
21
|
+
}
|
|
15
22
|
}
|
|
16
|
-
return (_jsx(StyledModal, { id: props.id_, "$rawCss": css, onAttemptClose: onAttemptClose, render: show, style: Object.assign({ alignItems: props.align, gap: '0.75rem', justifyContent: props.justify }, style), children: props.children.map((child, idx) => (_jsx(DynamicComponent, { component: child }, `modal-${idx}-${child.uid}`))) }));
|
|
23
|
+
return (_jsx(StyledModal, { id: props.id_, "$rawCss": css, onAttemptClose: onAttemptClose, onClosed: props.on_closed ? onClosedAction : undefined, render: show, style: Object.assign({ alignItems: props.align, gap: '0.75rem', justifyContent: props.justify }, style), children: props.children.map((child, idx) => (_jsx(DynamicComponent, { component: child }, `modal-${idx}-${child.uid}`))) }));
|
|
17
24
|
}
|
|
18
25
|
export default Modal;
|
|
19
26
|
//# sourceMappingURL=modal.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"modal.js","sourceRoot":"","sources":["../../../js/common/modal/modal.tsx"],"names":[],"mappings":";AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"modal.js","sourceRoot":"","sources":["../../../js/common/modal/modal.tsx"],"names":[],"mappings":";AAAA,OAAO,EAGH,gBAAgB,EAGhB,SAAS,EACT,SAAS,EACT,kBAAkB,EAClB,WAAW,GACd,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,KAAK,IAAI,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAkBzD,MAAM,WAAW,GAAG,SAAS,CAAC,OAAO,CAAC,CAAC;AAEvC;;;;GAIG;AACH,SAAS,KAAK,CAAC,KAAiB;IAC5B,MAAM,oBAAoB,GAAG,SAAS,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC;IAC/D,MAAM,cAAc,GAAG,SAAS,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;IAClD,MAAM,CAAC,KAAK,EAAE,GAAG,CAAC,GAAG,kBAAkB,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IACtD,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,WAAW,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAEhD,SAAS,cAAc;QACnB,IAAI,KAAK,CAAC,gBAAgB,EAAE,CAAC;YACzB,oBAAoB,EAAE,CAAC;QAC3B,CAAC;aAAM,CAAC;YACJ,OAAO,CAAC,KAAK,CAAC,CAAC;QACnB,CAAC;IACL,CAAC;IAED,OAAO,CACH,KAAC,WAAW,IACR,EAAE,EAAE,KAAK,CAAC,GAAG,aACJ,GAAG,EACZ,cAAc,EAAE,cAAc,EAC9B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,SAAS,EACtD,MAAM,EAAE,IAAI,EACZ,KAAK,kBAAI,UAAU,EAAE,KAAK,CAAC,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,cAAc,EAAE,KAAK,CAAC,OAAO,IAAK,KAAK,aAExF,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE,CAAC,CAChC,KAAC,gBAAgB,IAAC,SAAS,EAAE,KAAK,IAAO,SAAS,GAAG,IAAI,KAAK,CAAC,GAAG,EAAE,CAAI,CAC3E,CAAC,GACQ,CACjB,CAAC;AACN,CAAC;AAED,eAAe,KAAK,CAAC"}
|
package/dist/{dara_components-1.24.1-py3-none-any.whl → dara_components-1.24.2-py3-none-any.whl}
RENAMED
|
Binary file
|
|
@@ -62162,10 +62162,16 @@ You must set sticky: 'left' | 'right' for the '${bugWithUnderColumnsSticky.Heade
|
|
|
62162
62162
|
}
|
|
62163
62163
|
const StyledModal = core$1.injectCss(Modal$1);
|
|
62164
62164
|
function Modal(props) {
|
|
62165
|
+
const onAttemptCloseAction = core$1.useAction(props.on_attempt_close);
|
|
62166
|
+
const onClosedAction = core$1.useAction(props.on_closed);
|
|
62165
62167
|
const [style2, css2] = core$1.useComponentStyles(props, false);
|
|
62166
62168
|
const [show, setShow] = core$1.useVariable(props.show);
|
|
62167
62169
|
function onAttemptClose() {
|
|
62168
|
-
|
|
62170
|
+
if (props.on_attempt_close) {
|
|
62171
|
+
onAttemptCloseAction();
|
|
62172
|
+
} else {
|
|
62173
|
+
setShow(false);
|
|
62174
|
+
}
|
|
62169
62175
|
}
|
|
62170
62176
|
return /* @__PURE__ */ React.createElement(
|
|
62171
62177
|
StyledModal,
|
|
@@ -62173,6 +62179,7 @@ You must set sticky: 'left' | 'right' for the '${bugWithUnderColumnsSticky.Heade
|
|
|
62173
62179
|
id: props.id_,
|
|
62174
62180
|
$rawCss: css2,
|
|
62175
62181
|
onAttemptClose,
|
|
62182
|
+
onClosed: props.on_closed ? onClosedAction : void 0,
|
|
62176
62183
|
render: show,
|
|
62177
62184
|
style: { alignItems: props.align, gap: "0.75rem", justifyContent: props.justify, ...style2 }
|
|
62178
62185
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@darajs/components",
|
|
3
|
-
"version": "1.24.
|
|
3
|
+
"version": "1.24.2",
|
|
4
4
|
"description": "Components for the Dara framework",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -30,9 +30,9 @@
|
|
|
30
30
|
"prettier": "@darajs/prettier-config",
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@babel/core": "^7.23.5",
|
|
33
|
-
"@darajs/eslint-config": "1.24.
|
|
34
|
-
"@darajs/prettier-config": "1.24.
|
|
35
|
-
"@darajs/stylelint-config": "1.24.
|
|
33
|
+
"@darajs/eslint-config": "1.24.2",
|
|
34
|
+
"@darajs/prettier-config": "1.24.2",
|
|
35
|
+
"@darajs/stylelint-config": "1.24.2",
|
|
36
36
|
"@testing-library/react-hooks": "^3.4.2",
|
|
37
37
|
"@types/lodash": "^4.14.155",
|
|
38
38
|
"@types/prop-types": "^15.7.15",
|
|
@@ -68,13 +68,13 @@
|
|
|
68
68
|
"@codemirror/state": "^6.0.0",
|
|
69
69
|
"@codemirror/theme-one-dark": "^6.1.2",
|
|
70
70
|
"@codemirror/view": "^6.0.0",
|
|
71
|
-
"@darajs/core": "1.24.
|
|
72
|
-
"@darajs/styled-components": "1.24.
|
|
73
|
-
"@darajs/ui-causal-graph-editor": "1.24.
|
|
74
|
-
"@darajs/ui-components": "1.24.
|
|
75
|
-
"@darajs/ui-hierarchy-viewer": "1.24.
|
|
76
|
-
"@darajs/ui-icons": "1.24.
|
|
77
|
-
"@darajs/ui-utils": "1.24.
|
|
71
|
+
"@darajs/core": "1.24.2",
|
|
72
|
+
"@darajs/styled-components": "1.24.2",
|
|
73
|
+
"@darajs/ui-causal-graph-editor": "1.24.2",
|
|
74
|
+
"@darajs/ui-components": "1.24.2",
|
|
75
|
+
"@darajs/ui-hierarchy-viewer": "1.24.2",
|
|
76
|
+
"@darajs/ui-icons": "1.24.2",
|
|
77
|
+
"@darajs/ui-utils": "1.24.2",
|
|
78
78
|
"@lezer/highlight": "^1.2.1",
|
|
79
79
|
"@lezer/json": "^1.0.3",
|
|
80
80
|
"@lezer/lr": "^1.4.2",
|
|
@@ -101,5 +101,5 @@
|
|
|
101
101
|
"publishConfig": {
|
|
102
102
|
"access": "public"
|
|
103
103
|
},
|
|
104
|
-
"gitHead": "
|
|
104
|
+
"gitHead": "f81ec04bedaaa6752f13e33604a219a73b2a8106"
|
|
105
105
|
}
|