dash-week-range-picker 0.0.1__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.
File without changes
@@ -0,0 +1,11 @@
1
+ include dash_week_range_picker/dash_week_range_picker.min.js
2
+ include dash_week_range_picker/dash_week_range_picker.min.js.map
3
+ include dash_week_range_picker/async-*.js
4
+ include dash_week_range_picker/async-*.js.map
5
+ include dash_week_range_picker/*-shared.js
6
+ include dash_week_range_picker/*-shared.js.map
7
+ include dash_week_range_picker/metadata.json
8
+ include dash_week_range_picker/package-info.json
9
+ include README.md
10
+ include LICENSE
11
+ include package.json
@@ -0,0 +1,115 @@
1
+ Metadata-Version: 2.4
2
+ Name: dash_week_range_picker
3
+ Version: 0.0.1
4
+ Summary: Mantine-based ISO-week range picker for Dash
5
+ Author: Ihor Lazariev <121246456+ihor-lazariev@users.noreply.github.com>
6
+ License: MIT
7
+ Classifier: Framework :: Dash
8
+ Description-Content-Type: text/markdown
9
+ License-File: LICENSE
10
+ Dynamic: author
11
+ Dynamic: classifier
12
+ Dynamic: description
13
+ Dynamic: description-content-type
14
+ Dynamic: license
15
+ Dynamic: license-file
16
+ Dynamic: summary
17
+
18
+ # Dash Week Range Picker
19
+
20
+ Dash Week Range Picker is a Dash component library.
21
+
22
+ Mantine-based ISO-week range picker for Dash
23
+
24
+ Get started with:
25
+ 1. Install Dash and its dependencies: https://dash.plotly.com/installation
26
+ 2. Run `python usage.py`
27
+ 3. Visit http://localhost:8050 in your web browser
28
+
29
+ ## Contributing
30
+
31
+ See [CONTRIBUTING.md](./CONTRIBUTING.md)
32
+
33
+ ### Install dependencies
34
+
35
+ If you have selected install_dependencies during the prompt, you can skip this part.
36
+
37
+ 1. Install npm packages
38
+ ```
39
+ $ npm install
40
+ ```
41
+ 2. Create a virtual env and activate.
42
+ ```
43
+ $ virtualenv venv
44
+ $ . venv/bin/activate
45
+ ```
46
+ _Note: venv\Scripts\activate for windows_
47
+
48
+ 3. Install python packages required to build components.
49
+ ```
50
+ $ pip install -r requirements.txt
51
+ ```
52
+ 4. Install the python packages for testing (optional)
53
+ ```
54
+ $ pip install -r tests/requirements.txt
55
+ ```
56
+
57
+ ### Write your component code in `src/lib/components/DashWeekRangePicker.react.js`.
58
+
59
+ - The demo app is in `src/demo` and you will import your example component code into your demo app.
60
+ - Test your code in a Python environment:
61
+ 1. Build your code
62
+ ```
63
+ $ npm run build
64
+ ```
65
+ 2. Run and modify the `usage.py` sample dash app:
66
+ ```
67
+ $ python usage.py
68
+ ```
69
+ - Write tests for your component.
70
+ - A sample test is available in `tests/test_usage.py`, it will load `usage.py` and you can then automate interactions with selenium.
71
+ - Run the tests with `$ pytest tests`.
72
+ - The Dash team uses these types of integration tests extensively. Browse the Dash component code on GitHub for more examples of testing (e.g. https://github.com/plotly/dash-core-components)
73
+ - Add custom styles to your component by putting your custom CSS files into your distribution folder (`dash_week_range_picker`).
74
+ - Make sure that they are referenced in `MANIFEST.in` so that they get properly included when you're ready to publish your component.
75
+ - Make sure the stylesheets are added to the `_css_dist` dict in `dash_week_range_picker/__init__.py` so dash will serve them automatically when the component suite is requested.
76
+ - [Review your code](./review_checklist.md)
77
+
78
+ ### Create a production build and publish:
79
+
80
+ 1. Build your code:
81
+ ```
82
+ $ npm run build
83
+ ```
84
+ 2. Create a Python distribution
85
+ ```
86
+ $ python setup.py sdist bdist_wheel
87
+ ```
88
+ This will create source and wheel distribution in the generated the `dist/` folder.
89
+ See [PyPA](https://packaging.python.org/guides/distributing-packages-using-setuptools/#packaging-your-project)
90
+ for more information.
91
+
92
+ 3. Test your tarball by copying it into a new environment and installing it locally:
93
+ ```
94
+ $ pip install dash_week_range_picker-0.0.1.tar.gz
95
+ ```
96
+
97
+ 4. If it works, then you can publish the component to NPM and PyPI:
98
+ 1. Publish on PyPI
99
+ ```
100
+ $ twine upload dist/*
101
+ ```
102
+ 2. Cleanup the dist folder (optional)
103
+ ```
104
+ $ rm -rf dist
105
+ ```
106
+ 3. Publish on NPM (Optional if chosen False in `publish_on_npm`)
107
+ ```
108
+ $ npm publish
109
+ ```
110
+ _Publishing your component to NPM will make the JavaScript bundles available on the unpkg CDN. By default, Dash serves the component library's CSS and JS locally, but if you choose to publish the package to NPM you can set `serve_locally` to `False` and you may see faster load times._
111
+
112
+ 5. Share your component with the community! https://community.plotly.com/c/dash
113
+ 1. Publish this repository to GitHub
114
+ 2. Tag your GitHub repository with the plotly-dash tag so that it appears here: https://github.com/topics/plotly-dash
115
+ 3. Create a post in the Dash community forum: https://community.plotly.com/c/dash
@@ -0,0 +1,98 @@
1
+ # Dash Week Range Picker
2
+
3
+ Dash Week Range Picker is a Dash component library.
4
+
5
+ Mantine-based ISO-week range picker for Dash
6
+
7
+ Get started with:
8
+ 1. Install Dash and its dependencies: https://dash.plotly.com/installation
9
+ 2. Run `python usage.py`
10
+ 3. Visit http://localhost:8050 in your web browser
11
+
12
+ ## Contributing
13
+
14
+ See [CONTRIBUTING.md](./CONTRIBUTING.md)
15
+
16
+ ### Install dependencies
17
+
18
+ If you have selected install_dependencies during the prompt, you can skip this part.
19
+
20
+ 1. Install npm packages
21
+ ```
22
+ $ npm install
23
+ ```
24
+ 2. Create a virtual env and activate.
25
+ ```
26
+ $ virtualenv venv
27
+ $ . venv/bin/activate
28
+ ```
29
+ _Note: venv\Scripts\activate for windows_
30
+
31
+ 3. Install python packages required to build components.
32
+ ```
33
+ $ pip install -r requirements.txt
34
+ ```
35
+ 4. Install the python packages for testing (optional)
36
+ ```
37
+ $ pip install -r tests/requirements.txt
38
+ ```
39
+
40
+ ### Write your component code in `src/lib/components/DashWeekRangePicker.react.js`.
41
+
42
+ - The demo app is in `src/demo` and you will import your example component code into your demo app.
43
+ - Test your code in a Python environment:
44
+ 1. Build your code
45
+ ```
46
+ $ npm run build
47
+ ```
48
+ 2. Run and modify the `usage.py` sample dash app:
49
+ ```
50
+ $ python usage.py
51
+ ```
52
+ - Write tests for your component.
53
+ - A sample test is available in `tests/test_usage.py`, it will load `usage.py` and you can then automate interactions with selenium.
54
+ - Run the tests with `$ pytest tests`.
55
+ - The Dash team uses these types of integration tests extensively. Browse the Dash component code on GitHub for more examples of testing (e.g. https://github.com/plotly/dash-core-components)
56
+ - Add custom styles to your component by putting your custom CSS files into your distribution folder (`dash_week_range_picker`).
57
+ - Make sure that they are referenced in `MANIFEST.in` so that they get properly included when you're ready to publish your component.
58
+ - Make sure the stylesheets are added to the `_css_dist` dict in `dash_week_range_picker/__init__.py` so dash will serve them automatically when the component suite is requested.
59
+ - [Review your code](./review_checklist.md)
60
+
61
+ ### Create a production build and publish:
62
+
63
+ 1. Build your code:
64
+ ```
65
+ $ npm run build
66
+ ```
67
+ 2. Create a Python distribution
68
+ ```
69
+ $ python setup.py sdist bdist_wheel
70
+ ```
71
+ This will create source and wheel distribution in the generated the `dist/` folder.
72
+ See [PyPA](https://packaging.python.org/guides/distributing-packages-using-setuptools/#packaging-your-project)
73
+ for more information.
74
+
75
+ 3. Test your tarball by copying it into a new environment and installing it locally:
76
+ ```
77
+ $ pip install dash_week_range_picker-0.0.1.tar.gz
78
+ ```
79
+
80
+ 4. If it works, then you can publish the component to NPM and PyPI:
81
+ 1. Publish on PyPI
82
+ ```
83
+ $ twine upload dist/*
84
+ ```
85
+ 2. Cleanup the dist folder (optional)
86
+ ```
87
+ $ rm -rf dist
88
+ ```
89
+ 3. Publish on NPM (Optional if chosen False in `publish_on_npm`)
90
+ ```
91
+ $ npm publish
92
+ ```
93
+ _Publishing your component to NPM will make the JavaScript bundles available on the unpkg CDN. By default, Dash serves the component library's CSS and JS locally, but if you choose to publish the package to NPM you can set `serve_locally` to `False` and you may see faster load times._
94
+
95
+ 5. Share your component with the community! https://community.plotly.com/c/dash
96
+ 1. Publish this repository to GitHub
97
+ 2. Tag your GitHub repository with the plotly-dash tag so that it appears here: https://github.com/topics/plotly-dash
98
+ 3. Create a post in the Dash community forum: https://community.plotly.com/c/dash
@@ -0,0 +1,193 @@
1
+ # AUTO GENERATED FILE - DO NOT EDIT
2
+
3
+ import typing # noqa: F401
4
+ from typing_extensions import TypedDict, NotRequired, Literal # noqa: F401
5
+ from dash.development.base_component import Component, _explicitize_args
6
+ try:
7
+ from dash.types import NumberType # noqa: F401
8
+ except ImportError:
9
+ # Backwards compatibility for dash<=4.1.0
10
+ if typing.TYPE_CHECKING:
11
+ raise
12
+ NumberType = typing.Union[ # noqa: F401
13
+ typing.SupportsFloat, typing.SupportsInt, typing.SupportsComplex
14
+ ]
15
+
16
+ ComponentSingleType = typing.Union[str, int, float, Component, None]
17
+ ComponentType = typing.Union[
18
+ ComponentSingleType,
19
+ typing.Sequence[ComponentSingleType],
20
+ ]
21
+
22
+
23
+ class WeekRangePickerInput(Component):
24
+ """A WeekRangePickerInput component.
25
+ WeekRangePickerInput - an ISO-week-granularity range picker (Mantine `Calendar` + `PickerInputBase`
26
+ composed by hand, the same public building blocks Mantine's own `YearPickerInput`/`MonthPickerInput`
27
+ are built from). Clicking any day selects/commits its whole ISO week (Monday-Sunday), instead of the
28
+ arbitrary single day a normal date-range picker would give you.
29
+
30
+ `value` is always `[startISO, endISO]` where both bounds already fall on a Monday/Sunday
31
+ respectively, or `[startISO, null]` while a range is mid-selection (exactly one week picked so far),
32
+ or `[null, null]` when empty - the same shape a Dash range DatePickerInput already emits, so it drops
33
+ into any callback written against `utils.dates.unpack_range`/`range_pending` unchanged.
34
+
35
+ Keyword arguments:
36
+
37
+ - id (string | dict; optional):
38
+ The ID used to identify this component in Dash callbacks. Works as
39
+ a normal Dash id, including pattern-matching (dict) ids.
40
+
41
+ - className (string; optional):
42
+ CSS class for the outer wrapper div.
43
+
44
+ - clearable (boolean; default True):
45
+ Shows a clear button (resets value to `[None, None]`) once a range
46
+ is selected.
47
+
48
+ - closeOnChange (boolean; default False):
49
+ Closes the calendar popover as soon as a range is completed (or a
50
+ preset is clicked).
51
+
52
+ - firstDayOfWeek (number; default 1):
53
+ 0-6, where 1 = Monday. Do not change this - the
54
+ click-to-select-week snapping logic always snaps to the
55
+ Monday/Sunday of the ISO week regardless of this prop, so changing
56
+ it would only desync the visual grid from that logic, not the
57
+ weeks it actually selects.
58
+
59
+ - forceColorScheme (a value equal to: 'light', 'dark'; default undefined):
60
+ Forces a specific color scheme (\"light\" | \"dark\") on this
61
+ component's own `MantineProvider`, independent of the host app's
62
+ own scheme.
63
+
64
+ - highlightToday (boolean; default True):
65
+ Highlights today's date in the calendar.
66
+
67
+ - loading_state (dict; optional):
68
+ Object that holds the loading state object coming from
69
+ dash-renderer.
70
+
71
+ `loading_state` is a dict with keys:
72
+
73
+ - is_loading (boolean; optional):
74
+ Determines if the component is loading or not.
75
+
76
+ - prop_name (string; optional):
77
+ Holds which property is loading.
78
+
79
+ - component_name (string; optional):
80
+ Holds the name of the component that is loading.
81
+
82
+ - maxDate (string; optional):
83
+ Latest selectable date, ISO `YYYY-MM-DD`.
84
+
85
+ - minDate (string; optional):
86
+ Earliest selectable date, ISO `YYYY-MM-DD`. Does not need to be
87
+ week-aligned itself; days before it are disabled in the calendar
88
+ the normal Mantine way.
89
+
90
+ - persisted_props (list of a value equal to: 'value's; default ['value']):
91
+ Properties whose user interactions will persist after refreshing
92
+ the component or the page.
93
+
94
+ - persistence (boolean | string | number; default False):
95
+ Used to allow user interactions in this component to be persisted
96
+ when the component - or the page - is refreshed. If `persisted` is
97
+ truthy and `persistence_type` is `session`, the value is persisted
98
+ for the duration of the browser session.
99
+
100
+ - persistence_type (a value equal to: 'local', 'session', 'memory'; default 'local'):
101
+ Where persisted user changes will be stored: `memory` (only kept
102
+ in memory, reset on page refresh), `local` (window.localStorage,
103
+ data is kept after the browser quit), or `session`
104
+ (window.sessionStorage, data is cleared once the browser quit).
105
+
106
+ - placeholder (string; default 'Select Period'):
107
+ Text shown in the input when no range is selected.
108
+
109
+ - presets (list of dicts; optional):
110
+ Quick-pick shortcuts shown to the left of the calendar, each
111
+ `value` already a week-aligned `[startISO, endISO]` pair, e.g.
112
+ `{\"label\": \"Last 12 Weeks\", \"value\": [\"2026-03-16\",
113
+ \"2026-06-07\"]}`.
114
+
115
+ `presets` is a list of dicts with keys:
116
+
117
+ - label (string; optional)
118
+
119
+ - value (list of strings; optional)
120
+
121
+ - theme (dict; optional):
122
+ Mantine theme override, merged into this component's own isolated
123
+ `MantineProvider` (this component ships its own private copy of
124
+ `@mantine/core`, so it does not automatically inherit a host app's
125
+ `MantineProvider` theme - pass the same theme dict the host app
126
+ uses here instead).
127
+
128
+ - value (list of strings; default [None, None]):
129
+ `[startISO, endISO]`, both ISO `YYYY-MM-DD` and already
130
+ week-aligned (Monday/Sunday), e.g. `[\"2026-06-01\",
131
+ \"2026-06-07\"]`. `[startISO, None]` while a range is
132
+ mid-selection (one week picked so far). `[None, None]` (or unset)
133
+ when empty.
134
+
135
+ - withWeekNumbers (boolean; default True):
136
+ Shows the ISO week-number column next to the calendar grid."""
137
+ _children_props: typing.List[str] = []
138
+ _base_nodes = ['children']
139
+ _namespace = 'dash_week_range_picker'
140
+ _type = 'WeekRangePickerInput'
141
+ Presets = TypedDict(
142
+ "Presets",
143
+ {
144
+ "label": NotRequired[str],
145
+ "value": NotRequired[typing.Sequence[str]]
146
+ }
147
+ )
148
+
149
+ LoadingState = TypedDict(
150
+ "LoadingState",
151
+ {
152
+ "is_loading": NotRequired[bool],
153
+ "prop_name": NotRequired[str],
154
+ "component_name": NotRequired[str]
155
+ }
156
+ )
157
+
158
+
159
+ def __init__(
160
+ self,
161
+ id: typing.Optional[typing.Union[str, dict]] = None,
162
+ value: typing.Optional[typing.Sequence[str]] = None,
163
+ minDate: typing.Optional[str] = None,
164
+ maxDate: typing.Optional[str] = None,
165
+ presets: typing.Optional[typing.Sequence["Presets"]] = None,
166
+ placeholder: typing.Optional[str] = None,
167
+ clearable: typing.Optional[bool] = None,
168
+ closeOnChange: typing.Optional[bool] = None,
169
+ withWeekNumbers: typing.Optional[bool] = None,
170
+ highlightToday: typing.Optional[bool] = None,
171
+ firstDayOfWeek: typing.Optional[NumberType] = None,
172
+ theme: typing.Optional[dict] = None,
173
+ forceColorScheme: typing.Optional[Literal["light", "dark"]] = None,
174
+ className: typing.Optional[str] = None,
175
+ style: typing.Optional[typing.Any] = None,
176
+ loading_state: typing.Optional["LoadingState"] = None,
177
+ persistence: typing.Optional[typing.Union[bool, str, NumberType]] = None,
178
+ persisted_props: typing.Optional[typing.Sequence[Literal["value"]]] = None,
179
+ persistence_type: typing.Optional[Literal["local", "session", "memory"]] = None,
180
+ **kwargs
181
+ ):
182
+ self._prop_names = ['id', 'className', 'clearable', 'closeOnChange', 'firstDayOfWeek', 'forceColorScheme', 'highlightToday', 'loading_state', 'maxDate', 'minDate', 'persisted_props', 'persistence', 'persistence_type', 'placeholder', 'presets', 'style', 'theme', 'value', 'withWeekNumbers']
183
+ self._valid_wildcard_attributes = []
184
+ self.available_properties = ['id', 'className', 'clearable', 'closeOnChange', 'firstDayOfWeek', 'forceColorScheme', 'highlightToday', 'loading_state', 'maxDate', 'minDate', 'persisted_props', 'persistence', 'persistence_type', 'placeholder', 'presets', 'style', 'theme', 'value', 'withWeekNumbers']
185
+ self.available_wildcard_properties = []
186
+ _explicit_args = kwargs.pop('_explicit_args')
187
+ _locals = locals()
188
+ _locals.update(kwargs) # For wildcard attrs and excess named props
189
+ args = {k: _locals[k] for k in _explicit_args}
190
+
191
+ super(WeekRangePickerInput, self).__init__(**args)
192
+
193
+ setattr(WeekRangePickerInput, "__init__", _explicitize_args(WeekRangePickerInput.__init__))
@@ -0,0 +1,87 @@
1
+ from __future__ import print_function as _
2
+
3
+ import os as _os
4
+ import sys as _sys
5
+ import json
6
+
7
+ import dash as _dash
8
+
9
+ # noinspection PyUnresolvedReferences
10
+ from ._imports_ import *
11
+ from ._imports_ import __all__
12
+
13
+ if not hasattr(_dash, '__plotly_dash') and not hasattr(_dash, 'development'):
14
+ print('Dash was not successfully imported. '
15
+ 'Make sure you don\'t have a file '
16
+ 'named \n"dash.py" in your current directory.', file=_sys.stderr)
17
+ _sys.exit(1)
18
+
19
+ _basepath = _os.path.dirname(__file__)
20
+ _filepath = _os.path.abspath(_os.path.join(_basepath, 'package-info.json'))
21
+ with open(_filepath) as f:
22
+ package = json.load(f)
23
+
24
+ package_name = package['name'].replace(' ', '_').replace('-', '_')
25
+ __version__ = package['version']
26
+
27
+ _current_path = _os.path.dirname(_os.path.abspath(__file__))
28
+
29
+ _this_module = _sys.modules[__name__]
30
+
31
+ async_resources = []
32
+
33
+ _js_dist = []
34
+
35
+ _js_dist.extend(
36
+ [
37
+ {
38
+ "relative_package_path": "async-{}.js".format(async_resource),
39
+ "external_url": (
40
+ "https://unpkg.com/{0}@{2}"
41
+ "/{1}/async-{3}.js"
42
+ ).format(package_name, __name__, __version__, async_resource),
43
+ "namespace": package_name,
44
+ "async": True,
45
+ }
46
+ for async_resource in async_resources
47
+ ]
48
+ )
49
+
50
+ # TODO: Figure out if unpkg link works
51
+ _js_dist.extend(
52
+ [
53
+ {
54
+ "relative_package_path": "async-{}.js.map".format(async_resource),
55
+ "external_url": (
56
+ "https://unpkg.com/{0}@{2}"
57
+ "/{1}/async-{3}.js.map"
58
+ ).format(package_name, __name__, __version__, async_resource),
59
+ "namespace": package_name,
60
+ "dynamic": True,
61
+ }
62
+ for async_resource in async_resources
63
+ ]
64
+ )
65
+
66
+ _js_dist.extend(
67
+ [
68
+ {
69
+ 'relative_package_path': 'dash_week_range_picker.min.js',
70
+
71
+ 'namespace': package_name
72
+ },
73
+ {
74
+ 'relative_package_path': 'dash_week_range_picker.min.js.map',
75
+
76
+ 'namespace': package_name,
77
+ 'dynamic': True
78
+ }
79
+ ]
80
+ )
81
+
82
+ _css_dist = []
83
+
84
+
85
+ for _component in __all__:
86
+ setattr(locals()[_component], '_js_dist', _js_dist)
87
+ setattr(locals()[_component], '_css_dist', _css_dist)
@@ -0,0 +1,5 @@
1
+ from .WeekRangePickerInput import WeekRangePickerInput
2
+
3
+ __all__ = [
4
+ "WeekRangePickerInput"
5
+ ]