saha-ui 1.22.8 → 1.22.10
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 -1
- package/dist/components/Calendar/Calendar.styles.d.ts.map +1 -1
- package/dist/components/Calendar/Calendar.styles.js +11 -5
- package/dist/components/Calendar/index.d.ts.map +1 -1
- package/dist/components/Calendar/index.js +39 -37
- package/dist/components/Combobox/Combobox.d.ts.map +1 -1
- package/dist/components/Combobox/Combobox.js +519 -482
- package/dist/components/Dropdown/Dropdown.types.d.ts +2 -5
- package/dist/components/Dropdown/Dropdown.types.d.ts.map +1 -1
- package/dist/components/Dropdown/index.d.ts.map +1 -1
- package/dist/components/Dropdown/index.js +369 -332
- package/dist/components/Link/index.js +8 -8
- package/dist/components/Select/index.d.ts +1 -5
- package/dist/components/Select/index.d.ts.map +1 -1
- package/dist/components/Select/index.js +486 -358
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +396 -389
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -350,7 +350,7 @@ We welcome contributions from the community! Whether it's:
|
|
|
350
350
|
|
|
351
351
|
<div align="center">
|
|
352
352
|
|
|
353
|
-
**MIT License** ©
|
|
353
|
+
**MIT License** ©2025 [Saha UI](https://saha-ui.isubroto.com.bd)
|
|
354
354
|
|
|
355
355
|
Free to use for personal and commercial projects
|
|
356
356
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Calendar.styles.d.ts","sourceRoot":"","sources":["../../../src/components/Calendar/Calendar.styles.ts"],"names":[],"mappings":"AACA;;GAEG;AACH,QAAA,MAAM,gBAAgB;;;;;;
|
|
1
|
+
{"version":3,"file":"Calendar.styles.d.ts","sourceRoot":"","sources":["../../../src/components/Calendar/Calendar.styles.ts"],"names":[],"mappings":"AACA;;GAEG;AACH,QAAA,MAAM,gBAAgB;;;;;;8EAuGrB,CAAC;AAEF;;GAEG;AACH,QAAA,MAAM,WAAW;;;;8EAwXhB,CAAC;AACF,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,CAAC"}
|
|
@@ -13,13 +13,15 @@ const o = e(
|
|
|
13
13
|
"border border-border/30 backdrop-blur-sm",
|
|
14
14
|
"before:absolute before:inset-0 before:bg-gradient-to-br",
|
|
15
15
|
"before:from-primary/5 before:via-transparent before:to-accent/5",
|
|
16
|
-
"before:opacity-50 before:transition-opacity before:duration-500"
|
|
16
|
+
"before:opacity-50 before:transition-opacity before:duration-500",
|
|
17
|
+
"before:pointer-events-none"
|
|
17
18
|
],
|
|
18
19
|
bordered: [
|
|
19
20
|
"bg-card/90 shadow-sm backdrop-blur-sm",
|
|
20
21
|
"before:absolute before:inset-0 before:bg-gradient-to-br",
|
|
21
22
|
"before:from-primary/3 before:to-accent/3",
|
|
22
|
-
"before:opacity-50 before:transition-opacity before:duration-500"
|
|
23
|
+
"before:opacity-50 before:transition-opacity before:duration-500",
|
|
24
|
+
"before:pointer-events-none"
|
|
23
25
|
],
|
|
24
26
|
glass: [
|
|
25
27
|
"glass backdrop-blur-2xl",
|
|
@@ -27,7 +29,8 @@ const o = e(
|
|
|
27
29
|
"shadow-[0_8px_32px_0] shadow-black/10 dark:shadow-black/30",
|
|
28
30
|
"before:absolute before:inset-0 before:bg-gradient-to-br",
|
|
29
31
|
"before:from-white/5 before:to-transparent",
|
|
30
|
-
"before:opacity-70 before:transition-opacity before:duration-500"
|
|
32
|
+
"before:opacity-70 before:transition-opacity before:duration-500",
|
|
33
|
+
"before:pointer-events-none"
|
|
31
34
|
],
|
|
32
35
|
"glass-strong": [
|
|
33
36
|
"glass-strong backdrop-blur-3xl",
|
|
@@ -35,7 +38,8 @@ const o = e(
|
|
|
35
38
|
"shadow-[0_12px_48px_0] shadow-black/15 dark:shadow-black/40",
|
|
36
39
|
"before:absolute before:inset-0 before:bg-gradient-to-br",
|
|
37
40
|
"before:from-white/10 before:to-transparent",
|
|
38
|
-
"before:opacity-80 before:transition-opacity before:duration-500"
|
|
41
|
+
"before:opacity-80 before:transition-opacity before:duration-500",
|
|
42
|
+
"before:pointer-events-none"
|
|
39
43
|
],
|
|
40
44
|
gradient: [
|
|
41
45
|
"bg-gradient-to-br from-primary/20 via-background to-accent/20",
|
|
@@ -43,7 +47,9 @@ const o = e(
|
|
|
43
47
|
"before:absolute before:inset-0 before:-z-10",
|
|
44
48
|
"before:bg-gradient-to-r before:from-primary before:via-accent before:to-secondary",
|
|
45
49
|
"before:opacity-50 before:blur-xl",
|
|
46
|
-
"
|
|
50
|
+
"before:pointer-events-none",
|
|
51
|
+
"after:absolute after:inset-[2px] after:bg-background/95 after:rounded-[inherit]",
|
|
52
|
+
"after:pointer-events-none"
|
|
47
53
|
]
|
|
48
54
|
},
|
|
49
55
|
color: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Calendar/index.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,aAAa,EAAc,MAAM,kBAAkB,CAAC;AAqClE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,QAAA,MAAM,QAAQ,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Calendar/index.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,aAAa,EAAc,MAAM,kBAAkB,CAAC;AAqClE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,QAAA,MAAM,QAAQ,0GAupBZ,CAAC;AAIH,eAAe,QAAQ,CAAC"}
|
|
@@ -6,16 +6,16 @@ import { calendarVariants as pe, dayVariants as Ce } from "./Calendar.styles.js"
|
|
|
6
6
|
const u = (n, s) => n.getDate() === s.getDate() && n.getMonth() === s.getMonth() && n.getFullYear() === s.getFullYear(), we = (n, s) => n.getMonth() === s.getMonth() && n.getFullYear() === s.getFullYear(), Z = (n, s) => new Date(n, s + 1, 0).getDate(), xe = (n, s) => new Date(n, s, 1).getDay(), Me = (n, s) => !s || !s.to ? !1 : n >= s.from && n <= s.to, Ne = be((n, s) => {
|
|
7
7
|
const {
|
|
8
8
|
variant: $ = "default",
|
|
9
|
-
color:
|
|
9
|
+
color: P = "primary",
|
|
10
10
|
bordered: ee = !1,
|
|
11
11
|
rounded: ne = "lg",
|
|
12
|
-
size:
|
|
12
|
+
size: V = "md",
|
|
13
13
|
weekdayFormat: B = "short",
|
|
14
|
-
firstDayOfWeek:
|
|
14
|
+
firstDayOfWeek: j = 0,
|
|
15
15
|
minDate: h,
|
|
16
16
|
maxDate: f,
|
|
17
|
-
disabledDates:
|
|
18
|
-
isDateDisabled:
|
|
17
|
+
disabledDates: S = [],
|
|
18
|
+
isDateDisabled: z,
|
|
19
19
|
showWeekNumbers: te = !1,
|
|
20
20
|
showTodayButton: E = !0,
|
|
21
21
|
showClearButton: W = !0,
|
|
@@ -59,7 +59,7 @@ const u = (n, s) => n.getDate() === s.getDate() && n.getMonth() === s.getMonth()
|
|
|
59
59
|
"Warning: 'range.to' should not be before 'range.from'. The dates will be auto-corrected."
|
|
60
60
|
))), e.validateDate("minDate", h), e.validateDate("maxDate", f), h && f && b(h) && b(f) && f < h && e.error(
|
|
61
61
|
"Invalid prop: 'maxDate' should not be before 'minDate'."
|
|
62
|
-
), e.validateArray("disabledDates",
|
|
62
|
+
), e.validateArray("disabledDates", S, b), e.validateDate("currentMonth", w);
|
|
63
63
|
}
|
|
64
64
|
}, [
|
|
65
65
|
i,
|
|
@@ -68,61 +68,61 @@ const u = (n, s) => n.getDate() === s.getDate() && n.getMonth() === s.getMonth()
|
|
|
68
68
|
r,
|
|
69
69
|
h,
|
|
70
70
|
f,
|
|
71
|
-
|
|
71
|
+
S,
|
|
72
72
|
w,
|
|
73
73
|
n
|
|
74
74
|
]);
|
|
75
|
-
const [c,
|
|
75
|
+
const [c, Y] = Q(
|
|
76
76
|
w || m || /* @__PURE__ */ new Date()
|
|
77
|
-
), [I,
|
|
77
|
+
), [I, A] = Q(null);
|
|
78
78
|
K(() => {
|
|
79
|
-
w &&
|
|
79
|
+
w && Y(w);
|
|
80
80
|
}, [w]);
|
|
81
81
|
const se = X(() => {
|
|
82
82
|
const e = [], t = new Date(2024, 0, 7);
|
|
83
83
|
for (let a = 0; a < 7; a++) {
|
|
84
84
|
const d = new Date(t);
|
|
85
|
-
d.setDate(t.getDate() + (a +
|
|
85
|
+
d.setDate(t.getDate() + (a + j) % 7);
|
|
86
86
|
const g = new Intl.DateTimeFormat(D, {
|
|
87
87
|
weekday: B
|
|
88
88
|
}).format(d);
|
|
89
89
|
e.push(g);
|
|
90
90
|
}
|
|
91
91
|
return e;
|
|
92
|
-
}, [D, B,
|
|
93
|
-
const e = c.getFullYear(), t = c.getMonth(), a = Z(e, t), d = xe(e, t), g = [], M = (d -
|
|
92
|
+
}, [D, B, j]), de = X(() => {
|
|
93
|
+
const e = c.getFullYear(), t = c.getMonth(), a = Z(e, t), d = xe(e, t), g = [], M = (d - j + 7) % 7, F = Z(
|
|
94
94
|
t === 0 ? e - 1 : e,
|
|
95
95
|
t === 0 ? 11 : t - 1
|
|
96
96
|
);
|
|
97
97
|
for (let l = M - 1; l >= 0; l--) {
|
|
98
|
-
const
|
|
98
|
+
const R = new Date(
|
|
99
99
|
t === 0 ? e - 1 : e,
|
|
100
100
|
t === 0 ? 11 : t - 1,
|
|
101
|
-
|
|
101
|
+
F - l
|
|
102
102
|
);
|
|
103
|
-
g.push(
|
|
103
|
+
g.push(R);
|
|
104
104
|
}
|
|
105
105
|
for (let l = 1; l <= a; l++)
|
|
106
106
|
g.push(new Date(e, t, l));
|
|
107
107
|
const T = 42 - g.length;
|
|
108
108
|
for (let l = 1; l <= T; l++) {
|
|
109
|
-
const
|
|
109
|
+
const R = new Date(
|
|
110
110
|
t === 11 ? e + 1 : e,
|
|
111
111
|
t === 11 ? 0 : t + 1,
|
|
112
112
|
l
|
|
113
113
|
);
|
|
114
|
-
g.push(
|
|
114
|
+
g.push(R);
|
|
115
115
|
}
|
|
116
116
|
return g;
|
|
117
|
-
}, [c,
|
|
118
|
-
(e) => !!(
|
|
119
|
-
[h, f,
|
|
117
|
+
}, [c, j]), L = y(
|
|
118
|
+
(e) => !!(z && z(e) || h && e < h || f && e > f || S.some((t) => u(t, e))),
|
|
119
|
+
[h, f, S, z]
|
|
120
120
|
), ce = y(
|
|
121
121
|
(e) => i === "single" && m ? u(e, m) : i === "multiple" && v ? v.some((t) => u(t, e)) : i === "range" && r ? r.to ? u(e, r.from) || u(e, r.to) : u(e, r.from) : !1,
|
|
122
122
|
[i, m, v, r]
|
|
123
123
|
), ue = y(
|
|
124
124
|
(e) => {
|
|
125
|
-
if (!
|
|
125
|
+
if (!L(e))
|
|
126
126
|
if (i === "single")
|
|
127
127
|
p?.(u(e, m) ? void 0 : e);
|
|
128
128
|
else if (i === "multiple") {
|
|
@@ -138,36 +138,38 @@ const u = (n, s) => n.getDate() === s.getDate() && n.getMonth() === s.getMonth()
|
|
|
138
138
|
p,
|
|
139
139
|
k,
|
|
140
140
|
C,
|
|
141
|
-
|
|
141
|
+
L
|
|
142
142
|
]
|
|
143
143
|
), q = y(
|
|
144
144
|
(e) => {
|
|
145
145
|
const t = new Date(c);
|
|
146
|
-
e === "prev" ? t.setMonth(t.getMonth() - 1) : t.setMonth(t.getMonth() + 1),
|
|
146
|
+
e === "prev" ? t.setMonth(t.getMonth() - 1) : t.setMonth(t.getMonth() + 1), Y(t), x?.(t);
|
|
147
147
|
},
|
|
148
148
|
[c, x]
|
|
149
149
|
), me = y(() => {
|
|
150
150
|
const e = /* @__PURE__ */ new Date();
|
|
151
|
-
|
|
151
|
+
Y(e), x?.(e), i === "single" && p?.(e);
|
|
152
152
|
}, [i, p, x]), ge = y(() => {
|
|
153
153
|
i === "single" ? p?.(void 0) : i === "multiple" ? k?.([]) : i === "range" && C?.(void 0);
|
|
154
154
|
}, [i, p, k, C]), G = y(
|
|
155
155
|
(e, t) => {
|
|
156
156
|
const a = new Date(c);
|
|
157
|
-
e === "month" ? a.setMonth(t) : a.setFullYear(t),
|
|
157
|
+
e === "month" ? a.setMonth(t) : a.setFullYear(t), Y(a), x?.(a), A(null);
|
|
158
158
|
},
|
|
159
159
|
[c, x]
|
|
160
160
|
), he = (e, t) => {
|
|
161
161
|
if (!e) return /* @__PURE__ */ o("div", { className: "h-10 w-10" }, t);
|
|
162
|
-
const d = u(e, /* @__PURE__ */ new Date()), g = ce(e), M =
|
|
162
|
+
const d = u(e, /* @__PURE__ */ new Date()), g = ce(e), M = L(e), F = !we(e, c), T = i === "range" ? Me(e, r) : !1;
|
|
163
|
+
if (F)
|
|
164
|
+
return /* @__PURE__ */ o("div", { className: "h-10 w-10" }, t);
|
|
163
165
|
let l = "default";
|
|
164
166
|
if (M)
|
|
165
167
|
l = "disabled";
|
|
166
168
|
else if (i === "range" && r?.from) {
|
|
167
169
|
const H = u(e, r.from), J = r.to && u(e, r.to);
|
|
168
|
-
H && J ? l = "rangeBoth" : H ? l = "rangeStart" : J ? l = "rangeEnd" : T ? l = "inRange" : d ? l = "today" :
|
|
169
|
-
} else g ? l = "selected" : d ? l = "today" :
|
|
170
|
-
const
|
|
170
|
+
H && J ? l = "rangeBoth" : H ? l = "rangeStart" : J ? l = "rangeEnd" : T ? l = "inRange" : d ? l = "today" : F && (l = "outside");
|
|
171
|
+
} else g ? l = "selected" : d ? l = "today" : F && (l = "outside");
|
|
172
|
+
const R = O ? O(e, g, d, M, T) : e.getDate();
|
|
171
173
|
return /* @__PURE__ */ o(
|
|
172
174
|
"button",
|
|
173
175
|
{
|
|
@@ -175,14 +177,14 @@ const u = (n, s) => n.getDate() === s.getDate() && n.getMonth() === s.getMonth()
|
|
|
175
177
|
onClick: () => ue(e),
|
|
176
178
|
disabled: M,
|
|
177
179
|
className: U(
|
|
178
|
-
Ce({ size:
|
|
180
|
+
Ce({ size: V, state: l, color: P }),
|
|
179
181
|
le,
|
|
180
182
|
oe && "hover:scale-110"
|
|
181
183
|
),
|
|
182
184
|
"aria-label": e.toLocaleDateString(D),
|
|
183
185
|
"aria-selected": g,
|
|
184
186
|
"aria-disabled": M,
|
|
185
|
-
children: /* @__PURE__ */ o("span", { className: "relative z-10", children:
|
|
187
|
+
children: /* @__PURE__ */ o("span", { className: "relative z-10", children: R })
|
|
186
188
|
},
|
|
187
189
|
t
|
|
188
190
|
);
|
|
@@ -191,7 +193,7 @@ const u = (n, s) => n.getDate() === s.getDate() && n.getMonth() === s.getMonth()
|
|
|
191
193
|
const d = new Date(c.getFullYear(), a, 1);
|
|
192
194
|
return new Intl.DateTimeFormat(D, { month: "long" }).format(d);
|
|
193
195
|
});
|
|
194
|
-
return /* @__PURE__ */ o("div", { className: "grid grid-cols-3 gap-2 p-4", children: e.map((t, a) => /* @__PURE__ */ o(
|
|
196
|
+
return /* @__PURE__ */ o("div", { className: "relative z-10 grid grid-cols-3 gap-2 p-4", children: e.map((t, a) => /* @__PURE__ */ o(
|
|
195
197
|
"button",
|
|
196
198
|
{
|
|
197
199
|
type: "button",
|
|
@@ -207,7 +209,7 @@ const u = (n, s) => n.getDate() === s.getDate() && n.getMonth() === s.getMonth()
|
|
|
207
209
|
)) });
|
|
208
210
|
}, ve = () => {
|
|
209
211
|
const e = c.getFullYear(), t = Array.from({ length: 12 }, (a, d) => e - 5 + d);
|
|
210
|
-
return /* @__PURE__ */ o("div", { className: "grid grid-cols-3 gap-2 p-4", children: t.map((a) => /* @__PURE__ */ o(
|
|
212
|
+
return /* @__PURE__ */ o("div", { className: "relative z-10 grid grid-cols-3 gap-2 p-4", children: t.map((a) => /* @__PURE__ */ o(
|
|
211
213
|
"button",
|
|
212
214
|
{
|
|
213
215
|
type: "button",
|
|
@@ -227,7 +229,7 @@ const u = (n, s) => n.getDate() === s.getDate() && n.getMonth() === s.getMonth()
|
|
|
227
229
|
{
|
|
228
230
|
ref: s,
|
|
229
231
|
className: U(
|
|
230
|
-
pe({ variant: $, color:
|
|
232
|
+
pe({ variant: $, color: P, bordered: ee, size: V, rounded: ne }),
|
|
231
233
|
ie
|
|
232
234
|
),
|
|
233
235
|
role: "application",
|
|
@@ -266,7 +268,7 @@ const u = (n, s) => n.getDate() === s.getDate() && n.getMonth() === s.getMonth()
|
|
|
266
268
|
"button",
|
|
267
269
|
{
|
|
268
270
|
type: "button",
|
|
269
|
-
onClick: () =>
|
|
271
|
+
onClick: () => A(I === "month" ? null : "month"),
|
|
270
272
|
className: "px-3 py-1.5 rounded-lg font-semibold hover:bg-primary/10 hover:text-primary transition-all",
|
|
271
273
|
children: new Intl.DateTimeFormat(D, {
|
|
272
274
|
month: "long"
|
|
@@ -277,7 +279,7 @@ const u = (n, s) => n.getDate() === s.getDate() && n.getMonth() === s.getMonth()
|
|
|
277
279
|
"button",
|
|
278
280
|
{
|
|
279
281
|
type: "button",
|
|
280
|
-
onClick: () =>
|
|
282
|
+
onClick: () => A(I === "year" ? null : "year"),
|
|
281
283
|
className: "px-3 py-1.5 rounded-lg font-semibold hover:bg-primary/10 hover:text-primary transition-all",
|
|
282
284
|
children: c.getFullYear()
|
|
283
285
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Combobox.d.ts","sourceRoot":"","sources":["../../../src/components/Combobox/Combobox.tsx"],"names":[],"mappings":"AAEA,OAAO,KASN,MAAM,OAAO,CAAC;AAIf,OAAO,KAAK,EACV,aAAa,EACb,oBAAoB,EACpB,oBAAoB,EACpB,mBAAmB,EACnB,kBAAkB,EAClB,oBAAoB,EACpB,kBAAkB,EAClB,iBAAiB,EACjB,sBAAsB,EACtB,mBAAmB,EAKpB,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"Combobox.d.ts","sourceRoot":"","sources":["../../../src/components/Combobox/Combobox.tsx"],"names":[],"mappings":"AAEA,OAAO,KASN,MAAM,OAAO,CAAC;AAIf,OAAO,KAAK,EACV,aAAa,EACb,oBAAoB,EACpB,oBAAoB,EACpB,mBAAmB,EACnB,kBAAkB,EAClB,oBAAoB,EACpB,kBAAkB,EAClB,iBAAiB,EACjB,sBAAsB,EACtB,mBAAmB,EAKpB,MAAM,kBAAkB,CAAC;AAgI1B;;GAEG;AACH,eAAO,MAAM,QAAQ,sFA4rBpB,CAAC;AA4FF;;GAEG;AACH,eAAO,MAAM,eAAe,6FAc3B,CAAC;AAIF;;;GAGG;AACH,eAAO,MAAM,aAAa;kBAER,MAAM;gBAAc,MAAM;yCAyB1C,CAAC;AAIH;;GAEG;AACH,eAAO,MAAM,eAAe,6FAmG3B,CAAC;AAIF;;GAEG;AACH,eAAO,MAAM,cAAc,8FAkB1B,CAAC;AAIF;;GAEG;AACH,eAAO,MAAM,YAAY,0FA0GxB,CAAC;AAIF;;GAEG;AACH,eAAO,MAAM,aAAa,2FAazB,CAAC;AAIF;;GAEG;AACH,eAAO,MAAM,aAAa,2FAkBzB,CAAC;AAIF;;GAEG;AACH,eAAO,MAAM,eAAe,6FAkB3B,CAAC;AAIF;;GAEG;AACH,eAAO,MAAM,iBAAiB,+FAK5B,CAAC;AAIH;;GAEG;AACH,eAAO,MAAM,cAAc,+FAuBzB,CAAC;AAIH,eAAe,QAAQ,CAAC"}
|