@povio/ui 2.2.9-rc.4 → 2.2.9-rc.41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/buttons/Button/Button.d.ts +2 -1
- package/dist/components/buttons/Button/Button.js +41 -32
- package/dist/components/buttons/InlineIconButton/InlineIconButton.d.ts +2 -1
- package/dist/components/buttons/InlineIconButton/InlineIconButton.js +2 -2
- package/dist/components/inputs/Checkbox/Checkbox.js +6 -1
- package/dist/components/inputs/Checkbox/checkbox.cva.d.ts +3 -0
- package/dist/components/inputs/Checkbox/checkbox.cva.js +2 -1
- package/dist/components/inputs/DateTime/DatePicker/DatePicker.d.ts +8 -3
- package/dist/components/inputs/DateTime/DatePicker/DatePicker.js +81 -6
- package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.d.ts +7 -2
- package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.js +83 -5
- package/dist/components/inputs/DateTime/DateTimePicker/DateTimePicker.d.ts +8 -2
- package/dist/components/inputs/DateTime/DateTimePicker/DateTimePicker.js +84 -7
- package/dist/components/inputs/DateTime/TimePicker/TimePicker.d.ts +2 -1
- package/dist/components/inputs/DateTime/TimePicker/TimePicker.js +60 -4
- package/dist/components/inputs/DateTime/shared/Calendar.d.ts +5 -2
- package/dist/components/inputs/DateTime/shared/Calendar.js +23 -6
- package/dist/components/inputs/DateTime/shared/CalendarCell.d.ts +1 -1
- package/dist/components/inputs/DateTime/shared/CalendarCell.js +3 -3
- package/dist/components/inputs/DateTime/shared/CalendarGrid.d.ts +1 -1
- package/dist/components/inputs/DateTime/shared/DateField.js +3 -10
- package/dist/components/inputs/DateTime/shared/DatePickerInput.d.ts +6 -2
- package/dist/components/inputs/DateTime/shared/DatePickerInput.js +65 -55
- package/dist/components/inputs/DateTime/shared/DateSegmentItem.d.ts +14 -0
- package/dist/components/inputs/DateTime/shared/DateSegmentItem.js +19 -6
- package/dist/components/inputs/DateTime/shared/TimePickerInput.js +4 -2
- package/dist/components/inputs/DateTime/shared/datePicker.types.d.ts +4 -0
- package/dist/components/inputs/DateTime/shared/datePickerInput.cva.d.ts +7 -0
- package/dist/components/inputs/DateTime/shared/datePickerInput.cva.js +13 -0
- package/dist/components/inputs/DateTime/shared/datePickerTodayIcon.d.ts +6 -0
- package/dist/components/inputs/DateTime/shared/datePickerTodayIcon.js +21 -0
- package/dist/components/inputs/DateTime/shared/dateSegment.utils.d.ts +2 -0
- package/dist/components/inputs/DateTime/shared/dateSegment.utils.js +9 -0
- package/dist/components/inputs/DateTime/shared/dateSegment.utils.spec.d.ts +1 -0
- package/dist/components/inputs/DateTime/shared/staticDateTimeSegments.d.ts +35 -0
- package/dist/components/inputs/DateTime/shared/staticDateTimeSegments.js +80 -0
- package/dist/components/inputs/File/FileUpload.js +1 -0
- package/dist/components/inputs/File/shared/InputUploadContent.js +1 -0
- package/dist/components/inputs/FormField/FormField.d.ts +3 -3
- package/dist/components/inputs/FormField/FormFieldHeader.d.ts +2 -2
- package/dist/components/inputs/FormField/FormFieldHeader.js +3 -1
- package/dist/components/inputs/FormField/FormFieldLabel.d.ts +2 -2
- package/dist/components/inputs/FormField/formFieldHeader.cva.d.ts +6 -0
- package/dist/components/inputs/FormField/formFieldHeader.cva.js +11 -0
- package/dist/components/inputs/Input/NumberInput/NumberInput.d.ts +5 -2
- package/dist/components/inputs/Input/NumberInput/NumberInput.js +78 -7
- package/dist/components/inputs/Input/NumberRangeInput/NumberRangeField.d.ts +45 -0
- package/dist/components/inputs/Input/NumberRangeInput/NumberRangeField.js +146 -0
- package/dist/components/inputs/Input/NumberRangeInput/NumberRangeInput.d.ts +35 -0
- package/dist/components/inputs/Input/NumberRangeInput/NumberRangeInput.js +233 -0
- package/dist/components/inputs/Input/TextArea/TextArea.cva.d.ts +4 -0
- package/dist/components/inputs/Input/TextArea/TextArea.cva.js +5 -0
- package/dist/components/inputs/Input/TextArea/TextArea.js +3 -1
- package/dist/components/inputs/Input/TextInput/TextInput.d.ts +3 -1
- package/dist/components/inputs/Input/TextInput/TextInput.js +77 -7
- package/dist/components/inputs/Input/shared/InputContent.js +7 -6
- package/dist/components/inputs/Input/shared/numberStatic.utils.d.ts +1 -0
- package/dist/components/inputs/Input/shared/numberStatic.utils.js +7 -0
- package/dist/components/inputs/Inputs/InputItem.d.ts +12 -9
- package/dist/components/inputs/Inputs/InputItem.js +2 -0
- package/dist/components/inputs/RadioGroup/RadioGroup.d.ts +2 -1
- package/dist/components/inputs/RadioGroup/RadioGroup.js +106 -25
- package/dist/components/inputs/RadioGroup/radio.cva.d.ts +17 -0
- package/dist/components/inputs/RadioGroup/radio.cva.js +42 -1
- package/dist/components/inputs/Selection/Autocomplete/Autocomplete.d.ts +6 -2
- package/dist/components/inputs/Selection/Autocomplete/Autocomplete.js +95 -6
- package/dist/components/inputs/Selection/Autocomplete/QueryAutocomplete.d.ts +1 -1
- package/dist/components/inputs/Selection/Autocomplete/QueryAutocomplete.js +20 -11
- package/dist/components/inputs/Selection/Autocomplete/queryAutocomplete.types.d.ts +25 -19
- package/dist/components/inputs/Selection/Select/QuerySelect.d.ts +3 -3
- package/dist/components/inputs/Selection/Select/QuerySelect.js +22 -36
- package/dist/components/inputs/Selection/Select/Select.d.ts +7 -3
- package/dist/components/inputs/Selection/Select/Select.js +108 -4
- package/dist/components/inputs/Selection/shared/SelectBase.d.ts +4 -1
- package/dist/components/inputs/Selection/shared/SelectBase.js +3 -2
- package/dist/components/inputs/Selection/shared/SelectDesktop.d.ts +1 -1
- package/dist/components/inputs/Selection/shared/SelectDesktop.js +8 -4
- package/dist/components/inputs/Selection/shared/SelectInput.d.ts +2 -2
- package/dist/components/inputs/Selection/shared/SelectInput.js +13 -2
- package/dist/components/inputs/Selection/shared/SelectListBox.d.ts +2 -2
- package/dist/components/inputs/Selection/shared/SelectListBox.js +3 -3
- package/dist/components/inputs/Selection/shared/SelectMobile.d.ts +1 -1
- package/dist/components/inputs/Selection/shared/SelectMobile.js +5 -3
- package/dist/components/inputs/Selection/shared/select.context.d.ts +3 -2
- package/dist/components/inputs/Selection/shared/select.context.js +27 -4
- package/dist/components/inputs/Selection/shared/select.types.d.ts +3 -2
- package/dist/components/inputs/Selection/shared/selectDesktop.cva.d.ts +3 -0
- package/dist/components/inputs/Selection/shared/selectDesktop.cva.js +5 -0
- package/dist/components/inputs/Selection/shared/staticSelect.utils.d.ts +23 -0
- package/dist/components/inputs/Selection/shared/staticSelect.utils.js +37 -0
- package/dist/components/inputs/Selection/shared/staticSelect.utils.spec.d.ts +1 -0
- package/dist/components/inputs/Skeleton/InputFrame.d.ts +77 -0
- package/dist/components/inputs/Skeleton/InputFrame.js +200 -0
- package/dist/components/inputs/TextEditor/TextEditor.js +1 -0
- package/dist/components/inputs/Toggle/Toggle.js +6 -1
- package/dist/components/inputs/Toggle/toggle.cva.d.ts +3 -0
- package/dist/components/inputs/Toggle/toggle.cva.js +2 -1
- package/dist/components/inputs/shared/CheckContent.d.ts +2 -1
- package/dist/components/inputs/shared/CheckContent.js +3 -4
- package/dist/components/inputs/shared/InputClear.d.ts +2 -1
- package/dist/components/inputs/shared/InputClear.js +13 -1
- package/dist/components/inputs/shared/StaticInput.d.ts +38 -0
- package/dist/components/inputs/shared/TooltipWrapper.js +5 -1
- package/dist/components/inputs/shared/input.cva.d.ts +10 -0
- package/dist/components/inputs/shared/input.cva.js +19 -1
- package/dist/components/inputs/shared/tooltipWrapper.cva.d.ts +4 -0
- package/dist/components/inputs/shared/tooltipWrapper.cva.js +5 -0
- package/dist/components/inputs/shared/useStaticInputHandoff.d.ts +13 -0
- package/dist/components/inputs/shared/useStaticInputHandoff.js +47 -0
- package/dist/config/uiConfig.context.d.ts +8 -2
- package/dist/config/uiConfig.context.js +12 -1
- package/dist/config/uiStyle.context.d.ts +27 -4
- package/dist/hooks/useIntersectionObserver.d.ts +1 -1
- package/dist/hooks/useIntersectionObserver.js +29 -10
- package/dist/hooks/useQueryAutocomplete.d.ts +5 -16
- package/dist/hooks/useQueryAutocomplete.js +20 -5
- package/dist/index.d.ts +5 -0
- package/dist/index.js +3 -2
- package/dist/tw-ui-plugin.js +2 -0
- package/dist/utils/date-time.utils.d.ts +30 -9
- package/dist/utils/date-time.utils.js +113 -1
- package/dist/utils/query.utils.d.ts +4 -0
- package/dist/utils/query.utils.js +8 -0
- package/package.json +1 -1
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { SelectInputTags } from "./SelectInputTags.js";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
//#region src/components/inputs/Selection/shared/staticSelect.utils.tsx
|
|
4
|
+
var getStaticSelectValue = ({ items, value, selectionMode, initialSelection, mapInitialToSelectItem = ((item) => ({
|
|
5
|
+
id: item.id,
|
|
6
|
+
label: item.label ?? item.name ?? ""
|
|
7
|
+
})), showSelectionContent, isDisabled, collapseAfter, selectedTagsType }) => {
|
|
8
|
+
const initialSelectedItems = initialSelection ? (Array.isArray(initialSelection) ? initialSelection : [initialSelection]).map((item) => mapInitialToSelectItem(item)) : [];
|
|
9
|
+
const allItemsMap = /* @__PURE__ */ new Map();
|
|
10
|
+
[...initialSelectedItems, ...items].forEach((item) => allItemsMap.set(item.id, item));
|
|
11
|
+
const getItem = (id) => allItemsMap.get(id) ?? null;
|
|
12
|
+
const selectedItems = Array.isArray(value) ? value.map((id) => getItem(id)).filter((item) => item != null) : [];
|
|
13
|
+
const selectedItem = !Array.isArray(value) && value != null ? getItem(value) : null;
|
|
14
|
+
if (selectionMode === "multiple") return {
|
|
15
|
+
selectedItem,
|
|
16
|
+
selectedItems,
|
|
17
|
+
displayValue: selectedItems.length > 0 ? /* @__PURE__ */ jsx(SelectInputTags, {
|
|
18
|
+
selectedItems,
|
|
19
|
+
isDisabled,
|
|
20
|
+
collapseAfter,
|
|
21
|
+
selectedTagsType,
|
|
22
|
+
onRemove: () => void 0
|
|
23
|
+
}) : "",
|
|
24
|
+
isEmpty: selectedItems.length === 0
|
|
25
|
+
};
|
|
26
|
+
return {
|
|
27
|
+
selectedItem,
|
|
28
|
+
selectedItems,
|
|
29
|
+
displayValue: selectedItem != null ? showSelectionContent && selectedItem.content ? selectedItem.content : /* @__PURE__ */ jsx("div", {
|
|
30
|
+
className: "min-w-0 flex-1 truncate",
|
|
31
|
+
children: selectedItem.label
|
|
32
|
+
}) : "",
|
|
33
|
+
isEmpty: selectedItem == null
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
//#endregion
|
|
37
|
+
export { getStaticSelectValue };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { FC, FocusEventHandler, MouseEventHandler, ReactElement, ReactNode, Ref, SVGProps } from 'react';
|
|
2
|
+
import { InlineIconButtonProps } from '../../buttons/InlineIconButton/InlineIconButton';
|
|
3
|
+
import { FormFieldProps } from '../FormField/FormField';
|
|
4
|
+
import { FormFieldHeaderProps } from '../FormField/FormFieldHeader';
|
|
5
|
+
import { InputVariantProps } from '../shared/input.cva';
|
|
6
|
+
import { TypographyVariantProps } from '../../text/Typography/typography.cva';
|
|
7
|
+
type InputFrameIcon = FC<SVGProps<SVGSVGElement>> | ReactElement;
|
|
8
|
+
interface InputFrameAction {
|
|
9
|
+
icon: InlineIconButtonProps["icon"];
|
|
10
|
+
onClick: () => void;
|
|
11
|
+
altText: string;
|
|
12
|
+
className?: string;
|
|
13
|
+
}
|
|
14
|
+
interface InputFrameDataAttributes {
|
|
15
|
+
dataDisabled?: boolean;
|
|
16
|
+
dataHasSearch?: boolean;
|
|
17
|
+
dataHasSelection?: boolean;
|
|
18
|
+
dataInvalid?: boolean;
|
|
19
|
+
dataIsDirty?: boolean;
|
|
20
|
+
dataIsDisabled?: boolean;
|
|
21
|
+
dataIsEmpty?: boolean;
|
|
22
|
+
dataIsFilled?: boolean;
|
|
23
|
+
dataIsRequired?: boolean;
|
|
24
|
+
}
|
|
25
|
+
type InputFrameDataAttributeProps = {
|
|
26
|
+
"data-disabled"?: boolean;
|
|
27
|
+
"data-has-search"?: boolean;
|
|
28
|
+
"data-has-selection"?: boolean;
|
|
29
|
+
"data-invalid"?: boolean;
|
|
30
|
+
"data-is-dirty"?: boolean;
|
|
31
|
+
"data-is-disabled"?: boolean;
|
|
32
|
+
"data-is-empty"?: boolean;
|
|
33
|
+
"data-is-filled"?: boolean;
|
|
34
|
+
"data-is-required"?: boolean;
|
|
35
|
+
};
|
|
36
|
+
type InputFrameChildProps = InputFrameDataAttributeProps & {
|
|
37
|
+
id: string;
|
|
38
|
+
};
|
|
39
|
+
type InputFrameChildren = ReactNode | ((childProps: InputFrameChildProps) => ReactNode);
|
|
40
|
+
type InputFrameLabelPlacement = "content-wrapper" | "content-row";
|
|
41
|
+
type InputFrameActionContentPlacement = "content-wrapper" | "content-row";
|
|
42
|
+
export interface InputFrameProps extends InputVariantProps, Partial<FormFieldProps> {
|
|
43
|
+
ref?: Ref<HTMLDivElement>;
|
|
44
|
+
children: InputFrameChildren;
|
|
45
|
+
formFieldRef?: Ref<HTMLDivElement>;
|
|
46
|
+
onMouseEnter?: MouseEventHandler<HTMLDivElement>;
|
|
47
|
+
onFocusCapture?: FocusEventHandler<HTMLDivElement>;
|
|
48
|
+
labelProps?: FormFieldHeaderProps["labelProps"];
|
|
49
|
+
headerProps?: FormFieldHeaderProps;
|
|
50
|
+
leadingContent?: ReactNode;
|
|
51
|
+
leadingIcon?: InputFrameIcon;
|
|
52
|
+
actionContent?: ReactNode;
|
|
53
|
+
actionContentPlacement?: InputFrameActionContentPlacement;
|
|
54
|
+
trailingContent?: ReactNode;
|
|
55
|
+
trailingIcon?: InputFrameIcon;
|
|
56
|
+
trailingAction?: ReactNode;
|
|
57
|
+
unit?: string;
|
|
58
|
+
isLoading?: boolean;
|
|
59
|
+
action?: InputFrameAction;
|
|
60
|
+
isClearable?: boolean;
|
|
61
|
+
showClear?: boolean;
|
|
62
|
+
renderStatic?: boolean;
|
|
63
|
+
onStaticInteract?: (shouldFocus: boolean) => void;
|
|
64
|
+
clearClassName?: string;
|
|
65
|
+
onClear?: () => void;
|
|
66
|
+
dataAttributes?: InputFrameDataAttributes;
|
|
67
|
+
typographySize?: TypographyVariantProps["size"];
|
|
68
|
+
id?: string;
|
|
69
|
+
inputClassName?: string;
|
|
70
|
+
contentClassName?: string;
|
|
71
|
+
contentWrapperClassName?: string;
|
|
72
|
+
wrapContentAndTrailing?: boolean;
|
|
73
|
+
labelPlacement?: InputFrameLabelPlacement;
|
|
74
|
+
trailingClassName?: string;
|
|
75
|
+
}
|
|
76
|
+
export declare const InputFrame: (props: InputFrameProps) => import("react/jsx-runtime").JSX.Element;
|
|
77
|
+
export {};
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
import { UIStyle } from "../../../config/uiStyle.context.js";
|
|
2
|
+
import { typography } from "../../text/Typography/typography.cva.js";
|
|
3
|
+
import { Loader } from "../../status/Loader/Loader.js";
|
|
4
|
+
import { UIConfig } from "../../../config/uiConfig.context.js";
|
|
5
|
+
import { InlineIconButton } from "../../buttons/InlineIconButton/InlineIconButton.js";
|
|
6
|
+
import { FormFieldLabel } from "../FormField/FormFieldLabel.js";
|
|
7
|
+
import { InputClear } from "../shared/InputClear.js";
|
|
8
|
+
import { inputBase, inputContentWrapper, inputSize } from "../shared/input.cva.js";
|
|
9
|
+
import { FormField } from "../FormField/FormField.js";
|
|
10
|
+
import { TooltipWrapper } from "../shared/TooltipWrapper.js";
|
|
11
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
12
|
+
import { clsx } from "clsx";
|
|
13
|
+
import { isValidElement, useId } from "react";
|
|
14
|
+
//#region src/components/inputs/Skeleton/InputFrame.tsx
|
|
15
|
+
var InputFrame = (props) => {
|
|
16
|
+
const ui = UIConfig.useConfig();
|
|
17
|
+
const inputBaseCva = UIStyle.useCva("input.baseCva", inputBase);
|
|
18
|
+
const inputSizeCva = UIStyle.useCva("input.sizeCva", inputSize);
|
|
19
|
+
const inputContentWrapperCva = UIStyle.useCva("input.contentWrapperCva", inputContentWrapper);
|
|
20
|
+
const typographyCva = UIStyle.useCva("typography.cva", typography);
|
|
21
|
+
const generatedInputId = useId();
|
|
22
|
+
const { ref, children, formFieldRef, labelProps: labelPropsProp, headerProps, error, label, tooltipText, helperText, isRequired, rightContent, isDisabled, isHeaderHidden, hideLabel: hideLabelProp, headerClassName, errorClassName, className, leadingContent, leadingIcon, actionContent, actionContentPlacement = "content-wrapper", trailingContent, trailingIcon, trailingAction, unit, isLoading, action, isClearable: isClearableProp, showClear, renderStatic, onStaticInteract, clearClassName, onClear, dataAttributes, typographySize, id: idProp, inputClassName, contentClassName, contentWrapperClassName, wrapContentAndTrailing, labelPlacement = "content-wrapper", trailingClassName, onMouseEnter, onFocusCapture, variant: variantProp, as: asProp, size: sizeProp } = props;
|
|
23
|
+
const as = asProp ?? ui.input.as;
|
|
24
|
+
const size = sizeProp ?? ui.input.size;
|
|
25
|
+
const variant = variantProp ?? ui.input.variant;
|
|
26
|
+
const hideLabel = hideLabelProp ?? ui.input.hideLabel;
|
|
27
|
+
const hasClear = !!(isClearableProp ?? ui.input.isClearable);
|
|
28
|
+
const isLeadingIconElement = leadingIcon && isValidElement(leadingIcon);
|
|
29
|
+
const isTrailingIconElement = trailingIcon && isValidElement(trailingIcon);
|
|
30
|
+
const hasTrailingContent = hasClear || !!trailingContent || !!unit || !!isLoading || !!action || !!trailingIcon || !!trailingAction;
|
|
31
|
+
const isTrailingInteractive = !!action || !!trailingAction || !!isTrailingIconElement || hasClear && !!showClear || !!trailingContent;
|
|
32
|
+
const dataAttributeProps = getInputFrameDataAttributeProps(dataAttributes);
|
|
33
|
+
const baseLabelProps = headerProps?.labelProps ?? labelPropsProp;
|
|
34
|
+
const inputId = idProp ?? baseLabelProps?.htmlFor ?? `input-frame_${generatedInputId}`;
|
|
35
|
+
const labelProps = {
|
|
36
|
+
...baseLabelProps,
|
|
37
|
+
htmlFor: inputId
|
|
38
|
+
};
|
|
39
|
+
const formFieldProps = {
|
|
40
|
+
error,
|
|
41
|
+
label: label ?? "",
|
|
42
|
+
tooltipText,
|
|
43
|
+
helperText,
|
|
44
|
+
isRequired,
|
|
45
|
+
rightContent,
|
|
46
|
+
isHeaderHidden: isHeaderHidden || as === "inline" || as === "filter" || as === "floating",
|
|
47
|
+
hideLabel,
|
|
48
|
+
isDisabled,
|
|
49
|
+
headerClassName,
|
|
50
|
+
errorClassName,
|
|
51
|
+
className
|
|
52
|
+
};
|
|
53
|
+
const resolvedHeaderProps = headerProps ? {
|
|
54
|
+
...headerProps,
|
|
55
|
+
labelProps
|
|
56
|
+
} : {
|
|
57
|
+
label: label ?? "",
|
|
58
|
+
tooltipText,
|
|
59
|
+
helperText,
|
|
60
|
+
isRequired,
|
|
61
|
+
rightContent,
|
|
62
|
+
isHeaderHidden: hideLabel || isHeaderHidden,
|
|
63
|
+
isDisabled,
|
|
64
|
+
className: headerClassName,
|
|
65
|
+
labelProps
|
|
66
|
+
};
|
|
67
|
+
const labelContent = as && ["filter", "floating"].includes(as) ? /* @__PURE__ */ jsx(FormFieldLabel, {
|
|
68
|
+
as,
|
|
69
|
+
size,
|
|
70
|
+
...resolvedHeaderProps
|
|
71
|
+
}) : null;
|
|
72
|
+
const resolvedContentWrapperClassName = contentWrapperClassName ?? inputContentWrapperCva({ as });
|
|
73
|
+
const contentRow = /* @__PURE__ */ jsxs("div", {
|
|
74
|
+
className: clsx("group/input-frame flex min-w-0 w-full items-center gap-input-gap-input-text-to-elements pr-0!", as === "inline" && "h-full", inputSizeCva({
|
|
75
|
+
size,
|
|
76
|
+
as
|
|
77
|
+
}), typographySize && typographyCva({ size: typographySize }), contentClassName),
|
|
78
|
+
children: [
|
|
79
|
+
leadingContent,
|
|
80
|
+
leadingIcon && /* @__PURE__ */ jsx("div", {
|
|
81
|
+
className: clsx(!isLeadingIconElement && "pointer-events-none"),
|
|
82
|
+
children: renderIconVisual(leadingIcon)
|
|
83
|
+
}),
|
|
84
|
+
labelPlacement === "content-row" && labelContent,
|
|
85
|
+
actionContentPlacement === "content-row" && actionContent,
|
|
86
|
+
/* @__PURE__ */ jsxs("div", {
|
|
87
|
+
className: resolvedContentWrapperClassName,
|
|
88
|
+
children: [
|
|
89
|
+
labelPlacement === "content-wrapper" && labelContent,
|
|
90
|
+
actionContentPlacement === "content-wrapper" && actionContent,
|
|
91
|
+
typeof children === "function" ? children({
|
|
92
|
+
...dataAttributeProps,
|
|
93
|
+
id: inputId
|
|
94
|
+
}) : children
|
|
95
|
+
]
|
|
96
|
+
})
|
|
97
|
+
]
|
|
98
|
+
});
|
|
99
|
+
const trailingRow = hasTrailingContent ? /* @__PURE__ */ jsxs("div", {
|
|
100
|
+
className: clsx("flex items-center gap-input-gap-trailing-elements py-0! pl-0!", inputSizeCva({
|
|
101
|
+
size,
|
|
102
|
+
as
|
|
103
|
+
}), !isTrailingInteractive && "pointer-events-none", trailingClassName),
|
|
104
|
+
children: [
|
|
105
|
+
hasClear && /* @__PURE__ */ jsx(InputClear, {
|
|
106
|
+
onClear: () => onClear?.(),
|
|
107
|
+
className: clearClassName,
|
|
108
|
+
show: !!showClear,
|
|
109
|
+
renderStatic
|
|
110
|
+
}),
|
|
111
|
+
trailingContent,
|
|
112
|
+
unit && /* @__PURE__ */ jsx("span", {
|
|
113
|
+
className: typographyCva({
|
|
114
|
+
size: "label-2",
|
|
115
|
+
sizeMobile: "label-2",
|
|
116
|
+
variant: "prominent-1",
|
|
117
|
+
className: "text-text-default-3"
|
|
118
|
+
}),
|
|
119
|
+
children: unit
|
|
120
|
+
}),
|
|
121
|
+
isLoading && /* @__PURE__ */ jsx("div", {
|
|
122
|
+
className: "inline-flex",
|
|
123
|
+
children: /* @__PURE__ */ jsx(Loader, {})
|
|
124
|
+
}),
|
|
125
|
+
!isLoading && action && /* @__PURE__ */ jsx(InlineIconButton, {
|
|
126
|
+
color: "secondary",
|
|
127
|
+
icon: action.icon,
|
|
128
|
+
isDisabled,
|
|
129
|
+
onPress: action.onClick,
|
|
130
|
+
excludeFromTabOrder: true,
|
|
131
|
+
label: action.altText,
|
|
132
|
+
className: clsx("border-0!", action.className)
|
|
133
|
+
}),
|
|
134
|
+
!isLoading && !action && trailingIcon && renderIconVisual(trailingIcon),
|
|
135
|
+
trailingAction
|
|
136
|
+
]
|
|
137
|
+
}) : null;
|
|
138
|
+
const inputFrameContent = wrapContentAndTrailing ? /* @__PURE__ */ jsxs("div", {
|
|
139
|
+
className: "flex w-full items-center gap-input-gap-input-text-to-elements",
|
|
140
|
+
children: [contentRow, trailingRow]
|
|
141
|
+
}) : /* @__PURE__ */ jsxs(Fragment, { children: [contentRow, trailingRow] });
|
|
142
|
+
return /* @__PURE__ */ jsx(TooltipWrapper, {
|
|
143
|
+
as,
|
|
144
|
+
error,
|
|
145
|
+
triggerTabIndex: as === "inline" ? -1 : void 0,
|
|
146
|
+
children: /* @__PURE__ */ jsx(FormField, {
|
|
147
|
+
...formFieldProps,
|
|
148
|
+
...dataAttributeProps,
|
|
149
|
+
ref: formFieldRef,
|
|
150
|
+
as,
|
|
151
|
+
labelProps,
|
|
152
|
+
tabIndex: as === "inline" ? -1 : void 0,
|
|
153
|
+
onMouseEnter: (event) => {
|
|
154
|
+
onMouseEnter?.(event);
|
|
155
|
+
if (renderStatic) onStaticInteract?.(false);
|
|
156
|
+
},
|
|
157
|
+
onFocusCapture: (event) => {
|
|
158
|
+
onFocusCapture?.(event);
|
|
159
|
+
if (renderStatic) onStaticInteract?.(true);
|
|
160
|
+
},
|
|
161
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
162
|
+
ref,
|
|
163
|
+
...dataAttributeProps,
|
|
164
|
+
className: clsx("relative flex cursor-text has-disabled:cursor-default", inputBaseCva({
|
|
165
|
+
variant,
|
|
166
|
+
as
|
|
167
|
+
}), inputClassName),
|
|
168
|
+
tabIndex: renderStatic ? isDisabled ? -1 : 0 : void 0,
|
|
169
|
+
onFocus: () => {
|
|
170
|
+
if (renderStatic) onStaticInteract?.(true);
|
|
171
|
+
},
|
|
172
|
+
onClick: () => {
|
|
173
|
+
if (renderStatic) onStaticInteract?.(true);
|
|
174
|
+
},
|
|
175
|
+
onPointerDown: () => {
|
|
176
|
+
if (renderStatic) onStaticInteract?.(true);
|
|
177
|
+
},
|
|
178
|
+
"data-rac": "",
|
|
179
|
+
children: inputFrameContent
|
|
180
|
+
})
|
|
181
|
+
})
|
|
182
|
+
});
|
|
183
|
+
};
|
|
184
|
+
var renderIconVisual = (icon) => {
|
|
185
|
+
if (isValidElement(icon)) return icon;
|
|
186
|
+
return /* @__PURE__ */ jsx(icon, { className: "size-6 text-interactive-text-secondary-idle" });
|
|
187
|
+
};
|
|
188
|
+
var getInputFrameDataAttributeProps = (dataAttributes) => ({
|
|
189
|
+
"data-is-empty": dataAttributes?.dataIsEmpty || void 0,
|
|
190
|
+
"data-is-filled": dataAttributes?.dataIsFilled || void 0,
|
|
191
|
+
"data-is-dirty": dataAttributes?.dataIsDirty || void 0,
|
|
192
|
+
"data-is-required": dataAttributes?.dataIsRequired || void 0,
|
|
193
|
+
"data-is-disabled": dataAttributes?.dataIsDisabled || void 0,
|
|
194
|
+
"data-disabled": dataAttributes?.dataDisabled || void 0,
|
|
195
|
+
"data-has-search": dataAttributes?.dataHasSearch || void 0,
|
|
196
|
+
"data-invalid": dataAttributes?.dataInvalid || void 0,
|
|
197
|
+
"data-has-selection": dataAttributes?.dataHasSelection || void 0
|
|
198
|
+
});
|
|
199
|
+
//#endregion
|
|
200
|
+
export { InputFrame };
|
|
@@ -106,6 +106,7 @@ var TextEditorBase = ({ ref, as = "default", placeholder, label, hideLabel, tool
|
|
|
106
106
|
"data-rac": "",
|
|
107
107
|
"data-hovered": isHovered || void 0,
|
|
108
108
|
"data-disabled": isDisabled || void 0,
|
|
109
|
+
"data-is-disabled": isDisabled || void 0,
|
|
109
110
|
"data-focus-within": isFocused || void 0,
|
|
110
111
|
"data-focus-visible": isFocused && isFocusVisible || void 0,
|
|
111
112
|
"data-is-filled": !editor?.isEmpty,
|
|
@@ -2,7 +2,7 @@ import { UIStyle } from "../../../config/uiStyle.context.js";
|
|
|
2
2
|
import { UIConfig } from "../../../config/uiConfig.context.js";
|
|
3
3
|
import { FormFieldError } from "../FormField/FormFieldError.js";
|
|
4
4
|
import { CheckContent } from "../shared/CheckContent.js";
|
|
5
|
-
import { toggle, toggleTypography } from "./toggle.cva.js";
|
|
5
|
+
import { toggle, toggleContentClassName, toggleTypography } from "./toggle.cva.js";
|
|
6
6
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
7
7
|
import { clsx } from "clsx";
|
|
8
8
|
import { Switch } from "react-aria-components";
|
|
@@ -13,6 +13,7 @@ var ToggleBase = (props) => {
|
|
|
13
13
|
const ui = UIConfig.useConfig();
|
|
14
14
|
const toggleCva = UIStyle.useCva("toggle.cva", toggle);
|
|
15
15
|
const toggleTypographyMap = UIStyle.useMapper("toggle.typography", toggleTypography);
|
|
16
|
+
const toggleContentClassNameMap = UIStyle.useMapper("toggle.contentClassName", toggleContentClassName);
|
|
16
17
|
const { className, children, isDisabled, error, variant = ui.toggle.variant, ...rest } = props;
|
|
17
18
|
const formFieldErrorProps = {
|
|
18
19
|
error,
|
|
@@ -32,6 +33,10 @@ var ToggleBase = (props) => {
|
|
|
32
33
|
variant,
|
|
33
34
|
...rest
|
|
34
35
|
}),
|
|
36
|
+
contentClassName: toggleContentClassNameMap({
|
|
37
|
+
variant,
|
|
38
|
+
...rest
|
|
39
|
+
}),
|
|
35
40
|
children
|
|
36
41
|
})]
|
|
37
42
|
}), /* @__PURE__ */ jsx(FormFieldError, { ...formFieldErrorProps })] });
|
|
@@ -8,3 +8,6 @@ export interface ToggleVariantProps extends VariantProps<typeof toggle> {
|
|
|
8
8
|
export declare const toggleTypography: (props: {
|
|
9
9
|
variant?: "default" | null | undefined;
|
|
10
10
|
}) => TypographyVariantProps | undefined;
|
|
11
|
+
export declare const toggleContentClassName: (props: {
|
|
12
|
+
variant?: "default" | null | undefined;
|
|
13
|
+
}) => string | undefined;
|
|
@@ -26,5 +26,6 @@ var toggleTypography = compoundMapper({ default: {
|
|
|
26
26
|
sizeMobile: "label-1",
|
|
27
27
|
variant: "default"
|
|
28
28
|
} });
|
|
29
|
+
var toggleContentClassName = compoundMapper({ default: "text-text-default-2" });
|
|
29
30
|
//#endregion
|
|
30
|
-
export { toggle, toggleTypography };
|
|
31
|
+
export { toggle, toggleContentClassName, toggleTypography };
|
|
@@ -3,6 +3,7 @@ import { TypographyVariantProps } from '../../text/Typography/typography.cva';
|
|
|
3
3
|
interface CheckContentProps {
|
|
4
4
|
typography?: TypographyVariantProps;
|
|
5
5
|
className?: string;
|
|
6
|
+
contentClassName?: string;
|
|
6
7
|
}
|
|
7
|
-
export declare const CheckContent: ({ children, className, ...props }: PropsWithChildren<CheckContentProps>) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export declare const CheckContent: ({ children, className, contentClassName, ...props }: PropsWithChildren<CheckContentProps>) => import("react/jsx-runtime").JSX.Element;
|
|
8
9
|
export {};
|
|
@@ -3,15 +3,14 @@ import { typography } from "../../text/Typography/typography.cva.js";
|
|
|
3
3
|
import { jsx } from "react/jsx-runtime";
|
|
4
4
|
import clsx$1 from "clsx";
|
|
5
5
|
//#region src/components/inputs/shared/CheckContent.tsx
|
|
6
|
-
var CheckContent = ({ children, className, ...props }) => {
|
|
6
|
+
var CheckContent = ({ children, className, contentClassName, ...props }) => {
|
|
7
7
|
return /* @__PURE__ */ jsx("div", {
|
|
8
8
|
className: clsx$1(UIStyle.useCva("typography.cva", typography)({
|
|
9
9
|
size: "label-1",
|
|
10
10
|
sizeMobile: "label-1",
|
|
11
11
|
variant: "default",
|
|
12
|
-
...props.typography
|
|
13
|
-
|
|
14
|
-
}), className),
|
|
12
|
+
...props.typography
|
|
13
|
+
}), contentClassName, className),
|
|
15
14
|
children
|
|
16
15
|
});
|
|
17
16
|
};
|
|
@@ -2,8 +2,9 @@ import { CSSProperties } from 'react';
|
|
|
2
2
|
interface InputClearProps {
|
|
3
3
|
onClear: () => void;
|
|
4
4
|
show?: boolean;
|
|
5
|
+
renderStatic?: boolean;
|
|
5
6
|
className?: string;
|
|
6
7
|
style?: CSSProperties;
|
|
7
8
|
}
|
|
8
|
-
export declare const InputClear: ({ onClear, className, style, show }: InputClearProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export declare const InputClear: ({ onClear, className, style, show, renderStatic }: InputClearProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
10
|
export {};
|
|
@@ -5,7 +5,19 @@ import { jsx } from "react/jsx-runtime";
|
|
|
5
5
|
import { clsx } from "clsx";
|
|
6
6
|
import { useTranslation } from "react-i18next";
|
|
7
7
|
//#region src/components/inputs/shared/InputClear.tsx
|
|
8
|
-
var InputClear = ({ onClear, className, style, show }) => {
|
|
8
|
+
var InputClear = ({ onClear, className, style, show, renderStatic }) => {
|
|
9
|
+
if (renderStatic) return /* @__PURE__ */ jsx("button", {
|
|
10
|
+
className: clsx("invisible relative z-1 flex items-center size-6 shrink-0", "group-focus-within:visible group-hover/date-picker-content:visible group-hover/select-content:visible group-hover/text-area:visible group-hover:visible", "border-0!", !show && "invisible!", className),
|
|
11
|
+
style
|
|
12
|
+
});
|
|
13
|
+
return /* @__PURE__ */ jsx(InputClearButton, {
|
|
14
|
+
onClear,
|
|
15
|
+
className,
|
|
16
|
+
style,
|
|
17
|
+
show
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
var InputClearButton = ({ onClear, className, style, show }) => {
|
|
9
21
|
const { t } = useTranslation("ui");
|
|
10
22
|
return /* @__PURE__ */ jsx(InlineIconButton, {
|
|
11
23
|
color: "secondary",
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { FormFieldProps } from '../FormField/FormField';
|
|
3
|
+
import { TextInputProps } from '../Input/TextInput/TextInput';
|
|
4
|
+
import { InputSizeProps, InputVariantProps } from './input.cva';
|
|
5
|
+
import { TypographyVariantProps } from '../../text/Typography/typography.cva';
|
|
6
|
+
type StaticInputDataAttributes = {
|
|
7
|
+
dataDisabled?: boolean;
|
|
8
|
+
dataHasSearch?: boolean;
|
|
9
|
+
dataHasSelection?: boolean;
|
|
10
|
+
dataInvalid?: boolean;
|
|
11
|
+
dataIsDirty?: boolean;
|
|
12
|
+
dataIsDisabled?: boolean;
|
|
13
|
+
dataIsEmpty?: boolean;
|
|
14
|
+
dataIsFilled?: boolean;
|
|
15
|
+
dataIsRequired?: boolean;
|
|
16
|
+
};
|
|
17
|
+
interface StaticInputProps extends FormFieldProps {
|
|
18
|
+
onInteract: (shouldFocus: boolean) => void;
|
|
19
|
+
as?: TextInputProps["as"];
|
|
20
|
+
typographySize?: TypographyVariantProps["size"];
|
|
21
|
+
size?: InputSizeProps["size"];
|
|
22
|
+
variant?: InputVariantProps["variant"];
|
|
23
|
+
applyMinInputWidth?: boolean;
|
|
24
|
+
placeholder?: ReactNode;
|
|
25
|
+
showPlacholderIfFilled?: boolean;
|
|
26
|
+
displayValue?: ReactNode;
|
|
27
|
+
isEmpty?: boolean;
|
|
28
|
+
leadingVisual?: ReactNode;
|
|
29
|
+
leadingContent?: ReactNode;
|
|
30
|
+
leadingContentClassName?: string;
|
|
31
|
+
hasClearIcon?: boolean;
|
|
32
|
+
trailingContent?: ReactNode;
|
|
33
|
+
contentRowClassName?: string;
|
|
34
|
+
inputClassName?: string;
|
|
35
|
+
dataAttributes?: StaticInputDataAttributes;
|
|
36
|
+
}
|
|
37
|
+
export declare const StaticInput: ({ onInteract, as, typographySize, size, variant, applyMinInputWidth, placeholder, showPlacholderIfFilled, displayValue, isEmpty, leadingVisual, leadingContent, leadingContentClassName, hasClearIcon, trailingContent, contentRowClassName, inputClassName, dataAttributes, className, ...formFieldProps }: StaticInputProps) => import("react/jsx-runtime").JSX.Element;
|
|
38
|
+
export {};
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
+
import { UIStyle } from "../../../config/uiStyle.context.js";
|
|
1
2
|
import { Tooltip } from "../../overlays/Tooltip/Tooltip.js";
|
|
3
|
+
import { tooltipWrapperTrigger } from "./tooltipWrapper.cva.js";
|
|
2
4
|
import { jsx } from "react/jsx-runtime";
|
|
3
5
|
//#region src/components/inputs/shared/TooltipWrapper.tsx
|
|
4
6
|
var TooltipWrapper = (props) => {
|
|
7
|
+
const tooltipWrapperTriggerCva = UIStyle.useCva("tooltipWrapper.triggerCva", tooltipWrapperTrigger);
|
|
5
8
|
if (props.as !== "inline") return props.children;
|
|
6
9
|
return /* @__PURE__ */ jsx(Tooltip, {
|
|
7
10
|
text: props.error || void 0,
|
|
@@ -9,10 +12,11 @@ var TooltipWrapper = (props) => {
|
|
|
9
12
|
color: "error",
|
|
10
13
|
hidden: !props.error,
|
|
11
14
|
isNonInteractiveTrigger: true,
|
|
12
|
-
triggerClassName: props.triggerClassName,
|
|
15
|
+
triggerClassName: tooltipWrapperTriggerCva({ className: props.triggerClassName }),
|
|
13
16
|
triggerTabIndex: props.triggerTabIndex,
|
|
14
17
|
children: /* @__PURE__ */ jsx("div", {
|
|
15
18
|
tabIndex: -1,
|
|
19
|
+
className: tooltipWrapperTriggerCva({}),
|
|
16
20
|
children: props.children
|
|
17
21
|
})
|
|
18
22
|
});
|
|
@@ -12,6 +12,16 @@ export declare const inputSize: (props?: ({
|
|
|
12
12
|
} & ClassProp) | undefined) => string;
|
|
13
13
|
export interface InputSizeProps extends VariantProps<typeof inputSize> {
|
|
14
14
|
}
|
|
15
|
+
export declare const inputContentWrapper: (props?: ({
|
|
16
|
+
as?: "filter" | "default" | "floating" | "inline" | null | undefined;
|
|
17
|
+
} & ClassProp) | undefined) => string;
|
|
18
|
+
export interface InputContentWrapperProps extends VariantProps<typeof inputContentWrapper> {
|
|
19
|
+
}
|
|
20
|
+
export declare const inputClearClass: (props?: ({
|
|
21
|
+
as?: "filter" | "default" | "floating" | "inline" | null | undefined;
|
|
22
|
+
} & ClassProp) | undefined) => string;
|
|
23
|
+
export interface InputClearClassProps extends VariantProps<typeof inputClearClass> {
|
|
24
|
+
}
|
|
15
25
|
export declare const inputSide: (props?: ({
|
|
16
26
|
size?: "small" | "default" | "extra-small" | "large" | null | undefined;
|
|
17
27
|
type?: "left" | "right" | "var" | null | undefined;
|
|
@@ -191,6 +191,24 @@ var inputSize = cva("", {
|
|
|
191
191
|
as: "default"
|
|
192
192
|
}
|
|
193
193
|
});
|
|
194
|
+
var inputContentWrapper = cva("flex w-full", {
|
|
195
|
+
variants: { as: {
|
|
196
|
+
default: "",
|
|
197
|
+
floating: "flex-col",
|
|
198
|
+
filter: "gap-input-gap-input-text-to-elements",
|
|
199
|
+
inline: ""
|
|
200
|
+
} },
|
|
201
|
+
defaultVariants: { as: "default" }
|
|
202
|
+
});
|
|
203
|
+
var inputClearClass = cva("", {
|
|
204
|
+
variants: { as: {
|
|
205
|
+
default: "",
|
|
206
|
+
floating: "",
|
|
207
|
+
filter: "",
|
|
208
|
+
inline: ""
|
|
209
|
+
} },
|
|
210
|
+
defaultVariants: { as: "default" }
|
|
211
|
+
});
|
|
194
212
|
var inputSide = cva("", {
|
|
195
213
|
variants: {
|
|
196
214
|
size: {
|
|
@@ -277,4 +295,4 @@ var useInputCva = () => {
|
|
|
277
295
|
};
|
|
278
296
|
};
|
|
279
297
|
//#endregion
|
|
280
|
-
export { inputBase, inputSide, inputSize, useInputCva };
|
|
298
|
+
export { inputBase, inputClearClass, inputContentWrapper, inputSide, inputSize, useInputCva };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { VariantProps } from 'class-variance-authority';
|
|
2
|
+
export declare const tooltipWrapperTrigger: (props?: import('class-variance-authority/types').ClassProp | undefined) => string;
|
|
3
|
+
export interface TooltipWrapperTriggerVariantProps extends VariantProps<typeof tooltipWrapperTrigger> {
|
|
4
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Dispatch, RefObject, SetStateAction } from 'react';
|
|
2
|
+
interface StaticInputHandoffOptions<TElement extends HTMLElement> {
|
|
3
|
+
inputRef: RefObject<TElement | null>;
|
|
4
|
+
renderInput: boolean;
|
|
5
|
+
setRenderInput: Dispatch<SetStateAction<boolean>>;
|
|
6
|
+
getFocusTarget?: (element: TElement) => HTMLElement | null | undefined;
|
|
7
|
+
}
|
|
8
|
+
export declare const useStaticInputHandoff: <TElement extends HTMLElement = HTMLInputElement>({ inputRef, renderInput, setRenderInput, getFocusTarget, }: StaticInputHandoffOptions<TElement>) => {
|
|
9
|
+
shouldFocus: boolean;
|
|
10
|
+
renderRealInput: (focus: boolean) => void;
|
|
11
|
+
replayStaticInputChange: (value: string) => void;
|
|
12
|
+
};
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { useLayoutEffect, useRef, useState } from "react";
|
|
2
|
+
//#region src/components/inputs/shared/useStaticInputHandoff.ts
|
|
3
|
+
var useStaticInputHandoff = ({ inputRef, renderInput, setRenderInput, getFocusTarget }) => {
|
|
4
|
+
const [shouldFocus, setShouldFocus] = useState(false);
|
|
5
|
+
const pendingStaticChangeRef = useRef(null);
|
|
6
|
+
useLayoutEffect(() => {
|
|
7
|
+
if (!renderInput || !shouldFocus) return;
|
|
8
|
+
const focusRealInput = (replayPendingChange) => {
|
|
9
|
+
const input = inputRef.current;
|
|
10
|
+
const pendingValue = pendingStaticChangeRef.current;
|
|
11
|
+
const focusTarget = input ? getFocusTarget?.(input) ?? input : null;
|
|
12
|
+
if (replayPendingChange && focusTarget instanceof HTMLInputElement && pendingValue != null) {
|
|
13
|
+
(Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype, "value")?.set)?.call(focusTarget, pendingValue);
|
|
14
|
+
focusTarget.dispatchEvent(new Event("input", { bubbles: true }));
|
|
15
|
+
pendingStaticChangeRef.current = null;
|
|
16
|
+
}
|
|
17
|
+
focusTarget?.focus();
|
|
18
|
+
};
|
|
19
|
+
focusRealInput(true);
|
|
20
|
+
const frame = requestAnimationFrame(() => {
|
|
21
|
+
focusRealInput(false);
|
|
22
|
+
setShouldFocus(false);
|
|
23
|
+
});
|
|
24
|
+
return () => {
|
|
25
|
+
cancelAnimationFrame(frame);
|
|
26
|
+
};
|
|
27
|
+
}, [
|
|
28
|
+
getFocusTarget,
|
|
29
|
+
inputRef,
|
|
30
|
+
renderInput,
|
|
31
|
+
shouldFocus
|
|
32
|
+
]);
|
|
33
|
+
return {
|
|
34
|
+
shouldFocus,
|
|
35
|
+
renderRealInput: (focus) => {
|
|
36
|
+
setShouldFocus(focus);
|
|
37
|
+
setRenderInput(true);
|
|
38
|
+
},
|
|
39
|
+
replayStaticInputChange: (value) => {
|
|
40
|
+
pendingStaticChangeRef.current = value;
|
|
41
|
+
setShouldFocus(true);
|
|
42
|
+
setRenderInput(true);
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
//#endregion
|
|
47
|
+
export { useStaticInputHandoff };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PropsWithChildren } from 'react';
|
|
1
|
+
import { PropsWithChildren, ReactElement } from 'react';
|
|
2
2
|
import { ButtonProps } from '../components/buttons/Button/Button';
|
|
3
3
|
import { CheckboxProps } from '../components/inputs/Checkbox/Checkbox';
|
|
4
4
|
import { DatePickerProps } from '../components/inputs/DateTime/DatePicker/DatePicker';
|
|
@@ -19,6 +19,7 @@ export declare namespace UIConfig {
|
|
|
19
19
|
[P in keyof T]-?: T[P] extends object ? DeepRequired<T[P]> : Exclude<T[P], null | undefined>;
|
|
20
20
|
};
|
|
21
21
|
export interface Options {
|
|
22
|
+
renderStaticInput: boolean;
|
|
22
23
|
input: Pick<TextInputProps, "variant" | "isClearable" | "hideLabel" | "as" | "size">;
|
|
23
24
|
button: Pick<ButtonProps, "variant" | "size">;
|
|
24
25
|
numberInput: Pick<NumberInputProps, "formatOptions">;
|
|
@@ -33,7 +34,12 @@ export declare namespace UIConfig {
|
|
|
33
34
|
};
|
|
34
35
|
toggle: Pick<ToggleProps, "variant">;
|
|
35
36
|
slider: Pick<SliderProps, "minValue" | "maxValue">;
|
|
36
|
-
dateInput: Pick<DatePickerProps, "todayIcon" | "shouldForceLeadingZeros" | "disableManualEntry"
|
|
37
|
+
dateInput: Pick<DatePickerProps, "todayIcon" | "todayIconButtonSize" | "todayIconPlacement" | "shouldForceLeadingZeros" | "disableManualEntry" | "autoFixYear"> & {
|
|
38
|
+
calendarIcon?: ReactElement;
|
|
39
|
+
dateTimeIcon?: ReactElement;
|
|
40
|
+
timeIcon?: ReactElement;
|
|
41
|
+
setDateValueOnDateSelection?: boolean;
|
|
42
|
+
};
|
|
37
43
|
actionModal: Pick<ActionModalProps, "titleTypography" | "descriptionTypography">;
|
|
38
44
|
bottomSheet: Pick<BottomSheetProps, "closeDragThreshold" | "closeVelocityThreshold" | "hideThumb" | "headerTypography">;
|
|
39
45
|
tableHeaderText: Pick<HeaderTextProps, "variant" | "size">;
|