@qwickapps/react-framework 1.5.12 → 1.6.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.
Files changed (65) hide show
  1. package/README.md +23 -0
  2. package/dist/components/blocks/ImageGallery.d.ts +30 -0
  3. package/dist/components/blocks/ImageGallery.d.ts.map +1 -0
  4. package/dist/components/blocks/OptionSelector.d.ts +45 -0
  5. package/dist/components/blocks/OptionSelector.d.ts.map +1 -0
  6. package/dist/components/blocks/index.d.ts +4 -0
  7. package/dist/components/blocks/index.d.ts.map +1 -1
  8. package/dist/components/forms/Captcha.d.ts +33 -28
  9. package/dist/components/forms/Captcha.d.ts.map +1 -1
  10. package/dist/components/forms/FormCheckbox.d.ts +15 -12
  11. package/dist/components/forms/FormCheckbox.d.ts.map +1 -1
  12. package/dist/components/forms/FormField.d.ts +20 -23
  13. package/dist/components/forms/FormField.d.ts.map +1 -1
  14. package/dist/components/forms/FormSelect.d.ts +16 -15
  15. package/dist/components/forms/FormSelect.d.ts.map +1 -1
  16. package/dist/hooks/useBaseProps.d.ts +27 -1172
  17. package/dist/hooks/useBaseProps.d.ts.map +1 -1
  18. package/dist/index.esm.js +1674 -554
  19. package/dist/index.js +1676 -552
  20. package/dist/palettes/manifest.json +19 -19
  21. package/dist/schemas/CaptchaSchema.d.ts +16 -0
  22. package/dist/schemas/CaptchaSchema.d.ts.map +1 -0
  23. package/dist/schemas/FormCheckboxSchema.d.ts +16 -0
  24. package/dist/schemas/FormCheckboxSchema.d.ts.map +1 -0
  25. package/dist/schemas/FormFieldSchema.d.ts +23 -0
  26. package/dist/schemas/FormFieldSchema.d.ts.map +1 -0
  27. package/dist/schemas/FormSelectSchema.d.ts +20 -0
  28. package/dist/schemas/FormSelectSchema.d.ts.map +1 -0
  29. package/dist/schemas/ImageGallerySchema.d.ts +27 -0
  30. package/dist/schemas/ImageGallerySchema.d.ts.map +1 -0
  31. package/dist/schemas/OptionSelectorSchema.d.ts +34 -0
  32. package/dist/schemas/OptionSelectorSchema.d.ts.map +1 -0
  33. package/dist/schemas/index.d.ts +6 -0
  34. package/dist/schemas/index.d.ts.map +1 -1
  35. package/package.json +1 -1
  36. package/src/components/blocks/Article.tsx +1 -1
  37. package/src/components/blocks/ImageGallery.tsx +464 -0
  38. package/src/components/blocks/OptionSelector.tsx +459 -0
  39. package/src/components/blocks/index.ts +4 -0
  40. package/src/components/forms/Captcha.tsx +57 -63
  41. package/src/components/forms/FormCheckbox.tsx +35 -43
  42. package/src/components/forms/FormField.tsx +50 -66
  43. package/src/components/forms/FormSelect.tsx +41 -49
  44. package/src/hooks/useBaseProps.ts +34 -1
  45. package/src/schemas/CaptchaSchema.ts +65 -0
  46. package/src/schemas/FormCheckboxSchema.ts +65 -0
  47. package/src/schemas/FormFieldSchema.ts +140 -0
  48. package/src/schemas/FormSelectSchema.ts +108 -0
  49. package/src/schemas/ImageGallerySchema.ts +148 -0
  50. package/src/schemas/OptionSelectorSchema.ts +216 -0
  51. package/src/schemas/index.ts +6 -0
  52. package/src/stories/ImageGallery.stories.tsx +497 -0
  53. package/src/stories/OptionSelector.stories.tsx +506 -0
  54. /package/dist/palettes/{palette-autumn.1.5.12.css → palette-autumn.1.6.0.css} +0 -0
  55. /package/dist/palettes/{palette-autumn.1.5.12.min.css → palette-autumn.1.6.0.min.css} +0 -0
  56. /package/dist/palettes/{palette-cosmic.1.5.12.css → palette-cosmic.1.6.0.css} +0 -0
  57. /package/dist/palettes/{palette-cosmic.1.5.12.min.css → palette-cosmic.1.6.0.min.css} +0 -0
  58. /package/dist/palettes/{palette-default.1.5.12.css → palette-default.1.6.0.css} +0 -0
  59. /package/dist/palettes/{palette-default.1.5.12.min.css → palette-default.1.6.0.min.css} +0 -0
  60. /package/dist/palettes/{palette-ocean.1.5.12.css → palette-ocean.1.6.0.css} +0 -0
  61. /package/dist/palettes/{palette-ocean.1.5.12.min.css → palette-ocean.1.6.0.min.css} +0 -0
  62. /package/dist/palettes/{palette-spring.1.5.12.css → palette-spring.1.6.0.css} +0 -0
  63. /package/dist/palettes/{palette-spring.1.5.12.min.css → palette-spring.1.6.0.min.css} +0 -0
  64. /package/dist/palettes/{palette-winter.1.5.12.css → palette-winter.1.6.0.css} +0 -0
  65. /package/dist/palettes/{palette-winter.1.5.12.min.css → palette-winter.1.6.0.min.css} +0 -0
