@elliemae/ds-form 3.2.0-rc.2 → 3.2.0-rc.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/FormItem/props.js +3 -1
- package/dist/cjs/FormItem/props.js.map +2 -2
- package/dist/cjs/InputMask/mask_types/DateInputMask.js +0 -36
- package/dist/cjs/InputMask/mask_types/DateInputMask.js.map +2 -2
- package/dist/cjs/InputMask/mask_types/DateTimeInputMask.js +0 -36
- package/dist/cjs/InputMask/mask_types/DateTimeInputMask.js.map +2 -2
- package/dist/cjs/InputMask/mask_types/DictionaryInputMask.js +0 -39
- package/dist/cjs/InputMask/mask_types/DictionaryInputMask.js.map +2 -2
- package/dist/cjs/InputMask/mask_types/NumberInputMask.js +0 -48
- package/dist/cjs/InputMask/mask_types/NumberInputMask.js.map +2 -2
- package/dist/cjs/InputMask/mask_types/PhoneInputMask.js +0 -36
- package/dist/cjs/InputMask/mask_types/PhoneInputMask.js.map +2 -2
- package/dist/cjs/InputMask/mask_types/PhoneInternationalInputMask.js +0 -36
- package/dist/cjs/InputMask/mask_types/PhoneInternationalInputMask.js.map +2 -2
- package/dist/cjs/InputMask/mask_types/SsnInputMask.js +0 -36
- package/dist/cjs/InputMask/mask_types/SsnInputMask.js.map +2 -2
- package/dist/cjs/InputMask/mask_types/UsZipCodeInputMask.js +0 -36
- package/dist/cjs/InputMask/mask_types/UsZipCodeInputMask.js.map +2 -2
- package/dist/cjs/InputMask/mask_types/ZipCodeSearchInputMask.js +0 -36
- package/dist/cjs/InputMask/mask_types/ZipCodeSearchInputMask.js.map +2 -2
- package/dist/cjs/InputMask/props.js +2 -1
- package/dist/cjs/InputMask/props.js.map +2 -2
- package/dist/cjs/InputProtected/props.js +4 -2
- package/dist/cjs/InputProtected/props.js.map +2 -2
- package/dist/cjs/Radio/DSRadio.js +6 -4
- package/dist/cjs/Radio/DSRadio.js.map +2 -2
- package/dist/esm/FormItem/props.js +3 -1
- package/dist/esm/FormItem/props.js.map +2 -2
- package/dist/esm/InputMask/mask_types/DateInputMask.js +0 -36
- package/dist/esm/InputMask/mask_types/DateInputMask.js.map +2 -2
- package/dist/esm/InputMask/mask_types/DateTimeInputMask.js +0 -36
- package/dist/esm/InputMask/mask_types/DateTimeInputMask.js.map +2 -2
- package/dist/esm/InputMask/mask_types/DictionaryInputMask.js +0 -39
- package/dist/esm/InputMask/mask_types/DictionaryInputMask.js.map +2 -2
- package/dist/esm/InputMask/mask_types/NumberInputMask.js +0 -48
- package/dist/esm/InputMask/mask_types/NumberInputMask.js.map +2 -2
- package/dist/esm/InputMask/mask_types/PhoneInputMask.js +0 -36
- package/dist/esm/InputMask/mask_types/PhoneInputMask.js.map +2 -2
- package/dist/esm/InputMask/mask_types/PhoneInternationalInputMask.js +0 -36
- package/dist/esm/InputMask/mask_types/PhoneInternationalInputMask.js.map +2 -2
- package/dist/esm/InputMask/mask_types/SsnInputMask.js +0 -36
- package/dist/esm/InputMask/mask_types/SsnInputMask.js.map +2 -2
- package/dist/esm/InputMask/mask_types/UsZipCodeInputMask.js +0 -36
- package/dist/esm/InputMask/mask_types/UsZipCodeInputMask.js.map +2 -2
- package/dist/esm/InputMask/mask_types/ZipCodeSearchInputMask.js +0 -36
- package/dist/esm/InputMask/mask_types/ZipCodeSearchInputMask.js.map +2 -2
- package/dist/esm/InputMask/props.js +2 -1
- package/dist/esm/InputMask/props.js.map +2 -2
- package/dist/esm/InputProtected/props.js +4 -2
- package/dist/esm/InputProtected/props.js.map +2 -2
- package/dist/esm/Radio/DSRadio.js +6 -4
- package/dist/esm/Radio/DSRadio.js.map +2 -2
- package/package.json +12 -12
|
@@ -55,7 +55,6 @@ __export(PhoneInternationalInputMask_exports, {
|
|
|
55
55
|
module.exports = __toCommonJS(PhoneInternationalInputMask_exports);
|
|
56
56
|
var React = __toESM(require("react"));
|
|
57
57
|
var import_react = __toESM(require("react"));
|
|
58
|
-
var import_ds_utilities = require("@elliemae/ds-utilities");
|
|
59
58
|
var import_TextBox = require("../../TextBox");
|
|
60
59
|
var import_setCaretPosition = require("../utils/setCaretPosition");
|
|
61
60
|
const conformValue = (rawValue, cursorPos, lastkeycode) => {
|
|
@@ -235,40 +234,5 @@ const PhoneInternationalInputMask = (_a) => {
|
|
|
235
234
|
value: maskedValue
|
|
236
235
|
}));
|
|
237
236
|
};
|
|
238
|
-
PhoneInternationalInputMask.propTypes = {
|
|
239
|
-
focus: import_ds_utilities.PropTypes.bool,
|
|
240
|
-
setFocus: import_ds_utilities.PropTypes.func,
|
|
241
|
-
setRawMask: import_ds_utilities.PropTypes.func,
|
|
242
|
-
cursorPosition: import_ds_utilities.PropTypes.shape({ current: import_ds_utilities.PropTypes.number }),
|
|
243
|
-
setCursorPosition: import_ds_utilities.PropTypes.func,
|
|
244
|
-
lastkey: import_ds_utilities.PropTypes.shape({ code: import_ds_utilities.PropTypes.number, key: import_ds_utilities.PropTypes.string }),
|
|
245
|
-
setLastkey: import_ds_utilities.PropTypes.func,
|
|
246
|
-
setRawValue: import_ds_utilities.PropTypes.func,
|
|
247
|
-
style: import_ds_utilities.PropTypes.object,
|
|
248
|
-
disabled: import_ds_utilities.PropTypes.bool,
|
|
249
|
-
className: import_ds_utilities.PropTypes.string,
|
|
250
|
-
name: import_ds_utilities.PropTypes.string,
|
|
251
|
-
maxLength: import_ds_utilities.PropTypes.number,
|
|
252
|
-
minLength: import_ds_utilities.PropTypes.number,
|
|
253
|
-
fluidWidth: import_ds_utilities.PropTypes.bool,
|
|
254
|
-
placeholder: import_ds_utilities.PropTypes.string,
|
|
255
|
-
value: import_ds_utilities.PropTypes.string,
|
|
256
|
-
onChange: import_ds_utilities.PropTypes.func,
|
|
257
|
-
onKeyDown: import_ds_utilities.PropTypes.func,
|
|
258
|
-
leftComponent: import_ds_utilities.PropTypes.element,
|
|
259
|
-
rightComponent: import_ds_utilities.PropTypes.element,
|
|
260
|
-
onFocus: import_ds_utilities.PropTypes.func,
|
|
261
|
-
onBlur: import_ds_utilities.PropTypes.func,
|
|
262
|
-
onPaste: import_ds_utilities.PropTypes.func,
|
|
263
|
-
onKeyUp: import_ds_utilities.PropTypes.func,
|
|
264
|
-
hasError: import_ds_utilities.PropTypes.bool,
|
|
265
|
-
readOnly: import_ds_utilities.PropTypes.bool,
|
|
266
|
-
onClick: import_ds_utilities.PropTypes.func,
|
|
267
|
-
clearable: import_ds_utilities.PropTypes.bool,
|
|
268
|
-
type: import_ds_utilities.PropTypes.string,
|
|
269
|
-
innerRef: import_ds_utilities.PropTypes.any,
|
|
270
|
-
mask: import_ds_utilities.PropTypes.any,
|
|
271
|
-
placeholderChar: import_ds_utilities.PropTypes.string
|
|
272
|
-
};
|
|
273
237
|
var PhoneInternationalInputMask_default = PhoneInternationalInputMask;
|
|
274
238
|
//# sourceMappingURL=PhoneInternationalInputMask.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/InputMask/mask_types/PhoneInternationalInputMask.tsx", "../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable max-lines */\n/* eslint-disable complexity */\nimport React, { useCallback, useLayoutEffect, useRef, useState } from 'react';\nimport { PropTypes } from '@elliemae/ds-utilities';\nimport { DSTextBox } from '../../TextBox';\nimport { TCharsToAdd } from '../types';\nimport { setCaretPosition } from '../utils/setCaretPosition';\n\nconst conformValue = (rawValue, cursorPos, lastkeycode) => {\n let nextMaskedValue = rawValue\n .split('+1')\n .slice(-1)[0]\n .split('')\n .filter((char) => char >= '0' && char <= '9');\n\n while (nextMaskedValue.length && nextMaskedValue[0] === '0')\n nextMaskedValue.splice(0, 1);\n\n nextMaskedValue = nextMaskedValue.slice(0, 10);\n\n let maskedPos = 0;\n for (let i = 0; i < cursorPos; i += 1) {\n if (nextMaskedValue[maskedPos] === rawValue[i]) maskedPos += 1;\n }\n\n // list of [string to add, position to add]\nconst charactersToAdd: TCharsToAdd = [\n ['+1 (', 0],\n [') ', 7],\n ['-', 12],\n ];\n\n charactersToAdd.forEach(([chars, pos]) => {\n if (nextMaskedValue.length > pos) {\n nextMaskedValue.splice(pos, 0, ...chars);\n if (maskedPos >= pos) maskedPos += chars.length;\n }\n });\n\n if (lastkeycode !== 8 && maskedPos < nextMaskedValue.length) {\n charactersToAdd.forEach(([chars, pos]) => {\n if (maskedPos === pos) maskedPos += chars.length;\n });\n } else if (lastkeycode === 8 && maskedPos) {\n charactersToAdd.forEach(([chars, pos]) => {\n if (maskedPos === pos + 1) maskedPos -= chars.length;\n });\n }\n return { nextMaskedValue: nextMaskedValue.join(''), maskedPos };\n};\n\nconst PhoneInternationalInputMask = ({\n focus,\n setFocus,\n setRawMask,\n cursorPosition,\n setCursorPosition,\n lastkey,\n setLastkey,\n setRawValue,\n style,\n disabled,\n className,\n name,\n maxLength,\n minLength,\n fluidWidth,\n placeholder,\n onKeyDown,\n onClick,\n onChange,\n onFocus,\n onBlur,\n onPaste,\n onKeyUp,\n hasError,\n readOnly,\n type,\n innerRef,\n clearable = false,\n leftComponent,\n rightComponent,\n value,\n ...rest\n}) => {\n const inputRef = useRef();\n const [maskedValue, setMaskedValue] = useState(value);\n\n const conform = useCallback(\n ({ rawValue, cursorPos, lastkeycode, shouldUpdateCursorPos = true }) => {\n const { nextMaskedValue, maskedPos } = conformValue(\n rawValue,\n cursorPos,\n lastkeycode,\n );\n const event = {\n target: {\n value: nextMaskedValue,\n originalValue: rawValue,\n },\n };\n if (onChange && nextMaskedValue !== maskedValue) onChange(event);\n\n setMaskedValue(nextMaskedValue);\n setRawValue(nextMaskedValue);\n\n if (shouldUpdateCursorPos) setCursorPosition({ current: maskedPos });\n },\n [maskedValue, onChange],\n );\n\n const handleOnChange = useCallback(\n (e) => {\n const { value: rawValue, selectionEnd } = e.target;\n setRawMask(rawValue);\n setRawValue(rawValue);\n setCursorPosition({ current: selectionEnd });\n setFocus(true);\n },\n [setRawMask, setRawValue, setCursorPosition, setFocus, lastkey.code],\n );\n\n useLayoutEffect(() => {\n if (focus) setCaretPosition(inputRef.current, cursorPosition.current);\n }, [focus, cursorPosition]);\n\n useLayoutEffect(() => {\n // if the value changes, then re-conform the mask\n conform({\n rawValue: value,\n cursorPos: cursorPosition.current,\n lastkeycode: lastkey.code,\n shouldUpdateCursorPos: focus,\n });\n }, [focus, value, cursorPosition.current]);\n\n const handleKeyDown = useCallback(\n (e) => {\n e.stopPropagation();\n setLastkey({ key: e.key, code: e.keyCode });\n onKeyDown(e);\n },\n [onKeyDown],\n );\n\n const handleBlur = useCallback(\n (e) => {\n setFocus(false);\n onBlur(e);\n },\n [onBlur],\n );\n\n return (\n <DSTextBox\n {...rest}\n className={className}\n clearable={clearable}\n disabled={disabled}\n fluidWidth={fluidWidth}\n hasError={hasError}\n innerRef={(ref) => {\n inputRef.current = ref;\n if (innerRef) innerRef(ref);\n }}\n isActive={focus}\n leftComponent={leftComponent}\n maxLength={maxLength}\n minLength={minLength}\n name={name}\n onBlur={handleBlur}\n onChange={handleOnChange}\n onClick={onClick}\n onFocus={onFocus}\n onKeyDown={handleKeyDown}\n onKeyUp={onKeyUp}\n onPaste={onPaste}\n placeholder={placeholder}\n readOnly={readOnly}\n rightComponent={rightComponent}\n style={style}\n type={type}\n value={maskedValue}\n />\n );\n};\n\
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADEvB,mBAAsE;
|
|
4
|
+
"sourcesContent": ["/* eslint-disable max-lines */\n/* eslint-disable complexity */\nimport React, { useCallback, useLayoutEffect, useRef, useState } from 'react';\nimport { PropTypes } from '@elliemae/ds-utilities';\nimport { DSTextBox } from '../../TextBox';\nimport { TCharsToAdd } from '../types';\nimport { setCaretPosition } from '../utils/setCaretPosition';\n\nconst conformValue = (rawValue, cursorPos, lastkeycode) => {\n let nextMaskedValue = rawValue\n .split('+1')\n .slice(-1)[0]\n .split('')\n .filter((char) => char >= '0' && char <= '9');\n\n while (nextMaskedValue.length && nextMaskedValue[0] === '0')\n nextMaskedValue.splice(0, 1);\n\n nextMaskedValue = nextMaskedValue.slice(0, 10);\n\n let maskedPos = 0;\n for (let i = 0; i < cursorPos; i += 1) {\n if (nextMaskedValue[maskedPos] === rawValue[i]) maskedPos += 1;\n }\n\n // list of [string to add, position to add]\nconst charactersToAdd: TCharsToAdd = [\n ['+1 (', 0],\n [') ', 7],\n ['-', 12],\n ];\n\n charactersToAdd.forEach(([chars, pos]) => {\n if (nextMaskedValue.length > pos) {\n nextMaskedValue.splice(pos, 0, ...chars);\n if (maskedPos >= pos) maskedPos += chars.length;\n }\n });\n\n if (lastkeycode !== 8 && maskedPos < nextMaskedValue.length) {\n charactersToAdd.forEach(([chars, pos]) => {\n if (maskedPos === pos) maskedPos += chars.length;\n });\n } else if (lastkeycode === 8 && maskedPos) {\n charactersToAdd.forEach(([chars, pos]) => {\n if (maskedPos === pos + 1) maskedPos -= chars.length;\n });\n }\n return { nextMaskedValue: nextMaskedValue.join(''), maskedPos };\n};\n\nconst PhoneInternationalInputMask = ({\n focus,\n setFocus,\n setRawMask,\n cursorPosition,\n setCursorPosition,\n lastkey,\n setLastkey,\n setRawValue,\n style,\n disabled,\n className,\n name,\n maxLength,\n minLength,\n fluidWidth,\n placeholder,\n onKeyDown,\n onClick,\n onChange,\n onFocus,\n onBlur,\n onPaste,\n onKeyUp,\n hasError,\n readOnly,\n type,\n innerRef,\n clearable = false,\n leftComponent,\n rightComponent,\n value,\n ...rest\n}) => {\n const inputRef = useRef();\n const [maskedValue, setMaskedValue] = useState(value);\n\n const conform = useCallback(\n ({ rawValue, cursorPos, lastkeycode, shouldUpdateCursorPos = true }) => {\n const { nextMaskedValue, maskedPos } = conformValue(\n rawValue,\n cursorPos,\n lastkeycode,\n );\n const event = {\n target: {\n value: nextMaskedValue,\n originalValue: rawValue,\n },\n };\n if (onChange && nextMaskedValue !== maskedValue) onChange(event);\n\n setMaskedValue(nextMaskedValue);\n setRawValue(nextMaskedValue);\n\n if (shouldUpdateCursorPos) setCursorPosition({ current: maskedPos });\n },\n [maskedValue, onChange],\n );\n\n const handleOnChange = useCallback(\n (e) => {\n const { value: rawValue, selectionEnd } = e.target;\n setRawMask(rawValue);\n setRawValue(rawValue);\n setCursorPosition({ current: selectionEnd });\n setFocus(true);\n },\n [setRawMask, setRawValue, setCursorPosition, setFocus, lastkey.code],\n );\n\n useLayoutEffect(() => {\n if (focus) setCaretPosition(inputRef.current, cursorPosition.current);\n }, [focus, cursorPosition]);\n\n useLayoutEffect(() => {\n // if the value changes, then re-conform the mask\n conform({\n rawValue: value,\n cursorPos: cursorPosition.current,\n lastkeycode: lastkey.code,\n shouldUpdateCursorPos: focus,\n });\n }, [focus, value, cursorPosition.current]);\n\n const handleKeyDown = useCallback(\n (e) => {\n e.stopPropagation();\n setLastkey({ key: e.key, code: e.keyCode });\n onKeyDown(e);\n },\n [onKeyDown],\n );\n\n const handleBlur = useCallback(\n (e) => {\n setFocus(false);\n onBlur(e);\n },\n [onBlur],\n );\n\n return (\n <DSTextBox\n {...rest}\n className={className}\n clearable={clearable}\n disabled={disabled}\n fluidWidth={fluidWidth}\n hasError={hasError}\n innerRef={(ref) => {\n inputRef.current = ref;\n if (innerRef) innerRef(ref);\n }}\n isActive={focus}\n leftComponent={leftComponent}\n maxLength={maxLength}\n minLength={minLength}\n name={name}\n onBlur={handleBlur}\n onChange={handleOnChange}\n onClick={onClick}\n onFocus={onFocus}\n onKeyDown={handleKeyDown}\n onKeyUp={onKeyUp}\n onPaste={onPaste}\n placeholder={placeholder}\n readOnly={readOnly}\n rightComponent={rightComponent}\n style={style}\n type={type}\n value={maskedValue}\n />\n );\n};\n\nexport { PhoneInternationalInputMask };\nexport default PhoneInternationalInputMask;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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A,IAAO,sCAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -55,7 +55,6 @@ __export(SsnInputMask_exports, {
|
|
|
55
55
|
module.exports = __toCommonJS(SsnInputMask_exports);
|
|
56
56
|
var React = __toESM(require("react"));
|
|
57
57
|
var import_react = __toESM(require("react"));
|
|
58
|
-
var import_ds_utilities = require("@elliemae/ds-utilities");
|
|
59
58
|
var import_TextBox = require("../../TextBox");
|
|
60
59
|
var import_setCaretPosition = require("../utils/setCaretPosition");
|
|
61
60
|
const conformValue = (rawValue, cursorPos, lastkeycode) => {
|
|
@@ -231,40 +230,5 @@ const SsnInputMask = (_a) => {
|
|
|
231
230
|
value: maskedValue
|
|
232
231
|
}));
|
|
233
232
|
};
|
|
234
|
-
SsnInputMask.propTypes = {
|
|
235
|
-
focus: import_ds_utilities.PropTypes.bool,
|
|
236
|
-
setFocus: import_ds_utilities.PropTypes.func,
|
|
237
|
-
setRawMask: import_ds_utilities.PropTypes.func,
|
|
238
|
-
cursorPosition: import_ds_utilities.PropTypes.shape({ current: import_ds_utilities.PropTypes.number }),
|
|
239
|
-
setCursorPosition: import_ds_utilities.PropTypes.func,
|
|
240
|
-
lastkey: import_ds_utilities.PropTypes.shape({ code: import_ds_utilities.PropTypes.number, key: import_ds_utilities.PropTypes.string }),
|
|
241
|
-
setLastkey: import_ds_utilities.PropTypes.func,
|
|
242
|
-
setRawValue: import_ds_utilities.PropTypes.func,
|
|
243
|
-
style: import_ds_utilities.PropTypes.object,
|
|
244
|
-
disabled: import_ds_utilities.PropTypes.bool,
|
|
245
|
-
className: import_ds_utilities.PropTypes.string,
|
|
246
|
-
name: import_ds_utilities.PropTypes.string,
|
|
247
|
-
maxLength: import_ds_utilities.PropTypes.number,
|
|
248
|
-
minLength: import_ds_utilities.PropTypes.number,
|
|
249
|
-
fluidWidth: import_ds_utilities.PropTypes.bool,
|
|
250
|
-
placeholder: import_ds_utilities.PropTypes.string,
|
|
251
|
-
value: import_ds_utilities.PropTypes.string,
|
|
252
|
-
onChange: import_ds_utilities.PropTypes.func,
|
|
253
|
-
onKeyDown: import_ds_utilities.PropTypes.func,
|
|
254
|
-
leftComponent: import_ds_utilities.PropTypes.element,
|
|
255
|
-
rightComponent: import_ds_utilities.PropTypes.element,
|
|
256
|
-
onFocus: import_ds_utilities.PropTypes.func,
|
|
257
|
-
onBlur: import_ds_utilities.PropTypes.func,
|
|
258
|
-
onPaste: import_ds_utilities.PropTypes.func,
|
|
259
|
-
onKeyUp: import_ds_utilities.PropTypes.func,
|
|
260
|
-
hasError: import_ds_utilities.PropTypes.bool,
|
|
261
|
-
readOnly: import_ds_utilities.PropTypes.bool,
|
|
262
|
-
onClick: import_ds_utilities.PropTypes.func,
|
|
263
|
-
clearable: import_ds_utilities.PropTypes.bool,
|
|
264
|
-
type: import_ds_utilities.PropTypes.string,
|
|
265
|
-
innerRef: import_ds_utilities.PropTypes.any,
|
|
266
|
-
mask: import_ds_utilities.PropTypes.any,
|
|
267
|
-
placeholderChar: import_ds_utilities.PropTypes.string
|
|
268
|
-
};
|
|
269
233
|
var SsnInputMask_default = SsnInputMask;
|
|
270
234
|
//# sourceMappingURL=SsnInputMask.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/InputMask/mask_types/SsnInputMask.tsx", "../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable max-lines */\n/* eslint-disable complexity */\nimport React, { useCallback, useLayoutEffect, useRef, useState } from 'react';\nimport { PropTypes } from '@elliemae/ds-utilities';\nimport { DSTextBox } from '../../TextBox';\nimport { TCharsToAdd } from '../types';\nimport { setCaretPosition } from '../utils/setCaretPosition';\n\nconst conformValue = (rawValue, cursorPos, lastkeycode) => {\n const nextMaskedValue = rawValue\n .split('')\n .filter((char) => char >= '0' && char <= '9')\n .slice(0, 9);\n\n let maskedPos = 0;\n for (let i = 0; i < cursorPos; i += 1) {\n if (nextMaskedValue[maskedPos] === rawValue[i]) maskedPos += 1;\n }\n\n // list of [string to add, position to add]\nconst charactersToAdd: TCharsToAdd = [\n ['-', 3],\n ['-', 6],\n ];\n\n charactersToAdd.forEach(([chars, pos]) => {\n if (nextMaskedValue.length > pos) {\n nextMaskedValue.splice(pos, 0, ...chars);\n if (maskedPos >= pos) maskedPos += chars.length;\n }\n });\n\n if (lastkeycode !== 8 && maskedPos < nextMaskedValue.length) {\n charactersToAdd.forEach(([chars, pos]) => {\n if (maskedPos === pos) maskedPos += chars.length;\n });\n } else if (lastkeycode === 8 && maskedPos) {\n charactersToAdd.forEach(([chars, pos]) => {\n if (maskedPos === pos + 1) maskedPos -= chars.length;\n });\n }\n return { nextMaskedValue: nextMaskedValue.join(''), maskedPos };\n};\n\nconst SsnInputMask = ({\n focus,\n setFocus,\n setRawMask,\n cursorPosition,\n setCursorPosition,\n lastkey,\n setLastkey,\n setRawValue,\n style,\n disabled,\n className,\n name,\n maxLength,\n minLength,\n fluidWidth,\n placeholder,\n onKeyDown,\n onClick,\n onChange,\n onFocus,\n onBlur,\n onPaste,\n onKeyUp,\n hasError,\n readOnly,\n type,\n innerRef,\n clearable = false,\n leftComponent,\n rightComponent,\n value,\n ...rest\n}) => {\n const inputRef = useRef();\n const [maskedValue, setMaskedValue] = useState(value);\n\n const conform = useCallback(\n ({ rawValue, cursorPos, lastkeycode, shouldUpdateCursorPos = true }) => {\n const { nextMaskedValue, maskedPos } = conformValue(\n rawValue,\n cursorPos,\n lastkeycode,\n );\n const event = {\n target: {\n value: nextMaskedValue,\n originalValue: rawValue,\n },\n };\n if (onChange && nextMaskedValue !== maskedValue) onChange(event);\n\n setMaskedValue(nextMaskedValue);\n setRawValue(nextMaskedValue);\n\n if (shouldUpdateCursorPos) setCursorPosition({ current: maskedPos });\n },\n [maskedValue, onChange],\n );\n\n const handleOnChange = useCallback(\n (e) => {\n const { value: rawValue, selectionEnd } = e.target;\n setRawMask(rawValue);\n setRawValue(rawValue);\n setCursorPosition({ current: selectionEnd });\n setFocus(true);\n },\n [setRawMask, setRawValue, setCursorPosition, setFocus, lastkey.code],\n );\n\n useLayoutEffect(() => {\n if (focus) setCaretPosition(inputRef.current, cursorPosition.current);\n }, [focus, cursorPosition]);\n\n useLayoutEffect(() => {\n // if the value changes, then re-conform the mask\n conform({\n rawValue: value,\n cursorPos: cursorPosition.current,\n lastkeycode: lastkey.code,\n shouldUpdateCursorPos: focus,\n });\n }, [focus, value, cursorPosition.current]);\n\n const handleKeyDown = useCallback(\n (e) => {\n e.stopPropagation();\n setLastkey({ key: e.key, code: e.keyCode });\n onKeyDown(e);\n },\n [onKeyDown],\n );\n\n const handleBlur = useCallback(\n (e) => {\n setFocus(false);\n onBlur(e);\n },\n [onBlur],\n );\n\n return (\n <DSTextBox\n {...rest}\n className={className}\n clearable={clearable}\n disabled={disabled}\n fluidWidth={fluidWidth}\n hasError={hasError}\n innerRef={(ref) => {\n inputRef.current = ref;\n if (innerRef) innerRef(ref);\n }}\n isActive={focus}\n leftComponent={leftComponent}\n maxLength={maxLength}\n minLength={minLength}\n name={name}\n onBlur={handleBlur}\n onChange={handleOnChange}\n onClick={onClick}\n onFocus={onFocus}\n onKeyDown={handleKeyDown}\n onKeyUp={onKeyUp}\n onPaste={onPaste}\n placeholder={placeholder}\n readOnly={readOnly}\n rightComponent={rightComponent}\n style={style}\n type={type}\n value={maskedValue}\n />\n );\n};\n\
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADEvB,mBAAsE;
|
|
4
|
+
"sourcesContent": ["/* eslint-disable max-lines */\n/* eslint-disable complexity */\nimport React, { useCallback, useLayoutEffect, useRef, useState } from 'react';\nimport { PropTypes } from '@elliemae/ds-utilities';\nimport { DSTextBox } from '../../TextBox';\nimport { TCharsToAdd } from '../types';\nimport { setCaretPosition } from '../utils/setCaretPosition';\n\nconst conformValue = (rawValue, cursorPos, lastkeycode) => {\n const nextMaskedValue = rawValue\n .split('')\n .filter((char) => char >= '0' && char <= '9')\n .slice(0, 9);\n\n let maskedPos = 0;\n for (let i = 0; i < cursorPos; i += 1) {\n if (nextMaskedValue[maskedPos] === rawValue[i]) maskedPos += 1;\n }\n\n // list of [string to add, position to add]\nconst charactersToAdd: TCharsToAdd = [\n ['-', 3],\n ['-', 6],\n ];\n\n charactersToAdd.forEach(([chars, pos]) => {\n if (nextMaskedValue.length > pos) {\n nextMaskedValue.splice(pos, 0, ...chars);\n if (maskedPos >= pos) maskedPos += chars.length;\n }\n });\n\n if (lastkeycode !== 8 && maskedPos < nextMaskedValue.length) {\n charactersToAdd.forEach(([chars, pos]) => {\n if (maskedPos === pos) maskedPos += chars.length;\n });\n } else if (lastkeycode === 8 && maskedPos) {\n charactersToAdd.forEach(([chars, pos]) => {\n if (maskedPos === pos + 1) maskedPos -= chars.length;\n });\n }\n return { nextMaskedValue: nextMaskedValue.join(''), maskedPos };\n};\n\nconst SsnInputMask = ({\n focus,\n setFocus,\n setRawMask,\n cursorPosition,\n setCursorPosition,\n lastkey,\n setLastkey,\n setRawValue,\n style,\n disabled,\n className,\n name,\n maxLength,\n minLength,\n fluidWidth,\n placeholder,\n onKeyDown,\n onClick,\n onChange,\n onFocus,\n onBlur,\n onPaste,\n onKeyUp,\n hasError,\n readOnly,\n type,\n innerRef,\n clearable = false,\n leftComponent,\n rightComponent,\n value,\n ...rest\n}) => {\n const inputRef = useRef();\n const [maskedValue, setMaskedValue] = useState(value);\n\n const conform = useCallback(\n ({ rawValue, cursorPos, lastkeycode, shouldUpdateCursorPos = true }) => {\n const { nextMaskedValue, maskedPos } = conformValue(\n rawValue,\n cursorPos,\n lastkeycode,\n );\n const event = {\n target: {\n value: nextMaskedValue,\n originalValue: rawValue,\n },\n };\n if (onChange && nextMaskedValue !== maskedValue) onChange(event);\n\n setMaskedValue(nextMaskedValue);\n setRawValue(nextMaskedValue);\n\n if (shouldUpdateCursorPos) setCursorPosition({ current: maskedPos });\n },\n [maskedValue, onChange],\n );\n\n const handleOnChange = useCallback(\n (e) => {\n const { value: rawValue, selectionEnd } = e.target;\n setRawMask(rawValue);\n setRawValue(rawValue);\n setCursorPosition({ current: selectionEnd });\n setFocus(true);\n },\n [setRawMask, setRawValue, setCursorPosition, setFocus, lastkey.code],\n );\n\n useLayoutEffect(() => {\n if (focus) setCaretPosition(inputRef.current, cursorPosition.current);\n }, [focus, cursorPosition]);\n\n useLayoutEffect(() => {\n // if the value changes, then re-conform the mask\n conform({\n rawValue: value,\n cursorPos: cursorPosition.current,\n lastkeycode: lastkey.code,\n shouldUpdateCursorPos: focus,\n });\n }, [focus, value, cursorPosition.current]);\n\n const handleKeyDown = useCallback(\n (e) => {\n e.stopPropagation();\n setLastkey({ key: e.key, code: e.keyCode });\n onKeyDown(e);\n },\n [onKeyDown],\n );\n\n const handleBlur = useCallback(\n (e) => {\n setFocus(false);\n onBlur(e);\n },\n [onBlur],\n );\n\n return (\n <DSTextBox\n {...rest}\n className={className}\n clearable={clearable}\n disabled={disabled}\n fluidWidth={fluidWidth}\n hasError={hasError}\n innerRef={(ref) => {\n inputRef.current = ref;\n if (innerRef) innerRef(ref);\n }}\n isActive={focus}\n leftComponent={leftComponent}\n maxLength={maxLength}\n minLength={minLength}\n name={name}\n onBlur={handleBlur}\n onChange={handleOnChange}\n onClick={onClick}\n onFocus={onFocus}\n onKeyDown={handleKeyDown}\n onKeyUp={onKeyUp}\n onPaste={onPaste}\n placeholder={placeholder}\n readOnly={readOnly}\n rightComponent={rightComponent}\n style={style}\n type={type}\n value={maskedValue}\n />\n );\n};\n\nexport { SsnInputMask };\nexport default SsnInputMask;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;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AAEA,oCAAgB,MAAM;AACpB,QAAI;AAAO,oDAAiB,SAAS,SAAS,eAAe,OAAO;AAAA,EACtE,GAAG,CAAC,OAAO,cAAc,CAAC;AAE1B,oCAAgB,MAAM;AAEpB,YAAQ;AAAA,MACN,UAAU;AAAA,MACV,WAAW,eAAe;AAAA,MAC1B,aAAa,QAAQ;AAAA,MACrB,uBAAuB;AAAA,IACzB,CAAC;AAAA,EACH,GAAG,CAAC,OAAO,OAAO,eAAe,OAAO,CAAC;AAEzC,QAAM,gBAAgB,8BACpB,CAAC,MAAM;AACL,MAAE,gBAAgB;AAClB,eAAW,EAAE,KAAK,EAAE,KAAK,MAAM,EAAE,QAAQ,CAAC;AAC1C,cAAU,CAAC;AAAA,EACb,GACA,CAAC,SAAS,CACZ;AAEA,QAAM,aAAa,8BACjB,CAAC,MAAM;AACL,aAAS,KAAK;AACd,WAAO,CAAC;AAAA,EACV,GACA,CAAC,MAAM,CACT;AAEA,SACE,mDAAC,2DACK,OADL;AAAA,IAEC;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,UAAU,CAAC,QAAQ;AACjB,eAAS,UAAU;AACnB,UAAI;AAAU,iBAAS,GAAG;AAAA,IAC5B;AAAA,IACA,UAAU;AAAA,IACV;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,QAAQ;AAAA,IACR,UAAU;AAAA,IACV;AAAA,IACA;AAAA,IACA,WAAW;AAAA,IACX;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,OAAO;AAAA,IACT;AAEJ;AAGA,IAAO,uBAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -55,7 +55,6 @@ __export(UsZipCodeInputMask_exports, {
|
|
|
55
55
|
module.exports = __toCommonJS(UsZipCodeInputMask_exports);
|
|
56
56
|
var React = __toESM(require("react"));
|
|
57
57
|
var import_react = __toESM(require("react"));
|
|
58
|
-
var import_ds_utilities = require("@elliemae/ds-utilities");
|
|
59
58
|
var import_TextBox = require("../../TextBox");
|
|
60
59
|
var import_setCaretPosition = require("../utils/setCaretPosition");
|
|
61
60
|
const conformValue = (rawValue, cursorPos) => {
|
|
@@ -209,40 +208,5 @@ const UsZipCodeInputMask = (_a) => {
|
|
|
209
208
|
value: maskedValue
|
|
210
209
|
}));
|
|
211
210
|
};
|
|
212
|
-
UsZipCodeInputMask.propTypes = {
|
|
213
|
-
focus: import_ds_utilities.PropTypes.bool,
|
|
214
|
-
setFocus: import_ds_utilities.PropTypes.func,
|
|
215
|
-
setRawMask: import_ds_utilities.PropTypes.func,
|
|
216
|
-
cursorPosition: import_ds_utilities.PropTypes.shape({ current: import_ds_utilities.PropTypes.number }),
|
|
217
|
-
setCursorPosition: import_ds_utilities.PropTypes.func,
|
|
218
|
-
lastkey: import_ds_utilities.PropTypes.shape({ code: import_ds_utilities.PropTypes.number, key: import_ds_utilities.PropTypes.string }),
|
|
219
|
-
setLastkey: import_ds_utilities.PropTypes.func,
|
|
220
|
-
setRawValue: import_ds_utilities.PropTypes.func,
|
|
221
|
-
style: import_ds_utilities.PropTypes.object,
|
|
222
|
-
disabled: import_ds_utilities.PropTypes.bool,
|
|
223
|
-
className: import_ds_utilities.PropTypes.string,
|
|
224
|
-
name: import_ds_utilities.PropTypes.string,
|
|
225
|
-
maxLength: import_ds_utilities.PropTypes.number,
|
|
226
|
-
minLength: import_ds_utilities.PropTypes.number,
|
|
227
|
-
fluidWidth: import_ds_utilities.PropTypes.bool,
|
|
228
|
-
placeholder: import_ds_utilities.PropTypes.string,
|
|
229
|
-
value: import_ds_utilities.PropTypes.string,
|
|
230
|
-
onChange: import_ds_utilities.PropTypes.func,
|
|
231
|
-
onKeyDown: import_ds_utilities.PropTypes.func,
|
|
232
|
-
leftComponent: import_ds_utilities.PropTypes.element,
|
|
233
|
-
rightComponent: import_ds_utilities.PropTypes.element,
|
|
234
|
-
onFocus: import_ds_utilities.PropTypes.func,
|
|
235
|
-
onBlur: import_ds_utilities.PropTypes.func,
|
|
236
|
-
onPaste: import_ds_utilities.PropTypes.func,
|
|
237
|
-
onKeyUp: import_ds_utilities.PropTypes.func,
|
|
238
|
-
hasError: import_ds_utilities.PropTypes.bool,
|
|
239
|
-
readOnly: import_ds_utilities.PropTypes.bool,
|
|
240
|
-
onClick: import_ds_utilities.PropTypes.func,
|
|
241
|
-
clearable: import_ds_utilities.PropTypes.bool,
|
|
242
|
-
type: import_ds_utilities.PropTypes.string,
|
|
243
|
-
innerRef: import_ds_utilities.PropTypes.any,
|
|
244
|
-
mask: import_ds_utilities.PropTypes.any,
|
|
245
|
-
placeholderChar: import_ds_utilities.PropTypes.string
|
|
246
|
-
};
|
|
247
211
|
var UsZipCodeInputMask_default = UsZipCodeInputMask;
|
|
248
212
|
//# sourceMappingURL=UsZipCodeInputMask.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/InputMask/mask_types/UsZipCodeInputMask.tsx", "../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable max-lines */\n/* eslint-disable complexity */\nimport React, { useCallback, useLayoutEffect, useRef, useState } from 'react';\nimport { PropTypes } from '@elliemae/ds-utilities';\nimport { DSTextBox } from '../../TextBox';\nimport { setCaretPosition } from '../utils/setCaretPosition';\n\nconst conformValue = (rawValue: string, cursorPos: number) => {\n const nextMaskedValue = rawValue\n .split('')\n .filter((char) => char >= '0' && char <= '9')\n .slice(0, 5);\n\n let maskedPos = 0;\n for (let i = 0; i < cursorPos; i += 1) {\n if (nextMaskedValue[maskedPos] === rawValue[i]) maskedPos += 1;\n }\n return { nextMaskedValue: nextMaskedValue.join(''), maskedPos };\n};\n\nconst UsZipCodeInputMask = ({\n focus,\n setFocus,\n setRawMask,\n cursorPosition,\n setCursorPosition,\n lastkey,\n setLastkey,\n setRawValue,\n style,\n disabled,\n className,\n name,\n maxLength,\n minLength,\n fluidWidth,\n placeholder,\n onKeyDown,\n onClick,\n onChange,\n onFocus,\n onBlur,\n onPaste,\n onKeyUp,\n hasError,\n readOnly,\n type,\n innerRef,\n clearable = false,\n leftComponent,\n rightComponent,\n value,\n ...rest\n}) => {\n const inputRef = useRef();\n const [maskedValue, setMaskedValue] = useState(value);\n\n const conform = useCallback(\n ({ rawValue, cursorPos, lastkeycode, shouldUpdateCursorPos = true }) => {\n const { nextMaskedValue, maskedPos } = conformValue(rawValue, cursorPos);\n const event = {\n target: {\n value: nextMaskedValue,\n originalValue: rawValue,\n },\n };\n if (onChange && nextMaskedValue !== maskedValue) onChange(event);\n\n setMaskedValue(nextMaskedValue);\n setRawValue(nextMaskedValue);\n\n if (shouldUpdateCursorPos) setCursorPosition({ current: maskedPos });\n },\n [maskedValue, onChange],\n );\n\n const handleOnChange = useCallback(\n (e) => {\n const { value: rawValue, selectionEnd } = e.target;\n setRawMask(rawValue);\n setRawValue(rawValue);\n setCursorPosition({ current: selectionEnd });\n setFocus(true);\n },\n [setRawMask, setRawValue, setCursorPosition, setFocus, lastkey.code],\n );\n\n useLayoutEffect(() => {\n if (focus) setCaretPosition(inputRef.current, cursorPosition.current);\n }, [focus, cursorPosition]);\n\n useLayoutEffect(() => {\n // if the value changes, then re-conform the mask\n conform({\n rawValue: value,\n cursorPos: cursorPosition.current,\n lastkeycode: lastkey.code,\n shouldUpdateCursorPos: focus,\n });\n }, [focus, value, cursorPosition.current]);\n\n const handleKeyDown = useCallback(\n (e) => {\n e.stopPropagation();\n setLastkey({ key: e.key, code: e.keyCode });\n onKeyDown(e);\n },\n [onKeyDown],\n );\n\n const handleBlur = useCallback(\n (e) => {\n setFocus(false);\n onBlur(e);\n },\n [onBlur],\n );\n\n return (\n <DSTextBox\n {...rest}\n className={className}\n clearable={clearable}\n disabled={disabled}\n fluidWidth={fluidWidth}\n hasError={hasError}\n innerRef={(ref) => {\n inputRef.current = ref;\n if (innerRef) innerRef(ref);\n }}\n isActive={focus}\n leftComponent={leftComponent}\n maxLength={maxLength}\n minLength={minLength}\n name={name}\n onBlur={handleBlur}\n onChange={handleOnChange}\n onClick={onClick}\n onFocus={onFocus}\n onKeyDown={handleKeyDown}\n onKeyUp={onKeyUp}\n onPaste={onPaste}\n placeholder={placeholder}\n readOnly={readOnly}\n rightComponent={rightComponent}\n style={style}\n type={type}\n value={maskedValue}\n />\n );\n};\n\
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADEvB,mBAAsE;
|
|
4
|
+
"sourcesContent": ["/* eslint-disable max-lines */\n/* eslint-disable complexity */\nimport React, { useCallback, useLayoutEffect, useRef, useState } from 'react';\nimport { PropTypes } from '@elliemae/ds-utilities';\nimport { DSTextBox } from '../../TextBox';\nimport { setCaretPosition } from '../utils/setCaretPosition';\n\nconst conformValue = (rawValue: string, cursorPos: number) => {\n const nextMaskedValue = rawValue\n .split('')\n .filter((char) => char >= '0' && char <= '9')\n .slice(0, 5);\n\n let maskedPos = 0;\n for (let i = 0; i < cursorPos; i += 1) {\n if (nextMaskedValue[maskedPos] === rawValue[i]) maskedPos += 1;\n }\n return { nextMaskedValue: nextMaskedValue.join(''), maskedPos };\n};\n\nconst UsZipCodeInputMask = ({\n focus,\n setFocus,\n setRawMask,\n cursorPosition,\n setCursorPosition,\n lastkey,\n setLastkey,\n setRawValue,\n style,\n disabled,\n className,\n name,\n maxLength,\n minLength,\n fluidWidth,\n placeholder,\n onKeyDown,\n onClick,\n onChange,\n onFocus,\n onBlur,\n onPaste,\n onKeyUp,\n hasError,\n readOnly,\n type,\n innerRef,\n clearable = false,\n leftComponent,\n rightComponent,\n value,\n ...rest\n}) => {\n const inputRef = useRef();\n const [maskedValue, setMaskedValue] = useState(value);\n\n const conform = useCallback(\n ({ rawValue, cursorPos, lastkeycode, shouldUpdateCursorPos = true }) => {\n const { nextMaskedValue, maskedPos } = conformValue(rawValue, cursorPos);\n const event = {\n target: {\n value: nextMaskedValue,\n originalValue: rawValue,\n },\n };\n if (onChange && nextMaskedValue !== maskedValue) onChange(event);\n\n setMaskedValue(nextMaskedValue);\n setRawValue(nextMaskedValue);\n\n if (shouldUpdateCursorPos) setCursorPosition({ current: maskedPos });\n },\n [maskedValue, onChange],\n );\n\n const handleOnChange = useCallback(\n (e) => {\n const { value: rawValue, selectionEnd } = e.target;\n setRawMask(rawValue);\n setRawValue(rawValue);\n setCursorPosition({ current: selectionEnd });\n setFocus(true);\n },\n [setRawMask, setRawValue, setCursorPosition, setFocus, lastkey.code],\n );\n\n useLayoutEffect(() => {\n if (focus) setCaretPosition(inputRef.current, cursorPosition.current);\n }, [focus, cursorPosition]);\n\n useLayoutEffect(() => {\n // if the value changes, then re-conform the mask\n conform({\n rawValue: value,\n cursorPos: cursorPosition.current,\n lastkeycode: lastkey.code,\n shouldUpdateCursorPos: focus,\n });\n }, [focus, value, cursorPosition.current]);\n\n const handleKeyDown = useCallback(\n (e) => {\n e.stopPropagation();\n setLastkey({ key: e.key, code: e.keyCode });\n onKeyDown(e);\n },\n [onKeyDown],\n );\n\n const handleBlur = useCallback(\n (e) => {\n setFocus(false);\n onBlur(e);\n },\n [onBlur],\n );\n\n return (\n <DSTextBox\n {...rest}\n className={className}\n clearable={clearable}\n disabled={disabled}\n fluidWidth={fluidWidth}\n hasError={hasError}\n innerRef={(ref) => {\n inputRef.current = ref;\n if (innerRef) innerRef(ref);\n }}\n isActive={focus}\n leftComponent={leftComponent}\n maxLength={maxLength}\n minLength={minLength}\n name={name}\n onBlur={handleBlur}\n onChange={handleOnChange}\n onClick={onClick}\n onFocus={onFocus}\n onKeyDown={handleKeyDown}\n onKeyUp={onKeyUp}\n onPaste={onPaste}\n placeholder={placeholder}\n readOnly={readOnly}\n rightComponent={rightComponent}\n style={style}\n type={type}\n value={maskedValue}\n />\n );\n};\n\nexport { UsZipCodeInputMask };\nexport default UsZipCodeInputMask;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADEvB,mBAAsE;AAEtE,qBAA0B;AAC1B,8BAAiC;AAEjC,MAAM,eAAe,CAAC,UAAkB,cAAsB;AAC5D,QAAM,kBAAkB,SACrB,MAAM,EAAE,EACR,OAAO,CAAC,SAAS,QAAQ,OAAO,QAAQ,GAAG,EAC3C,MAAM,GAAG,CAAC;AAEb,MAAI,YAAY;AAChB,WAAS,IAAI,GAAG,IAAI,WAAW,KAAK,GAAG;AACrC,QAAI,gBAAgB,eAAe,SAAS;AAAI,mBAAa;AAAA,EAC/D;AACA,SAAO,EAAE,iBAAiB,gBAAgB,KAAK,EAAE,GAAG,UAAU;AAChE;AAEA,MAAM,qBAAqB,CAAC,OAiCtB;AAjCsB,eAC1B;AAAA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,YAAY;AAAA,IACZ;AAAA,IACA;AAAA,IACA;AAAA,MA/B0B,IAgCvB,iBAhCuB,IAgCvB;AAAA,IA/BH;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;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,QAAQ,CAAC;AAC1C,cAAU,CAAC;AAAA,EACb,GACA,CAAC,SAAS,CACZ;AAEA,QAAM,aAAa,8BACjB,CAAC,MAAM;AACL,aAAS,KAAK;AACd,WAAO,CAAC;AAAA,EACV,GACA,CAAC,MAAM,CACT;AAEA,SACE,mDAAC,2DACK,OADL;AAAA,IAEC;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,UAAU,CAAC,QAAQ;AACjB,eAAS,UAAU;AACnB,UAAI;AAAU,iBAAS,GAAG;AAAA,IAC5B;AAAA,IACA,UAAU;AAAA,IACV;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,QAAQ;AAAA,IACR,UAAU;AAAA,IACV;AAAA,IACA;AAAA,IACA,WAAW;AAAA,IACX;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,OAAO;AAAA,IACT;AAEJ;AAGA,IAAO,6BAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -55,7 +55,6 @@ __export(ZipCodeSearchInputMask_exports, {
|
|
|
55
55
|
module.exports = __toCommonJS(ZipCodeSearchInputMask_exports);
|
|
56
56
|
var React = __toESM(require("react"));
|
|
57
57
|
var import_react = __toESM(require("react"));
|
|
58
|
-
var import_ds_utilities = require("@elliemae/ds-utilities");
|
|
59
58
|
var import_TextBox = require("../../TextBox");
|
|
60
59
|
var import_setCaretPosition = require("../utils/setCaretPosition");
|
|
61
60
|
const conformValue = (rawValue, cursorPos, lastkeycode) => {
|
|
@@ -228,40 +227,5 @@ const ZipCodeSearchInputMask = (_a) => {
|
|
|
228
227
|
value: maskedValue
|
|
229
228
|
}));
|
|
230
229
|
};
|
|
231
|
-
ZipCodeSearchInputMask.propTypes = {
|
|
232
|
-
focus: import_ds_utilities.PropTypes.bool,
|
|
233
|
-
setFocus: import_ds_utilities.PropTypes.func,
|
|
234
|
-
setRawMask: import_ds_utilities.PropTypes.func,
|
|
235
|
-
cursorPosition: import_ds_utilities.PropTypes.shape({ current: import_ds_utilities.PropTypes.number }),
|
|
236
|
-
setCursorPosition: import_ds_utilities.PropTypes.func,
|
|
237
|
-
lastkey: import_ds_utilities.PropTypes.shape({ code: import_ds_utilities.PropTypes.number, key: import_ds_utilities.PropTypes.string }),
|
|
238
|
-
setLastkey: import_ds_utilities.PropTypes.func,
|
|
239
|
-
setRawValue: import_ds_utilities.PropTypes.func,
|
|
240
|
-
style: import_ds_utilities.PropTypes.object,
|
|
241
|
-
disabled: import_ds_utilities.PropTypes.bool,
|
|
242
|
-
className: import_ds_utilities.PropTypes.string,
|
|
243
|
-
name: import_ds_utilities.PropTypes.string,
|
|
244
|
-
maxLength: import_ds_utilities.PropTypes.number,
|
|
245
|
-
minLength: import_ds_utilities.PropTypes.number,
|
|
246
|
-
fluidWidth: import_ds_utilities.PropTypes.bool,
|
|
247
|
-
placeholder: import_ds_utilities.PropTypes.string,
|
|
248
|
-
value: import_ds_utilities.PropTypes.string,
|
|
249
|
-
onChange: import_ds_utilities.PropTypes.func,
|
|
250
|
-
onKeyDown: import_ds_utilities.PropTypes.func,
|
|
251
|
-
leftComponent: import_ds_utilities.PropTypes.element,
|
|
252
|
-
rightComponent: import_ds_utilities.PropTypes.element,
|
|
253
|
-
onFocus: import_ds_utilities.PropTypes.func,
|
|
254
|
-
onBlur: import_ds_utilities.PropTypes.func,
|
|
255
|
-
onPaste: import_ds_utilities.PropTypes.func,
|
|
256
|
-
onKeyUp: import_ds_utilities.PropTypes.func,
|
|
257
|
-
hasError: import_ds_utilities.PropTypes.bool,
|
|
258
|
-
readOnly: import_ds_utilities.PropTypes.bool,
|
|
259
|
-
onClick: import_ds_utilities.PropTypes.func,
|
|
260
|
-
clearable: import_ds_utilities.PropTypes.bool,
|
|
261
|
-
type: import_ds_utilities.PropTypes.string,
|
|
262
|
-
innerRef: import_ds_utilities.PropTypes.any,
|
|
263
|
-
mask: import_ds_utilities.PropTypes.any,
|
|
264
|
-
placeholderChar: import_ds_utilities.PropTypes.string
|
|
265
|
-
};
|
|
266
230
|
var ZipCodeSearchInputMask_default = ZipCodeSearchInputMask;
|
|
267
231
|
//# sourceMappingURL=ZipCodeSearchInputMask.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/InputMask/mask_types/ZipCodeSearchInputMask.tsx", "../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable max-lines */\n/* eslint-disable complexity */\nimport React, { useCallback, useLayoutEffect, useRef, useState } from 'react';\nimport { PropTypes } from '@elliemae/ds-utilities';\nimport { DSTextBox } from '../../TextBox';\nimport { TCharsToAdd } from '../types';\nimport { setCaretPosition } from '../utils/setCaretPosition';\n\nconst conformValue = (rawValue, cursorPos, lastkeycode) => {\n const nextMaskedValue = rawValue\n .split('')\n .filter((char) => char >= '0' && char <= '9')\n .slice(0, 9);\n\n let maskedPos = 0;\n for (let i = 0; i < cursorPos; i += 1) {\n if (nextMaskedValue[maskedPos] === rawValue[i]) maskedPos += 1;\n }\n\n // list of [string to add, position to add]\n const charactersToAdd: TCharsToAdd = [['-', 5]];\n\n charactersToAdd.forEach(([chars, pos]) => {\n if (nextMaskedValue.length > pos) {\n nextMaskedValue.splice(pos, 0, chars);\n if (maskedPos >= pos) maskedPos += chars.length;\n }\n });\n\n if (lastkeycode !== 8 && maskedPos < nextMaskedValue.length) {\n charactersToAdd.forEach(([chars, pos]) => {\n if (maskedPos === pos) maskedPos += chars.length;\n });\n } else if (lastkeycode === 8 && maskedPos) {\n charactersToAdd.forEach(([chars, pos]) => {\n if (maskedPos === pos + 1) maskedPos -= chars.length;\n });\n }\n return { nextMaskedValue: nextMaskedValue.join(''), maskedPos };\n};\n\nconst ZipCodeSearchInputMask = ({\n focus,\n setFocus,\n setRawMask,\n cursorPosition,\n setCursorPosition,\n lastkey,\n setLastkey,\n setRawValue,\n style,\n disabled,\n className,\n name,\n maxLength,\n minLength,\n fluidWidth,\n placeholder,\n onKeyDown,\n onClick,\n onChange,\n onFocus,\n onBlur,\n onPaste,\n onKeyUp,\n hasError,\n readOnly,\n type,\n innerRef,\n clearable = false,\n leftComponent,\n rightComponent,\n value,\n ...rest\n}) => {\n const inputRef = useRef();\n const [maskedValue, setMaskedValue] = useState(value);\n\n const conform = useCallback(\n ({ rawValue, cursorPos, lastkeycode, shouldUpdateCursorPos = true }) => {\n const { nextMaskedValue, maskedPos } = conformValue(\n rawValue,\n cursorPos,\n lastkeycode,\n );\n const event = {\n target: {\n value: nextMaskedValue,\n originalValue: rawValue,\n },\n };\n if (onChange && nextMaskedValue !== maskedValue) onChange(event);\n\n setMaskedValue(nextMaskedValue);\n setRawValue(nextMaskedValue);\n\n if (shouldUpdateCursorPos) setCursorPosition({ current: maskedPos });\n },\n [maskedValue, onChange],\n );\n\n const handleOnChange = useCallback(\n (e) => {\n const { value: rawValue, selectionEnd } = e.target;\n setRawMask(rawValue);\n setRawValue(rawValue);\n setCursorPosition({ current: selectionEnd });\n setFocus(true);\n },\n [setRawMask, setRawValue, setCursorPosition, setFocus, lastkey.code],\n );\n\n useLayoutEffect(() => {\n if (focus) setCaretPosition(inputRef.current, cursorPosition.current);\n }, [focus, cursorPosition]);\n\n useLayoutEffect(() => {\n // if the value changes, then re-conform the mask\n conform({\n rawValue: value,\n cursorPos: cursorPosition.current,\n lastkeycode: lastkey.code,\n shouldUpdateCursorPos: focus,\n });\n }, [focus, value, cursorPosition.current]);\n\n const handleKeyDown = useCallback(\n (e) => {\n e.stopPropagation();\n setLastkey({ key: e.key, code: e.keyCode });\n onKeyDown(e);\n },\n [onKeyDown],\n );\n\n const handleBlur = useCallback(\n (e) => {\n setFocus(false);\n onBlur(e);\n },\n [onBlur],\n );\n\n return (\n <DSTextBox\n {...rest}\n className={className}\n clearable={clearable}\n disabled={disabled}\n fluidWidth={fluidWidth}\n hasError={hasError}\n innerRef={(ref) => {\n inputRef.current = ref;\n if (innerRef && typeof innerRef === 'function') innerRef(ref);\n }}\n isActive={focus}\n leftComponent={leftComponent}\n maxLength={maxLength}\n minLength={minLength}\n name={name}\n onBlur={handleBlur}\n onChange={handleOnChange}\n onClick={onClick}\n onFocus={onFocus}\n onKeyDown={handleKeyDown}\n onKeyUp={onKeyUp}\n onPaste={onPaste}\n placeholder={placeholder}\n readOnly={readOnly}\n rightComponent={rightComponent}\n style={style}\n type={type}\n value={maskedValue}\n />\n );\n};\n\
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADEvB,mBAAsE;
|
|
4
|
+
"sourcesContent": ["/* eslint-disable max-lines */\n/* eslint-disable complexity */\nimport React, { useCallback, useLayoutEffect, useRef, useState } from 'react';\nimport { PropTypes } from '@elliemae/ds-utilities';\nimport { DSTextBox } from '../../TextBox';\nimport { TCharsToAdd } from '../types';\nimport { setCaretPosition } from '../utils/setCaretPosition';\n\nconst conformValue = (rawValue, cursorPos, lastkeycode) => {\n const nextMaskedValue = rawValue\n .split('')\n .filter((char) => char >= '0' && char <= '9')\n .slice(0, 9);\n\n let maskedPos = 0;\n for (let i = 0; i < cursorPos; i += 1) {\n if (nextMaskedValue[maskedPos] === rawValue[i]) maskedPos += 1;\n }\n\n // list of [string to add, position to add]\n const charactersToAdd: TCharsToAdd = [['-', 5]];\n\n charactersToAdd.forEach(([chars, pos]) => {\n if (nextMaskedValue.length > pos) {\n nextMaskedValue.splice(pos, 0, chars);\n if (maskedPos >= pos) maskedPos += chars.length;\n }\n });\n\n if (lastkeycode !== 8 && maskedPos < nextMaskedValue.length) {\n charactersToAdd.forEach(([chars, pos]) => {\n if (maskedPos === pos) maskedPos += chars.length;\n });\n } else if (lastkeycode === 8 && maskedPos) {\n charactersToAdd.forEach(([chars, pos]) => {\n if (maskedPos === pos + 1) maskedPos -= chars.length;\n });\n }\n return { nextMaskedValue: nextMaskedValue.join(''), maskedPos };\n};\n\nconst ZipCodeSearchInputMask = ({\n focus,\n setFocus,\n setRawMask,\n cursorPosition,\n setCursorPosition,\n lastkey,\n setLastkey,\n setRawValue,\n style,\n disabled,\n className,\n name,\n maxLength,\n minLength,\n fluidWidth,\n placeholder,\n onKeyDown,\n onClick,\n onChange,\n onFocus,\n onBlur,\n onPaste,\n onKeyUp,\n hasError,\n readOnly,\n type,\n innerRef,\n clearable = false,\n leftComponent,\n rightComponent,\n value,\n ...rest\n}) => {\n const inputRef = useRef();\n const [maskedValue, setMaskedValue] = useState(value);\n\n const conform = useCallback(\n ({ rawValue, cursorPos, lastkeycode, shouldUpdateCursorPos = true }) => {\n const { nextMaskedValue, maskedPos } = conformValue(\n rawValue,\n cursorPos,\n lastkeycode,\n );\n const event = {\n target: {\n value: nextMaskedValue,\n originalValue: rawValue,\n },\n };\n if (onChange && nextMaskedValue !== maskedValue) onChange(event);\n\n setMaskedValue(nextMaskedValue);\n setRawValue(nextMaskedValue);\n\n if (shouldUpdateCursorPos) setCursorPosition({ current: maskedPos });\n },\n [maskedValue, onChange],\n );\n\n const handleOnChange = useCallback(\n (e) => {\n const { value: rawValue, selectionEnd } = e.target;\n setRawMask(rawValue);\n setRawValue(rawValue);\n setCursorPosition({ current: selectionEnd });\n setFocus(true);\n },\n [setRawMask, setRawValue, setCursorPosition, setFocus, lastkey.code],\n );\n\n useLayoutEffect(() => {\n if (focus) setCaretPosition(inputRef.current, cursorPosition.current);\n }, [focus, cursorPosition]);\n\n useLayoutEffect(() => {\n // if the value changes, then re-conform the mask\n conform({\n rawValue: value,\n cursorPos: cursorPosition.current,\n lastkeycode: lastkey.code,\n shouldUpdateCursorPos: focus,\n });\n }, [focus, value, cursorPosition.current]);\n\n const handleKeyDown = useCallback(\n (e) => {\n e.stopPropagation();\n setLastkey({ key: e.key, code: e.keyCode });\n onKeyDown(e);\n },\n [onKeyDown],\n );\n\n const handleBlur = useCallback(\n (e) => {\n setFocus(false);\n onBlur(e);\n },\n [onBlur],\n );\n\n return (\n <DSTextBox\n {...rest}\n className={className}\n clearable={clearable}\n disabled={disabled}\n fluidWidth={fluidWidth}\n hasError={hasError}\n innerRef={(ref) => {\n inputRef.current = ref;\n if (innerRef && typeof innerRef === 'function') innerRef(ref);\n }}\n isActive={focus}\n leftComponent={leftComponent}\n maxLength={maxLength}\n minLength={minLength}\n name={name}\n onBlur={handleBlur}\n onChange={handleOnChange}\n onClick={onClick}\n onFocus={onFocus}\n onKeyDown={handleKeyDown}\n onKeyUp={onKeyUp}\n onPaste={onPaste}\n placeholder={placeholder}\n readOnly={readOnly}\n rightComponent={rightComponent}\n style={style}\n type={type}\n value={maskedValue}\n />\n );\n};\n\nexport { ZipCodeSearchInputMask };\nexport default ZipCodeSearchInputMask;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADEvB,mBAAsE;AAEtE,qBAA0B;AAE1B,8BAAiC;AAEjC,MAAM,eAAe,CAAC,UAAU,WAAW,gBAAgB;AACzD,QAAM,kBAAkB,SACrB,MAAM,EAAE,EACR,OAAO,CAAC,SAAS,QAAQ,OAAO,QAAQ,GAAG,EAC3C,MAAM,GAAG,CAAC;AAEb,MAAI,YAAY;AAChB,WAAS,IAAI,GAAG,IAAI,WAAW,KAAK,GAAG;AACrC,QAAI,gBAAgB,eAAe,SAAS;AAAI,mBAAa;AAAA,EAC/D;AAGA,QAAM,kBAA+B,CAAC,CAAC,KAAK,CAAC,CAAC;AAE9C,kBAAgB,QAAQ,CAAC,CAAC,OAAO,SAAS;AACxC,QAAI,gBAAgB,SAAS,KAAK;AAChC,sBAAgB,OAAO,KAAK,GAAG,KAAK;AACpC,UAAI,aAAa;AAAK,qBAAa,MAAM;AAAA,IAC3C;AAAA,EACF,CAAC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DACK,OADL;AAAA,IAEC;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,UAAU,CAAC,QAAQ;AACjB,eAAS,UAAU;AACnB,UAAI,YAAY,OAAO,aAAa;AAAY,iBAAS,GAAG;AAAA,IAC9D;AAAA,IACA,UAAU;AAAA,IACV;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,QAAQ;AAAA,IACR,UAAU;AAAA,IACV;AAAA,IACA;AAAA,IACA,WAAW;AAAA,IACX;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,OAAO;AAAA,IACT;AAEJ;AAGA,IAAO,iCAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -58,7 +58,8 @@ const inputProps = {
|
|
|
58
58
|
mask: import_ds_utilities.PropTypes.oneOfType([
|
|
59
59
|
import_ds_utilities.PropTypes.array,
|
|
60
60
|
import_ds_utilities.PropTypes.string,
|
|
61
|
-
import_ds_utilities.PropTypes.func
|
|
61
|
+
import_ds_utilities.PropTypes.func,
|
|
62
|
+
import_ds_utilities.PropTypes.object
|
|
62
63
|
]).description("Mask that has to match with the input information entered. ['DATE', 'PHONE', 'PHONE_INTENATIONAL', 'SSN', 'US_ZIP_CODE', 'NUMBER', 'PERCENT', 'ZIP_CODE_SEARCH']"),
|
|
63
64
|
pipe: import_ds_utilities.PropTypes.func.description("Expects pipe functions. i.e. autoCorrectedDatePipe"),
|
|
64
65
|
useSubfix: import_ds_utilities.PropTypes.string.description("Put a sufix after the input mask"),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/InputMask/props.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import { PropTypes } from '@elliemae/ds-utilities';\n\nexport const inputProps = {\n /** Should component focus automatically */\n autoFocus: PropTypes.bool.description('Should component focus automatically'),\n /**\n * Set style for the input mask\n */\n style: PropTypes.object.description('Set style for the input mask'),\n /**\n * Whether the input mask is disabled or not\n */\n disabled: PropTypes.bool.description(\n 'Whether the input mask is disabled or not',\n ),\n /** disableTooltip */\n disableTooltip: PropTypes.bool\n .description('Whether to show a tooltip or not when text does not fit')\n .defaultValue(true),\n /** css class */\n className: PropTypes.string.description('css class'),\n /** html name prop for form */\n name: PropTypes.string.description('html name prop for form'),\n /**\n * Max length for the input mask\n */\n maxLength: PropTypes.number.description('Max length for the input mask'),\n /**\n * Min length for the input mask\n */\n minLength: PropTypes.number.description('Min length for the input mask'),\n /**\n * Whether to make the content of the input mask fit the container or not\n */\n fluidWidth: PropTypes.bool.description(\n 'Whether to make the content of the input mask fit the container or not',\n ),\n /** isShowElipsisActive */\n isShowElipsisActive: PropTypes.bool\n .description(\n 'Wheter to enable the ellipsis and tooltip functionality or not',\n )\n .defaultValue(true),\n /**\n * Component that works as placeholder\n */\n placeholder: PropTypes.node.description(\n 'Component that works as placeholder',\n ),\n /**\n * Allows a function that is triggered once a key is being pressed\n */\n onKeyDown: PropTypes.func.description(\n 'Allows a function that is triggered once a key is being pressed',\n ),\n /**\n * Allows a function that is triggered once the input mask is clicked\n */\n onClick: PropTypes.func.description(\n 'Allows a function that is triggered once the input mask is clicked',\n ),\n /**\n * Allows a function that is triggered once the input mask changes\n */\n onChange: PropTypes.func.description(\n 'Allows a function that is triggered once the input mask changes',\n ),\n /**\n * Allows a function that is triggered once the input mask is focused\n */\n onFocus: PropTypes.func.description(\n 'Allows a function that is triggered once the input mask is focused',\n ),\n /**\n * Allows a function that is triggered once the input mask loses focus\n */\n onBlur: PropTypes.func.description(\n 'Allows a function that is triggered once the input mask loses focus',\n ),\n /**\n * Allows a function that is triggered once the input mask is pasted\n */\n onPaste: PropTypes.func.description(\n 'Allows a function that is triggered once the input mask is pasted',\n ),\n /**\n * Allows a function that is triggered once in the input mask a keyboard key is released\n */\n onKeyUp: PropTypes.func.description(\n 'Allows a function that is triggered once in the input mask a keyboard key is released',\n ),\n /**\n * Default value once the component is initialized\n */\n value: PropTypes.string.description(\n 'Default value once the component is initialized',\n ),\n /**\n * Whether the input mask has error or not\n */\n hasError: PropTypes.bool.description(\n 'Whether the input mask has error or not',\n ),\n /**\n * Whether the input mask is read only or not\n */\n readOnly: PropTypes.bool.description(\n 'Whether the input mask is read only or not',\n ),\n innerRef: PropTypes.oneOfType([\n PropTypes.func,\n PropTypes.shape({ current: PropTypes.any }),\n ]).description('Whether the input mask is read only or not'),\n /**\n * Type of input. Ex: 'text'\n */\n type: PropTypes.string.description(\"Type of input. Ex: 'text'\"),\n /**\n * Whether the input mask is clearable or not\n */\n clearable: PropTypes.bool.description(\n 'Whether the input mask is clearable or not',\n ),\n /**\n * Component to be added at the right side of the input\n */\n leftComponent: PropTypes.node.description(\n 'Component to be added at the right side of the input',\n ),\n /**\n * Component to be added at the right side of the input\n */\n rightComponent: PropTypes.node.description(\n 'Component to be added at the right side of the input',\n ),\n /**\n * Mask that has to match with the input information entered\n * ['DATE', 'PHONE', 'PHONE_INTENATIONAL', 'SSN', 'US_ZIP_CODE', 'NUMBER', 'PERCENT']\n */\n mask: PropTypes.oneOfType([\n PropTypes.array,\n PropTypes.string,\n PropTypes.func,\n ]).description(\n \"Mask that has to match with the input information entered. ['DATE', 'PHONE', 'PHONE_INTENATIONAL', 'SSN', 'US_ZIP_CODE', 'NUMBER', 'PERCENT', 'ZIP_CODE_SEARCH']\",\n ),\n /**\n Expects pipe functions. i.e. autoCorrectedDatePipe\n link a docu de text-mask\n */\n pipe: PropTypes.func.description(\n 'Expects pipe functions. i.e. autoCorrectedDatePipe',\n ),\n /**\n * Put a sufix after the input mask\n */\n useSubfix: PropTypes.string.description('Put a sufix after the input mask'),\n /**\n * The placeholder character represents the fillable spot in the mask.\n * The default placeholder character is underscore, _\n */\n placeholderChar: PropTypes.string\n .description(\n `The placeholder character represents the fillable spot in the mask.\n The default placeholder character is underscore, _.`,\n )\n .defaultValue('_'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CAAC;AAAA,EAC5C,CAAC,EAAE,YAAY,4CAA4C;AAAA,EAI3D,MAAM,8BAAU,OAAO,YAAY,2BAA2B;AAAA,EAI9D,WAAW,8BAAU,KAAK,YACxB,4CACF;AAAA,EAIA,eAAe,8BAAU,KAAK,YAC5B,sDACF;AAAA,EAIA,gBAAgB,8BAAU,KAAK,YAC7B,sDACF;AAAA,EAKA,MAAM,8BAAU,UAAU;AAAA,IACxB,8BAAU;AAAA,IACV,8BAAU;AAAA,IACV,8BAAU;AAAA,EACZ,CAAC,EAAE,YACD,kKACF;AAAA,EAKA,MAAM,8BAAU,KAAK,YACnB,oDACF;AAAA,EAIA,WAAW,8BAAU,OAAO,YAAY,kCAAkC;AAAA,EAK1E,iBAAiB,8BAAU,OACxB,YACC;AAAA,qDAEF,EACC,aAAa,GAAG;AACrB;",
|
|
4
|
+
"sourcesContent": ["import { PropTypes } from '@elliemae/ds-utilities';\n\nexport const inputProps = {\n /** Should component focus automatically */\n autoFocus: PropTypes.bool.description('Should component focus automatically'),\n /**\n * Set style for the input mask\n */\n style: PropTypes.object.description('Set style for the input mask'),\n /**\n * Whether the input mask is disabled or not\n */\n disabled: PropTypes.bool.description(\n 'Whether the input mask is disabled or not',\n ),\n /** disableTooltip */\n disableTooltip: PropTypes.bool\n .description('Whether to show a tooltip or not when text does not fit')\n .defaultValue(true),\n /** css class */\n className: PropTypes.string.description('css class'),\n /** html name prop for form */\n name: PropTypes.string.description('html name prop for form'),\n /**\n * Max length for the input mask\n */\n maxLength: PropTypes.number.description('Max length for the input mask'),\n /**\n * Min length for the input mask\n */\n minLength: PropTypes.number.description('Min length for the input mask'),\n /**\n * Whether to make the content of the input mask fit the container or not\n */\n fluidWidth: PropTypes.bool.description(\n 'Whether to make the content of the input mask fit the container or not',\n ),\n /** isShowElipsisActive */\n isShowElipsisActive: PropTypes.bool\n .description(\n 'Wheter to enable the ellipsis and tooltip functionality or not',\n )\n .defaultValue(true),\n /**\n * Component that works as placeholder\n */\n placeholder: PropTypes.node.description(\n 'Component that works as placeholder',\n ),\n /**\n * Allows a function that is triggered once a key is being pressed\n */\n onKeyDown: PropTypes.func.description(\n 'Allows a function that is triggered once a key is being pressed',\n ),\n /**\n * Allows a function that is triggered once the input mask is clicked\n */\n onClick: PropTypes.func.description(\n 'Allows a function that is triggered once the input mask is clicked',\n ),\n /**\n * Allows a function that is triggered once the input mask changes\n */\n onChange: PropTypes.func.description(\n 'Allows a function that is triggered once the input mask changes',\n ),\n /**\n * Allows a function that is triggered once the input mask is focused\n */\n onFocus: PropTypes.func.description(\n 'Allows a function that is triggered once the input mask is focused',\n ),\n /**\n * Allows a function that is triggered once the input mask loses focus\n */\n onBlur: PropTypes.func.description(\n 'Allows a function that is triggered once the input mask loses focus',\n ),\n /**\n * Allows a function that is triggered once the input mask is pasted\n */\n onPaste: PropTypes.func.description(\n 'Allows a function that is triggered once the input mask is pasted',\n ),\n /**\n * Allows a function that is triggered once in the input mask a keyboard key is released\n */\n onKeyUp: PropTypes.func.description(\n 'Allows a function that is triggered once in the input mask a keyboard key is released',\n ),\n /**\n * Default value once the component is initialized\n */\n value: PropTypes.string.description(\n 'Default value once the component is initialized',\n ),\n /**\n * Whether the input mask has error or not\n */\n hasError: PropTypes.bool.description(\n 'Whether the input mask has error or not',\n ),\n /**\n * Whether the input mask is read only or not\n */\n readOnly: PropTypes.bool.description(\n 'Whether the input mask is read only or not',\n ),\n innerRef: PropTypes.oneOfType([\n PropTypes.func,\n PropTypes.shape({ current: PropTypes.any }),\n ]).description('Whether the input mask is read only or not'),\n /**\n * Type of input. Ex: 'text'\n */\n type: PropTypes.string.description(\"Type of input. Ex: 'text'\"),\n /**\n * Whether the input mask is clearable or not\n */\n clearable: PropTypes.bool.description(\n 'Whether the input mask is clearable or not',\n ),\n /**\n * Component to be added at the right side of the input\n */\n leftComponent: PropTypes.node.description(\n 'Component to be added at the right side of the input',\n ),\n /**\n * Component to be added at the right side of the input\n */\n rightComponent: PropTypes.node.description(\n 'Component to be added at the right side of the input',\n ),\n /**\n * Mask that has to match with the input information entered\n * ['DATE', 'PHONE', 'PHONE_INTENATIONAL', 'SSN', 'US_ZIP_CODE', 'NUMBER', 'PERCENT']\n */\n mask: PropTypes.oneOfType([\n PropTypes.array,\n PropTypes.string,\n PropTypes.func,\n PropTypes.object,\n ]).description(\n \"Mask that has to match with the input information entered. ['DATE', 'PHONE', 'PHONE_INTENATIONAL', 'SSN', 'US_ZIP_CODE', 'NUMBER', 'PERCENT', 'ZIP_CODE_SEARCH']\",\n ),\n /**\n Expects pipe functions. i.e. autoCorrectedDatePipe\n link a docu de text-mask\n */\n pipe: PropTypes.func.description(\n 'Expects pipe functions. i.e. autoCorrectedDatePipe',\n ),\n /**\n * Put a sufix after the input mask\n */\n useSubfix: PropTypes.string.description('Put a sufix after the input mask'),\n /**\n * The placeholder character represents the fillable spot in the mask.\n * The default placeholder character is underscore, _\n */\n placeholderChar: PropTypes.string\n .description(\n `The placeholder character represents the fillable spot in the mask.\n The default placeholder character is underscore, _.`,\n )\n .defaultValue('_'),\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,0BAA0B;AAEnB,MAAM,aAAa;AAAA,EAExB,WAAW,8BAAU,KAAK,YAAY,sCAAsC;AAAA,EAI5E,OAAO,8BAAU,OAAO,YAAY,8BAA8B;AAAA,EAIlE,UAAU,8BAAU,KAAK,YACvB,2CACF;AAAA,EAEA,gBAAgB,8BAAU,KACvB,YAAY,yDAAyD,EACrE,aAAa,IAAI;AAAA,EAEpB,WAAW,8BAAU,OAAO,YAAY,WAAW;AAAA,EAEnD,MAAM,8BAAU,OAAO,YAAY,yBAAyB;AAAA,EAI5D,WAAW,8BAAU,OAAO,YAAY,+BAA+B;AAAA,EAIvE,WAAW,8BAAU,OAAO,YAAY,+BAA+B;AAAA,EAIvE,YAAY,8BAAU,KAAK,YACzB,wEAC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 @@ const inputProtectedProps = {
|
|
|
39
39
|
value: import_ds_utilities.PropTypes.oneOfType([import_ds_utilities.PropTypes.string, import_ds_utilities.PropTypes.number]).description("input s value"),
|
|
40
40
|
readOnly: import_ds_utilities.PropTypes.bool.description("Whether the input is read-only or not").defaultValue(false),
|
|
41
41
|
mask: import_ds_utilities.PropTypes.oneOfType([
|
|
42
|
-
import_ds_utilities.PropTypes.
|
|
43
|
-
import_ds_utilities.PropTypes.func
|
|
42
|
+
import_ds_utilities.PropTypes.array,
|
|
43
|
+
import_ds_utilities.PropTypes.func,
|
|
44
|
+
import_ds_utilities.PropTypes.object,
|
|
45
|
+
import_ds_utilities.PropTypes.string
|
|
44
46
|
]).description("mask to apply"),
|
|
45
47
|
type: import_ds_utilities.PropTypes.oneOf(["password", "number", "text"]).description("type of input"),
|
|
46
48
|
placeholderChar: import_ds_utilities.PropTypes.string.description(`The placeholder character represents the fillable spot in the mask.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/InputProtected/props.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import { PropTypes } from '@elliemae/ds-utilities';\nimport { LEFT_ADDON_OPTIONS, RIGHT_ADDON_OPTIONS } from './options';\n\nexport const inputProtectedProps = {\n leftAddon: PropTypes.oneOf([\n LEFT_ADDON_OPTIONS.LockLocked,\n LEFT_ADDON_OPTIONS.LockUnlocked,\n ]).description('left addon component to display'),\n rightAddon: PropTypes.oneOf([\n RIGHT_ADDON_OPTIONS.VisibleView,\n RIGHT_ADDON_OPTIONS.InvisibleHide,\n ])\n .description('right addon component to display')\n .defaultValue(RIGHT_ADDON_OPTIONS.InvisibleHide),\n onChange: PropTypes.func.description(\n 'Function executed when input s value changes',\n ),\n value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).description(\n 'input s value',\n ),\n readOnly: PropTypes.bool\n .description('Whether the input is read-only or not')\n .defaultValue(false),\n mask: PropTypes.oneOfType([\n PropTypes.
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,0BAA0B;AAC1B,qBAAwD;AAEjD,MAAM,sBAAsB;AAAA,EACjC,WAAW,8BAAU,MAAM;AAAA,IACzB,kCAAmB;AAAA,IACnB,kCAAmB;AAAA,EACrB,CAAC,EAAE,YAAY,iCAAiC;AAAA,EAChD,YAAY,8BAAU,MAAM;AAAA,IAC1B,mCAAoB;AAAA,IACpB,mCAAoB;AAAA,EACtB,CAAC,EACE,YAAY,kCAAkC,EAC9C,aAAa,mCAAoB,aAAa;AAAA,EACjD,UAAU,8BAAU,KAAK,YACvB,8CACF;AAAA,EACA,OAAO,8BAAU,UAAU,CAAC,8BAAU,QAAQ,8BAAU,MAAM,CAAC,EAAE,YAC/D,eACF;AAAA,EACA,UAAU,8BAAU,KACjB,YAAY,uCAAuC,EACnD,aAAa,KAAK;AAAA,EACrB,MAAM,8BAAU,UAAU;AAAA,IACxB,8BAAU,
|
|
4
|
+
"sourcesContent": ["import { PropTypes } from '@elliemae/ds-utilities';\nimport { LEFT_ADDON_OPTIONS, RIGHT_ADDON_OPTIONS } from './options';\n\nexport const inputProtectedProps = {\n leftAddon: PropTypes.oneOf([\n LEFT_ADDON_OPTIONS.LockLocked,\n LEFT_ADDON_OPTIONS.LockUnlocked,\n ]).description('left addon component to display'),\n rightAddon: PropTypes.oneOf([\n RIGHT_ADDON_OPTIONS.VisibleView,\n RIGHT_ADDON_OPTIONS.InvisibleHide,\n ])\n .description('right addon component to display')\n .defaultValue(RIGHT_ADDON_OPTIONS.InvisibleHide),\n onChange: PropTypes.func.description(\n 'Function executed when input s value changes',\n ),\n value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).description(\n 'input s value',\n ),\n readOnly: PropTypes.bool\n .description('Whether the input is read-only or not')\n .defaultValue(false),\n mask: PropTypes.oneOfType([\n PropTypes.array,\n PropTypes.func,\n PropTypes.object,\n PropTypes.string,\n ]).description('mask to apply'),\n type: PropTypes.oneOf(['password', 'number', 'text']).description(\n 'type of input',\n ),\n /**\n * PlaceholderChar: The placeholder character represents the fillable spot in the mask.\n * The default placeholder character is underscore, _.\n */\n placeholderChar: PropTypes.string.description(\n `The placeholder character represents the fillable spot in the mask.\n * The default placeholder character is underscore, _.`,\n ),\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,0BAA0B;AAC1B,qBAAwD;AAEjD,MAAM,sBAAsB;AAAA,EACjC,WAAW,8BAAU,MAAM;AAAA,IACzB,kCAAmB;AAAA,IACnB,kCAAmB;AAAA,EACrB,CAAC,EAAE,YAAY,iCAAiC;AAAA,EAChD,YAAY,8BAAU,MAAM;AAAA,IAC1B,mCAAoB;AAAA,IACpB,mCAAoB;AAAA,EACtB,CAAC,EACE,YAAY,kCAAkC,EAC9C,aAAa,mCAAoB,aAAa;AAAA,EACjD,UAAU,8BAAU,KAAK,YACvB,8CACF;AAAA,EACA,OAAO,8BAAU,UAAU,CAAC,8BAAU,QAAQ,8BAAU,MAAM,CAAC,EAAE,YAC/D,eACF;AAAA,EACA,UAAU,8BAAU,KACjB,YAAY,uCAAuC,EACnD,aAAa,KAAK;AAAA,EACrB,MAAM,8BAAU,UAAU;AAAA,IACxB,8BAAU;AAAA,IACV,8BAAU;AAAA,IACV,8BAAU;AAAA,IACV,8BAAU;AAAA,EACZ,CAAC,EAAE,YAAY,eAAe;AAAA,EAC9B,MAAM,8BAAU,MAAM,CAAC,YAAY,UAAU,MAAM,CAAC,EAAE,YACpD,eACF;AAAA,EAKA,iBAAiB,8BAAU,OAAO,YAChC;AAAA,wDAEF;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -74,7 +74,8 @@ const DSRadio = (_a) => {
|
|
|
74
74
|
name,
|
|
75
75
|
onChange,
|
|
76
76
|
children,
|
|
77
|
-
tabIndex
|
|
77
|
+
tabIndex,
|
|
78
|
+
innerRef
|
|
78
79
|
} = _b, otherProps = __objRest(_b, [
|
|
79
80
|
"containerProps",
|
|
80
81
|
"className",
|
|
@@ -89,7 +90,8 @@ const DSRadio = (_a) => {
|
|
|
89
90
|
"name",
|
|
90
91
|
"onChange",
|
|
91
92
|
"children",
|
|
92
|
-
"tabIndex"
|
|
93
|
+
"tabIndex",
|
|
94
|
+
"innerRef"
|
|
93
95
|
]);
|
|
94
96
|
const { cssClassName, classNameElement } = (0, import_ds_classnames.convertPropToCssClassName)("form-element-radio", className, {
|
|
95
97
|
hasError,
|
|
@@ -119,7 +121,7 @@ const DSRadio = (_a) => {
|
|
|
119
121
|
type: "radio",
|
|
120
122
|
value
|
|
121
123
|
})), /* @__PURE__ */ import_react.default.createElement("span", {
|
|
122
|
-
ref:
|
|
124
|
+
ref: innerRef,
|
|
123
125
|
"aria-checked": checked,
|
|
124
126
|
"aria-disabled": disabled,
|
|
125
127
|
className: classNameElement("input-button"),
|
|
@@ -170,7 +172,7 @@ const radioProps = {
|
|
|
170
172
|
onChange: import_ds_utilities.PropTypes.func.description("Allows a function that is triggered once the radio changes"),
|
|
171
173
|
children: import_ds_utilities.PropTypes.node.description("Optional, if you want a checkbox customized"),
|
|
172
174
|
tabIndex: import_ds_utilities.PropTypes.number.description("HTML tabindex to manage focus"),
|
|
173
|
-
style: import_ds_utilities.PropTypes.
|
|
175
|
+
style: import_ds_utilities.PropTypes.object.description("style override object")
|
|
174
176
|
};
|
|
175
177
|
DSRadio.propTypes = radioProps;
|
|
176
178
|
DSRadio.displayName = "DSRadio";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/Radio/DSRadio.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable max-lines */\n/* eslint-disable react/no-unknown-property */\nimport React, { useRef } from 'react';\nimport { PropTypes, describe } from '@elliemae/ds-utilities';\nimport { convertPropToCssClassName } from '@elliemae/ds-classnames';\nimport { Circle } from './Circle';\n\ninterface DSRadioT {\n [x: string]: unknown;\n innerRef?: React.MutableRefObject<HTMLInputElement>;\n containerProps?: { [x: string]: unknown };\n className?: string;\n style?: React.CSSProperties;\n labelText?: string;\n htmlFor?: string;\n hasError?: boolean;\n readOnly?: boolean;\n disabled?: boolean;\n checked?: boolean;\n value?: string;\n name?: string;\n onKeyDown?: React.KeyboardEventHandler<HTMLSpanElement>;\n onChange?: React.ChangeEventHandler<HTMLInputElement>;\n children?: React.ReactNode | React.ReactNode[];\n tabIndex?: number;\n}\n\nconst DSRadio = ({\n containerProps,\n className,\n style,\n labelText,\n htmlFor,\n hasError,\n readOnly,\n disabled,\n checked,\n value,\n name,\n onChange,\n children,\n tabIndex,\n ...otherProps\n}: DSRadioT) => {\n // this will be solved when we move to styled components...\n // eslint-disable-next-line @typescript-eslint/unbound-method\n const { cssClassName, classNameElement } = convertPropToCssClassName('form-element-radio', className, {\n hasError,\n readOnly,\n disabled,\n });\n const checkRef = useRef<HTMLInputElement | null>(null);\n return (\n <div {...containerProps} className={cssClassName}>\n <label className={classNameElement('label')} htmlFor={htmlFor}>\n <input\n {...otherProps}\n ref={checkRef}\n aria-disabled={disabled}\n checked={disabled ? false : checked}\n className={classNameElement('input')}\n disabled={disabled}\n name={name}\n onChange={(e) => {\n if (!readOnly && !disabled) {\n onChange(e);\n }\n }}\n readOnly={readOnly}\n tabIndex={-1}\n type=\"radio\"\n value={value}\n />\n <span\n ref={
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADEvB,mBAA8B;AAC9B,0BAAoC;AACpC,2BAA0C;AAC1C,oBAAuB;AAsBvB,MAAM,UAAU,CAAC,
|
|
4
|
+
"sourcesContent": ["/* eslint-disable max-lines */\n/* eslint-disable react/no-unknown-property */\nimport React, { useRef } from 'react';\nimport { PropTypes, describe } from '@elliemae/ds-utilities';\nimport { convertPropToCssClassName } from '@elliemae/ds-classnames';\nimport { Circle } from './Circle';\n\ninterface DSRadioT {\n [x: string]: unknown;\n innerRef?: React.MutableRefObject<HTMLInputElement>;\n containerProps?: { [x: string]: unknown };\n className?: string;\n style?: React.CSSProperties;\n labelText?: string;\n htmlFor?: string;\n hasError?: boolean;\n readOnly?: boolean;\n disabled?: boolean;\n checked?: boolean;\n value?: string;\n name?: string;\n onKeyDown?: React.KeyboardEventHandler<HTMLSpanElement>;\n onChange?: React.ChangeEventHandler<HTMLInputElement>;\n children?: React.ReactNode | React.ReactNode[];\n tabIndex?: number;\n}\n\nconst DSRadio = ({\n containerProps,\n className,\n style,\n labelText,\n htmlFor,\n hasError,\n readOnly,\n disabled,\n checked,\n value,\n name,\n onChange,\n children,\n tabIndex,\n innerRef,\n ...otherProps\n}: DSRadioT) => {\n // this will be solved when we move to styled components...\n // eslint-disable-next-line @typescript-eslint/unbound-method\n const { cssClassName, classNameElement } = convertPropToCssClassName('form-element-radio', className, {\n hasError,\n readOnly,\n disabled,\n });\n const checkRef = useRef<HTMLInputElement | null>(null);\n return (\n <div {...containerProps} className={cssClassName}>\n <label className={classNameElement('label')} htmlFor={htmlFor}>\n <input\n {...otherProps}\n ref={checkRef}\n aria-disabled={disabled}\n checked={disabled ? false : checked}\n className={classNameElement('input')}\n disabled={disabled}\n name={name}\n onChange={(e) => {\n if (!readOnly && !disabled) {\n onChange(e);\n }\n }}\n readOnly={readOnly}\n tabIndex={-1}\n type=\"radio\"\n value={value}\n />\n <span\n ref={innerRef}\n aria-checked={checked}\n aria-disabled={disabled}\n className={classNameElement('input-button')}\n onKeyDown={(e) => {\n // really really bad pattern...\n // overwriting the target to point to the hidden input because the focus is on the span and not on the input...\n // we will solve this with a v2 of this when we move to controlled + styled components...\n e.target = checkRef.current;\n if (disabled) return;\n if (e.key === 'Enter' || e.keyCode === 32) {\n onChange(e);\n } else if (otherProps.onKeyDown) {\n otherProps.onKeyDown(e);\n }\n }}\n role=\"radio\"\n style={style}\n tabIndex={disabled ? -1 : tabIndex}\n // value={value} // should be unused?\n >\n <Circle checked={checked} />\n </span>\n <span className={classNameElement('label-text')}>{labelText}</span>\n </label>\n {children && <div className={classNameElement('radio-children')}>{children}</div>}\n </div>\n );\n};\n\nDSRadio.defaultProps = {\n containerProps: {},\n className: '',\n hasError: false,\n readOnly: false,\n disabled: false,\n checked: false,\n name: '',\n onChange: () => null,\n children: null,\n tabIndex: 0,\n};\n\nconst radioProps = {\n /** Injected props to wrapper element of component */\n containerProps: PropTypes.object.description('Injected props to wrapper element of component'),\n /** css class prop */\n className: PropTypes.string.description('css class prop'),\n /** name property to manage form */\n name: PropTypes.string.description('name property to manage form'),\n /**\n * Displayable label for the radio\n */\n labelText: PropTypes.string.description('Displayable label for the radio'),\n /** HTMLFOR property to manage form */\n htmlFor: PropTypes.element.description('HTMLFOR property to manage form'),\n /**\n * Whether the radio has error or not\n */\n hasError: PropTypes.bool.description('Whether the radio has error or not'),\n /**\n * Whether the radio is read only or not\n */\n readOnly: PropTypes.bool.description('Whether the radio is read only or not'),\n /**\n * Whether the radio is disabled or not\n */\n disabled: PropTypes.bool.description('Whether the radio is disabled or not'),\n /**\n * Whether the radio is checked or not\n */\n checked: PropTypes.bool.description('Whether the radio is checked or not'),\n /**\n * Value that takes the checkbox if it is checked\n */\n value: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.object]).description(\n 'Value that takes the checkbox if it is checked',\n ).isRequired,\n /**\n * Allows a function that is triggered once the radio changes\n */\n onChange: PropTypes.func.description('Allows a function that is triggered once the radio changes'),\n /**\n * Optional, if you want a checkbox customized\n */\n children: PropTypes.node.description('Optional, if you want a checkbox customized'),\n /** HTML tabindex to manage focus */\n tabIndex: PropTypes.number.description('HTML tabindex to manage focus'),\n /** style override object */\n style: PropTypes.object.description('style override object'),\n};\n\nDSRadio.propTypes = radioProps;\nDSRadio.displayName = 'DSRadio';\nconst DSRadioWithSchema = describe(DSRadio);\nDSRadioWithSchema.propTypes = radioProps;\n\nexport { DSRadio, DSRadioWithSchema };\n\nexport default DSRadio;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADEvB,mBAA8B;AAC9B,0BAAoC;AACpC,2BAA0C;AAC1C,oBAAuB;AAsBvB,MAAM,UAAU,CAAC,OAiBD;AAjBC,eACf;AAAA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,MAfe,IAgBZ,uBAhBY,IAgBZ;AAAA,IAfH;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA;AAKA,QAAM,EAAE,cAAc,qBAAqB,oDAA0B,sBAAsB,WAAW;AAAA,IACpG;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AACD,QAAM,WAAW,yBAAgC,IAAI;AACrD,SACE,mDAAC,wCAAQ,iBAAR;AAAA,IAAwB,WAAW;AAAA,MAClC,mDAAC;AAAA,IAAM,WAAW,iBAAiB,OAAO;AAAA,IAAG;AAAA,KAC3C,mDAAC,0CACK,aADL;AAAA,IAEC,KAAK;AAAA,IACL,iBAAe;AAAA,IACf,SAAS,WAAW,QAAQ;AAAA,IAC5B,WAAW,iBAAiB,OAAO;AAAA,IACnC;AAAA,IACA;AAAA,IAC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,8BAAU,KAAK,YAAY,oCAAoC;AAAA,EAIzE,UAAU,8BAAU,KAAK,YAAY,uCAAuC;AAAA,EAI5E,UAAU,8BAAU,KAAK,YAAY,sCAAsC;AAAA,EAI3E,SAAS,8BAAU,KAAK,YAAY,qCAAqC;AAAA,EAIzE,OAAO,8BAAU,UAAU,CAAC,8BAAU,QAAQ,8BAAU,QAAQ,8BAAU,MAAM,CAAC,EAAE,YACjF,gDACF,EAAE;AAAA,EAIF,UAAU,8BAAU,KAAK,YAAY,4DAA4D;AAAA,EAIjG,UAAU,8BAAU,KAAK,YAAY,6CAA6C;AAAA,EAElF,UAAU,8BAAU,OAAO,YAAY,+BAA+B;AAAA,EAEtE,OAAO,8BAAU,OAAO,YAAY,uBAAuB;AAC7D;AAEA,QAAQ,YAAY;AACpB,QAAQ,cAAc;AACtB,MAAM,oBAAoB,kCAAS,OAAO;AAC1C,kBAAkB,YAAY;AAI9B,IAAO,kBAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -38,7 +38,9 @@ const props = {
|
|
|
38
38
|
onKeyUp: PropTypes.func.description("on key up event handler"),
|
|
39
39
|
mask: PropTypes.oneOfType([
|
|
40
40
|
PropTypes.string,
|
|
41
|
-
PropTypes.func
|
|
41
|
+
PropTypes.func,
|
|
42
|
+
PropTypes.object,
|
|
43
|
+
PropTypes.array
|
|
42
44
|
]).description("mask for input mask component"),
|
|
43
45
|
useSubfix: PropTypes.string.description("add suffix to input"),
|
|
44
46
|
suffix: PropTypes.string.description("suffix for input"),
|