UNPKG

@lion/ui

Version:

A package of extendable web components

109 lines (96 loc) 170 kB
--- parts: - API Table - Input File title: 'Input File: API Table' eleventyNavigation: key: API Table >> Input File title: API Table order: 90 parent: Input File --- # Input File: API Table ## class: `FileHandle` ### Fields | Name | Privacy | Type | Default | Description | Inherited From | | ----------------- | --------- | --------------- | ----------------- | ----------- | -------------- | | `failedProp` | public | `Array<string>` | `[]` | | | | `systemFile` | public | | `systemFile` | | | | `_acceptCriteria` | protected | | `_acceptCriteria` | | | ### Methods | Name | Privacy | Description | Parameters | Return | Inherited From | | ----------------------- | --------- | ----------- | ------------------ | -------- | -------------- | | `createDownloadUrl` | public | | `file: SystemFile` | | | | `uploadFileStatus` | public | | | | | | `_getFileNameExtension` | protected | | `fileName: string` | `string` | | <hr/> ## class: `LionInputFile`, `lion-input-file` ### Fields | Name | Privacy | Type | Default | Description | Inherited From | | ---------------------------- | --------- | ------------------------------------- | ----------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------- | | `accept` | public | `string` | `''` | | | | `allowCrossRootRegistration` | public | `boolean` | `false` | To encourage accessibility best practices, \`form-element-register\` events&#xA;do not pierce through shadow roots. This forces the developer to create form groups and fieldsets that automatically allow the creation of accessible relationships in the same dom tree.&#xA;Use this option if you know what you're doing. It will then be possible to nest FormControls&#xA;inside shadow dom. See https\://lion.js.org/fundamentals/rationales/accessibility/#shadow-roots-and-accessibility | LionField | | `autofocus` | public | `boolean` | `false` | | LionField | | `buttonLabel` | public | `string` | `''` | The label of the button | | | `defaultValidators` | public | `Validator[]` | `[]` | Used by Subclassers to add default Validators to a particular FormControl.&#xA;A date input for instance, always needs the isDate validator. | LionField | | `dirty` | public | `boolean` | `false` | True when user has changed the value of the field. | LionField | | `disabled` | public | `boolean` | `false` | | LionField | | `enableDropZone` | public | `boolean` | `false` | | | | `fieldName` | public | `string` | | Will be used in validation messages to refer to the current field | LionField | | `filled` | public | `boolean` | `false` | True when the modelValue is non-empty (see \_isEmpty in FormControlMixin) | LionField | | `focused` | public | `boolean` | `false` | Whether the focusable element within (\`.\_focusableNode\`) is focused.&#xA;Reflects to attribute '\[focused]' as a styling hook | LionField | | `focusedVisible` | public | `boolean` | `false` | Whether the focusable element within (\`.\_focusableNode\`) matches ':focus-visible'&#xA;Reflects to attribute '\[focused-visible]' as a styling hook&#xA;See: https\://developer.mozilla.org/en-US/docs/Web/CSS/:focus-visible | LionField | | `formatOn` | protected | `string` | `'change'` | Event that will trigger formatting (more precise, visual update of the view, so the&#xA;user sees the formatted value)&#xA;Default: 'change' | LionField | | `formatOptions` | public | | `({ mode: 'auto' })` | Configuration object that will be available inside the formatter function | LionField | | `formattedValue` | public | `string\|undefined` | `undefined` | The view value is the result of the formatter function (when available).&#xA;The result will be stored in the native \_inputNode (usually an input\[type=text]).&#xA;&#xA;Examples:&#xA;- For a date input, this would be '20/01/1999' (dependent on locale).&#xA;- For a number input, this could be '1,234.56' (a String representation of modelValue&#xA;1234.56) | LionField | | `hasFeedbackFor` | public | `ValidationType[]` | `[]` | As soon as validation happens (after modelValue/validators/validator param change), this&#xA;array is updated with the active ValidationTypes ('error'\|'warning'\|'success'\|'info' etc.).&#xA;Notice the difference with \`.showsFeedbackFor\`, which filters \`.hasFeedbackFor\` based on&#xA;\`.feedbackCondition()\`.&#xA;&#xA;For styling purposes, will be reflected to \[has-feedback-for="error warning"]. This can&#xA;be useful for subtle visual feedback on keyup, like a red/green border around an input. | LionField | | `helpText` | public | `string` | | The helpt text for the input node.&#xA;When no light dom defined via \[slot=help-text], this value will be used | LionField | | `isDragging` | public | `boolean` | | | | | `isPending` | public | `boolean` | `false` | Flag indicating whether async validation is pending.&#xA;Creates attribute \[is-pending] as a styling hook | LionField | | `label` | public | `string` | | The label text for the input node.&#xA;When no light dom defined via \[slot=label], this value will be used. | LionField | | `labelSrOnly` | public | `boolean` | `false` | The label will only be visible for srceen readers when true | LionField | | `maxFileSize` | public | `number` | `MAX_FILE_SIZE` | | | | `modelValue` | public | `InputFile[]` | `[]` | | LionField | | `multiple` | public | `boolean` | `false` | | | | `name` | public | `string` | `''` | The name the element will be registered with to the .formElements collection&#xA;of the parent. Also, it serves as the key of key/value pairs in&#xA; modelValue/serializedValue objects | LionField | | `operationMode` | public | `OperationMode` | | Types of input interaction of the FormControl (for instance 'enter'\|'select'\|'upload') | LionField | | `prefilled` | public | `boolean` | `false` | True when user has left non-empty field or input is prefilled.&#xA;The name must be seen from the point of view of the input field:&#xA;once the user enters the input field, the value is non-empty. | LionField | | `readOnly` | public | `boolean` | `false` | A Boolean attribute which, if present, indicates that the user should not be able to edit&#xA;the value of the input. The difference between disabled and readonly is that read-only&#xA;controls can still function, whereas disabled controls generally do not function as&#xA;controls until they are enabled.&#xA;(From: https\://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-readonly) | LionField | | `serializedValue` | public | `string\|undefined` | `undefined` | The serialized version of the model value.&#xA;This value exists for maximal compatibility with the platform API.&#xA;The serialized value can be an interface in context where data binding is not&#xA;supported and a serialized string needs to be set.&#xA;&#xA;Examples:&#xA;- For a date input, this would be the iso format of a date, e.g. '1999-01-20'.&#xA;- For a number input this would be the String representation of a float ('1234.56'&#xA; instead of 1234.56)&#xA;&#xA;When no parser is available, the value is usually the same as the formattedValue&#xA;(being \_inputNode.value) | LionField | | `showsFeedbackFor` | public | `ValidationType[]` | `[]` | Based on outcome of feedbackCondition, this array decides what ValidationTypes should be&#xA;shown in validationFeedback, based on meta data like interaction states.&#xA;&#xA;For styling purposes, it reflects it \`\[shows-feedback-for="error warning"]\` | LionField | | `slots` | public | | | Adds ".\_feedbackNode" as described below | LionField | | `submitted` | public | | | | LionField | | `touched` | public | `boolean` | `false` | True when user has focused and left(blurred) the field. | LionField | | `type` | public | `string` | `'file'` | | | | `uploadOnSelect` | public | `boolean` | `false` | | | | `uploadResponse` | public | `UploadResponse[]` | `[]` | | | | `validationStates` | public | `ValidationStates` | `{}` | The outcome of a validation 'round'. Keyed by ValidationType and Validator name | LionField | | `validators` | public | `Validator[]` | `[]` | Used by Application Developers to add Validators to a FormControl. | LionField | | `value` | public | | | The view value. Will be delegated to \`.\_inputNode.value\` | LionField | | `_acceptCriteria` | protected | | | | | | `_allValidators` | protected | `(Validator \| MetaValidator)[]` | | Combination of validators provided by Application Developer and the default validators | LionField | | `_ariaDescribedNodes` | public | `HTMLElement[]` | `[]` | Contains all elements that should end up in aria-describedby of \`.\_inputNode\` | LionField | | `_ariaLabelledNodes` | public | `HTMLElement[]` | `[]` | Contains all elements that should end up in aria-labelledby of \`.\_inputNode\` | LionField | | `_buttonNode` | protected | | | | | | `_feedbackConditionMeta` | protected | | | Allows Subclassers to add meta info for feedbackCondition | LionField | | `_feedbackNode` | protected | | | Element where validation feedback will be rendered to | LionField | | `_fileListNode` | protected | `LionSelectedFileList` | | | | | `_focusableNode` | protected | `HTMLElement` | | The focusable element:&#xA;could be an input, textarea, select, button or any other element with tabindex > -1 | LionField | | `_helpTextNode` | protected | | | Element where help text will be rendered to | LionField | | `_initialButtonLabel` | protected | `string` | `''` | | | | `_inputId` | protected | `string` | | Unique id that can be used in all light dom | LionField | | `_inputNode` | protected | `HTMLInputElement` | | The interactive (form) element. Can be a native element like input/textarea/select or&#xA;an element with tabindex > -1 | LionField | | `_isDragAndDropSupported` | protected | | | | | | `_isHandlingUserInput` | protected | `boolean` | `false` | Flag that will be set when user interaction takes place (for instance after an 'input'&#xA;event). Will be added as meta info to the \`model-value-changed\` event. Depending on&#xA;whether a user is interacting, formatting logic will be handled differently. | LionField | | `_isPasting` | protected | `boolean` | `false` | Whether the user is pasting content. Allows Subclassers to do this in their subclass: | LionField | | `_isRepropagationEndpoint` | public | `boolean` | `false` | By default, a field with \_repropagationRole 'choice-group' will act as an&#xA;'endpoint'. This means it will be considered as an individual field: for&#xA;a select, individual options will not be part of the formPath. They&#xA;will.&#xA;Similarly, components that (a11y wise) need to be fieldsets, but 'interaction wise'&#xA;(from Application Developer perspective) need to be more like fields&#xA;(think of an amount-input with a currency select box next to it), can set this&#xA;to true to hide private internals in the formPath. | LionField | | `_labelNode` | protected | | | Element where label will be rendered to | LionField | | `_leaveEvent` | protected | `string` | `'blur'` | The event that triggers the touched state | LionField | | `_parentFormGroup` | protected | `FormRegistrarHost \| undefined` | `undefined` | The registrar this FormControl registers to, Usually a descendant of FormGroup or&#xA;ChoiceGroup | LionField | | `_repropagationRole` | public | `'child'\|'choice-group'\|'fieldset'` | `'child'` | Based on the role, details of handling model-value-changed repropagation differ. | LionField | | `_requestedToBeDisabled` | protected | `boolean` | `false` | | LionField | | `_selectedFilesMetaData` | protected | `InputFile[]` | `[]` | | | | `_valueChangedEvent` | protected | `string` | `'model-value-changed'` | The event that triggers the dirty state | LionField | | `_visibleMessagesAmount` | protected | `number` | `1` | The amount of feedback messages that will visible in LionValidationFeedback | LionField | ### Methods | Name | Privacy | Description | Parameters