@k8slens/lds 0.58.2 → 0.58.3
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/lib/cjs/Avatar/Avatar.d.ts +3 -1
- package/lib/cjs/Badge/Badge.d.ts +6 -4
- package/lib/cjs/Button/Button.d.ts +34 -6
- package/lib/cjs/Button/shared.d.ts +30 -1
- package/lib/cjs/ButtonBar/ButtonBar.d.ts +17 -0
- package/lib/cjs/Checkbox/Checkbox.d.ts +7 -0
- package/lib/cjs/ConfirmDialog/ConfirmDialog.d.ts +16 -0
- package/lib/cjs/DrawerTransition/DrawerTransition.d.ts +20 -0
- package/lib/cjs/Input/Input.d.ts +8 -0
- package/lib/cjs/LinkButton/LinkButton.d.ts +7 -0
- package/lib/cjs/LoadingIndicator/LoadingIndicator.d.ts +8 -2
- package/lib/cjs/Lozenge/Lozenge.d.ts +4 -2
- package/lib/cjs/Modal/Modal.d.ts +26 -0
- package/lib/cjs/Notification/Notification.d.ts +18 -2
- package/lib/cjs/NumberBadge/NumberBadge.d.ts +1 -1
- package/lib/cjs/Panel/Panel.d.ts +28 -0
- package/lib/cjs/ProfileBlock/ProfileBlock.d.ts +8 -0
- package/lib/cjs/ProgressBar/ProgressBar.d.ts +11 -0
- package/lib/cjs/ProgressBar/ProgressBar.js +1 -1
- package/lib/cjs/RadioCard/RadioCard.d.ts +27 -1
- package/lib/cjs/Select/MultiOption.d.ts +14 -4
- package/lib/cjs/Select/Option.d.ts +6 -0
- package/lib/cjs/Select/Select.d.ts +39 -5
- package/lib/cjs/SideNav/SideNav.d.ts +9 -3
- package/lib/cjs/SideNav/SideNavGroup.d.ts +13 -5
- package/lib/cjs/SideNav/SideNavItem.d.ts +22 -5
- package/lib/cjs/Switch/Switch.d.ts +2 -0
- package/lib/cjs/Tooltip/Tooltip.d.ts +15 -3
- package/lib/cjs/UserMenu/UserMenu.d.ts +9 -2
- package/lib/cjs/UserMenu/UserMenuDropdown.d.ts +10 -6
- package/lib/cjs/UserMenu/UserMenuItem.d.ts +22 -1
- package/lib/es/Avatar/Avatar.d.ts +3 -1
- package/lib/es/Badge/Badge.d.ts +6 -4
- package/lib/es/Button/Button.d.ts +34 -6
- package/lib/es/Button/shared.d.ts +30 -1
- package/lib/es/ButtonBar/ButtonBar.d.ts +17 -0
- package/lib/es/Checkbox/Checkbox.d.ts +7 -0
- package/lib/es/ConfirmDialog/ConfirmDialog.d.ts +16 -0
- package/lib/es/DrawerTransition/DrawerTransition.d.ts +20 -0
- package/lib/es/Input/Input.d.ts +8 -0
- package/lib/es/LinkButton/LinkButton.d.ts +7 -0
- package/lib/es/LoadingIndicator/LoadingIndicator.d.ts +8 -2
- package/lib/es/Lozenge/Lozenge.d.ts +4 -2
- package/lib/es/Modal/Modal.d.ts +26 -0
- package/lib/es/Notification/Notification.d.ts +18 -2
- package/lib/es/NumberBadge/NumberBadge.d.ts +1 -1
- package/lib/es/Panel/Panel.d.ts +28 -0
- package/lib/es/ProfileBlock/ProfileBlock.d.ts +8 -0
- package/lib/es/ProgressBar/ProgressBar.d.ts +11 -0
- package/lib/es/ProgressBar/ProgressBar.js +1 -1
- package/lib/es/RadioCard/RadioCard.d.ts +27 -1
- package/lib/es/Select/MultiOption.d.ts +14 -4
- package/lib/es/Select/Option.d.ts +6 -0
- package/lib/es/Select/Select.d.ts +39 -5
- package/lib/es/SideNav/SideNav.d.ts +9 -3
- package/lib/es/SideNav/SideNavGroup.d.ts +13 -5
- package/lib/es/SideNav/SideNavItem.d.ts +22 -5
- package/lib/es/Switch/Switch.d.ts +2 -0
- package/lib/es/Tooltip/Tooltip.d.ts +15 -3
- package/lib/es/UserMenu/UserMenu.d.ts +9 -2
- package/lib/es/UserMenu/UserMenuDropdown.d.ts +10 -6
- package/lib/es/UserMenu/UserMenuItem.d.ts +22 -1
- package/llms.txt +262 -102
- package/package.json +3 -3
- /package/lib/web/{lds-v0-58-1 → lds-v0-58-2}/index.css +0 -0
- /package/lib/web/{lds-v0-58-1 → lds-v0-58-2}/index.js +0 -0
- /package/lib/web/{lds-v0-58-1 → lds-v0-58-2}/typography.css +0 -0
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React, { type HTMLAttributes } from "react";
|
|
2
2
|
import { type Icon } from "@k8slens/lds-icons/lib/es/Icon/Icon";
|
|
3
|
+
/** Props for the Avatar component. */
|
|
3
4
|
export interface AvatarProps extends Pick<HTMLAttributes<HTMLDivElement>, "aria-hidden" | "aria-label"> {
|
|
4
5
|
/**
|
|
5
6
|
* Full name of the user. Initials will be generated from this value and shown if no image is provided.
|
|
@@ -14,7 +15,8 @@ export interface AvatarProps extends Pick<HTMLAttributes<HTMLDivElement>, "aria-
|
|
|
14
15
|
*/
|
|
15
16
|
image?: string | Icon | null;
|
|
16
17
|
/**
|
|
17
|
-
* Size of the avatar.
|
|
18
|
+
* Size of the avatar.
|
|
19
|
+
* @default "md"
|
|
18
20
|
*/
|
|
19
21
|
size?: "sm" | "md" | "xl";
|
|
20
22
|
}
|
package/lib/cjs/Badge/Badge.d.ts
CHANGED
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
import React, { HTMLAttributes } from "react";
|
|
2
|
+
/** Props for the Badge component. */
|
|
2
3
|
export interface BadgeProps extends Pick<HTMLAttributes<HTMLSpanElement>, "id" | "className" | "title" | "aria-label" | "aria-hidden" | "role"> {
|
|
3
4
|
/**
|
|
4
|
-
* If no title
|
|
5
|
+
* If no title is provided, the badge will be hidden from screen readers.
|
|
5
6
|
*/
|
|
6
7
|
title?: string;
|
|
7
8
|
/**
|
|
8
|
-
* Defines the color of the
|
|
9
|
-
* @default secondary
|
|
9
|
+
* Defines the color of the badge.
|
|
10
|
+
* @default "secondary"
|
|
10
11
|
*/
|
|
11
12
|
type?: "primary" | "secondary" | "success" | "error" | "warning";
|
|
12
13
|
/**
|
|
13
|
-
*
|
|
14
|
+
* Size of the badge.
|
|
15
|
+
* @default "sm"
|
|
14
16
|
*/
|
|
15
17
|
size?: "sm" | "md" | "lg";
|
|
16
18
|
}
|
|
@@ -1,41 +1,65 @@
|
|
|
1
1
|
import React, { ButtonHTMLAttributes, ReactNode } from "react";
|
|
2
2
|
import { Props } from "./shared";
|
|
3
|
+
/** Props for the Button component. */
|
|
3
4
|
export interface ButtonProps extends Props, Pick<ButtonHTMLAttributes<HTMLButtonElement>, "id" | "className" | "aria-label" | "title"> {
|
|
5
|
+
/**
|
|
6
|
+
* The HTML `type` attribute for the underlying `<button>` element.
|
|
7
|
+
* @default "button"
|
|
8
|
+
*/
|
|
4
9
|
buttonType?: ButtonHTMLAttributes<HTMLButtonElement>["type"];
|
|
5
10
|
/**
|
|
6
|
-
* Specify the
|
|
11
|
+
* Specify the initial value of the button element, used when the button is inside a form.
|
|
7
12
|
*/
|
|
8
13
|
buttonValue?: ButtonHTMLAttributes<HTMLButtonElement>["value"];
|
|
9
14
|
/**
|
|
10
|
-
* Specify the
|
|
15
|
+
* Specify the name of the button element, used when the button is inside a form.
|
|
11
16
|
*/
|
|
12
17
|
buttonName?: ButtonHTMLAttributes<HTMLButtonElement>["name"];
|
|
18
|
+
/**
|
|
19
|
+
* Whether to show the loading activity indicator.
|
|
20
|
+
* @default false
|
|
21
|
+
*/
|
|
13
22
|
loading?: boolean;
|
|
14
23
|
/**
|
|
15
|
-
* When set to true
|
|
24
|
+
* When set to true, if the onClick callback returns a promise,
|
|
16
25
|
* loading activity indicator will be shown until the promise has been resolved/rejected.
|
|
26
|
+
* @default false
|
|
17
27
|
*/
|
|
18
28
|
loadingStateOnPromise?: boolean;
|
|
29
|
+
/** Click handler. May return a promise when used with `loadingStateOnPromise`. */
|
|
19
30
|
onClick?(e: React.MouseEvent<HTMLButtonElement, MouseEvent>): Promise<unknown> | unknown;
|
|
20
31
|
}
|
|
32
|
+
/** Props for the Button component when `label` is a ReactNode (requires explicit `aria-label`). */
|
|
21
33
|
export interface ButtonPropsWithLabelNode extends Omit<Props, "label">, Pick<ButtonHTMLAttributes<HTMLButtonElement>, "id" | "className" | "title"> {
|
|
34
|
+
/**
|
|
35
|
+
* The HTML `type` attribute for the underlying `<button>` element.
|
|
36
|
+
* @default "button"
|
|
37
|
+
*/
|
|
22
38
|
buttonType?: ButtonHTMLAttributes<HTMLButtonElement>["type"];
|
|
23
39
|
/**
|
|
24
|
-
* Specify the
|
|
40
|
+
* Specify the initial value of the button element, used when the button is inside a form.
|
|
25
41
|
*/
|
|
26
42
|
buttonValue?: ButtonHTMLAttributes<HTMLButtonElement>["value"];
|
|
27
43
|
/**
|
|
28
|
-
* Specify the
|
|
44
|
+
* Specify the name of the button element, used when the button is inside a form.
|
|
29
45
|
*/
|
|
30
46
|
buttonName?: ButtonHTMLAttributes<HTMLButtonElement>["name"];
|
|
47
|
+
/**
|
|
48
|
+
* Whether to show the loading activity indicator.
|
|
49
|
+
* @default false
|
|
50
|
+
*/
|
|
31
51
|
loading?: boolean;
|
|
32
52
|
/**
|
|
33
|
-
* When set to true
|
|
53
|
+
* When set to true, if the onClick callback returns a promise,
|
|
34
54
|
* loading activity indicator will be shown until the promise has been resolved/rejected.
|
|
55
|
+
* @default false
|
|
35
56
|
*/
|
|
36
57
|
loadingStateOnPromise?: boolean;
|
|
58
|
+
/** Required accessible label when `label` is a ReactNode. */
|
|
37
59
|
"aria-label": string;
|
|
60
|
+
/** Button label content, accepts ReactNode. */
|
|
38
61
|
label: ReactNode;
|
|
62
|
+
/** Click handler. May return a promise when used with `loadingStateOnPromise`. */
|
|
39
63
|
onClick?(e: React.MouseEvent<HTMLButtonElement, MouseEvent>): Promise<unknown> | unknown;
|
|
40
64
|
}
|
|
41
65
|
/**
|
|
@@ -44,6 +68,10 @@ export interface ButtonPropsWithLabelNode extends Omit<Props, "label">, Pick<But
|
|
|
44
68
|
* from `onClick` will show a loading indicator until the promise has been resolved/rejected.
|
|
45
69
|
*
|
|
46
70
|
* Usage: `import { Button } from "@k8slens/lds"`
|
|
71
|
+
*
|
|
72
|
+
* ```tsx
|
|
73
|
+
* <Button label="Save" type="primary" onClick={handleSave} />
|
|
74
|
+
* ```
|
|
47
75
|
*/
|
|
48
76
|
declare const Button: React.ForwardRefExoticComponent<(ButtonProps | ButtonPropsWithLabelNode) & React.RefAttributes<HTMLButtonElement>>;
|
|
49
77
|
export default Button;
|
|
@@ -4,17 +4,46 @@ export declare type Type = "default" | "primary" | "ok" | "danger" | "caution";
|
|
|
4
4
|
export declare type Size = "xxs" | "xs" | "sm" | "md";
|
|
5
5
|
export declare type IconPosition = "right" | "left";
|
|
6
6
|
export declare type TextTransform = "uppercase" | "capitalize";
|
|
7
|
+
/** Shared props for the Button component variants. */
|
|
7
8
|
export interface Props {
|
|
9
|
+
/** Text label rendered inside the button. */
|
|
8
10
|
label: string;
|
|
11
|
+
/** Icon component rendered alongside the label. */
|
|
9
12
|
icon?: Icon;
|
|
13
|
+
/**
|
|
14
|
+
* Which side of the label the icon is rendered on.
|
|
15
|
+
* @default "left"
|
|
16
|
+
*/
|
|
10
17
|
iconPosition?: IconPosition;
|
|
18
|
+
/**
|
|
19
|
+
* Visual style variant of the button.
|
|
20
|
+
* @default "default"
|
|
21
|
+
*/
|
|
11
22
|
type?: Type;
|
|
23
|
+
/**
|
|
24
|
+
* Size of the button.
|
|
25
|
+
* @default "md"
|
|
26
|
+
*/
|
|
12
27
|
size?: Size;
|
|
28
|
+
/**
|
|
29
|
+
* Shorthand for `type="primary"`.
|
|
30
|
+
* @deprecated Use `type="primary"` instead.
|
|
31
|
+
*/
|
|
13
32
|
primary?: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Whether the button is disabled.
|
|
35
|
+
* @default false
|
|
36
|
+
*/
|
|
14
37
|
disabled?: boolean;
|
|
38
|
+
/** Whether the button uses the discreet (low-emphasis) style. */
|
|
15
39
|
discreet?: boolean;
|
|
16
|
-
/**
|
|
40
|
+
/**
|
|
41
|
+
* Text transform applied to the label.
|
|
42
|
+
* @deprecated Use `textTransform` instead.
|
|
43
|
+
*/
|
|
17
44
|
case?: TextTransform;
|
|
45
|
+
/** Text transform applied to the label. */
|
|
18
46
|
textTransform?: TextTransform;
|
|
47
|
+
/** Additional content rendered after the label. */
|
|
19
48
|
children?: React.ReactNode;
|
|
20
49
|
}
|
|
@@ -3,15 +3,32 @@ declare type ExtractIntrinsicElementProps<Element extends keyof JSX.IntrinsicEle
|
|
|
3
3
|
declare type ExtractComponentProps<TComponentOrTProps> = TComponentOrTProps extends React.ComponentType<infer TProps> ? TProps : TComponentOrTProps;
|
|
4
4
|
declare type ExtractProps<TComponentOrTProps> = TComponentOrTProps extends keyof JSX.IntrinsicElements ? ExtractIntrinsicElementProps<TComponentOrTProps> : ExtractComponentProps<TComponentOrTProps>;
|
|
5
5
|
export declare type Type = "default" | "centered" | "stacked" | "grid";
|
|
6
|
+
/** Props for the ButtonBar component. */
|
|
6
7
|
export declare type ButtonBarProps<ElementType extends JSX.IntrinsicElements | React.ElementType<any>> = Partial<Omit<ExtractProps<ElementType>, "children" | "as" | "type" | "gridSize">> & {
|
|
8
|
+
/**
|
|
9
|
+
* Element or component to render as the container.
|
|
10
|
+
* @default "div"
|
|
11
|
+
*/
|
|
7
12
|
as?: keyof JSX.IntrinsicElements | React.ElementType<any> | undefined;
|
|
13
|
+
/**
|
|
14
|
+
* Layout type for the button arrangement.
|
|
15
|
+
* @default "default"
|
|
16
|
+
*/
|
|
8
17
|
type?: Type;
|
|
18
|
+
/** Override the grid column count (only used when `type` is `"grid"`). */
|
|
9
19
|
gridSize?: Number;
|
|
10
20
|
};
|
|
11
21
|
/**
|
|
12
22
|
* A container for buttons. Set `type` prop to change the layout of the buttons.
|
|
13
23
|
*
|
|
14
24
|
* Usage: `import { ButtonBar } from "@k8slens/lds"`
|
|
25
|
+
*
|
|
26
|
+
* ```tsx
|
|
27
|
+
* <ButtonBar>
|
|
28
|
+
* <Button label="Cancel" />
|
|
29
|
+
* <Button label="Save" type="primary" />
|
|
30
|
+
* </ButtonBar>
|
|
31
|
+
* ```
|
|
15
32
|
*/
|
|
16
33
|
declare function ButtonBar<ElementType extends JSX.IntrinsicElements | React.ElementType<any>>({ as: Component, type, gridSize, children, ...props }: PropsWithChildren<ButtonBarProps<ElementType>>): React.JSX.Element;
|
|
17
34
|
export default ButtonBar;
|
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
+
/** Props for the Checkbox component. */
|
|
2
3
|
export interface CheckboxProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, "type" | "onChange" | "value" | "disabled"> {
|
|
4
|
+
/** Whether the checkbox is checked. */
|
|
3
5
|
value: boolean;
|
|
6
|
+
/** Change handler receiving the new value and the original event. */
|
|
4
7
|
onChange(value: boolean, evt: React.ChangeEvent<HTMLInputElement>): void;
|
|
8
|
+
/**
|
|
9
|
+
* Whether the checkbox is disabled.
|
|
10
|
+
* @default false
|
|
11
|
+
*/
|
|
5
12
|
disabled?: boolean;
|
|
6
13
|
}
|
|
7
14
|
/**
|
|
@@ -1,15 +1,31 @@
|
|
|
1
1
|
import React, { type ReactNode } from "react";
|
|
2
2
|
import { type ButtonProps } from "../Button/Button";
|
|
3
3
|
declare type AllowedButtonProps = Pick<ButtonProps, "type" | "size" | "discreet" | "icon" | "iconPosition" | "textTransform">;
|
|
4
|
+
/** Props for the ConfirmDialog component. */
|
|
4
5
|
export declare type ConfirmDialogProps = {
|
|
6
|
+
/** Title displayed in the confirm dialog header. */
|
|
5
7
|
title: string;
|
|
8
|
+
/** Optional message body rendered below the title. */
|
|
6
9
|
message?: string | ReactNode;
|
|
10
|
+
/**
|
|
11
|
+
* Label for the confirm button.
|
|
12
|
+
* @default "Ok"
|
|
13
|
+
*/
|
|
7
14
|
confirmText?: string;
|
|
15
|
+
/**
|
|
16
|
+
* Label for the cancel button.
|
|
17
|
+
* @default "Cancel"
|
|
18
|
+
*/
|
|
8
19
|
cancelLabel?: string;
|
|
20
|
+
/** Additional Button props forwarded to the confirm button. */
|
|
9
21
|
confirmButtonProps?: Partial<AllowedButtonProps>;
|
|
22
|
+
/** Additional Button props forwarded to the cancel button. */
|
|
10
23
|
cancelButtonProps?: Partial<AllowedButtonProps>;
|
|
24
|
+
/** Called when the dialog is dismissed (overlay click or escape key). */
|
|
11
25
|
handleClose: () => void;
|
|
26
|
+
/** Called when the user clicks the confirm button. */
|
|
12
27
|
handleConfirm: () => void;
|
|
28
|
+
/** Called when the user clicks the cancel button. */
|
|
13
29
|
handleCancel: () => void;
|
|
14
30
|
};
|
|
15
31
|
/**
|
|
@@ -1,10 +1,30 @@
|
|
|
1
1
|
import React, { PropsWithChildren } from "react";
|
|
2
|
+
/** Props for the DrawerTransition component. */
|
|
2
3
|
export interface DrawerTransitionProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
4
|
+
/** Whether the drawer is open. */
|
|
3
5
|
open: boolean;
|
|
6
|
+
/**
|
|
7
|
+
* Transition duration in milliseconds.
|
|
8
|
+
* @default 250
|
|
9
|
+
*/
|
|
4
10
|
duration?: number;
|
|
11
|
+
/** Callback fired after the enter transition completes. */
|
|
5
12
|
afterEnter?: () => void;
|
|
13
|
+
/** Callback fired after the exit transition completes. */
|
|
6
14
|
afterExit?: () => void;
|
|
15
|
+
/** Changes in dependencies trigger re-calculation of the drawer dimensions. */
|
|
7
16
|
deps?: object;
|
|
8
17
|
}
|
|
18
|
+
/**
|
|
19
|
+
* An animated drawer that expands and collapses content with a height transition.
|
|
20
|
+
*
|
|
21
|
+
* Usage: `import { DrawerTransition } from "@k8slens/lds"`
|
|
22
|
+
*
|
|
23
|
+
* ```tsx
|
|
24
|
+
* <DrawerTransition open={isOpen}>
|
|
25
|
+
* <p>Collapsible content here</p>
|
|
26
|
+
* </DrawerTransition>
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
9
29
|
declare const DrawerTransition: React.FC<PropsWithChildren<DrawerTransitionProps>>;
|
|
10
30
|
export default DrawerTransition;
|
package/lib/cjs/Input/Input.d.ts
CHANGED
|
@@ -1,15 +1,23 @@
|
|
|
1
1
|
import React, { HTMLInputTypeAttribute } from "react";
|
|
2
2
|
import { type Icon } from "@k8slens/lds-icons/lib/es/Icon/Icon";
|
|
3
3
|
export declare type InputType = Exclude<HTMLInputTypeAttribute, "button" | "checkbox" | "radio" | "number">;
|
|
4
|
+
/** Props for the Input component. */
|
|
4
5
|
export interface InputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, "type"> {
|
|
6
|
+
/** Icon component displayed on the right side of the input. */
|
|
5
7
|
icon?: Icon;
|
|
8
|
+
/** HTML input type (excludes button, checkbox, radio, number). */
|
|
6
9
|
type?: InputType;
|
|
10
|
+
/** Props forwarded to the wrapping `div` element. */
|
|
7
11
|
wrapperProps?: React.HTMLAttributes<HTMLDivElement>;
|
|
8
12
|
}
|
|
9
13
|
/**
|
|
10
14
|
* A simple input component. Set `icon` prop to show an icon on the right side of the input.
|
|
11
15
|
*
|
|
12
16
|
* Usage: `import { Input } from "@k8slens/lds"`
|
|
17
|
+
*
|
|
18
|
+
* ```tsx
|
|
19
|
+
* <Input placeholder="Enter text" onChange={handleChange} />
|
|
20
|
+
* ```
|
|
13
21
|
*/
|
|
14
22
|
declare const Input: React.ForwardRefExoticComponent<InputProps & React.RefAttributes<HTMLInputElement>>;
|
|
15
23
|
export default Input;
|
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
import React, { type AnchorHTMLAttributes } from "react";
|
|
2
2
|
export declare type Size = "sm" | "md";
|
|
3
3
|
export declare type TextTransform = "uppercase" | "capitalize";
|
|
4
|
+
/** Props for the LinkButton component. */
|
|
4
5
|
export interface LinkButtonProps extends Omit<AnchorHTMLAttributes<HTMLAnchorElement>, "label"> {
|
|
6
|
+
/** Text label displayed in the link button. */
|
|
5
7
|
label: string;
|
|
8
|
+
/**
|
|
9
|
+
* Size of the link button.
|
|
10
|
+
* @default "md"
|
|
11
|
+
*/
|
|
6
12
|
size?: Size;
|
|
13
|
+
/** Text transformation applied to the label. */
|
|
7
14
|
textTransform?: TextTransform;
|
|
8
15
|
/**
|
|
9
16
|
* Leave `href` and `onClick` undefined to disable the button
|
|
@@ -1,17 +1,23 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { type Props as IconProps } from "@k8slens/lds-icons/lib/es/Icon/Icon.d";
|
|
3
|
+
/** Props for the LoadingIndicator component. */
|
|
3
4
|
export interface LoadingIndicatorProps {
|
|
4
5
|
/**
|
|
5
|
-
|
|
6
|
+
* `IconProps.size`, see [SVGIcon](/?path=/docs/icon-svgicon--default) for details.
|
|
6
7
|
* @default "md"
|
|
7
8
|
*/
|
|
8
9
|
size?: IconProps["size"];
|
|
10
|
+
/** Optional class name. */
|
|
9
11
|
className?: string;
|
|
10
12
|
}
|
|
11
13
|
/**
|
|
12
|
-
*
|
|
14
|
+
* Animated spinner for loading states. Wraps a SpinnerIcon with configurable size.
|
|
13
15
|
*
|
|
14
16
|
* Usage: `import { LoadingIndicator } from "@k8slens/lds"`
|
|
17
|
+
*
|
|
18
|
+
* ```tsx
|
|
19
|
+
* <LoadingIndicator size="md" />
|
|
20
|
+
* ```
|
|
15
21
|
*/
|
|
16
22
|
declare const LoadingIndicator: React.FC<LoadingIndicatorProps>;
|
|
17
23
|
export default LoadingIndicator;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import React, { HTMLAttributes } from "react";
|
|
2
2
|
export declare type TextTransform = "uppercase" | "capitalize";
|
|
3
|
+
/** Props for the Lozenge component. */
|
|
3
4
|
export interface LozengeProps extends Omit<HTMLAttributes<HTMLSpanElement>, "type" | "size" | "textTransform"> {
|
|
4
5
|
/**
|
|
5
6
|
* Defines the color of the lozenge.
|
|
6
|
-
* @default secondary
|
|
7
|
+
* @default "secondary"
|
|
7
8
|
*/
|
|
8
9
|
type?: "primary" | "secondary" | "success" | "error" | "warning";
|
|
9
10
|
/**
|
|
@@ -11,7 +12,8 @@ export interface LozengeProps extends Omit<HTMLAttributes<HTMLSpanElement>, "typ
|
|
|
11
12
|
*/
|
|
12
13
|
textTransform?: TextTransform;
|
|
13
14
|
/**
|
|
14
|
-
*
|
|
15
|
+
* Size of the lozenge.
|
|
16
|
+
* @default "sm"
|
|
15
17
|
*/
|
|
16
18
|
size?: "sm" | "md" | "lg";
|
|
17
19
|
}
|
package/lib/cjs/Modal/Modal.d.ts
CHANGED
|
@@ -1,16 +1,36 @@
|
|
|
1
1
|
import React, { PropsWithChildren, ReactNode } from "react";
|
|
2
2
|
import { PanelProps } from "../Panel/Panel";
|
|
3
3
|
import { ButtonBarProps } from "../ButtonBar/ButtonBar";
|
|
4
|
+
/** Props for the Modal component. */
|
|
4
5
|
export interface ModalProps<Component extends keyof JSX.IntrinsicElements | React.ElementType> {
|
|
6
|
+
/** Title displayed in the modal header. */
|
|
5
7
|
title: string;
|
|
8
|
+
/** Optional subtitle displayed below the title. */
|
|
6
9
|
subTitle?: string;
|
|
10
|
+
/** Whether the modal is currently open. */
|
|
7
11
|
isOpen: boolean;
|
|
12
|
+
/** Called when the modal is dismissed (overlay click or escape key). */
|
|
8
13
|
onClose: () => void;
|
|
14
|
+
/**
|
|
15
|
+
* Size of the modal.
|
|
16
|
+
* @default "md"
|
|
17
|
+
*/
|
|
9
18
|
size: "sm" | "md" | "lg" | "xl";
|
|
19
|
+
/** Element type or component used as the content wrapper (passed to Panel). */
|
|
10
20
|
contentComponent?: PanelProps<Component>["wrapperComponent"];
|
|
21
|
+
/** Props forwarded to the content wrapper component. */
|
|
11
22
|
contentProps?: PanelProps<Component>["wrapperProps"];
|
|
23
|
+
/**
|
|
24
|
+
* Props forwarded to the footer ButtonBar component.
|
|
25
|
+
* @default {}
|
|
26
|
+
*/
|
|
12
27
|
buttonBarProps?: Omit<ButtonBarProps<"footer">, "as">;
|
|
28
|
+
/**
|
|
29
|
+
* Additional class name for the modal Panel.
|
|
30
|
+
* @default ""
|
|
31
|
+
*/
|
|
13
32
|
className?: string;
|
|
33
|
+
/** Content rendered in the modal footer, wrapped by ButtonBar. */
|
|
14
34
|
footer?: ReactNode;
|
|
15
35
|
}
|
|
16
36
|
/**
|
|
@@ -24,6 +44,12 @@ export interface ModalProps<Component extends keyof JSX.IntrinsicElements | Reac
|
|
|
24
44
|
* To pass props to `ButtonBar` use the `buttonBarProps` prop.
|
|
25
45
|
*
|
|
26
46
|
* Usage: `import { Modal } from "@k8slens/lds"`
|
|
47
|
+
*
|
|
48
|
+
* ```tsx
|
|
49
|
+
* <Modal isOpen={open} onClose={close} title="Confirm" size="sm">
|
|
50
|
+
* <p>Are you sure?</p>
|
|
51
|
+
* </Modal>
|
|
52
|
+
* ```
|
|
27
53
|
*/
|
|
28
54
|
declare function Modal<Component extends keyof JSX.IntrinsicElements | React.ElementType>({ children, isOpen, onClose, title, subTitle, size, contentComponent, contentProps: _contentProps, buttonBarProps, className, footer, }: PropsWithChildren<ModalProps<Component>>): React.JSX.Element | null;
|
|
29
55
|
export default Modal;
|
|
@@ -1,22 +1,38 @@
|
|
|
1
1
|
import React, { ReactNode } from "react";
|
|
2
2
|
export declare type Type = "flash" | "closable" | "inline" | "default";
|
|
3
3
|
export declare type AlertLevel = "info" | "success" | "error" | "warning";
|
|
4
|
+
/** Props for the Notification component. */
|
|
4
5
|
export interface NotificationProps {
|
|
6
|
+
/** The notification body content. */
|
|
5
7
|
message: string | ReactNode;
|
|
8
|
+
/** Optional bold heading rendered above the message. */
|
|
6
9
|
title?: string;
|
|
10
|
+
/**
|
|
11
|
+
* Behavior type of the notification.
|
|
12
|
+
* @default "default"
|
|
13
|
+
*/
|
|
7
14
|
type?: Type;
|
|
15
|
+
/**
|
|
16
|
+
* Visual severity level of the notification.
|
|
17
|
+
* @default "info"
|
|
18
|
+
*/
|
|
8
19
|
level?: AlertLevel;
|
|
20
|
+
/** @deprecated Use `type` prop instead. */
|
|
9
21
|
inline?: false;
|
|
22
|
+
/** @deprecated Use `type` prop instead. */
|
|
10
23
|
flash?: false;
|
|
11
24
|
/**
|
|
12
|
-
* Hide after `flashDuration` milliseconds, if type is set to "flash"
|
|
25
|
+
* Hide after `flashDuration` milliseconds, if type is set to "flash".
|
|
26
|
+
* @default 5000
|
|
13
27
|
*/
|
|
14
28
|
flashDuration?: number;
|
|
15
29
|
/**
|
|
16
|
-
* Can be set closable if not inline
|
|
30
|
+
* Can be set closable if not inline.
|
|
17
31
|
*/
|
|
18
32
|
closable?: boolean;
|
|
33
|
+
/** Called after the notification finishes its exit transition. */
|
|
19
34
|
onClose?(): void;
|
|
35
|
+
/** Additional class name for the notification wrapper. */
|
|
20
36
|
className?: string;
|
|
21
37
|
}
|
|
22
38
|
/**
|
|
@@ -4,7 +4,7 @@ export declare const formatNumber: (n: number) => string;
|
|
|
4
4
|
interface BaseNumberBadgeProps extends Omit<LozengeProps, "role" | "children" | "title" | "textTransform" | "size"> {
|
|
5
5
|
value: number | null | undefined;
|
|
6
6
|
/**
|
|
7
|
-
* If no title
|
|
7
|
+
* If no title is provided, the badge will be hidden from screen readers.
|
|
8
8
|
*/
|
|
9
9
|
title?: string;
|
|
10
10
|
/**
|
package/lib/cjs/Panel/Panel.d.ts
CHANGED
|
@@ -1,17 +1,45 @@
|
|
|
1
1
|
import React, { Fragment, ReactNode } from "react";
|
|
2
2
|
import type { ExtractProps } from "../types/ExtractProps.d";
|
|
3
|
+
/** Props for the Panel component. */
|
|
3
4
|
export interface PanelProps<WrapperComponent extends keyof JSX.IntrinsicElements | React.ElementType = typeof Fragment, HeaderComponent extends keyof JSX.IntrinsicElements | React.ElementType = "header", ContentComponent extends keyof JSX.IntrinsicElements | React.ElementType = "div", FooterComponent extends keyof JSX.IntrinsicElements | React.ElementType = "footer"> {
|
|
5
|
+
/** Content rendered in the header section. */
|
|
4
6
|
header?: ReactNode;
|
|
7
|
+
/** Content rendered in the footer section. */
|
|
5
8
|
footer?: ReactNode;
|
|
9
|
+
/** Optional class name applied to header, content, and footer elements. */
|
|
6
10
|
className?: string;
|
|
11
|
+
/**
|
|
12
|
+
* Component used to wrap the entire panel.
|
|
13
|
+
* @default Fragment
|
|
14
|
+
*/
|
|
7
15
|
wrapperComponent?: WrapperComponent;
|
|
16
|
+
/** Props forwarded to the wrapper component. */
|
|
8
17
|
wrapperProps?: ExtractProps<WrapperComponent>;
|
|
18
|
+
/**
|
|
19
|
+
* Component used for the header section.
|
|
20
|
+
* @default "header"
|
|
21
|
+
*/
|
|
9
22
|
headerComponent?: HeaderComponent;
|
|
23
|
+
/** Props forwarded to the header component. */
|
|
10
24
|
headerProps?: ExtractProps<HeaderComponent>;
|
|
25
|
+
/**
|
|
26
|
+
* Component used for the content section.
|
|
27
|
+
* @default "div"
|
|
28
|
+
*/
|
|
11
29
|
contentComponent?: ContentComponent | undefined;
|
|
30
|
+
/** Props forwarded to the content component. */
|
|
12
31
|
contentProps?: ExtractProps<ContentComponent>;
|
|
32
|
+
/**
|
|
33
|
+
* Component used for the footer section.
|
|
34
|
+
* @default "footer"
|
|
35
|
+
*/
|
|
13
36
|
footerComponent?: FooterComponent;
|
|
37
|
+
/** Props forwarded to the footer component. */
|
|
14
38
|
footerProps?: ExtractProps<FooterComponent>;
|
|
39
|
+
/**
|
|
40
|
+
* Whether to show a loading indicator overlay.
|
|
41
|
+
* @default false
|
|
42
|
+
*/
|
|
15
43
|
loading?: boolean;
|
|
16
44
|
}
|
|
17
45
|
/**
|
|
@@ -6,10 +6,18 @@ declare type Item = {
|
|
|
6
6
|
avatar?: AvatarProps["image"];
|
|
7
7
|
avatarTitle: string;
|
|
8
8
|
};
|
|
9
|
+
/** Props for the ProfileBlock component. */
|
|
9
10
|
export declare type ProfileBlockProps = HTMLProps<HTMLDivElement> & {
|
|
11
|
+
/**
|
|
12
|
+
* Whether to show a loading indicator instead of text content.
|
|
13
|
+
* @default false
|
|
14
|
+
*/
|
|
10
15
|
loading?: boolean;
|
|
16
|
+
/** User data to display (title, subtitle, avatar). */
|
|
11
17
|
item: Item;
|
|
18
|
+
/** Custom formatter for the title text. */
|
|
12
19
|
formatTitle?: (item: Item) => string | ReactElement;
|
|
20
|
+
/** Custom formatter for the subtitle text. */
|
|
13
21
|
formatSubtitle?: (item: Item) => string | ReactElement;
|
|
14
22
|
};
|
|
15
23
|
/**
|
|
@@ -1,8 +1,19 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
+
/** Props for the ProgressBar component. */
|
|
2
3
|
export interface ProgressBarProps extends React.ProgressHTMLAttributes<HTMLProgressElement> {
|
|
4
|
+
/** Current progress value. */
|
|
3
5
|
value: number;
|
|
6
|
+
/**
|
|
7
|
+
* Maximum value for the progress bar.
|
|
8
|
+
* @default 1
|
|
9
|
+
*/
|
|
4
10
|
max?: number;
|
|
11
|
+
/**
|
|
12
|
+
* Color of the progress bar.
|
|
13
|
+
* @default "default"
|
|
14
|
+
*/
|
|
5
15
|
type?: "default" | "ok" | "caution" | "danger";
|
|
16
|
+
/** Accessible title text. Falls back to percentage display if not provided. */
|
|
6
17
|
title?: string;
|
|
7
18
|
}
|
|
8
19
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e=require("../_virtual/_tslib.js"),a=require("react"),t=require("./ProgressBar.module.css.js")
|
|
1
|
+
"use strict";var e=require("../_virtual/_tslib.js"),a=require("react"),t=require("clsx"),r=require("./ProgressBar.module.css.js");function s(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var u=s(a),l=s(t);module.exports=function(a){var t,s=a.value,i=a.type,o=void 0===i?"default":i,c=a.max,n=void 0===c?1:c,d=a.title,m=a.className,v=e.__rest(a,["value","type","max","title","className"]),f=isNaN(s)?0:Math.max(0,s),x=isNaN(n)||n<=0?1:n,N=Math.min(100,Math.round(f/x*100)),p=d||"".concat(N,"%");return u.default.createElement("progress",e.__assign({},v,{className:l.default(r.progressBar,m,(t={},t[r[o]]="default"!==o,t)),value:f,max:x,"aria-valuetext":p,title:d}),p)};
|
|
@@ -10,16 +10,33 @@ declare type ItemState = {
|
|
|
10
10
|
selected?: boolean;
|
|
11
11
|
disabled?: boolean;
|
|
12
12
|
};
|
|
13
|
+
/** Props for the RadioCard component. */
|
|
13
14
|
export interface RadioCardProps<T> {
|
|
15
|
+
/** HTML `id` attribute for the radio group. */
|
|
14
16
|
id?: string;
|
|
17
|
+
/** Accessible label for the radio group. */
|
|
15
18
|
"aria-label"?: string;
|
|
19
|
+
/** Array of options to render as radio cards. */
|
|
16
20
|
options: Array<T>;
|
|
21
|
+
/** Currently selected option. */
|
|
17
22
|
value: T | undefined;
|
|
23
|
+
/** Change handler receiving the selected option. */
|
|
18
24
|
onChange(d: T): void;
|
|
25
|
+
/** Name attribute for the radio group. */
|
|
19
26
|
name: string;
|
|
27
|
+
/** Optional class name for the radio group container. */
|
|
20
28
|
className?: string;
|
|
29
|
+
/** Optional class name applied to each radio card item. */
|
|
21
30
|
itemClassName?: string;
|
|
31
|
+
/**
|
|
32
|
+
* Whether the entire radio group is disabled.
|
|
33
|
+
* @default false
|
|
34
|
+
*/
|
|
22
35
|
disabled?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Whether the radio group is in an invalid state.
|
|
38
|
+
* @default false
|
|
39
|
+
*/
|
|
23
40
|
invalid?: boolean;
|
|
24
41
|
/**
|
|
25
42
|
* Function to render the content of card item.
|
|
@@ -30,9 +47,18 @@ export interface RadioCardProps<T> {
|
|
|
30
47
|
renderItem?(d: T | undefined, state: ItemState): ReactNode;
|
|
31
48
|
}
|
|
32
49
|
/**
|
|
33
|
-
* A
|
|
50
|
+
* A card-based radio group for visual option selection. Renders each option as a styled card with a radio indicator.
|
|
34
51
|
*
|
|
35
52
|
* Usage: `import { RadioCard } from "@k8slens/lds"`
|
|
53
|
+
*
|
|
54
|
+
* ```tsx
|
|
55
|
+
* <RadioCard
|
|
56
|
+
* name="plan"
|
|
57
|
+
* options={[{ id: "1", label: "Free" }, { id: "2", label: "Pro" }]}
|
|
58
|
+
* value={selected}
|
|
59
|
+
* onChange={setSelected}
|
|
60
|
+
* />
|
|
61
|
+
* ```
|
|
36
62
|
*/
|
|
37
63
|
export default function RadioCard<T extends DefaultOption>({ id, "aria-label": ariaLabel, value, options, onChange, name, invalid, disabled, itemClassName, className, renderItem, ...radioGroupProps }: RadioCardProps<T>): React.JSX.Element;
|
|
38
64
|
export {};
|
|
@@ -1,9 +1,19 @@
|
|
|
1
1
|
import React, { type ReactNode } from "react";
|
|
2
|
-
|
|
2
|
+
/** Props for the MultiOption component. */
|
|
3
|
+
interface MultiOptionProps {
|
|
4
|
+
/** Display text of the option, used for the accessible label. */
|
|
3
5
|
label: string;
|
|
4
|
-
|
|
6
|
+
/** Optional class name for the multi-option pill. */
|
|
7
|
+
className?: string;
|
|
8
|
+
/** Content rendered inside the option pill. */
|
|
5
9
|
children: ReactNode;
|
|
10
|
+
/** Called when the remove button is clicked or activated via keyboard. */
|
|
6
11
|
onRemove: (e: React.MouseEvent | React.KeyboardEvent) => void;
|
|
7
|
-
|
|
8
|
-
|
|
12
|
+
/** Called on arrow key press for keyboard navigation between pills. */
|
|
13
|
+
onArrowNavigate?: (direction: "next" | "prev") => void;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Removable pill for selected values in a multi-select. Supports keyboard navigation and accessible removal.
|
|
17
|
+
*/
|
|
18
|
+
declare const MultiOption: React.ForwardRefExoticComponent<MultiOptionProps & React.RefAttributes<HTMLSpanElement>>;
|
|
9
19
|
export default MultiOption;
|