@confidencesystemsinc/sdk 1.0.1 → 1.0.3
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/playbook/confidence-playbook.d.ts +3 -0
- package/dist/sdk.cjs +15 -15
- package/dist/sdk.js +1060 -1043
- package/package.json +2 -3
- package/src/App.css +0 -2
- package/src/components/badge.tsx +0 -116
- package/src/components/initiate-playbook-modal/InitiatePlaybookModal.tsx +0 -53
- package/src/components/playbook/confidence-playbook.tsx +0 -217
- package/src/components/playbook/playbook-header.tsx +0 -13
- package/src/components/playbook-button/ConfidencePlaybookButton.tsx +0 -74
- package/src/components/task/confidence-task.tsx +0 -198
- package/src/components/task/task-buttons.tsx +0 -32
- package/src/components/task/task-dropdown-badge.tsx +0 -121
- package/src/components/task/task-left-panel.tsx +0 -60
- package/src/components/task/task-status-badge.tsx +0 -23
- package/src/components/ui/button.tsx +0 -269
- package/src/components/ui/header.tsx +0 -12
- package/src/components/ui/input.tsx +0 -39
- package/src/components/ui/modal.tsx +0 -88
- package/src/constants/settings.constants.ts +0 -2
- package/src/hooks/task-events/useCompleteTask.ts +0 -26
- package/src/hooks/task-events/useStartTask.ts +0 -29
- package/src/hooks/usePlaybook.ts +0 -48
- package/src/hooks/usePlaybookActions.ts +0 -69
- package/src/hooks/useTaskButtons.ts +0 -46
- package/src/index.ts +0 -6
- package/src/services/complete-task.service.ts +0 -21
- package/src/services/initiate-playbook.service.ts +0 -24
- package/src/services/start-task.services.ts +0 -23
- package/src/stories/initiate-playbook-modal.stories.tsx +0 -31
- package/src/stories/modal.stories.tsx +0 -50
- package/src/stories/playbook-container.stories.tsx +0 -79
- package/src/types/playbook.types.ts +0 -22
- package/src/types/task.types.ts +0 -20
- package/src/utils/cn.ts +0 -6
- package/src/vite-env.d.ts +0 -1
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
TASK_BUTTONS_DISPLAY_TEXT,
|
|
3
|
-
TaskButton,
|
|
4
|
-
} from "../../hooks/useTaskButtons";
|
|
5
|
-
import Button from "../ui/button";
|
|
6
|
-
|
|
7
|
-
export const TaskButtons = ({
|
|
8
|
-
buttons,
|
|
9
|
-
onButtonClick,
|
|
10
|
-
}: {
|
|
11
|
-
buttons: TaskButton[];
|
|
12
|
-
onButtonClick: (buttonType: TaskButton) => void;
|
|
13
|
-
}) => {
|
|
14
|
-
return (
|
|
15
|
-
<div className="flex items-center justify-end">
|
|
16
|
-
{buttons.map((button) => {
|
|
17
|
-
return (
|
|
18
|
-
<Button
|
|
19
|
-
key={button}
|
|
20
|
-
size="smallCollapse"
|
|
21
|
-
className="ml-2"
|
|
22
|
-
onClick={() => {
|
|
23
|
-
onButtonClick(button);
|
|
24
|
-
}}
|
|
25
|
-
>
|
|
26
|
-
{TASK_BUTTONS_DISPLAY_TEXT[button]}
|
|
27
|
-
</Button>
|
|
28
|
-
);
|
|
29
|
-
})}
|
|
30
|
-
</div>
|
|
31
|
-
);
|
|
32
|
-
};
|
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
import { useDismiss, useFloating, useInteractions } from "@floating-ui/react";
|
|
2
|
-
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
|
3
|
-
import { cn } from "../../utils/cn";
|
|
4
|
-
import { faArrowRight, faChevronDown } from "@fortawesome/free-solid-svg-icons";
|
|
5
|
-
import { Badge } from "../badge";
|
|
6
|
-
import { useState } from "react";
|
|
7
|
-
const TASK_DROPDOWN_BADGE_VARIANTS = {
|
|
8
|
-
default: "text-secondary-600 border-secondary-600",
|
|
9
|
-
primary: "text-primary-600 border-primary-600",
|
|
10
|
-
success: "text-success-600 border-success-600",
|
|
11
|
-
} as const;
|
|
12
|
-
|
|
13
|
-
interface TaskDropdownBadgeProps {
|
|
14
|
-
title: string;
|
|
15
|
-
variant?: keyof typeof TASK_DROPDOWN_BADGE_VARIANTS;
|
|
16
|
-
transitions: {
|
|
17
|
-
id: string;
|
|
18
|
-
color: "primary" | "success";
|
|
19
|
-
action: string;
|
|
20
|
-
to: string;
|
|
21
|
-
}[];
|
|
22
|
-
onClick?: (action: string) => void;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
const MenuItem = ({
|
|
26
|
-
transition,
|
|
27
|
-
onClick,
|
|
28
|
-
}: {
|
|
29
|
-
transition: {
|
|
30
|
-
id: string;
|
|
31
|
-
color: "primary" | "success";
|
|
32
|
-
action: string;
|
|
33
|
-
to: string;
|
|
34
|
-
};
|
|
35
|
-
onClick: () => void;
|
|
36
|
-
}) => {
|
|
37
|
-
return (
|
|
38
|
-
<div
|
|
39
|
-
className="py-1 px-3 space-x-2 flex items-center hover:bg-gray-100 cursor-pointer"
|
|
40
|
-
onClick={(e) => {
|
|
41
|
-
e.stopPropagation();
|
|
42
|
-
onClick();
|
|
43
|
-
}}
|
|
44
|
-
>
|
|
45
|
-
<span className="text-base text-dark flex-1">{transition.action}</span>
|
|
46
|
-
<FontAwesomeIcon icon={faArrowRight} className="text-gray-400" />
|
|
47
|
-
<Badge category="outline" color={transition.color}>
|
|
48
|
-
{transition.to}
|
|
49
|
-
</Badge>
|
|
50
|
-
</div>
|
|
51
|
-
);
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
export const TaskDropdownBadge = ({
|
|
55
|
-
title,
|
|
56
|
-
variant = "default",
|
|
57
|
-
transitions,
|
|
58
|
-
onClick,
|
|
59
|
-
}: TaskDropdownBadgeProps) => {
|
|
60
|
-
const [isOpen, setIsOpen] = useState(false);
|
|
61
|
-
|
|
62
|
-
const { refs, floatingStyles, context } = useFloating({
|
|
63
|
-
strategy: "fixed",
|
|
64
|
-
placement: "bottom-end",
|
|
65
|
-
open: isOpen,
|
|
66
|
-
onOpenChange: setIsOpen,
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
const dismiss = useDismiss(context, {
|
|
70
|
-
outsidePress: true,
|
|
71
|
-
});
|
|
72
|
-
const { getReferenceProps, getFloatingProps } = useInteractions([dismiss]);
|
|
73
|
-
return (
|
|
74
|
-
<>
|
|
75
|
-
<div
|
|
76
|
-
onClick={
|
|
77
|
-
transitions?.length ? () => setIsOpen((prev) => !prev) : undefined
|
|
78
|
-
}
|
|
79
|
-
ref={refs.setReference}
|
|
80
|
-
className={cn(
|
|
81
|
-
"px-1 uppercase border rounded-sm",
|
|
82
|
-
transitions.length ? "cursor-pointer" : "pointer-events-none",
|
|
83
|
-
TASK_DROPDOWN_BADGE_VARIANTS[variant],
|
|
84
|
-
)}
|
|
85
|
-
{...getReferenceProps()}
|
|
86
|
-
>
|
|
87
|
-
<span className="text-sm font-bold">{title}</span>
|
|
88
|
-
{transitions.length > 0 ? (
|
|
89
|
-
<FontAwesomeIcon
|
|
90
|
-
icon={faChevronDown}
|
|
91
|
-
className="text-gray-400 ml-1"
|
|
92
|
-
/>
|
|
93
|
-
) : (
|
|
94
|
-
<></>
|
|
95
|
-
)}
|
|
96
|
-
</div>
|
|
97
|
-
|
|
98
|
-
{isOpen && transitions.length && (
|
|
99
|
-
<div
|
|
100
|
-
ref={refs.setFloating}
|
|
101
|
-
style={floatingStyles}
|
|
102
|
-
className={cn(
|
|
103
|
-
"border border-gray-200 py-1.5 rounded-sm min-w-[172px] bg-white shadow-dark/50",
|
|
104
|
-
)}
|
|
105
|
-
{...getFloatingProps()}
|
|
106
|
-
>
|
|
107
|
-
{transitions.map((transition, index) => (
|
|
108
|
-
<MenuItem
|
|
109
|
-
key={index}
|
|
110
|
-
transition={transition}
|
|
111
|
-
onClick={() => {
|
|
112
|
-
onClick?.(transition.id as string);
|
|
113
|
-
setIsOpen(false);
|
|
114
|
-
}}
|
|
115
|
-
/>
|
|
116
|
-
))}
|
|
117
|
-
</div>
|
|
118
|
-
)}
|
|
119
|
-
</>
|
|
120
|
-
);
|
|
121
|
-
};
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import clsx from "clsx";
|
|
2
|
-
import { TaskStatus, TASK_STATUS } from "../../types/task.types";
|
|
3
|
-
import { PLAYBOOK_TYPES, PlaybookType } from "../../types/playbook.types";
|
|
4
|
-
|
|
5
|
-
export interface TaskCardV2LeftPanelProps {
|
|
6
|
-
playbookType: PlaybookType;
|
|
7
|
-
status: TaskStatus;
|
|
8
|
-
step: number;
|
|
9
|
-
isSelected?: boolean;
|
|
10
|
-
onSelect?: (withShiftKey?: boolean) => void;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
const LEFT_PANEL_FORMATTED_LABELS: {
|
|
14
|
-
[key in TaskStatus]?: string;
|
|
15
|
-
} = {
|
|
16
|
-
[TASK_STATUS.IN_REVIEW]: "In Review",
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
const LEFT_PANEL_COLOR: {
|
|
20
|
-
[key in TaskStatus]?: string;
|
|
21
|
-
} = {
|
|
22
|
-
[TASK_STATUS.OPEN]: "bg-secondary-500",
|
|
23
|
-
[TASK_STATUS.IN_PROGRESS]: "bg-primary-600",
|
|
24
|
-
[TASK_STATUS.IN_REVIEW]: "bg-success-600",
|
|
25
|
-
[TASK_STATUS.COMPLETED]: "bg-success-600",
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
export const TaskLeftPanel = ({
|
|
29
|
-
playbookType,
|
|
30
|
-
status,
|
|
31
|
-
step,
|
|
32
|
-
isSelected,
|
|
33
|
-
onSelect,
|
|
34
|
-
}: TaskCardV2LeftPanelProps) => {
|
|
35
|
-
return (
|
|
36
|
-
<div
|
|
37
|
-
className={clsx(
|
|
38
|
-
"flex flex-col items-center justify-center",
|
|
39
|
-
isSelected ? "bg-[#FFE600]" : LEFT_PANEL_COLOR[status],
|
|
40
|
-
onSelect && "cursor-pointer",
|
|
41
|
-
)}
|
|
42
|
-
onClick={(e) => {
|
|
43
|
-
e.stopPropagation();
|
|
44
|
-
onSelect?.(e.shiftKey);
|
|
45
|
-
}}
|
|
46
|
-
>
|
|
47
|
-
<span
|
|
48
|
-
className={clsx(
|
|
49
|
-
`text-orientation-mixed w-[27px] flex items-center whitespace-nowrap px-2 text-sm font-bold [writing-mode:vertical-lr]`,
|
|
50
|
-
isSelected ? "text-black" : "text-white",
|
|
51
|
-
)}
|
|
52
|
-
>
|
|
53
|
-
{/** TODO: check "status" wording */}
|
|
54
|
-
{playbookType === PLAYBOOK_TYPES.SEQUENTIAL
|
|
55
|
-
? `STEP ${step}`
|
|
56
|
-
: (LEFT_PANEL_FORMATTED_LABELS[status] || status).toUpperCase()}
|
|
57
|
-
</span>
|
|
58
|
-
</div>
|
|
59
|
-
);
|
|
60
|
-
};
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { TASK_STATUS, TaskStatus } from "../../types/task.types";
|
|
2
|
-
import { Badge, BadgeSolid } from "../badge";
|
|
3
|
-
|
|
4
|
-
export interface TaskCardV2StatusBadgeProps {
|
|
5
|
-
status: TaskStatus;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export const STATUS_BADGE_COLOR: {
|
|
9
|
-
[key in TaskStatus]?: keyof typeof BadgeSolid;
|
|
10
|
-
} = {
|
|
11
|
-
[TASK_STATUS.OPEN]: "secondary",
|
|
12
|
-
[TASK_STATUS.IN_PROGRESS]: "primary",
|
|
13
|
-
[TASK_STATUS.IN_REVIEW]: "success",
|
|
14
|
-
[TASK_STATUS.COMPLETED]: "success",
|
|
15
|
-
} as const;
|
|
16
|
-
|
|
17
|
-
export const TaskStatusBadge = ({ status }: TaskCardV2StatusBadgeProps) => {
|
|
18
|
-
return (
|
|
19
|
-
<Badge category="outline" color={STATUS_BADGE_COLOR[status]}>
|
|
20
|
-
{status}
|
|
21
|
-
</Badge>
|
|
22
|
-
);
|
|
23
|
-
};
|
|
@@ -1,269 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ReactNode,
|
|
3
|
-
ButtonHTMLAttributes,
|
|
4
|
-
CSSProperties,
|
|
5
|
-
forwardRef,
|
|
6
|
-
} from "react";
|
|
7
|
-
import { twMerge } from "tailwind-merge";
|
|
8
|
-
/*
|
|
9
|
-
DOCS: https://tailwindcss.com/docs/content-configuration#class-detection-in-depth
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
const ButtonBase =
|
|
13
|
-
"whitespace-nowrap font-normal flex items-center justify-center";
|
|
14
|
-
const ButtonFocus =
|
|
15
|
-
"focus:outline focus:outline-3 focus:outline-primary-500/[.3]";
|
|
16
|
-
const ButtonDisabled = "disabled:opacity-15 disabled:pointer-events-none";
|
|
17
|
-
|
|
18
|
-
const isLight = (color: string) => {
|
|
19
|
-
return Boolean(color === "grayLight" || color === "warning");
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
const handleNoneColor = (fn: () => string, color?: string) => {
|
|
23
|
-
if (!color || color === "none") {
|
|
24
|
-
return "";
|
|
25
|
-
}
|
|
26
|
-
return fn();
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
const buttonColorBase = (color: string, active: boolean) =>
|
|
30
|
-
handleNoneColor(() => {
|
|
31
|
-
const useColor = color === "gray400" ? "gray" : color;
|
|
32
|
-
const textColor = isLight(useColor)
|
|
33
|
-
? "active:text-black"
|
|
34
|
-
: "active:text-white";
|
|
35
|
-
if (color === "primary") {
|
|
36
|
-
return active
|
|
37
|
-
? `bg-${useColor}-800 text-white`
|
|
38
|
-
: `hover:bg-${useColor}-800 active:bg-${useColor}-800 hover:text-white ${textColor}`;
|
|
39
|
-
} else if (useColor === "grayDark") {
|
|
40
|
-
return active
|
|
41
|
-
? "bg-gray-800 text-white"
|
|
42
|
-
: `hover:bg-gray-800 active:bg-gray-800 hover:text-white ${textColor}`;
|
|
43
|
-
} else if (useColor === "grayLight") {
|
|
44
|
-
return active
|
|
45
|
-
? "bg-gray-50 text-black"
|
|
46
|
-
: `hover:bg-gray-50 active:bg-gray-50 hover:text-black ${textColor}`;
|
|
47
|
-
} else if (color === "gray400") {
|
|
48
|
-
return active
|
|
49
|
-
? `bg-${useColor}-500 text-white`
|
|
50
|
-
: `hover:bg-${useColor}-500 active:bg-${useColor}-500 hover:text-white ${textColor}`;
|
|
51
|
-
}
|
|
52
|
-
return active
|
|
53
|
-
? `bg-${useColor}-700 text-white`
|
|
54
|
-
: `hover:bg-${useColor}-600 active:bg-${useColor}-700 hover:text-white ${textColor}`;
|
|
55
|
-
}, color);
|
|
56
|
-
|
|
57
|
-
const buttonColorSolid = (color: string) =>
|
|
58
|
-
handleNoneColor(() => {
|
|
59
|
-
const textColor = isLight(color) ? "text-black" : "text-white";
|
|
60
|
-
if (color === "primary") {
|
|
61
|
-
return `bg-primary-600 ${textColor}`;
|
|
62
|
-
} else if (color === "gray400") {
|
|
63
|
-
return `bg-gray-400 ${textColor}`;
|
|
64
|
-
}
|
|
65
|
-
return `bg-${color}-500 ${textColor}`;
|
|
66
|
-
}, color);
|
|
67
|
-
|
|
68
|
-
const buttonColorLink = (color: string) => {
|
|
69
|
-
const classes: Record<string, string> = {
|
|
70
|
-
dark: "text-dark hover:text-dark",
|
|
71
|
-
yellow: "text-yellow hover:text-yellow",
|
|
72
|
-
gray: "text-gray-500 hover:text-gray-800",
|
|
73
|
-
primary: "text-primary-600 hover:text-primary-800",
|
|
74
|
-
secondary: "text-secondary-500 hover:text-secondary-800",
|
|
75
|
-
success: "text-success-500 hover:text-success-800",
|
|
76
|
-
info: "text-info-500 hover:text-info-800",
|
|
77
|
-
warning: "text-warning-500 hover:text-warning-800",
|
|
78
|
-
danger: "text-danger-500 hover:text-danger-800",
|
|
79
|
-
steel: "text-steel-500 hover:text-steel-800",
|
|
80
|
-
orange: "text-orange-500 hover:text-orange-800",
|
|
81
|
-
purple: "text-purple-500 hover:text-purple-800",
|
|
82
|
-
"fiserv-orange": "text-fiserv-orange-500 hover:text-fiserv-orange-800",
|
|
83
|
-
grayDark: "text-gray-800 hover:text-gray-900",
|
|
84
|
-
grayLight: "text-gray-50 hover:text-gray-400",
|
|
85
|
-
gray400: "text-gray-400 hover:text-gray-700",
|
|
86
|
-
};
|
|
87
|
-
return (color && classes[color]) || "";
|
|
88
|
-
};
|
|
89
|
-
|
|
90
|
-
const buttonColorLinkHoverSolid = (color: string, active: boolean) => {
|
|
91
|
-
const classes: Record<string, string> = {
|
|
92
|
-
dark: active
|
|
93
|
-
? "bg-dark text-white"
|
|
94
|
-
: "text-dark hover:bg-dark hover:text-white",
|
|
95
|
-
yellow: active
|
|
96
|
-
? "bg-yellow text-white"
|
|
97
|
-
: "text-yellow hover:bg-yellow hover:text-white",
|
|
98
|
-
gray: active
|
|
99
|
-
? "bg-gray-500 text-white"
|
|
100
|
-
: "text-gray-500 hover:bg-gray-500 hover:text-white",
|
|
101
|
-
primary: active
|
|
102
|
-
? "bg-primary-800 text-white"
|
|
103
|
-
: "text-primary-600 hover:bg-primary-800 hover:text-white",
|
|
104
|
-
secondary: active
|
|
105
|
-
? "bg-secondary-500 text-white"
|
|
106
|
-
: "text-secondary-500 hover:bg-secondary-500 hover:text-white",
|
|
107
|
-
success: active
|
|
108
|
-
? "bg-success-500 text-white"
|
|
109
|
-
: "text-success-500 hover:bg-success-500 hover:text-white",
|
|
110
|
-
info: active
|
|
111
|
-
? "bg-info-500 text-white"
|
|
112
|
-
: "text-info-500 hover:bg-info-500 hover:text-white",
|
|
113
|
-
warning: active
|
|
114
|
-
? "bg-warning-500 text-white"
|
|
115
|
-
: "text-warning-500 hover:bg-warning-500 hover:text-white",
|
|
116
|
-
danger: active
|
|
117
|
-
? "bg-danger-500 text-white"
|
|
118
|
-
: "text-danger-500 hover:bg-danger-500 hover:text-white",
|
|
119
|
-
steel: active
|
|
120
|
-
? "bg-steel-500 text-white"
|
|
121
|
-
: "text-steel-500 hover:bg-steel-500 hover:text-white",
|
|
122
|
-
orange: active
|
|
123
|
-
? "bg-orange-500 text-white"
|
|
124
|
-
: "text-orange-500 hover:bg-orange-500 hover:text-white",
|
|
125
|
-
purple: active
|
|
126
|
-
? "bg-purple-500 text-white"
|
|
127
|
-
: "text-purple-500 hover:bg-purple-500 hover:text-white",
|
|
128
|
-
"fiserv-orange": active
|
|
129
|
-
? "bg-fiserv-orange-500 text-white"
|
|
130
|
-
: "text-fiserv-orange-500 hover:bg-fiserv-orange-500 hover:text-white",
|
|
131
|
-
grayDark: active
|
|
132
|
-
? "bg-gray-900 text-white"
|
|
133
|
-
: "text-gray-800 hover:bg-gray-900 hover:text-white",
|
|
134
|
-
grayLight: active
|
|
135
|
-
? "bg-gray-400 text-white"
|
|
136
|
-
: "text-gray-50 hover:bg-gray-400 hover:text-white",
|
|
137
|
-
gray400: active
|
|
138
|
-
? "bg-gray-500 text-white"
|
|
139
|
-
: "text-gray-400 hover:bg-gray-500 hover:text-white",
|
|
140
|
-
};
|
|
141
|
-
return (color && classes[color]) || "";
|
|
142
|
-
};
|
|
143
|
-
|
|
144
|
-
const buttonColorOutline = (color: string, active: boolean) => {
|
|
145
|
-
if (!color || color === "none") {
|
|
146
|
-
return "";
|
|
147
|
-
} else if (color === "primary") {
|
|
148
|
-
return `border border-primary-600 ${active ? "" : "text-primary-600"}`;
|
|
149
|
-
} else if (color === "grayDark") {
|
|
150
|
-
return `border border-gray-800 ${active ? "" : "text-gray-800"}`;
|
|
151
|
-
} else if (color === "grayLight") {
|
|
152
|
-
return `border border-gray-50 ${active ? "" : "text-gray-400"}`;
|
|
153
|
-
} else if (color === "gray400") {
|
|
154
|
-
return `border border-gray-400 ${active ? "" : "text-gray-400"}`;
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
return `border border-${color}-500 ${active ? "" : `text-${color}-500`}`;
|
|
158
|
-
};
|
|
159
|
-
|
|
160
|
-
export type ButtonCategoryType =
|
|
161
|
-
| "solid"
|
|
162
|
-
| "link"
|
|
163
|
-
| "linkHoverSolid"
|
|
164
|
-
| "outline";
|
|
165
|
-
|
|
166
|
-
const ButtonCategoryFn = (
|
|
167
|
-
color: string,
|
|
168
|
-
active: boolean,
|
|
169
|
-
): { [key in ButtonCategoryType]: string } => {
|
|
170
|
-
return {
|
|
171
|
-
solid: buttonColorSolid(color),
|
|
172
|
-
link: buttonColorLink(color),
|
|
173
|
-
linkHoverSolid: buttonColorLinkHoverSolid(color, active),
|
|
174
|
-
outline: buttonColorOutline(color, active),
|
|
175
|
-
};
|
|
176
|
-
};
|
|
177
|
-
|
|
178
|
-
export const ButtonSize = {
|
|
179
|
-
none: "",
|
|
180
|
-
default: "min-w-fit h-[40px] text-base px-3",
|
|
181
|
-
base: "w-full md:min-w-fit h-[40px] text-base px-3",
|
|
182
|
-
small: "min-w-[106px] h-[30px] text-sm px-2",
|
|
183
|
-
normal: "min-w-[140px] h-[38px] text-base px-3",
|
|
184
|
-
large: "min-w-[160px] h-[40px] text-lg px-3",
|
|
185
|
-
NormalBlock: "w-full h-[40px] text-lg px-3",
|
|
186
|
-
box: "w-[38px] h-[38px]",
|
|
187
|
-
smallCollapse: "h-[30px] text-sm px-2",
|
|
188
|
-
normalCollapse: "h-[38px] text-base px-3",
|
|
189
|
-
} as const;
|
|
190
|
-
|
|
191
|
-
export type ButtonSizeType = keyof typeof ButtonSize;
|
|
192
|
-
|
|
193
|
-
export const ButtonRounded = {
|
|
194
|
-
none: "",
|
|
195
|
-
default: "rounded",
|
|
196
|
-
pill: "rounded-pill",
|
|
197
|
-
} as const;
|
|
198
|
-
|
|
199
|
-
export type ButtonRoundedType = keyof typeof ButtonRounded;
|
|
200
|
-
|
|
201
|
-
export interface ButtonProps
|
|
202
|
-
extends ButtonHTMLAttributes<Omit<HTMLButtonElement, "type">> {
|
|
203
|
-
active?: boolean;
|
|
204
|
-
children: ReactNode;
|
|
205
|
-
color?: string;
|
|
206
|
-
size?: ButtonSizeType;
|
|
207
|
-
category?: "solid" | "link" | "outline" | "linkHoverSolid";
|
|
208
|
-
type?: "button" | "submit";
|
|
209
|
-
rounded?: ButtonRoundedType;
|
|
210
|
-
className?: string;
|
|
211
|
-
useFilterStyle?: boolean;
|
|
212
|
-
usePaginationStyle?: boolean;
|
|
213
|
-
dataCy?: string;
|
|
214
|
-
testingIdKey?: string;
|
|
215
|
-
style?: CSSProperties;
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
const button = (
|
|
219
|
-
{
|
|
220
|
-
active = false,
|
|
221
|
-
children,
|
|
222
|
-
color = "primary",
|
|
223
|
-
size = "normal",
|
|
224
|
-
category = "solid",
|
|
225
|
-
className,
|
|
226
|
-
type = "button",
|
|
227
|
-
rounded = "default",
|
|
228
|
-
style = {},
|
|
229
|
-
...props
|
|
230
|
-
}: ButtonProps,
|
|
231
|
-
ref: React.Ref<HTMLButtonElement>,
|
|
232
|
-
) => {
|
|
233
|
-
const disabledClasses = ButtonDisabled;
|
|
234
|
-
const colorBaseClasses = !/link/.test(category)
|
|
235
|
-
? buttonColorBase(color, active)
|
|
236
|
-
: null;
|
|
237
|
-
const focusClasses = ButtonFocus; // for accessibility we always need focus outlines
|
|
238
|
-
const sizeClasses = ButtonSize[size];
|
|
239
|
-
const categoryClasses = ButtonCategoryFn(color, active)?.[category];
|
|
240
|
-
const colorClasses = twMerge(colorBaseClasses, categoryClasses);
|
|
241
|
-
const roundedClasses = ButtonRounded[rounded];
|
|
242
|
-
return (
|
|
243
|
-
<button
|
|
244
|
-
{...props}
|
|
245
|
-
style={{
|
|
246
|
-
...style,
|
|
247
|
-
transition:
|
|
248
|
-
"color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out",
|
|
249
|
-
}}
|
|
250
|
-
type={type}
|
|
251
|
-
ref={ref}
|
|
252
|
-
className={twMerge(
|
|
253
|
-
ButtonBase,
|
|
254
|
-
focusClasses,
|
|
255
|
-
disabledClasses,
|
|
256
|
-
sizeClasses,
|
|
257
|
-
colorClasses,
|
|
258
|
-
roundedClasses,
|
|
259
|
-
className,
|
|
260
|
-
"cursor-pointer",
|
|
261
|
-
)}
|
|
262
|
-
>
|
|
263
|
-
{children}
|
|
264
|
-
</button>
|
|
265
|
-
);
|
|
266
|
-
};
|
|
267
|
-
|
|
268
|
-
const Button = forwardRef(button);
|
|
269
|
-
export default Button;
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { Description, Field, Input, Label } from "@headlessui/react";
|
|
2
|
-
import { cn } from "../../utils/cn";
|
|
3
|
-
|
|
4
|
-
interface InputProps extends React.InputHTMLAttributes<HTMLInputElement> {
|
|
5
|
-
type?: string; // Optional type prop, default is "text"
|
|
6
|
-
label: string; // Required label prop for the input field
|
|
7
|
-
description?: string; // Optional description prop for additional information
|
|
8
|
-
}
|
|
9
|
-
export const InputField = ({
|
|
10
|
-
type = "text",
|
|
11
|
-
className,
|
|
12
|
-
label,
|
|
13
|
-
description,
|
|
14
|
-
...props
|
|
15
|
-
}: InputProps & {
|
|
16
|
-
className?: string;
|
|
17
|
-
}) => {
|
|
18
|
-
return (
|
|
19
|
-
<div className="w-full max-w-md px-4">
|
|
20
|
-
<Field>
|
|
21
|
-
<Label className="font-medium text-gray-900">{label}</Label>
|
|
22
|
-
{description && (
|
|
23
|
-
<Description className="text-sm text-secondary">
|
|
24
|
-
{description}
|
|
25
|
-
</Description>
|
|
26
|
-
)}
|
|
27
|
-
<Input
|
|
28
|
-
type={type}
|
|
29
|
-
className={cn(
|
|
30
|
-
"mt-3 block w-full rounded-lg border border-gray-200 px-3 py-1.5 text-sm/6 text-gray-800",
|
|
31
|
-
"focus:not-data-focus:outline-none data-focus:outline-2 data-focus:-outline-offset-2 data-focus:outline-primary-500",
|
|
32
|
-
className,
|
|
33
|
-
)}
|
|
34
|
-
{...props}
|
|
35
|
-
/>
|
|
36
|
-
</Field>
|
|
37
|
-
</div>
|
|
38
|
-
);
|
|
39
|
-
};
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Dialog,
|
|
3
|
-
DialogBackdrop,
|
|
4
|
-
DialogPanel,
|
|
5
|
-
DialogTitle,
|
|
6
|
-
} from "@headlessui/react";
|
|
7
|
-
import React from "react";
|
|
8
|
-
import Button from "./button";
|
|
9
|
-
|
|
10
|
-
export const Modal = ({
|
|
11
|
-
isOpen,
|
|
12
|
-
close,
|
|
13
|
-
title,
|
|
14
|
-
dismissOptions,
|
|
15
|
-
confirmOptions,
|
|
16
|
-
children,
|
|
17
|
-
}: {
|
|
18
|
-
isOpen: boolean;
|
|
19
|
-
close: () => void;
|
|
20
|
-
title: string;
|
|
21
|
-
children: React.ReactNode;
|
|
22
|
-
dismissOptions?: {
|
|
23
|
-
label: string;
|
|
24
|
-
onClick: () => void;
|
|
25
|
-
};
|
|
26
|
-
confirmOptions?: {
|
|
27
|
-
label: string;
|
|
28
|
-
onClick: () => void;
|
|
29
|
-
disabled?: boolean;
|
|
30
|
-
};
|
|
31
|
-
}) => {
|
|
32
|
-
return (
|
|
33
|
-
<Dialog
|
|
34
|
-
open={isOpen}
|
|
35
|
-
onClose={close}
|
|
36
|
-
className="relative z-50 transition duration-300 ease-out data-closed:opacity-0"
|
|
37
|
-
transition
|
|
38
|
-
>
|
|
39
|
-
{/* The backdrop, rendered as a fixed sibling to the panel container */}
|
|
40
|
-
<DialogBackdrop className="fixed inset-0 bg-black/30" />
|
|
41
|
-
|
|
42
|
-
{/* Full-screen container to center the panel */}
|
|
43
|
-
<div className="fixed inset-0 flex w-screen items-center justify-center p-4">
|
|
44
|
-
{/* The actual dialog panel */}
|
|
45
|
-
<DialogPanel className="max-w-lg divide-y divide-gray-100 bg-white rounded-sm shadow-xl">
|
|
46
|
-
<DialogTitle className=" text-gray-900 p-4">{title}</DialogTitle>
|
|
47
|
-
<div className="p-4">{children}</div>
|
|
48
|
-
{dismissOptions || confirmOptions ? (
|
|
49
|
-
<div className="flex gap-4 justify-end p-4">
|
|
50
|
-
{dismissOptions ? (
|
|
51
|
-
<Button
|
|
52
|
-
onClick={() => {
|
|
53
|
-
dismissOptions.onClick();
|
|
54
|
-
close();
|
|
55
|
-
}}
|
|
56
|
-
size="small"
|
|
57
|
-
color="secondary"
|
|
58
|
-
>
|
|
59
|
-
{dismissOptions.label}
|
|
60
|
-
</Button>
|
|
61
|
-
) : (
|
|
62
|
-
<></>
|
|
63
|
-
)}
|
|
64
|
-
|
|
65
|
-
{confirmOptions ? (
|
|
66
|
-
<Button
|
|
67
|
-
disabled={confirmOptions.disabled}
|
|
68
|
-
onClick={() => {
|
|
69
|
-
confirmOptions.onClick();
|
|
70
|
-
close();
|
|
71
|
-
}}
|
|
72
|
-
size="small"
|
|
73
|
-
color="primary"
|
|
74
|
-
>
|
|
75
|
-
{confirmOptions.label}
|
|
76
|
-
</Button>
|
|
77
|
-
) : (
|
|
78
|
-
<></>
|
|
79
|
-
)}
|
|
80
|
-
</div>
|
|
81
|
-
) : (
|
|
82
|
-
<></>
|
|
83
|
-
)}
|
|
84
|
-
</DialogPanel>
|
|
85
|
-
</div>
|
|
86
|
-
</Dialog>
|
|
87
|
-
);
|
|
88
|
-
};
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { useMutation } from "@tanstack/react-query";
|
|
2
|
-
import { completeTask } from "../../services/complete-task.service";
|
|
3
|
-
|
|
4
|
-
export const useCompleteTask = () => {
|
|
5
|
-
const completeTaskMutation = useMutation({
|
|
6
|
-
mutationFn: async (taskInstanceId: string) => {
|
|
7
|
-
return completeTask(taskInstanceId);
|
|
8
|
-
},
|
|
9
|
-
});
|
|
10
|
-
|
|
11
|
-
const completeTaskHandler = async (taskInstanceId: string) => {
|
|
12
|
-
return completeTaskMutation.mutateAsync(taskInstanceId, {
|
|
13
|
-
onSuccess: () => {
|
|
14
|
-
console.log("Task completed successfully");
|
|
15
|
-
},
|
|
16
|
-
onError: (error) => {
|
|
17
|
-
console.error("Error completing task:", error);
|
|
18
|
-
},
|
|
19
|
-
});
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
return {
|
|
23
|
-
completeTask: completeTaskHandler,
|
|
24
|
-
...completeTaskMutation,
|
|
25
|
-
};
|
|
26
|
-
};
|