@comitor/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.
- package/LICENSE +35 -0
- package/README.md +14 -6
- package/dist/components/ui/action-bar-constants.d.ts +31 -0
- package/dist/components/ui/action-bar-constants.js +9 -0
- package/dist/components/ui/action-bar-constants.js.map +1 -0
- package/dist/components/ui/action-bar.d.ts +67 -0
- package/dist/components/ui/action-bar.js +522 -0
- package/dist/components/ui/action-bar.js.map +1 -0
- package/dist/components/ui/badge-overflow.d.ts +30 -0
- package/dist/components/ui/badge-overflow.js +179 -0
- package/dist/components/ui/badge-overflow.js.map +1 -0
- package/dist/components/ui/banner.d.ts +79 -0
- package/dist/components/ui/banner.js +518 -0
- package/dist/components/ui/banner.js.map +1 -0
- package/dist/components/ui/circular-progress.d.ts +50 -0
- package/dist/components/ui/circular-progress.js +266 -0
- package/dist/components/ui/circular-progress.js.map +1 -0
- package/dist/components/ui/cropper-constants.d.ts +34 -0
- package/dist/components/ui/cropper-constants.js +10 -0
- package/dist/components/ui/cropper-constants.js.map +1 -0
- package/dist/components/ui/cropper.d.ts +106 -0
- package/dist/components/ui/cropper.js +1269 -0
- package/dist/components/ui/cropper.js.map +1 -0
- package/dist/components/ui/drawer.d.ts +1 -1
- package/dist/components/ui/drawer.js +2 -2
- package/dist/components/ui/drawer.js.map +1 -1
- package/dist/components/ui/kanban-constants.d.ts +61 -0
- package/dist/components/ui/kanban-constants.js +21 -0
- package/dist/components/ui/kanban-constants.js.map +1 -0
- package/dist/components/ui/kanban.d.ts +72 -0
- package/dist/components/ui/kanban.js +787 -0
- package/dist/components/ui/kanban.js.map +1 -0
- package/dist/components/ui/key-value-constants.d.ts +33 -0
- package/dist/components/ui/key-value-constants.js +11 -0
- package/dist/components/ui/key-value-constants.js.map +1 -0
- package/dist/components/ui/key-value.d.ts +96 -0
- package/dist/components/ui/key-value.js +641 -0
- package/dist/components/ui/key-value.js.map +1 -0
- package/dist/components/ui/mask-input-constants.d.ts +99 -0
- package/dist/components/ui/mask-input-constants.js +601 -0
- package/dist/components/ui/mask-input-constants.js.map +1 -0
- package/dist/components/ui/mask-input.d.ts +36 -0
- package/dist/components/ui/mask-input.js +558 -0
- package/dist/components/ui/mask-input.js.map +1 -0
- package/dist/components/ui/mention.d.ts +31 -0
- package/dist/components/ui/mention.js +128 -0
- package/dist/components/ui/mention.js.map +1 -0
- package/dist/components/ui/phone-input-constants.d.ts +54 -0
- package/dist/components/ui/phone-input-constants.js +9 -0
- package/dist/components/ui/phone-input-constants.js.map +1 -0
- package/dist/components/ui/phone-input.d.ts +85 -0
- package/dist/components/ui/phone-input.js +743 -0
- package/dist/components/ui/phone-input.js.map +1 -0
- package/dist/components/ui/rating.d.ts +56 -0
- package/dist/components/ui/rating.js +646 -0
- package/dist/components/ui/rating.js.map +1 -0
- package/dist/components/ui/responsive-dialog.d.ts +35 -0
- package/dist/components/ui/responsive-dialog.js +193 -0
- package/dist/components/ui/responsive-dialog.js.map +1 -0
- package/dist/components/ui/scroll-spy.d.ts +42 -0
- package/dist/components/ui/scroll-spy.js +334 -0
- package/dist/components/ui/scroll-spy.js.map +1 -0
- package/dist/components/ui/stepper-constants.d.ts +29 -0
- package/dist/components/ui/stepper-constants.js +9 -0
- package/dist/components/ui/stepper-constants.js.map +1 -0
- package/dist/components/ui/stepper.d.ts +80 -0
- package/dist/components/ui/stepper.js +902 -0
- package/dist/components/ui/stepper.js.map +1 -0
- package/dist/components/ui/tags-input.d.ts +41 -0
- package/dist/components/ui/tags-input.js +127 -0
- package/dist/components/ui/tags-input.js.map +1 -0
- package/dist/components/ui/time-picker-constants.d.ts +48 -0
- package/dist/components/ui/time-picker-constants.js +14 -0
- package/dist/components/ui/time-picker-constants.js.map +1 -0
- package/dist/components/ui/time-picker.d.ts +115 -0
- package/dist/components/ui/time-picker.js +1620 -0
- package/dist/components/ui/time-picker.js.map +1 -0
- package/dist/components/ui/timeline.d.ts +32 -0
- package/dist/components/ui/timeline.js +559 -0
- package/dist/components/ui/timeline.js.map +1 -0
- package/dist/components/ui/tour-constants.d.ts +39 -0
- package/dist/components/ui/tour-constants.js +12 -0
- package/dist/components/ui/tour-constants.js.map +1 -0
- package/dist/components/ui/tour.d.ts +124 -0
- package/dist/components/ui/tour.js +1207 -0
- package/dist/components/ui/tour.js.map +1 -0
- package/dist/data-grid/data-grid-cell-wrapper.js +1 -1
- package/dist/data-grid/data-grid-cell-wrapper.js.map +1 -1
- package/dist/data-grid/data-grid-context-menu.js +1 -1
- package/dist/data-grid/data-grid-context-menu.js.map +1 -1
- package/dist/data-grid/data-grid-paste-dialog.js +1 -1
- package/dist/data-grid/data-grid-paste-dialog.js.map +1 -1
- package/dist/data-grid/data-grid-row.js +1 -1
- package/dist/data-grid/data-grid-row.js.map +1 -1
- package/dist/data-grid/data-grid-search.js +1 -1
- package/dist/data-grid/data-grid-search.js.map +1 -1
- package/dist/data-grid/data-grid.js +1 -1
- package/dist/data-grid/data-grid.js.map +1 -1
- package/dist/data-grid/sortable.js +1 -1
- package/dist/data-grid/sortable.js.map +1 -1
- package/dist/data-grid/use-data-grid-undo-redo.js +2 -2
- package/dist/data-grid/use-data-grid-undo-redo.js.map +1 -1
- package/dist/data-grid/use-data-grid.js +3 -3
- package/dist/data-grid/use-data-grid.js.map +1 -1
- package/dist/index.d.ts +31 -0
- package/dist/index.js +42 -0
- package/dist/index.js.map +1 -1
- package/dist/lib/compose-refs.js.map +1 -0
- package/dist/lib/use-as-ref.js.map +1 -0
- package/dist/lib/use-is-mobile.d.ts +10 -0
- package/dist/lib/use-is-mobile.js +21 -0
- package/dist/lib/use-is-mobile.js.map +1 -0
- package/dist/lib/use-isomorphic-layout-effect.js.map +1 -0
- package/dist/lib/use-lazy-ref.js.map +1 -0
- package/dist/lib/visually-hidden-input.d.ts +12 -0
- package/dist/lib/visually-hidden-input.js +105 -0
- package/dist/lib/visually-hidden-input.js.map +1 -0
- package/package.json +5 -1
- package/styles.css +19 -0
- package/dist/data-grid/compose-refs.js.map +0 -1
- package/dist/data-grid/use-as-ref.js.map +0 -1
- package/dist/data-grid/use-isomorphic-layout-effect.js.map +0 -1
- package/dist/data-grid/use-lazy-ref.js.map +0 -1
- /package/dist/{data-grid → lib}/compose-refs.d.ts +0 -0
- /package/dist/{data-grid → lib}/compose-refs.js +0 -0
- /package/dist/{data-grid → lib}/use-as-ref.d.ts +0 -0
- /package/dist/{data-grid → lib}/use-as-ref.js +0 -0
- /package/dist/{data-grid → lib}/use-isomorphic-layout-effect.d.ts +0 -0
- /package/dist/{data-grid → lib}/use-isomorphic-layout-effect.js +0 -0
- /package/dist/{data-grid → lib}/use-lazy-ref.d.ts +0 -0
- /package/dist/{data-grid → lib}/use-lazy-ref.js +0 -0
package/LICENSE
CHANGED
|
@@ -19,3 +19,38 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
19
19
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
20
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
21
|
SOFTWARE.
|
|
22
|
+
|
|
23
|
+
--------------------------------------------------------------------------------
|
|
24
|
+
|
|
25
|
+
THIRD-PARTY NOTICES
|
|
26
|
+
|
|
27
|
+
Portions of this package are derived from the following MIT-licensed works:
|
|
28
|
+
|
|
29
|
+
- tablecn (https://github.com/sadmann7/tablecn) — the `data-grid` entry.
|
|
30
|
+
- Dice UI (https://github.com/sadmann7/diceui) — ActionBar, BadgeOverflow, Banner,
|
|
31
|
+
CircularProgress, Cropper, Kanban, KeyValue, MaskInput, Mention, PhoneInput,
|
|
32
|
+
Rating, ResponsiveDialog, ScrollSpy, Stepper, TagsInput, TimePicker, Timeline,
|
|
33
|
+
Tour, and the shared helpers in `lib/` (compose-refs, use-as-ref,
|
|
34
|
+
use-isomorphic-layout-effect, use-lazy-ref, visually-hidden-input).
|
|
35
|
+
|
|
36
|
+
MIT License
|
|
37
|
+
|
|
38
|
+
Copyright (c) 2024 Sadman Sakib
|
|
39
|
+
|
|
40
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
41
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
42
|
+
in the Software without restriction, including without limitation the rights
|
|
43
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
44
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
45
|
+
furnished to do so, subject to the following conditions:
|
|
46
|
+
|
|
47
|
+
The above copyright notice and this permission notice shall be included in all
|
|
48
|
+
copies or substantial portions of the Software.
|
|
49
|
+
|
|
50
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
51
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
52
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
53
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
54
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
55
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
56
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -8,8 +8,10 @@ component ghép sẵn và khung ứng dụng (shell) kiểu workspace × app.
|
|
|
8
8
|
- Token brand nằm ở **`styles.css`** — đổi token, bump version, mọi app nhận cùng một thay đổi.
|
|
9
9
|
- Server-component-friendly: `"use client"` chỉ nằm ở file thật sự cần.
|
|
10
10
|
|
|
11
|
-
> Trạng thái: `1.
|
|
12
|
-
> (
|
|
11
|
+
> Trạng thái: `2.1.0` — 79 file primitive (Tier 1, gồm 18 component port từ
|
|
12
|
+
> [Dice UI](docs/diceui.md)) · 32 file composite (Tier 2) · 25 file shell (Tier 3) · 4 file chart ·
|
|
13
|
+
> 32 file data-grid · 5 file uploader. API chốt từ `1.0.0`. (Đếm bằng `ls src/<tầng>`; con số trôi
|
|
14
|
+
> theo mỗi bản — đếm lại, đừng chép.)
|
|
13
15
|
>
|
|
14
16
|
> Tài liệu đầy đủ: **https://design-system.comitor.ai** —
|
|
15
17
|
> [Get started](https://design-system.comitor.ai/get-started) ·
|
|
@@ -157,21 +159,21 @@ và prop chỉ còn nghĩa "không hoạt hình". https://design-system.comitor.
|
|
|
157
159
|
Ranh giới server/client là cạm bẫy cùng họ, và hỏng theo **hai kiểu ngược nhau**: 7 helper dựng chuỗi
|
|
158
160
|
class (`buttonVariants`, `toggleVariants`…) gọi từ Server Component thì **ném lỗi to**, còn một hằng
|
|
159
161
|
dữ liệu lọt vào sau file `"use client"` thì ra `undefined` — **không throw, không warning** — trong
|
|
160
|
-
khi TypeScript vẫn khai kiểu literal. Danh sách đầy
|
|
162
|
+
khi TypeScript vẫn khai kiểu literal. Danh sách đầy đủ, ai gọi được ai không:
|
|
161
163
|
https://design-system.comitor.ai/foundations/server-client
|
|
162
164
|
|
|
163
165
|
## 5. Bảng component
|
|
164
166
|
|
|
165
|
-
Số file nguồn hiện tại: **
|
|
167
|
+
Số file nguồn hiện tại: **79 primitive · 32 composite · 25 shell · 4 chart · 32 data-grid · 5 uploader**. Mỗi component có trang
|
|
166
168
|
riêng kèm demo, bảng prop và cạm bẫy của nó:
|
|
167
169
|
|
|
168
170
|
| Tầng | Là gì | Trang |
|
|
169
171
|
|---|---|---|
|
|
170
|
-
| **Tier 1 — primitive** ·
|
|
172
|
+
| **Tier 1 — primitive** · 79 file · `@comitor/ui` | shadcn/ui style `new-york`, đã tùy biến token theo brand Comitor — cộng 18 component port từ Dice UI ở `2.1.0`: `Kanban`, `Stepper`, `Timeline`, `TimePicker`, `TagsInput`, `Mention`, `ActionBar`, `PhoneInput`, `MaskInput`, `Rating`, `CircularProgress`, `Banner`, `ResponsiveDialog`, `Tour`, `KeyValue`, `Cropper`, `ScrollSpy`, `BadgeOverflow` | https://design-system.comitor.ai/components · vì sao chọn chúng, và mọi chỗ đã đổi so với thượng nguồn: [docs/diceui.md](docs/diceui.md) |
|
|
171
173
|
| **Tier 2 — composite** · 31 file · `@comitor/ui` | Giá trị thật của gói: pattern lặp ở mọi app, ghép từ nhiều primitive (`DataTable`, `PageHeader`, `Combobox`, `DatePicker`, `StatCard`…) | https://design-system.comitor.ai/composites |
|
|
172
174
|
| **Tier 3 — shell** · 25 file · `@comitor/ui/shell` | Khung ứng dụng workspace × app: sidebar, header, theme, ba trục hiển thị (tương phản · mật độ · cỡ chữ) | https://design-system.comitor.ai/shell |
|
|
173
175
|
| **chart** · 4 file · `@comitor/ui/chart` | Lớp shadcn bọc recharts, cùng ba bản dựng sẵn theo brand. ⚠ Ba wrapper `Comitor*Chart` **mặc định TẮT** hiệu ứng vẽ dần (`isAnimationActive = false`) — bật lại là biểu đồ kẹt ở khung đầu: có trục, có lưới, KHÔNG có dữ liệu. Mặc định đó KHÔNG áp cho `<ChartContainer>` + recharts do app tự lắp | https://design-system.comitor.ai/components/chart |
|
|
174
|
-
| **data-grid** ·
|
|
176
|
+
| **data-grid** · 32 file · `@comitor/ui/data-grid` | `DataGrid` — lưới sửa trực tiếp kiểu bảng tính, cho màn nhập liệu hàng loạt. Port từ [tablecn](https://www.tablecn.com/data-grid) (MIT) sang primitive + token của gói. ⚠ Là tầng DUY NHẤT có peer **`@tanstack/react-table`**, tầng duy nhất mặc định **tiếng Anh** (prop `locale`, xem dưới), và mọi thứ trong nó là client component | [docs/data-grid.md](docs/data-grid.md) |
|
|
175
177
|
| **uploader** · 5 file · `@comitor/ui/uploader` | `FileUpload` (tệp) · `ImageUploadField` (ảnh) · `useFileUpload` — kéo thả, xem trước, tiến độ. Peer optional: `@uppy/core` + `@uppy/xhr-upload` | https://design-system.comitor.ai/components |
|
|
176
178
|
| **form** · `@comitor/ui/form` | Binding shadcn ⇄ react-hook-form | https://design-system.comitor.ai/components/form |
|
|
177
179
|
|
|
@@ -280,3 +282,9 @@ https://design-system.comitor.ai/foundations/colors
|
|
|
280
282
|
## 8. Giấy phép
|
|
281
283
|
|
|
282
284
|
MIT © Comitor
|
|
285
|
+
|
|
286
|
+
Hai phần được port từ mã nguồn MIT của **Sadman Sakib** (© 2024), giữ nguyên điều kiện của giấy
|
|
287
|
+
phép gốc — toàn văn thông báo bản quyền nằm cuối [LICENSE](LICENSE):
|
|
288
|
+
|
|
289
|
+
- `@comitor/ui/data-grid` — từ [tablecn](https://tablecn.com) ([docs/data-grid.md](docs/data-grid.md));
|
|
290
|
+
- 18 component Tier 1 của `2.1.0` — từ [Dice UI](https://diceui.com) ([docs/diceui.md](docs/diceui.md)).
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Nhãn mặc định của `ActionBar`.
|
|
3
|
+
*
|
|
4
|
+
* Module **CỐ Ý không có `"use client"`** — xem `src/chart/chart-colors.ts` để biết lý do đầy đủ:
|
|
5
|
+
* mọi export của một file `"use client"` đến tay Server Component dưới dạng client-reference
|
|
6
|
+
* proxy, đọc ra `undefined` mà KHÔNG throw, KHÔNG warning.
|
|
7
|
+
*
|
|
8
|
+
* ⚠ Barrel `src/index.ts` xuất module này TRỰC TIẾP. `action-bar.tsx` chỉ được `import`, KHÔNG
|
|
9
|
+
* được `export` lại (re-export qua file client là vô hiệu, và đụng tên với `export *`).
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Toàn bộ chuỗi hiển thị và chuỗi a11y của `ActionBar` — truyền một phần qua prop `labels` của
|
|
13
|
+
* `ActionBar`, phần còn lại lấy từ `DEFAULT_ACTION_BAR_LABELS`.
|
|
14
|
+
*
|
|
15
|
+
* Khoá có số chèn vào là HÀM: nối chuỗi ở phía app là cách chắc chắn sai trật tự từ ở ngôn ngữ khác.
|
|
16
|
+
*/
|
|
17
|
+
interface ActionBarLabels {
|
|
18
|
+
/** `aria-label` của thanh (`role="toolbar"`) — prop `aria-label` của `ActionBar` vẫn thắng. */
|
|
19
|
+
toolbar: string;
|
|
20
|
+
/** Dòng đếm `ActionBarSelection` hiện khi có prop `count`: "Đã chọn 3". */
|
|
21
|
+
selected: (count: number) => string;
|
|
22
|
+
/**
|
|
23
|
+
* Tên cho trình đọc màn hình của `ActionBarClose` — nút chỉ có icon X. Đóng thanh ở khuôn dùng
|
|
24
|
+
* chuẩn là BỎ CHỌN (app xoá vùng chọn trong `onOpenChange(false)`), nên tên nói đúng việc đó.
|
|
25
|
+
*/
|
|
26
|
+
close: string;
|
|
27
|
+
}
|
|
28
|
+
/** Nhãn tiếng Việt mặc định — mọi khoá đều override được qua prop `labels`. */
|
|
29
|
+
declare const DEFAULT_ACTION_BAR_LABELS: ActionBarLabels;
|
|
30
|
+
|
|
31
|
+
export { type ActionBarLabels, DEFAULT_ACTION_BAR_LABELS };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
const DEFAULT_ACTION_BAR_LABELS = {
|
|
2
|
+
toolbar: "Thao t\xE1c h\xE0ng lo\u1EA1t",
|
|
3
|
+
selected: (count) => `\u0110\xE3 ch\u1ECDn ${count}`,
|
|
4
|
+
close: "B\u1ECF ch\u1ECDn"
|
|
5
|
+
};
|
|
6
|
+
export {
|
|
7
|
+
DEFAULT_ACTION_BAR_LABELS
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=action-bar-constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/ui/action-bar-constants.ts"],"sourcesContent":["/**\n * Nhãn mặc định của `ActionBar`.\n *\n * Module **CỐ Ý không có `\"use client\"`** — xem `src/chart/chart-colors.ts` để biết lý do đầy đủ:\n * mọi export của một file `\"use client\"` đến tay Server Component dưới dạng client-reference\n * proxy, đọc ra `undefined` mà KHÔNG throw, KHÔNG warning.\n *\n * ⚠ Barrel `src/index.ts` xuất module này TRỰC TIẾP. `action-bar.tsx` chỉ được `import`, KHÔNG\n * được `export` lại (re-export qua file client là vô hiệu, và đụng tên với `export *`).\n */\n\n/**\n * Toàn bộ chuỗi hiển thị và chuỗi a11y của `ActionBar` — truyền một phần qua prop `labels` của\n * `ActionBar`, phần còn lại lấy từ `DEFAULT_ACTION_BAR_LABELS`.\n *\n * Khoá có số chèn vào là HÀM: nối chuỗi ở phía app là cách chắc chắn sai trật tự từ ở ngôn ngữ khác.\n */\nexport interface ActionBarLabels {\n /** `aria-label` của thanh (`role=\"toolbar\"`) — prop `aria-label` của `ActionBar` vẫn thắng. */\n toolbar: string;\n /** Dòng đếm `ActionBarSelection` hiện khi có prop `count`: \"Đã chọn 3\". */\n selected: (count: number) => string;\n /**\n * Tên cho trình đọc màn hình của `ActionBarClose` — nút chỉ có icon X. Đóng thanh ở khuôn dùng\n * chuẩn là BỎ CHỌN (app xoá vùng chọn trong `onOpenChange(false)`), nên tên nói đúng việc đó.\n */\n close: string;\n}\n\n/** Nhãn tiếng Việt mặc định — mọi khoá đều override được qua prop `labels`. */\nexport const DEFAULT_ACTION_BAR_LABELS: ActionBarLabels = {\n toolbar: \"Thao tác hàng loạt\",\n selected: (count) => `Đã chọn ${count}`,\n close: \"Bỏ chọn\"\n};\n"],"mappings":"AA8BO,MAAM,4BAA6C;AAAA,EACxD,SAAS;AAAA,EACT,UAAU,CAAC,UAAU,wBAAW,KAAK;AAAA,EACrC,OAAO;AACT;","names":[]}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { ActionBarLabels } from './action-bar-constants.js';
|
|
3
|
+
import { Button } from './button.js';
|
|
4
|
+
import 'class-variance-authority/types';
|
|
5
|
+
import 'class-variance-authority';
|
|
6
|
+
|
|
7
|
+
type Direction = "ltr" | "rtl";
|
|
8
|
+
type Orientation = "horizontal" | "vertical";
|
|
9
|
+
interface DivProps extends React.ComponentProps<"div"> {
|
|
10
|
+
asChild?: boolean;
|
|
11
|
+
}
|
|
12
|
+
interface ActionBarProps extends DivProps {
|
|
13
|
+
open?: boolean;
|
|
14
|
+
onOpenChange?: (open: boolean) => void;
|
|
15
|
+
onEscapeKeyDown?: (event: KeyboardEvent) => void;
|
|
16
|
+
align?: "start" | "center" | "end";
|
|
17
|
+
alignOffset?: number;
|
|
18
|
+
side?: "top" | "bottom";
|
|
19
|
+
sideOffset?: number;
|
|
20
|
+
portalContainer?: Element | DocumentFragment | null;
|
|
21
|
+
dir?: Direction;
|
|
22
|
+
orientation?: Orientation;
|
|
23
|
+
loop?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Chuỗi hiển thị và chuỗi a11y (tên thanh, dòng "Đã chọn N", tên nút đóng) — mặc định
|
|
26
|
+
* `DEFAULT_ACTION_BAR_LABELS` (tiếng Việt); truyền một phần là đủ.
|
|
27
|
+
*
|
|
28
|
+
* ⚠ Thêm so với thượng nguồn: bản gốc không có chuỗi nào — thanh `role="toolbar"` không tên và
|
|
29
|
+
* nút đóng chỉ chứa `<X />` là một nút KHÔNG TÊN với trình đọc màn hình.
|
|
30
|
+
*/
|
|
31
|
+
labels?: Partial<ActionBarLabels>;
|
|
32
|
+
}
|
|
33
|
+
declare function ActionBar(props: ActionBarProps): React.JSX.Element | null;
|
|
34
|
+
interface ActionBarSelectionProps extends DivProps {
|
|
35
|
+
/**
|
|
36
|
+
* Số mục đang chọn. Có giá trị thì phần tử tự in `labels.selected(count)` ("Đã chọn 3") TRƯỚC
|
|
37
|
+
* `children` — nên `children` chỉ còn là dấu ngăn + nút đóng.
|
|
38
|
+
*
|
|
39
|
+
* ⚠ Thêm so với thượng nguồn: bản gốc để app tự viết chữ ("{n} selected"), tức chuỗi hiển thị
|
|
40
|
+
* không đi qua `labels`. Bỏ qua khi `asChild` (Slot chỉ nhận đúng MỘT phần tử con).
|
|
41
|
+
*/
|
|
42
|
+
count?: number;
|
|
43
|
+
}
|
|
44
|
+
declare function ActionBarSelection(props: ActionBarSelectionProps): React.JSX.Element;
|
|
45
|
+
declare function ActionBarGroup(props: DivProps): React.JSX.Element;
|
|
46
|
+
interface ActionBarItemProps extends Omit<React.ComponentProps<typeof Button>, "onSelect"> {
|
|
47
|
+
onSelect?: (event: Event) => void;
|
|
48
|
+
}
|
|
49
|
+
declare function ActionBarItem(props: ActionBarItemProps): React.JSX.Element;
|
|
50
|
+
interface ActionBarCloseProps extends React.ComponentProps<"button"> {
|
|
51
|
+
asChild?: boolean;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Nút đóng thanh (thường là "bỏ chọn"). Không truyền `children` thì vẽ icon X.
|
|
55
|
+
*
|
|
56
|
+
* ⚠ Khác thượng nguồn: có tên cho trình đọc màn hình — `aria-label` mặc định `labels.close`
|
|
57
|
+
* ("Bỏ chọn"). Bản gốc chỉ render `children`, và khuôn dùng của chính thượng nguồn là
|
|
58
|
+
* `<ActionBarClose><X /></ActionBarClose>`: một nút KHÔNG TÊN. Nếu `children` là CHỮ nhìn thấy
|
|
59
|
+
* được thì truyền `aria-label` trùng với chữ đó (WCAG 2.5.3), hoặc `aria-label={undefined}`.
|
|
60
|
+
*/
|
|
61
|
+
declare function ActionBarClose(props: ActionBarCloseProps): React.JSX.Element;
|
|
62
|
+
interface ActionBarSeparatorProps extends DivProps {
|
|
63
|
+
orientation?: Orientation;
|
|
64
|
+
}
|
|
65
|
+
declare function ActionBarSeparator(props: ActionBarSeparatorProps): React.JSX.Element;
|
|
66
|
+
|
|
67
|
+
export { ActionBar, ActionBarClose, type ActionBarCloseProps, ActionBarGroup, ActionBarItem, type ActionBarItemProps, type ActionBarProps, ActionBarSelection, type ActionBarSelectionProps, ActionBarSeparator, type ActionBarSeparatorProps };
|