@cloud-ru/ds-ai-icon-giga 1.0.0
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/CHANGELOG.md +8 -0
- package/LICENSE +201 -0
- package/README.md +103 -0
- package/dist/cjs/AiIconGiga.d.ts +29 -0
- package/dist/cjs/AiIconGiga.js +21 -0
- package/dist/cjs/constants.d.ts +80 -0
- package/dist/cjs/constants.js +53 -0
- package/dist/cjs/index.d.ts +3 -0
- package/dist/cjs/index.js +9 -0
- package/dist/cjs/package.json +3 -0
- package/dist/cjs/style.css +5 -0
- package/dist/cjs/styles.module.css +5 -0
- package/dist/esm/AiIconGiga.d.ts +29 -0
- package/dist/esm/AiIconGiga.js +15 -0
- package/dist/esm/constants.d.ts +80 -0
- package/dist/esm/constants.js +50 -0
- package/dist/esm/index.d.ts +3 -0
- package/dist/esm/index.js +2 -0
- package/dist/esm/style.css +5 -0
- package/dist/esm/styles.module.css +5 -0
- package/dist/tsconfig.cjs.tsbuildinfo +1 -0
- package/dist/tsconfig.esm.tsbuildinfo +1 -0
- package/package.json +42 -0
- package/src/AiIconGiga.tsx +82 -0
- package/src/constants.ts +59 -0
- package/src/index.ts +3 -0
- package/src/styles.module.scss +7 -0
package/CHANGELOG.md
ADDED
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2023 Cloud technology Limited (Ltd.)
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
# AiIconGiga
|
|
2
|
+
|
|
3
|
+
`@cloud-ru/ds-ai-icon-giga` — Иконка-логотип GigaChat в монохроме и брендовых градиентах для тёмного и светлого фона.
|
|
4
|
+
|
|
5
|
+
`AiIconGiga` — иконка-логотип GigaChat из набора AI Components. Рендерится как `<svg>` и переиспользуется в составных компонентах стриминга. Поддерживает монохромный вариант (`neutral`) и два брендовых градиента — для тёмного и светлого фона.
|
|
6
|
+
|
|
7
|
+
## Когда использовать
|
|
8
|
+
|
|
9
|
+
- Маркировка GigaChat-сценариев в стриминг-компонентах (заголовки чатов, превью генераций, аватары ассистента).
|
|
10
|
+
- Брендовый акцент рядом с AI-функциональностью.
|
|
11
|
+
|
|
12
|
+
### Когда не нужен
|
|
13
|
+
|
|
14
|
+
- Произвольная интерфейсная иконка:
|
|
15
|
+
- используйте `@cloud-ru/ds-icons`.
|
|
16
|
+
- Кликабельный триггер:
|
|
17
|
+
- оборачивайте `AiIconGiga` в `@cloud-ru/ds-button` или ставьте обработчик на родителя.
|
|
18
|
+
|
|
19
|
+
## Анатомия
|
|
20
|
+
|
|
21
|
+
### Variant (default `neutral`)
|
|
22
|
+
|
|
23
|
+
- `neutral` — монохром через `currentColor` (по умолчанию вторичный текстовый токен). Цвет наследуется от родителя.
|
|
24
|
+
- `logoDark` — брендовый зелёно-голубой градиент, рассчитанный на тёмный фон.
|
|
25
|
+
- `logoLight` — брендовый градиент, рассчитанный на светлый фон.
|
|
26
|
+
|
|
27
|
+
### Size (default `80`)
|
|
28
|
+
|
|
29
|
+
Квадратный размер в пикселях. Глиф логотипа центрирован с отступом 12.5% от размера бокса.
|
|
30
|
+
|
|
31
|
+
## Установка
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
pnpm add @cloud-ru/ds-ai-icon-giga
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
```ts
|
|
38
|
+
import { AiIconGiga } from '@cloud-ru/ds-ai-icon-giga'
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Примеры использования
|
|
42
|
+
|
|
43
|
+
### Neutral
|
|
44
|
+
|
|
45
|
+
Монохром через currentColor
|
|
46
|
+
|
|
47
|
+
```tsx
|
|
48
|
+
import { AiIconGiga, VARIANT } from '@cloud-ru/ds-ai-icon-giga';
|
|
49
|
+
|
|
50
|
+
export function Neutral() {
|
|
51
|
+
return <AiIconGiga variant={VARIANT.Neutral} />;
|
|
52
|
+
}
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### Branded
|
|
56
|
+
|
|
57
|
+
Брендовые градиенты logoLight / logoDark
|
|
58
|
+
|
|
59
|
+
```tsx
|
|
60
|
+
import { AiIconGiga, VARIANT } from '@cloud-ru/ds-ai-icon-giga';
|
|
61
|
+
|
|
62
|
+
export function Branded() {
|
|
63
|
+
return (
|
|
64
|
+
<div style={{ display: 'flex', gap: 12, flexWrap: 'wrap', alignItems: 'center' }}>
|
|
65
|
+
<AiIconGiga variant={VARIANT.LogoLight} />
|
|
66
|
+
<AiIconGiga variant={VARIANT.LogoDark} />
|
|
67
|
+
</div>
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### Sizes
|
|
73
|
+
|
|
74
|
+
Настраиваемый размер через `size`
|
|
75
|
+
|
|
76
|
+
```tsx
|
|
77
|
+
import { AiIconGiga } from '@cloud-ru/ds-ai-icon-giga';
|
|
78
|
+
|
|
79
|
+
export function Sizes() {
|
|
80
|
+
return (
|
|
81
|
+
<div style={{ display: 'flex', gap: 12, flexWrap: 'wrap', alignItems: 'center' }}>
|
|
82
|
+
<AiIconGiga size={24} />
|
|
83
|
+
<AiIconGiga size={48} />
|
|
84
|
+
<AiIconGiga size={80} />
|
|
85
|
+
</div>
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## Props
|
|
91
|
+
|
|
92
|
+
**AiIconGigaProps**
|
|
93
|
+
|
|
94
|
+
| Prop | Type | Default | Description |
|
|
95
|
+
|------|------|---------|-------------|
|
|
96
|
+
| `className` | `string` | — | Доп. класс корня. |
|
|
97
|
+
| `data-test-id` | `string` | `ai-icon-giga` | |
|
|
98
|
+
| `size` | `number` | `80` | Размер иконки в px (квадрат). По умолчанию `80`. |
|
|
99
|
+
| `variant` | `"logoDark"` \| `"logoLight"` \| `"neutral"` | `neutral` | Вариант логотипа GigaChat: <br/> - `neutral` — монохром (`currentColor`, по умолчанию вторичный текстовый токен); <br/> - `logoDark` — брендовый градиент для тёмного фона; <br/> - `logoLight` — брендовый градиент для светлого фона. <br/> По умолчанию `neutral`. |
|
|
100
|
+
|
|
101
|
+
#### Related types
|
|
102
|
+
|
|
103
|
+
- `AiIconGigaVariant` = `"logoDark"` \| `"logoLight"` \| `"neutral"`
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { ValueOf, WithSupportProps } from '@cloud-ru/ds-utils';
|
|
2
|
+
import { ComponentPropsWithoutRef, ReactElement } from 'react';
|
|
3
|
+
import { VARIANT } from './constants';
|
|
4
|
+
export type AiIconGigaVariant = ValueOf<typeof VARIANT>;
|
|
5
|
+
export type AiIconGigaOwnProps = {
|
|
6
|
+
/**
|
|
7
|
+
* Вариант логотипа GigaChat:
|
|
8
|
+
* - `neutral` — монохром (`currentColor`, по умолчанию вторичный текстовый токен);
|
|
9
|
+
* - `logoDark` — брендовый градиент для тёмного фона;
|
|
10
|
+
* - `logoLight` — брендовый градиент для светлого фона.
|
|
11
|
+
* По умолчанию `neutral`.
|
|
12
|
+
*/
|
|
13
|
+
variant?: AiIconGigaVariant;
|
|
14
|
+
/** Размер иконки в px (квадрат). По умолчанию `80`. */
|
|
15
|
+
size?: number;
|
|
16
|
+
/** Доп. класс корня. */
|
|
17
|
+
className?: string;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Публичный props компонента `AiIconGiga`.
|
|
21
|
+
*
|
|
22
|
+
* Иконка-логотип GigaChat из набора AI Components для переиспользования в
|
|
23
|
+
* составных компонентах стриминга. Рендерится как `<svg>`.
|
|
24
|
+
*
|
|
25
|
+
* По умолчанию декоративна (`aria-hidden`). Если иконка несёт смысл —
|
|
26
|
+
* переопределите `aria-hidden={false}` и задайте `aria-label`.
|
|
27
|
+
*/
|
|
28
|
+
export type AiIconGigaProps = WithSupportProps<AiIconGigaOwnProps & Omit<ComponentPropsWithoutRef<'svg'>, keyof AiIconGigaOwnProps | 'children'>>;
|
|
29
|
+
export declare function AiIconGiga({ variant, size, className, 'aria-hidden': ariaHidden, 'data-test-id': dataTestId, ...rest }: AiIconGigaProps): ReactElement;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.AiIconGiga = AiIconGiga;
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const classnames_1 = __importDefault(require("classnames"));
|
|
9
|
+
const react_1 = require("react");
|
|
10
|
+
const constants_1 = require("./constants");
|
|
11
|
+
const styles_module_scss_1 = __importDefault(require('./styles.module.css'));
|
|
12
|
+
const STOPS_BY_VARIANT = {
|
|
13
|
+
[constants_1.VARIANT.LogoDark]: constants_1.LOGO_DARK_STOPS,
|
|
14
|
+
[constants_1.VARIANT.LogoLight]: constants_1.LOGO_LIGHT_STOPS,
|
|
15
|
+
};
|
|
16
|
+
function AiIconGiga({ variant = constants_1.VARIANT.Neutral, size = 80, className, 'aria-hidden': ariaHidden, 'data-test-id': dataTestId = constants_1.TEST_IDS.root, ...rest }) {
|
|
17
|
+
const gradientId = (0, react_1.useId)();
|
|
18
|
+
const isBranded = variant === constants_1.VARIANT.LogoDark || variant === constants_1.VARIANT.LogoLight;
|
|
19
|
+
const stops = isBranded ? STOPS_BY_VARIANT[variant] : undefined;
|
|
20
|
+
return ((0, jsx_runtime_1.jsx)("svg", { ...rest, width: size, height: size, viewBox: '0 0 80 80', fill: 'none', xmlns: 'http://www.w3.org/2000/svg', className: (0, classnames_1.default)(styles_module_scss_1.default.root, className), "aria-hidden": ariaHidden ?? true, "data-variant": variant, "data-test-id": dataTestId, children: (0, jsx_runtime_1.jsxs)("g", { transform: 'translate(10 10)', children: [(0, jsx_runtime_1.jsx)("path", { d: constants_1.GIGA_PATH, fill: isBranded ? `url(#${gradientId})` : 'currentColor' }), stops && ((0, jsx_runtime_1.jsx)("defs", { children: (0, jsx_runtime_1.jsx)("radialGradient", { id: gradientId, ...constants_1.GRADIENT_PARAMS, children: stops.map(({ offset, stopColor }) => ((0, jsx_runtime_1.jsx)("stop", { offset: offset, stopColor: stopColor }, offset))) }) }))] }) }));
|
|
21
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
export declare const TEST_IDS: {
|
|
2
|
+
readonly root: "ai-icon-giga";
|
|
3
|
+
};
|
|
4
|
+
export declare const VARIANT: {
|
|
5
|
+
readonly Neutral: "neutral";
|
|
6
|
+
readonly LogoDark: "logoDark";
|
|
7
|
+
readonly LogoLight: "logoLight";
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Path логотипа GigaChat (viewBox `0 0 60 60`, общий для всех вариантов).
|
|
11
|
+
* Источник — Figma AI-COMPONENTS, node 7404:40178 (экспортированный `d`-атрибут).
|
|
12
|
+
* Это геометрия фигуры (числа и команды path), а не разметка: рендерится через
|
|
13
|
+
* `<path d={...}>`, без `dangerouslySetInnerHTML` — внедрение скриптов невозможно.
|
|
14
|
+
*/
|
|
15
|
+
export declare const GIGA_PATH = "M30 0C13.4301 0 0 13.4323 0 30C0 46.5677 13.4323 60 30 60C46.5677 60 60 46.5677 60 30C60 13.4323 46.5677 0 30 0ZM8.48807 24.5597C8.08633 23.285 8.03248 21.8261 8.32648 20.2327C8.83819 17.6158 10.1646 14.9473 12.162 12.5166L12.1912 12.4807C16.8078 6.3784 24.8403 2.73584 33.6785 2.73584C35.5009 2.73584 37.2941 2.89071 39.0402 3.19593C32.5271 3.79966 25.8121 6.66792 19.0634 11.7311C18.7761 11.9466 18.5921 12.272 18.5584 12.6289C18.5247 12.9857 18.6414 13.3426 18.8838 13.6096C21.0855 16.038 23.2895 18.6931 25.8143 21.9675C26.234 22.5129 27.0038 22.6274 27.5694 22.2256C32.6595 18.5786 37.0764 15.8764 41.3541 13.8049C41.1633 15.9976 38.23 19.3955 35.1642 21.9653C30.2626 25.9782 24.36 30.1504 17.7392 30.6845L17.4811 30.707C16.5071 30.7519 15.459 30.6374 14.3705 30.3681C11.7513 29.697 9.44191 27.41 8.49256 24.562L8.48807 24.5597ZM29.9798 55.9422C23.9695 55.9422 18.4394 53.8909 14.0473 50.4526C14.8867 50.5289 15.7709 50.5671 16.7337 50.5671C17.5395 50.5671 18.4013 50.5401 19.3282 50.4885C24.8044 50.089 30.4646 48.4574 35.6984 45.7754C40.9905 43.062 45.6026 39.3925 49.0432 35.153C51.274 32.3296 53.947 27.9913 54.7056 22.7329C54.7528 22.7979 54.7999 22.8653 54.847 22.9326C55.4979 25.2016 55.848 27.5986 55.848 30.0786C55.848 44.3637 44.2672 55.9445 29.982 55.9445L29.9798 55.9422Z";
|
|
16
|
+
/**
|
|
17
|
+
* Силуэт логотипа GigaChat как CSS `mask-image` (`url("data:image/svg+xml,…")`).
|
|
18
|
+
* Для эффектов, заливающих форму иконки внешним paint'ом (например, ведущая иконка
|
|
19
|
+
* `AiShimmer`): силуэт получает shimmer-покрытие вместо собственного цвета иконки.
|
|
20
|
+
*/
|
|
21
|
+
export declare const GIGA_MASK_IMAGE: string;
|
|
22
|
+
export declare const GRADIENT_PARAMS: {
|
|
23
|
+
readonly cx: "0";
|
|
24
|
+
readonly cy: "0";
|
|
25
|
+
readonly r: "1";
|
|
26
|
+
readonly gradientUnits: "userSpaceOnUse";
|
|
27
|
+
readonly gradientTransform: "translate(39.525 13.0149) scale(55.5181)";
|
|
28
|
+
};
|
|
29
|
+
/** Стопы градиента для тёмного фона (`type='logoDark'`). */
|
|
30
|
+
export declare const LOGO_DARK_STOPS: readonly [{
|
|
31
|
+
readonly offset: "0.08";
|
|
32
|
+
readonly stopColor: "#7CB5F2";
|
|
33
|
+
}, {
|
|
34
|
+
readonly offset: "0.17";
|
|
35
|
+
readonly stopColor: "#78B9EC";
|
|
36
|
+
}, {
|
|
37
|
+
readonly offset: "0.28";
|
|
38
|
+
readonly stopColor: "#70C6DD";
|
|
39
|
+
}, {
|
|
40
|
+
readonly offset: "0.38";
|
|
41
|
+
readonly stopColor: "#64D8C7";
|
|
42
|
+
}, {
|
|
43
|
+
readonly offset: "0.44";
|
|
44
|
+
readonly stopColor: "#5FD7C2";
|
|
45
|
+
}, {
|
|
46
|
+
readonly offset: "0.51";
|
|
47
|
+
readonly stopColor: "#54D5B3";
|
|
48
|
+
}, {
|
|
49
|
+
readonly offset: "0.58";
|
|
50
|
+
readonly stopColor: "#40D39C";
|
|
51
|
+
}, {
|
|
52
|
+
readonly offset: "0.66";
|
|
53
|
+
readonly stopColor: "#26D07C";
|
|
54
|
+
}];
|
|
55
|
+
/** Стопы градиента для светлого фона (`type='logoLight'`). */
|
|
56
|
+
export declare const LOGO_LIGHT_STOPS: readonly [{
|
|
57
|
+
readonly offset: "0.08";
|
|
58
|
+
readonly stopColor: "#58A1EE";
|
|
59
|
+
}, {
|
|
60
|
+
readonly offset: "0.17";
|
|
61
|
+
readonly stopColor: "#5EACE8";
|
|
62
|
+
}, {
|
|
63
|
+
readonly offset: "0.28";
|
|
64
|
+
readonly stopColor: "#5ABDD8";
|
|
65
|
+
}, {
|
|
66
|
+
readonly offset: "0.38";
|
|
67
|
+
readonly stopColor: "#54D4C1";
|
|
68
|
+
}, {
|
|
69
|
+
readonly offset: "0.44";
|
|
70
|
+
readonly stopColor: "#4BD2BB";
|
|
71
|
+
}, {
|
|
72
|
+
readonly offset: "0.51";
|
|
73
|
+
readonly stopColor: "#47D2AD";
|
|
74
|
+
}, {
|
|
75
|
+
readonly offset: "0.58";
|
|
76
|
+
readonly stopColor: "#38D198";
|
|
77
|
+
}, {
|
|
78
|
+
readonly offset: "0.66";
|
|
79
|
+
readonly stopColor: "#24C676";
|
|
80
|
+
}];
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LOGO_LIGHT_STOPS = exports.LOGO_DARK_STOPS = exports.GRADIENT_PARAMS = exports.GIGA_MASK_IMAGE = exports.GIGA_PATH = exports.VARIANT = exports.TEST_IDS = void 0;
|
|
4
|
+
exports.TEST_IDS = {
|
|
5
|
+
root: 'ai-icon-giga',
|
|
6
|
+
};
|
|
7
|
+
exports.VARIANT = {
|
|
8
|
+
Neutral: 'neutral',
|
|
9
|
+
LogoDark: 'logoDark',
|
|
10
|
+
LogoLight: 'logoLight',
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Path логотипа GigaChat (viewBox `0 0 60 60`, общий для всех вариантов).
|
|
14
|
+
* Источник — Figma AI-COMPONENTS, node 7404:40178 (экспортированный `d`-атрибут).
|
|
15
|
+
* Это геометрия фигуры (числа и команды path), а не разметка: рендерится через
|
|
16
|
+
* `<path d={...}>`, без `dangerouslySetInnerHTML` — внедрение скриптов невозможно.
|
|
17
|
+
*/
|
|
18
|
+
exports.GIGA_PATH = 'M30 0C13.4301 0 0 13.4323 0 30C0 46.5677 13.4323 60 30 60C46.5677 60 60 46.5677 60 30C60 13.4323 46.5677 0 30 0ZM8.48807 24.5597C8.08633 23.285 8.03248 21.8261 8.32648 20.2327C8.83819 17.6158 10.1646 14.9473 12.162 12.5166L12.1912 12.4807C16.8078 6.3784 24.8403 2.73584 33.6785 2.73584C35.5009 2.73584 37.2941 2.89071 39.0402 3.19593C32.5271 3.79966 25.8121 6.66792 19.0634 11.7311C18.7761 11.9466 18.5921 12.272 18.5584 12.6289C18.5247 12.9857 18.6414 13.3426 18.8838 13.6096C21.0855 16.038 23.2895 18.6931 25.8143 21.9675C26.234 22.5129 27.0038 22.6274 27.5694 22.2256C32.6595 18.5786 37.0764 15.8764 41.3541 13.8049C41.1633 15.9976 38.23 19.3955 35.1642 21.9653C30.2626 25.9782 24.36 30.1504 17.7392 30.6845L17.4811 30.707C16.5071 30.7519 15.459 30.6374 14.3705 30.3681C11.7513 29.697 9.44191 27.41 8.49256 24.562L8.48807 24.5597ZM29.9798 55.9422C23.9695 55.9422 18.4394 53.8909 14.0473 50.4526C14.8867 50.5289 15.7709 50.5671 16.7337 50.5671C17.5395 50.5671 18.4013 50.5401 19.3282 50.4885C24.8044 50.089 30.4646 48.4574 35.6984 45.7754C40.9905 43.062 45.6026 39.3925 49.0432 35.153C51.274 32.3296 53.947 27.9913 54.7056 22.7329C54.7528 22.7979 54.7999 22.8653 54.847 22.9326C55.4979 25.2016 55.848 27.5986 55.848 30.0786C55.848 44.3637 44.2672 55.9445 29.982 55.9445L29.9798 55.9422Z';
|
|
19
|
+
/**
|
|
20
|
+
* Силуэт логотипа GigaChat как CSS `mask-image` (`url("data:image/svg+xml,…")`).
|
|
21
|
+
* Для эффектов, заливающих форму иконки внешним paint'ом (например, ведущая иконка
|
|
22
|
+
* `AiShimmer`): силуэт получает shimmer-покрытие вместо собственного цвета иконки.
|
|
23
|
+
*/
|
|
24
|
+
exports.GIGA_MASK_IMAGE = `url("data:image/svg+xml,${encodeURIComponent(`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 80 80"><g transform="translate(10 10)"><path d="${exports.GIGA_PATH}"/></g></svg>`)}")`;
|
|
25
|
+
exports.GRADIENT_PARAMS = {
|
|
26
|
+
cx: '0',
|
|
27
|
+
cy: '0',
|
|
28
|
+
r: '1',
|
|
29
|
+
gradientUnits: 'userSpaceOnUse',
|
|
30
|
+
gradientTransform: 'translate(39.525 13.0149) scale(55.5181)',
|
|
31
|
+
};
|
|
32
|
+
/** Стопы градиента для тёмного фона (`type='logoDark'`). */
|
|
33
|
+
exports.LOGO_DARK_STOPS = [
|
|
34
|
+
{ offset: '0.08', stopColor: '#7CB5F2' },
|
|
35
|
+
{ offset: '0.17', stopColor: '#78B9EC' },
|
|
36
|
+
{ offset: '0.28', stopColor: '#70C6DD' },
|
|
37
|
+
{ offset: '0.38', stopColor: '#64D8C7' },
|
|
38
|
+
{ offset: '0.44', stopColor: '#5FD7C2' },
|
|
39
|
+
{ offset: '0.51', stopColor: '#54D5B3' },
|
|
40
|
+
{ offset: '0.58', stopColor: '#40D39C' },
|
|
41
|
+
{ offset: '0.66', stopColor: '#26D07C' },
|
|
42
|
+
];
|
|
43
|
+
/** Стопы градиента для светлого фона (`type='logoLight'`). */
|
|
44
|
+
exports.LOGO_LIGHT_STOPS = [
|
|
45
|
+
{ offset: '0.08', stopColor: '#58A1EE' },
|
|
46
|
+
{ offset: '0.17', stopColor: '#5EACE8' },
|
|
47
|
+
{ offset: '0.28', stopColor: '#5ABDD8' },
|
|
48
|
+
{ offset: '0.38', stopColor: '#54D4C1' },
|
|
49
|
+
{ offset: '0.44', stopColor: '#4BD2BB' },
|
|
50
|
+
{ offset: '0.51', stopColor: '#47D2AD' },
|
|
51
|
+
{ offset: '0.58', stopColor: '#38D198' },
|
|
52
|
+
{ offset: '0.66', stopColor: '#24C676' },
|
|
53
|
+
];
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.VARIANT = exports.TEST_IDS = exports.GIGA_MASK_IMAGE = exports.AiIconGiga = void 0;
|
|
4
|
+
var AiIconGiga_1 = require("./AiIconGiga");
|
|
5
|
+
Object.defineProperty(exports, "AiIconGiga", { enumerable: true, get: function () { return AiIconGiga_1.AiIconGiga; } });
|
|
6
|
+
var constants_1 = require("./constants");
|
|
7
|
+
Object.defineProperty(exports, "GIGA_MASK_IMAGE", { enumerable: true, get: function () { return constants_1.GIGA_MASK_IMAGE; } });
|
|
8
|
+
Object.defineProperty(exports, "TEST_IDS", { enumerable: true, get: function () { return constants_1.TEST_IDS; } });
|
|
9
|
+
Object.defineProperty(exports, "VARIANT", { enumerable: true, get: function () { return constants_1.VARIANT; } });
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { ValueOf, WithSupportProps } from '@cloud-ru/ds-utils';
|
|
2
|
+
import { ComponentPropsWithoutRef, ReactElement } from 'react';
|
|
3
|
+
import { VARIANT } from './constants.js';
|
|
4
|
+
export type AiIconGigaVariant = ValueOf<typeof VARIANT>;
|
|
5
|
+
export type AiIconGigaOwnProps = {
|
|
6
|
+
/**
|
|
7
|
+
* Вариант логотипа GigaChat:
|
|
8
|
+
* - `neutral` — монохром (`currentColor`, по умолчанию вторичный текстовый токен);
|
|
9
|
+
* - `logoDark` — брендовый градиент для тёмного фона;
|
|
10
|
+
* - `logoLight` — брендовый градиент для светлого фона.
|
|
11
|
+
* По умолчанию `neutral`.
|
|
12
|
+
*/
|
|
13
|
+
variant?: AiIconGigaVariant;
|
|
14
|
+
/** Размер иконки в px (квадрат). По умолчанию `80`. */
|
|
15
|
+
size?: number;
|
|
16
|
+
/** Доп. класс корня. */
|
|
17
|
+
className?: string;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Публичный props компонента `AiIconGiga`.
|
|
21
|
+
*
|
|
22
|
+
* Иконка-логотип GigaChat из набора AI Components для переиспользования в
|
|
23
|
+
* составных компонентах стриминга. Рендерится как `<svg>`.
|
|
24
|
+
*
|
|
25
|
+
* По умолчанию декоративна (`aria-hidden`). Если иконка несёт смысл —
|
|
26
|
+
* переопределите `aria-hidden={false}` и задайте `aria-label`.
|
|
27
|
+
*/
|
|
28
|
+
export type AiIconGigaProps = WithSupportProps<AiIconGigaOwnProps & Omit<ComponentPropsWithoutRef<'svg'>, keyof AiIconGigaOwnProps | 'children'>>;
|
|
29
|
+
export declare function AiIconGiga({ variant, size, className, 'aria-hidden': ariaHidden, 'data-test-id': dataTestId, ...rest }: AiIconGigaProps): ReactElement;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import cn from 'classnames';
|
|
3
|
+
import { useId } from 'react';
|
|
4
|
+
import { GIGA_PATH, GRADIENT_PARAMS, LOGO_DARK_STOPS, LOGO_LIGHT_STOPS, TEST_IDS, VARIANT } from './constants.js';
|
|
5
|
+
import styles from './styles.module.css';
|
|
6
|
+
const STOPS_BY_VARIANT = {
|
|
7
|
+
[VARIANT.LogoDark]: LOGO_DARK_STOPS,
|
|
8
|
+
[VARIANT.LogoLight]: LOGO_LIGHT_STOPS,
|
|
9
|
+
};
|
|
10
|
+
export function AiIconGiga({ variant = VARIANT.Neutral, size = 80, className, 'aria-hidden': ariaHidden, 'data-test-id': dataTestId = TEST_IDS.root, ...rest }) {
|
|
11
|
+
const gradientId = useId();
|
|
12
|
+
const isBranded = variant === VARIANT.LogoDark || variant === VARIANT.LogoLight;
|
|
13
|
+
const stops = isBranded ? STOPS_BY_VARIANT[variant] : undefined;
|
|
14
|
+
return (_jsx("svg", { ...rest, width: size, height: size, viewBox: '0 0 80 80', fill: 'none', xmlns: 'http://www.w3.org/2000/svg', className: cn(styles.root, className), "aria-hidden": ariaHidden ?? true, "data-variant": variant, "data-test-id": dataTestId, children: _jsxs("g", { transform: 'translate(10 10)', children: [_jsx("path", { d: GIGA_PATH, fill: isBranded ? `url(#${gradientId})` : 'currentColor' }), stops && (_jsx("defs", { children: _jsx("radialGradient", { id: gradientId, ...GRADIENT_PARAMS, children: stops.map(({ offset, stopColor }) => (_jsx("stop", { offset: offset, stopColor: stopColor }, offset))) }) }))] }) }));
|
|
15
|
+
}
|