@scripso-homepad/ui 0.4.20 → 0.4.22
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-F7NV3HPU.js → chunk-KJYQA5OY.js} +37 -13
- package/dist/chunk-KJYQA5OY.js.map +1 -0
- package/dist/index.cjs +41 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.js +8 -3
- package/dist/index.js.map +1 -1
- package/dist/web/index.cjs +35 -11
- package/dist/web/index.cjs.map +1 -1
- package/dist/web/index.js +1 -1
- package/package.json +1 -1
- package/src/components/Input.tsx +13 -2
- package/src/components/PhoneInput.tsx +1 -0
- package/src/components/Select.stories.tsx +1 -0
- package/src/components/Select.tsx +9 -2
- package/src/theme/input.ts +30 -9
- package/dist/chunk-F7NV3HPU.js.map +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -74,6 +74,11 @@ interface SelectBaseProps {
|
|
|
74
74
|
hintClassName?: string;
|
|
75
75
|
/** Shorter option rows for compact filter-style dropdowns. */
|
|
76
76
|
compact?: boolean;
|
|
77
|
+
/**
|
|
78
|
+
* When true (default), clicking the already-selected option clears the selection
|
|
79
|
+
* in single-select mode. Set to false for required fields that must keep a value.
|
|
80
|
+
*/
|
|
81
|
+
allowDeselect?: boolean;
|
|
77
82
|
}
|
|
78
83
|
interface SingleSelectProps extends SelectBaseProps {
|
|
79
84
|
multiple?: false;
|
|
@@ -86,7 +91,7 @@ interface MultipleSelectProps extends SelectBaseProps {
|
|
|
86
91
|
onValueChange?: (value: string[]) => void;
|
|
87
92
|
}
|
|
88
93
|
type SelectProps = SingleSelectProps | MultipleSelectProps;
|
|
89
|
-
declare function Select({ label, placeholder, value, onValueChange, options, leftIcon, multiple, disabled, error, invalid, hint, containerStyle, fieldStyle, className, fieldClassName, menuClassName, labelClassName, errorClassName, hintClassName, compact, }: SelectProps): react.JSX.Element;
|
|
94
|
+
declare function Select({ label, placeholder, value, onValueChange, options, leftIcon, multiple, disabled, error, invalid, hint, containerStyle, fieldStyle, className, fieldClassName, menuClassName, labelClassName, errorClassName, hintClassName, compact, allowDeselect, }: SelectProps): react.JSX.Element;
|
|
90
95
|
|
|
91
96
|
interface PhoneInputProps extends Omit<TextInputProps, "style"> {
|
|
92
97
|
label?: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -74,6 +74,11 @@ interface SelectBaseProps {
|
|
|
74
74
|
hintClassName?: string;
|
|
75
75
|
/** Shorter option rows for compact filter-style dropdowns. */
|
|
76
76
|
compact?: boolean;
|
|
77
|
+
/**
|
|
78
|
+
* When true (default), clicking the already-selected option clears the selection
|
|
79
|
+
* in single-select mode. Set to false for required fields that must keep a value.
|
|
80
|
+
*/
|
|
81
|
+
allowDeselect?: boolean;
|
|
77
82
|
}
|
|
78
83
|
interface SingleSelectProps extends SelectBaseProps {
|
|
79
84
|
multiple?: false;
|
|
@@ -86,7 +91,7 @@ interface MultipleSelectProps extends SelectBaseProps {
|
|
|
86
91
|
onValueChange?: (value: string[]) => void;
|
|
87
92
|
}
|
|
88
93
|
type SelectProps = SingleSelectProps | MultipleSelectProps;
|
|
89
|
-
declare function Select({ label, placeholder, value, onValueChange, options, leftIcon, multiple, disabled, error, invalid, hint, containerStyle, fieldStyle, className, fieldClassName, menuClassName, labelClassName, errorClassName, hintClassName, compact, }: SelectProps): react.JSX.Element;
|
|
94
|
+
declare function Select({ label, placeholder, value, onValueChange, options, leftIcon, multiple, disabled, error, invalid, hint, containerStyle, fieldStyle, className, fieldClassName, menuClassName, labelClassName, errorClassName, hintClassName, compact, allowDeselect, }: SelectProps): react.JSX.Element;
|
|
90
95
|
|
|
91
96
|
interface PhoneInputProps extends Omit<TextInputProps, "style"> {
|
|
92
97
|
label?: string;
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { spacing, colors, fontWeight, fontSize, fonts, radii, INPUT_ICON_GAP, useApplyWebClassName, resolveInputVisualState, Label, getInputFieldStyles, inputFieldMetrics } from './chunk-
|
|
2
|
-
export { Button, Input, Label, brand, buttonTypography, colors, emeraldGreen, fontSize, fontWeight, fonts, labelTypography, navy, radii, rubyRed, shadows, spacing, stormGray, typographyScale } from './chunk-
|
|
1
|
+
import { spacing, colors, fontWeight, fontSize, fonts, radii, INPUT_ICON_GAP, useApplyWebClassName, resolveInputVisualState, Label, getInputFieldStyles, inputFieldMetrics } from './chunk-KJYQA5OY.js';
|
|
2
|
+
export { Button, Input, Label, brand, buttonTypography, colors, emeraldGreen, fontSize, fontWeight, fonts, labelTypography, navy, radii, rubyRed, shadows, spacing, stormGray, typographyScale } from './chunk-KJYQA5OY.js';
|
|
3
3
|
import { createContext, useRef, useState, useMemo, useEffect, useLayoutEffect, useContext, isValidElement, cloneElement } from 'react';
|
|
4
4
|
import { Platform, StyleSheet, Animated, Easing, View, Pressable, Text, Modal, ScrollView, TextInput, Dimensions } from 'react-native';
|
|
5
5
|
import Svg2, { Path } from 'react-native-svg';
|
|
@@ -483,7 +483,8 @@ function Select({
|
|
|
483
483
|
labelClassName,
|
|
484
484
|
errorClassName,
|
|
485
485
|
hintClassName,
|
|
486
|
-
compact = false
|
|
486
|
+
compact = false,
|
|
487
|
+
allowDeselect = true
|
|
487
488
|
}) {
|
|
488
489
|
const wrapperRef = useRef(null);
|
|
489
490
|
const triggerRef = useRef(null);
|
|
@@ -587,6 +588,9 @@ function Select({
|
|
|
587
588
|
return;
|
|
588
589
|
}
|
|
589
590
|
if (selectedValues.includes(nextValue)) {
|
|
591
|
+
if (allowDeselect) {
|
|
592
|
+
onValueChange?.("");
|
|
593
|
+
}
|
|
590
594
|
closeMenu();
|
|
591
595
|
return;
|
|
592
596
|
}
|
|
@@ -1171,6 +1175,7 @@ function PhoneInput({
|
|
|
1171
1175
|
View,
|
|
1172
1176
|
{
|
|
1173
1177
|
style: [
|
|
1178
|
+
inputFieldMetrics.containerBase,
|
|
1174
1179
|
inputFieldMetrics.container,
|
|
1175
1180
|
phoneFieldStyles.container,
|
|
1176
1181
|
styles3.phoneField
|