@sphereon/ui-components.ssi-react 0.4.1-next.99 → 0.4.1-unstable.123
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.
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { FC, ReactElement } from 'react';
|
|
2
|
+
type Props = {
|
|
3
|
+
label: string;
|
|
4
|
+
checked: boolean;
|
|
5
|
+
onChange: (checked: boolean) => void;
|
|
6
|
+
tooltip?: ReactElement | string;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
color?: string;
|
|
9
|
+
labelPosition?: 'left' | 'right';
|
|
10
|
+
};
|
|
11
|
+
declare const SSISwitchItem: FC<Props>;
|
|
12
|
+
export default SSISwitchItem;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import { Switch, Tooltip } from '@mui/material';
|
|
4
|
+
import { styled } from '@mui/material/styles';
|
|
5
|
+
import { parseColor } from '@sphereon/ui-components.core';
|
|
6
|
+
const createMaterialSwitch = (color) => styled(Switch)(({ theme }) => ({
|
|
7
|
+
width: 52,
|
|
8
|
+
height: 32,
|
|
9
|
+
padding: 0,
|
|
10
|
+
'& .MuiSwitch-switchBase': {
|
|
11
|
+
padding: 4,
|
|
12
|
+
transitionDuration: '300ms',
|
|
13
|
+
'&.Mui-checked': {
|
|
14
|
+
transform: 'translateX(20px)',
|
|
15
|
+
color: 'var(--color-grey-50)',
|
|
16
|
+
'& + .MuiSwitch-track': {
|
|
17
|
+
backgroundColor: parseColor(color),
|
|
18
|
+
opacity: 1,
|
|
19
|
+
border: 0,
|
|
20
|
+
},
|
|
21
|
+
'&.Mui-disabled + .MuiSwitch-track': {
|
|
22
|
+
opacity: 0.5,
|
|
23
|
+
},
|
|
24
|
+
'& .MuiSwitch-thumb:before': {
|
|
25
|
+
backgroundImage: `url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" height="16" width="16" viewBox="0 0 24 24"><path fill="${encodeURIComponent(parseColor(color))}" d="M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"/></svg>')`,
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
'&.Mui-focusVisible .MuiSwitch-thumb': {
|
|
29
|
+
color: parseColor(color),
|
|
30
|
+
border: '6px solid var(--color-grey-50)',
|
|
31
|
+
},
|
|
32
|
+
'&.Mui-disabled .MuiSwitch-thumb': {
|
|
33
|
+
color: theme.palette.grey[100],
|
|
34
|
+
},
|
|
35
|
+
'&.Mui-disabled + .MuiSwitch-track': {
|
|
36
|
+
opacity: 0.3,
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
'& .MuiSwitch-thumb': {
|
|
40
|
+
boxSizing: 'border-box',
|
|
41
|
+
width: 24,
|
|
42
|
+
height: 24,
|
|
43
|
+
'&:before': {
|
|
44
|
+
content: "''",
|
|
45
|
+
position: 'absolute',
|
|
46
|
+
width: '100%',
|
|
47
|
+
height: '100%',
|
|
48
|
+
left: 0,
|
|
49
|
+
top: 0,
|
|
50
|
+
backgroundRepeat: 'no-repeat',
|
|
51
|
+
backgroundPosition: 'center',
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
'& .MuiSwitch-track': {
|
|
55
|
+
borderRadius: 16,
|
|
56
|
+
backgroundColor: 'var(--color-grey-300)',
|
|
57
|
+
opacity: 1,
|
|
58
|
+
transition: theme.transitions.create(['background-color'], {
|
|
59
|
+
duration: 300,
|
|
60
|
+
}),
|
|
61
|
+
},
|
|
62
|
+
}));
|
|
63
|
+
const SSISwitchItem = (props) => {
|
|
64
|
+
const { label, checked, onChange, tooltip, disabled, labelPosition = false, color = 'var(--color-pending-500)' } = props;
|
|
65
|
+
const [showTooltip, setShowTooltip] = useState(false);
|
|
66
|
+
const MaterialSwitch = createMaterialSwitch(parseColor(color));
|
|
67
|
+
const handleChange = (event) => {
|
|
68
|
+
onChange(event.target.checked);
|
|
69
|
+
};
|
|
70
|
+
const containerStyle = {
|
|
71
|
+
display: 'flex',
|
|
72
|
+
flexDirection: 'row',
|
|
73
|
+
alignItems: 'center',
|
|
74
|
+
gap: '12px',
|
|
75
|
+
};
|
|
76
|
+
const labelStyle = {
|
|
77
|
+
fontSize: '14px',
|
|
78
|
+
fontWeight: 400,
|
|
79
|
+
color: 'var(--color-grey-800)',
|
|
80
|
+
letterSpacing: '0.14px',
|
|
81
|
+
};
|
|
82
|
+
const content = (_jsxs("div", { style: containerStyle, children: [(labelPosition === 'left' || !labelPosition) && _jsx("span", { style: labelStyle, children: label }), _jsx(MaterialSwitch, { checked: checked, onChange: handleChange, disabled: disabled }), labelPosition === 'right' && _jsx("span", { style: labelStyle, children: label })] }));
|
|
83
|
+
if (tooltip) {
|
|
84
|
+
return (_jsx(Tooltip, { title: tooltip, open: showTooltip, onOpen: () => setShowTooltip(true), onClose: () => setShowTooltip(false), arrow: true, children: _jsx("div", { onMouseEnter: () => setShowTooltip(true), onMouseLeave: () => setShowTooltip(false), children: content }) }));
|
|
85
|
+
}
|
|
86
|
+
return content;
|
|
87
|
+
};
|
|
88
|
+
export default SSISwitchItem;
|
package/dist/index.d.ts
CHANGED
|
@@ -61,6 +61,7 @@ import ActivityIcon from './components/assets/icons/Activity';
|
|
|
61
61
|
import ContactIcon from './components/assets/icons/Contact';
|
|
62
62
|
import BellIcon from './components/assets/icons/Bell';
|
|
63
63
|
import CredentialIcon from './components/assets/icons/Credential';
|
|
64
|
+
import SSISwitchItem from './components/buttons/SSISwitchItem';
|
|
64
65
|
import { Row } from '@tanstack/react-table';
|
|
65
66
|
import './styles/css/tailwind.css';
|
|
66
67
|
import './components/views/FormView/styles.css';
|
|
@@ -69,4 +70,4 @@ export * from './styles/fonts';
|
|
|
69
70
|
export * from './types';
|
|
70
71
|
export * from './helpers';
|
|
71
72
|
export * from './utils';
|
|
72
|
-
export { SSICredentialCardView, CredentialMiniCardView, CredentialMiniCardViewProps, SSIStatusLabel, SSICheckmarkBadge, SSIExclamationMarkBadge, SSIPlaceholderLogo, SSILogo, SSIAddIcon, SSIFilterIcon, SSIArrowDownIcon, SSITypeLabel, IconButton, PrimaryButton, SecondaryButton, DropDownList, SSITableView, SSITableViewHeader, SSITabView, SSITabViewHeader, SSIProfileIcon, SSIToastContainer, SSICheckbox, SSIActivityIndicator, SSIHoverText, StepMarker, ProgressStepIndicator, PaginationControls, PaginationControlsProps, Row, DocumentIcon, CrossIcon, ImageIcon, MeatBallsIcon, PencilIcon, ViewIcon, CopyIcon, DeleteIcon, FileSelection, ComboBox, DragAndDropBox, PersonPlaceholder, PassportPhotoControl, passportPhotoControlTester, CustomArrayControl, customArrayControlTester, ColorPickerControl, colorPickerControlTester, CredentialIssuanceWizardView, CredentialViewItem, JSONDataView, TextInputField, WarningImage, FormView, InformationRequestView, ContactViewItem, CapitolIcon, ChevronIcon, ManIcon, LaptopIcon, StoreIcon, RoleIconView, RoleViewItem, Listbox, ActivityIcon, ContactIcon, BellIcon, CredentialIcon, getFormViewAjv };
|
|
73
|
+
export { SSICredentialCardView, CredentialMiniCardView, CredentialMiniCardViewProps, SSIStatusLabel, SSICheckmarkBadge, SSIExclamationMarkBadge, SSIPlaceholderLogo, SSILogo, SSIAddIcon, SSIFilterIcon, SSIArrowDownIcon, SSITypeLabel, IconButton, PrimaryButton, SecondaryButton, DropDownList, SSITableView, SSITableViewHeader, SSITabView, SSITabViewHeader, SSIProfileIcon, SSIToastContainer, SSICheckbox, SSIActivityIndicator, SSIHoverText, StepMarker, ProgressStepIndicator, PaginationControls, PaginationControlsProps, Row, DocumentIcon, CrossIcon, ImageIcon, MeatBallsIcon, PencilIcon, ViewIcon, CopyIcon, DeleteIcon, FileSelection, ComboBox, DragAndDropBox, PersonPlaceholder, PassportPhotoControl, passportPhotoControlTester, CustomArrayControl, customArrayControlTester, ColorPickerControl, colorPickerControlTester, CredentialIssuanceWizardView, CredentialViewItem, JSONDataView, TextInputField, WarningImage, FormView, InformationRequestView, ContactViewItem, CapitolIcon, ChevronIcon, ManIcon, LaptopIcon, StoreIcon, RoleIconView, RoleViewItem, Listbox, ActivityIcon, ContactIcon, BellIcon, CredentialIcon, SSISwitchItem, getFormViewAjv };
|
package/dist/index.js
CHANGED
|
@@ -61,6 +61,7 @@ import ActivityIcon from './components/assets/icons/Activity';
|
|
|
61
61
|
import ContactIcon from './components/assets/icons/Contact';
|
|
62
62
|
import BellIcon from './components/assets/icons/Bell';
|
|
63
63
|
import CredentialIcon from './components/assets/icons/Credential';
|
|
64
|
+
import SSISwitchItem from './components/buttons/SSISwitchItem';
|
|
64
65
|
import './styles/css/tailwind.css';
|
|
65
66
|
import './components/views/FormView/styles.css';
|
|
66
67
|
import '@sphereon/ui-components.core/dist/styles/tokens.css';
|
|
@@ -68,4 +69,4 @@ export * from './styles/fonts';
|
|
|
68
69
|
export * from './types';
|
|
69
70
|
export * from './helpers';
|
|
70
71
|
export * from './utils';
|
|
71
|
-
export { SSICredentialCardView, CredentialMiniCardView, SSIStatusLabel, SSICheckmarkBadge, SSIExclamationMarkBadge, SSIPlaceholderLogo, SSILogo, SSIAddIcon, SSIFilterIcon, SSIArrowDownIcon, SSITypeLabel, IconButton, PrimaryButton, SecondaryButton, DropDownList, SSITableView, SSITableViewHeader, SSITabView, SSITabViewHeader, SSIProfileIcon, SSIToastContainer, SSICheckbox, SSIActivityIndicator, SSIHoverText, StepMarker, ProgressStepIndicator, PaginationControls, PaginationControlsProps, DocumentIcon, CrossIcon, ImageIcon, MeatBallsIcon, PencilIcon, ViewIcon, CopyIcon, DeleteIcon, FileSelection, ComboBox, DragAndDropBox, PersonPlaceholder, PassportPhotoControl, passportPhotoControlTester, CustomArrayControl, customArrayControlTester, ColorPickerControl, colorPickerControlTester, CredentialIssuanceWizardView, CredentialViewItem, JSONDataView, TextInputField, WarningImage, FormView, InformationRequestView, ContactViewItem, CapitolIcon, ChevronIcon, ManIcon, LaptopIcon, StoreIcon, RoleIconView, RoleViewItem, Listbox, ActivityIcon, ContactIcon, BellIcon, CredentialIcon, getFormViewAjv };
|
|
72
|
+
export { SSICredentialCardView, CredentialMiniCardView, SSIStatusLabel, SSICheckmarkBadge, SSIExclamationMarkBadge, SSIPlaceholderLogo, SSILogo, SSIAddIcon, SSIFilterIcon, SSIArrowDownIcon, SSITypeLabel, IconButton, PrimaryButton, SecondaryButton, DropDownList, SSITableView, SSITableViewHeader, SSITabView, SSITabViewHeader, SSIProfileIcon, SSIToastContainer, SSICheckbox, SSIActivityIndicator, SSIHoverText, StepMarker, ProgressStepIndicator, PaginationControls, PaginationControlsProps, DocumentIcon, CrossIcon, ImageIcon, MeatBallsIcon, PencilIcon, ViewIcon, CopyIcon, DeleteIcon, FileSelection, ComboBox, DragAndDropBox, PersonPlaceholder, PassportPhotoControl, passportPhotoControlTester, CustomArrayControl, customArrayControlTester, ColorPickerControl, colorPickerControlTester, CredentialIssuanceWizardView, CredentialViewItem, JSONDataView, TextInputField, WarningImage, FormView, InformationRequestView, ContactViewItem, CapitolIcon, ChevronIcon, ManIcon, LaptopIcon, StoreIcon, RoleIconView, RoleViewItem, Listbox, ActivityIcon, ContactIcon, BellIcon, CredentialIcon, SSISwitchItem, getFormViewAjv };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sphereon/ui-components.ssi-react",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.4.1-
|
|
4
|
+
"version": "0.4.1-unstable.123+89813a0",
|
|
5
5
|
"description": "SSI UI components for React",
|
|
6
6
|
"repository": "git@github.com:Sphereon-Opensource/UI-Components.git",
|
|
7
7
|
"author": "Sphereon <dev@sphereon.com>",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"@mui/x-date-pickers": "^8.18.0",
|
|
51
51
|
"@sphereon/ssi-sdk.data-store": "0.34.1-feature.SSISDK.45.94",
|
|
52
52
|
"@sphereon/ssi-types": "0.34.1-feature.SSISDK.45.94",
|
|
53
|
-
"@sphereon/ui-components.core": "0.4.1-
|
|
53
|
+
"@sphereon/ui-components.core": "0.4.1-unstable.123+89813a0",
|
|
54
54
|
"@tanstack/react-table": "^8.9.3",
|
|
55
55
|
"ajv": "^8.17.1",
|
|
56
56
|
"ajv-formats": "^3.0.1",
|
|
@@ -72,5 +72,5 @@
|
|
|
72
72
|
"peerDependencies": {
|
|
73
73
|
"react": ">= 18"
|
|
74
74
|
},
|
|
75
|
-
"gitHead": "
|
|
75
|
+
"gitHead": "89813a09c16fe20469c677065467851c696fb9c7"
|
|
76
76
|
}
|