@lotics/ui 2.0.0 → 2.1.0

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/accordion.tsx +15 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lotics/ui",
3
- "version": "2.0.0",
3
+ "version": "2.1.0",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  "./tokens": "./src/tokens.ts",
package/src/accordion.tsx CHANGED
@@ -22,6 +22,12 @@ export interface AccordionProps {
22
22
  style?: StyleProp<ViewStyle>;
23
23
  /** Merged onto the container while open — e.g. an accent border. */
24
24
  expandedStyle?: StyleProp<ViewStyle>;
25
+ /** Merged onto the clickable trigger (after the comfortable-tap-target
26
+ * defaults). Use to bleed the hover highlight full-width while keeping the
27
+ * header label aligned with surrounding content — e.g.
28
+ * `{ marginHorizontal: -12, paddingHorizontal: 12 }` inside a 12px-padded
29
+ * container — or to widen the tap target. */
30
+ triggerStyle?: StyleProp<ViewStyle>;
25
31
  accessibilityLabel?: string;
26
32
  }
27
33
 
@@ -42,6 +48,7 @@ export function Accordion(props: AccordionProps) {
42
48
  onToggle,
43
49
  style,
44
50
  expandedStyle,
51
+ triggerStyle,
45
52
  accessibilityLabel,
46
53
  } = props;
47
54
  const [internal, setInternal] = useState(defaultExpanded);
@@ -61,7 +68,7 @@ export function Accordion(props: AccordionProps) {
61
68
  accessibilityRole="button"
62
69
  accessibilityState={{ expanded }}
63
70
  accessibilityLabel={accessibilityLabel}
64
- style={styles.trigger}
71
+ style={[styles.trigger, triggerStyle]}
65
72
  >
66
73
  <View style={styles.headerContent}>{header}</View>
67
74
  <Icon name={expanded ? "chevron-up" : "chevron-down"} size={18} color={colors.zinc[400]} />
@@ -87,11 +94,17 @@ const styles = StyleSheet.create({
87
94
  flexDirection: "row",
88
95
  alignItems: "center",
89
96
  gap: 12,
97
+ // A bare row is a too-small tap target and gives PressableHighlight's
98
+ // hover/press tint no room to read as a button. Pad vertically for a
99
+ // comfortable target and round the corners so the tint is a pill.
100
+ paddingVertical: 8,
101
+ borderRadius: 8,
90
102
  },
91
103
  headerContent: {
92
104
  flex: 1,
93
105
  },
94
106
  body: {
95
- marginTop: 12,
107
+ // The trigger's own bottom padding contributes ~8 of the header→body gap.
108
+ marginTop: 4,
96
109
  },
97
110
  });