triafly-ui-kit 1.0.27 → 1.0.28

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.
Files changed (38) hide show
  1. package/README.md +93 -93
  2. package/dist/assets/src/components/Ui/ModalWindow/ModalWindow.css +1 -1
  3. package/dist/assets/src/components/Ui/Tooltip/Tooltip.stories.module.css +1 -1
  4. package/dist/components/Ui/DatePicker/DatePicker.js +13 -6
  5. package/dist/components/Ui/DatePicker/DatePicker.stories.js +39 -33
  6. package/dist/main.d.ts +0 -33
  7. package/dist/main.js +153 -157
  8. package/dist/src/components/Ui/Tooltip/Tooltip.stories.module.css.js +1 -1
  9. package/dist/styles/_mixins.scss +21 -21
  10. package/dist/styles/fix.scss +3 -3
  11. package/dist/styles/main.scss +26 -26
  12. package/dist/styles/reset.scss +105 -105
  13. package/dist/styles/typography.scss +106 -102
  14. package/dist/styles/variables.scss +273 -273
  15. package/package.json +110 -111
  16. package/src/styles/_mixins.scss +21 -21
  17. package/src/styles/fix.scss +3 -3
  18. package/src/styles/main.scss +26 -26
  19. package/src/styles/reset.scss +105 -105
  20. package/src/styles/typography.scss +106 -102
  21. package/src/styles/variables.scss +273 -273
  22. package/dist/_virtual/dayjs.min.js +0 -7
  23. package/dist/_virtual/dayjs.min2.js +0 -4
  24. package/dist/_virtual/ru.js +0 -2
  25. package/dist/_virtual/ru2.js +0 -4
  26. package/dist/assets/src/components/Ui/DateRangePicker/DateRangePicker.css +0 -1
  27. package/dist/components/Ui/DatePicker/index.js +0 -4
  28. package/dist/components/Ui/DateRangePicker/DateRangePicker.js +0 -195
  29. package/dist/components/Ui/DateRangePicker/DateRangePicker.stories.js +0 -84
  30. package/dist/components/Ui/DateRangePicker/const.js +0 -37
  31. package/dist/components/Ui/DateRangePicker/hooks/useCalendarRenderer.js +0 -48
  32. package/dist/components/Ui/DateRangePicker/hooks/useChangeDate.js +0 -28
  33. package/dist/components/Ui/DateRangePicker/hooks/useDateNavigation.js +0 -22
  34. package/dist/components/Ui/DateRangePicker/hooks/useDateRangeState.js +0 -24
  35. package/dist/components/Ui/DateRangePicker/hooks/useQuickRange.js +0 -77
  36. package/dist/components/Ui/DateRangePicker/index.js +0 -4
  37. package/dist/node_modules/dayjs/dayjs.min.js +0 -282
  38. package/dist/node_modules/dayjs/locale/ru.js +0 -36
