@suphark/ui 0.27.0 → 0.27.1

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.
Files changed (40) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/README.md +2 -1
  3. package/package.json +1 -1
  4. package/src/components/app-shell/app-shell.tsx +11 -2
  5. package/src/components/app-shell/organization-switcher.tsx +1 -1
  6. package/src/components/app-shell/user-menu.tsx +1 -1
  7. package/src/components/data-table/data-table-column-header.tsx +1 -1
  8. package/src/components/data-table/data-table-faceted-filter.tsx +1 -1
  9. package/src/components/data-table/data-table-row-actions.tsx +10 -3
  10. package/src/components/data-table/data-table-view-option.tsx +1 -1
  11. package/src/components/design-system/sections/hero-specimen.tsx +1 -1
  12. package/src/components/design-system/sections/showcase-data-display.tsx +1 -1
  13. package/src/components/design-system/sections/showcase-feedback.tsx +1 -1
  14. package/src/components/design-system/sections/showcase-forms.tsx +1 -1
  15. package/src/components/design-system/sections/showcase-guidelines-recipes.tsx +1 -1
  16. package/src/components/design-system/sections/showcase-overlays-navigation.tsx +1 -1
  17. package/src/components/design-system/sections/showcase-overview.tsx +1 -1
  18. package/src/components/design-system/sections/showcase-primitives.tsx +1 -1
  19. package/src/components/pwa/pwa-install-card.tsx +1 -1
  20. package/src/components/shared/action-form.tsx +1 -1
  21. package/src/components/shared/button/base/action-button.tsx +8 -3
  22. package/src/components/shared/button/base/link-button.tsx +3 -1
  23. package/src/components/shared/button/button.tsx +8 -1
  24. package/src/components/shared/button/copy-button.tsx +1 -1
  25. package/src/components/shared/button/floating-save-button.tsx +1 -1
  26. package/src/components/shared/combobox.tsx +1 -1
  27. package/src/components/shared/date/date-range-picker.tsx +1 -1
  28. package/src/components/shared/dropzone.tsx +1 -1
  29. package/src/components/shared/env-snippet.tsx +1 -1
  30. package/src/components/shared/filter-bar.tsx +1 -1
  31. package/src/components/shared/form/date-time-picker.tsx +1 -1
  32. package/src/components/shared/form/form-field-combobox.tsx +1 -1
  33. package/src/components/shared/form/form-field-select.tsx +1 -1
  34. package/src/components/shared/form-dialog.tsx +1 -1
  35. package/src/components/shared/language/language-switch.tsx +1 -1
  36. package/src/components/shared/layout/error-state.tsx +2 -1
  37. package/src/components/shared/multi-select-combobox.tsx +1 -1
  38. package/src/components/shared/selection-button.tsx +1 -1
  39. package/src/components/shared/step-form.tsx +1 -1
  40. package/src/components/shared/ui-text.tsx +4 -0
package/CHANGELOG.md CHANGED
@@ -2,6 +2,21 @@
2
2
 
