@oscarrf2/goo-ds 0.1.0 → 0.1.2
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/CHANGELOG.md +96 -0
- package/dist/assets/index.css +1 -0
- package/dist/components/Button/Button.js +60 -0
- package/dist/components/Button/Button.js.map +1 -0
- package/dist/components/Cell/Cell.js +28 -0
- package/dist/components/Cell/Cell.js.map +1 -0
- package/dist/components/Codeblock/Codeblock.js +51 -0
- package/dist/components/Codeblock/Codeblock.js.map +1 -0
- package/dist/components/CoreText/CoreText.js +26 -0
- package/dist/components/CoreText/CoreText.js.map +1 -0
- package/dist/components/Divider/Divider.js +25 -0
- package/dist/components/Divider/Divider.js.map +1 -0
- package/dist/components/InputImage/InputImage.js +284 -0
- package/dist/components/InputImage/InputImage.js.map +1 -0
- package/dist/components/Sidebar/Sidebar.js +27 -0
- package/dist/components/Sidebar/Sidebar.js.map +1 -0
- package/dist/components/SidebarItem/SidebarItem.js +37 -0
- package/dist/components/SidebarItem/SidebarItem.js.map +1 -0
- package/dist/components/Skeleton/Skeleton.js +30 -0
- package/dist/components/Skeleton/Skeleton.js.map +1 -0
- package/dist/components/Spacer/Spacer.js +21 -0
- package/dist/components/Spacer/Spacer.js.map +1 -0
- package/dist/components/TabItem/TabItem.js +33 -0
- package/dist/components/TabItem/TabItem.js.map +1 -0
- package/dist/components/Table/Table.js +18 -0
- package/dist/components/Table/Table.js.map +1 -0
- package/dist/components/TableRow/TableRow.js +35 -0
- package/dist/components/TableRow/TableRow.js.map +1 -0
- package/dist/components/Tabs/Tabs.js +23 -0
- package/dist/components/Tabs/Tabs.js.map +1 -0
- package/dist/index.js +32 -0
- package/dist/index.js.map +1 -0
- package/dist/styles.css +17 -0
- package/dist/vite.svg +1 -0
- package/package.json +19 -19
- package/src/components/Button/Button.tsx +0 -82
- package/src/components/Button/Button.types.ts +0 -62
- package/src/components/Button/index.ts +0 -3
- package/src/components/Cell/Cell.tsx +0 -42
- package/src/components/Cell/Cell.types.ts +0 -42
- package/src/components/Cell/index.ts +0 -3
- package/src/components/Codeblock/Codeblock.tsx +0 -88
- package/src/components/Codeblock/Codeblock.types.ts +0 -42
- package/src/components/Codeblock/index.ts +0 -3
- package/src/components/CoreText/CoreText.tsx +0 -43
- package/src/components/CoreText/CoreText.types.ts +0 -56
- package/src/components/CoreText/index.ts +0 -2
- package/src/components/Divider/Divider.tsx +0 -35
- package/src/components/Divider/Divider.types.ts +0 -19
- package/src/components/Divider/index.ts +0 -3
- package/src/components/InputImage/InputImage.tsx +0 -314
- package/src/components/InputImage/InputImage.types.ts +0 -86
- package/src/components/InputImage/index.ts +0 -2
- package/src/components/Sidebar/Sidebar.tsx +0 -42
- package/src/components/Sidebar/Sidebar.types.ts +0 -24
- package/src/components/Sidebar/index.ts +0 -3
- package/src/components/SidebarItem/SidebarItem.tsx +0 -55
- package/src/components/SidebarItem/SidebarItem.types.ts +0 -39
- package/src/components/SidebarItem/index.ts +0 -3
- package/src/components/Skeleton/Skeleton.tsx +0 -41
- package/src/components/Skeleton/Skeleton.types.ts +0 -65
- package/src/components/Skeleton/index.ts +0 -5
- package/src/components/Spacer/Spacer.tsx +0 -31
- package/src/components/Spacer/Spacer.types.ts +0 -58
- package/src/components/Spacer/index.ts +0 -3
- package/src/components/TabItem/TabItem.tsx +0 -45
- package/src/components/TabItem/TabItem.types.ts +0 -35
- package/src/components/TabItem/index.ts +0 -3
- package/src/components/Table/Table.tsx +0 -39
- package/src/components/Table/Table.types.ts +0 -18
- package/src/components/Table/index.ts +0 -3
- package/src/components/TableRow/TableRow.tsx +0 -53
- package/src/components/TableRow/TableRow.types.ts +0 -41
- package/src/components/TableRow/index.ts +0 -3
- package/src/components/Tabs/Tabs.tsx +0 -37
- package/src/components/Tabs/Tabs.types.ts +0 -18
- package/src/components/Tabs/index.ts +0 -3
- package/src/components/index.ts +0 -15
- package/src/compositions/index.ts +0 -3
- package/src/index.ts +0 -4
- package/src/styles.css +0 -2
- /package/{src → dist}/components/Button/Button.css +0 -0
- /package/{src → dist}/components/Cell/Cell.css +0 -0
- /package/{src → dist}/components/Codeblock/Codeblock.css +0 -0
- /package/{src → dist}/components/Divider/Divider.css +0 -0
- /package/{src → dist}/components/InputImage/InputImage.css +0 -0
- /package/{src → dist}/components/Sidebar/Sidebar.css +0 -0
- /package/{src → dist}/components/SidebarItem/SidebarItem.css +0 -0
- /package/{src → dist}/components/Skeleton/Skeleton.css +0 -0
- /package/{src → dist}/components/TabItem/TabItem.css +0 -0
- /package/{src → dist}/components/Table/Table.css +0 -0
- /package/{src → dist}/components/TableRow/TableRow.css +0 -0
- /package/{src → dist}/components/Tabs/Tabs.css +0 -0
- /package/{src → dist}/index.css +0 -0
- /package/{src → dist}/styles/component-tokens.css +0 -0
- /package/{src → dist}/styles/component-tokens.current.css +0 -0
- /package/{src → dist}/styles/fonts.css +0 -0
- /package/{src → dist}/styles/global-tokens.css +0 -0
- /package/{src → dist}/styles/index.css +0 -0
- /package/{src → dist}/styles/number-tokens.css +0 -0
- /package/{src → dist}/styles/semantic-tokens.css +0 -0
- /package/{src → dist}/styles/style-tokens.css +0 -0
- /package/{src → dist}/styles/typography-tokens.css +0 -0
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import type { ReactNode } from "react";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Cell component props
|
|
5
|
-
* Provides table cell layout using design system tokens
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
export type CellType = "header" | "body";
|
|
9
|
-
|
|
10
|
-
export type CellAlignment = "left" | "center" | "right";
|
|
11
|
-
|
|
12
|
-
export type CellWidth = "xs" | "sm" | "md" | "lg" | "xl" | "fill";
|
|
13
|
-
|
|
14
|
-
export interface CellProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
15
|
-
/**
|
|
16
|
-
* The type of cell (header or body)
|
|
17
|
-
* @default "body"
|
|
18
|
-
*/
|
|
19
|
-
type?: CellType;
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Horizontal alignment of cell content
|
|
23
|
-
* @default "left"
|
|
24
|
-
*/
|
|
25
|
-
alignment?: CellAlignment;
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Width preset for the cell
|
|
29
|
-
* @default "md"
|
|
30
|
-
*/
|
|
31
|
-
width?: CellWidth;
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Cell content
|
|
35
|
-
*/
|
|
36
|
-
children?: ReactNode;
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Additional CSS class names
|
|
40
|
-
*/
|
|
41
|
-
className?: string;
|
|
42
|
-
}
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import { useState, useRef } from "react";
|
|
4
|
-
import type { CodeblockProps } from "./Codeblock.types";
|
|
5
|
-
import "./Codeblock.css";
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Codeblock - Code display component for the goo-ds design system
|
|
9
|
-
*
|
|
10
|
-
* Provides consistent code block display with copy functionality.
|
|
11
|
-
* Token-first per Constitution (no hardcoded values).
|
|
12
|
-
*
|
|
13
|
-
* @example
|
|
14
|
-
* ```tsx
|
|
15
|
-
* <Codeblock>
|
|
16
|
-
* const greeting = "Hello, world!";
|
|
17
|
-
* console.log(greeting);
|
|
18
|
-
* </Codeblock>
|
|
19
|
-
*
|
|
20
|
-
* <Codeblock showCopy={false}>
|
|
21
|
-
* function example() {
|
|
22
|
-
* return true;
|
|
23
|
-
* }
|
|
24
|
-
* </Codeblock>
|
|
25
|
-
* ```
|
|
26
|
-
*/
|
|
27
|
-
export function Codeblock({
|
|
28
|
-
children,
|
|
29
|
-
showCopy = true,
|
|
30
|
-
copyLabel = "Copy",
|
|
31
|
-
copiedLabel = "Copied!",
|
|
32
|
-
onCodeCopy,
|
|
33
|
-
className = "",
|
|
34
|
-
...props
|
|
35
|
-
}: CodeblockProps) {
|
|
36
|
-
const [copied, setCopied] = useState(false);
|
|
37
|
-
const codeRef = useRef<HTMLPreElement>(null);
|
|
38
|
-
|
|
39
|
-
const handleCopy = async () => {
|
|
40
|
-
if (!codeRef.current) return;
|
|
41
|
-
|
|
42
|
-
const textContent = codeRef.current.textContent || "";
|
|
43
|
-
|
|
44
|
-
try {
|
|
45
|
-
await navigator.clipboard.writeText(textContent);
|
|
46
|
-
setCopied(true);
|
|
47
|
-
|
|
48
|
-
if (onCodeCopy) {
|
|
49
|
-
onCodeCopy(textContent);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
// Reset copied state after 2 seconds
|
|
53
|
-
setTimeout(() => {
|
|
54
|
-
setCopied(false);
|
|
55
|
-
}, 2000);
|
|
56
|
-
} catch (err) {
|
|
57
|
-
console.error("Failed to copy code:", err);
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
return (
|
|
62
|
-
<div
|
|
63
|
-
className={`gds-codeblock ${className}`.trim()}
|
|
64
|
-
data-component="Codeblock"
|
|
65
|
-
data-show-copy={showCopy}
|
|
66
|
-
{...props}
|
|
67
|
-
>
|
|
68
|
-
<pre ref={codeRef} className="gds-codeblock-content">
|
|
69
|
-
<code>{children}</code>
|
|
70
|
-
</pre>
|
|
71
|
-
|
|
72
|
-
{showCopy && (
|
|
73
|
-
<button
|
|
74
|
-
type="button"
|
|
75
|
-
className="gds-codeblock-copy-button"
|
|
76
|
-
onClick={handleCopy}
|
|
77
|
-
aria-label={copied ? copiedLabel : copyLabel}
|
|
78
|
-
>
|
|
79
|
-
<span className="gds-codeblock-copy-text">
|
|
80
|
-
{copied ? copiedLabel : copyLabel}
|
|
81
|
-
</span>
|
|
82
|
-
</button>
|
|
83
|
-
)}
|
|
84
|
-
</div>
|
|
85
|
-
);
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
export default Codeblock;
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import type { ReactNode } from "react";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Codeblock component props
|
|
5
|
-
* Provides code display with copy functionality using design system tokens
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
export interface CodeblockProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
9
|
-
/**
|
|
10
|
-
* Code content to display
|
|
11
|
-
*/
|
|
12
|
-
children: ReactNode;
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Whether to show the copy button
|
|
16
|
-
* @default true
|
|
17
|
-
*/
|
|
18
|
-
showCopy?: boolean;
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Custom copy button label
|
|
22
|
-
* @default "Copy"
|
|
23
|
-
*/
|
|
24
|
-
copyLabel?: string;
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Label shown after successful copy
|
|
28
|
-
* @default "Copied!"
|
|
29
|
-
*/
|
|
30
|
-
copiedLabel?: string;
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Callback when copy button is clicked
|
|
34
|
-
* Receives the text content of the codeblock
|
|
35
|
-
*/
|
|
36
|
-
onCodeCopy?: (content: string) => void;
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Additional CSS class names
|
|
40
|
-
*/
|
|
41
|
-
className?: string;
|
|
42
|
-
}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import type { CoreTextProps } from "./CoreText.types";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* CoreText - Foundation typography component for the goo-ds design system
|
|
5
|
-
*
|
|
6
|
-
* Renders text with consistent typography styles defined in Figma.
|
|
7
|
-
* Styles are applied via CSS classes from style-tokens.css (token-first per Constitution).
|
|
8
|
-
*
|
|
9
|
-
* @example
|
|
10
|
-
* ```tsx
|
|
11
|
-
* <CoreText style="headline-lg-bold">Page Title</CoreText>
|
|
12
|
-
* <CoreText style="body-md-regular" align="center">Body text</CoreText>
|
|
13
|
-
* <CoreText style="link-md-medium" as="a" href="/page">Link text</CoreText>
|
|
14
|
-
* ```
|
|
15
|
-
*/
|
|
16
|
-
export function CoreText({
|
|
17
|
-
children,
|
|
18
|
-
style = "body-md-regular",
|
|
19
|
-
align = "left",
|
|
20
|
-
className = "",
|
|
21
|
-
as: Component = "p",
|
|
22
|
-
}: CoreTextProps) {
|
|
23
|
-
// Alignment classes (structural utility per Constitution IV)
|
|
24
|
-
const alignmentClass =
|
|
25
|
-
align === "center" ? "text-center" : align === "right" ? "text-right" : "text-left";
|
|
26
|
-
|
|
27
|
-
// Combine style class from style-tokens.css with alignment and custom classes
|
|
28
|
-
const combinedClassName = [style, alignmentClass, className].filter(Boolean).join(" ");
|
|
29
|
-
|
|
30
|
-
return (
|
|
31
|
-
<Component
|
|
32
|
-
className={combinedClassName}
|
|
33
|
-
style={{
|
|
34
|
-
color: "var(--coreText-text-primary-default)",
|
|
35
|
-
margin: 0,
|
|
36
|
-
}}
|
|
37
|
-
>
|
|
38
|
-
{children}
|
|
39
|
-
</Component>
|
|
40
|
-
);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export default CoreText;
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import type { ElementType, ReactNode } from "react";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* CoreText style variants matching Figma text styles
|
|
5
|
-
* These map directly to CSS classes in style-tokens.css
|
|
6
|
-
*/
|
|
7
|
-
export type CoreTextStyle =
|
|
8
|
-
// Headlines (use secondary font: Geist)
|
|
9
|
-
| "headline-lg-bold"
|
|
10
|
-
| "headline-md-bold"
|
|
11
|
-
| "headline-sm-bold"
|
|
12
|
-
| "headline-sm-medium"
|
|
13
|
-
| "headline-sm-regular"
|
|
14
|
-
| "headline-xs-bold"
|
|
15
|
-
// Body (use primary font: Inter)
|
|
16
|
-
| "body-lg-bold"
|
|
17
|
-
| "body-lg-medium"
|
|
18
|
-
| "body-lg-regular"
|
|
19
|
-
| "body-md-bold"
|
|
20
|
-
| "body-md-medium"
|
|
21
|
-
| "body-md-regular"
|
|
22
|
-
| "body-sm-medium"
|
|
23
|
-
| "body-sm-regular"
|
|
24
|
-
| "body-xs-medium"
|
|
25
|
-
| "body-xs-regular"
|
|
26
|
-
// Labels (use primary font: Inter)
|
|
27
|
-
| "label-lg-medium"
|
|
28
|
-
| "label-lg-regular"
|
|
29
|
-
| "label-md-medium"
|
|
30
|
-
| "label-md-regular"
|
|
31
|
-
// Links (use primary font: Inter, with underline)
|
|
32
|
-
| "link-md-medium"
|
|
33
|
-
| "link-md-regular"
|
|
34
|
-
| "link-sm-medium"
|
|
35
|
-
| "link-sm-regular";
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* Text alignment options matching Figma variants
|
|
39
|
-
*/
|
|
40
|
-
export type CoreTextAlign = "left" | "center" | "right";
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* CoreText component props
|
|
44
|
-
*/
|
|
45
|
-
export interface CoreTextProps {
|
|
46
|
-
/** Text content to render */
|
|
47
|
-
children?: ReactNode;
|
|
48
|
-
/** Typography style variant (maps to CSS class from style-tokens.css) */
|
|
49
|
-
style?: CoreTextStyle;
|
|
50
|
-
/** Text alignment */
|
|
51
|
-
align?: CoreTextAlign;
|
|
52
|
-
/** Additional CSS class names */
|
|
53
|
-
className?: string;
|
|
54
|
-
/** Polymorphic element type (default: "p") */
|
|
55
|
-
as?: ElementType;
|
|
56
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import type { DividerProps } from "./Divider.types";
|
|
2
|
-
import "./Divider.css";
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Divider - Divider component for the goo-ds design system
|
|
6
|
-
*
|
|
7
|
-
* Provides consistent visual separator in horizontal or vertical orientation.
|
|
8
|
-
* Token-first per Constitution (no hardcoded values).
|
|
9
|
-
*
|
|
10
|
-
* @example
|
|
11
|
-
* ```tsx
|
|
12
|
-
* <Divider />
|
|
13
|
-
* <Divider orientation="vertical" />
|
|
14
|
-
* ```
|
|
15
|
-
*/
|
|
16
|
-
export function Divider({
|
|
17
|
-
orientation = "horizontal",
|
|
18
|
-
className = "",
|
|
19
|
-
...props
|
|
20
|
-
}: DividerProps) {
|
|
21
|
-
return (
|
|
22
|
-
<div
|
|
23
|
-
className={`gds-divider gds-divider-${orientation} ${className}`.trim()}
|
|
24
|
-
role="separator"
|
|
25
|
-
aria-orientation={orientation}
|
|
26
|
-
data-component="Divider"
|
|
27
|
-
data-orientation={orientation}
|
|
28
|
-
{...props}
|
|
29
|
-
>
|
|
30
|
-
<div className="gds-divider-line" />
|
|
31
|
-
</div>
|
|
32
|
-
);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export default Divider;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Divider component props
|
|
3
|
-
* Provides visual separator using design system tokens
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
export type DividerOrientation = "horizontal" | "vertical";
|
|
7
|
-
|
|
8
|
-
export interface DividerProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
9
|
-
/**
|
|
10
|
-
* Orientation of the divider
|
|
11
|
-
* @default "horizontal"
|
|
12
|
-
*/
|
|
13
|
-
orientation?: DividerOrientation;
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Additional CSS class names
|
|
17
|
-
*/
|
|
18
|
-
className?: string;
|
|
19
|
-
}
|
|
@@ -1,314 +0,0 @@
|
|
|
1
|
-
import type { InputImageProps } from "./InputImage.types";
|
|
2
|
-
import { Button } from "../Button/Button";
|
|
3
|
-
import { CoreText } from "../CoreText/CoreText";
|
|
4
|
-
import "./InputImage.css";
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* InputImage - Image upload input component with drag-and-drop support
|
|
8
|
-
*
|
|
9
|
-
* Provides a file upload interface with multiple visual states including:
|
|
10
|
-
* - Default: Empty state with drag-and-drop zone
|
|
11
|
-
* - Hover: Visual feedback during drag-over
|
|
12
|
-
* - Filled: Shows uploaded image with remove button
|
|
13
|
-
* - Loading: Loading skeleton state
|
|
14
|
-
* - Generating: Blurred preview during processing
|
|
15
|
-
* - Generated: Final result with optional comparison slider
|
|
16
|
-
* - Disabled: Non-interactive state
|
|
17
|
-
*
|
|
18
|
-
* Token-first per Constitution (no hardcoded values).
|
|
19
|
-
*
|
|
20
|
-
* @example
|
|
21
|
-
* ```tsx
|
|
22
|
-
* <InputImage state="Default" onUploadClick={handleUpload} />
|
|
23
|
-
* <InputImage state="Filled" imageSrc="/path/to/image.jpg" onRemoveClick={handleRemove} />
|
|
24
|
-
* <InputImage state="Generated" imageSrc="/path/to/image.jpg" comparisonSlider={true} />
|
|
25
|
-
* ```
|
|
26
|
-
*/
|
|
27
|
-
export function InputImage({
|
|
28
|
-
state = "Default",
|
|
29
|
-
comparisonSlider = true,
|
|
30
|
-
imageSrc,
|
|
31
|
-
imageAlt = "",
|
|
32
|
-
onUploadClick,
|
|
33
|
-
onRemoveClick,
|
|
34
|
-
onDragEnter,
|
|
35
|
-
onDragLeave,
|
|
36
|
-
onDrop,
|
|
37
|
-
className = "",
|
|
38
|
-
children,
|
|
39
|
-
sliderPosition = 50,
|
|
40
|
-
// onSliderDrag not yet implemented
|
|
41
|
-
}: InputImageProps) {
|
|
42
|
-
// Default state
|
|
43
|
-
if (state === "Default") {
|
|
44
|
-
return (
|
|
45
|
-
<div
|
|
46
|
-
className={`gds-input-image gds-input-image-default ${className}`.trim()}
|
|
47
|
-
onDragEnter={onDragEnter}
|
|
48
|
-
onDragLeave={onDragLeave}
|
|
49
|
-
onDrop={onDrop}
|
|
50
|
-
data-component="InputImage"
|
|
51
|
-
data-state={state}
|
|
52
|
-
>
|
|
53
|
-
{children || (
|
|
54
|
-
<>
|
|
55
|
-
<CoreText
|
|
56
|
-
variant="label"
|
|
57
|
-
size="lg"
|
|
58
|
-
weight="medium"
|
|
59
|
-
className="gds-input-image-label"
|
|
60
|
-
>
|
|
61
|
-
Drag and drop
|
|
62
|
-
</CoreText>
|
|
63
|
-
<CoreText
|
|
64
|
-
variant="body"
|
|
65
|
-
size="sm"
|
|
66
|
-
weight="regular"
|
|
67
|
-
className="gds-input-image-separator"
|
|
68
|
-
>
|
|
69
|
-
or
|
|
70
|
-
</CoreText>
|
|
71
|
-
<Button
|
|
72
|
-
variant="primary"
|
|
73
|
-
size="small"
|
|
74
|
-
onClick={onUploadClick}
|
|
75
|
-
className="gds-input-image-button"
|
|
76
|
-
>
|
|
77
|
-
Click to upload
|
|
78
|
-
</Button>
|
|
79
|
-
</>
|
|
80
|
-
)}
|
|
81
|
-
</div>
|
|
82
|
-
);
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
// Hover state
|
|
86
|
-
if (state === "Hover") {
|
|
87
|
-
return (
|
|
88
|
-
<div
|
|
89
|
-
className={`gds-input-image gds-input-image-hover ${className}`.trim()}
|
|
90
|
-
onDragEnter={onDragEnter}
|
|
91
|
-
onDragLeave={onDragLeave}
|
|
92
|
-
onDrop={onDrop}
|
|
93
|
-
data-component="InputImage"
|
|
94
|
-
data-state={state}
|
|
95
|
-
>
|
|
96
|
-
{children || (
|
|
97
|
-
<>
|
|
98
|
-
<CoreText
|
|
99
|
-
variant="label"
|
|
100
|
-
size="lg"
|
|
101
|
-
weight="medium"
|
|
102
|
-
className="gds-input-image-label"
|
|
103
|
-
>
|
|
104
|
-
Drag and drop
|
|
105
|
-
</CoreText>
|
|
106
|
-
<CoreText
|
|
107
|
-
variant="body"
|
|
108
|
-
size="sm"
|
|
109
|
-
weight="regular"
|
|
110
|
-
className="gds-input-image-separator"
|
|
111
|
-
>
|
|
112
|
-
or
|
|
113
|
-
</CoreText>
|
|
114
|
-
<Button
|
|
115
|
-
variant="primary"
|
|
116
|
-
size="small"
|
|
117
|
-
onClick={onUploadClick}
|
|
118
|
-
className="gds-input-image-button"
|
|
119
|
-
>
|
|
120
|
-
Click to upload
|
|
121
|
-
</Button>
|
|
122
|
-
</>
|
|
123
|
-
)}
|
|
124
|
-
</div>
|
|
125
|
-
);
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
// Filled state
|
|
129
|
-
if (state === "Filled") {
|
|
130
|
-
return (
|
|
131
|
-
<div
|
|
132
|
-
className={`gds-input-image gds-input-image-filled ${className}`.trim()}
|
|
133
|
-
data-component="InputImage"
|
|
134
|
-
data-state={state}
|
|
135
|
-
>
|
|
136
|
-
{imageSrc && (
|
|
137
|
-
<img
|
|
138
|
-
src={imageSrc}
|
|
139
|
-
alt={imageAlt}
|
|
140
|
-
className="gds-input-image-preview"
|
|
141
|
-
/>
|
|
142
|
-
)}
|
|
143
|
-
<Button
|
|
144
|
-
variant="primary"
|
|
145
|
-
size="small"
|
|
146
|
-
onClick={onRemoveClick}
|
|
147
|
-
className="gds-input-image-remove-button"
|
|
148
|
-
iconLeft={
|
|
149
|
-
<svg
|
|
150
|
-
width="16"
|
|
151
|
-
height="16"
|
|
152
|
-
viewBox="0 0 16 16"
|
|
153
|
-
fill="none"
|
|
154
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
155
|
-
aria-hidden="true"
|
|
156
|
-
>
|
|
157
|
-
<path
|
|
158
|
-
d="M12 4L4 12M4 4L12 12"
|
|
159
|
-
stroke="currentColor"
|
|
160
|
-
strokeWidth="2"
|
|
161
|
-
strokeLinecap="round"
|
|
162
|
-
strokeLinejoin="round"
|
|
163
|
-
/>
|
|
164
|
-
</svg>
|
|
165
|
-
}
|
|
166
|
-
/>
|
|
167
|
-
</div>
|
|
168
|
-
);
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
// Loading state
|
|
172
|
-
if (state === "Loading") {
|
|
173
|
-
return (
|
|
174
|
-
<div
|
|
175
|
-
className={`gds-input-image gds-input-image-loading ${className}`.trim()}
|
|
176
|
-
data-component="InputImage"
|
|
177
|
-
data-state={state}
|
|
178
|
-
/>
|
|
179
|
-
);
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
// Generating state
|
|
183
|
-
if (state === "Generating") {
|
|
184
|
-
return (
|
|
185
|
-
<div
|
|
186
|
-
className={`gds-input-image gds-input-image-generating ${className}`.trim()}
|
|
187
|
-
data-component="InputImage"
|
|
188
|
-
data-state={state}
|
|
189
|
-
>
|
|
190
|
-
<div className="gds-input-image-blur-container">
|
|
191
|
-
{imageSrc && (
|
|
192
|
-
<img
|
|
193
|
-
src={imageSrc}
|
|
194
|
-
alt={imageAlt}
|
|
195
|
-
className="gds-input-image-blur-preview"
|
|
196
|
-
/>
|
|
197
|
-
)}
|
|
198
|
-
</div>
|
|
199
|
-
</div>
|
|
200
|
-
);
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
// Generated state
|
|
204
|
-
if (state === "Generated") {
|
|
205
|
-
return (
|
|
206
|
-
<div
|
|
207
|
-
className={`gds-input-image gds-input-image-generated ${className}`.trim()}
|
|
208
|
-
data-component="InputImage"
|
|
209
|
-
data-state={state}
|
|
210
|
-
>
|
|
211
|
-
{imageSrc && (
|
|
212
|
-
<img
|
|
213
|
-
src={imageSrc}
|
|
214
|
-
alt={imageAlt}
|
|
215
|
-
className="gds-input-image-result"
|
|
216
|
-
/>
|
|
217
|
-
)}
|
|
218
|
-
{comparisonSlider && (
|
|
219
|
-
<div
|
|
220
|
-
className="gds-input-image-comparison-slider"
|
|
221
|
-
style={{
|
|
222
|
-
left: `${sliderPosition}%`,
|
|
223
|
-
}}
|
|
224
|
-
>
|
|
225
|
-
<div className="gds-input-image-slider-line" />
|
|
226
|
-
<Button
|
|
227
|
-
variant="secondary"
|
|
228
|
-
size="small"
|
|
229
|
-
className="gds-input-image-slider-button"
|
|
230
|
-
iconLeft={
|
|
231
|
-
<svg
|
|
232
|
-
width="16"
|
|
233
|
-
height="16"
|
|
234
|
-
viewBox="0 0 16 16"
|
|
235
|
-
fill="none"
|
|
236
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
237
|
-
aria-hidden="true"
|
|
238
|
-
>
|
|
239
|
-
<path
|
|
240
|
-
d="M6 12L2 8L6 4"
|
|
241
|
-
stroke="currentColor"
|
|
242
|
-
strokeWidth="2"
|
|
243
|
-
strokeLinecap="round"
|
|
244
|
-
strokeLinejoin="round"
|
|
245
|
-
/>
|
|
246
|
-
<path
|
|
247
|
-
d="M10 4L14 8L10 12"
|
|
248
|
-
stroke="currentColor"
|
|
249
|
-
strokeWidth="2"
|
|
250
|
-
strokeLinecap="round"
|
|
251
|
-
strokeLinejoin="round"
|
|
252
|
-
/>
|
|
253
|
-
</svg>
|
|
254
|
-
}
|
|
255
|
-
/>
|
|
256
|
-
</div>
|
|
257
|
-
)}
|
|
258
|
-
</div>
|
|
259
|
-
);
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
// Disabled state
|
|
263
|
-
if (state === "Disabled") {
|
|
264
|
-
return (
|
|
265
|
-
<div
|
|
266
|
-
className={`gds-input-image gds-input-image-disabled ${className}`.trim()}
|
|
267
|
-
data-component="InputImage"
|
|
268
|
-
data-state={state}
|
|
269
|
-
>
|
|
270
|
-
{children || (
|
|
271
|
-
<>
|
|
272
|
-
<CoreText
|
|
273
|
-
variant="label"
|
|
274
|
-
size="lg"
|
|
275
|
-
weight="medium"
|
|
276
|
-
className="gds-input-image-label"
|
|
277
|
-
>
|
|
278
|
-
Drag and drop
|
|
279
|
-
</CoreText>
|
|
280
|
-
<CoreText
|
|
281
|
-
variant="body"
|
|
282
|
-
size="sm"
|
|
283
|
-
weight="regular"
|
|
284
|
-
className="gds-input-image-separator"
|
|
285
|
-
>
|
|
286
|
-
or
|
|
287
|
-
</CoreText>
|
|
288
|
-
<Button
|
|
289
|
-
variant="primary"
|
|
290
|
-
size="small"
|
|
291
|
-
disabled
|
|
292
|
-
className="gds-input-image-button"
|
|
293
|
-
>
|
|
294
|
-
Click to upload
|
|
295
|
-
</Button>
|
|
296
|
-
</>
|
|
297
|
-
)}
|
|
298
|
-
</div>
|
|
299
|
-
);
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
// Fallback to default
|
|
303
|
-
return (
|
|
304
|
-
<div
|
|
305
|
-
className={`gds-input-image gds-input-image-default ${className}`.trim()}
|
|
306
|
-
data-component="InputImage"
|
|
307
|
-
data-state="Default"
|
|
308
|
-
>
|
|
309
|
-
{children}
|
|
310
|
-
</div>
|
|
311
|
-
);
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
export default InputImage;
|