@duskmoon-dev/components 0.4.0 → 0.5.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/README.md +84 -3
- package/dist/components/chat/Chat.types.d.ts +75 -1
- package/dist/components/chat/ChatComposer.d.ts +4 -0
- package/dist/components/chat/index.d.ts +1 -0
- package/dist/components/chat/index.js +1098 -25
- package/dist/components/dm-pro-table/index.js +12 -0
- package/dist/components/dm-query/index.js +12 -0
- package/dist/components/dm-search/index.js +12 -0
- package/dist/components/dm-table/index.js +12 -0
- package/dist/components/json-schema-form/JsonSchemaForm.d.ts +19 -0
- package/dist/components/json-schema-form/JsonSchemaWidget.d.ts +14 -0
- package/dist/components/json-schema-form/index.d.ts +8 -0
- package/dist/components/json-schema-form/index.js +7661 -0
- package/dist/components/json-schema-form/json-form-widgets.d.ts +26 -0
- package/dist/components/json-schema-form/json-schema-form.d.ts +50 -0
- package/dist/components/select/index.js +12 -0
- package/dist/generated/version.d.ts +1 -1
- package/dist/index.js +8105 -7665
- package/dist/infrastructure.js +1 -1
- package/dist/styles.css +312 -10
- package/package.json +9 -3
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { JsonValue, RenderableSchema } from "./json-schema-form";
|
|
2
|
+
export declare const widgetNames: readonly ["input", "input-number", "checkbox", "radio", "radio-group", "checkbox-group", "color-picker", "date-picker", "dm-date-picker", "mentions", "otp-input", "rate", "segmented", "select", "slider", "switch", "time-picker", "transfer", "tree-select", "cascader", "upload"];
|
|
3
|
+
export type WidgetName = (typeof widgetNames)[number];
|
|
4
|
+
export type WidgetOption = {
|
|
5
|
+
value: string | number | boolean;
|
|
6
|
+
label: string;
|
|
7
|
+
children?: WidgetOption[];
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
};
|
|
10
|
+
export type OrientationWidgetConfig = {
|
|
11
|
+
orientation?: "horizontal" | "vertical";
|
|
12
|
+
};
|
|
13
|
+
export type WidgetConfig = OrientationWidgetConfig & {
|
|
14
|
+
length?: number;
|
|
15
|
+
count?: number;
|
|
16
|
+
allowHalf?: boolean;
|
|
17
|
+
min?: number;
|
|
18
|
+
max?: number;
|
|
19
|
+
step?: number;
|
|
20
|
+
};
|
|
21
|
+
export declare const flattenOptions: (options: WidgetOption[]) => WidgetOption[];
|
|
22
|
+
export declare function widgetConfig(schema: RenderableSchema): WidgetConfig;
|
|
23
|
+
export declare function naturalWidgetValue(schema: RenderableSchema): JsonValue | undefined;
|
|
24
|
+
export declare function optionsFor(schema: RenderableSchema): WidgetOption[];
|
|
25
|
+
export declare function inspectWidgets(input: Record<string, unknown>, location: string): void;
|
|
26
|
+
export declare function widgetValueError(schema: RenderableSchema, value: JsonValue): string | undefined;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { type WidgetName, type WidgetOption, type WidgetConfig } from "./json-form-widgets";
|
|
2
|
+
export type JsonValue = null | boolean | number | string | JsonValue[] | {
|
|
3
|
+
[key: string]: JsonValue;
|
|
4
|
+
};
|
|
5
|
+
export type FormValue = {
|
|
6
|
+
[key: string]: JsonValue;
|
|
7
|
+
};
|
|
8
|
+
export type RenderableSchema = {
|
|
9
|
+
type: "object" | "array" | "string" | "number" | "integer" | "boolean";
|
|
10
|
+
$schema?: "https://json-schema.org/draft/2020-12/schema";
|
|
11
|
+
$id?: string;
|
|
12
|
+
$comment?: string;
|
|
13
|
+
title?: string;
|
|
14
|
+
description?: string;
|
|
15
|
+
default?: JsonValue;
|
|
16
|
+
enum?: JsonValue[];
|
|
17
|
+
properties?: Record<string, RenderableSchema>;
|
|
18
|
+
required?: string[];
|
|
19
|
+
items?: RenderableSchema;
|
|
20
|
+
additionalProperties?: false;
|
|
21
|
+
minLength?: number;
|
|
22
|
+
maxLength?: number;
|
|
23
|
+
pattern?: string;
|
|
24
|
+
format?: string;
|
|
25
|
+
minItems?: number;
|
|
26
|
+
maxItems?: number;
|
|
27
|
+
uniqueItems?: boolean;
|
|
28
|
+
minProperties?: number;
|
|
29
|
+
maxProperties?: number;
|
|
30
|
+
exclusiveMinimum?: number;
|
|
31
|
+
exclusiveMaximum?: number;
|
|
32
|
+
minimum?: number;
|
|
33
|
+
maximum?: number;
|
|
34
|
+
multipleOf?: number;
|
|
35
|
+
"x-widget"?: WidgetName;
|
|
36
|
+
"x-options"?: WidgetOption[];
|
|
37
|
+
"x-widget-options"?: WidgetConfig;
|
|
38
|
+
};
|
|
39
|
+
/** Errors keyed by escaped JSON Pointer, with an empty key for form errors. */
|
|
40
|
+
export type FormErrors = Record<string, string>;
|
|
41
|
+
export type FormValidationResult = {
|
|
42
|
+
valid: boolean;
|
|
43
|
+
errors: FormErrors;
|
|
44
|
+
};
|
|
45
|
+
export type CompiledForm = {
|
|
46
|
+
schema: RenderableSchema;
|
|
47
|
+
initialValue: () => FormValue;
|
|
48
|
+
validate: (value: FormValue) => FormValidationResult;
|
|
49
|
+
};
|
|
50
|
+
export declare function compileForm(input: unknown): CompiledForm;
|
|
@@ -172,11 +172,17 @@ var OptGroup = forwardRef(({ children, ...props }, ref) => /* @__PURE__ */ jsx("
|
|
|
172
172
|
OptGroup.displayName = "Select.OptGroup";
|
|
173
173
|
var SelectRoot = forwardRef(({
|
|
174
174
|
allowClear,
|
|
175
|
+
"aria-describedby": ariaDescribedBy,
|
|
176
|
+
"aria-errormessage": ariaErrorMessage,
|
|
177
|
+
"aria-invalid": ariaInvalid,
|
|
178
|
+
"aria-label": ariaLabel,
|
|
179
|
+
"aria-labelledby": ariaLabelledBy,
|
|
175
180
|
children,
|
|
176
181
|
className,
|
|
177
182
|
defaultValue,
|
|
178
183
|
disabled,
|
|
179
184
|
filterOption,
|
|
185
|
+
id,
|
|
180
186
|
loading,
|
|
181
187
|
mode,
|
|
182
188
|
onChange,
|
|
@@ -299,8 +305,14 @@ var SelectRoot = forwardRef(({
|
|
|
299
305
|
children: [
|
|
300
306
|
/* @__PURE__ */ jsxs("button", {
|
|
301
307
|
type: "button",
|
|
308
|
+
id,
|
|
302
309
|
className: getSelectClasses({ size, status, disabled }),
|
|
303
310
|
disabled: disabled || loading,
|
|
311
|
+
"aria-describedby": ariaDescribedBy,
|
|
312
|
+
"aria-errormessage": ariaErrorMessage,
|
|
313
|
+
"aria-invalid": ariaInvalid,
|
|
314
|
+
"aria-label": ariaLabel,
|
|
315
|
+
"aria-labelledby": ariaLabelledBy,
|
|
304
316
|
"aria-haspopup": "listbox",
|
|
305
317
|
"aria-expanded": open,
|
|
306
318
|
onClick: () => setOpen((current) => !current),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "0.
|
|
1
|
+
export declare const version = "0.5.0";
|