@knkcs/anker 0.0.4 → 0.0.6

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.
@@ -1,15 +1,17 @@
1
- import { HStack as HStack$1, Code, Box as Box$1, VStack, Text as Text$1, Link, Skeleton, Checkbox as Checkbox$1 } from '../chunk-SJIYWHIV.js';
2
- import { formatRelativeDateTime, StatusBadge } from '../chunk-KVPN6T6J.js';
3
- import { Tooltip, MenuRoot, MenuTrigger, MenuContent, MenuItem } from '../chunk-NJFF6S77.js';
1
+ import { Collapsible, Skeleton, Separator, Checkbox as Checkbox$1 } from '../chunk-TXGJ7BNX.js';
2
+ import { formatRelativeDateTime, StatusBadge } from '../chunk-NQN6LXYU.js';
3
+ import { Tooltip, MenuRoot, MenuTrigger, MenuContent, MenuItem, Table } from '../chunk-2QFOWHTU.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-SJ6YXNZW.js';
7
- import { createContext, Timeline, TreeView, Box, Flex, Collapsible, HStack, Text, Card as Card$1, Heading, Grid, GridItem, Menu, Portal, Checkbox, Table, Drawer, Spacer, ButtonGroup, Stack, Dialog, Separator, useSlotRecipe, chakra } from '@chakra-ui/react';
8
- export { createTreeCollection } from '@chakra-ui/react';
7
+ import { Box, Flex, HStack, Text, Heading, Grid, GridItem, Code, Link, VStack, Spacer, Stack } from '../chunk-G4QMIXLC.js';
9
8
  import { X, Ellipsis, Plus, ChevronLeft, ChevronRight, ArrowUp, ArrowDown, ArrowUpDown, ChevronDown, Check, Upload } from 'lucide-react';
10
9
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
10
+ import { createContext, Timeline, TreeView, Card as Card$1, Menu, Portal, Checkbox, Drawer, ButtonGroup, Dialog, useSlotRecipe, chakra } from '@chakra-ui/react';
11
+ export { createTreeCollection } from '@chakra-ui/react';
11
12
  import React2, { createContext as createContext$1, Children, useState, useMemo, useRef, useEffect, useCallback, useContext } from 'react';
12
13
  import dayjs from 'dayjs';
14
+ import { Link as Link$1 } from 'react-router-dom';
13
15
  import { useReactTable, getSortedRowModel, getCoreRowModel, flexRender } from '@tanstack/react-table';
14
16
 
