@k8slens/lds 0.57.0 → 0.58.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/README.md +42 -37
- package/lib/cjs/Avatar/Avatar.d.ts +7 -2
- package/lib/cjs/Badge/Badge.d.ts +9 -0
- package/lib/cjs/Checkbox/Checkbox.d.ts +9 -0
- package/lib/cjs/ConfirmDialog/ConfirmDialog.d.ts +13 -1
- package/lib/cjs/LinkButton/LinkButton.d.ts +9 -0
- package/lib/cjs/Lozenge/Lozenge.d.ts +9 -0
- package/lib/cjs/Notification/Notification.d.ts +9 -0
- package/lib/cjs/NumberBadge/NumberBadge.d.ts +9 -0
- package/lib/cjs/ProfileBlock/ProfileBlock.d.ts +9 -0
- package/lib/cjs/ProgressBar/ProgressBar.d.ts +9 -0
- package/lib/cjs/Switch/Switch.d.ts +9 -0
- package/lib/cjs/Table/Table.d.ts +111 -0
- package/lib/cjs/Table/Table.js +1 -0
- package/lib/cjs/Table/Table.module.css.js +1 -0
- package/lib/cjs/Tooltip/Tooltip.d.ts +9 -0
- package/lib/cjs/UserMenu/UserMenu.d.ts +7 -1
- package/lib/cjs/components.d.ts +1 -0
- package/lib/cjs/index.css +1 -1
- package/lib/cjs/index.electron.js +1 -1
- package/lib/cjs/index.js +1 -1
- package/lib/es/Avatar/Avatar.d.ts +7 -2
- package/lib/es/Badge/Badge.d.ts +9 -0
- package/lib/es/Checkbox/Checkbox.d.ts +9 -0
- package/lib/es/ConfirmDialog/ConfirmDialog.d.ts +13 -1
- package/lib/es/LinkButton/LinkButton.d.ts +9 -0
- package/lib/es/Lozenge/Lozenge.d.ts +9 -0
- package/lib/es/Notification/Notification.d.ts +9 -0
- package/lib/es/NumberBadge/NumberBadge.d.ts +9 -0
- package/lib/es/ProfileBlock/ProfileBlock.d.ts +9 -0
- package/lib/es/ProgressBar/ProgressBar.d.ts +9 -0
- package/lib/es/Switch/Switch.d.ts +9 -0
- package/lib/es/Table/Table.d.ts +111 -0
- package/lib/es/Table/Table.js +1 -0
- package/lib/es/Table/Table.module.css.js +1 -0
- package/lib/es/Tooltip/Tooltip.d.ts +9 -0
- package/lib/es/UserMenu/UserMenu.d.ts +7 -1
- package/lib/es/components.d.ts +1 -0
- package/lib/es/index.css +1 -1
- package/lib/es/index.electron.js +1 -1
- package/lib/es/index.js +1 -1
- package/lib/web/{lds-v0-56-0 → lds-v0-57-3}/index.css +1 -1
- package/lib/web/{lds-v0-56-0 → lds-v0-57-3}/index.js +3 -3
- package/llms.txt +372 -0
- package/package.json +7 -6
- /package/lib/web/{lds-v0-56-0 → lds-v0-57-3}/typography.css +0 -0
package/README.md
CHANGED
|
@@ -1,51 +1,56 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @k8slens/lds
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
Core React component library for the Lens Design System.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
5
6
|
|
|
6
|
-
|
|
7
|
+
```bash
|
|
8
|
+
npm install @k8slens/lds @k8slens/lds-tokens
|
|
9
|
+
```
|
|
7
10
|
|
|
8
|
-
|
|
9
|
-
- `./lib/es/index.js` - Main ES module
|
|
10
|
-
- `./lib/es/index.electron.js` - Main ES module for Electron
|
|
11
|
-
- `./lib/es/ComponentName/ComponentName.js` - Individual ES modules
|
|
11
|
+
## Setup
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
- `./lib/cjs/index.js` - Main CommonJS module
|
|
15
|
-
- `./lib/cjs/ComponentName/ComponentName.js` - Individual CommonJS modules
|
|
13
|
+
Import required styles in your app entry point:
|
|
16
14
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
-
|
|
15
|
+
```tsx
|
|
16
|
+
// Fonts (required)
|
|
17
|
+
import "@k8slens/lds-tokens/lib/electron/font-face.css";
|
|
20
18
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
- import `@k8slens/lds/index.css` in your React app to include general styles
|
|
25
|
-
- import `@k8slens/lds/typography.css` in your React app (after index.css) to include base typographic styles
|
|
26
|
-
- Use in a component:
|
|
19
|
+
// Tokens (required)
|
|
20
|
+
import "@k8slens/lds-tokens/lib/web/tokens.core.css";
|
|
21
|
+
import "@k8slens/lds-tokens/lib/web/tokens.dark.css"; // or tokens.light.css
|
|
27
22
|
|
|
28
|
-
|
|
29
|
-
import
|
|
23
|
+
// Component styles (required)
|
|
24
|
+
import "@k8slens/lds/lib/es/index.css";
|
|
30
25
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
);
|
|
26
|
+
// Optional: Base typography styles
|
|
27
|
+
import "@k8slens/lds/lib/es/typography.css";
|
|
34
28
|
```
|
|
35
29
|
|
|
36
|
-
## Usage
|
|
37
|
-
- run `npm i -s @k8slens/lds @k8slens/lds-tokens`
|
|
38
|
-
- import `@k8slens/lds-tokens/lib/electron/fonts.css` in your React Electron app to include fonts
|
|
39
|
-
- import `@k8slens/lds/index.css` in your React Electron app to include general styles
|
|
40
|
-
- Use in a component:
|
|
30
|
+
## Usage
|
|
41
31
|
|
|
42
|
-
```
|
|
43
|
-
import { Button } from "@k8slens/lds";
|
|
32
|
+
```tsx
|
|
33
|
+
import { Button, Input, Modal, Select } from "@k8slens/lds";
|
|
44
34
|
|
|
45
|
-
export const
|
|
46
|
-
<Button label="My Button" />
|
|
47
|
-
);
|
|
35
|
+
export const MyComponent = () => <Button label="Click me" type="primary" />;
|
|
48
36
|
```
|
|
49
37
|
|
|
50
|
-
##
|
|
51
|
-
|
|
38
|
+
## Documentation
|
|
39
|
+
|
|
40
|
+
Browse components and examples at [lens-design-system.k8slens.dev](https://lens-design-system.k8slens.dev/?path=/docs/core).
|
|
41
|
+
|
|
42
|
+
## AI Assistance
|
|
43
|
+
|
|
44
|
+
This package includes an `llms.txt` file with API documentation optimized for LLMs. Add to your project's AI configuration (e.g., `AGENTS.md` or `CLAUDE.md`):
|
|
45
|
+
|
|
46
|
+
```markdown
|
|
47
|
+
Read node_modules/@k8slens/lds/llms.txt for component API reference.
|
|
48
|
+
Read node_modules/@k8slens/lds-tokens/llms.txt for design tokens reference.
|
|
49
|
+
|
|
50
|
+
Always use LDS components and tokens instead of custom implementations:
|
|
51
|
+
|
|
52
|
+
- Use Button, Input, Modal, Select etc. from @k8slens/lds
|
|
53
|
+
- Use CSS variables from @k8slens/lds-tokens for colors, spacing, radius
|
|
54
|
+
- Never hardcode values that exist as tokens
|
|
55
|
+
- Search llms.txt files before creating custom components or styles.
|
|
56
|
+
```
|
|
@@ -19,7 +19,12 @@ export interface AvatarProps extends Pick<HTMLAttributes<HTMLDivElement>, "aria-
|
|
|
19
19
|
size?: "sm" | "md" | "xl";
|
|
20
20
|
}
|
|
21
21
|
/**
|
|
22
|
-
*
|
|
23
|
-
*
|
|
22
|
+
* Displays user's profile picture or initials with random background color.
|
|
23
|
+
*
|
|
24
|
+
* Usage: `import { Avatar } from "@k8slens/lds"`
|
|
25
|
+
*
|
|
26
|
+
* ```tsx
|
|
27
|
+
* <Avatar name="John Doe" image="avatar.jpg" />
|
|
28
|
+
* ```
|
|
24
29
|
*/
|
|
25
30
|
export default function Avatar({ name, className, image: AvatarImage, size, ...props }: AvatarProps): React.JSX.Element;
|
package/lib/cjs/Badge/Badge.d.ts
CHANGED
|
@@ -14,4 +14,13 @@ export interface BadgeProps extends Pick<HTMLAttributes<HTMLSpanElement>, "id" |
|
|
|
14
14
|
*/
|
|
15
15
|
size?: "sm" | "md" | "lg";
|
|
16
16
|
}
|
|
17
|
+
/**
|
|
18
|
+
* A small status indicator dot. Use `type` prop for semantic colors.
|
|
19
|
+
*
|
|
20
|
+
* Usage: `import { Badge } from "@k8slens/lds"`
|
|
21
|
+
*
|
|
22
|
+
* ```tsx
|
|
23
|
+
* <Badge type="success" title="Active" />
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
17
26
|
export default function Badge({ className, type, size, title, ...props }: BadgeProps): React.JSX.Element;
|
|
@@ -4,4 +4,13 @@ export interface CheckboxProps extends Omit<React.InputHTMLAttributes<HTMLInputE
|
|
|
4
4
|
onChange(value: boolean, evt: React.ChangeEvent<HTMLInputElement>): void;
|
|
5
5
|
disabled?: boolean;
|
|
6
6
|
}
|
|
7
|
+
/**
|
|
8
|
+
* A styled checkbox input with checkmark icon.
|
|
9
|
+
*
|
|
10
|
+
* Usage: `import { Checkbox } from "@k8slens/lds"`
|
|
11
|
+
*
|
|
12
|
+
* ```tsx
|
|
13
|
+
* <Checkbox value={checked} onChange={setChecked} />
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
7
16
|
export default function Checkbox({ disabled, value, onChange, className, ...inputProps }: CheckboxProps): React.JSX.Element;
|
|
@@ -13,7 +13,19 @@ export declare type ConfirmDialogProps = {
|
|
|
13
13
|
handleCancel: () => void;
|
|
14
14
|
};
|
|
15
15
|
/**
|
|
16
|
-
*
|
|
16
|
+
* A modal dialog that asks the user to confirm an action. Use with `useConfirmDialog` hook.
|
|
17
|
+
*
|
|
18
|
+
* Usage: `import { useConfirmDialog } from "@k8slens/lds"`
|
|
19
|
+
*
|
|
20
|
+
* ```tsx
|
|
21
|
+
* const { ConfirmDialog, confirm } = useConfirmDialog();
|
|
22
|
+
* return (
|
|
23
|
+
* <>
|
|
24
|
+
* <Button onClick={() => confirm("Delete?", "This cannot be undone.")} />
|
|
25
|
+
* {ConfirmDialog}
|
|
26
|
+
* </>
|
|
27
|
+
* );
|
|
28
|
+
* ```
|
|
17
29
|
*/
|
|
18
30
|
declare const ConfirmDialog: ({ title, message, confirmText, cancelLabel, confirmButtonProps, cancelButtonProps, handleClose, handleConfirm, handleCancel, }: ConfirmDialogProps) => React.JSX.Element;
|
|
19
31
|
declare type ConfirmDialogConfig = Omit<ConfirmDialogProps, "title" | "message" | "handleClose" | "handleConfirm" | "handleCancel">;
|
|
@@ -14,6 +14,15 @@ export interface LinkButtonProps extends Omit<AnchorHTMLAttributes<HTMLAnchorEle
|
|
|
14
14
|
*/
|
|
15
15
|
onClick?: AnchorHTMLAttributes<HTMLAnchorElement>["onClick"];
|
|
16
16
|
}
|
|
17
|
+
/**
|
|
18
|
+
* A text link with arrow icon for navigation actions.
|
|
19
|
+
*
|
|
20
|
+
* Usage: `import { LinkButton } from "@k8slens/lds"`
|
|
21
|
+
*
|
|
22
|
+
* ```tsx
|
|
23
|
+
* <LinkButton label="Learn more" href="/docs" />
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
17
26
|
declare const LinkButton: React.ForwardRefExoticComponent<LinkButtonProps & {
|
|
18
27
|
children?: React.ReactNode;
|
|
19
28
|
} & React.RefAttributes<HTMLAnchorElement>>;
|
|
@@ -15,5 +15,14 @@ export interface LozengeProps extends Omit<HTMLAttributes<HTMLSpanElement>, "typ
|
|
|
15
15
|
*/
|
|
16
16
|
size?: "sm" | "md" | "lg";
|
|
17
17
|
}
|
|
18
|
+
/**
|
|
19
|
+
* A pill-shaped label for status or category display.
|
|
20
|
+
*
|
|
21
|
+
* Usage: `import { Lozenge } from "@k8slens/lds"`
|
|
22
|
+
*
|
|
23
|
+
* ```tsx
|
|
24
|
+
* <Lozenge type="success">Active</Lozenge>
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
18
27
|
declare const Lozenge: React.ForwardRefExoticComponent<LozengeProps & React.RefAttributes<HTMLSpanElement>>;
|
|
19
28
|
export default Lozenge;
|
|
@@ -19,5 +19,14 @@ export interface NotificationProps {
|
|
|
19
19
|
onClose?(): void;
|
|
20
20
|
className?: string;
|
|
21
21
|
}
|
|
22
|
+
/**
|
|
23
|
+
* Alert banner for user feedback. Set `type` to control behavior: `flash` auto-dismisses, `closable` shows close button.
|
|
24
|
+
*
|
|
25
|
+
* Usage: `import { Notification } from "@k8slens/lds"`
|
|
26
|
+
*
|
|
27
|
+
* ```tsx
|
|
28
|
+
* <Notification level="success" message="Saved successfully" />
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
22
31
|
declare const Notification: React.FC<NotificationProps>;
|
|
23
32
|
export default Notification;
|
|
@@ -31,5 +31,14 @@ interface Props extends BaseNumberBadgeProps {
|
|
|
31
31
|
role: Exclude<AriaRole, "status">;
|
|
32
32
|
}
|
|
33
33
|
export declare type NumberBadgeProps = StatusNumberBadgeProps | Props;
|
|
34
|
+
/**
|
|
35
|
+
* A numeric badge that formats large numbers (1500 → "1.5k"). Returns null if value is 0 unless `showZero` is set.
|
|
36
|
+
*
|
|
37
|
+
* Usage: `import { NumberBadge } from "@k8slens/lds"`
|
|
38
|
+
*
|
|
39
|
+
* ```tsx
|
|
40
|
+
* <NumberBadge value={42} title="Items" />
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
34
43
|
export default function NumberBadge({ className, value, showZero, displayPlusSign, title, ...props }: NumberBadgeProps): React.JSX.Element | null;
|
|
35
44
|
export {};
|
|
@@ -12,5 +12,14 @@ export declare type ProfileBlockProps = HTMLProps<HTMLDivElement> & {
|
|
|
12
12
|
formatTitle?: (item: Item) => string | ReactElement;
|
|
13
13
|
formatSubtitle?: (item: Item) => string | ReactElement;
|
|
14
14
|
};
|
|
15
|
+
/**
|
|
16
|
+
* Displays user info with avatar, title, and subtitle. Supports loading state.
|
|
17
|
+
*
|
|
18
|
+
* Usage: `import { ProfileBlock } from "@k8slens/lds"`
|
|
19
|
+
*
|
|
20
|
+
* ```tsx
|
|
21
|
+
* <ProfileBlock item={{ title: "@user", subtitle: "Name", avatarTitle: "Name" }} />
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
15
24
|
declare const ProfileBlock: ({ className, loading, item, formatTitle, formatSubtitle, ...props }: ProfileBlockProps) => React.JSX.Element;
|
|
16
25
|
export default ProfileBlock;
|
|
@@ -5,4 +5,13 @@ export interface ProgressBarProps extends React.ProgressHTMLAttributes<HTMLProgr
|
|
|
5
5
|
type?: "default" | "ok" | "caution" | "danger";
|
|
6
6
|
title?: string;
|
|
7
7
|
}
|
|
8
|
+
/**
|
|
9
|
+
* A progress bar with semantic color types. Value can be 0-1 or use custom `max`.
|
|
10
|
+
*
|
|
11
|
+
* Usage: `import { ProgressBar } from "@k8slens/lds"`
|
|
12
|
+
*
|
|
13
|
+
* ```tsx
|
|
14
|
+
* <ProgressBar value={0.75} type="ok" />
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
8
17
|
export default function ProgressBar({ value, type, max, title, className, ...props }: ProgressBarProps): React.JSX.Element;
|
|
@@ -3,4 +3,13 @@ import React from "react";
|
|
|
3
3
|
export interface SwitchProps extends Omit<HTMLProps<HTMLInputElement>, "onChange"> {
|
|
4
4
|
onChange?: (checked: boolean, event: ChangeEvent<HTMLInputElement>) => void;
|
|
5
5
|
}
|
|
6
|
+
/**
|
|
7
|
+
* A toggle switch input with label support.
|
|
8
|
+
*
|
|
9
|
+
* Usage: `import { Switch } from "@k8slens/lds"`
|
|
10
|
+
*
|
|
11
|
+
* ```tsx
|
|
12
|
+
* <Switch checked={enabled} onChange={setEnabled}>Enable feature</Switch>
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
6
15
|
export declare function Switch({ className, children, disabled, onChange, ...props }: SwitchProps): React.JSX.Element;
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import React, { HTMLAttributes, ReactNode, TdHTMLAttributes, ThHTMLAttributes } from "react";
|
|
2
|
+
/** Props for the Table component. */
|
|
3
|
+
export declare type TableProps = HTMLAttributes<HTMLTableElement> & {
|
|
4
|
+
/**
|
|
5
|
+
* Whether the table uses responsive layout on mobile viewports.
|
|
6
|
+
* @default true
|
|
7
|
+
*/
|
|
8
|
+
responsive?: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Whether the table renders with inner row borders.
|
|
11
|
+
* @default false
|
|
12
|
+
*/
|
|
13
|
+
bordered?: boolean;
|
|
14
|
+
};
|
|
15
|
+
/** Props for the TableCaption component. */
|
|
16
|
+
export declare type TableCaptionProps = HTMLAttributes<HTMLTableCaptionElement> & {
|
|
17
|
+
/**
|
|
18
|
+
* Controls caption visibility: "visible" renders normally, "sr-only" is screen-reader only, "hidden" hides completely.
|
|
19
|
+
* @default "sr-only"
|
|
20
|
+
*/
|
|
21
|
+
visibility?: "visible" | "sr-only" | "hidden";
|
|
22
|
+
};
|
|
23
|
+
export declare const TableCaption: ({ visibility, className, children, ...props }: TableCaptionProps) => React.JSX.Element;
|
|
24
|
+
/** Props for the TableHead component. */
|
|
25
|
+
export declare type TableHeadProps = HTMLAttributes<HTMLTableSectionElement>;
|
|
26
|
+
export declare const TableHead: ({ children, ...props }: TableHeadProps) => React.JSX.Element;
|
|
27
|
+
/** Props for the TableBody component. */
|
|
28
|
+
export declare type TableBodyProps = HTMLAttributes<HTMLTableSectionElement> & {
|
|
29
|
+
/**
|
|
30
|
+
* Whether the table body is in a loading state.
|
|
31
|
+
* @default false
|
|
32
|
+
*/
|
|
33
|
+
loading?: boolean;
|
|
34
|
+
};
|
|
35
|
+
export declare const TableBody: ({ loading, children, ...props }: TableBodyProps) => React.JSX.Element;
|
|
36
|
+
/** Props for the TableRow component. */
|
|
37
|
+
export declare type TableRowProps = HTMLAttributes<HTMLTableRowElement> & {
|
|
38
|
+
/**
|
|
39
|
+
* Whether the row displays an error flash animation.
|
|
40
|
+
* @default false
|
|
41
|
+
*/
|
|
42
|
+
error?: boolean;
|
|
43
|
+
};
|
|
44
|
+
export declare const TableRow: ({ error, className, children, ...props }: TableRowProps) => React.JSX.Element;
|
|
45
|
+
/** Props for the TableHeaderCell component. */
|
|
46
|
+
export declare type TableHeaderCellProps = Omit<ThHTMLAttributes<HTMLTableCellElement>, "align"> & {
|
|
47
|
+
/** Horizontal alignment of header content. */
|
|
48
|
+
align?: "start" | "center" | "end";
|
|
49
|
+
/**
|
|
50
|
+
* Whether the column is sortable.
|
|
51
|
+
* @default false
|
|
52
|
+
*/
|
|
53
|
+
sortable?: boolean;
|
|
54
|
+
/**
|
|
55
|
+
* Current sort direction, or false if unsorted.
|
|
56
|
+
* @default false
|
|
57
|
+
*/
|
|
58
|
+
sorted?: "asc" | "desc" | false;
|
|
59
|
+
};
|
|
60
|
+
export declare const TableHeaderCell: ({ align, sortable, sorted, className, children, ...props }: TableHeaderCellProps) => React.JSX.Element;
|
|
61
|
+
/** Props for the TableCell component. */
|
|
62
|
+
export declare type TableCellProps = Omit<TdHTMLAttributes<HTMLTableCellElement>, "align"> & {
|
|
63
|
+
/**
|
|
64
|
+
* Whether this cell is the primary (row header) cell, rendered as `<th scope="row">`.
|
|
65
|
+
* @default false
|
|
66
|
+
*/
|
|
67
|
+
primary?: boolean;
|
|
68
|
+
/** Horizontal alignment of cell content. */
|
|
69
|
+
align?: "start" | "center" | "end";
|
|
70
|
+
/** Text color style variant. */
|
|
71
|
+
textStyle?: "default" | "accent" | "secondary" | "tertiary" | "quarternary";
|
|
72
|
+
/** Label shown as a responsive header on mobile viewports. */
|
|
73
|
+
responsiveHeader?: ReactNode;
|
|
74
|
+
};
|
|
75
|
+
export declare const TableCell: ({ primary, align, textStyle, responsiveHeader, className, children, ...props }: TableCellProps) => React.JSX.Element;
|
|
76
|
+
/** Props for the TableStatusRow component. */
|
|
77
|
+
export declare type TableStatusRowProps = HTMLAttributes<HTMLTableRowElement> & {
|
|
78
|
+
/** Number of columns the status cell should span. */
|
|
79
|
+
colSpan: number;
|
|
80
|
+
};
|
|
81
|
+
export declare const TableStatusRow: ({ colSpan, children, ...props }: TableStatusRowProps) => React.JSX.Element;
|
|
82
|
+
/**
|
|
83
|
+
* A composable data table with responsive layout, sorting indicators, and row states.
|
|
84
|
+
*
|
|
85
|
+
* Usage: `import Table from "@k8slens/lds/Table"`
|
|
86
|
+
*
|
|
87
|
+
* ```tsx
|
|
88
|
+
* <Table>
|
|
89
|
+
* <Table.Head>
|
|
90
|
+
* <Table.Row>
|
|
91
|
+
* <Table.HeaderCell>Name</Table.HeaderCell>
|
|
92
|
+
* </Table.Row>
|
|
93
|
+
* </Table.Head>
|
|
94
|
+
* <Table.Body>
|
|
95
|
+
* <Table.Row>
|
|
96
|
+
* <Table.Cell>Value</Table.Cell>
|
|
97
|
+
* </Table.Row>
|
|
98
|
+
* </Table.Body>
|
|
99
|
+
* </Table>
|
|
100
|
+
* ```
|
|
101
|
+
*/
|
|
102
|
+
declare const Table: (({ responsive, bordered, className, children, ...props }: TableProps) => React.JSX.Element) & {
|
|
103
|
+
Caption: ({ visibility, className, children, ...props }: TableCaptionProps) => React.JSX.Element;
|
|
104
|
+
Head: ({ children, ...props }: TableHeadProps) => React.JSX.Element;
|
|
105
|
+
Body: ({ loading, children, ...props }: TableBodyProps) => React.JSX.Element;
|
|
106
|
+
Row: ({ error, className, children, ...props }: TableRowProps) => React.JSX.Element;
|
|
107
|
+
HeaderCell: ({ align, sortable, sorted, className, children, ...props }: TableHeaderCellProps) => React.JSX.Element;
|
|
108
|
+
Cell: ({ primary, align, textStyle, responsiveHeader, className, children, ...props }: TableCellProps) => React.JSX.Element;
|
|
109
|
+
StatusRow: ({ colSpan, children, ...props }: TableStatusRowProps) => React.JSX.Element;
|
|
110
|
+
};
|
|
111
|
+
export default Table;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../_virtual/_tslib.js"),a=require("react"),t=require("clsx"),r=require("@k8slens/lds-icons"),l=require("./Table.module.css.js");function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var s=n(a),i=n(t),d=r.navigation.ArrowUpIcon,o=r.navigation.ArrowDownIcon,c=a.createContext({responsive:!0}),u=function(a){var t=a.visibility,r=void 0===t?"sr-only":t,n=a.className,d=a.children,o=e.__rest(a,["visibility","className","children"]);return s.default.createElement("caption",e.__assign({},o,{className:i.default(l.caption,n,{"lds-only-aria":"sr-only"===r}),hidden:"hidden"===r||void 0}),d)},v=function(a){var t=a.children,r=e.__rest(a,["children"]);return s.default.createElement("thead",e.__assign({},r),t)},f=function(a){var t=a.loading,r=void 0!==t&&t,l=a.children,n=e.__rest(a,["loading","children"]);return s.default.createElement("tbody",e.__assign({},n,{"aria-busy":r||void 0}),l)},m=function(a){var t,r=a.error,n=void 0!==r&&r,d=a.className,o=a.children,c=e.__rest(a,["error","className","children"]);return s.default.createElement("tr",e.__assign({},c,{className:i.default(l.row,d,(t={},t[l.rowError]=n,t))}),o)},_=function(a){var t,r,n,c=a.align,u=a.sortable,v=void 0!==u&&u,f=a.sorted,m=void 0!==f&&f,_=a.className,p=a.children,b=e.__rest(a,["align","sortable","sorted","className","children"]),h="center"===c?l.center:"end"===c?l.end:void 0;return s.default.createElement("th",e.__assign({},b,{scope:null!==(n=b.scope)&&void 0!==n?n:"col","aria-sort":"asc"===m?"ascending":"desc"===m?"descending":void 0,className:i.default(l.tableHeader,_,h,(t={},t[l.sortable]=v,t))}),s.default.createElement("span",null,p,v&&("asc"===m?s.default.createElement(d,{className:l.sortIcon}):s.default.createElement(o,{className:i.default(l.sortIcon,(r={},r[l.inactive]=!m,r))}))))},p={accent:l.textAccent,secondary:l.textSecondary,tertiary:l.textTertiary,quarternary:l.textQuarternary,default:l.textDefault},b=function(t){var r=t.primary,n=void 0!==r&&r,d=t.align,o=t.textStyle,u=t.responsiveHeader,v=t.className,f=t.children,m=e.__rest(t,["primary","align","textStyle","responsiveHeader","className","children"]),_=a.useContext(c).responsive,b=n?"th":"td",h="center"===d?l.center:"end"===d?l.end:void 0,y=o?p[o]:void 0;return s.default.createElement(b,e.__assign({},m,n?{scope:"row"}:{},{className:i.default(l.tableCell,v,h,y)}),_&&null!=u&&s.default.createElement("div",{"aria-hidden":!0,className:l.cellHeader},u),f)},h=function(a){var t=a.colSpan,r=a.children,n=e.__rest(a,["colSpan","children"]);return s.default.createElement("tr",e.__assign({},n),s.default.createElement("td",{colSpan:t},s.default.createElement("div",{className:l.noData},r)))},y=Object.assign((function(a){var t,r=a.responsive,n=void 0===r||r,d=a.bordered,o=void 0!==d&&d,u=a.className,v=a.children,f=e.__rest(a,["responsive","bordered","className","children"]);return s.default.createElement(c.Provider,{value:{responsive:n}},s.default.createElement("table",e.__assign({},f,{className:i.default(l.table,u,(t={},t[l.bordered]=o,t[l.responsive]=n,t))}),v))}),{Caption:u,Head:v,Body:f,Row:m,HeaderCell:_,Cell:b,StatusRow:h});exports.TableBody=f,exports.TableCaption=u,exports.TableCell=b,exports.TableHead=v,exports.TableHeaderCell=_,exports.TableRow=m,exports.TableStatusRow=h,exports.default=y;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";module.exports={table:"lds-table",row:"lds-table--row",bordered:"lds-table--bordered",tableHeader:"lds-table--table-header",sortable:"lds-table--sortable",sortIcon:"lds-table--sort-icon",inactive:"lds-table--inactive",center:"lds-table--center",end:"lds-table--end",tableCell:"lds-table--table-cell",textAccent:"lds-table--text-accent",textSecondary:"lds-table--text-secondary",textTertiary:"lds-table--text-tertiary",textQuarternary:"lds-table--text-quarternary",textDefault:"lds-table--text-default",cellHeader:"lds-table--cell-header",noData:"lds-table--no-data",caption:"lds-table--caption",responsive:"lds-table--responsive",rowError:"lds-table--row-error",flashError:"lds-table--flash-error"};
|
|
@@ -23,4 +23,13 @@ export interface SpanTooltipProps extends Omit<HTMLAttributes<HTMLSpanElement>,
|
|
|
23
23
|
export interface DivTooltipProps extends Omit<HTMLAttributes<HTMLDivElement>, "onFocus" | "onBlur" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "aria-describedby">, TooltipProps {
|
|
24
24
|
wrapper: "div";
|
|
25
25
|
}
|
|
26
|
+
/**
|
|
27
|
+
* Shows contextual information on hover/focus. Wrap any element to add a tooltip.
|
|
28
|
+
*
|
|
29
|
+
* Usage: `import { Tooltip } from "@k8slens/lds"`
|
|
30
|
+
*
|
|
31
|
+
* ```tsx
|
|
32
|
+
* <Tooltip text="Helpful info"><span>Hover me</span></Tooltip>
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
26
35
|
export default function Tooltip({ id, wrapper: Wrapper, mutationsListenerElement: initialMutationsListenerElement, popupClassName, placement, alwaysVisible, text, children, ...props }: SpanTooltipProps | DivTooltipProps): React.JSX.Element;
|
|
@@ -50,6 +50,12 @@ export interface CustomUserMenuProps extends BaseUserMenuProps {
|
|
|
50
50
|
}
|
|
51
51
|
export declare type UserMenuProps = DefaultUserMenuProps | CustomUserMenuProps;
|
|
52
52
|
/**
|
|
53
|
-
*
|
|
53
|
+
* Displays user info with dropdown menu for account actions. Uses default menu items if `items` prop is not provided.
|
|
54
|
+
*
|
|
55
|
+
* Usage: `import { UserMenu } from "@k8slens/lds"`
|
|
56
|
+
*
|
|
57
|
+
* ```tsx
|
|
58
|
+
* <UserMenu user={{ name: "John", username: "john" }} onLogoutClick={logout} />
|
|
59
|
+
* ```
|
|
54
60
|
*/
|
|
55
61
|
export default function UserMenu({ user, header, footer, origin, className, onLogoutClick, loading, ...props }: UserMenuProps): React.JSX.Element;
|
package/lib/cjs/components.d.ts
CHANGED
|
@@ -24,3 +24,4 @@ export { default as Tooltip } from "./Tooltip/Tooltip";
|
|
|
24
24
|
export { default as UserMenu } from "./UserMenu/UserMenu";
|
|
25
25
|
export { DefaultHeader as UserMenuDefaultHeader } from "./UserMenu/DefaultHeader";
|
|
26
26
|
export { Switch } from "./Switch/Switch";
|
|
27
|
+
export { default as Table } from "./Table/Table";
|