3
3
  รูปแบบตาม [Keep a Changelog](https://keepachangelog.com/) · semver: patch = หน้าตา/บั๊ก, minor = component/prop ใหม่, major = เปลี่ยน/ลบ props
4
4
 
5
+ ## [0.27.1] — 2026-10-05
6
+
7
+ ### Added
8
+
9
+ - `Button`: ถ้า `aria-label` ไปอยู่บน element ใน `render=` (เช่น `render={<Link aria-label="…"/>}`) ก็ใช้เป็น tooltip ได้ (เดิมต้องอยู่บน `Button` เท่านั้น — รายงานจาก Pi Auth)
10
+ - เทสต์ชุดใหม่ `button-tooltip-triggers`: ยืนยันว่าปุ่มไอคอนที่ส่งเป็น `render=`/`trigger` ของ `DropdownMenuTrigger` / `PopoverTrigger` / `FormDialog` / `RowActions` ยังได้ tooltip จริง (เช็กจาก popup ที่ขึ้น ไม่ใช่ `data-slot` — `data-slot` ของปุ่มจะกลายเป็นของ trigger ชั้นนอกเสมอ ใช้ชี้วัดไม่ได้)
11
+
12
+ ### Fixed
13
+
14
+ - **ตัวห่อปุ่มของแพ็กเกจเองหล่น tooltip** (รายงานจาก Pi Auth): `LinkButton`/`ActionButton`/`CopyButton`/`DeleteManyButton`/`FloatingSaveButton`/`SelectionButton`, `DataTable*`, `UserMenu`, `OrganizationSwitcher`, `FilterBar`, `Combobox`, `Dropzone`, `StepForm`, `ActionForm`, `ErrorState`, `EnvSnippet`, `DateRangePicker`, `DateTimePicker`, `FormField*`, `LanguageSwitch`, `PwaInstallCard` และตัวอย่างใน `design-system` — ทั้งหมด import `Button` จากไฟล์ shadcn ดิบ (ไม่มี tooltip) ตอนนี้ย้ายมาใช้ตัวที่ห่อ tooltip แล้ว 33 ไฟล์ (ปุ่มไอคอนอย่าง `<LinkButton aria-label="…"><KeyIcon/></LinkButton>` จึงได้ tooltip ด้วย)
15
+ - `ActionButton` / `LinkButton`: มี `tooltip` ของตัวเองอยู่แล้ว → ส่ง `tooltip={false}` ให้ `Button` ชั้นใน กันขึ้นสองชั้น (props `tooltip`/`tooltipSide` ของ `ActionButton` ยังเป็นแบบเดิมทุกประการ)
16
+ - `DataTableRowActions`: ปุ่ม "…" ใช้ `aria-label` จาก `UiText.actions` แทน `sr-only` อังกฤษ "Open menu"
17
+ - **กฎใหม่กันพลาดซ้ำ**: `pnpm check:button` (อยู่ใน `verify` และ CI) ห้ามไฟล์ในแพ็กเกจ import `Button` จาก `components/ui/button` ยกเว้นไฟล์ shadcn เองกับตัวห่อ
18
+ - **`AppShell` ปุ่มย่อ/ขยายเมนู**: ปุ่มในหัวเรื่อง (`SidebarTrigger`) ได้ tooltip เหมือนปุ่มไอคอนอื่น และแถบลาก (`SidebarRail`) เลิกใช้ `title` ของ shadcn ที่ทำ tooltip ของเบราว์เซอร์ซ้อนขึ้นมา — ทั้งคู่ใช้ป้ายภาษาไทยจาก `UiText.toggleSidebar` (คีย์ใหม่, ค่าเริ่มต้น "ย่อ/ขยายเมนู" / EN "Toggle sidebar") แทน "Toggle Sidebar" ที่ฝังอยู่ในไฟล์ shadcn (รายงานจาก Pi Files หลัง bump ^0.27.0 — แก้ที่ `app-shell.tsx` ไม่แตะ `components/ui/sidebar.tsx`)
19
+
5
20
  ## [0.27.0] — 2026-10-05
6
21
 
7
22
  ### Added
package/README.md CHANGED
@@ -178,7 +178,8 @@ export default async function Layout({ children }) {
178
178
  - ไม่มี `aria-label` แต่ใช้รูปแบบ shadcn `<span className="sr-only">ข้อความ</span>` ข้างไอคอน ก็ใช้ข้อความนั้นเป็น tooltip ให้เหมือนกัน
179
179
  - ปุ่มที่ `disabled` ไม่ขึ้น tooltip (ปุ่มที่ปิดอยู่ไม่รับ pointer ตามสไตล์ของ shadcn) — ถ้าต้องอธิบายว่าทำไมกดไม่ได้ ให้ห่อ `SimpleTooltip` ที่ `<span>` ครอบปุ่มแทน
180
180
  - มี `title="…"` อยู่เดิมให้เอาออก ไม่งั้นจะได้ tooltip ซ้อนกับของเบราว์เซอร์
181
- - `<button>` ดิบ (ไม่ผ่าน `Button`) ไม่ได้ของนี้ — อีกเหตุผลที่ห้ามเขียนปุ่มเอง
181
+ - `<button>` ดิบ (ไม่ผ่าน `Button`) ไม่ได้ของนี้ — อีกเหตุผลที่ห้ามเขียนปุ่มเอง · และต้อง import `Button` **จาก `@suphark/ui`** เท่านั้น: `@suphark/ui/components/ui/button` คือไฟล์ shadcn ดิบที่ไม่มี tooltip
182
+ - ตรวจว่าปุ่มมี tooltip ไหม **อย่าดูจาก `data-slot`** — ปุ่มที่เป็น `render=`/`trigger` ของ Dialog/Popover/DropdownMenu จะได้ `data-slot` ของ trigger ชั้นนอก (`dialog-trigger` ฯลฯ) ทั้งที่มี tooltip อยู่ ให้เอาเมาส์ไปวางจริง หรือเช็ก `[data-slot=tooltip-content]` หลัง hover
182
183
  - ปุ่มไอคอนของแพ็กเกจเอง (`RowActions`, `ActionMenu`, `SimpleDialog` ปุ่มปิด, `DataTable` แบ่งหน้า, `ThemeToggle`, `Notice`, `UploadList`, `TimePicker`, `MonthStepper`, `SecretReveal`, `CommandPalette` …) ได้ tooltip ไปพร้อมกันตั้งแต่ 0.27.0
183
184
 
184
185
  ### ยืนยันก่อนทำ — ห้ามใช้ `window.confirm`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@suphark/ui",
3
- "version": "0.27.0",
3
+ "version": "0.27.1",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "Design system กลางของ Suphark apps: shadcn/ui (base-nova, Base UI, Tailwind v4) + shared components + token/ฟอนต์ Noto Sans Thai Looped — ส่งเป็น source ให้แอป Next transpile เอง",
@@ -1,6 +1,8 @@
1
1
  "use client";
2
2
 
3
+ import { SimpleTooltip } from "@suphark/ui/components/shared/simple-tooltip";
3
4
  import { SkipLink } from "@suphark/ui/components/shared/skip-link";
5
+ import { useUiText } from "@suphark/ui/components/shared/ui-text";
4
6
  import {
5
7
  InputGroup,
6
8
  InputGroupAddon,
@@ -156,6 +158,8 @@ function SidebarShell({
156
158
  mobileTabs,
157
159
  children,
158
160
  }: AppShellProps) {
161
+ const text = useUiText();
162
+ const toggleSidebarLabel = text.toggleSidebar ?? "ย่อ/ขยายเมนู";
159
163
  const style = brandColor
160
164
  ? ({
161
165
  "--brand": brandColor,
@@ -203,7 +207,9 @@ function SidebarShell({
203
207
  )}
204
208
  >
205
209
  <div className="flex h-12 min-w-0 flex-1 items-center gap-2 md:h-full">
206
- <SidebarTrigger className="-ml-1" />
210
+ <SimpleTooltip content={toggleSidebarLabel}>
211
+ <SidebarTrigger className="-ml-1" aria-label={toggleSidebarLabel} />
212
+ </SimpleTooltip>
207
213
  {breadcrumbs && (
208
214
  <>
209
215
  <Separator orientation="vertical" className="mr-2 hidden h-4 md:block" />
@@ -379,6 +385,8 @@ function ShellSidebar({
379
385
  | "collapsible"
380
386
  >) {
381
387
  const { state, isMobile } = useSidebar();
388
+ const text = useUiText();
389
+ const railLabel = text.toggleSidebar ?? "ย่อ/ขยายเมนู";
382
390
  const [query, setQuery] = useState("");
383
391
  const collapsed = state === "collapsed" && !isMobile;
384
392
  useEffect(() => {
@@ -436,7 +444,8 @@ function ShellSidebar({
436
444
  )}
437
445
  </SidebarContent>
438
446
  {sidebarFooter && <SidebarFooter>{sidebarFooter}</SidebarFooter>}
439
- {collapsible !== "none" && <SidebarRail />}
447
+ {/* title ของ shadcn เป็นอังกฤษและทำ tooltip ของเบราว์เซอร์ซ้อนกับของเรา → ปิดด้วย title={undefined} */}
448
+ {collapsible !== "none" && <SidebarRail aria-label={railLabel} title={undefined} />}
440
449
  </Sidebar>
441
450
  );
442
451
  }
@@ -1,8 +1,8 @@
1
1
  "use client";
2
2
 
3
+ import { Button } from "@suphark/ui/components/shared/button/button";
3
4
  import { SwitcherChevron } from "@suphark/ui/components/shared/switcher-chevron";
4
5
  import { useUiText } from "@suphark/ui/components/shared/ui-text";
5
- import { Button } from "@suphark/ui/components/ui/button";
6
6
  import {
7
7
  DropdownMenu,
8
8
  DropdownMenuContent,
@@ -1,9 +1,9 @@
1
1
  "use client";
2
2
 
3
+ import { Button } from "@suphark/ui/components/shared/button/button";
3
4
  import { Initials } from "@suphark/ui/components/shared/initials";
4
5
  import { SwitcherChevron } from "@suphark/ui/components/shared/switcher-chevron";
5
6
  import { useUiText } from "@suphark/ui/components/shared/ui-text";
6
- import { Button } from "@suphark/ui/components/ui/button";
7
7
  import {
8
8
  DropdownMenu,
9
9
  DropdownMenuContent,
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
 
3
- import { Button } from "@suphark/ui/components/ui/button";
3
+ import { Button } from "@suphark/ui/components/shared/button/button";
4
4
  import {
5
5
  DropdownMenu,
6
6
  DropdownMenuContent,
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
 
3
+ import { Button } from "@suphark/ui/components/shared/button/button";
3
4
  import { Badge } from "@suphark/ui/components/ui/badge";
4
- import { Button } from "@suphark/ui/components/ui/button";
5
5
  import {
6
6
  Command,
7
7
  CommandEmpty,
@@ -1,6 +1,8 @@
1
1
  "use client";
2
2
 
3
+ import { Button } from "@suphark/ui/components/shared/button/button";
3
4
  import { DeleteButton } from "@suphark/ui/components/shared/button/delete-button";
5
+ import { useUiText } from "@suphark/ui/components/shared/ui-text";
4
6
  import {
5
7
  AlertDialog,
6
8
  AlertDialogCancel,
@@ -10,7 +12,6 @@ import {
10
12
  AlertDialogHeader,
11
13
  AlertDialogTitle,
12
14
  } from "@suphark/ui/components/ui/alert-dialog";
13
- import { Button } from "@suphark/ui/components/ui/button";
14
15
  import {
15
16
  DropdownMenu,
16
17
  DropdownMenuContent,
@@ -74,6 +75,7 @@ export function DataTableRowActions<TData>({
74
75
  nameKey = "name" as keyof TData,
75
76
  idKey = "id" as keyof TData,
76
77
  }: DataTableRowActionsProps<TData>) {
78
+ const text = useUiText();
77
79
  const item = row.original;
78
80
  const itemRecord = item as Record<string, unknown>;
79
81
  const itemName = String(
@@ -105,10 +107,15 @@ export function DataTableRowActions<TData>({
105
107
  <div className="flex justify-end">
106
108
  <DropdownMenu>
107
109
  <DropdownMenuTrigger
108
- render={<Button variant="ghost" className="flex h-8 w-8 p-0 data-popup-open:bg-muted" />}
110
+ render={
111
+ <Button
112
+ variant="ghost"
113
+ aria-label={text.actions}
114
+ className="flex h-8 w-8 p-0 data-popup-open:bg-muted"
115
+ />
116
+ }
109
117
  >
110
118
  <Ellipsis className="h-4 w-4" />
111
- <span className="sr-only">Open menu</span>
112
119
  </DropdownMenuTrigger>
113
120
  <DropdownMenuContent align="end" className="w-[160px]">
114
121
  {children}
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
 
3
- import { Button } from "@suphark/ui/components/ui/button";
3
+ import { Button } from "@suphark/ui/components/shared/button/button";
4
4
  import {
5
5
  DropdownMenu,
6
6
  DropdownMenuCheckboxItem,
@@ -1,8 +1,8 @@
1
1
  "use client";
2
2
 
3
+ import { Button } from "@suphark/ui/components/shared/button/button";
3
4
  import { Initials } from "@suphark/ui/components/shared/initials";
4
5
  import { StatusBadge } from "@suphark/ui/components/shared/status-badge";
5
- import { Button } from "@suphark/ui/components/ui/button";
6
6
  import { Checkbox } from "@suphark/ui/components/ui/checkbox";
7
7
  import {
8
8
  InputGroup,
@@ -1,5 +1,6 @@
1
1
  "use client";
2
2
 
3
+ import { Button } from "@suphark/ui/components/shared/button/button";
3
4
  import { FormattedNumber } from "@suphark/ui/components/shared/number/formatted-number";
4
5
  import { PrimarySecondaryText } from "@suphark/ui/components/shared/text/primary-secondary-text";
5
6
  import {
@@ -13,7 +14,6 @@ import {
13
14
  AttachmentTitle,
14
15
  } from "@suphark/ui/components/ui/attachment";
15
16
  import { Badge } from "@suphark/ui/components/ui/badge";
16
- import { Button } from "@suphark/ui/components/ui/button";
17
17
  import {
18
18
  Card,
19
19
  CardContent,
@@ -1,8 +1,8 @@
1
1
  "use client";
2
2
 
3
+ import { Button } from "@suphark/ui/components/shared/button/button";
3
4
  import { Alert, AlertDescription, AlertTitle } from "@suphark/ui/components/ui/alert";
4
5
  import { Badge } from "@suphark/ui/components/ui/badge";
5
- import { Button } from "@suphark/ui/components/ui/button";
6
6
  import {
7
7
  Card,
8
8
  CardContent,
@@ -1,9 +1,9 @@
1
1
  "use client";
2
2
 
3
+ import { Button } from "@suphark/ui/components/shared/button/button";
3
4
  import { Combobox } from "@suphark/ui/components/shared/combobox";
4
5
  import { MultiSelectCombobox } from "@suphark/ui/components/shared/multi-select-combobox";
5
6
  import { Badge } from "@suphark/ui/components/ui/badge";
6
- import { Button } from "@suphark/ui/components/ui/button";
7
7
  import {
8
8
  Card,
9
9
  CardContent,
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
 
3
+ import { Button } from "@suphark/ui/components/shared/button/button";
3
4
  import { Badge } from "@suphark/ui/components/ui/badge";
4
- import { Button } from "@suphark/ui/components/ui/button";
5
5
  import {
6
6
  Card,
7
7
  CardContent,
@@ -1,5 +1,6 @@
1
1
  "use client";
2
2
 
3
+ import { Button } from "@suphark/ui/components/shared/button/button";
3
4
  import {
4
5
  AlertDialog,
5
6
  AlertDialogAction,
@@ -20,7 +21,6 @@ import {
20
21
  BreadcrumbPage,
21
22
  BreadcrumbSeparator,
22
23
  } from "@suphark/ui/components/ui/breadcrumb";
23
- import { Button } from "@suphark/ui/components/ui/button";
24
24
  import {
25
25
  Card,
26
26
  CardContent,
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
 
3
+ import { Button } from "@suphark/ui/components/shared/button/button";
3
4
  import { Badge } from "@suphark/ui/components/ui/badge";
4
- import { Button } from "@suphark/ui/components/ui/button";
5
5
  import {
6
6
  Card,
7
7
  CardContent,
@@ -8,6 +8,7 @@ import {
8
8
  PrintButton,
9
9
  SaveButton,
10
10
  } from "@suphark/ui/components/shared/button";
11
+ import { Button } from "@suphark/ui/components/shared/button/button";
11
12
  import {
12
13
  Accordion,
13
14
  AccordionContent,
@@ -16,7 +17,6 @@ import {
16
17
  } from "@suphark/ui/components/ui/accordion";
17
18
  import { Avatar, AvatarFallback, AvatarImage } from "@suphark/ui/components/ui/avatar";
18
19
  import { Badge } from "@suphark/ui/components/ui/badge";
19
- import { Button } from "@suphark/ui/components/ui/button";
20
20
  import { ButtonGroup, ButtonGroupSeparator } from "@suphark/ui/components/ui/button-group";
21
21
  import {
22
22
  Card,
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
 
3
- import { Button } from "@suphark/ui/components/ui/button";
3
+ import { Button } from "@suphark/ui/components/shared/button/button";
4
4
  import { cn } from "@suphark/ui/lib/utils";
5
5
  import { Check, Download, MonitorSmartphone, Share, Smartphone } from "lucide-react";
6
6
  import { useEffect, useState } from "react";
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
 
3
- import { Button } from "@suphark/ui/components/ui/button";
3
+ import { Button } from "@suphark/ui/components/shared/button/button";
4
4
  import { Card, CardContent } from "@suphark/ui/components/ui/card";
5
5
  import { cn } from "@suphark/ui/lib/utils";
6
6
  import { type ComponentProps, type ReactNode, startTransition, useActionState } from "react";
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
 
3
- import { Button } from "@suphark/ui/components/ui/button";
3
+ import { Button } from "@suphark/ui/components/shared/button/button";
4
4
  import { Tooltip, TooltipContent, TooltipTrigger } from "@suphark/ui/components/ui/tooltip";
5
5
  import {
6
6
  type CheckPermissionOptions,
@@ -11,8 +11,11 @@ import { cn } from "@suphark/ui/lib/utils";
11
11
  import { Loader2 } from "lucide-react";
12
12
  import * as React from "react";
13
13
 
14
- // ดึง Type Props มาจาก Component โดยตรง
15
- type ButtonProps = React.ComponentProps<typeof Button>;
14
+ // ดึง Type Props มาจาก Component โดยตรง — tooltip ของตัวนี้คุมเอง (ReactNode + side ของ Base UI)
15
+ type ButtonProps = Omit<
16
+ React.ComponentProps<typeof Button>,
17
+ "tooltip" | "tooltipSide" | "tooltipDelay"
18
+ >;
16
19
 
17
20
  type TooltipContentProps = React.ComponentProps<typeof TooltipContent>;
18
21
 
@@ -100,6 +103,8 @@ export function ActionButton({
100
103
  const buttonContent = (
101
104
  <Button
102
105
  className={cn(responsive && "max-sm:px-2", className)}
106
+ // มี tooltip ของตัวเองแล้ว ไม่ให้ Button สร้างซ้อนอีกชั้น (ไม่มี = ปล่อยให้ Button ใช้ aria-label เอง)
107
+ tooltip={finalTooltip ? false : undefined}
103
108
  disabled={isLoading || disabled} // Disable if loading or explicitly disabled
104
109
  onClick={onClick}
105
110
  variant={variant}
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
 
3
3
  // [FIX 1.1] นำเข้าเฉพาะ Button
4
- import { Button } from "@suphark/ui/components/ui/button";
4
+ import { Button } from "@suphark/ui/components/shared/button/button";
5
5
  import { Tooltip, TooltipContent, TooltipTrigger } from "@suphark/ui/components/ui/tooltip";
6
6
  import {
7
7
  type CheckPermissionOptions,
@@ -97,6 +97,8 @@ export function LinkButton({
97
97
  const buttonContent = (
98
98
  <Button
99
99
  className={className}
100
+ // มี tooltip ของตัวเองแล้ว ไม่ให้ Button สร้างซ้อนอีกชั้น (ไม่มี = ปล่อยให้ Button ใช้ aria-label เอง)
101
+ tooltip={tooltip ? false : undefined}
100
102
  disabled={isPending || disabled} // Disable if pending or explicitly disabled
101
103
  onClick={handleClick}
102
104
  {...props}
@@ -36,6 +36,13 @@ export function ButtonTooltipSuppress({ children }: { children: ReactNode }) {
36
36
  return <NoAutoTooltip.Provider value={true}>{children}</NoAutoTooltip.Provider>;
37
37
  }
38
38
 
39
+ /** `aria-label` ที่เผลอไปอยู่บน element ใน `render=` (เช่น `render={<Link aria-label="…"/>}`) */
40
+ function renderLabel(render: unknown): string | null {
41
+ if (!isValidElement(render)) return null;
42
+ const label = (render.props as { "aria-label"?: unknown })["aria-label"];
43
+ return typeof label === "string" && label.trim() !== "" ? label : null;
44
+ }
45
+
39
46
  /** ข้อความใน `<span className="sr-only">` (รูปแบบของ shadcn ที่ใช้แทน aria-label) */
40
47
  function srOnlyText(children: ReactNode): string | null {
41
48
  let found: string | null = null;
@@ -89,7 +96,7 @@ export function Button({ tooltip, tooltipSide = "top", tooltipDelay, ...props }:
89
96
  const label =
90
97
  typeof props["aria-label"] === "string" && props["aria-label"].trim() !== ""
91
98
  ? props["aria-label"]
92
- : srOnlyText(props.children);
99
+ : (renderLabel(props.render) ?? srOnlyText(props.children));
93
100
  const explicit = tooltip !== undefined && tooltip !== null && tooltip !== "";
94
101
  const auto =
95
102
  !suppressed &&
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
 
3
+ import { Button } from "@suphark/ui/components/shared/button/button";
3
4
  import { useUiText } from "@suphark/ui/components/shared/ui-text";
4
- import { Button } from "@suphark/ui/components/ui/button";
5
5
  import { useCopyToClipboard } from "@suphark/ui/hooks/use-copy-to-clipboard";
6
6
  import { cn } from "@suphark/ui/lib/utils";
7
7
  import { Check, Copy } from "lucide-react";
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
 
3
- import { Button } from "@suphark/ui/components/ui/button";
3
+ import { Button } from "@suphark/ui/components/shared/button/button";
4
4
  import { cn } from "@suphark/ui/lib/utils";
5
5
  import { Check, Loader2, Save, X } from "lucide-react";
6
6
  import { useEffect, useRef, useState } from "react";
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
 
3
+ import { Button } from "@suphark/ui/components/shared/button/button";
3
4
  import { SwitcherChevron } from "@suphark/ui/components/shared/switcher-chevron";
4
- import { Button } from "@suphark/ui/components/ui/button";
5
5
  import {
6
6
  Command,
7
7
  CommandEmpty,
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
 
3
+ import { Button } from "@suphark/ui/components/shared/button/button";
3
4
  import { Badge } from "@suphark/ui/components/ui/badge";
4
- import { Button } from "@suphark/ui/components/ui/button";
5
5
  import { Calendar } from "@suphark/ui/components/ui/calendar";
6
6
  import { Popover, PopoverContent, PopoverTrigger } from "@suphark/ui/components/ui/popover";
7
7
  import { Separator } from "@suphark/ui/components/ui/separator";
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
 
3
- import { Button } from "@suphark/ui/components/ui/button";
3
+ import { Button } from "@suphark/ui/components/shared/button/button";
4
4
  import { formatBytes } from "@suphark/ui/lib/formatters";
5
5
  import { cn } from "@suphark/ui/lib/utils";
6
6
  import { UploadCloud } from "lucide-react";
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
 
3
- import { Button } from "@suphark/ui/components/ui/button";
3
+ import { Button } from "@suphark/ui/components/shared/button/button";
4
4
  import { copyText, selectContents } from "@suphark/ui/lib/copy-text";
5
5
  import { CheckIcon, CopyIcon } from "lucide-react";
6
6
  import { useRef, useState } from "react";
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
 
3
- import { Button } from "@suphark/ui/components/ui/button";
3
+ import { Button } from "@suphark/ui/components/shared/button/button";
4
4
  import { NativeSelect, NativeSelectOption } from "@suphark/ui/components/ui/native-select";
5
5
  import { cn } from "@suphark/ui/lib/utils";
6
6
  import { XIcon } from "lucide-react";
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
 
3
- import { Button } from "@suphark/ui/components/ui/button";
3
+ import { Button } from "@suphark/ui/components/shared/button/button";
4
4
  import { Calendar } from "@suphark/ui/components/ui/calendar";
5
5
  import { Popover, PopoverContent, PopoverTrigger } from "@suphark/ui/components/ui/popover";
6
6
  import { useMounted } from "@suphark/ui/hooks/use-mounted";
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
 
3
+ import { Button } from "@suphark/ui/components/shared/button/button";
3
4
  import { SwitcherChevron } from "@suphark/ui/components/shared/switcher-chevron";
4
- import { Button } from "@suphark/ui/components/ui/button";
5
5
  import {
6
6
  Command,
7
7
  CommandEmpty,
@@ -1,8 +1,8 @@
1
1
  "use client";
2
2
 
3
+ import { Button } from "@suphark/ui/components/shared/button/button";
3
4
  import { MultiSelectCombobox } from "@suphark/ui/components/shared/multi-select-combobox";
4
5
  import { SwitcherChevron } from "@suphark/ui/components/shared/switcher-chevron";
5
- import { Button } from "@suphark/ui/components/ui/button";
6
6
  import {
7
7
  Command,
8
8
  CommandEmpty,
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
 
3
+ import { Button } from "@suphark/ui/components/shared/button/button";
3
4
  import { SecretReveal } from "@suphark/ui/components/shared/secret-reveal";
4
- import { Button } from "@suphark/ui/components/ui/button";
5
5
  import {
6
6
  Dialog,
7
7
  DialogContent,
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
 
3
+ import { Button } from "@suphark/ui/components/shared/button/button";
3
4
  import { useUiText } from "@suphark/ui/components/shared/ui-text";
4
- import { Button } from "@suphark/ui/components/ui/button";
5
5
  import {
6
6
  DropdownMenu,
7
7
  DropdownMenuContent,
@@ -1,6 +1,7 @@
1
1
  "use client";
2
2
 
3
- import { Button, buttonVariants } from "@suphark/ui/components/ui/button";
3
+ import { Button } from "@suphark/ui/components/shared/button/button";
4
+ import { buttonVariants } from "@suphark/ui/components/ui/button";
4
5
  import { Card, CardContent, CardHeader, CardTitle } from "@suphark/ui/components/ui/card";
5
6
  import { cn } from "@suphark/ui/lib/utils";
6
7
  import { AlertTriangle, Home, LogIn, RotateCcw } from "lucide-react";
@@ -1,8 +1,8 @@
1
1
  "use client";
2
2
 
3
+ import { Button } from "@suphark/ui/components/shared/button/button";
3
4
  import { SwitcherChevron } from "@suphark/ui/components/shared/switcher-chevron";
4
5
  import { Badge } from "@suphark/ui/components/ui/badge";
5
- import { Button } from "@suphark/ui/components/ui/button";
6
6
  import {
7
7
  Command,
8
8
  CommandEmpty,
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
 
3
- import { Button } from "@suphark/ui/components/ui/button";
3
+ import { Button } from "@suphark/ui/components/shared/button/button";
4
4
  import { cn } from "@suphark/ui/lib/utils";
5
5
  import type { ComponentProps } from "react";
6
6
 
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
 
3
- import { Button } from "@suphark/ui/components/ui/button";
3
+ import { Button } from "@suphark/ui/components/shared/button/button";
4
4
  import { Spinner } from "@suphark/ui/components/ui/spinner";
5
5
  import { errorMessage, failedResult, isNavigationError } from "@suphark/ui/lib/action-result";
6
6
  import { cn } from "@suphark/ui/lib/utils";
@@ -43,6 +43,8 @@ export interface UiText {
43
43
  switcher?: Partial<{ choose: string; organization: string }>;
44
44
  /** UserMenu: aria-label ปุ่มเปิดเมนู (optional — "เมนูผู้ใช้") */
45
45
  userMenu?: string;
46
+ /** AppShell: ปุ่มย่อ/ขยายเมนูข้าง (optional — "ย่อ/ขยายเมนู") */
47
+ toggleSidebar?: string;
46
48
  /** UserMenu: ปุ่มออกจากระบบ (optional — "ออกจากระบบ") */
47
49
  signOut?: string;
48
50
  /** ThemeMenuItems: หัวกลุ่ม + ตัวเลือก (optional) */
@@ -148,6 +150,7 @@ export const UI_TEXT_TH: UiText = {
148
150
  },
149
151
  switcher: { choose: "เลือกองค์กร", organization: "องค์กร" },
150
152
  userMenu: "เมนูผู้ใช้",
153
+ toggleSidebar: "ย่อ/ขยายเมนู",
151
154
  signOut: "ออกจากระบบ",
152
155
  theme: { label: "ธีม", light: "สว่าง", dark: "มืด", system: "ตามระบบ" },
153
156
  sectionNav: { tabs: "แท็บย่อย" },
@@ -245,6 +248,7 @@ export const UI_TEXT_EN: UiText = {
245
248
  },
246
249
  switcher: { choose: "Choose organization", organization: "Organization" },
247
250
  userMenu: "User menu",
251
+ toggleSidebar: "Toggle sidebar",
248
252
  signOut: "Sign out",
249
253
  theme: { label: "Theme", light: "Light", dark: "Dark", system: "System" },
250
254
  sectionNav: { tabs: "Section tabs" },