@povio/ui 2.2.9-rc.3 → 2.2.9-rc.30
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 +88 -6
- package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.d.ts +7 -2
- package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.js +91 -6
- package/dist/components/inputs/DateTime/DateTimePicker/DateTimePicker.d.ts +8 -2
- package/dist/components/inputs/DateTime/DateTimePicker/DateTimePicker.js +91 -7
- package/dist/components/inputs/DateTime/TimePicker/TimePicker.d.ts +2 -1
- package/dist/components/inputs/DateTime/TimePicker/TimePicker.js +73 -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.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 +85 -7
- package/dist/components/inputs/Input/NumberRangeInput/NumberRangeInput.d.ts +38 -0
- package/dist/components/inputs/Input/NumberRangeInput/NumberRangeInput.js +318 -0
- package/dist/components/inputs/Input/TextInput/TextInput.d.ts +3 -1
- package/dist/components/inputs/Input/TextInput/TextInput.js +88 -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 +15 -18
- package/dist/components/inputs/Inputs/InputItem.js +2 -0
- 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 +104 -6
- package/dist/components/inputs/Selection/Autocomplete/QueryAutocomplete.d.ts +1 -1
- package/dist/components/inputs/Selection/Autocomplete/QueryAutocomplete.js +15 -10
- package/dist/components/inputs/Selection/Autocomplete/queryAutocomplete.types.d.ts +25 -19
- package/dist/components/inputs/Selection/Select/QuerySelect.d.ts +3 -4
- package/dist/components/inputs/Selection/Select/QuerySelect.js +8 -35
- package/dist/components/inputs/Selection/Select/Select.d.ts +7 -3
- package/dist/components/inputs/Selection/Select/Select.js +119 -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 +68 -0
- package/dist/components/inputs/Skeleton/InputFrame.js +171 -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/StaticInput.js +104 -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/config/uiConfig.context.d.ts +8 -2
- package/dist/config/uiConfig.context.js +12 -1
- package/dist/config/uiStyle.context.d.ts +20 -3
- package/dist/helpers/dynamicInputs.d.ts +1 -1
- 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 +7 -0
- package/dist/index.js +4 -2
- 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
|
@@ -6,6 +6,7 @@ import "./useSelectItems.js";
|
|
|
6
6
|
import { SelectContext } from "./select.context.js";
|
|
7
7
|
import { SelectInput } from "./SelectInput.js";
|
|
8
8
|
import { SelectListBox } from "./SelectListBox.js";
|
|
9
|
+
import { selectPopoverCva } from "./selectDesktop.cva.js";
|
|
9
10
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
10
11
|
import { clsx } from "clsx";
|
|
11
12
|
import { Fragment as Fragment$1, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
@@ -13,9 +14,10 @@ import { ComboBox, DialogTrigger, Popover } from "react-aria-components";
|
|
|
13
14
|
import { useLabel, usePreventScroll } from "react-aria";
|
|
14
15
|
import { mergeRefs } from "@react-aria/utils";
|
|
15
16
|
//#region src/components/inputs/Selection/shared/SelectDesktop.tsx
|
|
16
|
-
var SelectDesktop = ({ ref, error, ignoreTriggerWidth, showSelectionContent, inputClassName, containerClassName, customTrigger, onBlur, onMouseEnter, onFocusCapture, ...props }) => {
|
|
17
|
+
var SelectDesktop = ({ ref, error, ignoreTriggerWidth, showSelectionContent, inputClassName, containerClassName, leadingContent, trailingContent, customTrigger, onBlur, onMouseEnter, onFocusCapture, ...props }) => {
|
|
17
18
|
const { label, tooltipText, helperText, isDirty, isRequired, rightContent, isHeaderHidden, headerClassName, errorClassName, placeholder, variant, isDisabled, className, hideLabel, hideDropdownIcon, isSearchable, isClearable, isLoading, as, size, collapseAfter, selectedTagsType } = props;
|
|
18
19
|
const popoverCva = UIStyle.useCva("popover.cva", popover);
|
|
20
|
+
const selectPopoverCva$1 = UIStyle.useCva("select.popoverCva", selectPopoverCva);
|
|
19
21
|
const formFieldProps = {
|
|
20
22
|
error,
|
|
21
23
|
label,
|
|
@@ -113,14 +115,14 @@ var SelectDesktop = ({ ref, error, ignoreTriggerWidth, showSelectionContent, inp
|
|
|
113
115
|
className: clsx("w-full", containerClassName)
|
|
114
116
|
},
|
|
115
117
|
as,
|
|
118
|
+
onMouseEnter,
|
|
119
|
+
onFocusCapture,
|
|
116
120
|
ref: wrapperRef,
|
|
117
121
|
children: [customTrigger ? /* @__PURE__ */ jsx(DialogTrigger, {
|
|
118
122
|
...dialogTriggerProps,
|
|
119
123
|
children: /* @__PURE__ */ jsx("div", {
|
|
120
124
|
...fieldProps,
|
|
121
125
|
ref: mergeRefs(ref, triggerRef),
|
|
122
|
-
onMouseEnter,
|
|
123
|
-
onFocusCapture,
|
|
124
126
|
children: customTrigger
|
|
125
127
|
})
|
|
126
128
|
}) : /* @__PURE__ */ jsx(SelectInput, {
|
|
@@ -137,6 +139,8 @@ var SelectDesktop = ({ ref, error, ignoreTriggerWidth, showSelectionContent, inp
|
|
|
137
139
|
isClearable,
|
|
138
140
|
showSelectionContent,
|
|
139
141
|
inputClassName,
|
|
142
|
+
leadingContent,
|
|
143
|
+
trailingContent,
|
|
140
144
|
collapseAfter,
|
|
141
145
|
selectedTagsType,
|
|
142
146
|
isRequired,
|
|
@@ -151,7 +155,7 @@ var SelectDesktop = ({ ref, error, ignoreTriggerWidth, showSelectionContent, inp
|
|
|
151
155
|
triggerRef,
|
|
152
156
|
isOpen,
|
|
153
157
|
onOpenChange: setIsOpen,
|
|
154
|
-
className:
|
|
158
|
+
className: selectPopoverCva$1({}),
|
|
155
159
|
style: { width: !ignoreTriggerWidth ? popoverWidth : void 0 },
|
|
156
160
|
offset: 0,
|
|
157
161
|
children: /* @__PURE__ */ jsx(SelectListBox, {
|
|
@@ -4,12 +4,12 @@ import { FormFieldHeaderProps } from '../../FormField/FormFieldHeader';
|
|
|
4
4
|
import { SelectBaseProps } from './SelectBase';
|
|
5
5
|
import { SelectItem } from './select.types';
|
|
6
6
|
import { InputVariantProps } from '../../shared/input.cva';
|
|
7
|
-
interface SelectInputProps extends InputVariantProps, Pick<SelectBaseProps, "ref" | "placeholder" | "isDisabled" | "hideDropdownIcon" | "isSearchable" | "isClearable" | "onBlur" | "showSelectionContent" | "inputClassName" | "selectedTagsType" | "collapseAfter" | "isRequired" | "isDirty" | "fireBlurOnChange" | "onMouseEnter" | "onFocusCapture"> {
|
|
7
|
+
interface SelectInputProps extends InputVariantProps, Pick<SelectBaseProps, "ref" | "placeholder" | "isDisabled" | "hideDropdownIcon" | "isSearchable" | "isClearable" | "onBlur" | "showSelectionContent" | "inputClassName" | "selectedTagsType" | "collapseAfter" | "isRequired" | "isDirty" | "fireBlurOnChange" | "leadingContent" | "trailingContent" | "onMouseEnter" | "onFocusCapture"> {
|
|
8
8
|
isInvalid?: boolean;
|
|
9
9
|
className?: string;
|
|
10
10
|
fieldProps?: AriaFieldProps;
|
|
11
11
|
headerProps?: FormFieldHeaderProps;
|
|
12
12
|
onCloseComboBox?: (state: ComboBoxState<SelectItem> | null) => void;
|
|
13
13
|
}
|
|
14
|
-
export declare const SelectInput: ({ ref, placeholder, variant, as, size, isDisabled, isInvalid, className, hideDropdownIcon, isSearchable, isClearable, showSelectionContent, inputClassName, fieldProps, headerProps, selectedTagsType, collapseAfter, isRequired, isDirty, onCloseComboBox, onBlur, fireBlurOnChange, onMouseEnter, onFocusCapture, ...props }: SelectInputProps) => import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export declare const SelectInput: ({ ref, placeholder, variant, as, size, isDisabled, isInvalid, className, hideDropdownIcon, isSearchable, isClearable, showSelectionContent, inputClassName, fieldProps, headerProps, selectedTagsType, collapseAfter, isRequired, isDirty, onCloseComboBox, onBlur, fireBlurOnChange, leadingContent, trailingContent, onMouseEnter, onFocusCapture, ...props }: SelectInputProps) => import("react/jsx-runtime").JSX.Element;
|
|
15
15
|
export {};
|
|
@@ -4,7 +4,7 @@ import { Typography } from "../../../text/Typography/Typography.js";
|
|
|
4
4
|
import "../../../../config/i18n.js";
|
|
5
5
|
import { FormFieldLabel } from "../../FormField/FormFieldLabel.js";
|
|
6
6
|
import { InputClear } from "../../shared/InputClear.js";
|
|
7
|
-
import { inputBase, inputSize } from "../../shared/input.cva.js";
|
|
7
|
+
import { inputBase, inputClearClass, inputSize } from "../../shared/input.cva.js";
|
|
8
8
|
import { SelectInputTags } from "./SelectInputTags.js";
|
|
9
9
|
import { SelectContext } from "./select.context.js";
|
|
10
10
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -14,9 +14,10 @@ import { Button, ComboBoxStateContext, Input } from "react-aria-components";
|
|
|
14
14
|
import { useFocusVisible, useFocusWithin, useHover } from "react-aria";
|
|
15
15
|
import { useTranslation } from "react-i18next";
|
|
16
16
|
//#region src/components/inputs/Selection/shared/SelectInput.tsx
|
|
17
|
-
var SelectInput = ({ ref, placeholder, variant, as, size, isDisabled, isInvalid, className, hideDropdownIcon, isSearchable, isClearable, showSelectionContent, inputClassName, fieldProps, headerProps, selectedTagsType, collapseAfter, isRequired, isDirty, onCloseComboBox, onBlur, fireBlurOnChange, onMouseEnter, onFocusCapture, ...props }) => {
|
|
17
|
+
var SelectInput = ({ ref, placeholder, variant, as, size, isDisabled, isInvalid, className, hideDropdownIcon, isSearchable, isClearable, showSelectionContent, inputClassName, fieldProps, headerProps, selectedTagsType, collapseAfter, isRequired, isDirty, onCloseComboBox, onBlur, fireBlurOnChange, leadingContent, trailingContent, onMouseEnter, onFocusCapture, ...props }) => {
|
|
18
18
|
const inputSizeCva = UIStyle.useCva("input.sizeCva", inputSize);
|
|
19
19
|
const inputBaseCva = UIStyle.useCva("input.baseCva", inputBase);
|
|
20
|
+
const inputClearClassCva = UIStyle.useCva("input.clearClassCva", inputClearClass);
|
|
20
21
|
const { t } = useTranslation("ui");
|
|
21
22
|
const state = use(ComboBoxStateContext);
|
|
22
23
|
const { hoverProps, isHovered } = useHover({ isDisabled });
|
|
@@ -70,6 +71,7 @@ var SelectInput = ({ ref, placeholder, variant, as, size, isDisabled, isInvalid,
|
|
|
70
71
|
}),
|
|
71
72
|
"data-rac": "",
|
|
72
73
|
"data-disabled": isDisabled || void 0,
|
|
74
|
+
"data-is-disabled": isDisabled || void 0,
|
|
73
75
|
"data-hovered": isHovered || void 0,
|
|
74
76
|
"data-focused": isOpen || isFocused || void 0,
|
|
75
77
|
"data-focus-within": isFocused || void 0,
|
|
@@ -101,6 +103,10 @@ var SelectInput = ({ ref, placeholder, variant, as, size, isDisabled, isInvalid,
|
|
|
101
103
|
...headerProps,
|
|
102
104
|
labelProps
|
|
103
105
|
}),
|
|
106
|
+
leadingContent && /* @__PURE__ */ jsx("div", {
|
|
107
|
+
className: "ml-input-side-default flex shrink-0 items-center",
|
|
108
|
+
children: leadingContent
|
|
109
|
+
}),
|
|
104
110
|
(showTags || isSearchable) && /* @__PURE__ */ jsxs("div", {
|
|
105
111
|
className: clsx("flex flex-1 flex-wrap gap-input-gap-input-text-to-elements truncate", !isSearchable && "pointer-events-none z-1"),
|
|
106
112
|
children: [showTags && /* @__PURE__ */ jsx(SelectInputTags, {
|
|
@@ -138,8 +144,13 @@ var SelectInput = ({ ref, placeholder, variant, as, size, isDisabled, isInvalid,
|
|
|
138
144
|
onClear();
|
|
139
145
|
if (fireBlurOnChange) onBlur?.({});
|
|
140
146
|
},
|
|
147
|
+
className: inputClearClassCva({ as }),
|
|
141
148
|
show: showClearButton
|
|
142
149
|
}),
|
|
150
|
+
trailingContent && /* @__PURE__ */ jsx("div", {
|
|
151
|
+
className: "flex shrink-0 items-center",
|
|
152
|
+
children: trailingContent
|
|
153
|
+
}),
|
|
143
154
|
!hideDropdownIcon && /* @__PURE__ */ jsx(Button, {
|
|
144
155
|
excludeFromTabOrder: true,
|
|
145
156
|
"aria-label": t(($) => isOpen ? $.ui.closeAlt : $.ui.openAlt),
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { AriaListBoxProps } from 'react-aria';
|
|
2
2
|
import { SelectBaseProps } from './SelectBase';
|
|
3
3
|
import { SelectItem } from './select.types';
|
|
4
|
-
export interface SelectListBoxProps extends Pick<SelectBaseProps, "label" | "newItemRender" | "onLoadMore" | "selectionMode" | "isSearchable" | "virtualizerOptions">, Omit<AriaListBoxProps<SelectItem>, "children" | "aria-label" | "selectionMode" | "items" | "selectedKeys" | "onSelectionChange" | "escapeKeyBehavior" | "shouldSelectOnPressUp" | "label"> {
|
|
4
|
+
export interface SelectListBoxProps extends Pick<SelectBaseProps, "label" | "newItemRender" | "onLoadMore" | "selectionMode" | "isSearchable" | "virtualizerOptions" | "totalItems" | "hasLoadMore">, Omit<AriaListBoxProps<SelectItem>, "children" | "aria-label" | "selectionMode" | "items" | "selectedKeys" | "onSelectionChange" | "escapeKeyBehavior" | "shouldSelectOnPressUp" | "label"> {
|
|
5
5
|
className?: string;
|
|
6
6
|
isScrollable?: boolean;
|
|
7
7
|
onClose?: () => void;
|
|
8
8
|
}
|
|
9
|
-
export declare const SelectListBox: ({ label, selectionMode, isSearchable, isScrollable, virtualizerOptions, newItemRender, onLoadMore, className, onClose, ...props }: SelectListBoxProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export declare const SelectListBox: ({ label, selectionMode, isSearchable, isScrollable, virtualizerOptions, totalItems, newItemRender, onLoadMore, className, onClose, ...props }: SelectListBoxProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -7,8 +7,8 @@ import { jsx } from "react/jsx-runtime";
|
|
|
7
7
|
import { clsx } from "clsx";
|
|
8
8
|
import { ListBox, ListLayout, Virtualizer } from "react-aria-components";
|
|
9
9
|
//#region src/components/inputs/Selection/shared/SelectListBox.tsx
|
|
10
|
-
var SelectListBox = ({ label, selectionMode, isSearchable, isScrollable = true, virtualizerOptions, newItemRender, onLoadMore, className, onClose, ...props }) => {
|
|
11
|
-
const { fieldState, onChange, listItems, selectableListItems, selectedIds, isMultiple, onClear, onSelectAll } = SelectContext.useSelect();
|
|
10
|
+
var SelectListBox = ({ label, selectionMode, isSearchable, isScrollable = true, virtualizerOptions, totalItems, newItemRender, onLoadMore, className, onClose, ...props }) => {
|
|
11
|
+
const { fieldState, onChange, listItems, selectableListItems, selectedIds, isMultiple, onClear, onSelectAll, hasLoadMore } = SelectContext.useSelect();
|
|
12
12
|
const onSelectionChange = (value) => {
|
|
13
13
|
const ids = Array.from(value);
|
|
14
14
|
if (!isMultiple && ids.length === 0) {
|
|
@@ -42,7 +42,7 @@ var SelectListBox = ({ label, selectionMode, isSearchable, isScrollable = true,
|
|
|
42
42
|
newItemRender
|
|
43
43
|
}, item.id);
|
|
44
44
|
};
|
|
45
|
-
if (virtualizerOptions || listItems.length > 100) return /* @__PURE__ */ jsx(Virtualizer, {
|
|
45
|
+
if (virtualizerOptions || (totalItems ?? listItems.length) > 100 || hasLoadMore) return /* @__PURE__ */ jsx(Virtualizer, {
|
|
46
46
|
layout: ListLayout,
|
|
47
47
|
layoutOptions: virtualizerOptions,
|
|
48
48
|
children: /* @__PURE__ */ jsx(ListBox, {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Key } from 'react-aria-components';
|
|
2
2
|
import { SelectBaseProps } from './SelectBase';
|
|
3
3
|
type SelectMobileProps<TKey extends Key = Key> = SelectBaseProps<TKey>;
|
|
4
|
-
export declare const SelectMobile: <TKey extends Key = Key>({ ref, error, showSelectionContent, inputClassName, containerClassName, customTrigger, onBlur, onMouseEnter, onFocusCapture, ...props }: SelectMobileProps<TKey>) => import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
export declare const SelectMobile: <TKey extends Key = Key>({ ref, error, showSelectionContent, inputClassName, containerClassName, leadingContent, trailingContent, customTrigger, onBlur, onMouseEnter, onFocusCapture, ...props }: SelectMobileProps<TKey>) => import("react/jsx-runtime").JSX.Element;
|
|
5
5
|
export {};
|
|
@@ -13,7 +13,7 @@ import { useRef } from "react";
|
|
|
13
13
|
import { DialogTrigger } from "react-aria-components";
|
|
14
14
|
import { useLabel } from "react-aria";
|
|
15
15
|
//#region src/components/inputs/Selection/shared/SelectMobile.tsx
|
|
16
|
-
var SelectMobile = ({ ref, error, showSelectionContent, inputClassName, containerClassName, customTrigger, onBlur, onMouseEnter, onFocusCapture, ...props }) => {
|
|
16
|
+
var SelectMobile = ({ ref, error, showSelectionContent, inputClassName, containerClassName, leadingContent, trailingContent, customTrigger, onBlur, onMouseEnter, onFocusCapture, ...props }) => {
|
|
17
17
|
const { label, tooltipText, helperText, isDirty, isRequired, rightContent, isHeaderHidden, headerClassName, errorClassName, placeholder, variant, isDisabled, className, hideLabel, hideDropdownIcon, hideSearchIcon, isSearchable, isClearable, as, size, collapseAfter, selectedTagsType } = props;
|
|
18
18
|
const formFieldProps = {
|
|
19
19
|
error,
|
|
@@ -57,13 +57,13 @@ var SelectMobile = ({ ref, error, showSelectionContent, inputClassName, containe
|
|
|
57
57
|
as,
|
|
58
58
|
labelProps,
|
|
59
59
|
className: clsx("w-full", containerClassName),
|
|
60
|
+
onMouseEnter,
|
|
61
|
+
onFocusCapture,
|
|
60
62
|
children: /* @__PURE__ */ jsxs(DialogTrigger, {
|
|
61
63
|
...dialogTriggerProps,
|
|
62
64
|
children: [customTrigger ? /* @__PURE__ */ jsx("div", {
|
|
63
65
|
...fieldProps,
|
|
64
66
|
ref,
|
|
65
|
-
onMouseEnter,
|
|
66
|
-
onFocusCapture,
|
|
67
67
|
children: customTrigger
|
|
68
68
|
}) : /* @__PURE__ */ jsx(SelectInput, {
|
|
69
69
|
ref,
|
|
@@ -81,6 +81,8 @@ var SelectMobile = ({ ref, error, showSelectionContent, inputClassName, containe
|
|
|
81
81
|
onBlur: void 0,
|
|
82
82
|
fieldProps,
|
|
83
83
|
headerProps,
|
|
84
|
+
leadingContent,
|
|
85
|
+
trailingContent,
|
|
84
86
|
collapseAfter,
|
|
85
87
|
selectedTagsType,
|
|
86
88
|
isRequired,
|
|
@@ -17,14 +17,15 @@ export declare namespace SelectContext {
|
|
|
17
17
|
onClear: () => void;
|
|
18
18
|
onSelectAll: () => void;
|
|
19
19
|
onRemove: (val: Key) => void;
|
|
20
|
+
onBlur: () => void;
|
|
20
21
|
listItems: ExtendedSelectItem[];
|
|
21
22
|
selectableListItems: SelectItem[];
|
|
22
23
|
selectedItems: SelectItem[];
|
|
23
24
|
selectedIds: Key[];
|
|
24
25
|
isMultiple: boolean;
|
|
25
26
|
} & Pick<SelectBaseProps, "onInputChange" | "isLoading" | "hasLoadMore">;
|
|
26
|
-
export type ProviderProps = GroupedSelectProps & Pick<SelectBaseProps, "items" | "onInputChange" | "onSearchChange" | "showSelectAllOption" | "showNewItemOption" | "newItemMinLength" | "onNewItemOption" | "isLoading" | "hasLoadMore" | "mapInitialToSelectItem" | "isSearchable" | "isClientSearchDisabled">;
|
|
27
|
-
export const Provider: ({ items, onInputChange, onSearchChange, showSelectAllOption, showNewItemOption, newItemMinLength, onNewItemOption, isLoading, hasLoadMore, isClientSearchDisabled, children, mapInitialToSelectItem, ...props }: PropsWithChildren<ProviderProps>) => import("react/jsx-runtime").JSX.Element;
|
|
27
|
+
export type ProviderProps = GroupedSelectProps & Pick<SelectBaseProps, "items" | "onInputChange" | "onSearchChange" | "showSelectAllOption" | "showNewItemOption" | "newItemMinLength" | "onNewItemOption" | "isLoading" | "hasLoadMore" | "mapInitialToSelectItem" | "isSearchable" | "isClientSearchDisabled" | "ignoreInputValueFiltering">;
|
|
28
|
+
export const Provider: ({ items, onInputChange, onSearchChange, showSelectAllOption, showNewItemOption, newItemMinLength, onNewItemOption, isLoading, hasLoadMore, isClientSearchDisabled, ignoreInputValueFiltering, children, mapInitialToSelectItem, ...props }: PropsWithChildren<ProviderProps>) => import("react/jsx-runtime").JSX.Element;
|
|
28
29
|
export const useSelect: () => Type;
|
|
29
30
|
export {};
|
|
30
31
|
}
|
|
@@ -10,7 +10,7 @@ var SelectContext;
|
|
|
10
10
|
id: item.id,
|
|
11
11
|
label: item.label ?? item.name ?? ""
|
|
12
12
|
});
|
|
13
|
-
_SelectContext.Provider = ({ items, onInputChange, onSearchChange, showSelectAllOption, showNewItemOption, newItemMinLength, onNewItemOption, isLoading, hasLoadMore, isClientSearchDisabled, children, mapInitialToSelectItem = defaultMapInitialToSelectItem, ...props }) => {
|
|
13
|
+
_SelectContext.Provider = ({ items, onInputChange, onSearchChange, showSelectAllOption, showNewItemOption, newItemMinLength, onNewItemOption, isLoading, hasLoadMore, isClientSearchDisabled, ignoreInputValueFiltering, children, mapInitialToSelectItem = defaultMapInitialToSelectItem, ...props }) => {
|
|
14
14
|
const isMultiple = props.selectionMode === "multiple";
|
|
15
15
|
const initialSelectedItems = useMemo(() => {
|
|
16
16
|
if (!props.initialSelection) return null;
|
|
@@ -42,9 +42,14 @@ var SelectContext;
|
|
|
42
42
|
newItemMinLength,
|
|
43
43
|
isLoading,
|
|
44
44
|
hasLoadMore,
|
|
45
|
-
isClientSearchDisabled
|
|
45
|
+
isClientSearchDisabled: ignoreInputValueFiltering ?? isClientSearchDisabled
|
|
46
46
|
});
|
|
47
|
-
const selectedItems = useMemo(() =>
|
|
47
|
+
const selectedItems = useMemo(() => {
|
|
48
|
+
const getItem = (id) => allItems.find((item) => item.id === id) ?? null;
|
|
49
|
+
if (Array.isArray(fieldState.value)) return fieldState.value.map((id) => getItem(id)).filter((item) => item !== null);
|
|
50
|
+
const selectedItem = fieldState.value != null ? getItem(fieldState.value) : null;
|
|
51
|
+
return selectedItem ? [selectedItem] : [];
|
|
52
|
+
}, [allItems, fieldState.value]);
|
|
48
53
|
const selectedIds = useMemo(() => selectedItems.map(({ id }) => id), [selectedItems]);
|
|
49
54
|
const getItem = useCallback((value) => allItems.find((item) => item && item.id === value) ?? null, [allItems]);
|
|
50
55
|
const updateValue = useCallback((value) => {
|
|
@@ -84,7 +89,7 @@ var SelectContext;
|
|
|
84
89
|
else updateValue(value);
|
|
85
90
|
}, [props.value]);
|
|
86
91
|
useEffect(() => {
|
|
87
|
-
if (!isMultiple && fieldState.value && fieldState.inputValue === "" && getItem(fieldState.value)?.label) syncFieldState(fieldState.value);
|
|
92
|
+
if (!isMultiple && props.value !== null && props.value !== void 0 && fieldState.value !== null && fieldState.value !== void 0 && fieldState.inputValue === "" && getItem(fieldState.value)?.label) syncFieldState(fieldState.value);
|
|
88
93
|
}, [allListItems]);
|
|
89
94
|
const handleInputChange = useCallback((inputValue) => {
|
|
90
95
|
const newFieldState = {
|
|
@@ -144,6 +149,22 @@ var SelectContext;
|
|
|
144
149
|
fieldState.value,
|
|
145
150
|
onChange
|
|
146
151
|
]);
|
|
152
|
+
const onBlur = useCallback(() => {
|
|
153
|
+
if (props.isSearchable && isMultiple && fieldState.searchValue !== "") {
|
|
154
|
+
const newFieldState = {
|
|
155
|
+
...fieldState,
|
|
156
|
+
inputValue: "",
|
|
157
|
+
searchValue: ""
|
|
158
|
+
};
|
|
159
|
+
setFieldState(newFieldState);
|
|
160
|
+
emitStateChanges(newFieldState);
|
|
161
|
+
setShowAll(true);
|
|
162
|
+
}
|
|
163
|
+
}, [
|
|
164
|
+
props.isSearchable,
|
|
165
|
+
isMultiple,
|
|
166
|
+
fieldState
|
|
167
|
+
]);
|
|
147
168
|
const value = useMemo(() => ({
|
|
148
169
|
fieldState,
|
|
149
170
|
isOpen,
|
|
@@ -154,6 +175,7 @@ var SelectContext;
|
|
|
154
175
|
onClear,
|
|
155
176
|
onSelectAll,
|
|
156
177
|
onRemove,
|
|
178
|
+
onBlur,
|
|
157
179
|
listItems,
|
|
158
180
|
selectableListItems,
|
|
159
181
|
selectedItems,
|
|
@@ -171,6 +193,7 @@ var SelectContext;
|
|
|
171
193
|
onClear,
|
|
172
194
|
onSelectAll,
|
|
173
195
|
onRemove,
|
|
196
|
+
onBlur,
|
|
174
197
|
listItems,
|
|
175
198
|
selectableListItems,
|
|
176
199
|
selectedIds,
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { ReactElement } from 'react';
|
|
1
|
+
import { ReactElement, ReactNode } from 'react';
|
|
2
2
|
import { Key } from 'react-aria-components';
|
|
3
3
|
import { FieldValues } from 'react-hook-form';
|
|
4
4
|
import { ControlProps } from '../../shared/form.types';
|
|
5
5
|
export interface SelectItem<TKey extends Key = Key> {
|
|
6
6
|
id: TKey;
|
|
7
7
|
label: string;
|
|
8
|
-
content?: string |
|
|
8
|
+
content?: string | ReactNode;
|
|
9
9
|
isDisabled?: boolean;
|
|
10
10
|
}
|
|
11
11
|
export interface ExtendedSelectItem<TKey extends Key = Key> extends SelectItem<TKey> {
|
|
@@ -54,6 +54,7 @@ export interface SelectAsyncProps {
|
|
|
54
54
|
onLoadMore?: () => void;
|
|
55
55
|
}
|
|
56
56
|
export interface SelectVirtualizationProps {
|
|
57
|
+
totalItems?: number;
|
|
57
58
|
virtualizerOptions?: {
|
|
58
59
|
rowHeight?: number;
|
|
59
60
|
estimatedRowHeight?: number;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { Key } from 'react-aria-components';
|
|
3
|
+
import { SelectBaseProps } from './SelectBase';
|
|
4
|
+
import { DefaultInitialSelectItem, SelectItem } from './select.types';
|
|
5
|
+
interface GetStaticSelectValueOptions<TKey extends Key = Key, TInitialSelectItem = DefaultInitialSelectItem<TKey>> {
|
|
6
|
+
items: SelectItem<TKey>[];
|
|
7
|
+
value: TKey | TKey[] | null | undefined;
|
|
8
|
+
selectionMode: SelectBaseProps<TKey>["selectionMode"];
|
|
9
|
+
initialSelection?: TInitialSelectItem | TInitialSelectItem[] | null;
|
|
10
|
+
mapInitialToSelectItem?: (item: TInitialSelectItem) => SelectItem<TKey>;
|
|
11
|
+
showSelectionContent?: boolean;
|
|
12
|
+
isDisabled?: boolean;
|
|
13
|
+
collapseAfter?: SelectBaseProps<TKey>["collapseAfter"];
|
|
14
|
+
selectedTagsType?: SelectBaseProps<TKey>["selectedTagsType"];
|
|
15
|
+
}
|
|
16
|
+
interface StaticSelectValueResult<TKey extends Key = Key> {
|
|
17
|
+
selectedItem: SelectItem<TKey> | null;
|
|
18
|
+
selectedItems: SelectItem<TKey>[];
|
|
19
|
+
displayValue: ReactNode;
|
|
20
|
+
isEmpty: boolean;
|
|
21
|
+
}
|
|
22
|
+
export declare const getStaticSelectValue: <TKey extends Key = Key, TInitialSelectItem = DefaultInitialSelectItem<TKey>>({ items, value, selectionMode, initialSelection, mapInitialToSelectItem, showSelectionContent, isDisabled, collapseAfter, selectedTagsType, }: GetStaticSelectValueOptions<TKey, TInitialSelectItem>) => StaticSelectValueResult<TKey>;
|
|
23
|
+
export {};
|
|
@@ -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,68 @@
|
|
|
1
|
+
import { FC, 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 InputFrameChildren = ReactNode | ((dataAttributeProps: InputFrameDataAttributeProps) => ReactNode);
|
|
37
|
+
type InputFrameLabelPlacement = "content-wrapper" | "content-row";
|
|
38
|
+
export interface InputFrameProps extends InputVariantProps, Partial<FormFieldProps> {
|
|
39
|
+
ref?: Ref<HTMLDivElement>;
|
|
40
|
+
children: InputFrameChildren;
|
|
41
|
+
formFieldRef?: Ref<HTMLDivElement>;
|
|
42
|
+
labelProps?: FormFieldHeaderProps["labelProps"];
|
|
43
|
+
headerProps?: FormFieldHeaderProps;
|
|
44
|
+
leadingContent?: ReactNode;
|
|
45
|
+
leadingIcon?: InputFrameIcon;
|
|
46
|
+
actionContent?: ReactNode;
|
|
47
|
+
trailingContent?: ReactNode;
|
|
48
|
+
trailingIcon?: InputFrameIcon;
|
|
49
|
+
trailingAction?: ReactNode;
|
|
50
|
+
unit?: string;
|
|
51
|
+
isLoading?: boolean;
|
|
52
|
+
action?: InputFrameAction;
|
|
53
|
+
isClearable?: boolean;
|
|
54
|
+
showClear?: boolean;
|
|
55
|
+
renderStatic?: boolean;
|
|
56
|
+
onStaticInteract?: (shouldFocus: boolean) => void;
|
|
57
|
+
clearClassName?: string;
|
|
58
|
+
onClear?: () => void;
|
|
59
|
+
dataAttributes?: InputFrameDataAttributes;
|
|
60
|
+
typographySize?: TypographyVariantProps["size"];
|
|
61
|
+
inputClassName?: string;
|
|
62
|
+
contentClassName?: string;
|
|
63
|
+
contentWrapperClassName?: string;
|
|
64
|
+
labelPlacement?: InputFrameLabelPlacement;
|
|
65
|
+
trailingClassName?: string;
|
|
66
|
+
}
|
|
67
|
+
export declare const InputFrame: ({ ref, children, formFieldRef, labelProps, headerProps, error, label, tooltipText, helperText, isRequired, rightContent, isDisabled, isHeaderHidden, hideLabel, headerClassName, errorClassName, className, leadingContent, leadingIcon, actionContent, trailingContent, trailingIcon, trailingAction, unit, isLoading, action, isClearable, showClear, renderStatic, onStaticInteract, clearClassName, onClear, dataAttributes, typographySize, inputClassName, contentClassName, contentWrapperClassName, labelPlacement, trailingClassName, variant, as, size, }: InputFrameProps) => import("react/jsx-runtime").JSX.Element;
|
|
68
|
+
export {};
|
|
@@ -0,0 +1,171 @@
|
|
|
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 { InlineIconButton } from "../../buttons/InlineIconButton/InlineIconButton.js";
|
|
5
|
+
import { FormFieldLabel } from "../FormField/FormFieldLabel.js";
|
|
6
|
+
import { InputClear } from "../shared/InputClear.js";
|
|
7
|
+
import { inputBase, inputContentWrapper, inputSize } from "../shared/input.cva.js";
|
|
8
|
+
import { FormField } from "../FormField/FormField.js";
|
|
9
|
+
import { TooltipWrapper } from "../shared/TooltipWrapper.js";
|
|
10
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
11
|
+
import { clsx } from "clsx";
|
|
12
|
+
import { isValidElement } from "react";
|
|
13
|
+
//#region src/components/inputs/Skeleton/InputFrame.tsx
|
|
14
|
+
var InputFrame = ({ ref, children, formFieldRef, labelProps, headerProps, error, label, tooltipText, helperText, isRequired, rightContent, isDisabled, isHeaderHidden, hideLabel, headerClassName, errorClassName, className, leadingContent, leadingIcon, actionContent, trailingContent, trailingIcon, trailingAction, unit, isLoading, action, isClearable, showClear, renderStatic, onStaticInteract, clearClassName, onClear, dataAttributes, typographySize, inputClassName, contentClassName, contentWrapperClassName, labelPlacement = "content-wrapper", trailingClassName, variant, as, size }) => {
|
|
15
|
+
const inputBaseCva = UIStyle.useCva("input.baseCva", inputBase);
|
|
16
|
+
const inputSizeCva = UIStyle.useCva("input.sizeCva", inputSize);
|
|
17
|
+
const inputContentWrapperCva = UIStyle.useCva("input.contentWrapperCva", inputContentWrapper);
|
|
18
|
+
const typographyCva = UIStyle.useCva("typography.cva", typography);
|
|
19
|
+
const hasClear = !!isClearable;
|
|
20
|
+
const isLeadingIconElement = leadingIcon && isValidElement(leadingIcon);
|
|
21
|
+
const isTrailingIconElement = trailingIcon && isValidElement(trailingIcon);
|
|
22
|
+
const hasTrailingContent = hasClear || !!trailingContent || !!unit || !!isLoading || !!action || !!trailingIcon || !!trailingAction;
|
|
23
|
+
const isTrailingInteractive = !!action || !!trailingAction || !!isTrailingIconElement || hasClear && !!showClear || !!trailingContent;
|
|
24
|
+
const dataAttributeProps = getInputFrameDataAttributeProps(dataAttributes);
|
|
25
|
+
const formFieldProps = {
|
|
26
|
+
error,
|
|
27
|
+
label: label ?? "",
|
|
28
|
+
tooltipText,
|
|
29
|
+
helperText,
|
|
30
|
+
isRequired,
|
|
31
|
+
rightContent,
|
|
32
|
+
isHeaderHidden: isHeaderHidden || as === "inline" || as === "filter" || as === "floating",
|
|
33
|
+
hideLabel,
|
|
34
|
+
isDisabled,
|
|
35
|
+
headerClassName,
|
|
36
|
+
errorClassName,
|
|
37
|
+
className
|
|
38
|
+
};
|
|
39
|
+
const resolvedHeaderProps = headerProps ?? {
|
|
40
|
+
label: label ?? "",
|
|
41
|
+
tooltipText,
|
|
42
|
+
helperText,
|
|
43
|
+
isRequired,
|
|
44
|
+
rightContent,
|
|
45
|
+
isHeaderHidden: hideLabel || isHeaderHidden,
|
|
46
|
+
isDisabled,
|
|
47
|
+
className: headerClassName,
|
|
48
|
+
labelProps
|
|
49
|
+
};
|
|
50
|
+
const labelContent = as && ["filter", "floating"].includes(as) ? /* @__PURE__ */ jsx(FormFieldLabel, {
|
|
51
|
+
as,
|
|
52
|
+
size,
|
|
53
|
+
...resolvedHeaderProps
|
|
54
|
+
}) : null;
|
|
55
|
+
const resolvedContentWrapperClassName = contentWrapperClassName ?? inputContentWrapperCva({ as });
|
|
56
|
+
return /* @__PURE__ */ jsx(TooltipWrapper, {
|
|
57
|
+
as,
|
|
58
|
+
error,
|
|
59
|
+
triggerTabIndex: as === "inline" ? -1 : void 0,
|
|
60
|
+
children: /* @__PURE__ */ jsx(FormField, {
|
|
61
|
+
...formFieldProps,
|
|
62
|
+
...dataAttributeProps,
|
|
63
|
+
ref: formFieldRef,
|
|
64
|
+
as,
|
|
65
|
+
labelProps,
|
|
66
|
+
tabIndex: as === "inline" ? -1 : void 0,
|
|
67
|
+
onMouseEnter: () => {
|
|
68
|
+
if (renderStatic) onStaticInteract?.(false);
|
|
69
|
+
},
|
|
70
|
+
onFocusCapture: () => {
|
|
71
|
+
if (renderStatic) onStaticInteract?.(true);
|
|
72
|
+
},
|
|
73
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
74
|
+
ref,
|
|
75
|
+
...dataAttributeProps,
|
|
76
|
+
className: clsx("relative flex cursor-text has-disabled:cursor-default", inputBaseCva({
|
|
77
|
+
variant,
|
|
78
|
+
as
|
|
79
|
+
}), inputClassName),
|
|
80
|
+
tabIndex: renderStatic ? isDisabled ? -1 : 0 : void 0,
|
|
81
|
+
onFocus: () => {
|
|
82
|
+
if (renderStatic) onStaticInteract?.(true);
|
|
83
|
+
},
|
|
84
|
+
onClick: () => {
|
|
85
|
+
if (renderStatic) onStaticInteract?.(true);
|
|
86
|
+
},
|
|
87
|
+
onPointerDown: () => {
|
|
88
|
+
if (renderStatic) onStaticInteract?.(true);
|
|
89
|
+
},
|
|
90
|
+
"data-rac": "",
|
|
91
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
92
|
+
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({
|
|
93
|
+
size,
|
|
94
|
+
as
|
|
95
|
+
}), typographySize && typographyCva({ size: typographySize }), contentClassName),
|
|
96
|
+
children: [
|
|
97
|
+
leadingContent,
|
|
98
|
+
leadingIcon && /* @__PURE__ */ jsx("div", {
|
|
99
|
+
className: clsx(!isLeadingIconElement && "pointer-events-none"),
|
|
100
|
+
children: renderIconVisual(leadingIcon)
|
|
101
|
+
}),
|
|
102
|
+
labelPlacement === "content-row" && labelContent,
|
|
103
|
+
/* @__PURE__ */ jsxs("div", {
|
|
104
|
+
className: resolvedContentWrapperClassName,
|
|
105
|
+
children: [
|
|
106
|
+
labelPlacement === "content-wrapper" && labelContent,
|
|
107
|
+
actionContent,
|
|
108
|
+
typeof children === "function" ? children(dataAttributeProps) : children
|
|
109
|
+
]
|
|
110
|
+
})
|
|
111
|
+
]
|
|
112
|
+
}), hasTrailingContent && /* @__PURE__ */ jsxs("div", {
|
|
113
|
+
className: clsx("flex items-center gap-input-gap-trailing-elements py-0! pl-0!", inputSizeCva({
|
|
114
|
+
size,
|
|
115
|
+
as
|
|
116
|
+
}), !isTrailingInteractive && "pointer-events-none", trailingClassName),
|
|
117
|
+
children: [
|
|
118
|
+
hasClear && /* @__PURE__ */ jsx(InputClear, {
|
|
119
|
+
onClear: () => onClear?.(),
|
|
120
|
+
className: clearClassName,
|
|
121
|
+
show: !!showClear,
|
|
122
|
+
renderStatic
|
|
123
|
+
}),
|
|
124
|
+
trailingContent,
|
|
125
|
+
unit && /* @__PURE__ */ jsx("span", {
|
|
126
|
+
className: typographyCva({
|
|
127
|
+
size: "label-2",
|
|
128
|
+
sizeMobile: "label-2",
|
|
129
|
+
variant: "prominent-1",
|
|
130
|
+
className: "text-text-default-3"
|
|
131
|
+
}),
|
|
132
|
+
children: unit
|
|
133
|
+
}),
|
|
134
|
+
isLoading && /* @__PURE__ */ jsx("div", {
|
|
135
|
+
className: "inline-flex",
|
|
136
|
+
children: /* @__PURE__ */ jsx(Loader, {})
|
|
137
|
+
}),
|
|
138
|
+
!isLoading && action && /* @__PURE__ */ jsx(InlineIconButton, {
|
|
139
|
+
color: "secondary",
|
|
140
|
+
icon: action.icon,
|
|
141
|
+
isDisabled,
|
|
142
|
+
onPress: action.onClick,
|
|
143
|
+
excludeFromTabOrder: true,
|
|
144
|
+
label: action.altText,
|
|
145
|
+
className: clsx("border-0!", action.className)
|
|
146
|
+
}),
|
|
147
|
+
!isLoading && !action && trailingIcon && renderIconVisual(trailingIcon),
|
|
148
|
+
trailingAction
|
|
149
|
+
]
|
|
150
|
+
})]
|
|
151
|
+
})
|
|
152
|
+
})
|
|
153
|
+
});
|
|
154
|
+
};
|
|
155
|
+
var renderIconVisual = (icon) => {
|
|
156
|
+
if (isValidElement(icon)) return icon;
|
|
157
|
+
return /* @__PURE__ */ jsx(icon, { className: "size-6 text-interactive-text-secondary-idle" });
|
|
158
|
+
};
|
|
159
|
+
var getInputFrameDataAttributeProps = (dataAttributes) => ({
|
|
160
|
+
"data-is-empty": dataAttributes?.dataIsEmpty || void 0,
|
|
161
|
+
"data-is-filled": dataAttributes?.dataIsFilled || void 0,
|
|
162
|
+
"data-is-dirty": dataAttributes?.dataIsDirty || void 0,
|
|
163
|
+
"data-is-required": dataAttributes?.dataIsRequired || void 0,
|
|
164
|
+
"data-is-disabled": dataAttributes?.dataIsDisabled || void 0,
|
|
165
|
+
"data-disabled": dataAttributes?.dataDisabled || void 0,
|
|
166
|
+
"data-has-search": dataAttributes?.dataHasSearch || void 0,
|
|
167
|
+
"data-invalid": dataAttributes?.dataInvalid || void 0,
|
|
168
|
+
"data-has-selection": dataAttributes?.dataHasSelection || void 0
|
|
169
|
+
});
|
|
170
|
+
//#endregion
|
|
171
|
+
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,
|