dara-components 1.24.0__py3-none-any.whl → 1.24.2__py3-none-any.whl
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.
- dara/components/_assets/auto_js/dara.components.umd.js +8 -1
- dara/components/common/modal.py +35 -0
- {dara_components-1.24.0.dist-info → dara_components-1.24.2.dist-info}/METADATA +3 -3
- {dara_components-1.24.0.dist-info → dara_components-1.24.2.dist-info}/RECORD +7 -7
- {dara_components-1.24.0.dist-info → dara_components-1.24.2.dist-info}/LICENSE +0 -0
- {dara_components-1.24.0.dist-info → dara_components-1.24.2.dist-info}/WHEEL +0 -0
- {dara_components-1.24.0.dist-info → dara_components-1.24.2.dist-info}/entry_points.txt +0 -0
|
@@ -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
|
},
|
dara/components/common/modal.py
CHANGED
|
@@ -16,6 +16,7 @@ limitations under the License.
|
|
|
16
16
|
"""
|
|
17
17
|
|
|
18
18
|
from dara.components.common.base_component import LayoutComponent
|
|
19
|
+
from dara.core.base_definitions import Action
|
|
19
20
|
from dara.core.interactivity import ClientVariable
|
|
20
21
|
|
|
21
22
|
|
|
@@ -42,9 +43,43 @@ class Modal(LayoutComponent):
|
|
|
42
43
|
|
|
43
44
|
```
|
|
44
45
|
|
|
46
|
+
A modal can also be closed by an external event, for example by clicking outside the modal.
|
|
47
|
+
To run something when this happens, you can pass an `on_attempt_close` action.
|
|
48
|
+
When you pass this action, the modal will not close automatically when the external event happens, it is up to the action to decide whether to close the modal.
|
|
49
|
+
You can also pass an `on_closed` action to run something when the modal has finished closing and has unmounted.
|
|
50
|
+
|
|
51
|
+
```python
|
|
52
|
+
from dara.core.interactivity import ActionCtx, action
|
|
53
|
+
from dara.components.common import Modal, Text
|
|
54
|
+
|
|
55
|
+
show = Variable(True)
|
|
56
|
+
|
|
57
|
+
@action
|
|
58
|
+
async def on_attempt_close(ctx: ActionCtx):
|
|
59
|
+
print('Modal attempting to close')
|
|
60
|
+
ctx.update(show, False)
|
|
61
|
+
|
|
62
|
+
@action
|
|
63
|
+
async def on_closed(ctx: ActionCtx):
|
|
64
|
+
print('Modal closed')
|
|
65
|
+
|
|
66
|
+
Modal(
|
|
67
|
+
Text('Test Text'),
|
|
68
|
+
show=show,
|
|
69
|
+
on_attempt_close=on_attempt_close(),
|
|
70
|
+
on_closed=on_closed()
|
|
71
|
+
)
|
|
72
|
+
|
|
73
|
+
```
|
|
74
|
+
|
|
45
75
|
:param show: Boolean Variable instance recording the state, if True it renders the model and it's children
|
|
76
|
+
:param on_attempt_close: An optional event listener for if an external event (e.g. esc key) tries to close the modal, it's up to the
|
|
77
|
+
parent component to decide whether to close the modal. if not passed, by default the modal will set the show variable to False.
|
|
78
|
+
:param on_closed: A handler that's called when the modal has finished closing and has unmounted
|
|
46
79
|
:param justify: How to justify the content of the modal, accepts any flexbox justifications
|
|
47
80
|
:param align: How to align the content of the modal, accepts any flexbox alignments
|
|
48
81
|
"""
|
|
49
82
|
|
|
50
83
|
show: ClientVariable
|
|
84
|
+
on_attempt_close: Action | None = None
|
|
85
|
+
on_closed: Action | None = None
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: dara-components
|
|
3
|
-
Version: 1.24.
|
|
3
|
+
Version: 1.24.2
|
|
4
4
|
Summary: Components for the Dara Framework
|
|
5
5
|
Home-page: https://dara.causalens.com/
|
|
6
6
|
License: Apache-2.0
|
|
@@ -15,7 +15,7 @@ Classifier: Programming Language :: Python :: 3.12
|
|
|
15
15
|
Requires-Dist: bokeh (==3.1.1)
|
|
16
16
|
Requires-Dist: cai-causal-graph (>=0.3.6)
|
|
17
17
|
Requires-Dist: certifi (>=2024.7.4)
|
|
18
|
-
Requires-Dist: dara-core (==1.24.
|
|
18
|
+
Requires-Dist: dara-core (==1.24.2)
|
|
19
19
|
Requires-Dist: dill (>=0.3.0,<0.4.0)
|
|
20
20
|
Requires-Dist: matplotlib (>=2.0.0)
|
|
21
21
|
Requires-Dist: pandas (>=1.1.0,<3.0.0)
|
|
@@ -27,7 +27,7 @@ Description-Content-Type: text/markdown
|
|
|
27
27
|
|
|
28
28
|
# Dara Components
|
|
29
29
|
|
|
30
|
-
<img src="https://github.com/causalens/dara/blob/v1.24.
|
|
30
|
+
<img src="https://github.com/causalens/dara/blob/v1.24.2/img/dara_light.svg?raw=true">
|
|
31
31
|
|
|
32
32
|

|
|
33
33
|
[](https://www.apache.org/licenses/LICENSE-2.0)
|
|
@@ -2,7 +2,7 @@ dara/components/__init__.py,sha256=C_FZGdU_DrybumO2aVYEpVmSJ00WnDtVxWjlvv_HRJ8,1
|
|
|
2
2
|
dara/components/_assets/__init__.py,sha256=WRWzSRHxObpPhbIJZ1R28PMkNvQeaz_mtcGyCDleUrQ,863
|
|
3
3
|
dara/components/_assets/auto_js/.gitkeep,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
4
4
|
dara/components/_assets/auto_js/dara.components.css,sha256=Qm0_kcxXBDoXvvPTc7YCttkl1zMFifdcp-KufTunPNY,162729
|
|
5
|
-
dara/components/_assets/auto_js/dara.components.umd.js,sha256=
|
|
5
|
+
dara/components/_assets/auto_js/dara.components.umd.js,sha256=iLMg_ulGJu6u7kfKb8Yu2IIPzKc_pdsa3c0lgmoZs4A,7038965
|
|
6
6
|
dara/components/_assets/common/bokeh-3.1.1.min.js,sha256=MbVmD3ArfHv5QtlTZlkO9QQOXQjGD1BD24RAfo9Cm3k,942380
|
|
7
7
|
dara/components/_assets/common/bokeh-api-3.1.1.min.js,sha256=mXZVlXj0uhFbxfm1E4g7vSkPABdBFP1ws0FLRTYSZwc,118248
|
|
8
8
|
dara/components/_assets/common/bokeh-gl-3.1.1.min.js,sha256=XzGw14TvTGCtZsW2mXMD5Ro2fVMkKk380eMyqwQN1rQ,194368
|
|
@@ -39,7 +39,7 @@ dara/components/common/image.py,sha256=ErDZ4Fv0_OzjbuqhNDDL_Nz1Q9Dq4wM7Q5aYJslCg
|
|
|
39
39
|
dara/components/common/input.py,sha256=SPQBsekvCJRr3wbeDoA_vhWlufM0SjuaiNInPxSSPtI,2013
|
|
40
40
|
dara/components/common/label.py,sha256=2wR5AWI4q8PeNbdBzNBZHmp_fM4X6GX0Ct9QfgKJ478,2477
|
|
41
41
|
dara/components/common/markdown.py,sha256=E7HZuzOEgCZ0A77zLcQMijC55eF68smlNpm1dUEKsNM,1665
|
|
42
|
-
dara/components/common/modal.py,sha256=
|
|
42
|
+
dara/components/common/modal.py,sha256=Ddepj4treLf_d-y8j3nLDXr5z2rLV80jSwhcmH512ys,3001
|
|
43
43
|
dara/components/common/overlay.py,sha256=Po-v9oGk6cJlOyRw0JhilBdSSP3eIqd6MhuoB4-KTEQ,1802
|
|
44
44
|
dara/components/common/paragraph.py,sha256=nOw-ocgjVwPj_QP8CmSHs2y3ghStTmOPGlqWx2UNMNg,2316
|
|
45
45
|
dara/components/common/progress_bar.py,sha256=x3k3IZjqwMEKgXWNaBqZIQqe96d8Pgrp84QX9uM5G6U,1873
|
|
@@ -93,8 +93,8 @@ dara/components/smart/data_slicer/utils/core.py,sha256=lRONw6kGZRlISvdOIfud9eUVt
|
|
|
93
93
|
dara/components/smart/data_slicer/utils/data_preview.py,sha256=-j77RuYWOJNQpZwEgb2iryA42DEgabq1Q8IXHkOUUe8,1697
|
|
94
94
|
dara/components/smart/data_slicer/utils/plotting.py,sha256=TB00576kbA6y1eRuZBe09UAcZmluY4iJsKmYnXZ3hWQ,3389
|
|
95
95
|
dara/components/smart/hierarchy.py,sha256=Q05GVG81ykwWdXcol9mqxopIrWwhhvwtT5TRF-A1j98,2871
|
|
96
|
-
dara_components-1.24.
|
|
97
|
-
dara_components-1.24.
|
|
98
|
-
dara_components-1.24.
|
|
99
|
-
dara_components-1.24.
|
|
100
|
-
dara_components-1.24.
|
|
96
|
+
dara_components-1.24.2.dist-info/LICENSE,sha256=r9u1w2RvpLMV6YjuXHIKXRBKzia3fx_roPwboGcLqCc,10944
|
|
97
|
+
dara_components-1.24.2.dist-info/METADATA,sha256=DD2MeNlrv3YOZtQfX4QnUekzbMcsPFoB_u3Ak5-GiqA,2687
|
|
98
|
+
dara_components-1.24.2.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
|
99
|
+
dara_components-1.24.2.dist-info/entry_points.txt,sha256=QsM8eFLf60NfKyKgE4vstwyaDuuFXgqqgHaLdcsnhnk,70
|
|
100
|
+
dara_components-1.24.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|