@rolster/react-components 19.9.0 → 19.10.0

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.
@@ -0,0 +1,13 @@
1
+ import { RlsAppTheme } from '../../../types';
2
+ import { PropsWithRlsTheme } from '../../definitions';
3
+ export type AppThemeLabels = Partial<Record<RlsAppTheme, string>>;
4
+ interface AppThemeTabsProps extends PropsWithRlsTheme {
5
+ labels?: AppThemeLabels;
6
+ onValue?: (value: RlsAppTheme) => void;
7
+ themes?: RlsAppTheme[];
8
+ value?: RlsAppTheme;
9
+ }
10
+ export declare const APP_THEMES: RlsAppTheme[];
11
+ declare function RlsAppThemeTabsComponent({ labels, onValue, rlsTheme, themes, value }: AppThemeTabsProps): import("react/jsx-runtime").JSX.Element;
12
+ export declare const RlsAppThemeTabs: import("react").MemoExoticComponent<typeof RlsAppThemeTabsComponent>;
13
+ export {};
@@ -0,0 +1,34 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { memo, useCallback, useEffect, useMemo, useState } from 'react';
3
+ import { getAppTheme, setAppTheme } from '../../../helpers/app-theme';
4
+ import { reactI18n } from '../../../i18n';
5
+ import { RlsTabs } from '../Tabs/Tabs';
6
+ export const APP_THEMES = ['light', 'dim', 'dark'];
7
+ const LABELS = {
8
+ light: () => reactI18n('appThemeLight'),
9
+ dim: () => reactI18n('appThemeDim'),
10
+ dark: () => reactI18n('appThemeDark')
11
+ };
12
+ function RlsAppThemeTabsComponent({ labels, onValue, rlsTheme, themes = APP_THEMES, value }) {
13
+ const [appTheme, setAppThemeValue] = useState(() => value ?? getAppTheme());
14
+ useEffect(() => {
15
+ if (value !== undefined) {
16
+ setAppTheme(value);
17
+ setAppThemeValue(value);
18
+ }
19
+ }, [value]);
20
+ const tabs = useMemo(() => {
21
+ return themes.map((theme) => ({
22
+ label: labels?.[theme] ?? LABELS[theme](),
23
+ value: theme
24
+ }));
25
+ }, [labels, themes]);
26
+ const onSelect = useCallback((theme) => {
27
+ setAppTheme(theme);
28
+ setAppThemeValue(theme);
29
+ onValue?.(theme);
30
+ }, [onValue]);
31
+ return (_jsx(RlsTabs, { tabs: tabs, value: appTheme, onValue: onSelect, rlsTheme: rlsTheme }));
32
+ }
33
+ export const RlsAppThemeTabs = memo(RlsAppThemeTabsComponent);
34
+ //# sourceMappingURL=AppThemeTabs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AppThemeTabs.js","sourceRoot":"","sources":["../../../../../src/components/molecules/AppThemeTabs/AppThemeTabs.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACxE,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAG1C,OAAO,EAAE,OAAO,EAAO,MAAM,cAAc,CAAC;AAW5C,MAAM,CAAC,MAAM,UAAU,GAAkB,CAAC,OAAO,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;AAElE,MAAM,MAAM,GAAsC;IAChD,KAAK,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,eAAe,CAAC;IACvC,GAAG,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,aAAa,CAAC;IACnC,IAAI,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,cAAc,CAAC;CACtC,CAAC;AAEF,SAAS,wBAAwB,CAAC,EAChC,MAAM,EACN,OAAO,EACP,QAAQ,EACR,MAAM,GAAG,UAAU,EACnB,KAAK,EACa;IAClB,MAAM,CAAC,QAAQ,EAAE,gBAAgB,CAAC,GAAG,QAAQ,CAC3C,GAAG,EAAE,CAAC,KAAK,IAAI,WAAW,EAAE,CAC7B,CAAC;IAEF,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;YACxB,WAAW,CAAC,KAAK,CAAC,CAAC;YACnB,gBAAgB,CAAC,KAAK,CAAC,CAAC;QAC1B,CAAC;IACH,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;IAEZ,MAAM,IAAI,GAAG,OAAO,CAAqB,GAAG,EAAE;QAC5C,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;YAC5B,KAAK,EAAE,MAAM,EAAE,CAAC,KAAK,CAAC,IAAI,MAAM,CAAC,KAAK,CAAC,EAAE;YACzC,KAAK,EAAE,KAAK;SACb,CAAC,CAAC,CAAC;IACN,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAErB,MAAM,QAAQ,GAAG,WAAW,CAC1B,CAAC,KAAkB,EAAE,EAAE;QACrB,WAAW,CAAC,KAAK,CAAC,CAAC;QACnB,gBAAgB,CAAC,KAAK,CAAC,CAAC;QAExB,OAAO,EAAE,CAAC,KAAK,CAAC,CAAC;IACnB,CAAC,EACD,CAAC,OAAO,CAAC,CACV,CAAC;IAEF,OAAO,CACL,KAAC,OAAO,IACN,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,QAAQ,EACf,OAAO,EAAE,QAAQ,EACjB,QAAQ,EAAE,QAAQ,GAClB,CACH,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,eAAe,GAAG,IAAI,CAAC,wBAAwB,CAAC,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { RlsAppTheme } from '../types';
2
+ export interface AppThemeController {
3
+ setValue: (value: RlsAppTheme) => void;
4
+ toggle: () => void;
5
+ value: RlsAppTheme;
6
+ }
7
+ export declare function useAppThemeController(initialTheme?: RlsAppTheme, primaryTheme?: RlsAppTheme, secondaryTheme?: RlsAppTheme): AppThemeController;
@@ -0,0 +1,20 @@
1
+ import { useCallback, useState } from 'react';
2
+ import { getAppTheme, setAppTheme } from '../helpers/app-theme';
3
+ export function useAppThemeController(initialTheme, primaryTheme = 'light', secondaryTheme = 'dark') {
4
+ const [appTheme, setAppThemeValue] = useState(() => {
5
+ if (initialTheme) {
6
+ setAppTheme(initialTheme);
7
+ return initialTheme;
8
+ }
9
+ return getAppTheme();
10
+ });
11
+ const setValue = useCallback((value) => {
12
+ setAppTheme(value);
13
+ setAppThemeValue(value);
14
+ }, []);
15
+ const toggle = useCallback(() => {
16
+ setValue(appTheme === primaryTheme ? secondaryTheme : primaryTheme);
17
+ }, [appTheme, primaryTheme, secondaryTheme, setValue]);
18
+ return { setValue, toggle, value: appTheme };
19
+ }
20
+ //# sourceMappingURL=AppThemeController.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AppThemeController.js","sourceRoot":"","sources":["../../../src/controllers/AppThemeController.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAShE,MAAM,UAAU,qBAAqB,CACnC,YAA0B,EAC1B,eAA4B,OAAO,EACnC,iBAA8B,MAAM;IAEpC,MAAM,CAAC,QAAQ,EAAE,gBAAgB,CAAC,GAAG,QAAQ,CAAc,GAAG,EAAE;QAC9D,IAAI,YAAY,EAAE,CAAC;YACjB,WAAW,CAAC,YAAY,CAAC,CAAC;YAE1B,OAAO,YAAY,CAAC;QACtB,CAAC;QAED,OAAO,WAAW,EAAE,CAAC;IACvB,CAAC,CAAC,CAAC;IAEH,MAAM,QAAQ,GAAG,WAAW,CAAC,CAAC,KAAkB,EAAE,EAAE;QAClD,WAAW,CAAC,KAAK,CAAC,CAAC;QACnB,gBAAgB,CAAC,KAAK,CAAC,CAAC;IAC1B,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,MAAM,MAAM,GAAG,WAAW,CAAC,GAAG,EAAE;QAC9B,QAAQ,CAAC,QAAQ,KAAK,YAAY,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC;IACtE,CAAC,EAAE,CAAC,QAAQ,EAAE,YAAY,EAAE,cAAc,EAAE,QAAQ,CAAC,CAAC,CAAC;IAEvD,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC;AAC/C,CAAC"}
@@ -3,9 +3,8 @@ export function getAppTheme() {
3
3
  if (typeof document === 'undefined') {
4
4
  return 'light';
5
5
  }
6
- return document.body.getAttribute(APP_THEME_ATTRIBUTE) === 'dark'
7
- ? 'dark'
8
- : 'light';
6
+ const theme = document.body.getAttribute(APP_THEME_ATTRIBUTE);
7
+ return theme === 'dark' || theme === 'dim' ? theme : 'light';
9
8
  }
