@rolster/react-components 18.21.19 → 18.21.21

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.
@@ -162,6 +162,9 @@
162
162
  --pvt-button-content-animation: none;
163
163
  --pvt-button-content-visibility: hidden;
164
164
  --pvt-button-ripple-background: var(--rls-theme-color-700);
165
+ --pvt-classic-background: var(--rls-app-color-200);
166
+ --pvt-classic-font-color: var(--rls-app-color-500);
167
+ --pvt-classic-border: none;
165
168
  --pvt-raised-background: var(--rls-theme-color-500);
166
169
  --pvt-raised-font-color: var(--rls-theme-font-500);
167
170
  --pvt-raised-border: none;
@@ -194,11 +197,14 @@
194
197
  --pvt-button-content-visibility: visible;
195
198
  }
196
199
  .rls-button:not(:disabled):hover {
200
+ --pvt-classic-background: var(--rls-theme-color-200);
201
+ --pvt-classic-font-color: var(--rls-theme-color-600);
202
+ --pvt-classic-border: none;
197
203
  --pvt-raised-background: var(--rls-theme-color-700);
198
204
  --pvt-raised-font-color: var(--rls-theme-font-900);
199
205
  --pvt-raised-border: none;
200
206
  --pvt-flat-background: var(--rls-theme-color-600);
201
- --pvt-flat-font-color: var(--rls-theme-font-500);
207
+ --pvt-flat-font-color: var(--rls-theme-color-050);
202
208
  --pvt-flat-border: none;
203
209
  --pvt-stroked-background: var(--rls-theme-color-100);
204
210
  --pvt-stroked-font-color: var(--rls-theme-color-700);
@@ -214,6 +220,9 @@
214
220
  --pvt-gradient-border: none;
215
221
  }
216
222
  .rls-button:disabled {
223
+ --pvt-classic-background: var(--rls-app-color-100);
224
+ --pvt-classic-font-color: var(--rls-app-color-400);
225
+ --pvt-classic-border: none;
217
226
  --pvt-raised-background: var(--rls-theme-color-200);
218
227
  --pvt-raised-font-color: var(--rls-theme-color-400);
219
228
  --pvt-raised-border: none;
@@ -266,6 +275,12 @@
266
275
  animation: var(--pvt-button-content-animation);
267
276
  visibility: var(--pvt-button-content-visibility);
268
277
  }
278
+ .rls-button__content--classic {
279
+ --pvt-button-content-background: var(--pvt-classic-background);
280
+ --pvt-button-content-font-color: var(--pvt-classic-font-color);
281
+ --pvt-button-content-border: var(--pvt-classic-border);
282
+ --pvt-button-ripple-background: var(--rls-theme-font-900);
283
+ }
269
284
  .rls-button__content--raised {
270
285
  --pvt-button-content-background: var(--pvt-raised-background);
271
286
  --pvt-button-content-font-color: var(--pvt-raised-font-color);
@@ -2283,9 +2298,7 @@
2283
2298
  padding: var(--rls-sizing-x6);
2284
2299
  box-sizing: border-box;
2285
2300
  border-radius: var(--rls-sizing-x4);
2286
- background: var(--rls-app-color-050);
2287
- box-shadow: var(--rls-light-shadow-bottom-4);
2288
- border: var(--rls-theme-border-1-300);
2301
+ background: var(--rls-theme-color-100);
2289
2302
  transform: translate(-50%, 100%);
2290
2303
  transition: transform 160ms 0ms var(--rls-standard-curve);
2291
2304
  }
@@ -2293,7 +2306,7 @@
2293
2306
  transform: translate(-50%, calc(0% - var(--rls-sizing-x8)));
2294
2307
  }
