Skip to content

Commit 33a9690

Browse files
authored
Merge pull request #46 from charlesLoder/issue-44/clover-v3
Updates to Clover-IIIF v3 and React v19
2 parents a6d6c54 + b463255 commit 33a9690

File tree

13 files changed

+444
-534
lines changed

13 files changed

+444
-534
lines changed

package-lock.json

Lines changed: 233 additions & 188 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,9 @@
5757
"peerDependencies": {
5858
"@iiif/parser": "^2.2.0",
5959
"@iiif/presentation-3": "^2.2.3",
60-
"@samvera/clover-iiif": "^2.19.2",
61-
"react": "^18.3.1",
62-
"react-dom": "^18.3.1"
60+
"@samvera/clover-iiif": "^3.0.0",
61+
"react": "^18.2.0 || ^19.0.0",
62+
"react-dom": "^18.2.0 || ^19.0.0"
6363
},
6464
"dependencies": {
6565
"@ai-sdk/anthropic": "^2.0.35",
@@ -69,13 +69,12 @@
6969
"@mediapipe/tasks-genai": "^0.10.14",
7070
"ai": "^5.0.76",
7171
"dedent": "^1.7.0",
72-
"react-basic-contenteditable": "^1.0.6",
7372
"react-markdown": "^10.1.0"
7473
},
7574
"devDependencies": {
7675
"@alcalzone/esm2cjs": "^1.4.1",
7776
"@eslint/js": "^9.28.0",
78-
"@samvera/clover-iiif": "^2.19.2",
77+
"@samvera/clover-iiif": "^3.0.0",
7978
"@storybook/addon-a11y": "^9.0.9",
8079
"@storybook/addon-docs": "^9.0.9",
8180
"@storybook/react-vite": "^9.0.9",
@@ -95,8 +94,8 @@
9594
"eslint-plugin-storybook": "^9.0.9",
9695
"jsdom": "^26.1.0",
9796
"prettier-plugin-organize-imports": "^4.1.0",
98-
"react": "^18.3.1",
99-
"react-dom": "^18.3.1",
97+
"react": "^19.0.0",
98+
"react-dom": "^19.0.0",
10099
"storybook": "^9.0.9",
101100
"storybook-css-modules": "^1.0.8",
102101
"tsc-alias": "^1.8.16",

src/components/Figure/style.module.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
margin: 0;
33
display: grid;
44

5+
&:has(img) {
6+
width: min-content;
7+
}
8+
59
/* configurable styles */
610
--figure-border-radius: var(--clover-ai-radii-2);
711
--figure-caption-color: var(--clover-ai-colors-primaryMuted);

src/components/Input/style.module.css

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@
1919
--input-border-radius: var(--clover-ai-sizes-2);
2020
border-radius: var(--input-border-radius);
2121

22-
--input-border-width: 1px;
23-
border-width: var(--input-border-width);
22+
border-width: calc(var(--clover-ai-sizes-1) / calc(var(--golden-ratio) * 2));
2423

2524
--input-border-style: solid;
2625
border-style: var(--input-border-style);
@@ -37,10 +36,12 @@
3736
&:focus {
3837
--input-box-shadow-color: color-mix(in srgb, var(--input-border-color) 10%, transparent);
3938
--input-box-shadow: 0 0 0 var(--clover-ai-sizes-1) var(--input-box-shadow-color);
39+
--input-border-color: var(--clover-ai-colors-accent);
4040
box-shadow: var(--input-box-shadow);
4141
}
4242

43-
&:user-invalid {
43+
&:user-invalid,
44+
&[aria-invalid="true"] {
4445
--input-border-color: var(--clover-ai-colors-error);
4546
}
4647
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import type { FC } from "react";
2+
import React from "react";
3+
import styles from "./style.module.css";
4+
5+
export interface PromptInputProps extends React.TextareaHTMLAttributes<HTMLTextAreaElement> {
6+
error?: string;
7+
placeholder?: string;
8+
children?: React.ReactNode;
9+
}
10+
11+
export const PromptInput: FC<PromptInputProps> = ({
12+
error,
13+
placeholder = "What would you like to know?",
14+
children,
15+
...rest
16+
}) => {
17+
return (
18+
<div className={styles.promptInputContainer} data-role="prompt-input">
19+
{error && <div className={styles.errorMessage}>{error}</div>}
20+
<div className={styles.promptInput} data-error={!!error}>
21+
<textarea
22+
aria-label="Write your prompt to chat with a model"
23+
placeholder={placeholder}
24+
{...rest}
25+
></textarea>
26+
{children && <div className={styles.childrenContainer}>{children}</div>}
27+
</div>
28+
</div>
29+
);
30+
};
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
.promptInputContainer {
2+
width: 100%;
3+
display: flex;
4+
flex-direction: column;
5+
gap: var(--clover-ai-sizes-1);
6+
}
7+
8+
.errorMessage {
9+
margin-top: 0.25rem;
10+
font-size: 0.875rem;
11+
color: var(--clover-ai-colors-error);
12+
}
13+
14+
.promptInput {
15+
display: flex;
16+
flex-direction: column;
17+
gap: var(--clover-ai-sizes-2);
18+
padding: var(--clover-ai-sizes-2);
19+
border-radius: 0.5rem;
20+
outline: none;
21+
transition:
22+
border-color 0.2s ease-in-out,
23+
box-shadow 0.2s ease-in-out;
24+
font-family: inherit;
25+
font-size: inherit;
26+
resize: none;
27+
overflow-wrap: break-word;
28+
word-wrap: break-word;
29+
border-width: calc(var(--clover-ai-sizes-1) / calc(var(--golden-ratio) * 2));
30+
border-style: solid;
31+
background-color: transparent;
32+
margin-block-end: var(--clover-ai-sizes-1);
33+
34+
/* configurable styles */
35+
--textarea-border-color: var(--clover-ai-colors-accentMuted);
36+
border-color: var(--textarea-border-color);
37+
38+
--textarea-box-shadow-color: color-mix(
39+
in srgb,
40+
var(--clover-ai-colors-accentMuted) 10%,
41+
transparent
42+
);
43+
--textarea-box-shadow: 0 0 0 var(--clover-ai-sizes-1) var(--textarea-box-shadow-color);
44+
45+
&:has(textarea:focus) {
46+
--textarea-border-color: var(--clover-ai-colors-accent);
47+
box-shadow: var(--textarea-box-shadow);
48+
}
49+
}
50+
51+
.promptInput[data-error="true"] {
52+
--textarea-border-color: var(--clover-ai-colors-error);
53+
&:has(textarea:focus) {
54+
--textarea-border-color: var(--clover-ai-colors-error);
55+
--textarea-box-shadow-color: color-mix(in srgb, var(--clover-ai-colors-error) 10%, transparent);
56+
}
57+
}
58+
59+
textarea {
60+
cursor: pointer;
61+
margin: 0;
62+
padding: 0;
63+
white-space: pre-wrap;
64+
border: none;
65+
width: 100%;
66+
font-family: inherit;
67+
resize: none;
68+
field-sizing: content;
69+
min-height: 2em;
70+
max-height: 4em;
71+
scrollbar-color: var(--clover-ai-colors-secondaryAlt) transparent;
72+
overflow-y: scroll;
73+
}
74+
75+
textarea:focus {
76+
outline: none;
77+
}
78+
79+
.childrenContainer {
80+
display: flex;
81+
flex-direction: row;
82+
justify-content: space-between;
83+
align-items: center;
84+
> * {
85+
display: flex;
86+
gap: 0.5rem;
87+
}
88+
}

src/components/TextArea/index.tsx

Lines changed: 0 additions & 70 deletions
This file was deleted.

0 commit comments

Comments
 (0)