@krak-stack/registry 0.11.6 → 0.11.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.
Files changed (123) hide show
  1. package/CHANGELOG.md +80 -0
  2. package/README.md +39 -0
  3. package/dist/components/app-switcher/html.d.ts +2 -2
  4. package/dist/components/asset-input/html.d.ts +70 -0
  5. package/dist/components/asset-input/html.js +1549 -0
  6. package/dist/components/asset-input/index.d.ts +280 -0
  7. package/dist/components/asset-input/react.d.ts +32 -0
  8. package/dist/components/asset-input/react.js +2269 -0
  9. package/dist/components/asset-input/schema.d.ts +93 -0
  10. package/dist/components/asset-input/upload.d.ts +15 -0
  11. package/dist/components/asset-table/html.d.ts +110 -0
  12. package/dist/components/asset-table/html.js +4934 -0
  13. package/dist/components/asset-table/index.d.ts +225 -0
  14. package/dist/components/asset-table/react.d.ts +21 -0
  15. package/dist/components/asset-table/react.js +8241 -0
  16. package/dist/components/asset-table/schema.d.ts +73 -0
  17. package/dist/components/audit-log-table/classes.d.ts +1 -0
  18. package/dist/components/audit-log-table/html.d.ts +158 -0
  19. package/dist/components/audit-log-table/html.js +3294 -0
  20. package/dist/components/audit-log-table/index.d.ts +37 -0
  21. package/dist/components/audit-log-table/react.d.ts +3 -51
  22. package/dist/components/audit-log-table/react.js +130 -89
  23. package/dist/components/audit-log-table/schema.d.ts +122 -0
  24. package/dist/components/danger-confirmation/html.d.ts +2 -2
  25. package/dist/components/danger-confirmation/index.d.ts +2 -2
  26. package/dist/components/data-table/classes.d.ts +3 -0
  27. package/dist/components/data-table/html.d.ts +70 -12
  28. package/dist/components/data-table/html.js +56 -19
  29. package/dist/components/data-table/index.d.ts +51 -1
  30. package/dist/components/data-table/react.d.ts +1 -0
  31. package/dist/components/data-table/react.js +46 -16
  32. package/dist/components/data-table/schema.d.ts +93 -3
  33. package/dist/components/docs/html.js +22 -4
  34. package/dist/components/docs/react.js +33 -2
  35. package/dist/components/editable-text/html.d.ts +2 -2
  36. package/dist/components/editable-text/index.d.ts +4 -4
  37. package/dist/components/effect-form/react.js +343 -138
  38. package/dist/components/email-editor/legacy-editor.html.d.ts +6 -6
  39. package/dist/components/file-input/classes.d.ts +1 -1
  40. package/dist/components/file-input/file-type.d.ts +1 -0
  41. package/dist/components/file-input/html.d.ts +8 -1
  42. package/dist/components/file-input/html.js +170 -12
  43. package/dist/components/file-input/index.d.ts +1 -0
  44. package/dist/components/file-input/react.d.ts +9 -1
  45. package/dist/components/file-input/react.js +277 -127
  46. package/dist/components/file-input/schema.d.ts +1 -0
  47. package/dist/components/form/react.js +343 -138
  48. package/dist/components/icon-input/html.js +19 -5
  49. package/dist/components/icon-input/react.js +70 -13
  50. package/dist/components/map-menu/html.d.ts +6 -0
  51. package/dist/components/map-menu/html.js +13 -8
  52. package/dist/components/map-menu/index.d.ts +5 -4
  53. package/dist/components/map-menu/react.d.ts +28 -17
  54. package/dist/components/map-menu/react.js +84 -178
  55. package/dist/components/map-menu/schema.d.ts +6 -0
  56. package/dist/components/map-menu/shared.d.ts +4 -0
  57. package/dist/components/permissions-input/classes.d.ts +8 -0
  58. package/dist/components/permissions-input/html.d.ts +41 -0
  59. package/dist/components/permissions-input/html.js +130 -0
  60. package/dist/components/permissions-input/index.d.ts +80 -0
  61. package/dist/components/permissions-input/react.d.ts +7 -0
  62. package/dist/components/permissions-input/react.js +201 -0
  63. package/dist/components/permissions-input/schema.d.ts +33 -0
  64. package/dist/components/phone-number-input/html.js +48 -14
  65. package/dist/components/phone-number-input/react.js +67 -10
  66. package/dist/components/search-menu/html.d.ts +2 -2
  67. package/dist/components/select-with-custom-input/html.d.ts +2 -2
  68. package/dist/components/sidebar-layout/html.d.ts +3 -2
  69. package/dist/components/sidebar-layout/html.js +20 -2
  70. package/dist/components/sidebar-layout/index.d.ts +1 -0
  71. package/dist/components/sidebar-layout/react.js +33 -2
  72. package/dist/components/switch/react.d.ts +14 -0
  73. package/dist/components/switch/react.js +55 -0
  74. package/dist/components/theme-switcher/html.d.ts +2 -2
  75. package/dist/components/time-input/html.d.ts +2 -2
  76. package/dist/components/timezone-input/html.js +48 -14
  77. package/dist/components/timezone-input/react.js +67 -10
  78. package/dist/components/tracking-notice/classes.d.ts +6 -0
  79. package/dist/components/tracking-notice/html.d.ts +85 -0
  80. package/dist/components/tracking-notice/html.js +354 -0
  81. package/dist/components/tracking-notice/index.d.ts +95 -0
  82. package/dist/components/tracking-notice/react.d.ts +5 -27
  83. package/dist/components/tracking-notice/react.js +189 -59
  84. package/dist/components/tracking-notice/schema.d.ts +45 -0
  85. package/dist/components/upload-attachment/classes.d.ts +3 -2
  86. package/dist/components/upload-attachment/html.d.ts +5 -5
  87. package/dist/components/upload-attachment/html.js +7 -5
  88. package/dist/components/upload-attachment/react.d.ts +3 -1
  89. package/dist/components/upload-attachment/react.js +25 -17
  90. package/dist/components/virtualized-combobox/classes.d.ts +12 -0
  91. package/dist/components/virtualized-combobox/html.d.ts +42 -0
  92. package/dist/components/virtualized-combobox/html.js +48 -14
  93. package/dist/components/virtualized-combobox/index.d.ts +55 -4
  94. package/dist/components/virtualized-combobox/react.d.ts +6 -2
  95. package/dist/components/virtualized-combobox/react.js +67 -10
  96. package/dist/components/virtualized-combobox/schema.d.ts +60 -4
  97. package/dist/components/webhook-delivery-table/html.js +56 -19
  98. package/dist/components/webhook-delivery-table/react.js +46 -16
  99. package/dist/lib/access/index.d.ts +61 -0
  100. package/dist/lib/access/index.js +92 -0
  101. package/dist/lib/access/table/classes.d.ts +13 -0
  102. package/dist/lib/access/table/html.d.ts +39 -0
  103. package/dist/lib/access/table/html.js +157 -0
  104. package/dist/lib/access/table/index.d.ts +32 -0
  105. package/dist/lib/access/table/react.d.ts +3 -0
  106. package/dist/lib/access/table/react.js +195 -0
  107. package/dist/lib/access/table/schema.d.ts +43 -0
  108. package/dist/lib/docs.integrations.server.js +23 -1
  109. package/dist/lib/docs.js +33 -2
  110. package/dist/lib/docs.server.js +29 -2
  111. package/dist/lib/documentation-toolkit.js +23 -1
  112. package/dist/lib/effect-ui-adapter/use-model.d.ts +1 -1
  113. package/dist/lib/effect-ui-adapter/use-model.js +19 -11
  114. package/dist/lib/lucide-effect.d.ts +19 -19
  115. package/dist/lib/lucide-effect.js +38 -38
  116. package/dist/services/assets/library.d.ts +221 -0
  117. package/dist/services/assets/schema.d.ts +3 -0
  118. package/dist/services/assets/url.d.ts +12 -0
  119. package/dist/services/assets/use-library.d.ts +20 -0
  120. package/dist/services/events/browser.js +39 -26
  121. package/dist/services/events/index.js +23 -19
  122. package/dist/services/opentelemetry/web-vitals.js +27 -23
  123. package/package.json +21 -1
