dara-components 1.24.1__py3-none-any.whl → 1.24.3__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.
@@ -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
- setShow(false);
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
  },
@@ -24,7 +24,7 @@ from dara.components.common.base_component import (
24
24
  )
25
25
  from dara.components.common.text import Text
26
26
  from dara.core.definitions import discover
27
- from dara.core.interactivity import AnyVariable, DerivedVariable, Variable
27
+ from dara.core.interactivity import ClientVariable
28
28
 
29
29
 
30
30
  @deprecated('Use `dara.core.Link` instead')
@@ -66,12 +66,12 @@ class Anchor(ModifierComponent):
66
66
  clean: bool = False
67
67
  new_tab: bool = False
68
68
 
69
- def __init__(self, child: ContentComponent | str | Variable[str] | DerivedVariable[str], **kwargs):
70
- if isinstance(child, (ContentComponent, Variable, DerivedVariable, str)) is False:
69
+ def __init__(self, child: ContentComponent | str | ClientVariable, **kwargs):
70
+ if isinstance(child, ContentComponent | ClientVariable | str) is False:
71
71
  raise LayoutError(f'Only a single ContentComponent may be passed as an Anchors child, passed : {child}')
72
72
 
73
73
  # Handle a string or Variable being passed directly to an anchor
74
- if isinstance(child, (str, AnyVariable)):
74
+ if isinstance(child, str | ClientVariable):
75
75
  child = Text(child)
76
76
  parsed_args: list[ContentComponent] = [child]
77
77
  super().__init__(*parsed_args, **kwargs)
@@ -22,7 +22,7 @@ from pydantic import field_validator
22
22
  from dara.components.common.base_component import FormComponent
23
23
  from dara.components.common.utils import Item
24
24
  from dara.core.base_definitions import Action
25
- from dara.core.interactivity import ClientVariable, Variable
25
+ from dara.core.interactivity import ClientVariable
26
26
 
27
27
 
28
28
  class CheckboxGroup(FormComponent):
@@ -101,7 +101,7 @@ class CheckboxGroup(FormComponent):
101
101
  select_max: int | None = None
102
102
  select_min: int | None = None
103
103
  list_styling: bool = False
104
- value: Variable[Any] | None = None
104
+ value: ClientVariable | None = None
105
105
  onchange: Action | None = None
106
106
  id: str | None = None
107
107
 
@@ -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
@@ -18,7 +18,7 @@ limitations under the License.
18
18
  from dara.components.common.base_component import ModifierComponent
19
19
  from dara.components.common.stack import Stack
20
20
  from dara.core.definitions import ComponentInstance
21
- from dara.core.interactivity import DerivedVariable, Variable
21
+ from dara.core.interactivity import ClientVariable
22
22
 
23
23
 
24
24
  class Tooltip(ModifierComponent):
@@ -72,14 +72,14 @@ class Tooltip(ModifierComponent):
72
72
  :param styling: Defines the style of the tooltip, can be 'default' or 'error'
