asterui 0.10.2
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/LICENSE +15 -0
- package/README.md +214 -0
- package/dist/components/Affix.d.ts +14 -0
- package/dist/components/Alert.d.ts +10 -0
- package/dist/components/Autocomplete.d.ts +18 -0
- package/dist/components/Avatar.d.ts +28 -0
- package/dist/components/Badge.d.ts +20 -0
- package/dist/components/Breadcrumb.d.ts +15 -0
- package/dist/components/Browser.d.ts +7 -0
- package/dist/components/Button.d.ts +23 -0
- package/dist/components/Card.d.ts +26 -0
- package/dist/components/Carousel.d.ts +14 -0
- package/dist/components/Cascader.d.ts +19 -0
- package/dist/components/Chart.d.ts +19 -0
- package/dist/components/Chat.d.ts +11 -0
- package/dist/components/Checkbox.d.ts +27 -0
- package/dist/components/Code.d.ts +14 -0
- package/dist/components/Collapse.d.ts +25 -0
- package/dist/components/ColorPicker.d.ts +10 -0
- package/dist/components/Container.d.ts +6 -0
- package/dist/components/ContextMenu.d.ts +23 -0
- package/dist/components/Countdown.d.ts +27 -0
- package/dist/components/DatePicker.d.ts +11 -0
- package/dist/components/Descriptions.d.ts +34 -0
- package/dist/components/Divider.d.ts +8 -0
- package/dist/components/Drawer.d.ts +10 -0
- package/dist/components/Dropdown.d.ts +39 -0
- package/dist/components/Empty.d.ts +8 -0
- package/dist/components/Fieldset.d.ts +15 -0
- package/dist/components/FileInput.d.ts +9 -0
- package/dist/components/Flex.d.ts +14 -0
- package/dist/components/FloatButton.d.ts +34 -0
- package/dist/components/Footer.d.ts +16 -0
- package/dist/components/Form.d.ts +66 -0
- package/dist/components/Grid.d.ts +26 -0
- package/dist/components/Hero.d.ts +9 -0
- package/dist/components/Image.d.ts +14 -0
- package/dist/components/Indicator.d.ts +7 -0
- package/dist/components/Input.d.ts +14 -0
- package/dist/components/InputNumber.d.ts +19 -0
- package/dist/components/Join.d.ts +6 -0
- package/dist/components/Label.d.ts +15 -0
- package/dist/components/Layout.d.ts +59 -0
- package/dist/components/List.d.ts +13 -0
- package/dist/components/Loading.d.ts +9 -0
- package/dist/components/Masonry.d.ts +15 -0
- package/dist/components/Mention.d.ts +30 -0
- package/dist/components/Menu.d.ts +45 -0
- package/dist/components/Modal.d.ts +42 -0
- package/dist/components/Navbar.d.ts +8 -0
- package/dist/components/Notification.d.ts +43 -0
- package/dist/components/OTPInput.d.ts +32 -0
- package/dist/components/PageLayout.d.ts +9 -0
- package/dist/components/Pagination.d.ts +18 -0
- package/dist/components/Phone.d.ts +8 -0
- package/dist/components/Popconfirm.d.ts +17 -0
- package/dist/components/Popover.d.ts +15 -0
- package/dist/components/Progress.d.ts +5 -0
- package/dist/components/QRCode.d.ts +19 -0
- package/dist/components/RadialProgress.d.ts +10 -0
- package/dist/components/Radio.d.ts +20 -0
- package/dist/components/Range.d.ts +16 -0
- package/dist/components/Rating.d.ts +22 -0
- package/dist/components/Responsive.d.ts +18 -0
- package/dist/components/Result.d.ts +12 -0
- package/dist/components/Select.d.ts +10 -0
- package/dist/components/Skeleton.d.ts +9 -0
- package/dist/components/Space.d.ts +10 -0
- package/dist/components/Splitter.d.ts +27 -0
- package/dist/components/Stack.d.ts +10 -0
- package/dist/components/Stat.d.ts +18 -0
- package/dist/components/Steps.d.ts +16 -0
- package/dist/components/Table.d.ts +51 -0
- package/dist/components/Tabs.d.ts +21 -0
- package/dist/components/Tag.d.ts +18 -0
- package/dist/components/Textarea.d.ts +9 -0
- package/dist/components/ThemeController.d.ts +20 -0
- package/dist/components/TimePicker.d.ts +12 -0
- package/dist/components/Timeline.d.ts +24 -0
- package/dist/components/Toggle.d.ts +7 -0
- package/dist/components/Tooltip.d.ts +9 -0
- package/dist/components/Transfer.d.ts +22 -0
- package/dist/components/Tree.d.ts +40 -0
- package/dist/components/TreeSelect.d.ts +20 -0
- package/dist/components/Typography.d.ts +53 -0
- package/dist/components/Upload.d.ts +38 -0
- package/dist/components/Window.d.ts +7 -0
- package/dist/hooks/useBreakpoint.d.ts +10 -0
- package/dist/index.d.ts +172 -0
- package/dist/index.js +182 -0
- package/dist/index.js.map +1 -0
- package/dist/index10.js +33 -0
- package/dist/index10.js.map +1 -0
- package/dist/index100.js +24 -0
- package/dist/index100.js.map +1 -0
- package/dist/index101.js +27 -0
- package/dist/index101.js.map +1 -0
- package/dist/index102.js +23 -0
- package/dist/index102.js.map +1 -0
- package/dist/index103.js +103 -0
- package/dist/index103.js.map +1 -0
- package/dist/index104.js +363 -0
- package/dist/index104.js.map +1 -0
- package/dist/index105.js +28 -0
- package/dist/index105.js.map +1 -0
- package/dist/index106.js +76 -0
- package/dist/index106.js.map +1 -0
- package/dist/index107.js +19 -0
- package/dist/index107.js.map +1 -0
- package/dist/index108.js +69 -0
- package/dist/index108.js.map +1 -0
- package/dist/index109.js +147 -0
- package/dist/index109.js.map +1 -0
- package/dist/index11.js +268 -0
- package/dist/index11.js.map +1 -0
- package/dist/index110.js +5 -0
- package/dist/index110.js.map +1 -0
- package/dist/index111.js +59 -0
- package/dist/index111.js.map +1 -0
- package/dist/index112.js +5 -0
- package/dist/index112.js.map +1 -0
- package/dist/index113.js +5 -0
- package/dist/index113.js.map +1 -0
- package/dist/index114.js +5 -0
- package/dist/index114.js.map +1 -0
- package/dist/index115.js +5 -0
- package/dist/index115.js.map +1 -0
- package/dist/index116.js +5 -0
- package/dist/index116.js.map +1 -0
- package/dist/index117.js +5 -0
- package/dist/index117.js.map +1 -0
- package/dist/index118.js +5 -0
- package/dist/index118.js.map +1 -0
- package/dist/index119.js +5 -0
- package/dist/index119.js.map +1 -0
- package/dist/index12.js +98 -0
- package/dist/index12.js.map +1 -0
- package/dist/index120.js +35 -0
- package/dist/index120.js.map +1 -0
- package/dist/index121.js +5 -0
- package/dist/index121.js.map +1 -0
- package/dist/index122.js +11 -0
- package/dist/index122.js.map +1 -0
- package/dist/index123.js +5 -0
- package/dist/index123.js.map +1 -0
- package/dist/index124.js +5 -0
- package/dist/index124.js.map +1 -0
- package/dist/index125.js +24 -0
- package/dist/index125.js.map +1 -0
- package/dist/index126.js +5 -0
- package/dist/index126.js.map +1 -0
- package/dist/index127.js +27 -0
- package/dist/index127.js.map +1 -0
- package/dist/index128.js +74 -0
- package/dist/index128.js.map +1 -0
- package/dist/index129.js +24 -0
- package/dist/index129.js.map +1 -0
- package/dist/index13.js +161 -0
- package/dist/index13.js.map +1 -0
- package/dist/index130.js +37 -0
- package/dist/index130.js.map +1 -0
- package/dist/index131.js +73 -0
- package/dist/index131.js.map +1 -0
- package/dist/index132.js +5 -0
- package/dist/index132.js.map +1 -0
- package/dist/index133.js +25 -0
- package/dist/index133.js.map +1 -0
- package/dist/index134.js +5 -0
- package/dist/index134.js.map +1 -0
- package/dist/index135.js +5 -0
- package/dist/index135.js.map +1 -0
- package/dist/index136.js +5 -0
- package/dist/index136.js.map +1 -0
- package/dist/index137.js +5 -0
- package/dist/index137.js.map +1 -0
- package/dist/index138.js +7 -0
- package/dist/index138.js.map +1 -0
- package/dist/index14.js +153 -0
- package/dist/index14.js.map +1 -0
- package/dist/index15.js +8 -0
- package/dist/index15.js.map +1 -0
- package/dist/index16.js +74 -0
- package/dist/index16.js.map +1 -0
- package/dist/index17.js +20 -0
- package/dist/index17.js.map +1 -0
- package/dist/index18.js +101 -0
- package/dist/index18.js.map +1 -0
- package/dist/index19.js +117 -0
- package/dist/index19.js.map +1 -0
- package/dist/index2.js +50 -0
- package/dist/index2.js.map +1 -0
- package/dist/index20.js +187 -0
- package/dist/index20.js.map +1 -0
- package/dist/index21.js +113 -0
- package/dist/index21.js.map +1 -0
- package/dist/index22.js +35 -0
- package/dist/index22.js.map +1 -0
- package/dist/index23.js +44 -0
- package/dist/index23.js.map +1 -0
- package/dist/index24.js +15 -0
- package/dist/index24.js.map +1 -0
- package/dist/index25.js +36 -0
- package/dist/index25.js.map +1 -0
- package/dist/index26.js +66 -0
- package/dist/index26.js.map +1 -0
- package/dist/index27.js +83 -0
- package/dist/index27.js.map +1 -0
- package/dist/index28.js +21 -0
- package/dist/index28.js.map +1 -0
- package/dist/index29.js +164 -0
- package/dist/index29.js.map +1 -0
- package/dist/index3.js +31 -0
- package/dist/index3.js.map +1 -0
- package/dist/index30.js +1085 -0
- package/dist/index30.js.map +1 -0
- package/dist/index31.js +21 -0
- package/dist/index31.js.map +1 -0
- package/dist/index32.js +125 -0
- package/dist/index32.js.map +1 -0
- package/dist/index33.js +43 -0
- package/dist/index33.js.map +1 -0
- package/dist/index34.js +194 -0
- package/dist/index34.js.map +1 -0
- package/dist/index35.js +100 -0
- package/dist/index35.js.map +1 -0
- package/dist/index36.js +165 -0
- package/dist/index36.js.map +1 -0
- package/dist/index37.js +149 -0
- package/dist/index37.js.map +1 -0
- package/dist/index38.js +18 -0
- package/dist/index38.js.map +1 -0
- package/dist/index39.js +24 -0
- package/dist/index39.js.map +1 -0
- package/dist/index4.js +104 -0
- package/dist/index4.js.map +1 -0
- package/dist/index40.js +122 -0
- package/dist/index40.js.map +1 -0
- package/dist/index41.js +16 -0
- package/dist/index41.js.map +1 -0
- package/dist/index42.js +38 -0
- package/dist/index42.js.map +1 -0
- package/dist/index43.js +119 -0
- package/dist/index43.js.map +1 -0
- package/dist/index44.js +179 -0
- package/dist/index44.js.map +1 -0
- package/dist/index45.js +150 -0
- package/dist/index45.js.map +1 -0
- package/dist/index46.js +15 -0
- package/dist/index46.js.map +1 -0
- package/dist/index47.js +25 -0
- package/dist/index47.js.map +1 -0
- package/dist/index48.js +17 -0
- package/dist/index48.js.map +1 -0
- package/dist/index49.js +10 -0
- package/dist/index49.js.map +1 -0
- package/dist/index5.js +64 -0
- package/dist/index5.js.map +1 -0
- package/dist/index50.js +269 -0
- package/dist/index50.js.map +1 -0
- package/dist/index51.js +20 -0
- package/dist/index51.js.map +1 -0
- package/dist/index52.js +125 -0
- package/dist/index52.js.map +1 -0
- package/dist/index53.js +113 -0
- package/dist/index53.js.map +1 -0
- package/dist/index54.js +173 -0
- package/dist/index54.js.map +1 -0
- package/dist/index55.js +35 -0
- package/dist/index55.js.map +1 -0
- package/dist/index56.js +125 -0
- package/dist/index56.js.map +1 -0
- package/dist/index57.js +89 -0
- package/dist/index57.js.map +1 -0
- package/dist/index58.js +23 -0
- package/dist/index58.js.map +1 -0
- package/dist/index59.js +77 -0
- package/dist/index59.js.map +1 -0
- package/dist/index6.js +133 -0
- package/dist/index6.js.map +1 -0
- package/dist/index60.js +60 -0
- package/dist/index60.js.map +1 -0
- package/dist/index61.js +48 -0
- package/dist/index61.js.map +1 -0
- package/dist/index62.js +55 -0
- package/dist/index62.js.map +1 -0
- package/dist/index63.js +65 -0
- package/dist/index63.js.map +1 -0
- package/dist/index64.js +110 -0
- package/dist/index64.js.map +1 -0
- package/dist/index65.js +44 -0
- package/dist/index65.js.map +1 -0
- package/dist/index66.js +24 -0
- package/dist/index66.js.map +1 -0
- package/dist/index67.js +49 -0
- package/dist/index67.js.map +1 -0
- package/dist/index68.js +137 -0
- package/dist/index68.js.map +1 -0
- package/dist/index69.js +55 -0
- package/dist/index69.js.map +1 -0
- package/dist/index7.js +14 -0
- package/dist/index7.js.map +1 -0
- package/dist/index70.js +25 -0
- package/dist/index70.js.map +1 -0
- package/dist/index71.js +25 -0
- package/dist/index71.js.map +1 -0
- package/dist/index72.js +332 -0
- package/dist/index72.js.map +1 -0
- package/dist/index73.js +59 -0
- package/dist/index73.js.map +1 -0
- package/dist/index74.js +43 -0
- package/dist/index74.js.map +1 -0
- package/dist/index75.js +98 -0
- package/dist/index75.js.map +1 -0
- package/dist/index76.js +133 -0
- package/dist/index76.js.map +1 -0
- package/dist/index77.js +164 -0
- package/dist/index77.js.map +1 -0
- package/dist/index78.js +68 -0
- package/dist/index78.js.map +1 -0
- package/dist/index79.js +38 -0
- package/dist/index79.js.map +1 -0
- package/dist/index8.js +73 -0
- package/dist/index8.js.map +1 -0
- package/dist/index80.js +37 -0
- package/dist/index80.js.map +1 -0
- package/dist/index81.js +213 -0
- package/dist/index81.js.map +1 -0
- package/dist/index82.js +216 -0
- package/dist/index82.js.map +1 -0
- package/dist/index83.js +298 -0
- package/dist/index83.js.map +1 -0
- package/dist/index84.js +181 -0
- package/dist/index84.js.map +1 -0
- package/dist/index85.js +261 -0
- package/dist/index85.js.map +1 -0
- package/dist/index86.js +17 -0
- package/dist/index86.js.map +1 -0
- package/dist/index87.js +36 -0
- package/dist/index87.js.map +1 -0
- package/dist/index88.js +10796 -0
- package/dist/index88.js.map +1 -0
- package/dist/index89.js +8 -0
- package/dist/index89.js.map +1 -0
- package/dist/index9.js +95 -0
- package/dist/index9.js.map +1 -0
- package/dist/index90.js +45 -0
- package/dist/index90.js.map +1 -0
- package/dist/index91.js +5 -0
- package/dist/index91.js.map +1 -0
- package/dist/index92.js +10 -0
- package/dist/index92.js.map +1 -0
- package/dist/index93.js +155 -0
- package/dist/index93.js.map +1 -0
- package/dist/index94.js +33 -0
- package/dist/index94.js.map +1 -0
- package/dist/index95.js +33 -0
- package/dist/index95.js.map +1 -0
- package/dist/index96.js +5 -0
- package/dist/index96.js.map +1 -0
- package/dist/index97.js +75 -0
- package/dist/index97.js.map +1 -0
- package/dist/index98.js +42 -0
- package/dist/index98.js.map +1 -0
- package/dist/index99.js +29 -0
- package/dist/index99.js.map +1 -0
- package/package.json +71 -0
package/dist/index35.js
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { jsxs as e, jsx as a } from "react/jsx-runtime";
|
|
2
|
+
const r = () => /* @__PURE__ */ a(
|
|
3
|
+
"svg",
|
|
4
|
+
{
|
|
5
|
+
width: "184",
|
|
6
|
+
height: "152",
|
|
7
|
+
viewBox: "0 0 184 152",
|
|
8
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
9
|
+
className: "mx-auto",
|
|
10
|
+
children: /* @__PURE__ */ e("g", { fill: "none", fillRule: "evenodd", children: [
|
|
11
|
+
/* @__PURE__ */ e("g", { transform: "translate(24 31.67)", children: [
|
|
12
|
+
/* @__PURE__ */ a(
|
|
13
|
+
"ellipse",
|
|
14
|
+
{
|
|
15
|
+
className: "fill-base-300",
|
|
16
|
+
cx: "67.797",
|
|
17
|
+
cy: "106.89",
|
|
18
|
+
rx: "67.797",
|
|
19
|
+
ry: "12.668"
|
|
20
|
+
}
|
|
21
|
+
),
|
|
22
|
+
/* @__PURE__ */ a(
|
|
23
|
+
"path",
|
|
24
|
+
{
|
|
25
|
+
className: "fill-base-200",
|
|
26
|
+
d: "M122.034 69.674L98.109 40.229c-1.148-1.386-2.826-2.225-4.593-2.225h-51.44c-1.766 0-3.444.839-4.592 2.225L13.56 69.674v15.383h108.475V69.674z"
|
|
27
|
+
}
|
|
28
|
+
),
|
|
29
|
+
/* @__PURE__ */ a(
|
|
30
|
+
"path",
|
|
31
|
+
{
|
|
32
|
+
className: "fill-base-100",
|
|
33
|
+
d: "M101.537 86.214L80.63 61.102c-1.001-1.207-2.507-1.867-4.048-1.867H31.724c-1.54 0-3.047.66-4.048 1.867L6.769 86.214v13.792h94.768V86.214z",
|
|
34
|
+
transform: "translate(13.56)"
|
|
35
|
+
}
|
|
36
|
+
),
|
|
37
|
+
/* @__PURE__ */ a(
|
|
38
|
+
"ellipse",
|
|
39
|
+
{
|
|
40
|
+
className: "fill-base-300",
|
|
41
|
+
cx: "67.797",
|
|
42
|
+
cy: "106.89",
|
|
43
|
+
rx: "67.797",
|
|
44
|
+
ry: "12.668"
|
|
45
|
+
}
|
|
46
|
+
),
|
|
47
|
+
/* @__PURE__ */ a(
|
|
48
|
+
"path",
|
|
49
|
+
{
|
|
50
|
+
className: "fill-base-200",
|
|
51
|
+
d: "M122.034 69.674L98.109 40.229c-1.148-1.386-2.826-2.225-4.593-2.225h-51.44c-1.766 0-3.444.839-4.592 2.225L13.56 69.674v15.383h108.475V69.674z"
|
|
52
|
+
}
|
|
53
|
+
),
|
|
54
|
+
/* @__PURE__ */ a(
|
|
55
|
+
"path",
|
|
56
|
+
{
|
|
57
|
+
className: "fill-base-content opacity-10",
|
|
58
|
+
d: "M33.83 0h67.933a4 4 0 0 1 4 4v93.344a4 4 0 0 1-4 4H33.83a4 4 0 0 1-4-4V4a4 4 0 0 1 4-4z"
|
|
59
|
+
}
|
|
60
|
+
),
|
|
61
|
+
/* @__PURE__ */ a(
|
|
62
|
+
"path",
|
|
63
|
+
{
|
|
64
|
+
className: "fill-base-100",
|
|
65
|
+
d: "M42.678 9.953h50.237a2 2 0 0 1 2 2V36.91a2 2 0 0 1-2 2H42.678a2 2 0 0 1-2-2V11.953a2 2 0 0 1 2-2zM42.94 49.767h49.713a2.262 2.262 0 1 1 0 4.524H42.94a2.262 2.262 0 0 1 0-4.524zM42.94 61.53h49.713a2.262 2.262 0 1 1 0 4.525H42.94a2.262 2.262 0 0 1 0-4.525zM121.813 105.032c-.775 3.071-3.497 5.36-6.735 5.36H20.515c-3.238 0-5.96-2.29-6.734-5.36a7.309 7.309 0 0 1-.222-1.79V69.675h26.318c2.907 0 5.25 2.448 5.25 5.42v.04c0 2.971 2.37 5.37 5.277 5.37h34.785c2.907 0 5.277-2.421 5.277-5.393V75.1c0-2.972 2.343-5.426 5.25-5.426h26.318v33.569c0 .617-.077 1.216-.221 1.789z"
|
|
66
|
+
}
|
|
67
|
+
)
|
|
68
|
+
] }),
|
|
69
|
+
/* @__PURE__ */ a(
|
|
70
|
+
"path",
|
|
71
|
+
{
|
|
72
|
+
className: "fill-base-content opacity-10",
|
|
73
|
+
d: "M149.121 33.292l-6.83 2.65a1 1 0 0 1-1.317-1.23l1.937-6.207c-2.589-2.944-4.109-6.534-4.109-10.408C138.802 8.102 148.92 0 161.402 0 173.881 0 184 8.102 184 18.097c0 9.995-10.118 18.097-22.599 18.097-4.528 0-8.744-1.066-12.28-2.902z"
|
|
74
|
+
}
|
|
75
|
+
),
|
|
76
|
+
/* @__PURE__ */ e("g", { className: "fill-base-100", transform: "translate(149.65 15.383)", children: [
|
|
77
|
+
/* @__PURE__ */ a("ellipse", { cx: "20.654", cy: "3.167", rx: "2.849", ry: "2.815" }),
|
|
78
|
+
/* @__PURE__ */ a("path", { d: "M5.698 5.63H0L2.898.704zM9.259.704h4.985V5.63H9.259z" })
|
|
79
|
+
] })
|
|
80
|
+
] })
|
|
81
|
+
}
|
|
82
|
+
), o = ({
|
|
83
|
+
children: l,
|
|
84
|
+
className: t = "",
|
|
85
|
+
description: s = "No Data",
|
|
86
|
+
image: c,
|
|
87
|
+
imageStyle: i,
|
|
88
|
+
...h
|
|
89
|
+
}) => {
|
|
90
|
+
const n = ["flex flex-col items-center justify-center py-8 px-4", t].filter(Boolean).join(" ");
|
|
91
|
+
return /* @__PURE__ */ e("div", { className: n, ...h, children: [
|
|
92
|
+
/* @__PURE__ */ a("div", { className: "mb-2", style: i, children: c === void 0 ? /* @__PURE__ */ a(r, {}) : c }),
|
|
93
|
+
s && /* @__PURE__ */ a("div", { className: "text-base-content/60 text-sm mb-4", children: s }),
|
|
94
|
+
l && /* @__PURE__ */ a("div", { className: "mt-2", children: l })
|
|
95
|
+
] });
|
|
96
|
+
};
|
|
97
|
+
export {
|
|
98
|
+
o as Empty
|
|
99
|
+
};
|
|
100
|
+
//# sourceMappingURL=index35.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index35.js","sources":["../src/components/Empty.tsx"],"sourcesContent":["import React from 'react'\n\nexport interface EmptyProps extends React.HTMLAttributes<HTMLDivElement> {\n children?: React.ReactNode\n description?: React.ReactNode\n image?: React.ReactNode\n imageStyle?: React.CSSProperties\n}\n\nconst DefaultEmptyImage: React.FC = () => (\n <svg\n width=\"184\"\n height=\"152\"\n viewBox=\"0 0 184 152\"\n xmlns=\"http://www.w3.org/2000/svg\"\n className=\"mx-auto\"\n >\n <g fill=\"none\" fillRule=\"evenodd\">\n <g transform=\"translate(24 31.67)\">\n <ellipse\n className=\"fill-base-300\"\n cx=\"67.797\"\n cy=\"106.89\"\n rx=\"67.797\"\n ry=\"12.668\"\n />\n <path\n className=\"fill-base-200\"\n d=\"M122.034 69.674L98.109 40.229c-1.148-1.386-2.826-2.225-4.593-2.225h-51.44c-1.766 0-3.444.839-4.592 2.225L13.56 69.674v15.383h108.475V69.674z\"\n />\n <path\n className=\"fill-base-100\"\n d=\"M101.537 86.214L80.63 61.102c-1.001-1.207-2.507-1.867-4.048-1.867H31.724c-1.54 0-3.047.66-4.048 1.867L6.769 86.214v13.792h94.768V86.214z\"\n transform=\"translate(13.56)\"\n />\n <ellipse\n className=\"fill-base-300\"\n cx=\"67.797\"\n cy=\"106.89\"\n rx=\"67.797\"\n ry=\"12.668\"\n />\n <path\n className=\"fill-base-200\"\n d=\"M122.034 69.674L98.109 40.229c-1.148-1.386-2.826-2.225-4.593-2.225h-51.44c-1.766 0-3.444.839-4.592 2.225L13.56 69.674v15.383h108.475V69.674z\"\n />\n <path\n className=\"fill-base-content opacity-10\"\n d=\"M33.83 0h67.933a4 4 0 0 1 4 4v93.344a4 4 0 0 1-4 4H33.83a4 4 0 0 1-4-4V4a4 4 0 0 1 4-4z\"\n />\n <path\n className=\"fill-base-100\"\n d=\"M42.678 9.953h50.237a2 2 0 0 1 2 2V36.91a2 2 0 0 1-2 2H42.678a2 2 0 0 1-2-2V11.953a2 2 0 0 1 2-2zM42.94 49.767h49.713a2.262 2.262 0 1 1 0 4.524H42.94a2.262 2.262 0 0 1 0-4.524zM42.94 61.53h49.713a2.262 2.262 0 1 1 0 4.525H42.94a2.262 2.262 0 0 1 0-4.525zM121.813 105.032c-.775 3.071-3.497 5.36-6.735 5.36H20.515c-3.238 0-5.96-2.29-6.734-5.36a7.309 7.309 0 0 1-.222-1.79V69.675h26.318c2.907 0 5.25 2.448 5.25 5.42v.04c0 2.971 2.37 5.37 5.277 5.37h34.785c2.907 0 5.277-2.421 5.277-5.393V75.1c0-2.972 2.343-5.426 5.25-5.426h26.318v33.569c0 .617-.077 1.216-.221 1.789z\"\n />\n </g>\n <path\n className=\"fill-base-content opacity-10\"\n d=\"M149.121 33.292l-6.83 2.65a1 1 0 0 1-1.317-1.23l1.937-6.207c-2.589-2.944-4.109-6.534-4.109-10.408C138.802 8.102 148.92 0 161.402 0 173.881 0 184 8.102 184 18.097c0 9.995-10.118 18.097-22.599 18.097-4.528 0-8.744-1.066-12.28-2.902z\"\n />\n <g className=\"fill-base-100\" transform=\"translate(149.65 15.383)\">\n <ellipse cx=\"20.654\" cy=\"3.167\" rx=\"2.849\" ry=\"2.815\" />\n <path d=\"M5.698 5.63H0L2.898.704zM9.259.704h4.985V5.63H9.259z\" />\n </g>\n </g>\n </svg>\n)\n\nexport const Empty: React.FC<EmptyProps> = ({\n children,\n className = '',\n description = 'No Data',\n image,\n imageStyle,\n ...rest\n}) => {\n const classes = ['flex flex-col items-center justify-center py-8 px-4', className]\n .filter(Boolean)\n .join(' ')\n\n return (\n <div className={classes} {...rest}>\n <div className=\"mb-2\" style={imageStyle}>\n {image === undefined ? <DefaultEmptyImage /> : image}\n </div>\n {description && (\n <div className=\"text-base-content/60 text-sm mb-4\">{description}</div>\n )}\n {children && <div className=\"mt-2\">{children}</div>}\n </div>\n )\n}\n"],"names":["DefaultEmptyImage","jsx","jsxs","Empty","children","className","description","image","imageStyle","rest","classes"],"mappings":";AASA,MAAMA,IAA8B,MAClC,gBAAAC;AAAA,EAAC;AAAA,EAAA;AAAA,IACC,OAAM;AAAA,IACN,QAAO;AAAA,IACP,SAAQ;AAAA,IACR,OAAM;AAAA,IACN,WAAU;AAAA,IAEV,UAAA,gBAAAC,EAAC,KAAA,EAAE,MAAK,QAAO,UAAS,WACtB,UAAA;AAAA,MAAA,gBAAAA,EAAC,KAAA,EAAE,WAAU,uBACX,UAAA;AAAA,QAAA,gBAAAD;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,WAAU;AAAA,YACV,IAAG;AAAA,YACH,IAAG;AAAA,YACH,IAAG;AAAA,YACH,IAAG;AAAA,UAAA;AAAA,QAAA;AAAA,QAEL,gBAAAA;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,WAAU;AAAA,YACV,GAAE;AAAA,UAAA;AAAA,QAAA;AAAA,QAEJ,gBAAAA;AAAA,UAA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,WAAWQ,GAAU,GAAGD,GAC3B,UAAA;AAAA,IAAA,gBAAAR,EAAC,OAAA,EAAI,WAAU,QAAO,OAAOO,GAC1B,gBAAU,SAAY,gBAAAP,EAACD,GAAA,CAAA,CAAkB,IAAKO,EAAA,CACjD;AAAA,IACCD,KACC,gBAAAL,EAAC,OAAA,EAAI,WAAU,qCAAqC,UAAAK,GAAY;AAAA,IAEjEF,KAAY,gBAAAH,EAAC,OAAA,EAAI,WAAU,QAAQ,UAAAG,EAAA,CAAS;AAAA,EAAA,GAC/C;AAEJ;"}
|
package/dist/index36.js
ADDED
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import { jsx as Z } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as U, useRef as W, useCallback as M, useState as _, useEffect as P } from "react";
|
|
3
|
+
function T(n, e, r) {
|
|
4
|
+
let i = "", l = 0;
|
|
5
|
+
for (let x = 0; x < e.length && l <= n.length; x++) {
|
|
6
|
+
const t = e[x];
|
|
7
|
+
t === "#" || t === "A" || t === "*" ? l < n.length ? (i += n[l], l++) : i += r : i += t;
|
|
8
|
+
}
|
|
9
|
+
return i;
|
|
10
|
+
}
|
|
11
|
+
function j(n, e) {
|
|
12
|
+
let r = "";
|
|
13
|
+
for (let i = 0; i < n.length && i < e.length; i++) {
|
|
14
|
+
const l = e[i];
|
|
15
|
+
(l === "#" || l === "A" || l === "*") && n[i] !== "_" && (r += n[i]);
|
|
16
|
+
}
|
|
17
|
+
return r;
|
|
18
|
+
}
|
|
19
|
+
function X(n, e) {
|
|
20
|
+
return e === "#" ? /\d/.test(n) : e === "A" ? /[a-zA-Z]/.test(n) : e === "*" ? /[a-zA-Z0-9]/.test(n) : !1;
|
|
21
|
+
}
|
|
22
|
+
function q(n, e) {
|
|
23
|
+
for (let r = e; r < n.length; r++)
|
|
24
|
+
if (n[r] === "#" || n[r] === "A" || n[r] === "*")
|
|
25
|
+
return r;
|
|
26
|
+
return n.length;
|
|
27
|
+
}
|
|
28
|
+
const Y = U(
|
|
29
|
+
({
|
|
30
|
+
type: n = "text",
|
|
31
|
+
size: e,
|
|
32
|
+
color: r,
|
|
33
|
+
ghost: i = !1,
|
|
34
|
+
bordered: l = !0,
|
|
35
|
+
className: x = "",
|
|
36
|
+
mask: t,
|
|
37
|
+
maskPlaceholder: R = "_",
|
|
38
|
+
value: g,
|
|
39
|
+
defaultValue: N,
|
|
40
|
+
onChange: d,
|
|
41
|
+
onKeyDown: A,
|
|
42
|
+
...z
|
|
43
|
+
}, B) => {
|
|
44
|
+
const D = {
|
|
45
|
+
xs: "input-xs",
|
|
46
|
+
sm: "input-sm",
|
|
47
|
+
md: "input-md",
|
|
48
|
+
lg: "input-lg",
|
|
49
|
+
xl: "input-xl"
|
|
50
|
+
}, F = {
|
|
51
|
+
neutral: "input-neutral",
|
|
52
|
+
primary: "input-primary",
|
|
53
|
+
secondary: "input-secondary",
|
|
54
|
+
accent: "input-accent",
|
|
55
|
+
info: "input-info",
|
|
56
|
+
success: "input-success",
|
|
57
|
+
warning: "input-warning",
|
|
58
|
+
error: "input-error"
|
|
59
|
+
}, S = [
|
|
60
|
+
"input",
|
|
61
|
+
!l && "border-0",
|
|
62
|
+
i && "input-ghost",
|
|
63
|
+
e && D[e],
|
|
64
|
+
r && F[r],
|
|
65
|
+
x
|
|
66
|
+
].filter(Boolean).join(" "), G = W(null), C = B || G, H = M(() => t ? j(g ?? N ?? "", t) : "", [t, g, N]), [b, v] = _(H), [I, E] = _(null);
|
|
67
|
+
P(() => {
|
|
68
|
+
t && g !== void 0 && v(j(g, t));
|
|
69
|
+
}, [t, g]), P(() => {
|
|
70
|
+
I !== null && C.current && (C.current.setSelectionRange(I, I), E(null));
|
|
71
|
+
}, [I, C]);
|
|
72
|
+
const J = M(
|
|
73
|
+
(s) => {
|
|
74
|
+
if (!t) {
|
|
75
|
+
d?.(s);
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
const f = s.target, y = f.value, h = j(y, t);
|
|
79
|
+
let p = "", a = 0;
|
|
80
|
+
for (let c = 0; c < t.length && a < h.length; c++) {
|
|
81
|
+
const o = t[c];
|
|
82
|
+
(o === "#" || o === "A" || o === "*") && (X(h[a], o) && (p += h[a]), a++);
|
|
83
|
+
}
|
|
84
|
+
v(p);
|
|
85
|
+
const V = T(p, t, R);
|
|
86
|
+
let u = q(t, 0), w = 0;
|
|
87
|
+
for (let c = 0; c < t.length; c++) {
|
|
88
|
+
const o = t[c];
|
|
89
|
+
(o === "#" || o === "A" || o === "*") && w < p.length && (w++, u = c + 1);
|
|
90
|
+
}
|
|
91
|
+
u = q(t, u), u > t.length && (u = t.length), E(u);
|
|
92
|
+
const Q = {
|
|
93
|
+
...s,
|
|
94
|
+
target: { ...f, value: V },
|
|
95
|
+
currentTarget: { ...f, value: V }
|
|
96
|
+
};
|
|
97
|
+
d?.(Q);
|
|
98
|
+
},
|
|
99
|
+
[t, R, d]
|
|
100
|
+
), L = M(
|
|
101
|
+
(s) => {
|
|
102
|
+
if (!t) {
|
|
103
|
+
A?.(s);
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
if (s.key === "Backspace") {
|
|
107
|
+
s.preventDefault();
|
|
108
|
+
const f = b.slice(0, -1);
|
|
109
|
+
v(f);
|
|
110
|
+
let y = 0, h = 0;
|
|
111
|
+
for (let u = 0; u < t.length; u++) {
|
|
112
|
+
const w = t[u];
|
|
113
|
+
if (w === "#" || w === "A" || w === "*")
|
|
114
|
+
if (h < f.length)
|
|
115
|
+
h++, y = u + 1;
|
|
116
|
+
else {
|
|
117
|
+
y = u;
|
|
118
|
+
break;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
E(y);
|
|
122
|
+
const p = T(f, t, R), a = s.currentTarget, V = {
|
|
123
|
+
target: { ...a, value: p },
|
|
124
|
+
currentTarget: { ...a, value: p }
|
|
125
|
+
};
|
|
126
|
+
d?.(V);
|
|
127
|
+
}
|
|
128
|
+
A?.(s);
|
|
129
|
+
},
|
|
130
|
+
[t, R, b, d, A]
|
|
131
|
+
);
|
|
132
|
+
if (!t)
|
|
133
|
+
return /* @__PURE__ */ Z(
|
|
134
|
+
"input",
|
|
135
|
+
{
|
|
136
|
+
ref: B,
|
|
137
|
+
type: n,
|
|
138
|
+
className: S,
|
|
139
|
+
value: g,
|
|
140
|
+
defaultValue: N,
|
|
141
|
+
onChange: d,
|
|
142
|
+
onKeyDown: A,
|
|
143
|
+
...z
|
|
144
|
+
}
|
|
145
|
+
);
|
|
146
|
+
const O = T(b, t, R);
|
|
147
|
+
return /* @__PURE__ */ Z(
|
|
148
|
+
"input",
|
|
149
|
+
{
|
|
150
|
+
ref: C,
|
|
151
|
+
type: "text",
|
|
152
|
+
className: S,
|
|
153
|
+
value: O,
|
|
154
|
+
onChange: J,
|
|
155
|
+
onKeyDown: L,
|
|
156
|
+
...z
|
|
157
|
+
}
|
|
158
|
+
);
|
|
159
|
+
}
|
|
160
|
+
);
|
|
161
|
+
Y.displayName = "Input";
|
|
162
|
+
export {
|
|
163
|
+
Y as Input
|
|
164
|
+
};
|
|
165
|
+
//# sourceMappingURL=index36.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index36.js","sources":["../src/components/Input.tsx"],"sourcesContent":["import React, { forwardRef, useState, useCallback, useRef, useEffect } from 'react'\n\nexport interface InputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'size'> {\n type?: 'text' | 'password' | 'email' | 'number' | 'date' | 'datetime-local' | 'week' | 'month' | 'tel' | 'url' | 'search' | 'time'\n size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl'\n color?: 'neutral' | 'primary' | 'secondary' | 'accent' | 'info' | 'success' | 'warning' | 'error'\n ghost?: boolean\n bordered?: boolean\n className?: string\n /** Input mask pattern. Use # for digits, A for letters, * for alphanumeric */\n mask?: string\n /** Placeholder character shown in mask (default: _) */\n maskPlaceholder?: string\n}\n\n// Helper to apply mask to raw value\nfunction applyMask(raw: string, mask: string, placeholder: string): string {\n let result = ''\n let rawIndex = 0\n\n for (let i = 0; i < mask.length && rawIndex <= raw.length; i++) {\n const maskChar = mask[i]\n if (maskChar === '#' || maskChar === 'A' || maskChar === '*') {\n if (rawIndex < raw.length) {\n result += raw[rawIndex]\n rawIndex++\n } else {\n result += placeholder\n }\n } else {\n result += maskChar\n }\n }\n\n return result\n}\n\n// Extract raw value from masked input\nfunction extractRaw(value: string, mask: string): string {\n let raw = ''\n for (let i = 0; i < value.length && i < mask.length; i++) {\n const maskChar = mask[i]\n if ((maskChar === '#' || maskChar === 'A' || maskChar === '*') && value[i] !== '_') {\n raw += value[i]\n }\n }\n return raw\n}\n\n// Check if character is valid for mask position\nfunction isValidChar(char: string, maskChar: string): boolean {\n if (maskChar === '#') return /\\d/.test(char)\n if (maskChar === 'A') return /[a-zA-Z]/.test(char)\n if (maskChar === '*') return /[a-zA-Z0-9]/.test(char)\n return false\n}\n\n// Find next input position in mask\nfunction findNextInputPosition(mask: string, fromIndex: number): number {\n for (let i = fromIndex; i < mask.length; i++) {\n if (mask[i] === '#' || mask[i] === 'A' || mask[i] === '*') {\n return i\n }\n }\n return mask.length\n}\n\nexport const Input = forwardRef<HTMLInputElement, InputProps>(\n (\n {\n type = 'text',\n size,\n color,\n ghost = false,\n bordered = true,\n className = '',\n mask,\n maskPlaceholder = '_',\n value,\n defaultValue,\n onChange,\n onKeyDown,\n ...props\n },\n ref\n ) => {\n const sizeClasses = {\n xs: 'input-xs',\n sm: 'input-sm',\n md: 'input-md',\n lg: 'input-lg',\n xl: 'input-xl',\n }\n\n const colorClasses = {\n neutral: 'input-neutral',\n primary: 'input-primary',\n secondary: 'input-secondary',\n accent: 'input-accent',\n info: 'input-info',\n success: 'input-success',\n warning: 'input-warning',\n error: 'input-error',\n }\n\n const inputClasses = [\n 'input',\n !bordered && 'border-0',\n ghost && 'input-ghost',\n size && sizeClasses[size],\n color && colorClasses[color],\n className,\n ]\n .filter(Boolean)\n .join(' ')\n\n // Mask handling\n const innerRef = useRef<HTMLInputElement>(null)\n const inputRef = (ref as React.RefObject<HTMLInputElement>) || innerRef\n\n const getInitialRaw = useCallback(() => {\n if (!mask) return ''\n const initial = (value ?? defaultValue ?? '') as string\n return extractRaw(initial, mask)\n }, [mask, value, defaultValue])\n\n const [rawValue, setRawValue] = useState(getInitialRaw)\n const [cursorPos, setCursorPos] = useState<number | null>(null)\n\n // Sync with controlled value\n useEffect(() => {\n if (mask && value !== undefined) {\n setRawValue(extractRaw(value as string, mask))\n }\n }, [mask, value])\n\n // Set cursor position after render\n useEffect(() => {\n if (cursorPos !== null && inputRef.current) {\n inputRef.current.setSelectionRange(cursorPos, cursorPos)\n setCursorPos(null)\n }\n }, [cursorPos, inputRef])\n\n const handleMaskedChange = useCallback(\n (e: React.ChangeEvent<HTMLInputElement>) => {\n if (!mask) {\n onChange?.(e)\n return\n }\n\n const input = e.target\n const inputValue = input.value\n\n // Extract what the user is trying to type\n const newRaw = extractRaw(inputValue, mask)\n\n // Filter to only valid characters\n let filteredRaw = ''\n let rawIdx = 0\n for (let i = 0; i < mask.length && rawIdx < newRaw.length; i++) {\n const maskChar = mask[i]\n if (maskChar === '#' || maskChar === 'A' || maskChar === '*') {\n if (isValidChar(newRaw[rawIdx], maskChar)) {\n filteredRaw += newRaw[rawIdx]\n }\n rawIdx++\n }\n }\n\n setRawValue(filteredRaw)\n\n // Calculate new cursor position\n const maskedValue = applyMask(filteredRaw, mask, maskPlaceholder)\n let newCursor = findNextInputPosition(mask, 0)\n let charsPlaced = 0\n for (let i = 0; i < mask.length; i++) {\n const maskChar = mask[i]\n if (maskChar === '#' || maskChar === 'A' || maskChar === '*') {\n if (charsPlaced < filteredRaw.length) {\n charsPlaced++\n newCursor = i + 1\n }\n }\n }\n // Skip to next input position if we're on a literal\n newCursor = findNextInputPosition(mask, newCursor)\n if (newCursor > mask.length) newCursor = mask.length\n\n setCursorPos(newCursor)\n\n // Create synthetic event with masked value\n const syntheticEvent = {\n ...e,\n target: { ...input, value: maskedValue },\n currentTarget: { ...input, value: maskedValue },\n } as React.ChangeEvent<HTMLInputElement>\n\n onChange?.(syntheticEvent)\n },\n [mask, maskPlaceholder, onChange]\n )\n\n const handleMaskedKeyDown = useCallback(\n (e: React.KeyboardEvent<HTMLInputElement>) => {\n if (!mask) {\n onKeyDown?.(e)\n return\n }\n\n if (e.key === 'Backspace') {\n e.preventDefault()\n const newRaw = rawValue.slice(0, -1)\n setRawValue(newRaw)\n\n // Calculate cursor position\n let newCursor = 0\n let charsPlaced = 0\n for (let i = 0; i < mask.length; i++) {\n const maskChar = mask[i]\n if (maskChar === '#' || maskChar === 'A' || maskChar === '*') {\n if (charsPlaced < newRaw.length) {\n charsPlaced++\n newCursor = i + 1\n } else {\n newCursor = i\n break\n }\n }\n }\n setCursorPos(newCursor)\n\n const maskedValue = applyMask(newRaw, mask, maskPlaceholder)\n const input = e.currentTarget\n const syntheticEvent = {\n target: { ...input, value: maskedValue },\n currentTarget: { ...input, value: maskedValue },\n } as unknown as React.ChangeEvent<HTMLInputElement>\n\n onChange?.(syntheticEvent)\n }\n\n onKeyDown?.(e)\n },\n [mask, maskPlaceholder, rawValue, onChange, onKeyDown]\n )\n\n // If no mask, render simple input\n if (!mask) {\n return (\n <input\n ref={ref}\n type={type}\n className={inputClasses}\n value={value}\n defaultValue={defaultValue}\n onChange={onChange}\n onKeyDown={onKeyDown}\n {...props}\n />\n )\n }\n\n // Render masked input\n const maskedValue = applyMask(rawValue, mask, maskPlaceholder)\n\n return (\n <input\n ref={inputRef}\n type=\"text\"\n className={inputClasses}\n value={maskedValue}\n onChange={handleMaskedChange}\n onKeyDown={handleMaskedKeyDown}\n {...props}\n />\n )\n }\n)\n\nInput.displayName = 'Input'\n"],"names":["applyMask","raw","mask","placeholder","result","rawIndex","i","maskChar","extractRaw","value","isValidChar","char","findNextInputPosition","fromIndex","Input","forwardRef","type","size","color","ghost","bordered","className","maskPlaceholder","defaultValue","onChange","onKeyDown","props","ref","sizeClasses","colorClasses","inputClasses","innerRef","useRef","inputRef","getInitialRaw","useCallback","rawValue","setRawValue","useState","cursorPos","setCursorPos","useEffect","handleMaskedChange","e","input","inputValue","newRaw","filteredRaw","rawIdx","maskedValue","newCursor","charsPlaced","syntheticEvent","handleMaskedKeyDown","jsx"],"mappings":";;AAgBA,SAASA,EAAUC,GAAaC,GAAcC,GAA6B;AACzE,MAAIC,IAAS,IACTC,IAAW;AAEf,WAASC,IAAI,GAAGA,IAAIJ,EAAK,UAAUG,KAAYJ,EAAI,QAAQK,KAAK;AAC9D,UAAMC,IAAWL,EAAKI,CAAC;AACvB,IAAIC,MAAa,OAAOA,MAAa,OAAOA,MAAa,MACnDF,IAAWJ,EAAI,UACjBG,KAAUH,EAAII,CAAQ,GACtBA,OAEAD,KAAUD,IAGZC,KAAUG;AAAA,EAEd;AAEA,SAAOH;AACT;AAGA,SAASI,EAAWC,GAAeP,GAAsB;AACvD,MAAID,IAAM;AACV,WAAS,IAAI,GAAG,IAAIQ,EAAM,UAAU,IAAIP,EAAK,QAAQ,KAAK;AACxD,UAAMK,IAAWL,EAAK,CAAC;AACvB,KAAKK,MAAa,OAAOA,MAAa,OAAOA,MAAa,QAAQE,EAAM,CAAC,MAAM,QAC7ER,KAAOQ,EAAM,CAAC;AAAA,EAElB;AACA,SAAOR;AACT;AAGA,SAASS,EAAYC,GAAcJ,GAA2B;AAC5D,SAAIA,MAAa,MAAY,KAAK,KAAKI,CAAI,IACvCJ,MAAa,MAAY,WAAW,KAAKI,CAAI,IAC7CJ,MAAa,MAAY,cAAc,KAAKI,CAAI,IAC7C;AACT;AAGA,SAASC,EAAsBV,GAAcW,GAA2B;AACtE,WAASP,IAAIO,GAAWP,IAAIJ,EAAK,QAAQI;AACvC,QAAIJ,EAAKI,CAAC,MAAM,OAAOJ,EAAKI,CAAC,MAAM,OAAOJ,EAAKI,CAAC,MAAM;AACpD,aAAOA;AAGX,SAAOJ,EAAK;AACd;AAEO,MAAMY,IAAQC;AAAA,EACnB,CACE;AAAA,IACE,MAAAC,IA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AcjD,EAAUoC,GAAUlC,GAAMoB,CAAe;AAE7D,WACE,gBAAAgC;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,KAAKrB;AAAA,QACL,MAAK;AAAA,QACL,WAAWH;AAAA,QACX,OAAOmB;AAAA,QACP,UAAUP;AAAA,QACV,WAAWW;AAAA,QACV,GAAG3B;AAAA,MAAA;AAAA,IAAA;AAAA,EAGV;AACF;AAEAZ,EAAM,cAAc;"}
|
package/dist/index37.js
ADDED
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { jsxs as k, jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as S, useState as A, useRef as K, useImperativeHandle as W } from "react";
|
|
3
|
+
const H = S(
|
|
4
|
+
({
|
|
5
|
+
value: o,
|
|
6
|
+
defaultValue: w,
|
|
7
|
+
min: i = -1 / 0,
|
|
8
|
+
max: c = 1 / 0,
|
|
9
|
+
step: p = 1,
|
|
10
|
+
precision: a,
|
|
11
|
+
size: s,
|
|
12
|
+
disabled: l = !1,
|
|
13
|
+
onChange: f,
|
|
14
|
+
formatter: d,
|
|
15
|
+
parser: h,
|
|
16
|
+
className: I = "",
|
|
17
|
+
controls: m = !0,
|
|
18
|
+
block: C = !0,
|
|
19
|
+
...D
|
|
20
|
+
}, V) => {
|
|
21
|
+
const [j, v] = A(w ?? null), x = K(null);
|
|
22
|
+
W(V, () => x.current);
|
|
23
|
+
const n = o !== void 0 ? o : j, B = (t) => {
|
|
24
|
+
if (t === null) return "";
|
|
25
|
+
let e = t;
|
|
26
|
+
return a !== void 0 && (e = Number(t.toFixed(a))), d ? d(e) : String(e);
|
|
27
|
+
}, L = (t) => {
|
|
28
|
+
if (!t) return null;
|
|
29
|
+
const e = h ? h(t) : parseFloat(t);
|
|
30
|
+
return isNaN(e) ? null : e;
|
|
31
|
+
}, b = (t) => {
|
|
32
|
+
let e = Math.max(i, Math.min(c, t));
|
|
33
|
+
return a !== void 0 && (e = Number(e.toFixed(a))), e;
|
|
34
|
+
}, u = (t) => {
|
|
35
|
+
if (t === null) {
|
|
36
|
+
o === void 0 && v(null), f?.(null);
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
const e = b(t);
|
|
40
|
+
o === void 0 && v(e), f?.(e);
|
|
41
|
+
}, g = () => {
|
|
42
|
+
if (l) return;
|
|
43
|
+
u((n ?? 0) + p);
|
|
44
|
+
}, y = () => {
|
|
45
|
+
if (l) return;
|
|
46
|
+
u((n ?? 0) - p);
|
|
47
|
+
}, M = (t) => {
|
|
48
|
+
const e = L(t.target.value);
|
|
49
|
+
e !== null ? u(e) : t.target.value === "" && u(null);
|
|
50
|
+
}, $ = (t) => {
|
|
51
|
+
l || (t.key === "ArrowUp" ? (t.preventDefault(), g()) : t.key === "ArrowDown" && (t.preventDefault(), y()));
|
|
52
|
+
}, F = () => {
|
|
53
|
+
n !== null && (n < i || n > c) && u(b(n));
|
|
54
|
+
}, R = [
|
|
55
|
+
"input",
|
|
56
|
+
"input-bordered",
|
|
57
|
+
"w-full",
|
|
58
|
+
s && {
|
|
59
|
+
xs: "input-xs",
|
|
60
|
+
sm: "input-sm",
|
|
61
|
+
md: "input-md",
|
|
62
|
+
lg: "input-lg",
|
|
63
|
+
xl: "input-xl"
|
|
64
|
+
}[s],
|
|
65
|
+
l && "input-disabled",
|
|
66
|
+
m && "pr-8"
|
|
67
|
+
].filter(Boolean).join(" "), N = s === "xs" || s === "sm" ? "btn-xs" : "btn-sm";
|
|
68
|
+
return /* @__PURE__ */ k("div", { className: `relative ${C ? "w-full" : "inline-block"} group ${I}`, children: [
|
|
69
|
+
/* @__PURE__ */ r(
|
|
70
|
+
"input",
|
|
71
|
+
{
|
|
72
|
+
ref: x,
|
|
73
|
+
type: "text",
|
|
74
|
+
className: R,
|
|
75
|
+
value: B(n),
|
|
76
|
+
onChange: M,
|
|
77
|
+
onKeyDown: $,
|
|
78
|
+
onBlur: F,
|
|
79
|
+
disabled: l,
|
|
80
|
+
...D
|
|
81
|
+
}
|
|
82
|
+
),
|
|
83
|
+
m && /* @__PURE__ */ k("div", { className: "absolute right-1 top-1/2 -translate-y-1/2 flex flex-col gap-0.5 opacity-0 group-hover:opacity-100 transition-opacity", children: [
|
|
84
|
+
/* @__PURE__ */ r(
|
|
85
|
+
"button",
|
|
86
|
+
{
|
|
87
|
+
type: "button",
|
|
88
|
+
className: `btn ${N} btn-ghost px-1 min-h-0 h-3.5`,
|
|
89
|
+
onClick: g,
|
|
90
|
+
disabled: l || n !== null && n >= c,
|
|
91
|
+
tabIndex: -1,
|
|
92
|
+
children: /* @__PURE__ */ r(
|
|
93
|
+
"svg",
|
|
94
|
+
{
|
|
95
|
+
className: "w-3 h-3",
|
|
96
|
+
fill: "none",
|
|
97
|
+
viewBox: "0 0 24 24",
|
|
98
|
+
stroke: "currentColor",
|
|
99
|
+
children: /* @__PURE__ */ r(
|
|
100
|
+
"path",
|
|
101
|
+
{
|
|
102
|
+
strokeLinecap: "round",
|
|
103
|
+
strokeLinejoin: "round",
|
|
104
|
+
strokeWidth: 2,
|
|
105
|
+
d: "M5 15l7-7 7 7"
|
|
106
|
+
}
|
|
107
|
+
)
|
|
108
|
+
}
|
|
109
|
+
)
|
|
110
|
+
}
|
|
111
|
+
),
|
|
112
|
+
/* @__PURE__ */ r(
|
|
113
|
+
"button",
|
|
114
|
+
{
|
|
115
|
+
type: "button",
|
|
116
|
+
className: `btn ${N} btn-ghost px-1 min-h-0 h-3.5`,
|
|
117
|
+
onClick: y,
|
|
118
|
+
disabled: l || n !== null && n <= i,
|
|
119
|
+
tabIndex: -1,
|
|
120
|
+
children: /* @__PURE__ */ r(
|
|
121
|
+
"svg",
|
|
122
|
+
{
|
|
123
|
+
className: "w-3 h-3",
|
|
124
|
+
fill: "none",
|
|
125
|
+
viewBox: "0 0 24 24",
|
|
126
|
+
stroke: "currentColor",
|
|
127
|
+
children: /* @__PURE__ */ r(
|
|
128
|
+
"path",
|
|
129
|
+
{
|
|
130
|
+
strokeLinecap: "round",
|
|
131
|
+
strokeLinejoin: "round",
|
|
132
|
+
strokeWidth: 2,
|
|
133
|
+
d: "M19 9l-7 7-7-7"
|
|
134
|
+
}
|
|
135
|
+
)
|
|
136
|
+
}
|
|
137
|
+
)
|
|
138
|
+
}
|
|
139
|
+
)
|
|
140
|
+
] })
|
|
141
|
+
] });
|
|
142
|
+
}
|
|
143
|
+
);
|
|
144
|
+
H.displayName = "InputNumber";
|
|
145
|
+
export {
|
|
146
|
+
H as InputNumber,
|
|
147
|
+
H as default
|
|
148
|
+
};
|
|
149
|
+
//# sourceMappingURL=index37.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index37.js","sources":["../src/components/InputNumber.tsx"],"sourcesContent":["import React, { useState, useRef, forwardRef, useImperativeHandle } from 'react'\n\nexport interface InputNumberProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'size' | 'onChange' | 'value' | 'defaultValue'> {\n value?: number\n defaultValue?: number\n min?: number\n max?: number\n step?: number\n precision?: number\n size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl'\n disabled?: boolean\n onChange?: (value: number | null) => void\n formatter?: (value: number | undefined) => string\n parser?: (displayValue: string) => number\n className?: string\n controls?: boolean\n block?: boolean\n}\n\nexport const InputNumber = forwardRef<HTMLInputElement, InputNumberProps>(\n (\n {\n value: controlledValue,\n defaultValue,\n min = -Infinity,\n max = Infinity,\n step = 1,\n precision,\n size,\n disabled = false,\n onChange,\n formatter,\n parser,\n className = '',\n controls = true,\n block = true,\n ...props\n },\n ref\n ) => {\n const [internalValue, setInternalValue] = useState<number | null>(defaultValue ?? null)\n const inputRef = useRef<HTMLInputElement>(null)\n\n useImperativeHandle(ref, () => inputRef.current!)\n\n const value = controlledValue !== undefined ? controlledValue : internalValue\n\n const formatValue = (num: number | null): string => {\n if (num === null) return ''\n let formatted = num\n if (precision !== undefined) {\n formatted = Number(num.toFixed(precision))\n }\n return formatter ? formatter(formatted) : String(formatted)\n }\n\n const parseValue = (str: string): number | null => {\n if (!str) return null\n const parsed = parser ? parser(str) : parseFloat(str)\n if (isNaN(parsed)) return null\n return parsed\n }\n\n const clampValue = (num: number): number => {\n let clamped = Math.max(min, Math.min(max, num))\n if (precision !== undefined) {\n clamped = Number(clamped.toFixed(precision))\n }\n return clamped\n }\n\n const updateValue = (newValue: number | null) => {\n if (newValue === null) {\n if (controlledValue === undefined) {\n setInternalValue(null)\n }\n onChange?.(null)\n return\n }\n\n const clamped = clampValue(newValue)\n if (controlledValue === undefined) {\n setInternalValue(clamped)\n }\n onChange?.(clamped)\n }\n\n const handleIncrement = () => {\n if (disabled) return\n const currentValue = value ?? 0\n updateValue(currentValue + step)\n }\n\n const handleDecrement = () => {\n if (disabled) return\n const currentValue = value ?? 0\n updateValue(currentValue - step)\n }\n\n const handleInputChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n const parsed = parseValue(e.target.value)\n if (parsed !== null) {\n updateValue(parsed)\n } else if (e.target.value === '') {\n updateValue(null)\n }\n }\n\n const handleKeyDown = (e: React.KeyboardEvent<HTMLInputElement>) => {\n if (disabled) return\n\n if (e.key === 'ArrowUp') {\n e.preventDefault()\n handleIncrement()\n } else if (e.key === 'ArrowDown') {\n e.preventDefault()\n handleDecrement()\n }\n }\n\n const handleBlur = () => {\n // Ensure value is within bounds on blur\n if (value !== null && (value < min || value > max)) {\n updateValue(clampValue(value))\n }\n }\n\n const sizeClasses = {\n xs: 'input-xs',\n sm: 'input-sm',\n md: 'input-md',\n lg: 'input-lg',\n xl: 'input-xl',\n }\n\n const inputClasses = [\n 'input',\n 'input-bordered',\n 'w-full',\n size && sizeClasses[size],\n disabled && 'input-disabled',\n controls && 'pr-8',\n ]\n .filter(Boolean)\n .join(' ')\n\n const buttonSize = size === 'xs' || size === 'sm' ? 'btn-xs' : 'btn-sm'\n\n return (\n <div className={`relative ${block ? 'w-full' : 'inline-block'} group ${className}`}>\n <input\n ref={inputRef}\n type=\"text\"\n className={inputClasses}\n value={formatValue(value)}\n onChange={handleInputChange}\n onKeyDown={handleKeyDown}\n onBlur={handleBlur}\n disabled={disabled}\n {...props}\n />\n {controls && (\n <div className=\"absolute right-1 top-1/2 -translate-y-1/2 flex flex-col gap-0.5 opacity-0 group-hover:opacity-100 transition-opacity\">\n <button\n type=\"button\"\n className={`btn ${buttonSize} btn-ghost px-1 min-h-0 h-3.5`}\n onClick={handleIncrement}\n disabled={disabled || (value !== null && value >= max)}\n tabIndex={-1}\n >\n <svg\n className=\"w-3 h-3\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n stroke=\"currentColor\"\n >\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeWidth={2}\n d=\"M5 15l7-7 7 7\"\n />\n </svg>\n </button>\n <button\n type=\"button\"\n className={`btn ${buttonSize} btn-ghost px-1 min-h-0 h-3.5`}\n onClick={handleDecrement}\n disabled={disabled || (value !== null && value <= min)}\n tabIndex={-1}\n >\n <svg\n className=\"w-3 h-3\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n stroke=\"currentColor\"\n >\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeWidth={2}\n d=\"M19 9l-7 7-7-7\"\n />\n </svg>\n </button>\n </div>\n )}\n </div>\n )\n }\n)\n\nInputNumber.displayName = 'InputNumber'\n\nexport default InputNumber\n"],"names":["InputNumber","forwardRef","controlledValue","defaultValue","min","max","step","precision","size","disabled","onChange","formatter","parser","className","controls","block","props","ref","internalValue","setInternalValue","useState","inputRef","useRef","useImperativeHandle","value","formatValue","num","formatted","parseValue","str","parsed","clampValue","clamped","updateValue","newValue","handleIncrement","handleDecrement","handleInputChange","e","handleKeyDown","handleBlur","inputClasses","buttonSize","jsxs","jsx"],"mappings":";;AAmBO,MAAMA,IAAcC;AAAA,EACzB,CACE;AAAA,IACE,OAAOC;AAAA,IACP,cAAAC;AAAA,IACA,KAAAC,IAAM;AAAA,IACN,KAAAC,IAAM;AAAA,IACN,MAAAC,IAAO;AAAA,IACP,WAAAC;AAAA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 @@
|
|
|
1
|
+
import { jsx as c } from "react/jsx-runtime";
|
|
2
|
+
import n from "react";
|
|
3
|
+
function p({ children: i, vertical: o = !1, className: t = "", ...a }) {
|
|
4
|
+
const r = ["join", o && "join-vertical", t].filter(Boolean).join(" "), m = n.Children.map(i, (e) => {
|
|
5
|
+
if (n.isValidElement(e)) {
|
|
6
|
+
const s = e.props.className || "", l = s ? `join-item ${s}` : "join-item";
|
|
7
|
+
return n.cloneElement(e, {
|
|
8
|
+
className: l
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
return e;
|
|
12
|
+
});
|
|
13
|
+
return /* @__PURE__ */ c("div", { className: r, ...a, children: m });
|
|
14
|
+
}
|
|
15
|
+
export {
|
|
16
|
+
p as Join
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=index38.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index38.js","sources":["../src/components/Join.tsx"],"sourcesContent":["import React from 'react'\n\nexport interface JoinProps extends React.HTMLAttributes<HTMLDivElement> {\n children: React.ReactNode\n vertical?: boolean\n}\n\nexport function Join({ children, vertical = false, className = '', ...rest }: JoinProps) {\n const classes = ['join', vertical && 'join-vertical', className].filter(Boolean).join(' ')\n\n // Automatically add join-item class to all children\n const childrenWithJoinItem = React.Children.map(children, (child) => {\n if (React.isValidElement(child)) {\n const existingClassName = (child.props as any).className || ''\n const newClassName = existingClassName ? `join-item ${existingClassName}` : 'join-item'\n\n return React.cloneElement(child as React.ReactElement<any>, {\n className: newClassName,\n })\n }\n return child\n })\n\n return <div className={classes} {...rest}>{childrenWithJoinItem}</div>\n}\n"],"names":["Join","children","vertical","className","rest","classes","childrenWithJoinItem","React","child","existingClassName","newClassName"],"mappings":";;AAOO,SAASA,EAAK,EAAE,UAAAC,GAAU,UAAAC,IAAW,IAAO,WAAAC,IAAY,IAAI,GAAGC,KAAmB;AACvF,QAAMC,IAAU,CAAC,QAAQH,KAAY,iBAAiBC,CAAS,EAAE,OAAO,OAAO,EAAE,KAAK,GAAG,GAGnFG,IAAuBC,EAAM,SAAS,IAAIN,GAAU,CAACO,MAAU;AACnE,QAAID,EAAM,eAAeC,CAAK,GAAG;AAC/B,YAAMC,IAAqBD,EAAM,MAAc,aAAa,IACtDE,IAAeD,IAAoB,aAAaA,CAAiB,KAAK;AAE5E,aAAOF,EAAM,aAAaC,GAAkC;AAAA,QAC1D,WAAWE;AAAA,MAAA,CACZ;AAAA,IACH;AACA,WAAOF;AAAA,EACT,CAAC;AAED,2BAAQ,OAAA,EAAI,WAAWH,GAAU,GAAGD,GAAO,UAAAE,GAAqB;AAClE;"}
|
package/dist/index39.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
2
|
+
function c({ children: l, className: n = "", ...s }) {
|
|
3
|
+
return /* @__PURE__ */ a("span", { className: `label ${n}`, ...s, children: l });
|
|
4
|
+
}
|
|
5
|
+
function r({ children: l, label: n, size: s, className: e = "", ...t }) {
|
|
6
|
+
const i = ["floating-label", s && {
|
|
7
|
+
xs: "input-xs",
|
|
8
|
+
sm: "input-sm",
|
|
9
|
+
md: "input-md",
|
|
10
|
+
lg: "input-lg",
|
|
11
|
+
xl: "input-xl"
|
|
12
|
+
}[s], e].filter(Boolean).join(" ");
|
|
13
|
+
return /* @__PURE__ */ o("label", { className: i, ...t, children: [
|
|
14
|
+
l,
|
|
15
|
+
/* @__PURE__ */ a("span", { children: n })
|
|
16
|
+
] });
|
|
17
|
+
}
|
|
18
|
+
const m = Object.assign(c, {
|
|
19
|
+
Floating: r
|
|
20
|
+
});
|
|
21
|
+
export {
|
|
22
|
+
m as Label
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=index39.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index39.js","sources":["../src/components/Label.tsx"],"sourcesContent":["import React from 'react'\n\nexport interface LabelProps extends React.HTMLAttributes<HTMLSpanElement> {\n children: React.ReactNode\n}\n\nexport interface FloatingLabelProps extends React.LabelHTMLAttributes<HTMLLabelElement> {\n children: React.ReactNode\n label: string\n size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl'\n}\n\nfunction LabelRoot({ children, className = '', ...rest }: LabelProps) {\n return <span className={`label ${className}`} {...rest}>{children}</span>\n}\n\nfunction FloatingLabel({ children, label, size, className = '', ...rest }: FloatingLabelProps) {\n const sizeClasses = {\n xs: 'input-xs',\n sm: 'input-sm',\n md: 'input-md',\n lg: 'input-lg',\n xl: 'input-xl',\n }\n\n const classes = ['floating-label', size && sizeClasses[size], className].filter(Boolean).join(' ')\n\n return (\n <label className={classes} {...rest}>\n {children}\n <span>{label}</span>\n </label>\n )\n}\n\nexport const Label = Object.assign(LabelRoot, {\n Floating: FloatingLabel,\n})\n"],"names":["LabelRoot","children","className","rest","jsx","FloatingLabel","label","size","classes","jsxs","Label"],"mappings":";AAYA,SAASA,EAAU,EAAE,UAAAC,GAAU,WAAAC,IAAY,IAAI,GAAGC,KAAoB;AACpE,SAAO,gBAAAC,EAAC,UAAK,WAAW,SAASF,CAAS,IAAK,GAAGC,GAAO,UAAAF,GAAS;AACpE;AAEA,SAASI,EAAc,EAAE,UAAAJ,GAAU,OAAAK,GAAO,MAAAC,GAAM,WAAAL,IAAY,IAAI,GAAGC,KAA4B;AAS7F,QAAMK,IAAU,CAAC,kBAAkBD,KARf;AAAA,IAClB,IAAI;AAAA,IACJ,IAAI;AAAA,IACJ,IAAI;AAAA,IACJ,IAAI;AAAA,IACJ,IAAI;AAAA,EAAA,EAGiDA,CAAI,GAAGL,CAAS,EAAE,OAAO,OAAO,EAAE,KAAK,GAAG;AAEjG,SACE,gBAAAO,EAAC,SAAA,EAAM,WAAWD,GAAU,GAAGL,GAC5B,UAAA;AAAA,IAAAF;AAAA,IACD,gBAAAG,EAAC,UAAM,UAAAE,EAAA,CAAM;AAAA,EAAA,GACf;AAEJ;AAEO,MAAMI,IAAQ,OAAO,OAAOV,GAAW;AAAA,EAC5C,UAAUK;AACZ,CAAC;"}
|
package/dist/index4.js
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { jsxs as z, jsx as c } from "react/jsx-runtime";
|
|
2
|
+
import { useState as g, useRef as v, useEffect as y } from "react";
|
|
3
|
+
const L = ({
|
|
4
|
+
value: a,
|
|
5
|
+
defaultValue: k = "",
|
|
6
|
+
onChange: m,
|
|
7
|
+
options: D,
|
|
8
|
+
placeholder: I = "Type to search...",
|
|
9
|
+
disabled: b = !1,
|
|
10
|
+
size: E = "md",
|
|
11
|
+
className: N = "",
|
|
12
|
+
allowCustomValue: w = !0,
|
|
13
|
+
filterOption: x,
|
|
14
|
+
notFoundContent: A = "No results found",
|
|
15
|
+
...C
|
|
16
|
+
}) => {
|
|
17
|
+
const u = D.map(
|
|
18
|
+
(e) => typeof e == "string" ? { value: e, label: e } : e
|
|
19
|
+
), [i, d] = g(k), [f, l] = g(!1), [r, n] = g(-1), p = v(null), o = v(null);
|
|
20
|
+
y(() => {
|
|
21
|
+
if (a !== void 0) {
|
|
22
|
+
const e = u.find((t) => t.value === a);
|
|
23
|
+
d(e?.label || a);
|
|
24
|
+
}
|
|
25
|
+
}, [a, u]);
|
|
26
|
+
const O = (e, t) => e.label.toLowerCase().includes(t.toLowerCase()), s = u.filter(
|
|
27
|
+
(e) => x ? x(e, i) : O(e, i)
|
|
28
|
+
), F = (e) => {
|
|
29
|
+
const t = e.target.value;
|
|
30
|
+
d(t), l(!0), n(0), w && m?.(t);
|
|
31
|
+
}, h = (e) => {
|
|
32
|
+
d(e.label), l(!1), n(-1), m?.(e.value), p.current?.focus();
|
|
33
|
+
}, R = (e) => {
|
|
34
|
+
if (!f && (e.key === "ArrowDown" || e.key === "ArrowUp")) {
|
|
35
|
+
l(!0), n(0);
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
switch (e.key) {
|
|
39
|
+
case "ArrowDown":
|
|
40
|
+
e.preventDefault(), n((t) => t < s.length - 1 ? t + 1 : t);
|
|
41
|
+
break;
|
|
42
|
+
case "ArrowUp":
|
|
43
|
+
e.preventDefault(), n((t) => t > 0 ? t - 1 : 0);
|
|
44
|
+
break;
|
|
45
|
+
case "Enter":
|
|
46
|
+
e.preventDefault(), r >= 0 && s[r] ? h(s[r]) : !w && s.length > 0 && h(s[0]);
|
|
47
|
+
break;
|
|
48
|
+
case "Escape":
|
|
49
|
+
l(!1), n(-1), p.current?.blur();
|
|
50
|
+
break;
|
|
51
|
+
}
|
|
52
|
+
}, T = () => {
|
|
53
|
+
l(!0), s.length > 0 && n(0);
|
|
54
|
+
}, V = (e) => {
|
|
55
|
+
o.current && o.current.contains(e.relatedTarget) || setTimeout(() => l(!1), 200);
|
|
56
|
+
}, $ = {
|
|
57
|
+
xs: "input-xs",
|
|
58
|
+
sm: "input-sm",
|
|
59
|
+
md: "input-md",
|
|
60
|
+
lg: "input-lg"
|
|
61
|
+
}[E];
|
|
62
|
+
return y(() => {
|
|
63
|
+
r >= 0 && o.current && o.current.children[r]?.scrollIntoView({ block: "nearest" });
|
|
64
|
+
}, [r]), /* @__PURE__ */ z("div", { className: `relative ${N}`, "data-state": f ? "open" : "closed", ...C, children: [
|
|
65
|
+
/* @__PURE__ */ c(
|
|
66
|
+
"input",
|
|
67
|
+
{
|
|
68
|
+
ref: p,
|
|
69
|
+
type: "text",
|
|
70
|
+
value: i,
|
|
71
|
+
onChange: F,
|
|
72
|
+
onKeyDown: R,
|
|
73
|
+
onFocus: T,
|
|
74
|
+
onBlur: V,
|
|
75
|
+
placeholder: I,
|
|
76
|
+
disabled: b,
|
|
77
|
+
className: `input input-bordered w-full ${$}`
|
|
78
|
+
}
|
|
79
|
+
),
|
|
80
|
+
f && !b && /* @__PURE__ */ c(
|
|
81
|
+
"div",
|
|
82
|
+
{
|
|
83
|
+
ref: o,
|
|
84
|
+
className: "absolute z-50 w-full mt-1 bg-base-100 border border-base-300 rounded-lg shadow-lg max-h-60 overflow-auto",
|
|
85
|
+
children: s.length > 0 ? s.map((e, t) => /* @__PURE__ */ c(
|
|
86
|
+
"div",
|
|
87
|
+
{
|
|
88
|
+
onMouseDown: (j) => {
|
|
89
|
+
j.preventDefault(), h(e);
|
|
90
|
+
},
|
|
91
|
+
onMouseEnter: () => n(t),
|
|
92
|
+
className: `px-4 py-2 cursor-pointer transition-colors ${t === r ? "bg-primary text-primary-content" : "hover:bg-base-200"}`,
|
|
93
|
+
children: e.label
|
|
94
|
+
},
|
|
95
|
+
e.value
|
|
96
|
+
)) : /* @__PURE__ */ c("div", { className: "px-4 py-2 text-base-content/60 text-center", children: A })
|
|
97
|
+
}
|
|
98
|
+
)
|
|
99
|
+
] });
|
|
100
|
+
};
|
|
101
|
+
export {
|
|
102
|
+
L as Autocomplete
|
|
103
|
+
};
|
|
104
|
+
//# sourceMappingURL=index4.js.map
|