@diwauhris/ui 1.4.4 → 1.6.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/lib/assets/ui.css +195 -51
- package/lib/index.cjs +2751 -115
- package/lib/index.mjs +2742 -118
- package/lib/types/ui-library/gallery/charts/AreaChart.d.ts +110 -0
- package/lib/types/ui-library/gallery/charts/BarList.d.ts +65 -0
- package/lib/types/ui-library/gallery/charts/Charts.d.ts +21 -5
- package/lib/types/ui-library/gallery/combobox/Combobox.d.ts +2 -1
- package/lib/types/ui-library/gallery/org-chart/OrgChart.d.ts +77 -0
- package/lib/types/ui-library/gallery/org-unit-tree/OrgUnitTree.d.ts +84 -0
- package/lib/types/ui-library/gallery/page-sample/IsoCubeBlock.d.ts +28 -0
- package/lib/types/ui-library/gallery/template-samples/templates/PafTemplate.d.ts +57 -0
- package/lib/types/ui-library/gallery/template-samples/templates/PayslipTemplate.d.ts +42 -0
- package/lib/types/ui-library/gallery/template-samples/templates/ReportTemplate.d.ts +18 -0
- package/lib/types/ui-library/gallery/template-samples/templates/TimekeepingTemplate.d.ts +22 -0
- package/lib/types/ui-library/index.d.ts +19 -1
- package/lib/types/ui-library/registry.d.ts +3 -9
- package/package.json +15 -2
package/lib/index.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { createContext, createElement, use, useCallback, useContext, useEffect, useId, useMemo, useRef, useState } from "react";
|
|
2
|
+
import React, { cloneElement, createContext, createElement, isValidElement, use, useCallback, useContext, useEffect, useId, useMemo, useRef, useState } from "react";
|
|
3
3
|
import { clsx } from "clsx";
|
|
4
4
|
import { twMerge } from "tailwind-merge";
|
|
5
|
-
import { AlertCircle, AlertTriangle, Archive, ArchiveRestore, ArrowDown, Ban, CalendarDays, Check, CheckCircle2, ChevronDown, ChevronLeft, ChevronRight, Clock, Command, File, Home, Info, Minus, Search, ShieldCheck, TrendingDown, TrendingUp, UploadCloud, X } from "lucide-react";
|
|
5
|
+
import { AlertCircle, AlertTriangle, Archive, ArchiveRestore, ArrowDown, Ban, CalendarDays, Check, CheckCircle2, ChevronDown, ChevronLeft, ChevronRight, Clock, Command, File, Home, Info, Minus, RotateCcw, Search, ShieldCheck, TrendingDown, TrendingUp, UploadCloud, X, ZoomIn, ZoomOut } from "lucide-react";
|
|
6
6
|
import Calendar$1 from "react-calendar";
|
|
7
7
|
import { format, isValid, parse } from "date-fns";
|
|
8
8
|
import * as DialogPrimitive from "@radix-ui/react-dialog";
|
|
@@ -10,6 +10,7 @@ import { createPortal } from "react-dom";
|
|
|
10
10
|
import * as PopoverPrimitive from "@radix-ui/react-popover";
|
|
11
11
|
import * as TooltipPrimitive from "@radix-ui/react-tooltip";
|
|
12
12
|
import { Link } from "react-router-dom";
|
|
13
|
+
import * as d3 from "d3";
|
|
13
14
|
import { Toaster, toast } from "sonner";
|
|
14
15
|
export * from "lucide-react";
|
|
15
16
|
//#region \0rolldown/runtime.js
|
|
@@ -189,15 +190,15 @@ function getInitials(name) {
|
|
|
189
190
|
return ((parts[0] ?? "").charAt(0) + (parts[parts.length - 1] ?? "").charAt(0)).toUpperCase();
|
|
190
191
|
}
|
|
191
192
|
var PALETTE = [
|
|
192
|
-
"#
|
|
193
|
+
"#00377B",
|
|
194
|
+
"#034EA2",
|
|
195
|
+
"#2D8ACA",
|
|
196
|
+
"#00ADCC",
|
|
197
|
+
"#00A74C",
|
|
198
|
+
"#B61D66",
|
|
199
|
+
"#F68B1F",
|
|
193
200
|
"#0F4C81",
|
|
194
|
-
"#0369A1"
|
|
195
|
-
"#1E3A8A",
|
|
196
|
-
"#0D9488",
|
|
197
|
-
"#0F766E",
|
|
198
|
-
"#B45309",
|
|
199
|
-
"#C2410C",
|
|
200
|
-
"#BE185D"
|
|
201
|
+
"#0369A1"
|
|
201
202
|
];
|
|
202
203
|
function deriveColor(name) {
|
|
203
204
|
if (!name) return PALETTE[0];
|
|
@@ -695,6 +696,7 @@ function RadioItem({ value, label, description, disabled: itemDisabled = false,
|
|
|
695
696
|
const isDisabled = groupDisabled || itemDisabled;
|
|
696
697
|
const isChecked = activeValue === value;
|
|
697
698
|
return /* @__PURE__ */ jsxs("label", {
|
|
699
|
+
htmlFor: id,
|
|
698
700
|
className: [
|
|
699
701
|
"group flex cursor-pointer items-start gap-3",
|
|
700
702
|
isDisabled ? "cursor-not-allowed opacity-50" : "",
|
|
@@ -710,7 +712,8 @@ function RadioItem({ value, label, description, disabled: itemDisabled = false,
|
|
|
710
712
|
disabled: isDisabled,
|
|
711
713
|
required,
|
|
712
714
|
onChange: () => !isDisabled && select(value),
|
|
713
|
-
className: "peer sr-only"
|
|
715
|
+
className: "peer sr-only",
|
|
716
|
+
"aria-label": typeof label === "string" ? label : void 0
|
|
714
717
|
}),
|
|
715
718
|
/* @__PURE__ */ jsx("div", {
|
|
716
719
|
className: [
|
|
@@ -750,6 +753,7 @@ function Switch({ checked, onChange, label, description, disabled = false, loadi
|
|
|
750
753
|
role: "switch",
|
|
751
754
|
"aria-checked": checked,
|
|
752
755
|
"aria-labelledby": labelId,
|
|
756
|
+
"aria-label": !label ? "Toggle" : void 0,
|
|
753
757
|
"aria-disabled": !isInteractive || void 0,
|
|
754
758
|
disabled: !isInteractive,
|
|
755
759
|
onClick: () => isInteractive && onChange(!checked),
|
|
@@ -789,7 +793,7 @@ function Switch({ checked, onChange, label, description, disabled = false, loadi
|
|
|
789
793
|
*/
|
|
790
794
|
var fieldInputClass = "w-full rounded-xl border border-slate-200 bg-slate-50 px-4 py-2.5 text-sm font-medium text-slate-900 outline-none transition placeholder:text-slate-400 focus:border-brand-blue/40 focus:ring-2 focus:ring-brand-blue/15 disabled:cursor-not-allowed disabled:opacity-60";
|
|
791
795
|
var fieldInputErrorClass = "border-rose-300 focus:border-rose-400 focus:ring-rose-100";
|
|
792
|
-
function Combobox({ value, onChange, options, placeholder, className, disabled, loading, error }) {
|
|
796
|
+
function Combobox({ value, onChange, options, placeholder, className, disabled, loading, error, "aria-label": ariaLabel }) {
|
|
793
797
|
const [isOpen, setIsOpen] = useState(false);
|
|
794
798
|
const [search, setSearch] = useState(value);
|
|
795
799
|
const [highlightIndex, setHighlightIndex] = useState(-1);
|
|
@@ -870,6 +874,7 @@ function Combobox({ value, onChange, options, placeholder, className, disabled,
|
|
|
870
874
|
"aria-activedescendant": highlightIndex >= 0 ? optionId(highlightIndex) : void 0,
|
|
871
875
|
"aria-autocomplete": "list",
|
|
872
876
|
"aria-invalid": error ? "true" : void 0,
|
|
877
|
+
"aria-label": ariaLabel,
|
|
873
878
|
value: search,
|
|
874
879
|
onChange: handleInputChange,
|
|
875
880
|
onFocus: () => setIsOpen(true),
|
|
@@ -2371,12 +2376,6 @@ var radius = {
|
|
|
2371
2376
|
* - Use gallery Button component (Phase 11 — replaces legacy inlined btn* strings)
|
|
2372
2377
|
* - Use a simple inline ErrorBanner instead of importing from ui.tsx
|
|
2373
2378
|
*/
|
|
2374
|
-
function ErrorBanner$1({ message }) {
|
|
2375
|
-
return /* @__PURE__ */ jsx("div", {
|
|
2376
|
-
className: "rounded-lg border border-rose-100 bg-rose-50 px-4 py-3 text-sm font-medium text-rose-700",
|
|
2377
|
-
children: message
|
|
2378
|
-
});
|
|
2379
|
-
}
|
|
2380
2379
|
function ConfirmAction({ title, message, label, description, confirmLabel = "Confirm", tone = "danger", disabled = false, onConfirm, children }) {
|
|
2381
2380
|
const [open, setOpen] = useState(false);
|
|
2382
2381
|
const [pending, setPending] = useState(false);
|
|
@@ -2438,7 +2437,7 @@ function ConfirmAction({ title, message, label, description, confirmLabel = "Con
|
|
|
2438
2437
|
className: "text-sm font-medium leading-relaxed text-slate-600",
|
|
2439
2438
|
children: effectiveMessage
|
|
2440
2439
|
})]
|
|
2441
|
-
}), error && /* @__PURE__ */ jsx(ErrorBanner
|
|
2440
|
+
}), error && /* @__PURE__ */ jsx(ErrorBanner, { message: error })]
|
|
2442
2441
|
})
|
|
2443
2442
|
})] });
|
|
2444
2443
|
}
|
|
@@ -2929,8 +2928,8 @@ function StepCircle({ state, number, icon }) {
|
|
|
2929
2928
|
}
|
|
2930
2929
|
function Stepper({ steps, currentStep, completedSteps = [], disabledSteps = [], orientation = "horizontal", className = "" }) {
|
|
2931
2930
|
if (!(orientation === "horizontal")) return /* @__PURE__ */ jsx("div", {
|
|
2931
|
+
role: "group",
|
|
2932
2932
|
"aria-label": "Progress",
|
|
2933
|
-
"aria-orientation": "vertical",
|
|
2934
2933
|
className: ["flex flex-col", className].filter(Boolean).join(" "),
|
|
2935
2934
|
children: /* @__PURE__ */ jsx("ol", {
|
|
2936
2935
|
className: "flex flex-col",
|
|
@@ -2978,34 +2977,48 @@ function Stepper({ steps, currentStep, completedSteps = [], disabledSteps = [],
|
|
|
2978
2977
|
disabled: "text-slate-300"
|
|
2979
2978
|
};
|
|
2980
2979
|
return /* @__PURE__ */ jsx("div", {
|
|
2980
|
+
role: "group",
|
|
2981
2981
|
"aria-label": "Progress",
|
|
2982
|
-
"aria-orientation": "horizontal",
|
|
2983
2982
|
className: ["w-full", className].filter(Boolean).join(" "),
|
|
2984
2983
|
children: /* @__PURE__ */ jsx("ol", {
|
|
2985
|
-
className: "
|
|
2984
|
+
className: "grid w-full",
|
|
2985
|
+
style: { gridTemplateColumns: `repeat(${steps.length}, 1fr)` },
|
|
2986
2986
|
children: steps.map((step, idx) => {
|
|
2987
2987
|
const state = resolvedStates[idx];
|
|
2988
2988
|
const isCurrent = state === "current";
|
|
2989
2989
|
const isLast = idx === steps.length - 1;
|
|
2990
|
+
const prevState = idx > 0 ? resolvedStates[idx - 1] : null;
|
|
2990
2991
|
return /* @__PURE__ */ jsxs("li", {
|
|
2991
2992
|
"aria-current": isCurrent ? "step" : void 0,
|
|
2992
|
-
className:
|
|
2993
|
+
className: "flex flex-col items-center",
|
|
2993
2994
|
children: [/* @__PURE__ */ jsxs("div", {
|
|
2994
|
-
className: "flex items-center
|
|
2995
|
-
children: [
|
|
2996
|
-
|
|
2997
|
-
|
|
2998
|
-
|
|
2999
|
-
|
|
3000
|
-
|
|
2995
|
+
className: "flex w-full items-center",
|
|
2996
|
+
children: [
|
|
2997
|
+
idx > 0 ? /* @__PURE__ */ jsx("div", {
|
|
2998
|
+
className: `h-0.5 flex-1 ${prevState === "completed" || prevState === "current" ? "bg-brand-blue/50" : "bg-slate-200"}`,
|
|
2999
|
+
"aria-hidden": "true"
|
|
3000
|
+
}) : /* @__PURE__ */ jsx("div", {
|
|
3001
|
+
className: "flex-1",
|
|
3002
|
+
"aria-hidden": "true"
|
|
3003
|
+
}),
|
|
3004
|
+
/* @__PURE__ */ jsx("div", {
|
|
3005
|
+
className: "shrink-0 z-10",
|
|
3006
|
+
children: /* @__PURE__ */ jsx(StepCircle, {
|
|
3007
|
+
state,
|
|
3008
|
+
number: idx + 1,
|
|
3009
|
+
icon: step.icon
|
|
3010
|
+
})
|
|
3011
|
+
}),
|
|
3012
|
+
!isLast ? /* @__PURE__ */ jsx("div", {
|
|
3013
|
+
className: `h-0.5 flex-1 ${state === "completed" ? "bg-brand-blue/50" : "bg-slate-200"}`,
|
|
3014
|
+
"aria-hidden": "true"
|
|
3015
|
+
}) : /* @__PURE__ */ jsx("div", {
|
|
3016
|
+
className: "flex-1",
|
|
3017
|
+
"aria-hidden": "true"
|
|
3001
3018
|
})
|
|
3002
|
-
|
|
3003
|
-
className: `h-0.5 flex-1 ${state === "completed" ? "bg-brand-blue/50" : "bg-slate-200"}`,
|
|
3004
|
-
"aria-hidden": "true"
|
|
3005
|
-
})]
|
|
3019
|
+
]
|
|
3006
3020
|
}), /* @__PURE__ */ jsxs("div", {
|
|
3007
|
-
className: "mt-2 flex flex-col items-center text-center
|
|
3008
|
-
style: { transform: isLast ? "translateX(calc(50% - 1.125rem))" : idx === 0 ? "translateX(calc(-50% + 1.125rem))" : void 0 },
|
|
3021
|
+
className: "mt-2 flex flex-col items-center text-center px-1",
|
|
3009
3022
|
children: [/* @__PURE__ */ jsx("p", {
|
|
3010
3023
|
className: `text-sm leading-tight ${labelColor[state]}`,
|
|
3011
3024
|
children: step.label
|
|
@@ -3287,20 +3300,22 @@ function Menu({ trigger, items, ariaLabel = "Menu", align = "right" }) {
|
|
|
3287
3300
|
focusItem(items.length - 1);
|
|
3288
3301
|
}
|
|
3289
3302
|
};
|
|
3303
|
+
const panelAlign = align === "left" ? "left-0" : "right-0";
|
|
3290
3304
|
return /* @__PURE__ */ jsxs("div", {
|
|
3291
3305
|
className: "relative inline-block",
|
|
3292
3306
|
ref: containerRef,
|
|
3293
3307
|
children: [/* @__PURE__ */ jsx("div", {
|
|
3294
3308
|
ref: triggerRef,
|
|
3295
|
-
"aria-expanded": open,
|
|
3296
|
-
"aria-haspopup": "menu",
|
|
3297
3309
|
onClick: () => setOpen((v) => !v),
|
|
3298
3310
|
className: "cursor-pointer",
|
|
3299
|
-
children: trigger
|
|
3311
|
+
children: isValidElement(trigger) ? cloneElement(trigger, {
|
|
3312
|
+
"aria-expanded": open,
|
|
3313
|
+
"aria-haspopup": "menu"
|
|
3314
|
+
}) : trigger
|
|
3300
3315
|
}), open && /* @__PURE__ */ jsx("div", {
|
|
3301
3316
|
role: "menu",
|
|
3302
3317
|
"aria-label": ariaLabel,
|
|
3303
|
-
className: `absolute top-full ${
|
|
3318
|
+
className: `absolute top-full ${panelAlign} z-30 mt-1 min-w-[11rem] overflow-hidden rounded-xl border border-slate-200 bg-white py-1 shadow-xl`,
|
|
3304
3319
|
children: items.map((item, index) => /* @__PURE__ */ jsxs("button", {
|
|
3305
3320
|
ref: (node) => {
|
|
3306
3321
|
itemRefs.current[index] = node;
|
|
@@ -3704,6 +3719,7 @@ function TimelineValueCard({ beforeLabel = "Previous", afterLabel = "Current", b
|
|
|
3704
3719
|
})]
|
|
3705
3720
|
}), /* @__PURE__ */ jsx("div", {
|
|
3706
3721
|
className: "text-sm text-slate-500 leading-snug",
|
|
3722
|
+
role: "group",
|
|
3707
3723
|
"aria-label": `${beforeLabel} value`,
|
|
3708
3724
|
children: beforeContent
|
|
3709
3725
|
})]
|
|
@@ -3730,6 +3746,7 @@ function TimelineValueCard({ beforeLabel = "Previous", afterLabel = "Current", b
|
|
|
3730
3746
|
})]
|
|
3731
3747
|
}), /* @__PURE__ */ jsx("div", {
|
|
3732
3748
|
className: "text-sm font-semibold text-slate-800 leading-snug",
|
|
3749
|
+
role: "group",
|
|
3733
3750
|
"aria-label": `${afterLabel} value`,
|
|
3734
3751
|
children: afterContent
|
|
3735
3752
|
})]
|
|
@@ -3895,11 +3912,11 @@ function EmployeeCard({ name, role, avatarSrc, status, meta, actions, className
|
|
|
3895
3912
|
* onSelect={setSelected}
|
|
3896
3913
|
* />
|
|
3897
3914
|
*/
|
|
3898
|
-
function flattenVisible(items, expanded) {
|
|
3915
|
+
function flattenVisible$1(items, expanded) {
|
|
3899
3916
|
const result = [];
|
|
3900
3917
|
for (const item of items) {
|
|
3901
3918
|
result.push(item);
|
|
3902
|
-
if (item.children && expanded.has(item.id)) result.push(...flattenVisible(item.children, expanded));
|
|
3919
|
+
if (item.children && expanded.has(item.id)) result.push(...flattenVisible$1(item.children, expanded));
|
|
3903
3920
|
}
|
|
3904
3921
|
return result;
|
|
3905
3922
|
}
|
|
@@ -3989,7 +4006,7 @@ function TreeView({ items, selectedId, onSelect, "aria-label": ariaLabel, classN
|
|
|
3989
4006
|
onSelect?.(id);
|
|
3990
4007
|
}, [onSelect]);
|
|
3991
4008
|
const handleKeyDown = (e) => {
|
|
3992
|
-
const visible = flattenVisible(items, expanded);
|
|
4009
|
+
const visible = flattenVisible$1(items, expanded);
|
|
3993
4010
|
if (visible.length === 0) return;
|
|
3994
4011
|
const currentId = selectedId ?? visible[0]?.id;
|
|
3995
4012
|
const currentIdx = visible.findIndex((v) => v.id === currentId);
|
|
@@ -4338,67 +4355,154 @@ function Calendar({ value, defaultValue, onChange, minDate, maxDate, className =
|
|
|
4338
4355
|
}
|
|
4339
4356
|
//#endregion
|
|
4340
4357
|
//#region src/ui-library/gallery/charts/Charts.tsx
|
|
4341
|
-
|
|
4358
|
+
/**
|
|
4359
|
+
* Charts — Design System Components
|
|
4360
|
+
*
|
|
4361
|
+
* Lightweight SVG-native chart primitives. No charting library dependency.
|
|
4362
|
+
* Suitable for simple analytics/KPI displays.
|
|
4363
|
+
*
|
|
4364
|
+
* Components:
|
|
4365
|
+
* BarChart — vertical bar chart
|
|
4366
|
+
* LineChart — line/area chart (SVG path)
|
|
4367
|
+
* CHART_PALETTE — shared default color sequence for multi-series charts
|
|
4368
|
+
*
|
|
4369
|
+
* Visual language (applied as defaults, no new props):
|
|
4370
|
+
* - BarChart: top-only rounded corners, subtle same-hue gradient fill,
|
|
4371
|
+
* baseline rule, value labels inside SVG above bars, comfortable gaps
|
|
4372
|
+
* - LineChart: gradient area fill fading to transparent, strokeWidth 2,
|
|
4373
|
+
* white-ring dots only when ≤ 12 data points, no horizontal distortion
|
|
4374
|
+
*
|
|
4375
|
+
* Accessibility:
|
|
4376
|
+
* - role="img" on every SVG with aria-label describing the chart
|
|
4377
|
+
* - Each bar/point has aria-label with label and value
|
|
4378
|
+
* - Decorative elements are aria-hidden
|
|
4379
|
+
*/
|
|
4380
|
+
/**
|
|
4381
|
+
* Default color sequence for multi-series / per-item charts.
|
|
4382
|
+
* Built on the brand's blue-sky hue family with a single warm accent.
|
|
4383
|
+
* Import this directly when constructing per-item color arrays:
|
|
4384
|
+
*
|
|
4385
|
+
* import { CHART_PALETTE } from '@diwauhris/ui';
|
|
4386
|
+
* const data = items.map((item, i) => ({ ...item, color: CHART_PALETTE[i % CHART_PALETTE.length] }));
|
|
4387
|
+
*/
|
|
4388
|
+
var CHART_PALETTE = [
|
|
4389
|
+
"#034EA2",
|
|
4390
|
+
"#2D8ACA",
|
|
4391
|
+
"#4F6FBF",
|
|
4392
|
+
"#0E7490",
|
|
4393
|
+
"#B45309"
|
|
4394
|
+
];
|
|
4395
|
+
function BarChart({ data, height = 160, barColor = "#034EA2", "aria-label": ariaLabel, className = "" }) {
|
|
4396
|
+
const uid = useId().replace(/:/g, "");
|
|
4342
4397
|
const max = Math.max(...data.map((d) => d.value), 1);
|
|
4343
|
-
const
|
|
4344
|
-
const
|
|
4398
|
+
const n = data.length;
|
|
4399
|
+
const W = Math.max(n * 50, 200);
|
|
4400
|
+
const w = W / n;
|
|
4401
|
+
const gap = w * .2;
|
|
4345
4402
|
const bw = w - gap * 2;
|
|
4346
|
-
|
|
4347
|
-
|
|
4348
|
-
|
|
4403
|
+
const bottomPad = 24;
|
|
4404
|
+
const labelGap = 4;
|
|
4405
|
+
const chartH = height - bottomPad;
|
|
4406
|
+
const baselineY = chartH;
|
|
4407
|
+
const isDefaultBarColor = barColor === "#034EA2";
|
|
4408
|
+
const fillColors = data.map((d, i) => d.color ?? (isDefaultBarColor ? CHART_PALETTE[i % CHART_PALETTE.length] ?? barColor : barColor));
|
|
4409
|
+
const distinctColors = Array.from(new Set(fillColors));
|
|
4410
|
+
return /* @__PURE__ */ jsx("div", {
|
|
4411
|
+
className,
|
|
4412
|
+
children: /* @__PURE__ */ jsxs("svg", {
|
|
4349
4413
|
role: "img",
|
|
4350
4414
|
"aria-label": ariaLabel,
|
|
4351
|
-
viewBox: `0 0
|
|
4415
|
+
viewBox: `0 0 ${W} ${height}`,
|
|
4352
4416
|
preserveAspectRatio: "none",
|
|
4353
4417
|
className: "w-full",
|
|
4354
4418
|
style: { height },
|
|
4355
|
-
children: [
|
|
4356
|
-
|
|
4357
|
-
|
|
4358
|
-
|
|
4359
|
-
|
|
4360
|
-
"
|
|
4361
|
-
|
|
4362
|
-
|
|
4363
|
-
|
|
4364
|
-
|
|
4365
|
-
|
|
4366
|
-
|
|
4367
|
-
|
|
4368
|
-
|
|
4369
|
-
|
|
4370
|
-
|
|
4371
|
-
|
|
4372
|
-
|
|
4373
|
-
|
|
4374
|
-
|
|
4375
|
-
|
|
4376
|
-
|
|
4377
|
-
|
|
4378
|
-
|
|
4379
|
-
|
|
4380
|
-
|
|
4381
|
-
|
|
4382
|
-
|
|
4383
|
-
|
|
4384
|
-
|
|
4385
|
-
|
|
4386
|
-
|
|
4387
|
-
|
|
4388
|
-
|
|
4389
|
-
|
|
4390
|
-
|
|
4419
|
+
children: [
|
|
4420
|
+
/* @__PURE__ */ jsx("defs", { children: distinctColors.map((color) => /* @__PURE__ */ jsxs("linearGradient", {
|
|
4421
|
+
id: `${uid}-bg-${color.replace("#", "")}`,
|
|
4422
|
+
x1: "0",
|
|
4423
|
+
y1: "0",
|
|
4424
|
+
x2: "0",
|
|
4425
|
+
y2: height - bottomPad,
|
|
4426
|
+
gradientUnits: "userSpaceOnUse",
|
|
4427
|
+
children: [/* @__PURE__ */ jsx("stop", {
|
|
4428
|
+
offset: "0%",
|
|
4429
|
+
stopColor: color,
|
|
4430
|
+
stopOpacity: 1
|
|
4431
|
+
}), /* @__PURE__ */ jsx("stop", {
|
|
4432
|
+
offset: "100%",
|
|
4433
|
+
stopColor: color,
|
|
4434
|
+
stopOpacity: .7
|
|
4435
|
+
})]
|
|
4436
|
+
}, color)) }),
|
|
4437
|
+
/* @__PURE__ */ jsx("line", {
|
|
4438
|
+
x1: 0,
|
|
4439
|
+
y1: baselineY,
|
|
4440
|
+
x2: W,
|
|
4441
|
+
y2: baselineY,
|
|
4442
|
+
stroke: "#e2e8f0",
|
|
4443
|
+
strokeWidth: .5,
|
|
4444
|
+
"aria-hidden": "true"
|
|
4445
|
+
}),
|
|
4446
|
+
data.map((d, i) => {
|
|
4447
|
+
const fillColor = fillColors[i];
|
|
4448
|
+
const gradId = `${uid}-bg-${fillColor.replace("#", "")}`;
|
|
4449
|
+
const barH = d.value / max * (chartH - 16);
|
|
4450
|
+
const x = i * w + gap;
|
|
4451
|
+
const barY = chartH - barH;
|
|
4452
|
+
const rx = Math.min(3, barH * .4);
|
|
4453
|
+
const barPath = barH < 1 ? "" : [
|
|
4454
|
+
`M ${x + rx},${barY}`,
|
|
4455
|
+
`Q ${x},${barY} ${x},${barY + rx}`,
|
|
4456
|
+
`L ${x},${barY + barH}`,
|
|
4457
|
+
`L ${x + bw},${barY + barH}`,
|
|
4458
|
+
`L ${x + bw},${barY + rx}`,
|
|
4459
|
+
`Q ${x + bw},${barY} ${x + bw - rx},${barY}`,
|
|
4460
|
+
"Z"
|
|
4461
|
+
].join(" ");
|
|
4462
|
+
return /* @__PURE__ */ jsxs("g", {
|
|
4463
|
+
"aria-label": `${d.label}: ${d.value}`,
|
|
4464
|
+
role: "img",
|
|
4465
|
+
children: [/* @__PURE__ */ jsx("path", {
|
|
4466
|
+
d: barPath,
|
|
4467
|
+
fill: `url(#${gradId})`
|
|
4468
|
+
}), /* @__PURE__ */ jsx("text", {
|
|
4469
|
+
x: x + bw / 2,
|
|
4470
|
+
y: barY - labelGap,
|
|
4471
|
+
textAnchor: "middle",
|
|
4472
|
+
fontSize: 7,
|
|
4473
|
+
fill: "#64748b",
|
|
4474
|
+
fontWeight: "600",
|
|
4475
|
+
fontFamily: "inherit",
|
|
4476
|
+
"aria-hidden": "true",
|
|
4477
|
+
children: d.value
|
|
4478
|
+
})]
|
|
4479
|
+
}, d.label);
|
|
4480
|
+
}),
|
|
4481
|
+
data.map((d, i) => /* @__PURE__ */ jsx("text", {
|
|
4482
|
+
x: i * w + w / 2,
|
|
4483
|
+
y: height - 4,
|
|
4484
|
+
textAnchor: "middle",
|
|
4485
|
+
fontSize: 7,
|
|
4486
|
+
fill: "#94a3b8",
|
|
4487
|
+
fontWeight: "600",
|
|
4488
|
+
fontFamily: "inherit",
|
|
4489
|
+
"aria-hidden": "true",
|
|
4490
|
+
children: d.label
|
|
4491
|
+
}, `lbl-${d.label}`))
|
|
4492
|
+
]
|
|
4493
|
+
})
|
|
4391
4494
|
});
|
|
4392
4495
|
}
|
|
4393
|
-
function LineChart({ data, height = 120, lineColor = "#
|
|
4496
|
+
function LineChart({ data, height = 120, lineColor = "#034EA2", filled = true, "aria-label": ariaLabel, className = "" }) {
|
|
4497
|
+
const uid = useId().replace(/:/g, "");
|
|
4394
4498
|
const max = Math.max(...data.map((d) => d.value), 1);
|
|
4395
4499
|
const n = data.length;
|
|
4396
4500
|
if (n < 2) return null;
|
|
4397
|
-
const
|
|
4398
|
-
const W = 100;
|
|
4501
|
+
const W = 300;
|
|
4399
4502
|
const H = height;
|
|
4400
|
-
const
|
|
4401
|
-
const
|
|
4503
|
+
const pad = Math.round(H * .07);
|
|
4504
|
+
const px = (i) => pad + i / (n - 1) * (W - pad * 2);
|
|
4505
|
+
const py = (v) => pad + (max - v) / max * (H - pad * 2);
|
|
4402
4506
|
const points = data.map((d, i) => ({
|
|
4403
4507
|
x: px(i),
|
|
4404
4508
|
y: py(d.value),
|
|
@@ -4407,38 +4511,314 @@ function LineChart({ data, height = 120, lineColor = "#6366f1", filled = true, "
|
|
|
4407
4511
|
}));
|
|
4408
4512
|
const linePath = points.map((p, i) => `${i === 0 ? "M" : "L"}${p.x},${p.y}`).join(" ");
|
|
4409
4513
|
const areaPath = `${linePath} L${points[n - 1].x},${H - pad} L${points[0].x},${H - pad} Z`;
|
|
4514
|
+
const showDots = n <= 12;
|
|
4410
4515
|
return /* @__PURE__ */ jsxs("svg", {
|
|
4411
4516
|
role: "img",
|
|
4412
4517
|
"aria-label": ariaLabel,
|
|
4413
4518
|
viewBox: `0 0 ${W} ${H}`,
|
|
4414
|
-
preserveAspectRatio: "none",
|
|
4415
4519
|
className: `w-full ${className}`,
|
|
4416
4520
|
style: { height },
|
|
4417
4521
|
children: [
|
|
4522
|
+
/* @__PURE__ */ jsx("defs", { children: filled && /* @__PURE__ */ jsxs("linearGradient", {
|
|
4523
|
+
id: `${uid}-lc-fill`,
|
|
4524
|
+
x1: "0",
|
|
4525
|
+
y1: "0",
|
|
4526
|
+
x2: "0",
|
|
4527
|
+
y2: "1",
|
|
4528
|
+
children: [/* @__PURE__ */ jsx("stop", {
|
|
4529
|
+
offset: "0%",
|
|
4530
|
+
stopColor: lineColor,
|
|
4531
|
+
stopOpacity: .2
|
|
4532
|
+
}), /* @__PURE__ */ jsx("stop", {
|
|
4533
|
+
offset: "100%",
|
|
4534
|
+
stopColor: lineColor,
|
|
4535
|
+
stopOpacity: 0
|
|
4536
|
+
})]
|
|
4537
|
+
}) }),
|
|
4418
4538
|
filled && /* @__PURE__ */ jsx("path", {
|
|
4419
4539
|
d: areaPath,
|
|
4420
|
-
fill:
|
|
4421
|
-
|
|
4540
|
+
fill: `url(#${uid}-lc-fill)`,
|
|
4541
|
+
"aria-hidden": "true"
|
|
4422
4542
|
}),
|
|
4423
4543
|
/* @__PURE__ */ jsx("path", {
|
|
4424
4544
|
d: linePath,
|
|
4425
4545
|
fill: "none",
|
|
4426
4546
|
stroke: lineColor,
|
|
4427
|
-
strokeWidth:
|
|
4547
|
+
strokeWidth: 2,
|
|
4428
4548
|
strokeLinejoin: "round",
|
|
4429
|
-
strokeLinecap: "round"
|
|
4549
|
+
strokeLinecap: "round",
|
|
4550
|
+
"aria-hidden": "true"
|
|
4430
4551
|
}),
|
|
4431
|
-
points.map((p) => /* @__PURE__ */ jsx("circle", {
|
|
4552
|
+
showDots && points.map((p) => /* @__PURE__ */ jsx("circle", {
|
|
4432
4553
|
cx: p.x,
|
|
4433
4554
|
cy: p.y,
|
|
4434
|
-
r: 2,
|
|
4555
|
+
r: 2.5,
|
|
4435
4556
|
fill: lineColor,
|
|
4557
|
+
stroke: "white",
|
|
4558
|
+
strokeWidth: 1.5,
|
|
4559
|
+
role: "img",
|
|
4436
4560
|
"aria-label": `${p.label}: ${p.value}`
|
|
4437
4561
|
}, p.label))
|
|
4438
4562
|
]
|
|
4439
4563
|
});
|
|
4440
4564
|
}
|
|
4441
4565
|
//#endregion
|
|
4566
|
+
//#region src/ui-library/gallery/charts/AreaChart.tsx
|
|
4567
|
+
/**
|
|
4568
|
+
* AreaChart — Design System Component
|
|
4569
|
+
*
|
|
4570
|
+
* SVG area/line chart with gradient fill, explicit Y-axis ticks, optional
|
|
4571
|
+
* threshold line, point annotations, highlight regions, and multi-series support.
|
|
4572
|
+
* No external charting library — native SVG only.
|
|
4573
|
+
*
|
|
4574
|
+
* Gradient IDs are scoped per instance via useId() to avoid SVG ID collisions
|
|
4575
|
+
* when multiple charts appear on the same page.
|
|
4576
|
+
*
|
|
4577
|
+
* Usage:
|
|
4578
|
+
* <AreaChart
|
|
4579
|
+
* data={monthlyData}
|
|
4580
|
+
* series={{ dataKey: 'value', color: '#6366f1', fillOpacity: { top: 0.22, bottom: 0.01 } }}
|
|
4581
|
+
* yTicks={[0, 25, 50, 75, 100]}
|
|
4582
|
+
* yTickFormat={(v) => `${v}%`}
|
|
4583
|
+
* annotations={[{ dataIndex: 5, label: 'Peak', radius: 5, color: '#ef4444' }]}
|
|
4584
|
+
* height={170}
|
|
4585
|
+
* />
|
|
4586
|
+
*
|
|
4587
|
+
* Accessibility:
|
|
4588
|
+
* - role="img" on the SVG with aria-label
|
|
4589
|
+
* - Each dot has aria-label with label and value
|
|
4590
|
+
* - Decorative elements are aria-hidden
|
|
4591
|
+
*/
|
|
4592
|
+
function resolveOpacity(op) {
|
|
4593
|
+
if (op === void 0) return {
|
|
4594
|
+
top: .15,
|
|
4595
|
+
bottom: 0
|
|
4596
|
+
};
|
|
4597
|
+
if (typeof op === "number") return {
|
|
4598
|
+
top: op,
|
|
4599
|
+
bottom: op
|
|
4600
|
+
};
|
|
4601
|
+
return op;
|
|
4602
|
+
}
|
|
4603
|
+
function AreaChart({ data, series, yTicks, yTickFormat, showDots = true, threshold, annotations = [], highlightRegion, height = 170, "aria-label": ariaLabel = "Area chart", className = "" }) {
|
|
4604
|
+
const uid = useId().replace(/:/g, "");
|
|
4605
|
+
const seriesArr = Array.isArray(series) ? series : [series];
|
|
4606
|
+
const primary = seriesArr[0];
|
|
4607
|
+
const W = 560;
|
|
4608
|
+
const pl = 52;
|
|
4609
|
+
const pt = 14;
|
|
4610
|
+
const pb = 30;
|
|
4611
|
+
const cW = 492;
|
|
4612
|
+
const cH = height - pt - pb;
|
|
4613
|
+
const n = data.length;
|
|
4614
|
+
const yTicksSafe = yTicks && yTicks.length > 0 ? yTicks : void 0;
|
|
4615
|
+
const minY = yTicksSafe ? Math.min(...yTicksSafe) : 0;
|
|
4616
|
+
const maxY = yTicksSafe ? Math.max(...yTicksSafe) : Math.max(...seriesArr.flatMap((s) => data.map((d) => Number(d[s.dataKey] ?? 0))), 1);
|
|
4617
|
+
const cx = (i) => pl + i / Math.max(n - 1, 1) * cW;
|
|
4618
|
+
const cy = (v) => pt + (1 - (v - minY) / (maxY - minY)) * cH;
|
|
4619
|
+
const paths = seriesArr.map((s) => {
|
|
4620
|
+
const vals = data.map((d) => Number(d[s.dataKey] ?? 0));
|
|
4621
|
+
const line = "M" + vals.map((v, i) => `${cx(i)},${cy(v)}`).join("L");
|
|
4622
|
+
return {
|
|
4623
|
+
line,
|
|
4624
|
+
area: `${line}L${cx(n - 1)},${height - pb}L${cx(0)},${height - pb}Z`,
|
|
4625
|
+
vals
|
|
4626
|
+
};
|
|
4627
|
+
});
|
|
4628
|
+
const annotatedIdx = new Set(annotations.map((a) => a.dataIndex));
|
|
4629
|
+
return /* @__PURE__ */ jsxs("svg", {
|
|
4630
|
+
role: "img",
|
|
4631
|
+
"aria-label": ariaLabel,
|
|
4632
|
+
viewBox: `0 0 ${W} ${height}`,
|
|
4633
|
+
className: `w-full ${className}`,
|
|
4634
|
+
style: { height },
|
|
4635
|
+
children: [
|
|
4636
|
+
/* @__PURE__ */ jsx("defs", { children: seriesArr.map((s, si) => {
|
|
4637
|
+
const op = resolveOpacity(s.fillOpacity);
|
|
4638
|
+
return /* @__PURE__ */ jsxs("linearGradient", {
|
|
4639
|
+
id: `${uid}-g${si}`,
|
|
4640
|
+
x1: "0",
|
|
4641
|
+
y1: "0",
|
|
4642
|
+
x2: "0",
|
|
4643
|
+
y2: "1",
|
|
4644
|
+
children: [/* @__PURE__ */ jsx("stop", {
|
|
4645
|
+
offset: "0%",
|
|
4646
|
+
stopColor: s.color,
|
|
4647
|
+
stopOpacity: op.top
|
|
4648
|
+
}), /* @__PURE__ */ jsx("stop", {
|
|
4649
|
+
offset: "100%",
|
|
4650
|
+
stopColor: s.color,
|
|
4651
|
+
stopOpacity: op.bottom
|
|
4652
|
+
})]
|
|
4653
|
+
}, si);
|
|
4654
|
+
}) }),
|
|
4655
|
+
highlightRegion && /* @__PURE__ */ jsxs("g", {
|
|
4656
|
+
"aria-hidden": "true",
|
|
4657
|
+
children: [/* @__PURE__ */ jsx("rect", {
|
|
4658
|
+
x: cx(highlightRegion.startIndex),
|
|
4659
|
+
y: pt,
|
|
4660
|
+
width: cx(highlightRegion.endIndex) - cx(highlightRegion.startIndex),
|
|
4661
|
+
height: cH,
|
|
4662
|
+
fill: highlightRegion.color ?? "#eef0ff",
|
|
4663
|
+
rx: 3,
|
|
4664
|
+
opacity: .7
|
|
4665
|
+
}), highlightRegion.label && /* @__PURE__ */ jsx("text", {
|
|
4666
|
+
x: (cx(highlightRegion.startIndex) + cx(highlightRegion.endIndex)) / 2,
|
|
4667
|
+
y: 23,
|
|
4668
|
+
textAnchor: "middle",
|
|
4669
|
+
fontSize: 7.5,
|
|
4670
|
+
fill: "#a5b4fc",
|
|
4671
|
+
children: highlightRegion.label
|
|
4672
|
+
})]
|
|
4673
|
+
}),
|
|
4674
|
+
yTicks?.map((v) => /* @__PURE__ */ jsxs("g", {
|
|
4675
|
+
"aria-hidden": "true",
|
|
4676
|
+
children: [/* @__PURE__ */ jsx("line", {
|
|
4677
|
+
x1: pl,
|
|
4678
|
+
y1: cy(v),
|
|
4679
|
+
x2: 544,
|
|
4680
|
+
y2: cy(v),
|
|
4681
|
+
stroke: "#f1f5f9",
|
|
4682
|
+
strokeWidth: 1
|
|
4683
|
+
}), /* @__PURE__ */ jsx("text", {
|
|
4684
|
+
x: 46,
|
|
4685
|
+
y: cy(v) + 4,
|
|
4686
|
+
textAnchor: "end",
|
|
4687
|
+
fontSize: 9,
|
|
4688
|
+
fill: "#94a3b8",
|
|
4689
|
+
children: yTickFormat ? yTickFormat(v) : String(v)
|
|
4690
|
+
})]
|
|
4691
|
+
}, v)),
|
|
4692
|
+
threshold && /* @__PURE__ */ jsx("line", {
|
|
4693
|
+
x1: pl,
|
|
4694
|
+
y1: cy(threshold.value),
|
|
4695
|
+
x2: 544,
|
|
4696
|
+
y2: cy(threshold.value),
|
|
4697
|
+
stroke: threshold.color ?? "#f59e0b",
|
|
4698
|
+
strokeWidth: 1,
|
|
4699
|
+
strokeDasharray: threshold.strokeStyle === "solid" ? void 0 : "4,2",
|
|
4700
|
+
"aria-hidden": "true"
|
|
4701
|
+
}),
|
|
4702
|
+
seriesArr.map((s, si) => {
|
|
4703
|
+
const op = resolveOpacity(s.fillOpacity);
|
|
4704
|
+
if (op.top === 0 && op.bottom === 0) return null;
|
|
4705
|
+
return /* @__PURE__ */ jsx("path", {
|
|
4706
|
+
d: paths[si].area,
|
|
4707
|
+
fill: `url(#${uid}-g${si})`,
|
|
4708
|
+
"aria-hidden": "true"
|
|
4709
|
+
}, `area-${si}`);
|
|
4710
|
+
}),
|
|
4711
|
+
seriesArr.map((s, si) => /* @__PURE__ */ jsx("path", {
|
|
4712
|
+
d: paths[si].line,
|
|
4713
|
+
fill: "none",
|
|
4714
|
+
stroke: s.color,
|
|
4715
|
+
strokeWidth: si === 0 ? 2.5 : 1.5,
|
|
4716
|
+
strokeLinecap: "round",
|
|
4717
|
+
strokeLinejoin: "round",
|
|
4718
|
+
strokeDasharray: s.strokeStyle === "dashed" ? "4,2" : void 0,
|
|
4719
|
+
"aria-hidden": "true"
|
|
4720
|
+
}, `line-${si}`)),
|
|
4721
|
+
showDots && paths[0].vals.map((v, i) => {
|
|
4722
|
+
if (annotatedIdx.has(i)) return null;
|
|
4723
|
+
return /* @__PURE__ */ jsx("circle", {
|
|
4724
|
+
cx: cx(i),
|
|
4725
|
+
cy: cy(v),
|
|
4726
|
+
r: 3.5,
|
|
4727
|
+
fill: primary.color,
|
|
4728
|
+
stroke: "white",
|
|
4729
|
+
strokeWidth: 2,
|
|
4730
|
+
"aria-label": `${data[i].label}: ${v}`
|
|
4731
|
+
}, `dot-${i}`);
|
|
4732
|
+
}),
|
|
4733
|
+
data.map((d, i) => /* @__PURE__ */ jsx("text", {
|
|
4734
|
+
x: cx(i),
|
|
4735
|
+
y: height - 4,
|
|
4736
|
+
textAnchor: "middle",
|
|
4737
|
+
fontSize: 9,
|
|
4738
|
+
fill: "#94a3b8",
|
|
4739
|
+
"aria-hidden": "true",
|
|
4740
|
+
children: d.label
|
|
4741
|
+
}, `x-${i}`)),
|
|
4742
|
+
annotations.map((ann) => {
|
|
4743
|
+
const v = Number(data[ann.dataIndex]?.[primary.dataKey] ?? 0);
|
|
4744
|
+
const x = cx(ann.dataIndex);
|
|
4745
|
+
const y = cy(v);
|
|
4746
|
+
const r = ann.radius ?? 4;
|
|
4747
|
+
const col = ann.color ?? primary.color;
|
|
4748
|
+
const ly = ann.labelPosition === "below" ? y + r + 10 : Math.max(22, y - r - 5);
|
|
4749
|
+
return /* @__PURE__ */ jsxs("g", {
|
|
4750
|
+
"aria-label": `${data[ann.dataIndex].label}: ${ann.label}`,
|
|
4751
|
+
children: [/* @__PURE__ */ jsx("circle", {
|
|
4752
|
+
cx: x,
|
|
4753
|
+
cy: y,
|
|
4754
|
+
r,
|
|
4755
|
+
fill: col,
|
|
4756
|
+
stroke: "white",
|
|
4757
|
+
strokeWidth: 2
|
|
4758
|
+
}), /* @__PURE__ */ jsx("text", {
|
|
4759
|
+
x,
|
|
4760
|
+
y: ly,
|
|
4761
|
+
textAnchor: "middle",
|
|
4762
|
+
fontSize: 8,
|
|
4763
|
+
fill: col,
|
|
4764
|
+
fontWeight: "bold",
|
|
4765
|
+
children: ann.label
|
|
4766
|
+
})]
|
|
4767
|
+
}, `ann-${ann.dataIndex}`);
|
|
4768
|
+
})
|
|
4769
|
+
]
|
|
4770
|
+
});
|
|
4771
|
+
}
|
|
4772
|
+
//#endregion
|
|
4773
|
+
//#region src/ui-library/gallery/charts/BarList.tsx
|
|
4774
|
+
function BarList({ items, valueFormat, totalLabel, barHeight = "h-2", staggerDelay = 70, className = "" }) {
|
|
4775
|
+
const maxValue = Math.max(...items.map((item) => item.value), 1);
|
|
4776
|
+
const total = items.reduce((sum, item) => sum + item.value, 0);
|
|
4777
|
+
const fmt = valueFormat ?? ((v) => String(v));
|
|
4778
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
4779
|
+
role: "list",
|
|
4780
|
+
"aria-label": "Bar list",
|
|
4781
|
+
className: `space-y-3 pt-1 ${className}`,
|
|
4782
|
+
children: [items.map((item, i) => {
|
|
4783
|
+
const pct = item.value / maxValue * 100;
|
|
4784
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
4785
|
+
role: "listitem",
|
|
4786
|
+
"aria-label": `${item.label}: ${fmt(item.value)}`,
|
|
4787
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
4788
|
+
className: "flex justify-between items-baseline mb-1",
|
|
4789
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
4790
|
+
className: "text-xs font-bold text-slate-700",
|
|
4791
|
+
children: item.label
|
|
4792
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
4793
|
+
className: "text-xs text-slate-400 font-medium",
|
|
4794
|
+
children: fmt(item.value)
|
|
4795
|
+
})]
|
|
4796
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
4797
|
+
className: `${barHeight} w-full bg-slate-100/60 rounded-full overflow-hidden`,
|
|
4798
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
4799
|
+
className: `${barHeight} rounded-full os-bar-in`,
|
|
4800
|
+
style: {
|
|
4801
|
+
width: `${pct}%`,
|
|
4802
|
+
backgroundColor: item.color,
|
|
4803
|
+
animationDelay: `${i * staggerDelay}ms`
|
|
4804
|
+
},
|
|
4805
|
+
"aria-hidden": "true"
|
|
4806
|
+
})
|
|
4807
|
+
})]
|
|
4808
|
+
}, item.label);
|
|
4809
|
+
}), totalLabel !== void 0 && /* @__PURE__ */ jsxs("div", {
|
|
4810
|
+
className: "pt-2 border-t border-slate-50 flex justify-between items-center",
|
|
4811
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
4812
|
+
className: "text-[10px] font-bold text-slate-400 uppercase tracking-widest",
|
|
4813
|
+
children: totalLabel
|
|
4814
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
4815
|
+
className: "text-sm font-bold text-slate-700",
|
|
4816
|
+
children: total
|
|
4817
|
+
})]
|
|
4818
|
+
})]
|
|
4819
|
+
});
|
|
4820
|
+
}
|
|
4821
|
+
//#endregion
|
|
4442
4822
|
//#region src/ui-library/gallery/heatmap/Heatmap.tsx
|
|
4443
4823
|
/**
|
|
4444
4824
|
* Heatmap — Design System Component
|
|
@@ -4457,31 +4837,31 @@ function LineChart({ data, height = 120, lineColor = "#6366f1", filled = true, "
|
|
|
4457
4837
|
var SCALES = {
|
|
4458
4838
|
blue: { cells: [
|
|
4459
4839
|
"bg-slate-100",
|
|
4460
|
-
"bg-
|
|
4461
|
-
"bg-
|
|
4462
|
-
"bg-
|
|
4463
|
-
"bg-
|
|
4840
|
+
"bg-sky-200",
|
|
4841
|
+
"bg-sky-400",
|
|
4842
|
+
"bg-blue-600",
|
|
4843
|
+
"bg-[#00377B]"
|
|
4464
4844
|
] },
|
|
4465
4845
|
navy: { cells: [
|
|
4466
4846
|
"bg-slate-100",
|
|
4467
|
-
"bg-
|
|
4468
|
-
"bg-
|
|
4469
|
-
"bg-
|
|
4470
|
-
"bg-
|
|
4847
|
+
"bg-slate-300",
|
|
4848
|
+
"bg-slate-500",
|
|
4849
|
+
"bg-slate-700",
|
|
4850
|
+
"bg-slate-900"
|
|
4471
4851
|
] },
|
|
4472
4852
|
teal: { cells: [
|
|
4473
4853
|
"bg-slate-100",
|
|
4474
|
-
"bg-cyan-
|
|
4475
|
-
"bg-cyan-
|
|
4476
|
-
"bg-cyan-
|
|
4477
|
-
"bg-cyan-
|
|
4854
|
+
"bg-cyan-200",
|
|
4855
|
+
"bg-cyan-400",
|
|
4856
|
+
"bg-cyan-600",
|
|
4857
|
+
"bg-cyan-800"
|
|
4478
4858
|
] },
|
|
4479
4859
|
orange: { cells: [
|
|
4480
4860
|
"bg-slate-100",
|
|
4481
|
-
"bg-orange-
|
|
4482
|
-
"bg-orange-300",
|
|
4861
|
+
"bg-orange-200",
|
|
4483
4862
|
"bg-orange-400",
|
|
4484
|
-
"bg-orange-
|
|
4863
|
+
"bg-orange-500",
|
|
4864
|
+
"bg-orange-700"
|
|
4485
4865
|
] }
|
|
4486
4866
|
};
|
|
4487
4867
|
var MONTHS = [
|
|
@@ -4622,6 +5002,2250 @@ function Heatmap({ data, scale = "blue", showLegend = true, showMonthLabels = tr
|
|
|
4622
5002
|
});
|
|
4623
5003
|
}
|
|
4624
5004
|
//#endregion
|
|
5005
|
+
//#region src/ui-library/gallery/org-chart/OrgChart.tsx
|
|
5006
|
+
/**
|
|
5007
|
+
* OrgChart — Design System Component
|
|
5008
|
+
*
|
|
5009
|
+
* A D3-powered SVG organization chart matching the UHRIS Company Structure
|
|
5010
|
+
* diagram mode. Renders a top-down tree with rectangular nodes and
|
|
5011
|
+
* stepped orthogonal connectors.
|
|
5012
|
+
*
|
|
5013
|
+
* Technology: D3 v7 (d3.hierarchy + d3.tree layout + d3.zoom)
|
|
5014
|
+
* Already a production dependency — no new packages introduced.
|
|
5015
|
+
*
|
|
5016
|
+
* Visual design (sourced from CompanyStructurePage diagram mode):
|
|
5017
|
+
* Nodes:
|
|
5018
|
+
* - 250 × 84 px rounded rectangles (rx=14)
|
|
5019
|
+
* - Root (depth 0): dark navy fill (#0f172a), white text
|
|
5020
|
+
* - Children: white fill (#fff), slate border (#e2e8f0)
|
|
5021
|
+
* - drop-shadow: 0 6px 12px rgba(15,23,42,0.08)
|
|
5022
|
+
* - Name: 13px, font-weight 800, centered
|
|
5023
|
+
* - Description: 11px, font-weight 600, #64748b / #cbd5e1 (root)
|
|
5024
|
+
* - Selected: indigo border overlay ring
|
|
5025
|
+
* Connectors:
|
|
5026
|
+
* - Stepped orthogonal path: M→V→H→V
|
|
5027
|
+
* - Stroke: #cbd5e1, stroke-width 1.5
|
|
5028
|
+
* Canvas:
|
|
5029
|
+
* - Viewport sized to container; fit-to-view on render
|
|
5030
|
+
* - Zoom: scaleExtent [0.05, 1.8]
|
|
5031
|
+
* - Pan: mouse/touch drag
|
|
5032
|
+
* - Layout: nodeSize [280, 185] — horizontal × vertical spacing
|
|
5033
|
+
* Controls:
|
|
5034
|
+
* - ZoomIn, Reset, ZoomOut buttons (top-right overlay panel)
|
|
5035
|
+
*
|
|
5036
|
+
* Accessibility:
|
|
5037
|
+
* - SVG has role="img" + aria-label
|
|
5038
|
+
* - Zoom controls have aria-label
|
|
5039
|
+
* - Keyboard: Tab to control buttons; diagram itself is navigated visually
|
|
5040
|
+
* - Note: full ARIA tree semantics are not possible in an SVG diagram;
|
|
5041
|
+
* use OrgUnitTree for a fully keyboard-accessible list-based alternative
|
|
5042
|
+
*
|
|
5043
|
+
* Usage:
|
|
5044
|
+
* <OrgChart
|
|
5045
|
+
* nodes={orgNodes}
|
|
5046
|
+
* selectedId={selectedId}
|
|
5047
|
+
* onSelect={setSelectedId}
|
|
5048
|
+
* aria-label="Company organization chart"
|
|
5049
|
+
* />
|
|
5050
|
+
*/
|
|
5051
|
+
function buildD3Tree(nodes) {
|
|
5052
|
+
function convert(node, depth) {
|
|
5053
|
+
return {
|
|
5054
|
+
id: node.id,
|
|
5055
|
+
name: node.label,
|
|
5056
|
+
description: node.description ?? "",
|
|
5057
|
+
isRoot: depth === 0,
|
|
5058
|
+
isSyntheticRoot: false,
|
|
5059
|
+
originalId: node.id,
|
|
5060
|
+
children: node.children?.map((c) => convert(c, depth + 1))
|
|
5061
|
+
};
|
|
5062
|
+
}
|
|
5063
|
+
if (nodes.length === 1) return convert(nodes[0], 0);
|
|
5064
|
+
return {
|
|
5065
|
+
id: "__synthetic_root__",
|
|
5066
|
+
name: "",
|
|
5067
|
+
description: "",
|
|
5068
|
+
isRoot: true,
|
|
5069
|
+
isSyntheticRoot: true,
|
|
5070
|
+
originalId: "__synthetic_root__",
|
|
5071
|
+
children: nodes.map((n) => convert(n, 0))
|
|
5072
|
+
};
|
|
5073
|
+
}
|
|
5074
|
+
function OrgChart({ nodes, selectedId, onSelect, height = "75vh", "aria-label": ariaLabel = "Organization chart", className = "" }) {
|
|
5075
|
+
const svgRef = useRef(null);
|
|
5076
|
+
const zoomRef = useRef(null);
|
|
5077
|
+
const initialTransformRef = useRef(null);
|
|
5078
|
+
const treeBoundsRef = useRef(null);
|
|
5079
|
+
const uid = useId().replace(/:/g, "");
|
|
5080
|
+
const fitToView = () => {
|
|
5081
|
+
if (!svgRef.current || !zoomRef.current || !treeBoundsRef.current) return;
|
|
5082
|
+
const { width: W, height: H } = svgRef.current.getBoundingClientRect();
|
|
5083
|
+
if (W === 0 || H === 0) return;
|
|
5084
|
+
const { minX, maxX, minY, maxY } = treeBoundsRef.current;
|
|
5085
|
+
const contentLeft = minX - 125;
|
|
5086
|
+
const contentRight = maxX + 125;
|
|
5087
|
+
const contentTop = minY - 42;
|
|
5088
|
+
const contentBottom = maxY + 42;
|
|
5089
|
+
const contentWidth = contentRight - contentLeft;
|
|
5090
|
+
const contentHeight = contentBottom - contentTop;
|
|
5091
|
+
const scaleX = (W - 80) / Math.max(1, contentWidth);
|
|
5092
|
+
const scaleY = (H - 80) / Math.max(1, contentHeight);
|
|
5093
|
+
const scale = Math.max(.05, Math.min(1.8, scaleX, scaleY));
|
|
5094
|
+
const contentCenterX = (contentLeft + contentRight) / 2;
|
|
5095
|
+
const contentCenterY = (contentTop + contentBottom) / 2;
|
|
5096
|
+
const tx = W / 2 - contentCenterX * scale;
|
|
5097
|
+
const ty = H / 2 - contentCenterY * scale;
|
|
5098
|
+
const t = d3.zoomIdentity.translate(tx, ty).scale(scale);
|
|
5099
|
+
initialTransformRef.current = t;
|
|
5100
|
+
d3.select(svgRef.current).call(zoomRef.current.transform, t);
|
|
5101
|
+
};
|
|
5102
|
+
useEffect(() => {
|
|
5103
|
+
if (!svgRef.current || nodes.length === 0) return;
|
|
5104
|
+
const svg = d3.select(svgRef.current);
|
|
5105
|
+
svg.selectAll("*").remove();
|
|
5106
|
+
const treeData = buildD3Tree(nodes);
|
|
5107
|
+
const root = d3.hierarchy(treeData);
|
|
5108
|
+
d3.tree().nodeSize([280, 185])(root);
|
|
5109
|
+
const descendants = root.descendants();
|
|
5110
|
+
treeBoundsRef.current = {
|
|
5111
|
+
minX: d3.min(descendants, (d) => d.x) ?? 0,
|
|
5112
|
+
maxX: d3.max(descendants, (d) => d.x) ?? 0,
|
|
5113
|
+
minY: d3.min(descendants, (d) => d.y) ?? 0,
|
|
5114
|
+
maxY: d3.max(descendants, (d) => d.y) ?? 0
|
|
5115
|
+
};
|
|
5116
|
+
const g = svg.append("g");
|
|
5117
|
+
const zoom = d3.zoom().scaleExtent([.05, 1.8]).on("zoom", (e) => g.attr("transform", e.transform.toString()));
|
|
5118
|
+
zoomRef.current = zoom;
|
|
5119
|
+
svg.call(zoom);
|
|
5120
|
+
g.selectAll("path").data(root.links().filter((l) => !l.source.data.isSyntheticRoot)).join("path").attr("fill", "none").attr("stroke", "#cbd5e1").attr("stroke-width", 1.5).attr("d", (link) => {
|
|
5121
|
+
const sx = link.source.x ?? 0;
|
|
5122
|
+
const sy = link.source.y ?? 0;
|
|
5123
|
+
const tx = link.target.x ?? 0;
|
|
5124
|
+
const ty = link.target.y ?? 0;
|
|
5125
|
+
return `M${sx},${sy}V${(sy + ty) / 2}H${tx}V${ty}`;
|
|
5126
|
+
});
|
|
5127
|
+
const node = g.selectAll("g.node").data(root.descendants().filter((d) => !d.data.isSyntheticRoot)).join("g").attr("class", "node").attr("transform", (d) => `translate(${d.x},${d.y})`).style("cursor", (d) => d.data.originalId !== "__synthetic_root__" ? "pointer" : "default").on("click", (_e, d) => {
|
|
5128
|
+
if (d.data.isSyntheticRoot) return;
|
|
5129
|
+
onSelect?.(d.data.originalId);
|
|
5130
|
+
});
|
|
5131
|
+
node.append("rect").attr("x", -125).attr("y", -42).attr("width", 250).attr("height", 84).attr("rx", 14).attr("fill", (d) => d.data.isRoot ? "#0f172a" : "#fff").attr("stroke", (d) => {
|
|
5132
|
+
if (selectedId && d.data.originalId === selectedId) return "#6366f1";
|
|
5133
|
+
return d.data.isRoot ? "#0f172a" : "#e2e8f0";
|
|
5134
|
+
}).attr("stroke-width", (d) => selectedId && d.data.originalId === selectedId ? 2.5 : 1).attr("filter", "drop-shadow(0 6px 12px rgba(15,23,42,0.08))");
|
|
5135
|
+
node.append("text").attr("text-anchor", "middle").attr("y", -8).attr("font-size", 13).attr("font-weight", 800).attr("fill", (d) => d.data.isRoot ? "#fff" : "#0f172a").text((d) => d.data.name);
|
|
5136
|
+
node.append("text").attr("text-anchor", "middle").attr("y", 16).attr("font-size", 11).attr("font-weight", 600).attr("fill", (d) => d.data.isRoot ? "#cbd5e1" : "#64748b").text((d) => d.data.description);
|
|
5137
|
+
if (selectedId) node.filter((d) => d.data.originalId === selectedId).append("rect").attr("x", -128).attr("y", -45).attr("width", 256).attr("height", 90).attr("rx", 16).attr("fill", "none").attr("stroke", "#6366f1").attr("stroke-width", 2.5).attr("opacity", .6);
|
|
5138
|
+
requestAnimationFrame(() => {
|
|
5139
|
+
fitToView();
|
|
5140
|
+
});
|
|
5141
|
+
}, [
|
|
5142
|
+
nodes,
|
|
5143
|
+
selectedId,
|
|
5144
|
+
onSelect
|
|
5145
|
+
]);
|
|
5146
|
+
useEffect(() => {
|
|
5147
|
+
const el = svgRef.current;
|
|
5148
|
+
if (!el) return;
|
|
5149
|
+
const ro = new ResizeObserver(() => {
|
|
5150
|
+
fitToView();
|
|
5151
|
+
});
|
|
5152
|
+
ro.observe(el);
|
|
5153
|
+
return () => ro.disconnect();
|
|
5154
|
+
}, []);
|
|
5155
|
+
const zoomBy = (factor) => {
|
|
5156
|
+
if (!svgRef.current || !zoomRef.current) return;
|
|
5157
|
+
d3.select(svgRef.current).transition().duration(250).call(zoomRef.current.scaleBy, factor);
|
|
5158
|
+
};
|
|
5159
|
+
const resetZoom = () => {
|
|
5160
|
+
fitToView();
|
|
5161
|
+
};
|
|
5162
|
+
const controlBtnClass = [
|
|
5163
|
+
"appearance-none border-0 bg-none font-[inherit]",
|
|
5164
|
+
"flex items-center justify-center rounded-lg p-2",
|
|
5165
|
+
"text-slate-400 transition hover:bg-slate-100 hover:text-slate-700",
|
|
5166
|
+
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand-blue/30"
|
|
5167
|
+
].join(" ");
|
|
5168
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
5169
|
+
className: `relative w-full overflow-hidden bg-slate-50/50 ${className}`,
|
|
5170
|
+
style: { height },
|
|
5171
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
5172
|
+
className: "absolute right-4 top-4 z-10 flex flex-col gap-2 rounded-lg border border-slate-100 bg-white p-2 shadow-md",
|
|
5173
|
+
children: [
|
|
5174
|
+
/* @__PURE__ */ jsx("button", {
|
|
5175
|
+
type: "button",
|
|
5176
|
+
className: controlBtnClass,
|
|
5177
|
+
onClick: () => zoomBy(1.2),
|
|
5178
|
+
"aria-label": "Zoom in",
|
|
5179
|
+
children: /* @__PURE__ */ jsx(ZoomIn, {
|
|
5180
|
+
size: 16,
|
|
5181
|
+
"aria-hidden": "true"
|
|
5182
|
+
})
|
|
5183
|
+
}),
|
|
5184
|
+
/* @__PURE__ */ jsx("button", {
|
|
5185
|
+
type: "button",
|
|
5186
|
+
className: controlBtnClass,
|
|
5187
|
+
onClick: resetZoom,
|
|
5188
|
+
"aria-label": "Reset zoom",
|
|
5189
|
+
children: /* @__PURE__ */ jsx(RotateCcw, {
|
|
5190
|
+
size: 16,
|
|
5191
|
+
"aria-hidden": "true"
|
|
5192
|
+
})
|
|
5193
|
+
}),
|
|
5194
|
+
/* @__PURE__ */ jsx("button", {
|
|
5195
|
+
type: "button",
|
|
5196
|
+
className: controlBtnClass,
|
|
5197
|
+
onClick: () => zoomBy(.8),
|
|
5198
|
+
"aria-label": "Zoom out",
|
|
5199
|
+
children: /* @__PURE__ */ jsx(ZoomOut, {
|
|
5200
|
+
size: 16,
|
|
5201
|
+
"aria-hidden": "true"
|
|
5202
|
+
})
|
|
5203
|
+
})
|
|
5204
|
+
]
|
|
5205
|
+
}), /* @__PURE__ */ jsx("svg", {
|
|
5206
|
+
ref: svgRef,
|
|
5207
|
+
id: uid,
|
|
5208
|
+
width: "100%",
|
|
5209
|
+
height: "100%",
|
|
5210
|
+
className: "block touch-none",
|
|
5211
|
+
role: "img",
|
|
5212
|
+
"aria-label": ariaLabel
|
|
5213
|
+
})]
|
|
5214
|
+
});
|
|
5215
|
+
}
|
|
5216
|
+
//#endregion
|
|
5217
|
+
//#region src/ui-library/gallery/org-unit-tree/OrgUnitTree.tsx
|
|
5218
|
+
/**
|
|
5219
|
+
* OrgUnitTree — Design System Component
|
|
5220
|
+
*
|
|
5221
|
+
* A card-based hierarchical organization tree matching the UHRIS
|
|
5222
|
+
* Company Structure list-mode visual design. Purely presentational —
|
|
5223
|
+
* no API calls, no domain logic, no permissions.
|
|
5224
|
+
*
|
|
5225
|
+
* Visual design (sourced from CompanyStructurePage StructureDesigner):
|
|
5226
|
+
* - Root node: dark navy (bg-slate-900) card with light text
|
|
5227
|
+
* - Child nodes: white bordered cards with blue hover accent
|
|
5228
|
+
* - Connector: left border (border-l border-slate-200) + indentation
|
|
5229
|
+
* - Icon badge: rounded-xl colored square containing the icon
|
|
5230
|
+
* - Actions: hover-reveal slot (opacity-0 → group-hover:opacity-100)
|
|
5231
|
+
* - Meta: right-aligned, hidden on narrow screens
|
|
5232
|
+
*
|
|
5233
|
+
* Accessibility (WAI-ARIA Tree pattern, RFC 1.2):
|
|
5234
|
+
* - role="tree" on root list
|
|
5235
|
+
* - role="treeitem" + aria-expanded + aria-selected + aria-level + aria-disabled
|
|
5236
|
+
* - role="group" on nested lists
|
|
5237
|
+
* - Keyboard: ArrowDown/Up/Left/Right/Home/End/Enter/Space
|
|
5238
|
+
* - Roving tabIndex: only focused item has tabIndex=0
|
|
5239
|
+
*
|
|
5240
|
+
* Usage:
|
|
5241
|
+
* <OrgUnitTree
|
|
5242
|
+
* nodes={orgNodes}
|
|
5243
|
+
* onSelect={(id) => navigate(`/org/${id}`)}
|
|
5244
|
+
* aria-label="Company structure"
|
|
5245
|
+
* />
|
|
5246
|
+
*/
|
|
5247
|
+
function flattenVisible(nodes, expanded) {
|
|
5248
|
+
const result = [];
|
|
5249
|
+
for (const node of nodes) {
|
|
5250
|
+
result.push(node);
|
|
5251
|
+
if (node.children?.length && expanded.has(node.id)) result.push(...flattenVisible(node.children, expanded));
|
|
5252
|
+
}
|
|
5253
|
+
return result;
|
|
5254
|
+
}
|
|
5255
|
+
function findParentId(nodes, targetId) {
|
|
5256
|
+
for (const node of nodes) {
|
|
5257
|
+
if (node.children?.some((c) => c.id === targetId)) return node.id;
|
|
5258
|
+
if (node.children) {
|
|
5259
|
+
const found = findParentId(node.children, targetId);
|
|
5260
|
+
if (found !== null) return found;
|
|
5261
|
+
}
|
|
5262
|
+
}
|
|
5263
|
+
return null;
|
|
5264
|
+
}
|
|
5265
|
+
function OrgUnitTree({ nodes, selectedId, onSelect, defaultExpandedIds, expandedIds: controlledExpandedIds, onExpandedChange, "aria-label": ariaLabel, className = "" }) {
|
|
5266
|
+
const baseId = useId().replace(/:/g, "");
|
|
5267
|
+
const treeRef = useRef(null);
|
|
5268
|
+
const [internalExpanded, setInternalExpanded] = useState(() => {
|
|
5269
|
+
if (defaultExpandedIds) return new Set(defaultExpandedIds);
|
|
5270
|
+
return new Set(nodes.map((n) => n.id));
|
|
5271
|
+
});
|
|
5272
|
+
const expanded = controlledExpandedIds ? new Set(controlledExpandedIds) : internalExpanded;
|
|
5273
|
+
const setExpanded = useCallback((next) => {
|
|
5274
|
+
if (!controlledExpandedIds) setInternalExpanded(next);
|
|
5275
|
+
onExpandedChange?.(Array.from(next));
|
|
5276
|
+
}, [controlledExpandedIds, onExpandedChange]);
|
|
5277
|
+
const [focusedId, setFocusedId] = useState(() => {
|
|
5278
|
+
return flattenVisible(nodes, new Set(nodes.map((n) => n.id))).find((n) => !n.disabled)?.id ?? null;
|
|
5279
|
+
});
|
|
5280
|
+
const toggleExpand = useCallback((id) => {
|
|
5281
|
+
const next = new Set(expanded);
|
|
5282
|
+
if (next.has(id)) next.delete(id);
|
|
5283
|
+
else next.add(id);
|
|
5284
|
+
setExpanded(next);
|
|
5285
|
+
}, [expanded, setExpanded]);
|
|
5286
|
+
const handleSelect = useCallback((id) => {
|
|
5287
|
+
setFocusedId(id);
|
|
5288
|
+
onSelect?.(id);
|
|
5289
|
+
}, [onSelect]);
|
|
5290
|
+
const handleKeyDown = (e) => {
|
|
5291
|
+
const visible = flattenVisible(nodes, expanded).filter((n) => !n.disabled);
|
|
5292
|
+
if (visible.length === 0) return;
|
|
5293
|
+
const focusEl = (id) => {
|
|
5294
|
+
setFocusedId(id);
|
|
5295
|
+
document.getElementById(`${baseId}-${id}`)?.focus();
|
|
5296
|
+
};
|
|
5297
|
+
const currentIdx = focusedId ? visible.findIndex((n) => n.id === focusedId) : -1;
|
|
5298
|
+
const current = focusedId ? visible.find((n) => n.id === focusedId) : null;
|
|
5299
|
+
switch (e.key) {
|
|
5300
|
+
case "ArrowDown": {
|
|
5301
|
+
e.preventDefault();
|
|
5302
|
+
const next = visible[currentIdx + 1];
|
|
5303
|
+
if (next) focusEl(next.id);
|
|
5304
|
+
break;
|
|
5305
|
+
}
|
|
5306
|
+
case "ArrowUp": {
|
|
5307
|
+
e.preventDefault();
|
|
5308
|
+
const prev = visible[currentIdx - 1];
|
|
5309
|
+
if (prev) focusEl(prev.id);
|
|
5310
|
+
break;
|
|
5311
|
+
}
|
|
5312
|
+
case "ArrowRight":
|
|
5313
|
+
e.preventDefault();
|
|
5314
|
+
if (!current) break;
|
|
5315
|
+
if (current.children?.length && !expanded.has(current.id)) {
|
|
5316
|
+
const next = new Set(expanded);
|
|
5317
|
+
next.add(current.id);
|
|
5318
|
+
setExpanded(next);
|
|
5319
|
+
} else if (current.children?.length && expanded.has(current.id)) {
|
|
5320
|
+
const firstChild = visible.find((n, i) => i > currentIdx && n.id === current.children[0]?.id);
|
|
5321
|
+
if (firstChild) focusEl(firstChild.id);
|
|
5322
|
+
}
|
|
5323
|
+
break;
|
|
5324
|
+
case "ArrowLeft":
|
|
5325
|
+
e.preventDefault();
|
|
5326
|
+
if (!current) break;
|
|
5327
|
+
if (current.children?.length && expanded.has(current.id)) {
|
|
5328
|
+
const next = new Set(expanded);
|
|
5329
|
+
next.delete(current.id);
|
|
5330
|
+
setExpanded(next);
|
|
5331
|
+
} else {
|
|
5332
|
+
const parentId = findParentId(nodes, current.id);
|
|
5333
|
+
if (parentId) focusEl(parentId);
|
|
5334
|
+
}
|
|
5335
|
+
break;
|
|
5336
|
+
case "Home":
|
|
5337
|
+
e.preventDefault();
|
|
5338
|
+
if (visible[0]) focusEl(visible[0].id);
|
|
5339
|
+
break;
|
|
5340
|
+
case "End": {
|
|
5341
|
+
e.preventDefault();
|
|
5342
|
+
const last = visible[visible.length - 1];
|
|
5343
|
+
if (last) focusEl(last.id);
|
|
5344
|
+
break;
|
|
5345
|
+
}
|
|
5346
|
+
case "Enter":
|
|
5347
|
+
case " ":
|
|
5348
|
+
e.preventDefault();
|
|
5349
|
+
if (current) {
|
|
5350
|
+
handleSelect(current.id);
|
|
5351
|
+
if (current.children?.length) toggleExpand(current.id);
|
|
5352
|
+
}
|
|
5353
|
+
}
|
|
5354
|
+
};
|
|
5355
|
+
const nodeRefs = useRef(/* @__PURE__ */ new Map());
|
|
5356
|
+
function renderNodes(branch, depth) {
|
|
5357
|
+
return branch.map((node) => {
|
|
5358
|
+
const isExpanded = expanded.has(node.id);
|
|
5359
|
+
const isRoot = depth === 1;
|
|
5360
|
+
const hasChildren = Boolean(node.children?.length);
|
|
5361
|
+
return /* @__PURE__ */ jsxs("li", {
|
|
5362
|
+
ref: (el) => {
|
|
5363
|
+
if (el) nodeRefs.current.set(node.id, el);
|
|
5364
|
+
else nodeRefs.current.delete(node.id);
|
|
5365
|
+
},
|
|
5366
|
+
id: `${baseId}-${node.id}`,
|
|
5367
|
+
role: "treeitem",
|
|
5368
|
+
"aria-expanded": hasChildren ? isExpanded : void 0,
|
|
5369
|
+
"aria-selected": selectedId === node.id,
|
|
5370
|
+
"aria-disabled": node.disabled || void 0,
|
|
5371
|
+
"aria-level": depth,
|
|
5372
|
+
tabIndex: focusedId === node.id ? 0 : -1,
|
|
5373
|
+
onFocus: () => setFocusedId(node.id),
|
|
5374
|
+
className: "outline-none",
|
|
5375
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
5376
|
+
className: ["group mb-2 flex items-center gap-3 rounded-xl border px-3 py-3 transition select-none", isRoot ? "border-slate-900 bg-slate-900 text-slate-300 shadow-md" : selectedId === node.id ? "border-brand-blue/40 bg-blue-50 shadow-sm" : node.disabled ? "border-slate-100 bg-slate-50 opacity-50 cursor-not-allowed" : "border-slate-200 bg-white hover:border-blue-300 hover:shadow-sm cursor-pointer"].filter(Boolean).join(" "),
|
|
5377
|
+
onClick: () => {
|
|
5378
|
+
if (node.disabled) return;
|
|
5379
|
+
if (hasChildren) toggleExpand(node.id);
|
|
5380
|
+
handleSelect(node.id);
|
|
5381
|
+
},
|
|
5382
|
+
children: [
|
|
5383
|
+
/* @__PURE__ */ jsx("button", {
|
|
5384
|
+
type: "button",
|
|
5385
|
+
"aria-label": isExpanded ? `Collapse ${node.label}` : `Expand ${node.label}`,
|
|
5386
|
+
tabIndex: -1,
|
|
5387
|
+
disabled: !hasChildren,
|
|
5388
|
+
onClick: (e) => {
|
|
5389
|
+
e.stopPropagation();
|
|
5390
|
+
if (hasChildren) toggleExpand(node.id);
|
|
5391
|
+
},
|
|
5392
|
+
className: [
|
|
5393
|
+
"flex items-center justify-center rounded p-1 shrink-0 transition",
|
|
5394
|
+
!hasChildren && "invisible",
|
|
5395
|
+
isRoot ? "hover:bg-slate-700" : "hover:bg-slate-100"
|
|
5396
|
+
].filter(Boolean).join(" "),
|
|
5397
|
+
children: isExpanded ? /* @__PURE__ */ jsx(ChevronDown, {
|
|
5398
|
+
size: 16,
|
|
5399
|
+
"aria-hidden": "true"
|
|
5400
|
+
}) : /* @__PURE__ */ jsx(ChevronRight, {
|
|
5401
|
+
size: 16,
|
|
5402
|
+
"aria-hidden": "true"
|
|
5403
|
+
})
|
|
5404
|
+
}),
|
|
5405
|
+
node.icon && /* @__PURE__ */ jsx("div", {
|
|
5406
|
+
className: isRoot ? "flex h-10 w-10 shrink-0 items-center justify-center rounded-xl bg-slate-800 text-slate-200" : "flex h-10 w-10 shrink-0 items-center justify-center rounded-xl bg-blue-50 text-blue-600",
|
|
5407
|
+
"aria-hidden": "true",
|
|
5408
|
+
children: node.icon
|
|
5409
|
+
}),
|
|
5410
|
+
/* @__PURE__ */ jsxs("div", {
|
|
5411
|
+
className: "min-w-0 flex-1",
|
|
5412
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
5413
|
+
className: ["flex flex-wrap items-center gap-2 text-sm font-bold", isRoot ? "text-white" : selectedId === node.id ? "text-brand-blue" : "text-slate-900"].filter(Boolean).join(" "),
|
|
5414
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
5415
|
+
className: "truncate",
|
|
5416
|
+
children: node.label
|
|
5417
|
+
}), node.badge && /* @__PURE__ */ jsx("span", { children: node.badge })]
|
|
5418
|
+
}), node.description && /* @__PURE__ */ jsx("div", {
|
|
5419
|
+
className: `mt-0.5 truncate text-xs font-medium ${isRoot ? "text-slate-400" : "text-slate-500"}`,
|
|
5420
|
+
children: node.description
|
|
5421
|
+
})]
|
|
5422
|
+
}),
|
|
5423
|
+
node.meta && /* @__PURE__ */ jsx("div", {
|
|
5424
|
+
className: `hidden md:flex items-center gap-3 text-xs ${isRoot ? "text-slate-300" : "text-slate-500"}`,
|
|
5425
|
+
children: node.meta
|
|
5426
|
+
}),
|
|
5427
|
+
node.actions && /* @__PURE__ */ jsx("div", {
|
|
5428
|
+
className: "flex items-center gap-1 opacity-0 transition-opacity group-hover:opacity-100 group-focus-within:opacity-100",
|
|
5429
|
+
onClick: (e) => e.stopPropagation(),
|
|
5430
|
+
children: node.actions
|
|
5431
|
+
})
|
|
5432
|
+
]
|
|
5433
|
+
}), hasChildren && isExpanded && /* @__PURE__ */ jsx("ul", {
|
|
5434
|
+
role: "group",
|
|
5435
|
+
className: "ml-6 border-l border-slate-200 pl-4",
|
|
5436
|
+
children: renderNodes(node.children, depth + 1)
|
|
5437
|
+
})]
|
|
5438
|
+
}, node.id);
|
|
5439
|
+
});
|
|
5440
|
+
}
|
|
5441
|
+
if (nodes.length === 0) return null;
|
|
5442
|
+
return /* @__PURE__ */ jsx("ul", {
|
|
5443
|
+
ref: treeRef,
|
|
5444
|
+
role: "tree",
|
|
5445
|
+
"aria-label": ariaLabel,
|
|
5446
|
+
onKeyDown: handleKeyDown,
|
|
5447
|
+
className: `w-full outline-none ${className}`,
|
|
5448
|
+
children: renderNodes(nodes, 1)
|
|
5449
|
+
});
|
|
5450
|
+
}
|
|
5451
|
+
//#endregion
|
|
5452
|
+
//#region src/ui-library/gallery/template-samples/templates/PafTemplate.tsx
|
|
5453
|
+
var fmt = new Intl.DateTimeFormat("en-US", {
|
|
5454
|
+
month: "short",
|
|
5455
|
+
day: "2-digit",
|
|
5456
|
+
year: "numeric"
|
|
5457
|
+
});
|
|
5458
|
+
var fmtDate = (v) => {
|
|
5459
|
+
if (!v?.trim()) return "";
|
|
5460
|
+
const n = /^\d{4}-\d{2}-\d{2}$/.test(v.trim()) ? `${v.trim()}T00:00:00` : v.trim();
|
|
5461
|
+
const d = new Date(n);
|
|
5462
|
+
return isNaN(d.getTime()) ? v : fmt.format(d);
|
|
5463
|
+
};
|
|
5464
|
+
var STANDARD_LABELS = [
|
|
5465
|
+
"Basic Salary",
|
|
5466
|
+
"Cola",
|
|
5467
|
+
"Trasa",
|
|
5468
|
+
"Trarep",
|
|
5469
|
+
"Communication",
|
|
5470
|
+
"Car",
|
|
5471
|
+
"Motor",
|
|
5472
|
+
"Others"
|
|
5473
|
+
];
|
|
5474
|
+
function PafTemplate({ data }) {
|
|
5475
|
+
const allComponents = STANDARD_LABELS.map((label) => {
|
|
5476
|
+
const found = data.salaryComponents?.find((c) => c.label.toLowerCase() === label.toLowerCase());
|
|
5477
|
+
if (found) return found;
|
|
5478
|
+
if (label === "Basic Salary") return {
|
|
5479
|
+
label,
|
|
5480
|
+
from: data.from.basicSalary,
|
|
5481
|
+
to: data.to.basicSalary
|
|
5482
|
+
};
|
|
5483
|
+
return {
|
|
5484
|
+
label,
|
|
5485
|
+
from: "",
|
|
5486
|
+
to: ""
|
|
5487
|
+
};
|
|
5488
|
+
});
|
|
5489
|
+
const shownComponents = allComponents.filter((c) => {
|
|
5490
|
+
if (c.label === "Basic Salary") return true;
|
|
5491
|
+
const hasFrom = c.from && parseFloat(c.from.replace(/,/g, "")) !== 0;
|
|
5492
|
+
const hasTo = c.to && parseFloat(c.to.replace(/,/g, "")) !== 0;
|
|
5493
|
+
return hasFrom || hasTo;
|
|
5494
|
+
});
|
|
5495
|
+
const paddingRows = Array.from({ length: Math.max(0, 7 - shownComponents.length) });
|
|
5496
|
+
const calcTotal = (type) => {
|
|
5497
|
+
const t = allComponents.reduce((acc, c) => {
|
|
5498
|
+
const v = parseFloat((type === "from" ? c.from : c.to).replace(/,/g, ""));
|
|
5499
|
+
return acc + (isNaN(v) ? 0 : v);
|
|
5500
|
+
}, 0);
|
|
5501
|
+
return t === 0 ? "" : t.toLocaleString("en-US", {
|
|
5502
|
+
minimumFractionDigits: 2,
|
|
5503
|
+
maximumFractionDigits: 2
|
|
5504
|
+
});
|
|
5505
|
+
};
|
|
5506
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
5507
|
+
className: "bg-white text-black font-sans",
|
|
5508
|
+
style: {
|
|
5509
|
+
width: "816px",
|
|
5510
|
+
minHeight: "1056px",
|
|
5511
|
+
padding: "60px 50px",
|
|
5512
|
+
boxSizing: "border-box"
|
|
5513
|
+
},
|
|
5514
|
+
children: [
|
|
5515
|
+
/* @__PURE__ */ jsx("h1", {
|
|
5516
|
+
className: "text-center italic font-bold text-2xl tracking-widest mb-8 uppercase",
|
|
5517
|
+
children: "Personnel Action Form"
|
|
5518
|
+
}),
|
|
5519
|
+
/* @__PURE__ */ jsxs("div", {
|
|
5520
|
+
className: "mb-6",
|
|
5521
|
+
children: [/* @__PURE__ */ jsx("h2", {
|
|
5522
|
+
className: "text-sm font-bold italic border-b border-black mb-2 uppercase tracking-tight",
|
|
5523
|
+
children: "Employee Data"
|
|
5524
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
5525
|
+
className: "grid grid-cols-12 gap-x-4",
|
|
5526
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
5527
|
+
className: "col-span-8 space-y-2",
|
|
5528
|
+
children: [{
|
|
5529
|
+
label: "Employee ID:",
|
|
5530
|
+
value: data.employee.idNo
|
|
5531
|
+
}, {
|
|
5532
|
+
label: "Employee Name:",
|
|
5533
|
+
value: data.employee.name.toUpperCase()
|
|
5534
|
+
}].map((r, i) => /* @__PURE__ */ jsxs("div", {
|
|
5535
|
+
className: "flex items-center",
|
|
5536
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
5537
|
+
className: "w-32 text-[11px] font-bold italic",
|
|
5538
|
+
children: r.label
|
|
5539
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
5540
|
+
className: "flex-1 border border-black px-2 py-0.5 text-[12px] min-h-[24px] font-semibold",
|
|
5541
|
+
children: r.value
|
|
5542
|
+
})]
|
|
5543
|
+
}, i))
|
|
5544
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
5545
|
+
className: "col-span-4 space-y-2",
|
|
5546
|
+
children: [{
|
|
5547
|
+
label: "Date Hired:",
|
|
5548
|
+
value: fmtDate(data.employee.dateHired) || "Jan 01, 2024"
|
|
5549
|
+
}, {
|
|
5550
|
+
label: "Date Prepared:",
|
|
5551
|
+
value: fmtDate(data.date)
|
|
5552
|
+
}].map((r, i) => /* @__PURE__ */ jsxs("div", {
|
|
5553
|
+
className: "flex items-center",
|
|
5554
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
5555
|
+
className: "w-24 text-[11px] font-bold italic",
|
|
5556
|
+
children: r.label
|
|
5557
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
5558
|
+
className: "flex-1 border border-black px-2 py-0.5 text-[12px] min-h-[24px] text-center",
|
|
5559
|
+
children: r.value
|
|
5560
|
+
})]
|
|
5561
|
+
}, i))
|
|
5562
|
+
})]
|
|
5563
|
+
})]
|
|
5564
|
+
}),
|
|
5565
|
+
/* @__PURE__ */ jsxs("div", {
|
|
5566
|
+
className: "mb-6",
|
|
5567
|
+
children: [/* @__PURE__ */ jsx("h2", {
|
|
5568
|
+
className: "text-sm font-bold italic border-b border-black mb-2 uppercase tracking-tight",
|
|
5569
|
+
children: "Position/Salary Change Details"
|
|
5570
|
+
}), /* @__PURE__ */ jsxs("table", {
|
|
5571
|
+
className: "w-full border-collapse",
|
|
5572
|
+
children: [/* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsxs("tr", { children: [
|
|
5573
|
+
/* @__PURE__ */ jsx("th", {
|
|
5574
|
+
className: "w-[124px]",
|
|
5575
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
5576
|
+
className: "sr-only",
|
|
5577
|
+
children: "Field"
|
|
5578
|
+
})
|
|
5579
|
+
}),
|
|
5580
|
+
/* @__PURE__ */ jsx("th", {
|
|
5581
|
+
className: "text-[12px] italic font-bold text-center pb-1",
|
|
5582
|
+
children: "FROM"
|
|
5583
|
+
}),
|
|
5584
|
+
/* @__PURE__ */ jsx("th", {
|
|
5585
|
+
className: "text-[12px] italic font-bold text-center pb-1",
|
|
5586
|
+
children: "TO"
|
|
5587
|
+
})
|
|
5588
|
+
] }) }), /* @__PURE__ */ jsxs("tbody", { children: [/* @__PURE__ */ jsxs("tr", { children: [
|
|
5589
|
+
/* @__PURE__ */ jsx("td", {
|
|
5590
|
+
className: "text-[10px] italic font-bold py-1",
|
|
5591
|
+
children: "Pay Template"
|
|
5592
|
+
}),
|
|
5593
|
+
/* @__PURE__ */ jsx("td", {
|
|
5594
|
+
className: "border border-black p-1 text-[11px] font-bold w-[300px]",
|
|
5595
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
5596
|
+
className: "px-1 min-h-[16px]",
|
|
5597
|
+
children: data.fromTemplate || "—"
|
|
5598
|
+
})
|
|
5599
|
+
}),
|
|
5600
|
+
/* @__PURE__ */ jsx("td", {
|
|
5601
|
+
className: "border border-black p-1 text-[11px] font-bold w-[300px]",
|
|
5602
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
5603
|
+
className: "px-1 min-h-[16px]",
|
|
5604
|
+
children: data.toTemplate || "—"
|
|
5605
|
+
})
|
|
5606
|
+
})
|
|
5607
|
+
] }), [
|
|
5608
|
+
{
|
|
5609
|
+
label: "Rank",
|
|
5610
|
+
from: data.from.rank,
|
|
5611
|
+
to: data.to.rank
|
|
5612
|
+
},
|
|
5613
|
+
{
|
|
5614
|
+
label: "Employment Status",
|
|
5615
|
+
from: data.from.status,
|
|
5616
|
+
to: data.to.status
|
|
5617
|
+
},
|
|
5618
|
+
{
|
|
5619
|
+
label: "Position",
|
|
5620
|
+
from: data.from.position,
|
|
5621
|
+
to: data.to.position
|
|
5622
|
+
},
|
|
5623
|
+
{
|
|
5624
|
+
label: "Department",
|
|
5625
|
+
from: data.from.department,
|
|
5626
|
+
to: data.to.department
|
|
5627
|
+
},
|
|
5628
|
+
{
|
|
5629
|
+
label: "Supervisor",
|
|
5630
|
+
from: data.from.supervisor,
|
|
5631
|
+
to: data.to.supervisor
|
|
5632
|
+
},
|
|
5633
|
+
{
|
|
5634
|
+
label: "Department Head",
|
|
5635
|
+
from: data.from.departmentHead,
|
|
5636
|
+
to: data.to.departmentHead
|
|
5637
|
+
},
|
|
5638
|
+
{
|
|
5639
|
+
label: "Company",
|
|
5640
|
+
from: data.from.company,
|
|
5641
|
+
to: data.to.company
|
|
5642
|
+
}
|
|
5643
|
+
].map((row, i) => /* @__PURE__ */ jsxs("tr", { children: [
|
|
5644
|
+
/* @__PURE__ */ jsx("td", {
|
|
5645
|
+
className: "text-[10px] italic font-bold py-1",
|
|
5646
|
+
children: row.label
|
|
5647
|
+
}),
|
|
5648
|
+
/* @__PURE__ */ jsx("td", {
|
|
5649
|
+
className: "border border-black p-1 text-[11px] w-[300px]",
|
|
5650
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
5651
|
+
className: "px-1 min-h-[16px]",
|
|
5652
|
+
children: row.from
|
|
5653
|
+
})
|
|
5654
|
+
}),
|
|
5655
|
+
/* @__PURE__ */ jsx("td", {
|
|
5656
|
+
className: "border border-black p-1 text-[11px] w-[300px]",
|
|
5657
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
5658
|
+
className: "px-1 min-h-[16px]",
|
|
5659
|
+
children: row.to
|
|
5660
|
+
})
|
|
5661
|
+
})
|
|
5662
|
+
] }, i))] })]
|
|
5663
|
+
})]
|
|
5664
|
+
}),
|
|
5665
|
+
/* @__PURE__ */ jsxs("div", {
|
|
5666
|
+
className: "mb-6",
|
|
5667
|
+
children: [/* @__PURE__ */ jsx("h2", {
|
|
5668
|
+
className: "text-sm font-bold italic border-b border-black mb-2 uppercase tracking-tight",
|
|
5669
|
+
children: "Reason for Adjustment"
|
|
5670
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
5671
|
+
className: "flex mb-2",
|
|
5672
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
5673
|
+
className: "flex-1",
|
|
5674
|
+
children: [
|
|
5675
|
+
/* @__PURE__ */ jsxs("div", {
|
|
5676
|
+
className: "flex items-center mb-1",
|
|
5677
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
5678
|
+
className: "text-[10px] italic font-bold w-32",
|
|
5679
|
+
children: "Date of Effectivity:"
|
|
5680
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
5681
|
+
className: "text-[11px] font-bold",
|
|
5682
|
+
children: fmtDate(data.effectiveDate)
|
|
5683
|
+
})]
|
|
5684
|
+
}),
|
|
5685
|
+
/* @__PURE__ */ jsx("div", {
|
|
5686
|
+
className: "text-[10px] italic font-bold mb-1",
|
|
5687
|
+
children: "Reason for Adjustment:"
|
|
5688
|
+
}),
|
|
5689
|
+
/* @__PURE__ */ jsx("div", {
|
|
5690
|
+
className: "flex items-start ml-4",
|
|
5691
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
5692
|
+
className: "text-[10px] italic mt-1",
|
|
5693
|
+
children: "Others"
|
|
5694
|
+
})
|
|
5695
|
+
})
|
|
5696
|
+
]
|
|
5697
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
5698
|
+
className: "w-[450px]",
|
|
5699
|
+
children: /* @__PURE__ */ jsxs("table", {
|
|
5700
|
+
className: "w-full border-collapse",
|
|
5701
|
+
children: [/* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsxs("tr", { children: [
|
|
5702
|
+
/* @__PURE__ */ jsx("th", {
|
|
5703
|
+
className: "w-1/3",
|
|
5704
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
5705
|
+
className: "sr-only",
|
|
5706
|
+
children: "Component"
|
|
5707
|
+
})
|
|
5708
|
+
}),
|
|
5709
|
+
/* @__PURE__ */ jsx("th", {
|
|
5710
|
+
className: "text-[11px] italic font-bold text-center border-x border-t border-black py-1",
|
|
5711
|
+
children: "FROM"
|
|
5712
|
+
}),
|
|
5713
|
+
/* @__PURE__ */ jsx("th", {
|
|
5714
|
+
className: "text-[11px] italic font-bold text-center border-r border-t border-black py-1",
|
|
5715
|
+
children: "TO"
|
|
5716
|
+
})
|
|
5717
|
+
] }) }), /* @__PURE__ */ jsxs("tbody", {
|
|
5718
|
+
className: "border-b border-black",
|
|
5719
|
+
children: [
|
|
5720
|
+
/* @__PURE__ */ jsxs("tr", { children: [
|
|
5721
|
+
/* @__PURE__ */ jsx("td", {
|
|
5722
|
+
className: "text-[10px] italic pr-4 text-right font-bold uppercase",
|
|
5723
|
+
children: "Template"
|
|
5724
|
+
}),
|
|
5725
|
+
/* @__PURE__ */ jsx("td", {
|
|
5726
|
+
className: "border-x border-black px-2 py-0.5 text-[9px] text-center font-bold",
|
|
5727
|
+
children: data.fromTemplate || "—"
|
|
5728
|
+
}),
|
|
5729
|
+
/* @__PURE__ */ jsx("td", {
|
|
5730
|
+
className: "border-r border-black px-2 py-0.5 text-[9px] text-center font-bold",
|
|
5731
|
+
children: data.toTemplate || "—"
|
|
5732
|
+
})
|
|
5733
|
+
] }),
|
|
5734
|
+
shownComponents.map((c, i) => /* @__PURE__ */ jsxs("tr", { children: [
|
|
5735
|
+
/* @__PURE__ */ jsx("td", {
|
|
5736
|
+
className: "text-[10px] italic pr-4 text-right font-bold",
|
|
5737
|
+
children: c.label
|
|
5738
|
+
}),
|
|
5739
|
+
/* @__PURE__ */ jsx("td", {
|
|
5740
|
+
className: "border-x border-black px-2 py-0.5 text-[11px] text-right min-h-[18px]",
|
|
5741
|
+
children: c.from && parseFloat(c.from.replace(/,/g, "")) !== 0 ? c.from : ""
|
|
5742
|
+
}),
|
|
5743
|
+
/* @__PURE__ */ jsx("td", {
|
|
5744
|
+
className: "border-r border-black px-2 py-0.5 text-[11px] text-right min-h-[18px]",
|
|
5745
|
+
children: c.to && parseFloat(c.to.replace(/,/g, "")) !== 0 ? c.to : ""
|
|
5746
|
+
})
|
|
5747
|
+
] }, i)),
|
|
5748
|
+
paddingRows.map((_, i) => /* @__PURE__ */ jsxs("tr", { children: [
|
|
5749
|
+
/* @__PURE__ */ jsx("td", {
|
|
5750
|
+
className: "text-[10px] py-1",
|
|
5751
|
+
children: "\xA0"
|
|
5752
|
+
}),
|
|
5753
|
+
/* @__PURE__ */ jsx("td", {
|
|
5754
|
+
className: "border-x border-black",
|
|
5755
|
+
children: "\xA0"
|
|
5756
|
+
}),
|
|
5757
|
+
/* @__PURE__ */ jsx("td", {
|
|
5758
|
+
className: "border-r border-black",
|
|
5759
|
+
children: "\xA0"
|
|
5760
|
+
})
|
|
5761
|
+
] }, `p-${i}`)),
|
|
5762
|
+
/* @__PURE__ */ jsxs("tr", {
|
|
5763
|
+
className: "border-t border-black",
|
|
5764
|
+
children: [
|
|
5765
|
+
/* @__PURE__ */ jsx("td", {
|
|
5766
|
+
className: "text-[10px] italic pr-4 text-right font-bold uppercase py-1",
|
|
5767
|
+
children: "Total"
|
|
5768
|
+
}),
|
|
5769
|
+
/* @__PURE__ */ jsx("td", {
|
|
5770
|
+
className: "border-x border-black px-2 py-1 text-[11px] text-right font-bold",
|
|
5771
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
5772
|
+
className: "border-b-4 border-double border-black pb-0.5",
|
|
5773
|
+
children: calcTotal("from")
|
|
5774
|
+
})
|
|
5775
|
+
}),
|
|
5776
|
+
/* @__PURE__ */ jsx("td", {
|
|
5777
|
+
className: "border-r border-black px-2 py-1 text-[11px] text-right font-bold",
|
|
5778
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
5779
|
+
className: "border-b-4 border-double border-black pb-0.5",
|
|
5780
|
+
children: calcTotal("to")
|
|
5781
|
+
})
|
|
5782
|
+
})
|
|
5783
|
+
]
|
|
5784
|
+
})
|
|
5785
|
+
]
|
|
5786
|
+
})]
|
|
5787
|
+
})
|
|
5788
|
+
})]
|
|
5789
|
+
})]
|
|
5790
|
+
}),
|
|
5791
|
+
/* @__PURE__ */ jsxs("div", {
|
|
5792
|
+
className: "mb-8",
|
|
5793
|
+
children: [/* @__PURE__ */ jsx("h2", {
|
|
5794
|
+
className: "text-sm font-bold italic border-b border-black mb-2 uppercase tracking-tight",
|
|
5795
|
+
children: "Reason for Change"
|
|
5796
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
5797
|
+
className: "border border-black p-2 min-h-[60px] text-[11px] break-words whitespace-pre-wrap",
|
|
5798
|
+
children: data.reason
|
|
5799
|
+
})]
|
|
5800
|
+
}),
|
|
5801
|
+
/* @__PURE__ */ jsxs("div", {
|
|
5802
|
+
className: "mt-10",
|
|
5803
|
+
children: [/* @__PURE__ */ jsx("h2", {
|
|
5804
|
+
className: "text-sm font-bold italic border-b border-black mb-4 uppercase tracking-tight",
|
|
5805
|
+
children: "Authorized Signatories"
|
|
5806
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
5807
|
+
className: "grid grid-cols-3 gap-6 mb-8",
|
|
5808
|
+
children: [
|
|
5809
|
+
{
|
|
5810
|
+
heading: "Prepared By",
|
|
5811
|
+
name: data.preparedBy,
|
|
5812
|
+
title: data.preparedByTitle || "HRMD Supervisor"
|
|
5813
|
+
},
|
|
5814
|
+
{
|
|
5815
|
+
heading: "Verified By",
|
|
5816
|
+
name: data.approvedBy || "VP of HRMD",
|
|
5817
|
+
title: data.approvedByTitle || "Vice President for HRMD"
|
|
5818
|
+
},
|
|
5819
|
+
{
|
|
5820
|
+
heading: "Conforme",
|
|
5821
|
+
name: data.employee.name,
|
|
5822
|
+
title: "Employee"
|
|
5823
|
+
}
|
|
5824
|
+
].map((sig, i) => /* @__PURE__ */ jsxs("div", {
|
|
5825
|
+
className: "flex flex-col",
|
|
5826
|
+
children: [
|
|
5827
|
+
/* @__PURE__ */ jsx("h3", {
|
|
5828
|
+
className: "text-[11px] italic font-bold mb-3",
|
|
5829
|
+
children: sig.heading
|
|
5830
|
+
}),
|
|
5831
|
+
/* @__PURE__ */ jsx("div", { className: "border-b border-black min-h-[48px] mb-1" }),
|
|
5832
|
+
/* @__PURE__ */ jsxs("div", {
|
|
5833
|
+
className: "text-center",
|
|
5834
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
5835
|
+
className: "text-[10px] font-bold uppercase",
|
|
5836
|
+
children: sig.name
|
|
5837
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
5838
|
+
className: "text-[9px] font-bold text-slate-400",
|
|
5839
|
+
children: sig.title
|
|
5840
|
+
})]
|
|
5841
|
+
})
|
|
5842
|
+
]
|
|
5843
|
+
}, i))
|
|
5844
|
+
})]
|
|
5845
|
+
}),
|
|
5846
|
+
/* @__PURE__ */ jsx("div", {
|
|
5847
|
+
className: "mt-6 border-t-2 border-dashed border-black pt-2 opacity-30 text-center",
|
|
5848
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
5849
|
+
className: "text-[7px] font-black uppercase tracking-[0.2em] italic",
|
|
5850
|
+
children: "Authorized Document — DIWA HRIS"
|
|
5851
|
+
})
|
|
5852
|
+
})
|
|
5853
|
+
]
|
|
5854
|
+
});
|
|
5855
|
+
}
|
|
5856
|
+
//#endregion
|
|
5857
|
+
//#region src/ui-library/gallery/page-sample/IsoCubeBlock.tsx
|
|
5858
|
+
function IsoCubeBlock({ boxWidth = 80, className = "" }) {
|
|
5859
|
+
const BW = boxWidth;
|
|
5860
|
+
const IH = BW * .575;
|
|
5861
|
+
const SH = BW * .525;
|
|
5862
|
+
const TOP_C = "#F3F3F5";
|
|
5863
|
+
const LEFT_C = "#7D739B";
|
|
5864
|
+
const RIGHT_C = "#9B92B8";
|
|
5865
|
+
function Box({ cx, cy }) {
|
|
5866
|
+
const hw = BW / 2;
|
|
5867
|
+
const A = `${cx + hw},${cy - IH}`;
|
|
5868
|
+
const B = `${cx + BW},${cy - IH / 2}`;
|
|
5869
|
+
const C = `${cx + hw},${cy}`;
|
|
5870
|
+
const D = `${cx},${cy - IH / 2}`;
|
|
5871
|
+
const E = `${cx + hw},${cy + SH}`;
|
|
5872
|
+
const F = `${cx},${cy - IH / 2 + SH}`;
|
|
5873
|
+
const G = `${cx + BW},${cy - IH / 2 + SH}`;
|
|
5874
|
+
return /* @__PURE__ */ jsxs("g", { children: [
|
|
5875
|
+
/* @__PURE__ */ jsx("polygon", {
|
|
5876
|
+
points: `${A} ${B} ${C} ${D}`,
|
|
5877
|
+
fill: TOP_C
|
|
5878
|
+
}),
|
|
5879
|
+
/* @__PURE__ */ jsx("polygon", {
|
|
5880
|
+
points: `${D} ${C} ${E} ${F}`,
|
|
5881
|
+
fill: LEFT_C
|
|
5882
|
+
}),
|
|
5883
|
+
/* @__PURE__ */ jsx("polygon", {
|
|
5884
|
+
points: `${B} ${C} ${E} ${G}`,
|
|
5885
|
+
fill: RIGHT_C
|
|
5886
|
+
})
|
|
5887
|
+
] });
|
|
5888
|
+
}
|
|
5889
|
+
const COLS = 4;
|
|
5890
|
+
const ROWS = 4;
|
|
5891
|
+
const SVG_W = BW * 6;
|
|
5892
|
+
const SVG_H = BW * 4.75;
|
|
5893
|
+
const rowDY = -(IH / 2 + SH);
|
|
5894
|
+
const baseX = SVG_W - BW / 2;
|
|
5895
|
+
const baseY = SVG_H;
|
|
5896
|
+
const boxes = [];
|
|
5897
|
+
for (let row = 0; row < ROWS; row++) for (let col = 0; col < COLS; col++) {
|
|
5898
|
+
const cx = baseX - col * BW + row * (BW / 2);
|
|
5899
|
+
const cy = baseY + row * rowDY;
|
|
5900
|
+
boxes.push({
|
|
5901
|
+
cx,
|
|
5902
|
+
cy,
|
|
5903
|
+
key: `${row}-${col}`
|
|
5904
|
+
});
|
|
5905
|
+
}
|
|
5906
|
+
return /* @__PURE__ */ jsx("svg", {
|
|
5907
|
+
"aria-hidden": "true",
|
|
5908
|
+
className: `pointer-events-none absolute bottom-0 right-0 ${className}`,
|
|
5909
|
+
width: SVG_W,
|
|
5910
|
+
height: SVG_H,
|
|
5911
|
+
viewBox: `0 0 ${SVG_W} ${SVG_H}`,
|
|
5912
|
+
style: { zIndex: 0 },
|
|
5913
|
+
overflow: "visible",
|
|
5914
|
+
children: [...boxes].sort((a, b) => {
|
|
5915
|
+
const [ar, ac] = a.key.split("-").map(Number);
|
|
5916
|
+
const [br, bc] = b.key.split("-").map(Number);
|
|
5917
|
+
if (ar !== br) return (br ?? 0) - (ar ?? 0);
|
|
5918
|
+
return (bc ?? 0) - (ac ?? 0);
|
|
5919
|
+
}).map(({ cx, cy, key }) => /* @__PURE__ */ jsx(Box, {
|
|
5920
|
+
cx,
|
|
5921
|
+
cy
|
|
5922
|
+
}, key))
|
|
5923
|
+
});
|
|
5924
|
+
}
|
|
5925
|
+
//#endregion
|
|
5926
|
+
//#region src/ui-library/gallery/template-samples/templates/PayslipTemplate.tsx
|
|
5927
|
+
var DEDUCTIONS = [
|
|
5928
|
+
{
|
|
5929
|
+
label: "W-Tax",
|
|
5930
|
+
amount: 117.59,
|
|
5931
|
+
remainingBalance: void 0,
|
|
5932
|
+
base: void 0
|
|
5933
|
+
},
|
|
5934
|
+
{
|
|
5935
|
+
label: "Pag-Ibig",
|
|
5936
|
+
amount: 100,
|
|
5937
|
+
remainingBalance: void 0,
|
|
5938
|
+
base: void 0
|
|
5939
|
+
},
|
|
5940
|
+
{
|
|
5941
|
+
label: "HMO Premium",
|
|
5942
|
+
amount: 229.99,
|
|
5943
|
+
remainingBalance: void 0,
|
|
5944
|
+
base: 5059.84
|
|
5945
|
+
},
|
|
5946
|
+
{
|
|
5947
|
+
label: "Insurance",
|
|
5948
|
+
amount: 19.44,
|
|
5949
|
+
remainingBalance: void 0,
|
|
5950
|
+
base: 427.62
|
|
5951
|
+
},
|
|
5952
|
+
{
|
|
5953
|
+
label: "COOP Share",
|
|
5954
|
+
amount: 300,
|
|
5955
|
+
remainingBalance: 4500,
|
|
5956
|
+
base: void 0
|
|
5957
|
+
},
|
|
5958
|
+
{
|
|
5959
|
+
label: "Salary Loan",
|
|
5960
|
+
amount: 1250,
|
|
5961
|
+
remainingBalance: 12500,
|
|
5962
|
+
base: void 0
|
|
5963
|
+
}
|
|
5964
|
+
];
|
|
5965
|
+
var ATTENDANCE_LOGS = [
|
|
5966
|
+
{
|
|
5967
|
+
in: "07:00",
|
|
5968
|
+
out: "16:00"
|
|
5969
|
+
},
|
|
5970
|
+
{
|
|
5971
|
+
in: "07:15",
|
|
5972
|
+
out: "16:00"
|
|
5973
|
+
},
|
|
5974
|
+
{
|
|
5975
|
+
in: "Reg. Hol",
|
|
5976
|
+
out: "Reg. Hol"
|
|
5977
|
+
},
|
|
5978
|
+
{
|
|
5979
|
+
in: "Sp. Hol",
|
|
5980
|
+
out: "Sp. Hol"
|
|
5981
|
+
},
|
|
5982
|
+
{
|
|
5983
|
+
in: "-",
|
|
5984
|
+
out: "-"
|
|
5985
|
+
},
|
|
5986
|
+
{
|
|
5987
|
+
in: "-",
|
|
5988
|
+
out: "-"
|
|
5989
|
+
},
|
|
5990
|
+
{
|
|
5991
|
+
in: "07:00",
|
|
5992
|
+
out: "16:00"
|
|
5993
|
+
},
|
|
5994
|
+
{
|
|
5995
|
+
in: "VL w/pay",
|
|
5996
|
+
out: "VL w/pay"
|
|
5997
|
+
},
|
|
5998
|
+
{
|
|
5999
|
+
in: "SL w/pay",
|
|
6000
|
+
out: "SL w/pay"
|
|
6001
|
+
},
|
|
6002
|
+
{
|
|
6003
|
+
in: "07:00",
|
|
6004
|
+
out: "12:00 (VL)"
|
|
6005
|
+
},
|
|
6006
|
+
{
|
|
6007
|
+
in: "07:00",
|
|
6008
|
+
out: "13:00 (SL)"
|
|
6009
|
+
},
|
|
6010
|
+
{
|
|
6011
|
+
in: "07:00 (RH)",
|
|
6012
|
+
out: "16:00"
|
|
6013
|
+
},
|
|
6014
|
+
{
|
|
6015
|
+
in: "-",
|
|
6016
|
+
out: "-"
|
|
6017
|
+
},
|
|
6018
|
+
{
|
|
6019
|
+
in: "07:00",
|
|
6020
|
+
out: "16:00"
|
|
6021
|
+
},
|
|
6022
|
+
{
|
|
6023
|
+
in: "07:00",
|
|
6024
|
+
out: "16:00"
|
|
6025
|
+
},
|
|
6026
|
+
{
|
|
6027
|
+
in: "07:00",
|
|
6028
|
+
out: "16:00"
|
|
6029
|
+
}
|
|
6030
|
+
];
|
|
6031
|
+
var WHOLE_DAY_TYPES = /* @__PURE__ */ new Set([
|
|
6032
|
+
"Reg. Hol",
|
|
6033
|
+
"Sp. Hol",
|
|
6034
|
+
"VL w/pay",
|
|
6035
|
+
"VL wo/pay",
|
|
6036
|
+
"SL w/pay",
|
|
6037
|
+
"SL wo/pay"
|
|
6038
|
+
]);
|
|
6039
|
+
var fc = (n) => n.toLocaleString(void 0, {
|
|
6040
|
+
minimumFractionDigits: 2,
|
|
6041
|
+
maximumFractionDigits: 2
|
|
6042
|
+
});
|
|
6043
|
+
var fr = (n) => n.toLocaleString(void 0, {
|
|
6044
|
+
minimumFractionDigits: 2,
|
|
6045
|
+
maximumFractionDigits: 6
|
|
6046
|
+
});
|
|
6047
|
+
function AttendanceTable({ logs }) {
|
|
6048
|
+
return /* @__PURE__ */ jsxs("table", {
|
|
6049
|
+
className: "flex-1 w-full text-center",
|
|
6050
|
+
children: [/* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsxs("tr", {
|
|
6051
|
+
className: "border-b border-black",
|
|
6052
|
+
children: [
|
|
6053
|
+
/* @__PURE__ */ jsx("th", {
|
|
6054
|
+
className: "font-black text-[8px]",
|
|
6055
|
+
children: "Date"
|
|
6056
|
+
}),
|
|
6057
|
+
/* @__PURE__ */ jsx("th", {
|
|
6058
|
+
className: "font-black text-[8px]",
|
|
6059
|
+
children: "IN"
|
|
6060
|
+
}),
|
|
6061
|
+
/* @__PURE__ */ jsx("th", {
|
|
6062
|
+
className: "font-black text-[8px]",
|
|
6063
|
+
children: "OUT"
|
|
6064
|
+
})
|
|
6065
|
+
]
|
|
6066
|
+
}) }), /* @__PURE__ */ jsx("tbody", { children: logs.map((log, i) => {
|
|
6067
|
+
const isWholeDay = WHOLE_DAY_TYPES.has(log.in) && log.in === log.out;
|
|
6068
|
+
const isAbsence = log.in === "-" && log.out === "-";
|
|
6069
|
+
const isTiny = log.in.includes("(") || log.out.includes("(");
|
|
6070
|
+
return /* @__PURE__ */ jsxs("tr", { children: [/* @__PURE__ */ jsx("td", {
|
|
6071
|
+
className: "font-bold text-[8px]",
|
|
6072
|
+
children: log.date
|
|
6073
|
+
}), isWholeDay ? /* @__PURE__ */ jsx("td", {
|
|
6074
|
+
colSpan: 2,
|
|
6075
|
+
className: "text-center font-bold text-[5px] tracking-tight uppercase border-b border-black/10",
|
|
6076
|
+
children: log.in
|
|
6077
|
+
}) : isAbsence ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("td", {
|
|
6078
|
+
className: "text-[6px]",
|
|
6079
|
+
children: "—"
|
|
6080
|
+
}), /* @__PURE__ */ jsx("td", {
|
|
6081
|
+
className: "text-[6px]",
|
|
6082
|
+
children: "—"
|
|
6083
|
+
})] }) : /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("td", {
|
|
6084
|
+
className: isTiny ? "text-[5px]" : "text-[8px]",
|
|
6085
|
+
children: log.in
|
|
6086
|
+
}), /* @__PURE__ */ jsx("td", {
|
|
6087
|
+
className: isTiny ? "text-[5px]" : "text-[8px]",
|
|
6088
|
+
children: log.out
|
|
6089
|
+
})] })] }, i);
|
|
6090
|
+
}) })]
|
|
6091
|
+
});
|
|
6092
|
+
}
|
|
6093
|
+
function PayslipTemplate({ data }) {
|
|
6094
|
+
const rates = data.rates ?? {
|
|
6095
|
+
hourly: 107.9713,
|
|
6096
|
+
daily: 863.77,
|
|
6097
|
+
monthly: 22601.9
|
|
6098
|
+
};
|
|
6099
|
+
const taxCode = data.taxCode ?? "S";
|
|
6100
|
+
const taxableGross = data.taxableGross ?? (data.netPay ? data.netPay * 1.1 : 22601.9);
|
|
6101
|
+
const nonTaxableGross = data.nonTaxableGross ?? 0;
|
|
6102
|
+
const totalGross = taxableGross + nonTaxableGross;
|
|
6103
|
+
const totalDeductions = DEDUCTIONS.reduce((s, d) => s + d.amount, 0);
|
|
6104
|
+
const finalNet = totalGross - totalDeductions;
|
|
6105
|
+
const buildLogs = () => {
|
|
6106
|
+
const period = data.payPeriod;
|
|
6107
|
+
return ATTENDANCE_LOGS.map((log, idx) => {
|
|
6108
|
+
let date = String(16 + idx).padStart(2, "0");
|
|
6109
|
+
if (period && period.includes("-")) {
|
|
6110
|
+
const monthMap = {
|
|
6111
|
+
Jan: 0,
|
|
6112
|
+
Feb: 1,
|
|
6113
|
+
Mar: 2,
|
|
6114
|
+
Apr: 3,
|
|
6115
|
+
May: 4,
|
|
6116
|
+
Jun: 5,
|
|
6117
|
+
Jul: 6,
|
|
6118
|
+
Aug: 7,
|
|
6119
|
+
Sep: 8,
|
|
6120
|
+
Oct: 9,
|
|
6121
|
+
Nov: 10,
|
|
6122
|
+
Dec: 11
|
|
6123
|
+
};
|
|
6124
|
+
const parts = period.split(" ");
|
|
6125
|
+
const startMonth = monthMap[parts[0]] ?? 0;
|
|
6126
|
+
const startDay = parseInt(parts[1]) || 1;
|
|
6127
|
+
const year = parseInt(period.match(/\d{4}$/)?.[0] ?? String((/* @__PURE__ */ new Date()).getFullYear()));
|
|
6128
|
+
const d = new Date(year, startMonth, startDay + idx);
|
|
6129
|
+
date = `${String(d.getMonth() + 1).padStart(2, "0")}/${String(d.getDate()).padStart(2, "0")}`;
|
|
6130
|
+
}
|
|
6131
|
+
return {
|
|
6132
|
+
...log,
|
|
6133
|
+
date
|
|
6134
|
+
};
|
|
6135
|
+
});
|
|
6136
|
+
};
|
|
6137
|
+
const logs = buildLogs();
|
|
6138
|
+
const leftLogs = logs.slice(0, 8);
|
|
6139
|
+
const rightLogs = logs.slice(8, 16);
|
|
6140
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
6141
|
+
className: "bg-white text-[#1a1a1a] p-8 font-mono text-[10px] max-w-[900px] mx-auto leading-tight",
|
|
6142
|
+
children: [
|
|
6143
|
+
/* @__PURE__ */ jsxs("div", {
|
|
6144
|
+
className: "grid grid-cols-12 gap-0 mb-2 items-start h-[70px]",
|
|
6145
|
+
children: [
|
|
6146
|
+
/* @__PURE__ */ jsxs("div", {
|
|
6147
|
+
className: "col-span-4 translate-y-2",
|
|
6148
|
+
children: [
|
|
6149
|
+
/* @__PURE__ */ jsx("h1", {
|
|
6150
|
+
className: "text-lg font-black tracking-tight leading-none mb-2",
|
|
6151
|
+
children: "DIWA HRIS PAYSLIP"
|
|
6152
|
+
}),
|
|
6153
|
+
/* @__PURE__ */ jsxs("p", {
|
|
6154
|
+
className: "font-bold flex gap-1 text-[9px]",
|
|
6155
|
+
children: ["Period: ", /* @__PURE__ */ jsx("span", {
|
|
6156
|
+
className: "font-normal",
|
|
6157
|
+
children: data.payPeriod || "No Period Selected"
|
|
6158
|
+
})]
|
|
6159
|
+
}),
|
|
6160
|
+
/* @__PURE__ */ jsxs("p", {
|
|
6161
|
+
className: "font-bold flex gap-1 text-[8px]",
|
|
6162
|
+
children: ["Printed: ", /* @__PURE__ */ jsx("span", {
|
|
6163
|
+
className: "font-normal",
|
|
6164
|
+
children: (/* @__PURE__ */ new Date()).toLocaleDateString()
|
|
6165
|
+
})]
|
|
6166
|
+
})
|
|
6167
|
+
]
|
|
6168
|
+
}),
|
|
6169
|
+
/* @__PURE__ */ jsxs("div", {
|
|
6170
|
+
className: "col-span-4 border border-black p-1.5 mt-2 mb-1 relative z-10",
|
|
6171
|
+
children: [
|
|
6172
|
+
/* @__PURE__ */ jsxs("div", {
|
|
6173
|
+
className: "flex gap-2 mb-0.5 border-b border-black pb-0.5",
|
|
6174
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
6175
|
+
className: "font-black border-r border-black pr-2",
|
|
6176
|
+
children: data.id
|
|
6177
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
6178
|
+
className: "font-black tracking-tight",
|
|
6179
|
+
children: data.name.toUpperCase()
|
|
6180
|
+
})]
|
|
6181
|
+
}),
|
|
6182
|
+
/* @__PURE__ */ jsx("div", {
|
|
6183
|
+
className: "font-bold text-[9px] border-b border-black pb-0.5 mb-0.5",
|
|
6184
|
+
children: data.role
|
|
6185
|
+
}),
|
|
6186
|
+
/* @__PURE__ */ jsx("div", {
|
|
6187
|
+
className: "font-bold text-[9px]",
|
|
6188
|
+
children: data.department
|
|
6189
|
+
})
|
|
6190
|
+
]
|
|
6191
|
+
}),
|
|
6192
|
+
/* @__PURE__ */ jsx("div", {
|
|
6193
|
+
className: "col-span-4 text-[9px] pl-8 text-right pr-2 mt-4 space-y-0",
|
|
6194
|
+
children: [
|
|
6195
|
+
["Hourly :", fr(rates.hourly)],
|
|
6196
|
+
["Daily :", fr(rates.daily)],
|
|
6197
|
+
["Monthly :", fr(rates.monthly)],
|
|
6198
|
+
["Tax Code :", taxCode]
|
|
6199
|
+
].map(([k, v]) => /* @__PURE__ */ jsxs("div", {
|
|
6200
|
+
className: "grid grid-cols-2",
|
|
6201
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
6202
|
+
className: "text-left font-bold",
|
|
6203
|
+
children: k
|
|
6204
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
6205
|
+
className: "font-bold",
|
|
6206
|
+
children: v
|
|
6207
|
+
})]
|
|
6208
|
+
}, k))
|
|
6209
|
+
})
|
|
6210
|
+
]
|
|
6211
|
+
}),
|
|
6212
|
+
/* @__PURE__ */ jsxs("div", {
|
|
6213
|
+
className: "grid grid-cols-12 border-t border-black min-h-[160px]",
|
|
6214
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
6215
|
+
className: "col-span-8 grid grid-cols-2 border-r border-black min-h-[160px]",
|
|
6216
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
6217
|
+
className: "border-r border-black p-1 flex flex-col h-full",
|
|
6218
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
6219
|
+
className: "flex-1",
|
|
6220
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
6221
|
+
className: "font-black border-b border-black mb-1 p-0.5 flex justify-between",
|
|
6222
|
+
children: [/* @__PURE__ */ jsx("span", { children: "EARNINGS:" }), /* @__PURE__ */ jsxs("div", {
|
|
6223
|
+
className: "flex gap-8 text-[7px] pr-2 items-center",
|
|
6224
|
+
children: [/* @__PURE__ */ jsx("span", { children: "UNIT" }), /* @__PURE__ */ jsx("span", { children: "AMOUNT" })]
|
|
6225
|
+
})]
|
|
6226
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
6227
|
+
className: "space-y-0.5",
|
|
6228
|
+
children: [
|
|
6229
|
+
/* @__PURE__ */ jsxs("div", {
|
|
6230
|
+
className: "grid grid-cols-12 gap-1 px-1",
|
|
6231
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
6232
|
+
className: "col-span-7",
|
|
6233
|
+
children: "Basic Salary"
|
|
6234
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
6235
|
+
className: "col-span-5 text-right",
|
|
6236
|
+
children: fc(taxableGross)
|
|
6237
|
+
})]
|
|
6238
|
+
}),
|
|
6239
|
+
/* @__PURE__ */ jsxs("div", {
|
|
6240
|
+
className: "grid grid-cols-12 gap-1 px-1",
|
|
6241
|
+
children: [
|
|
6242
|
+
/* @__PURE__ */ jsx("span", {
|
|
6243
|
+
className: "col-span-6",
|
|
6244
|
+
children: "Holiday Pay"
|
|
6245
|
+
}),
|
|
6246
|
+
/* @__PURE__ */ jsx("span", {
|
|
6247
|
+
className: "col-span-2 text-right",
|
|
6248
|
+
children: "1.00"
|
|
6249
|
+
}),
|
|
6250
|
+
/* @__PURE__ */ jsx("span", {
|
|
6251
|
+
className: "col-span-4 text-right",
|
|
6252
|
+
children: "863.77"
|
|
6253
|
+
})
|
|
6254
|
+
]
|
|
6255
|
+
}),
|
|
6256
|
+
/* @__PURE__ */ jsxs("div", {
|
|
6257
|
+
className: "grid grid-cols-12 gap-1 px-1 italic",
|
|
6258
|
+
children: [
|
|
6259
|
+
/* @__PURE__ */ jsx("span", {
|
|
6260
|
+
className: "col-span-6",
|
|
6261
|
+
children: "Absences"
|
|
6262
|
+
}),
|
|
6263
|
+
/* @__PURE__ */ jsx("span", {
|
|
6264
|
+
className: "col-span-2 text-right",
|
|
6265
|
+
children: "1.00"
|
|
6266
|
+
}),
|
|
6267
|
+
/* @__PURE__ */ jsxs("span", {
|
|
6268
|
+
className: "col-span-4 text-right",
|
|
6269
|
+
children: [
|
|
6270
|
+
"(",
|
|
6271
|
+
fc(863.77),
|
|
6272
|
+
")"
|
|
6273
|
+
]
|
|
6274
|
+
})
|
|
6275
|
+
]
|
|
6276
|
+
})
|
|
6277
|
+
]
|
|
6278
|
+
})]
|
|
6279
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
6280
|
+
className: "pt-2 border-t border-dotted border-black space-y-0.5",
|
|
6281
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
6282
|
+
className: "grid grid-cols-12 gap-1 px-1",
|
|
6283
|
+
children: [/* @__PURE__ */ jsxs("span", {
|
|
6284
|
+
className: "col-span-8 font-bold",
|
|
6285
|
+
children: ["Gross ", /* @__PURE__ */ jsx("span", {
|
|
6286
|
+
className: "font-normal",
|
|
6287
|
+
children: "(taxable)"
|
|
6288
|
+
})]
|
|
6289
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
6290
|
+
className: "col-span-4 text-right",
|
|
6291
|
+
children: fc(taxableGross)
|
|
6292
|
+
})]
|
|
6293
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
6294
|
+
className: "grid grid-cols-12 gap-1 px-1",
|
|
6295
|
+
children: [/* @__PURE__ */ jsxs("span", {
|
|
6296
|
+
className: "col-span-8 font-bold",
|
|
6297
|
+
children: ["Gross ", /* @__PURE__ */ jsx("span", {
|
|
6298
|
+
className: "font-normal",
|
|
6299
|
+
children: "(nontaxable)"
|
|
6300
|
+
})]
|
|
6301
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
6302
|
+
className: "col-span-4 text-right",
|
|
6303
|
+
children: fc(nonTaxableGross)
|
|
6304
|
+
})]
|
|
6305
|
+
})]
|
|
6306
|
+
})]
|
|
6307
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
6308
|
+
className: "p-1",
|
|
6309
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
6310
|
+
className: "font-black border-b border-black mb-1 p-0.5 flex justify-between",
|
|
6311
|
+
children: [/* @__PURE__ */ jsx("span", { children: "DEDUCTIONS:" }), /* @__PURE__ */ jsxs("div", {
|
|
6312
|
+
className: "flex gap-4 text-[7px] pr-2 items-center",
|
|
6313
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
6314
|
+
className: "w-16 text-center",
|
|
6315
|
+
children: "REM. BAL"
|
|
6316
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
6317
|
+
className: "w-12 text-right",
|
|
6318
|
+
children: "AMOUNT"
|
|
6319
|
+
})]
|
|
6320
|
+
})]
|
|
6321
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
6322
|
+
className: "space-y-0.5",
|
|
6323
|
+
children: DEDUCTIONS.map((d, i) => /* @__PURE__ */ jsxs("div", {
|
|
6324
|
+
className: "grid grid-cols-12 gap-1 px-1",
|
|
6325
|
+
children: [
|
|
6326
|
+
/* @__PURE__ */ jsx("span", {
|
|
6327
|
+
className: "col-span-5",
|
|
6328
|
+
children: d.label
|
|
6329
|
+
}),
|
|
6330
|
+
/* @__PURE__ */ jsx("span", {
|
|
6331
|
+
className: "col-span-3 text-center text-[8px] text-slate-500",
|
|
6332
|
+
children: d.remainingBalance ? fc(d.remainingBalance) : d.base ? fc(d.base) : ""
|
|
6333
|
+
}),
|
|
6334
|
+
/* @__PURE__ */ jsx("span", {
|
|
6335
|
+
className: "col-span-4 text-right",
|
|
6336
|
+
children: fc(d.amount)
|
|
6337
|
+
})
|
|
6338
|
+
]
|
|
6339
|
+
}, i))
|
|
6340
|
+
})]
|
|
6341
|
+
})]
|
|
6342
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
6343
|
+
className: "col-span-4 p-1 text-[8px]",
|
|
6344
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
6345
|
+
className: "flex gap-4",
|
|
6346
|
+
children: [/* @__PURE__ */ jsx(AttendanceTable, { logs: leftLogs }), /* @__PURE__ */ jsx(AttendanceTable, { logs: rightLogs })]
|
|
6347
|
+
})
|
|
6348
|
+
})]
|
|
6349
|
+
}),
|
|
6350
|
+
/* @__PURE__ */ jsx("div", {
|
|
6351
|
+
className: "border-t border-black mb-1",
|
|
6352
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
6353
|
+
className: "grid grid-cols-12",
|
|
6354
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
6355
|
+
className: "col-span-8 border-r border-black",
|
|
6356
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
6357
|
+
className: "grid grid-cols-2 bg-slate-100 py-1.5 border-y border-black font-black uppercase tracking-tight",
|
|
6358
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
6359
|
+
className: "grid grid-cols-12 px-2 border-r border-black",
|
|
6360
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
6361
|
+
className: "col-span-7",
|
|
6362
|
+
children: "Total Gross"
|
|
6363
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
6364
|
+
className: "col-span-5 text-right",
|
|
6365
|
+
children: fc(totalGross)
|
|
6366
|
+
})]
|
|
6367
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
6368
|
+
className: "grid grid-cols-12 px-2",
|
|
6369
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
6370
|
+
className: "col-span-8 text-right pr-4",
|
|
6371
|
+
children: "Total Deductions:"
|
|
6372
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
6373
|
+
className: "col-span-4 text-right",
|
|
6374
|
+
children: fc(totalDeductions)
|
|
6375
|
+
})]
|
|
6376
|
+
})]
|
|
6377
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
6378
|
+
className: "p-1 px-2 flex gap-4 items-center h-8",
|
|
6379
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
6380
|
+
className: "text-[11px] font-black uppercase",
|
|
6381
|
+
children: "Net Pay:"
|
|
6382
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
6383
|
+
className: "text-[16px] font-black pl-4",
|
|
6384
|
+
children: fc(finalNet)
|
|
6385
|
+
})]
|
|
6386
|
+
})]
|
|
6387
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
6388
|
+
className: "col-span-4 p-1 px-2",
|
|
6389
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
6390
|
+
className: "grid grid-cols-2 border border-black text-center mb-2",
|
|
6391
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
6392
|
+
className: "border-r border-black p-0.5",
|
|
6393
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
6394
|
+
className: "border-b border-black font-bold uppercase text-[7px] mb-0.5",
|
|
6395
|
+
children: "YTD Gross"
|
|
6396
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
6397
|
+
className: "font-black text-[12px]",
|
|
6398
|
+
children: fc(data.ytd?.gross ?? taxableGross)
|
|
6399
|
+
})]
|
|
6400
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
6401
|
+
className: "p-0.5",
|
|
6402
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
6403
|
+
className: "border-b border-black font-bold uppercase text-[7px] mb-0.5",
|
|
6404
|
+
children: "YTD Tax"
|
|
6405
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
6406
|
+
className: "font-black text-[12px]",
|
|
6407
|
+
children: fc(data.ytd?.tax ?? totalDeductions * .1)
|
|
6408
|
+
})]
|
|
6409
|
+
})]
|
|
6410
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
6411
|
+
className: "flex justify-between text-[8px] font-bold uppercase px-1 pb-0.5 pt-1",
|
|
6412
|
+
children: [
|
|
6413
|
+
["VL", data.leaveBalances?.vacation.remaining ?? 10],
|
|
6414
|
+
["SL", data.leaveBalances?.sick.remaining ?? 14],
|
|
6415
|
+
["PL", data.leaveBalances?.personal?.remaining ?? 0]
|
|
6416
|
+
].map(([k, v]) => /* @__PURE__ */ jsxs("div", {
|
|
6417
|
+
className: "flex gap-1",
|
|
6418
|
+
children: [/* @__PURE__ */ jsxs("span", { children: [k, " Bal:"] }), /* @__PURE__ */ jsx("span", {
|
|
6419
|
+
className: "font-normal",
|
|
6420
|
+
children: String(v)
|
|
6421
|
+
})]
|
|
6422
|
+
}, String(k)))
|
|
6423
|
+
})]
|
|
6424
|
+
})]
|
|
6425
|
+
})
|
|
6426
|
+
}),
|
|
6427
|
+
/* @__PURE__ */ jsx("div", {
|
|
6428
|
+
className: "mt-4 border-t-2 border-dashed border-black pt-2 opacity-30 text-center",
|
|
6429
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
6430
|
+
className: "text-[7px] font-black uppercase tracking-[0.2em] italic",
|
|
6431
|
+
children: "Authorized Document — DIWA HRIS Fin-Audit System"
|
|
6432
|
+
})
|
|
6433
|
+
})
|
|
6434
|
+
]
|
|
6435
|
+
});
|
|
6436
|
+
}
|
|
6437
|
+
//#endregion
|
|
6438
|
+
//#region src/ui-library/gallery/template-samples/templates/ReportTemplate.tsx
|
|
6439
|
+
var MOCK_ROWS = [
|
|
6440
|
+
{
|
|
6441
|
+
id: "DL-0001",
|
|
6442
|
+
name: "Maria Santos",
|
|
6443
|
+
dept: "Finance",
|
|
6444
|
+
position: "Senior Accountant",
|
|
6445
|
+
status: "Regular",
|
|
6446
|
+
dateHired: "Jan 15, 2021",
|
|
6447
|
+
rate: "25,000.00"
|
|
6448
|
+
},
|
|
6449
|
+
{
|
|
6450
|
+
id: "DL-0002",
|
|
6451
|
+
name: "Jose Reyes",
|
|
6452
|
+
dept: "IT",
|
|
6453
|
+
position: "IT Infrastructure Lead",
|
|
6454
|
+
status: "Regular",
|
|
6455
|
+
dateHired: "Mar 08, 2020",
|
|
6456
|
+
rate: "38,000.00"
|
|
6457
|
+
},
|
|
6458
|
+
{
|
|
6459
|
+
id: "DL-0003",
|
|
6460
|
+
name: "Ana Dela Cruz",
|
|
6461
|
+
dept: "HR",
|
|
6462
|
+
position: "HR Business Partner",
|
|
6463
|
+
status: "Regular",
|
|
6464
|
+
dateHired: "Jun 01, 2019",
|
|
6465
|
+
rate: "32,000.00"
|
|
6466
|
+
},
|
|
6467
|
+
{
|
|
6468
|
+
id: "DL-0004",
|
|
6469
|
+
name: "Carlo Mendoza",
|
|
6470
|
+
dept: "Operations",
|
|
6471
|
+
position: "Operations Manager",
|
|
6472
|
+
status: "Regular",
|
|
6473
|
+
dateHired: "Sep 22, 2022",
|
|
6474
|
+
rate: "45,000.00"
|
|
6475
|
+
},
|
|
6476
|
+
{
|
|
6477
|
+
id: "DL-0005",
|
|
6478
|
+
name: "Liza Bautista",
|
|
6479
|
+
dept: "Legal",
|
|
6480
|
+
position: "Legal Counsel",
|
|
6481
|
+
status: "Probationary",
|
|
6482
|
+
dateHired: "Feb 10, 2024",
|
|
6483
|
+
rate: "28,000.00"
|
|
6484
|
+
},
|
|
6485
|
+
{
|
|
6486
|
+
id: "DL-0006",
|
|
6487
|
+
name: "Mark Villanueva",
|
|
6488
|
+
dept: "Academic",
|
|
6489
|
+
position: "Academic Coordinator",
|
|
6490
|
+
status: "Regular",
|
|
6491
|
+
dateHired: "Nov 03, 2023",
|
|
6492
|
+
rate: "22,000.00"
|
|
6493
|
+
},
|
|
6494
|
+
{
|
|
6495
|
+
id: "DL-0007",
|
|
6496
|
+
name: "Rosa Castillo",
|
|
6497
|
+
dept: "Finance",
|
|
6498
|
+
position: "Bookkeeper",
|
|
6499
|
+
status: "Regular",
|
|
6500
|
+
dateHired: "Apr 14, 2018",
|
|
6501
|
+
rate: "20,000.00"
|
|
6502
|
+
},
|
|
6503
|
+
{
|
|
6504
|
+
id: "DL-0008",
|
|
6505
|
+
name: "Noel Ramos",
|
|
6506
|
+
dept: "IT",
|
|
6507
|
+
position: "Systems Analyst",
|
|
6508
|
+
status: "Regular",
|
|
6509
|
+
dateHired: "Jul 30, 2021",
|
|
6510
|
+
rate: "30,000.00"
|
|
6511
|
+
},
|
|
6512
|
+
{
|
|
6513
|
+
id: "DL-0009",
|
|
6514
|
+
name: "Cynthia Torres",
|
|
6515
|
+
dept: "HR",
|
|
6516
|
+
position: "Recruitment Officer",
|
|
6517
|
+
status: "Regular",
|
|
6518
|
+
dateHired: "Dec 05, 2022",
|
|
6519
|
+
rate: "24,000.00"
|
|
6520
|
+
},
|
|
6521
|
+
{
|
|
6522
|
+
id: "DL-0010",
|
|
6523
|
+
name: "Ramon Aquino",
|
|
6524
|
+
dept: "Operations",
|
|
6525
|
+
position: "Logistics Coordinator",
|
|
6526
|
+
status: "Probationary",
|
|
6527
|
+
dateHired: "Aug 18, 2024",
|
|
6528
|
+
rate: "19,500.00"
|
|
6529
|
+
},
|
|
6530
|
+
{
|
|
6531
|
+
id: "DL-0011",
|
|
6532
|
+
name: "Elena Fuentes",
|
|
6533
|
+
dept: "Academic",
|
|
6534
|
+
position: "Faculty Member",
|
|
6535
|
+
status: "Regular",
|
|
6536
|
+
dateHired: "Jun 12, 2017",
|
|
6537
|
+
rate: "27,000.00"
|
|
6538
|
+
},
|
|
6539
|
+
{
|
|
6540
|
+
id: "DL-0012",
|
|
6541
|
+
name: "Dennis Lacerna",
|
|
6542
|
+
dept: "Finance",
|
|
6543
|
+
position: "Payroll Officer",
|
|
6544
|
+
status: "Regular",
|
|
6545
|
+
dateHired: "Oct 01, 2020",
|
|
6546
|
+
rate: "23,500.00"
|
|
6547
|
+
}
|
|
6548
|
+
];
|
|
6549
|
+
var HEADERS = [
|
|
6550
|
+
"#",
|
|
6551
|
+
"Employee ID",
|
|
6552
|
+
"Full Name",
|
|
6553
|
+
"Department",
|
|
6554
|
+
"Position",
|
|
6555
|
+
"Status",
|
|
6556
|
+
"Date Hired",
|
|
6557
|
+
"Monthly Rate"
|
|
6558
|
+
];
|
|
6559
|
+
function ReportTemplate({ data }) {
|
|
6560
|
+
const today = (/* @__PURE__ */ new Date()).toLocaleDateString("en-US", {
|
|
6561
|
+
month: "long",
|
|
6562
|
+
day: "numeric",
|
|
6563
|
+
year: "numeric"
|
|
6564
|
+
});
|
|
6565
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
6566
|
+
className: "bg-white text-black font-sans",
|
|
6567
|
+
style: {
|
|
6568
|
+
width: "816px",
|
|
6569
|
+
minHeight: "1056px",
|
|
6570
|
+
padding: "48px 50px",
|
|
6571
|
+
boxSizing: "border-box"
|
|
6572
|
+
},
|
|
6573
|
+
children: [
|
|
6574
|
+
/* @__PURE__ */ jsxs("div", {
|
|
6575
|
+
className: "flex justify-between items-start mb-6 border-b-2 border-black pb-4",
|
|
6576
|
+
children: [/* @__PURE__ */ jsxs("div", { children: [
|
|
6577
|
+
/* @__PURE__ */ jsx("div", {
|
|
6578
|
+
className: "text-[9px] text-slate-500 uppercase tracking-widest mb-1 font-bold",
|
|
6579
|
+
children: data.company || "DIWA Learning Systems, Inc."
|
|
6580
|
+
}),
|
|
6581
|
+
/* @__PURE__ */ jsx("h1", {
|
|
6582
|
+
className: "text-[20px] font-black uppercase tracking-tight leading-tight",
|
|
6583
|
+
children: data.title || "Employee Masterlist Report"
|
|
6584
|
+
}),
|
|
6585
|
+
/* @__PURE__ */ jsx("p", {
|
|
6586
|
+
className: "text-[11px] text-slate-500 mt-0.5 italic",
|
|
6587
|
+
children: data.subtitle || "All Active Employees — Direct Labor"
|
|
6588
|
+
})
|
|
6589
|
+
] }), /* @__PURE__ */ jsxs("div", {
|
|
6590
|
+
className: "text-right text-[9px] space-y-0.5",
|
|
6591
|
+
children: [
|
|
6592
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
6593
|
+
/* @__PURE__ */ jsx("span", {
|
|
6594
|
+
className: "font-bold",
|
|
6595
|
+
children: "As of:"
|
|
6596
|
+
}),
|
|
6597
|
+
" ",
|
|
6598
|
+
data.asOf || today
|
|
6599
|
+
] }),
|
|
6600
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
6601
|
+
/* @__PURE__ */ jsx("span", {
|
|
6602
|
+
className: "font-bold",
|
|
6603
|
+
children: "Date Printed:"
|
|
6604
|
+
}),
|
|
6605
|
+
" ",
|
|
6606
|
+
today
|
|
6607
|
+
] }),
|
|
6608
|
+
/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("span", {
|
|
6609
|
+
className: "font-bold",
|
|
6610
|
+
children: "Page:"
|
|
6611
|
+
}), " 1 of 1"] }),
|
|
6612
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
6613
|
+
/* @__PURE__ */ jsx("span", {
|
|
6614
|
+
className: "font-bold",
|
|
6615
|
+
children: "Prepared by:"
|
|
6616
|
+
}),
|
|
6617
|
+
" ",
|
|
6618
|
+
data.preparedBy || "System"
|
|
6619
|
+
] })
|
|
6620
|
+
]
|
|
6621
|
+
})]
|
|
6622
|
+
}),
|
|
6623
|
+
/* @__PURE__ */ jsx("div", {
|
|
6624
|
+
className: "flex gap-6 mb-5 text-[10px]",
|
|
6625
|
+
children: [
|
|
6626
|
+
["Total Employees", String(MOCK_ROWS.length)],
|
|
6627
|
+
["Regular", String(MOCK_ROWS.filter((r) => r.status === "Regular").length)],
|
|
6628
|
+
["Probationary", String(MOCK_ROWS.filter((r) => r.status === "Probationary").length)],
|
|
6629
|
+
["Departments", "5"]
|
|
6630
|
+
].map(([label, value]) => /* @__PURE__ */ jsxs("div", {
|
|
6631
|
+
className: "border border-black px-3 py-1.5 text-center min-w-[80px]",
|
|
6632
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
6633
|
+
className: "font-black text-[16px]",
|
|
6634
|
+
children: value
|
|
6635
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
6636
|
+
className: "text-[8px] text-slate-500 font-bold uppercase tracking-tight",
|
|
6637
|
+
children: label
|
|
6638
|
+
})]
|
|
6639
|
+
}, label))
|
|
6640
|
+
}),
|
|
6641
|
+
/* @__PURE__ */ jsxs("table", {
|
|
6642
|
+
className: "w-full border-collapse text-[9px]",
|
|
6643
|
+
children: [
|
|
6644
|
+
/* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsx("tr", {
|
|
6645
|
+
className: "bg-[#00377B] text-white",
|
|
6646
|
+
children: HEADERS.map((h) => /* @__PURE__ */ jsx("th", {
|
|
6647
|
+
className: "border border-[#00377B] px-2 py-1.5 text-left font-bold uppercase tracking-wide text-[8px]",
|
|
6648
|
+
children: h
|
|
6649
|
+
}, h))
|
|
6650
|
+
}) }),
|
|
6651
|
+
/* @__PURE__ */ jsx("tbody", { children: MOCK_ROWS.map((row, i) => /* @__PURE__ */ jsxs("tr", {
|
|
6652
|
+
className: i % 2 === 0 ? "bg-white" : "bg-slate-50",
|
|
6653
|
+
children: [
|
|
6654
|
+
/* @__PURE__ */ jsx("td", {
|
|
6655
|
+
className: "border border-slate-200 px-2 py-1 text-slate-400",
|
|
6656
|
+
children: i + 1
|
|
6657
|
+
}),
|
|
6658
|
+
/* @__PURE__ */ jsx("td", {
|
|
6659
|
+
className: "border border-slate-200 px-2 py-1 font-mono font-bold",
|
|
6660
|
+
children: row.id
|
|
6661
|
+
}),
|
|
6662
|
+
/* @__PURE__ */ jsx("td", {
|
|
6663
|
+
className: "border border-slate-200 px-2 py-1 font-bold uppercase",
|
|
6664
|
+
children: row.name
|
|
6665
|
+
}),
|
|
6666
|
+
/* @__PURE__ */ jsx("td", {
|
|
6667
|
+
className: "border border-slate-200 px-2 py-1",
|
|
6668
|
+
children: row.dept
|
|
6669
|
+
}),
|
|
6670
|
+
/* @__PURE__ */ jsx("td", {
|
|
6671
|
+
className: "border border-slate-200 px-2 py-1",
|
|
6672
|
+
children: row.position
|
|
6673
|
+
}),
|
|
6674
|
+
/* @__PURE__ */ jsx("td", {
|
|
6675
|
+
className: "border border-slate-200 px-2 py-1",
|
|
6676
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
6677
|
+
className: ["inline-flex items-center rounded px-1.5 py-0.5 text-[8px] font-bold uppercase tracking-tight", row.status === "Regular" ? "bg-emerald-50 text-emerald-700" : "bg-amber-50 text-amber-700"].join(" "),
|
|
6678
|
+
children: row.status
|
|
6679
|
+
})
|
|
6680
|
+
}),
|
|
6681
|
+
/* @__PURE__ */ jsx("td", {
|
|
6682
|
+
className: "border border-slate-200 px-2 py-1",
|
|
6683
|
+
children: row.dateHired
|
|
6684
|
+
}),
|
|
6685
|
+
/* @__PURE__ */ jsx("td", {
|
|
6686
|
+
className: "border border-slate-200 px-2 py-1 text-right font-mono",
|
|
6687
|
+
children: row.rate
|
|
6688
|
+
})
|
|
6689
|
+
]
|
|
6690
|
+
}, row.id)) }),
|
|
6691
|
+
/* @__PURE__ */ jsx("tfoot", { children: /* @__PURE__ */ jsxs("tr", {
|
|
6692
|
+
className: "bg-slate-100 font-black border-t-2 border-black",
|
|
6693
|
+
children: [/* @__PURE__ */ jsx("td", {
|
|
6694
|
+
colSpan: 7,
|
|
6695
|
+
className: "border border-slate-300 px-2 py-1.5 text-right uppercase text-[8px] tracking-widest",
|
|
6696
|
+
children: "Total Monthly Cost:"
|
|
6697
|
+
}), /* @__PURE__ */ jsx("td", {
|
|
6698
|
+
className: "border border-slate-300 px-2 py-1.5 text-right font-mono",
|
|
6699
|
+
children: MOCK_ROWS.reduce((s, r) => s + parseFloat(r.rate.replace(/,/g, "")), 0).toLocaleString("en-US", { minimumFractionDigits: 2 })
|
|
6700
|
+
})]
|
|
6701
|
+
}) })
|
|
6702
|
+
]
|
|
6703
|
+
}),
|
|
6704
|
+
/* @__PURE__ */ jsxs("div", {
|
|
6705
|
+
className: "mt-8 flex justify-between items-end text-[9px]",
|
|
6706
|
+
children: [/* @__PURE__ */ jsxs("div", { children: [
|
|
6707
|
+
/* @__PURE__ */ jsx("div", { className: "border-b border-black w-48 mb-1" }),
|
|
6708
|
+
/* @__PURE__ */ jsxs("div", {
|
|
6709
|
+
className: "font-bold",
|
|
6710
|
+
children: ["Prepared by: ", data.preparedBy || "HRIS System"]
|
|
6711
|
+
}),
|
|
6712
|
+
/* @__PURE__ */ jsx("div", {
|
|
6713
|
+
className: "text-slate-400",
|
|
6714
|
+
children: "Human Resources Management Division"
|
|
6715
|
+
})
|
|
6716
|
+
] }), /* @__PURE__ */ jsxs("div", {
|
|
6717
|
+
className: "text-right",
|
|
6718
|
+
children: [
|
|
6719
|
+
/* @__PURE__ */ jsx("div", { className: "border-b border-black w-48 mb-1 ml-auto" }),
|
|
6720
|
+
/* @__PURE__ */ jsx("div", {
|
|
6721
|
+
className: "font-bold",
|
|
6722
|
+
children: "Noted by: ___________________________"
|
|
6723
|
+
}),
|
|
6724
|
+
/* @__PURE__ */ jsx("div", {
|
|
6725
|
+
className: "text-slate-400",
|
|
6726
|
+
children: "HR Director / VP Operations"
|
|
6727
|
+
})
|
|
6728
|
+
]
|
|
6729
|
+
})]
|
|
6730
|
+
}),
|
|
6731
|
+
/* @__PURE__ */ jsx("div", {
|
|
6732
|
+
className: "mt-6 border-t border-dashed border-black/40 pt-2 text-center opacity-40",
|
|
6733
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
6734
|
+
className: "text-[7px] font-black uppercase tracking-[0.2em] italic",
|
|
6735
|
+
children: "System-Generated Report — DIWA HRIS — Confidential"
|
|
6736
|
+
})
|
|
6737
|
+
})
|
|
6738
|
+
]
|
|
6739
|
+
});
|
|
6740
|
+
}
|
|
6741
|
+
//#endregion
|
|
6742
|
+
//#region src/ui-library/gallery/template-samples/templates/TimekeepingTemplate.tsx
|
|
6743
|
+
/**
|
|
6744
|
+
* TimekeepingTemplate — self-contained preview component
|
|
6745
|
+
*
|
|
6746
|
+
* Ported from unified-hris/components/TimekeepingFileTemplate.tsx.
|
|
6747
|
+
* No context deps. All data is mock + prop-driven.
|
|
6748
|
+
*/
|
|
6749
|
+
var RECORDS = [
|
|
6750
|
+
{
|
|
6751
|
+
dateIn: "16-Jan-25",
|
|
6752
|
+
day: "Thu",
|
|
6753
|
+
shift: 1,
|
|
6754
|
+
timeIn: "7:00 am",
|
|
6755
|
+
dateOut: "16-Jan-25",
|
|
6756
|
+
timeOut: "4:00 pm",
|
|
6757
|
+
hours: "8.00",
|
|
6758
|
+
actual: "9.00",
|
|
6759
|
+
late: "-",
|
|
6760
|
+
utime: "-",
|
|
6761
|
+
ot: "-",
|
|
6762
|
+
nd2: "-",
|
|
6763
|
+
rem: "-"
|
|
6764
|
+
},
|
|
6765
|
+
{
|
|
6766
|
+
dateIn: "17-Jan-25",
|
|
6767
|
+
day: "Fri",
|
|
6768
|
+
shift: 1,
|
|
6769
|
+
timeIn: "7:15 am",
|
|
6770
|
+
dateOut: "17-Jan-25",
|
|
6771
|
+
timeOut: "4:00 pm",
|
|
6772
|
+
hours: "8.00",
|
|
6773
|
+
actual: "9.00",
|
|
6774
|
+
late: "15",
|
|
6775
|
+
utime: "-",
|
|
6776
|
+
ot: "-",
|
|
6777
|
+
nd2: "-",
|
|
6778
|
+
rem: "-"
|
|
6779
|
+
},
|
|
6780
|
+
{
|
|
6781
|
+
dateIn: "18-Jan-25",
|
|
6782
|
+
day: "Sat",
|
|
6783
|
+
shift: 1,
|
|
6784
|
+
timeIn: "-",
|
|
6785
|
+
dateOut: "-",
|
|
6786
|
+
timeOut: "-",
|
|
6787
|
+
hours: "-",
|
|
6788
|
+
actual: "-",
|
|
6789
|
+
late: "-",
|
|
6790
|
+
utime: "-",
|
|
6791
|
+
ot: "-",
|
|
6792
|
+
nd2: "-",
|
|
6793
|
+
rem: "-"
|
|
6794
|
+
},
|
|
6795
|
+
{
|
|
6796
|
+
dateIn: "19-Jan-25",
|
|
6797
|
+
day: "Sun",
|
|
6798
|
+
shift: 1,
|
|
6799
|
+
timeIn: "-",
|
|
6800
|
+
dateOut: "-",
|
|
6801
|
+
timeOut: "-",
|
|
6802
|
+
hours: "-",
|
|
6803
|
+
actual: "-",
|
|
6804
|
+
late: "-",
|
|
6805
|
+
utime: "-",
|
|
6806
|
+
ot: "-",
|
|
6807
|
+
nd2: "-",
|
|
6808
|
+
rem: "-"
|
|
6809
|
+
},
|
|
6810
|
+
{
|
|
6811
|
+
dateIn: "20-Jan-25",
|
|
6812
|
+
day: "Mon",
|
|
6813
|
+
shift: 1,
|
|
6814
|
+
timeIn: "7:00 am",
|
|
6815
|
+
dateOut: "20-Jan-25",
|
|
6816
|
+
timeOut: "4:00 pm",
|
|
6817
|
+
hours: "8.00",
|
|
6818
|
+
actual: "9.00",
|
|
6819
|
+
late: "-",
|
|
6820
|
+
utime: "-",
|
|
6821
|
+
ot: "-",
|
|
6822
|
+
nd2: "-",
|
|
6823
|
+
rem: "-"
|
|
6824
|
+
},
|
|
6825
|
+
{
|
|
6826
|
+
dateIn: "21-Jan-25",
|
|
6827
|
+
day: "Tue",
|
|
6828
|
+
shift: 1,
|
|
6829
|
+
timeIn: "7:00 am",
|
|
6830
|
+
dateOut: "21-Jan-25",
|
|
6831
|
+
timeOut: "4:00 pm",
|
|
6832
|
+
hours: "8.00",
|
|
6833
|
+
actual: "9.00",
|
|
6834
|
+
late: "-",
|
|
6835
|
+
utime: "-",
|
|
6836
|
+
ot: "-",
|
|
6837
|
+
nd2: "-",
|
|
6838
|
+
rem: "-"
|
|
6839
|
+
},
|
|
6840
|
+
{
|
|
6841
|
+
dateIn: "22-Jan-25",
|
|
6842
|
+
day: "Wed",
|
|
6843
|
+
shift: 1,
|
|
6844
|
+
timeIn: "7:00 am",
|
|
6845
|
+
dateOut: "22-Jan-25",
|
|
6846
|
+
timeOut: "4:00 pm",
|
|
6847
|
+
hours: "8.00",
|
|
6848
|
+
actual: "9.00",
|
|
6849
|
+
late: "-",
|
|
6850
|
+
utime: "-",
|
|
6851
|
+
ot: "-",
|
|
6852
|
+
nd2: "-",
|
|
6853
|
+
rem: "-"
|
|
6854
|
+
},
|
|
6855
|
+
{
|
|
6856
|
+
dateIn: "23-Jan-25",
|
|
6857
|
+
day: "Thu",
|
|
6858
|
+
shift: 1,
|
|
6859
|
+
timeIn: "7:00 am",
|
|
6860
|
+
dateOut: "23-Jan-25",
|
|
6861
|
+
timeOut: "4:00 pm",
|
|
6862
|
+
hours: "8.00",
|
|
6863
|
+
actual: "9.00",
|
|
6864
|
+
late: "-",
|
|
6865
|
+
utime: "-",
|
|
6866
|
+
ot: "-",
|
|
6867
|
+
nd2: "-",
|
|
6868
|
+
rem: "-"
|
|
6869
|
+
},
|
|
6870
|
+
{
|
|
6871
|
+
dateIn: "24-Jan-25",
|
|
6872
|
+
day: "Fri",
|
|
6873
|
+
shift: 1,
|
|
6874
|
+
timeIn: "7:00 am",
|
|
6875
|
+
dateOut: "24-Jan-25",
|
|
6876
|
+
timeOut: "4:00 pm",
|
|
6877
|
+
hours: "8.00",
|
|
6878
|
+
actual: "9.00",
|
|
6879
|
+
late: "-",
|
|
6880
|
+
utime: "-",
|
|
6881
|
+
ot: "-",
|
|
6882
|
+
nd2: "-",
|
|
6883
|
+
rem: "-"
|
|
6884
|
+
},
|
|
6885
|
+
{
|
|
6886
|
+
dateIn: "25-Jan-25",
|
|
6887
|
+
day: "Sat",
|
|
6888
|
+
shift: 1,
|
|
6889
|
+
timeIn: "-",
|
|
6890
|
+
dateOut: "-",
|
|
6891
|
+
timeOut: "-",
|
|
6892
|
+
hours: "-",
|
|
6893
|
+
actual: "-",
|
|
6894
|
+
late: "-",
|
|
6895
|
+
utime: "-",
|
|
6896
|
+
ot: "-",
|
|
6897
|
+
nd2: "-",
|
|
6898
|
+
rem: "-"
|
|
6899
|
+
},
|
|
6900
|
+
{
|
|
6901
|
+
dateIn: "26-Jan-25",
|
|
6902
|
+
day: "Sun",
|
|
6903
|
+
shift: 1,
|
|
6904
|
+
timeIn: "-",
|
|
6905
|
+
dateOut: "-",
|
|
6906
|
+
timeOut: "-",
|
|
6907
|
+
hours: "-",
|
|
6908
|
+
actual: "-",
|
|
6909
|
+
late: "-",
|
|
6910
|
+
utime: "-",
|
|
6911
|
+
ot: "-",
|
|
6912
|
+
nd2: "-",
|
|
6913
|
+
rem: "-"
|
|
6914
|
+
},
|
|
6915
|
+
{
|
|
6916
|
+
dateIn: "27-Jan-25",
|
|
6917
|
+
day: "Mon",
|
|
6918
|
+
shift: 1,
|
|
6919
|
+
timeIn: "7:00 am",
|
|
6920
|
+
dateOut: "27-Jan-25",
|
|
6921
|
+
timeOut: "4:00 pm",
|
|
6922
|
+
hours: "8.00",
|
|
6923
|
+
actual: "9.00",
|
|
6924
|
+
late: "-",
|
|
6925
|
+
utime: "-",
|
|
6926
|
+
ot: "-",
|
|
6927
|
+
nd2: "-",
|
|
6928
|
+
rem: "-"
|
|
6929
|
+
},
|
|
6930
|
+
{
|
|
6931
|
+
dateIn: "28-Jan-25",
|
|
6932
|
+
day: "Tue",
|
|
6933
|
+
shift: 1,
|
|
6934
|
+
timeIn: "7:00 am",
|
|
6935
|
+
dateOut: "28-Jan-25",
|
|
6936
|
+
timeOut: "4:00 pm",
|
|
6937
|
+
hours: "8.00",
|
|
6938
|
+
actual: "9.00",
|
|
6939
|
+
late: "-",
|
|
6940
|
+
utime: "-",
|
|
6941
|
+
ot: "-",
|
|
6942
|
+
nd2: "-",
|
|
6943
|
+
rem: "-"
|
|
6944
|
+
},
|
|
6945
|
+
{
|
|
6946
|
+
dateIn: "29-Jan-25",
|
|
6947
|
+
day: "Wed",
|
|
6948
|
+
shift: 1,
|
|
6949
|
+
timeIn: "-",
|
|
6950
|
+
dateOut: "-",
|
|
6951
|
+
timeOut: "-",
|
|
6952
|
+
hours: "-",
|
|
6953
|
+
actual: "-",
|
|
6954
|
+
late: "-",
|
|
6955
|
+
utime: "-",
|
|
6956
|
+
ot: "-",
|
|
6957
|
+
nd2: "-",
|
|
6958
|
+
rem: "Sp. Hol"
|
|
6959
|
+
},
|
|
6960
|
+
{
|
|
6961
|
+
dateIn: "30-Jan-25",
|
|
6962
|
+
day: "Thu",
|
|
6963
|
+
shift: 1,
|
|
6964
|
+
timeIn: "7:00 am",
|
|
6965
|
+
dateOut: "30-Jan-25",
|
|
6966
|
+
timeOut: "4:00 pm",
|
|
6967
|
+
hours: "8.00",
|
|
6968
|
+
actual: "9.00",
|
|
6969
|
+
late: "-",
|
|
6970
|
+
utime: "-",
|
|
6971
|
+
ot: "-",
|
|
6972
|
+
nd2: "-",
|
|
6973
|
+
rem: "-"
|
|
6974
|
+
},
|
|
6975
|
+
{
|
|
6976
|
+
dateIn: "31-Jan-25",
|
|
6977
|
+
day: "Fri",
|
|
6978
|
+
shift: 1,
|
|
6979
|
+
timeIn: "7:00 am",
|
|
6980
|
+
dateOut: "31-Jan-25",
|
|
6981
|
+
timeOut: "4:00 pm",
|
|
6982
|
+
hours: "8.00",
|
|
6983
|
+
actual: "9.00",
|
|
6984
|
+
late: "-",
|
|
6985
|
+
utime: "-",
|
|
6986
|
+
ot: "-",
|
|
6987
|
+
nd2: "-",
|
|
6988
|
+
rem: "-"
|
|
6989
|
+
}
|
|
6990
|
+
];
|
|
6991
|
+
var OT_SUMMARY = [
|
|
6992
|
+
"OT 0.30",
|
|
6993
|
+
"OT 1.00",
|
|
6994
|
+
"OT 1.25",
|
|
6995
|
+
"OT 1.30",
|
|
6996
|
+
"OT 1.69",
|
|
6997
|
+
"OT 1.50",
|
|
6998
|
+
"OT 1.95",
|
|
6999
|
+
"OT 2.00",
|
|
7000
|
+
"OT 2.69",
|
|
7001
|
+
"OT 3.38"
|
|
7002
|
+
];
|
|
7003
|
+
function TimekeepingTemplate({ data }) {
|
|
7004
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
7005
|
+
className: "w-[297mm] min-h-[210mm] bg-white text-black font-sans text-[10px] leading-tight p-10 mx-auto",
|
|
7006
|
+
children: [
|
|
7007
|
+
/* @__PURE__ */ jsxs("div", {
|
|
7008
|
+
className: "flex justify-between items-start mb-4",
|
|
7009
|
+
children: [/* @__PURE__ */ jsxs("div", { children: [
|
|
7010
|
+
/* @__PURE__ */ jsxs("div", {
|
|
7011
|
+
className: "mb-2 text-[10px]",
|
|
7012
|
+
children: ["DatePrinted: \xA0 ", (/* @__PURE__ */ new Date()).toLocaleDateString("en-US", {
|
|
7013
|
+
month: "2-digit",
|
|
7014
|
+
day: "2-digit",
|
|
7015
|
+
year: "numeric"
|
|
7016
|
+
})]
|
|
7017
|
+
}),
|
|
7018
|
+
/* @__PURE__ */ jsx("h1", {
|
|
7019
|
+
className: "text-xl font-bold uppercase tracking-tight",
|
|
7020
|
+
children: "DIWA HRIS — TimeSheet"
|
|
7021
|
+
}),
|
|
7022
|
+
/* @__PURE__ */ jsx("div", {
|
|
7023
|
+
className: "mt-4 flex gap-8",
|
|
7024
|
+
children: /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsxs("div", {
|
|
7025
|
+
className: "flex gap-2",
|
|
7026
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
7027
|
+
className: "w-16",
|
|
7028
|
+
children: "Emp. ID:"
|
|
7029
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
7030
|
+
className: "font-bold",
|
|
7031
|
+
children: data.employee.empId || "DL250814-002"
|
|
7032
|
+
})]
|
|
7033
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
7034
|
+
className: "flex gap-2",
|
|
7035
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
7036
|
+
className: "w-16",
|
|
7037
|
+
children: "Name:"
|
|
7038
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
7039
|
+
className: "font-bold uppercase",
|
|
7040
|
+
children: data.employee.name
|
|
7041
|
+
})]
|
|
7042
|
+
})] })
|
|
7043
|
+
})
|
|
7044
|
+
] }), /* @__PURE__ */ jsxs("div", {
|
|
7045
|
+
className: "text-right",
|
|
7046
|
+
children: [
|
|
7047
|
+
/* @__PURE__ */ jsx("div", {
|
|
7048
|
+
className: "mb-1",
|
|
7049
|
+
children: "Page 1 of 1"
|
|
7050
|
+
}),
|
|
7051
|
+
/* @__PURE__ */ jsx("div", {
|
|
7052
|
+
className: "font-bold text-sm mb-2",
|
|
7053
|
+
children: data.period || "01/16/2025 – 01/31/2025"
|
|
7054
|
+
}),
|
|
7055
|
+
/* @__PURE__ */ jsxs("div", {
|
|
7056
|
+
className: "grid grid-cols-[80px_1fr] gap-x-2 text-left",
|
|
7057
|
+
children: [
|
|
7058
|
+
/* @__PURE__ */ jsx("span", { children: "Shift:" }),
|
|
7059
|
+
/* @__PURE__ */ jsx("span", {
|
|
7060
|
+
className: "font-bold",
|
|
7061
|
+
children: "1"
|
|
7062
|
+
}),
|
|
7063
|
+
/* @__PURE__ */ jsx("span", { children: "Position:" }),
|
|
7064
|
+
/* @__PURE__ */ jsx("span", {
|
|
7065
|
+
className: "font-bold",
|
|
7066
|
+
children: data.employee.role
|
|
7067
|
+
}),
|
|
7068
|
+
/* @__PURE__ */ jsx("span", { children: "Department:" }),
|
|
7069
|
+
/* @__PURE__ */ jsx("span", {
|
|
7070
|
+
className: "font-bold",
|
|
7071
|
+
children: data.employee.department
|
|
7072
|
+
}),
|
|
7073
|
+
/* @__PURE__ */ jsx("span", { children: "Imm. Superior:" }),
|
|
7074
|
+
/* @__PURE__ */ jsx("span", {
|
|
7075
|
+
className: "font-bold",
|
|
7076
|
+
children: data.employee.supervisor || "ACGarcia"
|
|
7077
|
+
})
|
|
7078
|
+
]
|
|
7079
|
+
})
|
|
7080
|
+
]
|
|
7081
|
+
})]
|
|
7082
|
+
}),
|
|
7083
|
+
/* @__PURE__ */ jsx("div", {
|
|
7084
|
+
className: "border-t border-b border-black mb-1",
|
|
7085
|
+
children: /* @__PURE__ */ jsxs("table", {
|
|
7086
|
+
className: "w-full text-center border-collapse",
|
|
7087
|
+
children: [
|
|
7088
|
+
/* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsx("tr", {
|
|
7089
|
+
className: "border-b border-black",
|
|
7090
|
+
children: [
|
|
7091
|
+
"DateIn",
|
|
7092
|
+
"Day",
|
|
7093
|
+
"Shift",
|
|
7094
|
+
"TimeIn",
|
|
7095
|
+
"DateOut",
|
|
7096
|
+
"TimeOut",
|
|
7097
|
+
"Hours",
|
|
7098
|
+
"Actual",
|
|
7099
|
+
"Late",
|
|
7100
|
+
"Utime",
|
|
7101
|
+
"OT",
|
|
7102
|
+
"ND2",
|
|
7103
|
+
"Rem."
|
|
7104
|
+
].map((h) => /* @__PURE__ */ jsx("th", {
|
|
7105
|
+
className: "py-1 text-[9px]",
|
|
7106
|
+
children: h
|
|
7107
|
+
}, h))
|
|
7108
|
+
}) }),
|
|
7109
|
+
/* @__PURE__ */ jsx("tbody", { children: RECORDS.map((r, i) => /* @__PURE__ */ jsxs("tr", {
|
|
7110
|
+
className: "h-4",
|
|
7111
|
+
children: [
|
|
7112
|
+
/* @__PURE__ */ jsx("td", { children: r.dateIn }),
|
|
7113
|
+
/* @__PURE__ */ jsx("td", { children: r.day }),
|
|
7114
|
+
/* @__PURE__ */ jsx("td", { children: r.shift }),
|
|
7115
|
+
/* @__PURE__ */ jsx("td", { children: r.timeIn }),
|
|
7116
|
+
/* @__PURE__ */ jsx("td", { children: r.dateOut }),
|
|
7117
|
+
/* @__PURE__ */ jsx("td", { children: r.timeOut }),
|
|
7118
|
+
/* @__PURE__ */ jsx("td", { children: r.hours }),
|
|
7119
|
+
/* @__PURE__ */ jsx("td", { children: r.actual }),
|
|
7120
|
+
/* @__PURE__ */ jsx("td", { children: r.late }),
|
|
7121
|
+
/* @__PURE__ */ jsx("td", { children: r.utime }),
|
|
7122
|
+
/* @__PURE__ */ jsx("td", { children: r.ot }),
|
|
7123
|
+
/* @__PURE__ */ jsx("td", { children: r.nd2 }),
|
|
7124
|
+
/* @__PURE__ */ jsx("td", { children: r.rem })
|
|
7125
|
+
]
|
|
7126
|
+
}, i)) }),
|
|
7127
|
+
/* @__PURE__ */ jsx("tfoot", { children: /* @__PURE__ */ jsxs("tr", {
|
|
7128
|
+
className: "border-t border-black font-bold",
|
|
7129
|
+
children: [
|
|
7130
|
+
/* @__PURE__ */ jsx("td", {
|
|
7131
|
+
colSpan: 6,
|
|
7132
|
+
className: "text-left py-1 pl-2",
|
|
7133
|
+
children: "Totals: ( 11 WorkDays )"
|
|
7134
|
+
}),
|
|
7135
|
+
/* @__PURE__ */ jsx("td", { children: "88.00" }),
|
|
7136
|
+
/* @__PURE__ */ jsx("td", { children: "99.00" }),
|
|
7137
|
+
/* @__PURE__ */ jsx("td", { children: "0.00" }),
|
|
7138
|
+
/* @__PURE__ */ jsx("td", { children: "0.00" }),
|
|
7139
|
+
/* @__PURE__ */ jsx("td", { children: "0.00" }),
|
|
7140
|
+
/* @__PURE__ */ jsx("td", { children: "0.00" }),
|
|
7141
|
+
/* @__PURE__ */ jsx("td", {})
|
|
7142
|
+
]
|
|
7143
|
+
}) })
|
|
7144
|
+
]
|
|
7145
|
+
})
|
|
7146
|
+
}),
|
|
7147
|
+
/* @__PURE__ */ jsx("div", {
|
|
7148
|
+
className: "flex justify-end mb-6 font-bold text-[10px]",
|
|
7149
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
7150
|
+
className: "text-right w-[120px]",
|
|
7151
|
+
children: [
|
|
7152
|
+
"Employment Status:",
|
|
7153
|
+
/* @__PURE__ */ jsx("br", {}),
|
|
7154
|
+
"Regular",
|
|
7155
|
+
/* @__PURE__ */ jsx("br", {}),
|
|
7156
|
+
"Monthly",
|
|
7157
|
+
/* @__PURE__ */ jsx("br", {}),
|
|
7158
|
+
"Rest Day: Sunday"
|
|
7159
|
+
]
|
|
7160
|
+
})
|
|
7161
|
+
}),
|
|
7162
|
+
/* @__PURE__ */ jsxs("div", {
|
|
7163
|
+
className: "text-center mb-10 px-12",
|
|
7164
|
+
children: [/* @__PURE__ */ jsx("p", {
|
|
7165
|
+
className: "mb-1",
|
|
7166
|
+
children: "I hereby certify that the above records are true and correct. Any"
|
|
7167
|
+
}), /* @__PURE__ */ jsx("p", { children: "unauthorized overtime will not be paid by the management." })]
|
|
7168
|
+
}),
|
|
7169
|
+
/* @__PURE__ */ jsxs("div", {
|
|
7170
|
+
className: "flex justify-between px-16 mb-10",
|
|
7171
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
7172
|
+
className: "text-center w-48",
|
|
7173
|
+
children: [/* @__PURE__ */ jsx("div", { className: "border-b border-black mb-1" }), /* @__PURE__ */ jsx("div", { children: "Employee Signature" })]
|
|
7174
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
7175
|
+
className: "text-center w-48",
|
|
7176
|
+
children: [/* @__PURE__ */ jsx("div", { className: "border-b border-black mb-1" }), /* @__PURE__ */ jsx("div", { children: "Immediate Superior" })]
|
|
7177
|
+
})]
|
|
7178
|
+
}),
|
|
7179
|
+
/* @__PURE__ */ jsx("div", {
|
|
7180
|
+
className: "text-center mb-2",
|
|
7181
|
+
children: "For HRD use only, please do not tamper with."
|
|
7182
|
+
}),
|
|
7183
|
+
/* @__PURE__ */ jsxs("div", {
|
|
7184
|
+
className: "border-t border-black pt-2 flex justify-between items-start mb-6",
|
|
7185
|
+
children: [
|
|
7186
|
+
/* @__PURE__ */ jsx("div", {
|
|
7187
|
+
className: "grid grid-cols-[90px_60px] gap-y-0.5",
|
|
7188
|
+
children: [
|
|
7189
|
+
["Days Worked:", "11.00"],
|
|
7190
|
+
["Hours Worked:", "88.00"],
|
|
7191
|
+
["Absences:", "1.00"],
|
|
7192
|
+
["", ""],
|
|
7193
|
+
["Tardiness:", "0.00"],
|
|
7194
|
+
["Reg. ND1", "0.00"],
|
|
7195
|
+
["Reg. ND2", "0.00"],
|
|
7196
|
+
["Holiday", "1.00"],
|
|
7197
|
+
["", ""],
|
|
7198
|
+
["Undertime:", "0.00"]
|
|
7199
|
+
].map(([k, v], i) => /* @__PURE__ */ jsxs(React.Fragment, { children: [/* @__PURE__ */ jsx("span", { children: k }), /* @__PURE__ */ jsx("span", {
|
|
7200
|
+
className: "text-right",
|
|
7201
|
+
children: v
|
|
7202
|
+
})] }, i))
|
|
7203
|
+
}),
|
|
7204
|
+
/* @__PURE__ */ jsxs("div", {
|
|
7205
|
+
className: "w-1/3",
|
|
7206
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
7207
|
+
className: "flex border-b border-black pb-0.5 mb-1",
|
|
7208
|
+
children: [
|
|
7209
|
+
/* @__PURE__ */ jsx("span", {
|
|
7210
|
+
className: "underline mr-auto",
|
|
7211
|
+
children: "Summary:"
|
|
7212
|
+
}),
|
|
7213
|
+
/* @__PURE__ */ jsx("span", {
|
|
7214
|
+
className: "w-10 text-center underline",
|
|
7215
|
+
children: "10%"
|
|
7216
|
+
}),
|
|
7217
|
+
/* @__PURE__ */ jsx("span", {
|
|
7218
|
+
className: "w-10 text-center underline",
|
|
7219
|
+
children: "15%"
|
|
7220
|
+
})
|
|
7221
|
+
]
|
|
7222
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
7223
|
+
className: "grid grid-cols-1 gap-y-0.5 pl-2",
|
|
7224
|
+
children: OT_SUMMARY.map((ot) => /* @__PURE__ */ jsx("div", { children: ot }, ot))
|
|
7225
|
+
})]
|
|
7226
|
+
}),
|
|
7227
|
+
/* @__PURE__ */ jsx("div", {
|
|
7228
|
+
className: "grid grid-cols-[90px_30px] gap-y-0.5 text-right",
|
|
7229
|
+
children: [
|
|
7230
|
+
["VL Bal :", "10"],
|
|
7231
|
+
["SL Bal :", "14"],
|
|
7232
|
+
["VL w/ Pay :", "0"],
|
|
7233
|
+
["VL w/o Pay :", "0"],
|
|
7234
|
+
["Prev.VL w/ Pay :", "0"],
|
|
7235
|
+
["SL w/ Pay :", "0"],
|
|
7236
|
+
["SL w/o Pay :", "0"],
|
|
7237
|
+
["PL Taken :", "0"],
|
|
7238
|
+
["BL Taken :", "0"],
|
|
7239
|
+
["Meal Allow. :", "0"]
|
|
7240
|
+
].map(([k, v], i) => /* @__PURE__ */ jsxs(React.Fragment, { children: [/* @__PURE__ */ jsx("span", { children: k }), /* @__PURE__ */ jsx("span", { children: v })] }, i))
|
|
7241
|
+
})
|
|
7242
|
+
]
|
|
7243
|
+
}),
|
|
7244
|
+
/* @__PURE__ */ jsx("div", { className: "border-t border-black/50 border-dashed pt-2" })
|
|
7245
|
+
]
|
|
7246
|
+
});
|
|
7247
|
+
}
|
|
7248
|
+
//#endregion
|
|
4625
7249
|
//#region src/ui-library/gallery/stat-card/Statistic.tsx
|
|
4626
7250
|
/**
|
|
4627
7251
|
* Statistic — Design System Component
|
|
@@ -4750,12 +7374,12 @@ var DOT_STYLES = {
|
|
|
4750
7374
|
shadow: "0 0 0 3px rgba(239,68,68,0.18)"
|
|
4751
7375
|
},
|
|
4752
7376
|
inactive: {
|
|
4753
|
-
bg: "#
|
|
4754
|
-
shadow: "0 0 0 3px rgba(
|
|
7377
|
+
bg: "#b45309",
|
|
7378
|
+
shadow: "0 0 0 3px rgba(180,83,9,0.18)"
|
|
4755
7379
|
},
|
|
4756
7380
|
pending: {
|
|
4757
|
-
bg: "#
|
|
4758
|
-
shadow: "0 0 0 3px rgba(
|
|
7381
|
+
bg: "#0284c7",
|
|
7382
|
+
shadow: "0 0 0 3px rgba(2,132,199,0.18)"
|
|
4759
7383
|
}
|
|
4760
7384
|
};
|
|
4761
7385
|
function StatusDot({ status, label, className = "" }) {
|
|
@@ -4968,4 +7592,4 @@ var shadow = {
|
|
|
4968
7592
|
overlay: "shadow-xl"
|
|
4969
7593
|
};
|
|
4970
7594
|
//#endregion
|
|
4971
|
-
export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, ActivityFeed, Alert, ApprovalTimeline, Avatar, Badge, BarChart, Breadcrumb, Button, Calendar, Card, CardContent, CardFooter, CardHeader, Checkbox, Combobox, CommandPalette, ConfirmAction, ConfirmDialog, DatePicker, DescriptionItem, DescriptionList, Dialog, DialogBody, DialogFooter, Divider, Drawer, Dropdown, EmployeeCard, EmptyState, ErrorBanner, Field, FieldContext, FieldInput, FileUpload, FilterChip, Heatmap, IconButton, Input, Kanban, LineChart, Menu, Modal, OtpInput, PageHeader, Pagination, PermissionMatrix, Popover, PopoverContent, PopoverTrigger, Progress, RadioGroup, RadioItem, Section, SegmentedControl, Select, SidebarGroup, SidebarItem, SidebarNav, SidebarSection, Skeleton, SkeletonAvatar, SkeletonCard, SkeletonTableRow, SkeletonText, Spinner, Statistic, StatusBadge, StatusDot, Stepper, Switch, Tab, TabList, TabPanel, TabPanels, Tabs, Textarea, Timeline, TimelineEmptyState, TimelineFooter, TimelineItem, TimelineValueCard, Toaster, Toolbar, Tooltip, TreeView, ValidationSummary, colors_exports as colors, dimension_exports as dimension, radius_exports as radius, shadow_exports as shadow, statusMenuItems, toast, typography_exports as typography, useFieldContext };
|
|
7595
|
+
export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, ActivityFeed, Alert, ApprovalTimeline, AreaChart, Avatar, Badge, BarChart, BarList, Breadcrumb, Button, CHART_PALETTE, Calendar, Card, CardContent, CardFooter, CardHeader, Checkbox, Combobox, CommandPalette, ConfirmAction, ConfirmDialog, DatePicker, DescriptionItem, DescriptionList, Dialog, DialogBody, DialogFooter, Divider, Drawer, Dropdown, EmployeeCard, EmptyState, ErrorBanner, Field, FieldContext, FieldInput, FileUpload, FilterChip, Heatmap, IconButton, Input, IsoCubeBlock, Kanban, LineChart, Menu, Modal, OrgChart, OrgUnitTree, OtpInput, PafTemplate, PageHeader, Pagination, PayslipTemplate, PermissionMatrix, Popover, PopoverContent, PopoverTrigger, Progress, RadioGroup, RadioItem, ReportTemplate, Section, SegmentedControl, Select, SidebarGroup, SidebarItem, SidebarNav, SidebarSection, Skeleton, SkeletonAvatar, SkeletonCard, SkeletonTableRow, SkeletonText, Spinner, Statistic, StatusBadge, StatusDot, Stepper, Switch, Tab, TabList, TabPanel, TabPanels, Tabs, Textarea, TimekeepingTemplate, Timeline, TimelineEmptyState, TimelineFooter, TimelineItem, TimelineValueCard, Toaster, Toolbar, Tooltip, TreeView, ValidationSummary, colors_exports as colors, dimension_exports as dimension, radius_exports as radius, shadow_exports as shadow, statusMenuItems, toast, typography_exports as typography, useFieldContext };
|