alif-ui 1.14.2 → 1.15.0
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/dist/components/Rating/Rating.d.ts +1 -1
- package/dist/components/Rating/Rating.d.ts.map +1 -1
- package/dist/components/Rating/Rating.js +18 -17
- package/dist/components/Rating/Rating.types.d.ts +4 -0
- package/dist/components/Rating/Rating.types.d.ts.map +1 -1
- package/dist/providers/AlifProvider/AlifProvider.d.ts.map +1 -1
- package/dist/providers/AlifProvider/AlifProvider.js +20 -23
- package/package.json +1 -1
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { RatingProps } from './Rating.types';
|
|
2
|
-
export declare const Rating: ({ size, variant, value, onChange, className, filledIcon, defaultIcon, }: RatingProps) => import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export declare const Rating: ({ size, variant, value, onChange, className, filledIcon, defaultIcon, max, }: RatingProps) => import("react/jsx-runtime").JSX.Element;
|
|
3
3
|
//# sourceMappingURL=Rating.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Rating.d.ts","sourceRoot":"","sources":["../../../src/lib/components/Rating/Rating.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,eAAO,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"Rating.d.ts","sourceRoot":"","sources":["../../../src/lib/components/Rating/Rating.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,eAAO,MAAM,MAAM,iFAShB,WAAW,4CA4Cb,CAAC"}
|
|
@@ -1,30 +1,31 @@
|
|
|
1
1
|
import { jsx as e } from "react/jsx-runtime";
|
|
2
|
-
import { useState as
|
|
2
|
+
import { useState as g } from "react";
|
|
3
3
|
import { classNames as n } from "../../utils/class-names.js";
|
|
4
|
-
import { getRatingStyles as
|
|
4
|
+
import { getRatingStyles as j } from "./Rating.utils.js";
|
|
5
5
|
import { SolidSystemStar as a } from "../../icons/components/SolidSystemStar.js";
|
|
6
|
-
import { OutlineSystemStar as
|
|
7
|
-
const
|
|
8
|
-
root:
|
|
9
|
-
stars:
|
|
10
|
-
star:
|
|
11
|
-
filled:
|
|
12
|
-
},
|
|
6
|
+
import { OutlineSystemStar as M } from "../../icons/components/OutlineSystemStar.js";
|
|
7
|
+
const N = "_root_dej42_1", x = "_stars_dej42_23", E = "_star_dej42_23", L = "_filled_dej42_54", s = {
|
|
8
|
+
root: N,
|
|
9
|
+
stars: x,
|
|
10
|
+
star: E,
|
|
11
|
+
filled: L
|
|
12
|
+
}, F = ({
|
|
13
13
|
size: i = "s",
|
|
14
14
|
variant: d = "solid",
|
|
15
15
|
value: c,
|
|
16
16
|
onChange: m,
|
|
17
17
|
className: u,
|
|
18
18
|
filledIcon: _,
|
|
19
|
-
defaultIcon: f
|
|
19
|
+
defaultIcon: f,
|
|
20
|
+
max: p = 5
|
|
20
21
|
}) => {
|
|
21
|
-
const [r, l] =
|
|
22
|
+
const [r, l] = g(null), S = Array.from({ length: p }, (t, o) => o + 1), h = (t) => l(t), v = () => l(null), y = (t) => t ? _ || /* @__PURE__ */ e(a, {}) : f || (d === "solid" ? /* @__PURE__ */ e(a, {}) : /* @__PURE__ */ e(M, {}));
|
|
22
23
|
return /* @__PURE__ */ e(
|
|
23
24
|
"div",
|
|
24
25
|
{
|
|
25
26
|
className: n(s.root, u),
|
|
26
|
-
style:
|
|
27
|
-
children: /* @__PURE__ */ e("div", { className: s.stars, children:
|
|
27
|
+
style: j(i),
|
|
28
|
+
children: /* @__PURE__ */ e("div", { className: s.stars, children: S.map((t) => {
|
|
28
29
|
const o = r !== null ? t <= r : t <= c;
|
|
29
30
|
return /* @__PURE__ */ e(
|
|
30
31
|
"div",
|
|
@@ -32,9 +33,9 @@ const M = "_root_dej42_1", N = "_stars_dej42_23", x = "_star_dej42_23", E = "_fi
|
|
|
32
33
|
role: "button",
|
|
33
34
|
className: n(s.star, o && s.filled),
|
|
34
35
|
onClick: () => m(t),
|
|
35
|
-
onMouseEnter: () =>
|
|
36
|
-
onMouseLeave:
|
|
37
|
-
children:
|
|
36
|
+
onMouseEnter: () => h(t),
|
|
37
|
+
onMouseLeave: v,
|
|
38
|
+
children: y(o)
|
|
38
39
|
},
|
|
39
40
|
t
|
|
40
41
|
);
|
|
@@ -43,5 +44,5 @@ const M = "_root_dej42_1", N = "_stars_dej42_23", x = "_star_dej42_23", E = "_fi
|
|
|
43
44
|
);
|
|
44
45
|
};
|
|
45
46
|
export {
|
|
46
|
-
|
|
47
|
+
F as Rating
|
|
47
48
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Rating.types.d.ts","sourceRoot":"","sources":["../../../src/lib/components/Rating/Rating.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,MAAM,MAAM,IAAI,GAAG,IAAI,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC;AAC1C,MAAM,MAAM,OAAO,GAAG,SAAS,GAAG,OAAO,CAAC;AAE1C,MAAM,WAAW,WAAW;IAC3B;;OAEG;IACH,IAAI,CAAC,EAAE,IAAI,CAAC;IAEZ;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;;OAGG;IACH,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAElC;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,UAAU,CAAC,EAAE,SAAS,CAAC;IAEvB;;OAEG;IACH,WAAW,CAAC,EAAE,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"Rating.types.d.ts","sourceRoot":"","sources":["../../../src/lib/components/Rating/Rating.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,MAAM,MAAM,IAAI,GAAG,IAAI,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC;AAC1C,MAAM,MAAM,OAAO,GAAG,SAAS,GAAG,OAAO,CAAC;AAE1C,MAAM,WAAW,WAAW;IAC3B;;OAEG;IACH,IAAI,CAAC,EAAE,IAAI,CAAC;IAEZ;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;;OAGG;IACH,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAElC;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,UAAU,CAAC,EAAE,SAAS,CAAC;IAEvB;;OAEG;IACH,WAAW,CAAC,EAAE,SAAS,CAAC;IAExB;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;CACb"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AlifProvider.d.ts","sourceRoot":"","sources":["../../../src/lib/providers/AlifProvider/AlifProvider.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAgB,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"AlifProvider.d.ts","sourceRoot":"","sources":["../../../src/lib/providers/AlifProvider/AlifProvider.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAgB,MAAM,sBAAsB,CAAC;AAwBvE,eAAO,MAAM,YAAY,qDAKtB,iBAAiB,4CAkCnB,CAAC"}
|
|
@@ -1,38 +1,35 @@
|
|
|
1
1
|
import { jsx as u } from "react/jsx-runtime";
|
|
2
|
-
import { useEffect as
|
|
2
|
+
import { useEffect as r, useState as g } from "react";
|
|
3
3
|
import { AlifProviderContext as f } from "./AlifProvider.context.js";
|
|
4
4
|
import { getDefaultLocale as h, getInitialValue as p, resolveMode as A } from "./AlifProvider.utils.js";
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const l = a ? a(t) : t;
|
|
12
|
-
document.documentElement.setAttribute(`data-${o}`, l);
|
|
13
|
-
}, [o, t, a, e]), [t, n];
|
|
5
|
+
const l = (e, n, o) => {
|
|
6
|
+
const [t, s] = g(p(e, n));
|
|
7
|
+
return r(() => {
|
|
8
|
+
const a = o ? o(t) : t;
|
|
9
|
+
localStorage.setItem(e, a), document.documentElement.setAttribute(`data-${e}`, a);
|
|
10
|
+
}, [e, t, o]), [t, s];
|
|
14
11
|
}, x = ({
|
|
15
|
-
children:
|
|
16
|
-
initialMode:
|
|
17
|
-
initialLocale:
|
|
18
|
-
brand:
|
|
12
|
+
children: e,
|
|
13
|
+
initialMode: n,
|
|
14
|
+
initialLocale: o,
|
|
15
|
+
brand: t = "alif"
|
|
19
16
|
}) => {
|
|
20
|
-
const [
|
|
17
|
+
const [s, a] = l(
|
|
21
18
|
"theme",
|
|
22
|
-
|
|
19
|
+
n || "system",
|
|
23
20
|
A
|
|
24
|
-
), [
|
|
21
|
+
), [i, c] = l(
|
|
25
22
|
"locale",
|
|
26
|
-
|
|
23
|
+
o || h()
|
|
27
24
|
);
|
|
28
|
-
return
|
|
29
|
-
document.documentElement.setAttribute("data-brand",
|
|
30
|
-
}, [
|
|
25
|
+
return r(() => {
|
|
26
|
+
document.documentElement.setAttribute("data-brand", t);
|
|
27
|
+
}, [t]), /* @__PURE__ */ u(f, { value: { mode: s, toggleMode: () => {
|
|
31
28
|
const m = document.documentElement;
|
|
32
|
-
|
|
29
|
+
a((d) => d === "light" ? "dark" : "light"), m.classList.add("themeChanging"), requestAnimationFrame(() => {
|
|
33
30
|
m.classList.remove("themeChanging");
|
|
34
31
|
});
|
|
35
|
-
}, locale:
|
|
32
|
+
}, locale: i, setLocale: c }, children: e });
|
|
36
33
|
};
|
|
37
34
|
export {
|
|
38
35
|
x as AlifProvider
|