@opencode-ai/ui 0.0.0-dev-202608201855 → 0.0.0-dev-17751

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.
Files changed (285) hide show
  1. package/dist/actions/button/button.d.ts +10 -0
  2. package/dist/actions/icon-button/icon-button.d.ts +11 -0
  3. package/dist/actions/split-button/split-button.d.ts +5 -0
  4. package/dist/components/card.d.ts +1 -1
  5. package/dist/components/list.d.ts +1 -1
  6. package/dist/components/scroll-view.d.ts +3 -3
  7. package/dist/context/i18n.d.ts +10 -7
  8. package/dist/{components → data-display/accordion}/accordion.d.ts +6 -6
  9. package/dist/{v2/components/avatar-v2.d.ts → data-display/avatar/avatar.d.ts} +1 -1
  10. package/dist/data-display/badge/badge.d.ts +7 -0
  11. package/dist/{components → data-display/diff-changes}/diff-changes.d.ts +2 -1
  12. package/dist/data-display/keybind/keybind.d.ts +7 -0
  13. package/dist/{v2/components/line-comment-v2.d.ts → data-display/line-comment/line-comment.d.ts} +9 -9
  14. package/dist/{v2/components/project-avatar-v2.d.ts → data-display/project-avatar/project-avatar.d.ts} +1 -1
  15. package/dist/feedback/loader/loader.d.ts +3 -0
  16. package/dist/{components → feedback/progress-circle}/progress-circle.d.ts +2 -0
  17. package/dist/feedback/toast/toast.d.ts +57 -0
  18. package/dist/{components → forms/checkbox}/checkbox.d.ts +2 -2
  19. package/dist/{v2/components/field-v2.d.ts → forms/field/field.d.ts} +4 -10
  20. package/dist/forms/radio/radio.d.ts +16 -0
  21. package/dist/{v2/components/select-v2.d.ts → forms/select/select.d.ts} +4 -6
  22. package/dist/{components → forms/switch}/switch.d.ts +4 -2
  23. package/dist/{v2/components/text-input-v2.d.ts → forms/text-input/text-input.d.ts} +3 -3
  24. package/dist/forms/textarea/textarea.d.ts +7 -0
  25. package/dist/i18n/ar.d.ts +0 -2
  26. package/dist/i18n/bg.d.ts +0 -2
  27. package/dist/i18n/br.d.ts +0 -2
  28. package/dist/i18n/bs.d.ts +0 -2
  29. package/dist/i18n/da.d.ts +0 -2
  30. package/dist/i18n/de.d.ts +0 -2
  31. package/dist/i18n/en.d.ts +209 -1
  32. package/dist/i18n/es.d.ts +0 -2
  33. package/dist/i18n/fr.d.ts +0 -2
  34. package/dist/i18n/he.d.ts +197 -0
  35. package/dist/i18n/ja.d.ts +0 -2
  36. package/dist/i18n/km.d.ts +0 -2
  37. package/dist/i18n/ko.d.ts +0 -2
  38. package/dist/i18n/lo.d.ts +0 -2
  39. package/dist/i18n/mk.d.ts +0 -2
  40. package/dist/i18n/mn.d.ts +0 -2
  41. package/dist/i18n/my.d.ts +0 -2
  42. package/dist/i18n/pl.d.ts +0 -2
  43. package/dist/i18n/ru.d.ts +0 -2
  44. package/dist/i18n/sr.d.ts +0 -2
  45. package/dist/i18n/tg.d.ts +0 -2
  46. package/dist/i18n/th.d.ts +0 -2
  47. package/dist/i18n/tr.d.ts +0 -2
  48. package/dist/i18n/zh.d.ts +0 -2
  49. package/dist/i18n/zht.d.ts +0 -2
  50. package/dist/{components/icon.d.ts → icons/icon/additional-icons.d.ts} +8 -8
  51. package/dist/{v2/components → icons/icon}/icon.d.ts +16 -1
  52. package/dist/layout/divider/divider.d.ts +5 -0
  53. package/dist/navigation/menu/menu.d.ts +59 -0
  54. package/dist/{v2/components/segmented-control-v2.d.ts → navigation/segmented-control/segmented-control.d.ts} +5 -5
  55. package/dist/{components → navigation/tabs}/tabs.d.ts +15 -8
  56. package/dist/{v2/components/dialog-v2.d.ts → overlays/dialog/dialog.d.ts} +1 -2
  57. package/dist/overlays/tooltip/tooltip.d.ts +14 -0
  58. package/dist/{components → typography/text-shimmer}/text-shimmer.d.ts +1 -0
  59. package/dist/typography/wordmark/wordmark.d.ts +2 -0
  60. package/package.json +131 -13
  61. package/src/{v2/components/button-v2.tsx → actions/button/button.tsx} +8 -8
  62. package/src/actions/icon-button/icon-button.tsx +32 -0
  63. package/src/{v2/components/split-button-v2.css → actions/split-button/split-button.css} +1 -6
  64. package/src/{v2/components/split-button-v2.tsx → actions/split-button/split-button.tsx} +4 -4
  65. package/src/components/animated-number.css +29 -11
  66. package/src/components/animated-number.tsx +2 -2
  67. package/src/components/card.css +2 -23
  68. package/src/components/card.tsx +4 -4
  69. package/src/components/collapsible.tsx +1 -1
  70. package/src/components/image-preview.tsx +3 -2
  71. package/src/components/list.css +5 -5
  72. package/src/components/list.tsx +7 -5
  73. package/src/components/popover.tsx +3 -2
  74. package/src/components/provider-icon.tsx +1 -1
  75. package/src/components/scroll-view.tsx +5 -20
  76. package/src/components/sticky-accordion-header.tsx +1 -1
  77. package/src/components/text-field.tsx +12 -4
  78. package/src/context/i18n.tsx +17 -14
  79. package/src/{components → data-display/accordion}/accordion.css +1 -26
  80. package/src/{components → data-display/accordion}/accordion.tsx +14 -14
  81. package/src/{v2/components/avatar-v2.tsx → data-display/avatar/avatar.tsx} +1 -1
  82. package/src/{v2/components/badge-v2.css → data-display/badge/badge.css} +19 -0
  83. package/src/{v2/components/badge-v2.tsx → data-display/badge/badge.tsx} +6 -4
  84. package/src/{components → data-display/diff-changes}/diff-changes.css +22 -19
  85. package/src/{v2/components/diff-changes-v2.tsx → data-display/diff-changes/diff-changes.tsx} +7 -2
  86. package/src/{v2/components/keybind-v2.css → data-display/keybind/keybind.css} +1 -1
  87. package/src/{v2/components/keybind-v2.tsx → data-display/keybind/keybind.tsx} +3 -3
  88. package/src/{v2/components/line-comment-v2.tsx → data-display/line-comment/line-comment.tsx} +17 -15
  89. package/src/{v2/components/project-avatar-v2.tsx → data-display/project-avatar/project-avatar.tsx} +1 -1
  90. package/src/{v2/components/loader-v2.tsx → feedback/loader/loader.tsx} +2 -2
  91. package/src/feedback/progress-circle/progress-circle.css +28 -0
  92. package/src/feedback/progress-circle/progress-circle.tsx +64 -0
  93. package/src/{v2/components/toast-v2.tsx → feedback/toast/toast.tsx} +60 -58
  94. package/src/{components → forms/checkbox}/checkbox.css +1 -7
  95. package/src/{components → forms/checkbox}/checkbox.tsx +13 -13
  96. package/src/{v2/components/field-v2.tsx → forms/field/field.tsx} +9 -11
  97. package/src/{v2/components/radio-v2.tsx → forms/radio/radio.tsx} +30 -20
  98. package/src/{v2/components/select-v2.css → forms/select/select.css} +2 -8
  99. package/src/{v2/components/select-v2.tsx → forms/select/select.tsx} +38 -32
  100. package/src/{v2/components/switch-v2.css → forms/switch/switch.css} +110 -0
  101. package/src/forms/switch/switch.tsx +34 -0
  102. package/src/{v2/components/text-input-v2.tsx → forms/text-input/text-input.tsx} +4 -4
  103. package/src/{v2/components/textarea-v2.tsx → forms/textarea/textarea.tsx} +3 -3
  104. package/src/hooks/create-auto-scroll.tsx +20 -0
  105. package/src/i18n/am.ts +0 -2
  106. package/src/i18n/ar.ts +0 -2
  107. package/src/i18n/az.ts +0 -2
  108. package/src/i18n/bg.ts +0 -2
  109. package/src/i18n/bn.ts +0 -2
  110. package/src/i18n/br.ts +0 -2
  111. package/src/i18n/bs.ts +0 -2
  112. package/src/i18n/ca.ts +0 -2
  113. package/src/i18n/cs.ts +0 -2
  114. package/src/i18n/da.ts +0 -2
  115. package/src/i18n/de.ts +0 -2
  116. package/src/i18n/dv.ts +0 -2
  117. package/src/i18n/dz.ts +0 -2
  118. package/src/i18n/el.ts +0 -2
  119. package/src/i18n/en.ts +18 -4
  120. package/src/i18n/es.ts +0 -2
  121. package/src/i18n/et.ts +0 -2
  122. package/src/i18n/fa.ts +0 -2
  123. package/src/i18n/fi.ts +0 -2
  124. package/src/i18n/fo.ts +0 -2
  125. package/src/i18n/fr.ts +0 -2
  126. package/src/i18n/he.ts +199 -0
  127. package/src/i18n/hi.ts +0 -2
  128. package/src/i18n/hr.ts +0 -2
  129. package/src/i18n/hu.ts +0 -2
  130. package/src/i18n/hy.ts +0 -2
  131. package/src/i18n/id.ts +0 -2
  132. package/src/i18n/is.ts +0 -2
  133. package/src/i18n/it.ts +0 -2
  134. package/src/i18n/ja.ts +0 -2
  135. package/src/i18n/ka.ts +0 -2
  136. package/src/i18n/km.ts +0 -2
  137. package/src/i18n/ko.ts +0 -2
  138. package/src/i18n/lo.ts +0 -2
  139. package/src/i18n/lt.ts +0 -2
  140. package/src/i18n/lv.ts +0 -2
  141. package/src/i18n/mk.ts +0 -2
  142. package/src/i18n/mn.ts +0 -2
  143. package/src/i18n/ms.ts +0 -2
  144. package/src/i18n/my.ts +0 -2
  145. package/src/i18n/ne.ts +0 -2
  146. package/src/i18n/nl.ts +0 -2
  147. package/src/i18n/no.ts +0 -2
  148. package/src/i18n/pa.ts +0 -2
  149. package/src/i18n/pl.ts +0 -2
  150. package/src/i18n/ro.ts +0 -2
  151. package/src/i18n/ru.ts +0 -2
  152. package/src/i18n/si.ts +0 -2
  153. package/src/i18n/sk.ts +0 -2
  154. package/src/i18n/sl.ts +0 -2
  155. package/src/i18n/sq.ts +0 -2
  156. package/src/i18n/sr.ts +0 -2
  157. package/src/i18n/sv.ts +0 -2
  158. package/src/i18n/tg.ts +0 -2
  159. package/src/i18n/th.ts +0 -2
  160. package/src/i18n/tk.ts +0 -2
  161. package/src/i18n/tr.ts +0 -2
  162. package/src/i18n/uk.ts +0 -2
  163. package/src/i18n/ur.ts +0 -2
  164. package/src/i18n/uz.ts +0 -2
  165. package/src/i18n/vi.ts +0 -2
  166. package/src/i18n/zh.ts +0 -2
  167. package/src/i18n/zht.ts +0 -2
  168. package/src/{components/icon.tsx → icons/icon/additional-icons.ts} +8 -74
  169. package/src/icons/icon/icon.css +3 -0
  170. package/src/{v2/components → icons/icon}/icon.tsx +42 -9
  171. package/src/{v2/components/divider-v2.tsx → layout/divider/divider.tsx} +3 -3
  172. package/src/{v2/components/menu-v2.css → navigation/menu/menu.css} +121 -0
  173. package/src/{v2/components/menu-v2.tsx → navigation/menu/menu.tsx} +96 -32
  174. package/src/{v2/components/segmented-control-v2.tsx → navigation/segmented-control/segmented-control.tsx} +9 -8
  175. package/src/{v2/components/tabs-v2.css → navigation/tabs/tabs-current.css} +24 -9
  176. package/src/{components → navigation/tabs}/tabs.css +39 -229
  177. package/src/navigation/tabs/tabs.tsx +194 -0
  178. package/src/{v2/components/dialog-v2.css → overlays/dialog/dialog.css} +3 -0
  179. package/src/{v2/components/dialog-v2.tsx → overlays/dialog/dialog.tsx} +11 -13
  180. package/src/{v2/components/tooltip-v2.css → overlays/tooltip/tooltip.css} +26 -0
  181. package/src/{v2/components/tooltip-v2.tsx → overlays/tooltip/tooltip.tsx} +18 -14
  182. package/src/styles/index.css +4 -20
  183. package/src/styles/tailwind/index.css +15 -1
  184. package/src/{v2/styles → styles/tokens}/theme.css +0 -12
  185. package/src/theme/context.tsx +19 -11
  186. package/src/theme/themes/oc-2.json +1 -1
  187. package/src/{components → typography/text-shimmer}/text-shimmer.css +2 -1
  188. package/src/{components → typography/text-shimmer}/text-shimmer.tsx +1 -0
  189. package/src/{v2/components/wordmark-v2.tsx → typography/wordmark/wordmark.tsx} +1 -1
  190. package/dist/components/avatar.d.ts +0 -9
  191. package/dist/components/button.d.ts +0 -9
  192. package/dist/components/dialog.d.ts +0 -12
  193. package/dist/components/dropdown-menu.d.ts +0 -80
  194. package/dist/components/icon-button.d.ts +0 -10
  195. package/dist/components/keybind.d.ts +0 -6
  196. package/dist/components/radio-group.d.ts +0 -16
  197. package/dist/components/select.d.ts +0 -21
  198. package/dist/components/tag.d.ts +0 -5
  199. package/dist/components/toast.d.ts +0 -56
  200. package/dist/components/tooltip.d.ts +0 -17
  201. package/dist/v2/components/accordion-v2.d.ts +0 -26
  202. package/dist/v2/components/badge-v2.d.ts +0 -6
  203. package/dist/v2/components/button-v2.d.ts +0 -10
  204. package/dist/v2/components/checkbox-v2.d.ts +0 -10
  205. package/dist/v2/components/diff-changes-v2.d.ts +0 -11
  206. package/dist/v2/components/divider-v2.d.ts +0 -5
  207. package/dist/v2/components/icon-button-v2.d.ts +0 -11
  208. package/dist/v2/components/inline-input-v2.d.ts +0 -21
  209. package/dist/v2/components/keybind-v2.d.ts +0 -7
  210. package/dist/v2/components/loader-v2.d.ts +0 -3
  211. package/dist/v2/components/menu-v2.d.ts +0 -52
  212. package/dist/v2/components/progress-circle-v2.d.ts +0 -8
  213. package/dist/v2/components/radio-v2.d.ts +0 -16
  214. package/dist/v2/components/split-button-v2.d.ts +0 -5
  215. package/dist/v2/components/switch-v2.d.ts +0 -7
  216. package/dist/v2/components/tabs-v2.d.ts +0 -34
  217. package/dist/v2/components/text-shimmer-v2.d.ts +0 -9
  218. package/dist/v2/components/textarea-v2.d.ts +0 -7
  219. package/dist/v2/components/toast-v2.d.ts +0 -57
  220. package/dist/v2/components/tooltip-v2.d.ts +0 -13
  221. package/dist/v2/components/wordmark-v2.d.ts +0 -2
  222. package/src/components/avatar.css +0 -49
  223. package/src/components/avatar.tsx +0 -55
  224. package/src/components/button.css +0 -194
  225. package/src/components/button.tsx +0 -33
  226. package/src/components/dialog.css +0 -181
  227. package/src/components/dialog.tsx +0 -72
  228. package/src/components/diff-changes.tsx +0 -115
  229. package/src/components/dropdown-menu.css +0 -135
  230. package/src/components/dropdown-menu.tsx +0 -308
  231. package/src/components/icon-button.css +0 -181
  232. package/src/components/icon-button.tsx +0 -29
  233. package/src/components/icon.css +0 -39
  234. package/src/components/keybind.css +0 -18
  235. package/src/components/keybind.tsx +0 -20
  236. package/src/components/progress-circle.css +0 -16
  237. package/src/components/progress-circle.tsx +0 -64
  238. package/src/components/radio-group.css +0 -187
  239. package/src/components/radio-group.tsx +0 -83
  240. package/src/components/select.css +0 -201
  241. package/src/components/select.tsx +0 -174
  242. package/src/components/switch.css +0 -136
  243. package/src/components/switch.tsx +0 -29
  244. package/src/components/tabs.tsx +0 -126
  245. package/src/components/tag.css +0 -37
  246. package/src/components/tag.tsx +0 -22
  247. package/src/components/toast.css +0 -236
  248. package/src/components/toast.tsx +0 -185
  249. package/src/components/tooltip.css +0 -74
  250. package/src/components/tooltip.tsx +0 -163
  251. package/src/v2/components/accordion-v2.css +0 -139
  252. package/src/v2/components/accordion-v2.tsx +0 -86
  253. package/src/v2/components/checkbox-v2.css +0 -184
  254. package/src/v2/components/checkbox-v2.tsx +0 -65
  255. package/src/v2/components/diff-changes-v2.css +0 -26
  256. package/src/v2/components/icon-button-v2.tsx +0 -37
  257. package/src/v2/components/inline-input-v2.css +0 -225
  258. package/src/v2/components/inline-input-v2.tsx +0 -107
  259. package/src/v2/components/progress-circle-v2.css +0 -13
  260. package/src/v2/components/progress-circle-v2.tsx +0 -52
  261. package/src/v2/components/switch-v2.tsx +0 -28
  262. package/src/v2/components/tabs-v2.tsx +0 -149
  263. package/src/v2/components/text-shimmer-v2.css +0 -125
  264. package/src/v2/components/text-shimmer-v2.tsx +0 -63
  265. /package/dist/{components → forms/inline-input}/inline-input.d.ts +0 -0
  266. /package/dist/{v2/components → navigation}/tab-state-indicator.d.ts +0 -0
  267. /package/src/{v2/components/button-v2.css → actions/button/button.css} +0 -0
  268. /package/src/{v2/components/icon-button-v2.css → actions/icon-button/icon-button.css} +0 -0
  269. /package/src/{v2/components/avatar-v2.css → data-display/avatar/avatar.css} +0 -0
  270. /package/src/{v2/components/line-comment-v2.css → data-display/line-comment/line-comment.css} +0 -0
  271. /package/src/{v2/components/project-avatar-v2.css → data-display/project-avatar/project-avatar.css} +0 -0
  272. /package/src/{v2/components/loader-v2.css → feedback/loader/loader.css} +0 -0
  273. /package/src/{v2/components/toast-v2.css → feedback/toast/toast.css} +0 -0
  274. /package/src/{v2/components/field-v2.css → forms/field/field.css} +0 -0
  275. /package/src/{components → forms/inline-input}/inline-input.css +0 -0
  276. /package/src/{components → forms/inline-input}/inline-input.tsx +0 -0
  277. /package/src/{v2/components/radio-v2.css → forms/radio/radio.css} +0 -0
  278. /package/src/{v2/components/text-input-v2.css → forms/text-input/text-input.css} +0 -0
  279. /package/src/{v2/components/textarea-v2.css → forms/textarea/textarea.css} +0 -0
  280. /package/src/{v2/components/divider-v2.css → layout/divider/divider.css} +0 -0
  281. /package/src/{v2/components/segmented-control-v2.css → navigation/segmented-control/segmented-control.css} +0 -0
  282. /package/src/{v2/components → navigation}/tab-state-indicator.tsx +0 -0
  283. /package/src/{v2/components/file-tree-v2.css → styles/file-tree.css} +0 -0
  284. /package/src/{v2/styles → styles/tokens}/colors.css +0 -0
  285. /package/src/{v2/styles/tailwind.css → styles/tokens/index.css} +0 -0
