@zvk/ui 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.md +26 -0
- package/README.md +31 -0
- package/dist/components/accordion/accordion.d.ts +43 -0
- package/dist/components/accordion/accordion.js +207 -0
- package/dist/components/accordion/index.d.ts +2 -0
- package/dist/components/accordion/index.js +2 -0
- package/dist/components/alert/alert.d.ts +24 -0
- package/dist/components/alert/alert.js +17 -0
- package/dist/components/alert/index.d.ts +2 -0
- package/dist/components/alert/index.js +1 -0
- package/dist/components/alert-dialog/alert-dialog.d.ts +46 -0
- package/dist/components/alert-dialog/alert-dialog.js +112 -0
- package/dist/components/alert-dialog/index.d.ts +2 -0
- package/dist/components/alert-dialog/index.js +2 -0
- package/dist/components/avatar/avatar.d.ts +14 -0
- package/dist/components/avatar/avatar.js +22 -0
- package/dist/components/avatar/index.d.ts +2 -0
- package/dist/components/avatar/index.js +2 -0
- package/dist/components/badge/badge.d.ts +11 -0
- package/dist/components/badge/badge.js +6 -0
- package/dist/components/badge/index.d.ts +2 -0
- package/dist/components/badge/index.js +1 -0
- package/dist/components/breadcrumbs/breadcrumbs.d.ts +24 -0
- package/dist/components/breadcrumbs/breadcrumbs.js +18 -0
- package/dist/components/breadcrumbs/index.d.ts +2 -0
- package/dist/components/breadcrumbs/index.js +1 -0
- package/dist/components/button/button.d.ts +13 -0
- package/dist/components/button/button.js +8 -0
- package/dist/components/button/index.d.ts +2 -0
- package/dist/components/button/index.js +1 -0
- package/dist/components/card/card.d.ts +31 -0
- package/dist/components/card/card.js +28 -0
- package/dist/components/card/index.d.ts +2 -0
- package/dist/components/card/index.js +1 -0
- package/dist/components/checkbox/checkbox.d.ts +11 -0
- package/dist/components/checkbox/checkbox.js +30 -0
- package/dist/components/checkbox/index.d.ts +2 -0
- package/dist/components/checkbox/index.js +2 -0
- package/dist/components/code-block/code-block.d.ts +10 -0
- package/dist/components/code-block/code-block.js +16 -0
- package/dist/components/code-block/index.d.ts +2 -0
- package/dist/components/code-block/index.js +1 -0
- package/dist/components/collapsible/collapsible.d.ts +23 -0
- package/dist/components/collapsible/collapsible.js +52 -0
- package/dist/components/collapsible/index.d.ts +2 -0
- package/dist/components/collapsible/index.js +2 -0
- package/dist/components/combobox/combobox.d.ts +20 -0
- package/dist/components/combobox/combobox.js +121 -0
- package/dist/components/combobox/index.d.ts +2 -0
- package/dist/components/combobox/index.js +2 -0
- package/dist/components/command/command-dialog.d.ts +2 -0
- package/dist/components/command/command-dialog.js +1 -0
- package/dist/components/command/command-filter.d.ts +7 -0
- package/dist/components/command/command-filter.js +14 -0
- package/dist/components/command/command.d.ts +55 -0
- package/dist/components/command/command.js +200 -0
- package/dist/components/command/index.d.ts +2 -0
- package/dist/components/command/index.js +2 -0
- package/dist/components/context-menu/context-menu.d.ts +34 -0
- package/dist/components/context-menu/context-menu.js +154 -0
- package/dist/components/context-menu/index.d.ts +2 -0
- package/dist/components/context-menu/index.js +2 -0
- package/dist/components/conversation/conversation.d.ts +60 -0
- package/dist/components/conversation/conversation.js +49 -0
- package/dist/components/conversation/index.d.ts +2 -0
- package/dist/components/conversation/index.js +1 -0
- package/dist/components/copy-button/copy-button.d.ts +23 -0
- package/dist/components/copy-button/copy-button.js +50 -0
- package/dist/components/copy-button/index.d.ts +2 -0
- package/dist/components/copy-button/index.js +2 -0
- package/dist/components/dialog/dialog.d.ts +62 -0
- package/dist/components/dialog/dialog.js +141 -0
- package/dist/components/dialog/index.d.ts +2 -0
- package/dist/components/dialog/index.js +2 -0
- package/dist/components/dropdown-menu/dropdown-menu.d.ts +43 -0
- package/dist/components/dropdown-menu/dropdown-menu.js +286 -0
- package/dist/components/dropdown-menu/index.d.ts +2 -0
- package/dist/components/dropdown-menu/index.js +2 -0
- package/dist/components/empty-state/empty-state.d.ts +13 -0
- package/dist/components/empty-state/empty-state.js +34 -0
- package/dist/components/empty-state/index.d.ts +2 -0
- package/dist/components/empty-state/index.js +1 -0
- package/dist/components/error-boundary/error-boundary.d.ts +29 -0
- package/dist/components/error-boundary/error-boundary.js +43 -0
- package/dist/components/error-boundary/index.d.ts +2 -0
- package/dist/components/error-boundary/index.js +2 -0
- package/dist/components/field/field.d.ts +23 -0
- package/dist/components/field/field.js +20 -0
- package/dist/components/field/index.d.ts +2 -0
- package/dist/components/field/index.js +1 -0
- package/dist/components/file-upload-input/file-upload-input.d.ts +13 -0
- package/dist/components/file-upload-input/file-upload-input.js +41 -0
- package/dist/components/file-upload-input/index.d.ts +2 -0
- package/dist/components/file-upload-input/index.js +2 -0
- package/dist/components/form/form.d.ts +30 -0
- package/dist/components/form/form.js +88 -0
- package/dist/components/form/index.d.ts +2 -0
- package/dist/components/form/index.js +2 -0
- package/dist/components/icon-button/icon-button.d.ts +10 -0
- package/dist/components/icon-button/icon-button.js +8 -0
- package/dist/components/icon-button/index.d.ts +2 -0
- package/dist/components/icon-button/index.js +1 -0
- package/dist/components/index.d.ts +102 -0
- package/dist/components/index.js +51 -0
- package/dist/components/input/index.d.ts +2 -0
- package/dist/components/input/index.js +1 -0
- package/dist/components/input/input.d.ts +11 -0
- package/dist/components/input/input.js +27 -0
- package/dist/components/label/index.d.ts +2 -0
- package/dist/components/label/index.js +1 -0
- package/dist/components/label/label.d.ts +9 -0
- package/dist/components/label/label.js +6 -0
- package/dist/components/menubar/index.d.ts +2 -0
- package/dist/components/menubar/index.js +2 -0
- package/dist/components/menubar/menubar.d.ts +39 -0
- package/dist/components/menubar/menubar.js +214 -0
- package/dist/components/pagination/index.d.ts +2 -0
- package/dist/components/pagination/index.js +1 -0
- package/dist/components/pagination/pagination.d.ts +21 -0
- package/dist/components/pagination/pagination.js +92 -0
- package/dist/components/popover/index.d.ts +2 -0
- package/dist/components/popover/index.js +2 -0
- package/dist/components/popover/popover.d.ts +28 -0
- package/dist/components/popover/popover.js +164 -0
- package/dist/components/progress/index.d.ts +2 -0
- package/dist/components/progress/index.js +1 -0
- package/dist/components/progress/progress.d.ts +24 -0
- package/dist/components/progress/progress.js +29 -0
- package/dist/components/radio-group/index.d.ts +2 -0
- package/dist/components/radio-group/index.js +2 -0
- package/dist/components/radio-group/radio-group.d.ts +42 -0
- package/dist/components/radio-group/radio-group.js +69 -0
- package/dist/components/responsive-container/index.d.ts +2 -0
- package/dist/components/responsive-container/index.js +1 -0
- package/dist/components/responsive-container/responsive-container.d.ts +10 -0
- package/dist/components/responsive-container/responsive-container.js +6 -0
- package/dist/components/scroll-area/index.d.ts +2 -0
- package/dist/components/scroll-area/index.js +2 -0
- package/dist/components/scroll-area/scroll-area.d.ts +21 -0
- package/dist/components/scroll-area/scroll-area.js +23 -0
- package/dist/components/sectioned-sidebar-nav/index.d.ts +2 -0
- package/dist/components/sectioned-sidebar-nav/index.js +1 -0
- package/dist/components/sectioned-sidebar-nav/sectioned-sidebar-nav.d.ts +39 -0
- package/dist/components/sectioned-sidebar-nav/sectioned-sidebar-nav.js +37 -0
- package/dist/components/select/index.d.ts +2 -0
- package/dist/components/select/index.js +2 -0
- package/dist/components/select/select.d.ts +46 -0
- package/dist/components/select/select.js +239 -0
- package/dist/components/separator/index.d.ts +2 -0
- package/dist/components/separator/index.js +1 -0
- package/dist/components/separator/separator.d.ts +8 -0
- package/dist/components/separator/separator.js +6 -0
- package/dist/components/sheet/index.d.ts +2 -0
- package/dist/components/sheet/index.js +2 -0
- package/dist/components/sheet/sheet.d.ts +49 -0
- package/dist/components/sheet/sheet.js +116 -0
- package/dist/components/sidebar-shell/index.d.ts +2 -0
- package/dist/components/sidebar-shell/index.js +1 -0
- package/dist/components/sidebar-shell/sidebar-shell.d.ts +35 -0
- package/dist/components/sidebar-shell/sidebar-shell.js +28 -0
- package/dist/components/skeleton/index.d.ts +2 -0
- package/dist/components/skeleton/index.js +1 -0
- package/dist/components/skeleton/skeleton.d.ts +10 -0
- package/dist/components/skeleton/skeleton.js +16 -0
- package/dist/components/slider/index.d.ts +2 -0
- package/dist/components/slider/index.js +2 -0
- package/dist/components/slider/slider.d.ts +12 -0
- package/dist/components/slider/slider.js +30 -0
- package/dist/components/spinner/index.d.ts +2 -0
- package/dist/components/spinner/index.js +1 -0
- package/dist/components/spinner/spinner.d.ts +10 -0
- package/dist/components/spinner/spinner.js +7 -0
- package/dist/components/stat/index.d.ts +2 -0
- package/dist/components/stat/index.js +1 -0
- package/dist/components/stat/stat.d.ts +13 -0
- package/dist/components/stat/stat.js +8 -0
- package/dist/components/switch/index.d.ts +2 -0
- package/dist/components/switch/index.js +2 -0
- package/dist/components/switch/switch.d.ts +11 -0
- package/dist/components/switch/switch.js +27 -0
- package/dist/components/table/index.d.ts +2 -0
- package/dist/components/table/index.js +1 -0
- package/dist/components/table/table.d.ts +45 -0
- package/dist/components/table/table.js +36 -0
- package/dist/components/tabs/index.d.ts +2 -0
- package/dist/components/tabs/index.js +2 -0
- package/dist/components/tabs/tabs.d.ts +34 -0
- package/dist/components/tabs/tabs.js +233 -0
- package/dist/components/tabs-with-sidebar/index.d.ts +2 -0
- package/dist/components/tabs-with-sidebar/index.js +2 -0
- package/dist/components/tabs-with-sidebar/tabs-with-sidebar.d.ts +21 -0
- package/dist/components/tabs-with-sidebar/tabs-with-sidebar.js +18 -0
- package/dist/components/textarea/index.d.ts +2 -0
- package/dist/components/textarea/index.js +2 -0
- package/dist/components/textarea/textarea.d.ts +11 -0
- package/dist/components/textarea/textarea.js +28 -0
- package/dist/components/toast/index.d.ts +2 -0
- package/dist/components/toast/index.js +1 -0
- package/dist/components/toast/toast.d.ts +33 -0
- package/dist/components/toast/toast.js +27 -0
- package/dist/components/toggle/index.d.ts +2 -0
- package/dist/components/toggle/index.js +2 -0
- package/dist/components/toggle/toggle.d.ts +12 -0
- package/dist/components/toggle/toggle.js +18 -0
- package/dist/components/toggle-group/index.d.ts +2 -0
- package/dist/components/toggle-group/index.js +2 -0
- package/dist/components/toggle-group/toggle-group.d.ts +28 -0
- package/dist/components/toggle-group/toggle-group.js +67 -0
- package/dist/components/tooltip/index.d.ts +2 -0
- package/dist/components/tooltip/index.js +2 -0
- package/dist/components/tooltip/tooltip.d.ts +10 -0
- package/dist/components/tooltip/tooltip.js +100 -0
- package/dist/hooks/index.d.ts +7 -0
- package/dist/hooks/index.js +5 -0
- package/dist/hooks/use-composed-refs.d.ts +3 -0
- package/dist/hooks/use-composed-refs.js +18 -0
- package/dist/hooks/use-controllable-state.d.ts +7 -0
- package/dist/hooks/use-controllable-state.js +30 -0
- package/dist/hooks/use-disclosure.d.ts +13 -0
- package/dist/hooks/use-disclosure.js +20 -0
- package/dist/hooks/use-event.d.ts +1 -0
- package/dist/hooks/use-event.js +11 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +3 -0
- package/dist/internal/collection/collection.d.ts +18 -0
- package/dist/internal/collection/collection.js +54 -0
- package/dist/internal/collection/index.d.ts +2 -0
- package/dist/internal/collection/index.js +1 -0
- package/dist/internal/dismissable-layer/dismissable-layer.d.ts +13 -0
- package/dist/internal/dismissable-layer/dismissable-layer.js +73 -0
- package/dist/internal/dismissable-layer/index.d.ts +2 -0
- package/dist/internal/dismissable-layer/index.js +1 -0
- package/dist/internal/floating/auto-update.d.ts +9 -0
- package/dist/internal/floating/auto-update.js +48 -0
- package/dist/internal/floating/compute-position.d.ts +2 -0
- package/dist/internal/floating/compute-position.js +96 -0
- package/dist/internal/floating/detect-overflow.d.ts +13 -0
- package/dist/internal/floating/detect-overflow.js +13 -0
- package/dist/internal/floating/floating-types.d.ts +42 -0
- package/dist/internal/floating/floating-types.js +1 -0
- package/dist/internal/floating/index.d.ts +27 -0
- package/dist/internal/floating/index.js +5 -0
- package/dist/internal/floating/middleware.d.ts +11 -0
- package/dist/internal/floating/middleware.js +42 -0
- package/dist/internal/floating/use-floating-position.d.ts +2 -0
- package/dist/internal/floating/use-floating-position.js +113 -0
- package/dist/internal/focus/focus-scope.d.ts +10 -0
- package/dist/internal/focus/focus-scope.js +68 -0
- package/dist/internal/focus/focus-utils.d.ts +9 -0
- package/dist/internal/focus/focus-utils.js +94 -0
- package/dist/internal/focus/index.d.ts +3 -0
- package/dist/internal/focus/index.js +2 -0
- package/dist/internal/overlay-stack/index.d.ts +1 -0
- package/dist/internal/overlay-stack/index.js +1 -0
- package/dist/internal/overlay-stack/overlay-stack.d.ts +12 -0
- package/dist/internal/overlay-stack/overlay-stack.js +41 -0
- package/dist/internal/portal/index.d.ts +2 -0
- package/dist/internal/portal/index.js +1 -0
- package/dist/internal/portal/portal.d.ts +7 -0
- package/dist/internal/portal/portal.js +19 -0
- package/dist/internal/scroll-lock/index.d.ts +1 -0
- package/dist/internal/scroll-lock/index.js +1 -0
- package/dist/internal/scroll-lock/scroll-lock.d.ts +4 -0
- package/dist/internal/scroll-lock/scroll-lock.js +69 -0
- package/dist/styles.css +3852 -0
- package/dist/tokens/index.d.ts +2 -0
- package/dist/tokens/index.js +1 -0
- package/dist/tokens/token-types.d.ts +23 -0
- package/dist/tokens/token-types.js +1 -0
- package/dist/tokens/tokens.d.ts +139 -0
- package/dist/tokens/tokens.js +139 -0
- package/dist/utils/cn.d.ts +2 -0
- package/dist/utils/cn.js +3 -0
- package/dist/utils/compose-event-handlers.d.ts +6 -0
- package/dist/utils/compose-event-handlers.js +8 -0
- package/dist/utils/index.d.ts +4 -0
- package/dist/utils/index.js +2 -0
- package/package.json +282 -0
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { cn } from "../../utils/cn.js";
|
|
5
|
+
function resetKeysChanged(previousKeys = [], nextKeys = []) {
|
|
6
|
+
if (previousKeys.length !== nextKeys.length) {
|
|
7
|
+
return true;
|
|
8
|
+
}
|
|
9
|
+
return previousKeys.some((key, index) => !Object.is(key, nextKeys[index]));
|
|
10
|
+
}
|
|
11
|
+
export class ErrorBoundary extends React.Component {
|
|
12
|
+
state = {
|
|
13
|
+
error: null
|
|
14
|
+
};
|
|
15
|
+
static getDerivedStateFromError(error) {
|
|
16
|
+
return { error };
|
|
17
|
+
}
|
|
18
|
+
componentDidCatch(error, info) {
|
|
19
|
+
this.props.onError?.(error, info);
|
|
20
|
+
}
|
|
21
|
+
componentDidUpdate(previousProps) {
|
|
22
|
+
if (this.state.error && resetKeysChanged(previousProps.resetKeys, this.props.resetKeys)) {
|
|
23
|
+
this.reset();
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
reset = () => {
|
|
27
|
+
this.setState({ error: null });
|
|
28
|
+
};
|
|
29
|
+
render() {
|
|
30
|
+
const { children, fallback } = this.props;
|
|
31
|
+
const { error } = this.state;
|
|
32
|
+
if (!error) {
|
|
33
|
+
return children;
|
|
34
|
+
}
|
|
35
|
+
if (typeof fallback === "function") {
|
|
36
|
+
return fallback({ error, reset: this.reset });
|
|
37
|
+
}
|
|
38
|
+
return fallback ?? _jsx(ErrorFallback, { error: error });
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
export function ErrorFallback({ action, className, error, ref, title = "Something went wrong", ...props }) {
|
|
42
|
+
return (_jsxs("div", { ...props, ref: ref, "aria-label": typeof title === "string" ? title : undefined, className: cn("liano-error-fallback", className), role: "alert", children: [_jsx("h3", { className: "liano-error-fallback__title", children: title }), error ? _jsx("p", { className: "liano-error-fallback__message", children: error.message }) : null, action ? _jsx("div", { className: "liano-error-fallback__action", children: action }) : null] }));
|
|
43
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export interface FieldProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
3
|
+
invalid?: boolean;
|
|
4
|
+
required?: boolean;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
7
|
+
}
|
|
8
|
+
export interface FieldLabelProps extends React.LabelHTMLAttributes<HTMLLabelElement> {
|
|
9
|
+
ref?: React.Ref<HTMLLabelElement>;
|
|
10
|
+
}
|
|
11
|
+
export interface FieldTextProps extends React.HTMLAttributes<HTMLParagraphElement> {
|
|
12
|
+
ref?: React.Ref<HTMLParagraphElement>;
|
|
13
|
+
}
|
|
14
|
+
declare function FieldRoot({ className, disabled, invalid, ref, required, ...props }: FieldProps): React.JSX.Element;
|
|
15
|
+
declare function FieldLabel({ className, ref, ...props }: FieldLabelProps): React.JSX.Element;
|
|
16
|
+
declare function FieldDescription({ className, ref, ...props }: FieldTextProps): React.JSX.Element;
|
|
17
|
+
declare function FieldError({ className, ref, role, ...props }: FieldTextProps): React.JSX.Element;
|
|
18
|
+
export declare const Field: typeof FieldRoot & {
|
|
19
|
+
Label: typeof FieldLabel;
|
|
20
|
+
Description: typeof FieldDescription;
|
|
21
|
+
Error: typeof FieldError;
|
|
22
|
+
};
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { cn } from "../../utils/cn.js";
|
|
4
|
+
function FieldRoot({ className, disabled, invalid, ref, required, ...props }) {
|
|
5
|
+
return (_jsx("div", { ...props, ref: ref, className: cn("liano-field", className), "data-disabled": disabled ? "true" : undefined, "data-invalid": invalid ? "true" : undefined, "data-required": required ? "true" : undefined }));
|
|
6
|
+
}
|
|
7
|
+
function FieldLabel({ className, ref, ...props }) {
|
|
8
|
+
return _jsx("label", { ...props, ref: ref, className: cn("liano-field__label", className) });
|
|
9
|
+
}
|
|
10
|
+
function FieldDescription({ className, ref, ...props }) {
|
|
11
|
+
return _jsx("p", { ...props, ref: ref, className: cn("liano-field__description", className) });
|
|
12
|
+
}
|
|
13
|
+
function FieldError({ className, ref, role = "alert", ...props }) {
|
|
14
|
+
return _jsx("p", { ...props, ref: ref, className: cn("liano-field__error", className), role: role });
|
|
15
|
+
}
|
|
16
|
+
export const Field = Object.assign(FieldRoot, {
|
|
17
|
+
Label: FieldLabel,
|
|
18
|
+
Description: FieldDescription,
|
|
19
|
+
Error: FieldError
|
|
20
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Field } from "./field.js";
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export type FileUploadInputSize = "sm" | "md" | "lg";
|
|
3
|
+
export interface FileUploadInputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, "size" | "type"> {
|
|
4
|
+
label?: React.ReactNode;
|
|
5
|
+
description?: React.ReactNode;
|
|
6
|
+
error?: React.ReactNode;
|
|
7
|
+
invalid?: boolean;
|
|
8
|
+
buttonLabel?: React.ReactNode;
|
|
9
|
+
emptyLabel?: React.ReactNode;
|
|
10
|
+
size?: FileUploadInputSize;
|
|
11
|
+
ref?: React.Ref<HTMLInputElement>;
|
|
12
|
+
}
|
|
13
|
+
export declare function FileUploadInput({ "aria-describedby": ariaDescribedBy, buttonLabel, className, description, disabled, emptyLabel, error, id, invalid, label, onChange, ref, required, size, ...props }: FileUploadInputProps): React.JSX.Element;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { Field } from "../field/field.js";
|
|
5
|
+
import { cn } from "../../utils/cn.js";
|
|
6
|
+
function hasRenderableNode(value) {
|
|
7
|
+
return value !== undefined && value !== null && value !== false;
|
|
8
|
+
}
|
|
9
|
+
function joinIds(...ids) {
|
|
10
|
+
const value = ids.filter(Boolean).join(" ");
|
|
11
|
+
return value.length > 0 ? value : undefined;
|
|
12
|
+
}
|
|
13
|
+
function getFileSummary(files, emptyLabel) {
|
|
14
|
+
if (!files || files.length === 0) {
|
|
15
|
+
return emptyLabel;
|
|
16
|
+
}
|
|
17
|
+
return Array.from(files)
|
|
18
|
+
.map((file) => file.name)
|
|
19
|
+
.join(", ");
|
|
20
|
+
}
|
|
21
|
+
export function FileUploadInput({ "aria-describedby": ariaDescribedBy, buttonLabel = "Choose file", className, description, disabled, emptyLabel = "No file selected", error, id, invalid, label, onChange, ref, required, size = "md", ...props }) {
|
|
22
|
+
const generatedId = React.useId();
|
|
23
|
+
const inputId = id ?? generatedId;
|
|
24
|
+
const [files, setFiles] = React.useState(null);
|
|
25
|
+
const hasDescription = hasRenderableNode(description);
|
|
26
|
+
const hasError = hasRenderableNode(error);
|
|
27
|
+
const invalidState = invalid || hasError;
|
|
28
|
+
const descriptionId = hasDescription ? `${inputId}-description` : undefined;
|
|
29
|
+
const errorId = hasError ? `${inputId}-error` : undefined;
|
|
30
|
+
const summaryId = `${inputId}-summary`;
|
|
31
|
+
const describedBy = joinIds(ariaDescribedBy, descriptionId, errorId);
|
|
32
|
+
function handleChange(event) {
|
|
33
|
+
setFiles(event.currentTarget.files);
|
|
34
|
+
onChange?.(event);
|
|
35
|
+
}
|
|
36
|
+
const input = (_jsxs("div", { className: "liano-file-upload-input", children: [_jsx("span", { "aria-hidden": "true", className: "liano-file-upload-input__button", children: buttonLabel }), _jsx("input", { ...props, ref: ref, "aria-describedby": describedBy, "aria-invalid": invalidState ? true : undefined, className: cn("liano-file-upload-input__control", className), "data-disabled": disabled ? "true" : undefined, "data-invalid": invalidState ? "true" : undefined, "data-required": required ? "true" : undefined, "data-size": size, disabled: disabled, id: inputId, onChange: handleChange, required: required, type: "file" }), _jsx("span", { className: "liano-file-upload-input__summary", id: summaryId, children: getFileSummary(files, emptyLabel) })] }));
|
|
37
|
+
if (!hasRenderableNode(label) && !hasDescription && !hasError) {
|
|
38
|
+
return input;
|
|
39
|
+
}
|
|
40
|
+
return (_jsxs(Field, { disabled: Boolean(disabled), invalid: invalidState, required: Boolean(required), children: [hasRenderableNode(label) ? _jsx(Field.Label, { htmlFor: inputId, children: label }) : null, input, hasDescription ? _jsx(Field.Description, { id: descriptionId, children: description }) : null, hasError ? _jsx(Field.Error, { id: errorId, children: error }) : null] }));
|
|
41
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export interface FormProps extends React.FormHTMLAttributes<HTMLFormElement> {
|
|
3
|
+
ref?: React.Ref<HTMLFormElement>;
|
|
4
|
+
}
|
|
5
|
+
export interface FormFieldProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
6
|
+
name?: string;
|
|
7
|
+
id?: string;
|
|
8
|
+
invalid?: boolean;
|
|
9
|
+
required?: boolean;
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
}
|
|
12
|
+
export interface FormItemProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
13
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
14
|
+
}
|
|
15
|
+
export interface FormLabelProps extends React.LabelHTMLAttributes<HTMLLabelElement> {
|
|
16
|
+
ref?: React.Ref<HTMLLabelElement>;
|
|
17
|
+
}
|
|
18
|
+
export interface FormControlProps {
|
|
19
|
+
children: React.ReactElement;
|
|
20
|
+
}
|
|
21
|
+
export interface FormTextProps extends React.HTMLAttributes<HTMLParagraphElement> {
|
|
22
|
+
ref?: React.Ref<HTMLParagraphElement>;
|
|
23
|
+
}
|
|
24
|
+
export declare function Form({ className, ref, ...props }: FormProps): React.JSX.Element;
|
|
25
|
+
export declare function FormField({ children, className, disabled, id, invalid, required, ...props }: FormFieldProps): React.JSX.Element;
|
|
26
|
+
export declare function FormItem({ className, ref, ...props }: FormItemProps): React.JSX.Element;
|
|
27
|
+
export declare function FormLabel({ className, htmlFor, ref, ...props }: FormLabelProps): React.JSX.Element;
|
|
28
|
+
export declare function FormControl({ children }: FormControlProps): React.ReactElement<Record<string, unknown>, string | React.JSXElementConstructor<any>>;
|
|
29
|
+
export declare function FormDescription({ className, ...props }: FormTextProps): React.JSX.Element;
|
|
30
|
+
export declare function FormMessage({ className, role, ...props }: FormTextProps): React.JSX.Element;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { cn } from "../../utils/cn.js";
|
|
5
|
+
const FormFieldContext = React.createContext(null);
|
|
6
|
+
function useFormFieldContext(calledBy) {
|
|
7
|
+
const context = React.useContext(FormFieldContext);
|
|
8
|
+
if (!context) {
|
|
9
|
+
throw new Error(`"${calledBy}" must be used within a <FormField />`);
|
|
10
|
+
}
|
|
11
|
+
return context;
|
|
12
|
+
}
|
|
13
|
+
function joinIds(ids) {
|
|
14
|
+
const value = ids.filter(Boolean).join(" ");
|
|
15
|
+
return value.length > 0 ? value : undefined;
|
|
16
|
+
}
|
|
17
|
+
export function Form({ className, ref, ...props }) {
|
|
18
|
+
return _jsx("form", { ...props, ref: ref, className: cn("liano-form", className) });
|
|
19
|
+
}
|
|
20
|
+
export function FormField({ children, className, disabled, id, invalid, required, ...props }) {
|
|
21
|
+
const generatedId = React.useId();
|
|
22
|
+
const controlId = id ?? generatedId;
|
|
23
|
+
const [descriptionIds, setDescriptionIds] = React.useState([]);
|
|
24
|
+
const registerDescription = React.useCallback((descriptionId) => {
|
|
25
|
+
setDescriptionIds((ids) => ids.includes(descriptionId) ? ids : [...ids, descriptionId]);
|
|
26
|
+
}, []);
|
|
27
|
+
const unregisterDescription = React.useCallback((descriptionId) => {
|
|
28
|
+
setDescriptionIds((ids) => ids.filter((entry) => entry !== descriptionId));
|
|
29
|
+
}, []);
|
|
30
|
+
const context = React.useMemo(() => ({
|
|
31
|
+
controlId,
|
|
32
|
+
descriptionIds,
|
|
33
|
+
...(disabled !== undefined ? { disabled } : {}),
|
|
34
|
+
...(invalid !== undefined ? { invalid } : {}),
|
|
35
|
+
...(required !== undefined ? { required } : {}),
|
|
36
|
+
registerDescription,
|
|
37
|
+
unregisterDescription
|
|
38
|
+
}), [controlId, descriptionIds, disabled, invalid, registerDescription, required, unregisterDescription]);
|
|
39
|
+
return (_jsx(FormFieldContext.Provider, { value: context, children: _jsx("div", { ...props, className: cn("liano-form-field", className), "data-disabled": disabled ? "true" : undefined, "data-invalid": invalid ? "true" : undefined, "data-required": required ? "true" : undefined, children: children }) }));
|
|
40
|
+
}
|
|
41
|
+
export function FormItem({ className, ref, ...props }) {
|
|
42
|
+
return _jsx("div", { ...props, ref: ref, className: cn("liano-form-item", className) });
|
|
43
|
+
}
|
|
44
|
+
export function FormLabel({ className, htmlFor, ref, ...props }) {
|
|
45
|
+
const context = useFormFieldContext("FormLabel");
|
|
46
|
+
return _jsx("label", { ...props, ref: ref, className: cn("liano-form-label", className), htmlFor: htmlFor ?? context.controlId });
|
|
47
|
+
}
|
|
48
|
+
export function FormControl({ children }) {
|
|
49
|
+
const context = useFormFieldContext("FormControl");
|
|
50
|
+
if (!React.isValidElement(children)) {
|
|
51
|
+
throw new Error("\"FormControl\" expects one valid React element child.");
|
|
52
|
+
}
|
|
53
|
+
const props = {};
|
|
54
|
+
const childProps = children.props;
|
|
55
|
+
const describedBy = joinIds(context.descriptionIds);
|
|
56
|
+
if (childProps.id === undefined) {
|
|
57
|
+
props.id = context.controlId;
|
|
58
|
+
}
|
|
59
|
+
if (childProps["aria-describedby"] === undefined && describedBy !== undefined) {
|
|
60
|
+
props["aria-describedby"] = describedBy;
|
|
61
|
+
}
|
|
62
|
+
if (childProps["aria-invalid"] === undefined && context.invalid !== undefined) {
|
|
63
|
+
props["aria-invalid"] = context.invalid;
|
|
64
|
+
}
|
|
65
|
+
if (childProps.disabled === undefined && context.disabled !== undefined) {
|
|
66
|
+
props.disabled = context.disabled;
|
|
67
|
+
}
|
|
68
|
+
if (childProps.required === undefined && context.required !== undefined) {
|
|
69
|
+
props.required = context.required;
|
|
70
|
+
}
|
|
71
|
+
return React.cloneElement(children, props);
|
|
72
|
+
}
|
|
73
|
+
function FormText({ className, id, ref, role, textRole, ...props }) {
|
|
74
|
+
const context = useFormFieldContext(textRole ?? "FormText");
|
|
75
|
+
const generatedId = React.useId();
|
|
76
|
+
const textId = id ?? `${context.controlId}-${generatedId}`;
|
|
77
|
+
React.useLayoutEffect(() => {
|
|
78
|
+
context.registerDescription(textId);
|
|
79
|
+
return () => context.unregisterDescription(textId);
|
|
80
|
+
}, [context.registerDescription, context.unregisterDescription, textId]);
|
|
81
|
+
return _jsx("p", { ...props, ref: ref, id: textId, role: role, className: className });
|
|
82
|
+
}
|
|
83
|
+
export function FormDescription({ className, ...props }) {
|
|
84
|
+
return _jsx(FormText, { ...props, className: cn("liano-form-description", className), textRole: "FormDescription" });
|
|
85
|
+
}
|
|
86
|
+
export function FormMessage({ className, role = "alert", ...props }) {
|
|
87
|
+
return _jsx(FormText, { ...props, className: cn("liano-form-message", className), role: role, textRole: "FormMessage" });
|
|
88
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { ButtonSize, ButtonVariant } from "../button/button.js";
|
|
3
|
+
export interface IconButtonProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, "disabled"> {
|
|
4
|
+
variant?: ButtonVariant;
|
|
5
|
+
size?: ButtonSize;
|
|
6
|
+
loading?: boolean;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
ref?: React.Ref<HTMLButtonElement>;
|
|
9
|
+
}
|
|
10
|
+
export declare function IconButton({ children, className, disabled, loading, ref, size, type, variant, ...props }: IconButtonProps): React.JSX.Element;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { Spinner } from "../spinner/spinner.js";
|
|
4
|
+
import { cn } from "../../utils/cn.js";
|
|
5
|
+
export function IconButton({ children, className, disabled, loading = false, ref, size = "md", type = "button", variant = "secondary", ...props }) {
|
|
6
|
+
const isDisabled = disabled || loading;
|
|
7
|
+
return (_jsx("button", { ...props, ref: ref, "aria-busy": loading ? true : undefined, className: cn("liano-icon-button", className), "data-disabled": isDisabled ? "true" : undefined, "data-loading": loading ? "true" : undefined, "data-size": size, "data-variant": variant, disabled: isDisabled, type: type, children: loading ? _jsx(Spinner, { size: "sm" }) : children }));
|
|
8
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { IconButton } from "./icon-button.js";
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
export { Accordion } from "./accordion/index.js";
|
|
2
|
+
export type { AccordionContentProps, AccordionItemProps, AccordionProps, AccordionTriggerProps, AccordionType, AccordionValue } from "./accordion/index.js";
|
|
3
|
+
export { Alert } from "./alert/index.js";
|
|
4
|
+
export type { AlertDescriptionProps, AlertProps, AlertRoot, AlertTitleProps, AlertTone } from "./alert/index.js";
|
|
5
|
+
export { Avatar } from "./avatar/index.js";
|
|
6
|
+
export type { AvatarProps, AvatarShape, AvatarSize } from "./avatar/index.js";
|
|
7
|
+
export { Badge } from "./badge/index.js";
|
|
8
|
+
export type { BadgeProps, BadgeSize, BadgeTone, BadgeVariant } from "./badge/index.js";
|
|
9
|
+
export { Breadcrumbs } from "./breadcrumbs/index.js";
|
|
10
|
+
export type { BreadcrumbsItemProps, BreadcrumbsProps } from "./breadcrumbs/index.js";
|
|
11
|
+
export { Button } from "./button/index.js";
|
|
12
|
+
export type { ButtonProps, ButtonSize, ButtonVariant } from "./button/index.js";
|
|
13
|
+
export { Card } from "./card/index.js";
|
|
14
|
+
export type { CardDescriptionProps, CardPadding, CardProps, CardSlotProps, CardTitleProps, CardVariant } from "./card/index.js";
|
|
15
|
+
export { Checkbox } from "./checkbox/index.js";
|
|
16
|
+
export type { CheckboxProps, CheckboxSize } from "./checkbox/index.js";
|
|
17
|
+
export { CodeBlock } from "./code-block/index.js";
|
|
18
|
+
export type { CodeBlockProps, CodeBlockSize } from "./code-block/index.js";
|
|
19
|
+
export { Collapsible } from "./collapsible/index.js";
|
|
20
|
+
export type { CollapsibleContentProps, CollapsibleProps, CollapsibleTriggerProps } from "./collapsible/index.js";
|
|
21
|
+
export { CopyButton, CopyableText } from "./copy-button/index.js";
|
|
22
|
+
export type { CopyButtonProps, CopyButtonSize, CopyStatus, CopyableTextProps } from "./copy-button/index.js";
|
|
23
|
+
export { Dialog } from "./dialog/index.js";
|
|
24
|
+
export type { DialogCloseProps, DialogContentProps, DialogDescriptionProps, DialogFooterProps, DialogHeaderProps, DialogOverlayProps, DialogProps, DialogTitleProps, DialogTriggerProps } from "./dialog/index.js";
|
|
25
|
+
export { DropdownMenu } from "./dropdown-menu/index.js";
|
|
26
|
+
export type { DropdownMenuContentProps, DropdownMenuItemProps, DropdownMenuProps, DropdownMenuSeparatorProps, DropdownMenuTriggerProps } from "./dropdown-menu/index.js";
|
|
27
|
+
export { AlertDialog } from "./alert-dialog/index.js";
|
|
28
|
+
export type { AlertDialogActionProps, AlertDialogCancelProps, AlertDialogContentProps, AlertDialogDescriptionProps, AlertDialogFooterProps, AlertDialogProps, AlertDialogTitleProps, AlertDialogTriggerProps } from "./alert-dialog/index.js";
|
|
29
|
+
export { Sheet } from "./sheet/index.js";
|
|
30
|
+
export type { SheetCloseProps, SheetContentProps, SheetDescriptionProps, SheetFooterProps, SheetHeaderProps, SheetProps, SheetSide, SheetTitleProps, SheetTriggerProps } from "./sheet/index.js";
|
|
31
|
+
export { ScrollArea } from "./scroll-area/index.js";
|
|
32
|
+
export type { ScrollAreaOrientation, ScrollAreaProps, ScrollAreaType, ScrollBarProps } from "./scroll-area/index.js";
|
|
33
|
+
export { Command, CommandDialog } from "./command/index.js";
|
|
34
|
+
export type { CommandDialogProps, CommandEmptyProps, CommandGroupProps, CommandInputProps, CommandItemProps, CommandListProps, CommandProps, CommandSeparatorProps } from "./command/index.js";
|
|
35
|
+
export { Combobox } from "./combobox/index.js";
|
|
36
|
+
export type { ComboboxOption, ComboboxProps } from "./combobox/index.js";
|
|
37
|
+
export { ContextMenu } from "./context-menu/index.js";
|
|
38
|
+
export type { ContextMenuContentProps, ContextMenuItemProps, ContextMenuProps, ContextMenuSeparatorProps, ContextMenuTriggerProps } from "./context-menu/index.js";
|
|
39
|
+
export { Menubar } from "./menubar/index.js";
|
|
40
|
+
export type { MenubarContentProps, MenubarItemProps, MenubarMenuProps, MenubarProps, MenubarSeparatorProps, MenubarTriggerProps } from "./menubar/index.js";
|
|
41
|
+
export { EmptyState } from "./empty-state/index.js";
|
|
42
|
+
export type { EmptyStateAlign, EmptyStateProps, EmptyStateSize } from "./empty-state/index.js";
|
|
43
|
+
export { ErrorBoundary, ErrorFallback } from "./error-boundary/index.js";
|
|
44
|
+
export type { ErrorBoundaryFallbackProps, ErrorBoundaryProps, ErrorBoundaryState, ErrorFallbackProps } from "./error-boundary/index.js";
|
|
45
|
+
export { Field } from "./field/index.js";
|
|
46
|
+
export type { FieldLabelProps, FieldProps, FieldTextProps } from "./field/index.js";
|
|
47
|
+
export { Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage } from "./form/index.js";
|
|
48
|
+
export type { FormControlProps, FormFieldProps, FormItemProps, FormLabelProps, FormProps, FormTextProps } from "./form/index.js";
|
|
49
|
+
export { FileUploadInput } from "./file-upload-input/index.js";
|
|
50
|
+
export type { FileUploadInputProps, FileUploadInputSize } from "./file-upload-input/index.js";
|
|
51
|
+
export { IconButton } from "./icon-button/index.js";
|
|
52
|
+
export type { IconButtonProps } from "./icon-button/index.js";
|
|
53
|
+
export { Input } from "./input/index.js";
|
|
54
|
+
export type { InputProps, InputSize } from "./input/index.js";
|
|
55
|
+
export { Label } from "./label/index.js";
|
|
56
|
+
export type { LabelProps, LabelSize } from "./label/index.js";
|
|
57
|
+
export { Pagination } from "./pagination/index.js";
|
|
58
|
+
export type { PaginationProps, PaginationRangeItem } from "./pagination/index.js";
|
|
59
|
+
export { Popover } from "./popover/index.js";
|
|
60
|
+
export type { PopoverContentProps, PopoverProps, PopoverTriggerProps } from "./popover/index.js";
|
|
61
|
+
export { Progress } from "./progress/index.js";
|
|
62
|
+
export type { ProgressProps, ProgressSize, ProgressState, ProgressTone } from "./progress/index.js";
|
|
63
|
+
export { RadioGroup, RadioGroupItem } from "./radio-group/index.js";
|
|
64
|
+
export type { RadioGroupItemProps, RadioGroupOption, RadioGroupOrientation, RadioGroupProps, RadioGroupSize } from "./radio-group/index.js";
|
|
65
|
+
export { Select } from "./select/index.js";
|
|
66
|
+
export type { SelectContentProps, SelectItemProps, SelectProps, SelectSize, SelectTriggerProps, SelectValueProps } from "./select/index.js";
|
|
67
|
+
export { ResponsiveContainer } from "./responsive-container/index.js";
|
|
68
|
+
export type { ResponsiveContainerGutter, ResponsiveContainerProps, ResponsiveContainerSize } from "./responsive-container/index.js";
|
|
69
|
+
export { Separator } from "./separator/index.js";
|
|
70
|
+
export type { SeparatorOrientation, SeparatorProps } from "./separator/index.js";
|
|
71
|
+
export { Slider } from "./slider/index.js";
|
|
72
|
+
export type { SliderProps, SliderSize } from "./slider/index.js";
|
|
73
|
+
export { SidebarShell } from "./sidebar-shell/index.js";
|
|
74
|
+
export type { SidebarShellLandmarkSlotProps, SidebarShellMainProps, SidebarShellProps, SidebarShellSide, SidebarShellSidebarProps, SidebarShellSlotProps, SidebarShellWidth } from "./sidebar-shell/index.js";
|
|
75
|
+
export { SectionedSidebarNav } from "./sectioned-sidebar-nav/index.js";
|
|
76
|
+
export type { SectionedSidebarNavItemBaseProps, SectionedSidebarNavItemProps, SectionedSidebarNavListProps, SectionedSidebarNavProps, SectionedSidebarNavSectionProps, SectionedSidebarNavSectionTitleProps } from "./sectioned-sidebar-nav/index.js";
|
|
77
|
+
export { Skeleton } from "./skeleton/index.js";
|
|
78
|
+
export type { SkeletonProps, SkeletonRounded } from "./skeleton/index.js";
|
|
79
|
+
export { Spinner } from "./spinner/index.js";
|
|
80
|
+
export type { SpinnerProps, SpinnerSize, SpinnerTone } from "./spinner/index.js";
|
|
81
|
+
export { Stat } from "./stat/index.js";
|
|
82
|
+
export type { StatProps, StatSize, StatTone } from "./stat/index.js";
|
|
83
|
+
export { Switch } from "./switch/index.js";
|
|
84
|
+
export type { SwitchProps, SwitchSize } from "./switch/index.js";
|
|
85
|
+
export { Table } from "./table/index.js";
|
|
86
|
+
export type { TableBodyProps, TableCaptionProps, TableCellProps, TableFooterProps, TableHeadProps, TableHeaderProps, TableProps, TableRowProps } from "./table/index.js";
|
|
87
|
+
export { Tabs } from "./tabs/index.js";
|
|
88
|
+
export type { TabsActivationMode, TabsContentProps, TabsListProps, TabsOrientation, TabsProps, TabsTriggerProps } from "./tabs/index.js";
|
|
89
|
+
export { TabsWithSidebar } from "./tabs-with-sidebar/index.js";
|
|
90
|
+
export type { TabsWithSidebarPanelProps, TabsWithSidebarProps, TabsWithSidebarSidebarProps, TabsWithSidebarWidth } from "./tabs-with-sidebar/index.js";
|
|
91
|
+
export { Textarea } from "./textarea/index.js";
|
|
92
|
+
export type { TextareaProps, TextareaSize } from "./textarea/index.js";
|
|
93
|
+
export { Toast, ToastViewport } from "./toast/index.js";
|
|
94
|
+
export type { ToastActionProps, ToastCloseProps, ToastPlacement, ToastProps, ToastTextProps, ToastTone, ToastViewportProps } from "./toast/index.js";
|
|
95
|
+
export { Tooltip } from "./tooltip/index.js";
|
|
96
|
+
export type { TooltipProps } from "./tooltip/index.js";
|
|
97
|
+
export { Toggle } from "./toggle/index.js";
|
|
98
|
+
export type { ToggleProps, ToggleSize, ToggleVariant } from "./toggle/index.js";
|
|
99
|
+
export { ToggleGroup } from "./toggle-group/index.js";
|
|
100
|
+
export type { ToggleGroupItemProps, ToggleGroupMultipleProps, ToggleGroupProps, ToggleGroupSingleProps } from "./toggle-group/index.js";
|
|
101
|
+
export { Conversation } from "./conversation/index.js";
|
|
102
|
+
export type { ConversationListProps, ConversationMessageProps, ConversationMessageRole, ConversationPromptInputProps, ConversationPromptInputSubmitProps, ConversationPromptInputTextareaProps, ConversationProps, ConversationReasoningProps, ConversationSlotProps, ConversationToolProps, ConversationToolStatus } from "./conversation/index.js";
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
export { Accordion } from "./accordion/index.js";
|
|
2
|
+
export { Alert } from "./alert/index.js";
|
|
3
|
+
export { Avatar } from "./avatar/index.js";
|
|
4
|
+
export { Badge } from "./badge/index.js";
|
|
5
|
+
export { Breadcrumbs } from "./breadcrumbs/index.js";
|
|
6
|
+
export { Button } from "./button/index.js";
|
|
7
|
+
export { Card } from "./card/index.js";
|
|
8
|
+
export { Checkbox } from "./checkbox/index.js";
|
|
9
|
+
export { CodeBlock } from "./code-block/index.js";
|
|
10
|
+
export { Collapsible } from "./collapsible/index.js";
|
|
11
|
+
export { CopyButton, CopyableText } from "./copy-button/index.js";
|
|
12
|
+
export { Dialog } from "./dialog/index.js";
|
|
13
|
+
export { DropdownMenu } from "./dropdown-menu/index.js";
|
|
14
|
+
export { AlertDialog } from "./alert-dialog/index.js";
|
|
15
|
+
export { Sheet } from "./sheet/index.js";
|
|
16
|
+
export { ScrollArea } from "./scroll-area/index.js";
|
|
17
|
+
export { Command, CommandDialog } from "./command/index.js";
|
|
18
|
+
export { Combobox } from "./combobox/index.js";
|
|
19
|
+
export { ContextMenu } from "./context-menu/index.js";
|
|
20
|
+
export { Menubar } from "./menubar/index.js";
|
|
21
|
+
export { EmptyState } from "./empty-state/index.js";
|
|
22
|
+
export { ErrorBoundary, ErrorFallback } from "./error-boundary/index.js";
|
|
23
|
+
export { Field } from "./field/index.js";
|
|
24
|
+
export { Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage } from "./form/index.js";
|
|
25
|
+
export { FileUploadInput } from "./file-upload-input/index.js";
|
|
26
|
+
export { IconButton } from "./icon-button/index.js";
|
|
27
|
+
export { Input } from "./input/index.js";
|
|
28
|
+
export { Label } from "./label/index.js";
|
|
29
|
+
export { Pagination } from "./pagination/index.js";
|
|
30
|
+
export { Popover } from "./popover/index.js";
|
|
31
|
+
export { Progress } from "./progress/index.js";
|
|
32
|
+
export { RadioGroup, RadioGroupItem } from "./radio-group/index.js";
|
|
33
|
+
export { Select } from "./select/index.js";
|
|
34
|
+
export { ResponsiveContainer } from "./responsive-container/index.js";
|
|
35
|
+
export { Separator } from "./separator/index.js";
|
|
36
|
+
export { Slider } from "./slider/index.js";
|
|
37
|
+
export { SidebarShell } from "./sidebar-shell/index.js";
|
|
38
|
+
export { SectionedSidebarNav } from "./sectioned-sidebar-nav/index.js";
|
|
39
|
+
export { Skeleton } from "./skeleton/index.js";
|
|
40
|
+
export { Spinner } from "./spinner/index.js";
|
|
41
|
+
export { Stat } from "./stat/index.js";
|
|
42
|
+
export { Switch } from "./switch/index.js";
|
|
43
|
+
export { Table } from "./table/index.js";
|
|
44
|
+
export { Tabs } from "./tabs/index.js";
|
|
45
|
+
export { TabsWithSidebar } from "./tabs-with-sidebar/index.js";
|
|
46
|
+
export { Textarea } from "./textarea/index.js";
|
|
47
|
+
export { Toast, ToastViewport } from "./toast/index.js";
|
|
48
|
+
export { Tooltip } from "./tooltip/index.js";
|
|
49
|
+
export { Toggle } from "./toggle/index.js";
|
|
50
|
+
export { ToggleGroup } from "./toggle-group/index.js";
|
|
51
|
+
export { Conversation } from "./conversation/index.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Input } from "./input.js";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export type InputSize = "sm" | "md" | "lg";
|
|
3
|
+
export interface InputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, "size"> {
|
|
4
|
+
label?: React.ReactNode;
|
|
5
|
+
description?: React.ReactNode;
|
|
6
|
+
error?: React.ReactNode;
|
|
7
|
+
invalid?: boolean;
|
|
8
|
+
size?: InputSize;
|
|
9
|
+
ref?: React.Ref<HTMLInputElement>;
|
|
10
|
+
}
|
|
11
|
+
export declare function Input({ "aria-describedby": ariaDescribedBy, className, description, disabled, error, id, invalid, label, ref, required, size, ...props }: InputProps): React.JSX.Element;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { Field } from "../field/field.js";
|
|
4
|
+
import { cn } from "../../utils/cn.js";
|
|
5
|
+
function hasRenderableNode(value) {
|
|
6
|
+
return value !== undefined && value !== null && value !== false;
|
|
7
|
+
}
|
|
8
|
+
function joinIds(...ids) {
|
|
9
|
+
const value = ids.filter(Boolean).join(" ");
|
|
10
|
+
return value.length > 0 ? value : undefined;
|
|
11
|
+
}
|
|
12
|
+
export function Input({ "aria-describedby": ariaDescribedBy, className, description, disabled, error, id, invalid, label, ref, required, size = "md", ...props }) {
|
|
13
|
+
const generatedId = React.useId();
|
|
14
|
+
const inputId = id ?? generatedId;
|
|
15
|
+
const hasDescription = hasRenderableNode(description);
|
|
16
|
+
const hasError = hasRenderableNode(error);
|
|
17
|
+
const hasLabel = hasRenderableNode(label);
|
|
18
|
+
const invalidState = invalid || hasError;
|
|
19
|
+
const descriptionId = hasDescription ? `${inputId}-description` : undefined;
|
|
20
|
+
const errorId = hasError ? `${inputId}-error` : undefined;
|
|
21
|
+
const describedBy = joinIds(ariaDescribedBy, descriptionId, errorId);
|
|
22
|
+
const input = (_jsx("input", { ...props, ref: ref, "aria-describedby": describedBy, "aria-invalid": invalidState ? true : undefined, className: cn("liano-input", className), "data-disabled": disabled ? "true" : undefined, "data-invalid": invalidState ? "true" : undefined, "data-required": required ? "true" : undefined, "data-size": size, disabled: disabled, id: inputId, required: required }));
|
|
23
|
+
if (!hasLabel && !hasDescription && !hasError) {
|
|
24
|
+
return input;
|
|
25
|
+
}
|
|
26
|
+
return (_jsxs(Field, { disabled: Boolean(disabled), invalid: invalidState, required: Boolean(required), children: [hasLabel ? _jsx(Field.Label, { htmlFor: inputId, children: label }) : null, input, hasDescription ? _jsx(Field.Description, { id: descriptionId, children: description }) : null, hasError ? _jsx(Field.Error, { id: errorId, children: error }) : null] }));
|
|
27
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Label } from "./label.js";
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export type LabelSize = "sm" | "md";
|
|
3
|
+
export interface LabelProps extends React.LabelHTMLAttributes<HTMLLabelElement> {
|
|
4
|
+
size?: LabelSize;
|
|
5
|
+
required?: boolean;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
ref?: React.Ref<HTMLLabelElement>;
|
|
8
|
+
}
|
|
9
|
+
export declare function Label({ children, className, disabled, ref, required, size, ...props }: LabelProps): React.JSX.Element;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { cn } from "../../utils/cn.js";
|
|
4
|
+
export function Label({ children, className, disabled, ref, required, size = "md", ...props }) {
|
|
5
|
+
return (_jsx("label", { ...props, ref: ref, className: cn("liano-label", className), "data-disabled": disabled ? "true" : undefined, "data-required": required ? "true" : undefined, "data-size": size, children: children }));
|
|
6
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export interface MenubarProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
3
|
+
defaultValue?: string;
|
|
4
|
+
onValueChange?: (value: string | undefined) => void;
|
|
5
|
+
value?: string;
|
|
6
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
7
|
+
}
|
|
8
|
+
export interface MenubarMenuProps {
|
|
9
|
+
children: React.ReactNode;
|
|
10
|
+
value: string;
|
|
11
|
+
}
|
|
12
|
+
export interface MenubarTriggerProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
13
|
+
ref?: React.Ref<HTMLButtonElement>;
|
|
14
|
+
}
|
|
15
|
+
export interface MenubarContentProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
16
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
17
|
+
}
|
|
18
|
+
export interface MenubarItemProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
19
|
+
onSelect?: (event: React.SyntheticEvent<HTMLElement>) => void;
|
|
20
|
+
ref?: React.Ref<HTMLButtonElement>;
|
|
21
|
+
}
|
|
22
|
+
export interface MenubarSeparatorProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
23
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
24
|
+
}
|
|
25
|
+
declare function MenubarRoot({ children, className, defaultValue, onKeyDown, onValueChange, ref, value, ...props }: MenubarProps): React.JSX.Element;
|
|
26
|
+
declare function MenubarMenu({ children, value }: MenubarMenuProps): React.JSX.Element;
|
|
27
|
+
declare function MenubarTrigger({ children, className, disabled, onClick, onKeyDown, ref, type, ...props }: MenubarTriggerProps): React.JSX.Element;
|
|
28
|
+
declare function MenubarContent({ children, className, onKeyDown, ref, ...props }: MenubarContentProps): React.JSX.Element | null;
|
|
29
|
+
declare function MenubarItem({ children, className, disabled, onClick, onKeyDown, onSelect, ref, type, ...props }: MenubarItemProps): React.JSX.Element;
|
|
30
|
+
declare function MenubarSeparator({ className, ref, ...props }: MenubarSeparatorProps): React.JSX.Element;
|
|
31
|
+
type MenubarComponent = typeof MenubarRoot & {
|
|
32
|
+
Content: typeof MenubarContent;
|
|
33
|
+
Item: typeof MenubarItem;
|
|
34
|
+
Menu: typeof MenubarMenu;
|
|
35
|
+
Separator: typeof MenubarSeparator;
|
|
36
|
+
Trigger: typeof MenubarTrigger;
|
|
37
|
+
};
|
|
38
|
+
export declare const Menubar: MenubarComponent;
|
|
39
|
+
export {};
|