@planningcenter/tapestry-react 2.9.0-rc.0 → 2.9.0-rc.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.
@@ -211,11 +211,11 @@ it('increment hour on arrow up', function () {
211
211
  }),
212
212
  hourInput = _setup15.hourInput;
213
213
 
214
- expect(hourInput).toHaveValue("01");
214
+ expect(hourInput).toHaveValue('01');
215
215
 
216
216
  _userEvent["default"].type(hourInput, '{arrowup}');
217
217
 
218
- expect(hourInput).toHaveValue("02");
218
+ expect(hourInput).toHaveValue('02');
219
219
  });
220
220
  it('increment hour if arrow up on minutes exceeds max value', function () {
221
221
  var _setup16 = setup({
@@ -225,11 +225,11 @@ it('increment hour if arrow up on minutes exceeds max value', function () {
225
225
  hourInput = _setup16.hourInput,
226
226
  minuteInput = _setup16.minuteInput;
227
227
 
228
- expect(hourInput).toHaveValue("01");
228
+ expect(hourInput).toHaveValue('01');
229
229
 
230
230
  _userEvent["default"].type(minuteInput, '{arrowup}');
231
231
 
232
- expect(hourInput).toHaveValue("02");
232
+ expect(hourInput).toHaveValue('02');
233
233
  });
234
234
  it('decrement hour on arrow down', function () {
235
235
  var _setup17 = setup({
@@ -238,11 +238,11 @@ it('decrement hour on arrow down', function () {
238
238
  }),
239
239
  hourInput = _setup17.hourInput;
240
240
 
241
- expect(hourInput).toHaveValue("02");
241
+ expect(hourInput).toHaveValue('02');
242
242
 
243
243
  _userEvent["default"].type(hourInput, '{arrowdown}');
244
244
 
245
- expect(hourInput).toHaveValue("01");
245
+ expect(hourInput).toHaveValue('01');
246
246
  });
247
247
  it('decrement hour if arrow down on minutes exceeds min value', function () {
248
248
  var _setup18 = setup({
@@ -252,11 +252,11 @@ it('decrement hour if arrow down on minutes exceeds min value', function () {
252
252
  hourInput = _setup18.hourInput,
253
253
  minuteInput = _setup18.minuteInput;
254
254
 
255
- expect(hourInput).toHaveValue("02");
255
+ expect(hourInput).toHaveValue('02');
256
256
 
257
257
  _userEvent["default"].type(minuteInput, '{arrowdown}');
258
258
 
259
- expect(hourInput).toHaveValue("01");
259
+ expect(hourInput).toHaveValue('01');
260
260
  });
261
261
  it('increment minute on arrow up', function () {
262
262
  var _setup19 = setup({
@@ -265,11 +265,11 @@ it('increment minute on arrow up', function () {
265
265
  }),
266
266
  minuteInput = _setup19.minuteInput;
267
267
 
268
- expect(minuteInput).toHaveValue("42");
268
+ expect(minuteInput).toHaveValue('42');
269
269
 
270
270
  _userEvent["default"].type(minuteInput, '{arrowup}');
271
271
 
272
- expect(minuteInput).toHaveValue("43");
272
+ expect(minuteInput).toHaveValue('43');
273
273
  });
274
274
  it('decrement minute on arrow down', function () {
275
275
  var _setup20 = setup({
@@ -278,11 +278,11 @@ it('decrement minute on arrow down', function () {
278
278
  }),
279
279
  minuteInput = _setup20.minuteInput;
280
280
 
281
- expect(minuteInput).toHaveValue("43");
281
+ expect(minuteInput).toHaveValue('43');
282
282
 
283
283
  _userEvent["default"].type(minuteInput, '{arrowdown}');
284
284
 
285
- expect(minuteInput).toHaveValue("42");
285
+ expect(minuteInput).toHaveValue('42');
286
286
  });
287
287
  it('set minute to min value if arrow up on minutes exceeds max value', function () {
288
288
  var _setup21 = setup({
@@ -291,11 +291,11 @@ it('set minute to min value if arrow up on minutes exceeds max value', function
291
291
  }),
292
292
  minuteInput = _setup21.minuteInput;
293
293
 
294
- expect(minuteInput).toHaveValue("59");
294
+ expect(minuteInput).toHaveValue('59');
295
295
 
296
296
  _userEvent["default"].type(minuteInput, '{arrowup}');
297
297
 
298
- expect(minuteInput).toHaveValue("00");
298
+ expect(minuteInput).toHaveValue('00');
299
299
  });
300
300
  it('set minute to max value if arrow down on minutes exceeds min value', function () {
301
301
  var _setup22 = setup({
@@ -304,11 +304,11 @@ it('set minute to max value if arrow down on minutes exceeds min value', functio
304
304
  }),
305
305
  minuteInput = _setup22.minuteInput;
306
306
 
307
- expect(minuteInput).toHaveValue("00");
307
+ expect(minuteInput).toHaveValue('00');
308
308
 
309
309
  _userEvent["default"].type(minuteInput, '{arrowdown}');
310
310
 
311
- expect(minuteInput).toHaveValue("59");
311
+ expect(minuteInput).toHaveValue('59');
312
312
  });
313
313
  it('toggle meridiem if arrow up on hour exceeds eleven', function () {
314
314
  var _setup23 = setup({
@@ -325,7 +325,7 @@ it('toggle meridiem if arrow up on hour exceeds eleven', function () {
325
325
  });
326
326
  it('toggle meridiem if arrow down on hour exceeds min value', function () {
327
327
  var _setup24 = setup({
328
- hours: 1
328
+ hours: 0
329
329
  }),
330
330
  hourInput = _setup24.hourInput,
331
331
  meridiemInput = _setup24.meridiemInput;
@@ -342,11 +342,11 @@ it('set 12 hour clock to min value if arrow up on hour exceeds max value', funct
342
342
  }),
343
343
  hourInput = _setup25.hourInput;
344
344
 
345
- expect(hourInput).toHaveValue("12");
345
+ expect(hourInput).toHaveValue('12');
346
346
 
347
347
  _userEvent["default"].type(hourInput, '{arrowup}');
348
348
 
349
- expect(hourInput).toHaveValue("01");
349
+ expect(hourInput).toHaveValue('01');
350
350
  });
351
351
  it('set 24 hour clock to min value if arrow up on hour exceeds max value', function () {
352
352
  var _setup26 = setup({
@@ -355,11 +355,11 @@ it('set 24 hour clock to min value if arrow up on hour exceeds max value', funct
355
355
  }),
356
356
  hourInput = _setup26.hourInput;
357
357
 
358
- expect(hourInput).toHaveValue("23");
358
+ expect(hourInput).toHaveValue('23');
359
359
 
360
360
  _userEvent["default"].type(hourInput, '{arrowup}');
361
361
 
362
- expect(hourInput).toHaveValue("00");
362
+ expect(hourInput).toHaveValue('00');
363
363
  });
364
364
  it('set 12 hour clock to max value if arrow down on hour exceeds min value', function () {
365
365
  var _setup27 = setup({
@@ -367,11 +367,11 @@ it('set 12 hour clock to max value if arrow down on hour exceeds min value', fun
367
367
  }),
368
368
  hourInput = _setup27.hourInput;
369
369
 
370
- expect(hourInput).toHaveValue("01");
370
+ expect(hourInput).toHaveValue('01');
371
371
 
372
372
  _userEvent["default"].type(hourInput, '{arrowdown}');
373
373
 
374
- expect(hourInput).toHaveValue("12");
374
+ expect(hourInput).toHaveValue('12');
375
375
  });
376
376
  it('set 24 hour clock to max value if arrow down on hour exceeds min value', function () {
377
377
  var _setup28 = setup({
@@ -380,11 +380,11 @@ it('set 24 hour clock to max value if arrow down on hour exceeds min value', fun
380
380
  }),
381
381
  hourInput = _setup28.hourInput;
382
382
 
383
- expect(hourInput).toHaveValue("00");
383
+ expect(hourInput).toHaveValue('00');
384
384
 
385
385
  _userEvent["default"].type(hourInput, '{arrowdown}');
386
386
 
387
- expect(hourInput).toHaveValue("23");
387
+ expect(hourInput).toHaveValue('23');
388
388
  });
389
389
  it('does not change the value of hours on arrow up or arrow down if ignored', function () {
390
390
  var _setup29 = setup({
@@ -394,15 +394,15 @@ it('does not change the value of hours on arrow up or arrow down if ignored', fu
394
394
  }),
395
395
  hourInput = _setup29.hourInput;
396
396
 
397
- expect(hourInput).toHaveValue("01");
397
+ expect(hourInput).toHaveValue('01');
398
398
 
399
399
  _userEvent["default"].type(hourInput, '{arrowup}');
400
400
 
401
- expect(hourInput).toHaveValue("01");
401
+ expect(hourInput).toHaveValue('01');
402
402
 
403
403
  _userEvent["default"].type(hourInput, '{arrowdown}');
404
404
 
405
- expect(hourInput).toHaveValue("01");
405
+ expect(hourInput).toHaveValue('01');
406
406
  });
407
407
  it('does not change the value of minutes on arrow up or arrow down if ignored', function () {
408
408
  var _setup30 = setup({
@@ -412,15 +412,15 @@ it('does not change the value of minutes on arrow up or arrow down if ignored',
412
412
  }),
413
413
  minuteInput = _setup30.minuteInput;
414
414
 
415
- expect(minuteInput).toHaveValue("42");
415
+ expect(minuteInput).toHaveValue('42');
416
416
 
417
417
  _userEvent["default"].type(minuteInput, '{arrowup}');
418
418
 
419
- expect(minuteInput).toHaveValue("42");
419
+ expect(minuteInput).toHaveValue('42');
420
420
 
421
421
  _userEvent["default"].type(minuteInput, '{arrowdown}');
422
422
 
423
- expect(minuteInput).toHaveValue("42");
423
+ expect(minuteInput).toHaveValue('42');
424
424
  }); // ios
425
425
 
426
426
  it('renders iOS as a single input', function () {
@@ -0,0 +1,274 @@
1
+ "use strict";
2
+
3
+ var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
4
+
5
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
6
+
7
+ exports.__esModule = true;
8
+ exports["default"] = void 0;
9
+
10
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
11
+
12
+ var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
13
+
14
+ var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
15
+
16
+ var _inheritsLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/inheritsLoose"));
17
+
18
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
19
+
20
+ var _react = _interopRequireWildcard(require("react"));
21
+
22
+ var _Box = _interopRequireDefault(require("../Box"));
23
+
24
+ var _Input = _interopRequireDefault(require("../Input/Input"));
25
+
26
+ var _InputBox = _interopRequireDefault(require("../Input/InputBox"));
27
+
28
+ var _InputField = _interopRequireDefault(require("../Input/InputField"));
29
+
30
+ var _NumberField = _interopRequireDefault(require("../NumberField"));
31
+
32
+ var _utils = require("../utils");
33
+
34
+ var _utils2 = require("./utils");
35
+
36
+ var MIN_MINUTE = 0;
37
+ var MAX_MINUTE = 59;
38
+
39
+ var TimeField = /*#__PURE__*/function (_Component) {
40
+ (0, _inheritsLoose2["default"])(TimeField, _Component);
41
+
42
+ function TimeField(props) {
43
+ var _this;
44
+
45
+ _this = _Component.call(this, props) || this;
46
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "setInputBoxRef", function (component) {
47
+ _this.inputBox = component;
48
+ });
49
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "updateTime", function (time) {
50
+ if (time === void 0) {
51
+ time = {};
52
+ }
53
+
54
+ var _this$props$value = _this.props.value,
55
+ hours = _this$props$value[0],
56
+ minutes = _this$props$value[1];
57
+
58
+ if (time.hours !== undefined) {
59
+ hours = time.hours;
60
+ }
61
+
62
+ if (time.minutes !== undefined) {
63
+ minutes = time.minutes;
64
+ }
65
+
66
+ if (_this.props.twelveHourClock && !_this.props.isIOS) {
67
+ if (hours > 11 && _this.state.meridiem === 'AM') {
68
+ hours -= 12;
69
+ } else if (hours < 12 && _this.state.meridiem === 'PM') {
70
+ hours += 12;
71
+ }
72
+ }
73
+
74
+ _this.props.onChange([hours, minutes]);
75
+ });
76
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "updateHours", function (amount) {
77
+ _this.props.onChange((0, _utils2.addHoursToTime)(_this.props.value, amount));
78
+ });
79
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "updateMinutes", function (amount) {
80
+ _this.props.onChange((0, _utils2.addMinutesToTime)(_this.props.value, amount));
81
+ });
82
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "toggleMeridiem", function () {
83
+ _this.setState(function (state) {
84
+ return {
85
+ meridiem: state.meridiem === 'AM' ? 'PM' : 'AM'
86
+ };
87
+ }, _this.updateTime);
88
+ });
89
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "handleHoursChange", function (hours) {
90
+ _this.updateTime({
91
+ hours: hours
92
+ });
93
+ });
94
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "handleHoursKeyDown", function (event) {
95
+ var hour = Number(event.target.value);
96
+ var isTwelveHourClock = _this.props.twelveHourClock;
97
+ var isHourEleven = _utils2.HOURS_TO_NOON - 1;
98
+ var maxHour = isTwelveHourClock ? _utils2.HOURS_TO_NOON : _utils2.HOURS_IN_DAY - 1;
99
+ var minHour = isTwelveHourClock ? 1 : 0;
100
+
101
+ if (event.key === 'ArrowRight') {
102
+ _this.inputBox.focus(1);
103
+ }
104
+
105
+ if (event.key === 'ArrowUp' && isTwelveHourClock && hour === isHourEleven) {
106
+ _this.toggleMeridiem();
107
+ }
108
+
109
+ if (event.key === 'ArrowUp' && hour === maxHour) {
110
+ _this.updateHours(1);
111
+ }
112
+
113
+ if (event.key === 'ArrowDown' && isTwelveHourClock && hour === minHour) {
114
+ _this.toggleMeridiem();
115
+ }
116
+
117
+ if (event.key === 'ArrowDown' && hour === minHour) {
118
+ _this.updateHours(-1);
119
+ }
120
+ });
121
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "handleMinutesChange", function (minutes) {
122
+ _this.updateTime({
123
+ minutes: minutes
124
+ });
125
+ });
126
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "handleMinutesKeyDown", function (event) {
127
+ var minute = Number(event.target.value);
128
+
129
+ if (_this.props.ignoredKeys.includes(event.key)) {
130
+ return;
131
+ }
132
+
133
+ if (event.key === 'ArrowLeft') {
134
+ _this.inputBox.focus(0);
135
+ }
136
+
137
+ if (event.key === 'ArrowRight') {
138
+ _this.inputBox.focus(2);
139
+ }
140
+
141
+ if (event.key === 'ArrowUp' && minute >= MAX_MINUTE) {
142
+ _this.updateMinutes(1);
143
+ }
144
+
145
+ if (event.key === 'ArrowDown' && minute <= MIN_MINUTE) {
146
+ _this.updateMinutes(-1);
147
+ }
148
+ });
149
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "handleAMPMKeyDown", function (event) {
150
+ if (_this.props.ignoredKeys.includes(event.key)) {
151
+ return;
152
+ }
153
+
154
+ if (event.key !== 'Tab' && !(event.metaKey && event.key === 'r')) {
155
+ event.preventDefault();
156
+ }
157
+
158
+ if (event.key === 'ArrowLeft') {
159
+ _this.inputBox.focus(1);
160
+ }
161
+
162
+ if (event.key.toLowerCase() === 'a' && _this.state.meridiem === 'PM' || event.key.toLowerCase() === 'p' && _this.state.meridiem === 'AM' || event.key === 'ArrowUp' || event.key === 'ArrowDown') {
163
+ _this.toggleMeridiem();
164
+ }
165
+ });
166
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "handleIOSChange", function (event) {
167
+ var _event$target$value$s = event.target.value.split(':'),
168
+ hours = _event$target$value$s[0],
169
+ minutes = _event$target$value$s[1];
170
+
171
+ _this.updateTime({
172
+ hours: +hours,
173
+ minutes: +minutes
174
+ });
175
+ });
176
+ _this.state = {
177
+ meridiem: (0, _utils2.getMeridiem)(props.value)
178
+ };
179
+ return _this;
180
+ }
181
+
182
+ var _proto = TimeField.prototype;
183
+
184
+ _proto.componentDidUpdate = function componentDidUpdate(lastProps) {
185
+ if (lastProps.value[0] !== this.props.value[0]) {
186
+ this.setState({
187
+ meridiem: (0, _utils2.getMeridiem)(this.props.value)
188
+ });
189
+ }
190
+ };
191
+
192
+ _proto.render = function render() {
193
+ var _this$props = this.props,
194
+ ignoredKeys = _this$props.ignoredKeys,
195
+ value = _this$props.value,
196
+ min = _this$props.min,
197
+ max = _this$props.max,
198
+ interval = _this$props.interval,
199
+ onChange = _this$props.onChange,
200
+ twelveHourClock = _this$props.twelveHourClock,
201
+ isIOS = _this$props.isIOS,
202
+ restProps = (0, _objectWithoutPropertiesLoose2["default"])(_this$props, ["ignoredKeys", "value", "min", "max", "interval", "onChange", "twelveHourClock", "isIOS"]);
203
+ var hours = value[0],
204
+ minutes = value[1];
205
+ return isIOS ? /*#__PURE__*/_react["default"].createElement(_Input["default"], (0, _extends2["default"])({}, restProps, {
206
+ type: "time",
207
+ autoWidth: hours + ":" + (0, _utils.padNumber)(minutes, 2) + " " + this.state.meridiem,
208
+ value: (0, _utils.padNumber)(hours, 2) + ":" + (0, _utils.padNumber)(minutes, 2),
209
+ onChange: this.handleIOSChange
210
+ })) : /*#__PURE__*/_react["default"].createElement(_InputBox["default"], (0, _extends2["default"])({
211
+ ref: this.setInputBoxRef,
212
+ inline: true
213
+ }, restProps), /*#__PURE__*/_react["default"].createElement(_NumberField["default"], {
214
+ autoWidth: false,
215
+ fontVariantNumeric: "tabular-nums",
216
+ moveFocusOnMax: true,
217
+ value: twelveHourClock ? hours % _utils2.HOURS_TO_NOON || _utils2.HOURS_TO_NOON : hours,
218
+ min: twelveHourClock ? 1 : 0,
219
+ max: twelveHourClock ? _utils2.HOURS_TO_NOON : _utils2.HOURS_IN_DAY - 1,
220
+ pad: 2,
221
+ grow: 0,
222
+ width: "2ch",
223
+ textAlign: "center",
224
+ "aria-label": "Hours",
225
+ onChange: this.handleHoursChange,
226
+ onKeyDown: this.handleHoursKeyDown,
227
+ ignoredKeys: ignoredKeys
228
+ }), /*#__PURE__*/_react["default"].createElement(_Box["default"], {
229
+ as: "span",
230
+ width: 0.5,
231
+ textAlign: "center",
232
+ userSelect: "none"
233
+ }, ":"), /*#__PURE__*/_react["default"].createElement(_NumberField["default"], {
234
+ autoWidth: false,
235
+ fontVariantNumeric: "tabular-nums",
236
+ moveFocusOnMax: true,
237
+ value: minutes,
238
+ min: MIN_MINUTE,
239
+ max: MAX_MINUTE,
240
+ pad: 2,
241
+ grow: 0,
242
+ width: "2ch",
243
+ textAlign: "center",
244
+ "aria-label": "Minutes",
245
+ onChange: this.handleMinutesChange,
246
+ onKeyDown: this.handleMinutesKeyDown,
247
+ ignoredKeys: ignoredKeys
248
+ }), twelveHourClock && /*#__PURE__*/_react["default"].createElement(_InputField["default"], {
249
+ highlightOnInteraction: true,
250
+ value: this.state.meridiem,
251
+ grow: 0,
252
+ width: "2em",
253
+ textAlign: "center",
254
+ "aria-label": "AM/PM",
255
+ onChange: _utils.noop // prevent React warnings
256
+ ,
257
+ onKeyDown: this.handleAMPMKeyDown
258
+ }));
259
+ };
260
+
261
+ return TimeField;
262
+ }(_react.Component);
263
+
264
+ (0, _defineProperty2["default"])(TimeField, "addHoursToTime", _utils2.addHoursToTime);
265
+ (0, _defineProperty2["default"])(TimeField, "addMinutesToTime", _utils2.addMinutesToTime);
266
+ (0, _defineProperty2["default"])(TimeField, "addTimeToDate", _utils2.addTimeToDate);
267
+ (0, _defineProperty2["default"])(TimeField, "getTimeFromDate", _utils2.getTimeFromDate);
268
+ (0, _defineProperty2["default"])(TimeField, "defaultProps", {
269
+ twelveHourClock: true,
270
+ ignoredKeys: [],
271
+ isIOS: _utils.isIOS
272
+ });
273
+ var _default = TimeField;
274
+ exports["default"] = _default;
@@ -27,18 +27,12 @@ function addHoursToTime(time, hoursToAdd) {
27
27
  function addMinutesToTime(time, minutesToAdd) {
28
28
  var hours = time[0],
29
29
  minutes = time[1];
30
- var nextMinutes = minutes + minutesToAdd;
31
- var remainderMinutes = modulo(nextMinutes, MINUTES_IN_HOUR);
32
-
33
- if (remainderMinutes >= 0) {
34
- var nextHours = hours + Math.floor(nextMinutes / MINUTES_IN_HOUR);
35
- hours = modulo(nextHours, HOURS_IN_DAY);
36
- minutes = remainderMinutes;
37
- } else {
38
- minutes = nextMinutes;
39
- }
40
-
41
- return [hours, minutes];
30
+ var totalTimeInMinutes = hours * 60 + minutes;
31
+ var totalMinutesInDay = 24 * 60;
32
+ var newTime = parseInt(totalTimeInMinutes) + parseInt(minutesToAdd);
33
+ var newHours = newTime > totalMinutesInDay ? Math.floor(newTime / 60) - 24 : Math.floor(newTime / 60);
34
+ var newMinutes = newTime % 60;
35
+ return [newHours, newMinutes];
42
36
  }
43
37
 
44
38
  function addTimeToDate(date, time) {
package/dist/cjs/utils.js CHANGED
@@ -21,6 +21,7 @@ exports.insertAtIndex = insertAtIndex;
21
21
  exports.isArray = isArray;
22
22
  exports.isElementInteractive = isElementInteractive;
23
23
  exports.isFunction = isFunction;
24
+ exports.isNumber = isNumber;
24
25
  exports.isValueInArray = isValueInArray;
25
26
  exports.joinChildren = joinChildren;
26
27
  exports.lockScroll = lockScroll;
@@ -399,6 +400,14 @@ function isArray(value) {
399
400
  function isFunction(value) {
400
401
  return value && value.constructor === Function;
401
402
  }
403
+ /**
404
+ * Determines if value is a number
405
+ */
406
+
407
+
408
+ function isNumber(value) {
409
+ return /^[0-9]$/i.test(value);
410
+ }
402
411
  /**
403
412
  * Determines if a value is present in an array by
404
413
  * performing a shallow equal check on each item.