@panneau/list-calendar 4.0.2 → 4.0.4

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 (2) hide show
  1. package/es/index.js +86 -73
  2. package/package.json +8 -8
package/es/index.js CHANGED
@@ -7,6 +7,7 @@ import { useState, useMemo, useCallback, useEffect } from 'react';
7
7
  import { useIntl, FormattedDate } from 'react-intl';
8
8
  import Button from '@panneau/element-button';
9
9
  import Icon from '@panneau/element-icon';
10
+ import { jsx, jsxs } from 'react/jsx-runtime';
10
11
 
11
12
  var styles = {"container":"panneau-list-calendar-container","inner":"panneau-list-calendar-inner","calendarHeader":"panneau-list-calendar-calendarHeader","activePeriod":"panneau-list-calendar-activePeriod","activePeriodWithDates":"panneau-list-calendar-activePeriodWithDates","arrow":"panneau-list-calendar-arrow","calendarGrid":"panneau-list-calendar-calendarGrid","calendarBox":"panneau-list-calendar-calendarBox","headerBox":"panneau-list-calendar-headerBox","day":"panneau-list-calendar-day","isToday":"panneau-list-calendar-isToday","isPast":"panneau-list-calendar-isPast","dayButton":"panneau-list-calendar-dayButton","active":"panneau-list-calendar-active"};
12
13
 
@@ -173,79 +174,91 @@ function CalendarList(_ref) {
173
174
  }
174
175
  return acc;
175
176
  }, false);
176
- return /*#__PURE__*/React.createElement("div", {
177
- className: classNames([styles.container, _defineProperty({}, className, className !== null)])
178
- }, /*#__PURE__*/React.createElement("div", {
179
- className: styles.inner
180
- }, /*#__PURE__*/React.createElement("div", {
181
- className: styles.calendarHeader
182
- }, /*#__PURE__*/React.createElement(Button, {
183
- className: styles.arrow,
184
- onClick: function onClick(e) {
185
- return onClickPeriodChange(e, true);
186
- }
187
- }, /*#__PURE__*/React.createElement(Icon, {
188
- name: "arrow-left"
189
- })), mode === 'weekly' ? /*#__PURE__*/React.createElement("div", {
190
- className: styles.activePeriod
191
- }, weekHasDates ? /*#__PURE__*/React.createElement("span", {
192
- className: styles.activePeriodWithDates
193
- }, /*#__PURE__*/React.createElement(FormattedDate, {
194
- value: activeDate,
195
- day: "numeric",
196
- month: "long",
197
- year: "numeric"
198
- })) : /*#__PURE__*/React.createElement(FormattedDate, {
199
- value: activeDate,
200
- day: "numeric",
201
- month: "long",
202
- year: "numeric"
203
- })) : /*#__PURE__*/React.createElement("div", {
204
- className: styles.activePeriod
205
- }, monthHasDates ? /*#__PURE__*/React.createElement("span", {
206
- className: styles.activePeriodWithDates
207
- }, /*#__PURE__*/React.createElement(FormattedDate, {
208
- value: activeDate,
209
- month: "long",
210
- year: "numeric"
211
- })) : /*#__PURE__*/React.createElement(FormattedDate, {
212
- value: activeDate,
213
- month: "long",
214
- year: "numeric"
215
- })), /*#__PURE__*/React.createElement(Button, {
216
- className: classNames([styles.arrow, styles.right]),
217
- onClick: onClickPeriodChange
218
- }, /*#__PURE__*/React.createElement(Icon, {
219
- name: "arrow-right"
220
- }))), /*#__PURE__*/React.createElement("div", {
221
- className: styles.calendarGrid
222
- }, days.map(function (d, i) {
223
- return /*#__PURE__*/React.createElement("div", {
224
- key: "day-".concat(i + 1),
225
- className: classNames([styles.calendarBox, styles.headerBox])
226
- }, d);
227
- }), datesArray.map(function (d, i) {
228
- var dTime = format(d, 'yyyy-MM-dd');
229
- var isCurrentYear = d.getUTCFullYear() === currentYear;
230
- var isCurrentMonth = d.getUTCMonth() === currentMonth;
231
- var isToday = isCurrentYear && isCurrentMonth && d.getDate() === currentDayOfTheMonth;
232
- var eventTime = d.getTime();
233
- var todayTime = currentDate.getTime();
234
- var isPast = eventTime < todayTime && !isToday;
235
- var hasItem = dates.includes(dTime);
236
- var inner = hasItem ? /*#__PURE__*/React.createElement(Button, {
237
- onClick: function onClick(e) {
238
- return onSelectDate(e, dTime);
239
- },
240
- className: classNames(styles.day, styles.dayButton, _defineProperty(_defineProperty(_defineProperty({}, styles.isToday, isToday), styles.isPast, isPast), styles.active, dates.includes(dTime)))
241
- }, format(d, 'd')) : /*#__PURE__*/React.createElement("div", {
242
- className: classNames(styles.day, _defineProperty({}, styles.isToday, isToday))
243
- }, format(d, 'd'));
244
- return /*#__PURE__*/React.createElement("div", {
245
- key: "date-".concat(d.getTime, "-").concat(i + 1),
246
- className: styles.calendarBox
247
- }, d.getUTCMonth() !== activeMonth && mode === 'monthly' ? '' : inner);
248
- }))));
177
+ return /*#__PURE__*/jsx("div", {
178
+ className: classNames([styles.container, _defineProperty({}, className, className !== null)]),
179
+ children: /*#__PURE__*/jsxs("div", {
180
+ className: styles.inner,
181
+ children: [/*#__PURE__*/jsxs("div", {
182
+ className: styles.calendarHeader,
183
+ children: [/*#__PURE__*/jsx(Button, {
184
+ className: styles.arrow,
185
+ onClick: function onClick(e) {
186
+ return onClickPeriodChange(e, true);
187
+ },
188
+ children: /*#__PURE__*/jsx(Icon, {
189
+ name: "arrow-left"
190
+ })
191
+ }), mode === 'weekly' ? /*#__PURE__*/jsx("div", {
192
+ className: styles.activePeriod,
193
+ children: weekHasDates ? /*#__PURE__*/jsx("span", {
194
+ className: styles.activePeriodWithDates,
195
+ children: /*#__PURE__*/jsx(FormattedDate, {
196
+ value: activeDate,
197
+ day: "numeric",
198
+ month: "long",
199
+ year: "numeric"
200
+ })
201
+ }) : /*#__PURE__*/jsx(FormattedDate, {
202
+ value: activeDate,
203
+ day: "numeric",
204
+ month: "long",
205
+ year: "numeric"
206
+ })
207
+ }) : /*#__PURE__*/jsx("div", {
208
+ className: styles.activePeriod,
209
+ children: monthHasDates ? /*#__PURE__*/jsx("span", {
210
+ className: styles.activePeriodWithDates,
211
+ children: /*#__PURE__*/jsx(FormattedDate, {
212
+ value: activeDate,
213
+ month: "long",
214
+ year: "numeric"
215
+ })
216
+ }) : /*#__PURE__*/jsx(FormattedDate, {
217
+ value: activeDate,
218
+ month: "long",
219
+ year: "numeric"
220
+ })
221
+ }), /*#__PURE__*/jsx(Button, {
222
+ className: classNames([styles.arrow, styles.right]),
223
+ onClick: onClickPeriodChange,
224
+ children: /*#__PURE__*/jsx(Icon, {
225
+ name: "arrow-right"
226
+ })
227
+ })]
228
+ }), /*#__PURE__*/jsxs("div", {
229
+ className: styles.calendarGrid,
230
+ children: [days.map(function (d, i) {
231
+ return /*#__PURE__*/jsx("div", {
232
+ className: classNames([styles.calendarBox, styles.headerBox]),
233
+ children: d
234
+ }, "day-".concat(i + 1));
235
+ }), datesArray.map(function (d, i) {
236
+ var dTime = format(d, 'yyyy-MM-dd');
237
+ var isCurrentYear = d.getUTCFullYear() === currentYear;
238
+ var isCurrentMonth = d.getUTCMonth() === currentMonth;
239
+ var isToday = isCurrentYear && isCurrentMonth && d.getDate() === currentDayOfTheMonth;
240
+ var eventTime = d.getTime();
241
+ var todayTime = currentDate.getTime();
242
+ var isPast = eventTime < todayTime && !isToday;
243
+ var hasItem = dates.includes(dTime);
244
+ var inner = hasItem ? /*#__PURE__*/jsx(Button, {
245
+ onClick: function onClick(e) {
246
+ return onSelectDate(e, dTime);
247
+ },
248
+ className: classNames(styles.day, styles.dayButton, _defineProperty(_defineProperty(_defineProperty({}, styles.isToday, isToday), styles.isPast, isPast), styles.active, dates.includes(dTime))),
249
+ children: format(d, 'd')
250
+ }) : /*#__PURE__*/jsx("div", {
251
+ className: classNames(styles.day, _defineProperty({}, styles.isToday, isToday)),
252
+ children: format(d, 'd')
253
+ });
254
+ return /*#__PURE__*/jsx("div", {
255
+ className: styles.calendarBox,
256
+ children: d.getUTCMonth() !== activeMonth && mode === 'monthly' ? '' : inner
257
+ }, "date-".concat(d.getTime, "-").concat(i + 1));
258
+ })]
259
+ })]
260
+ })
261
+ });
249
262
  }
