@zendeskgarden/react-chrome 9.0.0-next.6 → 9.0.0-next.8

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