From 7b55f15c3e4b30173ec5994dd3072b1f58047dc5 Mon Sep 17 00:00:00 2001 From: khanhas Date: Mon, 18 Jun 2018 00:56:15 +0700 Subject: [PATCH 1/2] Added StyledText, Picker.Item --- types/proton-native/index.d.ts | 141 +++++++++++++++++++-------------- 1 file changed, 80 insertions(+), 61 deletions(-) diff --git a/types/proton-native/index.d.ts b/types/proton-native/index.d.ts index 635f180b0e..c3521ede1e 100644 --- a/types/proton-native/index.d.ts +++ b/types/proton-native/index.d.ts @@ -169,62 +169,7 @@ export interface AreaPathProps extends AreaBaseProps { export class AreaPath extends React.Component { } -export interface AreaTextProps extends AreaBaseProps { - style?: { - /** - * The background color, specified as a CSS color string. - */ - backgroundColor?: string; - /** - * The text color, specified as a CSS color string. - */ - color?: string; - /** - * The font family (only if available on the system). - */ - fontFamily?: string; - /** - * The font size (in pt). - */ - fontSize?: number; - /** - * Whether an italic font should be used. - */ - fontStyle?: 'normal' | 'oblique' | 'italic'; - /** - * Whether a bold font should be used (and the amount). - */ - fontWeight?: 'minimum' | 'thin' | 'ultraLight' | 'light' | 'book' | 'normal' | 'medium' | 'semiBold' | 'bold' | 'ultraBold' | 'heavy' | 'ultraHeavy' | 'maximum' | number; - /** - * Wheter the text should be aligned to the left, center or right. - * - * **Works only on a top level text component, not it's children!** - */ - textAlign?: 'left' | 'center' | 'right'; - /** - * How wide or narrow the characters should be. - */ - textStretch?: 'ultraCondensed' | 'extraCondensed' | 'condensed' | 'semiCondensed' | 'normal' | 'semiExpanded' | 'expanded' | 'extraExpanded' | 'ultraExpanded'; - /** - * The text underline style. - */ - textUnderline?: 'none' | 'single' | 'double' | 'suggestion'; - /** - * The text underline color. - * - * A color string | 'spelling' | 'grammar' | 'auxiliary' - */ - textUnderlineColor?: 'spelling' | 'grammar' | 'auxiliary' | string; - }; - /** - * The x coordinate of the text's top left corner. (Only in a top level text component.) - */ - x?: number | string; - /** - * The y coordinate of the text's top left corner. (Only in a top level text component.) - */ - y?: number | string; -} +export interface AreaTextProps extends StyledTextProps, AreaBaseProps { } export class AreaText extends React.Component { } @@ -616,10 +561,18 @@ export interface PickerProps extends GridChildrenProps, Label, Stretchy { visible?: boolean; } +export interface PickerItemProps { + children: string; +} + +export class PickerItem extends React.Component { } + /** * A drop down menu where the user can pick different values. */ -export class Picker extends React.Component { } +export class Picker extends React.Component { + static Item: typeof PickerItem; +} export interface ProgressBarProps extends GridChildrenProps, Label, Stretchy { /** @@ -764,6 +717,65 @@ export interface Stretchy { stretchy?: boolean; } +export interface StyledTextProps { + style?: { + /** + * The background color, specified as a CSS color string. + */ + backgroundColor?: string; + /** + * The text color, specified as a CSS color string. + */ + color?: string; + /** + * The font family (only if available on the system). + */ + fontFamily?: string; + /** + * The font size (in pt). + */ + fontSize?: number; + /** + * Whether an italic font should be used. + */ + fontStyle?: 'normal' | 'oblique' | 'italic'; + /** + * Whether a bold font should be used (and the amount). + */ + fontWeight?: 'minimum' | 'thin' | 'ultraLight' | 'light' | 'book' | 'normal' | 'medium' | 'semiBold' | 'bold' | 'ultraBold' | 'heavy' | 'ultraHeavy' | 'maximum' | number; + /** + * Wheter the text should be aligned to the left, center or right. + * + * **Works only on a top level text component, not it's children!** + */ + textAlign?: 'left' | 'center' | 'right'; + /** + * How wide or narrow the characters should be. + */ + textStretch?: 'ultraCondensed' | 'extraCondensed' | 'condensed' | 'semiCondensed' | 'normal' | 'semiExpanded' | 'expanded' | 'extraExpanded' | 'ultraExpanded'; + /** + * The text underline style. + */ + textUnderline?: 'none' | 'single' | 'double' | 'suggestion'; + /** + * The text underline color. + * + * A color string | 'spelling' | 'grammar' | 'auxiliary' + */ + textUnderlineColor?: 'spelling' | 'grammar' | 'auxiliary' | string; + }; + /** + * The x coordinate of the text's top left corner. (Only in a top level text component.) + */ + x?: number | string; + /** + * The y coordinate of the text's top left corner. (Only in a top level text component.) + */ + y?: number | string; +} + +export class StyledText extends React.Component { } + export interface TabProps extends GridChildrenProps { /** * Whether the Tab is enabled. @@ -896,17 +908,16 @@ export class Window extends React.Component { } export function render(element: JSX.Element): void; /** - * A method to display an alert, or a dialog to save or open a file. + * A method to display an alert. * @param type What type the dialog is. The current types are: * - Message - a simple message * - Error - an error message * - Open - open a file * - Save - save a file - * @param options Options for the title and description if it is a Message or Error. - * Required one of title and description (if it is Message or Error) + * @param options Options for the title and descript. */ export function Dialog( - type: 'Message' | 'Error' | 'Open' | 'Save', + type: 'Message' | 'Error', options?: { title: string, description?: string @@ -915,3 +926,11 @@ export function Dialog( description: string } ): void; + +/** + * A dialog to save or open a file. Returns chosen file path. + * @param type What type the dialog is. The current types are: + * - Open - open a file + * - Save - save a file + */ +export function Dialog(type: 'Open' | 'Save'): string; From fead5f449c99f08fe6185081095b07cd176745a7 Mon Sep 17 00:00:00 2001 From: khanhas Date: Mon, 18 Jun 2018 19:50:38 +0700 Subject: [PATCH 2/2] Fixed Picker props type --- types/proton-native/index.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/types/proton-native/index.d.ts b/types/proton-native/index.d.ts index c3521ede1e..62aa0dce25 100644 --- a/types/proton-native/index.d.ts +++ b/types/proton-native/index.d.ts @@ -546,15 +546,15 @@ export interface PickerProps extends GridChildrenProps, Label, Stretchy { /** * When a *non-editable* Picker is changed. The current selection is passed as an argument. */ - onSelect?: (selection: string) => void; + onSelect?: (selection: number) => void; /** * What element is selected if the picker *is not* editable. */ - selected?: boolean; + selected?: number; /** * What text is selected/typed if the picker *is* editable. */ - text?: boolean; + text?: string; /** * Whether the Picker can be seen. */