@formsort/custom-question-api
Advanced tools
Comparing version 0.0.25 to 0.0.26
import { AnswerSemanticType } from '@formsort/constants'; | ||
declare type AnswerPrimitiveType = number | string | boolean | object; | ||
declare type AnswerType = AnswerPrimitiveType | AnswerPrimitiveType[]; | ||
export declare const setQuestionSize: (width?: number | undefined, height?: number | undefined) => void; | ||
export declare const setQuestionSize: (width?: string | number | undefined, height?: string | number | undefined) => void; | ||
export declare const getAnswerValue: <T extends AnswerType = AnswerType>() => Promise<T | undefined>; | ||
@@ -6,0 +6,0 @@ export declare const getSemanticAnswerValue: <T extends AnswerType = AnswerType>(semanticType: AnswerSemanticType) => Promise<T>; |
{ | ||
"name": "@formsort/custom-question-api", | ||
"version": "0.0.25", | ||
"version": "0.0.26", | ||
"description": "Helpers for implementing custom questions in Formsort", | ||
@@ -52,3 +52,3 @@ "main": "lib/index.js", | ||
}, | ||
"gitHead": "a7b0156bbc2ce661ad75fa222c7edcc40942fa26" | ||
"gitHead": "14006a50f2caa887d0fdb9b95eeb4edbebe1d216" | ||
} |
@@ -106,9 +106,11 @@ # @formsort/custom-question-api | ||
```tsx | ||
setQuestionSize(width?: number, height?: number) => void | ||
setQuestionSize(width?: number | string, height?: number | string) => void | ||
``` | ||
Sets the width and height of the question within Formsort. | ||
Sets the width and height of the question within Formsort. The default unit of measurement when passing a number is pixels (px). A different unit of measurement can be passed as a string. | ||
For example, `'2em'` or `'100%'`. | ||
To avoid jumpiness, if you know the size of your component beforehand, it's best to set the default width and height within the custom question directly within the Formsort studio. Use `setQuestionSize` when you do not know the dimensions of your question component beforehand, and want to make sure that Formsort gives it enough size to render without scrollbars. | ||
For example, if you implement your custom question as a React component, you may want to measure the component once it's rendered and tell Formsort its height and width: | ||
@@ -115,0 +117,0 @@ |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
14628
167
0