Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
3699cf7
[*] DatePicker: implement new component
ddudenin Sep 7, 2025
473dd54
[*] DatePicker: draft date range implementation
ddudenin Sep 17, 2025
4d11d3b
Merge branch 'main' into main
ddudenin Sep 17, 2025
3c56fee
[*] DatePicker: implement new functionality
ddudenin Sep 17, 2025
1521496
Merge branch 'main' into main
ddudenin Oct 3, 2025
e137040
[*] DatePicker: component cli
ddudenin Oct 3, 2025
cf54b21
[*] DatePicker: implement DateSegment Element
ddudenin Oct 4, 2025
6780bfa
Merge branch 'main' into main
ddudenin Oct 14, 2025
0d4e887
[*] DatePicker: docs
ddudenin Oct 14, 2025
445beb8
[*] DatePicker: fix user input after blur
ddudenin Oct 15, 2025
48e42c0
make datepicker input focusable
ealmloff Oct 16, 2025
8c45223
Merge branch 'main' into pr/ddudenin/121
ealmloff Oct 16, 2025
432be25
Fix keyboard shortcuts while datepicker is focused
ealmloff Oct 16, 2025
96a82e2
remove padding around calendar popover
ealmloff Oct 16, 2025
90fa26c
Improve clamping logic before the date is finalized
ealmloff Oct 17, 2025
b284e52
only set the date once the inputs are finished
ealmloff Oct 17, 2025
9ba8a46
tweak styling
ealmloff Oct 17, 2025
d14b1b6
don't allow invalid dates when the month changes
ealmloff Oct 17, 2025
7433bc6
tweak calendar input layout
ealmloff Oct 17, 2025
6b3ba49
simplify dom structure
ealmloff Oct 17, 2025
1d3bc13
more style tweaks
ealmloff Oct 17, 2025
30f49c8
rotate dropdown arrow
ealmloff Oct 17, 2025
bf991b5
simplify state model
ealmloff Oct 20, 2025
99fcda8
undo view date changes
ealmloff Oct 20, 2025
8563844
fix formatting
ealmloff Oct 20, 2025
ffa0777
fix trigger aria label
ealmloff Oct 20, 2025
59c6c70
fix doc tests
ealmloff Oct 20, 2025
26d281d
fix clippy
ealmloff Oct 20, 2025
c8f546e
normalize and reformat styles with stylelint
ealmloff Oct 20, 2025
84d790f
update docs.md and swap DatePickerPopover so it wraps the input
ealmloff Oct 20, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Building styled and more featured component libraries on top of Dioxus Primitive

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

28/28
28/29

- [x] Accordion
- [x] Alert Dialog
Expand All @@ -43,6 +43,7 @@ We're still in the early days - Many components are still being created and stab
- [x] Checkbox
- [x] Collapsible
- [x] Context Menu
- [ ] Date Picker
- [x] Dialog
- [x] Dropdown Menu
- [x] Hover Card
Expand Down
3 changes: 2 additions & 1 deletion component.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"preview/src/components/toggle_group",
"preview/src/components/context_menu",
"preview/src/components/aspect_ratio",
"preview/src/components/scroll_area"
"preview/src/components/scroll_area",
"preview/src/components/date_picker"
]
}
2 changes: 1 addition & 1 deletion preview/assets/dx-components-theme.css
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ body {
}

:hover {
scrollbar-color: var(--secondary-color-2) rgba(0, 0, 0, 0);
scrollbar-color: var(--secondary-color-2) rgb(0 0 0 / 0%);
}
}

Expand Down
10 changes: 5 additions & 5 deletions preview/assets/hero.css
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,11 @@
flex-direction: row;
align-items: center;
justify-content: center;
gap: 1em;
padding: 0.5em 1em;
border: 1px solid var(--primary-color-6);
border-radius: 0.5rem;
padding: 0.5em 1em;
margin: 1em auto;
gap: 1em;
}

