@dloizides/ui-forms 1.18.4 → 1.18.7
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/CHANGELOG.md +10 -0
- package/dist/index.js +8 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +10 -9
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -5
package/dist/index.mjs
CHANGED
|
@@ -2,10 +2,10 @@ import React2, { useState, useCallback, useMemo, useEffect, useRef, useLayoutEff
|
|
|
2
2
|
import { Platform, StyleSheet, TextInput, View, Text, ScrollView, Pressable, Switch, TouchableOpacity } from 'react-native';
|
|
3
3
|
import { useUi } from '@dloizides/ui-feedback';
|
|
4
4
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
5
|
-
import { Button } from '@dloizides/ui-buttons';
|
|
5
|
+
import { themeFocusRingColor, Button } from '@dloizides/ui-buttons';
|
|
6
6
|
import { createPortal } from 'react-dom';
|
|
7
7
|
import { MIN_TOUCH_TARGET_PX } from '@dloizides/a11y';
|
|
8
|
-
import { Z_INDEX } from '@dloizides/design-tokens';
|
|
8
|
+
import { Z_INDEX, focusRingOutline } from '@dloizides/design-tokens';
|
|
9
9
|
|
|
10
10
|
// src/Field/Field.tsx
|
|
11
11
|
function attachControlId(child, candidateId, describedById) {
|
|
@@ -604,8 +604,7 @@ var IS_WEB5 = Platform.OS === "web";
|
|
|
604
604
|
var TRANSITION_PROPERTY = "border-color, background-color, box-shadow";
|
|
605
605
|
var TRANSITION_DURATION = "0.14s";
|
|
606
606
|
var TRANSITION_TIMING = "ease";
|
|
607
|
-
var
|
|
608
|
-
var FOCUS_RING_ALPHA = 0.16;
|
|
607
|
+
var NO_RING = { outlineWidth: 0 };
|
|
609
608
|
var HOVER_BORDER_ALPHA = 0.22;
|
|
610
609
|
var PLACEHOLDER_ALPHA = 0.6;
|
|
611
610
|
var HEX_RADIX = 16;
|
|
@@ -660,15 +659,14 @@ function useThemedInput(options = {}) {
|
|
|
660
659
|
const backgroundColor = isFocused ? colors.surface : colors.surfaceElevated;
|
|
661
660
|
const base = { color: colors.text, borderColor, backgroundColor };
|
|
662
661
|
if (!IS_WEB5) return base;
|
|
663
|
-
const ringColor = hasError ? errorColor :
|
|
664
|
-
const ring = isFocused ?
|
|
662
|
+
const ringColor = hasError ? errorColor : themeFocusRingColor(theme);
|
|
663
|
+
const ring = isFocused ? focusRingOutline(ringColor) : NO_RING;
|
|
665
664
|
const webStyle = {
|
|
666
665
|
transitionProperty: TRANSITION_PROPERTY,
|
|
667
666
|
// Collapse the eased transition to instant when the user prefers reduced motion.
|
|
668
667
|
transitionDuration: prefersReducedMotion() ? "0s" : TRANSITION_DURATION,
|
|
669
668
|
transitionTimingFunction: TRANSITION_TIMING,
|
|
670
|
-
|
|
671
|
-
outlineStyle: "none"
|
|
669
|
+
...ring
|
|
672
670
|
};
|
|
673
671
|
return { ...base, ...webStyle };
|
|
674
672
|
}, [
|
|
@@ -680,7 +678,8 @@ function useThemedInput(options = {}) {
|
|
|
680
678
|
colors.surface,
|
|
681
679
|
colors.surfaceElevated,
|
|
682
680
|
primary,
|
|
683
|
-
errorColor
|
|
681
|
+
errorColor,
|
|
682
|
+
theme
|
|
684
683
|
]);
|
|
685
684
|
const focusBind = useMemo(() => ({ onFocus: handleFocus, onBlur: handleBlur }), [handleFocus, handleBlur]);
|
|
686
685
|
const hoverBind = useMemo(
|
|
@@ -973,6 +972,7 @@ var chipStyles = StyleSheet.create({
|
|
|
973
972
|
paddingHorizontal: 12,
|
|
974
973
|
paddingVertical: 6,
|
|
975
974
|
minHeight: MIN_TARGET_PX,
|
|
975
|
+
minWidth: MIN_TARGET_PX,
|
|
976
976
|
justifyContent: "center",
|
|
977
977
|
borderRadius: SOLID_RADIUS,
|
|
978
978
|
backgroundColor: TRANSPARENT_COLOR,
|
|
@@ -982,6 +982,7 @@ var chipStyles = StyleSheet.create({
|
|
|
982
982
|
paddingHorizontal: OUTLINE_PAD_H,
|
|
983
983
|
paddingVertical: OUTLINE_PAD_V,
|
|
984
984
|
minHeight: MIN_TARGET_PX,
|
|
985
|
+
minWidth: MIN_TARGET_PX,
|
|
985
986
|
justifyContent: "center",
|
|
986
987
|
borderRadius: OUTLINE_RADIUS,
|
|
987
988
|
borderWidth: 1
|