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