Skip to content

Commit

Permalink
feat(configurable-items): add ts type definitions
Browse files Browse the repository at this point in the history
  • Loading branch information
grabkowski committed Apr 9, 2021
1 parent 15c044e commit 769ad47
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import * as React from "react";

export interface ConfigurableItemRowProps {
/** A custom class name for the component. */
className?: string;
/** The checked value for the checkbox. */
enabled?: boolean;
/** The disabled value for the checkbox. */
locked?: boolean;
/** The label for the row. */
name?: string;
/** Callback triggered when the checkbox checked value is updated. */
onChange?: (ev: React.ChangeEvent<HTMLInputElement>) => void;
/** The unique index for the row. */
rowIndex: number;
/** An internal prop. Helpful to detect which component should be rendered */
theme?: object;
}

declare function ConfigurableItemRow(props: ConfigurableItemRowProps): JSX.Element;

export { ConfigurableItemRow as ConfigurableItemRowWithoutHOC };
export default ConfigurableItemRow;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from "./configurable-item-row";
21 changes: 21 additions & 0 deletions src/components/configurable-items/configurable-items.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import * as React from "react";

export interface ConfigurableItemsProps {
/** Children elements. */
children?: React.ReactNode;
/** A custom class name for the component. */
className?: string;
/** Callback triggered when an item is dragged. */
onDrag: (originalIndex: number, hoverIndex: number) => void;
/** Callback triggered when when the reset button is pressed. */
onReset?: () => void;
/** Callback triggered when the form is saved. */
onSave: (ev: React.FormEvent<HTMLFormElement>) => void;
/** An internal prop. Helpful to detect which component should be rendered */
theme?: object;

}

declare function ConfigurableItems(props: ConfigurableItemsProps): JSX.Element;

export default ConfigurableItems;
2 changes: 2 additions & 0 deletions src/components/configurable-items/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { default as ConfigurableItems } from "./configurable-items";
export { default as ConfigurableItemRow } from "./configurable-item-row/configurable-item-row";

0 comments on commit 769ad47

Please sign in to comment.