73
73
  """
74
74
 
75
- content: str | ComponentInstance | Variable[str] | DerivedVariable[str]
75
+ content: str | ComponentInstance | ClientVariable
76
76
  placement: str = 'auto'
77
77
  styling: str = 'default'
78
78
 
79
79
  def __init__(
80
80
  self,
81
81
  *components: ComponentInstance | None,
82
- content: str | ComponentInstance | Variable[str] | DerivedVariable[str],
82
+ content: str | ComponentInstance | ClientVariable,
83
83
  placement: str = 'auto',
84
84
  styling: str = 'default',
85
85
  **kwargs,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: dara-components
3
- Version: 1.24.1
3
+ Version: 1.24.3
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.1)
18
+ Requires-Dist: dara-core (==1.24.3)
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.1/img/dara_light.svg?raw=true">
30
+ <img src="https://github.com/causalens/dara/blob/v1.24.3/img/dara_light.svg?raw=true">
31
31
 
32
32
  ![Master tests](https://github.com/causalens/dara/actions/workflows/tests.yml/badge.svg?branch=master)
33
33
  [![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](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=YqCQAkLhP2I8H9LzDOrTaQVRrzqGarYBg9XTkMnRSpI,7038674
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
@@ -15,14 +15,14 @@ dara/components/_assets/common/pixi_viewport.js,sha256=X4X1cEPLpY7EHQfs0lCNsBdH9
15
15
  dara/components/_assets/common/plotly.min.js,sha256=8zGRhYASzyY8qHO4GcXnQFU4GD_j0OGm17Pld4Z7zDc,3608773
16
16
  dara/components/common/__init__.py,sha256=amZWLKVUsq987chihQxzNj40WyspcbBEtEqR0mTZ_pA,4076
17
17
  dara/components/common/accordion.py,sha256=EIPxycpE7E1C-ihiVpazEgJIinfHqKeb-Ig4kvU2Pgs,9367
18
- dara/components/common/anchor.py,sha256=SlC9DXUyTsCrfbgspfXTLeGkLQpkvrU7aGcWIJHC7jc,2825
18
+ dara/components/common/anchor.py,sha256=nFFQydCxI76ZzYnBvZGHVAydMIRrfd8DnYmrJSSzY3k,2770
19
19
  dara/components/common/base_component.py,sha256=6TzcQN7VKgSDUvTVCKGkSLHCx55eRG31gZhN1uzFfYE,4584
20
20
  dara/components/common/bullet_list.py,sha256=sZsyi8lIprvi1s4QX2ukrhBECwdgR2Yu9eHkLOgd0j4,1396
21
21
  dara/components/common/button.py,sha256=v8WSqTf4ma4_ewSSGuWoL2auwXGXRIKfSDUEaTB565Y,5301
22
22
  dara/components/common/button_bar.py,sha256=4Vi9vOyCsxyRYvd76vdX9Esu4tpX2ByJYiQS1zgiEHg,3777
23
23
  dara/components/common/card.py,sha256=Pk3rQr9UHQSW9_GJfdLoSzkMFRqSCKRl1OMxG3UghrE,2042
24
24
  dara/components/common/carousel.py,sha256=ijakwE4AXaYB1MpcVT19NW487LaleV6hvveyDylSjLA,5303
25
- dara/components/common/checkbox_group.py,sha256=9sHSzwwh3cngR7yi7MtBWEAUExUuIOdcWsecu2WQmd4,4227
25
+ dara/components/common/checkbox_group.py,sha256=ca355rxVuC7X5qOm4HHogrgPA5vrS77ZR9Zo0o3OiiU,4218
26
26
  dara/components/common/code.py,sha256=XsoWeq_PUX_DsCES_n6S4zjsANIJP-PJeIa67aM8GfE,2298
27
27
  dara/components/common/component_select_list.py,sha256=mSKZF4Ur2-8rB-pkbDATMgsYRsI91K4h_VUEvQjtZGQ,2589
28
28
  dara/components/common/datepicker.py,sha256=I739gvGTkIgE_THwtd-3LsbA9H1MHchMESfVMmzBE5A,3613
@@ -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=3qah5c0wBxqLyQoYLqNslzJ-IlPKBzyY3IvcwgCgXUw,1524
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
@@ -54,7 +54,7 @@ dara/components/common/table.py,sha256=A-PMzw2-Ri6yS5lwSubyfPa99U-8I1CVJ8MxNh9OA
54
54
  dara/components/common/text.py,sha256=IP8m2lpYkF0UoW4HIgEBCeqvi1wjeR5dO_Ydf03lvM0,1942
55
55
  dara/components/common/textarea.py,sha256=F0rOUHx7kVJM1BTrTq6BFnLUAN8P0OnlyTudvR0B2Qk,2084
56
56
  dara/components/common/time_utils.py,sha256=lB6ncnukBE1-pxz3F7pw0QLGrAiNCCELvBfRI49f-Rc,1717
57
- dara/components/common/tooltip.py,sha256=ZUl9zcQOLh689OWjqhKuSRp86oJHhigxf9zY4DNrsl8,3244
57
+ dara/components/common/tooltip.py,sha256=dMR397xIqt584CawCk6xnK_sxYEUcT3UMxKA3odRSwc,3189
58
58
  dara/components/common/utils.py,sha256=vkCHKW6t2ObcrzQpxnTNffoJa_rcbF8eQXfuQzgq03o,5430
59
59
  dara/components/graphs/__init__.py,sha256=xN6ibodsLvO_ATXASRgwfzCLraoWqdKuaGovWRaGxtk,750
60
60
  dara/components/graphs/components/__init__.py,sha256=GdWwL5spSsATOU57EmMqOf6t7az1rP5S3Djd0eyL9As,1007
@@ -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.1.dist-info/LICENSE,sha256=r9u1w2RvpLMV6YjuXHIKXRBKzia3fx_roPwboGcLqCc,10944
97
- dara_components-1.24.1.dist-info/METADATA,sha256=yx8IgGmIICagx3juT81v_3napZAMriI-PM-Z_oDCtb8,2687
98
- dara_components-1.24.1.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
99
- dara_components-1.24.1.dist-info/entry_points.txt,sha256=QsM8eFLf60NfKyKgE4vstwyaDuuFXgqqgHaLdcsnhnk,70
100
- dara_components-1.24.1.dist-info/RECORD,,
96
+ dara_components-1.24.3.dist-info/LICENSE,sha256=r9u1w2RvpLMV6YjuXHIKXRBKzia3fx_roPwboGcLqCc,10944
97
+ dara_components-1.24.3.dist-info/METADATA,sha256=uiV8J8CoBlLqPlKXsXspwuEVYWPl7APVcDaxMEapV7E,2687
98
+ dara_components-1.24.3.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
99
+ dara_components-1.24.3.dist-info/entry_points.txt,sha256=QsM8eFLf60NfKyKgE4vstwyaDuuFXgqqgHaLdcsnhnk,70
100
+ dara_components-1.24.3.dist-info/RECORD,,