@idealyst/components 1.2.71 → 1.2.73

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.71",
3
+ "version": "1.2.73",
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.71",
59
+ "@idealyst/theme": "^1.2.73",
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,7 +107,7 @@
107
107
  },
108
108
  "devDependencies": {
109
109
  "@idealyst/blur": "^1.2.40",
110
- "@idealyst/theme": "^1.2.71",
110
+ "@idealyst/theme": "^1.2.73",
111
111
  "@idealyst/tooling": "^1.2.30",
112
112
  "@mdi/react": "^1.6.1",
113
113
  "@types/react": "^19.1.0",
@@ -82,9 +82,8 @@ export const cardStyles = defineStyle('Card', (theme: Theme) => ({
82
82
  true: {
83
83
  _web: {
84
84
  cursor: 'pointer',
85
- transition: 'all 0.2s ease',
85
+ transition: 'box-shadow 0.2s ease',
86
86
  _hover: {
87
- transform: 'translateY(-2px)',
88
87
  boxShadow: '0 4px 12px rgba(0, 0, 0, 0.08), 0 2px 4px rgba(0, 0, 0, 0.06)',
89
88
  },
90
89
  },
@@ -93,21 +93,17 @@ const Card = forwardRef<IdealystElement, CardProps>(({
93
93
 
94
94
  const mergedRef = useMergeRefs(ref, webProps.ref, layoutRef);
95
95
 
96
- // Use appropriate HTML element based on pressable state
97
- const Component: any = pressable ? 'button' : 'div';
98
-
99
96
  return (
100
- <Component
97
+ <div
101
98
  {...webProps}
102
99
  {...ariaProps}
103
100
  ref={mergedRef as any}
104
101
  id={id}
105
102
  onClick={pressable ? handleClick : undefined}
106
- disabled={pressable && disabled}
107
103
  data-testid={testID}
108
104
  >
109
105
  {children}
110
- </Component>
106
+ </div>
111
107
  );
112
108
  });
113
109
 
@@ -11,6 +11,7 @@ const TextArea = forwardRef<IdealystElement, TextAreaProps>(({
11
11
  value: controlledValue,
12
12
  defaultValue = '',
13
13
  onChange,
14
+ onKeyDown: _onKeyDown, // Web-only, no-op on native
14
15
  placeholder,
15
16
  disabled = false,
16
17
  minHeight,
@@ -14,6 +14,7 @@ const TextArea = forwardRef<IdealystElement, TextAreaProps>(({
14
14
  value: controlledValue,
15
15
  defaultValue = '',
16
16
  onChange,
17
+ onKeyDown,
17
18
  placeholder,
18
19
  disabled = false,
19
20
  rows = 4,
@@ -204,6 +205,19 @@ const TextArea = forwardRef<IdealystElement, TextAreaProps>(({
204
205
  setIsFocused(false);
205
206
  };
206
207
 
208
+ const handleKeyDown = (e: React.KeyboardEvent<HTMLTextAreaElement>) => {
209
+ if (onKeyDown) {
210
+ onKeyDown({
211
+ key: e.key,
212
+ ctrlKey: e.ctrlKey,
213
+ shiftKey: e.shiftKey,
214
+ altKey: e.altKey,
215
+ metaKey: e.metaKey,
216
+ preventDefault: () => e.preventDefault(),
217
+ });
218
+ }
219
+ };
220
+
207
221
  const showFooter = (error || helperText) || (showCharacterCount && maxLength);
208
222
 
209
223
  const computedTextareaProps = getWebProps([
@@ -234,6 +248,7 @@ const TextArea = forwardRef<IdealystElement, TextAreaProps>(({
234
248
  onChange={handleChange}
235
249
  onFocus={handleFocus}
236
250
  onBlur={handleBlur}
251
+ onKeyDown={handleKeyDown}
237
252
  placeholder={placeholder}
238
253
  disabled={disabled}
239
254
  rows={autoGrow ? undefined : rows}
@@ -9,10 +9,35 @@ export type TextAreaSizeVariant = Size;
9
9
  export type TextAreaResizeVariant = 'none' | 'vertical' | 'horizontal' | 'both';
10
10
  export type TextAreaType = 'outlined' | 'filled' | 'bare';
11
11
 
12
+ /**
13
+ * Keyboard event data with modifier key states.
14
+ * Provides a cross-platform API for handling key presses with modifiers.
15
+ */
16
+ export interface KeyboardEventData {
17
+ /** The key that was pressed (e.g., 'Enter', 'a', 'Escape') */
18
+ key: string;
19
+ /** Whether the Ctrl key (or Cmd on Mac) was held */
20
+ ctrlKey: boolean;
21
+ /** Whether the Shift key was held */
22
+ shiftKey: boolean;
23
+ /** Whether the Alt key (Option on Mac) was held */
24
+ altKey: boolean;
25
+ /** Whether the Meta key (Cmd on Mac, Win on Windows) was held */
26
+ metaKey: boolean;
27
+ /** Prevents the default browser behavior (web only, no-op on native) */
28
+ preventDefault: () => void;
29
+ }
30
+
12
31
  export interface TextAreaProps extends FormInputStyleProps, FormAccessibilityProps {
13
32
  value?: string;
14
33
  defaultValue?: string;
15
34
  onChange?: (value: string) => void;
35
+ /**
36
+ * Called when a key is pressed while the textarea is focused.
37
+ * Includes modifier key states (ctrl, shift, alt, meta).
38
+ * Web only - no-op on native.
39
+ */
40
+ onKeyDown?: (event: KeyboardEventData) => void;
16
41
  placeholder?: string;
17
42
  disabled?: boolean;
18
43
  rows?: number;