@k8slens/lds 0.58.2 → 0.58.4
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/Avatar/Avatar.js +1 -1
- package/lib/cjs/Badge/Badge.d.ts +6 -4
- package/lib/cjs/Button/Button.d.ts +34 -6
- package/lib/cjs/Button/Button.js +1 -1
- package/lib/cjs/Button/shared.d.ts +30 -1
- package/lib/cjs/ButtonBar/ButtonBar.d.ts +17 -0
- package/lib/cjs/ButtonBar/ButtonBar.js +1 -1
- package/lib/cjs/Checkbox/Checkbox.d.ts +7 -0
- package/lib/cjs/ConfirmDialog/ConfirmDialog.d.ts +16 -0
- package/lib/cjs/ConfirmDialog/ConfirmDialog.js +1 -1
- package/lib/cjs/ContextMenu/ContextMenu.js +1 -1
- package/lib/cjs/DrawerTransition/DrawerTransition.d.ts +20 -0
- package/lib/cjs/DrawerTransition/DrawerTransition.js +1 -1
- package/lib/cjs/Input/Input.d.ts +8 -0
- package/lib/cjs/Input/Input.js +1 -1
- package/lib/cjs/LinkButton/LinkButton.d.ts +7 -0
- package/lib/cjs/LinkButton/LinkButton.js +1 -1
- package/lib/cjs/LoadingIndicator/LoadingIndicator.d.ts +8 -2
- package/lib/cjs/Lozenge/Lozenge.d.ts +4 -2
- package/lib/cjs/Lozenge/Lozenge.js +1 -1
- package/lib/cjs/Modal/Modal.d.ts +26 -0
- package/lib/cjs/Modal/Modal.js +1 -1
- package/lib/cjs/Notification/Notification.d.ts +18 -2
- package/lib/cjs/Notification/Notification.js +1 -1
- package/lib/cjs/NumberBadge/NumberBadge.d.ts +1 -1
- package/lib/cjs/Panel/Panel.d.ts +28 -0
- package/lib/cjs/Panel/Panel.js +1 -1
- 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/RadioCard/RadioCard.js +1 -1
- package/lib/cjs/Select/MultiOption.d.ts +14 -4
- package/lib/cjs/Select/MultiOption.js +1 -1
- package/lib/cjs/Select/Option.d.ts +6 -0
- package/lib/cjs/Select/Option.js +1 -1
- package/lib/cjs/Select/Select.d.ts +39 -5
- package/lib/cjs/Select/Select.js +1 -1
- package/lib/cjs/Select/SelectDropdown.js +1 -1
- package/lib/cjs/SideNav/SideNav.d.ts +9 -3
- package/lib/cjs/SideNav/SideNav.js +1 -1
- package/lib/cjs/SideNav/SideNavGroup.d.ts +13 -5
- package/lib/cjs/SideNav/SideNavGroup.js +1 -1
- package/lib/cjs/SideNav/SideNavItem.d.ts +22 -5
- package/lib/cjs/SideNav/SideNavItem.js +1 -1
- package/lib/cjs/Switch/Switch.d.ts +2 -0
- package/lib/cjs/Table/Table.js +1 -1
- package/lib/cjs/Textarea/Textarea.js +1 -1
- package/lib/cjs/Tooltip/Tooltip.d.ts +15 -3
- package/lib/cjs/Tooltip/Tooltip.js +1 -1
- package/lib/cjs/UserMenu/UserMenu.d.ts +9 -2
- package/lib/cjs/UserMenu/UserMenu.js +1 -1
- package/lib/cjs/UserMenu/UserMenuDropdown.d.ts +10 -6
- package/lib/cjs/UserMenu/UserMenuDropdown.js +1 -1
- package/lib/cjs/UserMenu/UserMenuItem.d.ts +22 -1
- package/lib/cjs/UserMenu/UserMenuItem.js +1 -1
- package/lib/cjs/_virtual/_tslib.js +1 -1
- package/lib/cjs/node_modules/lodash/_basePick.js +1 -1
- package/lib/cjs/node_modules/lodash/_baseToString.js +1 -1
- package/lib/cjs/node_modules/lodash/_memoizeCapped.js +1 -1
- package/lib/cjs/node_modules/lodash/_stringToPath.js +1 -1
- package/lib/cjs/node_modules/lodash/_toKey.js +1 -1
- package/lib/cjs/node_modules/lodash/pick.js +1 -1
- package/lib/es/Avatar/Avatar.d.ts +3 -1
- package/lib/es/Avatar/Avatar.js +1 -1
- package/lib/es/Badge/Badge.d.ts +6 -4
- package/lib/es/Button/Button.d.ts +34 -6
- package/lib/es/Button/Button.js +1 -1
- package/lib/es/Button/shared.d.ts +30 -1
- package/lib/es/ButtonBar/ButtonBar.d.ts +17 -0
- package/lib/es/ButtonBar/ButtonBar.js +1 -1
- package/lib/es/Checkbox/Checkbox.d.ts +7 -0
- package/lib/es/ConfirmDialog/ConfirmDialog.d.ts +16 -0
- package/lib/es/ConfirmDialog/ConfirmDialog.js +1 -1
- package/lib/es/ContextMenu/ContextMenu.js +1 -1
- package/lib/es/DrawerTransition/DrawerTransition.d.ts +20 -0
- package/lib/es/DrawerTransition/DrawerTransition.js +1 -1
- package/lib/es/Input/Input.d.ts +8 -0
- package/lib/es/Input/Input.js +1 -1
- package/lib/es/LinkButton/LinkButton.d.ts +7 -0
- package/lib/es/LinkButton/LinkButton.js +1 -1
- package/lib/es/LoadingIndicator/LoadingIndicator.d.ts +8 -2
- package/lib/es/Lozenge/Lozenge.d.ts +4 -2
- package/lib/es/Lozenge/Lozenge.js +1 -1
- package/lib/es/Modal/Modal.d.ts +26 -0
- package/lib/es/Modal/Modal.js +1 -1
- package/lib/es/Notification/Notification.d.ts +18 -2
- package/lib/es/Notification/Notification.js +1 -1
- package/lib/es/NumberBadge/NumberBadge.d.ts +1 -1
- package/lib/es/Panel/Panel.d.ts +28 -0
- package/lib/es/Panel/Panel.js +1 -1
- 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/RadioCard/RadioCard.js +1 -1
- package/lib/es/Select/MultiOption.d.ts +14 -4
- package/lib/es/Select/MultiOption.js +1 -1
- package/lib/es/Select/Option.d.ts +6 -0
- package/lib/es/Select/Option.js +1 -1
- package/lib/es/Select/Select.d.ts +39 -5
- package/lib/es/Select/Select.js +1 -1
- package/lib/es/Select/SelectDropdown.js +1 -1
- package/lib/es/SideNav/SideNav.d.ts +9 -3
- package/lib/es/SideNav/SideNav.js +1 -1
- package/lib/es/SideNav/SideNavGroup.d.ts +13 -5
- package/lib/es/SideNav/SideNavGroup.js +1 -1
- package/lib/es/SideNav/SideNavItem.d.ts +22 -5
- package/lib/es/SideNav/SideNavItem.js +1 -1
- package/lib/es/Switch/Switch.d.ts +2 -0
- package/lib/es/Table/Table.js +1 -1
- package/lib/es/Textarea/Textarea.js +1 -1
- package/lib/es/Tooltip/Tooltip.d.ts +15 -3
- package/lib/es/Tooltip/Tooltip.js +1 -1
- package/lib/es/UserMenu/UserMenu.d.ts +9 -2
- package/lib/es/UserMenu/UserMenu.js +1 -1
- package/lib/es/UserMenu/UserMenuDropdown.d.ts +10 -6
- package/lib/es/UserMenu/UserMenuDropdown.js +1 -1
- package/lib/es/UserMenu/UserMenuItem.d.ts +22 -1
- package/lib/es/UserMenu/UserMenuItem.js +1 -1
- package/lib/es/_virtual/_tslib.js +1 -1
- package/lib/es/node_modules/lodash/_basePick.js +1 -1
- package/lib/es/node_modules/lodash/_baseToString.js +1 -1
- package/lib/es/node_modules/lodash/_memoizeCapped.js +1 -1
- package/lib/es/node_modules/lodash/_stringToPath.js +1 -1
- package/lib/es/node_modules/lodash/_toKey.js +1 -1
- package/lib/es/node_modules/lodash/pick.js +1 -1
- package/lib/es/node_modules/lodash/throttle.js +1 -1
- package/lib/web/lds-v0-58-3/index.js +28 -0
- package/llms.txt +262 -102
- package/package.json +4 -4
- package/lib/web/lds-v0-58-1/index.js +0 -28
- /package/lib/web/{lds-v0-58-1 → lds-v0-58-3}/index.css +0 -0
- /package/lib/web/{lds-v0-58-1 → lds-v0-58-3}/typography.css +0 -0
package/llms.txt
CHANGED
|
@@ -11,14 +11,6 @@ npm install @k8slens/lds
|
|
|
11
11
|
```
|
|
12
12
|
|
|
13
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
14
|
- `@headlessui/react` ^2.2.0
|
|
23
15
|
- `@k8slens/lds-icons` *
|
|
24
16
|
- `@popperjs/core` ^2.11.6
|
|
@@ -40,14 +32,6 @@ import "@k8slens/lds/lib/es/index.css";
|
|
|
40
32
|
import "@k8slens/lds/lib/es/typography.css";
|
|
41
33
|
```
|
|
42
34
|
|
|
43
|
-
## Importing Components
|
|
44
|
-
|
|
45
|
-
All components are exported from the package root:
|
|
46
|
-
|
|
47
|
-
```typescript
|
|
48
|
-
import { Button, Input, Modal, Select, Avatar, Badge, ContextMenu, Textarea } from "@k8slens/lds";
|
|
49
|
-
```
|
|
50
|
-
|
|
51
35
|
## TypeScript Types
|
|
52
36
|
|
|
53
37
|
TypeScript definitions are included and exported from `lib/es/index.d.ts`. Component prop types are exported alongside components:
|
|
@@ -57,11 +41,6 @@ import { Button, ButtonProps } from "@k8slens/lds";
|
|
|
57
41
|
import { Select, SelectProps } from "@k8slens/lds";
|
|
58
42
|
```
|
|
59
43
|
|
|
60
|
-
## Module Formats
|
|
61
|
-
|
|
62
|
-
- ES Modules: `lib/es/index.js` (recommended)
|
|
63
|
-
- CommonJS: `lib/cjs/index.js`
|
|
64
|
-
|
|
65
44
|
## Components
|
|
66
45
|
|
|
67
46
|
### Avatar
|
|
@@ -69,61 +48,86 @@ import { Select, SelectProps } from "@k8slens/lds";
|
|
|
69
48
|
Displays user's profile picture or initials with random background color.
|
|
70
49
|
|
|
71
50
|
```tsx
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
<Avatar name="John Doe" image="avatar.jpg" />
|
|
51
|
+
<Avatar name="John Doe" image="avatar.jpg" size="md" />
|
|
75
52
|
```
|
|
76
53
|
|
|
54
|
+
**Props:**
|
|
55
|
+
- `name` (required) - Full name of the user. Initials will be generated from this value and shown if no image is provided
|
|
56
|
+
- `image` - URL of the image or an `Icon` component to use as the avatar
|
|
57
|
+
- `size` (default: "md") - "sm", "md", or "xl"
|
|
58
|
+
- `className` - Optional class name to apply to the avatar
|
|
59
|
+
|
|
77
60
|
### Badge
|
|
78
61
|
|
|
79
62
|
A small status indicator dot. Use `type` prop for semantic colors.
|
|
80
63
|
|
|
81
64
|
```tsx
|
|
82
|
-
import { Badge } from "@k8slens/lds";
|
|
83
|
-
|
|
84
65
|
<Badge type="success" title="Active" />
|
|
85
66
|
```
|
|
86
67
|
|
|
68
|
+
**Props:**
|
|
69
|
+
- `title` - Accessible title. If not provided, the badge is hidden from screen readers
|
|
70
|
+
- `type` (default: "secondary") - "primary", "secondary", "success", "error", or "warning"
|
|
71
|
+
- `size` (default: "sm") - "sm", "md", or "lg"
|
|
72
|
+
|
|
87
73
|
### Button
|
|
88
74
|
|
|
89
|
-
Accessible button with loading state and
|
|
75
|
+
Accessible button with icon, loading state, and promise-based loading.
|
|
90
76
|
|
|
91
77
|
```tsx
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
<Button label="Click me" type="primary" onClick={handleClick} />
|
|
78
|
+
<Button label="Save" type="primary" onClick={handleSave} />
|
|
95
79
|
```
|
|
96
80
|
|
|
81
|
+
**Props:**
|
|
82
|
+
- `label` (required) - Text label rendered inside the button. Use `ButtonPropsWithLabelNode` when passing a ReactNode (requires explicit `aria-label`)
|
|
83
|
+
- `type` (default: "default") - "default", "primary", "ok", "danger", or "caution"
|
|
84
|
+
- `size` (default: "md") - "xxs", "xs", "sm", or "md"
|
|
85
|
+
- `icon` - Icon component rendered alongside the label
|
|
86
|
+
- `iconPosition` (default: "left") - "left" or "right"
|
|
87
|
+
- `loading` (default: false) - Whether to show the loading activity indicator
|
|
88
|
+
- `loadingStateOnPromise` (default: false) - Show loading indicator until onClick promise resolves
|
|
89
|
+
- `disabled` (default: false) - Whether the button is disabled
|
|
90
|
+
- `discreet` - Whether the button uses the discreet (low-emphasis) style
|
|
91
|
+
- `textTransform` - "uppercase" or "capitalize"
|
|
92
|
+
- `onClick` - Click handler, may return a promise when used with `loadingStateOnPromise`
|
|
93
|
+
- `buttonType` (default: "button") - HTML `type` attribute for the button element
|
|
94
|
+
- `buttonValue` - HTML `value` attribute for the button element
|
|
95
|
+
- `buttonName` - HTML `name` attribute for the button element
|
|
96
|
+
|
|
97
97
|
### ButtonBar
|
|
98
98
|
|
|
99
|
-
|
|
99
|
+
A container for buttons. Set `type` prop to change the layout of the buttons.
|
|
100
100
|
|
|
101
101
|
```tsx
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
<ButtonBar type="default">
|
|
102
|
+
<ButtonBar>
|
|
105
103
|
<Button label="Cancel" />
|
|
106
|
-
<Button label="
|
|
104
|
+
<Button label="Save" type="primary" />
|
|
107
105
|
</ButtonBar>
|
|
108
106
|
```
|
|
109
107
|
|
|
108
|
+
**Props:**
|
|
109
|
+
- `type` (default: "default") - "default", "centered", "stacked", or "grid"
|
|
110
|
+
- `as` (default: "div") - Element or component to render as the container
|
|
111
|
+
- `gridSize` - Override the grid column count (only used when `type` is "grid")
|
|
112
|
+
|
|
110
113
|
### Checkbox
|
|
111
114
|
|
|
112
115
|
A styled checkbox input with checkmark icon.
|
|
113
116
|
|
|
114
117
|
```tsx
|
|
115
|
-
import { Checkbox } from "@k8slens/lds";
|
|
116
|
-
|
|
117
118
|
<Checkbox value={checked} onChange={setChecked} />
|
|
118
119
|
```
|
|
119
120
|
|
|
121
|
+
**Props:**
|
|
122
|
+
- `value` (required) - Whether the checkbox is checked
|
|
123
|
+
- `onChange` (required) - Change handler receiving the new value and the original event
|
|
124
|
+
- `disabled` (default: false) - Whether the checkbox is disabled
|
|
125
|
+
|
|
120
126
|
### ContextMenu
|
|
121
127
|
|
|
122
128
|
A dropdown context menu triggered by an icon button. Uses dot notation API for sub-components. Built with Headless UI v2 Menu for accessibility.
|
|
123
129
|
|
|
124
130
|
```tsx
|
|
125
|
-
import { ContextMenu } from "@k8slens/lds";
|
|
126
|
-
|
|
127
131
|
<ContextMenu>
|
|
128
132
|
<ContextMenu.Item onClick={handleEdit} icon={EditIcon}>Edit</ContextMenu.Item>
|
|
129
133
|
<ContextMenu.Item onClick={handleDelete} disabled>Delete</ContextMenu.Item>
|
|
@@ -152,8 +156,6 @@ import { ContextMenu } from "@k8slens/lds";
|
|
|
152
156
|
A modal dialog that asks the user to confirm an action. Use with `useConfirmDialog` hook.
|
|
153
157
|
|
|
154
158
|
```tsx
|
|
155
|
-
import { useConfirmDialog } from "@k8slens/lds";
|
|
156
|
-
|
|
157
159
|
const { ConfirmDialog, confirm } = useConfirmDialog();
|
|
158
160
|
return (
|
|
159
161
|
<>
|
|
@@ -163,159 +165,300 @@ return (
|
|
|
163
165
|
);
|
|
164
166
|
```
|
|
165
167
|
|
|
166
|
-
|
|
168
|
+
**ConfirmDialog Props (direct usage):**
|
|
169
|
+
- `title` (required) - Title displayed in the confirm dialog header
|
|
170
|
+
- `message` - Optional message body rendered below the title
|
|
171
|
+
- `confirmText` (default: "Ok") - Label for the confirm button
|
|
172
|
+
- `cancelLabel` (default: "Cancel") - Label for the cancel button
|
|
173
|
+
- `confirmButtonProps` - Additional Button props forwarded to the confirm button
|
|
174
|
+
- `cancelButtonProps` - Additional Button props forwarded to the cancel button
|
|
175
|
+
- `handleClose` (required) - Called when the dialog is dismissed
|
|
176
|
+
- `handleConfirm` (required) - Called when the user clicks the confirm button
|
|
177
|
+
- `handleCancel` (required) - Called when the user clicks the cancel button
|
|
178
|
+
|
|
179
|
+
### DrawerTransition
|
|
167
180
|
|
|
168
|
-
|
|
181
|
+
An animated drawer that expands and collapses content with a height transition.
|
|
169
182
|
|
|
170
183
|
```tsx
|
|
171
|
-
|
|
184
|
+
<DrawerTransition open={isOpen}>
|
|
185
|
+
<p>Collapsible content here</p>
|
|
186
|
+
</DrawerTransition>
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
**Props:**
|
|
190
|
+
- `open` (required) - Whether the drawer is open
|
|
191
|
+
- `duration` (default: 250) - Transition duration in milliseconds
|
|
192
|
+
- `afterEnter` - Callback fired after the enter transition completes
|
|
193
|
+
- `afterExit` - Callback fired after the exit transition completes
|
|
194
|
+
- `deps` - Changes in dependencies trigger re-calculation of the drawer dimensions
|
|
195
|
+
- Extends `HTMLAttributes<HTMLDivElement>`
|
|
196
|
+
|
|
197
|
+
### Input
|
|
172
198
|
|
|
173
|
-
|
|
199
|
+
A simple input component. Set `icon` prop to show an icon on the right side of the input.
|
|
200
|
+
|
|
201
|
+
```tsx
|
|
202
|
+
<Input placeholder="Enter text" onChange={handleChange} />
|
|
174
203
|
```
|
|
175
204
|
|
|
205
|
+
**Props:**
|
|
206
|
+
- `type` - HTML input type (excludes button, checkbox, radio, number)
|
|
207
|
+
- `icon` - Icon component displayed on the right side of the input
|
|
208
|
+
- `wrapperProps` - Props forwarded to the wrapping `div` element
|
|
209
|
+
- Extends standard HTML input attributes
|
|
210
|
+
|
|
176
211
|
### LinkButton
|
|
177
212
|
|
|
178
|
-
A text link with arrow icon for navigation actions.
|
|
213
|
+
A text link with arrow icon for navigation actions. Leave `href` and `onClick` undefined to disable the button.
|
|
179
214
|
|
|
180
215
|
```tsx
|
|
181
|
-
import { LinkButton } from "@k8slens/lds";
|
|
182
|
-
|
|
183
216
|
<LinkButton label="Learn more" href="/docs" />
|
|
184
217
|
```
|
|
185
218
|
|
|
219
|
+
**Props:**
|
|
220
|
+
- `label` (required) - Text label displayed in the link button
|
|
221
|
+
- `size` (default: "md") - "sm" or "md"
|
|
222
|
+
- `textTransform` - "uppercase" or "capitalize"
|
|
223
|
+
- `href` - Navigation URL. Omit to disable the button
|
|
224
|
+
- `onClick` - Click handler. Omit to disable the button
|
|
225
|
+
|
|
186
226
|
### LoadingIndicator
|
|
187
227
|
|
|
188
|
-
|
|
228
|
+
Animated spinner for loading states. Wraps a SpinnerIcon with configurable size.
|
|
189
229
|
|
|
190
230
|
```tsx
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
<LoadingIndicator size="xl" />
|
|
231
|
+
<LoadingIndicator size="md" />
|
|
194
232
|
```
|
|
195
233
|
|
|
234
|
+
**Props:**
|
|
235
|
+
- `size` (default: "md") - Icon size, see SVGIcon for available values
|
|
236
|
+
- `className` - Optional class name
|
|
237
|
+
|
|
196
238
|
### Lozenge
|
|
197
239
|
|
|
198
240
|
A pill-shaped label for status or category display.
|
|
199
241
|
|
|
200
242
|
```tsx
|
|
201
|
-
import { Lozenge } from "@k8slens/lds";
|
|
202
|
-
|
|
203
243
|
<Lozenge type="success">Active</Lozenge>
|
|
204
244
|
```
|
|
205
245
|
|
|
246
|
+
**Props:**
|
|
247
|
+
- `type` (default: "secondary") - "primary", "secondary", "success", "error", or "warning"
|
|
248
|
+
- `size` (default: "sm") - "sm", "md", or "lg"
|
|
249
|
+
- `textTransform` - "uppercase" or "capitalize"
|
|
250
|
+
|
|
206
251
|
### Modal
|
|
207
252
|
|
|
208
|
-
|
|
253
|
+
Responsive modal dialog extending Panel with header, footer, and size options.
|
|
209
254
|
|
|
210
255
|
```tsx
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
<Modal isOpen={isOpen} onClose={close} title="Title" footer={<Button label="Close" />}>
|
|
214
|
-
Content
|
|
256
|
+
<Modal isOpen={open} onClose={close} title="Confirm" size="sm">
|
|
257
|
+
<p>Are you sure?</p>
|
|
215
258
|
</Modal>
|
|
216
259
|
```
|
|
217
260
|
|
|
261
|
+
**Props:**
|
|
262
|
+
- `title` (required) - Title displayed in the modal header
|
|
263
|
+
- `subTitle` - Optional subtitle displayed below the title
|
|
264
|
+
- `isOpen` (required) - Whether the modal is currently open
|
|
265
|
+
- `onClose` (required) - Called when the modal is dismissed (overlay click or escape key)
|
|
266
|
+
- `size` (default: "md") - "sm", "md", "lg", or "xl"
|
|
267
|
+
- `footer` - Content rendered in the modal footer, wrapped by ButtonBar
|
|
268
|
+
- `contentComponent` - Element type or component used as the content wrapper (passed to Panel)
|
|
269
|
+
- `contentProps` - Props forwarded to the content wrapper component
|
|
270
|
+
- `buttonBarProps` (default: {}) - Props forwarded to the footer ButtonBar component
|
|
271
|
+
- `className` (default: "") - Additional class name for the modal Panel
|
|
272
|
+
|
|
218
273
|
### Notification
|
|
219
274
|
|
|
220
|
-
Alert banner for user feedback. `type
|
|
275
|
+
Alert banner for user feedback. Set `type` to control behavior: `flash` auto-dismisses, `closable` shows close button.
|
|
221
276
|
|
|
222
277
|
```tsx
|
|
223
|
-
import { Notification } from "@k8slens/lds";
|
|
224
|
-
|
|
225
278
|
<Notification level="success" message="Saved successfully" />
|
|
226
279
|
```
|
|
227
280
|
|
|
281
|
+
**Props:**
|
|
282
|
+
- `message` (required) - The notification body content (string or ReactNode)
|
|
283
|
+
- `title` - Optional bold heading rendered above the message
|
|
284
|
+
- `type` (default: "default") - "flash", "closable", "inline", or "default"
|
|
285
|
+
- `level` (default: "info") - "info", "success", "error", or "warning"
|
|
286
|
+
- `flashDuration` (default: 5000) - Hide after this many milliseconds if type is "flash"
|
|
287
|
+
- `onClose` - Called after the notification finishes its exit transition
|
|
288
|
+
- `className` - Additional class name for the notification wrapper
|
|
289
|
+
|
|
228
290
|
### NumberBadge
|
|
229
291
|
|
|
230
|
-
A numeric badge that formats large numbers (1500 → "1.5k").
|
|
292
|
+
A numeric badge that formats large numbers (1500 → "1.5k"). Returns null if value is 0 unless `showZero` is set.
|
|
231
293
|
|
|
232
294
|
```tsx
|
|
233
|
-
import { NumberBadge } from "@k8slens/lds";
|
|
234
|
-
|
|
235
295
|
<NumberBadge value={42} title="Items" />
|
|
236
296
|
```
|
|
237
297
|
|
|
298
|
+
**Props:**
|
|
299
|
+
- `value` (required) - Numeric value to display
|
|
300
|
+
- `title` - Accessible title. If not provided, the badge is hidden from screen readers
|
|
301
|
+
- `showZero` - Show badge even if value is zero
|
|
302
|
+
- `displayPlusSign` (default: false) - Show a plus sign for positive values
|
|
303
|
+
- `type` - Color type, inherited from Lozenge: "primary", "secondary", "success", "error", or "warning"
|
|
304
|
+
|
|
238
305
|
### Panel
|
|
239
306
|
|
|
240
|
-
|
|
307
|
+
Composable panel with configurable header, content, and footer sections.
|
|
241
308
|
|
|
242
309
|
```tsx
|
|
243
|
-
import { Panel } from "@k8slens/lds";
|
|
244
|
-
|
|
245
310
|
<Panel header={<h2>Title</h2>} loading={isLoading}>Content</Panel>
|
|
246
311
|
```
|
|
247
312
|
|
|
313
|
+
**Props:**
|
|
314
|
+
- `header` - Content rendered in the header section
|
|
315
|
+
- `footer` - Content rendered in the footer section
|
|
316
|
+
- `loading` (default: false) - Whether to show a loading indicator overlay
|
|
317
|
+
- `className` - Optional class name applied to header, content, and footer elements
|
|
318
|
+
- `wrapperComponent` (default: Fragment) - Component used to wrap the entire panel
|
|
319
|
+
- `wrapperProps` - Props forwarded to the wrapper component
|
|
320
|
+
- `headerComponent` (default: "header") - Component used for the header section
|
|
321
|
+
- `headerProps` - Props forwarded to the header component
|
|
322
|
+
- `contentComponent` (default: "div") - Component used for the content section
|
|
323
|
+
- `contentProps` - Props forwarded to the content component
|
|
324
|
+
- `footerComponent` (default: "footer") - Component used for the footer section
|
|
325
|
+
- `footerProps` - Props forwarded to the footer component
|
|
326
|
+
|
|
248
327
|
### ProfileBlock
|
|
249
328
|
|
|
250
|
-
Displays user info with avatar, title, and subtitle.
|
|
329
|
+
Displays user info with avatar, title, and subtitle. Supports loading state.
|
|
251
330
|
|
|
252
331
|
```tsx
|
|
253
|
-
import { ProfileBlock } from "@k8slens/lds";
|
|
254
|
-
|
|
255
332
|
<ProfileBlock item={{ title: "@user", subtitle: "Name", avatarTitle: "Name" }} />
|
|
256
333
|
```
|
|
257
334
|
|
|
335
|
+
**Props:**
|
|
336
|
+
- `item` (required) - User data to display: `{ title, subtitle, avatarTitle, avatar? }`
|
|
337
|
+
- `loading` (default: false) - Whether to show a loading indicator instead of text content
|
|
338
|
+
- `formatTitle` - Custom formatter for the title text, receives `item` and returns string or ReactElement
|
|
339
|
+
- `formatSubtitle` - Custom formatter for the subtitle text, receives `item` and returns string or ReactElement
|
|
340
|
+
|
|
258
341
|
### ProgressBar
|
|
259
342
|
|
|
260
343
|
A progress bar with semantic color types. Value can be 0-1 or use custom `max`.
|
|
261
344
|
|
|
262
345
|
```tsx
|
|
263
|
-
import { ProgressBar } from "@k8slens/lds";
|
|
264
|
-
|
|
265
346
|
<ProgressBar value={0.75} type="ok" />
|
|
266
347
|
```
|
|
267
348
|
|
|
349
|
+
**Props:**
|
|
350
|
+
- `value` (required) - Current progress value
|
|
351
|
+
- `max` (default: 1) - Maximum value for the progress bar
|
|
352
|
+
- `type` (default: "default") - "default", "ok", "caution", or "danger"
|
|
353
|
+
- `title` - Accessible title text. Falls back to percentage display if not provided
|
|
354
|
+
|
|
268
355
|
### RadioCard
|
|
269
356
|
|
|
270
|
-
|
|
357
|
+
A card-based radio group for visual option selection. Renders each option as a styled card with a radio indicator.
|
|
271
358
|
|
|
272
359
|
```tsx
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
360
|
+
<RadioCard
|
|
361
|
+
name="plan"
|
|
362
|
+
options={[{ id: "1", label: "Free" }, { id: "2", label: "Pro" }]}
|
|
363
|
+
value={selected}
|
|
364
|
+
onChange={setSelected}
|
|
365
|
+
/>
|
|
276
366
|
```
|
|
277
367
|
|
|
368
|
+
**Props:**
|
|
369
|
+
- `name` (required) - Name attribute for the radio group
|
|
370
|
+
- `options` (required) - Array of options to render as radio cards
|
|
371
|
+
- `value` (required) - Currently selected option
|
|
372
|
+
- `onChange` (required) - Change handler receiving the selected option
|
|
373
|
+
- `renderItem` - Function to render the content of each card item (receives option and state)
|
|
374
|
+
- `invalid` (default: false) - Whether the radio group is in an invalid state
|
|
375
|
+
- `disabled` (default: false) - Whether the entire radio group is disabled
|
|
376
|
+
- `id` - HTML `id` attribute for the radio group
|
|
377
|
+
- `aria-label` - Accessible label for the radio group
|
|
378
|
+
- `className` - Optional class name for the radio group container
|
|
379
|
+
- `itemClassName` - Optional class name applied to each radio card item
|
|
380
|
+
|
|
278
381
|
### Select
|
|
279
382
|
|
|
280
|
-
A dropdown select
|
|
383
|
+
A dropdown select with single and multi-value modes, grouped options, custom renderers, and keyboard navigation.
|
|
281
384
|
|
|
282
385
|
```tsx
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
386
|
+
<Select
|
|
387
|
+
options={[{ id: "1", label: "Option 1" }]}
|
|
388
|
+
value={selected}
|
|
389
|
+
onChange={setSelected}
|
|
390
|
+
/>
|
|
286
391
|
```
|
|
287
392
|
|
|
393
|
+
**Props:**
|
|
394
|
+
- `options` (required) - List of selectable options or option groups (`Group<T>` for grouped options)
|
|
395
|
+
- `value` (required) - Currently selected value(s)
|
|
396
|
+
- `onChange` (required) - Called when the selected value(s) change
|
|
397
|
+
- `multiple` - Set to `true` for multi selection (changes value type to array)
|
|
398
|
+
- `placeholder` (default: "") - Placeholder text shown when no value is selected
|
|
399
|
+
- `renderContent` - Function to render the content of the select element (receives option, state, placeholder)
|
|
400
|
+
- `loading` (default: false) - Loading state of the select element
|
|
401
|
+
- `openingDirection` (default: "auto") - "above", "below", or "auto"
|
|
402
|
+
- `size` (default: "md") - "md" or "lg"
|
|
403
|
+
- `maxHeight` - Maximum height of the dropdown in pixels
|
|
404
|
+
- `disabled` - Whether the select element is disabled
|
|
405
|
+
- `invalid` - Whether the select element is in an invalid state
|
|
406
|
+
- `id` - HTML `id` for the select button
|
|
407
|
+
- `aria-label` - Accessible label for the select element
|
|
408
|
+
- `name` - HTML `name` attribute passed to the underlying Listbox
|
|
409
|
+
- `title` - Tooltip of the select element
|
|
410
|
+
- `className` - Additional class name for the select wrapper
|
|
411
|
+
- `dropdownClassName` - Class name passed to `<Listbox.Options />`
|
|
412
|
+
- `itemClassName` - Class name passed to `<Listbox.Option />` (can be a function receiving state)
|
|
413
|
+
- `multiOptionClassName` - Additional class name for multi-option pills (multi-select only)
|
|
414
|
+
- `buttonRef` - Ref forwarded to the select button element
|
|
415
|
+
|
|
288
416
|
### SideNav
|
|
289
417
|
|
|
290
|
-
Side navigation container. Use with
|
|
418
|
+
Side navigation container. Use `SideNavGroup` with `SideNavItem` as direct children.
|
|
291
419
|
|
|
292
420
|
```tsx
|
|
293
|
-
import { SideNav, SideNavGroup, SideNavItem } from "@k8slens/lds";
|
|
294
|
-
|
|
295
421
|
<SideNav>
|
|
296
|
-
<SideNavGroup label="
|
|
297
|
-
<SideNavItem
|
|
422
|
+
<SideNavGroup label="Settings">
|
|
423
|
+
<SideNavItem active>General</SideNavItem>
|
|
298
424
|
</SideNavGroup>
|
|
299
425
|
</SideNav>
|
|
300
426
|
```
|
|
301
427
|
|
|
428
|
+
**SideNavGroup Props:**
|
|
429
|
+
- `label` - Group label text (provide either `label` or `aria-label`)
|
|
430
|
+
- `aria-label` - Accessible label when no visible label is needed
|
|
431
|
+
- `component` (default: "nav") - Component to render as the container
|
|
432
|
+
- `componentProps` - Props forwarded to the container component
|
|
433
|
+
- `id` - HTML `id` attribute
|
|
434
|
+
|
|
435
|
+
**SideNavItem Props:**
|
|
436
|
+
- `component` (default: "a") - Component to render as the item (e.g. `Link` from react-router)
|
|
437
|
+
- `componentProps` - Props forwarded to the item component
|
|
438
|
+
- `active` (default: false) - Whether the item is currently active (sets `aria-current="page"`)
|
|
439
|
+
- `disabled` (default: false) - Whether the item is disabled
|
|
440
|
+
- `type` (default: "default") - "default" or "danger"
|
|
441
|
+
- `externalLink` (default: false) - Renders a visual indication of an external link
|
|
442
|
+
|
|
302
443
|
### Switch
|
|
303
444
|
|
|
304
445
|
A toggle switch input with label support.
|
|
305
446
|
|
|
306
447
|
```tsx
|
|
307
|
-
import { Switch } from "@k8slens/lds";
|
|
308
|
-
|
|
309
448
|
<Switch checked={enabled} onChange={setEnabled}>Enable feature</Switch>
|
|
310
449
|
```
|
|
311
450
|
|
|
451
|
+
**Props:**
|
|
452
|
+
- `checked` - Whether the switch is checked
|
|
453
|
+
- `onChange` - Change handler receiving `(checked: boolean, event: ChangeEvent<HTMLInputElement>)`
|
|
454
|
+
- `disabled` - Whether the switch is disabled
|
|
455
|
+
- Extends `HTMLProps<HTMLInputElement>` (minus `onChange`)
|
|
456
|
+
|
|
312
457
|
### Textarea
|
|
313
458
|
|
|
314
459
|
A multi-line text input with optional auto-resize and character counter. Mirrors the Input component API.
|
|
315
460
|
|
|
316
461
|
```tsx
|
|
317
|
-
import { Textarea } from "@k8slens/lds";
|
|
318
|
-
|
|
319
462
|
<Textarea maxLength={500} autoResize placeholder="Write something..." />
|
|
320
463
|
```
|
|
321
464
|
|
|
@@ -333,9 +476,7 @@ Uses `forwardRef` for direct textarea access.
|
|
|
333
476
|
A composable data table with responsive layout, sorting indicators, and row states. Uses dot notation API for sub-components.
|
|
334
477
|
|
|
335
478
|
```tsx
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
<Table responsive bordered={false}>
|
|
479
|
+
<Table responsive>
|
|
339
480
|
<Table.Caption visibility="sr-only">User data</Table.Caption>
|
|
340
481
|
<Table.Head>
|
|
341
482
|
<Table.Row>
|
|
@@ -343,8 +484,8 @@ import { Table } from "@k8slens/lds";
|
|
|
343
484
|
<Table.HeaderCell align="end">Count</Table.HeaderCell>
|
|
344
485
|
</Table.Row>
|
|
345
486
|
</Table.Head>
|
|
346
|
-
<Table.Body
|
|
347
|
-
<Table.Row
|
|
487
|
+
<Table.Body>
|
|
488
|
+
<Table.Row>
|
|
348
489
|
<Table.Cell primary responsiveHeader="Name">John</Table.Cell>
|
|
349
490
|
<Table.Cell align="end" textStyle="accent">42</Table.Cell>
|
|
350
491
|
</Table.Row>
|
|
@@ -368,8 +509,8 @@ import { Table } from "@k8slens/lds";
|
|
|
368
509
|
|
|
369
510
|
**TableHeaderCell Props:**
|
|
370
511
|
- `align` - "start", "center", or "end"
|
|
371
|
-
- `sortable` (default: false) -
|
|
372
|
-
- `sorted` (default: false) - "asc", "desc", or false.
|
|
512
|
+
- `sortable` (default: false) - Whether the column is sortable
|
|
513
|
+
- `sorted` (default: false) - "asc", "desc", or false. Current sort direction or false if unsorted
|
|
373
514
|
|
|
374
515
|
**TableCell Props:**
|
|
375
516
|
- `primary` (default: false) - Renders as `<th scope="row">`
|
|
@@ -383,24 +524,43 @@ import { Table } from "@k8slens/lds";
|
|
|
383
524
|
|
|
384
525
|
### Tooltip
|
|
385
526
|
|
|
386
|
-
Shows contextual information on hover/focus.
|
|
527
|
+
Shows contextual information on hover/focus. Wrap any element to add a tooltip.
|
|
387
528
|
|
|
388
529
|
```tsx
|
|
389
|
-
import { Tooltip } from "@k8slens/lds";
|
|
390
|
-
|
|
391
530
|
<Tooltip text="Helpful info"><span>Hover me</span></Tooltip>
|
|
392
531
|
```
|
|
393
532
|
|
|
533
|
+
**Props:**
|
|
534
|
+
- `text` - Content displayed inside the tooltip popup (string or ReactElement)
|
|
535
|
+
- `placement` (default: "auto") - Popper placement of the tooltip popup
|
|
536
|
+
- `wrapper` (default: "span") - "span" or "div" wrapper element type around the children
|
|
537
|
+
- `alwaysVisible` (default: false) - Whether the tooltip is always visible (ignores hover/focus)
|
|
538
|
+
- `mutationsListenerElement` (default: document.body) - Element to listen for DOM mutations on to reposition
|
|
539
|
+
- `popupClassName` - Additional class name for the tooltip popup element
|
|
540
|
+
- `id` - HTML `id` attribute for the wrapper element
|
|
541
|
+
|
|
394
542
|
### UserMenu
|
|
395
543
|
|
|
396
544
|
Displays user info with dropdown menu for account actions. Uses default menu items if `items` prop is not provided.
|
|
397
545
|
|
|
398
546
|
```tsx
|
|
399
|
-
import { UserMenu } from "@k8slens/lds";
|
|
400
|
-
|
|
401
547
|
<UserMenu user={{ name: "John", username: "john" }} onLogoutClick={logout} />
|
|
402
548
|
```
|
|
403
549
|
|
|
550
|
+
**Props (default items variant):**
|
|
551
|
+
- `user` (required) - `{ name, username, avatar? }` - User information to display
|
|
552
|
+
- `onLogoutClick` (required) - Callback when the user clicks the Logout button
|
|
553
|
+
- `header` - Optional header content to display in the dropdown
|
|
554
|
+
- `footer` - Optional footer content to display in the dropdown
|
|
555
|
+
- `origin` (default: "https://app.k8slens.dev") - Origin for default menu item hrefs
|
|
556
|
+
- `className` - Optional class name for the trigger button
|
|
557
|
+
- `buttonRef` - Ref forwarded to the trigger button element
|
|
558
|
+
- `loading` (default: false) - Loading state of the User Menu
|
|
559
|
+
|
|
560
|
+
**Props (custom items variant):**
|
|
561
|
+
- `items` (required) - Array of `MenuItemGroup` for custom menu items
|
|
562
|
+
- `onLogoutClick` - Optional callback mapped to item with key "logout"
|
|
563
|
+
|
|
404
564
|
## Theming
|
|
405
565
|
|
|
406
566
|
Components are styled using CSS modules with CSS custom properties from @k8slens/lds-tokens. Import the tokens CSS to enable theming:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@k8slens/lds",
|
|
3
|
-
"version": "0.58.
|
|
3
|
+
"version": "0.58.4",
|
|
4
4
|
"description": "Lens Design System – Core React Component Library",
|
|
5
5
|
"author": "Mirantis Inc",
|
|
6
6
|
"license": "MIT",
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
"format": "oxlint --fix . && prettier --write ."
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@k8slens/lds-tokens": "^0.59.
|
|
33
|
-
"@storybook/react": "
|
|
32
|
+
"@k8slens/lds-tokens": "^0.59.4",
|
|
33
|
+
"@storybook/react": "10.2.15",
|
|
34
34
|
"@testing-library/react": "14.0.0",
|
|
35
35
|
"@types/randomcolor": "0.5.9",
|
|
36
36
|
"@types/rollup-plugin-delete": "1.0.0",
|
|
@@ -64,5 +64,5 @@
|
|
|
64
64
|
"\\.svg": "<rootDir>/../../__mocks__/SVGStub.js"
|
|
65
65
|
}
|
|
66
66
|
},
|
|
67
|
-
"gitHead": "
|
|
67
|
+
"gitHead": "4d79cf509073c250bbc49794d459230e41de28e6"
|
|
68
68
|
}
|