@ttt-productions/ui-core 0.11.32 → 0.11.34
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/browser/index.d.ts +2 -2
- package/dist/browser/index.js +1 -1
- package/dist/browser/index.js.map +1 -1
- package/dist/browser/reload-recovery-watch.d.ts +2 -2
- package/dist/browser/reload-recovery-watch.d.ts.map +1 -1
- package/dist/browser/reload-recovery-watch.js +5 -5
- package/dist/browser/reload-recovery-watch.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/lib/format-numbers.js +2 -2
- package/dist/lib/format-numbers.js.map +1 -1
- package/dist/lib/reload-recovery.js +13 -13
- package/dist/lib/reload-recovery.js.map +1 -1
- package/dist/lib/utils.js.map +1 -1
- package/dist/react/components/accordion.d.ts +2 -2
- package/dist/react/components/accordion.d.ts.map +1 -1
- package/dist/react/components/accordion.js +8 -8
- package/dist/react/components/accordion.js.map +1 -1
- package/dist/react/components/action-row.d.ts +32 -0
- package/dist/react/components/action-row.d.ts.map +1 -0
- package/dist/react/components/action-row.js +16 -0
- package/dist/react/components/action-row.js.map +1 -0
- package/dist/react/components/alert-dialog.d.ts +2 -2
- package/dist/react/components/alert-dialog.d.ts.map +1 -1
- package/dist/react/components/alert-dialog.js +15 -15
- package/dist/react/components/alert-dialog.js.map +1 -1
- package/dist/react/components/alert.d.ts +2 -2
- package/dist/react/components/alert.d.ts.map +1 -1
- package/dist/react/components/alert.js +12 -12
- package/dist/react/components/alert.js.map +1 -1
- package/dist/react/components/avatar.d.ts +2 -2
- package/dist/react/components/avatar.d.ts.map +1 -1
- package/dist/react/components/avatar.js +7 -7
- package/dist/react/components/avatar.js.map +1 -1
- package/dist/react/components/badge.d.ts +2 -2
- package/dist/react/components/badge.d.ts.map +1 -1
- package/dist/react/components/badge.js +9 -9
- package/dist/react/components/badge.js.map +1 -1
- package/dist/react/components/button.d.ts +2 -2
- package/dist/react/components/button.d.ts.map +1 -1
- package/dist/react/components/button.js +28 -28
- package/dist/react/components/button.js.map +1 -1
- package/dist/react/components/card.d.ts +1 -1
- package/dist/react/components/card.d.ts.map +1 -1
- package/dist/react/components/card.js +15 -15
- package/dist/react/components/card.js.map +1 -1
- package/dist/react/components/checkbox.d.ts +2 -2
- package/dist/react/components/checkbox.d.ts.map +1 -1
- package/dist/react/components/checkbox.js +6 -6
- package/dist/react/components/checkbox.js.map +1 -1
- package/dist/react/components/collapsible.d.ts +1 -1
- package/dist/react/components/collapsible.d.ts.map +1 -1
- package/dist/react/components/collapsible.js +2 -2
- package/dist/react/components/collapsible.js.map +1 -1
- package/dist/react/components/consequence-dialog.d.ts.map +1 -1
- package/dist/react/components/consequence-dialog.js +4 -2
- package/dist/react/components/consequence-dialog.js.map +1 -1
- package/dist/react/components/date-picker.d.ts +1 -1
- package/dist/react/components/date-picker.d.ts.map +1 -1
- package/dist/react/components/date-picker.js +102 -66
- package/dist/react/components/date-picker.js.map +1 -1
- package/dist/react/components/date-time-picker.d.ts +1 -1
- package/dist/react/components/date-time-picker.d.ts.map +1 -1
- package/dist/react/components/date-time-picker.js +20 -18
- package/dist/react/components/date-time-picker.js.map +1 -1
- package/dist/react/components/dialog.d.ts +2 -2
- package/dist/react/components/dialog.d.ts.map +1 -1
- package/dist/react/components/dialog.js +14 -14
- package/dist/react/components/dialog.js.map +1 -1
- package/dist/react/components/dropdown-menu.d.ts +2 -2
- package/dist/react/components/dropdown-menu.d.ts.map +1 -1
- package/dist/react/components/dropdown-menu.js +23 -18
- package/dist/react/components/dropdown-menu.js.map +1 -1
- package/dist/react/components/end-of-list-indicator.d.ts +1 -1
- package/dist/react/components/end-of-list-indicator.js +3 -3
- package/dist/react/components/end-of-list-indicator.js.map +1 -1
- package/dist/react/components/form.d.ts +3 -3
- package/dist/react/components/form.d.ts.map +1 -1
- package/dist/react/components/form.js +17 -17
- package/dist/react/components/form.js.map +1 -1
- package/dist/react/components/format-control.d.ts +12 -5
- package/dist/react/components/format-control.d.ts.map +1 -1
- package/dist/react/components/format-control.js +23 -7
- package/dist/react/components/format-control.js.map +1 -1
- package/dist/react/components/input.d.ts +10 -10
- package/dist/react/components/input.d.ts.map +1 -1
- package/dist/react/components/input.js +11 -7
- package/dist/react/components/input.js.map +1 -1
- package/dist/react/components/label.d.ts +3 -3
- package/dist/react/components/label.d.ts.map +1 -1
- package/dist/react/components/label.js +6 -6
- package/dist/react/components/label.js.map +1 -1
- package/dist/react/components/layout/screen-adaptive-view.d.ts +2 -2
- package/dist/react/components/layout/screen-adaptive-view.d.ts.map +1 -1
- package/dist/react/components/layout/screen-adaptive-view.js +39 -35
- package/dist/react/components/layout/screen-adaptive-view.js.map +1 -1
- package/dist/react/components/list-pagination.d.ts +1 -1
- package/dist/react/components/list-pagination.js +10 -10
- package/dist/react/components/list-pagination.js.map +1 -1
- package/dist/react/components/menubar.d.ts +2 -2
- package/dist/react/components/menubar.d.ts.map +1 -1
- package/dist/react/components/menubar.js +17 -17
- package/dist/react/components/menubar.js.map +1 -1
- package/dist/react/components/opener-focus.d.ts +1 -1
- package/dist/react/components/opener-focus.d.ts.map +1 -1
- package/dist/react/components/opener-focus.js +3 -3
- package/dist/react/components/opener-focus.js.map +1 -1
- package/dist/react/components/pending-guard.d.ts +1 -1
- package/dist/react/components/pending-guard.d.ts.map +1 -1
- package/dist/react/components/pending-guard.js +1 -1
- package/dist/react/components/pending-guard.js.map +1 -1
- package/dist/react/components/popover.d.ts +2 -2
- package/dist/react/components/popover.d.ts.map +1 -1
- package/dist/react/components/popover.js +5 -5
- package/dist/react/components/popover.js.map +1 -1
- package/dist/react/components/progress.d.ts +2 -2
- package/dist/react/components/progress.d.ts.map +1 -1
- package/dist/react/components/progress.js +5 -5
- package/dist/react/components/progress.js.map +1 -1
- package/dist/react/components/radio-group.d.ts +2 -2
- package/dist/react/components/radio-group.d.ts.map +1 -1
- package/dist/react/components/radio-group.js +7 -7
- package/dist/react/components/radio-group.js.map +1 -1
- package/dist/react/components/relative-time.d.ts +1 -1
- package/dist/react/components/relative-time.d.ts.map +1 -1
- package/dist/react/components/relative-time.js +8 -7
- package/dist/react/components/relative-time.js.map +1 -1
- package/dist/react/components/reload-recovery-notice.d.ts +3 -3
- package/dist/react/components/reload-recovery-notice.js +7 -7
- package/dist/react/components/reload-recovery-notice.js.map +1 -1
- package/dist/react/components/scroll-area.d.ts +2 -2
- package/dist/react/components/scroll-area.d.ts.map +1 -1
- package/dist/react/components/scroll-area.js +6 -8
- package/dist/react/components/scroll-area.js.map +1 -1
- package/dist/react/components/scroll-to-top-button.d.ts +5 -5
- package/dist/react/components/scroll-to-top-button.js +9 -9
- package/dist/react/components/scroll-to-top-button.js.map +1 -1
- package/dist/react/components/search-dropdown.d.ts.map +1 -1
- package/dist/react/components/search-dropdown.js +8 -3
- package/dist/react/components/search-dropdown.js.map +1 -1
- package/dist/react/components/select.d.ts +2 -2
- package/dist/react/components/select.d.ts.map +1 -1
- package/dist/react/components/select.js +19 -19
- package/dist/react/components/select.js.map +1 -1
- package/dist/react/components/separator.d.ts +2 -2
- package/dist/react/components/separator.d.ts.map +1 -1
- package/dist/react/components/separator.js +5 -5
- package/dist/react/components/separator.js.map +1 -1
- package/dist/react/components/sheet.d.ts +3 -3
- package/dist/react/components/sheet.d.ts.map +1 -1
- package/dist/react/components/sheet.js +21 -21
- package/dist/react/components/sheet.js.map +1 -1
- package/dist/react/components/show-more-toggle.d.ts +2 -2
- package/dist/react/components/show-more-toggle.d.ts.map +1 -1
- package/dist/react/components/show-more-toggle.js +6 -6
- package/dist/react/components/show-more-toggle.js.map +1 -1
- package/dist/react/components/skeleton.d.ts +1 -1
- package/dist/react/components/skeleton.d.ts.map +1 -1
- package/dist/react/components/skeleton.js +3 -3
- package/dist/react/components/skeleton.js.map +1 -1
- package/dist/react/components/slider.d.ts +2 -2
- package/dist/react/components/slider.d.ts.map +1 -1
- package/dist/react/components/slider.js +5 -5
- package/dist/react/components/slider.js.map +1 -1
- package/dist/react/components/spinner.d.ts +1 -1
- package/dist/react/components/spinner.d.ts.map +1 -1
- package/dist/react/components/spinner.js +10 -10
- package/dist/react/components/spinner.js.map +1 -1
- package/dist/react/components/switch.d.ts +2 -2
- package/dist/react/components/switch.d.ts.map +1 -1
- package/dist/react/components/switch.js +13 -8
- package/dist/react/components/switch.js.map +1 -1
- package/dist/react/components/table.d.ts +2 -2
- package/dist/react/components/table.d.ts.map +1 -1
- package/dist/react/components/table.js +24 -24
- package/dist/react/components/table.js.map +1 -1
- package/dist/react/components/tabs.d.ts +2 -2
- package/dist/react/components/tabs.d.ts.map +1 -1
- package/dist/react/components/tabs.js +7 -7
- package/dist/react/components/tabs.js.map +1 -1
- package/dist/react/components/textarea.d.ts +5 -5
- package/dist/react/components/textarea.d.ts.map +1 -1
- package/dist/react/components/textarea.js +11 -7
- package/dist/react/components/textarea.js.map +1 -1
- package/dist/react/components/toast.d.ts +4 -4
- package/dist/react/components/toast.d.ts.map +1 -1
- package/dist/react/components/toast.js +25 -25
- package/dist/react/components/toast.js.map +1 -1
- package/dist/react/components/toaster.d.ts.map +1 -1
- package/dist/react/components/toaster.js +5 -5
- package/dist/react/components/toaster.js.map +1 -1
- package/dist/react/components/tooltip.d.ts +2 -2
- package/dist/react/components/tooltip.d.ts.map +1 -1
- package/dist/react/components/tooltip.js +5 -5
- package/dist/react/components/tooltip.js.map +1 -1
- package/dist/react/hooks/use-async-action.js +2 -2
- package/dist/react/hooks/use-async-action.js.map +1 -1
- package/dist/react/hooks/use-cursor-page.d.ts +1 -1
- package/dist/react/hooks/use-cursor-page.js +2 -2
- package/dist/react/hooks/use-cursor-page.js.map +1 -1
- package/dist/react/hooks/use-media-query.js +5 -5
- package/dist/react/hooks/use-media-query.js.map +1 -1
- package/dist/react/hooks/use-paged-list.js +2 -2
- package/dist/react/hooks/use-paged-list.js.map +1 -1
- package/dist/react/hooks/use-return-scroll.d.ts +1 -1
- package/dist/react/hooks/use-return-scroll.d.ts.map +1 -1
- package/dist/react/hooks/use-return-scroll.js +11 -11
- package/dist/react/hooks/use-return-scroll.js.map +1 -1
- package/dist/react/hooks/use-toast.d.ts +3 -3
- package/dist/react/hooks/use-toast.d.ts.map +1 -1
- package/dist/react/hooks/use-toast.js +17 -17
- package/dist/react/hooks/use-toast.js.map +1 -1
- package/dist/react/index.d.ts +74 -72
- package/dist/react/index.d.ts.map +1 -1
- package/dist/react/index.js +51 -50
- package/dist/react/index.js.map +1 -1
- package/package.json +8 -6
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
|
|
1
|
+
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import * as React from
|
|
4
|
-
import { DatePicker } from
|
|
5
|
-
import { cn } from
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { DatePicker } from './date-picker.js';
|
|
5
|
+
import { cn } from '../../lib/utils.js';
|
|
6
6
|
const MINUTES_PER_DAY = 24 * 60;
|
|
7
7
|
const HOURS_12 = [12, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11];
|
|
8
|
-
const PERIODS = [
|
|
9
|
-
const pad2 = (n) => String(n).padStart(2,
|
|
8
|
+
const PERIODS = ['AM', 'PM'];
|
|
9
|
+
const pad2 = (n) => String(n).padStart(2, '0');
|
|
10
10
|
const at = (day, minuteOfDay) => new Date(day.getFullYear(), day.getMonth(), day.getDate(), Math.floor(minuteOfDay / 60), minuteOfDay % 60, 0, 0);
|
|
11
11
|
const minuteOfDayOf = (date) => date.getHours() * 60 + date.getMinutes();
|
|
12
|
-
const to24 = (hour12, period) => (hour12 % 12) + (period ===
|
|
13
|
-
const periodOf = (hours) => (hours >= 12 ?
|
|
12
|
+
const to24 = (hour12, period) => (hour12 % 12) + (period === 'PM' ? 12 : 0);
|
|
13
|
+
const periodOf = (hours) => (hours >= 12 ? 'PM' : 'AM');
|
|
14
14
|
const hour12Of = (hours) => (hours % 12 === 0 ? 12 : hours % 12);
|
|
15
15
|
/**
|
|
16
16
|
* Generic date-and-time picker: `DatePicker` for the day, then hour / minute / AM-PM
|
|
@@ -62,7 +62,9 @@ function DateTimePicker({ value, onChange, min, max, minuteStep = 1, defaultTime
|
|
|
62
62
|
// minute; only the bounds' days need the minute-by-minute check.
|
|
63
63
|
const firstOfferedMinute = minuteOptions[0];
|
|
64
64
|
const lastOfferedMinute = 23 * 60 + minuteOptions[minuteOptions.length - 1];
|
|
65
|
-
const isSameDay = (a, b) => a.getFullYear() === b.getFullYear() &&
|
|
65
|
+
const isSameDay = (a, b) => a.getFullYear() === b.getFullYear() &&
|
|
66
|
+
a.getMonth() === b.getMonth() &&
|
|
67
|
+
a.getDate() === b.getDate();
|
|
66
68
|
const isDayDisabled = (day) => {
|
|
67
69
|
if ((min && isSameDay(day, min)) || (max && isSameDay(day, max))) {
|
|
68
70
|
return allowedMinutesOn(day).length === 0;
|
|
@@ -87,7 +89,7 @@ function DateTimePicker({ value, onChange, min, max, minuteStep = 1, defaultTime
|
|
|
87
89
|
const hourEnabled = (hours) => minuteOptions.some((m) => allowedSet.has(hours * 60 + m));
|
|
88
90
|
const minuteEnabled = (minutes) => currentHours !== null && allowedSet.has(currentHours * 60 + minutes);
|
|
89
91
|
const periodEnabled = (period) => {
|
|
90
|
-
const base = period ===
|
|
92
|
+
const base = period === 'PM' ? 12 : 0;
|
|
91
93
|
for (let h = base; h < base + 12; h++)
|
|
92
94
|
if (hourEnabled(h))
|
|
93
95
|
return true;
|
|
@@ -115,7 +117,7 @@ function DateTimePicker({ value, onChange, min, max, minuteStep = 1, defaultTime
|
|
|
115
117
|
commit(value, hours * 60 + currentMinutes);
|
|
116
118
|
};
|
|
117
119
|
const timeDisabled = !value;
|
|
118
|
-
return (_jsxs("div", { className: cn(
|
|
120
|
+
return (_jsxs("div", { className: cn('flex flex-col gap-3 sm:flex-row sm:items-start', className), children: [_jsx(DatePicker, { selected: value, onSelect: handleDayPick, disabled: isDayDisabled }), _jsxs("div", { className: "flex gap-2 p-4 bg-card rounded-lg", role: "group", "aria-label": "Time", "aria-disabled": timeDisabled || undefined, children: [_jsx(TimeColumn, { label: "Hour", options: HOURS_12.map((h) => ({
|
|
119
121
|
key: h,
|
|
120
122
|
text: String(h),
|
|
121
123
|
ariaLabel: `${h} o'clock`,
|
|
@@ -138,7 +140,7 @@ function DateTimePicker({ value, onChange, min, max, minuteStep = 1, defaultTime
|
|
|
138
140
|
onPick: () => pickPeriod(p),
|
|
139
141
|
})) })] })] }));
|
|
140
142
|
}
|
|
141
|
-
DateTimePicker.displayName =
|
|
143
|
+
DateTimePicker.displayName = 'DateTimePicker';
|
|
142
144
|
function TimeColumn({ label, options }) {
|
|
143
145
|
const listRef = React.useRef(null);
|
|
144
146
|
const selectedIndex = options.findIndex((o) => o.selected && !o.disabled);
|
|
@@ -154,7 +156,7 @@ function TimeColumn({ label, options }) {
|
|
|
154
156
|
if (selectedIndex < 0)
|
|
155
157
|
return;
|
|
156
158
|
const el = listRef.current?.querySelector(`[data-index="${selectedIndex}"]`);
|
|
157
|
-
el?.scrollIntoView?.({ block:
|
|
159
|
+
el?.scrollIntoView?.({ block: 'nearest' });
|
|
158
160
|
}, [selectedIndex]);
|
|
159
161
|
const focusAt = (index) => {
|
|
160
162
|
setFocusIndex(index);
|
|
@@ -166,13 +168,13 @@ function TimeColumn({ label, options }) {
|
|
|
166
168
|
return;
|
|
167
169
|
const pos = enabled.indexOf(rovingIndex);
|
|
168
170
|
let next;
|
|
169
|
-
if (e.key ===
|
|
171
|
+
if (e.key === 'ArrowDown')
|
|
170
172
|
next = enabled[Math.min(enabled.length - 1, pos + 1)];
|
|
171
|
-
else if (e.key ===
|
|
173
|
+
else if (e.key === 'ArrowUp')
|
|
172
174
|
next = enabled[Math.max(0, pos - 1)];
|
|
173
|
-
else if (e.key ===
|
|
175
|
+
else if (e.key === 'Home')
|
|
174
176
|
next = enabled[0];
|
|
175
|
-
else if (e.key ===
|
|
177
|
+
else if (e.key === 'End')
|
|
176
178
|
next = enabled[enabled.length - 1];
|
|
177
179
|
if (next === undefined)
|
|
178
180
|
return;
|
|
@@ -182,7 +184,7 @@ function TimeColumn({ label, options }) {
|
|
|
182
184
|
return (_jsxs("div", { className: "flex flex-col items-center gap-1", children: [_jsx("div", { className: "text-xs font-semibold text-muted-foreground", "aria-hidden": "true", children: label }), _jsx("div", { ref: listRef, role: "group", "aria-label": label, onKeyDown: handleKeyDown, className: "flex h-64 w-14 flex-col gap-1 overflow-y-auto", children: options.map((o, i) => (_jsx("button", { type: "button", "data-index": i, tabIndex: i === rovingIndex ? 0 : -1, disabled: o.disabled, "aria-pressed": o.selected, "aria-label": o.ariaLabel, onClick: () => {
|
|
183
185
|
setFocusIndex(i);
|
|
184
186
|
o.onPick();
|
|
185
|
-
}, className: cn(
|
|
187
|
+
}, className: cn('h-9 shrink-0 rounded-lg text-sm font-semibold flex items-center justify-center', 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background', !o.disabled && !o.selected && 'text-foreground hover:bg-primary/10', o.selected && 'bg-primary text-primary-foreground font-bold', o.disabled && 'opacity-30 cursor-not-allowed'), children: o.text }, o.key))) })] }));
|
|
186
188
|
}
|
|
187
189
|
export { DateTimePicker };
|
|
188
190
|
//# sourceMappingURL=date-time-picker.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"date-time-picker.js","sourceRoot":"","sources":["../../../src/react/components/date-time-picker.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAC7C,OAAO,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAA;AAyBvC,MAAM,eAAe,GAAG,EAAE,GAAG,EAAE,CAAA;AAC/B,MAAM,QAAQ,GAAG,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAA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AAA;AACH,CAAC;AAED,OAAO,EAAE,cAAc,EAAE,CAAA","sourcesContent":["\"use client\"\n\nimport * as React from \"react\"\nimport { DatePicker } from \"./date-picker.js\"\nimport { cn } from \"../../lib/utils.js\"\n\nexport interface DateTimePickerTime {\n /** 0–23 */\n hours: number\n /** 0–59 */\n minutes: number\n}\n\nexport interface DateTimePickerProps {\n /** The chosen instant (local time). */\n value?: Date\n /** Called with the new instant — always inside `min`/`max`, seconds and milliseconds zero. */\n onChange?: (value: Date) => void\n /** The earliest selectable instant. Earlier days and times are unavailable. */\n min?: Date\n /** The latest selectable instant. Later days and times are unavailable. */\n max?: Date\n /** Minutes offered are multiples of this (default 1). */\n minuteStep?: number\n /** Time of day a picked day takes when there is no `value` yet (default 23:59 — end of day). */\n defaultTime?: DateTimePickerTime\n className?: string\n}\n\nconst MINUTES_PER_DAY = 24 * 60\nconst HOURS_12 = [12, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]\nconst PERIODS = [\"AM\", \"PM\"] as const\ntype Period = (typeof PERIODS)[number]\n\nconst pad2 = (n: number) => String(n).padStart(2, \"0\")\nconst at = (day: Date, minuteOfDay: number) =>\n new Date(day.getFullYear(), day.getMonth(), day.getDate(), Math.floor(minuteOfDay / 60), minuteOfDay % 60, 0, 0)\nconst minuteOfDayOf = (date: Date) => date.getHours() * 60 + date.getMinutes()\nconst to24 = (hour12: number, period: Period) => (hour12 % 12) + (period === \"PM\" ? 12 : 0)\nconst periodOf = (hours: number): Period => (hours >= 12 ? \"PM\" : \"AM\")\nconst hour12Of = (hours: number) => (hours % 12 === 0 ? 12 : hours % 12)\n\n/**\n * Generic date-and-time picker: `DatePicker` for the day, then hour / minute / AM-PM\n * columns of buttons for the time of day — never a native time input, so it looks and\n * behaves the same everywhere and honours `min` / `max` to the minute.\n *\n * Every offered day, hour, minute, and period is one the value may take: a day with\n * no allowed instant is disabled in the calendar, and an hour, minute, or period\n * that would land outside `min` / `max` on the chosen day is disabled. Picking a day\n * keeps the chosen time of day (or `defaultTime` when there is no value) and moves it\n * to the nearest allowed time on that day; picking an hour or period whose current\n * minute is unavailable takes the nearest allowed minute.\n *\n * Keyboard: each time column is one tab stop with roving focus (ArrowUp / ArrowDown,\n * Home / End); Enter or Space picks.\n */\nfunction DateTimePicker({\n value,\n onChange,\n min,\n max,\n minuteStep = 1,\n defaultTime = { hours: 23, minutes: 59 },\n className,\n}: DateTimePickerProps) {\n const step = Math.max(1, Math.min(60, Math.floor(minuteStep)))\n const minuteOptions = React.useMemo(\n () => Array.from({ length: Math.ceil(60 / step) }, (_, i) => i * step).filter((m) => m < 60),\n [step],\n )\n\n const isAllowed = React.useCallback(\n (instant: Date) => (!min || instant >= min) && (!max || instant <= max),\n [min, max],\n )\n const offeredMinutes = React.useMemo(() => new Set(minuteOptions), [minuteOptions])\n const isOffered = React.useCallback(\n (minuteOfDay: number) => offeredMinutes.has(minuteOfDay % 60),\n [offeredMinutes],\n )\n\n /** Allowed minutes-of-day on `day`, ascending. */\n const allowedMinutesOn = React.useCallback(\n (day: Date) => {\n const out: number[] = []\n for (let m = 0; m < MINUTES_PER_DAY; m++) {\n if (isOffered(m) && isAllowed(at(day, m))) out.push(m)\n }\n return out\n },\n [isAllowed, isOffered],\n )\n\n const nearestAllowed = (day: Date, wanted: number): number | null => {\n const allowed = allowedMinutesOn(day)\n if (allowed.length === 0) return null\n let best = allowed[0]\n for (const m of allowed) if (Math.abs(m - wanted) < Math.abs(best - wanted)) best = m\n return best\n }\n\n const commit = (day: Date, wanted: number) => {\n const m = nearestAllowed(day, wanted)\n if (m === null) return\n onChange?.(at(day, m))\n }\n\n // A day strictly between the bounds' own days is decided by its first and last offered\n // minute; only the bounds' days need the minute-by-minute check.\n const firstOfferedMinute = minuteOptions[0]\n const lastOfferedMinute = 23 * 60 + minuteOptions[minuteOptions.length - 1]\n const isSameDay = (a: Date, b: Date) =>\n a.getFullYear() === b.getFullYear() && a.getMonth() === b.getMonth() && a.getDate() === b.getDate()\n const isDayDisabled = (day: Date) => {\n if ((min && isSameDay(day, min)) || (max && isSameDay(day, max))) {\n return allowedMinutesOn(day).length === 0\n }\n if (min && at(day, lastOfferedMinute) < min) return true\n if (max && at(day, firstOfferedMinute) > max) return true\n return false\n }\n\n const handleDayPick = (day: Date | undefined) => {\n if (!day) return\n const wanted = value ? minuteOfDayOf(value) : defaultTime.hours * 60 + defaultTime.minutes\n commit(day, wanted)\n }\n\n const current = value ? minuteOfDayOf(value) : null\n const currentHours = current === null ? null : Math.floor(current / 60)\n const currentMinutes = current === null ? null : current % 60\n const currentPeriod = currentHours === null ? null : periodOf(currentHours)\n\n const allowedSet = React.useMemo(\n () => new Set(value ? allowedMinutesOn(value) : []),\n [value, allowedMinutesOn],\n )\n const hourEnabled = (hours: number) => minuteOptions.some((m) => allowedSet.has(hours * 60 + m))\n const minuteEnabled = (minutes: number) =>\n currentHours !== null && allowedSet.has(currentHours * 60 + minutes)\n const periodEnabled = (period: Period) => {\n const base = period === \"PM\" ? 12 : 0\n for (let h = base; h < base + 12; h++) if (hourEnabled(h)) return true\n return false\n }\n\n const pickHour = (hour12: number) => {\n if (!value || currentPeriod === null || currentMinutes === null) return\n const hours = to24(hour12, currentPeriod)\n const firstInHour = minuteOptions.find((m) => allowedSet.has(hours * 60 + m))\n if (firstInHour === undefined) return\n const minutes = allowedSet.has(hours * 60 + currentMinutes) ? currentMinutes : firstInHour\n commit(value, hours * 60 + minutes)\n }\n const pickMinute = (minutes: number) => {\n if (!value || currentHours === null) return\n commit(value, currentHours * 60 + minutes)\n }\n const pickPeriod = (period: Period) => {\n if (!value || currentHours === null || currentMinutes === null) return\n const hours = to24(hour12Of(currentHours), period)\n commit(value, hours * 60 + currentMinutes)\n }\n\n const timeDisabled = !value\n\n return (\n <div className={cn(\"flex flex-col gap-3 sm:flex-row sm:items-start\", className)}>\n <DatePicker selected={value} onSelect={handleDayPick} disabled={isDayDisabled} />\n <div\n className=\"flex gap-2 p-4 bg-card rounded-lg\"\n role=\"group\"\n aria-label=\"Time\"\n aria-disabled={timeDisabled || undefined}\n >\n <TimeColumn\n label=\"Hour\"\n options={HOURS_12.map((h) => ({\n key: h,\n text: String(h),\n ariaLabel: `${h} o'clock`,\n selected: currentHours !== null && hour12Of(currentHours) === h,\n disabled: timeDisabled || currentPeriod === null || !hourEnabled(to24(h, currentPeriod)),\n onPick: () => pickHour(h),\n }))}\n />\n <TimeColumn\n label=\"Minute\"\n options={minuteOptions.map((m) => ({\n key: m,\n text: pad2(m),\n ariaLabel: `${pad2(m)} minutes`,\n selected: currentMinutes === m,\n disabled: timeDisabled || !minuteEnabled(m),\n onPick: () => pickMinute(m),\n }))}\n />\n <TimeColumn\n label=\"AM or PM\"\n options={PERIODS.map((p) => ({\n key: p,\n text: p,\n ariaLabel: p,\n selected: currentPeriod === p,\n disabled: timeDisabled || !periodEnabled(p),\n onPick: () => pickPeriod(p),\n }))}\n />\n </div>\n </div>\n )\n}\n\nDateTimePicker.displayName = \"DateTimePicker\"\n\ninterface TimeOption {\n key: string | number\n text: string\n ariaLabel: string\n selected: boolean\n disabled: boolean\n onPick: () => void\n}\n\nfunction TimeColumn({ label, options }: { label: string; options: TimeOption[] }) {\n const listRef = React.useRef<HTMLDivElement | null>(null)\n const selectedIndex = options.findIndex((o) => o.selected && !o.disabled)\n const firstEnabled = options.findIndex((o) => !o.disabled)\n const [focusIndex, setFocusIndex] = React.useState<number | null>(null)\n const rovingIndex =\n focusIndex !== null && options[focusIndex] && !options[focusIndex].disabled\n ? focusIndex\n : selectedIndex >= 0\n ? selectedIndex\n : firstEnabled\n\n // Keep the chosen option in view inside the fixed-height column.\n React.useLayoutEffect(() => {\n if (selectedIndex < 0) return\n const el = listRef.current?.querySelector<HTMLButtonElement>(`[data-index=\"${selectedIndex}\"]`)\n el?.scrollIntoView?.({ block: \"nearest\" })\n }, [selectedIndex])\n\n const focusAt = (index: number) => {\n setFocusIndex(index)\n listRef.current?.querySelector<HTMLButtonElement>(`[data-index=\"${index}\"]`)?.focus()\n }\n\n const handleKeyDown = (e: React.KeyboardEvent<HTMLDivElement>) => {\n const enabled = options.map((o, i) => (o.disabled ? -1 : i)).filter((i) => i >= 0)\n if (enabled.length === 0 || rovingIndex < 0) return\n const pos = enabled.indexOf(rovingIndex)\n let next: number | undefined\n if (e.key === \"ArrowDown\") next = enabled[Math.min(enabled.length - 1, pos + 1)]\n else if (e.key === \"ArrowUp\") next = enabled[Math.max(0, pos - 1)]\n else if (e.key === \"Home\") next = enabled[0]\n else if (e.key === \"End\") next = enabled[enabled.length - 1]\n if (next === undefined) return\n e.preventDefault()\n focusAt(next)\n }\n\n return (\n <div className=\"flex flex-col items-center gap-1\">\n <div className=\"text-xs font-semibold text-muted-foreground\" aria-hidden=\"true\">\n {label}\n </div>\n <div\n ref={listRef}\n role=\"group\"\n aria-label={label}\n onKeyDown={handleKeyDown}\n className=\"flex h-64 w-14 flex-col gap-1 overflow-y-auto\"\n >\n {options.map((o, i) => (\n <button\n key={o.key}\n type=\"button\"\n data-index={i}\n tabIndex={i === rovingIndex ? 0 : -1}\n disabled={o.disabled}\n aria-pressed={o.selected}\n aria-label={o.ariaLabel}\n onClick={() => {\n setFocusIndex(i)\n o.onPick()\n }}\n className={cn(\n \"h-9 shrink-0 rounded-lg text-sm font-semibold flex items-center justify-center\",\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background\",\n !o.disabled && !o.selected && \"text-foreground hover:bg-primary/10\",\n o.selected && \"bg-primary text-primary-foreground font-bold\",\n o.disabled && \"opacity-30 cursor-not-allowed\",\n )}\n >\n {o.text}\n </button>\n ))}\n </div>\n </div>\n )\n}\n\nexport { DateTimePicker }\n"]}
|
|
1
|
+
{"version":3,"file":"date-time-picker.js","sourceRoot":"","sources":["../../../src/react/components/date-time-picker.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,UAAU,EA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AAC,CAAC,QAAQ,IAAI,CAAC,CAAC,CAAC,QAAQ,IAAI,qCAAqC,EACnE,CAAC,CAAC,QAAQ,IAAI,8CAA8C,EAC5D,CAAC,CAAC,QAAQ,IAAI,+BAA+B,CAC9C,YAEA,CAAC,CAAC,IAAI,IAnBF,CAAC,CAAC,GAAG,CAoBH,CACV,CAAC,GACE,IACF,CACP,CAAC;AACJ,CAAC;AAED,OAAO,EAAE,cAAc,EAAE,CAAC","sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { DatePicker } from './date-picker.js';\nimport { cn } from '../../lib/utils.js';\n\nexport interface DateTimePickerTime {\n /** 0–23 */\n hours: number;\n /** 0–59 */\n minutes: number;\n}\n\nexport interface DateTimePickerProps {\n /** The chosen instant (local time). */\n value?: Date;\n /** Called with the new instant — always inside `min`/`max`, seconds and milliseconds zero. */\n onChange?: (value: Date) => void;\n /** The earliest selectable instant. Earlier days and times are unavailable. */\n min?: Date;\n /** The latest selectable instant. Later days and times are unavailable. */\n max?: Date;\n /** Minutes offered are multiples of this (default 1). */\n minuteStep?: number;\n /** Time of day a picked day takes when there is no `value` yet (default 23:59 — end of day). */\n defaultTime?: DateTimePickerTime;\n className?: string;\n}\n\nconst MINUTES_PER_DAY = 24 * 60;\nconst HOURS_12 = [12, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11];\nconst PERIODS = ['AM', 'PM'] as const;\ntype Period = (typeof PERIODS)[number];\n\nconst pad2 = (n: number) => String(n).padStart(2, '0');\nconst at = (day: Date, minuteOfDay: number) =>\n new Date(\n day.getFullYear(),\n day.getMonth(),\n day.getDate(),\n Math.floor(minuteOfDay / 60),\n minuteOfDay % 60,\n 0,\n 0,\n );\nconst minuteOfDayOf = (date: Date) => date.getHours() * 60 + date.getMinutes();\nconst to24 = (hour12: number, period: Period) => (hour12 % 12) + (period === 'PM' ? 12 : 0);\nconst periodOf = (hours: number): Period => (hours >= 12 ? 'PM' : 'AM');\nconst hour12Of = (hours: number) => (hours % 12 === 0 ? 12 : hours % 12);\n\n/**\n * Generic date-and-time picker: `DatePicker` for the day, then hour / minute / AM-PM\n * columns of buttons for the time of day — never a native time input, so it looks and\n * behaves the same everywhere and honours `min` / `max` to the minute.\n *\n * Every offered day, hour, minute, and period is one the value may take: a day with\n * no allowed instant is disabled in the calendar, and an hour, minute, or period\n * that would land outside `min` / `max` on the chosen day is disabled. Picking a day\n * keeps the chosen time of day (or `defaultTime` when there is no value) and moves it\n * to the nearest allowed time on that day; picking an hour or period whose current\n * minute is unavailable takes the nearest allowed minute.\n *\n * Keyboard: each time column is one tab stop with roving focus (ArrowUp / ArrowDown,\n * Home / End); Enter or Space picks.\n */\nfunction DateTimePicker({\n value,\n onChange,\n min,\n max,\n minuteStep = 1,\n defaultTime = { hours: 23, minutes: 59 },\n className,\n}: DateTimePickerProps) {\n const step = Math.max(1, Math.min(60, Math.floor(minuteStep)));\n const minuteOptions = React.useMemo(\n () => Array.from({ length: Math.ceil(60 / step) }, (_, i) => i * step).filter((m) => m < 60),\n [step],\n );\n\n const isAllowed = React.useCallback(\n (instant: Date) => (!min || instant >= min) && (!max || instant <= max),\n [min, max],\n );\n const offeredMinutes = React.useMemo(() => new Set(minuteOptions), [minuteOptions]);\n const isOffered = React.useCallback(\n (minuteOfDay: number) => offeredMinutes.has(minuteOfDay % 60),\n [offeredMinutes],\n );\n\n /** Allowed minutes-of-day on `day`, ascending. */\n const allowedMinutesOn = React.useCallback(\n (day: Date) => {\n const out: number[] = [];\n for (let m = 0; m < MINUTES_PER_DAY; m++) {\n if (isOffered(m) && isAllowed(at(day, m))) out.push(m);\n }\n return out;\n },\n [isAllowed, isOffered],\n );\n\n const nearestAllowed = (day: Date, wanted: number): number | null => {\n const allowed = allowedMinutesOn(day);\n if (allowed.length === 0) return null;\n let best = allowed[0];\n for (const m of allowed) if (Math.abs(m - wanted) < Math.abs(best - wanted)) best = m;\n return best;\n };\n\n const commit = (day: Date, wanted: number) => {\n const m = nearestAllowed(day, wanted);\n if (m === null) return;\n onChange?.(at(day, m));\n };\n\n // A day strictly between the bounds' own days is decided by its first and last offered\n // minute; only the bounds' days need the minute-by-minute check.\n const firstOfferedMinute = minuteOptions[0];\n const lastOfferedMinute = 23 * 60 + minuteOptions[minuteOptions.length - 1];\n const isSameDay = (a: Date, b: Date) =>\n a.getFullYear() === b.getFullYear() &&\n a.getMonth() === b.getMonth() &&\n a.getDate() === b.getDate();\n const isDayDisabled = (day: Date) => {\n if ((min && isSameDay(day, min)) || (max && isSameDay(day, max))) {\n return allowedMinutesOn(day).length === 0;\n }\n if (min && at(day, lastOfferedMinute) < min) return true;\n if (max && at(day, firstOfferedMinute) > max) return true;\n return false;\n };\n\n const handleDayPick = (day: Date | undefined) => {\n if (!day) return;\n const wanted = value ? minuteOfDayOf(value) : defaultTime.hours * 60 + defaultTime.minutes;\n commit(day, wanted);\n };\n\n const current = value ? minuteOfDayOf(value) : null;\n const currentHours = current === null ? null : Math.floor(current / 60);\n const currentMinutes = current === null ? null : current % 60;\n const currentPeriod = currentHours === null ? null : periodOf(currentHours);\n\n const allowedSet = React.useMemo(\n () => new Set(value ? allowedMinutesOn(value) : []),\n [value, allowedMinutesOn],\n );\n const hourEnabled = (hours: number) => minuteOptions.some((m) => allowedSet.has(hours * 60 + m));\n const minuteEnabled = (minutes: number) =>\n currentHours !== null && allowedSet.has(currentHours * 60 + minutes);\n const periodEnabled = (period: Period) => {\n const base = period === 'PM' ? 12 : 0;\n for (let h = base; h < base + 12; h++) if (hourEnabled(h)) return true;\n return false;\n };\n\n const pickHour = (hour12: number) => {\n if (!value || currentPeriod === null || currentMinutes === null) return;\n const hours = to24(hour12, currentPeriod);\n const firstInHour = minuteOptions.find((m) => allowedSet.has(hours * 60 + m));\n if (firstInHour === undefined) return;\n const minutes = allowedSet.has(hours * 60 + currentMinutes) ? currentMinutes : firstInHour;\n commit(value, hours * 60 + minutes);\n };\n const pickMinute = (minutes: number) => {\n if (!value || currentHours === null) return;\n commit(value, currentHours * 60 + minutes);\n };\n const pickPeriod = (period: Period) => {\n if (!value || currentHours === null || currentMinutes === null) return;\n const hours = to24(hour12Of(currentHours), period);\n commit(value, hours * 60 + currentMinutes);\n };\n\n const timeDisabled = !value;\n\n return (\n <div className={cn('flex flex-col gap-3 sm:flex-row sm:items-start', className)}>\n <DatePicker selected={value} onSelect={handleDayPick} disabled={isDayDisabled} />\n <div\n className=\"flex gap-2 p-4 bg-card rounded-lg\"\n role=\"group\"\n aria-label=\"Time\"\n aria-disabled={timeDisabled || undefined}\n >\n <TimeColumn\n label=\"Hour\"\n options={HOURS_12.map((h) => ({\n key: h,\n text: String(h),\n ariaLabel: `${h} o'clock`,\n selected: currentHours !== null && hour12Of(currentHours) === h,\n disabled:\n timeDisabled || currentPeriod === null || !hourEnabled(to24(h, currentPeriod)),\n onPick: () => pickHour(h),\n }))}\n />\n <TimeColumn\n label=\"Minute\"\n options={minuteOptions.map((m) => ({\n key: m,\n text: pad2(m),\n ariaLabel: `${pad2(m)} minutes`,\n selected: currentMinutes === m,\n disabled: timeDisabled || !minuteEnabled(m),\n onPick: () => pickMinute(m),\n }))}\n />\n <TimeColumn\n label=\"AM or PM\"\n options={PERIODS.map((p) => ({\n key: p,\n text: p,\n ariaLabel: p,\n selected: currentPeriod === p,\n disabled: timeDisabled || !periodEnabled(p),\n onPick: () => pickPeriod(p),\n }))}\n />\n </div>\n </div>\n );\n}\n\nDateTimePicker.displayName = 'DateTimePicker';\n\ninterface TimeOption {\n key: string | number;\n text: string;\n ariaLabel: string;\n selected: boolean;\n disabled: boolean;\n onPick: () => void;\n}\n\nfunction TimeColumn({ label, options }: { label: string; options: TimeOption[] }) {\n const listRef = React.useRef<HTMLDivElement | null>(null);\n const selectedIndex = options.findIndex((o) => o.selected && !o.disabled);\n const firstEnabled = options.findIndex((o) => !o.disabled);\n const [focusIndex, setFocusIndex] = React.useState<number | null>(null);\n const rovingIndex =\n focusIndex !== null && options[focusIndex] && !options[focusIndex].disabled\n ? focusIndex\n : selectedIndex >= 0\n ? selectedIndex\n : firstEnabled;\n\n // Keep the chosen option in view inside the fixed-height column.\n React.useLayoutEffect(() => {\n if (selectedIndex < 0) return;\n const el = listRef.current?.querySelector<HTMLButtonElement>(`[data-index=\"${selectedIndex}\"]`);\n el?.scrollIntoView?.({ block: 'nearest' });\n }, [selectedIndex]);\n\n const focusAt = (index: number) => {\n setFocusIndex(index);\n listRef.current?.querySelector<HTMLButtonElement>(`[data-index=\"${index}\"]`)?.focus();\n };\n\n const handleKeyDown = (e: React.KeyboardEvent<HTMLDivElement>) => {\n const enabled = options.map((o, i) => (o.disabled ? -1 : i)).filter((i) => i >= 0);\n if (enabled.length === 0 || rovingIndex < 0) return;\n const pos = enabled.indexOf(rovingIndex);\n let next: number | undefined;\n if (e.key === 'ArrowDown') next = enabled[Math.min(enabled.length - 1, pos + 1)];\n else if (e.key === 'ArrowUp') next = enabled[Math.max(0, pos - 1)];\n else if (e.key === 'Home') next = enabled[0];\n else if (e.key === 'End') next = enabled[enabled.length - 1];\n if (next === undefined) return;\n e.preventDefault();\n focusAt(next);\n };\n\n return (\n <div className=\"flex flex-col items-center gap-1\">\n <div className=\"text-xs font-semibold text-muted-foreground\" aria-hidden=\"true\">\n {label}\n </div>\n <div\n ref={listRef}\n role=\"group\"\n aria-label={label}\n onKeyDown={handleKeyDown}\n className=\"flex h-64 w-14 flex-col gap-1 overflow-y-auto\"\n >\n {options.map((o, i) => (\n <button\n key={o.key}\n type=\"button\"\n data-index={i}\n tabIndex={i === rovingIndex ? 0 : -1}\n disabled={o.disabled}\n aria-pressed={o.selected}\n aria-label={o.ariaLabel}\n onClick={() => {\n setFocusIndex(i);\n o.onPick();\n }}\n className={cn(\n 'h-9 shrink-0 rounded-lg text-sm font-semibold flex items-center justify-center',\n 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background',\n !o.disabled && !o.selected && 'text-foreground hover:bg-primary/10',\n o.selected && 'bg-primary text-primary-foreground font-bold',\n o.disabled && 'opacity-30 cursor-not-allowed',\n )}\n >\n {o.text}\n </button>\n ))}\n </div>\n </div>\n );\n}\n\nexport { DateTimePicker };\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as React from
|
|
2
|
-
import * as DialogPrimitive from
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import * as DialogPrimitive from '@radix-ui/react-dialog';
|
|
3
3
|
declare const Dialog: React.FC<DialogPrimitive.DialogProps>;
|
|
4
4
|
declare const DialogTrigger: React.ForwardRefExoticComponent<DialogPrimitive.DialogTriggerProps & React.RefAttributes<HTMLButtonElement>>;
|
|
5
5
|
declare const DialogPortal: React.FC<DialogPrimitive.DialogPortalProps>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dialog.d.ts","sourceRoot":"","sources":["../../../src/react/components/dialog.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,
|
|
1
|
+
{"version":3,"file":"dialog.d.ts","sourceRoot":"","sources":["../../../src/react/components/dialog.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,eAAe,MAAM,wBAAwB,CAAC;AAM1D,QAAA,MAAM,MAAM,uCAAuB,CAAC;AACpC,QAAA,MAAM,aAAa,8GAA0B,CAAC;AAC9C,QAAA,MAAM,YAAY,6CAAyB,CAAC;AAC5C,QAAA,MAAM,WAAW,4GAAwB,CAAC;AAE1C,QAAA,MAAM,aAAa,8JAYjB,CAAC;AAGH,QAAA,MAAM,aAAa,8JA0BjB,CAAC;AAGH,QAAA,MAAM,YAAY;8BAA6B,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC;;CAElF,CAAC;AAGF,QAAA,MAAM,YAAY;8BAA6B,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC;;CAKlF,CAAC;AAGF,QAAA,MAAM,WAAW,oKASf,CAAC;AAGH,QAAA,MAAM,iBAAiB,8KASrB,CAAC;AAGH,OAAO,EACL,MAAM,EACN,YAAY,EACZ,aAAa,EACb,WAAW,EACX,aAAa,EACb,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,iBAAiB,GAClB,CAAC"}
|
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
|
|
1
|
+
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import * as React from
|
|
4
|
-
import * as DialogPrimitive from
|
|
5
|
-
import { X } from
|
|
6
|
-
import { cn } from
|
|
7
|
-
import { useOpenerFocus } from
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import * as DialogPrimitive from '@radix-ui/react-dialog';
|
|
5
|
+
import { X } from 'lucide-react';
|
|
6
|
+
import { cn } from '../../lib/utils.js';
|
|
7
|
+
import { useOpenerFocus } from './opener-focus.js';
|
|
8
8
|
const Dialog = DialogPrimitive.Root;
|
|
9
9
|
const DialogTrigger = DialogPrimitive.Trigger;
|
|
10
10
|
const DialogPortal = DialogPrimitive.Portal;
|
|
11
11
|
const DialogClose = DialogPrimitive.Close;
|
|
12
|
-
const DialogOverlay = React.forwardRef(({ className, ...props }, ref) => (_jsx(DialogPrimitive.Overlay, { ref: ref, className: cn(
|
|
12
|
+
const DialogOverlay = React.forwardRef(({ className, ...props }, ref) => (_jsx(DialogPrimitive.Overlay, { ref: ref, className: cn('fixed inset-0 z-50 bg-[color:var(--scrim)] duration-[var(--motion-base)] ease-[var(--motion-ease)] data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0', className), ...props })));
|
|
13
13
|
DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
|
|
14
14
|
const DialogContent = React.forwardRef(({ className, children, onOpenAutoFocus, onCloseAutoFocus, ...props }, ref) => {
|
|
15
15
|
const openerFocus = useOpenerFocus({ onOpenAutoFocus, onCloseAutoFocus });
|
|
16
|
-
return (_jsxs(DialogPortal, { children: [_jsx(DialogOverlay, {}), _jsxs(DialogPrimitive.Content, { ref: ref, className: cn(
|
|
16
|
+
return (_jsxs(DialogPortal, { children: [_jsx(DialogOverlay, {}), _jsxs(DialogPrimitive.Content, { ref: ref, className: cn('fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-card p-6 elevation-raised duration-[var(--motion-base)] ease-[var(--motion-ease)] data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg', 'max-h-[90vh] overflow-y-auto [&>*]:min-w-0', className), ...props, ...openerFocus, children: [children, _jsxs(DialogPrimitive.Close, { className: "absolute right-4 top-4 rounded-xs opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground", children: [_jsx(X, { className: "h-4 w-4" }), _jsx("span", { className: "sr-only", children: "Close" })] })] })] }));
|
|
17
17
|
});
|
|
18
18
|
DialogContent.displayName = DialogPrimitive.Content.displayName;
|
|
19
|
-
const DialogHeader = ({ className, ...props }) => (_jsx("div", { className: cn(
|
|
20
|
-
DialogHeader.displayName =
|
|
21
|
-
const DialogFooter = ({ className, ...props }) => (_jsx("div", { className: cn(
|
|
22
|
-
DialogFooter.displayName =
|
|
23
|
-
const DialogTitle = React.forwardRef(({ className, ...props }, ref) => (_jsx(DialogPrimitive.Title, { ref: ref, className: cn(
|
|
19
|
+
const DialogHeader = ({ className, ...props }) => (_jsx("div", { className: cn('flex flex-col space-y-1.5 text-center sm:text-left', className), ...props }));
|
|
20
|
+
DialogHeader.displayName = 'DialogHeader';
|
|
21
|
+
const DialogFooter = ({ className, ...props }) => (_jsx("div", { className: cn('flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2', className), ...props }));
|
|
22
|
+
DialogFooter.displayName = 'DialogFooter';
|
|
23
|
+
const DialogTitle = React.forwardRef(({ className, ...props }, ref) => (_jsx(DialogPrimitive.Title, { ref: ref, className: cn('text-lg font-semibold leading-none tracking-tight break-words', className), ...props })));
|
|
24
24
|
DialogTitle.displayName = DialogPrimitive.Title.displayName;
|
|
25
|
-
const DialogDescription = React.forwardRef(({ className, ...props }, ref) => (_jsx(DialogPrimitive.Description, { ref: ref, className: cn(
|
|
25
|
+
const DialogDescription = React.forwardRef(({ className, ...props }, ref) => (_jsx(DialogPrimitive.Description, { ref: ref, className: cn('text-sm text-muted-foreground break-words', className), ...props })));
|
|
26
26
|
DialogDescription.displayName = DialogPrimitive.Description.displayName;
|
|
27
27
|
export { Dialog, DialogPortal, DialogOverlay, DialogClose, DialogTrigger, DialogContent, DialogHeader, DialogFooter, DialogTitle, DialogDescription, };
|
|
28
28
|
//# sourceMappingURL=dialog.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dialog.js","sourceRoot":"","sources":["../../../src/react/components/dialog.tsx"],"names":[],"mappings":"AAAA,YAAY,
|
|
1
|
+
{"version":3,"file":"dialog.js","sourceRoot":"","sources":["../../../src/react/components/dialog.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,eAAe,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,CAAC,EAAE,MAAM,cAAc,CAAC;AAEjC,OAAO,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAC;AACxC,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEnD,MAAM,MAAM,GAAG,eAAe,CAAC,IAAI,CAAC;AACpC,MAAM,aAAa,GAAG,eAAe,CAAC,OAAO,CAAC;AAC9C,MAAM,YAA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AE,CAAC,oDAAoD,EAAE,SAAS,CAAC,KAAM,KAAK,GAAI,CACnG,CAAC;AACF,YAAY,CAAC,WAAW,GAAG,cAAc,CAAC;AAE1C,MAAM,YAAY,GAAG,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAwC,EAAE,EAAE,CAAC,CACtF,cACE,SAAS,EAAE,EAAE,CAAC,+DAA+D,EAAE,SAAS,CAAC,KACrF,KAAK,GACT,CACH,CAAC;AACF,YAAY,CAAC,WAAW,GAAG,cAAc,CAAC;AAE1C,MAAM,WAAW,GAAG,KAAK,CAAC,UAAU,CAGlC,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,EAAE,EAAE,CAAC,CAClC,KAAC,eAAe,CAAC,KAAK,IACpB,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,EAAE,CAAC,+DAA+D,EAAE,SAAS,CAAC,KACrF,KAAK,GACT,CACH,CAAC,CAAC;AACH,WAAW,CAAC,WAAW,GAAG,eAAe,CAAC,KAAK,CAAC,WAAW,CAAC;AAE5D,MAAM,iBAAiB,GAAG,KAAK,CAAC,UAAU,CAGxC,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,EAAE,EAAE,CAAC,CAClC,KAAC,eAAe,CAAC,WAAW,IAC1B,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,EAAE,CAAC,2CAA2C,EAAE,SAAS,CAAC,KACjE,KAAK,GACT,CACH,CAAC,CAAC;AACH,iBAAiB,CAAC,WAAW,GAAG,eAAe,CAAC,WAAW,CAAC,WAAW,CAAC;AAExE,OAAO,EACL,MAAM,EACN,YAAY,EACZ,aAAa,EACb,WAAW,EACX,aAAa,EACb,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,iBAAiB,GAClB,CAAC","sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport * as DialogPrimitive from '@radix-ui/react-dialog';\nimport { X } from 'lucide-react';\n\nimport { cn } from '../../lib/utils.js';\nimport { useOpenerFocus } from './opener-focus.js';\n\nconst Dialog = DialogPrimitive.Root;\nconst DialogTrigger = DialogPrimitive.Trigger;\nconst DialogPortal = DialogPrimitive.Portal;\nconst DialogClose = DialogPrimitive.Close;\n\nconst DialogOverlay = React.forwardRef<\n React.ElementRef<typeof DialogPrimitive.Overlay>,\n React.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay>\n>(({ className, ...props }, ref) => (\n <DialogPrimitive.Overlay\n ref={ref}\n className={cn(\n 'fixed inset-0 z-50 bg-[color:var(--scrim)] duration-[var(--motion-base)] ease-[var(--motion-ease)] data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0',\n className,\n )}\n {...props}\n />\n));\nDialogOverlay.displayName = DialogPrimitive.Overlay.displayName;\n\nconst DialogContent = React.forwardRef<\n React.ElementRef<typeof DialogPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content>\n>(({ className, children, onOpenAutoFocus, onCloseAutoFocus, ...props }, ref) => {\n const openerFocus = useOpenerFocus({ onOpenAutoFocus, onCloseAutoFocus });\n return (\n <DialogPortal>\n <DialogOverlay />\n <DialogPrimitive.Content\n ref={ref}\n className={cn(\n 'fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-card p-6 elevation-raised duration-[var(--motion-base)] ease-[var(--motion-ease)] data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg',\n 'max-h-[90vh] overflow-y-auto [&>*]:min-w-0',\n className,\n )}\n {...props}\n {...openerFocus}\n >\n {children}\n <DialogPrimitive.Close className=\"absolute right-4 top-4 rounded-xs opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground\">\n <X className=\"h-4 w-4\" />\n <span className=\"sr-only\">Close</span>\n </DialogPrimitive.Close>\n </DialogPrimitive.Content>\n </DialogPortal>\n );\n});\nDialogContent.displayName = DialogPrimitive.Content.displayName;\n\nconst DialogHeader = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (\n <div className={cn('flex flex-col space-y-1.5 text-center sm:text-left', className)} {...props} />\n);\nDialogHeader.displayName = 'DialogHeader';\n\nconst DialogFooter = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (\n <div\n className={cn('flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2', className)}\n {...props}\n />\n);\nDialogFooter.displayName = 'DialogFooter';\n\nconst DialogTitle = React.forwardRef<\n React.ElementRef<typeof DialogPrimitive.Title>,\n React.ComponentPropsWithoutRef<typeof DialogPrimitive.Title>\n>(({ className, ...props }, ref) => (\n <DialogPrimitive.Title\n ref={ref}\n className={cn('text-lg font-semibold leading-none tracking-tight break-words', className)}\n {...props}\n />\n));\nDialogTitle.displayName = DialogPrimitive.Title.displayName;\n\nconst DialogDescription = React.forwardRef<\n React.ElementRef<typeof DialogPrimitive.Description>,\n React.ComponentPropsWithoutRef<typeof DialogPrimitive.Description>\n>(({ className, ...props }, ref) => (\n <DialogPrimitive.Description\n ref={ref}\n className={cn('text-sm text-muted-foreground break-words', className)}\n {...props}\n />\n));\nDialogDescription.displayName = DialogPrimitive.Description.displayName;\n\nexport {\n Dialog,\n DialogPortal,\n DialogOverlay,\n DialogClose,\n DialogTrigger,\n DialogContent,\n DialogHeader,\n DialogFooter,\n DialogTitle,\n DialogDescription,\n};\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as React from
|
|
2
|
-
import * as DropdownMenuPrimitive from
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
|
|
3
3
|
declare const DropdownMenu: React.FC<DropdownMenuPrimitive.DropdownMenuProps>;
|
|
4
4
|
declare const DropdownMenuTrigger: React.ForwardRefExoticComponent<DropdownMenuPrimitive.DropdownMenuTriggerProps & React.RefAttributes<HTMLButtonElement>>;
|
|
5
5
|
declare const DropdownMenuGroup: React.ForwardRefExoticComponent<DropdownMenuPrimitive.DropdownMenuGroupProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dropdown-menu.d.ts","sourceRoot":"","sources":["../../../src/react/components/dropdown-menu.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,
|
|
1
|
+
{"version":3,"file":"dropdown-menu.d.ts","sourceRoot":"","sources":["../../../src/react/components/dropdown-menu.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,qBAAqB,MAAM,+BAA+B,CAAC;AAOvE,QAAA,MAAM,YAAY,mDAA6B,CAAC;AAChD,QAAA,MAAM,mBAAmB,0HAAgC,CAAC;AAC1D,QAAA,MAAM,iBAAiB,qHAA8B,CAAC;AACtD,QAAA,MAAM,kBAAkB,yDAA+B,CAAC;AACxD,QAAA,MAAM,eAAe,sDAA4B,CAAC;AAClD,QAAA,MAAM,sBAAsB,0HAAmC,CAAC;AAEhE,QAAA,MAAM,sBAAsB;YAGhB,OAAO;wCAejB,CAAC;AAGH,QAAA,MAAM,sBAAsB,6KAY1B,CAAC;AAGH,QAAA,MAAM,mBAAmB,0KAevB,CAAC;AAUH,QAAA,MAAM,gBAAgB;YAGV,OAAO;IACf;;;;;;OAMG;cACO,OAAO;IACjB,kEAAkE;WAC3D,KAAK,CAAC,SAAS;wCA0BxB,CAAC;AAGH,QAAA,MAAM,wBAAwB,+KAoB5B,CAAC;AAGH,QAAA,MAAM,qBAAqB,4KAmBzB,CAAC;AAGH,QAAA,MAAM,iBAAiB;YAGX,OAAO;wCAQjB,CAAC;AAGH,QAAA,MAAM,qBAAqB,4KASzB,CAAC;AAGH,QAAA,MAAM,oBAAoB;8BAA6B,KAAK,CAAC,cAAc,CAAC,eAAe,CAAC;;CAE3F,CAAC;AAGF,OAAO,EACL,YAAY,EACZ,mBAAmB,EACnB,mBAAmB,EACnB,gBAAgB,EAChB,wBAAwB,EACxB,qBAAqB,EACrB,iBAAiB,EACjB,qBAAqB,EACrB,oBAAoB,EACpB,iBAAiB,EACjB,kBAAkB,EAClB,eAAe,EACf,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,GACvB,CAAC"}
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
|
|
1
|
+
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import * as React from
|
|
4
|
-
import * as DropdownMenuPrimitive from
|
|
5
|
-
import { Slottable } from
|
|
6
|
-
import { Check, ChevronRight, Circle } from
|
|
7
|
-
import { cn } from
|
|
8
|
-
import { Spinner } from
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
|
|
5
|
+
import { Slottable } from '@radix-ui/react-slot';
|
|
6
|
+
import { Check, ChevronRight, Circle } from 'lucide-react';
|
|
7
|
+
import { cn } from '../../lib/utils.js';
|
|
8
|
+
import { Spinner } from './spinner.js';
|
|
9
9
|
const DropdownMenu = DropdownMenuPrimitive.Root;
|
|
10
10
|
const DropdownMenuTrigger = DropdownMenuPrimitive.Trigger;
|
|
11
11
|
const DropdownMenuGroup = DropdownMenuPrimitive.Group;
|
|
12
12
|
const DropdownMenuPortal = DropdownMenuPrimitive.Portal;
|
|
13
13
|
const DropdownMenuSub = DropdownMenuPrimitive.Sub;
|
|
14
14
|
const DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup;
|
|
15
|
-
const DropdownMenuSubTrigger = React.forwardRef(({ className, inset, children, ...props }, ref) => (_jsxs(DropdownMenuPrimitive.SubTrigger, { ref: ref, className: cn(
|
|
15
|
+
const DropdownMenuSubTrigger = React.forwardRef(({ className, inset, children, ...props }, ref) => (_jsxs(DropdownMenuPrimitive.SubTrigger, { ref: ref, className: cn('flex cursor-default gap-2 select-none items-center rounded-xs px-2 py-1.5 text-sm outline-hidden focus:bg-accent data-[state=open]:bg-accent [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0', inset && 'pl-8', className), ...props, children: [children, _jsx(ChevronRight, { className: "ml-auto" })] })));
|
|
16
16
|
DropdownMenuSubTrigger.displayName = DropdownMenuPrimitive.SubTrigger.displayName;
|
|
17
|
-
const DropdownMenuSubContent = React.forwardRef(({ className, ...props }, ref) => (_jsx(DropdownMenuPrimitive.SubContent, { ref: ref, className: cn(
|
|
17
|
+
const DropdownMenuSubContent = React.forwardRef(({ className, ...props }, ref) => (_jsx(DropdownMenuPrimitive.SubContent, { ref: ref, className: cn('z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground elevation-raised duration-[var(--motion-fast)] ease-[var(--motion-ease)] data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2', className), ...props })));
|
|
18
18
|
DropdownMenuSubContent.displayName = DropdownMenuPrimitive.SubContent.displayName;
|
|
19
|
-
const DropdownMenuContent = React.forwardRef(({ className, sideOffset = 4, ...props }, ref) => (_jsx(DropdownMenuPrimitive.Portal, { children: _jsx(DropdownMenuPrimitive.Content, { ref: ref, sideOffset: sideOffset, className: cn(
|
|
19
|
+
const DropdownMenuContent = React.forwardRef(({ className, sideOffset = 4, ...props }, ref) => (_jsx(DropdownMenuPrimitive.Portal, { children: _jsx(DropdownMenuPrimitive.Content, { ref: ref, sideOffset: sideOffset, className: cn('z-50 min-w-[8rem] overflow-hidden rounded-md border !bg-card p-1 text-popover-foreground elevation-popover duration-[var(--motion-fast)] ease-[var(--motion-ease)] data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2', className), ...props }) })));
|
|
20
20
|
DropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName;
|
|
21
21
|
// Every selection — a pointer, Enter, or Space — reaches the item as a click; stopping it in the
|
|
22
22
|
// capture phase keeps the item's select (and an `asChild` link's navigation) from running.
|
|
@@ -24,19 +24,24 @@ function blockActivation(event) {
|
|
|
24
24
|
event.preventDefault();
|
|
25
25
|
event.stopPropagation();
|
|
26
26
|
}
|
|
27
|
-
const DropdownMenuItem = React.forwardRef(({ className, inset, pending = false, icon, disabled, children, ...props }, ref) => (_jsxs(DropdownMenuPrimitive.Item, { ref: ref, className: cn(
|
|
28
|
-
? {
|
|
27
|
+
const DropdownMenuItem = React.forwardRef(({ className, inset, pending = false, icon, disabled, children, ...props }, ref) => (_jsxs(DropdownMenuPrimitive.Item, { ref: ref, className: cn('relative flex cursor-default select-none items-center gap-2 rounded-xs px-2 py-1.5 text-sm outline-hidden transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 app-dropdown-item', inset && 'pl-8', className), ...props, ...(pending
|
|
28
|
+
? {
|
|
29
|
+
'aria-busy': true,
|
|
30
|
+
'aria-disabled': true,
|
|
31
|
+
'data-pending': '',
|
|
32
|
+
onClickCapture: blockActivation,
|
|
33
|
+
}
|
|
29
34
|
: {}), disabled: (disabled && !pending) || undefined, children: [pending ? _jsx(Spinner, { size: "xs" }) : icon, _jsx(Slottable, { children: children })] })));
|
|
30
35
|
DropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName;
|
|
31
|
-
const DropdownMenuCheckboxItem = React.forwardRef(({ className, children, checked, ...props }, ref) => (_jsxs(DropdownMenuPrimitive.CheckboxItem, { ref: ref, className: cn(
|
|
36
|
+
const DropdownMenuCheckboxItem = React.forwardRef(({ className, children, checked, ...props }, ref) => (_jsxs(DropdownMenuPrimitive.CheckboxItem, { ref: ref, className: cn('relative flex cursor-default select-none items-center rounded-xs py-1.5 pl-8 pr-2 text-sm outline-hidden transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50', className), checked: checked, ...props, children: [_jsx("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: _jsx(DropdownMenuPrimitive.ItemIndicator, { children: _jsx(Check, { className: "h-4 w-4" }) }) }), children] })));
|
|
32
37
|
DropdownMenuCheckboxItem.displayName = DropdownMenuPrimitive.CheckboxItem.displayName;
|
|
33
|
-
const DropdownMenuRadioItem = React.forwardRef(({ className, children, ...props }, ref) => (_jsxs(DropdownMenuPrimitive.RadioItem, { ref: ref, className: cn(
|
|
38
|
+
const DropdownMenuRadioItem = React.forwardRef(({ className, children, ...props }, ref) => (_jsxs(DropdownMenuPrimitive.RadioItem, { ref: ref, className: cn('relative flex cursor-default select-none items-center rounded-xs py-1.5 pl-8 pr-2 text-sm outline-hidden transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50', className), ...props, children: [_jsx("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: _jsx(DropdownMenuPrimitive.ItemIndicator, { children: _jsx(Circle, { className: "h-2 w-2 fill-current" }) }) }), children] })));
|
|
34
39
|
DropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName;
|
|
35
|
-
const DropdownMenuLabel = React.forwardRef(({ className, inset, ...props }, ref) => (_jsx(DropdownMenuPrimitive.Label, { ref: ref, className: cn(
|
|
40
|
+
const DropdownMenuLabel = React.forwardRef(({ className, inset, ...props }, ref) => (_jsx(DropdownMenuPrimitive.Label, { ref: ref, className: cn('px-2 py-1.5 text-sm font-semibold', inset && 'pl-8', className), ...props })));
|
|
36
41
|
DropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName;
|
|
37
|
-
const DropdownMenuSeparator = React.forwardRef(({ className, ...props }, ref) => (_jsx(DropdownMenuPrimitive.Separator, { ref: ref, className: cn(
|
|
42
|
+
const DropdownMenuSeparator = React.forwardRef(({ className, ...props }, ref) => (_jsx(DropdownMenuPrimitive.Separator, { ref: ref, className: cn('-mx-1 my-1 h-px bg-muted', className), ...props })));
|
|
38
43
|
DropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName;
|
|
39
|
-
const DropdownMenuShortcut = ({ className, ...props }) => (_jsx("span", { className: cn(
|
|
40
|
-
DropdownMenuShortcut.displayName =
|
|
44
|
+
const DropdownMenuShortcut = ({ className, ...props }) => (_jsx("span", { className: cn('ml-auto text-xs tracking-widest opacity-60', className), ...props }));
|
|
45
|
+
DropdownMenuShortcut.displayName = 'DropdownMenuShortcut';
|
|
41
46
|
export { DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuItem, DropdownMenuCheckboxItem, DropdownMenuRadioItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuGroup, DropdownMenuPortal, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuRadioGroup, };
|
|
42
47
|
//# sourceMappingURL=dropdown-menu.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dropdown-menu.js","sourceRoot":"","sources":["../../../src/react/components/dropdown-menu.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ,OAAO,KAAK,KAAK,MAAM,OAAO,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AsB,EACtB,sBAAsB,GACvB,CAAA","sourcesContent":["\"use client\"\n\nimport * as React from \"react\"\nimport * as DropdownMenuPrimitive from \"@radix-ui/react-dropdown-menu\"\nimport { Slottable } from \"@radix-ui/react-slot\"\nimport { Check, ChevronRight, Circle } from \"lucide-react\"\n\nimport { cn } from \"../../lib/utils.js\"\nimport { Spinner } from \"./spinner.js\"\n\nconst DropdownMenu = DropdownMenuPrimitive.Root\nconst DropdownMenuTrigger = DropdownMenuPrimitive.Trigger\nconst DropdownMenuGroup = DropdownMenuPrimitive.Group\nconst DropdownMenuPortal = DropdownMenuPrimitive.Portal\nconst DropdownMenuSub = DropdownMenuPrimitive.Sub\nconst DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup\n\nconst DropdownMenuSubTrigger = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.SubTrigger>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubTrigger> & {\n inset?: boolean\n }\n>(({ className, inset, children, ...props }, ref) => (\n <DropdownMenuPrimitive.SubTrigger\n ref={ref}\n className={cn(\n \"flex cursor-default gap-2 select-none items-center rounded-xs px-2 py-1.5 text-sm outline-hidden focus:bg-accent data-[state=open]:bg-accent [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0\",\n inset && \"pl-8\",\n className\n )}\n {...props}\n >\n {children}\n <ChevronRight className=\"ml-auto\" />\n </DropdownMenuPrimitive.SubTrigger>\n))\nDropdownMenuSubTrigger.displayName = DropdownMenuPrimitive.SubTrigger.displayName\n\nconst DropdownMenuSubContent = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.SubContent>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubContent>\n>(({ className, ...props }, ref) => (\n <DropdownMenuPrimitive.SubContent\n ref={ref}\n className={cn(\n \"z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground elevation-raised data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2\",\n className\n )}\n {...props}\n />\n))\nDropdownMenuSubContent.displayName = DropdownMenuPrimitive.SubContent.displayName\n\nconst DropdownMenuContent = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Content>\n>(({ className, sideOffset = 4, ...props }, ref) => (\n <DropdownMenuPrimitive.Portal>\n <DropdownMenuPrimitive.Content\n ref={ref}\n sideOffset={sideOffset}\n className={cn(\n \"z-50 min-w-[8rem] overflow-hidden rounded-md border !bg-card p-1 text-popover-foreground elevation-popover data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2\",\n className\n )}\n {...props}\n />\n </DropdownMenuPrimitive.Portal>\n))\nDropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName\n\n// Every selection — a pointer, Enter, or Space — reaches the item as a click; stopping it in the\n// capture phase keeps the item's select (and an `asChild` link's navigation) from running.\nfunction blockActivation(event: React.MouseEvent<HTMLElement>) {\n event.preventDefault()\n event.stopPropagation()\n}\n\nconst DropdownMenuItem = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.Item>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Item> & {\n inset?: boolean\n /**\n * The action this item started is in flight: the item ignores selection, sets\n * `aria-disabled` and `aria-busy`, and shows the spinner in place of its `icon`. It is\n * never natively disabled while pending (a `disabled` passed alongside applies once pending\n * ends), so it keeps focus (FRONTEND-203). Keeping the menu\n * open meanwhile is the caller's `onSelect` (`event.preventDefault()`, close on settle).\n */\n pending?: boolean\n /** Leading icon. While `pending`, the spinner takes its place. */\n icon?: React.ReactNode\n }\n>(({ className, inset, pending = false, icon, disabled, children, ...props }, ref) => (\n <DropdownMenuPrimitive.Item\n ref={ref}\n className={cn(\n \"relative flex cursor-default select-none items-center gap-2 rounded-xs px-2 py-1.5 text-sm outline-hidden transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 app-dropdown-item\",\n inset && \"pl-8\",\n className\n )}\n {...props}\n {...(pending\n ? { \"aria-busy\": true, \"aria-disabled\": true, \"data-pending\": \"\", onClickCapture: blockActivation }\n : {})}\n disabled={(disabled && !pending) || undefined}\n >\n {/* Direct siblings, never a fragment: under `asChild` Radix Slot finds the Slottable\n among its direct children and renders the icon/spinner inside the child element. */}\n {pending ? <Spinner size=\"xs\" /> : icon}\n <Slottable>{children}</Slottable>\n </DropdownMenuPrimitive.Item>\n))\nDropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName\n\nconst DropdownMenuCheckboxItem = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.CheckboxItem>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.CheckboxItem>\n>(({ className, children, checked, ...props }, ref) => (\n <DropdownMenuPrimitive.CheckboxItem\n ref={ref}\n className={cn(\n \"relative flex cursor-default select-none items-center rounded-xs py-1.5 pl-8 pr-2 text-sm outline-hidden transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50\",\n className\n )}\n checked={checked}\n {...props}\n >\n <span className=\"absolute left-2 flex h-3.5 w-3.5 items-center justify-center\">\n <DropdownMenuPrimitive.ItemIndicator>\n <Check className=\"h-4 w-4\" />\n </DropdownMenuPrimitive.ItemIndicator>\n </span>\n {children}\n </DropdownMenuPrimitive.CheckboxItem>\n))\nDropdownMenuCheckboxItem.displayName = DropdownMenuPrimitive.CheckboxItem.displayName\n\nconst DropdownMenuRadioItem = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.RadioItem>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.RadioItem>\n>(({ className, children, ...props }, ref) => (\n <DropdownMenuPrimitive.RadioItem\n ref={ref}\n className={cn(\n \"relative flex cursor-default select-none items-center rounded-xs py-1.5 pl-8 pr-2 text-sm outline-hidden transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50\",\n className\n )}\n {...props}\n >\n <span className=\"absolute left-2 flex h-3.5 w-3.5 items-center justify-center\">\n <DropdownMenuPrimitive.ItemIndicator>\n <Circle className=\"h-2 w-2 fill-current\" />\n </DropdownMenuPrimitive.ItemIndicator>\n </span>\n {children}\n </DropdownMenuPrimitive.RadioItem>\n))\nDropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName\n\nconst DropdownMenuLabel = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.Label>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Label> & {\n inset?: boolean\n }\n>(({ className, inset, ...props }, ref) => (\n <DropdownMenuPrimitive.Label\n ref={ref}\n className={cn(\"px-2 py-1.5 text-sm font-semibold\", inset && \"pl-8\", className)}\n {...props}\n />\n))\nDropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName\n\nconst DropdownMenuSeparator = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.Separator>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Separator>\n>(({ className, ...props }, ref) => (\n <DropdownMenuPrimitive.Separator\n ref={ref}\n className={cn(\"-mx-1 my-1 h-px bg-muted\", className)}\n {...props}\n />\n))\nDropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName\n\nconst DropdownMenuShortcut = ({\n className,\n ...props\n}: React.HTMLAttributes<HTMLSpanElement>) => (\n <span className={cn(\"ml-auto text-xs tracking-widest opacity-60\", className)} {...props} />\n)\nDropdownMenuShortcut.displayName = \"DropdownMenuShortcut\"\n\nexport {\n DropdownMenu,\n DropdownMenuTrigger,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuCheckboxItem,\n DropdownMenuRadioItem,\n DropdownMenuLabel,\n DropdownMenuSeparator,\n DropdownMenuShortcut,\n DropdownMenuGroup,\n DropdownMenuPortal,\n DropdownMenuSub,\n DropdownMenuSubContent,\n DropdownMenuSubTrigger,\n DropdownMenuRadioGroup,\n}\n"]}
|
|
1
|
+
{"version":3,"file":"dropdown-menu.js","sourceRoot":"","sources":["../../../src/react/components/dropdown-menu.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,qBAAqB,MAAM,+BAA+B,CAAC;AACvE,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAE3D,OAAO,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAC;AACxC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,MAAM,YAAY,GAAG,qBAAqB,CAAC,IAAI,CAAC;AAChD,MAAM,mBAAmB,GAAG,qBAAqB,CAAC,OAAO,CAAC;AAC1D,MAAM,iBAAiB,GAAG,qBAAqB,CAAC,KAAK,CAAC;AACtD,MAAM,kBAAkB,GAAG,qBAAqB,CAAC,MAAM,CAAC;AACxD,MAAM,eAAe,GAAG,qBAAqB,CAAC,GAAG,CAAC;AAClD,MAAM,sBAAsB,GAAG,qBAAqB,CAAC,UAAU,CAAC;AAEhE,MAAM,sBAAsB,GAAG,KAAK,CAAC,UAAU,CAK7C,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,QAAQ,EAAE,G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,KAAK,GACT,CACH,CAAC,CAAC;AACH,qBAAqB,CAAC,WAAW,GAAG,qBAAqB,CAAC,SAAS,CAAC,WAAW,CAAC;AAEhF,MAAM,oBAAoB,GAAG,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAyC,EAAE,EAAE,CAAC,CAC/F,eAAM,SAAS,EAAE,EAAE,CAAC,4CAA4C,EAAE,SAAS,CAAC,KAAM,KAAK,GAAI,CAC5F,CAAC;AACF,oBAAoB,CAAC,WAAW,GAAG,sBAAsB,CAAC;AAE1D,OAAO,EACL,YAAY,EACZ,mBAAmB,EACnB,mBAAmB,EACnB,gBAAgB,EAChB,wBAAwB,EACxB,qBAAqB,EACrB,iBAAiB,EACjB,qBAAqB,EACrB,oBAAoB,EACpB,iBAAiB,EACjB,kBAAkB,EAClB,eAAe,EACf,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,GACvB,CAAC","sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';\nimport { Slottable } from '@radix-ui/react-slot';\nimport { Check, ChevronRight, Circle } from 'lucide-react';\n\nimport { cn } from '../../lib/utils.js';\nimport { Spinner } from './spinner.js';\n\nconst DropdownMenu = DropdownMenuPrimitive.Root;\nconst DropdownMenuTrigger = DropdownMenuPrimitive.Trigger;\nconst DropdownMenuGroup = DropdownMenuPrimitive.Group;\nconst DropdownMenuPortal = DropdownMenuPrimitive.Portal;\nconst DropdownMenuSub = DropdownMenuPrimitive.Sub;\nconst DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup;\n\nconst DropdownMenuSubTrigger = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.SubTrigger>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubTrigger> & {\n inset?: boolean;\n }\n>(({ className, inset, children, ...props }, ref) => (\n <DropdownMenuPrimitive.SubTrigger\n ref={ref}\n className={cn(\n 'flex cursor-default gap-2 select-none items-center rounded-xs px-2 py-1.5 text-sm outline-hidden focus:bg-accent data-[state=open]:bg-accent [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0',\n inset && 'pl-8',\n className,\n )}\n {...props}\n >\n {children}\n <ChevronRight className=\"ml-auto\" />\n </DropdownMenuPrimitive.SubTrigger>\n));\nDropdownMenuSubTrigger.displayName = DropdownMenuPrimitive.SubTrigger.displayName;\n\nconst DropdownMenuSubContent = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.SubContent>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubContent>\n>(({ className, ...props }, ref) => (\n <DropdownMenuPrimitive.SubContent\n ref={ref}\n className={cn(\n 'z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground elevation-raised duration-[var(--motion-fast)] ease-[var(--motion-ease)] data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2',\n className,\n )}\n {...props}\n />\n));\nDropdownMenuSubContent.displayName = DropdownMenuPrimitive.SubContent.displayName;\n\nconst DropdownMenuContent = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Content>\n>(({ className, sideOffset = 4, ...props }, ref) => (\n <DropdownMenuPrimitive.Portal>\n <DropdownMenuPrimitive.Content\n ref={ref}\n sideOffset={sideOffset}\n className={cn(\n 'z-50 min-w-[8rem] overflow-hidden rounded-md border !bg-card p-1 text-popover-foreground elevation-popover duration-[var(--motion-fast)] ease-[var(--motion-ease)] data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2',\n className,\n )}\n {...props}\n />\n </DropdownMenuPrimitive.Portal>\n));\nDropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName;\n\n// Every selection — a pointer, Enter, or Space — reaches the item as a click; stopping it in the\n// capture phase keeps the item's select (and an `asChild` link's navigation) from running.\nfunction blockActivation(event: React.MouseEvent<HTMLElement>) {\n event.preventDefault();\n event.stopPropagation();\n}\n\nconst DropdownMenuItem = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.Item>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Item> & {\n inset?: boolean;\n /**\n * The action this item started is in flight: the item ignores selection, sets\n * `aria-disabled` and `aria-busy`, and shows the spinner in place of its `icon`. It is\n * never natively disabled while pending (a `disabled` passed alongside applies once pending\n * ends), so it keeps focus (FRONTEND-203). Keeping the menu\n * open meanwhile is the caller's `onSelect` (`event.preventDefault()`, close on settle).\n */\n pending?: boolean;\n /** Leading icon. While `pending`, the spinner takes its place. */\n icon?: React.ReactNode;\n }\n>(({ className, inset, pending = false, icon, disabled, children, ...props }, ref) => (\n <DropdownMenuPrimitive.Item\n ref={ref}\n className={cn(\n 'relative flex cursor-default select-none items-center gap-2 rounded-xs px-2 py-1.5 text-sm outline-hidden transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 app-dropdown-item',\n inset && 'pl-8',\n className,\n )}\n {...props}\n {...(pending\n ? {\n 'aria-busy': true,\n 'aria-disabled': true,\n 'data-pending': '',\n onClickCapture: blockActivation,\n }\n : {})}\n disabled={(disabled && !pending) || undefined}\n >\n {/* Direct siblings, never a fragment: under `asChild` Radix Slot finds the Slottable\n among its direct children and renders the icon/spinner inside the child element. */}\n {pending ? <Spinner size=\"xs\" /> : icon}\n <Slottable>{children}</Slottable>\n </DropdownMenuPrimitive.Item>\n));\nDropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName;\n\nconst DropdownMenuCheckboxItem = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.CheckboxItem>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.CheckboxItem>\n>(({ className, children, checked, ...props }, ref) => (\n <DropdownMenuPrimitive.CheckboxItem\n ref={ref}\n className={cn(\n 'relative flex cursor-default select-none items-center rounded-xs py-1.5 pl-8 pr-2 text-sm outline-hidden transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50',\n className,\n )}\n checked={checked}\n {...props}\n >\n <span className=\"absolute left-2 flex h-3.5 w-3.5 items-center justify-center\">\n <DropdownMenuPrimitive.ItemIndicator>\n <Check className=\"h-4 w-4\" />\n </DropdownMenuPrimitive.ItemIndicator>\n </span>\n {children}\n </DropdownMenuPrimitive.CheckboxItem>\n));\nDropdownMenuCheckboxItem.displayName = DropdownMenuPrimitive.CheckboxItem.displayName;\n\nconst DropdownMenuRadioItem = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.RadioItem>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.RadioItem>\n>(({ className, children, ...props }, ref) => (\n <DropdownMenuPrimitive.RadioItem\n ref={ref}\n className={cn(\n 'relative flex cursor-default select-none items-center rounded-xs py-1.5 pl-8 pr-2 text-sm outline-hidden transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50',\n className,\n )}\n {...props}\n >\n <span className=\"absolute left-2 flex h-3.5 w-3.5 items-center justify-center\">\n <DropdownMenuPrimitive.ItemIndicator>\n <Circle className=\"h-2 w-2 fill-current\" />\n </DropdownMenuPrimitive.ItemIndicator>\n </span>\n {children}\n </DropdownMenuPrimitive.RadioItem>\n));\nDropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName;\n\nconst DropdownMenuLabel = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.Label>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Label> & {\n inset?: boolean;\n }\n>(({ className, inset, ...props }, ref) => (\n <DropdownMenuPrimitive.Label\n ref={ref}\n className={cn('px-2 py-1.5 text-sm font-semibold', inset && 'pl-8', className)}\n {...props}\n />\n));\nDropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName;\n\nconst DropdownMenuSeparator = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.Separator>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Separator>\n>(({ className, ...props }, ref) => (\n <DropdownMenuPrimitive.Separator\n ref={ref}\n className={cn('-mx-1 my-1 h-px bg-muted', className)}\n {...props}\n />\n));\nDropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName;\n\nconst DropdownMenuShortcut = ({ className, ...props }: React.HTMLAttributes<HTMLSpanElement>) => (\n <span className={cn('ml-auto text-xs tracking-widest opacity-60', className)} {...props} />\n);\nDropdownMenuShortcut.displayName = 'DropdownMenuShortcut';\n\nexport {\n DropdownMenu,\n DropdownMenuTrigger,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuCheckboxItem,\n DropdownMenuRadioItem,\n DropdownMenuLabel,\n DropdownMenuSeparator,\n DropdownMenuShortcut,\n DropdownMenuGroup,\n DropdownMenuPortal,\n DropdownMenuSub,\n DropdownMenuSubContent,\n DropdownMenuSubTrigger,\n DropdownMenuRadioGroup,\n};\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { CheckCircle2 } from
|
|
3
|
-
import { cn } from
|
|
2
|
+
import { CheckCircle2 } from 'lucide-react';
|
|
3
|
+
import { cn } from '../../lib/utils.js';
|
|
4
4
|
export function EndOfListIndicator({ message = "You've reached the end!", className, icon, }) {
|
|
5
|
-
return (_jsxs("div", { className: cn(
|
|
5
|
+
return (_jsxs("div", { className: cn('flex flex-col items-center gap-2 py-8 text-center text-muted-foreground', className), children: [icon ?? _jsx(CheckCircle2, { className: "h-6 w-6 text-[color:var(--success-icon)]" }), _jsx("p", { className: "text-sm", children: message })] }));
|
|
6
6
|
}
|
|
7
7
|
//# sourceMappingURL=end-of-list-indicator.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"end-of-list-indicator.js","sourceRoot":"","sources":["../../../src/react/components/end-of-list-indicator.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAC;AAQxC,MAAM,UAAU,kBAAkB,CAAC,EACjC,OAAO,GAAG,yBAAyB,EACnC,SAAS,EACT,IAAI,GACoB;IACxB,OAAO,CACL,eACE,SAAS,EAAE,EAAE,CACX,yEAAyE,EACzE,SAAS,CACV,aAEA,IAAI,IAAI,KAAC,YAAY,IAAC,SAAS,EAAC,0CAA0C,GAAG,EAC9E,YAAG,SAAS,EAAC,SAAS,YAAE,OAAO,GAAK,IAChC,CACP,CAAC;AACJ,CAAC","sourcesContent":["import * as React from
|
|
1
|
+
{"version":3,"file":"end-of-list-indicator.js","sourceRoot":"","sources":["../../../src/react/components/end-of-list-indicator.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAC;AAQxC,MAAM,UAAU,kBAAkB,CAAC,EACjC,OAAO,GAAG,yBAAyB,EACnC,SAAS,EACT,IAAI,GACoB;IACxB,OAAO,CACL,eACE,SAAS,EAAE,EAAE,CACX,yEAAyE,EACzE,SAAS,CACV,aAEA,IAAI,IAAI,KAAC,YAAY,IAAC,SAAS,EAAC,0CAA0C,GAAG,EAC9E,YAAG,SAAS,EAAC,SAAS,YAAE,OAAO,GAAK,IAChC,CACP,CAAC;AACJ,CAAC","sourcesContent":["import * as React from 'react';\nimport { CheckCircle2 } from 'lucide-react';\nimport { cn } from '../../lib/utils.js';\n\nexport interface EndOfListIndicatorProps {\n message?: string;\n className?: string;\n icon?: React.ReactNode;\n}\n\nexport function EndOfListIndicator({\n message = \"You've reached the end!\",\n className,\n icon,\n}: EndOfListIndicatorProps) {\n return (\n <div\n className={cn(\n 'flex flex-col items-center gap-2 py-8 text-center text-muted-foreground',\n className,\n )}\n >\n {icon ?? <CheckCircle2 className=\"h-6 w-6 text-[color:var(--success-icon)]\" />}\n <p className=\"text-sm\">{message}</p>\n </div>\n );\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import * as React from
|
|
2
|
-
import * as LabelPrimitive from
|
|
3
|
-
import { type ControllerProps, type FieldPath, type FieldValues } from
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import * as LabelPrimitive from '@radix-ui/react-label';
|
|
3
|
+
import { type ControllerProps, type FieldPath, type FieldValues } from 'react-hook-form';
|
|
4
4
|
declare const Form: <TFieldValues extends FieldValues, TContext = any, TTransformedValues = TFieldValues>({ children, watch, getValues, getFieldState, setError, clearErrors, setValue, setValues, trigger, formState, resetField, reset, handleSubmit, unregister, control, register, setFocus, subscribe, }: import("react-hook-form").FormProviderProps<TFieldValues, TContext, TTransformedValues>) => React.JSX.Element;
|
|
5
5
|
declare const FormField: <TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({ ...props }: ControllerProps<TFieldValues, TName>) => React.JSX.Element;
|
|
6
6
|
declare const useFormField: () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form.d.ts","sourceRoot":"","sources":["../../../src/react/components/form.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,
|
|
1
|
+
{"version":3,"file":"form.d.ts","sourceRoot":"","sources":["../../../src/react/components/form.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,cAAc,MAAM,uBAAuB,CAAC;AAExD,OAAO,EAIL,KAAK,eAAe,EACpB,KAAK,SAAS,EACd,KAAK,WAAW,EACjB,MAAM,iBAAiB,CAAC;AAKzB,QAAA,MAAM,IAAI,0YAAe,CAAC;AAW1B,QAAA,MAAM,SAAS,GACb,YAAY,SAAS,WAAW,GAAG,WAAW,EAC9C,KAAK,SAAS,SAAS,CAAC,YAAY,CAAC,GAAG,SAAS,CAAC,YAAY,CAAC,EAC/D,cAEC,eAAe,CAAC,YAAY,EAAE,KAAK,CAAC,sBAMtC,CAAC;AAEF,QAAA,MAAM,YAAY;;;;;;;;;;;CAqBjB,CAAC;AAQF,QAAA,MAAM,QAAQ,6GAUb,CAAC;AAGF,QAAA,MAAM,SAAS,yJAcb,CAAC;AAGH,QAAA,MAAM,WAAW,8JAef,CAAC;AAGH,QAAA,MAAM,eAAe,yHAcnB,CAAC;AAGH,QAAA,MAAM,WAAW,yHAmBf,CAAC;AAGH,OAAO,EACL,YAAY,EACZ,IAAI,EACJ,QAAQ,EACR,SAAS,EACT,WAAW,EACX,eAAe,EACf,WAAW,EACX,SAAS,GACV,CAAC"}
|