@@ -1,7 +1,7 @@
1
1
  // ../../src/components/tracking-notice/react.tsx
2
- import { useState, useSyncExternalStore } from "react";
2
+ import { useLayoutEffect, useState } from "react";
3
3
  import { createPortal } from "react-dom";
4
- import { Effect as Effect2, Schema as Schema3 } from "effect";
4
+ import { Component as Component2, View } from "effect/ui";
5
5
  import { XIcon } from "lucide-react";
6
6
  import { Button } from "@/components/ui/button";
7
7
  import { useKrakstackLocale } from "@krak-stack/registry/krakstack-provider/react";
@@ -13,6 +13,19 @@ import {
13
13
  DialogHeader,
14
14
  DialogTitle
15
15
  } from "@/components/ui/dialog";
16
+ import { useModel } from "@krak-stack/registry/effect-ui-adapter/react";
17
+
18
+ // ../../src/components/tracking-notice/classes.ts
19
+ var trackingNoticeClasses = {
20
+ trigger: "text-muted-foreground hover:text-foreground text-sm underline",
21
+ banner: "bg-card fixed inset-x-3 bottom-3 z-40 mx-auto max-w-3xl rounded-xl border p-5 shadow-xl sm:inset-x-6 sm:flex sm:items-center sm:gap-6",
22
+ dismiss: "text-muted-foreground hover:text-foreground absolute top-2 right-2 rounded-sm p-1",
23
+ bannerActions: "mt-4 flex shrink-0 flex-wrap gap-2 sm:mt-0"
24
+ };
25
+
26
+ // ../../src/components/tracking-notice/index.ts
27
+ import { Effect as Effect2, Queue, Schema as Schema4, Stream } from "effect";
28
+ import { Command, Component, Subscription, UiSchema } from "effect/ui";
16
29
 
17
30
  // ../../src/services/opentelemetry/consent.ts
18
31
  import * as Data from "effect/Data";
@@ -77,13 +90,17 @@ var ANALYTICS_CONSENT_COOKIE = "krakstack_analytics_consent";
77
90
  var ANALYTICS_NOTICE_VERSION = "1";
78
91
  var changedEvent = "krakstack:analytics-consent";
79
92
  var lifetime = 180 * 24 * 60 * 60 * 1000;
93
+ var cookiePrefix = `${ANALYTICS_CONSENT_COOKIE}=`;
80
94
  var codec = Schema2.StringFromUriComponent.pipe(Schema2.decodeTo(Schema2.fromJsonString(BrowserAnalyticsPreference)));
