@watermarkinsights/ripple 3.6.0 → 3.7.0-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.
Files changed (180) hide show
  1. package/README.md +3 -3
  2. package/dist/cjs/{functions-068b9a56.js → functions-f0693632.js} +708 -442
  3. package/dist/cjs/{global-51e309da.js → global-86d92ce3.js} +65 -65
  4. package/dist/cjs/{http-service-9e8c4dd5.js → http-service-494d81de.js} +49 -49
  5. package/dist/cjs/{interfaces-30a74c1f.js → interfaces-a3338581.js} +29 -29
  6. package/dist/cjs/loader.cjs.js +1 -1
  7. package/dist/cjs/priv-chart-popover.cjs.entry.js +78 -78
  8. package/dist/cjs/priv-datepicker.cjs.entry.js +667 -667
  9. package/dist/cjs/priv-navigator-button.cjs.entry.js +18 -18
  10. package/dist/cjs/priv-navigator-item.cjs.entry.js +23 -23
  11. package/dist/cjs/ripple.cjs.js +1 -1
  12. package/dist/cjs/wm-action-menu_2.cjs.entry.js +341 -341
  13. package/dist/cjs/wm-button.cjs.entry.js +237 -219
  14. package/dist/cjs/wm-chart-slice.cjs.entry.js +13 -13
  15. package/dist/cjs/wm-chart.cjs.entry.js +474 -474
  16. package/dist/cjs/wm-datepicker.cjs.entry.js +262 -256
  17. package/dist/cjs/wm-input.cjs.entry.js +134 -134
  18. package/dist/cjs/wm-modal-footer.cjs.entry.js +31 -31
  19. package/dist/cjs/wm-modal-header.cjs.entry.js +34 -34
  20. package/dist/cjs/wm-modal.cjs.entry.js +161 -161
  21. package/dist/cjs/wm-navigator.cjs.entry.js +268 -268
  22. package/dist/cjs/wm-network-uploader.cjs.entry.js +421 -421
  23. package/dist/cjs/wm-option_2.cjs.entry.js +494 -494
  24. package/dist/cjs/wm-pagination.cjs.entry.js +167 -167
  25. package/dist/cjs/wm-search.cjs.entry.js +231 -231
  26. package/dist/cjs/wm-snackbar.cjs.entry.js +170 -170
  27. package/dist/cjs/wm-tab-item_3.cjs.entry.js +296 -300
  28. package/dist/cjs/wm-tag-input.cjs.entry.js +570 -570
  29. package/dist/cjs/wm-timepicker.cjs.entry.js +380 -380
  30. package/dist/cjs/wm-toggletip.cjs.entry.js +124 -124
  31. package/dist/cjs/wm-uploader.cjs.entry.js +347 -347
  32. package/dist/cjs/wm-wrapper.cjs.entry.js +12 -12
  33. package/dist/collection/components/wm-action-menu/wm-action-menu.js +460 -460
  34. package/dist/collection/components/wm-button/wm-button.css +37 -4
  35. package/dist/collection/components/wm-button/wm-button.js +503 -485
  36. package/dist/collection/components/wm-chart/priv-chart-popover/priv-chart-popover.js +232 -232
  37. package/dist/collection/components/wm-chart/wm-chart-slice.js +64 -64
  38. package/dist/collection/components/wm-chart/wm-chart.js +719 -719
  39. package/dist/collection/components/wm-datepicker/priv-datepicker/priv-datepicker.js +1015 -1015
  40. package/dist/collection/components/wm-datepicker/wm-datepicker.js +468 -462
  41. package/dist/collection/components/wm-input/wm-input.js +424 -424
  42. package/dist/collection/components/wm-menuitem/wm-menuitem.js +444 -444
  43. package/dist/collection/components/wm-modal/wm-modal-footer.js +141 -141
  44. package/dist/collection/components/wm-modal/wm-modal-header.js +92 -92
  45. package/dist/collection/components/wm-modal/wm-modal.js +459 -459
  46. package/dist/collection/components/wm-navigator/priv-navigator-button/priv-navigator-button.js +97 -97
  47. package/dist/collection/components/wm-navigator/priv-navigator-item/priv-navigator-item.js +114 -114
  48. package/dist/collection/components/wm-navigator/wm-navigator.js +468 -468
  49. package/dist/collection/components/wm-option/wm-option.js +422 -422
  50. package/dist/collection/components/wm-pagination/wm-pagination.js +368 -368
  51. package/dist/collection/components/wm-search/wm-search.js +479 -479
  52. package/dist/collection/components/wm-select/wm-select.js +720 -720
  53. package/dist/collection/components/wm-snackbar/wm-snackbar.js +297 -297
  54. package/dist/collection/components/wm-tabs/wm-tab-item/wm-tab-item.js +216 -219
  55. package/dist/collection/components/wm-tabs/wm-tab-list/wm-tab-list.js +330 -331
  56. package/dist/collection/components/wm-tabs/wm-tab-panel/wm-tab-panel.js +104 -104
  57. package/dist/collection/components/wm-tag-input/wm-tag-input.js +801 -801
  58. package/dist/collection/components/wm-timepicker/wm-timepicker.js +580 -580
  59. package/dist/collection/components/wm-toggletip/wm-toggletip.js +241 -241
  60. package/dist/collection/components/wm-uploader/wm-network-uploader/wm-network-uploader.css +37 -4
  61. package/dist/collection/components/wm-uploader/wm-network-uploader/wm-network-uploader.js +753 -753
  62. package/dist/collection/components/wm-uploader/wm-uploader.css +37 -4
  63. package/dist/collection/components/wm-uploader/wm-uploader.js +748 -748
  64. package/dist/collection/components/wm-wrapper/wm-wrapper.js +27 -27
  65. package/dist/collection/dev/scripts.js +20 -20
  66. package/dist/collection/global/__mocks__/functions.js +6 -6
  67. package/dist/collection/global/functions.js +445 -445
  68. package/dist/collection/global/global.js +72 -72
  69. package/dist/collection/global/interfaces.js +49 -49
  70. package/dist/collection/global/services/__mocks__/http-service.js +130 -130
  71. package/dist/collection/global/services/http-service.js +50 -50
  72. package/dist/collection/lang/lang.js +5 -5
  73. package/dist/collection/lang/missing.js +39 -39
  74. package/dist/collection/lang/piglatin.js +93 -93
  75. package/dist/esm/{functions-122ab496.js → functions-cbfc81d1.js} +708 -442
  76. package/dist/esm/{global-c36ac692.js → global-d2addbde.js} +65 -65
  77. package/dist/esm/{http-service-5d037e16.js → http-service-3dc3b3e7.js} +49 -49
  78. package/dist/esm/{interfaces-61c6305b.js → interfaces-2b97fab2.js} +29 -29
  79. package/dist/esm/loader.js +1 -1
  80. package/dist/esm/polyfills/core-js.js +0 -0
  81. package/dist/esm/polyfills/dom.js +0 -0
  82. package/dist/esm/polyfills/es5-html-element.js +0 -0
  83. package/dist/esm/polyfills/index.js +0 -0
  84. package/dist/esm/polyfills/system.js +0 -0
  85. package/dist/esm/priv-chart-popover.entry.js +78 -78
  86. package/dist/esm/priv-datepicker.entry.js +667 -667
  87. package/dist/esm/priv-navigator-button.entry.js +18 -18
  88. package/dist/esm/priv-navigator-item.entry.js +23 -23
  89. package/dist/esm/ripple.js +1 -1
  90. package/dist/esm/wm-action-menu_2.entry.js +341 -341
  91. package/dist/esm/wm-button.entry.js +237 -219
  92. package/dist/esm/wm-chart-slice.entry.js +13 -13
  93. package/dist/esm/wm-chart.entry.js +474 -474
  94. package/dist/esm/wm-datepicker.entry.js +262 -256
  95. package/dist/esm/wm-input.entry.js +134 -134
  96. package/dist/esm/wm-modal-footer.entry.js +31 -31
  97. package/dist/esm/wm-modal-header.entry.js +34 -34
  98. package/dist/esm/wm-modal.entry.js +161 -161
  99. package/dist/esm/wm-navigator.entry.js +268 -268
  100. package/dist/esm/wm-network-uploader.entry.js +421 -421
  101. package/dist/esm/wm-option_2.entry.js +494 -494
  102. package/dist/esm/wm-pagination.entry.js +167 -167
  103. package/dist/esm/wm-search.entry.js +231 -231
  104. package/dist/esm/wm-snackbar.entry.js +170 -170
  105. package/dist/esm/wm-tab-item_3.entry.js +296 -300
  106. package/dist/esm/wm-tag-input.entry.js +570 -570
  107. package/dist/esm/wm-timepicker.entry.js +380 -380
  108. package/dist/esm/wm-toggletip.entry.js +124 -124
  109. package/dist/esm/wm-uploader.entry.js +347 -347
  110. package/dist/esm/wm-wrapper.entry.js +12 -12
  111. package/dist/ripple/{p-9a8fbfad.entry.js → p-0c488d9d.entry.js} +1 -1
  112. package/dist/ripple/{p-54c39a0b.entry.js → p-111f705a.entry.js} +1 -1
  113. package/dist/ripple/{p-e36853fd.entry.js → p-266e4bc2.entry.js} +1 -1
  114. package/dist/ripple/p-2caeca6b.entry.js +1 -0
  115. package/dist/ripple/{p-ecbb441f.entry.js → p-30f13477.entry.js} +1 -1
  116. package/dist/ripple/{p-888bec42.js → p-43f1298b.js} +0 -0
  117. package/dist/ripple/p-4414cb64.entry.js +1 -0
  118. package/dist/ripple/p-5585f23e.entry.js +1 -0
  119. package/dist/ripple/p-7d9c18b9.entry.js +1 -0
  120. package/dist/ripple/{p-a61b07de.entry.js → p-8a4bac13.entry.js} +1 -1
  121. package/dist/ripple/{p-4b72f4eb.entry.js → p-938a5ba4.entry.js} +1 -1
  122. package/dist/ripple/{p-2b3f75eb.entry.js → p-9d6e4c64.entry.js} +1 -1
  123. package/dist/ripple/{p-97884327.entry.js → p-ad73d523.entry.js} +1 -1
  124. package/dist/ripple/{p-08e67884.js → p-b5edcf38.js} +2 -2
  125. package/dist/ripple/{p-067909ce.entry.js → p-b9656d44.entry.js} +1 -1
  126. package/dist/ripple/{p-2aa79663.entry.js → p-bd05632b.entry.js} +1 -1
  127. package/dist/ripple/{p-f6bed262.entry.js → p-c0b0510a.entry.js} +1 -1
  128. package/dist/ripple/{p-1c23f228.entry.js → p-cd466a5b.entry.js} +1 -1
  129. package/dist/ripple/p-d9c7e3d6.js +1 -0
  130. package/dist/ripple/p-da1435f1.entry.js +1 -0
  131. package/dist/ripple/p-e3765b8e.entry.js +1 -0
  132. package/dist/ripple/{p-a2b02aec.entry.js → p-f33f3f20.entry.js} +1 -1
  133. package/dist/ripple/{p-803b19aa.entry.js → p-f3569e91.entry.js} +1 -1
  134. package/dist/ripple/{p-a6d6eae7.js → p-fd8070fb.js} +0 -0
  135. package/dist/ripple/ripple.esm.js +1 -1
  136. package/dist/types/components/wm-action-menu/wm-action-menu.d.ts +48 -48
  137. package/dist/types/components/wm-button/wm-button.d.ts +44 -44
  138. package/dist/types/components/wm-chart/priv-chart-popover/priv-chart-popover.d.ts +23 -23
  139. package/dist/types/components/wm-chart/wm-chart-slice.d.ts +8 -8
  140. package/dist/types/components/wm-chart/wm-chart.d.ts +82 -82
  141. package/dist/types/components/wm-datepicker/priv-datepicker/priv-datepicker.d.ts +76 -76
  142. package/dist/types/components/wm-datepicker/wm-datepicker.d.ts +41 -41
  143. package/dist/types/components/wm-input/wm-input.d.ts +46 -46
  144. package/dist/types/components/wm-menuitem/wm-menuitem.d.ts +34 -34
  145. package/dist/types/components/wm-modal/wm-modal-footer.d.ts +15 -15
  146. package/dist/types/components/wm-modal/wm-modal-header.d.ts +12 -12
  147. package/dist/types/components/wm-modal/wm-modal.d.ts +41 -41
  148. package/dist/types/components/wm-navigator/priv-navigator-button/priv-navigator-button.d.ts +10 -10
  149. package/dist/types/components/wm-navigator/priv-navigator-item/priv-navigator-item.d.ts +13 -13
  150. package/dist/types/components/wm-navigator/wm-navigator.d.ts +61 -61
  151. package/dist/types/components/wm-option/wm-option.d.ts +32 -32
  152. package/dist/types/components/wm-pagination/wm-pagination.d.ts +32 -32
  153. package/dist/types/components/wm-search/wm-search.d.ts +86 -86
  154. package/dist/types/components/wm-select/wm-select.d.ts +66 -66
  155. package/dist/types/components/wm-snackbar/wm-snackbar.d.ts +35 -35
  156. package/dist/types/components/wm-tabs/wm-tab-item/wm-tab-item.d.ts +38 -38
  157. package/dist/types/components/wm-tabs/wm-tab-list/wm-tab-list.d.ts +53 -53
  158. package/dist/types/components/wm-tabs/wm-tab-panel/wm-tab-panel.d.ts +20 -20
  159. package/dist/types/components/wm-tag-input/wm-tag-input.d.ts +92 -92
  160. package/dist/types/components/wm-timepicker/wm-timepicker.d.ts +61 -61
  161. package/dist/types/components/wm-toggletip/wm-toggletip.d.ts +27 -27
  162. package/dist/types/components/wm-uploader/wm-network-uploader/wm-network-uploader.d.ts +85 -85
  163. package/dist/types/components/wm-uploader/wm-uploader.d.ts +80 -80
  164. package/dist/types/components/wm-wrapper/wm-wrapper.d.ts +7 -7
  165. package/dist/types/components.d.ts +24 -24
  166. package/dist/types/global/__mocks__/functions.d.ts +6 -6
  167. package/dist/types/global/functions.d.ts +40 -40
  168. package/dist/types/global/global.d.ts +1 -1
  169. package/dist/types/global/interfaces.d.ts +34 -34
  170. package/dist/types/global/services/__mocks__/http-service.d.ts +6 -6
  171. package/dist/types/global/services/http-service.d.ts +4 -4
  172. package/dist/types/lang/lang.d.ts +5 -5
  173. package/package.json +47 -47
  174. package/dist/ripple/p-3ff67fd5.entry.js +0 -1
  175. package/dist/ripple/p-4629470d.entry.js +0 -1
  176. package/dist/ripple/p-4b1f14bb.entry.js +0 -1
  177. package/dist/ripple/p-7da00f33.entry.js +0 -1
  178. package/dist/ripple/p-888c18c3.entry.js +0 -1
  179. package/dist/ripple/p-8c93b893.js +0 -1
  180. package/dist/ripple/p-f95c2283.entry.js +0 -1
