@k8slens/lds 0.56.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 +9 -4
- package/lib/cjs/Badge/Badge.d.ts +11 -2
- package/lib/cjs/ButtonBar/ButtonBar.d.ts +1 -1
- package/lib/cjs/Checkbox/Checkbox.d.ts +10 -1
- package/lib/cjs/ConfirmDialog/ConfirmDialog.d.ts +16 -4
- package/lib/cjs/LinkButton/LinkButton.d.ts +9 -0
- package/lib/cjs/Lozenge/Lozenge.d.ts +9 -0
- package/lib/cjs/Modal/Modal.d.ts +1 -1
- package/lib/cjs/Modal/Modal.js +1 -1
- package/lib/cjs/Notification/Notification.d.ts +9 -0
- package/lib/cjs/NumberBadge/NumberBadge.d.ts +11 -2
- package/lib/cjs/Panel/Panel.d.ts +1 -1
- package/lib/cjs/ProfileBlock/ProfileBlock.d.ts +11 -2
- package/lib/cjs/ProgressBar/ProgressBar.d.ts +10 -1
- package/lib/cjs/RadioCard/RadioCard.d.ts +2 -2
- package/lib/cjs/RadioCard/RadioCard.js +1 -1
- package/lib/cjs/Select/Option.d.ts +2 -2
- package/lib/cjs/Select/Option.js +1 -1
- package/lib/cjs/Select/Select.d.ts +1 -1
- package/lib/cjs/Select/Select.js +1 -1
- package/lib/cjs/Select/SelectDropdown.d.ts +2 -2
- package/lib/cjs/Select/SelectDropdown.js +1 -1
- package/lib/cjs/SideNav/SideNavGroup.d.ts +1 -1
- package/lib/cjs/SideNav/SideNavItem.d.ts +1 -1
- package/lib/cjs/Switch/Switch.d.ts +11 -1
- package/lib/cjs/Tooltip/Tooltip.d.ts +11 -2
- package/lib/cjs/UserMenu/DefaultHeader.d.ts +1 -1
- package/lib/cjs/UserMenu/UserMenu.d.ts +8 -2
- package/lib/cjs/UserMenu/UserMenu.js +1 -1
- package/lib/cjs/UserMenu/UserMenuDropdown.d.ts +2 -2
- package/lib/cjs/UserMenu/UserMenuDropdown.js +1 -1
- package/lib/cjs/UserMenu/UserMenuItem.d.ts +2 -1
- package/lib/cjs/UserMenu/UserMenuItem.js +1 -1
- package/lib/cjs/index.css +1 -1
- package/lib/es/Avatar/Avatar.d.ts +9 -4
- package/lib/es/Badge/Badge.d.ts +11 -2
- package/lib/es/ButtonBar/ButtonBar.d.ts +1 -1
- package/lib/es/Checkbox/Checkbox.d.ts +10 -1
- package/lib/es/ConfirmDialog/ConfirmDialog.d.ts +16 -4
- package/lib/es/LinkButton/LinkButton.d.ts +9 -0
- package/lib/es/Lozenge/Lozenge.d.ts +9 -0
- package/lib/es/Modal/Modal.d.ts +1 -1
- package/lib/es/Modal/Modal.js +1 -1
- package/lib/es/Notification/Notification.d.ts +9 -0
- package/lib/es/NumberBadge/NumberBadge.d.ts +11 -2
- package/lib/es/Panel/Panel.d.ts +1 -1
- package/lib/es/ProfileBlock/ProfileBlock.d.ts +11 -2
- package/lib/es/ProgressBar/ProgressBar.d.ts +10 -1
- package/lib/es/RadioCard/RadioCard.d.ts +2 -2
- package/lib/es/RadioCard/RadioCard.js +1 -1
- package/lib/es/Select/Option.d.ts +2 -2
- package/lib/es/Select/Option.js +1 -1
- package/lib/es/Select/Select.d.ts +1 -1
- package/lib/es/Select/Select.js +1 -1
- package/lib/es/Select/SelectDropdown.d.ts +2 -2
- package/lib/es/Select/SelectDropdown.js +1 -1
- package/lib/es/SideNav/SideNavGroup.d.ts +1 -1
- package/lib/es/SideNav/SideNavItem.d.ts +1 -1
- package/lib/es/Switch/Switch.d.ts +11 -1
- package/lib/es/Tooltip/Tooltip.d.ts +11 -2
- package/lib/es/UserMenu/DefaultHeader.d.ts +1 -1
- package/lib/es/UserMenu/UserMenu.d.ts +8 -2
- package/lib/es/UserMenu/UserMenu.js +1 -1
- package/lib/es/UserMenu/UserMenuDropdown.d.ts +2 -2
- package/lib/es/UserMenu/UserMenuDropdown.js +1 -1
- package/lib/es/UserMenu/UserMenuItem.d.ts +2 -1
- package/lib/es/UserMenu/UserMenuItem.js +1 -1
- package/lib/es/index.css +1 -1
- package/lib/web/{lds-v0-55-13 → lds-v0-57-1}/index.css +1 -1
- package/lib/web/lds-v0-57-1/index.js +28 -0
- package/llms.txt +319 -0
- package/package.json +13 -9
- package/lib/web/lds-v0-55-13/index.js +0 -19
- /package/lib/web/{lds-v0-55-13 → lds-v0-57-1}/typography.css +0 -0
package/llms.txt
ADDED
|
@@ -0,0 +1,319 @@
|
|
|
1
|
+
# @k8slens/lds
|
|
2
|
+
|
|
3
|
+
> Lens Design System - A React component library providing accessible, themeable UI components for building Kubernetes management applications.
|
|
4
|
+
|
|
5
|
+
This package provides a comprehensive set of React components styled with CSS modules and powered by @k8slens/lds-tokens for consistent theming. Components support both light and dark themes and are designed with accessibility in mind.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install @k8slens/lds
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
### Peer Dependencies
|
|
14
|
+
|
|
15
|
+
The following peer dependencies are required:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npm install @headlessui/react @k8slens/lds-icons @popperjs/core clsx initialism randomcolor react react-dom react-popper rooks
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Required peer dependencies:
|
|
22
|
+
- `@headlessui/react` ^2.2.0
|
|
23
|
+
- `@k8slens/lds-icons` *
|
|
24
|
+
- `@popperjs/core` ^2.11.6
|
|
25
|
+
- `clsx` ^1.2.1
|
|
26
|
+
- `initialism` ^1.0.4
|
|
27
|
+
- `randomcolor` ^0.6.2
|
|
28
|
+
- `react` ^18.2.0
|
|
29
|
+
- `react-dom` ^18.2.0
|
|
30
|
+
- `react-popper` ^2.3.0
|
|
31
|
+
- `rooks` ^7.4.3
|
|
32
|
+
|
|
33
|
+
## Setup
|
|
34
|
+
|
|
35
|
+
Import required styles in your app entry point:
|
|
36
|
+
|
|
37
|
+
```tsx
|
|
38
|
+
import "@k8slens/lds-tokens/lib/electron/font-face.css";
|
|
39
|
+
import "@k8slens/lds/lib/es/index.css";
|
|
40
|
+
import "@k8slens/lds/lib/es/typography.css";
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Importing Components
|
|
44
|
+
|
|
45
|
+
All components are exported from the package root:
|
|
46
|
+
|
|
47
|
+
```typescript
|
|
48
|
+
import { Button, Input, Modal, Select, Avatar, Badge } from "@k8slens/lds";
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## TypeScript Types
|
|
52
|
+
|
|
53
|
+
TypeScript definitions are included and exported from `lib/es/index.d.ts`. Component prop types are exported alongside components:
|
|
54
|
+
|
|
55
|
+
```typescript
|
|
56
|
+
import { Button, ButtonProps } from "@k8slens/lds";
|
|
57
|
+
import { Select, SelectProps } from "@k8slens/lds";
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Module Formats
|
|
61
|
+
|
|
62
|
+
- ES Modules: `lib/es/index.js` (recommended)
|
|
63
|
+
- CommonJS: `lib/cjs/index.js`
|
|
64
|
+
|
|
65
|
+
## Components
|
|
66
|
+
|
|
67
|
+
### Avatar
|
|
68
|
+
|
|
69
|
+
Displays user's profile picture or initials with random background color.
|
|
70
|
+
|
|
71
|
+
```tsx
|
|
72
|
+
import { Avatar } from "@k8slens/lds";
|
|
73
|
+
|
|
74
|
+
<Avatar name="John Doe" image="avatar.jpg" />
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
### Badge
|
|
78
|
+
|
|
79
|
+
A small status indicator dot. Use `type` prop for semantic colors.
|
|
80
|
+
|
|
81
|
+
```tsx
|
|
82
|
+
import { Badge } from "@k8slens/lds";
|
|
83
|
+
|
|
84
|
+
<Badge type="success" title="Active" />
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### Button
|
|
88
|
+
|
|
89
|
+
Accessible button with loading state and icon support.
|
|
90
|
+
|
|
91
|
+
```tsx
|
|
92
|
+
import { Button } from "@k8slens/lds";
|
|
93
|
+
|
|
94
|
+
<Button label="Click me" type="primary" onClick={handleClick} />
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### ButtonBar
|
|
98
|
+
|
|
99
|
+
Container for button groups with layout control.
|
|
100
|
+
|
|
101
|
+
```tsx
|
|
102
|
+
import { ButtonBar } from "@k8slens/lds";
|
|
103
|
+
|
|
104
|
+
<ButtonBar type="default">
|
|
105
|
+
<Button label="Cancel" />
|
|
106
|
+
<Button label="Submit" type="primary" />
|
|
107
|
+
</ButtonBar>
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### Checkbox
|
|
111
|
+
|
|
112
|
+
A styled checkbox input with checkmark icon.
|
|
113
|
+
|
|
114
|
+
```tsx
|
|
115
|
+
import { Checkbox } from "@k8slens/lds";
|
|
116
|
+
|
|
117
|
+
<Checkbox value={checked} onChange={setChecked} />
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
### ConfirmDialog
|
|
121
|
+
|
|
122
|
+
A modal dialog that asks the user to confirm an action. Use with `useConfirmDialog` hook.
|
|
123
|
+
|
|
124
|
+
```tsx
|
|
125
|
+
import { useConfirmDialog } from "@k8slens/lds";
|
|
126
|
+
|
|
127
|
+
const { ConfirmDialog, confirm } = useConfirmDialog();
|
|
128
|
+
return (
|
|
129
|
+
<>
|
|
130
|
+
<Button onClick={() => confirm("Delete?", "This cannot be undone.")} />
|
|
131
|
+
{ConfirmDialog}
|
|
132
|
+
</>
|
|
133
|
+
);
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
### Input
|
|
137
|
+
|
|
138
|
+
A text input with optional icon.
|
|
139
|
+
|
|
140
|
+
```tsx
|
|
141
|
+
import { Input } from "@k8slens/lds";
|
|
142
|
+
|
|
143
|
+
<Input type="text" placeholder="Enter text..." />
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
### LinkButton
|
|
147
|
+
|
|
148
|
+
A text link with arrow icon for navigation actions.
|
|
149
|
+
|
|
150
|
+
```tsx
|
|
151
|
+
import { LinkButton } from "@k8slens/lds";
|
|
152
|
+
|
|
153
|
+
<LinkButton label="Learn more" href="/docs" />
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
### LoadingIndicator
|
|
157
|
+
|
|
158
|
+
A spinning loading indicator.
|
|
159
|
+
|
|
160
|
+
```tsx
|
|
161
|
+
import { LoadingIndicator } from "@k8slens/lds";
|
|
162
|
+
|
|
163
|
+
<LoadingIndicator size="xl" />
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
### Lozenge
|
|
167
|
+
|
|
168
|
+
A pill-shaped label for status or category display.
|
|
169
|
+
|
|
170
|
+
```tsx
|
|
171
|
+
import { Lozenge } from "@k8slens/lds";
|
|
172
|
+
|
|
173
|
+
<Lozenge type="success">Active</Lozenge>
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
### Modal
|
|
177
|
+
|
|
178
|
+
A responsive modal dialog with header, footer, and content areas.
|
|
179
|
+
|
|
180
|
+
```tsx
|
|
181
|
+
import { Modal } from "@k8slens/lds";
|
|
182
|
+
|
|
183
|
+
<Modal isOpen={isOpen} onClose={close} title="Title" footer={<Button label="Close" />}>
|
|
184
|
+
Content
|
|
185
|
+
</Modal>
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
### Notification
|
|
189
|
+
|
|
190
|
+
Alert banner for user feedback. `type="flash"` auto-dismisses, `type="closable"` shows close button.
|
|
191
|
+
|
|
192
|
+
```tsx
|
|
193
|
+
import { Notification } from "@k8slens/lds";
|
|
194
|
+
|
|
195
|
+
<Notification level="success" message="Saved successfully" />
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
### NumberBadge
|
|
199
|
+
|
|
200
|
+
A numeric badge that formats large numbers (1500 → "1.5k").
|
|
201
|
+
|
|
202
|
+
```tsx
|
|
203
|
+
import { NumberBadge } from "@k8slens/lds";
|
|
204
|
+
|
|
205
|
+
<NumberBadge value={42} title="Items" />
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
### Panel
|
|
209
|
+
|
|
210
|
+
A container with optional header, footer, and loading state.
|
|
211
|
+
|
|
212
|
+
```tsx
|
|
213
|
+
import { Panel } from "@k8slens/lds";
|
|
214
|
+
|
|
215
|
+
<Panel header={<h2>Title</h2>} loading={isLoading}>Content</Panel>
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
### ProfileBlock
|
|
219
|
+
|
|
220
|
+
Displays user info with avatar, title, and subtitle.
|
|
221
|
+
|
|
222
|
+
```tsx
|
|
223
|
+
import { ProfileBlock } from "@k8slens/lds";
|
|
224
|
+
|
|
225
|
+
<ProfileBlock item={{ title: "@user", subtitle: "Name", avatarTitle: "Name" }} />
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
### ProgressBar
|
|
229
|
+
|
|
230
|
+
A progress bar with semantic color types. Value can be 0-1 or use custom `max`.
|
|
231
|
+
|
|
232
|
+
```tsx
|
|
233
|
+
import { ProgressBar } from "@k8slens/lds";
|
|
234
|
+
|
|
235
|
+
<ProgressBar value={0.75} type="ok" />
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
### RadioCard
|
|
239
|
+
|
|
240
|
+
Styled radio button cards for option selection.
|
|
241
|
+
|
|
242
|
+
```tsx
|
|
243
|
+
import { RadioCard } from "@k8slens/lds";
|
|
244
|
+
|
|
245
|
+
<RadioCard name="choice" options={options} value={selected} onChange={setSelected} />
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
### Select
|
|
249
|
+
|
|
250
|
+
A dropdown select component with single or multiple selection.
|
|
251
|
+
|
|
252
|
+
```tsx
|
|
253
|
+
import { Select } from "@k8slens/lds";
|
|
254
|
+
|
|
255
|
+
<Select options={options} value={selected} onChange={setSelected} />
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
### SideNav
|
|
259
|
+
|
|
260
|
+
Side navigation container. Use with SideNavGroup and SideNavItem.
|
|
261
|
+
|
|
262
|
+
```tsx
|
|
263
|
+
import { SideNav, SideNavGroup, SideNavItem } from "@k8slens/lds";
|
|
264
|
+
|
|
265
|
+
<SideNav>
|
|
266
|
+
<SideNavGroup label="Section">
|
|
267
|
+
<SideNavItem href="/page1">Page 1</SideNavItem>
|
|
268
|
+
</SideNavGroup>
|
|
269
|
+
</SideNav>
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
### Switch
|
|
273
|
+
|
|
274
|
+
A toggle switch input with label support.
|
|
275
|
+
|
|
276
|
+
```tsx
|
|
277
|
+
import { Switch } from "@k8slens/lds";
|
|
278
|
+
|
|
279
|
+
<Switch checked={enabled} onChange={setEnabled}>Enable feature</Switch>
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
### Tooltip
|
|
283
|
+
|
|
284
|
+
Shows contextual information on hover/focus.
|
|
285
|
+
|
|
286
|
+
```tsx
|
|
287
|
+
import { Tooltip } from "@k8slens/lds";
|
|
288
|
+
|
|
289
|
+
<Tooltip text="Helpful info"><span>Hover me</span></Tooltip>
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
### UserMenu
|
|
293
|
+
|
|
294
|
+
Displays user info with dropdown menu for account actions. Uses default menu items if `items` prop is not provided.
|
|
295
|
+
|
|
296
|
+
```tsx
|
|
297
|
+
import { UserMenu } from "@k8slens/lds";
|
|
298
|
+
|
|
299
|
+
<UserMenu user={{ name: "John", username: "john" }} onLogoutClick={logout} />
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
## Theming
|
|
303
|
+
|
|
304
|
+
Components are styled using CSS modules with CSS custom properties from @k8slens/lds-tokens. Import the tokens CSS to enable theming:
|
|
305
|
+
|
|
306
|
+
```css
|
|
307
|
+
@import '@k8slens/lds-tokens/lib/web/tokens.core.css';
|
|
308
|
+
@import '@k8slens/lds-tokens/lib/web/tokens.dark.css';
|
|
309
|
+
/* or tokens.light.css for light theme */
|
|
310
|
+
```
|
|
311
|
+
|
|
312
|
+
## Documentation
|
|
313
|
+
|
|
314
|
+
- [Lens Design System Storybook](https://lens-design-system.k8slens.dev/)
|
|
315
|
+
|
|
316
|
+
## Optional
|
|
317
|
+
|
|
318
|
+
- [npm Package](https://www.npmjs.com/package/@k8slens/lds)
|
|
319
|
+
- [Source Code](https://github.com/lensapp/lens-design-system)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@k8slens/lds",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.57.2",
|
|
4
4
|
"description": "Lens Design System – Core React Component Library",
|
|
5
5
|
"author": "Mirantis Inc",
|
|
6
6
|
"license": "MIT",
|
|
@@ -15,7 +15,8 @@
|
|
|
15
15
|
"types": "./lib/es/index.d.ts",
|
|
16
16
|
"type": "module",
|
|
17
17
|
"files": [
|
|
18
|
-
"lib/"
|
|
18
|
+
"lib/",
|
|
19
|
+
"llms.txt"
|
|
19
20
|
],
|
|
20
21
|
"scripts": {
|
|
21
22
|
"start": "npm run rollup-watch",
|
|
@@ -24,11 +25,11 @@
|
|
|
24
25
|
"rollup": "rollup -c",
|
|
25
26
|
"clean": "rimraf lib",
|
|
26
27
|
"test": "jest",
|
|
27
|
-
"lint": "
|
|
28
|
-
"format": "
|
|
28
|
+
"lint": "oxlint .",
|
|
29
|
+
"format": "oxlint --fix . && prettier --write ."
|
|
29
30
|
},
|
|
30
31
|
"devDependencies": {
|
|
31
|
-
"@k8slens/lds-tokens": "^0.
|
|
32
|
+
"@k8slens/lds-tokens": "^0.58.2",
|
|
32
33
|
"@storybook/react": "6.5.16",
|
|
33
34
|
"@testing-library/react": "14.0.0",
|
|
34
35
|
"@types/randomcolor": "0.5.9",
|
|
@@ -37,11 +38,11 @@
|
|
|
37
38
|
"typescript": "4.8.4"
|
|
38
39
|
},
|
|
39
40
|
"peerDependencies": {
|
|
40
|
-
"@headlessui/react": "^
|
|
41
|
+
"@headlessui/react": "^2.2.0",
|
|
41
42
|
"@k8slens/lds-icons": "*",
|
|
42
43
|
"@popperjs/core": "^2.11.6",
|
|
43
|
-
"@types/react": "^18.
|
|
44
|
-
"@types/react-dom": "^18.
|
|
44
|
+
"@types/react": "^18.3.0",
|
|
45
|
+
"@types/react-dom": "^18.3.0",
|
|
45
46
|
"clsx": "^1.2.1",
|
|
46
47
|
"initialism": "^1.0.4",
|
|
47
48
|
"randomcolor": "^0.6.2",
|
|
@@ -52,6 +53,9 @@
|
|
|
52
53
|
},
|
|
53
54
|
"jest": {
|
|
54
55
|
"testEnvironment": "jsdom",
|
|
56
|
+
"setupFilesAfterEnv": [
|
|
57
|
+
"<rootDir>/../../jest.setup.js"
|
|
58
|
+
],
|
|
55
59
|
"transform": {
|
|
56
60
|
"^.+\\.(ts|tsx|js|jsx)$": "ts-jest"
|
|
57
61
|
},
|
|
@@ -60,5 +64,5 @@
|
|
|
60
64
|
"\\.svg": "<rootDir>/../../__mocks__/SVGStub.js"
|
|
61
65
|
}
|
|
62
66
|
},
|
|
63
|
-
"gitHead": "
|
|
67
|
+
"gitHead": "1edf9b6761a700920be41adb01f3de528320f639"
|
|
64
68
|
}
|