@scripso-homepad/ui 0.4.18 → 0.4.20
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/{chunk-U7OSCJKA.js → chunk-F7NV3HPU.js} +60 -20
- package/dist/chunk-F7NV3HPU.js.map +1 -0
- package/dist/index.cjs +126 -63
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +70 -47
- package/dist/index.js.map +1 -1
- package/dist/web/index.cjs +59 -19
- package/dist/web/index.cjs.map +1 -1
- package/dist/web/index.css +1 -6
- package/dist/web/index.css.map +1 -1
- package/dist/web/index.js +2 -2
- package/dist/web/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Button.tsx +1 -1
- package/src/components/Input.tsx +43 -2
- package/src/components/PhoneInput.tsx +11 -0
- package/src/components/Select.tsx +28 -16
- package/src/theme/input.ts +23 -13
- package/src/web/components/TableActionsMenu.tsx +1 -1
- package/src/web/components/drawer-scroll.css +1 -7
- package/dist/chunk-U7OSCJKA.js.map +0 -1
package/dist/web/index.cjs
CHANGED
|
@@ -28650,12 +28650,14 @@ var buttonTypography = {
|
|
|
28650
28650
|
};
|
|
28651
28651
|
|
|
28652
28652
|
// src/theme/input.ts
|
|
28653
|
-
var INPUT_HEIGHT =
|
|
28653
|
+
var INPUT_HEIGHT = 56;
|
|
28654
28654
|
var INPUT_ICON_SIZE = 20;
|
|
28655
28655
|
var INPUT_ICON_GAP = 10;
|
|
28656
28656
|
var INPUT_OUTLINE_WIDTH = 2;
|
|
28657
|
-
var INPUT_TEXT_LINE_HEIGHT =
|
|
28657
|
+
var INPUT_TEXT_LINE_HEIGHT = 20;
|
|
28658
28658
|
var INPUT_WEB_VERTICAL_PADDING = 14;
|
|
28659
|
+
var INPUT_VERTICAL_PADDING = 14;
|
|
28660
|
+
var INPUT_HORIZONTAL_PADDING = 16;
|
|
28659
28661
|
function resolveInputVisualState({
|
|
28660
28662
|
focused = false,
|
|
28661
28663
|
error = false,
|
|
@@ -28674,8 +28676,7 @@ function createOutlineStyle(ringColor) {
|
|
|
28674
28676
|
padding: 0,
|
|
28675
28677
|
backgroundColor: colors.transparent,
|
|
28676
28678
|
width: "100%",
|
|
28677
|
-
alignSelf: "stretch"
|
|
28678
|
-
...reactNative.Platform.OS !== "web" ? { overflow: "hidden" } : null
|
|
28679
|
+
alignSelf: "stretch"
|
|
28679
28680
|
};
|
|
28680
28681
|
}
|
|
28681
28682
|
var defaultOutline = {
|
|
@@ -28685,13 +28686,11 @@ var defaultOutline = {
|
|
|
28685
28686
|
padding: 0,
|
|
28686
28687
|
backgroundColor: colors.transparent,
|
|
28687
28688
|
width: "100%",
|
|
28688
|
-
alignSelf: "stretch"
|
|
28689
|
-
...reactNative.Platform.OS !== "web" ? { overflow: "hidden" } : null
|
|
28689
|
+
alignSelf: "stretch"
|
|
28690
28690
|
};
|
|
28691
28691
|
function getInputFieldStyles(state) {
|
|
28692
28692
|
const containerBase = {
|
|
28693
|
-
borderRadius: radii.lg
|
|
28694
|
-
...reactNative.Platform.OS !== "web" ? { overflow: "hidden" } : null
|
|
28693
|
+
borderRadius: radii.lg
|
|
28695
28694
|
};
|
|
28696
28695
|
switch (state) {
|
|
28697
28696
|
case "disabled":
|
|
@@ -28754,12 +28753,15 @@ var inputFieldMetrics = reactNative.StyleSheet.create({
|
|
|
28754
28753
|
alignItems: "center",
|
|
28755
28754
|
height: INPUT_HEIGHT,
|
|
28756
28755
|
borderRadius: radii.lg,
|
|
28757
|
-
|
|
28756
|
+
paddingHorizontal: INPUT_HORIZONTAL_PADDING,
|
|
28757
|
+
paddingVertical: INPUT_VERTICAL_PADDING,
|
|
28758
28758
|
gap: INPUT_ICON_GAP,
|
|
28759
|
+
// Do not clip glyph ascenders (Armenian / tall fonts).
|
|
28760
|
+
overflow: "visible",
|
|
28759
28761
|
...reactNative.Platform.OS === "web" ? {
|
|
28760
28762
|
boxSizing: "border-box",
|
|
28761
28763
|
paddingVertical: INPUT_WEB_VERTICAL_PADDING,
|
|
28762
|
-
paddingHorizontal:
|
|
28764
|
+
paddingHorizontal: INPUT_HORIZONTAL_PADDING
|
|
28763
28765
|
} : null
|
|
28764
28766
|
},
|
|
28765
28767
|
input: {
|
|
@@ -28774,8 +28776,7 @@ var inputFieldMetrics = reactNative.StyleSheet.create({
|
|
|
28774
28776
|
margin: 0,
|
|
28775
28777
|
borderWidth: 0,
|
|
28776
28778
|
backgroundColor: colors.transparent,
|
|
28777
|
-
|
|
28778
|
-
...reactNative.Platform.OS === "ios" ? { lineHeight: INPUT_TEXT_LINE_HEIGHT, paddingVertical: 2 } : null,
|
|
28779
|
+
// Leave lineHeight unset so platform font metrics keep placeholder tops visible.
|
|
28779
28780
|
...reactNative.Platform.OS === "web" ? {
|
|
28780
28781
|
alignSelf: "center",
|
|
28781
28782
|
outlineStyle: "none",
|
|
@@ -28787,6 +28788,18 @@ var inputFieldMetrics = reactNative.StyleSheet.create({
|
|
|
28787
28788
|
/** Single-line: avoid Android lineHeight jump between placeholder and typed text. */
|
|
28788
28789
|
inputSingleLine: {
|
|
28789
28790
|
...reactNative.Platform.OS === "android" ? { textAlignVertical: "center" } : null
|
|
28791
|
+
},
|
|
28792
|
+
/**
|
|
28793
|
+
* Multiline fields should not flex-fill the container — on iOS a tall TextInput
|
|
28794
|
+
* vertically centers the placeholder.
|
|
28795
|
+
*/
|
|
28796
|
+
inputMultiline: {
|
|
28797
|
+
flexGrow: 0,
|
|
28798
|
+
flexShrink: 1,
|
|
28799
|
+
flexBasis: "auto",
|
|
28800
|
+
width: "100%",
|
|
28801
|
+
alignSelf: "stretch",
|
|
28802
|
+
textAlignVertical: "top"
|
|
28790
28803
|
}
|
|
28791
28804
|
});
|
|
28792
28805
|
function hasClassList(node) {
|
|
@@ -28875,6 +28888,25 @@ function renderInputIcon(icon, color) {
|
|
|
28875
28888
|
}
|
|
28876
28889
|
return icon;
|
|
28877
28890
|
}
|
|
28891
|
+
var INTEGER_KEYBOARD_TYPES = /* @__PURE__ */ new Set([
|
|
28892
|
+
"numeric",
|
|
28893
|
+
"number-pad",
|
|
28894
|
+
"phone-pad"
|
|
28895
|
+
]);
|
|
28896
|
+
function sanitizeNumericInput(value, keyboardType) {
|
|
28897
|
+
if (keyboardType === "decimal-pad") {
|
|
28898
|
+
const normalized = value.replace(/,/g, ".").replace(/[^\d.]/g, "");
|
|
28899
|
+
const separatorIndex = normalized.indexOf(".");
|
|
28900
|
+
if (separatorIndex === -1) {
|
|
28901
|
+
return normalized;
|
|
28902
|
+
}
|
|
28903
|
+
return normalized.slice(0, separatorIndex + 1) + normalized.slice(separatorIndex + 1).replace(/\./g, "");
|
|
28904
|
+
}
|
|
28905
|
+
if (keyboardType && INTEGER_KEYBOARD_TYPES.has(keyboardType)) {
|
|
28906
|
+
return value.replace(/\D/g, "");
|
|
28907
|
+
}
|
|
28908
|
+
return value;
|
|
28909
|
+
}
|
|
28878
28910
|
function Input({
|
|
28879
28911
|
label,
|
|
28880
28912
|
leftIcon,
|
|
@@ -28897,7 +28929,10 @@ function Input({
|
|
|
28897
28929
|
showPasswordToggle,
|
|
28898
28930
|
onFocus,
|
|
28899
28931
|
onBlur,
|
|
28932
|
+
onChangeText,
|
|
28933
|
+
keyboardType,
|
|
28900
28934
|
multiline,
|
|
28935
|
+
textAlign = "left",
|
|
28901
28936
|
textAlignVertical,
|
|
28902
28937
|
...props
|
|
28903
28938
|
}) {
|
|
@@ -28931,6 +28966,9 @@ function Input({
|
|
|
28931
28966
|
setFocused(false);
|
|
28932
28967
|
onBlur?.(event);
|
|
28933
28968
|
}
|
|
28969
|
+
function handleChangeText(value) {
|
|
28970
|
+
onChangeText?.(sanitizeNumericInput(value, keyboardType));
|
|
28971
|
+
}
|
|
28934
28972
|
const helperMessage = error ?? hint;
|
|
28935
28973
|
function togglePasswordVisibility() {
|
|
28936
28974
|
if (!isDisabled) {
|
|
@@ -28975,20 +29013,22 @@ function Input({
|
|
|
28975
29013
|
ref: inputRef,
|
|
28976
29014
|
style: [
|
|
28977
29015
|
inputFieldMetrics.input,
|
|
28978
|
-
|
|
29016
|
+
multiline ? inputFieldMetrics.inputMultiline : inputFieldMetrics.inputSingleLine,
|
|
28979
29017
|
fieldStyles.text,
|
|
28980
29018
|
style
|
|
28981
29019
|
],
|
|
28982
29020
|
placeholderTextColor: fieldStyles.placeholder,
|
|
28983
29021
|
editable,
|
|
29022
|
+
keyboardType,
|
|
28984
29023
|
multiline,
|
|
28985
29024
|
secureTextEntry: effectiveSecureTextEntry,
|
|
28986
|
-
textAlign
|
|
29025
|
+
textAlign,
|
|
28987
29026
|
textAlignVertical: resolvedTextAlignVertical,
|
|
28988
29027
|
onFocus: handleFocus,
|
|
28989
29028
|
onBlur: handleBlur,
|
|
28990
29029
|
accessibilityState: { disabled: isDisabled },
|
|
28991
|
-
...props
|
|
29030
|
+
...props,
|
|
29031
|
+
onChangeText: handleChangeText
|
|
28992
29032
|
}
|
|
28993
29033
|
),
|
|
28994
29034
|
trailingIcon ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: styles2.iconSlot, children: trailingIcon }) : null
|
|
@@ -30583,7 +30623,7 @@ function TableActionsMenu({
|
|
|
30583
30623
|
{
|
|
30584
30624
|
ref: triggerRef,
|
|
30585
30625
|
variant: "menu",
|
|
30586
|
-
icon: /* @__PURE__ */ jsxRuntime.jsx(TableMoreIcon, { className: "size-
|
|
30626
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(TableMoreIcon, { className: "size-5" }),
|
|
30587
30627
|
ariaLabel: triggerAriaLabel,
|
|
30588
30628
|
onClick: () => setOpen((current) => !current),
|
|
30589
30629
|
"aria-expanded": open,
|
|
@@ -30997,7 +31037,8 @@ var styles3 = reactNative.StyleSheet.create({
|
|
|
30997
31037
|
justifyContent: "center"
|
|
30998
31038
|
},
|
|
30999
31039
|
withIcon: {
|
|
31000
|
-
justifyContent: "space-between"
|
|
31040
|
+
justifyContent: "space-between",
|
|
31041
|
+
gap: 24
|
|
31001
31042
|
},
|
|
31002
31043
|
disabled: {
|
|
31003
31044
|
opacity: 0.6
|
|
@@ -31011,8 +31052,7 @@ var styles3 = reactNative.StyleSheet.create({
|
|
|
31011
31052
|
},
|
|
31012
31053
|
labelWithIcon: {
|
|
31013
31054
|
flex: 1,
|
|
31014
|
-
flexShrink: 1
|
|
31015
|
-
marginRight: 8
|
|
31055
|
+
flexShrink: 1
|
|
31016
31056
|
},
|
|
31017
31057
|
iconContainer: {
|
|
31018
31058
|
alignItems: "center",
|