@pingux/astro 1.24.1-alpha.3 → 1.25.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.
@@ -0,0 +1,302 @@
1
+ import _findIndexInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/find-index";
2
+ import _slicedToArray from "@babel/runtime-corejs3/helpers/esm/slicedToArray";
3
+ import React, { useRef, useState } from 'react';
4
+ import { FocusScope } from '@react-aria/focus';
5
+ import { Item } from '@react-stately/collections';
6
+ import CloseIcon from 'mdi-react/CloseIcon';
7
+ import MoreVertIcon from 'mdi-react/MoreVertIcon';
8
+ import PencilIcon from 'mdi-react/PencilIcon';
9
+ import { Avatar, Box, IconButton, ListView, Menu, OverlayPanel, PopoverMenu, SearchField, Separator, SwitchField, Tab, Tabs, Text } from '../index';
10
+ import { useOverlayPanelState } from '../hooks';
11
+ import { pingImg } from '../utils/devUtils/constants/images';
12
+ import { jsx as ___EmotionJSX } from "@emotion/react";
13
+ export default {
14
+ title: 'Recipes/List with Panel'
15
+ };
16
+ var items = [{
17
+ email: 'dburkitt5@columbia.edu',
18
+ firstName: 'Nicola',
19
+ lastName: 'Burkitt',
20
+ avatar: pingImg
21
+ }, {
22
+ email: 'idixie2@elegantthemes.com',
23
+ firstName: 'Cacilia',
24
+ lastName: 'Dixie',
25
+ avatar: pingImg
26
+ }, {
27
+ email: 'dfowler0@rambler.ru',
28
+ firstName: 'Stavro',
29
+ lastName: 'Fowler',
30
+ avatar: pingImg
31
+ }, {
32
+ email: 'jgolde8@jimdo.com',
33
+ firstName: 'Celisse',
34
+ lastName: 'Golde',
35
+ avatar: pingImg
36
+ }, {
37
+ email: 'shearst9@answers.com',
38
+ firstName: 'Jeth',
39
+ lastName: 'Hearst',
40
+ avatar: pingImg
41
+ }, {
42
+ email: 'ajinaa@mapquest.com',
43
+ firstName: 'Kaycee',
44
+ lastName: 'Jina',
45
+ avatar: pingImg
46
+ }, {
47
+ email: 'vmalster4@biblegateway.com',
48
+ firstName: 'Lorry',
49
+ lastName: 'Malster',
50
+ avatar: pingImg
51
+ }, {
52
+ email: 'yphipp6@yellowpages.com',
53
+ firstName: 'Stanley',
54
+ lastName: 'Phipp',
55
+ avatar: pingImg
56
+ }, {
57
+ email: 'mskilbeck3@bbc.co.uk',
58
+ firstName: 'Gradey',
59
+ lastName: 'Skilbeck',
60
+ avatar: pingImg
61
+ }, {
62
+ email: 'dstebbing1@msu.edu',
63
+ firstName: 'Marnia',
64
+ lastName: 'Stebbing',
65
+ avatar: pingImg
66
+ }, {
67
+ email: 'lsterley7@lulu.com',
68
+ firstName: 'Joshua',
69
+ lastName: 'Sterley',
70
+ avatar: pingImg
71
+ }, {
72
+ email: 'luttleyb@hugedomains.com',
73
+ firstName: 'Jarrod',
74
+ lastName: 'Uttley',
75
+ avatar: pingImg
76
+ }, {
77
+ email: 'lidelc@yelp.com',
78
+ firstName: 'Andromache',
79
+ lastName: 'Idel',
80
+ avatar: pingImg,
81
+ hasSeparator: false
82
+ }];
83
+
84
+ var ListElement = function ListElement(_ref) {
85
+ var item = _ref.item,
86
+ onClosePanel = _ref.onClosePanel;
87
+ return ___EmotionJSX(Box, {
88
+ isRow: true,
89
+ minHeight: "60px"
90
+ }, ___EmotionJSX(Box, {
91
+ isRow: true,
92
+ mr: "auto",
93
+ alignItems: "center"
94
+ }, ___EmotionJSX(Avatar, {
95
+ mr: "md",
96
+ sx: {
97
+ width: '25px',
98
+ height: '25px'
99
+ },
100
+ src: item.avatar
101
+ }), ___EmotionJSX(Box, null, ___EmotionJSX(Text, {
102
+ variant: "bodyStrong",
103
+ alignSelf: "start"
104
+ }, item.lastName, ", ", item.firstName), ___EmotionJSX(Text, {
105
+ sx: {
106
+ fontSize: 'sm',
107
+ my: '1px',
108
+ lineHeight: '16px'
109
+ },
110
+ variant: "subtitle",
111
+ alignSelf: "start"
112
+ }, item.email))), ___EmotionJSX(Box, {
113
+ isRow: true,
114
+ alignSelf: "center"
115
+ }, ___EmotionJSX(SwitchField, {
116
+ "aria-label": "active user",
117
+ isDefaultSelected: true,
118
+ alignSelf: "center",
119
+ mr: "sm"
120
+ }), ___EmotionJSX(PopoverMenu, null, ___EmotionJSX(IconButton, {
121
+ "aria-label": "more icon button",
122
+ mr: onClosePanel ? 'sm' : 0
123
+ }, ___EmotionJSX(MoreVertIcon, null)), ___EmotionJSX(Menu, null, ___EmotionJSX(Item, {
124
+ key: "enable"
125
+ }, "Enable user"), ___EmotionJSX(Item, {
126
+ key: "disable"
127
+ }, "Disable user"), ___EmotionJSX(Item, {
128
+ key: "delete"
129
+ }, "Delete user"))), onClosePanel && ___EmotionJSX(IconButton, {
130
+ "aria-label": "close icon button",
131
+ onPress: onClosePanel
132
+ }, ___EmotionJSX(CloseIcon, null))));
133
+ };
134
+
135
+ export var Default = function Default() {
136
+ var _useState = useState(),
137
+ _useState2 = _slicedToArray(_useState, 2),
138
+ selectedItemId = _useState2[0],
139
+ setSelectedItemId = _useState2[1];
140
+
141
+ var _useState3 = useState(),
142
+ _useState4 = _slicedToArray(_useState3, 2),
143
+ selectedKeys = _useState4[0],
144
+ setSelectedKeys = _useState4[1];
145
+
146
+ var _useOverlayPanelState = useOverlayPanelState(),
147
+ panelState = _useOverlayPanelState.state,
148
+ onPanelClose = _useOverlayPanelState.onClose;
149
+
150
+ var panelTriggerRef = useRef();
151
+
152
+ var closePanelHandler = function closePanelHandler() {
153
+ onPanelClose(panelState, panelTriggerRef);
154
+ setSelectedItemId(-1);
155
+ setSelectedKeys([]);
156
+ };
157
+
158
+ var selectItemHandler = function selectItemHandler(e) {
159
+ if (e.size) {
160
+ setSelectedItemId(_findIndexInstanceProperty(items).call(items, function (item) {
161
+ return item.email === e.currentKey;
162
+ }));
163
+ setSelectedKeys([e.currentKey]);
164
+ panelState.open();
165
+ } else {
166
+ closePanelHandler();
167
+ }
168
+ };
169
+
170
+ return ___EmotionJSX(Box, {
171
+ px: "lg",
172
+ py: "lg",
173
+ bg: "accent.99"
174
+ }, ___EmotionJSX(SearchField, {
175
+ mb: "sm",
176
+ width: "400px",
177
+ placeholder: "Search",
178
+ "aria-label": "search"
179
+ }), ___EmotionJSX(ListView, {
180
+ items: items,
181
+ onSelectionChange: selectItemHandler,
182
+ ref: panelTriggerRef,
183
+ selectedKeys: selectedKeys
184
+ }, function (item) {
185
+ return ___EmotionJSX(Item, {
186
+ key: item.email,
187
+ textValue: item.email,
188
+ hasSeparator: item.hasSeparator,
189
+ listItemProps: {
190
+ pl: 15,
191
+ minHeight: 75
192
+ }
193
+ }, ___EmotionJSX(ListElement, {
194
+ item: item
195
+ }));
196
+ }), ___EmotionJSX(OverlayPanel, {
197
+ isOpen: panelState.isOpen,
198
+ state: panelState,
199
+ triggerRef: panelTriggerRef,
200
+ p: 0
201
+ }, panelState.isOpen && ___EmotionJSX(React.Fragment, null, ___EmotionJSX(FocusScope, {
202
+ contain: true,
203
+ restoreFocus: true,
204
+ autoFocus: true
205
+ }, ___EmotionJSX(Box, {
206
+ px: "md",
207
+ bg: "accent.99",
208
+ justifyContent: "center"
209
+ }, ___EmotionJSX(ListElement, {
210
+ item: selectedItemId >= 0 ? items[selectedItemId] : [],
211
+ onClosePanel: closePanelHandler
212
+ })), ___EmotionJSX(Separator, {
213
+ margin: 0,
214
+ bg: "accent.90"
215
+ }), ___EmotionJSX(Box, {
216
+ px: "lg",
217
+ pt: "xs"
218
+ }, ___EmotionJSX(Tabs, {
219
+ tabListProps: {
220
+ justifyContent: 'center'
221
+ },
222
+ tabPanelProps: {
223
+ sx: {
224
+ position: 'relative'
225
+ }
226
+ }
227
+ }, ___EmotionJSX(Tab, {
228
+ title: "Profile"
229
+ }, selectedItemId >= 0 && ___EmotionJSX(React.Fragment, null, ___EmotionJSX(IconButton, {
230
+ sx: {
231
+ position: 'absolute',
232
+ top: 0,
233
+ right: 0
234
+ }
235
+ }, ___EmotionJSX(PencilIcon, {
236
+ size: 20
237
+ })), ___EmotionJSX(Text, {
238
+ sx: {
239
+ fontSize: 'sm',
240
+ fontWeight: 3,
241
+ lineHeight: '16px'
242
+ },
243
+ variant: "base",
244
+ mb: "xs"
245
+ }, "Full Name"), ___EmotionJSX(Text, {
246
+ sx: {
247
+ fontWeight: 0,
248
+ lineHeight: '18px'
249
+ },
250
+ variant: "base",
251
+ mb: "md"
252
+ }, items[selectedItemId].firstName, " ", items[selectedItemId].lastName), ___EmotionJSX(Text, {
253
+ sx: {
254
+ fontSize: 'sm',
255
+ fontWeight: 3,
256
+ lineHeight: '16px'
257
+ },
258
+ variant: "base",
259
+ mb: "xs"
260
+ }, "First Name"), ___EmotionJSX(Text, {
261
+ sx: {
262
+ fontWeight: 0,
263
+ lineHeight: '18px'
264
+ },
265
+ variant: "base",
266
+ mb: "md"
267
+ }, items[selectedItemId].firstName), ___EmotionJSX(Text, {
268
+ sx: {
269
+ fontSize: 'sm',
270
+ fontWeight: 3,
271
+ lineHeight: '16px'
272
+ },
273
+ variant: "base",
274
+ mb: "xs"
275
+ }, "Last Name"), ___EmotionJSX(Text, {
276
+ sx: {
277
+ fontWeight: 0,
278
+ lineHeight: '18px'
279
+ },
280
+ variant: "base",
281
+ mb: "md"
282
+ }, items[selectedItemId].lastName), ___EmotionJSX(Text, {
283
+ sx: {
284
+ fontSize: 'sm',
285
+ fontWeight: 3,
286
+ lineHeight: '16px'
287
+ },
288
+ variant: "base",
289
+ mb: "xs"
290
+ }, "Email"), ___EmotionJSX(Text, {
291
+ sx: {
292
+ fontWeight: 0,
293
+ lineHeight: '18px'
294
+ },
295
+ variant: "base",
296
+ mb: "md"
297
+ }, items[selectedItemId].email))), ___EmotionJSX(Tab, {
298
+ title: "Group Memberships"
299
+ }, ___EmotionJSX(Text, null, "Group Memberships")), ___EmotionJSX(Tab, {
300
+ title: "Account Info"
301
+ }, ___EmotionJSX(Text, null, "Account Info"))))))));
302
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pingux/astro",
3
- "version": "1.24.1-alpha.3",
3
+ "version": "1.25.0",
4
4
  "description": "PingUX themeable React component library",
5
5
  "author": "ux-development@pingidentity.com",
6
6
  "license": "Apache-2.0",
@@ -36,6 +36,7 @@
36
36
  "@emotion/babel-preset-css-prop": "^11.2.0",
37
37
  "@emotion/cache": "^11.4.0",
38
38
  "@emotion/eslint-plugin": "^11.2.0",
39
+ "@faker-js/faker": "^7.1.0",
39
40
  "@storybook/addon-a11y": "^6.4.19",
40
41
  "@storybook/addon-actions": "^6.4.19",
41
42
  "@storybook/addon-console": "^1.2.3",
@@ -57,7 +58,6 @@
57
58
  "eslint-plugin-jest-dom": "^3.9.0",
58
59
  "eslint-plugin-react-hooks": "^2.5.1",
59
60
  "eslint-plugin-testing-library": "^4.6.0",
60
- "faker": "5.1.0",
61
61
  "jest-axe": "^5.0.1",
62
62
  "jest-emotion": "^11.0.0",
63
63
  "mutationobserver-shim": "^0.3.7",