@povio/ui 2.2.9-rc.25 → 2.2.9-rc.26

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.
@@ -3,7 +3,7 @@ import { FocusEvent, Ref } from 'react';
3
3
  import { FieldValues } from 'react-hook-form';
4
4
  import { DatePickerStateOptions } from 'react-stately';
5
5
  import { DatePickerInputHandle } from '../shared/DatePickerInput';
6
- import { DatePickerTodayIcon, DatePickerTodayIconButtonSize } from '../shared/datePicker.types';
6
+ import { DatePickerTodayIcon, DatePickerTodayIconButtonSize, DatePickerTodayIconPlacement } from '../shared/datePicker.types';
7
7
  import { FormFieldProps } from '../../FormField/FormField';
8
8
  import { ControlProps } from '../../shared/form.types';
9
9
  import { InputVariantProps } from '../../shared/input.cva';
@@ -14,6 +14,7 @@ interface DatePickerBaseProps extends FormFieldProps, InputVariantProps, Omit<Da
14
14
  className?: string;
15
15
  todayIcon?: DatePickerTodayIcon;
16
16
  todayIconButtonSize?: DatePickerTodayIconButtonSize;
17
+ todayIconPlacement?: DatePickerTodayIconPlacement;
17
18
  isDirty?: boolean;
18
19
  disableManualEntry?: boolean;
19
20
  autoFixYear?: boolean;
@@ -24,7 +24,7 @@ import { useCalendarState, useDatePickerState } from "react-stately";
24
24
  var PLACEHOLDER_VALUE = new CalendarDate(2024, 1, 1);
