dars-framework 1.9.0__tar.gz → 1.9.2__tar.gz
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.
- {dars_framework-1.9.0/dars_framework.egg-info → dars_framework-1.9.2}/PKG-INFO +1 -1
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/components/advanced/accordion.py +22 -3
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/components/advanced/card.py +20 -1
- dars_framework-1.9.2/dars/components/advanced/file_upload.py +59 -0
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/components/advanced/head.py +28 -35
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/components/advanced/modal.py +22 -1
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/components/advanced/navbar.py +22 -1
- dars_framework-1.9.2/dars/components/advanced/outlet.py +43 -0
- dars_framework-1.9.2/dars/components/advanced/table.py +48 -0
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/components/advanced/tabs.py +25 -4
- dars_framework-1.9.2/dars/components/basic/audio.py +56 -0
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/components/basic/button.py +22 -0
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/components/basic/checkbox.py +25 -0
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/components/basic/container.py +20 -0
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/components/basic/datepicker.py +32 -0
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/components/basic/image.py +23 -1
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/components/basic/input.py +26 -0
- dars_framework-1.9.2/dars/components/basic/link.py +52 -0
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/components/basic/markdown.py +23 -12
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/components/basic/page.py +23 -1
- dars_framework-1.9.2/dars/components/basic/progressbar.py +34 -0
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/components/basic/radiobutton.py +27 -0
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/components/basic/section.py +20 -0
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/components/basic/select.py +27 -0
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/components/basic/slider.py +29 -0
- dars_framework-1.9.2/dars/components/basic/spinner.py +24 -0
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/components/basic/text.py +16 -3
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/components/basic/textarea.py +27 -1
- dars_framework-1.9.2/dars/components/basic/tooltip.py +36 -0
- dars_framework-1.9.2/dars/components/basic/video.py +69 -0
- dars_framework-1.9.2/dars/components/layout/flex.py +57 -0
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/components/layout/grid.py +21 -1
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/components/visualization/chart.py +22 -15
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/components/visualization/table.py +28 -37
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/core/app.py +112 -1
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/core/routing.py +4 -12
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/core/utilities.py +89 -28
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/docs/INSTALL.md +164 -164
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/docs/KeyEvents.md +5 -5
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/docs/backend_api.md +1 -1
- dars_framework-1.9.2/dars/docs/components.md +405 -0
- dars_framework-1.9.2/dars/docs/config.md +109 -0
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/docs/custom_components.md +2 -2
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/docs/events.md +2 -2
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/docs/exporters.md +322 -320
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/docs/getting_started.md +4 -13
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/docs/hooks.md +1 -1
- dars_framework-1.9.2/dars/docs/index.md +52 -0
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/docs/routing.md +4 -4
- dars_framework-1.9.2/dars/docs/scripts.md +155 -0
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/docs/ssr.md +4 -2
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/docs/state_management.md +333 -330
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/docs/styling.md +34 -0
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/js_lib.py +106 -6
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/scripts/dscript.py +5 -8
- dars_framework-1.9.2/dars/scripts/utils_ds.py +726 -0
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/version.py +2 -2
- {dars_framework-1.9.0 → dars_framework-1.9.2/dars_framework.egg-info}/PKG-INFO +1 -1
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars_framework.egg-info/SOURCES.txt +0 -1
- {dars_framework-1.9.0 → dars_framework-1.9.2}/pyproject.toml +1 -1
- dars_framework-1.9.0/dars/components/advanced/file_upload.py +0 -33
- dars_framework-1.9.0/dars/components/advanced/outlet.py +0 -25
- dars_framework-1.9.0/dars/components/advanced/table.py +0 -25
- dars_framework-1.9.0/dars/components/basic/audio.py +0 -35
- dars_framework-1.9.0/dars/components/basic/link.py +0 -31
- dars_framework-1.9.0/dars/components/basic/progressbar.py +0 -18
- dars_framework-1.9.0/dars/components/basic/spinner.py +0 -12
- dars_framework-1.9.0/dars/components/basic/tooltip.py +0 -19
- dars_framework-1.9.0/dars/components/basic/video.py +0 -44
- dars_framework-1.9.0/dars/components/layout/flex.py +0 -33
- dars_framework-1.9.0/dars/docs/STRUCTURE.md +0 -290
- dars_framework-1.9.0/dars/docs/components.md +0 -2244
- dars_framework-1.9.0/dars/docs/config.md +0 -96
- dars_framework-1.9.0/dars/docs/index.md +0 -28
- dars_framework-1.9.0/dars/docs/scripts.md +0 -776
- dars_framework-1.9.0/dars/scripts/utils_ds.py +0 -302
- {dars_framework-1.9.0 → dars_framework-1.9.2}/Dars-logo.png +0 -0
- {dars_framework-1.9.0 → dars_framework-1.9.2}/LICENSE +0 -0
- {dars_framework-1.9.0 → dars_framework-1.9.2}/MANIFEST.in +0 -0
- {dars_framework-1.9.0 → dars_framework-1.9.2}/README.md +0 -0
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/__init__.py +0 -0
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/actionProtocol.py +0 -0
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/all.py +0 -0
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/backend/__init__.py +0 -0
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/backend/components.py +0 -0
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/backend/data.py +0 -0
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/backend/http.py +0 -0
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/backend/json_utils.py +0 -0
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/backend/route_loader.py +0 -0
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/backend/ssr.py +0 -0
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/cli/__init__.py +0 -0
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/cli/doctor/__init__.py +0 -0
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/cli/doctor/detect.py +0 -0
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/cli/doctor/doctor.py +0 -0
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/cli/doctor/installers.py +0 -0
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/cli/doctor/persist.py +0 -0
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/cli/doctor/preflight.py +0 -0
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/cli/doctor/ui.py +0 -0
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/cli/dpm.py +0 -0
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/cli/hot_reload.py +0 -0
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/cli/main.py +0 -0
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/cli/preview.py +0 -0
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/cli/translations.py +0 -0
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/components/__init__.py +0 -0
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/components/advanced/__init__.py +0 -0
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/components/basic/__init__.py +0 -0
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/components/layout/__init__.py +0 -0
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/components/layout/anchor.py +0 -0
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/components/visualization/__init__.py +0 -0
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/config.py +0 -0
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/core/__init__.py +0 -0
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/core/component.py +0 -0
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/core/events.py +0 -0
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/core/js_bridge.py +0 -0
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/core/properties.py +0 -0
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/core/route_types.py +0 -0
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/core/state.py +0 -0
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/core/state_v2.py +0 -0
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/dars_tests/apps_test/health_check.py +0 -0
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/dars_tests/run_tests.py +0 -0
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/dars_tests/tests/test_advanced_components.py +0 -0
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/dars_tests/tests/test_basic_components.py +0 -0
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/dars_tests/tests/test_core_and_cli.py +0 -0
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/dars_tests/tests/test_layout_components.py +0 -0
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/dars_tests/tests/test_version_check.py +0 -0
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/desktop/__init__.py +0 -0
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/desktop/api.py +0 -0
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/desktop/js_generator.py +0 -0
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/docs/__init__.py +0 -0
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/docs/animations.md +0 -0
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/docs/app.md +0 -0
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/docs/cli.md +0 -0
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/docs/env.md +0 -0
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/docs/operations.md +0 -0
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/env.py +0 -0
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/exporters/__init__.py +0 -0
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/exporters/base.py +0 -0
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/exporters/desktop/electron.py +0 -0
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/exporters/web/__init__.py +0 -0
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/exporters/web/html_css_js.py +0 -0
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/exporters/web/vdom.py +0 -0
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/hooks/__init__.py +0 -0
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/hooks/form_helpers.py +0 -0
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/hooks/set_vref.py +0 -0
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/hooks/update_vref.py +0 -0
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/hooks/use_dynamic.py +0 -0
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/hooks/use_value.py +0 -0
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/hooks/use_vref.py +0 -0
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/hooks/use_watch.py +0 -0
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/hooks/value_helpers.py +0 -0
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/scripts/__init__.py +0 -0
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/scripts/animations.py +0 -0
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/scripts/keycode.py +0 -0
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/scripts/script.py +0 -0
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/security.py +0 -0
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/templates/__init__.py +0 -0
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/templates/desktop/icon.png +0 -0
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/templates/desktop/template/backend/icons/icon.png +0 -0
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/templates/desktop/template/backend/main.js +0 -0
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/templates/desktop/template/backend/package.json +0 -0
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/templates/desktop/template/backend/preload.js +0 -0
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/templates/desktop/template/dars.config.json +0 -0
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/templates/desktop/template/icons/icon.png +0 -0
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/templates/desktop/template/main.py +0 -0
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/templates/desktop/template/public/electron-icon.png +0 -0
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/templates/desktop/template/public/icon.png +0 -0
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/templates/examples/README.md +0 -0
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/templates/examples/advanced/CustomComp/main.py +0 -0
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/templates/examples/advanced/Modal_Demo/advanced_modal_demo.py +0 -0
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/templates/examples/advanced/StateV2/README.md +0 -0
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/templates/examples/advanced/StateV2/animation_component.py +0 -0
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/templates/examples/advanced/StateV2/counter_component.py +0 -0
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/templates/examples/advanced/StateV2/hero_component.py +0 -0
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/templates/examples/advanced/StateV2/main.py +0 -0
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/templates/examples/advanced/StateV2/styles.css +0 -0
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/templates/examples/advanced/StateV2/timer_component.py +0 -0
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/templates/examples/advanced/VariousComponents/all_components_demo.py +0 -0
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/templates/examples/advanced/__init__.py +0 -0
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/templates/examples/advanced/dState/state_mods_demo.py +0 -0
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/templates/examples/advanced/hooks/useDynamic.py +0 -0
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/templates/examples/advanced/hooks/useValue.py +0 -0
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/templates/examples/advanced/hooks/useWatch.py +0 -0
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/templates/examples/basic/HelloWorld/hello_world.py +0 -0
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/templates/examples/basic/Layouts/flex_layout_responsive.py +0 -0
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/templates/examples/basic/Layouts/grid_layout_responsive.py +0 -0
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/templates/examples/basic/Layouts/layout_multipage_demo.py +0 -0
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/templates/examples/basic/PWA/icon-192x192.png +0 -0
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/templates/examples/basic/PWA/icon-512x512.png +0 -0
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/templates/examples/basic/PWA/pwa_custom_icons.py +0 -0
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/templates/examples/basic/__init__.py +0 -0
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/templates/examples/markdown/MarkdownTemplate/README.md +0 -0
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/templates/examples/markdown/MarkdownTemplate/markdown_template.py +0 -0
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/templates/examples/markdown/MarkdownTemplate/other_docs.md +0 -0
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars/templates/examples/markdown/__init__.py +0 -0
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars_framework.egg-info/dependency_links.txt +0 -0
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars_framework.egg-info/entry_points.txt +0 -0
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars_framework.egg-info/requires.txt +0 -0
- {dars_framework-1.9.0 → dars_framework-1.9.2}/dars_framework.egg-info/top_level.txt +0 -0
- {dars_framework-1.9.0 → dars_framework-1.9.2}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: dars-framework
|
|
3
|
-
Version: 1.9.
|
|
3
|
+
Version: 1.9.2
|
|
4
4
|
Summary: Dars is a Full-Stack multiplatform Python UI framework for building modern, interactive web and desktop apps with Python code. Seamlessly integrated with FastAPI, it allows you to build complete applications with Server-Side Rendering (SSR) and reactive SPA capabilities also classic multipage html and desktop apps in a single codebase.
|
|
5
5
|
Author-email: ztamdev <ztadevs@gmail.com>
|
|
6
6
|
Maintainer-email: ztamdev <ztadevs@gmail.com>
|
|
@@ -3,9 +3,28 @@ from typing import List, Optional
|
|
|
3
3
|
|
|
4
4
|
class Accordion(Component):
|
|
5
5
|
"""
|
|
6
|
-
Accordion component
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
Accordion component for displaying collapsible content sections.
|
|
7
|
+
|
|
8
|
+
Props:
|
|
9
|
+
- **sections** (list): List of tuples containing `(title, content)`.
|
|
10
|
+
- **open_indices** (list): Optional list of indices that should be open by default.
|
|
11
|
+
- **id** (str): Unique identifier for the component.
|
|
12
|
+
- **class_name** (str): String containing regular CSS class names.
|
|
13
|
+
- **style** (dict): Optional dictionary for CSS utility classes (prefer `style`).
|
|
14
|
+
- **children** (list): List of child components.
|
|
15
|
+
- **Events**: Handlers like `on_click`, etc.
|
|
16
|
+
|
|
17
|
+
Example:
|
|
18
|
+
```python
|
|
19
|
+
Accordion(
|
|
20
|
+
sections=[
|
|
21
|
+
("Section 1", Text("Content for section 1")),
|
|
22
|
+
("Section 2", Text("Content for section 2")),
|
|
23
|
+
],
|
|
24
|
+
open_indices=[0],
|
|
25
|
+
class_name="bg-white shadow-sm"
|
|
26
|
+
)
|
|
27
|
+
```
|
|
9
28
|
"""
|
|
10
29
|
|
|
11
30
|
def __init__(self, sections: List[tuple], open_indices: Optional[List[int]]=None, minimum_logic: bool = True, **props):
|
|
@@ -2,7 +2,26 @@ from dars.core.component import Component
|
|
|
2
2
|
from typing import Optional, Dict, Any, List
|
|
3
3
|
|
|
4
4
|
class Card(Component):
|
|
5
|
-
"""
|
|
5
|
+
"""
|
|
6
|
+
Card component for grouping related information in a visually distinct container.
|
|
7
|
+
|
|
8
|
+
Props:
|
|
9
|
+
- **children** (list): List of child components to render inside the card.
|
|
10
|
+
- **title** (str): Optional title displayed at the top of the card.
|
|
11
|
+
- **id** (str): Unique identifier for the component.
|
|
12
|
+
- **class_name** (str): String containing regular CSS class names.
|
|
13
|
+
- **style** (dict): Optional dictionary for CSS utility classes (prefer `style`).
|
|
14
|
+
- **Events**: Handlers like `on_click`, `on_mouse_enter`, etc.
|
|
15
|
+
|
|
16
|
+
Example:
|
|
17
|
+
```python
|
|
18
|
+
Card(
|
|
19
|
+
Text("Card content goes here..."),
|
|
20
|
+
title="Featured Post",
|
|
21
|
+
class_name="max-w-sm border border-slate-100 bg-gradient-to-br from-white to-slate-50"
|
|
22
|
+
)
|
|
23
|
+
```
|
|
24
|
+
"""
|
|
6
25
|
def __init__(
|
|
7
26
|
self,
|
|
8
27
|
children: Optional[List[Component]] = None,
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
|
|
2
|
+
from dars.core.component import Component
|
|
3
|
+
from dars.core.events import EventTypes
|
|
4
|
+
from typing import Optional, Dict, Any, Callable, Union
|
|
5
|
+
|
|
6
|
+
class FileUpload(Component):
|
|
7
|
+
"""
|
|
8
|
+
Component for selecting and uploading files with support for filters and size limits.
|
|
9
|
+
|
|
10
|
+
Props:
|
|
11
|
+
- **accept** (str): Allowed file types (e.g., `"image/*"`, `".pdf"`, `"audio/*"`).
|
|
12
|
+
- **multiple** (bool): If True, allows selecting multiple files.
|
|
13
|
+
- **disabled** (bool): If True, the component is not interactive.
|
|
14
|
+
- **required** (bool): If True, a file must be selected.
|
|
15
|
+
- **max_size** (int): Maximum file size allowed in bytes.
|
|
16
|
+
- **label** (str): Text label for the upload button (defaults to "Choose File").
|
|
17
|
+
- **id** (str): Unique identifier for the component.
|
|
18
|
+
- **class_name** (str): String containing regular CSS class names.
|
|
19
|
+
- **style** (dict): Optional dictionary for CSS utility classes (prefer `style`).
|
|
20
|
+
- **children** (list): List of child components.
|
|
21
|
+
- **Events**: Handlers like `on_change` (triggered when files are selected).
|
|
22
|
+
|
|
23
|
+
Example:
|
|
24
|
+
```python
|
|
25
|
+
FileUpload(
|
|
26
|
+
accept="image/*",
|
|
27
|
+
multiple=True,
|
|
28
|
+
label="Upload Images",
|
|
29
|
+
class_name="bg-indigo-600 text-white px-6 py-3 rounded-full cursor-pointer hover:bg-indigo-700 transition-all shadow-lg"
|
|
30
|
+
)
|
|
31
|
+
```
|
|
32
|
+
"""
|
|
33
|
+
def __init__(
|
|
34
|
+
self,
|
|
35
|
+
accept: Optional[str] = None,
|
|
36
|
+
multiple: bool = False,
|
|
37
|
+
disabled: bool = False,
|
|
38
|
+
required: bool = False,
|
|
39
|
+
max_size: Optional[int] = None, # In bytes
|
|
40
|
+
id: Optional[str] = None,
|
|
41
|
+
class_name: Optional[str] = None,
|
|
42
|
+
style: Optional[Dict[str, Any]] = None,
|
|
43
|
+
on_change: Optional[Callable] = None,
|
|
44
|
+
label: Optional[str] = "Choose File",
|
|
45
|
+
**props
|
|
46
|
+
):
|
|
47
|
+
super().__init__(id=id, class_name=class_name, style=style, **props)
|
|
48
|
+
self.accept = accept
|
|
49
|
+
self.multiple = multiple
|
|
50
|
+
self.disabled = disabled
|
|
51
|
+
self.required = required
|
|
52
|
+
self.max_size = max_size
|
|
53
|
+
self.label = label
|
|
54
|
+
|
|
55
|
+
if on_change:
|
|
56
|
+
self.set_event(EventTypes.CHANGE, on_change)
|
|
57
|
+
|
|
58
|
+
def render(self, exporter: Any) -> str:
|
|
59
|
+
raise NotImplementedError("render method must be implemented by exporter")
|
|
@@ -12,44 +12,37 @@ from dars.core.component import Component
|
|
|
12
12
|
|
|
13
13
|
class Head(Component):
|
|
14
14
|
"""
|
|
15
|
-
|
|
15
|
+
Component for managing document metadata in the HTML `<head>` section, essential for SEO and social sharing.
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
-
|
|
22
|
-
-
|
|
23
|
-
-
|
|
24
|
-
-
|
|
25
|
-
-
|
|
26
|
-
-
|
|
27
|
-
-
|
|
28
|
-
-
|
|
17
|
+
Props:
|
|
18
|
+
- **title** (str): Page title displayed in the browser tab.
|
|
19
|
+
- **description** (str): Meta description for search engines.
|
|
20
|
+
- **keywords** (list): List of keywords for indexing.
|
|
21
|
+
- **author** (str): Metadata for the page author.
|
|
22
|
+
- **robots** (str): Robots directive (e.g., `"index, follow"`, `"noindex, nofollow"`).
|
|
23
|
+
- **canonical** (str): Canonical URL for the page to avoid duplicate content.
|
|
24
|
+
- **favicon** (str): URL to override the site-wide favicon.
|
|
25
|
+
- **og_*** (str): Open Graph metadata for social media sharing (title, description, image, etc.).
|
|
26
|
+
- **twitter_*** (str): Twitter Card metadata.
|
|
27
|
+
- **meta** (list): List of dictionaries for custom `<meta>` tags.
|
|
28
|
+
- **links** (list): List of dictionaries for custom `<link>` tags.
|
|
29
|
+
- **structured_data** (dict): JSON-LD dictionary for structured data.
|
|
30
|
+
- **id** (str): Unique identifier for the component (not rendered).
|
|
31
|
+
- **class_name** (str): String containing regular CSS class names (not rendered).
|
|
32
|
+
- **style** (dict): Optional dictionary for CSS utility classes (prefer `style`) (not rendered).
|
|
33
|
+
- **children** (list): List of child components (not rendered).
|
|
34
|
+
- **Events**: Handlers (not typical for Head).
|
|
29
35
|
|
|
30
36
|
Example:
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
keywords=["python", "web", "framework"],
|
|
41
|
-
og_image="https://example.com/image.jpg",
|
|
42
|
-
og_type="article"
|
|
43
|
-
),
|
|
44
|
-
Heading("My Blog Post", level=1),
|
|
45
|
-
Text("Content here...")
|
|
46
|
-
)
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
Note:
|
|
50
|
-
- This component does NOT handle CSS or JavaScript (handled by exporter)
|
|
51
|
-
- It only manages metadata in the HTML <head> section
|
|
52
|
-
- Multiple Head components: last one wins (or merge strategy)
|
|
37
|
+
```python
|
|
38
|
+
Head(
|
|
39
|
+
title="Dars Framework - Python Web Development",
|
|
40
|
+
description="Build premium web applications with Python and modern design.",
|
|
41
|
+
og_image="https://dars.dev/og-image.png",
|
|
42
|
+
twitter_card="summary_large_image",
|
|
43
|
+
keywords=["python", "framework", "web", "frontend"]
|
|
44
|
+
)
|
|
45
|
+
```
|
|
53
46
|
"""
|
|
54
47
|
|
|
55
48
|
def __init__(
|
|
@@ -2,7 +2,28 @@ from dars.core.component import Component
|
|
|
2
2
|
from typing import Optional, Dict, Any, List
|
|
3
3
|
|
|
4
4
|
class Modal(Component):
|
|
5
|
-
"""
|
|
5
|
+
"""
|
|
6
|
+
Dialog component that appears on top of the main content, used for important actions or information.
|
|
7
|
+
|
|
8
|
+
Props:
|
|
9
|
+
- **children** (list): List of child components to be displayed inside the modal content area.
|
|
10
|
+
- **title** (str): Optional title displayed in the modal header.
|
|
11
|
+
- **is_open** (bool): Whether the modal is currently visible (defaults to False).
|
|
12
|
+
- **id** (str): Unique identifier for the component.
|
|
13
|
+
- **class_name** (str): String containing regular CSS class names for the modal overlay.
|
|
14
|
+
- **style** (dict): Optional dictionary for CSS utility classes (prefer `style`).
|
|
15
|
+
- **Events**: Handlers like `on_click` (can be used to close the modal by clicking the backdrop).
|
|
16
|
+
|
|
17
|
+
Example:
|
|
18
|
+
```python
|
|
19
|
+
Modal(
|
|
20
|
+
Text("Your changes have been saved successfully."),
|
|
21
|
+
title="Success",
|
|
22
|
+
is_open=True,
|
|
23
|
+
class_name="bg-white rounded-3xl shadow-2xl p-10 max-w-lg"
|
|
24
|
+
)
|
|
25
|
+
```
|
|
26
|
+
"""
|
|
6
27
|
def __init__(
|
|
7
28
|
self,
|
|
8
29
|
children: Optional[List[Component]] = None,
|
|
@@ -2,7 +2,28 @@ from dars.core.component import Component
|
|
|
2
2
|
from typing import Optional, Dict, Any, List
|
|
3
3
|
|
|
4
4
|
class Navbar(Component):
|
|
5
|
-
"""
|
|
5
|
+
"""
|
|
6
|
+
Navigation bar component for page headers, supporting branding and navigation links.
|
|
7
|
+
|
|
8
|
+
Props:
|
|
9
|
+
- ***children** (Component): Positional arguments for navigation links or other components.
|
|
10
|
+
- **brand** (str): Text or logo component for the site branding area.
|
|
11
|
+
- **id** (str): Unique identifier for the component.
|
|
12
|
+
- **class_name** (str): String containing regular CSS class names.
|
|
13
|
+
- **style** (dict): Optional dictionary for CSS utility classes (prefer `style`).
|
|
14
|
+
- **children** (list): List of child components.
|
|
15
|
+
- **Events**: Handlers like `on_click`, `on_mouse_enter`, etc.
|
|
16
|
+
|
|
17
|
+
Example:
|
|
18
|
+
```python
|
|
19
|
+
Navbar(
|
|
20
|
+
Link("Home", href="/", class_name="px-4 py-2 hover:text-indigo-600"),
|
|
21
|
+
Link("Services", href="/services", class_name="px-4 py-2 hover:text-indigo-600"),
|
|
22
|
+
brand="Dars Framework",
|
|
23
|
+
class_name="px-8 py-4 shadow-sm flex items-center justify-between"
|
|
24
|
+
)
|
|
25
|
+
```
|
|
26
|
+
"""
|
|
6
27
|
def __init__(
|
|
7
28
|
self,
|
|
8
29
|
*children,
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
from dars.components.basic.container import Container
|
|
2
|
+
|
|
3
|
+
class Outlet(Container):
|
|
4
|
+
"""
|
|
5
|
+
Routing placeholder component for Single Page Applications (SPA).
|
|
6
|
+
Acts as the target where child routes will be dynamically rendered based on the URL.
|
|
7
|
+
|
|
8
|
+
Props:
|
|
9
|
+
- **outlet_id** (str): Unique identifier for the outlet (defaults to `"main"`).
|
|
10
|
+
- **placeholder** (Component): Component to display while the route content is being loaded.
|
|
11
|
+
- ***children** (Component): Initial content for the outlet if no route is matched.
|
|
12
|
+
- **id** (str): Unique identifier for the component.
|
|
13
|
+
- **class_name** (str): String containing regular CSS class names.
|
|
14
|
+
- **style** (dict): Optional dictionary for CSS utility classes (prefer `style`).
|
|
15
|
+
- **Events**: Handlers for navigation and lifecycle events.
|
|
16
|
+
|
|
17
|
+
Example:
|
|
18
|
+
```python
|
|
19
|
+
Outlet(
|
|
20
|
+
outlet_id="main-view",
|
|
21
|
+
placeholder=Spinner(class_name="m-auto"),
|
|
22
|
+
class_name="w-full h-full"
|
|
23
|
+
)
|
|
24
|
+
```
|
|
25
|
+
"""
|
|
26
|
+
def __init__(self, outlet_id: str = "main", placeholder=None, *children, **props):
|
|
27
|
+
if placeholder is None and ('loading' in props):
|
|
28
|
+
placeholder = props.pop('loading')
|
|
29
|
+
|
|
30
|
+
if (not children) and (placeholder is not None):
|
|
31
|
+
if isinstance(placeholder, list):
|
|
32
|
+
children = tuple(placeholder)
|
|
33
|
+
else:
|
|
34
|
+
children = (placeholder,)
|
|
35
|
+
|
|
36
|
+
super().__init__(*children, **props)
|
|
37
|
+
self.props["data-dars-outlet"] = "true"
|
|
38
|
+
try:
|
|
39
|
+
self.props["data-dars-outlet-id"] = str(outlet_id or "main")
|
|
40
|
+
except Exception:
|
|
41
|
+
self.props["data-dars-outlet-id"] = "main"
|
|
42
|
+
base_cls = (getattr(self, "class_name", "") or "").strip()
|
|
43
|
+
self.class_name = ("dars-outlet " + base_cls).strip()
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
from dars.core.component import Component
|
|
2
|
+
from typing import List, Dict, Any, Optional
|
|
3
|
+
|
|
4
|
+
class Table(Component):
|
|
5
|
+
"""
|
|
6
|
+
Component for displaying structured data in a tabular format with support for sorting and pagination.
|
|
7
|
+
|
|
8
|
+
Props:
|
|
9
|
+
- **columns** (list): List of dictionaries defining columns (e.g., `[{"title": "Name", "field": "name", "sortable": True}]`).
|
|
10
|
+
- **data** (list): List of row dictionaries where keys match the `field` defined in `columns`.
|
|
11
|
+
- **page_size** (int): Number of rows to display per page (optional).
|
|
12
|
+
- **id** (str): Unique identifier for the component.
|
|
13
|
+
- **class_name** (str): String containing regular CSS class names.
|
|
14
|
+
- **style** (dict): Optional dictionary for CSS utility classes (prefer `style`).
|
|
15
|
+
- **children** (list): List of child components.
|
|
16
|
+
- **Events**: Handlers for sorting, filtering, and row clicks.
|
|
17
|
+
|
|
18
|
+
Example:
|
|
19
|
+
```python
|
|
20
|
+
Table(
|
|
21
|
+
columns=[
|
|
22
|
+
{"title": "User", "field": "user"},
|
|
23
|
+
{"title": "Status", "field": "status"}
|
|
24
|
+
],
|
|
25
|
+
data=[
|
|
26
|
+
{"user": "John Doe", "status": "Active"},
|
|
27
|
+
{"user": "Jane Smith", "status": "Pending"}
|
|
28
|
+
],
|
|
29
|
+
page_size=10,
|
|
30
|
+
class_name="min-w-full divide-y divide-slate-200 shadow-sm rounded-lg overflow-hidden"
|
|
31
|
+
)
|
|
32
|
+
```
|
|
33
|
+
"""
|
|
34
|
+
|
|
35
|
+
def __init__(self, columns: List[Dict[str, Any]], data: List[Dict[str, Any]], page_size: Optional[int]=None, **props):
|
|
36
|
+
super().__init__(**props)
|
|
37
|
+
self.columns = columns
|
|
38
|
+
self.data = data
|
|
39
|
+
self.page_size = page_size
|
|
40
|
+
|
|
41
|
+
def render(self) -> str:
|
|
42
|
+
# Renderiza la tabla en HTML (solo vista simple, sin JS avanzado todavía)
|
|
43
|
+
thead = '<thead><tr>' + ''.join(f'<th>{col["title"]}</th>' for col in self.columns) + '</tr></thead>'
|
|
44
|
+
rows = self.data[:self.page_size] if self.page_size else self.data
|
|
45
|
+
tbody = '<tbody>' + ''.join(
|
|
46
|
+
'<tr>' + ''.join(f'<td>{row.get(col["field"], "")}</td>' for col in self.columns) + '</tr>'
|
|
47
|
+
for row in rows) + '</tbody>'
|
|
48
|
+
return f'<table class="dars-table">{thead}{tbody}</table>'
|
|
@@ -3,10 +3,31 @@ from typing import List, Optional
|
|
|
3
3
|
|
|
4
4
|
class Tabs(Component):
|
|
5
5
|
"""
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
Tabbed navigation component for switching between multiple content panels in the same space.
|
|
7
|
+
|
|
8
|
+
Props:
|
|
9
|
+
- **tabs** (list): List of strings for the tab headers.
|
|
10
|
+
- **panels** (list): List of components or strings representing the content of each tab.
|
|
11
|
+
- **selected** (int): Index of the initially active tab (defaults to 0).
|
|
12
|
+
- **id** (str): Unique identifier for the component.
|
|
13
|
+
- **class_name** (str): String containing regular CSS class names.
|
|
14
|
+
- **style** (dict): Optional dictionary for CSS utility classes (prefer `style`).
|
|
15
|
+
- **children** (list): List of child components.
|
|
16
|
+
- **Events**: Handlers like `on_change` when the active tab is switched.
|
|
17
|
+
|
|
18
|
+
Example:
|
|
19
|
+
```python
|
|
20
|
+
Tabs(
|
|
21
|
+
tabs=["General", "Security", "Notifications"],
|
|
22
|
+
panels=[
|
|
23
|
+
Container(Text("General settings...")),
|
|
24
|
+
Container(Text("Security settings...")),
|
|
25
|
+
Container(Text("Notification settings..."))
|
|
26
|
+
],
|
|
27
|
+
selected=0,
|
|
28
|
+
class_name="bg-white rounded-xl shadow-sm border border-slate-100"
|
|
29
|
+
)
|
|
30
|
+
```
|
|
10
31
|
"""
|
|
11
32
|
|
|
12
33
|
def __init__(self, tabs: List[str], panels: List[Component], selected: Optional[int]=0, minimum_logic: bool = True, **props):
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
from typing import Optional, Dict, Any
|
|
2
|
+
|
|
3
|
+
from dars.core.component import Component
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class Audio(Component):
|
|
7
|
+
"""
|
|
8
|
+
Advanced HTML5 audio component for playing sound files.
|
|
9
|
+
|
|
10
|
+
Props:
|
|
11
|
+
- **src** (str): URL or path to the audio source.
|
|
12
|
+
- **controls** (bool): Whether to display audio controls (play/pause, volume, etc.).
|
|
13
|
+
- **autoplay** (bool): If True, the audio will start playing automatically.
|
|
14
|
+
- **loop** (bool): If True, the audio will play in a loop.
|
|
15
|
+
- **muted** (bool): If True, the audio will be muted by default.
|
|
16
|
+
- **preload** (str): Strategy for preloading ('auto', 'metadata', 'none').
|
|
17
|
+
- **id** (str): Unique identifier for the component.
|
|
18
|
+
- **class_name** (str): String containing regular CSS class names.
|
|
19
|
+
- **style** (dict): Optional dictionary for CSS utility classes (prefer `style`).
|
|
20
|
+
- **children** (list): List of child components.
|
|
21
|
+
- **Events**: Handlers like `on_play`, `on_pause`, `on_ended`, etc.
|
|
22
|
+
|
|
23
|
+
Example:
|
|
24
|
+
```python
|
|
25
|
+
Audio(
|
|
26
|
+
src="https://example.com/podcast.mp3",
|
|
27
|
+
controls=True,
|
|
28
|
+
class_name="w-full max-w-md"
|
|
29
|
+
)
|
|
30
|
+
```
|
|
31
|
+
"""
|
|
32
|
+
|
|
33
|
+
def __init__(
|
|
34
|
+
self,
|
|
35
|
+
src: str,
|
|
36
|
+
controls: bool = True,
|
|
37
|
+
autoplay: bool = False,
|
|
38
|
+
loop: bool = False,
|
|
39
|
+
muted: bool = False,
|
|
40
|
+
preload: Optional[str] = None,
|
|
41
|
+
class_name: Optional[str] = None,
|
|
42
|
+
style: Optional[Dict[str, Any]] = None,
|
|
43
|
+
attrs: Optional[Dict[str, Any]] = None,
|
|
44
|
+
**kwargs: Any,
|
|
45
|
+
) -> None:
|
|
46
|
+
super().__init__(class_name=class_name, style=style, **kwargs)
|
|
47
|
+
self.src = src
|
|
48
|
+
self.controls = controls
|
|
49
|
+
self.autoplay = autoplay
|
|
50
|
+
self.loop = loop
|
|
51
|
+
self.muted = muted
|
|
52
|
+
self.preload = preload
|
|
53
|
+
self.extra_attrs = attrs or {}
|
|
54
|
+
|
|
55
|
+
def render(self) -> str:
|
|
56
|
+
raise NotImplementedError("El método render debe ser implementado por el exportador")
|
|
@@ -5,6 +5,28 @@ from dars.scripts.script import Script
|
|
|
5
5
|
from typing import Optional, Union, Dict, Any, Callable
|
|
6
6
|
|
|
7
7
|
class Button(Component):
|
|
8
|
+
"""
|
|
9
|
+
Interactive button component that triggers actions when clicked.
|
|
10
|
+
|
|
11
|
+
Props:
|
|
12
|
+
- **text** (str): The label text displayed on the button.
|
|
13
|
+
- **disabled** (bool): Whether the button is interactive or not.
|
|
14
|
+
- **button_type** (str): HTML type of the button ('button', 'submit', 'reset').
|
|
15
|
+
- **id** (str): Unique identifier for the component.
|
|
16
|
+
- **class_name** (str): String containing regular CSS class names.
|
|
17
|
+
- **style** (dict): Optional dictionary for CSS utility classes (prefer `style`).
|
|
18
|
+
- **children** (list): List of child components to render inside the button.
|
|
19
|
+
- **Events**: Handlers like `on_click`, `on_double_click`, `on_mouse_enter`, `on_mouse_leave`, `on_mouse_down`, `on_mouse_up`, `on_key_down`, `on_key_up`.
|
|
20
|
+
|
|
21
|
+
Example:
|
|
22
|
+
```python
|
|
23
|
+
Button(
|
|
24
|
+
text="Click me!",
|
|
25
|
+
class_name="bg-indigo-600 text-white px-4 py-2 rounded shadow-md hover:shadow-lg transition-all",
|
|
26
|
+
on_click=lambda: print("Button clicked!")
|
|
27
|
+
)
|
|
28
|
+
```
|
|
29
|
+
"""
|
|
8
30
|
def __init__(
|
|
9
31
|
self,
|
|
10
32
|
text: str = "Button",
|
|
@@ -4,6 +4,31 @@ from dars.core.events import EventTypes
|
|
|
4
4
|
from typing import Optional, Union, Dict, Any, Callable
|
|
5
5
|
|
|
6
6
|
class Checkbox(Component):
|
|
7
|
+
"""
|
|
8
|
+
Interactive checkbox component for boolean input.
|
|
9
|
+
|
|
10
|
+
Props:
|
|
11
|
+
- **label** (str): Text label to display next to the checkbox.
|
|
12
|
+
- **checked** (bool): Current state of the checkbox.
|
|
13
|
+
- **value** (str): Value associated with the checkbox.
|
|
14
|
+
- **name** (str): Name attribute for form submission.
|
|
15
|
+
- **disabled** (bool): If True, the checkbox is not interactive.
|
|
16
|
+
- **required** (bool): If True, the checkbox must be checked.
|
|
17
|
+
- **id** (str): Unique identifier for the component.
|
|
18
|
+
- **class_name** (str): String containing regular CSS class names.
|
|
19
|
+
- **style** (dict): Optional dictionary for CSS utility classes (prefer `style`).
|
|
20
|
+
- **children** (list): List of child components.
|
|
21
|
+
- **Events**: Handlers like `on_change`, `on_click`, etc.
|
|
22
|
+
|
|
23
|
+
Example:
|
|
24
|
+
```python
|
|
25
|
+
Checkbox(
|
|
26
|
+
label="Accept terms and conditions",
|
|
27
|
+
on_change=lambda val: print(f"Checked: {val}"),
|
|
28
|
+
class_name="text-slate-700 font-medium cursor-pointer"
|
|
29
|
+
)
|
|
30
|
+
```
|
|
31
|
+
"""
|
|
7
32
|
def __init__(
|
|
8
33
|
self,
|
|
9
34
|
label: str = "",
|
|
@@ -3,6 +3,26 @@ from dars.core.properties import StyleProps
|
|
|
3
3
|
from typing import Optional, Union, Dict, Any, List
|
|
4
4
|
|
|
5
5
|
class Container(Component):
|
|
6
|
+
"""
|
|
7
|
+
Versatile container component (div) to wrap and organize other components.
|
|
8
|
+
|
|
9
|
+
Props:
|
|
10
|
+
- ***children** (Component): Positional arguments for child components.
|
|
11
|
+
- **additional_children** (list): Optional list of additional child components.
|
|
12
|
+
- **id** (str): Unique identifier for the component.
|
|
13
|
+
- **class_name** (str): String containing regular CSS class names.
|
|
14
|
+
- **style** (dict): Optional dictionary for CSS utility classes (prefer `style`).
|
|
15
|
+
- **Events**: Handlers like `on_click`, `on_mouse_enter`, etc.
|
|
16
|
+
|
|
17
|
+
Example:
|
|
18
|
+
```python
|
|
19
|
+
Container(
|
|
20
|
+
Text("Title"),
|
|
21
|
+
Button("Click me"),
|
|
22
|
+
class_name="flex flex-col gap-4 p-6 bg-slate-50 rounded-2xl"
|
|
23
|
+
)
|
|
24
|
+
```
|
|
25
|
+
"""
|
|
6
26
|
def __init__(
|
|
7
27
|
self,
|
|
8
28
|
*children: Component,
|
|
@@ -5,6 +5,38 @@ from typing import Optional, Union, Dict, Any, Callable
|
|
|
5
5
|
from datetime import datetime, date
|
|
6
6
|
|
|
7
7
|
class DatePicker(Component):
|
|
8
|
+
"""
|
|
9
|
+
Advanced date and time picker component for selecting dates with custom formats.
|
|
10
|
+
|
|
11
|
+
Props:
|
|
12
|
+
- **value** (str/date/datetime): Initial date value.
|
|
13
|
+
- **min_date** (str/date/datetime): Minimum selectable date.
|
|
14
|
+
- **max_date** (str/date/datetime): Maximum selectable date.
|
|
15
|
+
- **placeholder** (str): Hint text when no date is selected.
|
|
16
|
+
- **format** (str): Date format (e.g., `"YYYY-MM-DD"`, `"DD/MM/YYYY"`, `"MM/DD/YYYY"`, `"DD-MM-YYYY"`).
|
|
17
|
+
- **locale** (str): Language for the picker (e.g., `"es"`, `"en"`, `"fr"`, `"de"`, `"it"`, `"pt"`).
|
|
18
|
+
- **show_time** (bool): Whether to include a time selector.
|
|
19
|
+
- **inline** (bool): If True, shows the picker inline instead of a popup.
|
|
20
|
+
- **disabled_dates** (list): List of dates to be disabled.
|
|
21
|
+
- **disabled** (bool): If True, the component is not interactive.
|
|
22
|
+
- **required** (bool): If True, a date must be selected.
|
|
23
|
+
- **readonly** (bool): If True, the field is read-only.
|
|
24
|
+
- **id** (str): Unique identifier for the component.
|
|
25
|
+
- **class_name** (str): String containing regular CSS class names.
|
|
26
|
+
- **style** (dict): Optional dictionary for CSS utility classes (prefer `style`).
|
|
27
|
+
- **children** (list): List of child components.
|
|
28
|
+
- **Events**: Handlers like `on_change`, `on_open`, `on_close`.
|
|
29
|
+
|
|
30
|
+
Example:
|
|
31
|
+
```python
|
|
32
|
+
DatePicker(
|
|
33
|
+
placeholder="Select your birthday",
|
|
34
|
+
format="DD/MM/YYYY",
|
|
35
|
+
locale="es",
|
|
36
|
+
class_name="border p-2 rounded shadow-sm focus:ring-2 focus:ring-indigo-500"
|
|
37
|
+
)
|
|
38
|
+
```
|
|
39
|
+
"""
|
|
8
40
|
def __init__(
|
|
9
41
|
self,
|
|
10
42
|
value: Optional[Union[str, date, datetime]] = None,
|
|
@@ -2,7 +2,29 @@ from dars.core.component import Component
|
|
|
2
2
|
from typing import Optional, Dict, Any
|
|
3
3
|
|
|
4
4
|
class Image(Component):
|
|
5
|
-
"""
|
|
5
|
+
"""
|
|
6
|
+
Component for displaying images with support for dimensions and styling.
|
|
7
|
+
|
|
8
|
+
Props:
|
|
9
|
+
- **src** (str): URL or path to the image source.
|
|
10
|
+
- **alt** (str): Alternative text for accessibility.
|
|
11
|
+
- **width** (str): Width of the image (e.g., `"100px"`, `"50%"`).
|
|
12
|
+
- **height** (str): Height of the image.
|
|
13
|
+
- **id** (str): Unique identifier for the component.
|
|
14
|
+
- **class_name** (str): String containing regular CSS class names.
|
|
15
|
+
- **style** (dict): Optional dictionary for CSS utility classes (prefer `style`).
|
|
16
|
+
- **children** (list): List of child components.
|
|
17
|
+
- **Events**: Handlers like `on_click`, `on_load`, etc.
|
|
18
|
+
|
|
19
|
+
Example:
|
|
20
|
+
```python
|
|
21
|
+
Image(
|
|
22
|
+
src="https://example.com/logo.png",
|
|
23
|
+
alt="Dars Logo",
|
|
24
|
+
class_name="w-32 h-32 rounded-xl"
|
|
25
|
+
)
|
|
26
|
+
```
|
|
27
|
+
"""
|
|
6
28
|
def __init__(
|
|
7
29
|
self,
|
|
8
30
|
src: str,
|
|
@@ -4,6 +4,32 @@ from dars.core.events import EventTypes
|
|
|
4
4
|
from typing import Optional, Union, Dict, Any, Callable
|
|
5
5
|
|
|
6
6
|
class Input(Component):
|
|
7
|
+
"""
|
|
8
|
+
Interactive input field for user data entry.
|
|
9
|
+
|
|
10
|
+
Props:
|
|
11
|
+
- **value** (str): Current value of the input.
|
|
12
|
+
- **placeholder** (str): Hint text displayed when empty.
|
|
13
|
+
- **input_type** (str): HTML input type (e.g., `"text"`, `"password"`, `"email"`, `"number"`).
|
|
14
|
+
- **disabled** (bool): If True, the input is not interactive.
|
|
15
|
+
- **readonly** (bool): If True, the value cannot be modified.
|
|
16
|
+
- **required** (bool): If True, the field must be filled.
|
|
17
|
+
- **max_length** (int): Maximum number of characters allowed.
|
|
18
|
+
- **id** (str): Unique identifier for the component.
|
|
19
|
+
- **class_name** (str): String containing regular CSS class names.
|
|
20
|
+
- **style** (dict): Optional dictionary for CSS utility classes (prefer `style`).
|
|
21
|
+
- **children** (list): List of child components.
|
|
22
|
+
- **Events**: Handlers like `on_change`, `on_input`, `on_focus`, `on_blur`, `on_key_down`, `on_key_up`.
|
|
23
|
+
|
|
24
|
+
Example:
|
|
25
|
+
```python
|
|
26
|
+
Input(
|
|
27
|
+
placeholder="Enter your email...",
|
|
28
|
+
input_type="email",
|
|
29
|
+
class_name="w-full px-4 py-2 border rounded-lg focus:ring-2 focus:ring-indigo-500 outline-none"
|
|
30
|
+
)
|
|
31
|
+
```
|
|
32
|
+
"""
|
|
7
33
|
def __init__(
|
|
8
34
|
self,
|
|
9
35
|
value: str = "",
|