skillgrid 0.0.91 → 0.0.93
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.
- package/dist/assets/components/Notification/Notification.module-BVePCO8H.css +1 -0
- package/dist/components/Notification/Notification.d.ts +7 -0
- package/dist/components/Notification/Notification.i18n.json.d.ts +17 -0
- package/dist/components/Notification/Notification.i18n.json.js +9 -0
- package/dist/components/Notification/Notification.js +299 -0
- package/dist/components/Notification/Notification.module.css.js +72 -0
- package/dist/components/Notification/Notification.type.d.ts +146 -0
- package/dist/components/Notification/NotificationControls.d.ts +21 -0
- package/dist/components/Notification/NotificationControls.js +70 -0
- package/dist/components/Notification/index.d.ts +2 -0
- package/dist/components/Notification/lib/guidelinesReferenceContent.d.ts +34 -0
- package/dist/components/Notification/lib/index.d.ts +2 -0
- package/dist/components/Notification/lib/notificationStyleConfig.d.ts +16 -0
- package/dist/components/Notification/lib/notificationStyleConfig.js +41 -0
- package/dist/components/Notification/lib/referenceGuidelinesGeometry.d.ts +19 -0
- package/dist/components/Notification/lib/referenceGuidelinesGeometry.js +24 -0
- package/dist/components/Notification/lib/referenceGuidelinesGeometry.test.d.ts +1 -0
- package/dist/index.cjs.js +4 -4
- package/dist/index.css +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.es.js +22 -20
- package/dist/locale/en_US.d.ts +4 -0
- package/dist/locale/en_US.js +6 -4
- package/dist/locale/extendLocale.js +12 -8
- package/dist/locale/index.d.ts +1 -1
- package/dist/locale/ru_RU.d.ts +4 -0
- package/dist/locale/ru_RU.js +4 -2
- package/dist/locale/type.d.ts +6 -0
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
:root{--ease-in-out: cubic-bezier(.4, .24, 0, 1);--duration-100: .1s;--duration-300: .3s;--duration-400: .4s;--duration-500: .5s}._semantic-animation_y2jij_1{transition-property:transform,opacity;transition-timing-function:var(--ease-in-out)}._semantic-animation--100_y2jij_1{transition-duration:var(--duration-100)}._semantic-animation--300_y2jij_1{transition-duration:var(--duration-300)}._semantic-animation--400_y2jij_1{transition-duration:var(--duration-400)}._semantic-animation--500_y2jij_1{transition-duration:var(--duration-500)}._notification_y2jij_3{--notification-padding: 1rem;--notification-gap: 1rem;--notification-radius: .75rem;--notification-icon-padding: .5rem;--notification-actions-gap: .75rem;display:flex;gap:var(--notification-gap);align-items:flex-start;box-sizing:border-box;width:100%;padding:var(--notification-padding);background:var(--notification-bg, var(--bg-primary));border:none;border-radius:var(--notification-radius);box-shadow:var(--shadow-medium)}._notification_y2jij_3._desktop_y2jij_24{max-width:25rem}._notification_y2jij_3._mobile_y2jij_28{max-width:20.375rem}._notification_y2jij_3._mobile_y2jij_28._narrow_y2jij_32{max-width:17.9375rem}._entering_y2jij_36{will-change:transform,opacity;animation-name:_notificationEnter_y2jij_1;animation-duration:var(--duration-300);animation-timing-function:var(--ease-in-out);animation-fill-mode:both}._exiting_y2jij_45{will-change:transform,opacity;animation-name:_notificationExit_y2jij_1;animation-duration:var(--duration-300);animation-timing-function:var(--ease-in-out);animation-fill-mode:both}@media (prefers-reduced-motion: reduce){._entering_y2jij_36,._exiting_y2jij_45{animation:none}}._iconSlot_y2jij_61{display:flex;flex-shrink:0;align-items:center;justify-content:center;padding:var(--notification-icon-padding);color:var(--notification-icon-color);background:var(--notification-icon-bg);border-radius:50%}._iconSlotInner_y2jij_75{display:flex;flex-shrink:0;align-items:center;justify-content:center;width:var(--notification-icon-size, 1rem);height:var(--notification-icon-size, 1rem)}._iconSlotInner_y2jij_75>*{display:flex;align-items:center;justify-content:center}._content_y2jij_91{display:flex;flex:1;flex-direction:column;gap:var(--notification-gap);min-width:0}._header_y2jij_100{display:flex;gap:.5rem;align-items:flex-start;justify-content:space-between}._title_y2jij_107{flex:1;min-width:0;margin:0;color:var(--text-primary)}._collapseToggle_y2jij_114{cursor:pointer;display:block;flex:1;min-width:0;margin:0;padding:0;color:var(--text-primary);text-align:left;-webkit-appearance:none;-moz-appearance:none;appearance:none;background:transparent;border:none}._body_y2jij_132{margin:0;color:var(--text-secondary);word-break:break-word}._bodyCollapsed_y2jij_138{display:none}._controls_y2jij_142{display:flex;flex-shrink:0;gap:.25rem;align-items:center}._actions_y2jij_149{display:flex;flex-wrap:wrap;gap:var(--notification-actions-gap);align-items:center}._linkRow_y2jij_156{display:flex;flex-wrap:wrap}._referenceComposition_y2jij_161 ._content_y2jij_91{gap:.75rem}._referenceTextStack_y2jij_165{display:flex;flex:1;flex-direction:column;gap:.25rem;min-width:0}._referenceTopRow_y2jij_174{display:flex;gap:.5rem;align-items:flex-start;justify-content:space-between}._referenceControlsColumn_y2jij_181{flex-direction:column;align-items:flex-end;align-self:stretch;justify-content:space-between}._referenceRootAside_y2jij_188{flex-shrink:0}._referenceGuidelines326_y2jij_193{--notification-padding: 13.04px;--notification-gap: .625rem;--notification-icon-padding: 6.52px;--notification-icon-size: .8125rem;--notification-actions-gap: .625rem}._referenceGuidelines287_y2jij_201{--notification-padding: 11.48px;--notification-gap: .5rem;--notification-icon-padding: 5.74px;--notification-icon-size: .75rem;--notification-actions-gap: .5rem}._referenceGuidelines326_y2jij_193 ._iconSlotInner_y2jij_75>*,._referenceGuidelines287_y2jij_201 ._iconSlotInner_y2jij_75>*{transform-origin:center center;transform:scale(calc(var(--notification-icon-size) / 1rem))}._referenceGeometry32611573_y2jij_220,._referenceGeometry3268034_y2jij_221{width:326px;max-width:326px}._referenceGeometry28794925_y2jij_226,._referenceGeometry28770315_y2jij_227{width:287px;max-width:287px}._referenceGeometry400142_y2jij_232{width:400px;max-width:400px}@keyframes _notificationEnter_y2jij_1{0%{transform:translateY(-.5rem) scale(.98);opacity:0}to{transform:translateY(0) scale(1);opacity:1}}@keyframes _notificationExit_y2jij_1{0%{transform:translateY(0) scale(1);opacity:1}to{transform:translateY(-.5rem) scale(.98);opacity:0}}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ForwardRefExoticComponent, RefAttributes } from 'react';
|
|
2
|
+
import { NotificationProps } from './Notification.type';
|
|
3
|
+
/**
|
|
4
|
+
* Публичный тип — без reference props.
|
|
5
|
+
* Reference props остаются runtime-capable через {@link NotificationComponentProps} в stories/tests.
|
|
6
|
+
*/
|
|
7
|
+
export declare const Notification: ForwardRefExoticComponent<NotificationProps & RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,299 @@
|
|
|
1
|
+
import { jsxs as s, jsx as o, Fragment as J } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as Le, useState as L, useCallback as W, useRef as Ae, useEffect as K } from "react";
|
|
3
|
+
import { clsx as r } from "clsx";
|
|
4
|
+
import Ie from "../../styles/typography.module.css.js";
|
|
5
|
+
import { resolveReferenceGuidelinesGeometry as Re } from "./lib/referenceGuidelinesGeometry.js";
|
|
6
|
+
import { NotificationControls as Y } from "./NotificationControls.js";
|
|
7
|
+
import t from "./Notification.module.css.js";
|
|
8
|
+
import { useLocale as we } from "../ConfigProvider/ConfigProvider.hook.js";
|
|
9
|
+
import { NOTIFICATION_STYLE_CONFIG as ve, ASSERTIVE_NOTIFICATION_STYLES as xe } from "./lib/notificationStyleConfig.js";
|
|
10
|
+
import { Typography as A } from "../Typography/Typography.js";
|
|
11
|
+
import { Button as j } from "../Button/Button.js";
|
|
12
|
+
const Ge = {
|
|
13
|
+
"326-11573": t.referenceGeometry32611573,
|
|
14
|
+
"287-94925": t.referenceGeometry28794925,
|
|
15
|
+
"400-142": t.referenceGeometry400142,
|
|
16
|
+
"287-70315": t.referenceGeometry28770315,
|
|
17
|
+
"326-8034": t.referenceGeometry3268034
|
|
18
|
+
}, Oe = 300, P = 16, ke = 16;
|
|
19
|
+
function ee() {
|
|
20
|
+
return typeof window > "u" ? !1 : window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
21
|
+
}
|
|
22
|
+
function Q() {
|
|
23
|
+
return ee() ? 0 : Oe;
|
|
24
|
+
}
|
|
25
|
+
const te = Le((oe, ne) => {
|
|
26
|
+
const {
|
|
27
|
+
platform: I = "desktop",
|
|
28
|
+
style: R = "neutral",
|
|
29
|
+
showButton: ie = !0,
|
|
30
|
+
collapse: re = !1,
|
|
31
|
+
open: U,
|
|
32
|
+
onOpenChange: p,
|
|
33
|
+
referenceComposition: w = !1,
|
|
34
|
+
referenceControlsColumn: v = !1,
|
|
35
|
+
referenceGuidelinesScale: x,
|
|
36
|
+
title: l,
|
|
37
|
+
body: m,
|
|
38
|
+
width: le = "default",
|
|
39
|
+
showClose: d = !0,
|
|
40
|
+
showCopy: f = !1,
|
|
41
|
+
onClose: y,
|
|
42
|
+
onCopy: G,
|
|
43
|
+
closeAriaLabel: ae,
|
|
44
|
+
copyAriaLabel: ce,
|
|
45
|
+
primaryAction: a,
|
|
46
|
+
secondaryAction: c,
|
|
47
|
+
linkProps: Z,
|
|
48
|
+
className: se,
|
|
49
|
+
classNames: e,
|
|
50
|
+
rootStyle: de,
|
|
51
|
+
"data-testid": n = "notification",
|
|
52
|
+
...h
|
|
53
|
+
} = oe, { notification: q } = we(), O = ae ?? q.close, k = ce ?? q.copy, b = ve[R], fe = b.icon, N = U !== void 0, [ue, pe] = L(!1), _ = N ? U : ue, me = W(
|
|
54
|
+
(i) => {
|
|
55
|
+
N || pe(i), p == null || p(i);
|
|
56
|
+
},
|
|
57
|
+
[N, p]
|
|
58
|
+
), z = !!(re && l), B = !z || _, V = xe.includes(R), ye = z, X = w && !!l && !!m && !z, he = X && !v && (d || f), [g, S] = L(() => !ee()), [u, be] = L(!1), [ge, Se] = L(!0), C = Ae(null), T = W(() => {
|
|
59
|
+
C.current && (clearTimeout(C.current), C.current = null);
|
|
60
|
+
}, []);
|
|
61
|
+
K(() => T, [T]), K(() => {
|
|
62
|
+
if (!g) return;
|
|
63
|
+
const i = Q();
|
|
64
|
+
if (i === 0) {
|
|
65
|
+
S(!1);
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
const E = setTimeout(() => S(!1), i);
|
|
69
|
+
return () => clearTimeout(E);
|
|
70
|
+
}, [g]);
|
|
71
|
+
const Ce = (i) => {
|
|
72
|
+
i.target === i.currentTarget && g && !u && S(!1);
|
|
73
|
+
}, M = W(() => {
|
|
74
|
+
u || (S(!1), be(!0), T(), C.current = setTimeout(() => {
|
|
75
|
+
Se(!1), y == null || y();
|
|
76
|
+
}, Q()));
|
|
77
|
+
}, [T, u, y]), Te = () => {
|
|
78
|
+
me(!_);
|
|
79
|
+
}, D = ie && B && ((a == null ? void 0 : a.children) || (c == null ? void 0 : c.children)), H = !!Z, $ = Re({
|
|
80
|
+
referenceComposition: w,
|
|
81
|
+
referenceGuidelinesScale: x,
|
|
82
|
+
referenceControlsColumn: v,
|
|
83
|
+
hasActions: !!D,
|
|
84
|
+
hasLink: !!H
|
|
85
|
+
}), Ee = {
|
|
86
|
+
...de,
|
|
87
|
+
"--notification-bg": b.background,
|
|
88
|
+
"--notification-icon-color": b.iconColor,
|
|
89
|
+
"--notification-icon-bg": b.iconBackground
|
|
90
|
+
}, F = r(
|
|
91
|
+
t.title,
|
|
92
|
+
Ie["typography-subtitle-1-semibold"],
|
|
93
|
+
e == null ? void 0 : e.title
|
|
94
|
+
);
|
|
95
|
+
return ge ? /* @__PURE__ */ s(
|
|
96
|
+
"div",
|
|
97
|
+
{
|
|
98
|
+
ref: ne,
|
|
99
|
+
role: V ? "alert" : "status",
|
|
100
|
+
"aria-live": V ? "assertive" : "polite",
|
|
101
|
+
"aria-atomic": "true",
|
|
102
|
+
"data-testid": n,
|
|
103
|
+
"data-style": R,
|
|
104
|
+
"data-platform": I,
|
|
105
|
+
"data-expanded": B ? "true" : "false",
|
|
106
|
+
"data-reference-geometry": $,
|
|
107
|
+
className: r(
|
|
108
|
+
t.notification,
|
|
109
|
+
t[I],
|
|
110
|
+
le === "narrow" && I === "mobile" && t.narrow,
|
|
111
|
+
w && t.referenceComposition,
|
|
112
|
+
x === "326" && t.referenceGuidelines326,
|
|
113
|
+
x === "287" && t.referenceGuidelines287,
|
|
114
|
+
$ && Ge[$],
|
|
115
|
+
g && !u && t.entering,
|
|
116
|
+
u && t.exiting,
|
|
117
|
+
se,
|
|
118
|
+
e == null ? void 0 : e.root
|
|
119
|
+
),
|
|
120
|
+
style: Ee,
|
|
121
|
+
...h,
|
|
122
|
+
onAnimationEnd: (i) => {
|
|
123
|
+
var E;
|
|
124
|
+
(E = h.onAnimationEnd) == null || E.call(h, i), Ce(i);
|
|
125
|
+
},
|
|
126
|
+
children: [
|
|
127
|
+
/* @__PURE__ */ o(
|
|
128
|
+
"div",
|
|
129
|
+
{
|
|
130
|
+
className: r(t.iconSlot, e == null ? void 0 : e.icon),
|
|
131
|
+
"data-testid": `${n}-icon`,
|
|
132
|
+
"aria-hidden": "true",
|
|
133
|
+
children: /* @__PURE__ */ o("span", { className: t.iconSlotInner, children: /* @__PURE__ */ o(
|
|
134
|
+
fe,
|
|
135
|
+
{
|
|
136
|
+
iconSize: ke,
|
|
137
|
+
as: "div",
|
|
138
|
+
style: "none",
|
|
139
|
+
padding: !1
|
|
140
|
+
}
|
|
141
|
+
) })
|
|
142
|
+
}
|
|
143
|
+
),
|
|
144
|
+
/* @__PURE__ */ s("div", { className: r(t.content, e == null ? void 0 : e.content), children: [
|
|
145
|
+
X ? /* @__PURE__ */ o(J, { children: /* @__PURE__ */ s("div", { className: r(t.referenceTopRow, e == null ? void 0 : e.header), children: [
|
|
146
|
+
/* @__PURE__ */ s("div", { className: t.referenceTextStack, children: [
|
|
147
|
+
/* @__PURE__ */ o(
|
|
148
|
+
A.Subtitle,
|
|
149
|
+
{
|
|
150
|
+
as: "h3",
|
|
151
|
+
size: 1,
|
|
152
|
+
fontWeight: "semibold",
|
|
153
|
+
className: F,
|
|
154
|
+
"data-testid": `${n}-title`,
|
|
155
|
+
children: l
|
|
156
|
+
}
|
|
157
|
+
),
|
|
158
|
+
/* @__PURE__ */ o(
|
|
159
|
+
A.Label,
|
|
160
|
+
{
|
|
161
|
+
as: "p",
|
|
162
|
+
size: 3,
|
|
163
|
+
fontWeight: "regular",
|
|
164
|
+
typographyStyle: "secondary",
|
|
165
|
+
className: r(t.body, e == null ? void 0 : e.body),
|
|
166
|
+
"data-testid": `${n}-body`,
|
|
167
|
+
children: m
|
|
168
|
+
}
|
|
169
|
+
)
|
|
170
|
+
] }),
|
|
171
|
+
v && /* @__PURE__ */ o(
|
|
172
|
+
Y,
|
|
173
|
+
{
|
|
174
|
+
showClose: d,
|
|
175
|
+
showCopy: f,
|
|
176
|
+
closeAriaLabel: O,
|
|
177
|
+
copyAriaLabel: k,
|
|
178
|
+
iconSize: P,
|
|
179
|
+
order: "close-first",
|
|
180
|
+
column: !0,
|
|
181
|
+
className: e == null ? void 0 : e.controls,
|
|
182
|
+
dataTestId: n,
|
|
183
|
+
onClose: M,
|
|
184
|
+
onCopy: G
|
|
185
|
+
}
|
|
186
|
+
)
|
|
187
|
+
] }) }) : /* @__PURE__ */ s(J, { children: [
|
|
188
|
+
(l || d || f) && /* @__PURE__ */ s("div", { className: r(t.header, e == null ? void 0 : e.header), children: [
|
|
189
|
+
l && (ye ? /* @__PURE__ */ o(
|
|
190
|
+
"button",
|
|
191
|
+
{
|
|
192
|
+
type: "button",
|
|
193
|
+
className: r(t.collapseToggle, F),
|
|
194
|
+
"aria-expanded": _,
|
|
195
|
+
"data-testid": `${n}-collapse-toggle`,
|
|
196
|
+
onClick: Te,
|
|
197
|
+
children: l
|
|
198
|
+
}
|
|
199
|
+
) : /* @__PURE__ */ o(
|
|
200
|
+
A.Subtitle,
|
|
201
|
+
{
|
|
202
|
+
as: "h3",
|
|
203
|
+
size: 1,
|
|
204
|
+
fontWeight: "semibold",
|
|
205
|
+
className: F,
|
|
206
|
+
"data-testid": `${n}-title`,
|
|
207
|
+
children: l
|
|
208
|
+
}
|
|
209
|
+
)),
|
|
210
|
+
/* @__PURE__ */ o(
|
|
211
|
+
Y,
|
|
212
|
+
{
|
|
213
|
+
showClose: d,
|
|
214
|
+
showCopy: f,
|
|
215
|
+
closeAriaLabel: O,
|
|
216
|
+
copyAriaLabel: k,
|
|
217
|
+
iconSize: P,
|
|
218
|
+
order: "copy-first",
|
|
219
|
+
className: e == null ? void 0 : e.controls,
|
|
220
|
+
dataTestId: n,
|
|
221
|
+
onClose: M,
|
|
222
|
+
onCopy: G
|
|
223
|
+
}
|
|
224
|
+
)
|
|
225
|
+
] }),
|
|
226
|
+
m && /* @__PURE__ */ o(
|
|
227
|
+
A.Label,
|
|
228
|
+
{
|
|
229
|
+
as: "p",
|
|
230
|
+
size: 3,
|
|
231
|
+
fontWeight: "regular",
|
|
232
|
+
typographyStyle: "secondary",
|
|
233
|
+
className: r(
|
|
234
|
+
t.body,
|
|
235
|
+
!B && t.bodyCollapsed,
|
|
236
|
+
e == null ? void 0 : e.body
|
|
237
|
+
),
|
|
238
|
+
"data-testid": `${n}-body`,
|
|
239
|
+
children: m
|
|
240
|
+
}
|
|
241
|
+
)
|
|
242
|
+
] }),
|
|
243
|
+
H && /* @__PURE__ */ o("div", { className: t.linkRow, children: /* @__PURE__ */ o(j.Link, { size: "m", buttonStyle: "accent", ...Z }) }),
|
|
244
|
+
D && /* @__PURE__ */ s(
|
|
245
|
+
"div",
|
|
246
|
+
{
|
|
247
|
+
className: r(t.actions, e == null ? void 0 : e.actions),
|
|
248
|
+
"data-testid": `${n}-actions`,
|
|
249
|
+
children: [
|
|
250
|
+
(c == null ? void 0 : c.children) && /* @__PURE__ */ o(
|
|
251
|
+
j,
|
|
252
|
+
{
|
|
253
|
+
as: "button",
|
|
254
|
+
mode: "tertiary",
|
|
255
|
+
size: "s",
|
|
256
|
+
buttonStyle: "neutral",
|
|
257
|
+
...c
|
|
258
|
+
}
|
|
259
|
+
),
|
|
260
|
+
(a == null ? void 0 : a.children) && /* @__PURE__ */ o(
|
|
261
|
+
j,
|
|
262
|
+
{
|
|
263
|
+
as: "button",
|
|
264
|
+
mode: "secondary",
|
|
265
|
+
size: "s",
|
|
266
|
+
buttonStyle: "neutral",
|
|
267
|
+
...a
|
|
268
|
+
}
|
|
269
|
+
)
|
|
270
|
+
]
|
|
271
|
+
}
|
|
272
|
+
)
|
|
273
|
+
] }),
|
|
274
|
+
he && /* @__PURE__ */ o(
|
|
275
|
+
Y,
|
|
276
|
+
{
|
|
277
|
+
showClose: d,
|
|
278
|
+
showCopy: f,
|
|
279
|
+
closeAriaLabel: O,
|
|
280
|
+
copyAriaLabel: k,
|
|
281
|
+
iconSize: P,
|
|
282
|
+
order: "close-first",
|
|
283
|
+
column: !0,
|
|
284
|
+
aside: !0,
|
|
285
|
+
className: e == null ? void 0 : e.controls,
|
|
286
|
+
dataTestId: n,
|
|
287
|
+
onClose: M,
|
|
288
|
+
onCopy: G
|
|
289
|
+
}
|
|
290
|
+
)
|
|
291
|
+
]
|
|
292
|
+
}
|
|
293
|
+
) : null;
|
|
294
|
+
});
|
|
295
|
+
te.displayName = "Notification";
|
|
296
|
+
const Ue = te;
|
|
297
|
+
export {
|
|
298
|
+
Ue as Notification
|
|
299
|
+
};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import '../../assets/components/Notification/Notification.module-BVePCO8H.css';const e = "_notification_y2jij_3", n = "_desktop_y2jij_24", o = "_mobile_y2jij_28", i = "_narrow_y2jij_32", t = "_entering_y2jij_36", r = "_notificationEnter_y2jij_1", c = "_exiting_y2jij_45", _ = "_notificationExit_y2jij_1", s = "_iconSlot_y2jij_61", j = "_iconSlotInner_y2jij_75", a = "_content_y2jij_91", y = "_header_y2jij_100", f = "_title_y2jij_107", l = "_collapseToggle_y2jij_114", m = "_body_y2jij_132", d = "_bodyCollapsed_y2jij_138", G = "_controls_y2jij_142", p = "_actions_y2jij_149", g = "_linkRow_y2jij_156", C = "_referenceComposition_y2jij_161", u = "_referenceTextStack_y2jij_165", x = "_referenceTopRow_y2jij_174", b = "_referenceControlsColumn_y2jij_181", k = "_referenceRootAside_y2jij_188", w = "_referenceGuidelines326_y2jij_193", R = "_referenceGuidelines287_y2jij_201", S = "_referenceGeometry32611573_y2jij_220", T = "_referenceGeometry3268034_y2jij_221", E = "_referenceGeometry28794925_y2jij_226", h = "_referenceGeometry28770315_y2jij_227", A = "_referenceGeometry400142_y2jij_232", I = {
|
|
2
|
+
"semantic-animation": "_semantic-animation_y2jij_1",
|
|
3
|
+
"semantic-animation--100": "_semantic-animation--100_y2jij_1",
|
|
4
|
+
"semantic-animation--300": "_semantic-animation--300_y2jij_1",
|
|
5
|
+
"semantic-animation--400": "_semantic-animation--400_y2jij_1",
|
|
6
|
+
"semantic-animation--500": "_semantic-animation--500_y2jij_1",
|
|
7
|
+
notification: e,
|
|
8
|
+
desktop: n,
|
|
9
|
+
mobile: o,
|
|
10
|
+
narrow: i,
|
|
11
|
+
entering: t,
|
|
12
|
+
notificationEnter: r,
|
|
13
|
+
exiting: c,
|
|
14
|
+
notificationExit: _,
|
|
15
|
+
iconSlot: s,
|
|
16
|
+
iconSlotInner: j,
|
|
17
|
+
content: a,
|
|
18
|
+
header: y,
|
|
19
|
+
title: f,
|
|
20
|
+
collapseToggle: l,
|
|
21
|
+
body: m,
|
|
22
|
+
bodyCollapsed: d,
|
|
23
|
+
controls: G,
|
|
24
|
+
actions: p,
|
|
25
|
+
linkRow: g,
|
|
26
|
+
referenceComposition: C,
|
|
27
|
+
referenceTextStack: u,
|
|
28
|
+
referenceTopRow: x,
|
|
29
|
+
referenceControlsColumn: b,
|
|
30
|
+
referenceRootAside: k,
|
|
31
|
+
referenceGuidelines326: w,
|
|
32
|
+
referenceGuidelines287: R,
|
|
33
|
+
referenceGeometry32611573: S,
|
|
34
|
+
referenceGeometry3268034: T,
|
|
35
|
+
referenceGeometry28794925: E,
|
|
36
|
+
referenceGeometry28770315: h,
|
|
37
|
+
referenceGeometry400142: A
|
|
38
|
+
};
|
|
39
|
+
export {
|
|
40
|
+
p as actions,
|
|
41
|
+
m as body,
|
|
42
|
+
d as bodyCollapsed,
|
|
43
|
+
l as collapseToggle,
|
|
44
|
+
a as content,
|
|
45
|
+
G as controls,
|
|
46
|
+
I as default,
|
|
47
|
+
n as desktop,
|
|
48
|
+
t as entering,
|
|
49
|
+
c as exiting,
|
|
50
|
+
y as header,
|
|
51
|
+
s as iconSlot,
|
|
52
|
+
j as iconSlotInner,
|
|
53
|
+
g as linkRow,
|
|
54
|
+
o as mobile,
|
|
55
|
+
i as narrow,
|
|
56
|
+
e as notification,
|
|
57
|
+
r as notificationEnter,
|
|
58
|
+
_ as notificationExit,
|
|
59
|
+
C as referenceComposition,
|
|
60
|
+
b as referenceControlsColumn,
|
|
61
|
+
h as referenceGeometry28770315,
|
|
62
|
+
E as referenceGeometry28794925,
|
|
63
|
+
S as referenceGeometry32611573,
|
|
64
|
+
T as referenceGeometry3268034,
|
|
65
|
+
A as referenceGeometry400142,
|
|
66
|
+
R as referenceGuidelines287,
|
|
67
|
+
w as referenceGuidelines326,
|
|
68
|
+
k as referenceRootAside,
|
|
69
|
+
u as referenceTextStack,
|
|
70
|
+
x as referenceTopRow,
|
|
71
|
+
f as title
|
|
72
|
+
};
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import { CSSProperties, HTMLAttributes, MouseEventHandler, ReactNode } from 'react';
|
|
2
|
+
import { LinkButtonProps } from '../Button';
|
|
3
|
+
/** Платформа отображения уведомления. */
|
|
4
|
+
export type NotificationPlatform = 'desktop' | 'mobile';
|
|
5
|
+
/** Визуальный стиль уведомления. */
|
|
6
|
+
export type NotificationStyle = 'neutral' | 'positive' | 'warning' | 'error' | 'negative';
|
|
7
|
+
/** Узкие ширины из Figma guidelines (326 / 287 px). */
|
|
8
|
+
export type NotificationWidth = 'default' | 'narrow';
|
|
9
|
+
type NotificationField = 'root' | 'icon' | 'content' | 'header' | 'title' | 'body' | 'actions' | 'controls';
|
|
10
|
+
/** Параметры основной action-кнопки (secondary). */
|
|
11
|
+
export type NotificationPrimaryAction = {
|
|
12
|
+
children?: ReactNode;
|
|
13
|
+
onClick?: MouseEventHandler<HTMLButtonElement>;
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
loading?: boolean;
|
|
16
|
+
'data-testid'?: string;
|
|
17
|
+
};
|
|
18
|
+
/** Параметры дополнительной action-кнопки (tertiary). */
|
|
19
|
+
export type NotificationSecondaryAction = NotificationPrimaryAction;
|
|
20
|
+
/**
|
|
21
|
+
* Публичные props компонента Notification.
|
|
22
|
+
*
|
|
23
|
+
* @interface
|
|
24
|
+
*/
|
|
25
|
+
export interface NotificationProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title' | 'onCopy' | 'style'> {
|
|
26
|
+
/**
|
|
27
|
+
* Платформа: desktop фиксирует max-width 400px, mobile — 326px (или 287px при `width="narrow"`).
|
|
28
|
+
* @default 'desktop'
|
|
29
|
+
*/
|
|
30
|
+
platform?: NotificationPlatform;
|
|
31
|
+
/**
|
|
32
|
+
* Визуальный стиль и семантика иконки/фона.
|
|
33
|
+
* @default 'neutral'
|
|
34
|
+
*/
|
|
35
|
+
style?: NotificationStyle;
|
|
36
|
+
/**
|
|
37
|
+
* Показывать группу action-кнопок в footer.
|
|
38
|
+
* Не скрывает close/copy и link.
|
|
39
|
+
* @default true
|
|
40
|
+
*/
|
|
41
|
+
showButton?: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Компактный режим: body и actions скрыты, пока `open=false`.
|
|
44
|
+
* Без `title` игнорируется (контент остаётся развёрнутым).
|
|
45
|
+
* @default false
|
|
46
|
+
*/
|
|
47
|
+
collapse?: boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Развёрнутое состояние при `collapse=true` и наличии `title`.
|
|
50
|
+
* Игнорируется, если `collapse=false` или нет `title`.
|
|
51
|
+
* @default false
|
|
52
|
+
*/
|
|
53
|
+
open?: boolean;
|
|
54
|
+
/**
|
|
55
|
+
* Callback при смене `open` (раскрытие/сворачивание).
|
|
56
|
+
* Без `open` при активном collapse используется внутреннее состояние (uncontrolled).
|
|
57
|
+
* С переданным `open` состояние полностью controlled снаружи.
|
|
58
|
+
* @optional
|
|
59
|
+
*/
|
|
60
|
+
onOpenChange?: (open: boolean) => void;
|
|
61
|
+
/** Заголовок уведомления. */
|
|
62
|
+
title?: ReactNode;
|
|
63
|
+
/** Основной текст уведомления. */
|
|
64
|
+
body?: ReactNode;
|
|
65
|
+
/**
|
|
66
|
+
* Узкая ширина для mobile (287px). На desktop игнорируется.
|
|
67
|
+
* @default 'default'
|
|
68
|
+
*/
|
|
69
|
+
width?: NotificationWidth;
|
|
70
|
+
/**
|
|
71
|
+
* Показывать кнопку закрытия.
|
|
72
|
+
* @default true
|
|
73
|
+
*/
|
|
74
|
+
showClose?: boolean;
|
|
75
|
+
/**
|
|
76
|
+
* Показывать кнопку копирования.
|
|
77
|
+
* @default false
|
|
78
|
+
*/
|
|
79
|
+
showCopy?: boolean;
|
|
80
|
+
/**
|
|
81
|
+
* Вызывается после завершения exit-анимации при закрытии.
|
|
82
|
+
* @optional
|
|
83
|
+
*/
|
|
84
|
+
onClose?: () => void;
|
|
85
|
+
/**
|
|
86
|
+
* Вызывается при нажатии на copy.
|
|
87
|
+
* @optional
|
|
88
|
+
*/
|
|
89
|
+
onCopy?: () => void;
|
|
90
|
+
/**
|
|
91
|
+
* Aria-label для кнопки закрытия.
|
|
92
|
+
* По умолчанию из ConfigProvider locale (`notification.close`).
|
|
93
|
+
*/
|
|
94
|
+
closeAriaLabel?: string;
|
|
95
|
+
/**
|
|
96
|
+
* Aria-label для кнопки копирования.
|
|
97
|
+
* По умолчанию из ConfigProvider locale (`notification.copy`).
|
|
98
|
+
*/
|
|
99
|
+
copyAriaLabel?: string;
|
|
100
|
+
/**
|
|
101
|
+
* Основная action-кнопка (Button secondary, size s — 32px).
|
|
102
|
+
* @optional
|
|
103
|
+
*/
|
|
104
|
+
primaryAction?: NotificationPrimaryAction;
|
|
105
|
+
/**
|
|
106
|
+
* Дополнительная action-кнопка (Button tertiary, size s — 32px).
|
|
107
|
+
* @optional
|
|
108
|
+
*/
|
|
109
|
+
secondaryAction?: NotificationSecondaryAction;
|
|
110
|
+
/**
|
|
111
|
+
* Ссылка под текстом (Button.Link).
|
|
112
|
+
* @optional
|
|
113
|
+
*/
|
|
114
|
+
linkProps?: LinkButtonProps;
|
|
115
|
+
/** CSS-классы для частей компонента. */
|
|
116
|
+
classNames?: Partial<Record<NotificationField, string>>;
|
|
117
|
+
/** Inline-стили корневого контейнера (не путать с prop `style`). */
|
|
118
|
+
rootStyle?: CSSProperties;
|
|
119
|
+
/** data-testid корневого элемента. @default 'notification' */
|
|
120
|
+
'data-testid'?: string;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Internal / Storybook / Visual QA props.
|
|
124
|
+
* Не входят в публичный `NotificationProps` и не экспортируются из package index.
|
|
125
|
+
*
|
|
126
|
+
* @internal
|
|
127
|
+
*/
|
|
128
|
+
export type NotificationReferenceProps = {
|
|
129
|
+
/**
|
|
130
|
+
* Компоновка guidelines/Figma reference: title+body в одном stack.
|
|
131
|
+
* @default false
|
|
132
|
+
*/
|
|
133
|
+
referenceComposition?: boolean;
|
|
134
|
+
/**
|
|
135
|
+
* В referenceComposition: close/copy в колонке справа (Figma 326×80.34).
|
|
136
|
+
* @default false
|
|
137
|
+
*/
|
|
138
|
+
referenceControlsColumn?: boolean;
|
|
139
|
+
/**
|
|
140
|
+
* Масштаб guidelines instance (padding/типографика/controls + fixed geometry).
|
|
141
|
+
*/
|
|
142
|
+
referenceGuidelinesScale?: 'desktop' | '326' | '287';
|
|
143
|
+
};
|
|
144
|
+
/** Полные props реализации (публичные + reference). @internal */
|
|
145
|
+
export type NotificationComponentProps = NotificationProps & NotificationReferenceProps;
|
|
146
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export type NotificationControlsProps = {
|
|
2
|
+
showClose: boolean;
|
|
3
|
+
showCopy: boolean;
|
|
4
|
+
closeAriaLabel: string;
|
|
5
|
+
copyAriaLabel: string;
|
|
6
|
+
iconSize?: number;
|
|
7
|
+
/** Порядок: close→copy (reference column) или copy→close (header). */
|
|
8
|
+
order?: 'close-first' | 'copy-first';
|
|
9
|
+
column?: boolean;
|
|
10
|
+
aside?: boolean;
|
|
11
|
+
className?: string;
|
|
12
|
+
dataTestId: string;
|
|
13
|
+
onClose: () => void;
|
|
14
|
+
onCopy?: () => void;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Кнопки close/copy уведомления.
|
|
18
|
+
*
|
|
19
|
+
* @param props - {@link NotificationControlsProps}
|
|
20
|
+
*/
|
|
21
|
+
export declare function NotificationControls({ showClose, showCopy, closeAriaLabel, copyAriaLabel, iconSize, order, column, aside, className, dataTestId, onClose, onCopy, }: NotificationControlsProps): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { jsx as t, jsxs as c, Fragment as d } from "react/jsx-runtime";
|
|
2
|
+
import { clsx as C } from "clsx";
|
|
3
|
+
import { CrossOutlined as g, CopyOutlined as j } from "../Icon/categories/general.js";
|
|
4
|
+
import e from "./Notification.module.css.js";
|
|
5
|
+
function $({
|
|
6
|
+
showClose: r,
|
|
7
|
+
showCopy: o,
|
|
8
|
+
closeAriaLabel: u,
|
|
9
|
+
copyAriaLabel: f,
|
|
10
|
+
iconSize: l = 16,
|
|
11
|
+
order: m = "copy-first",
|
|
12
|
+
column: p = !1,
|
|
13
|
+
aside: y = !1,
|
|
14
|
+
className: b,
|
|
15
|
+
dataTestId: n,
|
|
16
|
+
onClose: x,
|
|
17
|
+
onCopy: i
|
|
18
|
+
}) {
|
|
19
|
+
if (!r && !o)
|
|
20
|
+
return null;
|
|
21
|
+
const s = r ? /* @__PURE__ */ t(
|
|
22
|
+
g,
|
|
23
|
+
{
|
|
24
|
+
as: "button",
|
|
25
|
+
type: "button",
|
|
26
|
+
iconSize: l,
|
|
27
|
+
mode: "tertiary",
|
|
28
|
+
style: "neutral",
|
|
29
|
+
padding: 4,
|
|
30
|
+
"aria-label": u,
|
|
31
|
+
"data-testid": `${n}-close`,
|
|
32
|
+
onClick: x
|
|
33
|
+
}
|
|
34
|
+
) : null, a = o ? /* @__PURE__ */ t(
|
|
35
|
+
j,
|
|
36
|
+
{
|
|
37
|
+
as: "button",
|
|
38
|
+
type: "button",
|
|
39
|
+
iconSize: l,
|
|
40
|
+
mode: "tertiary",
|
|
41
|
+
style: "neutral",
|
|
42
|
+
padding: 6,
|
|
43
|
+
"aria-label": f,
|
|
44
|
+
"data-testid": `${n}-copy`,
|
|
45
|
+
disabled: !i,
|
|
46
|
+
onClick: i
|
|
47
|
+
}
|
|
48
|
+
) : null;
|
|
49
|
+
return /* @__PURE__ */ t(
|
|
50
|
+
"div",
|
|
51
|
+
{
|
|
52
|
+
className: C(
|
|
53
|
+
e.controls,
|
|
54
|
+
p && e.referenceControlsColumn,
|
|
55
|
+
y && e.referenceRootAside,
|
|
56
|
+
b
|
|
57
|
+
),
|
|
58
|
+
children: m === "close-first" ? /* @__PURE__ */ c(d, { children: [
|
|
59
|
+
s,
|
|
60
|
+
a
|
|
61
|
+
] }) : /* @__PURE__ */ c(d, { children: [
|
|
62
|
+
a,
|
|
63
|
+
s
|
|
64
|
+
] })
|
|
65
|
+
}
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
export {
|
|
69
|
+
$ as NotificationControls
|
|
70
|
+
};
|