ansys-solutions-dash-super-components 0.2.dev7__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.
Files changed (26) hide show
  1. ansys/solutions/dash_super_components/__init__.py +44 -0
  2. ansys/solutions/dash_super_components/assets/__init__.py +20 -0
  3. ansys/solutions/dash_super_components/assets/dashAgGridComponentFunctions.js +71 -0
  4. ansys/solutions/dash_super_components/authenticator.py +277 -0
  5. ansys/solutions/dash_super_components/dual_input_range_slider.py +397 -0
  6. ansys/solutions/dash_super_components/folder_selector.py +830 -0
  7. ansys/solutions/dash_super_components/input_form.py +908 -0
  8. ansys/solutions/dash_super_components/input_row_array.py +368 -0
  9. ansys/solutions/dash_super_components/logs_supervisor.py +887 -0
  10. ansys/solutions/dash_super_components/transaction_method_status_badge.py +366 -0
  11. ansys/solutions/dash_super_components/transaction_supervisor.py +587 -0
  12. ansys/solutions/dash_super_components/tree.py +396 -0
  13. ansys/solutions/dash_super_components/utils/__init__.py +18 -0
  14. ansys/solutions/dash_super_components/utils/aio_ids.py +83 -0
  15. ansys/solutions/dash_super_components/utils/api_requests.py +69 -0
  16. ansys/solutions/dash_super_components/utils/assets_server.py +52 -0
  17. ansys/solutions/dash_super_components/utils/config.py +77 -0
  18. ansys/solutions/dash_super_components/utils/logs_parser.py +151 -0
  19. ansys/solutions/dash_super_components/utils/path_validator.py +163 -0
  20. ansys/solutions/dash_super_components/utils/status_badge_properties.py +60 -0
  21. ansys/solutions/dash_super_components/utils/svg_icons.py +395 -0
  22. ansys_solutions_dash_super_components-0.2.dev7.dist-info/METADATA +169 -0
  23. ansys_solutions_dash_super_components-0.2.dev7.dist-info/RECORD +26 -0
  24. ansys_solutions_dash_super_components-0.2.dev7.dist-info/WHEEL +4 -0
  25. ansys_solutions_dash_super_components-0.2.dev7.dist-info/licenses/AUTHORS +12 -0
  26. ansys_solutions_dash_super_components-0.2.dev7.dist-info/licenses/LICENSE +201 -0
