@pingux/astro 1.0.0-alpha.2 → 1.0.0-alpha.20
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.
- package/CHANGELOG.md +192 -0
- package/README.md +5 -0
- package/lib/cjs/components/AccordionGridGroup/AccordionGridGroup.stories.js +4 -11
- package/lib/cjs/components/AccordionItem/AccordionItem.js +3 -1
- package/lib/cjs/components/Button/Button.js +5 -24
- package/lib/cjs/components/Button/Button.stories.js +5 -11
- package/lib/cjs/components/Button/Button.test.js +0 -24
- package/lib/cjs/components/Chip/Chip.js +26 -10
- package/lib/cjs/components/Chip/Chip.stories.js +44 -5
- package/lib/cjs/components/Chip/Chip.test.js +9 -0
- package/lib/cjs/components/{Dropdown/index.js → Chip/ChipContext.js} +8 -7
- package/lib/cjs/components/CopyText/CopyText.js +3 -73
- package/lib/cjs/components/FileInputField/FileInputField.js +324 -0
- package/lib/cjs/components/FileInputField/FileInputField.stories.js +250 -0
- package/lib/cjs/components/FileInputField/FileInputField.test.js +227 -0
- package/lib/cjs/components/FileInputField/FileItem.js +125 -0
- package/lib/cjs/components/FileInputField/FileSelect.js +48 -0
- package/lib/cjs/components/{DropdownField → FileInputField}/index.js +2 -2
- package/lib/cjs/components/IconButton/IconButton.js +17 -7
- package/lib/cjs/components/IconButton/IconButton.test.js +0 -1
- package/lib/cjs/components/ListItem/ListItem.stories.js +0 -2
- package/lib/cjs/components/ListView/ListView.js +4 -3
- package/lib/cjs/components/ListViewItem/ListViewItem.js +3 -6
- package/lib/cjs/components/Stepper/Stepper.js +1 -0
- package/lib/cjs/components/Tab/Tab.js +15 -6
- package/lib/cjs/components/Tabs/Tabs.js +7 -1
- package/lib/cjs/components/Tabs/Tabs.stories.js +60 -6
- package/lib/cjs/components/Tabs/Tabs.test.js +78 -15
- package/lib/cjs/components/TextAreaField/TextAreaField.test.js +10 -0
- package/lib/cjs/{components/Panel → hooks/useCopyToClipboard}/index.js +2 -2
- package/lib/cjs/hooks/useCopyToClipboard/useCopyToClipboard.js +83 -0
- package/lib/cjs/hooks/useCopyToClipboard/useCopyToClipboard.test.js +79 -0
- package/lib/cjs/index.js +55 -133
- package/lib/cjs/layouts/ListLayout.stories.js +2 -1
- package/lib/cjs/layouts/SchemaFormLayout.stories.js +2 -21
- package/lib/cjs/recipes/ArrayField.stories.js +3 -3
- package/lib/cjs/recipes/CopyToClipboard.stories.js +45 -0
- package/lib/cjs/recipes/RadioButtonsWithLinks.stories.js +146 -0
- package/lib/cjs/styles/forms/input.js +15 -0
- package/lib/cjs/styles/theme.js +0 -3
- package/lib/cjs/styles/variants/accordion.js +7 -9
- package/lib/cjs/styles/variants/boxes.js +43 -18
- package/lib/cjs/styles/variants/buttons.js +22 -28
- package/lib/cjs/styles/variants/tabs.js +1 -0
- package/lib/cjs/styles/variants/variants.js +0 -3
- package/lib/components/AccordionGridGroup/AccordionGridGroup.stories.js +4 -11
- package/lib/components/AccordionItem/AccordionItem.js +3 -1
- package/lib/components/Button/Button.js +7 -24
- package/lib/components/Button/Button.stories.js +5 -10
- package/lib/components/Button/Button.test.js +0 -20
- package/lib/components/Chip/Chip.js +25 -10
- package/lib/components/Chip/Chip.stories.js +41 -5
- package/lib/components/Chip/Chip.test.js +9 -0
- package/lib/components/Chip/ChipContext.js +3 -0
- package/lib/components/CopyText/CopyText.js +2 -71
- package/lib/components/FileInputField/FileInputField.js +280 -0
- package/lib/components/FileInputField/FileInputField.stories.js +206 -0
- package/lib/components/FileInputField/FileInputField.test.js +187 -0
- package/lib/components/FileInputField/FileItem.js +100 -0
- package/lib/components/FileInputField/FileSelect.js +31 -0
- package/lib/components/FileInputField/index.js +1 -0
- package/lib/components/IconButton/IconButton.js +17 -9
- package/lib/components/IconButton/IconButton.test.js +0 -1
- package/lib/components/ListItem/ListItem.stories.js +0 -2
- package/lib/components/ListView/ListView.js +4 -3
- package/lib/components/ListViewItem/ListViewItem.js +3 -5
- package/lib/components/Stepper/Stepper.js +1 -0
- package/lib/components/Tab/Tab.js +15 -6
- package/lib/components/Tabs/Tabs.js +7 -1
- package/lib/components/Tabs/Tabs.stories.js +56 -4
- package/lib/components/Tabs/Tabs.test.js +78 -15
- package/lib/components/TextAreaField/TextAreaField.test.js +8 -0
- package/lib/hooks/useCopyToClipboard/index.js +1 -0
- package/lib/hooks/useCopyToClipboard/useCopyToClipboard.js +69 -0
- package/lib/hooks/useCopyToClipboard/useCopyToClipboard.test.js +64 -0
- package/lib/index.js +1 -8
- package/lib/layouts/ListLayout.stories.js +2 -1
- package/lib/layouts/SchemaFormLayout.stories.js +2 -19
- package/lib/recipes/ArrayField.stories.js +3 -3
- package/lib/recipes/CopyToClipboard.stories.js +25 -0
- package/lib/recipes/RadioButtonsWithLinks.stories.js +120 -0
- package/lib/styles/forms/input.js +15 -0
- package/lib/styles/theme.js +0 -3
- package/lib/styles/variants/accordion.js +7 -9
- package/lib/styles/variants/boxes.js +43 -18
- package/lib/styles/variants/buttons.js +22 -28
- package/lib/styles/variants/tabs.js +1 -0
- package/lib/styles/variants/variants.js +0 -2
- package/package.json +3 -2
- package/lib/cjs/components/Dropdown/Dropdown.js +0 -112
- package/lib/cjs/components/Dropdown/Dropdown.test.js +0 -80
- package/lib/cjs/components/DropdownField/DropdownField.js +0 -187
- package/lib/cjs/components/DropdownField/DropdownField.stories.js +0 -278
- package/lib/cjs/components/DropdownField/DropdownField.test.js +0 -80
- package/lib/cjs/components/Panel/Panel.js +0 -101
- package/lib/cjs/components/Panel/Panel.stories.js +0 -57
- package/lib/cjs/components/Panel/Panel.test.js +0 -72
- package/lib/cjs/components/Popover/Popover.js +0 -87
- package/lib/cjs/components/Popover/Popover.stories.js +0 -80
- package/lib/cjs/components/Popover/Popover.test.js +0 -91
- package/lib/cjs/components/Popover/index.js +0 -18
- package/lib/cjs/recipes/InputBoxWithLinkedChip.stories.js +0 -67
- package/lib/cjs/styles/variants/popover.js +0 -86
- package/lib/components/Dropdown/Dropdown.js +0 -90
- package/lib/components/Dropdown/Dropdown.test.js +0 -62
- package/lib/components/Dropdown/index.js +0 -1
- package/lib/components/DropdownField/DropdownField.js +0 -155
- package/lib/components/DropdownField/DropdownField.stories.js +0 -222
- package/lib/components/DropdownField/DropdownField.test.js +0 -60
- package/lib/components/DropdownField/index.js +0 -1
- package/lib/components/Panel/Panel.js +0 -71
- package/lib/components/Panel/Panel.stories.js +0 -35
- package/lib/components/Panel/Panel.test.js +0 -52
- package/lib/components/Panel/index.js +0 -1
- package/lib/components/Popover/Popover.js +0 -65
- package/lib/components/Popover/Popover.stories.js +0 -52
- package/lib/components/Popover/Popover.test.js +0 -75
- package/lib/components/Popover/index.js +0 -2
- package/lib/recipes/InputBoxWithLinkedChip.stories.js +0 -43
- package/lib/styles/variants/popover.js +0 -76
@@ -0,0 +1,120 @@
|
|
1
|
+
import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
|
2
|
+
import _slicedToArray from "@babel/runtime-corejs3/helpers/esm/slicedToArray";
|
3
|
+
import React, { useState } from 'react';
|
4
|
+
import CloseIcon from 'mdi-react/CloseIcon';
|
5
|
+
import { Box, Button, Icon, IconButton, Text } from '../index';
|
6
|
+
import RadioField from '../components/RadioField';
|
7
|
+
import RadioGroupField from '../components/RadioGroupField';
|
8
|
+
import { jsx as ___EmotionJSX } from "@emotion/react";
|
9
|
+
export default {
|
10
|
+
title: 'Recipes/RadioButtonsWithLinks'
|
11
|
+
};
|
12
|
+
export var Default = function Default() {
|
13
|
+
var roles = [{
|
14
|
+
name: 'Client Application Developer'
|
15
|
+
}, {
|
16
|
+
name: 'Environment Admin',
|
17
|
+
isDisabled: true
|
18
|
+
}, {
|
19
|
+
name: 'Identity Data Admin',
|
20
|
+
isDisabled: true
|
21
|
+
}, {
|
22
|
+
name: 'Organization Admin'
|
23
|
+
}];
|
24
|
+
var titleSx = {
|
25
|
+
fontSize: 'md',
|
26
|
+
color: 'neutral.20',
|
27
|
+
fontWeight: 2
|
28
|
+
};
|
29
|
+
var subtitleSx = {
|
30
|
+
fontSize: 'md',
|
31
|
+
color: 'neutral.10'
|
32
|
+
};
|
33
|
+
|
34
|
+
var RadioFieldWithButton = function RadioFieldWithButton(_ref) {
|
35
|
+
var fieldName = _ref.fieldName,
|
36
|
+
isDisabled = _ref.isDisabled;
|
37
|
+
|
38
|
+
var _useState = useState(false),
|
39
|
+
_useState2 = _slicedToArray(_useState, 2),
|
40
|
+
isOpen = _useState2[0],
|
41
|
+
setIsOpen = _useState2[1];
|
42
|
+
|
43
|
+
return ___EmotionJSX(Box, null, ___EmotionJSX(Box, {
|
44
|
+
isRow: true,
|
45
|
+
alignItems: "center"
|
46
|
+
}, ___EmotionJSX(RadioField, {
|
47
|
+
value: fieldName,
|
48
|
+
label: fieldName,
|
49
|
+
isDisabled: isDisabled
|
50
|
+
}), ___EmotionJSX(Button, {
|
51
|
+
variant: "text",
|
52
|
+
mb: "xs",
|
53
|
+
ml: "md",
|
54
|
+
onPress: function onPress() {
|
55
|
+
return setIsOpen(function (prev) {
|
56
|
+
return !prev;
|
57
|
+
});
|
58
|
+
},
|
59
|
+
isDisabled: isDisabled
|
60
|
+
}, "".concat(isOpen ? 'Hide' : 'Show', " Permissions"))), isOpen && ___EmotionJSX(PermissionsList, {
|
61
|
+
onPress: function onPress() {
|
62
|
+
return setIsOpen(false);
|
63
|
+
}
|
64
|
+
}));
|
65
|
+
};
|
66
|
+
|
67
|
+
var PermissionsList = function PermissionsList(_ref2) {
|
68
|
+
var onPress = _ref2.onPress;
|
69
|
+
return ___EmotionJSX(Box, {
|
70
|
+
p: "md",
|
71
|
+
bg: "neutral.95"
|
72
|
+
}, ___EmotionJSX(Box, {
|
73
|
+
isRow: true,
|
74
|
+
justifyContent: "space-between",
|
75
|
+
mb: "sm"
|
76
|
+
}, ___EmotionJSX(Text, {
|
77
|
+
sx: {
|
78
|
+
fontWeight: 2
|
79
|
+
}
|
80
|
+
}, "Permissions"), ___EmotionJSX(IconButton, {
|
81
|
+
onPress: onPress
|
82
|
+
}, ___EmotionJSX(Icon, {
|
83
|
+
icon: CloseIcon
|
84
|
+
}))), ___EmotionJSX(Box, null, ___EmotionJSX(Text, {
|
85
|
+
sx: titleSx,
|
86
|
+
mb: "xs"
|
87
|
+
}, "Resource"), ___EmotionJSX(Text, {
|
88
|
+
sx: subtitleSx,
|
89
|
+
mb: "sm"
|
90
|
+
}, "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua."), ___EmotionJSX(Text, {
|
91
|
+
sx: titleSx,
|
92
|
+
mb: "xs"
|
93
|
+
}, "Push Credentials"), ___EmotionJSX(Text, {
|
94
|
+
sx: subtitleSx,
|
95
|
+
mb: "sm"
|
96
|
+
}, "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod"), ___EmotionJSX(Text, {
|
97
|
+
sx: titleSx,
|
98
|
+
mb: "xs"
|
99
|
+
}, "Organization"), ___EmotionJSX(Text, {
|
100
|
+
sx: subtitleSx,
|
101
|
+
mb: "sm"
|
102
|
+
}, "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, {
|
103
|
+
sx: titleSx,
|
104
|
+
mb: "xs"
|
105
|
+
}, "Image"), ___EmotionJSX(Text, {
|
106
|
+
sx: subtitleSx,
|
107
|
+
mb: "sm"
|
108
|
+
}, "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod")));
|
109
|
+
};
|
110
|
+
|
111
|
+
return ___EmotionJSX(RadioGroupField, null, _mapInstanceProperty(roles).call(roles, function (_ref3) {
|
112
|
+
var name = _ref3.name,
|
113
|
+
isDisabled = _ref3.isDisabled;
|
114
|
+
return ___EmotionJSX(RadioFieldWithButton, {
|
115
|
+
fieldName: name,
|
116
|
+
isDisabled: isDisabled,
|
117
|
+
key: name
|
118
|
+
});
|
119
|
+
}));
|
120
|
+
};
|
@@ -49,6 +49,17 @@ export var input = _objectSpread(_objectSpread({}, text.inputValue), {}, {
|
|
49
49
|
'&::placeholder': text.placeholder,
|
50
50
|
'&::-ms-expand': {
|
51
51
|
display: 'none'
|
52
|
+
},
|
53
|
+
'&::-webkit-contacts-auto-fill-button, &::-webkit-credentials-auto-fill-button': {
|
54
|
+
visibility: 'hidden',
|
55
|
+
display: 'none !important',
|
56
|
+
pointerEvents: 'none',
|
57
|
+
height: 0,
|
58
|
+
width: 0,
|
59
|
+
margin: 0
|
60
|
+
},
|
61
|
+
'&::-ms-reveal, &::-ms-clear': {
|
62
|
+
display: 'none'
|
52
63
|
}
|
53
64
|
}); // Example variant input
|
54
65
|
|
@@ -117,6 +128,10 @@ input.container = (_input$container = {
|
|
117
128
|
backgroundColor: 'accent.95',
|
118
129
|
border: 'none'
|
119
130
|
},
|
131
|
+
'> textarea': {
|
132
|
+
backgroundColor: 'accent.95',
|
133
|
+
border: 'none'
|
134
|
+
},
|
120
135
|
'&:after': {
|
121
136
|
display: 'none'
|
122
137
|
}
|
package/lib/styles/theme.js
CHANGED
@@ -14,12 +14,12 @@ var accordionTitle = {
|
|
14
14
|
var accordion = {
|
15
15
|
display: 'flex',
|
16
16
|
mt: '5px',
|
17
|
-
mb: '
|
17
|
+
mb: '20px',
|
18
18
|
alignItems: 'flex-start'
|
19
19
|
};
|
20
20
|
var accordionBody = {
|
21
21
|
display: 'none !important',
|
22
|
-
|
22
|
+
pt: 'md',
|
23
23
|
width: '100%',
|
24
24
|
'.is-open &': {
|
25
25
|
display: 'flex !important'
|
@@ -28,10 +28,10 @@ var accordionBody = {
|
|
28
28
|
var accordionGridHeader = {
|
29
29
|
cursor: 'pointer',
|
30
30
|
lineHeight: '30px',
|
31
|
-
|
31
|
+
pl: 'sm',
|
32
32
|
outline: 'none',
|
33
33
|
display: 'flex',
|
34
|
-
justifyContent: '
|
34
|
+
justifyContent: 'center',
|
35
35
|
flexShrink: 0,
|
36
36
|
wordBreak: 'inherit',
|
37
37
|
whiteSpace: 'nowrap',
|
@@ -45,12 +45,9 @@ var accordionGridHeader = {
|
|
45
45
|
WebkitBoxShadow: 'focus',
|
46
46
|
MozBoxShadow: 'focus'
|
47
47
|
},
|
48
|
-
|
48
|
+
minHeight: '64px',
|
49
49
|
'&.is-hovered': {
|
50
|
-
|
51
|
-
'& div > div > div > span': {
|
52
|
-
color: 'active'
|
53
|
-
}
|
50
|
+
backgroundColor: 'accent.99'
|
54
51
|
},
|
55
52
|
'&.is-pressed': {
|
56
53
|
color: 'accent.20',
|
@@ -61,6 +58,7 @@ var accordionGridHeader = {
|
|
61
58
|
};
|
62
59
|
var accordionGridBody = {
|
63
60
|
display: 'none !important',
|
61
|
+
pl: 'sm',
|
64
62
|
width: '100%',
|
65
63
|
'&.is-selected': {
|
66
64
|
display: 'flex !important'
|
@@ -16,20 +16,6 @@ import { text } from './text';
|
|
16
16
|
var base = {
|
17
17
|
display: 'flex'
|
18
18
|
};
|
19
|
-
var panel = {
|
20
|
-
outline: 'none',
|
21
|
-
position: 'relative',
|
22
|
-
bg: 'white',
|
23
|
-
borderLeft: 'separator',
|
24
|
-
transition: 'margin 0.25s ease-in',
|
25
|
-
visibility: 'hidden',
|
26
|
-
'&.is-focused': {
|
27
|
-
boxShadow: 'focus'
|
28
|
-
},
|
29
|
-
'&.is-visible': {
|
30
|
-
visibility: 'visible'
|
31
|
-
}
|
32
|
-
};
|
33
19
|
var card = {
|
34
20
|
boxShadow: 'standard',
|
35
21
|
p: 'lg',
|
@@ -85,6 +71,10 @@ var listViewItem = _objectSpread(_objectSpread({}, base), {}, {
|
|
85
71
|
},
|
86
72
|
'&.is-focused': {
|
87
73
|
boxShadow: 'inset 0 0 5px #5873bdbf'
|
74
|
+
},
|
75
|
+
'&.has-separator': {
|
76
|
+
borderBottom: '1px solid',
|
77
|
+
borderBottomColor: 'line.hairline'
|
88
78
|
}
|
89
79
|
});
|
90
80
|
|
@@ -98,14 +88,27 @@ var listBoxSectionTitle = {
|
|
98
88
|
};
|
99
89
|
var chip = {
|
100
90
|
cursor: 'pointer',
|
101
|
-
|
102
|
-
p: '10px',
|
91
|
+
p: '3px 5px 4px 5px',
|
103
92
|
alignItems: 'center',
|
104
93
|
justifyContent: 'center',
|
105
94
|
minWidth: '50px',
|
106
95
|
alignSelf: 'flex-start',
|
107
96
|
display: 'inline-flex !important',
|
108
|
-
borderRadius: '5px'
|
97
|
+
borderRadius: '5px',
|
98
|
+
fontWeight: 1,
|
99
|
+
'& button': {
|
100
|
+
backgroundColor: 'transparent',
|
101
|
+
marginLeft: 'xs',
|
102
|
+
marginTop: '1px',
|
103
|
+
padding: '0',
|
104
|
+
'&.is-hovered': {
|
105
|
+
backgroundColor: 'white'
|
106
|
+
},
|
107
|
+
'& .mdi-icon': {
|
108
|
+
marginLeft: '0',
|
109
|
+
padding: '2px'
|
110
|
+
}
|
111
|
+
}
|
109
112
|
};
|
110
113
|
var inputInContainerSlot = {
|
111
114
|
position: 'absolute',
|
@@ -229,6 +232,28 @@ var datePicker = {
|
|
229
232
|
}
|
230
233
|
}
|
231
234
|
};
|
235
|
+
var fileInputFieldWrapper = {
|
236
|
+
display: 'flex',
|
237
|
+
border: '1px dashed',
|
238
|
+
borderColor: 'active',
|
239
|
+
padding: '10px 0',
|
240
|
+
'&.is-drag-active': {
|
241
|
+
backgroundColor: 'accent.95'
|
242
|
+
},
|
243
|
+
'&.is-error': {
|
244
|
+
borderColor: 'critical.dark'
|
245
|
+
},
|
246
|
+
'&.is-success': {
|
247
|
+
borderColor: 'success.dark'
|
248
|
+
},
|
249
|
+
'&.is-warning': {
|
250
|
+
borderColor: 'warning.dark'
|
251
|
+
},
|
252
|
+
'&.is-loading': {
|
253
|
+
justifyContent: 'center',
|
254
|
+
alignItems: 'center'
|
255
|
+
}
|
256
|
+
};
|
232
257
|
export default {
|
233
258
|
base: base,
|
234
259
|
card: card,
|
@@ -237,10 +262,10 @@ export default {
|
|
237
262
|
datePicker: datePicker,
|
238
263
|
expandableRow: expandableRow,
|
239
264
|
inputInContainerSlot: inputInContainerSlot,
|
265
|
+
fileInputFieldWrapper: fileInputFieldWrapper,
|
240
266
|
listItem: listItem,
|
241
267
|
listBoxSectionTitle: listBoxSectionTitle,
|
242
268
|
listViewItem: listViewItem,
|
243
|
-
panel: panel,
|
244
269
|
radioCheckedContent: radioCheckedContent,
|
245
270
|
radioContainer: radioContainer,
|
246
271
|
scrollbox: scrollbox,
|
@@ -158,32 +158,7 @@ var accordionHeader = _objectSpread(_objectSpread({}, base), {}, {
|
|
158
158
|
color: 'accent.20'
|
159
159
|
},
|
160
160
|
'&.is-focused': _objectSpread({}, defaultFocus)
|
161
|
-
});
|
162
|
-
|
163
|
-
|
164
|
-
var icon = {
|
165
|
-
p: '3px',
|
166
|
-
alignSelf: 'flex-start',
|
167
|
-
flexGrow: 0,
|
168
|
-
borderRadius: '100%',
|
169
|
-
cursor: 'pointer',
|
170
|
-
bg: 'transparent',
|
171
|
-
'path': {
|
172
|
-
fill: 'text.secondary'
|
173
|
-
},
|
174
|
-
outline: 'none',
|
175
|
-
color: 'white',
|
176
|
-
'&.is-hovered': {
|
177
|
-
bg: 'accent.90'
|
178
|
-
},
|
179
|
-
'&.is-pressed': {
|
180
|
-
'path': {
|
181
|
-
fill: 'white'
|
182
|
-
},
|
183
|
-
bg: 'active'
|
184
|
-
},
|
185
|
-
'&.is-focused': _objectSpread({}, defaultFocus)
|
186
|
-
};
|
161
|
+
});
|
187
162
|
|
188
163
|
var primary = _objectSpread(_objectSpread({}, base), {}, {
|
189
164
|
display: 'inline-flex',
|
@@ -309,7 +284,7 @@ var inline = _objectSpread(_objectSpread({}, base), {}, {
|
|
309
284
|
bg: 'white',
|
310
285
|
height: '22px',
|
311
286
|
lineHeight: 1,
|
312
|
-
fontSize: '
|
287
|
+
fontSize: 'sm',
|
313
288
|
borderRadius: '15px',
|
314
289
|
border: '1px solid',
|
315
290
|
borderColor: 'active',
|
@@ -452,6 +427,25 @@ var expandableRow = {
|
|
452
427
|
}
|
453
428
|
}
|
454
429
|
};
|
430
|
+
var fileInputField = {
|
431
|
+
background: 'none',
|
432
|
+
cursor: 'pointer',
|
433
|
+
'& span': {
|
434
|
+
textAlign: 'initial'
|
435
|
+
},
|
436
|
+
'&:focus-visible': {
|
437
|
+
outline: 'none'
|
438
|
+
},
|
439
|
+
'&.is-hovered, &.is-pressed': {
|
440
|
+
cursor: 'pointer',
|
441
|
+
'& span': {
|
442
|
+
textDecoration: 'underline'
|
443
|
+
}
|
444
|
+
},
|
445
|
+
'&.is-focused': {
|
446
|
+
boxShadow: 'focus'
|
447
|
+
}
|
448
|
+
};
|
455
449
|
export default {
|
456
450
|
accordionHeader: accordionHeader,
|
457
451
|
chipDeleteButton: chipDeleteButton,
|
@@ -470,8 +464,8 @@ export default {
|
|
470
464
|
'&.is-focused': _objectSpread({}, defaultFocus)
|
471
465
|
}),
|
472
466
|
expandableRow: expandableRow,
|
467
|
+
fileInputField: fileInputField,
|
473
468
|
iconButton: iconButton,
|
474
|
-
icon: icon,
|
475
469
|
imageUpload: imageUpload,
|
476
470
|
inline: inline,
|
477
471
|
inverted: inverted,
|
@@ -24,7 +24,6 @@ import menu from './menu';
|
|
24
24
|
import menuItem from './menuItem';
|
25
25
|
import messages from './messages';
|
26
26
|
import numberField from './numberField';
|
27
|
-
import popover from './popover';
|
28
27
|
import overlayPanel from './overlayPanel';
|
29
28
|
import popoverMenu from './popoverMenu';
|
30
29
|
import rockerbutton from './rockerbutton';
|
@@ -47,7 +46,6 @@ export default _objectSpread(_objectSpread({
|
|
47
46
|
modal: modal,
|
48
47
|
numberField: numberField,
|
49
48
|
overlayPanel: overlayPanel,
|
50
|
-
popover: popover,
|
51
49
|
popoverMenu: popoverMenu,
|
52
50
|
rockerbutton: rockerbutton,
|
53
51
|
separator: separator,
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@pingux/astro",
|
3
|
-
"version": "1.0.0-alpha.
|
3
|
+
"version": "1.0.0-alpha.20",
|
4
4
|
"description": "PingUX themeable React component library",
|
5
5
|
"author": "uxdev@pingidentity.com",
|
6
6
|
"license": "Apache-2.0",
|
@@ -129,12 +129,13 @@
|
|
129
129
|
"chroma-js": "^2.1.0",
|
130
130
|
"classnames": "^2.2.6",
|
131
131
|
"emotion-normalize": "^11.0.1",
|
132
|
-
"lodash": "^4.17.
|
132
|
+
"lodash": "^4.17.21",
|
133
133
|
"mdi-react": "^7.4.0",
|
134
134
|
"moment": "^2.29.1",
|
135
135
|
"prop-types": "^15.7.2",
|
136
136
|
"react-calendar": "^3.4.0",
|
137
137
|
"react-color": "^2.19.3",
|
138
|
+
"react-dropzone": "^11.4.2",
|
138
139
|
"rebass": "^4.0.7",
|
139
140
|
"recharts": "^2.1.4",
|
140
141
|
"regenerator-runtime": "^0.13.7",
|
@@ -1,112 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
var _interopRequireWildcard = require("@babel/runtime-corejs3/helpers/interopRequireWildcard");
|
4
|
-
|
5
|
-
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
6
|
-
|
7
|
-
var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
|
8
|
-
|
9
|
-
_Object$defineProperty(exports, "__esModule", {
|
10
|
-
value: true
|
11
|
-
});
|
12
|
-
|
13
|
-
exports["default"] = void 0;
|
14
|
-
|
15
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/extends"));
|
16
|
-
|
17
|
-
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/objectWithoutProperties"));
|
18
|
-
|
19
|
-
var _react = _interopRequireWildcard(require("react"));
|
20
|
-
|
21
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
22
|
-
|
23
|
-
var _forms = require("@rebass/forms");
|
24
|
-
|
25
|
-
var _focus = require("@react-aria/focus");
|
26
|
-
|
27
|
-
var _hooks = require("../../hooks");
|
28
|
-
|
29
|
-
var _react2 = require("@emotion/react");
|
30
|
-
|
31
|
-
/**
|
32
|
-
* Basic dropdown menu input.
|
33
|
-
* Accepts most styling props from [styled-system](https://styled-system.com/table).
|
34
|
-
* Built on top of the [Select component from Rebass Forms](https://rebassjs.org/forms/select).
|
35
|
-
*/
|
36
|
-
var Dropdown = /*#__PURE__*/_react["default"].forwardRef(function (props, ref) {
|
37
|
-
var className = props.className,
|
38
|
-
children = props.children,
|
39
|
-
hasNoneOption = props.hasNoneOption,
|
40
|
-
hasDisabledFirstOption = props.hasDisabledFirstOption,
|
41
|
-
firstLabel = props.firstLabel,
|
42
|
-
noneLabel = props.noneLabel,
|
43
|
-
defaultValue = props.defaultValue,
|
44
|
-
value = props.value,
|
45
|
-
others = (0, _objectWithoutProperties2["default"])(props, ["className", "children", "hasNoneOption", "hasDisabledFirstOption", "firstLabel", "noneLabel", "defaultValue", "value"]);
|
46
|
-
var dropdownRef = (0, _react.useRef)();
|
47
|
-
/* istanbul ignore next */
|
48
|
-
|
49
|
-
(0, _react.useImperativeHandle)(ref, function () {
|
50
|
-
return dropdownRef.current;
|
51
|
-
});
|
52
|
-
|
53
|
-
var _useFocusRing = (0, _focus.useFocusRing)(),
|
54
|
-
isFocusVisible = _useFocusRing.isFocusVisible,
|
55
|
-
focusProps = _useFocusRing.focusProps;
|
56
|
-
|
57
|
-
var _useStatusClasses = (0, _hooks.useStatusClasses)(className, {
|
58
|
-
isFocused: isFocusVisible
|
59
|
-
}),
|
60
|
-
classNames = _useStatusClasses.classNames;
|
61
|
-
|
62
|
-
return (0, _react2.jsx)(_forms.Select, (0, _extends2["default"])({
|
63
|
-
ref: dropdownRef,
|
64
|
-
className: classNames,
|
65
|
-
defaultValue: value ? undefined : defaultValue || '',
|
66
|
-
value: value
|
67
|
-
}, others, focusProps), !hasNoneOption && (0, _react2.jsx)("option", {
|
68
|
-
key: "__empty",
|
69
|
-
value: "",
|
70
|
-
disabled: hasDisabledFirstOption
|
71
|
-
}, firstLabel), hasNoneOption && (0, _react2.jsx)(_react["default"].Fragment, null, (0, _react2.jsx)("option", {
|
72
|
-
key: "__empty",
|
73
|
-
value: "",
|
74
|
-
disabled: hasDisabledFirstOption
|
75
|
-
}, noneLabel || firstLabel), (0, _react2.jsx)("option", {
|
76
|
-
key: "__spacer",
|
77
|
-
disabled: true
|
78
|
-
}, "--------")), children);
|
79
|
-
});
|
80
|
-
|
81
|
-
Dropdown.propTypes = {
|
82
|
-
/** Displays a none option within the dropdown options */
|
83
|
-
hasNoneOption: _propTypes["default"].bool,
|
84
|
-
|
85
|
-
/** Whether the first option is disabled. Useful to prevent reselection of the first option. */
|
86
|
-
hasDisabledFirstOption: _propTypes["default"].bool,
|
87
|
-
|
88
|
-
/** Id of the selected element */
|
89
|
-
id: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].number]),
|
90
|
-
|
91
|
-
/** Label for first option. */
|
92
|
-
firstLabel: _propTypes["default"].string,
|
93
|
-
|
94
|
-
/** Label for none option. `firstLabel` prop can also be used. */
|
95
|
-
noneLabel: _propTypes["default"].string,
|
96
|
-
|
97
|
-
/** Value of the select (controlled). */
|
98
|
-
value: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].number]),
|
99
|
-
|
100
|
-
/** Default value of the select (uncontrolled). */
|
101
|
-
defaultValue: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].number]),
|
102
|
-
|
103
|
-
/** Handler that is called when the element's selection state changes. */
|
104
|
-
onChange: _propTypes["default"].func
|
105
|
-
};
|
106
|
-
Dropdown.defaultProps = {
|
107
|
-
hasNoneOption: false,
|
108
|
-
firstLabel: 'Select an option'
|
109
|
-
};
|
110
|
-
Dropdown.displayName = 'Dropdown';
|
111
|
-
var _default = Dropdown;
|
112
|
-
exports["default"] = _default;
|
@@ -1,80 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
4
|
-
|
5
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/extends"));
|
6
|
-
|
7
|
-
var _react = _interopRequireDefault(require("react"));
|
8
|
-
|
9
|
-
var _testAxe = _interopRequireDefault(require("../../utils/testUtils/testAxe"));
|
10
|
-
|
11
|
-
var _testWrapper = require("../../utils/testUtils/testWrapper");
|
12
|
-
|
13
|
-
var _ = _interopRequireDefault(require("."));
|
14
|
-
|
15
|
-
var _react2 = require("@emotion/react");
|
16
|
-
|
17
|
-
var testId = 'test-box';
|
18
|
-
var defaultProps = {
|
19
|
-
'data-testid': testId
|
20
|
-
};
|
21
|
-
|
22
|
-
var getComponent = function getComponent() {
|
23
|
-
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
24
|
-
var children = props.children;
|
25
|
-
return (0, _testWrapper.render)((0, _react2.jsx)(_["default"], (0, _extends2["default"])({}, defaultProps, props), children));
|
26
|
-
}; // Need to be added to each test file to test accessibility using axe.
|
27
|
-
|
28
|
-
|
29
|
-
(0, _testAxe["default"])(getComponent, {
|
30
|
-
// Dropdown with label provided by DropdownField
|
31
|
-
rules: {
|
32
|
-
'select-name': {
|
33
|
-
enabled: false
|
34
|
-
}
|
35
|
-
}
|
36
|
-
});
|
37
|
-
test('dropdown renders', function () {
|
38
|
-
getComponent();
|
39
|
-
|
40
|
-
var dropdown = _testWrapper.screen.getByTestId(testId);
|
41
|
-
|
42
|
-
expect(dropdown).toBeInstanceOf(HTMLSelectElement);
|
43
|
-
expect(dropdown).toBeInTheDocument();
|
44
|
-
});
|
45
|
-
test('hasNoneOption prop renders none option', function () {
|
46
|
-
getComponent({
|
47
|
-
hasNoneOption: true,
|
48
|
-
noneLabel: 'None'
|
49
|
-
});
|
50
|
-
expect((0, _testWrapper.within)(document).getByText('None')).toBeInTheDocument();
|
51
|
-
});
|
52
|
-
test('default option is first one', function () {
|
53
|
-
getComponent();
|
54
|
-
|
55
|
-
var firstOption = _testWrapper.screen.getByRole('option');
|
56
|
-
|
57
|
-
expect(firstOption.value).toEqual('');
|
58
|
-
expect(firstOption).toHaveAttribute('selected', '');
|
59
|
-
expect(firstOption).toBeEnabled();
|
60
|
-
});
|
61
|
-
test('default option is disabled when hasDisabledFirstOption is passed in', function () {
|
62
|
-
getComponent({
|
63
|
-
hasDisabledFirstOption: true
|
64
|
-
});
|
65
|
-
|
66
|
-
var firstOption = _testWrapper.screen.getByRole('option');
|
67
|
-
|
68
|
-
expect(firstOption.value).toEqual('');
|
69
|
-
expect(firstOption).toHaveAttribute('selected', '');
|
70
|
-
expect(firstOption).toBeDisabled();
|
71
|
-
});
|
72
|
-
test('default option is not first one when custom defaultValue is passed in', function () {
|
73
|
-
getComponent({
|
74
|
-
defaultValue: '1'
|
75
|
-
});
|
76
|
-
|
77
|
-
var firstOption = _testWrapper.screen.getByRole('option');
|
78
|
-
|
79
|
-
expect(firstOption).not.toHaveAttribute('selected', '');
|
80
|
-
});
|