250
263
 
251
264
  export { CalendarList as default };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@panneau/list-calendar",
3
- "version": "4.0.2",
3
+ "version": "4.0.4",
4
4
  "description": "Calendar list",
5
5
  "keywords": [
6
6
  "javascript"
@@ -51,12 +51,12 @@
51
51
  },
52
52
  "dependencies": {
53
53
  "@babel/runtime": "^7.12.5",
54
- "@panneau/core": "^4.0.2",
55
- "@panneau/element-button": "^4.0.2",
56
- "@panneau/element-card": "^4.0.2",
57
- "@panneau/element-icon": "^4.0.2",
58
- "@panneau/element-loading": "^4.0.2",
59
- "@panneau/themes": "^4.0.2",
54
+ "@panneau/core": "^4.0.4",
55
+ "@panneau/element-button": "^4.0.4",
56
+ "@panneau/element-card": "^4.0.4",
57
+ "@panneau/element-icon": "^4.0.4",
58
+ "@panneau/element-loading": "^4.0.4",
59
+ "@panneau/themes": "^4.0.4",
60
60
  "classnames": "^2.5.1",
61
61
  "date-fns": "^3.3.1",
62
62
  "lodash-es": "^4.17.21",
@@ -67,5 +67,5 @@
67
67
  "publishConfig": {
68
68
  "access": "public"
69
69
  },
70
- "gitHead": "53ad0f27e467992c23158732e0f7d39d8615780b"
70
+ "gitHead": "e854451a718c6bc7dcde2b804c9913d8ac0297ff"
71
71
  }