xtreme-ui 0.0.110 → 0.0.111

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 +1 @@
1
- {"version":3,"file":"ColorPopper.d.ts","sourceRoot":"","sources":["../../../../src/components/base/ColorPopper/ColorPopper.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAoD,GAAG,EAAE,MAAM,OAAO,CAAC;AAwB9E,OAAO,oBAAoB,CAAC;AAE5B,OAAO,KAAK,EAAoB,iBAAiB,EAAE,MAAM,SAAS,CAAC;AACnE,OAAO,KAAK,EAAE,QAAQ,EAAoB,MAAM,cAAc,CAAC;AAE/D,iBAAS,gBAAgB,CAAC,CAAC,SAAS,QAAQ,GAAG,QAAQ,EAAG,KAAK,EAAE,iBAAiB,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,GAAG,CAAC,cAAc,CAAC,2CAsP9G;kBAtPQ,gBAAgB;;;AAwPzB,eAAO,MAAM,WAAW,EAAmC,CAAC,CAAC,SAAS,QAAQ,GAAG,QAAQ,EACxF,KAAK,EAAE,iBAAiB,CAAC,CAAC,CAAC,GAAG;IAAE,GAAG,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAA;CAAE,KACvD,UAAU,CAAC,OAAO,gBAAgB,CAAC,CAAC"}
1
+ {"version":3,"file":"ColorPopper.d.ts","sourceRoot":"","sources":["../../../../src/components/base/ColorPopper/ColorPopper.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAoD,GAAG,EAAE,MAAM,OAAO,CAAC;AAyB9E,OAAO,oBAAoB,CAAC;AAE5B,OAAO,KAAK,EAAoB,iBAAiB,EAAE,MAAM,SAAS,CAAC;AACnE,OAAO,KAAK,EAAE,QAAQ,EAAoB,MAAM,cAAc,CAAC;AAE/D,iBAAS,gBAAgB,CAAC,CAAC,SAAS,QAAQ,GAAG,QAAQ,EAAG,KAAK,EAAE,iBAAiB,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,GAAG,CAAC,cAAc,CAAC,2CAwP9G;kBAxPQ,gBAAgB;;;AA0PzB,eAAO,MAAM,WAAW,EAAmC,CAAC,CAAC,SAAS,QAAQ,GAAG,QAAQ,EACxF,KAAK,EAAE,iBAAiB,CAAC,CAAC,CAAC,GAAG;IAAE,GAAG,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAA;CAAE,KACvD,UAAU,CAAC,OAAO,gBAAgB,CAAC,CAAC"}
@@ -1,54 +1,55 @@
1
1
  "use client";
2
- import { jsxs as i, Fragment as re, jsx as t } from "react/jsx-runtime";
3
- import { forwardRef as le, useMemo as b, useState as C, useRef as ne, useEffect as L } from "react";
4
- import { useFloating as ie, autoUpdate as ae, shift as ce, flip as he, offset as de, useTransitionStyles as me, useInteractions as pe, useClick as ue, useDismiss as fe } from "@floating-ui/react";
2
+ import { jsxs as i, Fragment as le, jsx as t } from "react/jsx-runtime";
3
+ import { forwardRef as ne, useMemo as T, useState as C, useRef as ie, useEffect as L } from "react";
4
+ import { useFloating as ae, autoUpdate as ce, shift as he, flip as de, offset as me, useTransitionStyles as pe, useInteractions as ue, useClick as fe, useDismiss as Ce } from "@floating-ui/react";
5
5
  import g from "clsx";
6
- import { colord as s, getFormat as Ce } from "colord";
7
- import { ColorPicker as ge } from "../ColorPicker/ColorPicker.js";
8
- import { Icon as xe } from "../Icon/Icon.js";
9
- import { Textfield as ve } from "../Textfield/Textfield.js";
10
- import { getColorLabel as He } from "../../../utils/helper/colorHelper.js";
11
- import { THEME_SCHEME as ye } from "../../../utils/constants/theme.js";
12
- import { mergeRefs as Ne } from "../../../utils/function/mergeRefs.js";
13
- import { Button as R } from "../Button/Button.js";
6
+ import { colord as s, getFormat as ge } from "colord";
7
+ import { ColorPicker as xe } from "../ColorPicker/ColorPicker.js";
8
+ import { Icon as ve } from "../Icon/Icon.js";
9
+ import { Textfield as ye } from "../Textfield/Textfield.js";
10
+ import { useScreenType as He } from "../../hooks/useScreen.js";
11
+ import { getColorLabel as Ne } from "../../../utils/helper/colorHelper.js";
12
+ import { THEME_SCHEME as $e } from "../../../utils/constants/theme.js";
13
+ import { mergeRefs as Pe } from "../../../utils/function/mergeRefs.js";
14
+ import { Button as b } from "../Button/Button.js";
14
15
  /* empty css */
15
16
  function O(j, z) {
16
17
  const {
17
- className: T,
18
+ className: R,
18
19
  popperClassName: A,
19
20
  input: x = "textfield",
20
- size: q = "default",
21
- placeholder: D = "Color Picker",
21
+ size: D = "default",
22
+ placeholder: q = "Color Picker",
22
23
  colorHeading: m = "Pick color",
23
- schemeHeading: I,
24
+ schemeHeading: S,
24
25
  themeScheme: v,
25
- setThemeScheme: H,
26
+ setThemeScheme: y,
26
27
  showReset: U = !0,
27
28
  alpha: W,
28
29
  shade: _,
29
- swatch: y,
30
- hideWheel: S = !1,
30
+ swatch: H,
31
+ hideWheel: I = !1,
31
32
  color: a,
32
33
  setColor: p
33
- } = j, r = b(() => s(a), []), u = b(() => Ce(a), [a]), [N, c] = C(r.toHsv()), [h, d] = C(r.toHex()), [G, J] = C(m), $ = ne(!1), [E, P] = C(!1), { refs: k, floatingStyles: K, context: w } = ie({
34
+ } = j, { isDesktop: G } = He(), r = T(() => s(a), []), u = T(() => ge(a), [a]), [N, c] = C(r.toHsv()), [h, d] = C(r.toHex()), [J, K] = C(m), $ = ie(!1), [E, P] = C(!1), { refs: k, floatingStyles: Q, context: w } = ae({
34
35
  open: E,
35
36
  onOpenChange: P,
36
37
  middleware: [
37
- ce({ crossAxis: !0, padding: 18 }),
38
- he(),
39
- de(({ placement: e }) => e === "bottom" ? 10 : 16)
38
+ he({ crossAxis: !0, padding: 18 }),
39
+ de(),
40
+ me(({ placement: e }) => e === "bottom" ? 10 : 16)
40
41
  ],
41
- whileElementsMounted: ae
42
- }), { isMounted: Q, styles: X } = me(w, {
42
+ whileElementsMounted: ce
43
+ }), { isMounted: X, styles: Y } = pe(w, {
43
44
  duration: 200,
44
45
  initial: ({ side: e }) => ({
45
46
  opacity: 0,
46
47
  translate: e === "bottom" ? "0px 8px" : "0px -8px"
47
48
  })
48
- }), { getReferenceProps: F, getFloatingProps: Y } = pe([
49
- ue(w),
50
- fe(w)
51
- ]), [M, Z, B] = b(() => {
49
+ }), { getReferenceProps: F, getFloatingProps: Z } = ue([
50
+ fe(w),
51
+ Ce(w)
52
+ ]), [M, ee, B] = T(() => {
52
53
  const e = s(N), o = e.toHsl(), l = r.toHsl();
53
54
  return [
54
55
  `${Math.round(o.h)} ${Math.round(o.s)}% ${Math.round(o.l)}%`,
@@ -61,13 +62,13 @@ function O(j, z) {
61
62
  d(e);
62
63
  const o = s(e);
63
64
  o.isValid() && (c(o.toHsv()), f(o));
64
- }, ee = (e) => {
65
+ }, oe = (e) => {
65
66
  const o = s(e);
66
67
  c(e), d(o.toHex()), f(o);
67
- }, oe = (e) => {
68
+ }, te = (e) => {
68
69
  const o = s(e);
69
70
  c(o.toHsv()), d(o.toHex()), f(o);
70
- }, te = () => {
71
+ }, se = () => {
71
72
  c(r.toHsv()), d(r.toHex()), f(r);
72
73
  };
73
74
  return L(() => {
@@ -77,14 +78,14 @@ function O(j, z) {
77
78
  }
78
79
  $.current = !1;
79
80
  }, [a]), L(() => {
80
- J(He(s(h).toHsl()) ?? m);
81
- }, [m, h]), /* @__PURE__ */ i(re, { children: [
81
+ K(Ne(s(h).toHsl()) ?? m);
82
+ }, [m, h]), /* @__PURE__ */ i(le, { children: [
82
83
  x === "button" ? /* @__PURE__ */ t(
83
- R,
84
+ b,
84
85
  {
85
86
  className: "xtrColorButton",
86
87
  ref: k.setReference,
87
- size: q,
88
+ size: D,
88
89
  icon: "f53f",
89
90
  iconType: "solid",
90
91
  style: {
@@ -95,11 +96,11 @@ function O(j, z) {
95
96
  ...F()
96
97
  }
97
98
  ) : /* @__PURE__ */ t(
98
- ve,
99
+ ye,
99
100
  {
100
- className: g("xtrColorInput", T),
101
+ className: g("xtrColorInput", R),
101
102
  ref: k.setReference,
102
- placeholder: D,
103
+ placeholder: q,
103
104
  icon: "f53f",
104
105
  iconType: "solid",
105
106
  active: E,
@@ -113,25 +114,25 @@ function O(j, z) {
113
114
  ...F()
114
115
  }
115
116
  ),
116
- Q && /* @__PURE__ */ i(
117
+ X && /* @__PURE__ */ i(
117
118
  "div",
118
119
  {
119
- ref: Ne([z, k.setFloating]),
120
+ ref: Pe([z, k.setFloating]),
120
121
  className: g("xtrColorPopper", A),
121
- style: { ...K, ...X, "--colorBrandPrimary": M },
122
- ...Y(),
122
+ style: { ...Q, ...Y, "--colorBrandPrimary": M },
123
+ ...Z(),
123
124
  children: [
124
- (y || !S) && /* @__PURE__ */ i("div", { className: g("header", x === "button" && "withInput"), children: [
125
+ (H || !I) && /* @__PURE__ */ i("div", { className: g("header", x === "button" && "withInput"), children: [
125
126
  /* @__PURE__ */ i("div", { className: "heading", children: [
126
127
  /* @__PURE__ */ i("div", { children: [
127
- /* @__PURE__ */ t("h1", { children: G }),
128
+ /* @__PURE__ */ t("h1", { children: J }),
128
129
  x === "button" && /* @__PURE__ */ t(
129
130
  "input",
130
131
  {
131
132
  placeholder: "#Hex",
132
- className: g("popperInput", T),
133
- autoFocus: !0,
133
+ className: g("popperInput", R),
134
134
  value: h,
135
+ autoFocus: G,
135
136
  onChange: (e) => V(e.target.value)
136
137
  }
137
138
  )
@@ -139,56 +140,56 @@ function O(j, z) {
139
140
  /* @__PURE__ */ t("h1", { children: m })
140
141
  ] }),
141
142
  U && /* @__PURE__ */ t(
142
- xe,
143
+ ve,
143
144
  {
144
145
  code: "f1da",
145
146
  type: "solid",
146
- style: { "--colorBrandPrimary": Z },
147
- onClick: te
147
+ style: { "--colorBrandPrimary": ee },
148
+ onClick: se
148
149
  }
149
150
  )
150
151
  ] }),
151
- y && /* @__PURE__ */ t("div", { className: "swatch", children: y.map((e, o) => {
152
- const l = s(h).isEqual(e), n = s(e).toHsl(), se = `${n.h} ${n.s}% ${n.l}%`;
152
+ H && /* @__PURE__ */ t("div", { className: "swatch", children: H.map((e, o) => {
153
+ const l = s(h).isEqual(e), n = s(e).toHsl(), re = `${n.h} ${n.s}% ${n.l}%`;
153
154
  return /* @__PURE__ */ t(
154
- R,
155
+ b,
155
156
  {
156
157
  className: "swatchItem",
157
158
  icon: "f00c",
158
159
  iconType: "solid",
159
160
  size: "mini",
160
161
  style: {
161
- "--themeColor": se,
162
+ "--themeColor": re,
162
163
  color: l ? "white" : "transparent"
163
164
  },
164
- onClick: () => oe(n)
165
+ onClick: () => te(n)
165
166
  },
166
167
  `ThemeColor-${n.h}${n.s}${n.l}-${o}`
167
168
  );
168
169
  }) }),
169
- !S && /* @__PURE__ */ t(
170
- ge,
170
+ !I && /* @__PURE__ */ t(
171
+ xe,
171
172
  {
172
173
  className: "colorPicker",
173
174
  alpha: W,
174
175
  shade: _,
175
176
  color: N,
176
- setColor: ee
177
+ setColor: oe
177
178
  }
178
179
  ),
179
- I && /* @__PURE__ */ i("div", { className: "themeScheme", children: [
180
+ S && /* @__PURE__ */ i("div", { className: "themeScheme", children: [
180
181
  /* @__PURE__ */ t("div", { className: "header", children: /* @__PURE__ */ i("div", { className: "heading", children: [
181
182
  /* @__PURE__ */ t("div", { children: /* @__PURE__ */ t("h1", { children: v }) }),
182
- /* @__PURE__ */ t("h1", { children: I })
183
+ /* @__PURE__ */ t("h1", { children: S })
183
184
  ] }) }),
184
- /* @__PURE__ */ t("div", { className: "schemeSelector", children: ye.map(({ name: e, icon: o }, l) => /* @__PURE__ */ t(
185
- R,
185
+ /* @__PURE__ */ t("div", { className: "schemeSelector", children: $e.map(({ name: e, icon: o }, l) => /* @__PURE__ */ t(
186
+ b,
186
187
  {
187
188
  icon: o,
188
189
  iconType: "solid",
189
190
  disabled: v === e,
190
191
  type: v === e ? "primary" : "secondary",
191
- onClick: () => H == null ? void 0 : H(e)
192
+ onClick: () => y == null ? void 0 : y(e)
192
193
  },
193
194
  `ThemeScheme-${e}-${l}`
194
195
  )) })
@@ -198,8 +199,8 @@ function O(j, z) {
198
199
  )
199
200
  ] });
200
201
  }
201
- const Ve = le(O);
202
+ const je = ne(O);
202
203
  O.displayName = "ColorPopper";
203
204
  export {
204
- Ve as ColorPopper
205
+ je as ColorPopper
205
206
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xtreme-ui",
3
- "version": "0.0.110",
3
+ "version": "0.0.111",
4
4
  "type": "module",
5
5
  "description": "Collection of reusable components that can be used in web projects",
6
6
  "main": "dist/index.js",