2295
2308
  .rls-snackbar__avatar {
2296
- --rlc-icon-color: var(--rls-app-color-050);
2309
+ --rlc-icon-color: var(--rls-theme-color-050);
2297
2310
  display: flex;
2298
2311
  justify-content: center;
2299
2312
  align-items: center;
package/dist/es/index.js CHANGED
@@ -2278,27 +2278,26 @@ function RlsConfirmation({ approved, content, reject, rlsTheme, subtitle, title,
2278
2278
  const className = useMemo(() => {
2279
2279
  return renderClassStatus('rls-confirmation', { visible });
2280
2280
  }, [visible]);
2281
- return (jsxRuntimeExports.jsxs("div", { className: className, "rls-theme": rlsTheme, children: [jsxRuntimeExports.jsxs("div", { className: "rls-confirmation__component", children: [jsxRuntimeExports.jsxs("div", { className: "rls-confirmation__header", children: [title && jsxRuntimeExports.jsx("div", { className: "rls-confirmation__title", children: title }), subtitle && (jsxRuntimeExports.jsx("div", { className: "rls-confirmation__subtitle", children: subtitle }))] }), jsxRuntimeExports.jsx("div", { className: "rls-confirmation__body", children: content && (jsxRuntimeExports.jsx("div", { className: "rls-confirmation__message", children: content })) }), (approved || reject) && (jsxRuntimeExports.jsx("div", { className: "rls-confirmation__footer", children: jsxRuntimeExports.jsxs("div", { className: "rls-confirmation__actions", children: [approved && (jsxRuntimeExports.jsx(RlsButton, { identifier: approved.identifier, type: "raised", onClick: approved.onClick, children: approved.label })), reject && (jsxRuntimeExports.jsx(RlsButton, { identifier: reject.identifier, type: "outline", onClick: reject.onClick, children: reject.label }))] }) }))] }), jsxRuntimeExports.jsx("div", { className: "rls-confirmation__backdrop" })] }));
2281
+ return (jsxRuntimeExports.jsxs("div", { className: className, "rls-theme": rlsTheme, children: [jsxRuntimeExports.jsxs("div", { className: "rls-confirmation__component", children: [jsxRuntimeExports.jsxs("div", { className: "rls-confirmation__header", children: [title && jsxRuntimeExports.jsx("div", { className: "rls-confirmation__title", children: title }), subtitle && (jsxRuntimeExports.jsx("div", { className: "rls-confirmation__subtitle", children: subtitle }))] }), jsxRuntimeExports.jsx("div", { className: "rls-confirmation__body", children: content && (jsxRuntimeExports.jsx("div", { className: "rls-confirmation__message", children: content })) }), (approved || reject) && (jsxRuntimeExports.jsx("div", { className: "rls-confirmation__footer", children: jsxRuntimeExports.jsxs("div", { className: "rls-confirmation__actions", children: [approved && (jsxRuntimeExports.jsx(RlsButton, { identifier: approved.identifier, type: approved.type, onClick: approved.onClick, rlsTheme: approved.rlsTheme, children: approved.label })), reject && (jsxRuntimeExports.jsx(RlsButton, { identifier: reject.identifier, type: reject.type, onClick: reject.onClick, rlsTheme: reject.rlsTheme, children: reject.label }))] }) }))] }), jsxRuntimeExports.jsx("div", { className: "rls-confirmation__backdrop" })] }));
2282
2282
  }
2283
2283
  function useConfirmation() {
2284
2284
  const [config, setConfig] = useState({});
2285
2285
  const [visible, setVisible] = useState(false);
2286
- const rlsConfirmation = ReactDOM.createPortal(jsxRuntimeExports.jsx(RlsConfirmation, { ...config, visible: visible }), document.body);
2286
+ const component = ReactDOM.createPortal(jsxRuntimeExports.jsx(RlsConfirmation, { ...config, visible: visible }), document.body);
2287
2287
  const confirmation = useCallback((options) => {
2288
2288
  return new Promise((resolve) => {
2289
- const { content, rlsTheme, subtitle, title, approved, reject } = options;
2289
+ const { approved, reject } = options;
2290
2290
  setConfig({
2291
- content,
2292
- rlsTheme,
2293
- subtitle,
2294
- title,
2291
+ ...options,
2295
2292
  approved: {
2296
2293
  label: approved?.label ?? reactI18n('confirmationActionApproved'),
2297
2294
  onClick: () => {
2298
2295
  setVisible(false);
2299
2296
  resolve(ConfirmationResult.approved());
2300
2297
  },
2301
- identifier: approved?.identifier
2298
+ identifier: approved?.identifier,
2299
+ rlsTheme: approved?.rlsTheme,
2300
+ type: approved?.type ?? 'raised'
2302
2301
  },
2303
2302
  reject: reject
2304
2303
  ? {
@@ -2307,7 +2306,9 @@ function useConfirmation() {
2307
2306
  setVisible(false);
2308
2307
  resolve(ConfirmationResult.reject());
2309
2308
  },
2310
- identifier: reject.identifier
2309
+ identifier: reject.identifier,
2310
+ rlsTheme: reject.rlsTheme,
2311
+ type: reject?.type ?? 'classic'
2311
2312
  }
2312
2313
  : undefined
2313
2314
  });
@@ -2315,7 +2316,7 @@ function useConfirmation() {
2315
2316
  });
2316
2317
  }, []);
2317
2318
  return {
2318
- RlsConfirmation: rlsConfirmation,
2319
+ RlsConfirmation: component,
2319
2320
  confirmation
2320
2321
  };
2321
2322
  }
@@ -2398,7 +2399,7 @@ function useDatatable() {
2398
2399
  }
2399
2400
 
2400
2401
  function useListController(props) {
2401
- const { suggestions, automatic, formControl, reference } = props;
2402
+ const { limit, suggestions, automatic, formControl, reference } = props;
2402
2403
  const listIsOpen = useRef(false);
2403
2404
  const contentRef = useRef(null);
2404
2405
  const listRef = useRef(null);
@@ -2461,15 +2462,15 @@ function useListController(props) {
2461
2462
  changeValueInternal.current = false;
2462
2463
  }, [collection, formControl?.value]);
2463
2464
  const setState = useCallback((state) => {
2464
- const length = suggestions.length > 6 ? 6 : suggestions.length;
2465
+ const minHeightList = limit > 0 ? (limit < 6 ? limit * 48 : 300) : 160;
2465
2466
  const _state = state.modalIsVisible
2466
2467
  ? {
2467
2468
  ...state,
2468
- higher: locationListCanTop(contentRef.current, listRef.current, length * 48)
2469
+ higher: locationListCanTop(contentRef.current, listRef.current, minHeightList)
2469
2470
  }
2470
2471
  : state;
2471
2472
  refreshState((state) => ({ ...state, ..._state }));
2472
- }, []);
2473
+ }, [limit]);
2473
2474
  const setFormValue = useCallback((element, initialValue = false) => {
2474
2475
  refreshState((state) => ({
2475
2476
  ...state,
@@ -2514,10 +2515,14 @@ function useListController(props) {
2514
2515
  const DURATION_ANIMATION$1 = 240;
2515
2516
  const MAX_ELEMENTS = 6;
2516
2517
  function useFieldAutocomplete(props) {
2517
- const controller = useListController(props);
2518
+ const limit = useRef(props.suggestions.length);
2519
+ const controller = useListController({
2520
+ ...props,
2521
+ limit: limit.current
2522
+ });
2518
2523
  const [coincidences, setCoincidences] = useState([]);
2519
2524
  const [pattern, setPattern] = useState('');
2520
- const currentStore = useRef({
2525
+ const _store = useRef({
2521
2526
  coincidences: [],
2522
2527
  pattern: '',
2523
2528
  previous: null
@@ -2527,10 +2532,12 @@ function useFieldAutocomplete(props) {
2527
2532
  pattern,
2528
2533
  suggestions,
2529
2534
  reboot,
2530
- store: currentStore.current
2535
+ store: _store.current
2531
2536
  });
2532
- currentStore.current = store;
2533
- setCoincidences(collection.slice(0, MAX_ELEMENTS));
2537
+ _store.current = store;
2538
+ const coincidences = collection.slice(0, MAX_ELEMENTS);
2539
+ setCoincidences(coincidences);
2540
+ limit.current = coincidences.length;
2534
2541
  }, []);
2535
2542
  useEffect(() => {
2536
2543
  refreshCoincidences(props.suggestions, pattern, true);
@@ -2918,7 +2925,14 @@ function RlsFieldDateRange({ children, date: _date, disabled, formControl, ident
2918
2925
  }
2919
2926
 
2920
2927
  function useFieldSelect(props) {
2921
- const controller = useListController(props);
2928
+ const limit = useRef(props.suggestions.length);
2929
+ const controller = useListController({
2930
+ ...props,
2931
+ limit: limit.current
2932
+ });
2933
+ useEffect(() => {
2934
+ limit.current = props.suggestions.length;
2935
+ }, [props.suggestions]);
2922
2936
  const onFocusInput = useCallback(() => {
2923
2937
  controller.setState({ focused: true });
2924
2938
  }, [controller.setState]);
@@ -3116,16 +3130,26 @@ const RlsContext = createContext({
3116
3130
  return Promise.resolve(ConfirmationResult.approved());
3117
3131
  },
3118
3132
  snackbar: () => { },
3119
- withNavbar: () => { }
3133
+ setNavbarInApp: () => { },
3134
+ setNavbarIsCondense: () => { }
3120
3135
  });
3121
3136
  function RlsApplication({ children }) {
3122
3137
  const { RlsConfirmation, confirmation } = useConfirmation();
3123
3138
  const { RlsSnackbar, snackbar } = useSnackbar();
3124
- const [_withNavbar, withNavbar] = useState(false);
3139
+ const [hasNavbar, setNavbarInApp] = useState(false);
3140
+ const [isNavbarCondense, setNavbarIsCondense] = useState(false);
3125
3141
  const className = useMemo(() => {
3126
- return renderClassStatus('rls-app__body', { snackbar: _withNavbar });
3127
- }, [_withNavbar]);
3128
- return (jsxRuntimeExports.jsxs(RlsContext.Provider, { value: { confirmation, snackbar, withNavbar }, children: [jsxRuntimeExports.jsxs("div", { className: className, children: [children, RlsSnackbar] }), RlsConfirmation] }));
3142
+ return renderClassStatus('rls-app__body', {
3143
+ snackbar: hasNavbar,
3144
+ 'navbar-condense': isNavbarCondense
3145
+ });
3146
+ }, [hasNavbar]);
3147
+ return (jsxRuntimeExports.jsxs(RlsContext.Provider, { value: {
3148
+ confirmation,
3149
+ snackbar,
3150
+ setNavbarInApp,
3151
+ setNavbarIsCondense
3152
+ }, children: [jsxRuntimeExports.jsxs("div", { className: className, children: [children, RlsSnackbar] }), RlsConfirmation] }));
3129
3153
  }
3130
3154
 
3131
3155
  export { ConfirmationResult, RlsAlert, RlsAmount, RlsApplication, RlsAvatar, RlsBadge, RlsBallot, RlsBreadcrumb, RlsButton, RlsButtonAction, RlsButtonProgress, RlsButtonToggle, RlsCard, RlsCheckBox, RlsCheckBoxControl, RlsConfirmation, RlsContext, RlsDatatable, RlsDatatableCell, RlsDatatableData, RlsDatatableFloating, RlsDatatableHeader, RlsDatatableRecord, RlsDatatableSubheader, RlsDatatableTitle, RlsDatatableTotals, RlsFieldAutocomplete, RlsFieldAutocompleteTemplate, RlsFieldDate, RlsFieldDateRange, RlsFieldMoney, RlsFieldNumber, RlsFieldPassword, RlsFieldReadonly, RlsFieldSelect, RlsFieldSelectTemplate, RlsFieldText, RlsFormNavigation, RlsIcon, RlsInput, RlsInputMoney, RlsInputNumber, RlsInputPassword, RlsInputSearch, RlsInputText, RlsLabel, RlsLabelCheckBox, RlsLabelRadioButton, RlsLabelSwitch, RlsMessageFormError, RlsMessageIcon, RlsModal, RlsPagination, RlsPickerDate, RlsPickerDateRange, RlsPickerDay, RlsPickerDayRange, RlsPickerMonth, RlsPickerSelectorTitle, RlsPickerYear, RlsPoster, RlsProgressBar, RlsProgressCircular, RlsRadioButton, RlsSkeleton, RlsSkeletonText, RlsSnackbar, RlsSwitch, RlsSwitchControl, RlsTabularText, RlsToolbar, rangeFormatTemplate, renderClassStatus, setErrorsI18n, useConfirmation, useDatatable, useListController, useSnackbar };