@deepnoid/ui 0.0.90 → 0.0.92
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-L7P6OBUX.mjs → chunk-3WTG4YNN.mjs} +2 -2
- package/dist/{chunk-2ZFHB4JM.mjs → chunk-FWJ2ZKH6.mjs} +23 -12
- package/dist/{chunk-N6IEGD4K.mjs → chunk-NUIYVRYF.mjs} +6 -3
- package/dist/{chunk-EDEV4IK4.mjs → chunk-SKQNTNEA.mjs} +5 -5
- package/dist/{chunk-S2VUKVCH.mjs → chunk-VNO4XOQG.mjs} +50 -10
- package/dist/components/dateTimePicker/dateTimePicker.d.mts +2 -0
- package/dist/components/dateTimePicker/dateTimePicker.d.ts +2 -0
- package/dist/components/dateTimePicker/dateTimePicker.js +81 -27
- package/dist/components/dateTimePicker/dateTimePicker.mjs +4 -4
- package/dist/components/dateTimePicker/index.js +81 -27
- package/dist/components/dateTimePicker/index.mjs +4 -4
- package/dist/components/dateTimePicker/timePicker.d.mts +2 -1
- package/dist/components/dateTimePicker/timePicker.d.ts +2 -1
- package/dist/components/dateTimePicker/timePicker.js +10 -7
- package/dist/components/dateTimePicker/timePicker.mjs +2 -2
- package/dist/components/dateTimePicker/useDateTimePicker.d.mts +4 -1
- package/dist/components/dateTimePicker/useDateTimePicker.d.ts +4 -1
- package/dist/components/dateTimePicker/useDateTimePicker.js +23 -12
- package/dist/components/dateTimePicker/useDateTimePicker.mjs +1 -1
- package/dist/components/list/index.js +5 -5
- package/dist/components/list/index.mjs +1 -1
- package/dist/components/list/listItem.js +5 -5
- package/dist/components/list/listItem.mjs +1 -1
- package/dist/components/modal/index.js +2 -2
- package/dist/components/modal/index.mjs +1 -1
- package/dist/components/modal/modal.js +2 -2
- package/dist/components/modal/modal.mjs +1 -1
- package/dist/components/modal/modal.test.js +2 -2
- package/dist/components/modal/modal.test.mjs +1 -1
- package/dist/components/select/index.mjs +2 -2
- package/dist/components/select/select.mjs +2 -2
- package/dist/components/select/select.test.mjs +2 -2
- package/dist/index.js +83 -29
- package/dist/index.mjs +20 -20
- package/package.json +1 -1
- package/dist/{chunk-2BCJZILI.mjs → chunk-JN7EGKJL.mjs} +3 -3
|
@@ -102,21 +102,23 @@ var useDatePicker = ({ initialDate, initialTime }) => {
|
|
|
102
102
|
const [targetRect, setTargetRect] = (0, import_react.useState)(null);
|
|
103
103
|
const [popupWidth, setPopupWidth] = (0, import_react.useState)(0);
|
|
104
104
|
const [popupHeight, setPopupHeight] = (0, import_react.useState)(0);
|
|
105
|
+
const [isFocusInput, setIsFocusInput] = (0, import_react.useState)(false);
|
|
105
106
|
const dateInputRef = (0, import_react.useRef)(null);
|
|
106
107
|
const datePickerWrapperRef = (0, import_react.useRef)(null);
|
|
107
108
|
const datePickerRef = (0, import_react.useRef)(null);
|
|
108
|
-
const
|
|
109
|
-
const calculatePositionWithScroll = (targetRect2
|
|
110
|
-
if (
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
109
|
+
const DATE_PICKER_GAP = 4;
|
|
110
|
+
const calculatePositionWithScroll = (targetRect2) => {
|
|
111
|
+
if (targetRect2 && popupWidth && popupHeight) {
|
|
112
|
+
const scrollTop = window.scrollY || document.documentElement.scrollTop || document.body.scrollTop;
|
|
113
|
+
const scrollLeft = window.scrollX || document.documentElement.scrollLeft || document.body.scrollLeft;
|
|
114
|
+
const spaceBelow = window.innerHeight - (targetRect2.y + targetRect2.height + DATE_PICKER_GAP);
|
|
115
|
+
const spaceAbove = targetRect2.y - DATE_PICKER_GAP;
|
|
116
|
+
const top = spaceBelow < popupHeight && spaceAbove > popupHeight ? targetRect2.y - popupHeight - DATE_PICKER_GAP : targetRect2.y + targetRect2.height + DATE_PICKER_GAP;
|
|
117
|
+
return {
|
|
118
|
+
top: top + scrollTop,
|
|
119
|
+
left: targetRect2.x + targetRect2.width - popupWidth + scrollLeft
|
|
120
|
+
};
|
|
121
|
+
}
|
|
120
122
|
};
|
|
121
123
|
const handleToggleDatePicker = () => {
|
|
122
124
|
if (datePickerRef.current) {
|
|
@@ -130,6 +132,12 @@ var useDatePicker = ({ initialDate, initialTime }) => {
|
|
|
130
132
|
const handleChangeTime = (time) => {
|
|
131
133
|
setSelectedTime(time);
|
|
132
134
|
};
|
|
135
|
+
const handleFocusInput = () => {
|
|
136
|
+
setIsFocusInput(true);
|
|
137
|
+
};
|
|
138
|
+
const handleBlueInput = () => {
|
|
139
|
+
setIsFocusInput(false);
|
|
140
|
+
};
|
|
133
141
|
(0, import_react.useEffect)(() => {
|
|
134
142
|
const onClickOutside = (e) => {
|
|
135
143
|
if (datePickerRef.current && !datePickerRef.current.contains(e.target) && datePickerWrapperRef.current && !datePickerWrapperRef.current.contains(e.target)) {
|
|
@@ -150,12 +158,15 @@ var useDatePicker = ({ initialDate, initialTime }) => {
|
|
|
150
158
|
selectedTime,
|
|
151
159
|
targetRect,
|
|
152
160
|
popupHeight,
|
|
161
|
+
isFocusInput,
|
|
153
162
|
dateInputRef,
|
|
154
163
|
datePickerWrapperRef,
|
|
155
164
|
datePickerRef,
|
|
156
165
|
handleToggleDatePicker,
|
|
157
166
|
handleChangeDate,
|
|
158
167
|
handleChangeTime,
|
|
168
|
+
handleFocusInput,
|
|
169
|
+
handleBlueInput,
|
|
159
170
|
calculatePositionWithScroll
|
|
160
171
|
};
|
|
161
172
|
};
|
|
@@ -4060,10 +4071,10 @@ var listItem = tv({
|
|
|
4060
4071
|
color: "primary",
|
|
4061
4072
|
class: {
|
|
4062
4073
|
base: [
|
|
4063
|
-
"hover:text-primary-
|
|
4074
|
+
"hover:text-primary-strong",
|
|
4064
4075
|
"hover:bg-primary-soft",
|
|
4065
|
-
"data-[selected=true]:text-
|
|
4066
|
-
"data-[selected=true]:bg-primary-
|
|
4076
|
+
"data-[selected=true]:text-white",
|
|
4077
|
+
"data-[selected=true]:bg-primary-main"
|
|
4067
4078
|
]
|
|
4068
4079
|
}
|
|
4069
4080
|
},
|
|
@@ -4074,8 +4085,8 @@ var listItem = tv({
|
|
|
4074
4085
|
base: [
|
|
4075
4086
|
"hover:text-secondary-main",
|
|
4076
4087
|
"hover:bg-secondary-soft",
|
|
4077
|
-
"data-[selected=true]:text-
|
|
4078
|
-
"data-[selected=true]:bg-secondary-
|
|
4088
|
+
"data-[selected=true]:text-white",
|
|
4089
|
+
"data-[selected=true]:bg-secondary-main"
|
|
4079
4090
|
]
|
|
4080
4091
|
}
|
|
4081
4092
|
}
|
|
@@ -4084,7 +4095,7 @@ var listItem = tv({
|
|
|
4084
4095
|
|
|
4085
4096
|
// src/components/dateTimePicker/timePicker.tsx
|
|
4086
4097
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
4087
|
-
var TimePicker = ({ color = "primary", selectedTime, onChangeTime }) => {
|
|
4098
|
+
var TimePicker = ({ color = "primary", selectedTime, isFocusInput, onChangeTime }) => {
|
|
4088
4099
|
const TOTAL_HOURS = 12;
|
|
4089
4100
|
const TOTAL_MINUTES = 60;
|
|
4090
4101
|
const ITEM_HEIGHT = 30;
|
|
@@ -4104,7 +4115,10 @@ var TimePicker = ({ color = "primary", selectedTime, onChangeTime }) => {
|
|
|
4104
4115
|
setSelectedMinute(minute);
|
|
4105
4116
|
setSelectedPeriod(period);
|
|
4106
4117
|
}
|
|
4107
|
-
|
|
4118
|
+
if (isFocusInput) {
|
|
4119
|
+
scrollToSelectedTime();
|
|
4120
|
+
}
|
|
4121
|
+
}, [selectedTime, isFocusInput]);
|
|
4108
4122
|
(0, import_react5.useEffect)(() => {
|
|
4109
4123
|
scrollToSelectedTime();
|
|
4110
4124
|
}, []);
|
|
@@ -4193,24 +4207,38 @@ var timePicker_default = TimePicker;
|
|
|
4193
4207
|
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
4194
4208
|
var DatePicker = (0, import_react6.forwardRef)((originalProps, ref) => {
|
|
4195
4209
|
const [props, variantProps] = mapPropsVariants(originalProps, dateTimePickerStyle.variantKeys);
|
|
4196
|
-
const {
|
|
4210
|
+
const {
|
|
4211
|
+
classNames,
|
|
4212
|
+
label,
|
|
4213
|
+
errorMessage,
|
|
4214
|
+
startContent,
|
|
4215
|
+
endContent,
|
|
4216
|
+
type = "date",
|
|
4217
|
+
value,
|
|
4218
|
+
onChangeDate,
|
|
4219
|
+
onChangeTime,
|
|
4220
|
+
...inputProps
|
|
4221
|
+
} = props;
|
|
4197
4222
|
const slots = (0, import_react6.useMemo)(() => dateTimePickerStyle({ ...variantProps }), [variantProps]);
|
|
4198
4223
|
const {
|
|
4199
4224
|
selectedDate,
|
|
4200
4225
|
selectedTime,
|
|
4201
4226
|
targetRect,
|
|
4202
4227
|
popupHeight,
|
|
4228
|
+
isFocusInput,
|
|
4203
4229
|
datePickerRef,
|
|
4204
4230
|
dateInputRef,
|
|
4205
4231
|
datePickerWrapperRef,
|
|
4206
4232
|
handleToggleDatePicker,
|
|
4207
4233
|
handleChangeDate,
|
|
4208
4234
|
handleChangeTime,
|
|
4235
|
+
handleFocusInput,
|
|
4236
|
+
handleBlueInput,
|
|
4209
4237
|
calculatePositionWithScroll
|
|
4210
4238
|
} = useDatePicker({
|
|
4211
4239
|
initialDate: void 0
|
|
4212
4240
|
});
|
|
4213
|
-
const position = targetRect ? calculatePositionWithScroll(targetRect
|
|
4241
|
+
const position = targetRect ? calculatePositionWithScroll(targetRect) : null;
|
|
4214
4242
|
const getBaseProps = (0, import_react6.useCallback)(
|
|
4215
4243
|
() => ({
|
|
4216
4244
|
className: slots.base({ class: classNames == null ? void 0 : classNames.base })
|
|
@@ -4243,17 +4271,29 @@ var DatePicker = (0, import_react6.forwardRef)((originalProps, ref) => {
|
|
|
4243
4271
|
className: slots.input({ class: classNames == null ? void 0 : classNames.input }),
|
|
4244
4272
|
size: 0,
|
|
4245
4273
|
type,
|
|
4246
|
-
value: type === "date" ? selectedDate || "" : type === "time" ? selectedTime || "" : "",
|
|
4274
|
+
value: value !== void 0 ? value : type === "date" ? selectedDate || "" : type === "time" ? selectedTime || "" : "",
|
|
4247
4275
|
onChange: (e) => {
|
|
4248
4276
|
if (type === "date") {
|
|
4249
4277
|
handleChangeDate(e.target.value);
|
|
4278
|
+
if (onChangeDate) {
|
|
4279
|
+
onChangeDate(e.target.value);
|
|
4280
|
+
}
|
|
4250
4281
|
} else if (type === "time") {
|
|
4251
4282
|
handleChangeTime(e.target.value);
|
|
4283
|
+
if (onChangeTime) {
|
|
4284
|
+
onChangeTime(e.target.value);
|
|
4285
|
+
}
|
|
4252
4286
|
}
|
|
4253
4287
|
},
|
|
4288
|
+
onFocus: (e) => {
|
|
4289
|
+
handleFocusInput();
|
|
4290
|
+
},
|
|
4291
|
+
onBlur: (e) => {
|
|
4292
|
+
handleBlueInput();
|
|
4293
|
+
},
|
|
4254
4294
|
max: "9999-12-31"
|
|
4255
4295
|
}),
|
|
4256
|
-
[inputProps, ref, dateInputRef, slots, classNames == null ? void 0 : classNames.input, selectedDate]
|
|
4296
|
+
[inputProps, ref, dateInputRef, slots, classNames == null ? void 0 : classNames.input, selectedDate, selectedTime, type, value]
|
|
4257
4297
|
);
|
|
4258
4298
|
const getContentProps = (0, import_react6.useCallback)(
|
|
4259
4299
|
() => ({
|
|
@@ -4336,8 +4376,8 @@ var DatePicker = (0, import_react6.forwardRef)((originalProps, ref) => {
|
|
|
4336
4376
|
ref: datePickerWrapperRef,
|
|
4337
4377
|
style: {
|
|
4338
4378
|
position: "absolute",
|
|
4339
|
-
top: position == null ? void 0 : position.top,
|
|
4340
|
-
left: position == null ? void 0 : position.left,
|
|
4379
|
+
top: (position == null ? void 0 : position.top) || -99999,
|
|
4380
|
+
left: (position == null ? void 0 : position.left) || -99999,
|
|
4341
4381
|
zIndex: 1e3
|
|
4342
4382
|
},
|
|
4343
4383
|
children: [
|
|
@@ -4347,10 +4387,24 @@ var DatePicker = (0, import_react6.forwardRef)((originalProps, ref) => {
|
|
|
4347
4387
|
color: originalProps.color,
|
|
4348
4388
|
selectedDate,
|
|
4349
4389
|
highlightWeekend: originalProps.highlightWeekend,
|
|
4350
|
-
onChangeDate:
|
|
4390
|
+
onChangeDate: (date) => {
|
|
4391
|
+
handleChangeDate(date);
|
|
4392
|
+
if (onChangeDate) onChangeDate(date);
|
|
4393
|
+
}
|
|
4351
4394
|
}
|
|
4352
4395
|
),
|
|
4353
|
-
type === "time" && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
4396
|
+
type === "time" && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
4397
|
+
timePicker_default,
|
|
4398
|
+
{
|
|
4399
|
+
color: originalProps.color,
|
|
4400
|
+
selectedTime,
|
|
4401
|
+
isFocusInput,
|
|
4402
|
+
onChangeTime: (time) => {
|
|
4403
|
+
handleChangeTime(time);
|
|
4404
|
+
if (onChangeTime) onChangeTime(time);
|
|
4405
|
+
}
|
|
4406
|
+
}
|
|
4407
|
+
)
|
|
4354
4408
|
]
|
|
4355
4409
|
}
|
|
4356
4410
|
),
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
import "../../chunk-75HLCORR.mjs";
|
|
3
3
|
import {
|
|
4
4
|
dateTimePicker_default
|
|
5
|
-
} from "../../chunk-
|
|
6
|
-
import "../../chunk-
|
|
5
|
+
} from "../../chunk-VNO4XOQG.mjs";
|
|
6
|
+
import "../../chunk-FWJ2ZKH6.mjs";
|
|
7
7
|
import "../../chunk-WX32MAKV.mjs";
|
|
8
8
|
import "../../chunk-P732YGHO.mjs";
|
|
9
|
-
import "../../chunk-
|
|
9
|
+
import "../../chunk-NUIYVRYF.mjs";
|
|
10
10
|
import "../../chunk-7MVEAQ7Z.mjs";
|
|
11
11
|
import "../../chunk-EYY4CRRR.mjs";
|
|
12
|
-
import "../../chunk-
|
|
12
|
+
import "../../chunk-SKQNTNEA.mjs";
|
|
13
13
|
import "../../chunk-ZYIIXWVY.mjs";
|
|
14
14
|
import "../../chunk-LCI6RPWE.mjs";
|
|
15
15
|
import "../../chunk-IOCRFIQF.mjs";
|
|
@@ -3,8 +3,9 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
|
3
3
|
interface Props {
|
|
4
4
|
color?: "primary" | "secondary";
|
|
5
5
|
selectedTime?: string;
|
|
6
|
+
isFocusInput?: boolean;
|
|
6
7
|
onChangeTime?: (time: string) => void;
|
|
7
8
|
}
|
|
8
|
-
declare const TimePicker: ({ color, selectedTime, onChangeTime }: Props) => react_jsx_runtime.JSX.Element;
|
|
9
|
+
declare const TimePicker: ({ color, selectedTime, isFocusInput, onChangeTime }: Props) => react_jsx_runtime.JSX.Element;
|
|
9
10
|
|
|
10
11
|
export { type Props, TimePicker as default };
|
|
@@ -3,8 +3,9 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
|
3
3
|
interface Props {
|
|
4
4
|
color?: "primary" | "secondary";
|
|
5
5
|
selectedTime?: string;
|
|
6
|
+
isFocusInput?: boolean;
|
|
6
7
|
onChangeTime?: (time: string) => void;
|
|
7
8
|
}
|
|
8
|
-
declare const TimePicker: ({ color, selectedTime, onChangeTime }: Props) => react_jsx_runtime.JSX.Element;
|
|
9
|
+
declare const TimePicker: ({ color, selectedTime, isFocusInput, onChangeTime }: Props) => react_jsx_runtime.JSX.Element;
|
|
9
10
|
|
|
10
11
|
export { type Props, TimePicker as default };
|
|
@@ -212,10 +212,10 @@ var listItem = tv({
|
|
|
212
212
|
color: "primary",
|
|
213
213
|
class: {
|
|
214
214
|
base: [
|
|
215
|
-
"hover:text-primary-
|
|
215
|
+
"hover:text-primary-strong",
|
|
216
216
|
"hover:bg-primary-soft",
|
|
217
|
-
"data-[selected=true]:text-
|
|
218
|
-
"data-[selected=true]:bg-primary-
|
|
217
|
+
"data-[selected=true]:text-white",
|
|
218
|
+
"data-[selected=true]:bg-primary-main"
|
|
219
219
|
]
|
|
220
220
|
}
|
|
221
221
|
},
|
|
@@ -226,8 +226,8 @@ var listItem = tv({
|
|
|
226
226
|
base: [
|
|
227
227
|
"hover:text-secondary-main",
|
|
228
228
|
"hover:bg-secondary-soft",
|
|
229
|
-
"data-[selected=true]:text-
|
|
230
|
-
"data-[selected=true]:bg-secondary-
|
|
229
|
+
"data-[selected=true]:text-white",
|
|
230
|
+
"data-[selected=true]:bg-secondary-main"
|
|
231
231
|
]
|
|
232
232
|
}
|
|
233
233
|
}
|
|
@@ -236,7 +236,7 @@ var listItem = tv({
|
|
|
236
236
|
|
|
237
237
|
// src/components/dateTimePicker/timePicker.tsx
|
|
238
238
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
239
|
-
var TimePicker = ({ color = "primary", selectedTime, onChangeTime }) => {
|
|
239
|
+
var TimePicker = ({ color = "primary", selectedTime, isFocusInput, onChangeTime }) => {
|
|
240
240
|
const TOTAL_HOURS = 12;
|
|
241
241
|
const TOTAL_MINUTES = 60;
|
|
242
242
|
const ITEM_HEIGHT = 30;
|
|
@@ -256,7 +256,10 @@ var TimePicker = ({ color = "primary", selectedTime, onChangeTime }) => {
|
|
|
256
256
|
setSelectedMinute(minute);
|
|
257
257
|
setSelectedPeriod(period);
|
|
258
258
|
}
|
|
259
|
-
|
|
259
|
+
if (isFocusInput) {
|
|
260
|
+
scrollToSelectedTime();
|
|
261
|
+
}
|
|
262
|
+
}, [selectedTime, isFocusInput]);
|
|
260
263
|
(0, import_react3.useEffect)(() => {
|
|
261
264
|
scrollToSelectedTime();
|
|
262
265
|
}, []);
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
timePicker_default
|
|
4
|
-
} from "../../chunk-
|
|
4
|
+
} from "../../chunk-NUIYVRYF.mjs";
|
|
5
5
|
import "../../chunk-7MVEAQ7Z.mjs";
|
|
6
6
|
import "../../chunk-EYY4CRRR.mjs";
|
|
7
|
-
import "../../chunk-
|
|
7
|
+
import "../../chunk-SKQNTNEA.mjs";
|
|
8
8
|
import "../../chunk-E3G5QXSH.mjs";
|
|
9
9
|
import "../../chunk-J725QONZ.mjs";
|
|
10
10
|
import "../../chunk-IZ6II3QA.mjs";
|
|
@@ -16,13 +16,16 @@ declare const useDatePicker: ({ initialDate, initialTime }: DatePickerHookProps)
|
|
|
16
16
|
selectedTime: string | undefined;
|
|
17
17
|
targetRect: TargetRect | null;
|
|
18
18
|
popupHeight: number;
|
|
19
|
+
isFocusInput: boolean;
|
|
19
20
|
dateInputRef: React.RefObject<HTMLInputElement>;
|
|
20
21
|
datePickerWrapperRef: React.RefObject<HTMLDivElement>;
|
|
21
22
|
datePickerRef: React.RefObject<HTMLDivElement>;
|
|
22
23
|
handleToggleDatePicker: () => void;
|
|
23
24
|
handleChangeDate: (date: string) => void;
|
|
24
25
|
handleChangeTime: (time: string) => void;
|
|
25
|
-
|
|
26
|
+
handleFocusInput: () => void;
|
|
27
|
+
handleBlueInput: () => void;
|
|
28
|
+
calculatePositionWithScroll: (targetRect: TargetRect) => {
|
|
26
29
|
top: number;
|
|
27
30
|
left: number;
|
|
28
31
|
} | undefined;
|
|
@@ -16,13 +16,16 @@ declare const useDatePicker: ({ initialDate, initialTime }: DatePickerHookProps)
|
|
|
16
16
|
selectedTime: string | undefined;
|
|
17
17
|
targetRect: TargetRect | null;
|
|
18
18
|
popupHeight: number;
|
|
19
|
+
isFocusInput: boolean;
|
|
19
20
|
dateInputRef: React.RefObject<HTMLInputElement>;
|
|
20
21
|
datePickerWrapperRef: React.RefObject<HTMLDivElement>;
|
|
21
22
|
datePickerRef: React.RefObject<HTMLDivElement>;
|
|
22
23
|
handleToggleDatePicker: () => void;
|
|
23
24
|
handleChangeDate: (date: string) => void;
|
|
24
25
|
handleChangeTime: (time: string) => void;
|
|
25
|
-
|
|
26
|
+
handleFocusInput: () => void;
|
|
27
|
+
handleBlueInput: () => void;
|
|
28
|
+
calculatePositionWithScroll: (targetRect: TargetRect) => {
|
|
26
29
|
top: number;
|
|
27
30
|
left: number;
|
|
28
31
|
} | undefined;
|
|
@@ -43,21 +43,23 @@ var useDatePicker = ({ initialDate, initialTime }) => {
|
|
|
43
43
|
const [targetRect, setTargetRect] = (0, import_react.useState)(null);
|
|
44
44
|
const [popupWidth, setPopupWidth] = (0, import_react.useState)(0);
|
|
45
45
|
const [popupHeight, setPopupHeight] = (0, import_react.useState)(0);
|
|
46
|
+
const [isFocusInput, setIsFocusInput] = (0, import_react.useState)(false);
|
|
46
47
|
const dateInputRef = (0, import_react.useRef)(null);
|
|
47
48
|
const datePickerWrapperRef = (0, import_react.useRef)(null);
|
|
48
49
|
const datePickerRef = (0, import_react.useRef)(null);
|
|
49
|
-
const
|
|
50
|
-
const calculatePositionWithScroll = (targetRect2
|
|
51
|
-
if (
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
50
|
+
const DATE_PICKER_GAP = 4;
|
|
51
|
+
const calculatePositionWithScroll = (targetRect2) => {
|
|
52
|
+
if (targetRect2 && popupWidth && popupHeight) {
|
|
53
|
+
const scrollTop = window.scrollY || document.documentElement.scrollTop || document.body.scrollTop;
|
|
54
|
+
const scrollLeft = window.scrollX || document.documentElement.scrollLeft || document.body.scrollLeft;
|
|
55
|
+
const spaceBelow = window.innerHeight - (targetRect2.y + targetRect2.height + DATE_PICKER_GAP);
|
|
56
|
+
const spaceAbove = targetRect2.y - DATE_PICKER_GAP;
|
|
57
|
+
const top = spaceBelow < popupHeight && spaceAbove > popupHeight ? targetRect2.y - popupHeight - DATE_PICKER_GAP : targetRect2.y + targetRect2.height + DATE_PICKER_GAP;
|
|
58
|
+
return {
|
|
59
|
+
top: top + scrollTop,
|
|
60
|
+
left: targetRect2.x + targetRect2.width - popupWidth + scrollLeft
|
|
61
|
+
};
|
|
62
|
+
}
|
|
61
63
|
};
|
|
62
64
|
const handleToggleDatePicker = () => {
|
|
63
65
|
if (datePickerRef.current) {
|
|
@@ -71,6 +73,12 @@ var useDatePicker = ({ initialDate, initialTime }) => {
|
|
|
71
73
|
const handleChangeTime = (time) => {
|
|
72
74
|
setSelectedTime(time);
|
|
73
75
|
};
|
|
76
|
+
const handleFocusInput = () => {
|
|
77
|
+
setIsFocusInput(true);
|
|
78
|
+
};
|
|
79
|
+
const handleBlueInput = () => {
|
|
80
|
+
setIsFocusInput(false);
|
|
81
|
+
};
|
|
74
82
|
(0, import_react.useEffect)(() => {
|
|
75
83
|
const onClickOutside = (e) => {
|
|
76
84
|
if (datePickerRef.current && !datePickerRef.current.contains(e.target) && datePickerWrapperRef.current && !datePickerWrapperRef.current.contains(e.target)) {
|
|
@@ -91,12 +99,15 @@ var useDatePicker = ({ initialDate, initialTime }) => {
|
|
|
91
99
|
selectedTime,
|
|
92
100
|
targetRect,
|
|
93
101
|
popupHeight,
|
|
102
|
+
isFocusInput,
|
|
94
103
|
dateInputRef,
|
|
95
104
|
datePickerWrapperRef,
|
|
96
105
|
datePickerRef,
|
|
97
106
|
handleToggleDatePicker,
|
|
98
107
|
handleChangeDate,
|
|
99
108
|
handleChangeTime,
|
|
109
|
+
handleFocusInput,
|
|
110
|
+
handleBlueInput,
|
|
100
111
|
calculatePositionWithScroll
|
|
101
112
|
};
|
|
102
113
|
};
|
|
@@ -212,10 +212,10 @@ var listItem = tv({
|
|
|
212
212
|
color: "primary",
|
|
213
213
|
class: {
|
|
214
214
|
base: [
|
|
215
|
-
"hover:text-primary-
|
|
215
|
+
"hover:text-primary-strong",
|
|
216
216
|
"hover:bg-primary-soft",
|
|
217
|
-
"data-[selected=true]:text-
|
|
218
|
-
"data-[selected=true]:bg-primary-
|
|
217
|
+
"data-[selected=true]:text-white",
|
|
218
|
+
"data-[selected=true]:bg-primary-main"
|
|
219
219
|
]
|
|
220
220
|
}
|
|
221
221
|
},
|
|
@@ -226,8 +226,8 @@ var listItem = tv({
|
|
|
226
226
|
base: [
|
|
227
227
|
"hover:text-secondary-main",
|
|
228
228
|
"hover:bg-secondary-soft",
|
|
229
|
-
"data-[selected=true]:text-
|
|
230
|
-
"data-[selected=true]:bg-secondary-
|
|
229
|
+
"data-[selected=true]:text-white",
|
|
230
|
+
"data-[selected=true]:bg-secondary-main"
|
|
231
231
|
]
|
|
232
232
|
}
|
|
233
233
|
}
|
|
@@ -152,10 +152,10 @@ var listItem = tv({
|
|
|
152
152
|
color: "primary",
|
|
153
153
|
class: {
|
|
154
154
|
base: [
|
|
155
|
-
"hover:text-primary-
|
|
155
|
+
"hover:text-primary-strong",
|
|
156
156
|
"hover:bg-primary-soft",
|
|
157
|
-
"data-[selected=true]:text-
|
|
158
|
-
"data-[selected=true]:bg-primary-
|
|
157
|
+
"data-[selected=true]:text-white",
|
|
158
|
+
"data-[selected=true]:bg-primary-main"
|
|
159
159
|
]
|
|
160
160
|
}
|
|
161
161
|
},
|
|
@@ -166,8 +166,8 @@ var listItem = tv({
|
|
|
166
166
|
base: [
|
|
167
167
|
"hover:text-secondary-main",
|
|
168
168
|
"hover:bg-secondary-soft",
|
|
169
|
-
"data-[selected=true]:text-
|
|
170
|
-
"data-[selected=true]:bg-secondary-
|
|
169
|
+
"data-[selected=true]:text-white",
|
|
170
|
+
"data-[selected=true]:bg-secondary-main"
|
|
171
171
|
]
|
|
172
172
|
}
|
|
173
173
|
}
|
|
@@ -4441,7 +4441,7 @@ var modal = tv({
|
|
|
4441
4441
|
slots: {
|
|
4442
4442
|
backdrop: ["relative w-screen h-screen fixed inset-0 bg-black/60", "z-[900]"],
|
|
4443
4443
|
modalWrapper: ["group/modal", "absolute", "top-1/2", "-translate-y-1/2", "left-1/2", "-translate-x-1/2"],
|
|
4444
|
-
icon: ["absolute", "top-[
|
|
4444
|
+
icon: ["absolute", "top-[0px]", "left-1/2", "-translate-x-1/2", "z-10"],
|
|
4445
4445
|
closeIcon: [
|
|
4446
4446
|
"absolute",
|
|
4447
4447
|
"top-[20px]",
|
|
@@ -4460,7 +4460,7 @@ var modal = tv({
|
|
|
4460
4460
|
"bg-background",
|
|
4461
4461
|
"shadow-drop shadow-foreground/20 rounded-xxlg",
|
|
4462
4462
|
"overflow-hidden",
|
|
4463
|
-
"group-data-[icon-visibility=true]/modal:mt-[
|
|
4463
|
+
"group-data-[icon-visibility=true]/modal:mt-[40px]",
|
|
4464
4464
|
"group-data-[icon-visibility=true]/modal:pt-[60px]"
|
|
4465
4465
|
],
|
|
4466
4466
|
body: ["flex", "flex-col", "gap-[20px]"],
|
|
@@ -4440,7 +4440,7 @@ var modal = tv({
|
|
|
4440
4440
|
slots: {
|
|
4441
4441
|
backdrop: ["relative w-screen h-screen fixed inset-0 bg-black/60", "z-[900]"],
|
|
4442
4442
|
modalWrapper: ["group/modal", "absolute", "top-1/2", "-translate-y-1/2", "left-1/2", "-translate-x-1/2"],
|
|
4443
|
-
icon: ["absolute", "top-[
|
|
4443
|
+
icon: ["absolute", "top-[0px]", "left-1/2", "-translate-x-1/2", "z-10"],
|
|
4444
4444
|
closeIcon: [
|
|
4445
4445
|
"absolute",
|
|
4446
4446
|
"top-[20px]",
|
|
@@ -4459,7 +4459,7 @@ var modal = tv({
|
|
|
4459
4459
|
"bg-background",
|
|
4460
4460
|
"shadow-drop shadow-foreground/20 rounded-xxlg",
|
|
4461
4461
|
"overflow-hidden",
|
|
4462
|
-
"group-data-[icon-visibility=true]/modal:mt-[
|
|
4462
|
+
"group-data-[icon-visibility=true]/modal:mt-[40px]",
|
|
4463
4463
|
"group-data-[icon-visibility=true]/modal:pt-[60px]"
|
|
4464
4464
|
],
|
|
4465
4465
|
body: ["flex", "flex-col", "gap-[20px]"],
|
|
@@ -17276,7 +17276,7 @@ var modal = tv({
|
|
|
17276
17276
|
slots: {
|
|
17277
17277
|
backdrop: ["relative w-screen h-screen fixed inset-0 bg-black/60", "z-[900]"],
|
|
17278
17278
|
modalWrapper: ["group/modal", "absolute", "top-1/2", "-translate-y-1/2", "left-1/2", "-translate-x-1/2"],
|
|
17279
|
-
icon: ["absolute", "top-[
|
|
17279
|
+
icon: ["absolute", "top-[0px]", "left-1/2", "-translate-x-1/2", "z-10"],
|
|
17280
17280
|
closeIcon: [
|
|
17281
17281
|
"absolute",
|
|
17282
17282
|
"top-[20px]",
|
|
@@ -17295,7 +17295,7 @@ var modal = tv({
|
|
|
17295
17295
|
"bg-background",
|
|
17296
17296
|
"shadow-drop shadow-foreground/20 rounded-xxlg",
|
|
17297
17297
|
"overflow-hidden",
|
|
17298
|
-
"group-data-[icon-visibility=true]/modal:mt-[
|
|
17298
|
+
"group-data-[icon-visibility=true]/modal:mt-[40px]",
|
|
17299
17299
|
"group-data-[icon-visibility=true]/modal:pt-[60px]"
|
|
17300
17300
|
],
|
|
17301
17301
|
body: ["flex", "flex-col", "gap-[20px]"],
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
import "../../chunk-QCEKPS7U.mjs";
|
|
3
3
|
import {
|
|
4
4
|
select_default
|
|
5
|
-
} from "../../chunk-
|
|
6
|
-
import "../../chunk-S3QS5B7F.mjs";
|
|
5
|
+
} from "../../chunk-JN7EGKJL.mjs";
|
|
7
6
|
import "../../chunk-RZZWHI6O.mjs";
|
|
7
|
+
import "../../chunk-S3QS5B7F.mjs";
|
|
8
8
|
import "../../chunk-ZYIIXWVY.mjs";
|
|
9
9
|
import "../../chunk-LCI6RPWE.mjs";
|
|
10
10
|
import "../../chunk-IOCRFIQF.mjs";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
select_default
|
|
4
|
-
} from "../../chunk-
|
|
5
|
-
import "../../chunk-S3QS5B7F.mjs";
|
|
4
|
+
} from "../../chunk-JN7EGKJL.mjs";
|
|
6
5
|
import "../../chunk-RZZWHI6O.mjs";
|
|
6
|
+
import "../../chunk-S3QS5B7F.mjs";
|
|
7
7
|
import "../../chunk-ZYIIXWVY.mjs";
|
|
8
8
|
import "../../chunk-LCI6RPWE.mjs";
|
|
9
9
|
import "../../chunk-IOCRFIQF.mjs";
|
|
@@ -4,9 +4,9 @@ import {
|
|
|
4
4
|
} from "../../chunk-S4DTK5GI.mjs";
|
|
5
5
|
import {
|
|
6
6
|
select_default
|
|
7
|
-
} from "../../chunk-
|
|
8
|
-
import "../../chunk-S3QS5B7F.mjs";
|
|
7
|
+
} from "../../chunk-JN7EGKJL.mjs";
|
|
9
8
|
import "../../chunk-RZZWHI6O.mjs";
|
|
9
|
+
import "../../chunk-S3QS5B7F.mjs";
|
|
10
10
|
import {
|
|
11
11
|
act,
|
|
12
12
|
render
|