From 769ad47527d3bce4ff94eb5d1f192526dbc1ecc9 Mon Sep 17 00:00:00 2001 From: grabkowski Date: Tue, 6 Apr 2021 18:02:43 +0200 Subject: [PATCH] feat(configurable-items): add ts type definitions --- .../configurable-item-row.d.ts | 23 +++++++++++++++++++ .../configurable-item-row/index.d.ts | 1 + .../configurable-items.d.ts | 21 +++++++++++++++++ src/components/configurable-items/index.d.ts | 2 ++ 4 files changed, 47 insertions(+) create mode 100644 src/components/configurable-items/configurable-item-row/configurable-item-row.d.ts create mode 100644 src/components/configurable-items/configurable-item-row/index.d.ts create mode 100644 src/components/configurable-items/configurable-items.d.ts create mode 100644 src/components/configurable-items/index.d.ts diff --git a/src/components/configurable-items/configurable-item-row/configurable-item-row.d.ts b/src/components/configurable-items/configurable-item-row/configurable-item-row.d.ts new file mode 100644 index 0000000000..a935a3c505 --- /dev/null +++ b/src/components/configurable-items/configurable-item-row/configurable-item-row.d.ts @@ -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) => 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; diff --git a/src/components/configurable-items/configurable-item-row/index.d.ts b/src/components/configurable-items/configurable-item-row/index.d.ts new file mode 100644 index 0000000000..03530d5a37 --- /dev/null +++ b/src/components/configurable-items/configurable-item-row/index.d.ts @@ -0,0 +1 @@ +export { default } from "./configurable-item-row"; diff --git a/src/components/configurable-items/configurable-items.d.ts b/src/components/configurable-items/configurable-items.d.ts new file mode 100644 index 0000000000..bd402d1c37 --- /dev/null +++ b/src/components/configurable-items/configurable-items.d.ts @@ -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) => void; + /** An internal prop. Helpful to detect which component should be rendered */ + theme?: object; + +} + +declare function ConfigurableItems(props: ConfigurableItemsProps): JSX.Element; + +export default ConfigurableItems; diff --git a/src/components/configurable-items/index.d.ts b/src/components/configurable-items/index.d.ts new file mode 100644 index 0000000000..dc38d85978 --- /dev/null +++ b/src/components/configurable-items/index.d.ts @@ -0,0 +1,2 @@ +export { default as ConfigurableItems } from "./configurable-items"; +export { default as ConfigurableItemRow } from "./configurable-item-row/configurable-item-row";