Skip to content

Commit

Permalink
fixed ts in prelum so our manager app would stop throwing these errors
Browse files Browse the repository at this point in the history
  • Loading branch information
DerekAgility committed Nov 8, 2024
1 parent 48b3772 commit aad5939
Show file tree
Hide file tree
Showing 9 changed files with 113 additions and 93 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/type-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Type Check

on:
push:
branches:
- main # Run type checking on pushes to the main branch
pull_request:
branches:
- main # Run type checking on pull requests to the main branch

jobs:
type-check:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3 # Checks out the repository code

- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: "18" # Specify the Node.js version you want

- name: Install dependencies
run: yarn install # Or `npm install` if you're using npm

- name: Run TypeScript type check
run: npx tsc --noEmit --skipLibCheck
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@agility/plenum-ui",
"version": "2.1.11",
"version": "2.1.12",
"license": "MIT",
"main": "dist/index.js",
"module": "dist/index.js",
Expand Down
12 changes: 6 additions & 6 deletions stories/molecules/inputs/InputCounter/InputCounter.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import React, { FC } from "react"
import { FC } from "react";

export interface IInputCounterProps {
/** Counter limit */
limit: number | undefined
limit: number | undefined;
/** Counter current number */
current: number
current: number;
}

/** Primary UI component for user interaction */
Expand All @@ -19,6 +19,6 @@ const InputCounter: FC<IInputCounterProps> = ({ current = 0, limit }) => {
</>
)}
</div>
)
}
export default InputCounter
);
};
export default InputCounter;
30 changes: 15 additions & 15 deletions stories/molecules/inputs/InputLabel/InputLabel.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import React, { FC } from "react"
import { default as cn } from "classnames"
import { FC } from "react";
import { default as cn } from "classnames";

export interface IInputLabelProps {
/** Prop comment */
isPlaceholder?: boolean
id: string
isRequired?: boolean
isDisabled?: boolean
isError?: boolean
isActive?: boolean
isFocused?: boolean
label?: string
isPlaceholder?: boolean;
id: string;
isRequired?: boolean;
isDisabled?: boolean;
isError?: boolean;
isActive?: boolean;
isFocused?: boolean;
label?: string;
}

/** Comment */
Expand All @@ -32,14 +32,14 @@ const InputLabel: FC<IInputLabelProps> = ({
{ "text-red-500 bg-white": !isPlaceholder && isError },
{ "text-gray-500/[.5]": isDisabled },
{ "inline-block transition-all text-sm text-gray-700 mb-1": !isPlaceholder }
)
if (!label) return null
);
if (!label) return null;
return (
<label htmlFor={id} className={labelStyles}>
{label}
{isRequired && <span className="text-red-500"> *</span>}
</label>
)
}
);
};

export default InputLabel
export default InputLabel;
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { Meta, StoryObj } from "@storybook/react"
import NestedInputButton, { INestedInputButtonProps } from "./NestedInputButton"
import type { Meta, StoryObj } from "@storybook/react";
import NestedInputButton, { INestedInputButtonProps } from "./NestedInputButton";

const meta: Meta<typeof NestedInputButton> = {
title: "Design System/molecules/inputs/Nested Input Button",
Expand All @@ -12,10 +12,10 @@ const meta: Meta<typeof NestedInputButton> = {
url: "https://www.figma.com/file/Rb5fJ8hD3pwvLnidgCaGgB/Agility-UI?type=design&node-id=114-2290&mode=dev&device-scaling=100%25&page-id=0%3A1"
}
}
}
};

export default meta
type Story = StoryObj<typeof NestedInputButton>
export default meta;
type Story = StoryObj<typeof NestedInputButton>;

export const RightAligned: Story = {
args: {
Expand All @@ -25,28 +25,24 @@ export const RightAligned: Story = {
},
ctaLabel: "Search",
align: "right",
isClear: false,
onClickHandler: () => window.alert("Clicked"),
buttonProps: {
type: "button"
}
isClear: false
}
}
};
export const LeftAligned: Story = {
args: {
...RightAligned.args,
align: "left"
}
}
};
export const IsClear: Story = {
args: {
...RightAligned.args,
isClear: true
}
}
};
export const NoIcon: Story = {
args: {
...RightAligned.args,
icon: undefined
}
}
};
68 changes: 34 additions & 34 deletions stories/molecules/inputs/textArea/TextArea.tsx
Original file line number Diff line number Diff line change
@@ -1,46 +1,46 @@
import React, { forwardRef, useEffect, useId, useState } from "react"
import { default as cn } from "classnames"
import InputLabel from "../InputLabel"
import InputCounter from "../InputCounter"
import React, { useId } from "react";
import { default as cn } from "classnames";
import InputLabel from "../InputLabel";
import InputCounter from "../InputCounter";

interface ILabelProps extends React.DetailedHTMLProps<React.LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement> {
display: string
htmlFor?: string
display: string;
htmlFor?: string;
}

