@sphereon/ui-components.ssi-react 0.1.3-unstable.15 → 0.1.3-unstable.19

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,15 @@
1
+ import { FC, ReactNode } from 'react';
2
+ export interface IProps {
3
+ onValueChange?: (isChecked: boolean) => Promise<void>;
4
+ initialValue?: boolean;
5
+ isChecked?: boolean;
6
+ label?: string | ReactNode;
7
+ disabled?: boolean;
8
+ backgroundColor?: string;
9
+ borderColor?: string;
10
+ selectedColor?: string;
11
+ labelColor?: string;
12
+ checkmarkColor?: string;
13
+ }
14
+ declare const SSICheckbox: FC<IProps>;
15
+ export default SSICheckbox;
@@ -0,0 +1,24 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import React from 'react';
3
+ import { OpacityStyleEnum, fontColors, selectionElements } from '@sphereon/ui-components.core';
4
+ import { SSICheckboxContainerStyled as Container, SSICheckboxLabelContainerStyled as LabelCaption, SSICheckboxSelectedContainerStyled as SelectedContainer, SSICheckboxUnselectedContainerStyled as UnselectedContainer, } from '../../../styles/components';
5
+ const SSICheckbox = (props) => {
6
+ const { backgroundColor, borderColor = selectionElements.primaryBorderDark, disabled = false, initialValue = false, label, selectedColor = selectionElements.primaryDark, labelColor = fontColors.light, checkmarkColor = fontColors.dark } = props;
7
+ const [isChecked, setChecked] = React.useState(initialValue);
8
+ const value = props.isChecked !== undefined ? props.isChecked : isChecked;
9
+ const onValueChange = async () => {
10
+ const { onValueChange } = props;
11
+ if (disabled) {
12
+ return;
13
+ }
14
+ if (onValueChange) {
15
+ await onValueChange(!isChecked);
16
+ }
17
+ setChecked(!isChecked);
18
+ };
19
+ return (_jsxs(Container, { onClick: onValueChange, style: { ...(disabled && { opacity: OpacityStyleEnum.DISABLED }) }, children: [value ? (_jsx(SelectedContainer, { style: { backgroundColor: selectedColor, border: `1px solid ${borderColor}` } })) : (_jsx(UnselectedContainer, { style: { backgroundColor, border: `1px solid ${borderColor}` } })), label &&
20
+ (typeof label === 'string'
21
+ ? _jsx(LabelCaption, { style: { color: labelColor }, children: label })
22
+ : label)] }));
23
+ };
24
+ export default SSICheckbox;
package/dist/index.d.ts CHANGED
@@ -18,6 +18,7 @@ import SSITabView from './components/views/SSITabView';
18
18
  import SSITabViewHeader from './components/views/SSITabView/SSITabViewHeader';
19
19
  import SSIProfileIcon from './components/assets/icons/SSIProfileIcon';
20
20
  import SSISecondaryButton from './components/buttons/SSISecondaryButton';
21
+ import SSICheckbox from './components/fields/SSICheckbox';
21
22
  export * from './types';
22
23
  export * from './styles/components/fonts';
23
- export { SSICredentialCardView, SSICredentialMiniCardView, SSIStatusLabel, SSICheckmarkBadge, SSIExclamationMarkBadge, SSIPlaceholderLogo, SSILogo, SSIAddIcon, SSIFilterIcon, SSIArrowDownIcon, SSITypeLabel, SSIIconButton, SSIPrimaryButton, SSISecondaryButton, SSIDropDownList, SSITableView, SSITableViewHeader, SSITabView, SSITabViewHeader, SSIProfileIcon, };
24
+ export { SSICredentialCardView, SSICredentialMiniCardView, SSIStatusLabel, SSICheckmarkBadge, SSIExclamationMarkBadge, SSIPlaceholderLogo, SSILogo, SSIAddIcon, SSIFilterIcon, SSIArrowDownIcon, SSITypeLabel, SSIIconButton, SSIPrimaryButton, SSISecondaryButton, SSIDropDownList, SSITableView, SSITableViewHeader, SSITabView, SSITabViewHeader, SSIProfileIcon, SSICheckbox };
package/dist/index.js CHANGED
@@ -18,6 +18,7 @@ import SSITabView from './components/views/SSITabView';
18
18
  import SSITabViewHeader from './components/views/SSITabView/SSITabViewHeader';
