@lotics/ui 11.7.1 → 11.7.2
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/docs/composition.md +2 -1
- package/package.json +1 -1
- package/src/floating_action_bar.tsx +4 -1
- package/src/locale.tsx +5 -0
package/docs/composition.md
CHANGED
|
@@ -254,7 +254,8 @@ an empty overlay with no content to derive a name from.
|
|
|
254
254
|
|
|
255
255
|
Make a register SELECTABLE with the `Table` `leading` gutter + `selectAll` slot — a
|
|
256
256
|
`CheckboxInput` per `TableRow` (its `leading` slot) + a select-all in the header band, the ticked
|
|
257
|
-
rows `marked`, paired with a `FloatingActionBar
|
|
257
|
+
rows `marked`, paired with a `FloatingActionBar` (its "Clear" escape is locale-resolved — pass
|
|
258
|
+
`clearLabel` only to override it). The selection state is the **`useSelection()`**
|
|
258
259
|
hook (`@lotics/ui/use_selection`: `selected` / `has` / `count` / `toggle` / `setAll` /
|
|
259
260
|
`allSelected` / `indeterminate` / `clear`) — gating which rows CAN be ticked stays with you: pass
|
|
260
261
|
only the selectable ids to `setAll`/`allSelected`/`indeterminate` (a non-selectable row gets a
|
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ReactNode } from "react";
|
|
2
2
|
import { StyleSheet, View } from "react-native";
|
|
3
3
|
import { Button } from "./button";
|
|
4
|
+
import { useLoticsLocale } from "./locale";
|
|
4
5
|
import { Card } from "./card";
|
|
5
6
|
import { Text } from "./text";
|
|
6
7
|
|
|
@@ -11,6 +12,7 @@ export interface FloatingActionBarProps {
|
|
|
11
12
|
label: string;
|
|
12
13
|
/** Clears the selection — the always-present escape. */
|
|
13
14
|
onClear: () => void;
|
|
15
|
+
/** Overrides the localized default ("Clear" / "Bỏ chọn"). */
|
|
14
16
|
clearLabel?: string;
|
|
15
17
|
/** The bulk action(s) — a primary `Button` or an "Assign to…" `Popover`. */
|
|
16
18
|
children: ReactNode;
|
|
@@ -25,7 +27,8 @@ export interface FloatingActionBarProps {
|
|
|
25
27
|
* `box-none` wrapper lets clicks fall through everywhere except the bar.
|
|
26
28
|
*/
|
|
27
29
|
export function FloatingActionBar(props: FloatingActionBarProps) {
|
|
28
|
-
const
|
|
30
|
+
const loc = useLoticsLocale().floatingActionBar;
|
|
31
|
+
const { count, label, onClear, clearLabel = loc.clear, children } = props;
|
|
29
32
|
if (count <= 0) return null;
|
|
30
33
|
return (
|
|
31
34
|
<View pointerEvents="box-none" style={styles.wrap}>
|
package/src/locale.tsx
CHANGED
|
@@ -36,6 +36,9 @@ export interface LoticsLocale {
|
|
|
36
36
|
/** `FilterChip` (and `ColumnFilter`): the generic clear affordance, used when
|
|
37
37
|
* a call site doesn't pass a dimension-specific `clearLabel`. */
|
|
38
38
|
filterChip: { clear: string };
|
|
39
|
+
/** `FloatingActionBar`: the escape that drops the selection. The COUNT's noun is
|
|
40
|
+
* the call site's `label` (it names the rows), so only the escape lives here. */
|
|
41
|
+
floatingActionBar: { clear: string };
|
|
39
42
|
/** `FormField`: the "Optional" marker shown next to the label when `optional`. */
|
|
40
43
|
formField: { optional: string };
|
|
41
44
|
/** `Drawer`: the record prev/next + close controls (screen-reader names). */
|
|
@@ -107,6 +110,7 @@ export const en: LoticsLocale = {
|
|
|
107
110
|
datePicker: { today: "Today", now: "Now", clear: "Clear", done: "Done", openCalendar: "Open calendar", time: "Time", startTime: "Start time", endTime: "End time", addTime: "Add time", removeTime: "Remove time", year: "Year", month: "Month", day: "Day", hour: "Hour", minute: "Minute", dayPeriod: "AM/PM" },
|
|
108
111
|
calendar: { previousMonth: "Previous month", nextMonth: "Next month" },
|
|
109
112
|
filterChip: { clear: "Clear" },
|
|
113
|
+
floatingActionBar: { clear: "Clear" },
|
|
110
114
|
formField: { optional: "Optional" },
|
|
111
115
|
drawer: { previous: "Previous record", next: "Next record", close: "Close" },
|
|
112
116
|
inline: { saveError: "Couldn't save. Try again.", save: "Save", cancel: "Cancel" },
|
|
@@ -186,6 +190,7 @@ export const vi: LoticsLocale = {
|
|
|
186
190
|
datePicker: { today: "Hôm nay", now: "Bây giờ", clear: "Xóa", done: "Xong", openCalendar: "Mở lịch", time: "Giờ", startTime: "Giờ bắt đầu", endTime: "Giờ kết thúc", addTime: "Thêm giờ", removeTime: "Bỏ giờ", year: "Năm", month: "Tháng", day: "Ngày", hour: "Giờ", minute: "Phút", dayPeriod: "SA/CH" },
|
|
187
191
|
calendar: { previousMonth: "Tháng trước", nextMonth: "Tháng sau" },
|
|
188
192
|
filterChip: { clear: "Xóa" },
|
|
193
|
+
floatingActionBar: { clear: "Bỏ chọn" },
|
|
189
194
|
formField: { optional: "Tùy chọn" },
|
|
190
195
|
drawer: { previous: "Bản ghi trước", next: "Bản ghi sau", close: "Đóng" },
|
|
191
196
|
inline: { saveError: "Không lưu được. Thử lại.", save: "Lưu", cancel: "Hủy" },
|