@idealyst/components 1.2.35 → 1.2.36

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.35",
3
+ "version": "1.2.36",
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.35",
59
+ "@idealyst/theme": "^1.2.36",
60
60
  "@mdi/js": ">=7.0.0",
61
61
  "@mdi/react": ">=1.0.0",
62
62
  "@react-native-vector-icons/common": ">=12.0.0",
@@ -106,7 +106,7 @@
106
106
  }
107
107
  },
108
108
  "devDependencies": {
109
- "@idealyst/theme": "^1.2.35",
109
+ "@idealyst/theme": "^1.2.36",
110
110
  "@idealyst/tooling": "^1.2.30",
111
111
  "@mdi/react": "^1.6.1",
112
112
  "@types/react": "^19.1.0",
package/src/Card/types.ts CHANGED
@@ -1,8 +1,9 @@
1
1
  import { Intent, Size } from '@idealyst/theme';
2
2
  import type { ReactNode } from 'react';
3
- import type { StyleProp, ViewStyle, LayoutChangeEvent } from 'react-native';
3
+ import type { StyleProp, ViewStyle } from 'react-native';
4
4
  import { ContainerStyleProps } from '../utils/viewStyleProps';
5
5
  import { InteractiveAccessibilityProps } from '../utils/accessibility';
6
+ import type { LayoutChangeEvent } from '../hooks/useWebLayout';
6
7
 
7
8
  // Component-specific type aliases for future extensibility
8
9
  export type CardIntentVariant = Intent;
@@ -87,6 +87,7 @@ const Checkbox = forwardRef<IdealystElement, CheckboxProps>(({
87
87
  // Apply variants
88
88
  checkboxStyles.useVariants({
89
89
  size,
90
+ intent,
90
91
  type: variant as any,
91
92
  checked: internalChecked,
92
93
  disabled,
@@ -86,10 +86,6 @@ export const checkboxStyles = defineStyle('Checkbox', (theme: Theme) => ({
86
86
  outlined: { borderWidth: 2 },
87
87
  },
88
88
  checked: {
89
- true: {
90
- backgroundColor: theme.$intents.primary,
91
- borderColor: theme.$intents.primary,
92
- },
93
89
  false: {
94
90
  backgroundColor: 'transparent',
95
91
  borderColor: theme.colors.border.primary,
@@ -100,6 +96,15 @@ export const checkboxStyles = defineStyle('Checkbox', (theme: Theme) => ({
100
96
  false: { opacity: 1 },
101
97
  },
102
98
  },
99
+ compoundVariants: [
100
+ {
101
+ checked: true,
102
+ styles: {
103
+ backgroundColor: theme.$intents.primary,
104
+ borderColor: theme.$intents.primary,
105
+ },
106
+ },
107
+ ],
103
108
  _web: {
104
109
  outline: 'none',
105
110
  display: 'flex',
@@ -120,6 +120,7 @@ const Checkbox = forwardRef<IdealystElement, CheckboxProps>(({
120
120
  // Apply variants
121
121
  checkboxStyles.useVariants({
122
122
  size,
123
+ intent,
123
124
  type: variant as any,
124
125
  checked: internalChecked,
125
126
  disabled,
@@ -1,7 +1,8 @@
1
1
  import type { ReactNode } from 'react';
2
- import type { StyleProp, ViewStyle, LayoutChangeEvent } from 'react-native';
2
+ import type { StyleProp, ViewStyle } from 'react-native';
3
3
  import { Surface } from '@idealyst/theme';
4
4
  import { ContainerStyleProps } from '../utils/viewStyleProps';
5
+ import type { LayoutChangeEvent } from '../hooks/useWebLayout';
5
6
 
6
7
  /**
7
8
  * Full-screen container component with safe area support.
@@ -201,9 +201,13 @@ const TextInput = React.forwardRef<IdealystElement, TextInputProps>(({
201
201
  nativeA11yProps,
202
202
  ]);
203
203
 
204
- // Apply variants to the stylesheet (for size and spacing)
204
+ // Apply variants to the stylesheet (for size, type, and spacing)
205
205
  textInputStyles.useVariants({
206
206
  size,
207
+ type,
208
+ focused: isFocused,
209
+ hasError,
210
+ disabled,
207
211
  margin,
208
212
  marginVertical,
209
213
  marginHorizontal,
@@ -123,9 +123,13 @@ const TextInput = React.forwardRef<IdealystElement, TextInputProps>(({
123
123
  setIsPasswordVisible(!isPasswordVisible);
124
124
  };
125
125
 
126
- // Apply variants (for size and spacing)
126
+ // Apply variants (for size, type, and spacing)
127
127
  textInputStyles.useVariants({
128
128
  size,
129
+ type,
130
+ focused: isFocused,
131
+ hasError,
132
+ disabled,
129
133
  margin,
130
134
  marginVertical,
131
135
  marginHorizontal,
package/src/View/types.ts CHANGED
@@ -1,7 +1,8 @@
1
1
  import { Size, Surface, ResponsiveStyle } from '@idealyst/theme';
2
2
  import type { ReactNode } from 'react';
3
- import type { StyleProp, ViewStyle, LayoutChangeEvent } from 'react-native';
3
+ import type { StyleProp, ViewStyle } from 'react-native';
4
4
  import { ContainerStyleProps } from '../utils/viewStyleProps';
5
+ import type { LayoutChangeEvent } from '../hooks/useWebLayout';
5
6
 
6
7
  /**
7
8
  * Style prop type that accepts both regular styles and responsive styles.
@@ -1 +1,2 @@
1
1
  export { useWebLayout } from './useWebLayout.native';
2
+ export type { LayoutChangeEvent, LayoutInfo, OnLayoutCallback } from './types';
@@ -1 +1,2 @@
1
1
  export { useWebLayout } from './useWebLayout.web';
2
+ export type { LayoutChangeEvent, LayoutInfo, OnLayoutCallback } from './types';
@@ -1 +1,2 @@
1
1
  export { useWebLayout } from './useWebLayout.web';
2
+ export type { LayoutChangeEvent, LayoutInfo, OnLayoutCallback } from './types';
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Layout information provided when a component's dimensions change.
3
+ */
4
+ export interface LayoutInfo {
5
+ /** X position relative to the viewport (web) or parent (native) */
6
+ x: number;
7
+ /** Y position relative to the viewport (web) or parent (native) */
8
+ y: number;
9
+ /** Width of the element */
10
+ width: number;
11
+ /** Height of the element */
12
+ height: number;
13
+ }
14
+
15
+ /**
16
+ * Event fired when a component's layout changes.
17
+ * Compatible with React Native's LayoutChangeEvent structure.
18
+ */
19
+ export interface LayoutChangeEvent {
20
+ nativeEvent: {
21
+ layout: LayoutInfo;
22
+ };
23
+ }
24
+
25
+ /**
26
+ * Callback type for layout change events.
27
+ */
28
+ export type OnLayoutCallback = (event: LayoutChangeEvent) => void;
@@ -1,5 +1,5 @@
1
1
  import { useRef } from 'react';
2
- import type { LayoutChangeEvent } from 'react-native';
2
+ import type { LayoutChangeEvent } from './types';
3
3
 
4
4
  /**
5
5
  * No-op hook for native - onLayout is handled natively by React Native components.
@@ -1,5 +1,5 @@
1
1
  import { useEffect, useRef } from 'react';
2
- import type { LayoutChangeEvent } from 'react-native';
2
+ import type { LayoutChangeEvent } from './types';
3
3
 
4
4
  /**
5
5
  * Hook that provides onLayout functionality for web components using ResizeObserver.
@@ -33,7 +33,7 @@ export function useWebLayout<T extends HTMLElement = HTMLElement>(
33
33
  height: rect.height,
34
34
  },
35
35
  },
36
- } as LayoutChangeEvent);
36
+ });
37
37
  };
38
38
 
39
39
  // Call immediately with initial layout