@burdenoff/fe-libs 2026.1118.12 → 2026.1119.1

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 (41) hide show
  1. package/dist/chrome/globalSearch/AdvancedFiltersPanel.js +128 -127
  2. package/dist/chrome/notificationCenter/NotificationFilters.js +45 -44
  3. package/dist/connections/CredentialStorageSelector.js +135 -134
  4. package/dist/connections/SharePanels.js +70 -69
  5. package/dist/credentials/AuthMethodSelector.js +33 -32
  6. package/dist/credentials/SchemaForm.js +96 -95
  7. package/dist/shared/assistant/avatar/live/LiveAvatarSettingsFields.js +74 -73
  8. package/dist/shared/assistant/images.js +14 -13
  9. package/dist/shared/assistant/index.d.ts +1 -0
  10. package/dist/shared/assistant/sandboxRegistry.js +3 -0
  11. package/dist/shared/assistant/ui/AssistantLanguageMenu.d.ts +2 -0
  12. package/dist/shared/assistant/ui/AssistantLanguageMenu.js +41 -40
  13. package/dist/shared/assistant/ui/AssistantReplyLanguageSelector.d.ts +3 -1
  14. package/dist/shared/assistant/ui/AssistantReplyLanguageSelector.js +26 -25
  15. package/dist/shared/assistant/ui/composer/AssistantLanguageSelector.d.ts +3 -1
  16. package/dist/shared/assistant/ui/composer/AssistantLanguageSelector.js +22 -21
  17. package/dist/shared/assistant/ui/composer/AssistantVoiceGraceSelector.d.ts +2 -1
  18. package/dist/shared/assistant/ui/composer/AssistantVoiceGraceSelector.js +17 -16
  19. package/dist/shared/assistant/ui/composer/AssistantVoiceSelector.d.ts +3 -1
  20. package/dist/shared/assistant/ui/composer/AssistantVoiceSelector.js +22 -21
  21. package/dist/shared/pages/searchPage/FiltersPanel.js +129 -128
  22. package/dist/shared/pages/searchPage/SearchToolbar.js +24 -23
  23. package/dist/shared/providers/AppShellProvider.d.ts +8 -0
  24. package/dist/shared/providers/AppShellProvider.js +199 -193
  25. package/dist/shared/providers/shell/ThemeProvider.d.ts +6 -1
  26. package/dist/shared/providers/shell/ThemeProvider.js +65 -62
  27. package/dist/shared/providers/shell/themedNativeControls.d.ts +25 -0
  28. package/dist/shared/providers/shell/themedNativeControls.js +13 -0
  29. package/dist/shared-assistant.js +373 -372
  30. package/dist/sharing/ShareDialog.js +33 -32
  31. package/dist/storage/StorageFolderPicker.js +50 -49
  32. package/dist/ui/index.d.ts +2 -0
  33. package/dist/ui/themed-select-context.d.ts +9 -0
  34. package/dist/ui/themed-select-context.js +15 -0
  35. package/dist/ui/themed-select-options.d.ts +42 -0
  36. package/dist/ui/themed-select-options.js +88 -0
  37. package/dist/ui/themed-select.d.ts +7 -0
  38. package/dist/ui/themed-select.js +234 -0
  39. package/dist/ui.js +31 -29
  40. package/package.json +1 -1
  41. package/src/shared/tokens/tokens.css +100 -0
@@ -3,13 +3,14 @@ import { Button as i } from "../ui/button.js";
3
3
  import { Input as a } from "../ui/input.js";
4
4
  import { Label as o } from "../ui/label.js";
5
5
  import { Textarea as ee } from "../ui/textarea.js";
