glacia-native 0.4.0 → 0.5.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/lib/module/Bars.js +176 -0
- package/lib/module/Carousel.js +103 -0
- package/lib/module/Display.js +240 -0
- package/lib/module/Feedback.js +172 -0
- package/lib/module/Forms2.js +227 -0
- package/lib/module/Overlays.js +166 -0
- package/lib/module/Pickers.js +243 -0
- package/lib/module/Text.js +37 -0
- package/lib/module/index.js +58 -1
- package/lib/module/internal/GlassView.js +23 -7
- package/lib/module/internal/primitives.js +7 -2
- package/lib/module/internal/tokens.js +55 -1
- package/lib/typescript/Bars.d.ts +121 -0
- package/lib/typescript/Carousel.d.ts +47 -0
- package/lib/typescript/Display.d.ts +119 -0
- package/lib/typescript/Feedback.d.ts +138 -0
- package/lib/typescript/Forms2.d.ts +128 -0
- package/lib/typescript/Glass.d.ts +1 -1
- package/lib/typescript/Overlays.d.ts +105 -0
- package/lib/typescript/Pickers.d.ts +105 -0
- package/lib/typescript/Text.d.ts +28 -0
- package/lib/typescript/index.d.ts +9 -1
- package/lib/typescript/internal/GlassView.d.ts +10 -1
- package/lib/typescript/internal/tokens.d.ts +61 -0
- package/package.json +2 -2
- package/src/Bars.tsx +570 -0
- package/src/Carousel.tsx +233 -0
- package/src/Display.tsx +550 -0
- package/src/Feedback.tsx +579 -0
- package/src/Forms2.tsx +608 -0
- package/src/Overlays.tsx +474 -0
- package/src/Pickers.tsx +590 -0
- package/src/Text.tsx +83 -0
- package/src/index.ts +101 -1
- package/src/internal/GlassView.tsx +29 -7
- package/src/internal/primitives.ts +7 -2
- package/src/internal/tokens.ts +62 -0
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TimePicker = exports.DatePicker = exports.Calendar = exports.MONTHS = exports.WEEKDAYS = void 0;
|
|
4
|
+
exports.startOfDay = startOfDay;
|
|
5
|
+
exports.sameDay = sameDay;
|
|
6
|
+
exports.monthGrid = monthGrid;
|
|
7
|
+
exports.parseTime = parseTime;
|
|
8
|
+
exports.formatTime = formatTime;
|
|
9
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
10
|
+
const react_1 = require("react");
|
|
11
|
+
const Button_1 = require("./Button");
|
|
12
|
+
const Overlays_1 = require("./Overlays");
|
|
13
|
+
const tokens_1 = require("./internal/tokens");
|
|
14
|
+
const primitives_1 = require("./internal/primitives");
|
|
15
|
+
const motion_1 = require("./internal/motion");
|
|
16
|
+
// ---------------------------------------------------------------------------
|
|
17
|
+
// Date helpers
|
|
18
|
+
//
|
|
19
|
+
// Kept pure and exported so a caller (and the tests) can reason about the same
|
|
20
|
+
// calendar maths the grid uses. Dates are compared by day, never by instant,
|
|
21
|
+
// which is the bug that makes a picker select "yesterday" near midnight.
|
|
22
|
+
/** Midnight on the same calendar day, so two picks compare equal. */
|
|
23
|
+
function startOfDay(date) {
|
|
24
|
+
return new Date(date.getFullYear(), date.getMonth(), date.getDate());
|
|
25
|
+
}
|
|
26
|
+
function sameDay(a, b) {
|
|
27
|
+
if (!a || !b)
|
|
28
|
+
return false;
|
|
29
|
+
return (a.getFullYear() === b.getFullYear() && a.getMonth() === b.getMonth() && a.getDate() === b.getDate());
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* The six-row month grid.
|
|
33
|
+
*
|
|
34
|
+
* Always six rows so the calendar does not change height as months change,
|
|
35
|
+
* which would make the surrounding layout jump between February and March.
|
|
36
|
+
*/
|
|
37
|
+
function monthGrid(year, month, weekStartsOn = 0) {
|
|
38
|
+
const first = new Date(year, month, 1);
|
|
39
|
+
// getDay() is 0 for Sunday; the offset is how many leading cells to add.
|
|
40
|
+
const offset = (first.getDay() - weekStartsOn + 7) % 7;
|
|
41
|
+
const cells = [];
|
|
42
|
+
for (let i = 0; i < 42; i += 1) {
|
|
43
|
+
const date = new Date(year, month, 1 - offset + i);
|
|
44
|
+
cells.push({
|
|
45
|
+
date,
|
|
46
|
+
outside: date.getMonth() !== month,
|
|
47
|
+
key: `${date.getFullYear()}-${date.getMonth()}-${date.getDate()}`,
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
return cells;
|
|
51
|
+
}
|
|
52
|
+
exports.WEEKDAYS = ["S", "M", "T", "W", "T", "F", "S"];
|
|
53
|
+
exports.MONTHS = [
|
|
54
|
+
"January",
|
|
55
|
+
"February",
|
|
56
|
+
"March",
|
|
57
|
+
"April",
|
|
58
|
+
"May",
|
|
59
|
+
"June",
|
|
60
|
+
"July",
|
|
61
|
+
"August",
|
|
62
|
+
"September",
|
|
63
|
+
"October",
|
|
64
|
+
"November",
|
|
65
|
+
"December",
|
|
66
|
+
];
|
|
67
|
+
/**
|
|
68
|
+
* A month calendar, built from Glacia's own views.
|
|
69
|
+
*
|
|
70
|
+
* No native date picker anywhere: the grid, the weekday header and the month
|
|
71
|
+
* navigation are ours, so the calendar looks the same on iOS and Android and
|
|
72
|
+
* wears the library's tokens. The selected day is a `glassActive` fill, today
|
|
73
|
+
* carries a ring, and disabled days are dimmed.
|
|
74
|
+
*/
|
|
75
|
+
exports.Calendar = (0, react_1.forwardRef)(function Calendar({ value, onChange, minDate, maxDate, initialMonth, weekStartsOn = 0, style, isDark: isDarkProp, testID, ...props }, ref) {
|
|
76
|
+
const isDark = (0, motion_1.useIsDark)(isDarkProp);
|
|
77
|
+
const theme = isDark ? tokens_1.colors.dark : tokens_1.colors.light;
|
|
78
|
+
const { View, Text: RNText, Pressable } = (0, primitives_1.primitives)();
|
|
79
|
+
const anchor = value ?? initialMonth ?? new Date();
|
|
80
|
+
const [month, setMonth] = (0, react_1.useState)({ year: anchor.getFullYear(), month: anchor.getMonth() });
|
|
81
|
+
const cells = (0, react_1.useMemo)(() => monthGrid(month.year, month.month, weekStartsOn), [month, weekStartsOn]);
|
|
82
|
+
const today = startOfDay(new Date());
|
|
83
|
+
const isDisabled = (date) => {
|
|
84
|
+
const day = startOfDay(date);
|
|
85
|
+
if (minDate && day < startOfDay(minDate))
|
|
86
|
+
return true;
|
|
87
|
+
if (maxDate && day > startOfDay(maxDate))
|
|
88
|
+
return true;
|
|
89
|
+
return false;
|
|
90
|
+
};
|
|
91
|
+
const shift = (delta) => {
|
|
92
|
+
setMonth((current) => {
|
|
93
|
+
const next = new Date(current.year, current.month + delta, 1);
|
|
94
|
+
return { year: next.getFullYear(), month: next.getMonth() };
|
|
95
|
+
});
|
|
96
|
+
};
|
|
97
|
+
const cellSize = 38;
|
|
98
|
+
return ((0, jsx_runtime_1.jsxs)(View, { ref: ref, testID: testID, accessibilityRole: "none", style: [{ alignSelf: "stretch" }, style], ...props, children: [(0, jsx_runtime_1.jsxs)(View, { style: { flexDirection: "row", alignItems: "center", justifyContent: "space-between", paddingBottom: 8 }, children: [(0, jsx_runtime_1.jsx)(Pressable, { accessibilityRole: "button", accessibilityLabel: "Previous month", onPress: () => shift(-1), hitSlop: 8, style: { padding: 6 }, children: (0, jsx_runtime_1.jsx)(RNText, { style: { fontSize: 17, color: theme.foreground }, children: "\u2039" }) }), (0, jsx_runtime_1.jsx)(RNText, { accessibilityRole: "heading", style: { fontSize: 16, fontWeight: "600", color: theme.foreground }, children: `${exports.MONTHS[month.month]} ${month.year}` }), (0, jsx_runtime_1.jsx)(Pressable, { accessibilityRole: "button", accessibilityLabel: "Next month", onPress: () => shift(1), hitSlop: 8, style: { padding: 6 }, children: (0, jsx_runtime_1.jsx)(RNText, { style: { fontSize: 17, color: theme.foreground }, children: "\u203A" }) })] }), (0, jsx_runtime_1.jsx)(View, { style: { flexDirection: "row" }, children: Array.from({ length: 7 }, (_, i) => ((0, jsx_runtime_1.jsx)(View, { style: { flex: 1, alignItems: "center", paddingVertical: 4 }, children: (0, jsx_runtime_1.jsx)(RNText, { accessibilityElementsHidden: true, style: { fontSize: 11, fontWeight: "600", color: theme.muted }, children: exports.WEEKDAYS[(i + weekStartsOn) % 7] }) }, i))) }), Array.from({ length: 6 }, (_, row) => ((0, jsx_runtime_1.jsx)(View, { style: { flexDirection: "row" }, children: cells.slice(row * 7, row * 7 + 7).map((cell) => {
|
|
99
|
+
const selected = sameDay(cell.date, value);
|
|
100
|
+
const isToday = sameDay(cell.date, today);
|
|
101
|
+
const disabled = isDisabled(cell.date);
|
|
102
|
+
return ((0, jsx_runtime_1.jsx)(View, { style: { flex: 1, alignItems: "center", paddingVertical: 2 }, children: (0, jsx_runtime_1.jsx)(Pressable, { accessibilityRole: "button", accessibilityLabel: cell.date.toDateString(), accessibilityState: { selected, disabled }, disabled: disabled, onPress: () => onChange?.(startOfDay(cell.date)), style: {
|
|
103
|
+
width: cellSize,
|
|
104
|
+
height: cellSize,
|
|
105
|
+
borderRadius: cellSize / 2,
|
|
106
|
+
alignItems: "center",
|
|
107
|
+
justifyContent: "center",
|
|
108
|
+
backgroundColor: selected ? theme.glassActive : "transparent",
|
|
109
|
+
borderWidth: isToday && !selected ? 0.5 : selected ? 1 : 0,
|
|
110
|
+
borderColor: isToday && !selected ? theme.fill : theme.edge,
|
|
111
|
+
opacity: disabled ? 0.28 : cell.outside ? 0.45 : 1,
|
|
112
|
+
}, children: (0, jsx_runtime_1.jsx)(RNText, { style: {
|
|
113
|
+
fontSize: 14,
|
|
114
|
+
fontWeight: selected ? "600" : "400",
|
|
115
|
+
color: selected ? theme.foreground : theme.foreground,
|
|
116
|
+
}, children: String(cell.date.getDate()) }) }) }, cell.key));
|
|
117
|
+
}) }, row)))] }));
|
|
118
|
+
});
|
|
119
|
+
/**
|
|
120
|
+
* A date picker: the Calendar presented in a Sheet.
|
|
121
|
+
*
|
|
122
|
+
* Browsing months does not commit anything — the pending date is local until
|
|
123
|
+
* the user confirms, so an accidental swipe of the calendar cannot change a
|
|
124
|
+
* saved value.
|
|
125
|
+
*/
|
|
126
|
+
exports.DatePicker = (0, react_1.forwardRef)(function DatePicker({ open: openProp, defaultOpen = false, onOpenChange, value, onConfirm, onCancel, title = "Select date", confirmLabel = "Confirm", cancelLabel = "Cancel", minDate, maxDate, style, isDark: isDarkProp, testID, ...props }, ref) {
|
|
127
|
+
const isDark = (0, motion_1.useIsDark)(isDarkProp);
|
|
128
|
+
const [internalOpen, setInternalOpen] = (0, react_1.useState)(defaultOpen);
|
|
129
|
+
const open = openProp !== undefined ? openProp : internalOpen;
|
|
130
|
+
const [pending, setPending] = (0, react_1.useState)(value);
|
|
131
|
+
const setOpen = (next) => {
|
|
132
|
+
if (openProp === undefined)
|
|
133
|
+
setInternalOpen(next);
|
|
134
|
+
onOpenChange?.(next);
|
|
135
|
+
};
|
|
136
|
+
return ((0, jsx_runtime_1.jsx)(Overlays_1.Sheet, { ref: ref, open: open, onOpenChange: setOpen, title: title, isDark: isDark, testID: testID, style: style, footer: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Button_1.Button, { variant: "ghost", accessibilityLabel: cancelLabel, onPress: () => {
|
|
137
|
+
// Cancelling restores the committed value for the next open.
|
|
138
|
+
setPending(value);
|
|
139
|
+
onCancel?.();
|
|
140
|
+
setOpen(false);
|
|
141
|
+
}, children: cancelLabel }), (0, jsx_runtime_1.jsx)(Button_1.Button, { variant: "filled", accessibilityLabel: confirmLabel, disabled: pending === undefined, onPress: () => {
|
|
142
|
+
if (pending)
|
|
143
|
+
onConfirm?.(pending);
|
|
144
|
+
setOpen(false);
|
|
145
|
+
}, children: confirmLabel })] }), ...props, children: (0, jsx_runtime_1.jsx)(exports.Calendar, { value: pending, onChange: setPending, minDate: minDate, maxDate: maxDate, isDark: isDark, initialMonth: value }) }));
|
|
146
|
+
});
|
|
147
|
+
/** Splits "HH:MM" into parts, falling back to a sane default. */
|
|
148
|
+
function parseTime(value) {
|
|
149
|
+
const match = /^(\d{1,2}):(\d{2})$/.exec(value ?? "");
|
|
150
|
+
if (!match)
|
|
151
|
+
return { hour: 9, minute: 0 };
|
|
152
|
+
return {
|
|
153
|
+
hour: Math.min(Math.max(Number(match[1]), 0), 23),
|
|
154
|
+
minute: Math.min(Math.max(Number(match[2]), 0), 59),
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
/** Formats parts back to zero-padded "HH:MM". */
|
|
158
|
+
function formatTime(hour, minute) {
|
|
159
|
+
return `${String(hour).padStart(2, "0")}:${String(minute).padStart(2, "0")}`;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* A time picker: tappable hour/minute drums inside a Sheet.
|
|
163
|
+
*
|
|
164
|
+
* The drums are ordinary Pressables drawn by Glacia — not a native picker
|
|
165
|
+
* widget. Tapping a value selects it; the whole column scrolls in the Sheet.
|
|
166
|
+
*/
|
|
167
|
+
exports.TimePicker = (0, react_1.forwardRef)(function TimePicker({ open: openProp, defaultOpen = false, onOpenChange, value, onConfirm, onCancel, use12Hour = false, title = "Select time", confirmLabel = "Confirm", cancelLabel = "Cancel", minuteStep = 1, style, isDark: isDarkProp, testID, ...props }, ref) {
|
|
168
|
+
const isDark = (0, motion_1.useIsDark)(isDarkProp);
|
|
169
|
+
const theme = isDark ? tokens_1.colors.dark : tokens_1.colors.light;
|
|
170
|
+
const { View, Text: RNText, Pressable } = (0, primitives_1.primitives)();
|
|
171
|
+
const [internalOpen, setInternalOpen] = (0, react_1.useState)(defaultOpen);
|
|
172
|
+
const open = openProp !== undefined ? openProp : internalOpen;
|
|
173
|
+
const initial = parseTime(value);
|
|
174
|
+
const [hour, setHour] = (0, react_1.useState)(initial.hour);
|
|
175
|
+
const [minute, setMinute] = (0, react_1.useState)(initial.minute);
|
|
176
|
+
const setOpen = (next) => {
|
|
177
|
+
if (openProp === undefined)
|
|
178
|
+
setInternalOpen(next);
|
|
179
|
+
onOpenChange?.(next);
|
|
180
|
+
};
|
|
181
|
+
const hours = Array.from({ length: 24 }, (_, i) => i);
|
|
182
|
+
const minutes = Array.from({ length: Math.ceil(60 / minuteStep) }, (_, i) => i * minuteStep);
|
|
183
|
+
// In 12-hour mode the column shows 1–12; the stored hour stays 24-hour.
|
|
184
|
+
const displayHour = use12Hour ? (hour % 12 === 0 ? 12 : hour % 12) : hour;
|
|
185
|
+
const isPm = hour >= 12;
|
|
186
|
+
const column = (items, selected, onPick, label, pad = 2) => ((0, jsx_runtime_1.jsx)(View, { style: { height: 168, flex: 1 }, accessibilityRole: "none", accessibilityLabel: label, children: (0, jsx_runtime_1.jsx)(ScrollColumn, { items: items, selected: selected, onPick: onPick, isDark: isDark, pad: pad }) }));
|
|
187
|
+
return ((0, jsx_runtime_1.jsx)(Overlays_1.Sheet, { ref: ref, open: open, onOpenChange: setOpen, title: title, isDark: isDark, testID: testID, style: style, footer: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Button_1.Button, { variant: "ghost", accessibilityLabel: cancelLabel, onPress: () => {
|
|
188
|
+
setHour(initial.hour);
|
|
189
|
+
setMinute(initial.minute);
|
|
190
|
+
onCancel?.();
|
|
191
|
+
setOpen(false);
|
|
192
|
+
}, children: cancelLabel }), (0, jsx_runtime_1.jsx)(Button_1.Button, { variant: "filled", accessibilityLabel: confirmLabel, onPress: () => {
|
|
193
|
+
onConfirm?.(formatTime(hour, minute));
|
|
194
|
+
setOpen(false);
|
|
195
|
+
}, children: confirmLabel })] }), ...props, children: (0, jsx_runtime_1.jsxs)(View, { style: { flexDirection: "row", gap: 8, alignItems: "center" }, children: [column(use12Hour ? Array.from({ length: 12 }, (_, i) => i + 1) : hours, displayHour, (picked) => {
|
|
196
|
+
if (!use12Hour) {
|
|
197
|
+
setHour(picked);
|
|
198
|
+
return;
|
|
199
|
+
}
|
|
200
|
+
// Keep the current half of the day when the hour column changes.
|
|
201
|
+
setHour(picked % 12 === 0 ? (isPm ? 12 : 0) : isPm ? picked + 12 : picked);
|
|
202
|
+
}, "Hour"), (0, jsx_runtime_1.jsx)(RNText, { style: { fontSize: 22, color: theme.muted }, children: ":" }), column(minutes, minute, setMinute, "Minute"), use12Hour && ((0, jsx_runtime_1.jsx)(View, { style: { flex: 1, gap: 6 }, children: ["AM", "PM"].map((label) => {
|
|
203
|
+
const active = label === "PM" ? isPm : !isPm;
|
|
204
|
+
return ((0, jsx_runtime_1.jsx)(Pressable, { accessibilityRole: "button", accessibilityLabel: label, accessibilityState: { selected: active }, onPress: () => {
|
|
205
|
+
const nextPm = label === "PM";
|
|
206
|
+
if (nextPm === isPm)
|
|
207
|
+
return;
|
|
208
|
+
setHour((current) => (nextPm ? (current % 12) + 12 : current % 12));
|
|
209
|
+
}, style: {
|
|
210
|
+
height: 34,
|
|
211
|
+
borderRadius: tokens_1.radii.sm,
|
|
212
|
+
alignItems: "center",
|
|
213
|
+
justifyContent: "center",
|
|
214
|
+
backgroundColor: active ? theme.glassActive : "transparent",
|
|
215
|
+
borderWidth: 0.5,
|
|
216
|
+
borderColor: active ? theme.edge : "transparent",
|
|
217
|
+
}, children: (0, jsx_runtime_1.jsx)(RNText, { style: { fontSize: 14, fontWeight: active ? "600" : "500", color: active ? theme.foreground : theme.muted }, children: label }) }, label));
|
|
218
|
+
}) }))] }) }));
|
|
219
|
+
});
|
|
220
|
+
/** One scrollable column of the time drums. */
|
|
221
|
+
function ScrollColumn({ items, selected, onPick, isDark, pad, }) {
|
|
222
|
+
const theme = isDark ? tokens_1.colors.dark : tokens_1.colors.light;
|
|
223
|
+
const { getScrollView } = (0, primitives_1.primitives)();
|
|
224
|
+
const ScrollView = getScrollView();
|
|
225
|
+
const { View, Text: RNText, Pressable } = (0, primitives_1.primitives)();
|
|
226
|
+
const rows = items.map((item) => {
|
|
227
|
+
const active = item === selected;
|
|
228
|
+
return ((0, jsx_runtime_1.jsx)(Pressable, { accessibilityRole: "button", accessibilityLabel: String(item).padStart(pad, "0"), accessibilityState: { selected: active }, onPress: () => onPick(item), style: {
|
|
229
|
+
height: 34,
|
|
230
|
+
alignItems: "center",
|
|
231
|
+
justifyContent: "center",
|
|
232
|
+
borderRadius: tokens_1.radii.sm,
|
|
233
|
+
backgroundColor: active ? theme.glassActive : "transparent",
|
|
234
|
+
}, children: (0, jsx_runtime_1.jsx)(RNText, { style: { fontSize: 17, fontWeight: active ? "600" : "400", color: active ? theme.foreground : theme.muted }, children: String(item).padStart(pad, "0") }) }, item));
|
|
235
|
+
});
|
|
236
|
+
if (!ScrollView) {
|
|
237
|
+
// Off-device: no ScrollView, so the column is clipped to its height rather
|
|
238
|
+
// than truncated. Every value stays present and selectable, which is what
|
|
239
|
+
// the real drum shows once it can scroll.
|
|
240
|
+
return (0, jsx_runtime_1.jsx)(View, { style: { gap: 2, overflow: "hidden", height: 168 }, children: rows });
|
|
241
|
+
}
|
|
242
|
+
return ((0, jsx_runtime_1.jsx)(ScrollView, { showsVerticalScrollIndicator: false, style: { flex: 1 }, children: (0, jsx_runtime_1.jsx)(View, { style: { gap: 2 }, children: rows }) }));
|
|
243
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Text = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const tokens_1 = require("./internal/tokens");
|
|
7
|
+
const primitives_1 = require("./internal/primitives");
|
|
8
|
+
const motion_1 = require("./internal/motion");
|
|
9
|
+
/** The accessibility role each variant announces. */
|
|
10
|
+
const roles = {
|
|
11
|
+
title: "heading",
|
|
12
|
+
heading: "heading",
|
|
13
|
+
body: "text",
|
|
14
|
+
caption: "text",
|
|
15
|
+
label: "text",
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Themed text.
|
|
19
|
+
*
|
|
20
|
+
* Every Glacia component that renders words uses this, so type, colour and
|
|
21
|
+
* contrast come from one place. It wraps the resolver's `Text`, which is React
|
|
22
|
+
* Native's own on a device.
|
|
23
|
+
*/
|
|
24
|
+
exports.Text = (0, react_1.forwardRef)(function Text({ variant = "body", muted = false, destructive = false, numberOfLines, children, style, isDark: isDarkProp, testID, ...props }, ref) {
|
|
25
|
+
const isDark = (0, motion_1.useIsDark)(isDarkProp);
|
|
26
|
+
const theme = isDark ? tokens_1.colors.dark : tokens_1.colors.light;
|
|
27
|
+
const { Text: RNText } = (0, primitives_1.primitives)();
|
|
28
|
+
const scale = tokens_1.typeScale[variant];
|
|
29
|
+
const textStyle = {
|
|
30
|
+
fontSize: scale.fontSize,
|
|
31
|
+
lineHeight: scale.lineHeight,
|
|
32
|
+
fontWeight: scale.fontWeight,
|
|
33
|
+
color: destructive ? theme.destructive : muted ? theme.muted : theme.foreground,
|
|
34
|
+
...style,
|
|
35
|
+
};
|
|
36
|
+
return ((0, jsx_runtime_1.jsx)(RNText, { ref: ref, testID: testID, accessibilityRole: roles[variant], numberOfLines: numberOfLines, style: textStyle, ...props, children: children }));
|
|
37
|
+
});
|
package/lib/module/index.js
CHANGED
|
@@ -14,7 +14,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.
|
|
17
|
+
exports.Accordion = exports.ListSection = exports.ListItem = exports.List = exports.Banner = exports.Toast = exports.initialsOf = exports.Progress = exports.Spinner = exports.Skeleton = exports.Separator = exports.Badge = exports.Avatar = exports.Text = exports.NativeScrollArea = exports.NativeTable = exports.NativeImageGeneration = exports.NativeAIInput = exports.NativePanelside = exports.NativeThinkingOrb = exports.NativeSoundwave = exports.NativeTask = exports.NativeResponse = exports.NativeSources = exports.NativePlan = exports.ActionSheet = exports.AlertDialog = exports.DialogTrigger = exports.Dialog = exports.Select = exports.RadioGroup = exports.Checkbox = exports.Field = exports.Label = exports.Textarea = exports.Input = exports.CardFooter = exports.CardBody = exports.CardContent = exports.CardDescription = exports.CardTitle = exports.CardHeader = exports.Card = exports.Tabs = exports.TabBar = exports.SegmentedControl = exports.Slider = exports.Switch = exports.Button = exports.Glass = void 0;
|
|
18
|
+
exports.toneColor = exports.typeScale = exports.springs = exports.radii = exports.colors = exports.isGlassSupported = exports.MONTHS = exports.WEEKDAYS = exports.formatTime = exports.parseTime = exports.sameDay = exports.startOfDay = exports.monthGrid = exports.TimePicker = exports.DatePicker = exports.Calendar = exports.ButtonGroup = exports.InputOTP = exports.ToggleGroup = exports.Toggle = exports.Stepper = exports.PageControl = exports.Carousel = exports.anchorPopover = exports.Drawer = exports.Sheet = exports.Menu = exports.AppBar = exports.IconButton = exports.FAB = exports.Chip = exports.SearchBar = void 0;
|
|
18
19
|
var Glass_1 = require("./Glass");
|
|
19
20
|
Object.defineProperty(exports, "Glass", { enumerable: true, get: function () { return Glass_1.Glass; } });
|
|
20
21
|
var Button_1 = require("./Button");
|
|
@@ -70,9 +71,65 @@ Object.defineProperty(exports, "NativeTable", { enumerable: true, get: function
|
|
|
70
71
|
Object.defineProperty(exports, "NativeScrollArea", { enumerable: true, get: function () { return Table_1.NativeScrollArea; } });
|
|
71
72
|
// Charts, drawn with react-native-svg using the same maths as the web package.
|
|
72
73
|
__exportStar(require("./charts"), exports);
|
|
74
|
+
// Basics.
|
|
75
|
+
var Text_1 = require("./Text");
|
|
76
|
+
Object.defineProperty(exports, "Text", { enumerable: true, get: function () { return Text_1.Text; } });
|
|
77
|
+
var Display_1 = require("./Display");
|
|
78
|
+
Object.defineProperty(exports, "Avatar", { enumerable: true, get: function () { return Display_1.Avatar; } });
|
|
79
|
+
Object.defineProperty(exports, "Badge", { enumerable: true, get: function () { return Display_1.Badge; } });
|
|
80
|
+
Object.defineProperty(exports, "Separator", { enumerable: true, get: function () { return Display_1.Separator; } });
|
|
81
|
+
Object.defineProperty(exports, "Skeleton", { enumerable: true, get: function () { return Display_1.Skeleton; } });
|
|
82
|
+
Object.defineProperty(exports, "Spinner", { enumerable: true, get: function () { return Display_1.Spinner; } });
|
|
83
|
+
Object.defineProperty(exports, "Progress", { enumerable: true, get: function () { return Display_1.Progress; } });
|
|
84
|
+
Object.defineProperty(exports, "initialsOf", { enumerable: true, get: function () { return Display_1.initialsOf; } });
|
|
85
|
+
// Feedback and display.
|
|
86
|
+
var Feedback_1 = require("./Feedback");
|
|
87
|
+
Object.defineProperty(exports, "Toast", { enumerable: true, get: function () { return Feedback_1.Toast; } });
|
|
88
|
+
Object.defineProperty(exports, "Banner", { enumerable: true, get: function () { return Feedback_1.Banner; } });
|
|
89
|
+
Object.defineProperty(exports, "List", { enumerable: true, get: function () { return Feedback_1.List; } });
|
|
90
|
+
Object.defineProperty(exports, "ListItem", { enumerable: true, get: function () { return Feedback_1.ListItem; } });
|
|
91
|
+
Object.defineProperty(exports, "ListSection", { enumerable: true, get: function () { return Feedback_1.ListSection; } });
|
|
92
|
+
Object.defineProperty(exports, "Accordion", { enumerable: true, get: function () { return Feedback_1.Accordion; } });
|
|
93
|
+
// Bars, buttons and navigation.
|
|
94
|
+
var Bars_1 = require("./Bars");
|
|
95
|
+
Object.defineProperty(exports, "SearchBar", { enumerable: true, get: function () { return Bars_1.SearchBar; } });
|
|
96
|
+
Object.defineProperty(exports, "Chip", { enumerable: true, get: function () { return Bars_1.Chip; } });
|
|
97
|
+
Object.defineProperty(exports, "FAB", { enumerable: true, get: function () { return Bars_1.FAB; } });
|
|
98
|
+
Object.defineProperty(exports, "IconButton", { enumerable: true, get: function () { return Bars_1.IconButton; } });
|
|
99
|
+
Object.defineProperty(exports, "AppBar", { enumerable: true, get: function () { return Bars_1.AppBar; } });
|
|
100
|
+
// Overlays.
|
|
101
|
+
var Overlays_1 = require("./Overlays");
|
|
102
|
+
Object.defineProperty(exports, "Menu", { enumerable: true, get: function () { return Overlays_1.Menu; } });
|
|
103
|
+
Object.defineProperty(exports, "Sheet", { enumerable: true, get: function () { return Overlays_1.Sheet; } });
|
|
104
|
+
Object.defineProperty(exports, "Drawer", { enumerable: true, get: function () { return Overlays_1.Drawer; } });
|
|
105
|
+
Object.defineProperty(exports, "anchorPopover", { enumerable: true, get: function () { return Overlays_1.anchorPopover; } });
|
|
106
|
+
// Carousel.
|
|
107
|
+
var Carousel_1 = require("./Carousel");
|
|
108
|
+
Object.defineProperty(exports, "Carousel", { enumerable: true, get: function () { return Carousel_1.Carousel; } });
|
|
109
|
+
Object.defineProperty(exports, "PageControl", { enumerable: true, get: function () { return Carousel_1.PageControl; } });
|
|
110
|
+
// Forms and pickers.
|
|
111
|
+
var Forms2_1 = require("./Forms2");
|
|
112
|
+
Object.defineProperty(exports, "Stepper", { enumerable: true, get: function () { return Forms2_1.Stepper; } });
|
|
113
|
+
Object.defineProperty(exports, "Toggle", { enumerable: true, get: function () { return Forms2_1.Toggle; } });
|
|
114
|
+
Object.defineProperty(exports, "ToggleGroup", { enumerable: true, get: function () { return Forms2_1.ToggleGroup; } });
|
|
115
|
+
Object.defineProperty(exports, "InputOTP", { enumerable: true, get: function () { return Forms2_1.InputOTP; } });
|
|
116
|
+
Object.defineProperty(exports, "ButtonGroup", { enumerable: true, get: function () { return Forms2_1.ButtonGroup; } });
|
|
117
|
+
var Pickers_1 = require("./Pickers");
|
|
118
|
+
Object.defineProperty(exports, "Calendar", { enumerable: true, get: function () { return Pickers_1.Calendar; } });
|
|
119
|
+
Object.defineProperty(exports, "DatePicker", { enumerable: true, get: function () { return Pickers_1.DatePicker; } });
|
|
120
|
+
Object.defineProperty(exports, "TimePicker", { enumerable: true, get: function () { return Pickers_1.TimePicker; } });
|
|
121
|
+
Object.defineProperty(exports, "monthGrid", { enumerable: true, get: function () { return Pickers_1.monthGrid; } });
|
|
122
|
+
Object.defineProperty(exports, "startOfDay", { enumerable: true, get: function () { return Pickers_1.startOfDay; } });
|
|
123
|
+
Object.defineProperty(exports, "sameDay", { enumerable: true, get: function () { return Pickers_1.sameDay; } });
|
|
124
|
+
Object.defineProperty(exports, "parseTime", { enumerable: true, get: function () { return Pickers_1.parseTime; } });
|
|
125
|
+
Object.defineProperty(exports, "formatTime", { enumerable: true, get: function () { return Pickers_1.formatTime; } });
|
|
126
|
+
Object.defineProperty(exports, "WEEKDAYS", { enumerable: true, get: function () { return Pickers_1.WEEKDAYS; } });
|
|
127
|
+
Object.defineProperty(exports, "MONTHS", { enumerable: true, get: function () { return Pickers_1.MONTHS; } });
|
|
73
128
|
var GlassView_1 = require("./internal/GlassView");
|
|
74
129
|
Object.defineProperty(exports, "isGlassSupported", { enumerable: true, get: function () { return GlassView_1.isGlassSupported; } });
|
|
75
130
|
var tokens_1 = require("./internal/tokens");
|
|
76
131
|
Object.defineProperty(exports, "colors", { enumerable: true, get: function () { return tokens_1.colors; } });
|
|
77
132
|
Object.defineProperty(exports, "radii", { enumerable: true, get: function () { return tokens_1.radii; } });
|
|
78
133
|
Object.defineProperty(exports, "springs", { enumerable: true, get: function () { return tokens_1.springs; } });
|
|
134
|
+
Object.defineProperty(exports, "typeScale", { enumerable: true, get: function () { return tokens_1.typeScale; } });
|
|
135
|
+
Object.defineProperty(exports, "toneColor", { enumerable: true, get: function () { return tokens_1.toneColor; } });
|
|
@@ -1,18 +1,33 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.GlassView = exports.isGlassSupported = void 0;
|
|
4
|
+
exports.resetGlassRouter = resetGlassRouter;
|
|
4
5
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
6
|
const react_1 = require("react");
|
|
6
7
|
const fallback_1 = require("./fallback");
|
|
7
8
|
const glass_routing_1 = require("./glass-routing");
|
|
8
9
|
const motion_1 = require("./motion");
|
|
9
10
|
/**
|
|
10
|
-
* The installed `@callstack/liquid-glass` module
|
|
11
|
-
*
|
|
12
|
-
*
|
|
11
|
+
* The installed `@callstack/liquid-glass` module's routing decision.
|
|
12
|
+
*
|
|
13
|
+
* Resolved lazily and memoised on first use, rather than at module load, so the
|
|
14
|
+
* decision is taken when a surface first renders. On a device that is the same
|
|
15
|
+
* answer either way — `isLiquidGlassSupported` is a constant of the installed
|
|
16
|
+
* build — but it keeps the choice a property of the module rather than of
|
|
17
|
+
* import order, which is what makes both branches reachable in tests.
|
|
13
18
|
*/
|
|
14
|
-
|
|
15
|
-
|
|
19
|
+
let cachedRouter = null;
|
|
20
|
+
function router() {
|
|
21
|
+
if (cachedRouter === null)
|
|
22
|
+
cachedRouter = (0, glass_routing_1.defaultRouter)();
|
|
23
|
+
return cachedRouter;
|
|
24
|
+
}
|
|
25
|
+
/** Clears the memoised decision. Only tests call this, to drive both branches. */
|
|
26
|
+
function resetGlassRouter() {
|
|
27
|
+
cachedRouter = null;
|
|
28
|
+
}
|
|
29
|
+
/** Whether this build renders Apple's glass. */
|
|
30
|
+
exports.isGlassSupported = (0, glass_routing_1.defaultRouter)().supported;
|
|
16
31
|
/**
|
|
17
32
|
* Platform Glass View — the single place a glass surface is chosen:
|
|
18
33
|
* - iOS 26+: Real UIGlassEffect via @callstack/liquid-glass
|
|
@@ -20,8 +35,9 @@ exports.isGlassSupported = router.supported;
|
|
|
20
35
|
*/
|
|
21
36
|
exports.GlassView = (0, react_1.forwardRef)(function GlassView({ effect = "regular", tintColor, interactive = false, testID, style, children, isDark: isDarkProp, ...props }, ref) {
|
|
22
37
|
const isDark = (0, motion_1.useIsDark)(isDarkProp);
|
|
23
|
-
|
|
24
|
-
|
|
38
|
+
const decision = router();
|
|
39
|
+
if (decision.supported && decision.LiquidGlassView) {
|
|
40
|
+
const LiquidGlassView = decision.LiquidGlassView;
|
|
25
41
|
return ((0, jsx_runtime_1.jsx)(LiquidGlassView, { ref: ref, effect: effect, tintColor: tintColor, interactive: interactive, testID: testID, style: style, ...props, children: children }));
|
|
26
42
|
}
|
|
27
43
|
return ((0, jsx_runtime_1.jsx)(fallback_1.FallbackGlassView, { ref: ref, effect: effect, tintColor: tintColor, testID: testID, isDark: isDark, style: style, ...props, children: children }));
|
|
@@ -146,8 +146,10 @@ function resolve() {
|
|
|
146
146
|
domProps.onMouseUp = onMouseUp;
|
|
147
147
|
if (onMouseLeave)
|
|
148
148
|
domProps.onMouseLeave = onMouseLeave;
|
|
149
|
-
if (onPress) {
|
|
149
|
+
if (onPress && !disabled) {
|
|
150
150
|
// Any element hosting a press handler needs a DOM click to fire it.
|
|
151
|
+
// A disabled control gets no handler at all, mirroring React Native's
|
|
152
|
+
// Pressable, which swallows the press rather than calling it through.
|
|
151
153
|
domProps.onClick = onPress;
|
|
152
154
|
if (domProps.role === "button" ||
|
|
153
155
|
domProps.role === "checkbox" ||
|
|
@@ -179,12 +181,15 @@ function resolve() {
|
|
|
179
181
|
};
|
|
180
182
|
/** An image that reads its remote source in the DOM preview. */
|
|
181
183
|
function imageFallback(props) {
|
|
182
|
-
const { source, accessibilityLabel, style } = props ?? {};
|
|
184
|
+
const { source, accessibilityLabel, style, onError } = props ?? {};
|
|
183
185
|
const { createElement } = require("react");
|
|
184
186
|
return createElement("img", {
|
|
185
187
|
src: source?.uri,
|
|
186
188
|
alt: accessibilityLabel ?? "",
|
|
187
189
|
style: toDomStyle(style),
|
|
190
|
+
// A broken source must reach the component the same way it does on a
|
|
191
|
+
// device, or a fallback (initials, placeholder) can never render.
|
|
192
|
+
onError,
|
|
188
193
|
});
|
|
189
194
|
}
|
|
190
195
|
const SvgComponent = svg?.default ?? fallback("svg");
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.colors = exports.springs = exports.radii = void 0;
|
|
3
|
+
exports.colors = exports.typeScale = exports.springs = exports.radii = void 0;
|
|
4
|
+
exports.toneColor = toneColor;
|
|
4
5
|
const glacia_tokens_1 = require("glacia-tokens");
|
|
5
6
|
exports.radii = {
|
|
6
7
|
sm: glacia_tokens_1.radii.sm.number,
|
|
@@ -14,6 +15,27 @@ exports.springs = {
|
|
|
14
15
|
snappy: glacia_tokens_1.springs.snappy,
|
|
15
16
|
bouncy: glacia_tokens_1.springs.bouncy,
|
|
16
17
|
};
|
|
18
|
+
/**
|
|
19
|
+
* The package's type scale, in React Native points.
|
|
20
|
+
*
|
|
21
|
+
* Text maps its variants onto these names so every component in the library —
|
|
22
|
+
* and every app built on it — sizes type the same way.
|
|
23
|
+
*/
|
|
24
|
+
exports.typeScale = {
|
|
25
|
+
title: { fontSize: 28, lineHeight: 34, fontWeight: "700" },
|
|
26
|
+
heading: { fontSize: 20, lineHeight: 26, fontWeight: "600" },
|
|
27
|
+
body: { fontSize: 16, lineHeight: 22, fontWeight: "400" },
|
|
28
|
+
label: { fontSize: 13, lineHeight: 18, fontWeight: "600" },
|
|
29
|
+
caption: { fontSize: 12, lineHeight: 16, fontWeight: "400" },
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* Theme colours in the form React Native accepts.
|
|
33
|
+
*
|
|
34
|
+
* The shared tokens express colours as CSS colour strings (`rgb(r g b / a)`),
|
|
35
|
+
* which is right for the web package and rejected by React Native. The values
|
|
36
|
+
* below are the same colours written as `rgba(...)`/hex, sourced from the same
|
|
37
|
+
* token file, so the two platforms stay in step.
|
|
38
|
+
*/
|
|
17
39
|
exports.colors = {
|
|
18
40
|
light: {
|
|
19
41
|
foreground: "#000000E0",
|
|
@@ -21,8 +43,17 @@ exports.colors = {
|
|
|
21
43
|
glass: "rgba(255, 255, 255, 0.6)",
|
|
22
44
|
glassActive: "rgba(236, 236, 240, 0.85)",
|
|
23
45
|
edge: "rgba(0, 0, 0, 0.08)",
|
|
46
|
+
separator: "rgba(60, 60, 67, 0.18)",
|
|
24
47
|
fill: "#0088FF",
|
|
25
48
|
destructive: "#FF3B30",
|
|
49
|
+
on: "#34C759",
|
|
50
|
+
warning: "#FF9500",
|
|
51
|
+
info: "#007AFF",
|
|
52
|
+
// The dimmed layer behind a sheet, drawer or dialog.
|
|
53
|
+
scrim: "rgba(0, 0, 0, 0.45)",
|
|
54
|
+
// Text and icons drawn on top of a filled (tinted) surface.
|
|
55
|
+
onTint: "#FFFFFF",
|
|
56
|
+
skeleton: "rgba(60, 60, 67, 0.12)",
|
|
26
57
|
// Chart axis and grid lines: low-contrast, so they never compete with data.
|
|
27
58
|
axis: "#3C3C43",
|
|
28
59
|
},
|
|
@@ -32,8 +63,31 @@ exports.colors = {
|
|
|
32
63
|
glass: "rgba(40, 40, 40, 0.62)",
|
|
33
64
|
glassActive: "rgba(70, 70, 70, 0.62)",
|
|
34
65
|
edge: "rgba(255, 255, 255, 0.08)",
|
|
66
|
+
separator: "rgba(235, 235, 245, 0.16)",
|
|
35
67
|
fill: "#0091FF",
|
|
36
68
|
destructive: "#FF4245",
|
|
69
|
+
on: "#30D158",
|
|
70
|
+
warning: "#FF9F0A",
|
|
71
|
+
info: "#0A84FF",
|
|
72
|
+
scrim: "rgba(0, 0, 0, 0.6)",
|
|
73
|
+
onTint: "#FFFFFF",
|
|
74
|
+
skeleton: "rgba(235, 235, 245, 0.14)",
|
|
37
75
|
axis: "#EBEBF5",
|
|
38
76
|
},
|
|
39
77
|
};
|
|
78
|
+
/** Resolves a tone to its theme colour. */
|
|
79
|
+
function toneColor(theme, tone) {
|
|
80
|
+
switch (tone) {
|
|
81
|
+
case "success":
|
|
82
|
+
return theme.on;
|
|
83
|
+
case "warning":
|
|
84
|
+
return theme.warning;
|
|
85
|
+
case "error":
|
|
86
|
+
return theme.destructive;
|
|
87
|
+
default:
|
|
88
|
+
return theme.info;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
// Referenced so the shared tokens stay a live dependency: a colour removed
|
|
92
|
+
// from glacia-tokens should not silently linger here forever.
|
|
93
|
+
void glacia_tokens_1.colors;
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
import type { StyleProp, ViewStyle } from "react-native";
|
|
3
|
+
export interface SearchBarProps {
|
|
4
|
+
/** Controlled text. Omit and the bar keeps its own. */
|
|
5
|
+
value?: string;
|
|
6
|
+
defaultValue?: string;
|
|
7
|
+
onChangeText?: (text: string) => void;
|
|
8
|
+
onSubmit?: (text: string) => void;
|
|
9
|
+
placeholder?: string;
|
|
10
|
+
/** Shows a cancel button beside the field while it holds text or focus. */
|
|
11
|
+
showCancel?: boolean;
|
|
12
|
+
onCancel?: () => void;
|
|
13
|
+
accessibilityLabel?: string;
|
|
14
|
+
style?: StyleProp<ViewStyle>;
|
|
15
|
+
isDark?: boolean;
|
|
16
|
+
testID?: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* A search field for a bar or a screen header.
|
|
20
|
+
*
|
|
21
|
+
* Distinct from NativeAIInput: that is an AI composer with send semantics, this
|
|
22
|
+
* is ordinary app search — magnifier, themed placeholder, and a clear button
|
|
23
|
+
* once there is something to clear.
|
|
24
|
+
*/
|
|
25
|
+
export declare const SearchBar: import("react").ForwardRefExoticComponent<SearchBarProps & import("react").RefAttributes<any>>;
|
|
26
|
+
export interface ChipProps {
|
|
27
|
+
label: string;
|
|
28
|
+
icon?: ReactNode;
|
|
29
|
+
/** Shows a close affordance; called when it is pressed. */
|
|
30
|
+
onClose?: () => void;
|
|
31
|
+
/** Tapping the chip. Omit to make it a static tag. */
|
|
32
|
+
onPress?: () => void;
|
|
33
|
+
/** Controlled selection. Omit for a plain tag with no selected state. */
|
|
34
|
+
selected?: boolean;
|
|
35
|
+
defaultSelected?: boolean;
|
|
36
|
+
onSelectedChange?: (selected: boolean) => void;
|
|
37
|
+
disabled?: boolean;
|
|
38
|
+
style?: StyleProp<ViewStyle>;
|
|
39
|
+
isDark?: boolean;
|
|
40
|
+
testID?: string;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* A filter or tag pill.
|
|
44
|
+
*
|
|
45
|
+
* Selected state is a glass pill tinted with `glassActive` — the same selected
|
|
46
|
+
* treatment SegmentedControl and TabBar use, rather than a new colour.
|
|
47
|
+
*/
|
|
48
|
+
export declare const Chip: import("react").ForwardRefExoticComponent<ChipProps & import("react").RefAttributes<any>>;
|
|
49
|
+
export interface FABProps {
|
|
50
|
+
onPress: () => void;
|
|
51
|
+
/** Required: an icon-only circle has no text to announce. */
|
|
52
|
+
accessibilityLabel: string;
|
|
53
|
+
/** The icon. When a label string is also supplied, the FAB is extended. */
|
|
54
|
+
icon?: ReactNode;
|
|
55
|
+
/** Turns the circle into an extended pill with visible text. */
|
|
56
|
+
label?: string;
|
|
57
|
+
size?: "md" | "lg";
|
|
58
|
+
disabled?: boolean;
|
|
59
|
+
style?: StyleProp<ViewStyle>;
|
|
60
|
+
isDark?: boolean;
|
|
61
|
+
testID?: string;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* The floating action button.
|
|
65
|
+
*
|
|
66
|
+
* The flagship glass circle of the library: a round `Glass` with `interactive`
|
|
67
|
+
* so the material itself responds to touch. The caller positions it; the
|
|
68
|
+
* component does not assume an edge.
|
|
69
|
+
*/
|
|
70
|
+
export declare const FAB: import("react").ForwardRefExoticComponent<FABProps & import("react").RefAttributes<any>>;
|
|
71
|
+
export interface IconButtonProps {
|
|
72
|
+
/** Required: the icon carries no text of its own. */
|
|
73
|
+
accessibilityLabel: string;
|
|
74
|
+
onPress: () => void;
|
|
75
|
+
icon: ReactNode;
|
|
76
|
+
size?: "sm" | "md" | "lg";
|
|
77
|
+
variant?: "glass" | "ghost";
|
|
78
|
+
disabled?: boolean;
|
|
79
|
+
style?: StyleProp<ViewStyle>;
|
|
80
|
+
isDark?: boolean;
|
|
81
|
+
testID?: string;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* An icon-only button on glass.
|
|
85
|
+
*
|
|
86
|
+
* Button takes an icon alongside a label; this is the icon-only form, which
|
|
87
|
+
* every kit ships for toolbars and bar actions.
|
|
88
|
+
*/
|
|
89
|
+
export declare const IconButton: import("react").ForwardRefExoticComponent<IconButtonProps & import("react").RefAttributes<any>>;
|
|
90
|
+
export interface AppBarAction {
|
|
91
|
+
/** Announced to screen readers; the icon is decorative. */
|
|
92
|
+
accessibilityLabel: string;
|
|
93
|
+
icon: ReactNode;
|
|
94
|
+
onPress: () => void;
|
|
95
|
+
disabled?: boolean;
|
|
96
|
+
}
|
|
97
|
+
export interface AppBarProps {
|
|
98
|
+
title: string;
|
|
99
|
+
/** Optional second line under the title. */
|
|
100
|
+
subtitle?: string;
|
|
101
|
+
/** A back or menu action at the leading edge. */
|
|
102
|
+
leading?: AppBarAction;
|
|
103
|
+
/** Actions at the trailing edge. */
|
|
104
|
+
actions?: AppBarAction[];
|
|
105
|
+
/**
|
|
106
|
+
* The caller's safe-area inset above the bar. Glacia takes it as a prop
|
|
107
|
+
* rather than adding a native insets dependency: on a device the app already
|
|
108
|
+
* knows its insets, and passing a number keeps this component dependency-free.
|
|
109
|
+
*/
|
|
110
|
+
topInset?: number;
|
|
111
|
+
style?: StyleProp<ViewStyle>;
|
|
112
|
+
isDark?: boolean;
|
|
113
|
+
testID?: string;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* The top bar.
|
|
117
|
+
*
|
|
118
|
+
* A glass bar across the top of the screen with a leading action, a title and
|
|
119
|
+
* trailing actions — the counterpart to the existing bottom TabBar.
|
|
120
|
+
*/
|
|
121
|
+
export declare const AppBar: import("react").ForwardRefExoticComponent<AppBarProps & import("react").RefAttributes<any>>;
|