@balikjs/mobile 0.1.4 → 0.1.6
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/README.md +1 -0
- package/dist/Alert/Alert.js +82 -0
- package/dist/Alert/Alert.module.css.js +25 -0
- package/dist/Avatar/Avatar.js +60 -0
- package/dist/Avatar/Avatar.module.css.js +27 -0
- package/dist/BackToTop/BackToTop.js +55 -0
- package/dist/BackToTop/BackToTop.module.css.js +11 -0
- package/dist/Badge/Badge.js +59 -0
- package/dist/Badge/Badge.module.css.js +45 -0
- package/dist/BottomNavigation/BottomNavigation.js +48 -0
- package/dist/BottomNavigation/BottomNavigation.module.css.js +13 -0
- package/dist/BottomSheet/BottomSheet.js +120 -0
- package/dist/BottomSheet/BottomSheet.module.css.js +25 -0
- package/dist/Button/Button.js +56 -0
- package/dist/Button/Button.module.css.js +31 -0
- package/dist/Card/Card.js +22 -0
- package/dist/Card/Card.module.css.js +7 -0
- package/dist/Checkbox/Checkbox.js +65 -0
- package/dist/Checkbox/Checkbox.module.css.js +27 -0
- package/dist/Clipboard/Clipboard.js +60 -0
- package/dist/Clipboard/Clipboard.module.css.js +21 -0
- package/dist/CloseButton/CloseButton.js +37 -0
- package/dist/CloseButton/CloseButton.module.css.js +21 -0
- package/dist/Confirm/Confirm.js +146 -0
- package/dist/Confirm/Confirm.module.css.js +7 -0
- package/dist/DatePicker/DatePicker.js +149 -0
- package/dist/DatePicker/DatePicker.module.css.js +29 -0
- package/dist/Dialog/Dialog.js +142 -0
- package/dist/Dialog/Dialog.module.css.js +29 -0
- package/dist/Divider/Divider.js +27 -0
- package/dist/Divider/Divider.module.css.js +9 -0
- package/dist/Drawer/Drawer.js +59 -0
- package/dist/Drawer/Drawer.module.css.js +19 -0
- package/dist/Empty/Empty.js +25 -0
- package/dist/Empty/Empty.module.css.js +9 -0
- package/dist/Fab/Fab.js +79 -0
- package/dist/Fab/Fab.module.css.js +19 -0
- package/dist/Field/Field.js +70 -0
- package/dist/Field/Field.module.css.js +21 -0
- package/dist/Fieldset/Fieldset.js +31 -0
- package/dist/Fieldset/Fieldset.module.css.js +9 -0
- package/dist/FileUpload/FileUpload.js +174 -0
- package/dist/FileUpload/FileUpload.module.css.js +35 -0
- package/dist/FilterGroup/FilterGroup.js +70 -0
- package/dist/FilterGroup/FilterGroup.module.css.js +23 -0
- package/dist/Input/Input.js +68 -0
- package/dist/Input/Input.module.css.js +35 -0
- package/dist/Link/Link.js +22 -0
- package/dist/Link/Link.module.css.js +7 -0
- package/dist/MoneyInput/MoneyInput.js +106 -0
- package/dist/MoneyInput/MoneyInput.module.css.js +9 -0
- package/dist/Pagination/Pagination.js +67 -0
- package/dist/Pagination/Pagination.module.css.js +11 -0
- package/dist/Picker/Picker.js +75 -0
- package/dist/Picker/Picker.module.css.js +15 -0
- package/dist/PickerView/PickerView.js +89 -0
- package/dist/PickerView/PickerView.module.css.js +21 -0
- package/dist/PickerView/wheel.js +146 -0
- package/dist/PinInput/PinInput.js +80 -0
- package/dist/PinInput/PinInput.module.css.js +23 -0
- package/dist/Popover/Popover.js +107 -0
- package/dist/Popover/Popover.module.css.js +17 -0
- package/dist/Progress/Progress.js +80 -0
- package/dist/Progress/Progress.module.css.js +27 -0
- package/dist/QrCode/QrCode.js +78 -0
- package/dist/QrCode/QrCode.module.css.js +15 -0
- package/dist/RadioGroup/Radio.js +42 -0
- package/dist/RadioGroup/Radio.module.css.js +23 -0
- package/dist/RadioGroup/RadioGroup.js +29 -0
- package/dist/RadioGroup/RadioGroup.module.css.js +9 -0
- package/dist/RatingGroup/RatingGroup.js +87 -0
- package/dist/RatingGroup/RatingGroup.module.css.js +13 -0
- package/dist/SafeArea/SafeArea.js +24 -0
- package/dist/SafeArea/SafeArea.module.css.js +15 -0
- package/dist/SearchInput/SearchInput.js +76 -0
- package/dist/SearchInput/SearchInput.module.css.js +11 -0
- package/dist/Select/Select.js +122 -0
- package/dist/Select/Select.module.css.js +29 -0
- package/dist/SelectPc/Select.js +130 -0
- package/dist/SelectPc/SelectPc.module.css.js +31 -0
- package/dist/Skeleton/Skeleton.js +42 -0
- package/dist/Skeleton/Skeleton.module.css.js +11 -0
- package/dist/Slider/Slider.js +63 -0
- package/dist/Slider/Slider.module.css.js +19 -0
- package/dist/Spinner/Spinner.js +31 -0
- package/dist/Spinner/Spinner.module.css.js +17 -0
- package/dist/Steps/Steps.js +173 -0
- package/dist/Steps/Steps.module.css.js +31 -0
- package/dist/StickyHeader/StickyHeader.js +30 -0
- package/dist/StickyHeader/StickyHeader.module.css.js +9 -0
- package/dist/Switch/Switch.js +49 -0
- package/dist/Switch/Switch.module.css.js +25 -0
- package/dist/Tabs/Tabs.js +55 -0
- package/dist/Tabs/Tabs.module.css.js +13 -0
- package/dist/Tag/Tag.js +58 -0
- package/dist/Tag/Tag.module.css.js +35 -0
- package/dist/Textarea/Textarea.js +32 -0
- package/dist/Textarea/Textarea.module.css.js +21 -0
- package/dist/Toast/Toast.js +137 -0
- package/dist/Toast/Toast.module.css.js +43 -0
- package/dist/Toggle/Toggle.js +33 -0
- package/dist/Toggle/Toggle.module.css.js +9 -0
- package/dist/ToggleGroup/ToggleGroup.js +42 -0
- package/dist/ToggleGroup/ToggleGroup.module.css.js +19 -0
- package/dist/Tooltip/Tooltip.js +71 -0
- package/dist/Tooltip/Tooltip.module.css.js +13 -0
- package/dist/index.js +164 -3641
- package/dist/styles.css +1 -1
- package/dist/utils/bem.js +6 -0
- package/dist/utils/cn.js +6 -0
- package/dist/utils/useScrollLock.js +16 -0
- package/package.json +3 -198
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { spread as s, mergeProps as m, insert as a, template as p } from "solid-js/web";
|
|
2
|
+
import { splitProps as l, mergeProps as i } from "solid-js";
|
|
3
|
+
import { bem as n } from "../utils/bem.js";
|
|
4
|
+
import { cn as c } from "../utils/cn.js";
|
|
5
|
+
import f from "./Card.module.css.js";
|
|
6
|
+
var d = /* @__PURE__ */ p("<div>");
|
|
7
|
+
const P = {};
|
|
8
|
+
function b(t) {
|
|
9
|
+
const [e, o] = l(i(P, t), ["class", "children"]);
|
|
10
|
+
return (() => {
|
|
11
|
+
var r = d();
|
|
12
|
+
return s(r, m(o, {
|
|
13
|
+
"data-part": "root",
|
|
14
|
+
get class() {
|
|
15
|
+
return c(n(), f.base, e.class);
|
|
16
|
+
}
|
|
17
|
+
}), !1, !0), a(r, () => e.children), r;
|
|
18
|
+
})();
|
|
19
|
+
}
|
|
20
|
+
export {
|
|
21
|
+
b as Card
|
|
22
|
+
};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { createComponent as t, mergeProps as a, insert as l, memo as c, template as i } from "solid-js/web";
|
|
2
|
+
import { splitProps as m, mergeProps as u } from "solid-js";
|
|
3
|
+
import { Checkbox as n, useCheckboxContext as p } from "@ark-ui/solid";
|
|
4
|
+
import { bem as g } from "../utils/bem.js";
|
|
5
|
+
import { cn as h } from "../utils/cn.js";
|
|
6
|
+
import e from "./Checkbox.module.css.js";
|
|
7
|
+
var f = /* @__PURE__ */ i('<svg viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=3px stroke-linecap=round stroke-linejoin=round aria-hidden=true><title>'), x = /* @__PURE__ */ i('<svg><path d="M5 12h14"></svg>', !1, !0, !1), C = /* @__PURE__ */ i('<svg><path d="M20 6 9 17l-5-5"></svg>', !1, !0, !1);
|
|
8
|
+
const k = {
|
|
9
|
+
xs: e.sizeXs,
|
|
10
|
+
sm: e.sizeSm,
|
|
11
|
+
md: e.sizeMd,
|
|
12
|
+
lg: e.sizeLg,
|
|
13
|
+
xl: e.sizeXl,
|
|
14
|
+
"2xl": e.size2xl
|
|
15
|
+
}, z = {
|
|
16
|
+
size: "md",
|
|
17
|
+
rounded: !0
|
|
18
|
+
};
|
|
19
|
+
function v() {
|
|
20
|
+
const o = p();
|
|
21
|
+
return t(n.Indicator, {
|
|
22
|
+
get indeterminate() {
|
|
23
|
+
return o().indeterminate;
|
|
24
|
+
},
|
|
25
|
+
get class() {
|
|
26
|
+
return e.indicator;
|
|
27
|
+
},
|
|
28
|
+
get children() {
|
|
29
|
+
var r = f(), s = r.firstChild;
|
|
30
|
+
return l(s, () => o().indeterminate ? "Indeterminate" : "Check"), l(r, (() => {
|
|
31
|
+
var d = c(() => !!o().indeterminate);
|
|
32
|
+
return () => d() ? x() : C();
|
|
33
|
+
})(), null), r;
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
function $(o) {
|
|
38
|
+
const [r, s] = m(u(z, o), ["class", "children", "size", "rounded", "defaultChecked"]);
|
|
39
|
+
return t(n.Root, a(s, {
|
|
40
|
+
get class() {
|
|
41
|
+
return h(g(), e.root, k[r.size], r.rounded && e.rounded, r.class);
|
|
42
|
+
},
|
|
43
|
+
get children() {
|
|
44
|
+
return [t(n.Control, {
|
|
45
|
+
get class() {
|
|
46
|
+
return e.control;
|
|
47
|
+
},
|
|
48
|
+
get children() {
|
|
49
|
+
return t(v, {});
|
|
50
|
+
}
|
|
51
|
+
}), t(n.Label, {
|
|
52
|
+
get class() {
|
|
53
|
+
return e.label;
|
|
54
|
+
},
|
|
55
|
+
get children() {
|
|
56
|
+
return r.children;
|
|
57
|
+
}
|
|
58
|
+
}), t(n.HiddenInput, {})];
|
|
59
|
+
}
|
|
60
|
+
}));
|
|
61
|
+
}
|
|
62
|
+
$.Original = n;
|
|
63
|
+
export {
|
|
64
|
+
$ as Checkbox
|
|
65
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
const s = "_root_18n31_1", _ = "_control_18n31_16", n = "_indicator_18n31_66", o = "_label_18n31_78", e = "_sizeXs_18n31_90", i = "_sizeSm_18n31_100", t = "_sizeMd_18n31_110", c = "_sizeLg_18n31_120", z = "_sizeXl_18n31_130", l = "_size2xl_18n31_140", d = "_rounded_18n31_150", r = {
|
|
2
|
+
root: s,
|
|
3
|
+
control: _,
|
|
4
|
+
indicator: n,
|
|
5
|
+
label: o,
|
|
6
|
+
sizeXs: e,
|
|
7
|
+
sizeSm: i,
|
|
8
|
+
sizeMd: t,
|
|
9
|
+
sizeLg: c,
|
|
10
|
+
sizeXl: z,
|
|
11
|
+
size2xl: l,
|
|
12
|
+
rounded: d
|
|
13
|
+
};
|
|
14
|
+
export {
|
|
15
|
+
_ as control,
|
|
16
|
+
r as default,
|
|
17
|
+
n as indicator,
|
|
18
|
+
o as label,
|
|
19
|
+
s as root,
|
|
20
|
+
d as rounded,
|
|
21
|
+
l as size2xl,
|
|
22
|
+
c as sizeLg,
|
|
23
|
+
t as sizeMd,
|
|
24
|
+
i as sizeSm,
|
|
25
|
+
z as sizeXl,
|
|
26
|
+
e as sizeXs
|
|
27
|
+
};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { spread as d, mergeProps as u, insert as s, memo as y, createComponent as n, template as C } from "solid-js/web";
|
|
2
|
+
import { splitProps as f, mergeProps as b, createSignal as g, onCleanup as z } from "solid-js";
|
|
3
|
+
import { Check as h, Copy as v } from "lucide-solid";
|
|
4
|
+
import { bem as x } from "../utils/bem.js";
|
|
5
|
+
import { cn as P } from "../utils/cn.js";
|
|
6
|
+
import t from "./Clipboard.module.css.js";
|
|
7
|
+
var T = /* @__PURE__ */ C("<button>");
|
|
8
|
+
const D = {
|
|
9
|
+
xs: t.sizeXs,
|
|
10
|
+
sm: t.sizeSm,
|
|
11
|
+
md: t.sizeMd,
|
|
12
|
+
lg: t.sizeLg,
|
|
13
|
+
xl: t.sizeXl
|
|
14
|
+
}, _ = {
|
|
15
|
+
size: "md",
|
|
16
|
+
copiedDuration: 2e3,
|
|
17
|
+
toastOnCopy: !1
|
|
18
|
+
};
|
|
19
|
+
function L(l) {
|
|
20
|
+
const [o, c] = f(b(_, l), ["value", "size", "class", "copiedDuration", "toastOnCopy", "children"]), [a, i] = g(!1);
|
|
21
|
+
let r = null;
|
|
22
|
+
const p = async () => {
|
|
23
|
+
try {
|
|
24
|
+
await navigator.clipboard.writeText(o.value);
|
|
25
|
+
} catch {
|
|
26
|
+
const e = document.createElement("textarea");
|
|
27
|
+
e.value = o.value, e.style.position = "fixed", e.style.opacity = "0", document.body.appendChild(e), e.select(), document.execCommand("copy"), document.body.removeChild(e);
|
|
28
|
+
}
|
|
29
|
+
i(!0), clearTimeout(r), r = setTimeout(() => i(!1), o.copiedDuration);
|
|
30
|
+
};
|
|
31
|
+
return z(() => clearTimeout(r)), (() => {
|
|
32
|
+
var e = T();
|
|
33
|
+
return d(e, u(c, {
|
|
34
|
+
type: "button",
|
|
35
|
+
"data-part": "root",
|
|
36
|
+
onClick: p,
|
|
37
|
+
get class() {
|
|
38
|
+
return P(x("balik-clipboard", o.size), t.base, D[o.size], a() && t.copied, o.class);
|
|
39
|
+
}
|
|
40
|
+
}), !1, !0), s(e, (() => {
|
|
41
|
+
var m = y(() => !!a());
|
|
42
|
+
return () => m() ? n(h, {
|
|
43
|
+
"aria-hidden": "true",
|
|
44
|
+
get class() {
|
|
45
|
+
return t.icon;
|
|
46
|
+
},
|
|
47
|
+
"data-part": "icon"
|
|
48
|
+
}) : n(v, {
|
|
49
|
+
"aria-hidden": "true",
|
|
50
|
+
get class() {
|
|
51
|
+
return t.icon;
|
|
52
|
+
},
|
|
53
|
+
"data-part": "icon"
|
|
54
|
+
});
|
|
55
|
+
})(), null), s(e, () => o.children, null), e;
|
|
56
|
+
})();
|
|
57
|
+
}
|
|
58
|
+
export {
|
|
59
|
+
L as Clipboard
|
|
60
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
const s = "_base_17wch_1", e = "_icon_17wch_43", _ = "_copied_17wch_49", c = "_sizeXs_17wch_78", i = "_sizeSm_17wch_92", o = "_sizeMd_17wch_106", z = "_sizeLg_17wch_120", n = "_sizeXl_17wch_134", t = {
|
|
2
|
+
base: s,
|
|
3
|
+
icon: e,
|
|
4
|
+
copied: _,
|
|
5
|
+
sizeXs: c,
|
|
6
|
+
sizeSm: i,
|
|
7
|
+
sizeMd: o,
|
|
8
|
+
sizeLg: z,
|
|
9
|
+
sizeXl: n
|
|
10
|
+
};
|
|
11
|
+
export {
|
|
12
|
+
s as base,
|
|
13
|
+
_ as copied,
|
|
14
|
+
t as default,
|
|
15
|
+
e as icon,
|
|
16
|
+
z as sizeLg,
|
|
17
|
+
o as sizeMd,
|
|
18
|
+
i as sizeSm,
|
|
19
|
+
n as sizeXl,
|
|
20
|
+
c as sizeXs
|
|
21
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { spread as i, mergeProps as l, insert as m, createComponent as a, template as n } from "solid-js/web";
|
|
2
|
+
import { splitProps as p, mergeProps as d } from "solid-js";
|
|
3
|
+
import { X as u } from "lucide-solid";
|
|
4
|
+
import { bem as c } from "../utils/bem.js";
|
|
5
|
+
import { cn as z } from "../utils/cn.js";
|
|
6
|
+
import e from "./CloseButton.module.css.js";
|
|
7
|
+
var f = /* @__PURE__ */ n("<button>");
|
|
8
|
+
const b = {
|
|
9
|
+
xs: e.sizeXs,
|
|
10
|
+
sm: e.sizeSm,
|
|
11
|
+
md: e.sizeMd,
|
|
12
|
+
lg: e.sizeLg,
|
|
13
|
+
xl: e.sizeXl,
|
|
14
|
+
"2xl": e.size2xl
|
|
15
|
+
}, g = {
|
|
16
|
+
size: "md",
|
|
17
|
+
rounded: !1
|
|
18
|
+
};
|
|
19
|
+
function v(t) {
|
|
20
|
+
const [r, o] = p(d(g, t), ["size", "rounded", "class"]);
|
|
21
|
+
return (() => {
|
|
22
|
+
var s = f();
|
|
23
|
+
return i(s, l(o, {
|
|
24
|
+
type: "button",
|
|
25
|
+
"data-part": "root",
|
|
26
|
+
"aria-label": "Close",
|
|
27
|
+
get class() {
|
|
28
|
+
return z(c("balik-close-button", r.size), e.base, b[r.size], r.rounded && e.rounded, r.class);
|
|
29
|
+
}
|
|
30
|
+
}), !1, !0), m(s, a(u, {
|
|
31
|
+
"aria-hidden": "true"
|
|
32
|
+
})), s;
|
|
33
|
+
})();
|
|
34
|
+
}
|
|
35
|
+
export {
|
|
36
|
+
v as CloseButton
|
|
37
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
const s = "_base_1satc_1", e = "_sizeXs_1satc_38", _ = "_sizeSm_1satc_49", t = "_sizeMd_1satc_59", i = "_sizeLg_1satc_69", z = "_sizeXl_1satc_79", c = "_size2xl_1satc_89", a = "_rounded_1satc_99", o = {
|
|
2
|
+
base: s,
|
|
3
|
+
sizeXs: e,
|
|
4
|
+
sizeSm: _,
|
|
5
|
+
sizeMd: t,
|
|
6
|
+
sizeLg: i,
|
|
7
|
+
sizeXl: z,
|
|
8
|
+
size2xl: c,
|
|
9
|
+
rounded: a
|
|
10
|
+
};
|
|
11
|
+
export {
|
|
12
|
+
s as base,
|
|
13
|
+
o as default,
|
|
14
|
+
a as rounded,
|
|
15
|
+
c as size2xl,
|
|
16
|
+
i as sizeLg,
|
|
17
|
+
t as sizeMd,
|
|
18
|
+
_ as sizeSm,
|
|
19
|
+
z as sizeXl,
|
|
20
|
+
e as sizeXs
|
|
21
|
+
};
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import { createComponent as f, render as p, memo as h } from "solid-js/web";
|
|
2
|
+
import { splitProps as b, mergeProps as L, createRoot as w, createSignal as E, Show as v } from "solid-js";
|
|
3
|
+
import { Dialog as C } from "../Dialog/Dialog.js";
|
|
4
|
+
import g from "./Confirm.module.css.js";
|
|
5
|
+
const y = {
|
|
6
|
+
mode: "sheet",
|
|
7
|
+
confirmLabel: "Confirm",
|
|
8
|
+
cancelLabel: "Cancel",
|
|
9
|
+
danger: !1,
|
|
10
|
+
loading: !1
|
|
11
|
+
};
|
|
12
|
+
function d(t) {
|
|
13
|
+
const [e] = b(L(y, t), ["mode", "open", "onOpenChange", "confirmLabel", "cancelLabel", "danger", "loading", "onConfirm", "onCancel", "class", "children"]), r = !!e.onCancel;
|
|
14
|
+
return f(C, {
|
|
15
|
+
get mode() {
|
|
16
|
+
return e.mode;
|
|
17
|
+
},
|
|
18
|
+
get open() {
|
|
19
|
+
return e.open;
|
|
20
|
+
},
|
|
21
|
+
get onOpenChange() {
|
|
22
|
+
return e.onOpenChange;
|
|
23
|
+
},
|
|
24
|
+
closeable: !1,
|
|
25
|
+
showCancel: r,
|
|
26
|
+
showConfirm: !0,
|
|
27
|
+
get cancelLabel() {
|
|
28
|
+
return e.cancelLabel;
|
|
29
|
+
},
|
|
30
|
+
get confirmLabel() {
|
|
31
|
+
return e.confirmLabel;
|
|
32
|
+
},
|
|
33
|
+
get danger() {
|
|
34
|
+
return e.danger;
|
|
35
|
+
},
|
|
36
|
+
get loading() {
|
|
37
|
+
return e.loading;
|
|
38
|
+
},
|
|
39
|
+
get onConfirm() {
|
|
40
|
+
return e.onConfirm;
|
|
41
|
+
},
|
|
42
|
+
get onCancel() {
|
|
43
|
+
return e.onCancel;
|
|
44
|
+
},
|
|
45
|
+
get footerClass() {
|
|
46
|
+
return r ? void 0 : g.footerCenter;
|
|
47
|
+
},
|
|
48
|
+
get class() {
|
|
49
|
+
return e.class;
|
|
50
|
+
},
|
|
51
|
+
get children() {
|
|
52
|
+
return e.children;
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
let i = null, o = null, m = null;
|
|
57
|
+
function S() {
|
|
58
|
+
if (m) return;
|
|
59
|
+
const t = document.createElement("div");
|
|
60
|
+
document.body.appendChild(t), w(() => {
|
|
61
|
+
const [e, r] = E(null);
|
|
62
|
+
m = r;
|
|
63
|
+
const c = (n) => {
|
|
64
|
+
const u = e();
|
|
65
|
+
if (n.prev) return;
|
|
66
|
+
const l = i, a = o;
|
|
67
|
+
if (i = null, o = null, n.type === "confirm")
|
|
68
|
+
l == null || l();
|
|
69
|
+
else {
|
|
70
|
+
const s = new Error("Cancel");
|
|
71
|
+
s.code = "CANCEL", a == null || a(s);
|
|
72
|
+
}
|
|
73
|
+
r({
|
|
74
|
+
...u,
|
|
75
|
+
open: !1
|
|
76
|
+
});
|
|
77
|
+
};
|
|
78
|
+
p(() => f(v, {
|
|
79
|
+
get when() {
|
|
80
|
+
return e();
|
|
81
|
+
},
|
|
82
|
+
children: (n) => f(C, {
|
|
83
|
+
get mode() {
|
|
84
|
+
return n().mode || "sheet";
|
|
85
|
+
},
|
|
86
|
+
get open() {
|
|
87
|
+
return n().open;
|
|
88
|
+
},
|
|
89
|
+
closeable: !1,
|
|
90
|
+
get showCancel() {
|
|
91
|
+
return !n().noCancel;
|
|
92
|
+
},
|
|
93
|
+
showConfirm: !0,
|
|
94
|
+
get confirmLabel() {
|
|
95
|
+
return n().confirmLabel || "Confirm";
|
|
96
|
+
},
|
|
97
|
+
get cancelLabel() {
|
|
98
|
+
return n().cancelLabel || "Cancel";
|
|
99
|
+
},
|
|
100
|
+
get danger() {
|
|
101
|
+
return n().danger;
|
|
102
|
+
},
|
|
103
|
+
get footerClass() {
|
|
104
|
+
return h(() => !!n().noCancel)() ? g.footerCenter : void 0;
|
|
105
|
+
},
|
|
106
|
+
onConfirm: () => c({
|
|
107
|
+
type: "confirm",
|
|
108
|
+
prev: n()
|
|
109
|
+
}),
|
|
110
|
+
onCancel: () => c({
|
|
111
|
+
type: "cancel",
|
|
112
|
+
prev: n()
|
|
113
|
+
}),
|
|
114
|
+
onOpenChange: (u) => {
|
|
115
|
+
if (!u.open) {
|
|
116
|
+
if (o) {
|
|
117
|
+
const l = new Error("Cancel");
|
|
118
|
+
l.code = "CANCEL";
|
|
119
|
+
const a = o;
|
|
120
|
+
i = null, o = null, a(l);
|
|
121
|
+
}
|
|
122
|
+
r(null);
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
get children() {
|
|
126
|
+
return n().children;
|
|
127
|
+
}
|
|
128
|
+
})
|
|
129
|
+
}), t);
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
d.confirm = (t = {}) => (S(), new Promise((e, r) => {
|
|
133
|
+
if (o) {
|
|
134
|
+
const c = new Error("Superseded by a newer confirm()");
|
|
135
|
+
c.code = "CANCEL", o(c);
|
|
136
|
+
}
|
|
137
|
+
i = e, o = r, m({
|
|
138
|
+
...t,
|
|
139
|
+
open: !0
|
|
140
|
+
});
|
|
141
|
+
}));
|
|
142
|
+
const N = d.confirm;
|
|
143
|
+
export {
|
|
144
|
+
d as Confirm,
|
|
145
|
+
N as confirm
|
|
146
|
+
};
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { insert as g, createComponent as D, effect as S, className as c, template as M, delegateEvents as z } from "solid-js/web";
|
|
2
|
+
import { splitProps as K, mergeProps as j, createSignal as h, createMemo as k, createEffect as L, onCleanup as q } from "solid-js";
|
|
3
|
+
import { Calendar as G } from "lucide-solid";
|
|
4
|
+
import { BottomSheet as Q } from "../BottomSheet/BottomSheet.js";
|
|
5
|
+
import { PickerView as W } from "../PickerView/PickerView.js";
|
|
6
|
+
import { bem as X } from "../utils/bem.js";
|
|
7
|
+
import { cn as T } from "../utils/cn.js";
|
|
8
|
+
import o from "./DatePicker.module.css.js";
|
|
9
|
+
var Z = /* @__PURE__ */ M("<button type=button data-part=trigger><span>"), ee = /* @__PURE__ */ M("<div><button type=button>Cancel</button><span></span><button type=button>Confirm"), te = /* @__PURE__ */ M("<div data-part=picker-body><p data-part=weekday>");
|
|
10
|
+
const V = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
|
|
11
|
+
function C(s, n) {
|
|
12
|
+
return new Date(s, n + 1, 0).getDate();
|
|
13
|
+
}
|
|
14
|
+
function ne(s, n, l) {
|
|
15
|
+
return Math.max(n, Math.min(l, s));
|
|
16
|
+
}
|
|
17
|
+
const re = {
|
|
18
|
+
title: "Select Date",
|
|
19
|
+
placeholder: "Select Date",
|
|
20
|
+
value: null,
|
|
21
|
+
disabled: !1
|
|
22
|
+
};
|
|
23
|
+
function ge(s) {
|
|
24
|
+
const [n] = K(j(re, s), ["value", "onValueChange", "onConfirm", "onCancel", "min", "max", "title", "placeholder", "disabled", "class"]), l = /* @__PURE__ */ new Date(), w = n.min || new Date(l.getFullYear() - 100, 0, 1), x = n.max || new Date(l.getFullYear() + 10, 11, 31), m = w.getFullYear(), Y = x.getFullYear(), [$, p] = h(!1), [u, F] = h(l.getFullYear()), [v, P] = h(l.getMonth()), [f, b] = h(l.getDate()), E = k(() => C(u(), v()));
|
|
25
|
+
L(() => {
|
|
26
|
+
const e = E();
|
|
27
|
+
f() > e && b(e);
|
|
28
|
+
}), L(() => {
|
|
29
|
+
if (!$()) return;
|
|
30
|
+
const e = (r) => {
|
|
31
|
+
r.key === "Escape" && y();
|
|
32
|
+
};
|
|
33
|
+
document.addEventListener("keydown", e), q(() => document.removeEventListener("keydown", e));
|
|
34
|
+
});
|
|
35
|
+
const B = k(() => {
|
|
36
|
+
const e = u();
|
|
37
|
+
return [{
|
|
38
|
+
flex: 1.1,
|
|
39
|
+
items: Array.from({
|
|
40
|
+
length: Y - m + 1
|
|
41
|
+
}, (r, t) => ({
|
|
42
|
+
label: String(m + t),
|
|
43
|
+
value: m + t
|
|
44
|
+
}))
|
|
45
|
+
}, {
|
|
46
|
+
circular: !0,
|
|
47
|
+
items: V.map((r, t) => ({
|
|
48
|
+
label: r,
|
|
49
|
+
value: t,
|
|
50
|
+
disabled: e === m && t < w.getMonth() || e === Y && t > x.getMonth()
|
|
51
|
+
}))
|
|
52
|
+
}, {
|
|
53
|
+
flex: 0.9,
|
|
54
|
+
circular: !0,
|
|
55
|
+
items: Array.from({
|
|
56
|
+
length: E()
|
|
57
|
+
}, (r, t) => ({
|
|
58
|
+
label: String(t + 1).padStart(2, "0"),
|
|
59
|
+
value: t + 1
|
|
60
|
+
}))
|
|
61
|
+
}];
|
|
62
|
+
}), N = () => [u(), v(), f()], J = ([e, r, t]) => {
|
|
63
|
+
F(e), P(r), b(ne(t, 1, C(e, r)));
|
|
64
|
+
}, H = k(() => new Date(u(), v(), f()).toLocaleDateString("en-US", {
|
|
65
|
+
weekday: "long"
|
|
66
|
+
})), I = () => {
|
|
67
|
+
const e = n.value;
|
|
68
|
+
return e ? `${V[e.getMonth()]} ${e.getDate()}, ${e.getFullYear()}` : n.placeholder;
|
|
69
|
+
};
|
|
70
|
+
function R() {
|
|
71
|
+
if (n.disabled) return;
|
|
72
|
+
const e = n.value || l;
|
|
73
|
+
F(e.getFullYear()), P(e.getMonth()), b(Math.min(e.getDate(), C(e.getFullYear(), e.getMonth()))), p(!0);
|
|
74
|
+
}
|
|
75
|
+
function U() {
|
|
76
|
+
var r, t;
|
|
77
|
+
const e = new Date(u(), v(), f());
|
|
78
|
+
(r = n.onValueChange) == null || r.call(n, e), (t = n.onConfirm) == null || t.call(n, e), p(!1);
|
|
79
|
+
}
|
|
80
|
+
function y() {
|
|
81
|
+
var e;
|
|
82
|
+
(e = n.onCancel) == null || e.call(n), p(!1);
|
|
83
|
+
}
|
|
84
|
+
return [(() => {
|
|
85
|
+
var e = Z(), r = e.firstChild;
|
|
86
|
+
return e.$$click = R, g(r, I), g(e, D(G, {
|
|
87
|
+
get class() {
|
|
88
|
+
return o.triggerIcon;
|
|
89
|
+
},
|
|
90
|
+
size: 18,
|
|
91
|
+
"stroke-width": 1.5
|
|
92
|
+
}), null), S((t) => {
|
|
93
|
+
var i = T(X(), o.trigger, n.disabled && o.triggerDisabled, n.class), a = n.disabled, d = T(o.triggerText, !n.value && o.triggerPlaceholder);
|
|
94
|
+
return i !== t.e && c(e, t.e = i), a !== t.t && (e.disabled = t.t = a), d !== t.a && c(r, t.a = d), t;
|
|
95
|
+
}, {
|
|
96
|
+
e: void 0,
|
|
97
|
+
t: void 0,
|
|
98
|
+
a: void 0
|
|
99
|
+
}), e;
|
|
100
|
+
})(), D(Q, {
|
|
101
|
+
get open() {
|
|
102
|
+
return $();
|
|
103
|
+
},
|
|
104
|
+
get class() {
|
|
105
|
+
return o.sheet;
|
|
106
|
+
},
|
|
107
|
+
onOpenChange: (e) => {
|
|
108
|
+
e.open || y();
|
|
109
|
+
},
|
|
110
|
+
get children() {
|
|
111
|
+
return [(() => {
|
|
112
|
+
var e = ee(), r = e.firstChild, t = r.nextSibling, i = t.nextSibling;
|
|
113
|
+
return r.$$click = y, g(t, () => n.title), i.$$click = U, S((a) => {
|
|
114
|
+
var d = o.header, _ = o.headerButton, A = o.headerTitle, O = o.headerButton;
|
|
115
|
+
return d !== a.e && c(e, a.e = d), _ !== a.t && c(r, a.t = _), A !== a.a && c(t, a.a = A), O !== a.o && c(i, a.o = O), a;
|
|
116
|
+
}, {
|
|
117
|
+
e: void 0,
|
|
118
|
+
t: void 0,
|
|
119
|
+
a: void 0,
|
|
120
|
+
o: void 0
|
|
121
|
+
}), e;
|
|
122
|
+
})(), (() => {
|
|
123
|
+
var e = te(), r = e.firstChild;
|
|
124
|
+
return g(e, D(W, {
|
|
125
|
+
get class() {
|
|
126
|
+
return o.columns;
|
|
127
|
+
},
|
|
128
|
+
get columns() {
|
|
129
|
+
return B();
|
|
130
|
+
},
|
|
131
|
+
get value() {
|
|
132
|
+
return N();
|
|
133
|
+
},
|
|
134
|
+
onValueChange: J
|
|
135
|
+
}), r), g(r, H), S((t) => {
|
|
136
|
+
var i = o.pickerBody, a = o.weekday;
|
|
137
|
+
return i !== t.e && c(e, t.e = i), a !== t.t && c(r, t.t = a), t;
|
|
138
|
+
}, {
|
|
139
|
+
e: void 0,
|
|
140
|
+
t: void 0
|
|
141
|
+
}), e;
|
|
142
|
+
})()];
|
|
143
|
+
}
|
|
144
|
+
})];
|
|
145
|
+
}
|
|
146
|
+
z(["click"]);
|
|
147
|
+
export {
|
|
148
|
+
ge as DatePicker
|
|
149
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
const e = "_trigger_zwcfc_1", c = "_triggerDisabled_zwcfc_33", r = "_triggerText_zwcfc_40", t = "_triggerPlaceholder_zwcfc_48", _ = "_triggerIcon_zwcfc_52", g = "_pickerBody_zwcfc_61", o = "_sheet_zwcfc_68", s = "_header_zwcfc_74", i = "_headerTitle_zwcfc_87", d = "_headerButton_zwcfc_103", n = "_columns_zwcfc_114", a = "_weekday_zwcfc_118", l = {
|
|
2
|
+
trigger: e,
|
|
3
|
+
triggerDisabled: c,
|
|
4
|
+
triggerText: r,
|
|
5
|
+
triggerPlaceholder: t,
|
|
6
|
+
triggerIcon: _,
|
|
7
|
+
pickerBody: g,
|
|
8
|
+
sheet: o,
|
|
9
|
+
header: s,
|
|
10
|
+
headerTitle: i,
|
|
11
|
+
headerButton: d,
|
|
12
|
+
columns: n,
|
|
13
|
+
weekday: a
|
|
14
|
+
};
|
|
15
|
+
export {
|
|
16
|
+
n as columns,
|
|
17
|
+
l as default,
|
|
18
|
+
s as header,
|
|
19
|
+
d as headerButton,
|
|
20
|
+
i as headerTitle,
|
|
21
|
+
g as pickerBody,
|
|
22
|
+
o as sheet,
|
|
23
|
+
e as trigger,
|
|
24
|
+
c as triggerDisabled,
|
|
25
|
+
_ as triggerIcon,
|
|
26
|
+
t as triggerPlaceholder,
|
|
27
|
+
r as triggerText,
|
|
28
|
+
a as weekday
|
|
29
|
+
};
|