@shapesos/clay 0.5.1 → 0.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.
Files changed (60) hide show
  1. package/dist/button.cjs +604 -0
  2. package/dist/button.cjs.map +1 -0
  3. package/dist/button.d.cts +53 -0
  4. package/dist/button.d.ts +53 -0
  5. package/dist/button.js +17 -0
  6. package/dist/button.js.map +1 -0
  7. package/dist/chat.cjs +17 -15
  8. package/dist/chat.cjs.map +1 -1
  9. package/dist/chat.d.cts +14 -0
  10. package/dist/chat.d.ts +14 -0
  11. package/dist/chat.js +3 -3
  12. package/dist/chunk-FFABDVB3.js +149 -0
  13. package/dist/chunk-FFABDVB3.js.map +1 -0
  14. package/dist/{chunk-SYMZU32H.js → chunk-J6VPAHO3.js} +16 -16
  15. package/dist/chunk-J6VPAHO3.js.map +1 -0
  16. package/dist/{chunk-K2Q5MQWJ.js → chunk-KNYB3RL7.js} +1 -1
  17. package/dist/chunk-KNYB3RL7.js.map +1 -0
  18. package/dist/{chunk-WZHNMC6P.js → chunk-L6DUGB2E.js} +3 -1
  19. package/dist/chunk-L6DUGB2E.js.map +1 -0
  20. package/dist/{chunk-WQ2QTUYA.js → chunk-SV24ONND.js} +3 -1
  21. package/dist/chunk-SV24ONND.js.map +1 -0
  22. package/dist/{chunk-JC2RQL5O.js → chunk-TDMJUF4A.js} +3 -3
  23. package/dist/{chunk-SMTOVZ3O.js → chunk-WYGH3FKT.js} +1 -1
  24. package/dist/chunk-WYGH3FKT.js.map +1 -0
  25. package/dist/icon.cjs.map +1 -1
  26. package/dist/icon.d.cts +20 -1
  27. package/dist/icon.d.ts +20 -1
  28. package/dist/index.cjs +156 -13
  29. package/dist/index.cjs.map +1 -1
  30. package/dist/index.d.cts +2 -1
  31. package/dist/index.d.ts +2 -1
  32. package/dist/index.js +16 -6
  33. package/dist/keyboard-shortcut.cjs +2 -0
  34. package/dist/keyboard-shortcut.cjs.map +1 -1
  35. package/dist/keyboard-shortcut.d.cts +9 -0
  36. package/dist/keyboard-shortcut.d.ts +9 -0
  37. package/dist/keyboard-shortcut.js +1 -1
  38. package/dist/lottie.d.cts +26 -0
  39. package/dist/lottie.d.ts +26 -0
  40. package/dist/text-area.cjs +2 -0
  41. package/dist/text-area.cjs.map +1 -1
  42. package/dist/text-area.d.cts +10 -0
  43. package/dist/text-area.d.ts +10 -0
  44. package/dist/text-area.js +3 -3
  45. package/dist/tokens.cjs +2 -0
  46. package/dist/tokens.cjs.map +1 -1
  47. package/dist/tokens.d.cts +16 -0
  48. package/dist/tokens.d.ts +16 -0
  49. package/dist/tokens.js +1 -1
  50. package/dist/utils.cjs.map +1 -1
  51. package/dist/utils.d.cts +17 -0
  52. package/dist/utils.d.ts +17 -0
  53. package/dist/utils.js +2 -2
  54. package/package.json +8 -1
  55. package/dist/chunk-K2Q5MQWJ.js.map +0 -1
  56. package/dist/chunk-SMTOVZ3O.js.map +0 -1
  57. package/dist/chunk-SYMZU32H.js.map +0 -1
  58. package/dist/chunk-WQ2QTUYA.js.map +0 -1
  59. package/dist/chunk-WZHNMC6P.js.map +0 -1
  60. /package/dist/{chunk-JC2RQL5O.js.map → chunk-TDMJUF4A.js.map} +0 -0
package/dist/icon.d.ts CHANGED
@@ -1,31 +1,50 @@
1
1
  import * as react from 'react';
2
2
  import { ComponentType, SVGProps, ElementType } from 'react';
