@pingux/astro 1.5.1-alpha.0 → 1.6.0-alpha.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.
@@ -0,0 +1,80 @@
1
+ import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
2
+ import React from 'react';
3
+ import userEvent from '@testing-library/user-event';
4
+ import { render, screen } from '../../utils/testUtils/testWrapper';
5
+ import { TimeZonePicker, OverlayProvider } from '../../index';
6
+ import { jsx as ___EmotionJSX } from "@emotion/react";
7
+ var testTimeZoneJuba = 'Africa/Juba';
8
+ var testTimeZoneApia = 'Pacific/Apia';
9
+ var defaultProps = {
10
+ label: 'Test Label'
11
+ };
12
+
13
+ var getComponent = function getComponent() {
14
+ var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
15
+
16
+ var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
17
+ _ref$renderFn = _ref.renderFn,
18
+ renderFn = _ref$renderFn === void 0 ? render : _ref$renderFn;
19
+
20
+ return renderFn(___EmotionJSX(OverlayProvider, null, ___EmotionJSX(TimeZonePicker, _extends({}, defaultProps, props))));
21
+ };
22
+
23
+ beforeAll(function () {
24
+ jest.spyOn(window.HTMLElement.prototype, 'clientWidth', 'get').mockImplementation(function () {
25
+ return 1000;
26
+ });
27
+ jest.spyOn(window.HTMLElement.prototype, 'clientHeight', 'get').mockImplementation(function () {
28
+ return 1000;
29
+ });
30
+ window.HTMLElement.prototype.scrollIntoView = jest.fn();
31
+ jest.spyOn(window.screen, 'width', 'get').mockImplementation(function () {
32
+ return 1024;
33
+ });
34
+ jest.spyOn(window, 'requestAnimationFrame').mockImplementation(function (cb) {
35
+ return cb();
36
+ });
37
+ jest.useFakeTimers();
38
+ });
39
+ afterEach(function () {
40
+ jest.clearAllMocks();
41
+ });
42
+ afterAll(function () {
43
+ jest.restoreAllMocks();
44
+ });
45
+ test('renders ComboBoxField component', function () {
46
+ getComponent();
47
+ var input = screen.queryByRole('combobox');
48
+ var label = screen.getByText(defaultProps.label);
49
+ var button = screen.queryByRole('button');
50
+ expect(input).toBeInTheDocument();
51
+ expect(screen.queryAllByLabelText(defaultProps.label)).toEqual([input, button]);
52
+ expect(label).toBeInTheDocument();
53
+ expect(label).toHaveTextContent(defaultProps.label);
54
+ expect(button).toBeInTheDocument();
55
+ });
56
+ test('search is working correctly', function () {
57
+ getComponent();
58
+ var input = screen.queryByRole('combobox');
59
+ userEvent.type(input, testTimeZoneApia);
60
+ expect(screen.getByText(testTimeZoneApia)).toBeInTheDocument();
61
+ });
62
+ test('custom timezone can be added', function () {
63
+ getComponent({
64
+ additionalTimeZones: {
65
+ '(GMT+02:00) Africa/Juba': testTimeZoneJuba
66
+ }
67
+ });
68
+ var input = screen.queryByRole('combobox');
69
+ userEvent.type(input, testTimeZoneJuba);
70
+ expect(screen.getByText(testTimeZoneJuba)).toBeInTheDocument();
71
+ });
72
+ test('shows custom empty search state text when no items are found', function () {
73
+ var testEmptyText = 'test empty text';
74
+ getComponent({
75
+ emptySearchText: testEmptyText
76
+ });
77
+ var input = screen.queryByRole('combobox');
78
+ userEvent.type(input, 'awdasrf213');
79
+ expect(screen.getByText(testEmptyText)).toBeInTheDocument();
80
+ });
@@ -0,0 +1 @@
1
+ export { default } from './TimeZonePicker';
@@ -0,0 +1,112 @@
1
+ export default {
2
+ '(GMT-11:00) Pago Pago': 'Pacific/Pago_Pago',
3
+ '(GMT-10:00) Hawaii Time': 'Pacific/Honolulu',
4
+ '(GMT-08:00) Pacific Time': 'America/Los_Angeles',
5
+ '(GMT-08:00) Pacific Time - Tijuana': 'America/Tijuana',
6
+ '(GMT-07:00) Mountain Time': 'America/Denver',
7
+ '(GMT-07:00) Mountain Time - Arizona': 'America/Phoenix',
8
+ '(GMT-07:00) Mountain Time - Chihuahua, Mazatlan': 'America/Mazatlan',
9
+ '(GMT-06:00) Central Time': 'America/Chicago',
10
+ '(GMT-06:00) Central Time - Mexico City': 'America/Mexico_City',
11
+ '(GMT-06:00) Central Time - Regina': 'America/Regina',
12
+ '(GMT-06:00) Guatemala': 'America/Guatemala',
13
+ '(GMT-05:00) Bogota': 'America/Bogota',
14
+ '(GMT-05:00) Eastern Time': 'America/New_York',
15
+ '(GMT-05:00) Lima': 'America/Lima',
16
+ '(GMT-04:30) Caracas': 'America/Caracas',
17
+ '(GMT-04:00) Atlantic Time - Halifax': 'America/Halifax',
18
+ '(GMT-04:00) Guyana': 'America/Guyana',
19
+ '(GMT-04:00) La Paz': 'America/La_Paz',
20
+ '(GMT-03:00) Buenos Aires': 'America/Argentina/Buenos_Aires',
21
+ '(GMT-03:00) Godthab': 'America/Godthab',
22
+ '(GMT-03:00) Montevideo': 'America/Montevideo',
23
+ '(GMT-03:30) Newfoundland Time - St. Johns': 'America/St_Johns',
24
+ '(GMT-03:00) Santiago': 'America/Santiago',
25
+ '(GMT-02:00) Sao Paulo': 'America/Sao_Paulo',
26
+ '(GMT-02:00) South Georgia': 'Atlantic/South_Georgia',
27
+ '(GMT-01:00) Azores': 'Atlantic/Azores',
28
+ '(GMT-01:00) Cape Verde': 'Atlantic/Cape_Verde',
29
+ '(GMT+00:00) Casablanca': 'Africa/Casablanca',
30
+ '(GMT+00:00) Dublin': 'Europe/Dublin',
31
+ '(GMT+00:00) Lisbon': 'Europe/Lisbon',
32
+ '(GMT+00:00) London': 'Europe/London',
33
+ '(GMT+00:00) Monrovia': 'Africa/Monrovia',
34
+ '(GMT+01:00) Algiers': 'Africa/Algiers',
35
+ '(GMT+01:00) Amsterdam': 'Europe/Amsterdam',
36
+ '(GMT+01:00) Berlin': 'Europe/Berlin',
37
+ '(GMT+01:00) Brussels': 'Europe/Brussels',
38
+ '(GMT+01:00) Budapest': 'Europe/Budapest',
39
+ '(GMT+01:00) Central European Time - Belgrade': 'Europe/Belgrade',
40
+ '(GMT+01:00) Central European Time - Prague': 'Europe/Prague',
41
+ '(GMT+01:00) Copenhagen': 'Europe/Copenhagen',
42
+ '(GMT+01:00) Madrid': 'Europe/Madrid',
43
+ '(GMT+01:00) Paris': 'Europe/Paris',
44
+ '(GMT+01:00) Rome': 'Europe/Rome',
45
+ '(GMT+01:00) Stockholm': 'Europe/Stockholm',
46
+ '(GMT+01:00) Vienna': 'Europe/Vienna',
47
+ '(GMT+01:00) Warsaw': 'Europe/Warsaw',
48
+ '(GMT+02:00) Athens': 'Europe/Athens',
49
+ '(GMT+02:00) Bucharest': 'Europe/Bucharest',
50
+ '(GMT+02:00) Cairo': 'Africa/Cairo',
51
+ '(GMT+02:00) Jerusalem': 'Asia/Jerusalem',
52
+ '(GMT+02:00) Johannesburg': 'Africa/Johannesburg',
53
+ '(GMT+02:00) Helsinki': 'Europe/Helsinki',
54
+ '(GMT+02:00) Kiev': 'Europe/Kiev',
55
+ '(GMT+02:00) Moscow-01 - Kaliningrad': 'Europe/Kaliningrad',
56
+ '(GMT+02:00) Riga': 'Europe/Riga',
57
+ '(GMT+02:00) Sofia': 'Europe/Sofia',
58
+ '(GMT+02:00) Tallinn': 'Europe/Tallinn',
59
+ '(GMT+02:00) Vilnius': 'Europe/Vilnius',
60
+ '(GMT+03:00) Istanbul': 'Europe/Istanbul',
61
+ '(GMT+03:00) Baghdad': 'Asia/Baghdad',
62
+ '(GMT+03:00) Nairobi': 'Africa/Nairobi',
63
+ '(GMT+03:00) Minsk': 'Europe/Minsk',
64
+ '(GMT+03:00) Riyadh': 'Asia/Riyadh',
65
+ '(GMT+03:00) Moscow+00 - Moscow': 'Europe/Moscow',
66
+ '(GMT+03:30) Tehran': 'Asia/Tehran',
67
+ '(GMT+04:00) Baku': 'Asia/Baku',
68
+ '(GMT+04:00) Moscow+01 - Samara': 'Europe/Samara',
69
+ '(GMT+04:00) Tbilisi': 'Asia/Tbilisi',
70
+ '(GMT+04:00) Yerevan': 'Asia/Yerevan',
71
+ '(GMT+04:30) Kabul': 'Asia/Kabul',
72
+ '(GMT+05:00) Karachi': 'Asia/Karachi',
73
+ '(GMT+05:00) Moscow+02 - Yekaterinburg': 'Asia/Yekaterinburg',
74
+ '(GMT+05:00) Tashkent': 'Asia/Tashkent',
75
+ '(GMT+05:30) Colombo': 'Asia/Colombo',
76
+ '(GMT+06:00) Almaty': 'Asia/Almaty',
77
+ '(GMT+06:00) Dhaka': 'Asia/Dhaka',
78
+ '(GMT+06:30) Rangoon': 'Asia/Rangoon',
79
+ '(GMT+07:00) Bangkok': 'Asia/Bangkok',
80
+ '(GMT+07:00) Jakarta': 'Asia/Jakarta',
81
+ '(GMT+07:00) Moscow+04 - Krasnoyarsk': 'Asia/Krasnoyarsk',
82
+ '(GMT+08:00) China Time - Beijing': 'Asia/Shanghai',
83
+ '(GMT+08:00) Hong Kong': 'Asia/Hong_Kong',
84
+ '(GMT+08:00) Kuala Lumpur': 'Asia/Kuala_Lumpur',
85
+ '(GMT+08:00) Moscow+05 - Irkutsk': 'Asia/Irkutsk',
86
+ '(GMT+08:00) Singapore': 'Asia/Singapore',
87
+ '(GMT+08:00) Taipei': 'Asia/Taipei',
88
+ '(GMT+08:00) Ulaanbaatar': 'Asia/Ulaanbaatar',
89
+ '(GMT+08:00) Western Time - Perth': 'Australia/Perth',
90
+ '(GMT+09:00) Moscow+06 - Yakutsk': 'Asia/Yakutsk',
91
+ '(GMT+09:00) Seoul': 'Asia/Seoul',
92
+ '(GMT+09:00) Tokyo': 'Asia/Tokyo',
93
+ '(GMT+09:30) Central Time - Darwin': 'Australia/Darwin',
94
+ '(GMT+10:00) Eastern Time - Brisbane': 'Australia/Brisbane',
95
+ '(GMT+10:00) Guam': 'Pacific/Guam',
96
+ '(GMT+10:00) Moscow+07 - Magadan': 'Asia/Magadan',
97
+ '(GMT+10:00) Moscow+07 - Yuzhno-Sakhalinsk': 'Asia/Vladivostok',
98
+ '(GMT+10:00) Port Moresby': 'Pacific/Port_Moresby',
99
+ '(GMT+10:30) Central Time - Adelaide': 'Australia/Adelaide',
100
+ '(GMT+11:00) Eastern Time - Hobart': 'Australia/Hobart',
101
+ '(GMT+11:00) Eastern Time - Melbourne, Sydney': 'Australia/Sydney',
102
+ '(GMT+11:00) Guadalcanal': 'Pacific/Guadalcanal',
103
+ '(GMT+11:00) Noumea': 'Pacific/Noumea',
104
+ '(GMT+12:00) Majuro': 'Pacific/Majuro',
105
+ '(GMT+12:00) Moscow+09 - Petropavlovsk-Kamchatskiy': 'Asia/Kamchatka',
106
+ '(GMT+13:00) Auckland': 'Pacific/Auckland',
107
+ '(GMT+13:00) Fakaofo': 'Pacific/Fakaofo',
108
+ '(GMT+13:00) Fiji': 'Pacific/Fiji',
109
+ '(GMT+13:00) Tongatapu': 'Pacific/Tongatapu',
110
+ '(GMT+14:00) Apia': 'Pacific/Apia'
111
+ };
112
+ export var usCities = ['Los Angeles', 'Denver', 'Phoenix', 'Chicago', 'New York'];
package/lib/index.js CHANGED
@@ -140,6 +140,7 @@ export { default as TextArea } from './components/TextArea';
140
140
  export * from './components/TextArea';
