@lotics/ui 2.0.0 → 2.2.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lotics/ui",
3
- "version": "2.0.0",
3
+ "version": "2.2.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
  });
package/src/combobox.tsx CHANGED
@@ -63,6 +63,14 @@ export interface ComboboxProps<T extends string = string, D = unknown> {
63
63
  emptyText?: string;
64
64
  accessibilityLabel?: string;
65
65
  disabled?: boolean;
66
+ /** Single-select only: show an in-input clear ✕ whenever the input has text
67
+ * (a reflected selection or a typed query). Pressing it empties the input,
68
+ * resets the search, and fires `onClear` so the consumer can deselect. */
69
+ clearable?: boolean;
70
+ /** Fired when the clear ✕ is pressed (the input + search are reset first). */
71
+ onClear?: () => void;
72
+ /** Accessible label for the clear ✕ (default "Clear"). */
73
+ clearLabel?: string;
66
74
  autoFocus?: boolean;
67
75
  testID?: string;
68
76
  style?: StyleProp<ViewStyle>;
@@ -106,6 +114,9 @@ export function Combobox<T extends string = string, D = unknown>(props: Combobox
106
114
  emptyText = "No results",
107
115
  accessibilityLabel = "Results",
108
116
  disabled = false,
117
+ clearable = false,
118
+ onClear,
119
+ clearLabel,
109
120
  autoFocus = false,
110
121
  testID,
111
122
  style,
@@ -262,6 +273,9 @@ export function Combobox<T extends string = string, D = unknown>(props: Combobox
262
273
  testID={testID}
263
274
  icon={multi ? undefined : "search"}
264
275
  value={query}
276
+ clearable={!multi && clearable}
277
+ clearLabel={clearLabel}
278
+ onClear={onClear}
265
279
  onChangeText={handleChangeText}
266
280
  onFocus={() => {
267
281
  if (!disabled) setOpen(true);