@pingux/astro 1.0.0-alpha.0 → 1.0.0-alpha.12

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 (58) hide show
  1. package/CHANGELOG.md +129 -0
  2. package/lib/cjs/components/AccordionItem/AccordionItem.js +3 -1
  3. package/lib/cjs/components/Button/Button.stories.js +5 -11
  4. package/lib/cjs/components/CopyText/CopyText.js +3 -73
  5. package/lib/cjs/components/FileInputField/FileInputField.js +324 -0
  6. package/lib/cjs/components/FileInputField/FileInputField.stories.js +250 -0
  7. package/lib/cjs/components/FileInputField/FileInputField.test.js +227 -0
  8. package/lib/cjs/components/FileInputField/FileItem.js +125 -0
  9. package/lib/cjs/components/FileInputField/FileSelect.js +48 -0
  10. package/lib/cjs/components/FileInputField/index.js +18 -0
  11. package/lib/cjs/components/ListView/ListView.js +4 -3
  12. package/lib/cjs/components/ListViewItem/ListViewItem.js +3 -6
  13. package/lib/cjs/components/NumberField/NumberField.js +4 -2
  14. package/lib/cjs/components/NumberField/NumberField.test.js +15 -0
  15. package/lib/cjs/components/Tab/Tab.js +11 -4
  16. package/lib/cjs/components/Tabs/Tabs.js +7 -1
  17. package/lib/cjs/components/Tabs/Tabs.stories.js +60 -6
  18. package/lib/cjs/components/Tabs/Tabs.test.js +78 -15
  19. package/lib/cjs/hooks/useCopyToClipboard/index.js +18 -0
  20. package/lib/cjs/hooks/useCopyToClipboard/useCopyToClipboard.js +83 -0
  21. package/lib/cjs/hooks/useCopyToClipboard/useCopyToClipboard.test.js +79 -0
  22. package/lib/cjs/index.js +10 -0
  23. package/lib/cjs/recipes/CopyToClipboard.stories.js +45 -0
  24. package/lib/cjs/recipes/RadioButtonsWithLinks.stories.js +146 -0
  25. package/lib/cjs/styles/forms/input.js +11 -0
  26. package/lib/cjs/styles/variants/accordion.js +2 -2
  27. package/lib/cjs/styles/variants/boxes.js +27 -0
  28. package/lib/cjs/styles/variants/buttons.js +20 -0
  29. package/lib/cjs/styles/variants/tabs.js +1 -0
  30. package/lib/components/AccordionItem/AccordionItem.js +3 -1
  31. package/lib/components/Button/Button.stories.js +5 -10
  32. package/lib/components/CopyText/CopyText.js +2 -71
  33. package/lib/components/FileInputField/FileInputField.js +280 -0
  34. package/lib/components/FileInputField/FileInputField.stories.js +206 -0
  35. package/lib/components/FileInputField/FileInputField.test.js +187 -0
  36. package/lib/components/FileInputField/FileItem.js +100 -0
  37. package/lib/components/FileInputField/FileSelect.js +31 -0
  38. package/lib/components/FileInputField/index.js +1 -0
  39. package/lib/components/ListView/ListView.js +4 -3
  40. package/lib/components/ListViewItem/ListViewItem.js +3 -5
  41. package/lib/components/NumberField/NumberField.js +4 -2
  42. package/lib/components/NumberField/NumberField.test.js +9 -0
  43. package/lib/components/Tab/Tab.js +11 -4
  44. package/lib/components/Tabs/Tabs.js +7 -1
  45. package/lib/components/Tabs/Tabs.stories.js +56 -4
  46. package/lib/components/Tabs/Tabs.test.js +78 -15
  47. package/lib/hooks/useCopyToClipboard/index.js +1 -0
  48. package/lib/hooks/useCopyToClipboard/useCopyToClipboard.js +69 -0
  49. package/lib/hooks/useCopyToClipboard/useCopyToClipboard.test.js +64 -0
  50. package/lib/index.js +1 -0
  51. package/lib/recipes/CopyToClipboard.stories.js +25 -0
  52. package/lib/recipes/RadioButtonsWithLinks.stories.js +120 -0
  53. package/lib/styles/forms/input.js +11 -0
  54. package/lib/styles/variants/accordion.js +2 -2
  55. package/lib/styles/variants/boxes.js +27 -0
  56. package/lib/styles/variants/buttons.js +20 -0
  57. package/lib/styles/variants/tabs.js +1 -0
  58. package/package.json +3 -2
