@case-framework/survey-ui 0.8.4 → 0.9.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 +16 -0
- package/dist/src/index.d.ts +1 -0
- package/dist/src/modules/default-item-registry/default-item-cores.d.ts +2 -2
- package/dist/src/modules/default-item-registry/items/choice/player/question.d.ts +2 -2
- package/dist/src/modules/default-item-registry/items/form/player/field.d.ts +1 -1
- package/dist/src/modules/survey-player/localization/default-item-localizations.d.ts +3 -0
- package/dist/survey-ui.cjs +13 -13
- package/dist/survey-ui.cjs.map +1 -1
- package/dist/survey-ui.css +1 -1
- package/dist/survey-ui.js +3509 -4014
- package/dist/survey-ui.js.map +1 -1
- package/package.json +6 -5
- package/dist/src/modules/default-item-registry/items/choice/display-order.d.ts +0 -1
- package/dist/src/modules/default-item-registry/items/choice/model.d.ts +0 -28
- package/dist/src/modules/default-item-registry/items/form/model.d.ts +0 -163
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@case-framework/survey-ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"description": "Participant-facing React survey player for CASE surveys.",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"repository": {
|
|
@@ -30,9 +30,11 @@
|
|
|
30
30
|
"./package.json": "./package.json"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
+
"@case-framework/survey-items": "0.1.0",
|
|
33
34
|
"@case-framework/ui-localization": "0.2.1"
|
|
34
35
|
},
|
|
35
36
|
"devDependencies": {
|
|
37
|
+
"@case-framework/survey-core": "0.7.0",
|
|
36
38
|
"@tailwindcss/vite": "^4.3.2",
|
|
37
39
|
"@types/node": "^25.6.0",
|
|
38
40
|
"@types/react": "^19.2.18",
|
|
@@ -50,13 +52,12 @@
|
|
|
50
52
|
"tailwindcss": "^4.3.2",
|
|
51
53
|
"typescript": "~6.0.3",
|
|
52
54
|
"vite": "^8.0.10",
|
|
53
|
-
"vite-plugin-dts": "^4.5.4"
|
|
54
|
-
"@case-framework/survey-core": "0.6.1"
|
|
55
|
+
"vite-plugin-dts": "^4.5.4"
|
|
55
56
|
},
|
|
56
57
|
"peerDependencies": {
|
|
58
|
+
"@case-framework/survey-core": "^0.7.0",
|
|
57
59
|
"react": ">=19.2.0",
|
|
58
|
-
"react-dom": ">=19.2.0"
|
|
59
|
-
"@case-framework/survey-core": "0.6.1"
|
|
60
|
+
"react-dom": ">=19.2.0"
|
|
60
61
|
},
|
|
61
62
|
"scripts": {
|
|
62
63
|
"build": "vite build",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function getDisplayOrder<T>(items: readonly T[], shouldShuffle: boolean, seed: string): T[];
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { FormItemConfig } from '../form/model';
|
|
2
|
-
/** `1` = single selection (radio). `null` = multiple selection with no upper cap. Integers above 1 cap how many options may be selected. */
|
|
3
|
-
export type ChoiceMaxSelection = number | null;
|
|
4
|
-
export interface ChoiceOptionConfig {
|
|
5
|
-
id: string;
|
|
6
|
-
key?: string;
|
|
7
|
-
hasDisplayCondition?: boolean;
|
|
8
|
-
embeddedFormItemId?: string;
|
|
9
|
-
embeddedForm?: FormItemConfig;
|
|
10
|
-
}
|
|
11
|
-
export interface ChoiceItemConfig {
|
|
12
|
-
id: string;
|
|
13
|
-
maxSelection: ChoiceMaxSelection;
|
|
14
|
-
shuffleOptions: boolean;
|
|
15
|
-
options: ChoiceOptionConfig[];
|
|
16
|
-
}
|
|
17
|
-
export declare function choiceIsSingleSelect(maxSelection: ChoiceMaxSelection): boolean;
|
|
18
|
-
export declare function createChoiceItemConfig(itemId: string): ChoiceItemConfig;
|
|
19
|
-
export declare function getChoiceOptionLabelContentKey(optionId: string): string;
|
|
20
|
-
export declare function getChoiceOptionEmbeddedFormTranslationPrefix(optionId: string): string;
|
|
21
|
-
export declare function getChoiceOptionEmbeddedFormResponseSlotPrefix(optionId: string): string;
|
|
22
|
-
export declare function getChoiceOptionEmbeddedFormResponseSlotId(optionId: string, fieldKey: string): string;
|
|
23
|
-
export declare function getChoiceOptionEmbeddedFormResponseKeyPathSegment(option: Pick<ChoiceOptionConfig, "id" | "key">): string;
|
|
24
|
-
export declare function choiceOptionHasEmbeddedForm(option: Pick<ChoiceOptionConfig, "embeddedFormItemId" | "embeddedForm">): boolean;
|
|
25
|
-
export declare function normalizeChoiceOptionKey(value: string): string;
|
|
26
|
-
export declare function normalizeChoiceItemConfig(rawConfig: unknown, itemId: string): ChoiceItemConfig;
|
|
27
|
-
export declare function createChoiceOptionConfig(existingOptions: ChoiceOptionConfig[]): ChoiceOptionConfig;
|
|
28
|
-
export declare function createDuplicatedChoiceOptionConfig(option: ChoiceOptionConfig, existingOptions: ChoiceOptionConfig[]): ChoiceOptionConfig;
|
|
@@ -1,163 +0,0 @@
|
|
|
1
|
-
import { SurveyItemTranslations } from '@case-framework/survey-core';
|
|
2
|
-
export type FormFieldType = "input" | "textarea" | "number" | "datepicker" | "switch" | "select" | "slider";
|
|
3
|
-
export declare const FORM_DATEPICKER_FIELD_MODES: readonly ["year", "year-month", "year-month-day"];
|
|
4
|
-
export type FormDatepickerFieldMode = (typeof FORM_DATEPICKER_FIELD_MODES)[number];
|
|
5
|
-
export interface FormFieldRendererSlotDefinition {
|
|
6
|
-
id: "field" | "label" | "description" | "error";
|
|
7
|
-
entryLabel: string;
|
|
8
|
-
description: string;
|
|
9
|
-
component: "Field" | "FieldLabel" | "FieldDescription" | "FieldError";
|
|
10
|
-
}
|
|
11
|
-
export declare const FORM_FIELD_RENDERER_SLOTS: FormFieldRendererSlotDefinition[];
|
|
12
|
-
export interface FormFieldConfigSuggestion {
|
|
13
|
-
key: string;
|
|
14
|
-
label: string;
|
|
15
|
-
description: string;
|
|
16
|
-
}
|
|
17
|
-
export type FormFieldValidationType = "required" | "minLength" | "maxLength" | "pattern" | "email" | "url" | "integer" | "min" | "max" | "minDate" | "maxDate" | "mustBeTrue";
|
|
18
|
-
export interface FormFieldValidationSuggestion {
|
|
19
|
-
type: FormFieldValidationType;
|
|
20
|
-
label: string;
|
|
21
|
-
description: string;
|
|
22
|
-
valueKind: "none" | "number" | "text" | "date";
|
|
23
|
-
defaultValue?: number | string;
|
|
24
|
-
}
|
|
25
|
-
export interface FormFieldValidationConfig {
|
|
26
|
-
id: string;
|
|
27
|
-
type: FormFieldValidationType;
|
|
28
|
-
value?: number | string;
|
|
29
|
-
message?: string;
|
|
30
|
-
}
|
|
31
|
-
export type FormFieldEffectiveValidationType = "required" | FormFieldValidationType;
|
|
32
|
-
export interface FormFieldEffectiveValidationConfig {
|
|
33
|
-
id: string;
|
|
34
|
-
type: FormFieldEffectiveValidationType;
|
|
35
|
-
value?: number | string;
|
|
36
|
-
message?: string;
|
|
37
|
-
source: "required" | "validation";
|
|
38
|
-
}
|
|
39
|
-
export interface FormFieldSelectOptionConfig {
|
|
40
|
-
id: string;
|
|
41
|
-
value: string;
|
|
42
|
-
label?: string;
|
|
43
|
-
}
|
|
44
|
-
export interface FormInputFieldControlConfig {
|
|
45
|
-
type: "input";
|
|
46
|
-
placeholder?: string;
|
|
47
|
-
inputMode?: "text" | "email" | "tel" | "url" | "password";
|
|
48
|
-
autocomplete?: string;
|
|
49
|
-
}
|
|
50
|
-
export interface FormTextareaFieldControlConfig {
|
|
51
|
-
type: "textarea";
|
|
52
|
-
placeholder?: string;
|
|
53
|
-
rows?: number;
|
|
54
|
-
}
|
|
55
|
-
export interface FormNumberFieldControlConfig {
|
|
56
|
-
type: "number";
|
|
57
|
-
placeholder?: string;
|
|
58
|
-
step?: number;
|
|
59
|
-
unit?: string;
|
|
60
|
-
defaultValue?: number;
|
|
61
|
-
}
|
|
62
|
-
export interface FormDatepickerFieldControlConfig {
|
|
63
|
-
type: "datepicker";
|
|
64
|
-
placeholder?: string;
|
|
65
|
-
mode: FormDatepickerFieldMode;
|
|
66
|
-
}
|
|
67
|
-
export interface FormSwitchFieldControlConfig {
|
|
68
|
-
type: "switch";
|
|
69
|
-
checkedLabel?: string;
|
|
70
|
-
uncheckedLabel?: string;
|
|
71
|
-
defaultChecked?: boolean;
|
|
72
|
-
}
|
|
73
|
-
export interface FormSelectFieldControlConfig {
|
|
74
|
-
type: "select";
|
|
75
|
-
placeholder?: string;
|
|
76
|
-
allowClear?: boolean;
|
|
77
|
-
options: FormFieldSelectOptionConfig[];
|
|
78
|
-
}
|
|
79
|
-
export interface FormSliderFieldControlConfig {
|
|
80
|
-
type: "slider";
|
|
81
|
-
min?: number;
|
|
82
|
-
max?: number;
|
|
83
|
-
step?: number;
|
|
84
|
-
defaultValue?: number;
|
|
85
|
-
showValue?: boolean;
|
|
86
|
-
}
|
|
87
|
-
export type FormFieldControlConfig = FormInputFieldControlConfig | FormTextareaFieldControlConfig | FormNumberFieldControlConfig | FormDatepickerFieldControlConfig | FormSwitchFieldControlConfig | FormSelectFieldControlConfig | FormSliderFieldControlConfig;
|
|
88
|
-
export interface FormFieldConfig {
|
|
89
|
-
id: string;
|
|
90
|
-
key: string;
|
|
91
|
-
type: FormFieldType;
|
|
92
|
-
label?: string;
|
|
93
|
-
description?: string;
|
|
94
|
-
errorMessage?: string;
|
|
95
|
-
required?: boolean;
|
|
96
|
-
controller: FormFieldControlConfig;
|
|
97
|
-
validations: FormFieldValidationConfig[];
|
|
98
|
-
hasValidations?: boolean;
|
|
99
|
-
isInvalid?: boolean;
|
|
100
|
-
}
|
|
101
|
-
export declare function getFormFieldEffectiveValidations(field: Pick<FormFieldConfig, "id" | "required" | "validations">): FormFieldEffectiveValidationConfig[];
|
|
102
|
-
/**
|
|
103
|
-
* Column counts keyed by field group card width (container), not the viewport.
|
|
104
|
-
* Breakpoints match `@container (width >= …)` on `form-field-group`: 20rem / 24rem / 28rem / 36rem.
|
|
105
|
-
*/
|
|
106
|
-
export interface FormFieldGroupLayoutConfig {
|
|
107
|
-
/** Below @xs (under 20rem) */
|
|
108
|
-
base: number;
|
|
109
|
-
/** @xs — width >= 20rem */
|
|
110
|
-
xs: number;
|
|
111
|
-
/** @sm — width >= 24rem */
|
|
112
|
-
sm: number;
|
|
113
|
-
/** @md — width >= 28rem */
|
|
114
|
-
md: number;
|
|
115
|
-
/** @xl — width >= 36rem */
|
|
116
|
-
xl: number;
|
|
117
|
-
}
|
|
118
|
-
export interface FormFieldGroupConfig {
|
|
119
|
-
id: string;
|
|
120
|
-
title?: string;
|
|
121
|
-
description?: string;
|
|
122
|
-
hasDisplayCondition?: boolean;
|
|
123
|
-
layout: FormFieldGroupLayoutConfig;
|
|
124
|
-
fields: FormFieldConfig[];
|
|
125
|
-
}
|
|
126
|
-
export interface FormItemConfig {
|
|
127
|
-
id: string;
|
|
128
|
-
/** Editor-facing complexity level; it does not change participant behavior. */
|
|
129
|
-
authoringMode: "simple" | "custom";
|
|
130
|
-
fieldGroups: FormFieldGroupConfig[];
|
|
131
|
-
}
|
|
132
|
-
export declare function createFormItemConfig(itemId: string): FormItemConfig;
|
|
133
|
-
export declare function getFormFieldGroupTranslationPrefix(groupId: string, translationNamespace?: string): string;
|
|
134
|
-
export declare function getFormFieldGroupTitleContentKey(groupId: string, translationNamespace?: string): string;
|
|
135
|
-
export declare function getFormFieldGroupDescriptionContentKey(groupId: string, translationNamespace?: string): string;
|
|
136
|
-
export declare function getFormFieldTranslationPrefix(fieldId: string, translationNamespace?: string): string;
|
|
137
|
-
export declare function getFormFieldLabelContentKey(fieldId: string, translationNamespace?: string): string;
|
|
138
|
-
export declare function getFormFieldDescriptionContentKey(fieldId: string, translationNamespace?: string): string;
|
|
139
|
-
export declare function getFormFieldErrorMessageContentKey(fieldId: string, translationNamespace?: string): string;
|
|
140
|
-
export declare function getFormFieldPlaceholderContentKey(fieldId: string, translationNamespace?: string): string;
|
|
141
|
-
export declare function getFormFieldUnitContentKey(fieldId: string, translationNamespace?: string): string;
|
|
142
|
-
export declare function getFormFieldCheckedLabelContentKey(fieldId: string, translationNamespace?: string): string;
|
|
143
|
-
export declare function getFormFieldUncheckedLabelContentKey(fieldId: string, translationNamespace?: string): string;
|
|
144
|
-
export declare function getFormFieldOptionLabelContentKey(fieldId: string, optionId: string, translationNamespace?: string): string;
|
|
145
|
-
export declare function getFormFieldValidationMessageContentKey(fieldId: string, validationId: string, translationNamespace?: string): string;
|
|
146
|
-
export declare function getFormFieldTranslationKeys(field: Pick<FormFieldConfig, "id" | "type" | "controller" | "validations">, translationNamespace?: string): string[];
|
|
147
|
-
export declare function getFormFieldGroupTranslationKeys(group: Pick<FormFieldGroupConfig, "id">, translationNamespace?: string): string[];
|
|
148
|
-
export declare function writeFormFieldGroupTranslations(itemTranslations: SurveyItemTranslations, locale: string, group: Pick<FormFieldGroupConfig, "id" | "title" | "description">, translationNamespace?: string): void;
|
|
149
|
-
export declare function writeFormFieldTranslations(itemTranslations: SurveyItemTranslations, locale: string, field: Pick<FormFieldConfig, "id" | "type" | "label" | "description" | "errorMessage" | "controller" | "validations">, translationNamespace?: string): void;
|
|
150
|
-
export declare function withFormItemTranslatedContent(config: FormItemConfig, itemTranslations: SurveyItemTranslations | undefined, locale: string, options?: {
|
|
151
|
-
fallbackLocale?: string;
|
|
152
|
-
translationNamespace?: string;
|
|
153
|
-
}): FormItemConfig;
|
|
154
|
-
export declare function withoutFormItemTranslatedContent(config: FormItemConfig): FormItemConfig;
|
|
155
|
-
/** CSS custom properties for `.form-field-group-layout-scope` + `.form-field-group-grid`. */
|
|
156
|
-
export declare function formFieldGroupLayoutCssVars(layout: FormFieldGroupLayoutConfig): Record<string, string>;
|
|
157
|
-
export declare function getFormFieldControllerComponentName(type: FormFieldType): string;
|
|
158
|
-
export declare function getFormFieldConfigSuggestions(type: FormFieldType): FormFieldConfigSuggestion[];
|
|
159
|
-
export declare function getFormFieldValidationSuggestions(type: FormFieldType): FormFieldValidationSuggestion[];
|
|
160
|
-
export declare function normalizeFormItemConfig(rawConfig: unknown, itemId: string): FormItemConfig;
|
|
161
|
-
export declare function createFormFieldGroupConfig(): FormFieldGroupConfig;
|
|
162
|
-
export declare function getNextAvailableFormFieldKey(fields: Pick<FormFieldConfig, "key">[]): string;
|
|
163
|
-
export declare function createFormFieldConfig(type: FormFieldType, key?: string): FormFieldConfig;
|