@balikjs/mobile 0.1.10 → 0.1.12

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.
Files changed (68) hide show
  1. package/dist/Alert/Alert.module.css.js +18 -18
  2. package/dist/Avatar/Avatar.module.css.js +16 -16
  3. package/dist/BackToTop/BackToTop.module.css.js +6 -6
  4. package/dist/Badge/Badge.js +44 -43
  5. package/dist/Badge/Badge.module.css.js +36 -42
  6. package/dist/BottomNavigation/BottomNavigation.module.css.js +6 -6
  7. package/dist/BottomSheet/BottomSheet.js +61 -78
  8. package/dist/BottomSheet/BottomSheet.module.css.js +14 -20
  9. package/dist/Button/Button.js +29 -24
  10. package/dist/Button/Button.module.css.js +21 -19
  11. package/dist/Card/Card.module.css.js +1 -1
  12. package/dist/Checkbox/Checkbox.module.css.js +13 -13
  13. package/dist/Clipboard/Clipboard.js +31 -26
  14. package/dist/Clipboard/Clipboard.module.css.js +16 -16
  15. package/dist/CloseButton/CloseButton.js +1 -2
  16. package/dist/CloseButton/CloseButton.module.css.js +12 -12
  17. package/dist/Confirm/Confirm.js +31 -24
  18. package/dist/DatePicker/DatePicker.js +71 -59
  19. package/dist/DatePicker/DatePicker.module.css.js +36 -24
  20. package/dist/Dialog/Dialog.js +79 -63
  21. package/dist/Dialog/Dialog.module.css.js +16 -14
  22. package/dist/Divider/Divider.module.css.js +2 -2
  23. package/dist/Drawer/Drawer.module.css.js +2 -2
  24. package/dist/Fab/Fab.module.css.js +16 -16
  25. package/dist/Field/Field.module.css.js +14 -14
  26. package/dist/Fieldset/Fieldset.module.css.js +1 -1
  27. package/dist/FileUpload/FileUpload.module.css.js +26 -26
  28. package/dist/FilterGroup/FilterGroup.js +61 -58
  29. package/dist/FilterGroup/FilterGroup.module.css.js +12 -20
  30. package/dist/Input/Input.js +62 -40
  31. package/dist/Input/Input.module.css.js +36 -30
  32. package/dist/Link/Link.module.css.js +1 -1
  33. package/dist/MoneyInput/MoneyInput.module.css.js +6 -6
  34. package/dist/Pagination/Pagination.module.css.js +1 -1
  35. package/dist/Picker/Picker.module.css.js +8 -8
  36. package/dist/PickerView/PickerView.module.css.js +16 -16
  37. package/dist/PinInput/PinInput.module.css.js +14 -14
  38. package/dist/Popover/Popover.module.css.js +10 -10
  39. package/dist/Progress/Progress.module.css.js +14 -14
  40. package/dist/QrCode/QrCode.module.css.js +6 -6
  41. package/dist/RadioGroup/Radio.module.css.js +18 -18
  42. package/dist/RatingGroup/RatingGroup.js +6 -6
  43. package/dist/RatingGroup/RatingGroup.module.css.js +6 -6
  44. package/dist/SearchInput/SearchInput.module.css.js +1 -1
  45. package/dist/Select/Select.js +45 -44
  46. package/dist/Select/Select.module.css.js +20 -18
  47. package/dist/SelectPc/Select.js +50 -44
  48. package/dist/SelectPc/SelectPc.module.css.js +34 -28
  49. package/dist/SignaturePad/SignaturePad.js +116 -0
  50. package/dist/SignaturePad/SignaturePad.module.css.js +15 -0
  51. package/dist/Slider/Slider.module.css.js +10 -10
  52. package/dist/Spinner/Spinner.module.css.js +4 -4
  53. package/dist/Steps/Steps.js +87 -77
  54. package/dist/Steps/Steps.module.css.js +20 -22
  55. package/dist/StickyHeader/StickyHeader.module.css.js +2 -2
  56. package/dist/Switch/Switch.js +22 -18
  57. package/dist/Switch/Switch.module.css.js +22 -20
  58. package/dist/Tabs/Tabs.module.css.js +6 -6
  59. package/dist/Tag/Tag.js +34 -26
  60. package/dist/Tag/Tag.module.css.js +36 -32
  61. package/dist/Textarea/Textarea.module.css.js +10 -10
  62. package/dist/Toast/Toast.module.css.js +30 -30
  63. package/dist/Toggle/Toggle.module.css.js +1 -1
  64. package/dist/ToggleGroup/ToggleGroup.js +36 -21
  65. package/dist/ToggleGroup/ToggleGroup.module.css.js +22 -16
  66. package/dist/index.js +143 -135
  67. package/dist/styles.css +1 -1
  68. package/package.json +4 -1
