@shapesos/clay 0.10.0 → 0.12.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.
Files changed (85) hide show
  1. package/README.md +60 -0
  2. package/dist/artifacts.cjs +1467 -0
  3. package/dist/artifacts.cjs.map +1 -0
  4. package/dist/artifacts.d.cts +89 -0
  5. package/dist/artifacts.d.ts +89 -0
  6. package/dist/artifacts.js +33 -0
  7. package/dist/blocks.cjs +1418 -68
  8. package/dist/blocks.cjs.map +1 -1
  9. package/dist/blocks.css +2 -0
  10. package/dist/blocks.d.cts +36 -11
  11. package/dist/blocks.d.ts +36 -11
  12. package/dist/blocks.js +18 -5
  13. package/dist/button.d.cts +2 -2
  14. package/dist/button.d.ts +2 -2
  15. package/dist/chart.cjs +594 -0
  16. package/dist/chart.cjs.map +1 -0
  17. package/dist/chart.d.cts +439 -0
  18. package/dist/chart.d.ts +439 -0
  19. package/dist/chart.js +32 -0
  20. package/dist/chart.js.map +1 -0
  21. package/dist/chat.cjs +1462 -312
  22. package/dist/chat.cjs.map +1 -1
  23. package/dist/chat.d.cts +28 -10
  24. package/dist/chat.d.ts +28 -10
  25. package/dist/chat.js +10 -3
  26. package/dist/{chunk-R3BGPOAM.js → chunk-36CB624W.js} +53 -45
  27. package/dist/chunk-36CB624W.js.map +1 -0
  28. package/dist/chunk-4MZZH3WX.js +93 -0
  29. package/dist/chunk-4MZZH3WX.js.map +1 -0
  30. package/dist/chunk-AQEJRMRN.js +1 -0
  31. package/dist/chunk-AQEJRMRN.js.map +1 -0
  32. package/dist/{chunk-WS4IPADR.js → chunk-FFX3CAOX.js} +41 -109
  33. package/dist/chunk-FFX3CAOX.js.map +1 -0
  34. package/dist/chunk-JGMN6W72.js +12 -0
  35. package/dist/chunk-JGMN6W72.js.map +1 -0
  36. package/dist/{chunk-27GJUWVN.js → chunk-JJUIBBBU.js} +14 -8
  37. package/dist/chunk-JJUIBBBU.js.map +1 -0
  38. package/dist/{chunk-MLCRDVQ2.js → chunk-OBOXCBDL.js} +13 -5
  39. package/dist/chunk-OBOXCBDL.js.map +1 -0
  40. package/dist/chunk-P6GUNIAE.js +11 -0
  41. package/dist/chunk-P6GUNIAE.js.map +1 -0
  42. package/dist/chunk-QXGYMDIA.js +477 -0
  43. package/dist/chunk-QXGYMDIA.js.map +1 -0
  44. package/dist/chunk-Z5JWF24N.js +719 -0
  45. package/dist/chunk-Z5JWF24N.js.map +1 -0
  46. package/dist/icon.cjs +12 -4
  47. package/dist/icon.cjs.map +1 -1
  48. package/dist/icon.d.cts +19 -6
  49. package/dist/icon.d.ts +19 -6
  50. package/dist/icon.js +1 -1
  51. package/dist/index.cjs +1520 -332
  52. package/dist/index.cjs.map +1 -1
  53. package/dist/index.d.cts +7 -4
  54. package/dist/index.d.ts +7 -4
  55. package/dist/index.js +58 -25
  56. package/dist/lottie.d.cts +2 -2
  57. package/dist/lottie.d.ts +2 -2
  58. package/dist/table.cjs +142 -0
  59. package/dist/table.cjs.map +1 -0
  60. package/dist/table.d.cts +44 -0
  61. package/dist/table.d.ts +44 -0
  62. package/dist/table.js +25 -0
  63. package/dist/table.js.map +1 -0
  64. package/dist/text-area.d.cts +2 -2
  65. package/dist/text-area.d.ts +2 -2
  66. package/dist/types-B2aYk82c.d.cts +29 -0
  67. package/dist/types-B2aYk82c.d.ts +29 -0
  68. package/dist/types-C0BvwliI.d.cts +332 -0
  69. package/dist/types-C5bFH4v3.d.ts +332 -0
  70. package/dist/types-DCutaXjZ.d.cts +83 -0
  71. package/dist/types-uPfn67Dc.d.ts +83 -0
  72. package/dist/utils.cjs +14 -7
  73. package/dist/utils.cjs.map +1 -1
  74. package/dist/utils.d.cts +18 -1
  75. package/dist/utils.d.ts +18 -1
  76. package/dist/utils.js +6 -4
  77. package/package.json +41 -4
  78. package/dist/chunk-27GJUWVN.js.map +0 -1
  79. package/dist/chunk-MLCRDVQ2.js.map +0 -1
  80. package/dist/chunk-OKPNST44.js +0 -1
  81. package/dist/chunk-R3BGPOAM.js.map +0 -1
  82. package/dist/chunk-WS4IPADR.js.map +0 -1
  83. package/dist/types-Q9aqd9nq.d.cts +0 -34
  84. package/dist/types-Q9aqd9nq.d.ts +0 -34
  85. /package/dist/{chunk-OKPNST44.js.map → artifacts.js.map} +0 -0
package/dist/index.d.cts CHANGED
@@ -1,13 +1,16 @@
1
1
  export { ColorToken, TypographyStyle, TypographyType, colors, fontFamilies, typographyMixin, typographyStyles, typographyTypes } from './tokens.cjs';
