@talentlytica/prodigy 1.2.1 → 1.3.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/CHANGELOG.md ADDED
@@ -0,0 +1,130 @@
1
+ # Changelog
2
+
3
+ Semua perubahan penting pada `@talentlytica/prodigy` dicatat di berkas ini.
4
+
5
+ Format mengikuti [Keep a Changelog](https://keepachangelog.com/id/1.1.0/),
6
+ dan versinya mengikuti [Semantic Versioning](https://semver.org/lang/id/).
7
+
8
+ ## [1.3.0] — 2026-08-10
9
+
10
+ Seluruh perubahan di rilis ini terpusat pada komponen `DataTable`. Tujuannya membuat 11 komponen
11
+ tabel list di SPA Integro (`top-assessment`) bisa memakai DS tanpa kehilangan fitur yang sudah
12
+ dipakai pengguna hari ini.
13
+
14
+ **Semua prop baru bersifat opsional.** Tanpa satu pun prop baru, `DataTable` berperilaku sama
15
+ seperti v1.2.1 — kecuali dua perubahan visual yang disengaja di bagian *Diubah*.
16
+
17
+ ### Ditambahkan
18
+
19
+ - **Mode terkendali (controlled).** Prop `pagination` / `onPaginationChange`,
20
+ `sorting` / `onSortingChange`, dan `globalFilter` / `onGlobalFilterChange`. Bila prop terkendali
21
+ tidak diberikan, komponen tetap memegang state-nya sendiri seperti sebelumnya.
22
+ Callback selalu menerima **nilai jadi**, bukan fungsi `Updater` bawaan TanStack.
23
+ - **Mode server-side.** Prop `manualPagination`, `manualSorting`, `manualFiltering`, dan `rowCount`.
24
+ Saat aktif, `DataTable` berhenti memotong/menyaring/mengurutkan di klien dan merender `data`
25
+ apa adanya; jumlah halaman dan penghitung baris diturunkan dari `rowCount`.
26
+ - **`pageSizeOptions`** — pemilih jumlah baris per halaman. Mengganti pilihan selalu mengembalikan
27
+ tampilan ke halaman pertama. Tanpa prop ini, tidak ada pemilih yang dirender.
28
+ - **`withRowCount`** — footer penghitung baris, dengan teks `Tampilkan {dari} ke {sampai} dari
29
+ {total} entri` (pemisah ribuan `en-US`). Di mode klien totalnya mengikuti hasil filter, bukan
30
+ jumlah data mentah.
31
+ - **Seleksi baris** — prop `getRowId`, `enableRowSelection`, `rowSelection`, dan
32
+ `onRowSelectionChange`. Kolom checkbox disuntikkan oleh DS sendiri saat `enableRowSelection`
33
+ aktif. Checkbox di header memilih **hanya baris di halaman aktif**, tidak pernah lintas halaman.
34
+ `enableRowSelection` juga menerima fungsi predikat untuk mengizinkan sebagian baris saja.
35
+ - **`withSearch`** — menyembunyikan kotak cari.
36
+ - **`loading`** — merender baris skeleton sebanyak ukuran halaman aktif (bisa berbeda dari
37
+ prop `pageSize` bila diubah lewat `pageSizeOptions` atau `pagination` terkendali)
38
+ menggantikan isi tabel, tanpa mengosongkannya. Dipakai saat data sedang diambil ulang
39
+ (mis. ganti halaman/filter di mode server-side) agar tabel tidak sempat "berkedip" kosong
40
+ di antara satu muatan dan berikutnya. Footer (penghitung baris, pemilih halaman, pager)
41
+ tetap dirender seperti biasa — berpindah halaman selagi pengambilan data berlangsung itu wajar.
42
+ - **`error`** — konten (biasanya pesan + tombol coba lagi) yang menggantikan seluruh isi tabel
43
+ saat pengambilan data gagal. Bila `loading` dan `error` sama-sama diberikan, `error` yang
44
+ menang. Footer **tidak dirender sama sekali** selama `error` — tidak ada data state untuk
45
+ dijelaskan atau dinavigasi di bawah pesan galat.
46
+ - Saat `error` atau `loading` aktif bersama `enableRowSelection`, checkbox pilih-semua di header
47
+ ikut **dinonaktifkan** — mencegah konsumen memicu seleksi massal atas baris yang sedang tidak
48
+ benar-benar terlihat (pesan galat, atau skeleton yang belum tentu representasi datanya).
49
+ - **`toolbar`** — slot untuk kontrol tambahan (tombol ekspor, filter, dll.). Hanya saat prop ini
50
+ diisi, `DataTable` merender baris tata letak dua kolom (`toolbar` di kiri, kotak cari di kanan
51
+ dengan lebar tetap); barisnya tetap muncul walau `withSearch={false}`. Tanpa `toolbar`, kotak
52
+ cari tidak berubah sama sekali dari sebelumnya (lebar penuh, tanpa pembungkus baru) — prop ini
53
+ murni aditif bagi pemanggilan yang sudah ada.
54
+ - **`minWidth`** — membungkus tabel dengan `Table.ScrollContainer` agar bisa digeser mendatar
55
+ begitu lebar kolom melewati nilai ini, alih-alih memampatkan kolom di layar sempit.
56
+ - **`tableProps`** — diteruskan langsung ke `Table` di bawahnya (densitas, ukuran font,
57
+ `striped`, dan prop presentasional lain milik `Table`).
58
+ - **Peringatan khusus mode development** untuk kombinasi prop yang sebelumnya gagal secara diam:
59
+ - salah satu dari keempat slice terkendali — `pagination`, `sorting`, `globalFilter`, atau
60
+ `rowSelection` — diberikan tanpa handler pasangannya masing-masing (kontrolnya membeku; pada
61
+ kotak cari, setiap ketikan tertelan; pada seleksi, checkbox tidak akan pernah berubah);
62
+ - `manualPagination` tanpa `rowCount` (jumlah halaman jadi 1 dan kontrol paginasi tak dirender
63
+ sama sekali, sehingga pengguna terkunci di halaman pertama);
64
+ - `manualSorting` atau `manualFiltering` diberikan tanpa pasangan terkendalinya masing-masing
65
+ lengkap (`sorting`/`onSortingChange`, `globalFilter`/`onGlobalFilterChange`) — tanpa itu, klik
66
+ header mengurutkan state internal yang tidak pernah dipakai server, dan kotak cari menelan
67
+ setiap ketikan;
68
+ - `enableRowSelection` tanpa `getRowId` (TanStack jatuh ke indeks baris, sehingga seleksi
69
+ mengikuti **posisi** alih-alih entitas — dan di mode server-side indeks itu berulang tiap
70
+ halaman);
71
+ - prop `pageSize` diubah setelah mount di mode tak terkendali (nilainya hanya dibaca saat mount).
72
+
73
+ Peringatan hanya muncul sekali per pesan dan tidak ikut terbawa ke build produksi.
74
+
75
+ ### Diubah
76
+
77
+ > ⚠️ Dua butir pertama **terlihat oleh pengguna** dan ikut mengubah tampilan layar yang sudah
78
+ > memakai `DataTable`, bukan hanya yang mengadopsi fitur baru. Keduanya disengaja, demi
79
+ > keseragaman tabel lintas aplikasi, dan perlu QA visual saat rilis.
80
+
81
+ - Baris header tabel kini memakai latar token DS `neutral.1` (sebelumnya tanpa latar).
82
+ Token `neutral` dipilih, bukan `gray`, karena `gray` adalah palet bawaan Mantine yang tidak
83
+ dikelola tema Kelola — memakainya berarti perubahan palet DS tidak akan pernah sampai ke header.
84
+ - Komponen `Pagination` di footer kini `size="sm"` (sebelumnya memakai default Mantine `md`).
85
+ - `pageSize` tidak lagi diteruskan lewat `initialState` TanStack, melainkan menyemai state
86
+ paginasi internal. Perilakunya tetap sama: nilainya dibaca saat mount.
87
+ - Footer tabel hanya dirender bila memang ada isinya (pemilih baris per halaman, penghitung baris,
88
+ atau lebih dari satu halaman).
89
+
90
+ ### Diperbaiki
91
+
92
+ - Dokumentasi `searchPlaceholder` sebelumnya menyatakan bahwa mengosongkannya (`undefined`)
93
+ menyembunyikan kotak cari. Itu tidak pernah bekerja, karena nilai default parameter membuat
94
+ pemeriksaannya selalu benar. Dokumentasinya dikoreksi, dan penyembunyian kini dilakukan lewat
95
+ `withSearch={false}`. Perilaku lama dipertahankan apa adanya: memanggil `DataTable` tanpa
96
+ `searchPlaceholder` tetap menampilkan kotak cari.
97
+
98
+ ### Internal
99
+
100
+ - Menambahkan perangkat test (`vitest` + `jsdom` + `@testing-library/react`). Sebelumnya repo ini
101
+ tidak punya test runner sama sekali — wajar ketika seluruh komponen hanya me-re-export Mantine,
102
+ tapi `DataTable` kini satu-satunya komponen dengan logika stateful sungguhan.
103
+ - Berkas test dikecualikan dari tahap *declaration emit*, sehingga `dist/` tidak lagi berisi
104
+ deklarasi hasil turunan berkas test.
105
+
106
+ ### Catatan migrasi
107
+
108
+ - Tidak ada perubahan yang memutus kompatibilitas. Pemanggilan `DataTable` yang sudah ada tidak
109
+ perlu disentuh.
110
+ - **Bila memakai seleksi baris, `getRowId` wajib diisi** dengan id entitas yang stabil. Tanpa itu
111
+ seleksi akan mengikuti posisi baris, bukan datanya.
112
+
113
+ ### Keterbatasan yang diketahui
114
+
115
+ - **Seleksi baris dan pembaca layar.** Setiap checkbox baris yang disuntikkan DS membawa
116
+ `aria-label="Pilih baris"` yang **identik** untuk semua baris — pembaca layar mengumumkan teks
117
+ yang sama untuk tiap baris, tidak menyebut baris yang mana. Perbaikan konvensionalnya
118
+ (`aria-labelledby` menunjuk ke sel data pertama baris) sengaja belum diterapkan: sel data bisa
119
+ berisi JSX apa pun (`cell` kustom), sehingga "sel pertama" tidak selalu berupa teks yang jelas
120
+ untuk dipakai sebagai label. Lihat bagian "Keterbatasan yang diketahui" di `DataTable.mdx`.
121
+ Tim yang mengadopsi `enableRowSelection` di layar dengan banyak baris sebaiknya mengetahui ini
122
+ sebelum audit aksesibilitas, bukan sesudahnya.
123
+
124
+ ## [1.2.1] — 2026-07
125
+
126
+ - `Select` kini memakai `checkIconPosition="right"` sebagai default tema.
127
+
128
+ ## [1.2.0] dan sebelumnya
129
+
130
+ Tidak ada catatan perubahan terstruktur untuk versi-versi ini; lihat riwayat git.
@@ -1,15 +1,58 @@
1
- import { type ColumnDef } from '@tanstack/react-table';
1
+ import type { ReactNode } from 'react';
2
+ import { type ColumnDef, type PaginationState, type SortingState } from '@tanstack/react-table';
3
+ import { type TableProps } from '../Table/Table';
4
+ export declare function resetWarnedOnceForTests(): void;
2
5
  export interface DataTableProps<T> {
3
6
  /** Data mentah, satu objek per baris. */
4
7
  data: T[];
5
8
  /** Definisi kolom TanStack Table — lihat https://tanstack.com/table/latest/docs/guide/column-defs. */
6
9
  columns: ColumnDef<T, any>[];
7
- /** Placeholder kotak cari (pencarian global lintas kolom). `undefined` = sembunyikan kotak cari. */
10
+ /** Teks placeholder kotak cari (pencarian global lintas kolom). Tidak mempengaruhi visibility — gunakan `withSearch` untuk menyembunyikannya. */
8
11
  searchPlaceholder?: string;
12
+ /** Tampilkan kotak cari. Default `true`. Setel `false` untuk menyembunyikannya. */
13
+ withSearch?: boolean;
9
14
  /** Jumlah baris per halaman. Default 10. */
10
15
  pageSize?: number;
11
16
  /** Teks saat `data` kosong. Default "Belum ada data". */
12
17
  emptyLabel?: string;
18
+ /** Paginasi terkendali. Kosongkan agar `DataTable` memegang state-nya sendiri. */
19
+ pagination?: PaginationState;
20
+ onPaginationChange?: (next: PaginationState) => void;
21
+ /** Urutan terkendali. */
22
+ sorting?: SortingState;
23
+ onSortingChange?: (next: SortingState) => void;
24
+ /** Kata kunci pencarian terkendali (mis. agar tombol ekspor bisa mengikuti filter). */
25
+ globalFilter?: string;
26
+ onGlobalFilterChange?: (next: string) => void;
27
+ /** Paginasi dilakukan server: `data` sudah berisi satu halaman. Butuh `rowCount`. */
28
+ manualPagination?: boolean;
29
+ /** Pengurutan dilakukan server. */
30
+ manualSorting?: boolean;
31
+ /** Penyaringan dilakukan server. */
32
+ manualFiltering?: boolean;
33
+ /** Total baris di server — sumber jumlah halaman dan penghitung baris. */
34
+ rowCount?: number;
35
+ /** Pilihan jumlah baris per halaman. `undefined` = tanpa pemilih. */
36
+ pageSizeOptions?: number[];
37
+ /** Tampilkan "Tampilkan {from} ke {to} dari {total} entri" di footer. */
38
+ withRowCount?: boolean;
39
+ /** Kunci baris yang stabil. WAJIB bila memakai seleksi, agar pilihan bertahan lintas halaman. */
40
+ getRowId?: (row: T, index: number) => string;
41
+ /** Aktifkan kolom checkbox. Beri fungsi untuk mengizinkan sebagian baris saja. */
42
+ enableRowSelection?: boolean | ((row: T) => boolean);
43
+ /** Peta baris terpilih, dikunci `getRowId`. */
44
+ rowSelection?: Record<string, boolean>;
45
+ onRowSelectionChange?: (next: Record<string, boolean>) => void;
46
+ /** Sedang memuat — merender baris skeleton, BUKAN mengosongkan tabel. */
47
+ loading?: boolean;
48
+ /** Pesan galat; menggantikan isi tabel. App yang menyediakan tombol coba lagi. */
49
+ error?: ReactNode;
50
+ /** Kontrol tambahan (ekspor, filter) sebaris di kiri kotak cari. */
51
+ toolbar?: ReactNode;
52
+ /** Lebar minimum sebelum tabel bisa digeser mendatar. */
53
+ minWidth?: number;
54
+ /** Diteruskan ke `Table` — densitas, ukuran font, striped, dsb. */
55
+ tableProps?: TableProps;
13
56
  }
14
57
  /**
15
58
  * DataTable — pola *list page* (Table + cari + urut + halaman) yang berulang di
@@ -19,4 +62,4 @@ export interface DataTableProps<T> {
19
62
  * proyek ini di v9 — lihat design-system.md §5). Tampilan tetap `Table` Prodigy, jadi
20
63
  * styling ikut tema Kelola secara otomatis.
21
64
  */
22
- export declare function DataTable<T>({ data, columns, searchPlaceholder, pageSize, emptyLabel, }: DataTableProps<T>): import("react").JSX.Element;
65
+ export declare function DataTable<T>({ data, columns, searchPlaceholder, withSearch, pageSize, emptyLabel, pagination, onPaginationChange, sorting, onSortingChange, globalFilter, onGlobalFilterChange, manualPagination, manualSorting, manualFiltering, rowCount, pageSizeOptions, withRowCount, getRowId, enableRowSelection, rowSelection, onRowSelectionChange, loading, error, toolbar, minWidth, tableProps, }: DataTableProps<T>): import("react").JSX.Element;
@@ -1,63 +1,195 @@
1
- import { d as e, h as t, m as n, o as r, p as i, u as a } from "./primitives-BiEY8qsh.js";
2
- import { IconChevronDown as o, IconChevronUp as s, IconSearch as c, IconSelector as l } from "@tabler/icons-react";
3
- import { jsx as u, jsxs as d } from "react/jsx-runtime";
4
- import { flexRender as f, getCoreRowModel as p, getFilteredRowModel as m, getPaginationRowModel as h, getSortedRowModel as g, useReactTable as _ } from "@tanstack/react-table";
1
+ import { _ as e, d as t, g as n, h as ee, m as te, o as r, p as i, u as a, v as o } from "./primitives-cJiG7HAD.js";
2
+ import { useEffect as s, useMemo as ne, useRef as re, useState as c } from "react";
3
+ import { IconChevronDown as ie, IconChevronUp as ae, IconSearch as oe, IconSelector as se } from "@tabler/icons-react";
4
+ import { jsx as l, jsxs as u } from "react/jsx-runtime";
5
+ import { flexRender as d, getCoreRowModel as ce, getFilteredRowModel as le, getPaginationRowModel as ue, getSortedRowModel as de, useReactTable as fe } from "@tanstack/react-table";
5
6
  //#region src/components/DataTable/DataTable.tsx
6
- function v({ data: v, columns: y, searchPlaceholder: b = "Cari...", pageSize: x = 10, emptyLabel: S = "Belum ada data" }) {
7
- let C = _({
8
- data: v,
9
- columns: y,
10
- getCoreRowModel: p(),
11
- getSortedRowModel: g(),
12
- getFilteredRowModel: m(),
13
- getPaginationRowModel: h(),
14
- initialState: { pagination: {
15
- pageSize: x,
16
- pageIndex: 0
17
- } }
18
- }), w = C.getRowModel().rows, T = {
19
- asc: /* @__PURE__ */ u(s, { size: 14 }),
20
- desc: /* @__PURE__ */ u(o, { size: 14 })
7
+ var f = (() => {
8
+ try {
9
+ return process.env.NODE_ENV !== "production";
10
+ } catch {
11
+ return !1;
12
+ }
13
+ })();
14
+ function p(e, t) {
15
+ return typeof e == "function" ? e(t) : e;
16
+ }
17
+ var m = /* @__PURE__ */ new Set();
18
+ function h(e, t) {
19
+ m.has(e) || (m.add(e), console.warn(t));
20
+ }
21
+ function pe({ table: e }) {
22
+ let t = !!e.options.meta?.selectionDisabled;
23
+ return /* @__PURE__ */ l(n, {
24
+ "aria-label": "Pilih semua baris di halaman ini",
25
+ checked: e.getIsAllPageRowsSelected(),
26
+ indeterminate: e.getIsSomePageRowsSelected() && !e.getIsAllPageRowsSelected(),
27
+ onChange: e.getToggleAllPageRowsSelectedHandler(),
28
+ disabled: t
29
+ });
30
+ }
31
+ function me({ row: e }) {
32
+ return /* @__PURE__ */ l(n, {
33
+ "aria-label": "Pilih baris",
34
+ checked: e.getIsSelected(),
35
+ disabled: !e.getCanSelect(),
36
+ onChange: e.getToggleSelectedHandler()
37
+ });
38
+ }
39
+ function g({ data: n, columns: m, searchPlaceholder: g = "Cari...", withSearch: _ = !0, pageSize: v = 10, emptyLabel: he = "Belum ada data", pagination: y, onPaginationChange: b, sorting: x, onSortingChange: S, globalFilter: C, onGlobalFilterChange: w, manualPagination: T, manualSorting: E, manualFiltering: D, rowCount: O, pageSizeOptions: k, withRowCount: A, getRowId: j, enableRowSelection: M, rowSelection: N, onRowSelectionChange: P, loading: F, error: I, toolbar: L, minWidth: R, tableProps: ge }) {
40
+ let [_e, ve] = c({
41
+ pageIndex: 0,
42
+ pageSize: v
43
+ }), [ye, be] = c([]), [xe, Se] = c(""), [Ce, we] = c(v);
44
+ v !== Ce && (we(v), f && !y && h("pageSize-changed-while-uncontrolled", "[DataTable] `pageSize` diubah setelah mount, tapi dalam mode tak-terkendali prop ini hanya dibaca sekali saat mount — perubahan ini tidak berpengaruh. Pakai `pageSizeOptions` untuk kontrol UI rows-per-page, atau kendalikan lewat `pagination`/`onPaginationChange` untuk mengubahnya secara programatis."));
45
+ let z = y ?? _e, B = x ?? ye, V = C ?? xe, H = (e) => {
46
+ let t = p(e, z);
47
+ y || ve((t) => p(e, t)), b?.(t);
48
+ }, Te = (e) => {
49
+ let t = p(e, B);
50
+ x || be((t) => p(e, t)), S?.(t);
51
+ }, [Ee, De] = c({}), U = N ?? Ee, Oe = (e) => {
52
+ let t = p(e, U);
53
+ N || De((t) => p(e, t)), P?.(t);
54
+ }, W = ne(() => M ? [{
55
+ id: "__pilih",
56
+ header: pe,
57
+ cell: me
58
+ }, ...m] : m, [m, M]), G = typeof M == "function" ? (e) => M(e.original) : M, ke = (e) => {
59
+ let t = p(e, V);
60
+ C === void 0 && Se((t) => p(e, t)), w?.(t ?? "");
21
61
  };
22
- return /* @__PURE__ */ d(a, {
23
- gap: "sm",
24
- children: [
25
- b !== void 0 && /* @__PURE__ */ u(t, {
26
- placeholder: b,
27
- leftSection: /* @__PURE__ */ u(c, { size: 16 }),
28
- value: C.getState().globalFilter ?? "",
29
- onChange: (e) => C.setGlobalFilter(e.currentTarget.value)
30
- }),
31
- /* @__PURE__ */ d(i, { children: [/* @__PURE__ */ u(i.Thead, { children: C.getHeaderGroups().map((e) => /* @__PURE__ */ u(i.Tr, { children: e.headers.map((e) => /* @__PURE__ */ u(i.Th, {
62
+ s(() => {
63
+ f && (y !== void 0 && !b && h("pagination-without-onPaginationChange", "[DataTable] `pagination` diberikan tanpa `onPaginationChange` — kontrol paginasi akan macet permanen (klik tombol halaman tidak akan pernah berpindah)."), x !== void 0 && !S && h("sorting-without-onSortingChange", "[DataTable] `sorting` diberikan tanpa `onSortingChange` — kontrol urutan akan macet permanen (klik header tidak akan pernah mengurutkan)."), C !== void 0 && !w && h("globalFilter-without-onGlobalFilterChange", "[DataTable] `globalFilter` diberikan tanpa `onGlobalFilterChange` — kotak cari akan menelan setiap ketikan tanpa pernah berubah nilainya."), M && !j && h("enableRowSelection-without-getRowId", "[DataTable] `enableRowSelection` diberikan tanpa `getRowId` — TanStack jatuh ke indeks baris sebagai id, jadi seleksi mengikuti POSISI baris, bukan ENTITAS-nya: pindah halaman akan membuat baris yang tampak \"terpilih\" berbeda dari yang sebenarnya dipilih pengguna, dan `onRowSelectionChange` mengirim kunci seperti `{\"0\":true}` yang tidak bisa dipetakan balik ke data. Beri `getRowId` yang stabil."), N !== void 0 && !P && h("rowSelection-without-onRowSelectionChange", "[DataTable] `rowSelection` diberikan tanpa `onRowSelectionChange` — kontrol seleksi akan macet permanen (klik checkbox tidak akan pernah mengubah baris yang terpilih)."), E && !(x !== void 0 && S) && h("manualSorting-without-controlled-sorting", "[DataTable] `manualSorting` diberikan tanpa pasangan `sorting`/`onSortingChange` lengkap — klik header akan mengurutkan state internal yang tidak pernah dipakai (server tidak pernah tahu urutan yang diminta), sehingga kolom tampak bisa diklik tapi tidak benar-benar mengurutkan apa pun."), D && !(C !== void 0 && w) && h("manualFiltering-without-controlled-globalFilter", "[DataTable] `manualFiltering` diberikan tanpa pasangan `globalFilter`/`onGlobalFilterChange` lengkap — kotak cari akan menelan setiap ketikan tanpa pernah berubah nilainya."));
64
+ }, []);
65
+ let K = re(!1);
66
+ s(() => {
67
+ if (f) {
68
+ if (!K.current) {
69
+ K.current = !0;
70
+ return;
71
+ }
72
+ T && O === void 0 && h("manualPagination-without-rowCount", "[DataTable] `manualPagination` diberikan tanpa `rowCount` — jumlah halaman akan salah (dihitung dari data satu halaman) dan navigasi paginasi tidak akan muncul.");
73
+ }
74
+ });
75
+ let Ae = { selectionDisabled: !!(I || F) }, q = fe({
76
+ data: n,
77
+ columns: W,
78
+ getRowId: j,
79
+ enableRowSelection: G,
80
+ state: {
81
+ pagination: z,
82
+ sorting: B,
83
+ globalFilter: V,
84
+ rowSelection: U
85
+ },
86
+ onPaginationChange: H,
87
+ onSortingChange: Te,
88
+ onGlobalFilterChange: ke,
89
+ onRowSelectionChange: Oe,
90
+ manualPagination: T,
91
+ manualSorting: E,
92
+ manualFiltering: D,
93
+ rowCount: T ? O : void 0,
94
+ getCoreRowModel: ce(),
95
+ getSortedRowModel: E ? void 0 : de(),
96
+ getFilteredRowModel: D ? void 0 : le(),
97
+ getPaginationRowModel: T ? void 0 : ue(),
98
+ meta: Ae
99
+ }), J = q.getRowModel().rows, je = {
100
+ asc: /* @__PURE__ */ l(ae, { size: 14 }),
101
+ desc: /* @__PURE__ */ l(ie, { size: 14 })
102
+ }, Y = T ? O ?? 0 : q.getFilteredRowModel().rows.length, X = Y === 0 || J.length === 0, Z = X ? 0 : z.pageIndex * z.pageSize + 1, Me = X ? 0 : Math.min(Z + J.length - 1, Y), Q = /* @__PURE__ */ u(i, {
103
+ ...ge,
104
+ children: [/* @__PURE__ */ l(i.Thead, {
105
+ bg: "neutral.1",
106
+ children: q.getHeaderGroups().map((e) => /* @__PURE__ */ l(i.Tr, { children: e.headers.map((e) => /* @__PURE__ */ l(i.Th, {
32
107
  onClick: e.column.getToggleSortingHandler(),
33
108
  style: { cursor: e.column.getCanSort() ? "pointer" : void 0 },
34
- children: /* @__PURE__ */ d(r, {
109
+ children: /* @__PURE__ */ u(r, {
35
110
  gap: 4,
36
111
  wrap: "nowrap",
37
- children: [e.isPlaceholder ? null : f(e.column.columnDef.header, e.getContext()), e.column.getCanSort() && (T[e.column.getIsSorted()] ?? /* @__PURE__ */ u(l, {
112
+ children: [e.isPlaceholder ? null : d(e.column.columnDef.header, e.getContext()), e.column.getCanSort() && (je[e.column.getIsSorted()] ?? /* @__PURE__ */ l(se, {
38
113
  size: 14,
39
114
  opacity: .4
40
115
  }))]
41
116
  })
42
- }, e.id)) }, e.id)) }), /* @__PURE__ */ u(i.Tbody, { children: w.length === 0 ? /* @__PURE__ */ u(i.Tr, { children: /* @__PURE__ */ u(i.Td, {
43
- colSpan: y.length,
44
- children: /* @__PURE__ */ u(e, {
45
- ta: "center",
46
- c: "dimmed",
47
- py: "md",
48
- children: S
49
- })
50
- }) }) : w.map((e) => /* @__PURE__ */ u(i.Tr, { children: e.getVisibleCells().map((e) => /* @__PURE__ */ u(i.Td, { children: f(e.column.columnDef.cell, e.getContext()) }, e.id)) }, e.id)) })] }),
51
- C.getPageCount() > 1 && /* @__PURE__ */ u(r, {
52
- justify: "flex-end",
53
- children: /* @__PURE__ */ u(n, {
54
- total: C.getPageCount(),
55
- value: C.getState().pagination.pageIndex + 1,
56
- onChange: (e) => C.setPageIndex(e - 1)
57
- })
117
+ }, e.id)) }, e.id))
118
+ }), /* @__PURE__ */ l(i.Tbody, { children: I ? /* @__PURE__ */ l(i.Tr, { children: /* @__PURE__ */ l(i.Td, {
119
+ colSpan: W.length,
120
+ children: I
121
+ }) }) : F ? Array.from({ length: z.pageSize }).map((e, t) => /* @__PURE__ */ l(i.Tr, { children: W.map((e, t) => /* @__PURE__ */ l(i.Td, { children: /* @__PURE__ */ l(te, {
122
+ height: 12,
123
+ radius: "sm"
124
+ }) }, e.id ?? t)) }, `skeleton-${t}`)) : J.length === 0 ? /* @__PURE__ */ l(i.Tr, { children: /* @__PURE__ */ l(i.Td, {
125
+ colSpan: W.length,
126
+ children: /* @__PURE__ */ l(t, {
127
+ ta: "center",
128
+ c: "dimmed",
129
+ py: "md",
130
+ children: he
131
+ })
132
+ }) }) : J.map((e) => /* @__PURE__ */ l(i.Tr, { children: e.getVisibleCells().map((e) => /* @__PURE__ */ l(i.Td, { children: d(e.column.columnDef.cell, e.getContext()) }, e.id)) }, e.id)) })]
133
+ }), $ = (e) => /* @__PURE__ */ l(o, {
134
+ placeholder: g,
135
+ leftSection: /* @__PURE__ */ l(oe, { size: 16 }),
136
+ value: q.getState().globalFilter ?? "",
137
+ onChange: (e) => q.setGlobalFilter(e.currentTarget.value),
138
+ ...e === void 0 ? {} : { w: e }
139
+ });
140
+ return /* @__PURE__ */ u(a, {
141
+ gap: "sm",
142
+ children: [
143
+ L ? /* @__PURE__ */ u(r, {
144
+ justify: "space-between",
145
+ wrap: "wrap",
146
+ gap: "sm",
147
+ children: [/* @__PURE__ */ l(r, {
148
+ gap: "sm",
149
+ children: L
150
+ }), _ && $(260)]
151
+ }) : _ && $(),
152
+ R ? /* @__PURE__ */ l(i.ScrollContainer, {
153
+ minWidth: R,
154
+ children: Q
155
+ }) : Q,
156
+ !I && (k && k.length > 0 || A || q.getPageCount() > 1) && /* @__PURE__ */ u(r, {
157
+ justify: "space-between",
158
+ wrap: "wrap",
159
+ children: [/* @__PURE__ */ u(r, {
160
+ gap: "sm",
161
+ children: [k && k.length > 0 && /* @__PURE__ */ l(e, {
162
+ "aria-label": "Baris per halaman",
163
+ size: "xs",
164
+ w: 90,
165
+ value: String(z.pageSize),
166
+ data: k.map(String),
167
+ onChange: (e) => H({
168
+ pageIndex: 0,
169
+ pageSize: Number(e.currentTarget.value)
170
+ })
171
+ }), A && /* @__PURE__ */ u(t, {
172
+ size: "sm",
173
+ c: "dimmed",
174
+ children: [
175
+ "Tampilkan ",
176
+ Z,
177
+ " ke ",
178
+ Me,
179
+ " dari ",
180
+ Y.toLocaleString("en-US"),
181
+ " entri"
182
+ ]
183
+ })]
184
+ }), q.getPageCount() > 1 && /* @__PURE__ */ l(ee, {
185
+ total: q.getPageCount(),
186
+ value: z.pageIndex + 1,
187
+ onChange: (e) => q.setPageIndex(e - 1),
188
+ size: "sm"
189
+ })]
58
190
  })
59
191
  ]
60
192
  });
61
193
  }
62
194
  //#endregion
63
- export { v as DataTable };
195
+ export { g as DataTable };
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
- import { a as e, c as t, d as n, f as r, h as i, i as a, l as o, m as s, n as c, o as l, p as u, r as d, s as f, t as p, u as m } from "./primitives-BiEY8qsh.js";
2
- import { ActionIcon as h, ActionIcon as g, Alert as _, Alert as v, Anchor as y, Anchor as b, AppShell as x, Avatar as S, Avatar as C, Badge as w, Badge as T, Box as E, Breadcrumbs as D, Burger as O, Button as ee, Button as te, Card as ne, Card as re, Checkbox as ie, CloseButton as ae, ColorSwatch as oe, Divider as se, EmptyState as ce, FileButton as le, FileInput as ue, Group as k, Indicator as de, Input as fe, Loader as pe, LoadingOverlay as me, Menu as he, Menu as ge, Modal as _e, Modal as ve, MultiSelect as ye, NativeSelect as be, NavLink as A, Notification as j, NumberInput as M, Paper as N, PasswordInput as xe, Pill as Se, Popover as Ce, Popover as P, Progress as we, Radio as Te, RingProgress as Ee, SegmentedControl as De, SegmentedControl as Oe, Select as ke, Select as F, Skeleton as Ae, Stepper as je, Switch as Me, Table as Ne, Tabs as Pe, TagsInput as Fe, Text as I, Textarea as Ie, ThemeIcon as Le, Tooltip as Re, Tooltip as ze, UnstyledButton as L, VisuallyHidden as Be, createTheme as Ve } from "@mantine/core";
1
+ import { _ as e, a as t, c as n, d as r, f as i, g as a, h as o, i as s, l as c, m as l, n as u, o as d, p as f, r as p, s as m, t as h, u as g, v as _ } from "./primitives-cJiG7HAD.js";
2
+ import { ActionIcon as v, ActionIcon as y, Alert as b, Alert as x, Anchor as S, Anchor as C, AppShell as w, Avatar as T, Avatar as E, Badge as D, Badge as ee, Box as O, Breadcrumbs as te, Burger as ne, Button as re, Button as ie, Card as ae, Card as oe, CloseButton as se, ColorSwatch as ce, Divider as le, EmptyState as ue, FileButton as de, FileInput as fe, Group as k, Indicator as pe, Input as me, Loader as he, LoadingOverlay as ge, Menu as _e, Menu as ve, Modal as ye, Modal as be, MultiSelect as A, NavLink as j, Notification as M, NumberInput as N, Paper as xe, PasswordInput as Se, Pill as Ce, Popover as we, Popover as P, Progress as Te, Radio as Ee, RingProgress as De, SegmentedControl as Oe, SegmentedControl as ke, Select as Ae, Select as F, Stepper as je, Switch as Me, Table as Ne, Tabs as Pe, TagsInput as Fe, Text as I, Textarea as Ie, ThemeIcon as Le, Tooltip as Re, Tooltip as ze, UnstyledButton as L, VisuallyHidden as Be, createTheme as Ve } from "@mantine/core";
3
3
  import { useState as R } from "react";
4
4
  import { IconCalendar as z, IconChevronLeft as B, IconChevronRight as V, IconX as H } from "@tabler/icons-react";
5
5
  import { jsx as U, jsxs as W } from "react/jsx-runtime";
@@ -149,7 +149,7 @@ var G = Ve({
149
149
  cursorType: "pointer",
150
150
  other: { appBackground: "#F7F7F7" },
151
151
  components: {
152
- Button: te.extend({
152
+ Button: ie.extend({
153
153
  defaultProps: {
154
154
  variant: "filled",
155
155
  size: "sm",
@@ -158,8 +158,8 @@ var G = Ve({
158
158
  styles: { label: { fontWeight: 700 } },
159
159
  vars: (e, t) => t.variant === "subtle" ? { root: { "--button-color": `var(--mantine-color-${t.color || e.primaryColor}-5)` } } : { root: {} }
160
160
  }),
161
- Input: fe.extend({ defaultProps: { radius: "xl" } }),
162
- Badge: T.extend({
161
+ Input: me.extend({ defaultProps: { radius: "xl" } }),
162
+ Badge: ee.extend({
163
163
  defaultProps: {
164
164
  variant: "light",
165
165
  radius: "xl"
@@ -167,25 +167,25 @@ var G = Ve({
167
167
  vars: (e, t) => t.variant === "light" ? { root: { "--badge-color": `var(--mantine-color-${t.color || e.primaryColor}-5)` } } : { root: {} },
168
168
  styles: (e, t) => t.variant === "dot" ? { label: { color: `var(--mantine-color-${t.color || e.primaryColor}-5)` } } : {}
169
169
  }),
170
- Avatar: C.extend({ defaultProps: { radius: 9999 } }),
171
- Alert: v.extend({ defaultProps: { variant: "light" } }),
172
- Anchor: b.extend({ defaultProps: { underline: "hover" } }),
173
- Card: re.extend({ defaultProps: {
170
+ Avatar: E.extend({ defaultProps: { radius: 9999 } }),
171
+ Alert: x.extend({ defaultProps: { variant: "light" } }),
172
+ Anchor: C.extend({ defaultProps: { underline: "hover" } }),
173
+ Card: oe.extend({ defaultProps: {
174
174
  withBorder: !0,
175
175
  shadow: "md",
176
176
  radius: "md",
177
177
  padding: "lg"
178
178
  } }),
179
179
  Tooltip: ze.extend({ defaultProps: { withArrow: !0 } }),
180
- ActionIcon: g.extend({ defaultProps: {
180
+ ActionIcon: y.extend({ defaultProps: {
181
181
  variant: "subtle",
182
182
  color: "gray"
183
183
  } }),
184
- Menu: ge.extend({ defaultProps: {
184
+ Menu: ve.extend({ defaultProps: {
185
185
  shadow: "md",
186
186
  radius: "md"
187
187
  } }),
188
- Modal: ve.extend({ defaultProps: {
188
+ Modal: be.extend({ defaultProps: {
189
189
  centered: !0,
190
190
  radius: "md"
191
191
  } }),
@@ -194,7 +194,7 @@ var G = Ve({
194
194
  verticalSpacing: "sm",
195
195
  horizontalSpacing: "md"
196
196
  } }),
197
- SegmentedControl: Oe.extend({ defaultProps: { radius: "xl" } }),
197
+ SegmentedControl: ke.extend({ defaultProps: { radius: "xl" } }),
198
198
  Select: F.extend({ defaultProps: { checkIconPosition: "right" } })
199
199
  }
200
200
  }), He = [
@@ -248,9 +248,9 @@ function qe({ viewYear: e, viewMonth: t, selectedDate: n, onSelect: r }) {
248
248
  month: "next"
249
249
  });
250
250
  let l = /* @__PURE__ */ new Date(), u = new Date(l.getFullYear(), l.getMonth(), l.getDate()).getTime();
251
- return /* @__PURE__ */ W(E, {
251
+ return /* @__PURE__ */ W(O, {
252
252
  style: { width: 252 },
253
- children: [/* @__PURE__ */ U(E, {
253
+ children: [/* @__PURE__ */ U(O, {
254
254
  style: {
255
255
  display: "grid",
256
256
  gridTemplateColumns: "repeat(7, 36px)",
@@ -263,7 +263,7 @@ function qe({ viewYear: e, viewMonth: t, selectedDate: n, onSelect: r }) {
263
263
  style: { lineHeight: "28px" },
264
264
  children: e
265
265
  }, e))
266
- }), /* @__PURE__ */ U(E, {
266
+ }), /* @__PURE__ */ U(O, {
267
267
  style: {
268
268
  display: "grid",
269
269
  gridTemplateColumns: "repeat(7, 36px)"
@@ -295,21 +295,21 @@ function qe({ viewYear: e, viewMonth: t, selectedDate: n, onSelect: r }) {
295
295
  });
296
296
  }
297
297
  function q({ value: e, onChange: t, placeholder: n = "Pilih tanggal & jam" }) {
298
- let r = e instanceof Date ? e : /* @__PURE__ */ new Date(), [i, a] = R(!1), [o, s] = R(r.getFullYear()), [c, l] = R(r.getMonth()), [u, d] = R(e instanceof Date ? e : null), [f, p] = R(e instanceof Date ? e.getHours() : 0), [m, h] = R(e instanceof Date ? e.getMinutes() : 0), _ = /* @__PURE__ */ new Date(), v = !!(u && u.getDate() === _.getDate() && u.getMonth() === _.getMonth() && u.getFullYear() === _.getFullYear()), y = Array.from({ length: 24 }, (e, t) => ({
298
+ let r = e instanceof Date ? e : /* @__PURE__ */ new Date(), [i, a] = R(!1), [o, s] = R(r.getFullYear()), [c, l] = R(r.getMonth()), [u, d] = R(e instanceof Date ? e : null), [f, p] = R(e instanceof Date ? e.getHours() : 0), [m, h] = R(e instanceof Date ? e.getMinutes() : 0), g = /* @__PURE__ */ new Date(), _ = !!(u && u.getDate() === g.getDate() && u.getMonth() === g.getMonth() && u.getFullYear() === g.getFullYear()), v = Array.from({ length: 24 }, (e, t) => ({
299
299
  value: String(t),
300
300
  label: String(t).padStart(2, "0"),
301
- disabled: v && t < _.getHours()
301
+ disabled: _ && t < g.getHours()
302
302
  })), b = Array.from({ length: 60 }, (e, t) => ({
303
303
  value: String(t),
304
304
  label: String(t).padStart(2, "0"),
305
- disabled: v && f === _.getHours() && t < _.getMinutes()
305
+ disabled: _ && f === g.getHours() && t < g.getMinutes()
306
306
  })), x = () => {
307
307
  c === 0 ? (l(11), s((e) => e - 1)) : l((e) => e - 1);
308
308
  }, S = () => {
309
309
  c === 11 ? (l(0), s((e) => e + 1)) : l((e) => e + 1);
310
310
  }, C = (e) => {
311
311
  let n = f, r = m, i = new Date(o, c, e);
312
- i.getDate() === _.getDate() && i.getMonth() === _.getMonth() && i.getFullYear() === _.getFullYear() && (n < _.getHours() || n === _.getHours() && r < _.getMinutes()) && (n = _.getHours(), r = _.getMinutes(), p(n), h(r));
312
+ i.getDate() === g.getDate() && i.getMonth() === g.getMonth() && i.getFullYear() === g.getFullYear() && (n < g.getHours() || n === g.getHours() && r < g.getMinutes()) && (n = g.getHours(), r = g.getMinutes(), p(n), h(r));
313
313
  let a = new Date(o, c, e, n, r);
314
314
  d(a), t?.(a);
315
315
  }, w = (e) => {
@@ -324,9 +324,9 @@ function q({ value: e, onChange: t, placeholder: n = "Pilih tanggal & jam" }) {
324
324
  let e = new Date(u);
325
325
  e.setMinutes(n), d(e), t?.(e);
326
326
  }
327
- }, D = (e) => {
327
+ }, E = (e) => {
328
328
  e.stopPropagation(), d(null), p(0), h(0), t?.(null);
329
- }, O = Ke(u, f, m);
329
+ }, D = Ke(u, f, m);
330
330
  return /* @__PURE__ */ W(P, {
331
331
  opened: i,
332
332
  onChange: a,
@@ -335,7 +335,7 @@ function q({ value: e, onChange: t, placeholder: n = "Pilih tanggal & jam" }) {
335
335
  shadow: "md",
336
336
  radius: "md",
337
337
  trapFocus: !0,
338
- children: [/* @__PURE__ */ U(P.Target, { children: /* @__PURE__ */ W(E, {
338
+ children: [/* @__PURE__ */ U(P.Target, { children: /* @__PURE__ */ W(O, {
339
339
  onClick: () => a((e) => !e),
340
340
  style: {
341
341
  display: "flex",
@@ -358,18 +358,18 @@ function q({ value: e, onChange: t, placeholder: n = "Pilih tanggal & jam" }) {
358
358
  }),
359
359
  /* @__PURE__ */ U(I, {
360
360
  fz: 12,
361
- c: O ? "neutral.7" : "neutral.4",
361
+ c: D ? "neutral.7" : "neutral.4",
362
362
  style: {
363
363
  flex: 1,
364
364
  overflow: "hidden",
365
365
  textOverflow: "ellipsis",
366
366
  whiteSpace: "nowrap"
367
367
  },
368
- children: O || n
368
+ children: D || n
369
369
  }),
370
- u && /* @__PURE__ */ U(E, {
370
+ u && /* @__PURE__ */ U(O, {
371
371
  component: "span",
372
- onClick: D,
372
+ onClick: E,
373
373
  style: {
374
374
  display: "flex",
375
375
  alignItems: "center",
@@ -390,7 +390,7 @@ function q({ value: e, onChange: t, placeholder: n = "Pilih tanggal & jam" }) {
390
390
  align: "center",
391
391
  mb: 8,
392
392
  children: [
393
- /* @__PURE__ */ U(g, {
393
+ /* @__PURE__ */ U(y, {
394
394
  variant: "subtle",
395
395
  color: "gray",
396
396
  size: "sm",
@@ -407,7 +407,7 @@ function q({ value: e, onChange: t, placeholder: n = "Pilih tanggal & jam" }) {
407
407
  o
408
408
  ]
409
409
  }),
410
- /* @__PURE__ */ U(g, {
410
+ /* @__PURE__ */ U(y, {
411
411
  variant: "subtle",
412
412
  color: "gray",
413
413
  size: "sm",
@@ -422,7 +422,7 @@ function q({ value: e, onChange: t, placeholder: n = "Pilih tanggal & jam" }) {
422
422
  selectedDate: u,
423
423
  onSelect: C
424
424
  }),
425
- /* @__PURE__ */ U(E, { style: {
425
+ /* @__PURE__ */ U(O, { style: {
426
426
  height: 1,
427
427
  background: "var(--mantine-color-gray-2)",
428
428
  margin: "12px 0"
@@ -442,7 +442,7 @@ function q({ value: e, onChange: t, placeholder: n = "Pilih tanggal & jam" }) {
442
442
  radius: "xl",
443
443
  value: String(f),
444
444
  onChange: w,
445
- data: y,
445
+ data: v,
446
446
  w: 72,
447
447
  size: "xs",
448
448
  searchable: !0
@@ -527,9 +527,9 @@ function $({ viewYear: e, viewMonth: t, start: n, end: r, onSelect: i }) {
527
527
  month: "next"
528
528
  });
529
529
  let u = /* @__PURE__ */ new Date(), d = new Date(u.getFullYear(), u.getMonth(), u.getDate()).getTime(), f = n ? Z(n.getFullYear(), n.getMonth(), n.getDate()) : null, p = r ? Z(r.getFullYear(), r.getMonth(), r.getDate()) : null;
530
- return /* @__PURE__ */ W(E, {
530
+ return /* @__PURE__ */ W(O, {
531
531
  style: { width: 252 },
532
- children: [/* @__PURE__ */ U(E, {
532
+ children: [/* @__PURE__ */ U(O, {
533
533
  style: {
534
534
  display: "grid",
535
535
  gridTemplateColumns: "repeat(7, 36px)",
@@ -542,14 +542,14 @@ function $({ viewYear: e, viewMonth: t, start: n, end: r, onSelect: i }) {
542
542
  style: { lineHeight: "28px" },
543
543
  children: e
544
544
  }, e))
545
- }), /* @__PURE__ */ U(E, {
545
+ }), /* @__PURE__ */ U(O, {
546
546
  style: {
547
547
  display: "grid",
548
548
  gridTemplateColumns: "repeat(7, 36px)"
549
549
  },
550
550
  children: c.map((a, o) => {
551
551
  let s = o % 7, c = a.month === "current", l = c ? Z(e, t, a.day) : null, m = c ? new Date(e, t, a.day) : null, h = c && X(m, n), g = c && X(m, r), _ = h || g, v = !!(c && l !== null && f !== null && p !== null && l > f && l < p), y = c && u.getDate() === a.day && u.getMonth() === t && u.getFullYear() === e, b = c && l !== null && l < d, x = !c || b, S = Xe(s);
552
- return /* @__PURE__ */ U(E, {
552
+ return /* @__PURE__ */ U(O, {
553
553
  style: {
554
554
  display: "flex",
555
555
  alignItems: "center",
@@ -586,19 +586,19 @@ function $({ viewYear: e, viewMonth: t, start: n, end: r, onSelect: i }) {
586
586
  });
587
587
  }
588
588
  function Ze({ value: e, onChange: t, placeholder: n = "Pilih periode" }) {
589
- let r = e?.[0] instanceof Date ? e[0] : /* @__PURE__ */ new Date(), [i, a] = R(!1), [o, s] = R(r.getFullYear()), [c, l] = R(r.getMonth()), [u, d] = R(e?.[0] instanceof Date ? e[0] : null), [f, p] = R(e?.[1] instanceof Date ? e[1] : null), m = c === 11 ? o + 1 : o, h = c === 11 ? 0 : c + 1, _ = /* @__PURE__ */ new Date(), v = (e) => Array.from({ length: 24 }, (t, n) => ({
589
+ let r = e?.[0] instanceof Date ? e[0] : /* @__PURE__ */ new Date(), [i, a] = R(!1), [o, s] = R(r.getFullYear()), [c, l] = R(r.getMonth()), [u, d] = R(e?.[0] instanceof Date ? e[0] : null), [f, p] = R(e?.[1] instanceof Date ? e[1] : null), m = c === 11 ? o + 1 : o, h = c === 11 ? 0 : c + 1, g = /* @__PURE__ */ new Date(), _ = (e) => Array.from({ length: 24 }, (t, n) => ({
590
590
  value: String(n),
591
591
  label: String(n).padStart(2, "0"),
592
- disabled: X(e, _) && n < _.getHours()
593
- })), y = (e) => Array.from({ length: 60 }, (t, n) => ({
592
+ disabled: X(e, g) && n < g.getHours()
593
+ })), v = (e) => Array.from({ length: 60 }, (t, n) => ({
594
594
  value: String(n),
595
595
  label: String(n).padStart(2, "0"),
596
- disabled: X(e, _) && e !== null && e.getHours() === _.getHours() && n < _.getMinutes()
596
+ disabled: X(e, g) && e !== null && e.getHours() === g.getHours() && n < g.getMinutes()
597
597
  })), b = () => {
598
598
  c === 0 ? (l(11), s((e) => e - 1)) : l((e) => e - 1);
599
599
  }, x = () => {
600
600
  c === 11 ? (l(0), s((e) => e + 1)) : l((e) => e + 1);
601
- }, S = (e, n) => t?.([e, n]), C = (e) => X(e, _) && e.getTime() < _.getTime() ? new Date(_.getFullYear(), _.getMonth(), _.getDate(), _.getHours(), _.getMinutes()) : e, w = (e, t, n) => {
601
+ }, S = (e, n) => t?.([e, n]), C = (e) => X(e, g) && e.getTime() < g.getTime() ? new Date(g.getFullYear(), g.getMonth(), g.getDate(), g.getHours(), g.getMinutes()) : e, w = (e, t, n) => {
602
602
  if (!u || u && f) {
603
603
  let r = u?.getHours() ?? 0, i = u?.getMinutes() ?? 0, a = C(new Date(e, t, n, r, i));
604
604
  d(a), p(null), S(a, null);
@@ -622,9 +622,9 @@ function Ze({ value: e, onChange: t, placeholder: n = "Pilih periode" }) {
622
622
  let e = new Date(f);
623
623
  t === "h" ? e.setHours(r) : e.setMinutes(r), p(e), S(u, e);
624
624
  }
625
- }, D = (e) => {
625
+ }, E = (e) => {
626
626
  e.stopPropagation(), d(null), p(null), S(null, null);
627
- }, O = u ? `${Q(u)}${f ? ` - ${Q(f)}` : ""}` : "";
627
+ }, D = u ? `${Q(u)}${f ? ` - ${Q(f)}` : ""}` : "";
628
628
  return /* @__PURE__ */ W(P, {
629
629
  opened: i,
630
630
  onChange: a,
@@ -633,7 +633,7 @@ function Ze({ value: e, onChange: t, placeholder: n = "Pilih periode" }) {
633
633
  shadow: "md",
634
634
  radius: "md",
635
635
  trapFocus: !0,
636
- children: [/* @__PURE__ */ U(P.Target, { children: /* @__PURE__ */ W(E, {
636
+ children: [/* @__PURE__ */ U(P.Target, { children: /* @__PURE__ */ W(O, {
637
637
  onClick: () => a((e) => !e),
638
638
  style: {
639
639
  display: "flex",
@@ -656,18 +656,18 @@ function Ze({ value: e, onChange: t, placeholder: n = "Pilih periode" }) {
656
656
  }),
657
657
  /* @__PURE__ */ U(I, {
658
658
  fz: 12,
659
- c: O ? "neutral.7" : "neutral.4",
659
+ c: D ? "neutral.7" : "neutral.4",
660
660
  style: {
661
661
  flex: 1,
662
662
  overflow: "hidden",
663
663
  textOverflow: "ellipsis",
664
664
  whiteSpace: "nowrap"
665
665
  },
666
- children: O || n
666
+ children: D || n
667
667
  }),
668
- u && /* @__PURE__ */ U(E, {
668
+ u && /* @__PURE__ */ U(O, {
669
669
  component: "span",
670
- onClick: D,
670
+ onClick: E,
671
671
  style: {
672
672
  display: "flex",
673
673
  alignItems: "center",
@@ -686,12 +686,12 @@ function Ze({ value: e, onChange: t, placeholder: n = "Pilih periode" }) {
686
686
  align: "flex-start",
687
687
  gap: 24,
688
688
  wrap: "nowrap",
689
- children: [/* @__PURE__ */ W(E, { children: [/* @__PURE__ */ W(k, {
689
+ children: [/* @__PURE__ */ W(O, { children: [/* @__PURE__ */ W(k, {
690
690
  justify: "space-between",
691
691
  align: "center",
692
692
  mb: 8,
693
693
  children: [
694
- /* @__PURE__ */ U(g, {
694
+ /* @__PURE__ */ U(y, {
695
695
  variant: "subtle",
696
696
  color: "gray",
697
697
  size: "sm",
@@ -708,7 +708,7 @@ function Ze({ value: e, onChange: t, placeholder: n = "Pilih periode" }) {
708
708
  o
709
709
  ]
710
710
  }),
711
- /* @__PURE__ */ U(E, { w: 22 })
711
+ /* @__PURE__ */ U(O, { w: 22 })
712
712
  ]
713
713
  }), /* @__PURE__ */ U($, {
714
714
  viewYear: o,
@@ -716,12 +716,12 @@ function Ze({ value: e, onChange: t, placeholder: n = "Pilih periode" }) {
716
716
  start: u,
717
717
  end: f,
718
718
  onSelect: w
719
- })] }), /* @__PURE__ */ W(E, { children: [/* @__PURE__ */ W(k, {
719
+ })] }), /* @__PURE__ */ W(O, { children: [/* @__PURE__ */ W(k, {
720
720
  justify: "space-between",
721
721
  align: "center",
722
722
  mb: 8,
723
723
  children: [
724
- /* @__PURE__ */ U(E, { w: 22 }),
724
+ /* @__PURE__ */ U(O, { w: 22 }),
725
725
  /* @__PURE__ */ W(I, {
726
726
  fz: 12,
727
727
  fw: 700,
@@ -732,7 +732,7 @@ function Ze({ value: e, onChange: t, placeholder: n = "Pilih periode" }) {
732
732
  m
733
733
  ]
734
734
  }),
735
- /* @__PURE__ */ U(g, {
735
+ /* @__PURE__ */ U(y, {
736
736
  variant: "subtle",
737
737
  color: "gray",
738
738
  size: "sm",
@@ -748,7 +748,7 @@ function Ze({ value: e, onChange: t, placeholder: n = "Pilih periode" }) {
748
748
  onSelect: w
749
749
  })] })]
750
750
  }),
751
- /* @__PURE__ */ U(E, { style: {
751
+ /* @__PURE__ */ U(O, { style: {
752
752
  height: 1,
753
753
  background: "var(--mantine-color-gray-2)",
754
754
  margin: "12px 0"
@@ -772,7 +772,7 @@ function Ze({ value: e, onChange: t, placeholder: n = "Pilih periode" }) {
772
772
  radius: "xl",
773
773
  value: u ? String(u.getHours()) : null,
774
774
  onChange: (e) => T("start", "h", e),
775
- data: v(u),
775
+ data: _(u),
776
776
  w: 68,
777
777
  size: "xs",
778
778
  searchable: !0,
@@ -788,7 +788,7 @@ function Ze({ value: e, onChange: t, placeholder: n = "Pilih periode" }) {
788
788
  radius: "xl",
789
789
  value: u ? String(u.getMinutes()) : null,
790
790
  onChange: (e) => T("start", "m", e),
791
- data: y(u),
791
+ data: v(u),
792
792
  w: 68,
793
793
  size: "xs",
794
794
  searchable: !0,
@@ -811,7 +811,7 @@ function Ze({ value: e, onChange: t, placeholder: n = "Pilih periode" }) {
811
811
  radius: "xl",
812
812
  value: f ? String(f.getHours()) : null,
813
813
  onChange: (e) => T("end", "h", e),
814
- data: v(f),
814
+ data: _(f),
815
815
  w: 68,
816
816
  size: "xs",
817
817
  searchable: !0,
@@ -827,7 +827,7 @@ function Ze({ value: e, onChange: t, placeholder: n = "Pilih periode" }) {
827
827
  radius: "xl",
828
828
  value: f ? String(f.getMinutes()) : null,
829
829
  onChange: (e) => T("end", "m", e),
830
- data: y(f),
830
+ data: v(f),
831
831
  w: 68,
832
832
  size: "xs",
833
833
  searchable: !0,
@@ -842,4 +842,4 @@ function Ze({ value: e, onChange: t, placeholder: n = "Pilih periode" }) {
842
842
  });
843
843
  }
844
844
  //#endregion
845
- export { h as ActionIcon, _ as Alert, y as Anchor, x as AppShell, S as Avatar, w as Badge, p as Box, D as Breadcrumbs, O as Burger, ee as Button, ne as Card, c as Center, ie as Checkbox, ae as CloseButton, oe as ColorSwatch, d as Container, q as DateTimePicker, Ze as DateTimeRangePicker, se as Divider, ce as EmptyState, le as FileButton, ue as FileInput, a as Flex, e as Grid, l as Group, f as Image, de as Indicator, pe as Loader, me as LoadingOverlay, he as Menu, _e as Modal, ye as MultiSelect, be as NativeSelect, A as NavLink, j as Notification, M as NumberInput, s as Pagination, N as Paper, xe as PasswordInput, Se as Pill, Ce as Popover, we as Progress, Te as Radio, Ee as RingProgress, t as ScrollArea, De as SegmentedControl, ke as Select, o as SimpleGrid, Ae as Skeleton, m as Stack, je as Stepper, Me as Switch, u as Table, Pe as Tabs, Fe as TagsInput, n as Text, i as TextInput, Ie as Textarea, Le as ThemeIcon, r as Title, Re as Tooltip, Be as VisuallyHidden, G as kelolaTheme, G as theme };
845
+ export { v as ActionIcon, b as Alert, S as Anchor, w as AppShell, T as Avatar, D as Badge, h as Box, te as Breadcrumbs, ne as Burger, re as Button, ae as Card, u as Center, a as Checkbox, se as CloseButton, ce as ColorSwatch, p as Container, q as DateTimePicker, Ze as DateTimeRangePicker, le as Divider, ue as EmptyState, de as FileButton, fe as FileInput, s as Flex, t as Grid, d as Group, m as Image, pe as Indicator, he as Loader, ge as LoadingOverlay, _e as Menu, ye as Modal, A as MultiSelect, e as NativeSelect, j as NavLink, M as Notification, N as NumberInput, o as Pagination, xe as Paper, Se as PasswordInput, Ce as Pill, we as Popover, Te as Progress, Ee as Radio, De as RingProgress, n as ScrollArea, Oe as SegmentedControl, Ae as Select, c as SimpleGrid, l as Skeleton, g as Stack, je as Stepper, Me as Switch, f as Table, Pe as Tabs, Fe as TagsInput, r as Text, _ as TextInput, Ie as Textarea, Le as ThemeIcon, i as Title, Re as Tooltip, Be as VisuallyHidden, G as kelolaTheme, G as theme };
@@ -0,0 +1,2 @@
1
+ import { Box as e, Center as t, Checkbox as n, Container as r, Flex as i, Grid as a, Group as o, Image as s, NativeSelect as c, Pagination as l, ScrollArea as u, SimpleGrid as d, Skeleton as f, Stack as p, Table as m, Text as h, TextInput as g, Title as _ } from "@mantine/core";
2
+ export { c as _, a, u as c, h as d, _ as f, n as g, l as h, i, d as l, f as m, t as n, o, m as p, r, s, e as t, p as u, g as v };
@@ -35,7 +35,7 @@ export declare const kelolaTheme: {
35
35
  headings?: {
36
36
  fontFamily?: string | undefined;
37
37
  fontWeight?: string | undefined;
38
- textWrap?: "nowrap" | "wrap" | "balance" | "pretty" | "stable" | undefined;
38
+ textWrap?: "wrap" | "nowrap" | "balance" | "pretty" | "stable" | undefined;
39
39
  sizes?: {
40
40
  h1?: {
41
41
  fontSize?: string | undefined;
@@ -71,8 +71,8 @@ export declare const kelolaTheme: {
71
71
  } | undefined;
72
72
  radius?: {
73
73
  [x: string & {}]: string | undefined;
74
- sm?: string | undefined;
75
74
  xs?: string | undefined;
75
+ sm?: string | undefined;
76
76
  md?: string | undefined;
77
77
  lg?: string | undefined;
78
78
  xl?: string | undefined;
@@ -81,24 +81,24 @@ export declare const kelolaTheme: {
81
81
  spacing?: {
82
82
  [x: number]: string | undefined;
83
83
  [x: string & {}]: string | undefined;
84
- sm?: string | undefined;
85
84
  xs?: string | undefined;
85
+ sm?: string | undefined;
86
86
  md?: string | undefined;
87
87
  lg?: string | undefined;
88
88
  xl?: string | undefined;
89
89
  } | undefined;
90
90
  fontSizes?: {
91
91
  [x: string & {}]: string | undefined;
92
- sm?: string | undefined;
93
92
  xs?: string | undefined;
93
+ sm?: string | undefined;
94
94
  md?: string | undefined;
95
95
  lg?: string | undefined;
96
96
  xl?: string | undefined;
97
97
  } | undefined;
98
98
  lineHeights?: {
99
99
  [x: string & {}]: string | undefined;
100
- sm?: string | undefined;
101
100
  xs?: string | undefined;
101
+ sm?: string | undefined;
102
102
  md?: string | undefined;
103
103
  lg?: string | undefined;
104
104
  xl?: string | undefined;
@@ -111,22 +111,22 @@ export declare const kelolaTheme: {
111
111
  } | undefined;
112
112
  breakpoints?: {
113
113
  [x: string & {}]: string | undefined;
114
- sm?: string | undefined;
115
114
  xs?: string | undefined;
115
+ sm?: string | undefined;
116
116
  md?: string | undefined;
117
117
  lg?: string | undefined;
118
118
  xl?: string | undefined;
119
119
  } | undefined;
120
120
  shadows?: {
121
121
  [x: string & {}]: string | undefined;
122
- sm?: string | undefined;
123
122
  xs?: string | undefined;
123
+ sm?: string | undefined;
124
124
  md?: string | undefined;
125
125
  lg?: string | undefined;
126
126
  xl?: string | undefined;
127
127
  } | undefined;
128
128
  respectReducedMotion?: boolean | undefined;
129
- cursorType?: "pointer" | "default" | undefined;
129
+ cursorType?: "default" | "pointer" | undefined;
130
130
  defaultGradient?: {
131
131
  from?: string | undefined;
132
132
  to?: string | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@talentlytica/prodigy",
3
- "version": "1.2.1",
3
+ "version": "1.3.0",
4
4
  "description": "Talentlytica Prodigy design system — Mantine v9 base, tema Kelola Apps.",
5
5
  "license": "UNLICENSED",
6
6
  "repository": {
@@ -14,7 +14,8 @@
14
14
  "type": "module",
15
15
  "sideEffects": false,
16
16
  "files": [
17
- "dist"
17
+ "dist",
18
+ "CHANGELOG.md"
18
19
  ],
19
20
  "main": "./dist/index.js",
20
21
  "module": "./dist/index.js",
@@ -56,13 +57,27 @@
56
57
  },
57
58
  "typesVersions": {
58
59
  "*": {
59
- "charts": ["./dist/charts.d.ts"],
60
- "dates": ["./dist/dates.d.ts"],
61
- "dropzone": ["./dist/dropzone.d.ts"],
62
- "carousel": ["./dist/carousel.d.ts"],
63
- "rte": ["./dist/rte.d.ts"],
64
- "data-table": ["./dist/data-table.d.ts"],
65
- "notifications": ["./dist/notifications.d.ts"]
60
+ "charts": [
61
+ "./dist/charts.d.ts"
62
+ ],
63
+ "dates": [
64
+ "./dist/dates.d.ts"
65
+ ],
66
+ "dropzone": [
67
+ "./dist/dropzone.d.ts"
68
+ ],
69
+ "carousel": [
70
+ "./dist/carousel.d.ts"
71
+ ],
72
+ "rte": [
73
+ "./dist/rte.d.ts"
74
+ ],
75
+ "data-table": [
76
+ "./dist/data-table.d.ts"
77
+ ],
78
+ "notifications": [
79
+ "./dist/notifications.d.ts"
80
+ ]
66
81
  }
67
82
  },
68
83
  "scripts": {
@@ -70,84 +85,124 @@
70
85
  "build-storybook": "storybook build",
71
86
  "build": "vite build --config vite.lib.config.ts && tsc -p tsconfig.build.json",
72
87
  "typecheck": "tsc --noEmit",
88
+ "test": "vitest run",
89
+ "test:watch": "vitest",
73
90
  "prepublishOnly": "pnpm build"
74
91
  },
75
92
  "peerDependencies": {
76
- "@mantine/core": "^9.4.0",
77
- "react": "^18.2.0 || ^19.0.0",
78
- "react-dom": "^18.2.0 || ^19.0.0",
79
- "@mantine/hooks": "^9.4.0",
80
- "@mantine/notifications": "^9.4.0",
93
+ "@mantine/carousel": "^9.4.0",
81
94
  "@mantine/charts": "^9.4.0",
95
+ "@mantine/core": "^9.4.0",
82
96
  "@mantine/dates": "^9.4.0",
83
97
  "@mantine/dropzone": "^9.4.0",
84
- "@mantine/carousel": "^9.4.0",
98
+ "@mantine/hooks": "^9.4.0",
99
+ "@mantine/notifications": "^9.4.0",
85
100
  "@mantine/tiptap": "^9.4.0",
86
101
  "@tanstack/react-table": "^8.20.0",
87
- "recharts": "^3.2.1",
102
+ "@tiptap/core": "^3.3.0",
103
+ "@tiptap/extension-link": "^3.3.0",
104
+ "@tiptap/pm": "^3.3.0",
105
+ "@tiptap/react": "^3.3.0",
106
+ "@tiptap/starter-kit": "^3.3.0",
88
107
  "dayjs": "^1.11.0",
89
108
  "embla-carousel": "^8.0.0",
90
109
  "embla-carousel-react": "^8.0.0",
91
- "@tiptap/core": "^3.3.0",
92
- "@tiptap/react": "^3.3.0",
93
- "@tiptap/pm": "^3.3.0",
94
- "@tiptap/extension-link": "^3.3.0",
95
- "@tiptap/starter-kit": "^3.3.0"
110
+ "react": "^18.2.0 || ^19.0.0",
111
+ "react-dom": "^18.2.0 || ^19.0.0",
112
+ "recharts": "^3.2.1"
96
113
  },
97
114
  "peerDependenciesMeta": {
98
- "@mantine/hooks": { "optional": true },
99
- "@mantine/notifications": { "optional": true },
100
- "@mantine/charts": { "optional": true },
101
- "@mantine/dates": { "optional": true },
102
- "@mantine/dropzone": { "optional": true },
103
- "@mantine/carousel": { "optional": true },
104
- "@mantine/tiptap": { "optional": true },
105
- "@tanstack/react-table": { "optional": true },
106
- "recharts": { "optional": true },
107
- "dayjs": { "optional": true },
108
- "embla-carousel": { "optional": true },
109
- "embla-carousel-react": { "optional": true },
110
- "@tiptap/core": { "optional": true },
111
- "@tiptap/react": { "optional": true },
112
- "@tiptap/pm": { "optional": true },
113
- "@tiptap/extension-link": { "optional": true },
114
- "@tiptap/starter-kit": { "optional": true }
115
+ "@mantine/hooks": {
116
+ "optional": true
117
+ },
118
+ "@mantine/notifications": {
119
+ "optional": true
120
+ },
121
+ "@mantine/charts": {
122
+ "optional": true
123
+ },
124
+ "@mantine/dates": {
125
+ "optional": true
126
+ },
127
+ "@mantine/dropzone": {
128
+ "optional": true
129
+ },
130
+ "@mantine/carousel": {
131
+ "optional": true
132
+ },
133
+ "@mantine/tiptap": {
134
+ "optional": true
135
+ },
136
+ "@tanstack/react-table": {
137
+ "optional": true
138
+ },
139
+ "recharts": {
140
+ "optional": true
141
+ },
142
+ "dayjs": {
143
+ "optional": true
144
+ },
145
+ "embla-carousel": {
146
+ "optional": true
147
+ },
148
+ "embla-carousel-react": {
149
+ "optional": true
150
+ },
151
+ "@tiptap/core": {
152
+ "optional": true
153
+ },
154
+ "@tiptap/react": {
155
+ "optional": true
156
+ },
157
+ "@tiptap/pm": {
158
+ "optional": true
159
+ },
160
+ "@tiptap/extension-link": {
161
+ "optional": true
162
+ },
163
+ "@tiptap/starter-kit": {
164
+ "optional": true
165
+ }
115
166
  },
116
167
  "devDependencies": {
117
- "@mantine/core": "^9.4.1",
118
- "@mantine/hooks": "^9.4.1",
119
- "@mantine/notifications": "^9.4.1",
168
+ "@mantine/carousel": "^9.4.1",
120
169
  "@mantine/charts": "^9.4.1",
170
+ "@mantine/core": "^9.4.1",
121
171
  "@mantine/dates": "^9.4.1",
122
172
  "@mantine/dropzone": "^9.4.1",
123
- "@mantine/carousel": "^9.4.1",
173
+ "@mantine/hooks": "^9.4.1",
174
+ "@mantine/notifications": "^9.4.1",
124
175
  "@mantine/tiptap": "^9.4.1",
125
- "@tanstack/react-table": "^8.21.3",
126
- "recharts": "^3.10.0",
127
- "dayjs": "^1.11.21",
128
- "embla-carousel": "^8.6.0",
129
- "embla-carousel-react": "^8.6.0",
130
- "@tiptap/core": "^3.28.0",
131
- "@tiptap/react": "^3.28.0",
132
- "@tiptap/pm": "^3.28.0",
133
- "@tiptap/extension-link": "^3.28.0",
134
- "@tiptap/starter-kit": "^3.28.0",
135
176
  "@storybook/addon-docs": "^10.5.0",
136
177
  "@storybook/addon-themes": "^10.5.0",
137
178
  "@storybook/react-vite": "^10.5.0",
138
179
  "@tabler/icons-react": "^3.44.0",
180
+ "@tanstack/react-table": "^8.21.3",
181
+ "@testing-library/jest-dom": "^6",
182
+ "@testing-library/react": "^16",
183
+ "@tiptap/core": "^3.28.0",
184
+ "@tiptap/extension-link": "^3.28.0",
185
+ "@tiptap/pm": "^3.28.0",
186
+ "@tiptap/react": "^3.28.0",
187
+ "@tiptap/starter-kit": "^3.28.0",
139
188
  "@types/react": "^19.2.0",
140
189
  "@types/react-dom": "^19.2.0",
141
190
  "@vitejs/plugin-react": "^6.0.0",
191
+ "dayjs": "^1.11.21",
192
+ "embla-carousel": "^8.6.0",
193
+ "embla-carousel-react": "^8.6.0",
194
+ "jsdom": "^26",
142
195
  "postcss": "^8.5.0",
143
196
  "postcss-preset-mantine": "^1.18.0",
144
197
  "postcss-simple-vars": "^7.0.1",
145
198
  "react": "^19.2.0",
146
199
  "react-dom": "^19.2.0",
200
+ "recharts": "^3.10.0",
147
201
  "remark-gfm": "^4.0.1",
148
202
  "storybook": "^10.5.0",
149
203
  "typescript": "^5.7.0",
150
- "vite": "^8.1.0"
204
+ "vite": "^8.1.0",
205
+ "vitest": "^4"
151
206
  },
152
207
  "packageManager": "pnpm@9.15.9",
153
208
  "engines": {
@@ -1,2 +0,0 @@
1
- import { Box as e, Center as t, Container as n, Flex as r, Grid as i, Group as a, Image as o, Pagination as s, ScrollArea as c, SimpleGrid as l, Stack as u, Table as d, Text as f, TextInput as p, Title as m } from "@mantine/core";
2
- export { i as a, c, f as d, m as f, p as h, r as i, l, s as m, t as n, a as o, d as p, n as r, o as s, e as t, u };