Skip to content

Commit dfc589b

Browse files
ddudeninealmloff
andauthored
Date Picker component (#121)
* [*] DatePicker: implement new component - Select single day - Use time create for dates - Displaying a single month calendar view - No examples in docs - Fix CalendarSelectYear/CalendarSelectMonth date math bug * [*] DatePicker: draft date range implementation * [*] DatePicker: implement new functionality - Add popover with Calendar - Pass Calendar as child - Correct input validation - Split from preview - Fix add Calendar empty cells - Localization * [*] DatePicker: component cli * [*] DatePicker: implement DateSegment Element - Refact signals - Split Popover component - Delete unused styles * [*] DatePicker: docs * [*] DatePicker: fix user input after blur * make datepicker input focusable * Fix keyboard shortcuts while datepicker is focused * remove padding around calendar popover * Improve clamping logic before the date is finalized * only set the date once the inputs are finished * tweak styling * don't allow invalid dates when the month changes * tweak calendar input layout * simplify dom structure * more style tweaks * rotate dropdown arrow * simplify state model * undo view date changes * fix formatting * fix trigger aria label * fix doc tests * fix clippy * normalize and reformat styles with stylelint * update docs.md and swap DatePickerPopover so it wraps the input --------- Co-authored-by: Evan Almloff <[email protected]>
1 parent 723d43c commit dfc589b

File tree

34 files changed

+1152
-77
lines changed

34 files changed

+1152
-77
lines changed

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ Building styled and more featured component libraries on top of Dioxus Primitive
3333

3434
We're still in the early days - Many components are still being created and stabilized.
3535

36-
28/28
36+
28/29
3737

3838
- [x] Accordion
3939
- [x] Alert Dialog
@@ -43,6 +43,7 @@ We're still in the early days - Many components are still being created and stab
4343
- [x] Checkbox
4444
- [x] Collapsible
4545
- [x] Context Menu
46+
- [ ] Date Picker
4647
- [x] Dialog
4748
- [x] Dropdown Menu
4849
- [x] Hover Card

component.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
"preview/src/components/toggle_group",
3333
"preview/src/components/context_menu",
3434
"preview/src/components/aspect_ratio",
35-
"preview/src/components/scroll_area"
35+
"preview/src/components/scroll_area",
36+
"preview/src/components/date_picker"
3637
]
3738
}

preview/assets/dx-components-theme.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ body {
7171
}
7272

7373
:hover {
74-
scrollbar-color: var(--secondary-color-2) rgba(0, 0, 0, 0);
74+
scrollbar-color: var(--secondary-color-2) rgb(0 0 0 / 0%);
7575
}
7676
}
7777

preview/assets/hero.css

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,11 @@
6161
flex-direction: row;
6262
align-items: center;
6363
justify-content: center;
64-
gap: 1em;
64+
padding: 0.5em 1em;
6565
border: 1px solid var(--primary-color-6);
6666
border-radius: 0.5rem;
67-
padding: 0.5em 1em;
6867
margin: 1em auto;
68+
gap: 1em;
6969
}
7070

7171
#hero-installation:hover {
@@ -77,9 +77,9 @@
7777
flex-direction: row;
7878
align-items: center;
7979
justify-content: center;
80-
gap: 1em;
81-
background: var(--primary-warning-color);
82-
border-radius: 0.5rem;
8380
padding: 0.5em 1em;
81+
border-radius: 0.5rem;
8482
margin: 1em auto;
83+
background: var(--primary-warning-color);
84+
gap: 1em;
8585
}

preview/assets/language-select.css

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,29 +10,29 @@
1010
}
1111

1212
.language-select-container:has(:focus-visible) {
13-
outline: 2px solid var(--focused-border-color);
1413
border-radius: 0.5rem;
14+
outline: 2px solid var(--focused-border-color);
1515
}
1616

1717
.language-select {
18-
opacity: 0;
19-
inset: 0;
18+
position: absolute;
2019
width: 100%;
2120
height: 100%;
22-
margin: 0;
23-
position: absolute;
2421
padding: .25rem;
22+
margin: 0;
23+
inset: 0;
24+
opacity: 0;
2525
}
2626

2727
.language-select-value {
28+
display: inline-flex;
29+
align-items: center;
30+
justify-content: center;
31+
padding: .25rem;
2832
border: none;
2933
background-color: transparent;
3034
color: var(--secondary-color-4);
3135
cursor: pointer;
3236
font-size: 1.5rem;
33-
display: inline-flex;
34-
align-items: center;
35-
justify-content: center;
36-
padding: .25rem;
3737
transition: background-color 0.2s ease, color 0.2s ease;
3838
}

