@cl-light-ds/ui 0.2.0 → 0.4.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 +45 -45
- package/package.json +2 -2
- package/src/components/accordion/Accordion.astro +248 -248
- package/src/components/accordion/AccordionContent.astro +26 -26
- package/src/components/accordion/AccordionItem.astro +36 -36
- package/src/components/accordion/AccordionTrigger.astro +118 -118
- package/src/components/accordion/CHANGELOG.md +41 -41
- package/src/components/accordion/index.ts +4 -4
- package/src/components/alert/Alert.astro +167 -167
- package/src/components/alert/AlertDescription.astro +24 -24
- package/src/components/alert/AlertTitle.astro +24 -24
- package/src/components/alert/CHANGELOG.md +5 -5
- package/src/components/alert/index.ts +4 -4
- package/src/components/avatar/Avatar.astro +197 -197
- package/src/components/avatar/AvatarBadge.astro +44 -44
- package/src/components/avatar/AvatarFallback.astro +26 -26
- package/src/components/avatar/AvatarGroup.astro +26 -26
- package/src/components/avatar/AvatarGroupCount.astro +30 -30
- package/src/components/avatar/AvatarImage.astro +46 -46
- package/src/components/avatar/CHANGELOG.md +44 -44
- package/src/components/avatar/index.ts +6 -6
- package/src/components/badge/Badge.astro +167 -167
- package/src/components/badge/CHANGELOG.md +49 -49
- package/src/components/badge/index.ts +2 -2
- package/src/components/breadcrumb/Breadcrumb.astro +76 -76
- package/src/components/breadcrumb/BreadcrumbItem.astro +32 -32
- package/src/components/breadcrumb/BreadcrumbList.astro +26 -26
- package/src/components/breadcrumb/BreadcrumbSeparator.astro +26 -26
- package/src/components/breadcrumb/CHANGELOG.md +24 -24
- package/src/components/breadcrumb/index.ts +5 -5
- package/src/components/button/Button.astro +233 -233
- package/src/components/button/CHANGELOG.md +41 -41
- package/src/components/button/index.ts +2 -2
- package/src/components/button-group/ButtonGroup.astro +130 -130
- package/src/components/button-group/ButtonGroupSeparator.astro +30 -30
- package/src/components/button-group/ButtonGroupText.astro +21 -21
- package/src/components/button-group/CHANGELOG.md +34 -34
- package/src/components/button-group/index.ts +3 -3
- package/src/components/callout/CHANGELOG.md +32 -0
- package/src/components/callout/Callout.astro +147 -0
- package/src/components/callout/CalloutDescription.astro +16 -0
- package/src/components/callout/CalloutTitle.astro +16 -0
- package/src/components/callout/index.ts +3 -0
- package/src/components/card/CHANGELOG.md +162 -119
- package/src/components/card/Card.astro +197 -182
- package/src/components/card/CardAction.astro +26 -26
- package/src/components/card/CardContent.astro +28 -28
- package/src/components/card/CardDescription.astro +28 -28
- package/src/components/card/CardFooter.astro +24 -24
- package/src/components/card/CardHeader.astro +30 -30
- package/src/components/card/CardMedia.astro +27 -27
- package/src/components/card/CardMediaActions.astro +21 -0
- package/src/components/card/CardMediaSelect.astro +21 -0
- package/src/components/card/CardOverlay.astro +32 -32
- package/src/components/card/CardTitle.astro +21 -21
- package/src/components/card/index.ts +12 -10
- package/src/components/carousel/CHANGELOG.md +5 -5
- package/src/components/carousel/Carousel.astro +106 -106
- package/src/components/carousel/CarouselSlide.astro +22 -22
- package/src/components/carousel/index.ts +3 -3
- package/src/components/checkbox/CHANGELOG.md +58 -58
- package/src/components/checkbox/Checkbox.astro +159 -159
- package/src/components/checkbox/index.ts +1 -1
- package/src/components/collapsible/CHANGELOG.md +5 -5
- package/src/components/collapsible/Collapsible.astro +202 -202
- package/src/components/collapsible/CollapsibleContent.astro +36 -36
- package/src/components/collapsible/CollapsibleTrigger.astro +34 -34
- package/src/components/collapsible/index.ts +4 -4
- package/src/components/combobox/CHANGELOG.md +27 -27
- package/src/components/combobox/Combobox.astro +365 -365
- package/src/components/combobox/ComboboxContent.astro +37 -37
- package/src/components/combobox/ComboboxEmpty.astro +18 -18
- package/src/components/combobox/ComboboxGroup.astro +19 -19
- package/src/components/combobox/ComboboxInput.astro +74 -74
- package/src/components/combobox/ComboboxItem.astro +39 -39
- package/src/components/combobox/ComboboxLabel.astro +18 -18
- package/src/components/combobox/ComboboxList.astro +21 -21
- package/src/components/combobox/ComboboxSeparator.astro +17 -17
- package/src/components/combobox/ComboboxTrigger.astro +30 -30
- package/src/components/combobox/ComboboxValue.astro +22 -22
- package/src/components/combobox/index.ts +11 -11
- package/src/components/date/CHANGELOG.md +18 -18
- package/src/components/date/Date.astro +137 -137
- package/src/components/date/index.ts +2 -2
- package/src/components/dialog/CHANGELOG.md +39 -39
- package/src/components/dialog/Dialog.astro +196 -196
- package/src/components/dialog/DialogClose.astro +23 -23
- package/src/components/dialog/DialogContent.astro +42 -42
- package/src/components/dialog/DialogDescription.astro +18 -18
- package/src/components/dialog/DialogFooter.astro +18 -18
- package/src/components/dialog/DialogHeader.astro +18 -18
- package/src/components/dialog/DialogOverlay.astro +19 -19
- package/src/components/dialog/DialogTitle.astro +18 -18
- package/src/components/dialog/DialogTrigger.astro +37 -37
- package/src/components/dialog/index.ts +9 -9
- package/src/components/dropdown-menu/CHANGELOG.md +194 -194
- package/src/components/dropdown-menu/DropdownMenu.astro +226 -226
- package/src/components/dropdown-menu/DropdownMenuCheckboxItem.astro +114 -114
- package/src/components/dropdown-menu/DropdownMenuContent.astro +42 -42
- package/src/components/dropdown-menu/DropdownMenuGroup.astro +19 -19
- package/src/components/dropdown-menu/DropdownMenuItem.astro +220 -220
- package/src/components/dropdown-menu/DropdownMenuItemContent.astro +79 -79
- package/src/components/dropdown-menu/DropdownMenuLabel.astro +20 -20
- package/src/components/dropdown-menu/DropdownMenuPortal.astro +13 -13
- package/src/components/dropdown-menu/DropdownMenuRadioGroup.astro +13 -13
- package/src/components/dropdown-menu/DropdownMenuRadioItem.astro +101 -101
- package/src/components/dropdown-menu/DropdownMenuSeparator.astro +18 -18
- package/src/components/dropdown-menu/DropdownMenuShortcut.astro +18 -18
- package/src/components/dropdown-menu/DropdownMenuTrigger.astro +49 -49
- package/src/components/dropdown-menu/dropdown-menu-item-variants.ts +24 -24
- package/src/components/dropdown-menu/index.ts +12 -12
- package/src/components/field/CHANGELOG.md +33 -33
- package/src/components/field/Field.astro +664 -664
- package/src/components/field/FieldContent.astro +20 -20
- package/src/components/field/FieldDescription.astro +22 -22
- package/src/components/field/FieldError.astro +51 -51
- package/src/components/field/FieldGroup.astro +20 -20
- package/src/components/field/FieldLabel.astro +22 -22
- package/src/components/field/FieldLegend.astro +23 -23
- package/src/components/field/FieldSeparator.astro +30 -30
- package/src/components/field/FieldSet.astro +20 -20
- package/src/components/field/FieldTitle.astro +20 -20
- package/src/components/field/index.ts +10 -10
- package/src/components/hover-card/CHANGELOG.md +20 -20
- package/src/components/hover-card/HoverCard.astro +235 -235
- package/src/components/hover-card/HoverCardContent.astro +54 -54
- package/src/components/hover-card/HoverCardTrigger.astro +38 -38
- package/src/components/hover-card/index.ts +3 -3
- package/src/components/input/CHANGELOG.md +44 -29
- package/src/components/input/Input.astro +130 -130
- package/src/components/input/InputOTP.astro +211 -0
- package/src/components/input/index.ts +2 -2
- package/src/components/input-group/CHANGELOG.md +49 -49
- package/src/components/input-group/InputGroup.astro +135 -135
- package/src/components/input-group/InputGroupAddon.astro +49 -49
- package/src/components/input-group/InputGroupButton.astro +58 -58
- package/src/components/input-group/InputGroupInput.astro +18 -18
- package/src/components/input-group/InputGroupText.astro +21 -21
- package/src/components/input-group/InputGroupTextarea.astro +17 -17
- package/src/components/input-group/controlClasses.ts +2 -2
- package/src/components/input-group/index.ts +6 -6
- package/src/components/item/CHANGELOG.md +27 -27
- package/src/components/item/Item.astro +122 -122
- package/src/components/item/ItemActions.astro +21 -21
- package/src/components/item/ItemContent.astro +25 -25
- package/src/components/item/ItemDescription.astro +25 -25
- package/src/components/item/ItemFooter.astro +24 -24
- package/src/components/item/ItemGroup.astro +24 -24
- package/src/components/item/ItemHeader.astro +24 -24
- package/src/components/item/ItemMedia.astro +47 -47
- package/src/components/item/ItemSeparator.astro +21 -21
- package/src/components/item/ItemTitle.astro +25 -25
- package/src/components/item/index.ts +10 -10
- package/src/components/kbd/CHANGELOG.md +5 -5
- package/src/components/kbd/Kbd.astro +145 -145
- package/src/components/kbd/KbdGroup.astro +55 -55
- package/src/components/kbd/index.ts +2 -2
- package/src/components/label/CHANGELOG.md +28 -28
- package/src/components/label/Label.astro +97 -97
- package/src/components/label/index.ts +2 -2
- package/src/components/link-group/CHANGELOG.md +75 -75
- package/src/components/link-group/LinkGroup.astro +67 -67
- package/src/components/link-group/LinkGroupItem.astro +32 -32
- package/src/components/link-group/LinkGroupList.astro +25 -25
- package/src/components/link-group/LinkGroupTitle.astro +22 -22
- package/src/components/link-group/index.ts +5 -5
- package/src/components/link-group/link-group-list-variants.ts +15 -15
- package/src/components/logo/CHANGELOG.md +17 -0
- package/src/components/logo/Logo.astro +90 -0
- package/src/components/logo/index.ts +3 -0
- package/src/components/logo/logo-paths.ts +57 -0
- package/src/components/marquee/CHANGELOG.md +5 -5
- package/src/components/marquee/Marquee.astro +119 -119
- package/src/components/marquee/index.ts +2 -2
- package/src/components/native-select/CHANGELOG.md +5 -5
- package/src/components/native-select/NativeSelect.astro +125 -125
- package/src/components/native-select/NativeSelectOptGroup.astro +14 -14
- package/src/components/native-select/NativeSelectOption.astro +9 -9
- package/src/components/native-select/index.ts +3 -3
- package/src/components/navigation-menu/CHANGELOG.md +63 -63
- package/src/components/navigation-menu/NavigationMenu.astro +414 -414
- package/src/components/navigation-menu/NavigationMenuContent.astro +37 -37
- package/src/components/navigation-menu/NavigationMenuIndicator.astro +24 -24
- package/src/components/navigation-menu/NavigationMenuItem.astro +22 -22
- package/src/components/navigation-menu/NavigationMenuLink.astro +18 -18
- package/src/components/navigation-menu/NavigationMenuList.astro +21 -21
- package/src/components/navigation-menu/NavigationMenuPositioner.astro +44 -44
- package/src/components/navigation-menu/NavigationMenuTrigger.astro +30 -30
- package/src/components/navigation-menu/NavigationMenuViewport.astro +19 -19
- package/src/components/navigation-menu/index.ts +10 -10
- package/src/components/organisms/lightning-sidebar-nav/CHANGELOG.md +50 -0
- package/src/components/organisms/lightning-sidebar-nav/LightningSidebarNav.astro +176 -0
- package/src/components/organisms/lightning-sidebar-nav/SidebarNav.astro +50 -0
- package/src/components/organisms/lightning-sidebar-nav/SidebarNavGroup.astro +74 -0
- package/src/components/organisms/lightning-sidebar-nav/SidebarNavItem.astro +94 -0
- package/src/components/organisms/lightning-sidebar-nav/SidebarNavProBadge.astro +26 -0
- package/src/components/organisms/lightning-sidebar-nav/SidebarNavSection.astro +71 -0
- package/src/components/organisms/lightning-sidebar-nav/SidebarNavSkeleton.astro +67 -0
- package/src/components/organisms/lightning-sidebar-nav/SidebarNavSubItem.astro +69 -0
- package/src/components/organisms/lightning-sidebar-nav/SidebarNavUsage.astro +78 -0
- package/src/components/organisms/lightning-sidebar-nav/SidebarNavWorkspaceAvatar.astro +46 -0
- package/src/components/organisms/lightning-sidebar-nav/SidebarNavWorkspaceSwitcher.astro +130 -0
- package/src/components/organisms/lightning-sidebar-nav/icons.ts +46 -0
- package/src/components/organisms/lightning-sidebar-nav/index.ts +18 -0
- package/src/components/organisms/lightning-sidebar-nav/types.ts +77 -0
- package/src/components/popover/CHANGELOG.md +20 -20
- package/src/components/popover/Popover.astro +211 -211
- package/src/components/popover/PopoverClose.astro +18 -18
- package/src/components/popover/PopoverContent.astro +50 -50
- package/src/components/popover/PopoverDescription.astro +18 -18
- package/src/components/popover/PopoverHeader.astro +18 -18
- package/src/components/popover/PopoverTitle.astro +18 -18
- package/src/components/popover/PopoverTrigger.astro +35 -35
- package/src/components/popover/index.ts +7 -7
- package/src/components/radio-group/CHANGELOG.md +31 -31
- package/src/components/radio-group/RadioGroup.astro +81 -81
- package/src/components/radio-group/RadioGroupItem.astro +51 -51
- package/src/components/radio-group/index.ts +3 -3
- package/src/components/select/CHANGELOG.md +39 -39
- package/src/components/select/Select.astro +373 -373
- package/src/components/select/SelectContent.astro +91 -91
- package/src/components/select/SelectGroup.astro +19 -19
- package/src/components/select/SelectItem.astro +48 -48
- package/src/components/select/SelectLabel.astro +18 -18
- package/src/components/select/SelectSeparator.astro +17 -17
- package/src/components/select/SelectTrigger.astro +34 -34
- package/src/components/select/SelectValue.astro +22 -22
- package/src/components/select/index.ts +8 -8
- package/src/components/separator/CHANGELOG.md +5 -5
- package/src/components/separator/Separator.astro +60 -60
- package/src/components/separator/index.ts +2 -2
- package/src/components/skeleton/CHANGELOG.md +5 -5
- package/src/components/skeleton/Skeleton.astro +121 -121
- package/src/components/skeleton/index.ts +1 -1
- package/src/components/slider/CHANGELOG.md +5 -5
- package/src/components/slider/Slider.astro +198 -198
- package/src/components/slider/index.ts +1 -1
- package/src/components/spinner/CHANGELOG.md +18 -18
- package/src/components/spinner/Spinner.astro +135 -135
- package/src/components/spinner/index.ts +1 -1
- package/src/components/sticky-surface/CHANGELOG.md +5 -5
- package/src/components/sticky-surface/StickySurface.astro +152 -152
- package/src/components/sticky-surface/index.ts +2 -2
- package/src/components/switch/CHANGELOG.md +29 -29
- package/src/components/switch/Switch.astro +106 -106
- package/src/components/switch/index.ts +1 -1
- package/src/components/table/CHANGELOG.md +24 -24
- package/src/components/table/Table.astro +358 -251
- package/src/components/table/TableBody.astro +17 -18
- package/src/components/table/TableBulkToolbar.astro +37 -0
- package/src/components/table/TableCaption.astro +17 -17
- package/src/components/table/TableCell.astro +45 -21
- package/src/components/table/TableCellText.astro +17 -0
- package/src/components/table/TableColumnMenu.astro +50 -0
- package/src/components/table/TableEditableCell.astro +287 -0
- package/src/components/table/TableEmpty.astro +17 -0
- package/src/components/table/TableFolderCell.astro +38 -0
- package/src/components/table/TableFooter.astro +21 -21
- package/src/components/table/TableHead.astro +90 -21
- package/src/components/table/TableHeader.astro +17 -17
- package/src/components/table/TablePagination.astro +57 -0
- package/src/components/table/TableRow.astro +52 -21
- package/src/components/table/TableSelectAllBanner.astro +34 -0
- package/src/components/table/TableSelectCell.astro +50 -0
- package/src/components/table/TableSkeletonRow.astro +21 -0
- package/src/components/table/index.ts +19 -9
- package/src/components/table/table-cell-variants.ts +29 -0
- package/src/components/tabs/CHANGELOG.md +5 -5
- package/src/components/tabs/Tabs.astro +306 -306
- package/src/components/tabs/TabsContent.astro +47 -47
- package/src/components/tabs/TabsList.astro +69 -69
- package/src/components/tabs/TabsTrigger.astro +40 -40
- package/src/components/tabs/index.ts +6 -6
- package/src/components/textarea/CHANGELOG.md +22 -22
- package/src/components/textarea/Textarea.astro +58 -58
- package/src/components/textarea/index.ts +2 -2
- package/src/components/toggle/CHANGELOG.md +23 -23
- package/src/components/toggle/Toggle.astro +150 -150
- package/src/components/toggle/index.ts +1 -1
- package/src/components/toggle-group/CHANGELOG.md +18 -18
- package/src/components/toggle-group/ToggleGroup.astro +236 -236
- package/src/components/toggle-group/ToggleGroupItem.astro +48 -48
- package/src/components/toggle-group/index.ts +2 -2
- package/src/components/tooltip/CHANGELOG.md +22 -22
- package/src/components/tooltip/Tooltip.astro +357 -357
- package/src/components/tooltip/TooltipContent.astro +85 -85
- package/src/components/tooltip/TooltipTrigger.astro +34 -34
- package/src/components/tooltip/index.ts +3 -3
- package/src/lib/table-controller.ts +1090 -0
- package/src/lib/toggle-group-controller.ts +113 -113
- package/src/lib/toggle-shared.ts +27 -27
- package/src/lib/utils.ts +6 -6
- package/src/styles/globals.css +209 -177
|
@@ -1,251 +1,358 @@
|
|
|
1
|
-
---
|
|
2
|
-
/**
|
|
3
|
-
* @component Table
|
|
4
|
-
* @title Table
|
|
5
|
-
* @description A responsive table
|
|
6
|
-
* @figmaUrl https://www.figma.com/design/qXkzdqZ3QPQqgckU3AwIAH/ClickLearn-Lightning-Design-Library?node-id=5548-9089
|
|
7
|
-
*
|
|
8
|
-
* @preview
|
|
9
|
-
*
|
|
10
|
-
* <Table>
|
|
11
|
-
* <TableCaption>A list of your recent invoices.</TableCaption>
|
|
12
|
-
* <TableHeader>
|
|
13
|
-
* <TableRow>
|
|
14
|
-
* <TableHead class="w-[100px]">Invoice</TableHead>
|
|
15
|
-
* <TableHead>Status</TableHead>
|
|
16
|
-
* <TableHead>Method</TableHead>
|
|
17
|
-
* <TableHead class="text-right">Amount</TableHead>
|
|
18
|
-
* </TableRow>
|
|
19
|
-
* </TableHeader>
|
|
20
|
-
* <TableBody>
|
|
21
|
-
* <TableRow>
|
|
22
|
-
* <TableCell class="font-medium">INV001</TableCell>
|
|
23
|
-
* <TableCell>Paid</TableCell>
|
|
24
|
-
* <TableCell>Credit Card</TableCell>
|
|
25
|
-
* <TableCell class="text-right">$250.00</TableCell>
|
|
26
|
-
* </TableRow>
|
|
27
|
-
* <TableRow>
|
|
28
|
-
* <TableCell class="font-medium">INV002</TableCell>
|
|
29
|
-
* <TableCell>Pending</TableCell>
|
|
30
|
-
* <TableCell>PayPal</TableCell>
|
|
31
|
-
* <TableCell class="text-right">$150.00</TableCell>
|
|
32
|
-
* </TableRow>
|
|
33
|
-
* <TableRow>
|
|
34
|
-
* <TableCell class="font-medium">INV003</TableCell>
|
|
35
|
-
* <TableCell>Unpaid</TableCell>
|
|
36
|
-
* <TableCell>Bank Transfer</TableCell>
|
|
37
|
-
* <TableCell class="text-right">$350.00</TableCell>
|
|
38
|
-
* </TableRow>
|
|
39
|
-
* <TableRow>
|
|
40
|
-
* <TableCell class="font-medium">INV004</TableCell>
|
|
41
|
-
* <TableCell>Paid</TableCell>
|
|
42
|
-
* <TableCell>Credit Card</TableCell>
|
|
43
|
-
* <TableCell class="text-right">$450.00</TableCell>
|
|
44
|
-
* </TableRow>
|
|
45
|
-
* <TableRow>
|
|
46
|
-
* <TableCell class="font-medium">INV005</TableCell>
|
|
47
|
-
* <TableCell>Paid</TableCell>
|
|
48
|
-
* <TableCell>PayPal</TableCell>
|
|
49
|
-
* <TableCell class="text-right">$550.00</TableCell>
|
|
50
|
-
* </TableRow>
|
|
51
|
-
* <TableRow>
|
|
52
|
-
* <TableCell class="font-medium">INV006</TableCell>
|
|
53
|
-
* <TableCell>Pending</TableCell>
|
|
54
|
-
* <TableCell>Bank Transfer</TableCell>
|
|
55
|
-
* <TableCell class="text-right">$200.00</TableCell>
|
|
56
|
-
* </TableRow>
|
|
57
|
-
* <TableRow>
|
|
58
|
-
* <TableCell class="font-medium">INV007</TableCell>
|
|
59
|
-
* <TableCell>Unpaid</TableCell>
|
|
60
|
-
* <TableCell>Credit Card</TableCell>
|
|
61
|
-
* <TableCell class="text-right">$300.00</TableCell>
|
|
62
|
-
* </TableRow>
|
|
63
|
-
* </TableBody>
|
|
64
|
-
* <TableFooter>
|
|
65
|
-
* <TableRow>
|
|
66
|
-
* <TableCell colspan={3}>Total</TableCell>
|
|
67
|
-
* <TableCell class="text-right">$2,500.00</TableCell>
|
|
68
|
-
* </TableRow>
|
|
69
|
-
* </TableFooter>
|
|
70
|
-
* </Table>
|
|
71
|
-
*
|
|
72
|
-
* @usage
|
|
73
|
-
*
|
|
74
|
-
* ```astro nocollapse
|
|
75
|
-
* ---
|
|
76
|
-
* import {
|
|
77
|
-
* Table,
|
|
78
|
-
* TableBody,
|
|
79
|
-
* TableCaption,
|
|
80
|
-
* TableCell,
|
|
81
|
-
* TableFooter,
|
|
82
|
-
* TableHead,
|
|
83
|
-
* TableHeader,
|
|
84
|
-
* TableRow,
|
|
85
|
-
* } from '@bejamas/ui/components/table';
|
|
86
|
-
*
|
|
87
|
-
* const invoices = [
|
|
88
|
-
* { invoice: "INV001", paymentStatus: "Paid", totalAmount: "$250.00", paymentMethod: "Credit Card" },
|
|
89
|
-
* { invoice: "INV002", paymentStatus: "Pending", totalAmount: "$150.00", paymentMethod: "PayPal" },
|
|
90
|
-
* { invoice: "INV003", paymentStatus: "Unpaid", totalAmount: "$350.00", paymentMethod: "Bank Transfer" },
|
|
91
|
-
* { invoice: "INV004", paymentStatus: "Paid", totalAmount: "$450.00", paymentMethod: "Credit Card" },
|
|
92
|
-
* { invoice: "INV005", paymentStatus: "Paid", totalAmount: "$550.00", paymentMethod: "PayPal" },
|
|
93
|
-
* { invoice: "INV006", paymentStatus: "Pending", totalAmount: "$200.00", paymentMethod: "Bank Transfer" },
|
|
94
|
-
* { invoice: "INV007", paymentStatus: "Unpaid", totalAmount: "$300.00", paymentMethod: "Credit Card" },
|
|
95
|
-
* ];
|
|
96
|
-
* ---
|
|
97
|
-
*
|
|
98
|
-
* <Table>
|
|
99
|
-
* <TableCaption>A list of your recent invoices.</TableCaption>
|
|
100
|
-
* <TableHeader>
|
|
101
|
-
* <TableRow>
|
|
102
|
-
* <TableHead class="w-[100px]">Invoice</TableHead>
|
|
103
|
-
* <TableHead>Status</TableHead>
|
|
104
|
-
* <TableHead>Method</TableHead>
|
|
105
|
-
* <TableHead class="text-right">Amount</TableHead>
|
|
106
|
-
* </TableRow>
|
|
107
|
-
* </TableHeader>
|
|
108
|
-
* <TableBody>
|
|
109
|
-
* {invoices.map((invoice) => (
|
|
110
|
-
* <TableRow>
|
|
111
|
-
* <TableCell class="font-medium">{invoice.invoice}</TableCell>
|
|
112
|
-
* <TableCell>{invoice.paymentStatus}</TableCell>
|
|
113
|
-
* <TableCell>{invoice.paymentMethod}</TableCell>
|
|
114
|
-
* <TableCell class="text-right">{invoice.totalAmount}</TableCell>
|
|
115
|
-
* </TableRow>
|
|
116
|
-
* ))}
|
|
117
|
-
* </TableBody>
|
|
118
|
-
* <TableFooter>
|
|
119
|
-
* <TableRow>
|
|
120
|
-
* <TableCell colspan={3}>Total</TableCell>
|
|
121
|
-
* <TableCell class="text-right">$2,500.00</TableCell>
|
|
122
|
-
* </TableRow>
|
|
123
|
-
* </TableFooter>
|
|
124
|
-
* </Table>
|
|
125
|
-
* ```
|
|
126
|
-
*
|
|
127
|
-
* @examples
|
|
128
|
-
*
|
|
129
|
-
* ### Footer
|
|
130
|
-
*
|
|
131
|
-
* Use the `<TableFooter />` component to add a footer to the table.
|
|
132
|
-
*
|
|
133
|
-
* <Table>
|
|
134
|
-
* <TableCaption>A list of your recent invoices.</TableCaption>
|
|
135
|
-
* <TableHeader>
|
|
136
|
-
* <TableRow>
|
|
137
|
-
* <TableHead class="w-[100px]">Invoice</TableHead>
|
|
138
|
-
* <TableHead>Status</TableHead>
|
|
139
|
-
* <TableHead>Method</TableHead>
|
|
140
|
-
* <TableHead class="text-right">Amount</TableHead>
|
|
141
|
-
* </TableRow>
|
|
142
|
-
* </TableHeader>
|
|
143
|
-
* <TableBody>
|
|
144
|
-
* <TableRow>
|
|
145
|
-
* <TableCell class="font-medium">INV001</TableCell>
|
|
146
|
-
* <TableCell>Paid</TableCell>
|
|
147
|
-
* <TableCell>Credit Card</TableCell>
|
|
148
|
-
* <TableCell class="text-right">$250.00</TableCell>
|
|
149
|
-
* </TableRow>
|
|
150
|
-
* <TableRow>
|
|
151
|
-
* <TableCell class="font-medium">INV002</TableCell>
|
|
152
|
-
* <TableCell>Pending</TableCell>
|
|
153
|
-
* <TableCell>PayPal</TableCell>
|
|
154
|
-
* <TableCell class="text-right">$150.00</TableCell>
|
|
155
|
-
* </TableRow>
|
|
156
|
-
* <TableRow>
|
|
157
|
-
* <TableCell class="font-medium">INV003</TableCell>
|
|
158
|
-
* <TableCell>Unpaid</TableCell>
|
|
159
|
-
* <TableCell>Bank Transfer</TableCell>
|
|
160
|
-
* <TableCell class="text-right">$350.00</TableCell>
|
|
161
|
-
* </TableRow>
|
|
162
|
-
* </TableBody>
|
|
163
|
-
* <TableFooter>
|
|
164
|
-
* <TableRow>
|
|
165
|
-
* <TableCell colspan={3}>Total</TableCell>
|
|
166
|
-
* <TableCell class="text-right">$2,500.00</TableCell>
|
|
167
|
-
* </TableRow>
|
|
168
|
-
* </TableFooter>
|
|
169
|
-
* </Table>
|
|
170
|
-
*
|
|
171
|
-
* ### Actions
|
|
172
|
-
*
|
|
173
|
-
* A table showing actions for each row using a `<DropdownMenu />` component.
|
|
174
|
-
*
|
|
175
|
-
* <Table>
|
|
176
|
-
* <TableHeader>
|
|
177
|
-
* <TableRow>
|
|
178
|
-
* <TableHead>Product</TableHead>
|
|
179
|
-
* <TableHead>Price</TableHead>
|
|
180
|
-
* <TableHead class="text-right">Actions</TableHead>
|
|
181
|
-
* </TableRow>
|
|
182
|
-
* </TableHeader>
|
|
183
|
-
* <TableBody>
|
|
184
|
-
* <TableRow>
|
|
185
|
-
* <TableCell class="font-medium">Wireless Mouse</TableCell>
|
|
186
|
-
* <TableCell>$29.99</TableCell>
|
|
187
|
-
* <TableCell class="text-right">
|
|
188
|
-
* <DropdownMenu>
|
|
189
|
-
* <DropdownMenuTrigger variant="ghost" size="icon" class="size-8" tailIcon={false}><EllipsisIcon /><span class="sr-only">Open menu</span></DropdownMenuTrigger>
|
|
190
|
-
* <DropdownMenuContent align="end">
|
|
191
|
-
* <DropdownMenuItem>Edit</DropdownMenuItem>
|
|
192
|
-
* <DropdownMenuItem>Duplicate</DropdownMenuItem>
|
|
193
|
-
* <DropdownMenuSeparator />
|
|
194
|
-
* <DropdownMenuItem class="text-destructive">Delete</DropdownMenuItem>
|
|
195
|
-
* </DropdownMenuContent>
|
|
196
|
-
* </DropdownMenu>
|
|
197
|
-
* </TableCell>
|
|
198
|
-
* </TableRow>
|
|
199
|
-
* <TableRow>
|
|
200
|
-
* <TableCell class="font-medium">Mechanical Keyboard</TableCell>
|
|
201
|
-
* <TableCell>$129.99</TableCell>
|
|
202
|
-
* <TableCell class="text-right">
|
|
203
|
-
* <DropdownMenu>
|
|
204
|
-
* <DropdownMenuTrigger variant="ghost" size="icon" class="size-8" tailIcon={false}><EllipsisIcon /><span class="sr-only">Open menu</span></DropdownMenuTrigger>
|
|
205
|
-
* <DropdownMenuContent align="end">
|
|
206
|
-
* <DropdownMenuItem>Edit</DropdownMenuItem>
|
|
207
|
-
* <DropdownMenuItem>Duplicate</DropdownMenuItem>
|
|
208
|
-
* <DropdownMenuSeparator />
|
|
209
|
-
* <DropdownMenuItem class="text-destructive">Delete</DropdownMenuItem>
|
|
210
|
-
* </DropdownMenuContent>
|
|
211
|
-
* </DropdownMenu>
|
|
212
|
-
* </TableCell>
|
|
213
|
-
* </TableRow>
|
|
214
|
-
* <TableRow>
|
|
215
|
-
* <TableCell class="font-medium">USB-C Hub</TableCell>
|
|
216
|
-
* <TableCell>$49.99</TableCell>
|
|
217
|
-
* <TableCell class="text-right">
|
|
218
|
-
* <DropdownMenu>
|
|
219
|
-
* <DropdownMenuTrigger variant="ghost" size="icon" class="size-8" tailIcon={false}><EllipsisIcon /><span class="sr-only">Open menu</span></DropdownMenuTrigger>
|
|
220
|
-
* <DropdownMenuContent align="end">
|
|
221
|
-
* <DropdownMenuItem>Edit</DropdownMenuItem>
|
|
222
|
-
* <DropdownMenuItem>Duplicate</DropdownMenuItem>
|
|
223
|
-
* <DropdownMenuSeparator />
|
|
224
|
-
* <DropdownMenuItem class="text-destructive">Delete</DropdownMenuItem>
|
|
225
|
-
* </DropdownMenuContent>
|
|
226
|
-
* </DropdownMenu>
|
|
227
|
-
* </TableCell>
|
|
228
|
-
* </TableRow>
|
|
229
|
-
* </TableBody>
|
|
230
|
-
* </Table>
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
<
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
1
|
+
---
|
|
2
|
+
/**
|
|
3
|
+
* @component Table
|
|
4
|
+
* @title Table
|
|
5
|
+
* @description A responsive table with compound parts. Set `interactive` to enable sorting, row selection, inline editing, tree rows, keyboard grid navigation, column resize/hide and pinned columns. Data stays server-driven: the table emits `table:*` events and the app re-renders rows.
|
|
6
|
+
* @figmaUrl https://www.figma.com/design/qXkzdqZ3QPQqgckU3AwIAH/ClickLearn-Lightning-Design-Library?node-id=5548-9089
|
|
7
|
+
*
|
|
8
|
+
* @preview
|
|
9
|
+
*
|
|
10
|
+
* <Table>
|
|
11
|
+
* <TableCaption>A list of your recent invoices.</TableCaption>
|
|
12
|
+
* <TableHeader>
|
|
13
|
+
* <TableRow>
|
|
14
|
+
* <TableHead class="w-[100px]">Invoice</TableHead>
|
|
15
|
+
* <TableHead>Status</TableHead>
|
|
16
|
+
* <TableHead>Method</TableHead>
|
|
17
|
+
* <TableHead class="text-right">Amount</TableHead>
|
|
18
|
+
* </TableRow>
|
|
19
|
+
* </TableHeader>
|
|
20
|
+
* <TableBody>
|
|
21
|
+
* <TableRow>
|
|
22
|
+
* <TableCell class="font-medium">INV001</TableCell>
|
|
23
|
+
* <TableCell>Paid</TableCell>
|
|
24
|
+
* <TableCell>Credit Card</TableCell>
|
|
25
|
+
* <TableCell class="text-right">$250.00</TableCell>
|
|
26
|
+
* </TableRow>
|
|
27
|
+
* <TableRow>
|
|
28
|
+
* <TableCell class="font-medium">INV002</TableCell>
|
|
29
|
+
* <TableCell>Pending</TableCell>
|
|
30
|
+
* <TableCell>PayPal</TableCell>
|
|
31
|
+
* <TableCell class="text-right">$150.00</TableCell>
|
|
32
|
+
* </TableRow>
|
|
33
|
+
* <TableRow>
|
|
34
|
+
* <TableCell class="font-medium">INV003</TableCell>
|
|
35
|
+
* <TableCell>Unpaid</TableCell>
|
|
36
|
+
* <TableCell>Bank Transfer</TableCell>
|
|
37
|
+
* <TableCell class="text-right">$350.00</TableCell>
|
|
38
|
+
* </TableRow>
|
|
39
|
+
* <TableRow>
|
|
40
|
+
* <TableCell class="font-medium">INV004</TableCell>
|
|
41
|
+
* <TableCell>Paid</TableCell>
|
|
42
|
+
* <TableCell>Credit Card</TableCell>
|
|
43
|
+
* <TableCell class="text-right">$450.00</TableCell>
|
|
44
|
+
* </TableRow>
|
|
45
|
+
* <TableRow>
|
|
46
|
+
* <TableCell class="font-medium">INV005</TableCell>
|
|
47
|
+
* <TableCell>Paid</TableCell>
|
|
48
|
+
* <TableCell>PayPal</TableCell>
|
|
49
|
+
* <TableCell class="text-right">$550.00</TableCell>
|
|
50
|
+
* </TableRow>
|
|
51
|
+
* <TableRow>
|
|
52
|
+
* <TableCell class="font-medium">INV006</TableCell>
|
|
53
|
+
* <TableCell>Pending</TableCell>
|
|
54
|
+
* <TableCell>Bank Transfer</TableCell>
|
|
55
|
+
* <TableCell class="text-right">$200.00</TableCell>
|
|
56
|
+
* </TableRow>
|
|
57
|
+
* <TableRow>
|
|
58
|
+
* <TableCell class="font-medium">INV007</TableCell>
|
|
59
|
+
* <TableCell>Unpaid</TableCell>
|
|
60
|
+
* <TableCell>Credit Card</TableCell>
|
|
61
|
+
* <TableCell class="text-right">$300.00</TableCell>
|
|
62
|
+
* </TableRow>
|
|
63
|
+
* </TableBody>
|
|
64
|
+
* <TableFooter>
|
|
65
|
+
* <TableRow>
|
|
66
|
+
* <TableCell colspan={3}>Total</TableCell>
|
|
67
|
+
* <TableCell class="text-right">$2,500.00</TableCell>
|
|
68
|
+
* </TableRow>
|
|
69
|
+
* </TableFooter>
|
|
70
|
+
* </Table>
|
|
71
|
+
*
|
|
72
|
+
* @usage
|
|
73
|
+
*
|
|
74
|
+
* ```astro nocollapse
|
|
75
|
+
* ---
|
|
76
|
+
* import {
|
|
77
|
+
* Table,
|
|
78
|
+
* TableBody,
|
|
79
|
+
* TableCaption,
|
|
80
|
+
* TableCell,
|
|
81
|
+
* TableFooter,
|
|
82
|
+
* TableHead,
|
|
83
|
+
* TableHeader,
|
|
84
|
+
* TableRow,
|
|
85
|
+
* } from '@bejamas/ui/components/table';
|
|
86
|
+
*
|
|
87
|
+
* const invoices = [
|
|
88
|
+
* { invoice: "INV001", paymentStatus: "Paid", totalAmount: "$250.00", paymentMethod: "Credit Card" },
|
|
89
|
+
* { invoice: "INV002", paymentStatus: "Pending", totalAmount: "$150.00", paymentMethod: "PayPal" },
|
|
90
|
+
* { invoice: "INV003", paymentStatus: "Unpaid", totalAmount: "$350.00", paymentMethod: "Bank Transfer" },
|
|
91
|
+
* { invoice: "INV004", paymentStatus: "Paid", totalAmount: "$450.00", paymentMethod: "Credit Card" },
|
|
92
|
+
* { invoice: "INV005", paymentStatus: "Paid", totalAmount: "$550.00", paymentMethod: "PayPal" },
|
|
93
|
+
* { invoice: "INV006", paymentStatus: "Pending", totalAmount: "$200.00", paymentMethod: "Bank Transfer" },
|
|
94
|
+
* { invoice: "INV007", paymentStatus: "Unpaid", totalAmount: "$300.00", paymentMethod: "Credit Card" },
|
|
95
|
+
* ];
|
|
96
|
+
* ---
|
|
97
|
+
*
|
|
98
|
+
* <Table>
|
|
99
|
+
* <TableCaption>A list of your recent invoices.</TableCaption>
|
|
100
|
+
* <TableHeader>
|
|
101
|
+
* <TableRow>
|
|
102
|
+
* <TableHead class="w-[100px]">Invoice</TableHead>
|
|
103
|
+
* <TableHead>Status</TableHead>
|
|
104
|
+
* <TableHead>Method</TableHead>
|
|
105
|
+
* <TableHead class="text-right">Amount</TableHead>
|
|
106
|
+
* </TableRow>
|
|
107
|
+
* </TableHeader>
|
|
108
|
+
* <TableBody>
|
|
109
|
+
* {invoices.map((invoice) => (
|
|
110
|
+
* <TableRow>
|
|
111
|
+
* <TableCell class="font-medium">{invoice.invoice}</TableCell>
|
|
112
|
+
* <TableCell>{invoice.paymentStatus}</TableCell>
|
|
113
|
+
* <TableCell>{invoice.paymentMethod}</TableCell>
|
|
114
|
+
* <TableCell class="text-right">{invoice.totalAmount}</TableCell>
|
|
115
|
+
* </TableRow>
|
|
116
|
+
* ))}
|
|
117
|
+
* </TableBody>
|
|
118
|
+
* <TableFooter>
|
|
119
|
+
* <TableRow>
|
|
120
|
+
* <TableCell colspan={3}>Total</TableCell>
|
|
121
|
+
* <TableCell class="text-right">$2,500.00</TableCell>
|
|
122
|
+
* </TableRow>
|
|
123
|
+
* </TableFooter>
|
|
124
|
+
* </Table>
|
|
125
|
+
* ```
|
|
126
|
+
*
|
|
127
|
+
* @examples
|
|
128
|
+
*
|
|
129
|
+
* ### Footer
|
|
130
|
+
*
|
|
131
|
+
* Use the `<TableFooter />` component to add a footer to the table.
|
|
132
|
+
*
|
|
133
|
+
* <Table>
|
|
134
|
+
* <TableCaption>A list of your recent invoices.</TableCaption>
|
|
135
|
+
* <TableHeader>
|
|
136
|
+
* <TableRow>
|
|
137
|
+
* <TableHead class="w-[100px]">Invoice</TableHead>
|
|
138
|
+
* <TableHead>Status</TableHead>
|
|
139
|
+
* <TableHead>Method</TableHead>
|
|
140
|
+
* <TableHead class="text-right">Amount</TableHead>
|
|
141
|
+
* </TableRow>
|
|
142
|
+
* </TableHeader>
|
|
143
|
+
* <TableBody>
|
|
144
|
+
* <TableRow>
|
|
145
|
+
* <TableCell class="font-medium">INV001</TableCell>
|
|
146
|
+
* <TableCell>Paid</TableCell>
|
|
147
|
+
* <TableCell>Credit Card</TableCell>
|
|
148
|
+
* <TableCell class="text-right">$250.00</TableCell>
|
|
149
|
+
* </TableRow>
|
|
150
|
+
* <TableRow>
|
|
151
|
+
* <TableCell class="font-medium">INV002</TableCell>
|
|
152
|
+
* <TableCell>Pending</TableCell>
|
|
153
|
+
* <TableCell>PayPal</TableCell>
|
|
154
|
+
* <TableCell class="text-right">$150.00</TableCell>
|
|
155
|
+
* </TableRow>
|
|
156
|
+
* <TableRow>
|
|
157
|
+
* <TableCell class="font-medium">INV003</TableCell>
|
|
158
|
+
* <TableCell>Unpaid</TableCell>
|
|
159
|
+
* <TableCell>Bank Transfer</TableCell>
|
|
160
|
+
* <TableCell class="text-right">$350.00</TableCell>
|
|
161
|
+
* </TableRow>
|
|
162
|
+
* </TableBody>
|
|
163
|
+
* <TableFooter>
|
|
164
|
+
* <TableRow>
|
|
165
|
+
* <TableCell colspan={3}>Total</TableCell>
|
|
166
|
+
* <TableCell class="text-right">$2,500.00</TableCell>
|
|
167
|
+
* </TableRow>
|
|
168
|
+
* </TableFooter>
|
|
169
|
+
* </Table>
|
|
170
|
+
*
|
|
171
|
+
* ### Actions
|
|
172
|
+
*
|
|
173
|
+
* A table showing actions for each row using a `<DropdownMenu />` component.
|
|
174
|
+
*
|
|
175
|
+
* <Table>
|
|
176
|
+
* <TableHeader>
|
|
177
|
+
* <TableRow>
|
|
178
|
+
* <TableHead>Product</TableHead>
|
|
179
|
+
* <TableHead>Price</TableHead>
|
|
180
|
+
* <TableHead class="text-right">Actions</TableHead>
|
|
181
|
+
* </TableRow>
|
|
182
|
+
* </TableHeader>
|
|
183
|
+
* <TableBody>
|
|
184
|
+
* <TableRow>
|
|
185
|
+
* <TableCell class="font-medium">Wireless Mouse</TableCell>
|
|
186
|
+
* <TableCell>$29.99</TableCell>
|
|
187
|
+
* <TableCell class="text-right">
|
|
188
|
+
* <DropdownMenu>
|
|
189
|
+
* <DropdownMenuTrigger variant="ghost" size="icon" class="size-8" tailIcon={false}><EllipsisIcon /><span class="sr-only">Open menu</span></DropdownMenuTrigger>
|
|
190
|
+
* <DropdownMenuContent align="end">
|
|
191
|
+
* <DropdownMenuItem>Edit</DropdownMenuItem>
|
|
192
|
+
* <DropdownMenuItem>Duplicate</DropdownMenuItem>
|
|
193
|
+
* <DropdownMenuSeparator />
|
|
194
|
+
* <DropdownMenuItem class="text-destructive">Delete</DropdownMenuItem>
|
|
195
|
+
* </DropdownMenuContent>
|
|
196
|
+
* </DropdownMenu>
|
|
197
|
+
* </TableCell>
|
|
198
|
+
* </TableRow>
|
|
199
|
+
* <TableRow>
|
|
200
|
+
* <TableCell class="font-medium">Mechanical Keyboard</TableCell>
|
|
201
|
+
* <TableCell>$129.99</TableCell>
|
|
202
|
+
* <TableCell class="text-right">
|
|
203
|
+
* <DropdownMenu>
|
|
204
|
+
* <DropdownMenuTrigger variant="ghost" size="icon" class="size-8" tailIcon={false}><EllipsisIcon /><span class="sr-only">Open menu</span></DropdownMenuTrigger>
|
|
205
|
+
* <DropdownMenuContent align="end">
|
|
206
|
+
* <DropdownMenuItem>Edit</DropdownMenuItem>
|
|
207
|
+
* <DropdownMenuItem>Duplicate</DropdownMenuItem>
|
|
208
|
+
* <DropdownMenuSeparator />
|
|
209
|
+
* <DropdownMenuItem class="text-destructive">Delete</DropdownMenuItem>
|
|
210
|
+
* </DropdownMenuContent>
|
|
211
|
+
* </DropdownMenu>
|
|
212
|
+
* </TableCell>
|
|
213
|
+
* </TableRow>
|
|
214
|
+
* <TableRow>
|
|
215
|
+
* <TableCell class="font-medium">USB-C Hub</TableCell>
|
|
216
|
+
* <TableCell>$49.99</TableCell>
|
|
217
|
+
* <TableCell class="text-right">
|
|
218
|
+
* <DropdownMenu>
|
|
219
|
+
* <DropdownMenuTrigger variant="ghost" size="icon" class="size-8" tailIcon={false}><EllipsisIcon /><span class="sr-only">Open menu</span></DropdownMenuTrigger>
|
|
220
|
+
* <DropdownMenuContent align="end">
|
|
221
|
+
* <DropdownMenuItem>Edit</DropdownMenuItem>
|
|
222
|
+
* <DropdownMenuItem>Duplicate</DropdownMenuItem>
|
|
223
|
+
* <DropdownMenuSeparator />
|
|
224
|
+
* <DropdownMenuItem class="text-destructive">Delete</DropdownMenuItem>
|
|
225
|
+
* </DropdownMenuContent>
|
|
226
|
+
* </DropdownMenu>
|
|
227
|
+
* </TableCell>
|
|
228
|
+
* </TableRow>
|
|
229
|
+
* </TableBody>
|
|
230
|
+
* </Table>
|
|
231
|
+
*
|
|
232
|
+
* ### Interactive (sorting, selection, inline editing)
|
|
233
|
+
*
|
|
234
|
+
* The table never sorts, pages or saves data itself. It emits events on the root and the app responds:
|
|
235
|
+
*
|
|
236
|
+
* ```astro nocollapse
|
|
237
|
+
* <Table interactive stickyHeader pinnedColumns={2} maxHeight="480px" aria-label="Invoices">
|
|
238
|
+
* <TableBulkToolbar slot="bulk">
|
|
239
|
+
* <Button variant="outline" size="sm">Export .csv</Button>
|
|
240
|
+
* </TableBulkToolbar>
|
|
241
|
+
* <TableHeader>
|
|
242
|
+
* <TableRow>
|
|
243
|
+
* <TableSelectCell header />
|
|
244
|
+
* <TableHead column="name" sortable resizable>Name</TableHead>
|
|
245
|
+
* <TableHead column="status">Status</TableHead>
|
|
246
|
+
* <TableHead column="amount" align="right" sortable>Amount</TableHead>
|
|
247
|
+
* </TableRow>
|
|
248
|
+
* </TableHeader>
|
|
249
|
+
* <TableBody>
|
|
250
|
+
* <TableRow rowId="inv-1">
|
|
251
|
+
* <TableSelectCell />
|
|
252
|
+
* <TableEditableCell column="name" value="INV-00104" required />
|
|
253
|
+
* <TableEditableCell column="status" editor="select" value="paid" options={statusOptions} />
|
|
254
|
+
* <TableCell column="amount" align="right" numeric>$0.00</TableCell>
|
|
255
|
+
* </TableRow>
|
|
256
|
+
* </TableBody>
|
|
257
|
+
* </Table>
|
|
258
|
+
*
|
|
259
|
+
* <script>
|
|
260
|
+
* const table = document.querySelector('[data-slot="table-root"]');
|
|
261
|
+
* table.addEventListener("table:sort", (e) => refetch({ sort: e.detail }));
|
|
262
|
+
* table.addEventListener("table:edit", (e) => e.detail.respond(api.patch(e.detail)));
|
|
263
|
+
* </script>
|
|
264
|
+
* ```
|
|
265
|
+
*/
|
|
266
|
+
|
|
267
|
+
import { cn } from "@cl-light-ds/ui/lib/utils";
|
|
268
|
+
import type { HTMLAttributes } from "astro/types";
|
|
269
|
+
|
|
270
|
+
interface Props extends HTMLAttributes<"table"> {
|
|
271
|
+
class?: string;
|
|
272
|
+
/** Enables the table controller: sorting, selection, editing, tree rows, keyboard grid, resize/hide. */
|
|
273
|
+
interactive?: boolean;
|
|
274
|
+
/** Keeps the header row visible while the table body scrolls. Pair with `maxHeight`. */
|
|
275
|
+
stickyHeader?: boolean;
|
|
276
|
+
/** Number of leading columns pinned while scrolling horizontally. */
|
|
277
|
+
pinnedColumns?: number;
|
|
278
|
+
/** Max height of the scroll container, e.g. "480px". Needed for a sticky header inside the table. */
|
|
279
|
+
maxHeight?: string;
|
|
280
|
+
/** Marks the table busy (aria-busy) and dims the body while the server responds. */
|
|
281
|
+
loading?: boolean;
|
|
282
|
+
/** Total result count across all pages, used by the "Select all N results" banner. */
|
|
283
|
+
totalCount?: number;
|
|
284
|
+
/** Class for the outer wrapper that holds toolbar, table and pagination. */
|
|
285
|
+
rootClass?: string;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
const {
|
|
289
|
+
class: className = "",
|
|
290
|
+
interactive = false,
|
|
291
|
+
stickyHeader = false,
|
|
292
|
+
pinnedColumns = 0,
|
|
293
|
+
maxHeight,
|
|
294
|
+
loading = false,
|
|
295
|
+
totalCount,
|
|
296
|
+
rootClass = "",
|
|
297
|
+
...rest
|
|
298
|
+
} = Astro.props as Props;
|
|
299
|
+
|
|
300
|
+
const hasToolbar = Astro.slots.has("toolbar");
|
|
301
|
+
const hasBulk = Astro.slots.has("bulk");
|
|
302
|
+
const hasBanner = Astro.slots.has("banner");
|
|
303
|
+
const hasPagination = Astro.slots.has("pagination");
|
|
304
|
+
---
|
|
305
|
+
|
|
306
|
+
<div
|
|
307
|
+
data-slot="table-root"
|
|
308
|
+
data-interactive={interactive ? "" : undefined}
|
|
309
|
+
data-sticky-header={stickyHeader ? "" : undefined}
|
|
310
|
+
data-pinned-columns={pinnedColumns || undefined}
|
|
311
|
+
data-loading={loading ? "" : undefined}
|
|
312
|
+
data-total-count={totalCount}
|
|
313
|
+
class={cn("group/table relative flex w-full flex-col", rootClass)}
|
|
314
|
+
>
|
|
315
|
+
{
|
|
316
|
+
(hasToolbar || hasBulk) && (
|
|
317
|
+
<div data-slot="table-toolbar-region" class="flex min-h-14 flex-col justify-center">
|
|
318
|
+
{hasToolbar && (
|
|
319
|
+
<div data-slot="table-toolbar" class="group-data-[has-selection]/table:hidden">
|
|
320
|
+
<slot name="toolbar" />
|
|
321
|
+
</div>
|
|
322
|
+
)}
|
|
323
|
+
{hasBulk && (
|
|
324
|
+
<div data-slot="table-bulk-region" class="hidden group-data-[has-selection]/table:block">
|
|
325
|
+
<slot name="bulk" />
|
|
326
|
+
</div>
|
|
327
|
+
)}
|
|
328
|
+
</div>
|
|
329
|
+
)
|
|
330
|
+
}
|
|
331
|
+
{hasBanner && <slot name="banner" />}
|
|
332
|
+
<div
|
|
333
|
+
data-slot="table-container"
|
|
334
|
+
class="relative w-full overflow-auto"
|
|
335
|
+
style={maxHeight ? `max-height: ${maxHeight}` : undefined}
|
|
336
|
+
>
|
|
337
|
+
<table
|
|
338
|
+
data-slot="table"
|
|
339
|
+
aria-busy={loading ? "true" : undefined}
|
|
340
|
+
class={cn(
|
|
341
|
+
"w-full caption-bottom border-separate border-spacing-0 text-sm",
|
|
342
|
+
"[&_tbody]:transition-opacity group-data-[loading]/table:[&_tbody]:opacity-50",
|
|
343
|
+
className,
|
|
344
|
+
)}
|
|
345
|
+
{...rest}
|
|
346
|
+
>
|
|
347
|
+
<slot />
|
|
348
|
+
</table>
|
|
349
|
+
</div>
|
|
350
|
+
{hasPagination && <slot name="pagination" />}
|
|
351
|
+
{interactive && <div data-slot="table-live" class="sr-only" aria-live="polite" aria-atomic="true" />}
|
|
352
|
+
</div>
|
|
353
|
+
|
|
354
|
+
<script>
|
|
355
|
+
import { initTables } from "@cl-light-ds/ui/lib/table-controller";
|
|
356
|
+
|
|
357
|
+
initTables();
|
|
358
|
+
</script>
|
|
@@ -1,18 +1,17 @@
|
|
|
1
|
-
---
|
|
2
|
-
import { cn } from "@cl-light-ds/ui/lib/utils";
|
|
3
|
-
import type { HTMLAttributes } from "astro/types";
|
|
4
|
-
|
|
5
|
-
interface Props extends HTMLAttributes<"tbody"> {
|
|
6
|
-
class?: string;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
const {
|
|
10
|
-
class: className = "",
|
|
11
|
-
...rest
|
|
12
|
-
} = Astro.props as Props;
|
|
13
|
-
---
|
|
14
|
-
|
|
15
|
-
<tbody data-slot="table-body" class={cn("
|
|
16
|
-
<slot />
|
|
17
|
-
</tbody>
|
|
18
|
-
|
|
1
|
+
---
|
|
2
|
+
import { cn } from "@cl-light-ds/ui/lib/utils";
|
|
3
|
+
import type { HTMLAttributes } from "astro/types";
|
|
4
|
+
|
|
5
|
+
interface Props extends HTMLAttributes<"tbody"> {
|
|
6
|
+
class?: string;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const {
|
|
10
|
+
class: className = "",
|
|
11
|
+
...rest
|
|
12
|
+
} = Astro.props as Props;
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
<tbody data-slot="table-body" class={cn("", className)} {...rest}>
|
|
16
|
+
<slot />
|
|
17
|
+
</tbody>
|