@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.
Files changed (46) hide show
  1. package/README.md +42 -37
  2. package/lib/cjs/Avatar/Avatar.d.ts +7 -2
  3. package/lib/cjs/Badge/Badge.d.ts +9 -0
  4. package/lib/cjs/Checkbox/Checkbox.d.ts +9 -0
  5. package/lib/cjs/ConfirmDialog/ConfirmDialog.d.ts +13 -1
  6. package/lib/cjs/LinkButton/LinkButton.d.ts +9 -0
  7. package/lib/cjs/Lozenge/Lozenge.d.ts +9 -0
  8. package/lib/cjs/Notification/Notification.d.ts +9 -0
  9. package/lib/cjs/NumberBadge/NumberBadge.d.ts +9 -0
  10. package/lib/cjs/ProfileBlock/ProfileBlock.d.ts +9 -0
  11. package/lib/cjs/ProgressBar/ProgressBar.d.ts +9 -0
  12. package/lib/cjs/Switch/Switch.d.ts +9 -0
  13. package/lib/cjs/Table/Table.d.ts +111 -0
  14. package/lib/cjs/Table/Table.js +1 -0
  15. package/lib/cjs/Table/Table.module.css.js +1 -0
  16. package/lib/cjs/Tooltip/Tooltip.d.ts +9 -0
  17. package/lib/cjs/UserMenu/UserMenu.d.ts +7 -1
  18. package/lib/cjs/components.d.ts +1 -0
  19. package/lib/cjs/index.css +1 -1
  20. package/lib/cjs/index.electron.js +1 -1
  21. package/lib/cjs/index.js +1 -1
  22. package/lib/es/Avatar/Avatar.d.ts +7 -2
  23. package/lib/es/Badge/Badge.d.ts +9 -0
  24. package/lib/es/Checkbox/Checkbox.d.ts +9 -0
  25. package/lib/es/ConfirmDialog/ConfirmDialog.d.ts +13 -1
  26. package/lib/es/LinkButton/LinkButton.d.ts +9 -0
  27. package/lib/es/Lozenge/Lozenge.d.ts +9 -0
  28. package/lib/es/Notification/Notification.d.ts +9 -0
  29. package/lib/es/NumberBadge/NumberBadge.d.ts +9 -0
  30. package/lib/es/ProfileBlock/ProfileBlock.d.ts +9 -0
  31. package/lib/es/ProgressBar/ProgressBar.d.ts +9 -0
  32. package/lib/es/Switch/Switch.d.ts +9 -0
  33. package/lib/es/Table/Table.d.ts +111 -0
  34. package/lib/es/Table/Table.js +1 -0
  35. package/lib/es/Table/Table.module.css.js +1 -0
  36. package/lib/es/Tooltip/Tooltip.d.ts +9 -0
  37. package/lib/es/UserMenu/UserMenu.d.ts +7 -1
  38. package/lib/es/components.d.ts +1 -0
  39. package/lib/es/index.css +1 -1
  40. package/lib/es/index.electron.js +1 -1
  41. package/lib/es/index.js +1 -1
  42. package/lib/web/{lds-v0-56-0 → lds-v0-57-3}/index.css +1 -1
  43. package/lib/web/{lds-v0-56-0 → lds-v0-57-3}/index.js +3 -3
  44. package/llms.txt +372 -0
  45. package/package.json +7 -6
  46. /package/lib/web/{lds-v0-56-0 → lds-v0-57-3}/typography.css +0 -0
