@dloizides/ui-forms 1.55.0 → 1.57.0
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/index.d.mts +25 -6
- package/dist/index.d.ts +25 -6
- package/dist/index.js +271 -238
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +79 -47
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var React41 = require('react');
|
|
4
4
|
var reactNative = require('react-native');
|
|
5
5
|
var uiFeedback = require('@dloizides/ui-feedback');
|
|
6
6
|
var jsxRuntime = require('react/jsx-runtime');
|
|
@@ -14,12 +14,12 @@ var apiClientBase = require('@dloizides/api-client-base');
|
|
|
14
14
|
|
|
15
15
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
16
16
|
|
|
17
|
-
var
|
|
17
|
+
var React41__default = /*#__PURE__*/_interopDefault(React41);
|
|
18
18
|
var Svg__default = /*#__PURE__*/_interopDefault(Svg);
|
|
19
19
|
|
|
20
20
|
// src/Field/Field.tsx
|
|
21
21
|
function attachControlId(child, candidateId, describedById) {
|
|
22
|
-
if (!
|
|
22
|
+
if (!React41__default.default.isValidElement(child) || child.type === React41__default.default.Fragment) {
|
|
23
23
|
return { node: child };
|
|
24
24
|
}
|
|
25
25
|
const props = child.props;
|
|
@@ -30,15 +30,15 @@ function attachControlId(child, candidateId, describedById) {
|
|
|
30
30
|
if (describedById !== void 0 && props.describedById === void 0) {
|
|
31
31
|
injected.describedById = describedById;
|
|
32
32
|
}
|
|
33
|
-
return { node:
|
|
33
|
+
return { node: React41__default.default.cloneElement(element, injected), controlId };
|
|
34
34
|
}
|
|
35
35
|
var IS_WEB = reactNative.Platform.OS === "web";
|
|
36
36
|
function isAttributeHost(node) {
|
|
37
37
|
return typeof node === "object" && node !== null && typeof node.setAttribute === "function";
|
|
38
38
|
}
|
|
39
39
|
function useHtmlFor(controlId) {
|
|
40
|
-
const ref =
|
|
41
|
-
|
|
40
|
+
const ref = React41.useRef(null);
|
|
41
|
+
React41.useEffect(() => {
|
|
42
42
|
const node = ref.current;
|
|
43
43
|
if (!IS_WEB || !isAttributeHost(node)) return;
|
|
44
44
|
const target = controlId !== void 0 && controlId !== "" ? node.ownerDocument?.getElementById(controlId) : null;
|
|
@@ -148,15 +148,15 @@ var labelVariantStyles = reactNative.StyleSheet.create({
|
|
|
148
148
|
function resolveLabelVariantStyle(variant) {
|
|
149
149
|
return labelVariantStyles[variant ?? "field"] ?? labelVariantStyles.field;
|
|
150
150
|
}
|
|
151
|
-
var FormGridContext =
|
|
152
|
-
var GapOwnedContext =
|
|
151
|
+
var FormGridContext = React41__default.default.createContext(null);
|
|
152
|
+
var GapOwnedContext = React41__default.default.createContext(false);
|
|
153
153
|
var FormGridProvider = FormGridContext.Provider;
|
|
154
154
|
var GapOwnedProvider = GapOwnedContext.Provider;
|
|
155
155
|
function useFormGridMetrics() {
|
|
156
|
-
return
|
|
156
|
+
return React41__default.default.useContext(FormGridContext);
|
|
157
157
|
}
|
|
158
158
|
function useIsGapOwned() {
|
|
159
|
-
return
|
|
159
|
+
return React41__default.default.useContext(GapOwnedContext);
|
|
160
160
|
}
|
|
161
161
|
var ERROR_LIGHT_STEPS = ["500", "600", "700"];
|
|
162
162
|
var ERROR_DARK_STEPS = ["300", "200", "400", "100", "500"];
|
|
@@ -179,7 +179,7 @@ var styles = reactNative.StyleSheet.create({
|
|
|
179
179
|
});
|
|
180
180
|
var fieldSeq = 0;
|
|
181
181
|
function useFieldIds() {
|
|
182
|
-
const [ids] =
|
|
182
|
+
const [ids] = React41__default.default.useState(() => {
|
|
183
183
|
fieldSeq += 1;
|
|
184
184
|
const seq = String(fieldSeq);
|
|
185
185
|
return {
|
|
@@ -226,7 +226,7 @@ var Field = ({
|
|
|
226
226
|
const hasLabel = labelText !== "";
|
|
227
227
|
const marker = resolveFieldMarker(required, optional);
|
|
228
228
|
const { hintId, errorId, controlId, labelId } = useFieldIds();
|
|
229
|
-
const themeStyles =
|
|
229
|
+
const themeStyles = React41__default.default.useMemo(
|
|
230
230
|
() => ({
|
|
231
231
|
label: { color: colors.textSecondary },
|
|
232
232
|
requiredMark: { color: errorColor },
|
|
@@ -278,7 +278,7 @@ var FormGrid = ({
|
|
|
278
278
|
style,
|
|
279
279
|
testID
|
|
280
280
|
}) => {
|
|
281
|
-
const metrics =
|
|
281
|
+
const metrics = React41__default.default.useMemo(() => ({ minWidth, basis }), [minWidth, basis]);
|
|
282
282
|
return /* @__PURE__ */ jsxRuntime.jsx(FormGridProvider, { value: metrics, children: /* @__PURE__ */ jsxRuntime.jsx(GapOwnedProvider, { value: true, children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: [styles2.grid, { gap }, style], testID, children }) }) });
|
|
283
283
|
};
|
|
284
284
|
var LABEL_LINE_PLACEHOLDER = "\xA0";
|
|
@@ -363,8 +363,8 @@ var InlineFieldRow = ({
|
|
|
363
363
|
}) => {
|
|
364
364
|
const { width } = reactNative.useWindowDimensions();
|
|
365
365
|
const layout = inlineFieldRowLayout(width, fieldMaxWidth, inlineMinWidth);
|
|
366
|
-
const rowStyle =
|
|
367
|
-
const fieldStyle =
|
|
366
|
+
const rowStyle = React41.useMemo(() => [styles4.row, { gap }], [gap]);
|
|
367
|
+
const fieldStyle = React41.useMemo(() => [styles4.field, { maxWidth: layout.fieldMaxWidth }], [layout.fieldMaxWidth]);
|
|
368
368
|
if (!layout.inline)
|
|
369
369
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
370
370
|
field2,
|
|
@@ -545,7 +545,7 @@ var styles9 = reactNative.StyleSheet.create({
|
|
|
545
545
|
});
|
|
546
546
|
var sectionSeq = 0;
|
|
547
547
|
function useSectionLegendId() {
|
|
548
|
-
const [id] =
|
|
548
|
+
const [id] = React41__default.default.useState(() => {
|
|
549
549
|
sectionSeq += 1;
|
|
550
550
|
return `form-section-legend-${String(sectionSeq)}`;
|
|
551
551
|
});
|
|
@@ -803,8 +803,8 @@ function horizontalPlacement(rect2, viewportWidth) {
|
|
|
803
803
|
return { left, width };
|
|
804
804
|
}
|
|
805
805
|
function useAnchorRect(ref, enabled) {
|
|
806
|
-
const [rect2, setRect] =
|
|
807
|
-
|
|
806
|
+
const [rect2, setRect] = React41.useState(null);
|
|
807
|
+
React41.useLayoutEffect(() => {
|
|
808
808
|
if (!IS_WEB3 || !enabled) {
|
|
809
809
|
setRect(null);
|
|
810
810
|
return void 0;
|
|
@@ -853,8 +853,8 @@ function readViewportBottom() {
|
|
|
853
853
|
return viewport === null ? window.innerHeight : viewport.offsetTop + viewport.height;
|
|
854
854
|
}
|
|
855
855
|
function useVisualViewportBottom(enabled) {
|
|
856
|
-
const [bottom, setBottom] =
|
|
857
|
-
|
|
856
|
+
const [bottom, setBottom] = React41.useState(null);
|
|
857
|
+
React41.useLayoutEffect(() => {
|
|
858
858
|
if (!IS_WEB3 || !enabled) {
|
|
859
859
|
setBottom(null);
|
|
860
860
|
return void 0;
|
|
@@ -884,7 +884,7 @@ function scrollAnchorIntoView(ref, marginTop) {
|
|
|
884
884
|
scrollNodeIntoView(node, anchorScrollBlock(node.getBoundingClientRect().bottom, readViewportBottom()));
|
|
885
885
|
}
|
|
886
886
|
function useKeepAnchorInRoom(ref, marginTop, enabled) {
|
|
887
|
-
|
|
887
|
+
React41.useLayoutEffect(() => {
|
|
888
888
|
if (!IS_WEB3 || !enabled) return void 0;
|
|
889
889
|
const place = () => scrollAnchorIntoView(ref, marginTop);
|
|
890
890
|
place();
|
|
@@ -898,7 +898,7 @@ var ESCAPE_KEY = "Escape";
|
|
|
898
898
|
var LISTBOX_ROLE = { role: "listbox" };
|
|
899
899
|
var KEEP_FIELD_FOCUS = { onMouseDown: (event) => event.preventDefault() };
|
|
900
900
|
function useDismiss(anchorRef, menuRef, onDismiss) {
|
|
901
|
-
|
|
901
|
+
React41.useEffect(() => {
|
|
902
902
|
if (!IS_WEB4) return void 0;
|
|
903
903
|
const onMouseDown = (event) => {
|
|
904
904
|
const anchorNode = anchorRef.current;
|
|
@@ -920,7 +920,7 @@ function useDismiss(anchorRef, menuRef, onDismiss) {
|
|
|
920
920
|
}, [anchorRef, menuRef, onDismiss]);
|
|
921
921
|
}
|
|
922
922
|
function useKeepHighlightInView(testID, highlightedValue) {
|
|
923
|
-
|
|
923
|
+
React41.useEffect(() => {
|
|
924
924
|
if (!IS_WEB4 || highlightedValue === void 0 || highlightedValue === "") return;
|
|
925
925
|
scrollNodeIntoView(document.getElementById(optionDomId(testID, highlightedValue)), "nearest");
|
|
926
926
|
}, [testID, highlightedValue]);
|
|
@@ -939,7 +939,7 @@ function AnchoredMenu({
|
|
|
939
939
|
listbox,
|
|
940
940
|
placement
|
|
941
941
|
}) {
|
|
942
|
-
const menuRef =
|
|
942
|
+
const menuRef = React41__default.default.useRef(null);
|
|
943
943
|
useDismiss(anchorRef, menuRef, onDismiss);
|
|
944
944
|
useKeepHighlightInView(testID, listbox?.highlightedValue);
|
|
945
945
|
const rect2 = useAnchorRect(placement?.positionRef ?? anchorRef, usePortal);
|
|
@@ -1014,27 +1014,27 @@ function useThemedInput(options = {}) {
|
|
|
1014
1014
|
const { hasError = false, onFocus, onBlur, editable = true } = options;
|
|
1015
1015
|
const { theme } = uiFeedback.useUi();
|
|
1016
1016
|
const { colors, palette } = theme;
|
|
1017
|
-
const [isFocused, setIsFocused] =
|
|
1018
|
-
const [isHovered, setIsHovered] =
|
|
1019
|
-
const handleFocus =
|
|
1017
|
+
const [isFocused, setIsFocused] = React41.useState(false);
|
|
1018
|
+
const [isHovered, setIsHovered] = React41.useState(false);
|
|
1019
|
+
const handleFocus = React41.useCallback(
|
|
1020
1020
|
(e) => {
|
|
1021
1021
|
setIsFocused(true);
|
|
1022
1022
|
onFocus?.(e);
|
|
1023
1023
|
},
|
|
1024
1024
|
[onFocus]
|
|
1025
1025
|
);
|
|
1026
|
-
const handleBlur =
|
|
1026
|
+
const handleBlur = React41.useCallback(
|
|
1027
1027
|
(e) => {
|
|
1028
1028
|
setIsFocused(false);
|
|
1029
1029
|
onBlur?.(e);
|
|
1030
1030
|
},
|
|
1031
1031
|
[onBlur]
|
|
1032
1032
|
);
|
|
1033
|
-
const handleHoverIn =
|
|
1034
|
-
const handleHoverOut =
|
|
1033
|
+
const handleHoverIn = React41.useCallback(() => setIsHovered(true), []);
|
|
1034
|
+
const handleHoverOut = React41.useCallback(() => setIsHovered(false), []);
|
|
1035
1035
|
const primary = palette.primary["500"];
|
|
1036
1036
|
const errorColor = fieldErrorInk(theme);
|
|
1037
|
-
const style =
|
|
1037
|
+
const style = React41.useMemo(() => {
|
|
1038
1038
|
const restBorder = hasError ? errorColor : colors.border;
|
|
1039
1039
|
const focusBorder = hasError ? errorColor : primary;
|
|
1040
1040
|
const editableBorder = isFocused ? focusBorder : isHovered ? withAlpha(colors.text, HOVER_BORDER_ALPHA) : restBorder;
|
|
@@ -1067,8 +1067,8 @@ function useThemedInput(options = {}) {
|
|
|
1067
1067
|
errorColor,
|
|
1068
1068
|
theme
|
|
1069
1069
|
]);
|
|
1070
|
-
const focusBind =
|
|
1071
|
-
const hoverBind =
|
|
1070
|
+
const focusBind = React41.useMemo(() => ({ onFocus: handleFocus, onBlur: handleBlur }), [handleFocus, handleBlur]);
|
|
1071
|
+
const hoverBind = React41.useMemo(
|
|
1072
1072
|
() => IS_WEB5 ? { onMouseEnter: handleHoverIn, onMouseLeave: handleHoverOut } : {},
|
|
1073
1073
|
[handleHoverIn, handleHoverOut]
|
|
1074
1074
|
);
|
|
@@ -1099,7 +1099,7 @@ var boxStyles = reactNative.StyleSheet.create({
|
|
|
1099
1099
|
textAlignVertical: "top"
|
|
1100
1100
|
}
|
|
1101
1101
|
});
|
|
1102
|
-
var ThemedTextInput =
|
|
1102
|
+
var ThemedTextInput = React41__default.default.forwardRef(function ThemedTextInput2({
|
|
1103
1103
|
hasError = false,
|
|
1104
1104
|
describedById,
|
|
1105
1105
|
requiredField = false,
|
|
@@ -1194,11 +1194,11 @@ function recentsEqual(a, b) {
|
|
|
1194
1194
|
|
|
1195
1195
|
// src/useRecentValues/useRecentValues.ts
|
|
1196
1196
|
function useRecentValues(key, max = DEFAULT_MAX_RECENTS) {
|
|
1197
|
-
const [recents, setRecents] =
|
|
1198
|
-
|
|
1197
|
+
const [recents, setRecents] = React41.useState(() => readRecents(key).slice(0, max));
|
|
1198
|
+
React41.useEffect(() => {
|
|
1199
1199
|
setRecents(readRecents(key).slice(0, max));
|
|
1200
1200
|
}, [key, max]);
|
|
1201
|
-
const remember =
|
|
1201
|
+
const remember = React41.useCallback(
|
|
1202
1202
|
(value) => {
|
|
1203
1203
|
setRecents((current) => {
|
|
1204
1204
|
const next = computeNextRecents(current, value, max);
|
|
@@ -1209,7 +1209,7 @@ function useRecentValues(key, max = DEFAULT_MAX_RECENTS) {
|
|
|
1209
1209
|
},
|
|
1210
1210
|
[key, max]
|
|
1211
1211
|
);
|
|
1212
|
-
const clear =
|
|
1212
|
+
const clear = React41.useCallback(() => {
|
|
1213
1213
|
clearRecents(key);
|
|
1214
1214
|
setRecents([]);
|
|
1215
1215
|
}, [key]);
|
|
@@ -1231,24 +1231,24 @@ function RecentInputField({
|
|
|
1231
1231
|
const { theme } = uiFeedback.useUi();
|
|
1232
1232
|
const { colors, palette } = theme;
|
|
1233
1233
|
const { recents, remember } = useRecentValues(recentKey, recentMax);
|
|
1234
|
-
const anchorRef =
|
|
1235
|
-
const latestText =
|
|
1236
|
-
const [isOpen, setIsOpen] =
|
|
1237
|
-
const handleChange =
|
|
1234
|
+
const anchorRef = React41.useRef(null);
|
|
1235
|
+
const latestText = React41.useRef(typeof value === "string" ? value : "");
|
|
1236
|
+
const [isOpen, setIsOpen] = React41.useState(false);
|
|
1237
|
+
const handleChange = React41.useCallback(
|
|
1238
1238
|
(text) => {
|
|
1239
1239
|
latestText.current = text;
|
|
1240
1240
|
onChangeText?.(text);
|
|
1241
1241
|
},
|
|
1242
1242
|
[onChangeText]
|
|
1243
1243
|
);
|
|
1244
|
-
const handleFocus =
|
|
1244
|
+
const handleFocus = React41.useCallback(
|
|
1245
1245
|
(event) => {
|
|
1246
1246
|
setIsOpen(true);
|
|
1247
1247
|
onFocus?.(event);
|
|
1248
1248
|
},
|
|
1249
1249
|
[onFocus]
|
|
1250
1250
|
);
|
|
1251
|
-
const handleBlur =
|
|
1251
|
+
const handleBlur = React41.useCallback(
|
|
1252
1252
|
(event) => {
|
|
1253
1253
|
const blurredText = latestText.current;
|
|
1254
1254
|
setTimeout(() => {
|
|
@@ -1259,7 +1259,7 @@ function RecentInputField({
|
|
|
1259
1259
|
},
|
|
1260
1260
|
[remember, onBlur]
|
|
1261
1261
|
);
|
|
1262
|
-
const handleSubmit =
|
|
1262
|
+
const handleSubmit = React41.useCallback(
|
|
1263
1263
|
(event) => {
|
|
1264
1264
|
remember(latestText.current);
|
|
1265
1265
|
setIsOpen(false);
|
|
@@ -1267,7 +1267,7 @@ function RecentInputField({
|
|
|
1267
1267
|
},
|
|
1268
1268
|
[remember, onSubmitEditing]
|
|
1269
1269
|
);
|
|
1270
|
-
const pick =
|
|
1270
|
+
const pick = React41.useCallback(
|
|
1271
1271
|
(picked) => {
|
|
1272
1272
|
latestText.current = picked;
|
|
1273
1273
|
onChangeText?.(picked);
|
|
@@ -1323,8 +1323,8 @@ function rowsForText(text, inputWidth, minRows) {
|
|
|
1323
1323
|
|
|
1324
1324
|
// src/FormField/useAutoGrowRows.ts
|
|
1325
1325
|
function useAutoGrowRows(text, minRows) {
|
|
1326
|
-
const [inputWidth, setInputWidth] =
|
|
1327
|
-
const onLayout =
|
|
1326
|
+
const [inputWidth, setInputWidth] = React41.useState(NARROWEST_INPUT_WIDTH);
|
|
1327
|
+
const onLayout = React41.useCallback((event) => {
|
|
1328
1328
|
setInputWidth(event.nativeEvent.layout.width);
|
|
1329
1329
|
}, []);
|
|
1330
1330
|
return { numberOfLines: rowsForText(text, inputWidth, minRows), onLayout };
|
|
@@ -1561,7 +1561,7 @@ function ChipContent(props) {
|
|
|
1561
1561
|
}
|
|
1562
1562
|
function OutlineChip(props) {
|
|
1563
1563
|
const { option, selected, disabled, colors, testID, accessibilityHint, onPress } = props;
|
|
1564
|
-
const [hovered, setHovered] =
|
|
1564
|
+
const [hovered, setHovered] = React41__default.default.useState(false);
|
|
1565
1565
|
const active = selected || hovered;
|
|
1566
1566
|
const borderColor = active ? colors.primary : restBorderColor(colors, props.outlineTone);
|
|
1567
1567
|
const fill = chipFill({
|
|
@@ -1677,8 +1677,8 @@ function radioTabIndex(index, selectedIndex, disabled) {
|
|
|
1677
1677
|
var NO_GROUP_PROPS = {};
|
|
1678
1678
|
function useRadioKeyboard(config) {
|
|
1679
1679
|
const { enabled, disabled, values, selectedIndex, onChange } = config;
|
|
1680
|
-
const nodes =
|
|
1681
|
-
const chipRef =
|
|
1680
|
+
const nodes = React41__default.default.useRef([]);
|
|
1681
|
+
const chipRef = React41__default.default.useCallback((index) => (node) => {
|
|
1682
1682
|
nodes.current[index] = node;
|
|
1683
1683
|
}, []);
|
|
1684
1684
|
const onKeyDown = (event) => {
|
|
@@ -1797,7 +1797,7 @@ var ChipSelector = ({
|
|
|
1797
1797
|
const isRadioGroup = !multiple && singleSelectRole === "radio";
|
|
1798
1798
|
const { theme } = uiFeedback.useUi();
|
|
1799
1799
|
const { colors, palette } = theme;
|
|
1800
|
-
const chipColors =
|
|
1800
|
+
const chipColors = React41__default.default.useMemo(() => buildChipColors(colors, palette), [colors, palette]);
|
|
1801
1801
|
function isSelected(optionValue) {
|
|
1802
1802
|
if (multiple && Array.isArray(value))
|
|
1803
1803
|
return value.includes(optionValue);
|
|
@@ -1922,10 +1922,10 @@ var FormSwitchBox = ({
|
|
|
1922
1922
|
}) => {
|
|
1923
1923
|
const { colors } = uiFeedback.useUi().theme;
|
|
1924
1924
|
const { disabled, onValueChange, value } = slot;
|
|
1925
|
-
const toggle2 =
|
|
1925
|
+
const toggle2 = React41__default.default.useCallback(() => {
|
|
1926
1926
|
if (!disabled) onValueChange(!value);
|
|
1927
1927
|
}, [disabled, onValueChange, value]);
|
|
1928
|
-
const boxColors =
|
|
1928
|
+
const boxColors = React41__default.default.useMemo(
|
|
1929
1929
|
() => ({ borderColor: colors.border, backgroundColor: colors.surface }),
|
|
1930
1930
|
[colors.border, colors.surface]
|
|
1931
1931
|
);
|
|
@@ -1979,12 +1979,12 @@ var FormSwitchRow = ({
|
|
|
1979
1979
|
activeTrackColor
|
|
1980
1980
|
}) => {
|
|
1981
1981
|
const { theme } = uiFeedback.useUi();
|
|
1982
|
-
const toggle2 =
|
|
1982
|
+
const toggle2 = React41__default.default.useCallback(() => {
|
|
1983
1983
|
if (!disabled) onValueChange(!value);
|
|
1984
1984
|
}, [disabled, onValueChange, value]);
|
|
1985
1985
|
const { colors } = theme;
|
|
1986
1986
|
const hasDescription = typeof description === "string" && description !== "";
|
|
1987
|
-
const themeStyles =
|
|
1987
|
+
const themeStyles = React41__default.default.useMemo(() => {
|
|
1988
1988
|
const labelStyle = { color: colors.text };
|
|
1989
1989
|
const descriptionStyle = { color: colors.textSecondary };
|
|
1990
1990
|
return { label: labelStyle, description: descriptionStyle };
|
|
@@ -2036,6 +2036,17 @@ var FormSwitch = ({
|
|
|
2036
2036
|
}) => variant === "box" ? /* @__PURE__ */ jsxRuntime.jsx(FormSwitchBox, { ...props, disabled, stateLabel, testID }) : /* @__PURE__ */ jsxRuntime.jsx(FormSwitchRow, { ...props, disabled, testID });
|
|
2037
2037
|
var checkboxBoxColors = (colors, brand, checked) => checked ? { backgroundColor: brand, borderColor: brand } : { backgroundColor: "transparent", borderColor: colors.textSecondary };
|
|
2038
2038
|
var checkboxTickColor = (brand) => designTokens.resolveOnBrand(brand);
|
|
2039
|
+
var COMPACT_BOX = { width: 16, height: 16, borderRadius: 4, borderWidth: 1.5 };
|
|
2040
|
+
var CheckboxLookContext = React41.createContext("default");
|
|
2041
|
+
function CheckboxLookProvider({ look, children }) {
|
|
2042
|
+
return /* @__PURE__ */ jsxRuntime.jsx(CheckboxLookContext.Provider, { value: look, children });
|
|
2043
|
+
}
|
|
2044
|
+
function checkboxLookBox(look) {
|
|
2045
|
+
return look === "compact" ? COMPACT_BOX : void 0;
|
|
2046
|
+
}
|
|
2047
|
+
function useCheckboxLookBox() {
|
|
2048
|
+
return checkboxLookBox(React41.useContext(CheckboxLookContext));
|
|
2049
|
+
}
|
|
2039
2050
|
var ACTIVATION_KEYS = ["Enter", " ", "Spacebar"];
|
|
2040
2051
|
var HINT_FONT_SIZE2 = 12;
|
|
2041
2052
|
var BOX_SIZE = 20;
|
|
@@ -2119,14 +2130,15 @@ var FormCheckbox = ({
|
|
|
2119
2130
|
accessibilityHint,
|
|
2120
2131
|
labelHidden = false
|
|
2121
2132
|
}) => {
|
|
2133
|
+
const lookBox = useCheckboxLookBox();
|
|
2122
2134
|
const { theme } = uiFeedback.useUi();
|
|
2123
2135
|
const { colors, palette } = theme;
|
|
2124
2136
|
const brand = palette.primary["500"];
|
|
2125
2137
|
const hintText = typeof hint === "string" && hint !== "" ? hint : description;
|
|
2126
2138
|
const hasHint = typeof hintText === "string" && hintText !== "";
|
|
2127
2139
|
const { hintId } = useFieldIds();
|
|
2128
|
-
const [focused, setFocused] =
|
|
2129
|
-
const themeStyles =
|
|
2140
|
+
const [focused, setFocused] = React41__default.default.useState(false);
|
|
2141
|
+
const themeStyles = React41__default.default.useMemo(() => {
|
|
2130
2142
|
const boxOn = checkboxBoxColors(colors, brand, true);
|
|
2131
2143
|
const boxOff = checkboxBoxColors(colors, brand, false);
|
|
2132
2144
|
const ring = { borderColor: brand };
|
|
@@ -2173,7 +2185,7 @@ var FormCheckbox = ({
|
|
|
2173
2185
|
testID,
|
|
2174
2186
|
...keyboardProps,
|
|
2175
2187
|
children: [
|
|
2176
|
-
/* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: [styles17.box, value ? themeStyles.boxOn : themeStyles.boxOff], testID: `${testID}-box`, children: [
|
|
2188
|
+
/* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: [styles17.box, lookBox, value ? themeStyles.boxOn : themeStyles.boxOff], testID: `${testID}-box`, children: [
|
|
2177
2189
|
focused ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { pointerEvents: "none", style: [styles17.focusRing, themeStyles.ring], testID: `${testID}-focus-ring` }) : null,
|
|
2178
2190
|
value ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { accessibilityElementsHidden: true, pointerEvents: "none", style: [styles17.tick, themeStyles.tick], testID: `${testID}-tick` }) : null
|
|
2179
2191
|
] }),
|
|
@@ -2211,30 +2223,38 @@ var FIELD_PAD_H = 10;
|
|
|
2211
2223
|
var FIELD_FONT = 13;
|
|
2212
2224
|
var FIELD_RADIUS = 8;
|
|
2213
2225
|
var FIELD_CHEVRON_ROOM = 30;
|
|
2226
|
+
var CHIP_DESKTOP_HEIGHT = 30;
|
|
2227
|
+
var CHIP_GAP = 6;
|
|
2214
2228
|
var CHEVRON_BOX = 16;
|
|
2215
2229
|
var DEFAULT_CONFIG = { look: "default" };
|
|
2216
|
-
var SelectLookContext =
|
|
2217
|
-
function SelectLookProvider({ look, borderColor, children }) {
|
|
2218
|
-
const value =
|
|
2230
|
+
var SelectLookContext = React41.createContext(DEFAULT_CONFIG);
|
|
2231
|
+
function SelectLookProvider({ look, borderColor, backgroundColor, textColor, children }) {
|
|
2232
|
+
const value = React41.useMemo(() => ({ look, borderColor, backgroundColor, textColor }), [look, borderColor, backgroundColor, textColor]);
|
|
2219
2233
|
return /* @__PURE__ */ jsxRuntime.jsx(SelectLookContext.Provider, { value, children });
|
|
2220
2234
|
}
|
|
2221
|
-
function selectLookMetrics({ look, borderColor }, windowWidth) {
|
|
2235
|
+
function selectLookMetrics({ look, borderColor, backgroundColor, textColor }, windowWidth) {
|
|
2222
2236
|
if (look === "default") {
|
|
2223
2237
|
return void 0;
|
|
2224
2238
|
}
|
|
2225
2239
|
const isPhone = windowWidth < PHONE_MAX_WIDTH;
|
|
2240
|
+
const isChip = look === "chip";
|
|
2241
|
+
const desktopHeight = isChip ? CHIP_DESKTOP_HEIGHT : FIELD_DESKTOP_HEIGHT;
|
|
2226
2242
|
return {
|
|
2227
|
-
height: isPhone ? FIELD_PHONE_HEIGHT :
|
|
2243
|
+
height: isPhone ? FIELD_PHONE_HEIGHT : desktopHeight,
|
|
2228
2244
|
paddingHorizontal: FIELD_PAD_H,
|
|
2229
2245
|
paddingVertical: 0,
|
|
2230
2246
|
fontSize: FIELD_FONT,
|
|
2231
2247
|
borderRadius: FIELD_RADIUS,
|
|
2232
2248
|
chevronRoom: FIELD_CHEVRON_ROOM,
|
|
2233
|
-
|
|
2249
|
+
hug: isChip,
|
|
2250
|
+
gap: isChip ? CHIP_GAP : void 0,
|
|
2251
|
+
borderColor,
|
|
2252
|
+
backgroundColor,
|
|
2253
|
+
textColor
|
|
2234
2254
|
};
|
|
2235
2255
|
}
|
|
2236
2256
|
function useSelectLookMetrics() {
|
|
2237
|
-
const config =
|
|
2257
|
+
const config = React41.useContext(SelectLookContext);
|
|
2238
2258
|
const { width } = reactNative.useWindowDimensions();
|
|
2239
2259
|
return selectLookMetrics(config, width);
|
|
2240
2260
|
}
|
|
@@ -2270,10 +2290,10 @@ function lookSelectStyle(fit, m, colors) {
|
|
|
2270
2290
|
paddingInlineStart: m.paddingHorizontal,
|
|
2271
2291
|
paddingInlineEnd: m.chevronRoom,
|
|
2272
2292
|
borderColor: m.borderColor ?? colors.border,
|
|
2273
|
-
backgroundColor: colors.background,
|
|
2274
|
-
color: colors.text,
|
|
2293
|
+
backgroundColor: m.backgroundColor ?? colors.background,
|
|
2294
|
+
color: m.textColor ?? colors.text,
|
|
2275
2295
|
appearance: "none",
|
|
2276
|
-
backgroundImage: chevronDataUri(colors.chevron),
|
|
2296
|
+
backgroundImage: chevronDataUri(m.textColor ?? colors.chevron),
|
|
2277
2297
|
backgroundRepeat: "no-repeat",
|
|
2278
2298
|
backgroundPosition: `right ${String(CHEVRON_INSET)}px center`,
|
|
2279
2299
|
backgroundSize: "16px 16px"
|
|
@@ -2348,9 +2368,9 @@ function nextHighlight(current, count, delta) {
|
|
|
2348
2368
|
var FORWARD = 1;
|
|
2349
2369
|
var BACKWARD = -1;
|
|
2350
2370
|
function useSelectListbox({ options, isOpen, open, toggle: toggle2, select }) {
|
|
2351
|
-
const [row, setRow] =
|
|
2371
|
+
const [row, setRow] = React41.useState(NO_HIGHLIGHT);
|
|
2352
2372
|
const highlighted = isOpen ? options[row] : void 0;
|
|
2353
|
-
|
|
2373
|
+
React41.useEffect(() => {
|
|
2354
2374
|
if (!isOpen) setRow(NO_HIGHLIGHT);
|
|
2355
2375
|
}, [isOpen]);
|
|
2356
2376
|
const onKeyDown = (event) => {
|
|
@@ -2371,7 +2391,18 @@ var IS_WEB7 = reactNative.Platform.OS === "web";
|
|
|
2371
2391
|
var CHEVRON_DOWN = "\u25BE";
|
|
2372
2392
|
var CHEVRON_UP = "\u25B4";
|
|
2373
2393
|
function lookTriggerBox(m) {
|
|
2374
|
-
|
|
2394
|
+
if (m === void 0) return void 0;
|
|
2395
|
+
const hug = m.hug ? { justifyContent: "flex-start", alignSelf: "flex-start", gap: m.gap } : void 0;
|
|
2396
|
+
return { minHeight: m.height, height: m.height, paddingHorizontal: m.paddingHorizontal, paddingVertical: m.paddingVertical, borderRadius: m.borderRadius, ...hug };
|
|
2397
|
+
}
|
|
2398
|
+
function triggerInk(m, colors, isEmpty) {
|
|
2399
|
+
const themeText = isEmpty ? colors.textSecondary : colors.text;
|
|
2400
|
+
return {
|
|
2401
|
+
border: m?.borderColor ?? colors.border,
|
|
2402
|
+
background: m?.backgroundColor ?? colors.surfaceElevated,
|
|
2403
|
+
text: m?.textColor ?? themeText,
|
|
2404
|
+
chevron: m?.textColor ?? colors.textSecondary
|
|
2405
|
+
};
|
|
2375
2406
|
}
|
|
2376
2407
|
function listboxTriggerAria(testID, hasList, highlighted) {
|
|
2377
2408
|
return {
|
|
@@ -2398,22 +2429,22 @@ function MenuSelectControl({
|
|
|
2398
2429
|
}) {
|
|
2399
2430
|
const { theme } = uiFeedback.useUi();
|
|
2400
2431
|
const { colors, palette } = theme;
|
|
2401
|
-
const anchorRef =
|
|
2402
|
-
const [isOpen, setIsOpen] =
|
|
2403
|
-
const selectedLabel =
|
|
2432
|
+
const anchorRef = React41.useRef(null);
|
|
2433
|
+
const [isOpen, setIsOpen] = React41.useState(false);
|
|
2434
|
+
const selectedLabel = React41.useMemo(() => {
|
|
2404
2435
|
const found = options.find((o) => o.value === value);
|
|
2405
2436
|
return found?.label ?? placeholder;
|
|
2406
2437
|
}, [options, placeholder, value]);
|
|
2407
|
-
const close =
|
|
2438
|
+
const close = React41.useCallback(() => {
|
|
2408
2439
|
setIsOpen(false);
|
|
2409
2440
|
}, []);
|
|
2410
|
-
const open =
|
|
2441
|
+
const open = React41.useCallback(() => {
|
|
2411
2442
|
setIsOpen(true);
|
|
2412
2443
|
}, []);
|
|
2413
|
-
const toggle2 =
|
|
2444
|
+
const toggle2 = React41.useCallback(() => {
|
|
2414
2445
|
setIsOpen((prev) => !prev);
|
|
2415
2446
|
}, []);
|
|
2416
|
-
const select =
|
|
2447
|
+
const select = React41.useCallback(
|
|
2417
2448
|
(next) => {
|
|
2418
2449
|
onChange(next);
|
|
2419
2450
|
setIsOpen(false);
|
|
@@ -2421,6 +2452,7 @@ function MenuSelectControl({
|
|
|
2421
2452
|
[onChange]
|
|
2422
2453
|
);
|
|
2423
2454
|
const metrics = useSelectLookMetrics();
|
|
2455
|
+
const ink = triggerInk(metrics, colors, value === "");
|
|
2424
2456
|
const listbox = useSelectListbox({ options, isOpen, open, toggle: toggle2, select });
|
|
2425
2457
|
const isListbox = menuAnchor !== void 0;
|
|
2426
2458
|
const captureKeys = isListbox ? { onKeyDownCapture: listbox.onKeyDown } : {};
|
|
@@ -2439,11 +2471,11 @@ function MenuSelectControl({
|
|
|
2439
2471
|
"aria-labelledby": labelledById,
|
|
2440
2472
|
onBlur: isListbox ? close : void 0,
|
|
2441
2473
|
onPress: toggle2,
|
|
2442
|
-
style: [controlStyles.selectTrigger, lookTriggerBox(metrics), { borderColor:
|
|
2474
|
+
style: [controlStyles.selectTrigger, lookTriggerBox(metrics), { borderColor: ink.border, backgroundColor: ink.background }],
|
|
2443
2475
|
testID: `${testID}-trigger`,
|
|
2444
2476
|
children: [
|
|
2445
|
-
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { numberOfLines: 1, style: [controlStyles.selectTriggerText, metrics === void 0 ? void 0 : { fontSize: metrics.fontSize }, { color:
|
|
2446
|
-
metrics === void 0 ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { "aria-hidden": true, style: [controlStyles.chevron, { color:
|
|
2477
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { numberOfLines: 1, style: [controlStyles.selectTriggerText, metrics === void 0 ? void 0 : { fontSize: metrics.fontSize }, { color: ink.text }], children: selectedLabel }),
|
|
2478
|
+
metrics === void 0 ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { "aria-hidden": true, style: [controlStyles.chevron, { color: ink.chevron }], children: isOpen ? CHEVRON_UP : CHEVRON_DOWN }) : /* @__PURE__ */ jsxRuntime.jsx(SelectChevron, { color: ink.chevron, open: isOpen })
|
|
2447
2479
|
]
|
|
2448
2480
|
}
|
|
2449
2481
|
),
|
|
@@ -2489,7 +2521,7 @@ var SelectField = ({
|
|
|
2489
2521
|
) });
|
|
2490
2522
|
};
|
|
2491
2523
|
var REMOVE_GLYPH = "\xD7";
|
|
2492
|
-
var
|
|
2524
|
+
var CHIP_GAP2 = 4;
|
|
2493
2525
|
var CHIP_PAD_H = 8;
|
|
2494
2526
|
var CHIP_PAD_V = 4;
|
|
2495
2527
|
var CHIP_RADIUS = 999;
|
|
@@ -2498,7 +2530,7 @@ var styles18 = reactNative.StyleSheet.create({
|
|
|
2498
2530
|
chip: {
|
|
2499
2531
|
flexDirection: "row",
|
|
2500
2532
|
alignItems: "center",
|
|
2501
|
-
gap:
|
|
2533
|
+
gap: CHIP_GAP2,
|
|
2502
2534
|
paddingHorizontal: CHIP_PAD_H,
|
|
2503
2535
|
paddingVertical: CHIP_PAD_V,
|
|
2504
2536
|
borderWidth: 1,
|
|
@@ -2557,21 +2589,21 @@ var styles19 = reactNative.StyleSheet.create({
|
|
|
2557
2589
|
function MultiSelectBox(props) {
|
|
2558
2590
|
const { label, accessibilityHint, values, options, onChange, placeholder, chipLabels, testID, labelId } = props;
|
|
2559
2591
|
const { colors, palette } = uiFeedback.useUi().theme;
|
|
2560
|
-
const anchorRef =
|
|
2561
|
-
const [isOpen, setIsOpen] =
|
|
2592
|
+
const anchorRef = React41.useRef(null);
|
|
2593
|
+
const [isOpen, setIsOpen] = React41.useState(false);
|
|
2562
2594
|
const chosen = selectedOptions(options, values);
|
|
2563
2595
|
const remaining = remainingOptions(options, values);
|
|
2564
|
-
const close =
|
|
2596
|
+
const close = React41.useCallback(() => {
|
|
2565
2597
|
setIsOpen(false);
|
|
2566
2598
|
}, []);
|
|
2567
|
-
const toggle2 =
|
|
2599
|
+
const toggle2 = React41.useCallback(() => {
|
|
2568
2600
|
setIsOpen((prev) => !prev);
|
|
2569
2601
|
}, []);
|
|
2570
|
-
const add =
|
|
2602
|
+
const add = React41.useCallback((next) => {
|
|
2571
2603
|
onChange(addValue(values, next));
|
|
2572
2604
|
setIsOpen(false);
|
|
2573
2605
|
}, [onChange, values]);
|
|
2574
|
-
const remove =
|
|
2606
|
+
const remove = React41.useCallback((value) => {
|
|
2575
2607
|
onChange(removeValue(values, value));
|
|
2576
2608
|
}, [onChange, values]);
|
|
2577
2609
|
const chipColors = { text: colors.text, border: colors.border, surface: colors.surface };
|
|
@@ -2629,17 +2661,17 @@ function MultiSelectBox(props) {
|
|
|
2629
2661
|
var MultiSelectField = ({ labelVariant, hint, error, ...boxProps }) => /* @__PURE__ */ jsxRuntime.jsx(Field, { error, hint, label: boxProps.label, labelVariant, children: ({ labelId }) => /* @__PURE__ */ jsxRuntime.jsx(MultiSelectBox, { ...boxProps, labelId }) });
|
|
2630
2662
|
var CLOSE_DELAY_MS2 = 140;
|
|
2631
2663
|
function useDelayedBlurClose(open, close) {
|
|
2632
|
-
const timerRef =
|
|
2633
|
-
const cancelClose =
|
|
2664
|
+
const timerRef = React41.useRef(null);
|
|
2665
|
+
const cancelClose = React41.useCallback(() => {
|
|
2634
2666
|
if (timerRef.current !== null) clearTimeout(timerRef.current);
|
|
2635
2667
|
timerRef.current = null;
|
|
2636
2668
|
}, []);
|
|
2637
|
-
|
|
2638
|
-
const handleFocus =
|
|
2669
|
+
React41.useEffect(() => cancelClose, [cancelClose]);
|
|
2670
|
+
const handleFocus = React41.useCallback(() => {
|
|
2639
2671
|
cancelClose();
|
|
2640
2672
|
open();
|
|
2641
2673
|
}, [cancelClose, open]);
|
|
2642
|
-
const handleBlur =
|
|
2674
|
+
const handleBlur = React41.useCallback(() => {
|
|
2643
2675
|
cancelClose();
|
|
2644
2676
|
timerRef.current = setTimeout(close, CLOSE_DELAY_MS2);
|
|
2645
2677
|
}, [cancelClose, close]);
|
|
@@ -2682,10 +2714,10 @@ function isUnmatched(options, text) {
|
|
|
2682
2714
|
var DEFAULT_TYPEAHEAD_DEBOUNCE_MS = 250;
|
|
2683
2715
|
var IDLE = { results: [], isLoading: false, hasFailed: false, hasSettled: false };
|
|
2684
2716
|
function useTypeaheadSearch(load, query, enabled, debounceMs) {
|
|
2685
|
-
const [state, setState] =
|
|
2686
|
-
const loadRef =
|
|
2717
|
+
const [state, setState] = React41.useState(IDLE);
|
|
2718
|
+
const loadRef = React41.useRef(load);
|
|
2687
2719
|
loadRef.current = load;
|
|
2688
|
-
|
|
2720
|
+
React41.useEffect(() => {
|
|
2689
2721
|
if (!enabled) {
|
|
2690
2722
|
setState(IDLE);
|
|
2691
2723
|
return void 0;
|
|
@@ -2724,30 +2756,30 @@ function useTypeaheadRows(input, isOpen, isPicked) {
|
|
|
2724
2756
|
const query = value.trim();
|
|
2725
2757
|
const isSearching = search !== void 0 && isOpen && !isPicked && query.length >= minChars;
|
|
2726
2758
|
const found = useTypeaheadSearch(search?.load, query, isSearching, search?.debounceMs ?? DEFAULT_TYPEAHEAD_DEBOUNCE_MS);
|
|
2727
|
-
const staticRows =
|
|
2759
|
+
const staticRows = React41.useMemo(() => {
|
|
2728
2760
|
if (options === void 0 || options.some((o) => o.label === value)) return NO_ROWS;
|
|
2729
2761
|
return suggestOptions(options, value, minChars, maxSuggestions);
|
|
2730
2762
|
}, [options, value, minChars, maxSuggestions]);
|
|
2731
|
-
const foundRows =
|
|
2763
|
+
const foundRows = React41.useMemo(() => found.results.slice(0, maxSuggestions), [found.results, maxSuggestions]);
|
|
2732
2764
|
if (search === void 0) return { rows: staticRows, statusText: void 0 };
|
|
2733
2765
|
return { rows: foundRows, statusText: searchStatusText(found, search) };
|
|
2734
2766
|
}
|
|
2735
2767
|
function useTypeaheadState(input) {
|
|
2736
2768
|
const { search, value, onChange, onSubmit } = input;
|
|
2737
|
-
const [isOpen, setIsOpen] =
|
|
2738
|
-
const [picked, setPicked] =
|
|
2739
|
-
const [highlightIndex, setHighlightIndex] =
|
|
2769
|
+
const [isOpen, setIsOpen] = React41.useState(false);
|
|
2770
|
+
const [picked, setPicked] = React41.useState(null);
|
|
2771
|
+
const [highlightIndex, setHighlightIndex] = React41.useState(NO_HIGHLIGHT);
|
|
2740
2772
|
const { rows, statusText } = useTypeaheadRows(input, isOpen, picked !== null && picked.label === value);
|
|
2741
2773
|
const rowKey = rows.map((row) => row.value).join("\n");
|
|
2742
2774
|
const highlighted = isOpen ? rows[highlightIndex] : void 0;
|
|
2743
|
-
|
|
2744
|
-
|
|
2745
|
-
const open =
|
|
2746
|
-
const close =
|
|
2775
|
+
React41.useEffect(() => setHighlightIndex(NO_HIGHLIGHT), [rowKey]);
|
|
2776
|
+
React41.useEffect(() => setPicked((current) => current !== null && current.label !== value ? null : current), [value]);
|
|
2777
|
+
const open = React41.useCallback(() => setIsOpen(true), []);
|
|
2778
|
+
const close = React41.useCallback(() => {
|
|
2747
2779
|
setIsOpen(false);
|
|
2748
2780
|
setHighlightIndex(NO_HIGHLIGHT);
|
|
2749
2781
|
}, []);
|
|
2750
|
-
const pick =
|
|
2782
|
+
const pick = React41.useCallback(
|
|
2751
2783
|
(option) => {
|
|
2752
2784
|
setPicked(option);
|
|
2753
2785
|
onChange(option.label);
|
|
@@ -2756,14 +2788,14 @@ function useTypeaheadState(input) {
|
|
|
2756
2788
|
},
|
|
2757
2789
|
[onChange, search, close]
|
|
2758
2790
|
);
|
|
2759
|
-
const selectValue =
|
|
2791
|
+
const selectValue = React41.useCallback(
|
|
2760
2792
|
(optionValue) => {
|
|
2761
2793
|
const option = rows.find((row) => row.value === optionValue);
|
|
2762
2794
|
if (option !== void 0) pick(option);
|
|
2763
2795
|
},
|
|
2764
2796
|
[rows, pick]
|
|
2765
2797
|
);
|
|
2766
|
-
const handleChange =
|
|
2798
|
+
const handleChange = React41.useCallback(
|
|
2767
2799
|
(next) => {
|
|
2768
2800
|
if (picked !== null) {
|
|
2769
2801
|
setPicked(null);
|
|
@@ -2776,7 +2808,7 @@ function useTypeaheadState(input) {
|
|
|
2776
2808
|
[picked, search, onChange]
|
|
2777
2809
|
);
|
|
2778
2810
|
const handleKeyPress = useTypeaheadKeys({ rowCount: rows.length, isOpen, highlighted, setIsOpen, setHighlightIndex, close, pick });
|
|
2779
|
-
const handleSubmit =
|
|
2811
|
+
const handleSubmit = React41.useCallback(() => {
|
|
2780
2812
|
if (highlighted !== void 0) {
|
|
2781
2813
|
pick(highlighted);
|
|
2782
2814
|
return;
|
|
@@ -2788,7 +2820,7 @@ function useTypeaheadState(input) {
|
|
|
2788
2820
|
}
|
|
2789
2821
|
function useTypeaheadKeys(input) {
|
|
2790
2822
|
const { rowCount, isOpen, highlighted, setIsOpen, setHighlightIndex, close, pick } = input;
|
|
2791
|
-
return
|
|
2823
|
+
return React41.useCallback(
|
|
2792
2824
|
(event) => {
|
|
2793
2825
|
const { key } = event.nativeEvent;
|
|
2794
2826
|
if (key === "ArrowDown" || key === "ArrowUp") {
|
|
@@ -2825,7 +2857,7 @@ function TypeaheadControlImpl(props, ref) {
|
|
|
2825
2857
|
const maxSuggestions = ("search" in props ? props.search.maxResults : props.maxSuggestions) ?? DEFAULT_TYPEAHEAD_MAX_SUGGESTIONS;
|
|
2826
2858
|
const { theme } = uiFeedback.useUi();
|
|
2827
2859
|
const { colors, palette } = theme;
|
|
2828
|
-
const anchorRef =
|
|
2860
|
+
const anchorRef = React41.useRef(null);
|
|
2829
2861
|
const state = useTypeaheadState({ options, search, value, minChars, maxSuggestions, onChange, onSubmit });
|
|
2830
2862
|
const { handleFocus, handleBlur } = useDelayedBlurClose(state.open, state.close);
|
|
2831
2863
|
const showMenu = state.isOpen && (state.rows.length > 0 || state.statusText !== void 0);
|
|
@@ -2878,7 +2910,7 @@ function TypeaheadControlImpl(props, ref) {
|
|
|
2878
2910
|
hasError ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { role: "alert", style: [controlStyles.error, { color: fieldErrorInk(theme) }], testID: `${testID}-error`, children: error }) : null
|
|
2879
2911
|
] });
|
|
2880
2912
|
}
|
|
2881
|
-
var TypeaheadControl =
|
|
2913
|
+
var TypeaheadControl = React41.forwardRef(TypeaheadControlImpl);
|
|
2882
2914
|
var NATIVE_INPUT_BOX = {
|
|
2883
2915
|
borderStyle: "solid",
|
|
2884
2916
|
boxSizing: "border-box",
|
|
@@ -2966,7 +2998,7 @@ function tabStops(container) {
|
|
|
2966
2998
|
}
|
|
2967
2999
|
function PickerDialog({ testID, sheet, onDismiss, children }) {
|
|
2968
3000
|
const colors = usePickerColors();
|
|
2969
|
-
const ref =
|
|
3001
|
+
const ref = React41.useRef(null);
|
|
2970
3002
|
const onKeyDown = (event) => {
|
|
2971
3003
|
if (event.key === "Escape") {
|
|
2972
3004
|
event.preventDefault();
|
|
@@ -2989,8 +3021,8 @@ function PickerDialog({ testID, sheet, onDismiss, children }) {
|
|
|
2989
3021
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { ref, "data-testid": testID, "data-variant": sheet ? "sheet" : "popover", style, onKeyDown, children });
|
|
2990
3022
|
}
|
|
2991
3023
|
function useAnchorRect2(anchorRef) {
|
|
2992
|
-
const [rect2, setRect] =
|
|
2993
|
-
|
|
3024
|
+
const [rect2, setRect] = React41.useState(null);
|
|
3025
|
+
React41.useEffect(() => {
|
|
2994
3026
|
anchorRef.current?.measureInWindow((x, y, width, height) => setRect({ x, y, width, height }));
|
|
2995
3027
|
}, [anchorRef]);
|
|
2996
3028
|
return rect2;
|
|
@@ -3033,8 +3065,8 @@ function fitDropdownWidth(frame, viewportWidth, minWidth = MIN_PANEL_WIDTH) {
|
|
|
3033
3065
|
function DropdownSurface({ progress, translateY, anchorRef, onDismiss, closeLabel, closeHint, testID, children, minWidth, scale, accessibilityLabel, preferBelow = false }) {
|
|
3034
3066
|
const { height: viewportHeight, width: viewportWidth } = reactNative.useWindowDimensions();
|
|
3035
3067
|
const anchor = useAnchorRect2(anchorRef);
|
|
3036
|
-
const [panelHeight, setPanelHeight] =
|
|
3037
|
-
const onLayout =
|
|
3068
|
+
const [panelHeight, setPanelHeight] = React41.useState(0);
|
|
3069
|
+
const onLayout = React41.useCallback((event) => setPanelHeight(event.nativeEvent.layout.height), []);
|
|
3038
3070
|
const frame = anchor === null ? null : fitDropdownWidth(dropdownFrame(anchor, panelHeight, viewportHeight, preferBelow), viewportWidth, minWidth);
|
|
3039
3071
|
const place = frame === null ? null : { left: frame.left, width: frame.width, top: frame.top, bottom: frame.bottom };
|
|
3040
3072
|
return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.Modal, { transparent: true, visible: true, animationType: "none", "aria-label": accessibilityLabel, onRequestClose: onDismiss, children: [
|
|
@@ -3057,8 +3089,8 @@ var styles21 = reactNative.StyleSheet.create({
|
|
|
3057
3089
|
sheet: { width: "100%", alignSelf: "stretch" }
|
|
3058
3090
|
});
|
|
3059
3091
|
function useReducedMotion() {
|
|
3060
|
-
const [reduced, setReduced] =
|
|
3061
|
-
|
|
3092
|
+
const [reduced, setReduced] = React41.useState(false);
|
|
3093
|
+
React41.useEffect(() => {
|
|
3062
3094
|
let active = true;
|
|
3063
3095
|
reactNative.AccessibilityInfo.isReduceMotionEnabled().then((value) => {
|
|
3064
3096
|
if (active) setReduced(value);
|
|
@@ -3269,14 +3301,14 @@ function weekFirstDay(locale) {
|
|
|
3269
3301
|
return MONDAY3;
|
|
3270
3302
|
}
|
|
3271
3303
|
}
|
|
3272
|
-
var DatePickerContext =
|
|
3304
|
+
var DatePickerContext = React41.createContext({ labels: DEFAULT_DATE_PICKER_LABELS });
|
|
3273
3305
|
function DatePickerProvider({ labels, locale, today, display, children }) {
|
|
3274
|
-
const value =
|
|
3306
|
+
const value = React41.useMemo(() => ({ labels: { ...DEFAULT_DATE_PICKER_LABELS, ...labels }, locale, today, display }), [labels, locale, today, display]);
|
|
3275
3307
|
return /* @__PURE__ */ jsxRuntime.jsx(DatePickerContext.Provider, { value, children });
|
|
3276
3308
|
}
|
|
3277
3309
|
function useDatePickerConfig() {
|
|
3278
|
-
const config =
|
|
3279
|
-
const firstDay =
|
|
3310
|
+
const config = React41.useContext(DatePickerContext);
|
|
3311
|
+
const firstDay = React41.useMemo(() => weekFirstDay(config.locale), [config.locale]);
|
|
3280
3312
|
return { labels: config.labels, locale: config.locale, today: config.today ?? todayIso(), firstDay, display: config.display ?? "long" /* Long */ };
|
|
3281
3313
|
}
|
|
3282
3314
|
|
|
@@ -3299,8 +3331,8 @@ function monthSlideStyle(entered, reduced, direction) {
|
|
|
3299
3331
|
}
|
|
3300
3332
|
function useOpenProgress() {
|
|
3301
3333
|
const { durationMs, fromScale } = resolveOpenMotion(useReducedMotion());
|
|
3302
|
-
const progress =
|
|
3303
|
-
|
|
3334
|
+
const progress = React41.useRef(new reactNative.Animated.Value(0)).current;
|
|
3335
|
+
React41.useEffect(() => {
|
|
3304
3336
|
reactNative.Animated.timing(progress, { toValue: 1, duration: durationMs, useNativeDriver: false }).start();
|
|
3305
3337
|
}, [progress, durationMs]);
|
|
3306
3338
|
return {
|
|
@@ -3346,16 +3378,16 @@ function dayDomId(testID, iso) {
|
|
|
3346
3378
|
}
|
|
3347
3379
|
function useGridFocus(initial, bounds, testID, onPick) {
|
|
3348
3380
|
const { firstDay } = useDatePickerConfig();
|
|
3349
|
-
const [focusedDay, setFocusedDay] =
|
|
3350
|
-
const focusPending =
|
|
3381
|
+
const [focusedDay, setFocusedDay] = React41.useState(initial);
|
|
3382
|
+
const focusPending = React41.useRef(true);
|
|
3351
3383
|
const { min, max } = bounds;
|
|
3352
|
-
|
|
3384
|
+
React41.useEffect(() => {
|
|
3353
3385
|
if (!focusPending.current) return;
|
|
3354
3386
|
focusPending.current = false;
|
|
3355
3387
|
document.getElementById(dayDomId(testID, focusedDay))?.focus();
|
|
3356
3388
|
}, [focusedDay, testID]);
|
|
3357
|
-
const moveTo =
|
|
3358
|
-
const onDayKey =
|
|
3389
|
+
const moveTo = React41.useCallback((iso) => setFocusedDay(clampToBounds(iso, min, max)), [min, max]);
|
|
3390
|
+
const onDayKey = React41.useCallback(
|
|
3359
3391
|
(event, iso) => {
|
|
3360
3392
|
if (event.key === "Enter" || event.key === " ") {
|
|
3361
3393
|
event.preventDefault();
|
|
@@ -3442,8 +3474,8 @@ function MonthGrid({ month, selection: selection2, focusedDay, bounds, testID, o
|
|
|
3442
3474
|
const { labels, locale, today, firstDay } = useDatePickerConfig();
|
|
3443
3475
|
const colors = usePickerColors();
|
|
3444
3476
|
const parts = parseIso(month) ?? FALLBACK;
|
|
3445
|
-
const weeks =
|
|
3446
|
-
const weekdays =
|
|
3477
|
+
const weeks = React41.useMemo(() => buildMonthGrid(parts.year, parts.month, firstDay), [parts.year, parts.month, firstDay]);
|
|
3478
|
+
const weekdays = React41.useMemo(() => weekdayNames(locale, firstDay), [locale, firstDay]);
|
|
3447
3479
|
const title = formatMonthYear(month, locale);
|
|
3448
3480
|
const end = selection2.to === "" ? selection2.from : selection2.to;
|
|
3449
3481
|
const stateOf = (iso) => ({
|
|
@@ -3482,7 +3514,7 @@ function MonthHeader({ focusedDay, bounds, testID, onMove }) {
|
|
|
3482
3514
|
const { labels, locale } = useDatePickerConfig();
|
|
3483
3515
|
const colors = usePickerColors();
|
|
3484
3516
|
const parts = parseIso(focusedDay) ?? FALLBACK2;
|
|
3485
|
-
const names =
|
|
3517
|
+
const names = React41.useMemo(() => monthNames(locale), [locale]);
|
|
3486
3518
|
const setMonthYear = (year, month) => onMove(toIso({ year, month, day: Math.min(parts.day, daysInMonth(year, month)) }));
|
|
3487
3519
|
const selectStyle = { minHeight: a11y.MIN_TOUCH_TARGET_PX, border: "none", background: "transparent", color: colors.text, fontWeight: BOLD3, fontSize: FONT2, fontFamily: "inherit", cursor: "pointer" };
|
|
3488
3520
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between" }, children: [
|
|
@@ -3503,8 +3535,8 @@ function PickerFooter({ summary, children }) {
|
|
|
3503
3535
|
] });
|
|
3504
3536
|
}
|
|
3505
3537
|
function useEntered(key, reduced) {
|
|
3506
|
-
const [enteredKey, setEnteredKey] =
|
|
3507
|
-
|
|
3538
|
+
const [enteredKey, setEnteredKey] = React41.useState(null);
|
|
3539
|
+
React41.useEffect(() => {
|
|
3508
3540
|
if (reduced) return void 0;
|
|
3509
3541
|
let inner = 0;
|
|
3510
3542
|
const outer = requestAnimationFrame(() => {
|
|
@@ -3519,8 +3551,8 @@ function useEntered(key, reduced) {
|
|
|
3519
3551
|
}
|
|
3520
3552
|
function useMonthSlide(month) {
|
|
3521
3553
|
const reduced = useReducedMotion();
|
|
3522
|
-
const previous =
|
|
3523
|
-
const direction =
|
|
3554
|
+
const previous = React41.useRef(month);
|
|
3555
|
+
const direction = React41.useRef(0);
|
|
3524
3556
|
if (previous.current !== month) {
|
|
3525
3557
|
direction.current = month > previous.current ? 1 : -1;
|
|
3526
3558
|
previous.current = month;
|
|
@@ -3530,7 +3562,7 @@ function useMonthSlide(month) {
|
|
|
3530
3562
|
}
|
|
3531
3563
|
function SingleCalendar({ value, bounds, testID, onCommit }) {
|
|
3532
3564
|
const { labels, today } = useDatePickerConfig();
|
|
3533
|
-
const [draft, setDraft] =
|
|
3565
|
+
const [draft, setDraft] = React41.useState(value);
|
|
3534
3566
|
const grid = useGridFocus(clampToBounds(value !== "" ? value : today, bounds.min, bounds.max), bounds, testID, setDraft);
|
|
3535
3567
|
const month = monthStart(grid.focusedDay);
|
|
3536
3568
|
const motion = useMonthSlide(month);
|
|
@@ -3551,8 +3583,8 @@ function useIsPhone() {
|
|
|
3551
3583
|
return !isWideFormLayout(reactNative.useWindowDimensions().width);
|
|
3552
3584
|
}
|
|
3553
3585
|
function useReturnFocus(open, target) {
|
|
3554
|
-
const wasOpen =
|
|
3555
|
-
|
|
3586
|
+
const wasOpen = React41.useRef(open);
|
|
3587
|
+
React41.useEffect(() => {
|
|
3556
3588
|
const closed = wasOpen.current && !open;
|
|
3557
3589
|
wasOpen.current = open;
|
|
3558
3590
|
if (!closed) return void 0;
|
|
@@ -3562,9 +3594,9 @@ function useReturnFocus(open, target) {
|
|
|
3562
3594
|
}
|
|
3563
3595
|
function useTypedDate({ value, onChange, bounds, format, onError, rangeMessage, editOnType = false }) {
|
|
3564
3596
|
const { labels, locale } = useDatePickerConfig();
|
|
3565
|
-
const [editing, setEditing] =
|
|
3566
|
-
const [text, setText] =
|
|
3567
|
-
|
|
3597
|
+
const [editing, setEditing] = React41.useState(false);
|
|
3598
|
+
const [text, setText] = React41.useState("");
|
|
3599
|
+
React41.useEffect(() => {
|
|
3568
3600
|
setText((current) => {
|
|
3569
3601
|
const parsed = current.trim() === "" ? "" : parseTyped(current, locale);
|
|
3570
3602
|
if (parsed === null || parsed === value) return current;
|
|
@@ -3684,16 +3716,16 @@ function DatePickerInput({ fieldProps, context, onTypedError }) {
|
|
|
3684
3716
|
const { label, value, onChange, onSubmit, accessibilityHint, testID, required, disabled = false, min, max } = fieldProps;
|
|
3685
3717
|
const { labels, display } = useDatePickerConfig();
|
|
3686
3718
|
const phone = useIsPhone();
|
|
3687
|
-
const [open, setOpen] =
|
|
3688
|
-
const anchorRef =
|
|
3689
|
-
const inputRef =
|
|
3719
|
+
const [open, setOpen] = React41.useState(false);
|
|
3720
|
+
const anchorRef = React41.useRef(null);
|
|
3721
|
+
const inputRef = React41.useRef(null);
|
|
3690
3722
|
const bounds = { min, max };
|
|
3691
3723
|
const typed = useTypedDate({ value, onChange, bounds, format: displayFormatter(display), onError: onTypedError, editOnType: true });
|
|
3692
3724
|
const edit = typedEditBind(typed);
|
|
3693
3725
|
const { style, focusBind, hoverBind } = useThemedInput({ hasError: context.hasError, editable: !disabled });
|
|
3694
3726
|
const focus = focusBind;
|
|
3695
3727
|
const webA11y = webFieldA11y({ describedById: context.describedById, hasError: context.hasError, required });
|
|
3696
|
-
const close =
|
|
3728
|
+
const close = React41.useCallback(() => setOpen(false), []);
|
|
3697
3729
|
useReturnFocus(open, inputRef);
|
|
3698
3730
|
const commit = (iso) => {
|
|
3699
3731
|
onTypedError?.(void 0);
|
|
@@ -3769,7 +3801,7 @@ function TemporalInput({ fieldProps, context, webInputType, onTypedError }) {
|
|
|
3769
3801
|
}
|
|
3770
3802
|
function TemporalField({ fieldProps, webInputType }) {
|
|
3771
3803
|
const { label, required, hint, error } = fieldProps;
|
|
3772
|
-
const [typedError, setTypedError] =
|
|
3804
|
+
const [typedError, setTypedError] = React41.useState(void 0);
|
|
3773
3805
|
return /* @__PURE__ */ jsxRuntime.jsx(Field, { error: error ?? typedError, hint, label, required, children: (context) => /* @__PURE__ */ jsxRuntime.jsx(TemporalInput, { context, fieldProps, webInputType, onTypedError: setTypedError }) });
|
|
3774
3806
|
}
|
|
3775
3807
|
function DateField(props) {
|
|
@@ -3898,17 +3930,17 @@ function useRangeSummary(draft) {
|
|
|
3898
3930
|
}
|
|
3899
3931
|
function RangeCalendar({ value, bounds, phone, testID, onApply, onCancel }) {
|
|
3900
3932
|
const { labels, today } = useDatePickerConfig();
|
|
3901
|
-
const [draft, setDraft] =
|
|
3933
|
+
const [draft, setDraft] = React41.useState(value);
|
|
3902
3934
|
const initialDay = clampToBounds(value.from !== "" ? value.from : today, bounds.min, bounds.max);
|
|
3903
|
-
const pickDraft =
|
|
3935
|
+
const pickDraft = React41.useCallback((iso) => setDraft((current) => pickRangeDay(current, iso)), []);
|
|
3904
3936
|
const focus = useGridFocus(initialDay, bounds, testID, pickDraft);
|
|
3905
3937
|
const visible = phone ? PHONE_MONTHS : DESKTOP_MONTHS;
|
|
3906
|
-
const [first, setFirst] =
|
|
3938
|
+
const [first, setFirst] = React41.useState(() => monthStart(phone ? initialDay : addMonths(initialDay, 1 - DESKTOP_MONTHS)));
|
|
3907
3939
|
const focusMonth = monthStart(focus.focusedDay);
|
|
3908
3940
|
const last = addMonths(first, visible - 1);
|
|
3909
3941
|
const motion = useMonthSlide(first);
|
|
3910
3942
|
const summary = useRangeSummary(draft);
|
|
3911
|
-
|
|
3943
|
+
React41.useEffect(() => {
|
|
3912
3944
|
if (focusMonth < first) setFirst(focusMonth);
|
|
3913
3945
|
else if (focusMonth > last) setFirst(addMonths(focusMonth, 1 - visible));
|
|
3914
3946
|
}, [focusMonth, first, last, visible]);
|
|
@@ -3957,18 +3989,18 @@ function orNone(value) {
|
|
|
3957
3989
|
function WebDateRange({ value, onChange, onSubmit, fromLabel, toLabel, hint, testID, context, onTypedError }) {
|
|
3958
3990
|
const { labels } = useDatePickerConfig();
|
|
3959
3991
|
const phone = useIsPhone();
|
|
3960
|
-
const [open, setOpen] =
|
|
3961
|
-
const [fromError, setFromError] =
|
|
3962
|
-
const [toError, setToError] =
|
|
3963
|
-
const anchorRef =
|
|
3964
|
-
const fromRef =
|
|
3992
|
+
const [open, setOpen] = React41.useState(false);
|
|
3993
|
+
const [fromError, setFromError] = React41.useState(void 0);
|
|
3994
|
+
const [toError, setToError] = React41.useState(void 0);
|
|
3995
|
+
const anchorRef = React41.useRef(null);
|
|
3996
|
+
const fromRef = React41.useRef(null);
|
|
3965
3997
|
const from = useTypedDate({ value: value.from, onChange: (next) => onChange({ from: next, to: value.to }), bounds: { max: orNone(value.to) }, format: formatShort, onError: setFromError, rangeMessage: labels.rangeOrder, editOnType: true });
|
|
3966
3998
|
const to = useTypedDate({ value: value.to, onChange: (next) => onChange({ from: value.from, to: next }), bounds: { min: orNone(value.from) }, format: formatShort, onError: setToError, rangeMessage: labels.rangeOrder, editOnType: true });
|
|
3967
3999
|
const { style, focusBind, hoverBind } = useThemedInput({ hasError: context.hasError, editable: true });
|
|
3968
4000
|
const focus = focusBind;
|
|
3969
4001
|
const webA11y = webFieldA11y({ describedById: context.describedById, hasError: context.hasError });
|
|
3970
|
-
|
|
3971
|
-
const close =
|
|
4002
|
+
React41.useEffect(() => onTypedError(fromError ?? toError), [fromError, toError, onTypedError]);
|
|
4003
|
+
const close = React41.useCallback(() => setOpen(false), []);
|
|
3972
4004
|
useReturnFocus(open, fromRef);
|
|
3973
4005
|
const onKeyDown = (event) => {
|
|
3974
4006
|
if (event.key === "ArrowDown" && event.altKey) {
|
|
@@ -4052,7 +4084,7 @@ function DateRangeControl({
|
|
|
4052
4084
|
}) {
|
|
4053
4085
|
const hint = accessibilityHint ?? `${fromLabel} \u2013 ${toLabel}`;
|
|
4054
4086
|
const { labels } = useDatePickerConfig();
|
|
4055
|
-
const [typedError, setTypedError] =
|
|
4087
|
+
const [typedError, setTypedError] = React41.useState(void 0);
|
|
4056
4088
|
if (!IS_WEB9) {
|
|
4057
4089
|
return /* @__PURE__ */ jsxRuntime.jsx(GapOwnedProvider, { value: true, children: /* @__PURE__ */ jsxRuntime.jsx(NativeDateRange, { fromLabel, hint, style, testID, toLabel, value, onChange, onSubmit }) });
|
|
4058
4090
|
}
|
|
@@ -4220,9 +4252,9 @@ function FormStatusLine({ message, testID, style }) {
|
|
|
4220
4252
|
return /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { role: "alert", style: [styles24.line, { color: theme.colors.text }, style], testID, children: message });
|
|
4221
4253
|
}
|
|
4222
4254
|
function useFocusFirstInvalid(refs) {
|
|
4223
|
-
const latest =
|
|
4255
|
+
const latest = React41.useRef(refs);
|
|
4224
4256
|
latest.current = refs;
|
|
4225
|
-
return
|
|
4257
|
+
return React41.useCallback((invalid) => {
|
|
4226
4258
|
const first = invalid.map((field2) => latest.current[field2].current).find((node) => node !== null);
|
|
4227
4259
|
first?.focus();
|
|
4228
4260
|
}, []);
|
|
@@ -4273,10 +4305,10 @@ function withoutField(state, field2) {
|
|
|
4273
4305
|
}
|
|
4274
4306
|
function useServerFieldErrors(options) {
|
|
4275
4307
|
const { fields, refs, formatCode } = options;
|
|
4276
|
-
const [state, setState] =
|
|
4308
|
+
const [state, setState] = React41.useState(EMPTY_STATE);
|
|
4277
4309
|
const focusFirst = useFocusFirstInvalid(refs ?? NO_REFS);
|
|
4278
4310
|
const hasRefs = refs !== void 0;
|
|
4279
|
-
const apply =
|
|
4311
|
+
const apply = React41.useCallback(
|
|
4280
4312
|
(error) => {
|
|
4281
4313
|
const assigned = assignServerErrors(apiClientBase.parseFieldErrors(error), fields, formatCode);
|
|
4282
4314
|
setState({ byField: assigned.byField, formError: assigned.formError });
|
|
@@ -4287,17 +4319,17 @@ function useServerFieldErrors(options) {
|
|
|
4287
4319
|
},
|
|
4288
4320
|
[fields, formatCode, focusFirst, hasRefs]
|
|
4289
4321
|
);
|
|
4290
|
-
const clear =
|
|
4291
|
-
const reset =
|
|
4292
|
-
const errorFor =
|
|
4322
|
+
const clear = React41.useCallback((field2) => setState((current) => withoutField(current, field2)), []);
|
|
4323
|
+
const reset = React41.useCallback(() => setState(EMPTY_STATE), []);
|
|
4324
|
+
const errorFor = React41.useCallback((field2) => state.byField[field2], [state.byField]);
|
|
4293
4325
|
return { errorFor, apply, clear, formError: state.formError, reset };
|
|
4294
4326
|
}
|
|
4295
4327
|
function isScrollable(node) {
|
|
4296
4328
|
return "scrollIntoView" in Object(node);
|
|
4297
4329
|
}
|
|
4298
4330
|
function useKeepInView(trigger) {
|
|
4299
|
-
const ref =
|
|
4300
|
-
|
|
4331
|
+
const ref = React41.useRef(null);
|
|
4332
|
+
React41.useEffect(() => {
|
|
4301
4333
|
const node = ref.current;
|
|
4302
4334
|
const hasTrigger = trigger !== void 0 && trigger !== null;
|
|
4303
4335
|
if (hasTrigger && isScrollable(node)) node.scrollIntoView({ block: "nearest" });
|
|
@@ -4387,7 +4419,7 @@ var UploadWithLinkField = ({
|
|
|
4387
4419
|
const { theme } = uiFeedback.useUi();
|
|
4388
4420
|
const ring = uiButtons.useFocusRing();
|
|
4389
4421
|
const url = value ?? "";
|
|
4390
|
-
const [pasting, setPasting] =
|
|
4422
|
+
const [pasting, setPasting] = React41.useState(url !== "");
|
|
4391
4423
|
const previewBox = { borderRadius: PREVIEW_RADIUS, height: previewSize, width: previewSize };
|
|
4392
4424
|
return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles26.root, children: [
|
|
4393
4425
|
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles26.title, { color: theme.colors.text }], children: labels.title }),
|
|
@@ -4445,7 +4477,7 @@ var AddOnRequest = ({
|
|
|
4445
4477
|
disabled = false,
|
|
4446
4478
|
style
|
|
4447
4479
|
}) => {
|
|
4448
|
-
const [requested, setRequested] =
|
|
4480
|
+
const [requested, setRequested] = React41.useState(false);
|
|
4449
4481
|
const remove = () => {
|
|
4450
4482
|
setRequested(false);
|
|
4451
4483
|
onRemove();
|
|
@@ -4564,23 +4596,23 @@ var SHEET_MAX_HEIGHT2 = 480;
|
|
|
4564
4596
|
function SearchSelectPanel({ motion, state, labels, anchorRef, renderLeading, renderDetail, selectedValue, testID }) {
|
|
4565
4597
|
const { theme } = uiFeedback.useUi();
|
|
4566
4598
|
const { colors } = theme;
|
|
4567
|
-
const progress =
|
|
4599
|
+
const progress = React41.useRef(new reactNative.Animated.Value(0)).current;
|
|
4568
4600
|
const { durationMs } = motion;
|
|
4569
|
-
|
|
4601
|
+
React41.useEffect(() => {
|
|
4570
4602
|
reactNative.Animated.timing(progress, { toValue: 1, duration: durationMs, useNativeDriver: false }).start();
|
|
4571
4603
|
}, [progress, durationMs]);
|
|
4572
|
-
const leaving =
|
|
4573
|
-
const leave =
|
|
4604
|
+
const leaving = React41.useRef(false);
|
|
4605
|
+
const leave = React41.useCallback((after) => {
|
|
4574
4606
|
if (leaving.current) return;
|
|
4575
4607
|
leaving.current = true;
|
|
4576
4608
|
if (durationMs === 0) return after();
|
|
4577
4609
|
reactNative.Animated.timing(progress, { toValue: 0, duration: durationMs, useNativeDriver: false }).start(() => after());
|
|
4578
4610
|
}, [progress, durationMs]);
|
|
4579
4611
|
const { close, pick: pickNow, submit: submitNow, onKey, sections, highlight } = state;
|
|
4580
|
-
const dismiss =
|
|
4581
|
-
const pick =
|
|
4582
|
-
const submit =
|
|
4583
|
-
const onKeyPress =
|
|
4612
|
+
const dismiss = React41.useCallback(() => leave(close), [leave, close]);
|
|
4613
|
+
const pick = React41.useCallback((option) => leave(() => pickNow(option)), [leave, pickNow]);
|
|
4614
|
+
const submit = React41.useCallback(() => submitNow(pick), [submitNow, pick]);
|
|
4615
|
+
const onKeyPress = React41.useCallback((key) => key === KEY_ESCAPE ? dismiss() : onKey(key), [dismiss, onKey]);
|
|
4584
4616
|
const translateY = progress.interpolate({ inputRange: [0, 1], outputRange: [motion.fromY, 0] });
|
|
4585
4617
|
const isSheet = motion.surface === "sheet" /* Sheet */;
|
|
4586
4618
|
const shared = { selectedValue, renderLeading, renderDetail, onPick: pick, optionHint: labels.optionHint, testID, highlight };
|
|
@@ -4617,8 +4649,8 @@ var styles31 = reactNative.StyleSheet.create({
|
|
|
4617
4649
|
empty: { padding: PANEL_PAD }
|
|
4618
4650
|
});
|
|
4619
4651
|
function useRefocusOnClose(open, ref) {
|
|
4620
|
-
const wasOpen =
|
|
4621
|
-
|
|
4652
|
+
const wasOpen = React41.useRef(false);
|
|
4653
|
+
React41.useEffect(() => {
|
|
4622
4654
|
if (wasOpen.current && !open) ref.current?.focus();
|
|
4623
4655
|
wasOpen.current = open;
|
|
4624
4656
|
}, [open, ref]);
|
|
@@ -4651,38 +4683,38 @@ var KEY_DOWN = "ArrowDown";
|
|
|
4651
4683
|
var KEY_UP = "ArrowUp";
|
|
4652
4684
|
var KEY_ESCAPE2 = "Escape";
|
|
4653
4685
|
function useSearchSelectState(options, recents, onChange, onClosed) {
|
|
4654
|
-
const [open, setOpen] =
|
|
4655
|
-
const [query, setQueryState] =
|
|
4656
|
-
const [rawHighlight, setHighlight] =
|
|
4657
|
-
const sections =
|
|
4686
|
+
const [open, setOpen] = React41.useState(false);
|
|
4687
|
+
const [query, setQueryState] = React41.useState("");
|
|
4688
|
+
const [rawHighlight, setHighlight] = React41.useState(-1);
|
|
4689
|
+
const sections = React41.useMemo(() => buildSearchSelectSections(options, query, recents.recents), [options, query, recents.recents]);
|
|
4658
4690
|
const highlight = rawHighlight < sections.flat.length ? rawHighlight : -1;
|
|
4659
4691
|
const active = sections.flat[highlight];
|
|
4660
4692
|
const { remember } = recents;
|
|
4661
|
-
const close =
|
|
4693
|
+
const close = React41.useCallback(() => {
|
|
4662
4694
|
setOpen(false);
|
|
4663
4695
|
setQueryState("");
|
|
4664
4696
|
setHighlight(-1);
|
|
4665
4697
|
onClosed();
|
|
4666
4698
|
}, [onClosed]);
|
|
4667
|
-
const pick =
|
|
4699
|
+
const pick = React41.useCallback((option) => {
|
|
4668
4700
|
remember(option.value);
|
|
4669
4701
|
onChange(option.value);
|
|
4670
4702
|
close();
|
|
4671
4703
|
}, [remember, onChange, close]);
|
|
4672
|
-
const submit =
|
|
4704
|
+
const submit = React41.useCallback((via = pick) => {
|
|
4673
4705
|
if (active !== void 0) via(active);
|
|
4674
4706
|
}, [active, pick]);
|
|
4675
|
-
const setQuery =
|
|
4707
|
+
const setQuery = React41.useCallback((next) => {
|
|
4676
4708
|
setQueryState(next);
|
|
4677
4709
|
setHighlight(highlightAfterQuery(next));
|
|
4678
4710
|
}, []);
|
|
4679
|
-
const onKey =
|
|
4711
|
+
const onKey = React41.useCallback((key) => {
|
|
4680
4712
|
const count = sections.flat.length;
|
|
4681
4713
|
if (key === KEY_DOWN) setHighlight(moveHighlight(highlight, count, 1));
|
|
4682
4714
|
if (key === KEY_UP) setHighlight(moveHighlight(highlight, count, -1));
|
|
4683
4715
|
if (key === KEY_ESCAPE2) close();
|
|
4684
4716
|
}, [sections.flat.length, highlight, close]);
|
|
4685
|
-
const openList =
|
|
4717
|
+
const openList = React41.useCallback(() => setOpen(true), []);
|
|
4686
4718
|
return { open, query, highlight, active, sections, openList, close, setQuery, pick, submit, onKey };
|
|
4687
4719
|
}
|
|
4688
4720
|
var CHEVRON = "\u25BE";
|
|
@@ -4693,8 +4725,8 @@ function SearchSelect(props) {
|
|
|
4693
4725
|
const { options, value, onChange, accessibilityLabel, accessibilityHint, labels, testID, recentKey, renderLeading, renderDetail, renderTrigger, onBlur } = props;
|
|
4694
4726
|
const { theme } = uiFeedback.useUi();
|
|
4695
4727
|
const { colors } = theme;
|
|
4696
|
-
const triggerRef =
|
|
4697
|
-
const anchorRef =
|
|
4728
|
+
const triggerRef = React41.useRef(null);
|
|
4729
|
+
const anchorRef = React41.useRef(null);
|
|
4698
4730
|
const { width } = reactNative.useWindowDimensions();
|
|
4699
4731
|
const motion = resolveSelectMotion(width, useReducedMotion());
|
|
4700
4732
|
const recents = useRecentValues(recentKey ?? `search-select:${testID}`);
|
|
@@ -4702,9 +4734,9 @@ function SearchSelect(props) {
|
|
|
4702
4734
|
useRefocusOnClose(state.open, triggerRef);
|
|
4703
4735
|
const selected = findOption(options, value);
|
|
4704
4736
|
const onPress = state.open ? state.close : state.openList;
|
|
4705
|
-
const openRef =
|
|
4737
|
+
const openRef = React41.useRef(state.open);
|
|
4706
4738
|
openRef.current = state.open;
|
|
4707
|
-
const onTriggerBlur =
|
|
4739
|
+
const onTriggerBlur = React41.useCallback(() => {
|
|
4708
4740
|
if (!openRef.current) onBlur?.();
|
|
4709
4741
|
}, [onBlur]);
|
|
4710
4742
|
return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { ref: anchorRef, style: styles32.anchor, children: [
|
|
@@ -4754,7 +4786,7 @@ function isOutside(container, target) {
|
|
|
4754
4786
|
return !(target instanceof Node && container.contains(target));
|
|
4755
4787
|
}
|
|
4756
4788
|
function useOutsidePress(ref, onOutside) {
|
|
4757
|
-
|
|
4789
|
+
React41.useEffect(() => {
|
|
4758
4790
|
if (reactNative.Platform.OS !== "web" || typeof document === "undefined") return void 0;
|
|
4759
4791
|
const onPointerDown = (event) => {
|
|
4760
4792
|
if (isOutside(ref.current, event.target)) onOutside();
|
|
@@ -4765,7 +4797,7 @@ function useOutsidePress(ref, onOutside) {
|
|
|
4765
4797
|
}
|
|
4766
4798
|
var AFTER_SURFACE_UNMOUNT_MS = 0;
|
|
4767
4799
|
function useDeferredFocus(ref) {
|
|
4768
|
-
return
|
|
4800
|
+
return React41.useCallback(() => {
|
|
4769
4801
|
setTimeout(() => ref.current?.focus(), AFTER_SURFACE_UNMOUNT_MS);
|
|
4770
4802
|
}, [ref]);
|
|
4771
4803
|
}
|
|
@@ -5517,8 +5549,8 @@ var renderFlag = (option) => option.value === NO_COUNTRY2 ? null : /* @__PURE__
|
|
|
5517
5549
|
function CountryField({ value, onChange, accessibilityLabel, accessibilityHint, labels, testID, countries, noneLabel, onBlur }) {
|
|
5518
5550
|
const { theme } = uiFeedback.useUi();
|
|
5519
5551
|
const { textSecondary } = theme.colors;
|
|
5520
|
-
const options =
|
|
5521
|
-
const renderCode =
|
|
5552
|
+
const options = React41.useMemo(() => countryFieldOptions(countries, noneLabel), [countries, noneLabel]);
|
|
5553
|
+
const renderCode = React41.useCallback((option) => /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles33.code, { color: textSecondary }], children: option.detail }), [textSecondary]);
|
|
5522
5554
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
5523
5555
|
SearchSelect,
|
|
5524
5556
|
{
|
|
@@ -5540,9 +5572,9 @@ var styles33 = reactNative.StyleSheet.create({
|
|
|
5540
5572
|
code: { fontSize: CODE_FONT }
|
|
5541
5573
|
});
|
|
5542
5574
|
function useBlurVerdict(validate) {
|
|
5543
|
-
const [verdict, setVerdict] =
|
|
5544
|
-
const onEdit =
|
|
5545
|
-
const onLeave =
|
|
5575
|
+
const [verdict, setVerdict] = React41.useState(null);
|
|
5576
|
+
const onEdit = React41.useCallback(() => setVerdict(null), []);
|
|
5577
|
+
const onLeave = React41.useCallback(() => {
|
|
5546
5578
|
const next = validate();
|
|
5547
5579
|
setVerdict(next);
|
|
5548
5580
|
return next;
|
|
@@ -5696,11 +5728,11 @@ function rawCaretAfterChange(previous, previousCaret, next) {
|
|
|
5696
5728
|
|
|
5697
5729
|
// src/IbanInput/hooks/useIbanCaret.ts
|
|
5698
5730
|
function useIbanCaret(display) {
|
|
5699
|
-
const [selection2, setSelection] =
|
|
5700
|
-
const onSelectionChange =
|
|
5731
|
+
const [selection2, setSelection] = React41.useState({ start: display.length, end: display.length });
|
|
5732
|
+
const onSelectionChange = React41.useCallback((event) => {
|
|
5701
5733
|
setSelection(event.nativeEvent.selection);
|
|
5702
5734
|
}, []);
|
|
5703
|
-
const placeAfterEdit =
|
|
5735
|
+
const placeAfterEdit = React41.useCallback((text) => {
|
|
5704
5736
|
const caret = caretAfterEdit(text, rawCaretAfterChange(display, selection2.end, text));
|
|
5705
5737
|
setSelection({ start: caret, end: caret });
|
|
5706
5738
|
}, [display, selection2.end]);
|
|
@@ -5806,19 +5838,19 @@ function rejectionMessage(rejection, none, labels) {
|
|
|
5806
5838
|
function IbanInput({ value, onChange, onVerdict, accessibilityLabel, accessibilityHint, testID, rejectionLabels, placeholder, onBlur: onLeft }) {
|
|
5807
5839
|
const { theme } = uiFeedback.useUi();
|
|
5808
5840
|
const { colors } = theme;
|
|
5809
|
-
const draft =
|
|
5810
|
-
const validate =
|
|
5841
|
+
const draft = React41.useMemo(() => draftIban(value), [value]);
|
|
5842
|
+
const validate = React41.useCallback(() => validateIban(value), [value]);
|
|
5811
5843
|
const { verdict, onEdit, onLeave } = useBlurVerdict(validate);
|
|
5812
5844
|
const message = value === "" ? null : rejectionMessage(verdict?.rejection ?? null, "None" /* None */, rejectionLabels);
|
|
5813
5845
|
const counter = ibanCounter(draft);
|
|
5814
5846
|
const { selection: selection2, onSelectionChange, placeAfterEdit } = useIbanCaret(draft.display);
|
|
5815
|
-
const onChangeText =
|
|
5847
|
+
const onChangeText = React41.useCallback((text) => {
|
|
5816
5848
|
onEdit();
|
|
5817
5849
|
onVerdict?.(null);
|
|
5818
5850
|
placeAfterEdit(text);
|
|
5819
5851
|
onChange(draftIban(text).electronic);
|
|
5820
5852
|
}, [onEdit, onVerdict, placeAfterEdit, onChange]);
|
|
5821
|
-
const onBlur =
|
|
5853
|
+
const onBlur = React41.useCallback(() => {
|
|
5822
5854
|
const verdict2 = onLeave();
|
|
5823
5855
|
onVerdict?.(value === "" ? null : verdict2);
|
|
5824
5856
|
onLeft?.();
|
|
@@ -5893,16 +5925,16 @@ function validateBic(raw) {
|
|
|
5893
5925
|
function BicInput({ value, onChange, onVerdict, accessibilityLabel, accessibilityHint, testID, rejectionLabels, placeholder, onBlur: onLeft }) {
|
|
5894
5926
|
const { theme } = uiFeedback.useUi();
|
|
5895
5927
|
const { colors } = theme;
|
|
5896
|
-
const draft =
|
|
5897
|
-
const validate =
|
|
5928
|
+
const draft = React41.useMemo(() => draftBic(value), [value]);
|
|
5929
|
+
const validate = React41.useCallback(() => validateBic(value), [value]);
|
|
5898
5930
|
const { verdict, onEdit, onLeave } = useBlurVerdict(validate);
|
|
5899
5931
|
const message = value === "" ? null : rejectionMessage(verdict?.rejection ?? null, "None" /* None */, rejectionLabels);
|
|
5900
|
-
const onChangeText =
|
|
5932
|
+
const onChangeText = React41.useCallback((text) => {
|
|
5901
5933
|
onEdit();
|
|
5902
5934
|
onVerdict?.(null);
|
|
5903
5935
|
onChange(draftBic(text).value);
|
|
5904
5936
|
}, [onEdit, onVerdict, onChange]);
|
|
5905
|
-
const onBlur =
|
|
5937
|
+
const onBlur = React41.useCallback(() => {
|
|
5906
5938
|
const verdict2 = onLeave();
|
|
5907
5939
|
onVerdict?.(value === "" ? null : verdict2);
|
|
5908
5940
|
onLeft?.();
|
|
@@ -6058,7 +6090,7 @@ var styles38 = reactNative.StyleSheet.create({
|
|
|
6058
6090
|
function RadioList(props) {
|
|
6059
6091
|
const { options, value, onChange, optionTestIDPrefix, label, error, required = false, disabled = false, testID } = props;
|
|
6060
6092
|
const { theme } = uiFeedback.useUi();
|
|
6061
|
-
const colors =
|
|
6093
|
+
const colors = React41__default.default.useMemo(() => buildChipColors(theme.colors, theme.palette), [theme.colors, theme.palette]);
|
|
6062
6094
|
const selectedIndex = options.findIndex((option) => option.value === value);
|
|
6063
6095
|
const radio = useRadioKeyboard({ enabled: true, disabled, values: options.map((option) => option.value), selectedIndex, onChange });
|
|
6064
6096
|
return /* @__PURE__ */ jsxRuntime.jsx(Field, { error, label, required, testID, children: ({ describedById, hasError }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -6213,12 +6245,12 @@ var SubmitError = ({ message, testID }) => {
|
|
|
6213
6245
|
};
|
|
6214
6246
|
var toggle = (list, id) => list.includes(id) ? list.filter((item) => item !== id) : [...list, id];
|
|
6215
6247
|
function useDecisionPanel(outcomes, onSubmit) {
|
|
6216
|
-
const [outcome, setOutcome] =
|
|
6217
|
-
const [note, setNote] =
|
|
6218
|
-
const [reasons, setReasons] =
|
|
6219
|
-
const [checked, setChecked] =
|
|
6220
|
-
const [error, setError] =
|
|
6221
|
-
const [pending, setPending] =
|
|
6248
|
+
const [outcome, setOutcome] = React41__default.default.useState("");
|
|
6249
|
+
const [note, setNote] = React41__default.default.useState("");
|
|
6250
|
+
const [reasons, setReasons] = React41__default.default.useState([]);
|
|
6251
|
+
const [checked, setChecked] = React41__default.default.useState([]);
|
|
6252
|
+
const [error, setError] = React41__default.default.useState(null);
|
|
6253
|
+
const [pending, setPending] = React41__default.default.useState(null);
|
|
6222
6254
|
const submit = async (override) => {
|
|
6223
6255
|
const target = override ?? outcome;
|
|
6224
6256
|
const problem = validateDecision(outcomes, target, note);
|
|
@@ -6306,10 +6338,10 @@ var styles42 = reactNative.StyleSheet.create({
|
|
|
6306
6338
|
});
|
|
6307
6339
|
function RuleMark({ tone, colors }) {
|
|
6308
6340
|
const reduced = useReducedMotion();
|
|
6309
|
-
const scale =
|
|
6310
|
-
const wasMet =
|
|
6341
|
+
const scale = React41.useRef(new reactNative.Animated.Value(1)).current;
|
|
6342
|
+
const wasMet = React41.useRef(tone === "met" /* Met */);
|
|
6311
6343
|
const met = tone === "met" /* Met */;
|
|
6312
|
-
|
|
6344
|
+
React41.useEffect(() => {
|
|
6313
6345
|
const turnedMet = met && !wasMet.current;
|
|
6314
6346
|
wasMet.current = met;
|
|
6315
6347
|
if (!turnedMet || reduced) return;
|
|
@@ -6424,9 +6456,9 @@ function ruleAnnouncement(changed, labels) {
|
|
|
6424
6456
|
|
|
6425
6457
|
// src/PasswordField/usePasswordRuleAnnouncement.ts
|
|
6426
6458
|
function usePasswordRuleAnnouncement(rules, labels) {
|
|
6427
|
-
const previous =
|
|
6428
|
-
const [message, setMessage] =
|
|
6429
|
-
|
|
6459
|
+
const previous = React41.useRef(rules);
|
|
6460
|
+
const [message, setMessage] = React41.useState("");
|
|
6461
|
+
React41.useEffect(() => {
|
|
6430
6462
|
const changed = changedRules(previous.current, rules);
|
|
6431
6463
|
previous.current = rules;
|
|
6432
6464
|
if (changed.length > 0) setMessage(ruleAnnouncement(changed, labels));
|
|
@@ -6443,7 +6475,7 @@ function ruleColorsFrom(palette) {
|
|
|
6443
6475
|
}
|
|
6444
6476
|
function useRuleColors(override) {
|
|
6445
6477
|
const { theme } = uiFeedback.useUi();
|
|
6446
|
-
return
|
|
6478
|
+
return React41.useMemo(() => {
|
|
6447
6479
|
if (override !== void 0) return ruleColorsFrom(override);
|
|
6448
6480
|
return ruleColorsFrom({
|
|
6449
6481
|
success: theme.semantic.success?.["500"] ?? theme.colors.text,
|
|
@@ -6470,16 +6502,16 @@ function joinIds(...ids) {
|
|
|
6470
6502
|
return joined === "" ? void 0 : joined;
|
|
6471
6503
|
}
|
|
6472
6504
|
function useCaretKeepingToggle(inputRef, initialLength) {
|
|
6473
|
-
const [revealed, setRevealed] =
|
|
6474
|
-
const selection2 =
|
|
6475
|
-
const hadFocus =
|
|
6476
|
-
const onSelectionChange =
|
|
6505
|
+
const [revealed, setRevealed] = React41.useState(false);
|
|
6506
|
+
const selection2 = React41.useRef({ start: initialLength, end: initialLength });
|
|
6507
|
+
const hadFocus = React41.useRef(false);
|
|
6508
|
+
const onSelectionChange = React41.useCallback((event) => {
|
|
6477
6509
|
selection2.current = event.nativeEvent.selection;
|
|
6478
6510
|
}, []);
|
|
6479
|
-
const onPressIn =
|
|
6511
|
+
const onPressIn = React41.useCallback(() => {
|
|
6480
6512
|
hadFocus.current = inputRef.current?.isFocused?.() ?? false;
|
|
6481
6513
|
}, [inputRef]);
|
|
6482
|
-
const onToggle =
|
|
6514
|
+
const onToggle = React41.useCallback(() => {
|
|
6483
6515
|
setRevealed((current) => !current);
|
|
6484
6516
|
if (!hadFocus.current) return;
|
|
6485
6517
|
const node = inputRef.current;
|
|
@@ -6491,9 +6523,9 @@ function useCaretKeepingToggle(inputRef, initialLength) {
|
|
|
6491
6523
|
}, [inputRef]);
|
|
6492
6524
|
return { revealed, onPressIn, onToggle, onSelectionChange };
|
|
6493
6525
|
}
|
|
6494
|
-
var PasswordField =
|
|
6495
|
-
const inputRef =
|
|
6496
|
-
|
|
6526
|
+
var PasswordField = React41__default.default.forwardRef(function PasswordField2({ label, value, onChangeText, labels, testID, rules = NO_RULES, rulesDisplay = "meterGrid" /* MeterGrid */, flagUnmet = false, error, colors: colorOverride, inputProps }, ref) {
|
|
6527
|
+
const inputRef = React41.useRef(null);
|
|
6528
|
+
React41.useImperativeHandle(ref, () => inputRef.current);
|
|
6497
6529
|
const toggle2 = useCaretKeepingToggle(inputRef, value.length);
|
|
6498
6530
|
const colors = useRuleColors(colorOverride);
|
|
6499
6531
|
const announcement = usePasswordRuleAnnouncement(rules, labels);
|
|
@@ -6535,6 +6567,7 @@ exports.AnchoredMenu = AnchoredMenu;
|
|
|
6535
6567
|
exports.BicInput = BicInput;
|
|
6536
6568
|
exports.BicRejection = BicRejection;
|
|
6537
6569
|
exports.COUNTRIES = COUNTRIES;
|
|
6570
|
+
exports.CheckboxLookProvider = CheckboxLookProvider;
|
|
6538
6571
|
exports.ChipLabelWrap = ChipLabelWrap;
|
|
6539
6572
|
exports.ChipSelector = ChipSelector;
|
|
6540
6573
|
exports.CountryField = CountryField;
|