@skyscanner/backpack-web 36.13.1 → 36.14.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.
@@ -15,4 +15,4 @@
15
15
  * See the License for the specific language governing permissions and
16
16
  * limitations under the License.
17
17
  */
18
- .bpk-info-banner{padding:.5rem 1rem;overflow:hidden;border-radius:.5rem;margin:0;font-size:.875rem;line-height:1.25rem;font-weight:400}.bpk-info-banner--style-default{background-color:#eff3f8}.bpk-info-banner--style-onContrast{background-color:#fff}.bpk-info-banner__header{display:flex;flex-direction:row;align-items:flex-start}.bpk-info-banner__header--expandable{cursor:pointer}.bpk-info-banner__icon,.bpk-info-banner__toggle{padding:.125rem 0}.bpk-info-banner__message{padding:.25rem .5rem;flex-grow:1}.bpk-info-banner__success-icon{fill:#0c838a}.bpk-info-banner__warning-icon{fill:#f55d42}.bpk-info-banner__error-icon{fill:#e70866}.bpk-info-banner__info-icon{fill:#626971}.bpk-info-banner__toggle-button{padding:0;border:0;background-color:rgba(0,0,0,0);cursor:pointer;appearance:none}.bpk-info-banner__expand-icon{fill:#626971}.bpk-info-banner__children-container{color:#161616;font-size:.875rem;line-height:1.25rem;font-weight:400}.bpk-info-banner__children-container--with-action{padding:.25rem 0 .25rem}.bpk-info-banner__children-container--no-action{padding:.25rem 0 .5rem}
18
+ .bpk-info-banner{padding:.5rem 1rem;overflow:hidden;border-radius:.5rem;margin:0;font-size:.875rem;line-height:1.25rem;font-weight:400}.bpk-info-banner--style-default{background-color:#eff3f8}.bpk-info-banner--style-onContrast{background-color:#fff}.bpk-info-banner__header{display:flex;flex-direction:row;align-items:flex-start}.bpk-info-banner__header--expandable{width:100%;padding:0;border:none;background-color:rgba(0,0,0,0);text-align:start;cursor:pointer}.bpk-info-banner__icon,.bpk-info-banner__toggle{padding:.125rem 0}.bpk-info-banner__message{padding:.25rem .5rem;flex-grow:1}.bpk-info-banner__success-icon{fill:#0c838a}.bpk-info-banner__warning-icon{fill:#f55d42}.bpk-info-banner__error-icon{fill:#e70866}.bpk-info-banner__info-icon{fill:#626971}.bpk-info-banner__toggle-button{padding:0;border:0;background-color:rgba(0,0,0,0);cursor:pointer;appearance:none;fill:#626971}.bpk-info-banner__children-container{color:#161616;font-size:.875rem;line-height:1.25rem;font-weight:400}.bpk-info-banner__children-container--with-action{padding:.25rem 0 .25rem}.bpk-info-banner__children-container--no-action{padding:.25rem 0 .5rem}
@@ -67,20 +67,13 @@ const getIconForType = (type, CustomIcon) => {
67
67
  children: /*#__PURE__*/_jsx(AlignedIcon, {})
68
68
  });
69
69
  };
70
- const ToggleButton = props => {
71
- const classNames = getClassName('bpk-info-banner__expand-icon');
72
- return /*#__PURE__*/_jsx("button", {
73
- type: "button",
74
- className: getClassName('bpk-info-banner__toggle-button'),
75
- "aria-label": props.label,
76
- "aria-expanded": props.expanded,
77
- title: props.label,
78
- children: /*#__PURE__*/_jsx("div", {
79
- className: classNames,
80
- children: props.expanded ? /*#__PURE__*/_jsx(CollapseIcon, {}) : /*#__PURE__*/_jsx(ExpandIcon, {})
81
- })
82
- });
83
- };
70
+ const ToggleButton = props => /*#__PURE__*/_jsxs("div", {
71
+ className: getClassName('bpk-info-banner__toggle-button'),
72
+ children: [props.expanded ? /*#__PURE__*/_jsx(CollapseIcon, {}) : /*#__PURE__*/_jsx(ExpandIcon, {}), /*#__PURE__*/_jsx("span", {
73
+ className: "visually-hidden",
74
+ children: props.label
75
+ })]
76
+ });
84
77
  const BpkInfoBannerInner = ({
85
78
  action = null,
86
79
  animateOnEnter = false,
@@ -113,26 +106,23 @@ const BpkInfoBannerInner = ({
113
106
  const isExpandable = configuration === CONFIGURATION.EXPANDABLE;
114
107
  const dismissable = configuration === CONFIGURATION.DISMISSABLE;
115
108
  const showChildren = isExpandable && expanded;
116
- const sectionClassNames = getClassName('bpk-info-banner', `bpk-info-banner--${type}`, `bpk-info-banner--style-${style}`, bannerClassName && bannerClassName);
109
+ const classNames = getClassName('bpk-info-banner', `bpk-info-banner--${type}`, `bpk-info-banner--style-${style}`, bannerClassName && bannerClassName);
117
110
  const headerClassNames = getClassName('bpk-info-banner__header', isExpandable && 'bpk-info-banner__header--expandable');
118
111
  const childrenContainerClassName = action && isExpandable ? getClassName('bpk-info-banner__children-container--with-action') : getClassName('bpk-info-banner__children-container--no-action');
119
-
120
- /* eslint-disable
121
- jsx-a11y/no-static-element-interactions,
122
- jsx-a11y/click-events-have-key-events,
123
- */
124
- // Disabling 'click-events-have-key-events and interactive-supports-focus' because header element is not focusable.
125
- // ToggleButton is focusable and works for this.
112
+ const BannerHeader = isExpandable ? 'button' : 'div';
126
113
  return /*#__PURE__*/_jsx(AnimateAndFade, {
127
114
  animateOnEnter: animateOnEnter,
128
115
  animateOnLeave: dismissable || animateOnLeave,
129
116
  show: show,
130
117
  ...rest,
131
- children: /*#__PURE__*/_jsxs("section", {
132
- className: sectionClassNames,
133
- role: "presentation",
134
- children: [/*#__PURE__*/_jsxs("div", {
135
- role: isExpandable ? 'button' : undefined,
118
+ children: /*#__PURE__*/_jsxs("div", {
119
+ className: classNames,
120
+ children: [/*#__PURE__*/_jsxs(BannerHeader, {
121
+ "aria-expanded": isExpandable ? expanded : undefined,
122
+ type: isExpandable ? 'button' : undefined
123
+ // BannerHeader is just <button> or <div>, so className should be allowed.
124
+ // eslint-disable-next-line @skyscanner/rules/forbid-component-props
125
+ ,
136
126
  className: headerClassNames,
137
127
  onClick: onBannerExpandToggle,
138
128
  children: [/*#__PURE__*/_jsx("span", {
@@ -168,6 +158,5 @@ const BpkInfoBannerInner = ({
168
158
  })]
169
159
  })
170
160
  });
171
- /* eslint-enable */
172
161
  };
173
162
  export default BpkInfoBannerInner;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skyscanner/backpack-web",
3
- "version": "36.13.1",
3
+ "version": "36.14.0",
4
4
  "description": "Backpack Design System web library",
5
5
  "repository": {
6
6
  "type": "git",