2
- export { Block, BlockContext, BlockContextValue, BlockServices, TextBlockService, useBlockContext } from './blocks.cjs';
3
- export { B as BlockComponentProps, a as BlockRecord, b as BlockService, c as BlockType, T as TextBlockRecord, d as blockTypes } from './types-Q9aqd9nq.cjs';
4
- export { ChatContext, ChatContextValue, ChatMessage, ChatMessageType, MESSAGE_ROLE, MessageRole, useChatContext, useCopyToClipboard } from './chat.cjs';
2
+ export { ArtifactRefBlock, ArtifactRefBlockService, Block, BlockContext, BlockContextValue, BlockServices, TextBlockService, useBlockContext } from './blocks.cjs';
3
+ export { A as ArtifactRefBlockRecord, B as BlockComponentProps, a as BlockRecord, b as BlockService, c as BlockType, T as TextBlockRecord, d as blockTypes } from './types-DCutaXjZ.cjs';
4
+ export { A as ArtifactDataRow, a as ArtifactLabelsMap, b as ArtifactRecord, c as ArtifactService, d as ArtifactServiceProps, e as ArtifactType, B as BarChartConfig, C as ChartArtifactLabels, f as ChartArtifactRecord, g as ChartConfig, h as ChartStats, D as DEFAULT_CHART_ARTIFACT_LABELS, i as DEFAULT_TABLE_ARTIFACT_LABELS, L as LineChartConfig, P as PieChartConfig, T as TableArtifactLabels, j as TableArtifactRecord, k as TableColumn, l as TableConfig, m as TableRow, n as TableStats, o as artifactTypes } from './types-C0BvwliI.cjs';
5
+ export { ArtifactDownloadButton, ArtifactDownloadButtonProps, ArtifactServices, ChartArtifact, TableArtifact, artifactToClipboardText, isSafeDownloadUrl } from './artifacts.cjs';
6
+ export { ChatContext, ChatContextValue, ChatMessage, ChatMessageType, MESSAGE_ROLE, MessageRole, copyMessageText, useChatContext, useCopyToClipboard } from './chat.cjs';
5
7
  export { Icon, IconButton, IconButtonProps, IconButtonSize, IconButtonVariant, IconProps } from './icon.cjs';
6
8
  export { IconCtrl, KEYBOARD_SHORTCUT_VARIANTS, KeyIcon, KeyboardShortcut, KeyboardShortcutProps, KeyboardShortcutVariant } from './keyboard-shortcut.cjs';
7
9
  export { Lottie, LottieAnimationData, LottieProps, LottieRef } from './lottie.cjs';
8
10
  export { TextArea, TextAreaProps } from './text-area.cjs';
9
- export { MarkdownTable, convertTableToCSV, markdownToPlainText, mergeRefs, parseMarkdownTable } from './utils.cjs';
11
+ export { MarkdownTable, convertTableToCSV, escapeCsvField, markdownToPlainText, mergeRefs, parseMarkdownTable } from './utils.cjs';
10
12
  export { BUTTON_INTENT, BUTTON_SIZE, BUTTON_VARIANT, Button, ButtonIntent, ButtonProps, ButtonSize, ButtonVariant, ICON_POSITION, IconPosition } from './button.cjs';
13
+ export { C as ChartSeries, a as ChartVariant } from './types-B2aYk82c.cjs';
11
14
  import 'react';
12
15
  import 'react/jsx-runtime';
13
16
  import 'lottie-web';
package/dist/index.d.ts CHANGED
@@ -1,13 +1,16 @@
1
1
  export { ColorToken, TypographyStyle, TypographyType, colors, fontFamilies, typographyMixin, typographyStyles, typographyTypes } from './tokens.js';
2
- export { Block, BlockContext, BlockContextValue, BlockServices, TextBlockService, useBlockContext } from './blocks.js';
3
- export { B as BlockComponentProps, a as BlockRecord, b as BlockService, c as BlockType, T as TextBlockRecord, d as blockTypes } from './types-Q9aqd9nq.js';
4
- export { ChatContext, ChatContextValue, ChatMessage, ChatMessageType, MESSAGE_ROLE, MessageRole, useChatContext, useCopyToClipboard } from './chat.js';
2
+ export { ArtifactRefBlock, ArtifactRefBlockService, Block, BlockContext, BlockContextValue, BlockServices, TextBlockService, useBlockContext } from './blocks.js';
3
+ export { A as ArtifactRefBlockRecord, B as BlockComponentProps, a as BlockRecord, b as BlockService, c as BlockType, T as TextBlockRecord, d as blockTypes } from './types-uPfn67Dc.js';
4
+ export { A as ArtifactDataRow, a as ArtifactLabelsMap, b as ArtifactRecord, c as ArtifactService, d as ArtifactServiceProps, e as ArtifactType, B as BarChartConfig, C as ChartArtifactLabels, f as ChartArtifactRecord, g as ChartConfig, h as ChartStats, D as DEFAULT_CHART_ARTIFACT_LABELS, i as DEFAULT_TABLE_ARTIFACT_LABELS, L as LineChartConfig, P as PieChartConfig, T as TableArtifactLabels, j as TableArtifactRecord, k as TableColumn, l as TableConfig, m as TableRow, n as TableStats, o as artifactTypes } from './types-C5bFH4v3.js';
5
+ export { ArtifactDownloadButton, ArtifactDownloadButtonProps, ArtifactServices, ChartArtifact, TableArtifact, artifactToClipboardText, isSafeDownloadUrl } from './artifacts.js';
6
+ export { ChatContext, ChatContextValue, ChatMessage, ChatMessageType, MESSAGE_ROLE, MessageRole, copyMessageText, useChatContext, useCopyToClipboard } from './chat.js';
5
7
  export { Icon, IconButton, IconButtonProps, IconButtonSize, IconButtonVariant, IconProps } from './icon.js';