#hero-installation:hover {
Expand All @@ -77,9 +77,9 @@
flex-direction: row;
align-items: center;
justify-content: center;
gap: 1em;
background: var(--primary-warning-color);
border-radius: 0.5rem;
padding: 0.5em 1em;
border-radius: 0.5rem;
margin: 1em auto;
background: var(--primary-warning-color);
gap: 1em;
}
18 changes: 9 additions & 9 deletions preview/assets/language-select.css
Original file line number Diff line number Diff line change
Expand Up @@ -10,29 +10,29 @@
}

.language-select-container:has(:focus-visible) {
outline: 2px solid var(--focused-border-color);
border-radius: 0.5rem;
outline: 2px solid var(--focused-border-color);
}

.language-select {
opacity: 0;
inset: 0;
position: absolute;
width: 100%;
height: 100%;
margin: 0;
position: absolute;
padding: .25rem;
margin: 0;
inset: 0;
opacity: 0;
}

.language-select-value {
display: inline-flex;
align-items: center;
justify-content: center;
padding: .25rem;
border: none;
background-color: transparent;
color: var(--secondary-color-4);
cursor: pointer;
font-size: 1.5rem;
display: inline-flex;
align-items: center;
justify-content: center;
padding: .25rem;
transition: background-color 0.2s ease, color 0.2s ease;
}
10 changes: 5 additions & 5 deletions preview/assets/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -116,14 +116,14 @@ body {
display: flex;
align-items: center;
justify-content: center;
gap: 0.5em;
padding: 0;
border: none;
border-radius: 0.5rem;
margin: 0;
background: none;
color: var(--secondary-color-4);
cursor: pointer;
margin: 0;
padding: 0;
gap: 0.5em;
}

.copy-button:hover {
Expand Down Expand Up @@ -198,8 +198,8 @@ body {
}

.component-installation-list {
list-style-type: decimal;
padding-left: 2rem;
list-style-type: decimal;
}

.component-installation-list li {
Expand Down Expand Up @@ -254,6 +254,6 @@ body {

/* Disable animations while the page is loading */
.preload * {
transition: none !important;
animation-duration: 0.001s !important;
transition: none !important;
}
2 changes: 2 additions & 0 deletions preview/src/components/alert_dialog/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
opacity: 1;
transform: scale(1) translateY(0);
}

100% {
opacity: 0;
transform: scale(0.95) translateY(-2px);
Expand All @@ -30,6 +31,7 @@
opacity: 0;
transform: scale(0.95) translateY(-2px);
}

100% {
opacity: 1;
transform: scale(1) translateY(0);
Expand Down
8 changes: 7 additions & 1 deletion preview/src/components/button/style.css
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
.button {
padding: 8px 18px;
border-radius: 0.5rem;
border: none;
border-radius: 0.5rem;
cursor: pointer;
font-size: 1rem;
transition: background-color 0.2s ease, color 0.2s ease;
}

.button:focus-visible {
box-shadow: 0 0 0 2px var(--focused-border-color);
}
Expand All @@ -14,6 +15,7 @@
background-color: var(--secondary-color-2);
color: var(--primary-color);
}

.button[data-style="primary"]:hover {
background-color: var(--secondary-color-1);
}
Expand All @@ -22,6 +24,7 @@
background-color: var(--primary-color-5);
color: var(--secondary-color-1);
}

.button[data-style="secondary"]:hover {
background-color: var(--primary-color-4);
}
Expand All @@ -30,6 +33,7 @@
background-color: transparent;
color: var(--secondary-color-4);
}

.button[data-style="ghost"]:hover {
background-color: var(--primary-color-5);
color: var(--secondary-color-1);
Expand All @@ -41,6 +45,7 @@
var(--dark, var(--primary-color-3));
color: var(--secondary-color-4);
}

.button[data-style="outline"]:hover {
background-color: var(--primary-color-4);
}
Expand All @@ -49,6 +54,7 @@
background-color: var(--primary-error-color);
color: var(--contrast-error-color);
}

.button[data-style="destructive"]:hover {
background-color: var(--secondary-error-color);
}
18 changes: 9 additions & 9 deletions preview/src/components/calendar/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -159,31 +159,31 @@
}

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


