@opencode-ai/ui 0.0.0-dev-18424 → 0.0.0-dev-202608272004

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 (289) hide show
  1. package/dist/{data-display/accordion → components}/accordion.d.ts +6 -6
  2. package/dist/components/avatar.d.ts +9 -0
  3. package/dist/components/button.d.ts +9 -0
  4. package/dist/components/card.d.ts +1 -1
  5. package/dist/{forms/checkbox → components}/checkbox.d.ts +2 -2
  6. package/dist/components/dialog.d.ts +12 -0
  7. package/dist/{data-display/diff-changes → components}/diff-changes.d.ts +1 -2
  8. package/dist/components/dropdown-menu.d.ts +80 -0
  9. package/dist/components/icon-button.d.ts +10 -0
  10. package/dist/{icons/icon/additional-icons.d.ts → components/icon.d.ts} +8 -8
  11. package/dist/components/keybind.d.ts +6 -0
  12. package/dist/components/list.d.ts +1 -1
  13. package/dist/{feedback/progress-circle → components}/progress-circle.d.ts +0 -2
  14. package/dist/components/radio-group.d.ts +16 -0
  15. package/dist/components/scroll-view.d.ts +3 -3
  16. package/dist/components/select.d.ts +21 -0
  17. package/dist/{forms/switch → components}/switch.d.ts +2 -4
  18. package/dist/{navigation/tabs → components}/tabs.d.ts +8 -15
  19. package/dist/components/tag.d.ts +5 -0
  20. package/dist/{typography/text-shimmer → components}/text-shimmer.d.ts +0 -1
  21. package/dist/components/toast.d.ts +56 -0
  22. package/dist/components/tooltip.d.ts +17 -0
  23. package/dist/context/i18n.d.ts +7 -10
  24. package/dist/i18n/ar.d.ts +2 -0
  25. package/dist/i18n/bg.d.ts +2 -0
  26. package/dist/i18n/br.d.ts +2 -0
  27. package/dist/i18n/bs.d.ts +2 -0
  28. package/dist/i18n/da.d.ts +2 -0
  29. package/dist/i18n/de.d.ts +2 -0
  30. package/dist/i18n/en.d.ts +1 -227
  31. package/dist/i18n/es.d.ts +2 -0
  32. package/dist/i18n/fr.d.ts +2 -0
  33. package/dist/i18n/ja.d.ts +2 -0
  34. package/dist/i18n/km.d.ts +2 -0
  35. package/dist/i18n/ko.d.ts +2 -0
  36. package/dist/i18n/lo.d.ts +2 -0
  37. package/dist/i18n/mk.d.ts +2 -0
  38. package/dist/i18n/mn.d.ts +2 -0
  39. package/dist/i18n/my.d.ts +2 -0
  40. package/dist/i18n/pl.d.ts +2 -0
  41. package/dist/i18n/ru.d.ts +2 -0
  42. package/dist/i18n/sr.d.ts +2 -0
  43. package/dist/i18n/tg.d.ts +2 -0
  44. package/dist/i18n/th.d.ts +2 -0
  45. package/dist/i18n/tr.d.ts +2 -0
  46. package/dist/i18n/zh.d.ts +2 -0
  47. package/dist/i18n/zht.d.ts +2 -0
  48. package/dist/v2/components/accordion-v2.d.ts +26 -0
  49. package/dist/{data-display/avatar/avatar.d.ts → v2/components/avatar-v2.d.ts} +1 -1
  50. package/dist/v2/components/badge-v2.d.ts +6 -0
  51. package/dist/v2/components/button-v2.d.ts +10 -0
  52. package/dist/v2/components/checkbox-v2.d.ts +10 -0
  53. package/dist/{overlays/dialog/dialog.d.ts → v2/components/dialog-v2.d.ts} +2 -1
  54. package/dist/v2/components/diff-changes-v2.d.ts +11 -0
  55. package/dist/v2/components/divider-v2.d.ts +5 -0
  56. package/dist/{forms/field/field.d.ts → v2/components/field-v2.d.ts} +10 -4
  57. package/dist/v2/components/icon-button-v2.d.ts +11 -0
  58. package/dist/{icons/icon → v2/components}/icon.d.ts +1 -24
  59. package/dist/v2/components/inline-input-v2.d.ts +21 -0
  60. package/dist/v2/components/keybind-v2.d.ts +7 -0
  61. package/dist/{data-display/line-comment/line-comment.d.ts → v2/components/line-comment-v2.d.ts} +9 -9
  62. package/dist/v2/components/loader-v2.d.ts +3 -0
  63. package/dist/v2/components/menu-v2.d.ts +52 -0
  64. package/dist/v2/components/progress-circle-v2.d.ts +8 -0
  65. package/dist/{data-display/project-avatar/project-avatar.d.ts → v2/components/project-avatar-v2.d.ts} +1 -1
  66. package/dist/v2/components/radio-v2.d.ts +16 -0
  67. package/dist/{navigation/segmented-control/segmented-control.d.ts → v2/components/segmented-control-v2.d.ts} +5 -5
  68. package/dist/{forms/select/select.d.ts → v2/components/select-v2.d.ts} +6 -4
  69. package/dist/v2/components/split-button-v2.d.ts +5 -0
  70. package/dist/v2/components/switch-v2.d.ts +7 -0
  71. package/dist/v2/components/tabs-v2.d.ts +34 -0
  72. package/dist/{forms/text-input/text-input.d.ts → v2/components/text-input-v2.d.ts} +3 -3
  73. package/dist/v2/components/text-shimmer-v2.d.ts +9 -0
  74. package/dist/v2/components/textarea-v2.d.ts +7 -0
  75. package/dist/v2/components/toast-v2.d.ts +57 -0
  76. package/dist/v2/components/tooltip-v2.d.ts +13 -0
  77. package/dist/v2/components/wordmark-v2.d.ts +2 -0
  78. package/package.json +13 -131
  79. package/src/{data-display/accordion → components}/accordion.css +26 -1
  80. package/src/{data-display/accordion → components}/accordion.tsx +14 -14
  81. package/src/components/animated-number.css +11 -29
  82. package/src/components/animated-number.tsx +2 -2
  83. package/src/components/avatar.css +49 -0
  84. package/src/components/avatar.tsx +55 -0
  85. package/src/components/button.css +194 -0
  86. package/src/{actions/button → components}/button.tsx +11 -10
  87. package/src/components/card.css +23 -2
  88. package/src/components/card.tsx +4 -4
  89. package/src/{forms/checkbox → components}/checkbox.css +7 -1
  90. package/src/{forms/checkbox → components}/checkbox.tsx +13 -13
  91. package/src/components/collapsible.tsx +2 -2
  92. package/src/components/dialog.css +181 -0
  93. package/src/components/dialog.tsx +72 -0
  94. package/src/{data-display/diff-changes → components}/diff-changes.css +19 -22
  95. package/src/components/diff-changes.tsx +115 -0
  96. package/src/components/dock-surface.css +9 -2
  97. package/src/components/dropdown-menu.css +135 -0
  98. package/src/components/dropdown-menu.tsx +308 -0
  99. package/src/components/icon-button.css +181 -0
  100. package/src/components/icon-button.tsx +29 -0
  101. package/src/components/icon.css +39 -0
  102. package/src/{icons/icon/additional-icons.ts → components/icon.tsx} +74 -8
  103. package/src/components/image-preview.tsx +2 -3
  104. package/src/components/keybind.css +18 -0
  105. package/src/components/keybind.tsx +20 -0
  106. package/src/components/list.css +5 -5
  107. package/src/components/list.tsx +5 -7
  108. package/src/components/popover.tsx +2 -3
  109. package/src/components/progress-circle.css +16 -0
  110. package/src/components/progress-circle.tsx +64 -0
  111. package/src/components/radio-group.css +187 -0
  112. package/src/components/radio-group.tsx +83 -0
  113. package/src/components/scroll-view.tsx +20 -5
  114. package/src/components/select.css +201 -0
  115. package/src/components/select.tsx +174 -0
  116. package/src/components/sticky-accordion-header.tsx +1 -1
  117. package/src/components/switch.css +136 -0
  118. package/src/components/switch.tsx +29 -0
  119. package/src/{navigation/tabs → components}/tabs.css +229 -39
  120. package/src/components/tabs.tsx +126 -0
  121. package/src/components/tag.css +37 -0
  122. package/src/components/tag.tsx +22 -0
  123. package/src/components/text-field.tsx +4 -12
  124. package/src/{typography/text-shimmer → components}/text-shimmer.css +1 -2
  125. package/src/{typography/text-shimmer → components}/text-shimmer.tsx +0 -1
  126. package/src/components/toast.css +236 -0
  127. package/src/components/toast.tsx +185 -0
  128. package/src/components/tooltip.css +74 -0
  129. package/src/components/tooltip.tsx +163 -0
  130. package/src/context/dialog.tsx +0 -1
  131. package/src/context/i18n.tsx +14 -17
  132. package/src/hooks/create-auto-scroll.tsx +0 -20
  133. package/src/i18n/am.ts +3 -1
  134. package/src/i18n/ar.ts +3 -1
  135. package/src/i18n/az.ts +3 -1
  136. package/src/i18n/bg.ts +3 -1
  137. package/src/i18n/bn.ts +3 -1
  138. package/src/i18n/br.ts +3 -1
  139. package/src/i18n/bs.ts +3 -1
  140. package/src/i18n/ca.ts +3 -1
  141. package/src/i18n/cs.ts +3 -1
  142. package/src/i18n/da.ts +3 -1
  143. package/src/i18n/de.ts +3 -1
  144. package/src/i18n/dv.ts +3 -1
  145. package/src/i18n/dz.ts +3 -1
  146. package/src/i18n/el.ts +3 -1
  147. package/src/i18n/en.ts +5 -37
  148. package/src/i18n/es.ts +3 -1
  149. package/src/i18n/et.ts +3 -1
  150. package/src/i18n/fa.ts +3 -1
  151. package/src/i18n/fi.ts +3 -1
  152. package/src/i18n/fo.ts +3 -1
  153. package/src/i18n/fr.ts +3 -1
  154. package/src/i18n/hi.ts +3 -1
  155. package/src/i18n/hr.ts +3 -1
  156. package/src/i18n/hu.ts +3 -1
  157. package/src/i18n/hy.ts +3 -1
  158. package/src/i18n/id.ts +3 -1
  159. package/src/i18n/is.ts +3 -1
  160. package/src/i18n/it.ts +3 -1
  161. package/src/i18n/ja.ts +3 -1
  162. package/src/i18n/ka.ts +3 -1
  163. package/src/i18n/km.ts +3 -1
  164. package/src/i18n/ko.ts +3 -1
  165. package/src/i18n/lo.ts +3 -1
  166. package/src/i18n/lt.ts +3 -1
  167. package/src/i18n/lv.ts +3 -1
  168. package/src/i18n/mk.ts +3 -1
  169. package/src/i18n/mn.ts +3 -1
  170. package/src/i18n/ms.ts +3 -1
  171. package/src/i18n/my.ts +3 -1
  172. package/src/i18n/ne.ts +3 -1
  173. package/src/i18n/nl.ts +3 -1
  174. package/src/i18n/no.ts +3 -1
  175. package/src/i18n/pa.ts +3 -1
  176. package/src/i18n/pl.ts +3 -1
  177. package/src/i18n/ro.ts +3 -1
  178. package/src/i18n/ru.ts +3 -1
  179. package/src/i18n/si.ts +3 -1
  180. package/src/i18n/sk.ts +3 -1
  181. package/src/i18n/sl.ts +3 -1
  182. package/src/i18n/sq.ts +3 -1
  183. package/src/i18n/sr.ts +3 -1
  184. package/src/i18n/sv.ts +3 -1
  185. package/src/i18n/tg.ts +3 -1
  186. package/src/i18n/th.ts +3 -1
  187. package/src/i18n/tk.ts +3 -1
  188. package/src/i18n/tr.ts +3 -1
  189. package/src/i18n/uk.ts +3 -1
  190. package/src/i18n/ur.ts +3 -1
  191. package/src/i18n/uz.ts +3 -1
  192. package/src/i18n/vi.ts +3 -1
  193. package/src/i18n/zh.ts +3 -1
  194. package/src/i18n/zht.ts +3 -1
  195. package/src/styles/index.css +20 -4
  196. package/src/styles/tailwind/colors.css +0 -1
  197. package/src/styles/tailwind/index.css +1 -18
  198. package/src/styles/theme.css +2 -2
  199. package/src/theme/context.tsx +11 -19
  200. package/src/theme/themes/oc-2.json +1 -3
  201. package/src/theme/v2/foreground.ts +0 -1
  202. package/src/v2/components/accordion-v2.css +139 -0
  203. package/src/v2/components/accordion-v2.tsx +86 -0
  204. package/src/{data-display/avatar/avatar.tsx → v2/components/avatar-v2.tsx} +1 -1
  205. package/src/{data-display/badge/badge.css → v2/components/badge-v2.css} +0 -19
  206. package/src/{data-display/badge/badge.tsx → v2/components/badge-v2.tsx} +4 -6
  207. package/src/v2/components/button-v2.tsx +35 -0
  208. package/src/v2/components/checkbox-v2.css +184 -0
  209. package/src/v2/components/checkbox-v2.tsx +65 -0
  210. package/src/{overlays/dialog/dialog.css → v2/components/dialog-v2.css} +0 -3
  211. package/src/{overlays/dialog/dialog.tsx → v2/components/dialog-v2.tsx} +13 -11
  212. package/src/v2/components/diff-changes-v2.css +26 -0
  213. package/src/{data-display/diff-changes/diff-changes.tsx → v2/components/diff-changes-v2.tsx} +2 -7
  214. package/src/{layout/divider/divider.tsx → v2/components/divider-v2.tsx} +3 -3
  215. package/src/{forms/field/field.css → v2/components/field-v2.css} +1 -1
  216. package/src/{forms/field/field.tsx → v2/components/field-v2.tsx} +11 -9
  217. package/src/v2/components/icon-button-v2.tsx +37 -0
  218. package/src/{icons/icon → v2/components}/icon.tsx +9 -50
  219. package/src/v2/components/inline-input-v2.css +225 -0
  220. package/src/v2/components/inline-input-v2.tsx +107 -0
  221. package/src/{data-display/keybind/keybind.css → v2/components/keybind-v2.css} +1 -1
  222. package/src/{data-display/keybind/keybind.tsx → v2/components/keybind-v2.tsx} +3 -3
  223. package/src/{data-display/line-comment/line-comment.css → v2/components/line-comment-v2.css} +3 -3
  224. package/src/{data-display/line-comment/line-comment.tsx → v2/components/line-comment-v2.tsx} +15 -17
  225. package/src/{feedback/loader/loader.tsx → v2/components/loader-v2.tsx} +2 -2
  226. package/src/{navigation/menu/menu.css → v2/components/menu-v2.css} +2 -122
  227. package/src/{navigation/menu/menu.tsx → v2/components/menu-v2.tsx} +32 -96
  228. package/src/v2/components/progress-circle-v2.css +13 -0
  229. package/src/v2/components/progress-circle-v2.tsx +52 -0
  230. package/src/{data-display/project-avatar/project-avatar.tsx → v2/components/project-avatar-v2.tsx} +1 -1
  231. package/src/{forms/radio/radio.tsx → v2/components/radio-v2.tsx} +20 -30
  232. package/src/{navigation/segmented-control/segmented-control.css → v2/components/segmented-control-v2.css} +1 -1
  233. package/src/{navigation/segmented-control/segmented-control.tsx → v2/components/segmented-control-v2.tsx} +8 -9
  234. package/src/{forms/select/select.css → v2/components/select-v2.css} +8 -2
  235. package/src/{forms/select/select.tsx → v2/components/select-v2.tsx} +32 -38
  236. package/src/{actions/split-button/split-button.css → v2/components/split-button-v2.css} +6 -1
  237. package/src/{actions/split-button/split-button.tsx → v2/components/split-button-v2.tsx} +4 -4
  238. package/src/{forms/switch/switch.css → v2/components/switch-v2.css} +0 -110
  239. package/src/v2/components/switch-v2.tsx +28 -0
  240. package/src/{navigation/tabs/tabs-current.css → v2/components/tabs-v2.css} +10 -25
  241. package/src/v2/components/tabs-v2.tsx +149 -0
  242. package/src/{forms/text-input/text-input.css → v2/components/text-input-v2.css} +1 -1
  243. package/src/{forms/text-input/text-input.tsx → v2/components/text-input-v2.tsx} +4 -4
  244. package/src/v2/components/text-shimmer-v2.css +125 -0
  245. package/src/v2/components/text-shimmer-v2.tsx +63 -0
  246. package/src/{forms/textarea/textarea.tsx → v2/components/textarea-v2.tsx} +3 -3
  247. package/src/{feedback/toast/toast.tsx → v2/components/toast-v2.tsx} +58 -60
  248. package/src/{overlays/tooltip/tooltip.css → v2/components/tooltip-v2.css} +0 -26
  249. package/src/{overlays/tooltip/tooltip.tsx → v2/components/tooltip-v2.tsx} +14 -21
  250. package/src/{typography/wordmark/wordmark.tsx → v2/components/wordmark-v2.tsx} +1 -1
  251. package/src/{styles/tokens → v2/styles}/theme.css +14 -10
  252. package/dist/actions/button/button.d.ts +0 -10
  253. package/dist/actions/icon-button/icon-button.d.ts +0 -11
  254. package/dist/actions/split-button/split-button.d.ts +0 -5
  255. package/dist/data-display/badge/badge.d.ts +0 -7
  256. package/dist/data-display/keybind/keybind.d.ts +0 -7
  257. package/dist/feedback/loader/loader.d.ts +0 -3
  258. package/dist/feedback/toast/toast.d.ts +0 -57
  259. package/dist/forms/radio/radio.d.ts +0 -16
  260. package/dist/forms/textarea/textarea.d.ts +0 -7
  261. package/dist/i18n/he.d.ts +0 -197
  262. package/dist/layout/divider/divider.d.ts +0 -5
  263. package/dist/navigation/menu/menu.d.ts +0 -59
  264. package/dist/overlays/tooltip/tooltip.d.ts +0 -15
  265. package/dist/typography/wordmark/wordmark.d.ts +0 -2
  266. package/src/actions/icon-button/icon-button.tsx +0 -32
  267. package/src/feedback/progress-circle/progress-circle.css +0 -28
  268. package/src/feedback/progress-circle/progress-circle.tsx +0 -64
  269. package/src/forms/switch/switch.tsx +0 -34
  270. package/src/i18n/he.ts +0 -199
  271. package/src/icons/icon/icon.css +0 -3
  272. package/src/navigation/tabs/tabs.tsx +0 -194
  273. /package/dist/{forms/inline-input → components}/inline-input.d.ts +0 -0
  274. /package/dist/{navigation → v2/components}/tab-state-indicator.d.ts +0 -0
  275. /package/src/{forms/inline-input → components}/inline-input.css +0 -0
  276. /package/src/{forms/inline-input → components}/inline-input.tsx +0 -0
  277. /package/src/{data-display/avatar/avatar.css → v2/components/avatar-v2.css} +0 -0
  278. /package/src/{actions/button/button.css → v2/components/button-v2.css} +0 -0
  279. /package/src/{layout/divider/divider.css → v2/components/divider-v2.css} +0 -0
  280. /package/src/{styles/file-tree.css → v2/components/file-tree-v2.css} +0 -0
  281. /package/src/{actions/icon-button/icon-button.css → v2/components/icon-button-v2.css} +0 -0
  282. /package/src/{feedback/loader/loader.css → v2/components/loader-v2.css} +0 -0
  283. /package/src/{data-display/project-avatar/project-avatar.css → v2/components/project-avatar-v2.css} +0 -0
  284. /package/src/{forms/radio/radio.css → v2/components/radio-v2.css} +0 -0
  285. /package/src/{navigation → v2/components}/tab-state-indicator.tsx +0 -0
  286. /package/src/{forms/textarea/textarea.css → v2/components/textarea-v2.css} +0 -0
  287. /package/src/{feedback/toast/toast.css → v2/components/toast-v2.css} +0 -0
  288. /package/src/{styles/tokens → v2/styles}/colors.css +0 -0
  289. /package/src/{styles/tokens/index.css → v2/styles/tailwind.css} +0 -0
@@ -0,0 +1,236 @@
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
+ }
@@ -0,0 +1,185 @@
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
+ }
@@ -0,0 +1,74 @@
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
+ }
@@ -0,0 +1,163 @@
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
+ }
@@ -81,7 +81,6 @@ function init() {
81
81
  let dispose: (() => void) | undefined
82
82
  let setClosing: ((closing: boolean) => void) | undefined
83
83
 
84
- // Stacked dialogs render as sibling portals, so only the top layer may own the focus trap.
85
84
  const node = runWithOwner(owner, () =>
86
85
  createRoot((d: () => void) => {
87
86
  dispose = d