@itilite/lumina-ui 1.0.13-alpha → 1.0.14-alpha

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.
@@ -0,0 +1,52 @@
1
+ import * as React from 'react';
2
+
3
+ interface TimeValue {
4
+ hour: string;
5
+ minute: string;
6
+ period: "AM" | "PM";
7
+ }
8
+ interface DateRangeValue {
9
+ startDate: Date | null;
10
+ endDate: Date | null;
11
+ startTime: TimeValue;
12
+ endTime: TimeValue;
13
+ timezone: string;
14
+ activePreset?: string;
15
+ }
16
+ interface PresetOption {
17
+ label: string;
18
+ key: string;
19
+ getRange: () => (Date | null)[];
20
+ }
21
+ interface TimezoneOption {
22
+ label: string;
23
+ value: string;
24
+ }
25
+ interface DateRangePickerProps {
26
+ value?: DateRangeValue;
27
+ onChange?: (value: DateRangeValue) => void;
28
+ onRangeChange?: (value: DateRangeValue) => void;
29
+ confirmLabel?: string;
30
+ className?: string;
31
+ disabled?: boolean;
32
+ disablePastDates?: boolean;
33
+ minDate?: string | null;
34
+ maxDate?: string | null;
35
+ showSingleCalendar?: boolean;
36
+ id?: string;
37
+ defaultTimezone?: string;
38
+ isTimezoneDisabled?: boolean;
39
+ timezoneOptions?: TimezoneOption[];
40
+ /** Initial active preset key. e.g. "custom", "this-month", "yesterday" */
41
+ defaultPreset?: string;
42
+ presets?: PresetOption[];
43
+ hidePresets?: boolean;
44
+ hideFooter?: boolean;
45
+ }
46
+
47
+ declare function AdvancedDateRangePicker({ value, onChange, confirmLabel, className, disabled, disablePastDates, minDate, maxDate, showSingleCalendar, id, defaultTimezone, isTimezoneDisabled, timezoneOptions, defaultPreset, presets, hidePresets, hideFooter, }: DateRangePickerProps): React.JSX.Element;
48
+ declare namespace AdvancedDateRangePicker {
49
+ var displayName: string;
50
+ }
51
+
52
+ export { AdvancedDateRangePicker as A, type DateRangePickerProps as D, type PresetOption as P, type TimeValue as T, type DateRangeValue as a, type TimezoneOption as b };
@@ -0,0 +1,52 @@
1
+ import * as React from 'react';
2
+
3
+ interface TimeValue {
4
+ hour: string;
5
+ minute: string;
6
+ period: "AM" | "PM";
7
+ }
8
+ interface DateRangeValue {
9
+ startDate: Date | null;
10
+ endDate: Date | null;
11
+ startTime: TimeValue;
12
+ endTime: TimeValue;
13
+ timezone: string;
14
+ activePreset?: string;
15
+ }
16
+ interface PresetOption {
17
+ label: string;
18
+ key: string;
19
+ getRange: () => (Date | null)[];
20
+ }
21
+ interface TimezoneOption {
22
+ label: string;
23
+ value: string;
24
+ }
25
+ interface DateRangePickerProps {
26
+ value?: DateRangeValue;
27
+ onChange?: (value: DateRangeValue) => void;
28
+ onRangeChange?: (value: DateRangeValue) => void;
29
+ confirmLabel?: string;
30
+ className?: string;
31
+ disabled?: boolean;
32
+ disablePastDates?: boolean;
33
+ minDate?: string | null;
34
+ maxDate?: string | null;
35
+ showSingleCalendar?: boolean;
36
+ id?: string;
37
+ defaultTimezone?: string;
38
+ isTimezoneDisabled?: boolean;
39
+ timezoneOptions?: TimezoneOption[];
40
+ /** Initial active preset key. e.g. "custom", "this-month", "yesterday" */
41
+ defaultPreset?: string;
42
+ presets?: PresetOption[];
43
+ hidePresets?: boolean;
44
+ hideFooter?: boolean;
45
+ }
46
+
47
+ declare function AdvancedDateRangePicker({ value, onChange, confirmLabel, className, disabled, disablePastDates, minDate, maxDate, showSingleCalendar, id, defaultTimezone, isTimezoneDisabled, timezoneOptions, defaultPreset, presets, hidePresets, hideFooter, }: DateRangePickerProps): React.JSX.Element;
48
+ declare namespace AdvancedDateRangePicker {
49
+ var displayName: string;
50
+ }
51
+
52
+ export { AdvancedDateRangePicker as A, type DateRangePickerProps as D, type PresetOption as P, type TimeValue as T, type DateRangeValue as a, type TimezoneOption as b };
@@ -0,0 +1,82 @@
1
+ import * as React from 'react';
2
+ import { TableProps as TableProps$1, TablePaginationConfig } from 'antd';
3
+
4
+ type SortOrder = "ascend" | "descend" | undefined;
5
+ type AntColumnType<RecordType> = NonNullable<TableProps$1<RecordType>["columns"]>[number];
6
+ interface LuminaColumnHeaderProps {
7
+ /** Clicking cycles: undefined → ascend → descend → undefined */
8
+ sortable?: boolean;
9
+ /** Provide to make sort controlled. */
10
+ sortOrder?: SortOrder;
11
+ onSortChange?: (order: SortOrder) => void;
12
+ /** MUST be provided if sortable is true, otherwise no icon renders. */
13
+ sortIcon?: React.ReactNode;
14
+ /** > 0 turns the filter icon red and shows a count badge. */
15
+ filterCount?: number;
16
+ /** MUST be provided if filterContent is present, otherwise no icon renders. */
17
+ filterIcon?: React.ReactNode;
18
+ /** Renders a filter icon button; clicking it toggles visibility of this content. */
19
+ filterContent?: React.ReactNode;
20
+ className?: string;
21
+ }
22
+ type LuminaColumnType<RecordType = any> = AntColumnType<RecordType> & {
23
+ headerProps?: LuminaColumnHeaderProps;
24
+ };
25
+ type LuminaColumnsType<RecordType = any> = LuminaColumnType<RecordType>[];
26
+ interface TableProps<RecordType = any> extends Omit<TableProps$1<RecordType>, "size" | "bordered" | "pagination" | "columns"> {
27
+ /** `selectable` — clicking any row toggles its checkbox */
28
+ variant?: "default" | "selectable";
29
+ isAccordion?: boolean;
30
+ isToolbar?: boolean;
31
+ size?: "small" | "middle" | "large";
32
+ className?: string;
33
+ pagination?: TablePaginationConfig | boolean;
34
+ /** Add `headerProps` to any column to enable sort/filter icons. */
35
+ columns?: LuminaColumnsType<RecordType>;
36
+ /** Total items for server-side pagination. */
37
+ total?: number;
38
+ /** Current page number (1-indexed). */
39
+ current?: number;
40
+ pageSize?: number;
41
+ onPaginationChange?: TablePaginationConfig["onChange"];
42
+ emptyState?: React.ReactNode;
43
+ hideHeader?: boolean;
44
+ loadingIndicator?: React.ReactElement;
45
+ /** Extra class applied to header cells (th). */
46
+ headerCellClassName?: string;
47
+ /** Extra class applied to body cells (td). */
48
+ bodyCellClassName?: string;
49
+ /** Can be a string or a per-row function. */
50
+ rowClassName?: string | ((record: RecordType, index: number) => string);
51
+ }
52
+
53
+ /**
54
+ * Lumina Table component.
55
+ *
56
+ * Variants:
57
+ * - `default` – standard table
58
+ * - `selectable` – use with `rowSelection`; clicking any row toggles its checkbox
59
+ *
60
+ * Use `isAccordion` / `isToolbar` to strip outer chrome when embedded.
61
+ * Row hover tint is enabled by default via styles.
62
+ *
63
+ * Column header icons — add `headerProps` to any column definition:
64
+ * ```tsx
65
+ * columns={[{
66
+ * key: "name", dataIndex: "name", title: "Name",
67
+ * headerProps: {
68
+ * sortable: true,
69
+ * sortOrder: sortOrders.name,
70
+ * onSortChange: (order) => setSortOrders(prev => ({ ...prev, name: order })),
71
+ * filterCount: activeFilters.name ?? 0,
72
+ * filterContent: <MyFilterPanel />,
73
+ * },
74
+ * }]}
75
+ * ```
76
+ */
77
+ declare function Table<RecordType extends object = any>(props: TableProps<RecordType>): React.JSX.Element;
78
+ declare namespace Table {
79
+ var displayName: string;
80
+ }
81
+
82
+ export { type LuminaColumnHeaderProps as L, type SortOrder as S, Table as T, type LuminaColumnType as a, type LuminaColumnsType as b, type TableProps as c };
@@ -0,0 +1,82 @@
1
+ import * as React from 'react';
2
+ import { TableProps as TableProps$1, TablePaginationConfig } from 'antd';
3
+
4
+ type SortOrder = "ascend" | "descend" | undefined;
5
+ type AntColumnType<RecordType> = NonNullable<TableProps$1<RecordType>["columns"]>[number];
6
+ interface LuminaColumnHeaderProps {
7
+ /** Clicking cycles: undefined → ascend → descend → undefined */
8
+ sortable?: boolean;
9
+ /** Provide to make sort controlled. */
10
+ sortOrder?: SortOrder;
11
+ onSortChange?: (order: SortOrder) => void;
12
+ /** MUST be provided if sortable is true, otherwise no icon renders. */
13
+ sortIcon?: React.ReactNode;
14
+ /** > 0 turns the filter icon red and shows a count badge. */
15
+ filterCount?: number;
16
+ /** MUST be provided if filterContent is present, otherwise no icon renders. */
17
+ filterIcon?: React.ReactNode;
18
+ /** Renders a filter icon button; clicking it toggles visibility of this content. */
19
+ filterContent?: React.ReactNode;
20
+ className?: string;
21
+ }
22
+ type LuminaColumnType<RecordType = any> = AntColumnType<RecordType> & {
23
+ headerProps?: LuminaColumnHeaderProps;
24
+ };
25
+ type LuminaColumnsType<RecordType = any> = LuminaColumnType<RecordType>[];
26
+ interface TableProps<RecordType = any> extends Omit<TableProps$1<RecordType>, "size" | "bordered" | "pagination" | "columns"> {
27
+ /** `selectable` — clicking any row toggles its checkbox */
28
+ variant?: "default" | "selectable";
29
+ isAccordion?: boolean;
30
+ isToolbar?: boolean;
31
+ size?: "small" | "middle" | "large";
32
+ className?: string;
33
+ pagination?: TablePaginationConfig | boolean;
34
+ /** Add `headerProps` to any column to enable sort/filter icons. */
35
+ columns?: LuminaColumnsType<RecordType>;
36
+ /** Total items for server-side pagination. */
37
+ total?: number;
38
+ /** Current page number (1-indexed). */
39
+ current?: number;
40
+ pageSize?: number;
41
+ onPaginationChange?: TablePaginationConfig["onChange"];
42
+ emptyState?: React.ReactNode;
43
+ hideHeader?: boolean;
44
+ loadingIndicator?: React.ReactElement;
45
+ /** Extra class applied to header cells (th). */
46
+ headerCellClassName?: string;
47
+ /** Extra class applied to body cells (td). */
48
+ bodyCellClassName?: string;
49
+ /** Can be a string or a per-row function. */
50
+ rowClassName?: string | ((record: RecordType, index: number) => string);
51
+ }
52
+
53
+ /**
54
+ * Lumina Table component.
55
+ *
56
+ * Variants:
57
+ * - `default` – standard table
58
+ * - `selectable` – use with `rowSelection`; clicking any row toggles its checkbox
59
+ *
60
+ * Use `isAccordion` / `isToolbar` to strip outer chrome when embedded.
61
+ * Row hover tint is enabled by default via styles.
62
+ *
63
+ * Column header icons — add `headerProps` to any column definition:
64
+ * ```tsx
65
+ * columns={[{
66
+ * key: "name", dataIndex: "name", title: "Name",
67
+ * headerProps: {
68
+ * sortable: true,
69
+ * sortOrder: sortOrders.name,
70
+ * onSortChange: (order) => setSortOrders(prev => ({ ...prev, name: order })),
71
+ * filterCount: activeFilters.name ?? 0,
72
+ * filterContent: <MyFilterPanel />,
73
+ * },
74
+ * }]}
75
+ * ```
76
+ */
77
+ declare function Table<RecordType extends object = any>(props: TableProps<RecordType>): React.JSX.Element;
78
+ declare namespace Table {
79
+ var displayName: string;
80
+ }
81
+
82
+ export { type LuminaColumnHeaderProps as L, type SortOrder as S, Table as T, type LuminaColumnType as a, type LuminaColumnsType as b, type TableProps as c };
@@ -1,2 +1,2 @@
1
1
  import 'react';
