@rolster/react-components 19.7.2 → 19.7.5
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.
- package/LICENSE +21 -21
- package/dist/cjs/index.cjs +38 -14
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/es/index.mjs +39 -16
- package/dist/es/index.mjs.map +1 -1
- package/dist/esm/components/atoms/Avatar/Avatar.d.ts +2 -1
- package/dist/esm/components/atoms/Avatar/Avatar.js +3 -2
- package/dist/esm/components/atoms/Avatar/Avatar.js.map +1 -1
- package/dist/esm/components/atoms/ButtonAction/ButtonAction.d.ts +2 -1
- package/dist/esm/components/atoms/ButtonAction/ButtonAction.js +2 -2
- package/dist/esm/components/atoms/ButtonAction/ButtonAction.js.map +1 -1
- package/dist/esm/components/molecules/Tabs/Tabs.d.ts +4 -1
- package/dist/esm/components/molecules/Tabs/Tabs.js +25 -11
- package/dist/esm/components/molecules/Tabs/Tabs.js.map +1 -1
- package/dist/esm/controllers/TabsController.d.ts +14 -0
- package/dist/esm/controllers/TabsController.js +12 -0
- package/dist/esm/controllers/TabsController.js.map +1 -0
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/index.js.map +1 -1
- package/package.json +83 -83
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2022 Rolster Technology
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022 Rolster Technology
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -539,11 +539,12 @@ function RlsAreaTextComponent({ autoComplete, disabled, formControl, identifier,
|
|
|
539
539
|
}
|
|
540
540
|
const RlsAreaText = require$$0.memo(RlsAreaTextComponent);
|
|
541
541
|
|
|
542
|
-
function RlsAvatarComponent({ children, contrasted, rounded, skeleton, rlsTheme }) {
|
|
542
|
+
function RlsAvatarComponent({ children, contrasted, rounded, skeleton, transparent, rlsTheme }) {
|
|
543
543
|
const className = renderClassStatus('rls-avatar', {
|
|
544
544
|
contrasted,
|
|
545
545
|
rounded,
|
|
546
|
-
skeleton
|
|
546
|
+
skeleton,
|
|
547
|
+
transparent
|
|
547
548
|
});
|
|
548
549
|
return (jsxRuntimeExports.jsx("div", { className: className, "rls-theme": rlsTheme, children: children }));
|
|
549
550
|
}
|
|
@@ -586,9 +587,9 @@ function RlsButtonComponent({ type, children, disabled, identifier, onClick, pre
|
|
|
586
587
|
}
|
|
587
588
|
const RlsButton = require$$0.memo(RlsButtonComponent);
|
|
588
589
|
|
|
589
|
-
function RlsButtonActionComponent({ icon, disabled, identifier, onClick, rlsTheme, tooltip, type }) {
|
|
590
|
+
function RlsButtonActionComponent({ icon, badge, disabled, identifier, onClick, rlsTheme, tooltip, type }) {
|
|
590
591
|
const className = renderClassStatus('rls-button-action', { type });
|
|
591
|
-
return (jsxRuntimeExports.jsxs("button", { id: identifier, className: className, onClick: onClick, disabled: disabled, "rls-theme": rlsTheme, children: [jsxRuntimeExports.
|
|
592
|
+
return (jsxRuntimeExports.jsxs("button", { id: identifier, className: className, onClick: onClick, disabled: disabled, "rls-theme": rlsTheme, children: [jsxRuntimeExports.jsxs("div", { className: "rls-button-action__content", children: [jsxRuntimeExports.jsx(RlsIcon, { value: icon }), badge && jsxRuntimeExports.jsx("span", { className: "rls-button-action__badge", children: badge })] }), tooltip && (jsxRuntimeExports.jsx("div", { className: "rls-button-action__tooltip rls-overline-font-medium", children: jsxRuntimeExports.jsx("span", { children: tooltip }) }))] }));
|
|
592
593
|
}
|
|
593
594
|
const RlsButtonAction = require$$0.memo(RlsButtonActionComponent);
|
|
594
595
|
|
|
@@ -2299,32 +2300,46 @@ function RlsSliderComponent({ children, className, disabled, formControl, identi
|
|
|
2299
2300
|
}
|
|
2300
2301
|
const RlsSlider = require$$0.memo(RlsSliderComponent);
|
|
2301
2302
|
|
|
2302
|
-
function RlsTab({ onSelect, tab, value }) {
|
|
2303
|
+
function RlsTab({ disabled, onSelect, tab, value }) {
|
|
2303
2304
|
const className = renderClassStatus('rls-tabs__children', {
|
|
2304
2305
|
active: tab.value === value,
|
|
2305
|
-
disabled: tab.disabled
|
|
2306
|
+
disabled: disabled || tab.disabled
|
|
2306
2307
|
});
|
|
2307
2308
|
const onClick = require$$0.useCallback(() => {
|
|
2308
|
-
if (!tab.disabled) {
|
|
2309
|
+
if (!disabled && !tab.disabled) {
|
|
2309
2310
|
onSelect(tab.value);
|
|
2310
2311
|
}
|
|
2311
|
-
}, [tab.disabled]);
|
|
2312
|
+
}, [disabled, tab.disabled, onSelect]);
|
|
2312
2313
|
return (jsxRuntimeExports.jsx("div", { className: className, onClick: onClick, children: jsxRuntimeExports.jsx("span", { children: tab.label }) }));
|
|
2313
2314
|
}
|
|
2314
|
-
function RlsTabsComponent({ tabs, onValue, rlsTheme }) {
|
|
2315
|
-
const [
|
|
2315
|
+
function RlsTabsComponent({ tabs, formControl, onValue, value, rlsTheme }) {
|
|
2316
|
+
const [valueInternal, setValueInternal] = require$$0.useState();
|
|
2317
|
+
const valueSelected = require$$0.useMemo(() => {
|
|
2318
|
+
return formControl ? formControl.value : valueInternal;
|
|
2319
|
+
}, [formControl?.value, valueInternal]);
|
|
2316
2320
|
const onSelect = require$$0.useCallback((value) => {
|
|
2317
|
-
|
|
2321
|
+
if (formControl) {
|
|
2322
|
+
formControl?.setValue(value);
|
|
2323
|
+
}
|
|
2324
|
+
else {
|
|
2325
|
+
setValueInternal(value);
|
|
2326
|
+
}
|
|
2318
2327
|
onValue?.(value);
|
|
2319
|
-
}, [onValue]);
|
|
2328
|
+
}, [formControl, onValue]);
|
|
2320
2329
|
require$$0.useEffect(() => {
|
|
2330
|
+
if (formControl?.value !== undefined) {
|
|
2331
|
+
return setValueInternal(formControl.value);
|
|
2332
|
+
}
|
|
2333
|
+
if (value !== undefined) {
|
|
2334
|
+
return setValueInternal(value);
|
|
2335
|
+
}
|
|
2321
2336
|
const initial = tabs.find((tab) => tab.defaultActive) ?? tabs[0];
|
|
2322
2337
|
if (initial) {
|
|
2323
2338
|
onSelect(initial.value);
|
|
2324
2339
|
}
|
|
2325
|
-
}, []);
|
|
2340
|
+
}, [value, formControl?.value]);
|
|
2326
2341
|
return (jsxRuntimeExports.jsx("div", { className: "rls-tabs", "rls-theme": rlsTheme, children: tabs.map((tab, index) => {
|
|
2327
|
-
return (jsxRuntimeExports.jsx(RlsTab, { tab: tab, value:
|
|
2342
|
+
return (jsxRuntimeExports.jsx(RlsTab, { tab: tab, disabled: formControl?.disabled, value: valueSelected, onSelect: onSelect }, index));
|
|
2328
2343
|
}) }));
|
|
2329
2344
|
}
|
|
2330
2345
|
const RlsTabs = require$$0.memo(RlsTabsComponent);
|
|
@@ -4721,6 +4736,14 @@ function usePortalController() {
|
|
|
4721
4736
|
return { close, open, visible };
|
|
4722
4737
|
}
|
|
4723
4738
|
|
|
4739
|
+
function useTabsController(options) {
|
|
4740
|
+
const formControl = reactForms.useFormControl(options.value);
|
|
4741
|
+
const Tabs = require$$0.useMemo(() => {
|
|
4742
|
+
return (jsxRuntimeExports.jsx(RlsTabs, { tabs: options.tabs, formControl: formControl, onValue: options.onValue }));
|
|
4743
|
+
}, [options.tabs, options.onValue, formControl]);
|
|
4744
|
+
return { Tabs, formControl };
|
|
4745
|
+
}
|
|
4746
|
+
|
|
4724
4747
|
const APP_THEME_ATTRIBUTE = 'app-theme';
|
|
4725
4748
|
function getAppTheme() {
|
|
4726
4749
|
if (typeof document === 'undefined') {
|
|
@@ -4889,4 +4912,5 @@ exports.useRelocationOnComponent = useRelocationOnComponent;
|
|
|
4889
4912
|
exports.useResize = useResize;
|
|
4890
4913
|
exports.useRlsContext = useRlsContext;
|
|
4891
4914
|
exports.useSnackbar = useSnackbar;
|
|
4915
|
+
exports.useTabsController = useTabsController;
|
|
4892
4916
|
//# sourceMappingURL=index.cjs.map
|