From 19e40fe10a4bda2fb5e50a5a4ddb63b04746c4cb Mon Sep 17 00:00:00 2001 From: Dan Bucholtz Date: Mon, 20 Nov 2017 16:22:21 -0600 Subject: [PATCH] refactor(input): make the interfaces be in a .ts file so a corresponding .d.ts file is generated by the ts compiler --- packages/core/src/utils/input-interfaces.ts | 122 ++++++++++++++++++++ 1 file changed, 122 insertions(+) create mode 100644 packages/core/src/utils/input-interfaces.ts diff --git a/packages/core/src/utils/input-interfaces.ts b/packages/core/src/utils/input-interfaces.ts new file mode 100644 index 0000000000..b85f37ae03 --- /dev/null +++ b/packages/core/src/utils/input-interfaces.ts @@ -0,0 +1,122 @@ +import { EventEmitter } from '@stencil/core'; + + +export interface BaseInput { + + // Properties + // ------------------------ + + /** + * Indicates that the user cannot interact with the control. + */ + disabled: boolean; + + /** + * Returns / Sets the element's readonly attribute, indicating that + * the user cannot modify the value of the control. HTML5. This is + * ignored if the value of the type attribute is hidden, range, color, + * checkbox, radio, file, or a button type. + */ + readOnly?: boolean; + + /** + * Reflects the value of the form control. + */ + value: string; + + + // Events + // ------------------------ + + /** + * Removes focus from input; keystrokes will subsequently go nowhere. + */ + ionBlur: EventEmitter; + + /** + * Focus on the input element; keystrokes will subsequently go to this element. + */ + ionFocus: EventEmitter; + + /** + * Emitted when the styles change. This is useful for parent + * components to know how to style themselves depending on the + * child input. For example, a disabled ion-toggle may give + * its wrapping ion-item a different style. + */ + ionStyle: EventEmitter; + +} + + +export interface BooleanInput extends BaseInput { + /** + * Returns / Sets the current state of the element when type is checkbox or radio. + */ + checked: boolean; + + /** + * The change event is fired when the value of has changed. + * This is actually more similar to the native "input" event + * https://developer.mozilla.org/en-US/docs/Web/Events/input + */ + ionChange: EventEmitter; +} + + +export interface BooleanInputChangeEvent { + checked: boolean; +} + + +export interface SelectOptionInput extends BaseInput { + /** + * Indicates whether the option is currently selected. + */ + selected: boolean; + +} + + +export interface SelectInput extends BaseInput { + /** + * Indicates whether the option is currently selected. + */ + selected: boolean; + + /** + * A long reflecting the index of the first selected