@knkcs/anker 0.0.3 → 0.0.5

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.
Files changed (55) hide show
  1. package/dist/atoms/index.d.ts +16 -3
  2. package/dist/atoms/index.js +112 -18
  3. package/dist/atoms/index.js.map +1 -1
  4. package/dist/{chunk-NJFF6S77.js → chunk-2QFOWHTU.js} +4 -3
  5. package/dist/chunk-2QFOWHTU.js.map +1 -0
  6. package/dist/chunk-5YDCDC4B.js +12 -0
  7. package/dist/chunk-5YDCDC4B.js.map +1 -0
  8. package/dist/{chunk-YSFUGIQM.js → chunk-7WPKYUHP.js} +232 -116
  9. package/dist/chunk-7WPKYUHP.js.map +1 -0
  10. package/dist/{chunk-PZCL4M6I.js → chunk-E7KRPPCQ.js} +5 -18
  11. package/dist/chunk-E7KRPPCQ.js.map +1 -0
  12. package/dist/chunk-G4QMIXLC.js +3 -0
  13. package/dist/chunk-G4QMIXLC.js.map +1 -0
  14. package/dist/{chunk-C4JI3JNA.js → chunk-M5WNB4K6.js} +13 -34
  15. package/dist/chunk-M5WNB4K6.js.map +1 -0
  16. package/dist/chunk-NFZMG6ZL.js +3 -0
  17. package/dist/chunk-NFZMG6ZL.js.map +1 -0
  18. package/dist/{chunk-GJTQLZ4O.js → chunk-NQN6LXYU.js} +5 -28
  19. package/dist/chunk-NQN6LXYU.js.map +1 -0
  20. package/dist/chunk-OU6H3KU4.js +21 -0
  21. package/dist/chunk-OU6H3KU4.js.map +1 -0
  22. package/dist/chunk-SJ6YXNZW.js +30 -0
  23. package/dist/chunk-SJ6YXNZW.js.map +1 -0
  24. package/dist/chunk-TXGJ7BNX.js +51 -0
  25. package/dist/chunk-TXGJ7BNX.js.map +1 -0
  26. package/dist/chunk-WEP2AIQ5.js +37 -0
  27. package/dist/chunk-WEP2AIQ5.js.map +1 -0
  28. package/dist/chunk-WQIEF5N3.js +52 -0
  29. package/dist/chunk-WQIEF5N3.js.map +1 -0
  30. package/dist/{chunk-QU3FF5WI.js → chunk-ZFBDVERP.js} +4 -8
  31. package/dist/chunk-ZFBDVERP.js.map +1 -0
  32. package/dist/components/index.d.ts +207 -3
  33. package/dist/components/index.js +764 -15
  34. package/dist/components/index.js.map +1 -1
  35. package/dist/feedback/index.d.ts +20 -1
  36. package/dist/feedback/index.js +121 -3
  37. package/dist/feedback/index.js.map +1 -1
  38. package/dist/forms/index.d.ts +23 -15
  39. package/dist/forms/index.js +74 -48
  40. package/dist/forms/index.js.map +1 -1
  41. package/dist/primitives/index.js +13 -52
  42. package/dist/primitives/index.js.map +1 -1
  43. package/dist/theme/index.d.ts +162 -1
  44. package/dist/theme/index.js +1 -1
  45. package/package.json +4 -2
  46. package/dist/chunk-7UJ4QEUW.js +0 -37
  47. package/dist/chunk-7UJ4QEUW.js.map +0 -1
  48. package/dist/chunk-C4JI3JNA.js.map +0 -1
  49. package/dist/chunk-GJTQLZ4O.js.map +0 -1
  50. package/dist/chunk-NJFF6S77.js.map +0 -1
  51. package/dist/chunk-PZCL4M6I.js.map +0 -1
  52. package/dist/chunk-QU3FF5WI.js.map +0 -1
  53. package/dist/chunk-RJPEVNMJ.js +0 -23
  54. package/dist/chunk-RJPEVNMJ.js.map +0 -1
  55. package/dist/chunk-YSFUGIQM.js.map +0 -1
