@payglocal_ui/flux-ui 0.2.6 → 0.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/dist/index.cjs +3145 -592
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1206 -26
- package/dist/index.d.ts +1206 -26
- package/dist/index.js +3094 -546
- package/dist/index.js.map +1 -1
- package/package.json +14 -4
- package/src/__tests__/data-card-list.test.tsx +74 -0
- package/src/__tests__/data-table-row-click.test.tsx +113 -0
- package/src/__tests__/filter-chips.test.tsx +237 -0
- package/src/calendar-date-chip.tsx +262 -0
- package/src/column-manager.tsx +590 -0
- package/src/copyable-cell.tsx +253 -0
- package/src/data-card-list.tsx +188 -0
- package/src/data-table-card.tsx +205 -0
- package/src/data-table.tsx +876 -144
- package/src/date-picker.tsx +15 -3
- package/src/filter-chips.tsx +1874 -0
- package/src/format-datetime.ts +170 -0
- package/src/index.ts +95 -2
- package/src/popover.tsx +24 -15
- package/src/rotating-search-input.tsx +164 -0
- package/src/tab-presets.tsx +189 -0
package/src/date-picker.tsx
CHANGED
|
@@ -38,12 +38,21 @@ interface DatePickerProps {
|
|
|
38
38
|
onChange: (v: string) => void;
|
|
39
39
|
placeholder?: string;
|
|
40
40
|
className?: string;
|
|
41
|
+
/** Earliest selectable date, `YYYY-MM-DD`. Days before it are struck out. */
|
|
41
42
|
min?: string;
|
|
43
|
+
/**
|
|
44
|
+
* Latest selectable date, `YYYY-MM-DD`.
|
|
45
|
+
*
|
|
46
|
+
* Its absence is why a feature ended up hand-rolling a whole date chip to
|
|
47
|
+
* enforce an upper bound on Apply instead — an error after the fact, where
|
|
48
|
+
* the calendar could have said so before the click.
|
|
49
|
+
*/
|
|
50
|
+
max?: string;
|
|
42
51
|
label?: string;
|
|
43
52
|
}
|
|
44
53
|
|
|
45
54
|
/* ─── DatePicker ─────────────────────────────────────────────────────────── */
|
|
46
|
-
export function DatePicker({ value, onChange, placeholder = "Select date", className, min, label }: DatePickerProps) {
|
|
55
|
+
export function DatePicker({ value, onChange, placeholder = "Select date", className, min, max, label }: DatePickerProps) {
|
|
47
56
|
const today = new Date();
|
|
48
57
|
const parsed = parseYMD(value);
|
|
49
58
|
|
|
@@ -123,10 +132,13 @@ export function DatePicker({ value, onChange, placeholder = "Select date", class
|
|
|
123
132
|
const firstDay = firstDayOf(viewYear, viewMonth);
|
|
124
133
|
const prevTotal = daysInMonth(viewYear, viewMonth === 0 ? 11 : viewMonth - 1);
|
|
125
134
|
const minParsed = parseYMD(min ?? "");
|
|
135
|
+
const maxParsed = parseYMD(max ?? "");
|
|
126
136
|
|
|
127
137
|
function isDisabled(y: number, m: number, d: number) {
|
|
128
|
-
|
|
129
|
-
|
|
138
|
+
const day = new Date(y, m, d);
|
|
139
|
+
if (minParsed && day < new Date(minParsed.y, minParsed.m, minParsed.d)) return true;
|
|
140
|
+
if (maxParsed && day > new Date(maxParsed.y, maxParsed.m, maxParsed.d)) return true;
|
|
141
|
+
return false;
|
|
130
142
|
}
|
|
131
143
|
|
|
132
144
|
type Cell = { d: number; m: number; y: number; current: boolean };
|