@bsol-oss/react-datatable5 13.0.1-beta.2 → 13.0.1-beta.21

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 (45) hide show
  1. package/README.md +5 -326
  2. package/dist/index.d.ts +126 -291
  3. package/dist/index.js +2592 -2546
  4. package/dist/index.mjs +2597 -2547
  5. package/dist/types/components/DataTable/context/DataTableContext.d.ts +3 -0
  6. package/dist/types/components/DataTable/controls/ColumnFilterMenu.d.ts +20 -0
  7. package/dist/types/components/DataTable/controls/MobileTableControls.d.ts +1 -1
  8. package/dist/types/components/DataTable/controls/TableControls.d.ts +1 -3
  9. package/dist/types/components/DataTable/controls/TableFilterTags.d.ts +10 -1
  10. package/dist/types/components/DataTable/display/DataDisplay.d.ts +1 -1
  11. package/dist/types/components/DataTable/display/TableCardContainer.d.ts +5 -5
  12. package/dist/types/components/DataTable/hooks/useResponsiveColumnVisibility.d.ts +1 -1
  13. package/dist/types/components/DataTable/useDataTableServer.d.ts +1 -1
  14. package/dist/types/components/DataTable/utils/selectors.d.ts +1 -1
  15. package/dist/types/components/DatePicker/Calendar.d.ts +2 -0
  16. package/dist/types/components/DatePicker/DatePicker.d.ts +27 -0
  17. package/dist/types/components/DatePicker/DateTimePicker.d.ts +20 -4
  18. package/dist/types/components/DatePicker/UniversalPicker.d.ts +2 -3
  19. package/dist/types/components/DatePicker/index.d.ts +1 -2
  20. package/dist/types/components/Form/SchemaFormContext.d.ts +3 -11
  21. package/dist/types/components/Form/components/core/FormRoot.d.ts +30 -14
  22. package/dist/types/components/Form/components/fields/FilePicker.d.ts +1 -1
  23. package/dist/types/components/Form/components/fields/StringInputField.d.ts +0 -5
  24. package/dist/types/components/Form/components/fields/TagPicker.d.ts +1 -1
  25. package/dist/types/components/Form/components/fields/useIdPickerData.d.ts +4 -0
  26. package/dist/types/components/Form/components/types/CustomJSONSchema7.d.ts +25 -5
  27. package/dist/types/components/Form/components/viewers/EnumViewer.d.ts +1 -1
  28. package/dist/types/components/Form/components/viewers/FileViewer.d.ts +7 -5
  29. package/dist/types/components/Form/components/viewers/TagViewer.d.ts +1 -1
  30. package/dist/types/components/Form/useForm.d.ts +2 -5
  31. package/dist/types/components/Form/utils/ajvResolver.d.ts +4 -0
  32. package/dist/types/components/Form/utils/getNestedError.d.ts +12 -0
  33. package/dist/types/components/Form/utils/getTableData.d.ts +1 -2
  34. package/dist/types/components/Form/utils/useFormLabel.d.ts +12 -0
  35. package/dist/types/components/TextArea/TextArea.d.ts +4 -19
  36. package/dist/types/components/TimePicker/TimePicker.d.ts +9 -8
  37. package/dist/types/index.d.ts +10 -2
  38. package/package.json +7 -4
  39. package/dist/types/components/DatePicker/DatePickerInput.d.ts +0 -18
  40. package/dist/types/components/DatePicker/IsoTimePicker.d.ts +0 -24
  41. package/dist/types/components/DatePicker/PickerDemo.d.ts +0 -1
  42. package/dist/types/components/Form/utils/buildErrorMessages.d.ts +0 -223
  43. package/dist/types/components/Form/utils/getFieldError.d.ts +0 -6
  44. package/dist/types/components/Form/utils/useFormI18n.d.ts +0 -57
  45. package/dist/types/components/ui/number-input.d.ts +0 -8
@@ -1,22 +1,23 @@
1
- import { Dispatch, SetStateAction } from 'react';
1
+ import React from 'react';
2
2
  import { TimePickerLabels } from '../Form/components/types/CustomJSONSchema7';
