mirror of
https://github.com/pezkuwichain/pezkuwi-extension.git
synced 2026-10-20 18:56:20 +00:00
- @pezkuwi/dev, dev-test, dev-ts ^0.86.3 in the root and in every workspace package (they still asked for 0.84.3) - tsconfig.base target ES2022, the @pezkuwi/dev default; it carries the ErrorOptions type for `cause` - rethrown errors carry the original as `cause`; rejections are normalised to Error - page/messaging: the typed subscriber is called directly, not as `Function` - chrome mock: constant results through Promise.resolve - useLedger: drop a construction every branch below repeated - InputWithLabel: onKeyDown instead of the deprecated onKeyPress - Account: toggleActions + 1 instead of a pre-increment of a parameter - optional chains where a guard tested the same value - specs: mount<React.Component> so the wrappers are not `any`-typed - AccountsStore.set keeps its async override of KeyringStore.set: BaseStore.set handles its own failure, so it never rejects - extension-chains keeps its ChainProperties assertion: the package's own build does not load the type augmentation - the existing React Compiler findings (37, react-hooks rules only) are recorded in eslint-suppressions.json; a new one fails lint
48 lines
1.1 KiB
TypeScript
48 lines
1.1 KiB
TypeScript
// Copyright 2019-2026 @pezkuwi/extension-ui authors & contributors
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
import React, { useCallback } from 'react';
|
|
|
|
import Label from './Label.js';
|
|
import { TextArea } from './TextInputs.js';
|
|
|
|
interface Props {
|
|
className?: string;
|
|
isError?: boolean;
|
|
isFocused?: boolean;
|
|
isReadOnly?: boolean;
|
|
rowsCount?: number;
|
|
label: string;
|
|
onChange?: (value: string) => void;
|
|
value?: string;
|
|
}
|
|
|
|
export default function TextAreaWithLabel ({ className, isError, isFocused, isReadOnly, label, onChange, rowsCount, value }: Props): React.ReactElement<Props> {
|
|
const _onChange = useCallback(
|
|
({ target: { value } }: React.ChangeEvent<HTMLTextAreaElement>): void => {
|
|
onChange?.(value);
|
|
},
|
|
[onChange]
|
|
);
|
|
|
|
return (
|
|
<Label
|
|
className={className}
|
|
label={label}
|
|
>
|
|
<TextArea
|
|
autoCapitalize='off'
|
|
autoComplete='off'
|
|
autoCorrect='off'
|
|
autoFocus={isFocused}
|
|
onChange={_onChange}
|
|
readOnly={isReadOnly}
|
|
rows={rowsCount || 2}
|
|
spellCheck={false}
|
|
value={value}
|
|
withError={isError}
|
|
/>
|
|
</Label>
|
|
);
|
|
}
|