@grafana/plugin-ui 0.2.0 → 0.2.1

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.
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Copy & paste from https://github.com/grafana/grafana/blob/main/packages/grafana-ui/src/components/SecretInput/SecretInput.tsx
3
+ * Available starting from @grafana/ui 9.2
4
+ */
5
+ import * as React from "react";
6
+ import { Input } from "@grafana/ui";
7
+ export declare type Props = React.ComponentProps<typeof Input> & {
8
+ /** TRUE if the secret was already configured. (It is needed as often the backend doesn't send back the actual secret, only the information that it was configured) */
9
+ isConfigured: boolean;
10
+ /** Called when the user clicks on the "Reset" button in order to clear the secret */
11
+ onReset: () => void;
12
+ };
13
+ export declare const CONFIGURED_TEXT = "configured";
14
+ export declare const RESET_BUTTON_TEXT = "Reset";
15
+ export declare const SecretInput: ({ isConfigured, onReset, ...props }: Props) => JSX.Element;
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Copy & paste from https://github.com/grafana/grafana/blob/main/packages/grafana-ui/src/components/SecretTextArea/SecretTextArea.tsx
3
+ * Available starting from @grafana/ui 9.2
4
+ */
5
+ import * as React from "react";
6
+ import { TextArea } from "@grafana/ui";
7
+ export declare type Props = React.ComponentProps<typeof TextArea> & {
8
+ /** TRUE if the secret was already configured. (It is needed as often the backend doesn't send back the actual secret, only the information that it was configured) */
9
+ isConfigured: boolean;
10
+ /** Called when the user clicks on the "Reset" button in order to clear the secret */
11
+ onReset: () => void;
12
+ };
13
+ export declare const CONFIGURED_TEXT = "configured";
14
+ export declare const RESET_BUTTON_TEXT = "Reset";
15
+ /**
16
+ * Text area that does not disclose an already configured value but lets the user reset the current value and enter a new one.
17
+ * Typically useful for asymmetric cryptography keys.
18
+ */
19
+ export declare const SecretTextArea: ({ isConfigured, onReset, ...props }: Props) => JSX.Element;
@@ -1 +1,2 @@
1
- export {};
1
+ export { SecretInput } from "./SecretInput";
2
+ export { SecretTextArea } from "./SecretTextarea";
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ /**
3
+ * Copy & paste from https://github.com/grafana/grafana/blob/main/packages/grafana-ui/src/components/SecretInput/SecretInput.tsx
4
+ * Available starting from @grafana/ui 9.2
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.SecretInput = exports.RESET_BUTTON_TEXT = exports.CONFIGURED_TEXT = void 0;
8
+ const tslib_1 = require("tslib");
9
+ const React = tslib_1.__importStar(require("react"));
10
+ const ui_1 = require("@grafana/ui");
11
+ exports.CONFIGURED_TEXT = "configured";
12
+ exports.RESET_BUTTON_TEXT = "Reset";
13
+ const SecretInput = (_a) => {
14
+ var { isConfigured, onReset } = _a, props = tslib_1.__rest(_a, ["isConfigured", "onReset"]);
15
+ return (React.createElement(ui_1.HorizontalGroup, null,
16
+ !isConfigured && React.createElement(ui_1.Input, Object.assign({}, props, { type: "password" })),
17
+ isConfigured && (React.createElement(ui_1.Input, Object.assign({}, props, { type: "text", disabled: true, value: exports.CONFIGURED_TEXT }))),
18
+ isConfigured && (React.createElement(ui_1.Button, { onClick: onReset, variant: "secondary" }, exports.RESET_BUTTON_TEXT))));
19
+ };
20
+ exports.SecretInput = SecretInput;
21
+ //# sourceMappingURL=SecretInput.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SecretInput.js","sourceRoot":"","sources":["../../src/unreleasedComponents/SecretInput.tsx"],"names":[],"mappings":";AAAA;;;GAGG;;;;AAEH,qDAA+B;AAC/B,oCAA6D;AAShD,QAAA,eAAe,GAAG,YAAY,CAAC;AAC/B,QAAA,iBAAiB,GAAG,OAAO,CAAC;AAElC,MAAM,WAAW,GAAG,CAAC,EAA0C,EAAE,EAAE;QAA9C,EAAE,YAAY,EAAE,OAAO,OAAmB,EAAd,KAAK,sBAAjC,2BAAmC,CAAF;IAAc,OAAA,CACzE,oBAAC,oBAAe;QACb,CAAC,YAAY,IAAI,oBAAC,UAAK,oBAAK,KAAK,IAAE,IAAI,EAAC,UAAU,IAAG;QACrD,YAAY,IAAI,CACf,oBAAC,UAAK,oBAAK,KAAK,IAAE,IAAI,EAAC,MAAM,EAAC,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,uBAAe,IAAI,CACzE;QACA,YAAY,IAAI,CACf,oBAAC,WAAM,IAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAC,WAAW,IAC1C,yBAAiB,CACX,CACV,CACe,CACnB,CAAA;CAAA,CAAC;AAZW,QAAA,WAAW,eAYtB"}
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ /**
3
+ * Copy & paste from https://github.com/grafana/grafana/blob/main/packages/grafana-ui/src/components/SecretTextArea/SecretTextArea.tsx
4
+ * Available starting from @grafana/ui 9.2
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.SecretTextArea = exports.RESET_BUTTON_TEXT = exports.CONFIGURED_TEXT = void 0;
8
+ const tslib_1 = require("tslib");
9
+ const css_1 = require("@emotion/css");
10
+ const React = tslib_1.__importStar(require("react"));
11
+ const ui_1 = require("@grafana/ui");
12
+ exports.CONFIGURED_TEXT = "configured";
13
+ exports.RESET_BUTTON_TEXT = "Reset";
14
+ const getStyles = (theme) => {
15
+ return {
16
+ configuredStyle: (0, css_1.css) `
17
+ min-height: ${theme.spacing(theme.components.height.md)};
18
+ padding-top: ${theme.spacing(0.5) /** Needed to mimic vertically centered text in an input box */};
19
+ resize: none;
20
+ `,
21
+ };
22
+ };
23
+ /**
24
+ * Text area that does not disclose an already configured value but lets the user reset the current value and enter a new one.
25
+ * Typically useful for asymmetric cryptography keys.
26
+ */
27
+ const SecretTextArea = (_a) => {
28
+ var { isConfigured, onReset } = _a, props = tslib_1.__rest(_a, ["isConfigured", "onReset"]);
29
+ const styles = (0, ui_1.useStyles2)(getStyles);
30
+ return (React.createElement(ui_1.HorizontalGroup, null,
31
+ !isConfigured && React.createElement(ui_1.TextArea, Object.assign({}, props)),
32
+ isConfigured && (React.createElement(ui_1.TextArea, Object.assign({}, props, { rows: 1, disabled: true, value: exports.CONFIGURED_TEXT, className: (0, css_1.cx)(styles.configuredStyle) }))),
33
+ isConfigured && (React.createElement(ui_1.Button, { onClick: onReset, variant: "secondary" }, exports.RESET_BUTTON_TEXT))));
34
+ };
35
+ exports.SecretTextArea = SecretTextArea;
36
+ //# sourceMappingURL=SecretTextarea.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SecretTextarea.js","sourceRoot":"","sources":["../../src/unreleasedComponents/SecretTextarea.tsx"],"names":[],"mappings":";AAAA;;;GAGG;;;;AAEH,sCAAuC;AACvC,qDAA+B;AAG/B,oCAA4E;AAS/D,QAAA,eAAe,GAAG,YAAY,CAAC;AAC/B,QAAA,iBAAiB,GAAG,OAAO,CAAC;AAEzC,MAAM,SAAS,GAAG,CAAC,KAAoB,EAAE,EAAE;IACzC,OAAO;QACL,eAAe,EAAE,IAAA,SAAG,EAAA;oBACJ,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC;qBAErD,KAAK,CAAC,OAAO,CACX,GAAG,CACJ,CAAC,+DACJ;;KAED;KACF,CAAC;AACJ,CAAC,CAAC;AAEF;;;GAGG;AACI,MAAM,cAAc,GAAG,CAAC,EAA0C,EAAE,EAAE;QAA9C,EAAE,YAAY,EAAE,OAAO,OAAmB,EAAd,KAAK,sBAAjC,2BAAmC,CAAF;IAC9D,MAAM,MAAM,GAAG,IAAA,eAAU,EAAC,SAAS,CAAC,CAAC;IACrC,OAAO,CACL,oBAAC,oBAAe;QACb,CAAC,YAAY,IAAI,oBAAC,aAAQ,oBAAK,KAAK,EAAI;QACxC,YAAY,IAAI,CACf,oBAAC,aAAQ,oBACH,KAAK,IACT,IAAI,EAAE,CAAC,EACP,QAAQ,EAAE,IAAI,EACd,KAAK,EAAE,uBAAe,EACtB,SAAS,EAAE,IAAA,QAAE,EAAC,MAAM,CAAC,eAAe,CAAC,IACrC,CACH;QACA,YAAY,IAAI,CACf,oBAAC,WAAM,IAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAC,WAAW,IAC1C,yBAAiB,CACX,CACV,CACe,CACnB,CAAC;AACJ,CAAC,CAAC;AArBW,QAAA,cAAc,kBAqBzB"}
@@ -1,3 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SecretTextArea = exports.SecretInput = void 0;
4
+ // noop for when there are no components here
5
+ var SecretInput_1 = require("./SecretInput");
6
+ Object.defineProperty(exports, "SecretInput", { enumerable: true, get: function () { return SecretInput_1.SecretInput; } });
7
+ var SecretTextarea_1 = require("./SecretTextarea");
8
+ Object.defineProperty(exports, "SecretTextArea", { enumerable: true, get: function () { return SecretTextarea_1.SecretTextArea; } });
3
9
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/unreleasedComponents/index.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/unreleasedComponents/index.ts"],"names":[],"mappings":";;;AAAA,6CAA6C;AAC7C,6CAA4C;AAAnC,0GAAA,WAAW,OAAA;AACpB,mDAAkD;AAAzC,gHAAA,cAAc,OAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@grafana/plugin-ui",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "repository": "git@github.com:grafana/plugin-ui.git",
5
5
  "author": "Grafana Labs",
6
6
  "main": "dist/index.js",