@povio/ui 2.2.9-rc.8 → 2.2.10
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 -2
- package/dist/components/buttons/Button/Button.js +1 -1
- package/dist/components/buttons/PillButton/PillButton.d.ts +2 -2
- package/dist/components/buttons/PillButton/PillButton.js +1 -1
- package/dist/components/buttons/TextButton/TextButton.d.ts +2 -1
- package/dist/components/buttons/ToggleButton/ToggleButton.d.ts +2 -1
- package/dist/components/buttons/shared/ButtonContent.d.ts +3 -3
- package/dist/components/buttons/shared/ButtonContent.js +2 -2
- package/dist/components/inputs/Checkbox/Checkbox.js +1 -6
- package/dist/components/inputs/Checkbox/checkbox.cva.d.ts +0 -3
- package/dist/components/inputs/Checkbox/checkbox.cva.js +1 -2
- package/dist/components/inputs/DateTime/DatePicker/DatePicker.d.ts +8 -8
- package/dist/components/inputs/DateTime/DatePicker/DatePicker.js +59 -33
- package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.d.ts +4 -7
- package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.js +4 -14
- package/dist/components/inputs/DateTime/DateTimePicker/DateTimePicker.d.ts +7 -7
- package/dist/components/inputs/DateTime/DateTimePicker/DateTimePicker.js +40 -22
- package/dist/components/inputs/DateTime/TimePicker/TimePicker.d.ts +3 -3
- package/dist/components/inputs/DateTime/TimePicker/TimePicker.js +13 -20
- package/dist/components/inputs/DateTime/shared/Calendar.d.ts +4 -1
- package/dist/components/inputs/DateTime/shared/Calendar.js +75 -12
- package/dist/components/inputs/DateTime/shared/CalendarHeader.d.ts +2 -1
- package/dist/components/inputs/DateTime/shared/CalendarHeader.js +28 -4
- package/dist/components/inputs/DateTime/shared/DateField.d.ts +3 -1
- package/dist/components/inputs/DateTime/shared/DateField.js +41 -7
- package/dist/components/inputs/DateTime/shared/DatePickerInput.d.ts +6 -5
- package/dist/components/inputs/DateTime/shared/DatePickerInput.js +16 -18
- package/dist/components/inputs/DateTime/shared/MonthPicker.d.ts +3 -1
- package/dist/components/inputs/DateTime/shared/MonthPicker.js +4 -3
- package/dist/components/inputs/DateTime/shared/TimePickerInput.d.ts +1 -2
- package/dist/components/inputs/DateTime/shared/TimePickerInput.js +2 -7
- package/dist/components/inputs/DateTime/shared/YearPicker.d.ts +3 -1
- package/dist/components/inputs/DateTime/shared/YearPicker.js +4 -3
- package/dist/components/inputs/FormField/FormFieldHeader.js +1 -3
- package/dist/components/inputs/Input/NumberInput/NumberInput.js +0 -1
- package/dist/components/inputs/Input/TextInput/TextInput.js +0 -3
- package/dist/components/inputs/Inputs/InputItem.d.ts +16 -10
- package/dist/components/inputs/Inputs/InputItem.js +0 -4
- package/dist/components/inputs/RadioGroup/RadioGroup.js +1 -6
- package/dist/components/inputs/RadioGroup/radio.cva.d.ts +0 -3
- package/dist/components/inputs/RadioGroup/radio.cva.js +1 -2
- package/dist/components/inputs/Selection/Autocomplete/Autocomplete.d.ts +1 -3
- package/dist/components/inputs/Selection/Autocomplete/Autocomplete.js +3 -4
- package/dist/components/inputs/Selection/Autocomplete/QueryAutocomplete.d.ts +18 -3
- package/dist/components/inputs/Selection/Autocomplete/QueryAutocomplete.js +7 -23
- package/dist/components/inputs/Selection/Select/Select.d.ts +2 -4
- package/dist/components/inputs/Selection/Select/Select.js +3 -4
- package/dist/components/inputs/Selection/shared/SelectBase.d.ts +1 -8
- package/dist/components/inputs/Selection/shared/SelectBase.js +1 -3
- package/dist/components/inputs/Selection/shared/SelectDesktop.d.ts +1 -1
- package/dist/components/inputs/Selection/shared/SelectDesktop.js +2 -8
- package/dist/components/inputs/Selection/shared/SelectInput.d.ts +2 -2
- package/dist/components/inputs/Selection/shared/SelectInput.js +3 -23
- package/dist/components/inputs/Selection/shared/SelectMobile.d.ts +1 -1
- package/dist/components/inputs/Selection/shared/SelectMobile.js +5 -10
- package/dist/components/inputs/Selection/shared/select.context.d.ts +2 -3
- package/dist/components/inputs/Selection/shared/select.context.js +4 -22
- package/dist/components/inputs/Selection/shared/select.types.d.ts +2 -2
- package/dist/components/inputs/TextEditor/TextEditor.d.ts +0 -1
- package/dist/components/inputs/TextEditor/TextEditor.js +3 -7
- package/dist/components/inputs/Toggle/Toggle.js +1 -6
- package/dist/components/inputs/Toggle/toggle.cva.d.ts +0 -3
- package/dist/components/inputs/Toggle/toggle.cva.js +1 -2
- package/dist/components/inputs/shared/CheckContent.d.ts +1 -2
- package/dist/components/inputs/shared/CheckContent.js +4 -3
- package/dist/components/overlays/BottomSheet/BottomSheet.js +1 -2
- package/dist/components/overlays/Tooltip/TooltipEllipsis.d.ts +2 -2
- package/dist/config/link.context.js +4 -2
- package/dist/config/uiConfig.context.d.ts +2 -8
- package/dist/config/uiConfig.context.js +3 -5
- package/dist/config/uiStyle.context.d.ts +0 -5
- package/dist/helpers/dynamicInputs.d.ts +5 -5
- package/dist/helpers/dynamicInputs.js +0 -3
- package/dist/index.d.ts +0 -4
- package/dist/index.js +3 -4
- package/dist/utils/date-time.utils.d.ts +7 -6
- package/dist/utils/date-time.utils.js +66 -16
- package/package.json +1 -1
- package/dist/components/inputs/DateTime/shared/datePicker.types.d.ts +0 -3
- package/dist/components/inputs/FormField/formFieldHeader.cva.d.ts +0 -6
- package/dist/components/inputs/FormField/formFieldHeader.cva.js +0 -11
- package/dist/components/inputs/Selection/Autocomplete/queryAutocomplete.types.d.ts +0 -30
- package/dist/components/inputs/Selection/Select/QuerySelect.d.ts +0 -14
- package/dist/components/inputs/Selection/Select/QuerySelect.js +0 -56
- package/dist/components/inputs/Selection/shared/querySelect.utils.d.ts +0 -6
- package/dist/components/inputs/Selection/shared/querySelect.utils.js +0 -13
- package/dist/hooks/useQueryAutocomplete.d.ts +0 -25
- package/dist/hooks/useQueryAutocomplete.js +0 -41
|
@@ -2,6 +2,7 @@ import { CalendarIcon } from "../../../../assets/icons/Calendar.js";
|
|
|
2
2
|
import { DateTimeIcon } from "../../../../assets/icons/DateTime.js";
|
|
3
3
|
import { UIStyle } from "../../../../config/uiStyle.context.js";
|
|
4
4
|
import { Typography } from "../../../text/Typography/Typography.js";
|
|
5
|
+
import { IconButton } from "../../../buttons/IconButton/IconButton.js";
|
|
5
6
|
import { InlineIconButton } from "../../../buttons/InlineIconButton/InlineIconButton.js";
|
|
6
7
|
import { TodayIcon } from "../../../../assets/icons/Today.js";
|
|
7
8
|
import { DateField } from "./DateField.js";
|
|
@@ -15,7 +16,9 @@ import { Button } from "react-aria-components";
|
|
|
15
16
|
import { useFocusVisible, useFocusWithin, useHover } from "react-aria";
|
|
16
17
|
import { getLocalTimeZone, now, toCalendarDateTime, today } from "@internationalized/date";
|
|
17
18
|
//#region src/components/inputs/DateTime/shared/DatePickerInput.tsx
|
|
18
|
-
var DatePickerInput = ({ ref, as, groupProps, fieldProps, endFieldProps, buttonProps, isDisabled, isInvalid, disableDropdown, variant, size, isDateTime, isClearable, headerProps, todayIcon,
|
|
19
|
+
var DatePickerInput = ({ ref, as, groupProps, fieldProps, endFieldProps, buttonProps, isDisabled, isInvalid, disableDropdown, variant, size, isDateTime, isClearable, headerProps, todayIcon, isDirty, isRequired, disableManualEntry, placeholder, className, onOpenDropdown, dateGranularity = "day", timeZone, autoFixYear, isTimeOptional = false, ...props }) => {
|
|
20
|
+
let effectiveTimeZone = getLocalTimeZone();
|
|
21
|
+
if (timeZone) effectiveTimeZone = timeZone;
|
|
19
22
|
const inputBaseCva = UIStyle.useCva("input.baseCva", inputBase);
|
|
20
23
|
const inputSizeCva = UIStyle.useCva("input.sizeCva", inputSize);
|
|
21
24
|
const [canClear, setCanClear] = useState(false);
|
|
@@ -40,7 +43,6 @@ var DatePickerInput = ({ ref, as, groupProps, fieldProps, endFieldProps, buttonP
|
|
|
40
43
|
if (endFieldProps) endFieldProps.onChange?.(null);
|
|
41
44
|
setCanClear(false);
|
|
42
45
|
fieldProps.onBlur?.(null);
|
|
43
|
-
endFieldProps?.onBlur?.(null);
|
|
44
46
|
},
|
|
45
47
|
getContainer: () => containerRef.current
|
|
46
48
|
}));
|
|
@@ -51,25 +53,19 @@ var DatePickerInput = ({ ref, as, groupProps, fieldProps, endFieldProps, buttonP
|
|
|
51
53
|
dateFieldRef.current?.clearField();
|
|
52
54
|
fieldProps.onChange?.(null);
|
|
53
55
|
endDateFieldRef.current?.clearField();
|
|
54
|
-
endFieldProps?.onChange?.(null);
|
|
55
56
|
setCanClear(false);
|
|
56
|
-
fieldProps.onBlur?.(null);
|
|
57
|
-
endFieldProps?.onBlur?.(null);
|
|
58
57
|
};
|
|
59
58
|
const onToday = () => {
|
|
60
59
|
if (isDateTime) {
|
|
61
|
-
const calendarDateTime = toCalendarDateTime(now(
|
|
60
|
+
const calendarDateTime = toCalendarDateTime(now(effectiveTimeZone));
|
|
62
61
|
fieldProps.onChange?.(calendarDateTime);
|
|
63
62
|
if (endFieldProps) endFieldProps.onChange?.(calendarDateTime);
|
|
64
63
|
} else {
|
|
65
|
-
fieldProps.onChange?.(today(
|
|
66
|
-
if (endFieldProps) endFieldProps.onChange?.(today(
|
|
64
|
+
fieldProps.onChange?.(today(effectiveTimeZone));
|
|
65
|
+
if (endFieldProps) endFieldProps.onChange?.(today(effectiveTimeZone));
|
|
67
66
|
}
|
|
68
|
-
fieldProps.onBlur?.(null);
|
|
69
|
-
endFieldProps?.onBlur?.(null);
|
|
70
67
|
};
|
|
71
68
|
const hidePlaceholder = as === "floating" && !fieldProps.value && !isFocused;
|
|
72
|
-
const todayIconComponent = todayIcon === true ? TodayIcon : todayIcon || null;
|
|
73
69
|
return /* @__PURE__ */ jsxs("div", {
|
|
74
70
|
ref: containerRef,
|
|
75
71
|
className: clsx(inputBaseCva({
|
|
@@ -88,7 +84,6 @@ var DatePickerInput = ({ ref, as, groupProps, fieldProps, endFieldProps, buttonP
|
|
|
88
84
|
"data-has-selection": fieldProps.value !== null || void 0,
|
|
89
85
|
"data-is-dirty": isDirty || void 0,
|
|
90
86
|
"data-is-required": isRequired || void 0,
|
|
91
|
-
"data-is-filled": fieldProps.value !== null || void 0,
|
|
92
87
|
...groupProps,
|
|
93
88
|
...focusWithinProps,
|
|
94
89
|
...hoverProps,
|
|
@@ -108,12 +103,12 @@ var DatePickerInput = ({ ref, as, groupProps, fieldProps, endFieldProps, buttonP
|
|
|
108
103
|
className: "absolute inset-0 z-0",
|
|
109
104
|
isDisabled
|
|
110
105
|
}),
|
|
111
|
-
|
|
106
|
+
todayIcon && /* @__PURE__ */ jsx(IconButton, {
|
|
112
107
|
label: "",
|
|
113
|
-
icon:
|
|
114
|
-
size:
|
|
108
|
+
icon: TodayIcon,
|
|
109
|
+
size: "none",
|
|
115
110
|
onPress: onToday,
|
|
116
|
-
className: "relative z-1
|
|
111
|
+
className: "relative z-1"
|
|
117
112
|
}),
|
|
118
113
|
disableManualEntry && placeholder && !fieldProps.value ? /* @__PURE__ */ jsx(Typography, {
|
|
119
114
|
size: "label-1",
|
|
@@ -126,7 +121,9 @@ var DatePickerInput = ({ ref, as, groupProps, fieldProps, endFieldProps, buttonP
|
|
|
126
121
|
isInvalid,
|
|
127
122
|
onClearChange,
|
|
128
123
|
hidePlaceholder,
|
|
129
|
-
disableManualEntry
|
|
124
|
+
disableManualEntry,
|
|
125
|
+
dateGranularity,
|
|
126
|
+
isTimeOptional
|
|
130
127
|
}), endFieldProps && /* @__PURE__ */ jsxs(Fragment, { children: [!((as === "floating" || as === "filter") && hidePlaceholder) && /* @__PURE__ */ jsx("span", {
|
|
131
128
|
className: clsx("pointer-events-none select-none", isDisabled && "text-interactive-text-secondary-disabled"),
|
|
132
129
|
children: "–"
|
|
@@ -137,7 +134,8 @@ var DatePickerInput = ({ ref, as, groupProps, fieldProps, endFieldProps, buttonP
|
|
|
137
134
|
isInvalid,
|
|
138
135
|
onClearChange,
|
|
139
136
|
hidePlaceholder,
|
|
140
|
-
disableManualEntry
|
|
137
|
+
disableManualEntry,
|
|
138
|
+
isTimeOptional
|
|
141
139
|
})] })] })
|
|
142
140
|
]
|
|
143
141
|
})]
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import { CalendarDate } from '@internationalized/date';
|
|
1
2
|
import { CalendarState, RangeCalendarState } from '@react-stately/calendar';
|
|
2
3
|
import { Key } from 'react-aria-components';
|
|
3
4
|
export interface MonthPickerProps {
|
|
4
5
|
state: CalendarState | RangeCalendarState;
|
|
5
6
|
onSelectionChange: (key: Set<Key>) => void;
|
|
7
|
+
onDateChange?: (selectedDate: CalendarDate) => void;
|
|
6
8
|
}
|
|
7
|
-
export declare const MonthPicker: ({ state, onSelectionChange }: MonthPickerProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export declare const MonthPicker: ({ state, onSelectionChange, onDateChange }: MonthPickerProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -4,7 +4,7 @@ import { clsx } from "clsx";
|
|
|
4
4
|
import { ListBox, ListBoxItem } from "react-aria-components";
|
|
5
5
|
import { useDateFormatter } from "@react-aria/i18n";
|
|
6
6
|
//#region src/components/inputs/DateTime/shared/MonthPicker.tsx
|
|
7
|
-
var MonthPicker = ({ state, onSelectionChange }) => {
|
|
7
|
+
var MonthPicker = ({ state, onSelectionChange, onDateChange }) => {
|
|
8
8
|
const formatter = useDateFormatter({
|
|
9
9
|
month: "long",
|
|
10
10
|
timeZone: state.timeZone
|
|
@@ -32,8 +32,9 @@ var MonthPicker = ({ state, onSelectionChange }) => {
|
|
|
32
32
|
onSelectionChange: (key) => {
|
|
33
33
|
if (key === "all") return;
|
|
34
34
|
if (typeof [...key][0] === "number") {
|
|
35
|
-
const
|
|
36
|
-
state.setFocusedDate(
|
|
35
|
+
const selectedDate = state.focusedDate.set({ month: [...key][0] });
|
|
36
|
+
state.setFocusedDate(selectedDate);
|
|
37
|
+
onDateChange?.(selectedDate);
|
|
37
38
|
}
|
|
38
39
|
onSelectionChange(key);
|
|
39
40
|
},
|
|
@@ -9,7 +9,6 @@ interface DatePickerInputProps extends InputVariantProps {
|
|
|
9
9
|
state: TimeFieldState;
|
|
10
10
|
isDisabled?: boolean;
|
|
11
11
|
isDirty?: boolean;
|
|
12
|
-
isRequired?: boolean;
|
|
13
12
|
isInvalid?: boolean;
|
|
14
13
|
disableDropdown?: boolean;
|
|
15
14
|
headerProps?: FormFieldHeaderProps;
|
|
@@ -19,5 +18,5 @@ interface DatePickerInputProps extends InputVariantProps {
|
|
|
19
18
|
className?: string;
|
|
20
19
|
onPress: () => void;
|
|
21
20
|
}
|
|
22
|
-
export declare const TimePickerInput: ({ ref, as, fieldProps, state, isDisabled, isDirty,
|
|
21
|
+
export declare const TimePickerInput: ({ ref, as, fieldProps, state, isDisabled, isDirty, isInvalid, disableDropdown, variant, size, isClearable, headerProps, disableManualEntry, placeholder, className, onPress, ...props }: DatePickerInputProps) => import("react/jsx-runtime").JSX.Element;
|
|
23
22
|
export {};
|
|
@@ -12,7 +12,7 @@ import { useState } from "react";
|
|
|
12
12
|
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
|
-
var TimePickerInput = ({ ref, as, fieldProps, state, isDisabled, isDirty,
|
|
15
|
+
var TimePickerInput = ({ ref, as, fieldProps, state, isDisabled, isDirty, isInvalid, disableDropdown, variant, size, isClearable, headerProps, disableManualEntry, placeholder, className, onPress, ...props }) => {
|
|
16
16
|
const inputBaseCva = UIStyle.useCva("input.baseCva", inputBase);
|
|
17
17
|
const inputSizeCva = UIStyle.useCva("input.sizeCva", inputSize);
|
|
18
18
|
const { hoverProps, isHovered } = useHover({ isDisabled });
|
|
@@ -38,8 +38,6 @@ var TimePickerInput = ({ ref, as, fieldProps, state, isDisabled, isDirty, isRequ
|
|
|
38
38
|
"data-focus-visible": isFocused && isFocusVisible || void 0,
|
|
39
39
|
"data-has-selection": state.value !== null || void 0,
|
|
40
40
|
"data-is-dirty": isDirty || void 0,
|
|
41
|
-
"data-is-required": isRequired || void 0,
|
|
42
|
-
"data-is-filled": state.value !== null || void 0,
|
|
43
41
|
...fieldProps,
|
|
44
42
|
...focusWithinProps,
|
|
45
43
|
...hoverProps,
|
|
@@ -74,10 +72,7 @@ var TimePickerInput = ({ ref, as, fieldProps, state, isDisabled, isDirty, isRequ
|
|
|
74
72
|
as
|
|
75
73
|
}), "flex items-center gap-input-gap-trailing-elements py-0! pl-0!"),
|
|
76
74
|
children: [isClearable && /* @__PURE__ */ jsx(InputClear, {
|
|
77
|
-
onClear: () =>
|
|
78
|
-
state.setValue(null);
|
|
79
|
-
fieldProps.onBlur?.(null);
|
|
80
|
-
},
|
|
75
|
+
onClear: () => state.setValue(null),
|
|
81
76
|
show: canClear
|
|
82
77
|
}), (!disableDropdown || disableManualEntry) && /* @__PURE__ */ jsx(InlineIconButton, {
|
|
83
78
|
label: "",
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import { CalendarDate } from '@internationalized/date';
|
|
1
2
|
import { CalendarState, RangeCalendarState } from '@react-stately/calendar';
|
|
2
3
|
import { Key } from 'react-aria-components';
|
|
3
4
|
interface YearPickerProps {
|
|
4
5
|
state: CalendarState | RangeCalendarState;
|
|
5
6
|
onSelectionChange: (key: Set<Key>) => void;
|
|
7
|
+
onDateChange?: (selectedDate: CalendarDate) => void;
|
|
6
8
|
}
|
|
7
|
-
export declare const YearPicker: ({ state, onSelectionChange }: YearPickerProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export declare const YearPicker: ({ state, onSelectionChange, onDateChange }: YearPickerProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
10
|
export {};
|
|
@@ -7,7 +7,7 @@ import { ListBox, ListBoxItem } from "react-aria-components";
|
|
|
7
7
|
import { today } from "@internationalized/date";
|
|
8
8
|
import { useDateFormatter } from "@react-aria/i18n";
|
|
9
9
|
//#region src/components/inputs/DateTime/shared/YearPicker.tsx
|
|
10
|
-
var YearPicker = ({ state, onSelectionChange }) => {
|
|
10
|
+
var YearPicker = ({ state, onSelectionChange, onDateChange }) => {
|
|
11
11
|
const formatter = useDateFormatter({
|
|
12
12
|
year: "numeric",
|
|
13
13
|
timeZone: state.timeZone
|
|
@@ -40,8 +40,9 @@ var YearPicker = ({ state, onSelectionChange }) => {
|
|
|
40
40
|
if (key === "all") return;
|
|
41
41
|
const index = [...key][0];
|
|
42
42
|
if (typeof index === "number") {
|
|
43
|
-
const
|
|
44
|
-
state.setFocusedDate(
|
|
43
|
+
const selectedDate = state.focusedDate.set({ year: years[index].value });
|
|
44
|
+
state.setFocusedDate(selectedDate);
|
|
45
|
+
onDateChange?.(selectedDate);
|
|
45
46
|
}
|
|
46
47
|
onSelectionChange(key);
|
|
47
48
|
},
|
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
import { InfoIcon } from "../../../assets/icons/Info.js";
|
|
2
|
-
import { UIStyle } from "../../../config/uiStyle.context.js";
|
|
3
2
|
import { Typography } from "../../text/Typography/Typography.js";
|
|
4
3
|
import { Tooltip as Tooltip$1 } from "../../overlays/Tooltip/Tooltip.js";
|
|
5
4
|
import { FormFieldLabel } from "./FormFieldLabel.js";
|
|
6
|
-
import { formFieldHeader } from "./formFieldHeader.cva.js";
|
|
7
5
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
6
|
import { clsx } from "clsx";
|
|
9
7
|
import { Focusable } from "react-aria-components";
|
|
10
8
|
//#region src/components/inputs/FormField/FormFieldHeader.tsx
|
|
11
9
|
var FormFieldHeader = ({ label, tooltipText, helperText, isRequired, rightContent, isHeaderHidden, isDisabled, className, labelProps }) => {
|
|
12
10
|
return /* @__PURE__ */ jsxs("div", {
|
|
13
|
-
className: clsx(
|
|
11
|
+
className: clsx(isHeaderHidden ? "sr-only" : "mb-1", className),
|
|
14
12
|
children: [/* @__PURE__ */ jsxs("div", {
|
|
15
13
|
className: "flex items-start justify-between",
|
|
16
14
|
children: [/* @__PURE__ */ jsxs("div", {
|
|
@@ -101,7 +101,6 @@ var NumberInputBase = (props) => {
|
|
|
101
101
|
"data-is-dirty": isDirty || void 0,
|
|
102
102
|
"data-is-required": isRequired || void 0,
|
|
103
103
|
"data-is-empty": value === null || value === void 0 || void 0,
|
|
104
|
-
"data-is-filled": !("" + value === "" || value === null || value === void 0) || void 0,
|
|
105
104
|
placeholder: as === "floating" ? "\xA0" : inputProps.placeholder,
|
|
106
105
|
className: "w-full outline-none",
|
|
107
106
|
onFocus: (e) => {
|
|
@@ -75,8 +75,6 @@ var TextInputBase = (props) => {
|
|
|
75
75
|
labelProps,
|
|
76
76
|
className: clsx("group w-full", as === "inline" && "h-full", className),
|
|
77
77
|
tabIndex: as === "inline" ? -1 : void 0,
|
|
78
|
-
"data-is-empty": value === "" || value === null || value === void 0 || void 0,
|
|
79
|
-
"data-is-required": isRequired || void 0,
|
|
80
78
|
children: /* @__PURE__ */ jsx("div", {
|
|
81
79
|
className: clsx("relative flex cursor-text has-disabled:cursor-default", inputBaseCva({
|
|
82
80
|
variant,
|
|
@@ -93,7 +91,6 @@ var TextInputBase = (props) => {
|
|
|
93
91
|
...inputProps,
|
|
94
92
|
ref: mergeRefs(ref, inputRef),
|
|
95
93
|
"data-is-empty": value === "" || value === null || value === void 0 || void 0,
|
|
96
|
-
"data-is-filled": !(value === "" || value === null || value === void 0) || void 0,
|
|
97
94
|
"data-is-dirty": isDirty || void 0,
|
|
98
95
|
"data-is-required": isRequired || void 0,
|
|
99
96
|
"data-is-disabled": isDisabled || void 0,
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { ComponentProps, JSXElementConstructor, ReactElement, ReactNode } from 'react';
|
|
2
2
|
import { Control, UseFormReturn } from 'react-hook-form';
|
|
3
3
|
import { z } from 'zod';
|
|
4
|
-
import { Autocomplete } from '../Selection/Autocomplete/Autocomplete';
|
|
5
|
-
import { Select } from '../Selection/Select/Select';
|
|
6
4
|
import { HasRequiredProperty } from '../../../types/common';
|
|
7
5
|
declare const componentRegistry: {
|
|
8
6
|
readonly toggle: <TFieldValues extends import('react-hook-form').FieldValues>(props: import('../Toggle/Toggle').ControlledToggleProps<TFieldValues>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -12,16 +10,24 @@ declare const componentRegistry: {
|
|
|
12
10
|
readonly textInput: <TFieldValues extends import('react-hook-form').FieldValues>(props: import('../Input/TextInput/TextInput').ControlledTextInputProps<TFieldValues>) => import("react/jsx-runtime").JSX.Element;
|
|
13
11
|
readonly passwordInput: <TFieldValues extends import('react-hook-form').FieldValues>(props: import('../Input/PasswordInput/PasswordInput').ControlledPasswordInputProps<TFieldValues>) => import("react/jsx-runtime").JSX.Element;
|
|
14
12
|
readonly textArea: <TFieldValues extends import('react-hook-form').FieldValues>(props: import('../Input/TextArea/TextArea').ControlledTextAreaProps<TFieldValues>) => import("react/jsx-runtime").JSX.Element;
|
|
15
|
-
readonly select:
|
|
16
|
-
readonly
|
|
17
|
-
readonly
|
|
18
|
-
|
|
13
|
+
readonly select: <TFieldValues extends import('react-hook-form').FieldValues, TKey extends import('react-aria').Key = import('react-aria').Key, TInitialSelectItem = import('../Selection/shared/select.types').DefaultInitialSelectItem<TKey>>(props: import('../Selection/Select/Select').ControlledSelectProps<TFieldValues, TKey, TInitialSelectItem>) => import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
readonly autocomplete: <TFieldValues extends import('react-hook-form').FieldValues, TKey extends import('react-aria').Key = import('react-aria').Key, TInitialSelectItem = import('../Selection/shared/select.types').DefaultInitialSelectItem<TKey>>(props: import('../Selection/Autocomplete/Autocomplete').ControlledAutocompleteProps<TFieldValues, TKey, TInitialSelectItem>) => import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
readonly queryAutocomplete: <TFieldValues extends import('react-hook-form').FieldValues, TSelectItem extends import('../Selection/shared/select.types').SelectItem<any>, TQueryFn extends (...args: any) => import('@tanstack/react-query').UseQueryResult<TSelectItem[]>>({ query, queryParams, queryOptions, ...props }: import('../../../types/common').OmitDiscriminatedUnion<import('../Selection/Autocomplete/Autocomplete').AutocompleteProps<Exclude<ReturnType<TQueryFn>["data"], undefined>[0] extends {
|
|
16
|
+
id: infer InferredKey extends import('react-aria').Key;
|
|
17
|
+
} ? InferredKey : never>, "onChange" | "value" | "items" | "selectionMode" | "isLoading" | "showSelectionBar" | "showSelectAllOption" | "initialSelection" | "showSelectionContent" | "onSearchChange"> & (import('../Selection/shared/select.types').GroupedSelectControlProps<TFieldValues, Exclude<ReturnType<TQueryFn>["data"], undefined>[0] extends {
|
|
18
|
+
id: infer InferredKey extends import('react-aria').Key;
|
|
19
|
+
} ? InferredKey : never> & {
|
|
20
|
+
query: Parameters<TQueryFn>[0] extends {
|
|
21
|
+
search?: string;
|
|
22
|
+
} ? TQueryFn : never;
|
|
23
|
+
queryParams?: Omit<Parameters<TQueryFn>[0], "search"> | undefined;
|
|
24
|
+
queryOptions?: Parameters<TQueryFn>[1] | undefined;
|
|
25
|
+
})) => import("react/jsx-runtime").JSX.Element;
|
|
19
26
|
readonly segment: <TFieldValues extends import('react-hook-form').FieldValues, TKey extends import('react-aria').Key = import('react-aria').Key>(props: import('../../..').ControlledSegmentProps<TFieldValues, TKey>) => import("react/jsx-runtime").JSX.Element;
|
|
20
|
-
readonly datePicker: <TFieldValues extends import('react-hook-form').FieldValues>({ fullIso, minValue, maxValue, ...props }: import('../DateTime/DatePicker/DatePicker').ControlledDatePickerProps<TFieldValues>) => import("react/jsx-runtime").JSX.Element;
|
|
27
|
+
readonly datePicker: <TFieldValues extends import('react-hook-form').FieldValues>({ fullIso, granularity, minValue, maxValue, ...props }: import('../DateTime/DatePicker/DatePicker').ControlledDatePickerProps<TFieldValues>) => import("react/jsx-runtime").JSX.Element;
|
|
21
28
|
readonly dateTimePicker: <TFieldValues extends import('react-hook-form').FieldValues>({ fullIso, ...props }: import('../DateTime/DateTimePicker/DateTimePicker').ControlledDateTimePickerProps<TFieldValues>) => import("react/jsx-runtime").JSX.Element;
|
|
22
29
|
readonly timePicker: <TFieldValues extends import('react-hook-form').FieldValues>(props: import('../DateTime/TimePicker/TimePicker').ControlledTimePickerProps<TFieldValues>) => import("react/jsx-runtime").JSX.Element;
|
|
23
30
|
readonly dateRangePicker: <TFieldValues extends import('react-hook-form').FieldValues>({ fullIso, minValue, maxValue, ...props }: import('../DateTime/DateRangePicker/DateRangePicker').ControlledDateRangePickerProps<TFieldValues>) => import("react/jsx-runtime").JSX.Element;
|
|
24
|
-
readonly textEditor: <TFieldValues extends import('react-hook-form').FieldValues>(props: import('../../../text-editor.js').ControlledTextEditorProps<TFieldValues>) => import("react/jsx-runtime").JSX.Element;
|
|
25
31
|
readonly unknown: null;
|
|
26
32
|
};
|
|
27
33
|
export type InputComponentRegistry = typeof componentRegistry;
|
|
@@ -50,8 +56,8 @@ type TypeBasedInputDef<TSchemaType extends Record<string, any>, T extends InputC
|
|
|
50
56
|
interface RenderBasedInputDef<TSchemaType extends Record<string, any>, K extends keyof TSchemaType> {
|
|
51
57
|
type?: never;
|
|
52
58
|
name: K;
|
|
53
|
-
label?:
|
|
54
|
-
placeholder?:
|
|
59
|
+
label?: never;
|
|
60
|
+
placeholder?: never;
|
|
55
61
|
props?: never;
|
|
56
62
|
inputWrapper?: never;
|
|
57
63
|
render: (formControl: {
|
|
@@ -13,8 +13,6 @@ import { QueryAutocomplete } from "../Selection/Autocomplete/QueryAutocomplete.j
|
|
|
13
13
|
import { Slider } from "../Slider/Slider.js";
|
|
14
14
|
import { Toggle } from "../Toggle/Toggle.js";
|
|
15
15
|
import { Segment } from "../../segment/Segment.js";
|
|
16
|
-
import { QuerySelect } from "../Selection/Select/QuerySelect.js";
|
|
17
|
-
import { TextEditor } from "../TextEditor/TextEditor.js";
|
|
18
16
|
import { jsx } from "react/jsx-runtime";
|
|
19
17
|
//#region src/components/inputs/Inputs/InputItem.tsx
|
|
20
18
|
var componentRegistry = {
|
|
@@ -26,7 +24,6 @@ var componentRegistry = {
|
|
|
26
24
|
passwordInput: PasswordInput,
|
|
27
25
|
textArea: TextArea,
|
|
28
26
|
select: Select,
|
|
29
|
-
querySelect: QuerySelect,
|
|
30
27
|
autocomplete: Autocomplete,
|
|
31
28
|
queryAutocomplete: QueryAutocomplete,
|
|
32
29
|
segment: Segment,
|
|
@@ -34,7 +31,6 @@ var componentRegistry = {
|
|
|
34
31
|
dateTimePicker: DateTimePicker,
|
|
35
32
|
timePicker: TimePicker,
|
|
36
33
|
dateRangePicker: DateRangePicker,
|
|
37
|
-
textEditor: TextEditor,
|
|
38
34
|
unknown: null
|
|
39
35
|
};
|
|
40
36
|
function InputItem({ form, inputDef }) {
|
|
@@ -2,7 +2,7 @@ import { UIStyle } from "../../../config/uiStyle.context.js";
|
|
|
2
2
|
import { UIConfig } from "../../../config/uiConfig.context.js";
|
|
3
3
|
import { CheckContent } from "../shared/CheckContent.js";
|
|
4
4
|
import { FormField } from "../FormField/FormField.js";
|
|
5
|
-
import { radio,
|
|
5
|
+
import { radio, radioIndicatorClass, radioTypography } from "./radio.cva.js";
|
|
6
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
7
|
import { clsx } from "clsx";
|
|
8
8
|
import { Radio, RadioGroup } from "react-aria-components";
|
|
@@ -13,7 +13,6 @@ var RadioGroupBase = (props) => {
|
|
|
13
13
|
const ui = UIConfig.useConfig();
|
|
14
14
|
const radioCva = UIStyle.useCva("radio.cva", radio);
|
|
15
15
|
const radioTypographyMap = UIStyle.useMapper("radio.typography", radioTypography);
|
|
16
|
-
const radioContentClassNameMap = UIStyle.useMapper("radio.contentClassName", radioContentClassName);
|
|
17
16
|
const { label, tooltipText, helperText, isDirty, isRequired, rightContent, isDisabled, headerClassName, errorClassName, labelClassName, inputClassName, isHeaderHidden, error, className, options, variant = ui.radioGroup.variant, hideLabel = ui.radioGroup.hideLabel, ...rest } = props;
|
|
18
17
|
const formFieldProps = {
|
|
19
18
|
className,
|
|
@@ -50,10 +49,6 @@ var RadioGroupBase = (props) => {
|
|
|
50
49
|
variant,
|
|
51
50
|
...rest
|
|
52
51
|
}),
|
|
53
|
-
contentClassName: radioContentClassNameMap({
|
|
54
|
-
variant,
|
|
55
|
-
...rest
|
|
56
|
-
}),
|
|
57
52
|
className: labelClassName,
|
|
58
53
|
children: option.label
|
|
59
54
|
})]
|
|
@@ -9,6 +9,3 @@ export declare const radioIndicatorClass = "group flex items-center gap-2";
|
|
|
9
9
|
export declare const radioTypography: (props: {
|
|
10
10
|
variant?: "default" | null | undefined;
|
|
11
11
|
}) => TypographyVariantProps | undefined;
|
|
12
|
-
export declare const radioContentClassName: (props: {
|
|
13
|
-
variant?: "default" | null | undefined;
|
|
14
|
-
}) => string | undefined;
|
|
@@ -31,6 +31,5 @@ var radioTypography = compoundMapper({ default: {
|
|
|
31
31
|
sizeMobile: "label-1",
|
|
32
32
|
variant: "default"
|
|
33
33
|
} });
|
|
34
|
-
var radioContentClassName = compoundMapper({ default: "text-text-default-2" });
|
|
35
34
|
//#endregion
|
|
36
|
-
export { radio,
|
|
35
|
+
export { radio, radioIndicatorClass, radioTypography };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { ReactElement } from 'react';
|
|
2
1
|
import { Key } from 'react-aria-components';
|
|
3
2
|
import { FieldValues } from 'react-hook-form';
|
|
4
3
|
import { SelectBaseProps } from '../shared/SelectBase';
|
|
@@ -6,5 +5,4 @@ import { DefaultInitialSelectItem, GroupedSelectControlProps, GroupedSelectProps
|
|
|
6
5
|
import { OmitDiscriminatedUnion } from '../../../../types/common';
|
|
7
6
|
export type AutocompleteProps<TKey extends Key = Key, TInitialSelectItem = DefaultInitialSelectItem<TKey>> = OmitDiscriminatedUnion<SelectBaseProps<TKey, TInitialSelectItem>, "isSearchable">;
|
|
8
7
|
export type ControlledAutocompleteProps<TFieldValues extends FieldValues, TKey extends Key = Key, TInitialSelectItem = DefaultInitialSelectItem<TKey>> = Omit<AutocompleteProps<TKey, TInitialSelectItem>, keyof GroupedSelectProps> & GroupedSelectControlProps<TFieldValues, TKey, TInitialSelectItem>;
|
|
9
|
-
export declare
|
|
10
|
-
export declare function Autocomplete<TFieldValues extends FieldValues, TKey extends Key = Key, TInitialSelectItem = DefaultInitialSelectItem<TKey>>(props: ControlledAutocompleteProps<TFieldValues, TKey, TInitialSelectItem>): ReactElement;
|
|
8
|
+
export declare const Autocomplete: <TFieldValues extends FieldValues, TKey extends Key = Key, TInitialSelectItem = DefaultInitialSelectItem<TKey>>(props: ControlledAutocompleteProps<TFieldValues, TKey, TInitialSelectItem>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -3,19 +3,18 @@ import { jsx } from "react/jsx-runtime";
|
|
|
3
3
|
import { mergeRefs } from "@react-aria/utils";
|
|
4
4
|
import { Controller } from "react-hook-form";
|
|
5
5
|
//#region src/components/inputs/Selection/Autocomplete/Autocomplete.tsx
|
|
6
|
-
|
|
6
|
+
var Autocomplete = (props) => {
|
|
7
7
|
if ("formControl" in props && props.formControl) {
|
|
8
8
|
const { formControl, ref, ...innerProps } = props;
|
|
9
9
|
return /* @__PURE__ */ jsx(Controller, {
|
|
10
10
|
control: formControl.control,
|
|
11
11
|
name: formControl.name,
|
|
12
|
-
render: ({ field, fieldState: { error
|
|
12
|
+
render: ({ field, fieldState: { error } }) => /* @__PURE__ */ jsx(SelectBase, {
|
|
13
13
|
...innerProps,
|
|
14
14
|
ref: mergeRefs(ref, field.ref),
|
|
15
15
|
value: field.value,
|
|
16
16
|
onChange: field.onChange,
|
|
17
17
|
onBlur: field.onBlur,
|
|
18
|
-
isDirty,
|
|
19
18
|
isDisabled: field.disabled || props.isDisabled,
|
|
20
19
|
error: props.error ?? error?.message,
|
|
21
20
|
isSearchable: true
|
|
@@ -26,6 +25,6 @@ function Autocomplete(props) {
|
|
|
26
25
|
...props,
|
|
27
26
|
isSearchable: true
|
|
28
27
|
});
|
|
29
|
-
}
|
|
28
|
+
};
|
|
30
29
|
//#endregion
|
|
31
30
|
export { Autocomplete };
|
|
@@ -1,4 +1,19 @@
|
|
|
1
|
+
import { UseQueryResult } from '@tanstack/react-query';
|
|
2
|
+
import { Key } from 'react-aria-components';
|
|
1
3
|
import { FieldValues } from 'react-hook-form';
|
|
2
|
-
import {
|
|
3
|
-
import { SelectItem } from '../shared/select.types';
|
|
4
|
-
|
|
4
|
+
import { AutocompleteProps } from './Autocomplete';
|
|
5
|
+
import { GroupedSelectControlProps, GroupedSelectProps, SelectItem } from '../shared/select.types';
|
|
6
|
+
import { OmitDiscriminatedUnion } from '../../../../types/common';
|
|
7
|
+
type QueryFn<TSelectItem extends SelectItem = SelectItem> = (...args: any) => UseQueryResult<Array<TSelectItem>>;
|
|
8
|
+
type TKey<TQueryFn extends QueryFn> = Exclude<ReturnType<TQueryFn>["data"], undefined>[0] extends {
|
|
9
|
+
id: infer InferredKey extends Key;
|
|
10
|
+
} ? InferredKey : never;
|
|
11
|
+
type QueryAutocompleteProps<TFieldValues extends FieldValues, TSelectItem extends SelectItem<any>, TQueryFn extends QueryFn<TSelectItem>> = OmitDiscriminatedUnion<AutocompleteProps<TKey<TQueryFn>>, "items" | "onSearchChange" | "isLoading" | keyof GroupedSelectProps> & GroupedSelectControlProps<TFieldValues, TKey<TQueryFn>> & {
|
|
12
|
+
query: Parameters<TQueryFn>[0] extends {
|
|
13
|
+
search?: string;
|
|
14
|
+
} ? TQueryFn : never;
|
|
15
|
+
queryParams?: Omit<Parameters<TQueryFn>[0], "search">;
|
|
16
|
+
queryOptions?: Parameters<TQueryFn>[1];
|
|
17
|
+
};
|
|
18
|
+
export declare const QueryAutocomplete: <TFieldValues extends FieldValues, TSelectItem extends SelectItem<any>, TQueryFn extends QueryFn<TSelectItem>>({ query, queryParams, queryOptions, ...props }: QueryAutocompleteProps<TFieldValues, TSelectItem, TQueryFn>) => import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
export {};
|
|
@@ -1,35 +1,19 @@
|
|
|
1
|
-
import { UIConfig } from "../../../../config/uiConfig.context.js";
|
|
2
1
|
import { Autocomplete } from "./Autocomplete.js";
|
|
3
|
-
import { useQueryAutocomplete } from "../../../../hooks/useQueryAutocomplete.js";
|
|
4
2
|
import { jsx } from "react/jsx-runtime";
|
|
5
3
|
import { useState } from "react";
|
|
6
4
|
//#region src/components/inputs/Selection/Autocomplete/QueryAutocomplete.tsx
|
|
7
|
-
var QueryAutocomplete = ({ query, queryParams, queryOptions,
|
|
8
|
-
const ui = UIConfig.useConfig();
|
|
5
|
+
var QueryAutocomplete = ({ query, queryParams, queryOptions, ...props }) => {
|
|
9
6
|
const [search, setSearch] = useState("");
|
|
10
|
-
const
|
|
11
|
-
const extractedData = Array.isArray(data) ? data : data.pages.flatMap((page) => page.items ?? []);
|
|
12
|
-
return queryMap?.(extractedData) ?? extractedData;
|
|
13
|
-
};
|
|
14
|
-
const { items, isLoading, handleEnableQuery, hasNextPage, fetchNextPage } = useQueryAutocomplete({
|
|
15
|
-
query,
|
|
16
|
-
queryParams,
|
|
17
|
-
queryOptions,
|
|
18
|
-
mapItems: (data) => mapItems(data),
|
|
7
|
+
const { data: items, isLoading } = query({
|
|
19
8
|
search,
|
|
20
|
-
|
|
21
|
-
});
|
|
22
|
-
const { isInitialQueryDisabled: _, ...restProps } = props;
|
|
9
|
+
...queryParams
|
|
10
|
+
}, queryOptions);
|
|
23
11
|
return /* @__PURE__ */ jsx(Autocomplete, {
|
|
24
|
-
...
|
|
25
|
-
items,
|
|
12
|
+
...props,
|
|
13
|
+
items: items ?? [],
|
|
26
14
|
onSearchChange: setSearch,
|
|
27
15
|
isClientSearchDisabled: true,
|
|
28
|
-
isLoading
|
|
29
|
-
onMouseEnter: handleEnableQuery,
|
|
30
|
-
onFocusCapture: handleEnableQuery,
|
|
31
|
-
hasLoadMore: hasNextPage,
|
|
32
|
-
onLoadMore: fetchNextPage ? () => void fetchNextPage() : void 0
|
|
16
|
+
isLoading
|
|
33
17
|
});
|
|
34
18
|
};
|
|
35
19
|
//#endregion
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import { ReactElement } from 'react';
|
|
2
1
|
import { Key } from 'react-aria-components';
|
|
3
2
|
import { FieldValues } from 'react-hook-form';
|
|
4
3
|
import { SelectBaseProps } from '../shared/SelectBase';
|
|
5
4
|
import { DefaultInitialSelectItem, GroupedSelectControlProps, GroupedSelectProps, SelectAsyncProps } from '../shared/select.types';
|
|
6
5
|
import { OmitDiscriminatedUnion } from '../../../../types/common';
|
|
7
6
|
export type SelectProps<TKey extends Key = Key, TInitialSelectItem = DefaultInitialSelectItem<TKey>> = OmitDiscriminatedUnion<SelectBaseProps<TKey, TInitialSelectItem>, "initialSelection" | "mapInitialToSelectItem" | keyof SelectAsyncProps>;
|
|
8
|
-
export type ControlledSelectProps<TFieldValues extends FieldValues, TKey extends Key = Key, TInitialSelectItem = DefaultInitialSelectItem<TKey>> = Omit<SelectProps<TKey, TInitialSelectItem>, keyof GroupedSelectProps> & GroupedSelectControlProps<TFieldValues, TKey
|
|
9
|
-
export declare
|
|
10
|
-
export declare function Select<TFieldValues extends FieldValues, TKey extends Key = Key, TInitialSelectItem = DefaultInitialSelectItem<TKey>>(props: ControlledSelectProps<TFieldValues, TKey, TInitialSelectItem>): ReactElement;
|
|
7
|
+
export type ControlledSelectProps<TFieldValues extends FieldValues, TKey extends Key = Key, TInitialSelectItem = DefaultInitialSelectItem<TKey>> = Omit<SelectProps<TKey, TInitialSelectItem>, keyof GroupedSelectProps> & GroupedSelectControlProps<TFieldValues, TKey>;
|
|
8
|
+
export declare const Select: <TFieldValues extends FieldValues, TKey extends Key = Key, TInitialSelectItem = DefaultInitialSelectItem<TKey>>(props: ControlledSelectProps<TFieldValues, TKey, TInitialSelectItem>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -3,25 +3,24 @@ import { jsx } from "react/jsx-runtime";
|
|
|
3
3
|
import { mergeRefs } from "@react-aria/utils";
|
|
4
4
|
import { Controller } from "react-hook-form";
|
|
5
5
|
//#region src/components/inputs/Selection/Select/Select.tsx
|
|
6
|
-
|
|
6
|
+
var Select = (props) => {
|
|
7
7
|
if ("formControl" in props && props.formControl) {
|
|
8
8
|
const { formControl, ref, ...innerProps } = props;
|
|
9
9
|
return /* @__PURE__ */ jsx(Controller, {
|
|
10
10
|
control: formControl.control,
|
|
11
11
|
name: formControl.name,
|
|
12
|
-
render: ({ field, fieldState: { error
|
|
12
|
+
render: ({ field, fieldState: { error } }) => /* @__PURE__ */ jsx(SelectBase, {
|
|
13
13
|
...innerProps,
|
|
14
14
|
ref: mergeRefs(ref, field.ref),
|
|
15
15
|
value: field.value,
|
|
16
16
|
onChange: field.onChange,
|
|
17
17
|
onBlur: field.onBlur,
|
|
18
|
-
isDirty,
|
|
19
18
|
isDisabled: field.disabled || props.isDisabled,
|
|
20
19
|
error: props.error ?? error?.message
|
|
21
20
|
})
|
|
22
21
|
});
|
|
23
22
|
}
|
|
24
23
|
return /* @__PURE__ */ jsx(SelectBase, { ...props });
|
|
25
|
-
}
|
|
24
|
+
};
|
|
26
25
|
//#endregion
|
|
27
26
|
export { Select };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ReactElement, Ref } from 'react';
|
|
2
2
|
import { AriaButtonProps } from 'react-aria';
|
|
3
3
|
import { Key } from 'react-aria-components';
|
|
4
4
|
import { FormFieldProps } from '../../FormField/FormField';
|
|
@@ -7,28 +7,21 @@ import { InputVariantProps } from '../../shared/input.cva';
|
|
|
7
7
|
export type SelectBaseProps<TKey extends Key = Key, TInitialSelectItem = DefaultInitialSelectItem<TKey>> = FormFieldProps & GroupedSelectProps<TKey, TInitialSelectItem> & SelectNewItemProps & SelectAsyncProps & SelectVirtualizationProps & InputVariantProps & Pick<AriaButtonProps, "onBlur"> & {
|
|
8
8
|
ref?: Ref<HTMLDivElement>;
|
|
9
9
|
className?: string;
|
|
10
|
-
isDirty?: boolean;
|
|
11
10
|
placeholder?: string;
|
|
12
11
|
hideDropdownIcon?: boolean;
|
|
13
12
|
hideSearchIcon?: boolean;
|
|
14
13
|
isSearchable?: boolean;
|
|
15
14
|
isClearable?: boolean;
|
|
16
15
|
isClientSearchDisabled?: boolean;
|
|
17
|
-
ignoreInputValueFiltering?: boolean;
|
|
18
16
|
ignoreTriggerWidth?: boolean;
|
|
19
17
|
items: SelectItem<TKey>[];
|
|
20
18
|
inputClassName?: string;
|
|
21
19
|
containerClassName?: string;
|
|
22
|
-
leadingContent?: ReactNode;
|
|
23
|
-
trailingContent?: ReactNode;
|
|
24
20
|
customTrigger?: ReactElement;
|
|
25
21
|
selectedTagsType?: "tags" | "list";
|
|
26
22
|
collapseAfter?: number;
|
|
27
|
-
fireBlurOnChange?: boolean;
|
|
28
23
|
onInputChange?: (value: string) => void;
|
|
29
24
|
onSearchChange?: (value: string) => void;
|
|
30
25
|
mapInitialToSelectItem?: (item: TInitialSelectItem) => SelectItem<TKey>;
|
|
31
|
-
onMouseEnter?: MouseEventHandler<HTMLDivElement>;
|
|
32
|
-
onFocusCapture?: FocusEventHandler<HTMLDivElement>;
|
|
33
26
|
};
|
|
34
27
|
export declare const SelectBase: <TKey extends Key = Key, TInitialSelectItem = DefaultInitialSelectItem<TKey>>(dProps: SelectBaseProps<TKey, TInitialSelectItem>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -19,9 +19,7 @@ var SelectBase = (dProps) => {
|
|
|
19
19
|
selectedTagsType: dProps.selectedTagsType ?? ui.select.selectedTagsType,
|
|
20
20
|
ignoreTriggerWidth: dProps.virtualizerOptions || dProps.items.length > 100 ? false : dProps.ignoreTriggerWidth ?? false,
|
|
21
21
|
collapseAfter: dProps.collapseAfter ?? ui.select.collapseAfter,
|
|
22
|
-
hideSearchIcon: dProps.hideSearchIcon ?? ui.select.hideSearchIcon
|
|
23
|
-
fireBlurOnChange: dProps.fireBlurOnChange ?? ui.select.fireBlurOnChange,
|
|
24
|
-
isClientSearchDisabled: dProps.ignoreInputValueFiltering ?? dProps.isClientSearchDisabled
|
|
22
|
+
hideSearchIcon: dProps.hideSearchIcon ?? ui.select.hideSearchIcon
|
|
25
23
|
};
|
|
26
24
|
const isDesktop = useBreakpoint("md");
|
|
27
25
|
return /* @__PURE__ */ jsx(SelectContext.Provider, {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Key } from 'react-aria-components';
|
|
2
2
|
import { SelectBaseProps } from './SelectBase';
|
|
3
3
|
type SelectDesktopProps<TKey extends Key = Key> = SelectBaseProps<TKey>;
|
|
4
|
-
export declare const SelectDesktop: <TKey extends Key = Key>({ ref, error, ignoreTriggerWidth, showSelectionContent, inputClassName, containerClassName,
|
|
4
|
+
export declare const SelectDesktop: <TKey extends Key = Key>({ ref, error, ignoreTriggerWidth, showSelectionContent, inputClassName, containerClassName, customTrigger, onBlur, ...props }: SelectDesktopProps<TKey>) => import("react/jsx-runtime").JSX.Element;
|
|
5
5
|
export {};
|