blimpui 0.0.25 → 0.0.27
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/$/components/primitives/calendar/calendar-month-grid.d.ts +1 -1
- package/dist/$/components/primitives/calendar/calendar-month-grid.d.ts.map +1 -1
- package/dist/$/components/primitives/calendar/calendar-month-grid.js +4 -4
- package/dist/$/components/primitives/calendar.d.ts.map +1 -1
- package/dist/$/components/primitives/calendar.js +5 -2
- package/dist/$/components/primitives/range-calendar/range-calendar.d.ts.map +1 -1
- package/dist/$/components/primitives/range-calendar/range-calendar.js +16 -11
- package/dist/$/components/ui/date-range-picker.js +1 -2
- package/dist/$/components/ui/datepicker.d.ts.map +1 -1
- package/dist/$/components/ui/datepicker.js +3 -2
- package/dist/$/components/ui/icon/index.d.ts +3 -0
- package/dist/$/components/ui/icon/index.d.ts.map +1 -0
- package/dist/$/components/ui/icon/index.js +14 -0
- package/dist/$/components/ui/icon/index.native.d.ts +2 -0
- package/dist/$/components/ui/icon/index.native.d.ts.map +1 -0
- package/dist/$/components/ui/icon/index.native.js +16 -0
- package/dist/$/components/ui/icon/types.d.ts +8 -0
- package/dist/$/components/ui/icon/types.d.ts.map +1 -0
- package/dist/$/components/ui/icon/types.js +1 -0
- package/dist/$/components/ui/picker.js +2 -3
- package/dist/$/components/ui/select/dialog-select.d.ts +27 -0
- package/dist/$/components/ui/select/dialog-select.d.ts.map +1 -0
- package/dist/$/components/ui/select/dialog-select.js +56 -0
- package/dist/$/components/ui/select/index.d.ts +6 -0
- package/dist/$/components/ui/select/index.d.ts.map +1 -0
- package/dist/$/components/ui/select/index.js +3 -0
- package/dist/$/components/ui/select/option-list.d.ts +15 -0
- package/dist/$/components/ui/select/option-list.d.ts.map +1 -0
- package/dist/$/components/ui/select/option-list.js +34 -0
- package/dist/$/components/ui/select/popover-select.d.ts +52 -0
- package/dist/$/components/ui/select/popover-select.d.ts.map +1 -0
- package/dist/$/components/ui/select/popover-select.js +55 -0
- package/dist/$/components/ui/select/select-field.d.ts +11 -0
- package/dist/$/components/ui/select/select-field.d.ts.map +1 -0
- package/dist/$/components/ui/select/select-field.js +70 -0
- package/dist/$/components/ui/select/select.d.ts +5 -0
- package/dist/$/components/ui/select/select.d.ts.map +1 -0
- package/dist/$/components/ui/select/select.js +42 -0
- package/dist/$/components/ui/select/sheet-select.d.ts +27 -0
- package/dist/$/components/ui/select/sheet-select.d.ts.map +1 -0
- package/dist/$/components/ui/select/sheet-select.js +70 -0
- package/dist/$/components/ui/select/types.d.ts +68 -0
- package/dist/$/components/ui/select/types.d.ts.map +1 -0
- package/dist/$/components/ui/select/types.js +1 -0
- package/dist/$/components/ui/table/MobileTable.d.ts.map +1 -1
- package/dist/$/components/ui/table/MobileTable.js +1 -1
- package/dist/$/components/ui/table/TableSkeleton.d.ts +6 -1
- package/dist/$/components/ui/table/TableSkeleton.d.ts.map +1 -1
- package/dist/$/components/ui/table/TableSkeleton.js +3 -2
- package/dist/$/components/ui/timepicker.d.ts.map +1 -1
- package/dist/$/components/ui/timepicker.js +3 -2
- package/package.json +71 -69
|
@@ -6,7 +6,7 @@ type CalendarMonthGridProps = {
|
|
|
6
6
|
disabled?: (date: Date) => boolean;
|
|
7
7
|
isDateUnavailable?: (date: Date) => boolean;
|
|
8
8
|
pickerOpen: boolean;
|
|
9
|
-
onSelectDay: (day: Date) => void;
|
|
9
|
+
onSelectDay: (day: Date, outside: boolean) => void;
|
|
10
10
|
};
|
|
11
11
|
declare function CalendarMonthGrid({ displayMonth, firstDayOfWeekIndex, selectedDate, today, disabled, isDateUnavailable, pickerOpen, onSelectDay, }: CalendarMonthGridProps): import("react/jsx-runtime").JSX.Element;
|
|
12
12
|
export { CalendarMonthGrid };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calendar-month-grid.d.ts","sourceRoot":"","sources":["../../../../../$/components/primitives/calendar/calendar-month-grid.tsx"],"names":[],"mappings":"AAOA,KAAK,sBAAsB,GAAG;IAC7B,YAAY,EAAE,IAAI,CAAC;IACnB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,YAAY,CAAC,EAAE,IAAI,CAAC;IACpB,KAAK,EAAE,IAAI,CAAC;IACZ,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,OAAO,CAAC;IACnC,iBAAiB,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,OAAO,CAAC;IAC5C,UAAU,EAAE,OAAO,CAAC;IACpB,WAAW,EAAE,CAAC,GAAG,EAAE,IAAI,KAAK,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"calendar-month-grid.d.ts","sourceRoot":"","sources":["../../../../../$/components/primitives/calendar/calendar-month-grid.tsx"],"names":[],"mappings":"AAOA,KAAK,sBAAsB,GAAG;IAC7B,YAAY,EAAE,IAAI,CAAC;IACnB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,YAAY,CAAC,EAAE,IAAI,CAAC;IACpB,KAAK,EAAE,IAAI,CAAC;IACZ,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,OAAO,CAAC;IACnC,iBAAiB,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,OAAO,CAAC;IAC5C,UAAU,EAAE,OAAO,CAAC;IACpB,WAAW,EAAE,CAAC,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;CACnD,CAAC;AAEF,iBAAS,iBAAiB,CAAC,EAC1B,YAAY,EACZ,mBAAmB,EACnB,YAAY,EACZ,KAAK,EACL,QAAQ,EACR,iBAAiB,EACjB,UAAU,EACV,WAAW,GACX,EAAE,sBAAsB,2CA8DxB;AAED,OAAO,EAAE,iBAAiB,EAAE,CAAC;AAC7B,YAAY,EAAE,sBAAsB,EAAE,CAAC"}
|
|
@@ -9,21 +9,21 @@ function CalendarMonthGrid(_a) {
|
|
|
9
9
|
var grid = React.useMemo(function () { return buildMonthGrid(displayMonth, firstDayOfWeekIndex); }, [displayMonth, firstDayOfWeekIndex]);
|
|
10
10
|
return (_jsx(View, { className: "mt-2", children: grid.map(function (week, weekIndex) { return (_jsx(View, { className: "flex-row", children: week.map(function (day, dayIndex) {
|
|
11
11
|
var outside = !isSameMonth(day, displayMonth);
|
|
12
|
-
var dayDisabled =
|
|
12
|
+
var dayDisabled = Boolean(disabled === null || disabled === void 0 ? void 0 : disabled(day));
|
|
13
13
|
var unavailable = !outside && Boolean(isDateUnavailable === null || isDateUnavailable === void 0 ? void 0 : isDateUnavailable(day));
|
|
14
14
|
var selected = selectedDate
|
|
15
15
|
? isSameDay(day, selectedDate)
|
|
16
16
|
: false;
|
|
17
17
|
var isToday = isSameDay(day, today);
|
|
18
|
-
return (_jsx(View, { className: "flex-1 items-center justify-center py-1", children: _jsx(Pressable, { disabled: dayDisabled || pickerOpen, onPress: function () {
|
|
18
|
+
return (_jsx(View, { className: "flex-1 items-center justify-center py-1", children: _jsx(Pressable, { disabled: dayDisabled || pickerOpen || unavailable, onPress: function () {
|
|
19
19
|
if (unavailable)
|
|
20
20
|
return;
|
|
21
|
-
onSelectDay(day);
|
|
21
|
+
onSelectDay(day, outside);
|
|
22
22
|
}, accessibilityState: {
|
|
23
23
|
disabled: dayDisabled || unavailable,
|
|
24
24
|
}, className: cn("h-8 w-8 items-center justify-center rounded-full", selected && "bg-primary", !selected &&
|
|
25
25
|
isToday &&
|
|
26
|
-
"border-primary bg-primary/10 border", dayDisabled && "opacity-40"), children: _jsx(Text, { className: cn("text-base", selected && "text-primary-foreground", !selected && unavailable && "text-destructive", !selected && outside && "text-muted-foreground", !selected && !outside && "text-foreground"), selectable: false, children: day.getDate() }) }) }, "day-".concat(dayIndex)));
|
|
26
|
+
"border-primary bg-primary/10 border", (outside || dayDisabled) && "opacity-40"), children: _jsx(Text, { className: cn("text-base", selected && "text-primary-foreground", !selected && unavailable && "text-destructive", !selected && outside && "text-muted-foreground", !selected && !outside && "text-foreground"), selectable: false, children: day.getDate() }) }) }, "day-".concat(dayIndex)));
|
|
27
27
|
}) }, "week-".concat(weekIndex))); }) }));
|
|
28
28
|
}
|
|
29
29
|
export { CalendarMonthGrid };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calendar.d.ts","sourceRoot":"","sources":["../../../../$/components/primitives/calendar.tsx"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wCAAwC,CAAC;AAE5E,YAAY,EAAE,aAAa,EAAE,CAAC;AAE9B,iBAAS,QAAQ,CAAC,EACjB,KAAK,EACL,YAAY,EACZ,aAAa,EACb,KAAK,EACL,YAAY,EACZ,aAAa,EACb,QAAQ,EACR,MAAM,EACN,aAAa,EACb,cAAc,EACd,YAAY,EACZ,QAAQ,EACR,iBAAiB,EACjB,SAAS,EACT,iCAAiC,GACjC,EAAE,aAAa,
|
|
1
|
+
{"version":3,"file":"calendar.d.ts","sourceRoot":"","sources":["../../../../$/components/primitives/calendar.tsx"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wCAAwC,CAAC;AAE5E,YAAY,EAAE,aAAa,EAAE,CAAC;AAE9B,iBAAS,QAAQ,CAAC,EACjB,KAAK,EACL,YAAY,EACZ,aAAa,EACb,KAAK,EACL,YAAY,EACZ,aAAa,EACb,QAAQ,EACR,MAAM,EACN,aAAa,EACb,cAAc,EACd,YAAY,EACZ,QAAQ,EACR,iBAAiB,EACjB,SAAS,EACT,iCAAiC,GACjC,EAAE,aAAa,2CAyHf;AAED,OAAO,EAAE,QAAQ,EAAE,CAAC"}
|
|
@@ -36,13 +36,16 @@ function Calendar(_a) {
|
|
|
36
36
|
}), displayMonth = _c.displayMonth, setDisplayMonth = _c.setDisplayMonth, locale = _c.locale, firstDayOfWeekIndex = _c.firstDayOfWeekIndex, safeVisibleMonths = _c.safeVisibleMonths, pageStep = _c.pageStep, monthsToRender = _c.monthsToRender, years = _c.years, months = _c.months, canGoPrev = _c.canGoPrev, canGoNext = _c.canGoNext, pickerOpen = _c.pickerOpen, setPickerOpen = _c.setPickerOpen, onMonthWheel = _c.onMonthWheel, onYearWheel = _c.onYearWheel;
|
|
37
37
|
var headerMonthIndex = displayMonth.getMonth();
|
|
38
38
|
var headerYear = displayMonth.getFullYear();
|
|
39
|
-
var onSelectDay = React.useCallback(function (day) {
|
|
39
|
+
var onSelectDay = React.useCallback(function (day, outside) {
|
|
40
40
|
if (disabled === null || disabled === void 0 ? void 0 : disabled(day))
|
|
41
41
|
return;
|
|
42
42
|
if (isDateUnavailable === null || isDateUnavailable === void 0 ? void 0 : isDateUnavailable(day))
|
|
43
43
|
return;
|
|
44
|
+
if (outside) {
|
|
45
|
+
setDisplayMonth(startOfMonth(day));
|
|
46
|
+
}
|
|
44
47
|
setSelectedDate(day);
|
|
45
|
-
}, [disabled, isDateUnavailable, setSelectedDate]);
|
|
48
|
+
}, [disabled, isDateUnavailable, setDisplayMonth, setSelectedDate]);
|
|
46
49
|
return (_jsxs(View, { className: cn("bg-card border-border rounded-xl border p-4 shadow-sm shadow-black/5", className), children: [_jsx(CalendarHeader, { displayMonth: displayMonth, pickerOpen: pickerOpen, onTogglePicker: function () { return setPickerOpen(function (o) { return !o; }); }, canGoPrev: canGoPrev, canGoNext: canGoNext, onPrev: function () { return setDisplayMonth(addMonths(displayMonth, -pageStep)); }, onNext: function () { return setDisplayMonth(addMonths(displayMonth, pageStep)); } }), _jsxs(View, { className: "mt-3 relative", children: [_jsx(View, { className: cn(safeVisibleMonths > 1 && "flex-row gap-4"), children: monthsToRender.map(function (m) { return (_jsxs(View, { className: cn(safeVisibleMonths > 1 && "flex-1"), children: [safeVisibleMonths > 1 && (_jsxs(Text, { variant: "small", className: "mb-1 text-center font-semibold", children: [MONTHS[m.getMonth()], " ", m.getFullYear()] })), _jsx(CalendarWeekdaysRow, { firstDayOfWeekIndex: firstDayOfWeekIndex, locale: locale }), _jsx(CalendarMonthGrid, { displayMonth: m, firstDayOfWeekIndex: firstDayOfWeekIndex, selectedDate: selectedDate, today: today, disabled: disabled, isDateUnavailable: isDateUnavailable, pickerOpen: pickerOpen, onSelectDay: onSelectDay })] }, "".concat(m.getFullYear(), "-").concat(m.getMonth()))); }) }), _jsx(MonthYearOverlay, { open: pickerOpen, months: months, years: years, monthIndex: headerMonthIndex, year: headerYear, onMonthChange: onMonthWheel, onYearChange: onYearWheel, monthYearPickerContainerClassName: monthYearPickerContainerClassName })] })] }));
|
|
47
50
|
}
|
|
48
51
|
export { Calendar };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"range-calendar.d.ts","sourceRoot":"","sources":["../../../../../$/components/primitives/range-calendar/range-calendar.tsx"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EACX,cAAc,EACd,YAAY,EACZ,MAAM,wCAAwC,CAAC;AAEhD,MAAM,MAAM,SAAS,GAAG;IACvB,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,EAAE,CAAC,EAAE,IAAI,CAAC;CACV,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAChC,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,YAAY,CAAC,EAAE,SAAS,CAAC;IACzB,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,SAAS,GAAG,SAAS,KAAK,IAAI,CAAC;IACvD,KAAK,CAAC,EAAE,IAAI,CAAC;IACb,YAAY,CAAC,EAAE,IAAI,CAAC;IACpB,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,IAAI,KAAK,IAAI,CAAC;IACtC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,aAAa,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAC1B,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,OAAO,CAAC;IACnC,iBAAiB,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,OAAO,CAAC;IAC5C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,iCAAiC,CAAC,EAAE,MAAM,CAAC;CAC3C,CAAC;
|
|
1
|
+
{"version":3,"file":"range-calendar.d.ts","sourceRoot":"","sources":["../../../../../$/components/primitives/range-calendar/range-calendar.tsx"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EACX,cAAc,EACd,YAAY,EACZ,MAAM,wCAAwC,CAAC;AAEhD,MAAM,MAAM,SAAS,GAAG;IACvB,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,EAAE,CAAC,EAAE,IAAI,CAAC;CACV,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAChC,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,YAAY,CAAC,EAAE,SAAS,CAAC;IACzB,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,SAAS,GAAG,SAAS,KAAK,IAAI,CAAC;IACvD,KAAK,CAAC,EAAE,IAAI,CAAC;IACb,YAAY,CAAC,EAAE,IAAI,CAAC;IACpB,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,IAAI,KAAK,IAAI,CAAC;IACtC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,aAAa,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAC1B,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,OAAO,CAAC;IACnC,iBAAiB,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,OAAO,CAAC;IAC5C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,iCAAiC,CAAC,EAAE,MAAM,CAAC;CAC3C,CAAC;AA8JF,iBAAS,aAAa,CAAC,EACtB,KAAK,EACL,YAAY,EACZ,aAAa,EACb,KAAK,EACL,YAAY,EACZ,aAAa,EACb,QAAQ,EACR,MAAM,EACN,aAAa,EACb,cAAc,EACd,YAAY,EACZ,QAAQ,EACR,iBAAiB,EACjB,SAAS,EACT,iCAAiC,GACjC,EAAE,kBAAkB,2CAmMpB;AAED,OAAO,EAAE,aAAa,EAAE,CAAC"}
|
|
@@ -37,32 +37,28 @@ function RangeCalendarMonthGrid(_a) {
|
|
|
37
37
|
}, [selectedRange, previewRange]), from = _b.from, to = _b.to;
|
|
38
38
|
return (_jsx(View, { className: "mt-2", children: grid.map(function (week, weekIndex) { return (_jsx(View, { className: "flex-row", children: week.map(function (day, dayIndex) {
|
|
39
39
|
var outside = !isSameMonth(day, displayMonth);
|
|
40
|
-
var dayDisabled =
|
|
40
|
+
var dayDisabled = Boolean(disabled === null || disabled === void 0 ? void 0 : disabled(day));
|
|
41
41
|
var unavailable = !outside && Boolean(isDateUnavailable === null || isDateUnavailable === void 0 ? void 0 : isDateUnavailable(day));
|
|
42
42
|
var isToday = !outside && isSameDay(day, today);
|
|
43
|
-
var isStart = Boolean(from &&
|
|
44
|
-
var isEnd = Boolean(to &&
|
|
43
|
+
var isStart = Boolean(from && isSameDay(day, from));
|
|
44
|
+
var isEnd = Boolean(to && isSameDay(day, to));
|
|
45
45
|
var hasFullRange = Boolean(from && to);
|
|
46
|
-
var inRange = hasFullRange &&
|
|
47
|
-
!outside &&
|
|
48
|
-
isInInclusiveRange(day, from, to);
|
|
46
|
+
var inRange = hasFullRange && isInInclusiveRange(day, from, to);
|
|
49
47
|
var endpointSelected = isStart || isEnd;
|
|
50
48
|
var prevDay = week[dayIndex - 1];
|
|
51
49
|
var nextDay = week[dayIndex + 1];
|
|
52
50
|
var prevInRange = inRange &&
|
|
53
51
|
prevDay &&
|
|
54
|
-
isSameMonth(prevDay, displayMonth) &&
|
|
55
52
|
isInInclusiveRange(prevDay, from, to);
|
|
56
53
|
var nextInRange = inRange &&
|
|
57
54
|
nextDay &&
|
|
58
|
-
isSameMonth(nextDay, displayMonth) &&
|
|
59
55
|
isInInclusiveRange(nextDay, from, to);
|
|
60
56
|
var segmentStart = inRange && !prevInRange;
|
|
61
57
|
var segmentEnd = inRange && !nextInRange;
|
|
62
58
|
return (_jsx(View, { className: "flex-1 items-center justify-center py-1", children: _jsxs(View, { className: "relative h-8 w-full items-center justify-center", children: [_jsx(View, { pointerEvents: "none", className: cn("absolute inset-y-0 left-0 right-0", inRange && "bg-primary/10", segmentStart && "rounded-l-full", segmentEnd && "rounded-r-full") }), _jsx(Pressable, { disabled: dayDisabled || pickerOpen, onPress: function () {
|
|
63
59
|
if (unavailable)
|
|
64
60
|
return;
|
|
65
|
-
onSelectDay(day);
|
|
61
|
+
onSelectDay(day, outside);
|
|
66
62
|
}, onHoverIn: function () {
|
|
67
63
|
if (pickerOpen)
|
|
68
64
|
return;
|
|
@@ -126,7 +122,7 @@ function RangeCalendar(_a) {
|
|
|
126
122
|
}), displayMonth = _d.displayMonth, setDisplayMonth = _d.setDisplayMonth, locale = _d.locale, firstDayOfWeekIndex = _d.firstDayOfWeekIndex, safeVisibleMonths = _d.safeVisibleMonths, pageStep = _d.pageStep, monthsToRender = _d.monthsToRender, years = _d.years, months = _d.months, canGoPrev = _d.canGoPrev, canGoNext = _d.canGoNext, pickerOpen = _d.pickerOpen, setPickerOpen = _d.setPickerOpen, onMonthWheel = _d.onMonthWheel, onYearWheel = _d.onYearWheel;
|
|
127
123
|
var headerMonthIndex = displayMonth.getMonth();
|
|
128
124
|
var headerYear = displayMonth.getFullYear();
|
|
129
|
-
var onSelectDay = React.useCallback(function (day) {
|
|
125
|
+
var onSelectDay = React.useCallback(function (day, outside) {
|
|
130
126
|
if (disabled === null || disabled === void 0 ? void 0 : disabled(day))
|
|
131
127
|
return;
|
|
132
128
|
if (isDateUnavailable === null || isDateUnavailable === void 0 ? void 0 : isDateUnavailable(day))
|
|
@@ -136,6 +132,9 @@ function RangeCalendar(_a) {
|
|
|
136
132
|
hoverClearTimeoutRef.current = null;
|
|
137
133
|
}
|
|
138
134
|
setHoveredDay(undefined);
|
|
135
|
+
if (outside) {
|
|
136
|
+
setDisplayMonth(startOfMonth(day));
|
|
137
|
+
}
|
|
139
138
|
var nextDay = startOfDay(day);
|
|
140
139
|
var current = normalizeRange(selectedRangeRaw);
|
|
141
140
|
// Start a new range
|
|
@@ -150,7 +149,13 @@ function RangeCalendar(_a) {
|
|
|
150
149
|
return;
|
|
151
150
|
}
|
|
152
151
|
setSelectedRangeRaw({ from: fromDay, to: nextDay });
|
|
153
|
-
}, [
|
|
152
|
+
}, [
|
|
153
|
+
disabled,
|
|
154
|
+
isDateUnavailable,
|
|
155
|
+
selectedRangeRaw,
|
|
156
|
+
setDisplayMonth,
|
|
157
|
+
setSelectedRangeRaw,
|
|
158
|
+
]);
|
|
154
159
|
var onHoverDay = React.useCallback(function (day) {
|
|
155
160
|
if (hoverClearTimeoutRef.current) {
|
|
156
161
|
clearTimeout(hoverClearTimeoutRef.current);
|
|
@@ -28,7 +28,6 @@ import { FormField } from "./form-field";
|
|
|
28
28
|
import { Icon } from "./icon";
|
|
29
29
|
import { Text } from "./text";
|
|
30
30
|
import { Popover } from "./popover";
|
|
31
|
-
import { Calendar as CalendarIcon } from "lucide-react-native";
|
|
32
31
|
import * as React from "react";
|
|
33
32
|
import { Pressable, useWindowDimensions, View } from "react-native";
|
|
34
33
|
var buildDefaultRangeFormatter = function (locale, formatOptions) {
|
|
@@ -82,7 +81,7 @@ function DateRangePicker(_a) {
|
|
|
82
81
|
var resolvedPopoverContentClassName = cn("border-none bg-transparent p-0 shadow-none", popoverContentProps === null || popoverContentProps === void 0 ? void 0 : popoverContentProps.className);
|
|
83
82
|
return (_jsxs(_Fragment, { children: [_jsx(Popover, { onOpenChange: handleOpenChange, content: _jsx(RangeCalendar, __assign({ value: selectedRange, onValueChange: handleRangeChange }, rangeCalendarProps)), contentProps: __assign(__assign({}, popoverContentProps), { className: resolvedPopoverContentClassName, sideOffset: (_b = popoverContentProps === null || popoverContentProps === void 0 ? void 0 : popoverContentProps.sideOffset) !== null && _b !== void 0 ? _b : 8 }), triggerRef: popoverRef, type: isSmallerScreen ? "floating-sheet" : "popover" }), _jsxs(Pressable, { className: "flex-row items-center justify-between gap-2 py-1.5", disabled: formFieldProps.disabled, accessibilityState: {
|
|
84
83
|
disabled: formFieldProps.disabled,
|
|
85
|
-
}, onPress: function () { var _a; return (_a = popoverRef.current) === null || _a === void 0 ? void 0 : _a.open(); }, children: [_jsx(View, { className: "flex-1", children: _jsx(Text, { className: cn("text-base", displayValue ? "text-foreground" : "text-muted-foreground"), numberOfLines: 1, ellipsizeMode: "tail", children: textToShow }) }), _jsx(Icon, {
|
|
84
|
+
}, onPress: function () { var _a; return (_a = popoverRef.current) === null || _a === void 0 ? void 0 : _a.open(); }, children: [_jsx(View, { className: "flex-1", children: _jsx(Text, { className: cn("text-base", displayValue ? "text-foreground" : "text-muted-foreground"), numberOfLines: 1, ellipsizeMode: "tail", children: textToShow }) }), _jsx(Icon, { name: "solar:calendar-outline", className: cn("size-5 text-muted-foreground", isFocused && !hasError && !hasSuccess && "text-foreground", hasError && "text-destructive", hasSuccess && "text-primary", iconClassName) })] })] }));
|
|
86
85
|
} })));
|
|
87
86
|
}
|
|
88
87
|
DateRangePicker.displayName = "DateRangePicker";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"datepicker.d.ts","sourceRoot":"","sources":["../../../../$/components/ui/datepicker.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAY,KAAK,aAAa,EAAE,MAAM,YAAY,CAAC;AAC1D,OAAO,EAAa,KAAK,cAAc,EAAE,MAAM,cAAc,CAAC;AAG9D,OAAO,EAAW,cAAc,EAAkB,MAAM,WAAW,CAAC;AAGpE,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,KAAK,eAAe,GAAG,IAAI,CAC1B,cAAc,EACZ,UAAU,GACV,OAAO,GACP,cAAc,GACd,eAAe,GACf,SAAS,GACT,QAAQ,GACR,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tB,YAAY,EAAE,eAAe,EAAE,CAAC"}
|
|
@@ -28,7 +28,6 @@ import { FormField } from "./form-field";
|
|
|
28
28
|
import { Icon } from "./icon";
|
|
29
29
|
import { Text } from "./text";
|
|
30
30
|
import { Popover } from "./popover";
|
|
31
|
-
import { Calendar as CalendarIcon } from "lucide-react-native";
|
|
32
31
|
import * as React from "react";
|
|
33
32
|
import { Pressable, useWindowDimensions, View } from "react-native";
|
|
34
33
|
var buildDefaultFormatter = function (locale, formatOptions) {
|
|
@@ -75,7 +74,9 @@ function DatePicker(_a) {
|
|
|
75
74
|
}, onPress: function () {
|
|
76
75
|
var _a;
|
|
77
76
|
(_a = popoverRef.current) === null || _a === void 0 ? void 0 : _a.open();
|
|
78
|
-
}, children: [_jsx(View, { className: "flex-1", children: _jsx(Text, { className: cn("text-base", displayValue
|
|
77
|
+
}, children: [_jsx(View, { className: "flex-1", children: _jsx(Text, { className: cn("text-base", displayValue
|
|
78
|
+
? "text-foreground"
|
|
79
|
+
: "text-muted-foreground"), numberOfLines: 1, ellipsizeMode: "tail", children: textToShow }) }), _jsx(Icon, { name: "solar:calendar-outline", className: cn("size-5 text-muted-foreground", isFocused && !hasError && !hasSuccess && "text-foreground", hasError && "text-destructive", hasSuccess && "text-primary", iconClassName) })] }) }));
|
|
79
80
|
} })) }));
|
|
80
81
|
}
|
|
81
82
|
DatePicker.displayName = "DatePicker";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../$/components/ui/icon/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEvC,eAAO,MAAM,IAAI,GAAI,OAAO,YAAY,4CAOvC,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
import { Icon as DefaultIcon } from "@iconify/react";
|
|
14
|
+
export var Icon = function (props) { return (_jsx(DefaultIcon, __assign({}, props, { width: props.size, height: props.size, icon: props.name }))); };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.native.d.ts","sourceRoot":"","sources":["../../../../../$/components/ui/icon/index.native.tsx"],"names":[],"mappings":"AAIA,eAAO,MAAM,IAAI,GAAI,OAAO,GAAG,4CAAgC,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
import { IconifyIcon } from "@huymobile/react-native-iconify";
|
|
14
|
+
import { withUniwind } from "uniwind";
|
|
15
|
+
var IconifyLocal = withUniwind(IconifyIcon);
|
|
16
|
+
export var Icon = function (props) { return _jsx(IconifyLocal, __assign({}, props)); };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../$/components/ui/icon/types.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,YAAY;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,CAAC;CACxB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -28,7 +28,6 @@ import { FormField } from "./form-field";
|
|
|
28
28
|
import { Icon } from "./icon";
|
|
29
29
|
import { Text } from "./text";
|
|
30
30
|
import { Popover } from "./popover";
|
|
31
|
-
import { ChevronDown } from "lucide-react-native";
|
|
32
31
|
import * as React from "react";
|
|
33
32
|
import { Pressable, useWindowDimensions, View } from "react-native";
|
|
34
33
|
function Picker(_a) {
|
|
@@ -49,7 +48,7 @@ function Picker(_a) {
|
|
|
49
48
|
var isSmallerScreen = dimensions.width < 640;
|
|
50
49
|
var selectedOption = selectedValue !== undefined ? optionsMap.get(selectedValue) : undefined;
|
|
51
50
|
var displayLabel = selectedOption
|
|
52
|
-
? (_b = formatOptionLabel === null || formatOptionLabel === void 0 ? void 0 : formatOptionLabel(selectedOption)) !== null && _b !== void 0 ? _b : selectedOption.label
|
|
51
|
+
? ((_b = formatOptionLabel === null || formatOptionLabel === void 0 ? void 0 : formatOptionLabel(selectedOption)) !== null && _b !== void 0 ? _b : selectedOption.label)
|
|
53
52
|
: "";
|
|
54
53
|
var textToShow = displayLabel || placeholder;
|
|
55
54
|
var resolvedPopoverContentClassName = cn("border-none bg-transparent p-0 shadow-none", popoverContentProps === null || popoverContentProps === void 0 ? void 0 : popoverContentProps.className);
|
|
@@ -78,7 +77,7 @@ function Picker(_a) {
|
|
|
78
77
|
(_a = popoverRef.current) === null || _a === void 0 ? void 0 : _a.open();
|
|
79
78
|
}, children: [_jsx(View, { className: "flex-1", children: _jsx(Text, { className: cn("text-base", displayLabel
|
|
80
79
|
? "text-foreground"
|
|
81
|
-
: "text-muted-foreground"), numberOfLines: 1, ellipsizeMode: "tail", children: textToShow }) }), _jsx(Icon, {
|
|
80
|
+
: "text-muted-foreground"), numberOfLines: 1, ellipsizeMode: "tail", children: textToShow }) }), _jsx(Icon, { name: "icon-park-outline:down", className: cn("size-5 text-muted-foreground", isFocused &&
|
|
82
81
|
!hasError &&
|
|
83
82
|
!hasSuccess &&
|
|
84
83
|
"text-foreground", hasError && "text-destructive", hasSuccess && "text-primary", iconClassName) })] }) }));
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { DialogContent } from "../../primitives/dialog";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import type { SelectClassNames, SelectOption, SelectTriggerBaseProps, TriggerRef } from "./types";
|
|
4
|
+
type DialogSelectProps = {
|
|
5
|
+
options: SelectOption[];
|
|
6
|
+
value?: string;
|
|
7
|
+
defaultValue?: string;
|
|
8
|
+
placeholder?: string;
|
|
9
|
+
renderOption?: (option: SelectOption, state: {
|
|
10
|
+
isSelected: boolean;
|
|
11
|
+
isDisabled: boolean;
|
|
12
|
+
}) => React.ReactNode;
|
|
13
|
+
classNames?: SelectClassNames;
|
|
14
|
+
dialogTitle?: string;
|
|
15
|
+
dialogContentProps?: React.ComponentPropsWithoutRef<typeof DialogContent>;
|
|
16
|
+
triggerProps?: SelectTriggerBaseProps & {
|
|
17
|
+
size?: "default" | "sm";
|
|
18
|
+
};
|
|
19
|
+
onValueChange?: (value: string | undefined, option?: SelectOption) => void;
|
|
20
|
+
onOpenChange?: (open: boolean) => void;
|
|
21
|
+
disabled?: boolean;
|
|
22
|
+
className?: string;
|
|
23
|
+
};
|
|
24
|
+
declare const DialogSelect: React.ForwardRefExoticComponent<DialogSelectProps & React.RefAttributes<TriggerRef>>;
|
|
25
|
+
export { DialogSelect };
|
|
26
|
+
export type { DialogSelectProps };
|
|
27
|
+
//# sourceMappingURL=dialog-select.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dialog-select.d.ts","sourceRoot":"","sources":["../../../../../$/components/ui/select/dialog-select.tsx"],"names":[],"mappings":"AAEA,OAAO,EAEN,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3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import { Icon } from "../../../../$/components/primitives/icon";
|
|
14
|
+
import { cn } from "../../../../$/lib/utils";
|
|
15
|
+
import { Dialog, DialogContent, DialogHeader, DialogTitle, } from "../../primitives/dialog";
|
|
16
|
+
import { ChevronDown } from "lucide-react-native";
|
|
17
|
+
import * as React from "react";
|
|
18
|
+
import { Platform, Pressable, ScrollView, Text, View } from "react-native";
|
|
19
|
+
import { StandaloneOptionList } from "./option-list";
|
|
20
|
+
var DialogSelect = React.forwardRef(function (props, ref) {
|
|
21
|
+
var options = props.options, value = props.value, defaultValue = props.defaultValue, _a = props.placeholder, placeholder = _a === void 0 ? "Select an option" : _a, renderOption = props.renderOption, classNames = props.classNames, dialogTitle = props.dialogTitle, dialogContentProps = props.dialogContentProps, triggerProps = props.triggerProps, onValueChange = props.onValueChange, onOpenChange = props.onOpenChange, disabled = props.disabled, className = props.className;
|
|
22
|
+
var _b = React.useState(defaultValue !== null && defaultValue !== void 0 ? defaultValue : ""), internalValue = _b[0], setInternalValue = _b[1];
|
|
23
|
+
var resolvedValue = value !== undefined ? value : internalValue;
|
|
24
|
+
var _c = React.useState(false), open = _c[0], setOpen = _c[1];
|
|
25
|
+
var handleOpenChange = React.useCallback(function (next) {
|
|
26
|
+
setOpen(next);
|
|
27
|
+
onOpenChange === null || onOpenChange === void 0 ? void 0 : onOpenChange(next);
|
|
28
|
+
}, [onOpenChange]);
|
|
29
|
+
React.useImperativeHandle(ref, function () {
|
|
30
|
+
return ({
|
|
31
|
+
open: function () { return handleOpenChange(true); },
|
|
32
|
+
close: function () { return handleOpenChange(false); },
|
|
33
|
+
focus: function () { return handleOpenChange(true); },
|
|
34
|
+
blur: function () { return handleOpenChange(false); },
|
|
35
|
+
});
|
|
36
|
+
}, [handleOpenChange]);
|
|
37
|
+
var handleSelect = React.useCallback(function (option) {
|
|
38
|
+
if (value === undefined) {
|
|
39
|
+
setInternalValue(option.value);
|
|
40
|
+
}
|
|
41
|
+
onValueChange === null || onValueChange === void 0 ? void 0 : onValueChange(option.value, option);
|
|
42
|
+
handleOpenChange(false);
|
|
43
|
+
}, [value, onValueChange, handleOpenChange]);
|
|
44
|
+
var displayLabel = React.useMemo(function () {
|
|
45
|
+
var _a;
|
|
46
|
+
if (!resolvedValue)
|
|
47
|
+
return null;
|
|
48
|
+
var match = options.find(function (o) { return o.value === resolvedValue; });
|
|
49
|
+
return (_a = match === null || match === void 0 ? void 0 : match.label) !== null && _a !== void 0 ? _a : resolvedValue;
|
|
50
|
+
}, [resolvedValue, options]);
|
|
51
|
+
return (_jsxs(View, { className: cn("w-full", className), children: [_jsxs(Pressable, __assign({ onPress: function () { return !disabled && handleOpenChange(true); }, disabled: disabled, className: cn("bg-background flex h-10 flex-row items-center justify-between gap-2 rounded-md w-full sm:h-9", "border-none bg-transparent", (triggerProps === null || triggerProps === void 0 ? void 0 : triggerProps.size) === "sm" && "h-8", disabled && "opacity-50", triggerProps === null || triggerProps === void 0 ? void 0 : triggerProps.className, classNames === null || classNames === void 0 ? void 0 : classNames.trigger) }, (Platform.OS === "web"
|
|
52
|
+
? { role: "combobox", "aria-expanded": open }
|
|
53
|
+
: {}), { children: [_jsx(Text, { className: cn("text-sm flex-1", displayLabel ? "text-foreground" : "text-muted-foreground", classNames === null || classNames === void 0 ? void 0 : classNames.value), numberOfLines: 1, children: displayLabel !== null && displayLabel !== void 0 ? displayLabel : placeholder }), _jsx(Icon, { as: ChevronDown, className: "text-muted-foreground size-4" })] })), _jsx(Dialog, { open: open, onOpenChange: handleOpenChange, children: _jsxs(DialogContent, __assign({}, dialogContentProps, { className: cn("p-0 overflow-hidden", dialogContentProps === null || dialogContentProps === void 0 ? void 0 : dialogContentProps.className, classNames === null || classNames === void 0 ? void 0 : classNames.content), children: [dialogTitle && (_jsx(DialogHeader, { className: "px-4 pt-4 pb-2", children: _jsx(DialogTitle, { children: dialogTitle }) })), _jsx(ScrollView, { className: cn("max-h-80 p-1", classNames === null || classNames === void 0 ? void 0 : classNames.optionList), children: _jsx(StandaloneOptionList, { options: options, selectedValue: resolvedValue, onSelect: handleSelect, renderOption: renderOption, classNames: classNames }) })] })) })] }));
|
|
54
|
+
});
|
|
55
|
+
DialogSelect.displayName = "DialogSelect";
|
|
56
|
+
export { DialogSelect };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { Select as SelectBase } from "./select";
|
|
2
|
+
export { SelectField as Select } from "./select-field";
|
|
3
|
+
export { NativeSelectScrollView, SelectContent, SelectTrigger, SelectValue, } from "../../primitives/select";
|
|
4
|
+
export type { OptionRenderState, SelectClassNames, SelectOption, SelectProps, SelectType, } from "./types";
|
|
5
|
+
export type { SelectFieldProps } from "./select-field";
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../$/components/ui/select/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,UAAU,CAAC;AAChD,OAAO,EAAE,WAAW,IAAI,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,EACN,sBAAsB,EACtB,aAAa,EACb,aAAa,EACb,WAAW,GACX,MAAM,yBAAyB,CAAC;AACjC,YAAY,EACX,iBAAiB,EACjB,gBAAgB,EAChB,YAAY,EACZ,WAAW,EACX,UAAU,GACV,MAAM,SAAS,CAAC;AACjB,YAAY,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { SelectClassNames, SelectOption, OptionRenderState } from "./types";
|
|
3
|
+
export declare const PrimitiveOptionList: ({ options, renderOption, classNames, }: {
|
|
4
|
+
options: SelectOption[];
|
|
5
|
+
renderOption?: (option: SelectOption, state: OptionRenderState) => React.ReactNode;
|
|
6
|
+
classNames?: SelectClassNames;
|
|
7
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export declare const StandaloneOptionList: ({ options, selectedValue, onSelect, renderOption, classNames, }: {
|
|
9
|
+
options: SelectOption[];
|
|
10
|
+
selectedValue?: string;
|
|
11
|
+
onSelect: (option: SelectOption) => void;
|
|
12
|
+
renderOption?: (option: SelectOption, state: OptionRenderState) => React.ReactNode;
|
|
13
|
+
classNames?: SelectClassNames;
|
|
14
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
//# sourceMappingURL=option-list.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"option-list.d.ts","sourceRoot":"","sources":["../../../../../$/components/ui/select/option-list.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,gBAAgB,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAGjF,eAAO,MAAM,mBAAmB,GAAI,wCAIjC;IACF,OAAO,EAAE,YAAY,EAAE,CAAC;IACxB,YAAY,CAAC,EAAE,CACd,MAAM,EAAE,YAAY,EACpB,KAAK,EAAE,iBAAiB,KACpB,KAAK,CAAC,SAAS,CAAC;IACrB,UAAU,CAAC,EAAE,gBAAgB,CAAC;CAC9B,4CAyDA,CAAC;AAGF,eAAO,MAAM,oBAAoB,GAAI,iEAMlC;IACF,OAAO,EAAE,YAAY,EAAE,CAAC;IACxB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,EAAE,CAAC,MAAM,EAAE,YAAY,KAAK,IAAI,CAAC;IACzC,YAAY,CAAC,EAAE,CACd,MAAM,EAAE,YAAY,EACpB,KAAK,EAAE,iBAAiB,KACpB,KAAK,CAAC,SAAS,CAAC;IACrB,UAAU,CAAC,EAAE,gBAAgB,CAAC;CAC9B,4CAqDA,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { Icon } from "../../../../$/components/primitives/icon";
|
|
3
|
+
import { cn } from "../../../../$/lib/utils";
|
|
4
|
+
import * as SelectPrimitive from "@rn-primitives/select";
|
|
5
|
+
import { Check } from "lucide-react-native";
|
|
6
|
+
import { Platform, Pressable, Text, View } from "react-native";
|
|
7
|
+
// Used inside SelectPrimitive.Root (popover variant)
|
|
8
|
+
export var PrimitiveOptionList = function (_a) {
|
|
9
|
+
var options = _a.options, renderOption = _a.renderOption, classNames = _a.classNames;
|
|
10
|
+
var value = SelectPrimitive.useRootContext().value;
|
|
11
|
+
var selectedValue = value === null || value === void 0 ? void 0 : value.value;
|
|
12
|
+
return (_jsx(_Fragment, { children: options.map(function (option) {
|
|
13
|
+
var _a, _b;
|
|
14
|
+
var isSelected = selectedValue === option.value;
|
|
15
|
+
var isDisabled = !!option.disabled;
|
|
16
|
+
var renderer = (_a = option.renderOption) !== null && _a !== void 0 ? _a : renderOption;
|
|
17
|
+
var content = (_b = renderer === null || renderer === void 0 ? void 0 : renderer(option, { isSelected: isSelected, isDisabled: isDisabled })) !== null && _b !== void 0 ? _b : (_jsx(SelectPrimitive.ItemText, { className: cn("text-foreground text-sm", classNames === null || classNames === void 0 ? void 0 : classNames.optionItemLabel) }));
|
|
18
|
+
return (_jsxs(SelectPrimitive.Item, { value: option.value, label: option.label, disabled: option.disabled, className: cn("group relative flex w-full flex-row items-center gap-2 rounded-sm py-2 pl-3 pr-8 sm:py-1.5", Platform.select({
|
|
19
|
+
web: cn("focus:bg-accent focus:text-accent-foreground cursor-default outline-none data-[disabled]:pointer-events-none", "[&_svg]:pointer-events-none"),
|
|
20
|
+
}), classNames === null || classNames === void 0 ? void 0 : classNames.optionItemContainer, isSelected && (classNames === null || classNames === void 0 ? void 0 : classNames.optionItemActiveContainer), isDisabled && (classNames === null || classNames === void 0 ? void 0 : classNames.optionItemDisabledContainer)), children: [_jsx(View, { className: cn("absolute right-2 flex size-3.5 items-center justify-center", classNames === null || classNames === void 0 ? void 0 : classNames.optionItemIndicator), children: _jsx(SelectPrimitive.ItemIndicator, { children: _jsx(Icon, { as: Check, className: "text-muted-foreground size-4 shrink-0" }) }) }), content] }, option.value));
|
|
21
|
+
}) }));
|
|
22
|
+
};
|
|
23
|
+
// Standalone option list for sheet/dialog — no SelectPrimitive context needed
|
|
24
|
+
export var StandaloneOptionList = function (_a) {
|
|
25
|
+
var options = _a.options, selectedValue = _a.selectedValue, onSelect = _a.onSelect, renderOption = _a.renderOption, classNames = _a.classNames;
|
|
26
|
+
return (_jsx(_Fragment, { children: options.map(function (option) {
|
|
27
|
+
var _a;
|
|
28
|
+
var isSelected = selectedValue === option.value;
|
|
29
|
+
var isDisabled = !!option.disabled;
|
|
30
|
+
var renderer = (_a = option.renderOption) !== null && _a !== void 0 ? _a : renderOption;
|
|
31
|
+
var label = renderer ? (renderer(option, { isSelected: isSelected, isDisabled: isDisabled })) : (_jsx(Text, { className: cn("text-foreground text-sm", classNames === null || classNames === void 0 ? void 0 : classNames.optionItemLabel), children: option.label }));
|
|
32
|
+
return (_jsxs(Pressable, { onPress: function () { return !isDisabled && onSelect(option); }, disabled: isDisabled, className: cn("group relative flex w-full flex-row items-center gap-2 rounded-sm py-2 pl-3 pr-8 sm:py-1.5", classNames === null || classNames === void 0 ? void 0 : classNames.optionItemContainer, isSelected && (classNames === null || classNames === void 0 ? void 0 : classNames.optionItemActiveContainer), isDisabled && (classNames === null || classNames === void 0 ? void 0 : classNames.optionItemDisabledContainer), isDisabled && "opacity-50"), children: [_jsx(View, { className: cn("absolute right-2 flex size-3.5 items-center justify-center", classNames === null || classNames === void 0 ? void 0 : classNames.optionItemIndicator), children: isSelected && (_jsx(Icon, { as: Check, className: "text-muted-foreground size-4 shrink-0" })) }), label] }, option.value));
|
|
33
|
+
}) }));
|
|
34
|
+
};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { NativeSelectScrollView, SelectContent, SelectTrigger, SelectValue, type Option as PrimitiveOption, type TriggerRef } from "../../primitives/select";
|
|
2
|
+
import * as SelectPrimitive from "@rn-primitives/select";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import type { SelectOption, SelectClassNames } from "./types";
|
|
5
|
+
type PopoverSelectProps = Omit<React.ComponentPropsWithoutRef<typeof SelectPrimitive.Root>, "children" | "value" | "defaultValue" | "onValueChange"> & {
|
|
6
|
+
options: SelectOption[];
|
|
7
|
+
value?: string;
|
|
8
|
+
defaultValue?: string;
|
|
9
|
+
placeholder?: string;
|
|
10
|
+
renderOption?: (option: SelectOption, state: {
|
|
11
|
+
isSelected: boolean;
|
|
12
|
+
isDisabled: boolean;
|
|
13
|
+
}) => React.ReactNode;
|
|
14
|
+
classNames?: SelectClassNames;
|
|
15
|
+
triggerProps?: React.ComponentPropsWithoutRef<typeof SelectTrigger>;
|
|
16
|
+
contentProps?: React.ComponentPropsWithoutRef<typeof SelectContent>;
|
|
17
|
+
valueProps?: Omit<React.ComponentPropsWithoutRef<typeof SelectValue>, "placeholder">;
|
|
18
|
+
scrollViewProps?: React.ComponentProps<typeof NativeSelectScrollView>;
|
|
19
|
+
onValueChange?: (value: string | undefined, option?: SelectOption) => void;
|
|
20
|
+
onOptionChange?: (option: PrimitiveOption) => void;
|
|
21
|
+
};
|
|
22
|
+
declare const PopoverSelect: React.ForwardRefExoticComponent<Omit<Omit<import("react-native").ViewProps & {
|
|
23
|
+
asChild?: boolean;
|
|
24
|
+
} & {
|
|
25
|
+
value?: import("@rn-primitives/select").Option;
|
|
26
|
+
defaultValue?: import("@rn-primitives/select").Option;
|
|
27
|
+
onValueChange?: (option: import("@rn-primitives/select").Option) => void;
|
|
28
|
+
onOpenChange?: (open: boolean) => void;
|
|
29
|
+
disabled?: boolean;
|
|
30
|
+
dir?: "ltr" | "rtl";
|
|
31
|
+
name?: string;
|
|
32
|
+
required?: boolean;
|
|
33
|
+
} & React.RefAttributes<import("react-native").View>, "ref">, "children" | "value" | "defaultValue" | "onValueChange"> & {
|
|
34
|
+
options: SelectOption[];
|
|
35
|
+
value?: string;
|
|
36
|
+
defaultValue?: string;
|
|
37
|
+
placeholder?: string;
|
|
38
|
+
renderOption?: (option: SelectOption, state: {
|
|
39
|
+
isSelected: boolean;
|
|
40
|
+
isDisabled: boolean;
|
|
41
|
+
}) => React.ReactNode;
|
|
42
|
+
classNames?: SelectClassNames;
|
|
43
|
+
triggerProps?: React.ComponentPropsWithoutRef<typeof SelectTrigger>;
|
|
44
|
+
contentProps?: React.ComponentPropsWithoutRef<typeof SelectContent>;
|
|
45
|
+
valueProps?: Omit<React.ComponentPropsWithoutRef<typeof SelectValue>, "placeholder">;
|
|
46
|
+
scrollViewProps?: React.ComponentProps<typeof NativeSelectScrollView>;
|
|
47
|
+
onValueChange?: (value: string | undefined, option?: SelectOption) => void;
|
|
48
|
+
onOptionChange?: (option: PrimitiveOption) => void;
|
|
49
|
+
} & React.RefAttributes<TriggerRef>>;
|
|
50
|
+
export { PopoverSelect };
|
|
51
|
+
export type { PopoverSelectProps };
|
|
52
|
+
//# sourceMappingURL=popover-select.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"popover-select.d.ts","sourceRoot":"","sources":["../../../../../$/components/ui/select/popover-select.tsx"],"names":[],"mappings":"AAAA,OAAO,EACN,sBAAsB,EACtB,aAAa,EACb,aAAa,EACb,WAAW,EACX,KAAK,MAAM,IAAI,eAAe,EAC9B,KAAK,UAAU,EACf,MAAM,yBAAyB,CAAC;AAEjC,OAAO,KAAK,eAAe,MAAM,uBAAuB,CAAC;AACzD,OAAO,KAAK,KAAK,MAAM,O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AE;QAAE,UAAU,EAAE,OAAO,CAAC;QAAC,UAAU,EAAE,OAAO,CAAA;KAAE,KAC/C,KAAK,CAAC,SAAS;iBACP,gBAAgB;mBACd,KAAK,CAAC,wBAAwB,CAAC,OAAO,aAAa,CAAC;mBACpD,KAAK,CAAC,wBAAwB,CAAC,OAAO,aAAa,CAAC;iBACtD,IAAI,CAChB,KAAK,CAAC,wBAAwB,CAAC,OAAO,WAAW,CAAC,EAClD,aAAa,CACb;sBACiB,KAAK,CAAC,cAAc,CAAC,OAAO,sBAAsB,CAAC;oBACrD,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,EAAE,MAAM,CAAC,EAAE,YAAY,KAAK,IAAI;qBACzD,CAAC,MAAM,EAAE,eAAe,KAAK,IAAI;oCAwGlD,CAAC;AAIF,OAAO,EAAE,aAAa,EAAE,CAAC;AACzB,YAAY,EAAE,kBAAkB,EAAE,CAAC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
13
|
+
var t = {};
|
|
14
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15
|
+
t[p] = s[p];
|
|
16
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
19
|
+
t[p[i]] = s[p[i]];
|
|
20
|
+
}
|
|
21
|
+
return t;
|
|
22
|
+
};
|
|
23
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
24
|
+
import { NativeSelectScrollView, SelectContent, SelectTrigger, SelectValue, } from "../../primitives/select";
|
|
25
|
+
import { cn } from "../../../../$/lib/utils";
|
|
26
|
+
import * as SelectPrimitive from "@rn-primitives/select";
|
|
27
|
+
import * as React from "react";
|
|
28
|
+
import { PrimitiveOptionList } from "./option-list";
|
|
29
|
+
var toPrimitiveOption = function (optionValue, optionsMap) {
|
|
30
|
+
if (!optionValue)
|
|
31
|
+
return undefined;
|
|
32
|
+
var match = optionsMap.get(optionValue);
|
|
33
|
+
if (match)
|
|
34
|
+
return { value: match.value, label: match.label };
|
|
35
|
+
return { value: optionValue, label: optionValue };
|
|
36
|
+
};
|
|
37
|
+
var PopoverSelect = React.forwardRef(function (props, ref) {
|
|
38
|
+
var options = props.options, value = props.value, defaultValue = props.defaultValue, _a = props.placeholder, placeholder = _a === void 0 ? "Select an option" : _a, renderOption = props.renderOption, classNames = props.classNames, triggerProps = props.triggerProps, contentProps = props.contentProps, valueProps = props.valueProps, scrollViewProps = props.scrollViewProps, onValueChange = props.onValueChange, onOptionChange = props.onOptionChange, rootProps = __rest(props, ["options", "value", "defaultValue", "placeholder", "renderOption", "classNames", "triggerProps", "contentProps", "valueProps", "scrollViewProps", "onValueChange", "onOptionChange"]);
|
|
39
|
+
var optionsMap = React.useMemo(function () { return new Map(options.map(function (opt) { return [opt.value, opt]; })); }, [options]);
|
|
40
|
+
var resolvedValue = React.useMemo(function () { return toPrimitiveOption(value, optionsMap); }, [value, optionsMap]);
|
|
41
|
+
var resolvedDefaultValue = React.useMemo(function () { return toPrimitiveOption(defaultValue, optionsMap); }, [defaultValue, optionsMap]);
|
|
42
|
+
var handleValueChange = React.useCallback(function (option) {
|
|
43
|
+
var _a, _b;
|
|
44
|
+
onOptionChange === null || onOptionChange === void 0 ? void 0 : onOptionChange(option);
|
|
45
|
+
var matchingOption = (option === null || option === void 0 ? void 0 : option.value)
|
|
46
|
+
? (_a = optionsMap.get(option.value)) !== null && _a !== void 0 ? _a : (option
|
|
47
|
+
? { label: (_b = option.label) !== null && _b !== void 0 ? _b : option.value, value: option.value }
|
|
48
|
+
: undefined)
|
|
49
|
+
: undefined;
|
|
50
|
+
onValueChange === null || onValueChange === void 0 ? void 0 : onValueChange(option === null || option === void 0 ? void 0 : option.value, matchingOption);
|
|
51
|
+
}, [onOptionChange, onValueChange, optionsMap]);
|
|
52
|
+
return (_jsxs(SelectPrimitive.Root, __assign({ value: resolvedValue, defaultValue: resolvedDefaultValue, onValueChange: handleValueChange }, rootProps, { className: cn("w-full", rootProps.className), children: [_jsx(SelectTrigger, __assign({ ref: ref }, triggerProps, { className: cn("border-none bg-transparent text-foreground placeholder:text-muted-foreground w-full", triggerProps === null || triggerProps === void 0 ? void 0 : triggerProps.className, classNames === null || classNames === void 0 ? void 0 : classNames.trigger), children: _jsx(SelectValue, __assign({ placeholder: placeholder }, valueProps, { className: cn("text-foreground placeholder:text-muted-foreground", valueProps === null || valueProps === void 0 ? void 0 : valueProps.className, classNames === null || classNames === void 0 ? void 0 : classNames.value) })) })), _jsx(SelectContent, __assign({}, contentProps, { className: cn(contentProps === null || contentProps === void 0 ? void 0 : contentProps.className, classNames === null || classNames === void 0 ? void 0 : classNames.content), children: _jsx(NativeSelectScrollView, __assign({}, scrollViewProps, { className: cn(scrollViewProps === null || scrollViewProps === void 0 ? void 0 : scrollViewProps.className, classNames === null || classNames === void 0 ? void 0 : classNames.optionList), children: _jsx(PrimitiveOptionList, { options: options, renderOption: renderOption, classNames: classNames }) })) }))] })));
|
|
53
|
+
});
|
|
54
|
+
PopoverSelect.displayName = "PopoverSelect";
|
|
55
|
+
export { PopoverSelect };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type FormFieldProps } from "../form-field";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import type { SelectProps, TriggerRef } from "./types";
|
|
4
|
+
type SelectFieldProps = SelectProps & Omit<FormFieldProps, "children" | "value" | "defaultValue" | "onValueChange" | "onFocus" | "onBlur" | "placeholder"> & {
|
|
5
|
+
onFieldFocus?: FormFieldProps["onFocus"];
|
|
6
|
+
onFieldBlur?: FormFieldProps["onBlur"];
|
|
7
|
+
};
|
|
8
|
+
declare const SelectField: React.ForwardRefExoticComponent<SelectFieldProps & React.RefAttributes<TriggerRef>>;
|
|
9
|
+
export { SelectField };
|
|
10
|
+
export type { SelectFieldProps };
|
|
11
|
+
//# sourceMappingURL=select-field.d.ts.map
|