@sproutsocial/seeds-react-panel 1.0.11 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -42,10 +42,8 @@ __export(index_exports, {
42
42
  });
43
43
  module.exports = __toCommonJS(index_exports);
44
44
 
45
- // src/Panel.tsx
46
- var React6 = __toESM(require("react"));
47
- var import_seeds_react_drawer2 = __toESM(require("@sproutsocial/seeds-react-drawer"));
48
- var import_seeds_react_hooks = require("@sproutsocial/seeds-react-hooks");
45
+ // src/PanelHybrid.tsx
46
+ var import_seeds_react_system_props4 = require("@sproutsocial/seeds-react-system-props");
49
47
 
50
48
  // src/PanelContext.tsx
51
49
  var React = __toESM(require("react"));
@@ -63,6 +61,7 @@ var usePanelContext = () => {
63
61
  // src/PanelHeader.tsx
64
62
  var import_seeds_react_box = __toESM(require("@sproutsocial/seeds-react-box"));
65
63
  var import_seeds_react_text = __toESM(require("@sproutsocial/seeds-react-text"));
64
+ var import_seeds_react_system_props = require("@sproutsocial/seeds-react-system-props");
66
65
 
67
66
  // src/PanelCloseButton.tsx
68
67
  var React2 = require("react");
@@ -87,45 +86,173 @@ var PanelCloseButton = (props) => {
87
86
  };
88
87
  PanelCloseButton.displayName = "Panel.CloseButton";
89
88
 
89
+ // src/PanelShared.tsx
90
+ var React3 = __toESM(require("react"));
91
+ var import_seeds_react_hooks = require("@sproutsocial/seeds-react-hooks");
92
+ function cn(...inputs) {
93
+ const classes = [];
94
+ for (const input of inputs) {
95
+ if (!input) continue;
96
+ if (typeof input === "string") {
97
+ classes.push(input);
98
+ } else if (typeof input === "object") {
99
+ for (const [key, value] of Object.entries(input)) {
100
+ if (value) {
101
+ classes.push(key);
102
+ }
103
+ }
104
+ }
105
+ }
106
+ return classes.join(" ");
107
+ }
108
+ var getPanelContainerStyle = (direction, width, gap, isPanelOpen) => {
109
+ const gapValue = isPanelOpen && gap ? `${gap}px` : "0px";
110
+ const style = {
111
+ flexBasis: isPanelOpen ? `${width}px` : "0px"
112
+ };
113
+ if (direction === "bottom") {
114
+ style.width = "100%";
115
+ } else {
116
+ style.alignSelf = "stretch";
117
+ }
118
+ if (direction === "right") {
119
+ style.marginLeft = gapValue;
120
+ } else if (direction === "left") {
121
+ style.marginRight = gapValue;
122
+ } else {
123
+ style.marginTop = gapValue;
124
+ }
125
+ return style;
126
+ };
127
+ var getPanelInnerStyle = (direction, width) => direction === "bottom" ? { minHeight: `${width}px`, width: "100%" } : { minWidth: `${width}px`, height: "100%" };
128
+ var usePanelShell = (props) => {
129
+ const {
130
+ children,
131
+ closeButtonLabel,
132
+ header,
133
+ headerless = false,
134
+ footer,
135
+ title,
136
+ titleId,
137
+ direction = "right",
138
+ width = 384,
139
+ gap = 4,
140
+ mobileBreakpoint,
141
+ zIndex,
142
+ id,
143
+ snapPoints,
144
+ defaultSnapPoint,
145
+ snapPoint,
146
+ onSnapPointChange,
147
+ snapToSequentialPoints,
148
+ actions,
149
+ actionsInHeader,
150
+ "aria-labelledby": ariaLabelledByProp,
151
+ "aria-label": ariaLabel,
152
+ ...rest
153
+ } = props;
154
+ const panelContext = usePanelContext();
155
+ const { isPanelOpen, closePanel } = panelContext;
156
+ const isMobile = (0, import_seeds_react_hooks.useIsMobile)(mobileBreakpoint);
157
+ const enrichedValue = React3.useMemo(
158
+ () => ({ ...panelContext, closeButtonLabel, headerless }),
159
+ [panelContext, closeButtonLabel, headerless]
160
+ );
161
+ const prevChildrenRef = React3.useRef(null);
162
+ if (isPanelOpen) {
163
+ prevChildrenRef.current = children;
164
+ }
165
+ const renderedChildren = isPanelOpen ? children : prevChildrenRef.current;
166
+ const effectiveAriaLabelledBy = ariaLabelledByProp ?? (!headerless && header == null ? titleId : void 0);
167
+ return {
168
+ rest,
169
+ children,
170
+ closeButtonLabel,
171
+ header,
172
+ headerless,
173
+ footer,
174
+ title,
175
+ titleId,
176
+ direction,
177
+ width,
178
+ gap,
179
+ zIndex,
180
+ id,
181
+ snapPoints,
182
+ defaultSnapPoint,
183
+ snapPoint,
184
+ onSnapPointChange,
185
+ snapToSequentialPoints,
186
+ actions,
187
+ actionsInHeader,
188
+ ariaLabel,
189
+ isPanelOpen,
190
+ closePanel,
191
+ isMobile,
192
+ enrichedValue,
193
+ renderedChildren,
194
+ effectiveAriaLabelledBy
195
+ };
196
+ };
197
+
90
198
  // src/PanelHeader.tsx
91
199
  var import_jsx_runtime2 = require("react/jsx-runtime");
92
- var PanelHeader = ({
200
+ var PanelHeaderStyled = ({
201
+ title = "",
202
+ id = void 0,
203
+ children,
204
+ render,
205
+ ...rest
206
+ }) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
207
+ import_seeds_react_box.default,
208
+ {
209
+ display: "flex",
210
+ flex: "0 0 auto",
211
+ justifyContent: "space-between",
212
+ alignItems: "center",
213
+ p: 400,
214
+ borderBottom: "1px solid",
215
+ borderColor: "container.border.base",
216
+ ...rest,
217
+ children: children || /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
218
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_seeds_react_text.default.Headline, { id, children: title }),
219
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(PanelCloseButton, {})
220
+ ] })
221
+ }
222
+ );
223
+ var PanelHeaderTailwind = ({
93
224
  title = "",
94
225
  id = void 0,
95
226
  children,
96
227
  render,
97
228
  ...rest
98
229
  }) => {
230
+ const { className, ...domRest } = rest;
231
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: cn("seeds-panel-header", className), ...domRest, children: children || /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
232
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_seeds_react_text.default.Headline, { id, children: title }),
233
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(PanelCloseButton, {})
234
+ ] }) });
235
+ };
236
+ var PanelHeader = (props) => {
99
237
  const panelContext = usePanelContext();
100
- if (render) {
101
- return render(panelContext);
238
+ if (props.render) {
239
+ return props.render(panelContext);
102
240
  }
103
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
104
- import_seeds_react_box.default,
105
- {
106
- display: "flex",
107
- flex: "0 0 auto",
108
- justifyContent: "space-between",
109
- alignItems: "center",
110
- p: 400,
111
- borderBottom: "1px solid",
112
- borderColor: "container.border.base",
113
- ...rest,
114
- children: children || /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
115
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_seeds_react_text.default.Headline, { id, children: title }),
116
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(PanelCloseButton, {})
117
- ] })
118
- }
119
- );
241
+ const { title, id, children, render, ...rest } = props;
242
+ if ((0, import_seeds_react_system_props.needsStyledComponents)(rest)) {
243
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(PanelHeaderStyled, { ...props });
244
+ }
245
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(PanelHeaderTailwind, { ...props });
120
246
  };