6
8
  export { IconCtrl, KEYBOARD_SHORTCUT_VARIANTS, KeyIcon, KeyboardShortcut, KeyboardShortcutProps, KeyboardShortcutVariant } from './keyboard-shortcut.js';
7
9
  export { Lottie, LottieAnimationData, LottieProps, LottieRef } from './lottie.js';
8
10
  export { TextArea, TextAreaProps } from './text-area.js';
9
- export { MarkdownTable, convertTableToCSV, markdownToPlainText, mergeRefs, parseMarkdownTable } from './utils.js';
11
+ export { MarkdownTable, convertTableToCSV, escapeCsvField, markdownToPlainText, mergeRefs, parseMarkdownTable } from './utils.js';
10
12
  export { BUTTON_INTENT, BUTTON_SIZE, BUTTON_VARIANT, Button, ButtonIntent, ButtonProps, ButtonSize, ButtonVariant, ICON_POSITION, IconPosition } from './button.js';
13
+ export { C as ChartSeries, a as ChartVariant } from './types-B2aYk82c.js';
11
14
  import 'react';
12
15
  import 'react/jsx-runtime';
13
16
  import 'lottie-web';
package/dist/index.js CHANGED
@@ -1,7 +1,22 @@
1
+ import {
2
+ Lottie
3
+ } from "./chunk-BIATJTD4.js";
4
+ import {
5
+ TextArea
6
+ } from "./chunk-WPQQVKWY.js";
7
+ import {
8
+ IconCtrl,
9
+ KEYBOARD_SHORTCUT_VARIANTS,
10
+ KeyboardShortcut
11
+ } from "./chunk-L6DUGB2E.js";
1
12
  import {
2
13
  convertTableToCSV,
14
+ escapeCsvField,
3
15
  parseMarkdownTable
4
- } from "./chunk-27GJUWVN.js";
16
+ } from "./chunk-JJUIBBBU.js";
17
+ import {
18
+ mergeRefs
19
+ } from "./chunk-KNYB3RL7.js";
5
20
  import {
6
21
  BUTTON_INTENT,
7
22
  BUTTON_SIZE,
@@ -9,50 +24,55 @@ import {
9
24
  Button,
10
25
  ICON_POSITION
11
26
  } from "./chunk-EDICS62G.js";
12
- import "./chunk-C77QMQNT.js";
13
27
  import {
14
28
  ChatContext,
15
29
  ChatMessage,
16
30
  MESSAGE_ROLE,
31
+ copyMessageText,
17
32
  useChatContext,
18
33
  useCopyToClipboard
19
- } from "./chunk-WS4IPADR.js";
34
+ } from "./chunk-FFX3CAOX.js";
20
35
  import {
21
- markdownToPlainText
22
- } from "./chunk-NMKKU2UG.js";
23
- import "./chunk-OKPNST44.js";
36
+ BlockContext,
37
+ useBlockContext
38
+ } from "./chunk-JGMN6W72.js";
24
39
  import {
40
+ ArtifactRefBlock,
41
+ ArtifactRefBlockService,
25
42
  Block,
26
- BlockContext,
27
43
  BlockServices,
28
44
  TextBlockService,
29
- blockTypes,
30
- useBlockContext
31
- } from "./chunk-R3BGPOAM.js";
32
- import "./chunk-72TJUKMV.js";
33
- import {
34
- IconButton
35
- } from "./chunk-MLCRDVQ2.js";
36
- import {
37
- Lottie
38
- } from "./chunk-BIATJTD4.js";
45
+ blockTypes
46
+ } from "./chunk-36CB624W.js";
39
47
  import {
40
- TextArea
41
- } from "./chunk-WPQQVKWY.js";
48
+ markdownToPlainText
49
+ } from "./chunk-NMKKU2UG.js";
50
+ import "./chunk-AQEJRMRN.js";
42
51
  import {
43
- mergeRefs
44
- } from "./chunk-KNYB3RL7.js";
52
+ ArtifactDownloadButton,
53
+ ArtifactServices,
54
+ ChartArtifact,
55
+ DEFAULT_CHART_ARTIFACT_LABELS,
56
+ DEFAULT_TABLE_ARTIFACT_LABELS,
57
+ TableArtifact,
58
+ artifactToClipboardText,
59
+ artifactTypes,
60
+ isSafeDownloadUrl
61
+ } from "./chunk-Z5JWF24N.js";
62
+ import "./chunk-QXGYMDIA.js";
63
+ import "./chunk-C77QMQNT.js";
45
64
  import {
46
65
  fontFamilies,
47
66
  typographyMixin,
48
67
  typographyStyles,
49
68
  typographyTypes
50
69
  } from "./chunk-SV24ONND.js";
70
+ import "./chunk-4MZZH3WX.js";
71
+ import "./chunk-P6GUNIAE.js";
72
+ import "./chunk-72TJUKMV.js";
51
73
  import {
52
- IconCtrl,
53
- KEYBOARD_SHORTCUT_VARIANTS,
54
- KeyboardShortcut
55
- } from "./chunk-L6DUGB2E.js";
74
+ IconButton
75
+ } from "./chunk-OBOXCBDL.js";
56
76
  import {
57
77
  Icon
58
78
  } from "./chunk-OLJIJYB5.js";
