@carbon/ibm-products 2.25.0 → 2.27.0
Sign up to get free protection for your applications and to get access to all the features.
- package/css/index-full-carbon.css +556 -63
- package/css/index-full-carbon.css.map +1 -1
- package/css/index-full-carbon.min.css +1 -1
- package/css/index-full-carbon.min.css.map +1 -1
- package/css/index-without-carbon-released-only.css +50 -16
- package/css/index-without-carbon-released-only.css.map +1 -1
- package/css/index-without-carbon-released-only.min.css +1 -1
- package/css/index-without-carbon-released-only.min.css.map +1 -1
- package/css/index-without-carbon.css +556 -63
- package/css/index-without-carbon.css.map +1 -1
- package/css/index-without-carbon.min.css +1 -1
- package/css/index-without-carbon.min.css.map +1 -1
- package/css/index.css +527 -55
- package/css/index.css.map +1 -1
- package/css/index.min.css +1 -1
- package/css/index.min.css.map +1 -1
- package/es/components/BigNumbers/BigNumbers.d.ts +11 -0
- package/es/components/BigNumbers/BigNumbers.js +238 -0
- package/es/components/BigNumbers/constants.d.ts +13 -0
- package/es/components/BigNumbers/constants.js +67 -0
- package/es/components/BigNumbers/index.d.ts +1 -0
- package/es/components/Cascade/Cascade.d.ts +19 -2
- package/es/components/Cascade/Cascade.js +12 -9
- package/es/components/Coachmark/CoachmarkTagline.js +1 -2
- package/es/components/CoachmarkStack/CoachmarkStackHome.js +1 -1
- package/es/components/DataSpreadsheet/DataSpreadsheetBody.js +4 -3
- package/es/components/DataSpreadsheet/DataSpreadsheetHeader.js +3 -2
- package/es/components/DataSpreadsheet/utils/checkForHoldingKey.d.ts +1 -0
- package/es/components/DataSpreadsheet/utils/checkForHoldingKey.js +17 -0
- package/es/components/Datagrid/Datagrid/Datagrid.js +9 -2
- package/es/components/Datagrid/Datagrid/DatagridContent.d.ts +3 -1
- package/es/components/Datagrid/Datagrid/DatagridContent.js +6 -2
- package/es/components/Datagrid/Datagrid/DatagridHeaderRow.js +21 -8
- package/es/components/Datagrid/Datagrid/DatagridRow.js +15 -2
- package/es/components/Datagrid/Datagrid/DatagridToolbar.d.ts +10 -1
- package/es/components/Datagrid/Datagrid/DatagridToolbar.js +21 -4
- package/es/components/Datagrid/Datagrid/addons/Filtering/FilterProvider.js +32 -9
- package/es/components/Datagrid/Datagrid/addons/Filtering/constants.d.ts +3 -1
- package/es/components/Datagrid/Datagrid/addons/Filtering/constants.js +4 -1
- package/es/components/Datagrid/Datagrid/addons/Filtering/hooks/useFilters.js +35 -3
- package/es/components/Datagrid/Datagrid/addons/Slug/DatagridSlug.d.ts +2 -0
- package/es/components/Datagrid/Datagrid/addons/Slug/{ColumnHeaderSlug.js → DatagridSlug.js} +4 -4
- package/es/components/Datagrid/Datagrid/addons/stateReducer.js +3 -3
- package/es/components/Datagrid/useSelectAllToggle.js +5 -3
- package/es/components/Datagrid/useSortableColumns.js +2 -2
- package/es/components/EmptyStates/EmptyStateContent.d.ts +1 -1
- package/es/components/FullPageError/FullPageError.js +41 -15
- package/es/components/FullPageError/assets/Error403SVG.d.ts +9 -0
- package/es/components/FullPageError/assets/Error403SVG.js +714 -0
- package/es/components/FullPageError/assets/Error404SVG.d.ts +9 -0
- package/es/components/FullPageError/assets/Error404SVG.js +623 -0
- package/es/components/HTTPErrors/HTTPErrorContent.d.ts +1 -1
- package/es/components/InterstitialScreen/InterstitialScreen.js +1 -1
- package/es/components/SidePanel/SidePanel.js +13 -6
- package/es/components/SidePanel/motion/variants.d.ts +39 -12
- package/es/components/SidePanel/motion/variants.js +42 -11
- package/es/components/StringFormatter/StringFormatter.d.ts +6 -0
- package/es/components/StringFormatter/StringFormatter.js +79 -0
- package/es/components/StringFormatter/index.d.ts +1 -0
- package/es/components/StringFormatter/utils/enums.d.ts +14 -0
- package/es/components/StringFormatter/utils/enums.js +23 -0
- package/es/components/Tearsheet/TearsheetShell.js +26 -8
- package/es/components/UserAvatar/UserAvatar.js +59 -44
- package/es/components/index.d.ts +2 -0
- package/es/global/js/hooks/index.d.ts +2 -0
- package/es/global/js/hooks/useFocus.d.ts +11 -0
- package/es/global/js/hooks/useFocus.js +76 -0
- package/es/global/js/hooks/useIsomorphicEffect.d.ts +2 -0
- package/es/global/js/hooks/useIsomorphicEffect.js +14 -0
- package/es/global/js/package-settings.d.ts +2 -0
- package/es/global/js/package-settings.js +2 -0
- package/es/index.js +2 -0
- package/es/settings.d.ts +2 -0
- package/lib/components/BigNumbers/BigNumbers.d.ts +11 -0
- package/lib/components/BigNumbers/BigNumbers.js +244 -0
- package/lib/components/BigNumbers/constants.d.ts +13 -0
- package/lib/components/BigNumbers/constants.js +76 -0
- package/lib/components/BigNumbers/index.d.ts +1 -0
- package/lib/components/Cascade/Cascade.d.ts +19 -2
- package/lib/components/Cascade/Cascade.js +12 -9
- package/lib/components/Coachmark/CoachmarkTagline.js +3 -4
- package/lib/components/CoachmarkStack/CoachmarkStackHome.js +2 -2
- package/lib/components/DataSpreadsheet/DataSpreadsheetBody.js +4 -3
- package/lib/components/DataSpreadsheet/DataSpreadsheetHeader.js +3 -2
- package/lib/components/DataSpreadsheet/utils/checkForHoldingKey.d.ts +1 -0
- package/lib/components/DataSpreadsheet/utils/checkForHoldingKey.js +21 -0
- package/lib/components/Datagrid/Datagrid/Datagrid.js +9 -2
- package/lib/components/Datagrid/Datagrid/DatagridContent.d.ts +3 -1
- package/lib/components/Datagrid/Datagrid/DatagridContent.js +6 -2
- package/lib/components/Datagrid/Datagrid/DatagridHeaderRow.js +20 -7
- package/lib/components/Datagrid/Datagrid/DatagridRow.js +14 -1
- package/lib/components/Datagrid/Datagrid/DatagridToolbar.d.ts +10 -1
- package/lib/components/Datagrid/Datagrid/DatagridToolbar.js +20 -3
- package/lib/components/Datagrid/Datagrid/addons/Filtering/FilterProvider.js +30 -7
- package/lib/components/Datagrid/Datagrid/addons/Filtering/constants.d.ts +3 -1
- package/lib/components/Datagrid/Datagrid/addons/Filtering/constants.js +4 -0
- package/lib/components/Datagrid/Datagrid/addons/Filtering/hooks/useFilters.js +33 -1
- package/lib/components/Datagrid/Datagrid/addons/Slug/DatagridSlug.d.ts +2 -0
- package/lib/components/Datagrid/Datagrid/addons/Slug/{ColumnHeaderSlug.js → DatagridSlug.js} +4 -4
- package/lib/components/Datagrid/Datagrid/addons/stateReducer.js +3 -3
- package/lib/components/Datagrid/useSelectAllToggle.js +4 -2
- package/lib/components/Datagrid/useSortableColumns.js +2 -2
- package/lib/components/EmptyStates/EmptyStateContent.d.ts +1 -1
- package/lib/components/FullPageError/FullPageError.js +41 -15
- package/lib/components/FullPageError/assets/Error403SVG.d.ts +9 -0
- package/lib/components/FullPageError/assets/Error403SVG.js +722 -0
- package/lib/components/FullPageError/assets/Error404SVG.d.ts +9 -0
- package/lib/components/FullPageError/assets/Error404SVG.js +631 -0
- package/lib/components/HTTPErrors/HTTPErrorContent.d.ts +1 -1
- package/lib/components/InterstitialScreen/InterstitialScreen.js +3 -3
- package/lib/components/SidePanel/SidePanel.js +11 -4
- package/lib/components/SidePanel/motion/variants.d.ts +39 -12
- package/lib/components/SidePanel/motion/variants.js +42 -10
- package/lib/components/StringFormatter/StringFormatter.d.ts +6 -0
- package/lib/components/StringFormatter/StringFormatter.js +85 -0
- package/lib/components/StringFormatter/index.d.ts +1 -0
- package/lib/components/StringFormatter/utils/enums.d.ts +14 -0
- package/lib/components/StringFormatter/utils/enums.js +27 -0
- package/lib/components/Tearsheet/TearsheetShell.js +26 -8
- package/lib/components/UserAvatar/UserAvatar.js +59 -44
- package/lib/components/index.d.ts +2 -0
- package/lib/global/js/hooks/index.d.ts +2 -0
- package/lib/global/js/hooks/useFocus.d.ts +11 -0
- package/lib/global/js/hooks/useFocus.js +80 -0
- package/lib/global/js/hooks/useIsomorphicEffect.d.ts +2 -0
- package/lib/global/js/hooks/useIsomorphicEffect.js +18 -0
- package/lib/global/js/package-settings.d.ts +2 -0
- package/lib/global/js/package-settings.js +2 -0
- package/lib/index.js +10 -0
- package/lib/settings.d.ts +2 -0
- package/package.json +7 -7
- package/scss/components/BigNumbers/_big-numbers.scss +151 -0
- package/scss/components/BigNumbers/_carbon-imports.scss +11 -0
- package/scss/components/BigNumbers/_index-with-carbon.scss +9 -0
- package/scss/components/BigNumbers/_index.scss +8 -0
- package/scss/components/Datagrid/styles/_datagrid.scss +19 -0
- package/scss/components/FilterSummary/_filter-summary.scss +1 -1
- package/scss/components/FullPageError/_full-page-error.scss +20 -2
- package/scss/components/ProductiveCard/_productive-card.scss +1 -1
- package/scss/components/SidePanel/_side-panel.scss +1 -1
- package/scss/components/StringFormatter/_carbon-imports.scss +10 -0
- package/scss/components/StringFormatter/_index-with-carbon.scss +9 -0
- package/scss/components/StringFormatter/_index.scss +8 -0
- package/scss/components/StringFormatter/_string-formatter.scss +97 -0
- package/scss/components/Tearsheet/_tearsheet.scss +34 -2
- package/scss/components/UserAvatar/_user-avatar.scss +47 -4
- package/scss/components/_index-with-carbon.scss +2 -0
- package/scss/components/_index.scss +2 -0
- package/es/components/Datagrid/Datagrid/addons/Slug/ColumnHeaderSlug.d.ts +0 -2
- package/es/node_modules/@carbon/icon-helpers/es/index.js +0 -140
- package/es/node_modules/@carbon/icons-react/es/Icon.js +0 -73
- package/es/node_modules/@carbon/icons-react/es/generated/bucket-0.js +0 -2985
- package/es/node_modules/@carbon/icons-react/es/generated/bucket-3.js +0 -2900
- package/es/node_modules/@carbon/icons-react/es/generated/bucket-8.js +0 -3004
- package/es/node_modules/@carbon/icons-react/es/iconPropTypes-4cbeb95d.js +0 -14
- package/lib/components/Datagrid/Datagrid/addons/Slug/ColumnHeaderSlug.d.ts +0 -2
- package/lib/node_modules/@carbon/icon-helpers/es/index.js +0 -145
- package/lib/node_modules/@carbon/icons-react/es/Icon.js +0 -81
- package/lib/node_modules/@carbon/icons-react/es/generated/bucket-0.js +0 -3117
- package/lib/node_modules/@carbon/icons-react/es/generated/bucket-3.js +0 -3032
- package/lib/node_modules/@carbon/icons-react/es/generated/bucket-8.js +0 -3136
- package/lib/node_modules/@carbon/icons-react/es/iconPropTypes-4cbeb95d.js +0 -18
@@ -93,6 +93,22 @@ $motion-duration: $duration-moderate-02;
|
|
93
93
|
transform: translate3d(0, calc(min(95vh, 500px)), 0);
|
94
94
|
}
|
95
95
|
|
96
|
+
&.#{$block-class}.#{$block-class}.#{$block-class}.#{$block-class}--has-slug
|
97
|
+
.#{$block-class}__container {
|
98
|
+
border: 1px solid transparent;
|
99
|
+
/* override carbon ai removing background gradient */
|
100
|
+
background: linear-gradient(to top, var(--cds-layer), var(--cds-layer))
|
101
|
+
padding-box,
|
102
|
+
linear-gradient(
|
103
|
+
to bottom,
|
104
|
+
var(--cds-ai-border-start, #78a9ff),
|
105
|
+
var(--cds-ai-border-end, #d0e2ff)
|
106
|
+
)
|
107
|
+
border-box,
|
108
|
+
linear-gradient(to top, var(--cds-layer), var(--cds-layer)) border-box;
|
109
|
+
box-shadow: 0 4px 10px 2px $ai-drop-shadow;
|
110
|
+
}
|
111
|
+
|
96
112
|
// extra specificity to ensure this transition overrides the carbon default
|
97
113
|
&.#{$block-class}.#{$block-class} .#{$block-class}__container {
|
98
114
|
transition: transform $motion-duration motion(entrance, expressive),
|
@@ -223,8 +239,14 @@ $motion-duration: $duration-moderate-02;
|
|
223
239
|
}
|
224
240
|
|
225
241
|
&.#{$block-class}--wide
|
242
|
+
.#{$block-class}__header.#{$block-class}__header--with-close-icon,
|
243
|
+
&.#{$block-class}--has-slug .#{$block-class}__header.#{$block-class}__header {
|
244
|
+
padding-right: $spacing-11;
|
245
|
+
}
|
246
|
+
|
247
|
+
&.#{$block-class}--wide.#{$block-class}--has-slug
|
226
248
|
.#{$block-class}__header.#{$block-class}__header--with-close-icon {
|
227
|
-
|
249
|
+
margin-right: $spacing-09;
|
228
250
|
}
|
229
251
|
|
230
252
|
&.#{$block-class}--narrow .#{$block-class}__header-description {
|
@@ -292,6 +314,10 @@ $motion-duration: $duration-moderate-02;
|
|
292
314
|
flex-grow: 1;
|
293
315
|
}
|
294
316
|
|
317
|
+
&.#{$block-class}--has-slug .#{$block-class}__main {
|
318
|
+
@include utilities.callout-gradient('default', 0);
|
319
|
+
}
|
320
|
+
|
295
321
|
&.#{$block-class}--wide .#{$block-class}__content {
|
296
322
|
// Revert background color overridden by Carbon's modal - https://github.com/carbon-design-system/carbon/blob/main/packages/styles/scss/components/modal/_modal.scss#L54
|
297
323
|
.#{$carbon-prefix}--pagination,
|
@@ -320,7 +346,8 @@ $motion-duration: $duration-moderate-02;
|
|
320
346
|
.#{$carbon-prefix}--dropdown--light .#{$carbon-prefix}--dropdown-list,
|
321
347
|
/* stylelint-disable-next-line prettier/prettier */
|
322
348
|
.#{$carbon-prefix}--number--light input[type='number'],
|
323
|
-
.#{$carbon-prefix}--date-picker--light
|
349
|
+
.#{$carbon-prefix}--date-picker--light
|
350
|
+
.#{$carbon-prefix}--date-picker__input {
|
324
351
|
background-color: $field-02;
|
325
352
|
}
|
326
353
|
}
|
@@ -340,4 +367,9 @@ $motion-duration: $duration-moderate-02;
|
|
340
367
|
&.#{$block-class}--wide .#{$block-class}__buttons {
|
341
368
|
background: $background;
|
342
369
|
}
|
370
|
+
|
371
|
+
&.#{$block-class}--has-slug:not(.#{$block-class}--has-close)
|
372
|
+
.#{$carbon-prefix}--slug {
|
373
|
+
inset-inline-end: 0;
|
374
|
+
}
|
343
375
|
}
|
@@ -10,6 +10,8 @@
|
|
10
10
|
@use '../../global/styles/mixins';
|
11
11
|
@use '@carbon/colors' as *;
|
12
12
|
@use '@carbon/styles/scss/theme' as *;
|
13
|
+
@use '@carbon/styles/scss/spacing' as *;
|
14
|
+
@use '@carbon/styles/scss/type';
|
13
15
|
|
14
16
|
// Other Carbon settings if needed
|
15
17
|
// TODO: @use '@carbon/styles/scss/grid';
|
@@ -23,7 +25,22 @@
|
|
23
25
|
|
24
26
|
$block-class: #{$pkg-prefix}--user-avatar;
|
25
27
|
|
28
|
+
$sizes: (
|
29
|
+
xl: $spacing-10,
|
30
|
+
lg: $spacing-09,
|
31
|
+
md: $spacing-07,
|
32
|
+
sm: $spacing-06,
|
33
|
+
);
|
34
|
+
|
35
|
+
@mixin size($size) {
|
36
|
+
$_size: map-get($sizes, $size);
|
37
|
+
|
38
|
+
width: $_size;
|
39
|
+
height: $_size;
|
40
|
+
}
|
41
|
+
|
26
42
|
.#{$block-class} {
|
43
|
+
position: relative;
|
27
44
|
display: flex;
|
28
45
|
width: 4rem;
|
29
46
|
height: 4rem;
|
@@ -31,20 +48,27 @@ $block-class: #{$pkg-prefix}--user-avatar;
|
|
31
48
|
justify-content: center;
|
32
49
|
border: 0.5px solid transparent;
|
33
50
|
border-radius: 100%;
|
51
|
+
color: $text-inverse;
|
34
52
|
outline: none;
|
35
53
|
outline-offset: 3px;
|
36
54
|
}
|
37
55
|
|
38
|
-
|
39
|
-
|
40
|
-
|
56
|
+
.#{$block-class} svg {
|
57
|
+
color: $icon-inverse;
|
58
|
+
}
|
41
59
|
|
42
|
-
|
60
|
+
.#{$block-class}__tooltip {
|
61
|
+
&:focus-within .#{$block-class} {
|
43
62
|
// stylelint-disable-next-line carbon/theme-token-use
|
44
63
|
outline: 2px solid $focus;
|
45
64
|
}
|
46
65
|
}
|
47
66
|
|
67
|
+
@mixin setBgColor($color) {
|
68
|
+
// stylelint-disable-next-line carbon/theme-token-use
|
69
|
+
background-color: $color;
|
70
|
+
}
|
71
|
+
|
48
72
|
.#{$block-class}--light-cyan {
|
49
73
|
@include setBgColor($cyan-50);
|
50
74
|
}
|
@@ -52,3 +76,22 @@ $block-class: #{$pkg-prefix}--user-avatar;
|
|
52
76
|
.#{$block-class}--dark-cyan {
|
53
77
|
@include setBgColor($cyan-60);
|
54
78
|
}
|
79
|
+
.#{$block-class}--xl {
|
80
|
+
@include size('xl');
|
81
|
+
@include type.type-style('heading-04');
|
82
|
+
}
|
83
|
+
|
84
|
+
.#{$block-class}--lg {
|
85
|
+
@include size('lg');
|
86
|
+
@include type.type-style('heading-03');
|
87
|
+
}
|
88
|
+
|
89
|
+
.#{$block-class}--md {
|
90
|
+
@include size('md');
|
91
|
+
@include type.type-style('body-compact-01');
|
92
|
+
}
|
93
|
+
|
94
|
+
.#{$block-class}--sm {
|
95
|
+
@include size('sm');
|
96
|
+
@include type.type-style('label-01');
|
97
|
+
}
|
@@ -47,6 +47,7 @@
|
|
47
47
|
@use './Datagrid/index-with-carbon' as *;
|
48
48
|
@use './EditUpdateCards/index-with-carbon' as *;
|
49
49
|
@use './SimpleHeader/index-with-carbon' as *;
|
50
|
+
@use './BigNumbers/index-with-carbon' as *;
|
50
51
|
@use './TruncatedList/index-with-carbon' as *;
|
51
52
|
@use './InterstitialScreen/index-with-carbon' as *;
|
52
53
|
@use './InterstitialScreenView/index-with-carbon' as *;
|
@@ -61,4 +62,5 @@
|
|
61
62
|
@use './DelimitedList/index-with-carbon' as *;
|
62
63
|
@use './FullPageError/index-with-carbon' as *;
|
63
64
|
@use './SearchBar/index-with-carbon' as *;
|
65
|
+
@use './StringFormatter/index-with-carbon' as *;
|
64
66
|
@use './UserAvatar/index-with-carbon' as *;
|
@@ -62,6 +62,7 @@
|
|
62
62
|
@use './Guidebanner';
|
63
63
|
@use './InlineTip';
|
64
64
|
@use './NonLinearReading';
|
65
|
+
@use './BigNumbers';
|
65
66
|
@use './TruncatedList';
|
66
67
|
@use './InterstitialScreen';
|
67
68
|
@use './InterstitialScreenView';
|
@@ -69,4 +70,5 @@
|
|
69
70
|
@use './DelimitedList';
|
70
71
|
@use './FullPageError';
|
71
72
|
@use './SearchBar';
|
73
|
+
@use './StringFormatter';
|
72
74
|
@use './UserAvatar';
|
@@ -1,140 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* Copyright IBM Corp. 2020, 2024
|
3
|
-
*
|
4
|
-
* This source code is licensed under the Apache-2.0 license found in the
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
6
|
-
*/
|
7
|
-
|
8
|
-
import { typeof as _typeof } from '../../../../_virtual/_rollupPluginBabelHelpers.js';
|
9
|
-
|
10
|
-
function ownKeys(object, enumerableOnly) {
|
11
|
-
var keys = Object.keys(object);
|
12
|
-
if (Object.getOwnPropertySymbols) {
|
13
|
-
var symbols = Object.getOwnPropertySymbols(object);
|
14
|
-
enumerableOnly && (symbols = symbols.filter(function (sym) {
|
15
|
-
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
16
|
-
})), keys.push.apply(keys, symbols);
|
17
|
-
}
|
18
|
-
return keys;
|
19
|
-
}
|
20
|
-
function _objectSpread2(target) {
|
21
|
-
for (var i = 1; i < arguments.length; i++) {
|
22
|
-
var source = null != arguments[i] ? arguments[i] : {};
|
23
|
-
i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
|
24
|
-
_defineProperty(target, key, source[key]);
|
25
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
|
26
|
-
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
27
|
-
});
|
28
|
-
}
|
29
|
-
return target;
|
30
|
-
}
|
31
|
-
function _defineProperty(obj, key, value) {
|
32
|
-
key = _toPropertyKey(key);
|
33
|
-
if (key in obj) {
|
34
|
-
Object.defineProperty(obj, key, {
|
35
|
-
value: value,
|
36
|
-
enumerable: true,
|
37
|
-
configurable: true,
|
38
|
-
writable: true
|
39
|
-
});
|
40
|
-
} else {
|
41
|
-
obj[key] = value;
|
42
|
-
}
|
43
|
-
return obj;
|
44
|
-
}
|
45
|
-
function _objectWithoutPropertiesLoose(source, excluded) {
|
46
|
-
if (source == null) return {};
|
47
|
-
var target = {};
|
48
|
-
var sourceKeys = Object.keys(source);
|
49
|
-
var key, i;
|
50
|
-
for (i = 0; i < sourceKeys.length; i++) {
|
51
|
-
key = sourceKeys[i];
|
52
|
-
if (excluded.indexOf(key) >= 0) continue;
|
53
|
-
target[key] = source[key];
|
54
|
-
}
|
55
|
-
return target;
|
56
|
-
}
|
57
|
-
function _objectWithoutProperties(source, excluded) {
|
58
|
-
if (source == null) return {};
|
59
|
-
var target = _objectWithoutPropertiesLoose(source, excluded);
|
60
|
-
var key, i;
|
61
|
-
if (Object.getOwnPropertySymbols) {
|
62
|
-
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
63
|
-
for (i = 0; i < sourceSymbolKeys.length; i++) {
|
64
|
-
key = sourceSymbolKeys[i];
|
65
|
-
if (excluded.indexOf(key) >= 0) continue;
|
66
|
-
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
67
|
-
target[key] = source[key];
|
68
|
-
}
|
69
|
-
}
|
70
|
-
return target;
|
71
|
-
}
|
72
|
-
function _toPrimitive(input, hint) {
|
73
|
-
if (_typeof(input) !== "object" || input === null) return input;
|
74
|
-
var prim = input[Symbol.toPrimitive];
|
75
|
-
if (prim !== undefined) {
|
76
|
-
var res = prim.call(input, hint || "default");
|
77
|
-
if (_typeof(res) !== "object") return res;
|
78
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
79
|
-
}
|
80
|
-
return (hint === "string" ? String : Number)(input);
|
81
|
-
}
|
82
|
-
function _toPropertyKey(arg) {
|
83
|
-
var key = _toPrimitive(arg, "string");
|
84
|
-
return _typeof(key) === "symbol" ? key : String(key);
|
85
|
-
}
|
86
|
-
var _excluded = ["width", "height", "viewBox"],
|
87
|
-
_excluded2 = ["tabindex"];
|
88
|
-
/**
|
89
|
-
* Copyright IBM Corp. 2018, 2024
|
90
|
-
*
|
91
|
-
* This source code is licensed under the Apache-2.0 license found in the
|
92
|
-
* LICENSE file in the root directory of this source tree.
|
93
|
-
*/
|
94
|
-
|
95
|
-
var defaultAttributes = {
|
96
|
-
// Reference:
|
97
|
-
// https://github.com/IBM/carbon-components-react/issues/1392
|
98
|
-
// https://github.com/PolymerElements/iron-iconset-svg/pull/47
|
99
|
-
// `focusable` is a string attribute which is why we do not use a boolean here
|
100
|
-
focusable: 'false',
|
101
|
-
preserveAspectRatio: 'xMidYMid meet'
|
102
|
-
};
|
103
|
-
|
104
|
-
/**
|
105
|
-
* Get supplementary HTML attributes for a given <svg> element based on existing
|
106
|
-
* attributes.
|
107
|
-
*/
|
108
|
-
function getAttributes() {
|
109
|
-
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
110
|
-
width = _ref.width,
|
111
|
-
height = _ref.height,
|
112
|
-
_ref$viewBox = _ref.viewBox,
|
113
|
-
viewBox = _ref$viewBox === void 0 ? "0 0 ".concat(width, " ").concat(height) : _ref$viewBox,
|
114
|
-
attributes = _objectWithoutProperties(_ref, _excluded);
|
115
|
-
var tabindex = attributes.tabindex,
|
116
|
-
rest = _objectWithoutProperties(attributes, _excluded2);
|
117
|
-
var iconAttributes = _objectSpread2(_objectSpread2(_objectSpread2({}, defaultAttributes), rest), {}, {
|
118
|
-
width: width,
|
119
|
-
height: height,
|
120
|
-
viewBox: viewBox
|
121
|
-
});
|
122
|
-
|
123
|
-
// TODO: attributes.title assumes that the consumer will implement <title> and
|
124
|
-
// correctly set `aria-labelledby`.
|
125
|
-
if (iconAttributes['aria-label'] || iconAttributes['aria-labelledby'] || iconAttributes.title) {
|
126
|
-
iconAttributes.role = 'img';
|
127
|
-
|
128
|
-
// Reference:
|
129
|
-
// https://allyjs.io/tutorials/focusing-in-svg.html
|
130
|
-
if (tabindex !== undefined && tabindex !== null) {
|
131
|
-
iconAttributes.focusable = 'true';
|
132
|
-
iconAttributes.tabindex = tabindex;
|
133
|
-
}
|
134
|
-
} else {
|
135
|
-
iconAttributes['aria-hidden'] = true;
|
136
|
-
}
|
137
|
-
return iconAttributes;
|
138
|
-
}
|
139
|
-
|
140
|
-
export { defaultAttributes, getAttributes };
|
@@ -1,73 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* Copyright IBM Corp. 2020, 2024
|
3
|
-
*
|
4
|
-
* This source code is licensed under the Apache-2.0 license found in the
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
6
|
-
*/
|
7
|
-
|
8
|
-
import { objectWithoutProperties as _objectWithoutProperties, objectSpread2 as _objectSpread2 } from '../../../../_virtual/_rollupPluginBabelHelpers.js';
|
9
|
-
import { getAttributes } from '../../icon-helpers/es/index.js';
|
10
|
-
import PropTypes from '../../../prop-types/index.js';
|
11
|
-
import React__default from 'react';
|
12
|
-
|
13
|
-
var _excluded = ["className", "children", "tabIndex", "xmlns", "preserveAspectRatio"],
|
14
|
-
_excluded2 = ["tabindex"];
|
15
|
-
|
16
|
-
/**
|
17
|
-
* Copyright IBM Corp. 2019, 2023
|
18
|
-
*
|
19
|
-
* This source code is licensed under the Apache-2.0 license found in the
|
20
|
-
* LICENSE file in the root directory of this source tree.
|
21
|
-
*/
|
22
|
-
var Icon = /*#__PURE__*/React__default.forwardRef(function Icon(_ref, ref) {
|
23
|
-
var className = _ref.className,
|
24
|
-
children = _ref.children,
|
25
|
-
tabIndex = _ref.tabIndex,
|
26
|
-
_ref$xmlns = _ref.xmlns,
|
27
|
-
xmlns = _ref$xmlns === void 0 ? 'http://www.w3.org/2000/svg' : _ref$xmlns,
|
28
|
-
_ref$preserveAspectRa = _ref.preserveAspectRatio,
|
29
|
-
preserveAspectRatio = _ref$preserveAspectRa === void 0 ? 'xMidYMid meet' : _ref$preserveAspectRa,
|
30
|
-
rest = _objectWithoutProperties(_ref, _excluded);
|
31
|
-
var _getAttributes = getAttributes(_objectSpread2(_objectSpread2({}, rest), {}, {
|
32
|
-
tabindex: tabIndex
|
33
|
-
})),
|
34
|
-
tabindex = _getAttributes.tabindex,
|
35
|
-
attrs = _objectWithoutProperties(_getAttributes, _excluded2);
|
36
|
-
var props = attrs;
|
37
|
-
if (className) {
|
38
|
-
props.className = className;
|
39
|
-
}
|
40
|
-
if (tabindex !== undefined && tabindex !== null) {
|
41
|
-
if (typeof tabindex === 'number') {
|
42
|
-
props.tabIndex = tabindex;
|
43
|
-
} else {
|
44
|
-
props.tabIndex = Number(tabIndex);
|
45
|
-
}
|
46
|
-
}
|
47
|
-
if (ref) {
|
48
|
-
props.ref = ref;
|
49
|
-
}
|
50
|
-
if (xmlns) {
|
51
|
-
props.xmlns = xmlns;
|
52
|
-
}
|
53
|
-
if (preserveAspectRatio) {
|
54
|
-
props.preserveAspectRatio = preserveAspectRatio;
|
55
|
-
}
|
56
|
-
return /*#__PURE__*/React__default.createElement('svg', props, children);
|
57
|
-
});
|
58
|
-
Icon.displayName = 'Icon';
|
59
|
-
Icon.propTypes = {
|
60
|
-
'aria-hidden': PropTypes.oneOfType([PropTypes.bool, PropTypes.oneOf(['true', 'false'])]),
|
61
|
-
'aria-label': PropTypes.string,
|
62
|
-
'aria-labelledby': PropTypes.string,
|
63
|
-
children: PropTypes.node,
|
64
|
-
className: PropTypes.string,
|
65
|
-
height: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
66
|
-
preserveAspectRatio: PropTypes.string,
|
67
|
-
tabIndex: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
68
|
-
viewBox: PropTypes.string,
|
69
|
-
width: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
70
|
-
xmlns: PropTypes.string
|
71
|
-
};
|
72
|
-
|
73
|
-
export { Icon as default };
|