gbs-add-block 1.2.11 → 1.2.13

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 (34) hide show
  1. package/README.md +4 -2
  2. package/index.cjs +7 -1
  3. package/package.json +1 -1
  4. package/source/beta-components/fileuploader/README.md +99 -0
  5. package/source/beta-components/fileuploader/__tests__/core.test.ts +395 -0
  6. package/source/beta-components/fileuploader/core/format.ts +79 -0
  7. package/source/beta-components/fileuploader/core/index.ts +26 -0
  8. package/source/beta-components/fileuploader/core/store.ts +432 -0
  9. package/source/beta-components/fileuploader/core/transport.ts +145 -0
  10. package/source/beta-components/fileuploader/core/types.ts +126 -0
  11. package/source/beta-components/fileuploader/core/validate.ts +83 -0
  12. package/source/beta-components/fileuploader/index.ts +7 -0
  13. package/source/beta-components/fileuploader/react/FileRow.tsx +268 -0
  14. package/source/beta-components/fileuploader/react/FileUploader.tsx +515 -0
  15. package/source/beta-components/fileuploader/react/icons.tsx +80 -0
  16. package/source/beta-components/fileuploader/react/locale.ts +33 -0
  17. package/source/beta-components/fileuploader/react/props.ts +31 -0
  18. package/source/beta-components/fileuploader/react/useFileUploader.ts +32 -0
  19. package/source/beta-components/fileuploader/styles.css +395 -0
  20. package/source/beta-components/toaster/README.md +128 -0
  21. package/source/beta-components/toaster/__tests__/core.test.ts +256 -0
  22. package/source/beta-components/toaster/core/api.ts +87 -0
  23. package/source/beta-components/toaster/core/index.ts +14 -0
  24. package/source/beta-components/toaster/core/store.ts +211 -0
  25. package/source/beta-components/toaster/core/toast.ts +12 -0
  26. package/source/beta-components/toaster/core/types.ts +78 -0
  27. package/source/beta-components/toaster/index.ts +6 -0
  28. package/source/beta-components/toaster/react/ToastItem.tsx +164 -0
  29. package/source/beta-components/toaster/react/Toaster.tsx +187 -0
  30. package/source/beta-components/toaster/react/icons.tsx +56 -0
  31. package/source/beta-components/toaster/react/locale.ts +6 -0
  32. package/source/beta-components/toaster/react/props.ts +15 -0
  33. package/source/beta-components/toaster/react/useToasts.ts +11 -0
  34. package/source/beta-components/toaster/styles.css +283 -0
