glchat-a2ui-react-renderer 0.2.6 → 0.2.8
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/README.md +251 -124
- package/dist/index.d.ts +10 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +13 -5
- package/dist/src/Provider.d.ts +21 -14
- package/dist/src/Provider.d.ts.map +1 -1
- package/dist/src/Provider.js +56 -42
- package/dist/src/SurfaceRenderer.d.ts +17 -0
- package/dist/src/SurfaceRenderer.d.ts.map +1 -0
- package/dist/src/SurfaceRenderer.js +28 -0
- package/dist/src/components/a2ui/Button/Button.d.ts +313 -3
- package/dist/src/components/a2ui/Button/Button.d.ts.map +1 -1
- package/dist/src/components/a2ui/Button/Button.js +31 -24
- package/dist/src/components/a2ui/{MultipleChoice → ChoicePicker}/CheckboxList.d.ts +1 -2
- package/dist/src/components/a2ui/ChoicePicker/CheckboxList.d.ts.map +1 -0
- package/dist/src/components/a2ui/ChoicePicker/CheckboxList.js +34 -0
- package/dist/src/components/a2ui/ChoicePicker/ChoicePicker.d.ts +9 -0
- package/dist/src/components/a2ui/ChoicePicker/ChoicePicker.d.ts.map +1 -0
- package/dist/src/components/a2ui/ChoicePicker/ChoicePicker.js +54 -0
- package/dist/src/components/a2ui/ChoicePicker/theme.d.ts +10 -0
- package/dist/src/components/a2ui/ChoicePicker/theme.d.ts.map +1 -0
- package/dist/src/components/a2ui/{MultipleChoice → ChoicePicker}/theme.js +15 -12
- package/dist/src/components/a2ui/TagInput/TagInput.d.ts +290 -0
- package/dist/src/components/a2ui/TagInput/TagInput.d.ts.map +1 -0
- package/dist/src/components/a2ui/TagInput/TagInput.js +110 -0
- package/dist/src/components/a2ui/TagInput/theme.d.ts +13 -0
- package/dist/src/components/a2ui/TagInput/theme.d.ts.map +1 -0
- package/dist/src/components/a2ui/TagInput/theme.js +74 -0
- package/dist/src/components/a2ui/Timeout/Timeout.d.ts +154 -3
- package/dist/src/components/a2ui/Timeout/Timeout.d.ts.map +1 -1
- package/dist/src/components/a2ui/Timeout/Timeout.js +40 -25
- package/dist/src/components/a2ui/common.d.ts +87 -0
- package/dist/src/components/a2ui/common.d.ts.map +1 -0
- package/dist/src/components/a2ui/common.js +23 -0
- package/dist/src/components/ui/Button/Button.d.ts +15 -0
- package/dist/src/components/ui/Button/Button.d.ts.map +1 -0
- package/dist/src/components/ui/Button/Button.js +16 -0
- package/dist/src/components/ui/Button/theme.d.ts +5 -0
- package/dist/src/components/ui/Button/theme.d.ts.map +1 -0
- package/dist/src/components/{a2ui → ui}/Button/theme.js +13 -10
- package/dist/src/components/ui/Checkbox/Checkbox.js +2 -2
- package/dist/src/components/ui/Checkbox/theme.d.ts +3 -3
- package/dist/src/components/ui/Checkbox/theme.d.ts.map +1 -1
- package/dist/src/components/ui/Checkbox/theme.js +3 -3
- package/dist/src/components/ui/MultiSelect/MultiSelect.d.ts +1 -1
- package/dist/src/components/ui/MultiSelect/MultiSelect.d.ts.map +1 -1
- package/dist/src/components/ui/MultiSelect/MultiSelect.js +12 -12
- package/dist/src/components/ui/MultiSelect/theme.d.ts +12 -12
- package/dist/src/components/ui/MultiSelect/theme.d.ts.map +1 -1
- package/dist/src/components/ui/MultiSelect/theme.js +13 -13
- package/dist/src/components/ui/Select/Select.js +8 -8
- package/dist/src/components/ui/Select/theme.d.ts +8 -8
- package/dist/src/components/ui/Select/theme.d.ts.map +1 -1
- package/dist/src/components/ui/Select/theme.js +8 -9
- package/dist/src/utils/catalog.d.ts +16 -4
- package/dist/src/utils/catalog.d.ts.map +1 -1
- package/dist/src/utils/catalog.js +32 -27
- package/dist/src/utils/useSurfaces.d.ts +9 -0
- package/dist/src/utils/useSurfaces.d.ts.map +1 -0
- package/dist/src/utils/useSurfaces.js +28 -0
- package/json/README.md +61 -0
- package/json/a2ui-sample-messages.json +193 -0
- package/json/glchat_standard_catalog_definition.json +1470 -0
- package/package.json +15 -6
- package/styles/globals.css +232 -38
- package/dist/src/AllSurfacesRenderer.d.ts +0 -14
- package/dist/src/AllSurfacesRenderer.d.ts.map +0 -1
- package/dist/src/AllSurfacesRenderer.js +0 -18
- package/dist/src/SingleSurfaceRenderer.d.ts +0 -15
- package/dist/src/SingleSurfaceRenderer.d.ts.map +0 -1
- package/dist/src/SingleSurfaceRenderer.js +0 -9
- package/dist/src/components/a2ui/Button/theme.d.ts +0 -14
- package/dist/src/components/a2ui/Button/theme.d.ts.map +0 -1
- package/dist/src/components/a2ui/Card/Card.d.ts +0 -4
- package/dist/src/components/a2ui/Card/Card.d.ts.map +0 -1
- package/dist/src/components/a2ui/Card/Card.js +0 -16
- package/dist/src/components/a2ui/Card/theme.d.ts +0 -10
- package/dist/src/components/a2ui/Card/theme.d.ts.map +0 -1
- package/dist/src/components/a2ui/Card/theme.js +0 -21
- package/dist/src/components/a2ui/CheckBox/CheckBox.d.ts +0 -4
- package/dist/src/components/a2ui/CheckBox/CheckBox.d.ts.map +0 -1
- package/dist/src/components/a2ui/CheckBox/CheckBox.js +0 -26
- package/dist/src/components/a2ui/CheckBox/theme.d.ts +0 -11
- package/dist/src/components/a2ui/CheckBox/theme.d.ts.map +0 -1
- package/dist/src/components/a2ui/CheckBox/theme.js +0 -17
- package/dist/src/components/a2ui/DateTimeInput/theme.d.ts +0 -8
- package/dist/src/components/a2ui/DateTimeInput/theme.d.ts.map +0 -1
- package/dist/src/components/a2ui/DateTimeInput/theme.js +0 -11
- package/dist/src/components/a2ui/MultipleChoice/CheckboxList.d.ts.map +0 -1
- package/dist/src/components/a2ui/MultipleChoice/CheckboxList.js +0 -45
- package/dist/src/components/a2ui/MultipleChoice/MultipleChoice.d.ts +0 -4
- package/dist/src/components/a2ui/MultipleChoice/MultipleChoice.d.ts.map +0 -1
- package/dist/src/components/a2ui/MultipleChoice/MultipleChoice.js +0 -72
- package/dist/src/components/a2ui/MultipleChoice/theme.d.ts +0 -13
- package/dist/src/components/a2ui/MultipleChoice/theme.d.ts.map +0 -1
- package/dist/src/components/a2ui/TextField/TextField.d.ts +0 -4
- package/dist/src/components/a2ui/TextField/TextField.d.ts.map +0 -1
- package/dist/src/components/a2ui/TextField/TextField.js +0 -54
- package/dist/src/components/a2ui/TextField/theme.d.ts +0 -28
- package/dist/src/components/a2ui/TextField/theme.d.ts.map +0 -1
- package/dist/src/components/a2ui/TextField/theme.js +0 -82
- package/dist/src/components/a2ui/Timeout/theme.d.ts +0 -8
- package/dist/src/components/a2ui/Timeout/theme.d.ts.map +0 -1
- package/dist/src/components/a2ui/Timeout/theme.js +0 -12
- package/dist/src/utils/theme.d.ts +0 -4
- package/dist/src/utils/theme.d.ts.map +0 -1
- package/dist/src/utils/theme.js +0 -92
- package/patches/@a2ui+web_core+0.10.0.patch +0 -55
|
@@ -1,30 +1,45 @@
|
|
|
1
|
+
'use client';
|
|
1
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { createComponentImplementation } from '@a2ui/react/v0_9';
|
|
4
|
+
import { DynamicStringSchema } from '@a2ui/web_core/v0_9';
|
|
5
|
+
import { useEffect, useState } from 'react';
|
|
6
|
+
import { z } from 'zod';
|
|
5
7
|
import { formatAsHhMmSs, getRemainingSeconds } from '../../../utils/time.js';
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
8
|
+
import { CommonProps, describeDynamic, getWeightStyle } from '../common.js';
|
|
9
|
+
/**
|
|
10
|
+
* Countdown to a target UTC time (GLChat extension). Displays the remaining
|
|
11
|
+
* time as HH:MM:SS, updating every second.
|
|
12
|
+
*/
|
|
13
|
+
export const TimeoutApi = {
|
|
14
|
+
name: 'Timeout',
|
|
15
|
+
schema: z
|
|
16
|
+
.object({
|
|
17
|
+
...CommonProps,
|
|
18
|
+
targetTimeUtc: describeDynamic(DynamicStringSchema, 'DynamicString', 'The target time as a UTC ISO 8601 string to count down to.'),
|
|
19
|
+
variant: z
|
|
20
|
+
.enum(['body', 'caption', 'h3', 'h4', 'h5'])
|
|
21
|
+
.describe('A hint for the base text style.')
|
|
22
|
+
.optional(),
|
|
23
|
+
})
|
|
24
|
+
.strict()
|
|
25
|
+
.describe('A countdown timer to a target UTC time.'),
|
|
26
|
+
};
|
|
27
|
+
const textStyle = {
|
|
28
|
+
color: `hsl(var(--foreground) / 0.5)`,
|
|
29
|
+
fontSize: '0.875rem',
|
|
30
|
+
lineHeight: '1.25rem',
|
|
31
|
+
};
|
|
32
|
+
export const GlchatTimeoutComponent = createComponentImplementation(TimeoutApi, ({ props }) => {
|
|
33
|
+
const targetTimeUtc = typeof props.targetTimeUtc === 'string' ? props.targetTimeUtc : '';
|
|
34
|
+
const [remaining, setRemaining] = useState(() => getRemainingSeconds(targetTimeUtc));
|
|
16
35
|
useEffect(() => {
|
|
17
|
-
setRemaining(getRemainingSeconds(
|
|
18
|
-
|
|
19
|
-
useEffect(() => {
|
|
20
|
-
if (!resolvedTargetTimeUtcString)
|
|
36
|
+
setRemaining(getRemainingSeconds(targetTimeUtc));
|
|
37
|
+
if (!targetTimeUtc)
|
|
21
38
|
return;
|
|
22
|
-
const
|
|
23
|
-
setRemaining(getRemainingSeconds(
|
|
39
|
+
const timer = setInterval(() => {
|
|
40
|
+
setRemaining(getRemainingSeconds(targetTimeUtc));
|
|
24
41
|
}, 1000);
|
|
25
|
-
return () => clearInterval(
|
|
26
|
-
}, [
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
return (_jsx("div", { className: "a2ui-text", style: hostStyle, children: _jsx("section", { className: classMapToString(theme.components.Text.all), style: textStyle, children: _jsx("p", { children: formatAsHhMmSs(remaining) }) }) }));
|
|
30
|
-
}
|
|
42
|
+
return () => clearInterval(timer);
|
|
43
|
+
}, [targetTimeUtc]);
|
|
44
|
+
return (_jsx("div", { className: "a2ui-text a2ui-timeout", style: getWeightStyle(props.weight), children: _jsx("p", { style: textStyle, children: formatAsHhMmSs(remaining) }) }));
|
|
45
|
+
});
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import type { CSSProperties } from 'react';
|
|
2
|
+
import { z, type ZodTypeAny } from 'zod';
|
|
3
|
+
/**
|
|
4
|
+
* Catalog-level common properties shared by every component, mirroring the
|
|
5
|
+
* `CommonProps` used by the A2UI v0.9 basic catalog (`accessibility`, `weight`).
|
|
6
|
+
*/
|
|
7
|
+
export declare const CommonProps: {
|
|
8
|
+
accessibility: z.ZodOptional<z.ZodObject<{
|
|
9
|
+
label: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodObject<{
|
|
10
|
+
path: z.ZodString;
|
|
11
|
+
}, "strip", z.ZodTypeAny, {
|
|
12
|
+
path: string;
|
|
13
|
+
}, {
|
|
14
|
+
path: string;
|
|
15
|
+
}>, z.ZodObject<{
|
|
16
|
+
call: z.ZodString;
|
|
17
|
+
args: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
18
|
+
returnType: z.ZodDefault<z.ZodEnum<["string", "number", "boolean", "array", "object", "any", "void"]>>;
|
|
19
|
+
}, "strip", z.ZodTypeAny, {
|
|
20
|
+
call: string;
|
|
21
|
+
args: Record<string, any>;
|
|
22
|
+
returnType: "string" | "number" | "boolean" | "object" | "array" | "void" | "any";
|
|
23
|
+
}, {
|
|
24
|
+
call: string;
|
|
25
|
+
args: Record<string, any>;
|
|
26
|
+
returnType?: "string" | "number" | "boolean" | "object" | "array" | "void" | "any" | undefined;
|
|
27
|
+
}>]>>;
|
|
28
|
+
description: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodObject<{
|
|
29
|
+
path: z.ZodString;
|
|
30
|
+
}, "strip", z.ZodTypeAny, {
|
|
31
|
+
path: string;
|
|
32
|
+
}, {
|
|
33
|
+
path: string;
|
|
34
|
+
}>, z.ZodObject<{
|
|
35
|
+
call: z.ZodString;
|
|
36
|
+
args: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
37
|
+
returnType: z.ZodDefault<z.ZodEnum<["string", "number", "boolean", "array", "object", "any", "void"]>>;
|
|
38
|
+
}, "strip", z.ZodTypeAny, {
|
|
39
|
+
call: string;
|
|
40
|
+
args: Record<string, any>;
|
|
41
|
+
returnType: "string" | "number" | "boolean" | "object" | "array" | "void" | "any";
|
|
42
|
+
}, {
|
|
43
|
+
call: string;
|
|
44
|
+
args: Record<string, any>;
|
|
45
|
+
returnType?: "string" | "number" | "boolean" | "object" | "array" | "void" | "any" | undefined;
|
|
46
|
+
}>]>>;
|
|
47
|
+
}, "strip", z.ZodTypeAny, {
|
|
48
|
+
description?: string | {
|
|
49
|
+
path: string;
|
|
50
|
+
} | {
|
|
51
|
+
call: string;
|
|
52
|
+
args: Record<string, any>;
|
|
53
|
+
returnType: "string" | "number" | "boolean" | "object" | "array" | "void" | "any";
|
|
54
|
+
} | undefined;
|
|
55
|
+
label?: string | {
|
|
56
|
+
path: string;
|
|
57
|
+
} | {
|
|
58
|
+
call: string;
|
|
59
|
+
args: Record<string, any>;
|
|
60
|
+
returnType: "string" | "number" | "boolean" | "object" | "array" | "void" | "any";
|
|
61
|
+
} | undefined;
|
|
62
|
+
}, {
|
|
63
|
+
description?: string | {
|
|
64
|
+
path: string;
|
|
65
|
+
} | {
|
|
66
|
+
call: string;
|
|
67
|
+
args: Record<string, any>;
|
|
68
|
+
returnType?: "string" | "number" | "boolean" | "object" | "array" | "void" | "any" | undefined;
|
|
69
|
+
} | undefined;
|
|
70
|
+
label?: string | {
|
|
71
|
+
path: string;
|
|
72
|
+
} | {
|
|
73
|
+
call: string;
|
|
74
|
+
args: Record<string, any>;
|
|
75
|
+
returnType?: "string" | "number" | "boolean" | "object" | "array" | "void" | "any" | undefined;
|
|
76
|
+
} | undefined;
|
|
77
|
+
}>>;
|
|
78
|
+
weight: z.ZodOptional<z.ZodNumber>;
|
|
79
|
+
};
|
|
80
|
+
/**
|
|
81
|
+
* Maps the A2UI `weight` property to a flex style, matching the basic catalog.
|
|
82
|
+
* Only meaningful when the component is a direct child of a Row/Column.
|
|
83
|
+
*/
|
|
84
|
+
export declare function getWeightStyle(weight: number | undefined): CSSProperties | undefined;
|
|
85
|
+
/** Preserves A2UI `REF:` tags when adding a field description for catalog JSON generation. */
|
|
86
|
+
export declare function describeDynamic<T extends ZodTypeAny>(schema: T, def: string, description: string): T;
|
|
87
|
+
//# sourceMappingURL=common.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../../src/components/a2ui/common.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,EAAE,CAAC,EAAE,KAAK,UAAU,EAAE,MAAM,KAAK,CAAC;AAEzC;;;GAGG;AACH,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;sBAsBylZ,CAAC;;;;;;;;;;;;;;;;;;;sBAAivB,CAAC;;;;;;;;;;;;;;;;;;;;;;;sBAA2sB,CAAC;;;;;;;sBAA0O,CAAC;;;;CAnB1xc,CAAC;AAEF;;;GAGG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,aAAa,GAAG,SAAS,CAGpF;AAED,8FAA8F;AAC9F,wBAAgB,eAAe,CAAC,CAAC,SAAS,UAAU,EAClD,MAAM,EAAE,CAAC,EACT,GAAG,EAAE,MAAM,EACX,WAAW,EAAE,MAAM,GAClB,CAAC,CAEH"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { AccessibilityAttributesSchema } from '@a2ui/web_core/v0_9';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
/**
|
|
4
|
+
* Catalog-level common properties shared by every component, mirroring the
|
|
5
|
+
* `CommonProps` used by the A2UI v0.9 basic catalog (`accessibility`, `weight`).
|
|
6
|
+
*/
|
|
7
|
+
export const CommonProps = {
|
|
8
|
+
accessibility: AccessibilityAttributesSchema.optional(),
|
|
9
|
+
weight: z.number().optional(),
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Maps the A2UI `weight` property to a flex style, matching the basic catalog.
|
|
13
|
+
* Only meaningful when the component is a direct child of a Row/Column.
|
|
14
|
+
*/
|
|
15
|
+
export function getWeightStyle(weight) {
|
|
16
|
+
if (typeof weight !== 'number')
|
|
17
|
+
return undefined;
|
|
18
|
+
return { flex: `${weight}`, minWidth: 0, minHeight: 0 };
|
|
19
|
+
}
|
|
20
|
+
/** Preserves A2UI `REF:` tags when adding a field description for catalog JSON generation. */
|
|
21
|
+
export function describeDynamic(schema, def, description) {
|
|
22
|
+
return schema.describe(`REF:common_types.json#/$defs/${def}|${description}`);
|
|
23
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ButtonHTMLAttributes, CSSProperties, ReactNode } from 'react';
|
|
2
|
+
import { type ButtonVariant } from './theme.js';
|
|
3
|
+
export type ButtonProps = {
|
|
4
|
+
variant?: ButtonVariant;
|
|
5
|
+
className?: string;
|
|
6
|
+
style?: CSSProperties;
|
|
7
|
+
children?: ReactNode;
|
|
8
|
+
} & Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'style'>;
|
|
9
|
+
export declare const Button: import("react").ForwardRefExoticComponent<{
|
|
10
|
+
variant?: ButtonVariant;
|
|
11
|
+
className?: string;
|
|
12
|
+
style?: CSSProperties;
|
|
13
|
+
children?: ReactNode;
|
|
14
|
+
} & Omit<ButtonHTMLAttributes<HTMLButtonElement>, "style"> & import("react").RefAttributes<HTMLButtonElement>>;
|
|
15
|
+
//# sourceMappingURL=Button.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../../../../src/components/ui/Button/Button.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,oBAAoB,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAE5E,OAAO,EAGL,KAAK,aAAa,EACnB,MAAM,YAAY,CAAC;AAEpB,MAAM,MAAM,WAAW,GAAG;IACxB,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB,GAAG,IAAI,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,EAAE,OAAO,CAAC,CAAC;AAa3D,eAAO,MAAM,MAAM;cAjBP,aAAa;gBACX,MAAM;YACV,aAAa;eACV,SAAS;8GA+BpB,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { forwardRef } from 'react';
|
|
4
|
+
import { buttonBaseStyles, getButtonVariantStyles, } from './theme.js';
|
|
5
|
+
function mergeStyles(variant, style) {
|
|
6
|
+
return {
|
|
7
|
+
...buttonBaseStyles,
|
|
8
|
+
...getButtonVariantStyles(variant),
|
|
9
|
+
...style,
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
export const Button = forwardRef(function Button({ variant = 'outline', className, style, children, type = 'button', ...props }, ref) {
|
|
13
|
+
const buttonClassName = ['glchat-a2ui-button', className].filter(Boolean).join(' ');
|
|
14
|
+
return (_jsx("button", { ref: ref, type: type, className: buttonClassName, style: mergeStyles(variant, style), ...props, children: children }));
|
|
15
|
+
});
|
|
16
|
+
Button.displayName = 'Button';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { CSSProperties } from 'react';
|
|
2
|
+
export type ButtonVariant = 'primary' | 'destructive' | 'outline' | 'borderless';
|
|
3
|
+
export declare const buttonBaseStyles: CSSProperties;
|
|
4
|
+
export declare function getButtonVariantStyles(variant: ButtonVariant): CSSProperties;
|
|
5
|
+
//# sourceMappingURL=theme.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../../../../src/components/ui/Button/theme.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAE3C,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,aAAa,GAAG,SAAS,GAAG,YAAY,CAAC;AAEjF,eAAO,MAAM,gBAAgB,EAAE,aAiBb,CAAC;AAEnB,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,aAAa,GAAG,aAAa,CAsD5E"}
|
|
@@ -1,12 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
* Button structural class map.
|
|
3
|
-
*/
|
|
4
|
-
export const glchatButtonComponents = {};
|
|
5
|
-
/**
|
|
6
|
-
* Button inline styles aligned with package CSS tokens.
|
|
7
|
-
* Variant colors are layered in runtime via `getGlchatButtonVariantStyles`.
|
|
8
|
-
*/
|
|
9
|
-
export const glchatButtonAdditionalStyles = {
|
|
1
|
+
export const buttonBaseStyles = {
|
|
10
2
|
display: 'inline-flex',
|
|
11
3
|
alignItems: 'center',
|
|
12
4
|
justifyContent: 'center',
|
|
@@ -24,7 +16,7 @@ export const glchatButtonAdditionalStyles = {
|
|
|
24
16
|
transitionDuration: '150ms',
|
|
25
17
|
'--glchat-button-ring-color': 'hsl(var(--ring))',
|
|
26
18
|
};
|
|
27
|
-
export function
|
|
19
|
+
export function getButtonVariantStyles(variant) {
|
|
28
20
|
if (variant === 'primary') {
|
|
29
21
|
return {
|
|
30
22
|
backgroundColor: 'hsl(var(--primary))',
|
|
@@ -47,6 +39,17 @@ export function getGlchatButtonVariantStyles(variant) {
|
|
|
47
39
|
'--glchat-button-border-active': 'hsl(var(--destructive))',
|
|
48
40
|
};
|
|
49
41
|
}
|
|
42
|
+
if (variant === 'borderless') {
|
|
43
|
+
return {
|
|
44
|
+
backgroundColor: 'transparent',
|
|
45
|
+
borderColor: 'transparent',
|
|
46
|
+
color: 'hsl(var(--foreground))',
|
|
47
|
+
'--glchat-button-bg-hover': 'linear-gradient(hsla(var(--hover)), hsla(var(--hover))), transparent',
|
|
48
|
+
'--glchat-button-border-hover': 'transparent',
|
|
49
|
+
'--glchat-button-bg-active': 'linear-gradient(hsla(var(--hover)), hsla(var(--hover))), transparent',
|
|
50
|
+
'--glchat-button-border-active': 'transparent',
|
|
51
|
+
};
|
|
52
|
+
}
|
|
50
53
|
return {
|
|
51
54
|
backgroundColor: 'hsl(var(--background))',
|
|
52
55
|
borderColor: 'hsl(var(--border))',
|
|
@@ -3,7 +3,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
3
3
|
import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
|
|
4
4
|
import { Check } from 'lucide-react';
|
|
5
5
|
import * as React from 'react';
|
|
6
|
-
import {
|
|
7
|
-
const Checkbox = React.forwardRef(({ className, style, ...props }, ref) => (_jsx(CheckboxPrimitive.Root, { ref: ref, className: ['glchat-a2ui-checkbox', className].filter(Boolean).join(' '), style: { ...
|
|
6
|
+
import { checkboxIndicatorStyles, checkboxRootStyles, } from './theme.js';
|
|
7
|
+
const Checkbox = React.forwardRef(({ className, style, ...props }, ref) => (_jsx(CheckboxPrimitive.Root, { ref: ref, className: ['glchat-a2ui-checkbox', className].filter(Boolean).join(' '), style: { ...checkboxRootStyles, ...style }, ...props, children: _jsx(CheckboxPrimitive.Indicator, { style: checkboxIndicatorStyles, children: _jsx(Check, { style: { height: '1rem', width: '1rem' }, strokeWidth: 1.5, "aria-hidden": true }) }) })));
|
|
8
8
|
Checkbox.displayName = CheckboxPrimitive.Root.displayName;
|
|
9
9
|
export { Checkbox };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { CSSProperties } from 'react';
|
|
2
|
-
export declare const
|
|
3
|
-
export declare const
|
|
4
|
-
export declare const
|
|
2
|
+
export declare const checkboxRootStyles: CSSProperties;
|
|
3
|
+
export declare const checkboxIndicatorStyles: CSSProperties;
|
|
4
|
+
export declare const checkboxLabelStyles: CSSProperties;
|
|
5
5
|
//# sourceMappingURL=theme.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../../../../src/components/ui/Checkbox/theme.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAE3C,eAAO,MAAM,
|
|
1
|
+
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../../../../src/components/ui/Checkbox/theme.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAE3C,eAAO,MAAM,kBAAkB,EAAE,aAchC,CAAC;AAEF,eAAO,MAAM,uBAAuB,EAAE,aAKrC,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAE,aAIjC,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export const
|
|
1
|
+
export const checkboxRootStyles = {
|
|
2
2
|
height: '1rem',
|
|
3
3
|
width: '1rem',
|
|
4
4
|
flexShrink: 0,
|
|
@@ -13,13 +13,13 @@ export const glchatCheckboxRootStyles = {
|
|
|
13
13
|
cursor: 'pointer',
|
|
14
14
|
boxSizing: 'border-box',
|
|
15
15
|
};
|
|
16
|
-
export const
|
|
16
|
+
export const checkboxIndicatorStyles = {
|
|
17
17
|
display: 'flex',
|
|
18
18
|
alignItems: 'center',
|
|
19
19
|
justifyContent: 'center',
|
|
20
20
|
color: 'hsl(var(--primary-foreground))',
|
|
21
21
|
};
|
|
22
|
-
export const
|
|
22
|
+
export const checkboxLabelStyles = {
|
|
23
23
|
fontSize: '0.875rem',
|
|
24
24
|
color: 'hsl(var(--foreground))',
|
|
25
25
|
lineHeight: '1.25rem',
|
|
@@ -11,5 +11,5 @@ export type MultiSelectProps = {
|
|
|
11
11
|
className?: string;
|
|
12
12
|
style?: CSSProperties;
|
|
13
13
|
};
|
|
14
|
-
export declare function MultiSelect({ options, value, onValueChange, placeholder, disabled, filterable, maxSelections, className, style, }: Readonly<MultiSelectProps>): import("react
|
|
14
|
+
export declare function MultiSelect({ options, value, onValueChange, placeholder, disabled, filterable, maxSelections, className, style, }: Readonly<MultiSelectProps>): import("react").JSX.Element;
|
|
15
15
|
//# sourceMappingURL=MultiSelect.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MultiSelect.d.ts","sourceRoot":"","sources":["../../../../../src/components/ui/MultiSelect/MultiSelect.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAM3C,OAAO,EAaL,KAAK,iBAAiB,EACvB,MAAM,YAAY,CAAC;AAEpB,MAAM,MAAM,gBAAgB,GAAG;IAC7B,OAAO,EAAE,iBAAiB,EAAE,CAAC;IAC7B,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;IACzC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,aAAa,CAAC;CACvB,CAAC;AAMF,wBAAgB,WAAW,CAAC,EAC1B,OAAO,EACP,KAAK,EACL,aAAa,EACb,WAA8B,EAC9B,QAAgB,EAChB,UAAkB,EAClB,aAAa,EACb,SAAS,EACT,KAAK,GACN,EAAE,QAAQ,CAAC,gBAAgB,CAAC
|
|
1
|
+
{"version":3,"file":"MultiSelect.d.ts","sourceRoot":"","sources":["../../../../../src/components/ui/MultiSelect/MultiSelect.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAM3C,OAAO,EAaL,KAAK,iBAAiB,EACvB,MAAM,YAAY,CAAC;AAEpB,MAAM,MAAM,gBAAgB,GAAG;IAC7B,OAAO,EAAE,iBAAiB,EAAE,CAAC;IAC7B,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;IACzC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,aAAa,CAAC;CACvB,CAAC;AAMF,wBAAgB,WAAW,CAAC,EAC1B,OAAO,EACP,KAAK,EACL,aAAa,EACb,WAA8B,EAC9B,QAAgB,EAChB,UAAkB,EAClB,aAAa,EACb,SAAS,EACT,KAAK,GACN,EAAE,QAAQ,CAAC,gBAAgB,CAAC,+BAyS5B"}
|
|
@@ -6,7 +6,7 @@ import { useCallback, useMemo, useState } from 'react';
|
|
|
6
6
|
const optionHoverStyle = {
|
|
7
7
|
backgroundColor: 'hsl(var(--foreground) / 0.1)',
|
|
8
8
|
};
|
|
9
|
-
import {
|
|
9
|
+
import { multiSelectBadgeStyles, multiSelectCheckboxCheckedStyles, multiSelectCheckboxStyles, multiSelectContentStyles, multiSelectFooterButtonStyles, multiSelectFooterStyles, multiSelectListStyles, multiSelectOptionStyles, multiSelectPlaceholderStyles, multiSelectSearchInputStyles, multiSelectSeparatorStyles, multiSelectTriggerStyles, } from './theme.js';
|
|
10
10
|
function mergeStyles(base, override) {
|
|
11
11
|
return override ? { ...base, ...override } : base;
|
|
12
12
|
}
|
|
@@ -55,7 +55,7 @@ export function MultiSelect({ options, value, onValueChange, placeholder = 'Sele
|
|
|
55
55
|
setOpen(next);
|
|
56
56
|
if (!next)
|
|
57
57
|
setSearch('');
|
|
58
|
-
}, children: [_jsx(PopoverPrimitive.Trigger, { type: "button", disabled: disabled, className: triggerClassName, style: mergeStyles(
|
|
58
|
+
}, children: [_jsx(PopoverPrimitive.Trigger, { type: "button", disabled: disabled, className: triggerClassName, style: mergeStyles(multiSelectTriggerStyles, style), children: value.length > 0 ? (_jsxs("div", { style: {
|
|
59
59
|
display: 'flex',
|
|
60
60
|
minHeight: 0,
|
|
61
61
|
width: '100%',
|
|
@@ -75,7 +75,7 @@ export function MultiSelect({ options, value, onValueChange, placeholder = 'Sele
|
|
|
75
75
|
overflowX: 'hidden',
|
|
76
76
|
}, children: value.map((selectedValue) => {
|
|
77
77
|
const option = options.find((o) => o.value === selectedValue);
|
|
78
|
-
return (_jsxs("div", { style:
|
|
78
|
+
return (_jsxs("div", { style: multiSelectBadgeStyles, children: [_jsx("span", { style: {
|
|
79
79
|
overflow: 'hidden',
|
|
80
80
|
textOverflow: 'ellipsis',
|
|
81
81
|
whiteSpace: 'nowrap',
|
|
@@ -100,17 +100,17 @@ export function MultiSelect({ options, value, onValueChange, placeholder = 'Sele
|
|
|
100
100
|
event.stopPropagation();
|
|
101
101
|
if (!disabled)
|
|
102
102
|
handleClear();
|
|
103
|
-
}, "aria-hidden": true }), _jsx("div", { style:
|
|
103
|
+
}, "aria-hidden": true }), _jsx("div", { style: multiSelectSeparatorStyles }), _jsx(ChevronDown, { style: { height: '1rem', width: '1rem', flexShrink: 0, opacity: 0.5 }, strokeWidth: 1.5, "aria-hidden": true })] })] })) : (_jsxs("div", { style: {
|
|
104
104
|
display: 'flex',
|
|
105
105
|
width: '100%',
|
|
106
106
|
alignItems: 'center',
|
|
107
107
|
justifyContent: 'space-between',
|
|
108
|
-
}, children: [_jsx("span", { style:
|
|
109
|
-
...
|
|
108
|
+
}, children: [_jsx("span", { style: multiSelectPlaceholderStyles, children: placeholder }), _jsx(ChevronDown, { style: { height: '1rem', width: '1rem', opacity: 0.5 }, strokeWidth: 1.5, "aria-hidden": true })] })) }), _jsx(PopoverPrimitive.Portal, { children: _jsxs(PopoverPrimitive.Content, { align: "start", sideOffset: 4, className: "glchat-a2ui-multiselect-content", style: multiSelectContentStyles, onEscapeKeyDown: () => setOpen(false), children: [filterable && (_jsx("input", { type: "text", value: search, onChange: (e) => setSearch(e.target.value), placeholder: "Search...", style: multiSelectSearchInputStyles })), _jsxs("div", { style: multiSelectListStyles, children: [options.length > 0 && (_jsxs("button", { type: "button", className: "glchat-a2ui-multiselect-option", style: {
|
|
109
|
+
...multiSelectOptionStyles,
|
|
110
110
|
...(hoveredOption === '__all__' ? optionHoverStyle : {}),
|
|
111
111
|
}, onMouseEnter: () => setHoveredOption('__all__'), onMouseLeave: () => setHoveredOption(null), onClick: toggleAll, children: [_jsx("span", { style: isAllSelected
|
|
112
|
-
?
|
|
113
|
-
:
|
|
112
|
+
? multiSelectCheckboxCheckedStyles
|
|
113
|
+
: multiSelectCheckboxStyles, children: isAllSelected && (_jsx(Check, { style: { height: '1rem', width: '1rem' }, strokeWidth: 1.5 })) }), _jsx("span", { children: "Select all" })] })), filteredOptions.length === 0 ? (_jsx("div", { style: {
|
|
114
114
|
padding: '0.5rem 0.75rem',
|
|
115
115
|
fontSize: '0.875rem',
|
|
116
116
|
color: 'hsl(var(--foreground) / 0.5)',
|
|
@@ -120,18 +120,18 @@ export function MultiSelect({ options, value, onValueChange, placeholder = 'Sele
|
|
|
120
120
|
value.length >= maxSelections &&
|
|
121
121
|
!isSelected;
|
|
122
122
|
return (_jsxs("button", { type: "button", className: "glchat-a2ui-multiselect-option", disabled: atMax, style: {
|
|
123
|
-
...
|
|
123
|
+
...multiSelectOptionStyles,
|
|
124
124
|
...(hoveredOption === option.value ? optionHoverStyle : {}),
|
|
125
125
|
opacity: atMax ? 0.5 : 1,
|
|
126
126
|
cursor: atMax ? 'not-allowed' : 'pointer',
|
|
127
127
|
}, onMouseEnter: () => setHoveredOption(option.value), onMouseLeave: () => setHoveredOption(null), onClick: () => toggleOption(option.value), children: [_jsx("span", { style: isSelected
|
|
128
|
-
?
|
|
129
|
-
:
|
|
128
|
+
? multiSelectCheckboxCheckedStyles
|
|
129
|
+
: multiSelectCheckboxStyles, children: isSelected && (_jsx(Check, { style: { height: '1rem', width: '1rem' }, strokeWidth: 1.5 })) }), _jsx("span", { style: {
|
|
130
130
|
overflow: 'hidden',
|
|
131
131
|
display: '-webkit-box',
|
|
132
132
|
WebkitLineClamp: 2,
|
|
133
133
|
WebkitBoxOrient: 'vertical',
|
|
134
134
|
width: '100%',
|
|
135
135
|
}, children: option.label })] }, option.value));
|
|
136
|
-
}))] }), _jsxs("div", { style:
|
|
136
|
+
}))] }), _jsxs("div", { style: multiSelectFooterStyles, children: [value.length > 0 && (_jsxs(_Fragment, { children: [_jsx("button", { type: "button", style: multiSelectFooterButtonStyles, onClick: handleClear, children: "Clear" }), _jsx("div", { style: multiSelectSeparatorStyles })] })), _jsx("button", { type: "button", style: multiSelectFooterButtonStyles, onClick: () => setOpen(false), children: "Close" })] })] }) })] }));
|
|
137
137
|
}
|
|
@@ -3,16 +3,16 @@ export type MultiSelectOption = {
|
|
|
3
3
|
label: string;
|
|
4
4
|
value: string;
|
|
5
5
|
};
|
|
6
|
-
export declare const
|
|
7
|
-
export declare const
|
|
8
|
-
export declare const
|
|
9
|
-
export declare const
|
|
10
|
-
export declare const
|
|
11
|
-
export declare const
|
|
12
|
-
export declare const
|
|
13
|
-
export declare const
|
|
14
|
-
export declare const
|
|
15
|
-
export declare const
|
|
16
|
-
export declare const
|
|
17
|
-
export declare const
|
|
6
|
+
export declare const multiSelectTriggerStyles: CSSProperties;
|
|
7
|
+
export declare const multiSelectBadgeStyles: CSSProperties;
|
|
8
|
+
export declare const multiSelectPlaceholderStyles: CSSProperties;
|
|
9
|
+
export declare const multiSelectContentStyles: CSSProperties;
|
|
10
|
+
export declare const multiSelectSearchInputStyles: CSSProperties;
|
|
11
|
+
export declare const multiSelectListStyles: CSSProperties;
|
|
12
|
+
export declare const multiSelectOptionStyles: CSSProperties;
|
|
13
|
+
export declare const multiSelectCheckboxStyles: CSSProperties;
|
|
14
|
+
export declare const multiSelectCheckboxCheckedStyles: CSSProperties;
|
|
15
|
+
export declare const multiSelectFooterStyles: CSSProperties;
|
|
16
|
+
export declare const multiSelectFooterButtonStyles: CSSProperties;
|
|
17
|
+
export declare const multiSelectSeparatorStyles: CSSProperties;
|
|
18
18
|
//# sourceMappingURL=theme.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../../../../src/components/ui/MultiSelect/theme.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAE3C,MAAM,MAAM,iBAAiB,GAAG;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,eAAO,MAAM,
|
|
1
|
+
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../../../../src/components/ui/MultiSelect/theme.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAE3C,MAAM,MAAM,iBAAiB,GAAG;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,eAAO,MAAM,wBAAwB,EAAE,aAgBtC,CAAC;AAEF,eAAO,MAAM,sBAAsB,EAAE,aAcpC,CAAC;AAEF,eAAO,MAAM,4BAA4B,EAAE,aAI1C,CAAC;AAEF,eAAO,MAAM,wBAAwB,EAAE,aAWtC,CAAC;AAEF,eAAO,MAAM,4BAA4B,EAAE,aAW1C,CAAC;AAEF,eAAO,MAAM,qBAAqB,EAAE,aAKnC,CAAC;AAEF,eAAO,MAAM,uBAAuB,EAAE,aAgBrC,CAAC;AAEF,eAAO,MAAM,yBAAyB,EAAE,aAYvC,CAAC;AAEF,eAAO,MAAM,gCAAgC,EAAE,aAK9C,CAAC;AAEF,eAAO,MAAM,uBAAuB,EAAE,aASrC,CAAC;AAEF,eAAO,MAAM,6BAA6B,EAAE,aAS3C,CAAC;AAEF,eAAO,MAAM,0BAA0B,EAAE,aAMxC,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export const
|
|
1
|
+
export const multiSelectTriggerStyles = {
|
|
2
2
|
display: 'flex',
|
|
3
3
|
minHeight: '2.5rem',
|
|
4
4
|
width: '100%',
|
|
@@ -15,7 +15,7 @@ export const glchatMultiSelectTriggerStyles = {
|
|
|
15
15
|
boxSizing: 'border-box',
|
|
16
16
|
cursor: 'pointer',
|
|
17
17
|
};
|
|
18
|
-
export const
|
|
18
|
+
export const multiSelectBadgeStyles = {
|
|
19
19
|
display: 'flex',
|
|
20
20
|
alignItems: 'center',
|
|
21
21
|
justifyContent: 'space-between',
|
|
@@ -30,12 +30,12 @@ export const glchatMultiSelectBadgeStyles = {
|
|
|
30
30
|
fontWeight: 400,
|
|
31
31
|
maxWidth: '9rem',
|
|
32
32
|
};
|
|
33
|
-
export const
|
|
33
|
+
export const multiSelectPlaceholderStyles = {
|
|
34
34
|
fontSize: '0.875rem',
|
|
35
35
|
fontWeight: 400,
|
|
36
36
|
color: 'hsl(var(--foreground) / 0.5)',
|
|
37
37
|
};
|
|
38
|
-
export const
|
|
38
|
+
export const multiSelectContentStyles = {
|
|
39
39
|
zIndex: 50,
|
|
40
40
|
width: 'var(--radix-popover-trigger-width)',
|
|
41
41
|
borderRadius: 'var(--radius-md)',
|
|
@@ -47,7 +47,7 @@ export const glchatMultiSelectContentStyles = {
|
|
|
47
47
|
padding: 0,
|
|
48
48
|
boxShadow: '0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1)',
|
|
49
49
|
};
|
|
50
|
-
export const
|
|
50
|
+
export const multiSelectSearchInputStyles = {
|
|
51
51
|
width: '100%',
|
|
52
52
|
borderWidth: 0,
|
|
53
53
|
borderBottomWidth: '1px',
|
|
@@ -59,13 +59,13 @@ export const glchatMultiSelectSearchInputStyles = {
|
|
|
59
59
|
color: 'hsl(var(--foreground))',
|
|
60
60
|
outline: 'none',
|
|
61
61
|
};
|
|
62
|
-
export const
|
|
62
|
+
export const multiSelectListStyles = {
|
|
63
63
|
maxHeight: '250px',
|
|
64
64
|
overflowY: 'auto',
|
|
65
65
|
paddingTop: '0.25rem',
|
|
66
66
|
paddingBottom: '0.25rem',
|
|
67
67
|
};
|
|
68
|
-
export const
|
|
68
|
+
export const multiSelectOptionStyles = {
|
|
69
69
|
display: 'flex',
|
|
70
70
|
width: '100%',
|
|
71
71
|
cursor: 'pointer',
|
|
@@ -82,7 +82,7 @@ export const glchatMultiSelectOptionStyles = {
|
|
|
82
82
|
color: 'hsl(var(--foreground))',
|
|
83
83
|
textAlign: 'left',
|
|
84
84
|
};
|
|
85
|
-
export const
|
|
85
|
+
export const multiSelectCheckboxStyles = {
|
|
86
86
|
display: 'flex',
|
|
87
87
|
height: '1rem',
|
|
88
88
|
width: '1rem',
|
|
@@ -95,13 +95,13 @@ export const glchatMultiSelectCheckboxStyles = {
|
|
|
95
95
|
borderStyle: 'solid',
|
|
96
96
|
borderColor: 'hsl(var(--foreground))',
|
|
97
97
|
};
|
|
98
|
-
export const
|
|
99
|
-
...
|
|
98
|
+
export const multiSelectCheckboxCheckedStyles = {
|
|
99
|
+
...multiSelectCheckboxStyles,
|
|
100
100
|
borderColor: 'hsl(var(--primary))',
|
|
101
101
|
backgroundColor: 'hsl(var(--primary))',
|
|
102
102
|
color: 'hsl(var(--primary-foreground))',
|
|
103
103
|
};
|
|
104
|
-
export const
|
|
104
|
+
export const multiSelectFooterStyles = {
|
|
105
105
|
display: 'flex',
|
|
106
106
|
alignItems: 'center',
|
|
107
107
|
justifyContent: 'space-between',
|
|
@@ -111,7 +111,7 @@ export const glchatMultiSelectFooterStyles = {
|
|
|
111
111
|
padding: '0.25rem',
|
|
112
112
|
fontSize: '0.875rem',
|
|
113
113
|
};
|
|
114
|
-
export const
|
|
114
|
+
export const multiSelectFooterButtonStyles = {
|
|
115
115
|
flex: 1,
|
|
116
116
|
height: '2rem',
|
|
117
117
|
cursor: 'pointer',
|
|
@@ -121,7 +121,7 @@ export const glchatMultiSelectFooterButtonStyles = {
|
|
|
121
121
|
color: 'hsl(var(--foreground))',
|
|
122
122
|
fontSize: '0.875rem',
|
|
123
123
|
};
|
|
124
|
-
export const
|
|
124
|
+
export const multiSelectSeparatorStyles = {
|
|
125
125
|
width: '1px',
|
|
126
126
|
minHeight: '1.5rem',
|
|
127
127
|
backgroundColor: 'hsl(var(--border))',
|
|
@@ -3,25 +3,25 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
3
3
|
import * as SelectPrimitive from '@radix-ui/react-select';
|
|
4
4
|
import { Check, ChevronDown, ChevronUp } from 'lucide-react';
|
|
5
5
|
import * as React from 'react';
|
|
6
|
-
import {
|
|
6
|
+
import { selectContentStyles, selectItemIndicatorStyles, selectItemStyles, selectScrollButtonStyles, selectTriggerStyles, selectViewportStyles, } from './theme.js';
|
|
7
7
|
const Select = SelectPrimitive.Root;
|
|
8
8
|
const SelectGroup = SelectPrimitive.Group;
|
|
9
9
|
const SelectValue = SelectPrimitive.Value;
|
|
10
|
-
const SelectTrigger = React.forwardRef(({ className, style, children, ...props }, ref) => (_jsxs(SelectPrimitive.Trigger, { ref: ref, className: className, style: { ...
|
|
10
|
+
const SelectTrigger = React.forwardRef(({ className, style, children, ...props }, ref) => (_jsxs(SelectPrimitive.Trigger, { ref: ref, className: className, style: { ...selectTriggerStyles, ...style }, ...props, children: [children, _jsx(SelectPrimitive.Icon, { asChild: true, children: _jsx(ChevronDown, { style: { height: '1rem', width: '1rem', opacity: 0.5, flexShrink: 0 }, "aria-hidden": true }) })] })));
|
|
11
11
|
SelectTrigger.displayName = SelectPrimitive.Trigger.displayName;
|
|
12
|
-
const SelectScrollUpButton = React.forwardRef(({ style, ...props }, ref) => (_jsx(SelectPrimitive.ScrollUpButton, { ref: ref, style: { ...
|
|
12
|
+
const SelectScrollUpButton = React.forwardRef(({ style, ...props }, ref) => (_jsx(SelectPrimitive.ScrollUpButton, { ref: ref, style: { ...selectScrollButtonStyles, ...style }, ...props, children: _jsx(ChevronUp, { style: { height: '1rem', width: '1rem' }, "aria-hidden": true }) })));
|
|
13
13
|
SelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName;
|
|
14
|
-
const SelectScrollDownButton = React.forwardRef(({ style, ...props }, ref) => (_jsx(SelectPrimitive.ScrollDownButton, { ref: ref, style: { ...
|
|
14
|
+
const SelectScrollDownButton = React.forwardRef(({ style, ...props }, ref) => (_jsx(SelectPrimitive.ScrollDownButton, { ref: ref, style: { ...selectScrollButtonStyles, ...style }, ...props, children: _jsx(ChevronDown, { style: { height: '1rem', width: '1rem' }, "aria-hidden": true }) })));
|
|
15
15
|
SelectScrollDownButton.displayName = SelectPrimitive.ScrollDownButton.displayName;
|
|
16
|
-
const SelectContent = React.forwardRef(({ className, children, position = 'popper', style, ...props }, ref) => (_jsx(SelectPrimitive.Portal, { children: _jsxs(SelectPrimitive.Content, { ref: ref, className: className, position: position, style: { ...
|
|
16
|
+
const SelectContent = React.forwardRef(({ className, children, position = 'popper', style, ...props }, ref) => (_jsx(SelectPrimitive.Portal, { children: _jsxs(SelectPrimitive.Content, { ref: ref, className: className, position: position, style: { ...selectContentStyles, ...style }, ...props, children: [_jsx(SelectScrollUpButton, {}), _jsx(SelectPrimitive.Viewport, { style: position === 'popper'
|
|
17
17
|
? {
|
|
18
|
-
...
|
|
18
|
+
...selectViewportStyles,
|
|
19
19
|
height: 'var(--radix-select-trigger-height)',
|
|
20
20
|
width: '100%',
|
|
21
21
|
minWidth: 'var(--radix-select-trigger-width)',
|
|
22
22
|
}
|
|
23
|
-
:
|
|
23
|
+
: selectViewportStyles, children: children }), _jsx(SelectScrollDownButton, {})] }) })));
|
|
24
24
|
SelectContent.displayName = SelectPrimitive.Content.displayName;
|
|
25
|
-
const SelectItem = React.forwardRef(({ className, children, style, ...props }, ref) => (_jsxs(SelectPrimitive.Item, { ref: ref, className: ['glchat-a2ui-select-item', className].filter(Boolean).join(' '), style: { ...
|
|
25
|
+
const SelectItem = React.forwardRef(({ className, children, style, ...props }, ref) => (_jsxs(SelectPrimitive.Item, { ref: ref, className: ['glchat-a2ui-select-item', className].filter(Boolean).join(' '), style: { ...selectItemStyles, ...style }, ...props, children: [_jsx(SelectPrimitive.ItemText, { children: children }), _jsx("span", { style: selectItemIndicatorStyles, children: _jsx(SelectPrimitive.ItemIndicator, { children: _jsx(Check, { style: { height: '1rem', width: '1rem', color: 'hsl(var(--primary))' }, "aria-hidden": true }) }) })] })));
|
|
26
26
|
SelectItem.displayName = SelectPrimitive.Item.displayName;
|
|
27
27
|
export { Select, SelectContent, SelectGroup, SelectItem, SelectScrollDownButton, SelectScrollUpButton, SelectTrigger, SelectValue, };
|