@vonage/vivid 3.48.0 → 3.49.0-preview.1

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.
Files changed (182) hide show
  1. package/accordion/index.cjs +21 -0
  2. package/accordion-item/index.cjs +18 -0
  3. package/action-group/index.cjs +7 -0
  4. package/alert/index.cjs +30 -0
  5. package/appearance-ui/index.cjs +96 -0
  6. package/audio-player/index.cjs +34 -0
  7. package/avatar/index.cjs +11 -0
  8. package/badge/index.cjs +14 -0
  9. package/banner/index.cjs +29 -0
  10. package/breadcrumb/index.cjs +13 -0
  11. package/breadcrumb-item/index.cjs +22 -0
  12. package/button/index.cjs +25 -0
  13. package/calendar/index.cjs +9 -0
  14. package/calendar-event/index.cjs +9 -0
  15. package/card/index.cjs +14 -0
  16. package/checkbox/index.cjs +21 -0
  17. package/combobox/index.cjs +39 -0
  18. package/data-grid/index.cjs +18 -0
  19. package/date-picker/index.cjs +40 -0
  20. package/date-range-picker/index.cjs +40 -0
  21. package/dialog/index.cjs +31 -0
  22. package/divider/index.cjs +8 -0
  23. package/elevation/index.cjs +7 -0
  24. package/empty-state/index.cjs +12 -0
  25. package/fab/index.cjs +22 -0
  26. package/file-picker/index.cjs +30 -0
  27. package/focus/index.cjs +7 -0
  28. package/header/index.cjs +8 -0
  29. package/icon/index.cjs +10 -0
  30. package/index.cjs +296 -0
  31. package/layout/index.cjs +7 -0
  32. package/listbox/index.cjs +77 -0
  33. package/locales/en-GB.cjs +106 -0
  34. package/locales/en-US.cjs +106 -0
  35. package/locales/ja-JP.cjs +106 -0
  36. package/locales/zh-CN.cjs +106 -0
  37. package/menu/index.cjs +32 -0
  38. package/menu-item/index.cjs +22 -0
  39. package/nav/index.cjs +6 -0
  40. package/nav-disclosure/index.cjs +17 -0
  41. package/nav-item/index.cjs +22 -0
  42. package/note/index.cjs +16 -0
  43. package/number-field/index.cjs +33 -0
  44. package/option/index.cjs +23 -0
  45. package/package.json +20 -2
  46. package/pagination/index.cjs +28 -0
  47. package/popup/index.cjs +27 -0
  48. package/progress/index.cjs +9 -0
  49. package/progress-ring/index.cjs +9 -0
  50. package/radio/index.cjs +14 -0
  51. package/radio-group/index.cjs +14 -0
  52. package/select/index.cjs +38 -0
  53. package/selectable-box/index.cjs +25 -0
  54. package/shared/Reflector.cjs +67 -0
  55. package/shared/_has.cjs +62 -0
  56. package/shared/affix.cjs +64 -0
  57. package/shared/affix.js +8 -4
  58. package/shared/anchor.cjs +90 -0
  59. package/shared/anchored.cjs +78 -0
  60. package/shared/apply-mixins.cjs +25 -0
  61. package/shared/aria-global.cjs +74 -0
  62. package/shared/aria.cjs +11 -0
  63. package/shared/aria2.cjs +11 -0
  64. package/shared/base-progress.cjs +72 -0
  65. package/shared/breadcrumb-item.cjs +27 -0
  66. package/shared/button.cjs +202 -0
  67. package/shared/calendar-event.cjs +41 -0
  68. package/shared/children.cjs +61 -0
  69. package/shared/class-names.cjs +17 -0
  70. package/shared/definition.cjs +165 -0
  71. package/shared/definition10.cjs +102 -0
  72. package/shared/definition11.cjs +164 -0
  73. package/shared/definition11.js +38 -36
  74. package/shared/definition12.cjs +50 -0
  75. package/shared/definition13.cjs +779 -0
  76. package/shared/definition14.cjs +157 -0
  77. package/shared/definition15.cjs +249 -0
  78. package/shared/definition16.cjs +746 -0
  79. package/shared/definition17.cjs +1372 -0
  80. package/shared/definition18.cjs +175 -0
  81. package/shared/definition19.cjs +416 -0
  82. package/shared/definition2.cjs +232 -0
  83. package/shared/definition20.cjs +278 -0
  84. package/shared/definition21.cjs +83 -0
  85. package/shared/definition22.cjs +74 -0
  86. package/shared/definition23.cjs +106 -0
  87. package/shared/definition24.cjs +2392 -0
  88. package/shared/definition25.cjs +75 -0
  89. package/shared/definition26.cjs +39 -0
  90. package/shared/definition27.cjs +66 -0
  91. package/shared/definition28.cjs +849 -0
  92. package/shared/definition29.cjs +72 -0
  93. package/shared/definition3.cjs +72 -0
  94. package/shared/definition30.cjs +98 -0
  95. package/shared/definition31.cjs +37 -0
  96. package/shared/definition32.cjs +24 -0
  97. package/shared/definition33.cjs +64 -0
  98. package/shared/definition34.cjs +533 -0
  99. package/shared/definition35.cjs +295 -0
  100. package/shared/definition36.cjs +219 -0
  101. package/shared/definition37.cjs +109 -0
  102. package/shared/definition38.cjs +92 -0
  103. package/shared/definition39.cjs +448 -0
  104. package/shared/definition4.cjs +198 -0
  105. package/shared/definition40.cjs +49 -0
  106. package/shared/definition41.cjs +694 -0
  107. package/shared/definition42.cjs +152 -0
  108. package/shared/definition43.cjs +113 -0
  109. package/shared/definition44.cjs +607 -0
  110. package/shared/definition45.cjs +152 -0
  111. package/shared/definition46.cjs +166 -0
  112. package/shared/definition47.cjs +35 -0
  113. package/shared/definition48.cjs +98 -0
  114. package/shared/definition49.cjs +543 -0
  115. package/shared/definition5.cjs +199 -0
  116. package/shared/definition50.cjs +52 -0
  117. package/shared/definition51.cjs +150 -0
  118. package/shared/definition52.cjs +304 -0
  119. package/shared/definition53.cjs +309 -0
  120. package/shared/definition54.cjs +146 -0
  121. package/shared/definition55.cjs +128 -0
  122. package/shared/definition56.cjs +99 -0
  123. package/shared/definition57.cjs +310 -0
  124. package/shared/definition58.cjs +20 -0
  125. package/shared/definition59.cjs +51 -0
  126. package/shared/definition6.cjs +83 -0
  127. package/shared/definition60.cjs +1810 -0
  128. package/shared/definition7.cjs +72 -0
  129. package/shared/definition8.cjs +152 -0
  130. package/shared/definition9.cjs +69 -0
  131. package/shared/dialog-polyfill.esm.cjs +862 -0
  132. package/shared/direction.cjs +22 -0
  133. package/shared/dom.cjs +23 -0
  134. package/shared/enums.cjs +87 -0
  135. package/shared/focus.cjs +8 -0
  136. package/shared/focus2.cjs +11 -0
  137. package/shared/form-associated.cjs +470 -0
  138. package/shared/icon.cjs +237 -0
  139. package/shared/index.cjs +5061 -0
  140. package/shared/index2.cjs +231 -0
  141. package/shared/key-codes.cjs +115 -0
  142. package/shared/key-codes2.cjs +14 -0
  143. package/shared/listbox.cjs +1072 -0
  144. package/shared/localized.cjs +11 -0
  145. package/shared/numbers.cjs +38 -0
  146. package/shared/patterns/affix.d.ts +5 -1
  147. package/shared/presentationDate.cjs +6192 -0
  148. package/shared/radio.cjs +153 -0
  149. package/shared/ref.cjs +43 -0
  150. package/shared/repeat.cjs +767 -0
  151. package/shared/select.options.cjs +12 -0
  152. package/shared/slotted.cjs +123 -0
  153. package/shared/start-end.cjs +52 -0
  154. package/shared/strings.cjs +11 -0
  155. package/shared/text-anchor.cjs +33 -0
  156. package/shared/text-anchor.template.cjs +48 -0
  157. package/shared/text-field.cjs +5 -0
  158. package/shared/text-field2.cjs +228 -0
  159. package/shared/tree-item.cjs +154 -0
  160. package/shared/when.cjs +31 -0
  161. package/side-drawer/index.cjs +8 -0
  162. package/slider/index.cjs +16 -0
  163. package/split-button/index.cjs +20 -0
  164. package/styles/core/all.css +1 -1
  165. package/styles/core/theme.css +1 -1
  166. package/styles/core/typography.css +1 -1
  167. package/styles/tokens/theme-dark.css +4 -4
  168. package/styles/tokens/theme-light.css +4 -4
  169. package/styles/tokens/vivid-2-compat.css +1 -1
  170. package/switch/index.cjs +15 -0
  171. package/tab/index.cjs +17 -0
  172. package/tab-panel/index.cjs +6 -0
  173. package/tabs/index.cjs +24 -0
  174. package/tag/index.cjs +17 -0
  175. package/tag-group/index.cjs +7 -0
  176. package/text-anchor/index.cjs +24 -0
  177. package/text-area/index.cjs +25 -0
  178. package/text-field/index.cjs +27 -0
  179. package/toggletip/index.cjs +29 -0
  180. package/tooltip/index.cjs +29 -0
  181. package/tree-item/index.cjs +22 -0
  182. package/tree-view/index.cjs +14 -0