121
247
  PanelHeader.displayName = "Panel.Header";
122
248
 
123
249
  // src/PanelContent.tsx
124
- var React3 = require("react");
250
+ var React4 = require("react");
251
+ var import_seeds_react_system_props3 = require("@sproutsocial/seeds-react-system-props");
125
252
 
126
253
  // src/styles.ts
127
254
  var import_styled_components = __toESM(require("styled-components"));
128
- var import_seeds_react_system_props = require("@sproutsocial/seeds-react-system-props");
255
+ var import_seeds_react_system_props2 = require("@sproutsocial/seeds-react-system-props");
129
256
  var import_unitless = require("@sproutsocial/seeds-motion/unitless");
130
257
  var import_seeds_react_box2 = __toESM(require("@sproutsocial/seeds-react-box"));
131
258
  var gapSide = (direction) => {
@@ -150,7 +277,7 @@ var PanelContainer = import_styled_components.default.aside`
150
277
  align-self: stretch;
151
278
  `}
152
279
 
153
- ${import_seeds_react_system_props.COMMON}
280
+ ${import_seeds_react_system_props2.COMMON}
154
281
  `;
155
282
  var PanelInner = import_styled_components.default.div`
156
283
  ${(props) => props.$direction === "bottom" ? import_styled_components.css`
@@ -193,7 +320,7 @@ var Footer = (0, import_styled_components.default)(import_seeds_react_box2.defau
193
320
 
194
321
  // src/PanelContent.tsx
195
322
  var import_jsx_runtime3 = require("react/jsx-runtime");
196
- var PanelContent = ({ children, ...rest }) => {
323
+ var PanelContentStyled = ({ children, ...rest }) => {
197
324
  const { headerless } = usePanelContext();
198
325
  return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
199
326
  Content,
@@ -209,157 +336,191 @@ var PanelContent = ({ children, ...rest }) => {
209
336
  }
210
337
  );
211
338
  };
339
+ var PanelContentTailwind = ({
340
+ children,
341
+ ...rest
342
+ }) => {
343
+ const { headerless } = usePanelContext();
344
+ const scroll = !headerless;
345
+ const { className, style, ...domRest } = rest;
346
+ const contentStyle = {
347
+ overflowY: scroll ? "auto" : "hidden"
348
+ };
349
+ if (!scroll) {
350
+ contentStyle.display = "flex";
351
+ contentStyle.flexDirection = "column";
352
+ }
353
+ Object.assign(contentStyle, style);
354
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
355
+ "div",
356
+ {
357
+ className: cn(
358
+ "seeds-panel-content",
359
+ { "seeds-panel-content--headerless": !!headerless },
360
+ className
361
+ ),
362
+ style: contentStyle,
363
+ "data-panel-content": "",
364
+ ...domRest,
365
+ children
366
+ }
367
+ );
368
+ };
369
+ var PanelContent = (props) => {
370
+ const { children, ...rest } = props;
371
+ if ((0, import_seeds_react_system_props3.needsStyledComponents)(rest)) {
372
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(PanelContentStyled, { ...props });
373
+ }
374
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(PanelContentTailwind, { ...props });
375
+ };
212
376
  PanelContent.displayName = "Panel.Content";
213
377
 
214
- // src/PanelFooter.tsx
215
- var React4 = require("react");
216
- var import_jsx_runtime4 = require("react/jsx-runtime");
217
- var PanelFooter = ({ children, ...rest }) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Footer, { p: 450, "data-panel-footer": "", ...rest, children });
218
- PanelFooter.displayName = "Panel.Footer";
378
+ // src/PanelMobile.tsx
379
+ var React6 = require("react");
380
+ var import_seeds_react_drawer2 = __toESM(require("@sproutsocial/seeds-react-drawer"));
219
381
 
220
382
  // src/PanelMobileActionsHeader.tsx
221
383
  var React5 = require("react");
222
- var import_seeds_react_box3 = __toESM(require("@sproutsocial/seeds-react-box"));
223
384
  var import_seeds_react_button2 = __toESM(require("@sproutsocial/seeds-react-button"));
224
385
  var import_seeds_react_drawer = __toESM(require("@sproutsocial/seeds-react-drawer"));
225
386
  var import_seeds_react_icon2 = __toESM(require("@sproutsocial/seeds-react-icon"));
226
387
  var import_seeds_react_text2 = __toESM(require("@sproutsocial/seeds-react-text"));
227
- var import_jsx_runtime5 = require("react/jsx-runtime");
388
+ var import_jsx_runtime4 = require("react/jsx-runtime");
228
389
  var PanelMobileActionsHeader = ({
229
390
  title,
230
391
  titleId,
231
392
  actions
232
- }) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
393
+ }) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
233
394
  import_seeds_react_drawer.default.Header,
234
395
  {
235
- render: (ctx) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
236
- import_seeds_react_box3.default,
237
- {
238
- display: "flex",
239
- alignItems: "center",
240
- justifyContent: "space-between",
241
- pt: 400,
242
- px: 450,
243
- flex: "0 0 auto",
244
- children: [
245
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
246
- import_seeds_react_text2.default,
247
- {
248
- as: "h2",
249
- fontSize: 400,
250
- fontWeight: "semibold",
251
- color: "text.headline",
252
- id: titleId,
253
- children: title
254
- }
255
- ),
256
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_seeds_react_box3.default, { display: "flex", alignItems: "center", gap: 200, children: [
257
- actions.map((action, i) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
258
- import_seeds_react_button2.default,
259
- {
260
- appearance: "pill",
261
- "aria-label": action["aria-label"],
262
- onClick: action.onClick,
263
- disabled: action.disabled,
264
- children: action.iconName && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_seeds_react_icon2.default, { "aria-hidden": true, name: action.iconName })
265
- },
266
- i
267
- )),
268
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
269
- import_seeds_react_button2.default,
270
- {
271
- appearance: "pill",
272
- "aria-label": ctx.closeButtonLabel,
273
- onClick: ctx.onClose,
274
- children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_seeds_react_icon2.default, { "aria-hidden": true, name: "x-outline" })
275
- }
276
- )
277
- ] })
278
- ]
279
- }
280
- )
396
+ render: (ctx) => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "seeds-panel-mobile-actions-header", children: [
397
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
398
+ import_seeds_react_text2.default,
399
+ {
400
+ as: "h2",
401
+ fontSize: 400,
402
+ fontWeight: "semibold",
403
+ color: "text.headline",
404
+ id: titleId,
405
+ children: title
406
+ }
407
+ ),
408
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "seeds-panel-mobile-actions-buttons", children: [
409
+ actions.map((action, i) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
410
+ import_seeds_react_button2.default,
411
+ {
412
+ appearance: "pill",
413
+ "aria-label": action["aria-label"],
414
+ onClick: action.onClick,
415
+ disabled: action.disabled,
416
+ children: action.iconName && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_seeds_react_icon2.default, { "aria-hidden": true, name: action.iconName })
417
+ },
418
+ i
419
+ )),
420
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
421
+ import_seeds_react_button2.default,
422
+ {
423
+ appearance: "pill",
424
+ "aria-label": ctx.closeButtonLabel,
425
+ onClick: ctx.onClose,
426
+ children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_seeds_react_icon2.default, { "aria-hidden": true, name: "x-outline" })
427
+ }
428
+ )
429
+ ] })
430
+ ] })
281
431
  }
282
432
  );
283
433
  PanelMobileActionsHeader.displayName = "PanelMobileActionsHeader";
284
434
 
285
- // src/Panel.tsx
286
- var import_jsx_runtime6 = require("react/jsx-runtime");
287
- var PanelComponent = ({
288
- children,
289
- closeButtonLabel,
290
- header,
291
- headerless = false,
292
- footer,
293
- title,
294
- titleId,
295
- direction = "right",
296
- width = 384,
297
- gap = 4,
298
- mobileBreakpoint,
299
- zIndex,
300
- id,
301
- snapPoints,
302
- defaultSnapPoint,
303
- snapPoint,
304
- onSnapPointChange,
305
- snapToSequentialPoints,
306
- actions,
307
- actionsInHeader,
308
- "aria-labelledby": ariaLabelledByProp,
309
- "aria-label": ariaLabel,
310
- ...rest
311
- }) => {
312
- const panelContext = usePanelContext();
313
- const { isPanelOpen, closePanel } = panelContext;
314
- const isMobile = (0, import_seeds_react_hooks.useIsMobile)(mobileBreakpoint);
315
- const enrichedValue = React6.useMemo(
316
- () => ({ ...panelContext, closeButtonLabel, headerless }),
317
- [panelContext, closeButtonLabel, headerless]
318
- );
319
- const prevChildrenRef = React6.useRef(null);
320
- if (isPanelOpen) {
321
- prevChildrenRef.current = children;
322
- }
323
- const renderedChildren = isPanelOpen ? children : prevChildrenRef.current;
324
- const effectiveAriaLabelledBy = ariaLabelledByProp ?? (!headerless && header == null ? titleId : void 0);
325
- if (isMobile) {
326
- const shouldRenderActionsHeader = !headerless && header == null && actionsInHeader === true && !!actions && actions.length > 0;
327
- let defaultMobileHeader = null;
328
- if (!headerless) {
329
- defaultMobileHeader = shouldRenderActionsHeader ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
330
- PanelMobileActionsHeader,
331
- {
332
- title,
333
- titleId,
334
- actions
335
- }
336
- ) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_seeds_react_drawer2.default.Header, { title, id: titleId });
337
- }
338
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(PanelContext.Provider, { value: enrichedValue, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
339
- import_seeds_react_drawer2.default,
435
+ // src/PanelMobile.tsx
436
+ var import_jsx_runtime5 = require("react/jsx-runtime");
437
+ var PanelMobile = ({ shell }) => {
438
+ const {
439
+ rest,
440
+ children,
441
+ closeButtonLabel,
442
+ header,
443
+ headerless,
444
+ footer,
445
+ title,
446
+ titleId,
447
+ zIndex,
448
+ snapPoints,
449
+ defaultSnapPoint,
450
+ snapPoint,
451
+ onSnapPointChange,
452
+ snapToSequentialPoints,
453
+ actions,
454
+ actionsInHeader,
455
+ ariaLabel,
456
+ isPanelOpen,
457
+ closePanel,
458
+ enrichedValue,
459
+ effectiveAriaLabelledBy
460
+ } = shell;
461
+ const shouldRenderActionsHeader = !headerless && header == null && actionsInHeader === true && !!actions && actions.length > 0;
462
+ let defaultMobileHeader = null;
463
+ if (!headerless) {
464
+ defaultMobileHeader = shouldRenderActionsHeader ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
465
+ PanelMobileActionsHeader,
340
466
  {
341
- ...rest,
342
- open: isPanelOpen,
343
- onClose: closePanel,
344
- direction: "bottom",
345
- closeButtonLabel,
346
- zIndex,
347
- snapPoints,
348
- defaultSnapPoint,
349
- snapPoint,
350
- onSnapPointChange,
351
- snapToSequentialPoints,
352
- actions,
353
- actionsInHeader,
354
- "aria-labelledby": effectiveAriaLabelledBy,
355
- "aria-label": ariaLabel,
356
- children: [
357
- header ?? defaultMobileHeader,
358
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(PanelContent, { children }),
359
- footer
360
- ]
467
+ title,
468
+ titleId,
469
+ actions
361
470
  }
362
- ) });
471
+ ) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_seeds_react_drawer2.default.Header, { title, id: titleId });
472
+ }
473
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(PanelContext.Provider, { value: enrichedValue, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
474
+ import_seeds_react_drawer2.default,
475
+ {
476
+ ...rest,
477
+ open: isPanelOpen,
478
+ onClose: closePanel,
479
+ direction: "bottom",
480
+ closeButtonLabel,
481
+ zIndex,
482
+ snapPoints,
483
+ defaultSnapPoint,
484
+ snapPoint,
485
+ onSnapPointChange,
486
+ snapToSequentialPoints,
487
+ actions,
488
+ actionsInHeader,
489
+ "aria-labelledby": effectiveAriaLabelledBy,
490
+ "aria-label": ariaLabel,
491
+ children: [
492
+ header ?? defaultMobileHeader,
493
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(PanelContent, { children }),
494
+ footer
495
+ ]
496
+ }
497
+ ) });
498
+ };
499
+
500
+ // src/PanelStyled.tsx
501
+ var import_jsx_runtime6 = require("react/jsx-runtime");
502
+ var PanelStyled = (props) => {
503
+ const shell = usePanelShell(props);
504
+ const {
505
+ rest,
506
+ header,
507
+ headerless,
508
+ footer,
509
+ title,
510
+ titleId,
511
+ direction,
512
+ width,
513
+ gap,
514
+ id,
515
+ ariaLabel,
516
+ isPanelOpen,
517
+ isMobile,
518
+ enrichedValue,
519
+ renderedChildren,
520
+ effectiveAriaLabelledBy
521
+ } = shell;
522
+ if (isMobile) {
523
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(PanelMobile, { shell });
363
524
  }
364
525
  return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(PanelContext.Provider, { value: enrichedValue, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
365
526
  PanelContainer,
@@ -381,6 +542,126 @@ var PanelComponent = ({
381
542
  }
382
543
  ) });
383
544
  };
545
+
546
+ // src/PanelTailwind.tsx
547
+ var React7 = require("react");
548
+ var import_jsx_runtime7 = require("react/jsx-runtime");
549
+ var PanelTailwind = (props) => {
550
+ const shell = usePanelShell(props);
551
+ const {
552
+ rest,
553
+ header,
554
+ headerless,
555
+ footer,
556
+ title,
557
+ titleId,
558
+ direction,
559
+ width,
560
+ gap,
561
+ id,
562
+ ariaLabel,
563
+ isPanelOpen,
564
+ isMobile,
565
+ enrichedValue,
566
+ renderedChildren,
567
+ effectiveAriaLabelledBy
568
+ } = shell;
569
+ if (isMobile) {
570
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(PanelMobile, { shell });
571
+ }
572
+ const { className, style, ...domRest } = rest;
573
+ const containerStyle = getPanelContainerStyle(
574
+ direction,
575
+ width,
576
+ gap,
577
+ isPanelOpen
578
+ );
579
+ const innerStyle = getPanelInnerStyle(direction, width);
580
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(PanelContext.Provider, { value: enrichedValue, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
581
+ "aside",
582
+ {
583
+ ...domRest,
584
+ className: cn("seeds-panel", className),
585
+ style: { ...containerStyle, ...style },
586
+ "data-qa-panel": id,
587
+ "data-qa-panel-isopen": isPanelOpen,
588
+ "aria-labelledby": effectiveAriaLabelledBy,
589
+ "aria-label": ariaLabel,
590
+ children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "seeds-panel-inner", style: innerStyle, children: [
591
+ header ?? (headerless ? null : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(PanelHeader, { title, id: titleId })),
592
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(PanelContent, { children: renderedChildren }),
593
+ footer
594
+ ] })
595
+ }
596
+ ) });
597
+ };
598
+
599
+ // src/PanelHybrid.tsx
600
+ var import_jsx_runtime8 = require("react/jsx-runtime");
601
+ var PanelHybrid = (props) => {
602
+ const {
603
+ children,
604
+ closeButtonLabel,
605
+ header,
606
+ headerless,
607
+ footer,
608
+ title,
609
+ titleId,
610
+ direction,
611
+ width,
612
+ gap,
613
+ mobileBreakpoint,
614
+ zIndex,
615
+ id,
616
+ snapPoints,
617
+ defaultSnapPoint,
618
+ snapPoint,
619
+ onSnapPointChange,
620
+ snapToSequentialPoints,
621
+ actions,
622
+ actionsInHeader,
623
+ "aria-labelledby": ariaLabelledBy,
624
+ "aria-label": ariaLabel,
625
+ ...rest
626
+ } = props;
627
+ if ((0, import_seeds_react_system_props4.needsStyledComponents)(rest)) {
628
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(PanelStyled, { ...props });
629
+ }
630
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(PanelTailwind, { ...props });
631
+ };
632
+ PanelHybrid.displayName = "Panel";
633
+
634
+ // src/PanelFooter.tsx
635
+ var React8 = require("react");
636
+ var import_seeds_react_system_props5 = require("@sproutsocial/seeds-react-system-props");
637
+ var import_jsx_runtime9 = require("react/jsx-runtime");
638
+ var PanelFooterStyled = ({ children, ...rest }) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Footer, { p: 450, "data-panel-footer": "", ...rest, children });
639
+ var PanelFooterTailwind = ({ children, ...rest }) => {
640
+ const { className, style, ...domRest } = rest;
641
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
642
+ "div",
643
+ {
644
+ className: cn("seeds-panel-footer", className),
645
+ style: { marginBottom: "var(--bleed, 0px)", ...style },
646
+ "data-panel-footer": "",
647
+ ...domRest,
648
+ children
649
+ }
650
+ );
651
+ };
652
+ var PanelFooter = (props) => {
653
+ const { children, ...rest } = props;
654
+ if ((0, import_seeds_react_system_props5.needsStyledComponents)(rest)) {
655
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(PanelFooterStyled, { ...props });
656
+ }
657
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(PanelFooterTailwind, { ...props });
658
+ };
659
+ PanelFooter.displayName = "Panel.Footer";
660
+
661
+ // src/Panel.tsx
662
+ var import_jsx_runtime10 = require("react/jsx-runtime");
663
+ var PanelComponent = (props) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(PanelHybrid, { ...props });
664
+ PanelComponent.displayName = "Panel";
384
665
  PanelComponent.Header = PanelHeader;
385
666
  PanelComponent.Content = PanelContent;
386
667
  PanelComponent.CloseButton = PanelCloseButton;
@@ -388,39 +669,39 @@ PanelComponent.Footer = PanelFooter;
388
669
  var Panel_default = PanelComponent;
389
670
 
390
671
  // src/PanelProvider.tsx
391
- var React7 = __toESM(require("react"));
392
- var import_jsx_runtime7 = require("react/jsx-runtime");
672
+ var React9 = __toESM(require("react"));
673
+ var import_jsx_runtime11 = require("react/jsx-runtime");
393
674
  var PanelProvider = ({
394
675
  children,
395
676
  defaultOpen = false,
396
677
  open: controlledOpen,
397
678
  onOpenChange
398
679
  }) => {
399
- const [internalOpen, setInternalOpen] = React7.useState(defaultOpen);
680
+ const [internalOpen, setInternalOpen] = React9.useState(defaultOpen);
400
681
  const isControlled = controlledOpen !== void 0;
401
682
  const isPanelOpen = isControlled ? controlledOpen : internalOpen;
402
- const setOpen = React7.useCallback(
683
+ const setOpen = React9.useCallback(
403
684
  (next) => {
404
685
  if (!isControlled) setInternalOpen(next);
405
686
  onOpenChange?.(next);
406
687
  },
407
688
  [isControlled, onOpenChange]
408
689
  );
409
- const openPanel = React7.useCallback(() => setOpen(true), [setOpen]);
410
- const closePanel = React7.useCallback(() => setOpen(false), [setOpen]);
411
- const togglePanel = React7.useCallback(
690
+ const openPanel = React9.useCallback(() => setOpen(true), [setOpen]);
691
+ const closePanel = React9.useCallback(() => setOpen(false), [setOpen]);
692
+ const togglePanel = React9.useCallback(
412
693
  () => setOpen(!isPanelOpen),
413
694
  [setOpen, isPanelOpen]
414
695
  );
415
- const value = React7.useMemo(
696
+ const value = React9.useMemo(
416
697
  () => ({ isPanelOpen, openPanel, closePanel, togglePanel }),
417
698
  [isPanelOpen, openPanel, closePanel, togglePanel]
418
699
  );
419
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(PanelContext.Provider, { value, children });
700
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(PanelContext.Provider, { value, children });
420
701
  };
421
702
 
422
703
  // src/PanelTypes.ts
423
- var React8 = require("react");
704
+ var React10 = require("react");
424
705
 
425
706
  // src/index.ts
426
707
  var index_default = Panel_default;