Skip to content

Commit

Permalink
refactor: Standardize capitalisation for textarea
Browse files Browse the repository at this point in the history
  • Loading branch information
tjtanjin committed Sep 13, 2024
1 parent 3036947 commit ddad30f
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/constants/RcbEvent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const RcbEvent = {
USER_UPLOAD_FILE: "rcb-user-upload-file",

// text area value change
TEXTAREA_CHANGE_VALUE: "rcb-textarea-change-value"
TEXT_AREA_CHANGE_VALUE: "rcb-text-area-change-value"
}

export { RcbEvent };
4 changes: 2 additions & 2 deletions src/hooks/internal/useTextAreaInternal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ export const useTextAreaInternal = () => {
} else {
inputRef.current.value = newInput
}
if(settings.event?.rcbTextareaChangeValue) {
if(settings.event?.rcbTextAreaChangeValue) {

const event = callRcbEvent(RcbEvent.TEXTAREA_CHANGE_VALUE,
const event = callRcbEvent(RcbEvent.TEXT_AREA_CHANGE_VALUE,
{currValue: inputRef.current.value, prevValue: prevInputRef.current});
if (event.defaultPrevented) {
inputRef.current.value = prevInputRef.current;
Expand Down
2 changes: 1 addition & 1 deletion src/services/RcbEventService.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const cancellableMap = {
[RcbEvent.DISMISS_TOAST]: true,
[RcbEvent.USER_SUBMIT_TEXT]: true,
[RcbEvent.USER_UPLOAD_FILE]: true,
[RcbEvent.TEXTAREA_CHANGE_VALUE]: true
[RcbEvent.TEXT_AREA_CHANGE_VALUE]: true
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/types/Settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,6 @@ export type Settings = {
rcbDismissToast?: boolean;
rcbUserSubmitText?: boolean;
rcbUserUploadFile?: boolean;
rcbTextareaChangeValue?: boolean;
rcbTextAreaChangeValue?: boolean;
}
}
2 changes: 1 addition & 1 deletion src/types/events/RcbTextareaChangeValue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { RcbBaseEvent } from "../internal/events/RcbBaseEvent";
/**
* Defines the data available for stop stream message event.
*/
export type RcbTextareaChangeValueEvent = RcbBaseEvent<{
export type RcbTextAreaChangeValueEvent = RcbBaseEvent<{
currValue: string;
prevValue: string;
}>;
4 changes: 2 additions & 2 deletions types/global.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { RcbDismissToastEvent } from "../src/types/events/RcbDismissToastEvent";
import { RcbUserSubmitTextEvent } from "../src/types/events/RcbUserSubmitTextEvent";
import { RcbUserUploadFileEvent } from "../src/types/events/RcbUserUploadFileEvent";
import { RcbEvent } from "../src/constants/RcbEvent";
import { RcbTextareaChangeValueEvent } from "../src/types/events/RcbTextareaChangeValue";
import { RcbTextAreaChangeValueEvent } from "../src/types/events/RcbTextAreaChangeValue";

declare global {
interface Navigator {
Expand Down Expand Up @@ -75,6 +75,6 @@ declare global {
"rcb-user-upload-file": RcbUserUploadFileEvent;

// textarea change value
"rcb-textarea-change-value": RcbTextareaChangeValueEvent;
"rcb-text-area-change-value": RcbTextAreaChangeValueEvent;
}
}

0 comments on commit ddad30f

Please sign in to comment.