@recruitnepal/shared-packages 1.7.2 → 1.8.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/dist/components/common/NoData.d.ts +3 -4
- package/dist/components/common/NoData.d.ts.map +1 -1
- package/dist/components/common/NoData.js +4 -2
- package/dist/components/ui/Badge.d.ts +10 -0
- package/dist/components/ui/Badge.d.ts.map +1 -0
- package/dist/components/ui/Badge.js +20 -0
- package/dist/components/ui/BulletListTextarea.d.ts.map +1 -1
- package/dist/components/ui/BulletListTextarea.js +3 -2
- package/dist/components/ui/Button.d.ts +12 -0
- package/dist/components/ui/Button.d.ts.map +1 -0
- package/dist/components/ui/Button.js +31 -0
- package/dist/components/ui/DesignationSelect.d.ts +2 -4
- package/dist/components/ui/DesignationSelect.d.ts.map +1 -1
- package/dist/components/ui/DesignationSelect.js +5 -11
- package/dist/components/ui/IndustrySelect.d.ts +3 -4
- package/dist/components/ui/IndustrySelect.d.ts.map +1 -1
- package/dist/components/ui/IndustrySelect.js +1 -3
- package/dist/components/ui/MultiSelectOptions.d.ts +3 -5
- package/dist/components/ui/MultiSelectOptions.d.ts.map +1 -1
- package/dist/components/ui/MultiSelectOptions.js +19 -33
- package/dist/hooks/useDebounce.d.ts +3 -0
- package/dist/hooks/useDebounce.d.ts.map +1 -1
- package/dist/hooks/useDebounce.js +3 -0
- package/dist/hooks/useDesignations.d.ts +1 -9
- package/dist/hooks/useDesignations.d.ts.map +1 -1
- package/dist/hooks/useDesignations.js +59 -68
- package/dist/hooks/useIndustries.d.ts +4 -10
- package/dist/hooks/useIndustries.d.ts.map +1 -1
- package/dist/hooks/useIndustries.js +60 -69
- package/dist/hooks/useSkills.d.ts +1 -2
- package/dist/hooks/useSkills.d.ts.map +1 -1
- package/dist/hooks/useSkills.js +7 -7
- package/dist/index.d.ts +9 -30
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -23
- package/dist/utils/cn.d.ts +2 -1
- package/dist/utils/cn.d.ts.map +1 -1
- package/dist/utils/cn.js +4 -2
- package/package.json +23 -21
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
type NoDataProps = {
|
|
1
|
+
type Props = {
|
|
3
2
|
message?: string;
|
|
4
3
|
description?: string;
|
|
5
4
|
};
|
|
6
|
-
|
|
7
|
-
export
|
|
5
|
+
declare const NoData: ({ message, description }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export default NoData;
|
|
8
7
|
//# sourceMappingURL=NoData.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NoData.d.ts","sourceRoot":"","sources":["../../../src/components/common/NoData.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"NoData.d.ts","sourceRoot":"","sources":["../../../src/components/common/NoData.tsx"],"names":[],"mappings":"AAGA,KAAK,KAAK,GAAG;IACX,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,QAAA,MAAM,MAAM,GAAI,0BAA4C,KAAK,4CAkBhE,CAAC;AACF,eAAe,MAAM,CAAC"}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
import Image from 'next/image';
|
|
3
|
+
const NoData = ({ message = 'No data found', description }) => {
|
|
4
|
+
return (_jsxs("div", { className: "w-full h-full flex flex-col gap-2 items-center justify-center py-5 ", children: [_jsx("div", { className: " flex items-center justify-center p-5 rounded-full bg-gray-50 w-fit", children: _jsx(Image, { src: "/images/common/box.webp", alt: "empty box", width: 64, height: 64, className: "object-contain" }) }), _jsxs("div", { className: "text-center", children: [_jsx("p", { className: "text-gray-700", children: message }), description && _jsx("p", { className: "text-gray-500 text-xs", children: description })] })] }));
|
|
4
5
|
};
|
|
6
|
+
export default NoData;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { type VariantProps } from 'class-variance-authority';
|
|
3
|
+
declare const badgeVariants: (props?: ({
|
|
4
|
+
variant?: "outline" | "secondary" | "default" | null | undefined;
|
|
5
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
6
|
+
export interface BadgeProps extends React.HTMLAttributes<HTMLDivElement>, VariantProps<typeof badgeVariants> {
|
|
7
|
+
}
|
|
8
|
+
declare function Badge({ className, variant, ...props }: BadgeProps): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export { Badge, badgeVariants };
|
|
10
|
+
//# sourceMappingURL=Badge.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Badge.d.ts","sourceRoot":"","sources":["../../../src/components/ui/Badge.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAGlE,QAAA,MAAM,aAAa;;8EAclB,CAAC;AAEF,MAAM,WAAW,UACf,SAAQ,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,EAC1C,YAAY,CAAC,OAAO,aAAa,CAAC;CAAG;AAEzC,iBAAS,KAAK,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,GAAG,KAAK,EAAE,EAAE,UAAU,2CAI1D;AAED,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { cva } from 'class-variance-authority';
|
|
4
|
+
import { cn } from '../../utils/cn';
|
|
5
|
+
const badgeVariants = cva('inline-flex items-center rounded-full border px-2.5 py-1.5 text-xs transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2', {
|
|
6
|
+
variants: {
|
|
7
|
+
variant: {
|
|
8
|
+
default: 'border-transparent bg-primary/40 text-primary-foreground',
|
|
9
|
+
secondary: 'border-transparent bg-secondary text-secondary-foreground',
|
|
10
|
+
outline: 'text-foreground',
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
defaultVariants: {
|
|
14
|
+
variant: 'default',
|
|
15
|
+
},
|
|
16
|
+
});
|
|
17
|
+
function Badge({ className, variant, ...props }) {
|
|
18
|
+
return (_jsx("div", { className: cn(badgeVariants({ variant }), className), ...props }));
|
|
19
|
+
}
|
|
20
|
+
export { Badge, badgeVariants };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BulletListTextarea.d.ts","sourceRoot":"","sources":["../../../src/components/ui/BulletListTextarea.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"BulletListTextarea.d.ts","sourceRoot":"","sources":["../../../src/components/ui/BulletListTextarea.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,QAAA,MAAM,MAAM,YAAO,CAAC;AAEpB,iBAAS,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,GAAG,SAAS,GAAG,IAAI,GAAG,MAAM,EAAE,CAQ/E;AAED,iBAAS,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEzC;AAED,MAAM,WAAW,uBAAuB;IACtC,iGAAiG;IACjG,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,GAAG,SAAS,GAAG,IAAI,CAAC;IAC5C,+DAA+D;IAC/D,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;IACpC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,6CAA6C;IAC7C,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CACxB;AAED,QAAA,MAAM,kBAAkB,qGAwEvB,CAAC;AAIF,OAAO,EAAE,kBAAkB,EAAE,MAAM,EAAE,WAAW,EAAE,gBAAgB,EAAE,CAAC"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import * as React from 'react';
|
|
4
|
-
import {
|
|
4
|
+
import { Textarea } from '@/components/ui/textarea';
|
|
5
|
+
import { cn } from '@/utils/lib/utils';
|
|
5
6
|
const BULLET = '• ';
|
|
6
7
|
function normalizeToArray(value) {
|
|
7
8
|
if (Array.isArray(value)) {
|
|
@@ -54,7 +55,7 @@ const BulletListTextarea = React.forwardRef(({ value, onChange, placeholder = `$
|
|
|
54
55
|
}
|
|
55
56
|
}
|
|
56
57
|
};
|
|
57
|
-
return (_jsxs("div", { className: "space-y-1.5", children: [_jsx(
|
|
58
|
+
return (_jsxs("div", { className: "space-y-1.5", children: [_jsx(Textarea, { ref: ref, placeholder: placeholder, value: textValue, onChange: handleChange, onKeyDown: handleKeyDown, rows: rows, disabled: disabled, className: cn('min-h-[120px] resize-y text-base', className) }), hint && _jsx("p", { className: "text-xs text-muted-foreground", children: hint })] }));
|
|
58
59
|
});
|
|
59
60
|
BulletListTextarea.displayName = 'BulletListTextarea';
|
|
60
61
|
export { BulletListTextarea, BULLET, stripBullet, normalizeToArray };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { type VariantProps } from 'class-variance-authority';
|
|
3
|
+
declare const buttonVariants: (props?: ({
|
|
4
|
+
variant?: "outline" | "secondary" | "default" | "ghost" | null | undefined;
|
|
5
|
+
size?: "sm" | "default" | "lg" | null | undefined;
|
|
6
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
7
|
+
export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants> {
|
|
8
|
+
asChild?: boolean;
|
|
9
|
+
}
|
|
10
|
+
declare const Button: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
11
|
+
export { Button, buttonVariants };
|
|
12
|
+
//# sourceMappingURL=Button.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../../src/components/ui/Button.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAGlE,QAAA,MAAM,cAAc;;;8EAqBnB,CAAC;AAEF,MAAM,WAAW,WACf,SAAQ,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,EACnD,YAAY,CAAC,OAAO,cAAc,CAAC;IACrC,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,QAAA,MAAM,MAAM,uFAWX,CAAC;AAGF,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { Slot } from '@radix-ui/react-slot';
|
|
5
|
+
import { cva } from 'class-variance-authority';
|
|
6
|
+
import { cn } from '../../utils/cn';
|
|
7
|
+
const buttonVariants = cva('inline-flex items-center justify-center whitespace-nowrap rounded-lg text-base font-normal ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50', {
|
|
8
|
+
variants: {
|
|
9
|
+
variant: {
|
|
10
|
+
default: 'bg-primary text-primary-foreground hover:bg-primary/90',
|
|
11
|
+
outline: 'border border-input bg-background hover:bg-accent hover:text-accent-foreground',
|
|
12
|
+
secondary: 'bg-secondary text-secondary-foreground hover:bg-secondary/80',
|
|
13
|
+
ghost: 'hover:bg-accent hover:text-accent-foreground',
|
|
14
|
+
},
|
|
15
|
+
size: {
|
|
16
|
+
default: 'h-10 px-4 py-2',
|
|
17
|
+
sm: 'h-9 rounded-md px-3',
|
|
18
|
+
lg: 'h-11 rounded-md px-8',
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
defaultVariants: {
|
|
22
|
+
variant: 'default',
|
|
23
|
+
size: 'default',
|
|
24
|
+
},
|
|
25
|
+
});
|
|
26
|
+
const Button = React.forwardRef(({ className, variant, size, asChild = false, ...props }, ref) => {
|
|
27
|
+
const Comp = asChild ? Slot : 'button';
|
|
28
|
+
return (_jsx(Comp, { className: cn(buttonVariants({ variant, size, className })), ref: ref, ...props }));
|
|
29
|
+
});
|
|
30
|
+
Button.displayName = 'Button';
|
|
31
|
+
export { Button, buttonVariants };
|
|
@@ -5,9 +5,7 @@ export interface DesignationSelectProps {
|
|
|
5
5
|
disabled?: boolean;
|
|
6
6
|
className?: string;
|
|
7
7
|
valueType?: 'id' | 'title';
|
|
8
|
-
|
|
9
|
-
token?: string | null;
|
|
8
|
+
token?: string;
|
|
10
9
|
}
|
|
11
|
-
export default function DesignationSelect({ value, onChange, placeholder, disabled, className, valueType,
|
|
12
|
-
token, }: DesignationSelectProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export default function DesignationSelect({ value, onChange, placeholder, disabled, className, valueType, token, }: DesignationSelectProps): import("react/jsx-runtime").JSX.Element;
|
|
13
11
|
//# sourceMappingURL=DesignationSelect.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DesignationSelect.d.ts","sourceRoot":"","sources":["../../../src/components/ui/DesignationSelect.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"DesignationSelect.d.ts","sourceRoot":"","sources":["../../../src/components/ui/DesignationSelect.tsx"],"names":[],"mappings":"AAiBA,MAAM,WAAW,sBAAsB;IACrC,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,IAAI,GAAG,OAAO,CAAC;IAC3B,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAOD,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAAC,EACxC,KAAK,EACL,QAAQ,EACR,WAAoC,EACpC,QAAQ,EACR,SAAS,EACT,SAAmB,EACnB,KAAK,GACN,EAAE,sBAAsB,2CAyJxB"}
|
|
@@ -7,15 +7,12 @@ import { cn } from '../../utils/cn';
|
|
|
7
7
|
import { useDebounce } from '../../hooks/useDebounce';
|
|
8
8
|
import { Popover, PopoverContent, PopoverTrigger } from './popover';
|
|
9
9
|
import { Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, } from './command';
|
|
10
|
-
/** Matches ShadCN <SelectTrigger> so it looks like a normal input */
|
|
11
10
|
const selectTriggerClasses = 'flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none disabled:cursor-not-allowed cursor-pointer disabled:opacity-50';
|
|
12
11
|
const toString = (v) => String(v ?? '');
|
|
13
|
-
export default function DesignationSelect({ value, onChange, placeholder = 'Select a designation', disabled, className, valueType = 'title',
|
|
14
|
-
token, }) {
|
|
12
|
+
export default function DesignationSelect({ value, onChange, placeholder = 'Select a designation', disabled, className, valueType = 'title', token, }) {
|
|
15
13
|
const [open, setOpen] = React.useState(false);
|
|
16
14
|
const [searchQuery, setSearchQuery] = React.useState('');
|
|
17
15
|
const debouncedSearch = useDebounce(searchQuery, 300);
|
|
18
|
-
// Use backend search when there's a search query; infinite query for load-more on scroll
|
|
19
16
|
const { designations = [], designationsQuery, isLoading, } = useDesignations({
|
|
20
17
|
queryObject: debouncedSearch ? { search: debouncedSearch } : {},
|
|
21
18
|
limit: 50,
|
|
@@ -36,20 +33,17 @@ token, }) {
|
|
|
36
33
|
]);
|
|
37
34
|
const options = React.useMemo(() => designations.map((d) => ({
|
|
38
35
|
id: String(d.id),
|
|
39
|
-
title: d.title
|
|
36
|
+
title: d.title ?? String(d.id),
|
|
40
37
|
})), [designations]);
|
|
41
|
-
// Find selected option based on valueType
|
|
42
38
|
const selectedOption = React.useMemo(() => {
|
|
43
39
|
if (!value)
|
|
44
40
|
return null;
|
|
45
41
|
if (valueType === 'id') {
|
|
46
42
|
return options.find((o) => toString(o.id) === toString(value));
|
|
47
43
|
}
|
|
48
|
-
|
|
49
|
-
return options.find((o) => o.title === value);
|
|
50
|
-
}
|
|
44
|
+
return options.find((o) => o.title === value);
|
|
51
45
|
}, [value, options, valueType]);
|
|
52
|
-
const selectedLabel = selectedOption?.title
|
|
46
|
+
const selectedLabel = selectedOption?.title ?? '';
|
|
53
47
|
return (_jsxs(Popover, { open: open, onOpenChange: setOpen, children: [_jsx(PopoverTrigger, { asChild: true, children: _jsxs("div", { role: "combobox", "aria-expanded": open, "aria-disabled": disabled || isLoading, tabIndex: 0, onClick: () => !(disabled || isLoading) && setOpen((v) => !v), onKeyDown: (e) => {
|
|
54
48
|
if ((e.key === 'Enter' || e.key === ' ') && !(disabled || isLoading)) {
|
|
55
49
|
e.preventDefault();
|
|
@@ -68,7 +62,7 @@ token, }) {
|
|
|
68
62
|
: value === o.title;
|
|
69
63
|
return (_jsxs(CommandItem, { value: o.id, onSelect: () => {
|
|
70
64
|
const newValue = valueType === 'id' ? o.id : o.title;
|
|
71
|
-
onChange(newValue);
|
|
65
|
+
onChange(newValue ?? '');
|
|
72
66
|
setOpen(false);
|
|
73
67
|
setSearchQuery('');
|
|
74
68
|
}, className: "cursor-pointer", children: [_jsx(Check, { className: cn('mr-2 h-4 w-4', isSelected ? 'opacity-100' : 'opacity-0') }), o.title] }, o.id));
|
|
@@ -5,9 +5,8 @@ export interface IndustrySelectProps {
|
|
|
5
5
|
disabled?: boolean;
|
|
6
6
|
className?: string;
|
|
7
7
|
valueType?: 'id' | 'title';
|
|
8
|
-
/** Optional auth token (e.g. from
|
|
9
|
-
token?: string
|
|
8
|
+
/** Optional auth token for API (e.g. from app session) */
|
|
9
|
+
token?: string;
|
|
10
10
|
}
|
|
11
|
-
export default function IndustrySelect({ value, onChange, placeholder, disabled, className, valueType,
|
|
12
|
-
token, }: IndustrySelectProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export default function IndustrySelect({ value, onChange, placeholder, disabled, className, valueType, token, }: IndustrySelectProps): import("react/jsx-runtime").JSX.Element;
|
|
13
12
|
//# sourceMappingURL=IndustrySelect.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IndustrySelect.d.ts","sourceRoot":"","sources":["../../../src/components/ui/IndustrySelect.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"IndustrySelect.d.ts","sourceRoot":"","sources":["../../../src/components/ui/IndustrySelect.tsx"],"names":[],"mappings":"AAiBA,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,IAAI,GAAG,OAAO,CAAC;IAC3B,0DAA0D;IAC1D,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAQD,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,EACrC,KAAK,EACL,QAAQ,EACR,WAAkC,EAClC,QAAQ,EACR,SAAS,EACT,SAAgB,EAChB,KAAK,GACN,EAAE,mBAAmB,2CA4JrB"}
|
|
@@ -10,12 +10,10 @@ import { Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, Command
|
|
|
10
10
|
/** Matches ShadCN <SelectTrigger> so it looks like a normal input */
|
|
11
11
|
const selectTriggerClasses = 'flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none disabled:cursor-not-allowed cursor-pointer disabled:opacity-50';
|
|
12
12
|
const toString = (v) => String(v ?? '');
|
|
13
|
-
export default function IndustrySelect({ value, onChange, placeholder = 'Select an industry', disabled, className, valueType = 'id',
|
|
14
|
-
token, }) {
|
|
13
|
+
export default function IndustrySelect({ value, onChange, placeholder = 'Select an industry', disabled, className, valueType = 'id', token, }) {
|
|
15
14
|
const [open, setOpen] = React.useState(false);
|
|
16
15
|
const [searchQuery, setSearchQuery] = React.useState('');
|
|
17
16
|
const debouncedSearch = useDebounce(searchQuery, 300);
|
|
18
|
-
// Use backend search when there's a search query; infinite query for load-more on scroll
|
|
19
17
|
const { industries = [], industriesQuery, isLoading, } = useIndustries({
|
|
20
18
|
queryObject: debouncedSearch ? { search: debouncedSearch } : {},
|
|
21
19
|
limit: 50,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { InfiniteData, UseInfiniteQueryResult } from '@tanstack/react-query';
|
|
2
2
|
import type { Skill } from '../../hooks/useSkills';
|
|
3
|
-
type
|
|
3
|
+
export type MultiSelectOptionsProps = {
|
|
4
4
|
value: string[];
|
|
5
5
|
onChange: (value: string[]) => void;
|
|
6
6
|
options: string[];
|
|
@@ -10,9 +10,7 @@ type Props = {
|
|
|
10
10
|
}>, Error>;
|
|
11
11
|
disabled?: boolean;
|
|
12
12
|
staticOnly?: boolean;
|
|
13
|
-
|
|
14
|
-
token?: string | null;
|
|
13
|
+
token?: string;
|
|
15
14
|
};
|
|
16
|
-
export declare function MultiSelectOptions({ value, onChange, options, query: externalQuery, disabled, staticOnly, token, }:
|
|
17
|
-
export {};
|
|
15
|
+
export declare function MultiSelectOptions({ value, onChange, options, query: externalQuery, disabled, staticOnly, token, }: MultiSelectOptionsProps): import("react/jsx-runtime").JSX.Element;
|
|
18
16
|
//# sourceMappingURL=MultiSelectOptions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MultiSelectOptions.d.ts","sourceRoot":"","sources":["../../../src/components/ui/MultiSelectOptions.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"MultiSelectOptions.d.ts","sourceRoot":"","sources":["../../../src/components/ui/MultiSelectOptions.tsx"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EACV,YAAY,EACZ,sBAAsB,EACvB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAInD,MAAM,MAAM,uBAAuB,GAAG;IACpC,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;IACpC,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,KAAK,CAAC,EAAE,sBAAsB,CAC5B,YAAY,CAAC;QAAE,IAAI,EAAE,KAAK,EAAE,CAAC;QAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,CAAC,EACxD,KAAK,CACN,CAAC;IACF,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAsCF,wBAAgB,kBAAkB,CAAC,EACjC,KAAK,EACL,QAAQ,EACR,OAAO,EACP,KAAK,EAAE,aAAa,EACpB,QAAQ,EACR,UAAkB,EAClB,KAAK,GACN,EAAE,uBAAuB,2CAwJzB"}
|
|
@@ -2,33 +2,26 @@
|
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { Popover, PopoverTrigger, PopoverContent, } from './popover';
|
|
4
4
|
import { Command, CommandInput, CommandItem, CommandList, CommandGroup, CommandEmpty, } from './command';
|
|
5
|
+
import { Button } from './Button';
|
|
6
|
+
import { Badge } from './Badge';
|
|
5
7
|
import { X } from 'lucide-react';
|
|
6
|
-
import { useEffect, useState, useMemo
|
|
8
|
+
import { useEffect, useState, useMemo } from 'react';
|
|
9
|
+
import { useInView } from 'react-intersection-observer';
|
|
7
10
|
import { useSkills } from '../../hooks/useSkills';
|
|
11
|
+
import { useDebounce } from '../../hooks/useDebounce';
|
|
8
12
|
// Sub-component for badges
|
|
9
13
|
function SelectedBadges({ skills, removeSkill, }) {
|
|
10
|
-
return (_jsx("div", { className: "flex flex-wrap gap-1 w-full", children: skills.map((skill) => (_jsxs("
|
|
14
|
+
return (_jsx("div", { className: "flex flex-wrap gap-1 w-full", children: skills.map((skill) => (_jsxs(Badge, { variant: "secondary", className: "\n flex items-center gap-1\n px-1.5 py-0.5\n rounded-lg\n bg-primary text-white\n text-[11px] leading-tight sm:text-xs\n max-w-full break-words\n ", children: [_jsx("span", { className: "inline-block max-w-[72vw] sm:max-w-full overflow-hidden text-ellipsis", children: skill }), _jsx(X, { className: "w-3 h-3 cursor-pointer shrink-0", onClick: (e) => removeSkill(skill, e) })] }, skill))) }));
|
|
11
15
|
}
|
|
12
16
|
export function MultiSelectOptions({ value, onChange, options, query: externalQuery, disabled, staticOnly = false, token, }) {
|
|
13
17
|
const [open, setOpen] = useState(false);
|
|
14
18
|
const [search, setSearch] = useState('');
|
|
15
|
-
const
|
|
16
|
-
const
|
|
17
|
-
// Debounce search input to reduce API calls
|
|
18
|
-
useEffect(() => {
|
|
19
|
-
const timer = setTimeout(() => {
|
|
20
|
-
setDebouncedSearch(search.trim());
|
|
21
|
-
}, 300); // 300ms debounce delay
|
|
22
|
-
return () => clearTimeout(timer);
|
|
23
|
-
}, [search]);
|
|
24
|
-
// Use internal query with search if no external query provided, or if search is active
|
|
25
|
-
// If external query is provided and no search, use it for backward compatibility
|
|
26
|
-
// Skip API query if staticOnly is true
|
|
19
|
+
const debouncedSearch = useDebounce(search.trim(), 300);
|
|
20
|
+
const { ref, inView } = useInView();
|
|
27
21
|
const shouldUseInternalQuery = !staticOnly && (!externalQuery || debouncedSearch.length > 0);
|
|
28
22
|
const internalSkills = useSkills({
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
batchSize: 1, // Single page per load for faster response
|
|
23
|
+
limit: debouncedSearch ? 50 : 20,
|
|
24
|
+
batchSize: 1,
|
|
32
25
|
queryObject: debouncedSearch ? { search: debouncedSearch } : {},
|
|
33
26
|
token,
|
|
34
27
|
});
|
|
@@ -48,25 +41,18 @@ export function MultiSelectOptions({ value, onChange, options, query: externalQu
|
|
|
48
41
|
const apiOptions = query?.data?.pages.flatMap((page) => page.data?.map((s) => s.skill).filter(Boolean)) || [];
|
|
49
42
|
return Array.from(new Set([...options, ...apiOptions]));
|
|
50
43
|
}, [options, query?.data, staticOnly, debouncedSearch]);
|
|
51
|
-
// Reset search when popover closes
|
|
44
|
+
// Reset search when popover closes (debouncedSearch will follow)
|
|
52
45
|
useEffect(() => {
|
|
53
|
-
if (!open)
|
|
46
|
+
if (!open)
|
|
54
47
|
setSearch('');
|
|
55
|
-
setDebouncedSearch('');
|
|
56
|
-
}
|
|
57
48
|
}, [open]);
|
|
58
|
-
// Infinite scroll
|
|
49
|
+
// Infinite scroll
|
|
59
50
|
useEffect(() => {
|
|
60
|
-
if (
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
}
|
|
66
|
-
}, { threshold: 0.1 });
|
|
67
|
-
observer.observe(loadMoreRef.current);
|
|
68
|
-
return () => observer.disconnect();
|
|
69
|
-
}, [query?.hasNextPage, query?.isFetchingNextPage, query]);
|
|
51
|
+
if (inView && query?.hasNextPage && !query?.isFetchingNextPage) {
|
|
52
|
+
const timeout = setTimeout(() => query.fetchNextPage?.(), 200);
|
|
53
|
+
return () => clearTimeout(timeout);
|
|
54
|
+
}
|
|
55
|
+
}, [inView, query?.hasNextPage, query?.isFetchingNextPage, query]);
|
|
70
56
|
// Handlers
|
|
71
57
|
const toggleSkill = (skill) => onChange(value.includes(skill)
|
|
72
58
|
? value.filter((s) => s !== skill)
|
|
@@ -81,5 +67,5 @@ export function MultiSelectOptions({ value, onChange, options, query: externalQu
|
|
|
81
67
|
const canAddCustom = trimmedSearch &&
|
|
82
68
|
!combinedOptions.includes(trimmedSearch) &&
|
|
83
69
|
!value.includes(trimmedSearch);
|
|
84
|
-
return (_jsx("div", { className: "w-full", children: _jsxs(Popover, { open: open, onOpenChange: setOpen, children: [_jsx(PopoverTrigger, { disabled: disabled, asChild: true, children: _jsx(
|
|
70
|
+
return (_jsx("div", { className: "w-full", children: _jsxs(Popover, { open: open, onOpenChange: setOpen, children: [_jsx(PopoverTrigger, { disabled: disabled, asChild: true, children: _jsx(Button, { variant: "outline", className: "w-full min-h-10 justify-start border-slate-200 px-2 py-1 h-auto", children: value.length > 0 ? (_jsx(SelectedBadges, { skills: value, removeSkill: removeSkill })) : (_jsx("span", { className: "text-muted-foreground", children: "Select Options" })) }) }), _jsx(PopoverContent, { className: "max-w-sm max-h-[300px] overflow-y-auto p-0", children: _jsxs(Command, { shouldFilter: false, children: [_jsx(CommandInput, { value: search, onValueChange: setSearch, placeholder: "Search or add..." }), _jsxs(CommandList, { className: "max-h-[250px] overflow-y-auto", children: [!staticOnly && query?.isFetching && combinedOptions.length === 0 && (_jsx("div", { className: "text-center text-muted-foreground text-xs py-4", children: "Searching..." })), _jsxs(CommandGroup, { children: [combinedOptions.map((skill) => (_jsx(CommandItem, { onSelect: () => toggleSkill(skill), className: "cursor-pointer", children: _jsxs("div", { className: "flex items-center gap-2", children: [_jsx("input", { type: "checkbox", checked: value.includes(skill), readOnly: true, className: "accent-primary" }), _jsx("span", { children: skill })] }) }, skill))), canAddCustom && (_jsxs(CommandItem, { onSelect: () => toggleSkill(trimmedSearch), className: "cursor-pointer text-primary space-x-2", children: [_jsx("span", { className: "px-2 py-0.5 bg-green-600 hover:bg-green-500 rounded-sm text-xs text-white", children: "Add" }), _jsx("span", { children: trimmedSearch })] }))] }), combinedOptions.length === 0 && !canAddCustom && (!staticOnly && !query?.isFetching) && (_jsx(CommandEmpty, { children: "No matches found." })), !staticOnly && query?.hasNextPage && !query?.isFetching && (_jsx("div", { ref: ref, className: "text-center text-muted-foreground text-xs py-2", children: "Loading more..." }))] })] }) })] }) }));
|
|
85
71
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDebounce.d.ts","sourceRoot":"","sources":["../../src/hooks/useDebounce.ts"],"names":[],"mappings":"AAEA,wBAAgB,WAAW,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,GAAE,MAAY,GAAG,CAAC,CAS/D"}
|
|
1
|
+
{"version":3,"file":"useDebounce.d.ts","sourceRoot":"","sources":["../../src/hooks/useDebounce.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,GAAE,MAAY,GAAG,CAAC,CAS/D"}
|
|
@@ -15,15 +15,10 @@ export type UseDesignationsParams = {
|
|
|
15
15
|
limit?: number;
|
|
16
16
|
batchSize?: number;
|
|
17
17
|
queryObject?: Record<string, unknown>;
|
|
18
|
-
token?: string
|
|
18
|
+
token?: string;
|
|
19
19
|
};
|
|
20
20
|
export declare const useDesignations: ({ limit, batchSize, queryObject, token, }?: UseDesignationsParams) => {
|
|
21
21
|
designations: Designation[];
|
|
22
|
-
pagination: {
|
|
23
|
-
total: number;
|
|
24
|
-
page: number;
|
|
25
|
-
pages: number;
|
|
26
|
-
} | undefined;
|
|
27
22
|
designationsQuery: import("@tanstack/react-query").UseInfiniteQueryResult<import("@tanstack/query-core").InfiniteData<{
|
|
28
23
|
data: Designation[];
|
|
29
24
|
nextPage: number | null;
|
|
@@ -44,8 +39,5 @@ export declare const useDesignations: ({ limit, batchSize, queryObject, token, }
|
|
|
44
39
|
data: DesignationPayload;
|
|
45
40
|
}, unknown>;
|
|
46
41
|
deleteDesignation: import("@tanstack/react-query").UseMutationResult<unknown, Error, string, unknown>;
|
|
47
|
-
isCreating: boolean;
|
|
48
|
-
isUpdating: boolean;
|
|
49
|
-
isDeleting: boolean;
|
|
50
42
|
};
|
|
51
43
|
//# sourceMappingURL=useDesignations.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDesignations.d.ts","sourceRoot":"","sources":["../../src/hooks/useDesignations.ts"],"names":[],"mappings":"AAMA,MAAM,MAAM,WAAW,GAAG;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAeF,MAAM,MAAM,qBAAqB,GAAG;IAClC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACtC,KAAK,CAAC,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"useDesignations.d.ts","sourceRoot":"","sources":["../../src/hooks/useDesignations.ts"],"names":[],"mappings":"AAMA,MAAM,MAAM,WAAW,GAAG;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAeF,MAAM,MAAM,qBAAqB,GAAG;IAClC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACtC,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,eAAO,MAAM,eAAe,GAAI,4CAK7B,qBAA0B;;;;;;;;;;;;;;;;;;YAkFgB,MAAM;cAAQ,kBAAkB;;;CA+B5E,CAAC"}
|
|
@@ -11,31 +11,27 @@ export const useDesignations = ({ limit = 50, batchSize = 1, queryObject = {}, t
|
|
|
11
11
|
queryFn: async ({ pageParam = 1 }) => {
|
|
12
12
|
const pagesToFetch = Array.from({ length: batchSize }, (_, i) => pageParam + i);
|
|
13
13
|
const results = await Promise.all(pagesToFetch.map(async (page) => {
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
};
|
|
19
|
-
if (q.search) {
|
|
20
|
-
q.query = q.search;
|
|
21
|
-
delete q.search;
|
|
14
|
+
const params = { ...queryObject, page, limit };
|
|
15
|
+
if (params.search) {
|
|
16
|
+
params.query = params.search;
|
|
17
|
+
delete params.search;
|
|
22
18
|
}
|
|
23
|
-
const searchQuery = generateSearchQuery(
|
|
19
|
+
const searchQuery = generateSearchQuery(params);
|
|
24
20
|
const res = await apiRequest({
|
|
25
21
|
endpoint: `/designations?${searchQuery}`,
|
|
26
22
|
method: 'GET',
|
|
27
|
-
token
|
|
23
|
+
token,
|
|
28
24
|
});
|
|
29
25
|
if (!res.success) {
|
|
30
|
-
const
|
|
31
|
-
throw new Error(
|
|
26
|
+
const errs = res.errors;
|
|
27
|
+
throw new Error(errs?.error?.[0] ?? errs?.general?.[0] ?? 'Failed to fetch designations');
|
|
32
28
|
}
|
|
33
29
|
const payload = res.data;
|
|
34
|
-
const
|
|
35
|
-
const pages =
|
|
36
|
-
const nextPage =
|
|
30
|
+
const p = payload?.pagination;
|
|
31
|
+
const pages = p?.pages ?? 1;
|
|
32
|
+
const nextPage = p?.nextPage ?? (p && page < pages ? page + 1 : null);
|
|
37
33
|
return {
|
|
38
|
-
data: payload
|
|
34
|
+
data: payload?.data ?? [],
|
|
39
35
|
page,
|
|
40
36
|
pages,
|
|
41
37
|
nextPage,
|
|
@@ -52,66 +48,61 @@ export const useDesignations = ({ limit = 50, batchSize = 1, queryObject = {}, t
|
|
|
52
48
|
},
|
|
53
49
|
getNextPageParam: (lastPage) => lastPage.nextPage ?? undefined,
|
|
54
50
|
});
|
|
55
|
-
const createDesignation = useMutation({
|
|
56
|
-
mutationFn: async (data) => {
|
|
57
|
-
const res = await apiRequest({
|
|
58
|
-
endpoint: '/designations',
|
|
59
|
-
method: 'POST',
|
|
60
|
-
data,
|
|
61
|
-
token: token ?? undefined,
|
|
62
|
-
});
|
|
63
|
-
if (!res.success)
|
|
64
|
-
throw new Error(String((res.errors?.general?.[0]) || 'Failed to create designation'));
|
|
65
|
-
return res.data;
|
|
66
|
-
},
|
|
67
|
-
onSuccess: () => queryClient.invalidateQueries({ queryKey: ['designations'] }),
|
|
68
|
-
});
|
|
69
|
-
const updateDesignation = useMutation({
|
|
70
|
-
mutationFn: async ({ id, data }) => {
|
|
71
|
-
const res = await apiRequest({
|
|
72
|
-
endpoint: `/designations/${id}`,
|
|
73
|
-
method: 'PUT',
|
|
74
|
-
data,
|
|
75
|
-
token: token ?? undefined,
|
|
76
|
-
});
|
|
77
|
-
if (!res.success)
|
|
78
|
-
throw new Error(String((res.errors?.general?.[0]) || 'Failed to update designation'));
|
|
79
|
-
return res.data;
|
|
80
|
-
},
|
|
81
|
-
onSuccess: () => queryClient.invalidateQueries({ queryKey: ['designations'] }),
|
|
82
|
-
});
|
|
83
|
-
const deleteDesignation = useMutation({
|
|
84
|
-
mutationFn: async (id) => {
|
|
85
|
-
const res = await apiRequest({
|
|
86
|
-
endpoint: `/designations/${id}`,
|
|
87
|
-
method: 'DELETE',
|
|
88
|
-
token: token ?? undefined,
|
|
89
|
-
});
|
|
90
|
-
if (!res.success)
|
|
91
|
-
throw new Error(String((res.errors?.general?.[0]) || 'Failed to delete designation'));
|
|
92
|
-
return res.data;
|
|
93
|
-
},
|
|
94
|
-
onSuccess: () => queryClient.invalidateQueries({ queryKey: ['designations'] }),
|
|
95
|
-
});
|
|
96
51
|
const designations = designationsQuery.data?.pages?.flatMap((p) => p.data) ?? [];
|
|
97
|
-
const lastPage = designationsQuery.data?.pages?.slice(-1)?.[0];
|
|
98
|
-
const pagination = lastPage
|
|
99
|
-
? { total: designations.length, page: 1, pages: lastPage.totalPages ?? 1 }
|
|
100
|
-
: undefined;
|
|
101
52
|
return {
|
|
102
53
|
designations,
|
|
103
|
-
pagination,
|
|
104
54
|
designationsQuery,
|
|
105
55
|
isLoading: designationsQuery.isLoading,
|
|
106
56
|
isFetching: designationsQuery.isFetching,
|
|
107
57
|
isError: designationsQuery.isError,
|
|
108
58
|
error: designationsQuery.error,
|
|
109
59
|
refetch: designationsQuery.refetch,
|
|
110
|
-
createDesignation
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
60
|
+
createDesignation: useMutation({
|
|
61
|
+
mutationFn: async (data) => {
|
|
62
|
+
const res = await apiRequest({
|
|
63
|
+
endpoint: '/designations',
|
|
64
|
+
method: 'POST',
|
|
65
|
+
data,
|
|
66
|
+
token,
|
|
67
|
+
});
|
|
68
|
+
if (!res.success) {
|
|
69
|
+
const errs = res.errors;
|
|
70
|
+
throw new Error(errs?.error?.[0] ?? 'Failed to create designation');
|
|
71
|
+
}
|
|
72
|
+
return res.data;
|
|
73
|
+
},
|
|
74
|
+
onSuccess: () => queryClient.invalidateQueries({ queryKey: ['designations'] }),
|
|
75
|
+
}),
|
|
76
|
+
updateDesignation: useMutation({
|
|
77
|
+
mutationFn: async ({ id, data }) => {
|
|
78
|
+
const res = await apiRequest({
|
|
79
|
+
endpoint: `/designations/${id}`,
|
|
80
|
+
method: 'PUT',
|
|
81
|
+
data,
|
|
82
|
+
token,
|
|
83
|
+
});
|
|
84
|
+
if (!res.success) {
|
|
85
|
+
const errs = res.errors;
|
|
86
|
+
throw new Error(errs?.error?.[0] ?? 'Failed to update designation');
|
|
87
|
+
}
|
|
88
|
+
return res.data;
|
|
89
|
+
},
|
|
90
|
+
onSuccess: () => queryClient.invalidateQueries({ queryKey: ['designations'] }),
|
|
91
|
+
}),
|
|
92
|
+
deleteDesignation: useMutation({
|
|
93
|
+
mutationFn: async (id) => {
|
|
94
|
+
const res = await apiRequest({
|
|
95
|
+
endpoint: `/designations/${id}`,
|
|
96
|
+
method: 'DELETE',
|
|
97
|
+
token,
|
|
98
|
+
});
|
|
99
|
+
if (!res.success) {
|
|
100
|
+
const errs = res.errors;
|
|
101
|
+
throw new Error(errs?.error?.[0] ?? 'Failed to delete designation');
|
|
102
|
+
}
|
|
103
|
+
return res.data;
|
|
104
|
+
},
|
|
105
|
+
onSuccess: () => queryClient.invalidateQueries({ queryKey: ['designations'] }),
|
|
106
|
+
}),
|
|
116
107
|
};
|
|
117
108
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export type Industry = {
|
|
2
2
|
id: string;
|
|
3
3
|
title?: string;
|
|
4
|
+
name?: string;
|
|
4
5
|
description?: string;
|
|
5
6
|
category?: string;
|
|
6
7
|
status?: string;
|
|
@@ -15,15 +16,11 @@ export type UseIndustriesParams = {
|
|
|
15
16
|
limit?: number;
|
|
16
17
|
batchSize?: number;
|
|
17
18
|
queryObject?: Record<string, unknown>;
|
|
18
|
-
token
|
|
19
|
+
/** Optional auth token (e.g. from app session) */
|
|
20
|
+
token?: string;
|
|
19
21
|
};
|
|
20
|
-
export declare const useIndustries: (
|
|
22
|
+
export declare const useIndustries: ({ limit, batchSize, queryObject, token, }?: UseIndustriesParams) => {
|
|
21
23
|
industries: Industry[];
|
|
22
|
-
pagination: {
|
|
23
|
-
total: number;
|
|
24
|
-
page: number;
|
|
25
|
-
pages: number;
|
|
26
|
-
} | undefined;
|
|
27
24
|
industriesQuery: import("@tanstack/react-query").UseInfiniteQueryResult<import("@tanstack/query-core").InfiniteData<{
|
|
28
25
|
data: Industry[];
|
|
29
26
|
nextPage: number | null;
|
|
@@ -44,8 +41,5 @@ export declare const useIndustries: (params?: UseIndustriesParams) => {
|
|
|
44
41
|
data: IndustryPayload;
|
|
45
42
|
}, unknown>;
|
|
46
43
|
deleteIndustry: import("@tanstack/react-query").UseMutationResult<unknown, Error, string, unknown>;
|
|
47
|
-
isCreating: boolean;
|
|
48
|
-
isUpdating: boolean;
|
|
49
|
-
isDeleting: boolean;
|
|
50
44
|
};
|
|
51
45
|
//# sourceMappingURL=useIndustries.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useIndustries.d.ts","sourceRoot":"","sources":["../../src/hooks/useIndustries.ts"],"names":[],"mappings":"AAMA,MAAM,MAAM,QAAQ,GAAG;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAeF,MAAM,MAAM,mBAAmB,GAAG;IAChC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACtC,KAAK,CAAC,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"useIndustries.d.ts","sourceRoot":"","sources":["../../src/hooks/useIndustries.ts"],"names":[],"mappings":"AAMA,MAAM,MAAM,QAAQ,GAAG;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAeF,MAAM,MAAM,mBAAmB,GAAG;IAChC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACtC,kDAAkD;IAClD,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,eAAO,MAAM,aAAa,GAAI,4CAK3B,mBAAwB;;;;;;;;;;;;;;;;;;YA+EkB,MAAM;cAAQ,eAAe;;;CA+BzE,CAAC"}
|
|
@@ -2,8 +2,7 @@
|
|
|
2
2
|
import { useInfiniteQuery, useMutation, useQueryClient } from '@tanstack/react-query';
|
|
3
3
|
import { apiRequest } from '../utils/api-request';
|
|
4
4
|
import { generateSearchQuery } from '../utils/generateSearchQuery';
|
|
5
|
-
export const useIndustries = (
|
|
6
|
-
const { limit = 50, batchSize = 1, queryObject = {}, token } = params;
|
|
5
|
+
export const useIndustries = ({ limit = 50, batchSize = 1, queryObject = {}, token, } = {}) => {
|
|
7
6
|
const queryClient = useQueryClient();
|
|
8
7
|
const industriesQuery = useInfiniteQuery({
|
|
9
8
|
queryKey: ['industries', limit, batchSize, queryObject],
|
|
@@ -12,31 +11,27 @@ export const useIndustries = (params = {}) => {
|
|
|
12
11
|
queryFn: async ({ pageParam = 1 }) => {
|
|
13
12
|
const pagesToFetch = Array.from({ length: batchSize }, (_, i) => pageParam + i);
|
|
14
13
|
const results = await Promise.all(pagesToFetch.map(async (page) => {
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
};
|
|
20
|
-
if (q.search) {
|
|
21
|
-
q.query = q.search;
|
|
22
|
-
delete q.search;
|
|
14
|
+
const params = { ...queryObject, page, limit };
|
|
15
|
+
if (params.search) {
|
|
16
|
+
params.query = params.search;
|
|
17
|
+
delete params.search;
|
|
23
18
|
}
|
|
24
|
-
const searchQuery = generateSearchQuery(
|
|
19
|
+
const searchQuery = generateSearchQuery(params);
|
|
25
20
|
const res = await apiRequest({
|
|
26
21
|
endpoint: `/industries?${searchQuery}`,
|
|
27
22
|
method: 'GET',
|
|
28
|
-
token
|
|
23
|
+
token,
|
|
29
24
|
});
|
|
30
25
|
if (!res.success) {
|
|
31
|
-
const
|
|
32
|
-
throw new Error(
|
|
26
|
+
const errs = res.errors;
|
|
27
|
+
throw new Error(errs?.error?.[0] ?? errs?.general?.[0] ?? 'Failed to fetch industries');
|
|
33
28
|
}
|
|
34
29
|
const payload = res.data;
|
|
35
|
-
const
|
|
36
|
-
const pages =
|
|
37
|
-
const nextPage =
|
|
30
|
+
const p = payload?.pagination;
|
|
31
|
+
const pages = p?.pages ?? 1;
|
|
32
|
+
const nextPage = p?.nextPage ?? (p && page < pages ? page + 1 : null);
|
|
38
33
|
return {
|
|
39
|
-
data: payload
|
|
34
|
+
data: payload?.data ?? [],
|
|
40
35
|
page,
|
|
41
36
|
pages,
|
|
42
37
|
nextPage,
|
|
@@ -53,66 +48,62 @@ export const useIndustries = (params = {}) => {
|
|
|
53
48
|
},
|
|
54
49
|
getNextPageParam: (lastPage) => lastPage.nextPage ?? undefined,
|
|
55
50
|
});
|
|
56
|
-
const createIndustry = useMutation({
|
|
57
|
-
mutationFn: async (data) => {
|
|
58
|
-
const res = await apiRequest({
|
|
59
|
-
endpoint: '/industries',
|
|
60
|
-
method: 'POST',
|
|
61
|
-
data,
|
|
62
|
-
token: token ?? undefined,
|
|
63
|
-
});
|
|
64
|
-
if (!res.success)
|
|
65
|
-
throw new Error(String((res.errors?.general?.[0]) || 'Failed to create industry'));
|
|
66
|
-
return res.data;
|
|
67
|
-
},
|
|
68
|
-
onSuccess: () => queryClient.invalidateQueries({ queryKey: ['industries'] }),
|
|
69
|
-
});
|
|
70
|
-
const updateIndustry = useMutation({
|
|
71
|
-
mutationFn: async ({ id, data }) => {
|
|
72
|
-
const res = await apiRequest({
|
|
73
|
-
endpoint: `/industries/${id}`,
|
|
74
|
-
method: 'PUT',
|
|
75
|
-
data,
|
|
76
|
-
token: token ?? undefined,
|
|
77
|
-
});
|
|
78
|
-
if (!res.success)
|
|
79
|
-
throw new Error(String((res.errors?.general?.[0]) || 'Failed to update industry'));
|
|
80
|
-
return res.data;
|
|
81
|
-
},
|
|
82
|
-
onSuccess: () => queryClient.invalidateQueries({ queryKey: ['industries'] }),
|
|
83
|
-
});
|
|
84
|
-
const deleteIndustry = useMutation({
|
|
85
|
-
mutationFn: async (id) => {
|
|
86
|
-
const res = await apiRequest({
|
|
87
|
-
endpoint: `/industries/${id}`,
|
|
88
|
-
method: 'DELETE',
|
|
89
|
-
token: token ?? undefined,
|
|
90
|
-
});
|
|
91
|
-
if (!res.success)
|
|
92
|
-
throw new Error(String((res.errors?.general?.[0]) || 'Failed to delete industry'));
|
|
93
|
-
return res.data;
|
|
94
|
-
},
|
|
95
|
-
onSuccess: () => queryClient.invalidateQueries({ queryKey: ['industries'] }),
|
|
96
|
-
});
|
|
97
51
|
const industries = industriesQuery.data?.pages?.flatMap((p) => p.data) ?? [];
|
|
98
52
|
const lastPage = industriesQuery.data?.pages?.slice(-1)?.[0];
|
|
99
|
-
const pagination = lastPage
|
|
100
|
-
? { total: industries.length, page: 1, pages: lastPage.totalPages ?? 1 }
|
|
101
|
-
: undefined;
|
|
102
53
|
return {
|
|
103
54
|
industries,
|
|
104
|
-
pagination,
|
|
105
55
|
industriesQuery,
|
|
106
56
|
isLoading: industriesQuery.isLoading,
|
|
107
57
|
isFetching: industriesQuery.isFetching,
|
|
108
58
|
isError: industriesQuery.isError,
|
|
109
59
|
error: industriesQuery.error,
|
|
110
60
|
refetch: industriesQuery.refetch,
|
|
111
|
-
createIndustry
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
61
|
+
createIndustry: useMutation({
|
|
62
|
+
mutationFn: async (data) => {
|
|
63
|
+
const res = await apiRequest({
|
|
64
|
+
endpoint: '/industries',
|
|
65
|
+
method: 'POST',
|
|
66
|
+
data,
|
|
67
|
+
token,
|
|
68
|
+
});
|
|
69
|
+
if (!res.success) {
|
|
70
|
+
const errs = res.errors;
|
|
71
|
+
throw new Error(errs?.error?.[0] ?? 'Failed to create industry');
|
|
72
|
+
}
|
|
73
|
+
return res.data;
|
|
74
|
+
},
|
|
75
|
+
onSuccess: () => queryClient.invalidateQueries({ queryKey: ['industries'] }),
|
|
76
|
+
}),
|
|
77
|
+
updateIndustry: useMutation({
|
|
78
|
+
mutationFn: async ({ id, data }) => {
|
|
79
|
+
const res = await apiRequest({
|
|
80
|
+
endpoint: `/industries/${id}`,
|
|
81
|
+
method: 'PUT',
|
|
82
|
+
data,
|
|
83
|
+
token,
|
|
84
|
+
});
|
|
85
|
+
if (!res.success) {
|
|
86
|
+
const errs = res.errors;
|
|
87
|
+
throw new Error(errs?.error?.[0] ?? 'Failed to update industry');
|
|
88
|
+
}
|
|
89
|
+
return res.data;
|
|
90
|
+
},
|
|
91
|
+
onSuccess: () => queryClient.invalidateQueries({ queryKey: ['industries'] }),
|
|
92
|
+
}),
|
|
93
|
+
deleteIndustry: useMutation({
|
|
94
|
+
mutationFn: async (id) => {
|
|
95
|
+
const res = await apiRequest({
|
|
96
|
+
endpoint: `/industries/${id}`,
|
|
97
|
+
method: 'DELETE',
|
|
98
|
+
token,
|
|
99
|
+
});
|
|
100
|
+
if (!res.success) {
|
|
101
|
+
const errs = res.errors;
|
|
102
|
+
throw new Error(errs?.error?.[0] ?? 'Failed to delete industry');
|
|
103
|
+
}
|
|
104
|
+
return res.data;
|
|
105
|
+
},
|
|
106
|
+
onSuccess: () => queryClient.invalidateQueries({ queryKey: ['industries'] }),
|
|
107
|
+
}),
|
|
117
108
|
};
|
|
118
109
|
};
|
|
@@ -6,8 +6,7 @@ export type UseSkillsParams = {
|
|
|
6
6
|
limit?: number;
|
|
7
7
|
batchSize?: number;
|
|
8
8
|
queryObject?: Record<string, unknown>;
|
|
9
|
-
|
|
10
|
-
token?: string | null;
|
|
9
|
+
token?: string;
|
|
11
10
|
};
|
|
12
11
|
export declare const useSkills: ({ limit, batchSize, queryObject, token, }?: UseSkillsParams) => {
|
|
13
12
|
skillsQuery: import("@tanstack/react-query").UseInfiniteQueryResult<import("@tanstack/query-core").InfiniteData<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSkills.d.ts","sourceRoot":"","sources":["../../src/hooks/useSkills.ts"],"names":[],"mappings":"AAMA,MAAM,MAAM,KAAK,GAAG;IAClB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAYF,MAAM,MAAM,eAAe,GAAG;IAC5B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACtC,
|
|
1
|
+
{"version":3,"file":"useSkills.d.ts","sourceRoot":"","sources":["../../src/hooks/useSkills.ts"],"names":[],"mappings":"AAMA,MAAM,MAAM,KAAK,GAAG;IAClB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAYF,MAAM,MAAM,eAAe,GAAG;IAC5B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACtC,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,eAAO,MAAM,SAAS,GAAI,4CAKvB,eAAoB;;;;;;CAuCtB,CAAC"}
|
package/dist/hooks/useSkills.js
CHANGED
|
@@ -14,23 +14,23 @@ export const useSkills = ({ limit = 50, batchSize = 1, queryObject = {}, token,
|
|
|
14
14
|
const res = await apiRequest({
|
|
15
15
|
endpoint: `/skills?${searchQuery}`,
|
|
16
16
|
method: 'GET',
|
|
17
|
-
token
|
|
17
|
+
token,
|
|
18
18
|
});
|
|
19
19
|
if (!res.success) {
|
|
20
|
-
const
|
|
21
|
-
throw new Error(
|
|
20
|
+
const errs = res.errors;
|
|
21
|
+
throw new Error(errs?.error?.[0] ?? errs?.general?.[0] ?? 'Failed to fetch skills');
|
|
22
22
|
}
|
|
23
23
|
const payload = res.data;
|
|
24
24
|
return {
|
|
25
|
-
data: payload
|
|
25
|
+
data: payload?.data ?? [],
|
|
26
26
|
page,
|
|
27
|
-
pages: payload
|
|
28
|
-
nextPage: payload
|
|
27
|
+
pages: payload?.pagination?.pages ?? 1,
|
|
28
|
+
nextPage: payload?.pagination?.nextPage ?? null,
|
|
29
29
|
};
|
|
30
30
|
}));
|
|
31
31
|
const merged = results.flatMap((r) => r.data);
|
|
32
32
|
const last = results[results.length - 1];
|
|
33
|
-
const nextPage = last.nextPage
|
|
33
|
+
const nextPage = last.nextPage && last.page < last.pages ? last.nextPage : null;
|
|
34
34
|
return { data: merged, nextPage, totalPages: last.pages };
|
|
35
35
|
},
|
|
36
36
|
getNextPageParam: (lastPage) => lastPage.nextPage ?? undefined,
|
package/dist/index.d.ts
CHANGED
|
@@ -7,9 +7,15 @@ export { WORKSTATUS, WORK_STATUS_VALUES, } from './types/easy-apply';
|
|
|
7
7
|
export type { WorkStatusValue, QuestionsAPIRes, ScreeningAnswersApiResNew, } from './types/easy-apply';
|
|
8
8
|
export { apiRequest } from './utils/api-request';
|
|
9
9
|
export type { ApiResponse } from './utils/api-request';
|
|
10
|
-
export { generateSearchQuery } from './utils/generateSearchQuery';
|
|
11
|
-
export { monthsDropdown, yearsDropdown } from './utils/commonDropdownOptions';
|
|
12
10
|
export { cn } from './utils/cn';
|
|
11
|
+
export { generateSearchQuery } from './utils/generateSearchQuery';
|
|
12
|
+
export { useDebounce } from './hooks/useDebounce';
|
|
13
|
+
export { useIndustries } from './hooks/useIndustries';
|
|
14
|
+
export type { Industry, IndustryPayload, UseIndustriesParams } from './hooks/useIndustries';
|
|
15
|
+
export { useDesignations } from './hooks/useDesignations';
|
|
16
|
+
export type { Designation, DesignationPayload, UseDesignationsParams } from './hooks/useDesignations';
|
|
17
|
+
export { useSkills } from './hooks/useSkills';
|
|
18
|
+
export type { Skill, UseSkillsParams } from './hooks/useSkills';
|
|
13
19
|
export { useGetAllVacancy } from './hooks/useGetAllVacancy';
|
|
14
20
|
export { default as useGetAllVacancyDefault } from './hooks/useGetAllVacancy';
|
|
15
21
|
export { useSavedVacancyMutations } from './hooks/useSavedVacancyMutations';
|
|
@@ -22,40 +28,13 @@ export { useEasyApplyMutations } from './hooks/useEasyApplyMutations';
|
|
|
22
28
|
export type { UseEasyApplyMutationsParams } from './hooks/useEasyApplyMutations';
|
|
23
29
|
export { useEasyApplyFormHook, easyApplyUserSchema, screeningAnswerSchema, screeningAnswersSchema, } from './hooks/useEasyApplyFormHook';
|
|
24
30
|
export type { EasyApplyFormValues, EasyApplyScreeningAnswer, EasyApplyScreeningAnswers, UseEasyApplyFormHookParams, } from './hooks/useEasyApplyFormHook';
|
|
25
|
-
export { useDebounce } from './hooks/useDebounce';
|
|
26
|
-
export { useSkills } from './hooks/useSkills';
|
|
27
|
-
export type { Skill, UseSkillsParams } from './hooks/useSkills';
|
|
28
|
-
export { useIndustries } from './hooks/useIndustries';
|
|
29
|
-
export type { Industry, IndustryPayload, UseIndustriesParams } from './hooks/useIndustries';
|
|
30
|
-
export { useDesignations } from './hooks/useDesignations';
|
|
31
|
-
export type { Designation, DesignationPayload, UseDesignationsParams } from './hooks/useDesignations';
|
|
32
31
|
export { default as JobsClient } from './components/JobsClient';
|
|
33
32
|
export type { JobsClientProps } from './components/JobsClient';
|
|
34
33
|
export { default as JobDescriptionClient } from './components/JobDescriptionClient';
|
|
35
34
|
export type { JobDescriptionClientProps } from './components/JobDescriptionClient';
|
|
36
|
-
export type { TemplateData, TemplatePersonalInfo, TemplateSections, TemplateExperience, TemplateEducation, TemplateProject, TemplateSkill, TemplateSkillCategory, TemplateCertification, TemplateLanguage, TemplateReference, TemplateTraining, TemplateLink, TemplateProps, } from './types/template.types';
|
|
37
|
-
export type { CvBlock, CvBlockType, CvBlockStyle, CvLayout, } from './types/cv-blocks.types';
|
|
38
|
-
export type { CvDraft, CreateCvDraftPayload, UpdateCvDraftPayload, CvDraftListResponse, } from './types/cv-draft.types';
|
|
39
|
-
export { convertTemplateToBlocks, getDefaultColumns, getDefaultStyles, } from './utils/cv-block-converter';
|
|
40
|
-
export { preprocessTemplateCssClient, clearCssCacheClient, } from './utils/cv/pdf/styles/preprocessCssClient';
|
|
41
|
-
export { useCvPreview } from './stores/cvPreview.store';
|
|
42
|
-
export { useCvLayout } from './stores/cvLayout.store';
|
|
43
|
-
export { useCvDraftsStore } from './stores/cvDrafts.store';
|
|
44
|
-
export { default as TemplateRenderer } from './components/cv/TemplateRenderer';
|
|
45
|
-
export type { CvTemplateRegistry, TemplateRendererProps } from './components/cv/TemplateRenderer';
|
|
46
|
-
export { default as TemplatePicker } from './components/cv/TemplatePicker';
|
|
47
|
-
export { default as ResponsivePreview } from './components/cv/ResponsivePreview';
|
|
48
|
-
export type { TemplatePickerProps } from './components/cv/TemplatePicker';
|
|
49
|
-
export { generateSampleTemplateData } from './components/cv/TemplatePicker';
|
|
50
35
|
export { RatingStars } from './components/ui/RatingStars';
|
|
51
|
-
export { BulletListTextarea } from './components/ui/BulletListTextarea';
|
|
52
|
-
export type { BulletListTextareaProps } from './components/ui/BulletListTextarea';
|
|
53
36
|
export { default as IndustrySelect } from './components/ui/IndustrySelect';
|
|
54
|
-
export type { IndustrySelectProps } from './components/ui/IndustrySelect';
|
|
55
37
|
export { default as DesignationSelect } from './components/ui/DesignationSelect';
|
|
56
|
-
export type { DesignationSelectProps } from './components/ui/DesignationSelect';
|
|
57
38
|
export { MultiSelectOptions } from './components/ui/MultiSelectOptions';
|
|
58
|
-
export {
|
|
59
|
-
export { Popover, PopoverTrigger, PopoverContent } from './components/ui/popover';
|
|
60
|
-
export { Command, CommandInput, CommandList, CommandEmpty, CommandGroup, CommandItem, } from './components/ui/command';
|
|
39
|
+
export type { MultiSelectOptionsProps } from './components/ui/MultiSelectOptions';
|
|
61
40
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAGxD,YAAY,EACV,gBAAgB,EAChB,aAAa,EACb,UAAU,EACV,eAAe,GAChB,MAAM,SAAS,CAAC;AACjB,YAAY,EACV,aAAa,EACb,oBAAoB,EACpB,gBAAgB,GACjB,MAAM,mBAAmB,CAAC;AAC3B,YAAY,EACV,gBAAgB,EAChB,uBAAuB,EACvB,mBAAmB,GACpB,MAAM,uBAAuB,CAAC;AAC/B,YAAY,EACV,QAAQ,EACR,YAAY,EACZ,wBAAwB,GACzB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,UAAU,EACV,kBAAkB,GACnB,MAAM,oBAAoB,CAAC;AAC5B,YAAY,EACV,eAAe,EACf,eAAe,EACf,yBAAyB,GAC1B,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,YAAY,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAGxD,YAAY,EACV,gBAAgB,EAChB,aAAa,EACb,UAAU,EACV,eAAe,GAChB,MAAM,SAAS,CAAC;AACjB,YAAY,EACV,aAAa,EACb,oBAAoB,EACpB,gBAAgB,GACjB,MAAM,mBAAmB,CAAC;AAC3B,YAAY,EACV,gBAAgB,EAChB,uBAAuB,EACvB,mBAAmB,GACpB,MAAM,uBAAuB,CAAC;AAC/B,YAAY,EACV,QAAQ,EACR,YAAY,EACZ,wBAAwB,GACzB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,UAAU,EACV,kBAAkB,GACnB,MAAM,oBAAoB,CAAC;AAC5B,YAAY,EACV,eAAe,EACf,eAAe,EACf,yBAAyB,GAC1B,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,YAAY,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,EAAE,EAAE,MAAM,YAAY,CAAC;AAChC,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAGlE,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,YAAY,EAAE,QAAQ,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5F,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,YAAY,EAAE,WAAW,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AACtG,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,YAAY,EAAE,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAGhE,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,OAAO,IAAI,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AAC9E,OAAO,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAC5E,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AACtE,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AACtE,YAAY,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AACjF,OAAO,EACL,oBAAoB,EACpB,mBAAmB,EACnB,qBAAqB,EACrB,sBAAsB,GACvB,MAAM,8BAA8B,CAAC;AACtC,YAAY,EACV,mBAAmB,EACnB,wBAAwB,EACxB,yBAAyB,EACzB,0BAA0B,GAC3B,MAAM,8BAA8B,CAAC;AAGtC,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAChE,YAAY,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,EAAE,OAAO,IAAI,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AACpF,YAAY,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAC;AAGnF,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAC3E,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AACjF,OAAO,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AACxE,YAAY,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -3,9 +3,13 @@ export { initApi, getBaseURL, API } from './api-client';
|
|
|
3
3
|
export { WORKSTATUS, WORK_STATUS_VALUES, } from './types/easy-apply';
|
|
4
4
|
// Utils
|
|
5
5
|
export { apiRequest } from './utils/api-request';
|
|
6
|
-
export { generateSearchQuery } from './utils/generateSearchQuery';
|
|
7
|
-
export { monthsDropdown, yearsDropdown } from './utils/commonDropdownOptions';
|
|
8
6
|
export { cn } from './utils/cn';
|
|
7
|
+
export { generateSearchQuery } from './utils/generateSearchQuery';
|
|
8
|
+
// Hooks (debounce + industry/designation/skill API)
|
|
9
|
+
export { useDebounce } from './hooks/useDebounce';
|
|
10
|
+
export { useIndustries } from './hooks/useIndustries';
|
|
11
|
+
export { useDesignations } from './hooks/useDesignations';
|
|
12
|
+
export { useSkills } from './hooks/useSkills';
|
|
9
13
|
// Hooks
|
|
10
14
|
export { useGetAllVacancy } from './hooks/useGetAllVacancy';
|
|
11
15
|
export { default as useGetAllVacancyDefault } from './hooks/useGetAllVacancy';
|
|
@@ -17,32 +21,11 @@ export { useVacancyQuestions } from './hooks/useVacancyQuestions';
|
|
|
17
21
|
export { useShareJob } from './hooks/useShareJob';
|
|
18
22
|
export { useEasyApplyMutations } from './hooks/useEasyApplyMutations';
|
|
19
23
|
export { useEasyApplyFormHook, easyApplyUserSchema, screeningAnswerSchema, screeningAnswersSchema, } from './hooks/useEasyApplyFormHook';
|
|
20
|
-
export { useDebounce } from './hooks/useDebounce';
|
|
21
|
-
export { useSkills } from './hooks/useSkills';
|
|
22
|
-
export { useIndustries } from './hooks/useIndustries';
|
|
23
|
-
export { useDesignations } from './hooks/useDesignations';
|
|
24
24
|
// Components
|
|
25
25
|
export { default as JobsClient } from './components/JobsClient';
|
|
26
26
|
export { default as JobDescriptionClient } from './components/JobDescriptionClient';
|
|
27
|
-
// CV Builder: utils
|
|
28
|
-
export { convertTemplateToBlocks, getDefaultColumns, getDefaultStyles, } from './utils/cv-block-converter';
|
|
29
|
-
export { preprocessTemplateCssClient, clearCssCacheClient, } from './utils/cv/pdf/styles/preprocessCssClient';
|
|
30
|
-
// CV Builder: stores
|
|
31
|
-
export { useCvPreview } from './stores/cvPreview.store';
|
|
32
|
-
export { useCvLayout } from './stores/cvLayout.store';
|
|
33
|
-
export { useCvDraftsStore } from './stores/cvDrafts.store';
|
|
34
|
-
// CV Builder: components (registry-based; no templates in package)
|
|
35
|
-
export { default as TemplateRenderer } from './components/cv/TemplateRenderer';
|
|
36
|
-
export { default as TemplatePicker } from './components/cv/TemplatePicker';
|
|
37
|
-
export { default as ResponsivePreview } from './components/cv/ResponsivePreview';
|
|
38
|
-
export { generateSampleTemplateData } from './components/cv/TemplatePicker';
|
|
39
27
|
// UI Components
|
|
40
28
|
export { RatingStars } from './components/ui/RatingStars';
|
|
41
|
-
export { BulletListTextarea } from './components/ui/BulletListTextarea';
|
|
42
29
|
export { default as IndustrySelect } from './components/ui/IndustrySelect';
|
|
43
30
|
export { default as DesignationSelect } from './components/ui/DesignationSelect';
|
|
44
31
|
export { MultiSelectOptions } from './components/ui/MultiSelectOptions';
|
|
45
|
-
export { NoData } from './components/common/NoData';
|
|
46
|
-
// UI Primitives (Popover, Command)
|
|
47
|
-
export { Popover, PopoverTrigger, PopoverContent } from './components/ui/popover';
|
|
48
|
-
export { Command, CommandInput, CommandList, CommandEmpty, CommandGroup, CommandItem, } from './components/ui/command';
|
package/dist/utils/cn.d.ts
CHANGED
package/dist/utils/cn.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cn.d.ts","sourceRoot":"","sources":["../../src/utils/cn.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"cn.d.ts","sourceRoot":"","sources":["../../src/utils/cn.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,UAAU,EAAE,MAAM,MAAM,CAAC;AAG7C,wBAAgB,EAAE,CAAC,GAAG,MAAM,EAAE,UAAU,EAAE,UAEzC"}
|
package/dist/utils/cn.js
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@recruitnepal/shared-packages",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"description": "Shared
|
|
3
|
+
"version": "1.8.0",
|
|
4
|
+
"description": "Shared hooks, API client, types and utils for Recruit Nepal (CV builder UI and preprocess stay in each repo)",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"scripts": {
|
|
@@ -9,13 +9,7 @@
|
|
|
9
9
|
"dev": "tsc --watch",
|
|
10
10
|
"prepublishOnly": "npm run build"
|
|
11
11
|
},
|
|
12
|
-
"keywords": [
|
|
13
|
-
"react",
|
|
14
|
-
"nextjs",
|
|
15
|
-
"recruit-nepal",
|
|
16
|
-
"shared-components",
|
|
17
|
-
"cv-builder"
|
|
18
|
-
],
|
|
12
|
+
"keywords": ["react", "nextjs", "recruit-nepal", "shared-components"],
|
|
19
13
|
"author": "",
|
|
20
14
|
"license": "MIT",
|
|
21
15
|
"peerDependencies": {
|
|
@@ -25,13 +19,25 @@
|
|
|
25
19
|
"zod": "^3.22.0",
|
|
26
20
|
"react-hook-form": "^7.49.0",
|
|
27
21
|
"@hookform/resolvers": "^3.3.0",
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"cmdk": "^1.0.0"
|
|
22
|
+
"lucide-react": "^0.460.0",
|
|
23
|
+
"clsx": "^2.1.0",
|
|
24
|
+
"tailwind-merge": "^2.5.0",
|
|
25
|
+
"cmdk": "^1.0.0",
|
|
26
|
+
"class-variance-authority": "^0.7.0",
|
|
27
|
+
"@radix-ui/react-popover": "^1.1.0",
|
|
28
|
+
"@radix-ui/react-slot": "^1.1.0",
|
|
29
|
+
"react-intersection-observer": "^9.16.0"
|
|
32
30
|
},
|
|
33
31
|
"dependencies": {
|
|
34
|
-
"axios": "^1.7.8"
|
|
32
|
+
"axios": "^1.7.8",
|
|
33
|
+
"clsx": "^2.1.0",
|
|
34
|
+
"tailwind-merge": "^2.5.0",
|
|
35
|
+
"lucide-react": "^0.460.0",
|
|
36
|
+
"cmdk": "^1.0.0",
|
|
37
|
+
"class-variance-authority": "^0.7.0",
|
|
38
|
+
"@radix-ui/react-popover": "^1.1.0",
|
|
39
|
+
"@radix-ui/react-slot": "^1.1.0",
|
|
40
|
+
"react-intersection-observer": "^9.16.0"
|
|
35
41
|
},
|
|
36
42
|
"devDependencies": {
|
|
37
43
|
"@types/node": "^20.11.17",
|
|
@@ -40,11 +46,7 @@
|
|
|
40
46
|
"typescript": "^5.3.3",
|
|
41
47
|
"zod": "^3.22.0",
|
|
42
48
|
"react-hook-form": "^7.49.0",
|
|
43
|
-
"@hookform/resolvers": "^3.3.0"
|
|
44
|
-
"zustand": "^4.5.0"
|
|
49
|
+
"@hookform/resolvers": "^3.3.0"
|
|
45
50
|
},
|
|
46
|
-
"files": [
|
|
47
|
-
|
|
48
|
-
"README.md"
|
|
49
|
-
]
|
|
50
|
-
}
|
|
51
|
+
"files": ["dist", "README.md"]
|
|
52
|
+
}
|