@contentful/field-editor-date 1.6.4 → 1.6.6

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.
@@ -43,7 +43,9 @@ function _interop_require_wildcard(obj, nodeInterop) {
43
43
  if (cache && cache.has(obj)) {
44
44
  return cache.get(obj);
45
45
  }
46
- var newObj = {};
46
+ var newObj = {
47
+ __proto__: null
48
+ };
47
49
  var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
48
50
  for(var key in obj){
49
51
  if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
@@ -80,7 +82,7 @@ function useEffectWithoutFirstRender(callback, deps) {
80
82
  callback();
81
83
  }, deps);
82
84
  }
83
- function DateEditorContainer({ initialValue , usesTime , usesTimezone , uses12hClock , disabled , hasClear , onChange }) {
85
+ function DateEditorContainer({ initialValue, usesTime, usesTimezone, uses12hClock, disabled, hasClear, onChange }) {
84
86
  const [value, setValue] = _react.useState(()=>initialValue);
85
87
  useEffectWithoutFirstRender(()=>{
86
88
  onChange(value);
@@ -105,7 +107,7 @@ function DateEditorContainer({ initialValue , usesTime , usesTimezone , uses12hC
105
107
  disabled: disabled,
106
108
  time: value.time,
107
109
  ampm: value.ampm,
108
- onChange: ({ time , ampm })=>{
110
+ onChange: ({ time, ampm })=>{
109
111
  setValue((value)=>({
110
112
  ...value,
111
113
  time,
@@ -141,7 +143,7 @@ function DateEditorContainer({ initialValue , usesTime , usesTimezone , uses12hC
141
143
  }, "Clear")));
142
144
  }
143
145
  function DateEditor(props) {
144
- const { field , parameters } = props;
146
+ const { field, parameters } = props;
145
147
  const formatParam = parameters?.instance?.format ?? 'timeZ';
146
148
  const ampmParam = parameters?.instance?.ampm ?? '24';
147
149
  const usesTime = formatParam !== 'dateonly';
@@ -152,7 +154,7 @@ function DateEditor(props) {
152
154
  isInitiallyDisabled: props.isInitiallyDisabled,
153
155
  isDisabled: props.isDisabled,
154
156
  debounce: 0
155
- }, ({ value , disabled , setValue , externalReset })=>{
157
+ }, ({ value, disabled, setValue, externalReset })=>{
156
158
  const datetimeValue = (0, _date.userInputFromDatetime)({
157
159
  value,
158
160
  uses12hClock
@@ -38,7 +38,9 @@ function _interop_require_wildcard(obj, nodeInterop) {
38
38
  if (cache && cache.has(obj)) {
39
39
  return cache.get(obj);
40
40
  }
41
- var newObj = {};
41
+ var newObj = {
42
+ __proto__: null
43
+ };
42
44
  var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
43
45
  for(var key in obj){
44
46
  if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
@@ -38,7 +38,9 @@ function _interop_require_wildcard(obj, nodeInterop) {
38
38
  if (cache && cache.has(obj)) {
39
39
  return cache.get(obj);
40
40
  }
41
- var newObj = {};
41
+ var newObj = {
42
+ __proto__: null
43
+ };
42
44
  var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
43
45
  for(var key in obj){
44
46
  if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
@@ -87,7 +89,7 @@ const getDefaultTime = ()=>{
87
89
  const formatToString = (uses12hClock, value)=>{
88
90
  return uses12hClock ? value.format('hh:mm A') : value.format('HH:mm');
89
91
  };
90
- const TimepickerInput = ({ disabled , uses12hClock , time ='12:00' , ampm ='AM' , onChange })=>{
92
+ const TimepickerInput = ({ disabled, uses12hClock, time = '12:00', ampm = 'AM', onChange })=>{
91
93
  const [selectedTime, setSelectedTime] = (0, _react.useState)(()=>{
92
94
  return formatToString(uses12hClock, getDefaultTime());
93
95
  });
@@ -16,7 +16,7 @@ function _interop_require_default(obj) {
16
16
  default: obj
17
17
  };
18
18
  }
19
- const TimezonepickerInput = ({ disabled , onChange , value =_zoneOffsets.defaultZoneOffset })=>{
19
+ const TimezonepickerInput = ({ disabled, onChange, value = _zoneOffsets.defaultZoneOffset })=>{
20
20
  return _react.default.createElement(_f36components.Select, {
21
21
  "aria-label": "Select timezone",
22
22
  testId: "timezone-input",
@@ -71,7 +71,7 @@ function datetimeFromUserInput(input) {
71
71
  };
72
72
  }
73
73
  }
74
- function buildFieldValue({ data , usesTime , usesTimezone }) {
74
+ function buildFieldValue({ data, usesTime, usesTimezone }) {
75
75
  const date = datetimeFromUserInput(data);
76
76
  if (date.invalid) {
77
77
  return {
@@ -97,7 +97,7 @@ function getDefaultAMPM() {
97
97
  function getDefaultUtcOffset() {
98
98
  return startOfToday('Z');
99
99
  }
100
- function userInputFromDatetime({ value , uses12hClock }) {
100
+ function userInputFromDatetime({ value, uses12hClock }) {
101
101
  const datetime = fieldValueToMoment(value);
102
102
  if (datetime) {
103
103
  const timeFormat = uses12hClock ? 'hh:mm' : 'HH:mm';
@@ -26,7 +26,7 @@ function useEffectWithoutFirstRender(callback, deps) {
26
26
  callback();
27
27
  }, deps);
28
28
  }
29
- function DateEditorContainer({ initialValue , usesTime , usesTimezone , uses12hClock , disabled , hasClear , onChange }) {
29
+ function DateEditorContainer({ initialValue, usesTime, usesTimezone, uses12hClock, disabled, hasClear, onChange }) {
30
30
  const [value, setValue] = React.useState(()=>initialValue);
31
31
  useEffectWithoutFirstRender(()=>{
32
32
  onChange(value);
@@ -51,7 +51,7 @@ function DateEditorContainer({ initialValue , usesTime , usesTimezone , uses12hC
51
51
  disabled: disabled,
52
52
  time: value.time,
53
53
  ampm: value.ampm,
54
- onChange: ({ time , ampm })=>{
54
+ onChange: ({ time, ampm })=>{
55
55
  setValue((value)=>({
56
56
  ...value,
57
57
  time,
@@ -87,7 +87,7 @@ function DateEditorContainer({ initialValue , usesTime , usesTimezone , uses12hC
87
87
  }, "Clear")));
88
88
  }
89
89
  export function DateEditor(props) {
90
- const { field , parameters } = props;
90
+ const { field, parameters } = props;
91
91
  const formatParam = parameters?.instance?.format ?? 'timeZ';
92
92
  const ampmParam = parameters?.instance?.ampm ?? '24';
93
93
  const usesTime = formatParam !== 'dateonly';
@@ -98,7 +98,7 @@ export function DateEditor(props) {
98
98
  isInitiallyDisabled: props.isInitiallyDisabled,
99
99
  isDisabled: props.isDisabled,
100
100
  debounce: 0
101
- }, ({ value , disabled , setValue , externalReset })=>{
101
+ }, ({ value, disabled, setValue, externalReset })=>{
102
102
  const datetimeValue = userInputFromDatetime({
103
103
  value,
104
104
  uses12hClock
@@ -33,7 +33,7 @@ const getDefaultTime = ()=>{
33
33
  const formatToString = (uses12hClock, value)=>{
34
34
  return uses12hClock ? value.format('hh:mm A') : value.format('HH:mm');
35
35
  };
36
- export const TimepickerInput = ({ disabled , uses12hClock , time ='12:00' , ampm ='AM' , onChange })=>{
36
+ export const TimepickerInput = ({ disabled, uses12hClock, time = '12:00', ampm = 'AM', onChange })=>{
37
37
  const [selectedTime, setSelectedTime] = useState(()=>{
38
38
  return formatToString(uses12hClock, getDefaultTime());
39
39
  });
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import { Select } from '@contentful/f36-components';
3
3
  import { zoneOffsets, defaultZoneOffset } from './utils/zoneOffsets';
4
- export const TimezonepickerInput = ({ disabled , onChange , value =defaultZoneOffset })=>{
4
+ export const TimezonepickerInput = ({ disabled, onChange, value = defaultZoneOffset })=>{
5
5
  return React.createElement(Select, {
6
6
  "aria-label": "Select timezone",
7
7
  testId: "timezone-input",
@@ -42,7 +42,7 @@ function datetimeFromUserInput(input) {
42
42
  };
43
43
  }
44
44
  }
45
- export function buildFieldValue({ data , usesTime , usesTimezone }) {
45
+ export function buildFieldValue({ data, usesTime, usesTimezone }) {
46
46
  const date = datetimeFromUserInput(data);
47
47
  if (date.invalid) {
48
48
  return {
@@ -68,7 +68,7 @@ export function getDefaultAMPM() {
68
68
  export function getDefaultUtcOffset() {
69
69
  return startOfToday('Z');
70
70
  }
71
- export function userInputFromDatetime({ value , uses12hClock }) {
71
+ export function userInputFromDatetime({ value, uses12hClock }) {
72
72
  const datetime = fieldValueToMoment(value);
73
73
  if (datetime) {
74
74
  const timeFormat = uses12hClock ? 'hh:mm' : 'HH:mm';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contentful/field-editor-date",
3
- "version": "1.6.4",
3
+ "version": "1.6.6",
4
4
  "main": "dist/cjs/index.js",
5
5
  "module": "dist/esm/index.js",
6
6
  "types": "dist/types/index.d.ts",
@@ -38,13 +38,13 @@
38
38
  "dependencies": {
39
39
  "@contentful/f36-components": "^4.34.1",
40
40
  "@contentful/f36-tokens": "^4.0.1",
41
- "@contentful/field-editor-shared": "^1.4.4",
41
+ "@contentful/field-editor-shared": "^1.4.6",
42
42
  "emotion": "^10.0.17",
43
43
  "moment": "^2.20.0"
44
44
  },
45
45
  "devDependencies": {
46
46
  "@babel/core": "^7.7.4",
47
- "@contentful/field-editor-test-utils": "^1.4.5",
47
+ "@contentful/field-editor-test-utils": "^1.4.7",
48
48
  "@types/timezoned-date": "^3.0.0",
49
49
  "timezoned-date": "^3.0.2"
50
50
  },
@@ -54,5 +54,5 @@
54
54
  "publishConfig": {
55
55
  "registry": "https://npm.pkg.github.com/"
56
56
  },
57
- "gitHead": "b1f62d6b934520b6d4dc328921dd500381d1e22c"
57
+ "gitHead": "894934e9a2888aeb0a894cfebea3e034ba830f2a"
58
58
  }