@carbon-labs/react-animated-header 0.21.0 → 0.22.0

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.
@@ -1,16 +0,0 @@
1
- /**
2
- * Copyright IBM Corp. 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
- 'use strict';
9
-
10
- var PropTypes = require('prop-types');
11
-
12
- const iconPropTypes = {
13
- size: PropTypes.oneOfType([PropTypes.number, PropTypes.string])
14
- };
15
-
16
- exports.i = iconPropTypes;
@@ -1,128 +0,0 @@
1
- /**
2
- * Copyright IBM Corp. 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
- 'use strict';
9
-
10
- function _defineProperty(e, r, t) {
11
- return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
12
- value: t,
13
- enumerable: !0,
14
- configurable: !0,
15
- writable: !0
16
- }) : e[r] = t, e;
17
- }
18
- function ownKeys(e, r) {
19
- var t = Object.keys(e);
20
- if (Object.getOwnPropertySymbols) {
21
- var o = Object.getOwnPropertySymbols(e);
22
- r && (o = o.filter(function (r) {
23
- return Object.getOwnPropertyDescriptor(e, r).enumerable;
24
- })), t.push.apply(t, o);
25
- }
26
- return t;
27
- }
28
- function _objectSpread2(e) {
29
- for (var r = 1; r < arguments.length; r++) {
30
- var t = null != arguments[r] ? arguments[r] : {};
31
- r % 2 ? ownKeys(Object(t), !0).forEach(function (r) {
32
- _defineProperty(e, r, t[r]);
33
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {
34
- Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
35
- });
36
- }
37
- return e;
38
- }
39
- function _objectWithoutProperties(e, t) {
40
- if (null == e) return {};
41
- var o,
42
- r,
43
- i = _objectWithoutPropertiesLoose(e, t);
44
- if (Object.getOwnPropertySymbols) {
45
- var n = Object.getOwnPropertySymbols(e);
46
- for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
47
- }
48
- return i;
49
- }
50
- function _objectWithoutPropertiesLoose(r, e) {
51
- if (null == r) return {};
52
- var t = {};
53
- for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
54
- if (-1 !== e.indexOf(n)) continue;
55
- t[n] = r[n];
56
- }
57
- return t;
58
- }
59
- function _toPrimitive(t, r) {
60
- if ("object" != typeof t || !t) return t;
61
- var e = t[Symbol.toPrimitive];
62
- if (void 0 !== e) {
63
- var i = e.call(t, r || "default");
64
- if ("object" != typeof i) return i;
65
- throw new TypeError("@@toPrimitive must return a primitive value.");
66
- }
67
- return ("string" === r ? String : Number)(t);
68
- }
69
- function _toPropertyKey(t) {
70
- var i = _toPrimitive(t, "string");
71
- return "symbol" == typeof i ? i : i + "";
72
- }
73
- var _excluded = ["width", "height", "viewBox"],
74
- _excluded2 = ["tabindex"];
75
- /**
76
- * Copyright IBM Corp. 2018, 2024
77
- *
78
- * This source code is licensed under the Apache-2.0 license found in the
79
- * LICENSE file in the root directory of this source tree.
80
- */
81
-
82
- var defaultAttributes = {
83
- // Reference:
84
- // https://github.com/IBM/carbon-components-react/issues/1392
85
- // https://github.com/PolymerElements/iron-iconset-svg/pull/47
86
- // `focusable` is a string attribute which is why we do not use a boolean here
87
- focusable: 'false',
88
- preserveAspectRatio: 'xMidYMid meet'
89
- };
90
-
91
- /**
92
- * Get supplementary HTML attributes for a given <svg> element based on existing
93
- * attributes.
94
- */
95
- function getAttributes() {
96
- var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
97
- width = _ref.width,
98
- height = _ref.height,
99
- _ref$viewBox = _ref.viewBox,
100
- viewBox = _ref$viewBox === void 0 ? "0 0 ".concat(width, " ").concat(height) : _ref$viewBox,
101
- attributes = _objectWithoutProperties(_ref, _excluded);
102
- var tabindex = attributes.tabindex,
103
- rest = _objectWithoutProperties(attributes, _excluded2);
104
- var iconAttributes = _objectSpread2(_objectSpread2(_objectSpread2({}, defaultAttributes), rest), {}, {
105
- width: width,
106
- height: height,
107
- viewBox: viewBox
108
- });
109
-
110
- // TODO: attributes.title assumes that the consumer will implement <title> and
111
- // correctly set `aria-labelledby`.
112
- if (iconAttributes['aria-label'] || iconAttributes['aria-labelledby'] || iconAttributes.title) {
113
- iconAttributes.role = 'img';
114
-
115
- // Reference:
116
- // https://allyjs.io/tutorials/focusing-in-svg.html
117
- if (tabindex !== undefined && tabindex !== null) {
118
- iconAttributes.focusable = 'true';
119
- iconAttributes.tabindex = tabindex;
120
- }
121
- } else {
122
- iconAttributes['aria-hidden'] = true;
123
- }
124
- return iconAttributes;
125
- }
126
-
127
- exports.defaultAttributes = defaultAttributes;
128
- exports.getAttributes = getAttributes;