hrm_ui_lib 3.1.15 → 3.1.17
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/assets/styles/helpers/_mixin.scss +326 -464
- package/assets/styles/styles.css +1 -1
- package/components/DarkModeSwitcher/DarkModeSwitcher.d.ts +3 -0
- package/components/DarkModeSwitcher/DarkModeSwitcher.js +25 -0
- package/components/DarkModeSwitcher/index.d.ts +1 -0
- package/components/DarkModeSwitcher/index.js +1 -0
- package/components/DarkModeSwitcher/types.d.ts +17 -0
- package/components/DarkModeSwitcher/types.js +5 -0
- package/components/SVGIcons/IconMoon.d.ts +4 -0
- package/components/SVGIcons/IconMoon.js +8 -0
- package/components/SVGIcons/IconSun.d.ts +4 -0
- package/components/SVGIcons/IconSun.js +8 -0
- package/package.json +1 -1
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef, useMemo } from 'react';
|
|
3
|
+
import classnames from 'classnames';
|
|
4
|
+
import { Label } from '../../helperComponents/Label';
|
|
5
|
+
import IconMoon from '../SVGIcons/IconMoon';
|
|
6
|
+
import IconSun from '../SVGIcons/IconSun';
|
|
7
|
+
export const DarkModeSwitcher = forwardRef((props, ref) => {
|
|
8
|
+
const { onClick, id = '', name, value, disabled, label, inlineType = false, dataId, size = 'small', setFieldValue, selectedValue, className = '', labelAddons, orientation = 'right', hasSpaceBetween = true } = props;
|
|
9
|
+
const isChecked = !!value || !!selectedValue;
|
|
10
|
+
const changeHandler = () => {
|
|
11
|
+
if (name && setFieldValue) {
|
|
12
|
+
setFieldValue(name, !isChecked);
|
|
13
|
+
}
|
|
14
|
+
if (onClick) {
|
|
15
|
+
onClick(!isChecked);
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
const labelComponent = useMemo(() => (_jsx(Label, { text: label, disabled: disabled, labelAddons: labelAddons, size: inlineType ? 'standard' : size, className: "switcher__label" })), [label, disabled, labelAddons, inlineType, size]);
|
|
19
|
+
const iconSize = size === 'small' ? 'xsmall' : 'small';
|
|
20
|
+
return (_jsxs("div", { className: classnames('dark-mode-switcher', {
|
|
21
|
+
'dark-mode-switcher--inline': inlineType,
|
|
22
|
+
'dark-mode-switcher--space-between': hasSpaceBetween
|
|
23
|
+
}), children: [label && orientation === 'right' && labelComponent, _jsxs("label", { id: id, className: classnames('controller', 'controller--switch', `controller--switch-${size}`, className, { 'controller--disabled': disabled }), children: [_jsx("input", { "data-id": dataId, type: "checkbox", tabIndex: 0, onChange: changeHandler, checked: isChecked, disabled: disabled }), _jsxs("span", { className: classnames('controller__icon', { dark_mode: selectedValue }), children: [selectedValue ? _jsx(IconSun, { size: iconSize }) : _jsx(IconMoon, { size: iconSize }), _jsx("span", { className: "controller__icon__inner" })] })] }), label && orientation === 'left' && labelComponent] }));
|
|
24
|
+
});
|
|
25
|
+
DarkModeSwitcher.displayName = 'DarkModeSwitcher';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './DarkModeSwitcher';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './DarkModeSwitcher';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export interface TSwitcherProps extends IFormCompProps {
|
|
2
|
+
onClick?: (isChecked: boolean) => void;
|
|
3
|
+
className?: string;
|
|
4
|
+
disabled?: boolean;
|
|
5
|
+
selectedValue?: boolean;
|
|
6
|
+
size?: 'large' | 'small';
|
|
7
|
+
inlineType?: boolean;
|
|
8
|
+
id?: string;
|
|
9
|
+
label?: string;
|
|
10
|
+
labelAddons?: React.ReactElement;
|
|
11
|
+
orientation?: 'left' | 'right';
|
|
12
|
+
hasSpaceBetween?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export declare enum ThemeMode {
|
|
15
|
+
Light = "light",
|
|
16
|
+
Dark = "dark"
|
|
17
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import classNames from 'classnames';
|
|
3
|
+
const IconMoon = ({ size, type, className = '', onClick, refHandler, id, dataId }) => (_jsx("svg", { xmlns: "http://www.w3.org/2000/svg", className: classNames('svg-icon', {
|
|
4
|
+
[`svg-icon__size-${size}`]: size,
|
|
5
|
+
[`svg-icon__type-${type}`]: type,
|
|
6
|
+
[className]: className
|
|
7
|
+
}), viewBox: "0 0 24 24", fill: "none", onClick: onClick, ref: refHandler, id: id, "data-id": dataId ? `${dataId}-svg-icon` : '', children: _jsx("path", { d: "M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z" }) }));
|
|
8
|
+
export default IconMoon;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import classNames from 'classnames';
|
|
3
|
+
const IconSun = ({ size, type, className = '', onClick, refHandler, id, dataId }) => (_jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", className: classNames('svg-icon', {
|
|
4
|
+
[`svg-icon__size-${size}`]: size,
|
|
5
|
+
[`svg-icon__type-${type}`]: type,
|
|
6
|
+
[className]: className
|
|
7
|
+
}), viewBox: "0 0 24 24", fill: "none", onClick: onClick, ref: refHandler, id: id, "data-id": dataId ? `${dataId}-svg-icon` : '', children: [_jsx("circle", { cx: "12", cy: "12", r: "5" }), " ", _jsx("line", { x1: "12", y1: "1", x2: "12", y2: "3" }), ' ', _jsx("line", { x1: "12", y1: "21", x2: "12", y2: "23" }), " ", _jsx("line", { x1: "4.22", y1: "4.22", x2: "5.64", y2: "5.64" }), ' ', _jsx("line", { x1: "18.36", y1: "18.36", x2: "19.78", y2: "19.78" }), " ", _jsx("line", { x1: "1", y1: "12", x2: "3", y2: "12" }), ' ', _jsx("line", { x1: "21", y1: "12", x2: "23", y2: "12" }), " ", _jsx("line", { x1: "4.22", y1: "19.78", x2: "5.64", y2: "18.36" }), ' ', _jsx("line", { x1: "18.36", y1: "5.64", x2: "19.78", y2: "4.22" })] }));
|
|
8
|
+
export default IconSun;
|