@@ -1,236 +0,0 @@
1
- [data-component="toast-region"] {
2
- position: fixed;
3
- bottom: 48px;
4
- inset-inline-end: 32px;
5
- z-index: 1000;
6
- display: flex;
7
- flex-direction: column;
8
- gap: 8px;
9
- max-width: min(400px, calc(100vw - 64px));
10
- max-height: calc(100dvh - 96px);
11
- width: 100%;
12
- overflow: hidden;
13
- pointer-events: none;
14
-
15
- [data-slot="toast-list"] {
16
- display: flex;
17
- flex-direction: column;
18
- gap: 8px;
19
- list-style: none;
20
- margin: 0;
21
- padding: 0;
22
- max-height: 100%;
23
- overflow-y: auto;
24
- scrollbar-width: none;
25
-
26
- &::-webkit-scrollbar {
27
- display: none;
28
- }
29
- }
30
- }
31
-
32
- [data-component="toast"] {
33
- position: relative;
34
- display: flex;
35
- align-items: flex-start;
36
- gap: 20px;
37
- padding: 16px 20px;
38
- max-height: min(420px, calc(100dvh - 96px));
39
- overflow: hidden;
40
- pointer-events: auto;
41
- transition: all 150ms ease-out;
42
-
43
- border-radius: var(--radius-lg);
44
- border: 1px solid var(--border-weak-base);
45
- background: var(--surface-float-base);
46
- color: var(--text-invert-base);
47
- box-shadow: var(--shadow-md);
48
-
49
- [data-slot="toast-inner"] {
50
- display: flex;
51
- align-items: flex-start;
52
- gap: 10px;
53
- }
54
-
55
- &[data-opened] {
56
- animation: toastPopIn 150ms ease-out;
57
- }
58
-
59
- &[data-closed] {
60
- animation: toastPopOut 100ms ease-in forwards;
61
- }
62
-
63
- &[data-swipe="move"] {
64
- transform: translateX(var(--kb-toast-swipe-move-x));
65
- }
66
-
67
- &[data-swipe="cancel"] {
68
- transform: translateX(0);
69
- transition: transform 200ms ease-out;
70
- }
71
-
72
- &[data-swipe="end"] {
73
- animation: toastSwipeOut 100ms ease-out forwards;
74
- }
75
-
76
- /* &[data-variant="success"] { */
77
- /* border-color: var(--color-semantic-positive); */
78
- /* } */
79
- /**/
80
- /* &[data-variant="error"] { */
81
- /* border-color: var(--color-semantic-danger); */
82
- /* } */
83
- /**/
84
- /* &[data-variant="loading"] { */
85
- /* border-color: var(--color-semantic-info); */
86
- /* } */
87
-
88
- [data-slot="toast-icon"] {
89
- flex-shrink: 0;
90
- display: flex;
91
- align-items: center;
92
- justify-content: center;
93
-
94
- [data-component="icon"] {
95
- color: var(--text-invert-stronger);
96
- /* color: var(--icon-invert-base); */
97
- }
98
- }
99
-
100
- [data-slot="toast-content"] {
101
- flex: 1;
102
- display: flex;
103
- flex-direction: column;
104
- gap: 2px;
105
- min-height: 0;
106
- min-width: 0;
107
- overflow-x: hidden;
108
- overflow-y: auto;
109
- scrollbar-width: none;
110
-
111
- &::-webkit-scrollbar {
112
- display: none;
113
- }
114
- }
115
-
116
- [data-slot="toast-title"] {
117
- color: var(--text-invert-strong);
118
- overflow: hidden;
119
- text-overflow: ellipsis;
120
- white-space: nowrap;
121
-
122
- /* text-14-medium */
123
- font-family: var(--font-family-sans);
124
- font-size: 14px;
125
- font-style: normal;
126
- font-weight: var(--font-weight-medium);
127
- line-height: var(--line-height-large); /* 142.857% */
128
- letter-spacing: var(--letter-spacing-normal);
129
-
130
- margin: 0;
131
- }
132
-
133
- [data-slot="toast-description"] {
134
- color: var(--text-invert-base);
135
- text-wrap-style: pretty;
136
- overflow-wrap: anywhere;
137
- word-break: break-word;
138
-
139
- /* text-14-regular */
140
- font-family: var(--font-family-sans);
141
- font-size: var(--font-size-base);
142
- font-style: normal;
143
- font-weight: var(--font-weight-regular);
144
- line-height: var(--line-height-x-large); /* 171.429% */
145
- letter-spacing: var(--letter-spacing-normal);
146
-
147
- margin: 0;
148
- }
149
-
150
- [data-slot="toast-actions"] {
151
- display: flex;
152
- flex-wrap: wrap;
153
- gap: 16px;
154
- margin-top: 8px;
155
- }
156
-
157
- [data-slot="toast-action"] {
158
- background: none;
159
- border: none;
160
- padding: 0;
161
- cursor: pointer;
162
- min-width: 0;
163
- max-width: 100%;
164
- overflow: hidden;
165
- text-overflow: ellipsis;
166
- white-space: nowrap;
167
-
168
- color: var(--text-invert-weak);
169
- font-family: var(--font-family-sans);
170
- font-size: var(--font-size-base);
171
- font-weight: var(--font-weight-medium);
172
- line-height: var(--line-height-large);
173
- letter-spacing: var(--letter-spacing-normal);
174
-
175
- &:hover {
176
- text-decoration: underline;
177
- }
178
-
179
- &:first-child {
180
- color: var(--text-invert-strong);
181
- }
182
- }
183
-
184
- [data-slot="toast-close-button"] {
185
- flex-shrink: 0;
186
- }
187
-
188
- [data-slot="toast-progress-track"] {
189
- position: absolute;
190
- bottom: 0;
191
- left: 0;
192
- right: 0;
193
- height: 3px;
194
- background-color: var(--surface-base);
195
- border-radius: 0 0 var(--radius-lg) var(--radius-lg);
196
- overflow: hidden;
197
- }
198
-
199
- [data-slot="toast-progress-fill"] {
200
- height: 100%;
201
- width: var(--kb-toast-progress-fill-width);
202
- background-color: var(--color-primary);
203
- transition: width 250ms linear;
204
- }
205
- }
206
-
207
- @keyframes toastPopIn {
208
- from {
209
- opacity: 0;
210
- transform: translateY(20px);
211
- }
212
- to {
213
- opacity: 1;
214
- transform: translateY(0);
215
- }
216
- }
217
-
218
- @keyframes toastPopOut {
219
- from {
220
- opacity: 1;
221
- transform: translateY(0);
222
- }
223
- to {
224
- opacity: 0;
225
- transform: translateY(20px);
226
- }
227
- }
228
-
229
- @keyframes toastSwipeOut {
230
- from {
231
- transform: translateX(var(--kb-toast-swipe-end-x));
232
- }
233
- to {
234
- transform: translateX(100%);
235
- }
236
- }
@@ -1,185 +0,0 @@
1
- import { Toast as Kobalte, toaster } from "@kobalte/core/toast"
2
- import type { ToastRootProps, ToastCloseButtonProps, ToastTitleProps, ToastDescriptionProps } from "@kobalte/core/toast"
3
- import type { ComponentProps, JSX } from "solid-js"
4
- import { Show } from "solid-js"
5
- import { Portal } from "solid-js/web"
6
- import { useI18n } from "../context/i18n"
7
- import { Icon, type IconProps } from "./icon"
8
- import { IconButton } from "./icon-button"
9
-
10
- export interface ToastRegionProps extends ComponentProps<typeof Kobalte.Region> {}
11
-
12
- function ToastRegion(props: ToastRegionProps) {
13
- return (
14
- <Portal>
15
- <Kobalte.Region data-component="toast-region" {...props}>
16
- <Kobalte.List data-slot="toast-list" />
17
- </Kobalte.Region>
18
- </Portal>
19
- )
20
- }
21
-
22
- export interface ToastRootComponentProps extends ToastRootProps {
23
- class?: string
24
- classList?: ComponentProps<"li">["classList"]
25
- children?: JSX.Element
26
- }
27
-
28
- function ToastRoot(props: ToastRootComponentProps) {
29
- return (
30
- <Kobalte
31
- data-component="toast"
32
- classList={{
33
- ...props.classList,
34
- [props.class ?? ""]: !!props.class,
35
- }}
36
- {...props}
37
- />
38
- )
39
- }
40
-
41
- function ToastIcon(props: { name: IconProps["name"] }) {
42
- return (
43
- <div data-slot="toast-icon">
44
- <Icon name={props.name} />
45
- </div>
46
- )
47
- }
48
-
49
- function ToastContent(props: ComponentProps<"div">) {
50
- return <div data-slot="toast-content" {...props} />
51
- }
52
-
53
- function ToastTitle(props: ToastTitleProps & ComponentProps<"div">) {
54
- return <Kobalte.Title data-slot="toast-title" {...props} />
55
- }
56
-
57
- function ToastDescription(props: ToastDescriptionProps & ComponentProps<"div">) {
58
- return <Kobalte.Description data-slot="toast-description" {...props} />
59
- }
60
-
61
- function ToastActions(props: ComponentProps<"div">) {
62
- return <div data-slot="toast-actions" {...props} />
63
- }
64
-
65
- function ToastCloseButton(props: ToastCloseButtonProps & ComponentProps<"button">) {
66
- const i18n = useI18n()
67
- return (
68
- <Kobalte.CloseButton
69
- data-slot="toast-close-button"
70
- as={IconButton}
71
- icon="close"
72
- variant="ghost"
73
- aria-label={i18n.t("ui.common.dismiss")}
74
- {...props}
75
- />
76
- )
77
- }
78
-
79
- function ToastProgressTrack(props: ComponentProps<typeof Kobalte.ProgressTrack>) {
80
- return <Kobalte.ProgressTrack data-slot="toast-progress-track" {...props} />
81
- }
82
-
83
- function ToastProgressFill(props: ComponentProps<typeof Kobalte.ProgressFill>) {
84
- return <Kobalte.ProgressFill data-slot="toast-progress-fill" {...props} />
85
- }
86
-
87
- export const Toast = Object.assign(ToastRoot, {
88
- Region: ToastRegion,
89
- Icon: ToastIcon,
90
- Content: ToastContent,
91
- Title: ToastTitle,
92
- Description: ToastDescription,
93
- Actions: ToastActions,
94
- CloseButton: ToastCloseButton,
95
- ProgressTrack: ToastProgressTrack,
96
- ProgressFill: ToastProgressFill,
97
- })
98
-
99
- export { toaster }
100
-
101
- export type ToastVariant = "default" | "success" | "error" | "loading"
102
-
103
- export interface ToastAction {
104
- label: string
105
- onClick: "dismiss" | (() => void)
106
- }
107
-
108
- export interface ToastOptions {
109
- title?: string
110
- description?: string
111
- icon?: IconProps["name"]
112
- variant?: ToastVariant
113
- duration?: number
114
- persistent?: boolean
115
- actions?: ToastAction[]
116
- }
117
-
118
- export function showToast(options: ToastOptions | string) {
119
- const opts = typeof options === "string" ? { description: options } : options
120
- return toaster.show((props) => (
121
- <Toast
122
- toastId={props.toastId}
123
- duration={opts.duration}
124
- persistent={opts.persistent}
125
- data-variant={opts.variant ?? "default"}
126
- >
127
- <Show when={opts.icon}>
128
- <Toast.Icon name={opts.icon!} />
129
- </Show>
130
- <Toast.Content>
131
- <Show when={opts.title}>
132
- <Toast.Title>{opts.title}</Toast.Title>
133
- </Show>
134
- <Show when={opts.description}>
135
- <Toast.Description>{opts.description}</Toast.Description>
136
- </Show>
137
- <Show when={opts.actions?.length}>
138
- <Toast.Actions>
139
- {opts.actions!.map((action) => (
140
- <button
141
- data-slot="toast-action"
142
- onClick={() => {
143
- if (typeof action.onClick === "function") {
144
- action.onClick()
145
- }
146
- toaster.dismiss(props.toastId)
147
- }}
148
- >
149
- {action.label}
150
- </button>
151
- ))}
152
- </Toast.Actions>
153
- </Show>
154
- </Toast.Content>
155
- <Toast.CloseButton />
156
- </Toast>
157
- ))
158
- }
159
-
160
- export interface ToastPromiseOptions<T, U = unknown> {
161
- loading?: JSX.Element
162
- success?: (data: T) => JSX.Element
163
- error?: (error: U) => JSX.Element
164
- }
165
-
166
- export function showPromiseToast<T, U = unknown>(
167
- promise: Promise<T> | (() => Promise<T>),
168
- options: ToastPromiseOptions<T, U>,
169
- ) {
170
- return toaster.promise(promise, (props) => (
171
- <Toast
172
- toastId={props.toastId}
173
- data-variant={props.state === "pending" ? "loading" : props.state === "fulfilled" ? "success" : "error"}
174
- >
175
- <Toast.Content>
176
- <Toast.Description>
177
- {props.state === "pending" && options.loading}
178
- {props.state === "fulfilled" && options.success?.(props.data!)}
179
- {props.state === "rejected" && options.error?.(props.error)}
180
- </Toast.Description>
181
- </Toast.Content>
182
- <Toast.CloseButton />
183
- </Toast>
184
- ))
185
- }
@@ -1,74 +0,0 @@
1
- [data-component="tooltip-trigger"] {
2
- display: flex;
3
- }
4
-
5
- [data-slot="tooltip-keybind"] {
6
- display: flex;
7
- align-items: center;
8
- gap: 12px;
9
- }
10
-
11
- [data-slot="tooltip-keybind-key"] {
12
- color: var(--text-invert-base);
13
- font-size: var(--font-size-small);
14
- font-weight: var(--font-weight-medium);
15
- line-height: var(--line-height-large);
16
- }
17
-
18
- [data-component="tooltip"] {
19
- z-index: 1000;
20
- max-width: 320px;
21
- border-radius: var(--radius-sm);
22
- background-color: var(--surface-float-base);
23
- color: var(--text-invert-strong);
24
- background: var(--surface-float-base);
25
- padding: 2px 8px;
26
- border: 1px solid var(--border-weak-base, rgba(0, 0, 0, 0.07));
27
-
28
- box-shadow: var(--shadow-md);
29
- pointer-events: none !important;
30
- /* transition: all 150ms ease-out; */
31
- /* transform: translate3d(0, 0, 0); */
32
- /* transform-origin: var(--kb-tooltip-content-transform-origin); */
33
-
34
- /* text-12-medium */
35
- font-family: var(--font-family-sans);
36
- font-size: var(--font-size-small);
37
- font-style: normal;
38
- font-weight: var(--font-weight-medium);
39
- line-height: var(--line-height-large); /* 166.667% */
40
- letter-spacing: var(--letter-spacing-normal);
41
-
42
- &[data-expanded] {
43
- opacity: 1;
44
- /* transform: translate3d(0, 0, 0); */
45
- }
46
-
47
- &[data-closed]:not([data-force-open="true"]) {
48
- opacity: 0;
49
- }
50
-
51
- /* &[data-placement="top"] { */
52
- /* &[data-closed] { */
53
- /* transform: translate3d(0, 4px, 0); */
54
- /* } */
55
- /* } */
56
- /**/
57
- /* &[data-placement="bottom"] { */
58
- /* &[data-closed] { */
59
- /* transform: translate3d(0, -4px, 0); */
60
- /* } */
61
- /* } */
62
- /**/
63
- /* &[data-placement="left"] { */
64
- /* &[data-closed] { */
65
- /* transform: translate3d(4px, 0, 0); */
66
- /* } */
67
- /* } */
68
- /**/
69
- /* &[data-placement="right"] { */
70
- /* &[data-closed] { */
71
- /* transform: translate3d(-4px, 0, 0); */
72
- /* } */
73
- /* } */
74
- }
@@ -1,163 +0,0 @@
1
- import { Tooltip as KobalteTooltip } from "@kobalte/core/tooltip"
2
- import { createEffect, Match, onCleanup, splitProps, Switch, type JSX } from "solid-js"
3
- import type { ComponentProps } from "solid-js"
4
- import { createStore } from "solid-js/store"
5
-
6
- export interface TooltipProps extends ComponentProps<typeof KobalteTooltip> {
7
- value: JSX.Element
8
- class?: string
9
- contentClass?: string
10
- contentStyle?: JSX.CSSProperties
11
- inactive?: boolean
12
- forceOpen?: boolean
13
- }
14
-
15
- export interface TooltipKeybindProps extends Omit<TooltipProps, "value"> {
16
- title: string
17
- keybind: string
18
- }
19
-
20
- export function TooltipKeybind(props: TooltipKeybindProps) {
21
- const [local, others] = splitProps(props, ["title", "keybind"])
22
- return (
23
- <Tooltip
24
- {...others}
25
- value={
26
- <div data-slot="tooltip-keybind">
27
- <span>{local.title}</span>
28
- <span data-slot="tooltip-keybind-key">{local.keybind}</span>
29
- </div>
30
- }
31
- />
32
- )
33
- }
34
-
35
- export function Tooltip(props: TooltipProps) {
36
- let ref: HTMLDivElement | undefined
37
- const [state, setState] = createStore({
38
- open: false,
39
- block: false,
40
- expand: false,
41
- })
42
- const [local, others] = splitProps(props, [
43
- "children",
44
- "class",
45
- "contentClass",
46
- "contentStyle",
47
- "inactive",
48
- "forceOpen",
49
- "ignoreSafeArea",
50
- "value",
51
- ])
52
-
53
- const close = () => setState("open", false)
54
-
55
- const inside = () => {
56
- const active = document.activeElement
57
- if (!ref || !active) return false
58
- return ref.contains(active)
59
- }
60
-
61
- const drop = (expand = state.expand) => {
62
- if (expand) return
63
- if (ref?.matches(":hover")) return
64
- if (inside()) return
65
- setState("block", false)
66
- }
67
-
68
- const sync = () => {
69
- const expand = !!ref?.querySelector('[aria-expanded="true"], [data-expanded]')
70
- setState("expand", expand)
71
- if (expand) {
72
- setState("block", true)
73
- close()
74
- return
75
- }
76
- drop(expand)
77
- }
78
-
79
- const arm = () => {
80
- setState("block", true)
81
- close()
82
- }
83
-
84
- const leave = () => {
85
- if (!inside()) close()
86
- drop()
87
- }
88
-
89
- createEffect(() => {
90
- if (!ref) return
91
- sync()
92
- const obs = new MutationObserver(sync)
93
- obs.observe(ref, {
94
- subtree: true,
95
- childList: true,
96
- attributes: true,
97
- attributeFilter: ["aria-expanded", "data-expanded"],
98
- })
99
- onCleanup(() => obs.disconnect())
100
- })
101
-
102
- let justClickedTrigger = false
103
-
104
- return (
105
- <Switch>
106
- <Match when={local.inactive}>{local.children}</Match>
107
- <Match when={true}>
108
- <KobalteTooltip
109
- gutter={4}
110
- openDelay={400}
111
- skipDelayDuration={300}
112
- {...others}
113
- closeDelay={0}
114
- ignoreSafeArea={local.ignoreSafeArea ?? true}
115
- open={local.forceOpen || state.open}
116
- onOpenChange={(open) => {
117
- if (local.forceOpen) return
118
- if (state.block && open) return
119
- if (justClickedTrigger) {
120
- justClickedTrigger = false
121
- return
122
- }
123
- setState("open", open)
124
- }}
125
- >
126
- <KobalteTooltip.Trigger
127
- ref={ref}
128
- as={"div"}
129
- data-component="tooltip-trigger"
130
- class={local.class}
131
- onPointerDownCapture={arm}
132
- onKeyDownCapture={(event: KeyboardEvent) => {
133
- if (event.key !== "Enter" && event.key !== " ") return
134
- arm()
135
- }}
136
- onPointerLeave={leave}
137
- onFocusOut={() => requestAnimationFrame(() => drop())}
138
- >
139
- {local.children}
140
- </KobalteTooltip.Trigger>
141
- <KobalteTooltip.Portal>
142
- <KobalteTooltip.Content
143
- data-component="tooltip"
144
- data-placement={props.placement}
145
- data-force-open={local.forceOpen}
146
- class={local.contentClass}
147
- style={local.contentStyle}
148
- onPointerDownOutside={(e) => {
149
- if (ref === e.target || (e.target instanceof Node && ref?.contains(e.target))) {
150
- justClickedTrigger = true
151
- }
152
- e.preventDefault()
153
- }}
154
- >
155
- {local.value}
156
- {/* <KobalteTooltip.Arrow data-slot="tooltip-arrow" /> */}
157
- </KobalteTooltip.Content>
158
- </KobalteTooltip.Portal>
159
- </KobalteTooltip>
160
- </Match>
161
- </Switch>
162
- )
163
- }