81
- var readCookie = (cookie) => cookie.split(";").map((part) => part.trim()).find((part) => part.startsWith(`${ANALYTICS_CONSENT_COOKIE}=`))?.slice(ANALYTICS_CONSENT_COOKIE.length + 1);
95
+ var decodePreference = Schema2.decodeOption(codec);
96
+ var encodePreference = Schema2.encodeSync(codec);
97
+ var decodePrivacySignals = Schema2.decodeUnknownOption(BrowserPrivacySignals);
98
+ var readCookie = (cookie) => cookie.split(";").map((part) => part.trim()).find((part) => part.startsWith(cookiePrefix))?.slice(cookiePrefix.length);
82
99
  var analyticsPreference = (cookie, now = Date.now()) => {
83
100
  const value = readCookie(cookie);
84
101
  if (!value)
85
102
  return;
86
- const decoded = Schema2.decodeOption(codec)(value);
103
+ const decoded = decodePreference(value);
87
104
  if (Option.isNone(decoded))
88
105
  return;
89
106
  const preference = decoded.value;
@@ -92,43 +109,53 @@ var analyticsPreference = (cookie, now = Date.now()) => {
92
109
  var browserPrivacyEnabled = () => {
93
110
  if (globalThis.navigator === undefined)
94
111
  return false;
95
- const value = Schema2.decodeUnknownOption(BrowserPrivacySignals)(navigator);
112
+ const value = decodePrivacySignals(navigator);
96
113
  return navigator.doNotTrack === "1" || navigator.doNotTrack === "yes" || Option.isSome(value) && value.value.globalPrivacyControl === true;
97
114
  };
98
- var browserPreference = () => {
99
- if (globalThis.document === undefined)
100
- return;
101
- const cookie = Effect.runSync(Effect.try({
102
- try: () => document.cookie,
103
- catch: () => new AnalyticsPreferenceStorageError({
104
- message: "Analytics preference storage unavailable"
105
- })
106
- }).pipe(Effect.orElseSucceed(() => "")));
107
- return analyticsPreference(cookie);
108
- };
115
+ var cookieOperation = (operation) => Effect.try({
116
+ try: operation,
117
+ catch: (cause) => new AnalyticsPreferenceStorageError({
118
+ message: "Analytics preference storage unavailable",
119
+ cause
120
+ })
121
+ });
122
+ var browserPreference = () => analyticsPreference(Effect.runSync(cookieOperation(() => globalThis.document?.cookie ?? "").pipe(Effect.orElseSucceed(() => ""))));
109
123
  var consentGeneration = 0;
110
124
  var previousSnapshot;
111
- var analyticsConsentSnapshot = () => {
112
- const preference = browserPreference();
113
- const snapshot = browserPrivacyEnabled() ? "blocked" : preference ? `${preference.choice}:${preference.revision}` : "pending";
125
+ var observeBrowserConsent = () => {
126
+ const blocked = browserPrivacyEnabled();
127
+ const preference = blocked ? undefined : browserPreference();
128
+ const snapshot = blocked ? "blocked" : preference ? `${preference.choice}:${preference.revision}` : "pending";
114
129
  if (snapshot !== previousSnapshot) {
115
130
  consentGeneration++;
116
131
  previousSnapshot = snapshot;
117
132
  }
118
- return snapshot;
133
+ return { preference, snapshot, generation: consentGeneration };
119
134
  };
135
+ var analyticsConsentSnapshot = () => observeBrowserConsent().snapshot;
120
136
  var saveAnalyticsPreference = (choice) => {
137
+ const host = globalThis.document;
138
+ if (host === undefined)
139
+ return false;
121
140
  const issuedAt = Date.now();
122
- const value = Schema2.encodeSync(codec)({
141
+ const revision = Effect.runSync(SecureRandom.SecureRandom.use((random) => random.uuidV7()).pipe(Effect.provide(SecureRandom.layerWebCrypto)));
142
+ const value = encodePreference({
123
143
  choice,
124
- revision: Effect.runSync(SecureRandom.SecureRandom.use((random) => random.uuidV7()).pipe(Effect.provide(SecureRandom.layerWebCrypto))),
144
+ revision,
125
145
  version: ANALYTICS_NOTICE_VERSION,
126
146
  issuedAt,
127
147
  expiresAt: issuedAt + lifetime
128
148
  });
129
- document.cookie = `${ANALYTICS_CONSENT_COOKIE}=${value}; Path=/; Max-Age=${lifetime / 1000}; SameSite=Lax${location.protocol === "https:" ? "; Secure" : ""}`;
149
+ const secure = host.location?.protocol === "https:" ? "; Secure" : "";
150
+ const written = Effect.runSync(cookieOperation(() => {
151
+ host.cookie = `${cookiePrefix}${value}; Path=/; Max-Age=${lifetime / 1000}; SameSite=Lax${secure}`;
152
+ return true;
153
+ }).pipe(Effect.orElseSucceed(() => false)));
154
+ if (!written)
155
+ return false;
156
+ const saved = browserPreference();
130
157
  globalThis.dispatchEvent(new Event(changedEvent));
131
- return analyticsPreference(document.cookie)?.choice === choice;
158
+ return saved?.choice === choice && saved.revision === revision;
132
159
  };
133
160
  var subscribeAnalyticsConsent = (listener) => {
134
161
  let previous = analyticsConsentSnapshot();
@@ -151,14 +178,43 @@ var subscribeAnalyticsConsent = (listener) => {
151
178
  };
152
179
  };
153
180
 
154
- // ../../src/components/tracking-notice/react.tsx
155
- import { jsx, jsxs, Fragment } from "react/jsx-runtime";
181
+ // ../../src/components/tracking-notice/schema.ts
182
+ import { Schema as Schema3 } from "effect";
183
+ var Text = Schema3.optional(Schema3.String);
184
+ var Messages = Schema3.Struct({
185
+ preferences: Text,
186
+ title: Text,
187
+ description: Text,
188
+ learnMore: Text,
189
+ details: Text,
190
+ essential: Text,
191
+ privacy: Text,
192
+ accept: Text,
193
+ decline: Text,
194
+ close: Text,
195
+ blocked: Text,
196
+ accepted: Text,
197
+ declined: Text,
198
+ pending: Text,
199
+ error: Text
200
+ }).annotate({ identifier: "TrackingNoticeMessages" });
201
+ var TrackingNoticePropsSchema = Schema3.Struct({
202
+ messages: Schema3.optional(Messages),
203
+ locale: Text,
204
+ privacyHref: Text
205
+ }).annotate({ identifier: "TrackingNoticeProps" });
206
+
207
+ // ../../src/components/tracking-notice/index.ts
208
+ var TrackingChoice = Schema4.Literals(["accepted", "declined"]);
156
209
  var browserPreferences = {
157
210
  subscribe: subscribeAnalyticsConsent,
158
211
  getSnapshot: analyticsConsentSnapshot,
159
212
  save: saveAnalyticsPreference
160
213
  };
161
- var translations = {
214
+
215
+ class ConsentStorageError extends Schema4.TaggedError()("ConsentStorageError", {}) {
216
+ }
217
+ var defaultMessages = {
162
218
  en: {
163
219
  preferences: "Analytics preferences",
164
220
  title: "Help us improve this site",
@@ -194,9 +250,96 @@ var translations = {
194
250
  error: "Impossible d’enregistrer votre préférence. Vérifiez que les témoins sont autorisés et réessayez."
195
251
  }
196
252
  };
253
+ var trackingNoticeMessages = (locale, overrides) => {
254
+ const defaults = locale.split("-")[0] === "fr" ? defaultMessages.fr : defaultMessages.en;
255
+ return {
256
+ ...defaults,
257
+ ...Object.fromEntries(Object.entries(overrides ?? {}).filter(([, value]) => value !== undefined))
258
+ };
259
+ };
260
+ var trackingNoticeStatus = (snapshot, labels) => snapshot === "blocked" ? labels.blocked : snapshot.startsWith("accepted:") ? labels.accepted : snapshot.startsWith("declined:") ? labels.declined : labels.pending;
261
+ var TrackingNoticeMessage = UiSchema.TaggedEnum({
262
+ Opened: {},
263
+ Closed: {},
264
+ Dismissed: {},
265
+ ChoiceRequested: { choice: TrackingChoice },
266
+ Saved: { success: Schema4.Boolean },
267
+ SnapshotChanged: { snapshot: Schema4.String }
268
+ });
269
+ var trackingNoticeOptions = {
270
+ name: "TrackingNotice",
271
+ props: TrackingNoticePropsSchema,
272
+ model: Schema4.Struct({
273
+ open: Schema4.Boolean,
274
+ dismissed: Schema4.Boolean,
275
+ failed: Schema4.Boolean,
276
+ snapshot: Schema4.String
277
+ }).annotate({ identifier: "TrackingNoticeModel" }),
278
+ message: TrackingNoticeMessage,
279
+ restore: false
280
+ };
281
+ var trackingNoticeBehaviours = (preferences) => {
282
+ const watch = Subscription.make("TrackingNotice/Watch", Stream.callback((queue) => Effect2.acquireRelease(Effect2.sync(() => {
283
+ const notify = () => {
284
+ Queue.offerUnsafe(queue, TrackingNoticeMessage.SnapshotChanged({
285
+ snapshot: preferences.getSnapshot()
286
+ }));
287
+ };
288
+ const unsubscribe = preferences.subscribe(notify);
289
+ notify();
290
+ return unsubscribe;
291
+ }), (unsubscribe) => Effect2.sync(unsubscribe))));
292
+ const Save = Command.make("TrackingNotice/Save", { args: { choice: TrackingChoice } }, ({ choice }) => Effect2.try({
293
+ try: () => !(choice === "accepted" && preferences.getSnapshot() === "blocked") && preferences.save(choice),
294
+ catch: () => new ConsentStorageError
295
+ }).pipe(Effect2.orElseSucceed(() => false), Effect2.map((success) => TrackingNoticeMessage.Saved({ success }))));
296
+ const update = Component.define(trackingNoticeOptions).update({
297
+ Opened: ($) => $.evolve({ open: true, failed: false }),
298
+ Closed: ($) => $.evolve({ open: false }),
299
+ Dismissed: ($) => $.evolve({ dismissed: true }),
300
+ ChoiceRequested: ($, { choice }) => $.run(Save.make({ choice })),
301
+ Saved: ($, { success }) => $.evolve({ failed: !success, open: !success && $.model.open }),
302
+ SnapshotChanged: ($, { snapshot }) => $.evolve({ snapshot })
303
+ });
304
+ return {
305
+ init: () => ({
306
+ open: false,
307
+ dismissed: false,
308
+ failed: false,
309
+ snapshot: "server"
310
+ }),
311
+ update,
312
+ subscriptions: () => [watch]
313
+ };
314
+ };
197
315
 
198
- class ConsentStorageError extends Schema3.TaggedError()("ConsentStorageError", {}) {
199
- }
316
+ // ../../src/components/tracking-notice/react.tsx
317
+ import { jsx, jsxs, Fragment } from "react/jsx-runtime";
318
+ var makeTrackingNoticeModel = (preferences) => Component2.define(trackingNoticeOptions).make({
319
+ ...trackingNoticeBehaviours(preferences),
320
+ view: () => View.text("")
321
+ });
322
+ var bindableTrackingNoticeModel = (initial) => {
323
+ let current = initial;
324
+ const listeners = new Set;
325
+ const notify = () => listeners.forEach((listener) => listener());
326
+ return {
327
+ component: makeTrackingNoticeModel({
328
+ subscribe: (listener) => {
329
+ listeners.add(listener);
330
+ return () => listeners.delete(listener);
331
+ },
332
+ getSnapshot: () => current.getSnapshot(),
333
+ save: (choice) => current.save(choice)
334
+ }),
335
+ bind: (preferences) => {
336
+ current = preferences;
337
+ const unsubscribe = current.subscribe(notify);
338
+ notify();
339
+ return unsubscribe;
340
+ }
341
+ };
342
+ };
200
343
  var TrackingNotice = ({
201
344
  messages,
202
345
  locale: localeOverride,
@@ -204,22 +347,15 @@ var TrackingNotice = ({
204
347
  preferences = browserPreferences
205
348
  } = {}) => {
206
349
  const locale = useKrakstackLocale(localeOverride);
207
- const labels = {
208
- ...locale.split("-")[0] === "fr" ? translations.fr : translations.en,
209
- ...messages
210
- };
211
- const snapshot = useSyncExternalStore(preferences.subscribe, preferences.getSnapshot, () => "server");
212
- const [open, setOpen] = useState(false);
213
- const [dismissed, setDismissed] = useState(false);
214
- const [failed, setFailed] = useState(false);
350
+ const labels = trackingNoticeMessages(locale, messages);
351
+ const [modelBinding] = useState(() => bindableTrackingNoticeModel(preferences));
352
+ useLayoutEffect(() => modelBinding.bind(preferences), [modelBinding, preferences]);
353
+ const {
354
+ model: { open, dismissed, failed, snapshot },
355
+ send
356
+ } = useModel(modelBinding.component, { locale, messages, privacyHref });
215
357
  const save = (choice) => {
216
- const result = Effect2.runSync(Effect2.try({
217
- try: () => preferences.save(choice),
218
- catch: () => new ConsentStorageError
219
- }).pipe(Effect2.orElseSucceed(() => false)));
220
- setFailed(!result);
221
- if (result)
222
- setOpen(false);
358
+ send(TrackingNoticeMessage.ChoiceRequested({ choice }));
223
359
  };
224
360
  const actions = /* @__PURE__ */ jsxs(Fragment, {
225
361
  children: [
@@ -257,27 +393,24 @@ var TrackingNotice = ({
257
393
  }) : null
258
394
  ]
259
395
  });
260
- const status = snapshot === "blocked" ? labels.blocked : snapshot.startsWith("accepted:") ? labels.accepted : snapshot.startsWith("declined:") ? labels.declined : labels.pending;
396
+ const status = trackingNoticeStatus(snapshot, labels);
261
397
  return /* @__PURE__ */ jsxs(Fragment, {
262
398
  children: [
263
399
  /* @__PURE__ */ jsx("button", {
264
400
  type: "button",
265
- className: "text-muted-foreground hover:text-foreground text-sm underline",
266
- onClick: () => {
267
- setFailed(false);
268
- setOpen(true);
269
- },
401
+ className: trackingNoticeClasses.trigger,
402
+ onClick: () => send(TrackingNoticeMessage.Opened()),
270
403
  children: labels.preferences
271
404
  }),
272
405
  snapshot === "pending" && !dismissed && !open ? createPortal(/* @__PURE__ */ jsxs("section", {
273
406
  "aria-label": labels.title,
274
- className: "bg-card fixed inset-x-3 bottom-3 z-40 mx-auto max-w-3xl rounded-xl border p-5 shadow-xl sm:inset-x-6 sm:flex sm:items-center sm:gap-6",
407
+ className: trackingNoticeClasses.banner,
275
408
  children: [
276
409
  /* @__PURE__ */ jsx("button", {
277
410
  type: "button",
278
411
  "aria-label": labels.close,
279
- className: "text-muted-foreground hover:text-foreground absolute top-2 right-2 rounded-sm p-1",
280
- onClick: () => setDismissed(true),
412
+ className: trackingNoticeClasses.dismiss,
413
+ onClick: () => send(TrackingNoticeMessage.Dismissed()),
281
414
  children: /* @__PURE__ */ jsx(XIcon, {
282
415
  className: "size-3.5"
283
416
  })
@@ -301,10 +434,7 @@ var TrackingNotice = ({
301
434
  }) : /* @__PURE__ */ jsx("button", {
302
435
  type: "button",
303
436
  className: "underline",
304
- onClick: () => {
305
- setFailed(false);
306
- setOpen(true);
307
- },
437
+ onClick: () => send(TrackingNoticeMessage.Opened()),
308
438
  children: labels.learnMore
309
439
  })
310
440
  ]
@@ -312,7 +442,7 @@ var TrackingNotice = ({
312
442
  ]
313
443
  }),
314
444
  /* @__PURE__ */ jsx("div", {
315
- className: "mt-4 flex shrink-0 gap-2 sm:mt-0",
445
+ className: trackingNoticeClasses.bannerActions,
316
446
  children: actions
317
447
  }),
318
448
  failed ? /* @__PURE__ */ jsx("p", {
@@ -324,7 +454,7 @@ var TrackingNotice = ({
324
454
  }), document.body) : null,
325
455
  /* @__PURE__ */ jsx(Dialog, {
326
456
  open,
327
- onOpenChange: setOpen,
457
+ onOpenChange: (next) => send(next ? TrackingNoticeMessage.Opened() : TrackingNoticeMessage.Closed()),
328
458
  children: /* @__PURE__ */ jsxs(DialogContent, {
329
459
  children: [
330
460
  /* @__PURE__ */ jsxs(DialogHeader, {
@@ -0,0 +1,45 @@
1
+ import { Schema } from "effect";
2
+ declare const Messages: Schema.Struct<{
3
+ readonly preferences: Schema.optional<Schema.String>;
4
+ readonly title: Schema.optional<Schema.String>;
5
+ readonly description: Schema.optional<Schema.String>;
6
+ readonly learnMore: Schema.optional<Schema.String>;
7
+ readonly details: Schema.optional<Schema.String>;
8
+ readonly essential: Schema.optional<Schema.String>;
9
+ readonly privacy: Schema.optional<Schema.String>;
10
+ readonly accept: Schema.optional<Schema.String>;
11
+ readonly decline: Schema.optional<Schema.String>;
12
+ readonly close: Schema.optional<Schema.String>;
13
+ readonly blocked: Schema.optional<Schema.String>;
14
+ readonly accepted: Schema.optional<Schema.String>;
15
+ readonly declined: Schema.optional<Schema.String>;
16
+ readonly pending: Schema.optional<Schema.String>;
17
+ readonly error: Schema.optional<Schema.String>;
18
+ }>;
19
+ export type TrackingNoticeMessages = {
20
+ readonly [Key in keyof typeof Messages.Type]-?: string;
21
+ };
22
+ export declare const TrackingNoticePropsSchema: Schema.Struct<{
23
+ readonly messages: Schema.optional<Schema.Struct<{
24
+ readonly preferences: Schema.optional<Schema.String>;
25
+ readonly title: Schema.optional<Schema.String>;
26
+ readonly description: Schema.optional<Schema.String>;
27
+ readonly learnMore: Schema.optional<Schema.String>;
28
+ readonly details: Schema.optional<Schema.String>;
29
+ readonly essential: Schema.optional<Schema.String>;
30
+ readonly privacy: Schema.optional<Schema.String>;
31
+ readonly accept: Schema.optional<Schema.String>;
32
+ readonly decline: Schema.optional<Schema.String>;
33
+ readonly close: Schema.optional<Schema.String>;
34
+ readonly blocked: Schema.optional<Schema.String>;
35
+ readonly accepted: Schema.optional<Schema.String>;
36
+ readonly declined: Schema.optional<Schema.String>;
37
+ readonly pending: Schema.optional<Schema.String>;
38
+ readonly error: Schema.optional<Schema.String>;
39
+ }>>;
40
+ readonly locale: Schema.optional<Schema.String>;
41
+ /** Link to an application-owned privacy page. */
42
+ readonly privacyHref: Schema.optional<Schema.String>;
43
+ }>;
44
+ export type TrackingNoticeProps = typeof TrackingNoticePropsSchema.Type;
45
+ export {};
@@ -1,8 +1,9 @@
1
1
  import type { UploadAttachmentClassesOverrides } from "./schema.js";
2
+ export declare const uploadAttachmentStatusRowClass = "mt-1 flex items-center gap-2";
2
3
  export declare const uploadAttachmentClasses: {
3
4
  readonly pendingIcon: "motion-safe:animate-spin";
4
- readonly status: "text-muted-foreground mt-1 text-xs";
5
- readonly progress: "accent-primary mt-2 h-1.5 w-full";
5
+ readonly status: "text-muted-foreground text-xs";
6
+ readonly progress: "accent-primary h-1.5 min-w-0 flex-1 overflow-hidden rounded-full [&:not(:indeterminate)]:appearance-none [&:not(:indeterminate)]:bg-muted [&::-webkit-progress-bar]:bg-muted [&::-webkit-progress-value]:rounded-full [&::-webkit-progress-value]:bg-primary [&::-moz-progress-bar]:rounded-full [&::-moz-progress-bar]:bg-primary";
6
7
  };
7
8
  export declare const resolveUploadAttachmentClasses: (overrides?: UploadAttachmentClassesOverrides) => {
8
9
  pendingIcon: string;
@@ -71,14 +71,14 @@ export declare const UploadAttachment: import("effect/ui/Component").Component<"
71
71
  readonly canRemove?: boolean | undefined;
72
72
  }, null, {
73
73
  readonly _tag: "Cancel";
74
- } | {
75
- readonly _tag: "Retry";
76
74
  } | {
77
75
  readonly _tag: "Remove";
78
- }, {
79
- readonly _tag: "Cancel";
80
76
  } | {
81
77
  readonly _tag: "Retry";
78
+ }, {
79
+ readonly _tag: "Cancel";
82
80
  } | {
83
81
  readonly _tag: "Remove";
84
- }, never, Html.Elements, {}, never>;
82
+ } | {
83
+ readonly _tag: "Retry";
84
+ }, never, Html.Elements, {}, "fileIcon">;
@@ -16,10 +16,11 @@ import {
16
16
  import { cn } from "cn";
17
17
 
18
18
  // ../../src/components/upload-attachment/classes.ts
19
+ var uploadAttachmentStatusRowClass = "mt-1 flex items-center gap-2";
19
20
  var uploadAttachmentClasses = {
20
21
  pendingIcon: "motion-safe:animate-spin",
21
- status: "text-muted-foreground mt-1 text-xs",
22
- progress: "accent-primary mt-2 h-1.5 w-full"
22
+ status: "text-muted-foreground text-xs",
23
+ progress: "accent-primary h-1.5 min-w-0 flex-1 overflow-hidden rounded-full [&:not(:indeterminate)]:appearance-none [&:not(:indeterminate)]:bg-muted [&::-webkit-progress-bar]:bg-muted [&::-webkit-progress-value]:rounded-full [&::-webkit-progress-value]:bg-primary [&::-moz-progress-bar]:rounded-full [&::-moz-progress-bar]:bg-primary"
23
24
  };
24
25
  var resolveUploadAttachmentClasses = (overrides) => ({
25
26
  ...uploadAttachmentClasses,
@@ -147,6 +148,7 @@ var props = Schema3.Struct({
147
148
  var UploadAttachment = Html.component({
148
149
  ...uploadAttachmentOptions,
149
150
  props,
151
+ slots: ["fileIcon"],
150
152
  reads: { localeConfig: krakstackLocaleRead }
151
153
  }).make({
152
154
  ...uploadAttachmentBehaviours,
@@ -165,10 +167,10 @@ var UploadAttachment = Html.component({
165
167
  "data-component": "upload-attachment",
166
168
  "data-state": state.status,
167
169
  "aria-labelledby": id
168
- }).children(h.span.class("bg-muted grid size-9 shrink-0 place-items-center rounded-md").children(state.status === "done" ? Check(h, { size: 18 }) : state.status === "error" ? TriangleAlert(h, { size: 18 }) : busy ? LoaderCircle(h, {
170
+ }).children(h.span.class("bg-muted grid size-9 shrink-0 place-items-center rounded-md").children(h.span.class("peer empty:hidden").children(h.slots.fileIcon), h.span.class("peer-[:not(:empty)]:hidden").children(state.status === "done" ? Check(h, { size: 18 }) : state.status === "error" ? TriangleAlert(h, { size: 18 }) : busy ? LoaderCircle(h, {
169
171
  size: 18,
170
172
  className: uploadAttachmentClasses.pendingIcon
171
- }) : FileIcon(h, { size: 18 })), h.div.class("min-w-0 flex-1").children(h.p.id(id).class("truncate text-sm font-medium").children(name), description && h.p.class("text-muted-foreground text-xs").children(description), h.p.attrs({
173
+ }) : FileIcon(h, { size: 18 }))), h.div.class("min-w-0 flex-1").children(h.p.id(id).class("truncate text-sm font-medium").children(name), description && h.p.class("text-muted-foreground text-xs").children(description), h.div.class(uploadAttachmentStatusRowClass).children(h.p.attrs({
172
174
  "data-slot": "upload-attachment-status",
173
175
  role: state.status === "error" ? "alert" : "status"
174
176
  }).class(uploadAttachmentClasses.status).children(status), state.status === "uploading" && h.progress.attrs({
@@ -176,7 +178,7 @@ var UploadAttachment = Html.component({
176
178
  "aria-label": `${copy.uploading}: ${name}`,
177
179
  max: "100",
178
180
  value: progress?.toString()
179
- }).class(uploadAttachmentClasses.progress)), h.div.class("flex items-center gap-1").children(busy && h.props.canCancel && action(copy.cancel, UploadAttachmentAction.Cancel()), retry && h.props.canRetry && action(copy.retry, UploadAttachmentAction.Retry()), !busy && h.props.canRemove && action(copy.remove, UploadAttachmentAction.Remove())));
181
+ }).class(uploadAttachmentClasses.progress))), h.div.class("flex items-center gap-1").children(busy && h.props.canCancel && action(copy.cancel, UploadAttachmentAction.Cancel()), retry && h.props.canRetry && action(copy.retry, UploadAttachmentAction.Retry()), !busy && h.props.canRemove && action(copy.remove, UploadAttachmentAction.Remove())));
180
182
  }
181
183
  });
182
184
  export {
@@ -1,9 +1,11 @@
1
+ import { type ReactNode } from "react";
1
2
  import type { UploadAttachmentSharedProps } from "./schema.js";
2
3
  export type { UploadAttachmentState, UploadAttachmentMessages } from "./schema.js";
3
4
  export type UploadAttachmentProps = UploadAttachmentSharedProps & {
5
+ fileIcon?: ReactNode;
4
6
  onCancel?: () => void;
5
7
  onRetry?: () => void;
6
8
  onRemove?: () => void;
7
9
  };
8
10
  /** Controlled presentation. The host owns transport, cancellation and retry policy. */
9
- export declare const UploadAttachment: ({ classes: classOverrides, name, description, state, disabled, onCancel, onRetry, onRemove, className, locale: override, messages, }: UploadAttachmentProps) => import("react").JSX.Element;
11
+ export declare const UploadAttachment: ({ classes: classOverrides, name, description, fileIcon, state, disabled, onCancel, onRetry, onRemove, className, locale: override, messages, }: UploadAttachmentProps) => import("react").JSX.Element;
@@ -20,10 +20,11 @@ import { Button } from "@/components/ui/button";
20
20
  import { useKrakstackLocale } from "@krak-stack/registry/krakstack-provider/react";
21
21
 
22
22
  // ../../src/components/upload-attachment/classes.ts
23
+ var uploadAttachmentStatusRowClass = "mt-1 flex items-center gap-2";
23
24
  var uploadAttachmentClasses = {
24
25
  pendingIcon: "motion-safe:animate-spin",
25
- status: "text-muted-foreground mt-1 text-xs",
26
- progress: "accent-primary mt-2 h-1.5 w-full"
26
+ status: "text-muted-foreground text-xs",
27
+ progress: "accent-primary h-1.5 min-w-0 flex-1 overflow-hidden rounded-full [&:not(:indeterminate)]:appearance-none [&:not(:indeterminate)]:bg-muted [&::-webkit-progress-bar]:bg-muted [&::-webkit-progress-value]:rounded-full [&::-webkit-progress-value]:bg-primary [&::-moz-progress-bar]:rounded-full [&::-moz-progress-bar]:bg-primary"
27
28
  };
28
29
  var resolveUploadAttachmentClasses = (overrides) => ({
29
30
  ...uploadAttachmentClasses,
@@ -147,6 +148,7 @@ var UploadAttachment = ({
147
148
  classes: classOverrides,
148
149
  name,
149
150
  description,
151
+ fileIcon,
150
152
  state,
151
153
  disabled,
152
154
  onCancel,
@@ -167,7 +169,7 @@ var UploadAttachment = ({
167
169
  "aria-labelledby": `${id}-name`,
168
170
  children: [
169
171
  /* @__PURE__ */ jsx(AttachmentMedia, {
170
- children: state.status === "done" ? /* @__PURE__ */ jsx(Check, {
172
+ children: fileIcon ?? (state.status === "done" ? /* @__PURE__ */ jsx(Check, {
171
173
  "aria-hidden": "true"
172
174
  }) : state.status === "error" ? /* @__PURE__ */ jsx(TriangleAlert, {
173
175
  "aria-hidden": "true"
@@ -176,30 +178,36 @@ var UploadAttachment = ({
176
178
  className: uploadAttachmentClasses.pendingIcon
177
179
  }) : /* @__PURE__ */ jsx(File, {
178
180
  "aria-hidden": "true"
179
- })
181
+ }))
180
182
  }),
181
183
  /* @__PURE__ */ jsxs(AttachmentContent, {
182
184
  children: [
183
185
  /* @__PURE__ */ jsx(AttachmentTitle, {
184
186
  id: `${id}-name`,
187
+ title: name,
185
188
  children: name
186
189
  }),
187
190
  description ? /* @__PURE__ */ jsx(AttachmentDescription, {
188
191
  children: description
189
192
  }) : null,
190
- /* @__PURE__ */ jsx("p", {
191
- "data-slot": "upload-attachment-status",
192
- role: state.status === "error" ? "alert" : "status",
193
- className: uploadAttachmentClasses.status,
194
- children: status
195
- }),
196
- state.status === "uploading" ? /* @__PURE__ */ jsx("progress", {
197
- "data-slot": "upload-attachment-progress",
198
- className: uploadAttachmentClasses.progress,
199
- "aria-label": `${copy.uploading}: ${name}`,
200
- max: 100,
201
- value: progress
202
- }) : null
193
+ /* @__PURE__ */ jsxs("div", {
194
+ className: uploadAttachmentStatusRowClass,
195
+ children: [
196
+ /* @__PURE__ */ jsx("p", {
197
+ "data-slot": "upload-attachment-status",
198
+ role: state.status === "error" ? "alert" : "status",
199
+ className: uploadAttachmentClasses.status,
200
+ children: status
201
+ }),
202
+ state.status === "uploading" ? /* @__PURE__ */ jsx("progress", {
203
+ "data-slot": "upload-attachment-progress",
204
+ className: uploadAttachmentClasses.progress,
205
+ "aria-label": `${copy.uploading}: ${name}`,
206
+ max: 100,
207
+ value: progress
208
+ }) : null
209
+ ]
210
+ })
203
211
  ]
204
212
  }),
205
213
  /* @__PURE__ */ jsxs(AttachmentActions, {
@@ -1,7 +1,19 @@
1
1
  import type { VirtualizedComboboxClassesOverrides } from "./schema.js";
2
2
  export declare const virtualizedComboboxClasses: {
3
3
  readonly itemLabel: "min-w-0 truncate";
4
+ readonly groupLabel: "text-muted-foreground px-2 pt-3 pb-1 text-start text-xs";
5
+ readonly itemContent: "flex min-w-0 flex-1 items-center gap-2 text-start";
6
+ readonly itemMedia: "bg-muted grid size-8 shrink-0 place-items-center overflow-hidden rounded-md [&_svg]:size-4";
7
+ readonly itemImage: "size-full object-cover";
8
+ readonly itemDescription: "text-muted-foreground block truncate text-xs";
4
9
  };
10
+ export declare const virtualizedComboboxGroupHeight = 36;
11
+ export declare const virtualizedComboboxDetailHeight = 52;
5
12
  export declare const resolveVirtualizedComboboxClasses: (overrides?: VirtualizedComboboxClassesOverrides) => {
6
13
  itemLabel: string;
14
+ groupLabel: string;
15
+ itemContent: string;
16
+ itemMedia: string;
17
+ itemImage: string;
18
+ itemDescription: string;
7
19
  };