phx-react 1.3.1833 → 1.3.1835

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.
Files changed (67) hide show
  1. package/dist/cjs/components/TableSchedule/PHXScheduleTable.d.ts +11 -0
  2. package/dist/cjs/components/TableSchedule/PHXScheduleTable.js +45 -0
  3. package/dist/cjs/components/TableSchedule/PHXScheduleTable.js.map +1 -0
  4. package/dist/cjs/components/TableSchedule/components/PHXScheduleTableBody.d.ts +16 -0
  5. package/dist/cjs/components/TableSchedule/components/PHXScheduleTableBody.js +148 -0
  6. package/dist/cjs/components/TableSchedule/components/PHXScheduleTableBody.js.map +1 -0
  7. package/dist/cjs/components/TableSchedule/components/PHXScheduleTableHead.d.ts +22 -0
  8. package/dist/cjs/components/TableSchedule/components/PHXScheduleTableHead.js +49 -0
  9. package/dist/cjs/components/TableSchedule/components/PHXScheduleTableHead.js.map +1 -0
  10. package/dist/cjs/components/TableSchedule/components/PHXScheduleTableLegend.d.ts +13 -0
  11. package/dist/cjs/components/TableSchedule/components/PHXScheduleTableLegend.js +26 -0
  12. package/dist/cjs/components/TableSchedule/components/PHXScheduleTableLegend.js.map +1 -0
  13. package/dist/cjs/components/TableSchedule/components/useStickyShadow.d.ts +15 -0
  14. package/dist/cjs/components/TableSchedule/components/useStickyShadow.js +37 -0
  15. package/dist/cjs/components/TableSchedule/components/useStickyShadow.js.map +1 -0
  16. package/dist/cjs/components/TableSchedule/constants.d.ts +49 -0
  17. package/dist/cjs/components/TableSchedule/constants.js +85 -0
  18. package/dist/cjs/components/TableSchedule/constants.js.map +1 -0
  19. package/dist/cjs/components/TableSchedule/index.d.ts +1 -0
  20. package/dist/cjs/components/TableSchedule/index.js +5 -0
  21. package/dist/cjs/components/TableSchedule/index.js.map +1 -0
  22. package/dist/cjs/components/TableSchedule/renderers.d.ts +39 -0
  23. package/dist/cjs/components/TableSchedule/renderers.js +138 -0
  24. package/dist/cjs/components/TableSchedule/renderers.js.map +1 -0
  25. package/dist/cjs/components/TableSchedule/types.d.ts +112 -0
  26. package/dist/cjs/components/TableSchedule/types.js +4 -0
  27. package/dist/cjs/components/TableSchedule/types.js.map +1 -0
  28. package/dist/cjs/components/TableSchedule/utils.d.ts +160 -0
  29. package/dist/cjs/components/TableSchedule/utils.js +283 -0
  30. package/dist/cjs/components/TableSchedule/utils.js.map +1 -0
  31. package/dist/cjs/index.d.ts +2 -1
  32. package/dist/cjs/index.js +3 -1
  33. package/dist/cjs/index.js.map +1 -1
  34. package/dist/esm/components/TableSchedule/PHXScheduleTable.d.ts +11 -0
  35. package/dist/esm/components/TableSchedule/PHXScheduleTable.js +40 -0
  36. package/dist/esm/components/TableSchedule/PHXScheduleTable.js.map +1 -0
  37. package/dist/esm/components/TableSchedule/components/PHXScheduleTableBody.d.ts +16 -0
  38. package/dist/esm/components/TableSchedule/components/PHXScheduleTableBody.js +143 -0
  39. package/dist/esm/components/TableSchedule/components/PHXScheduleTableBody.js.map +1 -0
  40. package/dist/esm/components/TableSchedule/components/PHXScheduleTableHead.d.ts +22 -0
  41. package/dist/esm/components/TableSchedule/components/PHXScheduleTableHead.js +45 -0
  42. package/dist/esm/components/TableSchedule/components/PHXScheduleTableHead.js.map +1 -0
  43. package/dist/esm/components/TableSchedule/components/PHXScheduleTableLegend.d.ts +13 -0
  44. package/dist/esm/components/TableSchedule/components/PHXScheduleTableLegend.js +21 -0
  45. package/dist/esm/components/TableSchedule/components/PHXScheduleTableLegend.js.map +1 -0
  46. package/dist/esm/components/TableSchedule/components/useStickyShadow.d.ts +15 -0
  47. package/dist/esm/components/TableSchedule/components/useStickyShadow.js +33 -0
  48. package/dist/esm/components/TableSchedule/components/useStickyShadow.js.map +1 -0
  49. package/dist/esm/components/TableSchedule/constants.d.ts +49 -0
  50. package/dist/esm/components/TableSchedule/constants.js +81 -0
  51. package/dist/esm/components/TableSchedule/constants.js.map +1 -0
  52. package/dist/esm/components/TableSchedule/index.d.ts +1 -0
  53. package/dist/esm/components/TableSchedule/index.js +2 -0
  54. package/dist/esm/components/TableSchedule/index.js.map +1 -0
  55. package/dist/esm/components/TableSchedule/renderers.d.ts +39 -0
  56. package/dist/esm/components/TableSchedule/renderers.js +129 -0
  57. package/dist/esm/components/TableSchedule/renderers.js.map +1 -0
  58. package/dist/esm/components/TableSchedule/types.d.ts +112 -0
  59. package/dist/esm/components/TableSchedule/types.js +3 -0
  60. package/dist/esm/components/TableSchedule/types.js.map +1 -0
  61. package/dist/esm/components/TableSchedule/utils.d.ts +160 -0
  62. package/dist/esm/components/TableSchedule/utils.js +264 -0
  63. package/dist/esm/components/TableSchedule/utils.js.map +1 -0
  64. package/dist/esm/index.d.ts +2 -1
  65. package/dist/esm/index.js +2 -1
  66. package/dist/esm/index.js.map +1 -1
  67. package/package.json +1 -1
