@neo4j-ndl/react 2.1.0 → 2.2.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.
- package/CHANGELOG.md +20 -0
- package/lib/cjs/button/IconButtonArray.js +4 -0
- package/lib/cjs/button/IconButtonArray.js.map +1 -1
- package/lib/cjs/layout/Box.js +56 -0
- package/lib/cjs/layout/Box.js.map +1 -0
- package/lib/cjs/layout/Flex.js +64 -0
- package/lib/cjs/layout/Flex.js.map +1 -0
- package/lib/cjs/layout/index.js +39 -0
- package/lib/cjs/layout/index.js.map +1 -0
- package/lib/cjs/layout/types.js +49 -0
- package/lib/cjs/layout/types.js.map +1 -0
- package/lib/esm/button/IconButtonArray.js +4 -0
- package/lib/esm/button/IconButtonArray.js.map +1 -1
- package/lib/esm/layout/Box.js +53 -0
- package/lib/esm/layout/Box.js.map +1 -0
- package/lib/esm/layout/Flex.js +61 -0
- package/lib/esm/layout/Flex.js.map +1 -0
- package/lib/esm/layout/index.js +23 -0
- package/lib/esm/layout/index.js.map +1 -0
- package/lib/esm/layout/types.js +44 -0
- package/lib/esm/layout/types.js.map +1 -0
- package/lib/types/button/IconButtonArray.d.ts +4 -0
- package/lib/types/layout/Box.d.ts +66 -0
- package/lib/types/layout/Flex.d.ts +80 -0
- package/lib/types/layout/index.d.ts +22 -0
- package/lib/types/layout/types.d.ts +48 -0
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
+
## 2.2.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#700](https://github.com/neo4j/neo4j-design/pull/700) [`3f2bb49`](https://github.com/neo4j/neo4j-design/commit/3f2bb49a3fe8480d2b1c709af76e90d9b6c3fd72) Thanks [@konsalex](https://github.com/konsalex)! - new layout components, that incorporate design tokens
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [[`3f2bb49`](https://github.com/neo4j/neo4j-design/commit/3f2bb49a3fe8480d2b1c709af76e90d9b6c3fd72)]:
|
|
12
|
+
- @neo4j-ndl/base@2.2.0
|
|
13
|
+
|
|
14
|
+
## 2.1.1
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- [#704](https://github.com/neo4j/neo4j-design/pull/704) [`b22b869`](https://github.com/neo4j/neo4j-design/commit/b22b869a594d34badcce0161931c0e8ce265f7be) Thanks [@konsalex](https://github.com/konsalex)! - IconButtonArray fix maximum height from 38px to 36px
|
|
19
|
+
|
|
20
|
+
- Updated dependencies [[`b22b869`](https://github.com/neo4j/neo4j-design/commit/b22b869a594d34badcce0161931c0e8ce265f7be)]:
|
|
21
|
+
- @neo4j-ndl/base@2.1.1
|
|
22
|
+
|
|
3
23
|
## 2.1.0
|
|
4
24
|
|
|
5
25
|
### Minor Changes
|
|
@@ -38,6 +38,10 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
38
38
|
*/
|
|
39
39
|
const react_1 = __importDefault(require("react"));
|
|
40
40
|
const defaultImports_1 = require("../_common/defaultImports");
|
|
41
|
+
/**
|
|
42
|
+
* TODO: v3. Incorporate the `size` prop into the component, and pass it to IconButton children.
|
|
43
|
+
* We need to use also the `size` prop to adjust padding in various sizes, now it has a fixed padding.
|
|
44
|
+
*/
|
|
41
45
|
exports.IconButtonArray = react_1.default.forwardRef(function Button(_a, ref) {
|
|
42
46
|
var { children, as, className, floating = false, orientation = 'horizontal' } = _a, restProps = __rest(_a, ["children", "as", "className", "floating", "orientation"]);
|
|
43
47
|
const Component = as || 'div';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IconButtonArray.js","sourceRoot":"","sources":["../../../src/button/IconButtonArray.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,kDAA0B;AAC1B,8DAAuD;
|
|
1
|
+
{"version":3,"file":"IconButtonArray.js","sourceRoot":"","sources":["../../../src/button/IconButtonArray.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,kDAA0B;AAC1B,8DAAuD;AAqBvD;;;GAGG;AACU,QAAA,eAAe,GAAG,eAAK,CAAC,UAAU,CAAC,SAAS,MAAM,CAC7D,EAOuB,EACvB,GAAG;QARH,EACE,QAAQ,EACR,EAAE,EACF,SAAS,EACT,QAAQ,GAAG,KAAK,EAChB,WAAW,GAAG,YAAY,OAEL,EADlB,SAAS,cANd,0DAOC,CADa;IAId,MAAM,SAAS,GAAG,EAAE,IAAI,KAAK,CAAC;IAE9B,MAAM,OAAO,GAAG,IAAA,2BAAU,EAAC,oBAAoB,EAAE;QAC/C,YAAY,EAAE,WAAW,KAAK,YAAY;QAC1C,YAAY,EAAE,WAAW,KAAK,UAAU;QACxC,oBAAoB,EAAE,QAAQ;QAC9B,CAAC,GAAG,SAAS,EAAE,CAAC,EAAE,SAAS;KAC5B,CAAC,CAAC;IAEH,OAAO,CACL,uBAAC,SAAS,oBAAK,SAAS,IAAE,SAAS,EAAE,OAAO,EAAE,GAAG,EAAE,GAAG,YACnD,QAAQ,IACC,CACb,CAAC;AACJ,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.Box = void 0;
|
|
15
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
16
|
+
/**
|
|
17
|
+
*
|
|
18
|
+
* Copyright (c) "Neo4j"
|
|
19
|
+
* Neo4j Sweden AB [http://neo4j.com]
|
|
20
|
+
*
|
|
21
|
+
* This file is part of Neo4j.
|
|
22
|
+
*
|
|
23
|
+
* Neo4j is free software: you can redistribute it and/or modify
|
|
24
|
+
* it under the terms of the GNU General Public License as published by
|
|
25
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
26
|
+
* (at your option) any later version.
|
|
27
|
+
*
|
|
28
|
+
* This program is distributed in the hope that it will be useful,
|
|
29
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
30
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
31
|
+
* GNU General Public License for more details.
|
|
32
|
+
*
|
|
33
|
+
* You should have received a copy of the GNU General Public License
|
|
34
|
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
35
|
+
*/
|
|
36
|
+
const react_1 = require("react");
|
|
37
|
+
const types_1 = require("./types");
|
|
38
|
+
/**
|
|
39
|
+
* Box is a general-purpose container that allows for controlled use of design tokens.
|
|
40
|
+
* Use the given props to configure display behavior and styling that aligns with Needle's tokens.
|
|
41
|
+
*/
|
|
42
|
+
exports.Box = (0, react_1.forwardRef)(function Box(_a, ref) {
|
|
43
|
+
var { as = 'div', padding, paddingInline, paddingInlineStart, paddingInlineEnd, paddingBlockEnd, paddingBlockStart, borderRadius, children } = _a, restProps = __rest(_a, ["as", "padding", "paddingInline", "paddingInlineStart", "paddingInlineEnd", "paddingBlockEnd", "paddingBlockStart", "borderRadius", "children"]);
|
|
44
|
+
const Component = as;
|
|
45
|
+
const style = {
|
|
46
|
+
padding: (0, types_1.getSpacing)(padding, 'padding'),
|
|
47
|
+
paddingInline: (0, types_1.getSpacing)(paddingInline, 'paddingInline'),
|
|
48
|
+
paddingInlineStart: (0, types_1.getSpacing)(paddingInlineStart, 'paddingInlineStart'),
|
|
49
|
+
paddingInlineEnd: (0, types_1.getSpacing)(paddingInlineEnd, 'paddingInlineEnd'),
|
|
50
|
+
paddingBlockEnd: (0, types_1.getSpacing)(paddingBlockEnd, 'paddingBlockEnd'),
|
|
51
|
+
paddingBlockStart: (0, types_1.getSpacing)(paddingBlockStart, 'paddingBlockStart'),
|
|
52
|
+
borderRadius: (0, types_1.getRadius)(borderRadius, 'borderRadius'),
|
|
53
|
+
};
|
|
54
|
+
return ((0, jsx_runtime_1.jsx)(Component, Object.assign({ ref: ref }, restProps, { style: Object.assign(Object.assign({}, style), restProps.style), children: children })));
|
|
55
|
+
});
|
|
56
|
+
//# sourceMappingURL=Box.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Box.js","sourceRoot":"","sources":["../../../src/layout/Box.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,iCAIe;AACf,mCAOiB;AAiDjB;;;GAGG;AACU,QAAA,GAAG,GAAiB,IAAA,kBAAU,EAAC,SAAS,GAAG,CAGtD,EAWc,EACd,GAAoC;QAZpC,EACE,EAAE,GAAG,KAAU,EACf,OAAO,EACP,aAAa,EACb,kBAAkB,EAClB,gBAAgB,EAChB,eAAe,EACf,iBAAiB,EACjB,YAAY,EACZ,QAAQ,OAEI,EADT,SAAS,cAVd,gJAWC,CADa;IAId,MAAM,SAAS,GAAG,EAA+B,CAAC;IAElD,MAAM,KAAK,GAAG;QACZ,OAAO,EAAE,IAAA,kBAAU,EAAC,OAAO,EAAE,SAAS,CAAC;QACvC,aAAa,EAAE,IAAA,kBAAU,EAAC,aAAa,EAAE,eAAe,CAAC;QACzD,kBAAkB,EAAE,IAAA,kBAAU,EAAC,kBAAkB,EAAE,oBAAoB,CAAC;QACxE,gBAAgB,EAAE,IAAA,kBAAU,EAAC,gBAAgB,EAAE,kBAAkB,CAAC;QAClE,eAAe,EAAE,IAAA,kBAAU,EAAC,eAAe,EAAE,iBAAiB,CAAC;QAC/D,iBAAiB,EAAE,IAAA,kBAAU,EAAC,iBAAiB,EAAE,mBAAmB,CAAC;QACrE,YAAY,EAAE,IAAA,iBAAS,EAAC,YAAY,EAAE,cAAc,CAAC;KACtD,CAAC;IAEF,OAAO,CACL,uBAAC,SAAS,kBACR,GAAG,EAAE,GAAG,IACJ,SAAS,IACb,KAAK,kCAAO,KAAK,GAAK,SAAS,CAAC,KAAK,aAEpC,QAAQ,IACC,CACb,CAAC;AACJ,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,64 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.Flex = void 0;
|
|
15
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
16
|
+
/**
|
|
17
|
+
*
|
|
18
|
+
* Copyright (c) "Neo4j"
|
|
19
|
+
* Neo4j Sweden AB [http://neo4j.com]
|
|
20
|
+
*
|
|
21
|
+
* This file is part of Neo4j.
|
|
22
|
+
*
|
|
23
|
+
* Neo4j is free software: you can redistribute it and/or modify
|
|
24
|
+
* it under the terms of the GNU General Public License as published by
|
|
25
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
26
|
+
* (at your option) any later version.
|
|
27
|
+
*
|
|
28
|
+
* This program is distributed in the hope that it will be useful,
|
|
29
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
30
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
31
|
+
* GNU General Public License for more details.
|
|
32
|
+
*
|
|
33
|
+
* You should have received a copy of the GNU General Public License
|
|
34
|
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
35
|
+
*/
|
|
36
|
+
const react_1 = require("react");
|
|
37
|
+
const types_1 = require("./types");
|
|
38
|
+
const base_1 = require("@neo4j-ndl/base");
|
|
39
|
+
/**
|
|
40
|
+
* Flex is a general-purpose container that helps
|
|
41
|
+
* lay out components with consistent spacing in a row or column.
|
|
42
|
+
*/
|
|
43
|
+
exports.Flex = (0, react_1.forwardRef)(function Flex(_a, ref) {
|
|
44
|
+
var { as = 'div', gap = '4', rowGap, columnGap, children, borderRadius, flexDirection = 'column', flexWrap = 'nowrap', alignItems, justifyContent } = _a, restProps = __rest(_a, ["as", "gap", "rowGap", "columnGap", "children", "borderRadius", "flexDirection", "flexWrap", "alignItems", "justifyContent"]);
|
|
45
|
+
const Component = as;
|
|
46
|
+
// If gap is not provided,
|
|
47
|
+
// and rowGap and columnGap are not provided,
|
|
48
|
+
// then use the default value.
|
|
49
|
+
const gapPx = (0, types_1.getSpacing)(gap, 'gap');
|
|
50
|
+
const rowGapPx = rowGap ? base_1.tokens.space[rowGap] : undefined;
|
|
51
|
+
const columnGapPx = columnGap ? base_1.tokens.space[columnGap] : undefined;
|
|
52
|
+
const gapFormatted = `${rowGapPx !== null && rowGapPx !== void 0 ? rowGapPx : gapPx} ${columnGapPx !== null && columnGapPx !== void 0 ? columnGapPx : gapPx}`;
|
|
53
|
+
const style = {
|
|
54
|
+
flexDirection,
|
|
55
|
+
alignItems,
|
|
56
|
+
flexWrap,
|
|
57
|
+
justifyContent,
|
|
58
|
+
display: 'flex',
|
|
59
|
+
gap: gapFormatted,
|
|
60
|
+
borderRadius: (0, types_1.getRadius)(borderRadius, 'borderRadius'),
|
|
61
|
+
};
|
|
62
|
+
return ((0, jsx_runtime_1.jsx)(Component, Object.assign({ ref: ref }, restProps, { style: Object.assign(Object.assign({}, style), restProps.style), children: children })));
|
|
63
|
+
});
|
|
64
|
+
//# sourceMappingURL=Flex.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Flex.js","sourceRoot":"","sources":["../../../src/layout/Flex.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,iCAIe;AACf,mCAOiB;AACjB,0CAAyC;AAmEzC;;;GAGG;AACU,QAAA,IAAI,GAAkB,IAAA,kBAAU,EAAC,SAAS,IAAI,CAGzD,EAYe,EACf,GAAoC;QAbpC,EACE,EAAE,GAAG,KAAU,EACf,GAAG,GAAG,GAAG,EACT,MAAM,EACN,SAAS,EACT,QAAQ,EACR,YAAY,EACZ,aAAa,GAAG,QAAQ,EACxB,QAAQ,GAAG,QAAQ,EACnB,UAAU,EACV,cAAc,OAED,EADV,SAAS,cAXd,6HAYC,CADa;IAId,MAAM,SAAS,GAAG,EAA+B,CAAC;IAElD,0BAA0B;IAC1B,6CAA6C;IAC7C,8BAA8B;IAC9B,MAAM,KAAK,GAAG,IAAA,kBAAU,EAAC,GAAG,EAAE,KAAK,CAAC,CAAC;IACrC,MAAM,QAAQ,GAAG,MAAM,CAAC,CAAC,CAAC,aAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAC3D,MAAM,WAAW,GAAG,SAAS,CAAC,CAAC,CAAC,aAAM,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IACpE,MAAM,YAAY,GAAG,GAAG,QAAQ,aAAR,QAAQ,cAAR,QAAQ,GAAI,KAAK,IAAI,WAAW,aAAX,WAAW,cAAX,WAAW,GAAI,KAAK,EAAE,CAAC;IAEpE,MAAM,KAAK,GAAwB;QACjC,aAAa;QACb,UAAU;QACV,QAAQ;QACR,cAAc;QACd,OAAO,EAAE,MAAM;QACf,GAAG,EAAE,YAAY;QACjB,YAAY,EAAE,IAAA,iBAAS,EAAC,YAAY,EAAE,cAAc,CAAC;KACtD,CAAC;IAEF,OAAO,CACL,uBAAC,SAAS,kBACR,GAAG,EAAE,GAAG,IACJ,SAAS,IACb,KAAK,kCAAO,KAAK,GAAK,SAAS,CAAC,KAAK,aAEpC,QAAQ,IACC,CACb,CAAC;AACJ,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
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("./Flex"), exports);
|
|
38
|
+
__exportStar(require("./Box"), exports);
|
|
39
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/layout/index.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;;;;;;;;;;;;;;;;AAEH,yCAAuB;AACvB,wCAAsB"}
|
|
@@ -0,0 +1,49 @@
|
|
|
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
|
+
exports.getRadius = exports.RadiusDefaults = exports.getSpacing = exports.SpacingDefaults = void 0;
|
|
24
|
+
const base_1 = require("@neo4j-ndl/base");
|
|
25
|
+
exports.SpacingDefaults = {
|
|
26
|
+
padding: '4',
|
|
27
|
+
paddingBlockStart: undefined,
|
|
28
|
+
paddingBlockEnd: undefined,
|
|
29
|
+
paddingInline: undefined,
|
|
30
|
+
paddingInlineStart: undefined,
|
|
31
|
+
paddingInlineEnd: undefined,
|
|
32
|
+
gap: '4',
|
|
33
|
+
};
|
|
34
|
+
const getSpacing = (spacing, property) => {
|
|
35
|
+
return spacing
|
|
36
|
+
? base_1.tokens.space[spacing || exports.SpacingDefaults[property]]
|
|
37
|
+
: undefined;
|
|
38
|
+
};
|
|
39
|
+
exports.getSpacing = getSpacing;
|
|
40
|
+
exports.RadiusDefaults = {
|
|
41
|
+
borderRadius: undefined,
|
|
42
|
+
};
|
|
43
|
+
const getRadius = (spacing, property) => {
|
|
44
|
+
return spacing
|
|
45
|
+
? base_1.tokens.borderRadius[spacing || exports.RadiusDefaults[property]]
|
|
46
|
+
: undefined;
|
|
47
|
+
};
|
|
48
|
+
exports.getRadius = getRadius;
|
|
49
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/layout/types.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;;;AAEH,0CAAyC;AAgB5B,QAAA,eAAe,GAAG;IAC7B,OAAO,EAAE,GAAG;IACZ,iBAAiB,EAAE,SAAS;IAC5B,eAAe,EAAE,SAAS;IAC1B,aAAa,EAAE,SAAS;IACxB,kBAAkB,EAAE,SAAS;IAC7B,gBAAgB,EAAE,SAAS;IAC3B,GAAG,EAAE,GAAG;CACA,CAAC;AAEJ,MAAM,UAAU,GAAG,CACxB,OAA4B,EAC5B,QAAsC,EACtC,EAAE;IACF,OAAO,OAAO;QACZ,CAAC,CAAC,aAAM,CAAC,KAAK,CAAC,OAAO,IAAI,uBAAe,CAAC,QAAQ,CAAC,CAAC;QACpD,CAAC,CAAC,SAAS,CAAC;AAChB,CAAC,CAAC;AAPW,QAAA,UAAU,cAOrB;AAIW,QAAA,cAAc,GAAG;IAC5B,YAAY,EAAE,SAAS;CACxB,CAAC;AAEK,MAAM,SAAS,GAAG,CACvB,OAA2B,EAC3B,QAAqC,EACrC,EAAE;IACF,OAAO,OAAO;QACZ,CAAC,CAAC,aAAM,CAAC,YAAY,CAAC,OAAO,IAAI,sBAAc,CAAC,QAAQ,CAAC,CAAC;QAC1D,CAAC,CAAC,SAAS,CAAC;AAChB,CAAC,CAAC;AAPW,QAAA,SAAS,aAOpB"}
|
|
@@ -32,6 +32,10 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
32
32
|
*/
|
|
33
33
|
import React from 'react';
|
|
34
34
|
import { classNames } from '../_common/defaultImports';
|
|
35
|
+
/**
|
|
36
|
+
* TODO: v3. Incorporate the `size` prop into the component, and pass it to IconButton children.
|
|
37
|
+
* We need to use also the `size` prop to adjust padding in various sizes, now it has a fixed padding.
|
|
38
|
+
*/
|
|
35
39
|
export const IconButtonArray = React.forwardRef(function Button(_a, ref) {
|
|
36
40
|
var { children, as, className, floating = false, orientation = 'horizontal' } = _a, restProps = __rest(_a, ["children", "as", "className", "floating", "orientation"]);
|
|
37
41
|
const Component = as || 'div';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IconButtonArray.js","sourceRoot":"","sources":["../../../src/button/IconButtonArray.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAqBvD,MAAM,CAAC,MAAM,eAAe,GAAG,KAAK,CAAC,UAAU,CAAC,SAAS,MAAM,CAC7D,EAOuB,EACvB,GAAG;QARH,EACE,QAAQ,EACR,EAAE,EACF,SAAS,EACT,QAAQ,GAAG,KAAK,EAChB,WAAW,GAAG,YAAY,OAEL,EADlB,SAAS,cANd,0DAOC,CADa;IAId,MAAM,SAAS,GAAG,EAAE,IAAI,KAAK,CAAC;IAE9B,MAAM,OAAO,GAAG,UAAU,CAAC,oBAAoB,EAAE;QAC/C,YAAY,EAAE,WAAW,KAAK,YAAY;QAC1C,YAAY,EAAE,WAAW,KAAK,UAAU;QACxC,oBAAoB,EAAE,QAAQ;QAC9B,CAAC,GAAG,SAAS,EAAE,CAAC,EAAE,SAAS;KAC5B,CAAC,CAAC;IAEH,OAAO,CACL,KAAC,SAAS,oBAAK,SAAS,IAAE,SAAS,EAAE,OAAO,EAAE,GAAG,EAAE,GAAG,YACnD,QAAQ,IACC,CACb,CAAC;AACJ,CAAC,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"file":"IconButtonArray.js","sourceRoot":"","sources":["../../../src/button/IconButtonArray.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAqBvD;;;GAGG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,KAAK,CAAC,UAAU,CAAC,SAAS,MAAM,CAC7D,EAOuB,EACvB,GAAG;QARH,EACE,QAAQ,EACR,EAAE,EACF,SAAS,EACT,QAAQ,GAAG,KAAK,EAChB,WAAW,GAAG,YAAY,OAEL,EADlB,SAAS,cANd,0DAOC,CADa;IAId,MAAM,SAAS,GAAG,EAAE,IAAI,KAAK,CAAC;IAE9B,MAAM,OAAO,GAAG,UAAU,CAAC,oBAAoB,EAAE;QAC/C,YAAY,EAAE,WAAW,KAAK,YAAY;QAC1C,YAAY,EAAE,WAAW,KAAK,UAAU;QACxC,oBAAoB,EAAE,QAAQ;QAC9B,CAAC,GAAG,SAAS,EAAE,CAAC,EAAE,SAAS;KAC5B,CAAC,CAAC;IAEH,OAAO,CACL,KAAC,SAAS,oBAAK,SAAS,IAAE,SAAS,EAAE,OAAO,EAAE,GAAG,EAAE,GAAG,YACnD,QAAQ,IACC,CACb,CAAC;AACJ,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
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 } 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 { forwardRef, } from 'react';
|
|
34
|
+
import { getSpacing, getRadius, } from './types';
|
|
35
|
+
/**
|
|
36
|
+
* Box is a general-purpose container that allows for controlled use of design tokens.
|
|
37
|
+
* Use the given props to configure display behavior and styling that aligns with Needle's tokens.
|
|
38
|
+
*/
|
|
39
|
+
export const Box = forwardRef(function Box(_a, ref) {
|
|
40
|
+
var { as = 'div', padding, paddingInline, paddingInlineStart, paddingInlineEnd, paddingBlockEnd, paddingBlockStart, borderRadius, children } = _a, restProps = __rest(_a, ["as", "padding", "paddingInline", "paddingInlineStart", "paddingInlineEnd", "paddingBlockEnd", "paddingBlockStart", "borderRadius", "children"]);
|
|
41
|
+
const Component = as;
|
|
42
|
+
const style = {
|
|
43
|
+
padding: getSpacing(padding, 'padding'),
|
|
44
|
+
paddingInline: getSpacing(paddingInline, 'paddingInline'),
|
|
45
|
+
paddingInlineStart: getSpacing(paddingInlineStart, 'paddingInlineStart'),
|
|
46
|
+
paddingInlineEnd: getSpacing(paddingInlineEnd, 'paddingInlineEnd'),
|
|
47
|
+
paddingBlockEnd: getSpacing(paddingBlockEnd, 'paddingBlockEnd'),
|
|
48
|
+
paddingBlockStart: getSpacing(paddingBlockStart, 'paddingBlockStart'),
|
|
49
|
+
borderRadius: getRadius(borderRadius, 'borderRadius'),
|
|
50
|
+
};
|
|
51
|
+
return (_jsx(Component, Object.assign({ ref: ref }, restProps, { style: Object.assign(Object.assign({}, style), restProps.style), children: children })));
|
|
52
|
+
});
|
|
53
|
+
//# sourceMappingURL=Box.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Box.js","sourceRoot":"","sources":["../../../src/layout/Box.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAc,EACZ,UAAU,GAGX,MAAM,OAAO,CAAC;AACf,OAAO,EAKL,UAAU,EACV,SAAS,GACV,MAAM,SAAS,CAAC;AAiDjB;;;GAGG;AACH,MAAM,CAAC,MAAM,GAAG,GAAiB,UAAU,CAAC,SAAS,GAAG,CAGtD,EAWc,EACd,GAAoC;QAZpC,EACE,EAAE,GAAG,KAAU,EACf,OAAO,EACP,aAAa,EACb,kBAAkB,EAClB,gBAAgB,EAChB,eAAe,EACf,iBAAiB,EACjB,YAAY,EACZ,QAAQ,OAEI,EADT,SAAS,cAVd,gJAWC,CADa;IAId,MAAM,SAAS,GAAG,EAA+B,CAAC;IAElD,MAAM,KAAK,GAAG;QACZ,OAAO,EAAE,UAAU,CAAC,OAAO,EAAE,SAAS,CAAC;QACvC,aAAa,EAAE,UAAU,CAAC,aAAa,EAAE,eAAe,CAAC;QACzD,kBAAkB,EAAE,UAAU,CAAC,kBAAkB,EAAE,oBAAoB,CAAC;QACxE,gBAAgB,EAAE,UAAU,CAAC,gBAAgB,EAAE,kBAAkB,CAAC;QAClE,eAAe,EAAE,UAAU,CAAC,eAAe,EAAE,iBAAiB,CAAC;QAC/D,iBAAiB,EAAE,UAAU,CAAC,iBAAiB,EAAE,mBAAmB,CAAC;QACrE,YAAY,EAAE,SAAS,CAAC,YAAY,EAAE,cAAc,CAAC;KACtD,CAAC;IAEF,OAAO,CACL,KAAC,SAAS,kBACR,GAAG,EAAE,GAAG,IACJ,SAAS,IACb,KAAK,kCAAO,KAAK,GAAK,SAAS,CAAC,KAAK,aAEpC,QAAQ,IACC,CACb,CAAC;AACJ,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,61 @@
|
|
|
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 } 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 { forwardRef, } from 'react';
|
|
34
|
+
import { getSpacing, getRadius, } from './types';
|
|
35
|
+
import { tokens } from '@neo4j-ndl/base';
|
|
36
|
+
/**
|
|
37
|
+
* Flex is a general-purpose container that helps
|
|
38
|
+
* lay out components with consistent spacing in a row or column.
|
|
39
|
+
*/
|
|
40
|
+
export const Flex = forwardRef(function Flex(_a, ref) {
|
|
41
|
+
var { as = 'div', gap = '4', rowGap, columnGap, children, borderRadius, flexDirection = 'column', flexWrap = 'nowrap', alignItems, justifyContent } = _a, restProps = __rest(_a, ["as", "gap", "rowGap", "columnGap", "children", "borderRadius", "flexDirection", "flexWrap", "alignItems", "justifyContent"]);
|
|
42
|
+
const Component = as;
|
|
43
|
+
// If gap is not provided,
|
|
44
|
+
// and rowGap and columnGap are not provided,
|
|
45
|
+
// then use the default value.
|
|
46
|
+
const gapPx = getSpacing(gap, 'gap');
|
|
47
|
+
const rowGapPx = rowGap ? tokens.space[rowGap] : undefined;
|
|
48
|
+
const columnGapPx = columnGap ? tokens.space[columnGap] : undefined;
|
|
49
|
+
const gapFormatted = `${rowGapPx !== null && rowGapPx !== void 0 ? rowGapPx : gapPx} ${columnGapPx !== null && columnGapPx !== void 0 ? columnGapPx : gapPx}`;
|
|
50
|
+
const style = {
|
|
51
|
+
flexDirection,
|
|
52
|
+
alignItems,
|
|
53
|
+
flexWrap,
|
|
54
|
+
justifyContent,
|
|
55
|
+
display: 'flex',
|
|
56
|
+
gap: gapFormatted,
|
|
57
|
+
borderRadius: getRadius(borderRadius, 'borderRadius'),
|
|
58
|
+
};
|
|
59
|
+
return (_jsx(Component, Object.assign({ ref: ref }, restProps, { style: Object.assign(Object.assign({}, style), restProps.style), children: children })));
|
|
60
|
+
});
|
|
61
|
+
//# sourceMappingURL=Flex.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Flex.js","sourceRoot":"","sources":["../../../src/layout/Flex.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAc,EACZ,UAAU,GAGX,MAAM,OAAO,CAAC;AACf,OAAO,EAKL,UAAU,EACV,SAAS,GACV,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAmEzC;;;GAGG;AACH,MAAM,CAAC,MAAM,IAAI,GAAkB,UAAU,CAAC,SAAS,IAAI,CAGzD,EAYe,EACf,GAAoC;QAbpC,EACE,EAAE,GAAG,KAAU,EACf,GAAG,GAAG,GAAG,EACT,MAAM,EACN,SAAS,EACT,QAAQ,EACR,YAAY,EACZ,aAAa,GAAG,QAAQ,EACxB,QAAQ,GAAG,QAAQ,EACnB,UAAU,EACV,cAAc,OAED,EADV,SAAS,cAXd,6HAYC,CADa;IAId,MAAM,SAAS,GAAG,EAA+B,CAAC;IAElD,0BAA0B;IAC1B,6CAA6C;IAC7C,8BAA8B;IAC9B,MAAM,KAAK,GAAG,UAAU,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;IACrC,MAAM,QAAQ,GAAG,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAC3D,MAAM,WAAW,GAAG,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IACpE,MAAM,YAAY,GAAG,GAAG,QAAQ,aAAR,QAAQ,cAAR,QAAQ,GAAI,KAAK,IAAI,WAAW,aAAX,WAAW,cAAX,WAAW,GAAI,KAAK,EAAE,CAAC;IAEpE,MAAM,KAAK,GAAwB;QACjC,aAAa;QACb,UAAU;QACV,QAAQ;QACR,cAAc;QACd,OAAO,EAAE,MAAM;QACf,GAAG,EAAE,YAAY;QACjB,YAAY,EAAE,SAAS,CAAC,YAAY,EAAE,cAAc,CAAC;KACtD,CAAC;IAEF,OAAO,CACL,KAAC,SAAS,kBACR,GAAG,EAAE,GAAG,IACJ,SAAS,IACb,KAAK,kCAAO,KAAK,GAAK,SAAS,CAAC,KAAK,aAEpC,QAAQ,IACC,CACb,CAAC;AACJ,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* Copyright (c) "Neo4j"
|
|
4
|
+
* Neo4j Sweden AB [http://neo4j.com]
|
|
5
|
+
*
|
|
6
|
+
* This file is part of Neo4j.
|
|
7
|
+
*
|
|
8
|
+
* Neo4j is free software: you can redistribute it and/or modify
|
|
9
|
+
* it under the terms of the GNU General Public License as published by
|
|
10
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
11
|
+
* (at your option) any later version.
|
|
12
|
+
*
|
|
13
|
+
* This program is distributed in the hope that it will be useful,
|
|
14
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
15
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
16
|
+
* GNU General Public License for more details.
|
|
17
|
+
*
|
|
18
|
+
* You should have received a copy of the GNU General Public License
|
|
19
|
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
20
|
+
*/
|
|
21
|
+
export * from './Flex';
|
|
22
|
+
export * from './Box';
|
|
23
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/layout/index.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,cAAc,QAAQ,CAAC;AACvB,cAAc,OAAO,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
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
|
+
import { tokens } from '@neo4j-ndl/base';
|
|
22
|
+
export const SpacingDefaults = {
|
|
23
|
+
padding: '4',
|
|
24
|
+
paddingBlockStart: undefined,
|
|
25
|
+
paddingBlockEnd: undefined,
|
|
26
|
+
paddingInline: undefined,
|
|
27
|
+
paddingInlineStart: undefined,
|
|
28
|
+
paddingInlineEnd: undefined,
|
|
29
|
+
gap: '4',
|
|
30
|
+
};
|
|
31
|
+
export const getSpacing = (spacing, property) => {
|
|
32
|
+
return spacing
|
|
33
|
+
? tokens.space[spacing || SpacingDefaults[property]]
|
|
34
|
+
: undefined;
|
|
35
|
+
};
|
|
36
|
+
export const RadiusDefaults = {
|
|
37
|
+
borderRadius: undefined,
|
|
38
|
+
};
|
|
39
|
+
export const getRadius = (spacing, property) => {
|
|
40
|
+
return spacing
|
|
41
|
+
? tokens.borderRadius[spacing || RadiusDefaults[property]]
|
|
42
|
+
: undefined;
|
|
43
|
+
};
|
|
44
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/layout/types.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAgBzC,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,OAAO,EAAE,GAAG;IACZ,iBAAiB,EAAE,SAAS;IAC5B,eAAe,EAAE,SAAS;IAC1B,aAAa,EAAE,SAAS;IACxB,kBAAkB,EAAE,SAAS;IAC7B,gBAAgB,EAAE,SAAS;IAC3B,GAAG,EAAE,GAAG;CACA,CAAC;AAEX,MAAM,CAAC,MAAM,UAAU,GAAG,CACxB,OAA4B,EAC5B,QAAsC,EACtC,EAAE;IACF,OAAO,OAAO;QACZ,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,IAAI,eAAe,CAAC,QAAQ,CAAC,CAAC;QACpD,CAAC,CAAC,SAAS,CAAC;AAChB,CAAC,CAAC;AAIF,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,YAAY,EAAE,SAAS;CACxB,CAAC;AAEF,MAAM,CAAC,MAAM,SAAS,GAAG,CACvB,OAA2B,EAC3B,QAAqC,EACrC,EAAE;IACF,OAAO,OAAO;QACZ,CAAC,CAAC,MAAM,CAAC,YAAY,CAAC,OAAO,IAAI,cAAc,CAAC,QAAQ,CAAC,CAAC;QAC1D,CAAC,CAAC,SAAS,CAAC;AAChB,CAAC,CAAC"}
|
|
@@ -34,4 +34,8 @@ export interface IconButtonArrayProps extends ElementBase<HTMLDivElement> {
|
|
|
34
34
|
/** If the button is in floating state */
|
|
35
35
|
floating?: boolean;
|
|
36
36
|
}
|
|
37
|
+
/**
|
|
38
|
+
* TODO: v3. Incorporate the `size` prop into the component, and pass it to IconButton children.
|
|
39
|
+
* We need to use also the `size` prop to adjust padding in various sizes, now it has a fixed padding.
|
|
40
|
+
*/
|
|
37
41
|
export declare const IconButtonArray: React.ForwardRefExoticComponent<IconButtonArrayProps & React.RefAttributes<unknown>>;
|
|
@@ -0,0 +1,66 @@
|
|
|
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
|
+
import React, { type ComponentPropsWithoutRef } from 'react';
|
|
22
|
+
import { type CustomElementType, type Spacing, type Radius } from './types';
|
|
23
|
+
type BaseBoxProps<T extends CustomElementType> = {
|
|
24
|
+
/**
|
|
25
|
+
* The DOM element to render as the Box.
|
|
26
|
+
* @default div
|
|
27
|
+
*/
|
|
28
|
+
as?: T;
|
|
29
|
+
/**
|
|
30
|
+
* @default tokens.space['4']
|
|
31
|
+
*/
|
|
32
|
+
padding?: Spacing;
|
|
33
|
+
/**
|
|
34
|
+
* @default undefined
|
|
35
|
+
*/
|
|
36
|
+
paddingBlockStart?: Spacing;
|
|
37
|
+
/**
|
|
38
|
+
* @default undefined
|
|
39
|
+
*/
|
|
40
|
+
paddingBlockEnd?: Spacing;
|
|
41
|
+
/**
|
|
42
|
+
* @default undefined
|
|
43
|
+
*/
|
|
44
|
+
paddingInline?: Spacing;
|
|
45
|
+
/**
|
|
46
|
+
* @default undefined
|
|
47
|
+
*/
|
|
48
|
+
paddingInlineStart?: Spacing;
|
|
49
|
+
/**
|
|
50
|
+
* @default undefined
|
|
51
|
+
*/
|
|
52
|
+
paddingInlineEnd?: Spacing;
|
|
53
|
+
/**
|
|
54
|
+
* @default undefined
|
|
55
|
+
*/
|
|
56
|
+
borderRadius?: Radius;
|
|
57
|
+
children?: React.ReactNode;
|
|
58
|
+
};
|
|
59
|
+
export type BoxProps<T extends CustomElementType> = Omit<ComponentPropsWithoutRef<T>, 'as'> & BaseBoxProps<T>;
|
|
60
|
+
type BoxComponent = <T extends CustomElementType>(props: BoxProps<T>) => React.ReactNode;
|
|
61
|
+
/**
|
|
62
|
+
* Box is a general-purpose container that allows for controlled use of design tokens.
|
|
63
|
+
* Use the given props to configure display behavior and styling that aligns with Needle's tokens.
|
|
64
|
+
*/
|
|
65
|
+
export declare const Box: BoxComponent;
|
|
66
|
+
export {};
|
|
@@ -0,0 +1,80 @@
|
|
|
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
|
+
import React, { type ComponentPropsWithoutRef } from 'react';
|
|
22
|
+
import { type CustomElementType, type Spacing, type Radius } from './types';
|
|
23
|
+
type AllowedFlexElements = 'div' | 'span' | 'ul' | 'ol' | 'li';
|
|
24
|
+
type BaseFlexProps<T extends CustomElementType> = {
|
|
25
|
+
/**
|
|
26
|
+
* The DOM element to render as the Flex,
|
|
27
|
+
* meaning the root node of the children collection.
|
|
28
|
+
* @default div
|
|
29
|
+
*/
|
|
30
|
+
as?: AllowedFlexElements;
|
|
31
|
+
/**
|
|
32
|
+
* @default tokens.space['4']
|
|
33
|
+
*/
|
|
34
|
+
gap?: Spacing;
|
|
35
|
+
/**
|
|
36
|
+
* @default undefined
|
|
37
|
+
*/
|
|
38
|
+
rowGap?: Spacing;
|
|
39
|
+
/**
|
|
40
|
+
* @default undefined
|
|
41
|
+
*/
|
|
42
|
+
columnGap?: Spacing;
|
|
43
|
+
/**
|
|
44
|
+
* @default undefined
|
|
45
|
+
*/
|
|
46
|
+
borderRadius?: Radius;
|
|
47
|
+
/**
|
|
48
|
+
* Flex direction is set to column by default.
|
|
49
|
+
* The `row-reverse` and `column-reverse` values
|
|
50
|
+
* are skipped due to accessibility concerns.
|
|
51
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/CSS/flex-direction#accessibility_concerns
|
|
52
|
+
*
|
|
53
|
+
* @default row
|
|
54
|
+
*/
|
|
55
|
+
flexDirection?: Exclude<React.CSSProperties['flexDirection'], 'row-reverse' | 'column-reverse'>;
|
|
56
|
+
/**
|
|
57
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/CSS/flex-wrap
|
|
58
|
+
* @default nowrap
|
|
59
|
+
*/
|
|
60
|
+
flexWrap?: React.CSSProperties['flexWrap'];
|
|
61
|
+
/**
|
|
62
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/CSS/justify-content
|
|
63
|
+
* @default undefined
|
|
64
|
+
*/
|
|
65
|
+
justifyContent?: React.CSSProperties['justifyContent'];
|
|
66
|
+
/**
|
|
67
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/CSS/align-items
|
|
68
|
+
* @default undefined
|
|
69
|
+
*/
|
|
70
|
+
alignItems?: React.CSSProperties['alignItems'];
|
|
71
|
+
children?: React.ReactNode;
|
|
72
|
+
};
|
|
73
|
+
export type FlexProps<T extends CustomElementType> = Omit<ComponentPropsWithoutRef<T>, 'as'> & BaseFlexProps<T>;
|
|
74
|
+
type FlexComponent = <T extends CustomElementType>(props: FlexProps<T>) => React.ReactNode;
|
|
75
|
+
/**
|
|
76
|
+
* Flex is a general-purpose container that helps
|
|
77
|
+
* lay out components with consistent spacing in a row or column.
|
|
78
|
+
*/
|
|
79
|
+
export declare const Flex: FlexComponent;
|
|
80
|
+
export {};
|
|
@@ -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 './Flex';
|
|
22
|
+
export * from './Box';
|
|
@@ -0,0 +1,48 @@
|
|
|
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 { tokens } from '@neo4j-ndl/base';
|
|
23
|
+
/**
|
|
24
|
+
* Currently supporting only native HTML elements.
|
|
25
|
+
* @todo Allow custom React components as well, like Typography.tsx does.
|
|
26
|
+
*/
|
|
27
|
+
export type CustomElementType = keyof HTMLElementTagNameMap;
|
|
28
|
+
/**
|
|
29
|
+
* More info here:
|
|
30
|
+
* https://stackoverflow.com/questions/75085783/conditional-react-component-properties-with-multiple-generics#comment132505139_75086121
|
|
31
|
+
*/
|
|
32
|
+
export type ReactComponent = (args: any) => JSX.Element;
|
|
33
|
+
export type Spacing = keyof typeof tokens.space;
|
|
34
|
+
export declare const SpacingDefaults: {
|
|
35
|
+
readonly padding: "4";
|
|
36
|
+
readonly paddingBlockStart: undefined;
|
|
37
|
+
readonly paddingBlockEnd: undefined;
|
|
38
|
+
readonly paddingInline: undefined;
|
|
39
|
+
readonly paddingInlineStart: undefined;
|
|
40
|
+
readonly paddingInlineEnd: undefined;
|
|
41
|
+
readonly gap: "4";
|
|
42
|
+
};
|
|
43
|
+
export declare const getSpacing: (spacing: Spacing | undefined, property: keyof typeof SpacingDefaults) => string | undefined;
|
|
44
|
+
export type Radius = keyof typeof tokens.borderRadius;
|
|
45
|
+
export declare const RadiusDefaults: {
|
|
46
|
+
borderRadius: undefined;
|
|
47
|
+
};
|
|
48
|
+
export declare const getRadius: (spacing: Radius | undefined, property: keyof typeof RadiusDefaults) => string | undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@neo4j-ndl/react",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.0",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"description": "React implementation of Neo4j Design System",
|
|
6
6
|
"keywords": [
|
|
@@ -93,7 +93,7 @@
|
|
|
93
93
|
"@floating-ui/react": "0.25.1",
|
|
94
94
|
"@heroicons/react": "2.0.13",
|
|
95
95
|
"@neo4j-cypher/react-codemirror": "^1.0.1",
|
|
96
|
-
"@neo4j-ndl/base": "^2.
|
|
96
|
+
"@neo4j-ndl/base": "^2.2.0",
|
|
97
97
|
"@table-nav/core": "0.0.7",
|
|
98
98
|
"@table-nav/react": "0.0.7",
|
|
99
99
|
"@tanstack/react-table": "^8.9.3",
|