@knkcs/anker 1.10.0 → 1.10.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.
|
@@ -241,6 +241,31 @@ interface DateCellProps {
|
|
|
241
241
|
}
|
|
242
242
|
declare const DateCell: React__default.FC<DateCellProps>;
|
|
243
243
|
|
|
244
|
+
interface DeviceCellProps {
|
|
245
|
+
/** Raw User-Agent string. Null/empty renders the empty cell value. */
|
|
246
|
+
userAgent: string | null | undefined;
|
|
247
|
+
/** Optional badge displayed to the right of the primary line (e.g. "Current"). */
|
|
248
|
+
badge?: {
|
|
249
|
+
label: string;
|
|
250
|
+
colorPalette?: string;
|
|
251
|
+
};
|
|
252
|
+
}
|
|
253
|
+
declare const DeviceCell: React__default.FC<DeviceCellProps>;
|
|
254
|
+
|
|
255
|
+
interface IdentityCellProps {
|
|
256
|
+
/** Primary display name. Null/undefined renders the empty cell value. */
|
|
257
|
+
name: string | null | undefined;
|
|
258
|
+
/** Optional secondary line below the name (e.g., email, ID). */
|
|
259
|
+
subText?: React__default.ReactNode;
|
|
260
|
+
/** Avatar image source URL. */
|
|
261
|
+
avatarSrc?: string;
|
|
262
|
+
/** Initials shown as the avatar fallback. Auto-derived from `name` when omitted. */
|
|
263
|
+
avatarFallback?: string;
|
|
264
|
+
/** Avatar size; defaults to "sm" to match table density. */
|
|
265
|
+
size?: "sm" | "md";
|
|
266
|
+
}
|
|
267
|
+
declare const IdentityCell: React__default.FC<IdentityCellProps>;
|
|
268
|
+
|
|
244
269
|
interface LinkCellProps {
|
|
245
270
|
/** Route path for navigation. Renders em-dash when null/undefined. */
|
|
246
271
|
to: string | null | undefined;
|
|
@@ -334,6 +359,22 @@ interface UrlCellProps {
|
|
|
334
359
|
}
|
|
335
360
|
declare const UrlCell: React__default.FC<UrlCellProps>;
|
|
336
361
|
|
|
362
|
+
/**
|
|
363
|
+
* Parse a User-Agent string into a coarse browser + OS label.
|
|
364
|
+
*
|
|
365
|
+
* Used by `DeviceCell` to render "Chrome on macOS" style labels in
|
|
366
|
+
* sessions / device lists. The matchers are intentionally simple —
|
|
367
|
+
* they cover the common power-user browsers (Chrome, Safari, Firefox,
|
|
368
|
+
* Edge, Opera) on the common platforms (macOS, Windows, iOS, Android,
|
|
369
|
+
* Linux). Unknown browsers return `"Unknown"`; unknown OSes return `""`.
|
|
370
|
+
*/
|
|
371
|
+
declare function parseUserAgent(ua: string | undefined | null): {
|
|
372
|
+
browser: string;
|
|
373
|
+
os: string;
|
|
374
|
+
};
|
|
375
|
+
/** Format a parsed UA into the "Chrome on macOS" style label. */
|
|
376
|
+
declare function formatUserAgent(ua: string | undefined | null): string;
|
|
377
|
+
|
|
337
378
|
interface DataTableProps<T extends Record<string, unknown>> {
|
|
338
379
|
/** Column definitions for TanStack Table */
|
|
339
380
|
columns: ColumnDef<T, unknown>[];
|
|
@@ -908,4 +949,4 @@ interface WidgetProps {
|
|
|
908
949
|
}
|
|
909
950
|
declare const Widget: React__default.FC<WidgetProps>;
|
|
910
951
|
|
|
911
|
-
export { ActionCell, type ActionCellAction, type ActionCellProps, BooleanCell, type BooleanCellProps, BulkActionBar, type BulkActionBarProps, type BulkActionProps, type BulkPopoverActionProps, Card, CardList, CardListData, type CardListDataProps, CardListItem, type CardListItemProps, type CardListMenuItem, type CardListProps, type CardProps, ChipPicker, type ChipPickerProps, CodeCell, type CodeCellProps, ColorSwatchCell, type ColorSwatchCellProps, ContextRail, type ContextRailHeaderProps, type ContextRailProps, type ContextRailSectionProps, CountCell, type CountCellProps, DataTable, type DataTableProps, DateCell, type DateCellProps, type DrawerProps, DrawerRoot, FactBox, type FactBoxAction, type FactBoxProps, InlineCreatableList, type InlineCreatableListProps, LabeledSwitch, type LabeledSwitchProps, LinkCell, type LinkCellProps, MenuCell, type MenuCellAction, type MenuCellProps, Modal, type ModalProps, NumberCell, type NumberCellProps, Pagination, type PaginationProps, SelectableCard, type SelectableCardBodyProps, type SelectableCardFooterProps, type SelectableCardProps, type SelectableCardThumbnailProps, Sidebar, type SidebarItemProps, type SidebarLogoProps, type SidebarSectionProps$1 as SidebarNavSectionProps, type SidebarProps, SidebarSection, type SidebarSectionProps, type SidebarUserMenuItemProps, type SidebarUserMenuProps, SlugCell, type SlugCellProps, StatusBadgeCell, type StatusBadgeCellProps, Stepper, StepperCompleted, StepperContainer, StepperContent, type StepperContentProps, StepperIcon, type StepperIconProps, type StepperProps, StepperProvider, StepperSeparator, type StepperSeparatorProps, StepperStep, type StepperStepProps, StepperStepTitle, StepperSteps, type StepperStepsProps, SwitchCell, type SwitchCellProps, CardList as Table, CardListData as TableData, type CardListDataProps as TableDataProps, CardListItem as TableItem, type CardListItemProps as TableItemProps, type CardListMenuItem as TableMenuItem, type CardListProps as TableProps, TimelineConnector, TimelineContent, TimelineDescription, TimelineIndicator, TimelineItem, type TimelineItemProps, TimelineRoot, type TimelineRootProps, TimelineSeparator, TimelineTitle, Toolbar, type ToolbarFilterChipProps, type ToolbarSearchProps, TreeViewBranch, TreeViewBranchContent, TreeViewBranchControl, TreeViewBranchIndicator, type TreeViewBranchProps, TreeViewBranchText, TreeViewBranchTrigger, TreeViewItem, TreeViewItemIndicator, type TreeViewItemProps, TreeViewItemText, TreeViewLabel, TreeViewNode, TreeViewRoot, type TreeViewRootProps, TreeViewTree, TruncatedTextCell, type TruncatedTextCellProps, UploadDropZone, type UploadDropZoneProps, UrlCell, type UrlCellProps, type UseStepProps, type UseStepperProps, type UseStepperReturn, Widget, type WidgetProps, emptyCellValue, pluralize, truncateText, useSidebarContext, useStep, useStepper, useStepperContext, useStepperNextButton, useStepperPrevButton };
|
|
952
|
+
export { ActionCell, type ActionCellAction, type ActionCellProps, BooleanCell, type BooleanCellProps, BulkActionBar, type BulkActionBarProps, type BulkActionProps, type BulkPopoverActionProps, Card, CardList, CardListData, type CardListDataProps, CardListItem, type CardListItemProps, type CardListMenuItem, type CardListProps, type CardProps, ChipPicker, type ChipPickerProps, CodeCell, type CodeCellProps, ColorSwatchCell, type ColorSwatchCellProps, ContextRail, type ContextRailHeaderProps, type ContextRailProps, type ContextRailSectionProps, CountCell, type CountCellProps, DataTable, type DataTableProps, DateCell, type DateCellProps, DeviceCell, type DeviceCellProps, type DrawerProps, DrawerRoot, FactBox, type FactBoxAction, type FactBoxProps, IdentityCell, type IdentityCellProps, InlineCreatableList, type InlineCreatableListProps, LabeledSwitch, type LabeledSwitchProps, LinkCell, type LinkCellProps, MenuCell, type MenuCellAction, type MenuCellProps, Modal, type ModalProps, NumberCell, type NumberCellProps, Pagination, type PaginationProps, SelectableCard, type SelectableCardBodyProps, type SelectableCardFooterProps, type SelectableCardProps, type SelectableCardThumbnailProps, Sidebar, type SidebarItemProps, type SidebarLogoProps, type SidebarSectionProps$1 as SidebarNavSectionProps, type SidebarProps, SidebarSection, type SidebarSectionProps, type SidebarUserMenuItemProps, type SidebarUserMenuProps, SlugCell, type SlugCellProps, StatusBadgeCell, type StatusBadgeCellProps, Stepper, StepperCompleted, StepperContainer, StepperContent, type StepperContentProps, StepperIcon, type StepperIconProps, type StepperProps, StepperProvider, StepperSeparator, type StepperSeparatorProps, StepperStep, type StepperStepProps, StepperStepTitle, StepperSteps, type StepperStepsProps, SwitchCell, type SwitchCellProps, CardList as Table, CardListData as TableData, type CardListDataProps as TableDataProps, CardListItem as TableItem, type CardListItemProps as TableItemProps, type CardListMenuItem as TableMenuItem, type CardListProps as TableProps, TimelineConnector, TimelineContent, TimelineDescription, TimelineIndicator, TimelineItem, type TimelineItemProps, TimelineRoot, type TimelineRootProps, TimelineSeparator, TimelineTitle, Toolbar, type ToolbarFilterChipProps, type ToolbarSearchProps, TreeViewBranch, TreeViewBranchContent, TreeViewBranchControl, TreeViewBranchIndicator, type TreeViewBranchProps, TreeViewBranchText, TreeViewBranchTrigger, TreeViewItem, TreeViewItemIndicator, type TreeViewItemProps, TreeViewItemText, TreeViewLabel, TreeViewNode, TreeViewRoot, type TreeViewRootProps, TreeViewTree, TruncatedTextCell, type TruncatedTextCellProps, UploadDropZone, type UploadDropZoneProps, UrlCell, type UrlCellProps, type UseStepProps, type UseStepperProps, type UseStepperReturn, Widget, type WidgetProps, emptyCellValue, formatUserAgent, parseUserAgent, pluralize, truncateText, useSidebarContext, useStep, useStepper, useStepperContext, useStepperNextButton, useStepperPrevButton };
|
package/dist/components/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { Collapsible, Skeleton, Separator, Checkbox as Checkbox$1 } from '../chunk-TXGJ7BNX.js';
|
|
2
2
|
import { formatRelativeDateTime, StatusBadge } from '../chunk-ELQTHWXC.js';
|
|
3
|
-
import { MenuItem, MenuRoot, MenuTrigger, MenuContent, Tooltip, Table } from '../chunk-2ZWZ2WAS.js';
|
|
3
|
+
import { MenuItem, MenuRoot, MenuTrigger, MenuContent, Tooltip, Badge, Avatar, Table } from '../chunk-2ZWZ2WAS.js';
|
|
4
4
|
import { Popover, PopoverTrigger, PopoverContent, PopoverBody, Switch } from '../chunk-WQIEF5N3.js';
|
|
5
5
|
import { text_input_default } from '../chunk-OU6H3KU4.js';
|
|
6
6
|
import { Button, IconButton } from '../chunk-JS7ZEZV3.js';
|
|
7
7
|
export { AuthCard, PageHeader } from '../chunk-D5ICTOCW.js';
|
|
8
|
-
import { Box, Flex, Heading, Text, HStack, Grid, GridItem, Code,
|
|
8
|
+
import { Box, Flex, Heading, Text, HStack, Grid, GridItem, Code, VStack, Link, Spacer, Stack } from '../chunk-G4QMIXLC.js';
|
|
9
9
|
import { PanelRightOpen, PanelRightClose, ChevronRight, Search, PanelLeftOpen, PanelLeftClose, X, Ellipsis, Plus, ChevronLeft, ArrowUp, ArrowDown, ArrowUpDown, ChevronDown, Check, Upload } from 'lucide-react';
|
|
10
10
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
11
11
|
import { createContext as createContext$1, Timeline, TreeView, Card as Card$1, Menu, Portal, Checkbox, Drawer, ButtonGroup, Dialog, useSlotRecipe, chakra } from '@chakra-ui/react';
|
|
@@ -699,6 +699,66 @@ var DateCell = ({
|
|
|
699
699
|
return /* @__PURE__ */ jsx("span", { children: formatted });
|
|
700
700
|
};
|
|
701
701
|
DateCell.displayName = "DateCell";
|
|
702
|
+
|
|
703
|
+
// src/components/data-table/cells/user-agent.ts
|
|
704
|
+
function parseUserAgent(ua) {
|
|
705
|
+
if (!ua) return { browser: "Unknown", os: "" };
|
|
706
|
+
let browser = "Unknown";
|
|
707
|
+
if (/Edg\//.test(ua)) browser = "Edge";
|
|
708
|
+
else if (/Firefox\//.test(ua)) browser = "Firefox";
|
|
709
|
+
else if (/OPR\/|Opera/.test(ua)) browser = "Opera";
|
|
710
|
+
else if (/Chrome\//.test(ua)) browser = "Chrome";
|
|
711
|
+
else if (/Safari\//.test(ua)) browser = "Safari";
|
|
712
|
+
let os = "";
|
|
713
|
+
if (/Windows NT/.test(ua)) os = "Windows";
|
|
714
|
+
else if (/iPhone|iPad/.test(ua)) os = "iOS";
|
|
715
|
+
else if (/Mac OS X|Macintosh/.test(ua)) os = "macOS";
|
|
716
|
+
else if (/Android/.test(ua)) os = "Android";
|
|
717
|
+
else if (/Linux/.test(ua)) os = "Linux";
|
|
718
|
+
return { browser, os };
|
|
719
|
+
}
|
|
720
|
+
function formatUserAgent(ua) {
|
|
721
|
+
const { browser, os } = parseUserAgent(ua);
|
|
722
|
+
return os ? `${browser} on ${os}` : browser;
|
|
723
|
+
}
|
|
724
|
+
var DeviceCell = ({ userAgent, badge }) => {
|
|
725
|
+
if (userAgent == null || userAgent === "") {
|
|
726
|
+
return /* @__PURE__ */ jsx("span", { children: emptyCellValue });
|
|
727
|
+
}
|
|
728
|
+
const label = formatUserAgent(userAgent);
|
|
729
|
+
return /* @__PURE__ */ jsx(Tooltip, { content: userAgent, showArrow: true, children: /* @__PURE__ */ jsxs(VStack, { align: "start", gap: 0, children: [
|
|
730
|
+
/* @__PURE__ */ jsxs(HStack, { gap: 2, align: "center", children: [
|
|
731
|
+
/* @__PURE__ */ jsx(Text, { fontSize: "sm", fontWeight: "medium", lineClamp: 1, children: label }),
|
|
732
|
+
badge && /* @__PURE__ */ jsx(Badge, { colorPalette: badge.colorPalette, size: "xs", children: badge.label })
|
|
733
|
+
] }),
|
|
734
|
+
/* @__PURE__ */ jsx(Text, { fontSize: "xs", color: "fg.muted", lineClamp: 1, children: userAgent })
|
|
735
|
+
] }) });
|
|
736
|
+
};
|
|
737
|
+
DeviceCell.displayName = "DeviceCell";
|
|
738
|
+
function deriveInitials(name) {
|
|
739
|
+
const parts = name.trim().split(/\s+/).filter(Boolean);
|
|
740
|
+
if (parts.length === 0) return "";
|
|
741
|
+
if (parts.length === 1) return parts[0].slice(0, 2).toUpperCase();
|
|
742
|
+
return (parts[0][0] + parts[parts.length - 1][0]).toUpperCase();
|
|
743
|
+
}
|
|
744
|
+
var IdentityCell = ({
|
|
745
|
+
name,
|
|
746
|
+
subText,
|
|
747
|
+
avatarSrc,
|
|
748
|
+
avatarFallback,
|
|
749
|
+
size = "sm"
|
|
750
|
+
}) => {
|
|
751
|
+
if (name == null) return /* @__PURE__ */ jsx("span", { children: emptyCellValue });
|
|
752
|
+
const initials = avatarFallback ?? deriveInitials(name);
|
|
753
|
+
return /* @__PURE__ */ jsxs(HStack, { gap: 2, align: "center", children: [
|
|
754
|
+
/* @__PURE__ */ jsx(Avatar, { size, name, src: avatarSrc, fallback: initials }),
|
|
755
|
+
/* @__PURE__ */ jsxs(VStack, { align: "start", gap: 0, children: [
|
|
756
|
+
/* @__PURE__ */ jsx(Text, { fontSize: "sm", fontWeight: "semibold", lineClamp: 1, children: name }),
|
|
757
|
+
subText != null && /* @__PURE__ */ jsx(Text, { fontSize: "xs", color: "fg.muted", lineClamp: 1, children: subText })
|
|
758
|
+
] })
|
|
759
|
+
] });
|
|
760
|
+
};
|
|
761
|
+
IdentityCell.displayName = "IdentityCell";
|
|
702
762
|
var LinkCell = ({ to, label }) => {
|
|
703
763
|
if (to == null) return /* @__PURE__ */ jsx("span", { children: emptyCellValue });
|
|
704
764
|
return /* @__PURE__ */ jsx(Link, { color: "accent", asChild: true, children: /* @__PURE__ */ jsx(
|
|
@@ -2576,6 +2636,6 @@ var Widget = ({
|
|
|
2576
2636
|
};
|
|
2577
2637
|
Widget.displayName = "Widget";
|
|
2578
2638
|
|
|
2579
|
-
export { ActionCell, BooleanCell, BulkActionBar, Card, CardList, CardListData, CardListItem, ChipPicker, CodeCell, ColorSwatchCell, ContextRail, CountCell, DataTable, DateCell, DrawerRoot, FactBox, InlineCreatableList, LabeledSwitch, LinkCell, MenuCell, Modal, NumberCell, Pagination, SelectableCard, Sidebar, SidebarSection2 as SidebarSection, SlugCell, StatusBadgeCell, Stepper, StepperCompleted, StepperContainer, StepperContent, StepperIcon, StepperProvider, StepperSeparator, StepperStep, StepperStepTitle, StepperSteps, SwitchCell, CardList as Table, CardListData as TableData, CardListItem as TableItem, TimelineConnector, TimelineContent, TimelineDescription, TimelineIndicator, TimelineItem, TimelineRoot, TimelineSeparator, TimelineTitle, Toolbar, TreeViewBranch, TreeViewBranchContent, TreeViewBranchControl, TreeViewBranchIndicator, TreeViewBranchText, TreeViewBranchTrigger, TreeViewItem, TreeViewItemIndicator, TreeViewItemText, TreeViewLabel, TreeViewNode, TreeViewRoot, TreeViewTree, TruncatedTextCell, UploadDropZone, UrlCell, Widget, emptyCellValue, pluralize, truncateText, useSidebarContext, useStep, useStepper, useStepperContext, useStepperNextButton, useStepperPrevButton };
|
|
2639
|
+
export { ActionCell, BooleanCell, BulkActionBar, Card, CardList, CardListData, CardListItem, ChipPicker, CodeCell, ColorSwatchCell, ContextRail, CountCell, DataTable, DateCell, DeviceCell, DrawerRoot, FactBox, IdentityCell, InlineCreatableList, LabeledSwitch, LinkCell, MenuCell, Modal, NumberCell, Pagination, SelectableCard, Sidebar, SidebarSection2 as SidebarSection, SlugCell, StatusBadgeCell, Stepper, StepperCompleted, StepperContainer, StepperContent, StepperIcon, StepperProvider, StepperSeparator, StepperStep, StepperStepTitle, StepperSteps, SwitchCell, CardList as Table, CardListData as TableData, CardListItem as TableItem, TimelineConnector, TimelineContent, TimelineDescription, TimelineIndicator, TimelineItem, TimelineRoot, TimelineSeparator, TimelineTitle, Toolbar, TreeViewBranch, TreeViewBranchContent, TreeViewBranchControl, TreeViewBranchIndicator, TreeViewBranchText, TreeViewBranchTrigger, TreeViewItem, TreeViewItemIndicator, TreeViewItemText, TreeViewLabel, TreeViewNode, TreeViewRoot, TreeViewTree, TruncatedTextCell, UploadDropZone, UrlCell, Widget, emptyCellValue, formatUserAgent, parseUserAgent, pluralize, truncateText, useSidebarContext, useStep, useStepper, useStepperContext, useStepperNextButton, useStepperPrevButton };
|
|
2580
2640
|
//# sourceMappingURL=index.js.map
|
|
2581
2641
|
//# sourceMappingURL=index.js.map
|