@pingux/astro 2.16.1-alpha.1 → 2.17.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.
Files changed (74) hide show
  1. package/lib/cjs/components/ListView/ListView.js +1 -1
  2. package/lib/cjs/components/ListView/ListView.mdx +4 -1
  3. package/lib/cjs/components/ListView/ListView.stories.js +52 -98
  4. package/lib/cjs/components/ListView/ListViewItem.js +126 -0
  5. package/lib/cjs/components/ListViewItem/ListViewItem.js +81 -100
  6. package/lib/cjs/{experimental → components}/ListViewItem/ListViewItem.mdx +4 -4
  7. package/lib/cjs/{experimental → components}/ListViewItem/ListViewItem.stories.js +32 -37
  8. package/lib/cjs/{experimental → components}/ListViewItem/ListViewItem.test.js +3 -3
  9. package/lib/cjs/{experimental → components}/ListViewItem/controls/ListViewItemEditButton.js +5 -5
  10. package/lib/cjs/{experimental → components}/ListViewItem/controls/ListViewItemEditButton.stories.js +5 -5
  11. package/lib/cjs/{experimental → components}/ListViewItem/controls/ListViewItemEditButton.test.js +2 -2
  12. package/lib/cjs/{experimental → components}/ListViewItem/controls/ListViewItemMenu.js +8 -8
  13. package/lib/cjs/{experimental → components}/ListViewItem/controls/ListViewItemMenu.stories.js +5 -5
  14. package/lib/cjs/{experimental → components}/ListViewItem/controls/ListViewItemMenu.test.js +2 -3
  15. package/lib/cjs/{experimental → components}/ListViewItem/controls/ListViewItemSwitchField.js +5 -5
  16. package/lib/cjs/{experimental → components}/ListViewItem/controls/ListViewItemSwitchField.stories.js +5 -5
  17. package/lib/cjs/{experimental → components}/ListViewItem/controls/ListViewItemSwitchField.test.js +2 -2
  18. package/lib/cjs/experimental/PageHeader/PageHeader.js +14 -14
  19. package/lib/cjs/experimental/PageHeader/PageHeader.stories.js +27 -11
  20. package/lib/cjs/experimental/PageHeader/PageHeader.test.js +14 -5
  21. package/lib/cjs/experimental/PanelHeader/PanelHeader.js +1 -1
  22. package/lib/cjs/experimental/PanelHeader/PanelHeader.stories.js +1 -1
  23. package/lib/cjs/index.d.ts +4 -4
  24. package/lib/cjs/index.js +8 -8
  25. package/lib/cjs/recipes/ListAndPanel.stories.js +195 -267
  26. package/lib/cjs/recipes/MaskedValue.stories.js +8 -1
  27. package/lib/cjs/{experimental/recipes → recipes}/ScrollableListView.stories.js +2 -2
  28. package/lib/cjs/utils/designUtils/figmaLinks.js +3 -0
  29. package/lib/components/ListView/ListView.js +1 -1
  30. package/lib/components/ListView/ListView.mdx +4 -1
  31. package/lib/components/ListView/ListView.stories.js +47 -93
  32. package/lib/components/ListView/ListViewItem.js +113 -0
  33. package/lib/components/ListViewItem/ListViewItem.js +78 -99
  34. package/lib/{experimental → components}/ListViewItem/ListViewItem.mdx +4 -4
  35. package/lib/{experimental → components}/ListViewItem/ListViewItem.stories.js +7 -12
  36. package/lib/{experimental → components}/ListViewItem/ListViewItem.test.js +1 -1
  37. package/lib/{experimental → components}/ListViewItem/controls/ListViewItemEditButton.js +4 -4
  38. package/lib/{experimental → components}/ListViewItem/controls/ListViewItemEditButton.stories.js +3 -3
  39. package/lib/{experimental → components}/ListViewItem/controls/ListViewItemEditButton.test.js +1 -1
  40. package/lib/{experimental → components}/ListViewItem/controls/ListViewItemMenu.js +5 -5
  41. package/lib/{experimental → components}/ListViewItem/controls/ListViewItemMenu.stories.js +3 -3
  42. package/lib/{experimental → components}/ListViewItem/controls/ListViewItemMenu.test.js +1 -2
  43. package/lib/{experimental → components}/ListViewItem/controls/ListViewItemSwitchField.js +4 -4
  44. package/lib/{experimental → components}/ListViewItem/controls/ListViewItemSwitchField.stories.js +3 -3
  45. package/lib/{experimental → components}/ListViewItem/controls/ListViewItemSwitchField.test.js +1 -1
  46. package/lib/experimental/PageHeader/PageHeader.js +14 -14
  47. package/lib/experimental/PageHeader/PageHeader.stories.js +25 -10
  48. package/lib/experimental/PageHeader/PageHeader.test.js +14 -5
  49. package/lib/experimental/PanelHeader/PanelHeader.js +1 -1
  50. package/lib/experimental/PanelHeader/PanelHeader.stories.js +1 -1
  51. package/lib/index.js +4 -4
  52. package/lib/recipes/ListAndPanel.stories.js +186 -260
  53. package/lib/recipes/MaskedValue.stories.js +7 -0
  54. package/lib/{experimental/recipes → recipes}/ScrollableListView.stories.js +2 -2
  55. package/lib/utils/designUtils/figmaLinks.js +3 -0
  56. package/package.json +1 -1
  57. package/lib/cjs/components/ListItem/ListItem.stories.js +0 -189
  58. package/lib/cjs/experimental/ListView/ListView.mdx +0 -47
  59. package/lib/cjs/experimental/ListView/ListView.stories.js +0 -742
  60. package/lib/cjs/experimental/ListViewItem/ListViewItem.js +0 -108
  61. package/lib/cjs/experimental/recipes/ListAndPanel.stories.js +0 -359
  62. package/lib/cjs/recipes/RadioButtonsWithLinks.stories.js +0 -133
  63. package/lib/cjs/recipes/ScrollableListView.stories.hidden.js +0 -136
  64. package/lib/components/ListItem/ListItem.stories.js +0 -174
  65. package/lib/experimental/ListView/ListView.mdx +0 -47
  66. package/lib/experimental/ListView/ListView.stories.js +0 -729
  67. package/lib/experimental/ListViewItem/ListViewItem.js +0 -93
  68. package/lib/experimental/recipes/ListAndPanel.stories.js +0 -342
  69. package/lib/recipes/RadioButtonsWithLinks.stories.js +0 -118
  70. package/lib/recipes/ScrollableListView.stories.hidden.js +0 -121
  71. /package/lib/cjs/{experimental → components}/ListViewItem/listViewItemAttributes.js +0 -0
  72. /package/lib/cjs/{experimental/recipes → recipes}/items.js +0 -0
  73. /package/lib/{experimental → components}/ListViewItem/listViewItemAttributes.js +0 -0
  74. /package/lib/{experimental/recipes → recipes}/items.js +0 -0