141
141
  export { default as TextAreaField } from './components/TextAreaField';
142
142
  export * from './components/TextAreaField';
143
+ export { default as TimeZonePicker } from './components/TimeZonePicker';
143
144
  export { default as TooltipTrigger } from './components/TooltipTrigger';
144
145
  export * from './components/TooltipTrigger';
145
146
  /* eslint-enable import/export */
@@ -175,6 +175,33 @@ var maskedValue = {
175
175
  fontWeight: 700
176
176
  }
177
177
  };
178
+ var timeZone = {
179
+ title: {
180
+ color: 'neutral.10',
181
+ fontSize: 'md',
182
+ whiteSpace: 'nowrap',
183
+ lineHeight: 1,
184
+ '.is-focused &': {
185
+ color: 'white'
186
+ }
187
+ },
188
+ subTitle: {
189
+ color: 'neutral.40',
190
+ fontSize: 'sm',
191
+ ml: 10,
192
+ '.is-focused &': {
193
+ color: 'white'
194
+ }
195
+ },
196
+ time: {
197
+ color: 'neutral.10',
198
+ fontSize: 'sm',
199
+ fontWeight: 1,
200
+ '.is-focused &': {
201
+ color: 'white'
202
+ }
203
+ }
204
+ };
178
205
  export var text = {
179
206
  base: base,
180
207
  bodyStrong: _objectSpread(_objectSpread({}, wordWrap), {}, {
@@ -287,5 +314,6 @@ export var text = {
287
314
  color: 'text.primary',
288
315
  fontFamily: 'standard'
289
316
  }),
290
- tooltipContent: tooltipContent
317
+ tooltipContent: tooltipContent,
318
+ timeZone: timeZone
291
319
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pingux/astro",
3
- "version": "1.5.1-alpha.0",
3
+ "version": "1.6.0-alpha.1",
4
4
  "description": "PingUX themeable React component library",
5
5
  "author": "ux-development@pingidentity.com",
6
6
  "license": "Apache-2.0",