@payglocal_ui/flux-ui 0.2.5 → 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 +3155 -594
- 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 +3104 -548
- 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 +887 -144
- package/src/date-picker.tsx +15 -3
- package/src/dropdown-menu.tsx +9 -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 };
|
package/src/dropdown-menu.tsx
CHANGED
|
@@ -19,7 +19,9 @@ const DropdownMenuSubTrigger = React.forwardRef<
|
|
|
19
19
|
<DropdownMenuPrimitive.SubTrigger
|
|
20
20
|
ref={ref}
|
|
21
21
|
className={cn(
|
|
22
|
-
|
|
22
|
+
// Matches DropdownMenuItem: a submenu row sits in the same list as the
|
|
23
|
+
// plain rows, so it cannot be a different size from them.
|
|
24
|
+
"flex cursor-default select-none items-center gap-2 rounded-lg px-2.5 py-1.5 text-[13px] outline-none",
|
|
23
25
|
"focus:bg-muted data-[state=open]:bg-muted",
|
|
24
26
|
inset && "pl-8",
|
|
25
27
|
className
|
|
@@ -94,7 +96,9 @@ const DropdownMenuCheckboxItem = React.forwardRef<
|
|
|
94
96
|
<DropdownMenuPrimitive.CheckboxItem
|
|
95
97
|
ref={ref}
|
|
96
98
|
className={cn(
|
|
97
|
-
|
|
99
|
+
// Matches DropdownMenuItem. `pl-8` stays: that gutter is the check /
|
|
100
|
+
// dot indicator's, not padding.
|
|
101
|
+
"relative flex cursor-default select-none items-center rounded-lg py-1.5 pl-8 pr-2.5 text-[13px] outline-none transition-colors",
|
|
98
102
|
"focus:bg-muted focus:text-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
99
103
|
className
|
|
100
104
|
)}
|
|
@@ -118,7 +122,9 @@ const DropdownMenuRadioItem = React.forwardRef<
|
|
|
118
122
|
<DropdownMenuPrimitive.RadioItem
|
|
119
123
|
ref={ref}
|
|
120
124
|
className={cn(
|
|
121
|
-
|
|
125
|
+
// Matches DropdownMenuItem. `pl-8` stays: that gutter is the check /
|
|
126
|
+
// dot indicator's, not padding.
|
|
127
|
+
"relative flex cursor-default select-none items-center rounded-lg py-1.5 pl-8 pr-2.5 text-[13px] outline-none transition-colors",
|
|
122
128
|
"focus:bg-muted focus:text-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
123
129
|
className
|
|
124
130
|
)}
|