@choice-ui/react 1.6.7 → 1.6.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/code-block/dist/index.d.ts +11 -14
- package/dist/components/code-block/dist/index.js +120 -93
- package/dist/components/code-block/src/code-block.d.ts +1 -2
- package/dist/components/code-block/src/code-block.js +11 -21
- package/dist/components/code-block/src/components/code-block-code.js +25 -13
- package/dist/components/code-block/src/components/code-block-content.d.ts +1 -1
- package/dist/components/code-block/src/components/code-block-content.js +14 -11
- package/dist/components/code-block/src/components/code-block-footer.js +4 -3
- package/dist/components/code-block/src/components/code-block-header.js +5 -6
- package/dist/components/code-block/src/hooks/index.d.ts +0 -1
- package/dist/components/code-block/src/hooks/use-code-block.js +26 -5
- package/dist/components/code-block/src/hooks/use-scroll-detection.d.ts +1 -2
- package/dist/components/code-block/src/hooks/use-scroll-detection.js +18 -12
- package/dist/components/code-block/src/types.d.ts +3 -5
- package/dist/components/code-block/src/utils/extract-code.js +23 -0
- package/dist/components/command/src/components/command-list.js +15 -3
- package/dist/components/description/dist/index.d.ts +8 -0
- package/dist/components/description/dist/index.js +29 -0
- package/dist/components/description/src/description.d.ts +6 -0
- package/dist/components/description/src/description.js +18 -0
- package/dist/components/description/src/index.d.ts +2 -0
- package/dist/components/description/src/tv.d.ts +13 -0
- package/dist/components/description/src/tv.js +15 -0
- package/dist/components/description/tsup.config.d.ts +2 -0
- package/dist/components/emoji-picker/dist/index.d.ts +1 -0
- package/dist/components/emoji-picker/dist/index.js +4 -2
- package/dist/components/emoji-picker/src/emoji-picker.d.ts +1 -0
- package/dist/components/emoji-picker/src/emoji-picker.js +4 -2
- package/dist/components/error-message/dist/index.d.ts +8 -0
- package/dist/components/error-message/dist/index.js +30 -0
- package/dist/components/error-message/src/error-message.d.ts +6 -0
- package/dist/components/error-message/src/error-message.js +19 -0
- package/dist/components/error-message/src/index.d.ts +2 -0
- package/dist/components/error-message/src/tv.d.ts +13 -0
- package/dist/components/error-message/src/tv.js +15 -0
- package/dist/components/error-message/tsup.config.d.ts +2 -0
- package/dist/components/form/src/adapters/base-adapter.js +4 -2
- package/dist/components/form/src/tv.d.ts +0 -12
- package/dist/components/form/src/tv.js +1 -13
- package/dist/components/index.d.ts +3 -0
- package/dist/components/md-render/dist/index.d.ts +2 -1
- package/dist/components/md-render/dist/index.js +5 -9
- package/dist/components/md-render/src/components/markdown-components.js +1 -7
- package/dist/components/md-render/src/md-render.js +4 -2
- package/dist/components/md-render/src/types.d.ts +2 -1
- package/dist/components/notifications/dist/index.d.ts +1 -5
- package/dist/components/notifications/src/notifications.d.ts +0 -1
- package/dist/components/notifications/src/notifications.js +0 -1
- package/dist/components/numeric-input/dist/index.d.ts +23 -9
- package/dist/components/numeric-input/dist/index.js +26 -3
- package/dist/components/numeric-input/src/components/numeric-input-menu-trigger.js +4 -1
- package/dist/components/numeric-input/src/hooks/index.d.ts +1 -0
- package/dist/components/numeric-input/src/hooks/use-numeric-long-press.d.ts +13 -0
- package/dist/components/numeric-input/src/hooks/use-numeric-long-press.js +27 -0
- package/dist/components/numeric-input/src/index.d.ts +1 -0
- package/dist/components/numeric-input/src/tv.js +22 -2
- package/dist/components/picture-preview/dist/index.d.ts +5 -0
- package/dist/components/picture-preview/dist/index.js +287 -140
- package/dist/components/picture-preview/src/hooks/useWheelHandler.d.ts +6 -1
- package/dist/components/picture-preview/src/hooks/useWheelHandler.js +25 -7
- package/dist/components/picture-preview/src/picture-preview.d.ts +5 -0
- package/dist/components/picture-preview/src/picture-preview.js +214 -123
- package/dist/components/picture-preview/src/tv.d.ts +93 -3
- package/dist/components/picture-preview/src/tv.js +48 -10
- package/dist/components/separator/dist/index.d.ts +1 -8
- package/dist/components/separator/src/separator.d.ts +1 -8
- package/dist/components/separator/src/separator.js +33 -5
- package/dist/components/separator/src/tv.d.ts +39 -18
- package/dist/components/separator/src/tv.js +37 -7
- package/dist/components/text-field/dist/index.d.ts +2 -3
- package/dist/components/text-field/dist/index.js +4 -19
- package/dist/components/text-field/src/components/index.d.ts +0 -1
- package/dist/components/text-field/src/text-field.d.ts +3 -2
- package/dist/components/text-field/src/text-field.js +2 -2
- package/dist/components/text-field/src/tv.d.ts +3 -3
- package/dist/components/text-field/src/tv.js +1 -6
- package/dist/components/toast/dist/index.d.ts +248 -0
- package/dist/components/toast/src/components/index.d.ts +3 -0
- package/dist/components/toast/src/components/toast-progress-bar.d.ts +7 -0
- package/dist/components/toast/src/components/toast-progress-bar.js +53 -0
- package/dist/components/toast/src/components/toaster-item.d.ts +26 -0
- package/dist/components/toast/src/components/toaster-item.js +416 -0
- package/dist/components/toast/src/components/toaster-slots.d.ts +87 -0
- package/dist/components/toast/src/components/toaster-slots.js +38 -0
- package/dist/components/toast/src/index.d.ts +5 -0
- package/dist/components/toast/src/store.d.ts +101 -0
- package/dist/components/toast/src/store.js +205 -0
- package/dist/components/toast/src/toaster.d.ts +87 -0
- package/dist/components/toast/src/toaster.js +271 -0
- package/dist/components/toast/src/tv.d.ts +365 -0
- package/dist/components/toast/src/tv.js +412 -0
- package/dist/components/toast/src/types.d.ts +79 -0
- package/dist/components/toast/tsup.config.d.ts +2 -0
- package/dist/index.js +11 -2
- package/dist/styles/components.css +2 -0
- package/package.json +1 -1
- package/dist/components/code-block/src/hooks/use-line-count.d.ts +0 -2
- package/dist/components/code-block/src/hooks/use-line-count.js +0 -27
- package/dist/components/text-field/src/components/field-description.d.ts +0 -2
- package/dist/components/text-field/src/components/field-description.js +0 -16
|
@@ -0,0 +1,412 @@
|
|
|
1
|
+
import { tcv } from "../../../shared/utils/tcx/tcx.js";
|
|
2
|
+
const toastViewportTv = tcv({
|
|
3
|
+
base: ["fixed z-modals flex flex-col outline-none"],
|
|
4
|
+
variants: {
|
|
5
|
+
expanded: {
|
|
6
|
+
true: {},
|
|
7
|
+
false: {}
|
|
8
|
+
},
|
|
9
|
+
layout: {
|
|
10
|
+
default: "w-72 max-w-[calc(100vw-2rem)]",
|
|
11
|
+
compact: "w-fit min-w-48 max-w-[calc(100vw-2rem)]"
|
|
12
|
+
},
|
|
13
|
+
position: {
|
|
14
|
+
"top-left": "top-(--toast-offset) left-(--toast-offset) items-start",
|
|
15
|
+
"top-center": "top-(--toast-offset) left-1/2 -translate-x-1/2 items-center",
|
|
16
|
+
"top-right": "top-(--toast-offset) right-(--toast-offset) items-end",
|
|
17
|
+
"bottom-left": "bottom-(--toast-offset) left-(--toast-offset) items-start",
|
|
18
|
+
"bottom-center": "bottom-(--toast-offset) left-1/2 -translate-x-1/2 items-center",
|
|
19
|
+
"bottom-right": "bottom-(--toast-offset) right-(--toast-offset) items-end"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
defaultVariants: {
|
|
23
|
+
position: "bottom-right",
|
|
24
|
+
expanded: false
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
const toastRootTv = tcv({
|
|
28
|
+
slots: {
|
|
29
|
+
root: [
|
|
30
|
+
"bg-(--toast-background-color) shadow-lg",
|
|
31
|
+
"absolute pointer-events-auto",
|
|
32
|
+
"flex",
|
|
33
|
+
"select-none touch-none overflow-hidden"
|
|
34
|
+
],
|
|
35
|
+
icon: [
|
|
36
|
+
"shrink-0 self-center w-6 h-6 flex items-center justify-center",
|
|
37
|
+
"transition-opacity duration-200"
|
|
38
|
+
],
|
|
39
|
+
content: [
|
|
40
|
+
"grid min-w-0 h-full items-center",
|
|
41
|
+
"overflow-hidden",
|
|
42
|
+
"transition-opacity duration-200",
|
|
43
|
+
"opacity-100"
|
|
44
|
+
],
|
|
45
|
+
actions: [
|
|
46
|
+
"flex items-center justify-center truncate",
|
|
47
|
+
"transition-opacity duration-200 pointer-events-auto self-stretch"
|
|
48
|
+
],
|
|
49
|
+
button: "flex items-center justify-center pointer-events-auto px-2",
|
|
50
|
+
title: "text-body-medium-strong min-w-0",
|
|
51
|
+
description: "text-body-medium",
|
|
52
|
+
progressTrack: "absolute overflow-hidden pointer-events-none",
|
|
53
|
+
progressIndicator: "h-full origin-left"
|
|
54
|
+
},
|
|
55
|
+
variants: {
|
|
56
|
+
position: {
|
|
57
|
+
"top-left": {
|
|
58
|
+
root: "left-0 top-0 origin-top"
|
|
59
|
+
},
|
|
60
|
+
"top-center": {
|
|
61
|
+
root: "top-0 origin-top"
|
|
62
|
+
},
|
|
63
|
+
"top-right": {
|
|
64
|
+
root: "right-0 top-0 origin-top"
|
|
65
|
+
},
|
|
66
|
+
"bottom-left": {
|
|
67
|
+
root: "left-0 bottom-0 origin-bottom"
|
|
68
|
+
},
|
|
69
|
+
"bottom-center": {
|
|
70
|
+
root: "bottom-0 origin-bottom"
|
|
71
|
+
},
|
|
72
|
+
"bottom-right": {
|
|
73
|
+
root: "right-0 bottom-0 origin-bottom"
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
hasDescription: {
|
|
77
|
+
true: {
|
|
78
|
+
icon: "row-span-2"
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
hasActions: {
|
|
82
|
+
true: {
|
|
83
|
+
root: "grid-cols-[1fr_auto] grid"
|
|
84
|
+
},
|
|
85
|
+
false: {
|
|
86
|
+
content: "pr-3"
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
hasIcon: {
|
|
90
|
+
true: {
|
|
91
|
+
content: "pl-2 pr-2 grid-cols-[1.5rem_auto] gap-x-2"
|
|
92
|
+
},
|
|
93
|
+
false: {
|
|
94
|
+
content: "pl-3 pr-2"
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
expanded: {
|
|
98
|
+
true: {
|
|
99
|
+
icon: "opacity-100 pointer-events-auto",
|
|
100
|
+
content: "opacity-100 pointer-events-auto",
|
|
101
|
+
actions: "opacity-100 pointer-events-auto"
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
behind: {
|
|
105
|
+
true: {
|
|
106
|
+
icon: "opacity-0 pointer-events-none",
|
|
107
|
+
content: "opacity-0 pointer-events-none",
|
|
108
|
+
actions: "opacity-0 pointer-events-none"
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
layout: {
|
|
112
|
+
default: {
|
|
113
|
+
root: "left-0 right-0 w-full items-center transition-colors delay-100 duration-400 rounded-lg",
|
|
114
|
+
content: "py-3 min-h-14 relative",
|
|
115
|
+
title: "line-clamp-2",
|
|
116
|
+
description: "line-clamp-3 opacity-70",
|
|
117
|
+
actions: "border-l text-white grid",
|
|
118
|
+
button: "w-full h-full [&+button]:border-t"
|
|
119
|
+
},
|
|
120
|
+
compact: {
|
|
121
|
+
root: "w-fit h-10 overflow-hidden rounded-xl",
|
|
122
|
+
content: "flex items-center h-10 min-w-fit",
|
|
123
|
+
title: "truncate",
|
|
124
|
+
actions: "flex items-center min-w-fit",
|
|
125
|
+
button: ""
|
|
126
|
+
}
|
|
127
|
+
},
|
|
128
|
+
variant: {
|
|
129
|
+
default: {},
|
|
130
|
+
accent: {},
|
|
131
|
+
success: {},
|
|
132
|
+
warning: {},
|
|
133
|
+
error: {},
|
|
134
|
+
assistive: {},
|
|
135
|
+
reset: {}
|
|
136
|
+
},
|
|
137
|
+
type: {
|
|
138
|
+
default: {},
|
|
139
|
+
info: {},
|
|
140
|
+
success: {},
|
|
141
|
+
warning: {},
|
|
142
|
+
error: {},
|
|
143
|
+
loading: {}
|
|
144
|
+
},
|
|
145
|
+
buttonVariant: {
|
|
146
|
+
action: {},
|
|
147
|
+
cancel: {}
|
|
148
|
+
}
|
|
149
|
+
},
|
|
150
|
+
compoundVariants: [
|
|
151
|
+
// text color
|
|
152
|
+
{
|
|
153
|
+
variant: ["accent", "success", "default", "error", "assistive"],
|
|
154
|
+
class: {
|
|
155
|
+
root: "text-white"
|
|
156
|
+
}
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
variant: "warning",
|
|
160
|
+
class: {
|
|
161
|
+
root: "text-gray-900"
|
|
162
|
+
}
|
|
163
|
+
},
|
|
164
|
+
// Type color
|
|
165
|
+
{
|
|
166
|
+
variant: "default",
|
|
167
|
+
type: ["default", "loading"],
|
|
168
|
+
class: {
|
|
169
|
+
icon: "text-white",
|
|
170
|
+
progressIndicator: "bg-white"
|
|
171
|
+
}
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
variant: "default",
|
|
175
|
+
type: "info",
|
|
176
|
+
class: {
|
|
177
|
+
icon: "text-accent-foreground",
|
|
178
|
+
progressIndicator: "bg-accent-foreground"
|
|
179
|
+
}
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
variant: "default",
|
|
183
|
+
type: "success",
|
|
184
|
+
class: {
|
|
185
|
+
icon: "text-success-foreground",
|
|
186
|
+
progressIndicator: "bg-success-foreground"
|
|
187
|
+
}
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
variant: "default",
|
|
191
|
+
type: "warning",
|
|
192
|
+
class: {
|
|
193
|
+
icon: "text-warning-foreground",
|
|
194
|
+
progressIndicator: "bg-warning-foreground"
|
|
195
|
+
}
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
variant: "default",
|
|
199
|
+
type: "error",
|
|
200
|
+
class: {
|
|
201
|
+
icon: "text-danger-foreground",
|
|
202
|
+
progressIndicator: "bg-danger-foreground"
|
|
203
|
+
}
|
|
204
|
+
},
|
|
205
|
+
// button in layout
|
|
206
|
+
{
|
|
207
|
+
layout: "default",
|
|
208
|
+
variant: "default",
|
|
209
|
+
class: {
|
|
210
|
+
actions: "border-menu-boundary",
|
|
211
|
+
button: "border-menu-boundary"
|
|
212
|
+
}
|
|
213
|
+
},
|
|
214
|
+
{
|
|
215
|
+
layout: "default",
|
|
216
|
+
variant: ["accent", "success", "warning", "error", "assistive"],
|
|
217
|
+
class: {
|
|
218
|
+
actions: "border-black/20",
|
|
219
|
+
button: "border-black/20"
|
|
220
|
+
}
|
|
221
|
+
},
|
|
222
|
+
{
|
|
223
|
+
layout: "default",
|
|
224
|
+
variant: ["accent", "success", "default", "error", "assistive"],
|
|
225
|
+
class: {
|
|
226
|
+
actions: "text-white",
|
|
227
|
+
button: "hover:bg-white/10 active:bg-white/20"
|
|
228
|
+
}
|
|
229
|
+
},
|
|
230
|
+
{
|
|
231
|
+
layout: "default",
|
|
232
|
+
variant: "warning",
|
|
233
|
+
class: {
|
|
234
|
+
actions: "text-gray-900",
|
|
235
|
+
button: "hover:bg-black/10 active:bg-black/20"
|
|
236
|
+
}
|
|
237
|
+
},
|
|
238
|
+
{
|
|
239
|
+
buttonVariant: "action",
|
|
240
|
+
layout: "compact",
|
|
241
|
+
class: {
|
|
242
|
+
button: "mr-2"
|
|
243
|
+
}
|
|
244
|
+
},
|
|
245
|
+
{
|
|
246
|
+
buttonVariant: "cancel",
|
|
247
|
+
layout: "compact",
|
|
248
|
+
class: {
|
|
249
|
+
button: "size-10 flex items-center justify-center"
|
|
250
|
+
}
|
|
251
|
+
},
|
|
252
|
+
{
|
|
253
|
+
buttonVariant: "cancel",
|
|
254
|
+
layout: "compact",
|
|
255
|
+
variant: "default",
|
|
256
|
+
class: {
|
|
257
|
+
button: "border-menu-boundary border-l"
|
|
258
|
+
}
|
|
259
|
+
},
|
|
260
|
+
{
|
|
261
|
+
buttonVariant: "action",
|
|
262
|
+
layout: "compact",
|
|
263
|
+
class: {
|
|
264
|
+
button: "px-2 h-6 rounded-md border border-transparent"
|
|
265
|
+
}
|
|
266
|
+
},
|
|
267
|
+
{
|
|
268
|
+
buttonVariant: "action",
|
|
269
|
+
layout: "compact",
|
|
270
|
+
variant: "default",
|
|
271
|
+
class: {
|
|
272
|
+
button: "border-menu-boundary"
|
|
273
|
+
}
|
|
274
|
+
},
|
|
275
|
+
{
|
|
276
|
+
buttonVariant: ["action", "cancel"],
|
|
277
|
+
layout: "compact",
|
|
278
|
+
variant: "default",
|
|
279
|
+
class: {
|
|
280
|
+
button: "hover:bg-white/10 active:bg-white/20"
|
|
281
|
+
}
|
|
282
|
+
},
|
|
283
|
+
{
|
|
284
|
+
buttonVariant: "action",
|
|
285
|
+
layout: "compact",
|
|
286
|
+
variant: ["accent", "success", "warning", "error", "assistive"],
|
|
287
|
+
class: {
|
|
288
|
+
button: "bg-black/30 hover:bg-black hover:text-white"
|
|
289
|
+
}
|
|
290
|
+
},
|
|
291
|
+
{
|
|
292
|
+
buttonVariant: "cancel",
|
|
293
|
+
layout: "compact",
|
|
294
|
+
variant: ["accent", "success", "warning", "error", "assistive"],
|
|
295
|
+
class: {
|
|
296
|
+
button: "border-black/10 hover:bg-black/10 active:bg-black/20 border-l"
|
|
297
|
+
}
|
|
298
|
+
},
|
|
299
|
+
// progress track
|
|
300
|
+
{
|
|
301
|
+
layout: "default",
|
|
302
|
+
class: {
|
|
303
|
+
progressTrack: "bottom-1 inset-x-2 h-0.5 rounded-full"
|
|
304
|
+
}
|
|
305
|
+
},
|
|
306
|
+
{
|
|
307
|
+
layout: "compact",
|
|
308
|
+
class: {
|
|
309
|
+
progressTrack: "inset-0 rounded-xl -z-1"
|
|
310
|
+
}
|
|
311
|
+
},
|
|
312
|
+
// progress indicator
|
|
313
|
+
{
|
|
314
|
+
layout: "default",
|
|
315
|
+
variant: "default",
|
|
316
|
+
class: {
|
|
317
|
+
progressIndicator: "bg-white/20"
|
|
318
|
+
}
|
|
319
|
+
},
|
|
320
|
+
{
|
|
321
|
+
layout: "default",
|
|
322
|
+
variant: "accent",
|
|
323
|
+
class: {
|
|
324
|
+
progressIndicator: "bg-blue-400/50"
|
|
325
|
+
}
|
|
326
|
+
},
|
|
327
|
+
{
|
|
328
|
+
layout: "default",
|
|
329
|
+
variant: "success",
|
|
330
|
+
class: {
|
|
331
|
+
progressIndicator: "bg-green-400/50"
|
|
332
|
+
}
|
|
333
|
+
},
|
|
334
|
+
{
|
|
335
|
+
layout: "default",
|
|
336
|
+
variant: "warning",
|
|
337
|
+
class: {
|
|
338
|
+
progressIndicator: "bg-black/20"
|
|
339
|
+
}
|
|
340
|
+
},
|
|
341
|
+
{
|
|
342
|
+
layout: "default",
|
|
343
|
+
variant: "error",
|
|
344
|
+
class: {
|
|
345
|
+
progressIndicator: "bg-red-400/50"
|
|
346
|
+
}
|
|
347
|
+
},
|
|
348
|
+
{
|
|
349
|
+
layout: "default",
|
|
350
|
+
variant: "assistive",
|
|
351
|
+
class: {
|
|
352
|
+
progressIndicator: "bg-pink-400/50"
|
|
353
|
+
}
|
|
354
|
+
},
|
|
355
|
+
// compact layout with progress
|
|
356
|
+
{
|
|
357
|
+
layout: "compact",
|
|
358
|
+
variant: "default",
|
|
359
|
+
class: {
|
|
360
|
+
progressIndicator: "bg-menu-background"
|
|
361
|
+
}
|
|
362
|
+
},
|
|
363
|
+
{
|
|
364
|
+
layout: "compact",
|
|
365
|
+
variant: "accent",
|
|
366
|
+
class: {
|
|
367
|
+
progressIndicator: "bg-accent-background"
|
|
368
|
+
}
|
|
369
|
+
},
|
|
370
|
+
{
|
|
371
|
+
layout: "compact",
|
|
372
|
+
variant: "success",
|
|
373
|
+
class: {
|
|
374
|
+
progressIndicator: "bg-success-background"
|
|
375
|
+
}
|
|
376
|
+
},
|
|
377
|
+
{
|
|
378
|
+
layout: "compact",
|
|
379
|
+
variant: "warning",
|
|
380
|
+
class: {
|
|
381
|
+
progressIndicator: "bg-warning-background"
|
|
382
|
+
}
|
|
383
|
+
},
|
|
384
|
+
{
|
|
385
|
+
layout: "compact",
|
|
386
|
+
variant: "error",
|
|
387
|
+
class: {
|
|
388
|
+
progressIndicator: "bg-danger-background"
|
|
389
|
+
}
|
|
390
|
+
},
|
|
391
|
+
{
|
|
392
|
+
layout: "compact",
|
|
393
|
+
variant: "assistive",
|
|
394
|
+
class: {
|
|
395
|
+
progressIndicator: "bg-assistive-background"
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
],
|
|
399
|
+
defaultVariants: {
|
|
400
|
+
hasActions: false,
|
|
401
|
+
type: "default",
|
|
402
|
+
layout: "default",
|
|
403
|
+
variant: "default",
|
|
404
|
+
expanded: false,
|
|
405
|
+
behind: false,
|
|
406
|
+
position: "bottom-right"
|
|
407
|
+
}
|
|
408
|
+
});
|
|
409
|
+
export {
|
|
410
|
+
toastRootTv,
|
|
411
|
+
toastViewportTv
|
|
412
|
+
};
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export type ToastType = "info" | "success" | "warning" | "error" | "loading" | "default";
|
|
3
|
+
export type ToastVariant = "default" | "accent" | "success" | "warning" | "error" | "assistive" | "reset";
|
|
4
|
+
export type ToastPosition = "top-left" | "top-center" | "top-right" | "bottom-left" | "bottom-center" | "bottom-right";
|
|
5
|
+
export type SwipeDirection = "up" | "down" | "left" | "right";
|
|
6
|
+
export interface ToastData<T extends object = object> {
|
|
7
|
+
id: string;
|
|
8
|
+
type: ToastType;
|
|
9
|
+
title?: React.ReactNode;
|
|
10
|
+
description?: React.ReactNode;
|
|
11
|
+
duration?: number;
|
|
12
|
+
priority?: number;
|
|
13
|
+
data?: T;
|
|
14
|
+
createdAt: number;
|
|
15
|
+
onClose?: () => void;
|
|
16
|
+
onAction?: () => void;
|
|
17
|
+
actionLabel?: React.ReactNode;
|
|
18
|
+
height?: number;
|
|
19
|
+
swipeDirection?: SwipeDirection;
|
|
20
|
+
}
|
|
21
|
+
export interface ToastManagerAddOptions<T extends object = object> {
|
|
22
|
+
id?: string;
|
|
23
|
+
type?: ToastType;
|
|
24
|
+
title?: React.ReactNode;
|
|
25
|
+
description?: React.ReactNode;
|
|
26
|
+
duration?: number;
|
|
27
|
+
priority?: number;
|
|
28
|
+
data?: T;
|
|
29
|
+
onClose?: () => void;
|
|
30
|
+
onAction?: () => void;
|
|
31
|
+
actionLabel?: React.ReactNode;
|
|
32
|
+
}
|
|
33
|
+
export interface ToastManagerUpdateOptions<T extends object = object> {
|
|
34
|
+
type?: ToastType;
|
|
35
|
+
title?: React.ReactNode;
|
|
36
|
+
description?: React.ReactNode;
|
|
37
|
+
duration?: number;
|
|
38
|
+
data?: T;
|
|
39
|
+
actionLabel?: React.ReactNode;
|
|
40
|
+
}
|
|
41
|
+
export interface ToastManagerPromiseOptions<Value, T extends object = object> {
|
|
42
|
+
loading: ToastManagerAddOptions<T>;
|
|
43
|
+
success: ToastManagerAddOptions<T> | ((value: Value) => ToastManagerAddOptions<T>);
|
|
44
|
+
error: ToastManagerAddOptions<T> | ((error: unknown) => ToastManagerAddOptions<T>);
|
|
45
|
+
}
|
|
46
|
+
export type ToastManagerAction = "add" | "close" | "update" | "promise";
|
|
47
|
+
export interface ToastManagerEvent {
|
|
48
|
+
action: ToastManagerAction;
|
|
49
|
+
options: unknown;
|
|
50
|
+
}
|
|
51
|
+
export interface ToastManager {
|
|
52
|
+
subscribe: (listener: (event: ToastManagerEvent) => void) => () => void;
|
|
53
|
+
add: <T extends object = object>(options: ToastManagerAddOptions<T>) => string;
|
|
54
|
+
close: (id: string) => void;
|
|
55
|
+
update: <T extends object = object>(id: string, updates: ToastManagerUpdateOptions<T>) => void;
|
|
56
|
+
promise: <Value, T extends object = object>(promiseValue: Promise<Value>, options: ToastManagerPromiseOptions<Value, T>) => Promise<Value>;
|
|
57
|
+
success: <T extends object = object>(options: Omit<ToastManagerAddOptions<T>, "type">) => string;
|
|
58
|
+
error: <T extends object = object>(options: Omit<ToastManagerAddOptions<T>, "type">) => string;
|
|
59
|
+
warning: <T extends object = object>(options: Omit<ToastManagerAddOptions<T>, "type">) => string;
|
|
60
|
+
info: <T extends object = object>(options: Omit<ToastManagerAddOptions<T>, "type">) => string;
|
|
61
|
+
loading: <T extends object = object>(options: Omit<ToastManagerAddOptions<T>, "type">) => string;
|
|
62
|
+
destroy: () => void;
|
|
63
|
+
}
|
|
64
|
+
export interface TimerInfo {
|
|
65
|
+
timeout?: ReturnType<typeof setTimeout>;
|
|
66
|
+
start: number;
|
|
67
|
+
delay: number;
|
|
68
|
+
remaining: number;
|
|
69
|
+
callback: () => void;
|
|
70
|
+
}
|
|
71
|
+
export interface ToastRootState {
|
|
72
|
+
type: ToastType;
|
|
73
|
+
swiping: boolean;
|
|
74
|
+
expanded: boolean;
|
|
75
|
+
}
|
|
76
|
+
export interface ToastContentState {
|
|
77
|
+
expanded: boolean;
|
|
78
|
+
behind: boolean;
|
|
79
|
+
}
|
package/dist/index.js
CHANGED
|
@@ -89,11 +89,13 @@ import { convertSlateToText, convertTextToSlate, convertTextToSlateWithResolver
|
|
|
89
89
|
import { extractTextWithMentions, parseTextWithMentions } from "./components/context-input/src/utils/text-extraction.js";
|
|
90
90
|
import { extractMentionContext } from "./components/context-input/src/utils/context-extraction.js";
|
|
91
91
|
import { ContextMenu } from "./components/context-menu/src/context-menu.js";
|
|
92
|
+
import { Description } from "./components/description/src/description.js";
|
|
92
93
|
import { Dialog } from "./components/dialog/src/dialog.js";
|
|
93
94
|
import { Dropdown } from "./components/dropdown/src/dropdown.js";
|
|
94
95
|
import { EmojiPicker } from "./components/emoji-picker/src/emoji-picker.js";
|
|
95
96
|
import { useEmojiData } from "./components/emoji-picker/src/hooks/use-emoji-data.js";
|
|
96
97
|
import { emojis } from "./components/emoji-picker/src/utils/emoji-data.js";
|
|
98
|
+
import { ErrorMessage } from "./components/error-message/src/error-message.js";
|
|
97
99
|
import { FileUpload } from "./components/file-upload/src/file-upload.js";
|
|
98
100
|
import { FileUploadClear } from "./components/file-upload/src/components/file-upload-clear.js";
|
|
99
101
|
import { FileUploadDropzone } from "./components/file-upload/src/components/file-upload-dropzone.js";
|
|
@@ -169,11 +171,12 @@ import { ModalInput } from "./components/modal/src/components/modal-input.js";
|
|
|
169
171
|
import { ModalTextarea } from "./components/modal/src/components/modal-textarea.js";
|
|
170
172
|
import { MultiSelect } from "./components/multi-select/src/multi-select.js";
|
|
171
173
|
import { MultiSelectTrigger } from "./components/multi-select/src/components/multi-select-trigger.js";
|
|
172
|
-
import {
|
|
174
|
+
import { notifications } from "./components/notifications/src/notifications.js";
|
|
173
175
|
import { NumericInput } from "./components/numeric-input/src/numeric-input.js";
|
|
174
176
|
import { NumericInputElement } from "./components/numeric-input/src/components/numeric-input-element.js";
|
|
175
177
|
import { NumericInputMenuTrigger } from "./components/numeric-input/src/components/numeric-input-menu-trigger.js";
|
|
176
178
|
import { NumericInputVariable } from "./components/numeric-input/src/components/numeric-input-variable.js";
|
|
179
|
+
import { useNumericLongPress } from "./components/numeric-input/src/hooks/use-numeric-long-press.js";
|
|
177
180
|
import { OtpInput } from "./components/otp-input/src/otp-input.js";
|
|
178
181
|
import { Pagination } from "./components/pagination/src/pagination.js";
|
|
179
182
|
import { Panel, PanelBase } from "./components/panel/src/panel.js";
|
|
@@ -224,6 +227,8 @@ import { TabItem } from "./components/tabs/src/tab-item.js";
|
|
|
224
227
|
import { TextField } from "./components/text-field/src/text-field.js";
|
|
225
228
|
import { Textarea } from "./components/textarea/src/textarea.js";
|
|
226
229
|
import { ResizeHandle } from "./components/textarea/src/components/resize-handle.js";
|
|
230
|
+
import { Toaster } from "./components/toast/src/toaster.js";
|
|
231
|
+
import { toast } from "./components/toast/src/store.js";
|
|
227
232
|
import { ToggleButton } from "./components/toggle-button/src/toggle-button.js";
|
|
228
233
|
import { ToggleGroup } from "./components/toggle-button/src/toggle-group.js";
|
|
229
234
|
import { Tooltip } from "./components/tooltip/src/tooltip.js";
|
|
@@ -303,12 +308,14 @@ export {
|
|
|
303
308
|
DateInput,
|
|
304
309
|
DateRangeInput,
|
|
305
310
|
DateRangePreset,
|
|
311
|
+
Description,
|
|
306
312
|
Dialog,
|
|
307
313
|
DigitExtractor,
|
|
308
314
|
DirectionContext,
|
|
309
315
|
DragGuide,
|
|
310
316
|
Dropdown,
|
|
311
317
|
EmojiPicker,
|
|
318
|
+
ErrorMessage,
|
|
312
319
|
FIELD_OPERATOR_MAP,
|
|
313
320
|
FieldType,
|
|
314
321
|
FileUpload,
|
|
@@ -441,7 +448,7 @@ export {
|
|
|
441
448
|
TimeCalendar,
|
|
442
449
|
TimeInput,
|
|
443
450
|
TimeRangeInput,
|
|
444
|
-
|
|
451
|
+
Toaster,
|
|
445
452
|
ToggleButton,
|
|
446
453
|
ToggleGroup,
|
|
447
454
|
Tooltip,
|
|
@@ -636,6 +643,7 @@ export {
|
|
|
636
643
|
tcx,
|
|
637
644
|
timeStringToDate,
|
|
638
645
|
timeToDate,
|
|
646
|
+
toast,
|
|
639
647
|
tryRelaxedParsing,
|
|
640
648
|
tryRelaxedTimeParsing,
|
|
641
649
|
useAlertDialog,
|
|
@@ -682,6 +690,7 @@ export {
|
|
|
682
690
|
useMenuTree,
|
|
683
691
|
useMergedValue,
|
|
684
692
|
useModifierKeys,
|
|
693
|
+
useNumericLongPress,
|
|
685
694
|
usePanelContext,
|
|
686
695
|
usePress,
|
|
687
696
|
usePressMove,
|
|
@@ -26,6 +26,7 @@
|
|
|
26
26
|
--animate-spinner-bounce-right: spinner-bounce-right 0.5s infinite alternate ease;
|
|
27
27
|
--animate-indeterminate-bar: indeterminate-bar 1.5s cubic-bezier(0.65, 0.815, 0.735, 0.395)
|
|
28
28
|
infinite normal none running;
|
|
29
|
+
|
|
29
30
|
}
|
|
30
31
|
|
|
31
32
|
/* Base styles */
|
|
@@ -625,3 +626,4 @@
|
|
|
625
626
|
}
|
|
626
627
|
}
|
|
627
628
|
}
|
|
629
|
+
|
package/package.json
CHANGED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import React__default, { useState, useEffect } from "react";
|
|
2
|
-
function useLineCount(children) {
|
|
3
|
-
const [lineCount, setLineCount] = useState(0);
|
|
4
|
-
useEffect(() => {
|
|
5
|
-
try {
|
|
6
|
-
const codeContent = React__default.Children.toArray(children).map((child) => {
|
|
7
|
-
var _a;
|
|
8
|
-
if (React__default.isValidElement(child) && ((_a = child.props) == null ? void 0 : _a.code) && typeof child.props.code === "string") {
|
|
9
|
-
return child.props.code;
|
|
10
|
-
}
|
|
11
|
-
return "";
|
|
12
|
-
}).join("");
|
|
13
|
-
if (codeContent) {
|
|
14
|
-
const lines = codeContent.split("\n").length;
|
|
15
|
-
setLineCount(lines);
|
|
16
|
-
} else {
|
|
17
|
-
setLineCount(0);
|
|
18
|
-
}
|
|
19
|
-
} catch (error) {
|
|
20
|
-
setLineCount(0);
|
|
21
|
-
}
|
|
22
|
-
}, [children]);
|
|
23
|
-
return lineCount;
|
|
24
|
-
}
|
|
25
|
-
export {
|
|
26
|
-
useLineCount
|
|
27
|
-
};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { memo, forwardRef } from "react";
|
|
3
|
-
const FieldDescription = memo(
|
|
4
|
-
forwardRef(function FieldDescription2(props, ref) {
|
|
5
|
-
return /* @__PURE__ */ jsx(
|
|
6
|
-
"div",
|
|
7
|
-
{
|
|
8
|
-
ref,
|
|
9
|
-
...props
|
|
10
|
-
}
|
|
11
|
-
);
|
|
12
|
-
})
|
|
13
|
-
);
|
|
14
|
-
export {
|
|
15
|
-
FieldDescription
|
|
16
|
-
};
|