@squadbase/vantage 0.6.1-dev2.5f947f1 → 0.6.2-dev1.31accb1

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.
Files changed (178) hide show
  1. package/dist/add-DY4AXANK.js +6 -0
  2. package/dist/add-DY4AXANK.js.map +1 -0
  3. package/dist/{build-O5TVNH4E.js → build-TVKFIVFQ.js} +8 -8
  4. package/dist/{build-O5TVNH4E.js.map → build-TVKFIVFQ.js.map} +1 -1
  5. package/dist/{check-WFBEDHDR.js → check-3KHZXZMQ.js} +6 -6
  6. package/dist/{check-WFBEDHDR.js.map → check-3KHZXZMQ.js.map} +1 -1
  7. package/dist/{chunk-LSRMRIXA.js → chunk-AG6RZ2RR.js} +1004 -23
  8. package/dist/chunk-AG6RZ2RR.js.map +1 -0
  9. package/dist/{chunk-KLEIVDUV.js → chunk-CEXAQQ5W.js} +150 -11
  10. package/dist/chunk-CEXAQQ5W.js.map +1 -0
  11. package/dist/{chunk-JGRMRXXZ.js → chunk-JKLLFVEU.js} +3 -3
  12. package/dist/{chunk-JGRMRXXZ.js.map → chunk-JKLLFVEU.js.map} +1 -1
  13. package/dist/{chunk-EP6JHXSR.js → chunk-LMUACBMA.js} +3 -3
  14. package/dist/{chunk-EP6JHXSR.js.map → chunk-LMUACBMA.js.map} +1 -1
  15. package/dist/{chunk-RPZAALCX.js → chunk-OB6UBJXF.js} +153 -153
  16. package/dist/{chunk-RPZAALCX.js.map → chunk-OB6UBJXF.js.map} +1 -1
  17. package/dist/{chunk-BCE22JSM.js → chunk-P7W4LR3Z.js} +32 -13
  18. package/dist/chunk-P7W4LR3Z.js.map +1 -0
  19. package/dist/{chunk-3G43C6OL.js → chunk-QI3XQKHS.js} +39 -3
  20. package/dist/chunk-QI3XQKHS.js.map +1 -0
  21. package/dist/{chunk-QDZA5JSL.js → chunk-U2M6HGKQ.js} +3 -3
  22. package/dist/{chunk-QDZA5JSL.js.map → chunk-U2M6HGKQ.js.map} +1 -1
  23. package/dist/{chunk-T3FLAGI6.js → chunk-VA776YE5.js} +3 -3
  24. package/dist/{chunk-T3FLAGI6.js.map → chunk-VA776YE5.js.map} +1 -1
  25. package/dist/cli.js +14 -11
  26. package/dist/cli.js.map +1 -1
  27. package/dist/components/index.d.ts +223 -1
  28. package/dist/components/index.js +2 -2
  29. package/dist/{dev-NZRLOQCL.js → dev-GDKATCC7.js} +22 -11
  30. package/dist/dev-GDKATCC7.js.map +1 -0
  31. package/dist/doc/index.js +2 -0
  32. package/dist/doc/index.js.map +1 -1
  33. package/dist/{docs-ZGDJUHJI.js → docs-EJJ3BECT.js} +3 -3
  34. package/dist/{docs-ZGDJUHJI.js.map → docs-EJJ3BECT.js.map} +1 -1
  35. package/dist/{doctor-VFKEMR54.js → doctor-WQXPXP6K.js} +7 -7
  36. package/dist/doctor-WQXPXP6K.js.map +1 -0
  37. package/dist/{preview-QDCIVVSR.js → preview-OGMCNQUO.js} +12 -4
  38. package/dist/preview-OGMCNQUO.js.map +1 -0
  39. package/dist/{routes-RHP5FVGD.js → routes-MWBWWOJ2.js} +5 -5
  40. package/dist/{routes-RHP5FVGD.js.map → routes-MWBWWOJ2.js.map} +1 -1
  41. package/dist/{search-RFBELGY7.js → search-6Y422SV6.js} +3 -3
  42. package/dist/{search-RFBELGY7.js.map → search-6Y422SV6.js.map} +1 -1
  43. package/dist/slide/index.js +61 -15
  44. package/dist/slide/index.js.map +1 -1
  45. package/dist/table/index.js +6 -5
  46. package/dist/table/index.js.map +1 -1
  47. package/dist/ui/index.d.ts +140 -10
  48. package/dist/ui/index.js +1405 -63
  49. package/dist/ui/index.js.map +1 -1
  50. package/dist/{upgrade-GF2P67M6.js → upgrade-HCANX4GQ.js} +6 -6
  51. package/dist/{upgrade-GF2P67M6.js.map → upgrade-HCANX4GQ.js.map} +1 -1
  52. package/dist/vite/index.js +3 -3
  53. package/docs/en/changelog.md +24 -0
  54. package/docs/en/cli-reference.md +30 -0
  55. package/docs/en/parts/page-shell.md +1 -1
  56. package/docs/index.json +291 -61
  57. package/docs/ja/changelog.md +50 -0
  58. package/docs/ja/cli-reference.md +29 -0
  59. package/docs/ja/components.md +33 -89
  60. package/docs/ja/page-types/csv.md +83 -0
  61. package/docs/ja/page-types/doc.md +83 -0
  62. package/docs/ja/page-types/excel.md +82 -0
  63. package/docs/ja/page-types/slide.md +132 -0
  64. package/docs/ja/page-types.md +47 -0
  65. package/docs/ja/parts/area-chart.md +61 -0
  66. package/docs/ja/parts/bar-chart.md +69 -0
  67. package/docs/ja/parts/bar-list.md +35 -0
  68. package/docs/ja/parts/category-bar.md +36 -0
  69. package/docs/ja/parts/donut-chart.md +47 -0
  70. package/docs/ja/parts/echart.md +3 -0
  71. package/docs/ja/parts/line-chart.md +58 -0
  72. package/docs/ja/parts/page-shell.md +1 -1
  73. package/docs/ja/parts/progress-circle.md +34 -0
  74. package/docs/ja/parts/sparkline.md +1 -1
  75. package/docs/ja/parts/tracker.md +32 -0
  76. package/docs/ja/routing.md +8 -86
  77. package/docs/ja/ui/alert-dialog.md +41 -0
  78. package/docs/ja/ui/avatar.md +31 -0
  79. package/docs/ja/ui/combobox.md +74 -0
  80. package/docs/ja/ui/drawer.md +41 -0
  81. package/docs/ja/ui/field.md +42 -0
  82. package/docs/ja/ui/hover-card.md +21 -0
  83. package/docs/ja/ui/kbd.md +16 -0
  84. package/docs/ja/ui/pagination.md +36 -0
  85. package/docs/ja/ui/radio-group.md +21 -0
  86. package/docs/ja/ui/toast.md +46 -0
  87. package/docs/ja/ui-and-theming.md +14 -7
  88. package/package.json +18 -12
  89. package/registry/ui/accordion.tsx +74 -0
  90. package/registry/ui/alert-dialog.tsx +189 -0
  91. package/registry/ui/alert.tsx +78 -0
  92. package/registry/ui/app-shell.tsx +281 -0
  93. package/registry/ui/area-chart.tsx +1015 -0
  94. package/registry/ui/avatar.tsx +110 -0
  95. package/registry/ui/badge.tsx +54 -0
  96. package/registry/ui/bar-chart.tsx +1013 -0
  97. package/registry/ui/bar-list.tsx +302 -0
  98. package/registry/ui/breadcrumb.tsx +126 -0
  99. package/registry/ui/button.tsx +60 -0
  100. package/registry/ui/calendar.tsx +221 -0
  101. package/registry/ui/card.tsx +105 -0
  102. package/registry/ui/category-bar.tsx +281 -0
  103. package/registry/ui/checkbox.tsx +28 -0
  104. package/registry/ui/collapsible.tsx +21 -0
  105. package/registry/ui/combobox.tsx +310 -0
  106. package/registry/ui/command.tsx +196 -0
  107. package/registry/ui/dashboard-card.tsx +174 -0
  108. package/registry/ui/data-table.tsx +16 -91
  109. package/registry/ui/date-range-picker.tsx +209 -0
  110. package/registry/ui/dialog.tsx +159 -0
  111. package/registry/ui/donut-chart.tsx +1004 -0
  112. package/registry/ui/drawer.tsx +229 -0
  113. package/registry/ui/dropdown-menu.tsx +272 -0
  114. package/registry/ui/echart.tsx +486 -0
  115. package/registry/ui/field.tsx +240 -0
  116. package/registry/ui/filter-bar.tsx +365 -0
  117. package/registry/ui/funnel-steps.tsx +274 -0
  118. package/registry/ui/hover-card.tsx +52 -0
  119. package/registry/ui/input-group.tsx +158 -0
  120. package/registry/ui/input.tsx +22 -0
  121. package/registry/ui/kbd.tsx +28 -0
  122. package/registry/ui/label.tsx +20 -0
  123. package/registry/ui/line-chart.tsx +1007 -0
  124. package/registry/ui/metric-value.tsx +54 -0
  125. package/registry/ui/multi-select.tsx +226 -0
  126. package/registry/ui/page-shell.tsx +227 -0
  127. package/registry/ui/pagination.tsx +138 -0
  128. package/registry/ui/placeholder.tsx +30 -0
  129. package/registry/ui/popover.tsx +90 -0
  130. package/registry/ui/progress-circle.tsx +272 -0
  131. package/registry/ui/progress.tsx +83 -0
  132. package/registry/ui/radio-group.tsx +39 -0
  133. package/registry/ui/scroll-area.tsx +55 -0
  134. package/registry/ui/searchable-select.tsx +209 -0
  135. package/registry/ui/section-header.tsx +41 -0
  136. package/registry/ui/segmented-control.tsx +71 -0
  137. package/registry/ui/select.tsx +253 -0
  138. package/registry/ui/separator.tsx +25 -0
  139. package/registry/ui/sheet.tsx +137 -0
  140. package/registry/ui/sidebar.tsx +723 -0
  141. package/registry/ui/skeleton.tsx +15 -0
  142. package/registry/ui/slider.tsx +54 -0
  143. package/registry/ui/sparkline.tsx +155 -0
  144. package/registry/ui/spinner.tsx +12 -0
  145. package/registry/ui/states.tsx +61 -0
  146. package/registry/ui/status-badge.tsx +79 -0
  147. package/registry/ui/switch.tsx +32 -0
  148. package/registry/ui/table.tsx +116 -0
  149. package/registry/ui/tabs.tsx +82 -0
  150. package/registry/ui/textarea.tsx +20 -0
  151. package/registry/ui/toast.tsx +250 -0
  152. package/registry/ui/toggle-group.tsx +89 -0
  153. package/registry/ui/toggle.tsx +45 -0
  154. package/registry/ui/tooltip.tsx +66 -0
  155. package/registry/ui/tracker.tsx +236 -0
  156. package/registry/ui/trend-indicator.tsx +62 -0
  157. package/skills/vantage-add-feature/SKILL.md +9 -7
  158. package/skills/vantage-design/SKILL.md +3 -1
  159. package/skills/vantage-design/references/format.md +1 -1
  160. package/skills/vantage-pitfalls/SKILL.md +5 -1
  161. package/skills/vantage-slide/SKILL.md +17 -0
  162. package/templates/AGENTS.md +10 -1
  163. package/templates/agents/api.md +29 -0
  164. package/templates/agents/csv.md +2 -1
  165. package/templates/agents/doc.md +4 -3
  166. package/templates/agents/page.md +22 -8
  167. package/templates/agents/slide.md +13 -1
  168. package/templates/agents/xlsx.md +2 -1
  169. package/theme.css +15 -1
  170. package/dist/add-EISGSZAH.js +0 -6
  171. package/dist/add-EISGSZAH.js.map +0 -1
  172. package/dist/chunk-3G43C6OL.js.map +0 -1
  173. package/dist/chunk-BCE22JSM.js.map +0 -1
  174. package/dist/chunk-KLEIVDUV.js.map +0 -1
  175. package/dist/chunk-LSRMRIXA.js.map +0 -1
  176. package/dist/dev-NZRLOQCL.js.map +0 -1
  177. package/dist/doctor-VFKEMR54.js.map +0 -1
  178. package/dist/preview-QDCIVVSR.js.map +0 -1