19
19
  import SSIProfileIcon from './components/assets/icons/SSIProfileIcon';
20
20
  import SSISecondaryButton from './components/buttons/SSISecondaryButton';
21
+ import SSICheckbox from './components/fields/SSICheckbox';
21
22
  export * from './types';
22
23
  export * from './styles/components/fonts';
23
- export { SSICredentialCardView, SSICredentialMiniCardView, SSIStatusLabel, SSICheckmarkBadge, SSIExclamationMarkBadge, SSIPlaceholderLogo, SSILogo, SSIAddIcon, SSIFilterIcon, SSIArrowDownIcon, SSITypeLabel, SSIIconButton, SSIPrimaryButton, SSISecondaryButton, SSIDropDownList, SSITableView, SSITableViewHeader, SSITabView, SSITabViewHeader, SSIProfileIcon, };
24
+ export { SSICredentialCardView, SSICredentialMiniCardView, SSIStatusLabel, SSICheckmarkBadge, SSIExclamationMarkBadge, SSIPlaceholderLogo, SSILogo, SSIAddIcon, SSIFilterIcon, SSIArrowDownIcon, SSITypeLabel, SSIIconButton, SSIPrimaryButton, SSISecondaryButton, SSIDropDownList, SSITableView, SSITableViewHeader, SSITabView, SSITabViewHeader, SSIProfileIcon, SSICheckbox };
@@ -0,0 +1,4 @@
1
+ export declare const SSICheckboxContainerStyled: import("styled-components").StyledComponent<"div", any, {}, never>;
2
+ export declare const SSICheckboxUnselectedContainerStyled: import("styled-components").StyledComponent<"div", any, {}, never>;
3
+ export declare const SSICheckboxSelectedContainerStyled: import("styled-components").StyledComponent<"div", any, {}, never>;
4
+ export declare const SSICheckboxLabelContainerStyled: import("styled-components").StyledComponent<"span", any, {}, never>;
@@ -0,0 +1,25 @@
1
+ import styled from 'styled-components';
2
+ import { SSITextH4LightStyled } from '../../fonts';
3
+ import { SSIFlexDirectionRowViewStyled } from '../../containers';
4
+ export const SSICheckboxContainerStyled = styled(SSIFlexDirectionRowViewStyled) `
5
+ align-items: center;
6
+ gap: 10px;
7
+ cursor: pointer;
8
+ `;
9
+ export const SSICheckboxUnselectedContainerStyled = styled.div `
10
+ width: 18px;
11
+ aspect-ratio: 1;
12
+ border-radius: 4px;
13
+ border-width: 1px;
14
+ `;
15
+ export const SSICheckboxSelectedContainerStyled = styled.div `
16
+ width: 18px;
17
+ aspect-ratio: 1;
18
+ border-radius: 4px;
19
+ align-items: center;
20
+ justify-content: center;
21
+ `;
22
+ export const SSICheckboxLabelContainerStyled = styled(SSITextH4LightStyled) `
23
+ display: flex;
24
+ flex-wrap: wrap;
25
+ `;
@@ -10,3 +10,4 @@ export * from './SSITableViewHeader';
10
10
  export * from './SSITableView';
11
11
  export * from './SSITabViewHeader';
12
12
  export * from './SSITabView';
13
+ export * from './SSICheckbox';
@@ -10,3 +10,4 @@ export * from './SSITableViewHeader';
10
10
  export * from './SSITableView';
11
11
  export * from './SSITabViewHeader';
12
12
  export * from './SSITabView';
13
+ export * from './SSICheckbox';
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.1.3-unstable.15+88a373a",
4
+ "version": "0.1.3-unstable.19+6852c02",
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>",
@@ -28,7 +28,7 @@
28
28
  "access": "public"
29
29
  },
30
30
  "dependencies": {
31
- "@sphereon/ui-components.core": "0.1.3-unstable.15+88a373a",
31
+ "@sphereon/ui-components.core": "0.1.3-unstable.19+6852c02",
32
32
  "@tanstack/react-table": "^8.9.3",
33
33
  "styled-components": "^5.3.3"
34
34
  },
@@ -40,5 +40,5 @@
40
40
  "peerDependencies": {
41
41
  "react": ">= 16.8.0"
42
42
  },
43
- "gitHead": "88a373a5f9fb7b863e412030eedc651350c99187"
43
+ "gitHead": "6852c02ac31e72b4556a910238bec3fd785532ea"
44
44
  }