@povio/ui 2.2.9-rc.4 → 2.2.9-rc.40
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/buttons/Button/Button.d.ts +2 -1
- package/dist/components/buttons/Button/Button.js +41 -32
- package/dist/components/buttons/InlineIconButton/InlineIconButton.d.ts +2 -1
- package/dist/components/buttons/InlineIconButton/InlineIconButton.js +2 -2
- package/dist/components/inputs/Checkbox/Checkbox.js +6 -1
- package/dist/components/inputs/Checkbox/checkbox.cva.d.ts +3 -0
- package/dist/components/inputs/Checkbox/checkbox.cva.js +2 -1
- package/dist/components/inputs/DateTime/DatePicker/DatePicker.d.ts +8 -3
- package/dist/components/inputs/DateTime/DatePicker/DatePicker.js +81 -6
- package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.d.ts +7 -2
- package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.js +83 -5
- package/dist/components/inputs/DateTime/DateTimePicker/DateTimePicker.d.ts +8 -2
- package/dist/components/inputs/DateTime/DateTimePicker/DateTimePicker.js +84 -7
- package/dist/components/inputs/DateTime/TimePicker/TimePicker.d.ts +2 -1
- package/dist/components/inputs/DateTime/TimePicker/TimePicker.js +60 -4
- 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 +3 -3
- package/dist/components/inputs/DateTime/shared/CalendarGrid.d.ts +1 -1
- package/dist/components/inputs/DateTime/shared/DateField.js +3 -10
- package/dist/components/inputs/DateTime/shared/DatePickerInput.d.ts +6 -2
- package/dist/components/inputs/DateTime/shared/DatePickerInput.js +65 -55
- package/dist/components/inputs/DateTime/shared/DateSegmentItem.d.ts +14 -0
- package/dist/components/inputs/DateTime/shared/DateSegmentItem.js +19 -6
- package/dist/components/inputs/DateTime/shared/TimePickerInput.js +4 -2
- package/dist/components/inputs/DateTime/shared/datePicker.types.d.ts +4 -0
- package/dist/components/inputs/DateTime/shared/datePickerInput.cva.d.ts +7 -0
- package/dist/components/inputs/DateTime/shared/datePickerInput.cva.js +13 -0
- package/dist/components/inputs/DateTime/shared/datePickerTodayIcon.d.ts +6 -0
- package/dist/components/inputs/DateTime/shared/datePickerTodayIcon.js +21 -0
- package/dist/components/inputs/DateTime/shared/dateSegment.utils.d.ts +2 -0
- package/dist/components/inputs/DateTime/shared/dateSegment.utils.js +9 -0
- package/dist/components/inputs/DateTime/shared/dateSegment.utils.spec.d.ts +1 -0
- package/dist/components/inputs/DateTime/shared/staticDateTimeSegments.d.ts +35 -0
- package/dist/components/inputs/DateTime/shared/staticDateTimeSegments.js +80 -0
- package/dist/components/inputs/File/FileUpload.js +1 -0
- package/dist/components/inputs/File/shared/InputUploadContent.js +1 -0
- package/dist/components/inputs/FormField/FormField.d.ts +3 -3
- package/dist/components/inputs/FormField/FormFieldHeader.d.ts +2 -2
- package/dist/components/inputs/FormField/FormFieldHeader.js +3 -1
- package/dist/components/inputs/FormField/FormFieldLabel.d.ts +2 -2
- package/dist/components/inputs/FormField/formFieldHeader.cva.d.ts +6 -0
- package/dist/components/inputs/FormField/formFieldHeader.cva.js +11 -0
- package/dist/components/inputs/Input/NumberInput/NumberInput.d.ts +5 -2
- package/dist/components/inputs/Input/NumberInput/NumberInput.js +78 -7
- package/dist/components/inputs/Input/NumberRangeInput/NumberRangeField.d.ts +45 -0
- package/dist/components/inputs/Input/NumberRangeInput/NumberRangeField.js +146 -0
- package/dist/components/inputs/Input/NumberRangeInput/NumberRangeInput.d.ts +35 -0
- package/dist/components/inputs/Input/NumberRangeInput/NumberRangeInput.js +233 -0
- package/dist/components/inputs/Input/TextArea/TextArea.cva.d.ts +4 -0
- package/dist/components/inputs/Input/TextArea/TextArea.cva.js +5 -0
- package/dist/components/inputs/Input/TextArea/TextArea.js +3 -1
- package/dist/components/inputs/Input/TextInput/TextInput.d.ts +3 -1
- package/dist/components/inputs/Input/TextInput/TextInput.js +77 -7
- package/dist/components/inputs/Input/shared/InputContent.js +7 -6
- package/dist/components/inputs/Input/shared/numberStatic.utils.d.ts +1 -0
- package/dist/components/inputs/Input/shared/numberStatic.utils.js +7 -0
- package/dist/components/inputs/Inputs/InputItem.d.ts +12 -9
- package/dist/components/inputs/Inputs/InputItem.js +2 -0
- package/dist/components/inputs/RadioGroup/RadioGroup.d.ts +2 -1
- package/dist/components/inputs/RadioGroup/RadioGroup.js +106 -25
- package/dist/components/inputs/RadioGroup/radio.cva.d.ts +17 -0
- package/dist/components/inputs/RadioGroup/radio.cva.js +42 -1
- package/dist/components/inputs/Selection/Autocomplete/Autocomplete.d.ts +6 -2
- package/dist/components/inputs/Selection/Autocomplete/Autocomplete.js +98 -6
- package/dist/components/inputs/Selection/Autocomplete/QueryAutocomplete.d.ts +1 -1
- package/dist/components/inputs/Selection/Autocomplete/QueryAutocomplete.js +15 -10
- package/dist/components/inputs/Selection/Autocomplete/queryAutocomplete.types.d.ts +25 -19
- package/dist/components/inputs/Selection/Select/QuerySelect.d.ts +3 -3
- package/dist/components/inputs/Selection/Select/QuerySelect.js +8 -35
- package/dist/components/inputs/Selection/Select/Select.d.ts +7 -3
- package/dist/components/inputs/Selection/Select/Select.js +111 -4
- package/dist/components/inputs/Selection/shared/SelectBase.d.ts +4 -1
- package/dist/components/inputs/Selection/shared/SelectBase.js +3 -2
- package/dist/components/inputs/Selection/shared/SelectDesktop.d.ts +1 -1
- package/dist/components/inputs/Selection/shared/SelectDesktop.js +8 -4
- package/dist/components/inputs/Selection/shared/SelectInput.d.ts +2 -2
- package/dist/components/inputs/Selection/shared/SelectInput.js +13 -2
- package/dist/components/inputs/Selection/shared/SelectListBox.d.ts +2 -2
- package/dist/components/inputs/Selection/shared/SelectListBox.js +3 -3
- package/dist/components/inputs/Selection/shared/SelectMobile.d.ts +1 -1
- package/dist/components/inputs/Selection/shared/SelectMobile.js +5 -3
- package/dist/components/inputs/Selection/shared/select.context.d.ts +3 -2
- package/dist/components/inputs/Selection/shared/select.context.js +27 -4
- package/dist/components/inputs/Selection/shared/select.types.d.ts +3 -2
- package/dist/components/inputs/Selection/shared/selectDesktop.cva.d.ts +3 -0
- package/dist/components/inputs/Selection/shared/selectDesktop.cva.js +5 -0
- package/dist/components/inputs/Selection/shared/staticSelect.utils.d.ts +23 -0
- package/dist/components/inputs/Selection/shared/staticSelect.utils.js +37 -0
- package/dist/components/inputs/Selection/shared/staticSelect.utils.spec.d.ts +1 -0
- package/dist/components/inputs/Skeleton/InputFrame.d.ts +77 -0
- package/dist/components/inputs/Skeleton/InputFrame.js +200 -0
- package/dist/components/inputs/TextEditor/TextEditor.js +1 -0
- package/dist/components/inputs/Toggle/Toggle.js +6 -1
- package/dist/components/inputs/Toggle/toggle.cva.d.ts +3 -0
- package/dist/components/inputs/Toggle/toggle.cva.js +2 -1
- package/dist/components/inputs/shared/CheckContent.d.ts +2 -1
- package/dist/components/inputs/shared/CheckContent.js +3 -4
- package/dist/components/inputs/shared/InputClear.d.ts +2 -1
- package/dist/components/inputs/shared/InputClear.js +13 -1
- package/dist/components/inputs/shared/StaticInput.d.ts +38 -0
- package/dist/components/inputs/shared/TooltipWrapper.js +5 -1
- package/dist/components/inputs/shared/input.cva.d.ts +10 -0
- package/dist/components/inputs/shared/input.cva.js +19 -1
- package/dist/components/inputs/shared/tooltipWrapper.cva.d.ts +4 -0
- package/dist/components/inputs/shared/tooltipWrapper.cva.js +5 -0
- package/dist/components/inputs/shared/useStaticInputHandoff.d.ts +13 -0
- package/dist/components/inputs/shared/useStaticInputHandoff.js +47 -0
- package/dist/config/uiConfig.context.d.ts +8 -2
- package/dist/config/uiConfig.context.js +12 -1
- package/dist/config/uiStyle.context.d.ts +27 -4
- package/dist/hooks/useIntersectionObserver.d.ts +1 -1
- package/dist/hooks/useIntersectionObserver.js +29 -10
- package/dist/hooks/useQueryAutocomplete.d.ts +5 -16
- package/dist/hooks/useQueryAutocomplete.js +20 -5
- package/dist/index.d.ts +5 -0
- package/dist/index.js +3 -2
- package/dist/tw-ui-plugin.js +2 -0
- package/dist/utils/date-time.utils.d.ts +30 -9
- package/dist/utils/date-time.utils.js +113 -1
- package/dist/utils/query.utils.d.ts +4 -0
- package/dist/utils/query.utils.js +8 -0
- package/package.json +1 -1
|
@@ -15,17 +15,30 @@ var getPlaceholder = (segment) => {
|
|
|
15
15
|
var DateSegmentItem = ({ segment, state, isDisabled, timePickerOnly, hidePlaceholder }) => {
|
|
16
16
|
const ref = useRef(null);
|
|
17
17
|
const { segmentProps } = useDateSegment(segment, state, ref);
|
|
18
|
-
|
|
18
|
+
return /* @__PURE__ */ jsx(DateSegmentItemView, {
|
|
19
|
+
ref,
|
|
20
|
+
segmentProps,
|
|
21
|
+
type: segment.type,
|
|
22
|
+
text: segment.text,
|
|
23
|
+
placeholder: getPlaceholder(segment),
|
|
24
|
+
isPlaceholder: segment.isPlaceholder,
|
|
25
|
+
isInputEmpty: !state.value,
|
|
26
|
+
isDisabled,
|
|
27
|
+
timePickerOnly,
|
|
28
|
+
hidePlaceholder
|
|
29
|
+
});
|
|
30
|
+
};
|
|
31
|
+
var DateSegmentItemView = ({ ref, segmentProps, type, text, placeholder, isPlaceholder, isInputEmpty, isDisabled, timePickerOnly, hidePlaceholder }) => {
|
|
19
32
|
return /* @__PURE__ */ jsx("div", {
|
|
20
33
|
...segmentProps,
|
|
21
34
|
ref,
|
|
22
|
-
className: clsx("box-content rounded-input-rounding-default", isDisabled && "text-interactive-text-secondary-disabled", !isDisabled && isInputEmpty && "text-text-default-3 group-focus-within:text-text-default-1", !isDisabled && !isInputEmpty && "text-text-default-1", "focus-within:outline-1 focus-within:outline-interactive-contained-primary-idle focus-within:outline-offset-1", ["hour", "dayPeriod"].includes(
|
|
23
|
-
children: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
35
|
+
className: clsx("box-content rounded-input-rounding-default", isDisabled && "text-interactive-text-secondary-disabled", !isDisabled && isInputEmpty && "text-text-default-3 group-focus-within:text-text-default-1", !isDisabled && !isInputEmpty && "text-text-default-1", "focus-within:outline-1 focus-within:outline-interactive-contained-primary-idle focus-within:outline-offset-1", type && ["hour", "dayPeriod"].includes(type) && !timePickerOnly && "ml-1", hidePlaceholder && "opacity-0"),
|
|
36
|
+
children: /* @__PURE__ */ jsxs(Fragment, { children: [isPlaceholder && /* @__PURE__ */ jsx("span", {
|
|
24
37
|
"aria-hidden": "true",
|
|
25
38
|
className: "pointer-events-none",
|
|
26
|
-
children:
|
|
27
|
-
}),
|
|
39
|
+
children: placeholder
|
|
40
|
+
}), isPlaceholder ? "" : text] })
|
|
28
41
|
});
|
|
29
42
|
};
|
|
30
43
|
//#endregion
|
|
31
|
-
export { DateSegmentItem, getPlaceholder };
|
|
44
|
+
export { DateSegmentItem, DateSegmentItemView, getPlaceholder };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ClockIcon } from "../../../../assets/icons/Clock.js";
|
|
2
1
|
import { UIStyle } from "../../../../config/uiStyle.context.js";
|
|
3
2
|
import { Typography } from "../../../text/Typography/Typography.js";
|
|
3
|
+
import { UIConfig } from "../../../../config/uiConfig.context.js";
|
|
4
4
|
import { InlineIconButton } from "../../../buttons/InlineIconButton/InlineIconButton.js";
|
|
5
5
|
import { FormFieldLabel } from "../../FormField/FormFieldLabel.js";
|
|
6
6
|
import { InputClear } from "../../shared/InputClear.js";
|
|
@@ -13,6 +13,7 @@ import { Button } from "react-aria-components";
|
|
|
13
13
|
import { useFocusVisible, useFocusWithin, useHover } from "react-aria";
|
|
14
14
|
//#region src/components/inputs/DateTime/shared/TimePickerInput.tsx
|
|
15
15
|
var TimePickerInput = ({ ref, as, fieldProps, state, isDisabled, isDirty, isRequired, isInvalid, disableDropdown, variant, size, isClearable, headerProps, disableManualEntry, placeholder, className, onPress, ...props }) => {
|
|
16
|
+
const uiConfig = UIConfig.useConfig();
|
|
16
17
|
const inputBaseCva = UIStyle.useCva("input.baseCva", inputBase);
|
|
17
18
|
const inputSizeCva = UIStyle.useCva("input.sizeCva", inputSize);
|
|
18
19
|
const { hoverProps, isHovered } = useHover({ isDisabled });
|
|
@@ -32,6 +33,7 @@ var TimePickerInput = ({ ref, as, fieldProps, state, isDisabled, isDirty, isRequ
|
|
|
32
33
|
"data-datetime-input": "",
|
|
33
34
|
"data-hovered": isHovered || void 0,
|
|
34
35
|
"data-disabled": isDisabled || void 0,
|
|
36
|
+
"data-is-disabled": isDisabled || void 0,
|
|
35
37
|
"data-invalid": isInvalid || void 0,
|
|
36
38
|
"data-is-empty": state.value === null || void 0,
|
|
37
39
|
"data-focus-within": isFocused || void 0,
|
|
@@ -83,7 +85,7 @@ var TimePickerInput = ({ ref, as, fieldProps, state, isDisabled, isDirty, isRequ
|
|
|
83
85
|
label: "",
|
|
84
86
|
color: "secondary",
|
|
85
87
|
onPress,
|
|
86
|
-
icon:
|
|
88
|
+
icon: uiConfig.dateInput.timeIcon,
|
|
87
89
|
isDisabled,
|
|
88
90
|
className: "border-0!"
|
|
89
91
|
})]
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { IconButtonProps } from '../../../buttons/IconButton/IconButton';
|
|
2
|
+
export type DatePickerTodayIcon = boolean | IconButtonProps["icon"];
|
|
3
|
+
export type DatePickerTodayIconButtonSize = IconButtonProps["size"];
|
|
4
|
+
export type DatePickerTodayIconPlacement = "content" | "fieldLabel";
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { VariantProps } from 'class-variance-authority';
|
|
2
|
+
import { InputSizeProps } from '../../shared/input.cva';
|
|
3
|
+
export declare const datePickerInputContentRow: (props?: ({
|
|
4
|
+
size?: "small" | "default" | "extra-small" | "large" | null | undefined;
|
|
5
|
+
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
6
|
+
export interface DatePickerInputContentRowProps extends VariantProps<typeof datePickerInputContentRow>, InputSizeProps {
|
|
7
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { cva } from "class-variance-authority";
|
|
2
|
+
//#region src/components/inputs/DateTime/shared/datePickerInput.cva.ts
|
|
3
|
+
var datePickerInputContentRow = cva("flex items-center gap-input-gap-input-text-to-elements", {
|
|
4
|
+
variants: { size: {
|
|
5
|
+
"extra-small": "",
|
|
6
|
+
small: "",
|
|
7
|
+
default: "",
|
|
8
|
+
large: ""
|
|
9
|
+
} },
|
|
10
|
+
defaultVariants: { size: "default" }
|
|
11
|
+
});
|
|
12
|
+
//#endregion
|
|
13
|
+
export { datePickerInputContentRow };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { FC, ReactElement, SVGProps } from 'react';
|
|
2
|
+
import { DatePickerTodayIcon, DatePickerTodayIconButtonSize } from './datePicker.types';
|
|
3
|
+
type TodayIconComponent = FC<SVGProps<SVGSVGElement>> | ReactElement;
|
|
4
|
+
export declare const getDatePickerTodayIcon: (todayIcon: DatePickerTodayIcon | undefined) => TodayIconComponent | null;
|
|
5
|
+
export declare const renderDatePickerTodayIcon: (todayIcon: DatePickerTodayIcon | undefined, size?: DatePickerTodayIconButtonSize, className?: string) => import("react/jsx-runtime").JSX.Element | undefined;
|
|
6
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { InlineIconButton } from "../../../buttons/InlineIconButton/InlineIconButton.js";
|
|
2
|
+
import { TodayIcon } from "../../../../assets/icons/Today.js";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
//#region src/components/inputs/DateTime/shared/datePickerTodayIcon.tsx
|
|
5
|
+
var getDatePickerTodayIcon = (todayIcon) => {
|
|
6
|
+
if (!todayIcon) return null;
|
|
7
|
+
return todayIcon === true ? TodayIcon : todayIcon;
|
|
8
|
+
};
|
|
9
|
+
var renderDatePickerTodayIcon = (todayIcon, size = "none", className) => {
|
|
10
|
+
const icon = getDatePickerTodayIcon(todayIcon);
|
|
11
|
+
if (!icon) return;
|
|
12
|
+
return /* @__PURE__ */ jsx(InlineIconButton, {
|
|
13
|
+
label: "",
|
|
14
|
+
icon,
|
|
15
|
+
size,
|
|
16
|
+
staticRender: true,
|
|
17
|
+
className: className ?? "relative z-1 !border-none"
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
//#endregion
|
|
21
|
+
export { getDatePickerTodayIcon, renderDatePickerTodayIcon };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
//#region src/components/inputs/DateTime/shared/dateSegment.utils.ts
|
|
2
|
+
var getTimeSegmentValue = (segment, fallbackValue = 0) => {
|
|
3
|
+
if (!segment) return fallbackValue;
|
|
4
|
+
const parsedValue = Number.parseInt(segment.text, 10);
|
|
5
|
+
if (Number.isFinite(parsedValue)) return parsedValue;
|
|
6
|
+
return Number.isFinite(segment.value) ? segment.value ?? fallbackValue : fallbackValue;
|
|
7
|
+
};
|
|
8
|
+
//#endregion
|
|
9
|
+
export { getTimeSegmentValue };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { CalendarDate } from '@internationalized/date';
|
|
2
|
+
import { DateValue, TimeValue } from 'react-aria';
|
|
3
|
+
interface StaticSegmentProps {
|
|
4
|
+
isDisabled?: boolean;
|
|
5
|
+
hidePlaceholder?: boolean;
|
|
6
|
+
}
|
|
7
|
+
interface StaticCalendarDateSegmentsProps extends StaticSegmentProps {
|
|
8
|
+
value?: CalendarDate | null;
|
|
9
|
+
locale: string;
|
|
10
|
+
placeholder?: string;
|
|
11
|
+
shouldForceLeadingZeros?: boolean;
|
|
12
|
+
}
|
|
13
|
+
interface StaticCalendarDateTimeSegmentsProps extends StaticSegmentProps {
|
|
14
|
+
value?: DateValue | null;
|
|
15
|
+
locale: string;
|
|
16
|
+
placeholder?: string;
|
|
17
|
+
shouldForceLeadingZeros?: boolean;
|
|
18
|
+
}
|
|
19
|
+
interface StaticDateRangeSegmentsProps extends StaticSegmentProps {
|
|
20
|
+
start?: CalendarDate | null;
|
|
21
|
+
end?: CalendarDate | null;
|
|
22
|
+
locale: string;
|
|
23
|
+
placeholder?: string;
|
|
24
|
+
shouldForceLeadingZeros?: boolean;
|
|
25
|
+
}
|
|
26
|
+
interface StaticTimeSegmentsProps extends StaticSegmentProps {
|
|
27
|
+
value?: TimeValue | null;
|
|
28
|
+
locale: string;
|
|
29
|
+
placeholder?: string;
|
|
30
|
+
}
|
|
31
|
+
export declare const getStaticCalendarDateSegments: ({ value, locale, placeholder, shouldForceLeadingZeros, isDisabled, hidePlaceholder, }: StaticCalendarDateSegmentsProps) => import("react/jsx-runtime").JSX.Element;
|
|
32
|
+
export declare const getStaticCalendarDateTimeSegments: ({ value, locale, placeholder, shouldForceLeadingZeros, isDisabled, hidePlaceholder, }: StaticCalendarDateTimeSegmentsProps) => import("react/jsx-runtime").JSX.Element;
|
|
33
|
+
export declare const getStaticDateRangeSegments: ({ start, end, locale, placeholder, shouldForceLeadingZeros, isDisabled, hidePlaceholder, }: StaticDateRangeSegmentsProps) => import("react/jsx-runtime").JSX.Element;
|
|
34
|
+
export declare const getStaticTimeSegments: ({ value, locale, placeholder, isDisabled, hidePlaceholder, }: StaticTimeSegmentsProps) => import("react/jsx-runtime").JSX.Element;
|
|
35
|
+
export {};
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { DateSegmentItemView } from "./DateSegmentItem.js";
|
|
2
|
+
import { DateTimeUtils } from "../../../../utils/date-time.utils.js";
|
|
3
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
//#region src/components/inputs/DateTime/shared/staticDateTimeSegments.tsx
|
|
5
|
+
var getStaticCalendarDateSegments = ({ value, locale, placeholder, shouldForceLeadingZeros, isDisabled, hidePlaceholder }) => {
|
|
6
|
+
const hasValue = !!value;
|
|
7
|
+
return renderStaticSegments(value ? DateTimeUtils.formatCalendarDateLocalized(value, locale, { shouldForceLeadingZeros }) : placeholder ?? DateTimeUtils.getDatePlaceholder(locale, { shouldForceLeadingZeros }), {
|
|
8
|
+
isPlaceholder: !hasValue,
|
|
9
|
+
isInputEmpty: !hasValue,
|
|
10
|
+
isDisabled,
|
|
11
|
+
hidePlaceholder
|
|
12
|
+
});
|
|
13
|
+
};
|
|
14
|
+
var getStaticCalendarDateTimeSegments = ({ value, locale, placeholder, shouldForceLeadingZeros, isDisabled, hidePlaceholder }) => {
|
|
15
|
+
const hasValue = !!(value && "hour" in value);
|
|
16
|
+
return renderStaticSegments(hasValue ? DateTimeUtils.formatCalendarDateTimeLocalized(value, locale, { shouldForceLeadingZeros }) : placeholder ?? DateTimeUtils.getDateTimePlaceholder(locale, { shouldForceLeadingZeros }), {
|
|
17
|
+
isPlaceholder: !hasValue,
|
|
18
|
+
isInputEmpty: !hasValue,
|
|
19
|
+
isDisabled,
|
|
20
|
+
hidePlaceholder
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
var getStaticDateRangeSegments = ({ start, end, locale, placeholder, shouldForceLeadingZeros, isDisabled, hidePlaceholder }) => {
|
|
24
|
+
const defaultPlaceholder = placeholder ?? DateTimeUtils.getDatePlaceholder(locale, { shouldForceLeadingZeros });
|
|
25
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
26
|
+
renderStaticSegments(start ? DateTimeUtils.formatCalendarDateLocalized(start, locale, { shouldForceLeadingZeros }) : defaultPlaceholder, {
|
|
27
|
+
isPlaceholder: !start,
|
|
28
|
+
isInputEmpty: !start,
|
|
29
|
+
isDisabled,
|
|
30
|
+
hidePlaceholder: hidePlaceholder && !start
|
|
31
|
+
}),
|
|
32
|
+
/* @__PURE__ */ jsx("span", {
|
|
33
|
+
className: isDisabled ? "pointer-events-none select-none text-interactive-text-secondary-disabled" : "pointer-events-none select-none",
|
|
34
|
+
children: "–"
|
|
35
|
+
}),
|
|
36
|
+
renderStaticSegments(end ? DateTimeUtils.formatCalendarDateLocalized(end, locale, { shouldForceLeadingZeros }) : defaultPlaceholder, {
|
|
37
|
+
isPlaceholder: !end,
|
|
38
|
+
isInputEmpty: !end,
|
|
39
|
+
isDisabled,
|
|
40
|
+
hidePlaceholder: hidePlaceholder && !end
|
|
41
|
+
})
|
|
42
|
+
] });
|
|
43
|
+
};
|
|
44
|
+
var getStaticTimeSegments = ({ value, locale, placeholder, isDisabled, hidePlaceholder }) => {
|
|
45
|
+
const hasValue = !!value;
|
|
46
|
+
return renderStaticSegments(value ? DateTimeUtils.formatTimeLocalized(value, locale) : placeholder ?? DateTimeUtils.getTimePlaceholder(locale), {
|
|
47
|
+
isPlaceholder: !hasValue,
|
|
48
|
+
isInputEmpty: !hasValue,
|
|
49
|
+
isDisabled,
|
|
50
|
+
hidePlaceholder,
|
|
51
|
+
timePickerOnly: true
|
|
52
|
+
});
|
|
53
|
+
};
|
|
54
|
+
var renderStaticSegments = (value, options) => {
|
|
55
|
+
return /* @__PURE__ */ jsx("div", {
|
|
56
|
+
className: "flex",
|
|
57
|
+
children: tokenizeStaticSegmentText(value).map((token, index) => /* @__PURE__ */ jsx(DateSegmentItemView, {
|
|
58
|
+
type: token.type,
|
|
59
|
+
text: getStaticSegmentText(token),
|
|
60
|
+
placeholder: getStaticSegmentText(token),
|
|
61
|
+
isPlaceholder: options.isPlaceholder && token.type !== "literal",
|
|
62
|
+
isInputEmpty: options.isInputEmpty,
|
|
63
|
+
isDisabled: options.isDisabled,
|
|
64
|
+
timePickerOnly: options.timePickerOnly,
|
|
65
|
+
hidePlaceholder: options.hidePlaceholder
|
|
66
|
+
}, index))
|
|
67
|
+
});
|
|
68
|
+
};
|
|
69
|
+
var tokenizeStaticSegmentText = (value) => {
|
|
70
|
+
return (value.match(/(\p{Letter}+|\p{Number}+|[^\p{Letter}\p{Number}]+)/gu) ?? [value]).map((text) => ({
|
|
71
|
+
text,
|
|
72
|
+
type: /^[^\p{Letter}\p{Number}]+$/u.test(text) ? "literal" : "day"
|
|
73
|
+
}));
|
|
74
|
+
};
|
|
75
|
+
var getStaticSegmentText = (token) => {
|
|
76
|
+
if (token.type !== "literal") return token.text;
|
|
77
|
+
return token.text.replaceAll(" ", "\xA0");
|
|
78
|
+
};
|
|
79
|
+
//#endregion
|
|
80
|
+
export { getStaticCalendarDateSegments, getStaticCalendarDateTimeSegments, getStaticDateRangeSegments, getStaticTimeSegments };
|
|
@@ -128,6 +128,7 @@ var FileUploadBase = (props) => {
|
|
|
128
128
|
...rest,
|
|
129
129
|
"data-rac": "",
|
|
130
130
|
"data-disabled": isDisabled || void 0,
|
|
131
|
+
"data-is-disabled": isDisabled || void 0,
|
|
131
132
|
"data-invalid": !!error || void 0,
|
|
132
133
|
"data-multiple": allowsMultiple || void 0,
|
|
133
134
|
"data-has-files": uploadState.length > 0 || void 0,
|
|
@@ -21,6 +21,7 @@ var InputUploadContent = (props) => {
|
|
|
21
21
|
children: /* @__PURE__ */ jsxs("div", {
|
|
22
22
|
"data-rac": "",
|
|
23
23
|
"data-disabled": isDisabled || void 0,
|
|
24
|
+
"data-is-disabled": isDisabled || void 0,
|
|
24
25
|
"data-invalid": !!error || void 0,
|
|
25
26
|
className: inputUploadButton({
|
|
26
27
|
variant,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PropsWithChildren, Ref } from 'react';
|
|
1
|
+
import { FocusEventHandler, MouseEventHandler, PropsWithChildren, Ref } from 'react';
|
|
2
2
|
import { FormFieldErrorProps } from './FormFieldError';
|
|
3
3
|
import { FormFieldHeaderProps } from './FormFieldHeader';
|
|
4
4
|
import { TextInputProps } from '../Input/TextInput/TextInput';
|
|
@@ -13,8 +13,8 @@ interface FormFieldComponentProps extends PropsWithChildren<FormFieldProps> {
|
|
|
13
13
|
labelProps?: FormFieldHeaderProps["labelProps"];
|
|
14
14
|
as?: TextInputProps["as"];
|
|
15
15
|
tabIndex?: number;
|
|
16
|
-
onMouseEnter?:
|
|
17
|
-
onFocusCapture?:
|
|
16
|
+
onMouseEnter?: MouseEventHandler<HTMLDivElement>;
|
|
17
|
+
onFocusCapture?: FocusEventHandler<HTMLDivElement>;
|
|
18
18
|
}
|
|
19
19
|
export declare const FormField: ({ ref, as, label, tooltipText, helperText, isRequired, rightContent, isDisabled, error, hideLabel, headerClassName, errorClassName, children, className, labelProps, isHeaderHidden, tabIndex, onMouseEnter, onFocusCapture, }: FormFieldComponentProps) => import("react/jsx-runtime").JSX.Element;
|
|
20
20
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DOMAttributes } from '@react-types/shared';
|
|
2
|
-
import { ReactNode } from 'react';
|
|
2
|
+
import { LabelHTMLAttributes, ReactNode } from 'react';
|
|
3
3
|
export interface FormFieldHeaderProps {
|
|
4
4
|
label: string;
|
|
5
5
|
tooltipText?: string;
|
|
@@ -9,6 +9,6 @@ export interface FormFieldHeaderProps {
|
|
|
9
9
|
isHeaderHidden?: boolean;
|
|
10
10
|
isDisabled?: boolean;
|
|
11
11
|
className?: string;
|
|
12
|
-
labelProps?: DOMAttributes<HTMLLabelElement>;
|
|
12
|
+
labelProps?: DOMAttributes<HTMLLabelElement> & LabelHTMLAttributes<HTMLLabelElement>;
|
|
13
13
|
}
|
|
14
14
|
export declare const FormFieldHeader: ({ label, tooltipText, helperText, isRequired, rightContent, isHeaderHidden, isDisabled, className, labelProps, }: FormFieldHeaderProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import { InfoIcon } from "../../../assets/icons/Info.js";
|
|
2
|
+
import { UIStyle } from "../../../config/uiStyle.context.js";
|
|
2
3
|
import { Typography } from "../../text/Typography/Typography.js";
|
|
3
4
|
import { Tooltip as Tooltip$1 } from "../../overlays/Tooltip/Tooltip.js";
|
|
4
5
|
import { FormFieldLabel } from "./FormFieldLabel.js";
|
|
6
|
+
import { formFieldHeader } from "./formFieldHeader.cva.js";
|
|
5
7
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
8
|
import { clsx } from "clsx";
|
|
7
9
|
import { Focusable } from "react-aria-components";
|
|
8
10
|
//#region src/components/inputs/FormField/FormFieldHeader.tsx
|
|
9
11
|
var FormFieldHeader = ({ label, tooltipText, helperText, isRequired, rightContent, isHeaderHidden, isDisabled, className, labelProps }) => {
|
|
10
12
|
return /* @__PURE__ */ jsxs("div", {
|
|
11
|
-
className: clsx(
|
|
13
|
+
className: clsx(UIStyle.useCva("formField.headerCva", formFieldHeader)({ visible: !isHeaderHidden }), className),
|
|
12
14
|
children: [/* @__PURE__ */ jsxs("div", {
|
|
13
15
|
className: "flex items-start justify-between",
|
|
14
16
|
children: [/* @__PURE__ */ jsxs("div", {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DOMAttributes } from '@react-types/shared';
|
|
2
|
-
import { RefCallback } from 'react';
|
|
2
|
+
import { LabelHTMLAttributes, RefCallback } from 'react';
|
|
3
3
|
import { InputSizeProps } from '../shared/input.cva';
|
|
4
4
|
import { LabelBaseProps } from '../shared/label.cva';
|
|
5
5
|
export interface FormFieldLabelProps extends LabelBaseProps, InputSizeProps {
|
|
@@ -7,7 +7,7 @@ export interface FormFieldLabelProps extends LabelBaseProps, InputSizeProps {
|
|
|
7
7
|
isRequired?: boolean;
|
|
8
8
|
isDisabled?: boolean;
|
|
9
9
|
ref?: RefCallback<HTMLOrSVGElement>;
|
|
10
|
-
labelProps?: DOMAttributes<HTMLLabelElement>;
|
|
10
|
+
labelProps?: DOMAttributes<HTMLLabelElement> & LabelHTMLAttributes<HTMLLabelElement>;
|
|
11
11
|
className?: string;
|
|
12
12
|
}
|
|
13
13
|
export declare const FormFieldLabel: ({ ref, as, label, isRequired, isDisabled, labelProps, className, }: FormFieldLabelProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { VariantProps } from 'class-variance-authority';
|
|
2
|
+
export declare const formFieldHeader: (props?: ({
|
|
3
|
+
visible?: boolean | null | undefined;
|
|
4
|
+
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
5
|
+
export interface FormFieldHeaderVariantProps extends VariantProps<typeof formFieldHeader> {
|
|
6
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { cva } from "class-variance-authority";
|
|
2
|
+
//#region src/components/inputs/FormField/formFieldHeader.cva.ts
|
|
3
|
+
var formFieldHeader = cva("", {
|
|
4
|
+
variants: { visible: {
|
|
5
|
+
true: "mb-1",
|
|
6
|
+
false: "sr-only"
|
|
7
|
+
} },
|
|
8
|
+
defaultVariants: { visible: true }
|
|
9
|
+
});
|
|
10
|
+
//#endregion
|
|
11
|
+
export { formFieldHeader };
|
|
@@ -13,8 +13,11 @@ interface NumberInputBaseProps extends FormFieldProps, InputVariantProps, Omit<I
|
|
|
13
13
|
value?: number | null;
|
|
14
14
|
onChange?: (value: number | null) => void;
|
|
15
15
|
onBlur?: (e: FocusEvent<HTMLInputElement>) => void;
|
|
16
|
+
autoFocusOnMount?: boolean;
|
|
16
17
|
}
|
|
17
|
-
export type NumberInputProps = NumberInputBaseProps
|
|
18
|
+
export type NumberInputProps = NumberInputBaseProps & {
|
|
19
|
+
renderStaticInput?: boolean;
|
|
20
|
+
};
|
|
18
21
|
export type ControlledNumberInputProps<TFieldValues extends FieldValues> = ControlProps<NumberInputProps, TFieldValues>;
|
|
19
|
-
export declare const NumberInput: <TFieldValues extends FieldValues>(props: ControlledNumberInputProps<TFieldValues>) => import("react/jsx-runtime").JSX.Element;
|
|
22
|
+
export declare const NumberInput: <TFieldValues extends FieldValues>({ renderStaticInput, ...props }: ControlledNumberInputProps<TFieldValues>) => import("react/jsx-runtime").JSX.Element;
|
|
20
23
|
export {};
|
|
@@ -3,21 +3,24 @@ import { UIConfig } from "../../../../config/uiConfig.context.js";
|
|
|
3
3
|
import { inputBase } from "../../shared/input.cva.js";
|
|
4
4
|
import { FormField } from "../../FormField/FormField.js";
|
|
5
5
|
import { TooltipWrapper } from "../../shared/TooltipWrapper.js";
|
|
6
|
+
import { InputFrame } from "../../Skeleton/InputFrame.js";
|
|
7
|
+
import { useStaticInputHandoff } from "../../shared/useStaticInputHandoff.js";
|
|
6
8
|
import { InputContent } from "../shared/InputContent.js";
|
|
9
|
+
import { getStaticNumberDisplayValue } from "../shared/numberStatic.utils.js";
|
|
7
10
|
import { jsx } from "react/jsx-runtime";
|
|
8
11
|
import { clsx } from "clsx";
|
|
9
|
-
import { useCallback, useRef } from "react";
|
|
12
|
+
import { useCallback, useEffect, useRef, useState } from "react";
|
|
10
13
|
import { Input, useLocale } from "react-aria-components";
|
|
11
14
|
import { useFocusVisible, useNumberField } from "react-aria";
|
|
12
15
|
import { mergeRefs } from "@react-aria/utils";
|
|
13
|
-
import { Controller } from "react-hook-form";
|
|
16
|
+
import { Controller, useWatch } from "react-hook-form";
|
|
14
17
|
import { useNumberFieldState } from "react-stately";
|
|
15
18
|
//#region src/components/inputs/Input/NumberInput/NumberInput.tsx
|
|
16
19
|
var NumberInputBase = (props) => {
|
|
17
20
|
const ui = UIConfig.useConfig();
|
|
18
21
|
const inputBaseCva = UIStyle.useCva("input.baseCva", inputBase);
|
|
19
22
|
const inputRef = useRef(null);
|
|
20
|
-
const { ref, inputClassName, label, tooltipText, helperText, isRequired, rightContent, isDisabled, isDirty, headerClassName, errorClassName, isHeaderHidden, error, className, unit, isLoading, action, leadingIcon, trailingIcon, value, onChange, onBlur, formatOptions = ui.numberInput.formatOptions, variant = ui.input.variant, as = ui.input.as, size = ui.input.size, hideLabel = ui.input.hideLabel, isClearable = ui.input.isClearable, ...rest } = props;
|
|
23
|
+
const { ref, inputClassName, label, tooltipText, helperText, isRequired, rightContent, isDisabled, isDirty, headerClassName, errorClassName, isHeaderHidden, error, className, unit, isLoading, action, leadingIcon, trailingIcon, value, onChange, onBlur, formatOptions = ui.numberInput.formatOptions, variant = ui.input.variant, as = ui.input.as, size = ui.input.size, hideLabel = ui.input.hideLabel, isClearable = ui.input.isClearable, autoFocusOnMount, ...rest } = props;
|
|
21
24
|
const numberFieldRef = useRef(null);
|
|
22
25
|
const { isFocusVisible } = useFocusVisible();
|
|
23
26
|
const { locale } = useLocale();
|
|
@@ -34,6 +37,10 @@ var NumberInputBase = (props) => {
|
|
|
34
37
|
formatOptions
|
|
35
38
|
};
|
|
36
39
|
const { labelProps, inputProps } = useNumberField(numberProps, useNumberFieldState(numberProps), numberFieldRef);
|
|
40
|
+
useEffect(() => {
|
|
41
|
+
if (!autoFocusOnMount || isDisabled) return;
|
|
42
|
+
requestAnimationFrame(() => inputRef.current?.focus());
|
|
43
|
+
}, [autoFocusOnMount, isDisabled]);
|
|
37
44
|
const formFieldProps = {
|
|
38
45
|
error,
|
|
39
46
|
label,
|
|
@@ -90,6 +97,8 @@ var NumberInputBase = (props) => {
|
|
|
90
97
|
...rest
|
|
91
98
|
}), inputClassName),
|
|
92
99
|
onClick: () => inputRef.current?.focus(),
|
|
100
|
+
"data-is-empty": value === null || value === void 0 || void 0,
|
|
101
|
+
"data-is-required": isRequired || void 0,
|
|
93
102
|
children: /* @__PURE__ */ jsx(InputContent, {
|
|
94
103
|
...inputContentProps,
|
|
95
104
|
headerProps,
|
|
@@ -114,7 +123,64 @@ var NumberInputBase = (props) => {
|
|
|
114
123
|
})
|
|
115
124
|
});
|
|
116
125
|
};
|
|
117
|
-
var NumberInput = (props) => {
|
|
126
|
+
var NumberInput = ({ renderStaticInput, ...props }) => {
|
|
127
|
+
const ui = UIConfig.useConfig();
|
|
128
|
+
const { locale } = useLocale();
|
|
129
|
+
const [renderInput, setRenderInput] = useState(!(renderStaticInput ?? ui.renderStaticInput));
|
|
130
|
+
const inputRef = useRef(null);
|
|
131
|
+
const { shouldFocus, renderRealInput, replayStaticInputChange } = useStaticInputHandoff({
|
|
132
|
+
inputRef,
|
|
133
|
+
renderInput,
|
|
134
|
+
setRenderInput
|
|
135
|
+
});
|
|
136
|
+
const watchedValue = "formControl" in props && props.formControl ? useWatch({
|
|
137
|
+
control: props.formControl.control,
|
|
138
|
+
name: props.formControl.name
|
|
139
|
+
}) : props.value;
|
|
140
|
+
let isFormControlDisabled = false;
|
|
141
|
+
if ("formControl" in props && props.formControl) isFormControlDisabled = !!props.formControl.control._options?.disabled;
|
|
142
|
+
if (!renderInput) {
|
|
143
|
+
const staticValue = watchedValue ?? props.value ?? props.defaultValue;
|
|
144
|
+
const formatOptions = props.formatOptions ?? ui.numberInput.formatOptions;
|
|
145
|
+
const displayValue = getStaticNumberDisplayValue(staticValue, new Intl.NumberFormat(locale, formatOptions)) ?? "";
|
|
146
|
+
const hasValue = displayValue !== "";
|
|
147
|
+
const as = props.as ?? ui.input.as;
|
|
148
|
+
let isDisabled = !!props.isDisabled;
|
|
149
|
+
if (isFormControlDisabled) isDisabled = true;
|
|
150
|
+
const dataAttributes = {
|
|
151
|
+
dataIsEmpty: !hasValue,
|
|
152
|
+
dataIsFilled: hasValue,
|
|
153
|
+
dataIsDirty: props.isDirty,
|
|
154
|
+
dataIsRequired: props.isRequired,
|
|
155
|
+
dataIsDisabled: isDisabled,
|
|
156
|
+
dataDisabled: isDisabled,
|
|
157
|
+
dataInvalid: !!props.error,
|
|
158
|
+
dataHasSelection: hasValue
|
|
159
|
+
};
|
|
160
|
+
return /* @__PURE__ */ jsx(InputFrame, {
|
|
161
|
+
...props,
|
|
162
|
+
isDisabled,
|
|
163
|
+
className: clsx("group w-full", as === "inline" && "h-full", props.className),
|
|
164
|
+
dataAttributes,
|
|
165
|
+
renderStatic: true,
|
|
166
|
+
onStaticInteract: renderRealInput,
|
|
167
|
+
inputClassName: props.inputClassName,
|
|
168
|
+
wrapContentAndTrailing: true,
|
|
169
|
+
children: (dataAttributeProps) => /* @__PURE__ */ jsx("input", {
|
|
170
|
+
type: "text",
|
|
171
|
+
ref: inputRef,
|
|
172
|
+
disabled: isDisabled,
|
|
173
|
+
inputMode: "numeric",
|
|
174
|
+
tabIndex: -1,
|
|
175
|
+
value: displayValue,
|
|
176
|
+
placeholder: as === "floating" ? "" : props.placeholder,
|
|
177
|
+
className: "w-full bg-transparent outline-none placeholder:text-text-default-3 disabled:text-interactive-text-secondary-disabled",
|
|
178
|
+
onChange: (event) => replayStaticInputChange(event.target.value),
|
|
179
|
+
...dataAttributeProps,
|
|
180
|
+
"data-rac": true
|
|
181
|
+
})
|
|
182
|
+
});
|
|
183
|
+
}
|
|
118
184
|
if ("formControl" in props && props.formControl) {
|
|
119
185
|
const { formControl, ref, ...innerProps } = props;
|
|
120
186
|
return /* @__PURE__ */ jsx(Controller, {
|
|
@@ -122,17 +188,22 @@ var NumberInput = (props) => {
|
|
|
122
188
|
name: formControl.name,
|
|
123
189
|
render: ({ field, fieldState: { error, isDirty } }) => /* @__PURE__ */ jsx(NumberInputBase, {
|
|
124
190
|
...innerProps,
|
|
125
|
-
ref: mergeRefs(ref, field.ref),
|
|
191
|
+
ref: mergeRefs(ref, field.ref, inputRef),
|
|
126
192
|
value: field.value,
|
|
127
193
|
onChange: field.onChange,
|
|
128
194
|
onBlur: field.onBlur,
|
|
129
195
|
isDirty,
|
|
130
196
|
isDisabled: field.disabled || props.isDisabled,
|
|
131
|
-
error: props.error ?? error?.message
|
|
197
|
+
error: props.error ?? error?.message,
|
|
198
|
+
autoFocusOnMount: shouldFocus
|
|
132
199
|
}, field.value === null || field.value === void 0 ? "empty" : "filled")
|
|
133
200
|
});
|
|
134
201
|
}
|
|
135
|
-
return /* @__PURE__ */ jsx(NumberInputBase, {
|
|
202
|
+
return /* @__PURE__ */ jsx(NumberInputBase, {
|
|
203
|
+
...props,
|
|
204
|
+
ref: mergeRefs(props.ref, inputRef),
|
|
205
|
+
autoFocusOnMount: shouldFocus
|
|
206
|
+
}, props.value === null || props.value === void 0 ? "empty" : "filled");
|
|
136
207
|
};
|
|
137
208
|
//#endregion
|
|
138
209
|
export { NumberInput };
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { FocusEvent, HTMLAttributes, Ref } from 'react';
|
|
2
|
+
import { NumberFieldProps as AriaNumberFieldProps } from 'react-aria-components';
|
|
3
|
+
import { FormFieldProps } from '../../FormField/FormField';
|
|
4
|
+
import { FormFieldHeaderProps } from '../../FormField/FormFieldHeader';
|
|
5
|
+
import { InputVariantProps } from '../../shared/input.cva';
|
|
6
|
+
export interface NumberRangeValue {
|
|
7
|
+
min: number | null;
|
|
8
|
+
max: number | null;
|
|
9
|
+
}
|
|
10
|
+
type NumberRangeFieldInputProps = Omit<AriaNumberFieldProps, "className" | "defaultValue" | "label" | "maxValue" | "minValue" | "onBlur" | "onChange" | "value">;
|
|
11
|
+
export interface NumberRangeFieldProps extends NumberRangeFieldInputProps {
|
|
12
|
+
ref?: Ref<HTMLDivElement>;
|
|
13
|
+
as: InputVariantProps["as"];
|
|
14
|
+
className?: string;
|
|
15
|
+
inputClassName?: string;
|
|
16
|
+
minInputClassName?: string;
|
|
17
|
+
maxInputClassName?: string;
|
|
18
|
+
inputBaseClassName: string;
|
|
19
|
+
inputSizeClassName: string;
|
|
20
|
+
formFieldProps: FormFieldProps;
|
|
21
|
+
headerProps: FormFieldHeaderProps;
|
|
22
|
+
rangeValue: NumberRangeValue;
|
|
23
|
+
effectiveError?: string;
|
|
24
|
+
minPlaceholder: string;
|
|
25
|
+
maxPlaceholder: string;
|
|
26
|
+
minLabel: string;
|
|
27
|
+
maxLabel: string;
|
|
28
|
+
hideInnerLabels?: boolean;
|
|
29
|
+
isDirty?: boolean;
|
|
30
|
+
isClearable?: boolean;
|
|
31
|
+
autoFocusOnMount?: boolean;
|
|
32
|
+
isDisabled?: boolean;
|
|
33
|
+
isRequired?: boolean;
|
|
34
|
+
isEmpty: boolean;
|
|
35
|
+
isHovered: boolean;
|
|
36
|
+
isFocused: boolean;
|
|
37
|
+
isFocusVisible: boolean;
|
|
38
|
+
focusWithinProps: HTMLAttributes<HTMLElement>;
|
|
39
|
+
hoverProps: HTMLAttributes<HTMLElement>;
|
|
40
|
+
onRangeSideChange: (side: keyof NumberRangeValue, nextValue: number | null) => void;
|
|
41
|
+
onRangeSideClear: (side: keyof NumberRangeValue) => void;
|
|
42
|
+
onBlur?: (e: FocusEvent<HTMLInputElement>) => void;
|
|
43
|
+
}
|
|
44
|
+
export declare const NumberRangeField: ({ ref, as, className, inputClassName, minInputClassName, maxInputClassName, inputBaseClassName, inputSizeClassName, formFieldProps, headerProps, rangeValue, effectiveError, minPlaceholder, maxPlaceholder, minLabel, maxLabel, hideInnerLabels, isDirty, isClearable, autoFocusOnMount, isDisabled, isRequired, isEmpty, isHovered, isFocused, isFocusVisible, focusWithinProps, hoverProps, onRangeSideChange, onRangeSideClear, onBlur, ...numberFieldProps }: NumberRangeFieldProps) => import("react/jsx-runtime").JSX.Element;
|
|
45
|
+
export {};
|