@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.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React41, { createContext, forwardRef, useRef, useImperativeHandle, useState, useCallback, useMemo, useEffect, useLayoutEffect, useContext } from 'react';
|
|
2
2
|
import { Platform, StyleSheet, TextInput, View, Text, Pressable, useWindowDimensions, ScrollView, Animated, Easing, AccessibilityInfo, Image, TouchableOpacity, Switch, Modal } from 'react-native';
|
|
3
3
|
import { useUi } from '@dloizides/ui-feedback';
|
|
4
4
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
@@ -12,7 +12,7 @@ import { parseFieldErrors } from '@dloizides/api-client-base';
|
|
|
12
12
|
|
|
13
13
|
// src/Field/Field.tsx
|
|
14
14
|
function attachControlId(child, candidateId, describedById) {
|
|
15
|
-
if (!
|
|
15
|
+
if (!React41.isValidElement(child) || child.type === React41.Fragment) {
|
|
16
16
|
return { node: child };
|
|
17
17
|
}
|
|
18
18
|
const props = child.props;
|
|
@@ -23,7 +23,7 @@ function attachControlId(child, candidateId, describedById) {
|
|
|
23
23
|
if (describedById !== void 0 && props.describedById === void 0) {
|
|
24
24
|
injected.describedById = describedById;
|
|
25
25
|
}
|
|
26
|
-
return { node:
|
|
26
|
+
return { node: React41.cloneElement(element, injected), controlId };
|
|
27
27
|
}
|
|
28
28
|
var IS_WEB = Platform.OS === "web";
|
|
29
29
|
function isAttributeHost(node) {
|
|
@@ -141,15 +141,15 @@ var labelVariantStyles = StyleSheet.create({
|
|
|
141
141
|
function resolveLabelVariantStyle(variant) {
|
|
142
142
|
return labelVariantStyles[variant ?? "field"] ?? labelVariantStyles.field;
|
|
143
143
|
}
|
|
144
|
-
var FormGridContext =
|
|
145
|
-
var GapOwnedContext =
|
|
144
|
+
var FormGridContext = React41.createContext(null);
|
|
145
|
+
var GapOwnedContext = React41.createContext(false);
|
|
146
146
|
var FormGridProvider = FormGridContext.Provider;
|
|
147
147
|
var GapOwnedProvider = GapOwnedContext.Provider;
|
|
148
148
|
function useFormGridMetrics() {
|
|
149
|
-
return
|
|
149
|
+
return React41.useContext(FormGridContext);
|
|
150
150
|
}
|
|
151
151
|
function useIsGapOwned() {
|
|
152
|
-
return
|
|
152
|
+
return React41.useContext(GapOwnedContext);
|
|
153
153
|
}
|
|
154
154
|
var ERROR_LIGHT_STEPS = ["500", "600", "700"];
|
|
155
155
|
var ERROR_DARK_STEPS = ["300", "200", "400", "100", "500"];
|
|
@@ -172,7 +172,7 @@ var styles = StyleSheet.create({
|
|
|
172
172
|
});
|
|
173
173
|
var fieldSeq = 0;
|
|
174
174
|
function useFieldIds() {
|
|
175
|
-
const [ids] =
|
|
175
|
+
const [ids] = React41.useState(() => {
|
|
176
176
|
fieldSeq += 1;
|
|
177
177
|
const seq = String(fieldSeq);
|
|
178
178
|
return {
|
|
@@ -219,7 +219,7 @@ var Field = ({
|
|
|
219
219
|
const hasLabel = labelText !== "";
|
|
220
220
|
const marker = resolveFieldMarker(required, optional);
|
|
221
221
|
const { hintId, errorId, controlId, labelId } = useFieldIds();
|
|
222
|
-
const themeStyles =
|
|
222
|
+
const themeStyles = React41.useMemo(
|
|
223
223
|
() => ({
|
|
224
224
|
label: { color: colors.textSecondary },
|
|
225
225
|
requiredMark: { color: errorColor },
|
|
@@ -271,7 +271,7 @@ var FormGrid = ({
|
|
|
271
271
|
style,
|
|
272
272
|
testID
|
|
273
273
|
}) => {
|
|
274
|
-
const metrics =
|
|
274
|
+
const metrics = React41.useMemo(() => ({ minWidth, basis }), [minWidth, basis]);
|
|
275
275
|
return /* @__PURE__ */ jsx(FormGridProvider, { value: metrics, children: /* @__PURE__ */ jsx(GapOwnedProvider, { value: true, children: /* @__PURE__ */ jsx(View, { style: [styles2.grid, { gap }, style], testID, children }) }) });
|
|
276
276
|
};
|
|
277
277
|
var LABEL_LINE_PLACEHOLDER = "\xA0";
|
|
@@ -538,7 +538,7 @@ var styles9 = StyleSheet.create({
|
|
|
538
538
|
});
|
|
539
539
|
var sectionSeq = 0;
|
|
540
540
|
function useSectionLegendId() {
|
|
541
|
-
const [id] =
|
|
541
|
+
const [id] = React41.useState(() => {
|
|
542
542
|
sectionSeq += 1;
|
|
543
543
|
return `form-section-legend-${String(sectionSeq)}`;
|
|
544
544
|
});
|
|
@@ -932,7 +932,7 @@ function AnchoredMenu({
|
|
|
932
932
|
listbox,
|
|
933
933
|
placement
|
|
934
934
|
}) {
|
|
935
|
-
const menuRef =
|
|
935
|
+
const menuRef = React41.useRef(null);
|
|
936
936
|
useDismiss(anchorRef, menuRef, onDismiss);
|
|
937
937
|
useKeepHighlightInView(testID, listbox?.highlightedValue);
|
|
938
938
|
const rect2 = useAnchorRect(placement?.positionRef ?? anchorRef, usePortal);
|
|
@@ -1092,7 +1092,7 @@ var boxStyles = StyleSheet.create({
|
|
|
1092
1092
|
textAlignVertical: "top"
|
|
1093
1093
|
}
|
|
1094
1094
|
});
|
|
1095
|
-
var ThemedTextInput =
|
|
1095
|
+
var ThemedTextInput = React41.forwardRef(function ThemedTextInput2({
|
|
1096
1096
|
hasError = false,
|
|
1097
1097
|
describedById,
|
|
1098
1098
|
requiredField = false,
|
|
@@ -1554,7 +1554,7 @@ function ChipContent(props) {
|
|
|
1554
1554
|
}
|
|
1555
1555
|
function OutlineChip(props) {
|
|
1556
1556
|
const { option, selected, disabled, colors, testID, accessibilityHint, onPress } = props;
|
|
1557
|
-
const [hovered, setHovered] =
|
|
1557
|
+
const [hovered, setHovered] = React41.useState(false);
|
|
1558
1558
|
const active = selected || hovered;
|
|
1559
1559
|
const borderColor = active ? colors.primary : restBorderColor(colors, props.outlineTone);
|
|
1560
1560
|
const fill = chipFill({
|
|
@@ -1670,8 +1670,8 @@ function radioTabIndex(index, selectedIndex, disabled) {
|
|
|
1670
1670
|
var NO_GROUP_PROPS = {};
|
|
1671
1671
|
function useRadioKeyboard(config) {
|
|
1672
1672
|
const { enabled, disabled, values, selectedIndex, onChange } = config;
|
|
1673
|
-
const nodes =
|
|
1674
|
-
const chipRef =
|
|
1673
|
+
const nodes = React41.useRef([]);
|
|
1674
|
+
const chipRef = React41.useCallback((index) => (node) => {
|
|
1675
1675
|
nodes.current[index] = node;
|
|
1676
1676
|
}, []);
|
|
1677
1677
|
const onKeyDown = (event) => {
|
|
@@ -1790,7 +1790,7 @@ var ChipSelector = ({
|
|
|
1790
1790
|
const isRadioGroup = !multiple && singleSelectRole === "radio";
|
|
1791
1791
|
const { theme } = useUi();
|
|
1792
1792
|
const { colors, palette } = theme;
|
|
1793
|
-
const chipColors =
|
|
1793
|
+
const chipColors = React41.useMemo(() => buildChipColors(colors, palette), [colors, palette]);
|
|
1794
1794
|
function isSelected(optionValue) {
|
|
1795
1795
|
if (multiple && Array.isArray(value))
|
|
1796
1796
|
return value.includes(optionValue);
|
|
@@ -1915,10 +1915,10 @@ var FormSwitchBox = ({
|
|
|
1915
1915
|
}) => {
|
|
1916
1916
|
const { colors } = useUi().theme;
|
|
1917
1917
|
const { disabled, onValueChange, value } = slot;
|
|
1918
|
-
const toggle2 =
|
|
1918
|
+
const toggle2 = React41.useCallback(() => {
|
|
1919
1919
|
if (!disabled) onValueChange(!value);
|
|
1920
1920
|
}, [disabled, onValueChange, value]);
|
|
1921
|
-
const boxColors =
|
|
1921
|
+
const boxColors = React41.useMemo(
|
|
1922
1922
|
() => ({ borderColor: colors.border, backgroundColor: colors.surface }),
|
|
1923
1923
|
[colors.border, colors.surface]
|
|
1924
1924
|
);
|
|
@@ -1972,12 +1972,12 @@ var FormSwitchRow = ({
|
|
|
1972
1972
|
activeTrackColor
|
|
1973
1973
|
}) => {
|
|
1974
1974
|
const { theme } = useUi();
|
|
1975
|
-
const toggle2 =
|
|
1975
|
+
const toggle2 = React41.useCallback(() => {
|
|
1976
1976
|
if (!disabled) onValueChange(!value);
|
|
1977
1977
|
}, [disabled, onValueChange, value]);
|
|
1978
1978
|
const { colors } = theme;
|
|
1979
1979
|
const hasDescription = typeof description === "string" && description !== "";
|
|
1980
|
-
const themeStyles =
|
|
1980
|
+
const themeStyles = React41.useMemo(() => {
|
|
1981
1981
|
const labelStyle = { color: colors.text };
|
|
1982
1982
|
const descriptionStyle = { color: colors.textSecondary };
|
|
1983
1983
|
return { label: labelStyle, description: descriptionStyle };
|
|
@@ -2029,6 +2029,17 @@ var FormSwitch = ({
|
|
|
2029
2029
|
}) => variant === "box" ? /* @__PURE__ */ jsx(FormSwitchBox, { ...props, disabled, stateLabel, testID }) : /* @__PURE__ */ jsx(FormSwitchRow, { ...props, disabled, testID });
|
|
2030
2030
|
var checkboxBoxColors = (colors, brand, checked) => checked ? { backgroundColor: brand, borderColor: brand } : { backgroundColor: "transparent", borderColor: colors.textSecondary };
|
|
2031
2031
|
var checkboxTickColor = (brand) => resolveOnBrand(brand);
|
|
2032
|
+
var COMPACT_BOX = { width: 16, height: 16, borderRadius: 4, borderWidth: 1.5 };
|
|
2033
|
+
var CheckboxLookContext = createContext("default");
|
|
2034
|
+
function CheckboxLookProvider({ look, children }) {
|
|
2035
|
+
return /* @__PURE__ */ jsx(CheckboxLookContext.Provider, { value: look, children });
|
|
2036
|
+
}
|
|
2037
|
+
function checkboxLookBox(look) {
|
|
2038
|
+
return look === "compact" ? COMPACT_BOX : void 0;
|
|
2039
|
+
}
|
|
2040
|
+
function useCheckboxLookBox() {
|
|
2041
|
+
return checkboxLookBox(useContext(CheckboxLookContext));
|
|
2042
|
+
}
|
|
2032
2043
|
var ACTIVATION_KEYS = ["Enter", " ", "Spacebar"];
|
|
2033
2044
|
var HINT_FONT_SIZE2 = 12;
|
|
2034
2045
|
var BOX_SIZE = 20;
|
|
@@ -2112,14 +2123,15 @@ var FormCheckbox = ({
|
|
|
2112
2123
|
accessibilityHint,
|
|
2113
2124
|
labelHidden = false
|
|
2114
2125
|
}) => {
|
|
2126
|
+
const lookBox = useCheckboxLookBox();
|
|
2115
2127
|
const { theme } = useUi();
|
|
2116
2128
|
const { colors, palette } = theme;
|
|
2117
2129
|
const brand = palette.primary["500"];
|
|
2118
2130
|
const hintText = typeof hint === "string" && hint !== "" ? hint : description;
|
|
2119
2131
|
const hasHint = typeof hintText === "string" && hintText !== "";
|
|
2120
2132
|
const { hintId } = useFieldIds();
|
|
2121
|
-
const [focused, setFocused] =
|
|
2122
|
-
const themeStyles =
|
|
2133
|
+
const [focused, setFocused] = React41.useState(false);
|
|
2134
|
+
const themeStyles = React41.useMemo(() => {
|
|
2123
2135
|
const boxOn = checkboxBoxColors(colors, brand, true);
|
|
2124
2136
|
const boxOff = checkboxBoxColors(colors, brand, false);
|
|
2125
2137
|
const ring = { borderColor: brand };
|
|
@@ -2166,7 +2178,7 @@ var FormCheckbox = ({
|
|
|
2166
2178
|
testID,
|
|
2167
2179
|
...keyboardProps,
|
|
2168
2180
|
children: [
|
|
2169
|
-
/* @__PURE__ */ jsxs(View, { style: [styles17.box, value ? themeStyles.boxOn : themeStyles.boxOff], testID: `${testID}-box`, children: [
|
|
2181
|
+
/* @__PURE__ */ jsxs(View, { style: [styles17.box, lookBox, value ? themeStyles.boxOn : themeStyles.boxOff], testID: `${testID}-box`, children: [
|
|
2170
2182
|
focused ? /* @__PURE__ */ jsx(View, { pointerEvents: "none", style: [styles17.focusRing, themeStyles.ring], testID: `${testID}-focus-ring` }) : null,
|
|
2171
2183
|
value ? /* @__PURE__ */ jsx(View, { accessibilityElementsHidden: true, pointerEvents: "none", style: [styles17.tick, themeStyles.tick], testID: `${testID}-tick` }) : null
|
|
2172
2184
|
] }),
|
|
@@ -2204,26 +2216,34 @@ var FIELD_PAD_H = 10;
|
|
|
2204
2216
|
var FIELD_FONT = 13;
|
|
2205
2217
|
var FIELD_RADIUS = 8;
|
|
2206
2218
|
var FIELD_CHEVRON_ROOM = 30;
|
|
2219
|
+
var CHIP_DESKTOP_HEIGHT = 30;
|
|
2220
|
+
var CHIP_GAP = 6;
|
|
2207
2221
|
var CHEVRON_BOX = 16;
|
|
2208
2222
|
var DEFAULT_CONFIG = { look: "default" };
|
|
2209
2223
|
var SelectLookContext = createContext(DEFAULT_CONFIG);
|
|
2210
|
-
function SelectLookProvider({ look, borderColor, children }) {
|
|
2211
|
-
const value = useMemo(() => ({ look, borderColor }), [look, borderColor]);
|
|
2224
|
+
function SelectLookProvider({ look, borderColor, backgroundColor, textColor, children }) {
|
|
2225
|
+
const value = useMemo(() => ({ look, borderColor, backgroundColor, textColor }), [look, borderColor, backgroundColor, textColor]);
|
|
2212
2226
|
return /* @__PURE__ */ jsx(SelectLookContext.Provider, { value, children });
|
|
2213
2227
|
}
|
|
2214
|
-
function selectLookMetrics({ look, borderColor }, windowWidth) {
|
|
2228
|
+
function selectLookMetrics({ look, borderColor, backgroundColor, textColor }, windowWidth) {
|
|
2215
2229
|
if (look === "default") {
|
|
2216
2230
|
return void 0;
|
|
2217
2231
|
}
|
|
2218
2232
|
const isPhone = windowWidth < PHONE_MAX_WIDTH;
|
|
2233
|
+
const isChip = look === "chip";
|
|
2234
|
+
const desktopHeight = isChip ? CHIP_DESKTOP_HEIGHT : FIELD_DESKTOP_HEIGHT;
|
|
2219
2235
|
return {
|
|
2220
|
-
height: isPhone ? FIELD_PHONE_HEIGHT :
|
|
2236
|
+
height: isPhone ? FIELD_PHONE_HEIGHT : desktopHeight,
|
|
2221
2237
|
paddingHorizontal: FIELD_PAD_H,
|
|
2222
2238
|
paddingVertical: 0,
|
|
2223
2239
|
fontSize: FIELD_FONT,
|
|
2224
2240
|
borderRadius: FIELD_RADIUS,
|
|
2225
2241
|
chevronRoom: FIELD_CHEVRON_ROOM,
|
|
2226
|
-
|
|
2242
|
+
hug: isChip,
|
|
2243
|
+
gap: isChip ? CHIP_GAP : void 0,
|
|
2244
|
+
borderColor,
|
|
2245
|
+
backgroundColor,
|
|
2246
|
+
textColor
|
|
2227
2247
|
};
|
|
2228
2248
|
}
|
|
2229
2249
|
function useSelectLookMetrics() {
|
|
@@ -2263,10 +2283,10 @@ function lookSelectStyle(fit, m, colors) {
|
|
|
2263
2283
|
paddingInlineStart: m.paddingHorizontal,
|
|
2264
2284
|
paddingInlineEnd: m.chevronRoom,
|
|
2265
2285
|
borderColor: m.borderColor ?? colors.border,
|
|
2266
|
-
backgroundColor: colors.background,
|
|
2267
|
-
color: colors.text,
|
|
2286
|
+
backgroundColor: m.backgroundColor ?? colors.background,
|
|
2287
|
+
color: m.textColor ?? colors.text,
|
|
2268
2288
|
appearance: "none",
|
|
2269
|
-
backgroundImage: chevronDataUri(colors.chevron),
|
|
2289
|
+
backgroundImage: chevronDataUri(m.textColor ?? colors.chevron),
|
|
2270
2290
|
backgroundRepeat: "no-repeat",
|
|
2271
2291
|
backgroundPosition: `right ${String(CHEVRON_INSET)}px center`,
|
|
2272
2292
|
backgroundSize: "16px 16px"
|
|
@@ -2364,7 +2384,18 @@ var IS_WEB7 = Platform.OS === "web";
|
|
|
2364
2384
|
var CHEVRON_DOWN = "\u25BE";
|
|
2365
2385
|
var CHEVRON_UP = "\u25B4";
|
|
2366
2386
|
function lookTriggerBox(m) {
|
|
2367
|
-
|
|
2387
|
+
if (m === void 0) return void 0;
|
|
2388
|
+
const hug = m.hug ? { justifyContent: "flex-start", alignSelf: "flex-start", gap: m.gap } : void 0;
|
|
2389
|
+
return { minHeight: m.height, height: m.height, paddingHorizontal: m.paddingHorizontal, paddingVertical: m.paddingVertical, borderRadius: m.borderRadius, ...hug };
|
|
2390
|
+
}
|
|
2391
|
+
function triggerInk(m, colors, isEmpty) {
|
|
2392
|
+
const themeText = isEmpty ? colors.textSecondary : colors.text;
|
|
2393
|
+
return {
|
|
2394
|
+
border: m?.borderColor ?? colors.border,
|
|
2395
|
+
background: m?.backgroundColor ?? colors.surfaceElevated,
|
|
2396
|
+
text: m?.textColor ?? themeText,
|
|
2397
|
+
chevron: m?.textColor ?? colors.textSecondary
|
|
2398
|
+
};
|
|
2368
2399
|
}
|
|
2369
2400
|
function listboxTriggerAria(testID, hasList, highlighted) {
|
|
2370
2401
|
return {
|
|
@@ -2414,6 +2445,7 @@ function MenuSelectControl({
|
|
|
2414
2445
|
[onChange]
|
|
2415
2446
|
);
|
|
2416
2447
|
const metrics = useSelectLookMetrics();
|
|
2448
|
+
const ink = triggerInk(metrics, colors, value === "");
|
|
2417
2449
|
const listbox = useSelectListbox({ options, isOpen, open, toggle: toggle2, select });
|
|
2418
2450
|
const isListbox = menuAnchor !== void 0;
|
|
2419
2451
|
const captureKeys = isListbox ? { onKeyDownCapture: listbox.onKeyDown } : {};
|
|
@@ -2432,11 +2464,11 @@ function MenuSelectControl({
|
|
|
2432
2464
|
"aria-labelledby": labelledById,
|
|
2433
2465
|
onBlur: isListbox ? close : void 0,
|
|
2434
2466
|
onPress: toggle2,
|
|
2435
|
-
style: [controlStyles.selectTrigger, lookTriggerBox(metrics), { borderColor:
|
|
2467
|
+
style: [controlStyles.selectTrigger, lookTriggerBox(metrics), { borderColor: ink.border, backgroundColor: ink.background }],
|
|
2436
2468
|
testID: `${testID}-trigger`,
|
|
2437
2469
|
children: [
|
|
2438
|
-
/* @__PURE__ */ jsx(Text, { numberOfLines: 1, style: [controlStyles.selectTriggerText, metrics === void 0 ? void 0 : { fontSize: metrics.fontSize }, { color:
|
|
2439
|
-
metrics === void 0 ? /* @__PURE__ */ jsx(Text, { "aria-hidden": true, style: [controlStyles.chevron, { color:
|
|
2470
|
+
/* @__PURE__ */ jsx(Text, { numberOfLines: 1, style: [controlStyles.selectTriggerText, metrics === void 0 ? void 0 : { fontSize: metrics.fontSize }, { color: ink.text }], children: selectedLabel }),
|
|
2471
|
+
metrics === void 0 ? /* @__PURE__ */ jsx(Text, { "aria-hidden": true, style: [controlStyles.chevron, { color: ink.chevron }], children: isOpen ? CHEVRON_UP : CHEVRON_DOWN }) : /* @__PURE__ */ jsx(SelectChevron, { color: ink.chevron, open: isOpen })
|
|
2440
2472
|
]
|
|
2441
2473
|
}
|
|
2442
2474
|
),
|
|
@@ -2482,7 +2514,7 @@ var SelectField = ({
|
|
|
2482
2514
|
) });
|
|
2483
2515
|
};
|
|
2484
2516
|
var REMOVE_GLYPH = "\xD7";
|
|
2485
|
-
var
|
|
2517
|
+
var CHIP_GAP2 = 4;
|
|
2486
2518
|
var CHIP_PAD_H = 8;
|
|
2487
2519
|
var CHIP_PAD_V = 4;
|
|
2488
2520
|
var CHIP_RADIUS = 999;
|
|
@@ -2491,7 +2523,7 @@ var styles18 = StyleSheet.create({
|
|
|
2491
2523
|
chip: {
|
|
2492
2524
|
flexDirection: "row",
|
|
2493
2525
|
alignItems: "center",
|
|
2494
|
-
gap:
|
|
2526
|
+
gap: CHIP_GAP2,
|
|
2495
2527
|
paddingHorizontal: CHIP_PAD_H,
|
|
2496
2528
|
paddingVertical: CHIP_PAD_V,
|
|
2497
2529
|
borderWidth: 1,
|
|
@@ -6051,7 +6083,7 @@ var styles38 = StyleSheet.create({
|
|
|
6051
6083
|
function RadioList(props) {
|
|
6052
6084
|
const { options, value, onChange, optionTestIDPrefix, label, error, required = false, disabled = false, testID } = props;
|
|
6053
6085
|
const { theme } = useUi();
|
|
6054
|
-
const colors =
|
|
6086
|
+
const colors = React41.useMemo(() => buildChipColors(theme.colors, theme.palette), [theme.colors, theme.palette]);
|
|
6055
6087
|
const selectedIndex = options.findIndex((option) => option.value === value);
|
|
6056
6088
|
const radio = useRadioKeyboard({ enabled: true, disabled, values: options.map((option) => option.value), selectedIndex, onChange });
|
|
6057
6089
|
return /* @__PURE__ */ jsx(Field, { error, label, required, testID, children: ({ describedById, hasError }) => /* @__PURE__ */ jsx(
|
|
@@ -6206,12 +6238,12 @@ var SubmitError = ({ message, testID }) => {
|
|
|
6206
6238
|
};
|
|
6207
6239
|
var toggle = (list, id) => list.includes(id) ? list.filter((item) => item !== id) : [...list, id];
|
|
6208
6240
|
function useDecisionPanel(outcomes, onSubmit) {
|
|
6209
|
-
const [outcome, setOutcome] =
|
|
6210
|
-
const [note, setNote] =
|
|
6211
|
-
const [reasons, setReasons] =
|
|
6212
|
-
const [checked, setChecked] =
|
|
6213
|
-
const [error, setError] =
|
|
6214
|
-
const [pending, setPending] =
|
|
6241
|
+
const [outcome, setOutcome] = React41.useState("");
|
|
6242
|
+
const [note, setNote] = React41.useState("");
|
|
6243
|
+
const [reasons, setReasons] = React41.useState([]);
|
|
6244
|
+
const [checked, setChecked] = React41.useState([]);
|
|
6245
|
+
const [error, setError] = React41.useState(null);
|
|
6246
|
+
const [pending, setPending] = React41.useState(null);
|
|
6215
6247
|
const submit = async (override) => {
|
|
6216
6248
|
const target = override ?? outcome;
|
|
6217
6249
|
const problem = validateDecision(outcomes, target, note);
|
|
@@ -6484,7 +6516,7 @@ function useCaretKeepingToggle(inputRef, initialLength) {
|
|
|
6484
6516
|
}, [inputRef]);
|
|
6485
6517
|
return { revealed, onPressIn, onToggle, onSelectionChange };
|
|
6486
6518
|
}
|
|
6487
|
-
var PasswordField =
|
|
6519
|
+
var PasswordField = React41.forwardRef(function PasswordField2({ label, value, onChangeText, labels, testID, rules = NO_RULES, rulesDisplay = "meterGrid" /* MeterGrid */, flagUnmet = false, error, colors: colorOverride, inputProps }, ref) {
|
|
6488
6520
|
const inputRef = useRef(null);
|
|
6489
6521
|
useImperativeHandle(ref, () => inputRef.current);
|
|
6490
6522
|
const toggle2 = useCaretKeepingToggle(inputRef, value.length);
|
|
@@ -6521,6 +6553,6 @@ var PasswordField = React40.forwardRef(function PasswordField2({ label, value, o
|
|
|
6521
6553
|
] }) });
|
|
6522
6554
|
});
|
|
6523
6555
|
|
|
6524
|
-
export { ActionBar, AddOnRequest, AlignToControl, AnchoredMenu, BicInput, BicRejection, COUNTRIES, ChipLabelWrap, ChipSelector, CountryField, CountryFlag, DEFAULT_DATE_PICKER_LABELS, DEFAULT_MAX_RECENTS, DEFAULT_OPTIONAL_LABEL, DEFAULT_TYPEAHEAD_MAX_SUGGESTIONS, DEFAULT_TYPEAHEAD_MIN_CHARS, DateDisplay, DateField, DateInput, DatePickerProvider, DateRangeControl, DateTimeField, DecisionPanel, DropdownPlacement, FLAG_HEIGHT, FLAG_WIDTH, Field, FileInput, FixBar, FlagShapeKind, FormActions, FormCell, FormCheckbox, FormField, FormGrid, FormSection, FormStack, FormStatusLine, FormSwitch, GatedChecklist, IBAN_MAX_LENGTH, IBAN_REGISTERED_COUNTRY_COUNT, INLINE_FIELD_ROW_MIN_WIDTH, IbanInput, IbanRejection, InlineFieldRow, LINE_ITEMS_WIDE_MIN_WIDTH, LineItems, MultiSelectField, PHONE_MAX_WIDTH, PasswordField, PasswordRules, PasswordRulesDisplay, RESPONSIVE_FORM_DEFAULT_BREAKPOINT, RadioList, ResponsiveFormLayout, RevealToggle, RuleTone, SEGMENT_BESIDE_FIELD, SEGMENT_BESIDE_TEXT_INPUT, SearchSelect, SelectControl, SelectField, SelectLookProvider, SelectSurface, StepperNav, StepperTabs, ThemedTextInput, TypeaheadControl, UploadWithLinkField, actionBarPosition, assignServerErrors, buildSearchSelectSections, canRemoveLine, changedRules, controlStyles, countryFieldOptions, countryFlag, countryOptions, defaultDecisionVariant, draftBic, draftIban, dropdownFrame, findOption, fitDropdownWidth, flagShapes, groupAriaChecked, groupInFours, highlightAfterQuery, ibanCounter, ibanLengthFor, inlineFieldRowLayout, isAddOnOpen, isChecklistComplete, isFallbackFlag, isFixBarVisible, isLineItemsWide, isOutside, isUnmatched, isWideFormLayout, leadFirst, lineItemColumnFlex, lineNumberOf, moveHighlight, nextHighlight, placeDropdown, radioRowIdentity, rejectionMessage, resolveGroupSelection, resolveSelectMotion, resolveStepNeighbours, rowsForText, ruleAnnouncement, ruleColorsFrom, ruleTone, selectLookMetrics, suggestOptions, toCountryValue, toggleGroupSelection, useAutoGrowRows, useBlurVerdict, useDeferredFocus, useFocusFirstInvalid, useKeepInView, useOutsidePress, useRecentValues, useReducedMotion, useSearchSelectState, useServerFieldErrors, useThemedInput, validateBic, validateDecision, validateIban };
|
|
6556
|
+
export { ActionBar, AddOnRequest, AlignToControl, AnchoredMenu, BicInput, BicRejection, COUNTRIES, CheckboxLookProvider, ChipLabelWrap, ChipSelector, CountryField, CountryFlag, DEFAULT_DATE_PICKER_LABELS, DEFAULT_MAX_RECENTS, DEFAULT_OPTIONAL_LABEL, DEFAULT_TYPEAHEAD_MAX_SUGGESTIONS, DEFAULT_TYPEAHEAD_MIN_CHARS, DateDisplay, DateField, DateInput, DatePickerProvider, DateRangeControl, DateTimeField, DecisionPanel, DropdownPlacement, FLAG_HEIGHT, FLAG_WIDTH, Field, FileInput, FixBar, FlagShapeKind, FormActions, FormCell, FormCheckbox, FormField, FormGrid, FormSection, FormStack, FormStatusLine, FormSwitch, GatedChecklist, IBAN_MAX_LENGTH, IBAN_REGISTERED_COUNTRY_COUNT, INLINE_FIELD_ROW_MIN_WIDTH, IbanInput, IbanRejection, InlineFieldRow, LINE_ITEMS_WIDE_MIN_WIDTH, LineItems, MultiSelectField, PHONE_MAX_WIDTH, PasswordField, PasswordRules, PasswordRulesDisplay, RESPONSIVE_FORM_DEFAULT_BREAKPOINT, RadioList, ResponsiveFormLayout, RevealToggle, RuleTone, SEGMENT_BESIDE_FIELD, SEGMENT_BESIDE_TEXT_INPUT, SearchSelect, SelectControl, SelectField, SelectLookProvider, SelectSurface, StepperNav, StepperTabs, ThemedTextInput, TypeaheadControl, UploadWithLinkField, actionBarPosition, assignServerErrors, buildSearchSelectSections, canRemoveLine, changedRules, controlStyles, countryFieldOptions, countryFlag, countryOptions, defaultDecisionVariant, draftBic, draftIban, dropdownFrame, findOption, fitDropdownWidth, flagShapes, groupAriaChecked, groupInFours, highlightAfterQuery, ibanCounter, ibanLengthFor, inlineFieldRowLayout, isAddOnOpen, isChecklistComplete, isFallbackFlag, isFixBarVisible, isLineItemsWide, isOutside, isUnmatched, isWideFormLayout, leadFirst, lineItemColumnFlex, lineNumberOf, moveHighlight, nextHighlight, placeDropdown, radioRowIdentity, rejectionMessage, resolveGroupSelection, resolveSelectMotion, resolveStepNeighbours, rowsForText, ruleAnnouncement, ruleColorsFrom, ruleTone, selectLookMetrics, suggestOptions, toCountryValue, toggleGroupSelection, useAutoGrowRows, useBlurVerdict, useDeferredFocus, useFocusFirstInvalid, useKeepInView, useOutsidePress, useRecentValues, useReducedMotion, useSearchSelectState, useServerFieldErrors, useThemedInput, validateBic, validateDecision, validateIban };
|
|
6525
6557
|
//# sourceMappingURL=index.mjs.map
|
|
6526
6558
|
//# sourceMappingURL=index.mjs.map
|