@open-formulieren/formio-builder
Version:
An opinionated Formio webform builder for Open Forms
27 lines (26 loc) • 1.07 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.applyInputMask = void 0;
/**
* This is Formio.js 4.13.x's input mask behaviour.
*
* It is known to have accessibility issues because the value is set, causing some
* screenreaders to read out the placeholders. For more information, see
* https://giovanicamara.com/blog/accessible-input-masking/
*
* This functionality only exists here to achieve feature parity with the native
* form builder, for the actual SDK/formio renderer, a better solution needs to be
* found.
*
* @deprecated Do not use this (anymore) for user-facing forms.
*
*/
// @ts-ignore there are no type definitions
const vanilla_text_mask_1 = require("@formio/vanilla-text-mask");
const formiojs_1 = require("formiojs");
const applyInputMask = (textValue, mask) => {
const options = { placeholderChar: '_' };
const result = (0, vanilla_text_mask_1.conformToMask)(textValue, formiojs_1.Utils.getInputMask(mask), options);
return result.conformedValue;
};
exports.applyInputMask = applyInputMask;