@comitor/ui 3.0.0 → 3.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/README.md +5 -1
- package/dist/components/composite/confirm-dialog.js +56 -35
- package/dist/components/composite/confirm-dialog.js.map +1 -1
- package/dist/components/composite/search-filter-bar-constants.d.ts +3 -0
- package/dist/components/composite/search-filter-bar-constants.js.map +1 -1
- package/dist/components/composite/table-pagination-constants.d.ts +3 -1
- package/dist/components/composite/table-pagination-constants.js.map +1 -1
- package/dist/components/composite/table-pagination.js +10 -2
- package/dist/components/composite/table-pagination.js.map +1 -1
- package/dist/components/composite/text-utils.d.ts +4 -23
- package/dist/components/composite/text-utils.js +1 -11
- package/dist/components/composite/text-utils.js.map +1 -1
- package/dist/components/composite/toast.d.ts +2 -1
- package/dist/components/composite/toast.js +3 -9
- package/dist/components/composite/toast.js.map +1 -1
- package/dist/components/ui/action-bar.js +45 -1
- package/dist/components/ui/action-bar.js.map +1 -1
- package/dist/components/ui/banner.d.ts +8 -0
- package/dist/components/ui/banner.js +149 -35
- package/dist/components/ui/banner.js.map +1 -1
- package/dist/components/ui/circular-progress.js +10 -2
- package/dist/components/ui/circular-progress.js.map +1 -1
- package/dist/components/ui/kanban.js +9 -3
- package/dist/components/ui/kanban.js.map +1 -1
- package/dist/components/ui/key-value.js +70 -76
- package/dist/components/ui/key-value.js.map +1 -1
- package/dist/components/ui/mask-input-constants.d.ts +34 -2
- package/dist/components/ui/mask-input-constants.js +87 -76
- package/dist/components/ui/mask-input-constants.js.map +1 -1
- package/dist/components/ui/mask-input.d.ts +6 -5
- package/dist/components/ui/mask-input.js +23 -21
- package/dist/components/ui/mask-input.js.map +1 -1
- package/dist/components/ui/mention.d.ts +14 -2
- package/dist/components/ui/mention.js +33 -6
- package/dist/components/ui/mention.js.map +1 -1
- package/dist/components/ui/phone-input.d.ts +18 -8
- package/dist/components/ui/phone-input.js +125 -35
- package/dist/components/ui/phone-input.js.map +1 -1
- package/dist/components/ui/rating.js +4 -2
- package/dist/components/ui/rating.js.map +1 -1
- package/dist/components/ui/scroll-spy.js +46 -31
- package/dist/components/ui/scroll-spy.js.map +1 -1
- package/dist/components/ui/slider.d.ts +1 -1
- package/dist/components/ui/slider.js +15 -1
- package/dist/components/ui/slider.js.map +1 -1
- package/dist/components/ui/sonner.js +2 -0
- package/dist/components/ui/sonner.js.map +1 -1
- package/dist/components/ui/stepper.js +26 -3
- package/dist/components/ui/stepper.js.map +1 -1
- package/dist/components/ui/time-picker.d.ts +24 -4
- package/dist/components/ui/time-picker.js +425 -162
- package/dist/components/ui/time-picker.js.map +1 -1
- package/dist/components/ui/timeline.js +45 -9
- package/dist/components/ui/timeline.js.map +1 -1
- package/dist/components/ui/toggle-group.js +12 -1
- package/dist/components/ui/toggle-group.js.map +1 -1
- package/dist/components/ui/tour.js +3 -2
- package/dist/components/ui/tour.js.map +1 -1
- package/dist/data-grid/data-grid-cell-variants.js +4 -4
- package/dist/data-grid/data-grid-cell-variants.js.map +1 -1
- package/dist/data-grid/data-grid-cell-wrapper.d.ts +1 -1
- package/dist/data-grid/data-grid-cell-wrapper.js +6 -0
- package/dist/data-grid/data-grid-cell-wrapper.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-select-column.js +6 -2
- package/dist/data-grid/data-grid-select-column.js.map +1 -1
- package/dist/data-grid/data-grid-skeleton.d.ts +5 -0
- package/dist/data-grid/data-grid-skeleton.js +1 -4
- package/dist/data-grid/data-grid-skeleton.js.map +1 -1
- package/dist/data-grid/data-grid.d.ts +1 -1
- package/dist/data-grid/data-grid.js +3 -2
- package/dist/data-grid/data-grid.js.map +1 -1
- package/dist/data-grid/filters.js +3 -2
- package/dist/data-grid/filters.js.map +1 -1
- package/dist/data-grid/types.d.ts +7 -0
- package/dist/data-grid/use-data-grid.d.ts +1 -0
- package/dist/data-grid/use-data-grid.js +70 -24
- package/dist/data-grid/use-data-grid.js.map +1 -1
- package/dist/data-grid/utils.d.ts +7 -0
- package/dist/data-grid/utils.js +3 -1
- package/dist/data-grid/utils.js.map +1 -1
- package/dist/i18n/locale-provider.d.ts +18 -0
- package/dist/i18n/locale-provider.js.map +1 -1
- package/dist/i18n/namespaces/rating.js +2 -1
- package/dist/i18n/namespaces/rating.js.map +1 -1
- package/dist/i18n/namespaces/search-filter-bar.js +8 -6
- package/dist/i18n/namespaces/search-filter-bar.js.map +1 -1
- package/dist/i18n/namespaces/shell.d.ts +4 -0
- package/dist/i18n/namespaces/shell.js +1 -1
- package/dist/i18n/namespaces/shell.js.map +1 -1
- package/dist/i18n/namespaces/table-pagination.js +6 -4
- package/dist/i18n/namespaces/table-pagination.js.map +1 -1
- package/dist/i18n/namespaces/toast.d.ts +3 -2
- package/dist/i18n/namespaces/toast.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/lib/collect-item-elements.d.ts +47 -0
- package/dist/lib/collect-item-elements.js +22 -0
- package/dist/lib/collect-item-elements.js.map +1 -0
- package/dist/lib/text-search.d.ts +32 -0
- package/dist/lib/text-search.js +17 -0
- package/dist/lib/text-search.js.map +1 -0
- package/dist/lib/toast-language.d.ts +8 -0
- package/dist/lib/toast-language.js +19 -0
- package/dist/lib/toast-language.js.map +1 -0
- package/dist/shell/app-shell.d.ts +1 -0
- package/dist/shell/index.d.ts +2 -1
- package/dist/shell/shell-context.d.ts +1 -0
- package/dist/shell/utils.d.ts +2 -1
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/lib/text-search.ts"],"sourcesContent":["/**\n * Tìm kiếm KHÔNG DẤU dùng chung cho mọi tầng — thuần, không import gì, không phụ thuộc React.\n *\n * Chuyển từ `components/composite/text-utils.ts` sang đây ở `3.1.0` (tên và chữ ký giữ nguyên, Tier 2\n * vẫn xuất lại qua đúng file đó): từ bản này primitive Tier 1 cũng cần CHÍNH luật này — `Mention` lọc\n * tên người theo `matchesSearch` — mà Tier 1 không được nhập ngược lên Tier 2. Một bản chép riêng là\n * hai luật sẽ lệch nhau (CLAUDE.md, \"Kiến trúc 3 tầng\").\n */\n\n/**\n * Bỏ dấu tiếng Việt để so khớp tìm kiếm (\"Nguyễn\" ⇄ \"nguyen\").\n *\n * Dùng NFD tách dấu thành ký tự tổ hợp rồi loại dải U+0300–U+036F. `đ/Đ` KHÔNG phải chữ có dấu\n * tổ hợp (là ký tự riêng trong Unicode) nên phải thay tay — thiếu bước này thì gõ \"duc\" sẽ không\n * ra \"Đức\".\n */\nexport function removeVietnameseTones(input: string): string {\n return input\n .normalize(\"NFD\")\n .replace(/[\\u0300-\\u036f]/g, \"\")\n .replace(/đ/g, \"d\")\n .replace(/Đ/g, \"D\");\n}\n\n/**\n * Chuẩn hoá chuỗi để so khớp: bỏ dấu + hạ chữ thường + `trim`.\n *\n * Đây là phép chuẩn hoá DUY NHẤT của cả gói (tầng shell cũng gọi lại hàm này, không giữ bản\n * riêng) — mỗi nơi tự chuẩn hoá một kiểu là cùng một từ khoá ra hai kết quả tìm kiếm khác nhau.\n * `removeVietnameseTones` ở trên là bậc thấp hơn, chỉ bỏ dấu, dùng khi cần giữ nguyên hoa/thường\n * (vd sinh slug).\n */\nexport function normalizeVi(value: string): string {\n return removeVietnameseTones(value).toLowerCase().trim();\n}\n\n/**\n * So khớp không dấu, không phân biệt hoa thường: `needle` có nằm trong `haystack` không.\n * Cả hai vế đi qua `normalizeVi` — cùng một luật với ô tìm kiếm của shell.\n */\nexport function matchesSearch(haystack: string, needle: string): boolean {\n const query = normalizeVi(needle);\n if (!query) return true;\n return normalizeVi(haystack).includes(query);\n}\n"],"mappings":"AAgBO,SAAS,sBAAsB,OAAuB;AAC3D,SAAO,MACJ,UAAU,KAAK,EACf,QAAQ,oBAAoB,EAAE,EAC9B,QAAQ,MAAM,GAAG,EACjB,QAAQ,MAAM,GAAG;AACtB;AAUO,SAAS,YAAY,OAAuB;AACjD,SAAO,sBAAsB,KAAK,EAAE,YAAY,EAAE,KAAK;AACzD;AAMO,SAAS,cAAc,UAAkB,QAAyB;AACvE,QAAM,QAAQ,YAAY,MAAM;AAChC,MAAI,CAAC,MAAO,QAAO;AACnB,SAAO,YAAY,QAAQ,EAAE,SAAS,KAAK;AAC7C;","names":[]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ToastMessages } from '../i18n/namespaces/toast.js';
|
|
2
|
+
|
|
3
|
+
/** Bảng chữ `toast` của toaster đang gắn trên trang (tiếng Anh khi chưa có toaster nào). */
|
|
4
|
+
declare function getActiveToastMessages(): ToastMessages;
|
|
5
|
+
/** Gọi trong MỌI toaster: ghi bảng chữ của provider gần nhất cho `toastPromise` đọc. */
|
|
6
|
+
declare function useToastLanguageBridge(): void;
|
|
7
|
+
|
|
8
|
+
export { getActiveToastMessages, useToastLanguageBridge };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useComitorMessages } from "../i18n/locale-provider.js";
|
|
3
|
+
import { toastEn } from "../i18n/namespaces/toast.js";
|
|
4
|
+
import { useIsomorphicLayoutEffect } from "./use-isomorphic-layout-effect.js";
|
|
5
|
+
let activeToastMessages = toastEn;
|
|
6
|
+
function getActiveToastMessages() {
|
|
7
|
+
return activeToastMessages;
|
|
8
|
+
}
|
|
9
|
+
function useToastLanguageBridge() {
|
|
10
|
+
const toastMessages = useComitorMessages("toast");
|
|
11
|
+
useIsomorphicLayoutEffect(() => {
|
|
12
|
+
activeToastMessages = toastMessages;
|
|
13
|
+
}, [toastMessages]);
|
|
14
|
+
}
|
|
15
|
+
export {
|
|
16
|
+
getActiveToastMessages,
|
|
17
|
+
useToastLanguageBridge
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=toast-language.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/lib/toast-language.ts"],"sourcesContent":["\"use client\";\n\nimport { useComitorMessages } from \"../i18n/locale-provider.js\";\nimport { toastEn } from \"../i18n/namespaces/toast.js\";\nimport { useIsomorphicLayoutEffect } from \"./use-isomorphic-layout-effect.js\";\n\n/**\n * Cầu NGÔN NGỮ cho `toastPromise` — nội bộ, không nằm trong barrel nào.\n *\n * `toastPromise` là hàm thường gọi từ event handler: ngoài lượt render, không gọi được hook, nên\n * không đọc được `ComitorLocaleProvider`. Toaster thì LUÔN nằm trong cây React (đặt một lần ở gốc,\n * bên trong provider): nó ghi bảng chữ hiện hành vào đây mỗi khi ngôn ngữ đổi, và `toastPromise`\n * đọc từ đây. Không có toaster thì cũng không có toast nào hiện ra, nên chữ rơi về tiếng Anh\n * cũng không ai thấy.\n *\n * ⚠ Vì sao tách khỏi `composite/toast.tsx` (3.0.1): ở `3.0.0` biến này nằm trong file đó và chỉ\n * `Toaster` của entry `.` ghi vào — `SonnerToaster` của `/shell` thì không, nên app dùng shell\n * (đúng cách tài liệu khuyên cho app Next) có `toastPromise` nói tiếng Anh giữa màn hình tiếng Việt\n * dù đã đặt provider. Hai toaster nay gọi cùng `useToastLanguageBridge()`. Không để hook ấy ở\n * `toast.tsx`: file đó được barrel `export *`, và hook sẽ thành API công khai ngoài ý muốn.\n */\nlet activeToastMessages = toastEn;\n\n/** Bảng chữ `toast` của toaster đang gắn trên trang (tiếng Anh khi chưa có toaster nào). */\nexport function getActiveToastMessages() {\n return activeToastMessages;\n}\n\n/** Gọi trong MỌI toaster: ghi bảng chữ của provider gần nhất cho `toastPromise` đọc. */\nexport function useToastLanguageBridge() {\n const toastMessages = useComitorMessages(\"toast\");\n useIsomorphicLayoutEffect(() => {\n activeToastMessages = toastMessages;\n }, [toastMessages]);\n}\n"],"mappings":";AAEA,SAAS,0BAA0B;AACnC,SAAS,eAAe;AACxB,SAAS,iCAAiC;AAiB1C,IAAI,sBAAsB;AAGnB,SAAS,yBAAyB;AACvC,SAAO;AACT;AAGO,SAAS,yBAAyB;AACvC,QAAM,gBAAgB,mBAAmB,OAAO;AAChD,4BAA0B,MAAM;AAC9B,0BAAsB;AAAA,EACxB,GAAG,CAAC,aAAa,CAAC;AACpB;","names":[]}
|
|
@@ -9,6 +9,7 @@ import './types.js';
|
|
|
9
9
|
import 'lucide-react';
|
|
10
10
|
import './utils.js';
|
|
11
11
|
import '../components/composite/text-utils.js';
|
|
12
|
+
import '../lib/text-search.js';
|
|
12
13
|
|
|
13
14
|
type AppShellLayout = "sidebar-first" | "header-first";
|
|
14
15
|
interface AppShellProps extends ShellProviderProps {
|
package/dist/shell/index.d.ts
CHANGED
|
@@ -23,7 +23,8 @@ export { AppDescriptor, DEFAULT_SHELL_LABELS, NavBadgeVariant, NavGroup, NavItem
|
|
|
23
23
|
export { UserAvatar, UserAvatarProps, UserMenu, UserMenuProps } from './user-menu.js';
|
|
24
24
|
export { NavSearchParams, appAccentStyle, flattenNavItems, getEntitledApps, getLockedApps, isNavBranchActive, isNavItemActive, resolveCurrentApp, toNavGroups, toSearchParams } from './utils.js';
|
|
25
25
|
export { WorkspaceSwitcher, WorkspaceSwitcherProps } from './workspace-switcher.js';
|
|
26
|
-
export { getVietnameseInitials
|
|
26
|
+
export { getVietnameseInitials } from '../components/composite/text-utils.js';
|
|
27
|
+
export { normalizeVi } from '../lib/text-search.js';
|
|
27
28
|
import 'react';
|
|
28
29
|
import 'sonner';
|
|
29
30
|
import 'next-themes';
|
|
@@ -4,6 +4,7 @@ import { Workspace, AppDescriptor, ShellNav, ShellLinkComponent, ShellUser, Shel
|
|
|
4
4
|
import { NavSearchParams } from './utils.js';
|
|
5
5
|
import 'lucide-react';
|
|
6
6
|
import '../components/composite/text-utils.js';
|
|
7
|
+
import '../lib/text-search.js';
|
|
7
8
|
|
|
8
9
|
interface ShellContextValue {
|
|
9
10
|
workspaces: Workspace[];
|
package/dist/shell/utils.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { CSSProperties } from 'react';
|
|
2
2
|
import { AppDescriptor, NavGroup, NavItem, ShellNav } from './types.js';
|
|
3
|
-
export { getVietnameseInitials
|
|
3
|
+
export { getVietnameseInitials } from '../components/composite/text-utils.js';
|
|
4
|
+
export { normalizeVi } from '../lib/text-search.js';
|
|
4
5
|
import 'lucide-react';
|
|
5
6
|
|
|
6
7
|
/**
|
package/package.json
CHANGED