@dododog/ui 0.1.0 → 0.1.1
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/{chunk-7LJS5LNR.js → chunk-NWLJ7VQF.js} +13 -4
- package/dist/{chunk-CNWUOKCY.mjs → chunk-RQGC6RPI.mjs} +13 -4
- package/dist/components/DateRangePicker/index.js +3 -3
- package/dist/components/DateRangePicker/index.mjs +1 -1
- package/dist/index.js +8 -8
- package/dist/index.mjs +2 -2
- package/package.json +2 -7
|
@@ -158,6 +158,7 @@ var DateRangePicker = React__namespace.forwardRef(
|
|
|
158
158
|
const [calendarMonth, setCalendarMonth] = React__namespace.useState(() => checkIn || /* @__PURE__ */ new Date());
|
|
159
159
|
const [activeDateField, setActiveDateField] = React__namespace.useState("arrival");
|
|
160
160
|
const [isMobile, setIsMobile] = React__namespace.useState(false);
|
|
161
|
+
const [isNarrow, setIsNarrow] = React__namespace.useState(false);
|
|
161
162
|
const internalRef = React__namespace.useRef(null);
|
|
162
163
|
const setRefs = React__namespace.useCallback(
|
|
163
164
|
(node) => {
|
|
@@ -174,6 +175,12 @@ var DateRangePicker = React__namespace.forwardRef(
|
|
|
174
175
|
mq.addEventListener("change", handler);
|
|
175
176
|
return () => mq.removeEventListener("change", handler);
|
|
176
177
|
}, []);
|
|
178
|
+
React__namespace.useEffect(() => {
|
|
179
|
+
const checkNarrow = () => setIsNarrow(window.innerWidth < minWidth + 64);
|
|
180
|
+
checkNarrow();
|
|
181
|
+
window.addEventListener("resize", checkNarrow);
|
|
182
|
+
return () => window.removeEventListener("resize", checkNarrow);
|
|
183
|
+
}, [minWidth]);
|
|
177
184
|
React__namespace.useEffect(() => {
|
|
178
185
|
if (isOpen) {
|
|
179
186
|
setActiveDateField("arrival");
|
|
@@ -335,6 +342,7 @@ var DateRangePicker = React__namespace.forwardRef(
|
|
|
335
342
|
center: "left-1/2 -translate-x-1/2",
|
|
336
343
|
right: "right-0"
|
|
337
344
|
};
|
|
345
|
+
const singleMonth = isNarrow;
|
|
338
346
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
339
347
|
"div",
|
|
340
348
|
{
|
|
@@ -343,15 +351,16 @@ var DateRangePicker = React__namespace.forwardRef(
|
|
|
343
351
|
"absolute top-full mt-2 bg-white rounded-3xl shadow-2xl border z-[60] p-8 pb-10",
|
|
344
352
|
positionClasses[position]
|
|
345
353
|
),
|
|
346
|
-
style: { minWidth: `${minWidth}px` },
|
|
354
|
+
style: singleMonth ? { width: "100%", maxWidth: "400px" } : { minWidth: `${minWidth}px` },
|
|
347
355
|
children: [
|
|
348
356
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between mb-4", children: [
|
|
349
357
|
/* @__PURE__ */ jsxRuntime.jsx("button", { onClick: () => setCalendarMonth(addMonths(calendarMonth, -1)), className: "p-2 hover:bg-gray-100 rounded-full transition-colors", children: /* @__PURE__ */ jsxRuntime.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", className: "text-gray-600", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "m15 18-6-6 6-6" }) }) }),
|
|
358
|
+
singleMonth && /* @__PURE__ */ jsxRuntime.jsx("h3", { className: "font-semibold text-lg text-primary capitalize", children: formatMonthYear(calendarMonth) }),
|
|
350
359
|
/* @__PURE__ */ jsxRuntime.jsx("button", { onClick: () => setCalendarMonth(addMonths(calendarMonth, 1)), className: "p-2 hover:bg-gray-100 rounded-full transition-colors", children: /* @__PURE__ */ jsxRuntime.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", className: "text-gray-600", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "m9 18 6-6-6-6" }) }) })
|
|
351
360
|
] }),
|
|
352
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-12", children: [
|
|
353
|
-
renderMonth(calendarMonth),
|
|
354
|
-
renderMonth(addMonths(calendarMonth, 1))
|
|
361
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: singleMonth ? "" : "flex gap-12", children: [
|
|
362
|
+
renderMonth(calendarMonth, singleMonth),
|
|
363
|
+
!singleMonth && renderMonth(addMonths(calendarMonth, 1))
|
|
355
364
|
] }),
|
|
356
365
|
(checkIn || checkOut) && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-right mt-4 pt-4 border-t border-gray-100", children: /* @__PURE__ */ jsxRuntime.jsx("button", { onClick: clearDates, className: "text-sm text-primary underline hover:text-secondary transition-colors", children: "Effacer les dates" }) })
|
|
357
366
|
]
|
|
@@ -136,6 +136,7 @@ var DateRangePicker = React.forwardRef(
|
|
|
136
136
|
const [calendarMonth, setCalendarMonth] = React.useState(() => checkIn || /* @__PURE__ */ new Date());
|
|
137
137
|
const [activeDateField, setActiveDateField] = React.useState("arrival");
|
|
138
138
|
const [isMobile, setIsMobile] = React.useState(false);
|
|
139
|
+
const [isNarrow, setIsNarrow] = React.useState(false);
|
|
139
140
|
const internalRef = React.useRef(null);
|
|
140
141
|
const setRefs = React.useCallback(
|
|
141
142
|
(node) => {
|
|
@@ -152,6 +153,12 @@ var DateRangePicker = React.forwardRef(
|
|
|
152
153
|
mq.addEventListener("change", handler);
|
|
153
154
|
return () => mq.removeEventListener("change", handler);
|
|
154
155
|
}, []);
|
|
156
|
+
React.useEffect(() => {
|
|
157
|
+
const checkNarrow = () => setIsNarrow(window.innerWidth < minWidth + 64);
|
|
158
|
+
checkNarrow();
|
|
159
|
+
window.addEventListener("resize", checkNarrow);
|
|
160
|
+
return () => window.removeEventListener("resize", checkNarrow);
|
|
161
|
+
}, [minWidth]);
|
|
155
162
|
React.useEffect(() => {
|
|
156
163
|
if (isOpen) {
|
|
157
164
|
setActiveDateField("arrival");
|
|
@@ -313,6 +320,7 @@ var DateRangePicker = React.forwardRef(
|
|
|
313
320
|
center: "left-1/2 -translate-x-1/2",
|
|
314
321
|
right: "right-0"
|
|
315
322
|
};
|
|
323
|
+
const singleMonth = isNarrow;
|
|
316
324
|
return /* @__PURE__ */ jsxs(
|
|
317
325
|
"div",
|
|
318
326
|
{
|
|
@@ -321,15 +329,16 @@ var DateRangePicker = React.forwardRef(
|
|
|
321
329
|
"absolute top-full mt-2 bg-white rounded-3xl shadow-2xl border z-[60] p-8 pb-10",
|
|
322
330
|
positionClasses[position]
|
|
323
331
|
),
|
|
324
|
-
style: { minWidth: `${minWidth}px` },
|
|
332
|
+
style: singleMonth ? { width: "100%", maxWidth: "400px" } : { minWidth: `${minWidth}px` },
|
|
325
333
|
children: [
|
|
326
334
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between mb-4", children: [
|
|
327
335
|
/* @__PURE__ */ jsx("button", { onClick: () => setCalendarMonth(addMonths(calendarMonth, -1)), className: "p-2 hover:bg-gray-100 rounded-full transition-colors", children: /* @__PURE__ */ jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", className: "text-gray-600", children: /* @__PURE__ */ jsx("path", { d: "m15 18-6-6 6-6" }) }) }),
|
|
336
|
+
singleMonth && /* @__PURE__ */ jsx("h3", { className: "font-semibold text-lg text-primary capitalize", children: formatMonthYear(calendarMonth) }),
|
|
328
337
|
/* @__PURE__ */ jsx("button", { onClick: () => setCalendarMonth(addMonths(calendarMonth, 1)), className: "p-2 hover:bg-gray-100 rounded-full transition-colors", children: /* @__PURE__ */ jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", className: "text-gray-600", children: /* @__PURE__ */ jsx("path", { d: "m9 18 6-6-6-6" }) }) })
|
|
329
338
|
] }),
|
|
330
|
-
/* @__PURE__ */ jsxs("div", { className: "flex gap-12", children: [
|
|
331
|
-
renderMonth(calendarMonth),
|
|
332
|
-
renderMonth(addMonths(calendarMonth, 1))
|
|
339
|
+
/* @__PURE__ */ jsxs("div", { className: singleMonth ? "" : "flex gap-12", children: [
|
|
340
|
+
renderMonth(calendarMonth, singleMonth),
|
|
341
|
+
!singleMonth && renderMonth(addMonths(calendarMonth, 1))
|
|
333
342
|
] }),
|
|
334
343
|
(checkIn || checkOut) && /* @__PURE__ */ jsx("div", { className: "text-right mt-4 pt-4 border-t border-gray-100", children: /* @__PURE__ */ jsx("button", { onClick: clearDates, className: "text-sm text-primary underline hover:text-secondary transition-colors", children: "Effacer les dates" }) })
|
|
335
344
|
]
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkNWLJ7VQF_js = require('../../chunk-NWLJ7VQF.js');
|
|
4
4
|
require('../../chunk-ADIDI7AJ.js');
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
Object.defineProperty(exports, "DatePickerInput", {
|
|
9
9
|
enumerable: true,
|
|
10
|
-
get: function () { return
|
|
10
|
+
get: function () { return chunkNWLJ7VQF_js.DatePickerInput; }
|
|
11
11
|
});
|
|
12
12
|
Object.defineProperty(exports, "DateRangePicker", {
|
|
13
13
|
enumerable: true,
|
|
14
|
-
get: function () { return
|
|
14
|
+
get: function () { return chunkNWLJ7VQF_js.DateRangePicker; }
|
|
15
15
|
});
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { DatePickerInput, DateRangePicker } from '../../chunk-
|
|
1
|
+
export { DatePickerInput, DateRangePicker } from '../../chunk-RQGC6RPI.mjs';
|
|
2
2
|
import '../../chunk-IMKLN273.mjs';
|
package/dist/index.js
CHANGED
|
@@ -42,7 +42,7 @@ var chunkIRKM5UF4_js = require('./chunk-IRKM5UF4.js');
|
|
|
42
42
|
var chunkODUY7NXD_js = require('./chunk-ODUY7NXD.js');
|
|
43
43
|
var chunkIJIUUBFT_js = require('./chunk-IJIUUBFT.js');
|
|
44
44
|
var chunk3BPC4LNH_js = require('./chunk-3BPC4LNH.js');
|
|
45
|
-
var
|
|
45
|
+
var chunkNWLJ7VQF_js = require('./chunk-NWLJ7VQF.js');
|
|
46
46
|
var chunkYSJAEDMG_js = require('./chunk-YSJAEDMG.js');
|
|
47
47
|
var chunkXXC2YD3D_js = require('./chunk-XXC2YD3D.js');
|
|
48
48
|
var chunkVWFY24XF_js = require('./chunk-VWFY24XF.js');
|
|
@@ -58,8 +58,8 @@ var chunkMY6BYO5F_js = require('./chunk-MY6BYO5F.js');
|
|
|
58
58
|
var chunkP7GAKOCX_js = require('./chunk-P7GAKOCX.js');
|
|
59
59
|
var chunkMCF3EQTV_js = require('./chunk-MCF3EQTV.js');
|
|
60
60
|
var chunkWBRVUWGC_js = require('./chunk-WBRVUWGC.js');
|
|
61
|
-
var chunkEY4ZIR3P_js = require('./chunk-EY4ZIR3P.js');
|
|
62
61
|
var chunkNHB2TI2B_js = require('./chunk-NHB2TI2B.js');
|
|
62
|
+
var chunkEY4ZIR3P_js = require('./chunk-EY4ZIR3P.js');
|
|
63
63
|
var chunkADIDI7AJ_js = require('./chunk-ADIDI7AJ.js');
|
|
64
64
|
|
|
65
65
|
|
|
@@ -294,11 +294,11 @@ Object.defineProperty(exports, "Counter", {
|
|
|
294
294
|
});
|
|
295
295
|
Object.defineProperty(exports, "DatePickerInput", {
|
|
296
296
|
enumerable: true,
|
|
297
|
-
get: function () { return
|
|
297
|
+
get: function () { return chunkNWLJ7VQF_js.DatePickerInput; }
|
|
298
298
|
});
|
|
299
299
|
Object.defineProperty(exports, "DateRangePicker", {
|
|
300
300
|
enumerable: true,
|
|
301
|
-
get: function () { return
|
|
301
|
+
get: function () { return chunkNWLJ7VQF_js.DateRangePicker; }
|
|
302
302
|
});
|
|
303
303
|
Object.defineProperty(exports, "DetailList", {
|
|
304
304
|
enumerable: true,
|
|
@@ -400,10 +400,6 @@ Object.defineProperty(exports, "Alert", {
|
|
|
400
400
|
enumerable: true,
|
|
401
401
|
get: function () { return chunkWBRVUWGC_js.Alert; }
|
|
402
402
|
});
|
|
403
|
-
Object.defineProperty(exports, "Avatar", {
|
|
404
|
-
enumerable: true,
|
|
405
|
-
get: function () { return chunkEY4ZIR3P_js.Avatar; }
|
|
406
|
-
});
|
|
407
403
|
Object.defineProperty(exports, "Autocomplete", {
|
|
408
404
|
enumerable: true,
|
|
409
405
|
get: function () { return chunkNHB2TI2B_js.Autocomplete; }
|
|
@@ -412,6 +408,10 @@ Object.defineProperty(exports, "autocompleteInputVariants", {
|
|
|
412
408
|
enumerable: true,
|
|
413
409
|
get: function () { return chunkNHB2TI2B_js.autocompleteInputVariants; }
|
|
414
410
|
});
|
|
411
|
+
Object.defineProperty(exports, "Avatar", {
|
|
412
|
+
enumerable: true,
|
|
413
|
+
get: function () { return chunkEY4ZIR3P_js.Avatar; }
|
|
414
|
+
});
|
|
415
415
|
Object.defineProperty(exports, "cn", {
|
|
416
416
|
enumerable: true,
|
|
417
417
|
get: function () { return chunkADIDI7AJ_js.cn; }
|
package/dist/index.mjs
CHANGED
|
@@ -40,7 +40,7 @@ export { Header } from './chunk-PPDKQ3FF.mjs';
|
|
|
40
40
|
export { HotelCard } from './chunk-PXHZ4CXG.mjs';
|
|
41
41
|
export { Checkbox } from './chunk-EEIPCJQ2.mjs';
|
|
42
42
|
export { Counter } from './chunk-TNGW36OC.mjs';
|
|
43
|
-
export { DatePickerInput, DateRangePicker } from './chunk-
|
|
43
|
+
export { DatePickerInput, DateRangePicker } from './chunk-RQGC6RPI.mjs';
|
|
44
44
|
export { DetailList } from './chunk-76DZXGKJ.mjs';
|
|
45
45
|
export { Divider } from './chunk-E4B6LXK7.mjs';
|
|
46
46
|
export { Drawer } from './chunk-ZLF7IL3Y.mjs';
|
|
@@ -56,6 +56,6 @@ export { CardList } from './chunk-RJWHPHHX.mjs';
|
|
|
56
56
|
export { Carousel } from './chunk-OOPP4ES2.mjs';
|
|
57
57
|
export { Accordion } from './chunk-NZ7GF6RF.mjs';
|
|
58
58
|
export { Alert } from './chunk-BQWVWK74.mjs';
|
|
59
|
-
export { Avatar } from './chunk-2POGTS27.mjs';
|
|
60
59
|
export { Autocomplete, autocompleteInputVariants } from './chunk-B47HQHX3.mjs';
|
|
60
|
+
export { Avatar } from './chunk-2POGTS27.mjs';
|
|
61
61
|
export { cn } from './chunk-IMKLN273.mjs';
|
package/package.json
CHANGED
|
@@ -1,15 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dododog/ui",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "React UI component library for DodoDog — pet-friendly travel platform",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"license": "MIT",
|
|
7
|
-
"
|
|
8
|
-
"type": "git",
|
|
9
|
-
"url": "https://github.com/DodoDog-Voyage/Website.git",
|
|
10
|
-
"directory": "packages/ui"
|
|
11
|
-
},
|
|
12
|
-
"homepage": "https://github.com/DodoDog-Voyage/Website/tree/main/packages/ui#readme",
|
|
7
|
+
"homepage": "https://storybook.dododog.voyage",
|
|
13
8
|
"keywords": [
|
|
14
9
|
"react",
|
|
15
10
|
"ui",
|