@unicef/material-ui 0.12.0 → 0.12.2

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/lib/dev.js CHANGED
@@ -35424,7 +35424,12 @@ function InputComponent(_ref) {
35424
35424
  var inputRef = _ref.inputRef,
35425
35425
  props = objectWithoutProperties(_ref, ['inputRef']);
35426
35426
 
35427
- return React__default.createElement('div', _extends$1({ ref: inputRef }, props));
35427
+ return React__default.createElement('div', _extends$1({
35428
+ ref: inputRef
35429
+ }, props, {
35430
+ required: undefined // Remove required from div element
35431
+ , 'aria-invalid': undefined // Remove aria-invalid from div element
35432
+ }));
35428
35433
  }
35429
35434
 
35430
35435
  InputComponent.propTypes = {
@@ -37249,7 +37254,10 @@ function Input$3(props) {
37249
37254
  describedBy = describedBy || customDescribedBy ? '' + (describedBy ? describedBy : '') + (customDescribedBy ? ' ' + customDescribedBy : '') : undefined;
37250
37255
  }
37251
37256
 
37252
- return React__default.createElement(components.Input, _extends$1({}, props, { 'aria-describedby': describedBy }));
37257
+ return React__default.createElement(components.Input, _extends$1({}, props, {
37258
+ 'aria-describedby': describedBy,
37259
+ required: props && props.selectProps && props.selectProps.required || undefined
37260
+ }));
37253
37261
  }
37254
37262
 