@@ -1,93 +0,0 @@
1
- import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
2
- import _objectWithoutProperties from "@babel/runtime-corejs3/helpers/esm/objectWithoutProperties";
3
- var _excluded = ["children", "className", "data", "isHovered", "isSelected", "linkProps", "onHoverChange", "onHoverEnd", "onHoverStart", "slots"];
4
- import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
5
- import React, { forwardRef } from 'react';
6
- import { useHover } from '@react-aria/interactions';
7
- import { useStatusClasses } from '../../hooks';
8
- import { Box, Icon, Image, Text } from '../../index';
9
- import { listViewItemPropTypes } from './listViewItemAttributes';
10
- import { jsx as ___EmotionJSX } from "@emotion/react";
11
- export var LIST_ITEM_ICON = '-list-item-icon';
12
- var ListViewItem = /*#__PURE__*/forwardRef(function (_ref, ref) {
13
- var _context, _context2;
14
- var children = _ref.children,
15
- className = _ref.className,
16
- data = _ref.data,
17
- isHovered = _ref.isHovered,
18
- isSelected = _ref.isSelected,
19
- linkProps = _ref.linkProps,
20
- onHoverChange = _ref.onHoverChange,
21
- onHoverEnd = _ref.onHoverEnd,
22
- onHoverStart = _ref.onHoverStart,
23
- slots = _ref.slots,
24
- others = _objectWithoutProperties(_ref, _excluded);
25
- var icon = data.icon,
26
- image = data.image,
27
- subtext = data.subtext,
28
- text = data.text;
29
- var shouldUseDefaultHover = isHovered === undefined;
30
- var _useHover = useHover({
31
- onHoverChange: onHoverChange,
32
- onHoverEnd: onHoverEnd,
33
- onHoverStart: onHoverStart
34
- }),
35
- hoverProps = _useHover.hoverProps,
36
- defaultIsHovered = _useHover.isHovered;
37
- var _useStatusClasses = useStatusClasses(className, {
38
- isHovered: shouldUseDefaultHover ? defaultIsHovered : isHovered,
39
- isSelected: isSelected
40
- }),
41
- classNames = _useStatusClasses.classNames;
42
- var getWrapperVariant = function getWrapperVariant() {
43
- if (slots !== null && slots !== void 0 && slots.leftOfData) return 'listViewItem.leftOfDataWrapper';
44
- if (image && !icon) return 'listViewItem.imageWrapper';
45
- return 'listViewItem.iconWrapper';
46
- };
47
- var renderIcon = icon && ___EmotionJSX(Box, {
48
- width: "25px"
49
- }, ___EmotionJSX(Icon, {
50
- color: "accent.40",
51
- icon: icon,
52
- size: "md",
53
- title: {
54
- id: _concatInstanceProperty(_context = "".concat(text)).call(_context, LIST_ITEM_ICON),
55
- name: _concatInstanceProperty(_context2 = "".concat(text)).call(_context2, LIST_ITEM_ICON)
56
- }
57
- }));
58
- var renderImage = !icon && image && ___EmotionJSX(Box, {
59
- width: "35px"
60
- }, ___EmotionJSX(Image, {
61
- src: image.src,
62
- alt: image.alt,
63
- "aria-label": image['aria-label']
64
- }));
65
- var renderData = ___EmotionJSX(Box, {
66
- isRow: true,
67
- alignItems: "center"
68
- }, (slots === null || slots === void 0 ? void 0 : slots.leftOfData) || renderIcon || renderImage, ___EmotionJSX(Box, {
69
- variant: getWrapperVariant()
70
- }, text && ___EmotionJSX(Text, {
71
- variant: "listViewItemText"
72
- }, text), subtext && ___EmotionJSX(Text, {
73
- variant: "listViewItemSubtext"
74
- }, subtext)));
75
- return ___EmotionJSX(Box, _extends({
76
- className: classNames,
77
- ref: ref,
78
- variant: "listViewItem.styledContainer"
79
- }, hoverProps, others), ___EmotionJSX(Box, {
80
- isRow: true,
81
- variant: getWrapperVariant()
82
- }, renderData, (slots === null || slots === void 0 ? void 0 : slots.rightOfData) && ___EmotionJSX(Box, {
83
- isRow: true,
84
- variant: "listViewItem.rightOfData"
85
- }, slots.rightOfData), ___EmotionJSX(Box, {
86
- isRow: true,
87
- gap: "sm",
88
- variant: "listViewItem.controls"
89
- }, children)));
90
- });
91
- ListViewItem.propTypes = listViewItemPropTypes;
92
- ListViewItem.displayName = 'ListViewItem';
93
- export default ListViewItem;
@@ -1,342 +0,0 @@
1
- import _slicedToArray from "@babel/runtime-corejs3/helpers/esm/slicedToArray";
2
- import _findIndexInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/find-index";
3
- import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
4
- import React, { useRef, useState } from 'react';
5
- import { FocusScope } from 'react-aria';
6
- import { Item } from 'react-stately';
7
- import AccountIcon from '@pingux/mdi-react/AccountIcon';
8
- import CloseIcon from '@pingux/mdi-react/CloseIcon';
9
- import MoreVertIcon from '@pingux/mdi-react/MoreVertIcon';
10
- import PencilIcon from '@pingux/mdi-react/PencilIcon';
11
- import PlusIcon from '@pingux/mdi-react/PlusIcon';
12
- import { useOverlayPanelState } from '../../hooks';
13
- import useOverlappingMenuHoverState from '../../hooks/useOverlappingMenuHoverState';
14
- import { Box, Icon, IconButton, Link, ListView, ListViewItem, ListViewItemMenu, ListViewItemSwitchField, Menu, OverlayPanel, PopoverMenu, SearchField, Separator, SwitchField, Tab, Tabs, Text } from '../../index';
15
- import { items } from './items';
16
- import { jsx as ___EmotionJSX } from "@emotion/react";
17
- export default {
18
- title: 'Experimental/Recipes/ListAndPanel',
19
- parameters: {
20
- docs: {
21
- source: {
22
- type: 'code'
23
- }
24
- }
25
- }
26
- };
27
- var sx = {
28
- wrapper: {
29
- px: 'lg',
30
- py: 'lg',
31
- bg: 'accent.99',
32
- height: '900px',
33
- overflowY: 'scroll'
34
- },
35
- separator: {
36
- bg: 'accent.90'
37
- },
38
- tabsWrapper: {
39
- px: 'lg',
40
- pt: 'xs'
41
- },
42
- iconButton: {
43
- position: 'absolute',
44
- top: 0,
45
- right: 0
46
- },
47
- itemLabel: {
48
- fontSize: 'sm',
49
- fontWeight: 3,
50
- lineHeight: '16px',
51
- mb: 'xs'
52
- },
53
- itemValue: {
54
- fontWeight: 0,
55
- lineHeight: '18px',
56
- mb: 'md'
57
- },
58
- panelHeader: {
59
- container: {
60
- bg: 'accent.99',
61
- minHeight: 58,
62
- ml: 0,
63
- pl: 14,
64
- pr: 'xs'
65
- },
66
- controls: {
67
- alignSelf: 'center',
68
- ml: 'auto',
69
- pr: 'sm'
70
- },
71
- data: {
72
- alignItems: 'center'
73
- },
74
- subtitle: {
75
- alignSelf: 'start',
76
- fontSize: 'sm',
77
- lineHeight: '16px',
78
- my: '1px'
79
- },
80
- title: {
81
- alignSelf: 'start',
82
- fontSize: 'md'
83
- },
84
- wrapper: {
85
- cursor: 'pointer',
86
- display: 'flex',
87
- flex: '1 1 0px',
88
- ml: 'md'
89
- }
90
- }
91
- };
92
- var heading = 'Users';
93
- var description = 'The description of the page. The description of the page. The description of the page. The description of the page. The description of the page. The description of the page. The description of the page. The description of the page. The description of the page.';
94
- var title = ___EmotionJSX(Box, null, ___EmotionJSX(Box, {
95
- align: "center",
96
- isRow: true,
97
- mb: "xs",
98
- role: "heading",
99
- "aria-level": "1"
100
- }, ___EmotionJSX(Text, {
101
- fontSize: "xx",
102
- fontWeight: 3,
103
- fontColor: "text.primary"
104
- }, heading), ___EmotionJSX(IconButton, {
105
- "aria-label": "icon button",
106
- ml: "sm",
107
- variant: "inverted"
108
- }, ___EmotionJSX(Icon, {
109
- icon: PlusIcon,
110
- size: "sm"
111
- }))), ___EmotionJSX(Text, {
112
- fontSize: "sm",
113
- color: "text.secondary",
114
- fontWeight: 0,
115
- width: "800px"
116
- }, description, ___EmotionJSX(Link, {
117
- href: "https://uilibrary.ping-eng.com/",
118
- sx: {
119
- fontSize: '13px'
120
- }
121
- }, " Learn more")));
122
- export var ListAndPanel = function ListAndPanel() {
123
- // Example of items data structure
124
- // const items = [
125
- // {
126
- // email: 'dburkitt5@columbia.edu',
127
- // firstName: 'Nicola',
128
- // lastName: 'Burkitt',
129
- // icon: AccountIcon,
130
- // },
131
- // ]
132
-
133
- var _useState = useState(),
134
- _useState2 = _slicedToArray(_useState, 2),
135
- selectedItemId = _useState2[0],
136
- setSelectedItemId = _useState2[1];
137
- var _useState3 = useState(),
138
- _useState4 = _slicedToArray(_useState3, 2),
139
- selectedKeys = _useState4[0],
140
- setSelectedKeys = _useState4[1];
141
- var _useOverlayPanelState = useOverlayPanelState(),
142
- panelState = _useOverlayPanelState.state,
143
- onPanelClose = _useOverlayPanelState.onClose;
144
- var panelTriggerRef = useRef();
145
- var closePanelHandler = function closePanelHandler() {
146
- onPanelClose(panelState, panelTriggerRef);
147
- setSelectedItemId(-1);
148
- setSelectedKeys([]);
149
- };
150
- var selectItemHandler = function selectItemHandler(e) {
151
- if (e.size) {
152
- setSelectedItemId(_findIndexInstanceProperty(items).call(items, function (item) {
153
- return item.email === e.currentKey;
154
- }));
155
- setSelectedKeys([e.currentKey]);
156
- panelState.open();
157
- } else {
158
- closePanelHandler();
159
- }
160
- };
161
- return ___EmotionJSX(Box, {
162
- sx: sx.wrapper
163
- }, title, ___EmotionJSX(SearchField, {
164
- position: "fixed",
165
- mb: "lg",
166
- mt: "lg",
167
- width: "400px",
168
- placeholder: "Search",
169
- "aria-label": "search"
170
- }), ___EmotionJSX(Separator, {
171
- margin: 0
172
- }), ___EmotionJSX(ListView, {
173
- items: items,
174
- onSelectionChange: selectItemHandler,
175
- ref: panelTriggerRef,
176
- selectedKeys: selectedKeys
177
- }, function (item) {
178
- var _context;
179
- return ___EmotionJSX(Item, {
180
- key: item.email
181
- }, ___EmotionJSX(ListElement, {
182
- data: {
183
- text: _concatInstanceProperty(_context = "".concat(item.lastName, ", ")).call(_context, item.firstName),
184
- subtext: item.email,
185
- icon: item.icon
186
- }
187
- }));
188
- }), ___EmotionJSX(OverlayPanel, {
189
- isOpen: panelState.isOpen,
190
- state: panelState,
191
- triggerRef: panelTriggerRef,
192
- p: 0,
193
- size: "large"
194
- }, panelState.isOpen && ___EmotionJSX(FocusScope, {
195
- contain: true,
196
- restoreFocus: true,
197
- autoFocus: true
198
- }, ___EmotionJSX(PanelHeader, {
199
- item: selectedItemId >= 0 ? items[selectedItemId] : [],
200
- onClosePanel: closePanelHandler
201
- }), ___EmotionJSX(Separator, {
202
- margin: 0,
203
- sx: sx.separator
204
- }), ___EmotionJSX(Box, {
205
- sx: sx.tabsWrapper
206
- }, ___EmotionJSX(Tabs, {
207
- tabListProps: {
208
- justifyContent: 'center'
209
- },
210
- tabPanelProps: {
211
- sx: {
212
- position: 'relative'
213
- }
214
- }
215
- }, ___EmotionJSX(Tab, {
216
- title: "Profile"
217
- }, selectedItemId >= 0 && ___EmotionJSX(React.Fragment, null, ___EmotionJSX(IconButton, {
218
- variant: "inverted",
219
- "aria-label": "pencil icon button",
220
- sx: sx.iconButton
221
- }, ___EmotionJSX(Icon, {
222
- icon: PencilIcon,
223
- size: "sm"
224
- })), ___EmotionJSX(Text, {
225
- sx: sx.itemLabel
226
- }, "Full Name"), ___EmotionJSX(Text, {
227
- sx: sx.itemValue
228
- }, items[selectedItemId].firstName, ' ', items[selectedItemId].lastName), ___EmotionJSX(Text, {
229
- sx: sx.itemLabel
230
- }, "First Name"), ___EmotionJSX(Text, {
231
- sx: sx.itemValue
232
- }, items[selectedItemId].firstName), ___EmotionJSX(Text, {
233
- sx: sx.itemLabel
234
- }, "Last Name"), ___EmotionJSX(Text, {
235
- sx: sx.itemValue
236
- }, items[selectedItemId].lastName), ___EmotionJSX(Text, {
237
- sx: sx.itemLabel
238
- }, "Email"), ___EmotionJSX(Text, {
239
- sx: sx.itemValue
240
- }, items[selectedItemId].email))), ___EmotionJSX(Tab, {
241
- title: "Group Memberships"
242
- }, ___EmotionJSX(Text, null, "Group Memberships")), ___EmotionJSX(Tab, {
243
- title: "Account Info"
244
- }, ___EmotionJSX(Text, null, "Account Info")))))));
245
- };
246
- export var ListElement = function ListElement(_ref) {
247
- var _ref$data = _ref.data,
248
- data = _ref$data === void 0 ? {
249
- subtext: 'dburkitt5@columbia.edu',
250
- text: 'Burkitt, Nicola',
251
- icon: AccountIcon
252
- } : _ref$data;
253
- var listItemRef = useRef();
254
- var _useOverlappingMenuHo = useOverlappingMenuHoverState({
255
- listItemRef: listItemRef
256
- }),
257
- handleHoverEnd = _useOverlappingMenuHo.handleHoverEnd,
258
- handleHoverStart = _useOverlappingMenuHo.handleHoverStart,
259
- handleMenuHoverEnd = _useOverlappingMenuHo.handleMenuHoverEnd,
260
- handleMouseMove = _useOverlappingMenuHo.handleMouseMove,
261
- isHovered = _useOverlappingMenuHo.isHovered;
262
- var text = data.text,
263
- subtext = data.subtext,
264
- icon = data.icon;
265
- return ___EmotionJSX(ListViewItem, {
266
- data: {
267
- icon: icon,
268
- subtext: subtext,
269
- text: text
270
- },
271
- isHovered: isHovered,
272
- onHoverEnd: handleHoverEnd,
273
- onHoverStart: handleHoverStart,
274
- onMouseMove: handleMouseMove,
275
- ref: listItemRef
276
- }, ___EmotionJSX(ListViewItemSwitchField, null), ___EmotionJSX(ListViewItemMenu, {
277
- onAction: handleHoverEnd,
278
- onHoverEnd: handleMenuHoverEnd,
279
- onHoverStart: handleHoverStart
280
- }, ___EmotionJSX(Item, {
281
- key: "enable"
282
- }, "Enable user"), ___EmotionJSX(Item, {
283
- key: "disable"
284
- }, "Disable user"), ___EmotionJSX(Item, {
285
- key: "delete"
286
- }, "Delete user")));
287
- };
288
- export var PanelHeader = function PanelHeader(_ref2) {
289
- var _context2;
290
- var _ref2$item = _ref2.item,
291
- item = _ref2$item === void 0 ? {
292
- email: 'dburkitt5@columbia.edu',
293
- icon: AccountIcon,
294
- firstName: 'John',
295
- lastName: 'Doe'
296
- } : _ref2$item,
297
- onClosePanel = _ref2.onClosePanel;
298
- var email = item.email,
299
- firstName = item.firstName,
300
- lastName = item.lastName;
301
- var text = _concatInstanceProperty(_context2 = "".concat(lastName, ", ")).call(_context2, firstName);
302
- return ___EmotionJSX(Box, {
303
- sx: sx.panelHeader.container
304
- }, ___EmotionJSX(Box, {
305
- isRow: true,
306
- sx: sx.panelHeader.wrapper
307
- }, ___EmotionJSX(Box, {
308
- isRow: true,
309
- sx: sx.panelHeader.data
310
- }, ___EmotionJSX(Box, null, ___EmotionJSX(Text, {
311
- variant: "bodyStrong",
312
- sx: sx.panelHeader.title
313
- }, text), ___EmotionJSX(Text, {
314
- variant: "subtitle",
315
- sx: sx.panelHeader.subtitle
316
- }, email))), ___EmotionJSX(Box, {
317
- isRow: true,
318
- sx: sx.panelHeader.controls
319
- }, ___EmotionJSX(SwitchField, {
320
- "aria-label": "active user",
321
- isDefaultSelected: true,
322
- alignSelf: "center",
323
- mr: "xs"
324
- }), ___EmotionJSX(PopoverMenu, null, ___EmotionJSX(IconButton, {
325
- "aria-label": "more"
326
- }, ___EmotionJSX(Icon, {
327
- icon: MoreVertIcon,
328
- size: "md"
329
- })), ___EmotionJSX(Menu, null, ___EmotionJSX(Item, {
330
- key: "enable"
331
- }, "Enable user"), ___EmotionJSX(Item, {
332
- key: "disable"
333
- }, "Disable user"), ___EmotionJSX(Item, {
334
- key: "delete"
335
- }, "Delete user"))), ___EmotionJSX(IconButton, {
336
- "aria-label": "close icon button",
337
- onPress: onClosePanel
338
- }, ___EmotionJSX(Icon, {
339
- size: "md",
340
- icon: CloseIcon
341
- })))));
342
- };
@@ -1,118 +0,0 @@
1
- import _slicedToArray from "@babel/runtime-corejs3/helpers/esm/slicedToArray";
2
- import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
3
- import React, { useState } from 'react';
4
- import CloseIcon from '@pingux/mdi-react/CloseIcon';
5
- import { Box, Button, Icon, IconButton, RadioField, RadioGroupField, Text } from '../index';
6
- import { jsx as ___EmotionJSX } from "@emotion/react";
7
- export default {
8
- title: 'Recipes/Radio Buttons with Links'
9
- };
10
- export var Default = function Default() {
11
- var roles = [{
12
- name: 'Client Application Developer'
13
- }, {
14
- name: 'Environment Admin',
15
- isDisabled: true
16
- }, {
17
- name: 'Identity Data Admin',
18
- isDisabled: true
19
- }, {
20
- name: 'Organization Admin'
21
- }];
22
- var titleSx = {
23
- fontSize: 'md',
24
- color: 'neutral.20',
25
- fontWeight: 2
26
- };
27
- var subtitleSx = {
28
- fontSize: 'md',
29
- color: 'neutral.10'
30
- };
31
- var RadioFieldWithButton = function RadioFieldWithButton(_ref) {
32
- var fieldName = _ref.fieldName,
33
- isDisabled = _ref.isDisabled;
34
- var _useState = useState(false),
35
- _useState2 = _slicedToArray(_useState, 2),
36
- isOpen = _useState2[0],
37
- setIsOpen = _useState2[1];
38
- return ___EmotionJSX(Box, null, ___EmotionJSX(Box, {
39
- isRow: true,
40
- alignItems: "center"
41
- }, ___EmotionJSX(RadioField, {
42
- value: fieldName,
43
- label: fieldName,
44
- isDisabled: isDisabled
45
- }), ___EmotionJSX(Button, {
46
- variant: "link",
47
- mb: "xs",
48
- ml: "md",
49
- onPress: function onPress() {
50
- return setIsOpen(function (prev) {
51
- return !prev;
52
- });
53
- },
54
- isDisabled: isDisabled
55
- }, "".concat(isOpen ? 'Hide' : 'Show', " Permissions"))), isOpen && ___EmotionJSX(PermissionsList, {
56
- onPress: function onPress() {
57
- return setIsOpen(false);
58
- }
59
- }));
60
- };
61
- var PermissionsList = function PermissionsList(_ref2) {
62
- var onPress = _ref2.onPress;
63
- return ___EmotionJSX(Box, {
64
- p: "md",
65
- bg: "neutral.95"
66
- }, ___EmotionJSX(Box, {
67
- isRow: true,
68
- justifyContent: "space-between",
69
- mb: "sm"
70
- }, ___EmotionJSX(Text, {
71
- sx: {
72
- fontWeight: 2
73
- }
74
- }, "Permissions"), ___EmotionJSX(IconButton, {
75
- onPress: onPress,
76
- "aria-label": "close"
77
- }, ___EmotionJSX(Icon, {
78
- icon: CloseIcon,
79
- size: "sm",
80
- title: {
81
- name: 'Close Icon'
82
- }
83
- }))), ___EmotionJSX(Box, null, ___EmotionJSX(Text, {
84
- sx: titleSx,
85
- mb: "xs"
86
- }, "Resource"), ___EmotionJSX(Text, {
87
- sx: subtitleSx,
88
- mb: "sm"
89
- }, "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua."), ___EmotionJSX(Text, {
90
- sx: titleSx,
91
- mb: "xs"
92
- }, "Push Credentials"), ___EmotionJSX(Text, {
93
- sx: subtitleSx,
94
- mb: "sm"
95
- }, "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod"), ___EmotionJSX(Text, {
96
- sx: titleSx,
97
- mb: "xs"
98
- }, "Organization"), ___EmotionJSX(Text, {
99
- sx: subtitleSx,
100
- mb: "sm"
101
- }, "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco"), ___EmotionJSX(Text, {
102
- sx: titleSx,
103
- mb: "xs"
104
- }, "Image"), ___EmotionJSX(Text, {
105
- sx: subtitleSx,
106
- mb: "sm"
107
- }, "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod")));
108
- };
109
- return ___EmotionJSX(RadioGroupField, null, _mapInstanceProperty(roles).call(roles, function (_ref3) {
110
- var name = _ref3.name,
111
- isDisabled = _ref3.isDisabled;
112
- return ___EmotionJSX(RadioFieldWithButton, {
113
- fieldName: name,
114
- isDisabled: isDisabled,
115
- key: name
116
- });
117
- }));
118
- };
@@ -1,121 +0,0 @@
1
- import _slicedToArray from "@babel/runtime-corejs3/helpers/esm/slicedToArray";
2
- import _objectDestructuringEmpty from "@babel/runtime-corejs3/helpers/esm/objectDestructuringEmpty";
3
- import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
4
- import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
5
- import _includesInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/includes";
6
- import React, { useState } from 'react';
7
- import { Item } from 'react-stately';
8
- import CreateIcon from '@pingux/mdi-react/CreateIcon';
9
- import FormSelectIcon from '@pingux/mdi-react/FormSelectIcon';
10
- import MoreVertIcon from '@pingux/mdi-react/MoreVertIcon';
11
- import { Box, Icon, IconButton, ListView, ScrollBox, SearchField, Text } from '../index';
12
- import { jsx as ___EmotionJSX } from "@emotion/react";
13
- export default {
14
- title: 'Recipes/Scrollable List View'
15
- };
16
- var unfilteredItems = [{
17
- key: 'Aardvark',
18
- name: 'Aardvark',
19
- id: '1'
20
- }, {
21
- key: 'Kangaroo',
22
- name: 'Kangaroo',
23
- id: '2'
24
- }, {
25
- key: 'Snake',
26
- name: 'Snake',
27
- id: '3'
28
- }, {
29
- key: 'Dog',
30
- name: 'Dog',
31
- id: '4'
32
- }, {
33
- key: 'Cat',
34
- name: 'Cat',
35
- id: '5'
36
- }, {
37
- key: 'Mouse',
38
- name: 'Mouse',
39
- id: '6'
40
- }, {
41
- key: 'Jaguar',
42
- name: 'Jaguar',
43
- id: '7'
44
- }, {
45
- key: 'Elephant',
46
- name: 'Elephant',
47
- id: '7'
48
- }];
49
- export var Default = function Default(_ref) {
50
- var args = _extends({}, (_objectDestructuringEmpty(_ref), _ref));
51
- var _useState = useState(''),
52
- _useState2 = _slicedToArray(_useState, 2),
53
- value = _useState2[0],
54
- setValue = _useState2[1];
55
- var _useState3 = useState(unfilteredItems),
56
- _useState4 = _slicedToArray(_useState3, 2),
57
- items = _useState4[0],
58
- setItems = _useState4[1];
59
- var filterItems = function filterItems(input) {
60
- var filtered = _filterInstanceProperty(unfilteredItems).call(unfilteredItems, function (obj) {
61
- var _context;
62
- return _includesInstanceProperty(_context = obj.name.toLowerCase()).call(_context, input.toLowerCase());
63
- });
64
- setItems(filtered);
65
- };
66
- var onChangeInput = function onChangeInput(input) {
67
- setValue(input);
68
- filterItems(input);
69
- };
70
- return ___EmotionJSX(Box, null, ___EmotionJSX(SearchField, {
71
- value: value,
72
- onChange: onChangeInput
73
- }), ___EmotionJSX(ScrollBox, {
74
- maxHeight: 450,
75
- hasShadows: true
76
- }, ___EmotionJSX(ListView, _extends({}, args, {
77
- items: items
78
- }), function (item) {
79
- return ___EmotionJSX(Item, {
80
- key: item.name,
81
- textValue: item.name
82
- }, ___EmotionJSX(Box, {
83
- isRow: true
84
- }, ___EmotionJSX(Box, {
85
- isRow: true,
86
- mr: "auto",
87
- alignSelf: "center"
88
- }, ___EmotionJSX(Icon, {
89
- icon: FormSelectIcon,
90
- mr: "sm",
91
- color: "accent.40",
92
- size: 25,
93
- title: {
94
- name: 'Form Select Icon'
95
- }
96
- }), ___EmotionJSX(Text, {
97
- variant: "itemTitle",
98
- alignSelf: "center"
99
- }, item.name)), ___EmotionJSX(Box, {
100
- isRow: true,
101
- alignSelf: "center",
102
- gap: "sm"
103
- }, ___EmotionJSX(IconButton, {
104
- "aria-label": "create-icon"
105
- }, ___EmotionJSX(Icon, {
106
- icon: CreateIcon,
107
- size: "sm",
108
- title: {
109
- name: 'Create Icon'
110
- }
111
- })), ___EmotionJSX(IconButton, {
112
- "aria-label": "create-icon"
113
- }, ___EmotionJSX(Icon, {
114
- icon: MoreVertIcon,
115
- size: "sm",
116
- title: {
117
- name: 'More Vertical Icon'
118
- }
119
- })))));
120
- })));
121
- };
File without changes