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.
@@ -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,4EAQhB,WAAW,4CA4Cb,CAAC"}
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 y } from "react";
2
+ import { useState as g } from "react";
3
3
  import { classNames as n } from "../../utils/class-names.js";
4
- import { getRatingStyles as g } from "./Rating.utils.js";
4
+ import { getRatingStyles as j } from "./Rating.utils.js";
5
5
  import { SolidSystemStar as a } from "../../icons/components/SolidSystemStar.js";
6
- import { OutlineSystemStar as j } from "../../icons/components/OutlineSystemStar.js";
7
- const M = "_root_dej42_1", N = "_stars_dej42_23", x = "_star_dej42_23", E = "_filled_dej42_54", s = {
8
- root: M,
9
- stars: N,
10
- star: x,
11
- filled: E
12
- }, C = ({
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] = y(null), p = Array.from({ length: 5 }, (t, o) => o + 1), S = (t) => l(t), h = () => l(null), v = (t) => t ? _ || /* @__PURE__ */ e(a, {}) : f || (d === "solid" ? /* @__PURE__ */ e(a, {}) : /* @__PURE__ */ e(j, {}));
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: g(i),
27
- children: /* @__PURE__ */ e("div", { className: s.stars, children: p.map((t) => {
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: () => S(t),
36
- onMouseLeave: h,
37
- children: v(o)
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
- C as Rating
47
+ F as Rating
47
48
  };
@@ -33,5 +33,9 @@ export interface RatingProps {
33
33
  * Custom icons for different states of the stars
34
34
  */
35
35
  defaultIcon?: ReactNode;
36
+ /**
37
+ * Custom maximum rating value. Default is 5.
38
+ */
39
+ max?: number;
36
40
  }
37
41
  //# sourceMappingURL=Rating.types.d.ts.map
@@ -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;CACxB"}
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;AA4BvE,eAAO,MAAM,YAAY,qDAKtB,iBAAiB,4CAkCnB,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 i, useState as g } from "react";
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 r = (o, s, a) => {
6
- const e = `alif-${o}`, [t, n] = g(
7
- p(e, s)
8
- );
9
- return i(() => {
10
- localStorage.setItem(e, t);
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: o,
16
- initialMode: s,
17
- initialLocale: a,
18
- brand: e = "alif"
12
+ children: e,
13
+ initialMode: n,
14
+ initialLocale: o,
15
+ brand: t = "alif"
19
16
  }) => {
20
- const [t, n] = r(
17
+ const [s, a] = l(
21
18
  "theme",
22
- s || "system",
19
+ n || "system",
23
20
  A
24
- ), [l, c] = r(
21
+ ), [i, c] = l(
25
22
  "locale",
26
- a || h()
23
+ o || h()
27
24
  );
28
- return i(() => {
29
- document.documentElement.setAttribute("data-brand", e);
30
- }, [e]), /* @__PURE__ */ u(f, { value: { mode: t, toggleMode: () => {
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
- n((d) => d === "light" ? "dark" : "light"), m.classList.add("themeChanging"), requestAnimationFrame(() => {
29
+ a((d) => d === "light" ? "dark" : "light"), m.classList.add("themeChanging"), requestAnimationFrame(() => {
33
30
  m.classList.remove("themeChanging");
34
31
  });
35
- }, locale: l, setLocale: c }, children: o });
32
+ }, locale: i, setLocale: c }, children: e });
36
33
  };
37
34
  export {
38
35
  x as AlifProvider
package/package.json CHANGED
@@ -21,7 +21,7 @@
21
21
  },
22
22
  "license": "ISC",
23
23
  "private": false,
24
- "version": "1.14.2",
24
+ "version": "1.15.0",
25
25
  "type": "module",
26
26
  "files": [
27
27
  "dist"