@neo4j-ndl/react 0.5.2 → 0.6.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 (39) hide show
  1. package/lib/cjs/drag-and-drop/DragAndDrop.js +13 -2
  2. package/lib/cjs/drag-and-drop/DragAndDrop.js.map +1 -1
  3. package/lib/cjs/dropdown/Dropdown.js +158 -0
  4. package/lib/cjs/dropdown/Dropdown.js.map +1 -0
  5. package/lib/cjs/dropdown/Overrides.js +50 -0
  6. package/lib/cjs/dropdown/Overrides.js.map +1 -0
  7. package/lib/cjs/dropdown/index.js +38 -0
  8. package/lib/cjs/dropdown/index.js.map +1 -0
  9. package/lib/cjs/dropdown/types.js +23 -0
  10. package/lib/cjs/dropdown/types.js.map +1 -0
  11. package/lib/cjs/index.js +2 -0
  12. package/lib/cjs/index.js.map +1 -1
  13. package/lib/cjs/table/helpers.js +5 -1
  14. package/lib/cjs/table/helpers.js.map +1 -1
  15. package/lib/cjs/tag/Tag.js +33 -4
  16. package/lib/cjs/tag/Tag.js.map +1 -1
  17. package/lib/esm/drag-and-drop/DragAndDrop.js +13 -2
  18. package/lib/esm/drag-and-drop/DragAndDrop.js.map +1 -1
  19. package/lib/esm/dropdown/Dropdown.js +152 -0
  20. package/lib/esm/dropdown/Dropdown.js.map +1 -0
  21. package/lib/esm/dropdown/Overrides.js +43 -0
  22. package/lib/esm/dropdown/Overrides.js.map +1 -0
  23. package/lib/esm/dropdown/index.js +22 -0
  24. package/lib/esm/dropdown/index.js.map +1 -0
  25. package/lib/esm/dropdown/types.js +22 -0
  26. package/lib/esm/dropdown/types.js.map +1 -0
  27. package/lib/esm/index.js +2 -0
  28. package/lib/esm/index.js.map +1 -1
  29. package/lib/esm/table/helpers.js +5 -1
  30. package/lib/esm/table/helpers.js.map +1 -1
  31. package/lib/esm/tag/Tag.js +10 -4
  32. package/lib/esm/tag/Tag.js.map +1 -1
  33. package/lib/types/dropdown/Dropdown.d.ts +25 -0
  34. package/lib/types/dropdown/Overrides.d.ts +27 -0
  35. package/lib/types/dropdown/index.d.ts +21 -0
  36. package/lib/types/dropdown/types.d.ts +69 -0
  37. package/lib/types/index.d.ts +2 -0
  38. package/lib/types/tag/Tag.d.ts +3 -2
  39. package/package.json +4 -2
@@ -1,4 +1,15 @@
1
1
  "use strict";
2
+ var __rest = (this && this.__rest) || function (s, e) {
3
+ var t = {};
4
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
5
+ t[p] = s[p];
6
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
7
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
8
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
9
+ t[p[i]] = s[p[i]];
10
+ }
11
+ return t;
12
+ };
2
13
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
14
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
15
  };
