@dnb/eufemia 9.41.0 → 9.42.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 +17 -0
- package/cjs/components/accordion/style/_accordion.scss +1 -1
- package/cjs/components/table/Table.d.ts +2 -2
- package/cjs/components/table/Table.js +1 -1
- package/cjs/components/table/TableContainer.js +2 -2
- package/cjs/components/table/index.d.ts +1 -0
- package/cjs/components/table/index.js +11 -1
- package/cjs/components/table/style/_table-accordion.scss +5 -0
- package/cjs/components/table/style/_table-container.scss +13 -1
- package/cjs/components/table/style/_table-header-buttons.scss +20 -1
- package/cjs/components/table/style/dnb-table.css +49 -5
- package/cjs/components/table/style/dnb-table.min.css +3 -3
- package/cjs/components/table/useHandleSortState.d.ts +34 -0
- package/cjs/components/table/useHandleSortState.js +196 -0
- package/cjs/fragments/scroll-view/style/_scroll-view.scss +3 -0
- package/cjs/shared/Eufemia.js +1 -1
- package/cjs/style/dnb-ui-components.css +52 -6
- package/cjs/style/dnb-ui-components.min.css +4 -4
- package/cjs/style/dnb-ui-fragments.css +3 -1
- package/cjs/style/dnb-ui-fragments.min.css +1 -1
- package/components/accordion/style/_accordion.scss +1 -1
- package/components/table/Table.d.ts +2 -2
- package/components/table/Table.js +1 -1
- package/components/table/TableContainer.js +2 -2
- package/components/table/index.d.ts +1 -0
- package/components/table/index.js +1 -0
- package/components/table/style/_table-accordion.scss +5 -0
- package/components/table/style/_table-container.scss +13 -1
- package/components/table/style/_table-header-buttons.scss +20 -1
- package/components/table/style/dnb-table.css +49 -5
- package/components/table/style/dnb-table.min.css +3 -3
- package/components/table/useHandleSortState.d.ts +34 -0
- package/components/table/useHandleSortState.js +141 -0
- package/es/components/accordion/style/_accordion.scss +1 -1
- package/es/components/table/Table.d.ts +2 -2
- package/es/components/table/Table.js +1 -1
- package/es/components/table/TableContainer.js +2 -2
- package/es/components/table/index.d.ts +1 -0
- package/es/components/table/index.js +1 -0
- package/es/components/table/style/_table-accordion.scss +5 -0
- package/es/components/table/style/_table-container.scss +13 -1
- package/es/components/table/style/_table-header-buttons.scss +20 -1
- package/es/components/table/style/dnb-table.css +49 -5
- package/es/components/table/style/dnb-table.min.css +3 -3
- package/es/components/table/useHandleSortState.d.ts +34 -0
- package/es/components/table/useHandleSortState.js +111 -0
- package/es/fragments/scroll-view/style/_scroll-view.scss +3 -0
- package/es/shared/Eufemia.js +1 -1
- package/es/style/dnb-ui-components.css +52 -6
- package/es/style/dnb-ui-components.min.css +4 -4
- package/es/style/dnb-ui-fragments.css +3 -1
- package/es/style/dnb-ui-fragments.min.css +1 -1
- package/esm/dnb-ui-basis.min.mjs +1 -1
- package/esm/dnb-ui-components.min.mjs +1 -1
- package/esm/dnb-ui-elements.min.mjs +2 -2
- package/esm/dnb-ui-extensions.min.mjs +1 -1
- package/esm/dnb-ui-lib.min.mjs +2 -2
- package/esm/dnb-ui-web-components.min.mjs +2 -2
- package/fragments/scroll-view/style/_scroll-view.scss +3 -0
- package/package.json +1 -1
- package/shared/Eufemia.js +1 -1
- package/style/dnb-ui-components.css +52 -6
- package/style/dnb-ui-components.min.css +4 -4
- package/style/dnb-ui-fragments.css +3 -1
- package/style/dnb-ui-fragments.min.css +1 -1
- package/umd/dnb-ui-basis.min.js +1 -1
- package/umd/dnb-ui-components.min.js +1 -1
- package/umd/dnb-ui-elements.min.js +2 -2
- package/umd/dnb-ui-extensions.min.js +1 -1
- package/umd/dnb-ui-lib.min.js +2 -2
- package/umd/dnb-ui-web-components.min.js +2 -2
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
+
|
|
3
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
4
|
+
|
|
5
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
6
|
+
|
|
7
|
+
import React from 'react';
|
|
8
|
+
export function useHandleSortState(config, defaults = {
|
|
9
|
+
direction: 'asc',
|
|
10
|
+
modes: ['asc', 'desc', 'off']
|
|
11
|
+
}) {
|
|
12
|
+
const initialState = React.useMemo(() => {
|
|
13
|
+
return Object.entries(config).reduce((acc, [name, opts]) => {
|
|
14
|
+
acc[name] = _objectSpread(_objectSpread({}, defaults), opts);
|
|
15
|
+
|
|
16
|
+
if (!acc[name].active && !acc[name].lastDirection) {
|
|
17
|
+
acc[name].lastDirection = acc[name].direction;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
return acc;
|
|
21
|
+
}, {});
|
|
22
|
+
}, [config, defaults]);
|
|
23
|
+
const [internalState, setState] = React.useState(initialState);
|
|
24
|
+
const sortHandler = React.useMemo(() => {
|
|
25
|
+
const list = Object.entries(internalState);
|
|
26
|
+
return list.reduce((acc, [name, opts]) => {
|
|
27
|
+
acc[name] = () => {
|
|
28
|
+
const state = _objectSpread({}, internalState[name]);
|
|
29
|
+
|
|
30
|
+
if (!state.active && state.lastDirection) {
|
|
31
|
+
state.direction = state.lastDirection;
|
|
32
|
+
state.active = true;
|
|
33
|
+
state.lastDirection = null;
|
|
34
|
+
} else {
|
|
35
|
+
state.direction = getNextMode({
|
|
36
|
+
state,
|
|
37
|
+
opts,
|
|
38
|
+
defaults
|
|
39
|
+
});
|
|
40
|
+
state.active = state.direction !== 'off';
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
setState(_objectSpread(_objectSpread({}, list.reduce((acc, [name, opts]) => {
|
|
44
|
+
acc[name] = opts;
|
|
45
|
+
acc[name].active = false;
|
|
46
|
+
|
|
47
|
+
if (opts.direction !== 'off') {
|
|
48
|
+
acc[name].lastDirection = opts.direction;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return acc;
|
|
52
|
+
}, {})), {}, {
|
|
53
|
+
[name]: state
|
|
54
|
+
}));
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
return acc;
|
|
58
|
+
}, {});
|
|
59
|
+
}, [internalState]);
|
|
60
|
+
let activeSortName = null;
|
|
61
|
+
const sortState = Object.entries(internalState).reduce((acc, [name, {
|
|
62
|
+
active,
|
|
63
|
+
direction
|
|
64
|
+
}]) => {
|
|
65
|
+
const reversed = direction === 'off' ? undefined : direction === 'desc';
|
|
66
|
+
acc[name] = {
|
|
67
|
+
active,
|
|
68
|
+
direction,
|
|
69
|
+
reversed
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
if (active) {
|
|
73
|
+
activeSortName = name;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
return acc;
|
|
77
|
+
}, {});
|
|
78
|
+
return {
|
|
79
|
+
sortState,
|
|
80
|
+
sortHandler,
|
|
81
|
+
activeSortName
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
function getNextMode({
|
|
85
|
+
state,
|
|
86
|
+
opts,
|
|
87
|
+
defaults
|
|
88
|
+
}) {
|
|
89
|
+
const modes = defaults.modes.filter(mode => {
|
|
90
|
+
return opts.modes.includes(mode);
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
for (let i = 0, l = modes.length; i < l; i++) {
|
|
94
|
+
const mode = modes[i];
|
|
95
|
+
|
|
96
|
+
if (mode === state.direction) {
|
|
97
|
+
let c = i + 1;
|
|
98
|
+
|
|
99
|
+
if (c >= l) {
|
|
100
|
+
c = 0;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
state.direction = modes[c];
|
|
104
|
+
break;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
return state.direction;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
export default useHandleSortState;
|
package/es/shared/Eufemia.js
CHANGED
|
@@ -563,7 +563,9 @@
|
|
|
563
563
|
-webkit-overflow-scrolling: touch;
|
|
564
564
|
-ms-overflow-style: auto;
|
|
565
565
|
scrollbar-color: #14555a transparent;
|
|
566
|
-
scrollbar-color: var(--color-emerald-green) transparent;
|
|
566
|
+
scrollbar-color: var(--color-emerald-green) transparent;
|
|
567
|
+
-ms-scroll-chaining: chained;
|
|
568
|
+
overscroll-behavior: auto; }
|
|
567
569
|
html:not([data-visual-test]) .dnb-scroll-view {
|
|
568
570
|
scroll-behavior: smooth; }
|
|
569
571
|
html[data-visual-test] .dnb-scroll-view {
|
|
@@ -7361,12 +7363,33 @@ span.dnb-space--no-collapse > span {
|
|
|
7361
7363
|
html:not([data-whatintent='touch'])
|
|
7362
7364
|
.dnb-table .dnb-table__th.dnb-table--sortable .dnb-table__sort-button.dnb-button:focus:not([disabled])::before {
|
|
7363
7365
|
right: -0.5rem; }
|
|
7364
|
-
.dnb-table > thead > tr > th.dnb-table--sortable .dnb-table__sort-button.dnb-button:focus:not([disabled]) .dnb-icon,
|
|
7366
|
+
html[data-visual-test] .dnb-table > thead > tr > th.dnb-table--sortable .dnb-table__sort-button.dnb-button:focus:not([disabled]) .dnb-icon,
|
|
7367
|
+
:not(.dnb-table--active) .dnb-table > thead > tr > th.dnb-table--sortable .dnb-table__sort-button.dnb-button:focus:not([disabled]):active .dnb-icon, html[data-visual-test]
|
|
7365
7368
|
html:not([data-whatintent='touch']) .dnb-table > thead > tr > th.dnb-table--sortable .dnb-table__sort-button.dnb-button:focus:not([disabled]) .dnb-icon,
|
|
7369
|
+
:not(.dnb-table--active)
|
|
7370
|
+
html:not([data-whatintent='touch']) .dnb-table > thead > tr > th.dnb-table--sortable .dnb-table__sort-button.dnb-button:focus:not([disabled]):active .dnb-icon, html[data-visual-test]
|
|
7371
|
+
.dnb-table .dnb-table__th.dnb-table--sortable .dnb-table__sort-button.dnb-button:focus:not([disabled]) .dnb-icon,
|
|
7372
|
+
:not(.dnb-table--active)
|
|
7373
|
+
.dnb-table .dnb-table__th.dnb-table--sortable .dnb-table__sort-button.dnb-button:focus:not([disabled]):active .dnb-icon, html[data-visual-test]
|
|
7374
|
+
html:not([data-whatintent='touch'])
|
|
7366
7375
|
.dnb-table .dnb-table__th.dnb-table--sortable .dnb-table__sort-button.dnb-button:focus:not([disabled]) .dnb-icon,
|
|
7376
|
+
:not(.dnb-table--active)
|
|
7367
7377
|
html:not([data-whatintent='touch'])
|
|
7368
|
-
.dnb-table .dnb-table__th.dnb-table--sortable .dnb-table__sort-button.dnb-button:focus:not([disabled]) .dnb-icon {
|
|
7378
|
+
.dnb-table .dnb-table__th.dnb-table--sortable .dnb-table__sort-button.dnb-button:focus:not([disabled]):active .dnb-icon {
|
|
7369
7379
|
opacity: 1; }
|
|
7380
|
+
html:not([data-visual-test]) .dnb-table > thead > tr > th.dnb-table--sortable .dnb-table__sort-button.dnb-button:focus:not([disabled]) .dnb-button__text::after, html:not([data-visual-test])
|
|
7381
|
+
html:not([data-whatintent='touch']) .dnb-table > thead > tr > th.dnb-table--sortable .dnb-table__sort-button.dnb-button:focus:not([disabled]) .dnb-button__text::after, html:not([data-visual-test])
|
|
7382
|
+
.dnb-table .dnb-table__th.dnb-table--sortable .dnb-table__sort-button.dnb-button:focus:not([disabled]) .dnb-button__text::after, html:not([data-visual-test])
|
|
7383
|
+
html:not([data-whatintent='touch'])
|
|
7384
|
+
.dnb-table .dnb-table__th.dnb-table--sortable .dnb-table__sort-button.dnb-button:focus:not([disabled]) .dnb-button__text::after {
|
|
7385
|
+
opacity: 1;
|
|
7386
|
+
color: inherit; }
|
|
7387
|
+
html:not([data-visual-test]) .dnb-table > thead > tr > th.dnb-table--sortable .dnb-table__sort-button.dnb-button:focus:not([disabled]):not(:active) .dnb-button__text::after, html:not([data-visual-test])
|
|
7388
|
+
html:not([data-whatintent='touch']) .dnb-table > thead > tr > th.dnb-table--sortable .dnb-table__sort-button.dnb-button:focus:not([disabled]):not(:active) .dnb-button__text::after, html:not([data-visual-test])
|
|
7389
|
+
.dnb-table .dnb-table__th.dnb-table--sortable .dnb-table__sort-button.dnb-button:focus:not([disabled]):not(:active) .dnb-button__text::after, html:not([data-visual-test])
|
|
7390
|
+
html:not([data-whatintent='touch'])
|
|
7391
|
+
.dnb-table .dnb-table__th.dnb-table--sortable .dnb-table__sort-button.dnb-button:focus:not([disabled]):not(:active) .dnb-button__text::after {
|
|
7392
|
+
visibility: visible; }
|
|
7370
7393
|
.dnb-table > thead > tr > th.dnb-table--sortable .dnb-table__sort-button.dnb-button:active[disabled],
|
|
7371
7394
|
html:not([data-whatintent='touch']) .dnb-table > thead > tr > th.dnb-table--sortable .dnb-table__sort-button.dnb-button:active[disabled],
|
|
7372
7395
|
.dnb-table .dnb-table__th.dnb-table--sortable .dnb-table__sort-button.dnb-button:active[disabled],
|
|
@@ -7500,6 +7523,18 @@ span.dnb-space--no-collapse > span {
|
|
|
7500
7523
|
color: #007272;
|
|
7501
7524
|
color: var(--color-sea-green);
|
|
7502
7525
|
opacity: 1; }
|
|
7526
|
+
.dnb-table > thead > tr > th.dnb-table--active .dnb-table__sort-button.dnb-button:focus[disabled],
|
|
7527
|
+
html:not([data-whatintent='touch']) .dnb-table > thead > tr > th.dnb-table--active .dnb-table__sort-button.dnb-button:focus[disabled],
|
|
7528
|
+
.dnb-table .dnb-table__th.dnb-table--active .dnb-table__sort-button.dnb-button:focus[disabled],
|
|
7529
|
+
html:not([data-whatintent='touch'])
|
|
7530
|
+
.dnb-table .dnb-table__th.dnb-table--active .dnb-table__sort-button.dnb-button:focus[disabled] {
|
|
7531
|
+
cursor: not-allowed; }
|
|
7532
|
+
.dnb-table > thead > tr > th.dnb-table--active .dnb-table__sort-button.dnb-button:focus:not([disabled]) .dnb-button__text::after,
|
|
7533
|
+
html:not([data-whatintent='touch']) .dnb-table > thead > tr > th.dnb-table--active .dnb-table__sort-button.dnb-button:focus:not([disabled]) .dnb-button__text::after,
|
|
7534
|
+
.dnb-table .dnb-table__th.dnb-table--active .dnb-table__sort-button.dnb-button:focus:not([disabled]) .dnb-button__text::after,
|
|
7535
|
+
html:not([data-whatintent='touch'])
|
|
7536
|
+
.dnb-table .dnb-table__th.dnb-table--active .dnb-table__sort-button.dnb-button:focus:not([disabled]) .dnb-button__text::after {
|
|
7537
|
+
opacity: 0; }
|
|
7503
7538
|
.dnb-table > thead > tr > th.dnb-table--active .dnb-table__sort-button.dnb-button:hover:focus:not(:active) .dnb-button__text::after,
|
|
7504
7539
|
.dnb-table .dnb-table__th.dnb-table--active .dnb-table__sort-button.dnb-button:hover:focus:not(:active) .dnb-button__text::after {
|
|
7505
7540
|
visibility: visible; }
|
|
@@ -7787,12 +7822,18 @@ thead > tr > th.dnb-table--active .dnb-table__sort-button.dnb-button:hover:focus
|
|
|
7787
7822
|
flex-direction: column; }
|
|
7788
7823
|
.dnb-table__container__body .dnb-table:not([class*='space__bottom']) {
|
|
7789
7824
|
margin-bottom: 0; }
|
|
7825
|
+
.dnb-table__container__body .dnb-table__size--large .dnb-table__th {
|
|
7826
|
+
padding-top: 1.5rem; }
|
|
7790
7827
|
.dnb-table__container__head {
|
|
7791
7828
|
padding: 2rem 1rem 0; }
|
|
7829
|
+
.dnb-table__container__head--empty {
|
|
7830
|
+
padding: 0.5rem 0 0; }
|
|
7792
7831
|
.dnb-spacing .dnb-table__container__head .dnb-h--large:not([class*='space__top']) {
|
|
7793
7832
|
margin: 0; }
|
|
7794
7833
|
.dnb-table__container__foot {
|
|
7795
|
-
padding:
|
|
7834
|
+
padding: 1rem 1rem 1.5rem; }
|
|
7835
|
+
.dnb-table__container__foot--empty {
|
|
7836
|
+
padding: 0 0 1rem; }
|
|
7796
7837
|
.dnb-modal__content .dnb-table__container .dnb-table__scroll-view {
|
|
7797
7838
|
overflow: visible; }
|
|
7798
7839
|
|
|
@@ -7858,12 +7899,15 @@ thead > tr > th.dnb-table--active .dnb-table__sort-button.dnb-button:hover:focus
|
|
|
7858
7899
|
var(--color-black-20); }
|
|
7859
7900
|
.dnb-table__th.dnb-table__th__accordion-icon {
|
|
7860
7901
|
padding: 0; }
|
|
7902
|
+
.dnb-table__th.dnb-table__th__accordion-icon,
|
|
7861
7903
|
.dnb-table__th.dnb-table__th__accordion-icon div {
|
|
7862
7904
|
width: 3.5rem;
|
|
7863
7905
|
text-indent: -300vw; }
|
|
7864
|
-
.dnb-table__size--medium .dnb-table__th.dnb-table__th__accordion-icon
|
|
7906
|
+
.dnb-table__size--medium .dnb-table__th.dnb-table__th__accordion-icon, .dnb-table__size--medium
|
|
7907
|
+
.dnb-table__th.dnb-table__th__accordion-icon div {
|
|
7865
7908
|
width: 3rem; }
|
|
7866
|
-
.dnb-table__size--small .dnb-table__th.dnb-table__th__accordion-icon
|
|
7909
|
+
.dnb-table__size--small .dnb-table__th.dnb-table__th__accordion-icon, .dnb-table__size--small
|
|
7910
|
+
.dnb-table__th.dnb-table__th__accordion-icon div {
|
|
7867
7911
|
width: 2.5rem; }
|
|
7868
7912
|
.dnb-table__td.dnb-table__td__accordion-icon {
|
|
7869
7913
|
padding: 0;
|
|
@@ -7974,6 +8018,8 @@ thead > tr > th.dnb-table--active .dnb-table__sort-button.dnb-button:hover:focus
|
|
|
7974
8018
|
* we trick VoiceOver to not make this row as the end of the table. We still need "hidden" to get the correct number of rows (childCount).
|
|
7975
8019
|
*/
|
|
7976
8020
|
display: block; } }
|
|
8021
|
+
.dnb-table__tr__accordion_content td {
|
|
8022
|
+
width: 100%; }
|
|
7977
8023
|
.dnb-table__tr__accordion_content td::before {
|
|
7978
8024
|
content: '';
|
|
7979
8025
|
position: absolute;
|