preview/assets/main.css

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -116,14 +116,14 @@ body {
116116
display: flex;
117117
align-items: center;
118118
justify-content: center;
119-
gap: 0.5em;
119+
padding: 0;
120120
border: none;
121121
border-radius: 0.5rem;
122+
margin: 0;
122123
background: none;
123124
color: var(--secondary-color-4);
124125
cursor: pointer;
125-
margin: 0;
126-
padding: 0;
126+
gap: 0.5em;
127127
}
128128

129129
.copy-button:hover {
@@ -198,8 +198,8 @@ body {
198198
}
199199

200200
.component-installation-list {
201-
list-style-type: decimal;
202201
padding-left: 2rem;
202+
list-style-type: decimal;
203203
}
204204

205205
.component-installation-list li {
@@ -254,6 +254,6 @@ body {
254254

255255
/* Disable animations while the page is loading */
256256
.preload * {
257-
transition: none !important;
258257
animation-duration: 0.001s !important;
258+
transition: none !important;
259259
}

preview/src/components/alert_dialog/style.css

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
opacity: 1;
1616
transform: scale(1) translateY(0);
1717
}
18+
1819
100% {
1920
opacity: 0;
2021
transform: scale(0.95) translateY(-2px);
@@ -30,6 +31,7 @@
3031
opacity: 0;
3132
transform: scale(0.95) translateY(-2px);
3233
}
34+
3335
100% {
3436
opacity: 1;
3537
transform: scale(1) translateY(0);

preview/src/components/button/style.css

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
.button {
22
padding: 8px 18px;
3-
border-radius: 0.5rem;
43
border: none;
4+
border-radius: 0.5rem;
55
cursor: pointer;
66
font-size: 1rem;
77
transition: background-color 0.2s ease, color 0.2s ease;
88
}
9+
910
.button:focus-visible {
1011
box-shadow: 0 0 0 2px var(--focused-border-color);
1112
}
@@ -14,6 +15,7 @@
1415
background-color: var(--secondary-color-2);
1516
color: var(--primary-color);
1617
}
18+
1719
.button[data-style="primary"]:hover {
1820
background-color: var(--secondary-color-1);
1921
}
@@ -22,6 +24,7 @@
2224
background-color: var(--primary-color-5);
2325
color: var(--secondary-color-1);
2426
}
27+
2528
.button[data-style="secondary"]:hover {
2629
background-color: var(--primary-color-4);
2730
}
@@ -30,6 +33,7 @@
3033
background-color: transparent;
3134
color: var(--secondary-color-4);
3235
}
36+
3337
.button[data-style="ghost"]:hover {
3438
background-color: var(--primary-color-5);
3539
color: var(--secondary-color-1);
@@ -41,6 +45,7 @@
4145
var(--dark, var(--primary-color-3));
4246
color: var(--secondary-color-4);
4347
}
48+
4449
.button[data-style="outline"]:hover {
4550
background-color: var(--primary-color-4);
4651
}
@@ -49,6 +54,7 @@
4954
background-color: var(--primary-error-color);
5055
color: var(--contrast-error-color);
5156
}
57+
5258
.button[data-style="destructive"]:hover {
5359
background-color: var(--secondary-error-color);
5460
}

preview/src/components/calendar/style.css

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -159,31 +159,31 @@
159159
}
160160

161161
.calendar-month-select-container:has(:focus-visible), .calendar-year-select-container:has(:focus-visible) {
162-
outline: 2px solid var(--focused-border-color);
163162
border-radius: 0.5rem;
163+
outline: 2px solid var(--focused-border-color);
164164
}
165165

166166

167167
.calendar-month-select, .calendar-year-select {
168-
opacity: 0;
169-
inset: 0;
168+
position: absolute;
170169
width: 100%;
171170
height: 100%;
172-
margin: 0;
173-
position: absolute;
174171
padding: .25rem;
172+
margin: 0;
173+
inset: 0;
174+
opacity: 0;
175175
}
176176

177177
.calendar-month-select-value, .calendar-year-select-value {
178+
display: inline-flex;
179+
align-items: center;
180+
justify-content: center;
181+
padding: .25rem;
178182
border: none;
179183
background-color: transparent;
180184
color: var(--secondary-color-4);
181185
cursor: pointer;
182186
font-size: 1rem;
183-
display: inline-flex;
184-
align-items: center;
185-
justify-content: center;
186-
padding: .25rem;
187187
transition: background-color 0.2s ease, color 0.2s ease;
188188
}
189189

0 commit comments

Comments
 (0)