@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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scripso-homepad/ui",
3
- "version": "0.4.29",
3
+ "version": "0.4.31",
4
4
  "type": "module",
5
5
  "description": "Cross-platform UI components for Homepad (React Web + React Native)",
6
6
  "license": "MIT",
@@ -77,27 +77,20 @@ export type CalendarRangeProps = CalendarBaseProps & {
77
77
  export type CalendarProps = CalendarSingleProps | CalendarRangeProps;
78
78
 
79
79
  function resolveDayCellStyle(day: CalendarDayCell): StyleProp<ViewStyle> {
80
- if (day.isDisabled) {
81
- return [calendarDropdownMetrics.dayCell];
82
- }
83
-
84
80
  if (day.isSelected) {
85
81
  return [calendarDropdownMetrics.dayCell, calendarDropdownMetrics.dayCellSelected];
86
82
  }
87
83
 
84
+ const useMutedBackground =
85
+ day.inCurrentMonth && !day.isToday && (day.isPast || day.isDisabled);
86
+
88
87
  return [
89
88
  calendarDropdownMetrics.dayCell,
90
- day.inCurrentMonth && day.isPast && !day.isToday
91
- ? calendarDropdownMetrics.dayCellPast
92
- : null,
89
+ useMutedBackground ? calendarDropdownMetrics.dayCellPast : null,
93
90
  ];
94
91
  }
95
92
 
96
93
  function resolveDayLabelStyle(day: CalendarDayCell): StyleProp<TextStyle> {
97
- if (day.isDisabled) {
98
- return [calendarDropdownMetrics.dayLabel, calendarDropdownMetrics.dayLabelDisabled];
99
- }
100
-
101
94
  if (day.isSelected) {
102
95
  return [calendarDropdownMetrics.dayLabel, calendarDropdownMetrics.dayLabelSelected];
103
96
  }
@@ -110,7 +103,7 @@ function resolveDayLabelStyle(day: CalendarDayCell): StyleProp<TextStyle> {
110
103
  return [calendarDropdownMetrics.dayLabel, calendarDropdownMetrics.dayLabelToday];
111
104
  }
112
105
 
113
- if (day.isPast) {
106
+ if (day.isPast || day.isDisabled) {
114
107
  return [calendarDropdownMetrics.dayLabel, calendarDropdownMetrics.dayLabelMuted];
115
108
  }
116
109
 
@@ -364,7 +357,9 @@ export function Calendar(props: CalendarProps) {
364
357
  >
365
358
  <Text style={resolveDayLabelStyle(day)}>{day.date.getDate()}</Text>
366
359
  {day.isToday && day.inCurrentMonth && !day.isSelected ? (
367
- <View style={calendarDropdownMetrics.todayDot} />
360
+ <View style={calendarDropdownMetrics.todayDotWrap}>
361
+ <View style={calendarDropdownMetrics.todayDot} />
362
+ </View>
368
363
  ) : null}
369
364
  </Pressable>
370
365
  ))}
@@ -42,6 +42,10 @@ export interface CountryCodeSelectorProps {
42
42
  /** Country list (defaults to built-in list). */
43
43
  options?: Country[];
44
44
  disabled?: boolean;
45
+ /** Outer trigger height. Defaults to shared input height. */
46
+ height?: number;
47
+ /** Trigger border color. Defaults to shared input border token. */
48
+ borderColor?: string;
45
49
  style?: StyleProp<ViewStyle>;
46
50
  className?: string;
47
51
  }
@@ -70,6 +74,8 @@ export function CountryCodeSelector({
70
74
  onValueChange,
71
75
  options = countries,
72
76
  disabled = false,
77
+ height = TRIGGER_HEIGHT,
78
+ borderColor = colors.stormGray50,
73
79
  style,
74
80
  className,
75
81
  }: CountryCodeSelectorProps) {
@@ -157,6 +163,7 @@ export function CountryCodeSelector({
157
163
  onPress={handleOpen}
158
164
  style={[
159
165
  styles.trigger,
166
+ { height, borderColor },
160
167
  disabled ? styles.triggerDisabled : styles.triggerEnabled,
161
168
  Platform.OS === "web" ? styles.triggerWeb : null,
162
169
  ]}
@@ -207,15 +214,14 @@ const styles = StyleSheet.create({
207
214
  height: TRIGGER_HEIGHT,
208
215
  borderRadius: radii.lg,
209
216
  borderWidth: 1,
210
- padding: spacing.lg,
217
+ paddingHorizontal: spacing.lg,
218
+ paddingVertical: 0,
211
219
  gap: spacing.sm,
212
220
  },
213
221
  triggerEnabled: {
214
- borderColor: colors.stormGray50,
215
222
  backgroundColor: colors.white,
216
223
  },
217
224
  triggerDisabled: {
218
- borderColor: colors.stormGray50,
219
225
  backgroundColor: colors.stormGray50,
220
226
  },
221
227
  triggerWeb: {
@@ -16,6 +16,7 @@ import { Label } from "./Label";
16
16
  import {
17
17
  getInputFieldStyles,
18
18
  inputFieldMetrics,
19
+ INPUT_HEIGHT,
19
20
  INPUT_ICON_GAP,
20
21
  INPUT_OUTLINE_WIDTH,
21
22
  resolveInputVisualState,
@@ -38,6 +39,8 @@ export interface PhoneInputProps extends Omit<TextInputProps, "style"> {
38
39
  onCountryCodeChange?: (countryCode: string) => void;
39
40
  error?: string;
40
41
  hint?: string;
42
+ /** Outer field height for country trigger + national number. Defaults to shared input height. */
43
+ height?: number;
41
44
  containerStyle?: StyleProp<ViewStyle>;
42
45
  style?: StyleProp<TextStyle>;
43
46
  className?: string;
@@ -60,6 +63,7 @@ export function PhoneInput({
60
63
  onCountryCodeChange,
61
64
  error,
62
65
  hint,
66
+ height = INPUT_HEIGHT,
63
67
  containerStyle,
64
68
  style,
65
69
  className,
@@ -124,6 +128,7 @@ export function PhoneInput({
124
128
  value={countryCode}
125
129
  onValueChange={onCountryCodeChange}
126
130
  disabled={isDisabled}
131
+ height={height}
127
132
  style={styles.countrySelector}
128
133
  />
129
134
  </View>
@@ -132,6 +137,7 @@ export function PhoneInput({
132
137
  style={[
133
138
  inputFieldMetrics.containerBase,
134
139
  inputFieldMetrics.container,
140
+ { height },
135
141
  phoneFieldStyles.container,
136
142
  styles.phoneField,
137
143
  ]}
@@ -35,7 +35,7 @@ export const CALENDAR_NAV_ICON_COLOR = colors.stormGray850;
35
35
  export const CALENDAR_FIELD_ICON_SIZE = 20;
36
36
  export const CALENDAR_FIELD_WIDTH = CALENDAR_PANEL_WIDTH;
37
37
  export const CALENDAR_FIELD_HEIGHT = 52;
38
- export const CALENDAR_FIELD_PADDING = spacing.lg;
38
+ export const CALENDAR_FIELD_PADDING = 14;
39
39
  export const CALENDAR_FIELD_GAP = spacing.sm;
40
40
  export const CALENDAR_FIELD_PLACEHOLDER_COLOR = colors.stormGray200;
41
41
 
@@ -217,18 +217,19 @@ export const calendarDropdownMetrics = StyleSheet.create({
217
217
  },
218
218
  dayLabelDisabled: {
219
219
  color: colors.stormGray300,
220
- opacity: 0.5,
221
220
  },
222
- todayDot: {
221
+ todayDotWrap: {
223
222
  position: "absolute",
224
- bottom: 5,
225
- left: "50%",
223
+ bottom: 4,
224
+ left: 0,
225
+ right: 0,
226
+ alignItems: "center",
227
+ },
228
+ todayDot: {
226
229
  width: CALENDAR_DAY_DOT_SIZE,
227
230
  height: CALENDAR_DAY_DOT_SIZE,
228
- borderRadius: 15,
231
+ borderRadius: CALENDAR_DAY_DOT_SIZE / 2,
229
232
  backgroundColor: CALENDAR_TODAY_DOT_COLOR,
230
- marginLeft: -(CALENDAR_DAY_DOT_SIZE / 2),
231
- zIndex: 1,
232
233
  },
233
234
  pickerBody: {
234
235
  width: CALENDAR_DAY_GRID_WIDTH,
@@ -347,7 +348,8 @@ export const calendarFieldMetrics = StyleSheet.create({
347
348
  paddingVertical: 0,
348
349
  paddingHorizontal: 0,
349
350
  margin: 0,
350
- ...(Platform.OS === "android" ? { includeFontPadding: false } : null),
351
+ includeFontPadding: false,
352
+ ...(Platform.OS === "android" ? { textAlignVertical: "center" as const } : null),
351
353
  ...(Platform.OS === "web"
352
354
  ? ({
353
355
  outlineStyle: "none",
@@ -38,7 +38,9 @@ export function SidebarNavItem({ item, isOpen, isActive, onNavigate }: SidebarNa
38
38
  'relative flex items-center rounded-xl px-4 py-3 transition-[background-color,color,gap,padding] duration-300 ease-in-out',
39
39
  isOpen ? 'w-full gap-4' : 'w-full justify-center gap-0 px-3',
40
40
  item.disabled && 'pointer-events-none opacity-50',
41
- isActive ? 'bg-black/12 text-white shadow-none' : 'text-navy-100 shadow-none hover:bg-white/5',
41
+ isActive
42
+ ? 'bg-black/12 text-white shadow-none'
43
+ : 'text-navy-100 shadow-none hover:bg-white/5',
42
44
  )}
43
45
  >
44
46
  <span