3
- interface TimePickerProps {
3
+ export interface TimePickerProps {
4
4
  hour: number | null;
5
- setHour: Dispatch<SetStateAction<number | null>>;
5
+ setHour: (hour: number | null) => void;
6
6
  minute: number | null;
7
- setMinute: Dispatch<SetStateAction<number | null>>;
7
+ setMinute: (minute: number | null) => void;
8
8
  meridiem: 'am' | 'pm' | null;
9
- setMeridiem: Dispatch<SetStateAction<'am' | 'pm' | null>>;
10
- onChange?: (newValue: {
9
+ setMeridiem: (meridiem: 'am' | 'pm' | null) => void;
10
+ onChange?: (params: {
11
11
  hour: number | null;
12
12
  minute: number | null;
13
13
  meridiem: 'am' | 'pm' | null;
14
14
  }) => void;
15
+ format?: '12h' | '24h';
16
+ showSeconds?: boolean;
15
17
  startTime?: string;
16
18
  selectedDate?: string;
17
19
  timezone?: string;
18
20
  portalled?: boolean;
19
21
  labels?: TimePickerLabels;
20
22
  }
21
- export declare const TimePicker: ({ hour, setHour, minute, setMinute, meridiem, setMeridiem, onChange, startTime, selectedDate, timezone, portalled, labels, }: TimePickerProps) => import("react/jsx-runtime").JSX.Element;
22
- export {};
23
+ export declare const TimePicker: React.FC<TimePickerProps>;
@@ -76,6 +76,16 @@ declare module '@tanstack/react-table' {
76
76
  * Only applies when canResize={false}.
77
77
  */
78
78
  responsivePriority?: number;
79
+ /**
80
+ * Grid column span for data display layout.
81
+ * Used in DataDisplay component.
82
+ */
83
+ gridColumn?: string | string[];
84
+ /**
85
+ * Grid row span for data display layout.
86
+ * Used in DataDisplay component.
87
+ */
88
+ gridRow?: string | object;
79
89
  }
80
90
  }
81
91
  export type { TableHeaderTexts } from './components/DataTable/display/TableHeader';
@@ -121,12 +131,10 @@ export * from './components/Form/components/core/FormBody';
121
131
  export * from './components/Form/components/types/CustomJSONSchema7';
122
132
  export * from './components/Form/components/MediaLibraryBrowser';
123
133
  export * from './components/Form/useForm';
124
- export * from './components/Form/utils/buildErrorMessages';
125
134
  export * from './components/DatePicker/DatePicker';
126
135
  export * from './components/DatePicker/getMultiDates';
127
136
  export * from './components/DatePicker/getRangeDates';
128
137
  export * from './components/DatePicker/RangeDatePicker';
129
- export * from './components/DatePicker/DatePickerInput';
130
138
  export * from './components/DataTable/display/RecordDisplay';
131
139
  export * from './components/DataTable/display/TableDataDisplay';
132
140
  export * from './components/DataTable/DefaultTable';
package/package.json CHANGED
@@ -1,11 +1,14 @@
1
1
  {
2
2
  "name": "@bsol-oss/react-datatable5",
3
- "version": "13.0.1-beta.2",
3
+ "version": "13.0.1-beta.21",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
7
7
  "types": "dist/index.d.ts",
8
- "repository": "https://github.com/bsol-oss/react-datatable5.git",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/bsol-oss/react-datatable5.git"
11
+ },
9
12
  "homepage": "https://github.com/bsol-oss/react-datatable5#react-datatable5",
10
13
  "author": "screw123",
11
14
  "license": "MIT",
@@ -46,7 +49,7 @@
46
49
  "ajv": "^8.12.0",
47
50
  "ajv-errors": "^3.0.0",
48
51
  "ajv-formats": "^3.0.1",
49
- "axios": "^1.7.9",
52
+ "axios": "^1.13.2",
50
53
  "dayjs": "^1.11.13",
51
54
  "next-themes": "^0.4.4",
52
55
  "react": "^19.0.0",
@@ -80,7 +83,7 @@
80
83
  "lint-staged": "^16.2.5",
81
84
  "prettier": "3.2.5",
82
85
  "rollup-plugin-dts": "^6.1.0",
83
- "storybook": "^10.0.7",
86
+ "storybook": "^10.1.11",
84
87
  "typescript": "^5.2.2",
85
88
  "vite": "^5.2.0"
86
89
  },
@@ -1,18 +0,0 @@
1
- import { DatePickerLabels } from './DatePicker';
2
- export interface DatePickerInputProps {
3
- value?: string | Date;
4
- onChange?: (date?: string) => void;
5
- placeholder?: string;
6
- dateFormat?: string;
7
- displayFormat?: string;
8
- labels?: DatePickerLabels;
9
- timezone?: string;
10
- minDate?: Date;
11
- maxDate?: Date;
12
- firstDayOfWeek?: 0 | 1 | 2 | 3 | 4 | 5 | 6;
13
- showOutsideDays?: boolean;
14
- monthsToDisplay?: number;
15
- insideDialog?: boolean;
16
- readOnly?: boolean;
17
- }
18
- export declare function DatePickerInput({ value, onChange, placeholder, dateFormat, displayFormat, labels, timezone, minDate, maxDate, firstDayOfWeek, showOutsideDays, monthsToDisplay, insideDialog, readOnly, }: DatePickerInputProps): import("react/jsx-runtime").JSX.Element;
@@ -1,24 +0,0 @@
1
- import { Dispatch, SetStateAction } from 'react';
2
- interface IsoTimePickerProps {
3
- hour: number | null;
4
- setHour: Dispatch<SetStateAction<number | null>>;
5
- minute: number | null;
6
- setMinute: Dispatch<SetStateAction<number | null>>;
7
- second: number | null;
8
- setSecond: Dispatch<SetStateAction<number | null>>;
9
- onChange?: (newValue: {
10
- hour: number | null;
11
- minute: number | null;
12
- second: number | null;
13
- }) => void;
14
- startTime?: string;
15
- selectedDate?: string;
16
- timezone?: string;
17
- portalled?: boolean;
18
- labels?: {
19
- placeholder?: string;
20
- emptyMessage?: string;
21
- };
22
- }
23
- export declare function IsoTimePicker({ hour, setHour, minute, setMinute, second, setSecond, onChange, startTime, selectedDate, timezone, portalled, labels, }: IsoTimePickerProps): import("react/jsx-runtime").JSX.Element;
24
- export {};
@@ -1 +0,0 @@
1
- export declare function PickerDemo(): import("react/jsx-runtime").JSX.Element;
@@ -1,223 +0,0 @@
1
- /**
2
- * Type definitions for error message configuration
3
- */
4
- /**
5
- * Common validation error types that can be customized
6
- */
7
- export type ValidationErrorType = 'minLength' | 'maxLength' | 'pattern' | 'minimum' | 'maximum' | 'multipleOf' | 'format' | 'type' | 'enum' | 'required' | 'minItems' | 'maxItems' | 'uniqueItems' | 'minProperties' | 'maxProperties' | 'anyOf' | 'oneOf' | 'allOf' | 'const' | 'additionalProperties' | 'dependencies';
8
- /**
9
- * Configuration for field-specific validation errors
10
- */
11
- export type FieldErrorConfig = Partial<Record<ValidationErrorType, string>>;
12
- /**
13
- * Configuration for building error messages
14
- */
15
- export interface ErrorMessageConfig {
16
- /**
17
- * Required field error messages
18
- * Maps field names to their required error messages
19
- * Supports both plain strings and i18n translation keys
20
- *
21
- * @example
22
- * ```typescript
23
- * required: {
24
- * username: "Username is required", // plain string
25
- * email: "user.email.field_required" // i18n key
26
- * }
27
- * ```
28
- */
29
- required?: Record<string, string>;
30
- /**
31
- * Field-specific validation error messages
32
- * Maps field names to their validation error configurations
33
- *
34
- * @example
35
- * ```typescript
36
- * properties: {
37
- * username: {
38
- * minLength: "Username must be at least 3 characters",
39
- * pattern: "Username can only contain letters and numbers"
40
- * },
41
- * age: {
42
- * minimum: "Age must be at least 18",
43
- * maximum: "Age cannot exceed 120"
44
- * }
45
- * }
46
- * ```
47
- */
48
- properties?: Record<string, FieldErrorConfig>;
49
- /**
50
- * Global fallback error messages for validation types
51
- * These are used when no field-specific message is provided
52
- *
53
- * @example
54
- * ```typescript
55
- * {
56
- * minLength: "This field is too short",
57
- * minimum: "Value is too small"
58
- * }
59
- * ```
60
- */
61
- [key: string]: any;
62
- }
63
- /**
64
- * Result of buildErrorMessages that follows ajv-errors format
65
- */
66
- export interface ErrorMessageResult {
67
- required?: Record<string, string>;
68
- properties?: Record<string, FieldErrorConfig>;
69
- [key: string]: any;
70
- }
71
- /**
72
- * Schema-level error message builder
73
- *
74
- * Builds a complete errorMessage object compatible with ajv-errors plugin.
75
- * Supports both i18n translation keys and plain string messages.
76
- *
77
- * @param config - Error message configuration
78
- * @returns Complete errorMessage object for JSON Schema
79
- *
80
- * @example
81
- * ```typescript
82
- * // Simple required field errors
83
- * const errorMessage = buildErrorMessages({
84
- * required: {
85
- * username: "Username is required",
86
- * email: "user.email.field_required" // i18n key
87
- * }
88
- * });
89
- *
90
- * // With validation rules
91
- * const errorMessage = buildErrorMessages({
92
- * required: {
93
- * password: "Password is required"
94
- * },
95
- * properties: {
96
- * password: {
97
- * minLength: "Password must be at least 8 characters",
98
- * pattern: "Password must contain letters and numbers"
99
- * },
100
- * age: {
101
- * minimum: "Must be 18 or older",
102
- * maximum: "Must be under 120"
103
- * }
104
- * }
105
- * });
106
- *
107
- * // With global fallbacks
108
- * const errorMessage = buildErrorMessages({
109
- * required: {
110
- * email: "Email is required"
111
- * },
112
- * minLength: "This field is too short", // applies to all fields
113
- * minimum: "Value is too small"
114
- * });
115
- * ```
116
- */
117
- export declare const buildErrorMessages: (config: ErrorMessageConfig) => ErrorMessageResult;
118
- /**
119
- * Converts buildErrorMessages result to ajv-errors compatible format
120
- */
121
- export declare const convertToAjvErrorsFormat: (errorMessages: ErrorMessageResult) => Record<string, any>;
122
- /**
123
- * Helper function to build required field errors
124
- *
125
- * Simplifies creating required field error messages, especially useful
126
- * for generating i18n translation keys following a pattern.
127
- *
128
- * @param fields - Array of required field names
129
- * @param messageOrGenerator - Either a string template or function to generate messages
130
- * @returns Required field error configuration
131
- *
132
- * @example
133
- * ```typescript
134
- * // Plain string messages
135
- * const required = buildRequiredErrors(
136
- * ["username", "email", "password"],
137
- * (field) => `${field} is required`
138
- * );
139
- * // Result: { username: "username is required", email: "email is required", ... }
140
- *
141
- * // i18n translation keys
142
- * const required = buildRequiredErrors(
143
- * ["username", "email"],
144
- * (field) => `user.${field}.field_required`
145
- * );
146
- * // Result: { username: "user.username.field_required", email: "user.email.field_required" }
147
- *
148
- * // Same message for all fields
149
- * const required = buildRequiredErrors(
150
- * ["username", "email"],
151
- * "This field is required"
152
- * );
153
- * // Result: { username: "This field is required", email: "This field is required" }
154
- *
155
- * // With keyPrefix for i18n
156
- * const required = buildRequiredErrors(
157
- * ["username", "email"],
158
- * (field) => `${field}.field_required`,
159
- * "user"
160
- * );
161
- * // Result: { username: "user.username.field_required", email: "user.email.field_required" }
162
- * ```
163
- */
164
- export declare const buildRequiredErrors: (fields: string[], messageOrGenerator: string | ((field: string) => string), keyPrefix?: string) => Record<string, string>;
165
- /**
166
- * Helper function to build field-specific validation errors
167
- *
168
- * Creates property-specific error messages for multiple fields at once.
169
- *
170
- * @param config - Maps field names to their validation error configurations
171
- * @returns Properties error configuration
172
- *
173
- * @example
174
- * ```typescript
175
- * const properties = buildFieldErrors({
176
- * username: {
177
- * minLength: "Username must be at least 3 characters",
178
- * pattern: "Username can only contain letters and numbers"
179
- * },
180
- * age: {
181
- * minimum: "Must be 18 or older",
182
- * maximum: "Must be under 120"
183
- * },
184
- * email: {
185
- * format: "Please enter a valid email address"
186
- * }
187
- * });
188
- * ```
189
- */
190
- export declare const buildFieldErrors: (config: Record<string, FieldErrorConfig>) => Record<string, FieldErrorConfig>;
191
- /**
192
- * Helper function to create a complete error message configuration in one call
193
- *
194
- * Convenient wrapper that combines required and validation errors.
195
- *
196
- * @param required - Required field error messages
197
- * @param properties - Field-specific validation error messages
198
- * @param globalFallbacks - Global fallback error messages
199
- * @returns Complete error message configuration
200
- *
201
- * @example
202
- * ```typescript
203
- * const errorMessage = createErrorMessage(
204
- * {
205
- * username: "Username is required",
206
- * email: "Email is required"
207
- * },
208
- * {
209
- * username: {
210
- * minLength: "Username must be at least 3 characters"
211
- * },
212
- * email: {
213
- * format: "Please enter a valid email"
214
- * }
215
- * },
216
- * {
217
- * minLength: "This field is too short",
218
- * format: "Invalid format"
219
- * }
220
- * );
221
- * ```
222
- */
223
- export declare const createErrorMessage: (required?: Record<string, string>, properties?: Record<string, FieldErrorConfig>, globalFallbacks?: Partial<Record<ValidationErrorType, string>>) => ErrorMessageResult;
@@ -1,6 +0,0 @@
1
- import { FieldErrors } from 'react-hook-form';
2
- /**
3
- * Gets the error message for a specific field from react-hook-form errors
4
- * Prioritizes required errors (#.required) over field-specific validation errors
5
- */
6
- export declare const getFieldError: (errors: FieldErrors, fieldName: string) => string | undefined;
@@ -1,57 +0,0 @@
1
- /**
2
- * Custom hook for form field labels and fallback text.
3
- * Automatically handles colLabel construction and removeIndex logic.
4
- * Uses schema.title when available, otherwise falls back to translate function.
5
- *
6
- * @param column - The column name
7
- * @param prefix - The prefix for the field (usually empty string or parent path)
8
- * @param schema - Optional schema object with title property
9
- * @returns Object with label helper functions
10
- *
11
- * @example
12
- * ```tsx
13
- * const formI18n = useFormI18n(column, prefix, schema);
14
- *
15
- * // Get field label (prefers schema.title)
16
- * <Field label={formI18n.label()} />
17
- *
18
- * // Get required error message
19
- * <Text>{formI18n.required()}</Text>
20
- *
21
- * // Get custom text
22
- * <Text>{formI18n.t('add_more')}</Text>
23
- *
24
- * // Access the raw colLabel
25
- * const colLabel = formI18n.colLabel;
26
- * ```
27
- */
28
- export declare const useFormI18n: (column: string, prefix?: string, schema?: {
29
- title?: string;
30
- }) => {
31
- /**
32
- * The constructed column label (prefix + column)
33
- */
34
- colLabel: string;
35
- /**
36
- * Get the field label from schema title prop, or fall back to translate function
37
- * Uses schema.title if available, otherwise: translate.t(removeIndex(`${colLabel}.field_label`))
38
- */
39
- label: (options?: any) => string;
40
- /**
41
- * Get the required error message
42
- * Equivalent to: translate.t(removeIndex(`${colLabel}.field_required`))
43
- */
44
- required: (options?: any) => string;
45
- /**
46
- * Get text for any custom key relative to the field
47
- * Equivalent to: translate.t(removeIndex(`${colLabel}.${key}`))
48
- *
49
- * @param key - The key suffix (e.g., 'add_more', 'total', etc.)
50
- * @param options - Optional options (e.g., defaultValue, interpolation variables)
51
- */
52
- t: (key: string, options?: any) => string;
53
- /**
54
- * Access to the original translate object for edge cases
55
- */
56
- translate: import("../useForm").Translate;
57
- };
@@ -1,8 +0,0 @@
1
- import { NumberInput as ChakraNumberInput } from "@chakra-ui/react";
2
- import * as React from "react";
3
- export interface NumberInputProps extends ChakraNumberInput.RootProps {
4
- }
5
- export declare const NumberInputRoot: React.ForwardRefExoticComponent<NumberInputProps & React.RefAttributes<HTMLDivElement>>;
6
- export declare const NumberInputField: React.ForwardRefExoticComponent<ChakraNumberInput.InputProps & React.RefAttributes<HTMLInputElement>>;
7
- export declare const NumberInputScrubber: React.ForwardRefExoticComponent<ChakraNumberInput.ScrubberProps & React.RefAttributes<HTMLDivElement>>;
8
- export declare const NumberInputLabel: React.ForwardRefExoticComponent<ChakraNumberInput.LabelProps & React.RefAttributes<HTMLLabelElement>>;