@dss-kit/ui-kit 0.3.4 → 0.3.6

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.
@@ -9,7 +9,13 @@ export type { TablePaginationLabels, TablePaginationProps, TablePaginationVarian
9
9
  export interface TableProps<TData> {
10
10
  /** Данные для отображения в таблице */
11
11
  data: TData[];
12
- /** Определения колонок */
12
+ /**
13
+ * Определения колонок.
14
+ *
15
+ * Сортировка по колонке по умолчанию выключена: чтобы включить её,
16
+ * укажите у колонки `enableSorting: true` (при этом `enableSorting`
17
+ * таблицы тоже должен быть включён).
18
+ */
13
19
  columns: ColumnDef<TData, any>[];
14
20
  /** Показывать ли границы */
15
21
  /** @default true */
@@ -17,7 +17,7 @@ const p = (s, f, g) => {
17
17
  right: e === "right" ? o : void 0,
18
18
  zIndex: 1,
19
19
  background: g,
20
- boxShadow: l ? `-4px 0 4px -4px ${d.color.effect.shadowL} inset` : e === "right" && i === 0 ? `4px 0 4px -4px ${d.color.effect.shadowL} inset` : void 0
20
+ boxShadow: l ? `-2px 0 2px -2px ${d.color.effect.shadowL} inset` : e === "right" && i === 0 ? `2px 0 2px -2px ${d.color.effect.shadowL} inset` : void 0
21
21
  };
22
22
  };
23
23
  export {
@@ -3,17 +3,31 @@ import { AccentType, NegativeType, NeutralType, PositiveType, Size, TransferType
3
3
  export type BadgeVariant = "filled" | "outline" | "clear";
4
4
  export type BadgeColor = NeutralType | AccentType | WarningType | PositiveType | NegativeType | TransferType;
5
5
  export type BadgeSize = Extract<Size, "sm" | "md" | "lg">;
6
+ export type BadgeTextAlign = "left" | "center" | "right";
6
7
  export interface BadgeProps {
8
+ /** Содержимое лейбла бейджа. Текст всегда центрируется по вертикали внутри бейджа. */
7
9
  label: ReactNode;
10
+ /** Цветовая схема бейджа (фон, рамка и цвет текста берутся из соответствующего токена). @default "neutral" */
8
11
  color?: BadgeColor;
12
+ /** Стиль заливки: "filled" — цветной фон, "outline" — только рамка, "clear" — прозрачный фон без рамки. @default "filled" */
9
13
  variant?: BadgeVariant;
14
+ /** Размер бейджа: "sm" (24px), "md" (32px) или "lg" (40px) — определяет высоту, отступы и вариант текста. @default "md" */
10
15
  size?: BadgeSize;
16
+ /** Фиксированная ширина бейджа (число в px или CSS-строка). Если не задана, ширина определяется содержимым. */
11
17
  width?: number | string;
18
+ /** Расположение текста лейбла по горизонтали внутри бейджа. @default "center" */
19
+ textAlign?: BadgeTextAlign;
20
+ /** Элемент (иконка и т.п.), отображаемый слева от текста лейбла. */
12
21
  leftElement?: ReactNode;
22
+ /** Элемент (иконка и т.п.), отображаемый справа от текста лейбла. */
13
23
  rightElement?: ReactNode;
24
+ /** Переводит бейдж в неактивное состояние: снижает непрозрачность, отключает клик и скрывает кнопку удаления. @default false */
14
25
  disabled?: boolean;
26
+ /** Обработчик клика по бейджу. Если передан (и `disabled` не установлен), бейдж становится кликабельным и получает эффект Ripple. */
15
27
  onClick?: (e: MouseEvent) => void;
28
+ /** Обработчик удаления бейджа. Если передан (и `disabled` не установлен), справа отображается кнопка с иконкой закрытия. */
16
29
  onDelete?: (e: MouseEvent) => void;
30
+ /** Класс для корневого контейнера бейджа (`Box`). */
17
31
  className?: string;
18
32
  /** Класс для текста-лейбла (`Text`). */
19
33
  labelClassName?: string;
@@ -1,39 +1,39 @@
1
- import { jsxs as C, jsx as a } from "react/jsx-runtime";
2
- import { cx as v, css as u } from "@emotion/css";
3
- import k from "../../../assets/svg/shared/close-outline.svg.js";
4
- import { Box as B } from "../../builders/Box/Box.js";
5
- import { theme as L } from "../../../utils/theme/index.js";
6
- import { Ripple as $ } from "../../builders/Ripple/Ripple.js";
7
- import { Text as w } from "../../builders/Text/Text.js";
8
- const { color: r, cornerRadius: g, spacing: l } = L, b = {
1
+ import { jsxs as k, jsx as a } from "react/jsx-runtime";
2
+ import { cx as y, css as u } from "@emotion/css";
3
+ import B from "../../../assets/svg/shared/close-outline.svg.js";
4
+ import { Box as L } from "../../builders/Box/Box.js";
5
+ import { theme as $ } from "../../../utils/theme/index.js";
6
+ import { Ripple as j } from "../../builders/Ripple/Ripple.js";
7
+ import { Text as h } from "../../builders/Text/Text.js";
8
+ const { color: e, cornerRadius: g, spacing: l } = $, b = {
9
9
  neutral: {
10
- border: r.border.neutralAlphaLow,
11
- bg: r.status.neutralTint,
12
- color: r.text.secondary,
10
+ border: e.border.neutralAlphaLow,
11
+ bg: e.status.neutralTint,
12
+ color: e.text.secondary,
13
13
  colorName: "secondary"
14
14
  },
15
15
  accent: {
16
- border: r.border.accentSecondary,
17
- bg: r.status.accentTintLow,
18
- color: r.text.accent,
16
+ border: e.border.accentSecondary,
17
+ bg: e.status.accentTintLow,
18
+ color: e.text.accent,
19
19
  colorName: "accent"
20
20
  },
21
21
  warning: {
22
- border: r.border.warningSecondary,
23
- bg: r.status.warningTintLow,
24
- color: r.text.warning,
22
+ border: e.border.warningSecondary,
23
+ bg: e.status.warningTintLow,
24
+ color: e.text.warning,
25
25
  colorName: "warning"
26
26
  },
27
27
  positive: {
28
- border: r.border.positiveSecondary,
29
- bg: r.status.positiveTintLow,
30
- color: r.text.positive,
28
+ border: e.border.positiveSecondary,
29
+ bg: e.status.positiveTintLow,
30
+ color: e.text.positive,
31
31
  colorName: "positive"
32
32
  },
33
33
  negative: {
34
- border: r.border.negativeSecondary,
35
- bg: r.status.negativeTintLow,
36
- color: r.text.negative,
34
+ border: e.border.negativeSecondary,
35
+ bg: e.status.negativeTintLow,
36
+ color: e.text.negative,
37
37
  colorName: "negative"
38
38
  },
39
39
  transfer: {
@@ -63,17 +63,17 @@ const { color: r, cornerRadius: g, spacing: l } = L, b = {
63
63
  }
64
64
  }, R = (d, n, o, p) => {
65
65
  const t = b[n];
66
- let e = t.bg, s = "none";
66
+ let r = t.bg, s = "none";
67
67
  const c = t.color;
68
68
  switch (d) {
69
69
  case "outline":
70
- e = "transparent", s = `1px solid ${t.border}`;
70
+ r = "transparent", s = `1px solid ${t.border}`;
71
71
  break;
72
72
  case "clear":
73
- e = "transparent";
73
+ r = "transparent";
74
74
  break;
75
75
  default:
76
- e = t.bg;
76
+ r = t.bg;
77
77
  break;
78
78
  }
79
79
  return u({
@@ -82,40 +82,42 @@ const { color: r, cornerRadius: g, spacing: l } = L, b = {
82
82
  userSelect: "none",
83
83
  position: "relative",
84
84
  transition: "background-color 0.2s, opacity 0.2s",
85
- backgroundColor: e,
85
+ backgroundColor: r,
86
86
  color: c,
87
87
  border: s
88
88
  });
89
- }, j = u({
89
+ }, I = u({
90
90
  display: "inline-flex",
91
91
  cursor: "pointer",
92
92
  opacity: 0.6,
93
93
  "&:hover": { opacity: 1 }
94
- }), y = u({
94
+ }), w = u({
95
95
  display: "inline-flex",
96
96
  alignItems: "center",
97
97
  color: "inherit"
98
- }), I = ({
98
+ }), O = ({
99
99
  label: d,
100
100
  color: n = "neutral",
101
101
  size: o = "md",
102
102
  variant: p = "filled",
103
103
  width: t,
104
- leftElement: e,
105
- rightElement: s,
106
- disabled: c,
104
+ textAlign: r = "center",
105
+ leftElement: s,
106
+ rightElement: c,
107
+ disabled: x,
107
108
  onClick: m,
108
- onDelete: x,
109
+ onDelete: f,
109
110
  className: N,
110
- labelClassName: h,
111
+ labelClassName: C,
111
112
  deleteButtonClassName: S
112
113
  }) => {
113
- const T = R(p, n, c, m);
114
- return /* @__PURE__ */ C(
115
- B,
114
+ const T = R(p, n, x, m);
115
+ return /* @__PURE__ */ k(
116
+ L,
116
117
  {
117
118
  row: !0,
118
119
  alignItems: "center",
120
+ justifyContent: "center",
119
121
  gap: l.sm,
120
122
  p: i[o].p,
121
123
  h: i[o].h,
@@ -123,37 +125,41 @@ const { color: r, cornerRadius: g, spacing: l } = L, b = {
123
125
  overflow: "hidden",
124
126
  borderRadius: i[o].corner,
125
127
  onClick: m,
126
- className: v(T, N),
128
+ className: y(T, N),
127
129
  children: [
128
- m && /* @__PURE__ */ a($, {}),
129
- e && /* @__PURE__ */ a("span", { className: y, children: e }),
130
+ m && /* @__PURE__ */ a(j, {}),
131
+ s && /* @__PURE__ */ a("span", { className: w, children: s }),
130
132
  /* @__PURE__ */ a(
131
- w,
133
+ h,
132
134
  {
133
135
  variant: i[o].text,
134
136
  colorName: b[n].colorName,
135
137
  textOverflow: "ellipsis",
136
- className: h,
138
+ left: r === "left",
139
+ center: r === "center",
140
+ right: r === "right",
141
+ flex: t ? 1 : void 0,
142
+ className: C,
137
143
  children: d
138
144
  }
139
145
  ),
140
- s && /* @__PURE__ */ a("span", { className: y, children: s }),
141
- x && !c && /* @__PURE__ */ a(
142
- w,
146
+ c && /* @__PURE__ */ a("span", { className: w, children: c }),
147
+ f && !x && /* @__PURE__ */ a(
148
+ h,
143
149
  {
144
- className: v(j, S),
150
+ className: y(I, S),
145
151
  colorName: b[n].colorName,
146
- onClick: (f) => {
147
- f.stopPropagation(), x(f);
152
+ onClick: (v) => {
153
+ v.stopPropagation(), f(v);
148
154
  },
149
- children: /* @__PURE__ */ a(k, {})
155
+ children: /* @__PURE__ */ a(B, {})
150
156
  }
151
157
  )
152
158
  ]
153
159
  }
154
160
  );
155
161
  };
156
- I.displayName = "Badge";
162
+ O.displayName = "Badge";
157
163
  export {
158
- I as Badge
164
+ O as Badge
159
165
  };