@grafana/components 0.0.43 → 0.0.44

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  # Grafana Product Design Engineering Components
2
2
 
3
- ## Usage
3
+ ## Installation
4
4
 
5
5
  Add `@grafana/components` to your project’s dependencies:
6
6
 
@@ -14,26 +14,45 @@ or
14
14
  $ yarn add @grafana/components
15
15
  ```
16
16
 
17
- For components that have elements based on Floating UI, you must ensure you wrap
18
- your application in a `<PortalProvider>` component at a sufficient root level,
19
- passing in the `defaultRoot` prop indicating the element floating elements
20
- should be portalled inside of:
17
+ To ensure that the necessary providers are present, you should add the following
18
+ to your `App.tsx` (or equivalent):
21
19
 
22
20
  ```tsx
23
- import { PortalProvider } from '@grafana/components';
21
+ import { getAppEvents } from '@grafana/runtime';
22
+ import { useTheme2 } from '@grafana/ui';
23
+ import { PortalProvider, ColorMode } from '@grafana/components';
24
24
 
25
- const MyApp = () => {
25
+ const App = () => {
26
26
  return (
27
- <>
28
- <PortalProvider defaultRoot={document.getElementById('grafana-portal-container')}>
29
- ...
30
- </PortalProvider>
31
- </>
27
+ <PortalProvider defaultRoot="grafana-portal-container">
28
+ <ColorMode getAppEvents={getAppEvents} useTheme2={useTheme2}>
29
+ <YourApp />
30
+ </ColorMode>
31
+ </PortalProvider>
32
32
  );
33
33
  };
34
34
  ```
35
35
 
36
- ### Icons
36
+ The dependency on `useTheme2` is necessary (for now) to detect the active _color
37
+ mode_ (light or dark); this dependency will go away in the longer term.
38
+
39
+ Additionally, to ensure that the stylesheet imported by `ColorMode` is correctly
40
+ included in the App bundle, you will need to update your project’s
41
+ `webpack.config.ts` configuration for the `style-loader` loader module:
42
+
43
+ ```diff
44
+ {
45
+ test: /\.css$/,
46
+ use: ['style-loader', 'css-loader'],
47
+ + sideEffects: true,
48
+ },
49
+ ```
50
+
51
+ This is to ensure that including stylesheets with `@import
52
+ 'path/to/stylesheet.css';` works correctly and the stylesheets aren’t
53
+ unintentionally ‘tree-shaken’ out.
54
+
55
+ ### Custom Icons
37
56
 
38
57
  The icons included with `@grafana/components` are based on [Lucide][lucide],
39
58
  which provides over 1,800 consistent icons. In addition, there are a smaller
@@ -4690,7 +4690,7 @@ Dot.fill = "none";
4690
4690
  const DownloadCloud = ({ title = "Download cloud", ...props }) => /* @__PURE__ */ jsxRuntime.jsxs("svg", { viewBox: "0 0 24 24", ...props, children: [
4691
4691
  title && /* @__PURE__ */ jsxRuntime.jsx("title", { children: title }),
4692
4692
  /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M12 13v8l-4-4m4 4 4-4" }),
4693
- /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M4.393 15.269A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.436 8.284" })
4693
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M19.94 16.497a4 4 0 0 0-2.706-7.424 6.499 6.499 0 0 0-12.72-1.41 4.997 4.997 0 0 0-.124 8.599" })
4694
4694
  ] });
4695
4695
  DownloadCloud.fill = "none";
4696
4696
 
@@ -13150,8 +13150,8 @@ Unplug.fill = "none";
13150
13150
 
13151
13151
  const UploadCloud = ({ title = "Upload cloud", ...props }) => /* @__PURE__ */ jsxRuntime.jsxs("svg", { viewBox: "0 0 24 24", ...props, children: [
13152
13152
  title && /* @__PURE__ */ jsxRuntime.jsx("title", { children: title }),
13153
- /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M12 13v8m-8-6.101A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242" }),
13154
- /* @__PURE__ */ jsxRuntime.jsx("path", { d: "m8 17 4-4 4 4" })
13153
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M12 13v8m-4-4 4-4 4 4" }),
13154
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M20 16.463a4 4 0 0 0-2.766-7.39 6.499 6.499 0 0 0-12.72-1.41A4.997 4.997 0 0 0 4 15.997" })
13155
13155
  ] });
13156
13156
  UploadCloud.fill = "none";
13157
13157