uibee 2.16.5 → 2.16.7
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/index.d.ts +1 -1
- package/dist/src/components/index.js +1 -1
- package/dist/src/components/inputs/toggle.js +12 -0
- package/package.json +1 -1
- package/src/components/inputs/toggle.tsx +1 -1
- package/dist/src/components/layout/toggle.js +0 -12
- /package/dist/src/components/{layout → inputs}/toggle.d.ts +0 -0
|
@@ -27,4 +27,4 @@ export { default as Pagination } from './table/pagination';
|
|
|
27
27
|
export { default as MarkdownRender } from './markdownrender/markdownRender';
|
|
28
28
|
export { default as ConfirmPopup } from './confirm/confirmPopup';
|
|
29
29
|
export { default as SeverityPill } from './vulnerability/severityPill';
|
|
30
|
-
export { default as Toggle } from './
|
|
30
|
+
export { default as Toggle } from './inputs/toggle';
|
|
@@ -41,4 +41,4 @@ export { default as ConfirmPopup } from './confirm/confirmPopup';
|
|
|
41
41
|
// Vulnerability
|
|
42
42
|
export { default as SeverityPill } from './vulnerability/severityPill';
|
|
43
43
|
// Layout
|
|
44
|
-
export { default as Toggle } from './
|
|
44
|
+
export { default as Toggle } from './inputs/toggle';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
export default function Toggle({ value, onChange, left, right, }) {
|
|
3
|
+
const active = 'bg-login-200 text-login-950 shadow';
|
|
4
|
+
const idle = 'text-login-200 hover:bg-login-50/10 hover:text-login-50';
|
|
5
|
+
const base = 'flex items-center justify-center rounded-lg transition gap-1';
|
|
6
|
+
function renderContent(opt) {
|
|
7
|
+
return (_jsxs(_Fragment, { children: [opt.icon, opt.text && _jsx("span", { children: opt.text })] }));
|
|
8
|
+
}
|
|
9
|
+
const isLeftActive = value === left.value;
|
|
10
|
+
const isRightActive = value === right.value;
|
|
11
|
+
return (_jsxs("div", { className: 'flex items-center border rounded-lg border-login-100/10 bg-login-50/5 p-1', children: [_jsx("button", { type: 'button', onClick: () => onChange(left.value), "aria-label": left.label ?? left.text, "aria-pressed": isLeftActive, className: `${base} px-2 h-7 ${isLeftActive ? active : idle}`, children: renderContent(left) }), _jsx("button", { type: 'button', onClick: () => onChange(right.value), "aria-label": right.label ?? right.text, "aria-pressed": isRightActive, className: `${base} px-2 h-7 ${isRightActive ? active : idle}`, children: renderContent(right) })] }));
|
|
12
|
+
}
|
package/package.json
CHANGED
|
@@ -35,7 +35,7 @@ export default function Toggle<T>({
|
|
|
35
35
|
const isRightActive = value === right.value
|
|
36
36
|
|
|
37
37
|
return (
|
|
38
|
-
<div className='flex items-center border border-login-100/10 bg-login-50/5 p-1'>
|
|
38
|
+
<div className='flex items-center border rounded-lg border-login-100/10 bg-login-50/5 p-1'>
|
|
39
39
|
<button
|
|
40
40
|
type='button'
|
|
41
41
|
onClick={() => onChange(left.value)}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
export default function Toggle({ value, onChange, left, right, }) {
|
|
3
|
-
const active = 'bg-login-200 text-login-950 shadow';
|
|
4
|
-
const idle = 'text-login-200 hover:bg-login-50/10 hover:text-login-50';
|
|
5
|
-
const base = 'flex items-center justify-center rounded-full transition gap-1';
|
|
6
|
-
function renderContent(opt) {
|
|
7
|
-
return (_jsxs(_Fragment, { children: [opt.icon, opt.text && _jsx("span", { children: opt.text })] }));
|
|
8
|
-
}
|
|
9
|
-
const isLeftActive = value === left.value;
|
|
10
|
-
const isRightActive = value === right.value;
|
|
11
|
-
return (_jsxs("div", { className: 'flex items-center rounded-full border border-login-100/10 bg-login-50/5 p-1', children: [_jsx("button", { type: 'button', onClick: () => onChange(left.value), "aria-label": left.label ?? left.text, "aria-pressed": isLeftActive, className: `${base} px-2 h-7 ${isLeftActive ? active : idle}`, children: renderContent(left) }), _jsx("button", { type: 'button', onClick: () => onChange(right.value), "aria-label": right.label ?? right.text, "aria-pressed": isRightActive, className: `${base} px-2 h-7 ${isRightActive ? active : idle}`, children: renderContent(right) })] }));
|
|
12
|
-
}
|
|
File without changes
|