@povio/ui 2.3.0-rc.3 → 2.3.0-rc.4
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/inputs/Input/TextInput/TextInput.js +3 -2
- package/dist/components/inputs/Selection/Autocomplete/QueryAutocomplete.js +1 -0
- package/dist/components/inputs/Selection/Select/Select.js +2 -1
- package/dist/components/inputs/shared/useStaticInputHandoff.d.ts +1 -0
- package/dist/components/inputs/shared/useStaticInputHandoff.js +12 -2
- package/dist/components/table/Table.js +5 -4
- package/package.json +1 -1
|
@@ -26,13 +26,14 @@ var TextInputBase = (props) => {
|
|
|
26
26
|
const isClearable = isClearableProp ?? ui.input.isClearable;
|
|
27
27
|
const textFieldRef = useRef(null);
|
|
28
28
|
const { isFocusVisible } = useFocusVisible();
|
|
29
|
+
const inputValue = value ?? "";
|
|
29
30
|
const { labelProps, inputProps } = useTextField({
|
|
30
31
|
...rest,
|
|
31
32
|
label,
|
|
32
33
|
isDisabled,
|
|
33
34
|
isInvalid: !!error,
|
|
34
35
|
isRequired,
|
|
35
|
-
value,
|
|
36
|
+
value: inputValue,
|
|
36
37
|
onChange,
|
|
37
38
|
onBlur
|
|
38
39
|
}, textFieldRef);
|
|
@@ -61,7 +62,7 @@ var TextInputBase = (props) => {
|
|
|
61
62
|
leadingIcon,
|
|
62
63
|
trailingIcon,
|
|
63
64
|
isClearable,
|
|
64
|
-
value,
|
|
65
|
+
value: inputValue,
|
|
65
66
|
onChange,
|
|
66
67
|
onBlur
|
|
67
68
|
};
|
|
@@ -6,6 +6,7 @@ import { jsx } from "react/jsx-runtime";
|
|
|
6
6
|
import { useState } from "react";
|
|
7
7
|
//#region src/components/inputs/Selection/Autocomplete/QueryAutocomplete.tsx
|
|
8
8
|
var QueryAutocomplete = ({ query, queryParams, queryOptions, queryMap, leadingContent, ...props }) => {
|
|
9
|
+
"use no memo";
|
|
9
10
|
const ui = UIConfig.useConfig();
|
|
10
11
|
const [search, setSearch] = useState("");
|
|
11
12
|
const { onChange, ...restProps } = props;
|
|
@@ -34,7 +34,7 @@ function Select({ renderStaticInput, ...props }) {
|
|
|
34
34
|
const ui = UIConfig.useConfig();
|
|
35
35
|
const [renderInput, setRenderInput] = useState(!(renderStaticInput ?? ui.renderStaticInput));
|
|
36
36
|
const rootRef = useRef(null);
|
|
37
|
-
const { renderRealInput, replayStaticInputChange } = useStaticInputHandoff({
|
|
37
|
+
const { renderRealInput, replayStaticInputChange, replayStaticInputPress } = useStaticInputHandoff({
|
|
38
38
|
inputRef: rootRef,
|
|
39
39
|
renderInput,
|
|
40
40
|
setRenderInput,
|
|
@@ -121,6 +121,7 @@ function Select({ renderStaticInput, ...props }) {
|
|
|
121
121
|
tabIndex: -1,
|
|
122
122
|
"data-type": "select-trigger",
|
|
123
123
|
className: clsx("w-full truncate bg-transparent text-start outline-none disabled:text-interactive-text-secondary-disabled", isMultiple && !isEmpty && "absolute inset-0 z-0"),
|
|
124
|
+
onPointerDown: replayStaticInputPress,
|
|
124
125
|
...dataAttributeProps,
|
|
125
126
|
"data-rac": true,
|
|
126
127
|
children: buttonContent
|
|
@@ -3,18 +3,23 @@ import { useLayoutEffect, useRef, useState } from "react";
|
|
|
3
3
|
var useStaticInputHandoff = ({ inputRef, renderInput, setRenderInput, getFocusTarget }) => {
|
|
4
4
|
const [shouldFocus, setShouldFocus] = useState(false);
|
|
5
5
|
const pendingStaticChangeRef = useRef(null);
|
|
6
|
+
const shouldReplayStaticPressRef = useRef(false);
|
|
6
7
|
useLayoutEffect(() => {
|
|
7
8
|
if (!renderInput || !shouldFocus) return;
|
|
8
|
-
const focusRealInput = (
|
|
9
|
+
const focusRealInput = (replayPendingInteraction) => {
|
|
9
10
|
const input = inputRef.current;
|
|
10
11
|
const pendingValue = pendingStaticChangeRef.current;
|
|
11
12
|
const focusTarget = input ? getFocusTarget?.(input) ?? input : null;
|
|
12
|
-
if (
|
|
13
|
+
if (replayPendingInteraction && focusTarget instanceof HTMLInputElement && pendingValue != null) {
|
|
13
14
|
(Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype, "value")?.set)?.call(focusTarget, pendingValue);
|
|
14
15
|
focusTarget.dispatchEvent(new Event("input", { bubbles: true }));
|
|
15
16
|
pendingStaticChangeRef.current = null;
|
|
16
17
|
}
|
|
17
18
|
focusTarget?.focus();
|
|
19
|
+
if (replayPendingInteraction && shouldReplayStaticPressRef.current) {
|
|
20
|
+
shouldReplayStaticPressRef.current = false;
|
|
21
|
+
focusTarget?.click();
|
|
22
|
+
}
|
|
18
23
|
};
|
|
19
24
|
focusRealInput(true);
|
|
20
25
|
const frame = requestAnimationFrame(() => {
|
|
@@ -40,6 +45,11 @@ var useStaticInputHandoff = ({ inputRef, renderInput, setRenderInput, getFocusTa
|
|
|
40
45
|
pendingStaticChangeRef.current = value;
|
|
41
46
|
setShouldFocus(true);
|
|
42
47
|
setRenderInput(true);
|
|
48
|
+
},
|
|
49
|
+
replayStaticInputPress: () => {
|
|
50
|
+
shouldReplayStaticPressRef.current = true;
|
|
51
|
+
setShouldFocus(true);
|
|
52
|
+
setRenderInput(true);
|
|
43
53
|
}
|
|
44
54
|
};
|
|
45
55
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
"use no memo";
|
|
1
2
|
import { ChevronDownIcon } from "../../assets/icons/ChevronDown.js";
|
|
2
3
|
import { ChevronUpIcon } from "../../assets/icons/ChevronUp.js";
|
|
3
4
|
import { UIStyle } from "../../config/uiStyle.context.js";
|
|
@@ -26,8 +27,8 @@ var CustomCellContext = (context) => {
|
|
|
26
27
|
value: context.getValue()
|
|
27
28
|
};
|
|
28
29
|
};
|
|
29
|
-
var
|
|
30
|
-
const rendered =
|
|
30
|
+
var renderCell = (Comp, props) => {
|
|
31
|
+
const rendered = flexRender(Comp, props);
|
|
31
32
|
return typeof rendered === "string" ? /* @__PURE__ */ jsx(CellText, { children: rendered }) : rendered;
|
|
32
33
|
};
|
|
33
34
|
var RowDragHandleCell = ({ rowId }) => {
|
|
@@ -68,7 +69,7 @@ var DraggableRow = ({ row, showCellBorder, onRowClick, onDoubleClick, tableRowCv
|
|
|
68
69
|
return /* @__PURE__ */ jsx("td", {
|
|
69
70
|
tabIndex: -1,
|
|
70
71
|
className: clsx(tableDataCva({ hasRightBorder: cellIndex > 0 && showCellBorder }), columnMeta.cellClass, columnMeta.width),
|
|
71
|
-
children:
|
|
72
|
+
children: renderCell(cell.column.columnDef.cell, CustomCellContext(cell.getContext()))
|
|
72
73
|
}, cell.id);
|
|
73
74
|
})
|
|
74
75
|
});
|
|
@@ -245,7 +246,7 @@ var Table = ({ items, showCellBorder, columns, onRowClick, onDoubleClick, classN
|
|
|
245
246
|
return /* @__PURE__ */ jsx("td", {
|
|
246
247
|
tabIndex: -1,
|
|
247
248
|
className: clsx(tableDataCva({ hasRightBorder: cellIndex > 0 && showCellBorder }), columnMeta.cellClass, columnMeta.width),
|
|
248
|
-
children:
|
|
249
|
+
children: renderCell(cell.column.columnDef.cell, CustomCellContext(cell.getContext()))
|
|
249
250
|
}, cell.id);
|
|
250
251
|
})
|
|
251
252
|
}, row.id);
|