@@ -35,7 +46,7 @@ const isFileValid = (fileType, paramAcceptedFiles) => {
35
46
  */
36
47
  const DragAndDrop = (props) => {
37
48
  var _a, _b, _c;
38
- const { dropZoneOptions, supportedFilesDescription, loadingComponent, isTesting, } = props;
49
+ const { dropZoneOptions, supportedFilesDescription, loadingComponent, isTesting } = props, otherProps = __rest(props, ["dropZoneOptions", "supportedFilesDescription", "loadingComponent", "isTesting"]);
39
50
  const { getRootProps, getInputProps, isDragActive, draggedFiles, acceptedFiles, } = (0, react_dropzone_1.useDropzone)(Object.assign(Object.assign({
40
51
  // If the developer does not pass this function, then the browser will automatically download the dragged file. To empty function avoids that.
41
52
  onDrop: () => null }, dropZoneOptions), { disabled: (dropZoneOptions === null || dropZoneOptions === void 0 ? void 0 : dropZoneOptions.disabled) || !!loadingComponent }));
@@ -63,7 +74,7 @@ const DragAndDrop = (props) => {
63
74
  'drag-active': isDragActive,
64
75
  'file-invalid': isDragActive && !isDraggedFileValid,
65
76
  });
66
- return ((0, jsx_runtime_1.jsx)("div", Object.assign({}, props, { ref: dropZoneRef, className: wrapperClasses }, { children: (0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "ndl-drag-and-drop-inner-content" }, getRootProps(), { children: [(0, jsx_runtime_1.jsx)("input", Object.assign({}, getInputProps())), (0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "ndl-drag-and-drop-inner" }, { children: [(0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "ndl-drag-and-drop-header" }, { children: [(0, jsx_runtime_1.jsx)("div", Object.assign({ className: "upload-img-wrapper" }, { children: width > 230 && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(isDragActive || isUploading) && !isTesting && ((0, jsx_runtime_1.jsx)("span", Object.assign({ className: "upload-img-label" }, { children: getFileTypeAbbr(isUploading
77
+ return ((0, jsx_runtime_1.jsx)("div", Object.assign({}, otherProps, { ref: dropZoneRef, className: wrapperClasses }, { children: (0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "ndl-drag-and-drop-inner-content" }, getRootProps(), { children: [(0, jsx_runtime_1.jsx)("input", Object.assign({}, getInputProps())), (0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "ndl-drag-and-drop-inner" }, { children: [(0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "ndl-drag-and-drop-header" }, { children: [(0, jsx_runtime_1.jsx)("div", Object.assign({ className: "upload-img-wrapper" }, { children: width > 230 && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(isDragActive || isUploading) && !isTesting && ((0, jsx_runtime_1.jsx)("span", Object.assign({ className: "upload-img-label" }, { children: getFileTypeAbbr(isUploading
67
78
  ? (_b = acceptedFiles[0]) === null || _b === void 0 ? void 0 : _b.type
68
79
  : (_c = draggedFiles[0]) === null || _c === void 0 ? void 0 : _c.type) }))), isUploading || isDragActive ? (computedFileImage) : ((0, jsx_runtime_1.jsx)(Cloud_1.default, {}))] })) })), !isUploading && ((0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "dnd-title-container" }, { children: [(0, jsx_runtime_1.jsxs)("h5", Object.assign({ className: "dnd-title" }, { children: ["Drag ", (0, jsx_runtime_1.jsx)("span", Object.assign({ className: "n-font-light" }, { children: "&" })), " Drop"] })), (0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "dnd-subtitle" }, { children: [(0, jsx_runtime_1.jsx)("span", { children: "or" }), ' ', (0, jsx_runtime_1.jsx)("span", Object.assign({ className: "dnd-browse-link" }, { children: "browse" }))] }))] })))] })), (0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "ndl-drag-and-drop-footer" }, { children: [isUploading && (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: loadingComponent }), !isUploading && ((0, jsx_runtime_1.jsx)("div", Object.assign({ className: "ndl-file-support-text" }, { children: supportedFilesDescription })))] }))] }))] })) })));
69
80
  };
@@ -1 +1 @@
1
- {"version":3,"file":"DragAndDrop.js","sourceRoot":"","sources":["../../../src/drag-and-drop/DragAndDrop.tsx"],"names":[],"mappings":";;;;;;AAsBA,4DAAoC;AACpC,0DAAuC;AACvC,wDAAqC;AACrC,sEAAmD;AACnD,yCAAuC;AACvC,mDAA8D;AAyB9D;;;;;;GAMG;AAEH,qCAAqC;AAErC,MAAM,WAAW,GAAG,CAClB,QAAgB,EAChB,kBAA8C,EAC9C,EAAE;IACF,IAAI,CAAC,kBAAkB;QAAE,OAAO,IAAI,CAAC;IAErC,MAAM,iBAAiB,GAAG,KAAK,CAAC,OAAO,CAAC,kBAAkB,CAAC;QACzD,CAAC,CAAC,kBAAkB,CAAC,IAAI,CAAC,GAAG,CAAC;QAC9B,CAAC,CAAC,kBAAkB,CAAC;IAEvB,OAAO,iBAAiB,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC;AAClD,CAAC,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,WAAW,GAAG,CAAC,KAAuB,EAAE,EAAE;;IAC9C,MAAM,EACJ,eAAe,EACf,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EAAC,0BAA0B,iBACvC,8CAAK,SAAS,EAAC,oBAAoB,gBAEhC,KAAK,GAAG,GAAG,IAAI,CACd,6DACG,CAAC,YAAY,IAAI,WAAW,CAAC,IAAI,CAAC,SAAS,IAAI,CAC9C,+CAAM,SAAS,EAAC,kBAAkB,gBAC/B,eAAe,CACd,WAAW;oDACT,CAAC,CAAC,MAAA,aAAa,CAAC,CAAC,CAAC,0CAAE,IAAI;oDACxB,CAAC,CAAC,MAAA,YAAY,CAAC,CAAC,CAAC,0CAAE,IAAI,CAC1B,IACI,CACR,EAEA,WAAW,IAAI,YAAY,CAAC,CAAC,CAAC,CAC7B,iBAAiB,CAClB,CAAC,CAAC,CAAC,CACF,uBAAC,eAAU,KAAG,CACf,IACA,CACJ,IACG,EACL,CAAC,WAAW,IAAI,CACf,+CAAK,SAAS,EAAC,qBAAqB,iBAClC,8CAAI,SAAS,EAAC,WAAW,0BAClB,+CAAM,SAAS,EAAC,cAAc,uBAAS,cACzC,EACL,+CAAK,SAAS,EAAC,cAAc,iBAC3B,kDAAe,EAAC,GAAG,EACnB,+CAAM,SAAS,EAAC,iBAAiB,4BAAc,KAC3C,KACF,CACP,KACG,EACN,+CAAK,SAAS,EAAC,0BAA0B,iBACtC,WAAW,IAAI,2DAAG,gBAAgB,GAAI,EACtC,CAAC,WAAW,IAAI,CACf,8CAAK,SAAS,EAAC,uBAAuB,gBACnC,yBAAyB,IACtB,CACP,KACG,KACF,KACF,IACF,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAe,WAAW,CAAC"}
@@ -0,0 +1,158 @@
1
+ "use strict";
2
+ var __rest = (this && this.__rest) || function (s, e) {
3
+ var t = {};
4
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
5
+ t[p] = s[p];
6
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
7
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
8
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
9
+ t[p[i]] = s[p[i]];
10
+ }
11
+ return t;
12
+ };
13
+ var __importDefault = (this && this.__importDefault) || function (mod) {
14
+ return (mod && mod.__esModule) ? mod : { "default": mod };
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.Dropdown = void 0;
18
+ const jsx_runtime_1 = require("react/jsx-runtime");
19
+ /**
20
+ *
21
+ * Copyright (c) "Neo4j"
22
+ * Neo4j Sweden AB [http://neo4j.com]
23
+ *
24
+ * This file is part of Neo4j.
25
+ *
26
+ * Neo4j is free software: you can redistribute it and/or modify
27
+ * it under the terms of the GNU General Public License as published by
28
+ * the Free Software Foundation, either version 3 of the License, or
29
+ * (at your option) any later version.
30
+ *
31
+ * This program is distributed in the hope that it will be useful,
32
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
33
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
34
+ * GNU General Public License for more details.
35
+ *
36
+ * You should have received a copy of the GNU General Public License
37
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
38
+ */
39
+ const react_1 = require("react");
40
+ const classnames_1 = __importDefault(require("classnames"));
41
+ const tokens_1 = __importDefault(require("@neo4j-ndl/base/lib/tokens/js/tokens"));
42
+ /** Different types of select components */
43
+ const react_select_1 = __importDefault(require("react-select"));
44
+ const creatable_1 = __importDefault(require("react-select/creatable"));
45
+ const async_1 = __importDefault(require("react-select/async"));
46
+ const helpers_1 = require("../helpers");
47
+ const utils_1 = require("../_common/utils");
48
+ const Overrides_1 = require("./Overrides");
49
+ /**
50
+ *
51
+ *
52
+ * Helpers
53
+ *
54
+ *
55
+ */
56
+ const overrideComponents = (props) => ({
57
+ DropdownIndicator: (0, Overrides_1.DropdownIndicatorCurrying)(props),
58
+ IndicatorSeparator: null,
59
+ ClearIndicator: (0, Overrides_1.CustomClearIndication)(props),
60
+ MultiValueRemove: (0, Overrides_1.CustomMultiValueRemove)(props),
61
+ Placeholder: (0, Overrides_1.CustomPlaceholder)(props),
62
+ });
63
+ const customStyles = ({ errorText, size, }) => {
64
+ const focusedBorderColor = errorText
65
+ ? tokens_1.default.palette.light.danger.border.strong
66
+ : tokens_1.default.palette.light.primary.focus;
67
+ const defaultBorder = errorText
68
+ ? tokens_1.default.palette.light.danger.border.strong
69
+ : tokens_1.default.palette.light.neutral.border.strong;
70
+ return {
71
+ control: (provided, state) => (Object.assign(Object.assign({}, provided), { minHeight: size === 'small' ? '36px' : '48px',
72
+ // Avoid shifting with border of 2px
73
+ // Source: https://stackoverflow.com/a/9612782/3247715
74
+ boxShadow: state.isFocused ? `0 0 0 2px ${focusedBorderColor}` : 'none', outline: 'none', border: state.isFocused
75
+ ? `1px solid ${focusedBorderColor}`
76
+ : `1px solid ${defaultBorder}`, '&:hover': {
77
+ border: state.isFocused
78
+ ? `1px solid ${focusedBorderColor}`
79
+ : `1px solid ${defaultBorder}`,
80
+ } })),
81
+ multiValue: (provided) => (Object.assign(Object.assign({}, provided), { borderRadius: '4px', height: '28px' })),
82
+ indicatorsContainer: (provided) => (Object.assign(Object.assign({}, provided), {
83
+ /**
84
+ * The right icon has padding of 8px so:
85
+ * padding-right: 8px+desired
86
+ */
87
+ paddingRight: size === 'small' ? '4px' : '8px' })),
88
+ /**
89
+ * Only for multi-select, make the padding
90
+ * 2px everywhere when we have at least one
91
+ * value selected
92
+ */
93
+ valueContainer: (provided, state) => (Object.assign(Object.assign({}, provided), { padding: state.isMulti && state.hasValue ? '2px' : '2px 8px' })),
94
+ menuList: (provided) => (Object.assign(Object.assign({}, provided), { padding: size === 'small' ? '16px 12px' : '16px 16px' })),
95
+ option: (provided, state) => (Object.assign(Object.assign({}, provided), { borderRadius: '4px', backgroundColor: state.isSelected
96
+ ? tokens_1.default.palette.light.neutral.bg.strong
97
+ : 'transparent', color: tokens_1.default.palette.light.neutral.text.default, '&:hover': {
98
+ backgroundColor: state.isSelected
99
+ ? tokens_1.default.palette.light.neutral.bg.strong
100
+ : tokens_1.default.palette.light.neutral.bg.default,
101
+ } })),
102
+ };
103
+ };
104
+ const ExposedKeys = [
105
+ 'onChange',
106
+ 'isMulti',
107
+ 'isClearable',
108
+ 'formatOptionLabel',
109
+ 'value',
110
+ 'placeholder',
111
+ 'options',
112
+ ];
113
+ exports.Dropdown = (0, helpers_1.forwardRef)(function Dropdown(props, ref) {
114
+ const { as, label, helpText, errorText, fluid = true, size = 'small', type = 'select', selectProps = {}, 'aria-label': ariaLabel } = props, rest = __rest(props, ["as", "label", "helpText", "errorText", "fluid", "size", "type", "selectProps", 'aria-label']);
115
+ const Component = as || 'div';
116
+ /**
117
+ * Merge selectProps with exposed react-select props
118
+ * Priority is given to selectProps
119
+ * Source: https://stackoverflow.com/a/32184094/3247715
120
+ */
121
+ const MergedSelectProps = (0, react_1.useMemo)(() => ExposedKeys.reduce((a, e) => ((a[e] = selectProps[e] || rest[e]), a), selectProps), [rest, selectProps]);
122
+ /**
123
+ * Remove selectProps from rest
124
+ * to spread them in the root component
125
+ */
126
+ const RestProps = (0, react_1.useMemo)(() => {
127
+ const cloned = Object.assign({}, rest);
128
+ ExposedKeys.forEach((key) => delete cloned[key]);
129
+ return cloned;
130
+ }, [rest]);
131
+ const ComponentOverrides = (0, react_1.useMemo)(() => overrideComponents({ errorText, size }), [errorText, size]);
132
+ const StyleOverrides = (0, react_1.useMemo)(() => customStyles({ errorText, size }), [errorText, size]);
133
+ const identifier = (0, react_1.useMemo)(() => {
134
+ if (typeof label === 'string')
135
+ return label;
136
+ if (ariaLabel)
137
+ return ariaLabel;
138
+ (0, utils_1.needleWarningMessage)('Consider adding an aria-label to make the select more accessible');
139
+ // 7 char long pseudo-random string
140
+ return Math.random().toString(36).slice(2, 9);
141
+ }, [label, ariaLabel]);
142
+ let SelectElement;
143
+ switch (type) {
144
+ case 'async-select': {
145
+ SelectElement = ((0, jsx_runtime_1.jsx)(async_1.default, Object.assign({ name: identifier, inputId: identifier, components: ComponentOverrides }, MergedSelectProps, { styles: Object.assign(Object.assign({}, StyleOverrides), selectProps === null || selectProps === void 0 ? void 0 : selectProps.styles) })));
146
+ break;
147
+ }
148
+ case 'creatable':
149
+ SelectElement = ((0, jsx_runtime_1.jsx)(creatable_1.default, Object.assign({ name: identifier, inputId: identifier, components: ComponentOverrides }, MergedSelectProps, { styles: Object.assign(Object.assign({}, StyleOverrides), selectProps === null || selectProps === void 0 ? void 0 : selectProps.styles) })));
150
+ break;
151
+ default:
152
+ SelectElement = ((0, jsx_runtime_1.jsx)(react_select_1.default, Object.assign({ name: identifier, inputId: identifier, components: ComponentOverrides }, MergedSelectProps, { styles: Object.assign(Object.assign({}, StyleOverrides), selectProps === null || selectProps === void 0 ? void 0 : selectProps.styles) })));
153
+ }
154
+ return ((0, jsx_runtime_1.jsxs)(Component, Object.assign({ ref: ref }, RestProps, { className: (0, classnames_1.default)('ndl-dropdown', size, {
155
+ fluid,
156
+ }) }, { children: [label && (0, jsx_runtime_1.jsx)("label", Object.assign({ htmlFor: identifier }, { children: label })), SelectElement, helpText && !errorText && (0, jsx_runtime_1.jsx)("span", Object.assign({ className: "sub-text" }, { children: helpText })), errorText && (0, jsx_runtime_1.jsx)("span", Object.assign({ className: "sub-text error-text" }, { children: errorText }))] })));
157
+ });
158
+ //# sourceMappingURL=Dropdown.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Dropdown.js","sourceRoot":"","sources":["../../../src/dropdown/Dropdown.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,iCAAuC;AACvC,4DAAoC;AACpC,kFAA0D;AAE1D,2CAA2C;AAC3C,gEAAiD;AACjD,uEAA+C;AAC/C,+DAA6C;AAE7C,wCAAwC;AACxC,4CAAwD;AAMxD,2CAKqB;AAErB;;;;;;GAMG;AAEH,MAAM,kBAAkB,GAAG,CAKzB,KAAmE,EACnE,EAAE,CACF,CAAC;IACC,iBAAiB,EAAE,IAAA,qCAAyB,EAAC,KAA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AC,sBAAM,kBACL,IAAI,EAAE,UAAU,EAChB,OAAO,EAAE,UAAU,EACnB,UAAU,EAAE,kBAAkB,IAC1B,iBAAiB,IACrB,MAAM,kCAAO,cAAc,GAAK,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,MAAM,KACnD,CACH,CAAC;KACL;IAED,OAAO,CACL,wBAAC,SAAS,kBACR,GAAG,EAAE,GAAG,IACJ,SAAS,IACb,SAAS,EAAE,IAAA,oBAAU,EAAC,cAAc,EAAE,IAAI,EAAE;YAC1C,KAAK;SACN,CAAC,iBAED,KAAK,IAAI,gDAAO,OAAO,EAAE,UAAU,gBAAG,KAAK,IAAS,EACpD,aAAa,EACb,QAAQ,IAAI,CAAC,SAAS,IAAI,+CAAM,SAAS,EAAC,UAAU,gBAAE,QAAQ,IAAQ,EACtE,SAAS,IAAI,+CAAM,SAAS,EAAC,qBAAqB,gBAAE,SAAS,IAAQ,KAC5D,CACb,CAAC;AACJ,CAAC,CAAC,CAAC"}
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CustomPlaceholder = exports.CustomMultiValueRemove = exports.CustomClearIndication = exports.DropdownIndicatorCurrying = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ /**
6
+ *
7
+ * Copyright (c) "Neo4j"
8
+ * Neo4j Sweden AB [http://neo4j.com]
9
+ *
10
+ * This file is part of Neo4j.
11
+ *
12
+ * Neo4j is free software: you can redistribute it and/or modify
13
+ * it under the terms of the GNU General Public License as published by
14
+ * the Free Software Foundation, either version 3 of the License, or
15
+ * (at your option) any later version.
16
+ *
17
+ * This program is distributed in the hope that it will be useful,
18
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
19
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20
+ * GNU General Public License for more details.
21
+ *
22
+ * You should have received a copy of the GNU General Public License
23
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
24
+ */
25
+ const react_select_1 = require("react-select");
26
+ const icons_1 = require("../icons");
27
+ const DropdownIndicatorCurrying = ({ errorText, size, }) => function Component(props) {
28
+ return ((0, jsx_runtime_1.jsx)(react_select_1.components.DropdownIndicator, Object.assign({}, props, { children: (0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "n-flex n-flex-row n-gap-3" }, { children: [(0, jsx_runtime_1.jsx)(icons_1.HeroIcon, { className: `dropdown-icon ${size}`, iconName: "ChevronDownIcon", style: {
29
+ transform: props.selectProps.menuIsOpen
30
+ ? 'rotate(180deg)'
31
+ : 'rotate(0deg)',
32
+ transitionDuration: '150ms',
33
+ } }), errorText && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", { className: "indicator" }), (0, jsx_runtime_1.jsx)(icons_1.HeroIcon, { className: `error-icon ${size}`, role: "img", type: "solid", iconName: "ExclamationCircleIcon" })] }))] })) })));
34
+ };
35
+ exports.DropdownIndicatorCurrying = DropdownIndicatorCurrying;
36
+ const CustomClearIndication = ({ errorText, size, }) => function Component(props) {
37
+ return ((0, jsx_runtime_1.jsx)(react_select_1.components.ClearIndicator, Object.assign({}, props, { children: (0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "n-flex n-flex-row n-gap-3" }, { children: [(0, jsx_runtime_1.jsx)(icons_1.HeroIcon, { className: "n-w-5 n-h-5 n-text-light-neutral-text-weak", iconName: "XIcon" }), (0, jsx_runtime_1.jsx)("div", { className: "indicator" })] })) })));
38
+ };
39
+ exports.CustomClearIndication = CustomClearIndication;
40
+ const CustomMultiValueRemove = ({ errorText, size, }) => function Component(props) {
41
+ return ((0, jsx_runtime_1.jsx)(react_select_1.components.MultiValueRemove, Object.assign({}, props, { children: (0, jsx_runtime_1.jsx)(icons_1.HeroIcon, { className: "n-text-light-neutral-text-weak", style: {
42
+ height: size === 'small' ? '16px' : '20px',
43
+ }, iconName: "XIcon" }) })));
44
+ };
45
+ exports.CustomMultiValueRemove = CustomMultiValueRemove;
46
+ const CustomPlaceholder = ({ errorText, size, }) => function Component(props) {
47
+ return ((0, jsx_runtime_1.jsx)(react_select_1.components.Placeholder, Object.assign({}, props, { children: (0, jsx_runtime_1.jsx)("div", Object.assign({ className: "n-text-light-neutral-text-weaker n-whitespace-nowrap" }, { children: props.children })) })));
48
+ };
49
+ exports.CustomPlaceholder = CustomPlaceholder;
50
+ //# sourceMappingURL=Overrides.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Overrides.js","sourceRoot":"","sources":["../../../src/dropdown/Overrides.tsx"],"names":[],"mappings":";;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,+CAOsB;AACtB,oCAAoC;AAG7B,MAAM,yBAAyB,GAAG,CAIvC,EACA,SAAS,EACT,IAAI,GACyD,EAAE,EAAE,CACjE,SAAS,SAAS,CAChB,KAA6D;IAE7D,OAAO,CACL,uBAAC,yBAAU,CAAC,iBAAiB,oBAAK,KAAK,cACrC,+CAAK,SAAS,EAAC,2BAA2B,iBACxC,uBAAC,gBAAQ,IACP,SAAS,EAAE,iBAAiB,IAAI,EAAE,EAClC,QAAQ,EAAC,iBAAiB,EAC1B,KAAK,EAAE;wBACL,SAAS,EAAE,KAAK,CAAC,WAAW,CAAC,UAAU;4BACrC,CAAC,CAAC,gBAAgB;4BAClB,CAAC,CAAC,cAAc;wBAClB,kBAAkB,EAAE,OAAO;qBAC5B,GACD,EACD,SAAS,IAAI,CACZ,6DACE,gCAAK,SAAS,EAAC,WAAW,GAAG,EAC7B,uBAAC,gBAAQ,IACP,SAAS,EAAE,cAAc,IAAI,EAAE,EAC/B,IAAI,EAAC,KAAK,EACV,IAAI,EAAC,OAAO,EACZ,QAAQ,EAAC,uBAAuB,GAChC,IACD,CACJ,KACG,IACuB,CAChC,CAAC;AACJ,CAAC,CAAC;AAtCS,QAAA,yBAAyB,6BAsClC;AAEG,MAAM,qBAAqB,GAAG,CAInC,EACA,SAAS,EACT,IAAI,GACyD,EAAE,EAAE,CACjE,SAAS,SAAS,CAChB,KAA0D;IAE1D,OAAO,CACL,uBAAC,yBAAU,CAAC,cAAc,oBAAK,KAAK,cAClC,+CAAK,SAAS,EAAC,2BAA2B,iBACxC,uBAAC,gBAAQ,IACP,SAAS,EAAC,4CAA4C,EACtD,QAAQ,EAAC,OAAO,GAChB,EACF,gCAAK,SAAS,EAAC,WAAW,GAAG,KACzB,IACoB,CAC7B,CAAC;AACJ,CAAC,CAAC;AAtBS,QAAA,qBAAqB,yBAsB9B;AAEG,MAAM,sBAAsB,GAAG,CAIpC,EACA,SAAS,EACT,IAAI,GACyD,EAAE,EAAE,CACjE,SAAS,SAAS,CAChB,KAA4D;IAE5D,OAAO,CACL,uBAAC,yBAAU,CAAC,gBAAgB,oBAAK,KAAK,cACpC,uBAAC,gBAAQ,IACP,SAAS,EAAC,gCAAgC,EAC1C,KAAK,EAAE;gBACL,MAAM,EAAE,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM;aAC3C,EACD,QAAQ,EAAC,OAAO,GAChB,IAC0B,CAC/B,CAAC;AACJ,CAAC,CAAC;AAtBS,QAAA,sBAAsB,0BAsB/B;AAEG,MAAM,iBAAiB,GAAG,CAI/B,EACA,SAAS,EACT,IAAI,GACyD,EAAE,EAAE,CACjE,SAAS,SAAS,CAAC,KAAuD;IACxE,OAAO,CACL,uBAAC,yBAAU,CAAC,WAAW,oBAAK,KAAK,cAC/B,8CAAK,SAAS,EAAC,sDAAsD,gBAClE,KAAK,CAAC,QAAQ,IACX,IACiB,CAC1B,CAAC;AACJ,CAAC,CAAC;AAhBS,QAAA,iBAAiB,qBAgB1B"}
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ /**
3
+ *
4
+ * Copyright (c) "Neo4j"
5
+ * Neo4j Sweden AB [http://neo4j.com]
6
+ *
7
+ * This file is part of Neo4j.
8
+ *
9
+ * Neo4j is free software: you can redistribute it and/or modify
10
+ * it under the terms of the GNU General Public License as published by
11
+ * the Free Software Foundation, either version 3 of the License, or
12
+ * (at your option) any later version.
13
+ *
14
+ * This program is distributed in the hope that it will be useful,
15
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
16
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
+ * GNU General Public License for more details.
18
+ *
19
+ * You should have received a copy of the GNU General Public License
20
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
21
+ */
22
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
23
+ if (k2 === undefined) k2 = k;
24
+ var desc = Object.getOwnPropertyDescriptor(m, k);
25
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
26
+ desc = { enumerable: true, get: function() { return m[k]; } };
27
+ }
28
+ Object.defineProperty(o, k2, desc);
29
+ }) : (function(o, m, k, k2) {
30
+ if (k2 === undefined) k2 = k;
31
+ o[k2] = m[k];
32
+ }));
33
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
34
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
35
+ };
36
+ Object.defineProperty(exports, "__esModule", { value: true });
37
+ __exportStar(require("./Dropdown"), exports);
38
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/dropdown/index.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;;;;;;;;;;;;;;;;AAEH,6CAA2B"}
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ /**
3
+ *
4
+ * Copyright (c) "Neo4j"
5
+ * Neo4j Sweden AB [http://neo4j.com]
6
+ *
7
+ * This file is part of Neo4j.
8
+ *
9
+ * Neo4j is free software: you can redistribute it and/or modify
10
+ * it under the terms of the GNU General Public License as published by
11
+ * the Free Software Foundation, either version 3 of the License, or
12
+ * (at your option) any later version.
13
+ *
14
+ * This program is distributed in the hope that it will be useful,
15
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
16
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
+ * GNU General Public License for more details.
18
+ *
19
+ * You should have received a copy of the GNU General Public License
20
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
21
+ */
22
+ Object.defineProperty(exports, "__esModule", { value: true });
23
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/dropdown/types.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG"}
package/lib/cjs/index.js CHANGED
@@ -53,4 +53,6 @@ __exportStar(require("./progress-bar"), exports);
53
53
  __exportStar(require("./table"), exports);
