@neo4j-ndl/react 1.8.20 → 1.10.0

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/CHANGELOG.md +22 -0
  2. package/lib/LICENSES.txt +53 -1
  3. package/lib/NOTICE.txt +9 -0
  4. package/lib/cjs/accordion/Accordion.js +241 -0
  5. package/lib/cjs/accordion/Accordion.js.map +1 -0
  6. package/lib/cjs/accordion/index.js +38 -0
  7. package/lib/cjs/accordion/index.js.map +1 -0
  8. package/lib/cjs/date-picker/DatePicker.js +91 -0
  9. package/lib/cjs/date-picker/DatePicker.js.map +1 -0
  10. package/lib/cjs/date-picker/index.js +38 -0
  11. package/lib/cjs/date-picker/index.js.map +1 -0
  12. package/lib/cjs/index.js +2 -0
  13. package/lib/cjs/index.js.map +1 -1
  14. package/lib/esm/accordion/Accordion.js +237 -0
  15. package/lib/esm/accordion/Accordion.js.map +1 -0
  16. package/lib/esm/accordion/index.js +22 -0
  17. package/lib/esm/accordion/index.js.map +1 -0
  18. package/lib/esm/date-picker/DatePicker.js +85 -0
  19. package/lib/esm/date-picker/DatePicker.js.map +1 -0
  20. package/lib/esm/date-picker/index.js +22 -0
  21. package/lib/esm/date-picker/index.js.map +1 -0
  22. package/lib/esm/index.js +2 -0
  23. package/lib/esm/index.js.map +1 -1
  24. package/lib/types/accordion/Accordion.d.ts +60 -0
  25. package/lib/types/accordion/index.d.ts +21 -0
  26. package/lib/types/date-picker/DatePicker.d.ts +35 -0
  27. package/lib/types/date-picker/index.d.ts +21 -0
  28. package/lib/types/graph-label/GraphLabel.d.ts +1 -1
  29. package/lib/types/index.d.ts +2 -0
  30. package/lib/types/side-navigation/SideNavigation.d.ts +2 -2
  31. package/lib/types/table/Table.d.ts +1 -1
  32. package/lib/types/table-deprecated/Table.d.ts +1 -1
  33. package/lib/types/typography/Typography.d.ts +1 -1
  34. package/lib/types/view-selector/ViewSelector.d.ts +1 -1
  35. package/package.json +5 -2
package/CHANGELOG.md CHANGED
@@ -1,5 +1,27 @@
1
1
  # Change Log
2
2
 
3
+ ## 1.10.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 95c8c78: new accordion component
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies [95c8c78]
12
+ - @neo4j-ndl/base@1.10.0
13
+
14
+ ## 1.9.0
15
+
16
+ ### Minor Changes
17
+
18
+ - 46bd73c: Added DatePicker component
19
+
20
+ ### Patch Changes
21
+
22
+ - Updated dependencies [46bd73c]
23
+ - @neo4j-ndl/base@1.9.0
24
+
3
25
  ## 1.8.20
4
26
 
5
27
  ### Patch Changes
package/lib/LICENSES.txt CHANGED
@@ -5210,7 +5210,7 @@ MIT License
5210
5210
 
5211
5211
  -----
5212
5212
 
5213
- The following software may be included in this product: @types/jest, @types/jest-axe, @types/node, @types/react, @types/react-dom, @types/react-resizable, @types/react-syntax-highlighter, @types/react-table, @types/tinycolor2. A copy of the source code may be downloaded from https://github.com/DefinitelyTyped/DefinitelyTyped.git (@types/jest), https://github.com/DefinitelyTyped/DefinitelyTyped.git (@types/jest-axe), https://github.com/DefinitelyTyped/DefinitelyTyped.git (@types/node), https://github.com/DefinitelyTyped/DefinitelyTyped.git (@types/react), https://github.com/DefinitelyTyped/DefinitelyTyped.git (@types/react-dom), https://github.com/DefinitelyTyped/DefinitelyTyped.git (@types/react-resizable), https://github.com/DefinitelyTyped/DefinitelyTyped.git (@types/react-syntax-highlighter), https://github.com/DefinitelyTyped/DefinitelyTyped.git (@types/react-table), https://github.com/DefinitelyTyped/DefinitelyTyped.git (@types/tinycolor2). This software contains the following license and notice below:
5213
+ The following software may be included in this product: @types/jest, @types/jest-axe, @types/node, @types/react, @types/react-datepicker, @types/react-dom, @types/react-resizable, @types/react-syntax-highlighter, @types/react-table, @types/tinycolor2. A copy of the source code may be downloaded from https://github.com/DefinitelyTyped/DefinitelyTyped.git (@types/jest), https://github.com/DefinitelyTyped/DefinitelyTyped.git (@types/jest-axe), https://github.com/DefinitelyTyped/DefinitelyTyped.git (@types/node), https://github.com/DefinitelyTyped/DefinitelyTyped.git (@types/react), https://github.com/DefinitelyTyped/DefinitelyTyped.git (@types/react-datepicker), https://github.com/DefinitelyTyped/DefinitelyTyped.git (@types/react-dom), https://github.com/DefinitelyTyped/DefinitelyTyped.git (@types/react-resizable), https://github.com/DefinitelyTyped/DefinitelyTyped.git (@types/react-syntax-highlighter), https://github.com/DefinitelyTyped/DefinitelyTyped.git (@types/react-table), https://github.com/DefinitelyTyped/DefinitelyTyped.git (@types/tinycolor2). This software contains the following license and notice below:
5214
5214
 
