@pingux/astro 2.30.0 → 2.31.0-alpha.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.
@@ -13,7 +13,10 @@ var TreeViewSection = /*#__PURE__*/forwardRef(function (props, ref) {
13
13
  var _context;
14
14
  var item = props.item,
15
15
  items = props.items,
16
- title = props.title;
16
+ title = props.title,
17
+ level = props.level,
18
+ position = props.position,
19
+ setSize = props.setSize;
17
20
  var key = item.key;
18
21
  var treeSectionRef = useRef();
19
22
  /* istanbul ignore next */
@@ -38,7 +41,10 @@ var TreeViewSection = /*#__PURE__*/forwardRef(function (props, ref) {
38
41
  }
39
42
  },
40
43
  "aria-expanded": isExpanded,
41
- "aria-disabled": isDisabled
44
+ "aria-disabled": isDisabled,
45
+ "aria-level": level,
46
+ "aria-setsize": setSize,
47
+ "aria-posinset": position + 1
42
48
  }, optionProps, {
43
49
  role: "treeitem",
44
50
  "aria-selected": isSelected
@@ -56,17 +62,23 @@ var TreeViewSection = /*#__PURE__*/forwardRef(function (props, ref) {
56
62
  sx: {
57
63
  pl: 'md'
58
64
  }
59
- }, _mapInstanceProperty(_context = _Array$from(items)).call(_context, function (_item) {
65
+ }, _mapInstanceProperty(_context = _Array$from(items)).call(_context, function (_item, _index) {
60
66
  var _item$value$items;
61
67
  return SectionOrItemRender(((_item$value$items = _item.value.items) === null || _item$value$items === void 0 ? void 0 : _item$value$items.length) > 0, ___EmotionJSX(TreeViewSection, {
62
68
  item: _item,
63
69
  items: _item.children,
64
70
  title: _item.value.title,
65
- key: _item.value.title
71
+ key: _item.value.title,
72
+ level: level + 1,
73
+ position: _index,
74
+ setSize: items.length
66
75
  }), ___EmotionJSX(TreeViewItem, {
67
76
  item: _item,
68
77
  title: _item.value.title,
69
- key: _item.value.title
78
+ key: _item.value.title,
79
+ level: level + 1,
80
+ position: _index,
81
+ setSize: items.length
70
82
  }));
71
83
  })));
72
84
  });
@@ -75,6 +87,9 @@ TreeViewSection.propTypes = {
75
87
  item: PropTypes.shape({
76
88
  key: PropTypes.string
77
89
  }),
78
- title: PropTypes.string
90
+ title: PropTypes.string,
91
+ level: PropTypes.number,
92
+ position: PropTypes.number,
93
+ setSize: PropTypes.number
79
94
  };
80
95
  export default TreeViewSection;
package/lib/index.js CHANGED
@@ -69,6 +69,7 @@ export { default as HelpHint } from './components/HelpHint';
69
69
  export * from './components/HelpHint';
70
70
  export { default as Icon } from './components/Icon';
71
71
  export * from './components/Icon';
72
+ export { NoticeIcon } from './components/Icon/NoticeIcon';
72
73
  export { default as IconBadge } from './components/IconBadge';
73
74
  export * from './components/IconBadge';
74
75
  export { default as IconButton } from './components/IconButton';
