@yca-software/yca-react-core 0.0.20 → 0.0.22
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/api/index.js +1 -1
- package/dist/{chunk-NL5V3XXV.js → chunk-2HTQDFQJ.js} +17 -2
- package/dist/chunk-2HTQDFQJ.js.map +1 -0
- package/dist/{chunk-25GC4ZEE.js → chunk-HJZNKZHZ.js} +3 -3
- package/dist/{chunk-25GC4ZEE.js.map → chunk-HJZNKZHZ.js.map} +1 -1
- package/dist/{chunk-KSWAKETF.js → chunk-QHNZTXPJ.js} +415 -8
- package/dist/chunk-QHNZTXPJ.js.map +1 -0
- package/dist/{chunk-6YTCQ4GG.js → chunk-WZ64FPVI.js} +47 -65
- package/dist/chunk-WZ64FPVI.js.map +1 -0
- package/dist/components/forms/index.js +2 -2
- package/dist/components/spa/index.d.ts +17 -1
- package/dist/components/spa/index.js +2 -2
- package/dist/components/ui/index.d.ts +71 -19
- package/dist/components/ui/index.js +1 -1
- package/dist/index-Ckfrh1rP.d.ts +26 -0
- package/dist/index.d.ts +3 -2
- package/dist/index.js +4 -4
- package/package.json +1 -1
- package/dist/chunk-6YTCQ4GG.js.map +0 -1
- package/dist/chunk-KSWAKETF.js.map +0 -1
- package/dist/chunk-NL5V3XXV.js.map +0 -1
|
@@ -7,10 +7,10 @@ import * as AlertDialogPrimitive from '@radix-ui/react-alert-dialog';
|
|
|
7
7
|
import * as React8 from 'react';
|
|
8
8
|
import { useRef, useId, useState, useEffect } from 'react';
|
|
9
9
|
import * as AvatarPrimitive from '@radix-ui/react-avatar';
|
|
10
|
-
import { Check, Calendar as Calendar$1, ChevronLeft, ChevronRight, Loader2, XIcon, ChevronUp, ChevronDown, X, CheckSquare, FileText, ImagePlus, UploadCloud } from 'lucide-react';
|
|
10
|
+
import { Check, Calendar as Calendar$1, ChevronLeft, ChevronRight, Loader2, XIcon, ChevronUp, ChevronDown, X, CheckSquare, Search, FileText, ImagePlus, UploadCloud } from 'lucide-react';
|
|
11
11
|
import { DayPicker } from 'react-day-picker';
|
|
12
12
|
import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
|
|
13
|
-
import { format, parse } from 'date-fns';
|
|
13
|
+
import { format, isSameMonth, isSameDay, addDays, startOfMonth, startOfDay, endOfDay, isWithinInterval, addMonths, addWeeks, startOfWeek, endOfWeek, parse } from 'date-fns';
|
|
14
14
|
import * as PopoverPrimitive from '@radix-ui/react-popover';
|
|
15
15
|
import * as DialogPrimitive from '@radix-ui/react-dialog';
|
|
16
16
|
import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
|
|
@@ -1493,6 +1493,322 @@ function DropdownSelectSearchInput({
|
|
|
1493
1493
|
}
|
|
1494
1494
|
) });
|
|
1495
1495
|
}
|
|
1496
|
+
function startOfVisibleWeek(date, weekStartsOnMonday) {
|
|
1497
|
+
return startOfWeek(date, { weekStartsOn: weekStartsOnMonday ? 1 : 0 });
|
|
1498
|
+
}
|
|
1499
|
+
function endOfVisibleWeek(date, weekStartsOnMonday) {
|
|
1500
|
+
return endOfWeek(date, { weekStartsOn: weekStartsOnMonday ? 1 : 0 });
|
|
1501
|
+
}
|
|
1502
|
+
function monthGridDays(anchor, weekStartsOnMonday) {
|
|
1503
|
+
const start = startOfVisibleWeek(startOfMonth(anchor), weekStartsOnMonday);
|
|
1504
|
+
return Array.from({ length: 42 }, (_, i) => addDays(start, i));
|
|
1505
|
+
}
|
|
1506
|
+
function weekDays(anchor, weekStartsOnMonday) {
|
|
1507
|
+
const start = startOfVisibleWeek(anchor, weekStartsOnMonday);
|
|
1508
|
+
return Array.from({ length: 7 }, (_, i) => addDays(start, i));
|
|
1509
|
+
}
|
|
1510
|
+
function eventInterval(event) {
|
|
1511
|
+
const start = startOfDay(event.start);
|
|
1512
|
+
const end = event.end ? endOfDay(event.end) : endOfDay(event.start);
|
|
1513
|
+
return { start, end };
|
|
1514
|
+
}
|
|
1515
|
+
function eventsOnDay(events, day) {
|
|
1516
|
+
const dayStart = startOfDay(day);
|
|
1517
|
+
const dayEnd = endOfDay(day);
|
|
1518
|
+
return events.filter((event) => {
|
|
1519
|
+
const { start, end } = eventInterval(event);
|
|
1520
|
+
return isWithinInterval(dayStart, { start, end }) || isWithinInterval(dayEnd, { start, end }) || start <= dayStart && end >= dayEnd;
|
|
1521
|
+
});
|
|
1522
|
+
}
|
|
1523
|
+
function weekdayLabels(weekStartsOnMonday, reference = /* @__PURE__ */ new Date()) {
|
|
1524
|
+
const start = startOfVisibleWeek(reference, weekStartsOnMonday);
|
|
1525
|
+
return Array.from({ length: 7 }, (_, i) => format(addDays(start, i), "EEE"));
|
|
1526
|
+
}
|
|
1527
|
+
function shiftAnchor(anchor, view, direction) {
|
|
1528
|
+
if (view === "month") return addMonths(anchor, direction);
|
|
1529
|
+
if (view === "week") return addWeeks(anchor, direction);
|
|
1530
|
+
return addDays(anchor, direction);
|
|
1531
|
+
}
|
|
1532
|
+
function titleForView(anchor, view, weekStartsOnMonday) {
|
|
1533
|
+
if (view === "month") return format(anchor, "MMMM yyyy");
|
|
1534
|
+
if (view === "day") return format(anchor, "EEEE, MMM d, yyyy");
|
|
1535
|
+
const start = startOfVisibleWeek(anchor, weekStartsOnMonday);
|
|
1536
|
+
const end = endOfVisibleWeek(anchor, weekStartsOnMonday);
|
|
1537
|
+
if (isSameMonth(start, end)) {
|
|
1538
|
+
return `${format(start, "MMM d")} \u2013 ${format(end, "d, yyyy")}`;
|
|
1539
|
+
}
|
|
1540
|
+
return `${format(start, "MMM d")} \u2013 ${format(end, "MMM d, yyyy")}`;
|
|
1541
|
+
}
|
|
1542
|
+
var MAX_MONTH_CHIPS = 3;
|
|
1543
|
+
function useControlledDate(value, defaultValue, onChange) {
|
|
1544
|
+
const [internal, setInternal] = React8.useState(defaultValue ?? /* @__PURE__ */ new Date());
|
|
1545
|
+
const isControlled = value !== void 0;
|
|
1546
|
+
const current = isControlled ? value : internal;
|
|
1547
|
+
const set = React8.useCallback(
|
|
1548
|
+
(next) => {
|
|
1549
|
+
if (!isControlled) setInternal(next);
|
|
1550
|
+
onChange?.(next);
|
|
1551
|
+
},
|
|
1552
|
+
[isControlled, onChange]
|
|
1553
|
+
);
|
|
1554
|
+
return [current, set];
|
|
1555
|
+
}
|
|
1556
|
+
function useControlledView(value, defaultValue, onChange) {
|
|
1557
|
+
const [internal, setInternal] = React8.useState(defaultValue);
|
|
1558
|
+
const isControlled = value !== void 0;
|
|
1559
|
+
const current = isControlled ? value : internal;
|
|
1560
|
+
const set = React8.useCallback(
|
|
1561
|
+
(next) => {
|
|
1562
|
+
if (!isControlled) setInternal(next);
|
|
1563
|
+
onChange?.(next);
|
|
1564
|
+
},
|
|
1565
|
+
[isControlled, onChange]
|
|
1566
|
+
);
|
|
1567
|
+
return [current, set];
|
|
1568
|
+
}
|
|
1569
|
+
function EventChip({
|
|
1570
|
+
event,
|
|
1571
|
+
dense,
|
|
1572
|
+
onClick
|
|
1573
|
+
}) {
|
|
1574
|
+
return /* @__PURE__ */ jsx(
|
|
1575
|
+
"button",
|
|
1576
|
+
{
|
|
1577
|
+
type: "button",
|
|
1578
|
+
"data-slot": "event-calendar-chip",
|
|
1579
|
+
className: cn(
|
|
1580
|
+
"w-full truncate rounded-md px-1.5 text-left text-[0.7rem] font-medium leading-5",
|
|
1581
|
+
"bg-primary/15 text-primary hover:bg-primary/25",
|
|
1582
|
+
dense && "leading-4 text-[0.65rem]",
|
|
1583
|
+
event.colorClassName
|
|
1584
|
+
),
|
|
1585
|
+
style: event.color ? { backgroundColor: `${event.color}22`, color: event.color } : void 0,
|
|
1586
|
+
onClick: (e) => {
|
|
1587
|
+
e.stopPropagation();
|
|
1588
|
+
onClick?.(event);
|
|
1589
|
+
},
|
|
1590
|
+
children: event.title
|
|
1591
|
+
}
|
|
1592
|
+
);
|
|
1593
|
+
}
|
|
1594
|
+
function EventCalendar({
|
|
1595
|
+
events,
|
|
1596
|
+
value,
|
|
1597
|
+
defaultValue,
|
|
1598
|
+
view: viewProp,
|
|
1599
|
+
defaultView = "month",
|
|
1600
|
+
onValueChange,
|
|
1601
|
+
onViewChange,
|
|
1602
|
+
onEventClick,
|
|
1603
|
+
onSlotClick,
|
|
1604
|
+
className,
|
|
1605
|
+
weekStartsOnMonday = true,
|
|
1606
|
+
labels
|
|
1607
|
+
}) {
|
|
1608
|
+
const [safeAnchor, setAnchor] = useControlledDate(value, defaultValue, onValueChange);
|
|
1609
|
+
const [safeView, setViewSafe] = useControlledView(viewProp, defaultView, onViewChange);
|
|
1610
|
+
const weekdays = React8.useMemo(
|
|
1611
|
+
() => weekdayLabels(weekStartsOnMonday, safeAnchor),
|
|
1612
|
+
[weekStartsOnMonday, safeAnchor]
|
|
1613
|
+
);
|
|
1614
|
+
const go = (direction) => setAnchor(shiftAnchor(safeAnchor, safeView, direction));
|
|
1615
|
+
return /* @__PURE__ */ jsxs(
|
|
1616
|
+
"div",
|
|
1617
|
+
{
|
|
1618
|
+
"data-slot": "event-calendar",
|
|
1619
|
+
className: cn(surfaceCard, "flex flex-col gap-3 p-3 sm:p-4", className),
|
|
1620
|
+
children: [
|
|
1621
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center justify-between gap-2", children: [
|
|
1622
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1", children: [
|
|
1623
|
+
/* @__PURE__ */ jsx(
|
|
1624
|
+
Button,
|
|
1625
|
+
{
|
|
1626
|
+
type: "button",
|
|
1627
|
+
variant: "outline",
|
|
1628
|
+
size: "icon-sm",
|
|
1629
|
+
"aria-label": "Previous",
|
|
1630
|
+
onClick: () => go(-1),
|
|
1631
|
+
children: /* @__PURE__ */ jsx(ChevronLeft, {})
|
|
1632
|
+
}
|
|
1633
|
+
),
|
|
1634
|
+
/* @__PURE__ */ jsx(
|
|
1635
|
+
Button,
|
|
1636
|
+
{
|
|
1637
|
+
type: "button",
|
|
1638
|
+
variant: "outline",
|
|
1639
|
+
size: "icon-sm",
|
|
1640
|
+
"aria-label": "Next",
|
|
1641
|
+
onClick: () => go(1),
|
|
1642
|
+
children: /* @__PURE__ */ jsx(ChevronRight, {})
|
|
1643
|
+
}
|
|
1644
|
+
),
|
|
1645
|
+
/* @__PURE__ */ jsx(Button, { type: "button", variant: "ghost", size: "sm", onClick: () => setAnchor(/* @__PURE__ */ new Date()), children: labels?.today ?? "Today" }),
|
|
1646
|
+
/* @__PURE__ */ jsx("h2", { className: "ml-1 text-sm font-semibold sm:text-base", children: titleForView(safeAnchor, safeView, weekStartsOnMonday) })
|
|
1647
|
+
] }),
|
|
1648
|
+
/* @__PURE__ */ jsx("div", { className: "flex items-center gap-1 rounded-lg border border-border/50 p-0.5", children: ["month", "week", "day"].map((v) => /* @__PURE__ */ jsx(
|
|
1649
|
+
Button,
|
|
1650
|
+
{
|
|
1651
|
+
type: "button",
|
|
1652
|
+
size: "sm",
|
|
1653
|
+
variant: safeView === v ? "secondary" : "ghost",
|
|
1654
|
+
onClick: () => setViewSafe(v),
|
|
1655
|
+
children: labels?.[v] ?? v.charAt(0).toUpperCase() + v.slice(1)
|
|
1656
|
+
},
|
|
1657
|
+
v
|
|
1658
|
+
)) })
|
|
1659
|
+
] }),
|
|
1660
|
+
safeView === "month" && /* @__PURE__ */ jsx(
|
|
1661
|
+
MonthGrid,
|
|
1662
|
+
{
|
|
1663
|
+
anchor: safeAnchor,
|
|
1664
|
+
events,
|
|
1665
|
+
weekStartsOnMonday,
|
|
1666
|
+
weekdays,
|
|
1667
|
+
onEventClick,
|
|
1668
|
+
onSlotClick
|
|
1669
|
+
}
|
|
1670
|
+
),
|
|
1671
|
+
safeView === "week" && /* @__PURE__ */ jsx(
|
|
1672
|
+
WeekGrid,
|
|
1673
|
+
{
|
|
1674
|
+
anchor: safeAnchor,
|
|
1675
|
+
events,
|
|
1676
|
+
weekStartsOnMonday,
|
|
1677
|
+
weekdays,
|
|
1678
|
+
onEventClick,
|
|
1679
|
+
onSlotClick
|
|
1680
|
+
}
|
|
1681
|
+
),
|
|
1682
|
+
safeView === "day" && /* @__PURE__ */ jsx(
|
|
1683
|
+
DayPane,
|
|
1684
|
+
{
|
|
1685
|
+
anchor: safeAnchor,
|
|
1686
|
+
events,
|
|
1687
|
+
onEventClick,
|
|
1688
|
+
onSlotClick
|
|
1689
|
+
}
|
|
1690
|
+
)
|
|
1691
|
+
]
|
|
1692
|
+
}
|
|
1693
|
+
);
|
|
1694
|
+
}
|
|
1695
|
+
function MonthGrid({
|
|
1696
|
+
anchor,
|
|
1697
|
+
events,
|
|
1698
|
+
weekStartsOnMonday,
|
|
1699
|
+
weekdays,
|
|
1700
|
+
onEventClick,
|
|
1701
|
+
onSlotClick
|
|
1702
|
+
}) {
|
|
1703
|
+
const days = monthGridDays(anchor, weekStartsOnMonday);
|
|
1704
|
+
const today = /* @__PURE__ */ new Date();
|
|
1705
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
1706
|
+
/* @__PURE__ */ jsx("div", { className: "grid grid-cols-7 gap-px", children: weekdays.map((label) => /* @__PURE__ */ jsx(
|
|
1707
|
+
"div",
|
|
1708
|
+
{
|
|
1709
|
+
className: "px-1 py-1 text-center text-[0.7rem] font-medium text-muted-foreground",
|
|
1710
|
+
children: label
|
|
1711
|
+
},
|
|
1712
|
+
label
|
|
1713
|
+
)) }),
|
|
1714
|
+
/* @__PURE__ */ jsx("div", { className: "grid grid-cols-7 gap-px rounded-lg border border-border/40 bg-border/40 overflow-hidden", children: days.map((day) => {
|
|
1715
|
+
const dayEvents = eventsOnDay(events, day);
|
|
1716
|
+
const inMonth = isSameMonth(day, anchor);
|
|
1717
|
+
const isToday = isSameDay(day, today);
|
|
1718
|
+
const overflow = dayEvents.length - MAX_MONTH_CHIPS;
|
|
1719
|
+
return /* @__PURE__ */ jsxs(
|
|
1720
|
+
"button",
|
|
1721
|
+
{
|
|
1722
|
+
type: "button",
|
|
1723
|
+
"data-slot": "event-calendar-day",
|
|
1724
|
+
className: cn(
|
|
1725
|
+
"flex min-h-[5.5rem] flex-col gap-0.5 bg-card p-1 text-left align-top",
|
|
1726
|
+
"hover:bg-accent/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
1727
|
+
!inMonth && "bg-muted/20 text-muted-foreground"
|
|
1728
|
+
),
|
|
1729
|
+
onClick: () => onSlotClick?.(day),
|
|
1730
|
+
children: [
|
|
1731
|
+
/* @__PURE__ */ jsx(
|
|
1732
|
+
"span",
|
|
1733
|
+
{
|
|
1734
|
+
className: cn(
|
|
1735
|
+
"inline-flex size-6 items-center justify-center rounded-md text-xs",
|
|
1736
|
+
isToday && "bg-primary text-primary-foreground font-semibold"
|
|
1737
|
+
),
|
|
1738
|
+
children: format(day, "d")
|
|
1739
|
+
}
|
|
1740
|
+
),
|
|
1741
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-0.5", children: [
|
|
1742
|
+
dayEvents.slice(0, MAX_MONTH_CHIPS).map((event) => /* @__PURE__ */ jsx(EventChip, { event, dense: true, onClick: onEventClick }, event.id)),
|
|
1743
|
+
overflow > 0 && /* @__PURE__ */ jsxs("span", { className: "px-1 text-[0.65rem] text-muted-foreground", children: [
|
|
1744
|
+
"+",
|
|
1745
|
+
overflow
|
|
1746
|
+
] })
|
|
1747
|
+
] })
|
|
1748
|
+
]
|
|
1749
|
+
},
|
|
1750
|
+
day.toISOString()
|
|
1751
|
+
);
|
|
1752
|
+
}) })
|
|
1753
|
+
] });
|
|
1754
|
+
}
|
|
1755
|
+
function WeekGrid({
|
|
1756
|
+
anchor,
|
|
1757
|
+
events,
|
|
1758
|
+
weekStartsOnMonday,
|
|
1759
|
+
weekdays,
|
|
1760
|
+
onEventClick,
|
|
1761
|
+
onSlotClick
|
|
1762
|
+
}) {
|
|
1763
|
+
const days = weekDays(anchor, weekStartsOnMonday);
|
|
1764
|
+
const today = /* @__PURE__ */ new Date();
|
|
1765
|
+
return /* @__PURE__ */ jsx("div", { className: "grid grid-cols-1 gap-2 sm:grid-cols-7", children: days.map((day, i) => {
|
|
1766
|
+
const dayEvents = eventsOnDay(events, day);
|
|
1767
|
+
return /* @__PURE__ */ jsxs(
|
|
1768
|
+
"button",
|
|
1769
|
+
{
|
|
1770
|
+
type: "button",
|
|
1771
|
+
className: cn(
|
|
1772
|
+
"flex min-h-[10rem] flex-col gap-1 rounded-lg border border-border/40 bg-card p-2 text-left",
|
|
1773
|
+
"hover:bg-accent/30 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
1774
|
+
isSameDay(day, today) && "ring-1 ring-primary/40"
|
|
1775
|
+
),
|
|
1776
|
+
onClick: () => onSlotClick?.(day),
|
|
1777
|
+
children: [
|
|
1778
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-baseline justify-between gap-1", children: [
|
|
1779
|
+
/* @__PURE__ */ jsx("span", { className: "text-[0.7rem] text-muted-foreground", children: weekdays[i] }),
|
|
1780
|
+
/* @__PURE__ */ jsx("span", { className: "text-sm font-medium", children: format(day, "d") })
|
|
1781
|
+
] }),
|
|
1782
|
+
/* @__PURE__ */ jsx("div", { className: "flex flex-col gap-1", children: dayEvents.map((event) => /* @__PURE__ */ jsx(EventChip, { event, onClick: onEventClick }, event.id)) })
|
|
1783
|
+
]
|
|
1784
|
+
},
|
|
1785
|
+
day.toISOString()
|
|
1786
|
+
);
|
|
1787
|
+
}) });
|
|
1788
|
+
}
|
|
1789
|
+
function DayPane({
|
|
1790
|
+
anchor,
|
|
1791
|
+
events,
|
|
1792
|
+
onEventClick,
|
|
1793
|
+
onSlotClick
|
|
1794
|
+
}) {
|
|
1795
|
+
const dayEvents = eventsOnDay(events, anchor);
|
|
1796
|
+
return /* @__PURE__ */ jsxs(
|
|
1797
|
+
"button",
|
|
1798
|
+
{
|
|
1799
|
+
type: "button",
|
|
1800
|
+
className: cn(
|
|
1801
|
+
"flex min-h-[16rem] flex-col gap-2 rounded-lg border border-border/40 bg-card p-3 text-left",
|
|
1802
|
+
"hover:bg-accent/20 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
|
|
1803
|
+
),
|
|
1804
|
+
onClick: () => onSlotClick?.(anchor),
|
|
1805
|
+
children: [
|
|
1806
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: format(anchor, "EEEE, MMMM d") }),
|
|
1807
|
+
dayEvents.length === 0 ? /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: "No events" }) : /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-2", children: dayEvents.map((event) => /* @__PURE__ */ jsx(EventChip, { event, onClick: onEventClick }, event.id)) })
|
|
1808
|
+
]
|
|
1809
|
+
}
|
|
1810
|
+
);
|
|
1811
|
+
}
|
|
1496
1812
|
var labelVariants = cva(
|
|
1497
1813
|
"text-sm font-medium leading-none tracking-tight text-foreground peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
|
|
1498
1814
|
);
|
|
@@ -1775,7 +2091,8 @@ var DEFAULT_TRANSLATIONS2 = {
|
|
|
1775
2091
|
triggerLabel: "Select options",
|
|
1776
2092
|
searchPlaceholder: "Search...",
|
|
1777
2093
|
noOptionsText: "No options",
|
|
1778
|
-
removeOptionAriaLabel: "Remove"
|
|
2094
|
+
removeOptionAriaLabel: "Remove",
|
|
2095
|
+
addMoreLabel: ""
|
|
1779
2096
|
};
|
|
1780
2097
|
function MultiSelect({
|
|
1781
2098
|
value,
|
|
@@ -1801,6 +2118,8 @@ function MultiSelect({
|
|
|
1801
2118
|
if (!q) return options;
|
|
1802
2119
|
return options.filter((opt) => opt.label.toLowerCase().includes(q));
|
|
1803
2120
|
}, [options, search]);
|
|
2121
|
+
const addMore = t.addMoreLabel.trim();
|
|
2122
|
+
const triggerText = value.length > 0 && showSelectedTags && addMore ? addMore : t.triggerLabel;
|
|
1804
2123
|
const toggle = (optionValue, checked) => {
|
|
1805
2124
|
if (checked) {
|
|
1806
2125
|
onValueChange([...value, optionValue]);
|
|
@@ -1832,12 +2151,12 @@ function MultiSelect({
|
|
|
1832
2151
|
type: "button",
|
|
1833
2152
|
variant: "outline",
|
|
1834
2153
|
className: "w-full justify-between",
|
|
1835
|
-
"aria-label": ariaLabel ??
|
|
2154
|
+
"aria-label": ariaLabel ?? triggerText,
|
|
1836
2155
|
disabled,
|
|
1837
2156
|
children: [
|
|
1838
2157
|
/* @__PURE__ */ jsxs("span", { className: "inline-flex items-center gap-2", children: [
|
|
1839
2158
|
/* @__PURE__ */ jsx(CheckSquare, { className: "h-4 w-4" }),
|
|
1840
|
-
|
|
2159
|
+
triggerText
|
|
1841
2160
|
] }),
|
|
1842
2161
|
!showSelectedTags && value.length > 0 ? /* @__PURE__ */ jsx(Badge, { variant: "secondary", children: value.length }) : null
|
|
1843
2162
|
]
|
|
@@ -1920,6 +2239,94 @@ var ScrollBar = React8.forwardRef(({ className, orientation = "vertical", ...pro
|
|
|
1920
2239
|
}
|
|
1921
2240
|
));
|
|
1922
2241
|
ScrollBar.displayName = ScrollAreaPrimitive.ScrollAreaScrollbar.displayName;
|
|
2242
|
+
function SearchField({
|
|
2243
|
+
value,
|
|
2244
|
+
onValueChange,
|
|
2245
|
+
onSubmit,
|
|
2246
|
+
onClear,
|
|
2247
|
+
placeholder,
|
|
2248
|
+
"aria-label": ariaLabel,
|
|
2249
|
+
searchButtonLabel = "Search",
|
|
2250
|
+
clearButtonLabel = "Clear",
|
|
2251
|
+
className,
|
|
2252
|
+
inputClassName,
|
|
2253
|
+
disabled,
|
|
2254
|
+
id,
|
|
2255
|
+
name,
|
|
2256
|
+
autoComplete = "off"
|
|
2257
|
+
}) {
|
|
2258
|
+
const hasText = value.trim().length > 0;
|
|
2259
|
+
const handleKeyDown = (event) => {
|
|
2260
|
+
if (event.key === "Enter") {
|
|
2261
|
+
event.preventDefault();
|
|
2262
|
+
onSubmit();
|
|
2263
|
+
}
|
|
2264
|
+
};
|
|
2265
|
+
return /* @__PURE__ */ jsxs(
|
|
2266
|
+
"div",
|
|
2267
|
+
{
|
|
2268
|
+
className: cn(
|
|
2269
|
+
"flex h-9 w-full min-w-0 overflow-hidden rounded-md border border-input bg-background shadow-xs",
|
|
2270
|
+
"transition-[border-color,box-shadow] focus-within:border-ring focus-within:ring-2 focus-within:ring-ring/20",
|
|
2271
|
+
disabled && "opacity-60",
|
|
2272
|
+
className
|
|
2273
|
+
),
|
|
2274
|
+
children: [
|
|
2275
|
+
/* @__PURE__ */ jsxs("div", { className: "relative flex min-w-0 flex-1 items-center", children: [
|
|
2276
|
+
/* @__PURE__ */ jsx(
|
|
2277
|
+
Input,
|
|
2278
|
+
{
|
|
2279
|
+
id,
|
|
2280
|
+
name,
|
|
2281
|
+
autoComplete,
|
|
2282
|
+
disabled,
|
|
2283
|
+
placeholder,
|
|
2284
|
+
value,
|
|
2285
|
+
onChange: (e) => onValueChange(e.target.value),
|
|
2286
|
+
onKeyDown: handleKeyDown,
|
|
2287
|
+
className: cn(
|
|
2288
|
+
"h-9 rounded-none rounded-l-md border-0 bg-transparent px-3 shadow-none",
|
|
2289
|
+
"focus-visible:border-transparent focus-visible:ring-0",
|
|
2290
|
+
hasText && onClear && "pr-9",
|
|
2291
|
+
inputClassName
|
|
2292
|
+
),
|
|
2293
|
+
"aria-label": ariaLabel ?? placeholder
|
|
2294
|
+
}
|
|
2295
|
+
),
|
|
2296
|
+
hasText && onClear ? /* @__PURE__ */ jsx(
|
|
2297
|
+
Button,
|
|
2298
|
+
{
|
|
2299
|
+
type: "button",
|
|
2300
|
+
variant: "ghost",
|
|
2301
|
+
size: "icon-sm",
|
|
2302
|
+
disabled,
|
|
2303
|
+
onClick: onClear,
|
|
2304
|
+
"aria-label": clearButtonLabel,
|
|
2305
|
+
className: "absolute right-1 top-1/2 -translate-y-1/2 text-muted-foreground hover:bg-muted/60 hover:text-foreground",
|
|
2306
|
+
children: /* @__PURE__ */ jsx(X, { className: "h-4 w-4", "aria-hidden": true })
|
|
2307
|
+
}
|
|
2308
|
+
) : null
|
|
2309
|
+
] }),
|
|
2310
|
+
/* @__PURE__ */ jsx(
|
|
2311
|
+
Button,
|
|
2312
|
+
{
|
|
2313
|
+
type: "button",
|
|
2314
|
+
variant: "default",
|
|
2315
|
+
disabled,
|
|
2316
|
+
onClick: onSubmit,
|
|
2317
|
+
"aria-label": searchButtonLabel,
|
|
2318
|
+
className: cn(
|
|
2319
|
+
"h-full w-10 shrink-0 rounded-none rounded-r-md border-0 border-l border-primary-foreground/15 px-0 shadow-none",
|
|
2320
|
+
"hover:bg-primary/90 active:bg-primary/95",
|
|
2321
|
+
"shadow-[inset_0_1px_0_0_color-mix(in_oklch,var(--primary-foreground)_20%,transparent)]"
|
|
2322
|
+
),
|
|
2323
|
+
children: /* @__PURE__ */ jsx(Search, { className: "h-4 w-4", "aria-hidden": true })
|
|
2324
|
+
}
|
|
2325
|
+
)
|
|
2326
|
+
]
|
|
2327
|
+
}
|
|
2328
|
+
);
|
|
2329
|
+
}
|
|
1923
2330
|
|
|
1924
2331
|
// src/components/ui/select-search/index.ts
|
|
1925
2332
|
var SEARCHABLE_SELECT_MIN_OPTIONS = 8;
|
|
@@ -2543,6 +2950,6 @@ function UploadDropzone(props) {
|
|
|
2543
2950
|
] });
|
|
2544
2951
|
}
|
|
2545
2952
|
|
|
2546
|
-
export { Alert, AlertDescription, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, Avatar, AvatarFallback, AvatarImage, Badge, Calendar, Checkbox, ConfirmDialog, DatePicker, DateRangePicker, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger, DropdownScrollableList, DropdownSelectSearchInput, Form, FormControl, FormDescription, FormDrawer, FormField, FormItem, FormLabel, FormMessage, H3, Heading, Label, Link, MultiSelect, Paragraph, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, SEARCHABLE_SELECT_MIN_OPTIONS, ScrollArea, ScrollBar, Select, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, Tooltip, TooltipProvider, UploadDropzone, badgeVariants, dropdownMenuSelectOptionsMaxHeightClassName, filterSelectOptions, foldSearchText, headingVariants, isSelectSearchable, linkStyles, paragraphVariants, useFormField };
|
|
2547
|
-
//# sourceMappingURL=chunk-
|
|
2548
|
-
//# sourceMappingURL=chunk-
|
|
2953
|
+
export { Alert, AlertDescription, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, Avatar, AvatarFallback, AvatarImage, Badge, Calendar, Checkbox, ConfirmDialog, DatePicker, DateRangePicker, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger, DropdownScrollableList, DropdownSelectSearchInput, EventCalendar, Form, FormControl, FormDescription, FormDrawer, FormField, FormItem, FormLabel, FormMessage, H3, Heading, Label, Link, MultiSelect, Paragraph, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, SEARCHABLE_SELECT_MIN_OPTIONS, ScrollArea, ScrollBar, SearchField, Select, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, Tooltip, TooltipProvider, UploadDropzone, badgeVariants, dropdownMenuSelectOptionsMaxHeightClassName, filterSelectOptions, foldSearchText, headingVariants, isSelectSearchable, linkStyles, paragraphVariants, useFormField };
|
|
2954
|
+
//# sourceMappingURL=chunk-QHNZTXPJ.js.map
|
|
2955
|
+
//# sourceMappingURL=chunk-QHNZTXPJ.js.map
|