@elliemae/ds-form 3.0.0-next.14 → 3.0.0-next.15
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/CheckboxGroup/props.js +3 -7
- package/dist/cjs/CheckboxGroup/props.js.map +2 -2
- package/dist/cjs/ExpandableInput/ExpandableInputImpl.js +3 -13
- package/dist/cjs/ExpandableInput/ExpandableInputImpl.js.map +2 -2
- package/dist/cjs/FormItem/ValidationFieldWrapper.js +26 -26
- package/dist/cjs/FormItem/ValidationFieldWrapper.js.map +2 -2
- package/dist/cjs/RadioGroup/props.js +3 -6
- package/dist/cjs/RadioGroup/props.js.map +2 -2
- package/dist/cjs/TimeInput/TimeInputs.js +30 -34
- package/dist/cjs/TimeInput/TimeInputs.js.map +2 -2
- package/dist/cjs/TimeInput/utils.js +8 -8
- package/dist/cjs/TimeInput/utils.js.map +2 -2
- package/dist/cjs/Toggle/DSToggle.js +2 -2
- package/dist/cjs/Toggle/DSToggle.js.map +2 -2
- package/dist/cjs/Toggle/props.js +2 -2
- package/dist/cjs/Toggle/props.js.map +2 -2
- package/dist/esm/CheckboxGroup/props.js +2 -6
- package/dist/esm/CheckboxGroup/props.js.map +2 -2
- package/dist/esm/ExpandableInput/ExpandableInputImpl.js +2 -12
- package/dist/esm/ExpandableInput/ExpandableInputImpl.js.map +2 -2
- package/dist/esm/FormItem/ValidationFieldWrapper.js +26 -26
- package/dist/esm/FormItem/ValidationFieldWrapper.js.map +2 -2
- package/dist/esm/RadioGroup/props.js +2 -5
- package/dist/esm/RadioGroup/props.js.map +2 -2
- package/dist/esm/TimeInput/TimeInputs.js +2 -6
- package/dist/esm/TimeInput/TimeInputs.js.map +2 -2
- package/dist/esm/TimeInput/utils.js +1 -8
- package/dist/esm/TimeInput/utils.js.map +2 -2
- package/dist/esm/Toggle/DSToggle.js +1 -1
- package/dist/esm/Toggle/DSToggle.js.map +2 -2
- package/dist/esm/Toggle/props.js +1 -1
- package/dist/esm/Toggle/props.js.map +1 -1
- package/package.json +12 -12
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/TimeInput/utils.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import { addLeadingZeros } from '@elliemae/ds-utilities';\nimport { parseInt, isNaN } from '@elliemae/ds-utilities';\nimport {
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,0BAAgC;AAChC,2BAAgC;AAChC,
|
|
4
|
+
"sourcesContent": ["import { addLeadingZeros } from '@elliemae/ds-utilities';\nimport { parseInt, isNaN } from '@elliemae/ds-utilities';\nimport { AM, PM, ARROW_UP, ARROW_DOWN, SHIFT, PLACEHOLDER_TIME } from '@elliemae/ds-shared';\n\nconst isAM = (time) => time && time.hour() < 12;\n\nexport const isArrowIncrementDecrement = (key) => key === ARROW_DOWN || key === ARROW_UP || key === SHIFT;\n\nexport const setNativeValue = (element, value) => {\n if (!Object.getOwnPropertyDescriptor(element, 'value')) return;\n const valueSetter = Object.getOwnPropertyDescriptor(element, 'value').set;\n const prototype = Object.getPrototypeOf(element);\n const prototypeValueSetter = Object.getOwnPropertyDescriptor(prototype, 'value').set;\n\n if (valueSetter && valueSetter !== prototypeValueSetter) {\n prototypeValueSetter.call(element, value);\n } else {\n valueSetter.call(element, value);\n }\n element.dispatchEvent(new Event('input', { bubbles: true }));\n};\n\nexport const placeholderFormat = (position, format, use12Hours) => {\n if (position === PLACEHOLDER_TIME.hour) {\n return _placeholderHour(format, use12Hours);\n }\n if (position === PLACEHOLDER_TIME.minutes) {\n return format.indexOf('mm') > -1 ? 'mm' : 'm';\n }\n if (position === PLACEHOLDER_TIME.seconds) {\n return format.indexOf('ss') > -1 ? 'ss' : 's';\n }\n if (position === PLACEHOLDER_TIME.meridiem) {\n return format.indexOf('A') > -1 ? 'A' : 'a';\n }\n};\n\nconst _placeholderHour = (format, use12Hours) => {\n if (use12Hours) {\n return format.indexOf('hh') > -1 ? 'hh' : 'h';\n }\n return format.indexOf('HH') > -1 ? 'HH' : 'H';\n};\n\nconst formatTimeNumber = (value, shouldAddLeadingZeros) => {\n if (value === null || value === undefined) return '';\n return shouldAddLeadingZeros ? addLeadingZeros(2)(value) : String(value);\n};\n\nexport const formatMinutes = (format, value) => {\n const shouldAddLeadingZeros = format.indexOf('mm') > -1;\n return formatTimeNumber(value, shouldAddLeadingZeros);\n};\nexport const formatSeconds = (format, value) => {\n const shouldAddLeadingZeros = format.indexOf('ss') > -1;\n return formatTimeNumber(value, shouldAddLeadingZeros);\n};\nexport const formatHour = (format, value) => {\n const shouldAddLeadingZeros = format.indexOf('HH') > -1 || format.indexOf('hh') > -1;\n return formatTimeNumber(value, shouldAddLeadingZeros);\n};\n\nexport const formatMeridiem = (format, value) => (format.indexOf('A') > -1 ? value.toUpperCase() : value.toLowerCase());\n\nexport const parseTimeNumberFromText = (stringValue) => {\n const parsedInt = parseInt(stringValue);\n if (isNaN(parsedInt)) return null;\n\n return parsedInt;\n};\n\nexport const focusNextInput = (currentEl) => {\n const nextElement = currentEl.nextElementSibling;\n if (nextElement && nextElement.nextElementSibling) {\n nextElement.nextElementSibling.focus();\n }\n};\n\nexport const focusPreviousInput = (currentEl) => {\n const previousElement = currentEl.previousElementSibling;\n if (previousElement && previousElement.previousElementSibling) {\n previousElement.previousElementSibling.focus();\n }\n};\n\nexport const getValidTimeNumber = ({ min, max }, number, typed) => {\n if (number === undefined || number === null) return null;\n if (number > max) {\n if (isNaN(typed)) return parseInt(typed);\n return max;\n }\n if (number < min) return min;\n return number;\n};\n\nexport const shouldFocusNextInput = (max, number = 0, stringValue) => {\n const safeString = String(stringValue);\n const cleanString = safeString.startsWith('00') ? safeString.slice(1) : safeString;\n return number * 10 > max || String(max).length === cleanString.length;\n};\n\nexport const getTimeValuesFromTime = (time, format, use12Hours) => {\n if (!time || !time.hour) return {};\n const hours = use12Hours ? time.hour() % 12 || 12 : time.hour();\n const minutes = time.minutes();\n const seconds = time.seconds();\n const meridiem = !isAM(time) ? PM : AM;\n\n return {\n hours: formatHour(format, hours),\n minutes: formatMinutes(format, minutes),\n seconds: formatSeconds(format, seconds),\n meridiem,\n };\n};\n\nexport const resetTimeValues = () => ({\n hours: '',\n minutes: '',\n seconds: '',\n meridiem: AM,\n});\n\nexport const commonInputProps = (onKeyDown, onInputFocus, onClick) => ({\n pattern: '[0-9]*',\n type: 'text',\n onKeyDown,\n onClick,\n onFocus: onInputFocus,\n});\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,0BAAgC;AAChC,2BAAgC;AAChC,uBAAsE;AAEtE,MAAM,OAAO,CAAC,SAAS,QAAQ,KAAK,SAAS;AAEtC,MAAM,4BAA4B,CAAC,QAAQ,QAAQ,+BAAc,QAAQ,6BAAY,QAAQ;AAE7F,MAAM,iBAAiB,CAAC,SAAS,UAAU;AAChD,MAAI,CAAC,OAAO,yBAAyB,SAAS;AAAU;AACxD,QAAM,cAAc,OAAO,yBAAyB,SAAS,SAAS;AACtE,QAAM,YAAY,OAAO,eAAe;AACxC,QAAM,uBAAuB,OAAO,yBAAyB,WAAW,SAAS;AAEjF,MAAI,eAAe,gBAAgB,sBAAsB;AACvD,yBAAqB,KAAK,SAAS;AAAA,SAC9B;AACL,gBAAY,KAAK,SAAS;AAAA;AAE5B,UAAQ,cAAc,IAAI,MAAM,SAAS,EAAE,SAAS;AAAA;AAG/C,MAAM,oBAAoB,CAAC,UAAU,Q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ACA;AAAA,EACA,SAAS;AAAA;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -64,7 +64,7 @@ var React = __toESM(require("react"));
|
|
|
64
64
|
var import_react = __toESM(require("react"));
|
|
65
65
|
var import_react_desc = require("react-desc");
|
|
66
66
|
var import_DSToggleImpl = require("./DSToggleImpl");
|
|
67
|
-
var
|
|
67
|
+
var import_ds_shared = require("@elliemae/ds-shared");
|
|
68
68
|
const DSToggle = (_a) => {
|
|
69
69
|
var _b = _a, {
|
|
70
70
|
containerProps,
|
|
@@ -121,7 +121,7 @@ const props = {
|
|
|
121
121
|
labelOn: import_react_desc.PropTypes.string.description("Label to show when the toggle is ON"),
|
|
122
122
|
labelOff: import_react_desc.PropTypes.string.description("Label to show when the toggle is OFF"),
|
|
123
123
|
value: import_react_desc.PropTypes.string.description("Default value once the component is initialized"),
|
|
124
|
-
size: import_react_desc.PropTypes.oneOf(
|
|
124
|
+
size: import_react_desc.PropTypes.oneOf(import_ds_shared.dsBasicSizes).description("['s', 'm', 'l']"),
|
|
125
125
|
name: import_react_desc.PropTypes.string.description("Input name")
|
|
126
126
|
};
|
|
127
127
|
DSToggle.propTypes = props;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/Toggle/DSToggle.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import React from 'react';\nimport { PropTypes, describe } from 'react-desc';\nimport { DSToggleImpl } from './DSToggleImpl';\nimport { dsBasicSizes } from '@elliemae/ds-shared
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAkB;AAClB,wBAAoC;AACpC,0BAA6B;AAC7B,
|
|
4
|
+
"sourcesContent": ["import React from 'react';\nimport { PropTypes, describe } from 'react-desc';\nimport { DSToggleImpl } from './DSToggleImpl';\nimport { dsBasicSizes } from '@elliemae/ds-shared';\n\nconst DSToggle = ({\n containerProps,\n hasError,\n readOnly,\n disabled,\n checked,\n labelOn,\n labelOff,\n name,\n value,\n size,\n ...otherProps\n}) => (\n <DSToggleImpl\n {...otherProps}\n checked={checked}\n containerProps={containerProps}\n disabled={disabled}\n hasError={hasError}\n labelOff={labelOff}\n labelOn={labelOn}\n name={name}\n readOnly={readOnly}\n size={size}\n value={value}\n />\n);\n\nDSToggle.defaultProps = {\n labelOn: 'ON',\n labelOff: 'OFF',\n size: 's',\n hasError: false,\n readOnly: false,\n disabled: false,\n checked: undefined,\n};\n\nconst props = {\n /**\n * Set of Properties attached to the main container\n */\n containerProps: PropTypes.shape({}).description('Set of Properties attached to the main container'),\n /**\n * Whether the toggle has error or not\n */\n hasError: PropTypes.bool.description('Whether the toggle has error or not'),\n /**\n * Whether the toggle is read only or not\n */\n readOnly: PropTypes.bool.description('Whether the toggle is read only or not'),\n /**\n * Whether the toggle is disabled or not\n */\n disabled: PropTypes.bool.description('Whether the toggle is disabled or not'),\n /**\n * Whether the toggle is checked or not\n */\n checked: PropTypes.bool.description('Whether the toggle is checked or not'),\n /**\n * Allows a function that is triggered once the toggle changes\n */\n onChange: PropTypes.func.description('Allows a function that is triggered once the toggle changes'),\n /**\n * Label to show when the toggle is ON\n */\n labelOn: PropTypes.string.description('Label to show when the toggle is ON'),\n /**\n * Label to show when the toggle is OFF\n */\n labelOff: PropTypes.string.description('Label to show when the toggle is OFF'),\n /**\n * Default value once the component is initialized\n */\n value: PropTypes.string.description('Default value once the component is initialized'),\n /**\n * ['s', 'm', 'l']\n */\n size: PropTypes.oneOf(dsBasicSizes).description(\"['s', 'm', 'l']\"),\n /**\n * Input name\n */\n name: PropTypes.string.description('Input name'),\n};\n\nDSToggle.propTypes = props;\n\nconst DSToggleWithSchema = describe(DSToggle);\n\nDSToggleWithSchema.propTypes = props;\n\nexport default DSToggle;\n\nexport {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BAAU,MAAM,+BAAc,YAAY;AAAA,EAIhD,MAAM,4BAAU,OAAO,YAAY;AAAA;AAGrC,SAAS,YAAY;AAErB,MAAM,qBAAqB,gCAAS;AAEpC,mBAAmB,YAAY;AAE/B,IAAO,mBAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/cjs/Toggle/props.js
CHANGED
|
@@ -31,7 +31,7 @@ __export(props_exports, {
|
|
|
31
31
|
});
|
|
32
32
|
var React = __toESM(require("react"));
|
|
33
33
|
var import_prop_types = __toESM(require("prop-types"));
|
|
34
|
-
var
|
|
34
|
+
var import_ds_shared = require("@elliemae/ds-shared");
|
|
35
35
|
const togglePropTypes = {
|
|
36
36
|
containerProps: import_prop_types.default.shape({}),
|
|
37
37
|
hasError: import_prop_types.default.bool,
|
|
@@ -42,7 +42,7 @@ const togglePropTypes = {
|
|
|
42
42
|
labelOn: import_prop_types.default.string,
|
|
43
43
|
labelOff: import_prop_types.default.string,
|
|
44
44
|
value: import_prop_types.default.string,
|
|
45
|
-
size: import_prop_types.default.oneOf(
|
|
45
|
+
size: import_prop_types.default.oneOf(import_ds_shared.dsBasicSizes),
|
|
46
46
|
name: import_prop_types.default.string
|
|
47
47
|
};
|
|
48
48
|
module.exports = __toCommonJS(props_exports);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/Toggle/props.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import PropTypes from 'prop-types';\nimport { dsBasicSizes } from '@elliemae/ds-shared
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,wBAAsB;AACtB,
|
|
4
|
+
"sourcesContent": ["import PropTypes from 'prop-types';\nimport { dsBasicSizes } from '@elliemae/ds-shared';\n\nexport const togglePropTypes = {\n /**\n * Set of Properties attached to the main container\n */\n containerProps: PropTypes.shape({}),\n /**\n * Whether the toggle has error or not\n */\n hasError: PropTypes.bool,\n /**\n * Whether the toggle is read only or not\n */\n readOnly: PropTypes.bool,\n /**\n * Whether the toggle is disabled or not\n */\n disabled: PropTypes.bool,\n /**\n * Whether the toggle is checked or not\n */\n checked: PropTypes.bool,\n /**\n * Allows a function that is triggered once the toggle changes\n */\n onChange: PropTypes.func,\n /**\n * Label to show when the toggle is ON\n */\n labelOn: PropTypes.string,\n /**\n * Label to show when the toggle is OFF\n */\n labelOff: PropTypes.string,\n /**\n * Default value once the component is initialized\n */\n value: PropTypes.string,\n /**\n * ['s', 'm', 'l']\n */\n size: PropTypes.oneOf(dsBasicSizes),\n /**\n * Input name\n */\n name: PropTypes.string,\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,wBAAsB;AACtB,uBAA6B;AAEtB,MAAM,kBAAkB;AAAA,EAI7B,gBAAgB,0BAAU,MAAM;AAAA,EAIhC,UAAU,0BAAU;AAAA,EAIpB,UAAU,0BAAU;AAAA,EAIpB,UAAU,0BAAU;AAAA,EAIpB,SAAS,0BAAU;AAAA,EAInB,UAAU,0BAAU;AAAA,EAIpB,SAAS,0BAAU;AAAA,EAInB,UAAU,0BAAU;AAAA,EAIpB,OAAO,0BAAU;AAAA,EAIjB,MAAM,0BAAU,MAAM;AAAA,EAItB,MAAM,0BAAU;AAAA;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { PropTypes } from "react-desc";
|
|
3
3
|
import { DSCheckbox } from "../Checkbox";
|
|
4
|
-
import { orientation as checkboxGroupOrientation } from "@elliemae/ds-shared
|
|
4
|
+
import { orientation as checkboxGroupOrientation } from "@elliemae/ds-shared";
|
|
5
5
|
const props = {
|
|
6
6
|
onChange: PropTypes.func.description("Allows a function that is triggered once the checkbox group changes"),
|
|
7
|
-
activeValue: PropTypes.oneOfType([
|
|
8
|
-
PropTypes.string,
|
|
9
|
-
PropTypes.number,
|
|
10
|
-
PropTypes.array
|
|
11
|
-
]).description("Default active value"),
|
|
7
|
+
activeValue: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.array]).description("Default active value"),
|
|
12
8
|
children: PropTypes.arrayOf(PropTypes.shape({
|
|
13
9
|
type: DSCheckbox
|
|
14
10
|
})).description("Checkbox group items to show of type DSCheckbox"),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/CheckboxGroup/props.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { PropTypes } from 'react-desc';\nimport { DSCheckbox } from '../Checkbox';\nimport { orientation as checkboxGroupOrientation } from '@elliemae/ds-shared
|
|
5
|
-
"mappings": "AAAA;ACAA;AACA;AACA;AAEO,MAAM,QAAQ;AAAA,EAInB,UAAU,UAAU,KAAK,
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { PropTypes } from 'react-desc';\nimport { DSCheckbox } from '../Checkbox';\nimport { orientation as checkboxGroupOrientation } from '@elliemae/ds-shared';\n\nexport const props = {\n /**\n * Allows a function that is triggered once the checkbox group changes\n */\n onChange: PropTypes.func.description('Allows a function that is triggered once the checkbox group changes'),\n /**\n * Default active value\n */\n activeValue: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.array]).description(\n 'Default active value',\n ),\n /**\n * Checkbox group items to show of type DSCheckbox\n */\n children: PropTypes.arrayOf(\n PropTypes.shape({\n type: DSCheckbox,\n }),\n ).description('Checkbox group items to show of type DSCheckbox'),\n /**\n * Whether the checkbox group is disabled or not\n */\n disabled: PropTypes.bool.description('Whether the checkbox group is disabled or not'),\n /**\n * ['horizontal', 'vertical']\n */\n orientation: PropTypes.oneOf(checkboxGroupOrientation).description(\"['horizontal', 'vertical']\"),\n /**\n * label props\n */\n labelProps: PropTypes.objectOf(\n PropTypes.shape({\n feedbackMessage: PropTypes.string,\n labelText: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),\n required: PropTypes.bool,\n }),\n ).description('label props'),\n};\n"],
|
|
5
|
+
"mappings": "AAAA;ACAA;AACA;AACA;AAEO,MAAM,QAAQ;AAAA,EAInB,UAAU,UAAU,KAAK,YAAY;AAAA,EAIrC,aAAa,UAAU,UAAU,CAAC,UAAU,QAAQ,UAAU,QAAQ,UAAU,QAAQ,YACtF;AAAA,EAKF,UAAU,UAAU,QAClB,UAAU,MAAM;AAAA,IACd,MAAM;AAAA,MAER,YAAY;AAAA,EAId,UAAU,UAAU,KAAK,YAAY;AAAA,EAIrC,aAAa,UAAU,MAAM,0BAA0B,YAAY;AAAA,EAInE,YAAY,UAAU,SACpB,UAAU,MAAM;AAAA,IACd,iBAAiB,UAAU;AAAA,IAC3B,WAAW,UAAU,UAAU,CAAC,UAAU,QAAQ,UAAU;AAAA,IAC5D,UAAU,UAAU;AAAA,MAEtB,YAAY;AAAA;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -20,7 +20,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
20
20
|
import * as React from "react";
|
|
21
21
|
import React2, { Component, cloneElement } from "react";
|
|
22
22
|
import { aggregatedClasses } from "@elliemae/ds-classnames";
|
|
23
|
-
import { isFunction } from "@elliemae/ds-shared
|
|
23
|
+
import { isFunction } from "@elliemae/ds-shared";
|
|
24
24
|
import { InputAddonWrapper } from "../Input";
|
|
25
25
|
const blockName = "expandable-input";
|
|
26
26
|
const ExpandableInput = aggregatedClasses("div")(blockName, null, ({ isOpen }) => ({ opened: isOpen }));
|
|
@@ -32,17 +32,7 @@ class ExpandableInputImpl extends Component {
|
|
|
32
32
|
this.input.focus();
|
|
33
33
|
}
|
|
34
34
|
render() {
|
|
35
|
-
const {
|
|
36
|
-
innerRef,
|
|
37
|
-
triggerComponent,
|
|
38
|
-
children,
|
|
39
|
-
width,
|
|
40
|
-
isOpen,
|
|
41
|
-
onOpen,
|
|
42
|
-
onClose,
|
|
43
|
-
onBlur,
|
|
44
|
-
containerProps
|
|
45
|
-
} = this.props;
|
|
35
|
+
const { innerRef, triggerComponent, children, width, isOpen, onOpen, onClose, onBlur, containerProps } = this.props;
|
|
46
36
|
const InputComponent = React2.Children.only(children);
|
|
47
37
|
const handleTriggerClick = (e) => {
|
|
48
38
|
if (isFunction(triggerComponent.onClick))
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/ExpandableInput/ExpandableInputImpl.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { Component, cloneElement } from 'react';\nimport { aggregatedClasses } from '@elliemae/ds-classnames';\nimport { isFunction } from '@elliemae/ds-shared
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;ACAA;AACA;AACA;AACA;AAEA,MAAM,YAAY;AAElB,MAAM,kBAAkB,kBAAkB,
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { Component, cloneElement } from 'react';\nimport { aggregatedClasses } from '@elliemae/ds-classnames';\nimport { isFunction } from '@elliemae/ds-shared';\nimport { InputAddonWrapper } from '../Input';\n\nconst blockName = 'expandable-input';\n\nconst ExpandableInput = aggregatedClasses('div')(blockName, null, ({ isOpen }) => ({ opened: isOpen }));\nconst InputWrapper = aggregatedClasses(InputAddonWrapper)(blockName, 'wrapper', ({ isOpen }) => ({ opened: isOpen }));\n\nclass ExpandableInputImpl extends Component {\n componentDidUpdate(prevProps) {\n const { isOpen } = this.props;\n if (isOpen && isOpen !== prevProps.isOpen) this.input.focus();\n }\n\n render() {\n const { innerRef, triggerComponent, children, width, isOpen, onOpen, onClose, onBlur, containerProps } = this.props;\n const InputComponent = React.Children.only(children);\n const handleTriggerClick = (e) => {\n if (isFunction(triggerComponent.onClick)) triggerComponent.onClick(e);\n if (isOpen) {\n onClose();\n } else {\n onOpen();\n }\n };\n\n return (\n <ExpandableInput\n {...containerProps}\n classProps={{ isOpen }}\n innerRef={innerRef}\n style={{ width: isOpen && width }}\n >\n <InputWrapper\n rightComponents={[\n cloneElement(triggerComponent, {\n key: 'handler',\n onClick: handleTriggerClick,\n }),\n ]}\n >\n {cloneElement(InputComponent, {\n className: 'expandable-input__input',\n innerRef: (node) => (this.input = node),\n onBlur,\n })}\n </InputWrapper>\n </ExpandableInput>\n );\n }\n}\n\nexport { ExpandableInputImpl };\nexport default ExpandableInputImpl;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;ACAA;AACA;AACA;AACA;AAEA,MAAM,YAAY;AAElB,MAAM,kBAAkB,kBAAkB,OAAO,WAAW,MAAM,CAAC,EAAE,aAAc,GAAE,QAAQ;AAC7F,MAAM,eAAe,kBAAkB,mBAAmB,WAAW,WAAW,CAAC,EAAE,aAAc,GAAE,QAAQ;AAE3G,kCAAkC,UAAU;AAAA,EAC1C,mBAAmB,WAAW;AAC5B,UAAM,EAAE,WAAW,KAAK;AACxB,QAAI,UAAU,WAAW,UAAU;AAAQ,WAAK,MAAM;AAAA;AAAA,EAGxD,SAAS;AACP,UAAM,EAAE,UAAU,kBAAkB,UAAU,OAAO,QAAQ,QAAQ,SAAS,QAAQ,mBAAmB,KAAK;AAC9G,UAAM,iBAAiB,OAAM,SAAS,KAAK;AAC3C,UAAM,qBAAqB,CAAC,MAAM;AAChC,UAAI,WAAW,iBAAiB;AAAU,yBAAiB,QAAQ;AACnE,UAAI,QAAQ;AACV;AAAA,aACK;AACL;AAAA;AAAA;AAIJ,WACE,qCAAC,iBAAD,iCACM,iBADN;AAAA,MAEE,YAAY,EAAE;AAAA,MACd;AAAA,MACA,OAAO,EAAE,OAAO,UAAU;AAAA,QAE1B,qCAAC,cAAD;AAAA,MACE,iBAAiB;AAAA,QACf,aAAa,kBAAkB;AAAA,UAC7B,KAAK;AAAA,UACL,SAAS;AAAA;AAAA;AAAA,OAIZ,aAAa,gBAAgB;AAAA,MAC5B,WAAW;AAAA,MACX,UAAU,CAAC,SAAU,KAAK,QAAQ;AAAA,MAClC;AAAA;AAAA;AAAA;AASZ,IAAO,8BAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -22,6 +22,32 @@ import { Component } from "react";
|
|
|
22
22
|
class ValidationFieldWrapper extends Component {
|
|
23
23
|
constructor(props) {
|
|
24
24
|
super(props);
|
|
25
|
+
this.handleChange = (e) => {
|
|
26
|
+
const { onChange } = this.props;
|
|
27
|
+
this.setState({ value: e.target.value });
|
|
28
|
+
if (onChange)
|
|
29
|
+
onChange(e);
|
|
30
|
+
};
|
|
31
|
+
this.handleBlur = (e) => {
|
|
32
|
+
const { onBlur, validateOnBlur } = this.props;
|
|
33
|
+
const { value } = this.state;
|
|
34
|
+
if (validateOnBlur)
|
|
35
|
+
this.executeValidations(value);
|
|
36
|
+
onBlur(e);
|
|
37
|
+
};
|
|
38
|
+
this.executeValidations = (value) => {
|
|
39
|
+
const { validations } = this.props;
|
|
40
|
+
if (validations && Array.isArray(validations)) {
|
|
41
|
+
if (!validations.some((validation) => {
|
|
42
|
+
const { error, payload } = validation({ value });
|
|
43
|
+
if (error)
|
|
44
|
+
this.setState({ validationMessage: payload, state: error });
|
|
45
|
+
return error;
|
|
46
|
+
})) {
|
|
47
|
+
this.setState({ hasError: false });
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
};
|
|
25
51
|
this.state = {
|
|
26
52
|
value: props.value
|
|
27
53
|
};
|
|
@@ -38,32 +64,6 @@ class ValidationFieldWrapper extends Component {
|
|
|
38
64
|
value
|
|
39
65
|
});
|
|
40
66
|
}
|
|
41
|
-
handleChange(e) {
|
|
42
|
-
const { onChange } = this.props;
|
|
43
|
-
this.setState({ value: e.target.value });
|
|
44
|
-
if (onChange)
|
|
45
|
-
onChange(e);
|
|
46
|
-
}
|
|
47
|
-
handleBlur(e) {
|
|
48
|
-
const { onBlur, validateOnBlur } = this.props;
|
|
49
|
-
const { value } = this.state;
|
|
50
|
-
if (validateOnBlur)
|
|
51
|
-
this.executeValidations(value);
|
|
52
|
-
onBlur(e);
|
|
53
|
-
}
|
|
54
|
-
executeValidations(value) {
|
|
55
|
-
const { validations } = this.props;
|
|
56
|
-
if (validations && Array.isArray(validations)) {
|
|
57
|
-
if (!validations.some((validation) => {
|
|
58
|
-
const { error, payload } = validation({ value });
|
|
59
|
-
if (error)
|
|
60
|
-
this.setState({ validationMessage: payload, state: error });
|
|
61
|
-
return error;
|
|
62
|
-
})) {
|
|
63
|
-
this.setState({ hasError: false });
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
67
|
render() {
|
|
68
68
|
const { children } = this.props;
|
|
69
69
|
const { value, validationMessage, validationState, hasError } = this.state;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/FormItem/ValidationFieldWrapper.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { Component } from 'react';\n\nexport default class ValidationFieldWrapper extends Component {\n static defaultProps = {\n validateOnBlur: false,\n validateOnChange: false,\n name: '', // name in context of the form\n value: '',\n validate: () => null,\n onChange: () => null,\n onBlur: () => null,\n };\n\n constructor(props) {\n super(props);\n this.state = {\n value: props.value,\n };\n }\n\n componentDidMount() {\n const { value } = this.state;\n this.executeValidations(value);\n }\n\n static getDerivedStateFromProps(nextProps, prevState) {\n const { value } = nextProps;\n if (value === prevState.value) return null;\n return {\n ...prevState,\n value,\n };\n }\n\n handleChange(e) {\n const { onChange } = this.props;\n this.setState({ value: e.target.value });\n if (onChange) onChange(e);\n }\n\n handleBlur(e) {\n const { onBlur, validateOnBlur } = this.props;\n const { value } = this.state;\n if (validateOnBlur) this.executeValidations(value);\n onBlur(e);\n }\n\n executeValidations(value) {\n const { validations } = this.props;\n if (validations && Array.isArray(validations)) {\n if (\n !validations.some(validation => {\n const { error, payload } = validation({ value });\n if (error)\n this.setState({ validationMessage: payload, state: error });\n return error;\n })\n ) {\n this.setState({ hasError: false });\n }\n }\n }\n\n render() {\n const { children } = this.props;\n const { value, validationMessage, validationState, hasError } = this.state;\n return children({\n value,\n validationMessage,\n validationState,\n hasError,\n onChange: this.handleChange,\n onBlur: this.handleBlur,\n });\n }\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;ACAA;AAEA,qCAAoD,UAAU;AAAA,EAW5D,YAAY,OAAO;AACjB,UAAM;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { Component } from 'react';\n\nexport default class ValidationFieldWrapper extends Component {\n static defaultProps = {\n validateOnBlur: false,\n validateOnChange: false,\n name: '', // name in context of the form\n value: '',\n validate: () => null,\n onChange: () => null,\n onBlur: () => null,\n };\n\n constructor(props) {\n super(props);\n this.state = {\n value: props.value,\n };\n }\n\n componentDidMount() {\n const { value } = this.state;\n this.executeValidations(value);\n }\n\n static getDerivedStateFromProps(nextProps, prevState) {\n const { value } = nextProps;\n if (value === prevState.value) return null;\n return {\n ...prevState,\n value,\n };\n }\n\n handleChange = (e) => {\n const { onChange } = this.props;\n this.setState({ value: e.target.value });\n if (onChange) onChange(e);\n }\n\n handleBlur = (e) => {\n const { onBlur, validateOnBlur } = this.props;\n const { value } = this.state;\n if (validateOnBlur) this.executeValidations(value);\n onBlur(e);\n }\n\n executeValidations = (value) => {\n const { validations } = this.props;\n if (validations && Array.isArray(validations)) {\n if (\n !validations.some(validation => {\n const { error, payload } = validation({ value });\n if (error)\n this.setState({ validationMessage: payload, state: error });\n return error;\n })\n ) {\n this.setState({ hasError: false });\n }\n }\n }\n\n render() {\n const { children } = this.props;\n const { value, validationMessage, validationState, hasError } = this.state;\n return children({\n value,\n validationMessage,\n validationState,\n hasError,\n onChange: this.handleChange,\n onBlur: this.handleBlur,\n });\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;ACAA;AAEA,qCAAoD,UAAU;AAAA,EAW5D,YAAY,OAAO;AACjB,UAAM;AAoBR,wBAAe,CAAC,MAAM;AACpB,YAAM,EAAE,aAAa,KAAK;AAC1B,WAAK,SAAS,EAAE,OAAO,EAAE,OAAO;AAChC,UAAI;AAAU,iBAAS;AAAA;AAGzB,sBAAa,CAAC,MAAM;AAClB,YAAM,EAAE,QAAQ,mBAAmB,KAAK;AACxC,YAAM,EAAE,UAAU,KAAK;AACvB,UAAI;AAAgB,aAAK,mBAAmB;AAC5C,aAAO;AAAA;AAGT,8BAAqB,CAAC,UAAU;AAC9B,YAAM,EAAE,gBAAgB,KAAK;AAC7B,UAAI,eAAe,MAAM,QAAQ,cAAc;AAC7C,YACE,CAAC,YAAY,KAAK,gBAAc;AAC9B,gBAAM,EAAE,OAAO,YAAY,WAAW,EAAE;AACxC,cAAI;AACF,iBAAK,SAAS,EAAE,mBAAmB,SAAS,OAAO;AACrD,iBAAO;AAAA,YAET;AACA,eAAK,SAAS,EAAE,UAAU;AAAA;AAAA;AAAA;AA3C9B,SAAK,QAAQ;AAAA,MACX,OAAO,MAAM;AAAA;AAAA;AAAA,EAIjB,oBAAoB;AAClB,UAAM,EAAE,UAAU,KAAK;AACvB,SAAK,mBAAmB;AAAA;AAAA,SAGnB,yBAAyB,WAAW,WAAW;AACpD,UAAM,EAAE,UAAU;AAClB,QAAI,UAAU,UAAU;AAAO,aAAO;AACtC,WAAO,iCACF,YADE;AAAA,MAEL;AAAA;AAAA;AAAA,EAiCJ,SAAS;AACP,UAAM,EAAE,aAAa,KAAK;AAC1B,UAAM,EAAE,OAAO,mBAAmB,iBAAiB,aAAa,KAAK;AACrE,WAAO,SAAS;AAAA,MACd;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,UAAU,KAAK;AAAA,MACf,QAAQ,KAAK;AAAA;AAAA;AAAA;AArEV,AADT,uBACS,eAAe;AAAA,EACpB,gBAAgB;AAAA,EAChB,kBAAkB;AAAA,EAClB,MAAM;AAAA,EACN,OAAO;AAAA,EACP,UAAU,MAAM;AAAA,EAChB,UAAU,MAAM;AAAA,EAChB,QAAQ,MAAM;AAAA;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { PropTypes } from "react-desc";
|
|
3
|
-
import { orientation as radioGroupOrientation } from "@elliemae/ds-shared
|
|
3
|
+
import { orientation as radioGroupOrientation } from "@elliemae/ds-shared";
|
|
4
4
|
const props = {
|
|
5
5
|
containerProps: PropTypes.object.description("Inject props to component wrapper"),
|
|
6
6
|
onChange: PropTypes.func.description("Allows a function that is triggered once the radio group changes"),
|
|
7
|
-
activeValue: PropTypes.oneOfType([
|
|
8
|
-
PropTypes.string,
|
|
9
|
-
PropTypes.number
|
|
10
|
-
]).description("Selected default active value"),
|
|
7
|
+
activeValue: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).description("Selected default active value"),
|
|
11
8
|
children: PropTypes.arrayOf(PropTypes.element).isRequired.description("Radio group items to show of type DSRadio"),
|
|
12
9
|
orientation: PropTypes.oneOf(radioGroupOrientation).description("['horizontal', 'vertical']"),
|
|
13
10
|
disabled: PropTypes.bool.description(""),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/RadioGroup/props.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { PropTypes } from 'react-desc';\nimport { orientation as radioGroupOrientation } from '@elliemae/ds-shared
|
|
5
|
-
"mappings": "AAAA;ACAA;AACA;AAEO,MAAM,QAAQ;AAAA,EAEnB,gBAAgB,UAAU,OAAO,
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { PropTypes } from 'react-desc';\nimport { orientation as radioGroupOrientation } from '@elliemae/ds-shared';\n\nexport const props = {\n /** Inject props to component wrapper */\n containerProps: PropTypes.object.description('Inject props to component wrapper'),\n /**\n * Allows a function that is triggered once the radio group changes\n */\n onChange: PropTypes.func.description('Allows a function that is triggered once the radio group changes'),\n /**\n * Selected default active value\n */\n activeValue: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).description('Selected default active value'),\n /**\n * Radio group items to show of type DSRadio\n */\n children: PropTypes.arrayOf(PropTypes.element).isRequired.description('Radio group items to show of type DSRadio'),\n /**\n * ['horizontal', 'vertical']\n */\n orientation: PropTypes.oneOf(radioGroupOrientation).description(\"['horizontal', 'vertical']\"),\n /**\n * Whether the radio group is disabled or not\n */\n disabled: PropTypes.bool.description(''),\n labelProps: PropTypes.shape({\n feedbackMessage: PropTypes.string,\n labelText: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),\n required: PropTypes.bool,\n }).description('Whether the radio group is disabled or not'),\n};\n"],
|
|
5
|
+
"mappings": "AAAA;ACAA;AACA;AAEO,MAAM,QAAQ;AAAA,EAEnB,gBAAgB,UAAU,OAAO,YAAY;AAAA,EAI7C,UAAU,UAAU,KAAK,YAAY;AAAA,EAIrC,aAAa,UAAU,UAAU,CAAC,UAAU,QAAQ,UAAU,SAAS,YAAY;AAAA,EAInF,UAAU,UAAU,QAAQ,UAAU,SAAS,WAAW,YAAY;AAAA,EAItE,aAAa,UAAU,MAAM,uBAAuB,YAAY;AAAA,EAIhE,UAAU,UAAU,KAAK,YAAY;AAAA,EACrC,YAAY,UAAU,MAAM;AAAA,IAC1B,iBAAiB,UAAU;AAAA,IAC3B,WAAW,UAAU,UAAU,CAAC,UAAU,QAAQ,UAAU;AAAA,IAC5D,UAAU,UAAU;AAAA,KACnB,YAAY;AAAA;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -51,7 +51,7 @@ import {
|
|
|
51
51
|
END,
|
|
52
52
|
PLACEHOLDER_TIME,
|
|
53
53
|
SHIFT
|
|
54
|
-
} from "@elliemae/ds-shared
|
|
54
|
+
} from "@elliemae/ds-shared";
|
|
55
55
|
const blockName = "input-times-group";
|
|
56
56
|
const InputTimesGroup = aggregatedClasses("div")(blockName);
|
|
57
57
|
const TimeInput = aggregatedClasses("input")(blockName, "input");
|
|
@@ -322,11 +322,7 @@ const TimeInputs = ({
|
|
|
322
322
|
}));
|
|
323
323
|
};
|
|
324
324
|
const renderTimeInputs = () => {
|
|
325
|
-
const inputs = [
|
|
326
|
-
renderHoursInput(),
|
|
327
|
-
renderMinutesInput(),
|
|
328
|
-
renderSecondsInput()
|
|
329
|
-
];
|
|
325
|
+
const inputs = [renderHoursInput(), renderMinutesInput(), renderSecondsInput()];
|
|
330
326
|
const inputsWithDividers = inputs.reduce((acc, input, index) => input ? acc.concat([
|
|
331
327
|
index ? /* @__PURE__ */ React2.createElement(TimeDivider, {
|
|
332
328
|
key: index,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/TimeInput/TimeInputs.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable complexity */\n/* eslint-disable react/prop-types */\n/* eslint-disable max-lines */\n/* eslint-disable max-statements */\nimport React, { useEffect, useState } from 'react';\nimport { aggregatedClasses } from '@elliemae/ds-classnames';\nimport moment from 'moment';\nimport {\n commonInputProps,\n formatHour,\n formatMinutes,\n formatSeconds,\n formatMeridiem,\n getValidTimeNumber,\n setNativeValue,\n parseTimeNumberFromText,\n focusNextInput,\n focusPreviousInput,\n getTimeValuesFromTime,\n isArrowIncrementDecrement,\n shouldFocusNextInput,\n placeholderFormat,\n} from './utils';\nimport {\n AM,\n PM,\n ARROW_UP,\n ARROW_DOWN,\n BACKSPACE,\n ESCAPE,\n HOME,\n HOUR_RANGE_12,\n HOUR_RANGE_24,\n GENERAL_TIME_RANGE,\n END,\n PLACEHOLDER_TIME,\n SHIFT,\n} from '@elliemae/ds-shared/constants';\n\nconst blockName = 'input-times-group';\n\nconst InputTimesGroup = aggregatedClasses('div')(blockName);\nconst TimeInput = aggregatedClasses('input')(blockName, 'input');\nconst Divider = aggregatedClasses('span')(\n blockName,\n 'divider',\n ({ value }) => ({\n value,\n }),\n);\n\n// eslint-disable-next-line react/prop-types\nconst TimeDivider = ({ content = ':', value = '' }) => (\n <Divider value={!!value}>{content}</Divider>\n);\n\nconst TimeInputs = ({\n time,\n format,\n use12Hours,\n step = 1,\n showHours,\n showMinutes,\n showSeconds,\n onChange,\n disabled,\n innerRef,\n clearable,\n 'arial-label': ariaLabel,\n 'aria-label': ariaLabel2,\n}) => {\n const [meridiem, setMeridiem] = useState('');\n const [hours, setHours] = useState('');\n const [minutes, setMinutes] = useState('');\n const [hasInputValue, setHasInputValue] = useState(false);\n const [seconds, setSeconds] = useState('');\n const [currentKey, setCurrentKey] = useState('');\n const [hasInputBeenTriggered, setHasInputBeenTriggered] = useState(false);\n\n const [lastTypedNumber, setLastTypedNumber] = useState(null);\n const inputRefs = {\n hours: null,\n minutes: null,\n seconds: null,\n meridiem: null,\n };\n\n useEffect(() => {\n if (time && moment(time).isValid()) {\n const timeValues = getTimeValuesFromTime(time, format, use12Hours);\n\n setMeridiem(timeValues.meridiem);\n setHours(timeValues.hours);\n setMinutes(timeValues.minutes);\n setSeconds(timeValues.seconds);\n } else {\n setMeridiem('');\n setHours('');\n setMinutes('');\n setSeconds('');\n }\n }, [time, format, use12Hours]);\n\n useEffect(() => {\n const selectedTime = time || moment();\n if (isTimeCompletelySet() && selectedTime.hours && hasInputBeenTriggered) {\n if (showHours && hours) selectedTime.hours(hours);\n if (showMinutes && minutes) selectedTime.minutes(minutes);\n if (showSeconds && seconds) selectedTime.seconds(seconds);\n if (use12Hours && meridiem) {\n const nextHours =\n meridiem.toLowerCase() === AM ? hours % 12 : (hours % 12) + 12;\n selectedTime.hour(nextHours);\n }\n onChange(selectedTime);\n setHasInputBeenTriggered(false);\n }\n }, [hours, minutes, seconds, meridiem]);\n\n const focusNextInputIfNeeded = (currentEl, max, number) => {\n if (\n shouldFocusNextInput(max, number, currentEl.value) &&\n !isArrowIncrementDecrement(currentKey) &&\n !hasInputValue\n ) {\n focusNextInput(currentEl);\n }\n };\n\n const getNextTimeValue = (value, incrementing = true) => {\n const parsedValue = parseTimeNumberFromText(value);\n return incrementing ? parsedValue + step : parsedValue - step;\n };\n\n const onInputFocus = (e) => {\n e.preventDefault();\n e.stopPropagation();\n e.target.select();\n };\n\n const onClick = (e) => {\n if (e.target.value) {\n setHasInputValue(true);\n }\n };\n\n // eslint-disable-next-line max-statements\n const onKeyDown = (event, max) => {\n const { target } = event;\n const { value } = target;\n setLastTypedNumber(event.key);\n switch (event.key) {\n case ARROW_UP: {\n event.preventDefault();\n setCurrentKey(event.key);\n const incrementedValue = getNextTimeValue(value);\n setNativeValue(event.target, incrementedValue);\n break;\n }\n case ARROW_DOWN: {\n event.preventDefault();\n setCurrentKey(event.key);\n const decrementedValue = getNextTimeValue(value, false);\n setNativeValue(event.target, decrementedValue);\n break;\n }\n case BACKSPACE: {\n event.preventDefault();\n if (!value) {\n focusPreviousInput(event.target);\n } else {\n setNativeValue(event.target, '');\n }\n break;\n }\n case ESCAPE: {\n event.preventDefault();\n event.target.blur();\n break;\n }\n case HOME: {\n event.preventDefault();\n setNativeValue(event.target, String(max));\n focusNextInput(event.target);\n break;\n }\n case END: {\n event.preventDefault();\n setNativeValue(event.target, '00');\n focusNextInput(event.target);\n break;\n }\n case SHIFT:\n event.preventDefault();\n setCurrentKey(event.key);\n break;\n default:\n break;\n }\n };\n\n const isTimeCompletelySet = () => {\n let neededValues = [];\n\n if (showHours) neededValues = [...neededValues, hours || null];\n if (showMinutes) neededValues = [...neededValues, minutes || null];\n if (showSeconds) neededValues = [...neededValues, seconds || null];\n if (use12Hours) neededValues = [...neededValues, meridiem || null];\n\n return !neededValues.some((value) => !value);\n };\n\n const handleSecondsChange = (e) => {\n const { value } = e.target;\n const secondsHandled = parseTimeNumberFromText(value);\n\n const nextSeconds = getValidTimeNumber(\n GENERAL_TIME_RANGE,\n secondsHandled,\n lastTypedNumber,\n );\n\n setSeconds(formatSeconds(format, nextSeconds));\n setHasInputBeenTriggered(true);\n focusNextInputIfNeeded(e.target, GENERAL_TIME_RANGE.max, value);\n };\n\n const handleMinutesChange = (e) => {\n const { value } = e.target;\n const minutesHandled = parseTimeNumberFromText(value);\n const nextMinutes = getValidTimeNumber(\n GENERAL_TIME_RANGE,\n minutesHandled,\n lastTypedNumber,\n );\n\n setMinutes(formatMinutes(format, nextMinutes));\n setHasInputBeenTriggered(true);\n focusNextInputIfNeeded(e.target, GENERAL_TIME_RANGE.max, value);\n };\n\n const handleHoursChange = (e) => {\n const { value } = e.target;\n const hour = parseTimeNumberFromText(value);\n const hoursRange = use12Hours ? HOUR_RANGE_12 : HOUR_RANGE_24;\n\n const nextHour = getValidTimeNumber(hoursRange, hour, lastTypedNumber);\n setHours(formatHour(format, nextHour));\n setHasInputBeenTriggered(true);\n focusNextInputIfNeeded(e.target, hoursRange.max, value);\n };\n\n const handleMeridiemKeyDown = (e) => {\n if (e.key === ARROW_UP || e.key === 'a') {\n setMeridiem(formatMeridiem(format, AM));\n } else if (e.key === ARROW_DOWN || e.key === 'p') {\n setMeridiem(formatMeridiem(format, PM));\n } else if (e.key === SHIFT) {\n setCurrentKey(e.key);\n } else if (e.key === BACKSPACE) {\n setMeridiem('');\n }\n setHasInputBeenTriggered(true);\n };\n\n const handleMeridiemBlur = (e) => {\n const { value } = e.target;\n if (value !== AM && value !== PM) {\n setMeridiem('');\n }\n };\n\n const handleOnBlur = (event) => {\n const selectedTime = moment();\n if (clearable && !event.currentTarget.contains(event.relatedTarget)) {\n if (showHours && hours) selectedTime.hours(hours);\n if (showMinutes && minutes) selectedTime.minutes(minutes);\n if (showSeconds && seconds) selectedTime.seconds(seconds);\n if (use12Hours && meridiem) {\n const nextHours =\n meridiem.toLowerCase() === AM ? hours % 12 : (hours % 12) + 12;\n selectedTime.hour(nextHours);\n }\n onChange(selectedTime);\n }\n };\n\n const renderSecondsInput = () => {\n if (!showSeconds) return null;\n\n return (\n <TimeInput\n {...commonInputProps(\n (e) => onKeyDown(e, GENERAL_TIME_RANGE.max),\n onInputFocus,\n onClick,\n )}\n key=\"seconds-input\"\n data-testid=\"ds-time-input__seconds\"\n aria-label={ariaLabel || ariaLabel2 || 'Seconds Input'}\n disabled={disabled}\n // eslint-disable-next-line no-return-assign\n innerRef={(node) => (inputRefs.seconds = node)}\n onChange={handleSecondsChange}\n placeholder={placeholderFormat(PLACEHOLDER_TIME.seconds, format)}\n value={seconds}\n />\n );\n };\n\n const renderMinutesInput = () => {\n if (!showMinutes) return null;\n\n return (\n <TimeInput\n {...commonInputProps(\n (e) => onKeyDown(e, GENERAL_TIME_RANGE.max),\n onInputFocus,\n onClick,\n )}\n key=\"minutes-input\"\n data-testid=\"ds-time-input__minutes\"\n aria-label={ariaLabel || ariaLabel2 || 'Minutes Input'}\n disabled={disabled}\n // eslint-disable-next-line no-return-assign\n innerRef={(node) => (inputRefs.minutes = node)}\n onChange={handleMinutesChange}\n placeholder={placeholderFormat(PLACEHOLDER_TIME.minutes, format)}\n value={minutes}\n />\n );\n };\n\n const renderHoursInput = () => {\n if (!showHours) return null;\n const hourFormatRange = use12Hours ? HOUR_RANGE_12 : HOUR_RANGE_24;\n\n return (\n <TimeInput\n {...commonInputProps(\n (e) => onKeyDown(e, hourFormatRange.max),\n onInputFocus,\n onClick,\n )}\n key=\"hour-input\"\n data-testid=\"ds-time-input__hours\"\n aria-label={ariaLabel || ariaLabel2 || 'Hours Input'}\n disabled={disabled}\n // eslint-disable-next-line no-return-assign\n innerRef={(node) => (inputRefs.hours = node)}\n onChange={handleHoursChange}\n placeholder={placeholderFormat(\n PLACEHOLDER_TIME.hour,\n format,\n use12Hours,\n )}\n value={hours}\n />\n );\n };\n\n const renderMeridiemInput = () => {\n if (!use12Hours) return null;\n\n return (\n <TimeInput\n {...commonInputProps}\n key=\"meridiem-input\"\n data-testid=\"ds-time-input__ampm\"\n aria-label={ariaLabel || ariaLabel2 || 'Meridiem Input'}\n disabled={disabled}\n onBlur={handleMeridiemBlur}\n onKeyDown={handleMeridiemKeyDown}\n placeholder={placeholderFormat(PLACEHOLDER_TIME.meridiem, format)}\n value={meridiem}\n />\n );\n };\n\n const renderTimeInputs = () => {\n const inputs = [\n renderHoursInput(),\n renderMinutesInput(),\n renderSecondsInput(),\n ];\n /* eslint-disable indent */\n const inputsWithDividers = inputs.reduce(\n (acc, input, index) =>\n input\n ? acc.concat([\n index ? (\n <TimeDivider\n // eslint-disable-next-line react/no-array-index-key\n key={index}\n content=\":\"\n value={input.props.value}\n />\n ) : null,\n input,\n ])\n : acc,\n [],\n );\n /* eslint-enable indent */\n\n return [\n inputsWithDividers,\n React.createElement('span', { key: 'span' }), // hack for next/prev focus\n renderMeridiemInput(),\n ];\n };\n\n return (\n <InputTimesGroup onBlur={handleOnBlur} innerRef={innerRef}>\n {renderTimeInputs()}\n </InputTimesGroup>\n );\n};\n\nexport { TimeInputs };\nexport default TimeInputs;\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;ACIA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAgBA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAgBA,MAAM,YAAY;AAElB,MAAM,kBAAkB,kBAAkB,OAAO;AACjD,MAAM,YAAY,kBAAkB,SAAS,WAAW;AACxD,MAAM,UAAU,kBAAkB,
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable complexity */\n/* eslint-disable react/prop-types */\n/* eslint-disable max-lines */\n/* eslint-disable max-statements */\nimport React, { useEffect, useState } from 'react';\nimport { aggregatedClasses } from '@elliemae/ds-classnames';\nimport moment from 'moment';\nimport {\n commonInputProps,\n formatHour,\n formatMinutes,\n formatSeconds,\n formatMeridiem,\n getValidTimeNumber,\n setNativeValue,\n parseTimeNumberFromText,\n focusNextInput,\n focusPreviousInput,\n getTimeValuesFromTime,\n isArrowIncrementDecrement,\n shouldFocusNextInput,\n placeholderFormat,\n} from './utils';\nimport {\n AM,\n PM,\n ARROW_UP,\n ARROW_DOWN,\n BACKSPACE,\n ESCAPE,\n HOME,\n HOUR_RANGE_12,\n HOUR_RANGE_24,\n GENERAL_TIME_RANGE,\n END,\n PLACEHOLDER_TIME,\n SHIFT,\n} from '@elliemae/ds-shared';\n\nconst blockName = 'input-times-group';\n\nconst InputTimesGroup = aggregatedClasses('div')(blockName);\nconst TimeInput = aggregatedClasses('input')(blockName, 'input');\nconst Divider = aggregatedClasses('span')(blockName, 'divider', ({ value }) => ({\n value,\n}));\n\n// eslint-disable-next-line react/prop-types\nconst TimeDivider = ({ content = ':', value = '' }) => <Divider value={!!value}>{content}</Divider>;\n\nconst TimeInputs = ({\n time,\n format,\n use12Hours,\n step = 1,\n showHours,\n showMinutes,\n showSeconds,\n onChange,\n disabled,\n innerRef,\n clearable,\n 'arial-label': ariaLabel,\n 'aria-label': ariaLabel2,\n}) => {\n const [meridiem, setMeridiem] = useState('');\n const [hours, setHours] = useState('');\n const [minutes, setMinutes] = useState('');\n const [hasInputValue, setHasInputValue] = useState(false);\n const [seconds, setSeconds] = useState('');\n const [currentKey, setCurrentKey] = useState('');\n const [hasInputBeenTriggered, setHasInputBeenTriggered] = useState(false);\n\n const [lastTypedNumber, setLastTypedNumber] = useState(null);\n const inputRefs = {\n hours: null,\n minutes: null,\n seconds: null,\n meridiem: null,\n };\n\n useEffect(() => {\n if (time && moment(time).isValid()) {\n const timeValues = getTimeValuesFromTime(time, format, use12Hours);\n\n setMeridiem(timeValues.meridiem);\n setHours(timeValues.hours);\n setMinutes(timeValues.minutes);\n setSeconds(timeValues.seconds);\n } else {\n setMeridiem('');\n setHours('');\n setMinutes('');\n setSeconds('');\n }\n }, [time, format, use12Hours]);\n\n useEffect(() => {\n const selectedTime = time || moment();\n if (isTimeCompletelySet() && selectedTime.hours && hasInputBeenTriggered) {\n if (showHours && hours) selectedTime.hours(hours);\n if (showMinutes && minutes) selectedTime.minutes(minutes);\n if (showSeconds && seconds) selectedTime.seconds(seconds);\n if (use12Hours && meridiem) {\n const nextHours = meridiem.toLowerCase() === AM ? hours % 12 : (hours % 12) + 12;\n selectedTime.hour(nextHours);\n }\n onChange(selectedTime);\n setHasInputBeenTriggered(false);\n }\n }, [hours, minutes, seconds, meridiem]);\n\n const focusNextInputIfNeeded = (currentEl, max, number) => {\n if (\n shouldFocusNextInput(max, number, currentEl.value) &&\n !isArrowIncrementDecrement(currentKey) &&\n !hasInputValue\n ) {\n focusNextInput(currentEl);\n }\n };\n\n const getNextTimeValue = (value, incrementing = true) => {\n const parsedValue = parseTimeNumberFromText(value);\n return incrementing ? parsedValue + step : parsedValue - step;\n };\n\n const onInputFocus = (e) => {\n e.preventDefault();\n e.stopPropagation();\n e.target.select();\n };\n\n const onClick = (e) => {\n if (e.target.value) {\n setHasInputValue(true);\n }\n };\n\n // eslint-disable-next-line max-statements\n const onKeyDown = (event, max) => {\n const { target } = event;\n const { value } = target;\n setLastTypedNumber(event.key);\n switch (event.key) {\n case ARROW_UP: {\n event.preventDefault();\n setCurrentKey(event.key);\n const incrementedValue = getNextTimeValue(value);\n setNativeValue(event.target, incrementedValue);\n break;\n }\n case ARROW_DOWN: {\n event.preventDefault();\n setCurrentKey(event.key);\n const decrementedValue = getNextTimeValue(value, false);\n setNativeValue(event.target, decrementedValue);\n break;\n }\n case BACKSPACE: {\n event.preventDefault();\n if (!value) {\n focusPreviousInput(event.target);\n } else {\n setNativeValue(event.target, '');\n }\n break;\n }\n case ESCAPE: {\n event.preventDefault();\n event.target.blur();\n break;\n }\n case HOME: {\n event.preventDefault();\n setNativeValue(event.target, String(max));\n focusNextInput(event.target);\n break;\n }\n case END: {\n event.preventDefault();\n setNativeValue(event.target, '00');\n focusNextInput(event.target);\n break;\n }\n case SHIFT:\n event.preventDefault();\n setCurrentKey(event.key);\n break;\n default:\n break;\n }\n };\n\n const isTimeCompletelySet = () => {\n let neededValues = [];\n\n if (showHours) neededValues = [...neededValues, hours || null];\n if (showMinutes) neededValues = [...neededValues, minutes || null];\n if (showSeconds) neededValues = [...neededValues, seconds || null];\n if (use12Hours) neededValues = [...neededValues, meridiem || null];\n\n return !neededValues.some((value) => !value);\n };\n\n const handleSecondsChange = (e) => {\n const { value } = e.target;\n const secondsHandled = parseTimeNumberFromText(value);\n\n const nextSeconds = getValidTimeNumber(GENERAL_TIME_RANGE, secondsHandled, lastTypedNumber);\n\n setSeconds(formatSeconds(format, nextSeconds));\n setHasInputBeenTriggered(true);\n focusNextInputIfNeeded(e.target, GENERAL_TIME_RANGE.max, value);\n };\n\n const handleMinutesChange = (e) => {\n const { value } = e.target;\n const minutesHandled = parseTimeNumberFromText(value);\n const nextMinutes = getValidTimeNumber(GENERAL_TIME_RANGE, minutesHandled, lastTypedNumber);\n\n setMinutes(formatMinutes(format, nextMinutes));\n setHasInputBeenTriggered(true);\n focusNextInputIfNeeded(e.target, GENERAL_TIME_RANGE.max, value);\n };\n\n const handleHoursChange = (e) => {\n const { value } = e.target;\n const hour = parseTimeNumberFromText(value);\n const hoursRange = use12Hours ? HOUR_RANGE_12 : HOUR_RANGE_24;\n\n const nextHour = getValidTimeNumber(hoursRange, hour, lastTypedNumber);\n setHours(formatHour(format, nextHour));\n setHasInputBeenTriggered(true);\n focusNextInputIfNeeded(e.target, hoursRange.max, value);\n };\n\n const handleMeridiemKeyDown = (e) => {\n if (e.key === ARROW_UP || e.key === 'a') {\n setMeridiem(formatMeridiem(format, AM));\n } else if (e.key === ARROW_DOWN || e.key === 'p') {\n setMeridiem(formatMeridiem(format, PM));\n } else if (e.key === SHIFT) {\n setCurrentKey(e.key);\n } else if (e.key === BACKSPACE) {\n setMeridiem('');\n }\n setHasInputBeenTriggered(true);\n };\n\n const handleMeridiemBlur = (e) => {\n const { value } = e.target;\n if (value !== AM && value !== PM) {\n setMeridiem('');\n }\n };\n\n const handleOnBlur = (event) => {\n const selectedTime = moment();\n if (clearable && !event.currentTarget.contains(event.relatedTarget)) {\n if (showHours && hours) selectedTime.hours(hours);\n if (showMinutes && minutes) selectedTime.minutes(minutes);\n if (showSeconds && seconds) selectedTime.seconds(seconds);\n if (use12Hours && meridiem) {\n const nextHours = meridiem.toLowerCase() === AM ? hours % 12 : (hours % 12) + 12;\n selectedTime.hour(nextHours);\n }\n onChange(selectedTime);\n }\n };\n\n const renderSecondsInput = () => {\n if (!showSeconds) return null;\n\n return (\n <TimeInput\n {...commonInputProps((e) => onKeyDown(e, GENERAL_TIME_RANGE.max), onInputFocus, onClick)}\n key=\"seconds-input\"\n data-testid=\"ds-time-input__seconds\"\n aria-label={ariaLabel || ariaLabel2 || 'Seconds Input'}\n disabled={disabled}\n // eslint-disable-next-line no-return-assign\n innerRef={(node) => (inputRefs.seconds = node)}\n onChange={handleSecondsChange}\n placeholder={placeholderFormat(PLACEHOLDER_TIME.seconds, format)}\n value={seconds}\n />\n );\n };\n\n const renderMinutesInput = () => {\n if (!showMinutes) return null;\n\n return (\n <TimeInput\n {...commonInputProps((e) => onKeyDown(e, GENERAL_TIME_RANGE.max), onInputFocus, onClick)}\n key=\"minutes-input\"\n data-testid=\"ds-time-input__minutes\"\n aria-label={ariaLabel || ariaLabel2 || 'Minutes Input'}\n disabled={disabled}\n // eslint-disable-next-line no-return-assign\n innerRef={(node) => (inputRefs.minutes = node)}\n onChange={handleMinutesChange}\n placeholder={placeholderFormat(PLACEHOLDER_TIME.minutes, format)}\n value={minutes}\n />\n );\n };\n\n const renderHoursInput = () => {\n if (!showHours) return null;\n const hourFormatRange = use12Hours ? HOUR_RANGE_12 : HOUR_RANGE_24;\n\n return (\n <TimeInput\n {...commonInputProps((e) => onKeyDown(e, hourFormatRange.max), onInputFocus, onClick)}\n key=\"hour-input\"\n data-testid=\"ds-time-input__hours\"\n aria-label={ariaLabel || ariaLabel2 || 'Hours Input'}\n disabled={disabled}\n // eslint-disable-next-line no-return-assign\n innerRef={(node) => (inputRefs.hours = node)}\n onChange={handleHoursChange}\n placeholder={placeholderFormat(PLACEHOLDER_TIME.hour, format, use12Hours)}\n value={hours}\n />\n );\n };\n\n const renderMeridiemInput = () => {\n if (!use12Hours) return null;\n\n return (\n <TimeInput\n {...commonInputProps}\n key=\"meridiem-input\"\n data-testid=\"ds-time-input__ampm\"\n aria-label={ariaLabel || ariaLabel2 || 'Meridiem Input'}\n disabled={disabled}\n onBlur={handleMeridiemBlur}\n onKeyDown={handleMeridiemKeyDown}\n placeholder={placeholderFormat(PLACEHOLDER_TIME.meridiem, format)}\n value={meridiem}\n />\n );\n };\n\n const renderTimeInputs = () => {\n const inputs = [renderHoursInput(), renderMinutesInput(), renderSecondsInput()];\n /* eslint-disable indent */\n const inputsWithDividers = inputs.reduce(\n (acc, input, index) =>\n input\n ? acc.concat([\n index ? (\n <TimeDivider\n // eslint-disable-next-line react/no-array-index-key\n key={index}\n content=\":\"\n value={input.props.value}\n />\n ) : null,\n input,\n ])\n : acc,\n [],\n );\n /* eslint-enable indent */\n\n return [\n inputsWithDividers,\n React.createElement('span', { key: 'span' }), // hack for next/prev focus\n renderMeridiemInput(),\n ];\n };\n\n return (\n <InputTimesGroup onBlur={handleOnBlur} innerRef={innerRef}>\n {renderTimeInputs()}\n </InputTimesGroup>\n );\n};\n\nexport { TimeInputs };\nexport default TimeInputs;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;ACIA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAA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sB;AAE1D,UAAM,qBAAqB,OAAO,OAChC,CAAC,KAAK,OAAO,UACX,QACI,IAAI,OAAO;AAAA,MACT,QACE,qCAAC,aAAD;AAAA,QAEE,KAAK;AAAA,QACL,SAAQ;AAAA,QACR,OAAO,MAAM,MAAM;AAAA,WAEnB;AAAA,MACJ;AAAA,SAEF,KACN;AAIF,WAAO;AAAA,MACL;AAAA,MACA,OAAM,cAAc,QAAQ,EAAE,KAAK;AAAA,MACnC;AAAA;AAAA;AAIJ,SACE,qCAAC,iBAAD;AAAA,IAAiB,QAAQ;AAAA,IAAc;AAAA,KACpC;AAAA;AAMP,IAAO,qBAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,14 +1,7 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { addLeadingZeros } from "@elliemae/ds-utilities";
|
|
3
3
|
import { parseInt, isNaN } from "@elliemae/ds-utilities";
|
|
4
|
-
import {
|
|
5
|
-
AM,
|
|
6
|
-
PM,
|
|
7
|
-
ARROW_UP,
|
|
8
|
-
ARROW_DOWN,
|
|
9
|
-
SHIFT,
|
|
10
|
-
PLACEHOLDER_TIME
|
|
11
|
-
} from "@elliemae/ds-shared/constants";
|
|
4
|
+
import { AM, PM, ARROW_UP, ARROW_DOWN, SHIFT, PLACEHOLDER_TIME } from "@elliemae/ds-shared";
|
|
12
5
|
const isAM = (time) => time && time.hour() < 12;
|
|
13
6
|
const isArrowIncrementDecrement = (key) => key === ARROW_DOWN || key === ARROW_UP || key === SHIFT;
|
|
14
7
|
const setNativeValue = (element, value) => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/TimeInput/utils.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { addLeadingZeros } from '@elliemae/ds-utilities';\nimport { parseInt, isNaN } from '@elliemae/ds-utilities';\nimport {
|
|
5
|
-
"mappings": "AAAA;ACAA;AACA;AACA;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { addLeadingZeros } from '@elliemae/ds-utilities';\nimport { parseInt, isNaN } from '@elliemae/ds-utilities';\nimport { AM, PM, ARROW_UP, ARROW_DOWN, SHIFT, PLACEHOLDER_TIME } from '@elliemae/ds-shared';\n\nconst isAM = (time) => time && time.hour() < 12;\n\nexport const isArrowIncrementDecrement = (key) => key === ARROW_DOWN || key === ARROW_UP || key === SHIFT;\n\nexport const setNativeValue = (element, value) => {\n if (!Object.getOwnPropertyDescriptor(element, 'value')) return;\n const valueSetter = Object.getOwnPropertyDescriptor(element, 'value').set;\n const prototype = Object.getPrototypeOf(element);\n const prototypeValueSetter = Object.getOwnPropertyDescriptor(prototype, 'value').set;\n\n if (valueSetter && valueSetter !== prototypeValueSetter) {\n prototypeValueSetter.call(element, value);\n } else {\n valueSetter.call(element, value);\n }\n element.dispatchEvent(new Event('input', { bubbles: true }));\n};\n\nexport const placeholderFormat = (position, format, use12Hours) => {\n if (position === PLACEHOLDER_TIME.hour) {\n return _placeholderHour(format, use12Hours);\n }\n if (position === PLACEHOLDER_TIME.minutes) {\n return format.indexOf('mm') > -1 ? 'mm' : 'm';\n }\n if (position === PLACEHOLDER_TIME.seconds) {\n return format.indexOf('ss') > -1 ? 'ss' : 's';\n }\n if (position === PLACEHOLDER_TIME.meridiem) {\n return format.indexOf('A') > -1 ? 'A' : 'a';\n }\n};\n\nconst _placeholderHour = (format, use12Hours) => {\n if (use12Hours) {\n return format.indexOf('hh') > -1 ? 'hh' : 'h';\n }\n return format.indexOf('HH') > -1 ? 'HH' : 'H';\n};\n\nconst formatTimeNumber = (value, shouldAddLeadingZeros) => {\n if (value === null || value === undefined) return '';\n return shouldAddLeadingZeros ? addLeadingZeros(2)(value) : String(value);\n};\n\nexport const formatMinutes = (format, value) => {\n const shouldAddLeadingZeros = format.indexOf('mm') > -1;\n return formatTimeNumber(value, shouldAddLeadingZeros);\n};\nexport const formatSeconds = (format, value) => {\n const shouldAddLeadingZeros = format.indexOf('ss') > -1;\n return formatTimeNumber(value, shouldAddLeadingZeros);\n};\nexport const formatHour = (format, value) => {\n const shouldAddLeadingZeros = format.indexOf('HH') > -1 || format.indexOf('hh') > -1;\n return formatTimeNumber(value, shouldAddLeadingZeros);\n};\n\nexport const formatMeridiem = (format, value) => (format.indexOf('A') > -1 ? value.toUpperCase() : value.toLowerCase());\n\nexport const parseTimeNumberFromText = (stringValue) => {\n const parsedInt = parseInt(stringValue);\n if (isNaN(parsedInt)) return null;\n\n return parsedInt;\n};\n\nexport const focusNextInput = (currentEl) => {\n const nextElement = currentEl.nextElementSibling;\n if (nextElement && nextElement.nextElementSibling) {\n nextElement.nextElementSibling.focus();\n }\n};\n\nexport const focusPreviousInput = (currentEl) => {\n const previousElement = currentEl.previousElementSibling;\n if (previousElement && previousElement.previousElementSibling) {\n previousElement.previousElementSibling.focus();\n }\n};\n\nexport const getValidTimeNumber = ({ min, max }, number, typed) => {\n if (number === undefined || number === null) return null;\n if (number > max) {\n if (isNaN(typed)) return parseInt(typed);\n return max;\n }\n if (number < min) return min;\n return number;\n};\n\nexport const shouldFocusNextInput = (max, number = 0, stringValue) => {\n const safeString = String(stringValue);\n const cleanString = safeString.startsWith('00') ? safeString.slice(1) : safeString;\n return number * 10 > max || String(max).length === cleanString.length;\n};\n\nexport const getTimeValuesFromTime = (time, format, use12Hours) => {\n if (!time || !time.hour) return {};\n const hours = use12Hours ? time.hour() % 12 || 12 : time.hour();\n const minutes = time.minutes();\n const seconds = time.seconds();\n const meridiem = !isAM(time) ? PM : AM;\n\n return {\n hours: formatHour(format, hours),\n minutes: formatMinutes(format, minutes),\n seconds: formatSeconds(format, seconds),\n meridiem,\n };\n};\n\nexport const resetTimeValues = () => ({\n hours: '',\n minutes: '',\n seconds: '',\n meridiem: AM,\n});\n\nexport const commonInputProps = (onKeyDown, onInputFocus, onClick) => ({\n pattern: '[0-9]*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OAAO,OAAO,KAAK,WAAW,YAAY;AAAA;AAG1D,MAAM,wBAAwB,CAAC,MAAM,QAAQ,eAAe;AACjE,MAAI,CAAC,QAAQ,CAAC,KAAK;AAAM,WAAO;AAChC,QAAM,QAAQ,aAAa,KAAK,SAAS,MAAM,KAAK,KAAK;AACzD,QAAM,UAAU,KAAK;AACrB,QAAM,UAAU,KAAK;AACrB,QAAM,WAAW,CAAC,KAAK,QAAQ,KAAK;AAEpC,SAAO;AAAA,IACL,OAAO,WAAW,QAAQ;AAAA,IAC1B,SAAS,cAAc,QAAQ;AAAA,IAC/B,SAAS,cAAc,QAAQ;AAAA,IAC/B;AAAA;AAAA;AAIG,MAAM,kBAAkB,MAAO;AAAA,EACpC,OAAO;AAAA,EACP,SAAS;AAAA,EACT,SAAS;AAAA,EACT,UAAU;AAAA;AAGL,MAAM,mBAAmB,CAAC,WAAW,cAAc,YAAa;AAAA,EACrE,SAAS;AAAA,EACT,MAAM;AAAA,EACN;AAAA,EACA;AAAA,EACA,SAAS;AAAA;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -33,7 +33,7 @@ import * as React from "react";
|
|
|
33
33
|
import React2 from "react";
|
|
34
34
|
import { PropTypes, describe } from "react-desc";
|
|
35
35
|
import { DSToggleImpl } from "./DSToggleImpl";
|
|
36
|
-
import { dsBasicSizes } from "@elliemae/ds-shared
|
|
36
|
+
import { dsBasicSizes } from "@elliemae/ds-shared";
|
|
37
37
|
const DSToggle = (_a) => {
|
|
38
38
|
var _b = _a, {
|
|
39
39
|
containerProps,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/Toggle/DSToggle.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React from 'react';\nimport { PropTypes, describe } from 'react-desc';\nimport { DSToggleImpl } from './DSToggleImpl';\nimport { dsBasicSizes } from '@elliemae/ds-shared
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;ACAA;AACA;AACA;AACA;AAEA,MAAM,WAAW,CAAC,OAYf;AAZe,eAChB;AAAA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,MAVgB,IAWb,uBAXa,IAWb;AAAA,IAVH;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA;AAGA,8CAAC,cAAD,iCACM,aADN;AAAA,IAEE;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA;AAAA;AAIJ,SAAS,eAAe;AAAA,EACtB,SAAS;AAAA,EACT,UAAU;AAAA,EACV,MAAM;AAAA,EACN,UAAU;AAAA,EACV,UAAU;AAAA,EACV,UAAU;AAAA,EACV,SAAS;AAAA;AAGX,MAAM,QAAQ;AAAA,EAIZ,gBAAgB,UAAU,MAAM,IAAI,
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React from 'react';\nimport { PropTypes, describe } from 'react-desc';\nimport { DSToggleImpl } from './DSToggleImpl';\nimport { dsBasicSizes } from '@elliemae/ds-shared';\n\nconst DSToggle = ({\n containerProps,\n hasError,\n readOnly,\n disabled,\n checked,\n labelOn,\n labelOff,\n name,\n value,\n size,\n ...otherProps\n}) => (\n <DSToggleImpl\n {...otherProps}\n checked={checked}\n containerProps={containerProps}\n disabled={disabled}\n hasError={hasError}\n labelOff={labelOff}\n labelOn={labelOn}\n name={name}\n readOnly={readOnly}\n size={size}\n value={value}\n />\n);\n\nDSToggle.defaultProps = {\n labelOn: 'ON',\n labelOff: 'OFF',\n size: 's',\n hasError: false,\n readOnly: false,\n disabled: false,\n checked: undefined,\n};\n\nconst props = {\n /**\n * Set of Properties attached to the main container\n */\n containerProps: PropTypes.shape({}).description('Set of Properties attached to the main container'),\n /**\n * Whether the toggle has error or not\n */\n hasError: PropTypes.bool.description('Whether the toggle has error or not'),\n /**\n * Whether the toggle is read only or not\n */\n readOnly: PropTypes.bool.description('Whether the toggle is read only or not'),\n /**\n * Whether the toggle is disabled or not\n */\n disabled: PropTypes.bool.description('Whether the toggle is disabled or not'),\n /**\n * Whether the toggle is checked or not\n */\n checked: PropTypes.bool.description('Whether the toggle is checked or not'),\n /**\n * Allows a function that is triggered once the toggle changes\n */\n onChange: PropTypes.func.description('Allows a function that is triggered once the toggle changes'),\n /**\n * Label to show when the toggle is ON\n */\n labelOn: PropTypes.string.description('Label to show when the toggle is ON'),\n /**\n * Label to show when the toggle is OFF\n */\n labelOff: PropTypes.string.description('Label to show when the toggle is OFF'),\n /**\n * Default value once the component is initialized\n */\n value: PropTypes.string.description('Default value once the component is initialized'),\n /**\n * ['s', 'm', 'l']\n */\n size: PropTypes.oneOf(dsBasicSizes).description(\"['s', 'm', 'l']\"),\n /**\n * Input name\n */\n name: PropTypes.string.description('Input name'),\n};\n\nDSToggle.propTypes = props;\n\nconst DSToggleWithSchema = describe(DSToggle);\n\nDSToggleWithSchema.propTypes = props;\n\nexport default DSToggle;\n\nexport { DSToggleWithSchema, DSToggle };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;ACAA;AACA;AACA;AACA;AAEA,MAAM,WAAW,CAAC,OAYf;AAZe,eAChB;AAAA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,MAVgB,IAWb,uBAXa,IAWb;AAAA,IAVH;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA;AAGA,8CAAC,cAAD,iCACM,aADN;AAAA,IAEE;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA;AAAA;AAIJ,SAAS,eAAe;AAAA,EACtB,SAAS;AAAA,EACT,UAAU;AAAA,EACV,MAAM;AAAA,EACN,UAAU;AAAA,EACV,UAAU;AAAA,EACV,UAAU;AAAA,EACV,SAAS;AAAA;AAGX,MAAM,QAAQ;AAAA,EAIZ,gBAAgB,UAAU,MAAM,IAAI,YAAY;AAAA,EAIhD,UAAU,UAAU,KAAK,YAAY;AAAA,EAIrC,UAAU,UAAU,KAAK,YAAY;AAAA,EAIrC,UAAU,UAAU,KAAK,YAAY;AAAA,EAIrC,SAAS,UAAU,KAAK,YAAY;AAAA,EAIpC,UAAU,UAAU,KAAK,YAAY;AAAA,EAIrC,SAAS,UAAU,OAAO,YAAY;AAAA,EAItC,UAAU,UAAU,OAAO,YAAY;AAAA,EAIvC,OAAO,UAAU,OAAO,YAAY;AAAA,EAIpC,MAAM,UAAU,MAAM,cAAc,YAAY;AAAA,EAIhD,MAAM,UAAU,OAAO,YAAY;AAAA;AAGrC,SAAS,YAAY;AAErB,MAAM,qBAAqB,SAAS;AAEpC,mBAAmB,YAAY;AAE/B,IAAO,mBAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/esm/Toggle/props.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import PropTypes from "prop-types";
|
|
3
|
-
import { dsBasicSizes } from "@elliemae/ds-shared
|
|
3
|
+
import { dsBasicSizes } from "@elliemae/ds-shared";
|
|
4
4
|
const togglePropTypes = {
|
|
5
5
|
containerProps: PropTypes.shape({}),
|
|
6
6
|
hasError: PropTypes.bool,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/Toggle/props.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import PropTypes from 'prop-types';\nimport { dsBasicSizes } from '@elliemae/ds-shared
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import PropTypes from 'prop-types';\nimport { dsBasicSizes } from '@elliemae/ds-shared';\n\nexport const togglePropTypes = {\n /**\n * Set of Properties attached to the main container\n */\n containerProps: PropTypes.shape({}),\n /**\n * Whether the toggle has error or not\n */\n hasError: PropTypes.bool,\n /**\n * Whether the toggle is read only or not\n */\n readOnly: PropTypes.bool,\n /**\n * Whether the toggle is disabled or not\n */\n disabled: PropTypes.bool,\n /**\n * Whether the toggle is checked or not\n */\n checked: PropTypes.bool,\n /**\n * Allows a function that is triggered once the toggle changes\n */\n onChange: PropTypes.func,\n /**\n * Label to show when the toggle is ON\n */\n labelOn: PropTypes.string,\n /**\n * Label to show when the toggle is OFF\n */\n labelOff: PropTypes.string,\n /**\n * Default value once the component is initialized\n */\n value: PropTypes.string,\n /**\n * ['s', 'm', 'l']\n */\n size: PropTypes.oneOf(dsBasicSizes),\n /**\n * Input name\n */\n name: PropTypes.string,\n};\n"],
|
|
5
5
|
"mappings": "AAAA;ACAA;AACA;AAEO,MAAM,kBAAkB;AAAA,EAI7B,gBAAgB,UAAU,MAAM;AAAA,EAIhC,UAAU,UAAU;AAAA,EAIpB,UAAU,UAAU;AAAA,EAIpB,UAAU,UAAU;AAAA,EAIpB,SAAS,UAAU;AAAA,EAInB,UAAU,UAAU;AAAA,EAIpB,SAAS,UAAU;AAAA,EAInB,UAAU,UAAU;AAAA,EAIpB,OAAO,UAAU;AAAA,EAIjB,MAAM,UAAU,MAAM;AAAA,EAItB,MAAM,UAAU;AAAA;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|