@rolster/react-components 19.9.0 → 19.11.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.
Files changed (32) hide show
  1. package/dist/cjs/index.cjs +229 -93
  2. package/dist/cjs/index.cjs.map +1 -1
  3. package/dist/es/index.mjs +224 -94
  4. package/dist/es/index.mjs.map +1 -1
  5. package/dist/esm/components/atoms/Chip/Chip.d.ts +13 -0
  6. package/dist/esm/components/atoms/Chip/Chip.js +10 -0
  7. package/dist/esm/components/atoms/Chip/Chip.js.map +1 -0
  8. package/dist/esm/components/molecules/AppThemeTabs/AppThemeTabs.d.ts +13 -0
  9. package/dist/esm/components/molecules/AppThemeTabs/AppThemeTabs.js +34 -0
  10. package/dist/esm/components/molecules/AppThemeTabs/AppThemeTabs.js.map +1 -0
  11. package/dist/esm/components/molecules/ChipGroup/ChipGroup.d.ts +31 -0
  12. package/dist/esm/components/molecules/ChipGroup/ChipGroup.js +34 -0
  13. package/dist/esm/components/molecules/ChipGroup/ChipGroup.js.map +1 -0
  14. package/dist/esm/components/organisms/FieldList/FieldList.js +4 -2
  15. package/dist/esm/components/organisms/FieldList/FieldList.js.map +1 -1
  16. package/dist/esm/components/organisms/LedColor/LedColor.d.ts +36 -0
  17. package/dist/esm/components/organisms/LedColor/LedColor.js +48 -0
  18. package/dist/esm/components/organisms/LedColor/LedColor.js.map +1 -0
  19. package/dist/esm/controllers/AppThemeController.d.ts +7 -0
  20. package/dist/esm/controllers/AppThemeController.js +20 -0
  21. package/dist/esm/controllers/AppThemeController.js.map +1 -0
  22. package/dist/esm/helpers/app-theme.js +2 -3
  23. package/dist/esm/helpers/app-theme.js.map +1 -1
  24. package/dist/esm/i18n.d.ts +3 -0
  25. package/dist/esm/i18n.js +6 -0
  26. package/dist/esm/i18n.js.map +1 -1
  27. package/dist/esm/index.d.ts +5 -0
  28. package/dist/esm/index.js +5 -0
  29. package/dist/esm/index.js.map +1 -1
  30. package/dist/esm/types.d.ts +2 -2
  31. package/package.json +2 -2
  32. package/readme.md +30 -24