export interface ITextareaProps extends Omit<React.TextareaHTMLAttributes<HTMLTextAreaElement>, "onChange"> {
/** Input ID */
id?: string
id?: string;
/** Input Name */
name?: string
name?: string;
/** Label for the input */
label?: ILabelProps
label?: ILabelProps;
/** Error state */
isError?: boolean
isError?: boolean;
/** If field is required */
isRequired?: boolean
isRequired?: boolean;
/** Disabled state */
isDisabled?: boolean
isDisabled?: boolean;
/** Set default value */
defaultValue?: string
defaultValue?: string;

value?: string
value?: string;

/** Message shown under the text field */
message?: string
message?: string;
/** Input character counter */
isShowCounter?: boolean
isShowCounter?: boolean;
/** Max length of input character */
maxLength?: number
maxLength?: number;
/** Callback on change */
onChange?(value: string): void
onChange?(value: string): void;
/** Number of rows */
rows?: number
rows?: number;
/** Number of cols */
cols?: number
placeholder?: string
className?: string
ref?: React.LegacyRef<HTMLTextAreaElement>
cols?: number;
placeholder?: string;
className?: string;
ref?: React.LegacyRef<HTMLTextAreaElement>;
}

const Textarea: React.FC<ITextareaProps> = ({
Expand All @@ -63,21 +63,21 @@ const Textarea: React.FC<ITextareaProps> = ({
ref,
...rest
}) => {
const uniqueID = useId()
const uniqueID = useId();

const discriptionStyles = cn("text-sm mt-1 block", { "text-gray-500": !isError }, { "text-red-500": isError })
const discriptionStyles = cn("text-sm mt-1 block", { "text-gray-500": !isError }, { "text-red-500": isError });

if (!id) id = `ta-${uniqueID}`
if (!id) id = `ta-${uniqueID}`;

if (!label) {
return (
<textarea
ref={ref}
maxLength={maxLength}
onChange={(e: React.ChangeEvent<HTMLTextAreaElement>) => {
const targetValue = e.target.value
const targetValue = e.target.value;
if (onChange) {
onChange(targetValue)
onChange(targetValue);
}
}}
rows={rows}
Expand All @@ -98,7 +98,7 @@ const Textarea: React.FC<ITextareaProps> = ({
placeholder={placeholder}
{...rest}
/>
)
);
}

//with label
Expand All @@ -119,9 +119,9 @@ const Textarea: React.FC<ITextareaProps> = ({
ref={ref}
maxLength={maxLength}
onChange={(e: React.ChangeEvent<HTMLTextAreaElement>) => {
const targetValue = e.target.value
const targetValue = e.target.value;
if (onChange) {
onChange(targetValue)
onChange(targetValue);
}
}}
rows={rows}
Expand Down Expand Up @@ -152,7 +152,7 @@ const Textarea: React.FC<ITextareaProps> = ({
)}
</div>
</div>
)
}
);
};

export default Textarea
export default Textarea;
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
import type { Meta, StoryObj } from "@storybook/react"
import AnimatedLabelTextArea, { IAnimatedLabelTextAreaProps } from "./AnimatedLabelTextArea"
import type { Meta, StoryObj } from "@storybook/react";
import AnimatedLabelTextArea, { IAnimatedLabelTextAreaProps } from "./AnimatedLabelTextArea";

const meta: Meta<typeof AnimatedLabelTextArea> = {
title: "Design System/organisms/Animated Label Text Area",
component: AnimatedLabelTextArea,
tags: ["autodocs"],
argTypes: {}
}
};

export default meta
type Story = StoryObj<typeof AnimatedLabelTextArea>
export default meta;
type Story = StoryObj<typeof AnimatedLabelTextArea>;
export const DefaultAnimatedLabelTextAreasStory: Story = {
args: {
id: "test",
label: "Label"
message: "Label"
} as IAnimatedLabelTextAreaProps
}
};

export const DefaultAnimatedLabelTextAreasStoryWithPlaceholder: Story = {
args: {
id: "test",
label: "Label",
message: "Label",
placeholder: "Placeholder"
} as IAnimatedLabelTextAreaProps
}
};
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { Meta, StoryObj } from "@storybook/react"
import FormInputWithAddons, { IFormInputWithAddonsProps } from "./FormInputWithAddons"
import type { Meta, StoryObj } from "@storybook/react";
import FormInputWithAddons, { IFormInputWithAddonsProps } from "./FormInputWithAddons";

const meta: Meta<typeof FormInputWithAddons> = {
title: "Design System/organisms/Form Input With Addons",
Expand All @@ -12,10 +12,10 @@ const meta: Meta<typeof FormInputWithAddons> = {
url: "https://www.figma.com/file/Rb5fJ8hD3pwvLnidgCaGgB/Agility-UI?type=design&node-id=85-1269&mode=design"
}
}
}
};

export default meta
type Story = StoryObj<typeof FormInputWithAddons>
export default meta;
type Story = StoryObj<typeof FormInputWithAddons>;

export const DefaultFormInputWithAddons: Story = {
args: {
Expand All @@ -26,7 +26,7 @@ export const DefaultFormInputWithAddons: Story = {
labelClass: "text-gray-900",
trailIcon: { icon: "IconSearch" }
}
}
};
export const FormInputWithAddonBTN: Story = {
args: {
id: "appSearch",
Expand All @@ -39,10 +39,7 @@ export const FormInputWithAddonBTN: Story = {
className: "h-5 w-5 text-gray-400"
},
ctaLabel: "Edit",
align: "right",
onClickHandler: () => {
alert("Button Clicked")
}
align: "right"
}
}
}
};
5 changes: 2 additions & 3 deletions utils/types.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
import { HTMLAttributes } from "react"
import React from "react"
export type ClassNameWithAutocomplete = React.ComponentPropsWithoutRef<"div">["className"]
import React from "react";
export type ClassNameWithAutocomplete = React.ComponentPropsWithoutRef<"div">["className"];

0 comments on commit aad5939

Please sign in to comment.