warqadui 0.0.28 → 0.0.30
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/dist/index.d.mts +4 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +20 -7
- package/dist/index.mjs +20 -7
- package/dist/styles.js +9 -0
- package/dist/styles.mjs +9 -0
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -229,6 +229,8 @@ interface SearchApiProps extends Omit<React__default.InputHTMLAttributes<HTMLInp
|
|
|
229
229
|
placeholder?: string;
|
|
230
230
|
value?: any;
|
|
231
231
|
onChange?: (value: any) => void;
|
|
232
|
+
onSelect?: (option: any) => void;
|
|
233
|
+
onClear?: () => void;
|
|
232
234
|
queryKey?: string;
|
|
233
235
|
labelKey?: string;
|
|
234
236
|
valueKey?: string;
|
|
@@ -249,6 +251,8 @@ interface SearchApiContextValue {
|
|
|
249
251
|
setSearchTerm: (v: string) => void;
|
|
250
252
|
selectedValue: any;
|
|
251
253
|
setSelectedValue: (v: any) => void;
|
|
254
|
+
onSelect?: (option: any) => void;
|
|
255
|
+
onClear?: () => void;
|
|
252
256
|
activeIndex: number;
|
|
253
257
|
setActiveIndex: (v: number) => void;
|
|
254
258
|
isFocused: boolean;
|
package/dist/index.d.ts
CHANGED
|
@@ -229,6 +229,8 @@ interface SearchApiProps extends Omit<React__default.InputHTMLAttributes<HTMLInp
|
|
|
229
229
|
placeholder?: string;
|
|
230
230
|
value?: any;
|
|
231
231
|
onChange?: (value: any) => void;
|
|
232
|
+
onSelect?: (option: any) => void;
|
|
233
|
+
onClear?: () => void;
|
|
232
234
|
queryKey?: string;
|
|
233
235
|
labelKey?: string;
|
|
234
236
|
valueKey?: string;
|
|
@@ -249,6 +251,8 @@ interface SearchApiContextValue {
|
|
|
249
251
|
setSearchTerm: (v: string) => void;
|
|
250
252
|
selectedValue: any;
|
|
251
253
|
setSelectedValue: (v: any) => void;
|
|
254
|
+
onSelect?: (option: any) => void;
|
|
255
|
+
onClear?: () => void;
|
|
252
256
|
activeIndex: number;
|
|
253
257
|
setActiveIndex: (v: number) => void;
|
|
254
258
|
isFocused: boolean;
|
package/dist/index.js
CHANGED
|
@@ -2079,7 +2079,7 @@ var useSearchApiContext = () => {
|
|
|
2079
2079
|
};
|
|
2080
2080
|
var SearchApi = (0, import_react13.forwardRef)(
|
|
2081
2081
|
(props, _) => {
|
|
2082
|
-
const { form, name, onChange, value, children, ...restProps } = props;
|
|
2082
|
+
const { form, name, onChange, onSelect, onClear, value, children, ...restProps } = props;
|
|
2083
2083
|
if (form && name) {
|
|
2084
2084
|
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2085
2085
|
import_react_hook_form5.Controller,
|
|
@@ -2092,6 +2092,8 @@ var SearchApi = (0, import_react13.forwardRef)(
|
|
|
2092
2092
|
...restProps,
|
|
2093
2093
|
form,
|
|
2094
2094
|
name,
|
|
2095
|
+
onSelect,
|
|
2096
|
+
onClear,
|
|
2095
2097
|
currentValue: field.value !== void 0 && field.value !== "" ? field.value : value,
|
|
2096
2098
|
onChangeHandler: (val) => {
|
|
2097
2099
|
field.onChange(val);
|
|
@@ -2110,6 +2112,8 @@ var SearchApi = (0, import_react13.forwardRef)(
|
|
|
2110
2112
|
...restProps,
|
|
2111
2113
|
form,
|
|
2112
2114
|
name,
|
|
2115
|
+
onSelect,
|
|
2116
|
+
onClear,
|
|
2113
2117
|
currentValue: value,
|
|
2114
2118
|
onChangeHandler: onChange || (() => {
|
|
2115
2119
|
}),
|
|
@@ -2123,6 +2127,8 @@ var SearchApiRoot = ({
|
|
|
2123
2127
|
children,
|
|
2124
2128
|
currentValue,
|
|
2125
2129
|
onChangeHandler,
|
|
2130
|
+
onSelect,
|
|
2131
|
+
onClear,
|
|
2126
2132
|
form,
|
|
2127
2133
|
name,
|
|
2128
2134
|
obj,
|
|
@@ -2287,6 +2293,7 @@ var SearchApiRoot = ({
|
|
|
2287
2293
|
setSelectedObject(option);
|
|
2288
2294
|
setTimeout(() => {
|
|
2289
2295
|
onChangeHandler(val);
|
|
2296
|
+
if (onSelect) onSelect(option);
|
|
2290
2297
|
}, 0);
|
|
2291
2298
|
if (form) {
|
|
2292
2299
|
if (obj) form.setValue(obj, option);
|
|
@@ -2313,6 +2320,7 @@ var SearchApiRoot = ({
|
|
|
2313
2320
|
onChangeHandler(void 0);
|
|
2314
2321
|
}
|
|
2315
2322
|
setSearchTerm("");
|
|
2323
|
+
if (onClear) onClear();
|
|
2316
2324
|
};
|
|
2317
2325
|
const filteredOptions = options.filter(
|
|
2318
2326
|
(option) => !filter.includes(getOptionValue(option))
|
|
@@ -2361,7 +2369,9 @@ var SearchApiRoot = ({
|
|
|
2361
2369
|
form,
|
|
2362
2370
|
name,
|
|
2363
2371
|
obj,
|
|
2364
|
-
error: message
|
|
2372
|
+
error: message,
|
|
2373
|
+
onSelect,
|
|
2374
|
+
onClear
|
|
2365
2375
|
};
|
|
2366
2376
|
const hasChildren = !!children;
|
|
2367
2377
|
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(SearchApiContext.Provider, { value: valueCtx, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
@@ -3339,6 +3349,9 @@ function PostTable({
|
|
|
3339
3349
|
finalColumns.unshift({
|
|
3340
3350
|
id: "_index",
|
|
3341
3351
|
header: "#",
|
|
3352
|
+
size: 40,
|
|
3353
|
+
minSize: 40,
|
|
3354
|
+
maxSize: 40,
|
|
3342
3355
|
cell: ({ row }) => /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
3343
3356
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "text-gray-500 font-medium ml-1", children: row.index + 1 }),
|
|
3344
3357
|
renderSubComponent && hasSubComponent(row.original) && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
@@ -3388,7 +3401,7 @@ function PostTable({
|
|
|
3388
3401
|
rowPadding,
|
|
3389
3402
|
"text-sm font-semibold text-gray-900 dark:text-zinc-100 text-left",
|
|
3390
3403
|
verticalLines && "border-x border-gray-200 dark:border-zinc-800",
|
|
3391
|
-
header.id === "_index" && "w-
|
|
3404
|
+
header.id === "_index" && "w-[1%] min-w-[40px] max-w-[40px] whitespace-nowrap",
|
|
3392
3405
|
header.column.columnDef.meta?.className
|
|
3393
3406
|
),
|
|
3394
3407
|
style: {
|
|
@@ -3450,7 +3463,7 @@ function PostTable({
|
|
|
3450
3463
|
rowPadding,
|
|
3451
3464
|
"text-sm text-gray-700 dark:text-gray-200",
|
|
3452
3465
|
verticalLines && "border-x border-gray-200 dark:border-zinc-800",
|
|
3453
|
-
cell.column.id === "_index" && "w-
|
|
3466
|
+
cell.column.id === "_index" && "w-[1%] min-w-[40px] max-w-[40px] whitespace-nowrap",
|
|
3454
3467
|
cell.column.columnDef.meta?.className
|
|
3455
3468
|
),
|
|
3456
3469
|
style: {
|
|
@@ -3585,7 +3598,7 @@ function PostTable({
|
|
|
3585
3598
|
"py-1! text-sm align-middle transition-colors duration-200",
|
|
3586
3599
|
column.id !== "_index" ? "cursor-text" : "",
|
|
3587
3600
|
verticalLines ? "border-x border-gray-200 dark:border-zinc-800" : "",
|
|
3588
|
-
column.id === "_index" ? "w-
|
|
3601
|
+
column.id === "_index" ? "w-[1%] min-w-[40px] max-w-[40px] whitespace-nowrap" : "",
|
|
3589
3602
|
hasError && "ring-1 ring-inset ring-red-500",
|
|
3590
3603
|
column.columnDef.meta?.className
|
|
3591
3604
|
),
|
|
@@ -3602,7 +3615,7 @@ function PostTable({
|
|
|
3602
3615
|
column.id === "_index" ? "" : "h-9",
|
|
3603
3616
|
!column.columnDef.meta?.className?.match(
|
|
3604
3617
|
/\b(w-|min-w-|max-w-)/
|
|
3605
|
-
) && !column.columnDef.meta?.width && "min-w-32"
|
|
3618
|
+
) && !column.columnDef.meta?.width && (!column.columnDef.maxSize || column.columnDef.maxSize >= 128) && (!column.columnDef.size || column.columnDef.size >= 128) && "min-w-32"
|
|
3606
3619
|
),
|
|
3607
3620
|
onKeyDown: (e) => {
|
|
3608
3621
|
if (e.key === "Enter") {
|
|
@@ -3660,7 +3673,7 @@ function PostTable({
|
|
|
3660
3673
|
rowPadding,
|
|
3661
3674
|
"text-sm font-semibold text-gray-900 dark:text-zinc-100 text-left",
|
|
3662
3675
|
verticalLines && "border-x border-gray-200 dark:border-zinc-800",
|
|
3663
|
-
header.id === "_index" && "w-
|
|
3676
|
+
header.id === "_index" && "w-[1%] min-w-[40px] max-w-[40px] whitespace-nowrap",
|
|
3664
3677
|
header.column.columnDef.meta?.className
|
|
3665
3678
|
),
|
|
3666
3679
|
style: {
|
package/dist/index.mjs
CHANGED
|
@@ -2020,7 +2020,7 @@ var useSearchApiContext = () => {
|
|
|
2020
2020
|
};
|
|
2021
2021
|
var SearchApi = forwardRef5(
|
|
2022
2022
|
(props, _) => {
|
|
2023
|
-
const { form, name, onChange, value, children, ...restProps } = props;
|
|
2023
|
+
const { form, name, onChange, onSelect, onClear, value, children, ...restProps } = props;
|
|
2024
2024
|
if (form && name) {
|
|
2025
2025
|
return /* @__PURE__ */ jsx21(
|
|
2026
2026
|
Controller5,
|
|
@@ -2033,6 +2033,8 @@ var SearchApi = forwardRef5(
|
|
|
2033
2033
|
...restProps,
|
|
2034
2034
|
form,
|
|
2035
2035
|
name,
|
|
2036
|
+
onSelect,
|
|
2037
|
+
onClear,
|
|
2036
2038
|
currentValue: field.value !== void 0 && field.value !== "" ? field.value : value,
|
|
2037
2039
|
onChangeHandler: (val) => {
|
|
2038
2040
|
field.onChange(val);
|
|
@@ -2051,6 +2053,8 @@ var SearchApi = forwardRef5(
|
|
|
2051
2053
|
...restProps,
|
|
2052
2054
|
form,
|
|
2053
2055
|
name,
|
|
2056
|
+
onSelect,
|
|
2057
|
+
onClear,
|
|
2054
2058
|
currentValue: value,
|
|
2055
2059
|
onChangeHandler: onChange || (() => {
|
|
2056
2060
|
}),
|
|
@@ -2064,6 +2068,8 @@ var SearchApiRoot = ({
|
|
|
2064
2068
|
children,
|
|
2065
2069
|
currentValue,
|
|
2066
2070
|
onChangeHandler,
|
|
2071
|
+
onSelect,
|
|
2072
|
+
onClear,
|
|
2067
2073
|
form,
|
|
2068
2074
|
name,
|
|
2069
2075
|
obj,
|
|
@@ -2228,6 +2234,7 @@ var SearchApiRoot = ({
|
|
|
2228
2234
|
setSelectedObject(option);
|
|
2229
2235
|
setTimeout(() => {
|
|
2230
2236
|
onChangeHandler(val);
|
|
2237
|
+
if (onSelect) onSelect(option);
|
|
2231
2238
|
}, 0);
|
|
2232
2239
|
if (form) {
|
|
2233
2240
|
if (obj) form.setValue(obj, option);
|
|
@@ -2254,6 +2261,7 @@ var SearchApiRoot = ({
|
|
|
2254
2261
|
onChangeHandler(void 0);
|
|
2255
2262
|
}
|
|
2256
2263
|
setSearchTerm("");
|
|
2264
|
+
if (onClear) onClear();
|
|
2257
2265
|
};
|
|
2258
2266
|
const filteredOptions = options.filter(
|
|
2259
2267
|
(option) => !filter.includes(getOptionValue(option))
|
|
@@ -2302,7 +2310,9 @@ var SearchApiRoot = ({
|
|
|
2302
2310
|
form,
|
|
2303
2311
|
name,
|
|
2304
2312
|
obj,
|
|
2305
|
-
error: message
|
|
2313
|
+
error: message,
|
|
2314
|
+
onSelect,
|
|
2315
|
+
onClear
|
|
2306
2316
|
};
|
|
2307
2317
|
const hasChildren = !!children;
|
|
2308
2318
|
return /* @__PURE__ */ jsx21(SearchApiContext.Provider, { value: valueCtx, children: /* @__PURE__ */ jsxs15(
|
|
@@ -3297,6 +3307,9 @@ function PostTable({
|
|
|
3297
3307
|
finalColumns.unshift({
|
|
3298
3308
|
id: "_index",
|
|
3299
3309
|
header: "#",
|
|
3310
|
+
size: 40,
|
|
3311
|
+
minSize: 40,
|
|
3312
|
+
maxSize: 40,
|
|
3300
3313
|
cell: ({ row }) => /* @__PURE__ */ jsxs18("div", { className: "flex items-center gap-2", children: [
|
|
3301
3314
|
/* @__PURE__ */ jsx24("span", { className: "text-gray-500 font-medium ml-1", children: row.index + 1 }),
|
|
3302
3315
|
renderSubComponent && hasSubComponent(row.original) && /* @__PURE__ */ jsx24(
|
|
@@ -3346,7 +3359,7 @@ function PostTable({
|
|
|
3346
3359
|
rowPadding,
|
|
3347
3360
|
"text-sm font-semibold text-gray-900 dark:text-zinc-100 text-left",
|
|
3348
3361
|
verticalLines && "border-x border-gray-200 dark:border-zinc-800",
|
|
3349
|
-
header.id === "_index" && "w-
|
|
3362
|
+
header.id === "_index" && "w-[1%] min-w-[40px] max-w-[40px] whitespace-nowrap",
|
|
3350
3363
|
header.column.columnDef.meta?.className
|
|
3351
3364
|
),
|
|
3352
3365
|
style: {
|
|
@@ -3408,7 +3421,7 @@ function PostTable({
|
|
|
3408
3421
|
rowPadding,
|
|
3409
3422
|
"text-sm text-gray-700 dark:text-gray-200",
|
|
3410
3423
|
verticalLines && "border-x border-gray-200 dark:border-zinc-800",
|
|
3411
|
-
cell.column.id === "_index" && "w-
|
|
3424
|
+
cell.column.id === "_index" && "w-[1%] min-w-[40px] max-w-[40px] whitespace-nowrap",
|
|
3412
3425
|
cell.column.columnDef.meta?.className
|
|
3413
3426
|
),
|
|
3414
3427
|
style: {
|
|
@@ -3543,7 +3556,7 @@ function PostTable({
|
|
|
3543
3556
|
"py-1! text-sm align-middle transition-colors duration-200",
|
|
3544
3557
|
column.id !== "_index" ? "cursor-text" : "",
|
|
3545
3558
|
verticalLines ? "border-x border-gray-200 dark:border-zinc-800" : "",
|
|
3546
|
-
column.id === "_index" ? "w-
|
|
3559
|
+
column.id === "_index" ? "w-[1%] min-w-[40px] max-w-[40px] whitespace-nowrap" : "",
|
|
3547
3560
|
hasError && "ring-1 ring-inset ring-red-500",
|
|
3548
3561
|
column.columnDef.meta?.className
|
|
3549
3562
|
),
|
|
@@ -3560,7 +3573,7 @@ function PostTable({
|
|
|
3560
3573
|
column.id === "_index" ? "" : "h-9",
|
|
3561
3574
|
!column.columnDef.meta?.className?.match(
|
|
3562
3575
|
/\b(w-|min-w-|max-w-)/
|
|
3563
|
-
) && !column.columnDef.meta?.width && "min-w-32"
|
|
3576
|
+
) && !column.columnDef.meta?.width && (!column.columnDef.maxSize || column.columnDef.maxSize >= 128) && (!column.columnDef.size || column.columnDef.size >= 128) && "min-w-32"
|
|
3564
3577
|
),
|
|
3565
3578
|
onKeyDown: (e) => {
|
|
3566
3579
|
if (e.key === "Enter") {
|
|
@@ -3618,7 +3631,7 @@ function PostTable({
|
|
|
3618
3631
|
rowPadding,
|
|
3619
3632
|
"text-sm font-semibold text-gray-900 dark:text-zinc-100 text-left",
|
|
3620
3633
|
verticalLines && "border-x border-gray-200 dark:border-zinc-800",
|
|
3621
|
-
header.id === "_index" && "w-
|
|
3634
|
+
header.id === "_index" && "w-[1%] min-w-[40px] max-w-[40px] whitespace-nowrap",
|
|
3622
3635
|
header.column.columnDef.meta?.className
|
|
3623
3636
|
),
|
|
3624
3637
|
style: {
|
package/dist/styles.js
CHANGED
|
@@ -699,6 +699,9 @@ select:-webkit-autofill:focus {
|
|
|
699
699
|
.w-8 {
|
|
700
700
|
width: 2rem;
|
|
701
701
|
}
|
|
702
|
+
.w-\\[1\\%\\] {
|
|
703
|
+
width: 1%;
|
|
704
|
+
}
|
|
702
705
|
.w-full {
|
|
703
706
|
width: 100%;
|
|
704
707
|
}
|
|
@@ -714,9 +717,15 @@ select:-webkit-autofill:focus {
|
|
|
714
717
|
.min-w-32 {
|
|
715
718
|
min-width: 8rem;
|
|
716
719
|
}
|
|
720
|
+
.min-w-\\[40px\\] {
|
|
721
|
+
min-width: 40px;
|
|
722
|
+
}
|
|
717
723
|
.max-w-2xl {
|
|
718
724
|
max-width: 42rem;
|
|
719
725
|
}
|
|
726
|
+
.max-w-\\[40px\\] {
|
|
727
|
+
max-width: 40px;
|
|
728
|
+
}
|
|
720
729
|
.max-w-full {
|
|
721
730
|
max-width: 100%;
|
|
722
731
|
}
|
package/dist/styles.mjs
CHANGED
|
@@ -697,6 +697,9 @@ select:-webkit-autofill:focus {
|
|
|
697
697
|
.w-8 {
|
|
698
698
|
width: 2rem;
|
|
699
699
|
}
|
|
700
|
+
.w-\\[1\\%\\] {
|
|
701
|
+
width: 1%;
|
|
702
|
+
}
|
|
700
703
|
.w-full {
|
|
701
704
|
width: 100%;
|
|
702
705
|
}
|
|
@@ -712,9 +715,15 @@ select:-webkit-autofill:focus {
|
|
|
712
715
|
.min-w-32 {
|
|
713
716
|
min-width: 8rem;
|
|
714
717
|
}
|
|
718
|
+
.min-w-\\[40px\\] {
|
|
719
|
+
min-width: 40px;
|
|
720
|
+
}
|
|
715
721
|
.max-w-2xl {
|
|
716
722
|
max-width: 42rem;
|
|
717
723
|
}
|
|
724
|
+
.max-w-\\[40px\\] {
|
|
725
|
+
max-width: 40px;
|
|
726
|
+
}
|
|
718
727
|
.max-w-full {
|
|
719
728
|
max-width: 100%;
|
|
720
729
|
}
|