@neo4j-ndl/react 0.7.2 → 0.8.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.
Files changed (35) hide show
  1. package/lib/cjs/code-block/CodeBlock.js +104 -0
  2. package/lib/cjs/code-block/CodeBlock.js.map +1 -0
  3. package/lib/cjs/code-block/index.js +38 -0
  4. package/lib/cjs/code-block/index.js.map +1 -0
  5. package/lib/cjs/code-block/languages.js +302 -0
  6. package/lib/cjs/code-block/languages.js.map +1 -0
  7. package/lib/cjs/dropdown/Dropdown.js +1 -1
  8. package/lib/cjs/dropdown/Dropdown.js.map +1 -1
  9. package/lib/cjs/graph-label/GraphLabel.js +80 -42
  10. package/lib/cjs/graph-label/GraphLabel.js.map +1 -1
  11. package/lib/cjs/graph-label/color.js +87 -0
  12. package/lib/cjs/graph-label/color.js.map +1 -0
  13. package/lib/cjs/index.js +1 -0
  14. package/lib/cjs/index.js.map +1 -1
  15. package/lib/esm/code-block/CodeBlock.js +75 -0
  16. package/lib/esm/code-block/CodeBlock.js.map +1 -0
  17. package/lib/esm/code-block/index.js +22 -0
  18. package/lib/esm/code-block/index.js.map +1 -0
  19. package/lib/esm/code-block/languages.js +301 -0
  20. package/lib/esm/code-block/languages.js.map +1 -0
  21. package/lib/esm/dropdown/Dropdown.js +1 -1
  22. package/lib/esm/dropdown/Dropdown.js.map +1 -1
  23. package/lib/esm/graph-label/GraphLabel.js +57 -42
  24. package/lib/esm/graph-label/GraphLabel.js.map +1 -1
  25. package/lib/esm/graph-label/color.js +77 -0
  26. package/lib/esm/graph-label/color.js.map +1 -0
  27. package/lib/esm/index.js +1 -0
  28. package/lib/esm/index.js.map +1 -1
  29. package/lib/types/code-block/CodeBlock.d.ts +34 -0
  30. package/lib/types/code-block/index.d.ts +21 -0
  31. package/lib/types/code-block/languages.d.ts +23 -0
  32. package/lib/types/graph-label/GraphLabel.d.ts +11 -38
  33. package/lib/types/graph-label/color.d.ts +41 -0
  34. package/lib/types/index.d.ts +1 -0
  35. package/package.json +6 -3
