@scripso-homepad/ui 0.4.29 → 0.4.31
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.cjs +27 -25
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +8 -2
- package/dist/index.d.ts +8 -2
- package/dist/index.js +27 -25
- package/dist/index.js.map +1 -1
- package/dist/web/index.cjs.map +1 -1
- package/dist/web/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Calendar.tsx +8 -13
- package/src/components/CountryCodeSelector.tsx +9 -3
- package/src/components/PhoneInput.tsx +6 -0
- package/src/theme/calendar.ts +11 -9
- package/src/web/layout/SidebarNavItem.tsx +3 -1
package/dist/index.d.cts
CHANGED
|
@@ -101,6 +101,8 @@ interface PhoneInputProps extends Omit<TextInputProps, "style"> {
|
|
|
101
101
|
onCountryCodeChange?: (countryCode: string) => void;
|
|
102
102
|
error?: string;
|
|
103
103
|
hint?: string;
|
|
104
|
+
/** Outer field height for country trigger + national number. Defaults to shared input height. */
|
|
105
|
+
height?: number;
|
|
104
106
|
containerStyle?: StyleProp<ViewStyle>;
|
|
105
107
|
style?: StyleProp<TextStyle>;
|
|
106
108
|
className?: string;
|
|
@@ -111,7 +113,7 @@ interface PhoneInputProps extends Omit<TextInputProps, "style"> {
|
|
|
111
113
|
errorClassName?: string;
|
|
112
114
|
hintClassName?: string;
|
|
113
115
|
}
|
|
114
|
-
declare function PhoneInput({ label, countryCode, onCountryCodeChange, error, hint, containerStyle, style, className, labelClassName, labelStyles, inputClassName, errorClassName, hintClassName, editable, onFocus, onBlur, onChangeText, ...props }: PhoneInputProps): react.JSX.Element;
|
|
116
|
+
declare function PhoneInput({ label, countryCode, onCountryCodeChange, error, hint, height, containerStyle, style, className, labelClassName, labelStyles, inputClassName, errorClassName, hintClassName, editable, onFocus, onBlur, onChangeText, ...props }: PhoneInputProps): react.JSX.Element;
|
|
115
117
|
|
|
116
118
|
type Country = {
|
|
117
119
|
code: string;
|
|
@@ -128,10 +130,14 @@ interface CountryCodeSelectorProps {
|
|
|
128
130
|
/** Country list (defaults to built-in list). */
|
|
129
131
|
options?: Country[];
|
|
130
132
|
disabled?: boolean;
|
|
133
|
+
/** Outer trigger height. Defaults to shared input height. */
|
|
134
|
+
height?: number;
|
|
135
|
+
/** Trigger border color. Defaults to shared input border token. */
|
|
136
|
+
borderColor?: string;
|
|
131
137
|
style?: StyleProp<ViewStyle>;
|
|
132
138
|
className?: string;
|
|
133
139
|
}
|
|
134
|
-
declare function CountryCodeSelector({ value, onValueChange, options, disabled, style, className, }: CountryCodeSelectorProps): react.JSX.Element;
|
|
140
|
+
declare function CountryCodeSelector({ value, onValueChange, options, disabled, height, borderColor, style, className, }: CountryCodeSelectorProps): react.JSX.Element;
|
|
135
141
|
|
|
136
142
|
type CountryFlagProps = {
|
|
137
143
|
code: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -101,6 +101,8 @@ interface PhoneInputProps extends Omit<TextInputProps, "style"> {
|
|
|
101
101
|
onCountryCodeChange?: (countryCode: string) => void;
|
|
102
102
|
error?: string;
|
|
103
103
|
hint?: string;
|
|
104
|
+
/** Outer field height for country trigger + national number. Defaults to shared input height. */
|
|
105
|
+
height?: number;
|
|
104
106
|
containerStyle?: StyleProp<ViewStyle>;
|
|
105
107
|
style?: StyleProp<TextStyle>;
|
|
106
108
|
className?: string;
|
|
@@ -111,7 +113,7 @@ interface PhoneInputProps extends Omit<TextInputProps, "style"> {
|
|
|
111
113
|
errorClassName?: string;
|
|
112
114
|
hintClassName?: string;
|
|
113
115
|
}
|
|
114
|
-
declare function PhoneInput({ label, countryCode, onCountryCodeChange, error, hint, containerStyle, style, className, labelClassName, labelStyles, inputClassName, errorClassName, hintClassName, editable, onFocus, onBlur, onChangeText, ...props }: PhoneInputProps): react.JSX.Element;
|
|
116
|
+
declare function PhoneInput({ label, countryCode, onCountryCodeChange, error, hint, height, containerStyle, style, className, labelClassName, labelStyles, inputClassName, errorClassName, hintClassName, editable, onFocus, onBlur, onChangeText, ...props }: PhoneInputProps): react.JSX.Element;
|
|
115
117
|
|
|
116
118
|
type Country = {
|
|
117
119
|
code: string;
|
|
@@ -128,10 +130,14 @@ interface CountryCodeSelectorProps {
|
|
|
128
130
|
/** Country list (defaults to built-in list). */
|
|
129
131
|
options?: Country[];
|
|
130
132
|
disabled?: boolean;
|
|
133
|
+
/** Outer trigger height. Defaults to shared input height. */
|
|
134
|
+
height?: number;
|
|
135
|
+
/** Trigger border color. Defaults to shared input border token. */
|
|
136
|
+
borderColor?: string;
|
|
131
137
|
style?: StyleProp<ViewStyle>;
|
|
132
138
|
className?: string;
|
|
133
139
|
}
|
|
134
|
-
declare function CountryCodeSelector({ value, onValueChange, options, disabled, style, className, }: CountryCodeSelectorProps): react.JSX.Element;
|
|
140
|
+
declare function CountryCodeSelector({ value, onValueChange, options, disabled, height, borderColor, style, className, }: CountryCodeSelectorProps): react.JSX.Element;
|
|
135
141
|
|
|
136
142
|
type CountryFlagProps = {
|
|
137
143
|
code: string;
|
package/dist/index.js
CHANGED
|
@@ -945,6 +945,8 @@ function CountryCodeSelector({
|
|
|
945
945
|
onValueChange,
|
|
946
946
|
options = countries,
|
|
947
947
|
disabled = false,
|
|
948
|
+
height = TRIGGER_HEIGHT,
|
|
949
|
+
borderColor = colors.stormGray50,
|
|
948
950
|
style,
|
|
949
951
|
className
|
|
950
952
|
}) {
|
|
@@ -970,8 +972,8 @@ function CountryCodeSelector({
|
|
|
970
972
|
}
|
|
971
973
|
function handleOpen() {
|
|
972
974
|
if (disabled) return;
|
|
973
|
-
triggerRef.current?.measureInWindow((x, y, width,
|
|
974
|
-
setAnchor({ x, y, width, height });
|
|
975
|
+
triggerRef.current?.measureInWindow((x, y, width, height2) => {
|
|
976
|
+
setAnchor({ x, y, width, height: height2 });
|
|
975
977
|
setOpen(true);
|
|
976
978
|
});
|
|
977
979
|
}
|
|
@@ -1024,6 +1026,7 @@ function CountryCodeSelector({
|
|
|
1024
1026
|
onPress: handleOpen,
|
|
1025
1027
|
style: [
|
|
1026
1028
|
styles3.trigger,
|
|
1029
|
+
{ height, borderColor },
|
|
1027
1030
|
disabled ? styles3.triggerDisabled : styles3.triggerEnabled,
|
|
1028
1031
|
Platform.OS === "web" ? styles3.triggerWeb : null
|
|
1029
1032
|
],
|
|
@@ -1073,15 +1076,14 @@ var styles3 = StyleSheet.create({
|
|
|
1073
1076
|
height: TRIGGER_HEIGHT,
|
|
1074
1077
|
borderRadius: radii.lg,
|
|
1075
1078
|
borderWidth: 1,
|
|
1076
|
-
|
|
1079
|
+
paddingHorizontal: spacing.lg,
|
|
1080
|
+
paddingVertical: 0,
|
|
1077
1081
|
gap: spacing.sm
|
|
1078
1082
|
},
|
|
1079
1083
|
triggerEnabled: {
|
|
1080
|
-
borderColor: colors.stormGray50,
|
|
1081
1084
|
backgroundColor: colors.white
|
|
1082
1085
|
},
|
|
1083
1086
|
triggerDisabled: {
|
|
1084
|
-
borderColor: colors.stormGray50,
|
|
1085
1087
|
backgroundColor: colors.stormGray50
|
|
1086
1088
|
},
|
|
1087
1089
|
triggerWeb: {
|
|
@@ -1152,6 +1154,7 @@ function PhoneInput({
|
|
|
1152
1154
|
onCountryCodeChange,
|
|
1153
1155
|
error,
|
|
1154
1156
|
hint,
|
|
1157
|
+
height = INPUT_HEIGHT,
|
|
1155
1158
|
containerStyle,
|
|
1156
1159
|
style,
|
|
1157
1160
|
className,
|
|
@@ -1209,6 +1212,7 @@ function PhoneInput({
|
|
|
1209
1212
|
value: countryCode,
|
|
1210
1213
|
onValueChange: onCountryCodeChange,
|
|
1211
1214
|
disabled: isDisabled,
|
|
1215
|
+
height,
|
|
1212
1216
|
style: styles4.countrySelector
|
|
1213
1217
|
}
|
|
1214
1218
|
) }),
|
|
@@ -1218,6 +1222,7 @@ function PhoneInput({
|
|
|
1218
1222
|
style: [
|
|
1219
1223
|
inputFieldMetrics.containerBase,
|
|
1220
1224
|
inputFieldMetrics.container,
|
|
1225
|
+
{ height },
|
|
1221
1226
|
phoneFieldStyles.container,
|
|
1222
1227
|
styles4.phoneField
|
|
1223
1228
|
],
|
|
@@ -1343,7 +1348,7 @@ var CALENDAR_NAV_ICON_COLOR = colors.stormGray850;
|
|
|
1343
1348
|
var CALENDAR_FIELD_ICON_SIZE = 20;
|
|
1344
1349
|
var CALENDAR_FIELD_WIDTH = CALENDAR_PANEL_WIDTH;
|
|
1345
1350
|
var CALENDAR_FIELD_HEIGHT = 52;
|
|
1346
|
-
var CALENDAR_FIELD_PADDING =
|
|
1351
|
+
var CALENDAR_FIELD_PADDING = 14;
|
|
1347
1352
|
var CALENDAR_FIELD_GAP = spacing.sm;
|
|
1348
1353
|
var CALENDAR_FIELD_PLACEHOLDER_COLOR = colors.stormGray200;
|
|
1349
1354
|
var CALENDAR_PANEL_TOTAL_HEIGHT = CALENDAR_PANEL_PADDING * 2 + CALENDAR_HEADER_HEIGHT + CALENDAR_PANEL_GAP * 2 + CALENDAR_WEEKDAY_CELL_SIZE + CALENDAR_DAY_GRID_HEIGHT;
|
|
@@ -1505,19 +1510,20 @@ var calendarDropdownMetrics = StyleSheet.create({
|
|
|
1505
1510
|
color: colors.stormGray300
|
|
1506
1511
|
},
|
|
1507
1512
|
dayLabelDisabled: {
|
|
1508
|
-
color: colors.stormGray300
|
|
1509
|
-
opacity: 0.5
|
|
1513
|
+
color: colors.stormGray300
|
|
1510
1514
|
},
|
|
1511
|
-
|
|
1515
|
+
todayDotWrap: {
|
|
1512
1516
|
position: "absolute",
|
|
1513
|
-
bottom:
|
|
1514
|
-
left:
|
|
1517
|
+
bottom: 4,
|
|
1518
|
+
left: 0,
|
|
1519
|
+
right: 0,
|
|
1520
|
+
alignItems: "center"
|
|
1521
|
+
},
|
|
1522
|
+
todayDot: {
|
|
1515
1523
|
width: CALENDAR_DAY_DOT_SIZE,
|
|
1516
1524
|
height: CALENDAR_DAY_DOT_SIZE,
|
|
1517
|
-
borderRadius:
|
|
1518
|
-
backgroundColor: CALENDAR_TODAY_DOT_COLOR
|
|
1519
|
-
marginLeft: -1.5,
|
|
1520
|
-
zIndex: 1
|
|
1525
|
+
borderRadius: CALENDAR_DAY_DOT_SIZE / 2,
|
|
1526
|
+
backgroundColor: CALENDAR_TODAY_DOT_COLOR
|
|
1521
1527
|
},
|
|
1522
1528
|
pickerBody: {
|
|
1523
1529
|
width: CALENDAR_DAY_GRID_WIDTH,
|
|
@@ -1618,7 +1624,8 @@ var calendarFieldMetrics = StyleSheet.create({
|
|
|
1618
1624
|
paddingVertical: 0,
|
|
1619
1625
|
paddingHorizontal: 0,
|
|
1620
1626
|
margin: 0,
|
|
1621
|
-
|
|
1627
|
+
includeFontPadding: false,
|
|
1628
|
+
...Platform.OS === "android" ? { textAlignVertical: "center" } : null,
|
|
1622
1629
|
...Platform.OS === "web" ? {
|
|
1623
1630
|
outlineStyle: "none"
|
|
1624
1631
|
} : null
|
|
@@ -2005,21 +2012,16 @@ function useCalendarLocale(locale) {
|
|
|
2005
2012
|
);
|
|
2006
2013
|
}
|
|
2007
2014
|
function resolveDayCellStyle(day) {
|
|
2008
|
-
if (day.isDisabled) {
|
|
2009
|
-
return [calendarDropdownMetrics.dayCell];
|
|
2010
|
-
}
|
|
2011
2015
|
if (day.isSelected) {
|
|
2012
2016
|
return [calendarDropdownMetrics.dayCell, calendarDropdownMetrics.dayCellSelected];
|
|
2013
2017
|
}
|
|
2018
|
+
const useMutedBackground = day.inCurrentMonth && !day.isToday && (day.isPast || day.isDisabled);
|
|
2014
2019
|
return [
|
|
2015
2020
|
calendarDropdownMetrics.dayCell,
|
|
2016
|
-
|
|
2021
|
+
useMutedBackground ? calendarDropdownMetrics.dayCellPast : null
|
|
2017
2022
|
];
|
|
2018
2023
|
}
|
|
2019
2024
|
function resolveDayLabelStyle(day) {
|
|
2020
|
-
if (day.isDisabled) {
|
|
2021
|
-
return [calendarDropdownMetrics.dayLabel, calendarDropdownMetrics.dayLabelDisabled];
|
|
2022
|
-
}
|
|
2023
2025
|
if (day.isSelected) {
|
|
2024
2026
|
return [calendarDropdownMetrics.dayLabel, calendarDropdownMetrics.dayLabelSelected];
|
|
2025
2027
|
}
|
|
@@ -2029,7 +2031,7 @@ function resolveDayLabelStyle(day) {
|
|
|
2029
2031
|
if (day.isToday) {
|
|
2030
2032
|
return [calendarDropdownMetrics.dayLabel, calendarDropdownMetrics.dayLabelToday];
|
|
2031
2033
|
}
|
|
2032
|
-
if (day.isPast) {
|
|
2034
|
+
if (day.isPast || day.isDisabled) {
|
|
2033
2035
|
return [calendarDropdownMetrics.dayLabel, calendarDropdownMetrics.dayLabelMuted];
|
|
2034
2036
|
}
|
|
2035
2037
|
return [calendarDropdownMetrics.dayLabel, calendarDropdownMetrics.dayLabelFuture];
|
|
@@ -2220,7 +2222,7 @@ function Calendar(props) {
|
|
|
2220
2222
|
style: resolveDayCellStyle(day),
|
|
2221
2223
|
children: [
|
|
2222
2224
|
/* @__PURE__ */ jsx(Text, { style: resolveDayLabelStyle(day), children: day.date.getDate() }),
|
|
2223
|
-
day.isToday && day.inCurrentMonth && !day.isSelected ? /* @__PURE__ */ jsx(View, { style: calendarDropdownMetrics.todayDot }) : null
|
|
2225
|
+
day.isToday && day.inCurrentMonth && !day.isSelected ? /* @__PURE__ */ jsx(View, { style: calendarDropdownMetrics.todayDotWrap, children: /* @__PURE__ */ jsx(View, { style: calendarDropdownMetrics.todayDot }) }) : null
|
|
2224
2226
|
]
|
|
2225
2227
|
},
|
|
2226
2228
|
day.date.toISOString()
|