@@ -1,4 +1,5 @@
1
1
  // Copied by `vantage add ui data-table`. This file is yours to edit.
2
+ // Generated from @squadbase/vantage src/components/data-table.tsx by `npm run registry` (in Vantage, edit src/, not registry/).
2
3
  /**
3
4
  * DataTable — a compound table over TanStack Table. `<DataTable>` owns the
4
5
  * table instance and publishes it on context; the toolbar, body, pagination and
@@ -39,28 +40,18 @@ import {
39
40
  } from "@tanstack/react-table"
40
41
  import { ArrowDown, ArrowUp, ArrowUpDown, Columns3, Search } from "lucide-react"
41
42
 
43
+ import { cn } from "@squadbase/vantage/ui"
44
+ import { Button } from "@squadbase/vantage/ui"
45
+ import { Checkbox } from "@squadbase/vantage/ui"
42
46
  import {
43
- Button,
44
- Checkbox,
45
47
  DropdownMenu,
46
48
  DropdownMenuCheckboxItem,
47
49
  DropdownMenuContent,
48
50
  DropdownMenuTrigger,
49
- Input,
50
- Select,
51
- SelectContent,
52
- SelectItem,
53
- SelectTrigger,
54
- SelectValue,
55
- Table,
56
- TableBody,
57
- TableCell,
58
- TableHead,
59
- TableHeader,
60
- TableRow,
61
- cn,
62
51
  } from "@squadbase/vantage/ui"
63
-
52
+ import { Input } from "@squadbase/vantage/ui"
53
+ import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@squadbase/vantage/ui"
54
+ import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@squadbase/vantage/ui"
64
55
 
65
56
  /* ------------------------------------------------------------------- types */
