@povio/ui 2.2.9-rc.12 → 2.2.9-rc.13
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/components/inputs/DateTime/DateTimePicker/DateTimePicker.d.ts +1 -0
- package/dist/components/inputs/DateTime/DateTimePicker/DateTimePicker.js +3 -2
- package/dist/components/inputs/DateTime/shared/Calendar.d.ts +5 -2
- package/dist/components/inputs/DateTime/shared/Calendar.js +23 -6
- package/dist/components/inputs/DateTime/shared/CalendarCell.d.ts +1 -1
- package/dist/components/inputs/DateTime/shared/CalendarCell.js +2 -2
- package/dist/components/inputs/DateTime/shared/CalendarGrid.d.ts +1 -1
- package/dist/components/inputs/Selection/Autocomplete/Autocomplete.js +3 -2
- package/dist/components/inputs/Selection/shared/SelectListBox.d.ts +1 -1
- package/dist/components/inputs/Selection/shared/SelectListBox.js +2 -2
- package/dist/config/uiConfig.context.d.ts +3 -1
- package/dist/config/uiConfig.context.js +2 -1
- package/package.json +1 -1
|
@@ -17,6 +17,7 @@ interface DateTimePickerBaseProps extends FormFieldProps, InputVariantProps, Omi
|
|
|
17
17
|
isDirty?: boolean;
|
|
18
18
|
disableManualEntry?: boolean;
|
|
19
19
|
autoFixYear?: boolean;
|
|
20
|
+
setDateValueOnDateSelection?: boolean;
|
|
20
21
|
placeholder?: string;
|
|
21
22
|
inputClassName?: string;
|
|
22
23
|
onBlur?: (e: FocusEvent<HTMLInputElement>) => void;
|
|
@@ -17,7 +17,7 @@ import { useCalendarState, useDatePickerState } from "react-stately";
|
|
|
17
17
|
//#region src/components/inputs/DateTime/DateTimePicker/DateTimePicker.tsx
|
|
18
18
|
var DateTimePickerBase = (props) => {
|
|
19
19
|
const ui = UIConfig.useConfig();
|
|
20
|
-
const { ref, label, tooltipText, helperText, isRequired, rightContent, isDisabled, isDirty, headerClassName, errorClassName, isHeaderHidden, error, onChange, onBlur, value, disableDropdown, isTimeOptional, placeholder, inputClassName, hideLabel = ui.input.hideLabel, variant = ui.input.variant, as = ui.input.as, size = ui.input.size, isClearable = ui.input.isClearable, todayIcon = ui.dateInput.todayIcon, todayIconButtonSize = ui.dateInput.todayIconButtonSize, shouldForceLeadingZeros = ui.dateInput.shouldForceLeadingZeros, disableManualEntry = ui.dateInput.disableManualEntry, autoFixYear = ui.dateInput.autoFixYear, ...rest } = props;
|
|
20
|
+
const { ref, label, tooltipText, helperText, isRequired, rightContent, isDisabled, isDirty, headerClassName, errorClassName, isHeaderHidden, error, onChange, onBlur, value, disableDropdown, isTimeOptional, placeholder, inputClassName, hideLabel = ui.input.hideLabel, variant = ui.input.variant, as = ui.input.as, size = ui.input.size, isClearable = ui.input.isClearable, todayIcon = ui.dateInput.todayIcon, todayIconButtonSize = ui.dateInput.todayIconButtonSize, shouldForceLeadingZeros = ui.dateInput.shouldForceLeadingZeros, disableManualEntry = ui.dateInput.disableManualEntry, autoFixYear = ui.dateInput.autoFixYear, setDateValueOnDateSelection = ui.dateInput.setDateValueOnDateSelection, ...rest } = props;
|
|
21
21
|
const formFieldProps = {
|
|
22
22
|
error,
|
|
23
23
|
label,
|
|
@@ -177,7 +177,8 @@ var DateTimePickerBase = (props) => {
|
|
|
177
177
|
calendarProps,
|
|
178
178
|
includesTime: true,
|
|
179
179
|
datePickerState: dialogState,
|
|
180
|
-
onApply
|
|
180
|
+
onApply,
|
|
181
|
+
setDateValueOnDateSelection
|
|
181
182
|
})
|
|
182
183
|
})]
|
|
183
184
|
})
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { CalendarState, CalendarStateOptions } from '@react-stately/calendar';
|
|
2
|
+
import { DateValue } from 'react-aria';
|
|
2
3
|
import { DatePickerState } from 'react-stately';
|
|
3
4
|
type DateTimeCalendarProps = {
|
|
4
5
|
includesTime?: false;
|
|
@@ -13,8 +14,10 @@ type CalendarProps = DateTimeCalendarProps & {
|
|
|
13
14
|
className?: string;
|
|
14
15
|
state: CalendarState;
|
|
15
16
|
calendarProps: Omit<CalendarStateOptions, "locale" | "createCalendar">;
|
|
16
|
-
onApply: () => void;
|
|
17
|
+
onApply: (selectedDate?: DateValue) => void;
|
|
18
|
+
onDateSelectionChange?: (selectedDate: DateValue) => void;
|
|
19
|
+
setDateValueOnDateSelection?: boolean;
|
|
17
20
|
};
|
|
18
21
|
export type ToggleState = "month" | "year" | "time";
|
|
19
|
-
export declare const Calendar: ({ className, includesTime, datePickerState, hourCycle, onApply, ...props }: CalendarProps) => import("react/jsx-runtime").JSX.Element;
|
|
22
|
+
export declare const Calendar: ({ className, includesTime, datePickerState, hourCycle, onApply, onDateSelectionChange, setDateValueOnDateSelection, ...props }: CalendarProps) => import("react/jsx-runtime").JSX.Element;
|
|
20
23
|
export {};
|
|
@@ -5,20 +5,37 @@ import { TimePickerForm } from "./TimePickerForm.js";
|
|
|
5
5
|
import { YearPicker } from "./YearPicker.js";
|
|
6
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
7
|
import { clsx } from "clsx";
|
|
8
|
-
import { useState } from "react";
|
|
8
|
+
import { useCallback, useState } from "react";
|
|
9
9
|
import { useCalendar } from "@react-aria/calendar";
|
|
10
10
|
//#region src/components/inputs/DateTime/shared/Calendar.tsx
|
|
11
|
-
var Calendar = ({ className, includesTime, datePickerState, hourCycle, onApply, ...props }) => {
|
|
11
|
+
var Calendar = ({ className, includesTime, datePickerState, hourCycle, onApply, onDateSelectionChange, setDateValueOnDateSelection = false, ...props }) => {
|
|
12
12
|
const [toggleState, setToggleState] = useState(null);
|
|
13
13
|
const { calendarProps, prevButtonProps, nextButtonProps } = useCalendar(props.calendarProps, props.state);
|
|
14
|
-
const
|
|
15
|
-
if (includesTime
|
|
16
|
-
|
|
14
|
+
const onDateSelection = useCallback((date) => {
|
|
15
|
+
if (!includesTime || !setDateValueOnDateSelection) return;
|
|
16
|
+
datePickerState.setDateValue(date);
|
|
17
|
+
}, [
|
|
18
|
+
includesTime,
|
|
19
|
+
datePickerState,
|
|
20
|
+
setDateValueOnDateSelection
|
|
21
|
+
]);
|
|
22
|
+
const handleDateChange = (selectedDate) => {
|
|
23
|
+
const resolvedDate = selectedDate ?? props.state.focusedDate;
|
|
24
|
+
if (includesTime && resolvedDate && setDateValueOnDateSelection) {
|
|
25
|
+
datePickerState.setDateValue(resolvedDate);
|
|
26
|
+
onDateSelectionChange?.(resolvedDate);
|
|
27
|
+
}
|
|
28
|
+
if (includesTime && toggleState !== "time") {
|
|
29
|
+
setToggleState("time");
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
onApply(resolvedDate);
|
|
17
33
|
};
|
|
18
34
|
const getContent = () => {
|
|
19
35
|
if (!toggleState) return /* @__PURE__ */ jsx(CalendarGrid, {
|
|
20
36
|
state: props.state,
|
|
21
|
-
onApply: handleDateChange
|
|
37
|
+
onApply: handleDateChange,
|
|
38
|
+
onDateSelection
|
|
22
39
|
});
|
|
23
40
|
if (toggleState === "month") return /* @__PURE__ */ jsx(MonthPicker, {
|
|
24
41
|
state: props.state,
|
|
@@ -4,7 +4,7 @@ import { KeyboardEvent } from 'react';
|
|
|
4
4
|
import { DateValue } from 'react-aria';
|
|
5
5
|
interface CalendarCellProps extends AriaCalendarCellProps {
|
|
6
6
|
state: CalendarState | RangeCalendarState;
|
|
7
|
-
onApply?: () => void;
|
|
7
|
+
onApply?: (selectedDate?: DateValue) => void;
|
|
8
8
|
shouldCloseOnSelect?: boolean;
|
|
9
9
|
onDateSelection?: (date: DateValue) => void;
|
|
10
10
|
onDateHover?: (date: DateValue | null) => void;
|
|
@@ -17,7 +17,7 @@ var CalendarCell = ({ state, onApply, shouldCloseOnSelect = true, onDateSelectio
|
|
|
17
17
|
const onClick = useCallback((event) => {
|
|
18
18
|
buttonProps.onClick?.(event);
|
|
19
19
|
if (onDateSelection) onDateSelection(props.date);
|
|
20
|
-
if (isSelected && shouldCloseOnSelect) onApply?.();
|
|
20
|
+
if (isSelected && shouldCloseOnSelect) onApply?.(props.date);
|
|
21
21
|
}, [
|
|
22
22
|
buttonProps,
|
|
23
23
|
onDateSelection,
|
|
@@ -87,7 +87,7 @@ var CalendarCell = ({ state, onApply, shouldCloseOnSelect = true, onDateSelectio
|
|
|
87
87
|
state.setFocusedDate(props.date);
|
|
88
88
|
}
|
|
89
89
|
eventHandler?.(event);
|
|
90
|
-
if (isSelected && shouldCloseOnSelect) onApply?.();
|
|
90
|
+
if (isSelected && shouldCloseOnSelect) onApply?.(props.date);
|
|
91
91
|
};
|
|
92
92
|
const onMouseEnter = useCallback(() => {
|
|
93
93
|
if (onDateHover && selectionState.isSelectingMode) onDateHover(props.date);
|
|
@@ -4,7 +4,7 @@ import { KeyboardEvent } from 'react';
|
|
|
4
4
|
import { DateValue } from 'react-aria';
|
|
5
5
|
interface CalendarGridProps extends AriaCalendarGridProps {
|
|
6
6
|
state: CalendarState | RangeCalendarState;
|
|
7
|
-
onApply?: () => void;
|
|
7
|
+
onApply?: (selectedDate?: DateValue) => void;
|
|
8
8
|
offset?: {
|
|
9
9
|
months?: number;
|
|
10
10
|
};
|
|
@@ -5,7 +5,7 @@ import { Controller } from "react-hook-form";
|
|
|
5
5
|
//#region src/components/inputs/Selection/Autocomplete/Autocomplete.tsx
|
|
6
6
|
function Autocomplete(props) {
|
|
7
7
|
if ("formControl" in props && props.formControl) {
|
|
8
|
-
const { formControl, ref, ...innerProps } = props;
|
|
8
|
+
const { ignoreInputValueFiltering = true, formControl, ref, ...innerProps } = props;
|
|
9
9
|
return /* @__PURE__ */ jsx(Controller, {
|
|
10
10
|
control: formControl.control,
|
|
11
11
|
name: formControl.name,
|
|
@@ -18,7 +18,8 @@ function Autocomplete(props) {
|
|
|
18
18
|
isDirty,
|
|
19
19
|
isDisabled: field.disabled || props.isDisabled,
|
|
20
20
|
error: props.error ?? error?.message,
|
|
21
|
-
isSearchable: true
|
|
21
|
+
isSearchable: true,
|
|
22
|
+
ignoreInputValueFiltering
|
|
22
23
|
})
|
|
23
24
|
});
|
|
24
25
|
}
|
|
@@ -6,4 +6,4 @@ export interface SelectListBoxProps extends Pick<SelectBaseProps, "label" | "new
|
|
|
6
6
|
isScrollable?: boolean;
|
|
7
7
|
onClose?: () => void;
|
|
8
8
|
}
|
|
9
|
-
export declare const SelectListBox: ({ label, selectionMode, isSearchable, isScrollable, virtualizerOptions, totalItems,
|
|
9
|
+
export declare const SelectListBox: ({ label, selectionMode, isSearchable, isScrollable, virtualizerOptions, totalItems, newItemRender, onLoadMore, className, onClose, ...props }: SelectListBoxProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -7,8 +7,8 @@ import { jsx } from "react/jsx-runtime";
|
|
|
7
7
|
import { clsx } from "clsx";
|
|
8
8
|
import { ListBox, ListLayout, Virtualizer } from "react-aria-components";
|
|
9
9
|
//#region src/components/inputs/Selection/shared/SelectListBox.tsx
|
|
10
|
-
var SelectListBox = ({ label, selectionMode, isSearchable, isScrollable = true, virtualizerOptions, totalItems,
|
|
11
|
-
const { fieldState, onChange, listItems, selectableListItems, selectedIds, isMultiple, onClear, onSelectAll } = SelectContext.useSelect();
|
|
10
|
+
var SelectListBox = ({ label, selectionMode, isSearchable, isScrollable = true, virtualizerOptions, totalItems, newItemRender, onLoadMore, className, onClose, ...props }) => {
|
|
11
|
+
const { fieldState, onChange, listItems, selectableListItems, selectedIds, isMultiple, onClear, onSelectAll, hasLoadMore } = SelectContext.useSelect();
|
|
12
12
|
const onSelectionChange = (value) => {
|
|
13
13
|
const ids = Array.from(value);
|
|
14
14
|
if (!isMultiple && ids.length === 0) {
|
|
@@ -33,7 +33,9 @@ export declare namespace UIConfig {
|
|
|
33
33
|
};
|
|
34
34
|
toggle: Pick<ToggleProps, "variant">;
|
|
35
35
|
slider: Pick<SliderProps, "minValue" | "maxValue">;
|
|
36
|
-
dateInput: Pick<DatePickerProps, "todayIcon" | "todayIconButtonSize" | "shouldForceLeadingZeros" | "disableManualEntry" | "autoFixYear"
|
|
36
|
+
dateInput: Pick<DatePickerProps, "todayIcon" | "todayIconButtonSize" | "shouldForceLeadingZeros" | "disableManualEntry" | "autoFixYear"> & {
|
|
37
|
+
setDateValueOnDateSelection?: boolean;
|
|
38
|
+
};
|
|
37
39
|
actionModal: Pick<ActionModalProps, "titleTypography" | "descriptionTypography">;
|
|
38
40
|
bottomSheet: Pick<BottomSheetProps, "closeDragThreshold" | "closeVelocityThreshold" | "hideThumb" | "headerTypography">;
|
|
39
41
|
tableHeaderText: Pick<HeaderTextProps, "variant" | "size">;
|