5215
5215
  MIT License
5216
5216
 
@@ -5529,6 +5529,32 @@ SOFTWARE.
5529
5529
 
5530
5530
  -----
5531
5531
 
5532
+ The following software may be included in this product: date-fns. A copy of the source code may be downloaded from https://github.com/date-fns/date-fns. This software contains the following license and notice below:
5533
+
5534
+ MIT License
5535
+
5536
+ Copyright (c) 2021 Sasha Koss and Lesha Koss https://kossnocorp.mit-license.org
5537
+
5538
+ Permission is hereby granted, free of charge, to any person obtaining a copy
5539
+ of this software and associated documentation files (the "Software"), to deal
5540
+ in the Software without restriction, including without limitation the rights
5541
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
5542
+ copies of the Software, and to permit persons to whom the Software is
5543
+ furnished to do so, subject to the following conditions:
5544
+
5545
+ The above copyright notice and this permission notice shall be included in all
5546
+ copies or substantial portions of the Software.
5547
+
5548
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
5549
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
5550
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
5551
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
5552
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
5553
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
5554
+ SOFTWARE.
5555
+
5556
+ -----
5557
+
5532
5558
  The following software may be included in this product: dedent. A copy of the source code may be downloaded from git://github.com/dmnd/dedent.git. This software contains the following license and notice below:
5533
5559
 
5534
5560
  The MIT License (MIT)
@@ -12268,6 +12294,32 @@ Apache License
12268
12294
 
12269
12295
  -----
12270
12296
 
12297
+ The following software may be included in this product: react-datepicker. A copy of the source code may be downloaded from git://github.com/Hacker0x01/react-datepicker.git. This software contains the following license and notice below:
12298
+
12299
+ The MIT License (MIT)
12300
+
12301
+ Copyright (c) 2014-2023 HackerOne Inc and individual contributors
12302
+
12303
+ Permission is hereby granted, free of charge, to any person obtaining a copy
12304
+ of this software and associated documentation files (the "Software"), to deal
12305
+ in the Software without restriction, including without limitation the rights
12306
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12307
+ copies of the Software, and to permit persons to whom the Software is
12308
+ furnished to do so, subject to the following conditions:
12309
+
12310
+ The above copyright notice and this permission notice shall be included in all
12311
+ copies or substantial portions of the Software.
12312
+
12313
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
12314
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
12315
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
12316
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
12317
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
12318
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
12319
+ SOFTWARE.
12320
+
12321
+ -----
12322
+
12271
12323
  The following software may be included in this product: react-dropzone. A copy of the source code may be downloaded from https://github.com/react-dropzone/react-dropzone.git. This software contains the following license and notice below:
12272
12324
 
12273
12325
  The MIT License (MIT)
package/lib/NOTICE.txt CHANGED
@@ -117,6 +117,9 @@ Third-party licenses
117
117
  │ ├─ @types/react@npm:17.0.62 (via npm:^17.0.62)
118
118
  │ │ ├─ URL: https://github.com/DefinitelyTyped/DefinitelyTyped.git
119
119
  │ │ └─ VendorUrl: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react
120
+ │ ├─ @types/react-datepicker@npm:4.11.2 (via npm:^4.11.2)
121
+ │ │ ├─ URL: https://github.com/DefinitelyTyped/DefinitelyTyped.git
122
+ │ │ └─ VendorUrl: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react-datepicker
120
123
  │ ├─ @types/react-dom@npm:17.0.18 (via npm:17.0.18)
121
124
  │ │ ├─ URL: https://github.com/DefinitelyTyped/DefinitelyTyped.git
122
125
  │ │ └─ VendorUrl: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react-dom
