@deepnoid/ui 0.1.20 → 0.1.22
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/.turbo/turbo-build.log +162 -172
- package/dist/{chunk-LNYMVBV5.mjs → chunk-6OMHIMIA.mjs} +8 -6
- package/dist/{chunk-3DPVPTHL.mjs → chunk-EAK5DVWA.mjs} +2 -2
- package/dist/{chunk-3BKCODIL.mjs → chunk-ICZTNO4V.mjs} +3 -3
- package/dist/{chunk-EGHTZLZJ.mjs → chunk-IVK24VIL.mjs} +1 -1
- package/dist/chunk-MSAULFDB.mjs +348 -0
- package/dist/{chunk-JOCMCOEK.mjs → chunk-P5PJTJLY.mjs} +13 -2
- package/dist/{chunk-63WXGSTV.mjs → chunk-XRC5OUYQ.mjs} +23 -13
- package/dist/components/input/index.js +13 -2
- package/dist/components/input/index.mjs +1 -1
- package/dist/components/input/input.js +13 -2
- package/dist/components/input/input.mjs +1 -1
- package/dist/components/modal/index.mjs +1 -1
- package/dist/components/modal/modal.mjs +1 -1
- package/dist/components/pagination/index.js +13 -2
- package/dist/components/pagination/index.mjs +2 -2
- package/dist/components/pagination/pagination.js +13 -2
- package/dist/components/pagination/pagination.mjs +2 -2
- package/dist/components/select/index.d.mts +1 -1
- package/dist/components/select/index.d.ts +1 -1
- package/dist/components/select/index.js +301 -286
- package/dist/components/select/index.mjs +2 -3
- package/dist/components/select/select.d.mts +190 -177
- package/dist/components/select/select.d.ts +190 -177
- package/dist/components/select/select.js +301 -286
- package/dist/components/select/select.mjs +2 -3
- package/dist/components/table/form-table.js +3 -3
- package/dist/components/table/form-table.mjs +1 -1
- package/dist/components/table/index.js +46 -23
- package/dist/components/table/index.mjs +6 -6
- package/dist/components/table/table-body.d.mts +3 -2
- package/dist/components/table/table-body.d.ts +3 -2
- package/dist/components/table/table-body.js +23 -13
- package/dist/components/table/table-body.mjs +1 -1
- package/dist/components/table/table-head.d.mts +2 -2
- package/dist/components/table/table-head.d.ts +2 -2
- package/dist/components/table/table-head.js +2 -2
- package/dist/components/table/table-head.mjs +1 -1
- package/dist/components/table/table.d.mts +2 -1
- package/dist/components/table/table.d.ts +2 -1
- package/dist/components/table/table.js +43 -20
- package/dist/components/table/table.mjs +5 -5
- package/dist/index.js +493 -497
- package/dist/index.mjs +28 -30
- package/package.json +1 -1
- package/dist/chunk-BXXAMH3R.mjs +0 -255
- package/dist/chunk-OF3X4BXG.mjs +0 -76
- package/dist/chunk-S3QS5B7F.mjs +0 -61
- package/dist/components/select/option.d.mts +0 -17
- package/dist/components/select/option.d.ts +0 -17
- package/dist/components/select/option.js +0 -4359
- package/dist/components/select/option.mjs +0 -12
- package/dist/components/select/useSelect.d.mts +0 -31
- package/dist/components/select/useSelect.d.ts +0 -31
- package/dist/components/select/useSelect.js +0 -84
- package/dist/components/select/useSelect.mjs +0 -8
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import {
|
|
3
|
-
option_default
|
|
4
|
-
} from "../../chunk-OF3X4BXG.mjs";
|
|
5
|
-
import "../../chunk-ZYIIXWVY.mjs";
|
|
6
|
-
import "../../chunk-HWL7TPUN.mjs";
|
|
7
|
-
import "../../chunk-3IU2RPSM.mjs";
|
|
8
|
-
import "../../chunk-4ZJFD3L3.mjs";
|
|
9
|
-
import "../../chunk-AC6TWLRT.mjs";
|
|
10
|
-
export {
|
|
11
|
-
option_default as default
|
|
12
|
-
};
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import * as react from 'react';
|
|
2
|
-
import { SelectOption } from './select.mjs';
|
|
3
|
-
import 'tailwind-variants';
|
|
4
|
-
import '../../utils/types.mjs';
|
|
5
|
-
|
|
6
|
-
interface SelectHookProps {
|
|
7
|
-
options: SelectOption[];
|
|
8
|
-
defaultOption?: SelectOption;
|
|
9
|
-
onChange?: (option: SelectOption) => void;
|
|
10
|
-
}
|
|
11
|
-
type TargetRect = {
|
|
12
|
-
x: number;
|
|
13
|
-
y: number;
|
|
14
|
-
width: number;
|
|
15
|
-
height: number;
|
|
16
|
-
};
|
|
17
|
-
declare const useSelect: ({ options, defaultOption, onChange }: SelectHookProps) => {
|
|
18
|
-
selectedOption: SelectOption | undefined;
|
|
19
|
-
targetRect: TargetRect | null;
|
|
20
|
-
optionWrapperHeight: number;
|
|
21
|
-
selectWrapperRef: react.RefObject<HTMLDivElement | null>;
|
|
22
|
-
optionWrapperRef: react.RefObject<HTMLDivElement | null>;
|
|
23
|
-
handleToggleSelect: () => void;
|
|
24
|
-
handleChangeOption: (option: SelectOption) => void;
|
|
25
|
-
calculatePositionWithScroll: (targetRect: TargetRect, optionWrapperHeight: number) => {
|
|
26
|
-
top: number;
|
|
27
|
-
left: number;
|
|
28
|
-
};
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
export { useSelect };
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import * as react from 'react';
|
|
2
|
-
import { SelectOption } from './select.js';
|
|
3
|
-
import 'tailwind-variants';
|
|
4
|
-
import '../../utils/types.js';
|
|
5
|
-
|
|
6
|
-
interface SelectHookProps {
|
|
7
|
-
options: SelectOption[];
|
|
8
|
-
defaultOption?: SelectOption;
|
|
9
|
-
onChange?: (option: SelectOption) => void;
|
|
10
|
-
}
|
|
11
|
-
type TargetRect = {
|
|
12
|
-
x: number;
|
|
13
|
-
y: number;
|
|
14
|
-
width: number;
|
|
15
|
-
height: number;
|
|
16
|
-
};
|
|
17
|
-
declare const useSelect: ({ options, defaultOption, onChange }: SelectHookProps) => {
|
|
18
|
-
selectedOption: SelectOption | undefined;
|
|
19
|
-
targetRect: TargetRect | null;
|
|
20
|
-
optionWrapperHeight: number;
|
|
21
|
-
selectWrapperRef: react.RefObject<HTMLDivElement | null>;
|
|
22
|
-
optionWrapperRef: react.RefObject<HTMLDivElement | null>;
|
|
23
|
-
handleToggleSelect: () => void;
|
|
24
|
-
handleChangeOption: (option: SelectOption) => void;
|
|
25
|
-
calculatePositionWithScroll: (targetRect: TargetRect, optionWrapperHeight: number) => {
|
|
26
|
-
top: number;
|
|
27
|
-
left: number;
|
|
28
|
-
};
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
export { useSelect };
|
|
@@ -1,84 +0,0 @@
|
|
|
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/select/useSelect.tsx
|
|
22
|
-
var useSelect_exports = {};
|
|
23
|
-
__export(useSelect_exports, {
|
|
24
|
-
useSelect: () => useSelect
|
|
25
|
-
});
|
|
26
|
-
module.exports = __toCommonJS(useSelect_exports);
|
|
27
|
-
var import_react = require("react");
|
|
28
|
-
var useSelect = ({ options, defaultOption, onChange }) => {
|
|
29
|
-
const [selectedOption, setSelectedOption] = (0, import_react.useState)(defaultOption);
|
|
30
|
-
const [targetRect, setTargetRect] = (0, import_react.useState)(null);
|
|
31
|
-
const [optionWrapperHeight, setOptionWrapperHeight] = (0, import_react.useState)(0);
|
|
32
|
-
const selectWrapperRef = (0, import_react.useRef)(null);
|
|
33
|
-
const optionWrapperRef = (0, import_react.useRef)(null);
|
|
34
|
-
const calculatePositionWithScroll = (targetRect2, optionWrapperHeight2) => {
|
|
35
|
-
const scrollTop = window.scrollY || document.documentElement.scrollTop || document.body.scrollTop;
|
|
36
|
-
const scrollLeft = window.scrollX || document.documentElement.scrollLeft || document.body.scrollLeft;
|
|
37
|
-
const spaceBelow = window.innerHeight - (targetRect2.y + targetRect2.height + 4);
|
|
38
|
-
const spaceAbove = targetRect2.y - 4;
|
|
39
|
-
const top = spaceBelow < optionWrapperHeight2 && spaceAbove > optionWrapperHeight2 ? targetRect2.y - optionWrapperHeight2 - 4 : targetRect2.y + targetRect2.height + 4;
|
|
40
|
-
return {
|
|
41
|
-
top: top + scrollTop,
|
|
42
|
-
left: targetRect2.x + scrollLeft
|
|
43
|
-
};
|
|
44
|
-
};
|
|
45
|
-
const handleToggleSelect = () => {
|
|
46
|
-
if (selectWrapperRef.current) {
|
|
47
|
-
const rect = selectWrapperRef.current.getBoundingClientRect();
|
|
48
|
-
setTargetRect((prevRect) => prevRect ? null : { x: rect.x, y: rect.y, width: rect.width, height: rect.height });
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
const handleChangeOption = (option) => {
|
|
52
|
-
onChange == null ? void 0 : onChange(option);
|
|
53
|
-
setSelectedOption(option);
|
|
54
|
-
handleToggleSelect();
|
|
55
|
-
};
|
|
56
|
-
(0, import_react.useEffect)(() => {
|
|
57
|
-
const onClickOutside = (e) => {
|
|
58
|
-
if (optionWrapperRef.current && !optionWrapperRef.current.contains(e.target)) {
|
|
59
|
-
setTargetRect(null);
|
|
60
|
-
}
|
|
61
|
-
};
|
|
62
|
-
window.addEventListener("mousedown", onClickOutside);
|
|
63
|
-
return () => window.removeEventListener("mousedown", onClickOutside);
|
|
64
|
-
}, []);
|
|
65
|
-
(0, import_react.useEffect)(() => {
|
|
66
|
-
if (optionWrapperRef.current) {
|
|
67
|
-
setOptionWrapperHeight(optionWrapperRef.current.getBoundingClientRect().height);
|
|
68
|
-
}
|
|
69
|
-
}, [targetRect]);
|
|
70
|
-
return {
|
|
71
|
-
selectedOption,
|
|
72
|
-
targetRect,
|
|
73
|
-
optionWrapperHeight,
|
|
74
|
-
selectWrapperRef,
|
|
75
|
-
optionWrapperRef,
|
|
76
|
-
handleToggleSelect,
|
|
77
|
-
handleChangeOption,
|
|
78
|
-
calculatePositionWithScroll
|
|
79
|
-
};
|
|
80
|
-
};
|
|
81
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
82
|
-
0 && (module.exports = {
|
|
83
|
-
useSelect
|
|
84
|
-
});
|