@@ -2,10 +2,12 @@ import _slicedToArray from "@babel/runtime-corejs3/helpers/esm/slicedToArray";
2
2
  import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
3
3
  import React, { useState } from 'react';
4
4
  import Earth from 'mdi-react/GlobeModelIcon';
5
+ import LockIcon from 'mdi-react/LockIcon';
5
6
  import Tabs from './Tabs';
6
7
  import Tab from '../Tab';
7
8
  import Icon from '../Icon';
8
9
  import Text from '../Text';
10
+ import { Chip } from '../../index';
9
11
  import { jsx as ___EmotionJSX } from "@emotion/react";
10
12
  export default {
11
13
  title: 'Tabs',
@@ -126,13 +128,12 @@ export var Centered = function Centered() {
126
128
  };
127
129
  export var DisabledSingleTab = function DisabledSingleTab() {
128
130
  return ___EmotionJSX(Tabs, {
129
- defaultSelectedKey: "Tab 2",
130
- items: tabs
131
+ items: tabs,
132
+ disabledKeys: ['Tab 2']
131
133
  }, function (item) {
132
134
  return ___EmotionJSX(Tab, {
133
135
  key: item.name,
134
- title: item.name,
135
- isDisabled: item.name === 'Tab 1'
136
+ title: item.name
136
137
  }, item.children);
137
138
  });
138
139
  };
@@ -184,4 +185,55 @@ export var TabPanelProps = function TabPanelProps() {
184
185
  title: item.name
185
186
  }, item.children);
186
187
  });
188
+ };
189
+ export var ContentSlots = function ContentSlots() {
190
+ var beforeTabNode = ___EmotionJSX(Icon, {
191
+ icon: LockIcon,
192
+ sx: {
193
+ marginTop: 10,
194
+ marginRight: 5
195
+ }
196
+ });
197
+
198
+ var nodeSx = {
199
+ alignItems: 'center',
200
+ backgroundColor: 'neutral.95',
201
+ borderRadius: '50%',
202
+ color: 'neutral.30',
203
+ fontSize: 'sm',
204
+ height: 20,
205
+ justifyContent: 'center',
206
+ marginLeft: 6,
207
+ marginTop: 10,
208
+ minWidth: 20
209
+ };
210
+
211
+ var afterTabNode = ___EmotionJSX(Chip, {
212
+ sx: nodeSx
213
+ }, "14");
214
+
215
+ return ___EmotionJSX(React.Fragment, null, ___EmotionJSX(Tabs, {
216
+ items: tabs,
217
+ mb: 50
218
+ }, ___EmotionJSX(Tab, {
219
+ key: "tab1",
220
+ title: "Tab 1",
221
+ slots: {
222
+ beforeTab: beforeTabNode
223
+ }
224
+ }, ___EmotionJSX(Text, null, "This is content for Tab 1")), ___EmotionJSX(Tab, {
225
+ key: "tab2",
226
+ title: "Tab 2"
227
+ }, ___EmotionJSX(Text, null, "This is content for Tab 2"))), ___EmotionJSX(Tabs, {
228
+ items: tabs
229
+ }, ___EmotionJSX(Tab, {
230
+ key: "tab1",
231
+ title: "Tab 1"
232
+ }, ___EmotionJSX(Text, null, "Compose Filter")), ___EmotionJSX(Tab, {
233
+ key: "tab2",
234
+ title: "Tab 2",
235
+ slots: {
236
+ afterTab: afterTabNode
237
+ }
238
+ }, ___EmotionJSX(Text, null, "Users Matched"))));
187
239
  };
@@ -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 _getTabs5 = getTabs(),
234
- tabs = _getTabs5.tabs,
235
- tab0 = _getTabs5.tab0,
236
- tab1 = _getTabs5.tab1,
237
- tab2 = _getTabs5.tab2; // Expect the second tab to be selected
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 _getTabs6 = getTabs(),
275
- tabs = _getTabs6.tabs,
276
- tab0 = _getTabs6.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 _getTabs7 = getTabs(),
306
- tabs = _getTabs7.tabs,
307
- tab0 = _getTabs7.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 _getTabs8, tab0;
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
- _getTabs8 = getTabs(), tab0 = _getTabs8.tab0;
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 _getTabs9 = getTabs(),
349
- tab0 = _getTabs9.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
  });