15
17
  var BulkAction = ({
@@ -388,7 +390,7 @@ function ChipPickerInner(props) {
388
390
  var ChipPicker = ChipPickerInner;
389
391
  ChipPicker.displayName = "ChipPicker";
390
392
  var ActionCell = ({ actions }) => {
391
- return /* @__PURE__ */ jsx(HStack$1, { gap: 1, children: actions.map((action) => /* @__PURE__ */ jsx(Tooltip, { content: action.label, children: action.href ? /* @__PURE__ */ jsx(
393
+ return /* @__PURE__ */ jsx(HStack, { gap: 1, children: actions.map((action) => /* @__PURE__ */ jsx(Tooltip, { content: action.label, children: action.href ? /* @__PURE__ */ jsx(
392
394
  IconButton,
393
395
  {
394
396
  "aria-label": action.label,
@@ -452,9 +454,9 @@ var CodeCell = ({
452
454
  CodeCell.displayName = "CodeCell";
453
455
  var ColorSwatchCell = ({ value }) => {
454
456
  if (value == null) return /* @__PURE__ */ jsx("span", { children: emptyCellValue });
455
- return /* @__PURE__ */ jsxs(HStack$1, { gap: 2, children: [
457
+ return /* @__PURE__ */ jsxs(HStack, { gap: 2, children: [
456
458
  /* @__PURE__ */ jsx(
457
- Box$1,
459
+ Box,
458
460
  {
459
461
  width: "1rem",
460
462
  height: "1rem",
@@ -512,6 +514,81 @@ var DateCell = ({
512
514
  return /* @__PURE__ */ jsx("span", { children: formatted });
513
515
  };
514
516
  DateCell.displayName = "DateCell";
517
+ var LinkCell = ({ to, label }) => {
518
+ if (to == null) return /* @__PURE__ */ jsx("span", { children: emptyCellValue });
519
+ return /* @__PURE__ */ jsx(Link, { color: "accent", asChild: true, children: /* @__PURE__ */ jsx(
520
+ Link$1,
521
+ {
522
+ to,
523
+ onClick: (e) => e.stopPropagation(),
524
+ children: label || to
525
+ }
526
+ ) });
527
+ };
528
+ LinkCell.displayName = "LinkCell";
529
+ var MenuCell = ({
530
+ actions,
531
+ menuThreshold = 1,
532
+ menuIcon: MenuIcon = Ellipsis,
533
+ triggerLabel = "Actions"
534
+ }) => {
535
+ if (actions.length === 0) return null;
536
+ const useMenu = actions.length > menuThreshold;
537
+ if (useMenu) {
538
+ return /* @__PURE__ */ jsxs(MenuRoot, { children: [
539
+ /* @__PURE__ */ jsx(MenuTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
540
+ IconButton,
541
+ {
542
+ "aria-label": triggerLabel,
543
+ size: "sm",
544
+ variant: "ghost",
545
+ onClick: (e) => e.stopPropagation(),
546
+ children: /* @__PURE__ */ jsx(MenuIcon, { size: 16 })
547
+ }
548
+ ) }),
549
+ /* @__PURE__ */ jsx(MenuContent, { children: actions.map((action) => /* @__PURE__ */ jsxs(
550
+ MenuItem,
551
+ {
552
+ value: action.label,
553
+ onClick: action.onClick,
554
+ disabled: action.disabled,
555
+ colorPalette: action.colorPalette,
556
+ children: [
557
+ action.icon && /* @__PURE__ */ jsx(action.icon, { size: 16 }),
558
+ action.label
559
+ ]
560
+ },
561
+ action.label
562
+ )) })
563
+ ] });
564
+ }
565
+ return /* @__PURE__ */ jsx(HStack, { gap: 1, onClick: (e) => e.stopPropagation(), children: actions.map(
566
+ (action) => action.icon ? /* @__PURE__ */ jsx(Tooltip, { content: action.label, children: /* @__PURE__ */ jsx(
567
+ IconButton,
568
+ {
569
+ "aria-label": action.label,
570
+ size: "sm",
571
+ variant: "ghost",
572
+ colorPalette: action.colorPalette,
573
+ onClick: action.onClick,
574
+ disabled: action.disabled,
575
+ children: /* @__PURE__ */ jsx(action.icon, { size: 16 })
576
+ }
577
+ ) }, action.label) : /* @__PURE__ */ jsx(
578
+ Button,
579
+ {
580
+ size: "sm",
581
+ variant: "ghost",
582
+ colorPalette: action.colorPalette,
583
+ onClick: action.onClick,
584
+ disabled: action.disabled,
585
+ children: action.label
586
+ },
587
+ action.label
588
+ )
589
+ ) });
590
+ };
591
+ MenuCell.displayName = "MenuCell";
515
592
  var NumberCell = ({ value, locale }) => {
516
593
  if (value == null) return /* @__PURE__ */ jsx("span", { children: emptyCellValue });
517
594
  const num = Number(value);
@@ -537,7 +614,7 @@ var StatusBadgeCell = ({
537
614
  if (detail) {
538
615
  return /* @__PURE__ */ jsxs(VStack, { align: "start", gap: 0.5, children: [
539
616
  badge,
540
- /* @__PURE__ */ jsx(Text$1, { fontSize: "xs", color: detailColor, children: detail })
617
+ /* @__PURE__ */ jsx(Text, { fontSize: "xs", color: detailColor, children: detail })
541
618
  ] });
542
619
  }
543
620
  return badge;
@@ -886,7 +963,6 @@ var DrawerRoot = ({
886
963
  {
887
964
  size: "sm",
888
965
  variant: "solid",
889
- colorPalette: "primary",
890
966
  onClick: onSave,
891
967
  disabled: saveButtonDisabled || loading,
892
968
  loading,
@@ -1217,7 +1293,6 @@ var Modal = ({
1217
1293
  Button,
1218
1294
  {
1219
1295
  variant: "solid",
1220
- colorPalette: "primary",
1221
1296
  onClick: onSave,
1222
1297
  disabled: saveDisabled || loading,
1223
1298
  loading,
@@ -1893,6 +1968,6 @@ var Widget = ({
1893
1968
  };
1894
1969
  Widget.displayName = "Widget";
1895
1970
 
1896
- export { ActionCell, BooleanCell, BulkActionBar, Card, CardList, CardListData, CardListItem, ChipPicker, CodeCell, ColorSwatchCell, CountCell, DataTable, DateCell, DrawerRoot, FactBox, InlineCreatableList, LabeledSwitch, Modal, NumberCell, Pagination, SelectableCard, 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, TreeViewBranch, TreeViewBranchContent, TreeViewBranchControl, TreeViewBranchIndicator, TreeViewBranchText, TreeViewBranchTrigger, TreeViewItem, TreeViewItemIndicator, TreeViewItemText, TreeViewLabel, TreeViewNode, TreeViewRoot, TreeViewTree, TruncatedTextCell, UploadDropZone, UrlCell, Widget, emptyCellValue, pluralize, truncateText, useStep, useStepper, useStepperContext, useStepperNextButton, useStepperPrevButton };
1971
+ export { ActionCell, BooleanCell, BulkActionBar, Card, CardList, CardListData, CardListItem, ChipPicker, CodeCell, ColorSwatchCell, CountCell, DataTable, DateCell, DrawerRoot, FactBox, InlineCreatableList, LabeledSwitch, LinkCell, MenuCell, Modal, NumberCell, Pagination, SelectableCard, 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, TreeViewBranch, TreeViewBranchContent, TreeViewBranchControl, TreeViewBranchIndicator, TreeViewBranchText, TreeViewBranchTrigger, TreeViewItem, TreeViewItemIndicator, TreeViewItemText, TreeViewLabel, TreeViewNode, TreeViewRoot, TreeViewTree, TruncatedTextCell, UploadDropZone, UrlCell, Widget, emptyCellValue, pluralize, truncateText, useStep, useStepper, useStepperContext, useStepperNextButton, useStepperPrevButton };
1897
1972
  //# sourceMappingURL=index.js.map
1898
1973
  //# sourceMappingURL=index.js.map