.calendar-month-select, .calendar-year-select {
opacity: 0;
inset: 0;
position: absolute;
width: 100%;
height: 100%;
margin: 0;
position: absolute;
padding: .25rem;
margin: 0;
inset: 0;
opacity: 0;
}

.calendar-month-select-value, .calendar-year-select-value {
display: inline-flex;
align-items: center;
justify-content: center;
padding: .25rem;
border: none;
background-color: transparent;
color: var(--secondary-color-4);
cursor: pointer;
font-size: 1rem;
display: inline-flex;
align-items: center;
justify-content: center;
padding: .25rem;
transition: background-color 0.2s ease, color 0.2s ease;
}

Expand Down
2 changes: 2 additions & 0 deletions preview/src/components/context_menu/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
opacity: 1;
transform: scale(1) translateY(0);
}

100% {
opacity: 0;
transform: scale(0.95) translateY(-2px);
Expand All @@ -36,6 +37,7 @@
opacity: 0;
transform: scale(0.95) translateY(-2px);
}

100% {
opacity: 1;
transform: scale(1) translateY(0);
Expand Down
13 changes: 13 additions & 0 deletions preview/src/components/date_picker/component.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"name": "date_picker",
"description": "A date picker component to select or input dates.",
"authors": ["Evan Almloff"],
"exclude": ["variants", "docs.md", "component.json"],
"cargoDependencies": [
{
"name": "dioxus-primitives",
"git": "https://github.com/DioxusLabs/components"
}
],
"globalAssets": ["../../../assets/dx-components-theme.css"]
}
90 changes: 90 additions & 0 deletions preview/src/components/date_picker/component.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
use dioxus::prelude::*;

use dioxus_primitives::{
date_picker::{self, DatePickerInputProps, DatePickerProps},
popover::{PopoverContentProps, PopoverTriggerProps},
ContentAlign,
};

use super::super::calendar::component::*;
use super::super::popover::component::*;

#[component]
pub fn DatePicker(props: DatePickerProps) -> Element {
rsx! {
document::Link { rel: "stylesheet", href: asset!("./style.css") }
div {
date_picker::DatePicker {
class: "date-picker",
on_value_change: props.on_value_change,
selected_date: props.selected_date,
disabled: props.disabled,
read_only: props.read_only,
attributes: props.attributes,
date_picker::DatePickerPopover {
popover_root: PopoverRoot,
{props.children}
}
}
}
}
}

#[component]
pub fn DatePickerInput(props: DatePickerInputProps) -> Element {
rsx! {
date_picker::DatePickerInput {
on_format_day_placeholder: props.on_format_day_placeholder,
on_format_month_placeholder: props.on_format_month_placeholder,
on_format_year_placeholder: props.on_format_year_placeholder,
attributes: props.attributes,
{props.children}
DatePickerPopoverTrigger {}
DatePickerPopoverContent {
align: ContentAlign::Center,
date_picker::DatePickerCalendar {
calendar: Calendar,
CalendarHeader {
CalendarNavigation {
CalendarPreviousMonthButton {}
CalendarSelectMonth {}
CalendarSelectYear {}
CalendarNextMonthButton {}
}
}
CalendarGrid {}
}
}
}
}
}

#[component]
pub fn DatePickerPopoverTrigger(props: PopoverTriggerProps) -> Element {
rsx! {
PopoverTrigger {
aria_label: "Show Calendar",
attributes: props.attributes,
svg {
class: "date-picker-expand-icon",
view_box: "0 0 24 24",
xmlns: "http://www.w3.org/2000/svg",
polyline { points: "6 9 12 15 18 9" }
}
}
}
}

#[component]
pub fn DatePickerPopoverContent(props: PopoverContentProps) -> Element {
rsx! {
PopoverContent {
class: "popover-content",
id: props.id,
side: props.side,
align: props.align,
attributes: props.attributes,
{props.children}
}
}
}
Loading
Loading