@journ/nude 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +59 -0
- package/dist/accordion-parts.d.ts +15 -0
- package/dist/accordion-parts.js +19 -0
- package/dist/accordion.d.ts +10 -0
- package/dist/accordion.js +10 -0
- package/dist/alert-dialog-parts.d.ts +13 -0
- package/dist/alert-dialog-parts.js +15 -0
- package/dist/alert-dialog.d.ts +14 -0
- package/dist/alert-dialog.js +15 -0
- package/dist/alert.d.ts +11 -0
- package/dist/alert.js +12 -0
- package/dist/animated-size.d.ts +18 -0
- package/dist/animated-size.js +55 -0
- package/dist/avatar-parts.d.ts +10 -0
- package/dist/avatar-parts.js +14 -0
- package/dist/avatar.d.ts +9 -0
- package/dist/avatar.js +9 -0
- package/dist/badge.d.ts +4 -0
- package/dist/badge.js +5 -0
- package/dist/breadcrumbs.d.ts +11 -0
- package/dist/breadcrumbs.js +15 -0
- package/dist/bulk-bar.d.ts +8 -0
- package/dist/bulk-bar.js +9 -0
- package/dist/button.d.ts +13 -0
- package/dist/button.js +21 -0
- package/dist/calendar-parts.d.ts +81 -0
- package/dist/calendar-parts.js +213 -0
- package/dist/calendar.d.ts +17 -0
- package/dist/calendar.js +17 -0
- package/dist/card.d.ts +12 -0
- package/dist/card.js +13 -0
- package/dist/carousel-parts.d.ts +29 -0
- package/dist/carousel-parts.js +98 -0
- package/dist/carousel.d.ts +11 -0
- package/dist/carousel.js +11 -0
- package/dist/checkbox-parts.d.ts +7 -0
- package/dist/checkbox-parts.js +9 -0
- package/dist/checkbox.d.ts +7 -0
- package/dist/checkbox.js +8 -0
- package/dist/chip.d.ts +22 -0
- package/dist/chip.js +29 -0
- package/dist/collapsible-parts.d.ts +7 -0
- package/dist/collapsible-parts.js +9 -0
- package/dist/collapsible.d.ts +8 -0
- package/dist/collapsible.js +9 -0
- package/dist/combobox-parts.d.ts +85 -0
- package/dist/combobox-parts.js +61 -0
- package/dist/combobox.d.ts +84 -0
- package/dist/combobox.js +21 -0
- package/dist/command-palette-parts.d.ts +22 -0
- package/dist/command-palette-parts.js +56 -0
- package/dist/command-palette.d.ts +64 -0
- package/dist/command-palette.js +18 -0
- package/dist/composer.d.ts +7 -0
- package/dist/composer.js +8 -0
- package/dist/context-menu-parts.d.ts +8 -0
- package/dist/context-menu-parts.js +10 -0
- package/dist/context-menu.d.ts +12 -0
- package/dist/context-menu.js +13 -0
- package/dist/currency-input-parts.d.ts +22 -0
- package/dist/currency-input-parts.js +57 -0
- package/dist/currency-input.d.ts +8 -0
- package/dist/currency-input.js +8 -0
- package/dist/data-table-parts.d.ts +101 -0
- package/dist/data-table-parts.js +220 -0
- package/dist/data-table.d.ts +12 -0
- package/dist/data-table.js +12 -0
- package/dist/date-input-parts.d.ts +15 -0
- package/dist/date-input-parts.js +54 -0
- package/dist/date-input.d.ts +8 -0
- package/dist/date-input.js +8 -0
- package/dist/date-picker-parts.d.ts +29 -0
- package/dist/date-picker-parts.js +33 -0
- package/dist/date-picker.d.ts +29 -0
- package/dist/date-picker.js +15 -0
- package/dist/date-range-picker-parts.d.ts +37 -0
- package/dist/date-range-picker-parts.js +63 -0
- package/dist/date-range-picker.d.ts +29 -0
- package/dist/date-range-picker.js +15 -0
- package/dist/description-list.d.ts +8 -0
- package/dist/description-list.js +9 -0
- package/dist/dialog-parts.d.ts +12 -0
- package/dist/dialog-parts.js +14 -0
- package/dist/dialog.d.ts +14 -0
- package/dist/dialog.js +15 -0
- package/dist/divider.d.ts +5 -0
- package/dist/divider.js +9 -0
- package/dist/drawer-parts.d.ts +24 -0
- package/dist/drawer-parts.js +14 -0
- package/dist/drawer.d.ts +27 -0
- package/dist/drawer.js +15 -0
- package/dist/dropdown-menu-parts.d.ts +8 -0
- package/dist/dropdown-menu-parts.js +10 -0
- package/dist/dropdown-menu.d.ts +12 -0
- package/dist/dropdown-menu.js +13 -0
- package/dist/empty-state.d.ts +10 -0
- package/dist/empty-state.js +11 -0
- package/dist/field-parts.d.ts +15 -0
- package/dist/field-parts.js +63 -0
- package/dist/field.d.ts +11 -0
- package/dist/field.js +11 -0
- package/dist/file-dropzone-parts.d.ts +34 -0
- package/dist/file-dropzone-parts.js +108 -0
- package/dist/file-dropzone.d.ts +10 -0
- package/dist/file-dropzone.js +10 -0
- package/dist/heading.d.ts +9 -0
- package/dist/heading.js +12 -0
- package/dist/hover-card-parts.d.ts +8 -0
- package/dist/hover-card-parts.js +12 -0
- package/dist/hover-card.d.ts +9 -0
- package/dist/hover-card.js +9 -0
- package/dist/icon-button.d.ts +6 -0
- package/dist/icon-button.js +5 -0
- package/dist/icon.d.ts +7 -0
- package/dist/icon.js +12 -0
- package/dist/index.d.ts +94 -0
- package/dist/index.js +87 -0
- package/dist/input.d.ts +4 -0
- package/dist/input.js +5 -0
- package/dist/lib/commit-on.d.ts +15 -0
- package/dist/lib/commit-on.js +17 -0
- package/dist/lib/menu-parts.d.ts +21 -0
- package/dist/lib/menu-parts.js +23 -0
- package/dist/lib/modal-content.d.ts +17 -0
- package/dist/lib/modal-content.js +17 -0
- package/dist/lib/modal-parts.d.ts +6 -0
- package/dist/lib/modal-parts.js +7 -0
- package/dist/lib/part.d.ts +6 -0
- package/dist/lib/part.js +13 -0
- package/dist/lib/picker.d.ts +44 -0
- package/dist/lib/picker.js +75 -0
- package/dist/lib/visually-hidden.d.ts +6 -0
- package/dist/lib/visually-hidden.js +15 -0
- package/dist/link.d.ts +9 -0
- package/dist/link.js +12 -0
- package/dist/markdown.d.ts +10 -0
- package/dist/markdown.js +10 -0
- package/dist/message.d.ts +13 -0
- package/dist/message.js +15 -0
- package/dist/month-picker-parts.d.ts +19 -0
- package/dist/month-picker-parts.js +38 -0
- package/dist/month-picker.d.ts +15 -0
- package/dist/month-picker.js +15 -0
- package/dist/month-stepper-parts.d.ts +16 -0
- package/dist/month-stepper-parts.js +52 -0
- package/dist/month-stepper.d.ts +10 -0
- package/dist/month-stepper.js +10 -0
- package/dist/multiple-selector-parts.d.ts +39 -0
- package/dist/multiple-selector-parts.js +118 -0
- package/dist/multiple-selector.d.ts +76 -0
- package/dist/multiple-selector.js +23 -0
- package/dist/nav-bar.d.ts +7 -0
- package/dist/nav-bar.js +8 -0
- package/dist/navigation-menu-parts.d.ts +18 -0
- package/dist/navigation-menu-parts.js +25 -0
- package/dist/navigation-menu.d.ts +12 -0
- package/dist/navigation-menu.js +12 -0
- package/dist/otp-input-parts.d.ts +9 -0
- package/dist/otp-input-parts.js +11 -0
- package/dist/otp-input.d.ts +8 -0
- package/dist/otp-input.js +9 -0
- package/dist/page-header.d.ts +8 -0
- package/dist/page-header.js +9 -0
- package/dist/page.d.ts +8 -0
- package/dist/page.js +9 -0
- package/dist/pagination.d.ts +13 -0
- package/dist/pagination.js +24 -0
- package/dist/pill-select.d.ts +4 -0
- package/dist/pill-select.js +5 -0
- package/dist/popover-parts.d.ts +9 -0
- package/dist/popover-parts.js +13 -0
- package/dist/popover.d.ts +10 -0
- package/dist/popover.js +10 -0
- package/dist/portal.d.ts +15 -0
- package/dist/portal.js +20 -0
- package/dist/progress-parts.d.ts +11 -0
- package/dist/progress-parts.js +32 -0
- package/dist/progress.d.ts +8 -0
- package/dist/progress.js +8 -0
- package/dist/quantity-input-parts.d.ts +21 -0
- package/dist/quantity-input-parts.js +86 -0
- package/dist/quantity-input.d.ts +10 -0
- package/dist/quantity-input.js +10 -0
- package/dist/radio-parts.d.ts +13 -0
- package/dist/radio-parts.js +17 -0
- package/dist/radio.d.ts +8 -0
- package/dist/radio.js +8 -0
- package/dist/scroll-area-parts.d.ts +17 -0
- package/dist/scroll-area-parts.js +21 -0
- package/dist/scroll-area.d.ts +10 -0
- package/dist/scroll-area.js +10 -0
- package/dist/select-parts.d.ts +26 -0
- package/dist/select-parts.js +38 -0
- package/dist/select.d.ts +14 -0
- package/dist/select.js +14 -0
- package/dist/sheet-parts.d.ts +15 -0
- package/dist/sheet-parts.js +15 -0
- package/dist/sheet.d.ts +14 -0
- package/dist/sheet.js +16 -0
- package/dist/sidebar.d.ts +14 -0
- package/dist/sidebar.js +17 -0
- package/dist/skeleton.d.ts +4 -0
- package/dist/skeleton.js +5 -0
- package/dist/slider-parts.d.ts +9 -0
- package/dist/slider-parts.js +11 -0
- package/dist/slider.d.ts +9 -0
- package/dist/slider.js +10 -0
- package/dist/spinner.d.ts +6 -0
- package/dist/spinner.js +23 -0
- package/dist/stack-parts.d.ts +22 -0
- package/dist/stack-parts.js +125 -0
- package/dist/stack.d.ts +10 -0
- package/dist/stack.js +10 -0
- package/dist/stat.d.ts +9 -0
- package/dist/stat.js +10 -0
- package/dist/step-button.d.ts +11 -0
- package/dist/step-button.js +13 -0
- package/dist/stepper-parts.d.ts +19 -0
- package/dist/stepper-parts.js +44 -0
- package/dist/stepper.d.ts +11 -0
- package/dist/stepper.js +11 -0
- package/dist/switch-parts.d.ts +6 -0
- package/dist/switch-parts.js +8 -0
- package/dist/switch.d.ts +7 -0
- package/dist/switch.js +8 -0
- package/dist/table.d.ts +12 -0
- package/dist/table.js +13 -0
- package/dist/tabs-parts.d.ts +8 -0
- package/dist/tabs-parts.js +10 -0
- package/dist/tabs.d.ts +9 -0
- package/dist/tabs.js +10 -0
- package/dist/tag-input-parts.d.ts +30 -0
- package/dist/tag-input-parts.js +99 -0
- package/dist/tag-input.d.ts +10 -0
- package/dist/tag-input.js +10 -0
- package/dist/text-morph.d.ts +17 -0
- package/dist/text-morph.js +62 -0
- package/dist/text-shimmer.d.ts +9 -0
- package/dist/text-shimmer.js +8 -0
- package/dist/text.d.ts +4 -0
- package/dist/text.js +5 -0
- package/dist/textarea.d.ts +4 -0
- package/dist/textarea.js +5 -0
- package/dist/time-range-parts.d.ts +22 -0
- package/dist/time-range-parts.js +56 -0
- package/dist/time-range.d.ts +10 -0
- package/dist/time-range.js +10 -0
- package/dist/toast-parts.d.ts +12 -0
- package/dist/toast-parts.js +21 -0
- package/dist/toast.d.ts +13 -0
- package/dist/toast.js +12 -0
- package/dist/toggle-group-parts.d.ts +6 -0
- package/dist/toggle-group-parts.js +8 -0
- package/dist/toggle-group.d.ts +7 -0
- package/dist/toggle-group.js +8 -0
- package/dist/tooltip-parts.d.ts +10 -0
- package/dist/tooltip-parts.js +17 -0
- package/dist/tooltip.d.ts +10 -0
- package/dist/tooltip.js +10 -0
- package/dist/touch-target.d.ts +6 -0
- package/dist/touch-target.js +10 -0
- package/package.json +83 -0
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { BulkBar } from "./bulk-bar.js";
|
|
3
|
+
import { Button } from "./button.js";
|
|
4
|
+
import { Indicator, Root as Root$1 } from "./checkbox-parts.js";
|
|
5
|
+
import { Pagination } from "./pagination.js";
|
|
6
|
+
import { Content, Root as Root$2, Trigger } from "./popover-parts.js";
|
|
7
|
+
import { Table } from "./table.js";
|
|
8
|
+
import { useEffect, useRef } from "react";
|
|
9
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
10
|
+
import { createRequiredContext } from "@journ/lift";
|
|
11
|
+
import { columnVisibilityFeature, createColumnHelper, createPaginatedRowModel, createSortedRowModel, rowPaginationFeature, rowSelectionFeature, rowSortingFeature, tableFeatures, useTable } from "@tanstack/react-table";
|
|
12
|
+
//#region src/data-table-parts.tsx
|
|
13
|
+
/** The table features journ turns on. Declared once so every part sees the same types. */
|
|
14
|
+
const features = tableFeatures({
|
|
15
|
+
rowSortingFeature,
|
|
16
|
+
sortedRowModel: createSortedRowModel(),
|
|
17
|
+
rowSelectionFeature,
|
|
18
|
+
columnVisibilityFeature,
|
|
19
|
+
rowPaginationFeature,
|
|
20
|
+
paginatedRowModel: createPaginatedRowModel()
|
|
21
|
+
});
|
|
22
|
+
/** Typed helper for building columns: `const column = dataTableColumns<Row>()`. */
|
|
23
|
+
const dataTableColumns = () => createColumnHelper();
|
|
24
|
+
const defaultComponents = {
|
|
25
|
+
Table,
|
|
26
|
+
Checkbox: {
|
|
27
|
+
Root: Root$1,
|
|
28
|
+
Indicator
|
|
29
|
+
},
|
|
30
|
+
Popover: {
|
|
31
|
+
Root: Root$2,
|
|
32
|
+
Trigger,
|
|
33
|
+
Content
|
|
34
|
+
},
|
|
35
|
+
Pagination,
|
|
36
|
+
BulkBar,
|
|
37
|
+
TriggerButton: Button,
|
|
38
|
+
ActionButton: Button
|
|
39
|
+
};
|
|
40
|
+
const [DataTableContext, useShared] = createRequiredContext("DataTable.Root");
|
|
41
|
+
/** The TanStack table instance, for custom parts such as a search box or a footer. */
|
|
42
|
+
const useDataTable = () => useShared().table;
|
|
43
|
+
const noClassNames = {};
|
|
44
|
+
const noIcons = {};
|
|
45
|
+
/** Owns sorting, selection, column visibility and paging, and shares the table with its parts. */
|
|
46
|
+
const Root = ({ data, columns, pageSize = 10, getRowId, initialSorting = [], onSelectionChange, components, classNames = noClassNames, icons = noIcons, children }) => {
|
|
47
|
+
const table = useTable({
|
|
48
|
+
features,
|
|
49
|
+
data,
|
|
50
|
+
columns,
|
|
51
|
+
getRowId,
|
|
52
|
+
initialState: {
|
|
53
|
+
sorting: initialSorting,
|
|
54
|
+
pagination: {
|
|
55
|
+
pageIndex: 0,
|
|
56
|
+
pageSize
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}, (state) => state);
|
|
60
|
+
const { rowSelection } = table.state;
|
|
61
|
+
const mounted = useRef(false);
|
|
62
|
+
useEffect(() => {
|
|
63
|
+
if (!mounted.current) {
|
|
64
|
+
mounted.current = true;
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
onSelectionChange?.(table.getSelectedRowModel().flatRows.map((row) => row.original));
|
|
68
|
+
}, [rowSelection]);
|
|
69
|
+
return /* @__PURE__ */ jsx(DataTableContext, {
|
|
70
|
+
value: {
|
|
71
|
+
table,
|
|
72
|
+
state: table.state,
|
|
73
|
+
components: {
|
|
74
|
+
...defaultComponents,
|
|
75
|
+
...components
|
|
76
|
+
},
|
|
77
|
+
classNames,
|
|
78
|
+
icons
|
|
79
|
+
},
|
|
80
|
+
children
|
|
81
|
+
});
|
|
82
|
+
};
|
|
83
|
+
const Toolbar = (props) => /* @__PURE__ */ jsx("div", {
|
|
84
|
+
"data-slot": "data-table-toolbar",
|
|
85
|
+
...props
|
|
86
|
+
});
|
|
87
|
+
const sortLabel = {
|
|
88
|
+
asc: "ascending",
|
|
89
|
+
desc: "descending"
|
|
90
|
+
};
|
|
91
|
+
const HeaderCell = ({ header }) => {
|
|
92
|
+
const { table, components, classNames, icons } = useShared();
|
|
93
|
+
const { column } = header;
|
|
94
|
+
const sorted = column.getIsSorted();
|
|
95
|
+
const content = header.isPlaceholder ? null : /* @__PURE__ */ jsx(table.FlexRender, { header });
|
|
96
|
+
return /* @__PURE__ */ jsx(components.Table.Header, {
|
|
97
|
+
"aria-sort": column.getCanSort() ? sorted ? sortLabel[sorted] : "none" : void 0,
|
|
98
|
+
children: column.getCanSort() ? /* @__PURE__ */ jsxs("button", {
|
|
99
|
+
type: "button",
|
|
100
|
+
"data-slot": "data-table-sort",
|
|
101
|
+
onClick: column.getToggleSortingHandler(),
|
|
102
|
+
className: classNames.sortButton,
|
|
103
|
+
children: [content, sorted === "asc" ? icons.sortAscending : sorted === "desc" ? icons.sortDescending : icons.unsorted]
|
|
104
|
+
}) : content
|
|
105
|
+
});
|
|
106
|
+
};
|
|
107
|
+
/** Renders the header, rows and cells from the table state with the Table parts. */
|
|
108
|
+
const View = ({ empty = "No results", ...props }) => {
|
|
109
|
+
const { table, components, classNames } = useShared();
|
|
110
|
+
const { Table: Parts } = components;
|
|
111
|
+
const rows = table.getRowModel().rows;
|
|
112
|
+
return /* @__PURE__ */ jsxs(Parts.Root, {
|
|
113
|
+
...props,
|
|
114
|
+
children: [/* @__PURE__ */ jsx(Parts.Head, { children: table.getHeaderGroups().map((group) => /* @__PURE__ */ jsx(Parts.Row, { children: group.headers.map((header) => /* @__PURE__ */ jsx(HeaderCell, { header }, header.id)) }, group.id)) }), /* @__PURE__ */ jsx(Parts.Body, { children: rows.length > 0 ? rows.map((row) => /* @__PURE__ */ jsx(Parts.Row, {
|
|
115
|
+
"data-state": row.getIsSelected() ? "selected" : void 0,
|
|
116
|
+
className: classNames.row,
|
|
117
|
+
children: row.getVisibleCells().map((cell) => /* @__PURE__ */ jsx(Parts.Cell, { children: /* @__PURE__ */ jsx(table.FlexRender, { cell }) }, cell.id))
|
|
118
|
+
}, row.id)) : /* @__PURE__ */ jsx(Parts.Row, { children: /* @__PURE__ */ jsx(Parts.Cell, {
|
|
119
|
+
colSpan: table.getVisibleLeafColumns().length,
|
|
120
|
+
className: classNames.emptyCell,
|
|
121
|
+
children: empty
|
|
122
|
+
}) }) })]
|
|
123
|
+
});
|
|
124
|
+
};
|
|
125
|
+
/** A checkbox built from whichever Checkbox parts the root was given. */
|
|
126
|
+
const TableCheckbox = ({ onCheckedChange, ...props }) => {
|
|
127
|
+
const { Checkbox } = useShared().components;
|
|
128
|
+
return /* @__PURE__ */ jsx(Checkbox.Root, {
|
|
129
|
+
...props,
|
|
130
|
+
onCheckedChange: (checked) => onCheckedChange(checked === true),
|
|
131
|
+
children: /* @__PURE__ */ jsx(Checkbox.Indicator, {})
|
|
132
|
+
});
|
|
133
|
+
};
|
|
134
|
+
/** A checkbox column with select all for the current page. Put it first in `columns`. */
|
|
135
|
+
const selectColumn = () => ({
|
|
136
|
+
id: "select",
|
|
137
|
+
enableSorting: false,
|
|
138
|
+
enableHiding: false,
|
|
139
|
+
header: ({ table }) => /* @__PURE__ */ jsx(TableCheckbox, {
|
|
140
|
+
"aria-label": "Select all rows",
|
|
141
|
+
checked: table.getIsAllPageRowsSelected() || table.getIsSomePageRowsSelected() && "indeterminate",
|
|
142
|
+
onCheckedChange: (checked) => table.toggleAllPageRowsSelected(checked)
|
|
143
|
+
}),
|
|
144
|
+
cell: ({ row }) => /* @__PURE__ */ jsx(TableCheckbox, {
|
|
145
|
+
"aria-label": "Select row",
|
|
146
|
+
checked: row.getIsSelected(),
|
|
147
|
+
onCheckedChange: (checked) => row.toggleSelected(checked)
|
|
148
|
+
})
|
|
149
|
+
});
|
|
150
|
+
const columnLabel = (column) => typeof column.columnDef.header === "string" ? column.columnDef.header : column.id;
|
|
151
|
+
/** A popover with one checkbox per hideable column. Children replace the default trigger label. */
|
|
152
|
+
const ColumnPicker = ({ children = "Columns" }) => {
|
|
153
|
+
const { table, components, classNames, icons } = useShared();
|
|
154
|
+
const { Popover, TriggerButton } = components;
|
|
155
|
+
const columns = table.getAllLeafColumns().filter((column) => column.getCanHide());
|
|
156
|
+
return /* @__PURE__ */ jsxs(Popover.Root, { children: [/* @__PURE__ */ jsx(Popover.Trigger, {
|
|
157
|
+
asChild: true,
|
|
158
|
+
children: /* @__PURE__ */ jsxs(TriggerButton, { children: [icons.columns, children] })
|
|
159
|
+
}), /* @__PURE__ */ jsx(Popover.Content, {
|
|
160
|
+
align: "start",
|
|
161
|
+
className: classNames.columnPickerContent,
|
|
162
|
+
children: columns.map((column) => /* @__PURE__ */ jsxs("label", {
|
|
163
|
+
"data-slot": "data-table-column-option",
|
|
164
|
+
className: classNames.columnOption,
|
|
165
|
+
children: [/* @__PURE__ */ jsx(TableCheckbox, {
|
|
166
|
+
checked: column.getIsVisible(),
|
|
167
|
+
onCheckedChange: (visible) => column.toggleVisibility(visible)
|
|
168
|
+
}), columnLabel(column)]
|
|
169
|
+
}, column.id))
|
|
170
|
+
})] });
|
|
171
|
+
};
|
|
172
|
+
/** Previous and next with the current page. Uses buttons, since paging stays on the page. */
|
|
173
|
+
const Pager = (props) => {
|
|
174
|
+
const { table, components, classNames, icons } = useShared();
|
|
175
|
+
const { ActionButton } = components;
|
|
176
|
+
const { pageIndex } = table.state.pagination;
|
|
177
|
+
return /* @__PURE__ */ jsxs(components.Pagination.Root, {
|
|
178
|
+
"aria-label": "Table pagination",
|
|
179
|
+
...props,
|
|
180
|
+
children: [
|
|
181
|
+
/* @__PURE__ */ jsxs(ActionButton, {
|
|
182
|
+
disabled: !table.getCanPreviousPage(),
|
|
183
|
+
onClick: () => table.previousPage(),
|
|
184
|
+
children: [icons.previous, "Previous"]
|
|
185
|
+
}),
|
|
186
|
+
/* @__PURE__ */ jsxs("span", {
|
|
187
|
+
"data-slot": "data-table-page",
|
|
188
|
+
"aria-live": "polite",
|
|
189
|
+
className: classNames.pagerStatus,
|
|
190
|
+
children: [
|
|
191
|
+
"Page ",
|
|
192
|
+
pageIndex + 1,
|
|
193
|
+
" of ",
|
|
194
|
+
Math.max(table.getPageCount(), 1)
|
|
195
|
+
]
|
|
196
|
+
}),
|
|
197
|
+
/* @__PURE__ */ jsxs(ActionButton, {
|
|
198
|
+
disabled: !table.getCanNextPage(),
|
|
199
|
+
onClick: () => table.nextPage(),
|
|
200
|
+
children: ["Next", icons.next]
|
|
201
|
+
})
|
|
202
|
+
]
|
|
203
|
+
});
|
|
204
|
+
};
|
|
205
|
+
/** Appears while rows are selected. Children are the bulk actions. */
|
|
206
|
+
const SelectionBar = ({ children, ...props }) => {
|
|
207
|
+
const { table, components } = useShared();
|
|
208
|
+
const { BulkBar: Bar, ActionButton } = components;
|
|
209
|
+
const count = table.getSelectedRowModel().rows.length;
|
|
210
|
+
if (count === 0) return null;
|
|
211
|
+
return /* @__PURE__ */ jsxs(Bar.Root, {
|
|
212
|
+
...props,
|
|
213
|
+
children: [/* @__PURE__ */ jsxs(Bar.Count, { children: [count, " selected"] }), /* @__PURE__ */ jsxs(Bar.Actions, { children: [children, /* @__PURE__ */ jsx(ActionButton, {
|
|
214
|
+
onClick: () => table.resetRowSelection(),
|
|
215
|
+
children: "Clear"
|
|
216
|
+
})] })]
|
|
217
|
+
});
|
|
218
|
+
};
|
|
219
|
+
//#endregion
|
|
220
|
+
export { ColumnPicker, Pager, Root, SelectionBar, Toolbar, View, dataTableColumns, selectColumn, useDataTable };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ColumnPicker, DataTableClassNames, DataTableColumn, DataTableComponents, DataTableIcons, Pager, Root, RootProps, SelectionBar, Toolbar, View, dataTableColumns, selectColumn, useDataTable } from "./data-table-parts.js";
|
|
2
|
+
//#region src/data-table.d.ts
|
|
3
|
+
declare const DataTable: {
|
|
4
|
+
Root: typeof Root;
|
|
5
|
+
Toolbar: typeof Toolbar;
|
|
6
|
+
ColumnPicker: typeof ColumnPicker;
|
|
7
|
+
Table: typeof View;
|
|
8
|
+
Pager: typeof Pager;
|
|
9
|
+
SelectionBar: typeof SelectionBar;
|
|
10
|
+
};
|
|
11
|
+
//#endregion
|
|
12
|
+
export { DataTable, type DataTableClassNames, type DataTableColumn, type DataTableComponents, type DataTableIcons, type RootProps as DataTableProps, dataTableColumns, selectColumn, useDataTable };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ColumnPicker, Pager, Root, SelectionBar, Toolbar, View, dataTableColumns, selectColumn, useDataTable } from "./data-table-parts.js";
|
|
2
|
+
//#region src/data-table.tsx
|
|
3
|
+
const DataTable = {
|
|
4
|
+
Root,
|
|
5
|
+
Toolbar,
|
|
6
|
+
ColumnPicker,
|
|
7
|
+
Table: View,
|
|
8
|
+
Pager,
|
|
9
|
+
SelectionBar
|
|
10
|
+
};
|
|
11
|
+
//#endregion
|
|
12
|
+
export { DataTable, dataTableColumns, selectColumn, useDataTable };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Input } from "./input.js";
|
|
2
|
+
import { ComponentPropsWithRef, ReactNode } from "react";
|
|
3
|
+
//#region src/date-input-parts.d.ts
|
|
4
|
+
type RootProps = {
|
|
5
|
+
value?: Date | null;
|
|
6
|
+
defaultValue?: Date | null;
|
|
7
|
+
onValueChange?: (date: Date | null) => void;
|
|
8
|
+
locale?: string;
|
|
9
|
+
children?: ReactNode;
|
|
10
|
+
};
|
|
11
|
+
/** Holds the typed text and commits a real date on blur or Enter. */
|
|
12
|
+
declare const Root: ({ value, defaultValue, onValueChange, locale, children }: RootProps) => import("react").JSX.Element;
|
|
13
|
+
declare const Field: ({ onBlur, onKeyDown, ...props }: ComponentPropsWithRef<typeof Input>) => import("react").JSX.Element;
|
|
14
|
+
//#endregion
|
|
15
|
+
export { Field, Root, type RootProps };
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Input } from "./input.js";
|
|
3
|
+
import { commitOn } from "./lib/commit-on.js";
|
|
4
|
+
import { useState } from "react";
|
|
5
|
+
import { jsx } from "react/jsx-runtime";
|
|
6
|
+
import { createRequiredContext, useControllableState } from "@journ/lift";
|
|
7
|
+
import { datePlaceholder, formatDate, parseDate } from "@journ/fitter-happier";
|
|
8
|
+
//#region src/date-input-parts.tsx
|
|
9
|
+
const [DateInputContext, useDateInput] = createRequiredContext("DateInput.Root");
|
|
10
|
+
/** Holds the typed text and commits a real date on blur or Enter. */
|
|
11
|
+
const Root = ({ value, defaultValue = null, onValueChange, locale = "en", children }) => {
|
|
12
|
+
const [date, setDate] = useControllableState(value, defaultValue, onValueChange);
|
|
13
|
+
const [text, setText] = useState(date ? formatDate(date, locale) : "");
|
|
14
|
+
const [invalid, setInvalid] = useState(false);
|
|
15
|
+
const commit = () => {
|
|
16
|
+
const parsed = parseDate(text, locale);
|
|
17
|
+
if (text.trim() && !parsed) {
|
|
18
|
+
setInvalid(true);
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
setInvalid(false);
|
|
22
|
+
setText(parsed ? formatDate(parsed, locale) : "");
|
|
23
|
+
setDate(parsed);
|
|
24
|
+
};
|
|
25
|
+
return /* @__PURE__ */ jsx(DateInputContext, {
|
|
26
|
+
value: {
|
|
27
|
+
text,
|
|
28
|
+
invalid,
|
|
29
|
+
locale,
|
|
30
|
+
setText: (next) => (setInvalid(false), setText(next)),
|
|
31
|
+
commit
|
|
32
|
+
},
|
|
33
|
+
children
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
const Field = ({ onBlur, onKeyDown, ...props }) => {
|
|
37
|
+
const { text, invalid, locale, setText, commit } = useDateInput();
|
|
38
|
+
return /* @__PURE__ */ jsx(Input, {
|
|
39
|
+
"data-slot": "date-input",
|
|
40
|
+
inputMode: "numeric",
|
|
41
|
+
autoComplete: "off",
|
|
42
|
+
placeholder: datePlaceholder(locale),
|
|
43
|
+
"aria-invalid": invalid || void 0,
|
|
44
|
+
...props,
|
|
45
|
+
value: text,
|
|
46
|
+
onChange: (event) => setText(event.target.value),
|
|
47
|
+
...commitOn(commit, {
|
|
48
|
+
onBlur,
|
|
49
|
+
onKeyDown
|
|
50
|
+
})
|
|
51
|
+
});
|
|
52
|
+
};
|
|
53
|
+
//#endregion
|
|
54
|
+
export { Field, Root };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { RootProps as RootProps$1 } from "./calendar-parts.js";
|
|
2
|
+
import { PickerActions, PickerContextValue, PickerProviderProps, PickerState } from "./lib/picker.js";
|
|
3
|
+
import { ReactNode } from "react";
|
|
4
|
+
//#region src/date-picker-parts.d.ts
|
|
5
|
+
type DatePickerMeta = {
|
|
6
|
+
locale?: string;
|
|
7
|
+
};
|
|
8
|
+
type DatePickerState = PickerState<Date>;
|
|
9
|
+
type DatePickerActions = PickerActions<Date>;
|
|
10
|
+
type DatePickerContextValue = PickerContextValue<Date, DatePickerMeta>;
|
|
11
|
+
declare const Provider: ({ children, ...props }: PickerProviderProps<Date, DatePickerMeta>) => import("react").JSX.Element, Trigger: (props: import("react").ComponentPropsWithRef<'button'>) => import("react").JSX.Element, PickerValue: ({ placeholder, children, ...props }: import("react").ClassAttributes<HTMLSpanElement> & import("react").HTMLAttributes<HTMLSpanElement> & {
|
|
12
|
+
placeholder?: string;
|
|
13
|
+
}) => import("react").JSX.Element, useDatePicker: any;
|
|
14
|
+
type RootProps = {
|
|
15
|
+
value?: Date | null;
|
|
16
|
+
defaultValue?: Date | null;
|
|
17
|
+
onValueChange?: (date: Date) => void;
|
|
18
|
+
locale?: string;
|
|
19
|
+
children?: ReactNode;
|
|
20
|
+
};
|
|
21
|
+
declare const Root: ({ value, defaultValue, onValueChange, locale, children }: RootProps) => import("react").JSX.Element;
|
|
22
|
+
type ValueProps = Omit<React.ComponentProps<typeof PickerValue>, 'children'> & {
|
|
23
|
+
format?: Intl.DateTimeFormatOptions;
|
|
24
|
+
};
|
|
25
|
+
declare const Value: ({ format, ...props }: ValueProps) => import("react").JSX.Element;
|
|
26
|
+
type CalendarProps = Omit<RootProps$1, 'value' | 'defaultValue' | 'onValueChange' | 'locale'>;
|
|
27
|
+
declare const Calendar: (props: CalendarProps) => import("react").JSX.Element;
|
|
28
|
+
//#endregion
|
|
29
|
+
export { Calendar, type DatePickerActions, type DatePickerContextValue, type DatePickerMeta, type DatePickerState, Provider, Root, type RootProps, Trigger, Value, useDatePicker };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Root as Root$1 } from "./calendar-parts.js";
|
|
3
|
+
import { createPicker } from "./lib/picker.js";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
//#region src/date-picker-parts.tsx
|
|
6
|
+
const { Provider, Trigger, Value: PickerValue, usePicker: useDatePicker, usePickerState } = createPicker("DatePicker", "date-picker");
|
|
7
|
+
const Root = ({ value, defaultValue = null, onValueChange, locale = "en", children }) => {
|
|
8
|
+
const { state, actions } = usePickerState(value, defaultValue, onValueChange);
|
|
9
|
+
return /* @__PURE__ */ jsx(Provider, {
|
|
10
|
+
state,
|
|
11
|
+
actions,
|
|
12
|
+
meta: { locale },
|
|
13
|
+
children
|
|
14
|
+
});
|
|
15
|
+
};
|
|
16
|
+
const Value = ({ format = { dateStyle: "medium" }, ...props }) => {
|
|
17
|
+
const { state, meta } = useDatePicker();
|
|
18
|
+
return /* @__PURE__ */ jsx(PickerValue, {
|
|
19
|
+
...props,
|
|
20
|
+
children: state.value && new Intl.DateTimeFormat(meta.locale, format).format(state.value)
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
const Calendar = (props) => {
|
|
24
|
+
const { state, actions, meta } = useDatePicker();
|
|
25
|
+
return /* @__PURE__ */ jsx(Root$1, {
|
|
26
|
+
...props,
|
|
27
|
+
value: state.value,
|
|
28
|
+
onValueChange: actions.select,
|
|
29
|
+
locale: meta.locale
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
//#endregion
|
|
33
|
+
export { Calendar, Provider, Root, Trigger, Value, useDatePicker };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { ModalContentProps } from "./lib/modal-content.js";
|
|
2
|
+
import { PickerProviderProps } from "./lib/picker.js";
|
|
3
|
+
import { Calendar, DatePickerActions, DatePickerContextValue, DatePickerMeta, DatePickerState, Root, RootProps, Value, useDatePicker } from "./date-picker-parts.js";
|
|
4
|
+
//#region src/date-picker.d.ts
|
|
5
|
+
declare const DatePicker: {
|
|
6
|
+
Provider: ({ children, ...props }: PickerProviderProps<Date, DatePickerMeta>) => import("react").JSX.Element;
|
|
7
|
+
Root: typeof Root;
|
|
8
|
+
Trigger: (props: import("react").ComponentPropsWithRef<'button'>) => import("react").JSX.Element;
|
|
9
|
+
Value: typeof Value;
|
|
10
|
+
Content: ({ classNames, overlayRef, ...props }: ModalContentProps<{
|
|
11
|
+
Root: typeof import("vaul").Root;
|
|
12
|
+
NestedRoot: typeof import("vaul").NestedRoot;
|
|
13
|
+
Content: React.ForwardRefExoticComponent<Omit<import("@radix-ui/react-dialog").DialogContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
14
|
+
Overlay: React.ForwardRefExoticComponent<Omit<import("@radix-ui/react-dialog").DialogOverlayProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
15
|
+
Trigger: React.ForwardRefExoticComponent<import("@radix-ui/react-dialog").DialogTriggerProps & React.RefAttributes<HTMLButtonElement>>;
|
|
16
|
+
Portal: typeof import("vaul").Portal;
|
|
17
|
+
Handle: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
18
|
+
preventCycle?: boolean | undefined;
|
|
19
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
|
20
|
+
Close: React.ForwardRefExoticComponent<import("@radix-ui/react-dialog").DialogCloseProps & React.RefAttributes<HTMLButtonElement>>;
|
|
21
|
+
Title: React.ForwardRefExoticComponent<import("@radix-ui/react-dialog").DialogTitleProps & React.RefAttributes<HTMLHeadingElement>>;
|
|
22
|
+
Description: React.ForwardRefExoticComponent<import("@radix-ui/react-dialog").DialogDescriptionProps & React.RefAttributes<HTMLParagraphElement>>;
|
|
23
|
+
}>) => import("react").JSX.Element;
|
|
24
|
+
Title: (props: import("@radix-ui/react-dialog").DialogTitleProps & import("react").RefAttributes<HTMLHeadingElement>) => import("react").ReactNode;
|
|
25
|
+
Description: (props: import("@radix-ui/react-dialog").DialogDescriptionProps & import("react").RefAttributes<HTMLParagraphElement>) => import("react").ReactNode;
|
|
26
|
+
Calendar: typeof Calendar;
|
|
27
|
+
};
|
|
28
|
+
//#endregion
|
|
29
|
+
export { DatePicker, type DatePickerActions, type DatePickerContextValue, type DatePickerMeta, type RootProps as DatePickerProps, type DatePickerState, useDatePicker };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Content, Description, Title } from "./drawer-parts.js";
|
|
2
|
+
import { Calendar, Provider, Root, Trigger, Value, useDatePicker } from "./date-picker-parts.js";
|
|
3
|
+
//#region src/date-picker.tsx
|
|
4
|
+
const DatePicker = {
|
|
5
|
+
Provider,
|
|
6
|
+
Root,
|
|
7
|
+
Trigger,
|
|
8
|
+
Value,
|
|
9
|
+
Content,
|
|
10
|
+
Title,
|
|
11
|
+
Description,
|
|
12
|
+
Calendar
|
|
13
|
+
};
|
|
14
|
+
//#endregion
|
|
15
|
+
export { DatePicker, useDatePicker };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { RootProps as RootProps$1 } from "./calendar-parts.js";
|
|
2
|
+
import { PickerActions, PickerContextValue, PickerProviderProps, PickerState } from "./lib/picker.js";
|
|
3
|
+
import { ComponentProps, ReactNode } from "react";
|
|
4
|
+
//#region src/date-range-picker-parts.d.ts
|
|
5
|
+
type DateRange = {
|
|
6
|
+
from: Date;
|
|
7
|
+
to: Date;
|
|
8
|
+
};
|
|
9
|
+
type DateRangePickerMeta = {
|
|
10
|
+
locale?: string;
|
|
11
|
+
};
|
|
12
|
+
type DateRangePickerState = PickerState<DateRange>;
|
|
13
|
+
type DateRangePickerActions = PickerActions<DateRange>;
|
|
14
|
+
type DateRangePickerContextValue = PickerContextValue<DateRange, DateRangePickerMeta>;
|
|
15
|
+
declare const Provider: ({ children, ...props }: PickerProviderProps<DateRange, DateRangePickerMeta>) => import("react").JSX.Element, Trigger: (props: import("react").ComponentPropsWithRef<'button'>) => import("react").JSX.Element, PickerValue: ({ placeholder, children, ...props }: import("react").ClassAttributes<HTMLSpanElement> & import("react").HTMLAttributes<HTMLSpanElement> & {
|
|
16
|
+
placeholder?: string;
|
|
17
|
+
}) => import("react").JSX.Element, useDateRangePicker: any;
|
|
18
|
+
type RootProps = {
|
|
19
|
+
value?: DateRange | null;
|
|
20
|
+
defaultValue?: DateRange | null;
|
|
21
|
+
onValueChange?: (range: DateRange) => void;
|
|
22
|
+
locale?: string;
|
|
23
|
+
children?: ReactNode;
|
|
24
|
+
};
|
|
25
|
+
declare const Root: ({ value, defaultValue, onValueChange, locale, children }: RootProps) => import("react").JSX.Element;
|
|
26
|
+
type ValueProps = Omit<ComponentProps<typeof PickerValue>, 'children'> & {
|
|
27
|
+
format?: Intl.DateTimeFormatOptions;
|
|
28
|
+
};
|
|
29
|
+
declare const Value: ({ format, ...props }: ValueProps) => import("react").JSX.Element;
|
|
30
|
+
type CalendarProps = Pick<RootProps$1, 'defaultMonth' | 'weekStartsOn' | 'children'>;
|
|
31
|
+
/**
|
|
32
|
+
* The first click sets one end, the second completes the range (in either
|
|
33
|
+
* order) and closes the picker. A third click on a finished range starts over.
|
|
34
|
+
*/
|
|
35
|
+
declare const Calendar: ({ defaultMonth, weekStartsOn, children }: CalendarProps) => import("react").JSX.Element;
|
|
36
|
+
//#endregion
|
|
37
|
+
export { Calendar, type DateRange, type DateRangePickerActions, type DateRangePickerContextValue, type DateRangePickerMeta, type DateRangePickerState, Provider, Root, type RootProps, Trigger, Value, useDateRangePicker };
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Provider as Provider$1, useCalendarNavigation } from "./calendar-parts.js";
|
|
3
|
+
import { createPicker } from "./lib/picker.js";
|
|
4
|
+
import { useState } from "react";
|
|
5
|
+
import { jsx } from "react/jsx-runtime";
|
|
6
|
+
//#region src/date-range-picker-parts.tsx
|
|
7
|
+
const { Provider, Trigger, Value: PickerValue, usePicker: useDateRangePicker, usePickerState } = createPicker("DateRangePicker", "date-range-picker");
|
|
8
|
+
const Root = ({ value, defaultValue = null, onValueChange, locale = "en", children }) => {
|
|
9
|
+
const { state, actions } = usePickerState(value, defaultValue, onValueChange);
|
|
10
|
+
return /* @__PURE__ */ jsx(Provider, {
|
|
11
|
+
state,
|
|
12
|
+
actions,
|
|
13
|
+
meta: { locale },
|
|
14
|
+
children
|
|
15
|
+
});
|
|
16
|
+
};
|
|
17
|
+
const Value = ({ format = { dateStyle: "medium" }, ...props }) => {
|
|
18
|
+
const { state, meta } = useDateRangePicker();
|
|
19
|
+
return /* @__PURE__ */ jsx(PickerValue, {
|
|
20
|
+
...props,
|
|
21
|
+
children: state.value && new Intl.DateTimeFormat(meta.locale, format).formatRange(state.value.from, state.value.to)
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* The first click sets one end, the second completes the range (in either
|
|
26
|
+
* order) and closes the picker. A third click on a finished range starts over.
|
|
27
|
+
*/
|
|
28
|
+
const Calendar = ({ defaultMonth, weekStartsOn = 0, children }) => {
|
|
29
|
+
const { state, actions, meta } = useDateRangePicker();
|
|
30
|
+
const [anchor, setAnchor] = useState(null);
|
|
31
|
+
const { month, view, navigation } = useCalendarNavigation(defaultMonth ?? state.value?.from ?? /* @__PURE__ */ new Date());
|
|
32
|
+
const calendarActions = {
|
|
33
|
+
...navigation,
|
|
34
|
+
select: (date) => {
|
|
35
|
+
if (!anchor) return setAnchor(date);
|
|
36
|
+
const [from, to] = date.getTime() < anchor.getTime() ? [date, anchor] : [anchor, date];
|
|
37
|
+
setAnchor(null);
|
|
38
|
+
actions.select({
|
|
39
|
+
from,
|
|
40
|
+
to
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
return /* @__PURE__ */ jsx(Provider$1, {
|
|
45
|
+
state: {
|
|
46
|
+
selected: null,
|
|
47
|
+
range: anchor ? {
|
|
48
|
+
from: anchor,
|
|
49
|
+
to: null
|
|
50
|
+
} : state.value,
|
|
51
|
+
month,
|
|
52
|
+
view
|
|
53
|
+
},
|
|
54
|
+
actions: calendarActions,
|
|
55
|
+
meta: {
|
|
56
|
+
locale: meta.locale,
|
|
57
|
+
weekStartsOn
|
|
58
|
+
},
|
|
59
|
+
children
|
|
60
|
+
});
|
|
61
|
+
};
|
|
62
|
+
//#endregion
|
|
63
|
+
export { Calendar, Provider, Root, Trigger, Value, useDateRangePicker };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { ModalContentProps } from "./lib/modal-content.js";
|
|
2
|
+
import { PickerProviderProps } from "./lib/picker.js";
|
|
3
|
+
import { Calendar, DateRange, DateRangePickerActions, DateRangePickerContextValue, DateRangePickerMeta, DateRangePickerState, Root, RootProps, Value, useDateRangePicker } from "./date-range-picker-parts.js";
|
|
4
|
+
//#region src/date-range-picker.d.ts
|
|
5
|
+
declare const DateRangePicker: {
|
|
6
|
+
Provider: ({ children, ...props }: PickerProviderProps<DateRange, DateRangePickerMeta>) => import("react").JSX.Element;
|
|
7
|
+
Root: typeof Root;
|
|
8
|
+
Trigger: (props: import("react").ComponentPropsWithRef<'button'>) => import("react").JSX.Element;
|
|
9
|
+
Value: typeof Value;
|
|
10
|
+
Content: ({ classNames, overlayRef, ...props }: ModalContentProps<{
|
|
11
|
+
Root: typeof import("vaul").Root;
|
|
12
|
+
NestedRoot: typeof import("vaul").NestedRoot;
|
|
13
|
+
Content: React.ForwardRefExoticComponent<Omit<import("@radix-ui/react-dialog").DialogContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
14
|
+
Overlay: React.ForwardRefExoticComponent<Omit<import("@radix-ui/react-dialog").DialogOverlayProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
15
|
+
Trigger: React.ForwardRefExoticComponent<import("@radix-ui/react-dialog").DialogTriggerProps & React.RefAttributes<HTMLButtonElement>>;
|
|
16
|
+
Portal: typeof import("vaul").Portal;
|
|
17
|
+
Handle: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
18
|
+
preventCycle?: boolean | undefined;
|
|
19
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
|
20
|
+
Close: React.ForwardRefExoticComponent<import("@radix-ui/react-dialog").DialogCloseProps & React.RefAttributes<HTMLButtonElement>>;
|
|
21
|
+
Title: React.ForwardRefExoticComponent<import("@radix-ui/react-dialog").DialogTitleProps & React.RefAttributes<HTMLHeadingElement>>;
|
|
22
|
+
Description: React.ForwardRefExoticComponent<import("@radix-ui/react-dialog").DialogDescriptionProps & React.RefAttributes<HTMLParagraphElement>>;
|
|
23
|
+
}>) => import("react").JSX.Element;
|
|
24
|
+
Title: (props: import("@radix-ui/react-dialog").DialogTitleProps & import("react").RefAttributes<HTMLHeadingElement>) => import("react").ReactNode;
|
|
25
|
+
Description: (props: import("@radix-ui/react-dialog").DialogDescriptionProps & import("react").RefAttributes<HTMLParagraphElement>) => import("react").ReactNode;
|
|
26
|
+
Calendar: typeof Calendar;
|
|
27
|
+
};
|
|
28
|
+
//#endregion
|
|
29
|
+
export { type DateRange, DateRangePicker, type DateRangePickerActions, type DateRangePickerContextValue, type DateRangePickerMeta, type RootProps as DateRangePickerProps, type DateRangePickerState, useDateRangePicker };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Content, Description, Title } from "./drawer-parts.js";
|
|
2
|
+
import { Calendar, Provider, Root, Trigger, Value, useDateRangePicker } from "./date-range-picker-parts.js";
|
|
3
|
+
//#region src/date-range-picker.tsx
|
|
4
|
+
const DateRangePicker = {
|
|
5
|
+
Provider,
|
|
6
|
+
Root,
|
|
7
|
+
Trigger,
|
|
8
|
+
Value,
|
|
9
|
+
Content,
|
|
10
|
+
Title,
|
|
11
|
+
Description,
|
|
12
|
+
Calendar
|
|
13
|
+
};
|
|
14
|
+
//#endregion
|
|
15
|
+
export { DateRangePicker, useDateRangePicker };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
//#region src/description-list.d.ts
|
|
2
|
+
declare const DescriptionList: {
|
|
3
|
+
Root: (props: import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDListElement>, HTMLDListElement>) => import("react").ReactNode;
|
|
4
|
+
Term: (props: import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLElement>, HTMLElement>) => import("react").ReactNode;
|
|
5
|
+
Details: (props: import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLElement>, HTMLElement>) => import("react").ReactNode;
|
|
6
|
+
};
|
|
7
|
+
//#endregion
|
|
8
|
+
export { DescriptionList };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { part } from "./lib/part.js";
|
|
2
|
+
//#region src/description-list.tsx
|
|
3
|
+
const DescriptionList = {
|
|
4
|
+
Root: part("dl", "description-list"),
|
|
5
|
+
Term: part("dt", "description-list-term"),
|
|
6
|
+
Details: part("dd", "description-list-details")
|
|
7
|
+
};
|
|
8
|
+
//#endregion
|
|
9
|
+
export { DescriptionList };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ModalContentProps } from "./lib/modal-content.js";
|
|
2
|
+
import { Actions, Body } from "./lib/modal-parts.js";
|
|
3
|
+
import * as RadixDialog from "@radix-ui/react-dialog";
|
|
4
|
+
//#region src/dialog-parts.d.ts
|
|
5
|
+
declare const Root: import("react").FC<RadixDialog.DialogProps>;
|
|
6
|
+
declare const Trigger: import("react").ForwardRefExoticComponent<RadixDialog.DialogTriggerProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
7
|
+
declare const Close: import("react").ForwardRefExoticComponent<RadixDialog.DialogCloseProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
8
|
+
declare const Content: ({ classNames, overlayRef, ...props }: ModalContentProps<typeof RadixDialog>) => import("react").JSX.Element;
|
|
9
|
+
declare const Title: (props: RadixDialog.DialogTitleProps & import("react").RefAttributes<HTMLHeadingElement>) => import("react").ReactNode;
|
|
10
|
+
declare const Description: (props: RadixDialog.DialogDescriptionProps & import("react").RefAttributes<HTMLParagraphElement>) => import("react").ReactNode;
|
|
11
|
+
//#endregion
|
|
12
|
+
export { Actions, Body, Close, Content, Description, Root, Title, Trigger };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { part } from "./lib/part.js";
|
|
3
|
+
import { createModalContent } from "./lib/modal-content.js";
|
|
4
|
+
import { Actions, Body } from "./lib/modal-parts.js";
|
|
5
|
+
import * as RadixDialog from "@radix-ui/react-dialog";
|
|
6
|
+
//#region src/dialog-parts.tsx
|
|
7
|
+
const Root = RadixDialog.Root;
|
|
8
|
+
const Trigger = RadixDialog.Trigger;
|
|
9
|
+
const Close = RadixDialog.Close;
|
|
10
|
+
const Content = createModalContent(RadixDialog, "dialog");
|
|
11
|
+
const Title = part(RadixDialog.Title, "dialog-title");
|
|
12
|
+
const Description = part(RadixDialog.Description, "dialog-description");
|
|
13
|
+
//#endregion
|
|
14
|
+
export { Actions, Body, Close, Content, Description, Root, Title, Trigger };
|