@rolster/react-components 18.12.6 → 18.12.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.
@@ -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-3) solid var(--color-rolster-300);
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-bold);
950
- font-size: 6.6rem;
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, onAction }) {
215
- const contentRef = react.useRef(null);
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 (!contentRef?.current?.contains(target)) {
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: contentRef, "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: () => {
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 caption-semibold", children: subtitle }))] }), actions && (jsxRuntime.jsx("div", { className: "rls-toolbar__actions", children: actions.map((action, index) => (jsxRuntime.jsx("div", { children: action }, index))) }))] }));
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;
@@ -1537,8 +1539,8 @@ function RlsDatatableCell({ children, className, control, overflow }) {
1537
1539
  return (jsxRuntime.jsx("th", { className: (renderClassStatus('rls-datatable__cell', { control, overflow }) +
1538
1540
  ` ${className || ''}`).trim(), children: children }));
1539
1541
  }
1540
- function RlsDatatable({ children, footer, header, rlsTheme }) {
1541
- return (jsxRuntime.jsxs("div", { className: "rls-datatable", "rls-theme": rlsTheme, children: [jsxRuntime.jsxs("table", { children: [header && jsxRuntime.jsx("thead", { className: "rls-datatable__thead", children: header }), jsxRuntime.jsx("tbody", { className: "rls-datatable__tbody", children: children })] }), footer && jsxRuntime.jsx("div", { className: "rls-datatable__tfooter", children: footer })] }));
1542
+ function RlsDatatable({ bodyRef, children, footer, header, rlsTheme }) {
1543
+ return (jsxRuntime.jsxs("div", { className: "rls-datatable", "rls-theme": rlsTheme, children: [jsxRuntime.jsxs("table", { children: [header && jsxRuntime.jsx("thead", { className: "rls-datatable__thead", children: header }), jsxRuntime.jsx("tbody", { ref: bodyRef, className: "rls-datatable__tbody", children: children })] }), footer && jsxRuntime.jsx("div", { className: "rls-datatable__tfooter", children: footer })] }));
1542
1544
  }
1543
1545
 
1544
1546
  const controlIsValid = (props) => {
@@ -1552,21 +1554,8 @@ const controlIsValid = (props) => {
1552
1554
  }, []);
1553
1555
  };
1554
1556
 
1555
- function instanceOfReactControlProps(props) {
1556
- return (typeof props === 'object' && ('state' in props || 'validators' in props));
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);
1557
+ function useControl(controlProps, controlValidators) {
1558
+ const props = helpersForms.createFormControlProps(controlProps, controlValidators);
1570
1559
  const [state, setCurrentState] = react.useState(props.state);
1571
1560
  const [value, setValue] = react.useState(props.state);
1572
1561
  const [touched, setTouched] = react.useState(props.touched || false);
@@ -1645,6 +1634,9 @@ function useReactControl(controlProps, controlValidators) {
1645
1634
  value,
1646
1635
  wrong: touched && !valid
1647
1636
  };
1637
+ }
1638
+ function useReactControl(controlProps, controlValidators) {
1639
+ return useControl(controlProps, controlValidators);
1648
1640
  }
1649
1641
 
1650
1642
  var PickerListenerType;
@@ -2103,6 +2095,7 @@ exports.RlsApplication = RlsApplication;
2103
2095
  exports.RlsAutocompleteField = RlsAutocompleteField;
2104
2096
  exports.RlsAutocompleteFieldTemplate = RlsAutocompleteFieldTemplate;
2105
2097
  exports.RlsAvatar = RlsAvatar;
2098
+ exports.RlsBadge = RlsBadge;
2106
2099
  exports.RlsBallot = RlsBallot;
2107
2100
  exports.RlsBreadcrumb = RlsBreadcrumb;
2108
2101
  exports.RlsButton = RlsButton;