@@ -6,7 +6,7 @@
6
6
  * - Supports FormControlLabel for proper label positioning
7
7
  * - Handles required and disabled states
8
8
  * - Helper text support
9
- * - Base props support for grid behavior and styling
9
+ * - Schema-driven architecture with serialization support
10
10
  *
11
11
  * Copyright (c) 2025 QwickApps.com. All rights reserved.
12
12
  */
@@ -18,31 +18,32 @@ import {
18
18
  Checkbox,
19
19
  FormHelperText,
20
20
  } from '@mui/material';
21
- import { useBaseProps, WithBaseProps, QWICKAPP_COMPONENT } from '../../hooks/useBaseProps';
21
+ import type { SchemaProps } from '@qwickapps/schema';
22
+ import FormCheckboxModel from '../../schemas/FormCheckboxSchema';
23
+ import { ViewProps } from '../shared/viewProps';
24
+ import { createSerializableView, SerializableComponent } from '../shared/createSerializableView';
22
25
 
23
- interface FormCheckboxBaseProps {
24
- label: string;
25
- checked: boolean;
26
+ /**
27
+ * Props interface for FormCheckbox component
28
+ * Combines schema props with callback handler
29
+ */
30
+ export interface FormCheckboxProps extends ViewProps, SchemaProps<typeof FormCheckboxModel> {
31
+ /** Callback when checkbox state changes */
26
32
  onChange: (checked: boolean) => void;
27
- helperText?: string;
28
- required?: boolean;
29
- disabled?: boolean;
30
33
  }
31
34
 
32
- export interface FormCheckboxProps extends WithBaseProps<FormCheckboxBaseProps> {}
33
-
34
- export const FormCheckbox = React.forwardRef<HTMLDivElement, FormCheckboxProps>((props, ref) => {
35
- const { gridProps, styleProps, htmlProps, restProps } = useBaseProps(props);
36
-
37
- const {
38
- label,
39
- checked,
40
- onChange,
41
- helperText,
42
- required = false,
43
- disabled = false,
44
- } = restProps as FormCheckboxBaseProps;
45
-
35
+ /**
36
+ * FormCheckboxView - Pure view component that renders the checkbox
37
+ */
38
+ function FormCheckboxView({
39
+ label,
40
+ checked,
41
+ onChange,
42
+ helperText,
43
+ required = false,
44
+ disabled = false,
45
+ ...restProps
46
+ }: FormCheckboxProps) {
46
47
  const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
47
48
  onChange(e.target.checked);
48
49
  };
@@ -65,29 +66,15 @@ export const FormCheckbox = React.forwardRef<HTMLDivElement, FormCheckboxProps>(
65
66
  '& .MuiFormControlLabel-label.Mui-disabled': {
66
67
  color: 'var(--theme-text-disabled)',
67
68
  },
68
- ...styleProps.sx,
69
69
  };
70
70
 
71
71
  const helperTextStyles = {
72
72
  color: 'var(--theme-secondary)',
73
- marginLeft: '32px', // Align with checkbox + label
73
+ marginLeft: '32px',
74
74
  };
75
75
 
76
76
  return (
77
- <FormControl
78
- ref={ref}
79
- {...htmlProps}
80
- {...styleProps}
81
- // Store grid props as data attributes for ColumnLayout to pick up
82
- {...(gridProps && {
83
- 'data-grid-span': gridProps.span,
84
- 'data-grid-xs': gridProps.xs,
85
- 'data-grid-sm': gridProps.sm,
86
- 'data-grid-md': gridProps.md,
87
- 'data-grid-lg': gridProps.lg,
88
- 'data-grid-xl': gridProps.xl,
89
- })}
90
- >
77
+ <FormControl {...restProps}>
91
78
  <FormControlLabel
92
79
  control={
93
80
  <Checkbox
@@ -106,11 +93,16 @@ export const FormCheckbox = React.forwardRef<HTMLDivElement, FormCheckboxProps>(
106
93
  )}
107
94
  </FormControl>
108
95
  );
109
- });
110
-
111
- FormCheckbox.displayName = 'FormCheckbox';
96
+ }
112
97
 
