triafly-ui-kit 1.0.89 → 1.0.91

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
- .search-input{border:1px solid var(--color-border-primary-default);border-radius:22px;margin:0 12px 0 0}.search-input:focus-within{border:2px solid var(--color-border-primary-default);margin:0 11px 0 -1px}.search-input:focus-within .text-input .input-container input{margin:-1px}.search-input .text-input .input-container input{border:none}.search-input .text-input .input-container input:focus{outline:none}.search-input__label{margin:0 0 8px}.search-input .guess-box{padding:0 12px 12px}.search-input .guess-box ul{border-top:1px solid var(--color-border-primary-default);padding:12px 0 0}.search-input .guess-box ul li{min-height:36px;display:flex;align-items:center;padding:0 8px;cursor:pointer}.search-input .guess-box ul li:hover{background-color:var(--color-bg-innerisland-default)}.dropdown-input-test{position:relative}.dropdown-input-test .caret{fill:var(--color-icon-secondary-default);position:absolute;bottom:9px;right:10px}.dropdown-input-test .input-box{position:relative;cursor:pointer;display:flex;justify-content:space-between;align-items:center;outline:none;background-color:var(--color-bg-neutral-basic-default)}.dropdown-input-test .input-box.disabled{background-color:var(--color-bg-island-disabled);pointer-events:none}.dropdown-input-test .input-box.invalid{border-color:var(--color-border-error-default)}.dropdown-input-test .input-box.invalid>span{color:var(--color-border-error-default)}.dropdown-input-test .input-box.invalid svg *{fill:var(--color-border-error-default)}.dropdown-input-test .input-box .placeholder{color:var(--color-text-secondary-default)}.dropdown-input-test .options{position:absolute;top:100%;bottom:auto;left:1%;right:1%;max-height:304px;overflow-y:auto;overflow-x:hidden;background-color:var(--color-bg-neutral-basic-default);border-radius:8px;border:1px solid var(--color-border-primary-default);margin:1px -1px 0;z-index:21}.dropdown-input-test .options.above{bottom:calc(100% + 1px);top:auto}.dropdown-input-test .options li{padding:0 8px;min-height:36px;cursor:pointer;display:flex;align-items:center}.dropdown-input-test .options li:hover,.dropdown-input-test .options li.dropdown-input__option--selected{background-color:var(--color-bg-neutral-lightest-default)}.search-input-container{position:relative;display:inline-block;width:100%}.search-input-container .caret{position:absolute;right:10px;top:50%;transform:translateY(-50%);cursor:pointer;z-index:1;fill:var(--color-icon-secondary-default)}.suggestions-portal{background-color:var(--color-bg-neutral-basic-default);border-radius:8px;border:1px solid var(--color-border-primary-default);box-shadow:0 2px 8px #00000026;overflow-y:auto}.suggestions-portal .suggestions-list{list-style:none;padding:0;margin:0}.suggestions-portal .suggestions-list li{padding:8px 12px;min-height:36px;cursor:pointer;display:flex;align-items:center}.suggestions-portal .suggestions-list li:hover{background-color:var(--color-bg-neutral-lightest-default)}
1
+ .search-input{border:1px solid var(--color-border-primary-default);border-radius:22px;margin:0 12px 0 0}.search-input:focus-within{border:2px solid var(--color-border-primary-default);margin:0 11px 0 -1px}.search-input:focus-within .text-input .input-container input{margin:-1px}.search-input .text-input .input-container input{border:none}.search-input .text-input .input-container input:focus{outline:none}.search-input__label{margin:0 0 8px}.search-input .guess-box{padding:0 12px 12px}.search-input .guess-box ul{border-top:1px solid var(--color-border-primary-default);padding:12px 0 0}.search-input .guess-box ul li{min-height:36px;display:flex;align-items:center;padding:0 8px;cursor:pointer}.search-input .guess-box ul li:hover{background-color:var(--color-bg-innerisland-default)}.dropdown-input-test{position:relative}.dropdown-input-test .caret{display:none;fill:var(--color-icon-secondary-default);position:absolute;bottom:9px;right:10px}.dropdown-input-test .input-box{position:relative;cursor:pointer;display:flex;justify-content:space-between;align-items:center;outline:none;background-color:var(--color-bg-neutral-basic-default)}.dropdown-input-test .input-box.disabled{background-color:var(--color-bg-island-disabled);pointer-events:none}.dropdown-input-test .input-box.invalid{border-color:var(--color-border-error-default)}.dropdown-input-test .input-box.invalid>span{color:var(--color-border-error-default)}.dropdown-input-test .input-box.invalid svg *{fill:var(--color-border-error-default)}.dropdown-input-test .input-box .placeholder{color:var(--color-text-secondary-default)}.dropdown-input-test .options{position:absolute;top:100%;bottom:auto;left:1%;right:1%;max-height:304px;overflow-y:auto;overflow-x:hidden;background-color:var(--color-bg-neutral-basic-default);border-radius:8px;border:1px solid var(--color-border-primary-default);margin:1px -1px 0;z-index:21}.dropdown-input-test .options.above{bottom:calc(100% + 1px);top:auto}.dropdown-input-test .options li{padding:0 8px;min-height:36px;cursor:pointer;display:flex;align-items:center}.dropdown-input-test .options li:hover,.dropdown-input-test .options li.dropdown-input__option--selected{background-color:var(--color-bg-neutral-lightest-default)}.search-input-container{position:relative;display:inline-block;width:100%}.search-input-container .caret{position:absolute;right:10px;top:50%;transform:translateY(-50%);cursor:pointer;z-index:1;fill:var(--color-icon-secondary-default)}.suggestions-portal{background-color:var(--color-bg-neutral-basic-default);border-radius:8px;border:1px solid var(--color-border-primary-default);box-shadow:0 2px 8px #00000026;overflow-y:auto}.suggestions-portal .suggestions-list{list-style:none;padding:0;margin:0}.suggestions-portal .suggestions-list li{padding:8px 12px;min-height:36px;cursor:pointer;display:flex;align-items:center;overflow-wrap:anywhere}.suggestions-portal .suggestions-list li:hover{background-color:var(--color-bg-neutral-lightest-default)}
@@ -1 +1 @@
1
- .table-component{width:100%;position:relative}.table-component__wrapper{width:100%;overflow:auto}.table-component__wrapper.bordered{border:1px solid var(--color-border-primary-default);border-radius:8px}.table-component__wrapper__table{width:100%;border-collapse:separate;border-spacing:0}.table-component__wrapper__table.bordered{border:none}.table-component__wrapper__table__thead{background-color:var(--color-bg-neutral-light-default);height:41px}.table-component__wrapper__table__thead.stickyHeader{position:sticky;top:0;z-index:10}.table-component__wrapper__table__thead__tr:hover{background-color:var(--color-bg-island-selected)}.table-component__wrapper__table__thead__th{padding:12px;text-align:left;position:relative}.table-component__wrapper__table__thead__th.bordered{border-left:1px solid var(--color-border-primary-default);border-bottom:none}.table-component__wrapper__table__thead__th.bordered:first-child{border-left:none}.table-component__wrapper__table__thead__th.stickyLeft{position:sticky;left:0;background-color:inherit;z-index:9}.table-component__wrapper__table__thead__th .th-content{display:flex;align-items:center;gap:4px}.table-component__wrapper__table__thead__th .sort-icon{display:inline-flex}.table-component__wrapper__table__tbody__tr:hover{background-color:var(--color-bg-island-selected)}.table-component__wrapper__table__tbody--hoverable{cursor:pointer}.table-component__wrapper__table__tbody__td{padding:12px}.table-component__wrapper__table__tbody__td--bordered{border-top:1px solid var(--color-border-primary-default);border-left:1px solid var(--color-border-primary-default)}.table-component__wrapper__table__tbody__td--bordered:first-child{border-left:none}.table-component__wrapper__table__tbody__td--sticky-left{position:sticky;left:0;background-color:inherit;z-index:8}.table-component__wrapper.borderBottom .table-component__wrapper__table__tbody td{border-bottom:1px solid var(--color-border-primary-default)}.loading_table_init{position:absolute;top:0;left:0;right:0;bottom:0;display:"flex";justify-content:"center";align-items:"center";background-color:"rgba(255, 255, 255, 0.7)";z-index:10}
1
+ .table-component{width:100%;position:relative}.table-component__wrapper{width:100%}.table-component__wrapper.bordered{border:1px solid var(--color-border-primary-default);border-radius:8px}.table-component__wrapper__table{width:100%;border-collapse:separate;border-spacing:0}.table-component__wrapper__table.bordered{border:none}.table-component__wrapper__table__thead{background-color:var(--color-bg-neutral-light-default);height:41px}.table-component__wrapper__table__thead.stickyHeader{position:sticky;top:0;z-index:10}.table-component__wrapper__table__thead__tr:hover{background-color:var(--color-bg-island-selected)}.table-component__wrapper__table__thead__th{padding:12px;text-align:left;position:relative}.table-component__wrapper__table__thead__th.bordered{border-left:1px solid var(--color-border-primary-default);border-bottom:none}.table-component__wrapper__table__thead__th.bordered:first-child{border-left:none}.table-component__wrapper__table__thead__th.stickyLeft{position:sticky;left:0;background-color:inherit;z-index:9}.table-component__wrapper__table__thead__th .th-content{display:flex;align-items:center;gap:4px}.table-component__wrapper__table__thead__th .sort-icon{display:inline-flex}.table-component__wrapper__table__tbody__tr:hover{background-color:var(--color-bg-island-selected)}.table-component__wrapper__table__tbody--hoverable{cursor:pointer}.table-component__wrapper__table__tbody__td{padding:12px}.table-component__wrapper__table__tbody__td--bordered{border-top:1px solid var(--color-border-primary-default);border-left:1px solid var(--color-border-primary-default)}.table-component__wrapper__table__tbody__td--bordered:first-child{border-left:none}.table-component__wrapper__table__tbody__td--sticky-left{position:sticky;left:0;background-color:inherit;z-index:8}.table-component__wrapper.borderBottom .table-component__wrapper__table__tbody td{border-bottom:1px solid var(--color-border-primary-default)}.loading_table_init{position:absolute;top:0;left:0;right:0;bottom:0;display:"flex";justify-content:"center";align-items:"center";background-color:"rgba(255, 255, 255, 0.7)";z-index:10}
@@ -0,0 +1,69 @@
1
+ import { SearchInput as o } from "./SearchInput.js";
2
+ import { demoSearchData as l } from "./SearchData.js";
3
+ const a = l.map((e) => ({
4
+ value: e.toLowerCase(),
5
+ label: e
6
+ })), s = {
7
+ title: "UIKit/SearchInput",
8
+ // Путь в сторибуке
9
+ component: o,
10
+ parameters: {
11
+ layout: "centered"
12
+ // Компонент будет по центру
13
+ },
14
+ tags: ["autodocs"],
15
+ // Автоматическая генерация docs
16
+ argTypes: {
17
+ // Описываем пропсы для удобного контроля в Storybook
18
+ onChange: { action: "onChange" }
19
+ // Логируем вызов onChange
20
+ }
21
+ }, n = {
22
+ args: {
23
+ label: "Выберите фрукт",
24
+ placeholder: "Начните вводить название...",
25
+ options: a
26
+ // <--- Передаем тестовые данные
27
+ }
28
+ }, c = {
29
+ args: {
30
+ label: "Любимый фрукт",
31
+ placeholder: "Начните вводить название...",
32
+ options: a,
33
+ value: "mango"
34
+ // Предустановленное значение (value)
35
+ }
36
+ }, i = {
37
+ args: {
38
+ label: "Поиск пользователей",
39
+ placeholder: "Введите имя...",
40
+ options: [],
41
+ // Нет опций
42
+ isLoading: !0
43
+ // Показываем индикатор загрузки
44
+ }
45
+ }, p = {
46
+ args: {
47
+ label: "Email",
48
+ placeholder: "Введите email...",
49
+ hasError: !0,
50
+ errorMessage: "Некорректный email адрес",
51
+ options: a
52
+ }
53
+ }, d = {
54
+ args: {
55
+ label: "Статус (недоступно)",
56
+ placeholder: "Выберите статус...",
57
+ isDisabled: !0,
58
+ options: a,
59
+ value: "banana"
60
+ }
61
+ };
62
+ export {
63
+ n as Basic,
64
+ d as Disabled,
65
+ i as Loading,
66
+ p as WithError,
67
+ c as WithInitialValue,
68
+ s as default
69
+ };
@@ -1,115 +1,121 @@
1
- import { jsxs as z, jsx as c } from "react/jsx-runtime";
1
+ import { jsxs as z, jsx as l } from "react/jsx-runtime";
2
2
  import { createPortal as U } from "react-dom";
3
- import { useState as l, useRef as S, useEffect as p } from "react";
3
+ import { useState as i, useRef as S, useEffect as d } from "react";
4
4
  import '../../../assets/src/components/Ui/SearchInput/SearchInput.css';/* empty css */
5
5
  import { getPortalContainer as Y, releasePortal as _ } from "../../../shared/utils/fn/portals.js";
6
- import { TextInput as q } from "../TextInput/TextInput.js";
7
- import { IconCaretUpDown as G } from "../Icons/Icons.js";
8
- const I = "search-input-global-portal", J = ({
6
+ import { TextInput as G } from "../TextInput/TextInput.js";
7
+ import { IconCaretUpDown as J } from "../Icons/Icons.js";
8
+ const I = "search-input-global-portal", M = ({
9
9
  name: v = "SearchInput",
10
- label: k,
11
- placeholder: y = "",
12
- type: N = "text",
13
- id: P,
10
+ label: y,
11
+ placeholder: k = "",
12
+ type: P = "text",
13
+ id: N,
14
14
  isDisabled: R = !1,
15
15
  errorMessage: D = "",
16
16
  hasError: E = !1,
17
17
  className: L = "",
18
- isClearable: V,
19
- isLoading: F,
20
- value: n = "",
21
- onChange: r,
22
- options: o = []
18
+ isClearable: O = !0,
19
+ isLoading: V,
20
+ value: r = "",
21
+ onChange: o,
22
+ options: c = []
23
23
  }) => {
24
- const [m, g] = l(n), [A, d] = l(""), [f, h] = l([]), [w, i] = l(!1), [x, B] = l(!1), [C, H] = l(!1), s = S(null), a = S(null);
25
- p(() => (a.current = Y(I), () => _(I)), []), p(() => {
26
- if (n) {
27
- const e = o.find((t) => t.value === n);
28
- d(e ? e.label : n), g(n);
24
+ const [m, g] = i(r), [A, f] = i(""), [p, h] = i([]), [w, u] = i(!1), [b, F] = i(!1), [B, C] = i(!1), n = S(null), a = S(null);
25
+ d(() => (a.current = Y(I), () => _(I)), []), d(() => {
26
+ if (r) {
27
+ const e = c.find((t) => t.value === r);
28
+ f(e ? e.label : r), g(r);
29
29
  } else
30
- d("");
31
- }, [n, o]), p(() => {
32
- if (m.trim() === "" && x) {
33
- h(o);
30
+ f("");
31
+ }, [r, c]), d(() => {
32
+ if (m.trim() === "" && b) {
33
+ h(c);
34
34
  return;
35
35
  }
36
- const e = o.filter(
36
+ const e = c.filter(
37
37
  (t) => t.label.toLowerCase().includes(m.toLowerCase())
38
38
  );
39
39
  h(e);
40
- }, [m, o, x]), p(() => {
40
+ }, [m, c, b]), d(() => {
41
41
  const e = (t) => {
42
- s.current && !s.current.contains(t.target) && a.current && !a.current.contains(t.target) && i(!1);
42
+ const s = n.current && !n.current.contains(t.target), q = a.current && !a.current.contains(t.target);
43
+ s && q && u(!1);
43
44
  };
44
- return document.addEventListener("click", e), () => {
45
- document.removeEventListener("click", e);
45
+ return document.addEventListener("mousedown", e), () => {
46
+ document.removeEventListener("mousedown", e);
46
47
  };
48
+ }, []), d(() => {
49
+ if (n.current) {
50
+ const e = n.current.querySelector("input");
51
+ e && e.setAttribute("autocomplete", "off");
52
+ }
47
53
  }, []);
48
- const K = (e) => {
54
+ const H = (e) => {
49
55
  const t = e.target.value;
50
- g(t), d(t), r == null || r(t), i(!0);
51
- }, b = (e) => {
52
- g(e.value), d(e.label), r == null || r(e.value), i(!1);
53
- }, O = () => {
54
- B(!0), i(!0), h(o);
56
+ g(t), f(t), o == null || o(t), u(!0);
57
+ }, x = (e) => {
58
+ g(e.value), f(e.label), o == null || o(e.value), u(!1);
59
+ }, K = () => {
60
+ F(!0), u(!0), h(c);
55
61
  }, T = (e) => {
56
- e.key === "Enter" && f.length > 0 && w && b(f[0]);
62
+ e.key === "Enter" && p.length > 0 && w && x(p[0]);
57
63
  }, $ = (e) => {
58
- if (e.stopPropagation(), !w && s.current) {
59
- const t = s.current.getBoundingClientRect(), u = window.innerHeight - t.bottom;
60
- H(u < 304 && t.top >= 304);
64
+ if (e.stopPropagation(), !w && n.current) {
65
+ const t = n.current.getBoundingClientRect(), s = window.innerHeight - t.bottom;
66
+ C(s < 304 && t.top >= 304);
61
67
  }
62
- i((t) => !t);
68
+ u((t) => !t);
63
69
  }, j = () => {
64
- if (!w || !x || f.length === 0 || !s.current || !a.current)
70
+ if (!w || !b || p.length === 0 || !n.current || !a.current)
65
71
  return null;
66
- const e = s.current.getBoundingClientRect(), t = {
72
+ const e = n.current.getBoundingClientRect(), t = {
67
73
  position: "fixed",
68
74
  width: e.width,
69
75
  left: e.left,
70
76
  maxHeight: "304px",
71
77
  zIndex: 9999
72
78
  };
73
- return C ? t.bottom = `${window.innerHeight - e.top}px` : t.top = `${e.bottom}px`, U(
74
- /* @__PURE__ */ c("div", { className: "suggestions-portal", style: t, children: /* @__PURE__ */ c("ul", { className: "suggestions-list", children: f.map((u) => /* @__PURE__ */ c(
79
+ return B ? t.bottom = `${window.innerHeight - e.top}px` : t.top = `${e.bottom}px`, U(
80
+ /* @__PURE__ */ l("div", { className: "suggestions-portal", style: t, children: /* @__PURE__ */ l("ul", { className: "suggestions-list", children: p.map((s) => /* @__PURE__ */ l(
75
81
  "li",
76
82
  {
77
83
  onClick: () => {
78
- b(u);
84
+ x(s);
79
85
  },
80
- children: u.label
86
+ children: s.label
81
87
  },
82
- u.value
88
+ s.value
83
89
  )) }) }),
84
90
  a.current
85
91
  );
86
92
  };
87
- return /* @__PURE__ */ z("div", { className: "search-input-container", ref: s, children: [
88
- /* @__PURE__ */ c(
89
- q,
93
+ return /* @__PURE__ */ z("div", { className: "search-input-container", ref: n, children: [
94
+ /* @__PURE__ */ l(
95
+ G,
90
96
  {
91
97
  name: v,
92
- label: k,
93
- type: N,
98
+ label: y,
99
+ type: P,
94
100
  className: `${L}`,
95
101
  value: A,
96
- onChange: K,
97
- placeholder: y,
98
- id: P,
102
+ onChange: H,
103
+ placeholder: k,
104
+ id: N,
99
105
  isDisabled: R,
100
- isClearable: V,
106
+ isClearable: O,
101
107
  hasError: E,
102
108
  errorMessage: D,
103
- isLoading: F,
104
- onFocus: O,
109
+ isLoading: V,
110
+ onFocus: K,
105
111
  onKeyDown: T
106
112
  }
107
113
  ),
108
- /* @__PURE__ */ c("div", { className: "caret", onClick: $, children: /* @__PURE__ */ c(G, {}) }),
114
+ /* @__PURE__ */ l("div", { className: "caret", onClick: $, children: /* @__PURE__ */ l(J, {}) }),
109
115
  j()
110
116
  ] });
111
117
  };
112
- J.displayName = "SearchInput";
118
+ M.displayName = "SearchInput";
113
119
  export {
114
- J as SearchInput
120
+ M as SearchInput
115
121
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "triafly-ui-kit",
3
- "version": "1.0.89",
3
+ "version": "1.0.91",
4
4
  "description": "UI Kit from Triafly",
5
5
  "main": "./dist/main.js",
6
6
  "module": "./dist/main.js",