@douglasneuroinformatics/libui 2.3.1 → 2.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/ActionDropdown/ActionDropdown.d.ts +5 -1
- package/dist/components/ActionDropdown/ActionDropdown.d.ts.map +1 -1
- package/dist/components/ActionDropdown/ActionDropdown.js +3 -3
- package/dist/components/ClientTable/ClientTable.js +1 -1
- package/dist/components/Dialog/Dialog.d.ts +1 -0
- package/dist/components/Dialog/Dialog.d.ts.map +1 -1
- package/dist/components/Dialog/Dialog.js +2 -0
- package/dist/components/Dialog/DialogBody.d.ts +3 -0
- package/dist/components/Dialog/DialogBody.d.ts.map +1 -0
- package/dist/components/Dialog/DialogBody.js +5 -0
- package/dist/components/DropdownButton/DropdownButton.js +1 -1
- package/dist/components/ListboxDropdown/ListboxDropdown.d.ts +5 -2
- package/dist/components/ListboxDropdown/ListboxDropdown.d.ts.map +1 -1
- package/dist/components/ListboxDropdown/ListboxDropdown.js +4 -3
- package/dist/components/SearchBar/SearchBar.d.ts +3 -1
- package/dist/components/SearchBar/SearchBar.d.ts.map +1 -1
- package/dist/components/SearchBar/SearchBar.js +2 -2
- package/dist/components/Sheet/Sheet.d.ts +1 -0
- package/dist/components/Sheet/Sheet.d.ts.map +1 -1
- package/dist/components/Sheet/Sheet.js +2 -0
- package/dist/components/Sheet/SheetBody.d.ts +3 -0
- package/dist/components/Sheet/SheetBody.d.ts.map +1 -0
- package/dist/components/Sheet/SheetBody.js +5 -0
- package/dist/components.d.ts +0 -3
- package/dist/components.d.ts.map +1 -1
- package/dist/components.js +0 -3
- package/dist/hooks.d.ts +0 -1
- package/dist/hooks.d.ts.map +1 -1
- package/dist/hooks.js +0 -1
- package/package.json +1 -1
- package/src/components/ActionDropdown/ActionDropdown.tsx +17 -3
- package/src/components/ClientTable/ClientTable.tsx +1 -1
- package/src/components/Dialog/Dialog.tsx +2 -0
- package/src/components/Dialog/DialogBody.tsx +15 -0
- package/src/components/DropdownButton/DropdownButton.tsx +1 -1
- package/src/components/ListboxDropdown/ListboxDropdown.tsx +12 -4
- package/src/components/SearchBar/SearchBar.tsx +4 -1
- package/src/components/Sheet/Sheet.tsx +2 -0
- package/src/components/Sheet/SheetBody.tsx +15 -0
- package/src/components.ts +0 -3
- package/src/hooks.ts +0 -1
- package/dist/components/LegacyModal/LegacyModal.d.ts +0 -13
- package/dist/components/LegacyModal/LegacyModal.d.ts.map +0 -1
- package/dist/components/LegacyModal/LegacyModal.js +0 -25
- package/dist/components/LegacySlider/LegacySlider.d.ts +0 -11
- package/dist/components/LegacySlider/LegacySlider.d.ts.map +0 -1
- package/dist/components/LegacySlider/LegacySlider.js +0 -24
- package/dist/components/LegacyStepper/LegacyStepper.d.ts +0 -15
- package/dist/components/LegacyStepper/LegacyStepper.d.ts.map +0 -1
- package/dist/components/LegacyStepper/LegacyStepper.js +0 -46
- package/dist/context/LegacyStepperContext.d.ts +0 -7
- package/dist/context/LegacyStepperContext.d.ts.map +0 -1
- package/dist/context/LegacyStepperContext.js +0 -3
- package/dist/hooks/useLegacyStepper.d.ts +0 -7
- package/dist/hooks/useLegacyStepper.d.ts.map +0 -1
- package/dist/hooks/useLegacyStepper.js +0 -6
- package/src/components/LegacyModal/LegacyModal.tsx +0 -77
- package/src/components/LegacySlider/LegacySlider.tsx +0 -67
- package/src/components/LegacyStepper/LegacyStepper.tsx +0 -91
- package/src/context/LegacyStepperContext.tsx +0 -7
- package/src/hooks/useLegacyStepper.ts +0 -8
|
@@ -8,13 +8,17 @@ type ActionDropdownOptionKey<T> = T extends readonly string[] ? T[number] : T ex
|
|
|
8
8
|
} ? Extract<keyof T, string> : never;
|
|
9
9
|
export type ActionDropdownProps<T extends ActionDropdownOptions> = {
|
|
10
10
|
align?: DropdownMenuContentProps['align'];
|
|
11
|
+
contentClassName?: string;
|
|
12
|
+
disabled?: boolean;
|
|
11
13
|
/** Callback function invoked when user clicks an option */
|
|
12
14
|
onSelection: (option: ActionDropdownOptionKey<T>) => void;
|
|
13
15
|
/** Either a list of options for the dropdown, or an object with options mapped to custom labels */
|
|
14
16
|
options: T;
|
|
15
17
|
/** The text content for the dropdown toggle */
|
|
16
18
|
title: string;
|
|
19
|
+
triggerClassName?: string;
|
|
20
|
+
widthFull?: boolean;
|
|
17
21
|
};
|
|
18
|
-
export declare function ActionDropdown<const T extends ActionDropdownOptions>({ align, onSelection, options, title }: ActionDropdownProps<T>): React.JSX.Element;
|
|
22
|
+
export declare function ActionDropdown<const T extends ActionDropdownOptions>({ align, contentClassName, disabled, onSelection, options, title, triggerClassName, widthFull }: ActionDropdownProps<T>): React.JSX.Element;
|
|
19
23
|
export {};
|
|
20
24
|
//# sourceMappingURL=ActionDropdown.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActionDropdown.d.ts","sourceRoot":"","sources":["../../../src/components/ActionDropdown/ActionDropdown.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,wCAAwC,CAAC;AAEvF,KAAK,qBAAqB,GAAG;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE,GAAG,SAAS,MAAM,EAAE,CAAC;AAE3E,KAAK,uBAAuB,CAAC,CAAC,IAAI,CAAC,SAAS,SAAS,MAAM,EAAE,GACzD,CAAC,CAAC,MAAM,CAAC,GACT,CAAC,SAAS;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE,GACjC,OAAO,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,GACxB,KAAK,CAAC;AAEZ,MAAM,MAAM,mBAAmB,CAAC,CAAC,SAAS,qBAAqB,IAAI;IACjE,KAAK,CAAC,EAAE,wBAAwB,CAAC,OAAO,CAAC,CAAC;IAE1C,2DAA2D;IAC3D,WAAW,EAAE,CAAC,MAAM,EAAE,uBAAuB,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC;IAE1D,oGAAoG;IACpG,OAAO,EAAE,CAAC,CAAC;IAEX,+CAA+C;IAC/C,KAAK,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"ActionDropdown.d.ts","sourceRoot":"","sources":["../../../src/components/ActionDropdown/ActionDropdown.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,wCAAwC,CAAC;AAEvF,KAAK,qBAAqB,GAAG;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE,GAAG,SAAS,MAAM,EAAE,CAAC;AAE3E,KAAK,uBAAuB,CAAC,CAAC,IAAI,CAAC,SAAS,SAAS,MAAM,EAAE,GACzD,CAAC,CAAC,MAAM,CAAC,GACT,CAAC,SAAS;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE,GACjC,OAAO,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,GACxB,KAAK,CAAC;AAEZ,MAAM,MAAM,mBAAmB,CAAC,CAAC,SAAS,qBAAqB,IAAI;IACjE,KAAK,CAAC,EAAE,wBAAwB,CAAC,OAAO,CAAC,CAAC;IAE1C,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAE1B,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB,2DAA2D;IAC3D,WAAW,EAAE,CAAC,MAAM,EAAE,uBAAuB,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC;IAE1D,oGAAoG;IACpG,OAAO,EAAE,CAAC,CAAC;IAEX,+CAA+C;IAC/C,KAAK,EAAE,MAAM,CAAC;IAEd,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAE1B,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,CAAC;AAGF,wBAAgB,cAAc,CAAC,KAAK,CAAC,CAAC,SAAS,qBAAqB,EAAE,EACpE,KAAe,EACf,gBAAgB,EAChB,QAAQ,EACR,WAAW,EACX,OAAO,EACP,KAAK,EACL,gBAAgB,EAChB,SAAS,EACV,EAAE,mBAAmB,CAAC,CAAC,CAAC,qBA2BxB"}
|
|
@@ -2,13 +2,13 @@ import React from 'react';
|
|
|
2
2
|
import { DropdownButton } from '../DropdownButton/DropdownButton.js';
|
|
3
3
|
import { DropdownMenu } from '../DropdownMenu/DropdownMenu.js';
|
|
4
4
|
// eslint-disable-next-line react/function-component-definition
|
|
5
|
-
export function ActionDropdown({ align = 'start', onSelection, options, title }) {
|
|
5
|
+
export function ActionDropdown({ align = 'start', contentClassName, disabled, onSelection, options, title, triggerClassName, widthFull }) {
|
|
6
6
|
const optionKeys = options instanceof Array ? options : Object.keys(options);
|
|
7
7
|
return (React.createElement(DropdownMenu, null,
|
|
8
8
|
React.createElement("div", { className: "w-full" },
|
|
9
9
|
React.createElement(DropdownMenu.Trigger, { asChild: true },
|
|
10
|
-
React.createElement(DropdownButton,
|
|
11
|
-
React.createElement(DropdownMenu.Content, { align: align,
|
|
10
|
+
React.createElement(DropdownButton, { className: triggerClassName, disabled: disabled }, title)),
|
|
11
|
+
React.createElement(DropdownMenu.Content, { align: align, className: contentClassName, widthFull: widthFull },
|
|
12
12
|
React.createElement(DropdownMenu.Group, null, optionKeys.map((option) => (React.createElement(DropdownMenu.Item, { key: option, onClick: () => {
|
|
13
13
|
onSelection(option);
|
|
14
14
|
} }, Array.isArray(options) ? option : options[option]))))))));
|
|
@@ -30,7 +30,7 @@ export const ClientTable = ({ className, columnDropdownOptions, columns, data, e
|
|
|
30
30
|
const currentEntries = data.slice(firstEntry - 1, lastEntry);
|
|
31
31
|
const nRows = Math.max(currentEntries.length, minRows ?? -1);
|
|
32
32
|
return (React.createElement("div", { className: className },
|
|
33
|
-
React.createElement("div", { className: "rounded-md border bg-card tracking-tight text-muted-foreground shadow" },
|
|
33
|
+
React.createElement("div", { className: "rounded-md border bg-card tracking-tight text-muted-foreground shadow-sm" },
|
|
34
34
|
React.createElement(Table, null,
|
|
35
35
|
React.createElement(Table.Header, null,
|
|
36
36
|
React.createElement(Table.Row, null, columns.map((column, i) => (React.createElement(Table.Head, { className: "whitespace-nowrap text-foreground", key: i }, columnDropdownOptions ? (React.createElement(DropdownMenu, null,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" resolution-mode="require"/>
|
|
2
2
|
export declare const Dialog: import("react").FC<import("@radix-ui/react-dialog").DialogProps> & {
|
|
3
|
+
Body: ({ children, className, ...props }: import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>) => import("react").JSX.Element;
|
|
3
4
|
Content: import("react").ForwardRefExoticComponent<Omit<import("@radix-ui/react-dialog").DialogContentProps & import("react").RefAttributes<HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
4
5
|
Description: import("react").ForwardRefExoticComponent<Omit<import("@radix-ui/react-dialog").DialogDescriptionProps & import("react").RefAttributes<HTMLParagraphElement>, "ref"> & import("react").RefAttributes<HTMLParagraphElement>>;
|
|
5
6
|
Footer: ({ className, ...props }: import("react").HTMLAttributes<HTMLDivElement>) => import("react").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Dialog.d.ts","sourceRoot":"","sources":["../../../src/components/Dialog/Dialog.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"Dialog.d.ts","sourceRoot":"","sources":["../../../src/components/Dialog/Dialog.tsx"],"names":[],"mappings":";AASA,eAAO,MAAM,MAAM;;;;;;;;CAQjB,CAAC"}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { Root, Trigger } from '@radix-ui/react-dialog';
|
|
2
|
+
import { DialogBody } from './DialogBody.js';
|
|
2
3
|
import { DialogContent } from './DialogContent.js';
|
|
3
4
|
import { DialogDescription } from './DialogDescription.js';
|
|
4
5
|
import { DialogFooter } from './DialogFooter.js';
|
|
5
6
|
import { DialogHeader } from './DialogHeader.js';
|
|
6
7
|
import { DialogTitle } from './DialogTitle.js';
|
|
7
8
|
export const Dialog = Object.assign(Root.bind(null), {
|
|
9
|
+
Body: DialogBody,
|
|
8
10
|
Content: DialogContent,
|
|
9
11
|
Description: DialogDescription,
|
|
10
12
|
Footer: DialogFooter,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DialogBody.d.ts","sourceRoot":"","sources":["../../../src/components/Dialog/DialogBody.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,eAAO,MAAM,UAAU,sCAIpB,MAAM,iBAAiB,CAAC,MAAM,cAAc,CAAC,cAAc,CAAC,EAAE,cAAc,CAAC,sBAM/E,CAAC"}
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import { ChevronDownIcon } from 'lucide-react';
|
|
3
3
|
import { cn } from '../../utils.js';
|
|
4
4
|
export const DropdownButton = React.forwardRef(function DropdownButton({ children, className, ...props }, ref) {
|
|
5
|
-
return (React.createElement("button", { className: cn('flex h-9 w-full items-center whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1', children ? 'justify-between' : 'justify-end', className), ref: ref, type: "button", ...props },
|
|
5
|
+
return (React.createElement("button", { className: cn('flex h-9 w-full items-center gap-2 whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1', children ? 'justify-between' : 'justify-end', className), ref: ref, type: "button", ...props },
|
|
6
6
|
children,
|
|
7
7
|
React.createElement(ChevronDownIcon, { className: "h-4 w-4 opacity-50" })));
|
|
8
8
|
});
|
|
@@ -7,12 +7,15 @@ export type ListboxDropdownOption = {
|
|
|
7
7
|
export type ListboxDropdownProps<T extends ListboxDropdownOption> = {
|
|
8
8
|
checkPosition?: 'left' | 'right';
|
|
9
9
|
className?: string;
|
|
10
|
+
contentClassName?: string;
|
|
11
|
+
disabled?: boolean;
|
|
10
12
|
options: T[];
|
|
11
13
|
selected: T[];
|
|
12
14
|
setSelected: React.Dispatch<React.SetStateAction<T[]>>;
|
|
13
15
|
title: string;
|
|
14
|
-
|
|
16
|
+
triggerClassName?: string;
|
|
15
17
|
variant?: ButtonProps['variant'];
|
|
18
|
+
widthFull?: boolean;
|
|
16
19
|
};
|
|
17
|
-
export declare const ListboxDropdown: <T extends ListboxDropdownOption>({ options, selected, setSelected, title }: ListboxDropdownProps<T>) => React.JSX.Element;
|
|
20
|
+
export declare const ListboxDropdown: <T extends ListboxDropdownOption>({ contentClassName, disabled, options, selected, setSelected, title, triggerClassName, widthFull }: ListboxDropdownProps<T>) => React.JSX.Element;
|
|
18
21
|
//# sourceMappingURL=ListboxDropdown.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ListboxDropdown.d.ts","sourceRoot":"","sources":["../../../src/components/ListboxDropdown/ListboxDropdown.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"ListboxDropdown.d.ts","sourceRoot":"","sources":["../../../src/components/ListboxDropdown/ListboxDropdown.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAIvD,MAAM,MAAM,qBAAqB,GAAG;IAClC,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,oBAAoB,CAAC,CAAC,SAAS,qBAAqB,IAAI;IAClE,aAAa,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IACjC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,EAAE,CAAC,EAAE,CAAC;IACb,QAAQ,EAAE,CAAC,EAAE,CAAC;IACd,WAAW,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IACvD,KAAK,EAAE,MAAM,CAAC;IACd,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,OAAO,CAAC,EAAE,WAAW,CAAC,SAAS,CAAC,CAAC;IACjC,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,CAAC;AAEF,eAAO,MAAM,eAAe,wIASzB,qBAAqB,CAAC,CAAC,sBAiCzB,CAAC"}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { cn } from '../../utils.js';
|
|
2
3
|
import {} from '../Button/Button.js';
|
|
3
4
|
import { DropdownButton } from '../DropdownButton/DropdownButton.js';
|
|
4
5
|
import { DropdownMenu } from '../DropdownMenu/DropdownMenu.js';
|
|
5
|
-
export const ListboxDropdown = ({ options, selected, setSelected, title }) => {
|
|
6
|
+
export const ListboxDropdown = ({ contentClassName, disabled, options, selected, setSelected, title, triggerClassName, widthFull }) => {
|
|
6
7
|
return (React.createElement(DropdownMenu, null,
|
|
7
|
-
React.createElement(DropdownMenu.Trigger, { asChild: true, className:
|
|
8
|
+
React.createElement(DropdownMenu.Trigger, { asChild: true, className: cn('w-full', triggerClassName), disabled: disabled },
|
|
8
9
|
React.createElement(DropdownButton, null, title)),
|
|
9
|
-
React.createElement(DropdownMenu.Content, {
|
|
10
|
+
React.createElement(DropdownMenu.Content, { align: "start", className: contentClassName, widthFull: widthFull }, options.map((option) => {
|
|
10
11
|
const checked = Boolean(selected.find((selectedOption) => selectedOption.key === option.key));
|
|
11
12
|
return (React.createElement(DropdownMenu.CheckboxItem, { checked: checked, className: "flex w-full items-center whitespace-nowrap bg-slate-50 p-2 text-sm hover:bg-slate-200 dark:bg-slate-800 dark:hover:bg-slate-700 ", "data-cy": "select-dropdown-option", key: option.key, onSelect: (event) => {
|
|
12
13
|
event.preventDefault();
|
|
@@ -6,6 +6,8 @@ export type BaseSearchBarProps = {
|
|
|
6
6
|
onClick?: () => void;
|
|
7
7
|
/** Custom placeholder to use instead of the default */
|
|
8
8
|
placeholder?: string;
|
|
9
|
+
/** Whether the input element should be readonly */
|
|
10
|
+
readOnly?: boolean;
|
|
9
11
|
};
|
|
10
12
|
type ControlledSearchBarProps = {
|
|
11
13
|
/** Event handler called when the value changes */
|
|
@@ -18,6 +20,6 @@ type UncontrolledSearchBarProps = {
|
|
|
18
20
|
value?: never;
|
|
19
21
|
} & BaseSearchBarProps;
|
|
20
22
|
export type SearchBarProps = ControlledSearchBarProps | UncontrolledSearchBarProps;
|
|
21
|
-
export declare const SearchBar: ({ className, onClick, onValueChange, placeholder, value }: SearchBarProps) => React.JSX.Element;
|
|
23
|
+
export declare const SearchBar: ({ className, onClick, onValueChange, placeholder, readOnly, value }: SearchBarProps) => React.JSX.Element;
|
|
22
24
|
export {};
|
|
23
25
|
//# sourceMappingURL=SearchBar.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SearchBar.d.ts","sourceRoot":"","sources":["../../../src/components/SearchBar/SearchBar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAQ1B,MAAM,MAAM,kBAAkB,GAAG;IAC/B,0GAA0G;IAC1G,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,uEAAuE;IACvE,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,uDAAuD;IACvD,WAAW,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"SearchBar.d.ts","sourceRoot":"","sources":["../../../src/components/SearchBar/SearchBar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAQ1B,MAAM,MAAM,kBAAkB,GAAG;IAC/B,0GAA0G;IAC1G,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,uEAAuE;IACvE,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,uDAAuD;IACvD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,mDAAmD;IACnD,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF,KAAK,wBAAwB,GAAG;IAC9B,kDAAkD;IAClD,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,qGAAqG;IACrG,KAAK,EAAE,MAAM,CAAC;CACf,GAAG,kBAAkB,CAAC;AAEvB,KAAK,0BAA0B,GAAG;IAChC,aAAa,CAAC,EAAE,KAAK,CAAC;IACtB,KAAK,CAAC,EAAE,KAAK,CAAC;CACf,GAAG,kBAAkB,CAAC;AAEvB,MAAM,MAAM,cAAc,GAAG,wBAAwB,GAAG,0BAA0B,CAAC;AAEnF,eAAO,MAAM,SAAS,wEAAyE,cAAc,sBAkB5G,CAAC"}
|
|
@@ -3,11 +3,11 @@ import { SearchIcon } from 'lucide-react';
|
|
|
3
3
|
import { useTranslation } from 'react-i18next';
|
|
4
4
|
import { cn } from '../../utils.js';
|
|
5
5
|
import { Input } from '../Input/Input.js';
|
|
6
|
-
export const SearchBar = ({ className, onClick, onValueChange, placeholder, value }) => {
|
|
6
|
+
export const SearchBar = ({ className, onClick, onValueChange, placeholder, readOnly, value }) => {
|
|
7
7
|
const { t } = useTranslation('libui');
|
|
8
8
|
return (React.createElement("form", { className: cn('relative', className) },
|
|
9
9
|
React.createElement(SearchIcon, { className: "absolute left-2 top-2.5 h-4 w-4 text-muted-foreground" }),
|
|
10
|
-
React.createElement(Input, { className: "pl-8", placeholder: placeholder ?? t('searchBar.placeholder'), type: "search", value: value, onChange: (event) => {
|
|
10
|
+
React.createElement(Input, { className: "pl-8", placeholder: placeholder ?? t('searchBar.placeholder'), readOnly: readOnly, type: "search", value: value, onChange: (event) => {
|
|
11
11
|
onValueChange?.(event.target.value);
|
|
12
12
|
}, onClick: () => onClick?.() })));
|
|
13
13
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" resolution-mode="require"/>
|
|
2
2
|
export declare const Sheet: import("react").FC<import("@radix-ui/react-dialog").DialogProps> & {
|
|
3
|
+
Body: ({ children, className, ...props }: import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>) => import("react").JSX.Element;
|
|
3
4
|
Close: import("react").ForwardRefExoticComponent<import("@radix-ui/react-dialog").DialogCloseProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
4
5
|
Content: import("react").ForwardRefExoticComponent<Omit<import("@radix-ui/react-dialog").DialogContentProps & import("react").RefAttributes<HTMLDivElement>, "ref"> & import("class-variance-authority").VariantProps<(props?: ({
|
|
5
6
|
side?: "top" | "right" | "bottom" | "left" | null | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Sheet.d.ts","sourceRoot":"","sources":["../../../src/components/Sheet/Sheet.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"Sheet.d.ts","sourceRoot":"","sources":["../../../src/components/Sheet/Sheet.tsx"],"names":[],"mappings":";AAUA,eAAO,MAAM,KAAK;;;;;;;;;;;;;CAWhB,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Close, Portal, Root, Trigger } from '@radix-ui/react-dialog';
|
|
2
|
+
import { SheetBody } from './SheetBody.js';
|
|
2
3
|
import { SheetContent } from './SheetContent.js';
|
|
3
4
|
import { SheetDescription } from './SheetDescription.js';
|
|
4
5
|
import { SheetFooter } from './SheetFooter.js';
|
|
@@ -6,6 +7,7 @@ import { SheetHeader } from './SheetHeader.js';
|
|
|
6
7
|
import { SheetOverlay } from './SheetOverlay.js';
|
|
7
8
|
import { SheetTitle } from './SheetTitle.js';
|
|
8
9
|
export const Sheet = Object.assign(Root.bind(null), {
|
|
10
|
+
Body: SheetBody,
|
|
9
11
|
Close,
|
|
10
12
|
Content: SheetContent,
|
|
11
13
|
Description: SheetDescription,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SheetBody.d.ts","sourceRoot":"","sources":["../../../src/components/Sheet/SheetBody.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,eAAO,MAAM,SAAS,sCAInB,MAAM,iBAAiB,CAAC,MAAM,cAAc,CAAC,cAAc,CAAC,EAAE,cAAc,CAAC,sBAM/E,CAAC"}
|
package/dist/components.d.ts
CHANGED
|
@@ -25,9 +25,6 @@ export * from './components/HoverCard/HoverCard.js';
|
|
|
25
25
|
export * from './components/Input/Input.js';
|
|
26
26
|
export * from './components/Label/Label.js';
|
|
27
27
|
export * from './components/LanguageToggle/LanguageToggle.js';
|
|
28
|
-
export * from './components/LegacyModal/LegacyModal.js';
|
|
29
|
-
export * from './components/LegacySlider/LegacySlider.js';
|
|
30
|
-
export * from './components/LegacyStepper/LegacyStepper.js';
|
|
31
28
|
export * from './components/LineGraph/LineGraph.js';
|
|
32
29
|
export * from './components/ListboxDropdown/ListboxDropdown.js';
|
|
33
30
|
export * from './components/MenuBar/MenuBar.js';
|
package/dist/components.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"components.d.ts","sourceRoot":"","sources":["../src/components.ts"],"names":[],"mappings":"AAAA,cAAc,qCAAqC,CAAC;AACpD,cAAc,+CAA+C,CAAC;AAC9D,cAAc,yCAAyC,CAAC;AACxD,cAAc,yCAAyC,CAAC;AACxD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,uCAAuC,CAAC;AACtD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,mCAAmC,CAAC;AAClD,cAAc,yCAAyC,CAAC;AACxD,cAAc,yCAAyC,CAAC;AACxD,cAAc,iCAAiC,CAAC;AAChD,cAAc,yCAAyC,CAAC;AACxD,cAAc,uCAAuC,CAAC;AACtD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,+CAA+C,CAAC;AAC9D,cAAc,2CAA2C,CAAC;AAC1D,cAAc,6CAA6C,CAAC;AAC5D,cAAc,6CAA6C,CAAC;AAC5D,cAAc,2BAA2B,CAAC;AAC1C,cAAc,iCAAiC,CAAC;AAChD,cAAc,qCAAqC,CAAC;AACpD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,+CAA+C,CAAC;AAC9D,cAAc,
|
|
1
|
+
{"version":3,"file":"components.d.ts","sourceRoot":"","sources":["../src/components.ts"],"names":[],"mappings":"AAAA,cAAc,qCAAqC,CAAC;AACpD,cAAc,+CAA+C,CAAC;AAC9D,cAAc,yCAAyC,CAAC;AACxD,cAAc,yCAAyC,CAAC;AACxD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,uCAAuC,CAAC;AACtD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,mCAAmC,CAAC;AAClD,cAAc,yCAAyC,CAAC;AACxD,cAAc,yCAAyC,CAAC;AACxD,cAAc,iCAAiC,CAAC;AAChD,cAAc,yCAAyC,CAAC;AACxD,cAAc,uCAAuC,CAAC;AACtD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,+CAA+C,CAAC;AAC9D,cAAc,2CAA2C,CAAC;AAC1D,cAAc,6CAA6C,CAAC;AAC5D,cAAc,6CAA6C,CAAC;AAC5D,cAAc,2BAA2B,CAAC;AAC1C,cAAc,iCAAiC,CAAC;AAChD,cAAc,qCAAqC,CAAC;AACpD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,+CAA+C,CAAC;AAC9D,cAAc,qCAAqC,CAAC;AACpD,cAAc,iDAAiD,CAAC;AAChE,cAAc,iCAAiC,CAAC;AAChD,cAAc,iDAAiD,CAAC;AAChE,cAAc,uCAAuC,CAAC;AACtD,cAAc,iCAAiC,CAAC;AAChD,cAAc,mCAAmC,CAAC;AAClD,cAAc,uCAAuC,CAAC;AACtD,cAAc,qCAAqC,CAAC;AACpD,cAAc,uCAAuC,CAAC;AACtD,cAAc,qCAAqC,CAAC;AACpD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,qCAAqC,CAAC;AACpD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,iCAAiC,CAAC;AAChD,cAAc,yCAAyC,CAAC;AACxD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,mCAAmC,CAAC;AAClD,cAAc,yCAAyC,CAAC;AACxD,cAAc,iCAAiC,CAAC"}
|
package/dist/components.js
CHANGED
|
@@ -25,9 +25,6 @@ export * from './components/HoverCard/HoverCard.js';
|
|
|
25
25
|
export * from './components/Input/Input.js';
|
|
26
26
|
export * from './components/Label/Label.js';
|
|
27
27
|
export * from './components/LanguageToggle/LanguageToggle.js';
|
|
28
|
-
export * from './components/LegacyModal/LegacyModal.js';
|
|
29
|
-
export * from './components/LegacySlider/LegacySlider.js';
|
|
30
|
-
export * from './components/LegacyStepper/LegacyStepper.js';
|
|
31
28
|
export * from './components/LineGraph/LineGraph.js';
|
|
32
29
|
export * from './components/ListboxDropdown/ListboxDropdown.js';
|
|
33
30
|
export * from './components/MenuBar/MenuBar.js';
|
package/dist/hooks.d.ts
CHANGED
|
@@ -3,7 +3,6 @@ export * from './hooks/useEventCallback.js';
|
|
|
3
3
|
export * from './hooks/useEventListener.js';
|
|
4
4
|
export * from './hooks/useInterval.js';
|
|
5
5
|
export * from './hooks/useIsomorphicLayoutEffect.js';
|
|
6
|
-
export * from './hooks/useLegacyStepper.js';
|
|
7
6
|
export * from './hooks/useMediaQuery.js';
|
|
8
7
|
export * from './hooks/useNotificationsStore.js';
|
|
9
8
|
export * from './hooks/useOnClickOutside.js';
|
package/dist/hooks.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../src/hooks.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,wBAAwB,CAAC;AACvC,cAAc,sCAAsC,CAAC;AACrD,cAAc,
|
|
1
|
+
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../src/hooks.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,wBAAwB,CAAC;AACvC,cAAc,sCAAsC,CAAC;AACrD,cAAc,0BAA0B,CAAC;AACzC,cAAc,kCAAkC,CAAC;AACjD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC"}
|
package/dist/hooks.js
CHANGED
|
@@ -3,7 +3,6 @@ export * from './hooks/useEventCallback.js';
|
|
|
3
3
|
export * from './hooks/useEventListener.js';
|
|
4
4
|
export * from './hooks/useInterval.js';
|
|
5
5
|
export * from './hooks/useIsomorphicLayoutEffect.js';
|
|
6
|
-
export * from './hooks/useLegacyStepper.js';
|
|
7
6
|
export * from './hooks/useMediaQuery.js';
|
|
8
7
|
export * from './hooks/useNotificationsStore.js';
|
|
9
8
|
export * from './hooks/useOnClickOutside.js';
|
package/package.json
CHANGED
|
@@ -16,6 +16,10 @@ type ActionDropdownOptionKey<T> = T extends readonly string[]
|
|
|
16
16
|
export type ActionDropdownProps<T extends ActionDropdownOptions> = {
|
|
17
17
|
align?: DropdownMenuContentProps['align'];
|
|
18
18
|
|
|
19
|
+
contentClassName?: string;
|
|
20
|
+
|
|
21
|
+
disabled?: boolean;
|
|
22
|
+
|
|
19
23
|
/** Callback function invoked when user clicks an option */
|
|
20
24
|
onSelection: (option: ActionDropdownOptionKey<T>) => void;
|
|
21
25
|
|
|
@@ -24,23 +28,33 @@ export type ActionDropdownProps<T extends ActionDropdownOptions> = {
|
|
|
24
28
|
|
|
25
29
|
/** The text content for the dropdown toggle */
|
|
26
30
|
title: string;
|
|
31
|
+
|
|
32
|
+
triggerClassName?: string;
|
|
33
|
+
|
|
34
|
+
widthFull?: boolean;
|
|
27
35
|
};
|
|
28
36
|
|
|
29
37
|
// eslint-disable-next-line react/function-component-definition
|
|
30
38
|
export function ActionDropdown<const T extends ActionDropdownOptions>({
|
|
31
39
|
align = 'start',
|
|
40
|
+
contentClassName,
|
|
41
|
+
disabled,
|
|
32
42
|
onSelection,
|
|
33
43
|
options,
|
|
34
|
-
title
|
|
44
|
+
title,
|
|
45
|
+
triggerClassName,
|
|
46
|
+
widthFull
|
|
35
47
|
}: ActionDropdownProps<T>) {
|
|
36
48
|
const optionKeys: readonly string[] = options instanceof Array ? options : Object.keys(options);
|
|
37
49
|
return (
|
|
38
50
|
<DropdownMenu>
|
|
39
51
|
<div className="w-full">
|
|
40
52
|
<DropdownMenu.Trigger asChild>
|
|
41
|
-
<DropdownButton
|
|
53
|
+
<DropdownButton className={triggerClassName} disabled={disabled}>
|
|
54
|
+
{title}
|
|
55
|
+
</DropdownButton>
|
|
42
56
|
</DropdownMenu.Trigger>
|
|
43
|
-
<DropdownMenu.Content align={align}
|
|
57
|
+
<DropdownMenu.Content align={align} className={contentClassName} widthFull={widthFull}>
|
|
44
58
|
<DropdownMenu.Group>
|
|
45
59
|
{optionKeys.map((option) => (
|
|
46
60
|
<DropdownMenu.Item
|
|
@@ -81,7 +81,7 @@ export const ClientTable = <T extends ClientTableEntry>({
|
|
|
81
81
|
|
|
82
82
|
return (
|
|
83
83
|
<div className={className}>
|
|
84
|
-
<div className="rounded-md border bg-card tracking-tight text-muted-foreground shadow">
|
|
84
|
+
<div className="rounded-md border bg-card tracking-tight text-muted-foreground shadow-sm">
|
|
85
85
|
<Table>
|
|
86
86
|
<Table.Header>
|
|
87
87
|
<Table.Row>
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Root, Trigger } from '@radix-ui/react-dialog';
|
|
2
2
|
|
|
3
|
+
import { DialogBody } from './DialogBody.js';
|
|
3
4
|
import { DialogContent } from './DialogContent.js';
|
|
4
5
|
import { DialogDescription } from './DialogDescription.js';
|
|
5
6
|
import { DialogFooter } from './DialogFooter.js';
|
|
@@ -7,6 +8,7 @@ import { DialogHeader } from './DialogHeader.js';
|
|
|
7
8
|
import { DialogTitle } from './DialogTitle.js';
|
|
8
9
|
|
|
9
10
|
export const Dialog = Object.assign(Root.bind(null), {
|
|
11
|
+
Body: DialogBody,
|
|
10
12
|
Content: DialogContent,
|
|
11
13
|
Description: DialogDescription,
|
|
12
14
|
Footer: DialogFooter,
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import { cn } from '../../utils.js';
|
|
4
|
+
|
|
5
|
+
export const DialogBody = ({
|
|
6
|
+
children,
|
|
7
|
+
className,
|
|
8
|
+
...props
|
|
9
|
+
}: React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>) => {
|
|
10
|
+
return (
|
|
11
|
+
<div className={cn('py-4', className)} {...props}>
|
|
12
|
+
{children}
|
|
13
|
+
</div>
|
|
14
|
+
);
|
|
15
|
+
};
|
|
@@ -9,7 +9,7 @@ export const DropdownButton = React.forwardRef<HTMLButtonElement, React.ButtonHT
|
|
|
9
9
|
return (
|
|
10
10
|
<button
|
|
11
11
|
className={cn(
|
|
12
|
-
'flex h-9 w-full items-center whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1',
|
|
12
|
+
'flex h-9 w-full items-center gap-2 whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1',
|
|
13
13
|
children ? 'justify-between' : 'justify-end',
|
|
14
14
|
className
|
|
15
15
|
)}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
|
+
import { cn } from '../../utils.js';
|
|
3
4
|
import { type ButtonProps } from '../Button/Button.js';
|
|
4
5
|
import { DropdownButton } from '../DropdownButton/DropdownButton.js';
|
|
5
6
|
import { DropdownMenu } from '../DropdownMenu/DropdownMenu.js';
|
|
@@ -12,26 +13,33 @@ export type ListboxDropdownOption = {
|
|
|
12
13
|
export type ListboxDropdownProps<T extends ListboxDropdownOption> = {
|
|
13
14
|
checkPosition?: 'left' | 'right';
|
|
14
15
|
className?: string;
|
|
16
|
+
contentClassName?: string;
|
|
17
|
+
disabled?: boolean;
|
|
15
18
|
options: T[];
|
|
16
19
|
selected: T[];
|
|
17
20
|
setSelected: React.Dispatch<React.SetStateAction<T[]>>;
|
|
18
21
|
title: string;
|
|
19
|
-
|
|
22
|
+
triggerClassName?: string;
|
|
20
23
|
variant?: ButtonProps['variant'];
|
|
24
|
+
widthFull?: boolean;
|
|
21
25
|
};
|
|
22
26
|
|
|
23
27
|
export const ListboxDropdown = <T extends ListboxDropdownOption>({
|
|
28
|
+
contentClassName,
|
|
29
|
+
disabled,
|
|
24
30
|
options,
|
|
25
31
|
selected,
|
|
26
32
|
setSelected,
|
|
27
|
-
title
|
|
33
|
+
title,
|
|
34
|
+
triggerClassName,
|
|
35
|
+
widthFull
|
|
28
36
|
}: ListboxDropdownProps<T>) => {
|
|
29
37
|
return (
|
|
30
38
|
<DropdownMenu>
|
|
31
|
-
<DropdownMenu.Trigger asChild className=
|
|
39
|
+
<DropdownMenu.Trigger asChild className={cn('w-full', triggerClassName)} disabled={disabled}>
|
|
32
40
|
<DropdownButton>{title}</DropdownButton>
|
|
33
41
|
</DropdownMenu.Trigger>
|
|
34
|
-
<DropdownMenu.Content
|
|
42
|
+
<DropdownMenu.Content align="start" className={contentClassName} widthFull={widthFull}>
|
|
35
43
|
{options.map((option) => {
|
|
36
44
|
const checked = Boolean(selected.find((selectedOption) => selectedOption.key === option.key));
|
|
37
45
|
return (
|
|
@@ -13,6 +13,8 @@ export type BaseSearchBarProps = {
|
|
|
13
13
|
onClick?: () => void;
|
|
14
14
|
/** Custom placeholder to use instead of the default */
|
|
15
15
|
placeholder?: string;
|
|
16
|
+
/** Whether the input element should be readonly */
|
|
17
|
+
readOnly?: boolean;
|
|
16
18
|
};
|
|
17
19
|
|
|
18
20
|
type ControlledSearchBarProps = {
|
|
@@ -29,7 +31,7 @@ type UncontrolledSearchBarProps = {
|
|
|
29
31
|
|
|
30
32
|
export type SearchBarProps = ControlledSearchBarProps | UncontrolledSearchBarProps;
|
|
31
33
|
|
|
32
|
-
export const SearchBar = ({ className, onClick, onValueChange, placeholder, value }: SearchBarProps) => {
|
|
34
|
+
export const SearchBar = ({ className, onClick, onValueChange, placeholder, readOnly, value }: SearchBarProps) => {
|
|
33
35
|
const { t } = useTranslation('libui');
|
|
34
36
|
return (
|
|
35
37
|
<form className={cn('relative', className)}>
|
|
@@ -37,6 +39,7 @@ export const SearchBar = ({ className, onClick, onValueChange, placeholder, valu
|
|
|
37
39
|
<Input
|
|
38
40
|
className="pl-8"
|
|
39
41
|
placeholder={placeholder ?? t('searchBar.placeholder')}
|
|
42
|
+
readOnly={readOnly}
|
|
40
43
|
type="search"
|
|
41
44
|
value={value}
|
|
42
45
|
onChange={(event) => {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Close, Portal, Root, Trigger } from '@radix-ui/react-dialog';
|
|
2
2
|
|
|
3
|
+
import { SheetBody } from './SheetBody.js';
|
|
3
4
|
import { SheetContent } from './SheetContent.js';
|
|
4
5
|
import { SheetDescription } from './SheetDescription.js';
|
|
5
6
|
import { SheetFooter } from './SheetFooter.js';
|
|
@@ -8,6 +9,7 @@ import { SheetOverlay } from './SheetOverlay.js';
|
|
|
8
9
|
import { SheetTitle } from './SheetTitle.js';
|
|
9
10
|
|
|
10
11
|
export const Sheet = Object.assign(Root.bind(null), {
|
|
12
|
+
Body: SheetBody,
|
|
11
13
|
Close,
|
|
12
14
|
Content: SheetContent,
|
|
13
15
|
Description: SheetDescription,
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import { cn } from '../../utils.js';
|
|
4
|
+
|
|
5
|
+
export const SheetBody = ({
|
|
6
|
+
children,
|
|
7
|
+
className,
|
|
8
|
+
...props
|
|
9
|
+
}: React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>) => {
|
|
10
|
+
return (
|
|
11
|
+
<div className={cn('py-4', className)} {...props}>
|
|
12
|
+
{children}
|
|
13
|
+
</div>
|
|
14
|
+
);
|
|
15
|
+
};
|
package/src/components.ts
CHANGED
|
@@ -25,9 +25,6 @@ export * from './components/HoverCard/HoverCard.js';
|
|
|
25
25
|
export * from './components/Input/Input.js';
|
|
26
26
|
export * from './components/Label/Label.js';
|
|
27
27
|
export * from './components/LanguageToggle/LanguageToggle.js';
|
|
28
|
-
export * from './components/LegacyModal/LegacyModal.js';
|
|
29
|
-
export * from './components/LegacySlider/LegacySlider.js';
|
|
30
|
-
export * from './components/LegacyStepper/LegacyStepper.js';
|
|
31
28
|
export * from './components/LineGraph/LineGraph.js';
|
|
32
29
|
export * from './components/ListboxDropdown/ListboxDropdown.js';
|
|
33
30
|
export * from './components/MenuBar/MenuBar.js';
|
package/src/hooks.ts
CHANGED
|
@@ -3,7 +3,6 @@ export * from './hooks/useEventCallback.js';
|
|
|
3
3
|
export * from './hooks/useEventListener.js';
|
|
4
4
|
export * from './hooks/useInterval.js';
|
|
5
5
|
export * from './hooks/useIsomorphicLayoutEffect.js';
|
|
6
|
-
export * from './hooks/useLegacyStepper.js';
|
|
7
6
|
export * from './hooks/useMediaQuery.js';
|
|
8
7
|
export * from './hooks/useNotificationsStore.js';
|
|
9
8
|
export * from './hooks/useOnClickOutside.js';
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
/** @deprecated */
|
|
3
|
-
export type LegacyModalProps = {
|
|
4
|
-
children: React.ReactNode;
|
|
5
|
-
onClose: () => void;
|
|
6
|
-
open: boolean;
|
|
7
|
-
showCloseButton?: boolean;
|
|
8
|
-
title: string;
|
|
9
|
-
width?: 'lg' | 'md' | 'sm' | 'xl';
|
|
10
|
-
};
|
|
11
|
-
/** @deprecated */
|
|
12
|
-
export declare const LegacyModal: ({ children, onClose, open, showCloseButton, title, width }: LegacyModalProps) => React.JSX.Element;
|
|
13
|
-
//# sourceMappingURL=LegacyModal.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"LegacyModal.d.ts","sourceRoot":"","sources":["../../../src/components/LegacyModal/LegacyModal.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAM1B,kBAAkB;AAClB,MAAM,MAAM,gBAAgB,GAAG;IAC7B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,IAAI,EAAE,OAAO,CAAC;IACd,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;CACnC,CAAC;AAEF,kBAAkB;AAClB,eAAO,MAAM,WAAW,+DAAuE,gBAAgB,sBA2D9G,CAAC"}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Dialog, Transition } from '@headlessui/react';
|
|
3
|
-
import { XMarkIcon } from '@heroicons/react/24/solid';
|
|
4
|
-
import { clsx } from 'clsx';
|
|
5
|
-
/** @deprecated */
|
|
6
|
-
export const LegacyModal = ({ children, onClose, open, showCloseButton, title, width = 'md' }) => {
|
|
7
|
-
return (React.createElement(Transition, { appear: true, as: React.Fragment, show: open },
|
|
8
|
-
React.createElement(Dialog, { as: "div", className: "relative z-10", onClose: onClose },
|
|
9
|
-
React.createElement(Transition.Child, { as: React.Fragment, enter: "ease-out duration-300", enterFrom: "opacity-0", enterTo: "opacity-100", leave: "ease-in duration-200", leaveFrom: "opacity-100", leaveTo: "opacity-0" },
|
|
10
|
-
React.createElement("div", { className: "fixed inset-0 bg-black bg-opacity-50" })),
|
|
11
|
-
React.createElement("div", { className: "fixed inset-0 overflow-y-auto" },
|
|
12
|
-
React.createElement("div", { className: "flex min-h-full items-center justify-center p-4 text-center" },
|
|
13
|
-
React.createElement(Transition.Child, { as: React.Fragment, enter: "ease-out duration-300", enterFrom: "opacity-0 scale-95", enterTo: "opacity-100 scale-100", leave: "ease-in duration-200", leaveFrom: "opacity-100 scale-100", leaveTo: "opacity-0 scale-95" },
|
|
14
|
-
React.createElement(Dialog.Panel, { className: clsx('relative w-full transform overflow-visible rounded-2xl bg-slate-100 p-6 text-left align-middle text-slate-900 shadow-xl transition-all dark:bg-slate-800 dark:text-slate-100', {
|
|
15
|
-
'max-w-lg': width === 'lg',
|
|
16
|
-
'max-w-md': width === 'md',
|
|
17
|
-
'max-w-sm': width === 'sm',
|
|
18
|
-
'max-w-xl': width === 'xl'
|
|
19
|
-
}) },
|
|
20
|
-
React.createElement("div", { className: "flex items-center justify-between" },
|
|
21
|
-
React.createElement(Dialog.Title, { as: "h3", className: "p-0.5 text-xl font-bold leading-6" }, title),
|
|
22
|
-
showCloseButton && (React.createElement("button", { className: "flex items-center justify-center rounded-md p-0.5 hover:bg-slate-200 dark:hover:bg-slate-700", type: "button", onClick: onClose },
|
|
23
|
-
React.createElement(XMarkIcon, { height: 24, width: 24 })))),
|
|
24
|
-
React.createElement("div", { className: "my-2 p-0.5" }, children))))))));
|
|
25
|
-
};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
/** @deprecated */
|
|
3
|
-
export type LegacySliderProps = {
|
|
4
|
-
children: React.ReactNode;
|
|
5
|
-
isOpen: boolean;
|
|
6
|
-
setIsOpen: (isOpen: boolean) => void;
|
|
7
|
-
title: React.ReactNode;
|
|
8
|
-
};
|
|
9
|
-
/** @deprecated */
|
|
10
|
-
export declare const LegacySlider: ({ children, isOpen, setIsOpen, title }: LegacySliderProps) => React.JSX.Element;
|
|
11
|
-
//# sourceMappingURL=LegacySlider.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"LegacySlider.d.ts","sourceRoot":"","sources":["../../../src/components/LegacySlider/LegacySlider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,kBAAkB;AAClB,MAAM,MAAM,iBAAiB,GAAG;IAC9B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,MAAM,EAAE,OAAO,CAAC;IAChB,SAAS,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;IACrC,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC;CACxB,CAAC;AAEF,kBAAkB;AAClB,eAAO,MAAM,YAAY,2CAA4C,iBAAiB,sBAoDrF,CAAC"}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Dialog, Transition } from '@headlessui/react';
|
|
3
|
-
import { XMarkIcon } from '@heroicons/react/24/outline';
|
|
4
|
-
/** @deprecated */
|
|
5
|
-
export const LegacySlider = ({ children, isOpen, setIsOpen, title }) => {
|
|
6
|
-
return (React.createElement(Transition, { as: React.Fragment, show: isOpen },
|
|
7
|
-
React.createElement(Dialog, { as: "div", className: "fixed inset-0 z-10 overflow-hidden", onClose: setIsOpen },
|
|
8
|
-
React.createElement("div", { className: "absolute inset-0 overflow-hidden" },
|
|
9
|
-
React.createElement(Transition.Child, { as: React.Fragment, enter: "transition-opacity ease-linear duration-500", enterFrom: "opacity-0", enterTo: "opacity-100", leave: "transition-opacity ease-linear duration-500", leaveFrom: "opacity-100", leaveTo: "opacity-0" },
|
|
10
|
-
React.createElement("div", { className: "fixed inset-0 bg-black/30" })),
|
|
11
|
-
React.createElement("div", { className: "pointer-events-none fixed inset-y-0 right-0 flex max-w-full pl-10" },
|
|
12
|
-
React.createElement(Transition.Child, { as: React.Fragment, enter: "transform transition ease-in-out duration-500", enterFrom: "translate-x-full", enterTo: "translate-x-0", leave: "transform transition ease-in-out duration-500", leaveFrom: "translate-x-0", leaveTo: "translate-x-full" },
|
|
13
|
-
React.createElement("div", { className: "pointer-events-auto w-screen max-w-md" },
|
|
14
|
-
React.createElement("div", { className: "flex h-full flex-col overflow-y-scroll bg-slate-50 py-6 shadow-xl dark:bg-slate-800" },
|
|
15
|
-
React.createElement("div", { className: "px-4 sm:px-6" },
|
|
16
|
-
React.createElement("div", { className: "flex items-center justify-between" },
|
|
17
|
-
React.createElement(Dialog.Title, { className: "font-semibold text-slate-900 dark:text-slate-100" }, title),
|
|
18
|
-
React.createElement("button", { className: "text-muted-foreground hover:text-slate-500", type: "button", onClick: () => {
|
|
19
|
-
setIsOpen(false);
|
|
20
|
-
} },
|
|
21
|
-
React.createElement(XMarkIcon, { "aria-hidden": "true", className: "h-6 w-6" })))),
|
|
22
|
-
React.createElement("hr", { className: "mx-4 my-4 border-slate-300" }),
|
|
23
|
-
React.createElement("div", { className: "relative flex-1 px-4 sm:px-6" }, children)))))))));
|
|
24
|
-
};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
/** @deprecated */
|
|
3
|
-
export type Step = {
|
|
4
|
-
element: React.ReactElement;
|
|
5
|
-
icon: React.ReactElement;
|
|
6
|
-
label: string;
|
|
7
|
-
};
|
|
8
|
-
/** @deprecated */
|
|
9
|
-
export type LegacyStepperProps = {
|
|
10
|
-
className?: string;
|
|
11
|
-
steps: Step[];
|
|
12
|
-
};
|
|
13
|
-
/** @deprecated */
|
|
14
|
-
export declare const LegacyStepper: ({ className, steps }: LegacyStepperProps) => React.JSX.Element;
|
|
15
|
-
//# sourceMappingURL=LegacyStepper.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"LegacyStepper.d.ts","sourceRoot":"","sources":["../../../src/components/LegacyStepper/LegacyStepper.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkD,MAAM,OAAO,CAAC;AAQvE,kBAAkB;AAClB,MAAM,MAAM,IAAI,GAAG;IACjB,OAAO,EAAE,KAAK,CAAC,YAAY,CAAC;IAC5B,IAAI,EAAE,KAAK,CAAC,YAAY,CAAC;IACzB,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,kBAAkB;AAClB,MAAM,MAAM,kBAAkB,GAAG;IAC/B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,IAAI,EAAE,CAAC;CACf,CAAC;AAEF,kBAAkB;AAClB,eAAO,MAAM,aAAa,yBAA0B,kBAAkB,sBAoErE,CAAC"}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import React, { useEffect, useReducer, useRef, useState } from 'react';
|
|
2
|
-
import clsx from 'clsx';
|
|
3
|
-
import { LegacyStepperContext } from '../../context/LegacyStepperContext.js';
|
|
4
|
-
import { useWindowSize } from '../../hooks/useWindowSize.js';
|
|
5
|
-
import { cn } from '../../utils.js';
|
|
6
|
-
/** @deprecated */
|
|
7
|
-
export const LegacyStepper = ({ className, steps }) => {
|
|
8
|
-
const icons = useRef([]);
|
|
9
|
-
const [divideStyles, setDivideStyles] = useState([]);
|
|
10
|
-
const { height, width } = useWindowSize();
|
|
11
|
-
useEffect(() => {
|
|
12
|
-
const styles = [];
|
|
13
|
-
for (let i = 0; i < steps.length - 1; i++) {
|
|
14
|
-
const current = icons.current[i];
|
|
15
|
-
const next = icons.current[i + 1];
|
|
16
|
-
const left = current.offsetLeft + current.offsetWidth;
|
|
17
|
-
styles.push({
|
|
18
|
-
left,
|
|
19
|
-
width: next.offsetLeft - left
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
setDivideStyles(styles);
|
|
23
|
-
}, [height, width]);
|
|
24
|
-
const [index, updateIndex] = useReducer((prevIndex, action) => {
|
|
25
|
-
if (action === 'decrement' && prevIndex > 0) {
|
|
26
|
-
return prevIndex - 1;
|
|
27
|
-
}
|
|
28
|
-
else if (action === 'increment' && prevIndex < steps.length - 1) {
|
|
29
|
-
return prevIndex + 1;
|
|
30
|
-
}
|
|
31
|
-
return prevIndex;
|
|
32
|
-
}, 0);
|
|
33
|
-
return (React.createElement(LegacyStepperContext.Provider, { value: { index, updateIndex } },
|
|
34
|
-
React.createElement("div", { className: cn('flex flex-col', className) },
|
|
35
|
-
React.createElement("div", { className: "relative mb-12 flex items-center justify-between print:hidden" }, steps.map((step, i) => {
|
|
36
|
-
return (React.createElement(React.Fragment, { key: i },
|
|
37
|
-
React.createElement("div", { className: "flex items-center" },
|
|
38
|
-
React.createElement("div", { className: "flex flex-col items-center justify-center" },
|
|
39
|
-
React.createElement("div", { className: clsx('h-12 w-12 rounded-full bg-sky-700 py-3 text-white transition duration-500 ease-in-out [&>*]:h-full [&>*]:w-full', i > index && 'bg-slate-200 dark:bg-slate-700'), ref: (e) => {
|
|
40
|
-
icons.current[i] = e;
|
|
41
|
-
} }, step.icon),
|
|
42
|
-
React.createElement("span", { className: "mt-2 text-xs font-medium uppercase text-muted-foreground" }, step.label))),
|
|
43
|
-
i !== steps.length - 1 && (React.createElement("div", { className: clsx('absolute top-6 flex-auto border-t-2 transition duration-500 ease-in-out', i >= index ? 'border-slate-200 dark:border-slate-700' : 'border-sky-700'), style: divideStyles[i] }))));
|
|
44
|
-
})),
|
|
45
|
-
React.createElement("div", { className: "flex-grow" }, steps[index]?.element))));
|
|
46
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"LegacyStepperContext.d.ts","sourceRoot":"","sources":["../../src/context/LegacyStepperContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAwB,MAAM,OAAO,CAAC;AAE7C,kBAAkB;AAClB,eAAO,MAAM,oBAAoB;WACxB,MAAM;iBACA,MAAM,QAAQ,CAAC,WAAW,GAAG,WAAW,CAAC;EAC/C,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useLegacyStepper.d.ts","sourceRoot":"","sources":["../../src/hooks/useLegacyStepper.ts"],"names":[],"mappings":";AAIA,kBAAkB;AAClB,wBAAgB,gBAAgB;;;EAE/B"}
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
|
|
3
|
-
import { Dialog, Transition } from '@headlessui/react';
|
|
4
|
-
import { XMarkIcon } from '@heroicons/react/24/solid';
|
|
5
|
-
import { clsx } from 'clsx';
|
|
6
|
-
|
|
7
|
-
/** @deprecated */
|
|
8
|
-
export type LegacyModalProps = {
|
|
9
|
-
children: React.ReactNode;
|
|
10
|
-
onClose: () => void;
|
|
11
|
-
open: boolean;
|
|
12
|
-
showCloseButton?: boolean;
|
|
13
|
-
title: string;
|
|
14
|
-
width?: 'lg' | 'md' | 'sm' | 'xl';
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
/** @deprecated */
|
|
18
|
-
export const LegacyModal = ({ children, onClose, open, showCloseButton, title, width = 'md' }: LegacyModalProps) => {
|
|
19
|
-
return (
|
|
20
|
-
<Transition appear as={React.Fragment} show={open}>
|
|
21
|
-
<Dialog as="div" className="relative z-10" onClose={onClose}>
|
|
22
|
-
<Transition.Child
|
|
23
|
-
as={React.Fragment}
|
|
24
|
-
enter="ease-out duration-300"
|
|
25
|
-
enterFrom="opacity-0"
|
|
26
|
-
enterTo="opacity-100"
|
|
27
|
-
leave="ease-in duration-200"
|
|
28
|
-
leaveFrom="opacity-100"
|
|
29
|
-
leaveTo="opacity-0"
|
|
30
|
-
>
|
|
31
|
-
<div className="fixed inset-0 bg-black bg-opacity-50" />
|
|
32
|
-
</Transition.Child>
|
|
33
|
-
<div className="fixed inset-0 overflow-y-auto">
|
|
34
|
-
<div className="flex min-h-full items-center justify-center p-4 text-center">
|
|
35
|
-
<Transition.Child
|
|
36
|
-
as={React.Fragment}
|
|
37
|
-
enter="ease-out duration-300"
|
|
38
|
-
enterFrom="opacity-0 scale-95"
|
|
39
|
-
enterTo="opacity-100 scale-100"
|
|
40
|
-
leave="ease-in duration-200"
|
|
41
|
-
leaveFrom="opacity-100 scale-100"
|
|
42
|
-
leaveTo="opacity-0 scale-95"
|
|
43
|
-
>
|
|
44
|
-
<Dialog.Panel
|
|
45
|
-
className={clsx(
|
|
46
|
-
'relative w-full transform overflow-visible rounded-2xl bg-slate-100 p-6 text-left align-middle text-slate-900 shadow-xl transition-all dark:bg-slate-800 dark:text-slate-100',
|
|
47
|
-
{
|
|
48
|
-
'max-w-lg': width === 'lg',
|
|
49
|
-
'max-w-md': width === 'md',
|
|
50
|
-
'max-w-sm': width === 'sm',
|
|
51
|
-
'max-w-xl': width === 'xl'
|
|
52
|
-
}
|
|
53
|
-
)}
|
|
54
|
-
>
|
|
55
|
-
<div className="flex items-center justify-between">
|
|
56
|
-
<Dialog.Title as="h3" className="p-0.5 text-xl font-bold leading-6">
|
|
57
|
-
{title}
|
|
58
|
-
</Dialog.Title>
|
|
59
|
-
{showCloseButton && (
|
|
60
|
-
<button
|
|
61
|
-
className="flex items-center justify-center rounded-md p-0.5 hover:bg-slate-200 dark:hover:bg-slate-700"
|
|
62
|
-
type="button"
|
|
63
|
-
onClick={onClose}
|
|
64
|
-
>
|
|
65
|
-
<XMarkIcon height={24} width={24} />
|
|
66
|
-
</button>
|
|
67
|
-
)}
|
|
68
|
-
</div>
|
|
69
|
-
<div className="my-2 p-0.5">{children}</div>
|
|
70
|
-
</Dialog.Panel>
|
|
71
|
-
</Transition.Child>
|
|
72
|
-
</div>
|
|
73
|
-
</div>
|
|
74
|
-
</Dialog>
|
|
75
|
-
</Transition>
|
|
76
|
-
);
|
|
77
|
-
};
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
|
|
3
|
-
import { Dialog, Transition } from '@headlessui/react';
|
|
4
|
-
import { XMarkIcon } from '@heroicons/react/24/outline';
|
|
5
|
-
|
|
6
|
-
/** @deprecated */
|
|
7
|
-
export type LegacySliderProps = {
|
|
8
|
-
children: React.ReactNode;
|
|
9
|
-
isOpen: boolean;
|
|
10
|
-
setIsOpen: (isOpen: boolean) => void;
|
|
11
|
-
title: React.ReactNode;
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
/** @deprecated */
|
|
15
|
-
export const LegacySlider = ({ children, isOpen, setIsOpen, title }: LegacySliderProps) => {
|
|
16
|
-
return (
|
|
17
|
-
<Transition as={React.Fragment} show={isOpen}>
|
|
18
|
-
<Dialog as="div" className="fixed inset-0 z-10 overflow-hidden" onClose={setIsOpen}>
|
|
19
|
-
<div className="absolute inset-0 overflow-hidden">
|
|
20
|
-
<Transition.Child
|
|
21
|
-
as={React.Fragment}
|
|
22
|
-
enter="transition-opacity ease-linear duration-500"
|
|
23
|
-
enterFrom="opacity-0"
|
|
24
|
-
enterTo="opacity-100"
|
|
25
|
-
leave="transition-opacity ease-linear duration-500"
|
|
26
|
-
leaveFrom="opacity-100"
|
|
27
|
-
leaveTo="opacity-0"
|
|
28
|
-
>
|
|
29
|
-
<div className="fixed inset-0 bg-black/30" />
|
|
30
|
-
</Transition.Child>
|
|
31
|
-
<div className="pointer-events-none fixed inset-y-0 right-0 flex max-w-full pl-10">
|
|
32
|
-
<Transition.Child
|
|
33
|
-
as={React.Fragment}
|
|
34
|
-
enter="transform transition ease-in-out duration-500"
|
|
35
|
-
enterFrom="translate-x-full"
|
|
36
|
-
enterTo="translate-x-0"
|
|
37
|
-
leave="transform transition ease-in-out duration-500"
|
|
38
|
-
leaveFrom="translate-x-0"
|
|
39
|
-
leaveTo="translate-x-full"
|
|
40
|
-
>
|
|
41
|
-
<div className="pointer-events-auto w-screen max-w-md">
|
|
42
|
-
<div className="flex h-full flex-col overflow-y-scroll bg-slate-50 py-6 shadow-xl dark:bg-slate-800">
|
|
43
|
-
<div className="px-4 sm:px-6">
|
|
44
|
-
<div className="flex items-center justify-between">
|
|
45
|
-
<Dialog.Title className="font-semibold text-slate-900 dark:text-slate-100">{title}</Dialog.Title>
|
|
46
|
-
<button
|
|
47
|
-
className="text-muted-foreground hover:text-slate-500"
|
|
48
|
-
type="button"
|
|
49
|
-
onClick={() => {
|
|
50
|
-
setIsOpen(false);
|
|
51
|
-
}}
|
|
52
|
-
>
|
|
53
|
-
<XMarkIcon aria-hidden="true" className="h-6 w-6" />
|
|
54
|
-
</button>
|
|
55
|
-
</div>
|
|
56
|
-
</div>
|
|
57
|
-
<hr className="mx-4 my-4 border-slate-300" />
|
|
58
|
-
<div className="relative flex-1 px-4 sm:px-6">{children}</div>
|
|
59
|
-
</div>
|
|
60
|
-
</div>
|
|
61
|
-
</Transition.Child>
|
|
62
|
-
</div>
|
|
63
|
-
</div>
|
|
64
|
-
</Dialog>
|
|
65
|
-
</Transition>
|
|
66
|
-
);
|
|
67
|
-
};
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
import React, { useEffect, useReducer, useRef, useState } from 'react';
|
|
2
|
-
|
|
3
|
-
import clsx from 'clsx';
|
|
4
|
-
|
|
5
|
-
import { LegacyStepperContext } from '../../context/LegacyStepperContext.js';
|
|
6
|
-
import { useWindowSize } from '../../hooks/useWindowSize.js';
|
|
7
|
-
import { cn } from '../../utils.js';
|
|
8
|
-
|
|
9
|
-
/** @deprecated */
|
|
10
|
-
export type Step = {
|
|
11
|
-
element: React.ReactElement;
|
|
12
|
-
icon: React.ReactElement;
|
|
13
|
-
label: string;
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
/** @deprecated */
|
|
17
|
-
export type LegacyStepperProps = {
|
|
18
|
-
className?: string;
|
|
19
|
-
steps: Step[];
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
/** @deprecated */
|
|
23
|
-
export const LegacyStepper = ({ className, steps }: LegacyStepperProps) => {
|
|
24
|
-
const icons = useRef<HTMLDivElement[]>([]);
|
|
25
|
-
const [divideStyles, setDivideStyles] = useState<React.CSSProperties[]>([]);
|
|
26
|
-
const { height, width } = useWindowSize();
|
|
27
|
-
|
|
28
|
-
useEffect(() => {
|
|
29
|
-
const styles: React.CSSProperties[] = [];
|
|
30
|
-
for (let i = 0; i < steps.length - 1; i++) {
|
|
31
|
-
const current = icons.current[i];
|
|
32
|
-
const next = icons.current[i + 1];
|
|
33
|
-
const left = current.offsetLeft + current.offsetWidth;
|
|
34
|
-
styles.push({
|
|
35
|
-
left,
|
|
36
|
-
width: next.offsetLeft - left
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
setDivideStyles(styles);
|
|
40
|
-
}, [height, width]);
|
|
41
|
-
|
|
42
|
-
const [index, updateIndex] = useReducer((prevIndex: number, action: 'decrement' | 'increment') => {
|
|
43
|
-
if (action === 'decrement' && prevIndex > 0) {
|
|
44
|
-
return prevIndex - 1;
|
|
45
|
-
} else if (action === 'increment' && prevIndex < steps.length - 1) {
|
|
46
|
-
return prevIndex + 1;
|
|
47
|
-
}
|
|
48
|
-
return prevIndex;
|
|
49
|
-
}, 0);
|
|
50
|
-
|
|
51
|
-
return (
|
|
52
|
-
<LegacyStepperContext.Provider value={{ index, updateIndex }}>
|
|
53
|
-
<div className={cn('flex flex-col', className)}>
|
|
54
|
-
<div className="relative mb-12 flex items-center justify-between print:hidden">
|
|
55
|
-
{steps.map((step, i) => {
|
|
56
|
-
return (
|
|
57
|
-
<React.Fragment key={i}>
|
|
58
|
-
<div className="flex items-center">
|
|
59
|
-
<div className="flex flex-col items-center justify-center">
|
|
60
|
-
<div
|
|
61
|
-
className={clsx(
|
|
62
|
-
'h-12 w-12 rounded-full bg-sky-700 py-3 text-white transition duration-500 ease-in-out [&>*]:h-full [&>*]:w-full',
|
|
63
|
-
i > index && 'bg-slate-200 dark:bg-slate-700'
|
|
64
|
-
)}
|
|
65
|
-
ref={(e) => {
|
|
66
|
-
icons.current[i] = e!;
|
|
67
|
-
}}
|
|
68
|
-
>
|
|
69
|
-
{step.icon}
|
|
70
|
-
</div>
|
|
71
|
-
<span className="mt-2 text-xs font-medium uppercase text-muted-foreground">{step.label}</span>
|
|
72
|
-
</div>
|
|
73
|
-
</div>
|
|
74
|
-
{i !== steps.length - 1 && (
|
|
75
|
-
<div
|
|
76
|
-
className={clsx(
|
|
77
|
-
'absolute top-6 flex-auto border-t-2 transition duration-500 ease-in-out',
|
|
78
|
-
i >= index ? 'border-slate-200 dark:border-slate-700' : 'border-sky-700'
|
|
79
|
-
)}
|
|
80
|
-
style={divideStyles[i]}
|
|
81
|
-
/>
|
|
82
|
-
)}
|
|
83
|
-
</React.Fragment>
|
|
84
|
-
);
|
|
85
|
-
})}
|
|
86
|
-
</div>
|
|
87
|
-
<div className="flex-grow">{steps[index]?.element}</div>
|
|
88
|
-
</div>
|
|
89
|
-
</LegacyStepperContext.Provider>
|
|
90
|
-
);
|
|
91
|
-
};
|