66
57
 
@@ -152,40 +143,17 @@ export interface DataTableColumnVisibilityProps {
152
143
  className?: string
153
144
  }
154
145
 
155
- export interface DataTablePresetProps<TData, TValue> {
156
- columns: ColumnDef<TData, TValue>[]
157
- data: TData[]
158
-
159
- enableSorting?: boolean
160
- sorting?: SortingState
161
- onSortingChange?: OnChangeFn<SortingState>
162
-
163
- enableFiltering?: boolean
164
- columnFilters?: ColumnFiltersState
165
- onColumnFiltersChange?: OnChangeFn<ColumnFiltersState>
166
- globalFilter?: string
167
- onGlobalFilterChange?: OnChangeFn<string>
168
-
169
- enablePagination?: boolean
170
- pagination?: PaginationState
171
- onPaginationChange?: OnChangeFn<PaginationState>
172
- pageCount?: number
173
-
174
- enableRowSelection?: boolean
175
- rowSelection?: RowSelectionState
176
- onRowSelectionChange?: OnChangeFn<RowSelectionState>
177
-
146
+ /** The preset takes every `DataTable` prop except `children`, plus a few slots. */
147
+ export type DataTablePresetProps<TData, TValue> = Omit<
148
+ DataTableProps<TData, TValue>,
149
+ "children"
150
+ > & {
178
151
  enableColumnVisibility?: boolean
179
- columnVisibility?: VisibilityState
180
- onColumnVisibilityChange?: OnChangeFn<VisibilityState>
181
152
  columnLabels?: Record<string, string>
182
153
 
183
154
  /** Extension slots */
184
155
  toolbar?: ReactNode
185
156
  bulkActions?: (selectedRows: TData[]) => ReactNode
186
-
187
- meta?: TableMeta<TData>
188
- className?: string
189
157
  }
190
158
 
191
159
  /* ------------------------------------------------------------------ helper */
@@ -532,7 +500,6 @@ export const DataTablePagination = forwardRef<HTMLDivElement, DataTablePaginatio
532
500
  {totalRows}件中 {rangeStart} - {rangeEnd} を表示
533
501
  </span>
534
502
  <Select
535
- items={Object.fromEntries(pageSizeOptions.map((size) => [String(size), `${size}件`]))}
536
503
  value={String(currentPageSize)}
537
504
  onValueChange={(value) => table.setPageSize(Number(value))}
538
505
  >
@@ -635,31 +602,11 @@ DataTableColumnVisibility.displayName = "DataTableColumnVisibility"
635
602
 
636
603
  /** The usual arrangement — toolbar, body and pagination — in one component. */
637
604
  export function DataTablePreset<TData, TValue>({
638
- columns,
639
- data,
640
- enableSorting,
641
- sorting,
642
- onSortingChange,
643
- enableFiltering,
644
- columnFilters,
645
- onColumnFiltersChange,
646
- globalFilter,
647
- onGlobalFilterChange,
648
- enablePagination,
649
- pagination,
650
- onPaginationChange,
651
- pageCount,
652
- enableRowSelection,
653
- rowSelection,
654
- onRowSelectionChange,
655
605
  enableColumnVisibility = false,
656
- columnVisibility,
657
- onColumnVisibilityChange,
658
606
  columnLabels,
659
607
  toolbar,
660
608
  bulkActions,
661
- meta,
662
- className,
609
+ ...tableProps
663
610
  }: DataTablePresetProps<TData, TValue>) {
664
611
  const toolbarSlot =
665
612
  toolbar || enableColumnVisibility ? (
@@ -670,36 +617,14 @@ export function DataTablePreset<TData, TValue>({
670
617
  ) : undefined
671
618
 
672
619
  return (
673
- <DataTable<TData, TValue>
674
- columns={columns}
675
- data={data}
676
- enableSorting={enableSorting}
677
- sorting={sorting}
678
- onSortingChange={onSortingChange}
679
- enableFiltering={enableFiltering}
680
- columnFilters={columnFilters}
681
- onColumnFiltersChange={onColumnFiltersChange}
682
- globalFilter={globalFilter}
683
- onGlobalFilterChange={onGlobalFilterChange}
684
- enablePagination={enablePagination}
685
- pagination={pagination}
686
- onPaginationChange={onPaginationChange}
687
- pageCount={pageCount}
688
- enableRowSelection={enableRowSelection}
689
- rowSelection={rowSelection}
690
- onRowSelectionChange={onRowSelectionChange}
691
- columnVisibility={columnVisibility}
692
- onColumnVisibilityChange={onColumnVisibilityChange}
693
- meta={meta}
694
- className={className}
695
- >
620
+ <DataTable<TData, TValue> {...tableProps}>
696
621
  <DataTableToolbar
697
- showSearch={enableFiltering}
622
+ showSearch={tableProps.enableFiltering}
698
623
  toolbar={toolbarSlot}
699
624
  bulkActions={bulkActions as ((selectedRows: unknown[]) => ReactNode) | undefined}
700
625
  />
701
626
  <DataTableContent />
702
- {enablePagination && <DataTablePagination />}
627
+ {tableProps.enablePagination && <DataTablePagination />}
703
628
  </DataTable>
704
629
  )
705
630
  }
@@ -0,0 +1,209 @@
1
+ // Copied by `vantage add ui date-range-picker`. This file is yours to edit.
2
+ // Generated from @squadbase/vantage src/components/date-range-picker.tsx by `npm run registry` (in Vantage, edit src/, not registry/).
3
+ /**
4
+ * DateRangePicker — a range calendar in a popover with quick presets down the
5
+ * side. On mobile the presets stack above a single month; on desktop they sit
6
+ * beside a two-month view.
7
+ */
8
+ import { forwardRef, useCallback, useState } from "react"
9
+ import { CalendarIcon } from "lucide-react"
10
+ import { endOfDay, endOfMonth, format, startOfDay, startOfMonth, subDays, subMonths } from "date-fns"
11
+ import { ja } from "date-fns/locale"
12
+ import type { DateRange as RdpDateRange } from "react-day-picker"
13
+
14
+ import { cn } from "@squadbase/vantage/ui"
15
+ import { useIsMobile } from "@squadbase/vantage/ui"
16
+ import { Button } from "@squadbase/vantage/ui"
17
+ import { Calendar } from "@squadbase/vantage/ui"
18
+ import { Popover, PopoverContent, PopoverTrigger } from "@squadbase/vantage/ui"
19
+ import type { DateRange, PresetItem } from "@squadbase/vantage/components"
20
+
21
+ export const defaultPresets: PresetItem[] = [
22
+ {
23
+ label: "Today",
24
+ getValue: () => {
25
+ const today = new Date()
26
+ return { from: startOfDay(today), to: endOfDay(today) }
27
+ },
28
+ },
29
+ {
30
+ label: "Yesterday",
31
+ getValue: () => {
32
+ const yesterday = subDays(new Date(), 1)
33
+ return { from: startOfDay(yesterday), to: endOfDay(yesterday) }
34
+ },
35
+ },
36
+ {
37
+ label: "Last 7 days",
38
+ getValue: () => {
39
+ const today = new Date()
40
+ return { from: startOfDay(subDays(today, 6)), to: endOfDay(today) }
41
+ },
42
+ },
43
+ {
44
+ label: "Last 14 days",
45
+ getValue: () => {
46
+ const today = new Date()
47
+ return { from: startOfDay(subDays(today, 13)), to: endOfDay(today) }
48
+ },
49
+ },
50
+ {
51
+ label: "Last 30 days",
52
+ getValue: () => {
53
+ const today = new Date()
54
+ return { from: startOfDay(subDays(today, 29)), to: endOfDay(today) }
55
+ },
56
+ },
57
+ {
58
+ label: "Last 90 days",
59
+ getValue: () => {
60
+ const today = new Date()
61
+ return { from: startOfDay(subDays(today, 89)), to: endOfDay(today) }
62
+ },
63
+ },
64
+ {
65
+ label: "This month",
66
+ getValue: () => {
67
+ const today = new Date()
68
+ return { from: startOfMonth(today), to: endOfDay(today) }
69
+ },
70
+ },
71
+ {
72
+ label: "Last month",
73
+ getValue: () => {
74
+ const lastMonth = subMonths(new Date(), 1)
75
+ return { from: startOfMonth(lastMonth), to: endOfMonth(lastMonth) }
76
+ },
77
+ },
78
+ ]
79
+
80
+ export interface DateRangePickerProps {
81
+ /**
82
+ * 選択中の日付範囲。型は Vantage 独自の `DateRange`。
83
+ * react-day-picker の `DateRange` とは別物なので注意 — そちらが必要なら
84
+ * このファイルの末尾で re-export している `RdpDateRange` を使う。
85
+ *
86
+ * @example
87
+ * import type { DateRange } from "@squadbase/vantage/components"
88
+ *
89
+ * const [range, setRange] = useState<DateRange | undefined>()
90
+ * <DateRangePicker value={range} onChange={setRange} />
91
+ */
92
+ value?: DateRange
93
+ onChange?: (range: DateRange) => void
94
+ presets?: PresetItem[]
95
+ showPresets?: boolean
96
+ maxDate?: Date
97
+ minDate?: Date
98
+ placeholder?: string
99
+ disabled?: boolean
100
+ className?: string
101
+ align?: "start" | "center" | "end"
102
+ }
103
+
104
+ export const DateRangePicker = forwardRef<HTMLDivElement, DateRangePickerProps>(
105
+ function DateRangePicker(
106
+ {
107
+ value,
108
+ onChange,
109
+ presets = defaultPresets,
110
+ showPresets = true,
111
+ maxDate,
112
+ minDate,
113
+ placeholder = "Select date range",
114
+ disabled = false,
115
+ className,
116
+ align = "start",
117
+ },
118
+ ref,
119
+ ) {
120
+ const [open, setOpen] = useState(false)
121
+ const isMobile = useIsMobile()
122
+
123
+ const handleCalendarSelect = useCallback(
124
+ (range: RdpDateRange | undefined) => {
125
+ onChange?.({ from: range?.from, to: range?.to })
126
+ },
127
+ [onChange],
128
+ )
129
+
130
+ const handlePresetClick = useCallback(
131
+ (preset: PresetItem) => {
132
+ onChange?.(preset.getValue())
133
+ setOpen(false)
134
+ },
135
+ [onChange],
136
+ )
137
+
138
+ const formatDateRange = () => {
139
+ if (!value?.from) return placeholder
140
+ if (!value.to) return format(value.from, "yyyy/MM/dd", { locale: ja })
141
+ return `${format(value.from, "yyyy/MM/dd", { locale: ja })} - ${format(value.to, "yyyy/MM/dd", { locale: ja })}`
142
+ }
143
+
144
+ const calendarSelected: RdpDateRange | undefined = value?.from
145
+ ? { from: value.from, to: value.to ?? undefined }
146
+ : undefined
147
+
148
+ return (
149
+ <div ref={ref} data-slot="date-range-picker">
150
+ <Popover open={open} onOpenChange={setOpen}>
151
+ <PopoverTrigger
152
+ render={
153
+ <Button
154
+ variant="outline"
155
+ disabled={disabled}
156
+ className={cn(
157
+ "w-auto justify-start text-left font-normal",
158
+ !value?.from && "text-muted-foreground",
159
+ className,
160
+ )}
161
+ />
162
+ }
163
+ aria-label={formatDateRange()}
164
+ aria-expanded={open}
165
+ >
166
+ <CalendarIcon className="size-4" aria-hidden="true" />
167
+ <span>{formatDateRange()}</span>
168
+ </PopoverTrigger>
169
+ <PopoverContent
170
+ align={align}
171
+ className={cn("w-auto p-0", isMobile ? "flex flex-col" : "flex")}
172
+ >
173
+ {showPresets && (
174
+ <div className={cn("flex flex-col gap-1 p-3", isMobile ? "border-b" : "border-r")}>
175
+ {presets.map((preset) => (
176
+ <Button
177
+ key={preset.label}
178
+ variant="ghost"
179
+ size="sm"
180
+ className="justify-start text-xs"
181
+ onClick={() => handlePresetClick(preset)}
182
+ >
183
+ {preset.label}
184
+ </Button>
185
+ ))}
186
+ </div>
187
+ )}
188
+ <div className="p-3">
189
+ <Calendar
190
+ mode="range"
191
+ numberOfMonths={isMobile ? 1 : 2}
192
+ selected={calendarSelected}
193
+ onSelect={handleCalendarSelect}
194
+ disabled={(date) => {
195
+ if (maxDate && date > maxDate) return true
196
+ if (minDate && date < minDate) return true
197
+ return false
198
+ }}
199
+ />
200
+ </div>
201
+ </PopoverContent>
202
+ </Popover>
203
+ </div>
204
+ )
205
+ },
206
+ )
207
+ DateRangePicker.displayName = "DateRangePicker"
208
+
209
+ export type { DateRange as RdpDateRange } from "react-day-picker"
@@ -0,0 +1,159 @@
1
+ // Copied by `vantage add ui dialog`. This file is yours to edit.
2
+ // Generated from @squadbase/vantage src/ui/dialog.tsx by `npm run registry` (in Vantage, edit src/, not registry/).
3
+ import * as React from "react"
4
+ import { Dialog as DialogPrimitive } from "@base-ui/react/dialog"
5
+
6
+ import { cn } from "@squadbase/vantage/ui"
7
+ import { Button } from "@squadbase/vantage/ui"
8
+ import { XIcon } from "lucide-react"
9
+
10
+ function Dialog({ ...props }: DialogPrimitive.Root.Props) {
11
+ return <DialogPrimitive.Root data-slot="dialog" {...props} />
12
+ }
13
+
14
+ function DialogTrigger({ ...props }: DialogPrimitive.Trigger.Props) {
15
+ return <DialogPrimitive.Trigger data-slot="dialog-trigger" {...props} />
16
+ }
17
+
18
+ function DialogPortal({ ...props }: DialogPrimitive.Portal.Props) {
19
+ return <DialogPrimitive.Portal data-slot="dialog-portal" {...props} />
20
+ }
21
+
22
+ function DialogClose({ ...props }: DialogPrimitive.Close.Props) {
23
+ return <DialogPrimitive.Close data-slot="dialog-close" {...props} />
24
+ }
25
+
26
+ function DialogOverlay({
27
+ className,
28
+ ...props
29
+ }: DialogPrimitive.Backdrop.Props) {
30
+ return (
31
+ <DialogPrimitive.Backdrop
32
+ data-slot="dialog-overlay"
33
+ className={cn(
34
+ "fixed inset-0 isolate z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0",
35
+ className
36
+ )}
37
+ {...props}
38
+ />
39
+ )
40
+ }
41
+
42
+ function DialogContent({
43
+ className,
44
+ children,
45
+ showCloseButton = true,
46
+ ...props
47
+ }: DialogPrimitive.Popup.Props & {
48
+ showCloseButton?: boolean
49
+ }) {
50
+ return (
51
+ <DialogPortal>
52
+ <DialogOverlay />
53
+ <DialogPrimitive.Popup
54
+ data-slot="dialog-content"
55
+ className={cn(
56
+ "fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl bg-popover p-4 text-sm text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",
57
+ className
58
+ )}
59
+ {...props}
60
+ >
61
+ {children}
62
+ {showCloseButton && (
63
+ <DialogPrimitive.Close
64
+ data-slot="dialog-close"
65
+ render={
66
+ <Button
67
+ variant="ghost"
68
+ className="absolute top-2 right-2"
69
+ size="icon-sm"
70
+ />
71
+ }
72
+ >
73
+ <XIcon />
74
+ <span className="sr-only">Close</span>
75
+ </DialogPrimitive.Close>
76
+ )}
77
+ </DialogPrimitive.Popup>
78
+ </DialogPortal>
79
+ )
80
+ }
81
+
82
+ function DialogHeader({ className, ...props }: React.ComponentProps<"div">) {
83
+ return (
84
+ <div
85
+ data-slot="dialog-header"
86
+ className={cn("flex flex-col gap-2", className)}
87
+ {...props}
88
+ />
89
+ )
90
+ }
91
+
92
+ function DialogFooter({
93
+ className,
94
+ showCloseButton = false,
95
+ children,
96
+ ...props
97
+ }: React.ComponentProps<"div"> & {
98
+ showCloseButton?: boolean
99
+ }) {
100
+ return (
101
+ <div
102
+ data-slot="dialog-footer"
103
+ className={cn(
104
+ "-mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-xl border-t bg-muted/50 p-4 sm:flex-row sm:justify-end",
105
+ className
106
+ )}
107
+ {...props}
108
+ >
109
+ {children}
110
+ {showCloseButton && (
111
+ <DialogPrimitive.Close render={<Button variant="outline" />}>
112
+ Close
113
+ </DialogPrimitive.Close>
114
+ )}
115
+ </div>
116
+ )
117
+ }
118
+
119
+ function DialogTitle({ className, ...props }: DialogPrimitive.Title.Props) {
120
+ return (
121
+ <DialogPrimitive.Title
122
+ data-slot="dialog-title"
123
+ className={cn(
124
+ "cn-font-heading text-base leading-none font-medium",
125
+ className
126
+ )}
127
+ {...props}
128
+ />
129
+ )
130
+ }
131
+
132
+ function DialogDescription({
133
+ className,
134
+ ...props
135
+ }: DialogPrimitive.Description.Props) {
136
+ return (
137
+ <DialogPrimitive.Description
138
+ data-slot="dialog-description"
139
+ className={cn(
140
+ "text-sm text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground",
141
+ className
142
+ )}
143
+ {...props}
144
+ />
145
+ )
146
+ }
147
+
148
+ export {
149
+ Dialog,
150
+ DialogClose,
151
+ DialogContent,
152
+ DialogDescription,
153
+ DialogFooter,
154
+ DialogHeader,
155
+ DialogOverlay,
156
+ DialogPortal,
157
+ DialogTitle,
158
+ DialogTrigger,
159
+ }