@pingux/astro 2.84.0 → 2.85.0-alpha.15
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/lib/cjs/components/Avatar/Avatar.js +43 -8
- package/lib/cjs/components/Avatar/Avatar.test.js +10 -1
- package/lib/cjs/components/CheckboxField/CheckboxField.stories.js +5 -3
- package/lib/cjs/components/SwitchField/SwitchField.d.ts +4 -0
- package/lib/cjs/components/SwitchField/SwitchField.js +12 -32
- package/lib/cjs/components/SwitchField/SwitchField.stories.d.ts +11 -0
- package/lib/cjs/components/SwitchField/SwitchField.stories.js +4 -2
- package/lib/cjs/components/SwitchField/SwitchField.test.d.ts +1 -0
- package/lib/cjs/components/SwitchField/index.d.ts +1 -0
- package/lib/cjs/components/SwitchField/switchFieldAttributes.d.ts +94 -0
- package/lib/cjs/components/SwitchField/switchFieldAttributes.js +2 -30
- package/lib/cjs/components/TimeField/TimeField.stories.js +2 -2
- package/lib/cjs/styles/themes/next-gen/codeView/codeView.d.ts +1 -1
- package/lib/cjs/styles/themes/next-gen/codeView/codeView.js +2 -2
- package/lib/cjs/styles/themes/next-gen/convertedComponentList.js +1 -1
- package/lib/cjs/styles/themes/next-gen/next-gen.d.ts +64 -31
- package/lib/cjs/styles/themes/next-gen/next-gen.js +4 -11
- package/lib/cjs/styles/themes/next-gen/sizes.d.ts +18 -0
- package/lib/cjs/styles/themes/next-gen/sizes.js +27 -0
- package/lib/cjs/styles/themes/next-gen/text.d.ts +6 -0
- package/lib/cjs/styles/themes/next-gen/text.js +14 -6
- package/lib/cjs/styles/themes/next-gen/variants/cards.js +1 -1
- package/lib/cjs/styles/themes/next-gen/variants/images.d.ts +4 -0
- package/lib/cjs/styles/themes/next-gen/variants/images.js +12 -0
- package/lib/cjs/styles/themes/next-gen/variants/links.js +4 -4
- package/lib/cjs/styles/themes/next-gen/variants/text.js +1 -1
- package/lib/cjs/styles/themes/next-gen/variants/variants.d.ts +48 -30
- package/lib/cjs/styles/themes/next-gen/variants/variants.js +51 -26
- package/lib/cjs/types/avatar.d.ts +5 -1
- package/lib/cjs/types/checkboxField.d.ts +3 -1
- package/lib/cjs/types/index.d.ts +1 -0
- package/lib/cjs/types/index.js +19 -8
- package/lib/cjs/types/switchField.d.ts +29 -0
- package/lib/cjs/types/switchField.js +6 -0
- package/lib/components/Avatar/Avatar.js +44 -7
- package/lib/components/Avatar/Avatar.test.js +10 -1
- package/lib/components/CheckboxField/CheckboxField.stories.js +5 -3
- package/lib/components/SwitchField/SwitchField.js +14 -34
- package/lib/components/SwitchField/SwitchField.stories.js +4 -2
- package/lib/components/SwitchField/switchFieldAttributes.js +1 -28
- package/lib/components/TimeField/TimeField.stories.js +2 -2
- package/lib/styles/themes/next-gen/codeView/codeView.js +2 -2
- package/lib/styles/themes/next-gen/convertedComponentList.js +1 -1
- package/lib/styles/themes/next-gen/next-gen.js +4 -11
- package/lib/styles/themes/next-gen/sizes.js +19 -0
- package/lib/styles/themes/next-gen/text.js +14 -6
- package/lib/styles/themes/next-gen/variants/cards.js +1 -1
- package/lib/styles/themes/next-gen/variants/images.js +4 -0
- package/lib/styles/themes/next-gen/variants/links.js +4 -4
- package/lib/styles/themes/next-gen/variants/text.js +1 -1
- package/lib/styles/themes/next-gen/variants/variants.js +51 -26
- package/lib/types/index.js +1 -0
- package/lib/types/switchField.js +1 -0
- package/package.json +1 -1
- package/lib/cjs/recipes/NextGen/DefaultAvatar.stories.d.ts +0 -6
- package/lib/cjs/recipes/NextGen/DefaultAvatar.stories.js +0 -41
- package/lib/recipes/NextGen/DefaultAvatar.stories.js +0 -31
@@ -0,0 +1,27 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
|
4
|
+
_Object$defineProperty(exports, "__esModule", {
|
5
|
+
value: true
|
6
|
+
});
|
7
|
+
exports["default"] = void 0;
|
8
|
+
var avatar = {
|
9
|
+
sm: '24px',
|
10
|
+
md: '34px',
|
11
|
+
lg: '72px',
|
12
|
+
xl: '104px'
|
13
|
+
};
|
14
|
+
var container = {
|
15
|
+
xs: ['100%', '540px', '720px', '960px', '1140px', '1540px'],
|
16
|
+
sm: ['100%', '540px', '720px', '960px', '1140px', '1540px'],
|
17
|
+
md: ['100%', '100%', '720px', '960px', '1140px', '1540px'],
|
18
|
+
lg: ['100%', '100%', '100%', '960px', '1140px', '1540px'],
|
19
|
+
xl: ['100%', '100%', '100%', '100%', '1140px', '1540px'],
|
20
|
+
xx: ['100%', '100%', '100%', '100%', '100%', '1540px'],
|
21
|
+
fluid: ['100%', '100%', '100%', '100%', '100%', '100%']
|
22
|
+
};
|
23
|
+
var _default = {
|
24
|
+
avatar: avatar,
|
25
|
+
container: container
|
26
|
+
};
|
27
|
+
exports["default"] = _default;
|
@@ -7,15 +7,23 @@ _Object$defineProperty(exports, "__esModule", {
|
|
7
7
|
});
|
8
8
|
exports.fontWeights = exports.fontSizes = void 0;
|
9
9
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/defineProperty"));
|
10
|
+
var _sizes = _interopRequireDefault(require("./sizes"));
|
10
11
|
var _fontWeights;
|
12
|
+
var fontSizeBase = 0.9375;
|
11
13
|
var fontSizes = {
|
12
|
-
|
14
|
+
avatar: {
|
15
|
+
'sm': "calc(".concat(_sizes["default"].avatar.sm, " * .4)"),
|
16
|
+
'md': "calc(".concat(_sizes["default"].avatar.md, " * .4)"),
|
17
|
+
'lg': "calc(".concat(_sizes["default"].avatar.lg, " * .4)"),
|
18
|
+
'xl': "calc(".concat(_sizes["default"].avatar.xl, " * .4)")
|
19
|
+
},
|
20
|
+
'xs': "".concat(fontSizeBase * 0.8, "rem"),
|
13
21
|
'sm': '0.875rem',
|
14
|
-
'md':
|
15
|
-
'lg':
|
16
|
-
'xl':
|
17
|
-
'xx':
|
18
|
-
'xxx':
|
22
|
+
'md': "".concat(fontSizeBase * 1, "rem"),
|
23
|
+
'lg': "".concat(fontSizeBase * 1.25, "rem"),
|
24
|
+
'xl': "".concat(fontSizeBase * 1.5, "rem"),
|
25
|
+
'xx': "".concat(fontSizeBase * 1.75, "rem"),
|
26
|
+
'xxx': "".concat(fontSizeBase * 2.25, "rem")
|
19
27
|
};
|
20
28
|
exports.fontSizes = fontSizes;
|
21
29
|
var fontWeights = (_fontWeights = {}, (0, _defineProperty2["default"])(_fontWeights, -1, 300), (0, _defineProperty2["default"])(_fontWeights, 0, 400), (0, _defineProperty2["default"])(_fontWeights, 1, 400), (0, _defineProperty2["default"])(_fontWeights, 2, 600), (0, _defineProperty2["default"])(_fontWeights, 3, 600), _fontWeights);
|
@@ -7,7 +7,7 @@ _Object$defineProperty(exports, "__esModule", {
|
|
7
7
|
exports["default"] = void 0;
|
8
8
|
var interactive = {
|
9
9
|
boxShadow: 'none',
|
10
|
-
borderRadius: '
|
10
|
+
borderRadius: '1rem',
|
11
11
|
border: '1px solid',
|
12
12
|
borderColor: 'gray-300',
|
13
13
|
transition: 'border-color .15s ease-in',
|
@@ -0,0 +1,12 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
|
4
|
+
_Object$defineProperty(exports, "__esModule", {
|
5
|
+
value: true
|
6
|
+
});
|
7
|
+
exports["default"] = void 0;
|
8
|
+
var avatar = {};
|
9
|
+
var _default = {
|
10
|
+
avatar: avatar
|
11
|
+
};
|
12
|
+
exports["default"] = _default;
|
@@ -23,14 +23,14 @@ var nextGen = {
|
|
23
23
|
px: 'md',
|
24
24
|
textDecoration: 'none',
|
25
25
|
borderRadius: '4px',
|
26
|
-
lineHeight: '
|
26
|
+
lineHeight: '1.5',
|
27
27
|
minHeight: '22.5px',
|
28
28
|
fontFamily: 'standard',
|
29
29
|
'&.is-hovered': {
|
30
|
-
color: '
|
30
|
+
color: 'blue-600'
|
31
31
|
},
|
32
32
|
'&.is-pressed': {
|
33
|
-
color: '
|
33
|
+
color: 'blue-600'
|
34
34
|
}
|
35
35
|
};
|
36
36
|
var sideNav = _objectSpread(_objectSpread({}, nextGen), {}, {
|
@@ -49,7 +49,7 @@ var sideNav = _objectSpread(_objectSpread({}, nextGen), {}, {
|
|
49
49
|
transition: 'background-color .15s ease'
|
50
50
|
},
|
51
51
|
'&.is-selected': {
|
52
|
-
color: '
|
52
|
+
color: 'blue-600',
|
53
53
|
'&:before': {
|
54
54
|
backgroundColor: 'active_light'
|
55
55
|
}
|
@@ -454,38 +454,47 @@ declare const _default: {
|
|
454
454
|
};
|
455
455
|
};
|
456
456
|
avatar: {
|
457
|
-
|
458
|
-
|
459
|
-
|
460
|
-
|
461
|
-
|
462
|
-
|
463
|
-
fontSize: string;
|
457
|
+
backgroundColor: string;
|
458
|
+
color: string;
|
459
|
+
cursor: string;
|
460
|
+
'&.is-orange': {
|
461
|
+
backgroundColor: string;
|
462
|
+
color: string;
|
464
463
|
};
|
465
|
-
|
466
|
-
|
467
|
-
|
468
|
-
textAlign: string;
|
469
|
-
justifyContent: string;
|
470
|
-
fontFamily: string;
|
471
|
-
size: string;
|
464
|
+
'&.is-green': {
|
465
|
+
backgroundColor: string;
|
466
|
+
color: string;
|
472
467
|
};
|
473
|
-
|
474
|
-
|
475
|
-
|
476
|
-
textAlign: string;
|
477
|
-
justifyContent: string;
|
478
|
-
fontFamily: string;
|
479
|
-
size: string;
|
468
|
+
'&.is-purple': {
|
469
|
+
backgroundColor: string;
|
470
|
+
color: string;
|
480
471
|
};
|
481
|
-
|
482
|
-
|
483
|
-
|
484
|
-
|
485
|
-
|
486
|
-
|
487
|
-
|
472
|
+
'&.is-pink': {
|
473
|
+
backgroundColor: string;
|
474
|
+
color: string;
|
475
|
+
};
|
476
|
+
'&.is-red': {
|
477
|
+
backgroundColor: string;
|
478
|
+
color: string;
|
479
|
+
};
|
480
|
+
'&.is-yellow': {
|
481
|
+
backgroundColor: string;
|
482
|
+
color: string;
|
483
|
+
};
|
484
|
+
'&.is-cyan': {
|
485
|
+
backgroundColor: string;
|
486
|
+
color: string;
|
488
487
|
};
|
488
|
+
'&.is-teal': {
|
489
|
+
backgroundColor: string;
|
490
|
+
color: string;
|
491
|
+
};
|
492
|
+
display: string;
|
493
|
+
borderRadius: string;
|
494
|
+
textAlign: string;
|
495
|
+
alignItems: string;
|
496
|
+
justifyContent: string;
|
497
|
+
fontFamily: string;
|
489
498
|
};
|
490
499
|
listViewItem: {
|
491
500
|
rightOfData: {
|
@@ -554,8 +563,17 @@ declare const _default: {
|
|
554
563
|
borderRadius: string;
|
555
564
|
border: string;
|
556
565
|
borderColor: string;
|
557
|
-
'& > div': {
|
558
|
-
|
566
|
+
'& > div > div': {
|
567
|
+
'& > div:first-of-type': {
|
568
|
+
'& > div > div': {
|
569
|
+
borderRadius: string;
|
570
|
+
};
|
571
|
+
};
|
572
|
+
'& > div:last-of-type': {
|
573
|
+
'& > div > div': {
|
574
|
+
borderRadius: string;
|
575
|
+
};
|
576
|
+
};
|
559
577
|
};
|
560
578
|
};
|
561
579
|
};
|
@@ -248,33 +248,49 @@ var separator = {
|
|
248
248
|
bg: 'gray-300'
|
249
249
|
}
|
250
250
|
};
|
251
|
-
var
|
251
|
+
var avatar = {
|
252
|
+
backgroundColor: 'lightcyan',
|
253
|
+
color: 'darkcyan',
|
254
|
+
cursor: 'pointer',
|
255
|
+
'&.is-orange': {
|
256
|
+
backgroundColor: 'lightorange',
|
257
|
+
color: 'darkorange'
|
258
|
+
},
|
259
|
+
'&.is-green': {
|
260
|
+
backgroundColor: 'lightgreen',
|
261
|
+
color: 'darkgreen'
|
262
|
+
},
|
263
|
+
'&.is-purple': {
|
264
|
+
backgroundColor: 'lightpurple',
|
265
|
+
color: 'darkpurple'
|
266
|
+
},
|
267
|
+
'&.is-pink': {
|
268
|
+
backgroundColor: 'lightpink',
|
269
|
+
color: 'darkpink'
|
270
|
+
},
|
271
|
+
'&.is-red': {
|
272
|
+
backgroundColor: 'lightred',
|
273
|
+
color: 'darkred'
|
274
|
+
},
|
275
|
+
'&.is-yellow': {
|
276
|
+
backgroundColor: 'lightyellow',
|
277
|
+
color: 'darkyellow'
|
278
|
+
},
|
279
|
+
'&.is-cyan': {
|
280
|
+
backgroundColor: 'lightcyan',
|
281
|
+
color: 'darkcyan'
|
282
|
+
},
|
283
|
+
'&.is-teal': {
|
284
|
+
backgroundColor: 'lightteal',
|
285
|
+
color: 'darkteal'
|
286
|
+
},
|
287
|
+
display: 'flex',
|
252
288
|
borderRadius: '50%',
|
253
289
|
textAlign: 'center',
|
290
|
+
alignItems: 'center',
|
254
291
|
justifyContent: 'center',
|
255
292
|
fontFamily: 'standard'
|
256
293
|
};
|
257
|
-
var avatar = {
|
258
|
-
xl: _objectSpread({
|
259
|
-
size: '104px',
|
260
|
-
fontSize: 'calc(104px * .4)'
|
261
|
-
}, avatarBase),
|
262
|
-
lg: _objectSpread(_objectSpread({
|
263
|
-
size: '72px'
|
264
|
-
}, avatarBase), {}, {
|
265
|
-
fontSize: 'calc(72px * .4)'
|
266
|
-
}),
|
267
|
-
md: _objectSpread(_objectSpread({
|
268
|
-
size: '34px'
|
269
|
-
}, avatarBase), {}, {
|
270
|
-
fontSize: 'calc(34px * .4)'
|
271
|
-
}),
|
272
|
-
sm: _objectSpread(_objectSpread({
|
273
|
-
size: '24px'
|
274
|
-
}, avatarBase), {}, {
|
275
|
-
fontSize: 'calc(24px * .4)'
|
276
|
-
})
|
277
|
-
};
|
278
294
|
var progressBarContainer = {
|
279
295
|
backgroundColor: 'gray-200',
|
280
296
|
borderRadius: '.5rem',
|
@@ -314,8 +330,8 @@ var listViewItem = {
|
|
314
330
|
}
|
315
331
|
},
|
316
332
|
styledContainer: {
|
317
|
-
py: '
|
318
|
-
px: '
|
333
|
+
py: 'md',
|
334
|
+
px: 'lg',
|
319
335
|
bg: 'transparent',
|
320
336
|
'&.is-hovered': {
|
321
337
|
bg: 'transparent',
|
@@ -437,8 +453,17 @@ var listView = {
|
|
437
453
|
borderRadius: '16px',
|
438
454
|
border: '1px solid',
|
439
455
|
borderColor: '#e7eef4',
|
440
|
-
'& > div': {
|
441
|
-
|
456
|
+
'& > div > div': {
|
457
|
+
'& > div:first-of-type': {
|
458
|
+
'& > div > div': {
|
459
|
+
borderRadius: '16px 16px 0 0'
|
460
|
+
}
|
461
|
+
},
|
462
|
+
'& > div:last-of-type': {
|
463
|
+
'& > div > div': {
|
464
|
+
borderRadius: ' 0 0 16px 16px'
|
465
|
+
}
|
466
|
+
}
|
442
467
|
}
|
443
468
|
}
|
444
469
|
};
|
@@ -1,9 +1,13 @@
|
|
1
1
|
import { AvatarProps as ThemeUIAvatarProps, ThemeUICSSObject } from 'theme-ui';
|
2
2
|
export interface AvatarProps extends ThemeUIAvatarProps {
|
3
3
|
/** Source of avatar. */
|
4
|
-
src
|
4
|
+
src?: string;
|
5
5
|
/** Alternative text for avatar. */
|
6
6
|
alt?: string;
|
7
7
|
/** Inline styling prop */
|
8
8
|
sx?: ThemeUICSSObject;
|
9
|
+
/** If no image src is supplied, this text will render inside of a styled div */
|
10
|
+
defaultText?: string;
|
11
|
+
size?: string;
|
12
|
+
color?: string;
|
9
13
|
}
|
@@ -1,7 +1,9 @@
|
|
1
1
|
import { UseFieldProps } from '../hooks/useField/useField';
|
2
|
-
export interface CheckboxFieldProps extends UseFieldProps<HTMLInputElement> {
|
2
|
+
export interface CheckboxFieldProps extends Omit<UseFieldProps<HTMLInputElement>, 'onChange'> {
|
3
3
|
/** Handler that is called when a key is pressed. */
|
4
4
|
onKeyDown?: () => void;
|
5
5
|
/** Handler that is called when a key is released. */
|
6
6
|
onKeyUp?: () => void;
|
7
|
+
/** Handler that is called when the element's selection state changes. */
|
8
|
+
onChange?: (isSelected: boolean) => void;
|
7
9
|
}
|
package/lib/cjs/types/index.d.ts
CHANGED
package/lib/cjs/types/index.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
|
-
var _context, _context2, _context3, _context4, _context5, _context6, _context7, _context8, _context9, _context10, _context11, _context12, _context13, _context14, _context15, _context16, _context17, _context18, _context19, _context20, _context21, _context22, _context23, _context24, _context25, _context26, _context27, _context28, _context29, _context30, _context31, _context32, _context33, _context34, _context35, _context36, _context37, _context38, _context39, _context40, _context41, _context42, _context43, _context44, _context45, _context46, _context47, _context48, _context49, _context50, _context51, _context52, _context53;
|
3
|
+
var _context, _context2, _context3, _context4, _context5, _context6, _context7, _context8, _context9, _context10, _context11, _context12, _context13, _context14, _context15, _context16, _context17, _context18, _context19, _context20, _context21, _context22, _context23, _context24, _context25, _context26, _context27, _context28, _context29, _context30, _context31, _context32, _context33, _context34, _context35, _context36, _context37, _context38, _context39, _context40, _context41, _context42, _context43, _context44, _context45, _context46, _context47, _context48, _context49, _context50, _context51, _context52, _context53, _context54;
|
4
4
|
var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
|
5
5
|
var _forEachInstanceProperty = require("@babel/runtime-corejs3/core-js-stable/instance/for-each");
|
6
6
|
var _Object$keys = require("@babel/runtime-corejs3/core-js-stable/object/keys");
|
@@ -513,8 +513,19 @@ _forEachInstanceProperty(_context46 = _Object$keys(_shared)).call(_context46, fu
|
|
513
513
|
}
|
514
514
|
});
|
515
515
|
});
|
516
|
+
var _switchField = require("./switchField");
|
517
|
+
_forEachInstanceProperty(_context47 = _Object$keys(_switchField)).call(_context47, function (key) {
|
518
|
+
if (key === "default" || key === "__esModule") return;
|
519
|
+
if (key in exports && exports[key] === _switchField[key]) return;
|
520
|
+
_Object$defineProperty(exports, key, {
|
521
|
+
enumerable: true,
|
522
|
+
get: function get() {
|
523
|
+
return _switchField[key];
|
524
|
+
}
|
525
|
+
});
|
526
|
+
});
|
516
527
|
var _tab = require("./tab");
|
517
|
-
_forEachInstanceProperty(
|
528
|
+
_forEachInstanceProperty(_context48 = _Object$keys(_tab)).call(_context48, function (key) {
|
518
529
|
if (key === "default" || key === "__esModule") return;
|
519
530
|
if (key in exports && exports[key] === _tab[key]) return;
|
520
531
|
_Object$defineProperty(exports, key, {
|
@@ -525,7 +536,7 @@ _forEachInstanceProperty(_context47 = _Object$keys(_tab)).call(_context47, funct
|
|
525
536
|
});
|
526
537
|
});
|
527
538
|
var _table = require("./table");
|
528
|
-
_forEachInstanceProperty(
|
539
|
+
_forEachInstanceProperty(_context49 = _Object$keys(_table)).call(_context49, function (key) {
|
529
540
|
if (key === "default" || key === "__esModule") return;
|
530
541
|
if (key in exports && exports[key] === _table[key]) return;
|
531
542
|
_Object$defineProperty(exports, key, {
|
@@ -536,7 +547,7 @@ _forEachInstanceProperty(_context48 = _Object$keys(_table)).call(_context48, fun
|
|
536
547
|
});
|
537
548
|
});
|
538
549
|
var _tabs = require("./tabs");
|
539
|
-
_forEachInstanceProperty(
|
550
|
+
_forEachInstanceProperty(_context50 = _Object$keys(_tabs)).call(_context50, function (key) {
|
540
551
|
if (key === "default" || key === "__esModule") return;
|
541
552
|
if (key in exports && exports[key] === _tabs[key]) return;
|
542
553
|
_Object$defineProperty(exports, key, {
|
@@ -547,7 +558,7 @@ _forEachInstanceProperty(_context49 = _Object$keys(_tabs)).call(_context49, func
|
|
547
558
|
});
|
548
559
|
});
|
549
560
|
var _text = require("./text");
|
550
|
-
_forEachInstanceProperty(
|
561
|
+
_forEachInstanceProperty(_context51 = _Object$keys(_text)).call(_context51, function (key) {
|
551
562
|
if (key === "default" || key === "__esModule") return;
|
552
563
|
if (key in exports && exports[key] === _text[key]) return;
|
553
564
|
_Object$defineProperty(exports, key, {
|
@@ -558,7 +569,7 @@ _forEachInstanceProperty(_context50 = _Object$keys(_text)).call(_context50, func
|
|
558
569
|
});
|
559
570
|
});
|
560
571
|
var _textField = require("./textField");
|
561
|
-
_forEachInstanceProperty(
|
572
|
+
_forEachInstanceProperty(_context52 = _Object$keys(_textField)).call(_context52, function (key) {
|
562
573
|
if (key === "default" || key === "__esModule") return;
|
563
574
|
if (key in exports && exports[key] === _textField[key]) return;
|
564
575
|
_Object$defineProperty(exports, key, {
|
@@ -569,7 +580,7 @@ _forEachInstanceProperty(_context51 = _Object$keys(_textField)).call(_context51,
|
|
569
580
|
});
|
570
581
|
});
|
571
582
|
var _timefield = require("./timefield");
|
572
|
-
_forEachInstanceProperty(
|
583
|
+
_forEachInstanceProperty(_context53 = _Object$keys(_timefield)).call(_context53, function (key) {
|
573
584
|
if (key === "default" || key === "__esModule") return;
|
574
585
|
if (key in exports && exports[key] === _timefield[key]) return;
|
575
586
|
_Object$defineProperty(exports, key, {
|
@@ -580,7 +591,7 @@ _forEachInstanceProperty(_context52 = _Object$keys(_timefield)).call(_context52,
|
|
580
591
|
});
|
581
592
|
});
|
582
593
|
var _tooltipTrigger = require("./tooltipTrigger");
|
583
|
-
_forEachInstanceProperty(
|
594
|
+
_forEachInstanceProperty(_context54 = _Object$keys(_tooltipTrigger)).call(_context54, function (key) {
|
584
595
|
if (key === "default" || key === "__esModule") return;
|
585
596
|
if (key in exports && exports[key] === _tooltipTrigger[key]) return;
|
586
597
|
_Object$defineProperty(exports, key, {
|
@@ -0,0 +1,29 @@
|
|
1
|
+
/// <reference types="react" />
|
2
|
+
import { ControlProps } from '../hooks/useField/useField';
|
3
|
+
import { Status } from './item';
|
4
|
+
import { LabelProps } from './label';
|
5
|
+
import { DOMAttributes } from './shared';
|
6
|
+
export interface SwitchFieldProps extends DOMAttributes {
|
7
|
+
className?: string;
|
8
|
+
label?: React.ReactNode;
|
9
|
+
helperText?: string;
|
10
|
+
isDefaultSelected?: boolean;
|
11
|
+
isDisabled?: boolean;
|
12
|
+
status?: Status;
|
13
|
+
controlProps?: ControlProps;
|
14
|
+
isSelected?: boolean;
|
15
|
+
onChange?: () => void;
|
16
|
+
value?: string;
|
17
|
+
isRequired?: boolean;
|
18
|
+
hintText?: string;
|
19
|
+
labelProps?: LabelProps;
|
20
|
+
hasAutoFocus?: boolean;
|
21
|
+
id?: string;
|
22
|
+
isReadOnly?: boolean;
|
23
|
+
name?: string;
|
24
|
+
onBlur?: () => void;
|
25
|
+
onFocus?: () => void;
|
26
|
+
onFocusChange?: () => void;
|
27
|
+
onKeyDown?: () => void;
|
28
|
+
onKeyUp?: () => void;
|
29
|
+
}
|
@@ -1,14 +1,51 @@
|
|
1
|
+
import _Object$keys from "@babel/runtime-corejs3/core-js-stable/object/keys";
|
2
|
+
import _Object$getOwnPropertySymbols from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols";
|
3
|
+
import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
|
4
|
+
import _Object$getOwnPropertyDescriptor from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor";
|
5
|
+
import _forEachInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/for-each";
|
6
|
+
import _Object$getOwnPropertyDescriptors from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors";
|
7
|
+
import _Object$defineProperties from "@babel/runtime-corejs3/core-js-stable/object/define-properties";
|
8
|
+
import _Object$defineProperty from "@babel/runtime-corejs3/core-js-stable/object/define-property";
|
1
9
|
import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
|
10
|
+
import _defineProperty from "@babel/runtime-corejs3/helpers/esm/defineProperty";
|
11
|
+
import _objectWithoutProperties from "@babel/runtime-corejs3/helpers/esm/objectWithoutProperties";
|
12
|
+
var _excluded = ["alt", "defaultText", "color", "className", "size", "src", "sx"];
|
13
|
+
function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
14
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context, _context2; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context = ownKeys(Object(source), !0)).call(_context, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context2 = ownKeys(Object(source))).call(_context2, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
|
2
15
|
import React, { forwardRef } from 'react';
|
3
|
-
import { Avatar as ThemeUIAvatar } from 'theme-ui';
|
16
|
+
import { Avatar as ThemeUIAvatar, Box } from 'theme-ui';
|
17
|
+
import { useStatusClasses } from '../../hooks';
|
4
18
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
5
19
|
var Avatar = /*#__PURE__*/forwardRef(function (props, ref) {
|
6
|
-
|
7
|
-
|
8
|
-
|
20
|
+
var _props$alt = props.alt,
|
21
|
+
alt = _props$alt === void 0 ? 'Avatar' : _props$alt,
|
22
|
+
defaultText = props.defaultText,
|
23
|
+
color = props.color,
|
24
|
+
className = props.className,
|
25
|
+
size = props.size,
|
26
|
+
src = props.src,
|
27
|
+
sx = props.sx,
|
28
|
+
others = _objectWithoutProperties(props, _excluded);
|
29
|
+
var _useStatusClasses = useStatusClasses(className, _defineProperty({}, "is-".concat(color), true)),
|
30
|
+
classNames = _useStatusClasses.classNames;
|
31
|
+
if (src) {
|
32
|
+
return ___EmotionJSX(ThemeUIAvatar, _extends({
|
33
|
+
ref: ref,
|
34
|
+
alt: alt,
|
35
|
+
src: src,
|
36
|
+
sx: _objectSpread({
|
37
|
+
size: size
|
38
|
+
}, sx)
|
39
|
+
}, others));
|
40
|
+
}
|
41
|
+
return ___EmotionJSX(Box, _extends({
|
42
|
+
variant: "avatar",
|
43
|
+
className: classNames,
|
44
|
+
sx: _objectSpread({
|
45
|
+
size: size,
|
46
|
+
fontSize: size
|
47
|
+
}, sx)
|
48
|
+
}, others), defaultText);
|
9
49
|
});
|
10
|
-
Avatar.defaultProps = {
|
11
|
-
alt: 'Avatar'
|
12
|
-
};
|
13
50
|
Avatar.displayName = 'Avatar';
|
14
51
|
export default Avatar;
|
@@ -5,8 +5,9 @@ import { render, screen } from '../../utils/testUtils/testWrapper';
|
|
5
5
|
import { universalComponentTests } from '../../utils/testUtils/universalComponentTest';
|
6
6
|
import Avatar from '.';
|
7
7
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
8
|
+
var src = faker.image.lorempicsum.imageUrl(150, 150, false, undefined, '1');
|
8
9
|
var defaultProps = {
|
9
|
-
src:
|
10
|
+
src: src
|
10
11
|
};
|
11
12
|
var getComponent = function getComponent() {
|
12
13
|
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
@@ -31,4 +32,12 @@ test('an avatar is rendered with custom alt', function () {
|
|
31
32
|
});
|
32
33
|
var img = screen.getByRole('img');
|
33
34
|
expect(img).toHaveAttribute('alt', 'Custom Alt');
|
35
|
+
});
|
36
|
+
test('an avatar is rendered with custom alt', function () {
|
37
|
+
getComponent({
|
38
|
+
src: undefined,
|
39
|
+
defaultText: 'KL'
|
40
|
+
});
|
41
|
+
var avatar = screen.getByText('KL');
|
42
|
+
expect(avatar).toBeInTheDocument();
|
34
43
|
});
|
@@ -87,8 +87,8 @@ export var Controlled = function Controlled() {
|
|
87
87
|
setSelected = _React$useState2[1];
|
88
88
|
return ___EmotionJSX(CheckboxField, {
|
89
89
|
isSelected: isSelected,
|
90
|
-
onChange: function onChange(
|
91
|
-
return setSelected;
|
90
|
+
onChange: function onChange(selected) {
|
91
|
+
return setSelected(selected);
|
92
92
|
},
|
93
93
|
label: "Click me"
|
94
94
|
});
|
@@ -183,7 +183,9 @@ export var ExpandableAndToggleableIndeterminate = function ExpandableAndToggleab
|
|
183
183
|
return ___EmotionJSX(React.Fragment, null, ___EmotionJSX(SwitchField, {
|
184
184
|
isSelected: isReadOnly,
|
185
185
|
label: "Is Read Only",
|
186
|
-
onChange:
|
186
|
+
onChange: function onChange() {
|
187
|
+
return setIsReadOnly(!isReadOnly);
|
188
|
+
},
|
187
189
|
value: "my-switch"
|
188
190
|
}), ___EmotionJSX("br", null), ___EmotionJSX(Box, {
|
189
191
|
isRow: true,
|