@oslokommune/punkt-react 19.15.1 → 19.15.3
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/CHANGELOG.md +23 -0
- package/dist/punkt-react.cjs +1 -1
- package/dist/punkt-react.js +587 -606
- package/dist/shared-types/calendar.d.ts +0 -1
- package/dist/shared-utils/calendar/calendar-grid.d.ts +0 -4
- package/dist/shared-utils/calendar/index.d.ts +1 -1
- package/package.json +3 -3
- package/src/components/calendar/Calendar.core.test.tsx +9 -0
- package/src/components/calendar/CalendarGrid.tsx +3 -15
|
@@ -10,7 +10,3 @@ export declare function calculateCalendarDimensions(year: number, month: number)
|
|
|
10
10
|
* Determine what type of cell to render at a given position
|
|
11
11
|
*/
|
|
12
12
|
export declare function getCellType(rowIndex: number, colIndex: number, dayCounter: number, gridDimensions: ICalendarGridDimensions): 'prev-month' | 'current-month' | 'next-month';
|
|
13
|
-
/**
|
|
14
|
-
* Get the day number to display for a given cell
|
|
15
|
-
*/
|
|
16
|
-
export declare function getDayNumber(cellType: 'prev-month' | 'current-month' | 'next-month', colIndex: number, dayCounter: number, gridDimensions: ICalendarGridDimensions): number;
|
|
@@ -5,6 +5,6 @@
|
|
|
5
5
|
* to provide a single import point for calendar-related utilities.
|
|
6
6
|
*/
|
|
7
7
|
export { isDateExcluded, isDayDisabled, isPrevMonthAllowed, isNextMonthAllowed, type IDateConstraints, } from './date-validation';
|
|
8
|
-
export { DAYS_PER_WEEK, MONDAY_OFFSET, calculateCalendarDimensions, getCellType,
|
|
8
|
+
export { DAYS_PER_WEEK, MONDAY_OFFSET, calculateCalendarDimensions, getCellType, type ICalendarGridDimensions, type IGridCellPosition, } from './calendar-grid';
|
|
9
9
|
export { convertSelectedToDates, updateRangeMap, isRangeAllowed, addToSelection, removeFromSelection, toggleSelection, handleRangeSelection, type TDateRangeMap, type ISelectionState, type ISelectionOptions, } from './selection-manager';
|
|
10
10
|
export { KEY_DIRECTION_MAP, shouldIgnoreKeyboardEvent, findNextSelectableDate, getKeyDirection, } from './keyboard-navigation';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oslokommune/punkt-react",
|
|
3
|
-
"version": "19.15.
|
|
3
|
+
"version": "19.15.3",
|
|
4
4
|
"description": "React komponentbibliotek til Punkt, designsystem for Oslo kommune",
|
|
5
5
|
"homepage": "https://punkt.oslo.kommune.no",
|
|
6
6
|
"author": "Team Designsystem, Oslo kommune",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"@eslint/eslintrc": "^3.3.5",
|
|
42
42
|
"@eslint/js": "^10.0.1",
|
|
43
43
|
"@oslokommune/punkt-assets": "^19.14.2",
|
|
44
|
-
"@oslokommune/punkt-css": "^19.15.
|
|
44
|
+
"@oslokommune/punkt-css": "^19.15.3",
|
|
45
45
|
"@testing-library/jest-dom": "^6.9.1",
|
|
46
46
|
"@testing-library/react": "^16.3.2",
|
|
47
47
|
"@testing-library/user-event": "^14.6.1",
|
|
@@ -101,5 +101,5 @@
|
|
|
101
101
|
"url": "https://github.com/oslokommune/punkt/issues"
|
|
102
102
|
},
|
|
103
103
|
"license": "MIT",
|
|
104
|
-
"gitHead": "
|
|
104
|
+
"gitHead": "e4314e8b6bd5119bb74094fa2809fc5d389bcd2e"
|
|
105
105
|
}
|
|
@@ -29,6 +29,15 @@ describe('PktCalendar', () => {
|
|
|
29
29
|
expect(monthNav).toBeInTheDocument()
|
|
30
30
|
})
|
|
31
31
|
|
|
32
|
+
test('renders days outside the current month as empty cells', () => {
|
|
33
|
+
const { container } = createCalendar({ currentmonth: '2024-10-01' })
|
|
34
|
+
|
|
35
|
+
const otherCells = container.querySelectorAll('.pkt-cal-other')
|
|
36
|
+
expect(otherCells).toHaveLength(4)
|
|
37
|
+
otherCells.forEach((cell) => expect(cell).toBeEmptyDOMElement())
|
|
38
|
+
expect(container.querySelectorAll('.pkt-calendar__date')).toHaveLength(31)
|
|
39
|
+
})
|
|
40
|
+
|
|
32
41
|
test('renders month picker when withcontrols is true', () => {
|
|
33
42
|
const { container } = createCalendar({ withcontrols: true })
|
|
34
43
|
|
|
@@ -1,9 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
DAYS_PER_WEEK,
|
|
3
|
-
calculateCalendarDimensions,
|
|
4
|
-
getCellType,
|
|
5
|
-
getDayNumber,
|
|
6
|
-
} from 'shared-utils/calendar/calendar-grid'
|
|
1
|
+
import { DAYS_PER_WEEK, calculateCalendarDimensions, getCellType } from 'shared-utils/calendar/calendar-grid'
|
|
7
2
|
import {
|
|
8
3
|
getDayViewData,
|
|
9
4
|
getDayCellClasses,
|
|
@@ -122,13 +117,7 @@ export const CalendarGrid = ({ state }: { state: ICalendarState }) => {
|
|
|
122
117
|
)
|
|
123
118
|
}
|
|
124
119
|
|
|
125
|
-
const renderEmptyDayCell = (
|
|
126
|
-
<td key={key} className="pkt-cal-other">
|
|
127
|
-
<div className="pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--label-only" data-disabled="disabled">
|
|
128
|
-
<span className="pkt-btn__text pkt-txt-14-light">{day}</span>
|
|
129
|
-
</div>
|
|
130
|
-
</td>
|
|
131
|
-
)
|
|
120
|
+
const renderEmptyDayCell = (key: string) => <td key={key} className="pkt-cal-other"></td>
|
|
132
121
|
|
|
133
122
|
const renderCalendarBody = () => {
|
|
134
123
|
const today = todayDate
|
|
@@ -161,8 +150,7 @@ export const CalendarGrid = ({ state }: { state: ICalendarState }) => {
|
|
|
161
150
|
cells.push(renderDayView(dayCounter, today))
|
|
162
151
|
dayCounter++
|
|
163
152
|
} else {
|
|
164
|
-
|
|
165
|
-
cells.push(renderEmptyDayCell(dayNumber, `${cellType}-${i}-${j}`))
|
|
153
|
+
cells.push(renderEmptyDayCell(`${cellType}-${i}-${j}`))
|
|
166
154
|
if (cellType === 'next-month') {
|
|
167
155
|
dayCounter++
|
|
168
156
|
}
|