@rolster/react-components 18.12.6 → 18.12.8
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/dist/cjs/assets/{index-r16o2aIF.css → index-7UzJ6VgT.css} +28 -18
- package/dist/cjs/index.js +39 -35
- package/dist/cjs/index.js.map +1 -1
- package/dist/es/assets/{index-r16o2aIF.css → index-7UzJ6VgT.css} +28 -18
- package/dist/es/index.js +38 -36
- package/dist/es/index.js.map +1 -1
- package/dist/esm/components/atoms/Badge/Badge.css +18 -0
- package/dist/esm/components/atoms/Badge/Badge.d.ts +3 -0
- package/dist/esm/components/atoms/Badge/Badge.js +6 -0
- package/dist/esm/components/atoms/Badge/Badge.js.map +1 -0
- package/dist/esm/components/atoms/index.d.ts +1 -0
- package/dist/esm/components/atoms/index.js +1 -0
- package/dist/esm/components/atoms/index.js.map +1 -1
- package/dist/esm/components/molecules/ButtonToggle/ButtonToggle.css +4 -3
- package/dist/esm/components/molecules/ButtonToggle/ButtonToggle.d.ts +3 -2
- package/dist/esm/components/molecules/ButtonToggle/ButtonToggle.js +8 -11
- package/dist/esm/components/molecules/ButtonToggle/ButtonToggle.js.map +1 -1
- package/dist/esm/components/molecules/Toolbar/Toolbar.css +5 -15
- package/dist/esm/components/molecules/Toolbar/Toolbar.js +1 -1
- package/dist/esm/components/molecules/Toolbar/Toolbar.js.map +1 -1
- package/dist/esm/components/organisms/Datatable/Datatable.d.ts +5 -3
- package/dist/esm/components/organisms/Datatable/Datatable.js +7 -8
- package/dist/esm/components/organisms/Datatable/Datatable.js.map +1 -1
- package/dist/esm/hooks/DatatableHook.d.ts +6 -0
- package/dist/esm/hooks/DatatableHook.js +12 -0
- package/dist/esm/hooks/DatatableHook.js.map +1 -0
- package/dist/esm/hooks/index.d.ts +1 -0
- package/dist/esm/hooks/index.js +1 -0
- package/dist/esm/hooks/index.js.map +1 -1
- package/package.json +4 -4
|
@@ -51,6 +51,25 @@
|
|
|
51
51
|
line-height: inherit;
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
+
.rls-badge {
|
|
55
|
+
position: relative;
|
|
56
|
+
display: inline-block;
|
|
57
|
+
width: auto;
|
|
58
|
+
padding: var(--sizing-x2);
|
|
59
|
+
box-sizing: border-box;
|
|
60
|
+
font-size: var(--caption-font-size);
|
|
61
|
+
letter-spacing: var(--caption-letter-spacing);
|
|
62
|
+
line-height: var(--caption-line-height);
|
|
63
|
+
color: var(--color-rolster-500);
|
|
64
|
+
background: var(--color-rolster-100);
|
|
65
|
+
border-radius: var(--sizing-x2);
|
|
66
|
+
}
|
|
67
|
+
.rls-badge > span {
|
|
68
|
+
font-size: inherit;
|
|
69
|
+
letter-spacing: inherit;
|
|
70
|
+
line-height: inherit;
|
|
71
|
+
}
|
|
72
|
+
|
|
54
73
|
.rls-breadcrumb {
|
|
55
74
|
--pvt-link-font-color: var(--color-theme-300);
|
|
56
75
|
display: -webkit-box;
|
|
@@ -933,12 +952,13 @@
|
|
|
933
952
|
overflow-x: hidden;
|
|
934
953
|
z-index: var(--z-index-2);
|
|
935
954
|
background: var(--background-theme-500);
|
|
936
|
-
border: var(--border-
|
|
955
|
+
border: var(--border-1-rolster-500);
|
|
937
956
|
transform: var(--rls-button-toggle-ul-transform);
|
|
938
957
|
transform-origin: 0% 0%;
|
|
939
958
|
transition: transform 240ms 0ms var(--standard-curve),
|
|
940
959
|
opacity 240ms 0ms var(--standard-curve);
|
|
941
960
|
will-change: opacity, transform;
|
|
961
|
+
box-shadow: 0px 0px 0px 3px var(--box-shadow-rolster-500);
|
|
942
962
|
}
|
|
943
963
|
.rls-button-toggle__list ul li {
|
|
944
964
|
padding: 0rem var(--sizing-x6);
|
|
@@ -946,8 +966,8 @@
|
|
|
946
966
|
height: var(--sizing-x20);
|
|
947
967
|
line-height: var(--sizing-x20);
|
|
948
968
|
cursor: default;
|
|
949
|
-
font-weight: var(--font-weight-
|
|
950
|
-
font-size:
|
|
969
|
+
font-weight: var(--font-weight-semibold);
|
|
970
|
+
font-size: 6rem;
|
|
951
971
|
letter-spacing: 0.825px;
|
|
952
972
|
text-transform: uppercase;
|
|
953
973
|
color: var(--color-theme-300);
|
|
@@ -1390,28 +1410,21 @@
|
|
|
1390
1410
|
.rls-toolbar {
|
|
1391
1411
|
display: flex;
|
|
1392
1412
|
justify-content: space-between;
|
|
1413
|
+
align-items: center;
|
|
1393
1414
|
column-gap: var(--sizing-x6);
|
|
1394
1415
|
height: var(--rls-toolbar-height);
|
|
1395
1416
|
}
|
|
1396
1417
|
.rls-toolbar > * {
|
|
1397
1418
|
width: auto;
|
|
1398
1419
|
}
|
|
1399
|
-
.rls-toolbar__content {
|
|
1400
|
-
display: flex;
|
|
1401
|
-
height: 100%;
|
|
1402
|
-
padding: var(--sizing-x2) var(--sizing-x6);
|
|
1403
|
-
box-sizing: border-box;
|
|
1404
|
-
margin: auto 0rem;
|
|
1405
|
-
}
|
|
1406
1420
|
.rls-toolbar__description {
|
|
1421
|
+
display: flex;
|
|
1422
|
+
flex-direction: column;
|
|
1423
|
+
row-gap: var(--sizing-x2);
|
|
1407
1424
|
overflow: hidden;
|
|
1408
|
-
padding: 0rem var(--sizing-x2);
|
|
1409
|
-
box-sizing: border-box;
|
|
1410
|
-
margin: auto 0rem;
|
|
1411
1425
|
}
|
|
1412
1426
|
.rls-toolbar__description > label {
|
|
1413
1427
|
position: relative;
|
|
1414
|
-
float: left;
|
|
1415
1428
|
width: 100%;
|
|
1416
1429
|
overflow: hidden;
|
|
1417
1430
|
text-overflow: ellipsis;
|
|
@@ -1431,11 +1444,8 @@
|
|
|
1431
1444
|
.rls-toolbar__actions {
|
|
1432
1445
|
display: flex;
|
|
1433
1446
|
box-sizing: border-box;
|
|
1434
|
-
margin: auto 0rem;
|
|
1435
1447
|
column-gap: var(--sizing-x8);
|
|
1436
|
-
|
|
1437
|
-
.rls-toolbar__actions > * {
|
|
1438
|
-
margin: auto 0rem;
|
|
1448
|
+
align-items: center;
|
|
1439
1449
|
}
|
|
1440
1450
|
|
|
1441
1451
|
.rls-year-picker {
|
package/dist/cjs/index.js
CHANGED
|
@@ -7,6 +7,7 @@ var helpersDate = require('@rolster/helpers-date');
|
|
|
7
7
|
var helpersString = require('@rolster/helpers-string');
|
|
8
8
|
var i18n = require('@rolster/i18n');
|
|
9
9
|
var ReactDOM = require('react-dom');
|
|
10
|
+
var helpersForms = require('@rolster/helpers-forms');
|
|
10
11
|
require('uuid');
|
|
11
12
|
var rxjs = require('rxjs');
|
|
12
13
|
|
|
@@ -42,6 +43,10 @@ function RlsAvatar({ children, rounded, skeleton, rlsTheme }) {
|
|
|
42
43
|
return (jsxRuntime.jsx("div", { className: renderClassStatus('rls-avatar', { rounded, skeleton }), "rls-theme": rlsTheme, children: children }));
|
|
43
44
|
}
|
|
44
45
|
|
|
46
|
+
function RlsBadge({ children, rlsTheme }) {
|
|
47
|
+
return (jsxRuntime.jsx("div", { className: "rls-badge", "rls-theme": rlsTheme, children: children }));
|
|
48
|
+
}
|
|
49
|
+
|
|
45
50
|
function RlsBreadcrumb({ labels }) {
|
|
46
51
|
return (jsxRuntime.jsx("div", { className: "rls-breadcrumb", children: labels.map(({ label, onClick }, index) => (jsxRuntime.jsx("label", { className: "rls-breadcrumb__label", onClick: onClick, children: jsxRuntime.jsx("a", { className: "rls-breadcrumb__label__a", children: label }) }, index))) }));
|
|
47
52
|
}
|
|
@@ -211,14 +216,14 @@ function RlsBallot({ bordered, children, img, initials, skeleton, subtitle, rlsT
|
|
|
211
216
|
return (jsxRuntime.jsxs("div", { className: renderClassStatus('rls-ballot', { bordered, skeleton }), "rls-theme": rlsTheme, children: [(img || initials) && (jsxRuntime.jsxs(RlsAvatar, { skeleton: skeleton, children: [img && jsxRuntime.jsx("img", { src: img }), initials && jsxRuntime.jsx("span", { children: initials })] })), jsxRuntime.jsxs("div", { className: "rls-ballot__component", children: [jsxRuntime.jsx("label", { className: "rls-ballot__title", children: jsxRuntime.jsx(RlsSkeletonText, { active: skeleton, children: children }) }), subtitle && (jsxRuntime.jsx("label", { className: "rls-ballot__subtitle", children: jsxRuntime.jsx(RlsSkeletonText, { active: skeleton, children: subtitle }) }))] })] }));
|
|
212
217
|
}
|
|
213
218
|
|
|
214
|
-
function RlsButtonToggle({ options, type, disabled, rlsTheme
|
|
215
|
-
const
|
|
219
|
+
function RlsButtonToggle({ onAction, options, type, automatic, disabled, rlsTheme }) {
|
|
220
|
+
const componentRef = react.useRef(null);
|
|
216
221
|
const [firstAction] = options;
|
|
217
222
|
const [action, setAction] = react.useState(firstAction);
|
|
218
223
|
const [visible, setVisible] = react.useState(false);
|
|
219
224
|
react.useEffect(() => {
|
|
220
225
|
function onCloseMenu({ target }) {
|
|
221
|
-
if (!
|
|
226
|
+
if (!componentRef?.current?.contains(target)) {
|
|
222
227
|
setVisible(false);
|
|
223
228
|
}
|
|
224
229
|
}
|
|
@@ -233,17 +238,14 @@ function RlsButtonToggle({ options, type, disabled, rlsTheme, onAction }) {
|
|
|
233
238
|
function onSelectAction(action) {
|
|
234
239
|
setAction(action);
|
|
235
240
|
setVisible(false);
|
|
241
|
+
if (automatic) {
|
|
242
|
+
onAction(action.value);
|
|
243
|
+
}
|
|
236
244
|
}
|
|
237
|
-
return (jsxRuntime.jsxs("div", { className: "rls-button-toggle", ref:
|
|
238
|
-
if (onAction) {
|
|
239
|
-
onAction(action.value);
|
|
240
|
-
}
|
|
241
|
-
}, children: action.label }) })), jsxRuntime.jsx("div", { className: "rls-button-toggle__icon", children: jsxRuntime.jsx(RlsButton, { type: type, prefixIcon: "arrow-ios-down", disabled: disabled, onClick: onClickMenu }) })] }), jsxRuntime.jsx("div", { className: renderClassStatus('rls-button-toggle__list', {
|
|
245
|
+
return (jsxRuntime.jsxs("div", { className: "rls-button-toggle", ref: componentRef, "rls-theme": rlsTheme, children: [jsxRuntime.jsxs("div", { className: "rls-button-toggle__content", children: [action && (jsxRuntime.jsx("div", { className: "rls-button-toggle__action", children: jsxRuntime.jsx(RlsButton, { disabled: disabled, type: type, onClick: () => onAction(action.value), children: action.label }) })), jsxRuntime.jsx("div", { className: "rls-button-toggle__icon", children: jsxRuntime.jsx(RlsButton, { type: type, prefixIcon: "arrow-ios-down", disabled: disabled, onClick: onClickMenu }) })] }), jsxRuntime.jsx("div", { className: renderClassStatus('rls-button-toggle__list', {
|
|
242
246
|
visible,
|
|
243
247
|
hide: !visible
|
|
244
|
-
}), children: jsxRuntime.jsx("ul", { children: options.map((action, index) => (jsxRuntime.jsx("li", { className: "truncate", onClick: () =>
|
|
245
|
-
onSelectAction(action);
|
|
246
|
-
}, children: action.label }, index))) }) })] }));
|
|
248
|
+
}), children: jsxRuntime.jsx("ul", { children: options.map((action, index) => (jsxRuntime.jsx("li", { className: "truncate", onClick: () => onSelectAction(action), children: action.label }, index))) }) })] }));
|
|
247
249
|
}
|
|
248
250
|
|
|
249
251
|
function RlsCheckBoxLabel({ children, disabled, extended, formControl, rlsTheme }) {
|
|
@@ -962,7 +964,7 @@ function RlsTextField({ children, disabled, formControl, placeholder, rlsTheme,
|
|
|
962
964
|
}
|
|
963
965
|
|
|
964
966
|
function RlsToolbar({ actions, children, subtitle }) {
|
|
965
|
-
return (jsxRuntime.jsxs("div", { className: "rls-toolbar", children: [jsxRuntime.jsxs("div", { className: "rls-toolbar__description", children: [children && jsxRuntime.jsx("label", { className: "rls-toolbar__title", children: children }), subtitle && (jsxRuntime.jsx("label", { className: "rls-toolbar__subtitle
|
|
967
|
+
return (jsxRuntime.jsxs("div", { className: "rls-toolbar", children: [jsxRuntime.jsxs("div", { className: "rls-toolbar__description", children: [children && jsxRuntime.jsx("label", { className: "rls-toolbar__title", children: children }), subtitle && (jsxRuntime.jsx("label", { className: "rls-toolbar__subtitle smalltext-semibold", children: subtitle }))] }), actions && (jsxRuntime.jsx("div", { className: "rls-toolbar__actions", children: actions.map((action, index) => (jsxRuntime.jsx("div", { children: action }, index))) }))] }));
|
|
966
968
|
}
|
|
967
969
|
|
|
968
970
|
const COUNT_YEAR_RANGE = 4;
|
|
@@ -1112,6 +1114,17 @@ const reactI18n = i18n.i18n({
|
|
|
1112
1114
|
}
|
|
1113
1115
|
});
|
|
1114
1116
|
|
|
1117
|
+
function useDatatable() {
|
|
1118
|
+
const [scrolleable, setScrolleable] = react.useState(false);
|
|
1119
|
+
const bodyRef = react.useRef(null);
|
|
1120
|
+
react.useEffect(() => {
|
|
1121
|
+
const scrollHeight = bodyRef?.current?.scrollHeight || 0;
|
|
1122
|
+
const clientHeight = bodyRef?.current?.clientHeight || 0;
|
|
1123
|
+
setScrolleable(scrollHeight > clientHeight);
|
|
1124
|
+
}, [bodyRef]);
|
|
1125
|
+
return { bodyRef, scrolleable };
|
|
1126
|
+
}
|
|
1127
|
+
|
|
1115
1128
|
class ListCollection {
|
|
1116
1129
|
constructor(value) {
|
|
1117
1130
|
this.value = value;
|
|
@@ -1526,19 +1539,18 @@ function RlsDatatableHeader({ children }) {
|
|
|
1526
1539
|
return jsxRuntime.jsx("tr", { className: "rls-datatable__header", children: children });
|
|
1527
1540
|
}
|
|
1528
1541
|
function RlsDatatableTitle({ children, className, control }) {
|
|
1529
|
-
return (jsxRuntime.jsx("th", { className:
|
|
1530
|
-
` ${className || ''}`).trim(), children: children }));
|
|
1542
|
+
return (jsxRuntime.jsx("th", { className: renderClassStatus('rls-datatable__title', { control }, className).trim(), children: children }));
|
|
1531
1543
|
}
|
|
1532
1544
|
function RlsDatatableData({ children, className, error }) {
|
|
1533
|
-
return (jsxRuntime.jsx("tr", { className:
|
|
1534
|
-
` ${className || ''}`).trim(), children: children }));
|
|
1545
|
+
return (jsxRuntime.jsx("tr", { className: renderClassStatus('rls-datatable__data', { error }, className).trim(), children: children }));
|
|
1535
1546
|
}
|
|
1536
1547
|
function RlsDatatableCell({ children, className, control, overflow }) {
|
|
1537
|
-
return (jsxRuntime.jsx("th", { className:
|
|
1538
|
-
` ${className || ''}`).trim(), children: children }));
|
|
1548
|
+
return (jsxRuntime.jsx("th", { className: renderClassStatus('rls-datatable__cell', { control, overflow }, className).trim(), children: children }));
|
|
1539
1549
|
}
|
|
1540
|
-
function RlsDatatable({ children, footer, header, rlsTheme }) {
|
|
1541
|
-
return (jsxRuntime.jsxs("div", { className:
|
|
1550
|
+
function RlsDatatable({ children, datatable, footer, header, rlsTheme }) {
|
|
1551
|
+
return (jsxRuntime.jsxs("div", { className: renderClassStatus('rls-datatable', {
|
|
1552
|
+
scrolleable: datatable?.scrolleable
|
|
1553
|
+
}), "rls-theme": rlsTheme, children: [jsxRuntime.jsxs("table", { children: [header && jsxRuntime.jsx("thead", { className: "rls-datatable__thead", children: header }), jsxRuntime.jsx("tbody", { ref: datatable?.bodyRef, className: "rls-datatable__tbody", children: children })] }), footer && jsxRuntime.jsx("div", { className: "rls-datatable__tfooter", children: footer })] }));
|
|
1542
1554
|
}
|
|
1543
1555
|
|
|
1544
1556
|
const controlIsValid = (props) => {
|
|
@@ -1552,21 +1564,8 @@ const controlIsValid = (props) => {
|
|
|
1552
1564
|
}, []);
|
|
1553
1565
|
};
|
|
1554
1566
|
|
|
1555
|
-
function
|
|
1556
|
-
|
|
1557
|
-
}
|
|
1558
|
-
function createReactControlProps(...argsProps) {
|
|
1559
|
-
if (argsProps.length < 1) {
|
|
1560
|
-
return { state: undefined, validators: undefined };
|
|
1561
|
-
}
|
|
1562
|
-
const [state, validators] = argsProps;
|
|
1563
|
-
if (argsProps.length < 2 && instanceOfReactControlProps(state)) {
|
|
1564
|
-
return state;
|
|
1565
|
-
}
|
|
1566
|
-
return { state: state, validators };
|
|
1567
|
-
}
|
|
1568
|
-
function useReactControl(controlProps, controlValidators) {
|
|
1569
|
-
const props = createReactControlProps(controlProps, controlValidators);
|
|
1567
|
+
function useControl(controlProps, controlValidators) {
|
|
1568
|
+
const props = helpersForms.createFormControlProps(controlProps, controlValidators);
|
|
1570
1569
|
const [state, setCurrentState] = react.useState(props.state);
|
|
1571
1570
|
const [value, setValue] = react.useState(props.state);
|
|
1572
1571
|
const [touched, setTouched] = react.useState(props.touched || false);
|
|
@@ -1645,6 +1644,9 @@ function useReactControl(controlProps, controlValidators) {
|
|
|
1645
1644
|
value,
|
|
1646
1645
|
wrong: touched && !valid
|
|
1647
1646
|
};
|
|
1647
|
+
}
|
|
1648
|
+
function useReactControl(controlProps, controlValidators) {
|
|
1649
|
+
return useControl(controlProps, controlValidators);
|
|
1648
1650
|
}
|
|
1649
1651
|
|
|
1650
1652
|
var PickerListenerType;
|
|
@@ -2103,6 +2105,7 @@ exports.RlsApplication = RlsApplication;
|
|
|
2103
2105
|
exports.RlsAutocompleteField = RlsAutocompleteField;
|
|
2104
2106
|
exports.RlsAutocompleteFieldTemplate = RlsAutocompleteFieldTemplate;
|
|
2105
2107
|
exports.RlsAvatar = RlsAvatar;
|
|
2108
|
+
exports.RlsBadge = RlsBadge;
|
|
2106
2109
|
exports.RlsBallot = RlsBallot;
|
|
2107
2110
|
exports.RlsBreadcrumb = RlsBreadcrumb;
|
|
2108
2111
|
exports.RlsButton = RlsButton;
|
|
@@ -2160,6 +2163,7 @@ exports.RlsToolbar = RlsToolbar;
|
|
|
2160
2163
|
exports.RlsYearPicker = RlsYearPicker;
|
|
2161
2164
|
exports.renderClassStatus = renderClassStatus;
|
|
2162
2165
|
exports.useConfirmationService = useConfirmationService;
|
|
2166
|
+
exports.useDatatable = useDatatable;
|
|
2163
2167
|
exports.useListControl = useListControl;
|
|
2164
2168
|
exports.useSnackbarService = useSnackbarService;
|
|
2165
2169
|
//# sourceMappingURL=index.js.map
|