@@ -0,0 +1,21 @@
1
+ /**
2
+ *
3
+ * Copyright (c) "Neo4j"
4
+ * Neo4j Sweden AB [http://neo4j.com]
5
+ *
6
+ * This file is part of Neo4j.
7
+ *
8
+ * Neo4j is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation, either version 3 of the License, or
11
+ * (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
20
+ */
21
+ export * from './CodeBlock';
@@ -0,0 +1,23 @@
1
+ /**
2
+ *
3
+ * Copyright (c) "Neo4j"
4
+ * Neo4j Sweden AB [http://neo4j.com]
5
+ *
6
+ * This file is part of Neo4j.
7
+ *
8
+ * Neo4j is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation, either version 3 of the License, or
11
+ * (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
20
+ */
21
+ declare const Languages: readonly ["abap", "abnf", "actionscript", "ada", "agda", "al", "antlr4", "apacheconf", "apex", "apl", "applescript", "aql", "arduino", "arff", "asciidoc", "asm6502", "asmatmel", "aspnet", "autohotkey", "autoit", "avisynth", "avro-idl", "bash", "basic", "batch", "bbcode", "bicep", "birb", "bison", "bnf", "brainfuck", "brightscript", "bro", "bsl", "c", "cfscript", "chaiscript", "cil", "clike", "clojure", "cmake", "cobol", "coffeescript", "concurnas", "coq", "cpp", "crystal", "csharp", "cshtml", "csp", "css-extras", "css", "csv", "cypher", "d", "dart", "dataweave", "dax", "dhall", "diff", "django", "dns-zone-file", "docker", "dot", "ebnf", "editorconfig", "eiffel", "ejs", "elixir", "elm", "erb", "erlang", "etlua", "excel-formula", "factor", "false", "firestore-security-rules", "flow", "fortran", "fsharp", "ftl", "gap", "gcode", "gdscript", "gedcom", "gherkin", "git", "glsl", "gml", "gn", "go-module", "go", "graphql", "groovy", "haml", "handlebars", "haskell", "haxe", "hcl", "hlsl", "hoon", "hpkp", "hsts", "http", "ichigojam", "icon", "icu-message-format", "idris", "iecst", "ignore", "inform7", "ini", "io", "j", "java", "javadoc", "javadoclike", "javascript", "javastacktrace", "jexl", "jolie", "jq", "js-extras", "js-templates", "jsdoc", "json", "json5", "jsonp", "jsstacktrace", "jsx", "julia", "keepalived", "keyman", "kotlin", "kumir", "kusto", "latex", "latte", "less", "lilypond", "liquid", "lisp", "livescript", "llvm", "log", "lolcode", "lua", "magma", "makefile", "markdown", "markup-templating", "markup", "matlab", "maxscript", "mel", "mermaid", "mizar", "mongodb", "monkey", "moonscript", "n1ql", "n4js", "nand2tetris-hdl", "naniscript", "nasm", "neon", "nevod", "nginx", "nim", "nix", "nsis", "objectivec", "ocaml", "opencl", "openqasm", "oz", "parigp", "parser", "pascal", "pascaligo", "pcaxis", "peoplecode", "perl", "php-extras", "php", "phpdoc", "plsql", "powerquery", "powershell", "processing", "prolog", "promql", "properties", "protobuf", "psl", "pug", "puppet", "pure", "purebasic", "purescript", "python", "q", "qml", "qore", "qsharp", "r", "racket", "reason", "regex", "rego", "renpy", "rest", "rip", "roboconf", "robotframework", "ruby", "rust", "sas", "sass", "scala", "scheme", "scss", "shell-session", "smali", "smalltalk", "smarty", "sml", "solidity", "solution-file", "soy", "sparql", "splunk-spl", "sqf", "sql", "squirrel", "stan", "stylus", "swift", "systemd", "t4-cs", "t4-templating", "t4-vb", "tap", "tcl", "textile", "toml", "tremor", "tsx", "tt2", "turtle", "twig", "typescript", "typoscript", "unrealscript", "uorazor", "uri", "v", "vala", "vbnet", "velocity", "verilog", "vhdl", "vim", "visual-basic", "warpscript", "wasm", "web-idl", "wiki", "wolfram", "wren", "xeora", "xml-doc", "xojo", "xquery", "yaml", "yang", "zig"];
22
+ export declare type LanguageProp = typeof Languages[number];
23
+ export {};
@@ -19,52 +19,25 @@
19
19
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
20
20
  */
21
21
  import React from 'react';
22
- import { ElementBase } from '../helpers';
23
22
  /**
24
23
  *
25
24
  *
26
- * Types
25
+ * GraphLabel Component
27
26
  *
28
27
  *
29
28
  */