3
3
 
4
+ /** Props for the Icon wrapper component. */
4
5
  interface IconProps {
6
+ /** The SVG icon component to render (e.g., from @tabler/icons-react). */
5
7
  icon: ComponentType<SVGProps<SVGSVGElement>>;
8
+ /** Icon size in pixels. Affects both width/height and stroke width scaling. @default 20 */
6
9
  size?: number;
10
+ /** Override the icon's stroke/fill color. Defaults to `currentColor`. */
7
11
  color?: string;
12
+ /** Additional CSS class name for the wrapper element. */
8
13
  className?: string;
14
+ /** Accessible label for the icon. Required when the icon conveys meaning not present in surrounding text. */
9
15
  "aria-label"?: string;
10
16
  }
11
17
 
12
18
  declare const Icon: react.ForwardRefExoticComponent<IconProps & react.RefAttributes<HTMLSpanElement>>;
13
19
 
20
+ /** Available button sizes. "small" = 28px tap target, "medium" = 32px. */
14
21
  type IconButtonSize = "small" | "medium";
22
+ /** Button shape variant. "short" = square (default), "long" = pill / wider hit area. */
15
23
  type IconButtonVariant = "short" | "long";
24
+ /** Props for the IconButton ghost-style button component. */
16
25
  interface IconButtonProps {
26
+ /** The SVG icon component to render inside the button. */
17
27
  icon: ComponentType<SVGProps<SVGSVGElement>>;
28
+ /** Button tap-target size. @default "small" */
18
29
  size?: IconButtonSize;
30
+ /** Shape variant — "short" for square, "long" for pill. @default "short" */
19
31
  variant?: IconButtonVariant;
32
+ /** Whether the button is in a toggled/active state (e.g., "liked"). */
20
33
  isSelected?: boolean;
34
+ /** Whether the button is non-interactive. */
21
35
  disabled?: boolean;
36
+ /** Click handler. */
22
37
  onClick?: () => void;
38
+ /** Additional CSS class name. */
23
39
  className?: string;
40
+ /** HTML `id` attribute. */
24
41
  id?: string;
42
+ /** Polymorphic `as` prop — render as a different element (e.g., `"a"` or a custom component). */
25
43
  as?: ElementType;
44
+ /** Accessible label for the button action. */
26
45
  "aria-label"?: string;
27
46
  }
28
47
 
29
48
  declare function IconButton({ icon, size, variant, isSelected, disabled, onClick, className, id, as, "aria-label": ariaLabel, }: IconButtonProps): React.ReactNode;
30
49
 
