uibee 2.7.11 → 2.7.13
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/dist/src/components/inputs/shared/selectionWrapper.d.ts +2 -1
- package/dist/src/components/inputs/shared/selectionWrapper.js +2 -2
- package/dist/src/components/inputs/switch.d.ts +2 -1
- package/dist/src/components/inputs/switch.js +3 -3
- package/dist/src/globals.css +9 -6
- package/package.json +1 -1
- package/src/components/inputs/shared/selectionWrapper.tsx +3 -1
- package/src/components/inputs/switch.tsx +5 -2
|
@@ -8,6 +8,7 @@ interface SelectionWrapperProps {
|
|
|
8
8
|
children: ReactNode;
|
|
9
9
|
className?: string;
|
|
10
10
|
disabled?: boolean;
|
|
11
|
+
hideError?: boolean;
|
|
11
12
|
}
|
|
12
|
-
export default function SelectionWrapper({ label, name, required, info, error, children, className, disabled, }: SelectionWrapperProps): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export default function SelectionWrapper({ label, name, required, info, error, children, className, disabled, hideError, }: SelectionWrapperProps): import("react/jsx-runtime").JSX.Element;
|
|
13
14
|
export {};
|
|
@@ -2,6 +2,6 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import InputLabel from './inputLabel';
|
|
3
3
|
import InputInfo from './inputInfo';
|
|
4
4
|
import InputError from './inputError';
|
|
5
|
-
export default function SelectionWrapper({ label, name, required, info, error, children, className, disabled, }) {
|
|
6
|
-
return (_jsxs("div", { className: `flex flex-col gap-1 ${className || ''}`, children: [_jsxs("div", { className: 'flex items-center justify-between mb-1', children: [_jsxs("div", { className: 'flex items-center gap-2', children: [children, label && (_jsx(InputLabel, { label: label, name: name, required: required, disabled: disabled, className: 'select-none cursor-pointer' }))] }), info && _jsx(InputInfo, { info: info })] }), _jsx(InputError, { error: error })] }));
|
|
5
|
+
export default function SelectionWrapper({ label, name, required, info, error, children, className, disabled, hideError, }) {
|
|
6
|
+
return (_jsxs("div", { className: `flex flex-col gap-1 ${className || ''}`, children: [_jsxs("div", { className: 'flex items-center justify-between mb-1', children: [_jsxs("div", { className: 'flex items-center gap-2', children: [children, label && (_jsx(InputLabel, { label: label, name: name, required: required, disabled: disabled, className: 'select-none cursor-pointer' }))] }), info && _jsx(InputInfo, { info: info })] }), !hideError && _jsx(InputError, { error: error })] }));
|
|
7
7
|
}
|
|
@@ -9,5 +9,6 @@ export type SwitchProps = {
|
|
|
9
9
|
error?: string;
|
|
10
10
|
info?: string;
|
|
11
11
|
required?: boolean;
|
|
12
|
+
switchOnly?: boolean;
|
|
12
13
|
};
|
|
13
|
-
export default function Switch({ label, name, checked, onChange, className, disabled, error, info, required, }: SwitchProps): import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export default function Switch({ label, name, checked, onChange, className, disabled, error, info, required, switchOnly, }: SwitchProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { SelectionWrapper } from './shared';
|
|
3
|
-
export default function Switch({ label, name, checked, onChange, className, disabled, error, info, required, }) {
|
|
4
|
-
return (_jsx(SelectionWrapper, { label: label, name: name, required: required, info: info, error: error, className: className, disabled: disabled, children: _jsxs("label", { className:
|
|
3
|
+
export default function Switch({ label, name, checked, onChange, className, disabled, error, info, required, switchOnly, }) {
|
|
4
|
+
return (_jsx(SelectionWrapper, { label: label, name: name, required: required, info: info, error: error, hideError: switchOnly, className: className, disabled: disabled, children: _jsxs("label", { className: `relative inline-flex items-center cursor-pointer ${switchOnly ? 'h-fit' : 'h-10.5'}`, children: [_jsx("input", { type: 'checkbox', id: name, name: name, checked: checked, onChange: onChange, disabled: disabled, required: required, className: 'sr-only peer' }), _jsx("div", { className: `
|
|
5
5
|
w-11 h-6 bg-login-500/50 rounded-full peer
|
|
6
6
|
peer-checked:after:translate-x-full peer-checked:after:border-white
|
|
7
|
-
after:content-[''] after:absolute
|
|
7
|
+
after:content-[''] after:absolute ${switchOnly ? 'top-0.5' : 'top-2.75'} after:left-0.5
|
|
8
8
|
after:bg-white after:border-gray-300 after:border after:rounded-full
|
|
9
9
|
after:h-5 after:w-5 after:transition-all peer-checked:bg-login
|
|
10
10
|
${disabled ? 'opacity-50 cursor-not-allowed' : ''}
|
package/dist/src/globals.css
CHANGED
|
@@ -297,12 +297,18 @@
|
|
|
297
297
|
.top-0 {
|
|
298
298
|
top: calc(var(--spacing) * 0);
|
|
299
299
|
}
|
|
300
|
+
.top-0\.5 {
|
|
301
|
+
top: calc(var(--spacing) * 0.5);
|
|
302
|
+
}
|
|
300
303
|
.top-1\/2 {
|
|
301
304
|
top: calc(1/2 * 100%);
|
|
302
305
|
}
|
|
303
306
|
.top-2 {
|
|
304
307
|
top: calc(var(--spacing) * 2);
|
|
305
308
|
}
|
|
309
|
+
.top-2\.75 {
|
|
310
|
+
top: calc(var(--spacing) * 2.75);
|
|
311
|
+
}
|
|
306
312
|
.top-4 {
|
|
307
313
|
top: calc(var(--spacing) * 4);
|
|
308
314
|
}
|
|
@@ -1084,6 +1090,9 @@
|
|
|
1084
1090
|
.h-16 {
|
|
1085
1091
|
height: calc(var(--spacing) * 16);
|
|
1086
1092
|
}
|
|
1093
|
+
.h-fit {
|
|
1094
|
+
height: fit-content;
|
|
1095
|
+
}
|
|
1087
1096
|
.h-full {
|
|
1088
1097
|
height: 100%;
|
|
1089
1098
|
}
|
|
@@ -1873,12 +1882,6 @@
|
|
|
1873
1882
|
position: absolute;
|
|
1874
1883
|
}
|
|
1875
1884
|
}
|
|
1876
|
-
.after\:top-2\.75 {
|
|
1877
|
-
&::after {
|
|
1878
|
-
content: var(--tw-content);
|
|
1879
|
-
top: calc(var(--spacing) * 2.75);
|
|
1880
|
-
}
|
|
1881
|
-
}
|
|
1882
1885
|
.after\:left-0\.5 {
|
|
1883
1886
|
&::after {
|
|
1884
1887
|
content: var(--tw-content);
|
package/package.json
CHANGED
|
@@ -12,6 +12,7 @@ interface SelectionWrapperProps {
|
|
|
12
12
|
children: ReactNode
|
|
13
13
|
className?: string
|
|
14
14
|
disabled?: boolean
|
|
15
|
+
hideError?: boolean
|
|
15
16
|
}
|
|
16
17
|
|
|
17
18
|
export default function SelectionWrapper({
|
|
@@ -23,6 +24,7 @@ export default function SelectionWrapper({
|
|
|
23
24
|
children,
|
|
24
25
|
className,
|
|
25
26
|
disabled,
|
|
27
|
+
hideError,
|
|
26
28
|
}: SelectionWrapperProps) {
|
|
27
29
|
return (
|
|
28
30
|
<div className={`flex flex-col gap-1 ${className || ''}`}>
|
|
@@ -41,7 +43,7 @@ export default function SelectionWrapper({
|
|
|
41
43
|
</div>
|
|
42
44
|
{info && <InputInfo info={info} />}
|
|
43
45
|
</div>
|
|
44
|
-
<InputError error={error} />
|
|
46
|
+
{!hideError && <InputError error={error} />}
|
|
45
47
|
</div>
|
|
46
48
|
)
|
|
47
49
|
}
|
|
@@ -11,6 +11,7 @@ export type SwitchProps = {
|
|
|
11
11
|
error?: string
|
|
12
12
|
info?: string
|
|
13
13
|
required?: boolean
|
|
14
|
+
switchOnly?: boolean
|
|
14
15
|
}
|
|
15
16
|
|
|
16
17
|
export default function Switch({
|
|
@@ -23,6 +24,7 @@ export default function Switch({
|
|
|
23
24
|
error,
|
|
24
25
|
info,
|
|
25
26
|
required,
|
|
27
|
+
switchOnly,
|
|
26
28
|
}: SwitchProps) {
|
|
27
29
|
return (
|
|
28
30
|
<SelectionWrapper
|
|
@@ -31,10 +33,11 @@ export default function Switch({
|
|
|
31
33
|
required={required}
|
|
32
34
|
info={info}
|
|
33
35
|
error={error}
|
|
36
|
+
hideError={switchOnly}
|
|
34
37
|
className={className}
|
|
35
38
|
disabled={disabled}
|
|
36
39
|
>
|
|
37
|
-
<label className=
|
|
40
|
+
<label className={`relative inline-flex items-center cursor-pointer ${switchOnly ? 'h-fit' : 'h-10.5'}`}>
|
|
38
41
|
<input
|
|
39
42
|
type='checkbox'
|
|
40
43
|
id={name}
|
|
@@ -48,7 +51,7 @@ export default function Switch({
|
|
|
48
51
|
<div className={`
|
|
49
52
|
w-11 h-6 bg-login-500/50 rounded-full peer
|
|
50
53
|
peer-checked:after:translate-x-full peer-checked:after:border-white
|
|
51
|
-
after:content-[''] after:absolute
|
|
54
|
+
after:content-[''] after:absolute ${switchOnly ? 'top-0.5' : 'top-2.75'} after:left-0.5
|
|
52
55
|
after:bg-white after:border-gray-300 after:border after:rounded-full
|
|
53
56
|
after:h-5 after:w-5 after:transition-all peer-checked:bg-login
|
|
54
57
|
${disabled ? 'opacity-50 cursor-not-allowed' : ''}
|