@@ -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
@@ -36,6 +36,7 @@ export { default as DropdownField } from './components/DropdownField';
36
36
  export * from './components/DropdownField';
37
37
  export { default as FieldHelperText } from './components/FieldHelperText';
38
38
  export * from './components/FieldHelperText';
39
+ export { default as FileInputField } from './components/FileInputField';
39
40
  export { default as HelpHint } from './components/HelpHint';
40
41
  export * from './components/HelpHint';
41
42
  export { default as Icon } from './components/Icon';
@@ -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
+ };
@@ -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
 
@@ -14,12 +14,12 @@ var accordionTitle = {
14
14
  var accordion = {
15
15
  display: 'flex',
16
16
  mt: '5px',
17
- mb: '5px',
17
+ mb: '20px',
18
18
  alignItems: 'flex-start'
19
19
  };
20
20
  var accordionBody = {
21
21
  display: 'none !important',
22
- p: 'md',
22
+ pt: 'md',
23
23
  width: '100%',
24
24
  '.is-open &': {
25
25
  display: 'flex !important'
@@ -85,6 +85,10 @@ var listViewItem = _objectSpread(_objectSpread({}, base), {}, {
85
85
  },
86
86
  '&.is-focused': {
87
87
  boxShadow: 'inset 0 0 5px #5873bdbf'
88
+ },
89
+ '&.has-separator': {
90
+ borderBottom: '1px solid',
91
+ borderBottomColor: 'line.hairline'
88
92
  }
89
93
  });
90
94
 
@@ -229,6 +233,28 @@ var datePicker = {
229
233
  }
230
234
  }
231
235
  };
236
+ var fileInputFieldWrapper = {
237
+ display: 'flex',
238
+ border: '1px dashed',
239
+ borderColor: 'active',
240
+ padding: '10px 0',
241
+ '&.is-drag-active': {
242
+ backgroundColor: 'accent.95'
243
+ },
244
+ '&.is-error': {
245
+ borderColor: 'critical.dark'
246
+ },
247
+ '&.is-success': {
248
+ borderColor: 'success.dark'
249
+ },
250
+ '&.is-warning': {
251
+ borderColor: 'warning.dark'
252
+ },
253
+ '&.is-loading': {
254
+ justifyContent: 'center',
255
+ alignItems: 'center'
256
+ }
257
+ };
232
258
  export default {
233
259
  base: base,
234
260
  card: card,
@@ -237,6 +263,7 @@ export default {
237
263
  datePicker: datePicker,
238
264
  expandableRow: expandableRow,
239
265
  inputInContainerSlot: inputInContainerSlot,
266
+ fileInputFieldWrapper: fileInputFieldWrapper,
240
267
  listItem: listItem,
241
268
  listBoxSectionTitle: listBoxSectionTitle,
242
269
  listViewItem: listViewItem,
@@ -452,6 +452,25 @@ var expandableRow = {
452
452
  }
453
453
  }
454
454
  };
455
+ var fileInputField = {
456
+ background: 'none',
457
+ cursor: 'pointer',
458
+ '& span': {
459
+ textAlign: 'initial'
460
+ },
461
+ '&:focus-visible': {
462
+ outline: 'none'
463
+ },
464
+ '&.is-hovered, &.is-pressed': {
465
+ cursor: 'pointer',
466
+ '& span': {
467
+ textDecoration: 'underline'
468
+ }
469
+ },
470
+ '&.is-focused': {
471
+ boxShadow: 'focus'
472
+ }
473
+ };
455
474
  export default {
456
475
  accordionHeader: accordionHeader,
457
476
  chipDeleteButton: chipDeleteButton,
@@ -470,6 +489,7 @@ export default {
470
489
  '&.is-focused': _objectSpread({}, defaultFocus)
471
490
  }),
472
491
  expandableRow: expandableRow,
492
+ fileInputField: fileInputField,
473
493
  iconButton: iconButton,
474
494
  icon: icon,
475
495
  imageUpload: imageUpload,
@@ -5,6 +5,7 @@ export var tab = {
5
5
  display: 'inline-flex',
6
6
  outline: 'none',
7
7
  transform: 'translateY(1px)',
8
+ width: '100%',
8
9
  '&.is-focused': {
9
10
  boxShadow: 'focus'
10
11
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pingux/astro",
3
- "version": "1.0.0-alpha.0",
3
+ "version": "1.0.0-alpha.12",
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.20",
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",