@rolster/react-components 18.18.1 → 18.18.3

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,10 +51,8 @@
51
51
  border-radius: 50%;
52
52
  }
53
53
  .rls-avatar span {
54
+ align-self: center;
54
55
  font-size: inherit;
55
- margin: auto;
56
- height: inherit;
57
- line-height: inherit;
58
56
  }
59
57
 
60
58
  .rls-badge {
@@ -918,6 +916,9 @@
918
916
  flex-direction: column;
919
917
  row-gap: var(--rlc-ballot-component-row-gap);
920
918
  }
919
+ .rls-ballot .rls-avatar + .rls-ballot__component {
920
+ width: calc(100% - var(--rlc-avatar-width) - var(--rls-sizing-x4));
921
+ }
921
922
  .rls-ballot__title {
922
923
  --rlc-skeleton-text-height: var(--rlc-ballot-title-height);
923
924
  --rlc-skeleton-text-letter-spacing: var(--rlc-ballot-title-letter-spacing);
package/dist/es/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import require$$0, { useState, useRef, useEffect, createContext } from 'react';
1
+ import require$$0, { useState, useRef, useEffect, useCallback, createContext } from 'react';
2
2
  import { currencyFormat, itIsDefined, PartialSealed } from '@rolster/commons';
3
3
  import { dateFormatTemplate, DAY_LABELS, DateRange, normalizeMinTime, assignDayInDate, dateIsBefore, MONTH_NAMES, Month, assignYearInDate, assignMonthInDate } from '@rolster/dates';
4
4
  import { PaginationController, verifyDayPicker, createDayPicker, createDayRangePicker, verifyMonthPicker, createMonthPicker, monthLimitTemplate, createYearPicker, verifyYearPicker, ListCollection, locationListCanTop, navigationListFromInput, navigationListFromElement, createAutocompleteStore, verifyDateRange, dateOutRange, PickerListenerEvent } from '@rolster/components';
@@ -2044,11 +2044,11 @@ function RlsDatatableHeader({ children, identifier }) {
2044
2044
  function RlsDatatableTitle({ children, className, control, identifier }) {
2045
2045
  return (jsxRuntimeExports.jsx("th", { id: identifier, className: renderClassStatus('rls-datatable__title', { control }, className).trim(), children: children }));
2046
2046
  }
2047
- function RlsDatatableRecord({ children, className, error, identifier, warning }) {
2048
- return (jsxRuntimeExports.jsx("tr", { id: identifier, className: renderClassStatus('rls-datatable__record', { error, warning }, className).trim(), children: children }));
2047
+ function RlsDatatableRecord({ children, className, error, identifier, info, successs, warning }) {
2048
+ return (jsxRuntimeExports.jsx("tr", { id: identifier, className: renderClassStatus('rls-datatable__record', { error, info, successs, warning }, className).trim(), children: children }));
2049
2049
  }
2050
- function RlsDatatableTotals({ children, className, error, identifier, warning }) {
2051
- return (jsxRuntimeExports.jsx("div", { id: identifier, className: renderClassStatus('rls-datatable__totals', { error, warning }, className).trim(), children: children }));
2050
+ function RlsDatatableTotals({ children, className, error, identifier, info, successs, warning }) {
2051
+ return (jsxRuntimeExports.jsx("div", { id: identifier, className: renderClassStatus('rls-datatable__totals', { error, info, successs, warning }, className).trim(), children: children }));
2052
2052
  }
2053
2053
  function RlsDatatableCell({ children, className, control, identifier, overflow }) {
2054
2054
  return (jsxRuntimeExports.jsx("th", { id: identifier, className: renderClassStatus('rls-datatable__cell', { control, overflow }, className).trim(), children: children }));
@@ -2127,7 +2127,7 @@ function useListController(props) {
2127
2127
  refresh(collection.current, formControl?.value, automatic);
2128
2128
  }, [suggestions]);
2129
2129
  useEffect(() => {
2130
- refresh(collection.current, formControl?.value, automatic);
2130
+ refresh(collection.current, formControl?.value);
2131
2131
  }, [formControl?.value]);
2132
2132
  function refresh(collection, state, automatic) {
2133
2133
  if (!state) {
@@ -2148,7 +2148,7 @@ function useListController(props) {
2148
2148
  }
2149
2149
  function refreshWithProtected(collection, automatic) {
2150
2150
  if (automatic && collection.value[0]) {
2151
- setFormValue(collection.value[0].value);
2151
+ formControl?.setInitialValue(collection.value[0].value);
2152
2152
  return true;
2153
2153
  }
2154
2154
  if (_protected.current) {
@@ -2164,9 +2164,9 @@ function useListController(props) {
2164
2164
  function refreshState(state) {
2165
2165
  setState((currentState) => ({ ...currentState, ...state }));
2166
2166
  }
2167
- function setFormValue(value) {
2167
+ const setFormValue = useCallback((value) => {
2168
2168
  formControl?.setValue(value);
2169
- }
2169
+ }, [formControl]);
2170
2170
  function navigationInput(event) {
2171
2171
  if (state.modalIsVisible) {
2172
2172
  const newPosition = navigationListFromInput({
@@ -2540,9 +2540,17 @@ function useFieldSelect(props) {
2540
2540
  }
2541
2541
  }
2542
2542
  function onClickAction() {
2543
- const modalIsVisible = !controller.modalIsVisible;
2544
- controller.setState({ modalIsVisible });
2545
- modalIsVisible && controller.inputRef?.current?.focus();
2543
+ const removable = !props.unremovable && !!controller.value;
2544
+ if (removable) {
2545
+ controller.setState({ modalIsVisible: false, value: '' });
2546
+ controller.setFormValue(props.value);
2547
+ props.onValue && props.onValue(props.value);
2548
+ }
2549
+ else {
2550
+ const modalIsVisible = !controller.modalIsVisible;
2551
+ controller.setState({ modalIsVisible });
2552
+ modalIsVisible && controller.inputRef?.current?.focus();
2553
+ }
2546
2554
  }
2547
2555
  function onClickBackdrop() {
2548
2556
  controller.setState({ modalIsVisible: false });
@@ -2588,16 +2596,14 @@ function useFieldSelect(props) {
2588
2596
  function RlsFieldSelectTemplate(props) {
2589
2597
  const select = useFieldSelect(props);
2590
2598
  const { controller } = select;
2591
- const { render, suggestions, children, formControl, msgErrorDisabled, placeholder, rlsTheme } = props;
2599
+ const { render, suggestions, children, formControl, msgErrorDisabled, placeholder, rlsTheme, unremovable } = props;
2592
2600
  const _disabled = formControl?.disabled || props.disabled;
2593
2601
  const className = renderClassStatus('rls-field-box', {
2594
2602
  focused: controller.focused && !_disabled,
2595
2603
  error: formControl?.wrong,
2596
2604
  disabled: _disabled
2597
2605
  }, 'rls-field-list rls-field-select');
2598
- return (jsxRuntimeExports.jsxs("div", { id: props.identifier, ref: controller.contentRef, className: className, "rls-theme": rlsTheme, children: [children && jsxRuntimeExports.jsx("label", { className: "rls-field-box__label", children: children }), jsxRuntimeExports.jsx("div", { className: "rls-field-box__component", children: jsxRuntimeExports.jsxs("div", { className: "rls-field-box__body", children: [jsxRuntimeExports.jsx("input", { ref: controller.inputRef, className: "rls-field-list__control", readOnly: true, disabled: _disabled, placeholder: placeholder, value: controller.value, onFocus: select.onFocusInput, onBlur: select.onBlurInput, onClick: select.onClickInput, onKeyDown: select.onKeydownInput }), jsxRuntimeExports.jsx("button", { className: renderClassStatus('rls-field-list__action', {
2599
- visible: controller.modalIsVisible
2600
- }), disabled: _disabled, onClick: select.onClickAction, children: jsxRuntimeExports.jsx(RlsIcon, { value: "arrow-ios-down" }) })] }) }), !msgErrorDisabled && (jsxRuntimeExports.jsx(RlsMessageFormError, { className: "rls-field-box__error", formControl: formControl })), jsxRuntimeExports.jsxs("div", { className: renderClassStatus('rls-field-list__suggestions', {
2606
+ return (jsxRuntimeExports.jsxs("div", { id: props.identifier, ref: controller.contentRef, className: className, "rls-theme": rlsTheme, children: [children && jsxRuntimeExports.jsx("label", { className: "rls-field-box__label", children: children }), jsxRuntimeExports.jsx("div", { className: "rls-field-box__component", children: jsxRuntimeExports.jsxs("div", { className: "rls-field-box__body", children: [jsxRuntimeExports.jsx("input", { ref: controller.inputRef, className: "rls-field-list__control", readOnly: true, disabled: _disabled, placeholder: placeholder, value: controller.value, onFocus: select.onFocusInput, onBlur: select.onBlurInput, onClick: select.onClickInput, onKeyDown: select.onKeydownInput }), jsxRuntimeExports.jsx("button", { className: renderClassStatus('rls-field-list__action'), disabled: _disabled, onClick: select.onClickAction, children: jsxRuntimeExports.jsx(RlsIcon, { value: !unremovable && !!controller.value ? 'close' : 'arrow-ios-down' }) })] }) }), !msgErrorDisabled && (jsxRuntimeExports.jsx(RlsMessageFormError, { className: "rls-field-box__error", formControl: formControl })), jsxRuntimeExports.jsxs("div", { className: renderClassStatus('rls-field-list__suggestions', {
2601
2607
  visible: controller.modalIsVisible,
2602
2608
  higher: controller.higher,
2603
2609
  hide: !controller.modalIsVisible