@k8slens/lds 0.57.0 → 0.57.2
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 +41 -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/Tooltip/Tooltip.d.ts +9 -0
- package/lib/cjs/UserMenu/UserMenu.d.ts +7 -1
- package/lib/cjs/index.css +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/Tooltip/Tooltip.d.ts +9 -0
- package/lib/es/UserMenu/UserMenu.d.ts +7 -1
- package/lib/es/index.css +1 -1
- package/lib/web/{lds-v0-56-0 → lds-v0-57-1}/index.css +1 -1
- package/llms.txt +319 -0
- package/package.json +7 -6
- /package/lib/web/{lds-v0-56-0 → lds-v0-57-1}/index.js +0 -0
- /package/lib/web/{lds-v0-56-0 → lds-v0-57-1}/typography.css +0 -0
package/README.md
CHANGED
|
@@ -1,51 +1,55 @@
|
|
|
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., `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
|
+
- Use Button, Input, Modal, Select etc. from @k8slens/lds
|
|
52
|
+
- Use CSS variables from @k8slens/lds-tokens for colors, spacing, radius
|
|
53
|
+
- Never hardcode values that exist as tokens
|
|
54
|
+
Search llms.txt files before creating custom components or styles.
|
|
55
|
+
```
|
|
@@ -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;
|
|
@@ -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;
|