@@ -61,6 +81,10 @@ import {
61
81
  } from "./chunk-JF3P66JF.js";
62
82
  import "./chunk-5WRI5ZAA.js";
63
83
  export {
84
+ ArtifactDownloadButton,
85
+ ArtifactRefBlock,
86
+ ArtifactRefBlockService,
87
+ ArtifactServices,
64
88
  BUTTON_INTENT,
65
89
  BUTTON_SIZE,
66
90
  BUTTON_VARIANT,
@@ -68,8 +92,11 @@ export {
68
92
  BlockContext,
69
93
  BlockServices,
70
94
  Button,
95
+ ChartArtifact,
71
96
  ChatContext,
72
97
  ChatMessage,
98
+ DEFAULT_CHART_ARTIFACT_LABELS,
99
+ DEFAULT_TABLE_ARTIFACT_LABELS,
73
100
  ICON_POSITION,
74
101
  Icon,
75
102
  IconButton,
@@ -78,12 +105,18 @@ export {
78
105
  KeyboardShortcut,
79
106
  Lottie,
80
107
  MESSAGE_ROLE,
108
+ TableArtifact,
81
109
  TextArea,
82
110
  TextBlockService,
111
+ artifactToClipboardText,
112
+ artifactTypes,
83
113
  blockTypes,
84
114
  colors,
85
115
  convertTableToCSV,
116
+ copyMessageText,
117
+ escapeCsvField,
86
118
  fontFamilies,
119
+ isSafeDownloadUrl,
87
120
  markdownToPlainText,
88
121
  mergeRefs,
89
122
  parseMarkdownTable,
package/dist/lottie.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import * as react from 'react';
1
+ import * as React from 'react';
2
2
  import { AnimationItem } from 'lottie-web';
3
3
 
4
4
  /** JSON animation data exported from After Effects via the Bodymovin plugin. */
@@ -59,6 +59,6 @@ interface LottieRef {
59
59
  getAnimationItem(): AnimationItem | null;
60
60
  }
61
61
 
62
- declare const Lottie: react.ForwardRefExoticComponent<LottieProps & react.RefAttributes<LottieRef>>;
62
+ declare const Lottie: React.ForwardRefExoticComponent<LottieProps & React.RefAttributes<LottieRef>>;
63
63
 
64
64
  export { Lottie, type LottieAnimationData, type LottieProps, type LottieRef };
package/dist/lottie.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import * as react from 'react';
1
+ import * as React from 'react';
2
2
  import { AnimationItem } from 'lottie-web';
3
3
 
4
4
  /** JSON animation data exported from After Effects via the Bodymovin plugin. */
@@ -59,6 +59,6 @@ interface LottieRef {
59
59
  getAnimationItem(): AnimationItem | null;
60
60
  }
61
61
 
62
- declare const Lottie: react.ForwardRefExoticComponent<LottieProps & react.RefAttributes<LottieRef>>;
62
+ declare const Lottie: React.ForwardRefExoticComponent<LottieProps & React.RefAttributes<LottieRef>>;
63
63
 
64
64
  export { Lottie, type LottieAnimationData, type LottieProps, type LottieRef };
package/dist/table.cjs ADDED
@@ -0,0 +1,142 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/components/table/index.ts
31
+ var table_exports = {};
32
+ __export(table_exports, {
33
+ Table: () => Table,
34
+ TableBody: () => TableBody,
35
+ TableCaption: () => TableCaption,
36
+ TableCell: () => TableCell,
37
+ TableFooter: () => TableFooter,
38
+ TableHead: () => TableHead,
39
+ TableHeader: () => TableHeader,
40
+ TableRow: () => TableRow,
41
+ useScrollShadow: () => useScrollShadow
42
+ });
43
+ module.exports = __toCommonJS(table_exports);
44
+
45
+ // src/components/ui/table.tsx
46
+ var React = __toESM(require("react"), 1);
47
+
48
+ // src/lib/utils.ts
49
+ var import_clsx = require("clsx");
50
+ var import_tailwind_merge = require("tailwind-merge");
51
+ function cn(...inputs) {
52
+ return (0, import_tailwind_merge.twMerge)((0, import_clsx.clsx)(inputs));
53
+ }
54
+
55
+ // src/components/ui/table.tsx
56
+ var import_jsx_runtime = require("react/jsx-runtime");
57
+ var Table = React.forwardRef(({ className, containerClassName, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: cn("relative w-full overflow-auto", containerClassName), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("table", { ref, className: cn("w-full caption-bottom text-sm", className), ...props }) }));
58
+ Table.displayName = "Table";
59
+ var TableHeader = React.forwardRef(
60
+ ({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("thead", { ref, className: cn("[&_tr]:border-b", className), ...props })
61
+ );
62
+ TableHeader.displayName = "TableHeader";
63
+ var TableBody = React.forwardRef(
64
+ ({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("tbody", { ref, className: cn("[&_tr:last-child]:border-0", className), ...props })
65
+ );
66
+ TableBody.displayName = "TableBody";
67
+ var TableFooter = React.forwardRef(
68
+ ({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("tfoot", { ref, className: cn("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0", className), ...props })
69
+ );
70
+ TableFooter.displayName = "TableFooter";
71
+ var TableRow = React.forwardRef(
72
+ ({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
73
+ "tr",
74
+ {
75
+ ref,
76
+ className: cn("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted", className),
77
+ ...props
78
+ }
79
+ )
80
+ );
81
+ TableRow.displayName = "TableRow";
82
+ var TableHead = React.forwardRef(
83
+ ({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
84
+ "th",
85
+ {
86
+ ref,
87
+ className: cn(
88
+ "h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",
89
+ className
90
+ ),
91
+ ...props
92
+ }
93
+ )
94
+ );
95
+ TableHead.displayName = "TableHead";
96
+ var TableCell = React.forwardRef(
97
+ ({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", { ref, className: cn("p-4 align-middle [&:has([role=checkbox])]:pr-0", className), ...props })
98
+ );
99
+ TableCell.displayName = "TableCell";
100
+ var TableCaption = React.forwardRef(
101
+ ({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("caption", { ref, className: cn("mt-4 text-sm text-muted-foreground", className), ...props })
102
+ );
103
+ TableCaption.displayName = "TableCaption";
104
+
105
+ // src/components/table/use-scroll-shadow.ts
106
+ var import_react = require("react");
107
+ function useScrollShadow() {
108
+ const targetRef = (0, import_react.useRef)(null);
109
+ const [isScrolled, setIsScrolled] = (0, import_react.useState)(false);
110
+ (0, import_react.useEffect)(() => {
111
+ const target = targetRef.current;
112
+ if (!target) return;
113
+ let scrollContainer = target;
114
+ while (scrollContainer) {
115
+ const overflowY = getComputedStyle(scrollContainer).overflowY;
116
+ if (overflowY === "auto" || overflowY === "scroll") break;
117
+ scrollContainer = scrollContainer.parentElement;
118
+ }
119
+ if (!scrollContainer) return;
120
+ setIsScrolled(scrollContainer.scrollTop > 0);
121
+ const handleScroll = () => {
122
+ if (!scrollContainer) return;
123
+ setIsScrolled(scrollContainer.scrollTop > 0);
124
+ };
125
+ scrollContainer.addEventListener("scroll", handleScroll, { passive: true });
126
+ return () => scrollContainer.removeEventListener("scroll", handleScroll);
127
+ }, []);
128
+ return { targetRef, isScrolled };
129
+ }
130
+ // Annotate the CommonJS export names for ESM import in node:
131
+ 0 && (module.exports = {
132
+ Table,
133
+ TableBody,
134
+ TableCaption,
135
+ TableCell,
136
+ TableFooter,
137
+ TableHead,
138
+ TableHeader,
139
+ TableRow,
140
+ useScrollShadow
141
+ });
142
+ //# sourceMappingURL=table.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/table/index.ts","../src/components/ui/table.tsx","../src/lib/utils.ts","../src/components/table/use-scroll-shadow.ts"],"sourcesContent":["/**\n * Public clay table primitives — shadcn-style compound components.\n *\n * Consumers compose tables at the call site from these parts (no wrapper, no smart `Table`):\n *\n * ```tsx\n * import { Table, TableHeader, TableBody, TableRow, TableHead, TableCell } from \"@shapesos/clay/table\";\n *\n * <Table>\n * <TableHeader>\n * <TableRow>\n * <TableHead>Name</TableHead>\n * <TableHead>Count</TableHead>\n * </TableRow>\n * </TableHeader>\n * <TableBody>\n * {rows.map((row) => (\n * <TableRow key={row.id}>\n * <TableCell>{row.name}</TableCell>\n * <TableCell>{row.count}</TableCell>\n * </TableRow>\n * ))}\n * </TableBody>\n * </Table>\n * ```\n *\n * `Table` extends shadcn's primitive with a `containerClassName` prop so callers can override the\n * wrapping `<div>`'s `overflow-auto` — needed when the table sits inside an outer scroll container\n * (e.g. an artifact card) and you want the sticky-header containing block to align with that\n * outer container.\n *\n * **Style note:** these primitives use Tailwind v4 + the clay theme tokens (`bg-muted`,\n * `text-muted-foreground`, `border-border`, etc.). Consumers must import the compiled stylesheet\n * alongside the JS:\n *\n * ```ts\n * import \"@shapesos/clay/blocks/styles.css\";\n * ```\n *\n * (The stylesheet name is `blocks/styles.css` for historical reasons — it's the single bundle\n * that compiles all clay-side Tailwind output, including the table primitives.)\n */\nexport {\n Table,\n TableBody,\n TableCaption,\n TableCell,\n TableFooter,\n TableHead,\n TableHeader,\n TableRow,\n} from \"@/components/ui/table\";\nexport { useScrollShadow } from \"./use-scroll-shadow\";\n","import * as React from \"react\";\n\nimport { cn } from \"@/lib/utils\";\n\n/** Extension of shadcn's `Table` registry component: exposes `containerClassName` so callers can\n * override the wrapping `<div>`'s default `overflow-auto`. We need this for sticky-header support\n * (sticky uses the nearest overflow ancestor as its containing block — when the actual scroll\n * container is one level out, the inner overflow-auto needs to be neutralised with\n * `overflow-visible` so sticky aligns with the real scrolling parent). */\nconst Table = React.forwardRef<\n HTMLTableElement,\n React.HTMLAttributes<HTMLTableElement> & { containerClassName?: string }\n>(({ className, containerClassName, ...props }, ref) => (\n <div className={cn(\"relative w-full overflow-auto\", containerClassName)}>\n <table ref={ref} className={cn(\"w-full caption-bottom text-sm\", className)} {...props} />\n </div>\n));\nTable.displayName = \"Table\";\n\nconst TableHeader = React.forwardRef<HTMLTableSectionElement, React.HTMLAttributes<HTMLTableSectionElement>>(\n ({ className, ...props }, ref) => <thead ref={ref} className={cn(\"[&_tr]:border-b\", className)} {...props} />\n);\nTableHeader.displayName = \"TableHeader\";\n\nconst TableBody = React.forwardRef<HTMLTableSectionElement, React.HTMLAttributes<HTMLTableSectionElement>>(\n ({ className, ...props }, ref) => (\n <tbody ref={ref} className={cn(\"[&_tr:last-child]:border-0\", className)} {...props} />\n )\n);\nTableBody.displayName = \"TableBody\";\n\nconst TableFooter = React.forwardRef<HTMLTableSectionElement, React.HTMLAttributes<HTMLTableSectionElement>>(\n ({ className, ...props }, ref) => (\n <tfoot ref={ref} className={cn(\"border-t bg-muted/50 font-medium [&>tr]:last:border-b-0\", className)} {...props} />\n )\n);\nTableFooter.displayName = \"TableFooter\";\n\nconst TableRow = React.forwardRef<HTMLTableRowElement, React.HTMLAttributes<HTMLTableRowElement>>(\n ({ className, ...props }, ref) => (\n <tr\n ref={ref}\n className={cn(\"border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted\", className)}\n {...props}\n />\n )\n);\nTableRow.displayName = \"TableRow\";\n\nconst TableHead = React.forwardRef<HTMLTableCellElement, React.ThHTMLAttributes<HTMLTableCellElement>>(\n ({ className, ...props }, ref) => (\n <th\n ref={ref}\n className={cn(\n \"h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0\",\n className\n )}\n {...props}\n />\n )\n);\nTableHead.displayName = \"TableHead\";\n\nconst TableCell = React.forwardRef<HTMLTableCellElement, React.TdHTMLAttributes<HTMLTableCellElement>>(\n ({ className, ...props }, ref) => (\n <td ref={ref} className={cn(\"p-4 align-middle [&:has([role=checkbox])]:pr-0\", className)} {...props} />\n )\n);\nTableCell.displayName = \"TableCell\";\n\nconst TableCaption = React.forwardRef<HTMLTableCaptionElement, React.HTMLAttributes<HTMLTableCaptionElement>>(\n ({ className, ...props }, ref) => (\n <caption ref={ref} className={cn(\"mt-4 text-sm text-muted-foreground\", className)} {...props} />\n )\n);\nTableCaption.displayName = \"TableCaption\";\n\nexport { Table, TableHeader, TableBody, TableFooter, TableHead, TableRow, TableCell, TableCaption };\n","import { clsx, type ClassValue } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\n/**\n * Combines class names using clsx and tailwind-merge — the standard shadcn/ui helper.\n * Tailwind classes that conflict (e.g. `p-2 p-4`) get merged so the last one wins.\n */\nexport function cn(...inputs: ClassValue[]): string {\n return twMerge(clsx(inputs));\n}\n","import { useEffect, useRef, useState, type RefObject } from \"react\";\n\n/**\n * Tracks whether a scroll container has scrolled past its top edge, for sticky-header shadow effects.\n *\n * Returns `targetRef` (attach to the scroll container itself or any element inside it) and\n * `isScrolled` (true once the container's `scrollTop > 0`). On mount the hook walks up the DOM\n * from the target to find the nearest overflow ancestor (or uses the target itself if it already\n * has `overflowY: auto | scroll`), then listens to its `scroll` event.\n *\n * Used to surface a subtle \"scroll lift\" shadow under sticky headers so users know there is\n * content hidden above.\n *\n * **Why a scroll listener and not a sentinel + IntersectionObserver:** an earlier version used a\n * 1px sentinel as the first child of the scroll container. The sentinel's height pushed the thead\n * down by one pixel in normal flow, and as soon as the user scrolled the thead snapped up to its\n * sticky position — a visible 1px jitter. A scroll listener has no layout footprint.\n *\n * `passive: true` so the listener doesn't block native scroll smoothness; we never call\n * `preventDefault`.\n */\nexport function useScrollShadow(): {\n targetRef: RefObject<HTMLDivElement | null>;\n isScrolled: boolean;\n} {\n const targetRef = useRef<HTMLDivElement>(null);\n const [isScrolled, setIsScrolled] = useState(false);\n\n useEffect(() => {\n const target = targetRef.current;\n if (!target) return;\n\n let scrollContainer: HTMLElement | null = target;\n while (scrollContainer) {\n const overflowY = getComputedStyle(scrollContainer).overflowY;\n if (overflowY === \"auto\" || overflowY === \"scroll\") break;\n scrollContainer = scrollContainer.parentElement;\n }\n if (!scrollContainer) return;\n\n setIsScrolled(scrollContainer.scrollTop > 0);\n\n const handleScroll = () => {\n if (!scrollContainer) return;\n setIsScrolled(scrollContainer.scrollTop > 0);\n };\n scrollContainer.addEventListener(\"scroll\", handleScroll, { passive: true });\n return () => scrollContainer.removeEventListener(\"scroll\", handleScroll);\n }, []);\n\n return { targetRef, isScrolled };\n}\n"],"mappings":"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","names":[]}
@@ -0,0 +1,44 @@
1
+ import * as React from 'react';
2
+ import { RefObject } from 'react';
3
+
4
+ /** Extension of shadcn's `Table` registry component: exposes `containerClassName` so callers can
5
+ * override the wrapping `<div>`'s default `overflow-auto`. We need this for sticky-header support
6
+ * (sticky uses the nearest overflow ancestor as its containing block — when the actual scroll
7
+ * container is one level out, the inner overflow-auto needs to be neutralised with
8
+ * `overflow-visible` so sticky aligns with the real scrolling parent). */
9
+ declare const Table: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLTableElement> & {
10
+ containerClassName?: string;
11
+ } & React.RefAttributes<HTMLTableElement>>;
12
+ declare const TableHeader: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLTableSectionElement> & React.RefAttributes<HTMLTableSectionElement>>;
13
+ declare const TableBody: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLTableSectionElement> & React.RefAttributes<HTMLTableSectionElement>>;
14
+ declare const TableFooter: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLTableSectionElement> & React.RefAttributes<HTMLTableSectionElement>>;
15
+ declare const TableRow: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLTableRowElement> & React.RefAttributes<HTMLTableRowElement>>;
16
+ declare const TableHead: React.ForwardRefExoticComponent<React.ThHTMLAttributes<HTMLTableCellElement> & React.RefAttributes<HTMLTableCellElement>>;
17
+ declare const TableCell: React.ForwardRefExoticComponent<React.TdHTMLAttributes<HTMLTableCellElement> & React.RefAttributes<HTMLTableCellElement>>;
18
+ declare const TableCaption: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLTableCaptionElement> & React.RefAttributes<HTMLTableCaptionElement>>;
19
+
20
+ /**
21
+ * Tracks whether a scroll container has scrolled past its top edge, for sticky-header shadow effects.
22
+ *
23
+ * Returns `targetRef` (attach to the scroll container itself or any element inside it) and
24
+ * `isScrolled` (true once the container's `scrollTop > 0`). On mount the hook walks up the DOM
25
+ * from the target to find the nearest overflow ancestor (or uses the target itself if it already
26
+ * has `overflowY: auto | scroll`), then listens to its `scroll` event.
27
+ *
28
+ * Used to surface a subtle "scroll lift" shadow under sticky headers so users know there is
29
+ * content hidden above.
30
+ *
31
+ * **Why a scroll listener and not a sentinel + IntersectionObserver:** an earlier version used a
32
+ * 1px sentinel as the first child of the scroll container. The sentinel's height pushed the thead
33
+ * down by one pixel in normal flow, and as soon as the user scrolled the thead snapped up to its
34
+ * sticky position — a visible 1px jitter. A scroll listener has no layout footprint.
35
+ *
36
+ * `passive: true` so the listener doesn't block native scroll smoothness; we never call
37
+ * `preventDefault`.
38
+ */
39
+ declare function useScrollShadow(): {
40
+ targetRef: RefObject<HTMLDivElement | null>;
41
+ isScrolled: boolean;
42
+ };
43
+
44
+ export { Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, useScrollShadow };
@@ -0,0 +1,44 @@
1
+ import * as React from 'react';
2
+ import { RefObject } from 'react';
3
+
4
+ /** Extension of shadcn's `Table` registry component: exposes `containerClassName` so callers can
5
+ * override the wrapping `<div>`'s default `overflow-auto`. We need this for sticky-header support
6
+ * (sticky uses the nearest overflow ancestor as its containing block — when the actual scroll
7
+ * container is one level out, the inner overflow-auto needs to be neutralised with
8
+ * `overflow-visible` so sticky aligns with the real scrolling parent). */
9
+ declare const Table: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLTableElement> & {
10
+ containerClassName?: string;
11
+ } & React.RefAttributes<HTMLTableElement>>;
12
+ declare const TableHeader: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLTableSectionElement> & React.RefAttributes<HTMLTableSectionElement>>;
13
+ declare const TableBody: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLTableSectionElement> & React.RefAttributes<HTMLTableSectionElement>>;
14
+ declare const TableFooter: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLTableSectionElement> & React.RefAttributes<HTMLTableSectionElement>>;
15
+ declare const TableRow: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLTableRowElement> & React.RefAttributes<HTMLTableRowElement>>;
16
+ declare const TableHead: React.ForwardRefExoticComponent<React.ThHTMLAttributes<HTMLTableCellElement> & React.RefAttributes<HTMLTableCellElement>>;
17
+ declare const TableCell: React.ForwardRefExoticComponent<React.TdHTMLAttributes<HTMLTableCellElement> & React.RefAttributes<HTMLTableCellElement>>;
18
+ declare const TableCaption: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLTableCaptionElement> & React.RefAttributes<HTMLTableCaptionElement>>;
19
+
20
+ /**
21
+ * Tracks whether a scroll container has scrolled past its top edge, for sticky-header shadow effects.
22
+ *
23
+ * Returns `targetRef` (attach to the scroll container itself or any element inside it) and
24
+ * `isScrolled` (true once the container's `scrollTop > 0`). On mount the hook walks up the DOM
25
+ * from the target to find the nearest overflow ancestor (or uses the target itself if it already
26
+ * has `overflowY: auto | scroll`), then listens to its `scroll` event.
27
+ *
28
+ * Used to surface a subtle "scroll lift" shadow under sticky headers so users know there is
29
+ * content hidden above.
30
+ *
31
+ * **Why a scroll listener and not a sentinel + IntersectionObserver:** an earlier version used a
32
+ * 1px sentinel as the first child of the scroll container. The sentinel's height pushed the thead
33
+ * down by one pixel in normal flow, and as soon as the user scrolled the thead snapped up to its
34
+ * sticky position — a visible 1px jitter. A scroll listener has no layout footprint.
35
+ *
36
+ * `passive: true` so the listener doesn't block native scroll smoothness; we never call
37
+ * `preventDefault`.
38
+ */
39
+ declare function useScrollShadow(): {
40
+ targetRef: RefObject<HTMLDivElement | null>;
41
+ isScrolled: boolean;
42
+ };
43
+
44
+ export { Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, useScrollShadow };
package/dist/table.js ADDED
@@ -0,0 +1,25 @@
1
+ import {
2
+ Table,
3
+ TableBody,
4
+ TableCaption,
5
+ TableCell,
6
+ TableFooter,
7
+ TableHead,
8
+ TableHeader,
9
+ TableRow,
10
+ useScrollShadow
11
+ } from "./chunk-4MZZH3WX.js";
12
+ import "./chunk-P6GUNIAE.js";
13
+ import "./chunk-5WRI5ZAA.js";
14
+ export {
15
+ Table,
16
+ TableBody,
17
+ TableCaption,
18
+ TableCell,
19
+ TableFooter,
20
+ TableHead,
21
+ TableHeader,
22
+ TableRow,
23
+ useScrollShadow
24
+ };
25
+ //# sourceMappingURL=table.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -1,4 +1,4 @@
1
- import * as react from 'react';
1
+ import * as React from 'react';
2
2
  import { KeyboardEventHandler } from 'react';
3
3
 
4
4
  /** Props for the TextArea auto-resizing input component. */
@@ -23,6 +23,6 @@ interface TextAreaProps {
23
23
  className?: string;
24
24
  }
25
25
 
26
- declare const TextArea: react.ForwardRefExoticComponent<TextAreaProps & react.RefAttributes<HTMLTextAreaElement>>;
26
+ declare const TextArea: React.ForwardRefExoticComponent<TextAreaProps & React.RefAttributes<HTMLTextAreaElement>>;
27
27
 
28
28
  export { TextArea, type TextAreaProps };
@@ -1,4 +1,4 @@
1
- import * as react from 'react';
1
+ import * as React from 'react';
2
2
  import { KeyboardEventHandler } from 'react';
3
3
 
4
4
  /** Props for the TextArea auto-resizing input component. */
@@ -23,6 +23,6 @@ interface TextAreaProps {
23
23
  className?: string;
24
24
  }
25
25
 
26
- declare const TextArea: react.ForwardRefExoticComponent<TextAreaProps & react.RefAttributes<HTMLTextAreaElement>>;
26
+ declare const TextArea: React.ForwardRefExoticComponent<TextAreaProps & React.RefAttributes<HTMLTextAreaElement>>;
27
27
 
28
28
  export { TextArea, type TextAreaProps };
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Core types for clay's chart library.
3
+ *
4
+ * Two layers consume these:
5
+ *
6
+ * 1. The high-level chart components (`<BarChart>`, `<LineChart>`, `<PieChart>`) — single-call
7
+ * convenience renderers with sensible defaults.
8
+ * 2. The artifact-side `ChartConfig` (in `@/components/artifacts/types`) — wire-protocol shape
9
+ * that drives the artifact renderer. `artifacts/types` re-exports `ChartSeries` and
10
+ * `ChartVariant` from here so both layers share one canonical type.
11
+ */
12
+ /**
13
+ * A single series in a multi-series chart. Used by `<LineChart>` and `<BarChart>`.
14
+ */
15
+ interface ChartSeries {
16
+ /** Must match a property name on every row in the chart's `data`. The value at this property
17
+ * is plotted (coerced to number if necessary). */
18
+ key: string;
19
+ /** Human-readable name shown in legend + tooltip. Defaults to `key` if missing, but always
20
+ * pass a label for clarity. */
21
+ label: string;
22
+ }
23
+ /**
24
+ * Variant discriminator — used by code that selects a chart type at runtime (the artifact
25
+ * renderer, for example). Each variant maps to a dedicated high-level component.
26
+ */
27
+ type ChartVariant = "LINE" | "BAR" | "PIE";
28
+
29
+ export type { ChartSeries as C, ChartVariant as a };
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Core types for clay's chart library.
3
+ *
4
+ * Two layers consume these:
5
+ *
6
+ * 1. The high-level chart components (`<BarChart>`, `<LineChart>`, `<PieChart>`) — single-call
7
+ * convenience renderers with sensible defaults.
8
+ * 2. The artifact-side `ChartConfig` (in `@/components/artifacts/types`) — wire-protocol shape
9
+ * that drives the artifact renderer. `artifacts/types` re-exports `ChartSeries` and
10
+ * `ChartVariant` from here so both layers share one canonical type.
11
+ */
12
+ /**
13
+ * A single series in a multi-series chart. Used by `<LineChart>` and `<BarChart>`.
14
+ */
15
+ interface ChartSeries {
16
+ /** Must match a property name on every row in the chart's `data`. The value at this property
17
+ * is plotted (coerced to number if necessary). */
18
+ key: string;
19
+ /** Human-readable name shown in legend + tooltip. Defaults to `key` if missing, but always
20
+ * pass a label for clarity. */
21
+ label: string;
22
+ }
23
+ /**
24
+ * Variant discriminator — used by code that selects a chart type at runtime (the artifact
25
+ * renderer, for example). Each variant maps to a dedicated high-level component.
26
+ */
27
+ type ChartVariant = "LINE" | "BAR" | "PIE";
28
+
29
+ export type { ChartSeries as C, ChartVariant as a };