@@ -0,0 +1,44 @@
1
+ # Copyright (C) 2026 ANSYS, Inc. and/or its affiliates.
2
+ # SPDX-License-Identifier: Apache-2.0
3
+ #
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+
18
+ """Initialization of the ansys.solutions.dash_super_components package."""
19
+
20
+ from .authenticator import Authenticator
21
+ from .dual_input_range_slider import DualInputRangeSlider
22
+ from .folder_selector import FolderSelector
23
+ from .input_form import InputForm
24
+ from .input_row_array import InputRowArray
25
+ from .logs_supervisor import LogsSupervisor
26
+ from .transaction_method_status_badge import TransactionMethodStatusBadge
27
+ from .transaction_supervisor import TransactionSupervisor
28
+ from .tree import Tree
29
+ from .utils.assets_server import add_super_components_assets
30
+ from .utils.config import configure
31
+
32
+ __all__ = [
33
+ "add_super_components_assets",
34
+ "Authenticator",
35
+ "configure",
36
+ "DualInputRangeSlider",
37
+ "FolderSelector",
38
+ "InputForm",
39
+ "InputRowArray",
40
+ "LogsSupervisor",
41
+ "TransactionMethodStatusBadge",
42
+ "TransactionSupervisor",
43
+ "Tree",
44
+ ]
@@ -0,0 +1,20 @@
1
+ # Copyright (C) 2026 ANSYS, Inc. and/or its affiliates.
2
+ # SPDX-License-Identifier: Apache-2.0
3
+ #
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+
18
+ """Initialization of the assets module."""
19
+
20
+ # This folder contains static assets for the package.
@@ -0,0 +1,71 @@
1
+ // Copyright (C) 2026 ANSYS, Inc. and/or its affiliates.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ //
4
+ //
5
+ // Licensed under the Apache License, Version 2.0 (the "License");
6
+ // you may not use this file except in compliance with the License.
7
+ // You may obtain a copy of the License at
8
+ //
9
+ // http://www.apache.org/licenses/LICENSE-2.0
10
+ //
11
+ // Unless required by applicable law or agreed to in writing, software
12
+ // distributed under the License is distributed on an "AS IS" BASIS,
13
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ // See the License for the specific language governing permissions and
15
+ // limitations under the License.
16
+
17
+ var dagcomponentfuncs = window.dashAgGridComponentFunctions = window.dashAgGridComponentFunctions || {};
18
+
19
+ dagcomponentfuncs.DMC_Badge_Level_Name = function (props) {
20
+ const {setData, data} = props;
21
+
22
+ function onClick() {
23
+ setData();
24
+ }
25
+ let leftSection, color;
26
+
27
+ if (props.value == "INFO") {
28
+ leftSection = React.createElement(window.dash_iconify.DashIconify, {
29
+ icon: "material-symbols:info",
30
+ });
31
+ color = "blue";
32
+ }
33
+ else if (props.value == "WARNING") {
34
+ leftSection = React.createElement(window.dash_iconify.DashIconify, {
35
+ icon: "material-symbols:warning",
36
+ });
37
+ color = "orange";
38
+ }
39
+ else if (props.value == "ERROR") {
40
+ leftSection = React.createElement(window.dash_iconify.DashIconify, {
41
+ icon: "icon-park-solid:error",
42
+ });
43
+ color = "red";
44
+ }
45
+ else if (props.value == "CRITICAL") {
46
+ leftSection = React.createElement(window.dash_iconify.DashIconify, {
47
+ icon: "eos-icons:critical-bug-outlined",
48
+ });
49
+ color = "pink";
50
+ }
51
+ else if (props.value == "DEBUG") {
52
+ leftSection = React.createElement(window.dash_iconify.DashIconify, {
53
+ icon: "eos-icons:critical-bug",
54
+ });
55
+ color = "grape";
56
+ }
57
+
58
+ return React.createElement(
59
+ window.dash_mantine_components.Badge,
60
+ {
61
+ onClick,
62
+ variant: props.variant,
63
+ color: color,
64
+ leftSection: leftSection,
65
+ radius: props.radius,
66
+ size: props.size,
67
+ style: props.style,
68
+ },
69
+ props.value
70
+ );
71
+ };
@@ -0,0 +1,277 @@
1
+ # Copyright (C) 2026 ANSYS, Inc. and/or its affiliates.
2
+ # SPDX-License-Identifier: Apache-2.0
3
+ #
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+
18
+ """Provide a Dash component for crafting an authentication form."""
19
+
20
+ from typing import Any, TypeVar
21
+ import uuid
22
+
23
+ try:
24
+ # dash-extensions < 2.0.5
25
+ from dash_extensions.enrich import _Wildcard # pyright: ignore[reportAttributeAccessIssue]
26
+ except ImportError:
27
+ # dash-extensions >= 2.0.5
28
+ from dash_extensions.enrich import (
29
+ Wildcard as _Wildcard, # pyright: ignore[reportAttributeAccessIssue]
30
+ )
31
+ from dash_extensions.enrich import html
32
+ import dash_mantine_components as dmc
33
+
34
+ from ansys.solutions.dash_super_components.utils.aio_ids import AIOIds
35
+ from ansys.solutions.dash_super_components.utils.svg_icons import IconNames, create_base64_svg_src
36
+
37
+ T = TypeVar("T", dmc.TextInput, dmc.PasswordInput, dmc.Button)
38
+
39
+
40
+ class Authenticator(html.Div):
41
+ """
42
+ A Dash component for crafting an authentication form.
43
+
44
+ Authenticator is based on the Dash All-in-One (AIO) component pattern. It
45
+ renders a vertical stack of ``TextInput``, ``PasswordInput``, and ``Button``
46
+ items inside a :class:`dmc.Card`.
47
+
48
+ When ``items`` is omitted or empty, a default form is rendered with a
49
+ username text input (id ``"username"``), a password input (id ``"password"``),
50
+ and a "Connect" button (id ``"connect"``).
51
+
52
+ Each item dict must contain the following keys:
53
+
54
+ - ``"type"`` *(required)*: ``"TextInput"``, ``"PasswordInput"``, or ``"Button"``.
55
+ - ``"id"`` *(required)*: unique string identifier for the item.
56
+ - ``"properties"`` *(required)*: dict of dash mantine component properties.
57
+
58
+ Parameters
59
+ ----------
60
+ items : list of dict, optional
61
+ Items to render in the form. Each dict must contain ``"type"``, ``"id"``,
62
+ and ``"properties"`` keys. When omitted or empty, the default form
63
+ (username, password, connect button) is rendered.
64
+ card_props : dict, optional
65
+ Properties forwarded to the wrapping :class:`dmc.Card`.
66
+ aio_id : str, optional
67
+ Unique identifier for this component instance. A UUID is generated when
68
+ not provided.
69
+ """
70
+
71
+ class AuthenticatorIds(AIOIds):
72
+ """Provides IDs for the subcomponents of :class:`Authenticator`."""
73
+
74
+ @classmethod
75
+ def _make_id_dict_with_index(
76
+ cls, subcomponent: str, aio_id: str | _Wildcard, index: str | _Wildcard
77
+ ) -> dict[str, Any]:
78
+ id_dict = cls.make_id_dict("authenticator", subcomponent, aio_id)
79
+ id_dict["index"] = index
80
+ return id_dict
81
+
82
+ @classmethod
83
+ def input(cls, aio_id: str | _Wildcard, item_id: str | _Wildcard) -> dict[str, Any]:
84
+ """
85
+ Return the id for an input item.
86
+
87
+ Parameters
88
+ ----------
89
+ aio_id : str or _Wildcard
90
+ The component's unique identifier.
91
+ item_id : str or _Wildcard
92
+ The unique identifier of the input item (item["id"]).
93
+
94
+ Returns
95
+ -------
96
+ dict[str, Any]
97
+ The unique id dictionary for an input item of the Authenticator
98
+ """
99
+ return cls._make_id_dict_with_index("input", aio_id, item_id)
100
+
101
+ @classmethod
102
+ def password(cls, aio_id: str | _Wildcard, item_id: str | _Wildcard) -> dict[str, Any]:
103
+ """
104
+ Return the id for a password item.
105
+
106
+ Parameters
107
+ ----------
108
+ aio_id : str or _Wildcard
109
+ The component's unique identifier.
110
+ item_id : str or _Wildcard
111
+ The unique identifier of the password item (item["id"]).
112
+
113
+ Returns
114
+ -------
115
+ dict[str, Any]
116
+ The unique id dictionary for a password item of the Authenticator
117
+ """
118
+ return cls._make_id_dict_with_index("password", aio_id, item_id)
119
+
120
+ @classmethod
121
+ def button(cls, aio_id: str | _Wildcard, item_id: str | _Wildcard) -> dict[str, Any]:
122
+ """
123
+ Return the id for a button item.
124
+
125
+ Parameters
126
+ ----------
127
+ aio_id : str or _Wildcard
128
+ The component's unique identifier.
129
+ item_id : str or _Wildcard
130
+ The unique identifier of the button item (item["id"]).
131
+
132
+ Returns
133
+ -------
134
+ dict[str, Any]
135
+ The unique id dictionary for a button item of the Authenticator
136
+ """
137
+ return cls._make_id_dict_with_index("button", aio_id, item_id)
138
+
139
+ ids = AuthenticatorIds
140
+
141
+ def __init__(
142
+ self,
143
+ items: list[dict[str, Any]] | None = None,
144
+ card_props: dict[str, Any] | None = None,
145
+ aio_id: str | None = None,
146
+ ):
147
+ if card_props is None:
148
+ card_props = {}
149
+ if items is None:
150
+ items = []
151
+
152
+ self.items = items
153
+ self.card_props = card_props
154
+ self.aio_id = aio_id if aio_id is not None else str(uuid.uuid4())
155
+ self._default_card_props = {
156
+ "withBorder": True,
157
+ "shadow": "sm",
158
+ "radius": "md",
159
+ "w": 500,
160
+ }
161
+ self._default_button_props = {
162
+ "children": "Connect",
163
+ "disabled": False,
164
+ "leftSection": html.Img(
165
+ src=create_base64_svg_src(IconNames.HUGE_ROCKET, color="#adb5bd"),
166
+ ),
167
+ "className": "mantine-button",
168
+ "style": {"width": "100%"},
169
+ }
170
+ self._default_text_input_props = {
171
+ "label": "Field",
172
+ "placeholder": "Enter your data.",
173
+ "required": True,
174
+ "disabled": False,
175
+ "style": {"width": "100%"},
176
+ }
177
+ self._default_password_input_props = {
178
+ "label": "Password",
179
+ "placeholder": "Enter your password.",
180
+ "required": True,
181
+ "disabled": False,
182
+ "leftSection": html.Img(
183
+ src=create_base64_svg_src(IconNames.MDI_SECURE, color="#adb5bd"),
184
+ ),
185
+ "style": {"width": "100%"},
186
+ }
187
+
188
+ if not len(self.items):
189
+ self.items = [
190
+ {
191
+ "type": "TextInput",
192
+ "id": "username",
193
+ "properties": {
194
+ "label": "Username",
195
+ "placeholder": "Enter your username",
196
+ "required": True,
197
+ "leftSection": html.Img(
198
+ src=create_base64_svg_src(IconNames.MDI_USER, color="#adb5bd"),
199
+ ),
200
+ },
201
+ },
202
+ {
203
+ "type": "PasswordInput",
204
+ "id": "password",
205
+ "properties": {
206
+ "label": "Password",
207
+ "placeholder": "Enter your password",
208
+ "required": True,
209
+ "leftSection": html.Img(
210
+ src=create_base64_svg_src(IconNames.MDI_SECURE, color="#adb5bd"),
211
+ ),
212
+ },
213
+ },
214
+ {
215
+ "type": "Button",
216
+ "id": "connect",
217
+ "properties": {
218
+ "children": "Connect",
219
+ "leftSection": html.Img(
220
+ src=create_base64_svg_src(IconNames.HUGE_ROCKET, color="#adb5bd"),
221
+ ),
222
+ },
223
+ },
224
+ ]
225
+
226
+ for prop, value in self._default_card_props.items():
227
+ if prop not in card_props:
228
+ card_props[prop] = value
229
+
230
+ super().__init__(
231
+ [
232
+ html.Div(
233
+ [
234
+ dmc.Card(self._generate_form(), **card_props),
235
+ ],
236
+ ),
237
+ ],
238
+ )
239
+
240
+ def _generate_form(self) -> list[html.Div | dmc.Space]:
241
+ """Generate the components of the form."""
242
+ children: list[html.Div | dmc.Space] = []
243
+ for item in self.items:
244
+ children.append(
245
+ html.Div(
246
+ self._create_component(item),
247
+ style={
248
+ "display": "flex",
249
+ "justifyContent": "center",
250
+ "align-items": "center",
251
+ },
252
+ ),
253
+ )
254
+ children.append(dmc.Space(h=5))
255
+ return children
256
+
257
+ def _create_component(
258
+ self, item: dict[str, Any]
259
+ ) -> dmc.TextInput | dmc.PasswordInput | dmc.Button:
260
+ if item["type"] == "TextInput":
261
+ component = dmc.TextInput(
262
+ id=self.ids.input(self.aio_id, item["id"]),
263
+ **{**self._default_text_input_props, **item["properties"]},
264
+ )
265
+ elif item["type"] == "PasswordInput":
266
+ component = dmc.PasswordInput(
267
+ id=self.ids.password(self.aio_id, item["id"]),
268
+ **{**self._default_password_input_props, **item["properties"]},
269
+ )
270
+ elif item["type"] == "Button":
271
+ component = dmc.Button(
272
+ id=self.ids.button(self.aio_id, item["id"]),
273
+ **{**self._default_button_props, **item["properties"]},
274
+ )
275
+ else:
276
+ raise ValueError(f"Unsupported item type: {item['type']}")
277
+ return component