@knkcs/anker 1.5.0 → 1.7.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.
@@ -12,14 +12,14 @@ type ButtonProps = Omit<ButtonProps$1, "variant"> & {
12
12
  variant?: "solid" | "subtle" | "surface" | "outline" | "ghost" | "plain" | "primary" | "secondary" | "link" | "link-gray" | undefined;
13
13
  };
14
14
  declare const Button: {
15
- ({ ref, ...props }: ButtonProps & {
15
+ ({ ref, colorPalette, ...props }: ButtonProps & {
16
16
  ref?: React.Ref<HTMLButtonElement>;
17
17
  }): react_jsx_runtime.JSX.Element;
18
18
  displayName: string;
19
19
  };
20
20
 
21
21
  declare const IconButton: {
22
- ({ ref, ...props }: IconButtonProps & {
22
+ ({ ref, colorPalette, ...props }: IconButtonProps & {
23
23
  ref?: React.Ref<HTMLButtonElement>;
24
24
  }): react_jsx_runtime.JSX.Element;
25
25
  displayName: string;
@@ -7,8 +7,8 @@ import { Textarea } from '../chunk-NFZMG6ZL.js';
7
7
  import { text_input_default } from '../chunk-OU6H3KU4.js';
8
8
  export { text_input_default as TextInput } from '../chunk-OU6H3KU4.js';
9
9
  import { Spinner } from '../chunk-5YDCDC4B.js';
10
- import { IconButton, Button } from '../chunk-SJ6YXNZW.js';
11
- export { Button, IconButton } from '../chunk-SJ6YXNZW.js';
10
+ import { IconButton, Button } from '../chunk-JS7ZEZV3.js';
11
+ export { Button, IconButton } from '../chunk-JS7ZEZV3.js';
12
12
  import { Text, Box, Stack as Stack$1, Flex, HStack, Heading } from '../chunk-G4QMIXLC.js';
13
13
  import { jsx, jsxs } from 'react/jsx-runtime';
14
14
  import { DataList as DataList$1, Icon, Circle, useCheckboxGroup, Stack, Box as Box$1, Clipboard, IconButton as IconButton$1, Input, chakra, ButtonGroup, Button as Button$1, Square } from '@chakra-ui/react';
@@ -4,6 +4,7 @@ import { jsx } from 'react/jsx-runtime';
4
4
  // src/atoms/button/button.tsx
5
5
  var Button = ({
6
6
  ref,
7
+ colorPalette = "primary",
7
8
  ...props
8
9
  }) => {
9
10
  return /* @__PURE__ */ jsx(
@@ -11,6 +12,7 @@ var Button = ({
11
12
  {
12
13
  size: "md",
13
14
  variant: "secondary",
15
+ colorPalette,
14
16
  ref,
15
17
  ...props
16
18
  }
@@ -19,12 +21,22 @@ var Button = ({
19
21
  Button.displayName = "Button";
20
22
  var IconButton = ({
21
23
  ref,
24
+ colorPalette = "primary",
22
25
  ...props
23
26
  }) => {
24
- return /* @__PURE__ */ jsx(IconButton$1, { size: "md", variant: "ghost", ref, ...props });
27
+ return /* @__PURE__ */ jsx(
28
+ IconButton$1,
29
+ {
30
+ size: "md",
31
+ variant: "ghost",
32
+ colorPalette,
33
+ ref,
34
+ ...props
35
+ }
36
+ );
25
37
  };
26
38
  IconButton.displayName = "IconButton";
27
39
 
28
40
  export { Button, IconButton };
29
- //# sourceMappingURL=chunk-SJ6YXNZW.js.map
30
- //# sourceMappingURL=chunk-SJ6YXNZW.js.map
41
+ //# sourceMappingURL=chunk-JS7ZEZV3.js.map
42
+ //# sourceMappingURL=chunk-JS7ZEZV3.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/atoms/button/button.tsx","../src/atoms/button/icon-button.tsx"],"names":["ChakraButton","jsx","ChakraIconButton"],"mappings":";;;;AAsBO,IAAM,SAAS,CAAC;AAAA,EACtB,GAAA;AAAA,EACA,YAAA,GAAe,SAAA;AAAA,EACf,GAAG;AACJ,CAAA,KAA4D;AAC3D,EAAA,uBACC,GAAA;AAAA,IAACA,QAAA;AAAA,IAAA;AAAA,MACA,IAAA,EAAK,IAAA;AAAA,MACL,OAAA,EAAS,WAAA;AAAA,MACT,YAAA;AAAA,MACA,GAAA;AAAA,MACC,GAAI;AAAA;AAAA,GACN;AAEF;AACA,MAAA,CAAO,WAAA,GAAc,QAAA;AC9Bd,IAAM,aAAa,CAAC;AAAA,EAC1B,GAAA;AAAA,EACA,YAAA,GAAe,SAAA;AAAA,EACf,GAAG;AACJ,CAAA,KAAgE;AAC/D,EAAA,uBACCC,GAAAA;AAAA,IAACC,YAAA;AAAA,IAAA;AAAA,MACA,IAAA,EAAK,IAAA;AAAA,MACL,OAAA,EAAQ,OAAA;AAAA,MACR,YAAA;AAAA,MACA,GAAA;AAAA,MACC,GAAG;AAAA;AAAA,GACL;AAEF;AACA,UAAA,CAAW,WAAA,GAAc,YAAA","file":"chunk-JS7ZEZV3.js","sourcesContent":["import {\n\tButton as ChakraButton,\n\ttype ButtonProps as ChakraButtonProps,\n} from \"@chakra-ui/react\";\n\n// Extend ButtonProps to include custom variants defined in the @knkcs/anker\n// theme (primary, secondary, link-gray) that are not in Chakra's default types.\nexport type ButtonProps = Omit<ChakraButtonProps, \"variant\"> & {\n\tvariant?:\n\t\t| \"solid\"\n\t\t| \"subtle\"\n\t\t| \"surface\"\n\t\t| \"outline\"\n\t\t| \"ghost\"\n\t\t| \"plain\"\n\t\t| \"primary\"\n\t\t| \"secondary\"\n\t\t| \"link\"\n\t\t| \"link-gray\"\n\t\t| undefined;\n};\n\nexport const Button = ({\n\tref,\n\tcolorPalette = \"primary\",\n\t...props\n}: ButtonProps & { ref?: React.Ref<HTMLButtonElement> }) => {\n\treturn (\n\t\t<ChakraButton\n\t\t\tsize=\"md\"\n\t\t\tvariant={\"secondary\" as ChakraButtonProps[\"variant\"]}\n\t\t\tcolorPalette={colorPalette}\n\t\t\tref={ref}\n\t\t\t{...(props as ChakraButtonProps)}\n\t\t/>\n\t);\n};\nButton.displayName = \"Button\";\n","import {\n\tIconButton as ChakraIconButton,\n\ttype IconButtonProps,\n} from \"@chakra-ui/react\";\n\nexport type { IconButtonProps };\n\nexport const IconButton = ({\n\tref,\n\tcolorPalette = \"primary\",\n\t...props\n}: IconButtonProps & { ref?: React.Ref<HTMLButtonElement> }) => {\n\treturn (\n\t\t<ChakraIconButton\n\t\t\tsize=\"md\"\n\t\t\tvariant=\"ghost\"\n\t\t\tcolorPalette={colorPalette}\n\t\t\tref={ref}\n\t\t\t{...props}\n\t\t/>\n\t);\n};\nIconButton.displayName = \"IconButton\";\n"]}
@@ -189,6 +189,8 @@ interface ContextRailSectionProps {
189
189
  id: string;
190
190
  icon?: React__default.ReactNode;
191
191
  label: string;
192
+ defaultOpen?: boolean;
193
+ action?: React__default.ReactNode;
192
194
  children: React__default.ReactNode;
193
195
  }
194
196
  declare const ContextRail: {
@@ -200,7 +202,7 @@ declare const ContextRail: {
200
202
  displayName: string;
201
203
  };
202
204
  Section: {
203
- ({ id, icon, label, children, }: ContextRailSectionProps): react_jsx_runtime.JSX.Element;
205
+ ({ id, icon, label, defaultOpen, action, children, }: ContextRailSectionProps): react_jsx_runtime.JSX.Element;
204
206
  displayName: string;
205
207
  };
206
208
  Footer: {
@@ -3,10 +3,10 @@ import { formatRelativeDateTime, StatusBadge } from '../chunk-NQN6LXYU.js';
3
3
  import { MenuItem, MenuRoot, MenuTrigger, MenuContent, Tooltip, 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
- import { Button, IconButton } from '../chunk-SJ6YXNZW.js';
6
+ import { Button, IconButton } from '../chunk-JS7ZEZV3.js';
7
7
  import { Box, Flex, Text, Heading, HStack, Grid, GridItem, Code, Link, VStack, Spacer, Stack } from '../chunk-G4QMIXLC.js';
8
8
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
9
- import { PanelRightOpen, PanelRightClose, Search, X, Ellipsis, Plus, ChevronLeft, ChevronRight, ArrowUp, ArrowDown, ArrowUpDown, ChevronDown, Check, Upload } from 'lucide-react';
9
+ import { PanelRightOpen, PanelRightClose, ChevronRight, Search, X, Ellipsis, Plus, ChevronLeft, ArrowUp, ArrowDown, ArrowUpDown, ChevronDown, Check, Upload } from 'lucide-react';
10
10
  import { createContext, Timeline, TreeView, Card as Card$1, Menu, Portal, Checkbox, Drawer, ButtonGroup, Dialog, useSlotRecipe, chakra } from '@chakra-ui/react';
11
11
  export { createTreeCollection } from '@chakra-ui/react';
12
12
  import React3, { createContext as createContext$1, useState, useEffect, Children, useMemo, useRef, useCallback, useContext } from 'react';
@@ -555,7 +555,7 @@ var ContextRailHeader = ({
555
555
  eyebrow,
556
556
  title,
557
557
  onClose: _onClose
558
- }) => /* @__PURE__ */ jsxs(Box, { mb: "4", children: [
558
+ }) => /* @__PURE__ */ jsxs(Box, { mb: "4", pb: "3", borderBottomWidth: "1px", borderBottomColor: "border", children: [
559
559
  eyebrow && /* @__PURE__ */ jsx(
560
560
  Text,
561
561
  {
@@ -585,14 +585,72 @@ var ContextRailSection = ({
585
585
  id,
586
586
  icon,
587
587
  label,
588
+ defaultOpen = true,
589
+ action,
588
590
  children
589
- }) => /* @__PURE__ */ jsxs(Box, { mb: "4", "data-section-id": id, children: [
590
- /* @__PURE__ */ jsxs(Flex, { align: "center", gap: "2", mb: "2", children: [
591
- icon && /* @__PURE__ */ jsx(Box, { display: "inline-flex", alignItems: "center", color: "muted", children: icon }),
592
- /* @__PURE__ */ jsx(Heading, { as: "h3", fontSize: "sm", fontWeight: "semibold", color: "default", children: label })
593
- ] }),
594
- /* @__PURE__ */ jsx(Box, { children })
595
- ] });
591
+ }) => {
592
+ const [open, setOpen] = useState(defaultOpen);
593
+ return /* @__PURE__ */ jsxs(
594
+ Box,
595
+ {
596
+ "data-section-id": id,
597
+ borderBottomWidth: "1px",
598
+ borderBottomColor: "border-muted",
599
+ children: [
600
+ /* @__PURE__ */ jsxs(Flex, { w: "full", align: "center", gap: "2", children: [
601
+ /* @__PURE__ */ jsxs(
602
+ Flex,
603
+ {
604
+ as: "button",
605
+ ...{ type: "button" },
606
+ onClick: () => setOpen((o) => !o),
607
+ "aria-expanded": open,
608
+ flex: "1",
609
+ align: "center",
610
+ gap: "2",
611
+ px: "0",
612
+ py: "3",
613
+ bg: "transparent",
614
+ border: "none",
615
+ cursor: "pointer",
616
+ textAlign: "left",
617
+ _hover: { bg: "bg-subtle" },
618
+ children: [
619
+ /* @__PURE__ */ jsx(
620
+ Box,
621
+ {
622
+ display: "inline-flex",
623
+ alignItems: "center",
624
+ color: "muted",
625
+ transform: open ? "rotate(90deg)" : "none",
626
+ transition: "transform 120ms ease-out",
627
+ children: /* @__PURE__ */ jsx(ChevronRight, { size: 12, "aria-hidden": true })
628
+ }
629
+ ),
630
+ icon && /* @__PURE__ */ jsx(Box, { display: "inline-flex", alignItems: "center", color: "muted", children: icon }),
631
+ /* @__PURE__ */ jsx(
632
+ Heading,
633
+ {
634
+ as: "h3",
635
+ fontSize: "2xs",
636
+ fontWeight: "semibold",
637
+ letterSpacing: "wider",
638
+ textTransform: "uppercase",
639
+ color: "muted",
640
+ flex: "1",
641
+ children: label
642
+ }
643
+ )
644
+ ]
645
+ }
646
+ ),
647
+ action && /* @__PURE__ */ jsx(Box, { py: "3", children: action })
648
+ ] }),
649
+ open && /* @__PURE__ */ jsx(Box, { pb: "3", children })
650
+ ]
651
+ }
652
+ );
653
+ };
596
654
  ContextRailSection.displayName = "ContextRail.Section";
597
655
  var ContextRailFooter = ({ children }) => /* @__PURE__ */ jsx(Box, { mt: "4", pt: "4", borderTopWidth: "1px", borderTopColor: "border-muted", children });
598
656
  ContextRailFooter.displayName = "ContextRail.Footer";
@@ -977,6 +1035,9 @@ function DataTableInner(props) {
977
1035
  const selectionColumn = useMemo(
978
1036
  () => ({
979
1037
  id: "_select",
1038
+ size: 40,
1039
+ minSize: 40,
1040
+ maxSize: 40,
980
1041
  header: ({ table: table2 }) => /* @__PURE__ */ jsxs(
981
1042
  Checkbox.Root,
982
1043
  {
@@ -1034,6 +1095,7 @@ function DataTableInner(props) {
1034
1095
  /* @__PURE__ */ jsx(Table.Header, { children: table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ jsx(Table.Row, { children: headerGroup.headers.map((header) => {
1035
1096
  const canSort = header.column.getCanSort();
1036
1097
  const sorted = header.column.getIsSorted();
1098
+ const isSelectCol = header.column.id === "_select";
1037
1099
  return /* @__PURE__ */ jsx(
1038
1100
  Table.ColumnHeader,
1039
1101
  {
@@ -1049,6 +1111,7 @@ function DataTableInner(props) {
1049
1111
  header.column.getToggleSortingHandler()?.(e);
1050
1112
  }
1051
1113
  } : void 0,
1114
+ style: isSelectCol ? { width: header.column.getSize() } : void 0,
1052
1115
  children: /* @__PURE__ */ jsxs(Flex, { alignItems: "center", gap: 1, children: [
1053
1116
  header.isPlaceholder ? null : flexRender(
1054
1117
  header.column.columnDef.header,
@@ -1078,10 +1141,17 @@ function DataTableInner(props) {
1078
1141
  onRowClick(row.original);
1079
1142
  }
1080
1143
  } : void 0,
1081
- children: row.getVisibleCells().map((cell) => /* @__PURE__ */ jsx(Table.Cell, { children: flexRender(
1082
- cell.column.columnDef.cell,
1083
- cell.getContext()
1084
- ) }, cell.id))
1144
+ children: row.getVisibleCells().map((cell) => /* @__PURE__ */ jsx(
1145
+ Table.Cell,
1146
+ {
1147
+ style: cell.column.id === "_select" ? { width: cell.column.getSize() } : void 0,
1148
+ children: flexRender(
1149
+ cell.column.columnDef.cell,
1150
+ cell.getContext()
1151
+ )
1152
+ },
1153
+ cell.id
1154
+ ))
1085
1155
  },
1086
1156
  row.id
1087
1157
  )),