6
- import { cn as s } from "../lib/utils.js";
7
- import { MemberPicker as c } from "./MemberPicker.js";
8
- import { PermissionSelect as l } from "./PermissionSelect.js";
9
- import { SharedWithList as te } from "./SharedWithList.js";
10
- import { copyTextToClipboard as ne, normalizeShareUrl as u } from "./shareUrl.js";
11
- import { useEffect as d, useMemo as f, useState as p } from "react";
12
- import { Check as re, Copy as ie, Globe as m, Link2 as h, Lock as g, Users as _ } from "lucide-react";
6
+ import { cn as te } from "../lib/utils.js";
7
+ import { MemberPicker as ne } from "./MemberPicker.js";
8
+ import { PermissionSelect as s } from "./PermissionSelect.js";
9
+ import { SharedWithList as c } from "./SharedWithList.js";
10
+ import { copyTextToClipboard as re, normalizeShareUrl as ie } from "./shareUrl.js";
11
+ import { ThemedSelect as l } from "../ui/themed-select.js";
12
+ import { useEffect as ae, useMemo as u, useState as d } from "react";
13
+ import { Check as f, Copy as p, Globe as m, Link2 as h, Lock as g, Users as _ } from "lucide-react";
13
14
  import { jsx as v, jsxs as y } from "react/jsx-runtime";
14
15
  // src/sharing/ShareDialog.tsx