package/llms.txt ADDED
@@ -0,0 +1,372 @@
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
+ ### Table
283
+
284
+ A composable data table with responsive layout, sorting indicators, and row states. Uses dot notation API for sub-components.
285
+
286
+ ```tsx
287
+ import { Table } from "@k8slens/lds";
288
+
289
+ <Table responsive bordered={false}>
290
+ <Table.Caption visibility="sr-only">User data</Table.Caption>
291
+ <Table.Head>
292
+ <Table.Row>
293
+ <Table.HeaderCell sortable sorted="asc">Name</Table.HeaderCell>
294
+ <Table.HeaderCell align="end">Count</Table.HeaderCell>
295
+ </Table.Row>
296
+ </Table.Head>
297
+ <Table.Body loading={false}>
298
+ <Table.Row error={false}>
299
+ <Table.Cell primary responsiveHeader="Name">John</Table.Cell>
300
+ <Table.Cell align="end" textStyle="accent">42</Table.Cell>
301
+ </Table.Row>
302
+ <Table.StatusRow colSpan={2}>No data available</Table.StatusRow>
303
+ </Table.Body>
304
+ </Table>
305
+ ```
306
+
307
+ **Table Props:**
308
+ - `responsive` (default: true) - Enables responsive layout on mobile
309
+ - `bordered` (default: false) - Adds inner row borders
310
+
311
+ **TableCaption Props:**
312
+ - `visibility` (default: "sr-only") - "visible", "sr-only", or "hidden"
313
+
314
+ **TableBody Props:**
315
+ - `loading` (default: false) - Indicates loading state, sets `aria-busy` when true
316
+
317
+ **TableRow Props:**
318
+ - `error` (default: false) - Shows error flash animation
319
+
320
+ **TableHeaderCell Props:**
321
+ - `align` - "start", "center", or "end"
322
+ - `sortable` (default: false) - Indicates column is sortable
323
+ - `sorted` (default: false) - "asc", "desc", or false. When `sortable` is true, a sort direction icon is always visible. The icon appears at reduced opacity when the column is not the active sort column. When actively sorted, the icon shows full opacity with direction (up for asc, down for desc)
324
+
325
+ **TableCell Props:**
326
+ - `primary` (default: false) - Renders as `<th scope="row">`
327
+ - `align` - "start", "center", or "end"
328
+ - `textStyle` - "default", "accent", "secondary", "tertiary", or "quarternary"
329
+ - `responsiveHeader` - Label shown on mobile viewports
330
+
331
+ **TableStatusRow Props:**
332
+ - `colSpan` (required) - Number of columns to span
333
+ - Extends `HTMLAttributes<HTMLTableRowElement>`
334
+
335
+ ### Tooltip
336
+
337
+ Shows contextual information on hover/focus.
338
+
339
+ ```tsx
340
+ import { Tooltip } from "@k8slens/lds";
341
+
342
+ <Tooltip text="Helpful info"><span>Hover me</span></Tooltip>
343
+ ```
344
+
345
+ ### UserMenu
346
+
347
+ Displays user info with dropdown menu for account actions. Uses default menu items if `items` prop is not provided.
348
+
349
+ ```tsx
350
+ import { UserMenu } from "@k8slens/lds";
351
+
352
+ <UserMenu user={{ name: "John", username: "john" }} onLogoutClick={logout} />
353
+ ```
354
+
355
+ ## Theming
356
+
357
+ Components are styled using CSS modules with CSS custom properties from @k8slens/lds-tokens. Import the tokens CSS to enable theming:
358
+
359
+ ```css
360
+ @import '@k8slens/lds-tokens/lib/web/tokens.core.css';
361
+ @import '@k8slens/lds-tokens/lib/web/tokens.dark.css';
362
+ /* or tokens.light.css for light theme */
363
+ ```
364
+
365
+ ## Documentation
366
+
367
+ - [Lens Design System Storybook](https://lens-design-system.k8slens.dev/)
368
+
369
+ ## Optional
370
+
371
+ - [npm Package](https://www.npmjs.com/package/@k8slens/lds)
372
+ - [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.57.0",
3
+ "version": "0.58.0",
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": "eslint .",
28
- "format": "eslint --fix ."
28
+ "lint": "oxlint .",
29
+ "format": "oxlint --fix . && prettier --write ."
29
30
  },
30
31
  "devDependencies": {
31
- "@k8slens/lds-tokens": "^0.58.0",
32
+ "@k8slens/lds-tokens": "^0.59.0",
32
33
  "@storybook/react": "6.5.16",
33
34
  "@testing-library/react": "14.0.0",
34
35
  "@types/randomcolor": "0.5.9",
@@ -63,5 +64,5 @@
63
64
  "\\.svg": "<rootDir>/../../__mocks__/SVGStub.js"
64
65
  }
65
66
  },
66
- "gitHead": "dc375594fe63bf08745b6cfa09c4dc8437a4dc03"
67
+ "gitHead": "e41693e45edd36a94e34ab286d4ededba24f5daf"
67
68
  }