dara-components 1.21.12__py3-none-any.whl → 1.21.14__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.
@@ -17,6 +17,7 @@ limitations under the License.
17
17
  # ruff: noqa: F401, F403
18
18
 
19
19
  from importlib.metadata import version
20
+ from inspect import isclass
20
21
 
21
22
  from pydantic import BaseModel
22
23
 
@@ -33,7 +34,7 @@ __version__ = version('dara-components')
33
34
 
34
35
  for symbol in list(globals().values()):
35
36
  try:
36
- if issubclass(symbol, BaseModel) and symbol is not BaseModel:
37
+ if isclass(symbol) and issubclass(symbol, BaseModel) and symbol is not BaseModel:
37
38
  symbol.model_rebuild()
38
39
  except Exception as e:
39
40
  from dara.core.logging import dev_logger
@@ -110,6 +110,10 @@ class Button(LayoutComponent):
110
110
  ```
111
111
 
112
112
  :param disabled: A variable, condition, or bool to disabled the button when true
113
+ :param loading: A variable, condition, or bool to set the button to a loading state, showing a spinner.
114
+ By default, the button will automatically be set to loading=True while the onclick action is running,
115
+ equivalent to `Button(..., onclick=my_action, loading=my_action.loading)`. You can opt out of this behaviour by
116
+ simply setting `loading=False`.
113
117
  :param onclick: An Action that is triggered by clicking the button
114
118
  :param icon: An optional icon to display, see dara.core.css.get_icon for details
115
119
  :param styling: A style of the button, can be 'primary', 'secondary', 'error', 'plain' or 'ghost'
@@ -120,6 +124,7 @@ class Button(LayoutComponent):
120
124
  """
121
125
 
122
126
  disabled: Optional[Union[Condition, ClientVariable, bool]] = None
127
+ loading: Optional[Union[Condition, ClientVariable, bool]] = None
123
128
  onclick: Optional[Action] = None
124
129
  icon: Optional[str] = None
125
130
  styling: Optional[ButtonStyle] = None
@@ -16,7 +16,7 @@ limitations under the License.
16
16
  """
17
17
 
18
18
  from enum import Enum
19
- from typing import Any, List, Literal, Optional, Sequence, Union
19
+ from typing import Any, ClassVar, List, Literal, Optional, Sequence, Union
20
20
 
21
21
  from fastapi.encoders import jsonable_encoder
22
22
  from pandas import DataFrame
@@ -47,6 +47,9 @@ class TableFormatterType(Enum):
47
47
  THRESHOLD = 'threshold'
48
48
 
49
49
 
50
+ TFormatterType = type[TableFormatterType]
51
+
52
+
50
53
  class TableFormatterCompareCondition(Enum):
51
54
  EQUAL = 'equal'
52
55
 
@@ -58,6 +61,9 @@ class TableFilter(Enum):
58
61
  DATETIME = 'datetime'
59
62
 
60
63
 
64
+ TFilterType = type[TableFilter]
65
+
66
+
61
67
  class Column(BaseModel):
62
68
  """
63
69
  Internal representation of a Table column, required for serialization to work correctly
@@ -862,8 +868,8 @@ class Table(ContentComponent):
862
868
  max_rows: Optional[int] = None
863
869
  suppress_click_events_for_selection: Optional[bool] = False
864
870
 
865
- TableFormatterType = TableFormatterType
866
- TableFilter = TableFilter
871
+ TableFormatterType: ClassVar[TFormatterType] = TableFormatterType
872
+ TableFilter: ClassVar[TFilterType] = TableFilter
867
873
 
868
874
  @field_validator('data')
869
875
  @classmethod
@@ -15,7 +15,7 @@ See the License for the specific language governing permissions and
15
15
  limitations under the License.
16
16
  """
17
17
 
18
- from typing import Any, Dict, List, Optional, Union
18
+ from typing import Any, ClassVar, Dict, List, Optional, Union
19
19
 
20
20
  from pydantic import field_validator
21
21
 
@@ -36,7 +36,7 @@ class Node(BaseModel):
36
36
  name: str
37
37
  meta: Optional[NodeMeta] = None
38
38
 
39
- Meta = NodeMeta
39
+ Meta: ClassVar[type[NodeMeta]] = NodeMeta
40
40
 
41
41
 
42
42
  class NodeHierarchyBuilder(StyledComponentInstance):
@@ -16,7 +16,7 @@ limitations under the License.
16
16
  """
17
17
 
18
18
  from enum import Enum
19
- from typing import Any, List, Optional
19
+ from typing import Any, ClassVar, List, Optional
20
20
 
21
21
  import plotly.graph_objects as go
22
22
  import plotly.io as pio
@@ -114,8 +114,8 @@ class Plotly(StyledComponentInstance):
114
114
  figure: str
115
115
  events: Optional[List[PlotlyEvent]] = None
116
116
 
117
- EventName = PlotlyEventName
118
- Event = PlotlyEvent
117
+ EventName: ClassVar[type[PlotlyEventName]] = PlotlyEventName
118
+ Event: ClassVar[type[PlotlyEvent]] = PlotlyEvent
119
119
 
120
120
  model_config = ConfigDict(
121
121
  arbitrary_types_allowed=True,
@@ -51941,11 +51941,13 @@ You must set sticky: 'left' | 'right' for the '${bugWithUnderColumnsSticky.Heade
51941
51941
  const StyledButton$1 = core$1.injectCss(G(Button$4)`