@@ -160,6 +163,8 @@ Third-party licenses
160
163
  │ ├─ concurrently@npm:7.6.0 (via npm:^7.4.0)
161
164
  │ │ ├─ URL: https://github.com/open-cli-tools/concurrently.git
162
165
  │ │ └─ VendorName: Kimmo Brunfeldt
166
+ │ ├─ date-fns@npm:2.30.0 (via npm:^2.30.0)
167
+ │ │ └─ URL: https://github.com/date-fns/date-fns
163
168
  │ ├─ dedent@npm:0.7.0 (via npm:^0.7.0)
164
169
  │ │ ├─ URL: git://github.com/dmnd/dedent.git
165
170
  │ │ ├─ VendorName: Desmond Brand
@@ -223,6 +228,10 @@ Third-party licenses
223
228
  │ ├─ react@npm:17.0.2 (via npm:^17.0.2)
224
229
  │ │ ├─ URL: https://github.com/facebook/react.git
225
230
  │ │ └─ VendorUrl: https://reactjs.org/
231
+ │ ├─ react-datepicker@npm:4.14.1 [a2e03] (via npm:^4.14.1 [a2e03])
232
+ │ │ ├─ URL: git://github.com/Hacker0x01/react-datepicker.git
233
+ │ │ ├─ VendorName: HackerOne
234
+ │ │ └─ VendorUrl: https://github.com/Hacker0x01/react-datepicker
226
235
  │ ├─ react-dom@npm:17.0.2 [d75d7] (via npm:^17.0.2 [d75d7])
227
236
  │ │ ├─ URL: https://github.com/facebook/react.git
228
237
  │ │ └─ VendorUrl: https://reactjs.org/
