@pingux/astro 1.0.0-alpha.6 → 1.0.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.
- package/CHANGELOG.md +170 -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/{Panel/index.js → Chip/ChipContext.js} +8 -7
- package/lib/cjs/components/CopyText/CopyText.js +3 -73
- 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/DropdownField → 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 +48 -136
- 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 +4 -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 +20 -18
- package/lib/cjs/styles/variants/buttons.js +2 -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/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 +0 -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 +4 -0
- package/lib/styles/theme.js +0 -3
- package/lib/styles/variants/accordion.js +7 -9
- package/lib/styles/variants/boxes.js +20 -18
- package/lib/styles/variants/buttons.js +2 -28
- package/lib/styles/variants/tabs.js +1 -0
- package/lib/styles/variants/variants.js +0 -2
- package/package.json +2 -2
- package/lib/cjs/components/Dropdown/Dropdown.js +0 -112
- package/lib/cjs/components/Dropdown/Dropdown.test.js +0 -80
- package/lib/cjs/components/Dropdown/index.js +0 -18
- 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
@@ -220,6 +220,31 @@ test('disabled all tabs', function () {
|
|
220
220
|
expect(tab1).not.toContainElement(screen.queryByRole('presentation'));
|
221
221
|
testTabPanel(0);
|
222
222
|
});
|
223
|
+
test('disabled tab is not accessible on click or focus', function () {
|
224
|
+
getComponent({
|
225
|
+
disabledKeys: [defaultTabs[1].name]
|
226
|
+
});
|
227
|
+
testTabPanel(0);
|
228
|
+
|
229
|
+
var _getTabs5 = getTabs(),
|
230
|
+
tabs = _getTabs5.tabs,
|
231
|
+
tab0 = _getTabs5.tab0,
|
232
|
+
tab1 = _getTabs5.tab1,
|
233
|
+
tab2 = _getTabs5.tab2; // Ensure that clicking a disabled tab does nothing
|
234
|
+
|
235
|
+
|
236
|
+
userEvent.click(tab1);
|
237
|
+
testTabPanel(0); // Ensure that disabled tab is not accessible via focus
|
238
|
+
|
239
|
+
userEvent.tab();
|
240
|
+
testSingleTab(tabs, tab0, 'toHaveFocus');
|
241
|
+
fireEvent.keyDown(tab0, {
|
242
|
+
key: 'ArrowRight',
|
243
|
+
code: 'ArrowRight'
|
244
|
+
});
|
245
|
+
testSingleTab(tabs, tab2, 'toHaveFocus');
|
246
|
+
testTabPanel(2);
|
247
|
+
});
|
223
248
|
test('controlled tabs', function () {
|
224
249
|
var selectedKey = defaultTabs[1].name;
|
225
250
|
var onSelectionChange = jest.fn();
|
@@ -230,11 +255,11 @@ test('controlled tabs', function () {
|
|
230
255
|
}),
|
231
256
|
rerender = _getComponent.rerender;
|
232
257
|
|
233
|
-
var
|
234
|
-
tabs =
|
235
|
-
tab0 =
|
236
|
-
tab1 =
|
237
|
-
tab2 =
|
258
|
+
var _getTabs6 = getTabs(),
|
259
|
+
tabs = _getTabs6.tabs,
|
260
|
+
tab0 = _getTabs6.tab0,
|
261
|
+
tab1 = _getTabs6.tab1,
|
262
|
+
tab2 = _getTabs6.tab2; // Expect the second tab to be selected
|
238
263
|
|
239
264
|
|
240
265
|
expect(onSelectionChange).not.toHaveBeenCalled();
|
@@ -271,9 +296,9 @@ test('tab line props', function () {
|
|
271
296
|
}),
|
272
297
|
rerender = _getComponent2.rerender;
|
273
298
|
|
274
|
-
var
|
275
|
-
tabs =
|
276
|
-
tab0 =
|
299
|
+
var _getTabs7 = getTabs(),
|
300
|
+
tabs = _getTabs7.tabs,
|
301
|
+
tab0 = _getTabs7.tab0;
|
277
302
|
|
278
303
|
var tabLine = screen.getByRole('presentation'); // Expect the tab line to have a red background
|
279
304
|
|
@@ -302,16 +327,16 @@ test('tab with icon', function () {
|
|
302
327
|
tabs: newTabs
|
303
328
|
});
|
304
329
|
|
305
|
-
var
|
306
|
-
tabs =
|
307
|
-
tab0 =
|
330
|
+
var _getTabs8 = getTabs(),
|
331
|
+
tabs = _getTabs8.tabs,
|
332
|
+
tab0 = _getTabs8.tab0;
|
308
333
|
|
309
334
|
var icon = screen.getByTestId('icon'); // Expect the tab to have the given icon element
|
310
335
|
|
311
336
|
testSingleTab(tabs, tab0, 'toContainElement', [icon]);
|
312
337
|
});
|
313
338
|
test('tooltip renders on tab\'s hover in `tooltip` mode', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
314
|
-
var
|
339
|
+
var _getTabs9, tab0;
|
315
340
|
|
316
341
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
317
342
|
while (1) {
|
@@ -321,7 +346,7 @@ test('tooltip renders on tab\'s hover in `tooltip` mode', /*#__PURE__*/_asyncToG
|
|
321
346
|
mode: 'tooltip'
|
322
347
|
});
|
323
348
|
expect(screen.queryByRole('tooltip')).not.toBeInTheDocument();
|
324
|
-
|
349
|
+
_getTabs9 = getTabs(), tab0 = _getTabs9.tab0;
|
325
350
|
fireEvent.mouseMove(tab0);
|
326
351
|
fireEvent.mouseEnter(tab0);
|
327
352
|
|
@@ -345,10 +370,48 @@ test('tabs without selected keys show null tab panel content', function () {
|
|
345
370
|
test('hover tab style', function () {
|
346
371
|
getComponent();
|
347
372
|
|
348
|
-
var
|
349
|
-
tab0 =
|
373
|
+
var _getTabs10 = getTabs(),
|
374
|
+
tab0 = _getTabs10.tab0;
|
350
375
|
|
351
376
|
expect(tab0).not.toHaveClass('is-hovered');
|
352
377
|
userEvent.hover(tab0);
|
353
378
|
expect(tab0).toHaveClass('is-hovered');
|
379
|
+
});
|
380
|
+
test('will render slots.beforeTab if provided', function () {
|
381
|
+
var testText = 'test-text';
|
382
|
+
|
383
|
+
var testComponent = ___EmotionJSX("div", null, testText);
|
384
|
+
|
385
|
+
var tabs = [{
|
386
|
+
name: 'Tab 1',
|
387
|
+
children: 'Tab 1 body',
|
388
|
+
props: {
|
389
|
+
slots: {
|
390
|
+
beforeTab: testComponent
|
391
|
+
}
|
392
|
+
}
|
393
|
+
}];
|
394
|
+
getComponent({}, {
|
395
|
+
tabs: tabs
|
396
|
+
});
|
397
|
+
expect(screen.getByText(testText)).toBeInTheDocument();
|
398
|
+
});
|
399
|
+
test('will render slots.afterTab if provided', function () {
|
400
|
+
var testText = 'test-text';
|
401
|
+
|
402
|
+
var testComponent = ___EmotionJSX("div", null, testText);
|
403
|
+
|
404
|
+
var tabs = [{
|
405
|
+
name: 'Tab 1',
|
406
|
+
children: 'Tab 1 body',
|
407
|
+
props: {
|
408
|
+
slots: {
|
409
|
+
afterTab: testComponent
|
410
|
+
}
|
411
|
+
}
|
412
|
+
}];
|
413
|
+
getComponent({}, {
|
414
|
+
tabs: tabs
|
415
|
+
});
|
416
|
+
expect(screen.getByText(testText)).toBeInTheDocument();
|
354
417
|
});
|
@@ -99,6 +99,14 @@ test('form wrapper will have default max label column width when no custom width
|
|
99
99
|
var textAreaContainer = screen.getByTestId(testId);
|
100
100
|
expect(textAreaContainer).toHaveStyle('grid-template-columns: 40% auto');
|
101
101
|
});
|
102
|
+
test('passing read only prop applys the is-read-only class to the textarea', function () {
|
103
|
+
var isReadOnly = true;
|
104
|
+
getComponent({
|
105
|
+
isReadOnly: isReadOnly
|
106
|
+
});
|
107
|
+
var textArea = screen.getByLabelText(defaultProps.label);
|
108
|
+
expect(textArea).toHaveClass('is-read-only');
|
109
|
+
});
|
102
110
|
test('form wrapper will have a max label column width when custom width set', function () {
|
103
111
|
var labelMode = 'left';
|
104
112
|
var containerProps = {
|
@@ -0,0 +1 @@
|
|
1
|
+
export { default } from './useCopyToClipboard';
|
@@ -0,0 +1,69 @@
|
|
1
|
+
import _regeneratorRuntime from "@babel/runtime-corejs3/regenerator";
|
2
|
+
import _asyncToGenerator from "@babel/runtime-corejs3/helpers/esm/asyncToGenerator";
|
3
|
+
|
4
|
+
var useCopyToClipboard = function useCopyToClipboard(value) {
|
5
|
+
var setIsCopied = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function () {};
|
6
|
+
return /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
7
|
+
var textArea, isSuccessful;
|
8
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
9
|
+
while (1) {
|
10
|
+
switch (_context.prev = _context.next) {
|
11
|
+
case 0:
|
12
|
+
_context.prev = 0;
|
13
|
+
|
14
|
+
if (!navigator.clipboard) {
|
15
|
+
_context.next = 7;
|
16
|
+
break;
|
17
|
+
}
|
18
|
+
|
19
|
+
_context.next = 4;
|
20
|
+
return navigator.clipboard.writeText(value);
|
21
|
+
|
22
|
+
case 4:
|
23
|
+
setIsCopied(true);
|
24
|
+
_context.next = 20;
|
25
|
+
break;
|
26
|
+
|
27
|
+
case 7:
|
28
|
+
// Workaround for copying in insecure origin
|
29
|
+
textArea = document.createElement('textarea');
|
30
|
+
textArea.value = value;
|
31
|
+
textArea.style.position = 'fixed';
|
32
|
+
document.body.appendChild(textArea);
|
33
|
+
textArea.focus();
|
34
|
+
textArea.select();
|
35
|
+
isSuccessful = document.execCommand('copy');
|
36
|
+
textArea.remove();
|
37
|
+
|
38
|
+
if (!isSuccessful) {
|
39
|
+
_context.next = 19;
|
40
|
+
break;
|
41
|
+
}
|
42
|
+
|
43
|
+
setIsCopied(isSuccessful);
|
44
|
+
_context.next = 20;
|
45
|
+
break;
|
46
|
+
|
47
|
+
case 19:
|
48
|
+
throw new Error('Unable to copy message');
|
49
|
+
|
50
|
+
case 20:
|
51
|
+
_context.next = 25;
|
52
|
+
break;
|
53
|
+
|
54
|
+
case 22:
|
55
|
+
_context.prev = 22;
|
56
|
+
_context.t0 = _context["catch"](0);
|
57
|
+
// eslint-disable-next-line no-console
|
58
|
+
console.error('Failed to copy: ', _context.t0);
|
59
|
+
|
60
|
+
case 25:
|
61
|
+
case "end":
|
62
|
+
return _context.stop();
|
63
|
+
}
|
64
|
+
}
|
65
|
+
}, _callee, null, [[0, 22]]);
|
66
|
+
}));
|
67
|
+
};
|
68
|
+
|
69
|
+
export default useCopyToClipboard;
|
@@ -0,0 +1,64 @@
|
|
1
|
+
import _Object$defineProperty from "@babel/runtime-corejs3/core-js-stable/object/define-property";
|
2
|
+
import _Object$defineProperties from "@babel/runtime-corejs3/core-js-stable/object/define-properties";
|
3
|
+
import _Object$getOwnPropertyDescriptors from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors";
|
4
|
+
import _forEachInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/for-each";
|
5
|
+
import _Object$getOwnPropertyDescriptor from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor";
|
6
|
+
import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
|
7
|
+
import _Object$getOwnPropertySymbols from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols";
|
8
|
+
import _Object$keys from "@babel/runtime-corejs3/core-js-stable/object/keys";
|
9
|
+
import _regeneratorRuntime from "@babel/runtime-corejs3/regenerator";
|
10
|
+
import _asyncToGenerator from "@babel/runtime-corejs3/helpers/esm/asyncToGenerator";
|
11
|
+
import _defineProperty from "@babel/runtime-corejs3/helpers/esm/defineProperty";
|
12
|
+
|
13
|
+
function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); if (enumerableOnly) symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
14
|
+
|
15
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { var _context2; _forEachInstanceProperty(_context2 = ownKeys(Object(source), true)).call(_context2, function (key) { _defineProperty(target, key, source[key]); }); } else if (_Object$getOwnPropertyDescriptors) { _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)); } else { var _context3; _forEachInstanceProperty(_context3 = ownKeys(Object(source))).call(_context3, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
16
|
+
|
17
|
+
import useCopyToClipboard from './useCopyToClipboard';
|
18
|
+
var mockCopyText = 'test';
|
19
|
+
|
20
|
+
var originalClipboard = _objectSpread({}, global.navigator.clipboard);
|
21
|
+
|
22
|
+
var originalExecCommand = global.document.execCommand;
|
23
|
+
beforeEach(function () {
|
24
|
+
global.navigator.clipboard = {
|
25
|
+
writeText: jest.fn()
|
26
|
+
};
|
27
|
+
global.document.execCommand = jest.fn();
|
28
|
+
global.document.execCommand.mockReturnValue(true);
|
29
|
+
});
|
30
|
+
afterEach(function () {
|
31
|
+
jest.resetAllMocks();
|
32
|
+
global.navigator.clipboard = originalClipboard;
|
33
|
+
global.document.execCommand = originalExecCommand;
|
34
|
+
});
|
35
|
+
test('default return', function () {
|
36
|
+
var copyToClipboard = useCopyToClipboard();
|
37
|
+
expect(copyToClipboard).toEqual(expect.any(Function));
|
38
|
+
});
|
39
|
+
test('should copy text that passed in props', function () {
|
40
|
+
var copyToClipboard = useCopyToClipboard(mockCopyText);
|
41
|
+
copyToClipboard();
|
42
|
+
expect(navigator.clipboard.writeText).toHaveBeenCalledWith(mockCopyText);
|
43
|
+
});
|
44
|
+
test('should call setIsCopied once function will be called', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
45
|
+
var mockSetIsCopied, copyToClipboard;
|
46
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
47
|
+
while (1) {
|
48
|
+
switch (_context.prev = _context.next) {
|
49
|
+
case 0:
|
50
|
+
mockSetIsCopied = jest.fn();
|
51
|
+
copyToClipboard = useCopyToClipboard(mockCopyText, mockSetIsCopied);
|
52
|
+
_context.next = 4;
|
53
|
+
return copyToClipboard();
|
54
|
+
|
55
|
+
case 4:
|
56
|
+
expect(mockSetIsCopied).toHaveBeenCalledWith(true);
|
57
|
+
|
58
|
+
case 5:
|
59
|
+
case "end":
|
60
|
+
return _context.stop();
|
61
|
+
}
|
62
|
+
}
|
63
|
+
}, _callee);
|
64
|
+
})));
|
package/lib/index.js
CHANGED
@@ -30,10 +30,6 @@ export * from './components/Chip';
|
|
30
30
|
export { default as ComboBoxField } from './components/ComboBoxField';
|
31
31
|
export { default as CopyText } from './components/CopyText';
|
32
32
|
export { default as ColorField } from './components/ColorField';
|
33
|
-
export { default as Dropdown } from './components/Dropdown';
|
34
|
-
export * from './components/Dropdown';
|
35
|
-
export { default as DropdownField } from './components/DropdownField';
|
36
|
-
export * from './components/DropdownField';
|
37
33
|
export { default as FieldHelperText } from './components/FieldHelperText';
|
38
34
|
export * from './components/FieldHelperText';
|
39
35
|
export { default as FileInputField } from './components/FileInputField';
|
@@ -77,12 +73,8 @@ export { default as OverlayPanel } from './components/OverlayPanel';
|
|
77
73
|
export * from './components/OverlayPanel';
|
78
74
|
export { default as PageHeader } from './components/PageHeader';
|
79
75
|
export * from './components/PageHeader';
|
80
|
-
export { default as Panel } from './components/Panel';
|
81
|
-
export * from './components/Panel';
|
82
76
|
export { default as PasswordField } from './components/PasswordField';
|
83
77
|
export * from './components/PasswordField';
|
84
|
-
export { default as Popover } from './components/Popover';
|
85
|
-
export * from './components/Popover';
|
86
78
|
export { default as PopoverContainer } from './components/PopoverContainer';
|
87
79
|
export * from './components/PopoverContainer';
|
88
80
|
export { default as PopoverMenu } from './components/PopoverMenu';
|
@@ -274,7 +274,8 @@ export var Default = function Default() {
|
|
274
274
|
}, ___EmotionJSX(Chip, {
|
275
275
|
bg: "success.light",
|
276
276
|
textColor: "success.dark",
|
277
|
-
label: "New"
|
277
|
+
label: "New",
|
278
|
+
isUppercase: true
|
278
279
|
})) : null)), ___EmotionJSX(Box, {
|
279
280
|
isRow: true,
|
280
281
|
alignSelf: "center"
|
@@ -3,14 +3,12 @@ import React from 'react';
|
|
3
3
|
import Earth from 'mdi-react/EarthIcon';
|
4
4
|
import Cog from 'mdi-react/CogOutlineIcon';
|
5
5
|
import Button from '../components/Button/Button';
|
6
|
-
import Panel from '../components/Panel/Panel';
|
7
6
|
import Box from '../components/Box/Box';
|
8
7
|
import Icon from '../components/Icon/Icon';
|
9
8
|
import Text from '../components/Text/Text';
|
10
9
|
import Separator from '../components/Separator/Separator';
|
11
10
|
import TextField from '../components/TextField/TextField';
|
12
11
|
import TextAreaField from '../components/TextAreaField/TextAreaField';
|
13
|
-
import DropdownField from '../components/DropdownField/DropdownField';
|
14
12
|
import RadioGroupField from '../components/RadioGroupField/RadioGroupField';
|
15
13
|
import RadioField from '../components/RadioField/RadioField';
|
16
14
|
import Tabs from '../components/Tabs/Tabs';
|
@@ -96,10 +94,7 @@ export var Default = function Default() {
|
|
96
94
|
}), ___EmotionJSX(TextAreaField, {
|
97
95
|
mb: "lg",
|
98
96
|
label: "Description"
|
99
|
-
}), ___EmotionJSX(
|
100
|
-
label: "Category",
|
101
|
-
mb: "lg"
|
102
|
-
}, ___EmotionJSX("option", null, "Option 1"), ___EmotionJSX("option", null, "Option 2"), ___EmotionJSX("option", null, "Option 3")), ___EmotionJSX(RadioGroupField, {
|
97
|
+
}), ___EmotionJSX(RadioGroupField, {
|
103
98
|
label: "Required Fields",
|
104
99
|
variant: "radioGroupBasic"
|
105
100
|
}, ___EmotionJSX(RadioField, {
|
@@ -108,17 +103,5 @@ export var Default = function Default() {
|
|
108
103
|
}), ___EmotionJSX(RadioField, {
|
109
104
|
value: "B",
|
110
105
|
label: "Option B"
|
111
|
-
}))))
|
112
|
-
isVisible: visible,
|
113
|
-
width: "70%",
|
114
|
-
bg: "accent.99"
|
115
|
-
}, ___EmotionJSX(Box, {
|
116
|
-
p: "lg",
|
117
|
-
onClick: function onClick() {
|
118
|
-
return setVisible(!visible);
|
119
|
-
}
|
120
|
-
}, ___EmotionJSX(Box, {
|
121
|
-
p: "lg",
|
122
|
-
bg: "white"
|
123
|
-
}, ___EmotionJSX(Text, null, "Your content here."))))));
|
106
|
+
}))))));
|
124
107
|
};
|
@@ -82,11 +82,11 @@ export var Default = function Default() {
|
|
82
82
|
sx: {
|
83
83
|
position: 'absolute',
|
84
84
|
right: -30,
|
85
|
-
top: 5
|
85
|
+
top: 5,
|
86
|
+
width: 'auto'
|
86
87
|
},
|
87
88
|
type: "delete",
|
88
|
-
title: "Delete Field"
|
89
|
-
variant: "icon"
|
89
|
+
title: "Delete Field"
|
90
90
|
}, ___EmotionJSX(Icon, {
|
91
91
|
icon: TrashIcon,
|
92
92
|
size: 20,
|
@@ -0,0 +1,25 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { Box, Button, Text } from '../index';
|
3
|
+
import useCopyToClipboard from '../hooks/useCopyToClipboard';
|
4
|
+
import { jsx as ___EmotionJSX } from "@emotion/react";
|
5
|
+
export default {
|
6
|
+
title: 'Recipes/CopyToClipboard'
|
7
|
+
};
|
8
|
+
export var Default = function Default() {
|
9
|
+
var textToCopy = 'eyJraWQiOiI4YTg5MmY3ZS1iNTk1LTRkYWQtODBlNC0yMzA4ODkyZTczZDQiLCJhbGciOiJSUzI1NiJ9.eyJhdWQiOiJodHRwczovL2FwaS5waW5nb25lLmNvbSIsImF1dGhVcmwiOiJodHRwczovL2F1dGgucGluZ29uZS5jb20iLCJjb25zb2xlVXJsIjoiaHR0cHM6Ly9jb25zb2xlLnBpbmdvbmUuY29tIiwiZW52aXJvbm1lbnROYW1lIjoiTW9udGFuYSIsImVudmlyb25tZW50SWQiOiJhYzc2NWQ0Ny1kMDM2LTQ1MGUtODFjMS1mYjQ1NDMxMjM1NjYiLCJvcmdhbml6YXRpb25OYW1lIjoiaW50ZXJuYWxfZXJpa2FhbGRlYm9yZ2hfMjUyMDc1MDMxIiwib3JnYW5pemF0aW9uSWQiOiJkMDYzMmYwZi03YjQ2LTQ5ZjUtYjgyYS1kZWU5MWQ3MDY3ODYiLCJnYXRld2F5TmFtZSI6ImRzZHMiLCJnYXRld2F5SWQiOiJiMDVmNGU5Yy1jMzRiLTRlZTMtYTYyNS01ZGFiNjlkYTE1YTEiLCJnYXRld2F5VHlwZSI6IlBJTkdfRkVERVJBVEUiLCJ0YXJnZXRDbHVzdGVyRW52aXJvbm1lbnQiOiJQUk9EIiwidGFyZ2V0R2VvZ3JhcGh5IjoiTkEiLCJyZWdpb24iOiJOb3J0aCBBbWVyaWNhIiwianRpIjoiMTUwYTQ0OTktZjIyYi00YWVhLWIzY2UtYWM2YWY1NjVjNjk5IiwiaXNzIjoid3NzOi8vZ2F0ZXdheXMucGluZ29uZS5jb20iLCJpYXQiOjE2MjYyODEyMTZ9.JJ9wwqTxQWUwz2vmU0yE54xuYff51xbirzZuEUxd8GDzV45bnpbmx460CY8g9ccdmOjvfVF4RPPsawpKuMZH271tDlLZl67iknxDVWBZSih9K6v0RAmsmNriR4OyOFOkGrULCIz3ISyPWeItp1AVuue_8guWR63KzYg32aPC4SgmOrc2myq9N6XNU2H1KybETbG_s5-VU_cUqaXn7GUzhL2_W6CSVrrlE1cYfjC7pxMKFm4vvIw_KcNYVGO1K6oYgzRZ4A8toQHIdlGB8L-wkCt442LdC93OjoQdkLuGzmXnO8BUohWea-Dn35gGHoH-H1BRQTya_H9AKyWMxCw-vg';
|
10
|
+
var copyToClipboard = useCopyToClipboard(textToCopy);
|
11
|
+
return ___EmotionJSX(Box, {
|
12
|
+
bg: "accent.99",
|
13
|
+
py: "md",
|
14
|
+
px: "xl"
|
15
|
+
}, ___EmotionJSX(Text, {
|
16
|
+
sx: {
|
17
|
+
wordBreak: 'break-all'
|
18
|
+
}
|
19
|
+
}, textToCopy), ___EmotionJSX(Button, {
|
20
|
+
variant: "inline",
|
21
|
+
my: "lg",
|
22
|
+
onPress: copyToClipboard,
|
23
|
+
"aria-label": "Copy Text To Clipboard"
|
24
|
+
}, "Copy To Clipboard"));
|
25
|
+
};
|
@@ -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
|
+
};
|
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'
|