@k8slens/lds-tips 0.47.0 → 0.48.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 +44 -20
- package/llms.txt +81 -0
- package/package.json +9 -8
package/README.md
CHANGED
|
@@ -1,14 +1,22 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @k8slens/lds-tips
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
Tips/tour component for the Lens Design System – display contextual hints and guided tours.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @k8slens/lds-tips @k8slens/lds @k8slens/lds-tokens
|
|
9
|
+
```
|
|
5
10
|
|
|
6
|
-
##
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
-
|
|
11
|
+
## Setup
|
|
12
|
+
|
|
13
|
+
```tsx
|
|
14
|
+
import "@k8slens/lds-tokens/lib/electron/font-face.css";
|
|
15
|
+
import "@k8slens/lds/lib/es/index.css";
|
|
16
|
+
import "@k8slens/lds-tips/lib/es/index.css";
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Usage
|
|
12
20
|
|
|
13
21
|
```tsx
|
|
14
22
|
import { Tips } from "@k8slens/lds-tips";
|
|
@@ -29,11 +37,12 @@ export const Component = () => (
|
|
|
29
37
|
## Example using MobX
|
|
30
38
|
|
|
31
39
|
### Tours
|
|
40
|
+
|
|
32
41
|
```tsx
|
|
33
42
|
// tours.ts
|
|
34
43
|
import type { Tour } from "@k8slens/lds-tips/lib/es/Tips/Tips";
|
|
35
44
|
|
|
36
|
-
|
|
45
|
+
const tours: Array<Tour> = [
|
|
37
46
|
{
|
|
38
47
|
id: "tour-1",
|
|
39
48
|
steps: [
|
|
@@ -60,14 +69,17 @@ export default const tours: Array<Tour> = [
|
|
|
60
69
|
),
|
|
61
70
|
},
|
|
62
71
|
],
|
|
63
|
-
}
|
|
64
|
-
]
|
|
72
|
+
},
|
|
73
|
+
];
|
|
74
|
+
|
|
75
|
+
export default tours;
|
|
65
76
|
```
|
|
66
77
|
|
|
67
78
|
### TipStore
|
|
79
|
+
|
|
68
80
|
```ts
|
|
69
81
|
// tips-store.ts
|
|
70
|
-
import { action, makeObservable, observable
|
|
82
|
+
import { action, makeObservable, observable } from "mobx";
|
|
71
83
|
|
|
72
84
|
import type { Tour, TipsProps } from "@k8slens/lds-tips/lib/es/Tips/Tips";
|
|
73
85
|
|
|
@@ -84,13 +96,11 @@ export class TipStore {
|
|
|
84
96
|
@observable
|
|
85
97
|
store: TipStoreModel = {
|
|
86
98
|
skipAll: false,
|
|
87
|
-
activeSteps: {}
|
|
99
|
+
activeSteps: {},
|
|
88
100
|
};
|
|
89
101
|
tours: Array<Tour> = tours;
|
|
90
102
|
|
|
91
103
|
constructor() {
|
|
92
|
-
super();
|
|
93
|
-
|
|
94
104
|
makeObservable(this);
|
|
95
105
|
}
|
|
96
106
|
|
|
@@ -104,11 +114,11 @@ export class TipStore {
|
|
|
104
114
|
let nextStep = 1;
|
|
105
115
|
if (typeof this.store.activeSteps[tourId] === "number") {
|
|
106
116
|
nextStep += this.store.activeSteps[tourId];
|
|
107
|
-
}
|
|
117
|
+
}
|
|
108
118
|
|
|
109
119
|
this.store.activeSteps = {
|
|
110
120
|
...this.store.activeSteps,
|
|
111
|
-
[tourId]: nextStep
|
|
121
|
+
[tourId]: nextStep,
|
|
112
122
|
};
|
|
113
123
|
|
|
114
124
|
return nextStep;
|
|
@@ -121,6 +131,7 @@ export class TipStore {
|
|
|
121
131
|
```
|
|
122
132
|
|
|
123
133
|
### Component
|
|
134
|
+
|
|
124
135
|
```tsx
|
|
125
136
|
// Component.tsx
|
|
126
137
|
import React from "react";
|
|
@@ -135,7 +146,6 @@ interface Props {
|
|
|
135
146
|
}
|
|
136
147
|
|
|
137
148
|
export const Component = observer(({ tipStore }: Props) => {
|
|
138
|
-
|
|
139
149
|
if (!tipStore) {
|
|
140
150
|
return null;
|
|
141
151
|
}
|
|
@@ -150,4 +160,18 @@ export const Component = observer(({ tipStore }: Props) => {
|
|
|
150
160
|
/>
|
|
151
161
|
);
|
|
152
162
|
});
|
|
153
|
-
```
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
## Documentation
|
|
166
|
+
|
|
167
|
+
Browse examples at [lens-design-system.k8slens.dev](https://lens-design-system.k8slens.dev/?path=/docs/tips).
|
|
168
|
+
|
|
169
|
+
## AI Assistance
|
|
170
|
+
|
|
171
|
+
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`):
|
|
172
|
+
|
|
173
|
+
```markdown
|
|
174
|
+
Read node_modules/@k8slens/lds-tips/llms.txt for tips/tours API reference.
|
|
175
|
+
|
|
176
|
+
Use the LDS Tips component instead of custom tooltip implementations.
|
|
177
|
+
```
|
package/llms.txt
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
# @k8slens/lds-tips
|
|
2
|
+
|
|
3
|
+
> Tips component for the Lens Design System - displays contextual hints and guidance.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @k8slens/lds-tips @k8slens/lds-tokens
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
### Peer Dependencies
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npm install react react-dom clsx @popperjs/core react-popper rooks lodash
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Setup
|
|
18
|
+
|
|
19
|
+
Import required styles in your app entry point:
|
|
20
|
+
|
|
21
|
+
```tsx
|
|
22
|
+
import "@k8slens/lds-tokens/lib/electron/font-face.css";
|
|
23
|
+
import "@k8slens/lds/lib/es/index.css";
|
|
24
|
+
import "@k8slens/lds-tips/lib/es/index.css";
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Components
|
|
28
|
+
|
|
29
|
+
### Tips
|
|
30
|
+
|
|
31
|
+
Container component that renders tips for guided tours. Requires a store to track step progress.
|
|
32
|
+
|
|
33
|
+
```tsx
|
|
34
|
+
import { Tips } from "@k8slens/lds-tips";
|
|
35
|
+
import type { Tour } from "@k8slens/lds-tips/lib/es/Tips/Tips";
|
|
36
|
+
|
|
37
|
+
const tours: Tour[] = [{
|
|
38
|
+
id: "tour-1",
|
|
39
|
+
steps: [{
|
|
40
|
+
id: "step-1",
|
|
41
|
+
selector: "#target-element",
|
|
42
|
+
content: <><h3>Welcome</h3><p>Click here to start.</p></>,
|
|
43
|
+
}],
|
|
44
|
+
}];
|
|
45
|
+
|
|
46
|
+
<Tips
|
|
47
|
+
tours={tours}
|
|
48
|
+
setNextStepNumber={(tourId) => /* increment step */}
|
|
49
|
+
getActiveStep={(tourId) => /* return current step */}
|
|
50
|
+
setSkipAll={() => /* mark all skipped */}
|
|
51
|
+
skipped={false}
|
|
52
|
+
/>
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### Tip
|
|
56
|
+
|
|
57
|
+
Low-level tip popup component positioned relative to a target element.
|
|
58
|
+
|
|
59
|
+
```tsx
|
|
60
|
+
import { Tip } from "@k8slens/lds-tips";
|
|
61
|
+
|
|
62
|
+
<Tip
|
|
63
|
+
target={document.getElementById("target")}
|
|
64
|
+
onDoneClick={() => /* advance to next */}
|
|
65
|
+
onSkipAllClick={() => /* skip all tips */}
|
|
66
|
+
>
|
|
67
|
+
Tip content here
|
|
68
|
+
</Tip>
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Dependencies
|
|
72
|
+
|
|
73
|
+
This package depends on `@k8slens/lds` core components.
|
|
74
|
+
|
|
75
|
+
## Documentation
|
|
76
|
+
|
|
77
|
+
- [Lens Design System](https://lens-design-system.k8slens.dev/)
|
|
78
|
+
|
|
79
|
+
## Optional
|
|
80
|
+
|
|
81
|
+
- [npm Package](https://www.npmjs.com/package/@k8slens/lds-tips)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@k8slens/lds-tips",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.48.0",
|
|
4
4
|
"description": "Lens Design System – React Tips component",
|
|
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,15 +25,15 @@
|
|
|
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
|
"dependencies": {
|
|
31
|
-
"@k8slens/lds": "^0.
|
|
32
|
+
"@k8slens/lds": "^0.58.0"
|
|
32
33
|
},
|
|
33
34
|
"devDependencies": {
|
|
34
|
-
"@k8slens/lds-icons": "^0.
|
|
35
|
-
"@k8slens/lds-tokens": "^0.
|
|
35
|
+
"@k8slens/lds-icons": "^0.56.0",
|
|
36
|
+
"@k8slens/lds-tokens": "^0.59.0",
|
|
36
37
|
"@rollup/plugin-node-resolve": "15.0.2",
|
|
37
38
|
"@storybook/react": "6.5.16",
|
|
38
39
|
"@testing-library/react": "14.0.0",
|
|
@@ -59,5 +60,5 @@
|
|
|
59
60
|
"\\.svg": "<rootDir>/../../__mocks__/SVGStub.js"
|
|
60
61
|
}
|
|
61
62
|
},
|
|
62
|
-
"gitHead": "
|
|
63
|
+
"gitHead": "e41693e45edd36a94e34ab286d4ededba24f5daf"
|
|
63
64
|
}
|