@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/cjs/index.js CHANGED
@@ -2280,27 +2280,26 @@ function RlsConfirmation({ approved, content, reject, rlsTheme, subtitle, title,
2280
2280
  const className = require$$0.useMemo(() => {
2281
2281
  return renderClassStatus('rls-confirmation', { visible });
2282
2282
  }, [visible]);
2283
- 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" })] }));
2283
+ 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" })] }));
2284
2284
  }
2285
2285
  function useConfirmation() {
2286
2286
  const [config, setConfig] = require$$0.useState({});
2287
2287
  const [visible, setVisible] = require$$0.useState(false);
2288
- const rlsConfirmation = ReactDOM.createPortal(jsxRuntimeExports.jsx(RlsConfirmation, { ...config, visible: visible }), document.body);
2288
+ const component = ReactDOM.createPortal(jsxRuntimeExports.jsx(RlsConfirmation, { ...config, visible: visible }), document.body);
2289
2289
  const confirmation = require$$0.useCallback((options) => {
2290
2290
  return new Promise((resolve) => {
2291
- const { content, rlsTheme, subtitle, title, approved, reject } = options;
2291
+ const { approved, reject } = options;
2292
2292
  setConfig({
2293
- content,
2294
- rlsTheme,
2295
- subtitle,
2296
- title,
2293
+ ...options,
2297
2294
  approved: {
2298
2295
  label: approved?.label ?? reactI18n('confirmationActionApproved'),
2299
2296
  onClick: () => {
2300
2297
  setVisible(false);
2301
2298
  resolve(ConfirmationResult.approved());
2302
2299
  },
2303
- identifier: approved?.identifier
2300
+ identifier: approved?.identifier,
2301
+ rlsTheme: approved?.rlsTheme,
2302
+ type: approved?.type ?? 'raised'
2304
2303
  },
2305
2304
  reject: reject
2306
2305
  ? {
@@ -2309,7 +2308,9 @@ function useConfirmation() {
2309
2308
  setVisible(false);
2310
2309
  resolve(ConfirmationResult.reject());
2311
2310
  },
2312
- identifier: reject.identifier
2311
+ identifier: reject.identifier,
2312
+ rlsTheme: reject.rlsTheme,
2313
+ type: reject?.type ?? 'classic'
2313
2314
  }
2314
2315
  : undefined
2315
2316
  });
@@ -2317,7 +2318,7 @@ function useConfirmation() {
2317
2318
  });
2318
2319
  }, []);
2319
2320
  return {
2320
- RlsConfirmation: rlsConfirmation,
2321
+ RlsConfirmation: component,
2321
2322
  confirmation
2322
2323
  };
2323
2324
  }
@@ -2400,7 +2401,7 @@ function useDatatable() {
2400
2401
  }
2401
2402
 
2402
2403
  function useListController(props) {
2403
- const { suggestions, automatic, formControl, reference } = props;
2404
+ const { limit, suggestions, automatic, formControl, reference } = props;
2404
2405
  const listIsOpen = require$$0.useRef(false);
2405
2406
  const contentRef = require$$0.useRef(null);
2406
2407
  const listRef = require$$0.useRef(null);
@@ -2463,15 +2464,15 @@ function useListController(props) {
2463
2464
  changeValueInternal.current = false;
2464
2465
  }, [collection, formControl?.value]);
2465
2466
  const setState = require$$0.useCallback((state) => {
2466
- const length = suggestions.length > 6 ? 6 : suggestions.length;
2467
+ const minHeightList = limit > 0 ? (limit < 6 ? limit * 48 : 300) : 160;
2467
2468
  const _state = state.modalIsVisible
2468
2469
  ? {
2469
2470
  ...state,
2470
- higher: components.locationListCanTop(contentRef.current, listRef.current, length * 48)
2471
+ higher: components.locationListCanTop(contentRef.current, listRef.current, minHeightList)
2471
2472
  }
2472
2473
  : state;
2473
2474
  refreshState((state) => ({ ...state, ..._state }));
2474
- }, []);
2475
+ }, [limit]);
2475
2476
  const setFormValue = require$$0.useCallback((element, initialValue = false) => {
2476
2477
  refreshState((state) => ({
2477
2478
  ...state,
@@ -2516,10 +2517,14 @@ function useListController(props) {
2516
2517
  const DURATION_ANIMATION$1 = 240;
2517
2518
  const MAX_ELEMENTS = 6;
2518
2519
  function useFieldAutocomplete(props) {
2519
- const controller = useListController(props);
2520
+ const limit = require$$0.useRef(props.suggestions.length);
2521
+ const controller = useListController({
2522
+ ...props,
2523
+ limit: limit.current
2524
+ });
2520
2525
  const [coincidences, setCoincidences] = require$$0.useState([]);
2521
2526
  const [pattern, setPattern] = require$$0.useState('');
2522
- const currentStore = require$$0.useRef({
2527
+ const _store = require$$0.useRef({
2523
2528
  coincidences: [],
2524
2529
  pattern: '',
2525
2530
  previous: null
@@ -2529,10 +2534,12 @@ function useFieldAutocomplete(props) {
2529
2534
  pattern,
2530
2535
  suggestions,
2531
2536
  reboot,
2532
- store: currentStore.current
2537
+ store: _store.current
2533
2538
  });
2534
- currentStore.current = store;
2535
- setCoincidences(collection.slice(0, MAX_ELEMENTS));
2539
+ _store.current = store;
2540
+ const coincidences = collection.slice(0, MAX_ELEMENTS);
2541
+ setCoincidences(coincidences);
2542
+ limit.current = coincidences.length;
2536
2543
  }, []);
2537
2544
  require$$0.useEffect(() => {
2538
2545
  refreshCoincidences(props.suggestions, pattern, true);
@@ -2920,7 +2927,14 @@ function RlsFieldDateRange({ children, date: _date, disabled, formControl, ident
2920
2927
  }
2921
2928
 
2922
2929
  function useFieldSelect(props) {
2923
- const controller = useListController(props);
2930
+ const limit = require$$0.useRef(props.suggestions.length);
2931
+ const controller = useListController({
2932
+ ...props,
2933
+ limit: limit.current
2934
+ });
2935
+ require$$0.useEffect(() => {
2936
+ limit.current = props.suggestions.length;
2937
+ }, [props.suggestions]);
2924
2938
  const onFocusInput = require$$0.useCallback(() => {
2925
2939
  controller.setState({ focused: true });
2926
2940
  }, [controller.setState]);
@@ -3118,16 +3132,26 @@ const RlsContext = require$$0.createContext({
3118
3132
  return Promise.resolve(ConfirmationResult.approved());
3119
3133
  },
3120
3134
  snackbar: () => { },
3121
- withNavbar: () => { }
3135
+ setNavbarInApp: () => { },
3136
+ setNavbarIsCondense: () => { }
3122
3137
  });
3123
3138
  function RlsApplication({ children }) {
3124
3139
  const { RlsConfirmation, confirmation } = useConfirmation();
3125
3140
  const { RlsSnackbar, snackbar } = useSnackbar();
3126
- const [_withNavbar, withNavbar] = require$$0.useState(false);
3141
+ const [hasNavbar, setNavbarInApp] = require$$0.useState(false);
3142
+ const [isNavbarCondense, setNavbarIsCondense] = require$$0.useState(false);
3127
3143
  const className = require$$0.useMemo(() => {
3128
- return renderClassStatus('rls-app__body', { snackbar: _withNavbar });
3129
- }, [_withNavbar]);
3130
- return (jsxRuntimeExports.jsxs(RlsContext.Provider, { value: { confirmation, snackbar, withNavbar }, children: [jsxRuntimeExports.jsxs("div", { className: className, children: [children, RlsSnackbar] }), RlsConfirmation] }));
3144
+ return renderClassStatus('rls-app__body', {
3145
+ snackbar: hasNavbar,
3146
+ 'navbar-condense': isNavbarCondense
3147
+ });
3148
+ }, [hasNavbar]);
3149
+ return (jsxRuntimeExports.jsxs(RlsContext.Provider, { value: {
3150
+ confirmation,
3151
+ snackbar,
3152
+ setNavbarInApp,
3153
+ setNavbarIsCondense
3154
+ }, children: [jsxRuntimeExports.jsxs("div", { className: className, children: [children, RlsSnackbar] }), RlsConfirmation] }));
3131
3155
  }
3132
3156
 
3133
3157
  exports.ConfirmationResult = ConfirmationResult;