UNPKG

@microsoft/teams.cards

Version:

<p> <a href="https://www.npmjs.com/package/@microsoft/teams.cards" target="_blank"> <img src="https://img.shields.io/npm/v/@microsoft/teams.cards" /> </a> <a href="https://www.npmjs.com/package/@microsoft/teams.cards?activeTab=code" ta

1 lines 4.59 kB
{"version":3,"sources":["../../src/inputs/base.ts"],"names":[],"mappings":";;AA4CO,MAAM,qBAAqB,OAAiC,CAAA;AAAA;AAAA;AAAA;AAAA,EAIjE,YAAA;AAAA;AAAA;AAAA;AAAA,EAKA,UAAA;AAAA;AAAA;AAAA;AAAA,EAKA,KAAA;AAAA;AAAA;AAAA;AAAA,EAKA,aAAA;AAAA;AAAA;AAAA;AAAA,EAKA,UAAA;AAAA;AAAA;AAAA;AAAA,EAKA,UAAA;AAAA,EAEA,WAAA,CAAY,OAAkC,GAAA,EAAI,EAAA;AAChD,IAAA,KAAA,CAAM,OAAO,CAAA;AAAA;AACf,EAEA,UAAU,KAAe,EAAA;AACvB,IAAA,IAAA,CAAK,YAAe,GAAA,KAAA;AACpB,IAAO,OAAA,IAAA;AAAA;AACT,EAEA,YAAA,CAAa,QAAQ,IAAM,EAAA;AACzB,IAAA,IAAA,CAAK,UAAa,GAAA,KAAA;AAClB,IAAO,OAAA,IAAA;AAAA;AACT,EAEA,SAAA,CAAU,KAAe,EAAA,QAAA,EAA+B,KAAyB,EAAA;AAC/E,IAAA,IAAA,CAAK,KAAQ,GAAA,KAAA;AACb,IAAA,IAAA,CAAK,aAAgB,GAAA,QAAA;AACrB,IAAA,IAAA,CAAK,UAAa,GAAA,KAAA;AAClB,IAAO,OAAA,IAAA;AAAA;AACT,EAEA,kBAAkB,KAA2B,EAAA;AAC3C,IAAA,IAAA,CAAK,aAAgB,GAAA,KAAA;AACrB,IAAO,OAAA,IAAA;AAAA;AACT,EAEA,eAAe,KAAwB,EAAA;AACrC,IAAA,IAAA,CAAK,UAAa,GAAA,KAAA;AAClB,IAAO,OAAA,IAAA;AAAA;AACT,EAEA,eAAe,KAAmB,EAAA;AAChC,IAAA,IAAA,CAAK,UAAa,GAAA,KAAA;AAClB,IAAO,OAAA,IAAA;AAAA;AAEX","file":"base.mjs","sourcesContent":["import { IElement, Element } from '../base';\n\n/**\n * [SUPPORTED ONLY IN JAVASCRIPT SDK] Determines the position of the label. It can take 'inline' and 'above' values. By default, the label is placed 'above' when label position is not specified.\n */\nexport type InputLabelPosition = 'inline' | 'above';\n\n/**\n * [SUPPORTED ONLY IN JAVASCRIPT SDK] Style hint for input fields. Allows input fields to appear as read-only but when user clicks/focuses on the field, it allows them to update those fields.\n */\nexport type InputStyle = 'revealOnHover' | 'default';\n\nexport interface IInputElement extends IElement {\n /**\n * Error message to display when entered input is invalid\n */\n errorMessage?: string;\n\n /**\n * Whether or not this input is required\n */\n isRequired?: boolean;\n\n /**\n * Label for this input\n */\n label?: string;\n\n /**\n * [SUPPORTED ONLY IN JAVASCRIPT SDK] Determines the position of the label. It can take 'inline' and 'above' values. By default, the label is placed 'above' when label position is not specified.\n */\n labelPosition?: InputLabelPosition;\n\n /**\n * [SUPPORTED ONLY IN JAVASCRIPT SDK] Determines the width of the label in percent like 40 or a specific pixel width like ‘40px’ when label is placed inline with the input. labelWidth would be ignored when the label is displayed above the input.\n */\n labelWidth?: string | number;\n\n /**\n * [SUPPORTED ONLY IN JAVASCRIPT SDK] Style hint for input fields. Allows input fields to appear as read-only but when user clicks/focuses on the field, it allows them to update those fields.\n */\n inputStyle?: InputStyle;\n}\n\nexport class InputElement extends Element implements IInputElement {\n /**\n * Error message to display when entered input is invalid\n */\n errorMessage?: string;\n\n /**\n * Whether or not this input is required\n */\n isRequired?: boolean;\n\n /**\n * Label for this input\n */\n label?: string;\n\n /**\n * [SUPPORTED ONLY IN JAVASCRIPT SDK] Determines the position of the label. It can take 'inline' and 'above' values. By default, the label is placed 'above' when label position is not specified.\n */\n labelPosition?: InputLabelPosition;\n\n /**\n * [SUPPORTED ONLY IN JAVASCRIPT SDK] Determines the width of the label in percent like 40 or a specific pixel width like ‘40px’ when label is placed inline with the input. labelWidth would be ignored when the label is displayed above the input.\n */\n labelWidth?: string | number;\n\n /**\n * [SUPPORTED ONLY IN JAVASCRIPT SDK] Style hint for input fields. Allows input fields to appear as read-only but when user clicks/focuses on the field, it allows them to update those fields.\n */\n inputStyle?: InputStyle;\n\n constructor(options: Partial<IInputElement> = {}) {\n super(options);\n }\n\n withError(value: string) {\n this.errorMessage = value;\n return this;\n }\n\n withRequired(value = true) {\n this.isRequired = value;\n return this;\n }\n\n withLabel(value: string, position?: InputLabelPosition, width?: string | number) {\n this.label = value;\n this.labelPosition = position;\n this.labelWidth = width;\n return this;\n }\n\n withLabelPosition(value: InputLabelPosition) {\n this.labelPosition = value;\n return this;\n }\n\n withLabelWidth(value: string | number) {\n this.labelWidth = value;\n return this;\n }\n\n withInputStyle(value: InputStyle) {\n this.inputStyle = value;\n return this;\n }\n}\n"]}