@@ -0,0 +1,283 @@
1
+ /*
2
+ * Toaster styles.
3
+ *
4
+ * Tokens read the DataGrid's --dg-* variables when they are set on an ancestor
5
+ * (toasts render in a portal on <body>, so set them on :root to share a theme)
6
+ * and fall back to the same palette otherwise. Rules live in the `components`
7
+ * layer, so utility classes passed through `className` / `classNames` win.
8
+ */
9
+ @layer theme, base, components, utilities;
10
+
11
+ @layer components {
12
+ .ts-region {
13
+ --ts-bg: var(--dg-bg, light-dark(#ffffff, #0b0b0e));
14
+ --ts-fg: var(--dg-fg, light-dark(#18181b, #f4f4f5));
15
+ --ts-muted: var(--dg-muted, light-dark(#71717a, #a1a1aa));
16
+ --ts-border: var(--dg-border, light-dark(#e4e4e7, #27272a));
17
+ --ts-hover: var(--dg-hover, light-dark(#f4f4f5, #1f1f23));
18
+ --ts-accent: var(--dg-accent, light-dark(#2563eb, #60a5fa));
19
+ --ts-accent-fg: var(--dg-accent-fg, light-dark(#ffffff, #0b1220));
20
+ --ts-focus: var(--dg-focus, light-dark(#2563eb, #60a5fa));
21
+ --ts-shadow: var(--dg-shadow, 0 10px 30px -8px light-dark(rgb(0 0 0 / 0.18), rgb(0 0 0 / 0.6)));
22
+ --ts-radius: var(--dg-radius, 8px);
23
+ --ts-font-size: var(--dg-font-size, 13px);
24
+ --ts-success: light-dark(#16a34a, #4ade80);
25
+ --ts-error: var(--dg-danger, light-dark(#dc2626, #f87171));
26
+ --ts-warning: light-dark(#d97706, #fbbf24);
27
+ --ts-info: var(--dg-accent, light-dark(#2563eb, #60a5fa));
28
+ --ts-width: 356px;
29
+ --ts-offset: 16px;
30
+ --ts-gap: 8px;
31
+ --ts-z-index: 2147483000;
32
+
33
+ color-scheme: inherit;
34
+ position: fixed;
35
+ z-index: var(--ts-z-index);
36
+ width: var(--ts-width);
37
+ max-width: calc(100vw - 2 * var(--ts-offset));
38
+ font-size: var(--ts-font-size);
39
+ line-height: 1.4;
40
+ color: var(--ts-fg);
41
+ /* The region spans the stack; only the toasts themselves take clicks. */
42
+ pointer-events: none;
43
+ }
44
+
45
+ :where(.dark, [data-theme="dark"]) .ts-region {
46
+ color-scheme: dark;
47
+ }
48
+ :where(.light, [data-theme="light"]) .ts-region {
49
+ color-scheme: light;
50
+ }
51
+
52
+ :where(.ts-region) *,
53
+ :where(.ts-region) *::before,
54
+ :where(.ts-region) *::after {
55
+ box-sizing: border-box;
56
+ }
57
+
58
+ /* ------------------------------------------------------------ placement */
59
+
60
+ .ts-region[data-position^="top"] {
61
+ top: var(--ts-offset);
62
+ --ts-enter-y: -8px;
63
+ }
64
+ .ts-region[data-position^="bottom"] {
65
+ bottom: var(--ts-offset);
66
+ --ts-enter-y: 8px;
67
+ }
68
+ .ts-region[data-position$="left"] {
69
+ left: var(--ts-offset);
70
+ }
71
+ .ts-region[data-position$="right"] {
72
+ right: var(--ts-offset);
73
+ }
74
+ .ts-region[data-position$="center"] {
75
+ left: 50%;
76
+ translate: -50% 0;
77
+ }
78
+
79
+ @media (max-width: 600px) {
80
+ .ts-region {
81
+ right: var(--ts-offset);
82
+ left: var(--ts-offset);
83
+ width: auto;
84
+ max-width: none;
85
+ translate: none;
86
+ }
87
+ }
88
+
89
+ .ts-list {
90
+ display: flex;
91
+ flex-direction: column;
92
+ gap: var(--ts-gap);
93
+ margin: 0;
94
+ padding: 0;
95
+ list-style: none;
96
+ outline: none;
97
+ }
98
+ /* Newest toast sits nearest the screen edge. */
99
+ .ts-region[data-position^="bottom"] .ts-list {
100
+ flex-direction: column-reverse;
101
+ }
102
+ .ts-list:focus-visible {
103
+ outline: 2px solid var(--ts-focus);
104
+ outline-offset: 4px;
105
+ border-radius: var(--ts-radius);
106
+ }
107
+
108
+ /* --------------------------------------------------------------- toast */
109
+
110
+ .ts-toast {
111
+ --ts-type-color: transparent;
112
+
113
+ position: relative;
114
+ display: flex;
115
+ align-items: flex-start;
116
+ gap: 10px;
117
+ width: 100%;
118
+ padding-block: 12px;
119
+ padding-inline: 14px 10px;
120
+ overflow: hidden;
121
+ border: 1px solid var(--ts-border);
122
+ border-radius: var(--ts-radius);
123
+ background: var(--ts-bg);
124
+ color: var(--ts-fg);
125
+ box-shadow: var(--ts-shadow);
126
+ pointer-events: auto;
127
+ outline: none;
128
+ touch-action: pan-y;
129
+ opacity: 1;
130
+ translate: var(--ts-swipe, 0px) 0;
131
+ transition:
132
+ opacity 200ms ease,
133
+ translate 200ms ease;
134
+ }
135
+ @starting-style {
136
+ .ts-toast {
137
+ opacity: 0;
138
+ translate: 0 var(--ts-enter-y, 8px);
139
+ }
140
+ }
141
+ .ts-toast[data-swiping] {
142
+ transition: none;
143
+ cursor: grabbing;
144
+ }
145
+ .ts-toast[data-state="closing"] {
146
+ opacity: 0;
147
+ pointer-events: none;
148
+ }
149
+ .ts-toast:focus-visible {
150
+ outline: 2px solid var(--ts-focus);
151
+ outline-offset: -2px;
152
+ }
153
+
154
+ /* A thin bar on the reading-start edge carries the type's color. */
155
+ .ts-toast::before {
156
+ content: "";
157
+ position: absolute;
158
+ inset-block: 0;
159
+ inset-inline-start: 0;
160
+ width: 3px;
161
+ background: var(--ts-type-color);
162
+ }
163
+ .ts-toast[data-type="success"] {
164
+ --ts-type-color: var(--ts-success);
165
+ }
166
+ .ts-toast[data-type="error"] {
167
+ --ts-type-color: var(--ts-error);
168
+ }
169
+ .ts-toast[data-type="warning"] {
170
+ --ts-type-color: var(--ts-warning);
171
+ }
172
+ .ts-toast[data-type="info"] {
173
+ --ts-type-color: var(--ts-info);
174
+ }
175
+
176
+ .ts-icon {
177
+ display: inline-grid;
178
+ flex: none;
179
+ place-items: center;
180
+ margin-top: 1px;
181
+ color: var(--ts-type-color);
182
+ }
183
+ .ts-toast:is([data-type="default"], [data-type="loading"]) .ts-icon {
184
+ color: var(--ts-muted);
185
+ }
186
+
187
+ .ts-content {
188
+ flex: 1 1 auto;
189
+ min-width: 0;
190
+ overflow-wrap: anywhere;
191
+ }
192
+ .ts-title {
193
+ font-weight: 600;
194
+ }
195
+ .ts-description {
196
+ margin-top: 2px;
197
+ color: var(--ts-muted);
198
+ }
199
+
200
+ .ts-actions {
201
+ display: flex;
202
+ flex: none;
203
+ align-items: center;
204
+ align-self: center;
205
+ gap: 6px;
206
+ }
207
+ .ts-button {
208
+ height: 28px;
209
+ padding: 0 10px;
210
+ border: 1px solid var(--ts-border);
211
+ border-radius: 6px;
212
+ background: var(--ts-bg);
213
+ color: inherit;
214
+ font: inherit;
215
+ font-weight: 500;
216
+ white-space: nowrap;
217
+ cursor: pointer;
218
+ }
219
+ .ts-button:hover {
220
+ background: var(--ts-hover);
221
+ }
222
+ .ts-button[data-variant="action"] {
223
+ border-color: var(--ts-accent);
224
+ background: var(--ts-accent);
225
+ color: var(--ts-accent-fg);
226
+ }
227
+ .ts-button[data-variant="action"]:hover {
228
+ background: color-mix(in oklab, var(--ts-accent), var(--ts-fg) 12%);
229
+ }
230
+ .ts-button:focus-visible {
231
+ outline: 2px solid var(--ts-focus);
232
+ outline-offset: 1px;
233
+ }
234
+
235
+ .ts-close {
236
+ display: inline-grid;
237
+ flex: none;
238
+ place-items: center;
239
+ width: 22px;
240
+ height: 22px;
241
+ padding: 0;
242
+ border: 0;
243
+ border-radius: 4px;
244
+ background: transparent;
245
+ color: var(--ts-muted);
246
+ cursor: pointer;
247
+ }
248
+ .ts-close:hover {
249
+ background: var(--ts-hover);
250
+ color: var(--ts-fg);
251
+ }
252
+ .ts-close:focus-visible {
253
+ outline: 2px solid var(--ts-focus);
254
+ outline-offset: 1px;
255
+ }
256
+
257
+ .ts-spinner {
258
+ animation: ts-spin 0.7s linear infinite;
259
+ }
260
+ @keyframes ts-spin {
261
+ to {
262
+ transform: rotate(360deg);
263
+ }
264
+ }
265
+
266
+ @media (prefers-reduced-motion: reduce) {
267
+ .ts-toast {
268
+ transition: none;
269
+ }
270
+ .ts-spinner {
271
+ animation-duration: 2s;
272
+ }
273
+ }
274
+
275
+ @media (forced-colors: active) {
276
+ .ts-toast {
277
+ border-color: CanvasText;
278
+ }
279
+ .ts-toast::before {
280
+ background: Highlight;
281
+ }
282
+ }
283
+ }