37255
37263
  Input$3.propTypes = {
@@ -53258,7 +53266,8 @@ function ActiveKeyboardDatePicker(props) {
53258
53266
  showLabelHelp = props.showLabelHelp,
53259
53267
  InputLabelHelpProps = props.InputLabelHelpProps,
53260
53268
  label = props.label,
53261
- others = objectWithoutProperties(props, ['autoOk', 'variant', 'inputVariant', 'readOnly', 'interactiveMode', 'InputLabelProps', 'className', 'inputProps', 'InputProps', 'placeholder', 'showLabelHelp', 'InputLabelHelpProps', 'label']);
53269
+ KeyboardButtonProps = props.KeyboardButtonProps,
53270
+ others = objectWithoutProperties(props, ['autoOk', 'variant', 'inputVariant', 'readOnly', 'interactiveMode', 'InputLabelProps', 'className', 'inputProps', 'InputProps', 'placeholder', 'showLabelHelp', 'InputLabelHelpProps', 'label', 'KeyboardButtonProps']);
53262
53271
 
53263
53272
  var _React$useState = React__default.useState(classes.icon),
53264
53273
  _React$useState2 = slicedToArray(_React$useState, 2),
@@ -53299,11 +53308,11 @@ function ActiveKeyboardDatePicker(props) {
53299
53308
  disabled: Boolean(readOnly)
53300
53309
  }, inputProps),
53301
53310
  readOnly: readOnly,
53302
- KeyboardButtonProps: {
53311
+ KeyboardButtonProps: _extends$1({}, KeyboardButtonProps, {
53303
53312
  classes: {
53304
53313
  root: '' + (!interactiveMode && !readOnly ? '' : hideIcon)
53305
53314
  }
53306
- },
53315
+ }),
53307
53316
  InputProps: _extends$1({
53308
53317
  classes: {
53309
53318
  root: classes.input + ' ' + (readOnly && classes.inputHover),
@@ -53345,14 +53354,17 @@ ActiveKeyboardDatePicker.propTypes = {
53345
53354
  /** Show label help */
53346
53355
  showLabelHelp: PropTypes__default.bool,
53347
53356
  /** Props applied to the input label help element. E.g InputLabelHelpProps={{type:'link', label:'Help', link:'unicef.github.io', icon, tooltipTitle: 'Tooltip title', tooltipPlacement: 'bottom}} */
53348
- InputLabelHelpProps: PropTypes__default.object
53357
+ InputLabelHelpProps: PropTypes__default.object,
53358
+ /** Keyboard button props */
53359
+ KeyboardButtonProps: PropTypes__default.object
53349
53360
  };
53350
53361
 
53351
53362
  ActiveKeyboardDatePicker.defaultProps = {
53352
53363
  inputVariant: 'outlined',
53353
53364
  autoOk: true,
53354
53365
  variant: 'inline',
53355
- format: 'dd/MM/yyyy'
53366
+ format: 'dd/MM/yyyy',
53367
+ KeyboardButtonProps: {}
53356
53368
  };
53357
53369
 
53358
53370
  var styles$17 = {
@@ -53675,7 +53687,8 @@ function ActiveKeyboardTimePicker(props) {
53675
53687
  showLabelHelp = props.showLabelHelp,
53676
53688
  InputLabelHelpProps = props.InputLabelHelpProps,
53677
53689
  label = props.label,
53678
- others = objectWithoutProperties(props, ['inputVariant', 'readOnly', 'interactiveMode', 'InputLabelProps', 'className', 'inputProps', 'InputProps', 'placeholder', 'showLabelHelp', 'InputLabelHelpProps', 'label']);
53690
+ KeyboardButtonProps = props.KeyboardButtonProps,
53691
+ others = objectWithoutProperties(props, ['inputVariant', 'readOnly', 'interactiveMode', 'InputLabelProps', 'className', 'inputProps', 'InputProps', 'placeholder', 'showLabelHelp', 'InputLabelHelpProps', 'label', 'KeyboardButtonProps']);
53679
53692
 
53680
53693
  var _React$useState = React__default.useState(classes.icon),
53681
53694
  _React$useState2 = slicedToArray(_React$useState, 2),
@@ -53714,11 +53727,11 @@ function ActiveKeyboardTimePicker(props) {
53714
53727
  disabled: Boolean(readOnly)
53715
53728
  }, inputProps),
53716
53729
  readOnly: readOnly,
53717
- KeyboardButtonProps: {
53730
+ KeyboardButtonProps: _extends$1({}, KeyboardButtonProps, {
53718
53731
  classes: {
53719
53732
  root: '' + (!interactiveMode && !readOnly ? '' : hideIcon)
53720
53733
  }
53721
- },
53734
+ }),
53722
53735
  InputProps: _extends$1({
53723
53736
  classes: {
53724
53737
  root: classes.input + ' ' + (readOnly && classes.inputHover),
@@ -53756,13 +53769,16 @@ ActiveKeyboardTimePicker.propTypes = {
53756
53769
  /** Show label help */
53757
53770
  showLabelHelp: PropTypes__default.bool,
53758
53771
  /** Props applied to the input label help element. E.g InputLabelHelpProps={{type:'link', label:'Help', link:'unicef.github.io', icon, tooltipTitle: 'Tooltip title', tooltipPlacement: 'bottom}} */
53759
- InputLabelHelpProps: PropTypes__default.object
53772
+ InputLabelHelpProps: PropTypes__default.object,
53773
+ /** Keyboard button props */
53774
+ KeyboardButtonProps: PropTypes__default.object
53760
53775
  };
53761
53776
 
53762
53777
  ActiveKeyboardTimePicker.defaultProps = {
53763
53778
  inputVariant: 'outlined',
53764
53779
  autoOk: true,
53765
- variant: 'inline'
53780
+ variant: 'inline',
53781
+ KeyboardButtonProps: {}
53766
53782
  };
53767
53783
 
53768
53784
  var filter$1 = createFilterOptions();
@@ -53983,6 +53999,172 @@ ActiveAutoComplete.defaultProps = {
53983
53999
  usedItemIds: []
53984
54000
  };
53985
54001
 
54002
+ var styles$1a = {
54003
+ labelRoot: {
54004
+ pointerEvents: 'auto',
54005
+ display: 'flex',
54006
+ alignItems: 'center'
54007
+ }
54008
+ };
54009
+
54010
+ var useStyles$A = makeStyles$1(function (theme) {
54011
+ return {
54012
+ textField: {
54013
+ marginTop: theme.spacing(0.25),
54014
+ marginBottom: theme.spacing(0.25)
54015
+ },
54016
+ notchedOutline: {
54017
+ borderRadius: 2,
54018
+ borderColor: 'transparent'
54019
+ },
54020
+ inputPaddingWithoutLabel: function inputPaddingWithoutLabel(props) {
54021
+ return {
54022
+ padding: props.inputPadding ? props.inputPadding : '2px 2px 2px 2px',
54023
+ height: 'auto'
54024
+ };
54025
+ },
54026
+ inputPaddingWithLabel: function inputPaddingWithLabel(props) {
54027
+ return {
54028
+ padding: props.inputPadding ? props.inputPadding : '18.5px 14px',
54029
+ height: 'auto'
54030
+ };
54031
+ },
54032
+ input: function input(props) {
54033
+ return _extends$1({}, theme.typography[props.typographyVariant]);
54034
+ },
54035
+ inputHover: {
54036
+ '&:hover $notchedOutline': {
54037
+ borderColor: 'transparent'
54038
+ }
54039
+ },
54040
+ icon: {
54041
+ display: 'none'
54042
+ },
54043
+ showIcon: {
54044
+ display: 'block'
54045
+ }
54046
+ };
54047
+ });
54048
+
54049
+ /**
54050
+ * ActiveKeyboardDateTimePicker is a customized [Material Ui KeyboardDateTimePicker]('https://material-ui-pickers.dev/api/KeyboardDateTimePicker') for more details
54051
+ */
54052
+ function ActiveKeyboardDateTimePicker(props) {
54053
+ var classes = useStyles$A(props);
54054
+ var autoOk = props.autoOk,
54055
+ variant = props.variant,
54056
+ inputVariant = props.inputVariant,
54057
+ readOnly = props.readOnly,
54058
+ interactiveMode = props.interactiveMode,
54059
+ InputLabelProps = props.InputLabelProps,
54060
+ className = props.className,
54061
+ inputProps = props.inputProps,
54062
+ InputProps = props.InputProps,
54063
+ placeholder = props.placeholder,
54064
+ showLabelHelp = props.showLabelHelp,
54065
+ InputLabelHelpProps = props.InputLabelHelpProps,
54066
+ label = props.label,
54067
+ KeyboardButtonProps = props.KeyboardButtonProps,
54068
+ others = objectWithoutProperties(props, ['autoOk', 'variant', 'inputVariant', 'readOnly', 'interactiveMode', 'InputLabelProps', 'className', 'inputProps', 'InputProps', 'placeholder', 'showLabelHelp', 'InputLabelHelpProps', 'label', 'KeyboardButtonProps']);
54069
+
54070
+ var _React$useState = React__default.useState(classes.icon),
54071
+ _React$useState2 = slicedToArray(_React$useState, 2),
54072
+ hideIcon = _React$useState2[0],
54073
+ setHideIcon = _React$useState2[1];
54074
+
54075
+ var inputPaddingClass = props.label ? classes.inputPaddingWithLabel : classes.inputPaddingWithoutLabel;
54076
+ var finalPlaceholder = readOnly ? null : placeholder;
54077
+
54078
+ var onMouseOver = function onMouseOver() {
54079
+ if (!readOnly) {
54080
+ setHideIcon(classes.showIcon);
54081
+ }
54082
+ return props.onMouseOver && props.onMouseOver;
54083
+ };
54084
+
54085
+ var handleBlur = function handleBlur(event) {
54086
+ event.preventDefault();
54087
+ setHideIcon(classes.icon);
54088
+ return props.onBlur && props.onBlur;
54089
+ };
54090
+
54091
+ return React__default.createElement(
54092
+ MuiPickersUtilsProvider,
54093
+ { utils: DateFnsUtils },
54094
+ React__default.createElement(KeyboardDateTimePicker, _extends$1({
54095
+ autoOk: autoOk,
54096
+ variant: variant,
54097
+ inputVariant: inputVariant,
54098
+ placeholder: finalPlaceholder,
54099
+ className: classes.textField + ' ' + (className && className),
54100
+ InputLabelProps: _extends$1({
54101
+ shrink: true,
54102
+ style: _extends$1({}, styles$1a.labelRoot)
54103
+ }, InputLabelProps),
54104
+ inputProps: _extends$1({
54105
+ readOnly: Boolean(readOnly),
54106
+ disabled: Boolean(readOnly)
54107
+ }, inputProps),
54108
+ readOnly: readOnly,
54109
+ KeyboardButtonProps: _extends$1({}, KeyboardButtonProps, {
54110
+ classes: {
54111
+ root: '' + (!interactiveMode && !readOnly ? '' : hideIcon)
54112
+ }
54113
+ }),
54114
+ InputProps: _extends$1({
54115
+ classes: {
54116
+ root: classes.input + ' ' + (readOnly && classes.inputHover),
54117
+ notchedOutline: '' + (!interactiveMode && !readOnly ? '' : classes.notchedOutline),
54118
+ input: inputPaddingClass
54119
+ }
54120
+ }, InputProps),
54121
+ label: showLabelHelp ? React__default.createElement(InputLabelHelp, _extends$1({ inputLabel: label }, InputLabelHelpProps)) : label,
54122
+ onMouseOver: onMouseOver,
54123
+ onMouseLeave: handleBlur,
54124
+ onBlur: handleBlur
54125
+ }, others))
54126
+ );
54127
+ }
54128
+
54129
+ ActiveKeyboardDateTimePicker.propTypes = {
54130
+ /** AutoOk on date select */
54131
+ autoOk: PropTypes__default.bool,
54132
+ /** Picker container option variant : 'dialog' | 'inline' | 'static' */
54133
+ variant: PropTypes__default.string,
54134
+ /** Material ui textfield variant */
54135
+ inputVariant: PropTypes__default.string,
54136
+ /** Date format */
54137
+ format: PropTypes__default.string,
54138
+ /** To make the content readOnly */
54139
+ readOnly: PropTypes__default.bool,
54140
+ /** Change to write mode by hiding text field border and displays border on hover*/
54141
+ interactiveMode: PropTypes__default.bool,
54142
+ /** Props applied to the InputLabel element.*/
54143
+ InputLabelProps: PropTypes__default.object,
54144
+ /** Attributes applied to the input element. */
54145
+ inputProps: PropTypes__default.object,
54146
+ /** Props applied to the Input element. */
54147
+ InputProps: PropTypes__default.object,
54148
+ /** Placeholder text*/
54149
+ placeholder: PropTypes__default.string,
54150
+ /** Label text */
54151
+ label: PropTypes__default.string,
54152
+ /** Show label help */
54153
+ showLabelHelp: PropTypes__default.bool,
54154
+ /** Props applied to the input label help element. E.g InputLabelHelpProps={{type:'link', label:'Help', link:'unicef.github.io', icon, tooltipTitle: 'Tooltip title', tooltipPlacement: 'bottom}} */
54155
+ InputLabelHelpProps: PropTypes__default.object,
54156
+ /** Keyboard button props */
54157
+ KeyboardButtonProps: PropTypes__default.object
54158
+ };
54159
+
54160
+ ActiveKeyboardDateTimePicker.defaultProps = {
54161
+ inputVariant: 'outlined',
54162
+ autoOk: true,
54163
+ variant: 'inline',
54164
+ format: 'dd/MM/yyyy hh:mm a',
54165
+ KeyboardButtonProps: {}
54166
+ };
54167
+
53986
54168
  exports.ActiveAutoComplete = ActiveAutoComplete;
53987
54169
  exports.ActiveCurrencyField = ActiveCurrencyField;
53988
54170
  exports.ActiveDatePicker = ActiveDatePicker;
@@ -53991,6 +54173,7 @@ exports.ActiveFormPositiveInteger = ActiveFormPositiveInteger;
53991
54173
  exports.ActiveFormSelect = ActiveFormSelect;
53992
54174
  exports.ActiveFormTextField = ActiveFormTextField;
53993
54175
  exports.ActiveKeyboardDatePicker = ActiveKeyboardDatePicker;
54176
+ exports.ActiveKeyboardDateTimePicker = ActiveKeyboardDateTimePicker;
53994
54177
  exports.ActiveKeyboardTimePicker = ActiveKeyboardTimePicker;
53995
54178
  exports.ActiveTimePicker = ActiveTimePicker;
53996
54179
  exports.UAsyncBadge = UAsyncBadge;