@pingux/astro 1.27.0-alpha.0 → 1.27.0-alpha.10

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 (33) hide show
  1. package/lib/cjs/components/ArrayField/ArrayField.stories.js +6 -6
  2. package/lib/cjs/components/FileInputField/FileInputField.js +8 -5
  3. package/lib/cjs/components/LinkSelectField/LinkSelectField.js +1 -1
  4. package/lib/cjs/components/ListBox/Option.js +4 -1
  5. package/lib/cjs/components/MenuItem/MenuItem.js +2 -1
  6. package/lib/cjs/components/Messages/Message.js +2 -1
  7. package/lib/cjs/components/PageHeader/PageHeader.js +7 -1
  8. package/lib/cjs/components/SelectField/SelectField.js +1 -1
  9. package/lib/cjs/components/Tab/Tab.js +15 -4
  10. package/lib/cjs/components/TabPicker/TabPicker.js +2 -2
  11. package/lib/cjs/hooks/useOverlayPanelState/useOverlayPanelState.test.js +3 -2
  12. package/lib/cjs/hooks/useSelectField/useSelectField.js +9 -1
  13. package/lib/cjs/recipes/CountryPicker.stories.js +25 -12
  14. package/lib/cjs/recipes/EditableInput.stories.js +55 -46
  15. package/lib/cjs/recipes/ListAndPanel.stories.js +102 -87
  16. package/lib/cjs/recipes/PageHeader.stories.js +73 -0
  17. package/lib/components/ArrayField/ArrayField.stories.js +6 -6
  18. package/lib/components/FileInputField/FileInputField.js +8 -5
  19. package/lib/components/LinkSelectField/LinkSelectField.js +1 -1
  20. package/lib/components/ListBox/Option.js +4 -1
  21. package/lib/components/MenuItem/MenuItem.js +2 -1
  22. package/lib/components/Messages/Message.js +2 -1
  23. package/lib/components/PageHeader/PageHeader.js +8 -1
  24. package/lib/components/SelectField/SelectField.js +1 -1
  25. package/lib/components/Tab/Tab.js +15 -4
  26. package/lib/components/TabPicker/TabPicker.js +2 -2
  27. package/lib/hooks/useOverlayPanelState/useOverlayPanelState.test.js +3 -2
  28. package/lib/hooks/useSelectField/useSelectField.js +9 -1
  29. package/lib/recipes/CountryPicker.stories.js +24 -12
  30. package/lib/recipes/EditableInput.stories.js +55 -46
  31. package/lib/recipes/ListAndPanel.stories.js +102 -87
  32. package/lib/recipes/PageHeader.stories.js +53 -0
  33. package/package.json +3 -2
@@ -37,6 +37,48 @@ var inputProps = {
37
37
  label: 'Example label',
38
38
  ariaLabel: 'Example aria label'
39
39
  };