@@ -1,15 +1,101 @@
1
- import { HStack, Code, Box as Box$1, VStack, Text as Text$1, Link, Skeleton } from '../chunk-7UJ4QEUW.js';
2
- import { IconButton, formatRelativeDateTime, Button, StatusBadge } from '../chunk-GJTQLZ4O.js';
3
- import { Tooltip, MenuRoot, MenuTrigger, MenuContent, MenuItem } from '../chunk-NJFF6S77.js';
4
- import { Switch } from '../chunk-RJPEVNMJ.js';
5
- import { createContext, Timeline, TreeView, Card as Card$1, Heading, Box, Flex, Grid, GridItem, Text, Menu, Portal, HStack as HStack$1, Checkbox, Table, Drawer, Spacer, ButtonGroup, Collapsible, Dialog, Separator, useSlotRecipe, chakra } from '@chakra-ui/react';
6
- export { createTreeCollection } from '@chakra-ui/react';
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
+ import { Popover, PopoverTrigger, PopoverContent, PopoverBody, Switch } from '../chunk-WQIEF5N3.js';
5
+ import { text_input_default } from '../chunk-OU6H3KU4.js';
6
+ import { Button, IconButton } from '../chunk-SJ6YXNZW.js';
7
+ import { Box, Flex, HStack, Text, Heading, Grid, GridItem, Code, Link, VStack, Spacer, Stack } from '../chunk-G4QMIXLC.js';
8
+ import { X, Ellipsis, Plus, ChevronLeft, ChevronRight, ArrowUp, ArrowDown, ArrowUpDown, ChevronDown, Check, Upload } from 'lucide-react';
7
9
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
8
- import React2, { createContext as createContext$1, Children, useMemo, useCallback, useContext } from 'react';
9
- import { Ellipsis, ChevronLeft, ChevronRight, ArrowUp, ArrowDown, ArrowUpDown, X, ChevronDown, Check } from 'lucide-react';
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';
12
+ import React2, { createContext as createContext$1, Children, useState, useMemo, useRef, useEffect, useCallback, useContext } from 'react';
10
13
  import dayjs from 'dayjs';
14
+ import { Link as Link$1 } from 'react-router-dom';
11
15
  import { useReactTable, getSortedRowModel, getCoreRowModel, flexRender } from '@tanstack/react-table';
12
16
 
