@knkcs/anker 1.6.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"]}
@@ -3,7 +3,7 @@ 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
9
  import { PanelRightOpen, PanelRightClose, ChevronRight, Search, X, Ellipsis, Plus, ChevronLeft, ArrowUp, ArrowDown, ArrowUpDown, ChevronDown, Check, Upload } from 'lucide-react';
@@ -1035,6 +1035,9 @@ function DataTableInner(props) {
1035
1035
  const selectionColumn = useMemo(
1036
1036
  () => ({
1037
1037
  id: "_select",
1038
+ size: 40,
1039
+ minSize: 40,
1040
+ maxSize: 40,
1038
1041
  header: ({ table: table2 }) => /* @__PURE__ */ jsxs(
1039
1042
  Checkbox.Root,
1040
1043
  {
@@ -1092,6 +1095,7 @@ function DataTableInner(props) {
1092
1095
  /* @__PURE__ */ jsx(Table.Header, { children: table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ jsx(Table.Row, { children: headerGroup.headers.map((header) => {
1093
1096
  const canSort = header.column.getCanSort();
1094
1097
  const sorted = header.column.getIsSorted();
1098
+ const isSelectCol = header.column.id === "_select";
1095
1099
  return /* @__PURE__ */ jsx(
1096
1100
  Table.ColumnHeader,
1097
1101
  {
@@ -1107,6 +1111,7 @@ function DataTableInner(props) {
1107
1111
  header.column.getToggleSortingHandler()?.(e);
1108
1112
  }
1109
1113
  } : void 0,
1114
+ style: isSelectCol ? { width: header.column.getSize() } : void 0,
1110
1115
  children: /* @__PURE__ */ jsxs(Flex, { alignItems: "center", gap: 1, children: [
1111
1116
  header.isPlaceholder ? null : flexRender(
1112
1117
  header.column.columnDef.header,
@@ -1136,10 +1141,17 @@ function DataTableInner(props) {
1136
1141
  onRowClick(row.original);
1137
1142
  }
1138
1143
  } : void 0,
1139
- children: row.getVisibleCells().map((cell) => /* @__PURE__ */ jsx(Table.Cell, { children: flexRender(
1140
- cell.column.columnDef.cell,
1141
- cell.getContext()
1142
- ) }, 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
+ ))
1143
1155
  },
1144
1156
  row.id
1145
1157
  )),