51942
51942
  flex: ${(props) => props.isSimpleButton ? void 0 : "1 1 100%"};
51943
51943
  `);
51944
- function Button({ children: children2, className, disabled: disabled2, icon, onclick, outline, styling, ...props }, ref) {
51944
+ function Button({ children: children2, className, disabled: disabled2, icon, onclick, outline, styling, loading, ...props }, ref) {
51945
51945
  const [style2, css2] = core$1.useComponentStyles(props);
51946
51946
  const onClick = core$1.useAction(onclick);
51947
- const loading = core$1.useActionIsLoading(onclick);
51947
+ const actionLoading = core$1.useActionIsLoading(onclick);
51948
51948
  const disabledValue = core$1.useConditionOrVariable(disabled2);
51949
+ const propLoading = core$1.useConditionOrVariable(loading);
51950
+ const loadingValue = loading === null || loading === void 0 ? actionLoading : propLoading;
51949
51951
  const Icon2 = icon ? core$1.getIcon(icon) : null;
51950
51952
  const iconColor = Array.isArray(children2) ? children2?.[0]?.props?.color || "inherit" : "inherit";
51951
51953
  return /* @__PURE__ */ React__namespace.createElement(
@@ -51956,7 +51958,7 @@ You must set sticky: 'left' | 'right' for the '${bugWithUnderColumnsSticky.Heade
51956
51958
  className,
51957
51959
  disabled: disabledValue,
51958
51960
  isSimpleButton: typeof children2 === "string" || children2[0]?.name === "Text",
51959
- loading,
51961
+ loading: loadingValue,
51960
51962
  onClick: (e3) => {
51961
51963
  if (props.stop_click_propagation !== false) {
51962
51964
  e3.stopPropagation();
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: dara-components
3
- Version: 1.21.12
3
+ Version: 1.21.14
4
4
  Summary: Components for the Dara Framework
5
5
  Home-page: https://dara.causalens.com/
6
6
  License: Apache-2.0
@@ -16,7 +16,7 @@ Classifier: Programming Language :: Python :: 3.12
16
16
  Requires-Dist: bokeh (>=3.1.0,<3.2.0)
17
17
  Requires-Dist: cai-causal-graph (>=0.3.6)
18
18
  Requires-Dist: certifi (>=2024.7.4)
19
- Requires-Dist: dara-core (==1.21.12)
19
+ Requires-Dist: dara-core (==1.21.14)
20
20
  Requires-Dist: dill (>=0.3.0,<0.4.0)
21
21
  Requires-Dist: matplotlib (>=2.0.0)
22
22
  Requires-Dist: pandas (>=1.1.0,<3.0.0)
@@ -28,7 +28,7 @@ Description-Content-Type: text/markdown
28
28
 
29
29
  # Dara Components
30
30
 
31
- <img src="https://github.com/causalens/dara/blob/v1.21.12/img/dara_light.svg?raw=true">
31
+ <img src="https://github.com/causalens/dara/blob/v1.21.14/img/dara_light.svg?raw=true">
32
32
 
33
33
  ![Master tests](https://github.com/causalens/dara/actions/workflows/tests.yml/badge.svg?branch=master)
34
34
  [![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://www.apache.org/licenses/LICENSE-2.0)
@@ -1,10 +1,10 @@
1
- dara/components/__init__.py,sha256=JjN7EAGU-tM7I7YHyKRAuZlcbpJFcVcFaGit5StehDs,1372
1
+ dara/components/__init__.py,sha256=C_FZGdU_DrybumO2aVYEpVmSJ00WnDtVxWjlvv_HRJ8,1420
2
2
  dara/components/common/__init__.py,sha256=amZWLKVUsq987chihQxzNj40WyspcbBEtEqR0mTZ_pA,4076
3
3
  dara/components/common/accordion.py,sha256=_JQGdhtC97YlV3_MUydeXTN7rKJFsWHy2JQzq_c0CXU,9498
4
4
  dara/components/common/anchor.py,sha256=ceN-6Vc0ekWz9VrFkFChO_Hm-FGMI1nMc9DJBAv9hnc,2877
5
5
  dara/components/common/base_component.py,sha256=rUFmLbe8DHL8S_ey5h93zuIP62cK26zknWwUF5eqp9I,4619
6
6
  dara/components/common/bullet_list.py,sha256=yk4lFAn6Bzx9UByp27P7ioVidAfsTPl5d4hIkG7MRkQ,1433
7
- dara/components/common/button.py,sha256=MIiQ6KSyO6z13kHd7lHAoxQeAGVYguYELLStw3JwBz0,4907
7
+ dara/components/common/button.py,sha256=DhB-qgh46_vmoEVbxItYI5onMum_60hatyAUmOSoHWk,5351
8
8
  dara/components/common/button_bar.py,sha256=3_q6ccopXP0Gx_wdsGnejU6oN8D98lsOyQKBNhx-AQA,3802
9
9
  dara/components/common/card.py,sha256=-_14Um86g_VQVLcCXDv-PpfkiH_pN68J4ZIcZ4lp3kY,2102
10
10
  dara/components/common/carousel.py,sha256=T-d4w2pF9wB5sNsXe2i3rEfiZoRZJd5D4jVD9ctw-Qk,5344
@@ -36,7 +36,7 @@ dara/components/common/spacer.py,sha256=ZRSl_fLntnumalaL41FYpBKDxOUgWgndkkLdDLl8
36
36
  dara/components/common/stack.py,sha256=FLw0IbQpW7l9A6LDS_KPCeQP0J7QKGYhVZ1RhAjBjpE,5562
37
37
  dara/components/common/switch.py,sha256=8t3Bra3TdJzQ3fEdra0e8xNJSoDFAy6x8OlaxYddFhY,1548
38
38
  dara/components/common/tabbed_card.py,sha256=S7m09fBNFR64UG9STcF1w-FriRZ3uKzif9W7q_Xro6E,2342
39
- dara/components/common/table.py,sha256=H_M_FJ65VyAUKtOR-o8Etg_YSRXNHTc4lzh9ZG3cZfo,30064
39
+ dara/components/common/table.py,sha256=-rzvtm_s0hhd7oScPotZu7buKLQ1EfGVhDtf2nZWPhg,30201
40
40
  dara/components/common/text.py,sha256=f-Dvo5vfuOauMlut-L1Jided2dxy8VrUuij6DVa5BZo,1986
41
41
  dara/components/common/textarea.py,sha256=F8dmyinylAjjXMhNwfiWInrCFuAnWuCPTsKKiEUkmOw,2106
42
42
  dara/components/common/time_utils.py,sha256=UbAws5HBptJ-xH-m4QRDDET-9leOQu9WdywmExBuqIc,1746
@@ -47,7 +47,7 @@ dara/components/graphs/components/__init__.py,sha256=GdWwL5spSsATOU57EmMqOf6t7az
47
47
  dara/components/graphs/components/base_graph_component.py,sha256=-joDvAQ0Ybvj6fiDevGlGNysMlbKpOJlHLbX7iWDbFs,4430
48
48
  dara/components/graphs/components/causal_graph_viewer.py,sha256=oQpvW_Vb9xE-gAF7JFOpPU_4kukXSPcZZ7BBLqX3y0Y,12439
49
49
  dara/components/graphs/components/edge_encoder.py,sha256=P75YnABZHIFvQ8y6sUMiyRKTtVD_gU3QyDgbESbBms8,6926
50
- dara/components/graphs/components/node_hierarchy_builder.py,sha256=mE8OXy_wbojWpnc5vq9zF77lnVI0k1E25DNbD-BiM2E,4362
50
+ dara/components/graphs/components/node_hierarchy_builder.py,sha256=KfJp_miwbXyXzY_rp0Jnek-yN4RsRdyzatbk_hhtQ28,4398
51
51
  dara/components/graphs/definitions.py,sha256=M46KV4VSNDnwAcfYoJnx71B_EZIuDAIRG2_mD9LtwOA,5316
52
52
  dara/components/graphs/graph_layout.py,sha256=Qb3zdcpolDQi_hFHAc2wGELUCvyeVfOqTOiVK-8uvW8,13852
53
53
  dara/components/plotting/__init__.py,sha256=u-wb5iAJBzDLEiXjaMuFy1rLAP_QzfnOvm1ZqMXsgac,797
@@ -59,7 +59,7 @@ dara/components/plotting/matplotlib/__init__.py,sha256=XNvSBKg8ML2IhMm9fJ5-OOHAI
59
59
  dara/components/plotting/matplotlib/matplotlib.py,sha256=VUeOJZ6bTVrsJezmGqUJdezi6Vp53voB9BBWAGfTtrQ,1851
60
60
  dara/components/plotting/palettes.py,sha256=dAFOLzDsb5Cq-ffhegLsElaJueGzCJ7Px6J7frMe_YY,8001
61
61
  dara/components/plotting/plotly/__init__.py,sha256=vbFmz0BhPw6LktZxtVc4iv5eXRlc-5OqhBKOleUVaBw,835
62
- dara/components/plotting/plotly/plotly.py,sha256=t0twKC-_gUYDdNcNZ0ZsvvWreJbSVsumoZGRFTZmFE8,4786
62
+ dara/components/plotting/plotly/plotly.py,sha256=xfKY4QjxkUEJ8ogBz43O2WIHWkrrg87REdUd4adbHHw,4858
63
63
  dara/components/plotting/plotly/themes.py,sha256=i7jpJOfhHVdyJAzTTcDoukUgZNPpH6atXrsZ8s3_dUw,4459
64
64
  dara/components/smart/__init__.py,sha256=PzggApMAClCo62aexuZ60MXWJclYfeuXwyZUrYVHOeM,1171
65
65
  dara/components/smart/chat/__init__.py,sha256=1J6s1YYBuDYg7Vft5vhMzkGHp2vjqUWy3BZQB4Es6mM,796
@@ -79,9 +79,9 @@ dara/components/smart/data_slicer/utils/core.py,sha256=4M_HA8oBzAkHklHgmaJ-qiKA3
79
79
  dara/components/smart/data_slicer/utils/data_preview.py,sha256=OAphjMrm3F76XmJ09X7sZSeOeKqGJFwN5ooo3qcyrG4,1722
80
80
  dara/components/smart/data_slicer/utils/plotting.py,sha256=TB00576kbA6y1eRuZBe09UAcZmluY4iJsKmYnXZ3hWQ,3389
81
81
  dara/components/smart/hierarchy.py,sha256=3RtHj68gA8H_X9FxQdaeSJloTqe8ciH52ku6f7zy33M,2902
82
- dara/components/umd/dara.components.umd.js,sha256=dnoqtLQt21gIW8c1B7_ZYF4Q049SnzgH42r0QvoruJc,6855502
82
+ dara/components/umd/dara.components.umd.js,sha256=RciXoiTSMp5321RlwRKkD5L4rgc8C3y6X1hmknnnMKw,6855690
83
83
  dara/components/umd/style.css,sha256=Qm0_kcxXBDoXvvPTc7YCttkl1zMFifdcp-KufTunPNY,162729
84
- dara_components-1.21.12.dist-info/LICENSE,sha256=r9u1w2RvpLMV6YjuXHIKXRBKzia3fx_roPwboGcLqCc,10944
85
- dara_components-1.21.12.dist-info/METADATA,sha256=IujtlTvMXJ4pyL7KACUbGtREBI-eHI7USa8rHSgP71w,2746
86
- dara_components-1.21.12.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
87
- dara_components-1.21.12.dist-info/RECORD,,
84
+ dara_components-1.21.14.dist-info/LICENSE,sha256=r9u1w2RvpLMV6YjuXHIKXRBKzia3fx_roPwboGcLqCc,10944
85
+ dara_components-1.21.14.dist-info/METADATA,sha256=DKjh1iyNj3iBb12LESn_V3vp4__dagAPSqOdaZ2XcNE,2746
86
+ dara_components-1.21.14.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
87
+ dara_components-1.21.14.dist-info/RECORD,,