17
+ var BulkAction = ({
18
+ label,
19
+ icon,
20
+ onClick,
21
+ colorPalette,
22
+ disabled,
23
+ loading
24
+ }) => /* @__PURE__ */ jsxs(
25
+ Button,
26
+ {
27
+ size: "sm",
28
+ onClick,
29
+ colorPalette,
30
+ disabled,
31
+ loading,
32
+ children: [
33
+ icon,
34
+ label
35
+ ]
36
+ }
37
+ );
38
+ BulkAction.displayName = "BulkActionBar.Action";
39
+ var BulkPopoverAction = ({
40
+ label,
41
+ icon,
42
+ children,
43
+ disabled
44
+ }) => /* @__PURE__ */ jsxs(Popover, { children: [
45
+ /* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(Button, { size: "sm", disabled, children: [
46
+ icon,
47
+ label
48
+ ] }) }),
49
+ /* @__PURE__ */ jsx(PopoverContent, { children })
50
+ ] });
51
+ BulkPopoverAction.displayName = "BulkActionBar.PopoverAction";
52
+ var BulkActionBar = ({
53
+ selectedCount,
54
+ onClear,
55
+ visible,
56
+ position = "fixed",
57
+ children,
58
+ countLabel
59
+ }) => {
60
+ const isVisible = visible ?? selectedCount > 0;
61
+ const label = countLabel ? countLabel(selectedCount) : `${selectedCount} items selected`;
62
+ return /* @__PURE__ */ jsx(Collapsible.Root, { open: isVisible, children: /* @__PURE__ */ jsx(Collapsible.Content, { children: /* @__PURE__ */ jsxs(
63
+ Flex,
64
+ {
65
+ position,
66
+ bottom: 0,
67
+ insetInline: 0,
68
+ zIndex: "sticky",
69
+ bg: "bg.surface",
70
+ borderTopWidth: "1px",
71
+ borderColor: "border",
72
+ shadow: "lg",
73
+ px: 4,
74
+ py: 3,
75
+ align: "center",
76
+ justify: "space-between",
77
+ children: [
78
+ /* @__PURE__ */ jsxs(HStack, { gap: 2, children: [
79
+ /* @__PURE__ */ jsx(Text, { fontWeight: "medium", fontSize: "sm", children: label }),
80
+ /* @__PURE__ */ jsx(
81
+ IconButton,
82
+ {
83
+ "aria-label": "Clear selection",
84
+ size: "sm",
85
+ variant: "ghost",
86
+ onClick: onClear,
87
+ children: /* @__PURE__ */ jsx(X, { size: 14 })
88
+ }
89
+ )
90
+ ] }),
91
+ /* @__PURE__ */ jsx(HStack, { gap: 2, children })
92
+ ]
93
+ }
94
+ ) }) });
95
+ };
96
+ BulkActionBar.displayName = "BulkActionBar";
97
+ BulkActionBar.Action = BulkAction;
98
+ BulkActionBar.PopoverAction = BulkPopoverAction;
13
99
  var Card = ({
14
100
  ref,
15
101
  maxW = "full",
@@ -190,6 +276,119 @@ var CardListItem = ({
190
276
  );
191
277
  };
192
278
  CardListItem.displayName = "CardListItem";
279
+ function ChipPickerInner(props) {
280
+ const {
281
+ assigned,
282
+ available,
283
+ onAdd,
284
+ onRemove,
285
+ getItemId,
286
+ getItemLabel,
287
+ getItemColor,
288
+ addLabel = "Add",
289
+ emptyLabel = "None",
290
+ searchable = false,
291
+ disabled = false
292
+ } = props;
293
+ const [search, setSearch] = useState("");
294
+ const assignedIds = new Set(assigned.map(getItemId));
295
+ const unassigned = available.filter(
296
+ (item) => !assignedIds.has(getItemId(item))
297
+ );
298
+ const filteredUnassigned = searchable && search.trim() ? unassigned.filter(
299
+ (item) => getItemLabel(item).toLowerCase().includes(search.toLowerCase())
300
+ ) : unassigned;
301
+ return /* @__PURE__ */ jsxs(Flex, { wrap: "wrap", gap: 2, align: "center", children: [
302
+ assigned.length === 0 && /* @__PURE__ */ jsx(Text, { fontSize: "sm", color: "fg.muted", children: emptyLabel }),
303
+ assigned.map((item) => {
304
+ const id = getItemId(item);
305
+ const label = getItemLabel(item);
306
+ const color = getItemColor?.(item);
307
+ return /* @__PURE__ */ jsxs(
308
+ Flex,
309
+ {
310
+ borderRadius: "full",
311
+ px: 3,
312
+ py: 1,
313
+ fontSize: "sm",
314
+ display: "inline-flex",
315
+ align: "center",
316
+ gap: 1,
317
+ bg: color ? `${color}33` : "bg.muted",
318
+ color: color ?? "fg.default",
319
+ children: [
320
+ /* @__PURE__ */ jsx(Text, { as: "span", lineHeight: "1", children: label }),
321
+ !disabled && /* @__PURE__ */ jsx(
322
+ "button",
323
+ {
324
+ type: "button",
325
+ style: {
326
+ display: "inline-flex",
327
+ alignItems: "center",
328
+ cursor: "pointer",
329
+ lineHeight: 1,
330
+ padding: 0,
331
+ border: "none",
332
+ background: "transparent",
333
+ color: "inherit"
334
+ },
335
+ "aria-label": `Remove ${label}`,
336
+ onClick: () => onRemove(item),
337
+ children: /* @__PURE__ */ jsx(X, { size: 12 })
338
+ }
339
+ )
340
+ ]
341
+ },
342
+ id
343
+ );
344
+ }),
345
+ unassigned.length > 0 && !disabled && /* @__PURE__ */ jsxs(Popover, { children: [
346
+ /* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
347
+ IconButton,
348
+ {
349
+ variant: "ghost",
350
+ size: "sm",
351
+ "aria-label": addLabel,
352
+ minWidth: "44px",
353
+ minHeight: "44px",
354
+ children: /* @__PURE__ */ jsx(Plus, { size: 14 })
355
+ }
356
+ ) }),
357
+ /* @__PURE__ */ jsx(PopoverContent, { portalled: true, children: /* @__PURE__ */ jsxs(PopoverBody, { children: [
358
+ searchable && /* @__PURE__ */ jsx(
359
+ text_input_default,
360
+ {
361
+ placeholder: "Search...",
362
+ size: "sm",
363
+ mb: 2,
364
+ value: search,
365
+ onChange: (e) => setSearch(e.target.value)
366
+ }
367
+ ),
368
+ filteredUnassigned.map((item) => /* @__PURE__ */ jsx(
369
+ Box,
370
+ {
371
+ px: 2,
372
+ py: 1.5,
373
+ rounded: "md",
374
+ cursor: "pointer",
375
+ fontSize: "sm",
376
+ _hover: { bg: "bg.subtle" },
377
+ onClick: () => {
378
+ onAdd(item);
379
+ setSearch("");
380
+ },
381
+ children: getItemLabel(item)
382
+ },
383
+ getItemId(item)
384
+ )),
385
+ filteredUnassigned.length === 0 && /* @__PURE__ */ jsx(Text, { fontSize: "sm", color: "fg.muted", px: 2, py: 1.5, children: "No results" })
386
+ ] }) })
387
+ ] })
388
+ ] });
389
+ }
390
+ var ChipPicker = ChipPickerInner;
391
+ ChipPicker.displayName = "ChipPicker";
193
392
  var ActionCell = ({ actions }) => {
194
393
  return /* @__PURE__ */ jsx(HStack, { gap: 1, children: actions.map((action) => /* @__PURE__ */ jsx(Tooltip, { content: action.label, children: action.href ? /* @__PURE__ */ jsx(
195
394
  IconButton,
@@ -257,7 +456,7 @@ var ColorSwatchCell = ({ value }) => {
257
456
  if (value == null) return /* @__PURE__ */ jsx("span", { children: emptyCellValue });
258
457
  return /* @__PURE__ */ jsxs(HStack, { gap: 2, children: [
259
458
  /* @__PURE__ */ jsx(
260
- Box$1,
459
+ Box,
261
460
  {
262
461
  width: "1rem",
263
462
  height: "1rem",
@@ -315,6 +514,81 @@ var DateCell = ({
315
514
  return /* @__PURE__ */ jsx("span", { children: formatted });
316
515
  };
317
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";
318
592
  var NumberCell = ({ value, locale }) => {
319
593
  if (value == null) return /* @__PURE__ */ jsx("span", { children: emptyCellValue });
320
594
  const num = Number(value);
@@ -340,7 +614,7 @@ var StatusBadgeCell = ({
340
614
  if (detail) {
341
615
  return /* @__PURE__ */ jsxs(VStack, { align: "start", gap: 0.5, children: [
342
616
  badge,
343
- /* @__PURE__ */ jsx(Text$1, { fontSize: "xs", color: detailColor, children: detail })
617
+ /* @__PURE__ */ jsx(Text, { fontSize: "xs", color: detailColor, children: detail })
344
618
  ] });
345
619
  }
346
620
  return badge;
@@ -404,7 +678,7 @@ var Pagination = (props) => {
404
678
  const totalPages = Math.max(1, Math.ceil(total / pageSize));
405
679
  const currentPage = Math.min(Math.max(1, page), totalPages);
406
680
  const pages = getVisiblePages(currentPage, totalPages, maxVisiblePages);
407
- return /* @__PURE__ */ jsxs(HStack$1, { gap: 1, children: [
681
+ return /* @__PURE__ */ jsxs(HStack, { gap: 1, children: [
408
682
  /* @__PURE__ */ jsx(
409
683
  IconButton,
410
684
  {
@@ -689,7 +963,6 @@ var DrawerRoot = ({
689
963
  {
690
964
  size: "sm",
691
965
  variant: "solid",
692
- colorPalette: "primary",
693
966
  onClick: onSave,
694
967
  disabled: saveButtonDisabled || loading,
695
968
  loading,
@@ -734,7 +1007,7 @@ var FactBox = (props) => {
734
1007
  alignItems: { md: "center" },
735
1008
  justifyContent: { md: "space-between" },
736
1009
  children: [
737
- /* @__PURE__ */ jsx(Box, { minW: 0, flex: "1 1 0%", children: /* @__PURE__ */ jsxs(HStack$1, { children: [
1010
+ /* @__PURE__ */ jsx(Box, { minW: 0, flex: "1 1 0%", children: /* @__PURE__ */ jsxs(HStack, { children: [
738
1011
  /* @__PURE__ */ jsx(
739
1012
  IconButton,
740
1013
  {
@@ -795,6 +1068,199 @@ var FactBox = (props) => {
795
1068
  ] });
796
1069
  };
797
1070
  FactBox.displayName = "FactBox";
1071
+ function InlineCreatableListInner(props) {
1072
+ const {
1073
+ items,
1074
+ activeIds = [],
1075
+ onToggle,
1076
+ onCreate,
1077
+ getItemId,
1078
+ getItemLabel,
1079
+ getItemColor,
1080
+ variant = "wrap",
1081
+ createPlaceholder = "New item...",
1082
+ createLabel = "New item",
1083
+ createIcon = /* @__PURE__ */ jsx(Plus, { size: 14 }),
1084
+ emptyText = "No items",
1085
+ disabled = false
1086
+ } = props;
1087
+ const [isCreating, setIsCreating] = useState(false);
1088
+ const [isSubmitting, setIsSubmitting] = useState(false);
1089
+ const inputRef = useRef(null);
1090
+ useEffect(() => {
1091
+ if (isCreating) {
1092
+ inputRef.current?.focus();
1093
+ }
1094
+ }, [isCreating]);
1095
+ const activeIdSet = new Set(activeIds);
1096
+ const handleSubmit = async (value) => {
1097
+ const trimmed = value.trim();
1098
+ if (!trimmed) {
1099
+ setIsCreating(false);
1100
+ return;
1101
+ }
1102
+ setIsSubmitting(true);
1103
+ try {
1104
+ await onCreate?.(trimmed);
1105
+ setIsCreating(false);
1106
+ } catch {
1107
+ } finally {
1108
+ setIsSubmitting(false);
1109
+ }
1110
+ };
1111
+ const handleKeyDown = (e) => {
1112
+ if (e.key === "Enter") {
1113
+ e.preventDefault();
1114
+ handleSubmit(e.target.value);
1115
+ } else if (e.key === "Escape") {
1116
+ setIsCreating(false);
1117
+ }
1118
+ };
1119
+ const handleBlur = (e) => {
1120
+ const value = e.target.value.trim();
1121
+ if (value) {
1122
+ handleSubmit(value);
1123
+ } else {
1124
+ setIsCreating(false);
1125
+ }
1126
+ };
1127
+ const wrapItemBaseStyle = {
1128
+ borderRadius: "6px",
1129
+ paddingInline: "12px",
1130
+ paddingBlock: "4px",
1131
+ fontSize: "0.875rem",
1132
+ cursor: "pointer",
1133
+ transition: "all 0.15s",
1134
+ border: "none",
1135
+ lineHeight: 1.5
1136
+ };
1137
+ const listItemBaseStyle = {
1138
+ paddingInline: "8px",
1139
+ paddingBlock: "6px",
1140
+ borderRadius: "6px",
1141
+ cursor: "pointer",
1142
+ fontSize: "0.875rem",
1143
+ transition: "all 0.15s",
1144
+ border: "none",
1145
+ textAlign: "start",
1146
+ width: "100%",
1147
+ display: "block"
1148
+ };
1149
+ const disabledStyle = disabled ? { opacity: 0.5, cursor: "not-allowed" } : {};
1150
+ const renderWrapItems = () => items.map((item) => {
1151
+ const id = getItemId(item);
1152
+ const label = getItemLabel(item);
1153
+ const color = getItemColor?.(item);
1154
+ const isActive = activeIdSet.has(id);
1155
+ let bgStyle;
1156
+ let colorStyle;
1157
+ if (isActive) {
1158
+ bgStyle = color ? `${color}33` : "var(--chakra-colors-primary-subtle)";
1159
+ colorStyle = color ?? "var(--chakra-colors-primary-fg)";
1160
+ } else {
1161
+ bgStyle = "var(--chakra-colors-bg-muted)";
1162
+ colorStyle = "var(--chakra-colors-fg-default)";
1163
+ }
1164
+ return /* @__PURE__ */ jsx(
1165
+ Box,
1166
+ {
1167
+ as: "button",
1168
+ rounded: "md",
1169
+ px: 3,
1170
+ py: 1,
1171
+ fontSize: "sm",
1172
+ cursor: disabled ? "not-allowed" : "pointer",
1173
+ transition: "all 0.15s",
1174
+ opacity: disabled ? 0.5 : 1,
1175
+ style: {
1176
+ ...wrapItemBaseStyle,
1177
+ ...disabledStyle,
1178
+ background: bgStyle,
1179
+ color: colorStyle
1180
+ },
1181
+ onClick: !disabled ? () => onToggle?.(id) : void 0,
1182
+ children: label
1183
+ },
1184
+ id
1185
+ );
1186
+ });
1187
+ const renderListItems = () => items.map((item) => {
1188
+ const id = getItemId(item);
1189
+ const label = getItemLabel(item);
1190
+ const isActive = activeIdSet.has(id);
1191
+ const bgStyle = isActive ? "var(--chakra-colors-primary-subtle)" : "transparent";
1192
+ const colorStyle = isActive ? "var(--chakra-colors-primary-fg)" : "var(--chakra-colors-fg-default)";
1193
+ return /* @__PURE__ */ jsx(
1194
+ Box,
1195
+ {
1196
+ as: "button",
1197
+ px: 2,
1198
+ py: 1.5,
1199
+ rounded: "md",
1200
+ cursor: disabled ? "not-allowed" : "pointer",
1201
+ fontSize: "sm",
1202
+ opacity: disabled ? 0.5 : 1,
1203
+ _hover: { bg: isActive ? "primary.subtle" : "bg.subtle" },
1204
+ style: {
1205
+ ...listItemBaseStyle,
1206
+ ...disabledStyle,
1207
+ background: bgStyle,
1208
+ color: colorStyle
1209
+ },
1210
+ onClick: !disabled ? () => onToggle?.(id) : void 0,
1211
+ children: label
1212
+ },
1213
+ id
1214
+ );
1215
+ });
1216
+ const showEmpty = items.length === 0 && !isCreating;
1217
+ const showCreateLink = !!onCreate && !isCreating && !disabled;
1218
+ return /* @__PURE__ */ jsxs(Box, { children: [
1219
+ variant === "wrap" ? /* @__PURE__ */ jsxs(Flex, { wrap: "wrap", gap: 2, children: [
1220
+ showEmpty && /* @__PURE__ */ jsx(Text, { fontSize: "sm", color: "fg.muted", children: emptyText }),
1221
+ renderWrapItems()
1222
+ ] }) : /* @__PURE__ */ jsxs(Stack, { gap: 0, children: [
1223
+ showEmpty && /* @__PURE__ */ jsx(Text, { fontSize: "sm", color: "fg.muted", px: 2, py: 1.5, children: emptyText }),
1224
+ renderListItems()
1225
+ ] }),
1226
+ showCreateLink && /* @__PURE__ */ jsxs(
1227
+ "button",
1228
+ {
1229
+ type: "button",
1230
+ style: {
1231
+ display: "inline-flex",
1232
+ alignItems: "center",
1233
+ gap: "4px",
1234
+ cursor: "pointer",
1235
+ fontSize: "0.875rem",
1236
+ color: "var(--chakra-colors-fg-muted)",
1237
+ marginBlockStart: items.length > 0 ? "8px" : "4px",
1238
+ border: "none",
1239
+ background: "transparent",
1240
+ padding: 0
1241
+ },
1242
+ onClick: () => setIsCreating(true),
1243
+ children: [
1244
+ createIcon,
1245
+ /* @__PURE__ */ jsx("span", { children: createLabel })
1246
+ ]
1247
+ }
1248
+ ),
1249
+ isCreating && /* @__PURE__ */ jsx(Box, { mt: items.length > 0 ? 2 : 1, children: /* @__PURE__ */ jsx(
1250
+ text_input_default,
1251
+ {
1252
+ ref: inputRef,
1253
+ size: "sm",
1254
+ placeholder: createPlaceholder,
1255
+ disabled: isSubmitting,
1256
+ onKeyDown: handleKeyDown,
1257
+ onBlur: handleBlur
1258
+ }
1259
+ ) })
1260
+ ] });
1261
+ }
1262
+ var InlineCreatableList = InlineCreatableListInner;
1263
+ InlineCreatableList.displayName = "InlineCreatableList";
798
1264
  var LabeledSwitch = ({
799
1265
  ref,
800
1266
  ...props
@@ -827,7 +1293,6 @@ var Modal = ({
827
1293
  Button,
828
1294
  {
829
1295
  variant: "solid",
830
- colorPalette: "primary",
831
1296
  onClick: onSave,
832
1297
  disabled: saveDisabled || loading,
833
1298
  loading,
@@ -867,6 +1332,147 @@ var Modal = ({
867
1332
  );
868
1333
  };
869
1334
  Modal.displayName = "Modal";
1335
+ var SelectableCardThumbnail = ({
1336
+ height = "160px",
1337
+ children
1338
+ }) => /* @__PURE__ */ jsx(
1339
+ Box,
1340
+ {
1341
+ h: height,
1342
+ overflow: "hidden",
1343
+ bg: "bg.subtle",
1344
+ display: "flex",
1345
+ alignItems: "center",
1346
+ justifyContent: "center",
1347
+ children
1348
+ }
1349
+ );
1350
+ SelectableCardThumbnail.displayName = "SelectableCard.Thumbnail";
1351
+ var SelectableCardBody = ({ children }) => /* @__PURE__ */ jsx(Box, { p: 3, children });
1352
+ SelectableCardBody.displayName = "SelectableCard.Body";
1353
+ var SelectableCardFooter = ({ children }) => /* @__PURE__ */ jsx(
1354
+ Flex,
1355
+ {
1356
+ p: 3,
1357
+ borderTopWidth: "1px",
1358
+ borderColor: "border",
1359
+ justify: "space-between",
1360
+ align: "center",
1361
+ children
1362
+ }
1363
+ );
1364
+ SelectableCardFooter.displayName = "SelectableCard.Footer";
1365
+ var SelectableCard = ({
1366
+ selected,
1367
+ selectionVisible,
1368
+ onSelect,
1369
+ onClick,
1370
+ disabled,
1371
+ children
1372
+ }) => {
1373
+ return /* @__PURE__ */ jsxs(Box, { role: "group", position: "relative", children: [
1374
+ /* @__PURE__ */ jsx(
1375
+ Box,
1376
+ {
1377
+ rounded: "lg",
1378
+ overflow: "hidden",
1379
+ borderWidth: "1px",
1380
+ borderColor: "border",
1381
+ bg: "bg.surface",
1382
+ cursor: onClick ? "pointer" : void 0,
1383
+ onClick: disabled ? void 0 : onClick,
1384
+ outline: selected ? "2px solid" : void 0,
1385
+ outlineColor: selected ? "accent" : void 0,
1386
+ outlineOffset: selected ? "-2px" : void 0,
1387
+ opacity: disabled ? 0.5 : void 0,
1388
+ transition: "all 0.2s",
1389
+ _hover: { shadow: "md" },
1390
+ children
1391
+ }
1392
+ ),
1393
+ onSelect && /* @__PURE__ */ jsx(
1394
+ Box,
1395
+ {
1396
+ position: "absolute",
1397
+ top: 2,
1398
+ insetInlineStart: 2,
1399
+ zIndex: 1,
1400
+ opacity: selected || selectionVisible ? 1 : 0,
1401
+ _groupHover: { opacity: 1 },
1402
+ transition: "opacity 0.15s",
1403
+ children: /* @__PURE__ */ jsx(
1404
+ Checkbox$1,
1405
+ {
1406
+ checked: selected,
1407
+ onCheckedChange: () => onSelect(),
1408
+ onClick: (e) => e.stopPropagation(),
1409
+ size: "sm"
1410
+ }
1411
+ )
1412
+ }
1413
+ )
1414
+ ] });
1415
+ };
1416
+ SelectableCard.displayName = "SelectableCard";
1417
+ SelectableCard.Thumbnail = SelectableCardThumbnail;
1418
+ SelectableCard.Body = SelectableCardBody;
1419
+ SelectableCard.Footer = SelectableCardFooter;
1420
+ var SidebarSection = ({
1421
+ label,
1422
+ children,
1423
+ actionIcon,
1424
+ onAction,
1425
+ editContent,
1426
+ emptyText,
1427
+ defaultEditing
1428
+ }) => {
1429
+ const [isEditing, setEditing] = useState(defaultEditing ?? false);
1430
+ const hasActionButton = Boolean(actionIcon && (onAction || editContent));
1431
+ const handleActionClick = () => {
1432
+ if (onAction) {
1433
+ onAction();
1434
+ } else if (editContent) {
1435
+ setEditing((prev) => !prev);
1436
+ }
1437
+ };
1438
+ const resolvedIcon = isEditing && !onAction && editContent ? /* @__PURE__ */ jsx(X, { size: 14 }) : actionIcon;
1439
+ let content;
1440
+ if (typeof children === "function") {
1441
+ content = children({ isEditing, setEditing });
1442
+ } else if (isEditing && editContent) {
1443
+ content = editContent;
1444
+ } else {
1445
+ content = children;
1446
+ }
1447
+ const isEmpty = content === null || content === void 0 || content === "" || content === false;
1448
+ return /* @__PURE__ */ jsxs(Box, { py: 3, children: [
1449
+ /* @__PURE__ */ jsxs(Flex, { justify: "space-between", align: "center", children: [
1450
+ /* @__PURE__ */ jsx(
1451
+ Text,
1452
+ {
1453
+ fontSize: "xs",
1454
+ fontWeight: "semibold",
1455
+ color: "fg.muted",
1456
+ textTransform: "uppercase",
1457
+ letterSpacing: "wide",
1458
+ children: label
1459
+ }
1460
+ ),
1461
+ hasActionButton && /* @__PURE__ */ jsx(
1462
+ IconButton,
1463
+ {
1464
+ "aria-label": isEditing && !onAction ? "Cancel edit" : label,
1465
+ size: "xs",
1466
+ variant: "ghost",
1467
+ onClick: handleActionClick,
1468
+ children: resolvedIcon
1469
+ }
1470
+ )
1471
+ ] }),
1472
+ /* @__PURE__ */ jsx(Box, { py: 2, children: isEmpty && emptyText ? /* @__PURE__ */ jsx(Text, { fontSize: "sm", color: "fg.subtle", children: emptyText }) : content })
1473
+ ] });
1474
+ };
1475
+ SidebarSection.displayName = "SidebarSection";
870
1476
  var [StepperProvider, useStepperContext] = createContext({
871
1477
  name: "StepperContext",
872
1478
  errorMessage: "useStepperContext: `context` is undefined. Seems you forgot to wrap stepper components in `<Stepper />`"
@@ -1200,6 +1806,149 @@ var TreeViewNode = TreeView.Node;
1200
1806
  TreeViewNode.displayName = "TreeViewNode";
1201
1807
  var TreeViewLabel = TreeView.Label;
1202
1808
  TreeViewLabel.displayName = "TreeViewLabel";
1809
+ function matchesAccept(file, accept) {
1810
+ const tokens = accept.split(",").map((t) => t.trim());
1811
+ for (const token of tokens) {
1812
+ if (token.startsWith(".")) {
1813
+ if (file.name.toLowerCase().endsWith(token.toLowerCase())) {
1814
+ return true;
1815
+ }
1816
+ } else if (token.includes("/*")) {
1817
+ const prefix = token.slice(0, token.indexOf("/*"));
1818
+ if (file.type.startsWith(prefix)) {
1819
+ return true;
1820
+ }
1821
+ } else {
1822
+ if (file.type === token) {
1823
+ return true;
1824
+ }
1825
+ }
1826
+ }
1827
+ return false;
1828
+ }
1829
+ var UploadDropZone = ({
1830
+ onFiles,
1831
+ onError,
1832
+ accept,
1833
+ multiple = true,
1834
+ compact = false,
1835
+ disabled = false,
1836
+ children,
1837
+ maxSize,
1838
+ dragActiveText = "Release to upload",
1839
+ dropHintText = "Drag and drop files here",
1840
+ buttonLabel = "Browse Files"
1841
+ }) => {
1842
+ const [isDragActive, setIsDragActive] = useState(false);
1843
+ const inputRef = useRef(null);
1844
+ const processFiles = (fileList) => {
1845
+ const files = Array.from(fileList);
1846
+ const accepted = [];
1847
+ for (const file of files) {
1848
+ if (maxSize !== void 0 && file.size > maxSize) {
1849
+ onError?.({ file, reason: "size" });
1850
+ continue;
1851
+ }
1852
+ if (accept && !matchesAccept(file, accept)) {
1853
+ onError?.({ file, reason: "type" });
1854
+ continue;
1855
+ }
1856
+ accepted.push(file);
1857
+ }
1858
+ if (accepted.length > 0) {
1859
+ onFiles(multiple ? accepted : [accepted[0]]);
1860
+ }
1861
+ };
1862
+ const handleDragOver = (e) => {
1863
+ e.preventDefault();
1864
+ if (!disabled) {
1865
+ setIsDragActive(true);
1866
+ }
1867
+ };
1868
+ const handleDragLeave = () => {
1869
+ setIsDragActive(false);
1870
+ };
1871
+ const handleDrop = (e) => {
1872
+ e.preventDefault();
1873
+ setIsDragActive(false);
1874
+ if (disabled) return;
1875
+ if (e.dataTransfer.files && e.dataTransfer.files.length > 0) {
1876
+ processFiles(e.dataTransfer.files);
1877
+ }
1878
+ };
1879
+ const handleInputChange = (e) => {
1880
+ if (e.target.files && e.target.files.length > 0) {
1881
+ processFiles(e.target.files);
1882
+ }
1883
+ e.target.value = "";
1884
+ };
1885
+ const handleBrowseClick = () => {
1886
+ if (!disabled) {
1887
+ inputRef.current?.click();
1888
+ }
1889
+ };
1890
+ const defaultContent = isDragActive ? /* @__PURE__ */ jsx(Text, { color: "fg.muted", fontSize: "sm", children: dragActiveText }) : compact ? /* @__PURE__ */ jsxs(HStack, { gap: 3, align: "center", children: [
1891
+ /* @__PURE__ */ jsx(Upload, { size: 24 }),
1892
+ /* @__PURE__ */ jsx(Text, { color: "fg.muted", fontSize: "sm", children: dropHintText }),
1893
+ /* @__PURE__ */ jsx(
1894
+ Button,
1895
+ {
1896
+ variant: "outline",
1897
+ size: "sm",
1898
+ onClick: handleBrowseClick,
1899
+ disabled,
1900
+ children: buttonLabel
1901
+ }
1902
+ )
1903
+ ] }) : /* @__PURE__ */ jsxs(Stack, { align: "center", gap: 3, children: [
1904
+ /* @__PURE__ */ jsx(Upload, { size: 48 }),
1905
+ /* @__PURE__ */ jsx(Text, { color: "fg.muted", fontSize: "sm", children: dropHintText }),
1906
+ /* @__PURE__ */ jsx(
1907
+ Button,
1908
+ {
1909
+ variant: "outline",
1910
+ size: "sm",
1911
+ onClick: handleBrowseClick,
1912
+ disabled,
1913
+ children: buttonLabel
1914
+ }
1915
+ )
1916
+ ] });
1917
+ return /* @__PURE__ */ jsxs(
1918
+ Box,
1919
+ {
1920
+ borderStyle: "dashed",
1921
+ borderWidth: "2px",
1922
+ borderColor: isDragActive ? "accent" : "border",
1923
+ bg: isDragActive ? "bg.accent-subtle" : "bg.subtle",
1924
+ rounded: "lg",
1925
+ textAlign: "center",
1926
+ transition: "all 0.2s",
1927
+ p: compact ? 3 : 6,
1928
+ opacity: disabled ? 0.5 : 1,
1929
+ cursor: disabled ? "not-allowed" : "default",
1930
+ onDragOver: handleDragOver,
1931
+ onDragLeave: handleDragLeave,
1932
+ onDrop: handleDrop,
1933
+ children: [
1934
+ /* @__PURE__ */ jsx(
1935
+ "input",
1936
+ {
1937
+ ref: inputRef,
1938
+ type: "file",
1939
+ accept,
1940
+ multiple,
1941
+ style: { display: "none" },
1942
+ onChange: handleInputChange,
1943
+ disabled
1944
+ }
1945
+ ),
1946
+ children !== void 0 ? children : defaultContent
1947
+ ]
1948
+ }
1949
+ );
1950
+ };
1951
+ UploadDropZone.displayName = "UploadDropZone";
1203
1952
  var Widget = ({
1204
1953
  heading,
1205
1954
  subHeading,
@@ -1219,6 +1968,6 @@ var Widget = ({
1219
1968
  };
1220
1969
  Widget.displayName = "Widget";
1221
1970
 
1222
- export { ActionCell, BooleanCell, Card, CardList, CardListData, CardListItem, CodeCell, ColorSwatchCell, CountCell, DataTable, DateCell, DrawerRoot, FactBox, LabeledSwitch, Modal, NumberCell, Pagination, 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, 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 };
1223
1972
  //# sourceMappingURL=index.js.map
1224
1973
  //# sourceMappingURL=index.js.map