@@ -0,0 +1,779 @@
1
+ 'use strict';
2
+
3
+ const index = require('./index.cjs');
4
+ const calendarEvent = require('./calendar-event.cjs');
5
+ const _has = require('./_has.cjs');
6
+ const repeat = require('./repeat.cjs');
7
+
8
+ /**
9
+ * Tests whether or not an object is an array.
10
+ *
11
+ * @private
12
+ * @param {*} val The object to test.
13
+ * @return {Boolean} `true` if `val` is an array, `false` otherwise.
14
+ * @example
15
+ *
16
+ * _isArray([]); //=> true
17
+ * _isArray(null); //=> false
18
+ * _isArray({}); //=> false
19
+ */
20
+ const _isArray = Array.isArray || function _isArray(val) {
21
+ return val != null && val.length >= 0 && Object.prototype.toString.call(val) === '[object Array]';
22
+ };
23
+
24
+ function _isString(x) {
25
+ return Object.prototype.toString.call(x) === '[object String]';
26
+ }
27
+
28
+ var toString = Object.prototype.toString;
29
+
30
+ var _isArguments =
31
+ /*#__PURE__*/
32
+ function () {
33
+ return toString.call(arguments) === '[object Arguments]' ? function _isArguments(x) {
34
+ return toString.call(x) === '[object Arguments]';
35
+ } : function _isArguments(x) {
36
+ return _has._has('callee', x);
37
+ };
38
+ }();
39
+
40
+ var hasEnumBug = !
41
+ /*#__PURE__*/
42
+ {
43
+ toString: null
44
+ }.propertyIsEnumerable('toString');
45
+ var nonEnumerableProps = ['constructor', 'valueOf', 'isPrototypeOf', 'toString', 'propertyIsEnumerable', 'hasOwnProperty', 'toLocaleString']; // Safari bug
46
+
47
+ var hasArgsEnumBug =
48
+ /*#__PURE__*/
49
+ function () {
50
+
51
+ return arguments.propertyIsEnumerable('length');
52
+ }();
53
+
54
+ var contains = function contains(list, item) {
55
+ var idx = 0;
56
+
57
+ while (idx < list.length) {
58
+ if (list[idx] === item) {
59
+ return true;
60
+ }
61
+
62
+ idx += 1;
63
+ }
64
+
65
+ return false;
66
+ };
67
+ /**
68
+ * Returns a list containing the names of all the enumerable own properties of
69
+ * the supplied object.
70
+ * Note that the order of the output array is not guaranteed to be consistent
71
+ * across different JS platforms.
72
+ *
73
+ * @func
74
+ * @memberOf R
75
+ * @since v0.1.0
76
+ * @category Object
77
+ * @sig {k: v} -> [k]
78
+ * @param {Object} obj The object to extract properties from
79
+ * @return {Array} An array of the object's own properties.
80
+ * @see R.keysIn, R.values, R.toPairs
81
+ * @example
82
+ *
83
+ * R.keys({a: 1, b: 2, c: 3}); //=> ['a', 'b', 'c']
84
+ */
85
+
86
+
87
+ var keys = typeof Object.keys === 'function' && !hasArgsEnumBug ?
88
+ /*#__PURE__*/
89
+ _has._curry1(function keys(obj) {
90
+ return Object(obj) !== obj ? [] : Object.keys(obj);
91
+ }) :
92
+ /*#__PURE__*/
93
+ _has._curry1(function keys(obj) {
94
+ if (Object(obj) !== obj) {
95
+ return [];
96
+ }
97
+
98
+ var prop, nIdx;
99
+ var ks = [];
100
+
101
+ var checkArgsLength = hasArgsEnumBug && _isArguments(obj);
102
+
103
+ for (prop in obj) {
104
+ if (_has._has(prop, obj) && (!checkArgsLength || prop !== 'length')) {
105
+ ks[ks.length] = prop;
106
+ }
107
+ }
108
+
109
+ if (hasEnumBug) {
110
+ nIdx = nonEnumerableProps.length - 1;
111
+
112
+ while (nIdx >= 0) {
113
+ prop = nonEnumerableProps[nIdx];
114
+
115
+ if (_has._has(prop, obj) && !contains(ks, prop)) {
116
+ ks[ks.length] = prop;
117
+ }
118
+
119
+ nIdx -= 1;
120
+ }
121
+ }
122
+
123
+ return ks;
124
+ });
125
+
126
+ /**
127
+ * Gives a single-word string description of the (native) type of a value,
128
+ * returning such answers as 'Object', 'Number', 'Array', or 'Null'. Does not
129
+ * attempt to distinguish user Object types any further, reporting them all as
130
+ * 'Object'.
131
+ *
132
+ * @func
133
+ * @memberOf R
134
+ * @since v0.8.0
135
+ * @category Type
136
+ * @sig (* -> {*}) -> String
137
+ * @param {*} val The value to test
138
+ * @return {String}
139
+ * @example
140
+ *
141
+ * R.type({}); //=> "Object"
142
+ * R.type(1); //=> "Number"
143
+ * R.type(false); //=> "Boolean"
144
+ * R.type('s'); //=> "String"
145
+ * R.type(null); //=> "Null"
146
+ * R.type([]); //=> "Array"
147
+ * R.type(/[A-z]/); //=> "RegExp"
148
+ * R.type(() => {}); //=> "Function"
149
+ * R.type(undefined); //=> "Undefined"
150
+ */
151
+
152
+ var type =
153
+ /*#__PURE__*/
154
+ _has._curry1(function type(val) {
155
+ return val === null ? 'Null' : val === undefined ? 'Undefined' : Object.prototype.toString.call(val).slice(8, -1);
156
+ });
157
+
158
+ /**
159
+ * A function that returns the `!` of its argument. It will return `true` when
160
+ * passed false-y value, and `false` when passed a truth-y one.
161
+ *
162
+ * @func
163
+ * @memberOf R
164
+ * @since v0.1.0
165
+ * @category Logic
166
+ * @sig * -> Boolean
167
+ * @param {*} a any value
168
+ * @return {Boolean} the logical inverse of passed argument.
169
+ * @see R.complement
170
+ * @example
171
+ *
172
+ * R.not(true); //=> false
173
+ * R.not(false); //=> true
174
+ * R.not(0); //=> true
175
+ * R.not(1); //=> false
176
+ */
177
+
178
+ var not =
179
+ /*#__PURE__*/
180
+ _has._curry1(function not(a) {
181
+ return !a;
182
+ });
183
+
184
+ const not$1 = not;
185
+
186
+ function _arrayFromIterator(iter) {
187
+ var list = [];
188
+ var next;
189
+
190
+ while (!(next = iter.next()).done) {
191
+ list.push(next.value);
192
+ }
193
+
194
+ return list;
195
+ }
196
+
197
+ function _includesWith(pred, x, list) {
198
+ var idx = 0;
199
+ var len = list.length;
200
+
201
+ while (idx < len) {
202
+ if (pred(x, list[idx])) {
203
+ return true;
204
+ }
205
+
206
+ idx += 1;
207
+ }
208
+
209
+ return false;
210
+ }
211
+
212
+ function _functionName(f) {
213
+ // String(x => x) evaluates to "x => x", so the pattern may not match.
214
+ var match = String(f).match(/^function (\w*)/);
215
+ return match == null ? '' : match[1];
216
+ }
217
+
218
+ // Based on https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
219
+ function _objectIs(a, b) {
220
+ // SameValue algorithm
221
+ if (a === b) {
222
+ // Steps 1-5, 7-10
223
+ // Steps 6.b-6.e: +0 != -0
224
+ return a !== 0 || 1 / a === 1 / b;
225
+ } else {
226
+ // Step 6.a: NaN == NaN
227
+ return a !== a && b !== b;
228
+ }
229
+ }
230
+
231
+ const _objectIs$1 = typeof Object.is === 'function' ? Object.is : _objectIs;
232
+
233
+ /**
234
+ * private _uniqContentEquals function.
235
+ * That function is checking equality of 2 iterator contents with 2 assumptions
236
+ * - iterators lengths are the same
237
+ * - iterators values are unique
238
+ *
239
+ * false-positive result will be returned for comparison of, e.g.
240
+ * - [1,2,3] and [1,2,3,4]
241
+ * - [1,1,1] and [1,2,3]
242
+ * */
243
+
244
+ function _uniqContentEquals(aIterator, bIterator, stackA, stackB) {
245
+ var a = _arrayFromIterator(aIterator);
246
+
247
+ var b = _arrayFromIterator(bIterator);
248
+
249
+ function eq(_a, _b) {
250
+ return _equals(_a, _b, stackA.slice(), stackB.slice());
251
+ } // if *a* array contains any element that is not included in *b*
252
+
253
+
254
+ return !_includesWith(function (b, aItem) {
255
+ return !_includesWith(eq, aItem, b);
256
+ }, b, a);
257
+ }
258
+
259
+ function _equals(a, b, stackA, stackB) {
260
+ if (_objectIs$1(a, b)) {
261
+ return true;
262
+ }
263
+
264
+ var typeA = type(a);
265
+
266
+ if (typeA !== type(b)) {
267
+ return false;
268
+ }
269
+
270
+ if (typeof a['fantasy-land/equals'] === 'function' || typeof b['fantasy-land/equals'] === 'function') {
271
+ return typeof a['fantasy-land/equals'] === 'function' && a['fantasy-land/equals'](b) && typeof b['fantasy-land/equals'] === 'function' && b['fantasy-land/equals'](a);
272
+ }
273
+
274
+ if (typeof a.equals === 'function' || typeof b.equals === 'function') {
275
+ return typeof a.equals === 'function' && a.equals(b) && typeof b.equals === 'function' && b.equals(a);
276
+ }
277
+
278
+ switch (typeA) {
279
+ case 'Arguments':
280
+ case 'Array':
281
+ case 'Object':
282
+ if (typeof a.constructor === 'function' && _functionName(a.constructor) === 'Promise') {
283
+ return a === b;
284
+ }
285
+
286
+ break;
287
+
288
+ case 'Boolean':
289
+ case 'Number':
290
+ case 'String':
291
+ if (!(typeof a === typeof b && _objectIs$1(a.valueOf(), b.valueOf()))) {
292
+ return false;
293
+ }
294
+
295
+ break;
296
+
297
+ case 'Date':
298
+ if (!_objectIs$1(a.valueOf(), b.valueOf())) {
299
+ return false;
300
+ }
301
+
302
+ break;
303
+
304
+ case 'Error':
305
+ return a.name === b.name && a.message === b.message;
306
+
307
+ case 'RegExp':
308
+ if (!(a.source === b.source && a.global === b.global && a.ignoreCase === b.ignoreCase && a.multiline === b.multiline && a.sticky === b.sticky && a.unicode === b.unicode)) {
309
+ return false;
310
+ }
311
+
312
+ break;
313
+ }
314
+
315
+ var idx = stackA.length - 1;
316
+
317
+ while (idx >= 0) {
318
+ if (stackA[idx] === a) {
319
+ return stackB[idx] === b;
320
+ }
321
+
322
+ idx -= 1;
323
+ }
324
+
325
+ switch (typeA) {
326
+ case 'Map':
327
+ if (a.size !== b.size) {
328
+ return false;
329
+ }
330
+
331
+ return _uniqContentEquals(a.entries(), b.entries(), stackA.concat([a]), stackB.concat([b]));
332
+
333
+ case 'Set':
334
+ if (a.size !== b.size) {
335
+ return false;
336
+ }
337
+
338
+ return _uniqContentEquals(a.values(), b.values(), stackA.concat([a]), stackB.concat([b]));
339
+
340
+ case 'Arguments':
341
+ case 'Array':
342
+ case 'Object':
343
+ case 'Boolean':
344
+ case 'Number':
345
+ case 'String':
346
+ case 'Date':
347
+ case 'Error':
348
+ case 'RegExp':
349
+ case 'Int8Array':
350
+ case 'Uint8Array':
351
+ case 'Uint8ClampedArray':
352
+ case 'Int16Array':
353
+ case 'Uint16Array':
354
+ case 'Int32Array':
355
+ case 'Uint32Array':
356
+ case 'Float32Array':
357
+ case 'Float64Array':
358
+ case 'ArrayBuffer':
359
+ break;
360
+
361
+ default:
362
+ // Values of other types are only equal if identical.
363
+ return false;
364
+ }
365
+
366
+ var keysA = keys(a);
367
+
368
+ if (keysA.length !== keys(b).length) {
369
+ return false;
370
+ }
371
+
372
+ var extendedStackA = stackA.concat([a]);
373
+ var extendedStackB = stackB.concat([b]);
374
+ idx = keysA.length - 1;
375
+
376
+ while (idx >= 0) {
377
+ var key = keysA[idx];
378
+
379
+ if (!(_has._has(key, b) && _equals(b[key], a[key], extendedStackA, extendedStackB))) {
380
+ return false;
381
+ }
382
+
383
+ idx -= 1;
384
+ }
385
+
386
+ return true;
387
+ }
388
+
389
+ /**
390
+ * Returns `true` if its arguments are equivalent, `false` otherwise. Handles
391
+ * cyclical data structures.
392
+ *
393
+ * Dispatches symmetrically to the `equals` methods of both arguments, if
394
+ * present.
395
+ *
396
+ * @func
397
+ * @memberOf R
398
+ * @since v0.15.0
399
+ * @category Relation
400
+ * @sig a -> b -> Boolean
401
+ * @param {*} a
402
+ * @param {*} b
403
+ * @return {Boolean}
404
+ * @example
405
+ *
406
+ * R.equals(1, 1); //=> true
407
+ * R.equals(1, '1'); //=> false
408
+ * R.equals([1, 2, 3], [1, 2, 3]); //=> true
409
+ *
410
+ * const a = {}; a.v = a;
411
+ * const b = {}; b.v = b;
412
+ * R.equals(a, b); //=> true
413
+ */
414
+
415
+ var equals =
416
+ /*#__PURE__*/
417
+ _has._curry2(function equals(a, b) {
418
+ return _equals(a, b, [], []);
419
+ });
420
+
421
+ function _isObject(x) {
422
+ return Object.prototype.toString.call(x) === '[object Object]';
423
+ }
424
+
425
+ /**
426
+ * Tests whether or not an object is a typed array.
427
+ *
428
+ * @private
429
+ * @param {*} val The object to test.
430
+ * @return {Boolean} `true` if `val` is a typed array, `false` otherwise.
431
+ * @example
432
+ *
433
+ * _isTypedArray(new Uint8Array([])); //=> true
434
+ * _isTypedArray(new Float32Array([])); //=> true
435
+ * _isTypedArray([]); //=> false
436
+ * _isTypedArray(null); //=> false
437
+ * _isTypedArray({}); //=> false
438
+ */
439
+ function _isTypedArray(val) {
440
+ var type = Object.prototype.toString.call(val);
441
+ return type === '[object Uint8ClampedArray]' || type === '[object Int8Array]' || type === '[object Uint8Array]' || type === '[object Int16Array]' || type === '[object Uint16Array]' || type === '[object Int32Array]' || type === '[object Uint32Array]' || type === '[object Float32Array]' || type === '[object Float64Array]' || type === '[object BigInt64Array]' || type === '[object BigUint64Array]';
442
+ }
443
+
444
+ /**
445
+ * Returns the empty value of its argument's type. Ramda defines the empty
446
+ * value of Array (`[]`), Object (`{}`), String (`''`),
447
+ * TypedArray (`Uint8Array []`, `Float32Array []`, etc), and Arguments. Other
448
+ * types are supported if they define `<Type>.empty`,
449
+ * `<Type>.prototype.empty` or implement the
450
+ * [FantasyLand Monoid spec](https://github.com/fantasyland/fantasy-land#monoid).
451
+ *
452
+ * Dispatches to the `empty` method of the first argument, if present.
453
+ *
454
+ * @func
455
+ * @memberOf R
456
+ * @since v0.3.0
457
+ * @category Function
458
+ * @sig a -> a
459
+ * @param {*} x
460
+ * @return {*}
461
+ * @example
462
+ *
463
+ * R.empty(Just(42)); //=> Nothing()
464
+ * R.empty([1, 2, 3]); //=> []
465
+ * R.empty('unicorns'); //=> ''
466
+ * R.empty({x: 1, y: 2}); //=> {}
467
+ * R.empty(Uint8Array.from('123')); //=> Uint8Array []
468
+ */
469
+
470
+ var empty =
471
+ /*#__PURE__*/
472
+ _has._curry1(function empty(x) {
473
+ return x != null && typeof x['fantasy-land/empty'] === 'function' ? x['fantasy-land/empty']() : x != null && x.constructor != null && typeof x.constructor['fantasy-land/empty'] === 'function' ? x.constructor['fantasy-land/empty']() : x != null && typeof x.empty === 'function' ? x.empty() : x != null && x.constructor != null && typeof x.constructor.empty === 'function' ? x.constructor.empty() : _isArray(x) ? [] : _isString(x) ? '' : _isObject(x) ? {} : _isArguments(x) ? function () {
474
+ return arguments;
475
+ }() : _isTypedArray(x) ? x.constructor.from('') : void 0 // else
476
+ ;
477
+ });
478
+
479
+ /**
480
+ * Returns `true` if the given value is its type's empty value; `false`
481
+ * otherwise.
482
+ *
483
+ * @func
484
+ * @memberOf R
485
+ * @since v0.1.0
486
+ * @category Logic
487
+ * @sig a -> Boolean
488
+ * @param {*} x
489
+ * @return {Boolean}
490
+ * @see R.empty
491
+ * @example
492
+ *
493
+ * R.isEmpty([1, 2, 3]); //=> false
494
+ * R.isEmpty([]); //=> true
495
+ * R.isEmpty(''); //=> true
496
+ * R.isEmpty(null); //=> false
497
+ * R.isEmpty({}); //=> true
498
+ * R.isEmpty({length: 0}); //=> false
499
+ * R.isEmpty(Uint8Array.from('')); //=> true
500
+ */
501
+
502
+ var isEmpty =
503
+ /*#__PURE__*/
504
+ _has._curry1(function isEmpty(x) {
505
+ return x != null && equals(x, empty(x));
506
+ });
507
+
508
+ const isEmpty$1 = isEmpty;
509
+
510
+ const styles = "ol{padding:0;margin:0;list-style:none}[role=grid i]{position:relative;z-index:0;display:grid;margin:auto;grid-template-areas:\". column-headers\" \"row-headers calendar\";grid-template-columns:min-content auto;inline-size:max(100%,500px);min-inline-size:880px}.row-headers{display:grid;grid-area:row-headers;grid-template-rows:repeat(24,1fr);margin-inline-end:2px}.row-headers>[role=rowheader i]{display:flex;align-items:flex-end;justify-content:flex-end}.row-headers>[role=rowheader i]>time{font:var(--vvd-typography-base-condensed);font-size:small;line-height:1;text-transform:uppercase;white-space:nowrap}.calendar-row{display:contents}.calendar-grid-presentation{display:grid;overflow:hidden;background:var(--vvd-color-surface-2dp);border-radius:8px;counter-reset:listing;filter:var(--vvd-shadow-surface-2dp);gap:1px;grid-area:calendar;grid-auto-flow:column;grid-template:repeat(24,1fr)/repeat(7,1fr)}.hours{display:contents}.hours>[role=listitem i]{position:relative;grid-column:1/8;grid-row:var(--row);min-block-size:calc(1px*(48 + 4*clamp(-1,var(--vvd-size-density, 0),2)));pointer-events:none}.hours>[role=listitem i]:not(:first-child):after{position:absolute;border-block-end:var(--vvd-color-neutral-100) 1px solid;content:\"\";inline-size:100%;margin-block-start:-1px}.hours>[role=listitem i]:nth-child(24n+1){--row: 1}.hours>[role=listitem i]:nth-child(24n+2){--row: 2}.hours>[role=listitem i]:nth-child(24n+3){--row: 3}.hours>[role=listitem i]:nth-child(24n+4){--row: 4}.hours>[role=listitem i]:nth-child(24n+5){--row: 5}.hours>[role=listitem i]:nth-child(24n+6){--row: 6}.hours>[role=listitem i]:nth-child(24n+7){--row: 7}.hours>[role=listitem i]:nth-child(24n+8){--row: 8}.hours>[role=listitem i]:nth-child(24n+9){--row: 9}.hours>[role=listitem i]:nth-child(24n+10){--row: 10}.hours>[role=listitem i]:nth-child(24n+11){--row: 11}.hours>[role=listitem i]:nth-child(24n+12){--row: 12}.hours>[role=listitem i]:nth-child(24n+13){--row: 13}.hours>[role=listitem i]:nth-child(24n+14){--row: 14}.hours>[role=listitem i]:nth-child(24n+15){--row: 15}.hours>[role=listitem i]:nth-child(24n+16){--row: 16}.hours>[role=listitem i]:nth-child(24n+17){--row: 17}.hours>[role=listitem i]:nth-child(24n+18){--row: 18}.hours>[role=listitem i]:nth-child(24n+19){--row: 19}.hours>[role=listitem i]:nth-child(24n+20){--row: 20}.hours>[role=listitem i]:nth-child(24n+21){--row: 21}.hours>[role=listitem i]:nth-child(24n+22){--row: 22}.hours>[role=listitem i]:nth-child(24n+23){--row: 23}.hours>[role=listitem i]:nth-child(24n+24){--row: 24}[role=gridcell i]{display:grid;gap:1px;grid-auto-flow:column}[role=gridcell i],[role=columnheader i],[role=columnheader i] [role=button i]{position:relative}[role=gridcell i]:before,[role=columnheader i]:before,[role=columnheader i] [role=button i]:before{position:absolute;z-index:-1;background-color:var(--vvd-color-information-400);content:\"\"}@supports (inset: 0){[role=gridcell i]:before,[role=columnheader i]:before,[role=columnheader i] [role=button i]:before{inset:0}}@supports not (inset: 0){[role=gridcell i]:before,[role=columnheader i]:before,[role=columnheader i] [role=button i]:before{inset:0}}[role=gridcell i]:focus,[role=columnheader i]:focus,[role=columnheader i] [role=button i]:focus{outline:none}[role=gridcell i]:not(:focus-visible):before,[role=columnheader i]:not(:focus-visible):before,[role=columnheader i] [role=button i]:not(:focus-visible):before{display:none}.columns{display:contents}.columns>[role=gridcell i]{position:relative;grid-column:var(--column);grid-row:1/25}.columns>[role=gridcell i]:nth-child(1){--column: 1}.columns>[role=gridcell i]:nth-child(2){--column: 2}.columns>[role=gridcell i]:nth-child(3){--column: 3}.columns>[role=gridcell i]:nth-child(4){--column: 4}.columns>[role=gridcell i]:nth-child(5){--column: 5}.columns>[role=gridcell i]:nth-child(6){--column: 6}.columns>[role=gridcell i]:nth-child(7){--column: 7}.columns>[role=gridcell i]:not(:first-child):after{position:absolute;block-size:100%;border-inline-end:var(--vvd-color-neutral-100) 1px solid;content:\"\";margin-inline-start:-1px}.column-headers{display:grid;grid-area:column-headers;grid-template-columns:repeat(7,1fr)}.column-headers [role=columnheader i] h2{display:grid;align-items:baseline;margin:0;font:var(--vvd-typography-heading-4);grid-template-columns:1fr auto 1fr}.column-headers [role=columnheader i] h2>em{font:inherit;inline-size:min-content}@supports (inset: 0){.column-headers [role=columnheader i] h2>em{inset-inline-start:0}}@supports not (inset: 0){.column-headers [role=columnheader i] h2>em{left:0}}.column-headers [role=columnheader i] h2>small{font:var(--vvd-typography-base-condensed);text-transform:uppercase}\n";
511
+
512
+ const ARROW_UP = "ArrowUp";
513
+ const ARROW_RIGHT = "ArrowRight";
514
+ const ARROW_DOWN = "ArrowDown";
515
+ const ARROW_LEFT = "ArrowLeft";
516
+ function isCellOrHeader(el) {
517
+ return el instanceof HTMLElement && (el.matches('[role="gridcell"i]') || el.matches('[role="columnheader"i]'));
518
+ }
519
+ const getCellOrHeader = (f) => f.matches('[role="columnheader"i]') ? '[role="gridcell"i]' : '[role="columnheader"i]';
520
+ function getNextFocusableGridElement(key, activeElement) {
521
+ if (activeElement.parentNode instanceof HTMLElement) {
522
+ switch (key) {
523
+ case ARROW_RIGHT:
524
+ return activeElement.nextElementSibling || activeElement.parentNode.firstElementChild;
525
+ case ARROW_LEFT:
526
+ return activeElement.previousElementSibling || activeElement.parentNode.lastElementChild;
527
+ case ARROW_UP:
528
+ case ARROW_DOWN: {
529
+ const { children } = activeElement.parentNode;
530
+ const i = Array.from(children).indexOf(activeElement);
531
+ return this.shadowRoot.querySelector(
532
+ `${getCellOrHeader(activeElement)}:nth-child(${i + 1})`
533
+ );
534
+ }
535
+ }
536
+ }
537
+ }
538
+ function getHeaderDescendantGridCell(key, activeElement) {
539
+ if (key !== ARROW_DOWN) {
540
+ return;
541
+ }
542
+ const header = activeElement.closest('[role="columnheader"i]');
543
+ const columnHeaders = this.shadowRoot.querySelectorAll('[role="columnheader"i]');
544
+ const i = Array.from(columnHeaders).indexOf(header);
545
+ return this.shadowRoot.querySelector(`[role="gridcell"i]:nth-child(${i + 1})`);
546
+ }
547
+
548
+ function getDay(el) {
549
+ const cellOrHeader = el.closest('[role="gridcell"i], [role="columnheader"i]');
550
+ if (cellOrHeader) {
551
+ const { parentElement } = cellOrHeader;
552
+ if (parentElement) {
553
+ return parentElement.children && Array.from(parentElement.children).indexOf(cellOrHeader);
554
+ }
555
+ }
556
+ }
557
+ function getHour(e, el, hours) {
558
+ const rowHeaderOrCell = el.closest('[role="rowheader"], [role="gridcell"i]');
559
+ if (rowHeaderOrCell) {
560
+ const DOMRect = rowHeaderOrCell.getBoundingClientRect();
561
+ const offsetY = e.clientY - DOMRect.y;
562
+ const hourHeight = DOMRect.height / hours;
563
+ const hour = offsetY / hourHeight;
564
+ return Math.round((hour + Number.EPSILON) * 100) / 100;
565
+ }
566
+ }
567
+ const getEventContext = function(e) {
568
+ if (!(e instanceof KeyboardEvent || e instanceof MouseEvent)) {
569
+ throw new Error("Invalid event. Event must be instance of KeyboardEvent or MouseEvent");
570
+ }
571
+ const [el] = e.composedPath();
572
+ if (!(el && el instanceof HTMLElement && this.shadowRoot.contains(el))) {
573
+ throw new Error("Invalid event. Event must contain a target object which is a direct descendant of calendar");
574
+ }
575
+ const day = getDay(el);
576
+ let hour;
577
+ if (e instanceof MouseEvent) {
578
+ hour = getHour(e, el, this._hours);
579
+ }
580
+ const context = {
581
+ ...day != void 0 && { day },
582
+ ...hour != void 0 && { hour }
583
+ };
584
+ return not$1(isEmpty$1(context)) ? context : null;
585
+ };
586
+
587
+ var __defProp = Object.defineProperty;
588
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
589
+ var __decorateClass = (decorators, target, key, kind) => {
590
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
591
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
592
+ if (decorator = decorators[i])
593
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
594
+ if (kind && result)
595
+ __defProp(target, key, result);
596
+ return result;
597
+ };
598
+ class Calendar extends index.FoundationElement {
599
+ constructor() {
600
+ super(...arguments);
601
+ this.hour12 = false;
602
+ /**
603
+ * @internal
604
+ */
605
+ this._hours = 24;
606
+ /**
607
+ * @internal
608
+ */
609
+ this._days = 7;
610
+ /**
611
+ * @internal
612
+ */
613
+ this.hoursAsDatetime = Array.from({ length: this._hours - 1 }).fill(new Date((/* @__PURE__ */ new Date()).setHours(0, 0, 0))).map((d, i) => new Date(d.setHours(++i)));
614
+ /**
615
+ * @param dateArr - array of dates. requires at least 1 date to be set within the array
616
+ * @returns array of incremental dates from the first date in the array
617
+ * @internal
618
+ */
619
+ this._generateDaysArr = (dateArr) => {
620
+ if (dateArr.length == this._days) {
621
+ return dateArr;
622
+ }
623
+ const lastDate = new Date(dateArr[dateArr.length - 1]);
624
+ lastDate.setDate(lastDate.getDate() + 1);
625
+ return this._generateDaysArr([...dateArr, lastDate]);
626
+ };
627
+ /**
628
+ * Fire an event
629
+ *
630
+ * @param calendarEvent - event name
631
+ * @returns boolean - return true
632
+ */
633
+ this.getEventContext = getEventContext;
634
+ }
635
+ get #activeCalendarEvent() {
636
+ const { activeElement } = document;
637
+ return activeElement instanceof calendarEvent.CalendarEvent ? activeElement : null;
638
+ }
639
+ getCalendarEventContainingCell(calendarEvent) {
640
+ const slotName = calendarEvent.getAttribute("slot");
641
+ const gridCell = this.shadowRoot.querySelector(`slot[name="${slotName}"i]`);
642
+ return gridCell.parentElement;
643
+ }
644
+ arrowKeysInteractions(key) {
645
+ const { activeElement } = this.shadowRoot;
646
+ let focusNext;
647
+ if (isCellOrHeader(activeElement)) {
648
+ focusNext = getNextFocusableGridElement.call(this, key, activeElement);
649
+ } else if (this.#activeCalendarEvent) {
650
+ focusNext = this.getCalendarEventContainingCell(this.#activeCalendarEvent);
651
+ } else if (activeElement?.matches('em[role="button"i]')) {
652
+ focusNext = getHeaderDescendantGridCell.call(this, key, activeElement);
653
+ } else {
654
+ focusNext = this.shadowRoot.querySelector('[role="columnheader"i]');
655
+ }
656
+ this.activateElement(focusNext);
657
+ }
658
+ activateElement(el) {
659
+ const onBlur = ({ target }) => target.setAttribute("tabindex", "-1");
660
+ el?.addEventListener("blur", onBlur, { once: true });
661
+ el?.setAttribute("tabindex", "0");
662
+ el?.focus();
663
+ }
664
+ onKeydown({ key }) {
665
+ const isArrow = [ARROW_UP, ARROW_RIGHT, ARROW_DOWN, ARROW_LEFT].some((predefinedKey) => predefinedKey == key);
666
+ if (isArrow) {
667
+ this.arrowKeysInteractions(key);
668
+ }
669
+ return !isArrow;
670
+ }
671
+ }
672
+ __decorateClass([
673
+ index.attr
674
+ ], Calendar.prototype, "datetime", 2);
675
+ __decorateClass([
676
+ index.attr({ attribute: "start-day" })
677
+ ], Calendar.prototype, "startDay", 2);
678
+ __decorateClass([
679
+ index.attr
680
+ ], Calendar.prototype, "locales", 2);
681
+ __decorateClass([
682
+ index.attr({ mode: "boolean" })
683
+ ], Calendar.prototype, "hour12", 2);
684
+
685
+ function getValidDateString(date) {
686
+ const twoDigit = (num) => `0${num}`.slice(-2);
687
+ return `${date.getFullYear()}-${twoDigit(date.getMonth() + 1)}-${twoDigit(date.getDate())}`;
688
+ }
689
+ const weekdaysMap = /* @__PURE__ */ new Map([
690
+ ["sunday", 0],
691
+ ["monday", 1]
692
+ ]);
693
+ function getFirstDateOfTheWeek(date = /* @__PURE__ */ new Date(), startDay) {
694
+ date = new Date(date);
695
+ let num = weekdaysMap.get(startDay);
696
+ num ??= 1;
697
+ const day = date.getDate() - (date.getDay() + 7 - num) % 7;
698
+ return new Date(date.setDate(day));
699
+ }
700
+
701
+ const HoursTemplate = () => {
702
+ return index.html`
703
+ <div class="row-headers" role="row">
704
+ ${repeat.repeat((x) => x.hoursAsDatetime, index.html`<span role="rowheader">
705
+ <time datetime="${(x, c) => new Intl.DateTimeFormat(c.parent.locales, {
706
+ hour: "numeric",
707
+ minute: "numeric",
708
+ hour12: false
709
+ }).format(x)}">
710
+ ${(x, c) => new Intl.DateTimeFormat(c.parent.locales, {
711
+ hour: "numeric",
712
+ hour12: c.parent.hour12
713
+ }).format(x)}
714
+ </time>
715
+ </span>`)}
716
+ </div>`;
717
+ };
718
+ const DaysTemplate = () => {
719
+ return index.html`
720
+ <div class="column-headers" role="row">
721
+ ${repeat.repeat((x) => x._generateDaysArr([getFirstDateOfTheWeek(x.datetime, x.startDay)]), index.html`
722
+ <div role="columnheader" tabindex="-1">
723
+ <time datetime=${(x) => getValidDateString(x)}>
724
+ <h2>
725
+ <!-- TODO add to column aria-labelledby or describedby to count
726
+ events and related day e.g. "3 events, Sunday, March 8" -->
727
+ <em tabindex="0" role="button" aria-label=${(x, c) => new Intl.DateTimeFormat(c.parent.locales, {
728
+ weekday: "long",
729
+ month: "long",
730
+ day: "2-digit"
731
+ }).format(x)}>
732
+ ${(x, c) => new Intl.DateTimeFormat(c.parent.locales, { day: "2-digit" }).format(x)}
733
+ </em>
734
+ <small aria-hidden="true">
735
+ ${(x, c) => new Intl.DateTimeFormat(c.parent.locales, { weekday: "short" }).format(x)}
736
+ </small>
737
+ </h2>
738
+ </time>
739
+ </div>`)}
740
+ </div>`;
741
+ };
742
+ const ColumnTemplate = index.html`
743
+ <div role="gridcell" tabindex="-1">
744
+ <slot name="day-${(_, c) => c.index}"></slot>
745
+ </div>
746
+ `;
747
+ const CalendarTemplate = () => index.html`
748
+ <div role="grid" @keydown=${(x, c) => x.onKeydown(c.event)}>
749
+ ${DaysTemplate}
750
+ <div class="calendar-row" role="rowgroup">
751
+ ${HoursTemplate}
752
+ <div class="calendar-grid-presentation" role="presentation">
753
+ <div class="hours" role="list">
754
+ ${repeat.repeat((x) => Array.from({ length: x.hoursAsDatetime.length + 1 }), index.html`
755
+ <div role="listitem"></div>`)}
756
+ </div>
757
+ <div class="columns" role="row">
758
+ ${repeat.repeat((x) => Array.from(Array(x._days)), ColumnTemplate, { positioning: true })}
759
+ </div>
760
+ <slot></slot>
761
+ </div>
762
+ </div>
763
+ </div>
764
+ `;
765
+
766
+ const calendarDefinition = Calendar.compose({
767
+ baseName: "calendar",
768
+ template: CalendarTemplate,
769
+ styles,
770
+ shadowOptions: {
771
+ delegatesFocus: true
772
+ }
773
+ });
774
+ const calendarRegistries = [calendarDefinition()];
775
+ const registerCalendar = index.registerFactory(calendarRegistries);
776
+
777
+ exports.calendarDefinition = calendarDefinition;
778
+ exports.calendarRegistries = calendarRegistries;
779
+ exports.registerCalendar = registerCalendar;