@zendeskgarden/react-chrome 9.0.0-next.7 → 9.0.0-next.9

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.
Files changed (94) hide show
  1. package/README.md +17 -14
  2. package/dist/esm/elements/Chrome.js +94 -0
  3. package/dist/esm/elements/SkipNav.js +65 -0
  4. package/dist/esm/elements/body/Body.js +57 -0
  5. package/dist/esm/elements/body/Content.js +54 -0
  6. package/dist/esm/elements/body/Main.js +47 -0
  7. package/dist/esm/elements/footer/Footer.js +67 -0
  8. package/dist/esm/elements/footer/FooterItem.js +47 -0
  9. package/dist/esm/elements/header/Header.js +60 -0
  10. package/dist/esm/elements/header/HeaderItem.js +69 -0
  11. package/dist/esm/elements/header/HeaderItemIcon.js +66 -0
  12. package/dist/esm/elements/header/HeaderItemText.js +51 -0
  13. package/dist/esm/elements/header/HeaderItemWrapper.js +47 -0
  14. package/dist/esm/elements/nav/Nav.js +78 -0
  15. package/dist/esm/elements/nav/NavItem.js +101 -0
  16. package/dist/esm/elements/nav/NavItemIcon.js +66 -0
  17. package/dist/esm/elements/nav/NavItemText.js +58 -0
  18. package/dist/esm/elements/nav/NavList.js +55 -0
  19. package/dist/esm/elements/sheet/Sheet.js +128 -0
  20. package/dist/esm/elements/sheet/components/Body.js +50 -0
  21. package/dist/esm/elements/sheet/components/Close.js +60 -0
  22. package/dist/esm/elements/sheet/components/Description.js +59 -0
  23. package/dist/esm/elements/sheet/components/Footer.js +50 -0
  24. package/dist/esm/elements/sheet/components/FooterItem.js +50 -0
  25. package/dist/esm/elements/sheet/components/Header.js +55 -0
  26. package/dist/esm/elements/sheet/components/Title.js +59 -0
  27. package/dist/esm/index.js +24 -0
  28. package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/link-stroke.svg.js +25 -0
  29. package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/x-stroke.svg.js +26 -0
  30. package/dist/esm/styled/StyledChrome.js +22 -0
  31. package/dist/esm/styled/StyledSkipNav.js +46 -0
  32. package/dist/esm/styled/StyledSkipNavIcon.js +28 -0
  33. package/dist/esm/styled/body/StyledBody.js +22 -0
  34. package/dist/esm/styled/body/StyledContent.js +25 -0
  35. package/dist/esm/styled/body/StyledMain.js +22 -0
  36. package/dist/esm/styled/footer/StyledFooter.js +25 -0
  37. package/dist/esm/styled/footer/StyledFooterItem.js +22 -0
  38. package/dist/esm/styled/header/StyledBaseHeaderItem.js +35 -0
  39. package/dist/esm/styled/header/StyledHeader.js +31 -0
  40. package/dist/esm/styled/header/StyledHeaderItem.js +37 -0
  41. package/dist/esm/styled/header/StyledHeaderItemIcon.js +22 -0
  42. package/dist/esm/styled/header/StyledHeaderItemText.js +23 -0
  43. package/dist/esm/styled/header/StyledHeaderItemWrapper.js +24 -0
  44. package/dist/esm/styled/header/StyledLogoHeaderItem.js +43 -0
  45. package/dist/esm/styled/nav/StyledBaseNavItem.js +32 -0
  46. package/dist/esm/styled/nav/StyledBrandmarkNavItem.js +23 -0
  47. package/dist/esm/styled/nav/StyledLogoNavItem.js +44 -0
  48. package/dist/esm/styled/nav/StyledNav.js +34 -0
  49. package/dist/esm/styled/nav/StyledNavButton.js +65 -0
  50. package/dist/esm/styled/nav/StyledNavItemIcon.js +22 -0
  51. package/dist/esm/styled/nav/StyledNavItemText.js +34 -0
  52. package/dist/esm/styled/nav/StyledNavList.js +22 -0
  53. package/dist/esm/styled/nav/StyledNavListItem.js +22 -0
  54. package/dist/esm/styled/sheet/StyledSheet.js +41 -0
  55. package/dist/esm/styled/sheet/StyledSheetBody.js +22 -0
  56. package/dist/esm/styled/sheet/StyledSheetClose.js +34 -0
  57. package/dist/esm/styled/sheet/StyledSheetDescription.js +22 -0
  58. package/dist/esm/styled/sheet/StyledSheetFooter.js +22 -0
  59. package/dist/esm/styled/sheet/StyledSheetFooterItem.js +22 -0
  60. package/dist/esm/styled/sheet/StyledSheetHeader.js +23 -0
  61. package/dist/esm/styled/sheet/StyledSheetTitle.js +22 -0
  62. package/dist/esm/styled/sheet/StyledSheetWrapper.js +37 -0
  63. package/dist/esm/types/index.js +10 -0
  64. package/dist/esm/utils/useBodyContext.js +14 -0
  65. package/dist/esm/utils/useChromeContext.js +16 -0
  66. package/dist/esm/utils/useFocusableMount.js +31 -0
  67. package/dist/esm/utils/useNavContext.js +16 -0
  68. package/dist/esm/utils/useNavListContext.js +14 -0
  69. package/dist/esm/utils/useSheetContext.js +16 -0
  70. package/dist/index.cjs.js +209 -461
  71. package/dist/typings/elements/nav/Nav.d.ts +2 -0
  72. package/dist/typings/elements/nav/NavList.d.ts +11 -0
  73. package/dist/typings/index.d.ts +1 -5
  74. package/dist/typings/styled/index.d.ts +3 -7
  75. package/dist/typings/styled/nav/StyledBaseNavItem.d.ts +1 -5
  76. package/dist/typings/styled/nav/StyledBrandmarkNavItem.d.ts +4 -5
  77. package/dist/typings/styled/nav/StyledLogoNavItem.d.ts +4 -5
  78. package/dist/typings/styled/nav/{StyledNavItem.d.ts → StyledNavButton.d.ts} +3 -1
  79. package/dist/typings/styled/nav/StyledNavList.d.ts +10 -0
  80. package/dist/typings/styled/nav/StyledNavListItem.d.ts +10 -0
  81. package/dist/typings/types/index.d.ts +2 -25
  82. package/dist/typings/utils/useNavListContext.d.ts +13 -0
  83. package/package.json +5 -7
  84. package/dist/index.esm.js +0 -1456
  85. package/dist/typings/elements/subnav/CollapsibleSubNavItem.d.ts +0 -14
  86. package/dist/typings/elements/subnav/SubNav.d.ts +0 -19
  87. package/dist/typings/elements/subnav/SubNavItem.d.ts +0 -14
  88. package/dist/typings/elements/subnav/SubNavItemText.d.ts +0 -14
  89. package/dist/typings/styled/subnav/StyledSubNav.d.ts +0 -17
  90. package/dist/typings/styled/subnav/StyledSubNavItem.d.ts +0 -21
  91. package/dist/typings/styled/subnav/StyledSubNavItemHeader.d.ts +0 -14
  92. package/dist/typings/styled/subnav/StyledSubNavItemIcon.d.ts +0 -14
  93. package/dist/typings/styled/subnav/StyledSubNavItemText.d.ts +0 -11
  94. package/dist/typings/styled/subnav/StyledSubNavPanel.d.ts +0 -12