@@ -0,0 +1,241 @@
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.Accordion = 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 classnames_1 = __importDefault(require("classnames"));
40
+ const react_1 = require("react");
41
+ const helpers_1 = require("../helpers");
42
+ const icons_1 = require("../icons");
43
+ const src_1 = require("@neo4j-ndl/react/src");
44
+ const getAccordionItem = (activeElement, accordionElement, iterator) => {
45
+ var _a;
46
+ const accordionItemElement = activeElement.parentElement;
47
+ let newItemElement = iterator(accordionElement, accordionItemElement);
48
+ let childItemElement = null;
49
+ // Iterate over next element until we find a menu item
50
+ // Iterate a maximum of 10 times looking for an element
51
+ for (let i = 0; i < 10; i++) {
52
+ // Can't find new element, break
53
+ if (!newItemElement) {
54
+ return null;
55
+ }
56
+ const role = (_a = newItemElement.firstElementChild) === null || _a === void 0 ? void 0 : _a.getAttribute('role');
57
+ if (role === 'heading') {
58
+ childItemElement = newItemElement;
59
+ break;
60
+ }
61
+ newItemElement = iterator(accordionElement, newItemElement);
62
+ }
63
+ return childItemElement;
64
+ };
65
+ // Gets next sibling child, looping at the end
66
+ const nextElement = (accordionElement, currentElement) => {
67
+ var _a, _b;
68
+ if (currentElement === accordionElement ||
69
+ !(currentElement === null || currentElement === void 0 ? void 0 : currentElement.nextElementSibling)) {
70
+ const nextItem = accordionElement.firstChild;
71
+ const firstAccordionItemHeaderElement = (_a = accordionElement === null || accordionElement === void 0 ? void 0 : accordionElement.firstElementChild) === null || _a === void 0 ? void 0 : _a.firstElementChild;
72
+ return (firstAccordionItemHeaderElement === null || firstAccordionItemHeaderElement === void 0 ? void 0 : firstAccordionItemHeaderElement.className.includes('ndl-accordion-item-header-disabled'))
73
+ ? nextElement(accordionElement, nextItem)
74
+ : nextItem;
75
+ }
76
+ else if (currentElement === null || currentElement === void 0 ? void 0 : currentElement.nextElementSibling) {
77
+ const nextItem = currentElement.nextElementSibling;
78
+ return ((_b = currentElement.nextElementSibling.firstElementChild) === null || _b === void 0 ? void 0 : _b.className.includes('ndl-accordion-item-header-disabled'))
79
+ ? nextElement(accordionElement, nextItem)
80
+ : nextItem;
81
+ }
82
+ return null;
83
+ };
84
+ // Gets prev sibling child, looping at the top
85
+ const previousElement = (accordionElement, currentElement) => {
86
+ var _a, _b;
87
+ if (currentElement === accordionElement ||
88
+ !(currentElement === null || currentElement === void 0 ? void 0 : currentElement.previousElementSibling)) {
89
+ const prevItem = accordionElement.lastElementChild;
90
+ const lastAccordionItemHeaderElement = (_a = accordionElement === null || accordionElement === void 0 ? void 0 : accordionElement.lastElementChild) === null || _a === void 0 ? void 0 : _a.firstElementChild;
91
+ return (lastAccordionItemHeaderElement === null || lastAccordionItemHeaderElement === void 0 ? void 0 : lastAccordionItemHeaderElement.className.includes('ndl-accordion-item-header-disabled'))
92
+ ? previousElement(accordionElement, prevItem)
93
+ : prevItem;
94
+ }
95
+ else if (currentElement === null || currentElement === void 0 ? void 0 : currentElement.previousElementSibling) {
96
+ const prevItem = currentElement.previousElementSibling;
97
+ return ((_b = currentElement.previousElementSibling.firstElementChild) === null || _b === void 0 ? void 0 : _b.className.includes('ndl-accordion-item-header-disabled'))
98
+ ? previousElement(accordionElement, prevItem)
99
+ : prevItem;
100
+ }
101
+ return null;
102
+ };
103
+ const AccordionContext = (0, react_1.createContext)(null);
104
+ const useAccordionContext = () => {
105
+ const context = (0, react_1.useContext)(AccordionContext);
106
+ if (context === null) {
107
+ throw new Error('Accordion used without context');
108
+ }
109
+ return context;
110
+ };
111
+ const Accordion = (0, helpers_1.forwardRef)(function Accordion(_a, ref) {
112
+ var { as = 'div', children, className } = _a, restProps = __rest(_a, ["as", "children", "className"]);
113
+ const accordionRef = (0, react_1.useRef)(null);
114
+ // The following function includes code needed to be
115
+ // able to navigate with the arrow keys (not tab).
116
+ const handleKeyDown = (event) => {
117
+ const accordionElement = accordionRef.current;
118
+ if (!accordionElement) {
119
+ return;
120
+ }
121
+ const activeElement = document.activeElement;
122
+ if (event.key == 'ArrowDown') {
123
+ event.preventDefault();
124
+ event.stopPropagation();
125
+ const newFocusedElement = getAccordionItem(activeElement, accordionElement, nextElement);
126
+ const newHeader = newFocusedElement === null || newFocusedElement === void 0 ? void 0 : newFocusedElement.firstElementChild;
127
+ newHeader.focus();
128
+ }
129
+ else if (event.key == 'ArrowUp') {
130
+ event.preventDefault();
131
+ event.stopPropagation();
132
+ const newFocusedElement = getAccordionItem(activeElement, accordionElement, previousElement);
133
+ const newHeader = newFocusedElement === null || newFocusedElement === void 0 ? void 0 : newFocusedElement.firstElementChild;
134
+ newHeader.focus();
135
+ }
136
+ else if (event.key == ' ' || event.key == 'Enter') {
137
+ event.preventDefault();
138
+ event.stopPropagation();
139
+ const buttonElement = activeElement.getElementsByClassName('ndl-accordion-item-header-button')[0];
140
+ buttonElement.click();
141
+ }
142
+ };
143
+ (0, react_1.useImperativeHandle)(ref, () => accordionRef.current);
144
+ const classes = (0, classnames_1.default)('ndl-accordion', className);
145
+ const Component = as;
146
+ const { onChange, multiple } = restProps, rootProps = __rest(restProps, ["onChange", "multiple"]);
147
+ const contextValue = multiple
148
+ ? {
149
+ onChange,
150
+ multiple,
151
+ expandedItemIds: restProps.expandedItemIds,
152
+ }
153
+ : {
154
+ onChange,
155
+ multiple,
156
+ expandedItemId: restProps.expandedItemId,
157
+ };
158
+ return ((0, jsx_runtime_1.jsx)(Component, Object.assign({}, rootProps, { className: classes, ref: accordionRef, onKeyDown: handleKeyDown }, { children: (0, jsx_runtime_1.jsx)(AccordionContext.Provider, Object.assign({ value: contextValue }, { children: children })) })));
159
+ });
160
+ const createItemId = (type, id) => `ndl-accordionitem${type}id-${id}`;
161
+ const Item = (_a) => {
162
+ var { itemId, children, title, className = '', arrowPosition = 'right', disabled = false, onExpandedChange } = _a, restProps = __rest(_a, ["itemId", "children", "title", "className", "arrowPosition", "disabled", "onExpandedChange"]);
163
+ const contentRef = (0, react_1.useRef)(null);
164
+ const innerContentRef = (0, react_1.useRef)(null);
165
+ const itemElementId = createItemId('item', itemId);
166
+ const headerElementId = createItemId('header', itemId);
167
+ const buttonElementId = createItemId('button', itemId);
168
+ const panelElementId = createItemId('panel', itemId);
169
+ const context = useAccordionContext();
170
+ const { multiple } = context;
171
+ const isExpanded = multiple
172
+ ? context.expandedItemIds.includes(itemId)
173
+ : context.expandedItemId === itemId;
174
+ const handleOnClick = (0, react_1.useCallback)(() => {
175
+ var _a, _b;
176
+ if (disabled)
177
+ return;
178
+ // Custom callback to call.
179
+ if (onExpandedChange !== undefined)
180
+ onExpandedChange(!isExpanded);
181
+ if (multiple) {
182
+ const { expandedItemIds, onChange } = context;
183
+ // Multiple expanded.
184
+ if (isExpanded) {
185
+ // Remove from list.
186
+ const newArray = expandedItemIds.filter((activeId) => activeId !== itemId);
187
+ onChange(newArray);
188
+ }
189
+ else if (!isExpanded) {
190
+ // Add to list.
191
+ const newArray = [...expandedItemIds];
192
+ newArray.push(itemId);
193
+ onChange(newArray);
194
+ }
195
+ }
196
+ else {
197
+ const { onChange } = context;
198
+ // Single expanded.
199
+ if (isExpanded) {
200
+ // Set null.
201
+ onChange(null);
202
+ }
203
+ else if (!isExpanded) {
204
+ // Set to id.
205
+ onChange(itemId);
206
+ }
207
+ }
208
+ // The W3 WAI-ARIA states that focus can only happen on the header not the header button.
209
+ (_b = (_a = document.activeElement) === null || _a === void 0 ? void 0 : _a.parentElement) === null || _b === void 0 ? void 0 : _b.focus();
210
+ }, [isExpanded, multiple, disabled, itemId, onExpandedChange, context]);
211
+ const classes = (0, classnames_1.default)('ndl-accordion-item', className, {
212
+ 'ndl-accordion-item-disabled': disabled,
213
+ });
214
+ const headerClasses = (0, classnames_1.default)('ndl-accordion-item-header', {
215
+ 'ndl-accordion-item-header-disabled': disabled,
216
+ });
217
+ const iconClasses = (0, classnames_1.default)('ndl-accordion-item-header-icon-wrapper', {
218
+ 'ndl-accordion-item-header-icon-wrapper-right': arrowPosition === 'right',
219
+ });
220
+ const buttonClasses = (0, classnames_1.default)('ndl-accordion-item-header-button', {
221
+ 'ndl-accordion-item-header-button-disabled': disabled,
222
+ });
223
+ const titleClasses = (0, classnames_1.default)('ndl-accordion-item-header-button-title', {
224
+ 'ndl-accordion-item-header-button-title': disabled,
225
+ 'ndl-accordion-item-header-button-title-right': arrowPosition === 'right',
226
+ });
227
+ const contentClasses = (0, classnames_1.default)('ndl-accordion-item-content', {
228
+ 'ndl-accordion-item-content-expanded': isExpanded,
229
+ 'ndl-accordion-item-content-right': arrowPosition === 'right',
230
+ });
231
+ const headerTitle = (0, jsx_runtime_1.jsx)("span", Object.assign({ className: titleClasses }, { children: title }));
232
+ return ((0, jsx_runtime_1.jsxs)("div", Object.assign({}, restProps, { className: classes, id: itemElementId }, { children: [(0, jsx_runtime_1.jsx)(src_1.Typography, Object.assign({ variant: "subheading-medium", className: headerClasses, role: "heading", tabIndex: disabled ? -1 : 0, id: headerElementId, "aria-level": "2" }, { children: (0, jsx_runtime_1.jsx)("button", Object.assign({ id: buttonElementId, onClick: handleOnClick, className: buttonClasses, "aria-expanded": isExpanded, "aria-disabled": disabled, "aria-label": title, "aria-controls": panelElementId, tabIndex: -1 }, { children: (0, jsx_runtime_1.jsxs)("span", Object.assign({ className: iconClasses }, { children: [headerTitle, (0, jsx_runtime_1.jsx)(icons_1.ChevronDownIconOutline, { className: (0, classnames_1.default)('ndl-accordion-item-header-icon', {
233
+ '-n-rotate-180': isExpanded,
234
+ }) })] })) })) })), (0, jsx_runtime_1.jsx)("div", Object.assign({ id: panelElementId, ref: contentRef, className: contentClasses, "aria-hidden": !isExpanded, "aria-labelledby": buttonElementId, role: "region" }, { children: (0, jsx_runtime_1.jsx)("div", Object.assign({ ref: innerContentRef, className: "ndl-accordion-item-content-inner" }, { children: (0, jsx_runtime_1.jsx)(src_1.Typography, Object.assign({ variant: "body-medium", className: "n-text-palette-neutral-text-weak", as: "div" }, { children: children })) })) }))] })));
235
+ };
236
+ // Issue with TypeScript forwardRef and subcomponents: https://github.com/DefinitelyTyped/DefinitelyTyped/issues/34757#issuecomment-894053907
237
+ // Fixes issue with: Accordion.Item = Item;
238
+ const AccordionNamespace = Object.assign(Accordion, { Item });
239
+ exports.Accordion = AccordionNamespace;
240
+ exports.default = Accordion;
241
+ //# sourceMappingURL=Accordion.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Accordion.js","sourceRoot":"","sources":["../../../src/accordion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C,gCAAgC,EAAE;oCACtD,eAAe,EAAE,UAAU;iCAC5B,CAAC,GACF,KACG,IACA,IACE,EACb,8CACE,EAAE,EAAE,cAAc,EAClB,GAAG,EAAE,UAAU,EACf,SAAS,EAAE,cAAc,iBACZ,CAAC,UAAU,qBACP,eAAe,EAChC,IAAI,EAAC,QAAQ,gBAEb,8CAAK,GAAG,EAAE,eAAe,EAAE,SAAS,EAAC,kCAAkC,gBACrE,uBAAC,gBAAU,kBACT,OAAO,EAAC,aAAa,EACrB,SAAS,EAAC,kCAAkC,EAC5C,EAAE,EAAC,KAAK,gBAEP,QAAQ,IACE,IACT,IACF,KACF,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,6IAA6I;AAC7I,2CAA2C;AAC3C,MAAM,kBAAkB,GAAG,MAAM,CAAC,MAAM,CAAC,SAAS,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;AAG/B,uCAAS;AAExC,kBAAe,SAAS,CAAC"}
@@ -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("./Accordion"), exports);
38
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/accordion/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;;;;;;;;;;;;;;;;AAEH,8CAA4B"}
@@ -0,0 +1,91 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.DatePicker = void 0;
7
+ const jsx_runtime_1 = require("react/jsx-runtime");
8
+ /**
9
+ *
10
+ * Copyright (c) "Neo4j"
11
+ * Neo4j Sweden AB [http://neo4j.com]
12
+ *
13
+ * This file is part of Neo4j.
14
+ *
15
+ * Neo4j is free software: you can redistribute it and/or modify
16
+ * it under the terms of the GNU General Public License as published by
17
+ * the Free Software Foundation, either version 3 of the License, or
18
+ * (at your option) any later version.
19
+ *
20
+ * This program is distributed in the hope that it will be useful,
21
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
22
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23
+ * GNU General Public License for more details.
24
+ *
25
+ * You should have received a copy of the GNU General Public License
26
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
27
+ */
28
+ const react_1 = require("react");
29
+ const react_datepicker_1 = __importDefault(require("react-datepicker"));
30
+ const classnames_1 = __importDefault(require("classnames"));
31
+ const icons_1 = require("../icons");
32
+ const text_input_1 = require("../text-input");
33
+ const helpers_1 = require("../helpers");
34
+ const button_1 = require("../button");
35
+ const typography_1 = require("../typography");
36
+ const date_fns_1 = require("date-fns");
37
+ exports.DatePicker = (0, helpers_1.forwardRef)(function DatePicker(props, ref) {
38
+ const { reactDatePickerProps, textInputProps, disabled, className } = props;
39
+ const classes = (0, classnames_1.default)(`ndl-datepicker`, className, {});
40
+ const datetimeRef = (0, react_1.useRef)(null);
41
+ const [picker, setPicker] = (0, react_1.useState)('day');
42
+ const headerAction = (0, react_1.useCallback)((action) => {
43
+ picker === action ? setPicker('day') : setPicker(action);
44
+ }, [picker]);
45
+ const CustomHeader = (0, react_1.useCallback)((props) => {
46
+ const { decreaseMonth, increaseMonth, increaseYear, decreaseYear, nextMonthButtonDisabled, nextYearButtonDisabled, prevMonthButtonDisabled, prevYearButtonDisabled, } = props;
47
+ const prevCallback = picker === 'year' ? decreaseYear : decreaseMonth;
48
+ const nextCallback = picker === 'year' ? increaseYear : increaseMonth;
49
+ const prevDisabled = picker === 'year' ? prevYearButtonDisabled : prevMonthButtonDisabled;
50
+ const nextDisabled = picker === 'year' ? nextYearButtonDisabled : nextMonthButtonDisabled;
51
+ return ((0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "ndl-datepicker-header" }, { children: [(0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "ndl-datepicker-selects" }, { children: [(0, jsx_runtime_1.jsx)("button", Object.assign({ className: "ndl-datepicker-header", onClick: () => headerAction('month') }, { children: (0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "n-flex n-items-center" }, { children: [(0, jsx_runtime_1.jsx)(typography_1.Typography, Object.assign({ variant: "label", className: "n-p-2" }, { children: (0, date_fns_1.format)(props.date, 'MMMM') })), (0, jsx_runtime_1.jsx)(icons_1.ChevronUpIconOutline, { className: (0, classnames_1.default)('ndl-datepicker-chevron', {
52
+ 'n-rotate-180': picker === 'month',
53
+ }), "aria-label": "Chevron icon" })] })) })), (0, jsx_runtime_1.jsx)("button", Object.assign({ className: "ndl-datepicker-header", onClick: () => headerAction('year') }, { children: (0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "n-flex n-items-center" }, { children: [(0, jsx_runtime_1.jsx)(typography_1.Typography, Object.assign({ variant: "label", className: "n-p-2" }, { children: (0, date_fns_1.format)(props.date, 'yyyy') })), (0, jsx_runtime_1.jsx)(icons_1.ChevronUpIconOutline, { className: (0, classnames_1.default)('ndl-datepicker-chevron', {
54
+ 'n-rotate-180': picker === 'year',
55
+ }), "aria-label": "Chevron icon" })] })) }))] })), picker !== 'month' && ((0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)(button_1.IconButton, Object.assign({ "aria-label": "Previous period", clean: true, onClick: prevCallback, disabled: prevDisabled }, { children: (0, jsx_runtime_1.jsx)(icons_1.ArrowLeftIconOutline, {}) })), (0, jsx_runtime_1.jsx)(button_1.IconButton, Object.assign({ "aria-label": "Next period", clean: true, onClick: nextCallback, disabled: nextDisabled }, { children: (0, jsx_runtime_1.jsx)(icons_1.ArrowRightIconOutline, {}) }))] }))] })));
56
+ }, [picker, headerAction]);
57
+ /**
58
+ * Intercept onChange so we can work with
59
+ * Month and Year pickers
60
+ */
61
+ const interceptedChange = (0, react_1.useCallback)((...args) => {
62
+ if (picker !== 'day') {
63
+ reactDatePickerProps === null || reactDatePickerProps === void 0 ? void 0 : reactDatePickerProps.onChange(...args);
64
+ setPicker('day');
65
+ }
66
+ else {
67
+ reactDatePickerProps === null || reactDatePickerProps === void 0 ? void 0 : reactDatePickerProps.onChange(...args);
68
+ }
69
+ }, [picker, reactDatePickerProps]);
70
+ /**
71
+ * Intercept onCalendarClose so we can
72
+ * switch to "day" picker if we close on "month" or "year"
73
+ * view
74
+ */
75
+ const interceptedOnCalendarClose = (0, react_1.useCallback)(() => {
76
+ var _a;
77
+ if (picker !== 'day') {
78
+ setPicker('day');
79
+ }
80
+ (_a = reactDatePickerProps === null || reactDatePickerProps === void 0 ? void 0 : reactDatePickerProps.onCalendarClose) === null || _a === void 0 ? void 0 : _a.call(reactDatePickerProps);
81
+ }, [picker, reactDatePickerProps]);
82
+ return ((0, jsx_runtime_1.jsx)("div", Object.assign({ className: classes }, { children: (0, jsx_runtime_1.jsx)(react_datepicker_1.default, Object.assign({ ref: datetimeRef, customInput: (0, jsx_runtime_1.jsx)(text_input_1.TextInput, Object.assign({ ref: ref, "aria-label": "Date picker input", rightIcon: (0, jsx_runtime_1.jsx)(icons_1.CalendarIconOutline, { onClick: (e) => {
83
+ var _a;
84
+ if ((_a = datetimeRef.current) === null || _a === void 0 ? void 0 : _a.isCalendarOpen()) {
85
+ datetimeRef.current.setOpen(false);
86
+ e.preventDefault();
87
+ e.stopPropagation();
88
+ }
89
+ }, "aria-label": "Calender Icon" }) }, textInputProps, { disabled: disabled })), disabled: disabled, showMonthYearPicker: picker === 'month', showYearPicker: picker === 'year', shouldCloseOnSelect: picker === 'day', dayClassName: () => 'ndl-datepicker-day', renderCustomHeader: CustomHeader }, reactDatePickerProps, { onChange: interceptedChange, onCalendarClose: interceptedOnCalendarClose })) })));
90
+ });
91
+ //# sourceMappingURL=DatePicker.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DatePicker.js","sourceRoot":"","sources":["../../../src/date-picker/DatePicker.tsx"],"names":[],"mappings":";;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,iCAAoE;AACpE,wEAG0B;AAC1B,4DAAoC;AACpC,oCAKkB;AAClB,8CAA0C;AAE1C,wCAAqD;AACrD,sCAAuC;AACvC,8CAA2C;AAC3C,uCAAkC;AAwBrB,QAAA,UAAU,GAAG,IAAA,oBAAU,EAAC,SAAS,UAAU,CACtD,KAAyB,EACzB,GAAmC;IAEnC,MAAM,EAAE,oBAAoB,EAAE,cAAc,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,KAAK,CAAC;IAE5E,MAAM,OAAO,GAAG,IAAA,oBAAU,EAAC,gBA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AAY,EAAE,GAAG,EAAE,CAAC,oBAAoB,EACxC,kBAAkB,EAAE,YAAY,IAC5B,oBAAoB,IACxB,QAAQ,EAAE,iBAAiB,EAC3B,eAAe,EAAE,0BAA0B,IAC3C,IACE,CACP,CAAC;AACJ,CAAC,CAAC,CAAC"}
@@ -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("./DatePicker"), exports);
38
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/date-picker/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;;;;;;;;;;;;;;;;AAEH,+CAA6B"}
package/lib/cjs/index.js CHANGED
@@ -34,6 +34,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
34
34
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
35
35
  };