@@ -0,0 +1,477 @@
1
+ import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
2
+ import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
3
+ import _Object$keys from "@babel/runtime-corejs3/core-js-stable/object/keys";
4
+ import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
5
+ import React, { useRef } from 'react';
6
+ import { Item } from 'react-stately';
7
+ import PencilIcon from '@pingux/mdi-react/PencilIcon';
8
+ import PlusIcon from '@pingux/mdi-react/PlusIcon';
9
+ import { useOverlayPanelState } from '../hooks';
10
+ import { AccordionGroup, Badge, Box, Button, ButtonBar, CheckboxField, EditButton, Icon, Image, ImageUploadField, NoticeIcon, OverlayPanel, OverlayProvider, PanelHeader, PanelHeaderCloseButton, PanelHeaderMenu, PanelHeaderSwitchField, SelectField, Tab, Tabs, Text, TextField } from '../index';
11
+ import { FIGMA_LINKS } from '../utils/designUtils/figmaLinks.js';
12
+ import UserImage from '../utils/devUtils/assets/UserImage.png';
13
+ import statuses from '../utils/devUtils/constants/statuses';
14
+ import { jsx as ___EmotionJSX } from "@emotion/react";
15
+ export default {
16
+ title: 'Experimental/PanelContent',
17
+ parameters: {
18
+ docs: {
19
+ source: {
20
+ type: 'code'
21
+ }
22
+ }
23
+ }
24
+ };
25
+ var colorBlockButtons = [{
26
+ text: 'Groups',
27
+ subtext: '21',
28
+ isConfigured: true
29
+ }, {
30
+ text: 'Population',
31
+ subtext: 'Denver',
32
+ isConfigured: true
33
+ }, {
34
+ text: 'MFA',
35
+ subtext: 'Enabled',
36
+ isConfigured: true
37
+ }, {
38
+ text: 'Roles',
39
+ subtext: '0'
40
+ }];
41
+ var data = {
42
+ contactInfo: {
43
+ label: 'Contact Info',
44
+ key: 'contactInfoKey',
45
+ fields: [{
46
+ label: 'Email',
47
+ value: 'ednepomuceno@pingidentity.com',
48
+ isVerified: true
49
+ }, {
50
+ label: 'Primary',
51
+ value: '+1 767-777-3333'
52
+ }, {
53
+ label: 'Address',
54
+ value: '1234 W California St, Denver CO 80101'
55
+ }]
56
+ },
57
+ personalInfo: {
58
+ label: 'Personal Info',
59
+ key: 'personalInfoKey',
60
+ image: UserImage,
61
+ fields: [{
62
+ label: 'Given Name',
63
+ value: 'Ed'
64
+ }, {
65
+ label: 'Famile Name',
66
+ value: 'Nepomuceno'
67
+ }]
68
+ },
69
+ companyInfo: {
70
+ label: 'Company Info',
71
+ key: 'companyInfoKey',
72
+ fields: [{
73
+ label: 'Tile',
74
+ value: 'Interaction Designer'
75
+ }]
76
+ },
77
+ customAttributes: {
78
+ label: 'Custom Attributes',
79
+ key: 'customAttributesKey',
80
+ fields: [{
81
+ label: 'T-Shirt Size',
82
+ value: 'Large'
83
+ }, {
84
+ label: 'Example Multi-Value Attribute',
85
+ value: 'value,value,value,value,value,value,value,value,value,value,value,value,value,value,value,value,value,value,value,'
86
+ }]
87
+ },
88
+ jsonAttributes: {
89
+ label: 'JSON Attributes',
90
+ key: 'jsonAttributesKey',
91
+ badges: ['Address', 'Contact', 'Another Json'],
92
+ fields: []
93
+ }
94
+ };
95
+ var OverlayWrapper = function OverlayWrapper(_ref) {
96
+ var children = _ref.children;
97
+ var _useOverlayPanelState = useOverlayPanelState({
98
+ isDefaultOpen: true
99
+ }),
100
+ state = _useOverlayPanelState.state;
101
+ var triggerRef = useRef();
102
+ return ___EmotionJSX(OverlayProvider, null, ___EmotionJSX(Button, {
103
+ ref: triggerRef,
104
+ onPress: state.open
105
+ }, "Open Panel"), ___EmotionJSX(OverlayPanel, {
106
+ isOpen: state.isOpen,
107
+ isTransitioning: state.isTransitioning,
108
+ size: "large",
109
+ p: "0"
110
+ }, ___EmotionJSX(PanelHeader, {
111
+ data: {
112
+ image: {
113
+ src: UserImage,
114
+ alt: 'user image'
115
+ },
116
+ text: data.personalInfo.fields[0].value,
117
+ subtext: data.personalInfo.fields[1].value
118
+ }
119
+ }, ___EmotionJSX(PanelHeaderSwitchField, null), ___EmotionJSX(PanelHeaderMenu, null), ___EmotionJSX(PanelHeaderCloseButton, {
120
+ onPress: state.close
121
+ })), children));
122
+ };
123
+ export var DisplayPanel = function DisplayPanel() {
124
+ var _context, _context2;
125
+ var renderProfileTab = ___EmotionJSX(React.Fragment, null, ___EmotionJSX(Box, {
126
+ isRow: true,
127
+ gap: "md",
128
+ mb: "20px"
129
+ }, _mapInstanceProperty(colorBlockButtons).call(colorBlockButtons, function (tileData) {
130
+ return ___EmotionJSX(ColorBlockButton, {
131
+ buttonData: tileData,
132
+ key: "".concat(tileData.text, "-key")
133
+ });
134
+ })), ___EmotionJSX(Box, {
135
+ isRow: true,
136
+ justifyContent: "space-between"
137
+ }, ___EmotionJSX(AccordionGroup, {
138
+ defaultExpandedKeys: _mapInstanceProperty(_context = _Object$keys(data)).call(_context, function (item) {
139
+ return data[item].key;
140
+ }),
141
+ labelHeadingTag: "h2"
142
+ }, _mapInstanceProperty(_context2 = _Object$keys(data)).call(_context2, function (item) {
143
+ var _context3;
144
+ return ___EmotionJSX(Item, {
145
+ "data-id": data[item].label,
146
+ key: data[item].key,
147
+ label: data[item].label,
148
+ textValue: data[item].label
149
+ }, data[item].image ? ___EmotionJSX(Box, {
150
+ isRow: true,
151
+ gap: "md"
152
+ }, ___EmotionJSX(Image, {
153
+ src: UserImage,
154
+ alt: "user"
155
+ }), ___EmotionJSX(LabelValuePairs, {
156
+ fields: data[item].fields
157
+ })) : ___EmotionJSX(LabelValuePairs, {
158
+ fields: data[item].fields
159
+ }), data[item].badges && ___EmotionJSX(Box, {
160
+ isRow: true,
161
+ gap: "sm"
162
+ }, _mapInstanceProperty(_context3 = data[item].badges).call(_context3, function (badge) {
163
+ return ___EmotionJSX(Badge, {
164
+ label: badge,
165
+ variant: "defaultBadge",
166
+ key: "".concat(badge, "-key")
167
+ });
168
+ })));
169
+ })), ___EmotionJSX(EditButton, {
170
+ size: "lg"
171
+ })));
172
+ var tabs = [{
173
+ name: 'Profile',
174
+ children: renderProfileTab
175
+ }, {
176
+ name: 'Groups',
177
+ children: 'Groups'
178
+ }, {
179
+ name: 'Roles',
180
+ children: 'Roles'
181
+ }, {
182
+ name: 'Services',
183
+ list: [{
184
+ key: 'service1',
185
+ name: 'Service 1',
186
+ children: 'Service 1',
187
+ role: 'listitem'
188
+ }, {
189
+ key: 'service2',
190
+ name: 'Service 2',
191
+ children: 'Service 2',
192
+ role: 'listitem'
193
+ }]
194
+ }, {
195
+ name: 'API',
196
+ children: 'API'
197
+ }];
198
+ return ___EmotionJSX(OverlayWrapper, null, ___EmotionJSX(Box, {
199
+ p: "lg",
200
+ pt: "xs"
201
+ }, ___EmotionJSX(Tabs, {
202
+ items: tabs,
203
+ mode: "list",
204
+ tabListProps: {
205
+ justifyContent: 'center',
206
+ mb: 'lg'
207
+ }
208
+ }, function (item) {
209
+ return ___EmotionJSX(Tab, _extends({
210
+ key: item.name,
211
+ title: item.name
212
+ }, item), item.children);
213
+ })));
214
+ };
215
+ DisplayPanel.parameters = {
216
+ design: {
217
+ type: 'figma',
218
+ url: FIGMA_LINKS.panelContent.displayPanel
219
+ },
220
+ a11y: {
221
+ config: {
222
+ rules: [{
223
+ id: 'color-contrast',
224
+ enabled: false
225
+ }]
226
+ }
227
+ }
228
+ };
229
+ export var ColorBlockButton = function ColorBlockButton(_ref2) {
230
+ var _ref2$buttonData = _ref2.buttonData,
231
+ buttonData = _ref2$buttonData === void 0 ? colorBlockButtons[0] : _ref2$buttonData;
232
+ return ___EmotionJSX(Button, {
233
+ variant: "colorBlock",
234
+ className: buttonData.isConfigured ? 'is-configured' : ''
235
+ }, ___EmotionJSX(Box, null, ___EmotionJSX(Text, {
236
+ variant: "buttonTitle"
237
+ }, buttonData.text), ___EmotionJSX(Text, {
238
+ variant: "buttonSubtitle"
239
+ }, buttonData.subtext)), ___EmotionJSX(Icon, {
240
+ icon: PencilIcon,
241
+ title: {
242
+ name: 'Create Icon'
243
+ }
244
+ }));
245
+ };
246
+ export var LabelValuePairs = function LabelValuePairs(_ref3) {
247
+ var _ref3$fields = _ref3.fields,
248
+ fields = _ref3$fields === void 0 ? data.contactInfo.fields : _ref3$fields;
249
+ return ___EmotionJSX(Box, {
250
+ gap: "md",
251
+ maxWidth: "675px"
252
+ }, _mapInstanceProperty(fields).call(fields, function (_ref4) {
253
+ var label = _ref4.label,
254
+ value = _ref4.value,
255
+ isVerified = _ref4.isVerified;
256
+ return ___EmotionJSX(Box, {
257
+ gap: "xs",
258
+ key: "".concat(label, "-key")
259
+ }, ___EmotionJSX(Text, {
260
+ variant: "h4"
261
+ }, label), ___EmotionJSX(Box, {
262
+ isRow: true,
263
+ gap: "md"
264
+ }, ___EmotionJSX(Text, null, value), isVerified && ___EmotionJSX(Box, {
265
+ isRow: true,
266
+ gap: "xs"
267
+ }, ___EmotionJSX(NoticeIcon, {
268
+ color: "success.dark",
269
+ status: statuses.SUCCESS,
270
+ "aria-label": "".concat(statuses.SUCCESS, "-icon"),
271
+ size: "xs"
272
+ }), ___EmotionJSX(Text, {
273
+ variant: "listSubtitle",
274
+ color: "success.dark"
275
+ }, "Verified"))));
276
+ }));
277
+ };
278
+ var editData = {
279
+ personalInfo: {
280
+ label: 'Personal Info',
281
+ key: 'personalInfoKey',
282
+ image: UserImage,
283
+ fields: [{
284
+ label: 'Prefix',
285
+ value: ''
286
+ }, {
287
+ label: 'Given Name',
288
+ value: 'Ed'
289
+ }, {
290
+ label: 'Middle Name',
291
+ value: ''
292
+ }, {
293
+ label: 'Family Name',
294
+ value: 'Nepomuceno'
295
+ }, {
296
+ label: 'Suffix',
297
+ value: ''
298
+ }, {
299
+ label: 'Formatted',
300
+ value: ''
301
+ }, {
302
+ label: 'Nickname',
303
+ value: ''
304
+ }]
305
+ },
306
+ contactInfo: {
307
+ label: 'Contact Info',
308
+ key: 'contactInfoKey',
309
+ fields: [{
310
+ label: 'Email',
311
+ value: 'ednepomuceno@pingidentity.com',
312
+ slot: ___EmotionJSX(CheckboxField, {
313
+ mt: "xs",
314
+ label: "Require Email to be Verified"
315
+ })
316
+ }, {
317
+ label: 'Phone Number',
318
+ value: '123-456-7890'
319
+ }, {
320
+ label: 'Street Address',
321
+ value: '123 Example St'
322
+ }, {
323
+ label: 'Country Code',
324
+ value: ''
325
+ }, {
326
+ label: 'Loality',
327
+ value: ''
328
+ }, {
329
+ label: 'Region',
330
+ value: ''
331
+ }, {
332
+ label: 'Zip Code',
333
+ value: '12345'
334
+ }]
335
+ },
336
+ companyInfo: {
337
+ label: 'Company Info',
338
+ key: 'companyInfoKey',
339
+ fields: [{
340
+ label: 'Account ID',
341
+ value: ''
342
+ }, {
343
+ label: 'Type',
344
+ value: ''
345
+ }, {
346
+ label: 'Title',
347
+ value: ''
348
+ }]
349
+ }
350
+ };
351
+ export var EditPanel = function EditPanel() {
352
+ var _context4, _context5, _context6;
353
+ return ___EmotionJSX(OverlayWrapper, null, ___EmotionJSX(Box, {
354
+ p: "lg",
355
+ pb: "0"
356
+ }, ___EmotionJSX(Box, {
357
+ gap: "md",
358
+ mb: "20px",
359
+ width: "500px"
360
+ }, ___EmotionJSX(TextField, {
361
+ defaultValue: "ednepomuceno",
362
+ isRequired: true,
363
+ label: "Username"
364
+ }), ___EmotionJSX(SelectField, {
365
+ label: "Population",
366
+ isRequired: true,
367
+ defaultSelectedKey: "population"
368
+ }, ___EmotionJSX(Item, {
369
+ key: "population"
370
+ }, "Denver"))), ___EmotionJSX(AccordionGroup, {
371
+ defaultExpandedKeys: _concatInstanceProperty(_context4 = []).call(_context4, _mapInstanceProperty(_context5 = _Object$keys(editData)).call(_context5, function (item) {
372
+ return editData[item].key;
373
+ }), ['preferencesKey', 'customAttributesKey', 'jsonAttributesKey']),
374
+ labelHeadingTag: "h2"
375
+ }, _mapInstanceProperty(_context6 = _Object$keys(editData)).call(_context6, function (item) {
376
+ var _context7;
377
+ return ___EmotionJSX(Item, {
378
+ "data-id": editData[item].label,
379
+ key: editData[item].key,
380
+ label: editData[item].label,
381
+ textValue: editData[item].label
382
+ }, ___EmotionJSX(Box, {
383
+ gap: "md",
384
+ width: "500px"
385
+ }, editData[item].image && ___EmotionJSX(ImageUploadField, {
386
+ label: "Photo",
387
+ previewHeight: 40,
388
+ previewWidth: 40,
389
+ previewImage: UserImage
390
+ }), _mapInstanceProperty(_context7 = editData[item].fields).call(_context7, function (_ref5) {
391
+ var label = _ref5.label,
392
+ value = _ref5.value,
393
+ slot = _ref5.slot;
394
+ return ___EmotionJSX(Box, {
395
+ key: "".concat(label, "-key")
396
+ }, ___EmotionJSX(TextField, {
397
+ label: label,
398
+ defaultValue: value
399
+ }), slot);
400
+ })));
401
+ }), ___EmotionJSX(Item, {
402
+ "data-id": "preferences",
403
+ key: "preferencesKey",
404
+ label: "Preferences",
405
+ textValue: "Preferences"
406
+ }, ___EmotionJSX(Box, {
407
+ gap: "md",
408
+ width: "500px"
409
+ }, ___EmotionJSX(SelectField, {
410
+ label: "Preferred Language",
411
+ defaultSelectedKey: "language"
412
+ }, ___EmotionJSX(Item, {
413
+ key: "language"
414
+ }, "Select a Language")), ___EmotionJSX(SelectField, {
415
+ label: "Locale",
416
+ defaultSelectedKey: "language"
417
+ }, ___EmotionJSX(Item, {
418
+ key: "language"
419
+ }, "Select a locale")), ___EmotionJSX(SelectField, {
420
+ label: "Timezone",
421
+ defaultSelectedKey: "language"
422
+ }, ___EmotionJSX(Item, {
423
+ key: "language"
424
+ }, "Select a timezone")))), ___EmotionJSX(Item, {
425
+ "data-id": "customAttributes",
426
+ key: "customAttributesKey",
427
+ label: "Custom Attributes",
428
+ textValue: "Custom Attributes"
429
+ }, ___EmotionJSX(AddAttributeButton, null), ___EmotionJSX(Text, {
430
+ fontWeight: "-1",
431
+ fontSize: "md",
432
+ textAlign: "center"
433
+ }, "Click + Add to select a custom attribute")), ___EmotionJSX(Item, {
434
+ "data-id": "jsonAttributes",
435
+ key: "jsonAttributesKey",
436
+ label: "JSON Attributes",
437
+ textValue: "JSON Attributes"
438
+ }, ___EmotionJSX(AddAttributeButton, null), ___EmotionJSX(Text, {
439
+ fontWeight: "-1",
440
+ fontSize: "md",
441
+ textAlign: "center"
442
+ }, "Click + Add to select a JSON attribute")))), ___EmotionJSX(ButtonBar, null, ___EmotionJSX(Button, {
443
+ variant: "primary"
444
+ }, "Save"), ___EmotionJSX(Button, {
445
+ variant: "link"
446
+ }, "Cancel")));
447
+ };
448
+ EditPanel.parameters = {
449
+ design: {
450
+ type: 'figma',
451
+ url: FIGMA_LINKS.panelContent.editPanel
452
+ },
453
+ a11y: {
454
+ config: {
455
+ rules: [{
456
+ id: 'color-contrast',
457
+ enabled: false
458
+ }]
459
+ }
460
+ }
461
+ };
462
+ export var AddAttributeButton = function AddAttributeButton() {
463
+ return ___EmotionJSX(Box, {
464
+ sx: {
465
+ position: 'relative',
466
+ left: '700px',
467
+ top: '-35px',
468
+ width: 0,
469
+ height: 0
470
+ }
471
+ }, ___EmotionJSX(Button, {
472
+ variant: "inlineWithIcon"
473
+ }, ___EmotionJSX(Icon, {
474
+ icon: PlusIcon,
475
+ size: "xs"
476
+ }), "Add"));
477
+ };
@@ -101,6 +101,10 @@ export var FIGMA_LINKS = {
101
101
  OnewayToBidirectionalArrow: {
102
102
  "default": 'https://www.figma.com/file/bpbEw54gTTcdIiZs4PKK1p/Astro-Specs?type=design&node-id=43504-1214&mode=design&t=R4kdj0liRHxsqbV5-0'
103
103
  },
104
+ panelContent: {
105
+ displayPanel: 'https://www.figma.com/file/bpbEw54gTTcdIiZs4PKK1p/Astro-Specs?node-id=43431%3A4249&mode=dev',
106
+ editPanel: 'https://www.figma.com/file/bpbEw54gTTcdIiZs4PKK1p/Astro-Specs?node-id=5013%3A15377&mode=dev'
107
+ },
104
108
  panelHeader: {
105
109
  "default": 'https://www.figma.com/file/bpbEw54gTTcdIiZs4PKK1p/Astro-Specs?type=design&node-id=44688%3A39612&mode=dev',
106
110
  withSubtext: 'https://www.figma.com/file/bpbEw54gTTcdIiZs4PKK1p/Astro-Specs?node-id=44688%3A39651&mode=dev',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pingux/astro",
3
- "version": "2.30.0",
3
+ "version": "2.31.0-alpha.0",
4
4
  "description": "React component library for Ping Identity's design system",
5
5
  "repository": {
6
6
  "type": "git",