Skip to content

Commit 931b957

Browse files
committed
Allow providing additional stylesheets in card_params (#6242)
* Allow providing additional stylesheets in card_params * Do not override stylesheets
1 parent b206b45 commit 931b957

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

panel/chat/feed.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,11 @@ def __init__(self, *objects, **params):
254254
**linked_params
255255
)
256256
card_params = linked_params.copy()
257+
card_stylesheets = (
258+
self._stylesheets +
259+
self.param.stylesheets.rx() +
260+
self.param.card_params.rx().get('stylesheets', [])
261+
)
257262
card_params.update(
258263
margin=self.param.margin,
259264
align=self.param.align,
@@ -267,9 +272,11 @@ def __init__(self, *objects, **params):
267272
min_height=self.param.min_height,
268273
title_css_classes=["chat-feed-title"],
269274
styles={"padding": "0px"},
270-
stylesheets=self._stylesheets + self.param.stylesheets.rx(),
275+
stylesheets=card_stylesheets
271276
)
272-
card_params.update(self.card_params)
277+
card_overrides = self.card_params.copy()
278+
card_overrides.pop('stylesheets', None)
279+
card_params.update(card_overrides)
273280
self.link(self._chat_log, objects='objects', bidirectional=True)
274281
# we have a card for the title
275282
self._card = Card(
@@ -303,7 +310,9 @@ def _cleanup(self, root: Model | None = None) -> None:
303310

304311
@param.depends("card_params", watch=True)
305312
def _update_card_params(self):
306-
self._card.param.update(**self.card_params)
313+
card_params = self.card_params.copy()
314+
card_params.pop('stylesheets', None)
315+
self._card.param.update(**card_params)
307316

308317
@param.depends("placeholder_text", watch=True, on_init=True)
309318
def _update_placeholder(self):

panel/chat/interface.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,6 @@ def __init__(self, *objects, **params):
164164
self._card.param.update(
165165
objects=self._card.objects + [self._input_container],
166166
css_classes=["chat-interface"],
167-
stylesheets=self._stylesheets,
168167
)
169168

170169
def _link_disabled_loading(self, obj: Viewable):

0 commit comments

Comments
 (0)