15
16
  var b = [
@@ -46,20 +47,20 @@ function S(e) {
46
47
  return e[0] ?? "VIEWER";
47
48
  }
48
49
  var C = ({ resource: C, controller: w, open: T, onOpenChange: E, workspaceId: D, authToken: O, apiGatewayUrl: k }) => {
49
- let { capabilities: A } = w, j = !!C.vibeId && A.supportsVibeShare, M = f(() => {
50
+ let { capabilities: A } = w, j = !!C.vibeId && A.supportsVibeShare, M = u(() => {
50
51
  let e = ["private"];
51
52
  return A.supportsUsers && e.push("users"), j && e.push("vibe"), A.supportsLink && e.push("link"), e;
52
53
  }, [
53
54
  A.supportsUsers,
54
55
  A.supportsLink,
55
56
  j
56
- ]), N = f(() => A.supportsUsers ? "users" : M[0] ?? "private", [M, A.supportsUsers]), [P, F] = p(N), [I, L] = p(null), [R, ae] = p(S(A.roles)), [z, B] = p(""), [V, H] = p("never"), [U, W] = p(!1), [G, K] = p(S(A.roles)), [q, oe] = p("never"), [J, Y] = p(null), [X, Z] = p(!1), [Q, $] = p(!1);
57
- d(() => {
57
+ ]), N = u(() => A.supportsUsers ? "users" : M[0] ?? "private", [M, A.supportsUsers]), [P, F] = d(N), [I, L] = d(null), [R, oe] = d(S(A.roles)), [z, B] = d(""), [V, H] = d("never"), [U, W] = d(!1), [G, K] = d(S(A.roles)), [q, se] = d("never"), [J, Y] = d(null), [X, Z] = d(!1), [Q, $] = d(!1);
58
+ ae(() => {
58
59
  T ? (F(N), w.refetch()) : (L(null), B(""), Y(null), Z(!1));
59
60
  }, [T, N]);
60
- let se = (e) => {
61
+ let ce = (e) => {
61
62
  F(e), e === "private" ? w.setVisibility?.("PRIVATE") : e === "vibe" && w.setVisibility?.("SHARED_WITH_VIBE");
62
- }, ce = async () => {
63
+ }, le = async () => {
63
64
  if (I?.email) {
64
65
  W(!0);
65
66
  try {
@@ -73,7 +74,7 @@ var C = ({ resource: C, controller: w, open: T, onOpenChange: E, workspaceId: D,
73
74
  W(!1);
74
75
  }
75
76
  }
76
- }, le = async () => {
77
+ }, ue = async () => {
77
78
  if (w.createLinkShare) {
78
79
  $(!0);
79
80
  try {
@@ -81,14 +82,14 @@ var C = ({ resource: C, controller: w, open: T, onOpenChange: E, workspaceId: D,
81
82
  role: G,
82
83
  expiresAt: A.supportsExpiry ? x(b.find((e) => e.value === q)?.hours ?? null) ?? null : null
83
84
  });
84
- Y(u(e.shareUrl)), w.refetch();
85
+ Y(ie(e.shareUrl)), w.refetch();
85
86
  } finally {
86
87
  $(!1);
87
88
  }
88
89
  }
89
- }, ue = async () => {
90
- J && await ne(J).then(() => !0, () => !1) && (Z(!0), setTimeout(() => Z(!1), 2e3));
91
- }, de = {
90
+ }, de = async () => {
91
+ J && await re(J).then(() => !0, () => !1) && (Z(!0), setTimeout(() => Z(!1), 2e3));
92
+ }, fe = {
92
93
  private: {
93
94
  label: "Private",
94
95
  icon: g,
@@ -127,14 +128,14 @@ var C = ({ resource: C, controller: w, open: T, onOpenChange: E, workspaceId: D,
127
128
  role: "tablist",
128
129
  "aria-label": "Sharing visibility",
129
130
  children: M.map((e) => {
130
- let t = de[e], n = t.icon, r = P === e;
131
+ let t = fe[e], n = t.icon, r = P === e;
131
132
  return /* @__PURE__ */ y("button", {
132
133
  type: "button",
133
134
  role: "tab",
134
135
  "aria-selected": r,
135
136
  "data-testid": t.testId,
136
- onClick: () => se(e),
137
- className: s("inline-flex items-center gap-1.5 rounded-md px-3 py-1.5 text-sm font-medium transition-colors", r ? "bg-bg-surface text-text-primary shadow-sm" : "text-text-secondary hover:text-text-primary"),
137
+ onClick: () => ce(e),
138
+ className: te("inline-flex items-center gap-1.5 rounded-md px-3 py-1.5 text-sm font-medium transition-colors", r ? "bg-bg-surface text-text-primary shadow-sm" : "text-text-secondary hover:text-text-primary"),
138
139
  children: [/* @__PURE__ */ v(n, { className: "size-4" }), t.label]
139
140
  }, e);
140
141
  })
@@ -156,7 +157,7 @@ var C = ({ resource: C, controller: w, open: T, onOpenChange: E, workspaceId: D,
156
157
  P === "users" ? /* @__PURE__ */ y("div", {
157
158
  className: "space-y-4",
158
159
  children: [
159
- /* @__PURE__ */ v(c, {
160
+ /* @__PURE__ */ v(ne, {
160
161
  workspaceId: D ?? "",
161
162
  authToken: O,
162
163
  apiGatewayUrl: k,
@@ -174,10 +175,10 @@ var C = ({ resource: C, controller: w, open: T, onOpenChange: E, workspaceId: D,
174
175
  children: [/* @__PURE__ */ v(o, {
175
176
  htmlFor: "share-role",
176
177
  children: "Permission"
177
- }), /* @__PURE__ */ v(l, {
178
+ }), /* @__PURE__ */ v(s, {
178
179
  value: R,
179
180
  roles: A.roles,
180
- onChange: ae
181
+ onChange: oe
181
182
  })]
182
183
  }),
183
184
  A.supportsExpiry ? /* @__PURE__ */ y("div", {
@@ -185,7 +186,7 @@ var C = ({ resource: C, controller: w, open: T, onOpenChange: E, workspaceId: D,
185
186
  children: [/* @__PURE__ */ v(o, {
186
187
  htmlFor: "share-user-expiry",
187
188
  children: "Access expires"
188
- }), /* @__PURE__ */ v("select", {
189
+ }), /* @__PURE__ */ v(l, {
189
190
  id: "share-user-expiry",
190
191
  value: V,
191
192
  onChange: (e) => H(e.target.value),
@@ -215,7 +216,7 @@ var C = ({ resource: C, controller: w, open: T, onOpenChange: E, workspaceId: D,
215
216
  "data-testid": "share-invite-submit",
216
217
  disabled: !I?.email || U,
217
218
  onClick: () => {
218
- ce();
219
+ le();
219
220
  },
220
221
  className: "w-full",
221
222
  children: U ? "Sharing…" : "Share"
@@ -252,7 +253,7 @@ var C = ({ resource: C, controller: w, open: T, onOpenChange: E, workspaceId: D,
252
253
  children: [/* @__PURE__ */ v(o, {
253
254
  htmlFor: "share-link-role",
254
255
  children: "Permission"
255
- }), /* @__PURE__ */ v(l, {
256
+ }), /* @__PURE__ */ v(s, {
256
257
  value: G,
257
258
  roles: A.roles,
258
259
  onChange: K,
@@ -264,10 +265,10 @@ var C = ({ resource: C, controller: w, open: T, onOpenChange: E, workspaceId: D,
264
265
  children: [/* @__PURE__ */ v(o, {
265
266
  htmlFor: "share-link-expiry",
266
267
  children: "Link expires"
267
- }), /* @__PURE__ */ v("select", {
268
+ }), /* @__PURE__ */ v(l, {
268
269
  id: "share-link-expiry",
269
270
  value: q,
270
- onChange: (e) => oe(e.target.value),
271
+ onChange: (e) => se(e.target.value),
271
272
  "data-testid": "share-link-expiry",
272
273
  className: "flex h-10 w-full rounded-md border border-border-default bg-bg-surface px-3 py-2 text-sm text-text-primary scheme-normal dark:scheme-dark focus:outline-none focus:ring-2 focus:ring-action-primary-bg [&_option]:bg-bg-surface [&_option]:text-text-primary",
273
274
  children: b.map((e) => /* @__PURE__ */ v("option", {
@@ -287,16 +288,16 @@ var C = ({ resource: C, controller: w, open: T, onOpenChange: E, workspaceId: D,
287
288
  type: "button",
288
289
  "data-testid": "share-copy-link",
289
290
  onClick: () => {
290
- ue();
291
+ de();
291
292
  },
292
- children: [v(X ? re : ie, { className: "size-4" }), X ? "Copied" : "Copy"]
293
+ children: [v(X ? f : p, { className: "size-4" }), X ? "Copied" : "Copy"]
293
294
  })]
294
295
  }) : /* @__PURE__ */ y(i, {
295
296
  type: "button",
296
297
  "data-testid": "share-create-link",
297
298
  disabled: Q || !w.createLinkShare,
298
299
  onClick: () => {
299
- le();
300
+ ue();
300
301
  },
301
302
  className: "w-full",
302
303
  children: [/* @__PURE__ */ v(h, { className: "size-4" }), Q ? "Creating…" : "Create link"]
@@ -305,7 +306,7 @@ var C = ({ resource: C, controller: w, open: T, onOpenChange: E, workspaceId: D,
305
306
  }) : null
306
307
  ]
307
308
  }),
308
- /* @__PURE__ */ v(te, {
309
+ /* @__PURE__ */ v(c, {
309
310
  controller: w,
310
311
  workspaceId: D,
311
312
  authToken: O,
@@ -1,9 +1,10 @@
1
- import { useEffect as e, useState as t } from "react";
2
- import { jsx as n, jsxs as r } from "react/jsx-runtime";
3
- import { gql as i } from "@apollo/client";
4
- import { useApolloClient as a } from "@apollo/client/react";
1
+ import { ThemedSelect as e } from "../ui/themed-select.js";
2
+ import { useEffect as t, useState as n } from "react";
3
+ import { jsx as r, jsxs as i } from "react/jsx-runtime";
4
+ import { gql as a } from "@apollo/client";
5
+ import { useApolloClient as o } from "@apollo/client/react";
5
6
  // src/storage/StorageFolderPicker.tsx
6
- var o = i`
7
+ var s = a`
7
8
  query StorageFolderPicker_ListFolders($context: ContextInput!, $parentId: ID) {
8
9
  listFiles(context: $context, parentId: $parentId, kind: FOLDER) {
9
10
  items {
@@ -14,7 +15,7 @@ var o = i`
14
15
  }
15
16
  }
16
17
  }
17
- `, s = i`
18
+ `, c = a`
18
19
  mutation StorageFolderPicker_CreateFolder($input: CreateFolderInput!) {
19
20
  createFolder(input: $input) {
20
21
  id
@@ -24,112 +25,112 @@ var o = i`
24
25
  }
25
26
  }
26
27
  `;
27
- function c({ workspaceId: i, value: c, onChange: l, operations: u, initialParentId: d, disabled: f }) {
28
- let p = a(), [m, h] = t(null), [g, _] = t(!1), [v, y] = t(""), [b, x] = t(null), S = u?.list ?? o, C = u?.create ?? s;
29
- return e(() => {
28
+ function l({ workspaceId: a, value: l, onChange: u, operations: d, initialParentId: f, disabled: p }) {
29
+ let m = o(), [h, g] = n(null), [_, v] = n(!1), [y, b] = n(""), [x, S] = n(null), C = d?.list ?? s, w = d?.create ?? c;
30
+ return t(() => {
30
31
  let e = !1;
31
- return h(null), x(null), p.query({
32
- query: S,
32
+ return g(null), S(null), m.query({
33
+ query: C,
33
34
  variables: {
34
- context: { workspaceId: i },
35
- parentId: d ?? null
35
+ context: { workspaceId: a },
36
+ parentId: f ?? null
36
37
  },
37
38
  fetchPolicy: "network-only"
38
39
  }).then((t) => {
39
40
  if (e) return;
40
41
  let n = t.data?.listFiles?.items ?? [];
41
- h(n.map(({ __typename: e, ...t }) => t));
42
+ g(n.map(({ __typename: e, ...t }) => t));
42
43
  }).catch((t) => {
43
- e || x(t instanceof Error ? t.message : String(t));
44
+ e || S(t instanceof Error ? t.message : String(t));
44
45
  }), () => {
45
46
  e = !0;
46
47
  };
47
48
  }, [
48
- p,
49
- S,
50
- i,
51
- d
52
- ]), /* @__PURE__ */ r("div", {
49
+ m,
50
+ C,
51
+ a,
52
+ f
53
+ ]), /* @__PURE__ */ i("div", {
53
54
  className: "space-y-2",
54
55
  children: [
55
- /* @__PURE__ */ n("label", {
56
+ /* @__PURE__ */ r("label", {
56
57
  className: "block text-xs font-medium text-text-secondary",
57
58
  children: "Save to folder"
58
59
  }),
59
- b && /* @__PURE__ */ n("p", {
60
+ x && /* @__PURE__ */ r("p", {
60
61
  className: "text-xs text-status-error-text",
61
- children: b
62
+ children: x
62
63
  }),
63
- m == null ? /* @__PURE__ */ n("p", {
64
+ h == null ? /* @__PURE__ */ r("p", {
64
65
  className: "text-xs text-text-tertiary",
65
66
  children: "Loading folders…"
66
- }) : m.length === 0 ? /* @__PURE__ */ n("p", {
67
+ }) : h.length === 0 ? /* @__PURE__ */ r("p", {
67
68
  className: "text-xs text-text-tertiary",
68
69
  children: "No folders yet — create one."
69
- }) : /* @__PURE__ */ r("select", {
70
- disabled: f,
71
- value: c?.id ?? "",
70
+ }) : /* @__PURE__ */ i(e, {
71
+ disabled: p,
72
+ value: l?.id ?? "",
72
73
  onChange: (e) => {
73
- l(m.find((t) => t.id === e.target.value) ?? null);
74
+ u(h.find((t) => t.id === e.target.value) ?? null);
74
75
  },
75
76
  className: "w-full rounded-md border border-border-subtle bg-bg-surface text-text-primary px-2 py-1.5 text-sm scheme-normal dark:scheme-dark [&_option]:bg-bg-surface [&_option]:text-text-primary",
76
77
  "aria-label": "Folder",
77
- children: [/* @__PURE__ */ n("option", {
78
+ children: [/* @__PURE__ */ r("option", {
78
79
  value: "",
79
80
  children: "— Pick a folder —"
80
- }), m.map((e) => /* @__PURE__ */ n("option", {
81
+ }), h.map((e) => /* @__PURE__ */ r("option", {
81
82
  value: e.id,
82
83
  children: e.path
83
84
  }, e.id))]
84
85
  }),
85
- g ? /* @__PURE__ */ r("div", {
86
+ _ ? /* @__PURE__ */ i("div", {
86
87
  className: "flex items-center gap-2",
87
88
  children: [
88
- /* @__PURE__ */ n("input", {
89
+ /* @__PURE__ */ r("input", {
89
90
  type: "text",
90
- value: v,
91
- onChange: (e) => y(e.target.value),
91
+ value: y,
92
+ onChange: (e) => b(e.target.value),
92
93
  placeholder: "New folder name",
93
94
  className: "flex-1 rounded-md border border-border-subtle bg-bg-surface px-2 py-1.5 text-sm"
94
95
  }),
95
- /* @__PURE__ */ n("button", {
96
+ /* @__PURE__ */ r("button", {
96
97
  type: "button",
97
98
  onClick: async () => {
98
- let e = v.trim();
99
+ let e = y.trim();
99
100
  if (e) try {
100
- let t = (await p.mutate({
101
- mutation: C,
101
+ let t = (await m.mutate({
102
+ mutation: w,
102
103
  variables: { input: {
103
104
  name: e,
104
- parentId: d ?? null,
105
- context: { workspaceId: i }
105
+ parentId: f ?? null,
106
+ context: { workspaceId: a }
106
107
  } }
107
108
  })).data?.createFolder;
108
- t && (h((e) => e ? [...e, t] : [t]), y(""), _(!1), l(t));
109
+ t && (g((e) => e ? [...e, t] : [t]), b(""), v(!1), u(t));
109
110
  } catch (e) {
110
- x(e instanceof Error ? e.message : String(e));
111
+ S(e instanceof Error ? e.message : String(e));
111
112
  }
112
113
  },
113
114
  className: "rounded-md bg-status-info-bg-default px-2.5 py-1.5 text-xs text-status-info-text-inverse",
114
115
  children: "Create"
115
116
  }),
116
- /* @__PURE__ */ n("button", {
117
+ /* @__PURE__ */ r("button", {
117
118
  type: "button",
118
119
  onClick: () => {
119
- _(!1), y("");
120
+ v(!1), b("");
120
121
  },
121
122
  className: "rounded-md border border-border-subtle px-2.5 py-1.5 text-xs text-text-secondary",
122
123
  children: "Cancel"
123
124
  })
124
125
  ]
125
- }) : /* @__PURE__ */ n("button", {
126
+ }) : /* @__PURE__ */ r("button", {
126
127
  type: "button",
127
- onClick: () => _(!0),
128
- disabled: f,
128
+ onClick: () => v(!0),
129
+ disabled: p,
129
130
  className: "text-xs text-status-info-text hover:underline disabled:opacity-50",
130
131
  children: "+ New folder"
131
132
  })
132
133
  ]
133
134
  });
134
135
  }
135
- export { c as StorageFolderPicker };
136
+ export { l as StorageFolderPicker };
@@ -31,6 +31,8 @@ export { Label } from './label';
31
31
  export { Popover, PopoverTrigger, PopoverContent, PopoverAnchor } from './popover';
32
32
  export { ScrollArea, ScrollBar } from './scroll-area';
33
33
  export { Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, } from './select';
34
+ export { ThemedSelect, type ThemedSelectProps } from './themed-select';
35
+ export { ThemedSelectProvider, useThemedSelects, type ThemedSelectProviderProps, } from './themed-select-context';
34
36
  export { Separator } from './separator';
35
37
  export { Sheet, SheetTrigger, SheetClose, SheetContent, SheetHeader, SheetFooter, SheetTitle, SheetDescription, } from './sheet';
36
38
  export { Skeleton } from './skeleton';
@@ -0,0 +1,9 @@
1
+ import { ReactNode } from 'react';
2
+ export interface ThemedSelectProviderProps {
3
+ /** Open the app's styled menu instead of the system's. Default true. */
4
+ enabled?: boolean;
5
+ children: ReactNode;
6
+ }
7
+ export declare function ThemedSelectProvider({ enabled, children }: ThemedSelectProviderProps): import('react').JSX.Element;
8
+ /** True when the selects under this point open the app's styled menu. */
9
+ export declare function useThemedSelects(): boolean;
@@ -0,0 +1,15 @@
1
+ import { createContext as e, use as t } from "react";
2
+ import { jsx as n } from "react/jsx-runtime";
3
+ // src/ui/themed-select-context.tsx
4
+ var r = e(!1);
5
+ r.displayName = "ThemedSelectContext";
6
+ function i({ enabled: e = !0, children: t }) {
7
+ return /* @__PURE__ */ n(r.Provider, {
8
+ value: e,
9
+ children: t
10
+ });
11
+ }
12
+ function a() {
13
+ return t(r);
14
+ }
15
+ export { i as ThemedSelectProvider, a as useThemedSelects };
@@ -0,0 +1,42 @@
1
+ import { ReactNode } from 'react';
2
+ export interface ThemedSelectOption {
3
+ /** Position among every `<option>`, in document order (as in `select.options`). */
4
+ index: number;
5
+ /** The submitted value: the `value` prop, or the option's text when it has none. */
6
+ value: string;
7
+ /** What the option shows: its `label` prop, or its text. */
8
+ label: string;
9
+ /** Disabled itself, or inside a disabled `<optgroup>`: shown, never chosen. */
10
+ disabled: boolean;
11
+ /** Its own `disabled` only: React's rule for the fallback choice reads just this. */
12
+ ownDisabled: boolean;
13
+ /** `hidden`: a placeholder the list never shows. */
14
+ hidden: boolean;
15
+ }
16
+ export type ThemedSelectEntry = {
17
+ kind: 'option';
18
+ option: ThemedSelectOption;
19
+ } | {
20
+ kind: 'group';
21
+ label: string;
22
+ options: ThemedSelectOption[];
23
+ };
24
+ export interface ThemedSelectModel {
25
+ /** What the menu lists, groups kept. */
26
+ entries: ThemedSelectEntry[];
27
+ /** Every option, flattened, in document order. */
28
+ options: ThemedSelectOption[];
29
+ }
30
+ /**
31
+ * Reads `children` as a native `<select>` would see them. Returns null when they hold
32
+ * anything else (a component that renders its own `<option>`, stray text): the caller
33
+ * then keeps the native `<select>`, which still works, rather than guess.
34
+ */
35
+ export declare function readThemedSelectChildren(children: ReactNode): ThemedSelectModel | null;
36
+ /**
37
+ * The option a native `<select>` shows for `value`, as React selects it: the first
38
+ * option with that value, else the first one not disabled itself. -1: no options.
39
+ */
40
+ export declare function selectedOptionIndex(options: readonly ThemedSelectOption[], value: string | undefined): number;
41
+ /** `value` / `defaultValue` as React writes it to a single `<select>`. */
42
+ export declare function selectValueString(value: unknown): string | undefined;
@@ -0,0 +1,88 @@
1
+ import { Fragment as e, isValidElement as t } from "react";
2
+ // src/ui/themed-select-options.ts
3
+ function n(e) {
4
+ return e.replace(/[\t\n\f\r ]+/g, " ").trim();
5
+ }
6
+ function r(e) {
7
+ return typeof e == "object" && !!e && Symbol.iterator in e;
8
+ }
9
+ function i(e) {
10
+ if (e == null || typeof e == "boolean") return "";
11
+ if (typeof e == "string" || typeof e == "number" || typeof e == "bigint") return String(e);
12
+ if (r(e) && !t(e)) {
13
+ let t = "";
14
+ for (let n of e) {
15
+ let e = i(n);
16
+ if (e === null) return null;
17
+ t += e;
18
+ }
19
+ return t;
20
+ }
21
+ return null;
22
+ }
23
+ function a(e, t) {
24
+ let n = e[t];
25
+ if (typeof n == "string") return n;
26
+ if (typeof n == "number" || typeof n == "bigint") return String(n);
27
+ }
28
+ function o(o) {
29
+ let s = [], c = [], l = (e, t) => {
30
+ let r = i(e.children);
31
+ if (r === null) return null;
32
+ let o = n(r), s = e.disabled === !0, l = {
33
+ index: c.length,
34
+ value: a(e, "value") ?? o,
35
+ label: n(a(e, "label") ?? "") || o,
36
+ disabled: s || t,
37
+ ownDisabled: s,
38
+ hidden: e.hidden === !0
39
+ };
40
+ return c.push(l), l;
41
+ }, u = (i, o) => {
42
+ if (i == null || typeof i == "boolean") return !0;
43
+ if (typeof i == "string") return i.trim() === "";
44
+ if (t(i)) {
45
+ if (i.type === e) return u(i.props.children, o);
46
+ if (i.type === "option") {
47
+ let e = l(i.props, o?.disabled ?? !1);
48
+ return e ? (o ? o.options.push(e) : s.push({
49
+ kind: "option",
50
+ option: e
51
+ }), !0) : !1;
52
+ }
53
+ if (i.type === "optgroup" && !o) {
54
+ let e = {
55
+ disabled: i.props.disabled === !0,
56
+ options: []
57
+ };
58
+ return u(i.props.children, e) ? (s.push({
59
+ kind: "group",
60
+ label: n(a(i.props, "label") ?? ""),
61
+ options: e.options
62
+ }), !0) : !1;
63
+ }
64
+ return !1;
65
+ }
66
+ if (r(i)) {
67
+ for (let e of i) if (!u(e, o)) return !1;
68
+ return !0;
69
+ }
70
+ return !1;
71
+ };
72
+ return u(o, null) ? {
73
+ entries: s,
74
+ options: c
75
+ } : null;
76
+ }
77
+ function s(e, t) {
78
+ let n = -1;
79
+ for (let r of e) {
80
+ if (t !== void 0 && r.value === t) return r.index;
81
+ n === -1 && !r.ownDisabled && (n = r.index);
82
+ }
83
+ return n;
84
+ }
85
+ function c(e) {
86
+ if (e != null) return Array.isArray(e) ? e.length > 0 ? String(e[0]) : void 0 : String(e);
87
+ }
88
+ export { o as readThemedSelectChildren, c as selectValueString, s as selectedOptionIndex };
@@ -0,0 +1,7 @@
1
+ import { ComponentPropsWithRef } from 'react';
2
+ export type ThemedSelectProps = ComponentPropsWithRef<'select'>;
3
+ /**
4
+ * A `<select>` that opens the app's styled menu where the app opted in, and is the
5
+ * plain native `<select>` everywhere else. See the file header for what it keeps.
6
+ */
7
+ export declare function ThemedSelect(props: ThemedSelectProps): import('react').JSX.Element;