2
- export { A as AdvancedDateRangePicker, A as default } from '../../AdvancedDateRangePicker-Di3rHxqf.mjs';
2
+ export { A as AdvancedDateRangePicker, A as default } from '../../AdvancedDateRangePicker-DOSprRQR.mjs';
@@ -1,2 +1,2 @@
1
1
  import 'react';
2
- export { A as AdvancedDateRangePicker, A as default } from '../../AdvancedDateRangePicker-Di3rHxqf.js';
2
+ export { A as AdvancedDateRangePicker, A as default } from '../../AdvancedDateRangePicker-DOSprRQR.js';
@@ -926,15 +926,6 @@ function CustomRangePicker(props) {
926
926
  const [selectedDate, setSelectedDate] = (0, import_react3.useState)(
927
927
  !isRange && dateRange[0] ? new Date(dateRange[0]) : null
928
928
  );
929
- (0, import_react3.useEffect)(() => {
930
- const newStart = dateRange[0] ? new Date(dateRange[0]) : null;
931
- const newEnd = dateRange[1] ? new Date(dateRange[1]) : null;
932
- setStartDate(newStart);
933
- setEndDate(newEnd);
934
- if (newStart) {
935
- setCurrentDate(new Date(newStart.getFullYear(), newStart.getMonth(), 1));
936
- }
937
- }, [dateRange]);
938
929
  const getDaysBetween = (start, end) => {
939
930
  if (!start || !end) return 0;
940
931
  const startDay = (0, import_dayjs.default)(start).startOf("day");
@@ -1076,11 +1067,8 @@ function CustomRangePicker(props) {
1076
1067
  if (isDateDisabled(date)) return;
1077
1068
  if (!isRange) {
1078
1069
  setSelectedDate(date);
1079
- onChangeRef.current(null, (0, import_dayjs.default)(date).format("D MMM, YYYY"));
1080
1070
  return;
1081
1071
  }
1082
- let nextStart = startDate;
1083
- let nextEnd = endDate;
1084
1072
  const isCheckinCheckoutSame = (0, import_dayjs.default)(date).format("D MMM, YYYY") === (0, import_dayjs.default)(startDate).format("D MMM, YYYY");
1085
1073
  if (showNightCount && isCheckinCheckoutSame) {
1086
1074
  setStartDate(null);
@@ -1088,34 +1076,32 @@ function CustomRangePicker(props) {
1088
1076
  setIsSelectingEnd(false);
1089
1077
  setHoverDate(null);
1090
1078
  showToastError("Check-in and check-out dates cannot be the same.");
1091
- onChangeRef.current(null, ["", ""]);
1092
1079
  return;
1093
1080
  }
1094
1081
  if (!startDate || startDate && endDate) {
1095
- nextStart = date;
1096
- nextEnd = null;
1097
- setStartDate(nextStart);
1098
- setEndDate(nextEnd);
1082
+ setStartDate(date);
1083
+ setEndDate(null);
1099
1084
  setIsSelectingEnd(true);
1100
1085
  setHoverDate(null);
1101
1086
  } else if (startDate && !endDate) {
1102
1087
  if (date < startDate) {
1103
- nextEnd = startDate;
1104
- nextStart = date;
1088
+ setEndDate(startDate);
1089
+ setStartDate(date);
1105
1090
  } else {
1106
- nextEnd = date;
1091
+ setEndDate(date);
1107
1092
  }
1108
- setStartDate(nextStart);
1109
- setEndDate(nextEnd);
1110
1093
  setIsSelectingEnd(false);
1111
1094
  setHoverDate(null);
1112
1095
  }
1113
- onChangeRef.current(null, [
1114
- nextStart ? (0, import_dayjs.default)(nextStart).format("D MMM, YYYY") : "",
1115
- nextEnd ? (0, import_dayjs.default)(nextEnd).format("D MMM, YYYY") : ""
1116
- ]);
1117
1096
  };
1118
1097
  (0, import_react3.useEffect)(() => {
1098
+ if (isRange) {
1099
+ sessionStorage.removeItem("rangePickerStartDate");
1100
+ onChangeRef.current(null, [
1101
+ startDate ? (0, import_dayjs.default)(startDate).format("D MMM, YYYY") : "",
1102
+ endDate ? (0, import_dayjs.default)(endDate).format("D MMM, YYYY") : ""
1103
+ ]);
1104
+ }
1119
1105
  if (isRange && startDate && !endDate) {
1120
1106
  sessionStorage.setItem(
1121
1107
  "rangePickerStartDate",
@@ -1123,6 +1109,11 @@ function CustomRangePicker(props) {
1123
1109
  );
1124
1110
  }
1125
1111
  }, [startDate, endDate, isRange]);
1112
+ (0, import_react3.useEffect)(() => {
1113
+ if (!isRange && selectedDate) {
1114
+ onChangeRef.current(null, (0, import_dayjs.default)(selectedDate).format("D MMM, YYYY"));
1115
+ }
1116
+ }, [selectedDate, isRange]);
1126
1117
  const handleDateHover = (date) => {
1127
1118
  if (isDateDisabled(date) || !isRange) return;
1128
1119
  if (isSelectingEnd && startDate && !endDate) {
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  CustomRangePicker,
3
3
  RangePicker_default
4
- } from "../../chunk-4JX54OKI.mjs";
4
+ } from "../../chunk-PSBEYGD4.mjs";
5
5
  import "../../chunk-GU5F7Z7I.mjs";
6
6
  import "../../chunk-MLCMZRUC.mjs";
7
7
  import "../../chunk-ZTRM4HZJ.mjs";
@@ -1,3 +1,3 @@
1
1
  import 'react';
2
- export { T as Table, T as default } from '../../Table-DNvoh2P8.mjs';
2
+ export { T as Table, T as default } from '../../Table-BxaCiQmh.mjs';
3
3
  import 'antd';
@@ -1,3 +1,3 @@
1
1
  import 'react';
2
- export { T as Table, T as default } from '../../Table-DNvoh2P8.js';
2
+ export { T as Table, T as default } from '../../Table-BxaCiQmh.js';
3
3
  import 'antd';
@@ -244,7 +244,6 @@ function Table(props) {
244
244
  "bodyCellClassName",
245
245
  "rowClassName"
246
246
  ]);
247
- const isChildVariant = isAccordion || isToolbar;
248
247
  const resolvedPagination = buildPagination(pagination, {
249
248
  total,
250
249
  current,
@@ -278,7 +277,7 @@ function Table(props) {
278
277
  const isSelected = current2.some((k) => k === key);
279
278
  const newKeys = isSelected ? current2.filter((k) => k !== key) : [...current2, key];
280
279
  const newRows = (dataSource != null ? dataSource : []).filter(
281
- (r) => newKeys.some((k) => k === getKey(r))
280
+ (r, idx) => newKeys.some((k) => k === getKey(r, idx))
282
281
  );
283
282
  onChange(newKeys, newRows, { type: "single" });
284
283
  }
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  Table,
3
3
  Table_default
4
- } from "../../chunk-X3NDICAU.mjs";
4
+ } from "../../chunk-ANJI6SPV.mjs";
5
5
  import "../../chunk-FWCSY2DS.mjs";
6
6
  export {
7
7
  Table,