@@ -0,0 +1,22 @@
1
+ import React from 'react';
2
+ import { GridHeaderGroup, PHXScheduleTableProps } from '../types';
3
+ type StickyHeaderPlaceholdersProps = {
4
+ stickyHeaderCount: number;
5
+ resolvedStickyColumnWidths: number[];
6
+ showStickyShadow: boolean;
7
+ zIndexBase: number;
8
+ rowSpan?: number;
9
+ };
10
+ type StickyHeaderContext = Pick<StickyHeaderPlaceholdersProps, 'stickyHeaderCount' | 'resolvedStickyColumnWidths' | 'showStickyShadow'>;
11
+ type PHXScheduleTableHeadProps = {
12
+ columns: PHXScheduleTableProps['columns'];
13
+ headerGroups?: GridHeaderGroup[];
14
+ } & StickyHeaderContext;
15
+ /**
16
+ * Renders the table head, including grouped headers and sticky row-header placeholders.
17
+ *
18
+ * @param {PHXScheduleTableHeadProps} props Head render inputs.
19
+ * @returns {React.ReactNode} The schedule table head.
20
+ */
21
+ export declare function PHXScheduleTableHead(props: PHXScheduleTableHeadProps): React.ReactNode;
22
+ export {};
@@ -0,0 +1,45 @@
1
+ 'use client';
2
+ import React from 'react';
3
+ import { HEADER_TH_CLASSNAME } from '../constants';
4
+ import { buildColumnHeaderCellStyle, buildHeaderGroupCellStyle, buildStickyHeaderCellStyle, getColumnAlign, getStickyHeaderClassName, } from '../utils';
5
+ /**
6
+ * Builds the placeholder props shared by sticky header rows.
7
+ *
8
+ * @param {StickyHeaderContext} stickyHeaderContext Sticky column state shared across header rows.
9
+ * @param {number} zIndexBase The z-index base used for the placeholder row.
10
+ * @param {number} [rowSpan] Optional row span applied to each placeholder cell.
11
+ * @returns {StickyHeaderPlaceholdersProps} The complete placeholder props for a sticky header row.
12
+ */
13
+ const buildStickyHeaderPlaceholderProps = (stickyHeaderContext, zIndexBase, rowSpan) => ({
14
+ ...stickyHeaderContext,
15
+ zIndexBase,
16
+ rowSpan,
17
+ });
18
+ /**
19
+ * Renders placeholder cells that reserve space for sticky row headers in the table head.
20
+ *
21
+ * @param {StickyHeaderPlaceholdersProps} props Sticky placeholder render inputs.
22
+ * @returns {React.ReactNode[]} The sticky placeholder cells.
23
+ */
24
+ const StickyHeaderPlaceholders = ({ stickyHeaderCount, resolvedStickyColumnWidths, showStickyShadow, zIndexBase, rowSpan, }) => Array.from({ length: stickyHeaderCount }).map((_, index) => (React.createElement("th", { key: index, rowSpan: rowSpan, className: getStickyHeaderClassName(index, stickyHeaderCount, showStickyShadow), style: buildStickyHeaderCellStyle({
25
+ index,
26
+ stickyWidths: resolvedStickyColumnWidths,
27
+ zIndexBase,
28
+ }) })));
29
+ /**
30
+ * Renders the table head, including grouped headers and sticky row-header placeholders.
31
+ *
32
+ * @param {PHXScheduleTableHeadProps} props Head render inputs.
33
+ * @returns {React.ReactNode} The schedule table head.
34
+ */
35
+ export function PHXScheduleTableHead(props) {
36
+ const { columns, headerGroups, ...stickyHeaderContext } = props;
37
+ return (React.createElement("thead", null,
38
+ headerGroups && headerGroups.length > 0 && (React.createElement("tr", null,
39
+ React.createElement(StickyHeaderPlaceholders, { ...buildStickyHeaderPlaceholderProps(stickyHeaderContext, 4, 2) }),
40
+ headerGroups.map((group, gi) => (React.createElement("th", { key: gi, colSpan: group.columnKeys.length, className: HEADER_TH_CLASSNAME, style: buildHeaderGroupCellStyle() }, group.header))))),
41
+ React.createElement("tr", null,
42
+ !headerGroups && React.createElement(StickyHeaderPlaceholders, { ...buildStickyHeaderPlaceholderProps(stickyHeaderContext, 3) }),
43
+ columns.map((col) => (React.createElement("th", { key: col.key, className: HEADER_TH_CLASSNAME, style: buildColumnHeaderCellStyle(getColumnAlign(col.align), col.minWidth) }, col.header))))));
44
+ }
45
+ //# sourceMappingURL=PHXScheduleTableHead.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PHXScheduleTableHead.js","sourceRoot":"","sources":["../../../../../src/components/TableSchedule/components/PHXScheduleTableHead.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;AAEZ,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAA;AAClD,OAAO,EACL,0BAA0B,EAC1B,yBAAyB,EACzB,0BAA0B,EAC1B,cAAc,EACd,wBAAwB,GACzB,MAAM,UAAU,CAAA;AAqBjB;;;;;;;GAOG;AACH,MAAM,iCAAiC,GAAG,CACxC,mBAAwC,EACxC,UAAkB,EAClB,OAAgB,EACe,EAAE,CAAC,CAAC;IACnC,GAAG,mBAAmB;IACtB,UAAU;IACV,OAAO;CACR,CAAC,CAAA;AAEF;;;;;GAKG;AACH,MAAM,wBAAwB,GAAG,CAAC,EAChC,iBAAiB,EACjB,0BAA0B,EAC1B,gBAAgB,EAChB,UAAU,EACV,OAAO,GACuB,EAAE,EAAE,CAClC,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,iBAAiB,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,CAAC,CAC1D,4BACE,GAAG,EAAE,KAAK,EACV,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,wBAAwB,CAAC,KAAK,EAAE,iBAAiB,EAAE,gBAAgB,CAAC,EAC/E,KAAK,EAAE,0BAA0B,CAAC;QAChC,KAAK;QACL,YAAY,EAAE,0BAA0B;QACxC,UAAU;KACX,CAAC,GACF,CACH,CAAC,CAAA;AAEJ;;;;;GAKG;AACH,MAAM,UAAU,oBAAoB,CAAC,KAAgC;IACnE,MAAM,EAAE,OAAO,EAAE,YAAY,EAAE,GAAG,mBAAmB,EAAE,GAAG,KAAK,CAAA;IAE/D,OAAO,CACL;QACG,YAAY,IAAI,YAAY,CAAC,MAAM,GAAG,CAAC,IAAI,CAC1C;YACE,oBAAC,wBAAwB,OAAK,iCAAiC,CAAC,mBAAmB,EAAE,CAAC,EAAE,CAAC,CAAC,GAAI;YAC7F,YAAY,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,EAAE,EAAE,CAAC,CAC/B,4BACE,GAAG,EAAE,EAAE,EACP,OAAO,EAAE,KAAK,CAAC,UAAU,CAAC,MAAM,EAChC,SAAS,EAAE,mBAAmB,EAC9B,KAAK,EAAE,yBAAyB,EAAE,IAEjC,KAAK,CAAC,MAAM,CACV,CACN,CAAC,CACC,CACN;QAED;YACG,CAAC,YAAY,IAAI,oBAAC,wBAAwB,OAAK,iCAAiC,CAAC,mBAAmB,EAAE,CAAC,CAAC,GAAI;YAC5G,OAAO,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CACpB,4BACE,GAAG,EAAE,GAAG,CAAC,GAAG,EACZ,SAAS,EAAE,mBAAmB,EAC9B,KAAK,EAAE,0BAA0B,CAAC,cAAc,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,GAAG,CAAC,QAAQ,CAAC,IAEzE,GAAG,CAAC,MAAM,CACR,CACN,CAAC,CACC,CACC,CACT,CAAA;AACH,CAAC"}
@@ -0,0 +1,13 @@
1
+ import React from 'react';
2
+ import { GridLegendItem } from '../types';
3
+ type PHXScheduleTableLegendProps = {
4
+ legendItems?: GridLegendItem[];
5
+ };
6
+ /**
7
+ * Renders the optional legend displayed above the schedule table.
8
+ *
9
+ * @param {PHXScheduleTableLegendProps} props Legend configuration.
10
+ * @returns {React.ReactNode} The legend markup, or null when no items exist.
11
+ */
12
+ export declare const PHXScheduleTableLegend: ({ legendItems }: PHXScheduleTableLegendProps) => React.JSX.Element | null;
13
+ export {};
@@ -0,0 +1,21 @@
1
+ 'use client';
2
+ import React from 'react';
3
+ import { LEGEND_INDICATOR_CLASSNAME, LEGEND_ITEM_CLASSNAME, LEGEND_LABEL_CLASSNAME, LEGEND_LAST_ITEM_CLASSNAME, LEGEND_WRAPPER_CLASSNAME, } from '../constants';
4
+ /**
5
+ * Renders the optional legend displayed above the schedule table.
6
+ *
7
+ * @param {PHXScheduleTableLegendProps} props Legend configuration.
8
+ * @returns {React.ReactNode} The legend markup, or null when no items exist.
9
+ */
10
+ export const PHXScheduleTableLegend = ({ legendItems }) => {
11
+ if (!legendItems || legendItems.length === 0) {
12
+ return null;
13
+ }
14
+ return (React.createElement("div", { className: LEGEND_WRAPPER_CLASSNAME }, legendItems.map((item, index) => {
15
+ var _a;
16
+ return (React.createElement("div", { key: index, className: index === legendItems.length - 1 ? LEGEND_LAST_ITEM_CLASSNAME : LEGEND_ITEM_CLASSNAME },
17
+ React.createElement("div", { className: `h-3 w-3 rounded border border-current ${item.variant ? LEGEND_INDICATOR_CLASSNAME[item.variant] : ''} ${(_a = item.indicatorClassName) !== null && _a !== void 0 ? _a : ''}`.trim() }),
18
+ React.createElement("span", { className: LEGEND_LABEL_CLASSNAME }, item.label)));
19
+ })));
20
+ };
21
+ //# sourceMappingURL=PHXScheduleTableLegend.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PHXScheduleTableLegend.js","sourceRoot":"","sources":["../../../../../src/components/TableSchedule/components/PHXScheduleTableLegend.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;AAEZ,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EACL,0BAA0B,EAC1B,qBAAqB,EACrB,sBAAsB,EACtB,0BAA0B,EAC1B,wBAAwB,GACzB,MAAM,cAAc,CAAA;AAOrB;;;;;GAKG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,EAAE,WAAW,EAA+B,EAAE,EAAE;IACrF,IAAI,CAAC,WAAW,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC7C,OAAO,IAAI,CAAA;IACb,CAAC;IAED,OAAO,CACL,6BAAK,SAAS,EAAE,wBAAwB,IACrC,WAAW,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE;;QAAC,OAAA,CAChC,6BACE,GAAG,EAAE,KAAK,EACV,SAAS,EAAE,KAAK,KAAK,WAAW,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,0BAA0B,CAAC,CAAC,CAAC,qBAAqB;YAEhG,6BACE,SAAS,EAAE,yCACT,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,0BAA0B,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAC5D,IAAI,MAAA,IAAI,CAAC,kBAAkB,mCAAI,EAAE,EAAE,CAAC,IAAI,EAAE,GAC1C;YACF,8BAAM,SAAS,EAAE,sBAAsB,IAAG,IAAI,CAAC,KAAK,CAAQ,CACxD,CACP,CAAA;KAAA,CAAC,CACE,CACP,CAAA;AACH,CAAC,CAAA"}
@@ -0,0 +1,15 @@
1
+ import type { RefObject } from 'react';
2
+ type UseStickyShadowParams = {
3
+ scrollContainerRef: RefObject<HTMLDivElement | null>;
4
+ columnsLength: number;
5
+ rowsLength: number;
6
+ stickyHeaderCount: number;
7
+ };
8
+ /**
9
+ * Tracks whether the sticky-header shadow should be visible based on horizontal scroll.
10
+ *
11
+ * @param {UseStickyShadowParams} params Dependencies required to recalculate shadow visibility.
12
+ * @returns {boolean} True when the table has been horizontally scrolled.
13
+ */
14
+ export declare const useStickyShadow: ({ scrollContainerRef, columnsLength, rowsLength, stickyHeaderCount, }: UseStickyShadowParams) => boolean;
15
+ export {};
@@ -0,0 +1,33 @@
1
+ 'use client';
2
+ import { useEffect, useState } from 'react';
3
+ /**
4
+ * Tracks whether the sticky-header shadow should be visible based on horizontal scroll.
5
+ *
6
+ * @param {UseStickyShadowParams} params Dependencies required to recalculate shadow visibility.
7
+ * @returns {boolean} True when the table has been horizontally scrolled.
8
+ */
9
+ export const useStickyShadow = ({ scrollContainerRef, columnsLength, rowsLength, stickyHeaderCount, }) => {
10
+ const [showStickyShadow, setShowStickyShadow] = useState(false);
11
+ useEffect(() => {
12
+ const container = scrollContainerRef.current;
13
+ if (!container)
14
+ return;
15
+ /**
16
+ * Synchronizes the sticky shadow state with the container's horizontal scroll position.
17
+ *
18
+ * @returns {void}
19
+ */
20
+ const updateStickyShadow = () => {
21
+ setShowStickyShadow(container.scrollLeft > 0);
22
+ };
23
+ updateStickyShadow();
24
+ container.addEventListener('scroll', updateStickyShadow, { passive: true });
25
+ window.addEventListener('resize', updateStickyShadow);
26
+ return () => {
27
+ container.removeEventListener('scroll', updateStickyShadow);
28
+ window.removeEventListener('resize', updateStickyShadow);
29
+ };
30
+ }, [columnsLength, rowsLength, stickyHeaderCount, scrollContainerRef]);
31
+ return showStickyShadow;
32
+ };
33
+ //# sourceMappingURL=useStickyShadow.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useStickyShadow.js","sourceRoot":"","sources":["../../../../../src/components/TableSchedule/components/useStickyShadow.ts"],"names":[],"mappings":"AAAA,YAAY,CAAA;AAGZ,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAS3C;;;;;GAKG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,EAC9B,kBAAkB,EAClB,aAAa,EACb,UAAU,EACV,iBAAiB,GACK,EAAE,EAAE;IAC1B,MAAM,CAAC,gBAAgB,EAAE,mBAAmB,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAA;IAE/D,SAAS,CAAC,GAAG,EAAE;QACb,MAAM,SAAS,GAAG,kBAAkB,CAAC,OAAO,CAAA;QAC5C,IAAI,CAAC,SAAS;YAAE,OAAM;QAEtB;;;;WAIG;QACH,MAAM,kBAAkB,GAAG,GAAG,EAAE;YAC9B,mBAAmB,CAAC,SAAS,CAAC,UAAU,GAAG,CAAC,CAAC,CAAA;QAC/C,CAAC,CAAA;QAED,kBAAkB,EAAE,CAAA;QACpB,SAAS,CAAC,gBAAgB,CAAC,QAAQ,EAAE,kBAAkB,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAA;QAC3E,MAAM,CAAC,gBAAgB,CAAC,QAAQ,EAAE,kBAAkB,CAAC,CAAA;QAErD,OAAO,GAAG,EAAE;YACV,SAAS,CAAC,mBAAmB,CAAC,QAAQ,EAAE,kBAAkB,CAAC,CAAA;YAC3D,MAAM,CAAC,mBAAmB,CAAC,QAAQ,EAAE,kBAAkB,CAAC,CAAA;QAC1D,CAAC,CAAA;IACH,CAAC,EAAE,CAAC,aAAa,EAAE,UAAU,EAAE,iBAAiB,EAAE,kBAAkB,CAAC,CAAC,CAAA;IAEtE,OAAO,gBAAgB,CAAA;AACzB,CAAC,CAAA"}
@@ -0,0 +1,49 @@
1
+ import { CSSProperties } from 'react';
2
+ import { GridCellVariant, GridColumnAlign, GridRowHeaderAlign } from './types';
3
+ export declare const BORDER = "0.5px solid var(--color-border-tertiary, #e5e7eb)";
4
+ export declare const stickyBase: CSSProperties;
5
+ export declare const thBase: CSSProperties;
6
+ export declare const HEADER_TH_CLASSNAME = "whitespace-nowrap bg-white px-3 py-2 text-xs font-semibold text-gray-900";
7
+ export declare const STICKY_SHADOW_CLASSNAME = "drop-shadow-[4px_0_4px_rgba(0,0,0,0.1)]";
8
+ export declare const LEGEND_WRAPPER_CLASSNAME = "mb-3 flex w-fit items-center gap-2 rounded-lg bg-white p-2";
9
+ export declare const LEGEND_ITEM_CLASSNAME = "ml-2 flex items-center gap-1";
10
+ export declare const LEGEND_LAST_ITEM_CLASSNAME = "ml-2 mr-2 flex items-center gap-1";
11
+ export declare const LEGEND_LABEL_CLASSNAME = "text-xs font-normal text-gray-900";
12
+ export declare const TABLE_SCROLL_CONTAINER_CLASSNAME = "overflow-x-auto rounded-lg bg-white";
13
+ export declare const TABLE_CLASSNAME = "w-full border-collapse";
14
+ export declare const TABLE_SCROLL_CONTAINER_STYLE: CSSProperties;
15
+ export declare const TABLE_STYLE: CSSProperties;
16
+ export declare const ROW_HEADER_CONTENT_CLASSNAME = "flex flex-col";
17
+ export declare const ROW_HEADER_ALIGN_CLASSNAME: Record<GridRowHeaderAlign, string>;
18
+ export declare const ROW_HEADER_TITLE_CLASSNAME = "text-xs font-semibold text-gray-900";
19
+ export declare const ROW_HEADER_DESCRIPTION_CLASSNAME = "text-xs text-gray-600";
20
+ export declare const CELL_BOX_BASE_CLASSNAME = "flex h-[30px] w-[176px] items-center overflow-hidden rounded-lg border-[0.5px] px-2.5 text-left text-xs font-normal shadow-sm";
21
+ export declare const CELL_BOX_VARIANT_CLASSNAME: Record<GridCellVariant, string>;
22
+ export declare const LEGEND_INDICATOR_CLASSNAME: Record<GridCellVariant, string>;
23
+ export declare const CELL_WRAPPER_ALIGN_CLASSNAME: Record<GridColumnAlign, string>;
24
+ /**
25
+ * Returns the wrapper alignment class for a cell based on the column alignment.
26
+ *
27
+ * @param {GridColumnAlign} align The alignment configured for the column.
28
+ * @returns {string} The Tailwind class used to align the cell wrapper content.
29
+ */
30
+ export declare const getCellWrapperAlignClassName: (align: GridColumnAlign) => string;
31
+ export declare const TOOLTIP_CONTENT_CLASSNAME = "flex max-w-[320px] flex-col gap-2 text-left";
32
+ export declare const TOOLTIP_TITLE_CLASSNAME = "text-xs font-semibold leading-5 text-gray-800";
33
+ export declare const TOOLTIP_SECTION_CLASSNAME = "flex flex-col gap-0.5";
34
+ export declare const TOOLTIP_LABEL_CLASSNAME = "text-xs leading-5 text-gray-500";
35
+ export declare const TOOLTIP_VALUE_CLASSNAME = "text-xs font-semibold leading-5 text-gray-800";
36
+ export declare const DEFAULT_TOOLTIP_CLASSNAME = "w-fit !px-5 !py-4";
37
+ export declare const SCHEDULE_CELL_CLASSNAME = "flex flex-col gap-2 text-left";
38
+ export declare const SCHEDULE_TITLE_CLASSNAME = "text-sm font-semibold leading-5 text-gray-800";
39
+ export declare const SCHEDULE_TITLE_DOTTED_CLASSNAME = "inline-block w-fit border-b-2 border-dotted border-gray-300 text-sm font-semibold leading-5 text-gray-800";
40
+ export declare const SCHEDULE_SECTION_CLASSNAME = "flex flex-col gap-1";
41
+ export declare const SCHEDULE_SECTION_LABEL_CLASSNAME = "flex items-center gap-1.5 text-xs font-normal leading-5 text-gray-500";
42
+ export declare const SCHEDULE_SECTION_VALUE_CLASSNAME = "text-sm font-semibold leading-5 text-gray-800";
43
+ export declare const SCHEDULE_EMPTY_TITLE_CLASSNAME = "text-sm font-semibold leading-5 text-gray-800";
44
+ export declare const SCHEDULE_EMPTY_DESCRIPTION_CLASSNAME = "text-xs font-normal leading-5 text-gray-500";
45
+ export declare const BOXED_CELL_PADDING_CLASSNAME = "px-1 py-1";
46
+ export declare const PLAIN_CELL_PADDING_CLASSNAME = "px-2 py-1.5";
47
+ export declare const BUTTON_BASE_CLASSNAME = "!shadow-none !flex !w-full !rounded-none !text-left";
48
+ export declare const CELL_CONTENT_BASE_CLASSNAME = "flex w-full text-left";
49
+ export declare const DATA_CELL_BASE_CLASSNAME = "align-middle border-l p-0";
@@ -0,0 +1,81 @@
1
+ 'use client';
2
+ export const BORDER = '0.5px solid var(--color-border-tertiary, #e5e7eb)';
3
+ export const stickyBase = {
4
+ position: 'sticky',
5
+ left: 0,
6
+ zIndex: 2,
7
+ background: 'var(--color-background-primary, #fff)',
8
+ borderRight: BORDER,
9
+ };
10
+ export const thBase = {
11
+ borderBottom: BORDER,
12
+ textAlign: 'center',
13
+ };
14
+ export const HEADER_TH_CLASSNAME = 'whitespace-nowrap bg-white px-3 py-2 text-xs font-semibold text-gray-900';
15
+ export const STICKY_SHADOW_CLASSNAME = 'drop-shadow-[4px_0_4px_rgba(0,0,0,0.1)]';
16
+ export const LEGEND_WRAPPER_CLASSNAME = 'mb-3 flex w-fit items-center gap-2 rounded-lg bg-white p-2';
17
+ export const LEGEND_ITEM_CLASSNAME = 'ml-2 flex items-center gap-1';
18
+ export const LEGEND_LAST_ITEM_CLASSNAME = 'ml-2 mr-2 flex items-center gap-1';
19
+ export const LEGEND_LABEL_CLASSNAME = 'text-xs font-normal text-gray-900';
20
+ export const TABLE_SCROLL_CONTAINER_CLASSNAME = 'overflow-x-auto rounded-lg bg-white';
21
+ export const TABLE_CLASSNAME = 'w-full border-collapse';
22
+ export const TABLE_SCROLL_CONTAINER_STYLE = {
23
+ border: BORDER,
24
+ };
25
+ export const TABLE_STYLE = {
26
+ width: '100%',
27
+ borderCollapse: 'collapse',
28
+ };
29
+ export const ROW_HEADER_CONTENT_CLASSNAME = 'flex flex-col';
30
+ export const ROW_HEADER_ALIGN_CLASSNAME = {
31
+ left: 'items-start text-left',
32
+ center: 'items-center text-center',
33
+ right: 'items-end text-right',
34
+ };
35
+ export const ROW_HEADER_TITLE_CLASSNAME = 'text-xs font-semibold text-gray-900';
36
+ export const ROW_HEADER_DESCRIPTION_CLASSNAME = 'text-xs text-gray-600';
37
+ export const CELL_BOX_BASE_CLASSNAME = 'flex h-[30px] w-[176px] items-center overflow-hidden rounded-lg border-[0.5px] px-2.5 text-left text-xs font-normal shadow-sm';
38
+ export const CELL_BOX_VARIANT_CLASSNAME = {
39
+ default: 'border-gray-500 bg-white text-gray-900',
40
+ moving: 'border-gray-500 bg-[#FFD6A4] text-gray-900',
41
+ trogiang: 'border-[#00527C] bg-[#E0F0FF] text-[#00527C]',
42
+ empty: 'border-gray-500 bg-white text-gray-900',
43
+ };
44
+ export const LEGEND_INDICATOR_CLASSNAME = {
45
+ default: '',
46
+ moving: 'bg-[#FFD6A4]',
47
+ trogiang: 'border-[#00527C] bg-[#E0F0FF]',
48
+ empty: '',
49
+ };
50
+ export const CELL_WRAPPER_ALIGN_CLASSNAME = {
51
+ left: 'justify-start',
52
+ center: 'justify-center',
53
+ right: 'justify-end',
54
+ };
55
+ /**
56
+ * Returns the wrapper alignment class for a cell based on the column alignment.
57
+ *
58
+ * @param {GridColumnAlign} align The alignment configured for the column.
59
+ * @returns {string} The Tailwind class used to align the cell wrapper content.
60
+ */
61
+ export const getCellWrapperAlignClassName = (align) => CELL_WRAPPER_ALIGN_CLASSNAME[align];
62
+ export const TOOLTIP_CONTENT_CLASSNAME = 'flex max-w-[320px] flex-col gap-2 text-left';
63
+ export const TOOLTIP_TITLE_CLASSNAME = 'text-xs font-semibold leading-5 text-gray-800';
64
+ export const TOOLTIP_SECTION_CLASSNAME = 'flex flex-col gap-0.5';
65
+ export const TOOLTIP_LABEL_CLASSNAME = 'text-xs leading-5 text-gray-500';
66
+ export const TOOLTIP_VALUE_CLASSNAME = 'text-xs font-semibold leading-5 text-gray-800';
67
+ export const DEFAULT_TOOLTIP_CLASSNAME = 'w-fit !px-5 !py-4';
68
+ export const SCHEDULE_CELL_CLASSNAME = 'flex flex-col gap-2 text-left';
69
+ export const SCHEDULE_TITLE_CLASSNAME = 'text-sm font-semibold leading-5 text-gray-800';
70
+ export const SCHEDULE_TITLE_DOTTED_CLASSNAME = 'inline-block w-fit border-b-2 border-dotted border-gray-300 text-sm font-semibold leading-5 text-gray-800';
71
+ export const SCHEDULE_SECTION_CLASSNAME = 'flex flex-col gap-1';
72
+ export const SCHEDULE_SECTION_LABEL_CLASSNAME = 'flex items-center gap-1.5 text-xs font-normal leading-5 text-gray-500';
73
+ export const SCHEDULE_SECTION_VALUE_CLASSNAME = 'text-sm font-semibold leading-5 text-gray-800';
74
+ export const SCHEDULE_EMPTY_TITLE_CLASSNAME = 'text-sm font-semibold leading-5 text-gray-800';
75
+ export const SCHEDULE_EMPTY_DESCRIPTION_CLASSNAME = 'text-xs font-normal leading-5 text-gray-500';
76
+ export const BOXED_CELL_PADDING_CLASSNAME = 'px-1 py-1';
77
+ export const PLAIN_CELL_PADDING_CLASSNAME = 'px-2 py-1.5';
78
+ export const BUTTON_BASE_CLASSNAME = '!shadow-none !flex !w-full !rounded-none !text-left';
79
+ export const CELL_CONTENT_BASE_CLASSNAME = 'flex w-full text-left';
80
+ export const DATA_CELL_BASE_CLASSNAME = 'align-middle border-l p-0';
81
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../src/components/TableSchedule/constants.ts"],"names":[],"mappings":"AAAA,YAAY,CAAA;AAKZ,MAAM,CAAC,MAAM,MAAM,GAAG,mDAAmD,CAAA;AAEzE,MAAM,CAAC,MAAM,UAAU,GAAkB;IACvC,QAAQ,EAAE,QAAQ;IAClB,IAAI,EAAE,CAAC;IACP,MAAM,EAAE,CAAC;IACT,UAAU,EAAE,uCAAuC;IACnD,WAAW,EAAE,MAAM;CACpB,CAAA;AAED,MAAM,CAAC,MAAM,MAAM,GAAkB;IACnC,YAAY,EAAE,MAAM;IACpB,SAAS,EAAE,QAAQ;CACpB,CAAA;AAED,MAAM,CAAC,MAAM,mBAAmB,GAAG,0EAA0E,CAAA;AAE7G,MAAM,CAAC,MAAM,uBAAuB,GAAG,yCAAyC,CAAA;AAEhF,MAAM,CAAC,MAAM,wBAAwB,GAAG,4DAA4D,CAAA;AACpG,MAAM,CAAC,MAAM,qBAAqB,GAAG,8BAA8B,CAAA;AACnE,MAAM,CAAC,MAAM,0BAA0B,GAAG,mCAAmC,CAAA;AAC7E,MAAM,CAAC,MAAM,sBAAsB,GAAG,mCAAmC,CAAA;AAEzE,MAAM,CAAC,MAAM,gCAAgC,GAAG,qCAAqC,CAAA;AACrF,MAAM,CAAC,MAAM,eAAe,GAAG,wBAAwB,CAAA;AACvD,MAAM,CAAC,MAAM,4BAA4B,GAAkB;IACzD,MAAM,EAAE,MAAM;CACf,CAAA;AACD,MAAM,CAAC,MAAM,WAAW,GAAkB;IACxC,KAAK,EAAE,MAAM;IACb,cAAc,EAAE,UAAU;CAC3B,CAAA;AAED,MAAM,CAAC,MAAM,4BAA4B,GAAG,eA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tE,MAAM,CAAC,MAAM,wBAAwB,GAAG,+CAA+C,CAAA;AACvF,MAAM,CAAC,MAAM,+BAA+B,GAC1C,2GAA2G,CAAA;AAC7G,MAAM,CAAC,MAAM,0BAA0B,GAAG,qBAAqB,CAAA;AAC/D,MAAM,CAAC,MAAM,gCAAgC,GAAG,uEAAuE,CAAA;AACvH,MAAM,CAAC,MAAM,gCAAgC,GAAG,+CAA+C,CAAA;AAC/F,MAAM,CAAC,MAAM,8BAA8B,GAAG,+CAA+C,CAAA;AAC7F,MAAM,CAAC,MAAM,oCAAoC,GAAG,6CAA6C,CAAA;AAEjG,MAAM,CAAC,MAAM,4BAA4B,GAAG,WAAW,CAAA;AACvD,MAAM,CAAC,MAAM,4BAA4B,GAAG,aAAa,CAAA;AACzD,MAAM,CAAC,MAAM,qBAAqB,GAAG,qDAAqD,CAAA;AAC1F,MAAM,CAAC,MAAM,2BAA2B,GAAG,uBAAuB,CAAA;AAClE,MAAM,CAAC,MAAM,wBAAwB,GAAG,2BAA2B,CAAA"}
@@ -0,0 +1 @@
1
+ export * from './PHXScheduleTable';
@@ -0,0 +1,2 @@
1
+ export * from './PHXScheduleTable';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/TableSchedule/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAA"}
@@ -0,0 +1,39 @@
1
+ import React from 'react';
2
+ import { GridCellData, GridRowHeader, GridScheduleContent } from './types';
3
+ /**
4
+ * Renders the content displayed inside a sticky row-header cell.
5
+ *
6
+ * @param {GridRowHeader} header The row-header configuration object.
7
+ * @returns {React.ReactNode} The rendered header content, or null when nothing is configured.
8
+ */
9
+ export declare const renderRowHeaderContent: (header: GridRowHeader) => string | number | bigint | true | Iterable<React.ReactNode> | Promise<React.AwaitedReactNode> | React.JSX.Element | null;
10
+ /**
11
+ * Renders the boxed visual treatment used by default-layout schedule cells.
12
+ *
13
+ * @param {GridCellData} cell The cell data to render.
14
+ * @returns {React.ReactNode} The boxed content node for the cell.
15
+ */
16
+ export declare const renderCellBoxContent: (cell: GridCellData) => React.JSX.Element;
17
+ /**
18
+ * Renders the rich schedule layout used by plain schedule cells.
19
+ *
20
+ * @param {GridScheduleContent} scheduleContent The structured schedule content to render.
21
+ * @param {string} [userDetailPageUrl] The base URL used to build person detail links.
22
+ * @returns {React.ReactNode} The rendered schedule content.
23
+ */
24
+ export declare const renderScheduleContent: (scheduleContent: GridScheduleContent, userDetailPageUrl?: string) => React.JSX.Element;
25
+ /**
26
+ * Resolves and renders the tooltip content for a data cell.
27
+ *
28
+ * @param {GridCellData} cell The cell whose tooltip content should be rendered.
29
+ * @param {string} [userDetailPageUrl] The base URL used to build person detail links.
30
+ * @returns {React.ReactNode} The tooltip content, or null when the cell has no tooltip payload.
31
+ */
32
+ export declare const renderTooltipContent: (cell: GridCellData, userDetailPageUrl?: string) => string | number | bigint | true | Iterable<React.ReactNode> | Promise<React.AwaitedReactNode> | React.JSX.Element | null;
33
+ /**
34
+ * Resolves the tooltip container class name for a cell.
35
+ *
36
+ * @param {GridCellData} cell The cell that may override the tooltip class.
37
+ * @returns {string} The tooltip class name to apply.
38
+ */
39
+ export declare const resolveTooltipClassName: (cell: GridCellData) => string;
@@ -0,0 +1,129 @@
1
+ 'use client';
2
+ import React from 'react';
3
+ import { CELL_BOX_BASE_CLASSNAME, CELL_BOX_VARIANT_CLASSNAME, DEFAULT_TOOLTIP_CLASSNAME, ROW_HEADER_ALIGN_CLASSNAME, ROW_HEADER_CONTENT_CLASSNAME, ROW_HEADER_DESCRIPTION_CLASSNAME, ROW_HEADER_TITLE_CLASSNAME, SCHEDULE_CELL_CLASSNAME, SCHEDULE_EMPTY_DESCRIPTION_CLASSNAME, SCHEDULE_EMPTY_TITLE_CLASSNAME, SCHEDULE_SECTION_CLASSNAME, SCHEDULE_SECTION_LABEL_CLASSNAME, SCHEDULE_SECTION_VALUE_CLASSNAME, SCHEDULE_TITLE_CLASSNAME, SCHEDULE_TITLE_DOTTED_CLASSNAME, TOOLTIP_CONTENT_CLASSNAME, TOOLTIP_LABEL_CLASSNAME, TOOLTIP_SECTION_CLASSNAME, TOOLTIP_TITLE_CLASSNAME, TOOLTIP_VALUE_CLASSNAME, } from './constants';
4
+ /**
5
+ * Checks whether a render value is a structured person-link object.
6
+ *
7
+ * @param {ReactNode | GridPersonLink} value The render value to inspect.
8
+ * @returns {value is GridPersonLink} True when the value matches the person-link contract.
9
+ */
10
+ const isGridPersonLink = (value) => !!value && typeof value === 'object' && 'type' in value && value.type === 'person-link';
11
+ /**
12
+ * Renders a person-link value as an external profile anchor when a destination URL exists.
13
+ *
14
+ * @param {GridPersonLink} person The person-link payload to render.
15
+ * @param {string} [userDetailPageUrl] The base URL used to build the person detail link.
16
+ * @returns {React.ReactNode} The rendered link node, or null when the person has no display name.
17
+ */
18
+ const renderGridPersonLink = (person, userDetailPageUrl) => {
19
+ if (!person.name)
20
+ return null;
21
+ return (React.createElement("a", { className: 'group inline-flex items-center gap-1 whitespace-nowrap font-semibold text-gray-800 hover:text-blue-500', href: userDetailPageUrl && person.id ? `${userDetailPageUrl}${person.id}` : undefined, rel: 'noopener noreferrer', target: '_blank' },
22
+ React.createElement("span", null,
23
+ person.name,
24
+ person.code ? ` (${person.code})` : ''),
25
+ person.id && userDetailPageUrl && person.icon));
26
+ };
27
+ /**
28
+ * Renders a tooltip or schedule value that may contain raw nodes, a person link, or a list of person links.
29
+ *
30
+ * @param {ReactNode | GridPersonLink | GridPersonLink[]} value The value payload to render.
31
+ * @param {string} [userDetailPageUrl] The base URL used to build person detail links.
32
+ * @returns {React.ReactNode} The rendered value node.
33
+ */
34
+ const renderRichValue = (value, userDetailPageUrl) => {
35
+ if (Array.isArray(value)) {
36
+ return (React.createElement("div", { className: 'flex flex-col gap-1' }, value.map((item, index) => (React.createElement("div", { key: index }, isGridPersonLink(item) ? renderGridPersonLink(item, userDetailPageUrl) : item)))));
37
+ }
38
+ return isGridPersonLink(value) ? renderGridPersonLink(value, userDetailPageUrl) : value;
39
+ };
40
+ /**
41
+ * Renders the content displayed inside a sticky row-header cell.
42
+ *
43
+ * @param {GridRowHeader} header The row-header configuration object.
44
+ * @returns {React.ReactNode} The rendered header content, or null when nothing is configured.
45
+ */
46
+ export const renderRowHeaderContent = (header) => {
47
+ if (header.content)
48
+ return header.content;
49
+ if (!header.headerContent)
50
+ return null;
51
+ const { title, description, align = 'left' } = header.headerContent;
52
+ return (React.createElement("div", { className: `${ROW_HEADER_CONTENT_CLASSNAME} ${ROW_HEADER_ALIGN_CLASSNAME[align]}` },
53
+ React.createElement("div", { className: ROW_HEADER_TITLE_CLASSNAME }, title),
54
+ description && React.createElement("div", { className: ROW_HEADER_DESCRIPTION_CLASSNAME }, description)));
55
+ };
56
+ /**
57
+ * Renders the boxed visual treatment used by default-layout schedule cells.
58
+ *
59
+ * @param {GridCellData} cell The cell data to render.
60
+ * @returns {React.ReactNode} The boxed content node for the cell.
61
+ */
62
+ export const renderCellBoxContent = (cell) => {
63
+ var _a, _b;
64
+ return (React.createElement("div", { className: `${CELL_BOX_BASE_CLASSNAME} ${CELL_BOX_VARIANT_CLASSNAME[(_a = cell.variant) !== null && _a !== void 0 ? _a : 'default']}` },
65
+ React.createElement("span", { className: 'block w-full overflow-hidden text-ellipsis whitespace-nowrap' }, (_b = cell.content) !== null && _b !== void 0 ? _b : ' ')));
66
+ };
67
+ /**
68
+ * Renders the rich schedule layout used by plain schedule cells.
69
+ *
70
+ * @param {GridScheduleContent} scheduleContent The structured schedule content to render.
71
+ * @param {string} [userDetailPageUrl] The base URL used to build person detail links.
72
+ * @returns {React.ReactNode} The rendered schedule content.
73
+ */
74
+ export const renderScheduleContent = (scheduleContent, userDetailPageUrl) => {
75
+ const { title, titleVariant = 'default', sections = [], emptyTitle = 'Trống', emptyDescription = 'Chưa xếp', } = scheduleContent;
76
+ if (!title && sections.length === 0) {
77
+ return (React.createElement("div", { className: SCHEDULE_CELL_CLASSNAME },
78
+ React.createElement("div", { className: SCHEDULE_EMPTY_TITLE_CLASSNAME }, emptyTitle),
79
+ React.createElement("div", { className: SCHEDULE_EMPTY_DESCRIPTION_CLASSNAME }, emptyDescription)));
80
+ }
81
+ return (React.createElement("div", { className: SCHEDULE_CELL_CLASSNAME },
82
+ title && (React.createElement("div", { className: titleVariant === 'dotted' ? SCHEDULE_TITLE_DOTTED_CLASSNAME : SCHEDULE_TITLE_CLASSNAME }, title)),
83
+ sections.map((section, sectionIndex) => (React.createElement("div", { key: sectionIndex, className: SCHEDULE_SECTION_CLASSNAME },
84
+ section.label && (React.createElement("div", { className: SCHEDULE_SECTION_LABEL_CLASSNAME },
85
+ section.labelPrefix,
86
+ React.createElement("span", null, section.label))),
87
+ section.items.map((item, itemIndex) => (React.createElement("div", { key: itemIndex, className: SCHEDULE_SECTION_VALUE_CLASSNAME }, isGridPersonLink(item) ? renderGridPersonLink(item, userDetailPageUrl) : item))))))));
88
+ };
89
+ /**
90
+ * Renders the grouped tooltip sections for a cell.
91
+ *
92
+ * @param {GridTooltipBlock[]} blocks The tooltip blocks to render.
93
+ * @param {string} [userDetailPageUrl] The base URL used to build person detail links.
94
+ * @returns {React.ReactNode} The rendered tooltip block list.
95
+ */
96
+ const renderTooltipBlocks = (blocks, userDetailPageUrl) => (React.createElement("ul", { className: 'text-left' }, blocks.map((block, index) => {
97
+ var _a;
98
+ return (React.createElement("li", { key: index, className: index === 0 ? 'list-none' : 'mt-3 list-none border-t border-gray-200 pt-3' },
99
+ React.createElement("div", { className: TOOLTIP_CONTENT_CLASSNAME },
100
+ block.title && React.createElement("div", { className: TOOLTIP_TITLE_CLASSNAME }, block.title), (_a = block.sections) === null || _a === void 0 ? void 0 :
101
+ _a.map((section, sectionIndex) => (React.createElement("div", { key: sectionIndex, className: TOOLTIP_SECTION_CLASSNAME },
102
+ React.createElement("span", { className: `${TOOLTIP_LABEL_CLASSNAME} inline-flex items-center gap-1.5` },
103
+ section.labelPrefix,
104
+ React.createElement("span", null, section.label)),
105
+ React.createElement("span", { className: TOOLTIP_VALUE_CLASSNAME }, renderRichValue(section.value, userDetailPageUrl))))))));
106
+ })));
107
+ /**
108
+ * Resolves and renders the tooltip content for a data cell.
109
+ *
110
+ * @param {GridCellData} cell The cell whose tooltip content should be rendered.
111
+ * @param {string} [userDetailPageUrl] The base URL used to build person detail links.
112
+ * @returns {React.ReactNode} The tooltip content, or null when the cell has no tooltip payload.
113
+ */
114
+ export const renderTooltipContent = (cell, userDetailPageUrl) => {
115
+ if (cell.tooltip)
116
+ return cell.tooltip;
117
+ if (cell.tooltipBlocks && cell.tooltipBlocks.length > 0) {
118
+ return renderTooltipBlocks(cell.tooltipBlocks, userDetailPageUrl);
119
+ }
120
+ return null;
121
+ };
122
+ /**
123
+ * Resolves the tooltip container class name for a cell.
124
+ *
125
+ * @param {GridCellData} cell The cell that may override the tooltip class.
126
+ * @returns {string} The tooltip class name to apply.
127
+ */
128
+ export const resolveTooltipClassName = (cell) => { var _a; return (_a = cell.tooltipClassName) !== null && _a !== void 0 ? _a : DEFAULT_TOOLTIP_CLASSNAME; };
129
+ //# sourceMappingURL=renderers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"renderers.js","sourceRoot":"","sources":["../../../../src/components/TableSchedule/renderers.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;AAEZ,OAAO,KAAoB,MAAM,OAAO,CAAA;AACxC,OAAO,EACL,uBAAuB,EACvB,0BAA0B,EAC1B,yBAAyB,EACzB,0BAA0B,EAC1B,4BAA4B,EAC5B,gCAAgC,EAChC,0BAA0B,EAC1B,uBAAuB,EACvB,oCAAoC,EACpC,8BAA8B,EAC9B,0BAA0B,EAC1B,gCAAgC,EAChC,gCAAgC,EAChC,wBAAwB,EACxB,+BAA+B,EAC/B,yBAAyB,EACzB,uBAAuB,EACvB,yBAAyB,EACzB,uBAAuB,EACvB,uBAAuB,GACxB,MAAM,aAAa,CAAA;AAGpB;;;;;GAKG;AACH,MAAM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SProperties, ReactNode } from 'react';
2
+ export type GridCellVariant = 'default' | 'moving' | 'trogiang' | 'empty';
3
+ export type GridPersonLink = {
4
+ type: 'person-link';
5
+ id?: number | string | null;
6
+ name?: ReactNode;
7
+ code?: ReactNode;
8
+ icon?: ReactNode;
9
+ };
10
+ export type GridTooltipSection = {
11
+ label: ReactNode;
12
+ labelPrefix?: ReactNode;
13
+ value: ReactNode | GridPersonLink | GridPersonLink[];
14
+ };
15
+ export type GridTooltipBlock = {
16
+ title?: ReactNode;
17
+ sections?: GridTooltipSection[];
18
+ };
19
+ export type GridCellLayout = 'boxed' | 'plain';
20
+ export type GridScheduleTitleVariant = 'default' | 'dotted';
21
+ export type GridRowHeaderAlign = 'left' | 'center' | 'right';
22
+ export type GridScheduleSection = {
23
+ label?: ReactNode;
24
+ labelPrefix?: ReactNode;
25
+ items: Array<ReactNode | GridPersonLink>;
26
+ };
27
+ export type GridScheduleContent = {
28
+ title?: ReactNode;
29
+ titleVariant?: GridScheduleTitleVariant;
30
+ sections?: GridScheduleSection[];
31
+ emptyTitle?: ReactNode;
32
+ emptyDescription?: ReactNode;
33
+ };
34
+ export type GridCellData = {
35
+ content?: ReactNode;
36
+ variant?: GridCellVariant;
37
+ layout?: GridCellLayout;
38
+ scheduleContent?: GridScheduleContent;
39
+ tooltipBlocks?: GridTooltipBlock[];
40
+ tooltip?: ReactNode;
41
+ tooltipClassName?: string;
42
+ cellStyle?: CSSProperties;
43
+ cellClassName?: string;
44
+ colSpan?: number;
45
+ rowSpan?: number;
46
+ disabled?: boolean;
47
+ data?: unknown;
48
+ };
49
+ export type GridRowHeaderContent = {
50
+ title: ReactNode;
51
+ description?: ReactNode;
52
+ align?: GridRowHeaderAlign;
53
+ };
54
+ export type GridRowHeader = {
55
+ content?: ReactNode;
56
+ headerContent?: GridRowHeaderContent;
57
+ rowSpan?: number;
58
+ width?: number;
59
+ className?: string;
60
+ style?: CSSProperties;
61
+ };
62
+ export type GridColumnAlign = 'left' | 'center' | 'right';
63
+ export type GridColumn = {
64
+ key: string;
65
+ header: ReactNode;
66
+ minWidth?: number;
67
+ align?: GridColumnAlign;
68
+ };
69
+ export type GridHeaderGroup = {
70
+ header: ReactNode;
71
+ columnKeys: string[];
72
+ };
73
+ export type TooltipComponentType = ComponentType<{
74
+ content: ReactNode;
75
+ contentClassName?: string;
76
+ children: ReactNode;
77
+ }>;
78
+ export type ButtonComponentType = ComponentType<{
79
+ tertiary?: boolean;
80
+ noPadding?: boolean;
81
+ className?: string;
82
+ onClick?: () => void;
83
+ children?: ReactNode;
84
+ }>;
85
+ export type ScheduleTableRow = {
86
+ rowHeader?: GridRowHeader;
87
+ rowHeaders?: Array<GridRowHeader | null>;
88
+ cells: Record<string, GridCellData>;
89
+ };
90
+ export type GridLegendItem = {
91
+ label: ReactNode;
92
+ variant?: GridCellVariant;
93
+ indicatorClassName?: string;
94
+ };
95
+ export type PHXScheduleTableProps = {
96
+ columns: GridColumn[];
97
+ headerGroups?: GridHeaderGroup[];
98
+ rows: ScheduleTableRow[];
99
+ onCellClick?: (params: {
100
+ rowIndex: number;
101
+ columnKey: string;
102
+ cellData: GridCellData;
103
+ }) => void;
104
+ stickyColumnWidth?: number;
105
+ stickyColumnWidths?: number[];
106
+ defaultCellLayout?: GridCellLayout;
107
+ legendItems?: GridLegendItem[];
108
+ userDetailPageUrl?: string;
109
+ className?: string;
110
+ TooltipComponent?: TooltipComponentType;
111
+ ButtonComponent?: ButtonComponentType;
112
+ };
@@ -0,0 +1,3 @@
1
+ 'use client';
2
+ export {};
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/components/TableSchedule/types.ts"],"names":[],"mappings":"AAAA,YAAY,CAAA"}