@patternfly/react-core 4.269.0 → 4.270.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@patternfly/react-core",
3
- "version": "4.269.0",
3
+ "version": "4.270.0",
4
4
  "description": "This library provides a set of common React components for use with the PatternFly reference implementation.",
5
5
  "main": "dist/js/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -71,5 +71,5 @@
71
71
  "react": "^16.8 || ^17 || ^18",
72
72
  "react-dom": "^16.8 || ^17 || ^18"
73
73
  },
74
- "gitHead": "bf9cf833bd7117fcfdb71fc68cab3d2453374336"
74
+ "gitHead": "78cd4be8d80842ed0236d9ac106f6e8ed56bb075"
75
75
  }
@@ -42,9 +42,9 @@ export interface DatePickerProps
42
42
  /** Error message to display when the text input cannot be parsed. */
43
43
  invalidFormatText?: string;
44
44
  /** Callback called every time the text input loses focus. */
45
- onBlur?: (value: string, date?: Date) => void;
45
+ onBlur?: (event: any, value: string, date?: Date) => void;
46
46
  /** Callback called every time the text input value changes. */
47
- onChange?: (value: string, date?: Date) => void;
47
+ onChange?: (event: React.FormEvent<HTMLInputElement>, value: string, date?: Date) => void;
48
48
  /** String to display in the empty text input as a hint for the expected date format. */
49
49
  placeholder?: string;
50
50
  /** Props to pass to the popover that contains the calendar month component. */
@@ -138,28 +138,28 @@ const DatePickerBase = (
138
138
  setErrorText(validators.map(validator => validator(date)).join('\n') || '');
139
139
  };
140
140
 
141
- const onTextInput = (value: string) => {
141
+ const onTextInput = (value: string, event: React.FormEvent<HTMLInputElement>) => {
142
142
  setValue(value);
143
143
  setErrorText('');
144
144
  const newValueDate = dateParse(value);
145
145
  setValueDate(newValueDate);
146
146
  if (isValidDate(newValueDate)) {
147
- onChange(value, new Date(newValueDate));
147
+ onChange(event, value, new Date(newValueDate));
148
148
  } else {
149
- onChange(value);
149
+ onChange(event, value);
150
150
  }
151
151
  };
152
152
 
153
- const onInputBlur = () => {
153
+ const onInputBlur = (event: any) => {
154
154
  if (pristine) {
155
155
  return;
156
156
  }
157
157
  const newValueDate = dateParse(value);
158
158
  if (isValidDate(newValueDate)) {
159
- onBlur(value, new Date(newValueDate));
159
+ onBlur(event, value, new Date(newValueDate));
160
160
  setError(newValueDate);
161
161
  } else {
162
- onBlur(value);
162
+ onBlur(event, value);
163
163
  setErrorText(invalidFormatText);
164
164
  }
165
165
  };
@@ -170,7 +170,7 @@ const DatePickerBase = (
170
170
  setValueDate(newValueDate);
171
171
  setError(newValueDate);
172
172
  setPopoverOpen(false);
173
- onChange(newValue, new Date(newValueDate));
173
+ onChange(null, newValue, new Date(newValueDate));
174
174
  };
175
175
 
176
176
  const onKeyPress = (ev: React.KeyboardEvent<HTMLInputElement>) => {
@@ -4,8 +4,8 @@ import { DatePicker } from '@patternfly/react-core';
4
4
  export const DatePickerBasic: React.FunctionComponent = () => (
5
5
  <DatePicker
6
6
  // eslint-disable-next-line no-console
7
- onBlur={(str, date) => console.log('onBlur', str, date)}
7
+ onBlur={(_event, str, date) => console.log('onBlur', str, date)}
8
8
  // eslint-disable-next-line no-console
9
- onChange={(str, date) => console.log('onChange', str, date)}
9
+ onChange={(_event, str, date) => console.log('onChange', str, date)}
10
10
  />
11
11
  );
@@ -7,7 +7,7 @@ export const DatePickerControlled: React.FunctionComponent = () => {
7
7
  return (
8
8
  <React.Fragment>
9
9
  <Button onClick={() => setValue(initialValue)}>Reset date</Button>
10
- <DatePicker value={value} onChange={value => setValue(value)} />
10
+ <DatePicker value={value} onChange={(_event, value) => setValue(value)} />
11
11
  </React.Fragment>
12
12
  );
13
13
  };