@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,61 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { part } from "./lib/part.js";
|
|
3
|
+
import { createPicker } from "./lib/picker.js";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
import { createRequiredContext } from "@journ/lift";
|
|
6
|
+
import { Command } from "cmdk";
|
|
7
|
+
//#region src/combobox-parts.tsx
|
|
8
|
+
const { ContextProvider, Provider, Trigger, Value, usePicker: useCombobox, usePickerState } = createPicker("Combobox", "combobox");
|
|
9
|
+
const [ItemContext, useComboboxItem] = createRequiredContext("Combobox.Item");
|
|
10
|
+
const normalize = (text) => text.normalize("NFD").replace(/\p{Diacritic}/gu, "").toLowerCase();
|
|
11
|
+
const matchKeywords = (value, search, keywords) => normalize(keywords?.length ? keywords.join(" ") : value).includes(normalize(search)) ? 1 : 0;
|
|
12
|
+
const Root = ({ value, defaultValue = null, onValueChange, children }) => {
|
|
13
|
+
const { state, actions } = usePickerState(value, defaultValue, onValueChange);
|
|
14
|
+
return /* @__PURE__ */ jsx(Provider, {
|
|
15
|
+
state,
|
|
16
|
+
actions,
|
|
17
|
+
children
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
/** Matches without accents or case, against the item's keywords when it has any. */
|
|
21
|
+
const Frame = part(Command, "combobox", {
|
|
22
|
+
loop: true,
|
|
23
|
+
filter: matchKeywords
|
|
24
|
+
});
|
|
25
|
+
const Input = part(Command.Input, "combobox-input");
|
|
26
|
+
const List = part(Command.List, "combobox-list");
|
|
27
|
+
const Empty = part(Command.Empty, "combobox-empty");
|
|
28
|
+
const Group = part(Command.Group, "combobox-group");
|
|
29
|
+
/** An option that knows nothing about the picker around it. Combobox, MultipleSelector and others build their items from it. */
|
|
30
|
+
const Option = ({ value, checked, onPick, onSelect, ...props }) => /* @__PURE__ */ jsx(ItemContext, {
|
|
31
|
+
value: { checked },
|
|
32
|
+
children: /* @__PURE__ */ jsx(Command.Item, {
|
|
33
|
+
"data-slot": "combobox-item",
|
|
34
|
+
"data-checked": checked,
|
|
35
|
+
value,
|
|
36
|
+
...props,
|
|
37
|
+
onSelect: (search) => {
|
|
38
|
+
onSelect?.(search);
|
|
39
|
+
onPick(value);
|
|
40
|
+
}
|
|
41
|
+
})
|
|
42
|
+
});
|
|
43
|
+
const Item = (props) => {
|
|
44
|
+
const { state, actions } = useCombobox();
|
|
45
|
+
return /* @__PURE__ */ jsx(Option, {
|
|
46
|
+
...props,
|
|
47
|
+
checked: state.value === props.value,
|
|
48
|
+
onPick: actions.select
|
|
49
|
+
});
|
|
50
|
+
};
|
|
51
|
+
/** Rendered only inside the checked item. */
|
|
52
|
+
const ItemIndicator = (props) => {
|
|
53
|
+
if (!useComboboxItem().checked) return null;
|
|
54
|
+
return /* @__PURE__ */ jsx("span", {
|
|
55
|
+
"data-slot": "combobox-item-indicator",
|
|
56
|
+
"aria-hidden": true,
|
|
57
|
+
...props
|
|
58
|
+
});
|
|
59
|
+
};
|
|
60
|
+
//#endregion
|
|
61
|
+
export { ContextProvider, Empty, Frame, Group, Input, Item, ItemIndicator, List, Option, Provider, Root, Trigger, Value, useCombobox };
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { ModalContentProps } from "./lib/modal-content.js";
|
|
2
|
+
import { PickerProviderProps } from "./lib/picker.js";
|
|
3
|
+
import { ComboboxActions, ComboboxContextValue, ComboboxState, Item, ItemIndicator, Root, RootProps, useCombobox } from "./combobox-parts.js";
|
|
4
|
+
//#region src/combobox.d.ts
|
|
5
|
+
declare const Combobox: {
|
|
6
|
+
Provider: ({ children, ...props }: PickerProviderProps<string, object>) => import("react").JSX.Element;
|
|
7
|
+
Root: typeof Root;
|
|
8
|
+
Trigger: (props: import("react").ComponentPropsWithRef<'button'>) => import("react").JSX.Element;
|
|
9
|
+
Value: ({ placeholder, children, ...props }: import("react").ClassAttributes<HTMLSpanElement> & import("react").HTMLAttributes<HTMLSpanElement> & {
|
|
10
|
+
placeholder?: string;
|
|
11
|
+
}) => import("react").JSX.Element;
|
|
12
|
+
Content: ({ classNames, overlayRef, ...props }: ModalContentProps<{
|
|
13
|
+
Root: typeof import("vaul").Root;
|
|
14
|
+
NestedRoot: typeof import("vaul").NestedRoot;
|
|
15
|
+
Content: React.ForwardRefExoticComponent<Omit<import("@radix-ui/react-dialog").DialogContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
16
|
+
Overlay: React.ForwardRefExoticComponent<Omit<import("@radix-ui/react-dialog").DialogOverlayProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
17
|
+
Trigger: React.ForwardRefExoticComponent<import("@radix-ui/react-dialog").DialogTriggerProps & React.RefAttributes<HTMLButtonElement>>;
|
|
18
|
+
Portal: typeof import("vaul").Portal;
|
|
19
|
+
Handle: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
20
|
+
preventCycle?: boolean | undefined;
|
|
21
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
|
22
|
+
Close: React.ForwardRefExoticComponent<import("@radix-ui/react-dialog").DialogCloseProps & React.RefAttributes<HTMLButtonElement>>;
|
|
23
|
+
Title: React.ForwardRefExoticComponent<import("@radix-ui/react-dialog").DialogTitleProps & React.RefAttributes<HTMLHeadingElement>>;
|
|
24
|
+
Description: React.ForwardRefExoticComponent<import("@radix-ui/react-dialog").DialogDescriptionProps & React.RefAttributes<HTMLParagraphElement>>;
|
|
25
|
+
}>) => import("react").JSX.Element;
|
|
26
|
+
Title: (props: import("@radix-ui/react-dialog").DialogTitleProps & import("react").RefAttributes<HTMLHeadingElement>) => import("react").ReactNode;
|
|
27
|
+
Description: (props: import("@radix-ui/react-dialog").DialogDescriptionProps & import("react").RefAttributes<HTMLParagraphElement>) => import("react").ReactNode;
|
|
28
|
+
Frame: (props: {
|
|
29
|
+
children?: React.ReactNode;
|
|
30
|
+
} & Pick<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>> & {
|
|
31
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
32
|
+
} & {
|
|
33
|
+
asChild?: boolean;
|
|
34
|
+
}, "asChild" | "key" | keyof import("react").HTMLAttributes<HTMLDivElement>> & {
|
|
35
|
+
label?: string;
|
|
36
|
+
shouldFilter?: boolean;
|
|
37
|
+
filter?: (value: string, search: string, keywords?: string[]) => number;
|
|
38
|
+
defaultValue?: string;
|
|
39
|
+
value?: string;
|
|
40
|
+
onValueChange?: (value: string) => void;
|
|
41
|
+
loop?: boolean;
|
|
42
|
+
disablePointerSelection?: boolean;
|
|
43
|
+
vimBindings?: boolean;
|
|
44
|
+
} & import("react").RefAttributes<HTMLDivElement>) => import("react").ReactNode;
|
|
45
|
+
Input: (props: Omit<Pick<Pick<import("react").DetailedHTMLProps<import("react").InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "key" | keyof import("react").InputHTMLAttributes<HTMLInputElement>> & {
|
|
46
|
+
ref?: React.Ref<HTMLInputElement>;
|
|
47
|
+
} & {
|
|
48
|
+
asChild?: boolean;
|
|
49
|
+
}, "asChild" | "key" | keyof import("react").InputHTMLAttributes<HTMLInputElement>>, "onChange" | "type" | "value"> & {
|
|
50
|
+
value?: string;
|
|
51
|
+
onValueChange?: (search: string) => void;
|
|
52
|
+
} & import("react").RefAttributes<HTMLInputElement>) => import("react").ReactNode;
|
|
53
|
+
List: (props: {
|
|
54
|
+
children?: React.ReactNode;
|
|
55
|
+
} & Pick<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>> & {
|
|
56
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
57
|
+
} & {
|
|
58
|
+
asChild?: boolean;
|
|
59
|
+
}, "asChild" | "key" | keyof import("react").HTMLAttributes<HTMLDivElement>> & {
|
|
60
|
+
label?: string;
|
|
61
|
+
} & import("react").RefAttributes<HTMLDivElement>) => import("react").ReactNode;
|
|
62
|
+
Empty: (props: {
|
|
63
|
+
children?: React.ReactNode;
|
|
64
|
+
} & Pick<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>> & {
|
|
65
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
66
|
+
} & {
|
|
67
|
+
asChild?: boolean;
|
|
68
|
+
}, "asChild" | "key" | keyof import("react").HTMLAttributes<HTMLDivElement>> & import("react").RefAttributes<HTMLDivElement>) => import("react").ReactNode;
|
|
69
|
+
Group: (props: {
|
|
70
|
+
children?: React.ReactNode;
|
|
71
|
+
} & Omit<Pick<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>> & {
|
|
72
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
73
|
+
} & {
|
|
74
|
+
asChild?: boolean;
|
|
75
|
+
}, "asChild" | "key" | keyof import("react").HTMLAttributes<HTMLDivElement>>, "heading" | "value"> & {
|
|
76
|
+
heading?: React.ReactNode;
|
|
77
|
+
value?: string;
|
|
78
|
+
forceMount?: boolean;
|
|
79
|
+
} & import("react").RefAttributes<HTMLDivElement>) => import("react").ReactNode;
|
|
80
|
+
Item: typeof Item;
|
|
81
|
+
ItemIndicator: typeof ItemIndicator;
|
|
82
|
+
};
|
|
83
|
+
//#endregion
|
|
84
|
+
export { Combobox, type ComboboxActions, type ComboboxContextValue, type RootProps as ComboboxProps, type ComboboxState, useCombobox };
|
package/dist/combobox.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Content, Description, Title } from "./drawer-parts.js";
|
|
2
|
+
import { Empty, Frame, Group, Input, Item, ItemIndicator, List, Provider, Root, Trigger, Value, useCombobox } from "./combobox-parts.js";
|
|
3
|
+
//#region src/combobox.tsx
|
|
4
|
+
const Combobox = {
|
|
5
|
+
Provider,
|
|
6
|
+
Root,
|
|
7
|
+
Trigger,
|
|
8
|
+
Value,
|
|
9
|
+
Content,
|
|
10
|
+
Title,
|
|
11
|
+
Description,
|
|
12
|
+
Frame,
|
|
13
|
+
Input,
|
|
14
|
+
List,
|
|
15
|
+
Empty,
|
|
16
|
+
Group,
|
|
17
|
+
Item,
|
|
18
|
+
ItemIndicator
|
|
19
|
+
};
|
|
20
|
+
//#endregion
|
|
21
|
+
export { Combobox, useCombobox };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Content as Content$1, Trigger } from "./dialog-parts.js";
|
|
2
|
+
import { ComponentPropsWithRef, ReactNode } from "react";
|
|
3
|
+
//#region src/command-palette-parts.d.ts
|
|
4
|
+
type RootProps = {
|
|
5
|
+
open?: boolean;
|
|
6
|
+
defaultOpen?: boolean;
|
|
7
|
+
onOpenChange?: (open: boolean) => void;
|
|
8
|
+
/** Runs when an item is chosen, with the item's `value`. The palette closes after. */
|
|
9
|
+
onSelect?: (value: string) => void;
|
|
10
|
+
/** Letter pressed with Cmd or Ctrl to toggle the palette. Pass an empty string to disable. */
|
|
11
|
+
shortcut?: string;
|
|
12
|
+
children?: ReactNode;
|
|
13
|
+
};
|
|
14
|
+
/** A dialog that hosts the combobox list parts, opened globally with a keyboard shortcut. */
|
|
15
|
+
declare const Root: ({ open, defaultOpen, onOpenChange, onSelect, shortcut, children }: RootProps) => import("react").JSX.Element;
|
|
16
|
+
type ContentProps = ComponentPropsWithRef<typeof Content$1> & {
|
|
17
|
+
/** Read by screen readers only. */
|
|
18
|
+
title?: string;
|
|
19
|
+
};
|
|
20
|
+
declare const Content: ({ title, children, ...props }: ContentProps) => import("react").JSX.Element;
|
|
21
|
+
//#endregion
|
|
22
|
+
export { Content, type ContentProps, Root, type RootProps, Trigger };
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { ContextProvider } from "./combobox-parts.js";
|
|
3
|
+
import { Content as Content$1, Root as Root$1, Title, Trigger } from "./dialog-parts.js";
|
|
4
|
+
import { visuallyHidden } from "./lib/visually-hidden.js";
|
|
5
|
+
import { useEffect } from "react";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
import { useControllableState } from "@journ/lift";
|
|
8
|
+
//#region src/command-palette-parts.tsx
|
|
9
|
+
/** A dialog that hosts the combobox list parts, opened globally with a keyboard shortcut. */
|
|
10
|
+
const Root = ({ open, defaultOpen = false, onOpenChange, onSelect, shortcut = "k", children }) => {
|
|
11
|
+
const [current, setOpen] = useControllableState(open, defaultOpen, onOpenChange);
|
|
12
|
+
const isOpen = current ?? false;
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
if (!shortcut) return;
|
|
15
|
+
const onKeyDown = (event) => {
|
|
16
|
+
if ((event.metaKey || event.ctrlKey) && event.key.toLowerCase() === shortcut.toLowerCase()) {
|
|
17
|
+
event.preventDefault();
|
|
18
|
+
setOpen(!isOpen);
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
document.addEventListener("keydown", onKeyDown);
|
|
22
|
+
return () => document.removeEventListener("keydown", onKeyDown);
|
|
23
|
+
}, [
|
|
24
|
+
shortcut,
|
|
25
|
+
isOpen,
|
|
26
|
+
setOpen
|
|
27
|
+
]);
|
|
28
|
+
return /* @__PURE__ */ jsx(ContextProvider, {
|
|
29
|
+
state: {
|
|
30
|
+
value: null,
|
|
31
|
+
open: isOpen
|
|
32
|
+
},
|
|
33
|
+
actions: {
|
|
34
|
+
setOpen,
|
|
35
|
+
select: (value) => {
|
|
36
|
+
onSelect?.(value);
|
|
37
|
+
setOpen(false);
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
children: /* @__PURE__ */ jsx(Root$1, {
|
|
41
|
+
open: isOpen,
|
|
42
|
+
onOpenChange: setOpen,
|
|
43
|
+
children
|
|
44
|
+
})
|
|
45
|
+
});
|
|
46
|
+
};
|
|
47
|
+
const Content = ({ title = "Command palette", children, ...props }) => /* @__PURE__ */ jsxs(Content$1, {
|
|
48
|
+
"aria-describedby": void 0,
|
|
49
|
+
...props,
|
|
50
|
+
children: [/* @__PURE__ */ jsx(Title, {
|
|
51
|
+
style: visuallyHidden,
|
|
52
|
+
children: title
|
|
53
|
+
}), children]
|
|
54
|
+
});
|
|
55
|
+
//#endregion
|
|
56
|
+
export { Content, Root, Trigger };
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { Item, ItemIndicator } from "./combobox-parts.js";
|
|
2
|
+
import { Content, Root, RootProps } from "./command-palette-parts.js";
|
|
3
|
+
//#region src/command-palette.d.ts
|
|
4
|
+
declare const CommandPalette: {
|
|
5
|
+
Root: typeof Root;
|
|
6
|
+
Trigger: import("react").ForwardRefExoticComponent<import("@radix-ui/react-dialog").DialogTriggerProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
7
|
+
Content: typeof Content;
|
|
8
|
+
Frame: (props: {
|
|
9
|
+
children?: React.ReactNode;
|
|
10
|
+
} & Pick<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>> & {
|
|
11
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
12
|
+
} & {
|
|
13
|
+
asChild?: boolean;
|
|
14
|
+
}, "asChild" | "key" | keyof import("react").HTMLAttributes<HTMLDivElement>> & {
|
|
15
|
+
label?: string;
|
|
16
|
+
shouldFilter?: boolean;
|
|
17
|
+
filter?: (value: string, search: string, keywords?: string[]) => number;
|
|
18
|
+
defaultValue?: string;
|
|
19
|
+
value?: string;
|
|
20
|
+
onValueChange?: (value: string) => void;
|
|
21
|
+
loop?: boolean;
|
|
22
|
+
disablePointerSelection?: boolean;
|
|
23
|
+
vimBindings?: boolean;
|
|
24
|
+
} & import("react").RefAttributes<HTMLDivElement>) => import("react").ReactNode;
|
|
25
|
+
Input: (props: Omit<Pick<Pick<import("react").DetailedHTMLProps<import("react").InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "key" | keyof import("react").InputHTMLAttributes<HTMLInputElement>> & {
|
|
26
|
+
ref?: React.Ref<HTMLInputElement>;
|
|
27
|
+
} & {
|
|
28
|
+
asChild?: boolean;
|
|
29
|
+
}, "asChild" | "key" | keyof import("react").InputHTMLAttributes<HTMLInputElement>>, "onChange" | "type" | "value"> & {
|
|
30
|
+
value?: string;
|
|
31
|
+
onValueChange?: (search: string) => void;
|
|
32
|
+
} & import("react").RefAttributes<HTMLInputElement>) => import("react").ReactNode;
|
|
33
|
+
List: (props: {
|
|
34
|
+
children?: React.ReactNode;
|
|
35
|
+
} & Pick<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>> & {
|
|
36
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
37
|
+
} & {
|
|
38
|
+
asChild?: boolean;
|
|
39
|
+
}, "asChild" | "key" | keyof import("react").HTMLAttributes<HTMLDivElement>> & {
|
|
40
|
+
label?: string;
|
|
41
|
+
} & import("react").RefAttributes<HTMLDivElement>) => import("react").ReactNode;
|
|
42
|
+
Empty: (props: {
|
|
43
|
+
children?: React.ReactNode;
|
|
44
|
+
} & Pick<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>> & {
|
|
45
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
46
|
+
} & {
|
|
47
|
+
asChild?: boolean;
|
|
48
|
+
}, "asChild" | "key" | keyof import("react").HTMLAttributes<HTMLDivElement>> & import("react").RefAttributes<HTMLDivElement>) => import("react").ReactNode;
|
|
49
|
+
Group: (props: {
|
|
50
|
+
children?: React.ReactNode;
|
|
51
|
+
} & Omit<Pick<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>> & {
|
|
52
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
53
|
+
} & {
|
|
54
|
+
asChild?: boolean;
|
|
55
|
+
}, "asChild" | "key" | keyof import("react").HTMLAttributes<HTMLDivElement>>, "heading" | "value"> & {
|
|
56
|
+
heading?: React.ReactNode;
|
|
57
|
+
value?: string;
|
|
58
|
+
forceMount?: boolean;
|
|
59
|
+
} & import("react").RefAttributes<HTMLDivElement>) => import("react").ReactNode;
|
|
60
|
+
Item: typeof Item;
|
|
61
|
+
ItemIndicator: typeof ItemIndicator;
|
|
62
|
+
};
|
|
63
|
+
//#endregion
|
|
64
|
+
export { CommandPalette, type RootProps as CommandPaletteProps };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Empty, Frame, Group, Input, Item, ItemIndicator, List } from "./combobox-parts.js";
|
|
2
|
+
import { Trigger } from "./dialog-parts.js";
|
|
3
|
+
import { Content, Root } from "./command-palette-parts.js";
|
|
4
|
+
//#region src/command-palette.tsx
|
|
5
|
+
const CommandPalette = {
|
|
6
|
+
Root,
|
|
7
|
+
Trigger,
|
|
8
|
+
Content,
|
|
9
|
+
Frame,
|
|
10
|
+
Input,
|
|
11
|
+
List,
|
|
12
|
+
Empty,
|
|
13
|
+
Group,
|
|
14
|
+
Item,
|
|
15
|
+
ItemIndicator
|
|
16
|
+
};
|
|
17
|
+
//#endregion
|
|
18
|
+
export { CommandPalette };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
//#region src/composer.d.ts
|
|
2
|
+
declare const Composer: {
|
|
3
|
+
Root: (props: import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>) => import("react").ReactNode;
|
|
4
|
+
Input: (props: import("react").DetailedHTMLProps<import("react").InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>) => import("react").ReactNode;
|
|
5
|
+
};
|
|
6
|
+
//#endregion
|
|
7
|
+
export { Composer };
|
package/dist/composer.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as RadixMenu from "@radix-ui/react-context-menu";
|
|
2
|
+
//#region src/context-menu-parts.d.ts
|
|
3
|
+
declare const Root: import("react").FC<RadixMenu.ContextMenuProps>;
|
|
4
|
+
declare const Trigger: import("react").ForwardRefExoticComponent<RadixMenu.ContextMenuTriggerProps & import("react").RefAttributes<HTMLSpanElement>>;
|
|
5
|
+
declare const Group: import("react").ForwardRefExoticComponent<RadixMenu.ContextMenuGroupProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
6
|
+
declare const Content: (props: RadixMenu.ContextMenuContentProps & import("react").RefAttributes<HTMLDivElement>) => import("react").JSX.Element, Item: (props: RadixMenu.ContextMenuItemProps & import("react").RefAttributes<HTMLDivElement>) => import("react").ReactNode, Label: (props: RadixMenu.ContextMenuLabelProps & import("react").RefAttributes<HTMLDivElement>) => import("react").ReactNode, Separator: (props: RadixMenu.ContextMenuSeparatorProps & import("react").RefAttributes<HTMLDivElement>) => import("react").ReactNode;
|
|
7
|
+
//#endregion
|
|
8
|
+
export { Content, Group, Item, Label, Root, Separator, Trigger };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { createMenuParts } from "./lib/menu-parts.js";
|
|
3
|
+
import * as RadixMenu from "@radix-ui/react-context-menu";
|
|
4
|
+
//#region src/context-menu-parts.tsx
|
|
5
|
+
const Root = RadixMenu.Root;
|
|
6
|
+
const Trigger = RadixMenu.Trigger;
|
|
7
|
+
const Group = RadixMenu.Group;
|
|
8
|
+
const { Content, Item, Label, Separator } = createMenuParts(RadixMenu, "context-menu");
|
|
9
|
+
//#endregion
|
|
10
|
+
export { Content, Group, Item, Label, Root, Separator, Trigger };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
//#region src/context-menu.d.ts
|
|
2
|
+
declare const ContextMenu: {
|
|
3
|
+
Root: import("react").FC<import("@radix-ui/react-context-menu").ContextMenuProps>;
|
|
4
|
+
Trigger: import("react").ForwardRefExoticComponent<import("@radix-ui/react-context-menu").ContextMenuTriggerProps & import("react").RefAttributes<HTMLSpanElement>>;
|
|
5
|
+
Content: (props: import("@radix-ui/react-context-menu").ContextMenuContentProps & import("react").RefAttributes<HTMLDivElement>) => import("react").JSX.Element;
|
|
6
|
+
Group: import("react").ForwardRefExoticComponent<import("@radix-ui/react-context-menu").ContextMenuGroupProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
7
|
+
Label: (props: import("@radix-ui/react-context-menu").ContextMenuLabelProps & import("react").RefAttributes<HTMLDivElement>) => import("react").ReactNode;
|
|
8
|
+
Item: (props: import("@radix-ui/react-context-menu").ContextMenuItemProps & import("react").RefAttributes<HTMLDivElement>) => import("react").ReactNode;
|
|
9
|
+
Separator: (props: import("@radix-ui/react-context-menu").ContextMenuSeparatorProps & import("react").RefAttributes<HTMLDivElement>) => import("react").ReactNode;
|
|
10
|
+
};
|
|
11
|
+
//#endregion
|
|
12
|
+
export { ContextMenu };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Content, Group, Item, Label, Root, Separator, Trigger } from "./context-menu-parts.js";
|
|
2
|
+
//#region src/context-menu.tsx
|
|
3
|
+
const ContextMenu = {
|
|
4
|
+
Root,
|
|
5
|
+
Trigger,
|
|
6
|
+
Content,
|
|
7
|
+
Group,
|
|
8
|
+
Label,
|
|
9
|
+
Item,
|
|
10
|
+
Separator
|
|
11
|
+
};
|
|
12
|
+
//#endregion
|
|
13
|
+
export { ContextMenu };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Input } from "./input.js";
|
|
2
|
+
import { ComponentPropsWithRef, ReactNode } from "react";
|
|
3
|
+
//#region src/currency-input-parts.d.ts
|
|
4
|
+
type RootProps = {
|
|
5
|
+
/** The amount, or null while empty. */
|
|
6
|
+
value?: number | null;
|
|
7
|
+
defaultValue?: number | null;
|
|
8
|
+
onValueChange?: (value: number | null) => void;
|
|
9
|
+
currency?: string;
|
|
10
|
+
locale?: string;
|
|
11
|
+
min?: number;
|
|
12
|
+
max?: number;
|
|
13
|
+
children?: ReactNode;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* An amount shown formatted ($1,234.50) and edited as plain digits. Typing is
|
|
17
|
+
* free until blur or Enter, then it is read in the locale and snapped to the bounds.
|
|
18
|
+
*/
|
|
19
|
+
declare const Root: ({ value, defaultValue, onValueChange, currency, locale, min, max, children }: RootProps) => import("react").JSX.Element;
|
|
20
|
+
declare const Field: ({ onBlur, onKeyDown, onFocus, ...props }: ComponentPropsWithRef<typeof Input>) => import("react").JSX.Element;
|
|
21
|
+
//#endregion
|
|
22
|
+
export { Field, Root, type RootProps };
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Input } from "./input.js";
|
|
3
|
+
import { commitOn } from "./lib/commit-on.js";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
import { createRequiredContext, useControllableState, useDraft } from "@journ/lift";
|
|
6
|
+
import { clamp, formatPlain, parseLocalizedNumber } from "@journ/fitter-happier";
|
|
7
|
+
//#region src/currency-input-parts.tsx
|
|
8
|
+
const [CurrencyContext, useCurrency] = createRequiredContext("CurrencyInput.Root");
|
|
9
|
+
/**
|
|
10
|
+
* An amount shown formatted ($1,234.50) and edited as plain digits. Typing is
|
|
11
|
+
* free until blur or Enter, then it is read in the locale and snapped to the bounds.
|
|
12
|
+
*/
|
|
13
|
+
const Root = ({ value, defaultValue = null, onValueChange, currency = "USD", locale = "en", min, max, children }) => {
|
|
14
|
+
const [stored, setStored] = useControllableState(value, defaultValue, onValueChange);
|
|
15
|
+
const amount = stored ?? null;
|
|
16
|
+
const money = new Intl.NumberFormat(locale, {
|
|
17
|
+
style: "currency",
|
|
18
|
+
currency
|
|
19
|
+
});
|
|
20
|
+
const { text, edit, commit } = useDraft({
|
|
21
|
+
value: amount,
|
|
22
|
+
format: (current) => current === null ? "" : money.format(current),
|
|
23
|
+
parse: (typed) => typed.trim() === "" ? null : parseLocalizedNumber(typed, locale) ?? void 0,
|
|
24
|
+
onCommit: (typed) => setStored(typed === null ? null : clamp(typed, min, max))
|
|
25
|
+
});
|
|
26
|
+
return /* @__PURE__ */ jsx(CurrencyContext, {
|
|
27
|
+
value: {
|
|
28
|
+
text,
|
|
29
|
+
edit,
|
|
30
|
+
commit,
|
|
31
|
+
locale,
|
|
32
|
+
focus: () => edit(amount === null ? "" : formatPlain(amount, locale))
|
|
33
|
+
},
|
|
34
|
+
children
|
|
35
|
+
});
|
|
36
|
+
};
|
|
37
|
+
const Field = ({ onBlur, onKeyDown, onFocus, ...props }) => {
|
|
38
|
+
const { text, edit, commit, focus } = useCurrency();
|
|
39
|
+
return /* @__PURE__ */ jsx(Input, {
|
|
40
|
+
"data-slot": "currency-input",
|
|
41
|
+
inputMode: "decimal",
|
|
42
|
+
autoComplete: "off",
|
|
43
|
+
...props,
|
|
44
|
+
value: text,
|
|
45
|
+
onChange: (event) => edit(event.target.value),
|
|
46
|
+
onFocus: (event) => {
|
|
47
|
+
onFocus?.(event);
|
|
48
|
+
focus();
|
|
49
|
+
},
|
|
50
|
+
...commitOn(commit, {
|
|
51
|
+
onBlur,
|
|
52
|
+
onKeyDown
|
|
53
|
+
})
|
|
54
|
+
});
|
|
55
|
+
};
|
|
56
|
+
//#endregion
|
|
57
|
+
export { Field, Root };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Field, Root, RootProps } from "./currency-input-parts.js";
|
|
2
|
+
//#region src/currency-input.d.ts
|
|
3
|
+
declare const CurrencyInput: {
|
|
4
|
+
Root: typeof Root;
|
|
5
|
+
Field: typeof Field;
|
|
6
|
+
};
|
|
7
|
+
//#endregion
|
|
8
|
+
export { CurrencyInput, type RootProps as CurrencyInputProps };
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { Table } from "./table.js";
|
|
2
|
+
import { ComponentPropsWithRef, ElementType, ReactNode } from "react";
|
|
3
|
+
import { ColumnDef, ReactTable, RowData, RowData as RowData$1, SortingState } from "@tanstack/react-table";
|
|
4
|
+
//#region src/data-table-parts.d.ts
|
|
5
|
+
/** The table features journ turns on. Declared once so every part sees the same types. */
|
|
6
|
+
declare const features: {
|
|
7
|
+
rowSortingFeature: import("@tanstack/react-table").TableFeature;
|
|
8
|
+
sortedRowModel: (table: import("@tanstack/react-table").Table<any, any>) => () => import("@tanstack/react-table").RowModel<any, any>;
|
|
9
|
+
rowSelectionFeature: import("@tanstack/react-table").TableFeature;
|
|
10
|
+
columnVisibilityFeature: import("@tanstack/react-table").TableFeature;
|
|
11
|
+
rowPaginationFeature: import("@tanstack/react-table").TableFeature;
|
|
12
|
+
paginatedRowModel: (table: import("@tanstack/react-table").Table<any, any>) => () => import("@tanstack/react-table").RowModel<any, any>;
|
|
13
|
+
};
|
|
14
|
+
type Features = typeof features;
|
|
15
|
+
type DataTableColumn<TData extends RowData$1> = ColumnDef<Features, TData>;
|
|
16
|
+
/** Typed helper for building columns: `const column = dataTableColumns<Row>()`. */
|
|
17
|
+
declare const dataTableColumns: <TData extends RowData$1>() => import("@tanstack/react-table").ColumnHelper<{
|
|
18
|
+
rowSortingFeature: import("@tanstack/react-table").TableFeature;
|
|
19
|
+
sortedRowModel: (table: import("@tanstack/react-table").Table<any, any>) => () => import("@tanstack/react-table").RowModel<any, any>;
|
|
20
|
+
rowSelectionFeature: import("@tanstack/react-table").TableFeature;
|
|
21
|
+
columnVisibilityFeature: import("@tanstack/react-table").TableFeature;
|
|
22
|
+
rowPaginationFeature: import("@tanstack/react-table").TableFeature;
|
|
23
|
+
paginatedRowModel: (table: import("@tanstack/react-table").Table<any, any>) => () => import("@tanstack/react-table").RowModel<any, any>;
|
|
24
|
+
}, TData>;
|
|
25
|
+
/** The components the parts render. A style layer swaps in its own; each receives the same props as the default. */
|
|
26
|
+
type DataTableComponents = {
|
|
27
|
+
Table: Record<keyof typeof Table, ElementType>;
|
|
28
|
+
Checkbox: {
|
|
29
|
+
Root: ElementType;
|
|
30
|
+
Indicator: ElementType;
|
|
31
|
+
};
|
|
32
|
+
Popover: {
|
|
33
|
+
Root: ElementType;
|
|
34
|
+
Trigger: ElementType;
|
|
35
|
+
Content: ElementType;
|
|
36
|
+
};
|
|
37
|
+
Pagination: {
|
|
38
|
+
Root: ElementType;
|
|
39
|
+
};
|
|
40
|
+
BulkBar: {
|
|
41
|
+
Root: ElementType;
|
|
42
|
+
Count: ElementType;
|
|
43
|
+
Actions: ElementType;
|
|
44
|
+
};
|
|
45
|
+
/** Opens the column picker. */
|
|
46
|
+
TriggerButton: ElementType;
|
|
47
|
+
/** Previous, next and clear selection. */
|
|
48
|
+
ActionButton: ElementType;
|
|
49
|
+
};
|
|
50
|
+
type DataTableClassNames = {
|
|
51
|
+
sortButton?: string;
|
|
52
|
+
row?: string;
|
|
53
|
+
emptyCell?: string;
|
|
54
|
+
columnPickerContent?: string;
|
|
55
|
+
columnOption?: string;
|
|
56
|
+
pagerStatus?: string;
|
|
57
|
+
};
|
|
58
|
+
type DataTableIcons = {
|
|
59
|
+
sortAscending?: ReactNode;
|
|
60
|
+
sortDescending?: ReactNode;
|
|
61
|
+
unsorted?: ReactNode;
|
|
62
|
+
columns?: ReactNode;
|
|
63
|
+
previous?: ReactNode;
|
|
64
|
+
next?: ReactNode;
|
|
65
|
+
};
|
|
66
|
+
/** The TanStack table instance, for custom parts such as a search box or a footer. */
|
|
67
|
+
declare const useDataTable: <TData extends RowData$1>() => ReactTable<Features, TData>;
|
|
68
|
+
type RootProps<TData extends RowData$1> = {
|
|
69
|
+
data: TData[];
|
|
70
|
+
columns: ColumnDef<Features, TData, any>[];
|
|
71
|
+
pageSize?: number;
|
|
72
|
+
getRowId?: (row: TData, index: number) => string;
|
|
73
|
+
initialSorting?: SortingState;
|
|
74
|
+
/** Fires with the selected rows whenever the selection changes. */
|
|
75
|
+
onSelectionChange?: (rows: TData[]) => void;
|
|
76
|
+
components?: Partial<DataTableComponents>;
|
|
77
|
+
classNames?: DataTableClassNames;
|
|
78
|
+
icons?: DataTableIcons;
|
|
79
|
+
children?: ReactNode;
|
|
80
|
+
};
|
|
81
|
+
/** Owns sorting, selection, column visibility and paging, and shares the table with its parts. */
|
|
82
|
+
declare const Root: <TData extends RowData$1>({ data, columns, pageSize, getRowId, initialSorting, onSelectionChange, components, classNames, icons, children }: RootProps<TData>) => import("react").JSX.Element;
|
|
83
|
+
declare const Toolbar: (props: ComponentPropsWithRef<'div'>) => import("react").JSX.Element;
|
|
84
|
+
type TableViewProps = ComponentPropsWithRef<'table'> & {
|
|
85
|
+
/** Shown in place of the rows when there are none. */
|
|
86
|
+
empty?: ReactNode;
|
|
87
|
+
};
|
|
88
|
+
/** Renders the header, rows and cells from the table state with the Table parts. */
|
|
89
|
+
declare const View: ({ empty, ...props }: TableViewProps) => import("react").JSX.Element;
|
|
90
|
+
/** A checkbox column with select all for the current page. Put it first in `columns`. */
|
|
91
|
+
declare const selectColumn: <TData extends RowData$1>() => DataTableColumn<TData>;
|
|
92
|
+
/** A popover with one checkbox per hideable column. Children replace the default trigger label. */
|
|
93
|
+
declare const ColumnPicker: ({ children }: {
|
|
94
|
+
children?: ReactNode;
|
|
95
|
+
}) => import("react").JSX.Element;
|
|
96
|
+
/** Previous and next with the current page. Uses buttons, since paging stays on the page. */
|
|
97
|
+
declare const Pager: (props: ComponentPropsWithRef<'nav'>) => import("react").JSX.Element;
|
|
98
|
+
/** Appears while rows are selected. Children are the bulk actions. */
|
|
99
|
+
declare const SelectionBar: ({ children, ...props }: ComponentPropsWithRef<'div'>) => import("react").JSX.Element | null;
|
|
100
|
+
//#endregion
|
|
101
|
+
export { ColumnPicker, type DataTableClassNames, type DataTableColumn, type DataTableComponents, type DataTableIcons, Pager, Root, type RootProps, type RowData, SelectionBar, type TableViewProps, Toolbar, View, dataTableColumns, selectColumn, useDataTable };
|