Skip to content

Commit 8b75f7a

Browse files
Development (#237)
* 229 documentation generation has hiccups with events (#235) * Cleanup of sidebar, updating storybook & fixing a few other issues * Moving theme out of state, and adding to new exported store * Adding missing dependancy (#234) * Only forcing view when not specified (#233) * Adding colour fallback when light entity only supports brightness and no color (#232) * Removing redundant code * Prep for release * Quick patch to calendar card
1 parent e850294 commit 8b75f7a

File tree

4 files changed

+22
-7
lines changed

4 files changed

+22
-7
lines changed

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
# 5.0.7
2+
3+
### @hakit/components
4+
5+
- BUGFIX - CalendarCard - Logic to swap out the view only when the view prop was undefined was a bit of a premature optimization, there's now two additional props `disableNarrow` and `disableAutoView` to disable the logic independently, fixes [issue](https://github.com/shannonhochkins/ha-component-kit/issues/231)
6+
7+
### @hakit/core
8+
- No changes, alignment with components package so versions are aligned
9+
110
# 5.0.6
211

312
### @hakit/components

packages/components/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@hakit/components",
33
"type": "module",
4-
"version": "5.0.6",
4+
"version": "5.0.7",
55
"private": false,
66
"keywords": [
77
"react",
@@ -69,7 +69,7 @@
6969
"@emotion/react": ">=11.x.x",
7070
"@emotion/styled": ">=11.x",
7171
"@fullcalendar/react": ">=6.x.x",
72-
"@hakit/core": "^5.0.6",
72+
"@hakit/core": "^5.0.7",
7373
"@mui/material": "^6.3.0",
7474
"@use-gesture/react": ">=10.x",
7575
"autolinker": ">=4.x",

packages/components/src/Cards/CalendarCard/index.tsx

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,10 @@ export interface CalendarCardProps extends Omit<CardBaseProps<"div", EntityName>
323323
timeZone?: string;
324324
/** the default rendered view @default "dayGridMonth" */
325325
view?: "dayGridMonth" | "listWeek" | "dayGridDay";
326+
/** based on the available size of the card, the view will automatically change based on the size @default false */
327+
disableAutoView?: boolean;
328+
/** disables the narrow class/styles from being added when the card is too small @default false */
329+
disableNarrow?: boolean;
326330
/** include the header controls @default true */
327331
includeHeader?: boolean;
328332
}
@@ -398,6 +402,8 @@ function InternalCalendarCard({
398402
className,
399403
timeZone,
400404
view,
405+
disableAutoView = false,
406+
disableNarrow = false,
401407
includeHeader = true,
402408
cssStyles,
403409
key,
@@ -509,23 +515,23 @@ function InternalCalendarCard({
509515
calRef.current.requestResize();
510516
if (width < 400) {
511517
// only change the view if it's not already in listWeek, and not defined as an input prop
512-
if (typeof view !== "undefined" && calendarApi.view.type !== "listWeek") {
518+
if (!disableAutoView && calendarApi.view.type !== "listWeek") {
513519
changeView((api) => {
514520
api.setOption("eventDisplay", "auto");
515521
api.changeView("listWeek");
516522
setActiveView("listWeek");
517523
});
518524
}
519-
if (!narrow) {
525+
if (!narrow && !disableNarrow) {
520526
setNarrow(true);
521527
}
522528
}
523-
if (width >= 400 && narrow) {
529+
if (width >= 400 && narrow && !disableNarrow) {
524530
setNarrow(false);
525531
}
526532
}
527533
},
528-
[narrow, view, changeView],
534+
[narrow, disableAutoView, disableNarrow, changeView],
529535
);
530536
useEffect(() => {
531537
if (width) {

packages/core/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@hakit/core",
3-
"version": "5.0.6",
3+
"version": "5.0.7",
44
"private": false,
55
"type": "module",
66
"keywords": [

0 commit comments

Comments
 (0)