@idealyst/components 1.2.100 → 1.2.102
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@idealyst/components",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.102",
|
|
4
4
|
"description": "Shared component library for React and React Native",
|
|
5
5
|
"documentation": "https://github.com/IdealystIO/idealyst-framework/tree/main/packages/components#readme",
|
|
6
6
|
"readme": "README.md",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"publish:npm": "npm publish"
|
|
57
57
|
},
|
|
58
58
|
"peerDependencies": {
|
|
59
|
-
"@idealyst/theme": "^1.2.
|
|
59
|
+
"@idealyst/theme": "^1.2.102",
|
|
60
60
|
"@mdi/js": ">=7.0.0",
|
|
61
61
|
"@mdi/react": ">=1.0.0",
|
|
62
62
|
"@react-native-vector-icons/common": ">=12.0.0",
|
|
@@ -107,8 +107,8 @@
|
|
|
107
107
|
},
|
|
108
108
|
"devDependencies": {
|
|
109
109
|
"@idealyst/blur": "^1.2.40",
|
|
110
|
-
"@idealyst/theme": "^1.2.
|
|
111
|
-
"@idealyst/tooling": "^1.2.
|
|
110
|
+
"@idealyst/theme": "^1.2.102",
|
|
111
|
+
"@idealyst/tooling": "^1.2.102",
|
|
112
112
|
"@mdi/react": "^1.6.1",
|
|
113
113
|
"@types/react": "^19.1.0",
|
|
114
114
|
"react": "^19.1.0",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useState, useEffect, forwardRef, useMemo } from 'react';
|
|
1
|
+
import { useState, useEffect, forwardRef, useMemo, memo } from 'react';
|
|
2
2
|
import { View, Text, Pressable } from 'react-native';
|
|
3
3
|
import MaterialDesignIcons from '@react-native-vector-icons/material-design-icons';
|
|
4
4
|
import { CheckboxProps } from './types';
|
|
@@ -6,6 +6,28 @@ import { checkboxStyles } from './Checkbox.styles';
|
|
|
6
6
|
import { getNativeSelectionAccessibilityProps } from '../utils/accessibility';
|
|
7
7
|
import type { IdealystElement } from '../utils/refTypes';
|
|
8
8
|
|
|
9
|
+
/**
|
|
10
|
+
* Isolated checkmark icon component.
|
|
11
|
+
* Uses the resolved checkmark style as the single source of truth for sizing,
|
|
12
|
+
* reducing rerenders on the parent Checkbox component.
|
|
13
|
+
*/
|
|
14
|
+
const CheckmarkIcon = memo(({ indeterminate, checked }: { indeterminate: boolean; checked: boolean }) => {
|
|
15
|
+
const checkmarkStyle = (checkboxStyles.checkmark as any)({ checked });
|
|
16
|
+
const iconSize = (typeof checkmarkStyle?.width === 'number' ? checkmarkStyle.width : 14);
|
|
17
|
+
|
|
18
|
+
return (
|
|
19
|
+
<View style={checkmarkStyle}>
|
|
20
|
+
<MaterialDesignIcons
|
|
21
|
+
name={indeterminate ? 'minus' : 'check'}
|
|
22
|
+
size={iconSize}
|
|
23
|
+
color="#ffffff"
|
|
24
|
+
/>
|
|
25
|
+
</View>
|
|
26
|
+
);
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
CheckmarkIcon.displayName = 'CheckmarkIcon';
|
|
30
|
+
|
|
9
31
|
const Checkbox = forwardRef<IdealystElement, CheckboxProps>(({
|
|
10
32
|
checked = false,
|
|
11
33
|
indeterminate = false,
|
|
@@ -105,7 +127,6 @@ const Checkbox = forwardRef<IdealystElement, CheckboxProps>(({
|
|
|
105
127
|
const wrapperStyle = (checkboxStyles.wrapper as any)({});
|
|
106
128
|
const containerStyle = (checkboxStyles.container as any)({});
|
|
107
129
|
const checkboxStyle = (checkboxStyles.checkbox as any)({ intent, checked: internalChecked, disabled, type: variant });
|
|
108
|
-
const checkmarkStyle = (checkboxStyles.checkmark as any)({ checked: internalChecked });
|
|
109
130
|
const labelStyle = (checkboxStyles.label as any)({ disabled });
|
|
110
131
|
const helperTextStyle = (checkboxStyles.helperText as any)({ error: !!error });
|
|
111
132
|
|
|
@@ -120,12 +141,7 @@ const Checkbox = forwardRef<IdealystElement, CheckboxProps>(({
|
|
|
120
141
|
>
|
|
121
142
|
<View style={checkboxStyle}>
|
|
122
143
|
{(internalChecked || indeterminate) && (
|
|
123
|
-
<
|
|
124
|
-
name={indeterminate ? 'minus' : 'check'}
|
|
125
|
-
size={14}
|
|
126
|
-
color="#ffffff"
|
|
127
|
-
style={checkmarkStyle}
|
|
128
|
-
/>
|
|
144
|
+
<CheckmarkIcon indeterminate={indeterminate} checked={internalChecked} />
|
|
129
145
|
)}
|
|
130
146
|
</View>
|
|
131
147
|
{labelContent && (
|