113
- // Mark as QwickApp component
114
- Object.assign(FormCheckbox, { [QWICKAPP_COMPONENT]: true });
98
+ /**
99
+ * Create FormCheckbox component using the factory pattern
100
+ */
101
+ export const FormCheckbox: SerializableComponent<FormCheckboxProps> = createSerializableView<FormCheckboxProps>({
102
+ tagName: 'FormCheckbox',
103
+ version: '1.0.0',
104
+ role: 'input',
105
+ View: FormCheckboxView,
106
+ });
115
107
 
116
108
  export default FormCheckbox;
@@ -4,10 +4,10 @@
4
4
  * Features:
5
5
  * - Uses QwickApps CSS theme variables for consistent styling
6
6
  * - Supports text, number, password, and email input types
7
- * - Integrated with MUI FormControl, Input, and Select
7
+ * - Integrated with MUI FormControl, Input
8
8
  * - Handles readonly, disabled, and required states
9
9
  * - Support for adornments and helper text
10
- * - Base props support for grid behavior and styling
10
+ * - Schema-driven architecture with serialization support
11
11
  *
12
12
  * Copyright (c) 2025 QwickApps.com. All rights reserved.
13
13
  */
@@ -20,63 +20,54 @@ import {
20
20
  FormHelperText,
21
21
  InputAdornment,
22
22
  } from '@mui/material';
23
- import { useBaseProps, WithBaseProps, QWICKAPP_COMPONENT } from '../../hooks/useBaseProps';
23
+ import type { SchemaProps } from '@qwickapps/schema';
24
+ import FormFieldModel from '../../schemas/FormFieldSchema';
25
+ import { ViewProps } from '../shared/viewProps';
26
+ import { createSerializableView, SerializableComponent } from '../shared/createSerializableView';
24
27
 