@@ -1978,6 +1978,12 @@ const es = {
1978
1978
  type: 0,
1979
1979
  value: "Octubre"
1980
1980
  }
1981
+ ],
1982
+ "date.requiredDateError": [
1983
+ {
1984
+ type: 0,
1985
+ value: "La fecha se require."
1986
+ }
1981
1987
  ],
1982
1988
  "date.sa": [
1983
1989
  {
@@ -2086,12 +2092,61 @@ const es = {
2086
2092
  type: 0,
2087
2093
  value: "Miércoles"
2088
2094
  }
2095
+ ],
2096
+ "global.characterLimit": [
2097
+ {
2098
+ style: null,
2099
+ type: 2,
2100
+ value: "limit"
2101
+ },
2102
+ {
2103
+ type: 0,
2104
+ value: " caracteres permitido."
2105
+ }
2106
+ ],
2107
+ "global.characterLimitReached": [
2108
+ {
2109
+ type: 0,
2110
+ value: "No se grabaran caracteres adicionales."
2111
+ }
2112
+ ],
2113
+ "global.charactersEntered": [
2114
+ {
2115
+ style: null,
2116
+ type: 2,
2117
+ value: "x"
2118
+ },
2119
+ {
2120
+ type: 0,
2121
+ value: " de "
2122
+ },
2123
+ {
2124
+ style: null,
2125
+ type: 2,
2126
+ value: "y"
2127
+ },
2128
+ {
2129
+ type: 0,
2130
+ value: " caracteres ingresados."
2131
+ }
2132
+ ],
2133
+ "global.closeVerb": [
2134
+ {
2135
+ type: 0,
2136
+ value: "Cerrar"
2137
+ }
2089
2138
  ],
2090
2139
  "global.genericError": [
2091
2140
  {
2092
2141
  type: 0,
2093
2142
  value: "Se produjo un error. Vuelva a intentarlo."
2094
2143
  }
2144
+ ],
2145
+ "global.newWindowLink": [
2146
+ {
2147
+ type: 0,
2148
+ value: "Se abre en una nueva ventana."
2149
+ }
2095
2150
  ],
2096
2151
  "global.next": [
2097
2152
  {
@@ -2104,6 +2159,24 @@ const es = {
2104
2159
  type: 0,
2105
2160
  value: "anterior"
2106
2161
  }
2162
+ ],
2163
+ "global.requiredError": [
2164
+ {
2165
+ type: 0,
2166
+ value: "Se require este campo de ingreso."
2167
+ }
2168
+ ],
2169
+ "global.requiredField": [
2170
+ {
2171
+ type: 0,
2172
+ value: "Campo de ingreso requerido"
2173
+ }
2174
+ ],
2175
+ "input.numberError": [
2176
+ {
2177
+ type: 0,
2178
+ value: "Ingrese un numero valido por favor."
2179
+ }
2107
2180
  ],
2108
2181
  "navigator.WatermarkAppNavigation": [
2109
2182
  {
@@ -2116,6 +2189,36 @@ const es = {
2116
2189
  type: 0,
2117
2190
  value: "Cerrar sesión"
2118
2191
  }
2192
+ ],
2193
+ "navigator.userinfo": [
2194
+ {
2195
+ type: 0,
2196
+ value: "Información de Usuario"
2197
+ }
2198
+ ],
2199
+ "navigator.userinfoAndProductNavigator": [
2200
+ {
2201
+ type: 0,
2202
+ value: "Información de Usuario y Navegador de Productos"
2203
+ }
2204
+ ],
2205
+ "navigator.userinfoLabel": [
2206
+ {
2207
+ type: 0,
2208
+ value: "para "
2209
+ },
2210
+ {
2211
+ type: 1,
2212
+ value: "name"
2213
+ },
2214
+ {
2215
+ type: 0,
2216
+ value: ", email "
2217
+ },
2218
+ {
2219
+ type: 1,
2220
+ value: "email"
2221
+ }
2119
2222
  ],
2120
2223
  "navigator.watermarkApps": [
2121
2224
  {
@@ -2229,6 +2332,169 @@ const es = {
2229
2332
  type: 6,
2230
2333
  value: "numResults"
2231
2334
  }
2335
+ ],
2336
+ "select.allSelected": [
2337
+ {
2338
+ type: 0,
2339
+ value: "Todo seleccionado"
2340
+ }
2341
+ ],
2342
+ "select.multiPlaceholder": [
2343
+ {
2344
+ type: 0,
2345
+ value: "Haga una elección"
2346
+ }
2347
+ ],
2348
+ "tagInput.existingOptions": [
2349
+ {
2350
+ offset: 0,
2351
+ options: {
2352
+ one: {
2353
+ value: [
2354
+ {
2355
+ type: 0,
2356
+ value: "solo una opcion existe."
2357
+ }
2358
+ ]
2359
+ },
2360
+ other: {
2361
+ value: [
2362
+ {
2363
+ type: 7
2364
+ },
2365
+ {
2366
+ type: 0,
2367
+ value: " opciones existen."
2368
+ }
2369
+ ]
2370
+ }
2371
+ },
2372
+ pluralType: "cardinal",
2373
+ type: 6,
2374
+ value: "num"
2375
+ }
2376
+ ],
2377
+ "tagInput.helpTextCanSelect": [
2378
+ {
2379
+ type: 0,
2380
+ value: "Buscsa y selecciona una etiqueta."
2381
+ }
2382
+ ],
2383
+ "tagInput.helpTextEditable": [
2384
+ {
2385
+ type: 0,
2386
+ value: "Presione la tecla de enter o coma para agregar una nueva etiqueta."
2387
+ }
2388
+ ],
2389
+ "tagInput.maxTagsReached": [
2390
+ {
2391
+ type: 0,
2392
+ value: "Se ha alcanzado el limite máximo de etiquetas, no se pueden agregar etiquetas adicionales."
2393
+ }
2394
+ ],
2395
+ "tagInput.placeholderAdd": [
2396
+ {
2397
+ type: 0,
2398
+ value: "Agrega una nueva etiqueta"
2399
+ }
2400
+ ],
2401
+ "tagInput.placeholderAddAndSearch": [
2402
+ {
2403
+ type: 0,
2404
+ value: "Agrega o busca por una etiqueta"
2405
+ }
2406
+ ],
2407
+ "tagInput.placeholderSearch": [
2408
+ {
2409
+ type: 0,
2410
+ value: "Buscsa y selecciona una etiqueta"
2411
+ }
2412
+ ],
2413
+ "tagInput.tagAdded": [
2414
+ {
2415
+ type: 1,
2416
+ value: "tagName"
2417
+ },
2418
+ {
2419
+ type: 0,
2420
+ value: " agregada."
2421
+ }
2422
+ ],
2423
+ "tagInput.tagAlreadyAdded": [
2424
+ {
2425
+ type: 1,
2426
+ value: "tagName"
2427
+ },
2428
+ {
2429
+ type: 0,
2430
+ value: " ya ha side añadida."
2431
+ }
2432
+ ],
2433
+ "tagInput.tagAreaInstructions": [
2434
+ {
2435
+ type: 0,
2436
+ value: "Selección de etiquetas. Presione la tecla retroceso o eliminar para quitar una etiqueta."
2437
+ }
2438
+ ],
2439
+ "tagInput.tagRemoved": [
2440
+ {
2441
+ type: 1,
2442
+ value: "tag"
2443
+ },
2444
+ {
2445
+ type: 0,
2446
+ value: " quitado"
2447
+ }
2448
+ ],
2449
+ "tagInput.tagsAddedCounter": [
2450
+ {
2451
+ type: 0,
2452
+ value: "Etiquetas añadidas: "
2453
+ },
2454
+ {
2455
+ style: null,
2456
+ type: 2,
2457
+ value: "x"
2458
+ },
2459
+ {
2460
+ type: 0,
2461
+ value: "/"
2462
+ },
2463
+ {
2464
+ style: null,
2465
+ type: 2,
2466
+ value: "y"
2467
+ }
2468
+ ],
2469
+ "time.invalidTime": [
2470
+ {
2471
+ type: 0,
2472
+ value: "Ingrese un tiempo valido por favor."
2473
+ }
2474
+ ],
2475
+ "time.requiredError": [
2476
+ {
2477
+ type: 0,
2478
+ value: "Se require una hora. "
2479
+ }
2480
+ ],
2481
+ "time.selectTime": [
2482
+ {
2483
+ type: 0,
2484
+ value: "Selecciona hora"
2485
+ }
2486
+ ],
2487
+ "time.timeFormat": [
2488
+ {
2489
+ type: 0,
2490
+ value: "hh:mm"
2491
+ }
2492
+ ],
2493
+ "toggletip.moreInformation": [
2494
+ {
2495
+ type: 0,
2496
+ value: "Más información"
2497
+ }
2232
2498
  ],
2233
2499
  "uploader.duplicateName": [
2234
2500
  {
@@ -6341,448 +6607,448 @@ function createIntl(config, cache) {
6341
6607
  return __assign(__assign({}, resolvedConfig), { formatters: formatters, formatNumber: formatNumber.bind(null, resolvedConfig, formatters.getNumberFormat), formatNumberToParts: formatNumberToParts.bind(null, resolvedConfig, formatters.getNumberFormat), formatRelativeTime: formatRelativeTime.bind(null, resolvedConfig, formatters.getRelativeTimeFormat), formatDate: formatDate.bind(null, resolvedConfig, formatters.getDateTimeFormat), formatDateToParts: formatDateToParts.bind(null, resolvedConfig, formatters.getDateTimeFormat), formatTime: formatTime.bind(null, resolvedConfig, formatters.getDateTimeFormat), formatDateTimeRange: formatDateTimeRange.bind(null, resolvedConfig, formatters.getDateTimeFormat), formatTimeToParts: formatTimeToParts.bind(null, resolvedConfig, formatters.getDateTimeFormat), formatPlural: formatPlural.bind(null, resolvedConfig, formatters.getPluralRules), formatMessage: formatMessage.bind(null, resolvedConfig, formatters), formatList: formatList.bind(null, resolvedConfig, formatters.getListFormat), formatListToParts: formatListToParts.bind(null, resolvedConfig, formatters.getListFormat), formatDisplayName: formatDisplayName.bind(null, resolvedConfig, formatters.getDisplayNames) });
6342
6608
  }
6343
6609
 
6344
- const DEFAULT_LANGUAGE = "en";
6345
- function getBrowserLang() {
6346
- const langAttr = document.documentElement.getAttribute("lang");
6347
- if (!!langAttr) {
6348
- return langAttr;
6349
- }
6350
- else if (window.navigator && window.navigator.language) {
6351
- const lang = window.navigator.languages ? window.navigator.languages[0] : window.navigator.language;
6352
- return lang.slice(0, 2);
6353
- }
6354
- else {
6355
- return DEFAULT_LANGUAGE;
6356
- }
6357
- }
6358
- // prevents memory leak
6359
- const cache = createIntlCache();
6360
- const locale = getBrowserLang();
6361
- const intl = createIntl({
6362
- locale: locale,
6363
- defaultLocale: "en",
6364
- messages: lang[locale] || en,
6365
- }, cache);
6366
- function generateId() {
6367
- return "wmcl-" + Math.random().toString(36).substr(2, 10);
6368
- }
6369
- function debounce(fn, wait) {
6370
- let timeout;
6371
- return function () {
6372
- const context = this;
6373
- const functionCall = () => fn.apply(context, arguments);
6374
- clearTimeout(timeout);
6375
- timeout = setTimeout(functionCall, wait);
6376
- };
6377
- }
6378
- function getTextDir() {
6379
- const dir = document.querySelector("html").getAttribute("dir");
6380
- return dir ? dir.toLowerCase() : "";
6381
- }
6382
- function getPosition(el) {
6383
- const coords = el.getBoundingClientRect();
6384
- let x = coords.x;
6385
- let y = coords.y;
6386
- // Edge doesn't have x and y
6387
- if (!x) {
6388
- if (getTextDir() === "rtl") {
6389
- x = coords.right;
6390
- }
6391
- else {
6392
- x = coords.left;
6393
- }
6394
- y = coords.top;
6395
- }
6396
- return { x, y };
6397
- }
6398
- function findParentWithScrollbar(el) {
6399
- while (!!el) {
6400
- if (el.scrollHeight > el.clientHeight && ["scroll", "auto"].includes(window.getComputedStyle(el).overflowY)) {
6401
- return el;
6402
- }
6403
- el = el.parentElement;
6404
- }
6405
- }
6406
- function findParentWithHiddenOverflow(el) {
6407
- while (!!el) {
6408
- if (window.getComputedStyle(el).overflowY !== "visible") {
6409
- return el;
6410
- }
6411
- el = el.parentElement;
6412
- }
6413
- }
6414
- function getClosableElementMeasurements(fixedEl, closableEl) {
6415
- const parent = findParentWithHiddenOverflow(fixedEl);
6416
- // if parent is not found, measurements are checked against the viewport
6417
- return {
6418
- closableElHeight: closableEl.clientHeight,
6419
- closableElWidth: closableEl.clientWidth,
6420
- // NB boundingClientRect.bottom is space from top of viewport to bottom of el
6421
- // to get space below the el -> height of viewport minus boundingClientRect.bottom
6422
- spaceAbove: parent
6423
- ? fixedEl.getBoundingClientRect().top - parent.getBoundingClientRect().top
6424
- : fixedEl.getBoundingClientRect().top,
6425
- // NB boundingClientRect.bottom is space from top of viewport to bottom of el
6426
- // to get space below the el -> height of viewport minus boundingClientRect.bottom
6427
- spaceBelow: parent
6428
- ? parent.getBoundingClientRect().bottom - fixedEl.getBoundingClientRect().bottom
6429
- : document.documentElement.clientHeight - fixedEl.getBoundingClientRect().bottom,
6430
- spaceLeft: parent
6431
- ? fixedEl.getBoundingClientRect().left - parent.getBoundingClientRect().left
6432
- : fixedEl.getBoundingClientRect().left,
6433
- spaceRight: parent
6434
- ? parent.getBoundingClientRect().right - fixedEl.getBoundingClientRect().right
6435
- : document.documentElement.clientWidth - fixedEl.getBoundingClientRect().right,
6436
- };
6437
- }
6438
- function shouldOpenUp(fixedEl, //the element visible on the page when the component is closed
6439
- closableEl, //the dropdown/popup/etc that becomes visible when the component is open
6440
- offsetAbove = 0, // if closableEl covers a part of fixedEl, that part should be offset
6441
- offsetBelow = 0 // if closableEl covers a part of fixedEl, that part should be offset
6442
- ) {
6443
- const { closableElHeight, spaceAbove, spaceBelow } = getClosableElementMeasurements(fixedEl, closableEl);
6444
- //we want to open up only if there's not enough space below AND there is enough space above
6445
- const openUp = closableElHeight > spaceBelow + offsetBelow && closableElHeight <= spaceAbove + offsetAbove;
6446
- return openUp;
6447
- }
6448
- function shouldOpenDown(fixedEl, //the element visible on the page when the component is closed
6449
- closableEl, //the dropdown/popup/etc that becomes visible when the component is open
6450
- offsetAbove = 0, // if closableEl covers a part of fixedEl, that part should be offset
6451
- offsetBelow = 0 // if closableEl covers a part of fixedEl, that part should be offset
6452
- ) {
6453
- const { closableElHeight, spaceAbove, spaceBelow } = getClosableElementMeasurements(fixedEl, closableEl);
6454
- //we want to open up only if there's not enough space below AND there is enough space above
6455
- const openDown = closableElHeight > spaceAbove + offsetAbove && closableElHeight <= spaceBelow + offsetBelow;
6456
- return openDown;
6457
- }
6458
- function shouldShiftRight(fixedEl, closableEl) {
6459
- const { closableElWidth, spaceLeft, spaceRight } = getClosableElementMeasurements(fixedEl, closableEl);
6460
- const needsSpaceLeft = closableElWidth > spaceLeft && spaceRight > spaceLeft;
6461
- return needsSpaceLeft;
6462
- }
6463
- function shouldShiftLeft(fixedEl, closableEl) {
6464
- const { closableElWidth, spaceLeft, spaceRight } = getClosableElementMeasurements(fixedEl, closableEl);
6465
- const needsSpaceRight = closableElWidth > spaceRight && spaceLeft > spaceRight;
6466
- return needsSpaceRight;
6467
- }
6468
- function adjustTooltipPosition(tPos, el, tooltipEl) {
6469
- // position must be reset before measurements are taken in adjustTooltipPosition
6470
- // otherwise text-wrapping from previous position makes width measurement inconsistent
6471
- tooltipEl.style.top = "";
6472
- tooltipEl.style.left = "";
6473
- const { spaceLeft, spaceRight, spaceBelow, spaceAbove } = getClosableElementMeasurements(el, tooltipEl);
6474
- const tooltipWidth = tooltipEl.getBoundingClientRect().width;
6475
- const tooltipHeight = tooltipEl.getBoundingClientRect().height;
6476
- const enoughSpaceAbove = spaceAbove > tooltipHeight;
6477
- const enoughSpaceBelow = spaceBelow > tooltipHeight;
6478
- // a tooltip should never be closer than 24px to the edge of a screen
6479
- const enoughSpaceLeft = spaceLeft - 24 > tooltipWidth;
6480
- const enoughSpaceRight = spaceRight - 24 > tooltipWidth;
6481
- const swapAbove = (position) => {
6482
- return !enoughSpaceAbove ? position.replace("top", "bottom") : position;
6483
- };
6484
- const swapBelow = (position) => {
6485
- return !enoughSpaceBelow && enoughSpaceAbove ? position.replace("bottom", "top") : position;
6486
- };
6487
- const swapLeft = (position, centeredPosition) => {
6488
- if (!enoughSpaceLeft && enoughSpaceRight) {
6489
- position = position.replace("left", "right");
6490
- }
6491
- else if (!enoughSpaceLeft && !enoughSpaceRight) {
6492
- position = centeredPosition;
6493
- }
6494
- return position;
6495
- };
6496
- const swapRight = (position, centeredPosition) => {
6497
- if (!enoughSpaceRight && enoughSpaceLeft) {
6498
- position = position.replace("right", "left");
6499
- }
6500
- else if (!enoughSpaceRight && !enoughSpaceLeft) {
6501
- position = centeredPosition;
6502
- }
6503
- return position;
6504
- };
6505
- // horizontal checks must occur before vertical checks, because horizontal can affect vertical positioning but not vice versa
6506
- switch (tPos) {
6507
- case "left":
6508
- tPos = swapLeft(tPos, "bottom");
6509
- case "right":
6510
- tPos = swapRight(tPos, "bottom");
6511
- case "top-left":
6512
- tPos = swapLeft(tPos, "top");
6513
- tPos = swapAbove(tPos);
6514
- case "top-right":
6515
- tPos = swapRight(tPos, "top");
6516
- tPos = swapAbove(tPos);
6517
- case "bottom-left":
6518
- tPos = swapLeft(tPos, "bottom");
6519
- tPos = swapBelow(tPos);
6520
- case "bottom-right":
6521
- tPos = swapRight(tPos, "bottom");
6522
- tPos = swapBelow(tPos);
6523
- case "top":
6524
- tPos = swapAbove(tPos);
6525
- case "bottom":
6526
- tPos = swapBelow(tPos);
6527
- }
6528
- return tPos;
6529
- }
6530
- function hasRoomRight(x, spaceNeeded) {
6531
- let horizOffset = 0;
6532
- // if (getTextDir() === "ltr") {
6533
- if (x.type === "click") {
6534
- // if it's a mouse event, deal with mouse coords
6535
- horizOffset = x.clientX;
6536
- // if it's a focus event, the offset is 0
6537
- }
6538
- else if (x.type === "focus") {
6539
- horizOffset = 0;
6540
- }
6541
- else {
6542
- // otherwise an element was passed, calculate how far it is from the edge of the window
6543
- let el = x; // re-assignment is for clarity
6544
- while (el) {
6545
- if (el.tagName == "BODY") {
6546
- // deal with browser quirks with body/window/document and page scroll
6547
- var xScroll = el.scrollLeft || document.documentElement.scrollLeft;
6548
- horizOffset += el.offsetLeft - xScroll + el.clientLeft;
6549
- }
6550
- else {
6551
- // for all other non-BODY elements
6552
- horizOffset += el.offsetLeft - el.scrollLeft + el.clientLeft;
6553
- }
6554
- el = el.offsetParent;
6555
- }
6556
- // }
6557
- }
6558
- return window.innerWidth - horizOffset >= spaceNeeded;
6559
- }
6560
- function checkForActiveElInShadow(element) {
6561
- while (element && element.shadowRoot) {
6562
- element = element.shadowRoot.activeElement;
6563
- }
6564
- return element;
6565
- }
6566
- function checkForFocusableElInShadow(element) {
6567
- const selectors = [
6568
- "button",
6569
- "a",
6570
- "input",
6571
- "select",
6572
- "textarea",
6573
- "wm-button",
6574
- "wm-search",
6575
- "wm-select",
6576
- "wm-action-menu",
6577
- "wm-tab-item",
6578
- "wm-datepicker",
6579
- ];
6580
- let focusableEl = element;
6581
- selectors.forEach((selector) => {
6582
- if (focusableEl && focusableEl.shadowRoot) {
6583
- let elInShadow = focusableEl.shadowRoot.querySelector(selector);
6584
- if (elInShadow) {
6585
- if (selector.startsWith("wm-")) {
6586
- focusableEl = checkForFocusableElInShadow(elInShadow);
6587
- }
6588
- else {
6589
- focusableEl = elInShadow;
6590
- }
6591
- }
6592
- }
6593
- });
6594
- return focusableEl;
6595
- }
6596
- function isFocusable(element) {
6597
- if (element.tabIndex > 0 || (element.tabIndex === 0 && element.getAttribute("tabIndex") !== null)) {
6598
- return true;
6599
- }
6600
- if (element.disabled) {
6601
- return false;
6602
- }
6603
- switch (element.nodeName) {
6604
- case "A":
6605
- return !!element.href && element.rel != "ignore";
6606
- case "INPUT":
6607
- return element.type != "hidden" && element.type != "file";
6608
- case "BUTTON":
6609
- case "SELECT":
6610
- case "TEXTAREA":
6611
- case "WM-BUTTON":
6612
- case "WM-SELECT":
6613
- case "WM-ACTION-MENU":
6614
- case "WM-DATEPICKER":
6615
- case "WM-TIMEPICKER":
6616
- case "WM-INPUT":
6617
- case "WM-TAG-INPUT":
6618
- case "WM-TAB-ITEM":
6619
- case "WM-SEARCH":
6620
- return true;
6621
- default:
6622
- return false;
6623
- }
6624
- }
6625
- function getFirstFocusableDescendant(element) {
6626
- if (isFocusable(element)) {
6627
- return checkForFocusableElInShadow(element);
6628
- }
6629
- else if (element.childNodes.length > 0) {
6630
- element.childNodes.forEach((i) => {
6631
- const childEl = getFirstFocusableDescendant(i);
6632
- return childEl && checkForFocusableElInShadow(childEl);
6633
- });
6634
- }
6635
- }
6636
- function hasValidType(file, types) {
6637
- const acceptedExtensions = types.split(" ");
6638
- const parts = file.name && file.name.split(".");
6639
- const ext = parts && parts.length > 1 && parts[parts.length - 1];
6640
- return ext
6641
- ? acceptedExtensions.includes(ext.toLowerCase())
6642
- : // fallback: if we couldn't obtain an extension,
6643
- // validate based on MIME type...
6644
- !!file.type
6645
- ? getAcceptedMimeTypesList(acceptedExtensions).includes(file.type)
6646
- : // ...and if that failed too, accept the file
6647
- // as it's preferable to accept an invalid file
6648
- // than refusing a valid one (back-end will take care of what slips through)
6649
- true;
6650
- }
6651
- // takes a string (space separated list of extensions), returns an array of strings (corresponding MIME types)
6652
- function getAcceptedMimeTypesList(acceptedExtensions) {
6653
- // this is just a list of common file types (regardless of whether they are/can be valid or not)
6654
- // front end checks are just a convenience to users, independent of security.
6655
- // it allows users to be notified of an invalid type as soon as they select the file, rather than when it gets uploaded
6656
- const lookupTable = {
6657
- aac: ["audio/aac"],
6658
- abw: ["application/x-abiword"],
6659
- arc: ["application/x-freearc"],
6660
- avi: ["video/x-msvideo"],
6661
- azw: ["application/vnd.amazon.ebook"],
6662
- bin: ["application/octet-stream"],
6663
- bmp: ["image/bmp"],
6664
- bz: ["application/x-bzip"],
6665
- bz2: ["application/x-bzip2"],
6666
- csh: ["application/x-csh"],
6667
- css: ["text/css"],
6668
- csv: ["text/csv"],
6669
- doc: ["application/msword"],
6670
- docx: ["application/vnd.openxmlformats-officedocument.wordprocessingml.document"],
6671
- eot: ["application/vnd.ms-fontobject"],
6672
- epub: ["application/epub+zip"],
6673
- gz: ["application/gzip"],
6674
- gif: ["image/gif"],
6675
- htm: ["text/html"],
6676
- html: ["text/html"],
6677
- ico: ["image/vnd.microsoft.icon"],
6678
- ics: ["text/calendar"],
6679
- jar: ["application/java-archive"],
6680
- jpeg: ["image/jpeg"],
6681
- jpg: ["image/jpeg"],
6682
- js: ["text/javascript"],
6683
- json: ["application/json"],
6684
- jsonld: ["application/ld+json"],
6685
- log: ["text/plain"],
6686
- mid: ["audio/x-midi"],
6687
- midi: ["audio/x-midi"],
6688
- mjs: ["text/javascript"],
6689
- mp3: ["audio/mpeg"],
6690
- mpeg: ["video/mpeg"],
6691
- mpkg: ["application/vnd.apple.installer+xml"],
6692
- odp: ["application/vnd.oasis.opendocument.presentation"],
6693
- ods: ["application/vnd.oasis.opendocument.spreadsheet"],
6694
- odt: ["application/vnd.oasis.opendocument.text"],
6695
- oga: ["audio/ogg"],
6696
- ogv: ["video/ogg"],
6697
- ogx: ["application/ogg"],
6698
- opus: ["audio/opus"],
6699
- otf: ["font/otf"],
6700
- png: ["image/png"],
6701
- pdf: ["application/pdf"],
6702
- php: ["application/php"],
6703
- ppt: ["application/vnd.ms-powerpoint"],
6704
- pptx: ["application/vnd.openxmlformats-officedocument.presentationml.presentation"],
6705
- rar: ["application/vnd.rar", "application/x-rar", "application/x-rar-compressed"],
6706
- rtf: ["application/rtf"],
6707
- sh: ["application/x-sh"],
6708
- svg: ["image/svg+xml"],
6709
- swf: ["application/x-shockwave-flash"],
6710
- tar: ["application/x-tar"],
6711
- tif: ["image/tiff"],
6712
- tiff: ["image/tiff"],
6713
- ts: ["video/mp2t"],
6714
- ttf: ["font/ttf"],
6715
- txt: ["text/plain"],
6716
- vsd: ["application/vnd.visio"],
6717
- wav: ["audio/wav"],
6718
- weba: ["audio/webm"],
6719
- webm: ["video/webm"],
6720
- webp: ["image/webp"],
6721
- woff: ["font/woff"],
6722
- woff2: ["font/woff2"],
6723
- xhtml: ["application/xhtml+xml"],
6724
- xls: ["application/vnd.ms-excel"],
6725
- xlsx: ["application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"],
6726
- xml: ["application/xml", "text/xml"],
6727
- xul: ["application/vnd.mozilla.xul+xml"],
6728
- zip: ["application/zip", "application/x-zip-compressed", "multipart/x-zip"],
6729
- "3gp": ["video/3gpp", "audio/3gpp"],
6730
- "3g2": ["video/3gpp2", "audio/3gpp2"],
6731
- "7z": ["application/x-7z-compressed"],
6732
- };
6733
- return acceptedExtensions.reduce((acc, ext) => acc.concat(lookupTable[ext]), []);
6734
- }
6735
- function snakeCaseToCamelCase(str) {
6736
- const snakeCaseRegexp = /^([a-z0-9]*)(_[a-z0-9]*)*$/g;
6737
- if (snakeCaseRegexp.test(str)) {
6738
- let camelCase = "";
6739
- let arr = str.split("_");
6740
- arr.forEach((word, idx) => {
6741
- camelCase += idx === 0 ? word.toLowerCase() : word.charAt(0).toUpperCase() + word.slice(1);
6742
- });
6743
- return camelCase;
6744
- }
6745
- else {
6746
- return str;
6747
- }
6748
- }
6749
- function getNewIndexToFocus(currentIndex, direction, listLength) {
6750
- let newIndex = currentIndex;
6751
- if (direction === "ArrowDown") {
6752
- newIndex = (currentIndex + 1) % listLength;
6753
- }
6754
- if (direction === "ArrowUp") {
6755
- newIndex = currentIndex === 0 ? listLength - 1 : currentIndex - 1;
6756
- }
6757
- return newIndex;
6758
- }
6759
- function isRelatedTarget(ev, id) {
6760
- // used for onBlur events to check the element that has been clicked
6761
- const ids = id.split(" ");
6762
- return ev.relatedTarget && ids.includes(ev.relatedTarget.id);
6763
- }
6764
- /*
6765
- * this is going to be needed to solve the extra tabbing on navigator
6766
- * and for programmatic focus of tabs
6767
- * Here's a draft, not bug proof, see:
6768
- * https://stackoverflow.com/a/10730308/3741713
6769
-
6770
- function getKeyboardFocusableElements(element = document) {
6771
- const els = Array.from(element.querySelectorAll('a, button, input, textarea, select, details, [tabindex]:not([tabindex="-1"]), wm-search, wm-timepicker, wm-tab-list, wm-tab-item, wm-button, wm-action-menu'));
6772
- return els.filter((el: Element) => !el.hasAttribute("disabled")) as HTMLElement[];
6773
- }
6774
-
6775
- export function getPreviousKeyboardFocusableElement(element: HTMLElement) {
6776
- const els = getKeyboardFocusableElements();
6777
- const current = els.indexOf(element);
6778
- return els[current - 1] as HTMLElement;
6779
- }
6780
-
6781
- export function getNextKeyboardFocusableElement(element: HTMLElement) {
6782
- const els = getKeyboardFocusableElements();
6783
- const current = els.indexOf(element);
6784
- return els[current + 1] as HTMLElement;
6785
- }
6610
+ const DEFAULT_LANGUAGE = "en";
6611
+ function getBrowserLang() {
6612
+ const langAttr = document.documentElement.getAttribute("lang");
6613
+ if (!!langAttr) {
6614
+ return langAttr;
6615
+ }
6616
+ else if (window.navigator && window.navigator.language) {
6617
+ const lang = window.navigator.languages ? window.navigator.languages[0] : window.navigator.language;
6618
+ return lang.slice(0, 2);
6619
+ }
6620
+ else {
6621
+ return DEFAULT_LANGUAGE;
6622
+ }
6623
+ }
6624
+ // prevents memory leak
6625
+ const cache = createIntlCache();
6626
+ const locale = getBrowserLang();
6627
+ const intl = createIntl({
6628
+ locale: locale,
6629
+ defaultLocale: "en",
6630
+ messages: lang[locale] || en,
6631
+ }, cache);
6632
+ function generateId() {
6633
+ return "wmcl-" + Math.random().toString(36).substr(2, 10);
6634
+ }
6635
+ function debounce(fn, wait) {
6636
+ let timeout;
6637
+ return function () {
6638
+ const context = this;
6639
+ const functionCall = () => fn.apply(context, arguments);
6640
+ clearTimeout(timeout);
6641
+ timeout = setTimeout(functionCall, wait);
6642
+ };
6643
+ }
6644
+ function getTextDir() {
6645
+ const dir = document.querySelector("html").getAttribute("dir");
6646
+ return dir ? dir.toLowerCase() : "";
6647
+ }
6648
+ function getPosition(el) {
6649
+ const coords = el.getBoundingClientRect();
6650
+ let x = coords.x;
6651
+ let y = coords.y;
6652
+ // Edge doesn't have x and y
6653
+ if (!x) {
6654
+ if (getTextDir() === "rtl") {
6655
+ x = coords.right;
6656
+ }
6657
+ else {
6658
+ x = coords.left;
6659
+ }
6660
+ y = coords.top;
6661
+ }
6662
+ return { x, y };
6663
+ }
6664
+ function findParentWithScrollbar(el) {
6665
+ while (!!el) {
6666
+ if (el.scrollHeight > el.clientHeight && ["scroll", "auto"].includes(window.getComputedStyle(el).overflowY)) {
6667
+ return el;
6668
+ }
6669
+ el = el.parentElement;
6670
+ }
6671
+ }
6672
+ function findParentWithHiddenOverflow(el) {
6673
+ while (!!el) {
6674
+ if (window.getComputedStyle(el).overflowY !== "visible") {
6675
+ return el;
6676
+ }
6677
+ el = el.parentElement;
6678
+ }
6679
+ }
6680
+ function getClosableElementMeasurements(fixedEl, closableEl) {
6681
+ const parent = findParentWithHiddenOverflow(fixedEl);
6682
+ // if parent is not found, measurements are checked against the viewport
6683
+ return {
6684
+ closableElHeight: closableEl.clientHeight,
6685
+ closableElWidth: closableEl.clientWidth,
6686
+ // NB boundingClientRect.bottom is space from top of viewport to bottom of el
6687
+ // to get space below the el -> height of viewport minus boundingClientRect.bottom
6688
+ spaceAbove: parent
6689
+ ? fixedEl.getBoundingClientRect().top - parent.getBoundingClientRect().top
6690
+ : fixedEl.getBoundingClientRect().top,
6691
+ // NB boundingClientRect.bottom is space from top of viewport to bottom of el
6692
+ // to get space below the el -> height of viewport minus boundingClientRect.bottom
6693
+ spaceBelow: parent
6694
+ ? parent.getBoundingClientRect().bottom - fixedEl.getBoundingClientRect().bottom
6695
+ : document.documentElement.clientHeight - fixedEl.getBoundingClientRect().bottom,
6696
+ spaceLeft: parent
6697
+ ? fixedEl.getBoundingClientRect().left - parent.getBoundingClientRect().left
6698
+ : fixedEl.getBoundingClientRect().left,
6699
+ spaceRight: parent
6700
+ ? parent.getBoundingClientRect().right - fixedEl.getBoundingClientRect().right
6701
+ : document.documentElement.clientWidth - fixedEl.getBoundingClientRect().right,
6702
+ };
6703
+ }
6704
+ function shouldOpenUp(fixedEl, //the element visible on the page when the component is closed
6705
+ closableEl, //the dropdown/popup/etc that becomes visible when the component is open
6706
+ offsetAbove = 0, // if closableEl covers a part of fixedEl, that part should be offset
6707
+ offsetBelow = 0 // if closableEl covers a part of fixedEl, that part should be offset
6708
+ ) {
6709
+ const { closableElHeight, spaceAbove, spaceBelow } = getClosableElementMeasurements(fixedEl, closableEl);
6710
+ //we want to open up only if there's not enough space below AND there is enough space above
6711
+ const openUp = closableElHeight > spaceBelow + offsetBelow && closableElHeight <= spaceAbove + offsetAbove;
6712
+ return openUp;
6713
+ }
6714
+ function shouldOpenDown(fixedEl, //the element visible on the page when the component is closed
6715
+ closableEl, //the dropdown/popup/etc that becomes visible when the component is open
6716
+ offsetAbove = 0, // if closableEl covers a part of fixedEl, that part should be offset
6717
+ offsetBelow = 0 // if closableEl covers a part of fixedEl, that part should be offset
6718
+ ) {
6719
+ const { closableElHeight, spaceAbove, spaceBelow } = getClosableElementMeasurements(fixedEl, closableEl);
6720
+ //we want to open up only if there's not enough space below AND there is enough space above
6721
+ const openDown = closableElHeight > spaceAbove + offsetAbove && closableElHeight <= spaceBelow + offsetBelow;
6722
+ return openDown;
6723
+ }
6724
+ function shouldShiftRight(fixedEl, closableEl) {
6725
+ const { closableElWidth, spaceLeft, spaceRight } = getClosableElementMeasurements(fixedEl, closableEl);
6726
+ const needsSpaceLeft = closableElWidth > spaceLeft && spaceRight > spaceLeft;
6727
+ return needsSpaceLeft;
6728
+ }
6729
+ function shouldShiftLeft(fixedEl, closableEl) {
6730
+ const { closableElWidth, spaceLeft, spaceRight } = getClosableElementMeasurements(fixedEl, closableEl);
6731
+ const needsSpaceRight = closableElWidth > spaceRight && spaceLeft > spaceRight;
6732
+ return needsSpaceRight;
6733
+ }
6734
+ function adjustTooltipPosition(tPos, el, tooltipEl) {
6735
+ // position must be reset before measurements are taken in adjustTooltipPosition
6736
+ // otherwise text-wrapping from previous position makes width measurement inconsistent
6737
+ tooltipEl.style.top = "";
6738
+ tooltipEl.style.left = "";
6739
+ const { spaceLeft, spaceRight, spaceBelow, spaceAbove } = getClosableElementMeasurements(el, tooltipEl);
6740
+ const tooltipWidth = tooltipEl.getBoundingClientRect().width;
6741
+ const tooltipHeight = tooltipEl.getBoundingClientRect().height;
6742
+ const enoughSpaceAbove = spaceAbove > tooltipHeight;
6743
+ const enoughSpaceBelow = spaceBelow > tooltipHeight;
6744
+ // a tooltip should never be closer than 24px to the edge of a screen
6745
+ const enoughSpaceLeft = spaceLeft - 24 > tooltipWidth;
6746
+ const enoughSpaceRight = spaceRight - 24 > tooltipWidth;
6747
+ const swapAbove = (position) => {
6748
+ return !enoughSpaceAbove ? position.replace("top", "bottom") : position;
6749
+ };
6750
+ const swapBelow = (position) => {
6751
+ return !enoughSpaceBelow && enoughSpaceAbove ? position.replace("bottom", "top") : position;
6752
+ };
6753
+ const swapLeft = (position, centeredPosition) => {
6754
+ if (!enoughSpaceLeft && enoughSpaceRight) {
6755
+ position = position.replace("left", "right");
6756
+ }
6757
+ else if (!enoughSpaceLeft && !enoughSpaceRight) {
6758
+ position = centeredPosition;
6759
+ }
6760
+ return position;
6761
+ };
6762
+ const swapRight = (position, centeredPosition) => {
6763
+ if (!enoughSpaceRight && enoughSpaceLeft) {
6764
+ position = position.replace("right", "left");
6765
+ }
6766
+ else if (!enoughSpaceRight && !enoughSpaceLeft) {
6767
+ position = centeredPosition;
6768
+ }
6769
+ return position;
6770
+ };
6771
+ // horizontal checks must occur before vertical checks, because horizontal can affect vertical positioning but not vice versa
6772
+ switch (tPos) {
6773
+ case "left":
6774
+ tPos = swapLeft(tPos, "bottom");
6775
+ case "right":
6776
+ tPos = swapRight(tPos, "bottom");
6777
+ case "top-left":
6778
+ tPos = swapLeft(tPos, "top");
6779
+ tPos = swapAbove(tPos);
6780
+ case "top-right":
6781
+ tPos = swapRight(tPos, "top");
6782
+ tPos = swapAbove(tPos);
6783
+ case "bottom-left":
6784
+ tPos = swapLeft(tPos, "bottom");
6785
+ tPos = swapBelow(tPos);
6786
+ case "bottom-right":
6787
+ tPos = swapRight(tPos, "bottom");
6788
+ tPos = swapBelow(tPos);
6789
+ case "top":
6790
+ tPos = swapAbove(tPos);
6791
+ case "bottom":
6792
+ tPos = swapBelow(tPos);
6793
+ }
6794
+ return tPos;
6795
+ }
6796
+ function hasRoomRight(x, spaceNeeded) {
6797
+ let horizOffset = 0;
6798
+ // if (getTextDir() === "ltr") {
6799
+ if (x.type === "click") {
6800
+ // if it's a mouse event, deal with mouse coords
6801
+ horizOffset = x.clientX;
6802
+ // if it's a focus event, the offset is 0
6803
+ }
6804
+ else if (x.type === "focus") {
6805
+ horizOffset = 0;
6806
+ }
6807
+ else {
6808
+ // otherwise an element was passed, calculate how far it is from the edge of the window
6809
+ let el = x; // re-assignment is for clarity
6810
+ while (el) {
6811
+ if (el.tagName == "BODY") {
6812
+ // deal with browser quirks with body/window/document and page scroll
6813
+ var xScroll = el.scrollLeft || document.documentElement.scrollLeft;
6814
+ horizOffset += el.offsetLeft - xScroll + el.clientLeft;
6815
+ }
6816
+ else {
6817
+ // for all other non-BODY elements
6818
+ horizOffset += el.offsetLeft - el.scrollLeft + el.clientLeft;
6819
+ }
6820
+ el = el.offsetParent;
6821
+ }
6822
+ // }
6823
+ }
6824
+ return window.innerWidth - horizOffset >= spaceNeeded;
6825
+ }
6826
+ function checkForActiveElInShadow(element) {
6827
+ while (element && element.shadowRoot) {
6828
+ element = element.shadowRoot.activeElement;
6829
+ }
6830
+ return element;
6831
+ }
6832
+ function checkForFocusableElInShadow(element) {
6833
+ const selectors = [
6834
+ "button",
6835
+ "a",
6836
+ "input",
6837
+ "select",
6838
+ "textarea",
6839
+ "wm-button",
6840
+ "wm-search",
6841
+ "wm-select",
6842
+ "wm-action-menu",
6843
+ "wm-tab-item",
6844
+ "wm-datepicker",
6845
+ ];
6846
+ let focusableEl = element;
6847
+ selectors.forEach((selector) => {
6848
+ if (focusableEl && focusableEl.shadowRoot) {
6849
+ let elInShadow = focusableEl.shadowRoot.querySelector(selector);
6850
+ if (elInShadow) {
6851
+ if (selector.startsWith("wm-")) {
6852
+ focusableEl = checkForFocusableElInShadow(elInShadow);
6853
+ }
6854
+ else {
6855
+ focusableEl = elInShadow;
6856
+ }
6857
+ }
6858
+ }
6859
+ });
6860
+ return focusableEl;
6861
+ }
6862
+ function isFocusable(element) {
6863
+ if (element.tabIndex > 0 || (element.tabIndex === 0 && element.getAttribute("tabIndex") !== null)) {
6864
+ return true;
6865
+ }
6866
+ if (element.disabled) {
6867
+ return false;
6868
+ }
6869
+ switch (element.nodeName) {
6870
+ case "A":
6871
+ return !!element.href && element.rel != "ignore";
6872
+ case "INPUT":
6873
+ return element.type != "hidden" && element.type != "file";
6874
+ case "BUTTON":
6875
+ case "SELECT":
6876
+ case "TEXTAREA":
6877
+ case "WM-BUTTON":
6878
+ case "WM-SELECT":
6879
+ case "WM-ACTION-MENU":
6880
+ case "WM-DATEPICKER":
6881
+ case "WM-TIMEPICKER":
6882
+ case "WM-INPUT":
6883
+ case "WM-TAG-INPUT":
6884
+ case "WM-TAB-ITEM":
6885
+ case "WM-SEARCH":
6886
+ return true;
6887
+ default:
6888
+ return false;
6889
+ }
6890
+ }
6891
+ function getFirstFocusableDescendant(element) {
6892
+ if (isFocusable(element)) {
6893
+ return checkForFocusableElInShadow(element);
6894
+ }
6895
+ else if (element.childNodes.length > 0) {
6896
+ element.childNodes.forEach((i) => {
6897
+ const childEl = getFirstFocusableDescendant(i);
6898
+ return childEl && checkForFocusableElInShadow(childEl);
6899
+ });
6900
+ }
6901
+ }
6902
+ function hasValidType(file, types) {
6903
+ const acceptedExtensions = types.split(" ");
6904
+ const parts = file.name && file.name.split(".");
6905
+ const ext = parts && parts.length > 1 && parts[parts.length - 1];
6906
+ return ext
6907
+ ? acceptedExtensions.includes(ext.toLowerCase())
6908
+ : // fallback: if we couldn't obtain an extension,
6909
+ // validate based on MIME type...
6910
+ !!file.type
6911
+ ? getAcceptedMimeTypesList(acceptedExtensions).includes(file.type)
6912
+ : // ...and if that failed too, accept the file
6913
+ // as it's preferable to accept an invalid file
6914
+ // than refusing a valid one (back-end will take care of what slips through)
6915
+ true;
6916
+ }
6917
+ // takes a string (space separated list of extensions), returns an array of strings (corresponding MIME types)
6918
+ function getAcceptedMimeTypesList(acceptedExtensions) {
6919
+ // this is just a list of common file types (regardless of whether they are/can be valid or not)
6920
+ // front end checks are just a convenience to users, independent of security.
6921
+ // it allows users to be notified of an invalid type as soon as they select the file, rather than when it gets uploaded
6922
+ const lookupTable = {
6923
+ aac: ["audio/aac"],
6924
+ abw: ["application/x-abiword"],
6925
+ arc: ["application/x-freearc"],
6926
+ avi: ["video/x-msvideo"],
6927
+ azw: ["application/vnd.amazon.ebook"],
6928
+ bin: ["application/octet-stream"],
6929
+ bmp: ["image/bmp"],
6930
+ bz: ["application/x-bzip"],
6931
+ bz2: ["application/x-bzip2"],
6932
+ csh: ["application/x-csh"],
6933
+ css: ["text/css"],
6934
+ csv: ["text/csv"],
6935
+ doc: ["application/msword"],
6936
+ docx: ["application/vnd.openxmlformats-officedocument.wordprocessingml.document"],
6937
+ eot: ["application/vnd.ms-fontobject"],
6938
+ epub: ["application/epub+zip"],
6939
+ gz: ["application/gzip"],
6940
+ gif: ["image/gif"],
6941
+ htm: ["text/html"],
6942
+ html: ["text/html"],
6943
+ ico: ["image/vnd.microsoft.icon"],
6944
+ ics: ["text/calendar"],
6945
+ jar: ["application/java-archive"],
6946
+ jpeg: ["image/jpeg"],
6947
+ jpg: ["image/jpeg"],
6948
+ js: ["text/javascript"],
6949
+ json: ["application/json"],
6950
+ jsonld: ["application/ld+json"],
6951
+ log: ["text/plain"],
6952
+ mid: ["audio/x-midi"],
6953
+ midi: ["audio/x-midi"],
6954
+ mjs: ["text/javascript"],
6955
+ mp3: ["audio/mpeg"],
6956
+ mpeg: ["video/mpeg"],
6957
+ mpkg: ["application/vnd.apple.installer+xml"],
6958
+ odp: ["application/vnd.oasis.opendocument.presentation"],
6959
+ ods: ["application/vnd.oasis.opendocument.spreadsheet"],
6960
+ odt: ["application/vnd.oasis.opendocument.text"],
6961
+ oga: ["audio/ogg"],
6962
+ ogv: ["video/ogg"],
6963
+ ogx: ["application/ogg"],
6964
+ opus: ["audio/opus"],
6965
+ otf: ["font/otf"],
6966
+ png: ["image/png"],
6967
+ pdf: ["application/pdf"],
6968
+ php: ["application/php"],
6969
+ ppt: ["application/vnd.ms-powerpoint"],
6970
+ pptx: ["application/vnd.openxmlformats-officedocument.presentationml.presentation"],
6971
+ rar: ["application/vnd.rar", "application/x-rar", "application/x-rar-compressed"],
6972
+ rtf: ["application/rtf"],
6973
+ sh: ["application/x-sh"],
6974
+ svg: ["image/svg+xml"],
6975
+ swf: ["application/x-shockwave-flash"],
6976
+ tar: ["application/x-tar"],
6977
+ tif: ["image/tiff"],
6978
+ tiff: ["image/tiff"],
6979
+ ts: ["video/mp2t"],
6980
+ ttf: ["font/ttf"],
6981
+ txt: ["text/plain"],
6982
+ vsd: ["application/vnd.visio"],
6983
+ wav: ["audio/wav"],
6984
+ weba: ["audio/webm"],
6985
+ webm: ["video/webm"],
6986
+ webp: ["image/webp"],
6987
+ woff: ["font/woff"],
6988
+ woff2: ["font/woff2"],
6989
+ xhtml: ["application/xhtml+xml"],
6990
+ xls: ["application/vnd.ms-excel"],
6991
+ xlsx: ["application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"],
6992
+ xml: ["application/xml", "text/xml"],
6993
+ xul: ["application/vnd.mozilla.xul+xml"],
6994
+ zip: ["application/zip", "application/x-zip-compressed", "multipart/x-zip"],
6995
+ "3gp": ["video/3gpp", "audio/3gpp"],
6996
+ "3g2": ["video/3gpp2", "audio/3gpp2"],
6997
+ "7z": ["application/x-7z-compressed"],
6998
+ };
6999
+ return acceptedExtensions.reduce((acc, ext) => acc.concat(lookupTable[ext]), []);
7000
+ }
7001
+ function snakeCaseToCamelCase(str) {
7002
+ const snakeCaseRegexp = /^([a-z0-9]*)(_[a-z0-9]*)*$/g;
7003
+ if (snakeCaseRegexp.test(str)) {
7004
+ let camelCase = "";
7005
+ let arr = str.split("_");
7006
+ arr.forEach((word, idx) => {
7007
+ camelCase += idx === 0 ? word.toLowerCase() : word.charAt(0).toUpperCase() + word.slice(1);
7008
+ });
7009
+ return camelCase;
7010
+ }
7011
+ else {
7012
+ return str;
7013
+ }
7014
+ }
7015
+ function getNewIndexToFocus(currentIndex, direction, listLength) {
7016
+ let newIndex = currentIndex;
7017
+ if (direction === "ArrowDown") {
7018
+ newIndex = (currentIndex + 1) % listLength;
7019
+ }
7020
+ if (direction === "ArrowUp") {
7021
+ newIndex = currentIndex === 0 ? listLength - 1 : currentIndex - 1;
7022
+ }
7023
+ return newIndex;
7024
+ }
7025
+ function isRelatedTarget(ev, id) {
7026
+ // used for onBlur events to check the element that has been clicked
7027
+ const ids = id.split(" ");
7028
+ return ev.relatedTarget && ids.includes(ev.relatedTarget.id);
7029
+ }
7030
+ /*
7031
+ * this is going to be needed to solve the extra tabbing on navigator
7032
+ * and for programmatic focus of tabs
7033
+ * Here's a draft, not bug proof, see:
7034
+ * https://stackoverflow.com/a/10730308/3741713
7035
+
7036
+ function getKeyboardFocusableElements(element = document) {
7037
+ const els = Array.from(element.querySelectorAll('a, button, input, textarea, select, details, [tabindex]:not([tabindex="-1"]), wm-search, wm-timepicker, wm-tab-list, wm-tab-item, wm-button, wm-action-menu'));
7038
+ return els.filter((el: Element) => !el.hasAttribute("disabled")) as HTMLElement[];
7039
+ }
7040
+
7041
+ export function getPreviousKeyboardFocusableElement(element: HTMLElement) {
7042
+ const els = getKeyboardFocusableElements();
7043
+ const current = els.indexOf(element);
7044
+ return els[current - 1] as HTMLElement;
7045
+ }
7046
+
7047
+ export function getNextKeyboardFocusableElement(element: HTMLElement) {
7048
+ const els = getKeyboardFocusableElements();
7049
+ const current = els.indexOf(element);
7050
+ return els[current + 1] as HTMLElement;
7051
+ }
6786
7052
  */
6787
7053
 
6788
7054
  exports.adjustTooltipPosition = adjustTooltipPosition;