@pingux/astro 2.133.0 → 2.134.0-alpha.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/lib/cjs/components/Box/Box.styles.d.ts +4 -0
- package/lib/cjs/components/Box/Box.styles.js +5 -0
- package/lib/cjs/components/IconButton/IconButton.styles.d.ts +41 -0
- package/lib/cjs/components/IconButton/IconButton.styles.js +14 -1
- package/lib/cjs/components/ListBox/Option.js +11 -2
- package/lib/cjs/components/SelectField/SelectField.stories.d.ts +1 -0
- package/lib/cjs/components/SelectField/SelectField.stories.js +22 -2
- package/lib/cjs/components/SelectField/SelectField.test.js +11 -0
- package/lib/cjs/components/SelectFieldBase/SelectFieldBase.js +48 -27
- package/lib/cjs/components/SelectFieldBase/SelectFieldBase.test.js +26 -0
- package/lib/cjs/components/TableBase/TableBase.js +36 -6
- package/lib/cjs/components/TableBase/TableBase.stories.d.ts +14 -0
- package/lib/cjs/components/TableBase/TableBase.stories.js +193 -6
- package/lib/cjs/components/TableBase/TableBase.styles.d.ts +17 -1
- package/lib/cjs/components/TableBase/TableBase.styles.js +11 -2
- package/lib/cjs/components/TableBase/TableBase.test.js +267 -0
- package/lib/cjs/components/TableBase/stories/NextGenTableBase.js +2 -4
- package/lib/cjs/hooks/useGetTheme/useGetTheme.d.ts +2 -0
- package/lib/cjs/styles/themeOverrides/nextGenDarkMode/customProperties/icons.d.ts +2 -0
- package/lib/cjs/styles/themeOverrides/nextGenDarkMode/customProperties/index.d.ts +2 -0
- package/lib/cjs/styles/themeOverrides/nextGenDarkMode/variants/variants.d.ts +0 -5
- package/lib/cjs/styles/themeOverrides/nextGenDarkMode/variants/variants.js +0 -5
- package/lib/cjs/styles/themes/astro/customProperties/icons.d.ts +2 -0
- package/lib/cjs/styles/themes/astro/customProperties/icons.js +1 -1
- package/lib/cjs/styles/themes/astro/customProperties/index.d.ts +2 -0
- package/lib/cjs/styles/themes/next-gen/customProperties/icons.d.ts +2 -0
- package/lib/cjs/styles/themes/next-gen/customProperties/icons.js +1 -1
- package/lib/cjs/styles/themes/next-gen/customProperties/index.d.ts +2 -0
- package/lib/cjs/styles/themes/next-gen/forms.d.ts +22 -0
- package/lib/cjs/styles/themes/next-gen/forms.js +12 -0
- package/lib/cjs/styles/themes/next-gen/next-gen.d.ts +58 -6
- package/lib/cjs/styles/themes/next-gen/variants/button.d.ts +38 -2
- package/lib/cjs/styles/themes/next-gen/variants/button.js +29 -19
- package/lib/cjs/styles/themes/next-gen/variants/cards.d.ts +0 -1
- package/lib/cjs/styles/themes/next-gen/variants/cards.js +1 -3
- package/lib/cjs/styles/themes/next-gen/variants/tableBase.d.ts +4 -2
- package/lib/cjs/styles/themes/next-gen/variants/tableBase.js +4 -2
- package/lib/cjs/styles/themes/next-gen/variants/variants.d.ts +9 -3
- package/lib/cjs/styles/themes/next-gen/variants/variants.js +7 -2
- package/lib/cjs/types/selectField.d.ts +5 -0
- package/lib/components/Box/Box.styles.js +5 -0
- package/lib/components/IconButton/IconButton.styles.js +14 -1
- package/lib/components/ListBox/Option.js +12 -3
- package/lib/components/SelectField/SelectField.stories.js +19 -0
- package/lib/components/SelectField/SelectField.test.js +11 -0
- package/lib/components/SelectFieldBase/SelectFieldBase.js +41 -20
- package/lib/components/SelectFieldBase/SelectFieldBase.test.js +26 -0
- package/lib/components/TableBase/TableBase.js +38 -8
- package/lib/components/TableBase/TableBase.stories.js +195 -8
- package/lib/components/TableBase/TableBase.styles.js +11 -2
- package/lib/components/TableBase/TableBase.test.js +267 -1
- package/lib/components/TableBase/stories/NextGenTableBase.js +3 -5
- package/lib/styles/themeOverrides/nextGenDarkMode/variants/variants.js +0 -5
- package/lib/styles/themes/astro/customProperties/icons.js +1 -1
- package/lib/styles/themes/next-gen/customProperties/icons.js +1 -1
- package/lib/styles/themes/next-gen/forms.js +12 -0
- package/lib/styles/themes/next-gen/variants/button.js +29 -19
- package/lib/styles/themes/next-gen/variants/cards.js +1 -3
- package/lib/styles/themes/next-gen/variants/tableBase.js +4 -2
- package/lib/styles/themes/next-gen/variants/variants.js +7 -2
- package/package.json +1 -1
@@ -1316,6 +1316,8 @@ declare const _default: {
|
|
1316
1316
|
width: string;
|
1317
1317
|
height: string;
|
1318
1318
|
border: string;
|
1319
|
+
position: string;
|
1320
|
+
right: string;
|
1319
1321
|
'& > svg': {
|
1320
1322
|
minWidth: string;
|
1321
1323
|
width: string;
|
@@ -1327,8 +1329,6 @@ declare const _default: {
|
|
1327
1329
|
'&.is-pressed': {
|
1328
1330
|
bg: string;
|
1329
1331
|
};
|
1330
|
-
position: string;
|
1331
|
-
right: number;
|
1332
1332
|
cursor: string;
|
1333
1333
|
transition: string;
|
1334
1334
|
outline: string;
|
@@ -1383,6 +1383,42 @@ declare const _default: {
|
|
1383
1383
|
bg: string;
|
1384
1384
|
};
|
1385
1385
|
};
|
1386
|
+
clearSelectionButton: {
|
1387
|
+
top: string;
|
1388
|
+
right: string;
|
1389
|
+
bg: string;
|
1390
|
+
'.is-float-label &': {
|
1391
|
+
top: string;
|
1392
|
+
};
|
1393
|
+
width: string;
|
1394
|
+
height: string;
|
1395
|
+
border: string;
|
1396
|
+
position: string;
|
1397
|
+
'& > svg': {
|
1398
|
+
minWidth: string;
|
1399
|
+
width: string;
|
1400
|
+
height: string;
|
1401
|
+
};
|
1402
|
+
'&.is-hovered': {
|
1403
|
+
bg: string;
|
1404
|
+
};
|
1405
|
+
'&.is-pressed': {
|
1406
|
+
bg: string;
|
1407
|
+
};
|
1408
|
+
cursor: string;
|
1409
|
+
transition: string;
|
1410
|
+
outline: string;
|
1411
|
+
borderRadius: string;
|
1412
|
+
borderColor: string;
|
1413
|
+
path: {
|
1414
|
+
fill: string;
|
1415
|
+
};
|
1416
|
+
'&.is-focused': {
|
1417
|
+
outline: string;
|
1418
|
+
outlineColor: string;
|
1419
|
+
outlineOffset: string;
|
1420
|
+
};
|
1421
|
+
};
|
1386
1422
|
};
|
1387
1423
|
modalCloseButton: {
|
1388
1424
|
position: string;
|
@@ -1515,6 +1551,17 @@ declare const _default: {
|
|
1515
1551
|
currentValue: {
|
1516
1552
|
color: string;
|
1517
1553
|
};
|
1554
|
+
arrow: {
|
1555
|
+
width: string;
|
1556
|
+
height: string;
|
1557
|
+
alignItems: string;
|
1558
|
+
justifyContent: string;
|
1559
|
+
'& > svg': {
|
1560
|
+
minWidth: string;
|
1561
|
+
width: string;
|
1562
|
+
height: string;
|
1563
|
+
};
|
1564
|
+
};
|
1518
1565
|
};
|
1519
1566
|
radio: {
|
1520
1567
|
base: {
|
@@ -2594,7 +2641,6 @@ declare const _default: {
|
|
2594
2641
|
};
|
2595
2642
|
};
|
2596
2643
|
tableWrapper: {
|
2597
|
-
overflowY: string;
|
2598
2644
|
p: string;
|
2599
2645
|
borderColor: string;
|
2600
2646
|
boxShadow: string;
|
@@ -2895,6 +2941,7 @@ declare const _default: {
|
|
2895
2941
|
py: string;
|
2896
2942
|
pl: string;
|
2897
2943
|
pr: string;
|
2944
|
+
justifyContent: string;
|
2898
2945
|
'&.is-focused': {
|
2899
2946
|
color: string;
|
2900
2947
|
bg: string;
|
@@ -2902,7 +2949,7 @@ declare const _default: {
|
|
2902
2949
|
'&.is-selected': {
|
2903
2950
|
color: string;
|
2904
2951
|
bg: string;
|
2905
|
-
pl:
|
2952
|
+
pl: string;
|
2906
2953
|
'&.is-focused': {
|
2907
2954
|
color: string;
|
2908
2955
|
};
|
@@ -3841,9 +3888,9 @@ declare const _default: {
|
|
3841
3888
|
borderBottomColor: string;
|
3842
3889
|
backgroundColor: string;
|
3843
3890
|
'&:not(.has-caption)': {
|
3891
|
+
borderTopLeftRadius: string;
|
3892
|
+
borderTopRightRadius: string;
|
3844
3893
|
'& > tr:first-child': {
|
3845
|
-
borderTopLeftRadius: string;
|
3846
|
-
borderTopRightRadius: string;
|
3847
3894
|
'& > th:first-of-type': {
|
3848
3895
|
borderTopLeftRadius: string;
|
3849
3896
|
};
|
@@ -3870,6 +3917,8 @@ declare const _default: {
|
|
3870
3917
|
borderTopColor: string;
|
3871
3918
|
borderBottom: string;
|
3872
3919
|
backgroundColor: string;
|
3920
|
+
borderBottomLeftRadius: string;
|
3921
|
+
borderBottomRightRadius: string;
|
3873
3922
|
'& > tr:last-child': {
|
3874
3923
|
borderBottom: string;
|
3875
3924
|
borderBottomLeftRadius: string;
|
@@ -3966,6 +4015,9 @@ declare const _default: {
|
|
3966
4015
|
stroke: string;
|
3967
4016
|
};
|
3968
4017
|
};
|
4018
|
+
'&.is-focused': {
|
4019
|
+
boxShadow: string;
|
4020
|
+
};
|
3969
4021
|
};
|
3970
4022
|
};
|
3971
4023
|
};
|
@@ -1064,6 +1064,8 @@ declare const buttons: {
|
|
1064
1064
|
width: string;
|
1065
1065
|
height: string;
|
1066
1066
|
border: string;
|
1067
|
+
position: string;
|
1068
|
+
right: string;
|
1067
1069
|
'& > svg': {
|
1068
1070
|
minWidth: string;
|
1069
1071
|
width: string;
|
@@ -1075,8 +1077,6 @@ declare const buttons: {
|
|
1075
1077
|
'&.is-pressed': {
|
1076
1078
|
bg: string;
|
1077
1079
|
};
|
1078
|
-
position: string;
|
1079
|
-
right: number;
|
1080
1080
|
cursor: string;
|
1081
1081
|
transition: string;
|
1082
1082
|
outline: string;
|
@@ -1131,6 +1131,42 @@ declare const buttons: {
|
|
1131
1131
|
bg: string;
|
1132
1132
|
};
|
1133
1133
|
};
|
1134
|
+
clearSelectionButton: {
|
1135
|
+
top: string;
|
1136
|
+
right: string;
|
1137
|
+
bg: string;
|
1138
|
+
'.is-float-label &': {
|
1139
|
+
top: string;
|
1140
|
+
};
|
1141
|
+
width: string;
|
1142
|
+
height: string;
|
1143
|
+
border: string;
|
1144
|
+
position: string;
|
1145
|
+
'& > svg': {
|
1146
|
+
minWidth: string;
|
1147
|
+
width: string;
|
1148
|
+
height: string;
|
1149
|
+
};
|
1150
|
+
'&.is-hovered': {
|
1151
|
+
bg: string;
|
1152
|
+
};
|
1153
|
+
'&.is-pressed': {
|
1154
|
+
bg: string;
|
1155
|
+
};
|
1156
|
+
cursor: string;
|
1157
|
+
transition: string;
|
1158
|
+
outline: string;
|
1159
|
+
borderRadius: string;
|
1160
|
+
borderColor: string;
|
1161
|
+
path: {
|
1162
|
+
fill: string;
|
1163
|
+
};
|
1164
|
+
'&.is-focused': {
|
1165
|
+
outline: string;
|
1166
|
+
outlineColor: string;
|
1167
|
+
outlineOffset: string;
|
1168
|
+
};
|
1169
|
+
};
|
1134
1170
|
};
|
1135
1171
|
modalCloseButton: {
|
1136
1172
|
position: string;
|
@@ -17,6 +17,7 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs3/he
|
|
17
17
|
var _chromaJs = _interopRequireDefault(require("chroma-js"));
|
18
18
|
var _codeView = require("../codeView/codeView");
|
19
19
|
var _colors = _interopRequireDefault(require("../colors/colors"));
|
20
|
+
var _tShirtSizes = _interopRequireDefault(require("../customProperties/tShirtSizes"));
|
20
21
|
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; }
|
21
22
|
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) { (0, _defineProperty2["default"])(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; }
|
22
23
|
var primaryBlue = _colors["default"].primary,
|
@@ -384,6 +385,24 @@ var onyxIconButton = _objectSpread(_objectSpread(_objectSpread({}, baseIconButto
|
|
384
385
|
alignItems: 'center',
|
385
386
|
justifyContent: 'center'
|
386
387
|
});
|
388
|
+
var searchClearButton = _objectSpread(_objectSpread({}, baseIconButton), {}, {
|
389
|
+
width: '20px',
|
390
|
+
height: '20px',
|
391
|
+
border: 'none',
|
392
|
+
position: 'absolute',
|
393
|
+
right: '20px',
|
394
|
+
'& > svg': {
|
395
|
+
minWidth: _tShirtSizes["default"].xs,
|
396
|
+
width: _tShirtSizes["default"].xs,
|
397
|
+
height: _tShirtSizes["default"].xs
|
398
|
+
},
|
399
|
+
'&.is-hovered': {
|
400
|
+
bg: 'background.hover'
|
401
|
+
},
|
402
|
+
'&.is-pressed': {
|
403
|
+
bg: 'background.hover'
|
404
|
+
}
|
405
|
+
});
|
387
406
|
var iconButtons = {
|
388
407
|
base: _objectSpread({}, baseIconButton),
|
389
408
|
nextGen: _objectSpread({}, onyxIconButton),
|
@@ -474,24 +493,7 @@ var iconButtons = {
|
|
474
493
|
backgroundColor: 'gray-300'
|
475
494
|
}
|
476
495
|
},
|
477
|
-
searchClearButton:
|
478
|
-
width: '20px',
|
479
|
-
height: '20px',
|
480
|
-
border: 'none',
|
481
|
-
'& > svg': {
|
482
|
-
minWidth: '18px',
|
483
|
-
width: '18px',
|
484
|
-
height: '18px'
|
485
|
-
},
|
486
|
-
'&.is-hovered': {
|
487
|
-
bg: 'background.hover'
|
488
|
-
},
|
489
|
-
'&.is-pressed': {
|
490
|
-
bg: 'background.hover'
|
491
|
-
},
|
492
|
-
position: 'absolute',
|
493
|
-
right: 20
|
494
|
-
}),
|
496
|
+
searchClearButton: searchClearButton,
|
495
497
|
filter: _objectSpread(_objectSpread({}, baseIconButton), {}, {
|
496
498
|
bg: 'transparent',
|
497
499
|
border: '2px solid',
|
@@ -519,7 +521,15 @@ var iconButtons = {
|
|
519
521
|
'&.is-hovered': {
|
520
522
|
bg: 'gray-900'
|
521
523
|
}
|
522
|
-
}
|
524
|
+
},
|
525
|
+
clearSelectionButton: _objectSpread(_objectSpread({}, searchClearButton), {}, {
|
526
|
+
top: '15px',
|
527
|
+
right: '1rem',
|
528
|
+
bg: 'transparent',
|
529
|
+
'.is-float-label &': {
|
530
|
+
top: '12px'
|
531
|
+
}
|
532
|
+
})
|
523
533
|
};
|
524
534
|
var buttons = {
|
525
535
|
neutral: neutral,
|
@@ -82,9 +82,7 @@ var suggestionRow = _objectSpread(_objectSpread({}, baseSuggestion), {}, {
|
|
82
82
|
var suggestionColumn = _objectSpread(_objectSpread({}, baseSuggestion), {}, {
|
83
83
|
display: 'flex'
|
84
84
|
});
|
85
|
-
var tableWrapper = _objectSpread(
|
86
|
-
overflowY: 'hidden'
|
87
|
-
});
|
85
|
+
var tableWrapper = _objectSpread({}, container);
|
88
86
|
var _default = {
|
89
87
|
interactive: interactive,
|
90
88
|
dark: dark,
|
@@ -30,9 +30,9 @@ export declare const tableBase: {
|
|
30
30
|
borderBottomColor: string;
|
31
31
|
backgroundColor: string;
|
32
32
|
'&:not(.has-caption)': {
|
33
|
+
borderTopLeftRadius: string;
|
34
|
+
borderTopRightRadius: string;
|
33
35
|
'& > tr:first-child': {
|
34
|
-
borderTopLeftRadius: string;
|
35
|
-
borderTopRightRadius: string;
|
36
36
|
'& > th:first-of-type': {
|
37
37
|
borderTopLeftRadius: string;
|
38
38
|
};
|
@@ -59,6 +59,8 @@ export declare const tableBase: {
|
|
59
59
|
borderTopColor: string;
|
60
60
|
borderBottom: string;
|
61
61
|
backgroundColor: string;
|
62
|
+
borderBottomLeftRadius: string;
|
63
|
+
borderBottomRightRadius: string;
|
62
64
|
'& > tr:last-child': {
|
63
65
|
borderBottom: string;
|
64
66
|
borderBottomLeftRadius: string;
|
@@ -48,9 +48,9 @@ var thead = {
|
|
48
48
|
borderBottomColor: 'border.base',
|
49
49
|
backgroundColor: 'background.base',
|
50
50
|
'&:not(.has-caption)': {
|
51
|
+
borderTopLeftRadius: borderRadius,
|
52
|
+
borderTopRightRadius: borderRadius,
|
51
53
|
'& > tr:first-child': {
|
52
|
-
borderTopLeftRadius: borderRadius,
|
53
|
-
borderTopRightRadius: borderRadius,
|
54
54
|
'& > th:first-of-type': {
|
55
55
|
borderTopLeftRadius: borderRadius
|
56
56
|
},
|
@@ -73,6 +73,8 @@ var tbody = {
|
|
73
73
|
borderTopColor: 'border.base',
|
74
74
|
borderBottom: 'unset',
|
75
75
|
backgroundColor: 'background.base',
|
76
|
+
borderBottomLeftRadius: borderRadius,
|
77
|
+
borderBottomRightRadius: borderRadius,
|
76
78
|
'& > tr:last-child': {
|
77
79
|
borderBottom: 'unset',
|
78
80
|
borderBottomLeftRadius: borderRadius,
|
@@ -494,6 +494,7 @@ declare const _default: {
|
|
494
494
|
py: string;
|
495
495
|
pl: string;
|
496
496
|
pr: string;
|
497
|
+
justifyContent: string;
|
497
498
|
'&.is-focused': {
|
498
499
|
color: string;
|
499
500
|
bg: string;
|
@@ -501,7 +502,7 @@ declare const _default: {
|
|
501
502
|
'&.is-selected': {
|
502
503
|
color: string;
|
503
504
|
bg: string;
|
504
|
-
pl:
|
505
|
+
pl: string;
|
505
506
|
'&.is-focused': {
|
506
507
|
color: string;
|
507
508
|
};
|
@@ -1440,9 +1441,9 @@ declare const _default: {
|
|
1440
1441
|
borderBottomColor: string;
|
1441
1442
|
backgroundColor: string;
|
1442
1443
|
'&:not(.has-caption)': {
|
1444
|
+
borderTopLeftRadius: string;
|
1445
|
+
borderTopRightRadius: string;
|
1443
1446
|
'& > tr:first-child': {
|
1444
|
-
borderTopLeftRadius: string;
|
1445
|
-
borderTopRightRadius: string;
|
1446
1447
|
'& > th:first-of-type': {
|
1447
1448
|
borderTopLeftRadius: string;
|
1448
1449
|
};
|
@@ -1469,6 +1470,8 @@ declare const _default: {
|
|
1469
1470
|
borderTopColor: string;
|
1470
1471
|
borderBottom: string;
|
1471
1472
|
backgroundColor: string;
|
1473
|
+
borderBottomLeftRadius: string;
|
1474
|
+
borderBottomRightRadius: string;
|
1472
1475
|
'& > tr:last-child': {
|
1473
1476
|
borderBottom: string;
|
1474
1477
|
borderBottomLeftRadius: string;
|
@@ -1565,6 +1568,9 @@ declare const _default: {
|
|
1565
1568
|
stroke: string;
|
1566
1569
|
};
|
1567
1570
|
};
|
1571
|
+
'&.is-focused': {
|
1572
|
+
boxShadow: string;
|
1573
|
+
};
|
1568
1574
|
};
|
1569
1575
|
};
|
1570
1576
|
};
|
@@ -19,6 +19,7 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs3/he
|
|
19
19
|
var _Attachment = _interopRequireDefault(require("../../../../components/AIComponents/Attachment/Attachment.styles"));
|
20
20
|
var _Skeleton = _interopRequireDefault(require("../../../../components/Skeleton/Skeleton.styles"));
|
21
21
|
var _codeView = _interopRequireDefault(require("../codeView/codeView"));
|
22
|
+
var _colors = _interopRequireDefault(require("../colors/colors"));
|
22
23
|
var _avatar = require("./avatar");
|
23
24
|
var _button = _interopRequireWildcard(require("./button"));
|
24
25
|
var _callout = _interopRequireDefault(require("./callout"));
|
@@ -212,7 +213,8 @@ var listBox = {
|
|
212
213
|
option: {
|
213
214
|
py: '.75rem',
|
214
215
|
pl: '.75rem',
|
215
|
-
pr: '
|
216
|
+
pr: 'md',
|
217
|
+
justifyContent: 'space-between',
|
216
218
|
'&.is-focused': {
|
217
219
|
color: 'text.primary',
|
218
220
|
bg: 'gray-100'
|
@@ -220,7 +222,7 @@ var listBox = {
|
|
220
222
|
'&.is-selected': {
|
221
223
|
color: 'text.primary',
|
222
224
|
bg: 'lightblue',
|
223
|
-
pl:
|
225
|
+
pl: '.75rem',
|
224
226
|
'&.is-focused': {
|
225
227
|
color: 'text.primary'
|
226
228
|
}
|
@@ -469,6 +471,9 @@ var _default = {
|
|
469
471
|
fill: 'gray-500',
|
470
472
|
stroke: 'gray-500'
|
471
473
|
}
|
474
|
+
},
|
475
|
+
'&.is-focused': {
|
476
|
+
boxShadow: "inset 0px 0px 0px 1px ".concat(_colors["default"].focus)
|
472
477
|
}
|
473
478
|
}
|
474
479
|
}
|
@@ -12,6 +12,8 @@ export interface SelectFieldProps<T> extends Omit<StyleProps, 'direction'>, UseS
|
|
12
12
|
};
|
13
13
|
'data-testid'?: string;
|
14
14
|
hintText?: string;
|
15
|
+
hasClearButton?: boolean;
|
16
|
+
onClear?: () => void;
|
15
17
|
}
|
16
18
|
export interface SelectFieldBaseProps extends UseSelectFieldReturnProps<object>, SharedFieldProps {
|
17
19
|
slots?: {
|
@@ -25,4 +27,7 @@ export interface SelectFieldBaseProps extends UseSelectFieldReturnProps<object>,
|
|
25
27
|
selectProps?: Record<string, unknown>;
|
26
28
|
isDisabled?: boolean;
|
27
29
|
helpHintProps?: HelpHintProps;
|
30
|
+
hasClearButton?: boolean;
|
31
|
+
clearButtonProps?: Record<string, unknown>;
|
32
|
+
onClear?: () => void;
|
28
33
|
}
|
@@ -1,9 +1,11 @@
|
|
1
|
+
import { focus } from '../../styles/colors';
|
1
2
|
var base = {
|
2
3
|
display: 'flex'
|
3
4
|
};
|
4
5
|
var indeterminateCheckboxIcon = {
|
5
6
|
width: '24px',
|
6
7
|
height: '24px',
|
8
|
+
borderRadius: '4px',
|
7
9
|
'& rect[id="indeterminate-checkbox-icon-wrapper"]': {
|
8
10
|
fill: 'active',
|
9
11
|
stroke: 'active'
|
@@ -13,6 +15,9 @@ var indeterminateCheckboxIcon = {
|
|
13
15
|
fill: 'neutral.80',
|
14
16
|
stroke: 'neutral.80'
|
15
17
|
}
|
18
|
+
},
|
19
|
+
'&.is-focused': {
|
20
|
+
boxShadow: "inset 0px 0px 0px 1px ".concat(focus)
|
16
21
|
}
|
17
22
|
};
|
18
23
|
export default {
|
@@ -9,6 +9,7 @@ import _Object$defineProperty from "@babel/runtime-corejs3/core-js-stable/object
|
|
9
9
|
import _defineProperty from "@babel/runtime-corejs3/helpers/esm/defineProperty";
|
10
10
|
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; }
|
11
11
|
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; }
|
12
|
+
import tShirtSizes from '../../styles/themes/astro/customProperties/tShirtSizes';
|
12
13
|
import { badgeDeleteButton, deleteButton, invertedBadgeDeleteButton } from '../Badge/Badge.styles';
|
13
14
|
import { defaultActive, defaultFocus, defaultHover } from '../Button/Buttons.styles';
|
14
15
|
import { toggle } from '../CollapsiblePanel/CollapsiblePanel.styles';
|
@@ -138,6 +139,17 @@ var searchClearButton = _objectSpread(_objectSpread({}, base), {}, {
|
|
138
139
|
position: 'absolute',
|
139
140
|
right: 10
|
140
141
|
});
|
142
|
+
var clearSelectionButton = _objectSpread(_objectSpread({}, base), {}, {
|
143
|
+
width: tShirtSizes.md,
|
144
|
+
height: tShirtSizes.md,
|
145
|
+
position: 'absolute',
|
146
|
+
right: '15px',
|
147
|
+
top: '7px',
|
148
|
+
bg: 'white',
|
149
|
+
'.is-float-label &': {
|
150
|
+
top: '9px'
|
151
|
+
}
|
152
|
+
});
|
141
153
|
var filter = _objectSpread(_objectSpread({}, base), {}, {
|
142
154
|
bg: 'white',
|
143
155
|
border: '1px solid',
|
@@ -187,5 +199,6 @@ export default {
|
|
187
199
|
applicationPortal: applicationPortal,
|
188
200
|
applicationPortalPinned: applicationPortalPinned,
|
189
201
|
searchClearButton: searchClearButton,
|
190
|
-
filter: filter
|
202
|
+
filter: filter,
|
203
|
+
clearSelectionButton: clearSelectionButton
|
191
204
|
};
|
@@ -14,10 +14,11 @@ var _excluded = ["item", "hasVirtualFocus", "isCondensed"],
|
|
14
14
|
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; }
|
15
15
|
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; }
|
16
16
|
import React, { forwardRef, useContext, useEffect, useImperativeHandle, useRef } from 'react';
|
17
|
+
import CheckIcon from '@pingux/mdi-react/CheckIcon';
|
17
18
|
import CircleSmallIcon from '@pingux/mdi-react/CircleSmallIcon';
|
18
19
|
import { useOption } from '@react-aria/listbox';
|
19
20
|
import { useMultivaluesContext } from '../../context/MultivaluesContext';
|
20
|
-
import { useStatusClasses } from '../../hooks';
|
21
|
+
import { useGetTheme, useStatusClasses } from '../../hooks';
|
21
22
|
import Box from '../Box';
|
22
23
|
import Icon from '../Icon';
|
23
24
|
import { ListBoxContext } from './ListBoxContext';
|
@@ -88,6 +89,8 @@ var Option = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
88
89
|
state.selectionManager.setFocusedKey(item.key);
|
89
90
|
}
|
90
91
|
};
|
92
|
+
var _useGetTheme = useGetTheme(),
|
93
|
+
isOnyx = _useGetTheme.themeState.isOnyx;
|
91
94
|
var _useStatusClasses = useStatusClasses(null, {
|
92
95
|
isDisabled: isDisabled || isSeparator,
|
93
96
|
isFocused: focused,
|
@@ -128,11 +131,17 @@ var Option = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
128
131
|
mr: "xs",
|
129
132
|
className: classNames,
|
130
133
|
variant: "listBox.checkboxIcon"
|
131
|
-
}) : isSelected && ___EmotionJSX(Icon, {
|
134
|
+
}) : isSelected && !isOnyx && ___EmotionJSX(Icon, {
|
132
135
|
icon: CircleSmallIcon,
|
133
136
|
title: {
|
134
137
|
name: 'Circle Small Icon'
|
135
138
|
}
|
136
|
-
}), rendered
|
139
|
+
}), rendered, isSelected && isOnyx && ___EmotionJSX(Icon, {
|
140
|
+
icon: CheckIcon,
|
141
|
+
title: {
|
142
|
+
name: 'Check Icon'
|
143
|
+
},
|
144
|
+
color: "green-500"
|
145
|
+
}));
|
137
146
|
});
|
138
147
|
export default Option;
|
@@ -457,4 +457,23 @@ export var WithHelpHint = function WithHelpHint(args) {
|
|
457
457
|
}, "Blue"), ___EmotionJSX(Item, {
|
458
458
|
key: "yellow"
|
459
459
|
}, "Yellow")));
|
460
|
+
};
|
461
|
+
export var WithClearButton = function WithClearButton(args) {
|
462
|
+
var _useState5 = useState('red'),
|
463
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
464
|
+
selectedKey = _useState6[0],
|
465
|
+
setSelectedKey = _useState6[1];
|
466
|
+
return ___EmotionJSX(OverlayProvider, null, ___EmotionJSX(SelectField, _extends({}, args, {
|
467
|
+
width: "100%",
|
468
|
+
label: "What's your favorite color?",
|
469
|
+
hasClearButton: true,
|
470
|
+
selectedKey: selectedKey,
|
471
|
+
onSelectionChange: setSelectedKey
|
472
|
+
}), ___EmotionJSX(Item, {
|
473
|
+
key: "red"
|
474
|
+
}, "Red"), ___EmotionJSX(Item, {
|
475
|
+
key: "blue"
|
476
|
+
}, "Blue"), ___EmotionJSX(Item, {
|
477
|
+
key: "yellow"
|
478
|
+
}, "Yellow")));
|
460
479
|
};
|
@@ -191,4 +191,15 @@ test('should show hintText text if prop is passed', function () {
|
|
191
191
|
fireEvent.mouseMove(helpHintButton);
|
192
192
|
fireEvent.mouseEnter(helpHintButton);
|
193
193
|
expect(screen.getByText(hintText)).toBeInTheDocument();
|
194
|
+
});
|
195
|
+
test('should have clear button if hasClearButton prop is true', function () {
|
196
|
+
getComponent({
|
197
|
+
selectedKey: 'a',
|
198
|
+
hasClearButton: true,
|
199
|
+
clearButtonProps: {
|
200
|
+
'data-testid': 'clear-button'
|
201
|
+
}
|
202
|
+
});
|
203
|
+
var clearButton = screen.getByTestId('clear-button');
|
204
|
+
expect(clearButton).toBeInTheDocument();
|
194
205
|
});
|
@@ -9,22 +9,17 @@ import _Object$defineProperty from "@babel/runtime-corejs3/core-js-stable/object
|
|
9
9
|
import _defineProperty from "@babel/runtime-corejs3/helpers/esm/defineProperty";
|
10
10
|
import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
|
11
11
|
import _objectWithoutProperties from "@babel/runtime-corejs3/helpers/esm/objectWithoutProperties";
|
12
|
-
var _excluded = ["columnStyleProps", "defaultText", "fieldContainerProps", "fieldControlInputProps", "fieldControlWrapperProps", "fieldLabelProps", "helperText", "isLoadingInitial", "isDisabled", "label", "labelMode", "name", "overlay", "placeholder", "slots", "state", "status", "trigger", "triggerProps", "triggerRef", "valueProps", "selectProps"];
|
12
|
+
var _excluded = ["columnStyleProps", "defaultText", "fieldContainerProps", "fieldControlInputProps", "fieldControlWrapperProps", "fieldLabelProps", "helperText", "isLoadingInitial", "isDisabled", "label", "labelMode", "name", "overlay", "placeholder", "slots", "state", "status", "trigger", "triggerProps", "triggerRef", "valueProps", "selectProps", "hasClearButton", "clearButtonProps", "onClear"];
|
13
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
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; }
|
15
15
|
import React, { forwardRef, useMemo } from 'react';
|
16
|
+
import CloseIcon from '@pingux/mdi-react/CloseIcon';
|
16
17
|
import { v4 as uuid } from 'uuid';
|
18
|
+
import { Box, Button, FieldHelperText, Icon, IconButton, Label, Loader, Text } from '../..';
|
17
19
|
import useGetTheme from '../../hooks/useGetTheme';
|
18
20
|
import { modes } from '../../utils/devUtils/constants/labelModes';
|
19
21
|
import { getPendoID } from '../../utils/devUtils/constants/pendoID';
|
20
22
|
import { getAriaAttributeProps } from '../../utils/docUtils/ariaAttributes';
|
21
|
-
import Box from '../Box';
|
22
|
-
import Button from '../Button';
|
23
|
-
import FieldHelperText from '../FieldHelperText';
|
24
|
-
import Icon from '../Icon';
|
25
|
-
import Label from '../Label';
|
26
|
-
import Loader from '../Loader';
|
27
|
-
import Text from '../Text';
|
28
23
|
import { HiddenSelect } from './HiddenSelect';
|
29
24
|
|
30
25
|
/**
|
@@ -58,6 +53,9 @@ var SelectFieldBase = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
58
53
|
triggerRef = props.triggerRef,
|
59
54
|
valueProps = props.valueProps,
|
60
55
|
selectProps = props.selectProps,
|
56
|
+
hasClearButton = props.hasClearButton,
|
57
|
+
clearButtonProps = props.clearButtonProps,
|
58
|
+
onClear = props.onClear,
|
61
59
|
others = _objectWithoutProperties(props, _excluded);
|
62
60
|
var _getAriaAttributeProp = getAriaAttributeProps(others),
|
63
61
|
ariaProps = _getAriaAttributeProp.ariaProps;
|
@@ -68,7 +66,40 @@ var SelectFieldBase = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
68
66
|
var helperTextId = useMemo(function () {
|
69
67
|
return uuid();
|
70
68
|
}, []);
|
71
|
-
var
|
69
|
+
var handleOnClear = function handleOnClear() {
|
70
|
+
if (onClear) {
|
71
|
+
onClear();
|
72
|
+
}
|
73
|
+
state.setSelectedKey(null);
|
74
|
+
};
|
75
|
+
var buttonRendered = !(hasClearButton && state.selectedKey) && ___EmotionJSX(Box, {
|
76
|
+
as: "span",
|
77
|
+
"aria-hidden": "true",
|
78
|
+
variant: "forms.select.arrow"
|
79
|
+
}, ___EmotionJSX(Icon, {
|
80
|
+
icon: state.isOpen ? MenuUp : MenuDown,
|
81
|
+
title: {
|
82
|
+
name: 'Menu down'
|
83
|
+
},
|
84
|
+
size: "md"
|
85
|
+
}));
|
86
|
+
var clearButton = hasClearButton && state.selectedKey && ___EmotionJSX(IconButton, _extends({
|
87
|
+
tabIndex: 0,
|
88
|
+
as: "span",
|
89
|
+
role: "button",
|
90
|
+
"aria-label": "Clear selection",
|
91
|
+
variant: "clearSelectionButton",
|
92
|
+
onPress: handleOnClear,
|
93
|
+
color: "text.secondary"
|
94
|
+
}, clearButtonProps), ___EmotionJSX(Icon, {
|
95
|
+
icon: CloseIcon,
|
96
|
+
title: {
|
97
|
+
name: 'Clear selection Icon'
|
98
|
+
}
|
99
|
+
}));
|
100
|
+
var defaultTrigger = ___EmotionJSX(Box, _extends({
|
101
|
+
isRow: true
|
102
|
+
}, fieldControlWrapperProps, {
|
72
103
|
variant: "forms.input.fieldControlWrapper"
|
73
104
|
}), ___EmotionJSX(Button, _extends({
|
74
105
|
className: fieldControlInputProps.className,
|
@@ -83,17 +114,7 @@ var SelectFieldBase = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
83
114
|
variant: "placeholder"
|
84
115
|
}, labelMode === modes.FLOAT ? '' : placeholder || defaultText)), isLoadingInitial && ___EmotionJSX(Loader, {
|
85
116
|
variant: "loader.withinInput"
|
86
|
-
}),
|
87
|
-
as: "span",
|
88
|
-
"aria-hidden": "true",
|
89
|
-
variant: "forms.select.arrow"
|
90
|
-
}, ___EmotionJSX(Icon, {
|
91
|
-
icon: state.isOpen ? MenuUp : MenuDown,
|
92
|
-
title: {
|
93
|
-
name: 'Menu down'
|
94
|
-
},
|
95
|
-
size: "md"
|
96
|
-
}))), slots === null || slots === void 0 ? void 0 : slots.inContainer);
|
117
|
+
}), buttonRendered), clearButton, slots === null || slots === void 0 ? void 0 : slots.inContainer);
|
97
118
|
return ___EmotionJSX(Box, _extends({
|
98
119
|
ref: ref,
|
99
120
|
variant: "forms.input.fieldContainer"
|