25
- export interface FormFieldOption {
26
- value: string | number;
27
- label: string;
28
- }
29
-
30
- interface FormFieldBaseProps {
31
- label: string;
32
- value: string | number;
28
+ /**
29
+ * Props interface for FormField component
30
+ * Combines schema props with callback handlers and adornments
31
+ */
32
+ export interface FormFieldProps extends ViewProps, SchemaProps<typeof FormFieldModel> {
33
+ /** Callback when value changes */
33
34
  onChange?: (value: string | number) => void;
35
+ /** Raw change handler with event */
34
36
  onChangeRaw?: (e: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => void;
35
- type?: 'text' | 'number' | 'password' | 'email' | 'tel';
36
- helperText?: string;
37
- required?: boolean;
38
- readOnly?: boolean;
39
- disabled?: boolean;
40
- disabledColor?: string;
41
- fullWidth?: boolean;
42
- multiline?: boolean;
43
- rows?: number;
44
- placeholder?: string;
37
+ /** Start adornment (icon, text, etc.) */
45
38
  startAdornment?: React.ReactNode;
39
+ /** End adornment (icon, text, etc.) */
46
40
  endAdornment?: React.ReactNode;
41
+ /** Additional input props */
47
42
  inputProps?: unknown;
48
43
  }
49
44
 
50
- export interface FormFieldProps extends WithBaseProps<FormFieldBaseProps> {}
51
-
52
- export const FormField = React.forwardRef<HTMLDivElement, FormFieldProps>((props, ref) => {
53
- const { gridProps, styleProps, htmlProps, restProps } = useBaseProps(props);
54
-
55
- const {
56
- label,
57
- value,
58
- onChange,
59
- onChangeRaw,
60
- type = 'text',
61
- helperText,
62
- required = false,
63
- readOnly = false,
64
- disabled = false,
65
- disabledColor,
66
- fullWidth = true,
67
- multiline = false,
68
- rows,
69
- placeholder,
70
- startAdornment,
71
- endAdornment,
72
- inputProps,
73
- } = restProps as FormFieldBaseProps;
74
-
75
- // Generate a unique ID for the input field
45
+ /**
46
+ * FormFieldView - Pure view component that renders the input field
47
+ */
48
+ function FormFieldView({
49
+ label,
50
+ value,
51
+ onChange,
52
+ onChangeRaw,
53
+ type = 'text',
54
+ helperText,
55
+ required = false,
56
+ readOnly = false,
57
+ disabled = false,
58
+ disabledColor,
59
+ fullWidth = true,
60
+ multiline = false,
61
+ rows,
62
+ placeholder,
63
+ startAdornment,
64
+ endAdornment,
65
+ inputProps,
66
+ ...restProps
67
+ }: FormFieldProps) {
76
68
  const fieldId = React.useId();
77
69
 
78
70
  const handleChange = (e: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => {
79
- // If onChangeRaw is provided, use it instead
80
71
  if (onChangeRaw) {
81
72
  onChangeRaw(e);
82
73
  return;
@@ -107,7 +98,6 @@ export const FormField = React.forwardRef<HTMLDivElement, FormFieldProps>((props
107
98
  color: disabledColor,
108
99
  WebkitTextFillColor: disabledColor,
109
100
  } : undefined,
110
- ...styleProps.sx,
111
101
  };
112
102
 
113
103
  const labelStyles = {
@@ -122,19 +112,8 @@ export const FormField = React.forwardRef<HTMLDivElement, FormFieldProps>((props
122
112
 
123
113
  return (
124
114
  <FormControl
125
- ref={ref}
126
115
  fullWidth={fullWidth}
127
- {...htmlProps}
128
- {...styleProps}
129
- // Store grid props as data attributes for ColumnLayout to pick up
130
- {...(gridProps && {
131
- 'data-grid-span': gridProps.span,
132
- 'data-grid-xs': gridProps.xs,
133
- 'data-grid-sm': gridProps.sm,
134
- 'data-grid-md': gridProps.md,
135
- 'data-grid-lg': gridProps.lg,
136
- 'data-grid-xl': gridProps.xl,
137
- })}
116
+ {...restProps}
138
117
  >
139
118
  <InputLabel htmlFor={fieldId} sx={labelStyles} shrink>
140
119
  {label}
@@ -170,11 +149,16 @@ export const FormField = React.forwardRef<HTMLDivElement, FormFieldProps>((props
170
149
  )}
171
150
  </FormControl>
172
151
  );
173
- });
174
-
175
- FormField.displayName = 'FormField';
152
+ }
176
153
 
177
- // Mark as QwickApp component
178
- Object.assign(FormField, { [QWICKAPP_COMPONENT]: true });
154
+ /**
155
+ * Create FormField component using the factory pattern
156
+ */
157
+ export const FormField: SerializableComponent<FormFieldProps> = createSerializableView<FormFieldProps>({
158
+ tagName: 'FormField',
159
+ version: '1.0.0',
160
+ role: 'input',
161
+ View: FormFieldView,
162
+ });
179
163
 
180
164
  export default FormField;
@@ -6,7 +6,7 @@
6
6
  * - Simplified select-only interface (use FormField for mixed inputs)
7
7
  * - Support for placeholder, size variants, and helper text
8
8
  * - Integrated with MUI FormControl and Select
9
- * - Base props support for grid behavior and styling
9
+ * - Schema-driven architecture with serialization support
10
10
  *
11
11
  * Copyright (c) 2025 QwickApps.com. All rights reserved.
12
12
  */
@@ -19,46 +19,45 @@ import {
19
19
  MenuItem,
20
20
  FormHelperText,
21
21
  } from '@mui/material';
22
- import { useBaseProps, WithBaseProps, QWICKAPP_COMPONENT } from '../../hooks/useBaseProps';
22
+ import type { SchemaProps } from '@qwickapps/schema';
23
+ import FormSelectModel from '../../schemas/FormSelectSchema';
24
+ import { ViewProps } from '../shared/viewProps';
25
+ import { createSerializableView, SerializableComponent } from '../shared/createSerializableView';
23
26
 
24
27
  export interface FormSelectOption {
25
28
  value: string | number;
26
29
  label: string;
27
30
  }
28
31
 
29
- interface FormSelectBaseProps {
30
- label?: string;
31
- value: string | number;
32
+ /**
33
+ * Props interface for FormSelect component
34
+ * Combines schema props with callback handlers
35
+ */
36
+ export interface FormSelectProps extends ViewProps, SchemaProps<typeof FormSelectModel> {
37
+ /** Callback when value changes */
32
38
  onChange: (value: string | number) => void;
39
+ /** Options array (runtime prop, overrides schema) */
33
40
  options: FormSelectOption[];
34
- helperText?: string;
35
- required?: boolean;
36
- disabled?: boolean;
37
- fullWidth?: boolean;
38
- size?: 'small' | 'medium';
39
- placeholder?: string;
40
41
  }
41
42
 
42
- export interface FormSelectProps extends WithBaseProps<FormSelectBaseProps> {}
43
-
44
- export const FormSelect = React.forwardRef<HTMLDivElement, FormSelectProps>((props, ref) => {
45
- const { gridProps, styleProps, htmlProps, restProps } = useBaseProps(props);
46
-
47
- const {
48
- label,
49
- value,
50
- onChange,
51
- options,
52
- helperText,
53
- required = false,
54
- disabled = false,
55
- fullWidth = true,
56
- size = 'small',
57
- placeholder,
58
- } = restProps as FormSelectBaseProps;
59
-
60
- const handleChange = (e: unknown) => {
61
- onChange(e.target.value);
43
+ /**
44
+ * FormSelectView - Pure view component that renders the select field
45
+ */
46
+ function FormSelectView({
47
+ label,
48
+ value,
49
+ onChange,
50
+ options,
51
+ helperText,
52
+ required = false,
53
+ disabled = false,
54
+ fullWidth = true,
55
+ size = 'small',
56
+ placeholder,
57
+ ...restProps
58
+ }: FormSelectProps) {
59
+ const handleChange = (e: { target: { value: unknown } }) => {
60
+ onChange(e.target.value as string | number);
62
61
  };
63
62
 
64
63
  const selectStyles = {
@@ -69,7 +68,6 @@ export const FormSelect = React.forwardRef<HTMLDivElement, FormSelectProps>((pro
69
68
  borderColor: 'var(--theme-surface)',
70
69
  color: 'var(--theme-text-primary)',
71
70
  borderRadius: 1,
72
- ...styleProps.sx,
73
71
  };
74
72
 
75
73
  const labelStyles = {
@@ -84,20 +82,9 @@ export const FormSelect = React.forwardRef<HTMLDivElement, FormSelectProps>((pro
84
82
 
85
83
  return (
86
84
  <FormControl
87
- ref={ref}
88
85
  fullWidth={fullWidth}
89
86
  size={size}
90
- {...htmlProps}
91
- {...styleProps}
92
- // Store grid props as data attributes for ColumnLayout to pick up
93
- {...(gridProps && {
94
- 'data-grid-span': gridProps.span,
95
- 'data-grid-xs': gridProps.xs,
96
- 'data-grid-sm': gridProps.sm,
97
- 'data-grid-md': gridProps.md,
98
- 'data-grid-lg': gridProps.lg,
99
- 'data-grid-xl': gridProps.xl,
100
- })}
87
+ {...restProps}
101
88
  >
102
89
  {label && (
103
90
  <InputLabel sx={labelStyles} shrink>
@@ -130,11 +117,16 @@ export const FormSelect = React.forwardRef<HTMLDivElement, FormSelectProps>((pro
130
117
  )}
131
118
  </FormControl>
132
119
  );
133
- });
134
-
135
- FormSelect.displayName = 'FormSelect';
120
+ }
136
121
 
137
- // Mark as QwickApp component
138
- Object.assign(FormSelect, { [QWICKAPP_COMPONENT]: true });
122
+ /**
123
+ * Create FormSelect component using the factory pattern
124
+ */
125
+ export const FormSelect: SerializableComponent<FormSelectProps> = createSerializableView<FormSelectProps>({
126
+ tagName: 'FormSelect',
127
+ version: '1.0.0',
128
+ role: 'input',
129
+ View: FormSelectView,
130
+ });
139
131
 
140
132
  export default FormSelect;
@@ -82,10 +82,43 @@ export interface BaseComponentProps {
82
82
  */
83
83
  export const QWICKAPP_COMPONENT = Symbol('QwickAppComponent');
84
84
 
85
+ /**
86
+ * Return type for useBaseProps hook
87
+ */
88
+ export interface BasePropsResult<T extends BaseComponentProps> {
89
+ gridProps: {
90
+ span?: number | 'auto' | 'grow';
91
+ xs?: number | 'auto';
92
+ sm?: number | 'auto';
93
+ md?: number | 'auto';
94
+ lg?: number | 'auto';
95
+ xl?: number | 'auto';
96
+ } | null;
97
+ styleProps: {
98
+ className?: string;
99
+ sx?: SxProps<Theme>;
100
+ style?: React.CSSProperties;
101
+ };
102
+ htmlProps: {
103
+ id?: string;
104
+ role?: string;
105
+ 'aria-label'?: string;
106
+ 'aria-labelledby'?: string;
107
+ 'aria-describedby'?: string;
108
+ 'data-testid'?: string;
109
+ onClick?: React.MouseEventHandler<unknown>;
110
+ onMouseEnter?: React.MouseEventHandler<unknown>;
111
+ onMouseLeave?: React.MouseEventHandler<unknown>;
112
+ onFocus?: React.FocusEventHandler<unknown>;
113
+ onBlur?: React.FocusEventHandler<unknown>;
114
+ };
115
+ restProps: Omit<T, keyof BaseComponentProps>;
116
+ }
117
+
85
118
  /**
86
119
  * Hook to process base component props
87
120
  */
88
- export function useBaseProps<T extends BaseComponentProps>(props: T) {
121
+ export function useBaseProps<T extends BaseComponentProps>(props: T): BasePropsResult<T> {
89
122
  const {
90
123
  // Grid props
91
124
  span,
@@ -0,0 +1,65 @@
1
+ /**
2
+ * Schema for Captcha component - Universal CAPTCHA widget
3
+ *
4
+ * Copyright (c) 2025 QwickApps.com. All rights reserved.
5
+ */
6
+
7
+ import { IsIn, IsOptional, IsString } from 'class-validator';
8
+ import 'reflect-metadata';
9
+ import { Editor, Field, Schema, FieldType } from '@qwickapps/schema';
10
+ import ViewSchema from './ViewSchema';
11
+
12
+ @Schema('Captcha', '1.0.0')
13
+ export class CaptchaModel extends ViewSchema {
14
+ @Field()
15
+ @Editor({
16
+ field_type: FieldType.SELECT,
17
+ label: 'CAPTCHA Provider',
18
+ description: 'Which CAPTCHA service to use'
19
+ })
20
+ @IsIn(['recaptcha-v2', 'recaptcha-v3', 'hcaptcha', 'turnstile'])
21
+ provider!: 'recaptcha-v2' | 'recaptcha-v3' | 'hcaptcha' | 'turnstile';
22
+
23
+ @Field()
24
+ @Editor({
25
+ field_type: FieldType.TEXT,
26
+ label: 'Site Key',
27
+ description: 'Public site key from CAPTCHA provider',
28
+ placeholder: 'Enter site key...'
29
+ })
30
+ @IsString()
31
+ siteKey!: string;
32
+
33
+ @Field({ defaultValue: 'light' })
34
+ @Editor({
35
+ field_type: FieldType.SELECT,
36
+ label: 'Theme',
37
+ description: 'CAPTCHA widget theme'
38
+ })
39
+ @IsOptional()
40
+ @IsIn(['light', 'dark'])
41
+ theme?: 'light' | 'dark';
42
+
43
+ @Field({ defaultValue: 'normal' })
44
+ @Editor({
45
+ field_type: FieldType.SELECT,
46
+ label: 'Size',
47
+ description: 'CAPTCHA widget size'
48
+ })
49
+ @IsOptional()
50
+ @IsIn(['normal', 'compact', 'invisible'])
51
+ size?: 'normal' | 'compact' | 'invisible';
52
+
53
+ @Field({ defaultValue: 'submit' })
54
+ @Editor({
55
+ field_type: FieldType.TEXT,
56
+ label: 'Action',
57
+ description: 'reCAPTCHA v3 action name',
58
+ placeholder: 'submit'
59
+ })
60
+ @IsOptional()
61
+ @IsString()
62
+ action?: string;
63
+ }
64
+
65
+ export default CaptchaModel;
@@ -0,0 +1,65 @@
1
+ /**
2
+ * Schema for FormCheckbox component - Themed checkbox input
3
+ *
4
+ * Copyright (c) 2025 QwickApps.com. All rights reserved.
5
+ */
6
+
7
+ import { IsBoolean, IsOptional, IsString } from 'class-validator';
8
+ import 'reflect-metadata';
9
+ import { Editor, Field, Schema, FieldType } from '@qwickapps/schema';
10
+ import ViewSchema from './ViewSchema';
11
+
12
+ @Schema('FormCheckbox', '1.0.0')
13
+ export class FormCheckboxModel extends ViewSchema {
14
+ @Field()
15
+ @Editor({
16
+ field_type: FieldType.TEXT,
17
+ label: 'Label',
18
+ description: 'Label text for the checkbox',
19
+ placeholder: 'Enter label...'
20
+ })
21
+ @IsString()
22
+ label!: string;
23
+
24
+ @Field({ defaultValue: false })
25
+ @Editor({
26
+ field_type: FieldType.BOOLEAN,
27
+ label: 'Checked',
28
+ description: 'Checkbox checked state'
29
+ })
30
+ @IsBoolean()
31
+ checked!: boolean;
32
+
33
+ @Field()
34
+ @Editor({
35
+ field_type: FieldType.TEXT,
36
+ label: 'Helper Text',
37
+ description: 'Helper text displayed below the checkbox',
38
+ placeholder: 'Enter helper text...'
39
+ })
40
+ @IsOptional()
41
+ @IsString()
42
+ helperText?: string;
43
+
44
+ @Field({ defaultValue: false })
45
+ @Editor({
46
+ field_type: FieldType.BOOLEAN,
47
+ label: 'Required',
48
+ description: 'Mark checkbox as required'
49
+ })
50
+ @IsOptional()
51
+ @IsBoolean()
52
+ required?: boolean;
53
+
54
+ @Field({ defaultValue: false })
55
+ @Editor({
56
+ field_type: FieldType.BOOLEAN,
57
+ label: 'Disabled',
58
+ description: 'Disable the checkbox'
59
+ })
60
+ @IsOptional()
61
+ @IsBoolean()
62
+ disabled?: boolean;
63
+ }
64
+
65
+ export default FormCheckboxModel;