@povio/ui 2.2.9-rc.2 → 2.2.9-rc.20
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/InlineIconButton/InlineIconButton.d.ts +1 -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 +9 -4
- package/dist/components/inputs/DateTime/DatePicker/DatePicker.js +96 -9
- package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.d.ts +9 -4
- package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.js +114 -7
- package/dist/components/inputs/DateTime/DateTimePicker/DateTimePicker.d.ts +10 -4
- package/dist/components/inputs/DateTime/DateTimePicker/DateTimePicker.js +91 -7
- package/dist/components/inputs/DateTime/TimePicker/TimePicker.d.ts +5 -3
- package/dist/components/inputs/DateTime/TimePicker/TimePicker.js +80 -6
- 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/DatePickerInput.d.ts +5 -2
- package/dist/components/inputs/DateTime/shared/DatePickerInput.js +21 -12
- package/dist/components/inputs/DateTime/shared/TimePickerInput.js +7 -3
- package/dist/components/inputs/DateTime/shared/datePicker.types.d.ts +3 -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 +20 -0
- package/dist/components/inputs/FormField/FormField.d.ts +3 -3
- package/dist/components/inputs/FormField/FormFieldHeader.js +3 -1
- 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 +92 -8
- package/dist/components/inputs/Input/TextInput/TextInput.d.ts +3 -1
- package/dist/components/inputs/Input/TextInput/TextInput.js +95 -8
- package/dist/components/inputs/Inputs/InputItem.d.ts +14 -18
- package/dist/components/inputs/RadioGroup/RadioGroup.js +17 -9
- package/dist/components/inputs/RadioGroup/radio.cva.d.ts +3 -0
- package/dist/components/inputs/RadioGroup/radio.cva.js +2 -1
- package/dist/components/inputs/Selection/Autocomplete/Autocomplete.d.ts +6 -2
- package/dist/components/inputs/Selection/Autocomplete/Autocomplete.js +86 -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 +1 -2
- package/dist/components/inputs/Selection/Select/QuerySelect.js +5 -3
- package/dist/components/inputs/Selection/Select/Select.d.ts +7 -3
- package/dist/components/inputs/Selection/Select/Select.js +84 -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 +12 -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 +22 -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 +35 -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/StaticInput.d.ts +34 -0
- package/dist/components/inputs/shared/StaticInput.js +88 -0
- package/dist/components/inputs/shared/TooltipWrapper.js +5 -1
- package/dist/components/inputs/shared/input.cva.d.ts +5 -0
- package/dist/components/inputs/shared/input.cva.js +10 -1
- package/dist/components/inputs/shared/tooltipWrapper.cva.d.ts +4 -0
- package/dist/components/inputs/shared/tooltipWrapper.cva.js +5 -0
- package/dist/config/uiConfig.context.d.ts +8 -2
- package/dist/config/uiConfig.context.js +11 -1
- package/dist/config/uiStyle.context.d.ts +19 -3
- package/dist/helpers/dynamicInputs.d.ts +5 -5
- package/dist/helpers/dynamicInputs.js +3 -0
- 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 +13 -3
- package/dist/index.d.ts +5 -0
- package/dist/index.js +3 -2
- package/dist/utils/date-time.utils.d.ts +10 -0
- package/dist/utils/date-time.utils.js +87 -1
- package/dist/utils/query.utils.d.ts +4 -0
- package/dist/utils/query.utils.js +8 -0
- package/package.json +1 -1
|
@@ -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,20 @@
|
|
|
1
|
+
import { UIStyle } from "../../../../config/uiStyle.context.js";
|
|
2
|
+
import { buttonIconSize } from "../../../buttons/Button/button.cva.js";
|
|
3
|
+
import { TodayIcon } from "../../../../assets/icons/Today.js";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
import { clsx } from "clsx";
|
|
6
|
+
import { isValidElement } from "react";
|
|
7
|
+
//#region src/components/inputs/DateTime/shared/datePickerTodayIcon.tsx
|
|
8
|
+
var getDatePickerTodayIcon = (todayIcon) => {
|
|
9
|
+
if (!todayIcon) return null;
|
|
10
|
+
return todayIcon === true ? TodayIcon : todayIcon;
|
|
11
|
+
};
|
|
12
|
+
var renderDatePickerTodayIcon = (todayIcon, size = "none", className) => {
|
|
13
|
+
const buttonIconSizeCva = UIStyle.useCva("button.iconSize", buttonIconSize);
|
|
14
|
+
const icon = getDatePickerTodayIcon(todayIcon);
|
|
15
|
+
if (!icon) return;
|
|
16
|
+
if (isValidElement(icon)) return icon;
|
|
17
|
+
return /* @__PURE__ */ jsx(icon, { className: clsx(buttonIconSizeCva({ size }), "text-interactive-text-secondary-idle", className) });
|
|
18
|
+
};
|
|
19
|
+
//#endregion
|
|
20
|
+
export { getDatePickerTodayIcon, renderDatePickerTodayIcon };
|
|
@@ -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,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", {
|
|
@@ -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 {};
|
|
@@ -1,23 +1,25 @@
|
|
|
1
1
|
import { UIStyle } from "../../../../config/uiStyle.context.js";
|
|
2
|
+
import { Loader } from "../../../status/Loader/Loader.js";
|
|
2
3
|
import { UIConfig } from "../../../../config/uiConfig.context.js";
|
|
3
4
|
import { inputBase } from "../../shared/input.cva.js";
|
|
4
5
|
import { FormField } from "../../FormField/FormField.js";
|
|
6
|
+
import { StaticInput } from "../../shared/StaticInput.js";
|
|
5
7
|
import { TooltipWrapper } from "../../shared/TooltipWrapper.js";
|
|
6
8
|
import { InputContent } from "../shared/InputContent.js";
|
|
7
|
-
import { jsx } from "react/jsx-runtime";
|
|
9
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
8
10
|
import { clsx } from "clsx";
|
|
9
|
-
import { useCallback, useRef } from "react";
|
|
11
|
+
import { isValidElement, useCallback, useEffect, useRef, useState } from "react";
|
|
10
12
|
import { Input, useLocale } from "react-aria-components";
|
|
11
13
|
import { useFocusVisible, useNumberField } from "react-aria";
|
|
12
14
|
import { mergeRefs } from "@react-aria/utils";
|
|
13
|
-
import { Controller } from "react-hook-form";
|
|
15
|
+
import { Controller, useWatch } from "react-hook-form";
|
|
14
16
|
import { useNumberFieldState } from "react-stately";
|
|
15
17
|
//#region src/components/inputs/Input/NumberInput/NumberInput.tsx
|
|
16
18
|
var NumberInputBase = (props) => {
|
|
17
19
|
const ui = UIConfig.useConfig();
|
|
18
20
|
const inputBaseCva = UIStyle.useCva("input.baseCva", inputBase);
|
|
19
21
|
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;
|
|
22
|
+
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
23
|
const numberFieldRef = useRef(null);
|
|
22
24
|
const { isFocusVisible } = useFocusVisible();
|
|
23
25
|
const { locale } = useLocale();
|
|
@@ -34,6 +36,10 @@ var NumberInputBase = (props) => {
|
|
|
34
36
|
formatOptions
|
|
35
37
|
};
|
|
36
38
|
const { labelProps, inputProps } = useNumberField(numberProps, useNumberFieldState(numberProps), numberFieldRef);
|
|
39
|
+
useEffect(() => {
|
|
40
|
+
if (!autoFocusOnMount || isDisabled) return;
|
|
41
|
+
requestAnimationFrame(() => inputRef.current?.focus());
|
|
42
|
+
}, [autoFocusOnMount, isDisabled]);
|
|
37
43
|
const formFieldProps = {
|
|
38
44
|
error,
|
|
39
45
|
label,
|
|
@@ -114,7 +120,80 @@ var NumberInputBase = (props) => {
|
|
|
114
120
|
})
|
|
115
121
|
});
|
|
116
122
|
};
|
|
117
|
-
var
|
|
123
|
+
var renderIconVisual = (icon) => {
|
|
124
|
+
if (!icon) return null;
|
|
125
|
+
if (isValidElement(icon)) return icon;
|
|
126
|
+
return /* @__PURE__ */ jsx(icon, { className: "size-6 text-interactive-text-secondary-idle" });
|
|
127
|
+
};
|
|
128
|
+
var NumberInput = ({ renderStaticInput, ...props }) => {
|
|
129
|
+
const ui = UIConfig.useConfig();
|
|
130
|
+
const { locale } = useLocale();
|
|
131
|
+
const [renderInput, setRenderInput] = useState(!(renderStaticInput ?? ui.renderStaticInput));
|
|
132
|
+
const [shouldFocus, setShouldFocus] = useState(false);
|
|
133
|
+
const inputRef = useRef(null);
|
|
134
|
+
const watchedValue = "formControl" in props && props.formControl ? useWatch({
|
|
135
|
+
control: props.formControl.control,
|
|
136
|
+
name: props.formControl.name
|
|
137
|
+
}) : props.value;
|
|
138
|
+
let isFormControlDisabled = false;
|
|
139
|
+
if ("formControl" in props && props.formControl) isFormControlDisabled = !!props.formControl.control._options?.disabled;
|
|
140
|
+
useEffect(() => {
|
|
141
|
+
if (!renderInput || !shouldFocus) return;
|
|
142
|
+
requestAnimationFrame(() => inputRef.current?.focus());
|
|
143
|
+
setShouldFocus(false);
|
|
144
|
+
}, [renderInput, shouldFocus]);
|
|
145
|
+
if (!renderInput) {
|
|
146
|
+
const staticValue = watchedValue ?? props.value ?? props.defaultValue;
|
|
147
|
+
const formatOptions = props.formatOptions ?? ui.numberInput.formatOptions;
|
|
148
|
+
const displayValue = staticValue == null ? "" : new Intl.NumberFormat(locale, formatOptions).format(staticValue);
|
|
149
|
+
const hasValue = displayValue !== "";
|
|
150
|
+
const as = props.as ?? ui.input.as;
|
|
151
|
+
const size = props.size ?? ui.input.size;
|
|
152
|
+
const variant = props.variant ?? ui.input.variant;
|
|
153
|
+
const hideLabel = props.hideLabel ?? ui.input.hideLabel;
|
|
154
|
+
const isHeaderHidden = props.isHeaderHidden || as === "inline" || as === "filter" || as === "floating";
|
|
155
|
+
let isDisabled = !!props.isDisabled;
|
|
156
|
+
if (isFormControlDisabled) isDisabled = true;
|
|
157
|
+
const trailingContent = !!props.unit || !!props.isLoading || !!props.action && !props.isLoading || !!props.trailingIcon && !props.isLoading && !props.action ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
158
|
+
props.unit && /* @__PURE__ */ jsx("span", {
|
|
159
|
+
className: "text-label-2 text-text-default-3",
|
|
160
|
+
children: props.unit
|
|
161
|
+
}),
|
|
162
|
+
props.isLoading && /* @__PURE__ */ jsx(Loader, {}),
|
|
163
|
+
!props.isLoading && props.action && renderIconVisual(props.action.icon),
|
|
164
|
+
!props.isLoading && !props.action && props.trailingIcon && renderIconVisual(props.trailingIcon)
|
|
165
|
+
] }) : void 0;
|
|
166
|
+
return /* @__PURE__ */ jsx(StaticInput, {
|
|
167
|
+
...props,
|
|
168
|
+
onInteract: (focus) => {
|
|
169
|
+
setShouldFocus(focus);
|
|
170
|
+
setRenderInput(true);
|
|
171
|
+
},
|
|
172
|
+
as,
|
|
173
|
+
size,
|
|
174
|
+
variant,
|
|
175
|
+
hideLabel,
|
|
176
|
+
isHeaderHidden,
|
|
177
|
+
isDisabled,
|
|
178
|
+
className: clsx("group w-full", as === "inline" && "h-full", props.className),
|
|
179
|
+
inputClassName: props.inputClassName,
|
|
180
|
+
placeholder: as === "floating" || staticValue ? "" : props.placeholder,
|
|
181
|
+
displayValue,
|
|
182
|
+
isEmpty: !hasValue,
|
|
183
|
+
dataAttributes: {
|
|
184
|
+
dataIsEmpty: !!!staticValue,
|
|
185
|
+
dataIsFilled: !(`${staticValue}` === "" || staticValue === null || staticValue === void 0),
|
|
186
|
+
dataIsDirty: props.isDirty,
|
|
187
|
+
dataIsRequired: props.isRequired,
|
|
188
|
+
dataIsDisabled: isDisabled,
|
|
189
|
+
dataDisabled: isDisabled,
|
|
190
|
+
dataInvalid: !!props.error,
|
|
191
|
+
dataHasSelection: hasValue
|
|
192
|
+
},
|
|
193
|
+
leadingVisual: renderIconVisual(props.leadingIcon),
|
|
194
|
+
trailingContent
|
|
195
|
+
});
|
|
196
|
+
}
|
|
118
197
|
if ("formControl" in props && props.formControl) {
|
|
119
198
|
const { formControl, ref, ...innerProps } = props;
|
|
120
199
|
return /* @__PURE__ */ jsx(Controller, {
|
|
@@ -122,17 +201,22 @@ var NumberInput = (props) => {
|
|
|
122
201
|
name: formControl.name,
|
|
123
202
|
render: ({ field, fieldState: { error, isDirty } }) => /* @__PURE__ */ jsx(NumberInputBase, {
|
|
124
203
|
...innerProps,
|
|
125
|
-
ref: mergeRefs(ref, field.ref),
|
|
204
|
+
ref: mergeRefs(ref, field.ref, inputRef),
|
|
126
205
|
value: field.value,
|
|
127
206
|
onChange: field.onChange,
|
|
128
207
|
onBlur: field.onBlur,
|
|
129
208
|
isDirty,
|
|
130
209
|
isDisabled: field.disabled || props.isDisabled,
|
|
131
|
-
error: props.error ?? error?.message
|
|
210
|
+
error: props.error ?? error?.message,
|
|
211
|
+
autoFocusOnMount: shouldFocus
|
|
132
212
|
}, field.value === null || field.value === void 0 ? "empty" : "filled")
|
|
133
213
|
});
|
|
134
214
|
}
|
|
135
|
-
return /* @__PURE__ */ jsx(NumberInputBase, {
|
|
215
|
+
return /* @__PURE__ */ jsx(NumberInputBase, {
|
|
216
|
+
...props,
|
|
217
|
+
ref: mergeRefs(props.ref, inputRef),
|
|
218
|
+
autoFocusOnMount: shouldFocus
|
|
219
|
+
}, props.value === null || props.value === void 0 ? "empty" : "filled");
|
|
136
220
|
};
|
|
137
221
|
//#endregion
|
|
138
222
|
export { NumberInput };
|
|
@@ -13,9 +13,11 @@ interface TextInputBaseProps extends FormFieldProps, InputVariantProps, Omit<Inp
|
|
|
13
13
|
type?: AllowedHTMLInputTypeAttribute;
|
|
14
14
|
todayIcon?: boolean;
|
|
15
15
|
isDirty?: boolean;
|
|
16
|
+
autoFocusOnMount?: boolean;
|
|
16
17
|
}
|
|
17
18
|
export interface TextInputProps extends TextInputBaseProps {
|
|
19
|
+
renderStaticInput?: boolean;
|
|
18
20
|
}
|
|
19
21
|
export type ControlledTextInputProps<TFieldValues extends FieldValues> = ControlProps<TextInputProps, TFieldValues>;
|
|
20
|
-
export declare const TextInput: <TFieldValues extends FieldValues>(props: ControlledTextInputProps<TFieldValues>) => import("react/jsx-runtime").JSX.Element;
|
|
22
|
+
export declare const TextInput: <TFieldValues extends FieldValues>({ renderStaticInput, ...props }: ControlledTextInputProps<TFieldValues>) => import("react/jsx-runtime").JSX.Element;
|
|
21
23
|
export {};
|
|
@@ -1,22 +1,24 @@
|
|
|
1
1
|
import { UIStyle } from "../../../../config/uiStyle.context.js";
|
|
2
|
+
import { Loader } from "../../../status/Loader/Loader.js";
|
|
2
3
|
import { UIConfig } from "../../../../config/uiConfig.context.js";
|
|
3
4
|
import { inputBase } from "../../shared/input.cva.js";
|
|
4
5
|
import { FormField } from "../../FormField/FormField.js";
|
|
6
|
+
import { StaticInput } from "../../shared/StaticInput.js";
|
|
5
7
|
import { TooltipWrapper } from "../../shared/TooltipWrapper.js";
|
|
6
8
|
import { InputContent } from "../shared/InputContent.js";
|
|
7
|
-
import { jsx } from "react/jsx-runtime";
|
|
9
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
8
10
|
import { clsx } from "clsx";
|
|
9
|
-
import { useRef } from "react";
|
|
11
|
+
import { isValidElement, useEffect, useRef, useState } from "react";
|
|
10
12
|
import { Input } from "react-aria-components";
|
|
11
13
|
import { useFocusVisible, useTextField } from "react-aria";
|
|
12
14
|
import { mergeRefs } from "@react-aria/utils";
|
|
13
|
-
import { Controller } from "react-hook-form";
|
|
15
|
+
import { Controller, useWatch } from "react-hook-form";
|
|
14
16
|
//#region src/components/inputs/Input/TextInput/TextInput.tsx
|
|
15
17
|
var TextInputBase = (props) => {
|
|
16
18
|
const ui = UIConfig.useConfig();
|
|
17
19
|
const inputBaseCva = UIStyle.useCva("input.baseCva", inputBase);
|
|
18
20
|
const inputRef = useRef(null);
|
|
19
|
-
const { ref, inputClassName, label, tooltipText, helperText, isRequired, rightContent, isDisabled, isDirty, headerClassName, errorClassName, isHeaderHidden, error, className, unit, isLoading, action, leadingIcon, trailingIcon, value, onChange, onBlur, as = ui.input.as, hideLabel = ui.input.hideLabel, variant = ui.input.variant, size = ui.input.size, isClearable = ui.input.isClearable, ...rest } = props;
|
|
21
|
+
const { ref, inputClassName, label, tooltipText, helperText, isRequired, rightContent, isDisabled, isDirty, headerClassName, errorClassName, isHeaderHidden, error, className, unit, isLoading, action, leadingIcon, trailingIcon, value, onChange, onBlur, as = ui.input.as, hideLabel = ui.input.hideLabel, variant = ui.input.variant, size = ui.input.size, isClearable = ui.input.isClearable, autoFocusOnMount, ...rest } = props;
|
|
20
22
|
const textFieldRef = useRef(null);
|
|
21
23
|
const { isFocusVisible } = useFocusVisible();
|
|
22
24
|
const { labelProps, inputProps } = useTextField({
|
|
@@ -29,6 +31,10 @@ var TextInputBase = (props) => {
|
|
|
29
31
|
onChange,
|
|
30
32
|
onBlur
|
|
31
33
|
}, textFieldRef);
|
|
34
|
+
useEffect(() => {
|
|
35
|
+
if (!autoFocusOnMount || isDisabled) return;
|
|
36
|
+
requestAnimationFrame(() => inputRef.current?.focus());
|
|
37
|
+
}, [autoFocusOnMount, isDisabled]);
|
|
32
38
|
const formFieldProps = {
|
|
33
39
|
error,
|
|
34
40
|
label,
|
|
@@ -84,6 +90,8 @@ var TextInputBase = (props) => {
|
|
|
84
90
|
...rest
|
|
85
91
|
}), inputClassName),
|
|
86
92
|
onClick: () => inputRef.current?.focus(),
|
|
93
|
+
"data-is-empty": value === "" || value === null || value === void 0 || void 0,
|
|
94
|
+
"data-is-required": isRequired || void 0,
|
|
87
95
|
children: /* @__PURE__ */ jsx(InputContent, {
|
|
88
96
|
...inputContentProps,
|
|
89
97
|
headerProps,
|
|
@@ -109,7 +117,81 @@ var TextInputBase = (props) => {
|
|
|
109
117
|
})
|
|
110
118
|
});
|
|
111
119
|
};
|
|
112
|
-
var
|
|
120
|
+
var renderIconVisual = (icon) => {
|
|
121
|
+
if (!icon) return null;
|
|
122
|
+
if (isValidElement(icon)) return icon;
|
|
123
|
+
return /* @__PURE__ */ jsx(icon, { className: "size-6 text-interactive-text-secondary-idle" });
|
|
124
|
+
};
|
|
125
|
+
var TextInput = ({ renderStaticInput, ...props }) => {
|
|
126
|
+
const ui = UIConfig.useConfig();
|
|
127
|
+
const [renderInput, setRenderInput] = useState(!(renderStaticInput ?? ui.renderStaticInput));
|
|
128
|
+
const [shouldFocus, setShouldFocus] = useState(false);
|
|
129
|
+
const inputRef = useRef(null);
|
|
130
|
+
const watchedValue = "formControl" in props && props.formControl ? useWatch({
|
|
131
|
+
control: props.formControl.control,
|
|
132
|
+
name: props.formControl.name
|
|
133
|
+
}) : props.value;
|
|
134
|
+
let isFormControlDisabled = false;
|
|
135
|
+
if ("formControl" in props && props.formControl) isFormControlDisabled = !!props.formControl.control._options?.disabled;
|
|
136
|
+
const staticValue = watchedValue ?? props.value ?? props.defaultValue ?? "";
|
|
137
|
+
const inputType = props.type;
|
|
138
|
+
if (!renderInput && inputType === "password" && `${staticValue}`.length > 0) setRenderInput(true);
|
|
139
|
+
useEffect(() => {
|
|
140
|
+
if (!renderInput || !shouldFocus) return;
|
|
141
|
+
requestAnimationFrame(() => inputRef.current?.focus());
|
|
142
|
+
setShouldFocus(false);
|
|
143
|
+
}, [renderInput, shouldFocus]);
|
|
144
|
+
if (!renderInput) {
|
|
145
|
+
const as = props.as ?? ui.input.as;
|
|
146
|
+
const size = props.size ?? ui.input.size;
|
|
147
|
+
const variant = props.variant ?? ui.input.variant;
|
|
148
|
+
const hideLabel = props.hideLabel ?? ui.input.hideLabel;
|
|
149
|
+
const isHeaderHidden = props.isHeaderHidden || as === "inline" || as === "filter" || as === "floating";
|
|
150
|
+
let isDisabled = !!props.isDisabled;
|
|
151
|
+
if (isFormControlDisabled) isDisabled = true;
|
|
152
|
+
const maskedPasswordValue = inputType === "password" && `${staticValue}`.length > 0 ? "•".repeat(`${staticValue}`.length) : staticValue;
|
|
153
|
+
const displayValue = maskedPasswordValue == null ? "" : `${maskedPasswordValue}`;
|
|
154
|
+
const hasValue = displayValue !== "";
|
|
155
|
+
const trailingContent = !!props.unit || !!props.isLoading || !!props.action && !props.isLoading || !!props.trailingIcon && !props.isLoading && !props.action ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
156
|
+
props.unit && /* @__PURE__ */ jsx("span", {
|
|
157
|
+
className: "text-label-2 text-text-default-3",
|
|
158
|
+
children: props.unit
|
|
159
|
+
}),
|
|
160
|
+
props.isLoading && /* @__PURE__ */ jsx(Loader, {}),
|
|
161
|
+
!props.isLoading && props.action && renderIconVisual(props.action.icon),
|
|
162
|
+
!props.isLoading && !props.action && props.trailingIcon && renderIconVisual(props.trailingIcon)
|
|
163
|
+
] }) : void 0;
|
|
164
|
+
return /* @__PURE__ */ jsx(StaticInput, {
|
|
165
|
+
...props,
|
|
166
|
+
onInteract: (focus) => {
|
|
167
|
+
setShouldFocus(focus);
|
|
168
|
+
setRenderInput(true);
|
|
169
|
+
},
|
|
170
|
+
as,
|
|
171
|
+
size,
|
|
172
|
+
variant,
|
|
173
|
+
hideLabel,
|
|
174
|
+
isHeaderHidden,
|
|
175
|
+
isDisabled,
|
|
176
|
+
className: clsx("group w-full", as === "inline" && "h-full", props.className),
|
|
177
|
+
inputClassName: props.inputClassName,
|
|
178
|
+
placeholder: as === "floating" ? "" : props.placeholder,
|
|
179
|
+
displayValue,
|
|
180
|
+
isEmpty: !hasValue,
|
|
181
|
+
dataAttributes: {
|
|
182
|
+
dataIsEmpty: !hasValue,
|
|
183
|
+
dataIsFilled: hasValue,
|
|
184
|
+
dataIsDirty: props.isDirty,
|
|
185
|
+
dataIsRequired: props.isRequired,
|
|
186
|
+
dataIsDisabled: isDisabled,
|
|
187
|
+
dataDisabled: isDisabled,
|
|
188
|
+
dataInvalid: !!props.error,
|
|
189
|
+
dataHasSelection: hasValue
|
|
190
|
+
},
|
|
191
|
+
leadingVisual: renderIconVisual(props.leadingIcon),
|
|
192
|
+
trailingContent
|
|
193
|
+
});
|
|
194
|
+
}
|
|
113
195
|
if ("formControl" in props && props.formControl) {
|
|
114
196
|
const { formControl, ref, ...innerProps } = props;
|
|
115
197
|
return /* @__PURE__ */ jsx(Controller, {
|
|
@@ -117,17 +199,22 @@ var TextInput = (props) => {
|
|
|
117
199
|
name: formControl.name,
|
|
118
200
|
render: ({ field, fieldState: { error, isDirty } }) => /* @__PURE__ */ jsx(TextInputBase, {
|
|
119
201
|
...innerProps,
|
|
120
|
-
ref: mergeRefs(ref, field.ref),
|
|
202
|
+
ref: mergeRefs(ref, field.ref, inputRef),
|
|
121
203
|
value: field.value,
|
|
122
204
|
onChange: field.onChange,
|
|
123
205
|
onBlur: field.onBlur,
|
|
124
206
|
isDirty,
|
|
125
207
|
isDisabled: field.disabled || props.isDisabled,
|
|
126
|
-
error: props.error ?? error?.message
|
|
208
|
+
error: props.error ?? error?.message,
|
|
209
|
+
autoFocusOnMount: shouldFocus
|
|
127
210
|
})
|
|
128
211
|
});
|
|
129
212
|
}
|
|
130
|
-
return /* @__PURE__ */ jsx(TextInputBase, {
|
|
213
|
+
return /* @__PURE__ */ jsx(TextInputBase, {
|
|
214
|
+
...props,
|
|
215
|
+
ref: mergeRefs(props.ref, inputRef),
|
|
216
|
+
autoFocusOnMount: shouldFocus
|
|
217
|
+
});
|
|
131
218
|
};
|
|
132
219
|
//#endregion
|
|
133
220
|
export { TextInput };
|
|
@@ -1,30 +1,26 @@
|
|
|
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';
|
|
4
6
|
import { HasRequiredProperty } from '../../../types/common';
|
|
5
7
|
declare const componentRegistry: {
|
|
6
8
|
readonly toggle: <TFieldValues extends import('react-hook-form').FieldValues>(props: import('../Toggle/Toggle').ControlledToggleProps<TFieldValues>) => import("react/jsx-runtime").JSX.Element;
|
|
7
9
|
readonly checkbox: <TFieldValues extends import('react-hook-form').FieldValues>(props: import('../Checkbox/Checkbox').ControlledCheckboxProps<TFieldValues>) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
-
readonly numberInput: <TFieldValues extends import('react-hook-form').FieldValues>(props: import('../Input/NumberInput/NumberInput').ControlledNumberInputProps<TFieldValues>) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
readonly numberInput: <TFieldValues extends import('react-hook-form').FieldValues>({ renderStaticInput, ...props }: import('../Input/NumberInput/NumberInput').ControlledNumberInputProps<TFieldValues>) => import("react/jsx-runtime").JSX.Element;
|
|
9
11
|
readonly slider: <TFieldValues extends import('react-hook-form').FieldValues, IsRange extends boolean = false>(props: import('../Slider/Slider').ControlledSliderProps<TFieldValues, IsRange>) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
-
readonly textInput: <TFieldValues extends import('react-hook-form').FieldValues>(props: import('../Input/TextInput/TextInput').ControlledTextInputProps<TFieldValues>) => import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
readonly textInput: <TFieldValues extends import('react-hook-form').FieldValues>({ renderStaticInput, ...props }: import('../Input/TextInput/TextInput').ControlledTextInputProps<TFieldValues>) => import("react/jsx-runtime").JSX.Element;
|
|
11
13
|
readonly passwordInput: <TFieldValues extends import('react-hook-form').FieldValues>(props: import('../Input/PasswordInput/PasswordInput').ControlledPasswordInputProps<TFieldValues>) => import("react/jsx-runtime").JSX.Element;
|
|
12
14
|
readonly textArea: <TFieldValues extends import('react-hook-form').FieldValues>(props: import('../Input/TextArea/TextArea').ControlledTextAreaProps<TFieldValues>) => import("react/jsx-runtime").JSX.Element;
|
|
13
|
-
readonly select:
|
|
14
|
-
readonly querySelect: <TFieldValues extends import('react-hook-form').FieldValues, TQueryFn extends import('../Selection/shared/querySelect.utils').QueryFn, TKey extends import('react-aria').Key = import('react-aria').Key>({ query, queryParams, queryOptions, queryMap, ...props }: import('
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
queryOptions?: Parameters<TQueryFn>[1] | undefined;
|
|
18
|
-
queryMap?: ((data: Exclude<ReturnType<TQueryFn>["data"], undefined>) => import('../Selection/shared/select.types').SelectItem<TKey>[]) | undefined;
|
|
19
|
-
isInitialQueryDisabled?: boolean;
|
|
20
|
-
})) => import("react/jsx-runtime").JSX.Element;
|
|
21
|
-
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;
|
|
22
|
-
readonly queryAutocomplete: <TFieldValues extends import('react-hook-form').FieldValues, TSelectItem extends import('../Selection/shared/select.types').SelectItem<any>, TQueryFn extends import('../Selection/Autocomplete/queryAutocomplete.types').QueryFn<TSelectItem>>({ query, queryParams, queryOptions, queryMap, ...props }: import('../Selection/Autocomplete/queryAutocomplete.types').QueryAutocompleteProps<TFieldValues, TSelectItem, TQueryFn>) => import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
readonly select: typeof Select;
|
|
16
|
+
readonly querySelect: <TFieldValues extends import('react-hook-form').FieldValues, TQueryFn extends import('../Selection/shared/querySelect.utils').QueryFn, TKey extends import('react-aria').Key = import('react-aria').Key>({ query, queryParams, queryOptions, queryMap, ...props }: import('../Selection/Select/QuerySelect.js').QuerySelectProps<TFieldValues, TQueryFn, TKey>) => import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
readonly autocomplete: typeof Autocomplete;
|
|
18
|
+
readonly queryAutocomplete: <TFieldValues extends import('react-hook-form').FieldValues, TSelectItem extends import('../../..').SelectItem<any>, TQueryFn extends import('../Selection/Autocomplete/queryAutocomplete.types').QueryFn>({ query, queryParams, queryOptions, queryMap, leadingContent, ...props }: import('../Selection/Autocomplete/queryAutocomplete.types').QueryAutocompleteProps<TFieldValues, TSelectItem, TQueryFn>) => import("react/jsx-runtime").JSX.Element;
|
|
23
19
|
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;
|
|
24
|
-
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;
|
|
25
|
-
readonly dateTimePicker: <TFieldValues extends import('react-hook-form').FieldValues>({ fullIso, ...props }: import('../DateTime/DateTimePicker/DateTimePicker').ControlledDateTimePickerProps<TFieldValues>) => import("react/jsx-runtime").JSX.Element;
|
|
26
|
-
readonly timePicker: <TFieldValues extends import('react-hook-form').FieldValues>(props: import('../DateTime/TimePicker/TimePicker').ControlledTimePickerProps<TFieldValues>) => import("react/jsx-runtime").JSX.Element;
|
|
27
|
-
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;
|
|
20
|
+
readonly datePicker: <TFieldValues extends import('react-hook-form').FieldValues>({ fullIso, minValue, maxValue, renderStaticInput, ...props }: import('../DateTime/DatePicker/DatePicker').ControlledDatePickerProps<TFieldValues>) => import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
readonly dateTimePicker: <TFieldValues extends import('react-hook-form').FieldValues>({ fullIso, renderStaticInput, ...props }: import('../DateTime/DateTimePicker/DateTimePicker').ControlledDateTimePickerProps<TFieldValues>) => import("react/jsx-runtime").JSX.Element;
|
|
22
|
+
readonly timePicker: <TFieldValues extends import('react-hook-form').FieldValues>({ renderStaticInput, ...props }: import('../DateTime/TimePicker/TimePicker').ControlledTimePickerProps<TFieldValues>) => import("react/jsx-runtime").JSX.Element;
|
|
23
|
+
readonly dateRangePicker: <TFieldValues extends import('react-hook-form').FieldValues>({ fullIso, minValue, maxValue, renderStaticInput, ...props }: import('../DateTime/DateRangePicker/DateRangePicker').ControlledDateRangePickerProps<TFieldValues>) => import("react/jsx-runtime").JSX.Element;
|
|
28
24
|
readonly textEditor: <TFieldValues extends import('react-hook-form').FieldValues>(props: import('../../../text-editor.js').ControlledTextEditorProps<TFieldValues>) => import("react/jsx-runtime").JSX.Element;
|
|
29
25
|
readonly unknown: null;
|
|
30
26
|
};
|
|
@@ -54,8 +50,8 @@ type TypeBasedInputDef<TSchemaType extends Record<string, any>, T extends InputC
|
|
|
54
50
|
interface RenderBasedInputDef<TSchemaType extends Record<string, any>, K extends keyof TSchemaType> {
|
|
55
51
|
type?: never;
|
|
56
52
|
name: K;
|
|
57
|
-
label?:
|
|
58
|
-
placeholder?:
|
|
53
|
+
label?: string;
|
|
54
|
+
placeholder?: string;
|
|
59
55
|
props?: never;
|
|
60
56
|
inputWrapper?: never;
|
|
61
57
|
render: (formControl: {
|
|
@@ -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, radioIndicatorClass, radioTypography } from "./radio.cva.js";
|
|
5
|
+
import { radio, radioContentClassName, 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,20 @@ 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);
|
|
16
17
|
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
|
+
const radioClassName = radioCva({
|
|
19
|
+
variant,
|
|
20
|
+
...rest
|
|
21
|
+
});
|
|
22
|
+
const radioTypographyProps = radioTypographyMap({
|
|
23
|
+
variant,
|
|
24
|
+
...rest
|
|
25
|
+
});
|
|
26
|
+
const radioContentClassNameValue = radioContentClassNameMap({
|
|
27
|
+
variant,
|
|
28
|
+
...rest
|
|
29
|
+
});
|
|
17
30
|
const formFieldProps = {
|
|
18
31
|
className,
|
|
19
32
|
error,
|
|
@@ -41,14 +54,9 @@ var RadioGroupBase = (props) => {
|
|
|
41
54
|
children: options.map((option) => /* @__PURE__ */ jsxs(Radio, {
|
|
42
55
|
value: option.value,
|
|
43
56
|
className: clsx("relative", radioIndicatorClass),
|
|
44
|
-
children: [/* @__PURE__ */ jsx("div", { className:
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
}) }), /* @__PURE__ */ jsx(CheckContent, {
|
|
48
|
-
typography: radioTypographyMap({
|
|
49
|
-
variant,
|
|
50
|
-
...rest
|
|
51
|
-
}),
|
|
57
|
+
children: [/* @__PURE__ */ jsx("div", { className: radioClassName }), /* @__PURE__ */ jsx(CheckContent, {
|
|
58
|
+
typography: radioTypographyProps,
|
|
59
|
+
contentClassName: radioContentClassNameValue,
|
|
52
60
|
className: labelClassName,
|
|
53
61
|
children: option.label
|
|
54
62
|
})]
|
|
@@ -9,3 +9,6 @@ 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,5 +31,6 @@ var radioTypography = compoundMapper({ default: {
|
|
|
31
31
|
sizeMobile: "label-1",
|
|
32
32
|
variant: "default"
|
|
33
33
|
} });
|
|
34
|
+
var radioContentClassName = compoundMapper({ default: "text-text-default-2" });
|
|
34
35
|
//#endregion
|
|
35
|
-
export { radio, radioIndicatorClass, radioTypography };
|
|
36
|
+
export { radio, radioContentClassName, radioIndicatorClass, radioTypography };
|
|
@@ -1,8 +1,12 @@
|
|
|
1
|
+
import { ReactElement } from 'react';
|
|
1
2
|
import { Key } from 'react-aria-components';
|
|
2
3
|
import { FieldValues } from 'react-hook-form';
|
|
3
4
|
import { SelectBaseProps } from '../shared/SelectBase';
|
|
4
5
|
import { DefaultInitialSelectItem, GroupedSelectControlProps, GroupedSelectProps } from '../shared/select.types';
|
|
5
6
|
import { OmitDiscriminatedUnion } from '../../../../types/common';
|
|
6
|
-
export type AutocompleteProps<TKey extends Key = Key, TInitialSelectItem = DefaultInitialSelectItem<TKey>> = OmitDiscriminatedUnion<SelectBaseProps<TKey, TInitialSelectItem>, "isSearchable"
|
|
7
|
+
export type AutocompleteProps<TKey extends Key = Key, TInitialSelectItem = DefaultInitialSelectItem<TKey>> = OmitDiscriminatedUnion<SelectBaseProps<TKey, TInitialSelectItem>, "isSearchable"> & {
|
|
8
|
+
renderStaticInput?: boolean;
|
|
9
|
+
};
|
|
7
10
|
export type ControlledAutocompleteProps<TFieldValues extends FieldValues, TKey extends Key = Key, TInitialSelectItem = DefaultInitialSelectItem<TKey>> = Omit<AutocompleteProps<TKey, TInitialSelectItem>, keyof GroupedSelectProps> & GroupedSelectControlProps<TFieldValues, TKey, TInitialSelectItem>;
|
|
8
|
-
export declare
|
|
11
|
+
export declare function Autocomplete<TKey extends Key = Key, TInitialSelectItem = DefaultInitialSelectItem<TKey>>(props: AutocompleteProps<TKey, TInitialSelectItem>): ReactElement;
|
|
12
|
+
export declare function Autocomplete<TFieldValues extends FieldValues, TKey extends Key = Key, TInitialSelectItem = DefaultInitialSelectItem<TKey>>(props: ControlledAutocompleteProps<TFieldValues, TKey, TInitialSelectItem>): ReactElement;
|