30
- declare type NodeLabelProps = {
29
+ declare const GraphLabel: React.ForwardRefExoticComponent<{
30
+ type: 'node' | 'relationship' | 'propertyKey';
31
31
  children?: React.ReactNode;
32
+ /** The background color of the label only applicable to type node and relationship*/
33
+ color?: string | undefined;
32
34
  /** Sets the label to the disabled style */
33
- disabled?: boolean;
35
+ disabled?: boolean | undefined;
34
36
  /** Additional classes only applicable to type node*/
35
- className?: string;
36
- /** The background color of the label only applicable to type node*/
37
- color?: string;
38
- /** If the element is selected */
39
- selected?: boolean;
40
- } & ElementBase<HTMLButtonElement>;
41
- declare type RelationshipLabelProps = {
42
- children?: React.ReactNode;
43
- /** Sets the label to the disabled style */
44
- disabled?: boolean;
45
- /** If the element is selected */
46
- selected?: boolean;
47
- } & ElementBase<HTMLButtonElement>;
48
- declare type PropertyKeyLabelProps = {
49
- children?: React.ReactNode;
50
- /** Sets the label to the disabled style */
51
- disabled?: boolean;
37
+ className?: string | undefined;
52
38
  /** If the element is selected */
53
- selected?: boolean;
54
- } & ElementBase<HTMLButtonElement>;
55
- declare type GraphLabelProps = ({
56
- type: 'node';
57
- } & NodeLabelProps) | ({
58
- type: 'relationship';
59
- } & RelationshipLabelProps) | ({
60
- type: 'propertyKey';
61
- } & PropertyKeyLabelProps);
62
- /**
63
- *
64
- *
65
- * GraphLabel Component
66
- *
67
- *
68
- */
69
- declare const GraphLabel: React.ForwardRefExoticComponent<GraphLabelProps & React.RefAttributes<HTMLDivElement>>;
39
+ selected?: boolean | undefined;
40
+ } & Omit<React.HTMLProps<HTMLButtonElement>, "ref" | "size" | "as" | "selected" | "onChange"> & {
41
+ as?: string | React.ComponentType<any> | undefined;
42
+ } & React.RefAttributes<HTMLDivElement>>;
70
43
  export default GraphLabel;
@@ -0,0 +1,41 @@
1
+ /**
2
+ *
3
+ * Copyright (c) "Neo4j"
4
+ * Neo4j Sweden AB [http://neo4j.com]
5
+ *
6
+ * This file is part of Neo4j.
7
+ *
8
+ * Neo4j is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation, either version 3 of the License, or
11
+ * (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
20
+ */
21
+ /**
22
+ * Takes a color string and returns color string
23
+ * that is readable on top of that background. Prioritizes pallete
24
+ * text colors and uses black or white as fallback.
25
+ */
26
+ export declare const getTextColorFromBackground: (color: string) => string;
27
+ /**
28
+ * Takes a color string and returns a color string
29
+ * that is darker or ligher depending on the given color.
30
+ */
31
+ export declare const getHoverColor: (color: string) => string;
32
+ /**
33
+ * Returns the most readlabale color on the given background color
34
+ * as a string from a list of palette text colors
35
+ */
36
+ export declare const getDisabledTextColor: (backgroundColor: string) => string;
37
+ /**
38
+ * Takes a color string and returns a color string
39
+ * that is darker or ligher depending on the given color.
40
+ */
41
+ export declare const getDisabledColor: (color: string) => string;
@@ -41,3 +41,4 @@ export * from './dropdown';
41
41
  export * from './tag';
42
42
  export * from './wizard';
43
43
  export * from './graph-label';
44
+ export * from './code-block';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neo4j-ndl/react",
3
- "version": "0.7.2",
3
+ "version": "0.8.1",
4
4
  "description": "React implementation of Neo4j Design System",
5
5
  "keywords": [
6
6
  "button",
@@ -48,6 +48,7 @@
48
48
  "@types/jest-axe": "^3.5.3",
49
49
  "@types/react-dom": "^17.0.11",
50
50
  "@types/react-table": "^7.7.10",
51
+ "@types/tinycolor2": "^1.4.3",
51
52
  "@typescript-eslint/eslint-plugin": "^5.5.0",
52
53
  "@typescript-eslint/parser": "^5.5.0",
53
54
  "babel-jest": "^27.3.1",
@@ -68,12 +69,14 @@
68
69
  },
69
70
  "dependencies": {
70
71
  "@heroicons/react": "^1.0.5",
71
- "@neo4j-ndl/base": "^0.7.1",
72
+ "@neo4j-ndl/base": "workspace:^",
72
73
  "classnames": "^2.3.1",
73
74
  "detect-browser": "^5.3.0",
74
75
  "react-dropzone": "^14.0.0",
75
76
  "react-select": "^5.3.2",
77
+ "react-syntax-highlighter": "^15.5.0",
76
78
  "react-table": "^7.7.0",
77
- "react-use": "^17.4.0"
79
+ "react-use": "^17.4.0",
80
+ "tinycolor2": "^1.4.2"
78
81
  }
79
82
  }