@@ -721,6 +721,12 @@ function RlsCheckBoxControlComponent({ formControl, disabled, identifier, rlsThe
721
721
  }
722
722
  const RlsCheckBoxControl = require$$0.memo(RlsCheckBoxControlComponent);
723
723
 
724
+ function RlsChipComponent({ children, className, contrasted, disabled, icon, identifier, onClick, onRemove, rlsTheme, selected }) {
725
+ const classNameChip = renderClassStatus('rls-chip', { clickable: !!onClick && !disabled, contrasted, disabled, selected }, className);
726
+ return (jsxRuntimeExports.jsxs("div", { id: identifier, className: classNameChip, "rls-theme": rlsTheme, onClick: disabled ? undefined : onClick, children: [icon && jsxRuntimeExports.jsx(RlsIcon, { className: "rls-chip__icon", value: icon }), jsxRuntimeExports.jsx("span", { className: "rls-chip__description", children: children }), onRemove && !disabled && (jsxRuntimeExports.jsx("button", { className: "rls-chip__remove", type: "button", onClick: onRemove, children: jsxRuntimeExports.jsx(RlsIcon, { value: "close" }) }))] }));
727
+ }
728
+ const RlsChip = require$$0.memo(RlsChipComponent);
729
+
724
730
  function RlsSkeletonComponent({ animation, rlsTheme }) {
725
731
  const className = renderClassStatus('rls-skeleton', {
726
732
  animation: animation !== 'shimmer' && animation
@@ -1472,6 +1478,132 @@ function RlsAlertComponent({ bordered, children, icon, identifier, rlsTheme }) {
1472
1478
  }
1473
1479
  const RlsAlert = require$$0.memo(RlsAlertComponent);
1474
1480
 
1481
+ const APP_THEME_ATTRIBUTE = 'app-theme';
1482
+ function getAppTheme() {
1483
+ if (typeof document === 'undefined') {
1484
+ return 'light';
1485
+ }
1486
+ const theme = document.body.getAttribute(APP_THEME_ATTRIBUTE);
1487
+ return theme === 'dark' || theme === 'dim' ? theme : 'light';
1488
+ }
1489
+ function setAppTheme(theme) {
1490
+ if (typeof document === 'undefined') {
1491
+ return;
1492
+ }
1493
+ document.body.setAttribute(APP_THEME_ATTRIBUTE, theme);
1494
+ }
1495
+ function toggleAppTheme() {
1496
+ const theme = getAppTheme() === 'dark' ? 'light' : 'dark';
1497
+ setAppTheme(theme);
1498
+ return theme;
1499
+ }
1500
+
1501
+ const reactI18n = i18n.i18n({
1502
+ es: {
1503
+ appThemeDark: 'Oscuro',
1504
+ appThemeDim: 'Intermedio',
1505
+ appThemeLight: 'Claro',
1506
+ confirmationActionApproved: 'Aceptar',
1507
+ dateActionCancel: 'Cancelar',
1508
+ dateActionSelect: 'Establecer',
1509
+ dateActionToday: 'Hoy',
1510
+ chooserImageActionCancel: 'Cancelar',
1511
+ editorImageActionRestore: 'Restaurar',
1512
+ editorImageActionSelect: 'Seleccionar',
1513
+ listEmptyDescription: 'Lo sentimos, en el momento no hay elementos en el listado',
1514
+ listEmptyTitle: 'Selección no disponible',
1515
+ listInputPlaceholder: 'Escriba palabre clave para filtrar...'
1516
+ },
1517
+ en: {
1518
+ appThemeDark: 'Dark',
1519
+ appThemeDim: 'Dim',
1520
+ appThemeLight: 'Light',
1521
+ confirmationActionApproved: 'Approved',
1522
+ dateActionCancel: 'Cancel',
1523
+ dateActionSelect: 'Select',
1524
+ dateActionToday: 'Today',
1525
+ chooserImageActionCancel: 'Cancel',
1526
+ editorImageActionRestore: 'Restore',
1527
+ editorImageActionSelect: 'Select',
1528
+ listEmptyDescription: 'Sorry, there are currently no items in the list',
1529
+ listEmptyTitle: 'Selection not available',
1530
+ listInputPlaceholder: 'Enter keyword to filter...'
1531
+ }
1532
+ });
1533
+
1534
+ function RlsTab({ disabled, onSelect, tab, value }) {
1535
+ const className = renderClassStatus('rls-tabs__children', {
1536
+ active: tab.value === value,
1537
+ disabled: disabled || tab.disabled
1538
+ });
1539
+ const onClick = require$$0.useCallback(() => {
1540
+ if (!disabled && !tab.disabled) {
1541
+ onSelect(tab.value);
1542
+ }
1543
+ }, [disabled, tab.disabled, onSelect]);
1544
+ return (jsxRuntimeExports.jsx("div", { className: className, onClick: onClick, children: jsxRuntimeExports.jsx("span", { children: tab.label }) }));
1545
+ }
1546
+ function RlsTabsComponent({ tabs, formControl, onValue, value, rlsTheme }) {
1547
+ const [valueInternal, setValueInternal] = require$$0.useState();
1548
+ const valueSelected = require$$0.useMemo(() => {
1549
+ return formControl ? formControl.value : valueInternal;
1550
+ }, [formControl?.value, valueInternal]);
1551
+ const onSelect = require$$0.useCallback((value) => {
1552
+ if (formControl) {
1553
+ formControl?.setValue(value);
1554
+ }
1555
+ else {
1556
+ setValueInternal(value);
1557
+ }
1558
+ onValue?.(value);
1559
+ }, [formControl, onValue]);
1560
+ require$$0.useEffect(() => {
1561
+ if (formControl?.value !== undefined) {
1562
+ return setValueInternal(formControl.value);
1563
+ }
1564
+ if (value !== undefined) {
1565
+ return setValueInternal(value);
1566
+ }
1567
+ const initial = tabs.find((tab) => tab.defaultActive) ?? tabs[0];
1568
+ if (initial) {
1569
+ onSelect(initial.value);
1570
+ }
1571
+ }, [value, formControl?.value]);
1572
+ return (jsxRuntimeExports.jsx("div", { className: "rls-tabs", "rls-theme": rlsTheme, children: tabs.map((tab, index) => {
1573
+ return (jsxRuntimeExports.jsx(RlsTab, { tab: tab, disabled: formControl?.disabled, value: valueSelected, onSelect: onSelect }, index));
1574
+ }) }));
1575
+ }
1576
+ const RlsTabs = require$$0.memo(RlsTabsComponent);
1577
+
1578
+ const APP_THEMES = ['light', 'dim', 'dark'];
1579
+ const LABELS = {
1580
+ light: () => reactI18n('appThemeLight'),
1581
+ dim: () => reactI18n('appThemeDim'),
1582
+ dark: () => reactI18n('appThemeDark')
1583
+ };
1584
+ function RlsAppThemeTabsComponent({ labels, onValue, rlsTheme, themes = APP_THEMES, value }) {
1585
+ const [appTheme, setAppThemeValue] = require$$0.useState(() => value ?? getAppTheme());
1586
+ require$$0.useEffect(() => {
1587
+ if (value !== undefined) {
1588
+ setAppTheme(value);
1589
+ setAppThemeValue(value);
1590
+ }
1591
+ }, [value]);
1592
+ const tabs = require$$0.useMemo(() => {
1593
+ return themes.map((theme) => ({
1594
+ label: labels?.[theme] ?? LABELS[theme](),
1595
+ value: theme
1596
+ }));
1597
+ }, [labels, themes]);
1598
+ const onSelect = require$$0.useCallback((theme) => {
1599
+ setAppTheme(theme);
1600
+ setAppThemeValue(theme);
1601
+ onValue?.(theme);
1602
+ }, [onValue]);
1603
+ return (jsxRuntimeExports.jsx(RlsTabs, { tabs: tabs, value: appTheme, onValue: onSelect, rlsTheme: rlsTheme }));
1604
+ }
1605
+ const RlsAppThemeTabs = require$$0.memo(RlsAppThemeTabsComponent);
1606
+
1475
1607
  function RlsBallotComponent({ bordered, className, children, img, initials, skeleton, subtitle, rlsTheme }) {
1476
1608
  const classNameBallot = renderClassStatus('rls-ballot', { bordered, skeleton }, className);
1477
1609
  return (jsxRuntimeExports.jsxs("div", { className: classNameBallot, "rls-theme": rlsTheme, children: [(img || initials) && (jsxRuntimeExports.jsxs(RlsAvatar, { skeleton: skeleton, children: [img && jsxRuntimeExports.jsx("img", { src: img }), initials && jsxRuntimeExports.jsx("span", { children: initials })] })), jsxRuntimeExports.jsxs("div", { className: "rls-ballot__component", children: [jsxRuntimeExports.jsx("div", { className: "rls-ballot__title", children: jsxRuntimeExports.jsx(RlsSkeletonText, { active: skeleton, children: children }) }), subtitle && (jsxRuntimeExports.jsx("div", { className: "rls-ballot__subtitle", children: jsxRuntimeExports.jsx(RlsSkeletonText, { active: skeleton, children: subtitle }) }))] })] }));
@@ -1545,6 +1677,36 @@ function RlsButtonToggleComponent({ onAction, options, type, automatic, disabled
1545
1677
  }
1546
1678
  const RlsButtonToggle = require$$0.memo(RlsButtonToggleComponent);
1547
1679
 
1680
+ function RlsChipGroupComponent({ className, disabled: disabledProps, formControl, identifier, onValue, options, reference, render, rlsTheme, value: valueInitial }) {
1681
+ const [value, setValue] = require$$0.useState(formControl?.value ?? valueInitial);
1682
+ const selected = require$$0.useMemo(() => {
1683
+ return formControl ? formControl.value : value;
1684
+ }, [formControl?.value, value]);
1685
+ const disabled = require$$0.useMemo(() => {
1686
+ return formControl?.disabled || disabledProps;
1687
+ }, [formControl?.disabled, disabledProps]);
1688
+ const classNameGroup = renderClassStatus('rls-chip-group', { disabled }, className);
1689
+ const isSelected = require$$0.useCallback((option) => {
1690
+ if (selected === undefined || selected === null) {
1691
+ return false;
1692
+ }
1693
+ return reference
1694
+ ? reference(option) === reference(selected)
1695
+ : option === selected;
1696
+ }, [reference, selected]);
1697
+ const onSelect = require$$0.useCallback((option) => () => {
1698
+ if (disabled) {
1699
+ return;
1700
+ }
1701
+ setValue(option);
1702
+ formControl?.setValue(option);
1703
+ formControl?.touch();
1704
+ onValue?.(option);
1705
+ }, [disabled, formControl, onValue]);
1706
+ return (jsxRuntimeExports.jsx("div", { id: identifier, className: classNameGroup, "rls-theme": rlsTheme, children: options.map((option, index) => (jsxRuntimeExports.jsx(RlsChip, { disabled: disabled, selected: isSelected(option), onClick: onSelect(option), children: render ? render(option) : String(option) }, index))) }));
1707
+ }
1708
+ const RlsChipGroup = require$$0.memo(RlsChipGroupComponent);
1709
+
1548
1710
  function RlsContentComponent({ children, identifier, rlsTheme }) {
1549
1711
  return (jsxRuntimeExports.jsx("div", { id: identifier, className: "rls-app__page__content", "rls-theme": rlsTheme, children: children }));
1550
1712
  }
@@ -1759,33 +1921,6 @@ function RlsFieldFileComponent({ accept, children, disabled: _disabled, formCont
1759
1921
  }
1760
1922
  const RlsFieldFile = require$$0.memo(RlsFieldFileComponent);
1761
1923
 
1762
- const reactI18n = i18n.i18n({
1763
- es: {
1764
- confirmationActionApproved: 'Aceptar',
1765
- dateActionCancel: 'Cancelar',
1766
- dateActionSelect: 'Establecer',
1767
- dateActionToday: 'Hoy',
1768
- chooserImageActionCancel: 'Cancelar',
1769
- editorImageActionRestore: 'Restaurar',
1770
- editorImageActionSelect: 'Seleccionar',
1771
- listEmptyDescription: 'Lo sentimos, en el momento no hay elementos en el listado',
1772
- listEmptyTitle: 'Selección no disponible',
1773
- listInputPlaceholder: 'Escriba palabre clave para filtrar...'
1774
- },
1775
- en: {
1776
- confirmationActionApproved: 'Approved',
1777
- dateActionCancel: 'Cancel',
1778
- dateActionSelect: 'Select',
1779
- dateActionToday: 'Today',
1780
- chooserImageActionCancel: 'Cancel',
1781
- editorImageActionRestore: 'Restore',
1782
- editorImageActionSelect: 'Select',
1783
- listEmptyDescription: 'Sorry, there are currently no items in the list',
1784
- listEmptyTitle: 'Selection not available',
1785
- listInputPlaceholder: 'Enter keyword to filter...'
1786
- }
1787
- });
1788
-
1789
1924
  function useEventCallback(callback) {
1790
1925
  const refCallback = require$$0.useRef(callback);
1791
1926
  require$$0.useInsertionEffect(() => {
@@ -2696,50 +2831,6 @@ function RlsSliderComponent({ children, className, disabled, formControl, identi
2696
2831
  }
2697
2832
  const RlsSlider = require$$0.memo(RlsSliderComponent);
2698
2833
 
2699
- function RlsTab({ disabled, onSelect, tab, value }) {
2700
- const className = renderClassStatus('rls-tabs__children', {
2701
- active: tab.value === value,
2702
- disabled: disabled || tab.disabled
2703
- });
2704
- const onClick = require$$0.useCallback(() => {
2705
- if (!disabled && !tab.disabled) {
2706
- onSelect(tab.value);
2707
- }
2708
- }, [disabled, tab.disabled, onSelect]);
2709
- return (jsxRuntimeExports.jsx("div", { className: className, onClick: onClick, children: jsxRuntimeExports.jsx("span", { children: tab.label }) }));
2710
- }
2711
- function RlsTabsComponent({ tabs, formControl, onValue, value, rlsTheme }) {
2712
- const [valueInternal, setValueInternal] = require$$0.useState();
2713
- const valueSelected = require$$0.useMemo(() => {
2714
- return formControl ? formControl.value : valueInternal;
2715
- }, [formControl?.value, valueInternal]);
2716
- const onSelect = require$$0.useCallback((value) => {
2717
- if (formControl) {
2718
- formControl?.setValue(value);
2719
- }
2720
- else {
2721
- setValueInternal(value);
2722
- }
2723
- onValue?.(value);
2724
- }, [formControl, onValue]);
2725
- require$$0.useEffect(() => {
2726
- if (formControl?.value !== undefined) {
2727
- return setValueInternal(formControl.value);
2728
- }
2729
- if (value !== undefined) {
2730
- return setValueInternal(value);
2731
- }
2732
- const initial = tabs.find((tab) => tab.defaultActive) ?? tabs[0];
2733
- if (initial) {
2734
- onSelect(initial.value);
2735
- }
2736
- }, [value, formControl?.value]);
2737
- return (jsxRuntimeExports.jsx("div", { className: "rls-tabs", "rls-theme": rlsTheme, children: tabs.map((tab, index) => {
2738
- return (jsxRuntimeExports.jsx(RlsTab, { tab: tab, disabled: formControl?.disabled, value: valueSelected, onSelect: onSelect }, index));
2739
- }) }));
2740
- }
2741
- const RlsTabs = require$$0.memo(RlsTabsComponent);
2742
-
2743
2834
  function RlsToolbarComponent({ actions, children, subtitle }) {
2744
2835
  return (jsxRuntimeExports.jsxs("div", { className: "rls-toolbar", children: [jsxRuntimeExports.jsxs("div", { className: "rls-toolbar__description", children: [children && jsxRuntimeExports.jsx("label", { className: "rls-toolbar__title", children: children }), subtitle && (jsxRuntimeExports.jsx("label", { className: "rls-toolbar__subtitle smalltext-semibold", children: subtitle }))] }), actions && (jsxRuntimeExports.jsx("div", { className: "rls-toolbar__actions", children: actions.map((action, index) => (jsxRuntimeExports.jsx("div", { children: action }, index))) }))] }));
2745
2836
  }
@@ -4554,7 +4645,9 @@ function RlsFieldListInner({ render, suggestions, action, children, formControl,
4554
4645
  readonly: props.readOnly
4555
4646
  }, `rls-field-list rls-field-list__multi ${props.className ?? ''}`);
4556
4647
  const renderWithCheckbox = require$$0.useCallback((element) => (jsxRuntimeExports.jsxs("div", { className: "rls-field-list__multi__element", children: [jsxRuntimeExports.jsx(RlsCheckBox, { checked: fieldList.isSelected(element) }), render(element)] })), [fieldList.isSelected, render]);
4557
- return (jsxRuntimeExports.jsxs("div", { id: props.identifier, ref: fieldList.refContent, className: className, "rls-theme": rlsTheme, children: [children && jsxRuntimeExports.jsx("span", { 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("div", { className: "rls-field-list__multi__chips", onClick: disabled ? undefined : fieldList.onClickInput, children: !fieldList.selected.length && placeholder ? (jsxRuntimeExports.jsx("span", { className: "rls-field-list__multi__placeholder", children: placeholder })) : (fieldList.selected.map((item, index) => (jsxRuntimeExports.jsxs("div", { className: "rls-field-list__multi__chip", children: [jsxRuntimeExports.jsx("span", { className: "rls-field-list__multi__chip__description", children: item.description }), !props.readOnly && !disabled && (jsxRuntimeExports.jsx("button", { className: "rls-field-list__multi__chip__remove", onClick: fieldList.onRemoveElement(item), children: jsxRuntimeExports.jsx(RlsIcon, { value: "close" }) }))] }, index)))) }), !props.readOnly && !disabled && (jsxRuntimeExports.jsx(RlsButtonIcon, { icon: "arrow-ios-down", onClick: fieldList.onClickAction }))] }) }), !msgErrorDisabled && (jsxRuntimeExports.jsx(RlsMessageFormError, { className: "rls-field-box__error", formControl: formControl })), jsxRuntimeExports.jsx(RlsFieldListSuggestions, { elements: suggestions, visible: fieldList.listIsVisible, action: action, disabled: disabled, higher: fieldList.higher, render: renderWithCheckbox, refAnchor: fieldList.refContent, refList: fieldList.refList, refSuggestions: fieldList.refSuggestions, onClickElement: fieldList.onClickElement, onKeydownElement: fieldList.onKeydownElement, onClickBackdrop: fieldList.onClickBackdrop, onHiddenAnchor: fieldList.onClickBackdrop })] }));
4648
+ return (jsxRuntimeExports.jsxs("div", { id: props.identifier, ref: fieldList.refContent, className: className, "rls-theme": rlsTheme, children: [children && jsxRuntimeExports.jsx("span", { 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("div", { className: "rls-field-list__multi__chips", onClick: disabled ? undefined : fieldList.onClickInput, children: !fieldList.selected.length && placeholder ? (jsxRuntimeExports.jsx("span", { className: "rls-field-list__multi__placeholder", children: placeholder })) : (fieldList.selected.map((item, index) => (jsxRuntimeExports.jsx(RlsChip, { onRemove: !props.readOnly && !disabled
4649
+ ? fieldList.onRemoveElement(item)
4650
+ : undefined, children: item.description }, index)))) }), !props.readOnly && !disabled && (jsxRuntimeExports.jsx(RlsButtonIcon, { icon: "arrow-ios-down", onClick: fieldList.onClickAction }))] }) }), !msgErrorDisabled && (jsxRuntimeExports.jsx(RlsMessageFormError, { className: "rls-field-box__error", formControl: formControl })), jsxRuntimeExports.jsx(RlsFieldListSuggestions, { elements: suggestions, visible: fieldList.listIsVisible, action: action, disabled: disabled, higher: fieldList.higher, render: renderWithCheckbox, refAnchor: fieldList.refContent, refList: fieldList.refList, refSuggestions: fieldList.refSuggestions, onClickElement: fieldList.onClickElement, onKeydownElement: fieldList.onKeydownElement, onClickBackdrop: fieldList.onClickBackdrop, onHiddenAnchor: fieldList.onClickBackdrop })] }));
4558
4651
  }
4559
4652
  function RlsFieldListTemplateComponent(props) {
4560
4653
  const fieldList = useFieldList(props);
@@ -5043,6 +5136,46 @@ function RlsImageChooserComponent(props) {
5043
5136
  }
5044
5137
  const RlsImageChooser = require$$0.memo(RlsImageChooserComponent);
5045
5138
 
5139
+ function RlsLedColorComponent({ className, color, disabled: disabledProps, formControl, identifier, onValue, readOnly, rlsTheme, value: valueInitial }) {
5140
+ const [value, setValue] = require$$0.useState(formControl?.value ?? valueInitial);
5141
+ const [modalIsVisible, setModalIsVisible] = require$$0.useState(false);
5142
+ const [pickerKey, setPickerKey] = require$$0.useState(0);
5143
+ const colorValue = require$$0.useMemo(() => {
5144
+ return formControl ? formControl.value : value;
5145
+ }, [formControl?.value, value]);
5146
+ const disabled = require$$0.useMemo(() => {
5147
+ return formControl?.disabled || disabledProps;
5148
+ }, [formControl?.disabled, disabledProps]);
5149
+ const ledColor = require$$0.useMemo(() => {
5150
+ return colorValue && hexIsValid(colorValue)
5151
+ ? normalizeHex(colorValue)
5152
+ : undefined;
5153
+ }, [colorValue]);
5154
+ const classNameLed = renderClassStatus('rls-led-color', { disabled, error: formControl?.wrong, readonly: readOnly }, className);
5155
+ const onChange = require$$0.useCallback((value) => {
5156
+ setValue(value);
5157
+ onValue?.(value);
5158
+ }, [onValue]);
5159
+ const onClickLed = require$$0.useCallback(() => {
5160
+ if (!disabled && !readOnly) {
5161
+ setPickerKey((key) => key + 1);
5162
+ setModalIsVisible(true);
5163
+ }
5164
+ }, [disabled, readOnly]);
5165
+ const onListener = require$$0.useCallback(({ event, value }) => {
5166
+ if (event !== components.PickerListenerEvent.Cancel) {
5167
+ onChange(value);
5168
+ }
5169
+ formControl?.touch();
5170
+ setModalIsVisible(false);
5171
+ }, [formControl, onChange]);
5172
+ const onBackdrop = require$$0.useCallback(() => {
5173
+ setModalIsVisible(false);
5174
+ }, []);
5175
+ return (jsxRuntimeExports.jsxs("div", { id: identifier, className: classNameLed, "rls-theme": rlsTheme, children: [jsxRuntimeExports.jsx("button", { className: "rls-led-color__trigger", type: "button", disabled: disabled, onClick: onClickLed, children: jsxRuntimeExports.jsx(RlsLed, { color: ledColor, rlsTheme: rlsTheme }) }), jsxRuntimeExports.jsx(RlsModal, { className: "rls-modal-color", visible: modalIsVisible, rlsTheme: rlsTheme, onBackdrop: onBackdrop, children: jsxRuntimeExports.jsx(RlsPickerColor, { formControl: formControl, color: ledColor ?? color, disabled: disabled, onListener: onListener }, pickerKey) })] }));
5176
+ }
5177
+ const RlsLedColor = require$$0.memo(RlsLedColorComponent);
5178
+
5046
5179
  function RlsModalSheetComponent({ autoclose, children, className, controller, onAutoClose, visible, rlsTheme }) {
5047
5180
  const classNameModal = renderClassStatus('rls-modal-sheet', { visible: controller?.visible ?? visible }, className);
5048
5181
  const onClickBackdrop = require$$0.useCallback(() => {
@@ -5224,6 +5357,24 @@ function RlsApplication({ children }) {
5224
5357
  return (jsxRuntimeExports.jsxs(RlsContext, { value: state, children: [jsxRuntimeExports.jsxs("div", { className: className, children: [children, jsxRuntimeExports.jsx(RlsSnackbar, {})] }), jsxRuntimeExports.jsx(RlsConfirmation, {}), jsxRuntimeExports.jsx(RlsNotifications, {})] }));
5225
5358
  }
5226
5359
 
5360
+ function useAppThemeController(initialTheme, primaryTheme = 'light', secondaryTheme = 'dark') {
5361
+ const [appTheme, setAppThemeValue] = require$$0.useState(() => {
5362
+ if (initialTheme) {
5363
+ setAppTheme(initialTheme);
5364
+ return initialTheme;
5365
+ }
5366
+ return getAppTheme();
5367
+ });
5368
+ const setValue = require$$0.useCallback((value) => {
5369
+ setAppTheme(value);
5370
+ setAppThemeValue(value);
5371
+ }, []);
5372
+ const toggle = require$$0.useCallback(() => {
5373
+ setValue(appTheme === primaryTheme ? secondaryTheme : primaryTheme);
5374
+ }, [appTheme, primaryTheme, secondaryTheme, setValue]);
5375
+ return { setValue, toggle, value: appTheme };
5376
+ }
5377
+
5227
5378
  const DEFAULT_DESIGN_SYSTEM = 'bordered';
5228
5379
 
5229
5380
  const DESIGN_SYSTEM_PREFIX = 'rls-design-system';
@@ -5357,32 +5508,13 @@ function useTabsController(options) {
5357
5508
  return require$$0.useMemo(() => ({ Tabs, formControl }), [Tabs, formControl]);
5358
5509
  }
5359
5510
 
5360
- const APP_THEME_ATTRIBUTE = 'app-theme';
5361
- function getAppTheme() {
5362
- if (typeof document === 'undefined') {
5363
- return 'light';
5364
- }
5365
- return document.body.getAttribute(APP_THEME_ATTRIBUTE) === 'dark'
5366
- ? 'dark'
5367
- : 'light';
5368
- }
5369
- function setAppTheme(theme) {
5370
- if (typeof document === 'undefined') {
5371
- return;
5372
- }
5373
- document.body.setAttribute(APP_THEME_ATTRIBUTE, theme);
5374
- }
5375
- function toggleAppTheme() {
5376
- const theme = getAppTheme() === 'dark' ? 'light' : 'dark';
5377
- setAppTheme(theme);
5378
- return theme;
5379
- }
5380
-
5511
+ exports.APP_THEMES = APP_THEMES;
5381
5512
  exports.ConfirmationResult = ConfirmationResult;
5382
5513
  exports.DEFAULT_COLOR = DEFAULT_COLOR;
5383
5514
  exports.RlsAccordion = RlsAccordion;
5384
5515
  exports.RlsAlert = RlsAlert;
5385
5516
  exports.RlsAmount = RlsAmount;
5517
+ exports.RlsAppThemeTabs = RlsAppThemeTabs;
5386
5518
  exports.RlsApplication = RlsApplication;
5387
5519
  exports.RlsAreaText = RlsAreaText;
5388
5520
  exports.RlsAvatar = RlsAvatar;
@@ -5401,6 +5533,8 @@ exports.RlsButtonToggle = RlsButtonToggle;
5401
5533
  exports.RlsCard = RlsCard;
5402
5534
  exports.RlsCheckBox = RlsCheckBox;
5403
5535
  exports.RlsCheckBoxControl = RlsCheckBoxControl;
5536
+ exports.RlsChip = RlsChip;
5537
+ exports.RlsChipGroup = RlsChipGroup;
5404
5538
  exports.RlsChooserAutocomplete = RlsChooserAutocomplete;
5405
5539
  exports.RlsChooserAutocompleteTemplate = RlsChooserAutocompleteTemplate;
5406
5540
  exports.RlsChooserList = RlsChooserList;
@@ -5460,6 +5594,7 @@ exports.RlsLabelCheckBox = RlsLabelCheckBox;
5460
5594
  exports.RlsLabelRadioButton = RlsLabelRadioButton;
5461
5595
  exports.RlsLabelSwitch = RlsLabelSwitch;
5462
5596
  exports.RlsLed = RlsLed;
5597
+ exports.RlsLedColor = RlsLedColor;
5463
5598
  exports.RlsMessageEmpty = RlsMessageEmpty;
5464
5599
  exports.RlsMessageFormError = RlsMessageFormError;
5465
5600
  exports.RlsMessageIcon = RlsMessageIcon;
@@ -5516,6 +5651,7 @@ exports.setDesignSystem = setDesignSystem;
5516
5651
  exports.setErrorsI18n = setErrorsI18n;
5517
5652
  exports.setThemeColor = setThemeColor;
5518
5653
  exports.toggleAppTheme = toggleAppTheme;
5654
+ exports.useAppThemeController = useAppThemeController;
5519
5655
  exports.useConfirmation = useConfirmation;
5520
5656
  exports.useDatatable = useDatatable;
5521
5657
  exports.useDesingSystemController = useDesingSystemController;