md-components-mdigial-azamat 0.0.336 → 0.0.337

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,61 +1,62 @@
1
- import { jsxs as y, jsx as c } from "react/jsx-runtime";
1
+ import { jsxs as y, jsx as l } from "react/jsx-runtime";
2
2
  import { useState as C, useEffect as P, useCallback as I, lazy as N, Suspense as A } from "react";
3
3
  import "../LayoutContext-752de9f0.js";
4
4
  import { r as L } from "../tokens-29849cf7.js";
5
+ import { C as k } from "../ComponentContainer-dca711c6.js";
5
6
  import { F as w } from "../Flex-86aee720.js";
6
7
  import { c as E } from "../cn-6a4bf187.js";
7
- import { SegmentsSliderTabs as k } from "./SegmentsSliderTabs.js";
8
- import { propsToEdit as D } from "./schema.js";
9
- import { SegmentsVariant as l } from "./types.js";
10
- function H(t) {
8
+ import { SegmentsSliderTabs as D } from "./SegmentsSliderTabs.js";
9
+ import { propsToEdit as H } from "./schema.js";
10
+ import { SegmentsVariant as s } from "./types.js";
11
+ function j(t) {
11
12
  var e;
12
13
  return typeof window > "u" || !((e = window.location) != null && e.search) ? null : new URLSearchParams(window.location.search).get(t);
13
14
  }
14
- function j(t, e) {
15
+ function K(t, e) {
15
16
  if (typeof window > "u")
16
17
  return;
17
18
  const n = new URL(window.location.href);
18
19
  n.searchParams.set(t, e), window.history.replaceState(window.history.state, "", n.toString());
19
20
  }
20
- function K(t) {
21
+ function O(t) {
21
22
  const [e, n] = C(() => null);
22
23
  P(() => {
23
- const o = () => n(H(t));
24
+ const o = () => n(j(t));
24
25
  return o(), window.addEventListener("popstate", o), () => window.removeEventListener("popstate", o);
25
26
  }, [t]);
26
27
  const r = I(
27
28
  (o) => {
28
- j(t, o), n(o);
29
+ K(t, o), n(o);
29
30
  },
30
31
  [t]
31
32
  );
32
33
  return [e, r];
33
34
  }
34
- const O = N(
35
+ const T = N(
35
36
  () => import("./SegmentsContent.js").then((t) => ({ default: t.SegmentsContent }))
36
37
  ), S = {
37
- [l.PRIMARY]: {
38
+ [s.PRIMARY]: {
38
39
  container: "rounded-[20px] bg-[#E3E4E8] p-1",
39
40
  item: "rounded-[19px] text-gray-800 font-semibold max-tablet:text-[16px] max-tablet:leading-[27px] max-tablet:px-4 max-tablet:py-2 text-[20px] leading-[30px] px-8 py-4 w-[275px]",
40
41
  activeItem: "bg-white"
41
42
  },
42
- [l.SECONDARY]: {
43
+ [s.SECONDARY]: {
43
44
  container: "rounded-xl bg-white/15 border border-white/15 backdrop-blur-[15px]",
44
45
  item: "text-white rounded-[13px] text-sm leading-5 py-[14px] w-[180px] max-tablet:pr-5 max-tablet:pl-4",
45
46
  activeItem: "bg-white text-black font-medium"
46
47
  },
47
- [l.SLIDER]: {
48
+ [s.SLIDER]: {
48
49
  container: "",
49
50
  item: "",
50
51
  activeItem: ""
51
52
  },
52
- [l.HEADER]: {
53
+ [s.HEADER]: {
53
54
  container: "rounded-[10px] bg-white p-1 gap-1",
54
55
  item: "rounded-[8px] text-[#40474f] font-medium text-[14px] leading-5 px-4 py-2",
55
56
  // Фон задаётся цветом из пропса, поэтому в классах его нет
56
57
  activeItem: ""
57
58
  }
58
- }, T = "green", Y = (t) => {
59
+ }, Y = "green", M = (t) => {
59
60
  if (!t)
60
61
  return;
61
62
  const e = t.trim().replace("#", ""), n = e.length === 3 ? e.split("").map((i) => i + i).join("") : e, r = n.length === 8 ? n.slice(0, 6) : n;
@@ -64,12 +65,12 @@ const O = N(
64
65
  const [o, m, u] = [0, 2, 4].map((i) => parseInt(r.slice(i, i + 2), 16));
65
66
  return (0.299 * o + 0.587 * m + 0.114 * u) / 255 > 0.6 ? "#0e0f11" : "#ffffff";
66
67
  };
67
- function M(t, e) {
68
+ function Q(t, e) {
68
69
  var r;
69
70
  const n = (r = t == null ? void 0 : t.tabKey) == null ? void 0 : r.trim();
70
71
  return n || String(e);
71
72
  }
72
- function Q(t, e) {
73
+ function U(t, e) {
73
74
  if (!(t != null && t.length) || e == null || e === "")
74
75
  return 0;
75
76
  const n = t.findIndex(
@@ -83,24 +84,24 @@ function Q(t, e) {
83
84
  const r = parseInt(e, 10);
84
85
  return Number.isNaN(r) || r < 0 || r >= t.length ? 0 : r;
85
86
  }
86
- const U = ({
87
+ const F = ({
87
88
  data: t = [],
88
- variant: e = l.PRIMARY,
89
+ variant: e = s.PRIMARY,
89
90
  queryParamKey: n = "tab",
90
91
  title: r,
91
92
  active_color: o
92
93
  }) => {
93
94
  var h;
94
- const [m, u] = K(n), p = Q(t, m), i = I(
95
- (s, a) => {
96
- u(M(s, a));
95
+ const [m, u] = O(n), p = U(t, m), i = I(
96
+ (c, a) => {
97
+ u(Q(c, a));
97
98
  },
98
99
  [u]
99
- ), f = S[e] || S[l.PRIMARY], x = t[p], b = e === l.HEADER, g = L(
100
- o || (b ? T : void 0)
100
+ ), f = S[e] || S[s.PRIMARY], x = t[p], b = e === s.HEADER, g = L(
101
+ o || (b ? Y : void 0)
101
102
  ), R = g ? {
102
103
  backgroundColor: g,
103
- color: Y(g)
104
+ color: M(g)
104
105
  } : void 0;
105
106
  return /* @__PURE__ */ y(
106
107
  w,
@@ -108,15 +109,15 @@ const U = ({
108
109
  vertical: !0,
109
110
  className: "gap-6",
110
111
  children: [
111
- e === l.SLIDER ? /* @__PURE__ */ c(
112
- k,
112
+ e === s.SLIDER ? /* @__PURE__ */ l(
113
+ D,
113
114
  {
114
115
  data: t,
115
116
  activeIndex: p,
116
- onChange: (s) => i(t[s], s)
117
+ onChange: (c) => i(t[c], c)
117
118
  }
118
119
  ) : (() => {
119
- const s = /* @__PURE__ */ c(
120
+ const c = /* @__PURE__ */ l(
120
121
  w,
121
122
  {
122
123
  className: E(
@@ -129,7 +130,7 @@ const U = ({
129
130
  ),
130
131
  children: t.map((a, d) => {
131
132
  var v;
132
- return /* @__PURE__ */ c(
133
+ return /* @__PURE__ */ l(
133
134
  "button",
134
135
  {
135
136
  onClick: () => i(a, d),
@@ -146,17 +147,17 @@ const U = ({
146
147
  })
147
148
  }
148
149
  );
149
- return b ? /* @__PURE__ */ y(w, { className: "w-full items-center justify-between gap-4 max-tablet:flex-col max-tablet:items-start", children: [
150
- r ? /* @__PURE__ */ c("h2", { className: "text-[#0e0f11] font-bold text-[32px] leading-[40px] max-tablet:text-[24px] max-tablet:leading-[32px]", children: r }) : null,
151
- s
152
- ] }) : s;
150
+ return b ? /* @__PURE__ */ l(k, { children: /* @__PURE__ */ y(w, { className: "w-full items-center justify-between gap-4 max-tablet:flex-col max-tablet:items-start", children: [
151
+ r ? /* @__PURE__ */ l("h2", { className: "text-[#0e0f11] font-bold text-[32px] leading-[40px] max-tablet:text-[24px] max-tablet:leading-[32px]", children: r }) : null,
152
+ c
153
+ ] }) }) : c;
153
154
  })(),
154
- (h = x == null ? void 0 : x.components) != null && h.length ? /* @__PURE__ */ c("div", { className: "segments-content w-full", children: /* @__PURE__ */ c(A, { fallback: null, children: /* @__PURE__ */ c(O, { components: x.components }) }) }) : null
155
+ (h = x == null ? void 0 : x.components) != null && h.length ? /* @__PURE__ */ l("div", { className: "segments-content w-full", children: /* @__PURE__ */ l(A, { fallback: null, children: /* @__PURE__ */ l(T, { components: x.components }) }) }) : null
155
156
  ]
156
157
  }
157
158
  );
158
159
  };
159
- U.propsToEdit = D;
160
+ F.propsToEdit = H;
160
161
  export {
161
- U as Segments
162
+ F as Segments
162
163
  };
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "md-components-mdigial-azamat",
3
3
  "author": "Azamat Raimbekov",
4
4
  "private": false,
5
- "version": "0.0.336",
5
+ "version": "0.0.337",
6
6
  "type": "module",
7
7
  "main": "dist/main.js",
8
8
  "types": "dist/main.d.ts",