@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/es/index.js CHANGED
@@ -5,6 +5,7 @@ import { daysFromMonth, weight, assignDay, DAY_LABELS, formatDate, between, Date
5
5
  import { hasPattern } from '@rolster/helpers-string';
6
6
  import { i18n } from '@rolster/i18n';
7
7
  import ReactDOM from 'react-dom';
8
+ import { createFormControlProps } from '@rolster/helpers-forms';
8
9
  import 'uuid';
9
10
  import { BehaviorSubject } from 'rxjs';
10
11
 
@@ -40,6 +41,10 @@ function RlsAvatar({ children, rounded, skeleton, rlsTheme }) {
40
41
  return (jsx("div", { className: renderClassStatus('rls-avatar', { rounded, skeleton }), "rls-theme": rlsTheme, children: children }));
41
42
  }
42
43
 
44
+ function RlsBadge({ children, rlsTheme }) {
45
+ return (jsx("div", { className: "rls-badge", "rls-theme": rlsTheme, children: children }));
46
+ }
47
+
43
48
  function RlsBreadcrumb({ labels }) {
44
49
  return (jsx("div", { className: "rls-breadcrumb", children: labels.map(({ label, onClick }, index) => (jsx("label", { className: "rls-breadcrumb__label", onClick: onClick, children: jsx("a", { className: "rls-breadcrumb__label__a", children: label }) }, index))) }));
45
50
  }
@@ -209,14 +214,14 @@ function RlsBallot({ bordered, children, img, initials, skeleton, subtitle, rlsT
209
214
  return (jsxs("div", { className: renderClassStatus('rls-ballot', { bordered, skeleton }), "rls-theme": rlsTheme, children: [(img || initials) && (jsxs(RlsAvatar, { skeleton: skeleton, children: [img && jsx("img", { src: img }), initials && jsx("span", { children: initials })] })), jsxs("div", { className: "rls-ballot__component", children: [jsx("label", { className: "rls-ballot__title", children: jsx(RlsSkeletonText, { active: skeleton, children: children }) }), subtitle && (jsx("label", { className: "rls-ballot__subtitle", children: jsx(RlsSkeletonText, { active: skeleton, children: subtitle }) }))] })] }));
210
215
  }
211
216
 
212
- function RlsButtonToggle({ options, type, disabled, rlsTheme, onAction }) {
213
- const contentRef = useRef(null);
217
+ function RlsButtonToggle({ onAction, options, type, automatic, disabled, rlsTheme }) {
218
+ const componentRef = useRef(null);
214
219
  const [firstAction] = options;
215
220
  const [action, setAction] = useState(firstAction);
216
221
  const [visible, setVisible] = useState(false);
217
222
  useEffect(() => {
218
223
  function onCloseMenu({ target }) {
219
- if (!contentRef?.current?.contains(target)) {
224
+ if (!componentRef?.current?.contains(target)) {
220
225
  setVisible(false);
221
226
  }
222
227
  }
@@ -231,17 +236,14 @@ function RlsButtonToggle({ options, type, disabled, rlsTheme, onAction }) {
231
236
  function onSelectAction(action) {
232
237
  setAction(action);
233
238
  setVisible(false);
239
+ if (automatic) {
240
+ onAction(action.value);
241
+ }
234
242
  }
235
- return (jsxs("div", { className: "rls-button-toggle", ref: contentRef, "rls-theme": rlsTheme, children: [jsxs("div", { className: "rls-button-toggle__content", children: [action && (jsx("div", { className: "rls-button-toggle__action", children: jsx(RlsButton, { disabled: disabled, type: type, onClick: () => {
236
- if (onAction) {
237
- onAction(action.value);
238
- }
239
- }, children: action.label }) })), jsx("div", { className: "rls-button-toggle__icon", children: jsx(RlsButton, { type: type, prefixIcon: "arrow-ios-down", disabled: disabled, onClick: onClickMenu }) })] }), jsx("div", { className: renderClassStatus('rls-button-toggle__list', {
243
+ return (jsxs("div", { className: "rls-button-toggle", ref: componentRef, "rls-theme": rlsTheme, children: [jsxs("div", { className: "rls-button-toggle__content", children: [action && (jsx("div", { className: "rls-button-toggle__action", children: jsx(RlsButton, { disabled: disabled, type: type, onClick: () => onAction(action.value), children: action.label }) })), jsx("div", { className: "rls-button-toggle__icon", children: jsx(RlsButton, { type: type, prefixIcon: "arrow-ios-down", disabled: disabled, onClick: onClickMenu }) })] }), jsx("div", { className: renderClassStatus('rls-button-toggle__list', {
240
244
  visible,
241
245
  hide: !visible
242
- }), children: jsx("ul", { children: options.map((action, index) => (jsx("li", { className: "truncate", onClick: () => {
243
- onSelectAction(action);
244
- }, children: action.label }, index))) }) })] }));
246
+ }), children: jsx("ul", { children: options.map((action, index) => (jsx("li", { className: "truncate", onClick: () => onSelectAction(action), children: action.label }, index))) }) })] }));
245
247
  }
246
248
 
247
249
  function RlsCheckBoxLabel({ children, disabled, extended, formControl, rlsTheme }) {
@@ -960,7 +962,7 @@ function RlsTextField({ children, disabled, formControl, placeholder, rlsTheme,
960
962
  }
961
963
 
962
964
  function RlsToolbar({ actions, children, subtitle }) {
963
- return (jsxs("div", { className: "rls-toolbar", children: [jsxs("div", { className: "rls-toolbar__description", children: [children && jsx("label", { className: "rls-toolbar__title", children: children }), subtitle && (jsx("label", { className: "rls-toolbar__subtitle caption-semibold", children: subtitle }))] }), actions && (jsx("div", { className: "rls-toolbar__actions", children: actions.map((action, index) => (jsx("div", { children: action }, index))) }))] }));
965
+ return (jsxs("div", { className: "rls-toolbar", children: [jsxs("div", { className: "rls-toolbar__description", children: [children && jsx("label", { className: "rls-toolbar__title", children: children }), subtitle && (jsx("label", { className: "rls-toolbar__subtitle smalltext-semibold", children: subtitle }))] }), actions && (jsx("div", { className: "rls-toolbar__actions", children: actions.map((action, index) => (jsx("div", { children: action }, index))) }))] }));
964
966
  }
965
967
 
966
968
  const COUNT_YEAR_RANGE = 4;
@@ -1535,8 +1537,8 @@ function RlsDatatableCell({ children, className, control, overflow }) {
1535
1537
  return (jsx("th", { className: (renderClassStatus('rls-datatable__cell', { control, overflow }) +
1536
1538
  ` ${className || ''}`).trim(), children: children }));
1537
1539
  }
1538
- function RlsDatatable({ children, footer, header, rlsTheme }) {
1539
- return (jsxs("div", { className: "rls-datatable", "rls-theme": rlsTheme, children: [jsxs("table", { children: [header && jsx("thead", { className: "rls-datatable__thead", children: header }), jsx("tbody", { className: "rls-datatable__tbody", children: children })] }), footer && jsx("div", { className: "rls-datatable__tfooter", children: footer })] }));
1540
+ function RlsDatatable({ bodyRef, children, footer, header, rlsTheme }) {
1541
+ return (jsxs("div", { className: "rls-datatable", "rls-theme": rlsTheme, children: [jsxs("table", { children: [header && jsx("thead", { className: "rls-datatable__thead", children: header }), jsx("tbody", { ref: bodyRef, className: "rls-datatable__tbody", children: children })] }), footer && jsx("div", { className: "rls-datatable__tfooter", children: footer })] }));
1540
1542
  }
1541
1543
 
1542
1544
  const controlIsValid = (props) => {
@@ -1550,21 +1552,8 @@ const controlIsValid = (props) => {
1550
1552
  }, []);
1551
1553
  };
1552
1554
 
1553
- function instanceOfReactControlProps(props) {
1554
- return (typeof props === 'object' && ('state' in props || 'validators' in props));
1555
- }
1556
- function createReactControlProps(...argsProps) {
1557
- if (argsProps.length < 1) {
1558
- return { state: undefined, validators: undefined };
1559
- }
1560
- const [state, validators] = argsProps;
1561
- if (argsProps.length < 2 && instanceOfReactControlProps(state)) {
1562
- return state;
1563
- }
1564
- return { state: state, validators };
1565
- }
1566
- function useReactControl(controlProps, controlValidators) {
1567
- const props = createReactControlProps(controlProps, controlValidators);
1555
+ function useControl(controlProps, controlValidators) {
1556
+ const props = createFormControlProps(controlProps, controlValidators);
1568
1557
  const [state, setCurrentState] = useState(props.state);
1569
1558
  const [value, setValue] = useState(props.state);
1570
1559
  const [touched, setTouched] = useState(props.touched || false);
@@ -1643,6 +1632,9 @@ function useReactControl(controlProps, controlValidators) {
1643
1632
  value,
1644
1633
  wrong: touched && !valid
1645
1634
  };
1635
+ }
1636
+ function useReactControl(controlProps, controlValidators) {
1637
+ return useControl(controlProps, controlValidators);
1646
1638
  }
1647
1639
 
1648
1640
  var PickerListenerType;
@@ -2094,5 +2086,5 @@ function RlsApplication({ children }) {
2094
2086
  return (jsxs(RlsContext.Provider, { value: { confirmation, snackbar }, children: [jsx("div", { className: "rls-app__body", children: children }), RlsSnackbar, RlsConfirmation] }));
2095
2087
  }
2096
2088
 
2097
- export { ConfirmationResult, ListCollection, RlsAmount, RlsApplication, RlsAutocompleteField, RlsAutocompleteFieldTemplate, RlsAvatar, RlsBallot, RlsBreadcrumb, RlsButton, RlsButtonAction, RlsButtonToggle, RlsCard, RlsCheckBox, RlsCheckBoxControl, RlsCheckBoxLabel, RlsConfirmation, RlsContext, RlsDatatable, RlsDatatableCell, RlsDatatableData, RlsDatatableHeader, RlsDatatableTitle, RlsDateField, RlsDatePicker, RlsDateRangeField, RlsDateRangePicker, RlsDayPicker, RlsDayRangePicker, RlsFormNavigation, RlsIcon, RlsInput, RlsInputMoney, RlsInputNumber, RlsInputPassword, RlsInputText, RlsLabel, RlsMessageIcon, RlsModal, RlsMoneyField, RlsMonthPicker, RlsMonthTitlePicker, RlsNumberField, RlsPagination, RlsPasswordField, RlsPoster, RlsProgressBar, RlsRadioButton, RlsRadioButtonLabel, RlsSearchInput, RlsSelectField, RlsSelectFieldTemplate, RlsSkeleton, RlsSkeletonText, RlsSnackbar, RlsSwitch, RlsSwitchControl, RlsSwitchLabel, RlsTabularText, RlsTextField, RlsToolbar, RlsYearPicker, renderClassStatus, useConfirmationService, useListControl, useSnackbarService };
2089
+ export { ConfirmationResult, ListCollection, RlsAmount, RlsApplication, RlsAutocompleteField, RlsAutocompleteFieldTemplate, RlsAvatar, RlsBadge, RlsBallot, RlsBreadcrumb, RlsButton, RlsButtonAction, RlsButtonToggle, RlsCard, RlsCheckBox, RlsCheckBoxControl, RlsCheckBoxLabel, RlsConfirmation, RlsContext, RlsDatatable, RlsDatatableCell, RlsDatatableData, RlsDatatableHeader, RlsDatatableTitle, RlsDateField, RlsDatePicker, RlsDateRangeField, RlsDateRangePicker, RlsDayPicker, RlsDayRangePicker, RlsFormNavigation, RlsIcon, RlsInput, RlsInputMoney, RlsInputNumber, RlsInputPassword, RlsInputText, RlsLabel, RlsMessageIcon, RlsModal, RlsMoneyField, RlsMonthPicker, RlsMonthTitlePicker, RlsNumberField, RlsPagination, RlsPasswordField, RlsPoster, RlsProgressBar, RlsRadioButton, RlsRadioButtonLabel, RlsSearchInput, RlsSelectField, RlsSelectFieldTemplate, RlsSkeleton, RlsSkeletonText, RlsSnackbar, RlsSwitch, RlsSwitchControl, RlsSwitchLabel, RlsTabularText, RlsTextField, RlsToolbar, RlsYearPicker, renderClassStatus, useConfirmationService, useListControl, useSnackbarService };
2098
2090
  //# sourceMappingURL=index.js.map