xtreme-ui 0.0.83 → 0.0.85

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.
@@ -5,7 +5,7 @@ export declare enum EButtonSize {
5
5
  default = "default",
6
6
  large = "large"
7
7
  }
8
- interface BaseButton extends HTMLAttributes<HTMLButtonElement> {
8
+ export interface BaseButton extends HTMLAttributes<HTMLButtonElement> {
9
9
  className?: string;
10
10
  style?: CSSProperties;
11
11
  type?: keyof typeof EButtonTypes;
@@ -16,11 +16,11 @@ interface BaseButton extends HTMLAttributes<HTMLButtonElement> {
16
16
  iconPosition?: 'left' | 'right';
17
17
  onClick?: () => void;
18
18
  }
19
- interface ButtonWithLabel extends BaseButton {
19
+ export interface ButtonWithLabel extends BaseButton {
20
20
  label: string;
21
21
  icon?: string;
22
22
  }
23
- interface ButtonWithIconName extends BaseButton {
23
+ export interface ButtonWithIconName extends BaseButton {
24
24
  label?: string;
25
25
  icon: string;
26
26
  }
@@ -33,5 +33,4 @@ export declare enum EButtonTypes {
33
33
  link = "link",
34
34
  linkDanger = "linkDanger"
35
35
  }
36
- export {};
37
36
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/components/base/Button/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAEtD,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE1C,oBAAY,WAAW;IACtB,IAAI,SAAS;IACb,OAAO,YAAY;IACnB,KAAK,UAAU;CACf;AACD,UAAU,UAAW,SAAQ,cAAc,CAAC,iBAAiB,CAAC;IAC7D,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,IAAI,CAAC,EAAE,MAAM,OAAO,YAAY,CAAC;IACjC,IAAI,CAAC,EAAE,MAAM,OAAO,WAAW,CAAC;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C;IAClC,YAAY,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAChC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACrB;AAED,MAAM,WAAW,eAAgB,SAAQ,UAAU;IAClD,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,kBAAmB,SAAQ,UAAU;IACrD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;CACb;AAED,MAAM,MAAM,YAAY,GAAG,eAAe,GAAG,kBAAkB,CAAC;AAEhE,oBAAY,YAAY;IACvB,OAAO,YAAY;IACnB,aAAa,kBAAkB;IAC/B,SAAS,cAAc;IACvB,eAAe,oBAAoB;IACnC,IAAI,SAAS;IACb,UAAU,eAAe;CACzB"}
@@ -1,3 +1,3 @@
1
1
  import { TSchemeSwitchProps } from './types';
2
- export declare const SchemeSwitch: import('react').ForwardRefExoticComponent<TSchemeSwitchProps & import('react').RefAttributes<HTMLSpanElement>>;
2
+ export declare const SchemeSwitch: import('react').ForwardRefExoticComponent<TSchemeSwitchProps & import('react').RefAttributes<HTMLButtonElement>>;
3
3
  //# sourceMappingURL=SchemeSwitch.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"SchemeSwitch.d.ts","sourceRoot":"","sources":["../../../../src/components/layout/SchemeSwitch/SchemeSwitch.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAE7C,eAAO,MAAM,YAAY,gHAwBvB,CAAC"}
1
+ {"version":3,"file":"SchemeSwitch.d.ts","sourceRoot":"","sources":["../../../../src/components/layout/SchemeSwitch/SchemeSwitch.tsx"],"names":[],"mappings":"AAQA,OAAO,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAE7C,eAAO,MAAM,YAAY,kHAyBvB,CAAC"}
@@ -1,28 +1,29 @@
1
1
  "use client";
2
- import { jsx as d } from "react/jsx-runtime";
3
- import { forwardRef as p, useMemo as m } from "react";
4
- import { Button as S } from "../../base/Button/Button.js";
5
- import { useXTheme as y } from "../../context/useContext.js";
2
+ import { jsx as p } from "react/jsx-runtime";
3
+ import { forwardRef as S, useMemo as n } from "react";
4
+ import { Button as y } from "../../base/Button/Button.js";
5
+ import { useXTheme as T } from "../../context/useContext.js";
6
6
  import { THEME_SCHEME as o } from "../../../utils/constants/commons.js";
7
- const T = p((n) => {
8
- const { className: r, withLabel: c = !1, type: i = "secondary", size: s = "default", iconType: a = "solid" } = n, { themeScheme: e, setThemeScheme: h } = y(), f = m(() => o[(o.findIndex((t) => t.name === e) + 1) % o.length], [e]), l = m(() => {
7
+ const w = S((r, c) => {
8
+ const { className: i, withLabel: s = !1, type: a = "secondary", size: h = "default", iconType: f = "solid" } = r, { themeScheme: e, setThemeScheme: l } = T(), m = n(() => o[(o.findIndex((t) => t.name === e) + 1) % o.length], [e]), u = n(() => {
9
9
  var t;
10
- return ((t = o.find((u) => u.name === e)) == null ? void 0 : t.icon) ?? "";
10
+ return ((t = o.find((d) => d.name === e)) == null ? void 0 : t.icon) ?? "";
11
11
  }, [e]);
12
- return /* @__PURE__ */ d(
13
- S,
12
+ return /* @__PURE__ */ p(
13
+ y,
14
14
  {
15
- className: r,
16
- type: i,
17
- size: s,
18
- icon: l,
19
- iconType: a,
20
- label: c ? `${e === "system" ? "auto" : e}` : void 0,
21
- onClick: () => h(f.name)
15
+ ref: c,
16
+ className: i,
17
+ type: a,
18
+ size: h,
19
+ icon: u,
20
+ iconType: f,
21
+ label: s ? `${e === "system" ? "auto" : e}` : void 0,
22
+ onClick: () => m.name && l(m.name)
22
23
  }
23
24
  );
24
25
  });
25
- T.displayName = "SchemeSwitch";
26
+ w.displayName = "SchemeSwitch";
26
27
  export {
27
- T as SchemeSwitch
28
+ w as SchemeSwitch
28
29
  };
package/dist/index.js CHANGED
@@ -1,93 +1,94 @@
1
1
  /* empty css */
2
2
  import { STORAGE as t, THEME_SCHEME as m } from "./utils/constants/commons.js";
3
3
  import { getLocalState as i, setLocalState as f } from "./utils/function/localStorage.js";
4
- import { mergeRefs as a } from "./utils/function/mergeRefs.js";
5
- import { capitalizeFirstLetter as s, safeStringFromCodePoint as c, unicodeToString as S } from "./utils/function/string.js";
6
- import { doc as l, elementObserver as d, getCssProperty as P, getCssPropertyPx as E, getCssPropertyVh as C, getCssPropertyVw as I, isClient as T, localStore as y, setCssProperty as z, waitForElement as h, win as A } from "./utils/helper/domHelper.js";
7
- import { createImage as k, getCroppedImg as u, getImageSize as v, getRadianAngle as L, readImageFile as w, readImageSrc as B } from "./utils/helper/imageHelper.js";
4
+ import { assignRef as a, mergeRefs as s } from "./utils/function/mergeRefs.js";
5
+ import { capitalizeFirstLetter as c, safeStringFromCodePoint as g, unicodeToString as S } from "./utils/function/string.js";
6
+ import { doc as d, elementObserver as P, getCssProperty as E, getCssPropertyPx as C, getCssPropertyVh as I, getCssPropertyVw as T, isClient as y, localStore as z, setCssProperty as h, waitForElement as A, win as F } from "./utils/helper/domHelper.js";
7
+ import { createImage as u, getCroppedImg as v, getImageSize as L, getRadianAngle as w, readImageFile as R, readImageSrc as B } from "./utils/helper/imageHelper.js";
8
8
  import { themeController as M } from "./utils/helper/themeController.js";
9
- import { XProvider as X } from "./components/context/index.js";
10
- import { useXData as O, useXTheme as V } from "./components/context/useContext.js";
11
- import { ActionCard as G } from "./components/base/ActionCard/ActionCard.js";
12
- import { EActionCardSize as _ } from "./components/base/ActionCard/types.js";
13
- import { Avatar as q } from "./components/base/Avatar/Avatar.js";
14
- import { EAvatarSize as K } from "./components/base/Avatar/types.js";
15
- import { Button as U } from "./components/base/Button/Button.js";
16
- import { EButtonTypes as Y } from "./components/base/Button/types.js";
17
- import { Icon as $ } from "./components/base/Icon/Icon.js";
18
- import { EIconSize as re } from "./components/base/Icon/types.js";
19
- import { Lottie as te } from "./components/base/Lottie/Lottie.js";
20
- import { ELottieSize as pe } from "./components/base/Lottie/types.js";
21
- import { ProgressBar as fe } from "./components/base/ProgressBar/ProgressBar.js";
22
- import { Spinner as ae } from "./components/base/Spinner/Spinner.js";
23
- import { ESpinnerSize as se } from "./components/base/Spinner/types.js";
9
+ import { XProvider as H } from "./components/context/index.js";
10
+ import { useXData as V, useXTheme as b } from "./components/context/useContext.js";
11
+ import { ActionCard as N } from "./components/base/ActionCard/ActionCard.js";
12
+ import { EActionCardSize as j } from "./components/base/ActionCard/types.js";
13
+ import { Avatar as J } from "./components/base/Avatar/Avatar.js";
14
+ import { EAvatarSize as Q } from "./components/base/Avatar/types.js";
15
+ import { Button as W } from "./components/base/Button/Button.js";
16
+ import { EButtonTypes as Z } from "./components/base/Button/types.js";
17
+ import { Icon as ee } from "./components/base/Icon/Icon.js";
18
+ import { EIconSize as oe } from "./components/base/Icon/types.js";
19
+ import { Lottie as me } from "./components/base/Lottie/Lottie.js";
20
+ import { ELottieSize as ie } from "./components/base/Lottie/types.js";
21
+ import { ProgressBar as xe } from "./components/base/ProgressBar/ProgressBar.js";
22
+ import { Spinner as se } from "./components/base/Spinner/Spinner.js";
23
+ import { ESpinnerSize as ce } from "./components/base/Spinner/types.js";
24
24
  import { Textfield as Se } from "./components/base/Textfield/Textfield.js";
25
- import { DatePicker as le } from "./components/base/DatePicker/DatePicker.js";
26
- import { EDatePickerTypes as Pe } from "./components/base/DatePicker/types.js";
27
- import { FilePicker as Ce } from "./components/base/FilePicker/FilePicker.js";
28
- import { FilePickerIcon as Te } from "./components/base/FilePicker/types.js";
29
- import { Select as ze } from "./components/base/Select/Select.js";
30
- import { ColorPopper as Ae } from "./components/base/ColorPopper/ColorPopper.js";
31
- import { Sider as ke } from "./components/layout/Sider/Sider.js";
32
- import { SiderModal as ve } from "./components/layout/SiderModal/SiderModal.js";
33
- import { Navigation as we } from "./components/layout/Navigation/Navigation.js";
25
+ import { DatePicker as de } from "./components/base/DatePicker/DatePicker.js";
26
+ import { EDatePickerTypes as Ee } from "./components/base/DatePicker/types.js";
27
+ import { FilePicker as Ie } from "./components/base/FilePicker/FilePicker.js";
28
+ import { FilePickerIcon as ye } from "./components/base/FilePicker/types.js";
29
+ import { Select as he } from "./components/base/Select/Select.js";
30
+ import { ColorPopper as Fe } from "./components/base/ColorPopper/ColorPopper.js";
31
+ import { Sider as ue } from "./components/layout/Sider/Sider.js";
32
+ import { SiderModal as Le } from "./components/layout/SiderModal/SiderModal.js";
33
+ import { Navigation as Re } from "./components/layout/Navigation/Navigation.js";
34
34
  import { ThemePicker as De } from "./components/layout/ThemePicker/ThemePicker.js";
35
- import { SchemeSwitch as Re } from "./components/layout/SchemeSwitch/SchemeSwitch.js";
36
- import { ImageEditor as He } from "./components/layout/ImageEditor/ImageEditor.js";
35
+ import { SchemeSwitch as Xe } from "./components/layout/SchemeSwitch/SchemeSwitch.js";
36
+ import { ImageEditor as Oe } from "./components/layout/ImageEditor/ImageEditor.js";
37
37
  export {
38
- G as ActionCard,
39
- q as Avatar,
40
- U as Button,
41
- Ae as ColorPopper,
42
- le as DatePicker,
43
- _ as EActionCardSize,
44
- K as EAvatarSize,
45
- Y as EButtonTypes,
46
- Pe as EDatePickerTypes,
47
- re as EIconSize,
48
- pe as ELottieSize,
49
- se as ESpinnerSize,
50
- Ce as FilePicker,
51
- Te as FilePickerIcon,
52
- $ as Icon,
53
- He as ImageEditor,
54
- te as Lottie,
55
- we as Navigation,
56
- fe as ProgressBar,
38
+ N as ActionCard,
39
+ J as Avatar,
40
+ W as Button,
41
+ Fe as ColorPopper,
42
+ de as DatePicker,
43
+ j as EActionCardSize,
44
+ Q as EAvatarSize,
45
+ Z as EButtonTypes,
46
+ Ee as EDatePickerTypes,
47
+ oe as EIconSize,
48
+ ie as ELottieSize,
49
+ ce as ESpinnerSize,
50
+ Ie as FilePicker,
51
+ ye as FilePickerIcon,
52
+ ee as Icon,
53
+ Oe as ImageEditor,
54
+ me as Lottie,
55
+ Re as Navigation,
56
+ xe as ProgressBar,
57
57
  t as STORAGE,
58
- Re as SchemeSwitch,
59
- ze as Select,
60
- ke as Sider,
61
- ve as SiderModal,
62
- ae as Spinner,
58
+ Xe as SchemeSwitch,
59
+ he as Select,
60
+ ue as Sider,
61
+ Le as SiderModal,
62
+ se as Spinner,
63
63
  m as THEME_SCHEME,
64
64
  Se as Textfield,
65
65
  De as ThemePicker,
66
- X as XProvider,
67
- s as capitalizeFirstLetter,
68
- k as createImage,
69
- l as doc,
70
- d as elementObserver,
71
- u as getCroppedImg,
72
- P as getCssProperty,
73
- E as getCssPropertyPx,
74
- C as getCssPropertyVh,
75
- I as getCssPropertyVw,
76
- v as getImageSize,
66
+ H as XProvider,
67
+ a as assignRef,
68
+ c as capitalizeFirstLetter,
69
+ u as createImage,
70
+ d as doc,
71
+ P as elementObserver,
72
+ v as getCroppedImg,
73
+ E as getCssProperty,
74
+ C as getCssPropertyPx,
75
+ I as getCssPropertyVh,
76
+ T as getCssPropertyVw,
77
+ L as getImageSize,
77
78
  i as getLocalState,
78
- L as getRadianAngle,
79
- T as isClient,
80
- y as localStore,
81
- a as mergeRefs,
82
- w as readImageFile,
79
+ w as getRadianAngle,
80
+ y as isClient,
81
+ z as localStore,
82
+ s as mergeRefs,
83
+ R as readImageFile,
83
84
  B as readImageSrc,
84
- c as safeStringFromCodePoint,
85
- z as setCssProperty,
85
+ g as safeStringFromCodePoint,
86
+ h as setCssProperty,
86
87
  f as setLocalState,
87
88
  M as themeController,
88
89
  S as unicodeToString,
89
- O as useXData,
90
- V as useXTheme,
91
- h as waitForElement,
92
- A as win
90
+ V as useXData,
91
+ b as useXTheme,
92
+ A as waitForElement,
93
+ F as win
93
94
  };
@@ -1,3 +1,4 @@
1
- import { LegacyRef, MutableRefObject, RefCallback } from 'react';
2
- export declare const mergeRefs: <T>(refs: Array<MutableRefObject<T> | LegacyRef<T>>) => RefCallback<T>;
1
+ import { Ref, RefCallback } from 'react';
2
+ export declare function assignRef<T>(ref: Ref<T> | undefined | null, value: T | null): void;
3
+ export declare function mergeRefs<T>(refs: (Ref<T> | undefined | null)[]): RefCallback<T>;
3
4
  //# sourceMappingURL=mergeRefs.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"mergeRefs.d.ts","sourceRoot":"","sources":["../../../src/utils/function/mergeRefs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAEjE,eAAO,MAAM,SAAS,GAAI,CAAC,EAAE,MAAM,KAAK,CAAC,gBAAgB,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC,KAAG,WAAW,CAAC,CAAC,CAU3F,CAAC"}
1
+ {"version":3,"file":"mergeRefs.d.ts","sourceRoot":"","sources":["../../../src/utils/function/mergeRefs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAEzC,wBAAgB,SAAS,CAAC,CAAC,EAC1B,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC,GAAG,SAAS,GAAG,IAAI,EAC9B,KAAK,EAAE,CAAC,GAAG,IAAI,GACb,IAAI,CAUN;AAED,wBAAgB,SAAS,CAAC,CAAC,EAAG,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,SAAS,GAAG,IAAI,CAAC,EAAE,GAAG,WAAW,CAAC,CAAC,CAAC,CAIjF"}
@@ -1,8 +1,19 @@
1
- const o = (e) => (t) => {
2
- e.forEach((n) => {
3
- typeof n == "function" ? n(t) : n != null && (n.current = t);
4
- });
5
- };
1
+ function r(n, t) {
2
+ if (typeof n == "function")
3
+ n(t);
4
+ else if (n != null)
5
+ try {
6
+ n.current = t;
7
+ } catch {
8
+ throw new Error(`Cannot assign value "${t}" to ref "${n}"`);
9
+ }
10
+ }
11
+ function c(n) {
12
+ return (t) => {
13
+ n.forEach((o) => r(o, t));
14
+ };
15
+ }
6
16
  export {
7
- o as mergeRefs
17
+ r as assignRef,
18
+ c as mergeRefs
8
19
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xtreme-ui",
3
- "version": "0.0.83",
3
+ "version": "0.0.85",
4
4
  "type": "module",
5
5
  "description": "Collection of reusable components that can be used in web projects",
6
6
  "main": "dist/index.js",