Software: Apache/2.4.41 (Ubuntu). PHP/8.0.30 uname -a: Linux apirnd 5.4.0-204-generic #224-Ubuntu SMP Thu Dec 5 13:38:28 UTC 2024 x86_64 uid=33(www-data) gid=33(www-data) groups=33(www-data) Safe-mode: OFF (not secure) /var/www/html/wincloud_gateway/node_modules/react-dates/esm/components/ drwxr-xr-x | |
| Viewing file: Select action/file-type: import _extends from "@babel/runtime/helpers/esm/extends";
import _assertThisInitialized from "@babel/runtime/helpers/esm/assertThisInitialized";
import _inheritsLoose from "@babel/runtime/helpers/esm/inheritsLoose";
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
import shallowEqual from "enzyme-shallow-equal";
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
import React from 'react';
import PropTypes from 'prop-types';
import { forbidExtraProps, nonNegativeInteger } from 'airbnb-prop-types';
import { css, withStyles, withStylesPropTypes } from 'react-with-styles';
import throttle from 'lodash/throttle';
import isTouchDevice from 'is-touch-device';
import noflip from '../utils/noflip';
import getInputHeight from '../utils/getInputHeight';
import openDirectionShape from '../shapes/OpenDirectionShape';
import { OPEN_DOWN, OPEN_UP, FANG_HEIGHT_PX, FANG_WIDTH_PX, DEFAULT_VERTICAL_SPACING, MODIFIER_KEY_NAMES } from '../constants';
var FANG_PATH_TOP = "M0,".concat(FANG_HEIGHT_PX, " ").concat(FANG_WIDTH_PX, ",").concat(FANG_HEIGHT_PX, " ").concat(FANG_WIDTH_PX / 2, ",0z");
var FANG_STROKE_TOP = "M0,".concat(FANG_HEIGHT_PX, " ").concat(FANG_WIDTH_PX / 2, ",0 ").concat(FANG_WIDTH_PX, ",").concat(FANG_HEIGHT_PX);
var FANG_PATH_BOTTOM = "M0,0 ".concat(FANG_WIDTH_PX, ",0 ").concat(FANG_WIDTH_PX / 2, ",").concat(FANG_HEIGHT_PX, "z");
var FANG_STROKE_BOTTOM = "M0,0 ".concat(FANG_WIDTH_PX / 2, ",").concat(FANG_HEIGHT_PX, " ").concat(FANG_WIDTH_PX, ",0");
var propTypes = process.env.NODE_ENV !== "production" ? forbidExtraProps(_objectSpread({}, withStylesPropTypes, {
id: PropTypes.string.isRequired,
placeholder: PropTypes.string,
displayValue: PropTypes.string,
ariaLabel: PropTypes.string,
screenReaderMessage: PropTypes.string,
focused: PropTypes.bool,
disabled: PropTypes.bool,
required: PropTypes.bool,
readOnly: PropTypes.bool,
openDirection: openDirectionShape,
showCaret: PropTypes.bool,
verticalSpacing: nonNegativeInteger,
small: PropTypes.bool,
block: PropTypes.bool,
regular: PropTypes.bool,
onChange: PropTypes.func,
onFocus: PropTypes.func,
onKeyDownShiftTab: PropTypes.func,
onKeyDownTab: PropTypes.func,
onKeyDownArrowDown: PropTypes.func,
onKeyDownQuestionMark: PropTypes.func,
// accessibility
isFocused: PropTypes.bool // describes actual DOM focus
})) : {};
var defaultProps = {
placeholder: 'Select Date',
displayValue: '',
ariaLabel: undefined,
screenReaderMessage: '',
focused: false,
disabled: false,
required: false,
readOnly: null,
openDirection: OPEN_DOWN,
showCaret: false,
verticalSpacing: DEFAULT_VERTICAL_SPACING,
small: false,
block: false,
regular: false,
onChange: function onChange() {},
onFocus: function onFocus() {},
onKeyDownShiftTab: function onKeyDownShiftTab() {},
onKeyDownTab: function onKeyDownTab() {},
onKeyDownArrowDown: function onKeyDownArrowDown() {},
onKeyDownQuestionMark: function onKeyDownQuestionMark() {},
// accessibility
isFocused: false
};
var DateInput =
/*#__PURE__*/
function (_ref) {
_inheritsLoose(DateInput, _ref);
var _proto = DateInput.prototype;
_proto[!React.PureComponent && "shouldComponentUpdate"] = function (nextProps, nextState) {
return !shallowEqual(this.props, nextProps) || !shallowEqual(this.state, nextState);
};
function DateInput(props) {
var _this;
_this = _ref.call(this, props) || this;
_this.state = {
dateString: '',
isTouchDevice: false
};
_this.onChange = _this.onChange.bind(_assertThisInitialized(_this));
_this.onKeyDown = _this.onKeyDown.bind(_assertThisInitialized(_this));
_this.setInputRef = _this.setInputRef.bind(_assertThisInitialized(_this));
_this.throttledKeyDown = throttle(_this.onFinalKeyDown, 300, {
trailing: false
});
return _this;
}
_proto.componentDidMount = function componentDidMount() {
this.setState({
isTouchDevice: isTouchDevice()
});
};
_proto.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
var dateString = this.state.dateString;
if (dateString && nextProps.displayValue) {
this.setState({
dateString: ''
});
}
};
_proto.componentDidUpdate = function componentDidUpdate(prevProps) {
var _this$props = this.props,
focused = _this$props.focused,
isFocused = _this$props.isFocused;
if (prevProps.focused === focused && prevProps.isFocused === isFocused) return;
if (focused && isFocused) {
this.inputRef.focus();
}
};
_proto.onChange = function onChange(e) {
var _this$props2 = this.props,
onChange = _this$props2.onChange,
onKeyDownQuestionMark = _this$props2.onKeyDownQuestionMark;
var dateString = e.target.value; // In Safari, onKeyDown does not consistently fire ahead of onChange. As a result, we need to
// special case the `?` key so that it always triggers the appropriate callback, instead of
// modifying the input value
if (dateString[dateString.length - 1] === '?') {
onKeyDownQuestionMark(e);
} else {
this.setState({
dateString: dateString
}, function () {
return onChange(dateString);
});
}
};
_proto.onKeyDown = function onKeyDown(e) {
e.stopPropagation();
if (!MODIFIER_KEY_NAMES.has(e.key)) {
this.throttledKeyDown(e);
}
};
_proto.onFinalKeyDown = function onFinalKeyDown(e) {
var _this$props3 = this.props,
onKeyDownShiftTab = _this$props3.onKeyDownShiftTab,
onKeyDownTab = _this$props3.onKeyDownTab,
onKeyDownArrowDown = _this$props3.onKeyDownArrowDown,
onKeyDownQuestionMark = _this$props3.onKeyDownQuestionMark;
var key = e.key;
if (key === 'Tab') {
if (e.shiftKey) {
onKeyDownShiftTab(e);
} else {
onKeyDownTab(e);
}
} else if (key === 'ArrowDown') {
onKeyDownArrowDown(e);
} else if (key === '?') {
e.preventDefault();
onKeyDownQuestionMark(e);
}
};
_proto.setInputRef = function setInputRef(ref) {
this.inputRef = ref;
};
_proto.render = function render() {
var _this$state = this.state,
dateString = _this$state.dateString,
isTouch = _this$state.isTouchDevice;
var _this$props4 = this.props,
id = _this$props4.id,
placeholder = _this$props4.placeholder,
ariaLabel = _this$props4.ariaLabel,
displayValue = _this$props4.displayValue,
screenReaderMessage = _this$props4.screenReaderMessage,
focused = _this$props4.focused,
showCaret = _this$props4.showCaret,
onFocus = _this$props4.onFocus,
disabled = _this$props4.disabled,
required = _this$props4.required,
readOnly = _this$props4.readOnly,
openDirection = _this$props4.openDirection,
verticalSpacing = _this$props4.verticalSpacing,
small = _this$props4.small,
regular = _this$props4.regular,
block = _this$props4.block,
styles = _this$props4.styles,
reactDates = _this$props4.theme.reactDates;
var value = dateString || displayValue || '';
var screenReaderMessageId = "DateInput__screen-reader-message-".concat(id);
var withFang = showCaret && focused;
var inputHeight = getInputHeight(reactDates, small);
return React.createElement("div", css(styles.DateInput, small && styles.DateInput__small, block && styles.DateInput__block, withFang && styles.DateInput__withFang, disabled && styles.DateInput__disabled, withFang && openDirection === OPEN_DOWN && styles.DateInput__openDown, withFang && openDirection === OPEN_UP && styles.DateInput__openUp), React.createElement("input", _extends({}, css(styles.DateInput_input, small && styles.DateInput_input__small, regular && styles.DateInput_input__regular, readOnly && styles.DateInput_input__readOnly, focused && styles.DateInput_input__focused, disabled && styles.DateInput_input__disabled), {
"aria-label": ariaLabel === undefined ? placeholder : ariaLabel,
type: "text",
id: id,
name: id,
ref: this.setInputRef,
value: value,
onChange: this.onChange,
onKeyDown: this.onKeyDown,
onFocus: onFocus,
placeholder: placeholder,
autoComplete: "off",
disabled: disabled,
readOnly: typeof readOnly === 'boolean' ? readOnly : isTouch,
required: required,
"aria-describedby": screenReaderMessage && screenReaderMessageId
})), withFang && React.createElement("svg", _extends({
role: "presentation",
focusable: "false"
}, css(styles.DateInput_fang, openDirection === OPEN_DOWN && {
top: inputHeight + verticalSpacing - FANG_HEIGHT_PX - 1
}, openDirection === OPEN_UP && {
bottom: inputHeight + verticalSpacing - FANG_HEIGHT_PX - 1
})), React.createElement("path", _extends({}, css(styles.DateInput_fangShape), {
d: openDirection === OPEN_DOWN ? FANG_PATH_TOP : FANG_PATH_BOTTOM
})), React.createElement("path", _extends({}, css(styles.DateInput_fangStroke), {
d: openDirection === OPEN_DOWN ? FANG_STROKE_TOP : FANG_STROKE_BOTTOM
}))), screenReaderMessage && React.createElement("p", _extends({}, css(styles.DateInput_screenReaderMessage), {
id: screenReaderMessageId
}), screenReaderMessage));
};
return DateInput;
}(React.PureComponent || React.Component);
DateInput.propTypes = process.env.NODE_ENV !== "production" ? propTypes : {};
DateInput.defaultProps = defaultProps;
export default withStyles(function (_ref2) {
var _ref2$reactDates = _ref2.reactDates,
border = _ref2$reactDates.border,
color = _ref2$reactDates.color,
sizing = _ref2$reactDates.sizing,
spacing = _ref2$reactDates.spacing,
font = _ref2$reactDates.font,
zIndex = _ref2$reactDates.zIndex;
return {
DateInput: {
margin: 0,
padding: spacing.inputPadding,
background: color.background,
position: 'relative',
display: 'inline-block',
width: sizing.inputWidth,
verticalAlign: 'middle'
},
DateInput__small: {
width: sizing.inputWidth_small
},
DateInput__block: {
width: '100%'
},
DateInput__disabled: {
background: color.disabled,
color: color.textDisabled
},
DateInput_input: {
fontWeight: font.input.weight,
fontSize: font.input.size,
lineHeight: font.input.lineHeight,
color: color.text,
backgroundColor: color.background,
width: '100%',
padding: "".concat(spacing.displayTextPaddingVertical, "px ").concat(spacing.displayTextPaddingHorizontal, "px"),
paddingTop: spacing.displayTextPaddingTop,
paddingBottom: spacing.displayTextPaddingBottom,
paddingLeft: noflip(spacing.displayTextPaddingLeft),
paddingRight: noflip(spacing.displayTextPaddingRight),
border: border.input.border,
borderTop: border.input.borderTop,
borderRight: noflip(border.input.borderRight),
borderBottom: border.input.borderBottom,
borderLeft: noflip(border.input.borderLeft),
borderRadius: border.input.borderRadius
},
DateInput_input__small: {
fontSize: font.input.size_small,
lineHeight: font.input.lineHeight_small,
letterSpacing: font.input.letterSpacing_small,
padding: "".concat(spacing.displayTextPaddingVertical_small, "px ").concat(spacing.displayTextPaddingHorizontal_small, "px"),
paddingTop: spacing.displayTextPaddingTop_small,
paddingBottom: spacing.displayTextPaddingBottom_small,
paddingLeft: noflip(spacing.displayTextPaddingLeft_small),
paddingRight: noflip(spacing.displayTextPaddingRight_small)
},
DateInput_input__regular: {
fontWeight: 'auto'
},
DateInput_input__readOnly: {
userSelect: 'none'
},
DateInput_input__focused: {
outline: border.input.outlineFocused,
background: color.backgroundFocused,
border: border.input.borderFocused,
borderTop: border.input.borderTopFocused,
borderRight: noflip(border.input.borderRightFocused),
borderBottom: border.input.borderBottomFocused,
borderLeft: noflip(border.input.borderLeftFocused)
},
DateInput_input__disabled: {
background: color.disabled,
fontStyle: font.input.styleDisabled
},
DateInput_screenReaderMessage: {
border: 0,
clip: 'rect(0, 0, 0, 0)',
height: 1,
margin: -1,
overflow: 'hidden',
padding: 0,
position: 'absolute',
width: 1
},
DateInput_fang: {
position: 'absolute',
width: FANG_WIDTH_PX,
height: FANG_HEIGHT_PX,
left: 22,
// TODO: should be noflip wrapped and handled by an isRTL prop
zIndex: zIndex + 2
},
DateInput_fangShape: {
fill: color.background
},
DateInput_fangStroke: {
stroke: color.core.border,
fill: 'transparent'
}
};
}, {
pureComponent: typeof React.PureComponent !== 'undefined'
})(DateInput); |
:: Command execute :: | |
--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0231 ]-- |