package/dist/index.esm.js DELETED
@@ -1,1456 +0,0 @@
1
- /**
2
- * Copyright Zendesk, Inc.
3
- *
4
- * Use of this source code is governed under the Apache License, Version 2.0
5
- * found at http://www.apache.org/licenses/LICENSE-2.0.
6
- */
7
-
8
- import * as React from 'react';
9
- import React__default, { Children, isValidElement, cloneElement, useContext, createRef, useState, useEffect, useMemo, createContext, useRef, forwardRef } from 'react';
10
- import PropTypes from 'prop-types';
11
- import styled, { css, keyframes, ThemeContext } from 'styled-components';
12
- import { retrieveComponentStyles, DEFAULT_THEME, getLineHeight, getColorV8, PALETTE, SELECTOR_FOCUS_VISIBLE, focusStyles, useDocument } from '@zendeskgarden/react-theming';
13
- import { math, rgba, readableColor } from 'polished';
14
- import { useAccordion } from '@zendeskgarden/container-accordion';
15
- import { getControlledValue } from '@zendeskgarden/container-utilities';
16
- import { useUIDSeed } from 'react-uid';
17
- import { mergeRefs } from 'react-merge-refs';
18
- import activeElement from 'dom-helpers/activeElement';
19
-
20
- function _extends$3() {
21
- _extends$3 = Object.assign ? Object.assign.bind() : function (target) {
22
- for (var i = 1; i < arguments.length; i++) {
23
- var source = arguments[i];
24
- for (var key in source) {
25
- if (Object.prototype.hasOwnProperty.call(source, key)) {
26
- target[key] = source[key];
27
- }
28
- }
29
- }
30
- return target;
31
- };
32
- return _extends$3.apply(this, arguments);
33
- }
34
-
35
- const PLACEMENT = ['end', 'start'];
36
- const PRODUCTS = ['chat', 'connect', 'explore', 'guide', 'message', 'support', 'talk'];
37
-
38
- const COMPONENT_ID$z = 'chrome.chrome';
39
- const StyledChrome = styled.div.attrs({
40
- 'data-garden-id': COMPONENT_ID$z,
41
- 'data-garden-version': '9.0.0-next.7'
42
- }).withConfig({
43
- displayName: "StyledChrome",
44
- componentId: "sc-1uqm6u6-0"
45
- })(["display:flex;position:relative;margin:0;height:100vh;overflow-y:hidden;font-family:", ";direction:", ";", ";"], props => props.theme.fonts.system, props => props.theme.rtl && 'rtl', props => retrieveComponentStyles(COMPONENT_ID$z, props));
46
- StyledChrome.defaultProps = {
47
- theme: DEFAULT_THEME
48
- };
49
-
50
- const COMPONENT_ID$y = 'chrome.header_item_icon';
51
- const StyledHeaderItemIcon = styled.div.attrs({
52
- 'data-garden-id': COMPONENT_ID$y,
53
- 'data-garden-version': '9.0.0-next.7'
54
- }).withConfig({
55
- displayName: "StyledHeaderItemIcon",
56
- componentId: "sc-1jhhp6z-0"
57
- })(["transition:transform 0.25s ease-in-out;margin:0 3px;width:", ";min-width:", ";height:", ";", ";"], props => props.theme.iconSizes.md, props => props.theme.iconSizes.md, props => props.theme.iconSizes.md, props => retrieveComponentStyles(COMPONENT_ID$y, props));
58
- StyledHeaderItemIcon.defaultProps = {
59
- theme: DEFAULT_THEME
60
- };
61
-
62
- const COMPONENT_ID$x = 'chrome.base_header_item';
63
- const getHeaderItemSize = props => `${props.theme.space.base * 7.5}px`;
64
- const sizeStyles$4 = props => {
65
- const size = props.theme.space.base * 7.5;
66
- return css(["padding:0 3px;min-width:", "px;height:", ";line-height:", ";"], size, props.maxY ? '100%' : `${size}px`, getLineHeight(size, props.theme.fontSizes.md));
67
- };
68
- const StyledBaseHeaderItem = styled.button.attrs({
69
- 'data-garden-id': COMPONENT_ID$x,
70
- 'data-garden-version': '9.0.0-next.7'
71
- }).withConfig({
72
- displayName: "StyledBaseHeaderItem",
73
- componentId: "sc-1qua7h6-0"
74
- })(["display:inline-flex;position:relative;flex:", ";align-items:center;justify-content:", ";order:1;transition:box-shadow 0.1s ease-in-out,color 0.1s ease-in-out;z-index:0;margin:", ";border:none;border-radius:", ";background:transparent;text-decoration:none;white-space:nowrap;color:inherit;font-size:inherit;", " ", ";"], props => props.maxX && '1', props => props.maxX ? 'start' : 'center', props => `0 ${props.theme.space.base * 3}px`, props => {
75
- if (props.isRound) {
76
- return '100%';
77
- }
78
- if (props.maxY) {
79
- return '0';
80
- }
81
- return props.theme.borderRadii.md;
82
- }, sizeStyles$4, props => retrieveComponentStyles(COMPONENT_ID$x, props));
83
- StyledBaseHeaderItem.defaultProps = {
84
- theme: DEFAULT_THEME
85
- };
86
-
87
- const COMPONENT_ID$w = 'chrome.header_item_text';
88
- const clippedStyling = css(["position:absolute;margin:0;clip:rect(1px,1px,1px,1px);width:1px;height:1px;overflow:hidden;white-space:nowrap;"]);
89
- const StyledHeaderItemText = styled.span.attrs({
90
- 'data-garden-id': COMPONENT_ID$w,
91
- 'data-garden-version': '9.0.0-next.7'
92
- }).withConfig({
93
- displayName: "StyledHeaderItemText",
94
- componentId: "sc-goz7la-0"
95
- })(["margin:0 3px;", " ", ";"], props => props.isClipped && clippedStyling, props => retrieveComponentStyles(COMPONENT_ID$w, props));
96
- StyledHeaderItemText.defaultProps = {
97
- theme: DEFAULT_THEME
98
- };
99
-
100
- const COMPONENT_ID$v = 'chrome.nav';
101
- const colorStyles$6 = props => {
102
- const shade = props.isDark || props.isLight ? 600 : 700;
103
- const backgroundColor = getColorV8(props.hue, shade, props.theme);
104
- const foregroundColor = props.isLight ? props.theme.palette.black : props.theme.palette.white;
105
- return css(["background-color:", ";color:", ";"], backgroundColor, foregroundColor);
106
- };
107
- const getNavWidth = props => {
108
- return `${props.theme.space.base * 15}px`;
109
- };
110
- const getExpandedNavWidth = () => {
111
- return `200px`;
112
- };
113
- const StyledNav = styled.nav.attrs({
114
- 'data-garden-id': COMPONENT_ID$v,
115
- 'data-garden-version': '9.0.0-next.7'
116
- }).withConfig({
117
- displayName: "StyledNav",
118
- componentId: "sc-6j462r-0"
119
- })(["display:flex;position:relative;flex-direction:column;flex-shrink:0;order:-1;width:", ";font-size:", ";", ";", ";"], props => props.isExpanded ? getExpandedNavWidth : getNavWidth, props => props.theme.fontSizes.md, props => colorStyles$6(props), props => retrieveComponentStyles(COMPONENT_ID$v, props));
120
- StyledNav.defaultProps = {
121
- theme: DEFAULT_THEME
122
- };
123
-
124
- const COMPONENT_ID$u = 'chrome.header_item';
125
- const retrieveProductColor$1 = props => {
126
- switch (props.product) {
127
- case 'chat':
128
- return PALETTE.product.chat;
129
- case 'connect':
130
- return PALETTE.product.connect;
131
- case 'explore':
132
- return PALETTE.product.explore;
133
- case 'guide':
134
- return PALETTE.product.guide;
135
- case 'message':
136
- return PALETTE.product.message;
137
- case 'support':
138
- return PALETTE.product.support;
139
- case 'talk':
140
- return PALETTE.product.talk;
141
- default:
142
- return 'inherit';
143
- }
144
- };
145
- const StyledLogoHeaderItem = styled(StyledBaseHeaderItem).attrs({
146
- 'data-garden-id': COMPONENT_ID$u,
147
- 'data-garden-version': '9.0.0-next.7',
148
- as: 'div'
149
- }).withConfig({
150
- displayName: "StyledLogoHeaderItem",
151
- componentId: "sc-1n1d1yv-0"
152
- })(["display:none;order:0;margin-right:", ";margin-left:", ";border-", ":", ";border-radius:0;padding:0;width:", ";height:100%;overflow:hidden;fill:", ";text-decoration:none;color:", ";", "{", "}", "{margin:0;width:", ";height:", ";}", ";"], props => props.theme.rtl ? `-${props.theme.space.base}px` : 'auto', props => props.theme.rtl ? 'auto' : `-${props.theme.space.base}px`, props => props.theme.rtl ? 'left' : 'right', props => `${props.theme.borders.sm} ${getColorV8('neutralHue', 300, props.theme)}`, props => getNavWidth(props), props => getColorV8('chromeHue', 700, props.theme), props => retrieveProductColor$1(props), StyledHeaderItemText, clippedStyling, StyledHeaderItemIcon, props => props.theme.iconSizes.lg, props => props.theme.iconSizes.lg, props => retrieveComponentStyles(COMPONENT_ID$u, props));
153
- StyledLogoHeaderItem.defaultProps = {
154
- theme: DEFAULT_THEME
155
- };
156
-
157
- const COMPONENT_ID$t = 'chrome.base_nav_item';
158
- const getNavItemHeight = props => {
159
- return `${props.theme.space.base * 13}px`;
160
- };
161
- const sizeStyles$3 = props => {
162
- const verticalPadding = math(`(${getNavItemHeight(props)} - ${props.theme.iconSizes.lg}) / 2`);
163
- const horizontalPadding = math(`(${getNavWidth(props)} - ${props.theme.iconSizes.lg}) / 4`);
164
- return css(["padding:", " ", ";min-height:", ";"], verticalPadding, horizontalPadding, getNavItemHeight);
165
- };
166
- const StyledBaseNavItem = styled.button.attrs({
167
- 'data-garden-id': COMPONENT_ID$t,
168
- 'data-garden-version': '9.0.0-next.7'
169
- }).withConfig({
170
- displayName: "StyledBaseNavItem",
171
- componentId: "sc-zvo43f-0"
172
- })(["display:flex;flex-shrink:0;align-items:center;justify-content:center;transition:outline-color 0.1s ease-in-out,box-shadow 0.1s ease-in-out,background-color 0.1s ease-in-out,opacity 0.1s ease-in-out;border:none;box-sizing:border-box;background:transparent;text-decoration:none;color:inherit;font-size:inherit;", ""], props => sizeStyles$3(props));
173
- StyledBaseNavItem.defaultProps = {
174
- theme: DEFAULT_THEME
175
- };
176
-
177
- const COMPONENT_ID$s = 'chrome.header';
178
- const getHeaderHeight = props => {
179
- return getNavItemHeight(props);
180
- };
181
- const StyledHeader = styled.header.attrs({
182
- 'data-garden-id': COMPONENT_ID$s,
183
- 'data-garden-version': '9.0.0-next.7'
184
- }).withConfig({
185
- displayName: "StyledHeader",
186
- componentId: "sc-1cexpz-0"
187
- })(["display:flex;position:", ";align-items:center;justify-content:flex-end;box-sizing:border-box;border-bottom:", ";box-shadow:", ";background-color:", ";padding:0 ", "px;height:", ";color:", ";font-size:", ";", " ", ";"], props => props.isStandalone && 'relative', props => `${props.theme.borders.sm} ${getColorV8('neutralHue', 300, props.theme)}`, props => props.isStandalone && props.theme.shadows.lg('0', '10px', getColorV8('chromeHue', 600, props.theme, 0.15)), props => getColorV8('background', 600 , props.theme), props => props.theme.space.base, getHeaderHeight, props => getColorV8('neutralHue', 600, props.theme), props => props.theme.fontSizes.md, props => props.isStandalone && `
188
- ${StyledLogoHeaderItem} {
189
- display: inline-flex;
190
- }
191
- `, props => retrieveComponentStyles(COMPONENT_ID$s, props));
192
- StyledHeader.defaultProps = {
193
- theme: DEFAULT_THEME
194
- };
195
-
196
- const COMPONENT_ID$r = 'chrome.skipnav';
197
- const animationStyles = () => {
198
- const animationName = keyframes(["0%{transform:translate(-50%,-50%);}"]);
199
- return css(["transition:opacity 0.2s ease-out,clip 0s linear 0.2s;opacity:0;clip:rect(0,0,0,0);&:focus{transition:opacity 0.2s ease-in-out;animation:0.2s cubic-bezier(0.15,0.85,0.35,1.2) ", ";opacity:1;clip:rect(0,150vw,100vh,-50vw);}"], animationName);
200
- };
201
- const colorStyles$5 = theme => {
202
- const color = getColorV8('primaryHue', 600, theme);
203
- const borderColor = getColorV8('neutralHue', 300, theme);
204
- const boxShadow = theme.shadows.lg(`${theme.space.base * 5}px`, `${theme.space.base * 7}px`, getColorV8('chromeHue', 600, theme, 0.15));
205
- return css(["border-color:", ";box-shadow:", ";background-color:", ";color:", ";&:hover,&:focus{color:", ";}", ""], borderColor, boxShadow, getColorV8('background', 600 , theme), color, color, focusStyles({
206
- theme,
207
- inset: true,
208
- boxShadow
209
- }));
210
- };
211
- const sizeStyles$2 = props => {
212
- const top = math(`${getHeaderHeight(props)} / 2`);
213
- const padding = `${props.theme.space.base * 5}px`;
214
- const paddingStart = `${props.theme.space.base * 4}px`;
215
- const fontSize = props.theme.fontSizes.md;
216
- const lineHeight = getLineHeight(padding, fontSize);
217
- return css(["top:", ";padding:", ";padding-", ":", ";line-height:", ";font-size:", ";"], top, padding, props.theme.rtl ? 'right' : 'left', paddingStart, lineHeight, fontSize);
218
- };
219
- const StyledSkipNav = styled.a.attrs({
220
- 'data-garden-id': COMPONENT_ID$r,
221
- 'data-garden-version': '9.0.0-next.7'
222
- }).withConfig({
223
- displayName: "StyledSkipNav",
224
- componentId: "sc-1tsro34-0"
225
- })(["", ";display:inline-flex;position:absolute;left:50%;align-items:center;justify-content:center;transform:translateX(-50%);direction:", ";z-index:", ";border:", ";border-radius:", ";text-decoration:underline;white-space:nowrap;", ";", "{text-decoration:none;}&:hover{text-decoration:underline;}", ";", ";"], animationStyles(), props => props.theme.rtl && 'rtl', props => props.zIndex, props => props.theme.borders.sm, props => props.theme.borderRadii.md, props => sizeStyles$2(props), SELECTOR_FOCUS_VISIBLE, props => colorStyles$5(props.theme), props => retrieveComponentStyles(COMPONENT_ID$r, props));
226
- StyledSkipNav.defaultProps = {
227
- theme: DEFAULT_THEME
228
- };
229
-
230
- var _path$2;
231
- function _extends$2() { _extends$2 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$2.apply(this, arguments); }
232
- var SvgLinkStroke = function SvgLinkStroke(props) {
233
- return /*#__PURE__*/React.createElement("svg", _extends$2({
234
- xmlns: "http://www.w3.org/2000/svg",
235
- width: 16,
236
- height: 16,
237
- focusable: "false",
238
- viewBox: "0 0 16 16",
239
- "aria-hidden": "true"
240
- }, props), _path$2 || (_path$2 = /*#__PURE__*/React.createElement("path", {
241
- fill: "currentColor",
242
- d: "M4.441 7.38l.095.083.939.939-.708.707-.939-.939-2 2-.132.142a2.829 2.829 0 003.99 3.99l.142-.132 2-2-.939-.939.707-.708.94.94a1 1 0 01.083 1.32l-.083.094-2 2A3.828 3.828 0 01.972 9.621l.15-.158 2-2A1 1 0 014.34 7.31l.101.07zm7.413-3.234a.5.5 0 01.057.638l-.057.07-7 7a.5.5 0 01-.765-.638l.057-.07 7-7a.5.5 0 01.708 0zm3.023-3.025a3.829 3.829 0 01.15 5.257l-.15.158-2 2a1 1 0 01-1.32.083l-.094-.083-.94-.94.708-.707.939.94 2-2 .132-.142a2.829 2.829 0 00-3.99-3.99l-.142.131-2 2 .939.939-.707.708-.94-.94a1 1 0 01-.082-1.32l.083-.094 2-2a3.828 3.828 0 015.414 0z"
243
- })));
244
- };
245
-
246
- const COMPONENT_ID$q = 'chrome.skipnav_icon';
247
- const sizeStyles$1 = theme => {
248
- const margin = `${theme.space.base * 2}px`;
249
- const size = theme.iconSizes.md;
250
- return css(["margin-", ":", ";width:", ";height:", ";"], theme.rtl ? 'left' : 'right', margin, size, size);
251
- };
252
- const StyledSkipNavIcon = styled(SvgLinkStroke).attrs({
253
- 'data-garden-id': COMPONENT_ID$q,
254
- 'data-garden-version': '9.0.0-next.7'
255
- }).withConfig({
256
- displayName: "StyledSkipNavIcon",
257
- componentId: "sc-1ika5z4-0"
258
- })(["transform:", ";color:", ";", ";", ";"], props => props.theme.rtl && 'scaleX(-1)', props => getColorV8('neutralHue', 600, props.theme), props => sizeStyles$1(props.theme), props => retrieveComponentStyles(COMPONENT_ID$q, props));
259
- StyledSkipNavIcon.defaultProps = {
260
- theme: DEFAULT_THEME
261
- };
262
-
263
- const COMPONENT_ID$p = 'chrome.body';
264
- const StyledBody = styled.div.attrs({
265
- 'data-garden-id': COMPONENT_ID$p,
266
- 'data-garden-version': '9.0.0-next.7'
267
- }).withConfig({
268
- displayName: "StyledBody",
269
- componentId: "sc-c7h9kv-0"
270
- })(["flex:1;order:1;background-color:", ";min-width:0;", ";"], props => getColorV8('neutralHue', 100, props.theme), props => retrieveComponentStyles(COMPONENT_ID$p, props));
271
- StyledBody.defaultProps = {
272
- theme: DEFAULT_THEME
273
- };
274
-
275
- const COMPONENT_ID$o = 'chrome.footer';
276
- const getFooterHeight = props => {
277
- return `${props.theme.space.base * 20}px`;
278
- };
279
- const StyledFooter = styled.footer.attrs({
280
- 'data-garden-id': COMPONENT_ID$o,
281
- 'data-garden-version': '9.0.0-next.7'
282
- }).withConfig({
283
- displayName: "StyledFooter",
284
- componentId: "sc-v7lib2-0"
285
- })(["display:flex;align-items:center;justify-content:flex-end;box-sizing:border-box;border-top:", ";background-color:", ";padding:0 ", "px;height:", ";", ";"], props => `${props.theme.borders.sm} ${getColorV8('neutralHue', 300, props.theme)}`, props => getColorV8('background', 600 , props.theme), props => props.theme.space.base * 9, getFooterHeight, props => retrieveComponentStyles(COMPONENT_ID$o, props));
286
- StyledFooter.defaultProps = {
287
- theme: DEFAULT_THEME
288
- };
289
-
290
- const COMPONENT_ID$n = 'chrome.content';
291
- const StyledContent = styled.div.attrs({
292
- 'data-garden-id': COMPONENT_ID$n,
293
- 'data-garden-version': '9.0.0-next.7'
294
- }).withConfig({
295
- displayName: "StyledContent",
296
- componentId: "sc-qcuzxn-0"
297
- })(["display:flex;height:", ";line-height:", ";color:", ";font-size:", ";&:focus{outline:none;}", ";"], props => props.hasFooter ? `calc(100% - ${math(`${getHeaderHeight(props)} + ${getFooterHeight(props)}`)})` : `calc(100% - ${getHeaderHeight(props)})`, props => getLineHeight(props.theme.lineHeights.md, props.theme.fontSizes.md), props => getColorV8('foreground', 600 , props.theme), props => props.theme.fontSizes.md, props => retrieveComponentStyles(COMPONENT_ID$n, props));
298
- StyledContent.defaultProps = {
299
- theme: DEFAULT_THEME
300
- };
301
-
302
- const COMPONENT_ID$m = 'chrome.main';
303
- const StyledMain = styled.main.attrs({
304
- 'data-garden-id': COMPONENT_ID$m,
305
- 'data-garden-version': '9.0.0-next.7'
306
- }).withConfig({
307
- displayName: "StyledMain",
308
- componentId: "sc-t61cre-0"
309
- })(["flex:1;order:1;background-color:", ";overflow:auto;:focus{outline:none;}", ";"], props => getColorV8('background', 600 , props.theme), props => retrieveComponentStyles(COMPONENT_ID$m, props));
310
- StyledMain.defaultProps = {
311
- theme: DEFAULT_THEME
312
- };
313
-
314
- const COMPONENT_ID$l = 'chrome.footer_item';
315
- const StyledFooterItem = styled.div.attrs({
316
- 'data-garden-id': COMPONENT_ID$l,
317
- 'data-garden-version': '9.0.0-next.7'
318
- }).withConfig({
319
- displayName: "StyledFooterItem",
320
- componentId: "sc-1cktm85-0"
321
- })(["margin:", ";", ";"], props => `0 ${props.theme.space.base}px`, props => retrieveComponentStyles(COMPONENT_ID$l, props));
322
- StyledFooterItem.defaultProps = {
323
- theme: DEFAULT_THEME
324
- };
325
-
326
- const COMPONENT_ID$k = 'chrome.header_item';
327
- const imgStyles = props => {
328
- const size = math(`${getHeaderItemSize(props)} - ${props.theme.space.base * 2}`);
329
- return css(["img{margin:0;border-radius:", ";width:", ";height:", ";}"], math(`${props.theme.borderRadii.md} - 1`), size, size);
330
- };
331
- const StyledHeaderItem = styled(StyledBaseHeaderItem).attrs({
332
- 'data-garden-id': COMPONENT_ID$k,
333
- 'data-garden-version': '9.0.0-next.7'
334
- }).withConfig({
335
- displayName: "StyledHeaderItem",
336
- componentId: "sc-14sft6n-0"
337
- })(["&:hover,&:focus{text-decoration:none;color:inherit;}", " &:focus-visible:active{box-shadow:none;}&:hover ", ",&:hover ", ",&:active ", ",&:active ", "{color:", ";}", " ", " ", ";"], props => focusStyles({
338
- theme: props.theme,
339
- inset: props.maxY
340
- }), StyledHeaderItemIcon, StyledHeaderItemText, StyledHeaderItemIcon, StyledHeaderItemText, props => getColorV8('chromeHue', 700, props.theme), imgStyles, props => props.isRound && `
341
- ${StyledHeaderItemIcon} {
342
- border-radius: 100px;
343
- }
344
- `, props => retrieveComponentStyles(COMPONENT_ID$k, props));
345
- StyledHeaderItem.defaultProps = {
346
- theme: DEFAULT_THEME
347
- };
348
-
349
- const COMPONENT_ID$j = 'chrome.header_item_wrapper';
350
- const StyledHeaderItemWrapper = styled(StyledBaseHeaderItem).attrs({
351
- 'data-garden-id': COMPONENT_ID$j,
352
- 'data-garden-version': '9.0.0-next.7',
353
- as: 'div'
354
- }).withConfig({
355
- displayName: "StyledHeaderItemWrapper",
356
- componentId: "sc-1uieu55-0"
357
- })(["", ";"], props => retrieveComponentStyles(COMPONENT_ID$j, props));
358
- StyledHeaderItemWrapper.defaultProps = {
359
- theme: DEFAULT_THEME
360
- };
361
-
362
- const COMPONENT_ID$i = 'chrome.logo_nav_item';
363
- const retrieveProductColor = product => {
364
- switch (product) {
365
- case 'chat':
366
- return PALETTE.product.chat;
367
- case 'connect':
368
- return PALETTE.product.connect;
369
- case 'explore':
370
- return PALETTE.product.explore;
371
- case 'guide':
372
- return PALETTE.product.guide;
373
- case 'message':
374
- return PALETTE.product.message;
375
- case 'support':
376
- return PALETTE.product.support;
377
- case 'talk':
378
- return PALETTE.product.talk;
379
- default:
380
- return 'inherit';
381
- }
382
- };
383
- const colorStyles$4 = props => {
384
- const fillColor = props.isLight ? props.theme.palette.grey[800] : props.theme.palette.white;
385
- const color = props.isLight || props.isDark ? fillColor : retrieveProductColor(props.product);
386
- return css(["color:", ";fill:", ";"], color, fillColor);
387
- };
388
- const StyledLogoNavItem = styled(StyledBaseNavItem).attrs({
389
- 'data-garden-id': COMPONENT_ID$i,
390
- 'data-garden-version': '9.0.0-next.7',
391
- as: 'div'
392
- }).withConfig({
393
- displayName: "StyledLogoNavItem",
394
- componentId: "sc-saaydx-0"
395
- })(["order:0;opacity:1;cursor:default;", ";"], props => colorStyles$4(props));
396
- StyledLogoNavItem.defaultProps = {
397
- theme: DEFAULT_THEME
398
- };
399
-
400
- const COMPONENT_ID$h = 'chrome.brandmark_nav_item';
401
- const StyledBrandmarkNavItem = styled(StyledBaseNavItem).attrs({
402
- 'data-garden-id': COMPONENT_ID$h,
403
- 'data-garden-version': '9.0.0-next.7',
404
- as: 'div'
405
- }).withConfig({
406
- displayName: "StyledBrandmarkNavItem",
407
- componentId: "sc-8kynd4-0"
408
- })(["order:1;opacity:0.3;margin-top:auto;"]);
409
- StyledBrandmarkNavItem.defaultProps = {
410
- theme: DEFAULT_THEME
411
- };
412
-
413
- const COMPONENT_ID$g = 'chrome.nav_item_icon';
414
- const StyledNavItemIcon = styled.div.attrs({
415
- 'data-garden-id': COMPONENT_ID$g,
416
- 'data-garden-version': '9.0.0-next.7'
417
- }).withConfig({
418
- displayName: "StyledNavItemIcon",
419
- componentId: "sc-7w9rpt-0"
420
- })(["align-self:flex-start;order:0;border-radius:", ";width:", ";height:", ";", ";"], props => props.theme.borderRadii.md, props => props.theme.iconSizes.lg, props => props.theme.iconSizes.lg, props => retrieveComponentStyles(COMPONENT_ID$g, props));
421
- StyledNavItemIcon.defaultProps = {
422
- theme: DEFAULT_THEME
423
- };
424
-
425
- const COMPONENT_ID$f = 'chrome.nav_item';
426
- const colorStyles$3 = props => {
427
- const {
428
- theme,
429
- hue,
430
- isLight,
431
- isDark,
432
- isCurrent
433
- } = props;
434
- const DARK = theme.palette.black;
435
- const LIGHT = theme.palette.white;
436
- let currentColor;
437
- let hoverColor;
438
- if (isCurrent) {
439
- if (isLight) {
440
- currentColor = rgba(DARK, 0.4);
441
- } else if (isDark) {
442
- currentColor = rgba(LIGHT, 0.4);
443
- } else {
444
- currentColor = getColorV8(hue, 500, theme);
445
- }
446
- } else {
447
- hoverColor = rgba(isLight ? LIGHT : DARK, 0.1);
448
- }
449
- const activeColor = rgba(isLight ? DARK : LIGHT, 0.1);
450
- const focusColor = isLight ? DARK : LIGHT;
451
- return css(["opacity:", ";outline-color:transparent;background-color:", ";&:hover{opacity:1;background-color:", ";}", " &:active{background-color:", ";}"], isCurrent ? 1 : 0.6, currentColor, hoverColor, focusStyles({
452
- theme,
453
- condition: false ,
454
- styles: {
455
- opacity: 1,
456
- outlineColor: focusColor
457
- }
458
- }), activeColor);
459
- };
460
- const StyledNavItem = styled(StyledBaseNavItem).attrs({
461
- 'data-garden-id': COMPONENT_ID$f,
462
- 'data-garden-version': '9.0.0-next.7',
463
- as: 'button'
464
- }).withConfig({
465
- displayName: "StyledNavItem",
466
- componentId: "sc-gs8mjz-0"
467
- })(["justify-content:", ";order:1;margin:0;cursor:", ";text-align:", ";&:hover,&:focus{text-decoration:none;color:inherit;}", ";&:focus-visible:hover,&:focus-visible:active,", "{outline:", " solid;outline-offset:-", ";}", " ", ";"], props => props.isExpanded && 'start', props => props.isCurrent ? 'default' : 'pointer', props => props.isExpanded && 'inherit', colorStyles$3, SELECTOR_FOCUS_VISIBLE, props => math(`${props.theme.borderWidths.md} - 1`), props => props.theme.borderWidths.md, props => props.isExpanded && `
468
- ${StyledNavItemIcon} {
469
- margin: 0 ${math(`(${getNavWidth(props)} - ${props.theme.iconSizes.lg}) / 4`)};
470
- }
471
- `, props => retrieveComponentStyles(COMPONENT_ID$f, props));
472
- StyledNavItem.defaultProps = {
473
- theme: DEFAULT_THEME
474
- };
475
-
476
- const COMPONENT_ID$e = 'chrome.nav_item_text';
477
- const StyledNavItemText = styled.span.attrs({
478
- 'data-garden-id': COMPONENT_ID$e,
479
- 'data-garden-version': '9.0.0-next.7'
480
- }).withConfig({
481
- displayName: "StyledNavItemText",
482
- componentId: "sc-13m84xl-0"
483
- })(["position:absolute;order:1;clip:rect(1px,1px,1px,1px);margin:", ";width:1px;height:1px;overflow:hidden;line-height:", ";white-space:", ";", " ", ";"], props => props.isExpanded && `0 ${math(`(${getNavWidth(props)} - ${props.theme.iconSizes.lg}) / 4`)}`, props => getLineHeight(props.theme.space.base * 5, props.theme.fontSizes.md), props => props.isWrapped ? 'normal' : 'nowrap', props => props.isExpanded && `
484
- ${StyledNavItem} > && {
485
- position: static;
486
- flex: 1;
487
- clip: auto;
488
- width: auto;
489
- height: auto;
490
- text-overflow: ellipsis;
491
- }
492
- `, props => retrieveComponentStyles(COMPONENT_ID$e, props));
493
- StyledNavItemText.defaultProps = {
494
- theme: DEFAULT_THEME
495
- };
496
-
497
- const COMPONENT_ID$d = 'chrome.subnav_item';
498
- const colorStyles$2 = props => {
499
- const {
500
- theme,
501
- isLight,
502
- isCurrent
503
- } = props;
504
- const DARK = theme.palette.black;
505
- const LIGHT = theme.palette.white;
506
- let currentColor;
507
- let hoverColor;
508
- if (isCurrent) {
509
- if (isLight) {
510
- currentColor = rgba(DARK, 0.1);
511
- } else {
512
- currentColor = rgba(LIGHT, 0.1);
513
- }
514
- } else {
515
- hoverColor = rgba(isLight ? LIGHT : DARK, 0.1);
516
- }
517
- const activeColor = rgba(isLight ? DARK : LIGHT, 0.03);
518
- return css(["opacity:", ";background-color:", ";&:hover{opacity:1;background-color:", ";}", " &:not([data-garden-header='true']):active{background-color:", ";}"], isCurrent ? '1' : '0.6', currentColor, hoverColor, focusStyles({
519
- theme,
520
- hue: isLight ? DARK : LIGHT,
521
- spacerWidth: null,
522
- styles: {
523
- opacity: 1
524
- }
525
- }), activeColor);
526
- };
527
- const getSubNavItemHeight = props => {
528
- return `${props.theme.space.base * 7.5}px`;
529
- };
530
- const StyledSubNavItem = styled.button.attrs({
531
- 'data-garden-id': COMPONENT_ID$d,
532
- 'data-garden-version': '9.0.0-next.7'
533
- }).withConfig({
534
- displayName: "StyledSubNavItem",
535
- componentId: "sc-1yg9dpx-0"
536
- })(["display:flex;align-items:center;transition:box-shadow 0.1s ease-in-out,background-color 0.1s ease-in-out,opacity 0.1s ease-in-out;margin:", "px 0 0;border:none;border-radius:", ";box-sizing:border-box;background:transparent;cursor:", ";padding:", ";width:100%;min-height:", ";text-align:inherit;font-size:inherit;&,&:hover,&:focus{text-decoration:none;color:inherit;}", ";", ";"], props => props.theme.space.base * 2, props => props.theme.borderRadii.md, props => props.isCurrent ? 'default' : 'pointer', props => `0 ${props.theme.space.base * 2}px`, getSubNavItemHeight, props => colorStyles$2(props), props => retrieveComponentStyles(COMPONENT_ID$d, props));
537
- StyledSubNavItem.defaultProps = {
538
- theme: DEFAULT_THEME
539
- };
540
-
541
- const COMPONENT_ID$c = 'chrome.subnav';
542
- const colorStyles$1 = props => {
543
- let shade;
544
- if (props.isLight) {
545
- shade = 500;
546
- } else {
547
- shade = props.isDark ? 700 : 800;
548
- }
549
- const backgroundColor = getColorV8(props.hue, shade, props.theme);
550
- const foregroundColor = props.isLight ? props.theme.palette.grey[800] : props.theme.palette.white;
551
- return css(["background-color:", ";color:", ";"], backgroundColor, foregroundColor);
552
- };
553
- const StyledSubNav = styled.nav.attrs({
554
- 'data-garden-id': COMPONENT_ID$c,
555
- 'data-garden-version': '9.0.0-next.7'
556
- }).withConfig({
557
- displayName: "StyledSubNav",
558
- componentId: "sc-19hjou6-0"
559
- })(["flex-direction:column;order:0;padding:", ";min-width:220px;overflow:auto;font-size:", ";", ";& > ", ":first-child{margin-top:0;}", ";"], props => `${props.theme.space.base * 6}px ${props.theme.space.base * 5}px`, props => props.theme.fontSizes.md, props => colorStyles$1(props), StyledSubNavItem, props => retrieveComponentStyles('chrome.subnav', props));
560
- StyledSubNav.defaultProps = {
561
- theme: DEFAULT_THEME
562
- };
563
-
564
- const COMPONENT_ID$b = 'chrome.subnav_item_text';
565
- const sizeStyles = props => {
566
- const baseLineHeight = props.theme.space.base * 5;
567
- const verticalMargin = math(`(${getSubNavItemHeight(props)} - ${baseLineHeight}) / 2`);
568
- const lineHeight = getLineHeight(baseLineHeight, props.theme.fontSizes.md);
569
- return css(["margin:", " 0;line-height:", ";"], verticalMargin, lineHeight);
570
- };
571
- const StyledSubNavItemText = styled.span.attrs({
572
- 'data-garden-id': COMPONENT_ID$b,
573
- 'data-garden-version': '9.0.0-next.7'
574
- }).withConfig({
575
- displayName: "StyledSubNavItemText",
576
- componentId: "sc-1hy0pn7-0"
577
- })(["overflow:hidden;text-overflow:ellipsis;white-space:", ";", " ", ";"], props => props.isWrapped ? 'normal' : 'nowrap', props => sizeStyles(props), props => retrieveComponentStyles(COMPONENT_ID$b, props));
578
- StyledSubNavItemText.defaultProps = {
579
- theme: DEFAULT_THEME
580
- };
581
-
582
- const COMPONENT_ID$a = 'chrome.collapsible_sub_nav_item';
583
- const StyledSubNavItemHeader = styled(StyledSubNavItem).attrs({
584
- 'data-garden-id': COMPONENT_ID$a,
585
- 'data-garden-version': '9.0.0-next.7',
586
- 'data-garden-header': 'true'
587
- }).withConfig({
588
- displayName: "StyledSubNavItemHeader",
589
- componentId: "sc-1vniter-0"
590
- })(["position:relative;padding-", ":", "px;", ";"], props => props.theme.rtl ? 'left' : 'right', props => props.theme.space.base * 7, props => retrieveComponentStyles(COMPONENT_ID$a, props));
591
- StyledSubNavItemHeader.defaultProps = {
592
- theme: DEFAULT_THEME
593
- };
594
-
595
- var _path$1;
596
- function _extends$1() { _extends$1 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$1.apply(this, arguments); }
597
- var SvgChevronDownStroke = function SvgChevronDownStroke(props) {
598
- return /*#__PURE__*/React.createElement("svg", _extends$1({
599
- xmlns: "http://www.w3.org/2000/svg",
600
- width: 12,
601
- height: 12,
602
- focusable: "false",
603
- viewBox: "0 0 12 12",
604
- "aria-hidden": "true"
605
- }, props), _path$1 || (_path$1 = /*#__PURE__*/React.createElement("path", {
606
- fill: "currentColor",
607
- d: "M1.646 3.646a.5.5 0 01.638-.057l.07.057L6 7.293l3.646-3.647a.5.5 0 01.638-.057l.07.057a.5.5 0 01.057.638l-.057.07-4 4a.5.5 0 01-.638.057l-.07-.057-4-4a.5.5 0 010-.708z"
608
- })));
609
- };
610
-
611
- const COMPONENT_ID$9 = 'chrome.collapsible_sub_nav_item_icon';
612
- const FilteredChevronDownStrokeIcon = React__default.forwardRef((_ref, ref) => {
613
- let {
614
- theme,
615
- isExpanded,
616
- ...validProps
617
- } = _ref;
618
- return React__default.createElement(SvgChevronDownStroke, _extends$3({
619
- ref: ref
620
- }, validProps));
621
- });
622
- FilteredChevronDownStrokeIcon.displayName = 'FilteredChevronDownStrokeIcon';
623
- const StyledSubNavItemIcon = styled(FilteredChevronDownStrokeIcon).withConfig({
624
- displayName: "StyledSubNavItemIcon",
625
- componentId: "sc-1d02hho-0"
626
- })(["width:", ";height:", ";"], props => props.theme.iconSizes.sm, props => props.theme.iconSizes.sm);
627
- StyledSubNavItemIcon.defaultProps = {
628
- theme: DEFAULT_THEME
629
- };
630
- const StyledSubNavItemIconWrapper = styled.div.attrs({
631
- 'data-garden-id': COMPONENT_ID$9,
632
- 'data-garden-version': '9.0.0-next.7'
633
- }).withConfig({
634
- displayName: "StyledSubNavItemIcon__StyledSubNavItemIconWrapper",
635
- componentId: "sc-1d02hho-1"
636
- })(["display:flex;position:absolute;top:0;right:", ";left:", ";align-items:center;justify-content:center;width:", "px;height:", ";", "{transform:", ";transition:transform 0.25s ease-in-out;}", ";"], props => props.theme.rtl ? 'auto' : 0, props => props.theme.rtl && 0, props => props.theme.space.base * 7, getSubNavItemHeight, StyledSubNavItemIcon, props => props.isExpanded && `rotate(${props.theme.rtl ? '-' : ''}180deg)`, props => retrieveComponentStyles(COMPONENT_ID$9, props));
637
- StyledSubNavItemIconWrapper.defaultProps = {
638
- theme: DEFAULT_THEME
639
- };
640
-
641
- const PANEL_COMPONENT_ID = 'chrome.collapsible_sub_nav_item_panel';
642
- const hiddenStyling = css(["visibility:hidden;max-height:0 !important;overflow:hidden;"]);
643
- const StyledSubNavPanel = styled.div.attrs({
644
- 'data-garden-id': PANEL_COMPONENT_ID,
645
- 'data-garden-version': '9.0.0-next.7'
646
- }).withConfig({
647
- displayName: "StyledSubNavPanel",
648
- componentId: "sc-1jv3rpv-0"
649
- })(["transition:max-height 0.25s cubic-bezier(0.15,0.85,0.35,1.2),0.25s visibility 0s linear;height:auto;max-height:100%;", " ", "{padding-", ":", ";}", ";"], props => props.isHidden && hiddenStyling, StyledSubNavItem, props => props.theme.rtl ? 'right' : 'left', props => `${props.theme.space.base * 5}px`, props => retrieveComponentStyles(PANEL_COMPONENT_ID, props));
650
- StyledSubNavPanel.defaultProps = {
651
- theme: DEFAULT_THEME
652
- };
653
-
654
- const COMPONENT_ID$8 = 'chrome.sheet';
655
- const borderStyle = _ref => {
656
- let {
657
- theme,
658
- placement,
659
- isOpen
660
- } = _ref;
661
- const borderColor = isOpen ? getColorV8('neutralHue', 300, theme) : 'transparent';
662
- const borderSides = ['-left', '-right'];
663
- let borderSide = '';
664
- if (theme.rtl) {
665
- borderSides.reverse();
666
- }
667
- if (placement === 'end') {
668
- borderSide = borderSides[0];
669
- } else if (placement === 'start') {
670
- borderSide = borderSides[1];
671
- }
672
- return `border${borderSide}: ${theme.borders.sm} ${borderColor};`;
673
- };
674
- const StyledSheet = styled.aside.attrs({
675
- 'data-garden-id': COMPONENT_ID$8,
676
- 'data-garden-version': '9.0.0-next.7'
677
- }).withConfig({
678
- displayName: "StyledSheet",
679
- componentId: "sc-dx8ijk-0"
680
- })(["display:flex;order:1;transition:", ";background-color:", ";width:", ";height:100%;overflow:hidden;font-size:", ";&:focus{outline:none;}", ";", ";"], props => props.isAnimated && 'width 250ms ease-in-out', props => getColorV8('background', 600 , props.theme), props => props.isOpen ? props.size : '0px', props => props.theme.fontSizes.md, props => borderStyle(props), props => retrieveComponentStyles(COMPONENT_ID$8, props));
681
- StyledSheet.defaultProps = {
682
- theme: DEFAULT_THEME
683
- };
684
-
685
- const COMPONENT_ID$7 = 'chrome.sheet_wrapper';
686
- const StyledSheetWrapper = styled.div.attrs({
687
- 'data-garden-id': COMPONENT_ID$7,
688
- 'data-garden-version': '9.0.0-next.7'
689
- }).withConfig({
690
- displayName: "StyledSheetWrapper",
691
- componentId: "sc-f6x9zb-0"
692
- })(["display:flex;position:relative;flex-direction:column;transform:", ";transition:", ";min-width:", ";", ";"], props => {
693
- const translateValues = [-100, 100];
694
- let translation = 'translateX(0%)';
695
- if (props.isOpen) {
696
- return translation;
697
- }
698
- if (props.theme.rtl) {
699
- translateValues.reverse();
700
- }
701
- if (props.placement === 'end') {
702
- translation = `translateX(${translateValues[1]}%)`;
703
- } else if (props.placement === 'start') {
704
- translation = `translateX(${translateValues[0]}%)`;
705
- }
706
- return translation;
707
- }, props => props.isAnimated && 'transform 250ms ease-in-out', props => props.size, props => retrieveComponentStyles(COMPONENT_ID$7, props));
708
- StyledSheetWrapper.defaultProps = {
709
- theme: DEFAULT_THEME
710
- };
711
-
712
- const COMPONENT_ID$6 = 'chrome.sheet_title';
713
- const StyledSheetTitle = styled.div.attrs({
714
- 'data-garden-id': COMPONENT_ID$6,
715
- 'data-garden-version': '9.0.0-next.7'
716
- }).withConfig({
717
- displayName: "StyledSheetTitle",
718
- componentId: "sc-1gogk75-0"
719
- })(["line-height:", ";color:", ";font-weight:", ";", ";"], props => getLineHeight(props.theme.space.base * 5, props.theme.fontSizes.md), props => getColorV8('foreground', 600 , props.theme), props => props.theme.fontWeights.semibold, props => retrieveComponentStyles(COMPONENT_ID$6, props));
720
- StyledSheetTitle.defaultProps = {
721
- theme: DEFAULT_THEME
722
- };
723
-
724
- const COMPONENT_ID$5 = 'chrome.sheet_description';
725
- const StyledSheetDescription = styled.div.attrs({
726
- 'data-garden-id': COMPONENT_ID$5,
727
- 'data-garden-version': '9.0.0-next.7'
728
- }).withConfig({
729
- displayName: "StyledSheetDescription",
730
- componentId: "sc-1puglb6-0"
731
- })(["line-height:", ";color:", ";", ";"], props => getLineHeight(props.theme.space.base * 4, props.theme.fontSizes.md), props => getColorV8('neutralHue', 600, props.theme), props => retrieveComponentStyles(COMPONENT_ID$5, props));
732
- StyledSheetDescription.defaultProps = {
733
- theme: DEFAULT_THEME
734
- };
735
-
736
- const COMPONENT_ID$4 = 'chrome.sheet_body';
737
- const StyledSheetBody = styled.div.attrs({
738
- 'data-garden-id': COMPONENT_ID$4,
739
- 'data-garden-version': '9.0.0-next.7'
740
- }).withConfig({
741
- displayName: "StyledSheetBody",
742
- componentId: "sc-bt4eoj-0"
743
- })(["flex:1;overflow-y:auto;padding:", "px;", ";"], props => props.theme.space.base * 5, props => retrieveComponentStyles(COMPONENT_ID$4, props));
744
- StyledSheetBody.defaultProps = {
745
- theme: DEFAULT_THEME
746
- };
747
-
748
- const COMPONENT_ID$3 = 'chrome.sheet_close';
749
- const BASE_MULTIPLIERS = {
750
- top: 2.5,
751
- side: 2,
752
- size: 10
753
- };
754
- const colorStyles = props => {
755
- const backgroundColor = 'primaryHue';
756
- const foregroundColor = 'neutralHue';
757
- return css(["background-color:transparent;color:", ";&:hover{background-color:", ";color:", ";}", " &:active{transition:background-color 0.1s ease-in-out,color 0.1s ease-in-out;background-color:", ";color:", ";}"], getColorV8(foregroundColor, 600, props.theme), getColorV8(backgroundColor, 600, props.theme, 0.08), getColorV8(foregroundColor, 700, props.theme), focusStyles({
758
- theme: props.theme
759
- }), getColorV8(backgroundColor, 600, props.theme, 0.2), getColorV8(foregroundColor, 800, props.theme));
760
- };
761
- const StyledSheetClose = styled.button.attrs({
762
- 'data-garden-id': COMPONENT_ID$3,
763
- 'data-garden-version': '9.0.0-next.7'
764
- }).withConfig({
765
- displayName: "StyledSheetClose",
766
- componentId: "sc-1ab02oq-0"
767
- })(["display:flex;position:absolute;top:", "px;", ":", ";align-items:center;justify-content:center;transition:box-shadow 0.1s ease-in-out,background-color 0.25s ease-in-out,color 0.25s ease-in-out;border:none;border-radius:50%;cursor:pointer;padding:0;width:", "px;height:", "px;overflow:hidden;text-decoration:none;font-size:0;user-select:none;&::-moz-focus-inner{border:0;}", ";& > svg{vertical-align:middle;}", ";"], props => props.theme.space.base * BASE_MULTIPLIERS.top, props => props.theme.rtl ? 'left' : 'right', props => `${props.theme.space.base * BASE_MULTIPLIERS.side}px`, props => props.theme.space.base * BASE_MULTIPLIERS.size, props => props.theme.space.base * BASE_MULTIPLIERS.size, props => colorStyles(props), props => retrieveComponentStyles(COMPONENT_ID$3, props));
768
- StyledSheetClose.defaultProps = {
769
- theme: DEFAULT_THEME
770
- };
771
-
772
- const COMPONENT_ID$2 = 'chrome.sheet_footer';
773
- const StyledSheetFooter = styled.footer.attrs({
774
- 'data-garden-id': COMPONENT_ID$2,
775
- 'data-garden-version': '9.0.0-next.7'
776
- }).withConfig({
777
- displayName: "StyledSheetFooter",
778
- componentId: "sc-2cktos-0"
779
- })(["display:flex;flex-flow:row wrap;align-items:center;justify-content:", ";border-top:", ";padding:", "px;", ";"], props => props.isCompact ? 'center' : 'flex-end', props => `${props.theme.borders.sm} ${getColorV8('neutralHue', 300, props.theme)}}`, props => props.theme.space.base * (props.isCompact ? 2.5 : 5), props => retrieveComponentStyles(COMPONENT_ID$2, props));
780
- StyledSheetFooter.defaultProps = {
781
- theme: DEFAULT_THEME
782
- };
783
-
784
- const COMPONENT_ID$1 = 'chrome.sheet_footer_item';
785
- const StyledSheetFooterItem = styled.div.attrs({
786
- 'data-garden-id': COMPONENT_ID$1,
787
- 'data-garden-version': '9.0.0-next.7'
788
- }).withConfig({
789
- displayName: "StyledSheetFooterItem",
790
- componentId: "sc-r9ixh-0"
791
- })(["", " ", ";"], props => `margin-${props.theme.rtl ? 'right' : 'left'}: ${props.theme.space.base * 5}px;`, props => retrieveComponentStyles(COMPONENT_ID$1, props));
792
- StyledSheetFooterItem.defaultProps = {
793
- theme: DEFAULT_THEME
794
- };
795
-
796
- const COMPONENT_ID = 'chrome.sheet_header';
797
- const StyledSheetHeader = styled.header.attrs({
798
- 'data-garden-id': COMPONENT_ID,
799
- 'data-garden-version': '9.0.0-next.7'
800
- }).withConfig({
801
- displayName: "StyledSheetHeader",
802
- componentId: "sc-o2ry8i-0"
803
- })(["border-bottom:", ";padding:", "px;", " ", ";"], props => `${props.theme.borders.sm} ${getColorV8('neutralHue', 300, props.theme)}}`, props => props.theme.space.base * 5, props => props.isCloseButtonPresent && `padding-${props.theme.rtl ? 'left' : 'right'}: ${props.theme.space.base * (BASE_MULTIPLIERS.size + BASE_MULTIPLIERS.side + 2)}px;`, props => retrieveComponentStyles(COMPONENT_ID, props));
804
- StyledSheetHeader.defaultProps = {
805
- theme: DEFAULT_THEME
806
- };
807
-
808
- const HeaderItem = React__default.forwardRef((_ref, ref) => {
809
- let {
810
- hasLogo,
811
- product,
812
- ...other
813
- } = _ref;
814
- if (hasLogo) {
815
- return React__default.createElement(StyledLogoHeaderItem, _extends$3({
816
- ref: ref,
817
- product: product
818
- }, other));
819
- }
820
- return React__default.createElement(StyledHeaderItem, _extends$3({
821
- ref: ref
822
- }, other));
823
- });
824
- HeaderItem.displayName = 'HeaderItem';
825
- HeaderItem.propTypes = {
826
- maxX: PropTypes.bool,
827
- maxY: PropTypes.bool,
828
- isRound: PropTypes.bool,
829
- product: PropTypes.oneOf(PRODUCTS),
830
- hasLogo: PropTypes.bool
831
- };
832
-
833
- const HeaderItemIcon = _ref => {
834
- let {
835
- children,
836
- ...props
837
- } = _ref;
838
- const element = Children.only(children);
839
- if ( isValidElement(element)) {
840
- const Icon = _ref2 => {
841
- let {
842
- theme,
843
- ...iconProps
844
- } = _ref2;
845
- return cloneElement(element, {
846
- ...props,
847
- ...iconProps
848
- });
849
- };
850
- return React__default.createElement(StyledHeaderItemIcon, _extends$3({
851
- as: Icon
852
- }, props));
853
- }
854
- return null;
855
- };
856
-
857
- const HeaderItemText = React__default.forwardRef((props, ref) => React__default.createElement(StyledHeaderItemText, _extends$3({
858
- ref: ref
859
- }, props)));
860
- HeaderItemText.displayName = 'HeaderItemText';
861
- HeaderItemText.propTypes = {
862
- isClipped: PropTypes.bool
863
- };
864
-
865
- const HeaderItemWrapper = React__default.forwardRef((props, ref) => React__default.createElement(StyledHeaderItemWrapper, _extends$3({
866
- ref: ref
867
- }, props)));
868
- HeaderItemWrapper.displayName = 'HeaderItemWrapper';
869
-
870
- const FooterItem$1 = React__default.forwardRef((props, ref) => React__default.createElement(StyledFooterItem, _extends$3({
871
- ref: ref
872
- }, props)));
873
- FooterItem$1.displayName = 'FooterItem';
874
-
875
- const NavContext = React__default.createContext({
876
- isExpanded: false
877
- });
878
- const useNavContext = () => {
879
- return useContext(NavContext);
880
- };
881
-
882
- const ChromeContext = React__default.createContext({
883
- hue: 'chromeHue'
884
- });
885
- const useChromeContext = () => {
886
- return useContext(ChromeContext);
887
- };
888
-
889
- const NavItem = React__default.forwardRef((_ref, ref) => {
890
- let {
891
- hasLogo,
892
- hasBrandmark,
893
- product,
894
- ...other
895
- } = _ref;
896
- const {
897
- hue,
898
- isLight,
899
- isDark
900
- } = useChromeContext();
901
- const {
902
- isExpanded
903
- } = useNavContext();
904
- const ariaCurrent = other.isCurrent || undefined;
905
- if (hasLogo) {
906
- return React__default.createElement(StyledLogoNavItem, _extends$3({
907
- ref: ref,
908
- isDark: isDark,
909
- isLight: isLight,
910
- product: product,
911
- "aria-current": ariaCurrent
912
- }, other));
913
- }
914
- if (hasBrandmark) {
915
- return React__default.createElement(StyledBrandmarkNavItem, _extends$3({
916
- ref: ref
917
- }, other));
918
- }
919
- return React__default.createElement(StyledNavItem, _extends$3({
920
- tabIndex: 0,
921
- ref: ref,
922
- isExpanded: isExpanded,
923
- hue: hue,
924
- isDark: isDark,
925
- isLight: isLight,
926
- "aria-current": ariaCurrent
927
- }, other));
928
- });
929
- NavItem.displayName = 'NavItem';
930
- NavItem.propTypes = {
931
- product: PropTypes.oneOf(PRODUCTS),
932
- hasLogo: PropTypes.bool,
933
- hasBrandmark: PropTypes.bool
934
- };
935
-
936
- const NavItemIcon = _ref => {
937
- let {
938
- children,
939
- ...props
940
- } = _ref;
941
- const element = Children.only(children);
942
- if ( isValidElement(element)) {
943
- const Icon = _ref2 => {
944
- let {
945
- theme,
946
- ...iconProps
947
- } = _ref2;
948
- return cloneElement(element, {
949
- ...props,
950
- ...iconProps
951
- });
952
- };
953
- return React__default.createElement(StyledNavItemIcon, _extends$3({
954
- as: Icon
955
- }, props));
956
- }
957
- return null;
958
- };
959
-
960
- const NavItemText = React__default.forwardRef((props, ref) => {
961
- const {
962
- isExpanded
963
- } = useNavContext();
964
- return React__default.createElement(StyledNavItemText, _extends$3({
965
- ref: ref,
966
- isExpanded: isExpanded
967
- }, props));
968
- });
969
- NavItemText.displayName = 'NavItemText';
970
- NavItemText.propTypes = {
971
- isWrapped: PropTypes.bool
972
- };
973
-
974
- const SubNavItem = React__default.forwardRef((props, ref) => {
975
- const {
976
- isDark,
977
- isLight
978
- } = useChromeContext();
979
- return React__default.createElement(StyledSubNavItem, _extends$3({
980
- ref: ref,
981
- isDark: isDark,
982
- isLight: isLight
983
- }, props));
984
- });
985
- SubNavItem.displayName = 'SubNavItem';
986
- SubNavItem.propTypes = {
987
- isCurrent: PropTypes.bool
988
- };
989
-
990
- const SubNavItemText = React__default.forwardRef((props, ref) => React__default.createElement(StyledSubNavItemText, _extends$3({
991
- ref: ref
992
- }, props)));
993
- SubNavItemText.displayName = 'SubNavItemText';
994
- SubNavItemText.propTypes = {
995
- isWrapped: PropTypes.bool
996
- };
997
-
998
- const CollapsibleSubNavItem = React__default.forwardRef((_ref, ref) => {
999
- let {
1000
- header,
1001
- children,
1002
- isExpanded: controlledExpanded,
1003
- onChange,
1004
- ...other
1005
- } = _ref;
1006
- const {
1007
- isDark,
1008
- isLight
1009
- } = useChromeContext();
1010
- const panelRef = createRef();
1011
- const [internalExpanded, setInternalExpanded] = useState(controlledExpanded);
1012
- const expanded = getControlledValue(controlledExpanded, internalExpanded);
1013
- const value = 0;
1014
- const expandedSections = expanded ? [value] : [];
1015
- const {
1016
- getHeaderProps,
1017
- getTriggerProps,
1018
- getPanelProps
1019
- } = useAccordion({
1020
- sections: [value],
1021
- expandedSections,
1022
- onChange: () => {
1023
- const isExpanded = expandedSections.length === 0;
1024
- if (onChange) {
1025
- onChange(isExpanded);
1026
- } else {
1027
- setInternalExpanded(isExpanded);
1028
- }
1029
- }
1030
- });
1031
- useEffect(() => {
1032
- if (expanded && panelRef.current) {
1033
- panelRef.current.style.maxHeight = `${panelRef.current.scrollHeight}px`;
1034
- }
1035
- }, [expanded, children, panelRef]);
1036
- return React__default.createElement("div", {
1037
- ref: ref
1038
- }, React__default.createElement("div", getHeaderProps({
1039
- 'aria-level': 2
1040
- }), React__default.createElement(StyledSubNavItemHeader, _extends$3({
1041
- isDark: isDark,
1042
- isLight: isLight,
1043
- isExpanded: expanded
1044
- }, getTriggerProps({
1045
- ...other,
1046
- role: null,
1047
- tabIndex: null,
1048
- value
1049
- }), {
1050
- type: "button"
1051
- }), React__default.createElement(React__default.Fragment, null, header, React__default.createElement(StyledSubNavItemIconWrapper, {
1052
- isExpanded: expanded
1053
- }, React__default.createElement(StyledSubNavItemIcon, null))))), React__default.createElement(StyledSubNavPanel, _extends$3({
1054
- isHidden: !expanded
1055
- }, getPanelProps({
1056
- ref: panelRef,
1057
- value
1058
- })), children));
1059
- });
1060
- CollapsibleSubNavItem.propTypes = {
1061
- header: PropTypes.any,
1062
- isExpanded: PropTypes.bool,
1063
- onChange: PropTypes.func
1064
- };
1065
- CollapsibleSubNavItem.displayName = 'CollapsibleSubNavItem';
1066
-
1067
- const Chrome = React__default.forwardRef((_ref, ref) => {
1068
- let {
1069
- hue,
1070
- isFluid,
1071
- ...props
1072
- } = _ref;
1073
- const theme = useContext(ThemeContext);
1074
- const isLightMemoized = useMemo(() => {
1075
- if (hue) {
1076
- const backgroundColor = getColorV8(hue, 600, theme);
1077
- const LIGHT_COLOR = 'white';
1078
- return readableColor(backgroundColor, LIGHT_COLOR, undefined, false ) === LIGHT_COLOR;
1079
- }
1080
- return false;
1081
- }, [hue, theme]);
1082
- const isLight = hue ? isLightMemoized : false;
1083
- const isDark = hue ? !isLightMemoized : false;
1084
- const chromeContextValue = useMemo(() => ({
1085
- hue: hue || 'chromeHue',
1086
- isLight,
1087
- isDark
1088
- }), [hue, isLight, isDark]);
1089
- const environment = useDocument(theme);
1090
- useEffect(() => {
1091
- if (environment && !isFluid) {
1092
- const htmlElement = environment.querySelector('html');
1093
- if (htmlElement) {
1094
- const defaultHtmlPosition = htmlElement.style.position;
1095
- htmlElement.style.position = 'fixed';
1096
- return () => {
1097
- htmlElement.style.position = defaultHtmlPosition;
1098
- };
1099
- }
1100
- }
1101
- return undefined;
1102
- }, [environment, isFluid]);
1103
- return React__default.createElement(ChromeContext.Provider, {
1104
- value: chromeContextValue
1105
- }, React__default.createElement(StyledChrome, _extends$3({
1106
- ref: ref
1107
- }, props)));
1108
- });
1109
- Chrome.displayName = 'Chrome';
1110
- Chrome.propTypes = {
1111
- hue: PropTypes.string
1112
- };
1113
-
1114
- const SkipNav = React__default.forwardRef((_ref, ref) => {
1115
- let {
1116
- targetId,
1117
- zIndex,
1118
- children,
1119
- ...props
1120
- } = _ref;
1121
- return React__default.createElement(StyledSkipNav, _extends$3({
1122
- href: `#${targetId}`,
1123
- zIndex: zIndex,
1124
- ref: ref
1125
- }, props), React__default.createElement(StyledSkipNavIcon, null), children);
1126
- });
1127
- SkipNav.displayName = 'SkipNav';
1128
- SkipNav.propTypes = {
1129
- targetId: PropTypes.string.isRequired,
1130
- zIndex: PropTypes.number
1131
- };
1132
- SkipNav.defaultProps = {
1133
- zIndex: 1
1134
- };
1135
-
1136
- const BodyContext = React__default.createContext(undefined);
1137
- const useBodyContext = () => {
1138
- return useContext(BodyContext);
1139
- };
1140
-
1141
- const Body$1 = React__default.forwardRef((props, ref) => {
1142
- const [hasFooter, setHasFooter] = useState(false);
1143
- const bodyContextValue = useMemo(() => ({
1144
- hasFooter,
1145
- setHasFooter
1146
- }), [hasFooter, setHasFooter]);
1147
- return React__default.createElement(BodyContext.Provider, {
1148
- value: bodyContextValue
1149
- }, React__default.createElement(StyledBody, _extends$3({
1150
- ref: ref
1151
- }, props)));
1152
- });
1153
- Body$1.displayName = 'Body';
1154
-
1155
- const Content = React__default.forwardRef((props, ref) => {
1156
- const {
1157
- hasFooter
1158
- } = useBodyContext() || {};
1159
- return React__default.createElement(StyledContent, _extends$3({
1160
- ref: ref,
1161
- hasFooter: hasFooter
1162
- }, props));
1163
- });
1164
- Content.displayName = 'Content';
1165
-
1166
- const Main = React__default.forwardRef((props, ref) => React__default.createElement(StyledMain, _extends$3({
1167
- ref: ref
1168
- }, props)));
1169
- Main.displayName = 'Main';
1170
-
1171
- const HeaderComponent = React__default.forwardRef((props, ref) => React__default.createElement(StyledHeader, _extends$3({
1172
- ref: ref
1173
- }, props)));
1174
- HeaderComponent.displayName = 'Header';
1175
- HeaderComponent.propTypes = {
1176
- isStandalone: PropTypes.bool
1177
- };
1178
- const Header$1 = HeaderComponent;
1179
- Header$1.Item = HeaderItem;
1180
- Header$1.ItemIcon = HeaderItemIcon;
1181
- Header$1.ItemText = HeaderItemText;
1182
- Header$1.ItemWrapper = HeaderItemWrapper;
1183
-
1184
- const FooterComponent = React__default.forwardRef((props, ref) => {
1185
- const {
1186
- hasFooter,
1187
- setHasFooter
1188
- } = useBodyContext() || {};
1189
- useEffect(() => {
1190
- if (!hasFooter && setHasFooter) {
1191
- setHasFooter(true);
1192
- }
1193
- return () => {
1194
- if (hasFooter && setHasFooter) {
1195
- setHasFooter(false);
1196
- }
1197
- };
1198
- }, [hasFooter, setHasFooter]);
1199
- return React__default.createElement(StyledFooter, _extends$3({
1200
- ref: ref
1201
- }, props));
1202
- });
1203
- FooterComponent.displayName = 'Footer';
1204
- const Footer$1 = FooterComponent;
1205
- Footer$1.Item = FooterItem$1;
1206
-
1207
- const NavComponent = React__default.forwardRef((props, ref) => {
1208
- const {
1209
- hue,
1210
- isLight,
1211
- isDark
1212
- } = useChromeContext();
1213
- const navContextValue = useMemo(() => ({
1214
- isExpanded: !!props.isExpanded
1215
- }), [props.isExpanded]);
1216
- return React__default.createElement(NavContext.Provider, {
1217
- value: navContextValue
1218
- }, React__default.createElement(StyledNav, _extends$3({
1219
- ref: ref
1220
- }, props, {
1221
- hue: hue,
1222
- isLight: isLight,
1223
- isDark: isDark
1224
- })));
1225
- });
1226
- NavComponent.displayName = 'Nav';
1227
- NavComponent.propTypes = {
1228
- isExpanded: PropTypes.bool
1229
- };
1230
- const Nav = NavComponent;
1231
- Nav.Item = NavItem;
1232
- Nav.ItemIcon = NavItemIcon;
1233
- Nav.ItemText = NavItemText;
1234
-
1235
- const SubNavComponent = React__default.forwardRef((props, ref) => {
1236
- const {
1237
- hue,
1238
- isLight,
1239
- isDark
1240
- } = useChromeContext();
1241
- return React__default.createElement(StyledSubNav, _extends$3({
1242
- ref: ref,
1243
- hue: hue,
1244
- isLight: isLight,
1245
- isDark: isDark
1246
- }, props));
1247
- });
1248
- SubNavComponent.displayName = 'SubNav';
1249
- const SubNav = SubNavComponent;
1250
- SubNav.Item = SubNavItem;
1251
- SubNav.ItemText = SubNavItemText;
1252
- SubNav.CollapsibleItem = CollapsibleSubNavItem;
1253
-
1254
- const SheetContext = createContext({
1255
- setIsCloseButtonPresent() {}
1256
- });
1257
- const useSheetContext = () => {
1258
- return useContext(SheetContext);
1259
- };
1260
-
1261
- function useFocusableMount(_ref) {
1262
- let {
1263
- isMounted,
1264
- focusOnMount,
1265
- restoreFocus,
1266
- targetRef
1267
- } = _ref;
1268
- const triggerRef = useRef();
1269
- useEffect(() => {
1270
- if (isMounted && focusOnMount && targetRef.current) {
1271
- triggerRef.current = activeElement();
1272
- targetRef.current.focus();
1273
- }
1274
- }, [isMounted, focusOnMount, targetRef]);
1275
- useEffect(() => {
1276
- if (!isMounted && restoreFocus && triggerRef.current) {
1277
- triggerRef.current.focus();
1278
- }
1279
- }, [isMounted, restoreFocus, triggerRef]);
1280
- }
1281
-
1282
- const SheetTitle = forwardRef((_ref, ref) => {
1283
- let {
1284
- id,
1285
- ...props
1286
- } = _ref;
1287
- const {
1288
- titleId
1289
- } = useSheetContext();
1290
- return React__default.createElement(StyledSheetTitle, _extends$3({
1291
- id: id || titleId,
1292
- ref: ref
1293
- }, props));
1294
- });
1295
- SheetTitle.displayName = 'Sheet.Title';
1296
- const Title = SheetTitle;
1297
-
1298
- const SheetDescription = forwardRef((_ref, ref) => {
1299
- let {
1300
- id,
1301
- ...props
1302
- } = _ref;
1303
- const {
1304
- descriptionId
1305
- } = useSheetContext();
1306
- return React__default.createElement(StyledSheetDescription, _extends$3({
1307
- id: id || descriptionId,
1308
- ref: ref
1309
- }, props));
1310
- });
1311
- SheetDescription.displayName = 'Sheet.Description';
1312
- const Description = SheetDescription;
1313
-
1314
- const SheetHeader = forwardRef((props, ref) => {
1315
- const {
1316
- isCloseButtonPresent
1317
- } = useSheetContext();
1318
- return React__default.createElement(StyledSheetHeader, _extends$3({
1319
- ref: ref,
1320
- isCloseButtonPresent: isCloseButtonPresent
1321
- }, props));
1322
- });
1323
- SheetHeader.displayName = 'Sheet.Header';
1324
- const Header = SheetHeader;
1325
-
1326
- const SheetBody = forwardRef((props, ref) => {
1327
- return React__default.createElement(StyledSheetBody, _extends$3({
1328
- ref: ref
1329
- }, props));
1330
- });
1331
- SheetBody.displayName = 'Sheet.Body';
1332
- const Body = SheetBody;
1333
-
1334
- const SheetFooter = forwardRef((props, ref) => {
1335
- return React__default.createElement(StyledSheetFooter, _extends$3({
1336
- ref: ref
1337
- }, props));
1338
- });
1339
- SheetFooter.displayName = 'Sheet.Footer';
1340
- const Footer = SheetFooter;
1341
-
1342
- const SheetFooterItem = forwardRef((props, ref) => {
1343
- return React__default.createElement(StyledSheetFooterItem, _extends$3({
1344
- ref: ref
1345
- }, props));
1346
- });
1347
- SheetFooterItem.displayName = 'Sheet.FooterItem';
1348
- const FooterItem = SheetFooterItem;
1349
-
1350
- var _path;
1351
- function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
1352
- var SvgXStroke = function SvgXStroke(props) {
1353
- return /*#__PURE__*/React.createElement("svg", _extends({
1354
- xmlns: "http://www.w3.org/2000/svg",
1355
- width: 16,
1356
- height: 16,
1357
- focusable: "false",
1358
- viewBox: "0 0 16 16",
1359
- "aria-hidden": "true"
1360
- }, props), _path || (_path = /*#__PURE__*/React.createElement("path", {
1361
- stroke: "currentColor",
1362
- strokeLinecap: "round",
1363
- d: "M3 13L13 3m0 10L3 3"
1364
- })));
1365
- };
1366
-
1367
- const SheetClose = forwardRef((props, ref) => {
1368
- const {
1369
- setIsCloseButtonPresent
1370
- } = useSheetContext();
1371
- useEffect(() => {
1372
- setIsCloseButtonPresent(true);
1373
- return () => setIsCloseButtonPresent(false);
1374
- }, [setIsCloseButtonPresent]);
1375
- return React__default.createElement(StyledSheetClose, _extends$3({
1376
- "aria-label": "Close Sheet",
1377
- ref: ref
1378
- }, props), React__default.createElement(SvgXStroke, null));
1379
- });
1380
- SheetClose.displayName = 'Sheet.Close';
1381
- const Close = SheetClose;
1382
-
1383
- const SheetComponent = React__default.forwardRef((_ref, ref) => {
1384
- let {
1385
- id,
1386
- isOpen,
1387
- isAnimated,
1388
- focusOnMount,
1389
- restoreFocus,
1390
- placement,
1391
- size,
1392
- children,
1393
- ...props
1394
- } = _ref;
1395
- const sheetRef = useRef(null);
1396
- const seed = useUIDSeed();
1397
- const [isCloseButtonPresent, setIsCloseButtonPresent] = useState(false);
1398
- const idPrefix = useMemo(() => id || seed(`sheet_${'9.0.0-next.7'}`), [id, seed]);
1399
- const titleId = `${idPrefix}--title`;
1400
- const descriptionId = `${idPrefix}--description`;
1401
- const sheetContext = useMemo(() => ({
1402
- titleId,
1403
- descriptionId,
1404
- isCloseButtonPresent,
1405
- setIsCloseButtonPresent
1406
- }), [titleId, descriptionId, isCloseButtonPresent]);
1407
- useFocusableMount({
1408
- targetRef: sheetRef,
1409
- isMounted: isOpen,
1410
- focusOnMount,
1411
- restoreFocus
1412
- });
1413
- return React__default.createElement(SheetContext.Provider, {
1414
- value: sheetContext
1415
- }, React__default.createElement(StyledSheet, _extends$3({
1416
- isOpen: isOpen,
1417
- isAnimated: isAnimated,
1418
- placement: placement,
1419
- size: size,
1420
- tabIndex: -1,
1421
- id: idPrefix,
1422
- "aria-labelledby": titleId,
1423
- "aria-describedby": descriptionId,
1424
- ref: mergeRefs([sheetRef, ref])
1425
- }, props), React__default.createElement(StyledSheetWrapper, {
1426
- isOpen: isOpen,
1427
- isAnimated: isAnimated,
1428
- placement: placement,
1429
- size: size
1430
- }, children)));
1431
- });
1432
- SheetComponent.displayName = 'Sheet';
1433
- SheetComponent.propTypes = {
1434
- id: PropTypes.string,
1435
- isOpen: PropTypes.bool,
1436
- isAnimated: PropTypes.bool,
1437
- focusOnMount: PropTypes.bool,
1438
- restoreFocus: PropTypes.bool,
1439
- placement: PropTypes.oneOf(PLACEMENT),
1440
- size: PropTypes.string
1441
- };
1442
- SheetComponent.defaultProps = {
1443
- isAnimated: true,
1444
- placement: 'end',
1445
- size: '380px'
1446
- };
1447
- const Sheet = SheetComponent;
1448
- Sheet.Body = Body;
1449
- Sheet.Close = Close;
1450
- Sheet.Description = Description;
1451
- Sheet.Footer = Footer;
1452
- Sheet.FooterItem = FooterItem;
1453
- Sheet.Header = Header;
1454
- Sheet.Title = Title;
1455
-
1456
- export { Body$1 as Body, Chrome, CollapsibleSubNavItem, Content, Footer$1 as Footer, FooterItem$1 as FooterItem, Header$1 as Header, HeaderItem, HeaderItemIcon, HeaderItemText, HeaderItemWrapper, Main, Nav, NavItem, NavItemIcon, NavItemText, PRODUCTS, Sheet, SkipNav, SubNav, SubNavItem, SubNavItemText };