@bison-lab/ui 4.10.2 → 4.12.5
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.
- package/dist/index.mjs +7 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.mjs
CHANGED
|
@@ -1909,13 +1909,17 @@ PopoverContent.displayName = Popover$1.Content.displayName;
|
|
|
1909
1909
|
const DatePicker = React.forwardRef(({ value, onChange, placeholder = "Pick a date", dateFormat = "PPP", disabled = false, className, fromDate, toDate, disabledDates, calendarLabel = "Choose a date", size = "md" }, ref) => {
|
|
1910
1910
|
const fieldProps = useFieldControl({});
|
|
1911
1911
|
const [open, setOpen] = React.useState(false);
|
|
1912
|
+
const [month, setMonth] = React.useState(value);
|
|
1912
1913
|
const handleSelect = (date) => {
|
|
1913
1914
|
onChange?.(date);
|
|
1914
1915
|
setOpen(false);
|
|
1915
1916
|
};
|
|
1916
1917
|
return /* @__PURE__ */ jsxs(Popover, {
|
|
1917
1918
|
open,
|
|
1918
|
-
onOpenChange:
|
|
1919
|
+
onOpenChange: (next) => {
|
|
1920
|
+
setOpen(next);
|
|
1921
|
+
if (next) setMonth(value ?? /* @__PURE__ */ new Date());
|
|
1922
|
+
},
|
|
1919
1923
|
children: [/* @__PURE__ */ jsx(PopoverTrigger, {
|
|
1920
1924
|
asChild: true,
|
|
1921
1925
|
children: /* @__PURE__ */ jsxs(Button, {
|
|
@@ -1934,6 +1938,8 @@ const DatePicker = React.forwardRef(({ value, onChange, placeholder = "Pick a da
|
|
|
1934
1938
|
children: /* @__PURE__ */ jsx(Calendar, {
|
|
1935
1939
|
mode: "single",
|
|
1936
1940
|
selected: value,
|
|
1941
|
+
month,
|
|
1942
|
+
onMonthChange: setMonth,
|
|
1937
1943
|
onSelect: handleSelect,
|
|
1938
1944
|
disabled: disabledDates ? disabledDates : void 0,
|
|
1939
1945
|
startMonth: fromDate,
|