@dloizides/ui-forms 1.57.0 → 1.59.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 +8 -1
- package/dist/index.d.ts +8 -1
- package/dist/index.js +25 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +25 -10
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React41, { createContext, forwardRef, useRef, useImperativeHandle, useState, useCallback, useMemo, useEffect,
|
|
1
|
+
import React41, { createContext, forwardRef, useRef, useImperativeHandle, useState, useCallback, useMemo, useEffect, useContext, useLayoutEffect } 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';
|
|
@@ -2191,6 +2191,14 @@ var FormCheckbox = ({
|
|
|
2191
2191
|
);
|
|
2192
2192
|
};
|
|
2193
2193
|
|
|
2194
|
+
// src/SelectControl/controlBorder.ts
|
|
2195
|
+
var CONTROL_BORDER_SCALE = "controlBorder";
|
|
2196
|
+
var MAIN_STEP2 = "500";
|
|
2197
|
+
function controlBorderOf(theme) {
|
|
2198
|
+
const scale = theme.palette[CONTROL_BORDER_SCALE];
|
|
2199
|
+
return scale?.[MAIN_STEP2] ?? theme.colors.border;
|
|
2200
|
+
}
|
|
2201
|
+
|
|
2194
2202
|
// src/SearchSelect/SelectSurface.ts
|
|
2195
2203
|
var SelectSurface = /* @__PURE__ */ ((SelectSurface2) => {
|
|
2196
2204
|
SelectSurface2["Sheet"] = "sheet";
|
|
@@ -2251,6 +2259,10 @@ function useSelectLookMetrics() {
|
|
|
2251
2259
|
const { width } = useWindowDimensions();
|
|
2252
2260
|
return selectLookMetrics(config, width);
|
|
2253
2261
|
}
|
|
2262
|
+
function lookInputBox(m) {
|
|
2263
|
+
if (m === void 0) return void 0;
|
|
2264
|
+
return { minHeight: m.height, height: m.height, paddingHorizontal: m.paddingHorizontal, paddingVertical: m.paddingVertical, fontSize: m.fontSize, borderRadius: m.borderRadius };
|
|
2265
|
+
}
|
|
2254
2266
|
function chevronDataUri(color) {
|
|
2255
2267
|
const svg = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="none" stroke="${color}" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"><path d="M4 6l4 4 4-4"/></svg>`;
|
|
2256
2268
|
return `url("data:image/svg+xml,${encodeURIComponent(svg)}")`;
|
|
@@ -2326,7 +2338,7 @@ function NativeSelect({
|
|
|
2326
2338
|
const textColor = hasMatch ? colors.text : colors.textSecondary;
|
|
2327
2339
|
const fit = native === "fit";
|
|
2328
2340
|
const metrics = useSelectLookMetrics();
|
|
2329
|
-
const selectStyle = metrics === void 0 ? nativeSelectStyle(fit,
|
|
2341
|
+
const selectStyle = metrics === void 0 ? nativeSelectStyle(fit, controlBorderOf(theme), colors.surfaceElevated, textColor) : lookSelectStyle(fit, metrics, { border: controlBorderOf(theme), background: colors.surfaceElevated, text: textColor, chevron: colors.textSecondary });
|
|
2330
2342
|
const handleChange = (event) => onChange(event.target.value);
|
|
2331
2343
|
return /* @__PURE__ */ jsx(View, { style: [controlStyles.anchor, fit ? fitStyles.anchor : void 0, metrics === void 0 ? void 0 : fitStyles.oneLine, style], children: /* @__PURE__ */ jsxs(
|
|
2332
2344
|
"select",
|
|
@@ -2391,7 +2403,7 @@ function lookTriggerBox(m) {
|
|
|
2391
2403
|
function triggerInk(m, colors, isEmpty) {
|
|
2392
2404
|
const themeText = isEmpty ? colors.textSecondary : colors.text;
|
|
2393
2405
|
return {
|
|
2394
|
-
border: m?.borderColor ?? colors.
|
|
2406
|
+
border: m?.borderColor ?? colors.controlBorder,
|
|
2395
2407
|
background: m?.backgroundColor ?? colors.surfaceElevated,
|
|
2396
2408
|
text: m?.textColor ?? themeText,
|
|
2397
2409
|
chevron: m?.textColor ?? colors.textSecondary
|
|
@@ -2445,7 +2457,7 @@ function MenuSelectControl({
|
|
|
2445
2457
|
[onChange]
|
|
2446
2458
|
);
|
|
2447
2459
|
const metrics = useSelectLookMetrics();
|
|
2448
|
-
const ink = triggerInk(metrics, colors, value === "");
|
|
2460
|
+
const ink = triggerInk(metrics, { ...colors, controlBorder: controlBorderOf(theme) }, value === "");
|
|
2449
2461
|
const listbox = useSelectListbox({ options, isOpen, open, toggle: toggle2, select });
|
|
2450
2462
|
const isListbox = menuAnchor !== void 0;
|
|
2451
2463
|
const captureKeys = isListbox ? { onKeyDownCapture: listbox.onKeyDown } : {};
|
|
@@ -2849,6 +2861,7 @@ function TypeaheadControlImpl(props, ref) {
|
|
|
2849
2861
|
const options = "options" in props ? props.options : void 0;
|
|
2850
2862
|
const maxSuggestions = ("search" in props ? props.search.maxResults : props.maxSuggestions) ?? DEFAULT_TYPEAHEAD_MAX_SUGGESTIONS;
|
|
2851
2863
|
const { theme } = useUi();
|
|
2864
|
+
const look = useSelectLookMetrics();
|
|
2852
2865
|
const { colors, palette } = theme;
|
|
2853
2866
|
const anchorRef = useRef(null);
|
|
2854
2867
|
const state = useTypeaheadState({ options, search, value, minChars, maxSuggestions, onChange, onSubmit });
|
|
@@ -2880,7 +2893,7 @@ function TypeaheadControlImpl(props, ref) {
|
|
|
2880
2893
|
onBlur: handleBlur,
|
|
2881
2894
|
onKeyPress: state.handleKeyPress,
|
|
2882
2895
|
onSubmitEditing: state.handleSubmit,
|
|
2883
|
-
style: [controlStyles.input, { borderColor: hasError ? fieldErrorInk(theme) : colors.border, backgroundColor: colors.surface, color: colors.text }],
|
|
2896
|
+
style: [controlStyles.input, { borderColor: hasError ? fieldErrorInk(theme) : colors.border, backgroundColor: colors.surface, color: colors.text }, lookInputBox(look)],
|
|
2884
2897
|
testID: search?.inputTestID ?? `${testID}-input`
|
|
2885
2898
|
}
|
|
2886
2899
|
),
|
|
@@ -2910,8 +2923,8 @@ var NATIVE_INPUT_BOX = {
|
|
|
2910
2923
|
fontFamily: "inherit",
|
|
2911
2924
|
width: "100%"
|
|
2912
2925
|
};
|
|
2913
|
-
function buildNativeInputStyle(themed) {
|
|
2914
|
-
const { paddingHorizontal, paddingVertical, ...box } = StyleSheet.flatten(controlStyles.input);
|
|
2926
|
+
function buildNativeInputStyle(themed, look) {
|
|
2927
|
+
const { paddingHorizontal, paddingVertical, ...box } = StyleSheet.flatten([controlStyles.input, look]);
|
|
2915
2928
|
return {
|
|
2916
2929
|
...box,
|
|
2917
2930
|
...themed,
|
|
@@ -2923,6 +2936,7 @@ function buildNativeInputStyle(themed) {
|
|
|
2923
2936
|
function WebDateInput({ fieldProps, context, webInputType }) {
|
|
2924
2937
|
const { label, value, onChange, onSubmit, accessibilityHint, testID, required, disabled = false, min, max } = fieldProps;
|
|
2925
2938
|
const { style, focusBind, hoverBind } = useThemedInput({ hasError: context.hasError, editable: !disabled });
|
|
2939
|
+
const look = lookInputBox(useSelectLookMetrics());
|
|
2926
2940
|
const webA11y = webFieldA11y({
|
|
2927
2941
|
describedById: context.describedById,
|
|
2928
2942
|
hasError: context.hasError,
|
|
@@ -2946,7 +2960,7 @@ function WebDateInput({ fieldProps, context, webInputType }) {
|
|
|
2946
2960
|
id: context.controlId,
|
|
2947
2961
|
max,
|
|
2948
2962
|
min,
|
|
2949
|
-
style: buildNativeInputStyle(style),
|
|
2963
|
+
style: buildNativeInputStyle(style, look),
|
|
2950
2964
|
title: accessibilityHint,
|
|
2951
2965
|
type: webInputType,
|
|
2952
2966
|
value,
|
|
@@ -3716,6 +3730,7 @@ function DatePickerInput({ fieldProps, context, onTypedError }) {
|
|
|
3716
3730
|
const typed = useTypedDate({ value, onChange, bounds, format: displayFormatter(display), onError: onTypedError, editOnType: true });
|
|
3717
3731
|
const edit = typedEditBind(typed);
|
|
3718
3732
|
const { style, focusBind, hoverBind } = useThemedInput({ hasError: context.hasError, editable: !disabled });
|
|
3733
|
+
const look = lookInputBox(useSelectLookMetrics());
|
|
3719
3734
|
const focus = focusBind;
|
|
3720
3735
|
const webA11y = webFieldA11y({ describedById: context.describedById, hasError: context.hasError, required });
|
|
3721
3736
|
const close = useCallback(() => setOpen(false), []);
|
|
@@ -3748,7 +3763,7 @@ function DatePickerInput({ fieldProps, context, onTypedError }) {
|
|
|
3748
3763
|
"data-testid": testID,
|
|
3749
3764
|
disabled,
|
|
3750
3765
|
id: context.controlId,
|
|
3751
|
-
style: { ...buildNativeInputStyle(style), paddingInlineEnd: ICON_ROOM },
|
|
3766
|
+
style: { ...buildNativeInputStyle(style, look), paddingInlineEnd: ICON_ROOM },
|
|
3752
3767
|
title: accessibilityHint,
|
|
3753
3768
|
type: "text",
|
|
3754
3769
|
value: typed.display,
|
|
@@ -6553,6 +6568,6 @@ var PasswordField = React41.forwardRef(function PasswordField2({ label, value, o
|
|
|
6553
6568
|
] }) });
|
|
6554
6569
|
});
|
|
6555
6570
|
|
|
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 };
|
|
6571
|
+
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, lookInputBox, 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, useSelectLookMetrics, useServerFieldErrors, useThemedInput, validateBic, validateDecision, validateIban };
|
|
6557
6572
|
//# sourceMappingURL=index.mjs.map
|
|
6558
6573
|
//# sourceMappingURL=index.mjs.map
|