@shapesos/clay 0.13.1 → 0.14.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.
- package/dist/ai-elements.cjs +877 -0
- package/dist/ai-elements.cjs.map +1 -0
- package/dist/ai-elements.d.cts +136 -0
- package/dist/ai-elements.d.ts +136 -0
- package/dist/ai-elements.js +31 -0
- package/dist/ai-elements.js.map +1 -0
- package/dist/artifacts.cjs +56 -11
- package/dist/artifacts.cjs.map +1 -1
- package/dist/artifacts.js +6 -6
- package/dist/blocks.cjs +83 -28
- package/dist/blocks.cjs.map +1 -1
- package/dist/blocks.css +1 -1
- package/dist/blocks.js +7 -7
- package/dist/button.cjs +27 -17
- package/dist/button.cjs.map +1 -1
- package/dist/button.js +3 -2
- package/dist/chart.js +3 -3
- package/dist/chat.cjs +83 -28
- package/dist/chat.cjs.map +1 -1
- package/dist/chat.js +8 -8
- package/dist/{chunk-YSSLTXZG.js → chunk-3THOTQO3.js} +7 -7
- package/dist/{chunk-WPQQVKWY.js → chunk-7OYIDM42.js} +2 -2
- package/dist/{chunk-EDICS62G.js → chunk-B4U37WIH.js} +9 -11
- package/dist/chunk-B4U37WIH.js.map +1 -0
- package/dist/chunk-BR5S37SC.js +171 -0
- package/dist/chunk-BR5S37SC.js.map +1 -0
- package/dist/chunk-CYC2YUKU.js +1 -0
- package/dist/chunk-CYC2YUKU.js.map +1 -0
- package/dist/chunk-L75JPWGS.js +1 -0
- package/dist/chunk-L75JPWGS.js.map +1 -0
- package/dist/{chunk-QAK7NM5F.js → chunk-MDAWYZBI.js} +3 -3
- package/dist/{chunk-L6DUGB2E.js → chunk-PGR2MDDU.js} +16 -5
- package/dist/chunk-PGR2MDDU.js.map +1 -0
- package/dist/{chunk-OBOXCBDL.js → chunk-PYDVANWI.js} +58 -13
- package/dist/chunk-PYDVANWI.js.map +1 -0
- package/dist/{chunk-SV24ONND.js → chunk-UXT2H3FM.js} +28 -18
- package/dist/chunk-UXT2H3FM.js.map +1 -0
- package/dist/{chunk-DT44KNCV.js → chunk-XFJ6XMJZ.js} +5 -5
- package/dist/{chunk-QXGYMDIA.js → chunk-YZB6YXKK.js} +4 -4
- package/dist/icon.cjs +56 -11
- package/dist/icon.cjs.map +1 -1
- package/dist/icon.d.cts +11 -2
- package/dist/icon.d.ts +11 -2
- package/dist/icon.js +1 -1
- package/dist/index.cjs +652 -421
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -2
- package/dist/index.d.ts +4 -2
- package/dist/index.js +50 -28
- package/dist/keyboard-shortcut.cjs +15 -4
- package/dist/keyboard-shortcut.cjs.map +1 -1
- package/dist/keyboard-shortcut.d.cts +10 -3
- package/dist/keyboard-shortcut.d.ts +10 -3
- package/dist/keyboard-shortcut.js +1 -1
- package/dist/text-area.cjs +27 -17
- package/dist/text-area.cjs.map +1 -1
- package/dist/text-area.d.cts +2 -24
- package/dist/text-area.d.ts +2 -24
- package/dist/text-area.js +3 -2
- package/dist/tokens.cjs +27 -17
- package/dist/tokens.cjs.map +1 -1
- package/dist/tokens.d.cts +6 -5
- package/dist/tokens.d.ts +6 -5
- package/dist/tokens.js +1 -1
- package/dist/types-CMzZsL_J.d.cts +25 -0
- package/dist/types-CMzZsL_J.d.ts +25 -0
- package/dist/utils.js +3 -3
- package/package.json +6 -1
- package/dist/chunk-EDICS62G.js.map +0 -1
- package/dist/chunk-L6DUGB2E.js.map +0 -1
- package/dist/chunk-OBOXCBDL.js.map +0 -1
- package/dist/chunk-SV24ONND.js.map +0 -1
- /package/dist/{chunk-YSSLTXZG.js.map → chunk-3THOTQO3.js.map} +0 -0
- /package/dist/{chunk-WPQQVKWY.js.map → chunk-7OYIDM42.js.map} +0 -0
- /package/dist/{chunk-QAK7NM5F.js.map → chunk-MDAWYZBI.js.map} +0 -0
- /package/dist/{chunk-DT44KNCV.js.map → chunk-XFJ6XMJZ.js.map} +0 -0
- /package/dist/{chunk-QXGYMDIA.js.map → chunk-YZB6YXKK.js.map} +0 -0
package/dist/chat.js
CHANGED
|
@@ -5,19 +5,19 @@ import {
|
|
|
5
5
|
copyMessageText,
|
|
6
6
|
useChatContext,
|
|
7
7
|
useCopyToClipboard
|
|
8
|
-
} from "./chunk-
|
|
9
|
-
import "./chunk-
|
|
8
|
+
} from "./chunk-3THOTQO3.js";
|
|
9
|
+
import "./chunk-MDAWYZBI.js";
|
|
10
10
|
import "./chunk-NMKKU2UG.js";
|
|
11
|
-
import "./chunk-
|
|
11
|
+
import "./chunk-XFJ6XMJZ.js";
|
|
12
|
+
import "./chunk-PYDVANWI.js";
|
|
12
13
|
import "./chunk-LXYCT4YO.js";
|
|
13
|
-
import "./chunk-
|
|
14
|
+
import "./chunk-OLJIJYB5.js";
|
|
15
|
+
import "./chunk-YZB6YXKK.js";
|
|
14
16
|
import "./chunk-C77QMQNT.js";
|
|
15
|
-
import "./chunk-
|
|
17
|
+
import "./chunk-UXT2H3FM.js";
|
|
18
|
+
import "./chunk-JF3P66JF.js";
|
|
16
19
|
import "./chunk-4MZZH3WX.js";
|
|
17
20
|
import "./chunk-P6GUNIAE.js";
|
|
18
|
-
import "./chunk-OBOXCBDL.js";
|
|
19
|
-
import "./chunk-OLJIJYB5.js";
|
|
20
|
-
import "./chunk-JF3P66JF.js";
|
|
21
21
|
import "./chunk-5WRI5ZAA.js";
|
|
22
22
|
export {
|
|
23
23
|
ChatContext,
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Block,
|
|
3
3
|
BlockServices
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-MDAWYZBI.js";
|
|
5
5
|
import {
|
|
6
6
|
IconCheck,
|
|
7
7
|
IconCopy,
|
|
8
8
|
IconThumbDown,
|
|
9
9
|
IconThumbUp
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-XFJ6XMJZ.js";
|
|
11
|
+
import {
|
|
12
|
+
IconButton
|
|
13
|
+
} from "./chunk-PYDVANWI.js";
|
|
11
14
|
import {
|
|
12
15
|
typographyMixin,
|
|
13
16
|
typographyTypes
|
|
14
|
-
} from "./chunk-
|
|
15
|
-
import {
|
|
16
|
-
IconButton
|
|
17
|
-
} from "./chunk-OBOXCBDL.js";
|
|
17
|
+
} from "./chunk-UXT2H3FM.js";
|
|
18
18
|
import {
|
|
19
19
|
colors
|
|
20
20
|
} from "./chunk-JF3P66JF.js";
|
|
@@ -220,4 +220,4 @@ export {
|
|
|
220
220
|
MESSAGE_ROLE,
|
|
221
221
|
ChatMessage
|
|
222
222
|
};
|
|
223
|
-
//# sourceMappingURL=chunk-
|
|
223
|
+
//# sourceMappingURL=chunk-3THOTQO3.js.map
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
import {
|
|
5
5
|
typographyMixin,
|
|
6
6
|
typographyTypes
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-UXT2H3FM.js";
|
|
8
8
|
import {
|
|
9
9
|
colors
|
|
10
10
|
} from "./chunk-JF3P66JF.js";
|
|
@@ -73,4 +73,4 @@ var TextArea = forwardRef(function TextArea2({ value, onChange, placeholder, max
|
|
|
73
73
|
export {
|
|
74
74
|
TextArea
|
|
75
75
|
};
|
|
76
|
-
//# sourceMappingURL=chunk-
|
|
76
|
+
//# sourceMappingURL=chunk-7OYIDM42.js.map
|
|
@@ -1,20 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
typographyMixin,
|
|
3
|
-
typographyTypes
|
|
4
|
-
} from "./chunk-SV24ONND.js";
|
|
5
1
|
import {
|
|
6
2
|
Icon
|
|
7
3
|
} from "./chunk-OLJIJYB5.js";
|
|
4
|
+
import {
|
|
5
|
+
typographyMixin,
|
|
6
|
+
typographyTypes
|
|
7
|
+
} from "./chunk-UXT2H3FM.js";
|
|
8
8
|
import {
|
|
9
9
|
colors
|
|
10
10
|
} from "./chunk-JF3P66JF.js";
|
|
11
11
|
|
|
12
|
-
// src/components/button/button.tsx
|
|
13
|
-
import { forwardRef } from "react";
|
|
14
|
-
|
|
15
|
-
// src/components/button/button-styles.ts
|
|
16
|
-
import styled, { css } from "styled-components";
|
|
17
|
-
|
|
18
12
|
// src/components/button/constants.ts
|
|
19
13
|
var BUTTON_VARIANT = {
|
|
20
14
|
SOLID: "solid",
|
|
@@ -35,7 +29,11 @@ var ICON_POSITION = {
|
|
|
35
29
|
TRAILING: "trailing"
|
|
36
30
|
};
|
|
37
31
|
|
|
32
|
+
// src/components/button/button.tsx
|
|
33
|
+
import { forwardRef } from "react";
|
|
34
|
+
|
|
38
35
|
// src/components/button/button-styles.ts
|
|
36
|
+
import styled, { css } from "styled-components";
|
|
39
37
|
var intentColors = {
|
|
40
38
|
[BUTTON_INTENT.PRIMARY]: {
|
|
41
39
|
base: colors["brown-100"],
|
|
@@ -174,4 +172,4 @@ export {
|
|
|
174
172
|
ICON_POSITION,
|
|
175
173
|
Button
|
|
176
174
|
};
|
|
177
|
-
//# sourceMappingURL=chunk-
|
|
175
|
+
//# sourceMappingURL=chunk-B4U37WIH.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/button/constants.ts","../src/components/button/button.tsx","../src/components/button/button-styles.ts"],"sourcesContent":["/** Available visual style variants for the Button component. */\nexport const BUTTON_VARIANT = {\n SOLID: \"solid\",\n OUTLINE: \"outline\",\n GHOST: \"ghost\",\n} as const;\n\n/** Available size presets for the Button component. */\nexport const BUTTON_SIZE = {\n XS: \"xs\",\n S: \"s\",\n M: \"m\",\n} as const;\n\n/** Available semantic intents for the Button component. */\nexport const BUTTON_INTENT = {\n PRIMARY: \"primary\",\n ERROR: \"error\",\n} as const;\n\n/** Available icon positions relative to the label text. */\nexport const ICON_POSITION = {\n LEADING: \"leading\",\n TRAILING: \"trailing\",\n} as const;\n","import { forwardRef } from \"react\";\nimport { Icon } from \"../icon/icon\";\nimport { StyledButton } from \"./button-styles\";\nimport { BUTTON_INTENT, BUTTON_SIZE, BUTTON_VARIANT, ICON_POSITION } from \"./constants\";\nimport type { ButtonProps } from \"./types\";\n\n/** A versatile button component with multiple variants and sizes. */\nexport const Button = forwardRef<HTMLButtonElement, ButtonProps>(function Button(\n {\n children,\n variant = BUTTON_VARIANT.SOLID,\n intent = BUTTON_INTENT.PRIMARY,\n size = BUTTON_SIZE.M,\n icon,\n iconPosition = ICON_POSITION.LEADING,\n disabled = false,\n onClick,\n className,\n \"aria-label\": ariaLabel,\n },\n ref\n) {\n const iconElement = icon ? <Icon icon={icon} size={16} /> : null;\n\n return (\n <StyledButton\n ref={ref}\n type=\"button\"\n $variant={variant}\n $intent={intent}\n $size={size}\n disabled={disabled}\n onClick={disabled ? undefined : onClick}\n className={className}\n aria-label={ariaLabel}\n >\n {iconPosition === ICON_POSITION.LEADING && iconElement}\n <span>{children}</span>\n {iconPosition === ICON_POSITION.TRAILING && iconElement}\n </StyledButton>\n );\n});\n","import styled, { css } from \"styled-components\";\nimport { colors } from \"../../tokens/colors\";\nimport { typographyMixin, typographyTypes } from \"../../tokens/typography\";\nimport { BUTTON_INTENT, BUTTON_SIZE, BUTTON_VARIANT } from \"./constants\";\nimport type { ButtonIntent, ButtonSize, ButtonVariant } from \"./types\";\n\ninterface IntentColors {\n /** Primary fill / text color. */\n base: string;\n /** Hover fill for solid variant. */\n hover: string;\n /** Muted fill for disabled solid variant. */\n disabledBg: string;\n /** Muted text for disabled state. */\n disabledText: string;\n /** Subtle hover background for outline/ghost variants. */\n subtleHover: string;\n /** Border color for outline variant. */\n border: string;\n /** Muted border for disabled outline variant. */\n disabledBorder: string;\n}\n\nconst intentColors: Record<ButtonIntent, IntentColors> = {\n [BUTTON_INTENT.PRIMARY]: {\n base: colors[\"brown-100\"],\n hover: colors[\"brown-90\"],\n disabledBg: colors[\"brown-20\"],\n disabledText: colors[\"brown-50\"],\n subtleHover: colors[\"brown-20\"],\n border: colors[\"brown-40\"],\n disabledBorder: colors[\"brown-20\"],\n },\n [BUTTON_INTENT.ERROR]: {\n base: colors[\"red-500\"],\n hover: colors[\"red-600\"],\n disabledBg: colors[\"red-100\"],\n disabledText: colors[\"red-200\"],\n subtleHover: colors[\"red-50\"],\n border: colors[\"red-200\"],\n disabledBorder: colors[\"red-100\"],\n },\n};\n\ninterface SizeValues {\n padding: string;\n borderRadius: string;\n gap: string;\n}\n\nconst sizeValues: Record<ButtonSize, SizeValues> = {\n [BUTTON_SIZE.XS]: { padding: \"6px 10px\", borderRadius: \"8px\", gap: \"4px\" },\n [BUTTON_SIZE.S]: { padding: \"8px 12px\", borderRadius: \"10px\", gap: \"6px\" },\n [BUTTON_SIZE.M]: { padding: \"10px 14px\", borderRadius: \"10px\", gap: \"6px\" },\n};\n\nfunction sizeMixin({ $size }: { $size: ButtonSize }): ReturnType<typeof css> {\n const s = sizeValues[$size];\n return css`\n padding: ${s.padding};\n border-radius: ${s.borderRadius};\n gap: ${s.gap};\n `;\n}\n\ninterface VariantColorMap {\n background: string;\n color: string;\n border: string;\n hoverBg: string;\n disabledBg?: string;\n disabledColor: string;\n disabledBorder?: string;\n}\n\nconst variantColorMap: Record<ButtonVariant, (c: IntentColors) => VariantColorMap> = {\n [BUTTON_VARIANT.SOLID]: (c) => ({\n background: c.base,\n color: colors.white,\n border: \"none\",\n hoverBg: c.hover,\n disabledBg: c.disabledBg,\n disabledColor: c.disabledText,\n }),\n [BUTTON_VARIANT.OUTLINE]: (c) => ({\n background: colors.white,\n color: c.base,\n border: `1px solid ${c.border}`,\n hoverBg: c.subtleHover,\n disabledColor: c.disabledText,\n disabledBorder: c.disabledBorder,\n }),\n [BUTTON_VARIANT.GHOST]: (c) => ({\n background: \"transparent\",\n color: c.base,\n border: \"none\",\n hoverBg: c.subtleHover,\n disabledColor: c.disabledText,\n }),\n};\n\nfunction variantMixin({\n $variant,\n $intent,\n}: {\n $variant: ButtonVariant;\n $intent: ButtonIntent;\n}): ReturnType<typeof css> {\n const v = variantColorMap[$variant](intentColors[$intent]);\n\n return css`\n background: ${v.background};\n color: ${v.color};\n border: ${v.border};\n\n &:hover:not(:disabled) {\n background: ${v.hoverBg};\n }\n\n &:disabled {\n color: ${v.disabledColor};\n ${v.disabledBg ? `background: ${v.disabledBg};` : \"\"}\n ${v.disabledBorder ? `border-color: ${v.disabledBorder};` : \"\"}\n }\n `;\n}\n\n/** Styled button element with variant, intent, and size transient props. */\nexport const StyledButton = styled.button<{\n $variant: ButtonVariant;\n $intent: ButtonIntent;\n $size: ButtonSize;\n}>`\n display: inline-flex;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n ${typographyMixin(typographyTypes.GEIST_BODY_XS_MEDIUM)};\n transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease;\n\n &:disabled {\n cursor: not-allowed;\n }\n\n ${sizeMixin}\n ${variantMixin}\n`;\n"],"mappings":";;;;;;;;;;;;AACO,IAAM,iBAAiB;AAAA,EAC5B,OAAO;AAAA,EACP,SAAS;AAAA,EACT,OAAO;AACT;AAGO,IAAM,cAAc;AAAA,EACzB,IAAI;AAAA,EACJ,GAAG;AAAA,EACH,GAAG;AACL;AAGO,IAAM,gBAAgB;AAAA,EAC3B,SAAS;AAAA,EACT,OAAO;AACT;AAGO,IAAM,gBAAgB;AAAA,EAC3B,SAAS;AAAA,EACT,UAAU;AACZ;;;ACxBA,SAAS,kBAAkB;;;ACA3B,OAAO,UAAU,WAAW;AAuB5B,IAAM,eAAmD;AAAA,EACvD,CAAC,cAAc,OAAO,GAAG;AAAA,IACvB,MAAM,OAAO,WAAW;AAAA,IACxB,OAAO,OAAO,UAAU;AAAA,IACxB,YAAY,OAAO,UAAU;AAAA,IAC7B,cAAc,OAAO,UAAU;AAAA,IAC/B,aAAa,OAAO,UAAU;AAAA,IAC9B,QAAQ,OAAO,UAAU;AAAA,IACzB,gBAAgB,OAAO,UAAU;AAAA,EACnC;AAAA,EACA,CAAC,cAAc,KAAK,GAAG;AAAA,IACrB,MAAM,OAAO,SAAS;AAAA,IACtB,OAAO,OAAO,SAAS;AAAA,IACvB,YAAY,OAAO,SAAS;AAAA,IAC5B,cAAc,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IDM42.js";
|
|
4
|
+
import {
|
|
5
|
+
BUTTON_INTENT,
|
|
6
|
+
BUTTON_SIZE,
|
|
7
|
+
Button
|
|
8
|
+
} from "./chunk-B4U37WIH.js";
|
|
9
|
+
import {
|
|
10
|
+
cn
|
|
11
|
+
} from "./chunk-P6GUNIAE.js";
|
|
12
|
+
|
|
13
|
+
// src/components/ai-elements/prompt-input/prompt-input.tsx
|
|
14
|
+
import { forwardRef, useCallback } from "react";
|
|
15
|
+
|
|
16
|
+
// src/components/ai-elements/prompt-input/types.ts
|
|
17
|
+
var CHAT_STATUS = {
|
|
18
|
+
/** Idle / ready to submit. */
|
|
19
|
+
READY: "ready",
|
|
20
|
+
/** The last submission errored — the button shows a retry affordance. */
|
|
21
|
+
ERROR: "error"
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
// src/components/ai-elements/prompt-input/prompt-input.tsx
|
|
25
|
+
import { jsx } from "react/jsx-runtime";
|
|
26
|
+
var PromptInput = ({ className, onSubmit, disabled, children, ...props }) => {
|
|
27
|
+
const handleSubmit = useCallback(
|
|
28
|
+
(event) => {
|
|
29
|
+
event.preventDefault();
|
|
30
|
+
if (disabled) {
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
const textarea = event.currentTarget.querySelector("textarea");
|
|
34
|
+
const text = textarea?.value ?? "";
|
|
35
|
+
if (!text.trim()) {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
onSubmit({ text }, event);
|
|
39
|
+
},
|
|
40
|
+
[disabled, onSubmit]
|
|
41
|
+
);
|
|
42
|
+
return /* @__PURE__ */ jsx(
|
|
43
|
+
"form",
|
|
44
|
+
{
|
|
45
|
+
className: cn(
|
|
46
|
+
"flex w-full flex-col overflow-hidden rounded-xl border bg-background shadow-lg shadow-foreground/5",
|
|
47
|
+
className
|
|
48
|
+
),
|
|
49
|
+
onSubmit: handleSubmit,
|
|
50
|
+
...props,
|
|
51
|
+
children
|
|
52
|
+
}
|
|
53
|
+
);
|
|
54
|
+
};
|
|
55
|
+
var PromptInputTextarea = forwardRef(
|
|
56
|
+
function PromptInputTextarea2({ className, onKeyDown, placeholder = "What would you like to know?", ...props }, ref) {
|
|
57
|
+
const handleKeyDown = useCallback(
|
|
58
|
+
(event) => {
|
|
59
|
+
onKeyDown?.(event);
|
|
60
|
+
if (event.defaultPrevented) {
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
if (event.key === "Enter" && !event.shiftKey && !event.nativeEvent.isComposing) {
|
|
64
|
+
event.preventDefault();
|
|
65
|
+
event.currentTarget.form?.requestSubmit();
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
[onKeyDown]
|
|
69
|
+
);
|
|
70
|
+
return /* @__PURE__ */ jsx("div", { className: cn("py-3", className), children: /* @__PURE__ */ jsx(TextArea, { ref, className: "px-4", onKeyDown: handleKeyDown, placeholder, ...props }) });
|
|
71
|
+
}
|
|
72
|
+
);
|
|
73
|
+
var PromptInputFooter = ({ className, ...props }) => /* @__PURE__ */ jsx("div", { className: cn("flex items-center justify-between gap-1 px-4 pb-3", className), ...props });
|
|
74
|
+
var PromptInputTools = ({ className, ...props }) => /* @__PURE__ */ jsx("div", { className: cn("flex min-w-0 items-center gap-1", className), ...props });
|
|
75
|
+
var PromptInputSubmit = ({
|
|
76
|
+
label = "Submit",
|
|
77
|
+
status = CHAT_STATUS.READY,
|
|
78
|
+
disabled,
|
|
79
|
+
className
|
|
80
|
+
}) => {
|
|
81
|
+
const handleClick = useCallback((event) => {
|
|
82
|
+
event.currentTarget.form?.requestSubmit();
|
|
83
|
+
}, []);
|
|
84
|
+
return /* @__PURE__ */ jsx(
|
|
85
|
+
Button,
|
|
86
|
+
{
|
|
87
|
+
intent: status === CHAT_STATUS.ERROR ? BUTTON_INTENT.ERROR : BUTTON_INTENT.PRIMARY,
|
|
88
|
+
size: BUTTON_SIZE.XS,
|
|
89
|
+
className,
|
|
90
|
+
disabled,
|
|
91
|
+
onClick: handleClick,
|
|
92
|
+
children: label
|
|
93
|
+
}
|
|
94
|
+
);
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
// src/components/ai-elements/mouse-grid/mouse-grid.tsx
|
|
98
|
+
import { useEffect, useRef } from "react";
|
|
99
|
+
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
100
|
+
function MouseGrid({ glowColor } = {}) {
|
|
101
|
+
const layerRef = useRef(null);
|
|
102
|
+
useEffect(() => {
|
|
103
|
+
let raf = 0;
|
|
104
|
+
let clientX = 0;
|
|
105
|
+
let clientY = 0;
|
|
106
|
+
function flush() {
|
|
107
|
+
raf = 0;
|
|
108
|
+
const layer = layerRef.current;
|
|
109
|
+
if (!layer) {
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
const rect = layer.getBoundingClientRect();
|
|
113
|
+
layer.style.setProperty("--vibe-mx", `${clientX - rect.left}px`);
|
|
114
|
+
layer.style.setProperty("--vibe-my", `${clientY - rect.top}px`);
|
|
115
|
+
}
|
|
116
|
+
function onMove(event) {
|
|
117
|
+
clientX = event.clientX;
|
|
118
|
+
clientY = event.clientY;
|
|
119
|
+
if (raf) {
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
raf = requestAnimationFrame(flush);
|
|
123
|
+
}
|
|
124
|
+
window.addEventListener("mousemove", onMove, { passive: true });
|
|
125
|
+
return () => {
|
|
126
|
+
window.removeEventListener("mousemove", onMove);
|
|
127
|
+
if (raf) {
|
|
128
|
+
cancelAnimationFrame(raf);
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
}, []);
|
|
132
|
+
const glowStyle = glowColor ? { "--vibe-glow-color": glowColor } : void 0;
|
|
133
|
+
return /* @__PURE__ */ jsxs("div", { ref: layerRef, "aria-hidden": "true", className: "vibe-mouse-grid-layer", children: [
|
|
134
|
+
/* @__PURE__ */ jsx2("div", { className: "vibe-mouse-grid" }),
|
|
135
|
+
/* @__PURE__ */ jsx2("div", { className: "vibe-mouse-glow", style: glowStyle })
|
|
136
|
+
] });
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
// src/components/ai-elements/suggestion/suggestion.tsx
|
|
140
|
+
import { useCallback as useCallback2 } from "react";
|
|
141
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
142
|
+
var Suggestions = ({ className, ...props }) => /* @__PURE__ */ jsx3("div", { className: cn("flex flex-wrap items-center justify-center gap-3", className), ...props });
|
|
143
|
+
var Suggestion = ({ suggestion, onClick, className, children, ...props }) => {
|
|
144
|
+
const handleClick = useCallback2(() => onClick?.(suggestion), [onClick, suggestion]);
|
|
145
|
+
return /* @__PURE__ */ jsx3(
|
|
146
|
+
"button",
|
|
147
|
+
{
|
|
148
|
+
type: "button",
|
|
149
|
+
onClick: handleClick,
|
|
150
|
+
className: cn(
|
|
151
|
+
"cursor-pointer whitespace-nowrap rounded-full border border-brown-30 bg-white px-4 py-2 text-sm text-brown-100 transition-colors hover:bg-brown-10 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brown-40",
|
|
152
|
+
className
|
|
153
|
+
),
|
|
154
|
+
...props,
|
|
155
|
+
children: children ?? suggestion
|
|
156
|
+
}
|
|
157
|
+
);
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
export {
|
|
161
|
+
CHAT_STATUS,
|
|
162
|
+
PromptInput,
|
|
163
|
+
PromptInputTextarea,
|
|
164
|
+
PromptInputFooter,
|
|
165
|
+
PromptInputTools,
|
|
166
|
+
PromptInputSubmit,
|
|
167
|
+
MouseGrid,
|
|
168
|
+
Suggestions,
|
|
169
|
+
Suggestion
|
|
170
|
+
};
|
|
171
|
+
//# sourceMappingURL=chunk-BR5S37SC.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/ai-elements/prompt-input/prompt-input.tsx","../src/components/ai-elements/prompt-input/types.ts","../src/components/ai-elements/mouse-grid/mouse-grid.tsx","../src/components/ai-elements/suggestion/suggestion.tsx"],"sourcesContent":["import { forwardRef, useCallback } from \"react\";\nimport type { FormEventHandler, KeyboardEventHandler, MouseEventHandler } from \"react\";\n\nimport { cn } from \"@/lib/utils\";\nimport { Button } from \"@/components/button/button\";\nimport { BUTTON_INTENT, BUTTON_SIZE } from \"@/components/button/constants\";\nimport { TextArea } from \"@/components/text-area/text-area\";\nimport { CHAT_STATUS } from \"./types\";\nimport type {\n PromptInputFooterProps,\n PromptInputProps,\n PromptInputSubmitProps,\n PromptInputTextareaProps,\n PromptInputToolsProps,\n} from \"./types\";\n\n/* ------------------------------------------------------------------------------------------------\n * Originally vendored from `@vercel/ai-elements`'s `prompt-input` registry entry. Slimmed hard to\n * the creation-surface essentials a consumer composes into a prompt-launcher hero: `PromptInput`\n * (form wrapper), `PromptInputTextarea`, `PromptInputFooter`, `PromptInputTools`, `PromptInputSubmit`.\n *\n * Everything else from the upstream entry is intentionally dropped: the action menu\n * (`PromptInputActionMenu*`), attachment / screenshot actions, the attachments strip, the\n * provider/controller contexts, and the `Select` / `HoverCard` / `Command` / `Tab` families. That\n * also sheds the upstream `nanoid` (id-per-attachment) dependency.\n *\n * Rewiring to clay's single-sourced primitives let this primitive ship with ZERO new runtime\n * dependencies — diverging from the original shared spec, which assumed the kept set would still\n * lean on `@base-ui/react`, `ai`, and `lucide-react`:\n * - upstream `InputGroupButton` (submit) → clay `Button` (filled, `type=\"button\"`, consumer label).\n * - upstream `InputGroupTextarea` → clay `TextArea` (auto-resize, transparent chrome).\n * - `lucide-react` icons → clay's already-bundled `@tabler/icons-react`.\n * - `ai`'s `ChatStatus` → a local ready/error status (see `./types`).\n *\n * Because clay's `Button` always renders `type=\"button\"`, native form submit isn't available;\n * both the Enter-key handler and the submit button trigger `form.requestSubmit()` explicitly. And\n * because clay's `TextArea` doesn't forward a `name` attribute, `PromptInput` reads the textarea's\n * value straight off the DOM at submit time rather than via `FormData` — keeping the form wrapper\n * decoupled from whoever controls the textarea's value.\n *\n * Types live in `./types`.\n * ------------------------------------------------------------------------------------------------ */\n\n/**\n * Form wrapper for a prompt composer. Renders a bordered, rounded surface; stacks its children\n * (textarea + footer) vertically. Reads the nested textarea's value on submit and forwards it to\n * `onSubmit`. Empty / whitespace-only submissions, and all submissions while `disabled`, are\n * ignored.\n */\nexport const PromptInput = ({ className, onSubmit, disabled, children, ...props }: PromptInputProps) => {\n const handleSubmit: FormEventHandler<HTMLFormElement> = useCallback(\n (event) => {\n event.preventDefault();\n if (disabled) {\n return;\n }\n const textarea = event.currentTarget.querySelector(\"textarea\");\n const text = textarea?.value ?? \"\";\n if (!text.trim()) {\n return;\n }\n onSubmit({ text }, event);\n },\n [disabled, onSubmit]\n );\n\n return (\n <form\n className={cn(\n \"flex w-full flex-col overflow-hidden rounded-xl border bg-background shadow-lg shadow-foreground/5\",\n className\n )}\n onSubmit={handleSubmit}\n {...props}\n >\n {children}\n </form>\n );\n};\n\n/**\n * Auto-resizing textarea for the prompt composer. Wraps clay's `TextArea` and adds Enter-to-submit\n * (Shift+Enter inserts a newline; submission is suppressed while an IME composition is active). The\n * consumer's `onKeyDown` runs first and can `preventDefault()` to opt out of the built-in Enter\n * handling.\n *\n * Horizontal padding lives on the textarea itself (not the wrapper) so its overflow scrollbar sits\n * flush against the wrapper's right edge; the wrapper only owns the vertical padding.\n */\nexport const PromptInputTextarea = forwardRef<HTMLTextAreaElement, PromptInputTextareaProps>(\n function PromptInputTextarea({ className, onKeyDown, placeholder = \"What would you like to know?\", ...props }, ref) {\n const handleKeyDown: KeyboardEventHandler<HTMLTextAreaElement> = useCallback(\n (event) => {\n onKeyDown?.(event);\n if (event.defaultPrevented) {\n return;\n }\n if (event.key === \"Enter\" && !event.shiftKey && !event.nativeEvent.isComposing) {\n event.preventDefault();\n event.currentTarget.form?.requestSubmit();\n }\n },\n [onKeyDown]\n );\n\n return (\n <div className={cn(\"py-3\", className)}>\n <TextArea ref={ref} className=\"px-4\" onKeyDown={handleKeyDown} placeholder={placeholder} {...props} />\n </div>\n );\n }\n);\n\n/**\n * Footer row beneath the textarea — left tools and the right-aligned submit button. Horizontal\n * padding matches {@link PromptInputTextarea}'s (`px-4`) so the tools/submit align with the\n * textarea's text edges.\n */\nexport const PromptInputFooter = ({ className, ...props }: PromptInputFooterProps) => (\n <div className={cn(\"flex items-center justify-between gap-1 px-4 pb-3\", className)} {...props} />\n);\n\n/** Left-aligned cluster inside {@link PromptInputFooter} (e.g. the submit hint). */\nexport const PromptInputTools = ({ className, ...props }: PromptInputToolsProps) => (\n <div className={cn(\"flex min-w-0 items-center gap-1\", className)} {...props} />\n);\n\n/**\n * Submit button for the prompt composer — a filled clay `Button` whose text is the consumer's\n * `label` (pass a localized string for i18n). Always submits the form via `form.requestSubmit()` on\n * click (clay buttons render `type=\"button\"`); the consumer disables it while a generation is in\n * flight. `status` drives the color: `error` renders the error (red) intent, otherwise primary.\n */\nexport const PromptInputSubmit = ({\n label = \"Submit\",\n status = CHAT_STATUS.READY,\n disabled,\n className,\n}: PromptInputSubmitProps) => {\n const handleClick = useCallback<MouseEventHandler<HTMLButtonElement>>((event) => {\n event.currentTarget.form?.requestSubmit();\n }, []);\n\n return (\n <Button\n intent={status === CHAT_STATUS.ERROR ? BUTTON_INTENT.ERROR : BUTTON_INTENT.PRIMARY}\n size={BUTTON_SIZE.XS}\n className={className}\n disabled={disabled}\n onClick={handleClick}\n >\n {label}\n </Button>\n );\n};\n","import type { FormEvent, HTMLAttributes } from \"react\";\n\nimport type { TextAreaProps } from \"@/components/text-area/types\";\n\n/**\n * Submission status the submit button reflects. The composer has no cancellation and no\n * intermediate \"generating\" state of its own — the consumer disables the button while busy — so\n * only the idle and error states are modeled here.\n */\nexport const CHAT_STATUS = {\n /** Idle / ready to submit. */\n READY: \"ready\",\n /** The last submission errored — the button shows a retry affordance. */\n ERROR: \"error\",\n} as const;\n\n/** Submission status the submit button reflects. */\nexport type ChatStatus = (typeof CHAT_STATUS)[keyof typeof CHAT_STATUS];\n\n/** Payload emitted by {@link PromptInput} on submit. v1 carries only text (attachments are cut). */\nexport interface PromptInputMessage {\n /** The current textarea value at submit time. */\n text: string;\n}\n\n/** Props for the {@link PromptInput} form wrapper. */\nexport type PromptInputProps = Omit<HTMLAttributes<HTMLFormElement>, \"onSubmit\"> & {\n /**\n * Fired when the form is submitted (Enter key or the submit button) with non-empty text.\n * Receives the captured message and the underlying form event.\n */\n onSubmit: (message: PromptInputMessage, event: FormEvent<HTMLFormElement>) => void;\n /**\n * Blocks submission across every trigger (Enter key, submit button, programmatic) when `true` —\n * e.g. while a generation is in flight. The single gate that keeps the Enter path in sync with a\n * disabled submit button. @default false\n */\n disabled?: boolean;\n};\n\n/** Props for {@link PromptInputTextarea} — clay `TextArea` props; `className` styles the wrapper. */\nexport type PromptInputTextareaProps = TextAreaProps;\n\n/** Props for {@link PromptInputFooter}. */\nexport type PromptInputFooterProps = HTMLAttributes<HTMLDivElement>;\n\n/** Props for {@link PromptInputTools}. */\nexport type PromptInputToolsProps = HTMLAttributes<HTMLDivElement>;\n\n/** Props for {@link PromptInputSubmit}. */\nexport interface PromptInputSubmitProps {\n /** Button label — pass a localized string (i18n) from the consumer. @default \"Submit\" */\n label?: string;\n /** Drives the button color: `error` renders the red error intent, otherwise primary. @default \"ready\" */\n status?: ChatStatus;\n /** Whether the button is non-interactive (e.g. empty input or a generation in flight). */\n disabled?: boolean;\n /** Additional CSS class name. */\n className?: string;\n}\n","import { useEffect, useRef, type CSSProperties } from \"react\";\n\nimport type { MouseGridProps } from \"./types\";\n\n/**\n * Absolutely-positioned grid backdrop, confined to its nearest positioned ancestor (give the\n * parent `position: relative` + `overflow: hidden` to clip it). The grid is revealed only near the\n * cursor via a radial mask whose center is driven by the `--vibe-mx` / `--vibe-my` CSS vars,\n * updated by a rAF-throttled `mousemove` listener. Renders behind all content (`z-0`) and never\n * blocks pointer events.\n *\n * Cursor coordinates are translated from viewport space (`clientX` / `clientY`) into layer-local\n * space (minus the layer's `getBoundingClientRect()` origin) and written onto the layer element\n * itself — not the document root — so the glow tracks correctly even though the layer no longer\n * fills the viewport. The rect read happens inside the rAF so it batches with paint.\n *\n * Pure `useEffect` + `requestAnimationFrame`, no animation library. The `.vibe-mouse-grid-layer` /\n * `.vibe-mouse-grid` / `.vibe-mouse-glow` styles ship in `@shapesos/clay/blocks/styles.css`.\n */\nexport function MouseGrid({ glowColor }: MouseGridProps = {}) {\n const layerRef = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n let raf = 0;\n let clientX = 0;\n let clientY = 0;\n function flush() {\n raf = 0;\n const layer = layerRef.current;\n if (!layer) {\n return;\n }\n const rect = layer.getBoundingClientRect();\n layer.style.setProperty(\"--vibe-mx\", `${clientX - rect.left}px`);\n layer.style.setProperty(\"--vibe-my\", `${clientY - rect.top}px`);\n }\n function onMove(event: MouseEvent) {\n clientX = event.clientX;\n clientY = event.clientY;\n if (raf) {\n return;\n }\n raf = requestAnimationFrame(flush);\n }\n window.addEventListener(\"mousemove\", onMove, { passive: true });\n return () => {\n window.removeEventListener(\"mousemove\", onMove);\n if (raf) {\n cancelAnimationFrame(raf);\n }\n };\n }, []);\n\n const glowStyle = glowColor ? ({ \"--vibe-glow-color\": glowColor } as CSSProperties) : undefined;\n\n return (\n <div ref={layerRef} aria-hidden=\"true\" className=\"vibe-mouse-grid-layer\">\n <div className=\"vibe-mouse-grid\" />\n <div className=\"vibe-mouse-glow\" style={glowStyle} />\n </div>\n );\n}\n","import { useCallback } from \"react\";\n\nimport { cn } from \"@/lib/utils\";\nimport type { SuggestionProps, SuggestionsProps } from \"./types\";\n\n/* ------------------------------------------------------------------------------------------------\n * Vendored + slimmed from `@vercel/ai-elements`'s `suggestion` registry entry. Upstream wraps the\n * pills in a shadcn `ScrollArea` and renders each as a shadcn `Button variant=\"outline\"`; clay has\n * neither, so this ships a dependency-free row (`flex flex-wrap`) of Tailwind-styled pills using\n * clay's named color tokens. Engine note: this is vendored ai-elements chrome, so it's Tailwind —\n * clay's `Button` is styled-components with fixed radii and can't produce the rounded-full pill.\n * ------------------------------------------------------------------------------------------------ */\n\n/**\n * A centered, wrapping row of {@link Suggestion} pills — e.g. starter prompts beneath a composer.\n * Compose `Suggestion` children inside.\n */\nexport const Suggestions = ({ className, ...props }: SuggestionsProps) => (\n <div className={cn(\"flex flex-wrap items-center justify-center gap-3\", className)} {...props} />\n);\n\n/**\n * A single tappable suggestion pill. Renders `children` if provided, otherwise the `suggestion`\n * text, and calls `onClick(suggestion)` when clicked.\n */\nexport const Suggestion = ({ suggestion, onClick, className, children, ...props }: SuggestionProps) => {\n const handleClick = useCallback(() => onClick?.(suggestion), [onClick, suggestion]);\n\n return (\n <button\n type=\"button\"\n onClick={handleClick}\n className={cn(\n \"cursor-pointer whitespace-nowrap rounded-full border border-brown-30 bg-white px-4 py-2 text-sm text-brown-100 transition-colors hover:bg-brown-10 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brown-40\",\n className\n )}\n {...props}\n >\n {children ?? suggestion}\n </button>\n );\n};\n"],"mappings":";;;;;;;;;;;;;AAAA,SAAS,YAAY,mBAAmB;;;ACSjC,IAAM,cAAc;AAAA;AAAA,EAEzB,OAAO;AAAA;AAAA,EAEP,OAAO;AACT;;;ADqDI;AAlBG,IAAM,cAAc,CAAC,EAAE,WAAW,UAAU,UAAU,UAAU,GAAG,MAAM,MAAwB;AACtG,QAAM,eAAkD;AAAA,IACtD,CAAC,UAAU;AACT,YAAM,eAAe;AACrB,UAAI,UAAU;AACZ;AAAA,MACF;AACA,YAAM,WAAW,MAAM,cAAc,cAAc,UAAU;AAC7D,YAAM,OAAO,UAAU,SAAS;AAChC,UAAI,CAAC,KAAK,KAAK,GAAG;AAChB;AAAA,MACF;AACA,eAAS,EAAE,KAAK,GAAG,KAAK;AAAA,IAC1B;AAAA,IACA,CAAC,UAAU,QAAQ;AAAA,EACrB;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACC,WAAW;AAAA,QACT;AAAA,QACA;AAAA,MACF;AAAA,MACA,UAAU;AAAA,MACT,GAAG;AAAA,MAEH;AAAA;AAAA,EACH;AAEJ;AAWO,IA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AU,GAAG,CAAC,SAAS,UAAU,CAAC;AAElF,SACE,gBAAAD;AAAA,IAAC;AAAA;AAAA,MACC,MAAK;AAAA,MACL,SAAS;AAAA,MACT,WAAW;AAAA,QACT;AAAA,QACA;AAAA,MACF;AAAA,MACC,GAAG;AAAA,MAEH,sBAAY;AAAA;AAAA,EACf;AAEJ;","names":["PromptInputTextarea","jsx","useCallback","jsx","useCallback"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=chunk-CYC2YUKU.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=chunk-L75JPWGS.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -4,11 +4,11 @@ import {
|
|
|
4
4
|
import {
|
|
5
5
|
ArtifactServices,
|
|
6
6
|
artifactToClipboardText
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-XFJ6XMJZ.js";
|
|
8
8
|
import {
|
|
9
9
|
typographyMixin,
|
|
10
10
|
typographyTypes
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-UXT2H3FM.js";
|
|
12
12
|
import {
|
|
13
13
|
colors
|
|
14
14
|
} from "./chunk-JF3P66JF.js";
|
|
@@ -247,4 +247,4 @@ export {
|
|
|
247
247
|
BlockServices,
|
|
248
248
|
Block
|
|
249
249
|
};
|
|
250
|
-
//# sourceMappingURL=chunk-
|
|
250
|
+
//# sourceMappingURL=chunk-MDAWYZBI.js.map
|
|
@@ -10,9 +10,9 @@ import styled, { css } from "styled-components";
|
|
|
10
10
|
|
|
11
11
|
// src/components/keyboard-shortcut/types.ts
|
|
12
12
|
var KEYBOARD_SHORTCUT_VARIANTS = {
|
|
13
|
-
/** Outlined keys with a subtle border —
|
|
13
|
+
/** Outlined keys with a subtle border + light glyph — for dark surfaces / app chrome. Default. */
|
|
14
14
|
OUTLINED: "outlined",
|
|
15
|
-
/** Filled keys with a solid background —
|
|
15
|
+
/** Filled keys with a solid background — for emphasis. */
|
|
16
16
|
FILLED: "filled"
|
|
17
17
|
};
|
|
18
18
|
|
|
@@ -27,6 +27,16 @@ var variantStyles = {
|
|
|
27
27
|
color: ${colors["brown-10"]};
|
|
28
28
|
`
|
|
29
29
|
};
|
|
30
|
+
var adaptiveStyles = {
|
|
31
|
+
[KEYBOARD_SHORTCUT_VARIANTS.OUTLINED]: css`
|
|
32
|
+
border: 1px solid color-mix(in oklch, currentColor 40%, transparent);
|
|
33
|
+
color: currentColor;
|
|
34
|
+
`,
|
|
35
|
+
[KEYBOARD_SHORTCUT_VARIANTS.FILLED]: css`
|
|
36
|
+
background: color-mix(in oklch, currentColor 12%, transparent);
|
|
37
|
+
color: currentColor;
|
|
38
|
+
`
|
|
39
|
+
};
|
|
30
40
|
var Wrapper = styled.div`
|
|
31
41
|
display: inline-flex;
|
|
32
42
|
align-items: center;
|
|
@@ -38,7 +48,7 @@ var Key = styled.kbd`
|
|
|
38
48
|
justify-content: center;
|
|
39
49
|
padding: 2px;
|
|
40
50
|
border-radius: 6px;
|
|
41
|
-
${({ $variant }) => variantStyles[$variant]};
|
|
51
|
+
${({ $variant, $adaptive }) => ($adaptive ? adaptiveStyles : variantStyles)[$variant]};
|
|
42
52
|
`;
|
|
43
53
|
|
|
44
54
|
// src/components/keyboard-shortcut/keyboard-shortcut.tsx
|
|
@@ -46,9 +56,10 @@ import { jsx } from "react/jsx-runtime";
|
|
|
46
56
|
function KeyboardShortcut({
|
|
47
57
|
keys,
|
|
48
58
|
variant = KEYBOARD_SHORTCUT_VARIANTS.OUTLINED,
|
|
59
|
+
adaptive = false,
|
|
49
60
|
className
|
|
50
61
|
}) {
|
|
51
|
-
return /* @__PURE__ */ jsx(Wrapper, { className, children: keys.map((KeyComponent, index) => /* @__PURE__ */ jsx(Key, { $variant: variant, children: /* @__PURE__ */ jsx(Icon, { icon: KeyComponent, size: 12 }) }, index)) });
|
|
62
|
+
return /* @__PURE__ */ jsx(Wrapper, { className, children: keys.map((KeyComponent, index) => /* @__PURE__ */ jsx(Key, { $variant: variant, $adaptive: adaptive, children: /* @__PURE__ */ jsx(Icon, { icon: KeyComponent, size: 12 }) }, index)) });
|
|
52
63
|
}
|
|
53
64
|
|
|
54
65
|
// src/components/keyboard-shortcut/icons/icon-ctrl.tsx
|
|
@@ -76,4 +87,4 @@ export {
|
|
|
76
87
|
KeyboardShortcut,
|
|
77
88
|
IconCtrl
|
|
78
89
|
};
|
|
79
|
-
//# sourceMappingURL=chunk-
|
|
90
|
+
//# sourceMappingURL=chunk-PGR2MDDU.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/keyboard-shortcut/keyboard-shortcut-styles.ts","../src/components/keyboard-shortcut/types.ts","../src/components/keyboard-shortcut/keyboard-shortcut.tsx","../src/components/keyboard-shortcut/icons/icon-ctrl.tsx"],"sourcesContent":["import styled, { css } from \"styled-components\";\n\nimport { colors } from \"../../tokens/colors\";\nimport { KEYBOARD_SHORTCUT_VARIANTS } from \"./types\";\nimport type { KeyboardShortcutVariant } from \"./types\";\n\n// Fixed-color treatments (default) — tuned for dark surfaces / app chrome.\nconst variantStyles: Record<KeyboardShortcutVariant, ReturnType<typeof css>> = {\n [KEYBOARD_SHORTCUT_VARIANTS.OUTLINED]: css`\n border: 1px solid ${colors[\"white-alpha-40\"]};\n color: ${colors[\"brown-10\"]};\n `,\n [KEYBOARD_SHORTCUT_VARIANTS.FILLED]: css`\n background: ${colors[\"brown-80\"]};\n color: ${colors[\"brown-10\"]};\n `,\n};\n\n// `adaptive` treatments — border/fill + glyph follow the surrounding text color (currentColor) so\n// the chip reads on any surface (light or dark). Selected when the `adaptive` prop is set.\nconst adaptiveStyles: Record<KeyboardShortcutVariant, ReturnType<typeof css>> = {\n [KEYBOARD_SHORTCUT_VARIANTS.OUTLINED]: css`\n border: 1px solid color-mix(in oklch, currentColor 40%, transparent);\n color: currentColor;\n `,\n [KEYBOARD_SHORTCUT_VARIANTS.FILLED]: css`\n background: color-mix(in oklch, currentColor 12%, transparent);\n color: currentColor;\n `,\n};\n\nexport const Wrapper = styled.div`\n display: inline-flex;\n align-items: center;\n gap: 2px;\n`;\n\nexport const Key = styled.kbd<{ $variant: KeyboardShortcutVariant; $adaptive: boolean }>`\n display: inline-flex;\n align-items: center;\n justify-content: center;\n padding: 2px;\n border-radius: 6px;\n ${({ $variant, $adaptive }) => ($adaptive ? adaptiveStyles : variantStyles)[$variant]};\n`;\n","import type { ComponentType, SVGProps } from \"react\";\n\n/** An SVG icon component representing a single keyboard key (e.g., Cmd, Shift, a letter). */\nexport type KeyIcon = ComponentType<SVGProps<SVGSVGElement>>;\n\n/** Available visual variants for the keyboard shortcut display. */\nexport const KEYBOARD_SHORTCUT_VARIANTS = {\n /** Outlined keys with a subtle border + light glyph — for dark surfaces / app chrome. Default. */\n OUTLINED: \"outlined\",\n /** Filled keys with a solid background — for emphasis. */\n FILLED: \"filled\",\n} as const;\n\n/** Visual variant for the KeyboardShortcut component. */\nexport type KeyboardShortcutVariant = (typeof KEYBOARD_SHORTCUT_VARIANTS)[keyof typeof KEYBOARD_SHORTCUT_VARIANTS];\n\n/** Props for the KeyboardShortcut display component. */\nexport interface KeyboardShortcutProps {\n /** Ordered array of key icon components representing the shortcut (e.g., `[IconCommand, IconLetterK]` for ⌘K). */\n keys: KeyIcon[];\n /** Visual style variant. @default \"outlined\" */\n variant?: KeyboardShortcutVariant;\n /**\n * When true, the border + glyph (outlined) or fill + glyph (filled) follow the surrounding text\n * color (`currentColor`) instead of fixed tokens, so the chip reads on any surface — light or\n * dark. Use on surfaces where the fixed-color variants wouldn't read (e.g. a prompt-launcher hero\n * on a light backdrop). @default false\n */\n adaptive?: boolean;\n /** Additional CSS class name. */\n className?: string;\n}\n","import type { ReactElement } from \"react\";\n\nimport { Icon } from \"../icon/icon\";\nimport { Key, Wrapper } from \"./keyboard-shortcut-styles\";\nimport { KEYBOARD_SHORTCUT_VARIANTS } from \"./types\";\nimport type { KeyboardShortcutProps } from \"./types\";\n\nexport function KeyboardShortcut({\n keys,\n variant = KEYBOARD_SHORTCUT_VARIANTS.OUTLINED,\n adaptive = false,\n className,\n}: KeyboardShortcutProps): ReactElement {\n return (\n <Wrapper className={className}>\n {keys.map((KeyComponent, index) => (\n <Key key={index} $variant={variant} $adaptive={adaptive}>\n <Icon icon={KeyComponent} size={12} />\n </Key>\n ))}\n </Wrapper>\n );\n}\n","import type { ReactElement, SVGProps } from \"react\";\n\nexport function IconCtrl(props: SVGProps<SVGSVGElement>): ReactElement {\n const { width = 24, height = 24, ...rest } = props;\n\n return (\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" width={width} height={height} fill=\"none\" {...rest}>\n <text\n x=\"50%\"\n y=\"50%\"\n dominantBaseline=\"central\"\n textAnchor=\"middle\"\n fill=\"currentColor\"\n fontFamily=\"Geist, sans-serif\"\n fontWeight={300}\n fontSize={14}\n >\n Ctrl\n </text>\n </svg>\n );\n}\n"],"mappings":";;;;;;;;AAAA,OAAO,UAAU,WAAW;;;ACMrB,IAAM,6BAA6B;AAAA;AAAA,EAExC,UAAU;AAAA;AAAA,EAEV,QAAQ;AACV;;;ADJA,IAAM,gBAAyE;AAAA,EAC7E,CAAC,2BAA2B,QAAQ,GAAG;AAAA,wBACjB,OAAO,gBAAgB,CAAC;AAAA,aACnC,OAAO,UAAU,CAAC;AAAA;AAAA,EAE7B,CAAC,2BAA2B,MAAM,GAAG;AAAA,kBACrB,OAAO,UAAU,CAAC;AAAA,aACvB,OAAO,UAAU,CAAC;AAAA;AAE/B;AAIA,IAAM,iBAA0E;AAAA,EAC9E,CAAC,2BAA2B,QAAQ,GAAG;AAAA;AAAA;AAAA;AAAA,EAIvC,CAAC,2BAA2B,MAAM,GAAG;AAAA;AAAA;AAAA;AAIvC;AAEO,IAAM,UAAU,OAAO;AAAA;AAAA;AAAA;AAAA;AAMvB,IAAM,MAAM,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAMtB,CAAC,EAAE,UAAU,UAAU,OAAO,YAAY,iBAAiB,eAAe,QAAQ,CAAC;AAAA;;;AE1B7E;AAVH,SAAS,iBAAiB;AAAA,EAC/B;AAAA,EACA,UAAU,2BAA2B;AAAA,EACrC,WAAW;AAAA,EACX;AACF,GAAwC;AACtC,SACE,oBAAC,WAAQ,WACN,eAAK,IAAI,CAAC,cAAc,UACvB,oBAAC,OAAgB,UAAU,SAAS,WAAW,UAC7C,8BAAC,QAAK,MAAM,cAAc,MAAM,IAAI,KAD5B,KAEV,CACD,GACH;AAEJ;;;ACfM,gBAAAA,YAAA;AALC,SAAS,SAAS,OAA8C;AACrE,QAAM,EAAE,QAAQ,IAAI,SAAS,IAAI,GAAG,KAAK,IAAI;AAE7C,SACE,gBAAAA,KAAC,SAAI,OAAM,8BAA6B,SAAQ,aAAY,OAAc,QAAgB,MAAK,QAAQ,GAAG,MACxG,0BAAAA;AAAA,IAAC;AAAA;AAAA,MACC,GAAE;AAAA,MACF,GAAE;AAAA,MACF,kBAAiB;AAAA,MACjB,YAAW;AAAA,MACX,MAAK;AAAA,MACL,YAAW;AAAA,MACX,YAAY;AAAA,MACZ,UAAU;AAAA,MACX;AAAA;AAAA,EAED,GACF;AAEJ;","names":["jsx"]}
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
import { forwardRef } from "react";
|
|
10
10
|
|
|
11
11
|
// src/components/icon-button/icon-button-styles.ts
|
|
12
|
-
import styled from "styled-components";
|
|
12
|
+
import styled, { css } from "styled-components";
|
|
13
13
|
var PADDING = {
|
|
14
14
|
short: {
|
|
15
15
|
small: "4px",
|
|
@@ -24,6 +24,59 @@ var BORDER_RADIUS = {
|
|
|
24
24
|
small: 6,
|
|
25
25
|
medium: 10
|
|
26
26
|
};
|
|
27
|
+
var intentStyles = {
|
|
28
|
+
secondary: ({ $isSelected }) => css`
|
|
29
|
+
background: ${$isSelected ? colors["brown-40"] : "transparent"};
|
|
30
|
+
color: ${colors["brown-100"]};
|
|
31
|
+
|
|
32
|
+
&:hover:not(:disabled) {
|
|
33
|
+
background: ${$isSelected ? colors["brown-40"] : colors["brown-20"]};
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
&:active:not(:disabled) {
|
|
37
|
+
background: ${colors["brown-40"]};
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
&:disabled {
|
|
41
|
+
color: ${colors["brown-50"]};
|
|
42
|
+
background: transparent;
|
|
43
|
+
}
|
|
44
|
+
`,
|
|
45
|
+
primary: () => css`
|
|
46
|
+
background: ${colors["brown-100"]};
|
|
47
|
+
color: ${colors.white};
|
|
48
|
+
|
|
49
|
+
&:hover:not(:disabled) {
|
|
50
|
+
background: ${colors["brown-90"]};
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
&:active:not(:disabled) {
|
|
54
|
+
background: ${colors["brown-90"]};
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
&:disabled {
|
|
58
|
+
color: ${colors["brown-50"]};
|
|
59
|
+
background: ${colors["brown-20"]};
|
|
60
|
+
}
|
|
61
|
+
`,
|
|
62
|
+
error: () => css`
|
|
63
|
+
background: ${colors["red-500"]};
|
|
64
|
+
color: ${colors.white};
|
|
65
|
+
|
|
66
|
+
&:hover:not(:disabled) {
|
|
67
|
+
background: ${colors["red-600"]};
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
&:active:not(:disabled) {
|
|
71
|
+
background: ${colors["red-600"]};
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
&:disabled {
|
|
75
|
+
color: ${colors["red-200"]};
|
|
76
|
+
background: ${colors["red-100"]};
|
|
77
|
+
}
|
|
78
|
+
`
|
|
79
|
+
};
|
|
27
80
|
var Button = styled.button`
|
|
28
81
|
display: inline-flex;
|
|
29
82
|
align-items: center;
|
|
@@ -31,22 +84,12 @@ var Button = styled.button`
|
|
|
31
84
|
padding: ${({ $size, $variant }) => PADDING[$variant][$size]};
|
|
32
85
|
border: none;
|
|
33
86
|
border-radius: ${({ $size }) => BORDER_RADIUS[$size]}px;
|
|
34
|
-
background: ${({ $isSelected }) => $isSelected ? colors["brown-40"] : "transparent"};
|
|
35
|
-
color: ${colors["brown-100"]};
|
|
36
87
|
cursor: pointer;
|
|
37
88
|
transition: background-color 100ms ease;
|
|
38
89
|
|
|
39
|
-
|
|
40
|
-
background: ${({ $isSelected }) => $isSelected ? colors["brown-40"] : colors["brown-20"]};
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
&:active {
|
|
44
|
-
background: ${colors["brown-40"]};
|
|
45
|
-
}
|
|
90
|
+
${({ $intent, $isSelected }) => intentStyles[$intent]({ $isSelected })}
|
|
46
91
|
|
|
47
92
|
&:disabled {
|
|
48
|
-
color: ${colors["brown-50"]};
|
|
49
|
-
background: transparent;
|
|
50
93
|
cursor: not-allowed;
|
|
51
94
|
}
|
|
52
95
|
`;
|
|
@@ -61,6 +104,7 @@ var IconButton = forwardRef(function IconButton2({
|
|
|
61
104
|
icon,
|
|
62
105
|
size = "small",
|
|
63
106
|
variant = "short",
|
|
107
|
+
intent = "secondary",
|
|
64
108
|
isSelected = false,
|
|
65
109
|
disabled = false,
|
|
66
110
|
onClick,
|
|
@@ -80,6 +124,7 @@ var IconButton = forwardRef(function IconButton2({
|
|
|
80
124
|
as,
|
|
81
125
|
$size: size,
|
|
82
126
|
$variant: variant,
|
|
127
|
+
$intent: intent,
|
|
83
128
|
$isSelected: isSelected,
|
|
84
129
|
disabled,
|
|
85
130
|
onClick: disabled ? void 0 : onClick,
|
|
@@ -94,4 +139,4 @@ var IconButton = forwardRef(function IconButton2({
|
|
|
94
139
|
export {
|
|
95
140
|
IconButton
|
|
96
141
|
};
|
|
97
|
-
//# sourceMappingURL=chunk-
|
|
142
|
+
//# sourceMappingURL=chunk-PYDVANWI.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/icon-button/icon-button.tsx","../src/components/icon-button/icon-button-styles.ts"],"sourcesContent":["import { forwardRef } from \"react\";\n\nimport { Icon } from \"../icon/icon\";\nimport { Button } from \"./icon-button-styles\";\nimport type { IconButtonProps, IconButtonSize } from \"./types\";\n\nconst ICON_SIZE_BY_BUTTON_SIZE: Record<IconButtonSize, number> = {\n small: 16,\n medium: 20,\n};\n\n/** Icon-only button. `forwardRef` + the rest-props spread so Radix `Slot`-based wrappers\n * (Tooltip, Popover, DropdownMenu) can attach refs and event handlers via `asChild`. */\nexport const IconButton = forwardRef<HTMLButtonElement, IconButtonProps>(function IconButton(\n {\n icon,\n size = \"small\",\n variant = \"short\",\n intent = \"secondary\",\n isSelected = false,\n disabled = false,\n onClick,\n className,\n id,\n as,\n \"aria-label\": ariaLabel,\n ...rest\n },\n ref\n) {\n // Only set `type=\"button\"` when rendering as a native button. Anchors (`as=\"a\"`) treat the\n // `type` attribute as a content-type hint for the linked resource — `type=\"button\"` on an\n // anchor is semantically wrong and shows up as an a11y / HTML-validation noise warning.\n const isNativeButton = as === undefined || as === \"button\";\n return (\n <Button\n ref={ref}\n className={className}\n id={id}\n as={as}\n $size={size}\n $variant={variant}\n $intent={intent}\n $isSelected={isSelected}\n disabled={disabled}\n onClick={disabled ? undefined : onClick}\n aria-label={ariaLabel}\n {...(isNativeButton ? { type: \"button\" as const } : {})}\n {...rest}\n >\n <Icon icon={icon} size={ICON_SIZE_BY_BUTTON_SIZE[size]} />\n </Button>\n );\n});\n","import styled, { css } from \"styled-components\";\n\nimport { colors } from \"../../tokens/colors\";\nimport type { IconButtonIntent, IconButtonSize, IconButtonVariant } from \"./types\";\n\nconst PADDING: Record<IconButtonVariant, Record<IconButtonSize, string>> = {\n short: {\n small: \"4px\",\n medium: \"6px\",\n },\n long: {\n small: \"4px 6px\",\n medium: \"6px 10px\",\n },\n};\n\nconst BORDER_RADIUS: Record<IconButtonSize, number> = {\n small: 6,\n medium: 10,\n};\n\n// Color treatment per intent. \"secondary\" is the original transparent ghost (default — preserves\n// every existing consumer). \"primary\" / \"error\" are filled, mirroring `Button`'s solid intents.\nconst intentStyles: Record<IconButtonIntent, (args: { $isSelected: boolean }) => ReturnType<typeof css>> = {\n secondary: ({ $isSelected }) => css`\n background: ${$isSelected ? colors[\"brown-40\"] : \"transparent\"};\n color: ${colors[\"brown-100\"]};\n\n &:hover:not(:disabled) {\n background: ${$isSelected ? colors[\"brown-40\"] : colors[\"brown-20\"]};\n }\n\n &:active:not(:disabled) {\n background: ${colors[\"brown-40\"]};\n }\n\n &:disabled {\n color: ${colors[\"brown-50\"]};\n background: transparent;\n }\n `,\n primary: () => css`\n background: ${colors[\"brown-100\"]};\n color: ${colors.white};\n\n &:hover:not(:disabled) {\n background: ${colors[\"brown-90\"]};\n }\n\n &:active:not(:disabled) {\n background: ${colors[\"brown-90\"]};\n }\n\n &:disabled {\n color: ${colors[\"brown-50\"]};\n background: ${colors[\"brown-20\"]};\n }\n `,\n error: () => css`\n background: ${colors[\"red-500\"]};\n color: ${colors.white};\n\n &:hover:not(:disabled) {\n background: ${colors[\"red-600\"]};\n }\n\n &:active:not(:disabled) {\n background: ${colors[\"red-600\"]};\n }\n\n &:disabled {\n color: ${colors[\"red-200\"]};\n background: ${colors[\"red-100\"]};\n }\n `,\n};\n\nexport const Button = styled.button<{\n $size: IconButtonSize;\n $variant: IconButtonVariant;\n $intent: IconButtonIntent;\n $isSelected: boolean;\n}>`\n display: inline-flex;\n align-items: center;\n justify-content: center;\n padding: ${({ $size, $variant }) => PADDING[$variant][$size]};\n border: none;\n border-radius: ${({ $size }) => BORDER_RADIUS[$size]}px;\n cursor: pointer;\n transition: background-color 100ms ease;\n\n ${({ $intent, $isSelected }) => intentStyles[$intent]({ $isSelected })}\n\n &:disabled {\n cursor: not-allowed;\n }\n`;\n"],"mappings":";;;;;;;;AAAA,SAAS,kBAAkB;;;ACA3B,OAAO,UAAU,WAAW;AA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