@ecohouse/ui 0.1.14 → 0.1.16

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": "@ecohouse/ui",
3
- "version": "0.1.14",
3
+ "version": "0.1.16",
4
4
  "type": "module",
5
5
  "private": false,
6
6
  "description": "Cross-platform presentation-only UI components for EcoHouse (React Native + React Native Web)",
@@ -36,6 +36,7 @@ export interface SegmentedToggleProps extends Omit<ViewProps, "style" | "childre
36
36
 
37
37
  const ICON_SIZE = 20;
38
38
  const ANIMATION_DURATION = 200;
39
+ const OPTION_HORIZONTAL_PADDING = 16;
39
40
 
40
41
  export const SegmentedToggle = forwardRef<ComponentRef<typeof View>, SegmentedToggleProps>(
41
42
  function SegmentedToggle(
@@ -69,7 +70,8 @@ export const SegmentedToggle = forwardRef<ComponentRef<typeof View>, SegmentedTo
69
70
  const [containerWidth, setContainerWidth] = useState(0);
70
71
  const availableOptionWidth = Math.max(0, (containerWidth - 12) / 2);
71
72
  const widestContentWidth = Math.max(...contentWidths);
72
- const contentBasedOptionWidth = widestContentWidth > 0 ? widestContentWidth + 24 * 2 : 0;
73
+ const contentBasedOptionWidth =
74
+ widestContentWidth > 0 ? widestContentWidth + OPTION_HORIZONTAL_PADDING * 2 : 0;
73
75
  const optionWidth = fullWidth ? availableOptionWidth : contentBasedOptionWidth;
74
76
  const indicatorTranslateX = progress.interpolate({
75
77
  inputRange: [0, 1],
@@ -193,7 +195,7 @@ const styles = StyleSheet.create({
193
195
  flexDirection: "row",
194
196
  alignItems: "center",
195
197
  justifyContent: "center",
196
- paddingHorizontal: 24,
198
+ paddingHorizontal: OPTION_HORIZONTAL_PADDING,
197
199
  borderRadius: 60,
198
200
  },
199
201
  optionContent: {
@@ -3,6 +3,7 @@ import { colors } from "./colors";
3
3
  import {
4
4
  buttonTypography,
5
5
  inputTypography,
6
+ segmentedToggleTypography,
6
7
  selectTypography,
7
8
  textareaTypography,
8
9
  } from "./typography";
@@ -20,6 +21,8 @@ describe("design tokens", () => {
20
21
  expect(colors.whiteAlpha5).toBe("#FFFFFF0D");
21
22
  expect(buttonTypography.lg.fontSize).toBe(14);
22
23
  expect(buttonTypography.lg.fontWeight).toBe("600");
24
+ expect(segmentedToggleTypography.fontSize).toBe(12);
25
+ expect(segmentedToggleTypography.lineHeight).toBe(12);
23
26
  });
24
27
 
25
28
  it("keeps Input, Select, and Textarea field text aligned", () => {
@@ -38,12 +38,12 @@ export const statCardTypography = {
38
38
  letterSpacing: 0,
39
39
  } as const;
40
40
 
41
- /** Segmented toggle label — Medium 14, line-height 100%, letter-spacing 0. */
41
+ /** Segmented toggle label — Medium 12, line-height 100%, letter-spacing 0. */
42
42
  export const segmentedToggleTypography = {
43
43
  fontFamily: fonts.sans,
44
- fontSize: 14,
44
+ fontSize: 12,
45
45
  fontWeight: "500" as const,
46
- lineHeight: 14,
46
+ lineHeight: 12,
47
47
  letterSpacing: 0,
48
48
  } as const;
49
49