36
36
  Object.defineProperty(exports, "__esModule", { value: true });
37
+ __exportStar(require("./accordion"), exports);
37
38
  __exportStar(require("./button"), exports);
38
39
  __exportStar(require("./label"), exports);
39
40
  __exportStar(require("./banner"), exports);
@@ -42,6 +43,7 @@ __exportStar(require("./checkbox"), exports);
42
43
  __exportStar(require("./switch"), exports);
43
44
  __exportStar(require("./radio"), exports);
44
45
  __exportStar(require("./context-menu"), exports);
46
+ __exportStar(require("./date-picker"), exports);
45
47
  __exportStar(require("./dialog"), exports);
46
48
  __exportStar(require("./modal"), exports);
47
49
  __exportStar(require("./loading-spinner"), exports);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;;;;;;;;;;;;;;;;AAEH,2CAAyB;AACzB,0CAAwB;AACxB,2CAAyB;AACzB,4CAA0B;AAC1B,6CAA2B;AAC3B,2CAAyB;AACzB,0CAAwB;AACxB,iDAA+B;AAC/B,2CAAyB;AACzB,0CAAwB;AACxB,oDAAkC;AAClC,yCAAuB;AACvB,kDAAgC;AAChC,4CAA0B;AAC1B,iDAA+B;AAC/B,qDAAmC;AACnC,0CAAwB;AACxB,kDAAgC;AAChC,+CAA6B;AAC7B,6CAA2B;AAC3B,8CAA4B;AAC5B,6CAA2B;AAC3B,wCAAsB;AACtB,2CAAyB;AACzB,2CAAyB;AACzB,gDAA8B;AAC9B,+CAA6B;AAC7B,sDAAoC;AACpC,qDAAmC;AACnC,oDAAkC;AAClC,+CAA6B;AAC7B,2CAAyB"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;;;;;;;;;;;;;;;;AAEH,8CAA4B;AAC5B,2CAAyB;AACzB,0CAAwB;AACxB,2CAAyB;AACzB,4CAA0B;AAC1B,6CAA2B;AAC3B,2CAAyB;AACzB,0CAAwB;AACxB,iDAA+B;AAC/B,gDAA8B;AAC9B,2CAAyB;AACzB,0CAAwB;AACxB,oDAAkC;AAClC,yCAAuB;AACvB,kDAAgC;AAChC,4CAA0B;AAC1B,iDAA+B;AAC/B,qDAAmC;AACnC,0CAAwB;AACxB,kDAAgC;AAChC,+CAA6B;AAC7B,6CAA2B;AAC3B,8CAA4B;AAC5B,6CAA2B;AAC3B,wCAAsB;AACtB,2CAAyB;AACzB,2CAAyB;AACzB,gDAA8B;AAC9B,+CAA6B;AAC7B,sDAAoC;AACpC,qDAAmC;AACnC,oDAAkC;AAClC,+CAA6B;AAC7B,2CAAyB"}