10
9
  export function setAppTheme(theme) {
11
10
  if (typeof document === 'undefined') {
@@ -1 +1 @@
1
- {"version":3,"file":"app-theme.js","sourceRoot":"","sources":["../../../src/helpers/app-theme.ts"],"names":[],"mappings":"AAEA,MAAM,mBAAmB,GAAG,WAAW,CAAC;AAExC,MAAM,UAAU,WAAW;IACzB,IAAI,OAAO,QAAQ,KAAK,WAAW,EAAE,CAAC;QACpC,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,OAAO,QAAQ,CAAC,IAAI,CAAC,YAAY,CAAC,mBAAmB,CAAC,KAAK,MAAM;QAC/D,CAAC,CAAC,MAAM;QACR,CAAC,CAAC,OAAO,CAAC;AACd,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,KAAkB;IAC5C,IAAI,OAAO,QAAQ,KAAK,WAAW,EAAE,CAAC;QACpC,OAAO;IACT,CAAC;IAED,QAAQ,CAAC,IAAI,CAAC,YAAY,CAAC,mBAAmB,EAAE,KAAK,CAAC,CAAC;AACzD,CAAC;AAED,MAAM,UAAU,cAAc;IAC5B,MAAM,KAAK,GAAgB,WAAW,EAAE,KAAK,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC;IAEvE,WAAW,CAAC,KAAK,CAAC,CAAC;IAEnB,OAAO,KAAK,CAAC;AACf,CAAC"}
1
+ {"version":3,"file":"app-theme.js","sourceRoot":"","sources":["../../../src/helpers/app-theme.ts"],"names":[],"mappings":"AAEA,MAAM,mBAAmB,GAAG,WAAW,CAAC;AAExC,MAAM,UAAU,WAAW;IACzB,IAAI,OAAO,QAAQ,KAAK,WAAW,EAAE,CAAC;QACpC,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,MAAM,KAAK,GAAG,QAAQ,CAAC,IAAI,CAAC,YAAY,CAAC,mBAAmB,CAAC,CAAC;IAE9D,OAAO,KAAK,KAAK,MAAM,IAAI,KAAK,KAAK,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC;AAC/D,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,KAAkB;IAC5C,IAAI,OAAO,QAAQ,KAAK,WAAW,EAAE,CAAC;QACpC,OAAO;IACT,CAAC;IAED,QAAQ,CAAC,IAAI,CAAC,YAAY,CAAC,mBAAmB,EAAE,KAAK,CAAC,CAAC;AACzD,CAAC;AAED,MAAM,UAAU,cAAc;IAC5B,MAAM,KAAK,GAAgB,WAAW,EAAE,KAAK,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC;IAEvE,WAAW,CAAC,KAAK,CAAC,CAAC;IAEnB,OAAO,KAAK,CAAC;AACf,CAAC"}
@@ -1,4 +1,7 @@
1
1
  export declare const reactI18n: import("@rolster/i18n").I18nTranslate<{
2
+ appThemeDark: string;
3
+ appThemeDim: string;
4
+ appThemeLight: string;
2
5
  confirmationActionApproved: string;
3
6
  dateActionCancel: string;
4
7
  dateActionSelect: string;
package/dist/esm/i18n.js CHANGED
@@ -1,6 +1,9 @@
1
1
  import { i18n } from '@rolster/i18n';
2
2
  export const reactI18n = i18n({
3
3
  es: {
4
+ appThemeDark: 'Oscuro',
5
+ appThemeDim: 'Intermedio',
6
+ appThemeLight: 'Claro',
4
7
  confirmationActionApproved: 'Aceptar',
5
8
  dateActionCancel: 'Cancelar',
6
9
  dateActionSelect: 'Establecer',
@@ -13,6 +16,9 @@ export const reactI18n = i18n({
13
16
  listInputPlaceholder: 'Escriba palabre clave para filtrar...'
14
17
  },
15
18
  en: {
19
+ appThemeDark: 'Dark',
20
+ appThemeDim: 'Dim',
21
+ appThemeLight: 'Light',
16
22
  confirmationActionApproved: 'Approved',
17
23
  dateActionCancel: 'Cancel',
18
24
  dateActionSelect: 'Select',
@@ -1 +1 @@
1
- {"version":3,"file":"i18n.js","sourceRoot":"","sources":["../../src/i18n.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAErC,MAAM,CAAC,MAAM,SAAS,GAAG,IAAI,CAAC;IAC5B,EAAE,EAAE;QACF,0BAA0B,EAAE,SAAS;QACrC,gBAAgB,EAAE,UAAU;QAC5B,gBAAgB,EAAE,YAAY;QAC9B,eAAe,EAAE,KAAK;QACtB,wBAAwB,EAAE,UAAU;QACpC,wBAAwB,EAAE,WAAW;QACrC,uBAAuB,EAAE,aAAa;QACtC,oBAAoB,EAClB,2DAA2D;QAC7D,cAAc,EAAE,yBAAyB;QACzC,oBAAoB,EAAE,uCAAuC;KAC9D;IACD,EAAE,EAAE;QACF,0BAA0B,EAAE,UAAU;QACtC,gBAAgB,EAAE,QAAQ;QAC1B,gBAAgB,EAAE,QAAQ;QAC1B,eAAe,EAAE,OAAO;QACxB,wBAAwB,EAAE,QAAQ;QAClC,wBAAwB,EAAE,SAAS;QACnC,uBAAuB,EAAE,QAAQ;QACjC,oBAAoB,EAAE,iDAAiD;QACvE,cAAc,EAAE,yBAAyB;QACzC,oBAAoB,EAAE,4BAA4B;KACnD;CACF,CAAC,CAAC"}
1
+ {"version":3,"file":"i18n.js","sourceRoot":"","sources":["../../src/i18n.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAErC,MAAM,CAAC,MAAM,SAAS,GAAG,IAAI,CAAC;IAC5B,EAAE,EAAE;QACF,YAAY,EAAE,QAAQ;QACtB,WAAW,EAAE,YAAY;QACzB,aAAa,EAAE,OAAO;QACtB,0BAA0B,EAAE,SAAS;QACrC,gBAAgB,EAAE,UAAU;QAC5B,gBAAgB,EAAE,YAAY;QAC9B,eAAe,EAAE,KAAK;QACtB,wBAAwB,EAAE,UAAU;QACpC,wBAAwB,EAAE,WAAW;QACrC,uBAAuB,EAAE,aAAa;QACtC,oBAAoB,EAClB,2DAA2D;QAC7D,cAAc,EAAE,yBAAyB;QACzC,oBAAoB,EAAE,uCAAuC;KAC9D;IACD,EAAE,EAAE;QACF,YAAY,EAAE,MAAM;QACpB,WAAW,EAAE,KAAK;QAClB,aAAa,EAAE,OAAO;QACtB,0BAA0B,EAAE,UAAU;QACtC,gBAAgB,EAAE,QAAQ;QAC1B,gBAAgB,EAAE,QAAQ;QAC1B,eAAe,EAAE,OAAO;QACxB,wBAAwB,EAAE,QAAQ;QAClC,wBAAwB,EAAE,SAAS;QACnC,uBAAuB,EAAE,QAAQ;QACjC,oBAAoB,EAAE,iDAAiD;QACvE,cAAc,EAAE,yBAAyB;QACzC,oBAAoB,EAAE,4BAA4B;KACnD;CACF,CAAC,CAAC"}
@@ -35,6 +35,7 @@ export * from './components/atoms/TabularText/TabularText';
35
35
  export * from './components/definitions';
36
36
  export * from './components/molecules/Accordion/Accordion';
37
37
  export * from './components/molecules/Alert/Alert';
38
+ export * from './components/molecules/AppThemeTabs/AppThemeTabs';
38
39
  export * from './components/molecules/Ballot/Ballot';
39
40
  export * from './components/molecules/Body/Body';
40
41
  export * from './components/molecules/ButtonProgress/ButtonProgress';
@@ -101,6 +102,7 @@ export * from './components/organisms/PickerDateRange/PickerDateRange';
101
102
  export * from './components/organisms/Snackbar/Snackbar';
102
103
  export type { FieldProps, InputProps, RolsterReactInputControl } from './components/types';
103
104
  export * from './context';
105
+ export * from './controllers/AppThemeController';
104
106
  export * from './controllers/DatatableController';
105
107
  export * from './controllers/DesingSystemController';
106
108
  export * from './controllers/DropdownController';
package/dist/esm/index.js CHANGED
@@ -35,6 +35,7 @@ export * from './components/atoms/TabularText/TabularText';
35
35
  export * from './components/definitions';
36
36
  export * from './components/molecules/Accordion/Accordion';
37
37
  export * from './components/molecules/Alert/Alert';
38
+ export * from './components/molecules/AppThemeTabs/AppThemeTabs';
38
39
  export * from './components/molecules/Ballot/Ballot';
39
40
  export * from './components/molecules/Body/Body';
40
41
  export * from './components/molecules/ButtonProgress/ButtonProgress';
@@ -100,6 +101,7 @@ export * from './components/organisms/PickerDate/PickerDate';
100
101
  export * from './components/organisms/PickerDateRange/PickerDateRange';
101
102
  export * from './components/organisms/Snackbar/Snackbar';
102
103
  export * from './context';
104
+ export * from './controllers/AppThemeController';
103
105
  export * from './controllers/DatatableController';
104
106
  export * from './controllers/DesingSystemController';
105
107
  export * from './controllers/DropdownController';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kCAAkC,CAAC;AACjD,cAAc,sCAAsC,CAAC;AACrD,cAAc,kCAAkC,CAAC;AACjD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,0CAA0C,CAAC;AACzD,cAAc,kCAAkC,CAAC;AACjD,cAAc,8CAA8C,CAAC;AAC7D,cAAc,0CAA0C,CAAC;AACzD,cAAc,8CAA8C,CAAC;AAC7D,cAAc,sCAAsC,CAAC;AACrD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,8CAA8C,CAAC;AAC7D,cAAc,8CAA8C,CAAC;AAC7D,cAAc,0CAA0C,CAAC;AACzD,cAAc,4CAA4C,CAAC;AAC3D,cAAc,gDAAgD,CAAC;AAC/D,cAAc,oDAAoD,CAAC;AACnE,cAAc,4CAA4C,CAAC;AAC3D,cAAc,wCAAwC,CAAC;AACvD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,4CA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danger' | 'berry' | 'hope' | 'mountains' | 'ross' | 'amaizing' | 'purple' | 'amber' | 'smartness' | 'obsidian';
3
- export type RlsAppTheme = 'light' | 'dark';
2
+ export type RlsTheme = 'standard' | 'primary' | 'secondary' | 'tertiary' | 'success' | 'info' | 'warning' | 'danger' | 'berry' | 'hope' | 'mountains' | 'ross' | 'amaizing' | 'purple' | 'amber' | 'smartness' | 'obsidian' | 'neutral';
3
+ export type RlsAppTheme = 'light' | 'dim' | 'dark';
4
4
  export type RlsDesignSystem = 'bordered' | 'filled' | 'gradient';
5
5
  export type RlsButtonType = 'ghost' | 'flat' | 'raised';
6
6
  declare module 'react' {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rolster/react-components",
3
- "version": "19.9.0",
3
+ "version": "19.10.0",
4
4
  "type": "module",
5
5
  "description": "Package containing UI components for React Project.",
6
6
  "license": "MIT",
@@ -50,7 +50,7 @@
50
50
  "devDependencies": {
51
51
  "@eslint/js": "^10.0.1",
52
52
  "@rolster/rollup": "^2.2.0",
53
- "@rolster/styles-foundations": "^3.5.24",
53
+ "@rolster/styles-foundations": "^3.7.0",
54
54
  "@rolster/types": "^1.1.1",
55
55
  "@types/react": "^19.0.0",
56
56
  "@types/react-dom": "^19.0.0",
package/readme.md CHANGED
@@ -168,6 +168,7 @@ function Header({ requesting, onSave }: HeaderProps) {
168
168
  | ------------------------- | ---------------------------------------------------------------------------------------- |
169
169
  | `RlsAccordion` | Collapsible section with title and indicator, animated on the height of its content |
170
170
  | `RlsAlert` | Message block with optional icon and bordered variant |
171
+ | `RlsAppThemeTabs` | Tab bar with the application themes that writes the selected one on the body |
171
172
  | `RlsBallot` | Avatar, title and subtitle row, with skeleton state |
172
173
  | `RlsBody` | Body container of an application page |
173
174
  | `RlsButtonProgress` | Action button surrounded by a circular progress while `progressing` |
@@ -301,27 +302,28 @@ function Assignment({ persons }: { persons: Person[] }) {
301
302
 
302
303
  ### Hooks
303
304
 
304
- | Hook | Description |
305
- | ---------------------------------------------------- | ------------------------------------------------------------------------------------- |
306
- | `useRlsContext(): RlsState` | Reads the context of `RlsApplication`; throws when the wrapper is missing |
307
- | `useConfirmation(): ConfirmationService` | Creates the `confirmation` function and the `RlsConfirmation` node that renders it |
308
- | `useNotifications(): NotificationsService` | Creates the `notify` function and the `RlsNotifications` node with the stack |
309
- | `useSnackbar(): SnackbarService` | Creates the `snackbar` function and the `RlsSnackbar` node that renders it |
310
- | `useFieldAutocomplete(props)` | State of an autocomplete field: coincidences, pattern, references and event handlers |
311
- | `useFieldList(props)` | State of a multiple selection field: selected elements, references and event handlers |
312
- | `useFieldSelect(props)` | State of a single selection field: value, references and event handlers |
313
- | `useListController(props)` | Base of the previous ones: visibility, keyboard navigation and writing to the control |
314
- | `useDatatable(table?): DatatableController` | Observes the body of a table and reports whether it is scrollable |
315
- | `useDesingSystemController(primary?, secondary?)` | Applies a design system and toggles between two of them |
316
- | `useDropdownController(effect?): DropdownController` | Opens a `RlsDropdown` at a position or from a mouse event |
317
- | `usePortalController(): PortalController` | Visibility of modals, sheets and navigation panels |
318
- | `useTabsController(options): TabsController` | Creates the control of a tab bar and the `Tabs` node bound to it |
319
- | `useImageEditorController(options)` | Opens the file selector and the image editor, and returns the node that renders them |
320
- | `useFormSingleSelectionController(props)` | `checked` state and selection of a value over a control |
321
- | `useFormToggleController(props)` | `checked` state and toggle of a `boolean` control |
322
- | `useResize({ refElement, onResize })` | Reports the dimensions of an element when it changes size |
323
- | `useRelocationOnComponent({ container, element })` | Allows dragging an element inside its container |
324
- | `useEventCallback(callback)` | Returns a stable function that always calls the last received callback |
305
+ | Hook | Description |
306
+ | ------------------------------------------------------- | ------------------------------------------------------------------------------------- |
307
+ | `useRlsContext(): RlsState` | Reads the context of `RlsApplication`; throws when the wrapper is missing |
308
+ | `useConfirmation(): ConfirmationService` | Creates the `confirmation` function and the `RlsConfirmation` node that renders it |
309
+ | `useNotifications(): NotificationsService` | Creates the `notify` function and the `RlsNotifications` node with the stack |
310
+ | `useSnackbar(): SnackbarService` | Creates the `snackbar` function and the `RlsSnackbar` node that renders it |
311
+ | `useFieldAutocomplete(props)` | State of an autocomplete field: coincidences, pattern, references and event handlers |
312
+ | `useFieldList(props)` | State of a multiple selection field: selected elements, references and event handlers |
313
+ | `useFieldSelect(props)` | State of a single selection field: value, references and event handlers |
314
+ | `useListController(props)` | Base of the previous ones: visibility, keyboard navigation and writing to the control |
315
+ | `useDatatable(table?): DatatableController` | Observes the body of a table and reports whether it is scrollable |
316
+ | `useDesingSystemController(primary?, secondary?)` | Applies a design system and toggles between two of them |
317
+ | `useAppThemeController(initial?, primary?, secondary?)` | Applies an application theme and toggles between two of them |
318
+ | `useDropdownController(effect?): DropdownController` | Opens a `RlsDropdown` at a position or from a mouse event |
319
+ | `usePortalController(): PortalController` | Visibility of modals, sheets and navigation panels |
320
+ | `useTabsController(options): TabsController` | Creates the control of a tab bar and the `Tabs` node bound to it |
321
+ | `useImageEditorController(options)` | Opens the file selector and the image editor, and returns the node that renders them |
322
+ | `useFormSingleSelectionController(props)` | `checked` state and selection of a value over a control |
323
+ | `useFormToggleController(props)` | `checked` state and toggle of a `boolean` control |
324
+ | `useResize({ refElement, onResize })` | Reports the dimensions of an element when it changes size |
325
+ | `useRelocationOnComponent({ container, element })` | Allows dragging an element inside its container |
326
+ | `useEventCallback(callback)` | Returns a stable function that always calls the last received callback |
325
327
 
326
328
  ```tsx
327
329
  import { RlsButton, useRlsContext } from '@rolster/react-components';
@@ -354,12 +356,12 @@ function DeleteAction({ person }: { person: Person }) {
354
356
 
355
357
  ### Theme and design system
356
358
 
357
- The application theme is written on the `app-theme` attribute of `document.body`, and the colors of a theme are written as custom properties on that same element.
359
+ The application theme is written on the `app-theme` attribute of `document.body`, and the colors of a theme are written as custom properties on that same element. The themes are `light`, `dim` and `dark`, as declared by `@rolster/styles-foundations`; `RlsAppThemeTabs` renders them as a tab bar and applies the selected one, with translated labels that the `labels` prop can override.
358
360
 
359
361
  | Function | Description |
360
362
  | ---------------------------------------- | ---------------------------------------------------------------------------- |
361
363
  | `getAppTheme(): RlsAppTheme` | Current theme, `light` when nothing has been set |
362
- | `setAppTheme(theme)` | Writes `light` or `dark` on the application body |
364
+ | `setAppTheme(theme)` | Writes `light`, `dim` or `dark` on the application body |
363
365
  | `toggleAppTheme(): RlsAppTheme` | Switches between `light` and `dark`, and returns the applied theme |
364
366
  | `setDesignSystem(designSystem?)` | Writes the class of the design system on the body and removes the other ones |
365
367
  | `generateThemePalette(color, theme?)` | Builds a `ThemePalette` of eleven shades from a hexadecimal color |
@@ -398,7 +400,7 @@ toggleAppTheme(); // 'dark'
398
400
  | Type | Description |
399
401
  | -------------------------------- | ------------------------------------------------------------------------------- |
400
402
  | `RlsTheme` | Color theme of a component, applied with the `rlsTheme` prop |
401
- | `RlsAppTheme` | Application theme, `light` or `dark` |
403
+ | `RlsAppTheme` | Application theme, `light`, `dim` or `dark` |
402
404
  | `RlsDesignSystem` | Design system, `bordered`, `filled` or `gradient` |
403
405
  | `RlsButtonType` | Button style, `ghost`, `flat` or `raised` |
404
406
  | `PropsWithClassName` | Props with an optional `className` |
@@ -414,6 +416,7 @@ toggleAppTheme(); // 'dark'
414
416
  | `NotificationsConfig` | Configuration of a notification, a `SnackbarConfig` plus `duration` |
415
417
  | `PaginationEvent<T>` | Event of `RlsPagination`: page, limits and suggestions of the page |
416
418
  | `Tab<T>` | Tab of `RlsTabs`: label, value and disabled state |
419
+ | `AppThemeLabels` | Labels of `RlsAppThemeTabs`, one optional string per application theme |
417
420
  | `NavbarMenuOption` | Option of `RlsNavbarMenu`: identifier, icon and label |
418
421
  | `ImageEditorValue` | Result of the image editor: `base64` and `blob` |
419
422
  | `ThemePalette` | Palette generated for a theme: shades, custom properties and CSS |