@pingux/astro 2.27.0 → 2.27.1-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.
@@ -1,47 +1,46 @@
1
- import _includesInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/includes";
2
- import _Array$from from "@babel/runtime-corejs3/core-js-stable/array/from";
1
+ import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
3
2
  import React, { forwardRef, useImperativeHandle, useRef } from 'react';
4
3
  import FileIcon from '@pingux/mdi-react/FileIcon';
4
+ import { useOption } from '@react-aria/listbox';
5
5
  import PropTypes from 'prop-types';
6
6
  import { useTreeViewContext } from '../../context/TreeViewContext';
7
7
  import { Box } from '../../index';
8
8
  import TreeViewRow from './TreeViewRow';
9
9
  import { jsx as ___EmotionJSX } from "@emotion/react";
10
10
  var TreeViewItem = /*#__PURE__*/forwardRef(function (props, ref) {
11
- var _context, _context2, _context3;
12
11
  var item = props.item,
13
12
  title = props.title;
13
+ var key = item.key;
14
14
  var treeItemRef = useRef();
15
15
  /* istanbul ignore next */
16
16
  useImperativeHandle(ref, function () {
17
17
  return treeItemRef.current;
18
18
  });
19
19
  var _useTreeViewContext = useTreeViewContext(),
20
- state = _useTreeViewContext.state,
21
- tree = _useTreeViewContext.tree;
22
- var isExpanded = _includesInstanceProperty(_context = _Array$from(state.expandedKeys)).call(_context, item.key);
23
- var isSelected = _includesInstanceProperty(_context2 = _Array$from(tree.selectedKeys)).call(_context2, item.key);
24
- var isDisabled = _includesInstanceProperty(_context3 = _Array$from(state.disabledKeys)).call(_context3, item.key);
25
-
26
- // this component may seem unnecessary, but it will be where the
27
- // useOption and dragAndDrop stuff will go
28
- // this comment will be removed at that time.
29
-
30
- return ___EmotionJSX(Box, {
20
+ state = _useTreeViewContext.state;
21
+ var _useOption = useOption({
22
+ key: key
23
+ }, state, treeItemRef),
24
+ optionProps = _useOption.optionProps,
25
+ isSelected = _useOption.isSelected,
26
+ isDisabled = _useOption.isDisabled;
27
+ var isExpanded = state.expandedKeys.has(key);
28
+ return ___EmotionJSX(Box, _extends({
31
29
  as: "li",
32
30
  isRow: true,
33
31
  ref: treeItemRef,
32
+ "aria-disabled": isDisabled
33
+ }, optionProps, {
34
34
  role: "treeitem",
35
- "aria-selected": isSelected,
36
- "aria-disabled": isDisabled,
37
35
  sx: {
38
36
  width: '100%',
39
37
  ml: '36px',
40
38
  ':not(:last-child)': {
41
39
  pb: 'sm'
42
40
  }
43
- }
44
- }, ___EmotionJSX(TreeViewRow, {
41
+ },
42
+ "aria-selected": isSelected
43
+ }), ___EmotionJSX(TreeViewRow, {
45
44
  item: item,
46
45
  title: title,
47
46
  mainIcon: FileIcon,
@@ -1,7 +1,8 @@
1
- import _includesInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/includes";
2
- import _Array$from from "@babel/runtime-corejs3/core-js-stable/array/from";
1
+ import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
3
2
  import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
3
+ import _Array$from from "@babel/runtime-corejs3/core-js-stable/array/from";
4
4
  import React, { forwardRef, useImperativeHandle, useRef } from 'react';
5
+ import { useOption } from '@react-aria/listbox';
5
6
  import PropTypes from 'prop-types';
6
7
  import { useTreeViewContext } from '../../context/TreeViewContext';
7
8
  import { Box, TreeViewItem } from '../../index';
@@ -9,22 +10,26 @@ import { SectionOrItemRender } from './TreeView';
9
10
  import TreeViewRow from './TreeViewRow';
10
11
  import { jsx as ___EmotionJSX } from "@emotion/react";
11
12
  var TreeViewSection = /*#__PURE__*/forwardRef(function (props, ref) {
12
- var _context, _context2, _context3, _context4;
13
+ var _context;
13
14
  var item = props.item,
14
15
  items = props.items,
15
16
  title = props.title;
17
+ var key = item.key;
16
18
  var treeSectionRef = useRef();
17
19
  /* istanbul ignore next */
18
20
  useImperativeHandle(ref, function () {
19
21
  return treeSectionRef.current;
20
22
  });
21
23
  var _useTreeViewContext = useTreeViewContext(),
22
- state = _useTreeViewContext.state,
23
- tree = _useTreeViewContext.tree;
24
- var isExpanded = _includesInstanceProperty(_context = _Array$from(state.expandedKeys)).call(_context, item.key);
25
- var isSelected = _includesInstanceProperty(_context2 = _Array$from(tree.selectedKeys)).call(_context2, item.key);
26
- var isDisabled = _includesInstanceProperty(_context3 = _Array$from(state.disabledKeys)).call(_context3, item.key);
27
- return ___EmotionJSX(Box, {
24
+ state = _useTreeViewContext.state;
25
+ var _useOption = useOption({
26
+ key: key
27
+ }, state, treeSectionRef),
28
+ optionProps = _useOption.optionProps,
29
+ isDisabled = _useOption.isDisabled,
30
+ isSelected = _useOption.isSelected;
31
+ var isExpanded = state.expandedKeys.has(key);
32
+ return ___EmotionJSX(Box, _extends({
28
33
  ref: treeSectionRef,
29
34
  as: "li",
30
35
  sx: {
@@ -32,11 +37,12 @@ var TreeViewSection = /*#__PURE__*/forwardRef(function (props, ref) {
32
37
  pb: 'sm'
33
38
  }
34
39
  },
35
- role: "treeitem",
36
40
  "aria-expanded": isExpanded,
37
- "aria-selected": isSelected,
38
41
  "aria-disabled": isDisabled
39
- }, ___EmotionJSX(TreeViewRow, {
42
+ }, optionProps, {
43
+ role: "treeitem",
44
+ "aria-selected": isSelected
45
+ }), ___EmotionJSX(TreeViewRow, {
40
46
  item: item,
41
47
  title: title,
42
48
  items: items,
@@ -50,7 +56,7 @@ var TreeViewSection = /*#__PURE__*/forwardRef(function (props, ref) {
50
56
  sx: {
51
57
  pl: 'md'
52
58
  }
53
- }, _mapInstanceProperty(_context4 = _Array$from(items)).call(_context4, function (_item) {
59
+ }, _mapInstanceProperty(_context = _Array$from(items)).call(_context, function (_item) {
54
60
  var _item$value$items;
55
61
  return SectionOrItemRender(((_item$value$items = _item.value.items) === null || _item$value$items === void 0 ? void 0 : _item$value$items.length) > 0, ___EmotionJSX(TreeViewSection, {
56
62
  item: _item,
@@ -1,22 +1,10 @@
1
- import _defineProperty from "@babel/runtime-corejs3/helpers/esm/defineProperty";
2
1
  import _slicedToArray from "@babel/runtime-corejs3/helpers/esm/slicedToArray";
3
2
  import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
4
- function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
5
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context3, _context4; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context3 = ownKeys(Object(source), !0)).call(_context3, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context4 = ownKeys(Object(source))).call(_context4, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
6
- import _includesInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/includes";
7
- import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
8
- import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
9
3
  import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
10
- import _Object$keys from "@babel/runtime-corejs3/core-js-stable/object/keys";
11
- import _Object$getOwnPropertySymbols from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols";
12
- import _Object$getOwnPropertyDescriptor from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor";
13
- import _forEachInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/for-each";
14
- import _Object$getOwnPropertyDescriptors from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors";
15
- import _Object$defineProperties from "@babel/runtime-corejs3/core-js-stable/object/define-properties";
16
- import _Object$defineProperty from "@babel/runtime-corejs3/core-js-stable/object/define-property";
17
- import React, { useEffect, useRef, useState } from 'react';
4
+ import React, { useState } from 'react';
18
5
  import CheckCircleIcon from '@pingux/mdi-react/CheckCircleIcon';
19
6
  import { Box, Icon, IconButton, Link, Separator, Text } from '../index';
7
+ import { FIGMA_LINKS } from '../utils/designUtils/figmaLinks.js';
20
8
  import { jsx as ___EmotionJSX } from "@emotion/react";
21
9
  export default {
22
10
  title: 'Recipes/Trial Experience Nav'
@@ -66,36 +54,53 @@ var EarthCircleIcon = function EarthCircleIcon() {
66
54
  };
67
55
  var RadioButtonIcon = function RadioButtonIcon(props) {
68
56
  return ___EmotionJSX("svg", _extends({
69
- "data-name": "Layer 1",
57
+ viewBox: "0 0 22 22",
58
+ fill: "none",
70
59
  xmlns: "http://www.w3.org/2000/svg",
71
- viewBox: "0 0 17.5 17.5",
72
60
  "aria-labelledby": "radio-button-icon-title"
73
61
  }, props), ___EmotionJSX("title", {
74
62
  id: "radio-button-icon-title"
75
63
  }, "Radio Button Icon"), ___EmotionJSX("path", {
76
- className: "cls-1",
77
- fill: "#B3BEE8",
78
- d: "M9,18.25A8.75,8.75,0,1,1,17.75,9.5,8.76,8.76,0,0,1,9,18.25ZM9,1.75A7.75,7.75,0,1,0,16.75,9.5,7.76,7.76,0,0,0,9,1.75Z",
79
- transform: "translate(-0.25 -0.75)"
64
+ d: "M11 18.3333C9.05508 18.3333 7.18982 17.5607 5.81455 16.1854C4.43928 14.8102 3.66667 12.9449 3.66667 11C3.66667 9.05507 4.43928 7.18981 5.81455 5.81455C7.18982 4.43928 9.05508 3.66666 11 3.66666C12.9449 3.66666 14.8102 4.43928 16.1854 5.81455C17.5607 7.18981 18.3333 9.05507 18.3333 11C18.3333 12.9449 17.5607 14.8102 16.1854 16.1854C14.8102 17.5607 12.9449 18.3333 11 18.3333ZM11 1.83333C9.79621 1.83333 8.60422 2.07043 7.49207 2.5311C6.37992 2.99177 5.36939 3.66698 4.51819 4.51818C2.7991 6.23727 1.83333 8.56884 1.83333 11C1.83333 13.4311 2.7991 15.7627 4.51819 17.4818C5.36939 18.333 6.37992 19.0082 7.49207 19.4689C8.60422 19.9296 9.79621 20.1667 11 20.1667C13.4311 20.1667 15.7627 19.2009 17.4818 17.4818C19.2009 15.7627 20.1667 13.4311 20.1667 11C20.1667 9.79621 19.9296 8.60421 19.4689 7.49206C19.0082 6.37991 18.333 5.36939 17.4818 4.51818C16.6306 3.66698 15.6201 2.99177 14.5079 2.5311C13.3958 2.07043 12.2038 1.83333 11 1.83333Z",
65
+ fill: "#B3BEE8"
80
66
  }), ___EmotionJSX("circle", {
81
- className: "cls-2",
82
- cx: "8.75",
83
- cy: "8.75",
84
- r: "8.05",
67
+ cx: "11",
68
+ cy: "11",
69
+ r: "8",
85
70
  fill: "white"
86
71
  }));
87
72
  };
73
+ var IntegrateYourAppIcon = function IntegrateYourAppIcon(props) {
74
+ return ___EmotionJSX("svg", _extends({
75
+ width: "24",
76
+ height: "24",
77
+ viewBox: "0 0 24 24",
78
+ fill: "none",
79
+ xmlns: "http://www.w3.org/2000/svg",
80
+ "aria-labelledby": "integrate-your-app-icon-title"
81
+ }, props), ___EmotionJSX("title", {
82
+ id: "integrate-your-app-icon-title"
83
+ }, "Integrate Your App Icon"), ___EmotionJSX("path", {
84
+ d: "M2 5H5V8H2V5ZM8.98124 9.18922C8.40906 8.51487 7.5878 8 6 8V5C8.4122 5 10.0909 5.86013 11.2688 7.24828C12.3198 8.48703 12.8987 10.0806 13.3691 11.3758L13.4097 11.4874C13.9318 12.9231 14.3502 14.0229 15.0188 14.8108C15.5909 15.4851 16.4122 16 18 16V19H6V16H11.0563C10.9745 15.8905 10.8976 15.7846 10.8245 15.6841L10.7869 15.6323C10.2778 14.9323 9.93844 14.4905 9.36346 14.1517C8.79448 13.8164 7.83564 13.5 6 13.5V10.5C7.7039 10.5 9.02155 10.73 10.0813 11.1674C9.7558 10.3671 9.42315 9.71004 8.98124 9.18922ZM5 10.5H2V13.5H5V10.5ZM2 16H5V19H2V16ZM22 16H19V19H22V16Z",
85
+ fill: "#FF8324"
86
+ }));
87
+ };
88
88
  var data = [{
89
89
  title: 'Design a Solution',
90
90
  icon: ArtIcon,
91
91
  iconTitle: 'Art Icon',
92
92
  key: 0,
93
93
  links: [{
94
+ isLinkSelected: true,
94
95
  title: 'Registration'
95
96
  }, {
97
+ isLinkSelected: true,
96
98
  title: 'Authentication'
97
99
  }, {
100
+ isLinkSelected: true,
98
101
  title: 'Profile management'
102
+ }, {
103
+ title: 'Account recovery'
99
104
  }, {
100
105
  title: 'Experience your solution'
101
106
  }]
@@ -119,6 +124,9 @@ var data = [{
119
124
  iconTitle: 'Earth Circle Icon',
120
125
  key: 2,
121
126
  links: [{
127
+ customIcon: IntegrateYourAppIcon,
128
+ title: 'Integrate your app'
129
+ }, {
122
130
  title: 'Learn about DaVinci'
123
131
  }, {
124
132
  title: 'View a workflow'
@@ -131,7 +139,11 @@ var sx = {
131
139
  justifyContent: 'center',
132
140
  mr: 'sm',
133
141
  borderRadius: '50%',
134
- zIndex: 3
142
+ zIndex: 3,
143
+ '& > svg ': {
144
+ width: '28px',
145
+ height: '28px'
146
+ }
135
147
  },
136
148
  headingSeparator: {
137
149
  flexGrow: 1,
@@ -146,7 +158,7 @@ var sx = {
146
158
  color: 'accent.30',
147
159
  lineHeight: '18px',
148
160
  fontWeight: '3',
149
- m: '12px 0px 28px 5px',
161
+ m: '12px 0px 28px 0px',
150
162
  maxWidth: '195px'
151
163
  },
152
164
  linkRowIconButton: {
@@ -174,19 +186,12 @@ var sx = {
174
186
  fill: 'accent.80'
175
187
  }
176
188
  },
177
- linkRowSeparator: {
178
- flexGrow: 1,
179
- backgroundColor: 'accent.30',
180
- width: '1px !important',
181
- zIndex: 2,
182
- m: '-4px 5px -5px 11.5px !important'
183
- },
184
189
  linkRowText: {
185
190
  fontSize: 'md',
186
191
  color: '#163CE3',
187
192
  lineHeight: '18px',
188
193
  fontWeight: '0',
189
- m: '3px 0px 20px 10px',
194
+ m: '3px 0px 15px 10px',
190
195
  maxWidth: '140px'
191
196
  },
192
197
  container: {
@@ -204,26 +209,11 @@ var Stage = function Stage(_ref) {
204
209
  iconTitle = _ref.iconTitle,
205
210
  links = _ref.links,
206
211
  isLastStage = _ref.isLastStage;
207
- var _useState = useState([]),
208
- _useState2 = _slicedToArray(_useState, 2),
209
- selectedLinks = _useState2[0],
210
- updateSelectedLinks = _useState2[1];
211
- var onSelectionChange = function onSelectionChange(thisIndex) {
212
- var _context2;
213
- var newArray = [];
214
- if (_includesInstanceProperty(selectedLinks).call(selectedLinks, thisIndex)) {
215
- newArray = _filterInstanceProperty(selectedLinks).call(selectedLinks, function (link) {
216
- return link !== thisIndex;
217
- });
218
- } else {
219
- var _context;
220
- newArray = _concatInstanceProperty(_context = []).call(_context, selectedLinks, [thisIndex]);
221
- }
222
- updateSelectedLinks(_concatInstanceProperty(_context2 = []).call(_context2, newArray));
223
- };
224
212
  return ___EmotionJSX(Box, {
225
213
  isRow: true
226
- }, ___EmotionJSX(Box, null, ___EmotionJSX(Box, {
214
+ }, ___EmotionJSX(Box, {
215
+ mr: "xs"
216
+ }, ___EmotionJSX(Box, {
227
217
  minWidth: "39.5px",
228
218
  minHeight: "39.5px",
229
219
  sx: sx.iconContainer
@@ -233,7 +223,7 @@ var Stage = function Stage(_ref) {
233
223
  name: iconTitle
234
224
  },
235
225
  color: "accent.40",
236
- size: "24px",
226
+ size: "15px",
237
227
  sx: {
238
228
  zIndex: 3
239
229
  }
@@ -245,66 +235,40 @@ var Stage = function Stage(_ref) {
245
235
  }, title), ___EmotionJSX(Box, {
246
236
  pl: "0px",
247
237
  mb: "25px"
248
- }, _mapInstanceProperty(links).call(links, function (link, index) {
238
+ }, _mapInstanceProperty(links).call(links, function (link) {
249
239
  return ___EmotionJSX(LinkRow, _extends({}, link, {
250
- onSelectionChange: onSelectionChange,
251
- index: index,
252
- isLinkSelected: selectedLinks.length !== 0,
253
- isLastLink: index === links.length - 1,
254
240
  key: link.title
255
241
  }));
256
242
  }))));
257
243
  };
258
244
  var LinkRow = function LinkRow(_ref2) {
259
- var index = _ref2.index,
260
- isLastLink = _ref2.isLastLink,
245
+ var title = _ref2.title,
261
246
  isLinkSelected = _ref2.isLinkSelected,
262
- onSelectionChange = _ref2.onSelectionChange,
263
- title = _ref2.title;
264
- var _useState3 = useState(false),
265
- _useState4 = _slicedToArray(_useState3, 2),
266
- isSelected = _useState4[0],
267
- handleSelectionChange = _useState4[1];
268
- var _useState5 = useState(0),
269
- _useState6 = _slicedToArray(_useState5, 2),
270
- verticalSeparatorHeight = _useState6[0],
271
- setVerticalSeparatorHeight = _useState6[1];
272
- var iconRef = useRef();
273
- var rowRef = useRef();
274
- useEffect(function () {
275
- var _rowRef$current$getBo = rowRef.current.getBoundingClientRect(),
276
- height = _rowRef$current$getBo.height;
277
- var _iconRef$current$getB = iconRef.current.getBoundingClientRect(),
278
- iconRefHeight = _iconRef$current$getB.height;
279
- var marginAccommodation = 4;
280
- var halfIconHeight = iconRefHeight / 2;
281
- setVerticalSeparatorHeight(height - halfIconHeight - marginAccommodation);
282
- }, [iconRef, rowRef]);
247
+ customIcon = _ref2.customIcon;
248
+ var _useState = useState(isLinkSelected),
249
+ _useState2 = _slicedToArray(_useState, 2),
250
+ isSelected = _useState2[0],
251
+ handleSelectionChange = _useState2[1];
283
252
  var onIconPress = function onIconPress() {
284
253
  handleSelectionChange(!isSelected);
285
- onSelectionChange(index);
286
254
  };
287
255
  return ___EmotionJSX(Box, {
288
- isRow: true,
289
- ref: rowRef
290
- }, ___EmotionJSX(Box, null, ___EmotionJSX(IconButton, {
256
+ isRow: true
257
+ }, ___EmotionJSX(Box, null, customIcon ? ___EmotionJSX(Icon, {
258
+ icon: customIcon,
259
+ size: "22px"
260
+ }) : ___EmotionJSX(IconButton, {
291
261
  "aria-label": "completed step icon indicator",
292
262
  onPress: onIconPress,
293
- ref: iconRef,
294
263
  sx: sx.linkRowIconButton
295
264
  }, ___EmotionJSX(Icon, {
296
265
  icon: isSelected ? CheckCircleIcon : RadioButtonIcon,
297
- size: "sm",
298
- sx: isSelected ? sx.linkRowIconButton : sx.linkRowIconNotSelected,
266
+ size: "22px",
267
+ sx: isSelected ? sx.linkRowIconSelected : sx.linkRowIconNotSelected,
299
268
  title: {
300
269
  name: 'Check Circle Icon'
301
270
  }
302
- })), !isLastLink && isLinkSelected && ___EmotionJSX(Separator, {
303
- orientation: "vertical",
304
- sx: _objectSpread(_objectSpread({}, sx.linkRowSeparator), {}, {
305
- maxHeight: verticalSeparatorHeight
306
- })
307
- })), ___EmotionJSX(Link, {
271
+ }))), ___EmotionJSX(Link, {
308
272
  href: "https://www.pingidentity.com",
309
273
  sx: sx.linkRowText,
310
274
  target: "_blank"
@@ -327,4 +291,10 @@ export var Default = function Default() {
327
291
  key: stage.title
328
292
  });
329
293
  })));
294
+ };
295
+ Default.parameters = {
296
+ design: {
297
+ type: 'figma',
298
+ url: FIGMA_LINKS.trialExperienceNav["default"]
299
+ }
330
300
  };
@@ -114,6 +114,9 @@ export var FIGMA_LINKS = {
114
114
  slider: {
115
115
  "default": 'https://www.figma.com/file/bpbEw54gTTcdIiZs4PKK1p/Astro-Specs?node-id=43112%3A1773&mode=dev'
116
116
  },
117
+ trialExperienceNav: {
118
+ "default": 'https://www.figma.com/file/bpbEw54gTTcdIiZs4PKK1p/Astro-Specs?node-id=43368%3A159&mode=dev'
119
+ },
117
120
  trialExperienceButtons: {
118
121
  "default": 'https://www.figma.com/file/bpbEw54gTTcdIiZs4PKK1p/Astro-Specs?node-id=43369%3A445'
119
122
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pingux/astro",
3
- "version": "2.27.0",
3
+ "version": "2.27.1-alpha.1",
4
4
  "description": "React component library for Ping Identity's design system",
5
5
  "repository": {
6
6
  "type": "git",