@cloud-ru/ds-tooltip 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 +170 -0
- package/dist/cjs/components/QuestionTooltip/QuestionTooltip.d.ts +6 -0
- package/dist/cjs/components/QuestionTooltip/QuestionTooltip.js +26 -0
- package/dist/cjs/components/QuestionTooltip/index.d.ts +2 -0
- package/dist/cjs/components/QuestionTooltip/index.js +18 -0
- package/dist/cjs/components/QuestionTooltip/styles.module.css +39 -0
- package/dist/cjs/components/QuestionTooltip/types.d.ts +19 -0
- package/dist/cjs/components/QuestionTooltip/types.js +2 -0
- package/dist/cjs/components/Tooltip/Tooltip.d.ts +16 -0
- package/dist/cjs/components/Tooltip/Tooltip.js +20 -0
- package/dist/cjs/components/Tooltip/index.d.ts +1 -0
- package/dist/cjs/components/Tooltip/index.js +17 -0
- package/dist/cjs/components/Tooltip/styles.module.css +38 -0
- package/dist/cjs/components/WithTooltip/WithTooltip.d.ts +9 -0
- package/dist/cjs/components/WithTooltip/WithTooltip.js +11 -0
- package/dist/cjs/components/WithTooltip/index.d.ts +1 -0
- package/dist/cjs/components/WithTooltip/index.js +17 -0
- package/dist/cjs/components/index.d.ts +3 -0
- package/dist/cjs/components/index.js +19 -0
- package/dist/cjs/constants.d.ts +10 -0
- package/dist/cjs/constants.js +13 -0
- package/dist/cjs/index.d.ts +5 -0
- package/dist/cjs/index.js +23 -0
- package/dist/cjs/package.json +3 -0
- package/dist/cjs/style.css +77 -0
- package/dist/cjs/types.d.ts +5 -0
- package/dist/cjs/types.js +2 -0
- package/dist/cjs/utils.d.ts +2 -0
- package/dist/cjs/utils.js +15 -0
- package/dist/esm/components/QuestionTooltip/QuestionTooltip.d.ts +6 -0
- package/dist/esm/components/QuestionTooltip/QuestionTooltip.js +20 -0
- package/dist/esm/components/QuestionTooltip/index.d.ts +2 -0
- package/dist/esm/components/QuestionTooltip/index.js +2 -0
- package/dist/esm/components/QuestionTooltip/styles.module.css +39 -0
- package/dist/esm/components/QuestionTooltip/types.d.ts +19 -0
- package/dist/esm/components/QuestionTooltip/types.js +1 -0
- package/dist/esm/components/Tooltip/Tooltip.d.ts +16 -0
- package/dist/esm/components/Tooltip/Tooltip.js +13 -0
- package/dist/esm/components/Tooltip/index.d.ts +1 -0
- package/dist/esm/components/Tooltip/index.js +1 -0
- package/dist/esm/components/Tooltip/styles.module.css +38 -0
- package/dist/esm/components/WithTooltip/WithTooltip.d.ts +9 -0
- package/dist/esm/components/WithTooltip/WithTooltip.js +8 -0
- package/dist/esm/components/WithTooltip/index.d.ts +1 -0
- package/dist/esm/components/WithTooltip/index.js +1 -0
- package/dist/esm/components/index.d.ts +3 -0
- package/dist/esm/components/index.js +3 -0
- package/dist/esm/constants.d.ts +10 -0
- package/dist/esm/constants.js +10 -0
- package/dist/esm/index.d.ts +5 -0
- package/dist/esm/index.js +3 -0
- package/dist/esm/style.css +77 -0
- package/dist/esm/types.d.ts +5 -0
- package/dist/esm/types.js +1 -0
- package/dist/esm/utils.d.ts +2 -0
- package/dist/esm/utils.js +12 -0
- package/dist/tsconfig.cjs.tsbuildinfo +1 -0
- package/dist/tsconfig.esm.tsbuildinfo +1 -0
- package/package.json +44 -0
- package/src/components/QuestionTooltip/QuestionTooltip.tsx +59 -0
- package/src/components/QuestionTooltip/index.ts +2 -0
- package/src/components/QuestionTooltip/styles.module.scss +51 -0
- package/src/components/QuestionTooltip/types.ts +20 -0
- package/src/components/Tooltip/Tooltip.tsx +69 -0
- package/src/components/Tooltip/index.ts +1 -0
- package/src/components/Tooltip/styles.module.scss +41 -0
- package/src/components/WithTooltip/WithTooltip.tsx +16 -0
- package/src/components/WithTooltip/index.ts +1 -0
- package/src/components/index.ts +3 -0
- package/src/constants.ts +11 -0
- package/src/index.ts +5 -0
- package/src/types.ts +7 -0
- package/src/utils.ts +14 -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,170 @@
|
|
|
1
|
+
# Tooltip
|
|
2
|
+
|
|
3
|
+
`@cloud-ru/ds-tooltip` — Пакет подсказок — компонент Tooltip для произвольного триггера и QuestionTooltip с иконкой «?» для полей форм и сложной терминологии.
|
|
4
|
+
|
|
5
|
+
Пакет `@cloud-ru/ds-tooltip` содержит всплывающие подсказки:
|
|
6
|
+
|
|
7
|
+
- ****Tooltip**** — универсальная подсказка. Оборачивает произвольный триггер (кнопка, иконка, текст) и показывает pop-up по hover, focus или клику.
|
|
8
|
+
- ****QuestionTooltip**** — специализированный вариант с готовым триггером «?» для полей форм и терминов.
|
|
9
|
+
|
|
10
|
+
## Установка
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
pnpm add @cloud-ru/ds-tooltip
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
```ts
|
|
17
|
+
import { Tooltip, QuestionTooltip } from '@cloud-ru/ds-tooltip'
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Tooltip
|
|
21
|
+
|
|
22
|
+
Всплывающая подсказка над произвольным триггером — четыре placement, четыре варианта trigger, поддержка клавиатуры и screen-reader.
|
|
23
|
+
|
|
24
|
+
Pop-up-подсказка над произвольным триггером. Принимает `children` (сам триггер) и `tip` (содержимое подсказки).
|
|
25
|
+
|
|
26
|
+
### Когда использовать
|
|
27
|
+
|
|
28
|
+
- Для раскрытия контекста на icon-only кнопке («Настройки», «Экспорт»).
|
|
29
|
+
- Для подсказки по disabled-элементу — почему он недоступен.
|
|
30
|
+
- Для аббревиатур и терминов в таблицах.
|
|
31
|
+
|
|
32
|
+
Когда **не** нужен: для длинного описания — вместо этого Popover или отдельная страница.
|
|
33
|
+
|
|
34
|
+
### Анатомия
|
|
35
|
+
|
|
36
|
+
#### Size
|
|
37
|
+
`xs` — короткие подписи на одной строке, `s` — многострочные подсказки и описания.
|
|
38
|
+
|
|
39
|
+
### Примеры использования
|
|
40
|
+
|
|
41
|
+
#### 1. Базовая подсказка
|
|
42
|
+
|
|
43
|
+
Hover + focus по умолчанию
|
|
44
|
+
|
|
45
|
+
```tsx
|
|
46
|
+
import { Tooltip } from '@cloud-ru/ds-tooltip';
|
|
47
|
+
|
|
48
|
+
export function Basic() {
|
|
49
|
+
return (
|
|
50
|
+
<Tooltip tip='Сохранить изменения'>
|
|
51
|
+
<button type='button'>Сохранить</button>
|
|
52
|
+
</Tooltip>
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
#### 2. Click trigger
|
|
58
|
+
|
|
59
|
+
Открывается по клику и остаётся видимой
|
|
60
|
+
|
|
61
|
+
```tsx
|
|
62
|
+
import { Tooltip } from '@cloud-ru/ds-tooltip';
|
|
63
|
+
|
|
64
|
+
export function ClickTrigger() {
|
|
65
|
+
return (
|
|
66
|
+
<Tooltip tip='Открывается по клику и остаётся видимой' trigger='click'>
|
|
67
|
+
<button type='button'>Подробнее</button>
|
|
68
|
+
</Tooltip>
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### Props
|
|
74
|
+
|
|
75
|
+
**TooltipProps**
|
|
76
|
+
|
|
77
|
+
| Prop | Type | Default | Description |
|
|
78
|
+
|------|------|---------|-------------|
|
|
79
|
+
| `children` | `ChildrenFunction` | — | Триггер поповера (подробнее читайте ниже) |
|
|
80
|
+
| `className` | `string` | — | |
|
|
81
|
+
| `closeOnPopstate` | `boolean` | — | Закрывать ли поповер при переходе по истории браузера |
|
|
82
|
+
| `data-test-id` | `string` | — | |
|
|
83
|
+
| `disableMaxWidth` | `boolean` | `false` | Отключение ограничения ширины тултипа |
|
|
84
|
+
| `disableSpanWrapper` | `boolean` | — | Отключает для `isValidElement` внешнюю обертку триггера <br/> Пригодится для элементов с `position: absolute` <br/> Работает для триггеров, которые умеют отдать свою DOM-ноду: нативные элементы, `forwardRef`-компоненты <br/> и компоненты, помеченные `withInnerRefSupport` из `@cloud-ru/ds-utils`. Остальные всё равно получают `<span>` — <br/> без ноды поповеру не от чего считать позицию; в dev-режиме об этом печатается предупреждение. |
|
|
85
|
+
| `fallbackPlacements` | `Placement` | — | Цепочка расположений которая будет применяться к поповеру от первого к последнему если при текущем он не влезает. |
|
|
86
|
+
| `hoverDelayClose` | `number` | `0` | Задержка закрытия по ховеру |
|
|
87
|
+
| `hoverDelayOpen` | `number` | `0` | Задержка открытия по ховеру |
|
|
88
|
+
| `offset` | `number` | `0` | Отступ поповера от его триггер-элемента (в пикселях). |
|
|
89
|
+
| `onOpenChange` | `((isOpen: boolean) => void)` | — | Колбек отображения компонента. Срабатывает при изменении состояния open. |
|
|
90
|
+
| `open` | `boolean` | — | Управляет состоянием показан/не показан. |
|
|
91
|
+
| `placement` | `"bottom"` \| `"bottom-end"` \| `"bottom-start"` \| `"left"` \| `"left-end"` \| `"left-start"` \| `"right"` \| `"right-end"` \| `"right-start"` \| `"top"` \| `"top-end"` \| `"top-start"` | `top` | Положение поповера относительно своего триггера (children). |
|
|
92
|
+
| `tip` | `ReactNode` | — | Содержимое тултипа (текст или разметка) |
|
|
93
|
+
| `trigger` | `"click"` \| `"clickAndFocusVisible"` \| `"focus"` \| `"focusVisible"` \| `"hover"` \| `"hoverAndFocus"` \| `"hoverAndFocusVisible"` | `hoverAndFocusVisible` | Условие отображения поповера: <br/> - `click` - открывать по клику <br/> - `hover` - открывать по ховеру <br/> - `focusVisible` - открывать по focus-visible <br/> - `focus` - открывать по фокусу <br/> - `hoverAndFocusVisible` - открывать по ховеру и focus-visible <br/> - `hoverAndFocus` - открывать по ховеру и фокусу <br/> - `clickAndFocusVisible` - открывать по клику и focus-visible |
|
|
94
|
+
| `triggerClassName` | `string` | — | CSS-класс триггера |
|
|
95
|
+
| `triggerRef` | `ForwardedRef<HTMLElement \| ReferenceType \| null>` | — | Ref ссылка на триггер |
|
|
96
|
+
|
|
97
|
+
##### Related types
|
|
98
|
+
|
|
99
|
+
- `Placement` = `"bottom"` \| `"bottom-end"` \| `"bottom-start"` \| `"left"` \| `"left-end"` \| `"left-start"` \| `"right"` \| `"right-end"` \| `"right-start"` \| `"top"` \| `"top-end"` \| `"top-start"`
|
|
100
|
+
|
|
101
|
+
## QuestionTooltip
|
|
102
|
+
|
|
103
|
+
Специализированный тултип с готовым триггером-иконкой «?» — для подсказок к полям форм и терминам.
|
|
104
|
+
|
|
105
|
+
Тултип с встроенным триггером — иконкой «?» размером 16px. Использует `Tooltip` под капотом, добавляя стандартный triggerButton с `aria-label`.
|
|
106
|
+
|
|
107
|
+
### Когда использовать
|
|
108
|
+
|
|
109
|
+
- Рядом с названием поля формы, чтобы объяснить назначение поля.
|
|
110
|
+
- Рядом с термином или аббревиатурой в тексте и таблицах.
|
|
111
|
+
- В онбординговых состояниях — пояснение новой фичи.
|
|
112
|
+
|
|
113
|
+
### Анатомия
|
|
114
|
+
|
|
115
|
+
#### Size
|
|
116
|
+
Размер триггера-иконки и тултипа: `xs` — для плотных форм, `s` — дефолт рядом с заголовками секций.
|
|
117
|
+
|
|
118
|
+
### Примеры использования
|
|
119
|
+
|
|
120
|
+
#### Подсказка к полю формы
|
|
121
|
+
|
|
122
|
+
aria-label триггера задаётся через triggerLabel
|
|
123
|
+
|
|
124
|
+
```tsx
|
|
125
|
+
import { QuestionTooltip } from '@cloud-ru/ds-tooltip';
|
|
126
|
+
|
|
127
|
+
export function Question() {
|
|
128
|
+
return (
|
|
129
|
+
<label style={{ display: 'inline-flex', gap: 8, alignItems: 'center' }}>
|
|
130
|
+
<span>API-ключ</span>
|
|
131
|
+
<input type='text' name='api-key' placeholder='sk_...' />
|
|
132
|
+
<QuestionTooltip tip='Строка из 32 символов. Хранится зашифрованной, видна только владельцу.' />
|
|
133
|
+
</label>
|
|
134
|
+
);
|
|
135
|
+
}
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
### Props
|
|
139
|
+
|
|
140
|
+
**QuestionTooltipProps**
|
|
141
|
+
|
|
142
|
+
| Prop | Type | Default | Description |
|
|
143
|
+
|------|------|---------|-------------|
|
|
144
|
+
| `children` | `ChildrenFunction` | — | Триггер поповера (подробнее читайте ниже) |
|
|
145
|
+
| `className` | `string` | — | |
|
|
146
|
+
| `closeOnPopstate` | `boolean` | — | Закрывать ли поповер при переходе по истории браузера |
|
|
147
|
+
| `data-test-id` | `string` | — | |
|
|
148
|
+
| `disableMaxWidth` | `boolean` | `false` | Отключение ограничения ширины тултипа |
|
|
149
|
+
| `disableSpanWrapper` | `boolean` | — | Отключает для `isValidElement` внешнюю обертку триггера <br/> Пригодится для элементов с `position: absolute` <br/> Работает для триггеров, которые умеют отдать свою DOM-ноду: нативные элементы, `forwardRef`-компоненты <br/> и компоненты, помеченные `withInnerRefSupport` из `@cloud-ru/ds-utils`. Остальные всё равно получают `<span>` — <br/> без ноды поповеру не от чего считать позицию; в dev-режиме об этом печатается предупреждение. |
|
|
150
|
+
| `fallbackPlacements` | `Placement` | — | Цепочка расположений которая будет применяться к поповеру от первого к последнему если при текущем он не влезает. |
|
|
151
|
+
| `hoverDelayClose` | `number` | — | Задержка закрытия по ховеру |
|
|
152
|
+
| `hoverDelayOpen` | `number` | — | Задержка открытия по ховеру |
|
|
153
|
+
| `offset` | `number` | `0` | Отступ поповера от его триггер-элемента (в пикселях). |
|
|
154
|
+
| `onOpenChange` | `((isOpen: boolean) => void)` | — | Колбек отображения компонента. Срабатывает при изменении состояния open. |
|
|
155
|
+
| `open` | `boolean` | — | Управляет состоянием показан/не показан. |
|
|
156
|
+
| `placement` | `"bottom"` \| `"bottom-end"` \| `"bottom-start"` \| `"left"` \| `"left-end"` \| `"left-start"` \| `"right"` \| `"right-end"` \| `"right-start"` \| `"top"` \| `"top-end"` \| `"top-start"` | `top` | Положение поповера относительно своего триггера (children). |
|
|
157
|
+
| `size` | `"s"` \| `"xs"` | `xs` | Размер |
|
|
158
|
+
| `tabIndex` | `number` | `0` | Tab index для кнопки-триггера |
|
|
159
|
+
| `tip` | `ReactNode` | — | Содержимое тултипа (текст или разметка) |
|
|
160
|
+
| `tooltipClassname` | `string` | — | CSS-класс контейнера подсказки |
|
|
161
|
+
| `trigger` | `"click"` \| `"clickAndFocusVisible"` \| `"focus"` \| `"focusVisible"` \| `"hover"` \| `"hoverAndFocus"` \| `"hoverAndFocusVisible"` | `hover` | Условие отображения поповера: <br/> - `click` - открывать по клику <br/> - `hover` - открывать по ховеру <br/> - `focusVisible` - открывать по focus-visible <br/> - `focus` - открывать по фокусу <br/> - `hoverAndFocusVisible` - открывать по ховеру и focus-visible <br/> - `hoverAndFocus` - открывать по ховеру и фокусу <br/> - `clickAndFocusVisible` - открывать по клику и focus-visible |
|
|
162
|
+
| `triggerClassName` | `string` | — | CSS-класс триггера |
|
|
163
|
+
| `triggerLabel` | `string` | `Подсказка` | Доступное имя для иконки-триггера |
|
|
164
|
+
| `triggerRef` | `ForwardedRef<HTMLElement \| ReferenceType \| null>` | — | Ref ссылка на триггер |
|
|
165
|
+
|
|
166
|
+
##### Related types
|
|
167
|
+
|
|
168
|
+
- `Placement` = `"bottom"` \| `"bottom-end"` \| `"bottom-start"` \| `"left"` \| `"left-end"` \| `"left-start"` \| `"right"` \| `"right-end"` \| `"right-start"` \| `"top"` \| `"top-end"` \| `"top-start"`
|
|
169
|
+
|
|
170
|
+
- `Size` = `"s"` \| `"xs"`
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { QuestionTooltipProps } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* QuestionTooltip — иконка «?» с тултипом-popover для подсказок к полям форм.
|
|
4
|
+
* Поверхность одна на всех раскладках (по договорённости с дизайном mobile не свапается на BottomSheet).
|
|
5
|
+
*/
|
|
6
|
+
export declare function QuestionTooltip({ tip, triggerLabel, trigger, className, tooltipClassname, open, onOpenChange, tabIndex, size, triggerRef, ...rest }: QuestionTooltipProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,26 @@
|
|
|
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.QuestionTooltip = QuestionTooltip;
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const system_1 = require("@cloud-ru/ds-icons/interface/system");
|
|
9
|
+
const popover_private_1 = require("@cloud-ru/ds-popover-private");
|
|
10
|
+
const utils_1 = require("@cloud-ru/ds-utils");
|
|
11
|
+
const classnames_1 = __importDefault(require("classnames"));
|
|
12
|
+
const constants_1 = require("../../constants");
|
|
13
|
+
const utils_2 = require("../../utils");
|
|
14
|
+
const Tooltip_1 = require("../Tooltip");
|
|
15
|
+
const styles_module_scss_1 = __importDefault(require('./styles.module.css'));
|
|
16
|
+
/**
|
|
17
|
+
* QuestionTooltip — иконка «?» с тултипом-popover для подсказок к полям форм.
|
|
18
|
+
* Поверхность одна на всех раскладках (по договорённости с дизайном mobile не свапается на BottomSheet).
|
|
19
|
+
*/
|
|
20
|
+
function QuestionTooltip({ tip, triggerLabel = 'Подсказка', trigger = popover_private_1.TRIGGER.Hover, className, tooltipClassname, open, onOpenChange, tabIndex = 0, size = constants_1.SIZE.XS, triggerRef, ...rest }) {
|
|
21
|
+
const [isOpen, setIsOpen] = (0, utils_1.useUncontrolledProp)(open, false, onOpenChange);
|
|
22
|
+
return ((0, jsx_runtime_1.jsx)(Tooltip_1.Tooltip, { tip: tip, className: tooltipClassname, triggerClassName: styles_module_scss_1.default.questionTooltipTrigger, open: isOpen, onOpenChange: setIsOpen, trigger: trigger, ...rest, children: (0, jsx_runtime_1.jsx)("button", { type: 'button', "aria-label": triggerLabel, "data-opened": isOpen, "data-trigger": trigger, tabIndex: tabIndex, className: (0, classnames_1.default)(styles_module_scss_1.default.button, className), "data-size": size, "data-test-id": constants_1.TEST_IDS.questionTooltip.triggerOpen,
|
|
23
|
+
// Ref ведёт на саму кнопку, а не на span-обёртку popover'а: потребителю
|
|
24
|
+
// нужен настоящий триггер (позиционирование, фокус).
|
|
25
|
+
ref: triggerRef, children: (0, jsx_runtime_1.jsx)(system_1.QuestionSVG, { size: (0, utils_2.getIconSize)(size) }) }) }));
|
|
26
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./QuestionTooltip"), exports);
|
|
18
|
+
__exportStar(require("./types"), exports);
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
.questionTooltipTrigger{
|
|
2
|
+
position:relative;
|
|
3
|
+
display:inline-flex;
|
|
4
|
+
align-items:center;
|
|
5
|
+
justify-content:center;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.button{
|
|
9
|
+
cursor:pointer;
|
|
10
|
+
position:relative;
|
|
11
|
+
display:inline-flex;
|
|
12
|
+
align-items:center;
|
|
13
|
+
justify-content:center;
|
|
14
|
+
margin:0;
|
|
15
|
+
padding:0;
|
|
16
|
+
border:none;
|
|
17
|
+
font:inherit;
|
|
18
|
+
color:var(--sn-theme-color-available-version-textTertiary, var(--sn-brand-color-text-version-tertiary, rgba(65, 66, 78, 0.5490196078)));
|
|
19
|
+
background:transparent;
|
|
20
|
+
}
|
|
21
|
+
.button:focus-visible{
|
|
22
|
+
outline:var(--sn-primitive-strokeWeight-strokeSemiBold, 2px) solid var(--sn-theme-color-available-complementary, #000000);
|
|
23
|
+
}
|
|
24
|
+
.button:active{
|
|
25
|
+
color:var(--sn-theme-color-available-version-textMain, var(--sn-brand-color-text-version-main, #41424e));
|
|
26
|
+
}
|
|
27
|
+
@media (hover: hover){
|
|
28
|
+
.button:hover:not(:active){
|
|
29
|
+
color:var(--sn-theme-color-available-version-textSecondary, var(--sn-brand-color-text-version-secondary, rgba(65, 66, 78, 0.8)));
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
.button[data-size=xs]{
|
|
33
|
+
width:var(--sn-density-size-icon-xs, var(--sn-primitive-dimension-24, 24px));
|
|
34
|
+
height:var(--sn-density-size-icon-xs, var(--sn-primitive-dimension-24, 24px));
|
|
35
|
+
}
|
|
36
|
+
.button[data-size=s]{
|
|
37
|
+
width:var(--sn-density-size-icon-s, var(--sn-primitive-dimension-24, 24px));
|
|
38
|
+
height:var(--sn-density-size-icon-s, var(--sn-primitive-dimension-24, 24px));
|
|
39
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Size } from '../../types';
|
|
2
|
+
import { TooltipProps } from '../Tooltip';
|
|
3
|
+
/**
|
|
4
|
+
* QuestionTooltip: иконка «?» с тултипом-popover. Поверхность одна на всех раскладках.
|
|
5
|
+
* `tooltipClassname` применяется к контейнеру подсказки.
|
|
6
|
+
*/
|
|
7
|
+
export type QuestionTooltipProps = TooltipProps & {
|
|
8
|
+
/** CSS-класс контейнера подсказки */
|
|
9
|
+
tooltipClassname?: string;
|
|
10
|
+
/** Доступное имя для иконки-триггера */
|
|
11
|
+
triggerLabel?: string;
|
|
12
|
+
/** Tab index для кнопки-триггера */
|
|
13
|
+
tabIndex?: number;
|
|
14
|
+
/**
|
|
15
|
+
* Размер
|
|
16
|
+
* @default xs
|
|
17
|
+
*/
|
|
18
|
+
size?: Size;
|
|
19
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { PopoverPrivateProps } from '@cloud-ru/ds-popover-private';
|
|
2
|
+
import { WithSupportProps } from '@cloud-ru/ds-utils';
|
|
3
|
+
import { ReactNode } from 'react';
|
|
4
|
+
export type TooltipProps = WithSupportProps<{
|
|
5
|
+
/** Содержимое тултипа (текст или разметка) */
|
|
6
|
+
tip: ReactNode;
|
|
7
|
+
/** Отключение ограничения ширины тултипа @default false */
|
|
8
|
+
disableMaxWidth?: boolean;
|
|
9
|
+
}> & Pick<PopoverPrivateProps, 'className' | 'triggerClassName' | 'offset' | 'open' | 'onOpenChange' | 'hoverDelayOpen' | 'hoverDelayClose' | 'triggerRef' | 'disableSpanWrapper' | 'fallbackPlacements' | 'closeOnPopstate'> & Partial<Pick<PopoverPrivateProps, 'trigger' | 'placement' | 'children'>>;
|
|
10
|
+
export declare const DEFAULT_FALLBACK_PLACEMENTS: ("left" | "right" | "top" | "bottom")[];
|
|
11
|
+
/**
|
|
12
|
+
* Tooltip — всплывающая подсказка при наведении.
|
|
13
|
+
* Стили и анатомия (отступы, скругления, макс. ширина) из @cloud-ru/ds-figma-variables.
|
|
14
|
+
* DOM повторяет структуру из Figma: корневой контейнер и слои (фон, контейнер контента, указатель) с position: absolute.
|
|
15
|
+
*/
|
|
16
|
+
export declare function Tooltip({ children, tip, placement, trigger, hoverDelayOpen, hoverDelayClose, triggerClassName, disableMaxWidth, ...otherProps }: TooltipProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,20 @@
|
|
|
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.DEFAULT_FALLBACK_PLACEMENTS = void 0;
|
|
7
|
+
exports.Tooltip = Tooltip;
|
|
8
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
9
|
+
const popover_private_1 = require("@cloud-ru/ds-popover-private");
|
|
10
|
+
const classnames_1 = __importDefault(require("classnames"));
|
|
11
|
+
const styles_module_scss_1 = __importDefault(require('./styles.module.css'));
|
|
12
|
+
exports.DEFAULT_FALLBACK_PLACEMENTS = [popover_private_1.PLACEMENT.Top, popover_private_1.PLACEMENT.Right, popover_private_1.PLACEMENT.Bottom, popover_private_1.PLACEMENT.Left];
|
|
13
|
+
/**
|
|
14
|
+
* Tooltip — всплывающая подсказка при наведении.
|
|
15
|
+
* Стили и анатомия (отступы, скругления, макс. ширина) из @cloud-ru/ds-figma-variables.
|
|
16
|
+
* DOM повторяет структуру из Figma: корневой контейнер и слои (фон, контейнер контента, указатель) с position: absolute.
|
|
17
|
+
*/
|
|
18
|
+
function Tooltip({ children, tip, placement = popover_private_1.PLACEMENT.Top, trigger = popover_private_1.TRIGGER.HoverAndFocusVisible, hoverDelayOpen = 0, hoverDelayClose = 0, triggerClassName, disableMaxWidth = false, ...otherProps }) {
|
|
19
|
+
return ((0, jsx_runtime_1.jsx)(popover_private_1.PopoverPrivate, { trigger: trigger, placement: placement, hasArrow: true, arrowContainerClassName: styles_module_scss_1.default.pointerWrapper, arrowElementClassName: styles_module_scss_1.default.pointerShape, hoverDelayOpen: hoverDelayOpen, hoverDelayClose: hoverDelayClose, fallbackPlacements: exports.DEFAULT_FALLBACK_PLACEMENTS, triggerClassName: (0, classnames_1.default)(styles_module_scss_1.default.triggerClassName, triggerClassName), popoverContent: (0, jsx_runtime_1.jsx)("div", { className: styles_module_scss_1.default.tooltipContainer, "data-disable-max-width": disableMaxWidth, role: 'tooltip', children: tip }), ...otherProps, children: children }));
|
|
20
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Tooltip';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./Tooltip"), exports);
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
.triggerClassName{
|
|
2
|
+
--offset:var(--sn-popover-anatomy-privatePopover-offset, var(--sn-primitive-dimension-4, 4px));
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.tooltipContainer{
|
|
6
|
+
border-radius:var(--sn-tooltip-anatomy-container-borderRadius, var(--sn-brand-anatomy-radius-tooltip-xs, var(--sn-primitive-dimension-4, 4px)));
|
|
7
|
+
padding:var(--sn-tooltip-anatomy-container-padding, var(--sn-brand-anatomy-spacing-tooltip-padding, var(--sn-primitive-dimension-8, 8px)));
|
|
8
|
+
max-width:256px;
|
|
9
|
+
min-width:var(--sn-tooltip-anatomy-container-minWidth, var(--sn-primitive-dimension-32, 32px));
|
|
10
|
+
min-height:var(--sn-tooltip-anatomy-container-minHeight, var(--sn-primitive-dimension-32, 32px));
|
|
11
|
+
font-family:var(--sn-regular-body-s-fontFamily, var(--sn-brand-font-fontFamily-regular-body, var(--sn-primitive-fontFamily-brandA-sans, SB Sans Interface)));
|
|
12
|
+
font-weight:var(--sn-regular-body-s-fontWeight, var(--sn-theme-typography-fontWeight-regular-body-s, var(--sn-brand-font-fontWeight-light-regular-body-s, var(--sn-primitive-font-fontWeightValue-400, 400))));
|
|
13
|
+
line-height:var(--sn-regular-body-s-lineHeight, var(--sn-density-typography-roleBody-lineHeightS, var(--sn-primitive-font-lineHeight-by14, 20px)));
|
|
14
|
+
font-size:var(--sn-regular-body-s-fontSize, var(--sn-density-typography-roleBody-fontSizeS, var(--sn-primitive-font-fontSize-14, 14px)));
|
|
15
|
+
letter-spacing:var(--sn-regular-body-s-letterSpacing, var(--sn-primitive-font-letterSpacing-m, 0.1px));
|
|
16
|
+
paragraph-spacing:var(--sn-regular-body-s-paragraphSpacing, var(--sn-primitive-font-paragraphSpacing-byFontSize12, 6px));
|
|
17
|
+
display:flex;
|
|
18
|
+
flex-direction:column;
|
|
19
|
+
box-sizing:border-box;
|
|
20
|
+
color:var(--sn-theme-color-available-inversion-textMain, var(--sn-brand-color-text-inversion-main, #e6e8ef));
|
|
21
|
+
overflow-wrap:break-word;
|
|
22
|
+
background:var(--sn-theme-color-invertNeutral-background2Level, var(--sn-brand-color-neutral-15, var(--sn-primitive-color-gray-15, #333342)));
|
|
23
|
+
}
|
|
24
|
+
.tooltipContainer[data-disable-max-width=true]{
|
|
25
|
+
max-width:calc(100vw - var(--sn-primitive-dimension-16, 16px));
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.pointerWrapper{
|
|
29
|
+
position:absolute;
|
|
30
|
+
display:flex;
|
|
31
|
+
align-items:center;
|
|
32
|
+
justify-content:center;
|
|
33
|
+
color:var(--sn-theme-color-invertNeutral-background2Level, var(--sn-brand-color-neutral-15, var(--sn-primitive-color-gray-15, #333342)));
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.pointerShape{
|
|
37
|
+
fill:currentcolor;
|
|
38
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { TooltipProps } from '../Tooltip';
|
|
2
|
+
type WithTooltipProps = {
|
|
3
|
+
/** Настройки для тултипа */
|
|
4
|
+
tooltip?: Omit<TooltipProps, 'children'>;
|
|
5
|
+
/** Триггер поповера (подробнее в TooltipProps) */
|
|
6
|
+
children: TooltipProps['children'];
|
|
7
|
+
};
|
|
8
|
+
export declare function WithTooltip({ tooltip, children }: WithTooltipProps): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WithTooltip = WithTooltip;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const Tooltip_1 = require("../Tooltip");
|
|
6
|
+
function WithTooltip({ tooltip, children }) {
|
|
7
|
+
if (!tooltip?.tip) {
|
|
8
|
+
return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: children });
|
|
9
|
+
}
|
|
10
|
+
return (0, jsx_runtime_1.jsx)(Tooltip_1.Tooltip, { ...tooltip, children: children });
|
|
11
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './WithTooltip';
|