@deepnoid/ui 0.0.89 → 0.0.90
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-2ZFHB4JM.mjs +76 -0
- package/dist/chunk-75HLCORR.mjs +1 -0
- package/dist/{chunk-FPCP4OOL.mjs → chunk-EDEV4IK4.mjs} +3 -3
- package/dist/{chunk-HFVZFUC3.mjs → chunk-L7P6OBUX.mjs} +1 -1
- package/dist/chunk-N6IEGD4K.mjs +119 -0
- package/dist/chunk-P732YGHO.mjs +18 -0
- package/dist/chunk-S2VUKVCH.mjs +319 -0
- package/dist/{chunk-MOINJECK.mjs → chunk-S3O52LLG.mjs} +1 -2
- package/dist/chunk-WX32MAKV.mjs +219 -0
- package/dist/components/accordion/accordion.d.mts +2 -2
- package/dist/components/accordion/accordion.d.ts +2 -2
- package/dist/components/accordion/accordion.test.mjs +3 -3
- package/dist/components/accordion/accordionItem.d.mts +2 -2
- package/dist/components/accordion/accordionItem.d.ts +2 -2
- package/dist/components/button/button-group.d.mts +2 -2
- package/dist/components/button/button-group.d.ts +2 -2
- package/dist/components/button/button-group.test.mjs +3 -3
- package/dist/components/button/button.d.mts +2 -2
- package/dist/components/button/button.d.ts +2 -2
- package/dist/components/button/button.test.mjs +3 -3
- package/dist/components/card/card.d.mts +2 -2
- package/dist/components/card/card.d.ts +2 -2
- package/dist/components/checkbox/checkbox.d.mts +2 -2
- package/dist/components/checkbox/checkbox.d.ts +2 -2
- package/dist/components/checkbox/checkbox.test.mjs +3 -3
- package/dist/components/dateTimePicker/calendar.d.mts +118 -0
- package/dist/components/dateTimePicker/calendar.d.ts +118 -0
- package/dist/components/dateTimePicker/calendar.js +3854 -0
- package/dist/components/dateTimePicker/calendar.mjs +16 -0
- package/dist/components/dateTimePicker/dateTimePicker.d.mts +443 -0
- package/dist/components/dateTimePicker/dateTimePicker.d.ts +443 -0
- package/dist/components/dateTimePicker/dateTimePicker.js +4486 -0
- package/dist/components/dateTimePicker/dateTimePicker.mjs +22 -0
- package/dist/components/dateTimePicker/index.d.mts +5 -0
- package/dist/components/dateTimePicker/index.d.ts +5 -0
- package/dist/components/dateTimePicker/index.js +4487 -0
- package/dist/components/dateTimePicker/index.mjs +21 -0
- package/dist/components/dateTimePicker/timePicker.d.mts +10 -0
- package/dist/components/dateTimePicker/timePicker.d.ts +10 -0
- package/dist/components/dateTimePicker/timePicker.js +342 -0
- package/dist/components/dateTimePicker/timePicker.mjs +13 -0
- package/dist/components/dateTimePicker/useDateTimePicker.d.mts +31 -0
- package/dist/components/dateTimePicker/useDateTimePicker.d.ts +31 -0
- package/dist/components/dateTimePicker/useDateTimePicker.js +106 -0
- package/dist/components/dateTimePicker/useDateTimePicker.mjs +9 -0
- package/dist/components/dateTimePicker/util.d.mts +4 -0
- package/dist/components/dateTimePicker/util.d.ts +4 -0
- package/dist/components/dateTimePicker/util.js +42 -0
- package/dist/components/dateTimePicker/util.mjs +10 -0
- package/dist/components/input/input.d.mts +2 -2
- package/dist/components/input/input.d.ts +2 -2
- package/dist/components/input/input.test.mjs +1 -1
- package/dist/components/list/index.js +3 -3
- package/dist/components/list/index.mjs +1 -1
- package/dist/components/list/list.d.mts +2 -2
- package/dist/components/list/list.d.ts +2 -2
- package/dist/components/list/listItem.d.mts +3 -3
- package/dist/components/list/listItem.d.ts +3 -3
- package/dist/components/list/listItem.js +3 -3
- package/dist/components/list/listItem.mjs +1 -1
- package/dist/components/modal/index.js +1 -1
- package/dist/components/modal/index.mjs +1 -1
- package/dist/components/modal/modal.d.mts +2 -2
- package/dist/components/modal/modal.d.ts +2 -2
- package/dist/components/modal/modal.js +1 -1
- package/dist/components/modal/modal.mjs +1 -1
- package/dist/components/modal/modal.test.js +1 -1
- package/dist/components/modal/modal.test.mjs +2 -2
- package/dist/components/pagination/pagination.d.mts +2 -2
- package/dist/components/pagination/pagination.d.ts +2 -2
- package/dist/components/progress/progress.d.mts +2 -2
- package/dist/components/progress/progress.d.ts +2 -2
- package/dist/components/radio/radio.d.mts +2 -2
- package/dist/components/radio/radio.d.ts +2 -2
- package/dist/components/select/index.mjs +2 -2
- package/dist/components/select/select.d.mts +2 -2
- package/dist/components/select/select.d.ts +2 -2
- package/dist/components/select/select.mjs +2 -2
- package/dist/components/select/select.test.mjs +5 -5
- package/dist/components/select/useSelect.d.mts +3 -3
- package/dist/components/select/useSelect.d.ts +3 -3
- package/dist/components/slider/slider.d.mts +2 -2
- package/dist/components/slider/slider.d.ts +2 -2
- package/dist/components/switch/index.js +1 -2
- package/dist/components/switch/index.mjs +1 -1
- package/dist/components/switch/switch.d.mts +2 -2
- package/dist/components/switch/switch.d.ts +2 -2
- package/dist/components/switch/switch.js +1 -2
- package/dist/components/switch/switch.mjs +1 -1
- package/dist/components/switch/switch.test.js +1 -2
- package/dist/components/switch/switch.test.mjs +1 -1
- package/dist/components/table/table-body.d.mts +2 -2
- package/dist/components/table/table-body.d.ts +2 -2
- package/dist/components/table/table.d.mts +5 -5
- package/dist/components/table/table.d.ts +5 -5
- package/dist/components/tabs/tabs.d.mts +2 -2
- package/dist/components/tabs/tabs.d.ts +2 -2
- package/dist/components/tabs/tabs.test.mjs +3 -3
- package/dist/components/textarea/textarea.d.mts +2 -2
- package/dist/components/textarea/textarea.d.ts +2 -2
- package/dist/components/textarea/textarea.test.mjs +1 -1
- package/dist/components/toast/toast.d.mts +2 -2
- package/dist/components/toast/toast.d.ts +2 -2
- package/dist/components/tooltip/index.d.mts +1 -1
- package/dist/components/tooltip/index.d.ts +1 -1
- package/dist/components/tooltip/tooltip-utils.d.mts +1 -1
- package/dist/components/tooltip/tooltip-utils.d.ts +1 -1
- package/dist/components/tooltip/tooltip.d.mts +3 -3
- package/dist/components/tooltip/tooltip.d.ts +3 -3
- package/dist/components/tooltip/tooltip.test.mjs +3 -3
- package/dist/components/tooltip/useTooltip.d.mts +1 -1
- package/dist/components/tooltip/useTooltip.d.ts +1 -1
- package/dist/index.d.mts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +697 -6
- package/dist/index.mjs +62 -43
- package/dist/{tooltip-utils-DCKA5gnI.d.mts → tooltip-utils-CrCabndd.d.mts} +2 -2
- package/dist/{tooltip-utils-DCKA5gnI.d.ts → tooltip-utils-CrCabndd.d.ts} +2 -2
- package/package.json +1 -1
- package/dist/{chunk-JN7EGKJL.mjs → chunk-2BCJZILI.mjs} +3 -3
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import "../../chunk-75HLCORR.mjs";
|
|
3
|
+
import {
|
|
4
|
+
dateTimePicker_default
|
|
5
|
+
} from "../../chunk-S2VUKVCH.mjs";
|
|
6
|
+
import "../../chunk-2ZFHB4JM.mjs";
|
|
7
|
+
import "../../chunk-WX32MAKV.mjs";
|
|
8
|
+
import "../../chunk-P732YGHO.mjs";
|
|
9
|
+
import "../../chunk-N6IEGD4K.mjs";
|
|
10
|
+
import "../../chunk-7MVEAQ7Z.mjs";
|
|
11
|
+
import "../../chunk-EYY4CRRR.mjs";
|
|
12
|
+
import "../../chunk-EDEV4IK4.mjs";
|
|
13
|
+
import "../../chunk-ZYIIXWVY.mjs";
|
|
14
|
+
import "../../chunk-LCI6RPWE.mjs";
|
|
15
|
+
import "../../chunk-IOCRFIQF.mjs";
|
|
16
|
+
import "../../chunk-E3G5QXSH.mjs";
|
|
17
|
+
import "../../chunk-J725QONZ.mjs";
|
|
18
|
+
import "../../chunk-IZ6II3QA.mjs";
|
|
19
|
+
export {
|
|
20
|
+
dateTimePicker_default as DateTimePicker
|
|
21
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
|
|
3
|
+
interface Props {
|
|
4
|
+
color?: "primary" | "secondary";
|
|
5
|
+
selectedTime?: string;
|
|
6
|
+
onChangeTime?: (time: string) => void;
|
|
7
|
+
}
|
|
8
|
+
declare const TimePicker: ({ color, selectedTime, onChangeTime }: Props) => react_jsx_runtime.JSX.Element;
|
|
9
|
+
|
|
10
|
+
export { type Props, TimePicker as default };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
|
|
3
|
+
interface Props {
|
|
4
|
+
color?: "primary" | "secondary";
|
|
5
|
+
selectedTime?: string;
|
|
6
|
+
onChangeTime?: (time: string) => void;
|
|
7
|
+
}
|
|
8
|
+
declare const TimePicker: ({ color, selectedTime, onChangeTime }: Props) => react_jsx_runtime.JSX.Element;
|
|
9
|
+
|
|
10
|
+
export { type Props, TimePicker as default };
|
|
@@ -0,0 +1,342 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use strict";
|
|
3
|
+
var __create = Object.create;
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __export = (target, all) => {
|
|
10
|
+
for (var name in all)
|
|
11
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from))
|
|
16
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
17
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
18
|
+
}
|
|
19
|
+
return to;
|
|
20
|
+
};
|
|
21
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
22
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
23
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
24
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
25
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
26
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
27
|
+
mod
|
|
28
|
+
));
|
|
29
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
30
|
+
|
|
31
|
+
// src/components/dateTimePicker/timePicker.tsx
|
|
32
|
+
var timePicker_exports = {};
|
|
33
|
+
__export(timePicker_exports, {
|
|
34
|
+
default: () => timePicker_default
|
|
35
|
+
});
|
|
36
|
+
module.exports = __toCommonJS(timePicker_exports);
|
|
37
|
+
var import_react3 = require("react");
|
|
38
|
+
|
|
39
|
+
// src/components/list/list.tsx
|
|
40
|
+
var import_react = __toESM(require("react"));
|
|
41
|
+
|
|
42
|
+
// src/utils/tailwind-variants.ts
|
|
43
|
+
var import_tailwind_variants = require("tailwind-variants");
|
|
44
|
+
var COMMON_SIZE = ["sm", "md", "lg"];
|
|
45
|
+
var COMMON_RADIUS = ["xlg", "xxlg", "none", "full"];
|
|
46
|
+
var COMMON_FONTSIZE = ["h1", "h2", "h3", "h4", "h5"];
|
|
47
|
+
var COMMON_SHADOW = ["inner", "drop"];
|
|
48
|
+
var tv = (0, import_tailwind_variants.createTV)({
|
|
49
|
+
// twMerge: false,
|
|
50
|
+
twMergeConfig: {
|
|
51
|
+
classGroups: {
|
|
52
|
+
fontSize: [{ text: [...COMMON_SIZE, ...COMMON_FONTSIZE] }],
|
|
53
|
+
borderRadius: [{ rounded: [...COMMON_RADIUS, ...COMMON_SIZE] }],
|
|
54
|
+
boxShadow: [{ shadow: [...COMMON_SHADOW] }],
|
|
55
|
+
padding: [{ p: [...COMMON_SIZE] }],
|
|
56
|
+
gap: [{ gap: [...COMMON_SIZE] }]
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
// src/utils/props.ts
|
|
62
|
+
var mapPropsVariants = (props, variantKeys, removeVariantProps = true) => {
|
|
63
|
+
if (!variantKeys) {
|
|
64
|
+
return [props, {}];
|
|
65
|
+
}
|
|
66
|
+
const picked = variantKeys.reduce((acc, key) => {
|
|
67
|
+
if (key in props) {
|
|
68
|
+
return { ...acc, [key]: props[key] };
|
|
69
|
+
} else {
|
|
70
|
+
return acc;
|
|
71
|
+
}
|
|
72
|
+
}, {});
|
|
73
|
+
if (removeVariantProps) {
|
|
74
|
+
const omitted = Object.keys(props).filter((key) => !variantKeys.includes(key)).reduce((acc, key) => ({ ...acc, [key]: props[key] }), {});
|
|
75
|
+
return [omitted, picked];
|
|
76
|
+
} else {
|
|
77
|
+
return [props, picked];
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
// src/components/list/list.tsx
|
|
82
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
83
|
+
var List = (0, import_react.forwardRef)((originalProps, ref) => {
|
|
84
|
+
const [props, variantProps] = mapPropsVariants(originalProps, list.variantKeys);
|
|
85
|
+
const { children, classNames } = props;
|
|
86
|
+
const slots = (0, import_react.useMemo)(() => list({ ...variantProps }), [...Object.values(variantProps)]);
|
|
87
|
+
const getBaseProps = (0, import_react.useCallback)(() => {
|
|
88
|
+
return {
|
|
89
|
+
className: slots.base({ class: classNames == null ? void 0 : classNames.base })
|
|
90
|
+
};
|
|
91
|
+
}, [slots, classNames == null ? void 0 : classNames.base]);
|
|
92
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { ref, ...getBaseProps(), children: import_react.default.Children.map(children, (child, index) => {
|
|
93
|
+
return import_react.default.cloneElement(child, {
|
|
94
|
+
...variantProps,
|
|
95
|
+
...child.props
|
|
96
|
+
});
|
|
97
|
+
}) });
|
|
98
|
+
});
|
|
99
|
+
List.displayName = "List";
|
|
100
|
+
var list_default = List;
|
|
101
|
+
var list = tv({
|
|
102
|
+
slots: {
|
|
103
|
+
base: ["flex", "flex-col"]
|
|
104
|
+
},
|
|
105
|
+
variants: {
|
|
106
|
+
variant: {
|
|
107
|
+
solid: {},
|
|
108
|
+
line: {}
|
|
109
|
+
},
|
|
110
|
+
size: {
|
|
111
|
+
sm: {},
|
|
112
|
+
md: {},
|
|
113
|
+
lg: {}
|
|
114
|
+
},
|
|
115
|
+
color: {
|
|
116
|
+
primary: {},
|
|
117
|
+
secondary: {}
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
defaultVariants: {
|
|
121
|
+
variant: "solid",
|
|
122
|
+
color: "primary",
|
|
123
|
+
size: "md"
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
// src/components/list/listItem.tsx
|
|
128
|
+
var import_react2 = require("react");
|
|
129
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
130
|
+
var ListItem = (0, import_react2.forwardRef)((originalProps, ref) => {
|
|
131
|
+
const [props, variantProps] = mapPropsVariants(originalProps, listItem.variantKeys);
|
|
132
|
+
const { title, selected, startContent, endContent, classNames, onClick } = props;
|
|
133
|
+
const slots = (0, import_react2.useMemo)(() => listItem({ ...variantProps }), [...Object.values(variantProps)]);
|
|
134
|
+
const getBaseProps = (0, import_react2.useCallback)(() => {
|
|
135
|
+
return {
|
|
136
|
+
className: slots.base({ class: classNames == null ? void 0 : classNames.base }),
|
|
137
|
+
"data-selected": selected,
|
|
138
|
+
onClick
|
|
139
|
+
};
|
|
140
|
+
}, [slots, classNames == null ? void 0 : classNames.base, selected, onClick]);
|
|
141
|
+
const getTitleWrapperProps = (0, import_react2.useCallback)(() => {
|
|
142
|
+
return {
|
|
143
|
+
className: slots.titleWrapper({ class: classNames == null ? void 0 : classNames.titleWrapper })
|
|
144
|
+
};
|
|
145
|
+
}, [slots, classNames == null ? void 0 : classNames.titleWrapper]);
|
|
146
|
+
const getTitleProps = (0, import_react2.useCallback)(() => {
|
|
147
|
+
return {
|
|
148
|
+
className: slots.title({ class: classNames == null ? void 0 : classNames.title })
|
|
149
|
+
};
|
|
150
|
+
}, [slots, classNames == null ? void 0 : classNames.title]);
|
|
151
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { ref, ...getBaseProps(), children: [
|
|
152
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { ...getTitleWrapperProps(), children: [
|
|
153
|
+
startContent && startContent,
|
|
154
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { ...getTitleProps(), children: title })
|
|
155
|
+
] }),
|
|
156
|
+
endContent && endContent
|
|
157
|
+
] });
|
|
158
|
+
});
|
|
159
|
+
ListItem.displayName = "ListItem";
|
|
160
|
+
var listItem_default = ListItem;
|
|
161
|
+
var listItem = tv({
|
|
162
|
+
slots: {
|
|
163
|
+
base: [
|
|
164
|
+
"group",
|
|
165
|
+
"w-full",
|
|
166
|
+
"flex",
|
|
167
|
+
"justify-between",
|
|
168
|
+
"items-center",
|
|
169
|
+
"text-foreground",
|
|
170
|
+
"bg-transparent",
|
|
171
|
+
"px-[10px]",
|
|
172
|
+
"cursor-pointer",
|
|
173
|
+
"select-none",
|
|
174
|
+
"gap-[10px]"
|
|
175
|
+
],
|
|
176
|
+
titleWrapper: ["flex", "w-full", "gap-[10px]", "overflow-hidden", "whitespace-nowrap", "text-overflow-ellipsis"],
|
|
177
|
+
title: "truncate"
|
|
178
|
+
},
|
|
179
|
+
variants: {
|
|
180
|
+
variant: {
|
|
181
|
+
solid: {},
|
|
182
|
+
line: {}
|
|
183
|
+
},
|
|
184
|
+
size: {
|
|
185
|
+
sm: {
|
|
186
|
+
base: "min-h-[30px] text-sm"
|
|
187
|
+
},
|
|
188
|
+
md: {
|
|
189
|
+
base: "min-h-[40px] text-md"
|
|
190
|
+
},
|
|
191
|
+
lg: {
|
|
192
|
+
base: "min-h-[50px] text-lg"
|
|
193
|
+
}
|
|
194
|
+
},
|
|
195
|
+
color: {
|
|
196
|
+
primary: {},
|
|
197
|
+
secondary: {}
|
|
198
|
+
},
|
|
199
|
+
isInGroup: {
|
|
200
|
+
true: ""
|
|
201
|
+
}
|
|
202
|
+
},
|
|
203
|
+
defaultVariants: {
|
|
204
|
+
variant: "solid",
|
|
205
|
+
color: "primary",
|
|
206
|
+
size: "md",
|
|
207
|
+
isInGroup: false
|
|
208
|
+
},
|
|
209
|
+
compoundVariants: [
|
|
210
|
+
{
|
|
211
|
+
variant: "solid",
|
|
212
|
+
color: "primary",
|
|
213
|
+
class: {
|
|
214
|
+
base: [
|
|
215
|
+
"hover:text-primary-main",
|
|
216
|
+
"hover:bg-primary-soft",
|
|
217
|
+
"data-[selected=true]:text-primary-main",
|
|
218
|
+
"data-[selected=true]:bg-primary-soft"
|
|
219
|
+
]
|
|
220
|
+
}
|
|
221
|
+
},
|
|
222
|
+
{
|
|
223
|
+
variant: "solid",
|
|
224
|
+
color: "secondary",
|
|
225
|
+
class: {
|
|
226
|
+
base: [
|
|
227
|
+
"hover:text-secondary-main",
|
|
228
|
+
"hover:bg-secondary-soft",
|
|
229
|
+
"data-[selected=true]:text-secondary-main",
|
|
230
|
+
"data-[selected=true]:bg-secondary-soft"
|
|
231
|
+
]
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
]
|
|
235
|
+
});
|
|
236
|
+
|
|
237
|
+
// src/components/dateTimePicker/timePicker.tsx
|
|
238
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
239
|
+
var TimePicker = ({ color = "primary", selectedTime, onChangeTime }) => {
|
|
240
|
+
const TOTAL_HOURS = 12;
|
|
241
|
+
const TOTAL_MINUTES = 60;
|
|
242
|
+
const ITEM_HEIGHT = 30;
|
|
243
|
+
const PERIODS = ["AM", "PM"];
|
|
244
|
+
const [selectedHour, setSelectedHour] = (0, import_react3.useState)("01");
|
|
245
|
+
const [selectedMinute, setSelectedMinute] = (0, import_react3.useState)("00");
|
|
246
|
+
const [selectedPeriod, setSelectedPeriod] = (0, import_react3.useState)("AM");
|
|
247
|
+
const hourRef = (0, import_react3.useRef)(null);
|
|
248
|
+
const minuteRef = (0, import_react3.useRef)(null);
|
|
249
|
+
const periodRef = (0, import_react3.useRef)(null);
|
|
250
|
+
const hoursArray = [...Array(TOTAL_HOURS).keys()].map((i) => (i + 1).toString().padStart(2, "0"));
|
|
251
|
+
const minutesArray = [...Array(TOTAL_MINUTES).keys()].map((i) => i.toString().padStart(2, "0"));
|
|
252
|
+
(0, import_react3.useEffect)(() => {
|
|
253
|
+
if (selectedTime) {
|
|
254
|
+
const { formattedHour, minute, period } = parseAndFormatTime(selectedTime);
|
|
255
|
+
setSelectedHour(formattedHour);
|
|
256
|
+
setSelectedMinute(minute);
|
|
257
|
+
setSelectedPeriod(period);
|
|
258
|
+
}
|
|
259
|
+
}, [selectedTime]);
|
|
260
|
+
(0, import_react3.useEffect)(() => {
|
|
261
|
+
scrollToSelectedTime();
|
|
262
|
+
}, []);
|
|
263
|
+
const parseAndFormatTime = (time) => {
|
|
264
|
+
const [hour, minute] = time.split(":").map((part) => part.padStart(2, "0"));
|
|
265
|
+
const parsedHour = parseInt(hour, 10);
|
|
266
|
+
const period = parsedHour >= 12 ? "PM" : "AM";
|
|
267
|
+
const formattedHour = parsedHour % 12 === 0 ? "12" : (parsedHour % 12).toString().padStart(2, "0");
|
|
268
|
+
return { formattedHour, minute, period };
|
|
269
|
+
};
|
|
270
|
+
const scrollToSelectedTime = () => {
|
|
271
|
+
if (selectedTime) {
|
|
272
|
+
const { formattedHour, minute, period } = parseAndFormatTime(selectedTime);
|
|
273
|
+
if (hourRef.current) {
|
|
274
|
+
hourRef.current.scrollTop = (parseInt(formattedHour) - 1) * ITEM_HEIGHT;
|
|
275
|
+
}
|
|
276
|
+
if (minuteRef.current) {
|
|
277
|
+
minuteRef.current.scrollTop = parseInt(minute) * ITEM_HEIGHT;
|
|
278
|
+
}
|
|
279
|
+
if (periodRef.current) {
|
|
280
|
+
periodRef.current.scrollTop = period === "AM" ? 0 : ITEM_HEIGHT;
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
};
|
|
284
|
+
const handleTimeChange = (hour, minute, period) => {
|
|
285
|
+
const parsedHour = parseInt(hour);
|
|
286
|
+
let hour24 = parsedHour;
|
|
287
|
+
if (period === "PM" && parsedHour !== 12) {
|
|
288
|
+
hour24 = parsedHour + 12;
|
|
289
|
+
} else if (period === "AM" && parsedHour === 12) {
|
|
290
|
+
hour24 = 0;
|
|
291
|
+
}
|
|
292
|
+
const formattedTime = `${hour24.toString().padStart(2, "0")}:${minute}`;
|
|
293
|
+
if (onChangeTime) {
|
|
294
|
+
onChangeTime(formattedTime);
|
|
295
|
+
}
|
|
296
|
+
};
|
|
297
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "flex h-[200px] p-[10px] gap-[5px] border border-neutral-main rounded-md bg-background shadow-lg", children: [
|
|
298
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(list_default, { ref: periodRef, classNames: { base: "overflow-y-auto scrollbar-hide" }, children: PERIODS.map((period, index) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
299
|
+
listItem_default,
|
|
300
|
+
{
|
|
301
|
+
color,
|
|
302
|
+
selected: period === selectedPeriod,
|
|
303
|
+
title: period,
|
|
304
|
+
size: "sm",
|
|
305
|
+
classNames: { base: "w-[50px] min-h-[30px]", titleWrapper: "flex justify-center" },
|
|
306
|
+
onClick: () => {
|
|
307
|
+
handleTimeChange(selectedHour, selectedMinute, period);
|
|
308
|
+
}
|
|
309
|
+
},
|
|
310
|
+
`${period}-${index}`
|
|
311
|
+
)) }),
|
|
312
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(list_default, { ref: hourRef, classNames: { base: "overflow-y-auto scrollbar-hide" }, children: hoursArray.map((hour, index) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
313
|
+
listItem_default,
|
|
314
|
+
{
|
|
315
|
+
color,
|
|
316
|
+
selected: hour === selectedHour,
|
|
317
|
+
title: hour,
|
|
318
|
+
size: "sm",
|
|
319
|
+
classNames: { base: "w-[50px] min-h-[30px]", titleWrapper: "flex justify-center" },
|
|
320
|
+
onClick: () => {
|
|
321
|
+
handleTimeChange(hour, selectedMinute, selectedPeriod);
|
|
322
|
+
}
|
|
323
|
+
},
|
|
324
|
+
`${hour}-${index}`
|
|
325
|
+
)) }),
|
|
326
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(list_default, { ref: minuteRef, classNames: { base: "overflow-y-auto scrollbar-hide" }, children: minutesArray.map((minute, index) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
327
|
+
listItem_default,
|
|
328
|
+
{
|
|
329
|
+
color,
|
|
330
|
+
selected: minute === selectedMinute,
|
|
331
|
+
title: minute,
|
|
332
|
+
size: "sm",
|
|
333
|
+
classNames: { base: "w-[50px] min-h-[30px]", titleWrapper: "flex justify-center" },
|
|
334
|
+
onClick: () => {
|
|
335
|
+
handleTimeChange(selectedHour, minute, selectedPeriod);
|
|
336
|
+
}
|
|
337
|
+
},
|
|
338
|
+
`${minute}-${index}`
|
|
339
|
+
)) })
|
|
340
|
+
] });
|
|
341
|
+
};
|
|
342
|
+
var timePicker_default = TimePicker;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
timePicker_default
|
|
4
|
+
} from "../../chunk-N6IEGD4K.mjs";
|
|
5
|
+
import "../../chunk-7MVEAQ7Z.mjs";
|
|
6
|
+
import "../../chunk-EYY4CRRR.mjs";
|
|
7
|
+
import "../../chunk-EDEV4IK4.mjs";
|
|
8
|
+
import "../../chunk-E3G5QXSH.mjs";
|
|
9
|
+
import "../../chunk-J725QONZ.mjs";
|
|
10
|
+
import "../../chunk-IZ6II3QA.mjs";
|
|
11
|
+
export {
|
|
12
|
+
timePicker_default as default
|
|
13
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
interface DatePickerHookProps {
|
|
4
|
+
initialDate?: Date;
|
|
5
|
+
initialTime?: string;
|
|
6
|
+
onChange?: (date: Date) => void;
|
|
7
|
+
}
|
|
8
|
+
type TargetRect = {
|
|
9
|
+
x: number;
|
|
10
|
+
y: number;
|
|
11
|
+
width: number;
|
|
12
|
+
height: number;
|
|
13
|
+
};
|
|
14
|
+
declare const useDatePicker: ({ initialDate, initialTime }: DatePickerHookProps) => {
|
|
15
|
+
selectedDate: string | undefined;
|
|
16
|
+
selectedTime: string | undefined;
|
|
17
|
+
targetRect: TargetRect | null;
|
|
18
|
+
popupHeight: number;
|
|
19
|
+
dateInputRef: React.RefObject<HTMLInputElement>;
|
|
20
|
+
datePickerWrapperRef: React.RefObject<HTMLDivElement>;
|
|
21
|
+
datePickerRef: React.RefObject<HTMLDivElement>;
|
|
22
|
+
handleToggleDatePicker: () => void;
|
|
23
|
+
handleChangeDate: (date: string) => void;
|
|
24
|
+
handleChangeTime: (time: string) => void;
|
|
25
|
+
calculatePositionWithScroll: (targetRect: TargetRect, popupHeight: number) => {
|
|
26
|
+
top: number;
|
|
27
|
+
left: number;
|
|
28
|
+
} | undefined;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export { useDatePicker };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
interface DatePickerHookProps {
|
|
4
|
+
initialDate?: Date;
|
|
5
|
+
initialTime?: string;
|
|
6
|
+
onChange?: (date: Date) => void;
|
|
7
|
+
}
|
|
8
|
+
type TargetRect = {
|
|
9
|
+
x: number;
|
|
10
|
+
y: number;
|
|
11
|
+
width: number;
|
|
12
|
+
height: number;
|
|
13
|
+
};
|
|
14
|
+
declare const useDatePicker: ({ initialDate, initialTime }: DatePickerHookProps) => {
|
|
15
|
+
selectedDate: string | undefined;
|
|
16
|
+
selectedTime: string | undefined;
|
|
17
|
+
targetRect: TargetRect | null;
|
|
18
|
+
popupHeight: number;
|
|
19
|
+
dateInputRef: React.RefObject<HTMLInputElement>;
|
|
20
|
+
datePickerWrapperRef: React.RefObject<HTMLDivElement>;
|
|
21
|
+
datePickerRef: React.RefObject<HTMLDivElement>;
|
|
22
|
+
handleToggleDatePicker: () => void;
|
|
23
|
+
handleChangeDate: (date: string) => void;
|
|
24
|
+
handleChangeTime: (time: string) => void;
|
|
25
|
+
calculatePositionWithScroll: (targetRect: TargetRect, popupHeight: number) => {
|
|
26
|
+
top: number;
|
|
27
|
+
left: number;
|
|
28
|
+
} | undefined;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export { useDatePicker };
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use strict";
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
+
|
|
21
|
+
// src/components/dateTimePicker/useDateTimePicker.tsx
|
|
22
|
+
var useDateTimePicker_exports = {};
|
|
23
|
+
__export(useDateTimePicker_exports, {
|
|
24
|
+
useDatePicker: () => useDatePicker
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(useDateTimePicker_exports);
|
|
27
|
+
var import_react = require("react");
|
|
28
|
+
|
|
29
|
+
// src/components/dateTimePicker/util.ts
|
|
30
|
+
var formatDateToString = (date) => {
|
|
31
|
+
const year = date.getFullYear();
|
|
32
|
+
const month = String(date.getMonth() + 1).padStart(2, "0");
|
|
33
|
+
const day = String(date.getDate()).padStart(2, "0");
|
|
34
|
+
return `${year}-${month}-${day}`;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
// src/components/dateTimePicker/useDateTimePicker.tsx
|
|
38
|
+
var useDatePicker = ({ initialDate, initialTime }) => {
|
|
39
|
+
const [selectedDate, setSelectedDate] = (0, import_react.useState)(
|
|
40
|
+
initialDate ? formatDateToString(initialDate) : ""
|
|
41
|
+
);
|
|
42
|
+
const [selectedTime, setSelectedTime] = (0, import_react.useState)(initialTime ? initialTime : "");
|
|
43
|
+
const [targetRect, setTargetRect] = (0, import_react.useState)(null);
|
|
44
|
+
const [popupWidth, setPopupWidth] = (0, import_react.useState)(0);
|
|
45
|
+
const [popupHeight, setPopupHeight] = (0, import_react.useState)(0);
|
|
46
|
+
const dateInputRef = (0, import_react.useRef)(null);
|
|
47
|
+
const datePickerWrapperRef = (0, import_react.useRef)(null);
|
|
48
|
+
const datePickerRef = (0, import_react.useRef)(null);
|
|
49
|
+
const dataPickerGap = 4;
|
|
50
|
+
const calculatePositionWithScroll = (targetRect2, popupHeight2) => {
|
|
51
|
+
if (popupWidth === 0 || popupHeight2 === 0) return;
|
|
52
|
+
const scrollTop = window.scrollY || document.documentElement.scrollTop || document.body.scrollTop;
|
|
53
|
+
const scrollLeft = window.scrollX || document.documentElement.scrollLeft || document.body.scrollLeft;
|
|
54
|
+
const spaceBelow = window.innerHeight - (targetRect2.y + targetRect2.height + dataPickerGap);
|
|
55
|
+
const spaceAbove = targetRect2.y - dataPickerGap;
|
|
56
|
+
const top = spaceBelow < popupHeight2 && spaceAbove > popupHeight2 ? targetRect2.y - popupHeight2 - dataPickerGap : targetRect2.y + targetRect2.height + dataPickerGap;
|
|
57
|
+
return {
|
|
58
|
+
top: top + scrollTop,
|
|
59
|
+
left: targetRect2.x + targetRect2.width - popupWidth + scrollLeft
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
const handleToggleDatePicker = () => {
|
|
63
|
+
if (datePickerRef.current) {
|
|
64
|
+
const rect = datePickerRef.current.getBoundingClientRect();
|
|
65
|
+
setTargetRect((prevRect) => prevRect ? null : { x: rect.x, y: rect.y, width: rect.width, height: rect.height });
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
const handleChangeDate = (date) => {
|
|
69
|
+
setSelectedDate(date);
|
|
70
|
+
};
|
|
71
|
+
const handleChangeTime = (time) => {
|
|
72
|
+
setSelectedTime(time);
|
|
73
|
+
};
|
|
74
|
+
(0, import_react.useEffect)(() => {
|
|
75
|
+
const onClickOutside = (e) => {
|
|
76
|
+
if (datePickerRef.current && !datePickerRef.current.contains(e.target) && datePickerWrapperRef.current && !datePickerWrapperRef.current.contains(e.target)) {
|
|
77
|
+
setTargetRect(null);
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
window.addEventListener("mousedown", onClickOutside);
|
|
81
|
+
return () => window.removeEventListener("mousedown", onClickOutside);
|
|
82
|
+
}, []);
|
|
83
|
+
(0, import_react.useEffect)(() => {
|
|
84
|
+
if (datePickerWrapperRef.current) {
|
|
85
|
+
setPopupHeight(datePickerWrapperRef.current.getBoundingClientRect().height);
|
|
86
|
+
setPopupWidth(datePickerWrapperRef.current.getBoundingClientRect().width);
|
|
87
|
+
}
|
|
88
|
+
}, [targetRect]);
|
|
89
|
+
return {
|
|
90
|
+
selectedDate,
|
|
91
|
+
selectedTime,
|
|
92
|
+
targetRect,
|
|
93
|
+
popupHeight,
|
|
94
|
+
dateInputRef,
|
|
95
|
+
datePickerWrapperRef,
|
|
96
|
+
datePickerRef,
|
|
97
|
+
handleToggleDatePicker,
|
|
98
|
+
handleChangeDate,
|
|
99
|
+
handleChangeTime,
|
|
100
|
+
calculatePositionWithScroll
|
|
101
|
+
};
|
|
102
|
+
};
|
|
103
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
104
|
+
0 && (module.exports = {
|
|
105
|
+
useDatePicker
|
|
106
|
+
});
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use strict";
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
+
|
|
21
|
+
// src/components/dateTimePicker/util.ts
|
|
22
|
+
var util_exports = {};
|
|
23
|
+
__export(util_exports, {
|
|
24
|
+
formatDateToString: () => formatDateToString,
|
|
25
|
+
formatStringToDate: () => formatStringToDate
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(util_exports);
|
|
28
|
+
var formatDateToString = (date) => {
|
|
29
|
+
const year = date.getFullYear();
|
|
30
|
+
const month = String(date.getMonth() + 1).padStart(2, "0");
|
|
31
|
+
const day = String(date.getDate()).padStart(2, "0");
|
|
32
|
+
return `${year}-${month}-${day}`;
|
|
33
|
+
};
|
|
34
|
+
var formatStringToDate = (date) => {
|
|
35
|
+
const formattedDate = new Date(date);
|
|
36
|
+
return formattedDate;
|
|
37
|
+
};
|
|
38
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
39
|
+
0 && (module.exports = {
|
|
40
|
+
formatDateToString,
|
|
41
|
+
formatStringToDate
|
|
42
|
+
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as tailwind_variants from 'tailwind-variants';
|
|
2
2
|
import { VariantProps } from 'tailwind-variants';
|
|
3
3
|
import * as tailwind_variants_dist_config from 'tailwind-variants/dist/config';
|
|
4
|
-
import
|
|
4
|
+
import React__default, { ComponentProps, ReactElement } from 'react';
|
|
5
5
|
import { SlotsToClasses } from '../../utils/types.mjs';
|
|
6
6
|
|
|
7
7
|
interface Props extends Omit<ComponentProps<"input">, "size"> {
|
|
@@ -18,7 +18,7 @@ interface Props extends Omit<ComponentProps<"input">, "size"> {
|
|
|
18
18
|
classNames?: SlotsToClasses<InputSlots>;
|
|
19
19
|
}
|
|
20
20
|
type InputProps = Props & InputVariantProps;
|
|
21
|
-
declare const Input:
|
|
21
|
+
declare const Input: React__default.ForwardRefExoticComponent<Omit<InputProps, "ref"> & React__default.RefAttributes<HTMLInputElement>>;
|
|
22
22
|
|
|
23
23
|
declare const inputStyle: tailwind_variants.TVReturnType<{
|
|
24
24
|
variant: {
|