@@ -1,31 +1,33 @@
1
- const n = "_base_1l4rf_1", s = "_loadingOverlay_1l4rf_24", e = "_loadingButton_1l4rf_35", t = "_outline_1l4rf_39", _ = "_solid_1l4rf_51", i = "_intentDefault_1l4rf_63", l = "_intentDanger_1l4rf_72", o = "_sizeXs_1l4rf_81", r = "_sizeSm_1l4rf_89", a = "_sizeMd_1l4rf_97", f = "_sizeLg_1l4rf_105", z = "_sizeXl_1l4rf_113", c = "_spinner_1l4rf_121", d = {
2
- base: n,
3
- loadingOverlay: s,
4
- loadingButton: e,
5
- outline: t,
1
+ const e = "_base_zewfr_1", n = "_loadingOverlay_zewfr_22", t = "_loadingButton_zewfr_33", s = "_outline_zewfr_37", _ = "_solid_zewfr_48", i = "_intentDefault_zewfr_60", o = "_intentNeutral_zewfr_69", z = "_intentDanger_zewfr_78", r = "_sizeXs_zewfr_87", l = "_sizeSm_zewfr_95", a = "_sizeMd_zewfr_103", f = "_sizeLg_zewfr_111", c = "_sizeXl_zewfr_119", w = "_spinner_zewfr_127", d = {
2
+ base: e,
3
+ loadingOverlay: n,
4
+ loadingButton: t,
5
+ outline: s,
6
6
  solid: _,
7
7
  intentDefault: i,
8
- intentDanger: l,
9
- sizeXs: o,
10
- sizeSm: r,
8
+ intentNeutral: o,
9
+ intentDanger: z,
10
+ sizeXs: r,
11
+ sizeSm: l,
11
12
  sizeMd: a,
12
13
  sizeLg: f,
13
- sizeXl: z,
14
- spinner: c
14
+ sizeXl: c,
15
+ spinner: w
15
16
  };
16
17
  export {
17
- n as base,
18
+ e as base,
18
19
  d as default,
19
- l as intentDanger,
20
+ z as intentDanger,
20
21
  i as intentDefault,
21
- e as loadingButton,
22
- s as loadingOverlay,
23
- t as outline,
22
+ o as intentNeutral,
23
+ t as loadingButton,
24
+ n as loadingOverlay,
25
+ s as outline,
24
26
  f as sizeLg,
25
27
  a as sizeMd,
26
- r as sizeSm,
27
- z as sizeXl,
28
- o as sizeXs,
28
+ l as sizeSm,
29
+ c as sizeXl,
30
+ r as sizeXs,
29
31
  _ as solid,
30
- c as spinner
32
+ w as spinner
31
33
  };
@@ -1,4 +1,4 @@
1
- const s = "_base_174ux_1", e = {
1
+ const s = "_base_clllx_1", e = {
2
2
  base: s
3
3
  };
4
4
  export {
@@ -1,27 +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,
1
+ const o = "_root_3hi0o_1", s = "_control_3hi0o_17", i = "_indicator_3hi0o_56", _ = "_label_3hi0o_68", e = "_sizeXs_3hi0o_76", t = "_sizeSm_3hi0o_86", n = "_sizeMd_3hi0o_96", c = "_sizeLg_3hi0o_106", z = "_sizeXl_3hi0o_116", l = "_size2xl_3hi0o_126", d = "_rounded_3hi0o_136", r = {
2
+ root: o,
3
+ control: s,
4
+ indicator: i,
5
+ label: _,
6
6
  sizeXs: e,
7
- sizeSm: i,
8
- sizeMd: t,
7
+ sizeSm: t,
8
+ sizeMd: n,
9
9
  sizeLg: c,
10
10
  sizeXl: z,
11
11
  size2xl: l,
12
12
  rounded: d
13
13
  };
14
14
  export {
15
- _ as control,
15
+ s as control,
16
16
  r as default,
17
- n as indicator,
18
- o as label,
19
- s as root,
17
+ i as indicator,
18
+ _ as label,
19
+ o as root,
20
20
  d as rounded,
21
21
  l as size2xl,
22
22
  c as sizeLg,
23
- t as sizeMd,
24
- i as sizeSm,
23
+ n as sizeMd,
24
+ t as sizeSm,
25
25
  z as sizeXl,
26
26
  e as sizeXs
27
27
  };
@@ -1,58 +1,63 @@
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";
1
+ import { spread as g, mergeProps as b, insert as c, memo as f, createComponent as p, template as y } from "solid-js/web";
2
+ import { splitProps as C, mergeProps as h, createSignal as v, onCleanup as x } from "solid-js";
3
+ import { Check as z, Copy as T } from "lucide-solid";
4
+ import { bem as P } from "../utils/bem.js";
5
+ import { cn as R } from "../utils/cn.js";
6
6
  import t from "./Clipboard.module.css.js";
7
- var T = /* @__PURE__ */ C("<button>");
8
- const D = {
7
+ var k = /* @__PURE__ */ y("<button>");
8
+ const w = {
9
9
  xs: t.sizeXs,
10
10
  sm: t.sizeSm,
11
11
  md: t.sizeMd,
12
12
  lg: t.sizeLg,
13
13
  xl: t.sizeXl
14
- }, _ = {
14
+ }, S = {
15
15
  size: "md",
16
16
  copiedDuration: 2e3,
17
17
  toastOnCopy: !1
18
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 () => {
19
+ function L(d) {
20
+ const [o, m] = C(h(S, d), ["value", "size", "class", "copiedDuration", "toastOnCopy", "children"]), [r, i] = v(!1);
21
+ let a = null;
22
+ const u = async () => {
23
+ var e;
23
24
  try {
24
- await navigator.clipboard.writeText(o.value);
25
+ (e = navigator.clipboard) != null && e.writeText ? await navigator.clipboard.writeText(o.value) : s();
25
26
  } 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);
27
+ s();
28
28
  }
29
- i(!0), clearTimeout(r), r = setTimeout(() => i(!1), o.copiedDuration);
29
+ i(!0), clearTimeout(a), a = setTimeout(() => i(!1), o.copiedDuration);
30
+ }, s = () => {
31
+ const e = document.createElement("textarea");
32
+ e.value = o.value, e.setAttribute("readonly", ""), e.style.cssText = "position:fixed;top:0;left:0;width:2px;height:2px;padding:0;border:none;outline:none;box-shadow:none;background:transparent;opacity:0;pointer-events:none", document.body.appendChild(e);
33
+ const n = document.getSelection(), l = n && n.rangeCount > 0 ? n.getRangeAt(0) : null;
34
+ e.select(), e.setSelectionRange(0, o.value.length), document.execCommand("copy"), document.body.removeChild(e), l && n && (n.removeAllRanges(), n.addRange(l));
30
35
  };
31
- return z(() => clearTimeout(r)), (() => {
32
- var e = T();
33
- return d(e, u(c, {
36
+ return x(() => clearTimeout(a)), (() => {
37
+ var e = k();
38
+ return g(e, b(m, {
34
39
  type: "button",
35
40
  "data-part": "root",
36
- onClick: p,
41
+ onClick: u,
37
42
  get class() {
38
- return P(x("balik-clipboard", o.size), t.base, D[o.size], a() && t.copied, o.class);
43
+ return R(P("balik-clipboard", o.size), t.base, w[o.size], r() && t.copied, o.class);
39
44
  }
40
- }), !1, !0), s(e, (() => {
41
- var m = y(() => !!a());
42
- return () => m() ? n(h, {
45
+ }), !1, !0), c(e, (() => {
46
+ var n = f(() => !!r());
47
+ return () => n() ? p(z, {
43
48
  "aria-hidden": "true",
44
49
  get class() {
45
50
  return t.icon;
46
51
  },
47
52
  "data-part": "icon"
48
- }) : n(v, {
53
+ }) : p(T, {
49
54
  "aria-hidden": "true",
50
55
  get class() {
51
56
  return t.icon;
52
57
  },
53
58
  "data-part": "icon"
54
59
  });
55
- })(), null), s(e, () => o.children, null), e;
60
+ })(), null), c(e, () => o.children, null), e;
56
61
  })();
57
62
  }
58
63
  export {
@@ -1,21 +1,21 @@
1
- const s = "_base_fovdv_1", e = "_icon_fovdv_42", o = "_copied_fovdv_48", _ = "_sizeXs_fovdv_77", i = "_sizeSm_fovdv_91", v = "_sizeMd_fovdv_105", c = "_sizeLg_fovdv_119", d = "_sizeXl_fovdv_133", z = {
1
+ const s = "_base_o8cik_1", i = "_icon_o8cik_36", e = "_copied_o8cik_42", o = "_sizeXs_o8cik_69", _ = "_sizeSm_o8cik_83", c = "_sizeMd_o8cik_97", z = "_sizeLg_o8cik_111", n = "_sizeXl_o8cik_125", t = {
2
2
  base: s,
3
- icon: e,
4
- copied: o,
5
- sizeXs: _,
6
- sizeSm: i,
7
- sizeMd: v,
8
- sizeLg: c,
9
- sizeXl: d
3
+ icon: i,
4
+ copied: e,
5
+ sizeXs: o,
6
+ sizeSm: _,
7
+ sizeMd: c,
8
+ sizeLg: z,
9
+ sizeXl: n
10
10
  };
11
11
  export {
12
12
  s as base,
13
- o as copied,
14
- z as default,
15
- e as icon,
16
- c as sizeLg,
17
- v as sizeMd,
18
- i as sizeSm,
19
- d as sizeXl,
20
- _ as sizeXs
13
+ e as copied,
14
+ t as default,
15
+ i as icon,
16
+ z as sizeLg,
17
+ c as sizeMd,
18
+ _ as sizeSm,
19
+ n as sizeXl,
20
+ o as sizeXs
21
21
  };
@@ -4,7 +4,7 @@ import { X as u } from "lucide-solid";
4
4
  import { bem as c } from "../utils/bem.js";
5
5
  import { cn as z } from "../utils/cn.js";
6
6
  import e from "./CloseButton.module.css.js";
7
- var f = /* @__PURE__ */ n("<button>");
7
+ var f = /* @__PURE__ */ n("<button data-part=root>");
8
8
  const b = {
9
9
  xs: e.sizeXs,
10
10
  sm: e.sizeSm,
@@ -22,7 +22,6 @@ function v(t) {
22
22
  var s = f();
23
23
  return i(s, l(o, {
24
24
  type: "button",
25
- "data-part": "root",
26
25
  "aria-label": "Close",
27
26
  get class() {
28
27
  return z(c("balik-close-button", r.size), e.base, b[r.size], r.rounded && e.rounded, r.class);
@@ -1,21 +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 = {
1
+ const s = "_base_r9hwl_1", e = "_sizeXs_r9hwl_31", _ = "_sizeSm_r9hwl_42", i = "_sizeMd_r9hwl_52", z = "_sizeLg_r9hwl_62", l = "_sizeXl_r9hwl_72", o = "_size2xl_r9hwl_82", n = "_rounded_r9hwl_92", r = {
2
2
  base: s,
3
3
  sizeXs: e,
4
4
  sizeSm: _,
5
- sizeMd: t,
6
- sizeLg: i,
7
- sizeXl: z,
8
- size2xl: c,
9
- rounded: a
5
+ sizeMd: i,
6
+ sizeLg: z,
7
+ sizeXl: l,
8
+ size2xl: o,
9
+ rounded: n
10
10
  };
11
11
  export {
12
12
  s as base,
13
- o as default,
14
- a as rounded,
15
- c as size2xl,
16
- i as sizeLg,
17
- t as sizeMd,
13
+ r as default,
14
+ n as rounded,
15
+ o as size2xl,
16
+ z as sizeLg,
17
+ i as sizeMd,
18
18
  _ as sizeSm,
19
- z as sizeXl,
19
+ l as sizeXl,
20
20
  e as sizeXs
21
21
  };
@@ -1,17 +1,18 @@
1
1
  import { createComponent as f, render as p, memo as h } from "solid-js/web";
2
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";
3
+ import { Dialog as g } from "../Dialog/Dialog.js";
4
+ import s from "./Confirm.module.css.js";
5
5
  const y = {
6
6
  mode: "sheet",
7
+ title: "Confirm",
7
8
  confirmLabel: "Confirm",
8
9
  cancelLabel: "Cancel",
9
10
  danger: !1,
10
11
  loading: !1
11
12
  };
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, {
13
+ function d(o) {
14
+ const [e] = b(L(y, o), ["mode", "open", "onOpenChange", "title", "confirmLabel", "cancelLabel", "danger", "loading", "onConfirm", "onCancel", "class", "children"]), r = !!e.onCancel;
15
+ return f(g, {
15
16
  get mode() {
16
17
  return e.mode;
17
18
  },
@@ -22,6 +23,9 @@ function d(t) {
22
23
  return e.onOpenChange;
23
24
  },
24
25
  closeable: !1,
26
+ get title() {
27
+ return e.title;
28
+ },
25
29
  showCancel: r,
26
30
  showConfirm: !0,
27
31
  get cancelLabel() {
@@ -43,7 +47,7 @@ function d(t) {
43
47
  return e.onCancel;
44
48
  },
45
49
  get footerClass() {
46
- return r ? void 0 : g.footerCenter;
50
+ return r ? void 0 : s.footerCenter;
47
51
  },
48
52
  get class() {
49
53
  return e.class;
@@ -53,22 +57,22 @@ function d(t) {
53
57
  }
54
58
  });
55
59
  }
56
- let i = null, o = null, m = null;
60
+ let i = null, t = null, m = null;
57
61
  function S() {
58
62
  if (m) return;
59
- const t = document.createElement("div");
60
- document.body.appendChild(t), w(() => {
63
+ const o = document.createElement("div");
64
+ document.body.appendChild(o), w(() => {
61
65
  const [e, r] = E(null);
62
66
  m = r;
63
67
  const c = (n) => {
64
68
  const u = e();
65
69
  if (n.prev) return;
66
- const l = i, a = o;
67
- if (i = null, o = null, n.type === "confirm")
70
+ const l = i, a = t;
71
+ if (i = null, t = null, n.type === "confirm")
68
72
  l == null || l();
69
73
  else {
70
- const s = new Error("Cancel");
71
- s.code = "CANCEL", a == null || a(s);
74
+ const C = new Error("Cancel");
75
+ C.code = "CANCEL", a == null || a(C);
72
76
  }
73
77
  r({
74
78
  ...u,
@@ -79,7 +83,7 @@ function S() {
79
83
  get when() {
80
84
  return e();
81
85
  },
82
- children: (n) => f(C, {
86
+ children: (n) => f(g, {
83
87
  get mode() {
84
88
  return n().mode || "sheet";
85
89
  },
@@ -87,6 +91,9 @@ function S() {
87
91
  return n().open;
88
92
  },
89
93
  closeable: !1,
94
+ get title() {
95
+ return n().title || "Confirm";
96
+ },
90
97
  get showCancel() {
91
98
  return !n().noCancel;
92
99
  },
@@ -101,7 +108,7 @@ function S() {
101
108
  return n().danger;
102
109
  },
103
110
  get footerClass() {
104
- return h(() => !!n().noCancel)() ? g.footerCenter : void 0;
111
+ return h(() => !!n().noCancel)() ? s.footerCenter : void 0;
105
112
  },
106
113
  onConfirm: () => c({
107
114
  type: "confirm",
@@ -113,11 +120,11 @@ function S() {
113
120
  }),
114
121
  onOpenChange: (u) => {
115
122
  if (!u.open) {
116
- if (o) {
123
+ if (t) {
117
124
  const l = new Error("Cancel");
118
125
  l.code = "CANCEL";
119
- const a = o;
120
- i = null, o = null, a(l);
126
+ const a = t;
127
+ i = null, t = null, a(l);
121
128
  }
122
129
  r(null);
123
130
  }
@@ -126,16 +133,16 @@ function S() {
126
133
  return n().children;
127
134
  }
128
135
  })
129
- }), t);
136
+ }), o);
130
137
  });
131
138
  }
132
- d.confirm = (t = {}) => (S(), new Promise((e, r) => {
133
- if (o) {
139
+ d.confirm = (o = {}) => (S(), new Promise((e, r) => {
140
+ if (t) {
134
141
  const c = new Error("Superseded by a newer confirm()");
135
- c.code = "CANCEL", o(c);
142
+ c.code = "CANCEL", t(c);
136
143
  }
137
- i = e, o = r, m({
138
- ...t,
144
+ i = e, t = r, m({
145
+ ...o,
139
146
  open: !0
140
147
  });
141
148
  }));
@@ -1,39 +1,48 @@
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();
1
+ import { insert as g, createComponent as y, effect as D, className as s, template as C, delegateEvents as U } from "solid-js/web";
2
+ import { splitProps as X, mergeProps as K, createSignal as h, createMemo as S, createEffect as _, onCleanup as j } from "solid-js";
3
+ import { Calendar as q } from "lucide-solid";
4
+ import { BottomSheet as G } from "../BottomSheet/BottomSheet.js";
5
+ import { PickerView as Q } from "../PickerView/PickerView.js";
6
+ import { bem as W } from "../utils/bem.js";
7
+ import { cn as A } from "../utils/cn.js";
8
+ import a from "./DatePicker.module.css.js";
9
+ var Z = /* @__PURE__ */ C("<button type=button data-part=trigger><span>"), ee = /* @__PURE__ */ C("<div><button type=button>Cancel</button><span></span><button type=button>Confirm"), te = /* @__PURE__ */ C("<div data-part=picker-body><p data-part=weekday>");
10
+ const L = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
11
+ function M(c, n) {
12
+ return new Date(c, n + 1, 0).getDate();
13
13
  }
14
- function ne(s, n, l) {
15
- return Math.max(n, Math.min(l, s));
14
+ function ne(c, n, l) {
15
+ return Math.max(n, Math.min(l, c));
16
16
  }
17
17
  const re = {
18
+ xs: a.sizeXs,
19
+ sm: a.sizeSm,
20
+ md: a.sizeMd,
21
+ lg: a.sizeLg,
22
+ xl: a.sizeXl
23
+ }, ae = {
18
24
  title: "Select Date",
19
25
  placeholder: "Select Date",
20
26
  value: null,
21
- disabled: !1
27
+ disabled: !1,
28
+ invalid: !1,
29
+ closeOnBackdrop: !1,
30
+ size: "md"
22
31
  };
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();
32
+ function me(c) {
33
+ const [n] = X(K(ae, c), ["value", "onValueChange", "onConfirm", "onCancel", "min", "max", "title", "placeholder", "size", "disabled", "invalid", "closeOnBackdrop", "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(), [z, p] = h(!1), [d, $] = h(l.getFullYear()), [v, F] = h(l.getMonth()), [f, b] = h(l.getDate()), O = S(() => M(d(), v()));
34
+ _(() => {
35
+ const e = O();
27
36
  f() > e && b(e);
28
- }), L(() => {
29
- if (!$()) return;
37
+ }), _(() => {
38
+ if (!z()) return;
30
39
  const e = (r) => {
31
- r.key === "Escape" && y();
40
+ r.key === "Escape" && k();
32
41
  };
33
- document.addEventListener("keydown", e), q(() => document.removeEventListener("keydown", e));
42
+ document.addEventListener("keydown", e), j(() => document.removeEventListener("keydown", e));
34
43
  });
35
- const B = k(() => {
36
- const e = u();
44
+ const T = S(() => {
45
+ const e = d();
37
46
  return [{
38
47
  flex: 1.1,
39
48
  items: Array.from({
@@ -44,7 +53,7 @@ function ge(s) {
44
53
  }))
45
54
  }, {
46
55
  circular: !0,
47
- items: V.map((r, t) => ({
56
+ items: L.map((r, t) => ({
48
57
  label: r,
49
58
  value: t,
50
59
  disabled: e === m && t < w.getMonth() || e === Y && t > x.getMonth()
@@ -53,66 +62,69 @@ function ge(s) {
53
62
  flex: 0.9,
54
63
  circular: !0,
55
64
  items: Array.from({
56
- length: E()
65
+ length: O()
57
66
  }, (r, t) => ({
58
67
  label: String(t + 1).padStart(2, "0"),
59
68
  value: t + 1
60
69
  }))
61
70
  }];
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", {
71
+ }), V = () => [d(), v(), f()], N = ([e, r, t]) => {
72
+ $(e), F(r), b(ne(t, 1, M(e, r)));
73
+ }, J = S(() => new Date(d(), v(), f()).toLocaleDateString("en-US", {
65
74
  weekday: "long"
66
- })), I = () => {
75
+ })), H = () => {
67
76
  const e = n.value;
68
- return e ? `${V[e.getMonth()]} ${e.getDate()}, ${e.getFullYear()}` : n.placeholder;
77
+ return e ? `${L[e.getMonth()]} ${e.getDate()}, ${e.getFullYear()}` : n.placeholder;
69
78
  };
70
- function R() {
79
+ function I() {
71
80
  if (n.disabled) return;
72
81
  const e = n.value || l;
73
- F(e.getFullYear()), P(e.getMonth()), b(Math.min(e.getDate(), C(e.getFullYear(), e.getMonth()))), p(!0);
82
+ $(e.getFullYear()), F(e.getMonth()), b(Math.min(e.getDate(), M(e.getFullYear(), e.getMonth()))), p(!0);
74
83
  }
75
- function U() {
84
+ function R() {
76
85
  var r, t;
77
- const e = new Date(u(), v(), f());
86
+ const e = new Date(d(), v(), f());
78
87
  (r = n.onValueChange) == null || r.call(n, e), (t = n.onConfirm) == null || t.call(n, e), p(!1);
79
88
  }
80
- function y() {
89
+ function k() {
81
90
  var e;
82
91
  (e = n.onCancel) == null || e.call(n), p(!1);
83
92
  }
84
93
  return [(() => {
85
94
  var e = Z(), r = e.firstChild;
86
- return e.$$click = R, g(r, I), g(e, D(G, {
95
+ return e.$$click = I, g(r, H), g(e, y(q, {
87
96
  get class() {
88
- return o.triggerIcon;
97
+ return a.triggerIcon;
89
98
  },
90
99
  size: 18,
91
100
  "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;
101
+ }), null), D((t) => {
102
+ var i = A(W("balik-date-picker-trigger", n.size), a.trigger, re[n.size], n.disabled && a.triggerDisabled, n.invalid && a.invalid, n.class), o = n.disabled, u = A(a.triggerText, !n.value && a.triggerPlaceholder);
103
+ return i !== t.e && s(e, t.e = i), o !== t.t && (e.disabled = t.t = o), u !== t.a && s(r, t.a = u), t;
95
104
  }, {
96
105
  e: void 0,
97
106
  t: void 0,
98
107
  a: void 0
99
108
  }), e;
100
- })(), D(Q, {
109
+ })(), y(G, {
101
110
  get open() {
102
- return $();
111
+ return z();
103
112
  },
104
113
  get class() {
105
- return o.sheet;
114
+ return a.sheet;
115
+ },
116
+ get dismissible() {
117
+ return n.closeOnBackdrop;
106
118
  },
107
119
  onOpenChange: (e) => {
108
- e.open || y();
120
+ e.open || k();
109
121
  },
110
122
  get children() {
111
123
  return [(() => {
112
124
  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;
125
+ return r.$$click = k, g(t, () => n.title), i.$$click = R, D((o) => {
126
+ var u = a.header, P = a.headerButton, B = a.headerTitle, E = a.headerButton;
127
+ return u !== o.e && s(e, o.e = u), P !== o.t && s(r, o.t = P), B !== o.a && s(t, o.a = B), E !== o.o && s(i, o.o = E), o;
116
128
  }, {
117
129
  e: void 0,
118
130
  t: void 0,
@@ -121,20 +133,20 @@ function ge(s) {
121
133
  }), e;
122
134
  })(), (() => {
123
135
  var e = te(), r = e.firstChild;
124
- return g(e, D(W, {
136
+ return g(e, y(Q, {
125
137
  get class() {
126
- return o.columns;
138
+ return a.columns;
127
139
  },
128
140
  get columns() {
129
- return B();
141
+ return T();
130
142
  },
131
143
  get value() {
132
- return N();
144
+ return V();
133
145
  },
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;
146
+ onValueChange: N
147
+ }), r), g(r, J), D((t) => {
148
+ var i = a.pickerBody, o = a.weekday;
149
+ return i !== t.e && s(e, t.e = i), o !== t.t && s(r, t.t = o), t;
138
150
  }, {
139
151
  e: void 0,
140
152
  t: void 0
@@ -143,7 +155,7 @@ function ge(s) {
143
155
  }
144
156
  })];
145
157
  }
146
- z(["click"]);
158
+ U(["click"]);
147
159
  export {
148
- ge as DatePicker
160
+ me as DatePicker
149
161
  };