@goplusvn/core 0.1.95 → 0.1.96

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/CHANGELOG.md CHANGED
@@ -1,3 +1,15 @@
1
+ ## 0.1.96 — Sửa lỗi Focus Trap khiến ô tìm kiếm Combobox/MultiSelect mất focus khi lồng trong Sheet/Dialog
2
+
3
+ Khi `Combobox` hoặc `MultiSelect` nằm trong `<Sheet>` (bộ lọc mobile) hoặc `<Dialog>`,
4
+ Radix Dialog's `FocusScope` bắt sự kiện tương tác trên Portal và giật focus ngược lại về trigger,
5
+ khiến ô input tìm kiếm bị blur ngay lập tức và không thể gõ được trên một số thiết bị/trình duyệt.
6
+
7
+ **Đổi**
8
+
9
+ - `ui/primitives/combobox.tsx` & `ui/forms/multi-select.tsx` — thêm `onFocusOutside={(e) => e.preventDefault()}`
10
+ trên `PopoverContent`, ngăn Dialog/Sheet cha cướp focus khỏi ô tìm kiếm; kích hoạt focus trực tiếp vào
11
+ `searchInputRef` khi mở panel.
12
+
1
13
  ## 0.1.95 — Triệt tiêu Hydration Mismatch trên AvatarFallback của UserDropdown
2
14
 
3
15
  Trong quá trình Server-Side Rendering (SSR), `useSafeAuthSession()` chưa có phiên đăng nhập
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@goplusvn/core",
3
3
  "description": "GoPlusVN Platform Kit - ERP kernel: layout, RBAC, CRUD, multi-tenant, system pages",
4
- "version": "0.1.95",
4
+ "version": "0.1.96",
5
5
  "private": false,
6
6
  "publishConfig": {
7
7
  "registry": "https://registry.npmjs.org",
@@ -724,16 +724,11 @@ export const MultiSelect = React.forwardRef<MultiSelectRef, MultiSelectProps>(
724
724
  collisionPadding={8}
725
725
  onOpenAutoFocus={(e) => {
726
726
  e.preventDefault();
727
- // Trên thiết bị cảm ứng / màn hình nhỏ, không ép mở bàn phím ảo để tránh che khuất danh sách
728
- const isTouchOrMobile =
729
- typeof window !== "undefined" &&
730
- ((typeof window.matchMedia === "function" &&
731
- window.matchMedia("(pointer: coarse)").matches) ||
732
- (typeof window.innerWidth === "number" &&
733
- window.innerWidth < 640));
734
- if (!isTouchOrMobile) {
735
- searchInputRef.current?.focus();
736
- }
727
+ searchInputRef.current?.focus();
728
+ }}
729
+ onFocusOutside={(e) => {
730
+ // Ngăn Dialog / Sheet cha giật focus khỏi ô tìm kiếm của Popover portal
731
+ e.preventDefault();
737
732
  }}
738
733
  className="z-[100] flex w-[var(--radix-popover-trigger-width)] min-w-[15rem] max-w-[calc(100vw-1rem)] flex-col overflow-hidden rounded-md border bg-popover/95 p-0 text-popover-foreground shadow-lg shadow-black/5 backdrop-blur-md"
739
734
  style={{
@@ -178,15 +178,11 @@ export function Combobox({
178
178
  collisionPadding={8}
179
179
  onOpenAutoFocus={(e) => {
180
180
  e.preventDefault();
181
- // Trên thiết bị cảm ứng / màn hình nhỏ, không ép mở bàn phím ảo để tránh che khuất danh sách
182
- const isTouchOrMobile =
183
- typeof window !== "undefined" &&
184
- ((typeof window.matchMedia === "function" &&
185
- window.matchMedia("(pointer: coarse)").matches) ||
186
- (typeof window.innerWidth === "number" && window.innerWidth < 640));
187
- if (!isTouchOrMobile) {
188
- searchInputRef.current?.focus();
189
- }
181
+ searchInputRef.current?.focus();
182
+ }}
183
+ onFocusOutside={(e) => {
184
+ // Ngăn Dialog / Sheet cha giật focus khỏi ô tìm kiếm của Popover portal
185
+ e.preventDefault();
190
186
  }}
191
187
  className="z-[100] w-[var(--radix-popover-trigger-width)] min-w-[12rem] max-w-[calc(100vw-1rem)] p-0 flex flex-col overflow-hidden"
192
188
  style={{
@@ -22,7 +22,7 @@
22
22
  "prepare": "husky || true"
23
23
  },
24
24
  "dependencies": {
25
- "@goerp/core": "npm:@goplusvn/core@^0.1.95",
25
+ "@goerp/core": "npm:@goplusvn/core@^0.1.96",
26
26
  "@hookform/resolvers": "3.9.0",
27
27
  "@prisma/adapter-pg": "^7.0.0",
28
28
  "@prisma/client": "^7.0.0",