@sb1/ffe-tables-react 10.1.5 → 10.1.7
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/es/TableRowExpandable.js
CHANGED
|
@@ -20,17 +20,16 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
20
20
|
}
|
|
21
21
|
return t;
|
|
22
22
|
};
|
|
23
|
-
import React, { useRef, useState } from 'react';
|
|
23
|
+
import React, { useRef, useState, useId } from 'react';
|
|
24
24
|
import classNames from 'classnames';
|
|
25
25
|
import { Icon } from '@sb1/ffe-icons-react';
|
|
26
26
|
import { Collapse } from '@sb1/ffe-collapse-react';
|
|
27
27
|
import { txt } from './texts';
|
|
28
|
-
import { v4 as uuid } from 'uuid';
|
|
29
28
|
import { CellContent } from './CellContent';
|
|
30
29
|
export var TableRowExpandable = React.forwardRef(function (_a, ref) {
|
|
31
30
|
var className = _a.className, expandContent = _a.expandContent, children = _a.children, _b = _a.locale, locale = _b === void 0 ? 'nb' : _b, onClick = _a.onClick, isDefaultOpen = _a.isDefaultOpen, rest = __rest(_a, ["className", "expandContent", "children", "locale", "onClick", "isDefaultOpen"]);
|
|
32
31
|
var _c = useState(!!isDefaultOpen), isOpen = _c[0], setIsOpen = _c[1];
|
|
33
|
-
var expandoRowId =
|
|
32
|
+
var expandoRowId = useId();
|
|
34
33
|
var _d = useState(false), isAnimating = _d[0], setIsAnimating = _d[1];
|
|
35
34
|
var expandButtonRef = useRef(null);
|
|
36
35
|
return (React.createElement(React.Fragment, null,
|
|
@@ -41,7 +40,6 @@ export var TableRowExpandable = React.forwardRef(function (_a, ref) {
|
|
|
41
40
|
if (!((_a = expandButtonRef.current) === null || _a === void 0 ? void 0 : _a.contains(e.target))) {
|
|
42
41
|
(_b = expandButtonRef.current) === null || _b === void 0 ? void 0 : _b.click();
|
|
43
42
|
}
|
|
44
|
-
onClick === null || onClick === void 0 ? void 0 : onClick(e);
|
|
45
43
|
}, ref: ref }, rest),
|
|
46
44
|
children,
|
|
47
45
|
React.createElement("td", null,
|
|
@@ -50,9 +48,10 @@ export var TableRowExpandable = React.forwardRef(function (_a, ref) {
|
|
|
50
48
|
'ffe-table__expand-button--open': isOpen,
|
|
51
49
|
}), ref: expandButtonRef, type: "button", "aria-label": isOpen
|
|
52
50
|
? txt[locale].showLess
|
|
53
|
-
: txt[locale].showMore, "aria-controls": expandoRowId, "aria-expanded": isOpen, onClick: function () {
|
|
51
|
+
: txt[locale].showMore, "aria-controls": expandoRowId, "aria-expanded": isOpen, onClick: function (e) {
|
|
54
52
|
setIsOpen(function (prev) { return !prev; });
|
|
55
53
|
setIsAnimating(true);
|
|
54
|
+
onClick === null || onClick === void 0 ? void 0 : onClick(e);
|
|
56
55
|
} },
|
|
57
56
|
React.createElement(Icon, { fileUrl: "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgLTk2MCA5NjAgOTYwIiB3aWR0aD0iMjQiPjxwYXRoIGQ9Ik00ODAtMzczLjUzOXEtNy4yMzEgMC0xMy40NjEtMi4zMDgtNi4yMzEtMi4zMDgtMTEuODQ2LTcuOTIzTDI3NC45MjQtNTYzLjUzOXEtOC4zMDgtOC4zMDctOC41LTIwLjg4NC0uMTkzLTEyLjU3NyA4LjUtMjEuMjY5IDguNjkyLTguNjkyIDIxLjA3Ni04LjY5MnQyMS4wNzYgOC42OTJMNDgwLTQ0Mi43NjhsMTYyLjkyNC0xNjIuOTI0cTguMzA3LTguMzA3IDIwLjg4NC04LjUgMTIuNTc2LS4xOTIgMjEuMjY4IDguNSA4LjY5MyA4LjY5MiA4LjY5MyAyMS4wNzcgMCAxMi4zODQtOC42OTMgMjEuMDc2TDUwNS4zMDctMzgzLjc3cS01LjYxNSA1LjYxNS0xMS44NDYgNy45MjMtNi4yMyAyLjMwOC0xMy40NjEgMi4zMDhaIi8+PC9zdmc+", size: "md" }))))),
|
|
58
57
|
React.createElement("tr", { "aria-hidden": !isAnimating && !isOpen, id: expandoRowId },
|
|
@@ -54,12 +54,11 @@ var classnames_1 = __importDefault(require("classnames"));
|
|
|
54
54
|
var ffe_icons_react_1 = require("@sb1/ffe-icons-react");
|
|
55
55
|
var ffe_collapse_react_1 = require("@sb1/ffe-collapse-react");
|
|
56
56
|
var texts_1 = require("./texts");
|
|
57
|
-
var uuid_1 = require("uuid");
|
|
58
57
|
var CellContent_1 = require("./CellContent");
|
|
59
58
|
exports.TableRowExpandable = react_1.default.forwardRef(function (_a, ref) {
|
|
60
59
|
var className = _a.className, expandContent = _a.expandContent, children = _a.children, _b = _a.locale, locale = _b === void 0 ? 'nb' : _b, onClick = _a.onClick, isDefaultOpen = _a.isDefaultOpen, rest = __rest(_a, ["className", "expandContent", "children", "locale", "onClick", "isDefaultOpen"]);
|
|
61
60
|
var _c = (0, react_1.useState)(!!isDefaultOpen), isOpen = _c[0], setIsOpen = _c[1];
|
|
62
|
-
var expandoRowId = (0, react_1.
|
|
61
|
+
var expandoRowId = (0, react_1.useId)();
|
|
63
62
|
var _d = (0, react_1.useState)(false), isAnimating = _d[0], setIsAnimating = _d[1];
|
|
64
63
|
var expandButtonRef = (0, react_1.useRef)(null);
|
|
65
64
|
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
@@ -70,7 +69,6 @@ exports.TableRowExpandable = react_1.default.forwardRef(function (_a, ref) {
|
|
|
70
69
|
if (!((_a = expandButtonRef.current) === null || _a === void 0 ? void 0 : _a.contains(e.target))) {
|
|
71
70
|
(_b = expandButtonRef.current) === null || _b === void 0 ? void 0 : _b.click();
|
|
72
71
|
}
|
|
73
|
-
onClick === null || onClick === void 0 ? void 0 : onClick(e);
|
|
74
72
|
}, ref: ref }, rest),
|
|
75
73
|
children,
|
|
76
74
|
react_1.default.createElement("td", null,
|
|
@@ -79,9 +77,10 @@ exports.TableRowExpandable = react_1.default.forwardRef(function (_a, ref) {
|
|
|
79
77
|
'ffe-table__expand-button--open': isOpen,
|
|
80
78
|
}), ref: expandButtonRef, type: "button", "aria-label": isOpen
|
|
81
79
|
? texts_1.txt[locale].showLess
|
|
82
|
-
: texts_1.txt[locale].showMore, "aria-controls": expandoRowId, "aria-expanded": isOpen, onClick: function () {
|
|
80
|
+
: texts_1.txt[locale].showMore, "aria-controls": expandoRowId, "aria-expanded": isOpen, onClick: function (e) {
|
|
83
81
|
setIsOpen(function (prev) { return !prev; });
|
|
84
82
|
setIsAnimating(true);
|
|
83
|
+
onClick === null || onClick === void 0 ? void 0 : onClick(e);
|
|
85
84
|
} },
|
|
86
85
|
react_1.default.createElement(ffe_icons_react_1.Icon, { fileUrl: "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgLTk2MCA5NjAgOTYwIiB3aWR0aD0iMjQiPjxwYXRoIGQ9Ik00ODAtMzczLjUzOXEtNy4yMzEgMC0xMy40NjEtMi4zMDgtNi4yMzEtMi4zMDgtMTEuODQ2LTcuOTIzTDI3NC45MjQtNTYzLjUzOXEtOC4zMDgtOC4zMDctOC41LTIwLjg4NC0uMTkzLTEyLjU3NyA4LjUtMjEuMjY5IDguNjkyLTguNjkyIDIxLjA3Ni04LjY5MnQyMS4wNzYgOC42OTJMNDgwLTQ0Mi43NjhsMTYyLjkyNC0xNjIuOTI0cTguMzA3LTguMzA3IDIwLjg4NC04LjUgMTIuNTc2LS4xOTIgMjEuMjY4IDguNSA4LjY5MyA4LjY5MiA4LjY5MyAyMS4wNzcgMCAxMi4zODQtOC42OTMgMjEuMDc2TDUwNS4zMDctMzgzLjc3cS01LjYxNSA1LjYxNS0xMS44NDYgNy45MjMtNi4yMyAyLjMwOC0xMy40NjEgMi4zMDhaIi8+PC9zdmc+", size: "md" }))))),
|
|
87
86
|
react_1.default.createElement("tr", { "aria-hidden": !isAnimating && !isOpen, id: expandoRowId },
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sb1/ffe-tables-react",
|
|
3
|
-
"version": "10.1.
|
|
3
|
+
"version": "10.1.7",
|
|
4
4
|
"description": "React implementation of ffe-tables",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "SpareBank 1",
|
|
@@ -42,5 +42,5 @@
|
|
|
42
42
|
"publishConfig": {
|
|
43
43
|
"access": "public"
|
|
44
44
|
},
|
|
45
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "5a02e0de7f86f8d3a9e763ca4f23bdc438938073"
|
|
46
46
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
export interface TableRowExpandableProps extends React.ComponentPropsWithoutRef<'tr'> {
|
|
2
|
+
export interface TableRowExpandableProps extends Omit<React.ComponentPropsWithoutRef<'tr'>, 'onClick'> {
|
|
3
3
|
expandContent: React.ReactNode;
|
|
4
4
|
locale?: 'nb' | 'nn' | 'en';
|
|
5
5
|
isDefaultOpen?: boolean;
|
|
6
|
+
onClick?: React.MouseEventHandler<HTMLButtonElement>;
|
|
6
7
|
}
|
|
7
8
|
export declare const TableRowExpandable: React.ForwardRefExoticComponent<TableRowExpandableProps & React.RefAttributes<HTMLTableRowElement>>;
|