40
+ var sx = {
41
+ editablePreview: {
42
+ whiteSpace: 'pre-line',
43
+ width: '100%',
44
+ overflowWrap: 'break-word',
45
+ minHeight: '45px',
46
+ paddingLeft: 'xs',
47
+ justifyContent: 'flex-end',
48
+ paddingBottom: 'xs',
49
+ borderBottomColor: 'active',
50
+ color: 'neutral.10',
51
+ fontSize: 'md',
52
+ fontWeight: 1,
53
+ lineHeight: '18px',
54
+ '&:focus': {
55
+ outline: 'none',
56
+ boxShadow: 'focus',
57
+ borderColor: 'active',
58
+ borderWidth: '1px',
59
+ borderStyle: 'solid'
60
+ }
61
+ },
62
+ editableInputWrapper: {
63
+ marginRight: '30px',
64
+ flexGrow: 1
65
+ },
66
+ editableInpuTextArea: {
67
+ maxHeight: '150px'
68
+ },
69
+ editableControlWrapper: {
70
+ position: 'absolute',
71
+ right: '0',
72
+ top: '27.5%',
73
+ alignItems: 'center',
74
+ justifyContent: 'space-between'
75
+ },
76
+ editableControlIconButton: {
77
+ marginRight: 'md',
78
+ width: '20px',
79
+ height: '20px'
80
+ }
81
+ };
40
82
  export var Default = function Default() {
41
83
  return ___EmotionJSX(Editable, {
42
84
  value: "Some value..."
@@ -90,6 +132,13 @@ var EditablePreview = function EditablePreview() {
90
132
  hasFocus = _useState4[0],
91
133
  setFocus = _useState4[1];
92
134
 
135
+ var editablePreviewDynamicSx = {
136
+ backgroundColor: hasFocus ? 'accent.95' : 'white',
137
+ borderBottom: editableContext.isEditing ? '0px' : '1px dashed',
138
+ '&:hover': {
139
+ background: editableContext.isEditing ? 'white' : 'accent.95'
140
+ }
141
+ };
93
142
  useEffect(function () {
94
143
  if (hasFocus && editableContext.isEditing) {
95
144
  setFocus(false);
@@ -116,8 +165,8 @@ var EditablePreview = function EditablePreview() {
116
165
  "aria-hidden": editableContext.isEditing,
117
166
  onClick: handleClick,
118
167
  onKeyDown: handleKeyDown,
119
- "aria-readonly": "false",
120
168
  "aria-label": "Inline editable text field",
169
+ role: "textbox",
121
170
  onFocus: function onFocus() {
122
171
  return setFocus(true);
123
172
  },
@@ -125,32 +174,7 @@ var EditablePreview = function EditablePreview() {
125
174
  return setFocus(false);
126
175
  },
127
176
  placeholder: "Click or press enter to edit text",
128
- sx: {
129
- whiteSpace: 'pre-line',
130
- backgroundColor: hasFocus ? 'accent.95' : 'white',
131
- width: '100%',
132
- overflowWrap: 'break-word',
133
- minHeight: '45px',
134
- paddingLeft: 'xs',
135
- justifyContent: 'flex-end',
136
- paddingBottom: 'xs',
137
- borderBottom: editableContext.isEditing ? '0px' : '1px dashed',
138
- borderBottomColor: 'active',
139
- color: 'neutral.10',
140
- fontSize: 'md',
141
- fontWeight: 1,
142
- lineHeight: '18px',
143
- '&:hover': {
144
- background: editableContext.isEditing ? 'white' : 'accent.95'
145
- },
146
- '&:focus': {
147
- outline: 'none',
148
- boxShadow: 'focus',
149
- borderColor: 'active',
150
- borderWidth: '1px',
151
- borderStyle: 'solid'
152
- }
153
- }
177
+ sx: _objectSpread(_objectSpread({}, editablePreviewDynamicSx), sx.editablePreview)
154
178
  }, editableContext.value);
155
179
  };
156
180
  /**
@@ -219,10 +243,7 @@ var EditableInput = function EditableInput(props) {
219
243
  return ___EmotionJSX(Box, {
220
244
  display: editableContext.isEditing ? 'flex' : 'none',
221
245
  "aria-hidden": !editableContext.isEditing,
222
- sx: {
223
- marginRight: '30px',
224
- flexGrow: 1
225
- }
246
+ sx: sx.editableInputWrapper
226
247
  }, ___EmotionJSX(TextAreaField, {
227
248
  rows: 1,
228
249
  ref: editableInput,
@@ -233,9 +254,7 @@ var EditableInput = function EditableInput(props) {
233
254
  onKeyDown: handleKeyDown,
234
255
  value: editingValue,
235
256
  "aria-label": ariaLabel,
236
- sx: {
237
- maxHeight: '150px'
238
- },
257
+ sx: sx.editableInpuTextArea,
239
258
  isUnresizable: true
240
259
  }));
241
260
  };
@@ -286,22 +305,12 @@ var EditableControl = function EditableControl(props) {
286
305
  display: editableContext.isEditing ? 'flex' : 'none',
287
306
  "aria-hidden": !editableContext.isEditing,
288
307
  isRow: true,
289
- sx: {
290
- position: 'absolute',
291
- right: '0',
292
- top: '27.5%',
293
- alignItems: 'center',
294
- justifyContent: 'space-between'
295
- }
308
+ sx: sx.editableControlWrapper
296
309
  }, ___EmotionJSX(IconButton, {
297
310
  onPress: handleSubmit,
298
311
  "aria-label": confirmBtn.ariaLabel,
299
312
  variant: confirmBtn.variant,
300
- mr: "15px",
301
- sx: {
302
- width: '20px',
303
- height: '20px'
304
- }
313
+ sx: sx.editableControlIconButton
305
314
  }, ___EmotionJSX(Icon, {
306
315
  icon: CheckIcon
307
316
  })), ___EmotionJSX(IconButton, {
@@ -92,44 +92,106 @@ var items = [{
92
92
  avatar: AccountIcon,
93
93
  hasSeparator: false
94
94
  }];
95
+ var sx = {
96
+ wrapper: {
97
+ px: 'lg',
98
+ py: 'lg',
99
+ bg: 'accent.99',
100
+ height: '900px',
101
+ overflowY: 'scroll'
102
+ },
103
+ searchField: {
104
+ position: 'fixed',
105
+ mb: 'sm',
106
+ width: '400px'
107
+ },
108
+ listElementWrapper: {
109
+ px: 'md',
110
+ bg: 'accent.99',
111
+ justifyContent: 'center'
112
+ },
113
+ separator: {
114
+ bg: 'accent.90'
115
+ },
116
+ tabsWrapper: {
117
+ px: 'lg',
118
+ pt: 'xs'
119
+ },
120
+ iconButton: {
121
+ position: 'absolute',
122
+ top: 0,
123
+ right: 0
124
+ },
125
+ itemLabel: {
126
+ fontSize: 'sm',
127
+ fontWeight: 3,
128
+ lineHeight: '16px',
129
+ mb: 'xs'
130
+ },
131
+ itemValue: {
132
+ fontWeight: 0,
133
+ lineHeight: '18px',
134
+ variant: 'base',
135
+ mb: 'md'
136
+ },
137
+ listElement: {
138
+ wrapper: {
139
+ minHeight: '60px'
140
+ },
141
+ iconWrapper: {
142
+ mr: 'auto',
143
+ alignItems: 'center'
144
+ },
145
+ icon: {
146
+ mr: 'sm',
147
+ alignSelf: 'center',
148
+ color: 'accent.40'
149
+ },
150
+ avatar: {
151
+ width: '25px',
152
+ height: '25px',
153
+ mr: 'md'
154
+ },
155
+ title: {
156
+ alignSelf: 'start'
157
+ },
158
+ subtitle: {
159
+ fontSize: 'sm',
160
+ my: '1px',
161
+ lineHeight: '16px',
162
+ alignSelf: 'start'
163
+ },
164
+ menuWrapper: {
165
+ alignSelf: 'center'
166
+ }
167
+ }
168
+ };
95
169
 
96
170
  var ListElement = function ListElement(_ref) {
97
171
  var item = _ref.item,
98
172
  onClosePanel = _ref.onClosePanel;
99
173
  return ___EmotionJSX(Box, {
100
174
  isRow: true,
101
- minHeight: "60px"
175
+ sx: sx.listElement.wrapper
102
176
  }, ___EmotionJSX(Box, {
103
177
  isRow: true,
104
- mr: "auto",
105
- alignItems: "center"
178
+ sx: sx.listElement.iconWrapper
106
179
  }, item.hasIcon ? ___EmotionJSX(Icon, {
107
180
  icon: item.avatar,
108
- alignSelf: "center",
109
181
  size: 24,
110
- mr: "sm",
111
- color: "accent.40"
182
+ sx: sx.listElement.icon
112
183
  }) : ___EmotionJSX(Avatar, {
113
- mr: "md",
114
- sx: {
115
- width: '25px',
116
- height: '25px'
117
- },
184
+ sx: sx.listElement.avatar,
118
185
  src: item.avatar
119
186
  }), ___EmotionJSX(Box, null, ___EmotionJSX(Text, {
120
187
  variant: "bodyStrong",
121
- alignSelf: "start"
188
+ sx: sx.listElement.title
122
189
  }, item.lastName, ", ", item.firstName), ___EmotionJSX(Text, {
123
- sx: {
124
- fontSize: 'sm',
125
- my: '1px',
126
- lineHeight: '16px'
127
- },
128
190
  variant: "subtitle",
129
- alignSelf: "start"
191
+ sx: sx.listElement.subtitle
130
192
  }, item.email))), ___EmotionJSX(Box, {
131
193
  isRow: true,
132
- alignSelf: "center"
194
+ sx: sx.listElement.menuWrapper
133
195
  }, ___EmotionJSX(SwitchField, {
134
196
  "aria-label": "active user",
135
197
  isDefaultSelected: true,
@@ -186,11 +248,7 @@ export var Default = function Default() {
186
248
  };
187
249
 
188
250
  return ___EmotionJSX(Box, {
189
- px: "lg",
190
- py: "lg",
191
- bg: "accent.99",
192
- height: "900px",
193
- overflowY: "scroll"
251
+ sx: sx.wrapper
194
252
  }, ___EmotionJSX(SearchField, {
195
253
  position: "fixed",
196
254
  mb: "sm",
@@ -224,18 +282,15 @@ export var Default = function Default() {
224
282
  restoreFocus: true,
225
283
  autoFocus: true
226
284
  }, ___EmotionJSX(Box, {
227
- px: "md",
228
- bg: "accent.99",
229
- justifyContent: "center"
285
+ sx: sx.listElementWrapper
230
286
  }, ___EmotionJSX(ListElement, {
231
287
  item: selectedItemId >= 0 ? items[selectedItemId] : [],
232
288
  onClosePanel: closePanelHandler
233
289
  })), ___EmotionJSX(Separator, {
234
290
  margin: 0,
235
- bg: "accent.90"
291
+ sx: sx.separator
236
292
  }), ___EmotionJSX(Box, {
237
- px: "lg",
238
- pt: "xs"
293
+ sx: sx.tabsWrapper
239
294
  }, ___EmotionJSX(Tabs, {
240
295
  tabListProps: {
241
296
  justifyContent: 'center'
@@ -249,73 +304,33 @@ export var Default = function Default() {
249
304
  title: "Profile"
250
305
  }, selectedItemId >= 0 && ___EmotionJSX(React.Fragment, null, ___EmotionJSX(IconButton, {
251
306
  variant: "inverted",
252
- sx: {
253
- position: 'absolute',
254
- top: 0,
255
- right: 0
256
- }
307
+ sx: sx.iconButton
257
308
  }, ___EmotionJSX(PencilIcon, {
258
309
  size: 20
259
310
  })), ___EmotionJSX(Text, {
260
- sx: {
261
- fontSize: 'sm',
262
- fontWeight: 3,
263
- lineHeight: '16px'
264
- },
265
- variant: "base",
266
- mb: "xs"
311
+ sx: sx.itemLabel,
312
+ variant: "base"
267
313
  }, "Full Name"), ___EmotionJSX(Text, {
268
- sx: {
269
- fontWeight: 0,
270
- lineHeight: '18px'
271
- },
272
- variant: "base",
273
- mb: "md"
314
+ sx: sx.itemValue,
315
+ variant: "base"
274
316
  }, items[selectedItemId].firstName, " ", items[selectedItemId].lastName), ___EmotionJSX(Text, {
275
- sx: {
276
- fontSize: 'sm',
277
- fontWeight: 3,
278
- lineHeight: '16px'
279
- },
280
- variant: "base",
281
- mb: "xs"
317
+ sx: sx.itemLabel,
318
+ variant: "base"
282
319
  }, "First Name"), ___EmotionJSX(Text, {
283
- sx: {
284
- fontWeight: 0,
285
- lineHeight: '18px'
286
- },
287
- variant: "base",
288
- mb: "md"
320
+ sx: sx.itemValue,
321
+ variant: "base"
289
322
  }, items[selectedItemId].firstName), ___EmotionJSX(Text, {
290
- sx: {
291
- fontSize: 'sm',
292
- fontWeight: 3,
293
- lineHeight: '16px'
294
- },
295
- variant: "base",
296
- mb: "xs"
323
+ sx: sx.itemLabel,
324
+ variant: "base"
297
325
  }, "Last Name"), ___EmotionJSX(Text, {
298
- sx: {
299
- fontWeight: 0,
300
- lineHeight: '18px'
301
- },
302
- variant: "base",
303
- mb: "md"
326
+ sx: sx.itemValue,
327
+ variant: "base"
304
328
  }, items[selectedItemId].lastName), ___EmotionJSX(Text, {
305
- sx: {
306
- fontSize: 'sm',
307
- fontWeight: 3,
308
- lineHeight: '16px'
309
- },
310
- variant: "base",
311
- mb: "xs"
329
+ sx: sx.itemLabel,
330
+ variant: "base"
312
331
  }, "Email"), ___EmotionJSX(Text, {
313
- sx: {
314
- fontWeight: 0,
315
- lineHeight: '18px'
316
- },
317
- variant: "base",
318
- mb: "md"
332
+ sx: sx.itemValue,
333
+ variant: "base"
319
334
  }, items[selectedItemId].email))), ___EmotionJSX(Tab, {
320
335
  title: "Group Memberships"
321
336
  }, ___EmotionJSX(Text, null, "Group Memberships")), ___EmotionJSX(Tab, {
@@ -0,0 +1,53 @@
1
+ import React from 'react';
2
+ import PlusIcon from 'mdi-react/PlusIcon';
3
+ import { Box, Button, IconButton, Icon, Text } from '../index';
4
+ import { jsx as ___EmotionJSX } from "@emotion/react";
5
+ export default {
6
+ title: 'Recipes/Page Header'
7
+ };
8
+ export var Default = function Default() {
9
+ var heading = 'Title of the Page';
10
+ 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.';
11
+ return ___EmotionJSX(Box, null, ___EmotionJSX(Box, null, ___EmotionJSX(Box, {
12
+ align: "center",
13
+ isRow: true,
14
+ mb: "xs",
15
+ role: "heading",
16
+ "aria-level": "1"
17
+ }, ___EmotionJSX(Text, {
18
+ variant: "title",
19
+ fontWeight: 3
20
+ }, heading), ___EmotionJSX(Button, {
21
+ variant: "inlinePrimary",
22
+ ml: "sm"
23
+ }, ___EmotionJSX(Icon, {
24
+ icon: PlusIcon,
25
+ color: "white",
26
+ size: 13,
27
+ mr: "4px"
28
+ }), "\xA0", "Add")), ___EmotionJSX(Text, {
29
+ variant: "bodyWeak"
30
+ }, description)), ___EmotionJSX(Box, {
31
+ mt: "xl"
32
+ }, ___EmotionJSX(Box, {
33
+ align: "center",
34
+ isRow: true,
35
+ mb: "xs",
36
+ role: "heading",
37
+ "aria-level": "1"
38
+ }, ___EmotionJSX(Text, {
39
+ variant: "title",
40
+ fontWeight: 3
41
+ }, heading), ___EmotionJSX(IconButton, {
42
+ "aria-label": "icon button",
43
+ ml: "sm",
44
+ mt: "3px",
45
+ variant: "inverted"
46
+ }, ___EmotionJSX(Icon, {
47
+ icon: PlusIcon,
48
+ color: "white",
49
+ size: 13
50
+ }))), ___EmotionJSX(Text, {
51
+ variant: "bodyWeak"
52
+ }, description)));
53
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pingux/astro",
3
- "version": "1.27.0-alpha.0",
3
+ "version": "1.27.0-alpha.10",
4
4
  "description": "PingUX themeable React component library",
5
5
  "author": "ux-development@pingidentity.com",
6
6
  "license": "Apache-2.0",
@@ -121,6 +121,7 @@
121
121
  "@react-stately/radio": "^3.2.0",
122
122
  "@react-stately/searchfield": "^3.1.1",
123
123
  "@react-stately/select": "^3.1.1",
124
+ "@react-stately/selection": "~3.10.2",
124
125
  "@react-stately/slider": "^3.0.7",
125
126
  "@react-stately/tabs": "^3.0.1",
126
127
  "@react-stately/toggle": "^3.2.0",
@@ -137,7 +138,7 @@
137
138
  "emotion-normalize": "^11.0.1",
138
139
  "lodash": "^4.17.21",
139
140
  "mdi-react": "^7.4.0",
140
- "moment": "^2.29.1",
141
+ "moment": "^2.29.4",
141
142
  "prism-react-renderer": "1.2.1",
142
143
  "prismjs": "^1.27.0",
143
144
  "prop-types": "^15.7.2",