31
- export { Icon, IconButton, type IconButtonProps, type IconButtonSize, type IconProps };
50
+ export { Icon, IconButton, type IconButtonProps, type IconButtonSize, type IconButtonVariant, type IconProps };
package/dist/index.cjs CHANGED
@@ -16342,8 +16342,12 @@ var require_lottie = __commonJS({
16342
16342
  // src/index.ts
16343
16343
  var src_exports = {};
16344
16344
  __export(src_exports, {
16345
+ BUTTON_SIZE: () => BUTTON_SIZE,
16346
+ BUTTON_VARIANT: () => BUTTON_VARIANT,
16347
+ Button: () => Button2,
16345
16348
  ChatContext: () => ChatContext,
16346
16349
  ChatMessage: () => ChatMessage,
16350
+ ICON_POSITION: () => ICON_POSITION,
16347
16351
  Icon: () => Icon,
16348
16352
  IconButton: () => IconButton,
16349
16353
  IconCtrl: () => IconCtrl,
@@ -16454,7 +16458,9 @@ var colors = {
16454
16458
 
16455
16459
  // src/tokens/typography.ts
16456
16460
  var fontFamilies = {
16461
+ /** Geist — primary UI font for body text, labels, headings, and display. */
16457
16462
  GEIST: "Geist",
16463
+ /** Crimson Pro — editorial/serif font, always italic. Used for decorative headings and pull quotes. */
16458
16464
  CRIMSON_PRO: "Crimson Pro"
16459
16465
  };
16460
16466
  var typographyTypes = {
@@ -16745,12 +16751,12 @@ function typographyMixin(type) {
16745
16751
  ].join(";\n ");
16746
16752
  }
16747
16753
 
16748
- // src/chat/chat-message-content/chat-message-content.tsx
16754
+ // src/components/chat/chat-message-content/chat-message-content.tsx
16749
16755
  var import_react_markdown = __toESM(require("react-markdown"), 1);
16750
16756
  var import_remark_breaks = __toESM(require("remark-breaks"), 1);
16751
16757
  var import_remark_gfm = __toESM(require("remark-gfm"), 1);
16752
16758
 
16753
- // src/chat/chat-message-content/chat-message-content-styles.ts
16759
+ // src/components/chat/chat-message-content/chat-message-content-styles.ts
16754
16760
  var import_styled_components = __toESM(require("styled-components"), 1);
16755
16761
  var ContentWrapper = import_styled_components.default.div`
16756
16762
  ${typographyMixin(typographyTypes.GEIST_BODY_S_REGULAR)};
@@ -16875,7 +16881,7 @@ var TableScroll = import_styled_components.default.div`
16875
16881
  margin-block: 8px 16px;
16876
16882
  `;
16877
16883
 
16878
- // src/chat/chat-message-content/chat-message-content.tsx
16884
+ // src/components/chat/chat-message-content/chat-message-content.tsx
16879
16885
  var import_jsx_runtime = require("react/jsx-runtime");
16880
16886
  function ScrollableTable({ node: _node, ...props }) {
16881
16887
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableScroll, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("table", { ...props }) });
@@ -16887,7 +16893,7 @@ function ChatMessageContent({ content: content2 }) {
16887
16893
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ContentWrapper, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_markdown.default, { remarkPlugins: [import_remark_gfm.default, import_remark_breaks.default], components: markdownComponents, children: content2 }) });
16888
16894
  }
16889
16895
 
16890
- // src/chat/chat-message-actions/chat-message-actions.tsx
16896
+ // src/components/chat/chat-message-actions/chat-message-actions.tsx
16891
16897
  var import_react5 = require("react");
16892
16898
 
16893
16899
  // node_modules/@tabler/icons-react/dist/esm/createReactComponent.mjs
@@ -17082,7 +17088,7 @@ function IconButton({
17082
17088
  );
17083
17089
  }
17084
17090
 
17085
- // src/chat/chat-context/chat-context.ts
17091
+ // src/components/chat/chat-context/chat-context.ts
17086
17092
  var import_react3 = require("react");
17087
17093
  var ChatContext = (0, import_react3.createContext)(null);
17088
17094
  function useChatContext() {
@@ -17093,7 +17099,7 @@ function useChatContext() {
17093
17099
  return context;
17094
17100
  }
17095
17101
 
17096
- // src/chat/hooks/use-copy-to-clipboard.ts
17102
+ // src/components/chat/hooks/use-copy-to-clipboard.ts
17097
17103
  var import_react4 = require("react");
17098
17104
 
17099
17105
  // src/utils/clipboard.ts
@@ -17119,7 +17125,7 @@ function markdownToPlainText(markdown) {
17119
17125
  return result;
17120
17126
  }
17121
17127
 
17122
- // src/chat/hooks/use-copy-to-clipboard.ts
17128
+ // src/components/chat/hooks/use-copy-to-clipboard.ts
17123
17129
  var RESET_DELAY_MS = 2e3;
17124
17130
  function useCopyToClipboard() {
17125
17131
  const [isCopied, setIsCopied] = (0, import_react4.useState)(false);
@@ -17144,13 +17150,13 @@ function useCopyToClipboard() {
17144
17150
  return { isCopied, copy };
17145
17151
  }
17146
17152
 
17147
- // src/chat/constants.ts
17153
+ // src/components/chat/constants.ts
17148
17154
  var MESSAGE_ROLE = {
17149
17155
  USER: "user",
17150
17156
  ASSISTANT: "assistant"
17151
17157
  };
17152
17158
 
17153
- // src/chat/chat-message-actions/chat-message-actions-styles.ts
17159
+ // src/components/chat/chat-message-actions/chat-message-actions-styles.ts
17154
17160
  var import_styled_components4 = __toESM(require("styled-components"), 1);
17155
17161
  var FADE_DURATION_MS = 150;
17156
17162
  var ANIMATE_DURATION_MS = 200;
@@ -17168,7 +17174,7 @@ var AnimatedAction = import_styled_components4.default.div`
17168
17174
  transition: max-width ${ANIMATE_DURATION_MS}ms ease, opacity ${ANIMATE_DURATION_MS}ms ease;
17169
17175
  `;
17170
17176
 
17171
- // src/chat/chat-message-actions/chat-message-actions.tsx
17177
+ // src/components/chat/chat-message-actions/chat-message-actions.tsx
17172
17178
  var import_jsx_runtime4 = require("react/jsx-runtime");
17173
17179
  function ChatMessageActions({ className, messageId, content: content2, role, isHelpful }) {
17174
17180
  const { onCopyMessage, onThumbUpClick, onThumbDownClick } = useChatContext();
@@ -17215,7 +17221,7 @@ function ChatMessageActions({ className, messageId, content: content2, role, isH
17215
17221
  ] });
17216
17222
  }
17217
17223
 
17218
- // src/chat/chat-message/chat-message-styles.ts
17224
+ // src/components/chat/chat-message/chat-message-styles.ts
17219
17225
  var import_styled_components5 = __toESM(require("styled-components"), 1);
17220
17226
  var MessageRow = import_styled_components5.default.div`
17221
17227
  display: flex;
@@ -17244,10 +17250,10 @@ var MessageBubble = import_styled_components5.default.div`
17244
17250
  min-width: 0;
17245
17251
  `;
17246
17252
 
17247
- // src/chat/chat-message/chat-message.tsx
17253
+ // src/components/chat/chat-message/chat-message.tsx
17248
17254
  var import_jsx_runtime5 = require("react/jsx-runtime");
17249
17255
  function ChatMessage({ message }) {
17250
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(MessageRow, { $role: message.role, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(MessageContainer, { $role: message.role, children: [
17256
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(MessageRow, { $role: message.role, role: "article", "aria-label": `${message.role} message`, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(MessageContainer, { $role: message.role, children: [
17251
17257
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(MessageBubble, { $role: message.role, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(ChatMessageContent, { content: message.content }) }),
17252
17258
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
17253
17259
  ChatMessageActions,
@@ -17266,7 +17272,9 @@ var import_styled_components6 = __toESM(require("styled-components"), 1);
17266
17272
 
17267
17273
  // src/components/keyboard-shortcut/types.ts
17268
17274
  var KEYBOARD_SHORTCUT_VARIANTS = {
17275
+ /** Outlined keys with a subtle border — use on dark backgrounds. */
17269
17276
  OUTLINED: "outlined",
17277
+ /** Filled keys with a solid background — use for emphasis or light backgrounds. */
17270
17278
  FILLED: "filled"
17271
17279
  };
17272
17280
 
@@ -17577,10 +17585,145 @@ var TextArea = (0, import_react8.forwardRef)(function TextArea2({ value: value2,
17577
17585
  }
17578
17586
  );
17579
17587
  });
17588
+
17589
+ // src/components/button/button.tsx
17590
+ var import_react9 = require("react");
17591
+
17592
+ // src/components/button/button-styles.ts
17593
+ var import_styled_components9 = __toESM(require("styled-components"), 1);
17594
+ var sizeStyles = {
17595
+ xs: import_styled_components9.css`
17596
+ padding: 6px 10px;
17597
+ border-radius: 8px;
17598
+ gap: 4px;
17599
+ `,
17600
+ s: import_styled_components9.css`
17601
+ padding: 8px 12px;
17602
+ border-radius: 10px;
17603
+ gap: 6px;
17604
+ `,
17605
+ m: import_styled_components9.css`
17606
+ padding: 10px 14px;
17607
+ border-radius: 10px;
17608
+ gap: 6px;
17609
+ `
17610
+ };
17611
+ var variantStyles2 = {
17612
+ solid: import_styled_components9.css`
17613
+ background: ${colors["brown-100"]};
17614
+ color: ${colors.white};
17615
+ border: none;
17616
+
17617
+ &:hover:not(:disabled) {
17618
+ background: ${colors["brown-90"]};
17619
+ }
17620
+
17621
+ &:disabled {
17622
+ background: ${colors["brown-20"]};
17623
+ color: ${colors["brown-50"]};
17624
+ }
17625
+ `,
17626
+ outline: import_styled_components9.css`
17627
+ background: ${colors.white};
17628
+ color: ${colors["brown-100"]};
17629
+ border: 1px solid ${colors["brown-40"]};
17630
+
17631
+ &:hover:not(:disabled) {
17632
+ background: ${colors["brown-20"]};
17633
+ }
17634
+
17635
+ &:disabled {
17636
+ border-color: ${colors["brown-20"]};
17637
+ color: ${colors["brown-50"]};
17638
+ }
17639
+ `,
17640
+ ghost: import_styled_components9.css`
17641
+ background: transparent;
17642
+ color: ${colors["brown-100"]};
17643
+ border: none;
17644
+
17645
+ &:hover:not(:disabled) {
17646
+ background: ${colors["brown-20"]};
17647
+ }
17648
+
17649
+ &:disabled {
17650
+ color: ${colors["brown-50"]};
17651
+ }
17652
+ `
17653
+ };
17654
+ var StyledButton = import_styled_components9.default.button`
17655
+ display: inline-flex;
17656
+ align-items: center;
17657
+ justify-content: center;
17658
+ cursor: pointer;
17659
+ ${typographyMixin(typographyTypes.GEIST_BODY_XS_MEDIUM)};
17660
+ transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease;
17661
+
17662
+ &:disabled {
17663
+ cursor: not-allowed;
17664
+ }
17665
+
17666
+ ${({ $size }) => sizeStyles[$size]}
17667
+ ${({ $variant }) => variantStyles2[$variant]}
17668
+ `;
17669
+
17670
+ // src/components/button/constants.ts
17671
+ var BUTTON_VARIANT = {
17672
+ SOLID: "solid",
17673
+ OUTLINE: "outline",
17674
+ GHOST: "ghost"
17675
+ };
17676
+ var BUTTON_SIZE = {
17677
+ XS: "xs",
17678
+ S: "s",
17679
+ M: "m"
17680
+ };
17681
+ var ICON_POSITION = {
17682
+ LEADING: "leading",
17683
+ TRAILING: "trailing"
17684
+ };
17685
+
17686
+ // src/components/button/button.tsx
17687
+ var import_jsx_runtime10 = require("react/jsx-runtime");
17688
+ var Button2 = (0, import_react9.forwardRef)(function Button3({
17689
+ children,
17690
+ variant = BUTTON_VARIANT.SOLID,
17691
+ size = BUTTON_SIZE.M,
17692
+ icon,
17693
+ iconPosition = ICON_POSITION.LEADING,
17694
+ disabled = false,
17695
+ onClick,
17696
+ className,
17697
+ "aria-label": ariaLabel
17698
+ }, ref) {
17699
+ const iconElement = icon ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Icon, { icon, size: 16 }) : null;
17700
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
17701
+ StyledButton,
17702
+ {
17703
+ ref,
17704
+ type: "button",
17705
+ $variant: variant,
17706
+ $size: size,
17707
+ disabled,
17708
+ onClick: disabled ? void 0 : onClick,
17709
+ className,
17710
+ "aria-label": ariaLabel,
17711
+ children: [
17712
+ iconPosition === ICON_POSITION.LEADING && iconElement,
17713
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { children }),
17714
+ iconPosition === ICON_POSITION.TRAILING && iconElement
17715
+ ]
17716
+ }
17717
+ );
17718
+ });
17580
17719
  // Annotate the CommonJS export names for ESM import in node:
17581
17720
  0 && (module.exports = {
17721
+ BUTTON_SIZE,
17722
+ BUTTON_VARIANT,
17723
+ Button,
17582
17724
  ChatContext,
17583
17725
  ChatMessage,
17726
+ ICON_POSITION,
17584
17727
  Icon,
17585
17728
  IconButton,
17586
17729
  IconCtrl,