54
54
  __exportStar(require("./drag-and-drop"), exports);
55
55
  __exportStar(require("./text-input"), exports);
56
+ __exportStar(require("./dropdown"), exports);
57
+ __exportStar(require("./tag"), exports);
56
58
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;;;;;;;;;;;;;;;;AAEH,2CAAyB;AACzB,0CAAwB;AACxB,0CAAwB;AACxB,4CAA0B;AAC1B,6CAA2B;AAC3B,2CAAyB;AACzB,0CAAwB;AACxB,iDAA+B;AAC/B,2CAAyB;AACzB,0CAAwB;AACxB,oDAAkC;AAClC,yCAAuB;AACvB,kDAAgC;AAChC,4CAA0B;AAC1B,0CAAwB;AACxB,iDAA+B;AAC/B,0CAAwB;AACxB,kDAAgC;AAChC,+CAA6B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;;;;;;;;;;;;;;;;AAEH,2CAAyB;AACzB,0CAAwB;AACxB,0CAAwB;AACxB,4CAA0B;AAC1B,6CAA2B;AAC3B,2CAAyB;AACzB,0CAAwB;AACxB,iDAA+B;AAC/B,2CAAyB;AACzB,0CAAwB;AACxB,oDAAkC;AAClC,yCAAuB;AACvB,kDAAgC;AAChC,4CAA0B;AAC1B,0CAAwB;AACxB,iDAA+B;AAC/B,0CAAwB;AACxB,kDAAgC;AAChC,+CAA6B;AAC7B,6CAA2B;AAC3B,wCAAsB"}
@@ -66,7 +66,11 @@ exports.ResizingBar = (0, react_1.memo)(function ResizingBarMemoed(props) {
66
66
  * The left section of the bottom navigation
67
67
  * that is showing the current page and how many results we can see
68
68
  */
69
- const TableResults = ({ pageIndex, pageLength, rowsLength, }) => ((0, jsx_runtime_1.jsx)("span", Object.assign({ className: "n-text-light-neutral-text-weaker body-medium n-whitespace-nowrap" }, { children: (0, jsx_runtime_1.jsxs)("span", { children: ["Showing", ' ', (0, jsx_runtime_1.jsxs)("b", { children: [pageIndex * 10, "-", pageIndex * 10 + pageLength] }), ' ', "of ", (0, jsx_runtime_1.jsx)("b", { children: rowsLength }), " results"] }) })));
69
+ const TableResults = ({ pageIndex, pageLength, rowsLength, }) => {
70
+ const from = Math.min(rowsLength, 1 + (pageIndex * pageLength));
71
+ const to = Math.min(rowsLength, pageIndex * pageLength + pageLength);
72
+ return ((0, jsx_runtime_1.jsx)("span", Object.assign({ className: "n-text-light-neutral-text-weaker body-medium n-whitespace-nowrap" }, { children: (0, jsx_runtime_1.jsxs)("span", { children: ["Showing ", (0, jsx_runtime_1.jsxs)("b", { children: [from, to !== from && `-${to}`] }), " of ", (0, jsx_runtime_1.jsx)("b", { children: rowsLength }), " results"] }) })));
73
+ };
70
74
  exports.TableResults = TableResults;
71
75
  /**
72
76
  * Modified from here: https://gist.github.com/kottenator/9d936eb3e4e3c3e02598
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../src/table/helpers.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,oCAAoC;AACpC,iCAA6B;AAG7B;;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,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,CAAC,IAAI,IAAI,IAAI,CAAC,GAAG,KAAK,CAAC,EAAE;YACrD,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;SACf;KACF;IAED,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE;QACxC,IAAI,CAAC,EAAE;YACL,IAAI,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE;gBACtB,aAAa,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;aAC3B;iBAAM,IAAI,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE;gBAC7B,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;aAC3B;SACF;QACD,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;QAC7B,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;KACd;IAED,OAAO,aAAa,CAAC;AACvB,CAAC,CAAC;AA5BW,QAAA,sBAAsB,0BA4BjC;AAEF;;;GAGG;AACI,MAAM,kBAAkB,GAAG,CAAC,IAAc,EAAE,GAAW,EAAE,EAAE;IAChE,yBAAyB;IACzB,IAAI,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;QACtB,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC;KACtC;IACD,qBAAqB;IACrB,OAAO,CAAC,GAAG,IAAI,EAAE,GAAG,CAAC,CAAC;AACxB,CAAC,CAAC;AAPW,QAAA,kBAAkB,sBAO7B"}
@@ -1,4 +1,27 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
2
25
  var __rest = (this && this.__rest) || function (s, e) {
3
26
  var t = {};
4
27
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
@@ -35,9 +58,10 @@ const jsx_runtime_1 = require("react/jsx-runtime");
35
58
  * You should have received a copy of the GNU General Public License
36
59
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
37
60
  */
38
- const react_1 = __importDefault(require("react"));
61
+ const react_1 = __importStar(require("react"));
39
62
  const classnames_1 = __importDefault(require("classnames"));
40
63
  const icons_1 = require("../icons");
64
+ const utils_1 = require("../_common/utils");
41
65
  /**
42
66
  *
43
67
  *
@@ -56,12 +80,17 @@ const icons_1 = require("../icons");
56
80
  const Tag = react_1.default.forwardRef(function Tag(props, ref) {
57
81
  const { children, type = 'default', removeable, onRemove } = props, rest = __rest(props, ["children", "type", "removeable", "onRemove"]);
58
82
  if (removeable && typeof onRemove !== 'function') {
59
- console.error('Tag element is removable but onRemove prop is not a function or provided');
83
+ (0, utils_1.needleWarningMessage)('Tag element is removable but onRemove prop is not a function or provided');
60
84
  }
61
- const classes = (0, classnames_1.default)(`ndl-tag`, type, {
85
+ const classes = (0, classnames_1.default)(`ndl-tag`, type, props.className, {
62
86
  removeable: removeable,
63
87
  });
64
- return ((0, jsx_runtime_1.jsxs)("div", Object.assign({}, rest, { className: classes, ref: ref }, { children: [children, removeable && ((0, jsx_runtime_1.jsx)("button", Object.assign({ type: "button", className: "remove-icon", onClick: onRemove }, { children: (0, jsx_runtime_1.jsx)(icons_1.HeroIcon, { iconName: "XIcon" }) })))] })));
88
+ const keyDownHandler = (0, react_1.useCallback)((e) => {
89
+ if (e.key === 'Enter') {
90
+ onRemove && onRemove(e);
91
+ }
92
+ }, [onRemove]);
93
+ return ((0, jsx_runtime_1.jsxs)("div", Object.assign({}, rest, { className: classes, ref: ref }, { children: [children, removeable && ((0, jsx_runtime_1.jsx)("button", Object.assign({ type: "button", className: "remove-icon", onKeyDown: keyDownHandler, onClick: onRemove }, { children: (0, jsx_runtime_1.jsx)(icons_1.HeroIcon, { iconName: "XIcon" }) })))] })));
65
94
  });
66
95
  exports.default = Tag;
67
96
  //# sourceMappingURL=Tag.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Tag.js","sourceRoot":"","sources":["../../../src/tag/Tag.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,kDAA0B;AAC1B,4DAAoC;AACpC,oCAAoC;AAgCpC;;;;;;GAMG;AAEH,qCAAqC;AAErC;;;;;;GAMG;AAEH,MAAM,GAAG,GAAG,eAAK,CAAC,UAAU,CAAC,SAAS,GAAG,CACvC,KAAe,EACf,GAAuC;IAEvC,MAAM,EAAE,QAAQ,EAAE,IAAI,GAAG,SAAS,EAAE,UAAU,EAAE,QAAQ,KAAc,KAAK,EAAd,IAAI,UAAK,KAAK,EAArE,8CAA6D,CAAQ,CAAC;IAE5E,IAAI,UAAU,IAAI,OAAO,QAAQ,KAAK,UAAU,EAAE;QAChD,OAAO,CAAC,KAAK,CACX,0EAA0E,CAC3E,CAAC;KACH;IAED,MAAM,OA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IAAI,CAAC,CAAC,GAAG,KAAK,OAAO,EAAE;YACrB,QAAQ,IAAI,QAAQ,CAAC,CAAC,CAAC,CAAC;SACzB;IACH,CAAC,EACD,CAAC,QAAQ,CAAC,CACX,CAAC;IAEF,OAAO,CACL,iDAAS,IAAI,IAAE,SAAS,EAAE,OAAO,EAAE,GAAG,EAAE,GAAG,iBACxC,QAAQ,EACR,UAAU,IAAI,CACb,iDACE,IAAI,EAAC,QAAQ,EACb,SAAS,EAAC,aAAa,EACvB,SAAS,EAAE,cAAc,EACzB,OAAO,EAAE,QAAQ,gBAEjB,uBAAC,gBAAQ,IAAC,QAAQ,EAAC,OAAO,GAAG,IACtB,CACV,KACG,CACP,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,kBAAe,GAAG,CAAC"}
@@ -1,3 +1,14 @@
1
+ var __rest = (this && this.__rest) || function (s, e) {
2
+ var t = {};
3
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
+ t[p] = s[p];
5
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
+ t[p[i]] = s[p[i]];
9
+ }
10
+ return t;
11
+ };
1
12
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
13
  import classnames from 'classnames';
3
14
  import CloudImage from './icons/Cloud';
@@ -30,7 +41,7 @@ const isFileValid = (fileType, paramAcceptedFiles) => {
30
41
  */
31
42
  const DragAndDrop = (props) => {
32
43
  var _a, _b, _c;
33
- const { dropZoneOptions, supportedFilesDescription, loadingComponent, isTesting, } = props;
44
+ const { dropZoneOptions, supportedFilesDescription, loadingComponent, isTesting } = props, otherProps = __rest(props, ["dropZoneOptions", "supportedFilesDescription", "loadingComponent", "isTesting"]);
34
45
  const { getRootProps, getInputProps, isDragActive, draggedFiles, acceptedFiles, } = useDropzone(Object.assign(Object.assign({
35
46
  // If the developer does not pass this function, then the browser will automatically download the dragged file. To empty function avoids that.
36
47
  onDrop: () => null }, dropZoneOptions), { disabled: (dropZoneOptions === null || dropZoneOptions === void 0 ? void 0 : dropZoneOptions.disabled) || !!loadingComponent }));
@@ -58,7 +69,7 @@ const DragAndDrop = (props) => {
58
69
  'drag-active': isDragActive,
59
70
  'file-invalid': isDragActive && !isDraggedFileValid,
60
71
  });
61
- return (_jsx("div", Object.assign({}, props, { ref: dropZoneRef, className: wrapperClasses }, { children: _jsxs("div", Object.assign({ className: "ndl-drag-and-drop-inner-content" }, getRootProps(), { children: [_jsx("input", Object.assign({}, getInputProps())), _jsxs("div", Object.assign({ className: "ndl-drag-and-drop-inner" }, { children: [_jsxs("div", Object.assign({ className: "ndl-drag-and-drop-header" }, { children: [_jsx("div", Object.assign({ className: "upload-img-wrapper" }, { children: width > 230 && (_jsxs(_Fragment, { children: [(isDragActive || isUploading) && !isTesting && (_jsx("span", Object.assign({ className: "upload-img-label" }, { children: getFileTypeAbbr(isUploading
72
+ return (_jsx("div", Object.assign({}, otherProps, { ref: dropZoneRef, className: wrapperClasses }, { children: _jsxs("div", Object.assign({ className: "ndl-drag-and-drop-inner-content" }, getRootProps(), { children: [_jsx("input", Object.assign({}, getInputProps())), _jsxs("div", Object.assign({ className: "ndl-drag-and-drop-inner" }, { children: [_jsxs("div", Object.assign({ className: "ndl-drag-and-drop-header" }, { children: [_jsx("div", Object.assign({ className: "upload-img-wrapper" }, { children: width > 230 && (_jsxs(_Fragment, { children: [(isDragActive || isUploading) && !isTesting && (_jsx("span", Object.assign({ className: "upload-img-label" }, { children: getFileTypeAbbr(isUploading
62
73
  ? (_b = acceptedFiles[0]) === null || _b === void 0 ? void 0 : _b.type
63
74
  : (_c = draggedFiles[0]) === null || _c === void 0 ? void 0 : _c.type) }))), isUploading || isDragActive ? (computedFileImage) : (_jsx(CloudImage, {}))] })) })), !isUploading && (_jsxs("div", Object.assign({ className: "dnd-title-container" }, { children: [_jsxs("h5", Object.assign({ className: "dnd-title" }, { children: ["Drag ", _jsx("span", Object.assign({ className: "n-font-light" }, { children: "&" })), " Drop"] })), _jsxs("div", Object.assign({ className: "dnd-subtitle" }, { children: [_jsx("span", { children: "or" }), ' ', _jsx("span", Object.assign({ className: "dnd-browse-link" }, { children: "browse" }))] }))] })))] })), _jsxs("div", Object.assign({ className: "ndl-drag-and-drop-footer" }, { children: [isUploading && _jsx(_Fragment, { children: loadingComponent }), !isUploading && (_jsx("div", Object.assign({ className: "ndl-file-support-text" }, { children: supportedFilesDescription })))] }))] }))] })) })));
64
75
  };
@@ -1 +1 @@
1
- {"version":3,"file":"DragAndDrop.js","sourceRoot":"","sources":["../../../src/drag-and-drop/DragAndDrop.tsx"],"names":[],"mappings":";AAsBA,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,UAAU,MAAM,eAAe,CAAC;AACvC,OAAO,SAAS,MAAM,cAAc,CAAC;AACrC,OAAO,gBAAgB,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,EAAmB,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAyB9D;;;;;;GAMG;AAEH,qCAAqC;AAErC,MAAM,WAAW,GAAG,CAClB,QAAgB,EAChB,kBAA8C,EAC9C,EAAE;IACF,IAAI,CAAC,kBAAkB;QAAE,OAAO,IAAI,CAAC;IAErC,MAAM,iBAAiB,GAAG,KAAK,CAAC,OAAO,CAAC,kBAAkB,CAAC;QACzD,CAAC,CAAC,kBAAkB,CAAC,IAAI,CAAC,GAAG,CAAC;QAC9B,CAAC,CAAC,kBAAkB,CAAC;IAEvB,OAAO,iBAAiB,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC;AAClD,CAAC,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,WAAW,GAAG,CAAC,KAAuB,EAAE,EAAE;;IAC9C,M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K,SAAS,EAAC,iCAAiC,IAAK,YAAY,EAAE,eACjE,gCAAW,aAAa,EAAE,EAAI,EAC9B,6BAAK,SAAS,EAAC,yBAAyB,iBACtC,6BAAK,SAAS,EAAC,0BAA0B,iBACvC,4BAAK,SAAS,EAAC,oBAAoB,gBAEhC,KAAK,GAAG,GAAG,IAAI,CACd,8BACG,CAAC,YAAY,IAAI,WAAW,CAAC,IAAI,CAAC,SAAS,IAAI,CAC9C,6BAAM,SAAS,EAAC,kBAAkB,gBAC/B,eAAe,CACd,WAAW;oDACT,CAAC,CAAC,MAAA,aAAa,CAAC,CAAC,CAAC,0CAAE,IAAI;oDACxB,CAAC,CAAC,MAAA,YAAY,CAAC,CAAC,CAAC,0CAAE,IAAI,CAC1B,IACI,CACR,EAEA,WAAW,IAAI,YAAY,CAAC,CAAC,CAAC,CAC7B,iBAAiB,CAClB,CAAC,CAAC,CAAC,CACF,KAAC,UAAU,KAAG,CACf,IACA,CACJ,IACG,EACL,CAAC,WAAW,IAAI,CACf,6BAAK,SAAS,EAAC,qBAAqB,iBAClC,4BAAI,SAAS,EAAC,WAAW,0BAClB,6BAAM,SAAS,EAAC,cAAc,uBAAS,cACzC,EACL,6BAAK,SAAS,EAAC,cAAc,iBAC3B,gCAAe,EAAC,GAAG,EACnB,6BAAM,SAAS,EAAC,iBAAiB,4BAAc,KAC3C,KACF,CACP,KACG,EACN,6BAAK,SAAS,EAAC,0BAA0B,iBACtC,WAAW,IAAI,4BAAG,gBAAgB,GAAI,EACtC,CAAC,WAAW,IAAI,CACf,4BAAK,SAAS,EAAC,uBAAuB,gBACnC,yBAAyB,IACtB,CACP,KACG,KACF,KACF,IACF,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,WAAW,CAAC"}
@@ -0,0 +1,152 @@
1
+ var __rest = (this && this.__rest) || function (s, e) {
2
+ var t = {};
3
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
+ t[p] = s[p];
5
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
+ t[p[i]] = s[p[i]];
9
+ }
10
+ return t;
11
+ };
12
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
+ /**
14
+ *
15
+ * Copyright (c) "Neo4j"
16
+ * Neo4j Sweden AB [http://neo4j.com]
17
+ *
18
+ * This file is part of Neo4j.
19
+ *
20
+ * Neo4j is free software: you can redistribute it and/or modify
21
+ * it under the terms of the GNU General Public License as published by
22
+ * the Free Software Foundation, either version 3 of the License, or
23
+ * (at your option) any later version.
24
+ *
25
+ * This program is distributed in the hope that it will be useful,
26
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
27
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
28
+ * GNU General Public License for more details.
29
+ *
30
+ * You should have received a copy of the GNU General Public License
31
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
32
+ */
33
+ import { useMemo } from 'react';
34
+ import classnames from 'classnames';
35
+ import tokens from '@neo4j-ndl/base/lib/tokens/js/tokens';
36
+ /** Different types of select components */
37
+ import Select from 'react-select';
38
+ import Creatable from 'react-select/creatable';
39
+ import AsyncSelect from 'react-select/async';
40
+ import { forwardRef } from '../helpers';
41
+ import { needleWarningMessage } from '../_common/utils';
42
+ import { CustomClearIndication, CustomMultiValueRemove, CustomPlaceholder, DropdownIndicatorCurrying, } from './Overrides';
43
+ /**
44
+ *
45
+ *
46
+ * Helpers
47
+ *
48
+ *
49
+ */
50
+ const overrideComponents = (props) => ({
51
+ DropdownIndicator: DropdownIndicatorCurrying(props),
52
+ IndicatorSeparator: null,
53
+ ClearIndicator: CustomClearIndication(props),
54
+ MultiValueRemove: CustomMultiValueRemove(props),
55
+ Placeholder: CustomPlaceholder(props),
56
+ });
57
+ const customStyles = ({ errorText, size, }) => {
58
+ const focusedBorderColor = errorText
59
+ ? tokens.palette.light.danger.border.strong
60
+ : tokens.palette.light.primary.focus;
61
+ const defaultBorder = errorText
62
+ ? tokens.palette.light.danger.border.strong
63
+ : tokens.palette.light.neutral.border.strong;
64
+ return {
65
+ control: (provided, state) => (Object.assign(Object.assign({}, provided), { minHeight: size === 'small' ? '36px' : '48px',
66
+ // Avoid shifting with border of 2px
67
+ // Source: https://stackoverflow.com/a/9612782/3247715
68
+ boxShadow: state.isFocused ? `0 0 0 2px ${focusedBorderColor}` : 'none', outline: 'none', border: state.isFocused
69
+ ? `1px solid ${focusedBorderColor}`
70
+ : `1px solid ${defaultBorder}`, '&:hover': {
71
+ border: state.isFocused
72
+ ? `1px solid ${focusedBorderColor}`
73
+ : `1px solid ${defaultBorder}`,
74
+ } })),
75
+ multiValue: (provided) => (Object.assign(Object.assign({}, provided), { borderRadius: '4px', height: '28px' })),
76
+ indicatorsContainer: (provided) => (Object.assign(Object.assign({}, provided), {
77
+ /**
78
+ * The right icon has padding of 8px so:
79
+ * padding-right: 8px+desired
80
+ */
81
+ paddingRight: size === 'small' ? '4px' : '8px' })),
82
+ /**
83
+ * Only for multi-select, make the padding
84
+ * 2px everywhere when we have at least one
85
+ * value selected
86
+ */
87
+ valueContainer: (provided, state) => (Object.assign(Object.assign({}, provided), { padding: state.isMulti && state.hasValue ? '2px' : '2px 8px' })),
88
+ menuList: (provided) => (Object.assign(Object.assign({}, provided), { padding: size === 'small' ? '16px 12px' : '16px 16px' })),
89
+ option: (provided, state) => (Object.assign(Object.assign({}, provided), { borderRadius: '4px', backgroundColor: state.isSelected
90
+ ? tokens.palette.light.neutral.bg.strong
91
+ : 'transparent', color: tokens.palette.light.neutral.text.default, '&:hover': {
92
+ backgroundColor: state.isSelected
93
+ ? tokens.palette.light.neutral.bg.strong
94
+ : tokens.palette.light.neutral.bg.default,
95
+ } })),
96
+ };
97
+ };
98
+ const ExposedKeys = [
99
+ 'onChange',
100
+ 'isMulti',
101
+ 'isClearable',
102
+ 'formatOptionLabel',
103
+ 'value',
104
+ 'placeholder',
105
+ 'options',
106
+ ];
107
+ export const Dropdown = forwardRef(function Dropdown(props, ref) {
108
+ const { as, label, helpText, errorText, fluid = true, size = 'small', type = 'select', selectProps = {}, 'aria-label': ariaLabel } = props, rest = __rest(props, ["as", "label", "helpText", "errorText", "fluid", "size", "type", "selectProps", 'aria-label']);
109
+ const Component = as || 'div';
110
+ /**
111
+ * Merge selectProps with exposed react-select props
112
+ * Priority is given to selectProps
113
+ * Source: https://stackoverflow.com/a/32184094/3247715
114
+ */
115
+ const MergedSelectProps = useMemo(() => ExposedKeys.reduce((a, e) => ((a[e] = selectProps[e] || rest[e]), a), selectProps), [rest, selectProps]);
116
+ /**
117
+ * Remove selectProps from rest
118
+ * to spread them in the root component
119
+ */
120
+ const RestProps = useMemo(() => {
121
+ const cloned = Object.assign({}, rest);
122
+ ExposedKeys.forEach((key) => delete cloned[key]);
123
+ return cloned;
124
+ }, [rest]);
125
+ const ComponentOverrides = useMemo(() => overrideComponents({ errorText, size }), [errorText, size]);
126
+ const StyleOverrides = useMemo(() => customStyles({ errorText, size }), [errorText, size]);
127
+ const identifier = useMemo(() => {
128
+ if (typeof label === 'string')
129
+ return label;
130
+ if (ariaLabel)
131
+ return ariaLabel;
132
+ needleWarningMessage('Consider adding an aria-label to make the select more accessible');
133
+ // 7 char long pseudo-random string
134
+ return Math.random().toString(36).slice(2, 9);
135
+ }, [label, ariaLabel]);
136
+ let SelectElement;
137
+ switch (type) {
138
+ case 'async-select': {
139
+ SelectElement = (_jsx(AsyncSelect, Object.assign({ name: identifier, inputId: identifier, components: ComponentOverrides }, MergedSelectProps, { styles: Object.assign(Object.assign({}, StyleOverrides), selectProps === null || selectProps === void 0 ? void 0 : selectProps.styles) })));
140
+ break;
141
+ }
142
+ case 'creatable':
143
+ SelectElement = (_jsx(Creatable, Object.assign({ name: identifier, inputId: identifier, components: ComponentOverrides }, MergedSelectProps, { styles: Object.assign(Object.assign({}, StyleOverrides), selectProps === null || selectProps === void 0 ? void 0 : selectProps.styles) })));
144
+ break;
145
+ default:
146
+ SelectElement = (_jsx(Select, Object.assign({ name: identifier, inputId: identifier, components: ComponentOverrides }, MergedSelectProps, { styles: Object.assign(Object.assign({}, StyleOverrides), selectProps === null || selectProps === void 0 ? void 0 : selectProps.styles) })));
147
+ }
148
+ return (_jsxs(Component, Object.assign({ ref: ref }, RestProps, { className: classnames('ndl-dropdown', size, {
149
+ fluid,
150
+ }) }, { children: [label && _jsx("label", Object.assign({ htmlFor: identifier }, { children: label })), SelectElement, helpText && !errorText && _jsx("span", Object.assign({ className: "sub-text" }, { children: helpText })), errorText && _jsx("span", Object.assign({ className: "sub-text error-text" }, { children: errorText }))] })));
151
+ });
152
+ //# sourceMappingURL=Dropdown.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Dropdown.js","sourceRoot":"","sources":["../../../src/dropdown/Dropdown.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAc,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,MAAM,MAAM,sCAAsC,CAAC;AAE1D,2CAA2C;AAC3C,OAAO,MAAqB,MAAM,cAAc,CAAC;AACjD,OAAO,SAAS,MAAM,wBAAwB,CAAC;AAC/C,OAAO,WAAW,MAAM,oBAAoB,CAAC;AAE7C,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAMxD,OAAO,EACL,qBAAqB,EACrB,sBAAsB,EACtB,iBAAiB,EACjB,yBAAyB,GAC1B,MAAM,aAAa,CAAC;AAErB;;;;;;GAMG;AAEH,MAAM,kBAAkB,GAAG,CAKzB,KAAmE,EACnE,EAAE,CACF,CAAC;IACC,iBAAiB,EAAE,yBAAyB,CAAC,KAAK,CAAC;IACn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kBAAkB,IAC1B,iBAAiB,IACrB,MAAM,kCAAO,cAAc,GAAK,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,MAAM,KACnD,CACH,CAAC;KACL;IAED,OAAO,CACL,MAAC,SAAS,kBACR,GAAG,EAAE,GAAG,IACJ,SAAS,IACb,SAAS,EAAE,UAAU,CAAC,cAAc,EAAE,IAAI,EAAE;YAC1C,KAAK;SACN,CAAC,iBAED,KAAK,IAAI,8BAAO,OAAO,EAAE,UAAU,gBAAG,KAAK,IAAS,EACpD,aAAa,EACb,QAAQ,IAAI,CAAC,SAAS,IAAI,6BAAM,SAAS,EAAC,UAAU,gBAAE,QAAQ,IAAQ,EACtE,SAAS,IAAI,6BAAM,SAAS,EAAC,qBAAqB,gBAAE,SAAS,IAAQ,KAC5D,CACb,CAAC;AACJ,CAAC,CAAC,CAAC"}
@@ -0,0 +1,43 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ /**
3
+ *
4
+ * Copyright (c) "Neo4j"
5
+ * Neo4j Sweden AB [http://neo4j.com]
6
+ *
7
+ * This file is part of Neo4j.
8
+ *
9
+ * Neo4j is free software: you can redistribute it and/or modify
10
+ * it under the terms of the GNU General Public License as published by
11
+ * the Free Software Foundation, either version 3 of the License, or
12
+ * (at your option) any later version.
13
+ *
14
+ * This program is distributed in the hope that it will be useful,
15
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
16
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
+ * GNU General Public License for more details.
18
+ *
19
+ * You should have received a copy of the GNU General Public License
20
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
21
+ */
22
+ import { components, } from 'react-select';
23
+ import { HeroIcon } from '../icons';
24
+ export const DropdownIndicatorCurrying = ({ errorText, size, }) => function Component(props) {
25
+ return (_jsx(components.DropdownIndicator, Object.assign({}, props, { children: _jsxs("div", Object.assign({ className: "n-flex n-flex-row n-gap-3" }, { children: [_jsx(HeroIcon, { className: `dropdown-icon ${size}`, iconName: "ChevronDownIcon", style: {
26
+ transform: props.selectProps.menuIsOpen
27
+ ? 'rotate(180deg)'
28
+ : 'rotate(0deg)',
29
+ transitionDuration: '150ms',
30
+ } }), errorText && (_jsxs(_Fragment, { children: [_jsx("div", { className: "indicator" }), _jsx(HeroIcon, { className: `error-icon ${size}`, role: "img", type: "solid", iconName: "ExclamationCircleIcon" })] }))] })) })));
31
+ };
32
+ export const CustomClearIndication = ({ errorText, size, }) => function Component(props) {
33
+ return (_jsx(components.ClearIndicator, Object.assign({}, props, { children: _jsxs("div", Object.assign({ className: "n-flex n-flex-row n-gap-3" }, { children: [_jsx(HeroIcon, { className: "n-w-5 n-h-5 n-text-light-neutral-text-weak", iconName: "XIcon" }), _jsx("div", { className: "indicator" })] })) })));
34
+ };
35
+ export const CustomMultiValueRemove = ({ errorText, size, }) => function Component(props) {
36
+ return (_jsx(components.MultiValueRemove, Object.assign({}, props, { children: _jsx(HeroIcon, { className: "n-text-light-neutral-text-weak", style: {
37
+ height: size === 'small' ? '16px' : '20px',
38
+ }, iconName: "XIcon" }) })));
39
+ };
40
+ export const CustomPlaceholder = ({ errorText, size, }) => function Component(props) {
41
+ return (_jsx(components.Placeholder, Object.assign({}, props, { children: _jsx("div", Object.assign({ className: "n-text-light-neutral-text-weaker n-whitespace-nowrap" }, { children: props.children })) })));
42
+ };
43
+ //# sourceMappingURL=Overrides.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Overrides.js","sourceRoot":"","sources":["../../../src/dropdown/Overrides.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EAEL,UAAU,GAKX,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAGpC,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAIvC,EACA,SAAS,EACT,IAAI,GACyD,EAAE,EAAE,CACjE,SAAS,SAAS,CAChB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AAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM;aAC3C,EACD,QAAQ,EAAC,OAAO,GAChB,IAC0B,CAC/B,CAAC;AACJ,CAAC,CAAC;AAEJ,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAI/B,EACA,SAAS,EACT,IAAI,GACyD,EAAE,EAAE,CACjE,SAAS,SAAS,CAAC,KAAuD;IACxE,OAAO,CACL,KAAC,UAAU,CAAC,WAAW,oBAAK,KAAK,cAC/B,4BAAK,SAAS,EAAC,sDAAsD,gBAClE,KAAK,CAAC,QAAQ,IACX,IACiB,CAC1B,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1,22 @@
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 './Dropdown';
22
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/dropdown/index.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,cAAc,YAAY,CAAC"}
@@ -0,0 +1,22 @@
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 {};
22
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/dropdown/types.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG"}
package/lib/esm/index.js CHANGED
@@ -37,4 +37,6 @@ export * from './progress-bar';
37
37
  export * from './table';
38
38
  export * from './drag-and-drop';
39
39
  export * from './text-input';
40
+ export * from './dropdown';
41
+ export * from './tag';
40
42
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,mBAAmB,CAAC;AAClC,cAAc,QAAQ,CAAC;AACvB,cAAc,iBAAiB,CAAC;AAChC,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,SAAS,CAAC;AACxB,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,mBAAmB,CAAC;AAClC,cAAc,QAAQ,CAAC;AACvB,cAAc,iBAAiB,CAAC;AAChC,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,SAAS,CAAC;AACxB,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,OAAO,CAAC"}
@@ -62,7 +62,11 @@ export const ResizingBar = memo(function ResizingBarMemoed(props) {
62
62
  * The left section of the bottom navigation
63
63
  * that is showing the current page and how many results we can see
64
64
  */
65
- export const TableResults = ({ pageIndex, pageLength, rowsLength, }) => (_jsx("span", Object.assign({ className: "n-text-light-neutral-text-weaker body-medium n-whitespace-nowrap" }, { children: _jsxs("span", { children: ["Showing", ' ', _jsxs("b", { children: [pageIndex * 10, "-", pageIndex * 10 + pageLength] }), ' ', "of ", _jsx("b", { children: rowsLength }), " results"] }) })));
65
+ export const TableResults = ({ pageIndex, pageLength, rowsLength, }) => {
66
+ const from = Math.min(rowsLength, 1 + (pageIndex * pageLength));
67
+ const to = Math.min(rowsLength, pageIndex * pageLength + pageLength);
68
+ return (_jsx("span", Object.assign({ className: "n-text-light-neutral-text-weaker body-medium n-whitespace-nowrap" }, { children: _jsxs("span", { children: ["Showing ", _jsxs("b", { children: [from, to !== from && `-${to}`] }), " of ", _jsx("b", { children: rowsLength }), " results"] }) })));
69
+ };
66
70
  /**
67
71
  * Modified from here: https://gist.github.com/kottenator/9d936eb3e4e3c3e02598
68
72
  *
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../src/table/helpers.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AACpC,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AAG7B;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,EAKxB,EAAE,EAAE;QALoB,EACvB,YAAY,OAIb,EAHI,KAAK,cAFe,gBAGxB,CADS;IAIR,QAAQ,IAAI,EAAE;QACZ,KAAK,YAAY,KAAK,IAAI;YACxB,OAAO,CACL,KAAC,QAAQ,oBACH,KAAK,IACT,SAAS,EAAC,aAAa,EACvB,IAAI,EAAC,SAAS,EACd,QAAQ,EAAC,oBAAoB,IAC7B,CACH,CAAC;QACJ,KAAK,YAAY,KAAK,KAAK;YACzB,OAAO,CACL,KAAC,QAAQ,oBACH,KAAK,IACT,SAAS,EAAC,aAAa,EACvB,IAAI,EAAC,SAAS,EACd,QAAQ,EAAC,mBAAmB,IAC5B,CACH,CAAC;QACJ;YACE,OAAO,CACL,KAAC,QAAQ,oBACH,KAAK,IACT,SAAS,EAAC,aAAa,EACvB,IAAI,EAAC,SAAS,EACd,QAAQ,EAAC,cAAc,IACvB,CACH,CAAC;KACL;AACH,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,WAAW,GAAG,IAAI,CAAC,SAAS,iBAAiB,CACxD,KAAwB;IAExB,OAAO,CACL,8BACM,KAAK,IACT,SAAS,EAAC,oBAAoB,EAC9B,KAAK,EAAE;YACL,KAAK,EAAE,KAAK;YACZ,MAAM,EAAE,CAAC;YACT,4DAA4D;YAC5D,WAAW,EAAE,MAAM;SACpB,IACD,CACH,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH;;;GAGG;AACH,MAAM,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AqB;IACrB,OAAO,CAAC,GAAG,IAAI,EAAE,GAAG,CAAC,CAAC;AACxB,CAAC,CAAC"}
@@ -30,9 +30,10 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
30
30
  * You should have received a copy of the GNU General Public License
31
31
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
32
32
  */
33
- import React from 'react';
33
+ import React, { useCallback } from 'react';
34
34
  import classnames from 'classnames';
35
35
  import { HeroIcon } from '../icons';
36
+ import { needleWarningMessage } from '../_common/utils';
36
37
  /**
37
38
  *
38
39
  *
@@ -51,12 +52,17 @@ import { HeroIcon } from '../icons';
51
52
  const Tag = React.forwardRef(function Tag(props, ref) {
52
53
  const { children, type = 'default', removeable, onRemove } = props, rest = __rest(props, ["children", "type", "removeable", "onRemove"]);
53
54
  if (removeable && typeof onRemove !== 'function') {
54
- console.error('Tag element is removable but onRemove prop is not a function or provided');
55
+ needleWarningMessage('Tag element is removable but onRemove prop is not a function or provided');
55
56
  }
56
- const classes = classnames(`ndl-tag`, type, {
57
+ const classes = classnames(`ndl-tag`, type, props.className, {
57
58
  removeable: removeable,
58
59
  });
59
- return (_jsxs("div", Object.assign({}, rest, { className: classes, ref: ref }, { children: [children, removeable && (_jsx("button", Object.assign({ type: "button", className: "remove-icon", onClick: onRemove }, { children: _jsx(HeroIcon, { iconName: "XIcon" }) })))] })));
60
+ const keyDownHandler = useCallback((e) => {
61
+ if (e.key === 'Enter') {
62
+ onRemove && onRemove(e);
63
+ }
64
+ }, [onRemove]);
65
+ return (_jsxs("div", Object.assign({}, rest, { className: classes, ref: ref }, { children: [children, removeable && (_jsx("button", Object.assign({ type: "button", className: "remove-icon", onKeyDown: keyDownHandler, onClick: onRemove }, { children: _jsx(HeroIcon, { iconName: "XIcon" }) })))] })));
60
66
  });
61
67
  export default Tag;
62
68
  //# sourceMappingURL=Tag.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Tag.js","sourceRoot":"","sources":["../../../src/tag/Tag.tsx"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o4j.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
+ import React from 'react';
22
+ /** Different types of select components */
23
+ import { GroupBase } from 'react-select';
24
+ import { SelectExposedProps, DropdownProps } from './types';
25
+ export declare const Dropdown: <OptionType, IsMulti extends boolean = false, GroupType extends GroupBase<OptionType> = GroupBase<OptionType>>(props: Omit<DropdownProps<OptionType, IsMulti, GroupType>, "selectProps"> & Partial<Pick<DropdownProps<OptionType, IsMulti, GroupType>, "selectProps">> & SelectExposedProps<OptionType, IsMulti, GroupType> & React.RefAttributes<unknown>) => React.ReactElement<any, string | React.JSXElementConstructor<any>> | null;
@@ -0,0 +1,27 @@
1
+ /// <reference types="react" />
2
+ /**
3
+ *
4
+ * Copyright (c) "Neo4j"
5
+ * Neo4j Sweden AB [http://neo4j.com]
6
+ *
7
+ * This file is part of Neo4j.
8
+ *
9
+ * Neo4j is free software: you can redistribute it and/or modify
10
+ * it under the terms of the GNU General Public License as published by
11
+ * the Free Software Foundation, either version 3 of the License, or
12
+ * (at your option) any later version.
13
+ *
14
+ * This program is distributed in the hope that it will be useful,
15
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
16
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
+ * GNU General Public License for more details.
18
+ *
19
+ * You should have received a copy of the GNU General Public License
20
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
21
+ */
22
+ import { ClearIndicatorProps, DropdownIndicatorProps, GroupBase, MultiValueRemoveProps, PlaceholderProps } from 'react-select';
23
+ import { ComponentOverrideCustomProps } from './types';
24
+ export declare const DropdownIndicatorCurrying: <OptionType, IsMulti extends boolean = false, GroupType extends GroupBase<OptionType> = GroupBase<OptionType>>({ errorText, size, }: ComponentOverrideCustomProps<OptionType, IsMulti, GroupType>) => (props: DropdownIndicatorProps<OptionType, IsMulti, GroupType>) => JSX.Element;
25
+ export declare const CustomClearIndication: <OptionType, IsMulti extends boolean = false, GroupType extends GroupBase<OptionType> = GroupBase<OptionType>>({ errorText, size, }: ComponentOverrideCustomProps<OptionType, IsMulti, GroupType>) => (props: ClearIndicatorProps<OptionType, IsMulti, GroupType>) => JSX.Element;
26
+ export declare const CustomMultiValueRemove: <OptionType, IsMulti extends boolean = false, GroupType extends GroupBase<OptionType> = GroupBase<OptionType>>({ errorText, size, }: ComponentOverrideCustomProps<OptionType, IsMulti, GroupType>) => (props: MultiValueRemoveProps<OptionType, IsMulti, GroupType>) => JSX.Element;
27
+ export declare const CustomPlaceholder: <OptionType, IsMulti extends boolean = false, GroupType extends GroupBase<OptionType> = GroupBase<OptionType>>({ errorText, size, }: ComponentOverrideCustomProps<OptionType, IsMulti, GroupType>) => (props: PlaceholderProps<OptionType, IsMulti, GroupType>) => JSX.Element;
@@ -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 './Dropdown';
@@ -0,0 +1,69 @@
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
+ /// <reference types="react" />
22
+ import { GroupBase, Props } from 'react-select';
23
+ import { CreatableProps } from 'react-select/creatable';
24
+ import { AsyncProps } from 'react-select/async';
25
+ import { ElementBase } from '../helpers';
26
+ /**
27
+ * We will provide a wrapper to the three distinct select components
28
+ * the library provides:
29
+ * 1. Select (the most simple component)
30
+ * 2. Creatable (for creatign new values in our options)
31
+ * 3. Async for fetching while typing, useful for cases that we avoid storing things
32
+ * in browser
33
+ */
34
+ export declare type ComponentType<OptionType, IsMulti extends boolean = false, GroupType extends GroupBase<OptionType> = GroupBase<OptionType>> = SelectComponent<OptionType, IsMulti, GroupType>['type'] | CreatableComponent<OptionType, IsMulti, GroupType>['type'] | AsyncComponent<OptionType, IsMulti, GroupType>['type'];
35
+ declare type ComponentSelectProps<OptionType, IsMulti extends boolean = false, GroupType extends GroupBase<OptionType> = GroupBase<OptionType>> = SelectComponent<OptionType, IsMulti, GroupType>['selectProps'] | CreatableComponent<OptionType, IsMulti, GroupType>['selectProps'] | AsyncComponent<OptionType, IsMulti, GroupType>['selectProps'];
36
+ interface CommonProps extends Omit<ElementBase<HTMLDivElement>, 'label' | 'value'> {
37
+ /**
38
+ * Error message
39
+ *
40
+ * Note: if it exists the dropdown will be in error state
41
+ */
42
+ errorText?: string;
43
+ /** Dropdown Label */
44
+ label?: string | JSX.Element;
45
+ /** To be used as an attribute in htmlFor */
46
+ 'aria-label'?: string;
47
+ /** Help text */
48
+ helpText?: string;
49
+ /** Size of the component */
50
+ size?: 'small' | 'large';
51
+ /** Displays with fluid width */
52
+ fluid?: boolean;
53
+ }
54
+ declare type SelectComponent<OptionType, IsMulti extends boolean = false, GroupType extends GroupBase<OptionType> = GroupBase<OptionType>> = {
55
+ selectProps: Props<OptionType, IsMulti, GroupType>;
56
+ type: 'select';
57
+ } & CommonProps;
58
+ declare type AsyncComponent<OptionType, IsMulti extends boolean = false, GroupType extends GroupBase<OptionType> = GroupBase<OptionType>> = {
59
+ selectProps: AsyncProps<OptionType, IsMulti, GroupType>;
60
+ type: 'async-select';
61
+ } & CommonProps;
62
+ declare type CreatableComponent<OptionType, IsMulti extends boolean = false, GroupType extends GroupBase<OptionType> = GroupBase<OptionType>> = {
63
+ selectProps: CreatableProps<OptionType, IsMulti, GroupType>;
64
+ type: 'creatable';
65
+ } & CommonProps;
66
+ export declare type DropdownProps<OptionType, IsMulti extends boolean = false, GroupType extends GroupBase<OptionType> = GroupBase<OptionType>> = SelectComponent<OptionType, IsMulti, GroupType> | AsyncComponent<OptionType, IsMulti, GroupType> | CreatableComponent<OptionType, IsMulti, GroupType>;
67
+ export declare type SelectExposedProps<OptionType, IsMulti extends boolean = false, GroupType extends GroupBase<OptionType> = GroupBase<OptionType>> = Pick<ComponentSelectProps<OptionType, IsMulti, GroupType>, 'onChange' | 'isMulti' | 'isClearable' | 'formatOptionLabel' | 'value' | 'placeholder' | 'options'>;
68
+ export declare type ComponentOverrideCustomProps<OptionType, IsMulti extends boolean = false, GroupType extends GroupBase<OptionType> = GroupBase<OptionType>> = Pick<DropdownProps<OptionType, IsMulti, GroupType>, 'size' | 'errorText'>;
69
+ export {};
@@ -37,3 +37,5 @@ export * from './progress-bar';
37
37
  export * from './table';
38
38
  export * from './drag-and-drop';
39
39
  export * from './text-input';
40
+ export * from './dropdown';
41
+ export * from './tag';
@@ -19,6 +19,7 @@
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';
22
23
  /**
23
24
  *
24
25
  *
@@ -26,7 +27,7 @@ import React from 'react';
26
27
  *
27
28
  *
28
29
  */
29
- interface CommonTagProps {
30
+ interface CommonTagProps extends ElementBase {
30
31
  children: string | React.ReactNode;
31
32
  /** Type of the tag */
32
33
  type?: 'destructive' | 'default';
@@ -35,7 +36,7 @@ interface RemoveableTagProps extends CommonTagProps {
35
36
  /** Adds a "x" icon is set to true */
36
37
  removeable: true;
37
38
  /** Handler when remove icon is clicked. Required if `removeable` is true */
38
- onRemove: () => void;
39
+ onRemove: (e: React.KeyboardEvent<HTMLElement> | React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;
39
40
  }
40
41
  interface NonRemovableTagProps extends CommonTagProps {
41
42
  removeable?: false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neo4j-ndl/react",
3
- "version": "0.5.2",
3
+ "version": "0.6.1",
4
4
  "description": "React implementation of Neo4j Design System",
5
5
  "keywords": [
6
6
  "button",
@@ -60,6 +60,7 @@
60
60
  "jest": "^27.3.1",
61
61
  "jest-axe": "^5.0.1",
62
62
  "react": "^17.0.2",
63
+ "react-select-event": "^5.5.0",
63
64
  "ts-jest": "^27.0.7"
64
65
  },
65
66
  "peerDependencies": {
@@ -67,9 +68,10 @@
67
68
  },
68
69
  "dependencies": {
69
70
  "@heroicons/react": "^1.0.5",
70
- "@neo4j-ndl/base": "^0.5.1",
71
+ "@neo4j-ndl/base": "^0.6.0",
71
72
  "classnames": "^2.3.1",
72
73
  "react-dropzone": "^12.0.4",
74
+ "react-select": "^5.3.2",
73
75
  "react-table": "^7.7.0",
74
76
  "react-use": "^17.4.0"
75
77
  }