@ayasofyazilim/ui 0.0.1 → 0.0.2
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/package.json +1 -1
- package/src/components/accordion.tsx +2 -2
- package/src/components/alert-dialog.tsx +5 -5
- package/src/components/alert.tsx +4 -4
- package/src/components/avatar.tsx +3 -3
- package/src/components/badge.tsx +2 -2
- package/src/components/breadcrumb.tsx +2 -2
- package/src/components/button-group.tsx +5 -5
- package/src/components/button.tsx +4 -3
- package/src/components/calendar.tsx +21 -24
- package/src/components/card.tsx +4 -4
- package/src/components/carousel.tsx +8 -8
- package/src/components/chart.tsx +11 -11
- package/src/components/checkbox.tsx +2 -2
- package/src/components/command.tsx +8 -8
- package/src/components/context-menu.tsx +9 -9
- package/src/components/dialog.tsx +4 -4
- package/src/components/drawer.tsx +4 -4
- package/src/components/dropdown-menu.tsx +9 -9
- package/src/components/field.tsx +13 -13
- package/src/components/form.tsx +4 -4
- package/src/components/hover-card.tsx +2 -2
- package/src/components/input-group.tsx +10 -10
- package/src/components/input-otp.tsx +3 -3
- package/src/components/input.tsx +2 -2
- package/src/components/item.tsx +9 -9
- package/src/components/kbd.tsx +2 -2
- package/src/components/label.tsx +2 -2
- package/src/components/menubar.tsx +11 -11
- package/src/components/navigation-menu.tsx +9 -9
- package/src/components/pagination.tsx +3 -6
- package/src/components/progress.tsx +2 -2
- package/src/components/radio-group.tsx +2 -2
- package/src/components/resizable.tsx +3 -3
- package/src/components/scroll-area.tsx +2 -2
- package/src/components/select.tsx +7 -7
- package/src/components/separator.tsx +2 -2
- package/src/components/sheet.tsx +3 -3
- package/src/components/skeleton.tsx +1 -1
- package/src/components/slider.tsx +5 -5
- package/src/components/spinner.tsx +1 -1
- package/src/components/stepper.tsx +10 -11
- package/src/components/switch.tsx +3 -3
- package/src/components/table.tsx +5 -5
- package/src/components/tabs.tsx +3 -3
- package/src/components/textarea.tsx +2 -2
- package/src/components/toggle-group.tsx +4 -4
- package/src/components/toggle.tsx +2 -2
- package/src/components/tooltip.tsx +2 -2
- package/src/custom/action-button.tsx +3 -6
- package/src/custom/async-select.tsx +12 -12
- package/src/custom/awesome-not-found.tsx +4 -4
- package/src/custom/charts/area-chart.tsx +2 -2
- package/src/custom/charts/bar-chart.tsx +2 -2
- package/src/custom/charts/chart-card.tsx +4 -4
- package/src/custom/charts/pie-chart.tsx +4 -4
- package/src/custom/charts/radar-chart.tsx +2 -2
- package/src/custom/combobox.tsx +18 -18
- package/src/custom/confirm-dialog.tsx +3 -3
- package/src/custom/country-selector.tsx +7 -7
- package/src/custom/date-picker/calendar-rac.tsx +5 -5
- package/src/custom/date-picker/datefield-rac.tsx +6 -6
- package/src/custom/date-picker/index.tsx +9 -9
- package/src/custom/date-picker-old.tsx +5 -5
- package/src/custom/date-tooltip.tsx +1 -1
- package/src/custom/document-scanner/corner-adjustment/action-buttons.tsx +2 -2
- package/src/custom/document-scanner/corner-adjustment/corner-handle.tsx +3 -3
- package/src/custom/document-scanner/index.tsx +8 -8
- package/src/custom/document-viewer/controllers.tsx +3 -3
- package/src/custom/document-viewer/index.tsx +1 -1
- package/src/custom/document-viewer/renderers/pdf.tsx +3 -3
- package/src/custom/email-input/email.tsx +16 -14
- package/src/custom/file-uploader.tsx +6 -6
- package/src/custom/filter-component/fields/async-select.tsx +1 -1
- package/src/custom/filter-component/fields/date.tsx +3 -3
- package/src/custom/filter-component/fields/multi-select.tsx +1 -1
- package/src/custom/filter-component/index.tsx +9 -9
- package/src/custom/image-canvas.tsx +5 -5
- package/src/custom/master-data-grid/components/filters/client-filter.tsx +6 -5
- package/src/custom/master-data-grid/components/filters/multi-filter-dialog.tsx +5 -4
- package/src/custom/master-data-grid/components/filters/server-filter.tsx +12 -11
- package/src/custom/master-data-grid/components/table/cell-renderer.tsx +26 -26
- package/src/custom/master-data-grid/hooks/use-columns.tsx +3 -3
- package/src/custom/master-data-grid/types.ts +5 -4
- package/src/custom/multi-select.tsx +21 -19
- package/src/custom/password-input.tsx +11 -11
- package/src/custom/phone-input.tsx +3 -3
- package/src/custom/schema-form/custom/label.tsx +3 -3
- package/src/custom/schema-form/fields/base-input-field.tsx +4 -4
- package/src/custom/schema-form/fields/field.tsx +4 -4
- package/src/custom/schema-form/fields/table-array/array-field-item.tsx +5 -5
- package/src/custom/schema-form/fields/table-array/array-field-template.tsx +6 -6
- package/src/custom/schema-form/index.tsx +13 -13
- package/src/custom/schema-form/templates/description.tsx +1 -1
- package/src/custom/schema-form/templates/submit.tsx +2 -2
- package/src/custom/schema-form/utils/schemas.ts +9 -9
- package/src/custom/schema-form/widgets/boolean.tsx +5 -5
- package/src/custom/schema-form/widgets/combobox.tsx +13 -13
- package/src/custom/schema-form/widgets/date.tsx +1 -1
- package/src/custom/schema-form/widgets/email.tsx +2 -2
- package/src/custom/schema-form/widgets/password.tsx +1 -1
- package/src/custom/schema-form/widgets/phone.tsx +3 -3
- package/src/custom/schema-form/widgets/select.tsx +5 -5
- package/src/custom/schema-form/widgets/selectable.tsx +2 -2
- package/src/custom/schema-form/widgets/string-array.tsx +16 -16
- package/src/custom/schema-form/widgets/url.tsx +2 -2
- package/src/custom/section-layout-v2.tsx +8 -8
- package/src/custom/select-tabs.tsx +2 -2
- package/src/custom/stepper.tsx +4 -4
- package/src/custom/tab-layout.tsx +6 -6
- package/src/custom/tanstack-table/fields/tanstack-table-column-header.tsx +7 -5
- package/src/custom/tanstack-table/fields/tanstack-table-filter-date.tsx +7 -7
- package/src/custom/tanstack-table/fields/tanstack-table-filter-faceted.tsx +9 -9
- package/src/custom/tanstack-table/fields/tanstack-table-filter-text.tsx +5 -8
- package/src/custom/tanstack-table/fields/tanstack-table-pagination.tsx +4 -4
- package/src/custom/tanstack-table/fields/tanstack-table-plain-table.tsx +8 -8
- package/src/custom/tanstack-table/fields/tanstack-table-row-actions-confirmation.tsx +2 -2
- package/src/custom/tanstack-table/fields/tanstack-table-row-actions-custom-dialog.tsx +2 -2
- package/src/custom/tanstack-table/fields/tanstack-table-row-actions.tsx +6 -6
- package/src/custom/tanstack-table/fields/tanstack-table-table-actions-custom-dialog.tsx +3 -3
- package/src/custom/tanstack-table/fields/tanstack-table-table-actions-schemaform-dialog.tsx +4 -4
- package/src/custom/tanstack-table/fields/tanstack-table-toolbar.tsx +2 -2
- package/src/custom/tanstack-table/fields/tanstack-table-view-options.tsx +5 -5
- package/src/custom/tanstack-table/types/index.ts +2 -2
- package/src/custom/tanstack-table/utils/columns-by-row-data.tsx +10 -10
- package/src/custom/tanstack-table/utils/editable-columns-by-row-data.tsx +8 -8
- package/src/custom/timeline.tsx +8 -8
- package/src/custom/tree.tsx +11 -9
- package/src/custom/webcam.tsx +14 -14
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
import { lodash } from "@
|
|
3
|
+
import { lodash } from "@ayasofyazilim/ui/lib/utils";
|
|
4
4
|
import { Form } from "@rjsf/shadcn";
|
|
5
5
|
import { customizeValidator } from "@rjsf/validator-ajv8";
|
|
6
6
|
import type { RJSFValidationError, FormValidation } from "@rjsf/utils";
|
|
@@ -104,7 +104,7 @@ export function SchemaForm<T = any>(props: SchemaFormProps<T>) {
|
|
|
104
104
|
schema = createDynamicSchema(
|
|
105
105
|
schema,
|
|
106
106
|
runtimeDependencyConfig,
|
|
107
|
-
formData as Record<string, unknown
|
|
107
|
+
formData as Record<string, unknown>,
|
|
108
108
|
);
|
|
109
109
|
}
|
|
110
110
|
|
|
@@ -156,7 +156,7 @@ export function SchemaForm<T = any>(props: SchemaFormProps<T>) {
|
|
|
156
156
|
|
|
157
157
|
return filteredErrors;
|
|
158
158
|
},
|
|
159
|
-
[formData, userTransformErrors]
|
|
159
|
+
[formData, userTransformErrors],
|
|
160
160
|
);
|
|
161
161
|
|
|
162
162
|
const combinedCustomValidate = useCallback(
|
|
@@ -165,29 +165,29 @@ export function SchemaForm<T = any>(props: SchemaFormProps<T>) {
|
|
|
165
165
|
|
|
166
166
|
if (runtimeDependencyConfig) {
|
|
167
167
|
const runtimeValidator = createRuntimeValidator(
|
|
168
|
-
runtimeDependencyConfig
|
|
168
|
+
runtimeDependencyConfig,
|
|
169
169
|
);
|
|
170
170
|
validationErrors = runtimeValidator(
|
|
171
171
|
formDataToValidate as Record<string, unknown>,
|
|
172
|
-
validationErrors as FormValidation<Record<string, unknown
|
|
172
|
+
validationErrors as FormValidation<Record<string, unknown>>,
|
|
173
173
|
) as FormValidation<T>;
|
|
174
174
|
}
|
|
175
175
|
|
|
176
176
|
if (userCustomValidate) {
|
|
177
177
|
validationErrors = userCustomValidate(
|
|
178
178
|
formDataToValidate,
|
|
179
|
-
validationErrors
|
|
179
|
+
validationErrors,
|
|
180
180
|
);
|
|
181
181
|
}
|
|
182
182
|
|
|
183
183
|
return validationErrors;
|
|
184
184
|
},
|
|
185
|
-
[runtimeDependencyConfig, userCustomValidate]
|
|
185
|
+
[runtimeDependencyConfig, userCustomValidate],
|
|
186
186
|
);
|
|
187
187
|
|
|
188
188
|
const memoizedWidgets = useMemo(
|
|
189
189
|
() => lodash.merge(INTERNAL_WIDGETS, widgets),
|
|
190
|
-
[widgets]
|
|
190
|
+
[widgets],
|
|
191
191
|
);
|
|
192
192
|
const memoizedFields = useMemo(() => fields, [fields]);
|
|
193
193
|
const memoizedTemplates = useMemo(() => {
|
|
@@ -196,14 +196,14 @@ export function SchemaForm<T = any>(props: SchemaFormProps<T>) {
|
|
|
196
196
|
templates,
|
|
197
197
|
useTableForArrayFields
|
|
198
198
|
? { ArrayFieldItemTemplate, ArrayFieldTemplate }
|
|
199
|
-
: {}
|
|
199
|
+
: {},
|
|
200
200
|
);
|
|
201
201
|
}, [templates]);
|
|
202
202
|
|
|
203
203
|
const handleSubmit = useCallback(
|
|
204
204
|
(
|
|
205
205
|
data: Parameters<NonNullable<typeof userOnSubmit>>[0],
|
|
206
|
-
event: React.FormEvent<HTMLFormElement
|
|
206
|
+
event: React.FormEvent<HTMLFormElement>,
|
|
207
207
|
) => {
|
|
208
208
|
if (!userOnSubmit) return;
|
|
209
209
|
|
|
@@ -213,14 +213,14 @@ export function SchemaForm<T = any>(props: SchemaFormProps<T>) {
|
|
|
213
213
|
if (fieldDependencies && cleanedFormData) {
|
|
214
214
|
cleanedFormData = cleanHiddenFieldsFromFormData(
|
|
215
215
|
cleanedFormData as Record<string, unknown>,
|
|
216
|
-
fieldDependencies
|
|
216
|
+
fieldDependencies,
|
|
217
217
|
) as T;
|
|
218
218
|
}
|
|
219
219
|
|
|
220
220
|
if (runtimeDependencyConfig && cleanedFormData) {
|
|
221
221
|
cleanedFormData = cleanFormDataForSubmit(
|
|
222
222
|
cleanedFormData as Record<string, unknown>,
|
|
223
|
-
runtimeDependencyConfig
|
|
223
|
+
runtimeDependencyConfig,
|
|
224
224
|
) as T;
|
|
225
225
|
}
|
|
226
226
|
|
|
@@ -230,7 +230,7 @@ export function SchemaForm<T = any>(props: SchemaFormProps<T>) {
|
|
|
230
230
|
|
|
231
231
|
userOnSubmit(submitData, event);
|
|
232
232
|
},
|
|
233
|
-
[userOnSubmit, runtimeDependencyConfig, fieldDependencies]
|
|
233
|
+
[userOnSubmit, runtimeDependencyConfig, fieldDependencies],
|
|
234
234
|
);
|
|
235
235
|
|
|
236
236
|
return (
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
Tooltip,
|
|
3
3
|
TooltipTrigger,
|
|
4
4
|
TooltipContent,
|
|
5
|
-
} from "@
|
|
5
|
+
} from "@ayasofyazilim/ui/components/tooltip";
|
|
6
6
|
import { DescriptionFieldProps } from "@rjsf/utils";
|
|
7
7
|
import { InfoIcon, MessageCircleQuestion } from "lucide-react";
|
|
8
8
|
|
|
@@ -4,8 +4,8 @@ import {
|
|
|
4
4
|
SubmitButtonProps,
|
|
5
5
|
UISchemaSubmitButtonOptions,
|
|
6
6
|
} from "@rjsf/utils";
|
|
7
|
-
import { Button } from "@
|
|
8
|
-
import { cn } from "@
|
|
7
|
+
import { Button } from "@ayasofyazilim/ui/components/button";
|
|
8
|
+
import { cn } from "@ayasofyazilim/ui/lib/utils";
|
|
9
9
|
|
|
10
10
|
export function SubmitButton(props: SubmitButtonProps) {
|
|
11
11
|
const { uiSchema } = props;
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
FilterType,
|
|
6
6
|
UiSchema,
|
|
7
7
|
} from "../types";
|
|
8
|
-
import { lodash } from "@
|
|
8
|
+
import { lodash } from "@ayasofyazilim/ui/lib/utils";
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
*
|
|
@@ -69,7 +69,7 @@ export function createSchemaWithFilters<T = string>({
|
|
|
69
69
|
|
|
70
70
|
const filterRecursive = (
|
|
71
71
|
currentObj: GenericObjectType,
|
|
72
|
-
parentPath: string = ""
|
|
72
|
+
parentPath: string = "",
|
|
73
73
|
): void => {
|
|
74
74
|
if (!currentObj.properties && !currentObj.items) return;
|
|
75
75
|
|
|
@@ -111,14 +111,14 @@ export function createSchemaWithFilters<T = string>({
|
|
|
111
111
|
}
|
|
112
112
|
}
|
|
113
113
|
},
|
|
114
|
-
{} as GenericObjectType["properties"]
|
|
114
|
+
{} as GenericObjectType["properties"],
|
|
115
115
|
);
|
|
116
116
|
|
|
117
117
|
// Update or Remove 'required' array based on kept keys
|
|
118
118
|
if (currentObj.required) {
|
|
119
119
|
currentObj.required = lodash.intersection(
|
|
120
120
|
currentObj.required,
|
|
121
|
-
keptKeys
|
|
121
|
+
keptKeys,
|
|
122
122
|
);
|
|
123
123
|
if (lodash.isEmpty(currentObj.required)) {
|
|
124
124
|
delete currentObj.required;
|
|
@@ -136,7 +136,7 @@ export function createSchemaWithFilters<T = string>({
|
|
|
136
136
|
*/
|
|
137
137
|
export function removeFieldsfromGenericSchema<T>(
|
|
138
138
|
obj: T,
|
|
139
|
-
keysToRemove: string | string[]
|
|
139
|
+
keysToRemove: string | string[],
|
|
140
140
|
): T {
|
|
141
141
|
const keysArray = lodash.castArray(keysToRemove);
|
|
142
142
|
|
|
@@ -153,7 +153,7 @@ export function removeFieldsfromGenericSchema<T>(
|
|
|
153
153
|
result[key] = transform(val);
|
|
154
154
|
}
|
|
155
155
|
},
|
|
156
|
-
{} as Record<string, unknown
|
|
156
|
+
{} as Record<string, unknown>,
|
|
157
157
|
);
|
|
158
158
|
}
|
|
159
159
|
|
|
@@ -223,7 +223,7 @@ function uiSchemaFromSchema({
|
|
|
223
223
|
});
|
|
224
224
|
return lodash.merge(acc, nested);
|
|
225
225
|
},
|
|
226
|
-
{}
|
|
226
|
+
{},
|
|
227
227
|
);
|
|
228
228
|
|
|
229
229
|
Object.assign(uiSchema[name], {
|
|
@@ -244,7 +244,7 @@ function uiSchemaFromSchema({
|
|
|
244
244
|
|
|
245
245
|
if (object.enum) {
|
|
246
246
|
uiSchemaItem["ui:enumNames"] = object.enum.map(
|
|
247
|
-
(key: string) => resources[`${constantKey}.${key}`] || key
|
|
247
|
+
(key: string) => resources[`${constantKey}.${key}`] || key,
|
|
248
248
|
);
|
|
249
249
|
uiSchemaItem["ui:options"] = {
|
|
250
250
|
label: true,
|
|
@@ -282,7 +282,7 @@ function filterUndefinedAndEmpty<T>(obj: T): FilteredObject<T> {
|
|
|
282
282
|
acc[key] = filteredValue;
|
|
283
283
|
}
|
|
284
284
|
},
|
|
285
|
-
{}
|
|
285
|
+
{},
|
|
286
286
|
);
|
|
287
287
|
|
|
288
288
|
return result as FilteredObject<T>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Checkbox } from "@
|
|
2
|
-
import { Label } from "@
|
|
3
|
-
import { Switch } from "@
|
|
4
|
-
import { cn } from "@
|
|
1
|
+
import { Checkbox } from "@ayasofyazilim/ui/components/checkbox";
|
|
2
|
+
import { Label } from "@ayasofyazilim/ui/components/label";
|
|
3
|
+
import { Switch } from "@ayasofyazilim/ui/components/switch";
|
|
4
|
+
import { cn } from "@ayasofyazilim/ui/lib/utils";
|
|
5
5
|
import { WidgetProps } from "@rjsf/utils";
|
|
6
6
|
import { ReactNode } from "react";
|
|
7
7
|
|
|
@@ -62,7 +62,7 @@ function BooleanWrapper({
|
|
|
62
62
|
data-wrapper="boolean"
|
|
63
63
|
className={cn(
|
|
64
64
|
"flex items-center gap-2 h-9 px-2 border rounded-md shadow-xs",
|
|
65
|
-
className
|
|
65
|
+
className,
|
|
66
66
|
)}
|
|
67
67
|
>
|
|
68
68
|
{children}
|
|
@@ -2,8 +2,8 @@ import { ChevronsUpDown } from "lucide-react";
|
|
|
2
2
|
import { WidgetProps } from "@rjsf/utils";
|
|
3
3
|
import { CheckIcon } from "lucide-react";
|
|
4
4
|
import { Dispatch, ReactNode, SetStateAction, useState } from "react";
|
|
5
|
-
import { Badge } from "@
|
|
6
|
-
import { Button } from "@
|
|
5
|
+
import { Badge } from "@ayasofyazilim/ui/components/badge";
|
|
6
|
+
import { Button } from "@ayasofyazilim/ui/components/button";
|
|
7
7
|
import {
|
|
8
8
|
Command,
|
|
9
9
|
CommandEmpty,
|
|
@@ -11,19 +11,19 @@ import {
|
|
|
11
11
|
CommandInput,
|
|
12
12
|
CommandItem,
|
|
13
13
|
CommandList,
|
|
14
|
-
} from "@
|
|
14
|
+
} from "@ayasofyazilim/ui/components/command";
|
|
15
15
|
import {
|
|
16
16
|
Drawer,
|
|
17
17
|
DrawerContent,
|
|
18
18
|
DrawerTrigger,
|
|
19
|
-
} from "@
|
|
19
|
+
} from "@ayasofyazilim/ui/components/drawer";
|
|
20
20
|
import {
|
|
21
21
|
Popover,
|
|
22
22
|
PopoverContent,
|
|
23
23
|
PopoverTrigger,
|
|
24
|
-
} from "@
|
|
25
|
-
import { useMediaQuery } from "@
|
|
26
|
-
import { cn } from "@
|
|
24
|
+
} from "@ayasofyazilim/ui/components/popover";
|
|
25
|
+
import { useMediaQuery } from "@ayasofyazilim/ui/hooks/use-media-query";
|
|
26
|
+
import { cn } from "@ayasofyazilim/ui/lib/utils";
|
|
27
27
|
|
|
28
28
|
type BadgeOptions = { className?: string; showValue?: boolean; label?: string };
|
|
29
29
|
|
|
@@ -54,7 +54,7 @@ export function CustomCombobox<T>(props: CustomComboboxProps<T>) {
|
|
|
54
54
|
const [open, setOpen] = useState(false);
|
|
55
55
|
const fieldValue = value || defaultValue;
|
|
56
56
|
const fieldValueDisplayName = list?.find(
|
|
57
|
-
(x) => x[selectIdentifier] === fieldValue
|
|
57
|
+
(x) => x[selectIdentifier] === fieldValue,
|
|
58
58
|
)?.[selectLabel];
|
|
59
59
|
const DesktopContent = (
|
|
60
60
|
<Popover open={open} onOpenChange={setOpen} modal>
|
|
@@ -73,7 +73,7 @@ export function CustomCombobox<T>(props: CustomComboboxProps<T>) {
|
|
|
73
73
|
"text-muted-foreground w-full justify-between font-normal shadow-xs hover:bg-white overflow-hidden",
|
|
74
74
|
fieldValueDisplayName && "text-foreground",
|
|
75
75
|
disabled &&
|
|
76
|
-
"disabled:pointer-events-auto hover:bg-background hover:text-muted-foreground"
|
|
76
|
+
"disabled:pointer-events-auto hover:bg-background hover:text-muted-foreground",
|
|
77
77
|
)}
|
|
78
78
|
>
|
|
79
79
|
<span className="truncate has-[role=dialog]:max-w-xs">
|
|
@@ -101,7 +101,7 @@ export function CustomCombobox<T>(props: CustomComboboxProps<T>) {
|
|
|
101
101
|
variant="outline"
|
|
102
102
|
className={cn(
|
|
103
103
|
"text-muted-foreground w-full justify-between font-normal shadow-xs hover:bg-white",
|
|
104
|
-
fieldValueDisplayName && "text-black"
|
|
104
|
+
fieldValueDisplayName && "text-black",
|
|
105
105
|
)}
|
|
106
106
|
>
|
|
107
107
|
{fieldValueDisplayName
|
|
@@ -147,7 +147,7 @@ function List<T>({
|
|
|
147
147
|
const filterResult = list?.find(
|
|
148
148
|
(i) =>
|
|
149
149
|
(i[selectIdentifier] as string).toString()?.toLocaleLowerCase() ===
|
|
150
|
-
value.toLocaleLowerCase()
|
|
150
|
+
value.toLocaleLowerCase(),
|
|
151
151
|
)?.[selectLabel] as string;
|
|
152
152
|
if (
|
|
153
153
|
value.includes(search) ||
|
|
@@ -175,11 +175,11 @@ function List<T>({
|
|
|
175
175
|
? item[selectIdentifier] === value
|
|
176
176
|
? undefined
|
|
177
177
|
: item[selectIdentifier]
|
|
178
|
-
: item[selectIdentifier]
|
|
178
|
+
: item[selectIdentifier],
|
|
179
179
|
);
|
|
180
180
|
if (onValueChange)
|
|
181
181
|
onValueChange(
|
|
182
|
-
list.find((i) => i[selectIdentifier] === value)
|
|
182
|
+
list.find((i) => i[selectIdentifier] === value),
|
|
183
183
|
);
|
|
184
184
|
setOpen(false);
|
|
185
185
|
}}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { EmailInput } from "@
|
|
2
|
-
import { cn } from "@
|
|
1
|
+
import { EmailInput } from "@ayasofyazilim/ui/custom/email-input";
|
|
2
|
+
import { cn } from "@ayasofyazilim/ui/lib/utils";
|
|
3
3
|
import { WidgetProps } from "@rjsf/utils";
|
|
4
4
|
import { useState } from "react";
|
|
5
5
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { WidgetProps } from "@rjsf/utils";
|
|
2
|
-
import { PasswordInput } from "@
|
|
2
|
+
import { PasswordInput } from "@ayasofyazilim/ui/custom/password-input";
|
|
3
3
|
|
|
4
4
|
export const PasswordInputWidget = (props: WidgetProps) => {
|
|
5
5
|
const {
|
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
import {
|
|
4
4
|
PhoneInput,
|
|
5
5
|
PhoneInputProps,
|
|
6
|
-
} from "@
|
|
6
|
+
} from "@ayasofyazilim/ui/custom/phone-input";
|
|
7
7
|
import { WidgetProps } from "@rjsf/utils";
|
|
8
8
|
|
|
9
9
|
export function CustomPhoneFieldWithParse<T>(
|
|
10
10
|
props: Partial<Omit<WidgetProps<T>, "onChange" | "id">> &
|
|
11
|
-
Omit<PhoneInputProps, "required" | "defaultValue" | "id"
|
|
11
|
+
Omit<PhoneInputProps, "required" | "defaultValue" | "id">,
|
|
12
12
|
) {
|
|
13
13
|
const required = props.required || props.uiSchema?.["ui:required"];
|
|
14
14
|
return (
|
|
@@ -23,7 +23,7 @@ export function CustomPhoneFieldWithParse<T>(
|
|
|
23
23
|
export const PhoneWithParseWidget = CustomPhoneFieldWithParse;
|
|
24
24
|
|
|
25
25
|
export const PhoneWithValueWidget = function CustomPhoneFieldWithValue(
|
|
26
|
-
props: WidgetProps & { defaultCountry?: string }
|
|
26
|
+
props: WidgetProps & { defaultCountry?: string },
|
|
27
27
|
) {
|
|
28
28
|
const { onChange, uiSchema } = props;
|
|
29
29
|
const required = uiSchema?.["ui:required"] || props.required;
|
|
@@ -11,9 +11,9 @@ import {
|
|
|
11
11
|
SelectItem,
|
|
12
12
|
SelectTrigger,
|
|
13
13
|
SelectValue,
|
|
14
|
-
} from "@
|
|
15
|
-
import { Selectable } from "@
|
|
16
|
-
import { cn } from "@
|
|
14
|
+
} from "@ayasofyazilim/ui/components/select";
|
|
15
|
+
import { Selectable } from "@ayasofyazilim/ui/custom/selectable";
|
|
16
|
+
import { cn } from "@ayasofyazilim/ui/lib/utils";
|
|
17
17
|
|
|
18
18
|
/** The `SelectWidget` is a widget for rendering dropdowns.
|
|
19
19
|
* It is typically used with string properties constrained with enum options.
|
|
@@ -57,12 +57,12 @@ export function SelectWidget<
|
|
|
57
57
|
label,
|
|
58
58
|
disabled: Array.isArray(enumDisabled) && enumDisabled.includes(value),
|
|
59
59
|
};
|
|
60
|
-
}
|
|
60
|
+
},
|
|
61
61
|
);
|
|
62
62
|
const cnClassName = cn(
|
|
63
63
|
"w-full",
|
|
64
64
|
{ "border-destructive": rawErrors.length > 0 },
|
|
65
|
-
className
|
|
65
|
+
className,
|
|
66
66
|
);
|
|
67
67
|
return !multiple ? (
|
|
68
68
|
<Select
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Selectable,
|
|
3
3
|
SelectableProps,
|
|
4
|
-
} from "@
|
|
4
|
+
} from "@ayasofyazilim/ui/custom/selectable";
|
|
5
5
|
import { WidgetProps } from "@rjsf/utils";
|
|
6
6
|
|
|
7
7
|
export function CustomSelectableWidget<T>(
|
|
8
|
-
selectableProps: Omit<SelectableProps<T>, "onChange"
|
|
8
|
+
selectableProps: Omit<SelectableProps<T>, "onChange">,
|
|
9
9
|
) {
|
|
10
10
|
const { getKey } = selectableProps;
|
|
11
11
|
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { ButtonProps } from "@
|
|
1
|
+
import { ButtonProps } from "@ayasofyazilim/ui/components/button";
|
|
2
2
|
import {
|
|
3
3
|
InputGroup,
|
|
4
4
|
InputGroupAddon,
|
|
5
5
|
InputGroupButton,
|
|
6
6
|
InputGroupInput,
|
|
7
7
|
InputGroupText,
|
|
8
|
-
} from "@
|
|
8
|
+
} from "@ayasofyazilim/ui/components/input-group";
|
|
9
9
|
import {
|
|
10
10
|
Tooltip,
|
|
11
11
|
TooltipContent,
|
|
12
12
|
TooltipTrigger,
|
|
13
|
-
} from "@
|
|
14
|
-
import { cn } from "@
|
|
13
|
+
} from "@ayasofyazilim/ui/components/tooltip";
|
|
14
|
+
import { cn } from "@ayasofyazilim/ui/lib/utils";
|
|
15
15
|
import { WidgetProps } from "@rjsf/utils";
|
|
16
16
|
import { PlusIcon, Trash2Icon } from "lucide-react";
|
|
17
17
|
import { useCallback, useState } from "react";
|
|
@@ -52,7 +52,7 @@ interface StringArrayWidgetConfig {
|
|
|
52
52
|
renderItem?: (
|
|
53
53
|
value: string,
|
|
54
54
|
index: number,
|
|
55
|
-
onRemove: () => void
|
|
55
|
+
onRemove: () => void,
|
|
56
56
|
) => React.ReactNode;
|
|
57
57
|
emptyState?: React.ReactNode;
|
|
58
58
|
placeholder?: string;
|
|
@@ -149,21 +149,21 @@ export function CustomStringArrayWidget(config: StringArrayWidgetConfig = {}) {
|
|
|
149
149
|
onAdd(finalValue);
|
|
150
150
|
}
|
|
151
151
|
},
|
|
152
|
-
[currentValues, props]
|
|
152
|
+
[currentValues, props],
|
|
153
153
|
);
|
|
154
154
|
|
|
155
155
|
const handleRemove = useCallback(
|
|
156
156
|
(index: number) => {
|
|
157
157
|
const valueToRemove = currentValues[index];
|
|
158
158
|
const newValues = currentValues.filter(
|
|
159
|
-
(_: string, i: number) => i !== index
|
|
159
|
+
(_: string, i: number) => i !== index,
|
|
160
160
|
);
|
|
161
161
|
props.onChange(newValues);
|
|
162
162
|
if (onRemove) {
|
|
163
163
|
onRemove(valueToRemove, index);
|
|
164
164
|
}
|
|
165
165
|
},
|
|
166
|
-
[currentValues, props, onRemove]
|
|
166
|
+
[currentValues, props, onRemove],
|
|
167
167
|
);
|
|
168
168
|
|
|
169
169
|
const isDisabled = disabled || props.disabled;
|
|
@@ -174,7 +174,7 @@ export function CustomStringArrayWidget(config: StringArrayWidgetConfig = {}) {
|
|
|
174
174
|
className={cn(
|
|
175
175
|
"p-1.5",
|
|
176
176
|
currentValues.length === 0 && "p-0",
|
|
177
|
-
classNames.container
|
|
177
|
+
classNames.container,
|
|
178
178
|
)}
|
|
179
179
|
>
|
|
180
180
|
<InputGroupAddon
|
|
@@ -183,7 +183,7 @@ export function CustomStringArrayWidget(config: StringArrayWidgetConfig = {}) {
|
|
|
183
183
|
"flex-col gap-1.5",
|
|
184
184
|
maxHeight,
|
|
185
185
|
"overflow-auto p-0",
|
|
186
|
-
classNames.listContainer || ""
|
|
186
|
+
classNames.listContainer || "",
|
|
187
187
|
)}
|
|
188
188
|
>
|
|
189
189
|
{currentValues.length === 0 && emptyState
|
|
@@ -197,14 +197,14 @@ export function CustomStringArrayWidget(config: StringArrayWidgetConfig = {}) {
|
|
|
197
197
|
<InputGroupText
|
|
198
198
|
className={cn(
|
|
199
199
|
"bg-accent relative w-full overflow-hidden pl-2 pr-1 min-h-8 h-8 rounded-md",
|
|
200
|
-
classNames.listItem || ""
|
|
200
|
+
classNames.listItem || "",
|
|
201
201
|
)}
|
|
202
202
|
key={`${value}-${index}`}
|
|
203
203
|
>
|
|
204
204
|
<span
|
|
205
205
|
className={cn(
|
|
206
206
|
"truncate text-ellipsis",
|
|
207
|
-
classNames.listItemText || ""
|
|
207
|
+
classNames.listItemText || "",
|
|
208
208
|
)}
|
|
209
209
|
>
|
|
210
210
|
{value}
|
|
@@ -212,7 +212,7 @@ export function CustomStringArrayWidget(config: StringArrayWidgetConfig = {}) {
|
|
|
212
212
|
<InputGroupButton
|
|
213
213
|
className={cn(
|
|
214
214
|
"rounded-md ml-auto",
|
|
215
|
-
classNames.removeButton || ""
|
|
215
|
+
classNames.removeButton || "",
|
|
216
216
|
)}
|
|
217
217
|
variant={buttonVariants.remove}
|
|
218
218
|
size={buttonSizes.remove}
|
|
@@ -231,7 +231,7 @@ export function CustomStringArrayWidget(config: StringArrayWidgetConfig = {}) {
|
|
|
231
231
|
className={cn(
|
|
232
232
|
"p-0 justify-between",
|
|
233
233
|
currentValues.length === 0 && "pr-1.5 ",
|
|
234
|
-
classNames.inputContainer || ""
|
|
234
|
+
classNames.inputContainer || "",
|
|
235
235
|
)}
|
|
236
236
|
>
|
|
237
237
|
<Tooltip open={!!error}>
|
|
@@ -241,7 +241,7 @@ export function CustomStringArrayWidget(config: StringArrayWidgetConfig = {}) {
|
|
|
241
241
|
className={cn(
|
|
242
242
|
"pl-2",
|
|
243
243
|
error && "text-destructive",
|
|
244
|
-
classNames.input || ""
|
|
244
|
+
classNames.input || "",
|
|
245
245
|
)}
|
|
246
246
|
placeholder={placeholder || props.options.placeholder}
|
|
247
247
|
value={inputValue}
|
|
@@ -269,7 +269,7 @@ export function CustomStringArrayWidget(config: StringArrayWidgetConfig = {}) {
|
|
|
269
269
|
variant={buttonVariants.add}
|
|
270
270
|
className={cn(
|
|
271
271
|
"rounded-md ml-auto",
|
|
272
|
-
classNames.addButton || ""
|
|
272
|
+
classNames.addButton || "",
|
|
273
273
|
)}
|
|
274
274
|
size={buttonSizes.add}
|
|
275
275
|
onClick={() => handleValue(inputValue)}
|
|
@@ -4,8 +4,8 @@ import {
|
|
|
4
4
|
InputGroupAddon,
|
|
5
5
|
InputGroupInput,
|
|
6
6
|
InputGroupText,
|
|
7
|
-
} from "@
|
|
8
|
-
import { cn } from "@
|
|
7
|
+
} from "@ayasofyazilim/ui/components/input-group";
|
|
8
|
+
import { cn } from "@ayasofyazilim/ui/lib/utils";
|
|
9
9
|
import { WidgetProps } from "@rjsf/utils";
|
|
10
10
|
|
|
11
11
|
export const URLInputWidget = (props: WidgetProps) => {
|
|
@@ -8,9 +8,9 @@ import React, {
|
|
|
8
8
|
useMemo,
|
|
9
9
|
useState,
|
|
10
10
|
} from "react";
|
|
11
|
-
import { Button } from "@
|
|
12
|
-
import { Skeleton } from "@
|
|
13
|
-
import { cn } from "@
|
|
11
|
+
import { Button } from "@ayasofyazilim/ui/components/button";
|
|
12
|
+
import { Skeleton } from "@ayasofyazilim/ui/components/skeleton";
|
|
13
|
+
import { cn } from "@ayasofyazilim/ui/lib/utils";
|
|
14
14
|
|
|
15
15
|
export interface ISection {
|
|
16
16
|
children?: React.ReactNode;
|
|
@@ -53,7 +53,7 @@ export function SectionLayoutNavbar({
|
|
|
53
53
|
"flex gap-4 text-sm text-center md:text-left p-3 ",
|
|
54
54
|
vertical
|
|
55
55
|
? "flex-col border-b md:border-b-0 md:border-r overflow-auto min-w-full md:min-w-60 items-center md:items-start"
|
|
56
|
-
: "flex-col md:flex-row border-b"
|
|
56
|
+
: "flex-col md:flex-row border-b",
|
|
57
57
|
)}
|
|
58
58
|
>
|
|
59
59
|
{sections.map((section) => (
|
|
@@ -65,7 +65,7 @@ export function SectionLayoutNavbar({
|
|
|
65
65
|
section.disabled
|
|
66
66
|
? "cursor-not-allowed opacity-50"
|
|
67
67
|
: "cursor-pointer",
|
|
68
|
-
section.className
|
|
68
|
+
section.className,
|
|
69
69
|
)}
|
|
70
70
|
data-active={activeSectionId === section.id}
|
|
71
71
|
href={section.link || "#"}
|
|
@@ -148,7 +148,7 @@ export function SectionLayout({
|
|
|
148
148
|
vertical,
|
|
149
149
|
}: ISectionLayoutProps) {
|
|
150
150
|
const [activeSectionId, setActiveSectionId] = useState(
|
|
151
|
-
defaultActiveSectionId || sections?.[0]?.id
|
|
151
|
+
defaultActiveSectionId || sections?.[0]?.id,
|
|
152
152
|
);
|
|
153
153
|
useEffect(() => {
|
|
154
154
|
if (linkElement && defaultActiveSectionId) {
|
|
@@ -157,7 +157,7 @@ export function SectionLayout({
|
|
|
157
157
|
}, [defaultActiveSectionId]);
|
|
158
158
|
const contextValue = useMemo(
|
|
159
159
|
() => ({ activeSectionId: activeSectionId || "" }),
|
|
160
|
-
[activeSectionId]
|
|
160
|
+
[activeSectionId],
|
|
161
161
|
);
|
|
162
162
|
return (
|
|
163
163
|
<SectionLayoutContext.Provider value={contextValue}>
|
|
@@ -194,7 +194,7 @@ export const SectionLayoutSkeleton = ({ vertical }: { vertical?: boolean }) => (
|
|
|
194
194
|
"flex gap-4 text-sm text-center md:text-left p-5 ",
|
|
195
195
|
vertical
|
|
196
196
|
? "flex-col border-b md:border-b-0 md:border-r min-w-full md:min-w-60 items-center md:items-start"
|
|
197
|
-
: "flex-col md:flex-row border-b"
|
|
197
|
+
: "flex-col md:flex-row border-b",
|
|
198
198
|
)}
|
|
199
199
|
>
|
|
200
200
|
<Skeleton className="h-6 w-full bg-gray-200" />
|
|
@@ -8,8 +8,8 @@ import React, {
|
|
|
8
8
|
useMemo,
|
|
9
9
|
useState,
|
|
10
10
|
} from "react";
|
|
11
|
-
import { Button } from "@
|
|
12
|
-
import { cn } from "@
|
|
11
|
+
import { Button } from "@ayasofyazilim/ui/components/button";
|
|
12
|
+
import { cn } from "@ayasofyazilim/ui/lib/utils";
|
|
13
13
|
|
|
14
14
|
const variants = {
|
|
15
15
|
default:
|
package/src/custom/stepper.tsx
CHANGED
|
@@ -8,8 +8,8 @@ import React, {
|
|
|
8
8
|
useContext,
|
|
9
9
|
useMemo,
|
|
10
10
|
} from "react";
|
|
11
|
-
import { Button } from "@
|
|
12
|
-
import { cn } from "@
|
|
11
|
+
import { Button } from "@ayasofyazilim/ui/components/button";
|
|
12
|
+
import { cn } from "@ayasofyazilim/ui/lib/utils";
|
|
13
13
|
|
|
14
14
|
export interface ISeparatorProps {
|
|
15
15
|
vertical?: boolean;
|
|
@@ -131,7 +131,7 @@ export const StepperHeader = ({
|
|
|
131
131
|
`flex gap-5 justify-between relative mb-10 ${
|
|
132
132
|
vertical ? "flex-col items-center w-2/12" : "w-full"
|
|
133
133
|
}`,
|
|
134
|
-
containerClassName
|
|
134
|
+
containerClassName,
|
|
135
135
|
);
|
|
136
136
|
const activeItemClass = cn("bg-primary text-white", activeItemClassName);
|
|
137
137
|
const inactiveItemClass = cn("bg-zinc-200 text-black", inactiveItemClassName);
|
|
@@ -217,7 +217,7 @@ export default function Stepper({
|
|
|
217
217
|
vertical,
|
|
218
218
|
stepsLength,
|
|
219
219
|
}),
|
|
220
|
-
[nextButtonText, previousButtonText, onIndexChange, vertical, stepsLength]
|
|
220
|
+
[nextButtonText, previousButtonText, onIndexChange, vertical, stepsLength],
|
|
221
221
|
);
|
|
222
222
|
const filteredChildren = React.Children.toArray(children)?.[activeTabIndex];
|
|
223
223
|
return (
|