@@ -1,195 +0,0 @@
1
- import { jsx as e, Fragment as E, jsxs as n } from "react/jsx-runtime";
2
- import { useRef as $, useState as A, useEffect as P } from "react";
3
- import D from "../../../_virtual/dayjs.min.js";
4
- import "../../../_virtual/ru.js";
5
- import '../../../assets/src/components/Ui/DateRangePicker/DateRangePicker.css';/* empty css */
6
- import { selectAutoCompliteDate as q } from "./const.js";
7
- import { useDateRangeState as F } from "./hooks/useDateRangeState.js";
8
- import { useDateNavigation as U } from "./hooks/useDateNavigation.js";
9
- import { useQuickRange as z } from "./hooks/useQuickRange.js";
10
- import { useCalendarRenderer as G } from "./hooks/useCalendarRenderer.js";
11
- import { IconCalendarBlank as H, IconCaretUpDown as J, IconCaretLeft as v, IconCaretRight as k } from "../Icons/Icons.js";
12
- D.locale("ru");
13
- const re = ({
14
- disabledBefore: m,
15
- disabledAfter: h,
16
- onChange: l,
17
- initialRange: R,
18
- className: x,
19
- placeholder: O = "Любая дата",
20
- autoCompleteWithToday: w = !0
21
- }) => {
22
- const N = $(null), [b, g] = A(!1), { leftMonth: s, rightMonth: c, setLeftMonth: u, setRightMonth: o, selectedRange: t, setSelectedRange: d } = F(R), { navigateLeftMonth: M, navigateRightMonth: y, navigateYear: f } = U(
23
- s,
24
- c,
25
- u,
26
- o
27
- ), { activeQuickRange: I, setQuickRange: L, isQuickRangeDisabled: Q, setActiveQuickRange: S } = z(
28
- d,
29
- u,
30
- o,
31
- m,
32
- h,
33
- l
34
- ), j = (a, r) => {
35
- if (!(m && a.isBefore(m, "day") || h && a.isAfter(h, "day")))
36
- if (S(null), !t.start || t.start && t.end) {
37
- if (d({ start: a, end: null }), r === "left") {
38
- const i = a.add(1, "month").startOf("month");
39
- i.isSame(s) ? o(i.add(1, "month")) : o(i);
40
- }
41
- } else
42
- a.isBefore(t.start, "day") ? d({ start: a, end: t.start }) : d({ ...t, end: a }), l && l({
43
- start: a.isBefore(t.start, "day") ? a : t.start,
44
- end: a.isBefore(t.start, "day") ? t.start : a
45
- });
46
- }, { renderCalendar: Y } = G(
47
- t,
48
- j,
49
- m,
50
- h
51
- ), B = () => {
52
- if (w && t.start && !t.end) {
53
- const a = D(), r = a.isAfter(t.start) ? a : t.start, i = {
54
- start: t.start,
55
- end: r
56
- };
57
- d(i), l && l(i);
58
- const p = i.start.startOf("month"), C = r.startOf("month");
59
- p.isSame(C) ? (u(p), o(p.add(1, "month"))) : (u(p), o(C));
60
- }
61
- g(!1);
62
- };
63
- return P(() => {
64
- const a = (r) => {
65
- N.current && !N.current.contains(r.target) && B();
66
- };
67
- return document.addEventListener("mousedown", a), () => {
68
- document.removeEventListener("mousedown", a);
69
- };
70
- }, [t]), /* @__PURE__ */ e(E, { children: /* @__PURE__ */ n("div", { className: `date-range-picker ${x}`, ref: N, children: [
71
- /* @__PURE__ */ n("div", { className: "date-range-picker-input", onClick: () => g(!b), children: [
72
- /* @__PURE__ */ e(H, {}),
73
- /* @__PURE__ */ e("span", { className: "placeholder", children: t != null && t.start && (t != null && t.end) ? `${t.start.format("DD-MM-YYYY")} – ${t.end.format("DD-MM-YYYY")}` : O }),
74
- /* @__PURE__ */ e(J, { className: "caret" })
75
- ] }),
76
- b && /* @__PURE__ */ e("div", { className: "date-range-picker-calendar", children: /* @__PURE__ */ n("div", { className: "date-range-picker-selection", children: [
77
- /* @__PURE__ */ e("div", { className: "date-range-picker-quick-selection-options", children: q.map((a) => {
78
- const r = Q(a.key);
79
- return /* @__PURE__ */ e(
80
- "button",
81
- {
82
- className: I === a.key ? "active" : "",
83
- onClick: () => !r && L(a.key),
84
- disabled: r,
85
- children: a.label
86
- },
87
- a.key
88
- );
89
- }) }),
90
- /* @__PURE__ */ e("div", { className: "line" }),
91
- /* @__PURE__ */ n("div", { className: "date-range-picker-section-period", children: [
92
- /* @__PURE__ */ n("div", { children: [
93
- /* @__PURE__ */ n("div", { className: "date-range-picker-section-period-month-year-block", children: [
94
- /* @__PURE__ */ n("div", { className: "month-control", children: [
95
- /* @__PURE__ */ e(
96
- "button",
97
- {
98
- className: "nav-button",
99
- onClick: () => M("prev"),
100
- "aria-label": "Предыдущий месяц",
101
- children: /* @__PURE__ */ e(v, {})
102
- }
103
- ),
104
- /* @__PURE__ */ e("span", { className: "current-month", children: s.format("MMMM") }),
105
- /* @__PURE__ */ e(
106
- "button",
107
- {
108
- className: "nav-button",
109
- onClick: () => M("next"),
110
- "aria-label": "Следующий месяц",
111
- disabled: s.add(1, "month").isAfter(c),
112
- children: /* @__PURE__ */ e(k, {})
113
- }
114
- )
115
- ] }),
116
- /* @__PURE__ */ n("div", { className: "year-control", children: [
117
- /* @__PURE__ */ e(
118
- "button",
119
- {
120
- className: "nav-button",
121
- onClick: () => f("prev", "left"),
122
- "aria-label": "Предыдущий год",
123
- children: /* @__PURE__ */ e(v, {})
124
- }
125
- ),
126
- /* @__PURE__ */ e("span", { className: "current-year", children: s.format("YYYY") }),
127
- /* @__PURE__ */ e(
128
- "button",
129
- {
130
- className: "nav-button",
131
- onClick: () => f("next", "left"),
132
- "aria-label": "Следующий год",
133
- children: /* @__PURE__ */ e(k, {})
134
- }
135
- )
136
- ] })
137
- ] }),
138
- Y(s, "left")
139
- ] }),
140
- /* @__PURE__ */ e("div", { className: "line" }),
141
- /* @__PURE__ */ n("div", { children: [
142
- /* @__PURE__ */ n("div", { className: "date-range-picker-section-period-month-year-block", children: [
143
- /* @__PURE__ */ n("div", { className: "month-control", children: [
144
- /* @__PURE__ */ e(
145
- "button",
146
- {
147
- className: "nav-button",
148
- onClick: () => y("prev"),
149
- "aria-label": "Предыдущий месяц",
150
- disabled: c.subtract(1, "month").isBefore(s),
151
- children: /* @__PURE__ */ e(v, {})
152
- }
153
- ),
154
- /* @__PURE__ */ e("span", { className: "current-month", children: c.format("MMMM") }),
155
- /* @__PURE__ */ e(
156
- "button",
157
- {
158
- className: "nav-button",
159
- onClick: () => y("next"),
160
- "aria-label": "Следующий месяц",
161
- children: /* @__PURE__ */ e(k, {})
162
- }
163
- )
164
- ] }),
165
- /* @__PURE__ */ n("div", { className: "year-control", children: [
166
- /* @__PURE__ */ e(
167
- "button",
168
- {
169
- className: "nav-button",
170
- onClick: () => f("prev", "right"),
171
- "aria-label": "Предыдущий год",
172
- children: /* @__PURE__ */ e(v, {})
173
- }
174
- ),
175
- /* @__PURE__ */ e("span", { className: "current-year", children: c.format("YYYY") }),
176
- /* @__PURE__ */ e(
177
- "button",
178
- {
179
- className: "nav-button",
180
- onClick: () => f("next", "right"),
181
- "aria-label": "Следующий год",
182
- children: /* @__PURE__ */ e(k, {})
183
- }
184
- )
185
- ] })
186
- ] }),
187
- Y(c, "right")
188
- ] })
189
- ] })
190
- ] }) })
191
- ] }) });
192
- };
193
- export {
194
- re as DateRangePicker
195
- };
@@ -1,84 +0,0 @@
1
- import { jsx as i } from "react/jsx-runtime";
2
- import { DateRangePicker as a } from "./DateRangePicker.js";
3
- import e from "../../../_virtual/dayjs.min.js";
4
- const s = {
5
- title: "UIKit/DateRangePicker",
6
- component: a,
7
- tags: ["autodocs"],
8
- argTypes: {
9
- disabledBefore: {
10
- control: "text",
11
- description: "Дизейбл до"
12
- },
13
- disabledAfter: {
14
- control: "text",
15
- description: "Дизейбл после"
16
- },
17
- className: {
18
- control: "text",
19
- description: "Класс для основного контейнера"
20
- },
21
- onChange: {
22
- action: "dateChanged",
23
- description: "Обработчик изменения даты"
24
- },
25
- placeholder: {
26
- control: "text",
27
- description: "Текст плейсхолдера"
28
- },
29
- autoCompleteWithToday: {
30
- control: "boolean",
31
- description: "Автозаполнение датой, если указали один не полностью"
32
- },
33
- initialRange: {
34
- control: "object",
35
- description: "Начальное состояние"
36
- }
37
- }
38
- }, d = {
39
- args: {
40
- placeholder: "Любая дата"
41
- }
42
- }, c = {
43
- args: {
44
- initialRange: {
45
- start: e("2023-01-01"),
46
- end: e()
47
- },
48
- placeholder: "Выберите дату"
49
- }
50
- }, p = {
51
- args: {
52
- disabledBefore: e(new Date(2023, 0, 1)),
53
- disabledAfter: e(new Date(2023, 11, 31)),
54
- placeholder: "Выберите дату в 2023 году"
55
- }
56
- }, g = {
57
- args: {
58
- disabledAfter: e(),
59
- placeholder: "Выберите дату"
60
- }
61
- }, h = {
62
- args: {
63
- initialRange: {
64
- start: e("2025-06-01"),
65
- end: e("2025-06-15")
66
- },
67
- placeholder: "Выберите дату"
68
- },
69
- render: (t) => {
70
- const o = {
71
- ...t,
72
- initialRange: t.initialRange
73
- };
74
- return /* @__PURE__ */ i(a, { ...o });
75
- }
76
- };
77
- export {
78
- d as Default,
79
- h as InitialDate,
80
- p as WithDateRange,
81
- g as WithDateRangeDisabledMonth,
82
- c as WithInitialDate,
83
- s as default
84
- };
@@ -1,37 +0,0 @@
1
- const e = [
2
- {
3
- label: "Сегодня",
4
- key: "today"
5
- },
6
- {
7
- label: "Вчера",
8
- key: "yesterday"
9
- },
10
- {
11
- label: "Эта неделя",
12
- key: "thisWeek"
13
- },
14
- {
15
- label: "Прошлая неделя",
16
- key: "lastWeek"
17
- },
18
- {
19
- label: "Этот месяц",
20
- key: "thisMonth"
21
- },
22
- {
23
- label: "Прошлый месяц",
24
- key: "lastMonth"
25
- },
26
- {
27
- label: "Этот год",
28
- key: "thisYear"
29
- },
30
- {
31
- label: "Прошлый год",
32
- key: "lastYear"
33
- }
34
- ];
35
- export {
36
- e as selectAutoCompliteDate
37
- };
@@ -1,48 +0,0 @@
1
- import { jsx as n, jsxs as u } from "react/jsx-runtime";
2
- import D from "../../../../_virtual/dayjs.min.js";
3
- const B = (o, S, d, i) => {
4
- const $ = D();
5
- return { renderCalendar: (a, C) => {
6
- const e = a.startOf("month"), c = a.endOf("month"), O = c.date(), M = (e.day() + 6) % 7, r = [];
7
- for (let t = M; t > 0; t--)
8
- r.push(e.subtract(t, "day"));
9
- for (let t = 0; t < O; t++)
10
- r.push(e.add(t, "day"));
11
- const N = Math.ceil(r.length / 7) * 7 - r.length;
12
- for (let t = 1; t <= N; t++)
13
- r.push(c.add(t, "day"));
14
- const l = [];
15
- for (let t = 0; t < r.length; t += 7)
16
- l.push(r.slice(t, t + 7));
17
- return /* @__PURE__ */ n("div", { className: "calendar-month", children: /* @__PURE__ */ u("table", { children: [
18
- /* @__PURE__ */ n("thead", { children: /* @__PURE__ */ n("tr", { children: ["Пн", "Вт", "Ср", "Чт", "Пт", "Сб", "Вс"].map((t) => /* @__PURE__ */ n("th", { children: t }, t)) }) }),
19
- /* @__PURE__ */ n("tbody", { children: l.map((t, h) => /* @__PURE__ */ n("tr", { children: t.map((s, b) => {
20
- var f, p;
21
- if (!s || s.month() !== a.month())
22
- return /* @__PURE__ */ n("td", { className: "other-month empty" }, `empty-${h}-${b}`);
23
- const y = d && s.isBefore(d, "day") || i && s.isAfter(i, "day"), m = s.isSame($, "day"), j = (f = o.start) == null ? void 0 : f.isSame(s, "day"), k = (p = o.end) == null ? void 0 : p.isSame(s, "day"), v = o.start && o.end && s.isAfter(o.start, "day") && s.isBefore(o.end, "day");
24
- return /* @__PURE__ */ u(
25
- "td",
26
- {
27
- className: `
28
- ${y ? "disabled" : ""}
29
- ${m ? "today" : ""}
30
- ${j ? "selected-start" : ""}
31
- ${k ? "selected-end" : ""}
32
- ${v ? "in-range" : ""}
33
- `,
34
- onClick: () => !y && S(s, C),
35
- children: [
36
- s.date(),
37
- m && /* @__PURE__ */ n("div", { className: "today-dot" })
38
- ]
39
- },
40
- s.toString()
41
- );
42
- }) }, h)) })
43
- ] }) });
44
- } };
45
- };
46
- export {
47
- B as useCalendarRenderer
48
- };
@@ -1,28 +0,0 @@
1
- import p from "../../../../_virtual/dayjs.min.js";
2
- const j = (r, o, m, f, k, D, B, O, y, h, i) => ({ handleDateClick: (t, a) => {
3
- if (!(y && t.isBefore(y, "day") || h && t.isAfter(h, "day")))
4
- if (B(null), !r.start || r.start && r.end) {
5
- if (o({ start: t, end: null }), a === "left") {
6
- const s = t.add(1, "month").startOf("month");
7
- s.isSame(k) ? f(s.add(1, "month")) : f(s);
8
- }
9
- } else
10
- t.isBefore(r.start, "day") ? o({ start: t, end: r.start }) : o({ ...r, end: t }), i && i({
11
- start: t.isBefore(r.start, "day") ? t : r.start,
12
- end: t.isBefore(r.start, "day") ? r.start : t
13
- });
14
- }, handleClosePicker: () => {
15
- if (D && r.start && !r.end) {
16
- const t = p(), a = t.isAfter(r.start) ? t : r.start, s = {
17
- start: r.start,
18
- end: a
19
- };
20
- o(s), i && i(s);
21
- const n = s.start.startOf("month"), u = a.startOf("month");
22
- n.isSame(u) ? (m(n), f(n.add(1, "month"))) : (m(n), f(u));
23
- }
24
- O(!1);
25
- } });
26
- export {
27
- j as useChangeDate
28
- };
@@ -1,22 +0,0 @@
1
- const m = (e, n, t, c) => ({
2
- navigateLeftMonth: (s) => {
3
- const a = s === "prev" ? e.subtract(1, "month") : e.add(1, "month");
4
- (a.isSame(n) || a.isAfter(n)) && c(a.add(1, "month")), t(a);
5
- },
6
- navigateRightMonth: (s) => {
7
- const a = s === "prev" ? n.subtract(1, "month") : n.add(1, "month");
8
- (a.isSame(e) || a.isBefore(e)) && t(a.subtract(1, "month")), c(a);
9
- },
10
- navigateYear: (s, a) => {
11
- if (a === "left") {
12
- const r = s === "prev" ? e.subtract(1, "year") : e.add(1, "year");
13
- t(r), r.isAfter(n) && c(r.add(1, "month"));
14
- } else {
15
- const r = s === "prev" ? n.subtract(1, "year") : n.add(1, "year");
16
- c(r), r.isBefore(e) && t(r.subtract(1, "month"));
17
- }
18
- }
19
- });
20
- export {
21
- m as useDateNavigation
22
- };
@@ -1,24 +0,0 @@
1
- import { useState as d, useEffect as u } from "react";
2
- import M from "../../../../_virtual/dayjs.min.js";
3
- const a = (t) => {
4
- const f = M(), [m, r] = d(f), [n, h] = d(f.add(1, "month")), [s, c] = d({
5
- start: (t == null ? void 0 : t.start) || null,
6
- end: (t == null ? void 0 : t.end) || null
7
- });
8
- return u(() => {
9
- if (s.start && s.end) {
10
- const e = s.start.startOf("month"), o = s.end.startOf("month");
11
- e.isSame(o) ? (r(e), h(e.add(1, "month"))) : (e.isSame(m, "month") || r(e), !o.isSame(n, "month") && o.isAfter(e) && h(o));
12
- }
13
- }, [s]), {
14
- leftMonth: m,
15
- rightMonth: n,
16
- setLeftMonth: r,
17
- setRightMonth: h,
18
- selectedRange: s,
19
- setSelectedRange: c
20
- };
21
- };
22
- export {
23
- a as useDateRangeState
24
- };
@@ -1,77 +0,0 @@
1
- import b from "../../../../_virtual/dayjs.min.js";
2
- import { useState as h } from "react";
3
- const Q = (u, i, o, n, k, d) => {
4
- const a = b(), [y, f] = h(null);
5
- return {
6
- activeQuickRange: y,
7
- setQuickRange: (r) => {
8
- let t, e = a;
9
- switch (r) {
10
- case "yesterday":
11
- t = a.subtract(1, "day"), e = t;
12
- break;
13
- case "thisWeek":
14
- t = a.startOf("week");
15
- break;
16
- case "lastWeek":
17
- t = a.subtract(1, "week").startOf("week"), e = t.add(6, "day");
18
- break;
19
- case "thisMonth":
20
- t = a.startOf("month");
21
- break;
22
- case "lastMonth":
23
- t = a.subtract(1, "month").startOf("month"), e = t.endOf("month");
24
- break;
25
- case "thisYear":
26
- t = a.startOf("year");
27
- break;
28
- case "lastYear":
29
- t = a.subtract(1, "year").startOf("year"), e = t.endOf("year");
30
- break;
31
- default:
32
- t = a;
33
- }
34
- if (f(r), u({ start: t, end: e }), d && d({ start: t, end: e }), t && e) {
35
- const s = t.startOf("month"), c = e.startOf("month");
36
- s.isSame(c) ? (i(s), o(s.add(1, "month"))) : (i(s), o(c));
37
- }
38
- },
39
- isQuickRangeDisabled: (r) => {
40
- let t, e = a;
41
- switch (r) {
42
- case "today":
43
- t = a, e = a;
44
- break;
45
- case "yesterday":
46
- t = a.subtract(1, "day"), e = t;
47
- break;
48
- case "thisWeek":
49
- t = a.startOf("week");
50
- break;
51
- case "lastWeek":
52
- t = a.subtract(1, "week").startOf("week"), e = t.add(6, "day");
53
- break;
54
- case "thisMonth":
55
- t = a.startOf("month");
56
- break;
57
- case "lastMonth":
58
- t = a.subtract(1, "month").startOf("month"), e = t.endOf("month");
59
- break;
60
- case "thisYear":
61
- t = a.startOf("year");
62
- break;
63
- case "lastYear":
64
- t = a.subtract(1, "year").startOf("year"), e = t.endOf("year");
65
- break;
66
- default:
67
- return !1;
68
- }
69
- const s = !n || t.isAfter(n, "day") || t.isSame(n, "day"), c = !k || e.isBefore(k, "day") || e.isSame(k, "day");
70
- return !s || !c;
71
- },
72
- setActiveQuickRange: f
73
- };
74
- };
75
- export {
76
- Q as useQuickRange
77
- };
@@ -1,4 +0,0 @@
1
- import { DateRangePicker as a } from "./DateRangePicker.js";
2
- export {
3
- a as DateRangePicker
4
- };