@aurora-ds/components 0.24.7 → 0.24.8

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.
@@ -1,9 +1,13 @@
1
- import { CSSProperties, ReactNode } from 'react';
1
+ import { CSSProperties, FocusEvent, ReactNode } from 'react';
2
2
  export type InputProps = {
3
3
  /** The value of the input */
4
4
  value: string;
5
5
  /** Callback fired when the value changes */
6
6
  onChange: (value: string) => void;
7
+ /** Callback fired when the input receives focus */
8
+ onFocus?: (event: FocusEvent<HTMLInputElement>) => void;
9
+ /** Callback fired when the input loses focus */
10
+ onBlur?: (event: FocusEvent<HTMLInputElement>) => void;
7
11
  /** Label displayed above the input */
8
12
  label?: string;
9
13
  /** Whether the field is mandatory (displays an asterisk next to the label) */
@@ -1,9 +1,13 @@
1
- import { CSSProperties } from 'react';
1
+ import { CSSProperties, FocusEvent } from 'react';
2
2
  export type TextAreaProps = {
3
3
  /** The value of the textarea */
4
4
  value: string;
5
5
  /** Callback fired when the value changes */
6
6
  onChange: (value: string) => void;
7
+ /** Callback fired when the textarea receives focus */
8
+ onFocus?: (event: FocusEvent<HTMLTextAreaElement>) => void;
9
+ /** Callback fired when the textarea loses focus */
10
+ onBlur?: (event: FocusEvent<HTMLTextAreaElement>) => void;
7
11
  /** Label displayed above the textarea */
8
12
  label?: string;
9
13
  /** Whether the field is mandatory (displays an asterisk next to the label) */
package/dist/cjs/index.js CHANGED
@@ -1218,14 +1218,14 @@ const UploadIcon = () => (jsxRuntime.jsxs("svg", { xmlns: 'http://www.w3.org/200
1218
1218
  /**
1219
1219
  * Input component
1220
1220
  */
1221
- const Input = React.forwardRef(({ value, onChange, label, mandatory = false, placeholder, disabled = false, type = 'text', ariaLabel, startIcon, endIcon, width, }, ref) => {
1221
+ const Input = React.forwardRef(({ value, onChange, onFocus, onBlur, label, mandatory = false, placeholder, disabled = false, type = 'text', ariaLabel, startIcon, endIcon, width, }, ref) => {
1222
1222
  const [showPassword, setShowPassword] = React.useState(false);
1223
1223
  const handleChange = (event) => {
1224
1224
  onChange(event.target.value);
1225
1225
  };
1226
1226
  const inputType = type === 'password' ? (showPassword ? 'text' : 'password') : type;
1227
1227
  const hasPasswordToggle = type === 'password';
1228
- return (jsxRuntime.jsxs(Stack, { direction: 'column', gap: 'xs', align: 'stretch', width: width ?? '100%', children: [label && (jsxRuntime.jsxs(Stack, { direction: 'row', gap: 'xs', align: 'center', children: [jsxRuntime.jsx(Text, { variant: 'label', fontSize: 'sm', children: label }), mandatory && (jsxRuntime.jsx(Text, { variant: 'label', fontSize: 'sm', color: 'error', children: "*" }))] })), jsxRuntime.jsxs("div", { className: `${INPUT_STYLES.container({ width })} ${disabled ? 'disabled' : ''}`, children: [jsxRuntime.jsx("input", { ref: ref, type: inputType, value: value, onChange: handleChange, placeholder: placeholder, disabled: disabled, className: INPUT_STYLES.root({ disabled, hasStartIcon: !!startIcon, hasEndIcon: !!endIcon, hasPasswordToggle }), "aria-label": ariaLabel || label }), startIcon && (jsxRuntime.jsx("div", { className: INPUT_STYLES.startIcon, children: jsxRuntime.jsx(Icon, { color: 'textTertiary', children: startIcon }) })), endIcon && (jsxRuntime.jsx("div", { className: hasPasswordToggle ? INPUT_STYLES.endIconShifted : INPUT_STYLES.endIcon, children: jsxRuntime.jsx(Icon, { color: 'textTertiary', children: endIcon }) })), hasPasswordToggle && (jsxRuntime.jsx("div", { className: INPUT_STYLES.passwordToggle, children: jsxRuntime.jsx(IconButton, { icon: showPassword ? jsxRuntime.jsx(EyeOffIcon, {}) : jsxRuntime.jsx(EyeIcon, {}), onClick: () => setShowPassword(!showPassword), disabled: disabled, ariaLabel: ariaLabel || label, variant: 'text', size: 'small', textColor: 'textSecondary' }) }))] })] }));
1228
+ return (jsxRuntime.jsxs(Stack, { direction: 'column', gap: 'xs', align: 'stretch', width: width ?? '100%', children: [label && (jsxRuntime.jsxs(Stack, { direction: 'row', gap: 'xs', align: 'center', children: [jsxRuntime.jsx(Text, { variant: 'label', fontSize: 'sm', children: label }), mandatory && (jsxRuntime.jsx(Text, { variant: 'label', fontSize: 'sm', color: 'error', children: "*" }))] })), jsxRuntime.jsxs("div", { className: `${INPUT_STYLES.container({ width })} ${disabled ? 'disabled' : ''}`, children: [jsxRuntime.jsx("input", { ref: ref, type: inputType, value: value, onChange: handleChange, onFocus: onFocus, onBlur: onBlur, placeholder: placeholder, disabled: disabled, className: INPUT_STYLES.root({ disabled, hasStartIcon: !!startIcon, hasEndIcon: !!endIcon, hasPasswordToggle }), "aria-label": ariaLabel || label }), startIcon && (jsxRuntime.jsx("div", { className: INPUT_STYLES.startIcon, children: jsxRuntime.jsx(Icon, { color: 'textTertiary', children: startIcon }) })), endIcon && (jsxRuntime.jsx("div", { className: hasPasswordToggle ? INPUT_STYLES.endIconShifted : INPUT_STYLES.endIcon, children: jsxRuntime.jsx(Icon, { color: 'textTertiary', children: endIcon }) })), hasPasswordToggle && (jsxRuntime.jsx("div", { className: INPUT_STYLES.passwordToggle, children: jsxRuntime.jsx(IconButton, { icon: showPassword ? jsxRuntime.jsx(EyeOffIcon, {}) : jsxRuntime.jsx(EyeIcon, {}), onClick: () => setShowPassword(!showPassword), disabled: disabled, ariaLabel: ariaLabel || label, variant: 'text', size: 'small', textColor: 'textSecondary' }) }))] })] }));
1229
1229
  });
1230
1230
  Input.displayName = 'Input';
1231
1231
  var Input_default = React.memo(Input);
@@ -1278,7 +1278,7 @@ const TEXTAREA_STYLES = theme.createStyles((theme) => ({
1278
1278
  /**
1279
1279
  * TextArea component with auto-expanding height based on content
1280
1280
  */
1281
- const TextArea = React.forwardRef(({ value, onChange, label, mandatory = false, placeholder, disabled = false, ariaLabel, width, minRows = 3, maxRows, }, ref) => {
1281
+ const TextArea = React.forwardRef(({ value, onChange, onFocus, onBlur, label, mandatory = false, placeholder, disabled = false, ariaLabel, width, minRows = 3, maxRows, }, ref) => {
1282
1282
  const internalRef = React.useRef(null);
1283
1283
  const textareaRef = ref || internalRef;
1284
1284
  const adjustHeight = React.useCallback(() => {
@@ -1303,7 +1303,7 @@ const TextArea = React.forwardRef(({ value, onChange, label, mandatory = false,
1303
1303
  const handleChange = (event) => {
1304
1304
  onChange(event.target.value);
1305
1305
  };
1306
- return (jsxRuntime.jsxs(Stack, { direction: 'column', gap: 'xs', align: 'stretch', width: width ?? '100%', children: [label && (jsxRuntime.jsxs(Stack, { direction: 'row', gap: 'xs', align: 'center', children: [jsxRuntime.jsx(Text, { variant: 'label', fontSize: 'sm', children: label }), mandatory && (jsxRuntime.jsx(Text, { variant: 'label', fontSize: 'sm', color: 'error', children: "*" }))] })), jsxRuntime.jsx("div", { className: `${TEXTAREA_STYLES.container({ width })} ${disabled ? 'disabled' : ''}`, children: jsxRuntime.jsx("textarea", { ref: textareaRef, value: value, onChange: handleChange, placeholder: placeholder, disabled: disabled, className: TEXTAREA_STYLES.root({ disabled }), "aria-label": ariaLabel || label, rows: minRows }) })] }));
1306
+ return (jsxRuntime.jsxs(Stack, { direction: 'column', gap: 'xs', align: 'stretch', width: width ?? '100%', children: [label && (jsxRuntime.jsxs(Stack, { direction: 'row', gap: 'xs', align: 'center', children: [jsxRuntime.jsx(Text, { variant: 'label', fontSize: 'sm', children: label }), mandatory && (jsxRuntime.jsx(Text, { variant: 'label', fontSize: 'sm', color: 'error', children: "*" }))] })), jsxRuntime.jsx("div", { className: `${TEXTAREA_STYLES.container({ width })} ${disabled ? 'disabled' : ''}`, children: jsxRuntime.jsx("textarea", { ref: textareaRef, value: value, onChange: handleChange, onFocus: onFocus, onBlur: onBlur, placeholder: placeholder, disabled: disabled, className: TEXTAREA_STYLES.root({ disabled }), "aria-label": ariaLabel || label, rows: minRows }) })] }));
1307
1307
  });
1308
1308
  TextArea.displayName = 'TextArea';
1309
1309
  var TextArea_default = React.memo(TextArea);