@eccenca/gui-elements 24.1.0-rc.1 → 24.1.0-rc.3
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/CHANGELOG.md +11 -5
- package/dist/cjs/components/Label/Label.js +7 -3
- package/dist/cjs/components/Label/Label.js.map +1 -1
- package/dist/cjs/extensions/codemirror/hooks/useCodemirrorModeExtension.hooks.js +17 -8
- package/dist/cjs/extensions/codemirror/hooks/useCodemirrorModeExtension.hooks.js.map +1 -1
- package/dist/esm/components/Label/Label.js +7 -3
- package/dist/esm/components/Label/Label.js.map +1 -1
- package/dist/esm/extensions/codemirror/hooks/useCodemirrorModeExtension.hooks.js +14 -5
- package/dist/esm/extensions/codemirror/hooks/useCodemirrorModeExtension.hooks.js.map +1 -1
- package/dist/types/components/Label/Label.d.ts +5 -1
- package/dist/types/extensions/codemirror/hooks/useCodemirrorModeExtension.hooks.d.ts +5 -3
- package/package.json +5 -2
- package/src/components/Label/Label.stories.tsx +2 -1
- package/src/components/Label/Label.tsx +13 -1
- package/src/extensions/codemirror/hooks/useCodemirrorModeExtension.hooks.ts +15 -5
package/CHANGELOG.md
CHANGED
|
@@ -8,7 +8,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
|
|
|
8
8
|
|
|
9
9
|
### Added
|
|
10
10
|
|
|
11
|
-
- `
|
|
11
|
+
- `ContentGroup` component
|
|
12
12
|
- Manage display of a grouped content section.
|
|
13
13
|
- Add info, actions and context annotations by using its properties.
|
|
14
14
|
- Can be nested into each other.
|
|
@@ -18,16 +18,22 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
|
|
|
18
18
|
- editor is focused on load if `autoFocus` prop is set to `true`
|
|
19
19
|
- implemented support for `disabled` state in code editor
|
|
20
20
|
- implemented support for `intent` states in code editor
|
|
21
|
+
- `<Label />`
|
|
22
|
+
- added `additionalElements` property to display elements at the end of the label
|
|
21
23
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
- `MultiSelect`:
|
|
25
|
-
- Old suggestions might be shown for a very short time when typing in a new search query.
|
|
24
|
+
## [24.0.1] - 2025-02-06
|
|
26
25
|
|
|
27
26
|
### Changed
|
|
28
27
|
|
|
29
28
|
- `eslint` libraries were upgraded to v9, so `node` v18.18 or higher is required
|
|
30
29
|
|
|
30
|
+
### Fixed
|
|
31
|
+
|
|
32
|
+
- `MultiSelect`:
|
|
33
|
+
- Old suggestions might be shown for a very short time when typing in a new search query.
|
|
34
|
+
- `CodeEditor`:
|
|
35
|
+
- Broken highlighting for editor modes that leveraged adapted legacy modes.
|
|
36
|
+
|
|
31
37
|
## [24.0.0] - 2024-12-17
|
|
32
38
|
|
|
33
39
|
This is a major release, and it might be not compatible with your current usage of our library. Please read about the necessary changes in the section about how to migrate.
|
|
@@ -18,9 +18,10 @@ exports.Label = void 0;
|
|
|
18
18
|
const react_1 = __importDefault(require("react"));
|
|
19
19
|
const constants_1 = require("../../configuration/constants");
|
|
20
20
|
const Icon_1 = __importDefault(require("../Icon/Icon"));
|
|
21
|
+
const Spacing_1 = __importDefault(require("../Separation/Spacing"));
|
|
21
22
|
const Tooltip_1 = __importDefault(require("../Tooltip/Tooltip"));
|
|
22
23
|
const Label = (_a) => {
|
|
23
|
-
var { children, className = "", disabled, text, info, tooltip, tooltipProps, isLayoutForElement = "label", emphasis = "normal" } = _a, otherLabelProps = __rest(_a, ["children", "className", "disabled", "text", "info", "tooltip", "tooltipProps", "isLayoutForElement", "emphasis"]);
|
|
24
|
+
var { children, className = "", disabled, text, info, tooltip, tooltipProps, isLayoutForElement = "label", emphasis = "normal", additionalElements } = _a, otherLabelProps = __rest(_a, ["children", "className", "disabled", "text", "info", "tooltip", "tooltipProps", "isLayoutForElement", "emphasis", "additionalElements"]);
|
|
24
25
|
let htmlElementstring = isLayoutForElement;
|
|
25
26
|
htmlElementstring = disabled && htmlElementstring === "label" ? "span" : htmlElementstring;
|
|
26
27
|
const labelContent = (react_1.default.createElement(react_1.default.Fragment, null,
|
|
@@ -29,8 +30,11 @@ const Label = (_a) => {
|
|
|
29
30
|
tooltip && (react_1.default.createElement("span", { className: `${constants_1.CLASSPREFIX}-label__tooltip` },
|
|
30
31
|
react_1.default.createElement(Tooltip_1.default, Object.assign({ content: tooltip, disabled: disabled }, tooltipProps),
|
|
31
32
|
react_1.default.createElement(Icon_1.default, { name: "item-info", small: true })))),
|
|
32
|
-
children && react_1.default.createElement("span", { className: `${constants_1.CLASSPREFIX}-label__other` }, children)
|
|
33
|
-
|
|
33
|
+
children && react_1.default.createElement("span", { className: `${constants_1.CLASSPREFIX}-label__other` }, children),
|
|
34
|
+
additionalElements && (react_1.default.createElement(react_1.default.Fragment, null,
|
|
35
|
+
react_1.default.createElement(Spacing_1.default, { vertical: true, size: "tiny" }),
|
|
36
|
+
additionalElements))));
|
|
37
|
+
return !!text || !!info || !!tooltip || !!children || !!additionalElements ? (react_1.default.createElement(htmlElementstring, Object.assign({ className: `${constants_1.CLASSPREFIX}-label ${constants_1.CLASSPREFIX}-label--${emphasis}` +
|
|
34
38
|
(className ? " " + className : "") +
|
|
35
39
|
(disabled ? ` ${constants_1.CLASSPREFIX}-label--disabled` : "") }, otherLabelProps), labelContent)) : (react_1.default.createElement(react_1.default.Fragment, null));
|
|
36
40
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Label.js","sourceRoot":"","sources":["../../../../src/components/Label/Label.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,kDAA0B;AAE1B,6DAAsE;AACtE,wDAAgC;AAChC,iEAA2D;
|
|
1
|
+
{"version":3,"file":"Label.js","sourceRoot":"","sources":["../../../../src/components/Label/Label.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,kDAA0B;AAE1B,6DAAsE;AACtE,wDAAgC;AAChC,oEAA4C;AAC5C,iEAA2D;AAsCpD,MAAM,KAAK,GAAG,CAAC,EAYT,EAAE,EAAE;QAZK,EAClB,QAAQ,EACR,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,CAAC,GAAG,GAAG,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC;YAClC,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,uBAAM,kBAAkB,CAAC,CAAC,CAAC,EAAE,CAAC,IAC/C,eAAe,GAEtB,YAAY,CACf,CACJ,CAAC,CAAC,CAAC,CACA,6DAAK,CACR,CAAC;AACN,CAAC,CAAC;AApDW,QAAA,KAAK,SAoDhB;AAEF,kBAAe,aAAK,CAAC"}
|
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useCodeMirrorModeExtension = exports.supportedCodeEditorModes = void 0;
|
|
4
|
+
//adapted v6 modes imports
|
|
5
|
+
const lang_javascript_1 = require("@codemirror/lang-javascript");
|
|
4
6
|
const lang_json_1 = require("@codemirror/lang-json");
|
|
5
|
-
//modes imports
|
|
6
7
|
const lang_markdown_1 = require("@codemirror/lang-markdown");
|
|
8
|
+
const lang_sql_1 = require("@codemirror/lang-sql");
|
|
7
9
|
const lang_xml_1 = require("@codemirror/lang-xml");
|
|
10
|
+
const lang_yaml_1 = require("@codemirror/lang-yaml");
|
|
8
11
|
const language_1 = require("@codemirror/language");
|
|
9
|
-
|
|
12
|
+
//legacy mode imports
|
|
10
13
|
const jinja2_1 = require("@codemirror/legacy-modes/mode/jinja2");
|
|
11
14
|
const mathematica_1 = require("@codemirror/legacy-modes/mode/mathematica");
|
|
12
15
|
const ntriples_1 = require("@codemirror/legacy-modes/mode/ntriples");
|
|
13
16
|
const python_1 = require("@codemirror/legacy-modes/mode/python");
|
|
14
17
|
const sparql_1 = require("@codemirror/legacy-modes/mode/sparql");
|
|
15
|
-
const sql_1 = require("@codemirror/legacy-modes/mode/sql");
|
|
16
18
|
const turtle_1 = require("@codemirror/legacy-modes/mode/turtle");
|
|
17
|
-
const yaml_1 = require("@codemirror/legacy-modes/mode/yaml");
|
|
18
19
|
//adaptations
|
|
19
20
|
const codemirrorTestHelper_1 = require("../tests/codemirrorTestHelper");
|
|
20
21
|
const supportedModes = {
|
|
@@ -23,19 +24,27 @@ const supportedModes = {
|
|
|
23
24
|
sparql: sparql_1.sparql,
|
|
24
25
|
turtle: turtle_1.turtle,
|
|
25
26
|
xml: lang_xml_1.xml,
|
|
26
|
-
yaml:
|
|
27
|
+
yaml: lang_yaml_1.yaml,
|
|
27
28
|
jinja2: jinja2_1.jinja2,
|
|
28
29
|
json: lang_json_1.json,
|
|
29
30
|
ntriples: ntriples_1.ntriples,
|
|
30
31
|
mathematica: mathematica_1.mathematica,
|
|
31
|
-
sql:
|
|
32
|
-
javascript:
|
|
32
|
+
sql: lang_sql_1.sql,
|
|
33
|
+
javascript: lang_javascript_1.javascript,
|
|
33
34
|
};
|
|
34
35
|
exports.supportedCodeEditorModes = Object.keys(supportedModes);
|
|
36
|
+
const v6AdaptedModes = new Map([
|
|
37
|
+
["json", true],
|
|
38
|
+
["markdown", true],
|
|
39
|
+
["xml", true],
|
|
40
|
+
["sql", true],
|
|
41
|
+
["yaml", true],
|
|
42
|
+
["javascript", true],
|
|
43
|
+
]);
|
|
35
44
|
const useCodeMirrorModeExtension = (mode) => {
|
|
36
45
|
return !mode
|
|
37
46
|
? (0, codemirrorTestHelper_1.adaptedSyntaxHighlighting)(language_1.defaultHighlightStyle)
|
|
38
|
-
:
|
|
47
|
+
: v6AdaptedModes.has(mode)
|
|
39
48
|
? (typeof supportedModes[mode] === "function" ? supportedModes[mode] : () => null)()
|
|
40
49
|
: language_1.StreamLanguage === null || language_1.StreamLanguage === void 0 ? void 0 : language_1.StreamLanguage.define(supportedModes[mode]);
|
|
41
50
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCodemirrorModeExtension.hooks.js","sourceRoot":"","sources":["../../../../../src/extensions/codemirror/hooks/useCodemirrorModeExtension.hooks.ts"],"names":[],"mappings":";;;AAAA,qDAA6C;AAC7C,
|
|
1
|
+
{"version":3,"file":"useCodemirrorModeExtension.hooks.js","sourceRoot":"","sources":["../../../../../src/extensions/codemirror/hooks/useCodemirrorModeExtension.hooks.ts"],"names":[],"mappings":";;;AAAA,0BAA0B;AAC1B,iEAAyD;AACzD,qDAA6C;AAC7C,6DAAqD;AACrD,mDAA2C;AAC3C,mDAA2C;AAC3C,qDAA6C;AAC7C,mDAA4G;AAC5G,qBAAqB;AACrB,iEAA8D;AAC9D,2EAAwE;AACxE,qEAAkE;AAClE,iEAA8D;AAC9D,iEAA8D;AAC9D,iEAA8D;AAE9D,aAAa;AACb,wEAA0E;AAE1E,MAAM,cAAc,GAAG;IACnB,QAAQ,EAAR,wBAAQ;IACR,MAAM,EAAN,eAAM;IACN,MAAM,EAAN,eAAM;IACN,MAAM,EAAN,eAAM;IACN,GAAG,EAAH,cAAG;IACH,IAAI,EAAJ,gBAAI;IACJ,MAAM,EAAN,eAAM;IACN,IAAI,EAAJ,gBAAI;IACJ,QAAQ,EAAR,mBAAQ;IACR,WAAW,EAAX,yBAAW;IACX,GAAG,EAAH,cAAG;IACH,UAAU,EAAV,4BAAU;CACJ,CAAC;AAEE,QAAA,wBAAwB,GAAG,MAAM,CAAC,IAAI,CAAC,cAAc,CAAuC,CAAC;AAG1G,MAAM,cAAc,GAAmD,IAAI,GAAG,CAAC;IAC3E,CAAC,MAAM,EAAE,IAAI,CAAC;IACd,CAAC,UAAU,EAAE,IAAI,CAAC;IAClB,CAAC,KAAK,EAAE,IAAI,CAAC;IACb,CAAC,KAAK,EAAE,IAAI,CAAC;IACb,CAAC,MAAM,EAAE,IAAI,CAAC;IACd,CAAC,YAAY,EAAE,IAAI,CAAC;CACvB,CAAC,CAAC;AAEI,MAAM,0BAA0B,GAAG,CAAC,IAA+B,EAAE,EAAE;IAC1E,OAAO,CAAC,IAAI;QACR,CAAC,CAAC,IAAA,gDAAyB,EAAC,gCAAqB,CAAC;QAClD,CAAC,CAAC,cAAc,CAAC,GAAG,CAAC,IAAI,CAAC;YAC1B,CAAC,CAAE,CAAC,OAAO,cAAc,CAAC,IAAI,CAAC,KAAK,UAAU,CAAC,CAAC,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,IAAI,CAA2B,EAAE;YAC/G,CAAC,CAAC,yBAAc,aAAd,yBAAc,uBAAd,yBAAc,CAAE,MAAM,CAAC,cAAc,CAAC,IAAI,CAA0B,CAAC,CAAC;AAChF,CAAC,CAAC;AANW,QAAA,0BAA0B,8BAMrC"}
|
|
@@ -23,9 +23,10 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
23
23
|
import React from "react";
|
|
24
24
|
import { CLASSPREFIX as eccgui } from "../../configuration/constants.js";
|
|
25
25
|
import Icon from "../Icon/Icon.js";
|
|
26
|
+
import Spacing from "../Separation/Spacing.js";
|
|
26
27
|
import Tooltip from "../Tooltip/Tooltip.js";
|
|
27
28
|
export var Label = function (_a) {
|
|
28
|
-
var children = _a.children, _b = _a.className, className = _b === void 0 ? "" : _b, disabled = _a.disabled, text = _a.text, info = _a.info, tooltip = _a.tooltip, tooltipProps = _a.tooltipProps, _c = _a.isLayoutForElement, isLayoutForElement = _c === void 0 ? "label" : _c, _d = _a.emphasis, emphasis = _d === void 0 ? "normal" : _d, otherLabelProps = __rest(_a, ["children", "className", "disabled", "text", "info", "tooltip", "tooltipProps", "isLayoutForElement", "emphasis"]);
|
|
29
|
+
var children = _a.children, _b = _a.className, className = _b === void 0 ? "" : _b, disabled = _a.disabled, text = _a.text, info = _a.info, tooltip = _a.tooltip, tooltipProps = _a.tooltipProps, _c = _a.isLayoutForElement, isLayoutForElement = _c === void 0 ? "label" : _c, _d = _a.emphasis, emphasis = _d === void 0 ? "normal" : _d, additionalElements = _a.additionalElements, otherLabelProps = __rest(_a, ["children", "className", "disabled", "text", "info", "tooltip", "tooltipProps", "isLayoutForElement", "emphasis", "additionalElements"]);
|
|
29
30
|
var htmlElementstring = isLayoutForElement;
|
|
30
31
|
htmlElementstring = disabled && htmlElementstring === "label" ? "span" : htmlElementstring;
|
|
31
32
|
var labelContent = (React.createElement(React.Fragment, null,
|
|
@@ -34,8 +35,11 @@ export var Label = function (_a) {
|
|
|
34
35
|
tooltip && (React.createElement("span", { className: "".concat(eccgui, "-label__tooltip") },
|
|
35
36
|
React.createElement(Tooltip, __assign({ content: tooltip, disabled: disabled }, tooltipProps),
|
|
36
37
|
React.createElement(Icon, { name: "item-info", small: true })))),
|
|
37
|
-
children && React.createElement("span", { className: "".concat(eccgui, "-label__other") }, children)
|
|
38
|
-
|
|
38
|
+
children && React.createElement("span", { className: "".concat(eccgui, "-label__other") }, children),
|
|
39
|
+
additionalElements && (React.createElement(React.Fragment, null,
|
|
40
|
+
React.createElement(Spacing, { vertical: true, size: "tiny" }),
|
|
41
|
+
additionalElements))));
|
|
42
|
+
return !!text || !!info || !!tooltip || !!children || !!additionalElements ? (React.createElement(htmlElementstring, __assign({ className: "".concat(eccgui, "-label ").concat(eccgui, "-label--").concat(emphasis) +
|
|
39
43
|
(className ? " " + className : "") +
|
|
40
44
|
(disabled ? " ".concat(eccgui, "-label--disabled") : "") }, otherLabelProps), labelContent)) : (React.createElement(React.Fragment, null));
|
|
41
45
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Label.js","sourceRoot":"","sources":["../../../../src/components/Label/Label.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,WAAW,IAAI,MAAM,EAAE,MAAM,+BAA+B,CAAC;AACtE,OAAO,IAAI,MAAM,cAAc,CAAC;AAChC,OAAO,OAAyB,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"Label.js","sourceRoot":"","sources":["../../../../src/components/Label/Label.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,WAAW,IAAI,MAAM,EAAE,MAA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B,CACpB,CACN,CACF,CACN,CAAC;IAEF,OAAO,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,OAAO,IAAI,CAAC,CAAC,QAAQ,IAAI,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC,CACzE,KAAK,CAAC,aAAa,CACf,iBAAiB,aAEb,SAAS,EACL,UAAG,MAAM,oBAAU,MAAM,qBAAW,QAAQ,CAAE;YAC9C,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,GAAG,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC;YAClC,CAAC,QAAQ,CAAC,CAAC,CAAC,WAAI,MAAM,qBAAkB,CAAC,CAAC,CAAC,EAAE,CAAC,IAC/C,eAAe,GAEtB,YAAY,CACf,CACJ,CAAC,CAAC,CAAC,CACA,yCAAK,CACR,CAAC;AACN,CAAC,CAAC;AAEF,eAAe,KAAK,CAAC"}
|
|
@@ -1,17 +1,18 @@
|
|
|
1
|
+
//adapted v6 modes imports
|
|
2
|
+
import { javascript } from "@codemirror/lang-javascript";
|
|
1
3
|
import { json } from "@codemirror/lang-json";
|
|
2
|
-
//modes imports
|
|
3
4
|
import { markdown } from "@codemirror/lang-markdown";
|
|
5
|
+
import { sql } from "@codemirror/lang-sql";
|
|
4
6
|
import { xml } from "@codemirror/lang-xml";
|
|
7
|
+
import { yaml } from "@codemirror/lang-yaml";
|
|
5
8
|
import { defaultHighlightStyle, StreamLanguage } from "@codemirror/language";
|
|
6
|
-
|
|
9
|
+
//legacy mode imports
|
|
7
10
|
import { jinja2 } from "@codemirror/legacy-modes/mode/jinja2.js";
|
|
8
11
|
import { mathematica } from "@codemirror/legacy-modes/mode/mathematica.js";
|
|
9
12
|
import { ntriples } from "@codemirror/legacy-modes/mode/ntriples.js";
|
|
10
13
|
import { python } from "@codemirror/legacy-modes/mode/python.js";
|
|
11
14
|
import { sparql } from "@codemirror/legacy-modes/mode/sparql.js";
|
|
12
|
-
import { sql } from "@codemirror/legacy-modes/mode/sql.js";
|
|
13
15
|
import { turtle } from "@codemirror/legacy-modes/mode/turtle.js";
|
|
14
|
-
import { yaml } from "@codemirror/legacy-modes/mode/yaml.js";
|
|
15
16
|
//adaptations
|
|
16
17
|
import { adaptedSyntaxHighlighting } from "../tests/codemirrorTestHelper.js";
|
|
17
18
|
var supportedModes = {
|
|
@@ -29,10 +30,18 @@ var supportedModes = {
|
|
|
29
30
|
javascript: javascript,
|
|
30
31
|
};
|
|
31
32
|
export var supportedCodeEditorModes = Object.keys(supportedModes);
|
|
33
|
+
var v6AdaptedModes = new Map([
|
|
34
|
+
["json", true],
|
|
35
|
+
["markdown", true],
|
|
36
|
+
["xml", true],
|
|
37
|
+
["sql", true],
|
|
38
|
+
["yaml", true],
|
|
39
|
+
["javascript", true],
|
|
40
|
+
]);
|
|
32
41
|
export var useCodeMirrorModeExtension = function (mode) {
|
|
33
42
|
return !mode
|
|
34
43
|
? adaptedSyntaxHighlighting(defaultHighlightStyle)
|
|
35
|
-
:
|
|
44
|
+
: v6AdaptedModes.has(mode)
|
|
36
45
|
? (typeof supportedModes[mode] === "function" ? supportedModes[mode] : function () { return null; })()
|
|
37
46
|
: StreamLanguage === null || StreamLanguage === void 0 ? void 0 : StreamLanguage.define(supportedModes[mode]);
|
|
38
47
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCodemirrorModeExtension.hooks.js","sourceRoot":"","sources":["../../../../../src/extensions/codemirror/hooks/useCodemirrorModeExtension.hooks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"useCodemirrorModeExtension.hooks.js","sourceRoot":"","sources":["../../../../../src/extensions/codemirror/hooks/useCodemirrorModeExtension.hooks.ts"],"names":[],"mappings":"AAAA,0BAA0B;AAC1B,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AACzD,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAC7C,OAAO,EAAE,QAA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CAAC,CAAC;AAEH,MAAM,CAAC,IAAM,0BAA0B,GAAG,UAAC,IAA+B;IACtE,OAAO,CAAC,IAAI;QACR,CAAC,CAAC,yBAAyB,CAAC,qBAAqB,CAAC;QAClD,CAAC,CAAC,cAAc,CAAC,GAAG,CAAC,IAAI,CAAC;YAC1B,CAAC,CAAE,CAAC,OAAO,cAAc,CAAC,IAAI,CAAC,KAAK,UAAU,CAAC,CAAC,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,cAAM,OAAA,IAAI,EAAJ,CAAI,CAA2B,EAAE;YAC/G,CAAC,CAAC,cAAc,aAAd,cAAc,uBAAd,cAAc,CAAE,MAAM,CAAC,cAAc,CAAC,IAAI,CAA0B,CAAC,CAAC;AAChF,CAAC,CAAC"}
|
|
@@ -30,6 +30,10 @@ export interface LabelProps extends React.LabelHTMLAttributes<HTMLLabelElement>
|
|
|
30
30
|
* visual appearance of the label
|
|
31
31
|
*/
|
|
32
32
|
emphasis?: "strong" | "normal";
|
|
33
|
+
/**
|
|
34
|
+
* Add other elements to the end of the label content
|
|
35
|
+
*/
|
|
36
|
+
additionalElements?: React.ReactNode | React.ReactNode[];
|
|
33
37
|
}
|
|
34
|
-
export declare const Label: ({ children, className, disabled, text, info, tooltip, tooltipProps, isLayoutForElement, emphasis, ...otherLabelProps }: LabelProps) => React.JSX.Element;
|
|
38
|
+
export declare const Label: ({ children, className, disabled, text, info, tooltip, tooltipProps, isLayoutForElement, emphasis, additionalElements, ...otherLabelProps }: LabelProps) => React.JSX.Element;
|
|
35
39
|
export default Label;
|
|
@@ -1,21 +1,23 @@
|
|
|
1
|
+
import { javascript } from "@codemirror/lang-javascript";
|
|
1
2
|
import { json } from "@codemirror/lang-json";
|
|
2
3
|
import { markdown } from "@codemirror/lang-markdown";
|
|
4
|
+
import { sql } from "@codemirror/lang-sql";
|
|
3
5
|
import { xml } from "@codemirror/lang-xml";
|
|
6
|
+
import { yaml } from "@codemirror/lang-yaml";
|
|
4
7
|
import { StreamParser } from "@codemirror/language";
|
|
5
|
-
import { sql } from "@codemirror/legacy-modes/mode/sql";
|
|
6
8
|
declare const supportedModes: {
|
|
7
9
|
readonly markdown: typeof markdown;
|
|
8
10
|
readonly python: StreamParser<unknown>;
|
|
9
11
|
readonly sparql: StreamParser<unknown>;
|
|
10
12
|
readonly turtle: StreamParser<unknown>;
|
|
11
13
|
readonly xml: typeof xml;
|
|
12
|
-
readonly yaml:
|
|
14
|
+
readonly yaml: typeof yaml;
|
|
13
15
|
readonly jinja2: StreamParser<unknown>;
|
|
14
16
|
readonly json: typeof json;
|
|
15
17
|
readonly ntriples: StreamParser<unknown>;
|
|
16
18
|
readonly mathematica: StreamParser<unknown>;
|
|
17
19
|
readonly sql: typeof sql;
|
|
18
|
-
readonly javascript:
|
|
20
|
+
readonly javascript: typeof javascript;
|
|
19
21
|
};
|
|
20
22
|
export declare const supportedCodeEditorModes: Array<keyof typeof supportedModes>;
|
|
21
23
|
export type SupportedCodeEditorModes = (typeof supportedCodeEditorModes)[number];
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eccenca/gui-elements",
|
|
3
3
|
"description": "GUI elements based on other libraries, usable in React application, written in Typescript.",
|
|
4
|
-
"version": "24.1.0-rc.
|
|
4
|
+
"version": "24.1.0-rc.3",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"homepage": "https://github.com/eccenca/gui-elements",
|
|
7
7
|
"bugs": "https://github.com/eccenca/gui-elements/issues",
|
|
@@ -72,10 +72,13 @@
|
|
|
72
72
|
"@blueprintjs/core": "^5.16.2",
|
|
73
73
|
"@blueprintjs/select": "^5.3.7",
|
|
74
74
|
"@carbon/icons": "^11.53.0",
|
|
75
|
-
"@carbon/react": "
|
|
75
|
+
"@carbon/react": "1.72.0",
|
|
76
|
+
"@codemirror/lang-javascript": "^6.2.2",
|
|
76
77
|
"@codemirror/lang-json": "^6.0.1",
|
|
77
78
|
"@codemirror/lang-markdown": "^6.3.1",
|
|
79
|
+
"@codemirror/lang-sql": "^6.8.0",
|
|
78
80
|
"@codemirror/lang-xml": "^6.1.0",
|
|
81
|
+
"@codemirror/lang-yaml": "^6.1.2",
|
|
79
82
|
"@codemirror/legacy-modes": "^6.4.2",
|
|
80
83
|
"@mavrin/remark-typograf": "^2.2.0",
|
|
81
84
|
"classnames": "^2.5.1",
|
|
@@ -2,7 +2,7 @@ import React from "react";
|
|
|
2
2
|
import { loremIpsum } from "react-lorem-ipsum";
|
|
3
3
|
import { Meta, StoryFn } from "@storybook/react";
|
|
4
4
|
|
|
5
|
-
import { Label } from "../../index";
|
|
5
|
+
import { Icon, Label } from "../../index";
|
|
6
6
|
|
|
7
7
|
export default {
|
|
8
8
|
title: "Forms/Label",
|
|
@@ -19,4 +19,5 @@ Default.args = {
|
|
|
19
19
|
tooltip: loremIpsum({ p: 1, avgSentencesPerParagraph: 2, startWithLoremIpsum: false, random: false }).toString(),
|
|
20
20
|
disabled: false,
|
|
21
21
|
htmlFor: "inputid",
|
|
22
|
+
additionalElements: <Icon name={"state-warning"} tooltipText={"message"} small />,
|
|
22
23
|
};
|
|
@@ -2,6 +2,7 @@ import React from "react";
|
|
|
2
2
|
|
|
3
3
|
import { CLASSPREFIX as eccgui } from "../../configuration/constants";
|
|
4
4
|
import Icon from "../Icon/Icon";
|
|
5
|
+
import Spacing from "../Separation/Spacing";
|
|
5
6
|
import Tooltip, { TooltipProps } from "../Tooltip/Tooltip";
|
|
6
7
|
|
|
7
8
|
export interface LabelProps extends React.LabelHTMLAttributes<HTMLLabelElement> {
|
|
@@ -34,6 +35,10 @@ export interface LabelProps extends React.LabelHTMLAttributes<HTMLLabelElement>
|
|
|
34
35
|
* visual appearance of the label
|
|
35
36
|
*/
|
|
36
37
|
emphasis?: "strong" | "normal";
|
|
38
|
+
/**
|
|
39
|
+
* Add other elements to the end of the label content
|
|
40
|
+
*/
|
|
41
|
+
additionalElements?: React.ReactNode | React.ReactNode[];
|
|
37
42
|
}
|
|
38
43
|
|
|
39
44
|
export const Label = ({
|
|
@@ -46,6 +51,7 @@ export const Label = ({
|
|
|
46
51
|
tooltipProps,
|
|
47
52
|
isLayoutForElement = "label",
|
|
48
53
|
emphasis = "normal",
|
|
54
|
+
additionalElements,
|
|
49
55
|
...otherLabelProps
|
|
50
56
|
}: LabelProps) => {
|
|
51
57
|
let htmlElementstring = isLayoutForElement;
|
|
@@ -63,10 +69,16 @@ export const Label = ({
|
|
|
63
69
|
</span>
|
|
64
70
|
)}
|
|
65
71
|
{children && <span className={`${eccgui}-label__other`}>{children}</span>}
|
|
72
|
+
{additionalElements && (
|
|
73
|
+
<>
|
|
74
|
+
<Spacing vertical size="tiny" />
|
|
75
|
+
{additionalElements}
|
|
76
|
+
</>
|
|
77
|
+
)}
|
|
66
78
|
</>
|
|
67
79
|
);
|
|
68
80
|
|
|
69
|
-
return !!text || !!info || !!tooltip || !!children ? (
|
|
81
|
+
return !!text || !!info || !!tooltip || !!children || !!additionalElements ? (
|
|
70
82
|
React.createElement(
|
|
71
83
|
htmlElementstring,
|
|
72
84
|
{
|
|
@@ -1,17 +1,18 @@
|
|
|
1
|
+
//adapted v6 modes imports
|
|
2
|
+
import { javascript } from "@codemirror/lang-javascript";
|
|
1
3
|
import { json } from "@codemirror/lang-json";
|
|
2
|
-
//modes imports
|
|
3
4
|
import { markdown } from "@codemirror/lang-markdown";
|
|
5
|
+
import { sql } from "@codemirror/lang-sql";
|
|
4
6
|
import { xml } from "@codemirror/lang-xml";
|
|
7
|
+
import { yaml } from "@codemirror/lang-yaml";
|
|
5
8
|
import { defaultHighlightStyle, LanguageSupport, StreamLanguage, StreamParser } from "@codemirror/language";
|
|
6
|
-
|
|
9
|
+
//legacy mode imports
|
|
7
10
|
import { jinja2 } from "@codemirror/legacy-modes/mode/jinja2";
|
|
8
11
|
import { mathematica } from "@codemirror/legacy-modes/mode/mathematica";
|
|
9
12
|
import { ntriples } from "@codemirror/legacy-modes/mode/ntriples";
|
|
10
13
|
import { python } from "@codemirror/legacy-modes/mode/python";
|
|
11
14
|
import { sparql } from "@codemirror/legacy-modes/mode/sparql";
|
|
12
|
-
import { sql } from "@codemirror/legacy-modes/mode/sql";
|
|
13
15
|
import { turtle } from "@codemirror/legacy-modes/mode/turtle";
|
|
14
|
-
import { yaml } from "@codemirror/legacy-modes/mode/yaml";
|
|
15
16
|
|
|
16
17
|
//adaptations
|
|
17
18
|
import { adaptedSyntaxHighlighting } from "../tests/codemirrorTestHelper";
|
|
@@ -34,10 +35,19 @@ const supportedModes = {
|
|
|
34
35
|
export const supportedCodeEditorModes = Object.keys(supportedModes) as Array<keyof typeof supportedModes>;
|
|
35
36
|
export type SupportedCodeEditorModes = (typeof supportedCodeEditorModes)[number];
|
|
36
37
|
|
|
38
|
+
const v6AdaptedModes: ReadonlyMap<SupportedCodeEditorModes, boolean> = new Map([
|
|
39
|
+
["json", true],
|
|
40
|
+
["markdown", true],
|
|
41
|
+
["xml", true],
|
|
42
|
+
["sql", true],
|
|
43
|
+
["yaml", true],
|
|
44
|
+
["javascript", true],
|
|
45
|
+
]);
|
|
46
|
+
|
|
37
47
|
export const useCodeMirrorModeExtension = (mode?: SupportedCodeEditorModes) => {
|
|
38
48
|
return !mode
|
|
39
49
|
? adaptedSyntaxHighlighting(defaultHighlightStyle)
|
|
40
|
-
:
|
|
50
|
+
: v6AdaptedModes.has(mode)
|
|
41
51
|
? ((typeof supportedModes[mode] === "function" ? supportedModes[mode] : () => null) as () => LanguageSupport)()
|
|
42
52
|
: StreamLanguage?.define(supportedModes[mode] as StreamParser<unknown>);
|
|
43
53
|
};
|