@pingux/astro 1.0.0-alpha.1 → 1.0.0-alpha.13
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 +132 -0
- package/lib/cjs/components/AccordionItem/AccordionItem.js +3 -1
- package/lib/cjs/components/Button/Button.stories.js +5 -11
- 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/FileInputField/index.js +18 -0
- package/lib/cjs/components/ListView/ListView.js +4 -3
- package/lib/cjs/components/ListViewItem/ListViewItem.js +3 -6
- package/lib/cjs/components/NumberField/NumberField.js +4 -2
- package/lib/cjs/components/NumberField/NumberField.test.js +15 -0
- package/lib/cjs/components/Tab/Tab.js +11 -4
- 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/hooks/useCopyToClipboard/index.js +18 -0
- package/lib/cjs/hooks/useCopyToClipboard/useCopyToClipboard.js +83 -0
- package/lib/cjs/hooks/useCopyToClipboard/useCopyToClipboard.test.js +79 -0
- package/lib/cjs/index.js +10 -0
- 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 +11 -0
- package/lib/cjs/styles/variants/accordion.js +2 -2
- package/lib/cjs/styles/variants/boxes.js +27 -0
- package/lib/cjs/styles/variants/buttons.js +21 -1
- package/lib/cjs/styles/variants/tabs.js +1 -0
- package/lib/components/AccordionItem/AccordionItem.js +3 -1
- package/lib/components/Button/Button.stories.js +5 -10
- 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/ListView/ListView.js +4 -3
- package/lib/components/ListViewItem/ListViewItem.js +3 -5
- package/lib/components/NumberField/NumberField.js +4 -2
- package/lib/components/NumberField/NumberField.test.js +9 -0
- package/lib/components/Tab/Tab.js +11 -4
- 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/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 -0
- package/lib/recipes/CopyToClipboard.stories.js +25 -0
- package/lib/recipes/RadioButtonsWithLinks.stories.js +120 -0
- package/lib/styles/forms/input.js +11 -0
- package/lib/styles/variants/accordion.js +2 -2
- package/lib/styles/variants/boxes.js +27 -0
- package/lib/styles/variants/buttons.js +21 -1
- package/lib/styles/variants/tabs.js +1 -0
- package/package.json +3 -2
@@ -0,0 +1,146 @@
|
|
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 = exports["default"] = void 0;
|
14
|
+
|
15
|
+
var _map = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/map"));
|
16
|
+
|
17
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/slicedToArray"));
|
18
|
+
|
19
|
+
var _react = _interopRequireWildcard(require("react"));
|
20
|
+
|
21
|
+
var _CloseIcon = _interopRequireDefault(require("mdi-react/CloseIcon"));
|
22
|
+
|
23
|
+
var _index = require("../index");
|
24
|
+
|
25
|
+
var _RadioField = _interopRequireDefault(require("../components/RadioField"));
|
26
|
+
|
27
|
+
var _RadioGroupField = _interopRequireDefault(require("../components/RadioGroupField"));
|
28
|
+
|
29
|
+
var _react2 = require("@emotion/react");
|
30
|
+
|
31
|
+
var _default = {
|
32
|
+
title: 'Recipes/RadioButtonsWithLinks'
|
33
|
+
};
|
34
|
+
exports["default"] = _default;
|
35
|
+
|
36
|
+
var Default = function Default() {
|
37
|
+
var roles = [{
|
38
|
+
name: 'Client Application Developer'
|
39
|
+
}, {
|
40
|
+
name: 'Environment Admin',
|
41
|
+
isDisabled: true
|
42
|
+
}, {
|
43
|
+
name: 'Identity Data Admin',
|
44
|
+
isDisabled: true
|
45
|
+
}, {
|
46
|
+
name: 'Organization Admin'
|
47
|
+
}];
|
48
|
+
var titleSx = {
|
49
|
+
fontSize: 'md',
|
50
|
+
color: 'neutral.20',
|
51
|
+
fontWeight: 2
|
52
|
+
};
|
53
|
+
var subtitleSx = {
|
54
|
+
fontSize: 'md',
|
55
|
+
color: 'neutral.10'
|
56
|
+
};
|
57
|
+
|
58
|
+
var RadioFieldWithButton = function RadioFieldWithButton(_ref) {
|
59
|
+
var fieldName = _ref.fieldName,
|
60
|
+
isDisabled = _ref.isDisabled;
|
61
|
+
|
62
|
+
var _useState = (0, _react.useState)(false),
|
63
|
+
_useState2 = (0, _slicedToArray2["default"])(_useState, 2),
|
64
|
+
isOpen = _useState2[0],
|
65
|
+
setIsOpen = _useState2[1];
|
66
|
+
|
67
|
+
return (0, _react2.jsx)(_index.Box, null, (0, _react2.jsx)(_index.Box, {
|
68
|
+
isRow: true,
|
69
|
+
alignItems: "center"
|
70
|
+
}, (0, _react2.jsx)(_RadioField["default"], {
|
71
|
+
value: fieldName,
|
72
|
+
label: fieldName,
|
73
|
+
isDisabled: isDisabled
|
74
|
+
}), (0, _react2.jsx)(_index.Button, {
|
75
|
+
variant: "text",
|
76
|
+
mb: "xs",
|
77
|
+
ml: "md",
|
78
|
+
onPress: function onPress() {
|
79
|
+
return setIsOpen(function (prev) {
|
80
|
+
return !prev;
|
81
|
+
});
|
82
|
+
},
|
83
|
+
isDisabled: isDisabled
|
84
|
+
}, "".concat(isOpen ? 'Hide' : 'Show', " Permissions"))), isOpen && (0, _react2.jsx)(PermissionsList, {
|
85
|
+
onPress: function onPress() {
|
86
|
+
return setIsOpen(false);
|
87
|
+
}
|
88
|
+
}));
|
89
|
+
};
|
90
|
+
|
91
|
+
var PermissionsList = function PermissionsList(_ref2) {
|
92
|
+
var onPress = _ref2.onPress;
|
93
|
+
return (0, _react2.jsx)(_index.Box, {
|
94
|
+
p: "md",
|
95
|
+
bg: "neutral.95"
|
96
|
+
}, (0, _react2.jsx)(_index.Box, {
|
97
|
+
isRow: true,
|
98
|
+
justifyContent: "space-between",
|
99
|
+
mb: "sm"
|
100
|
+
}, (0, _react2.jsx)(_index.Text, {
|
101
|
+
sx: {
|
102
|
+
fontWeight: 2
|
103
|
+
}
|
104
|
+
}, "Permissions"), (0, _react2.jsx)(_index.IconButton, {
|
105
|
+
onPress: onPress
|
106
|
+
}, (0, _react2.jsx)(_index.Icon, {
|
107
|
+
icon: _CloseIcon["default"]
|
108
|
+
}))), (0, _react2.jsx)(_index.Box, null, (0, _react2.jsx)(_index.Text, {
|
109
|
+
sx: titleSx,
|
110
|
+
mb: "xs"
|
111
|
+
}, "Resource"), (0, _react2.jsx)(_index.Text, {
|
112
|
+
sx: subtitleSx,
|
113
|
+
mb: "sm"
|
114
|
+
}, "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua."), (0, _react2.jsx)(_index.Text, {
|
115
|
+
sx: titleSx,
|
116
|
+
mb: "xs"
|
117
|
+
}, "Push Credentials"), (0, _react2.jsx)(_index.Text, {
|
118
|
+
sx: subtitleSx,
|
119
|
+
mb: "sm"
|
120
|
+
}, "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod"), (0, _react2.jsx)(_index.Text, {
|
121
|
+
sx: titleSx,
|
122
|
+
mb: "xs"
|
123
|
+
}, "Organization"), (0, _react2.jsx)(_index.Text, {
|
124
|
+
sx: subtitleSx,
|
125
|
+
mb: "sm"
|
126
|
+
}, "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"), (0, _react2.jsx)(_index.Text, {
|
127
|
+
sx: titleSx,
|
128
|
+
mb: "xs"
|
129
|
+
}, "Image"), (0, _react2.jsx)(_index.Text, {
|
130
|
+
sx: subtitleSx,
|
131
|
+
mb: "sm"
|
132
|
+
}, "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod")));
|
133
|
+
};
|
134
|
+
|
135
|
+
return (0, _react2.jsx)(_RadioGroupField["default"], null, (0, _map["default"])(roles).call(roles, function (_ref3) {
|
136
|
+
var name = _ref3.name,
|
137
|
+
isDisabled = _ref3.isDisabled;
|
138
|
+
return (0, _react2.jsx)(RadioFieldWithButton, {
|
139
|
+
fieldName: name,
|
140
|
+
isDisabled: isDisabled,
|
141
|
+
key: name
|
142
|
+
});
|
143
|
+
}));
|
144
|
+
};
|
145
|
+
|
146
|
+
exports.Default = Default;
|
@@ -71,6 +71,17 @@ var input = _objectSpread(_objectSpread({}, _text.text.inputValue), {}, {
|
|
71
71
|
'&::placeholder': _text.text.placeholder,
|
72
72
|
'&::-ms-expand': {
|
73
73
|
display: 'none'
|
74
|
+
},
|
75
|
+
'&::-webkit-contacts-auto-fill-button, &::-webkit-credentials-auto-fill-button': {
|
76
|
+
visibility: 'hidden',
|
77
|
+
display: 'none !important',
|
78
|
+
pointerEvents: 'none',
|
79
|
+
height: 0,
|
80
|
+
width: 0,
|
81
|
+
margin: 0
|
82
|
+
},
|
83
|
+
'&::-ms-reveal, &::-ms-clear': {
|
84
|
+
display: 'none'
|
74
85
|
}
|
75
86
|
}); // Example variant input
|
76
87
|
|
@@ -23,12 +23,12 @@ var accordionTitle = {
|
|
23
23
|
var accordion = {
|
24
24
|
display: 'flex',
|
25
25
|
mt: '5px',
|
26
|
-
mb: '
|
26
|
+
mb: '20px',
|
27
27
|
alignItems: 'flex-start'
|
28
28
|
};
|
29
29
|
var accordionBody = {
|
30
30
|
display: 'none !important',
|
31
|
-
|
31
|
+
pt: 'md',
|
32
32
|
width: '100%',
|
33
33
|
'.is-open &': {
|
34
34
|
display: 'flex !important'
|
@@ -106,6 +106,10 @@ var listViewItem = _objectSpread(_objectSpread({}, base), {}, {
|
|
106
106
|
},
|
107
107
|
'&.is-focused': {
|
108
108
|
boxShadow: 'inset 0 0 5px #5873bdbf'
|
109
|
+
},
|
110
|
+
'&.has-separator': {
|
111
|
+
borderBottom: '1px solid',
|
112
|
+
borderBottomColor: 'line.hairline'
|
109
113
|
}
|
110
114
|
});
|
111
115
|
|
@@ -250,6 +254,28 @@ var datePicker = {
|
|
250
254
|
}
|
251
255
|
}
|
252
256
|
};
|
257
|
+
var fileInputFieldWrapper = {
|
258
|
+
display: 'flex',
|
259
|
+
border: '1px dashed',
|
260
|
+
borderColor: 'active',
|
261
|
+
padding: '10px 0',
|
262
|
+
'&.is-drag-active': {
|
263
|
+
backgroundColor: 'accent.95'
|
264
|
+
},
|
265
|
+
'&.is-error': {
|
266
|
+
borderColor: 'critical.dark'
|
267
|
+
},
|
268
|
+
'&.is-success': {
|
269
|
+
borderColor: 'success.dark'
|
270
|
+
},
|
271
|
+
'&.is-warning': {
|
272
|
+
borderColor: 'warning.dark'
|
273
|
+
},
|
274
|
+
'&.is-loading': {
|
275
|
+
justifyContent: 'center',
|
276
|
+
alignItems: 'center'
|
277
|
+
}
|
278
|
+
};
|
253
279
|
var _default = {
|
254
280
|
base: base,
|
255
281
|
card: card,
|
@@ -258,6 +284,7 @@ var _default = {
|
|
258
284
|
datePicker: datePicker,
|
259
285
|
expandableRow: expandableRow,
|
260
286
|
inputInContainerSlot: inputInContainerSlot,
|
287
|
+
fileInputFieldWrapper: fileInputFieldWrapper,
|
261
288
|
listItem: listItem,
|
262
289
|
listBoxSectionTitle: listBoxSectionTitle,
|
263
290
|
listViewItem: listViewItem,
|
@@ -330,7 +330,7 @@ var inline = _objectSpread(_objectSpread({}, base), {}, {
|
|
330
330
|
bg: 'white',
|
331
331
|
height: '22px',
|
332
332
|
lineHeight: 1,
|
333
|
-
fontSize: '
|
333
|
+
fontSize: 'sm',
|
334
334
|
borderRadius: '15px',
|
335
335
|
border: '1px solid',
|
336
336
|
borderColor: 'active',
|
@@ -473,6 +473,25 @@ var expandableRow = {
|
|
473
473
|
}
|
474
474
|
}
|
475
475
|
};
|
476
|
+
var fileInputField = {
|
477
|
+
background: 'none',
|
478
|
+
cursor: 'pointer',
|
479
|
+
'& span': {
|
480
|
+
textAlign: 'initial'
|
481
|
+
},
|
482
|
+
'&:focus-visible': {
|
483
|
+
outline: 'none'
|
484
|
+
},
|
485
|
+
'&.is-hovered, &.is-pressed': {
|
486
|
+
cursor: 'pointer',
|
487
|
+
'& span': {
|
488
|
+
textDecoration: 'underline'
|
489
|
+
}
|
490
|
+
},
|
491
|
+
'&.is-focused': {
|
492
|
+
boxShadow: 'focus'
|
493
|
+
}
|
494
|
+
};
|
476
495
|
var _default = {
|
477
496
|
accordionHeader: accordionHeader,
|
478
497
|
chipDeleteButton: chipDeleteButton,
|
@@ -491,6 +510,7 @@ var _default = {
|
|
491
510
|
'&.is-focused': _objectSpread({}, defaultFocus)
|
492
511
|
}),
|
493
512
|
expandableRow: expandableRow,
|
513
|
+
fileInputField: fileInputField,
|
494
514
|
iconButton: iconButton,
|
495
515
|
icon: icon,
|
496
516
|
imageUpload: imageUpload,
|
@@ -80,7 +80,9 @@ var AccordionItem = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
80
80
|
"aria-label": ariaLabel || 'Accordion',
|
81
81
|
ref: buttonRef,
|
82
82
|
sx: {
|
83
|
-
display: 'flex'
|
83
|
+
display: 'flex',
|
84
|
+
px: '0',
|
85
|
+
height: 'unset'
|
84
86
|
},
|
85
87
|
variant: "accordionHeader",
|
86
88
|
className: buttonClasses
|
@@ -1,8 +1,3 @@
|
|
1
|
-
import _findInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/find";
|
2
|
-
import _Object$values from "@babel/runtime-corejs3/core-js-stable/object/values";
|
3
|
-
|
4
|
-
var _context;
|
5
|
-
|
6
1
|
import React from 'react';
|
7
2
|
import AddCircleIcon from 'mdi-react/AddCircleIcon';
|
8
3
|
import Box from '../Box';
|
@@ -15,7 +10,9 @@ import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
15
10
|
var variants = buttonVariants;
|
16
11
|
delete variants.ICON;
|
17
12
|
delete variants.ICON_BUTTON;
|
18
|
-
delete variants.INVERTED;
|
13
|
+
delete variants.INVERTED; // add designer approved variants for devs to use here
|
14
|
+
|
15
|
+
var variantOptions = ['critical', 'danger', 'default', 'inline', 'link', 'primary', 'success', 'text'];
|
19
16
|
export default {
|
20
17
|
title: 'Button',
|
21
18
|
component: Button,
|
@@ -23,11 +20,9 @@ export default {
|
|
23
20
|
variant: {
|
24
21
|
control: {
|
25
22
|
type: 'select',
|
26
|
-
options:
|
23
|
+
options: variantOptions
|
27
24
|
},
|
28
|
-
defaultValue:
|
29
|
-
return value === 'default';
|
30
|
-
})
|
25
|
+
defaultValue: 'default'
|
31
26
|
},
|
32
27
|
children: {
|
33
28
|
description: 'Button text.',
|
@@ -1,6 +1,4 @@
|
|
1
1
|
import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
|
2
|
-
import _regeneratorRuntime from "@babel/runtime-corejs3/regenerator";
|
3
|
-
import _asyncToGenerator from "@babel/runtime-corejs3/helpers/esm/asyncToGenerator";
|
4
2
|
import _setTimeout from "@babel/runtime-corejs3/core-js-stable/set-timeout";
|
5
3
|
import _slicedToArray from "@babel/runtime-corejs3/helpers/esm/slicedToArray";
|
6
4
|
import _objectWithoutProperties from "@babel/runtime-corejs3/helpers/esm/objectWithoutProperties";
|
@@ -11,6 +9,7 @@ import { Pressable, useHover } from '@react-aria/interactions';
|
|
11
9
|
import { mergeProps } from '@react-aria/utils';
|
12
10
|
import { Box, Button, Tooltip, TooltipTrigger } from '../../index';
|
13
11
|
import CopyButton from './CopyButton';
|
12
|
+
import useCopyToClipboard from '../../hooks/useCopyToClipboard';
|
14
13
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
15
14
|
|
16
15
|
var TooltipWrapper = function TooltipWrapper(_ref) {
|
@@ -75,75 +74,7 @@ var CopyText = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
75
74
|
|
76
75
|
return undefined;
|
77
76
|
}, [isCopied]);
|
78
|
-
|
79
|
-
var copyToClipboard = /*#__PURE__*/function () {
|
80
|
-
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
81
|
-
var textArea, isSuccessful;
|
82
|
-
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
83
|
-
while (1) {
|
84
|
-
switch (_context.prev = _context.next) {
|
85
|
-
case 0:
|
86
|
-
_context.prev = 0;
|
87
|
-
|
88
|
-
if (!navigator.clipboard) {
|
89
|
-
_context.next = 7;
|
90
|
-
break;
|
91
|
-
}
|
92
|
-
|
93
|
-
_context.next = 4;
|
94
|
-
return navigator.clipboard.writeText(value);
|
95
|
-
|
96
|
-
case 4:
|
97
|
-
setIsCopied(true);
|
98
|
-
_context.next = 20;
|
99
|
-
break;
|
100
|
-
|
101
|
-
case 7:
|
102
|
-
// Workaround for copying in insecure origin
|
103
|
-
textArea = document.createElement('textarea');
|
104
|
-
textArea.value = value;
|
105
|
-
textArea.style.position = 'fixed';
|
106
|
-
document.body.appendChild(textArea);
|
107
|
-
textArea.focus();
|
108
|
-
textArea.select();
|
109
|
-
isSuccessful = document.execCommand('copy');
|
110
|
-
textArea.remove();
|
111
|
-
|
112
|
-
if (!isSuccessful) {
|
113
|
-
_context.next = 19;
|
114
|
-
break;
|
115
|
-
}
|
116
|
-
|
117
|
-
setIsCopied(isSuccessful);
|
118
|
-
_context.next = 20;
|
119
|
-
break;
|
120
|
-
|
121
|
-
case 19:
|
122
|
-
throw new Error('Unable to copy message');
|
123
|
-
|
124
|
-
case 20:
|
125
|
-
_context.next = 25;
|
126
|
-
break;
|
127
|
-
|
128
|
-
case 22:
|
129
|
-
_context.prev = 22;
|
130
|
-
_context.t0 = _context["catch"](0);
|
131
|
-
// eslint-disable-next-line no-console
|
132
|
-
console.error('Failed to copy: ', _context.t0);
|
133
|
-
|
134
|
-
case 25:
|
135
|
-
case "end":
|
136
|
-
return _context.stop();
|
137
|
-
}
|
138
|
-
}
|
139
|
-
}, _callee, null, [[0, 22]]);
|
140
|
-
}));
|
141
|
-
|
142
|
-
return function copyToClipboard() {
|
143
|
-
return _ref2.apply(this, arguments);
|
144
|
-
};
|
145
|
-
}();
|
146
|
-
|
77
|
+
var copyToClipboard = useCopyToClipboard(value, setIsCopied);
|
147
78
|
var content = mode === 'link' ? children : ___EmotionJSX(Button, _extends({
|
148
79
|
variant: "quiet",
|
149
80
|
onPress: copyToClipboard,
|