25
25
  var DatePickerBase = (props) => {
26
26
  const ui = UIConfig.useConfig();
27
- const { ref, label, tooltipText, helperText, isRequired, rightContent, isDirty, isDisabled, headerClassName, errorClassName, isHeaderHidden, error, onChange, onBlur, value, disableDropdown, className, placeholder, inputClassName, as = ui.input.as, hideLabel = ui.input.hideLabel, variant = ui.input.variant, 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;
27
+ const { ref, label, tooltipText, helperText, isRequired, rightContent, isDirty, isDisabled, headerClassName, errorClassName, isHeaderHidden, error, onChange, onBlur, value, disableDropdown, className, placeholder, inputClassName, as = ui.input.as, hideLabel = ui.input.hideLabel, variant = ui.input.variant, size = ui.input.size, isClearable = ui.input.isClearable, todayIcon = ui.dateInput.todayIcon, todayIconButtonSize = ui.dateInput.todayIconButtonSize, todayIconPlacement = ui.dateInput.todayIconPlacement, shouldForceLeadingZeros = ui.dateInput.shouldForceLeadingZeros, disableManualEntry = ui.dateInput.disableManualEntry, autoFixYear = ui.dateInput.autoFixYear, ...rest } = props;
28
28
  const formFieldProps = {
29
29
  error,
30
30
  label,
@@ -144,6 +144,7 @@ var DatePickerBase = (props) => {
144
144
  headerProps,
145
145
  todayIcon,
146
146
  todayIconButtonSize,
147
+ todayIconPlacement,
147
148
  onOpenDropdown: () => state.toggle(),
148
149
  placeholder,
149
150
  className: inputClassName
@@ -4,7 +4,7 @@ import { DateValue } from 'react-aria';
4
4
  import { FieldValues } from 'react-hook-form';
5
5
  import { DateRangePickerStateOptions } from 'react-stately';
6
6
  import { DatePickerInputHandle } from '../shared/DatePickerInput';
7
- import { DatePickerTodayIcon, DatePickerTodayIconButtonSize } from '../shared/datePicker.types';
7
+ import { DatePickerTodayIcon, DatePickerTodayIconButtonSize, DatePickerTodayIconPlacement } from '../shared/datePicker.types';
8
8
  import { FormFieldProps } from '../../FormField/FormField';
9
9
  import { ControlProps } from '../../shared/form.types';
10
10
  import { InputVariantProps } from '../../shared/input.cva';
@@ -16,6 +16,7 @@ interface DateRangePickerBaseProps extends FormFieldProps, InputVariantProps, Om
16
16
  className?: string;
17
17
  todayIcon?: DatePickerTodayIcon;
18
18
  todayIconButtonSize?: DatePickerTodayIconButtonSize;
19
+ todayIconPlacement?: DatePickerTodayIconPlacement;
19
20
  isDirty?: boolean;
20
21
  disableManualEntry?: boolean;
21
22
  autoFixYear?: boolean;
@@ -28,7 +28,7 @@ import { useDateRangePickerState, useRangeCalendarState } from "react-stately";
28
28
  var DateRangePickerBase = (props) => {
29
29
  const ui = UIConfig.useConfig();
30
30
  const { t } = useTranslation();
31
- const { ref, label, tooltipText, helperText, isRequired, rightContent, isDisabled, isDirty, headerClassName, errorClassName, isHeaderHidden, error, onChange, onBlur, value, disableDropdown, className, hideSidebar, 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;
31
+ const { ref, label, tooltipText, helperText, isRequired, rightContent, isDisabled, isDirty, headerClassName, errorClassName, isHeaderHidden, error, onChange, onBlur, value, disableDropdown, className, hideSidebar, 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, todayIconPlacement = ui.dateInput.todayIconPlacement, shouldForceLeadingZeros = ui.dateInput.shouldForceLeadingZeros, disableManualEntry = ui.dateInput.disableManualEntry, autoFixYear = ui.dateInput.autoFixYear, ...rest } = props;
32
32
  const [validationRangeError, setValidationRangeError] = useState();
33
33
  const datePickerInputRef = useRef(null);
34
34
  const dateRangePickerRef = useMemo(() => ({ get current() {
@@ -489,6 +489,7 @@ var DateRangePickerBase = (props) => {
489
489
  headerProps,
490
490
  todayIcon,
491
491
  todayIconButtonSize,
492
+ todayIconPlacement,
492
493
  isDirty,
493
494
  disableManualEntry,
494
495
  autoFixYear,
@@ -3,7 +3,7 @@ import { DateValue } from 'react-aria';
3
3
  import { FieldValues } from 'react-hook-form';
4
4
  import { DatePickerStateOptions } from 'react-stately';
5
5
  import { DatePickerInputHandle } from '../shared/DatePickerInput';
6
- import { DatePickerTodayIcon, DatePickerTodayIconButtonSize } from '../shared/datePicker.types';
6
+ import { DatePickerTodayIcon, DatePickerTodayIconButtonSize, DatePickerTodayIconPlacement } from '../shared/datePicker.types';
7
7
  import { FormFieldProps } from '../../FormField/FormField';
8
8
  import { ControlProps } from '../../shared/form.types';
9
9
  import { InputVariantProps } from '../../shared/input.cva';
@@ -14,6 +14,7 @@ interface DateTimePickerBaseProps extends FormFieldProps, InputVariantProps, Omi
14
14
  isClearable?: boolean;
15
15
  todayIcon?: DatePickerTodayIcon;
16
16
  todayIconButtonSize?: DatePickerTodayIconButtonSize;
17
+ todayIconPlacement?: DatePickerTodayIconPlacement;
17
18
  isDirty?: boolean;
18
19
  disableManualEntry?: boolean;
19
20
  autoFixYear?: boolean;
@@ -21,7 +21,7 @@ import { useCalendarState, useDatePickerState } from "react-stately";
21
21
  //#region src/components/inputs/DateTime/DateTimePicker/DateTimePicker.tsx
22
22
  var DateTimePickerBase = (props) => {
23
23
  const ui = UIConfig.useConfig();
24
- 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;
24
+ 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, todayIconPlacement = ui.dateInput.todayIconPlacement, shouldForceLeadingZeros = ui.dateInput.shouldForceLeadingZeros, disableManualEntry = ui.dateInput.disableManualEntry, autoFixYear = ui.dateInput.autoFixYear, setDateValueOnDateSelection = ui.dateInput.setDateValueOnDateSelection, ...rest } = props;
25
25
  const formFieldProps = {
26
26
  error,
27
27
  label,
@@ -158,6 +158,7 @@ var DateTimePickerBase = (props) => {
158
158
  headerProps,
159
159
  todayIcon,
160
160
  todayIconButtonSize,
161
+ todayIconPlacement,
161
162
  isRequired,
162
163
  disableManualEntry,
163
164
  autoFixYear,
@@ -1,4 +1,5 @@
1
1
  import { DateSegmentItem } from "./DateSegmentItem.js";
2
+ import { getTimeSegmentValue } from "./dateSegment.utils.js";
2
3
  import { jsx } from "react/jsx-runtime";
3
4
  import { clsx } from "clsx";
4
5
  import { useEffect, useImperativeHandle, useRef } from "react";
@@ -31,16 +32,8 @@ var DateField = ({ ref, onClearChange, hidePlaceholder, isDisabled, disableManua
31
32
  const isDayFilled = daySegment && !daySegment.isPlaceholder;
32
33
  const isYearEmpty = yearSegment && !(parseInt(yearSegment.text) && yearSegment.text?.length === 4);
33
34
  const isHourEmpty = hourSegment && !parseInt(hourSegment.text);
34
- if (minuteSegment && !parseInt(minuteSegment.text)) {
35
- let minute = minuteSegment?.value || 0;
36
- if (minuteSegment?.text?.length && minuteSegment?.text?.length > 0) minute = parseInt(minuteSegment?.text ?? "00");
37
- state.setSegment("minute", minute);
38
- }
39
- if (isHourEmpty) {
40
- let hour = hourSegment?.value || 0;
41
- if (hourSegment?.text?.length && hourSegment?.text?.length > 0) hour = parseInt(hourSegment?.text ?? "00");
42
- state.setSegment("hour", hour);
43
- }
35
+ if (minuteSegment && !parseInt(minuteSegment.text)) state.setSegment("minute", getTimeSegmentValue(minuteSegment));
36
+ if (isHourEmpty) state.setSegment("hour", getTimeSegmentValue(hourSegment));
44
37
  if (isMonthFilled && isDayFilled && isYearEmpty) {
45
38
  let year = (/* @__PURE__ */ new Date()).getFullYear();
46
39
  if (yearSegment?.text?.length && yearSegment?.text?.length === 2) year = parseInt(`20${yearSegment?.text}`);
@@ -1,6 +1,6 @@
1
1
  import { Ref } from 'react';
2
2
  import { DatePickerAria } from 'react-aria';
3
- import { DatePickerTodayIcon, DatePickerTodayIconButtonSize } from './datePicker.types';
3
+ import { DatePickerTodayIcon, DatePickerTodayIconButtonSize, DatePickerTodayIconPlacement } from './datePicker.types';
4
4
  import { FormFieldHeaderProps } from '../../FormField/FormFieldHeader';
5
5
  import { InputVariantProps } from '../../shared/input.cva';
6
6
  export interface DatePickerInputHandle {
@@ -21,6 +21,7 @@ interface DatePickerInputProps extends InputVariantProps {
21
21
  headerProps?: FormFieldHeaderProps;
22
22
  todayIcon?: DatePickerTodayIcon;
23
23
  todayIconButtonSize?: DatePickerTodayIconButtonSize;
24
+ todayIconPlacement?: DatePickerTodayIconPlacement;
24
25
  isDirty?: boolean;
25
26
  isRequired?: boolean;
26
27
  disableManualEntry?: boolean;
@@ -29,5 +30,5 @@ interface DatePickerInputProps extends InputVariantProps {
29
30
  className?: string;
30
31
  onOpenDropdown?: () => void;
31
32
  }
32
- export declare const DatePickerInput: ({ ref, as, groupProps, fieldProps, endFieldProps, buttonProps, isDisabled, isInvalid, disableDropdown, variant, size, isDateTime, isClearable, headerProps, todayIcon, todayIconButtonSize, isDirty, isRequired, disableManualEntry, autoFixYear, placeholder, className, onOpenDropdown, ...props }: DatePickerInputProps) => import("react/jsx-runtime").JSX.Element;
33
+ export declare const DatePickerInput: ({ ref, as, groupProps, fieldProps, endFieldProps, buttonProps, isDisabled, isInvalid, disableDropdown, variant, size, isDateTime, isClearable, headerProps, todayIcon, todayIconButtonSize, todayIconPlacement, isDirty, isRequired, disableManualEntry, autoFixYear, placeholder, className, onOpenDropdown, ...props }: DatePickerInputProps) => import("react/jsx-runtime").JSX.Element;
33
34
  export {};
@@ -15,7 +15,7 @@ import { Button } from "react-aria-components";
15
15
  import { useFocusVisible, useFocusWithin, useHover } from "react-aria";
16
16
  import { getLocalTimeZone, now, toCalendarDateTime, today } from "@internationalized/date";
17
17
  //#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, todayIconButtonSize = "none", isDirty, isRequired, disableManualEntry, autoFixYear = false, placeholder, className, onOpenDropdown, ...props }) => {
18
+ var DatePickerInput = ({ ref, as, groupProps, fieldProps, endFieldProps, buttonProps, isDisabled, isInvalid, disableDropdown, variant, size, isDateTime, isClearable, headerProps, todayIcon, todayIconButtonSize = "none", todayIconPlacement = "content", isDirty, isRequired, disableManualEntry, autoFixYear = false, placeholder, className, onOpenDropdown, ...props }) => {
19
19
  const uiConfig = UIConfig.useConfig();
20
20
  const inputBaseCva = UIStyle.useCva("input.baseCva", inputBase);
21
21
  const inputSizeCva = UIStyle.useCva("input.sizeCva", inputSize);
@@ -72,6 +72,14 @@ var DatePickerInput = ({ ref, as, groupProps, fieldProps, endFieldProps, buttonP
72
72
  };
73
73
  const hidePlaceholder = as === "floating" && !fieldProps.value && !isFocused;
74
74
  const todayIconComponent = getDatePickerTodayIcon(todayIcon);
75
+ const todayIconButton = todayIconComponent ? /* @__PURE__ */ jsx(InlineIconButton, {
76
+ label: "",
77
+ icon: todayIconComponent,
78
+ size: todayIconButtonSize,
79
+ onPress: onToday,
80
+ className: "relative z-1 !border-none"
81
+ }) : null;
82
+ const shouldRenderTodayIconWithFieldLabel = todayIconPlacement === "fieldLabel";
75
83
  const pickerIcon = isDateTime ? uiConfig.dateInput.dateTimeIcon : uiConfig.dateInput.calendarIcon;
76
84
  return /* @__PURE__ */ jsxs("div", {
77
85
  ref: containerRef,
@@ -101,50 +109,48 @@ var DatePickerInput = ({ ref, as, groupProps, fieldProps, endFieldProps, buttonP
101
109
  size,
102
110
  as
103
111
  })),
104
- children: [as && ["filter", "floating"].includes(as) && headerProps && /* @__PURE__ */ jsx(FormFieldLabel, {
105
- as,
106
- ...headerProps
107
- }), /* @__PURE__ */ jsxs("div", {
108
- className: datePickerInputContentRowCva({ size }),
109
- children: [
110
- disableManualEntry && /* @__PURE__ */ jsx(Button, {
111
- onPress: onOpenDropdown,
112
- className: "absolute inset-0 z-0",
113
- isDisabled
114
- }),
115
- todayIconComponent && /* @__PURE__ */ jsx(InlineIconButton, {
116
- label: "",
117
- icon: todayIconComponent,
118
- size: todayIconButtonSize,
119
- onPress: onToday,
120
- className: "relative z-1 !border-none"
121
- }),
122
- disableManualEntry && placeholder && !fieldProps.value ? /* @__PURE__ */ jsx(Typography, {
123
- size: "label-1",
124
- className: "text-text-default-3",
125
- children: placeholder
126
- }) : /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(DateField, {
127
- ref: dateFieldRef,
128
- ...fieldProps,
129
- isDisabled,
130
- isInvalid,
131
- onClearChange,
132
- hidePlaceholder,
133
- disableManualEntry
134
- }), endFieldProps && /* @__PURE__ */ jsxs(Fragment, { children: [!((as === "floating" || as === "filter") && hidePlaceholder) && /* @__PURE__ */ jsx("span", {
135
- className: clsx("pointer-events-none select-none", isDisabled && "text-interactive-text-secondary-disabled"),
136
- children: "–"
137
- }), /* @__PURE__ */ jsx(DateField, {
138
- ref: endDateFieldRef,
139
- ...endFieldProps,
140
- isDisabled,
141
- isInvalid,
142
- onClearChange,
143
- hidePlaceholder,
144
- disableManualEntry
145
- })] })] })
146
- ]
147
- })]
112
+ children: [
113
+ as && ["filter", "floating"].includes(as) && headerProps && /* @__PURE__ */ jsx(FormFieldLabel, {
114
+ as,
115
+ ...headerProps
116
+ }),
117
+ shouldRenderTodayIconWithFieldLabel && todayIconButton,
118
+ /* @__PURE__ */ jsxs("div", {
119
+ className: datePickerInputContentRowCva({ size }),
120
+ children: [
121
+ disableManualEntry && /* @__PURE__ */ jsx(Button, {
122
+ onPress: onOpenDropdown,
123
+ className: "absolute inset-0 z-0",
124
+ isDisabled
125
+ }),
126
+ !shouldRenderTodayIconWithFieldLabel && todayIconButton,
127
+ disableManualEntry && placeholder && !fieldProps.value ? /* @__PURE__ */ jsx(Typography, {
128
+ size: "label-1",
129
+ className: "text-text-default-3",
130
+ children: placeholder
131
+ }) : /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(DateField, {
132
+ ref: dateFieldRef,
133
+ ...fieldProps,
134
+ isDisabled,
135
+ isInvalid,
136
+ onClearChange,
137
+ hidePlaceholder,
138
+ disableManualEntry
139
+ }), endFieldProps && /* @__PURE__ */ jsxs(Fragment, { children: [!((as === "floating" || as === "filter") && hidePlaceholder) && /* @__PURE__ */ jsx("span", {
140
+ className: clsx("pointer-events-none select-none", isDisabled && "text-interactive-text-secondary-disabled"),
141
+ children: "–"
142
+ }), /* @__PURE__ */ jsx(DateField, {
143
+ ref: endDateFieldRef,
144
+ ...endFieldProps,
145
+ isDisabled,
146
+ isInvalid,
147
+ onClearChange,
148
+ hidePlaceholder,
149
+ disableManualEntry
150
+ })] })] })
151
+ ]
152
+ })
153
+ ]
148
154
  }), /* @__PURE__ */ jsxs("div", {
149
155
  className: clsx(inputSizeCva({
150
156
  size,
@@ -1,3 +1,4 @@
1
1
  import { IconButtonProps } from '../../../buttons/IconButton/IconButton';
2
2
  export type DatePickerTodayIcon = boolean | IconButtonProps["icon"];
3
3
  export type DatePickerTodayIconButtonSize = IconButtonProps["size"];
4
+ export type DatePickerTodayIconPlacement = "content" | "fieldLabel";
@@ -0,0 +1,2 @@
1
+ import { DateSegment } from '@react-stately/datepicker';
2
+ export declare const getTimeSegmentValue: (segment: DateSegment | undefined, fallbackValue?: number) => number;
@@ -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 };
@@ -1,10 +1,10 @@
1
- import { GroupedSelectControlProps, GroupedSelectProps, SelectItem } from '../shared/select.types';
2
- import { SelectBaseProps } from '../shared/SelectBase';
1
+ import { DefaultInitialSelectItem, GroupedSelectControlProps, GroupedSelectProps, SelectItem } from '../shared/select.types';
2
+ import { SelectProps } from './Select';
3
3
  import { QueryDataType, QueryFn } from '../shared/querySelect.utils';
4
4
  import { OmitDiscriminatedUnion } from '../../../../types/common';
5
5
  import { Key } from 'react-aria-components';
6
6
  import { FieldValues } from 'react-hook-form';
7
- export type QuerySelectProps<TFieldValues extends FieldValues, TQueryFn extends QueryFn, TKey extends Key = Key> = OmitDiscriminatedUnion<SelectBaseProps<TKey>, "items" | "isLoading" | keyof GroupedSelectProps> & GroupedSelectControlProps<TFieldValues, TKey> & {
7
+ export type QuerySelectProps<TFieldValues extends FieldValues, TQueryFn extends QueryFn, TKey extends Key = Key, TInitialSelectItem = DefaultInitialSelectItem<TKey>> = OmitDiscriminatedUnion<SelectProps<TKey, TInitialSelectItem>, "items" | "totalItems" | keyof GroupedSelectProps> & GroupedSelectControlProps<TFieldValues, TKey, TInitialSelectItem> & {
8
8
  query: TQueryFn;
9
9
  queryParams?: Parameters<TQueryFn>[0];
10
10
  queryOptions?: Parameters<TQueryFn>[1];
@@ -1,10 +1,8 @@
1
1
  import { UIConfig } from "../../../../config/uiConfig.context.js";
2
- import { SelectBase } from "../shared/SelectBase.js";
2
+ import { Select } from "./Select.js";
3
3
  import { getQueryItems } from "../shared/querySelect.utils.js";
4
4
  import { useQueryAutocomplete } from "../../../../hooks/useQueryAutocomplete.js";
5
5
  import { jsx } from "react/jsx-runtime";
6
- import { mergeRefs } from "@react-aria/utils";
7
- import { Controller } from "react-hook-form";
8
6
  //#region src/components/inputs/Selection/Select/QuerySelect.tsx
9
7
  var QuerySelect = ({ query, queryParams, queryOptions, queryMap, ...props }) => {
10
8
  const ui = UIConfig.useConfig();
@@ -15,41 +13,14 @@ var QuerySelect = ({ query, queryParams, queryOptions, queryMap, ...props }) =>
15
13
  mapItems: (data) => getQueryItems(data, queryMap),
16
14
  initialQueryState: props.isInitialQueryDisabled ?? ui.querySelect?.isInitialQueryDisabled
17
15
  });
18
- if ("formControl" in props && props.formControl) {
19
- const { formControl, ref, isInitialQueryDisabled: _, ...innerProps } = props;
20
- return /* @__PURE__ */ jsx(Controller, {
21
- control: formControl.control,
22
- name: formControl.name,
23
- render: ({ field, fieldState: { error, isDirty } }) => /* @__PURE__ */ jsx(SelectBase, {
24
- ...innerProps,
25
- ref: mergeRefs(ref, field.ref),
26
- items,
27
- isLoading,
28
- totalItems,
29
- hasLoadMore: hasNextPage,
30
- onLoadMore: fetchNextPage,
31
- value: field.value,
32
- onChange: (value) => {
33
- field.onChange(value);
34
- field.onBlur?.();
35
- },
36
- onBlur: field.onBlur,
37
- isDirty,
38
- isDisabled: field.disabled || props.isDisabled,
39
- error: props.error ?? error?.message,
40
- onMouseEnter: handleEnableQuery,
41
- onFocusCapture: handleEnableQuery
42
- })
43
- });
44
- }
45
- const { isInitialQueryDisabled: _, ...restProps } = props;
46
- return /* @__PURE__ */ jsx(SelectBase, {
47
- ...restProps,
16
+ const { isInitialQueryDisabled: _, ...selectProps } = props;
17
+ return /* @__PURE__ */ jsx(Select, {
18
+ ...selectProps,
48
19
  items,
49
20
  isLoading,
50
21
  totalItems,
51
22
  hasLoadMore: hasNextPage,
52
- onLoadMore: fetchNextPage ? () => void fetchNextPage() : void 0,
23
+ onLoadMore: fetchNextPage,
53
24
  onMouseEnter: handleEnableQuery,
54
25
  onFocusCapture: handleEnableQuery
55
26
  });
@@ -34,7 +34,7 @@ export declare namespace UIConfig {
34
34
  };
35
35
  toggle: Pick<ToggleProps, "variant">;
36
36
  slider: Pick<SliderProps, "minValue" | "maxValue">;
37
- dateInput: Pick<DatePickerProps, "todayIcon" | "todayIconButtonSize" | "shouldForceLeadingZeros" | "disableManualEntry" | "autoFixYear"> & {
37
+ dateInput: Pick<DatePickerProps, "todayIcon" | "todayIconButtonSize" | "todayIconPlacement" | "shouldForceLeadingZeros" | "disableManualEntry" | "autoFixYear"> & {
38
38
  calendarIcon?: ReactElement;
39
39
  dateTimeIcon?: ReactElement;
40
40
  timeIcon?: ReactElement;
@@ -48,6 +48,7 @@ var UIConfig;
48
48
  dateInput: {
49
49
  todayIcon: false,
50
50
  todayIconButtonSize: "none",
51
+ todayIconPlacement: "content",
51
52
  shouldForceLeadingZeros: false,
52
53
  disableManualEntry: false,
53
54
  autoFixYear: false,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@povio/ui",
3
- "version": "2.2.9-rc.25",
3
+ "version": "2.2.9-rc.26",
4
4
  "type": "module",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/index.d.ts",