@uipath/apollo-wind 2.85.0 → 2.86.0

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 (38) hide show
  1. package/dist/components/ui/index.cjs +32 -32
  2. package/dist/components/ui/json-tree-view/JsonTree.cjs +3 -1
  3. package/dist/components/ui/json-tree-view/JsonTree.d.ts +8 -1
  4. package/dist/components/ui/json-tree-view/JsonTree.js +3 -1
  5. package/dist/components/ui/json-tree-view/JsonTree.types.d.ts +19 -2
  6. package/dist/components/ui/json-tree-view/JsonTreeRow.cjs +15 -8
  7. package/dist/components/ui/json-tree-view/JsonTreeRow.d.ts +3 -1
  8. package/dist/components/ui/json-tree-view/JsonTreeRow.js +15 -8
  9. package/dist/components/ui/json-tree-view/JsonTypeBadge.cjs +18 -10
  10. package/dist/components/ui/json-tree-view/JsonTypeBadge.d.ts +7 -4
  11. package/dist/components/ui/json-tree-view/JsonTypeBadge.js +18 -10
  12. package/dist/components/ui/json-tree-view/NodeKey.cjs +30 -24
  13. package/dist/components/ui/json-tree-view/NodeKey.d.ts +4 -3
  14. package/dist/components/ui/json-tree-view/NodeKey.js +30 -24
  15. package/dist/components/ui/json-tree-view/buildJsonTree.cjs +19 -0
  16. package/dist/components/ui/json-tree-view/buildJsonTree.d.ts +6 -0
  17. package/dist/components/ui/json-tree-view/buildJsonTree.js +17 -1
  18. package/dist/components/ui/model-picker/ModelTagChip.cjs +9 -3
  19. package/dist/components/ui/model-picker/ModelTagChip.d.ts +1 -0
  20. package/dist/components/ui/model-picker/ModelTagChip.js +5 -2
  21. package/dist/components/ui/model-picker/labels.cjs +2 -0
  22. package/dist/components/ui/model-picker/labels.d.ts +4 -0
  23. package/dist/components/ui/model-picker/labels.js +2 -0
  24. package/dist/components/ui/model-picker/primitives/ModelOptionRow.cjs +6 -8
  25. package/dist/components/ui/model-picker/primitives/ModelOptionRow.js +6 -8
  26. package/dist/components/ui/model-picker/primitives/ModelTagStrip.cjs +96 -0
  27. package/dist/components/ui/model-picker/primitives/ModelTagStrip.d.ts +10 -0
  28. package/dist/components/ui/model-picker/primitives/ModelTagStrip.js +62 -0
  29. package/dist/components/ui/model-picker/primitives/PickerTrigger.cjs +7 -9
  30. package/dist/components/ui/model-picker/primitives/PickerTrigger.js +7 -9
  31. package/dist/components/ui/use-visible-count.cjs +4 -3
  32. package/dist/components/ui/use-visible-count.d.ts +1 -1
  33. package/dist/components/ui/use-visible-count.js +4 -3
  34. package/dist/index.cjs +3 -0
  35. package/dist/index.d.ts +2 -2
  36. package/dist/index.js +2 -2
  37. package/dist/styles.css +9 -12
  38. package/package.json +2 -2
@@ -47,23 +47,28 @@ const TYPE_LABEL = {
47
47
  array: 'Array',
48
48
  null: 'Null'
49
49
  };
50
- function JsonTypeBadge({ type, icon, className, tooltip, reference }) {
50
+ function JsonTypeBadge({ type, icon, className, typeLabel, tooltip, reference }) {
51
51
  const strings = (0, external_strings_cjs_namespaceObject.useJsonTreeViewStrings)();
52
52
  const DefaultIcon = TYPE_ICON[type];
53
- const box = /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
54
- className: (0, index_cjs_namespaceObject.cn)('inline-flex h-4.5 min-w-4.5 shrink-0 items-center justify-center rounded border border-border bg-surface-overlay px-0.5 text-foreground-muted [&_svg]:size-2.75', className),
55
- children: icon ?? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(DefaultIcon, {})
56
- });
53
+ const label = typeLabel ?? TYPE_LABEL[type];
54
+ const tooltipName = 'string' == typeof tooltip ? tooltip : void 0;
55
+ const boxClassName = (0, index_cjs_namespaceObject.cn)('inline-flex h-4.5 min-w-4.5 shrink-0 items-center justify-center rounded border border-border bg-surface-overlay px-0.5 text-foreground-muted [&_svg]:size-2.75', className);
56
+ const boxIcon = icon ?? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(DefaultIcon, {});
57
57
  if (!reference) return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_JsonTreeTooltip_cjs_namespaceObject.JsonTreeTooltip, {
58
58
  content: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
59
59
  className: "break-all font-mono text-xs font-semibold leading-4",
60
- children: tooltip ?? TYPE_LABEL[type]
60
+ children: tooltip ?? label
61
61
  }),
62
62
  placement: "top",
63
63
  delay: true,
64
- children: box
64
+ children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
65
+ role: "img",
66
+ "aria-label": tooltipName ?? label,
67
+ className: boxClassName,
68
+ children: boxIcon
69
+ })
65
70
  });
66
- const title = strings.referenceType(TYPE_LABEL[type]);
71
+ const title = strings.referenceType(label);
67
72
  return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_JsonTreeTooltip_cjs_namespaceObject.JsonTreeTooltip, {
68
73
  content: tooltip ?? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("span", {
69
74
  className: "flex flex-col gap-0.5 leading-4",
@@ -84,9 +89,12 @@ function JsonTypeBadge({ type, icon, className, tooltip, reference }) {
84
89
  className: "relative inline-flex shrink-0 rounded outline-none focus-visible:ring-2 focus-visible:ring-ring",
85
90
  role: "img",
86
91
  tabIndex: 0,
87
- "aria-label": reference.source ? `${title}, ${reference.source}` : title,
92
+ "aria-label": tooltipName ?? (reference.source ? `${title}, ${reference.source}` : title),
88
93
  children: [
89
- box,
94
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
95
+ className: boxClassName,
96
+ children: boxIcon
97
+ }),
90
98
  /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
91
99
  className: "absolute -right-1 -bottom-1 grid size-3 place-items-center rounded-[3px] border border-border bg-surface-overlay text-foreground-muted",
92
100
  children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.ArrowUpRight, {
@@ -6,7 +6,9 @@ export interface JsonTypeBadgeProps {
6
6
  icon?: ReactNode;
7
7
  /** Color/chrome overrides (e.g. from a node decoration). */
8
8
  className?: string;
9
- /** Tooltip content on hover. Defaults to the capitalized type name. */
9
+ /** Type name shown on hover, in place of the capitalized JSON type. */
10
+ typeLabel?: string;
11
+ /** Tooltip content on hover, replacing the type name. */
10
12
  tooltip?: ReactNode;
11
13
  /** Marks the value as a reference: adds a corner tab with an arrow. */
12
14
  reference?: NodeBadgeReference;
@@ -14,7 +16,8 @@ export interface JsonTypeBadgeProps {
14
16
  /**
15
17
  * Compact badge for a JSON value type. Deliberately neutral: the value text
16
18
  * carries the color coding, the badge only carries the type icon. Hovering it
17
- * shows the type name (override via `tooltip`). A `reference` adds a corner
18
- * tab with an arrow; it has no hover state of its own, only the tooltip.
19
+ * shows the type name (override via `typeLabel` or `tooltip`), which is also
20
+ * its accessible name. A `reference` adds a corner tab with an arrow and makes
21
+ * the badge focusable; it has no hover state of its own, only the tooltip.
19
22
  */
20
- export declare function JsonTypeBadge({ type, icon, className, tooltip, reference }: JsonTypeBadgeProps): import("react/jsx-runtime").JSX.Element;
23
+ export declare function JsonTypeBadge({ type, icon, className, typeLabel, tooltip, reference, }: JsonTypeBadgeProps): import("react/jsx-runtime").JSX.Element;
@@ -19,23 +19,28 @@ const TYPE_LABEL = {
19
19
  array: 'Array',
20
20
  null: 'Null'
21
21
  };
22
- function JsonTypeBadge({ type, icon, className, tooltip, reference }) {
22
+ function JsonTypeBadge({ type, icon, className, typeLabel, tooltip, reference }) {
23
23
  const strings = useJsonTreeViewStrings();
24
24
  const DefaultIcon = TYPE_ICON[type];
25
- const box = /*#__PURE__*/ jsx("span", {
26
- className: cn('inline-flex h-4.5 min-w-4.5 shrink-0 items-center justify-center rounded border border-border bg-surface-overlay px-0.5 text-foreground-muted [&_svg]:size-2.75', className),
27
- children: icon ?? /*#__PURE__*/ jsx(DefaultIcon, {})
28
- });
25
+ const label = typeLabel ?? TYPE_LABEL[type];
26
+ const tooltipName = 'string' == typeof tooltip ? tooltip : void 0;
27
+ const boxClassName = cn('inline-flex h-4.5 min-w-4.5 shrink-0 items-center justify-center rounded border border-border bg-surface-overlay px-0.5 text-foreground-muted [&_svg]:size-2.75', className);
28
+ const boxIcon = icon ?? /*#__PURE__*/ jsx(DefaultIcon, {});
29
29
  if (!reference) return /*#__PURE__*/ jsx(JsonTreeTooltip, {
30
30
  content: /*#__PURE__*/ jsx("span", {
31
31
  className: "break-all font-mono text-xs font-semibold leading-4",
32
- children: tooltip ?? TYPE_LABEL[type]
32
+ children: tooltip ?? label
33
33
  }),
34
34
  placement: "top",
35
35
  delay: true,
36
- children: box
36
+ children: /*#__PURE__*/ jsx("span", {
37
+ role: "img",
38
+ "aria-label": tooltipName ?? label,
39
+ className: boxClassName,
40
+ children: boxIcon
41
+ })
37
42
  });
38
- const title = strings.referenceType(TYPE_LABEL[type]);
43
+ const title = strings.referenceType(label);
39
44
  return /*#__PURE__*/ jsx(JsonTreeTooltip, {
40
45
  content: tooltip ?? /*#__PURE__*/ jsxs("span", {
41
46
  className: "flex flex-col gap-0.5 leading-4",
@@ -56,9 +61,12 @@ function JsonTypeBadge({ type, icon, className, tooltip, reference }) {
56
61
  className: "relative inline-flex shrink-0 rounded outline-none focus-visible:ring-2 focus-visible:ring-ring",
57
62
  role: "img",
58
63
  tabIndex: 0,
59
- "aria-label": reference.source ? `${title}, ${reference.source}` : title,
64
+ "aria-label": tooltipName ?? (reference.source ? `${title}, ${reference.source}` : title),
60
65
  children: [
61
- box,
66
+ /*#__PURE__*/ jsx("span", {
67
+ className: boxClassName,
68
+ children: boxIcon
69
+ }),
62
70
  /*#__PURE__*/ jsx("span", {
63
71
  className: "absolute -right-1 -bottom-1 grid size-3 place-items-center rounded-[3px] border border-border bg-surface-overlay text-foreground-muted",
64
72
  children: /*#__PURE__*/ jsx(ArrowUpRight, {
@@ -35,34 +35,40 @@ function NodeKey({ node, label, displayPath, onCopyPath, className }) {
35
35
  const text = label ?? node.key;
36
36
  const copyPathText = displayPath ?? node.path;
37
37
  const keyClass = (0, index_cjs_namespaceObject.cn)('min-w-4 truncate text-xs text-foreground', null != label ? 'font-medium' : 'font-mono', void 0 === node.value && 'text-foreground-muted', className);
38
- if (!onCopyPath) return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
39
- className: keyClass,
40
- children: text
38
+ const details = /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
39
+ className: "flex max-w-60 flex-col gap-1",
40
+ children: [
41
+ null != label && label !== node.key && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
42
+ className: "text-xs font-semibold leading-4",
43
+ children: label
44
+ }),
45
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
46
+ className: "break-all font-mono text-xs font-semibold leading-4",
47
+ children: copyPathText
48
+ }),
49
+ node.schema?.description && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
50
+ className: "text-xs leading-4",
51
+ children: node.schema.description
52
+ }),
53
+ onCopyPath && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
54
+ className: "text-[11px] leading-4 opacity-70",
55
+ children: strings.copyPathHint
56
+ })
57
+ ]
58
+ });
59
+ if (!onCopyPath) return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_JsonTreeTooltip_cjs_namespaceObject.JsonTreeTooltip, {
60
+ placement: "top",
61
+ delay: true,
62
+ content: details,
63
+ children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
64
+ className: keyClass,
65
+ children: text
66
+ })
41
67
  });
42
68
  return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_JsonTreeTooltip_cjs_namespaceObject.JsonTreeTooltip, {
43
69
  placement: "top",
44
70
  delay: true,
45
- content: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
46
- className: "flex max-w-60 flex-col gap-1",
47
- children: [
48
- null != label && label !== node.key && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
49
- className: "text-xs font-semibold leading-4",
50
- children: label
51
- }),
52
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
53
- className: "break-all font-mono text-xs font-semibold leading-4",
54
- children: copyPathText
55
- }),
56
- node.schema?.description && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
57
- className: "text-xs leading-4",
58
- children: node.schema.description
59
- }),
60
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
61
- className: "text-[11px] leading-4 opacity-70",
62
- children: strings.copyPathHint
63
- })
64
- ]
65
- }),
71
+ content: details,
66
72
  children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("button", {
67
73
  type: "button",
68
74
  onClick: ()=>onCopyPath(node),
@@ -9,8 +9,9 @@ export interface NodeKeyProps {
9
9
  className?: string;
10
10
  }
11
11
  /**
12
- * The field name. Hovering underlines it and (after a short delay) shows a
13
- * popover titled with the node's full tree path, plus the schema description
14
- * and a copy hint; clicking copies the path.
12
+ * The field name. Hovering (after a short delay) shows a popover titled with
13
+ * the node's full tree path, plus the schema description. With `onCopyPath`
14
+ * the name is also underlined on hover, the popover adds a copy hint, and
15
+ * clicking copies the path.
15
16
  */
16
17
  export declare function NodeKey({ node, label, displayPath, onCopyPath, className }: NodeKeyProps): import("react/jsx-runtime").JSX.Element;
@@ -7,34 +7,40 @@ function NodeKey({ node, label, displayPath, onCopyPath, className }) {
7
7
  const text = label ?? node.key;
8
8
  const copyPathText = displayPath ?? node.path;
9
9
  const keyClass = cn('min-w-4 truncate text-xs text-foreground', null != label ? 'font-medium' : 'font-mono', void 0 === node.value && 'text-foreground-muted', className);
10
- if (!onCopyPath) return /*#__PURE__*/ jsx("span", {
11
- className: keyClass,
12
- children: text
10
+ const details = /*#__PURE__*/ jsxs("div", {
11
+ className: "flex max-w-60 flex-col gap-1",
12
+ children: [
13
+ null != label && label !== node.key && /*#__PURE__*/ jsx("span", {
14
+ className: "text-xs font-semibold leading-4",
15
+ children: label
16
+ }),
17
+ /*#__PURE__*/ jsx("span", {
18
+ className: "break-all font-mono text-xs font-semibold leading-4",
19
+ children: copyPathText
20
+ }),
21
+ node.schema?.description && /*#__PURE__*/ jsx("span", {
22
+ className: "text-xs leading-4",
23
+ children: node.schema.description
24
+ }),
25
+ onCopyPath && /*#__PURE__*/ jsx("span", {
26
+ className: "text-[11px] leading-4 opacity-70",
27
+ children: strings.copyPathHint
28
+ })
29
+ ]
30
+ });
31
+ if (!onCopyPath) return /*#__PURE__*/ jsx(JsonTreeTooltip, {
32
+ placement: "top",
33
+ delay: true,
34
+ content: details,
35
+ children: /*#__PURE__*/ jsx("span", {
36
+ className: keyClass,
37
+ children: text
38
+ })
13
39
  });
14
40
  return /*#__PURE__*/ jsx(JsonTreeTooltip, {
15
41
  placement: "top",
16
42
  delay: true,
17
- content: /*#__PURE__*/ jsxs("div", {
18
- className: "flex max-w-60 flex-col gap-1",
19
- children: [
20
- null != label && label !== node.key && /*#__PURE__*/ jsx("span", {
21
- className: "text-xs font-semibold leading-4",
22
- children: label
23
- }),
24
- /*#__PURE__*/ jsx("span", {
25
- className: "break-all font-mono text-xs font-semibold leading-4",
26
- children: copyPathText
27
- }),
28
- node.schema?.description && /*#__PURE__*/ jsx("span", {
29
- className: "text-xs leading-4",
30
- children: node.schema.description
31
- }),
32
- /*#__PURE__*/ jsx("span", {
33
- className: "text-[11px] leading-4 opacity-70",
34
- children: strings.copyPathHint
35
- })
36
- ]
37
- }),
43
+ content: details,
38
44
  children: /*#__PURE__*/ jsx("button", {
39
45
  type: "button",
40
46
  onClick: ()=>onCopyPath(node),
@@ -30,6 +30,7 @@ __webpack_require__.d(__webpack_exports__, {
30
30
  flattenJsonTree: ()=>flattenJsonTree,
31
31
  formatLeafValue: ()=>formatLeafValue,
32
32
  getValueAtPath: ()=>getValueAtPath,
33
+ hasVisibleRows: ()=>hasVisibleRows,
33
34
  inferValueType: ()=>inferValueType,
34
35
  isArrayItemTemplateRoot: ()=>isArrayItemTemplateRoot,
35
36
  isJsonObject: ()=>isJsonObject,
@@ -255,6 +256,22 @@ function flattenJsonTree(nodes, options = {}, depth = 0) {
255
256
  numberSiblingSets(rows, depth);
256
257
  return rows;
257
258
  }
259
+ function someInSubtree(node, test) {
260
+ const stack = [
261
+ node
262
+ ];
263
+ while(stack.length > 0){
264
+ const current = stack.pop();
265
+ if (test(current)) return true;
266
+ if (current.children) for (const child of current.children)stack.push(child);
267
+ }
268
+ return false;
269
+ }
270
+ function hasVisibleRows(nodes, options = {}) {
271
+ const { filterPredicate, displayTexts } = options;
272
+ const query = options.query?.trim().toLowerCase() ?? '';
273
+ return nodes.some((node)=>(!query || someInSubtree(node, (candidate)=>nodeSelfMatchesQuery(candidate, query, displayTexts))) && (!filterPredicate || someInSubtree(node, filterPredicate)));
274
+ }
258
275
  function numberSiblingSets(rows, baseDepth) {
259
276
  const openSets = [];
260
277
  const close = (set)=>{
@@ -371,6 +388,7 @@ exports.collectContainerPaths = __webpack_exports__.collectContainerPaths;
371
388
  exports.flattenJsonTree = __webpack_exports__.flattenJsonTree;
372
389
  exports.formatLeafValue = __webpack_exports__.formatLeafValue;
373
390
  exports.getValueAtPath = __webpack_exports__.getValueAtPath;
391
+ exports.hasVisibleRows = __webpack_exports__.hasVisibleRows;
374
392
  exports.inferValueType = __webpack_exports__.inferValueType;
375
393
  exports.isArrayItemTemplateRoot = __webpack_exports__.isArrayItemTemplateRoot;
376
394
  exports.isJsonObject = __webpack_exports__.isJsonObject;
@@ -385,6 +403,7 @@ for(var __rspack_i in __webpack_exports__)if (-1 === [
385
403
  "flattenJsonTree",
386
404
  "formatLeafValue",
387
405
  "getValueAtPath",
406
+ "hasVisibleRows",
388
407
  "inferValueType",
389
408
  "isArrayItemTemplateRoot",
390
409
  "isJsonObject",
@@ -64,6 +64,12 @@ export interface FlattenOptions {
64
64
  * nested tree can't overflow the call stack.
65
65
  */
66
66
  export declare function flattenJsonTree(nodes: JsonTreeNode[], options?: FlattenOptions, depth?: number): FlatJsonTreeRow[];
67
+ /**
68
+ * Whether `flattenJsonTree` with nothing collapsed would show any row, without
69
+ * building them. A top-level node shows when its subtree holds a query match
70
+ * and a filter match (not necessarily the same node), so that is all it checks.
71
+ */
72
+ export declare function hasVisibleRows(nodes: JsonTreeNode[], options?: Omit<FlattenOptions, 'collapsed'>): boolean;
67
73
  export interface ContainerPath {
68
74
  path: string;
69
75
  depth: number;
@@ -215,6 +215,22 @@ function flattenJsonTree(nodes, options = {}, depth = 0) {
215
215
  numberSiblingSets(rows, depth);
216
216
  return rows;
217
217
  }
218
+ function someInSubtree(node, test) {
219
+ const stack = [
220
+ node
221
+ ];
222
+ while(stack.length > 0){
223
+ const current = stack.pop();
224
+ if (test(current)) return true;
225
+ if (current.children) for (const child of current.children)stack.push(child);
226
+ }
227
+ return false;
228
+ }
229
+ function hasVisibleRows(nodes, options = {}) {
230
+ const { filterPredicate, displayTexts } = options;
231
+ const query = options.query?.trim().toLowerCase() ?? '';
232
+ return nodes.some((node)=>(!query || someInSubtree(node, (candidate)=>nodeSelfMatchesQuery(candidate, query, displayTexts))) && (!filterPredicate || someInSubtree(node, filterPredicate)));
233
+ }
218
234
  function numberSiblingSets(rows, baseDepth) {
219
235
  const openSets = [];
220
236
  const close = (set)=>{
@@ -325,4 +341,4 @@ function formatLeafValue(type, value, options) {
325
341
  if ('string' === type) return options?.preserveStringWhitespace ? `"${value}"` : JSON.stringify(value);
326
342
  return String(value);
327
343
  }
328
- export { appendPathSegment, buildJsonTree, collectContainerPaths, flattenJsonTree, formatLeafValue, getValueAtPath, inferValueType, isArrayItemTemplateRoot, isJsonObject, isPathCollapsed, removeValueAtPath, schemaDisplayType, setValueAtPath };
344
+ export { appendPathSegment, buildJsonTree, collectContainerPaths, flattenJsonTree, formatLeafValue, getValueAtPath, hasVisibleRows, inferValueType, isArrayItemTemplateRoot, isJsonObject, isPathCollapsed, removeValueAtPath, schemaDisplayType, setValueAtPath };
@@ -25,7 +25,8 @@ var __webpack_require__ = {};
25
25
  var __webpack_exports__ = {};
26
26
  __webpack_require__.r(__webpack_exports__);
27
27
  __webpack_require__.d(__webpack_exports__, {
28
- ModelTagChip: ()=>ModelTagChip
28
+ ModelTagChip: ()=>ModelTagChip,
29
+ tagVariantToken: ()=>tagVariantToken
29
30
  });
30
31
  const jsx_runtime_namespaceObject = require("react/jsx-runtime");
31
32
  const external_lucide_react_namespaceObject = require("lucide-react");
@@ -44,6 +45,9 @@ const VARIANT_MAP = {
44
45
  'cost-standard': 'mini',
45
46
  'cost-premium': 'mini'
46
47
  };
48
+ function tagVariantToken(tag, variants) {
49
+ return tag.variant ?? variants?.[tag.kind] ?? VARIANT_MAP[tag.kind] ?? 'mini';
50
+ }
47
51
  const BADGE_VARIANT = {
48
52
  mini: 'secondary',
49
53
  'info-mini': 'info',
@@ -59,7 +63,7 @@ const ICON_MAP = {
59
63
  'out-of-region': external_lucide_react_namespaceObject.GlobeLock
60
64
  };
61
65
  const ModelTagChip = ({ tag, variants, icons, disableTooltip })=>{
62
- const variantToken = tag.variant ?? variants?.[tag.kind] ?? VARIANT_MAP[tag.kind] ?? 'mini';
66
+ const variantToken = tagVariantToken(tag, variants);
63
67
  const Icon = icons && tag.kind in icons ? icons[tag.kind] : ICON_MAP[tag.kind];
64
68
  const chip = /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(external_badge_cjs_namespaceObject.Badge, {
65
69
  className: (0, index_cjs_namespaceObject.cn)('h-4 gap-0.5 border-transparent px-1.5 py-0 text-[10px] leading-4 font-semibold pointer-events-none', 'mini' === variantToken && 'bg-foreground/10', variantToken),
@@ -93,8 +97,10 @@ const ModelTagChip = ({ tag, variants, icons, disableTooltip })=>{
93
97
  return chip;
94
98
  };
95
99
  exports.ModelTagChip = __webpack_exports__.ModelTagChip;
100
+ exports.tagVariantToken = __webpack_exports__.tagVariantToken;
96
101
  for(var __rspack_i in __webpack_exports__)if (-1 === [
97
- "ModelTagChip"
102
+ "ModelTagChip",
103
+ "tagVariantToken"
98
104
  ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
99
105
  Object.defineProperty(exports, '__esModule', {
100
106
  value: true
@@ -1,5 +1,6 @@
1
1
  import type * as React from 'react';
2
2
  import type { ModelTag } from './types';
3
+ export declare function tagVariantToken(tag: ModelTag, variants?: Record<string, string>): string;
3
4
  export interface ModelTagChipProps {
4
5
  tag: ModelTag;
5
6
  /**
@@ -16,6 +16,9 @@ const VARIANT_MAP = {
16
16
  'cost-standard': 'mini',
17
17
  'cost-premium': 'mini'
18
18
  };
19
+ function tagVariantToken(tag, variants) {
20
+ return tag.variant ?? variants?.[tag.kind] ?? VARIANT_MAP[tag.kind] ?? 'mini';
21
+ }
19
22
  const BADGE_VARIANT = {
20
23
  mini: 'secondary',
21
24
  'info-mini': 'info',
@@ -31,7 +34,7 @@ const ICON_MAP = {
31
34
  'out-of-region': GlobeLock
32
35
  };
33
36
  const ModelTagChip = ({ tag, variants, icons, disableTooltip })=>{
34
- const variantToken = tag.variant ?? variants?.[tag.kind] ?? VARIANT_MAP[tag.kind] ?? 'mini';
37
+ const variantToken = tagVariantToken(tag, variants);
35
38
  const Icon = icons && tag.kind in icons ? icons[tag.kind] : ICON_MAP[tag.kind];
36
39
  const chip = /*#__PURE__*/ jsxs(Badge, {
37
40
  className: cn('h-4 gap-0.5 border-transparent px-1.5 py-0 text-[10px] leading-4 font-semibold pointer-events-none', 'mini' === variantToken && 'bg-foreground/10', variantToken),
@@ -64,4 +67,4 @@ const ModelTagChip = ({ tag, variants, icons, disableTooltip })=>{
64
67
  });
65
68
  return chip;
66
69
  };
67
- export { ModelTagChip };
70
+ export { ModelTagChip, tagVariantToken };
@@ -56,6 +56,8 @@ const DEFAULT_MODEL_PICKER_LABELS = {
56
56
  substitutedTagTooltip: (target)=>`This model is retired. Your traffic is currently being routed to ${target}. Update your configuration to make this explicit.`,
57
57
  outOfRegionTag: (geography)=>`Out of region (${geography})`,
58
58
  outOfRegionTagTooltip: (homeRegion)=>`Routes traffic outside ${homeRegion}`,
59
+ hiddenTagCount: (count)=>`+${count}`,
60
+ hiddenTagCountTooltip: (hidden)=>hidden.join(', '),
59
61
  costBasic: 'Basic',
60
62
  costStandard: 'Standard',
61
63
  costPremium: 'Premium',
@@ -30,6 +30,10 @@ export interface ModelPickerLabels {
30
30
  substitutedTagTooltip: (target: string) => string;
31
31
  outOfRegionTag: (geography: string) => string;
32
32
  outOfRegionTagTooltip: (homeRegion: string) => string;
33
+ /** The count of the chips a name has no room beside, e.g. "+2". */
34
+ hiddenTagCount: (count: number) => string;
35
+ /** The count's tooltip in the list, naming the chips it stands for. */
36
+ hiddenTagCountTooltip: (hidden: readonly string[]) => string;
33
37
  costBasic: string;
34
38
  costStandard: string;
35
39
  costPremium: string;
@@ -26,6 +26,8 @@ const DEFAULT_MODEL_PICKER_LABELS = {
26
26
  substitutedTagTooltip: (target)=>`This model is retired. Your traffic is currently being routed to ${target}. Update your configuration to make this explicit.`,
27
27
  outOfRegionTag: (geography)=>`Out of region (${geography})`,
28
28
  outOfRegionTagTooltip: (homeRegion)=>`Routes traffic outside ${homeRegion}`,
29
+ hiddenTagCount: (count)=>`+${count}`,
30
+ hiddenTagCountTooltip: (hidden)=>hidden.join(', '),
29
31
  costBasic: 'Basic',
30
32
  costStandard: 'Standard',
31
33
  costPremium: 'Premium',
@@ -36,8 +36,8 @@ const external_react_namespaceObject = require("react");
36
36
  const external_tooltip_cjs_namespaceObject = require("../../tooltip.cjs");
37
37
  const index_cjs_namespaceObject = require("../../../../lib/index.cjs");
38
38
  const external_labels_cjs_namespaceObject = require("../labels.cjs");
39
- const external_ModelTagChip_cjs_namespaceObject = require("../ModelTagChip.cjs");
40
39
  const external_utils_cjs_namespaceObject = require("../utils.cjs");
40
+ const external_ModelTagStrip_cjs_namespaceObject = require("./ModelTagStrip.cjs");
41
41
  const FULL_OPTION_HEIGHT = 64;
42
42
  const DENSE_OPTION_HEIGHT = 44;
43
43
  const ModelOptionRowInner = ({ model, index, active, selected, onSelect, onActivate, tagContext, tagVariants, renderActions, renderMeta, dense, hideTagKinds, id, 'data-testid': dataTestId })=>{
@@ -72,13 +72,11 @@ const ModelOptionRowInner = ({ model, index, active, selected, onSelect, onActiv
72
72
  className: (0, index_cjs_namespaceObject.cn)('min-w-0 flex-[0_1_auto] truncate leading-snug font-semibold text-foreground', dense ? 'text-xs' : 'text-sm'),
73
73
  children: primary
74
74
  }),
75
- inlineTags.map((t)=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
76
- className: "flex min-w-0 shrink items-center overflow-hidden [&_[data-slot=model-picker-tag]]:max-w-full [&_[data-slot=model-picker-tag]]:truncate",
77
- children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_ModelTagChip_cjs_namespaceObject.ModelTagChip, {
78
- tag: t,
79
- variants: tagVariants
80
- })
81
- }, `${t.kind}-${t.label}`))
75
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_ModelTagStrip_cjs_namespaceObject.ModelTagStrip, {
76
+ labels: labels,
77
+ tagVariants: tagVariants,
78
+ tags: inlineTags
79
+ })
82
80
  ]
83
81
  }),
84
82
  techId && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
@@ -5,8 +5,8 @@ import { memo } from "react";
5
5
  import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "../../tooltip.js";
6
6
  import { cn } from "../../../../lib/index.js";
7
7
  import { DEFAULT_MODEL_PICKER_LABELS } from "../labels.js";
8
- import { ModelTagChip } from "../ModelTagChip.js";
9
8
  import { deriveModelTags, isByoModel } from "../utils.js";
9
+ import { ModelTagStrip } from "./ModelTagStrip.js";
10
10
  const FULL_OPTION_HEIGHT = 64;
11
11
  const DENSE_OPTION_HEIGHT = 44;
12
12
  const ModelOptionRowInner = ({ model, index, active, selected, onSelect, onActivate, tagContext, tagVariants, renderActions, renderMeta, dense, hideTagKinds, id, 'data-testid': dataTestId })=>{
@@ -41,13 +41,11 @@ const ModelOptionRowInner = ({ model, index, active, selected, onSelect, onActiv
41
41
  className: cn('min-w-0 flex-[0_1_auto] truncate leading-snug font-semibold text-foreground', dense ? 'text-xs' : 'text-sm'),
42
42
  children: primary
43
43
  }),
44
- inlineTags.map((t)=>/*#__PURE__*/ jsx("span", {
45
- className: "flex min-w-0 shrink items-center overflow-hidden [&_[data-slot=model-picker-tag]]:max-w-full [&_[data-slot=model-picker-tag]]:truncate",
46
- children: /*#__PURE__*/ jsx(ModelTagChip, {
47
- tag: t,
48
- variants: tagVariants
49
- })
50
- }, `${t.kind}-${t.label}`))
44
+ /*#__PURE__*/ jsx(ModelTagStrip, {
45
+ labels: labels,
46
+ tagVariants: tagVariants,
47
+ tags: inlineTags
48
+ })
51
49
  ]
52
50
  }),
53
51
  techId && /*#__PURE__*/ jsx("span", {
@@ -0,0 +1,96 @@
1
+ "use strict";
2
+ "use client";
3
+ var __webpack_require__ = {};
4
+ (()=>{
5
+ __webpack_require__.d = (exports1, definition)=>{
6
+ for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
7
+ enumerable: true,
8
+ get: definition[key]
9
+ });
10
+ };
11
+ })();
12
+ (()=>{
13
+ __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
14
+ })();
15
+ (()=>{
16
+ __webpack_require__.r = (exports1)=>{
17
+ if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
18
+ value: 'Module'
19
+ });
20
+ Object.defineProperty(exports1, '__esModule', {
21
+ value: true
22
+ });
23
+ };
24
+ })();
25
+ var __webpack_exports__ = {};
26
+ __webpack_require__.r(__webpack_exports__);
27
+ __webpack_require__.d(__webpack_exports__, {
28
+ ModelTagStrip: ()=>ModelTagStrip
29
+ });
30
+ const jsx_runtime_namespaceObject = require("react/jsx-runtime");
31
+ const external_use_visible_count_cjs_namespaceObject = require("../../use-visible-count.cjs");
32
+ const index_cjs_namespaceObject = require("../../../../lib/index.cjs");
33
+ const external_ModelTagChip_cjs_namespaceObject = require("../ModelTagChip.cjs");
34
+ const CHIP_GAP = 6;
35
+ const SEVERITY_RANK = {
36
+ 'error-mini': 0,
37
+ 'warning-mini': 1
38
+ };
39
+ const OTHER_RANK = 2;
40
+ const tagKey = (t)=>`${t.kind}-${t.label}`;
41
+ const ModelTagStrip = ({ tags, labels, tagVariants, disableTooltip })=>{
42
+ const rank = (t)=>SEVERITY_RANK[(0, external_ModelTagChip_cjs_namespaceObject.tagVariantToken)(t, tagVariants)] ?? OTHER_RANK;
43
+ const ordered = [
44
+ ...tags
45
+ ].sort((a, b)=>rank(a) - rank(b));
46
+ const { containerRef, itemRefs, overflowRef, visibleCount } = (0, external_use_visible_count_cjs_namespaceObject.useVisibleCount)(ordered.length > 0, ordered.map(tagKey), CHIP_GAP, 0);
47
+ if (0 === ordered.length) return null;
48
+ const hiddenCount = ordered.length - visibleCount;
49
+ const hiddenLabels = ordered.slice(visibleCount).map((t)=>t.label);
50
+ return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("span", {
51
+ className: "relative grid flex-1 basis-0 grid-cols-[minmax(0,max-content)_auto] items-center justify-start",
52
+ "data-slot": "model-picker-tags",
53
+ ref: containerRef,
54
+ children: [
55
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
56
+ className: "relative flex min-w-0 items-center gap-1.5 overflow-hidden",
57
+ children: ordered.map((t, i)=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
58
+ className: (0, index_cjs_namespaceObject.cn)('flex shrink-0 items-center whitespace-nowrap', i >= visibleCount && 'pointer-events-none absolute opacity-0'),
59
+ ref: (el)=>{
60
+ itemRefs.current[i] = el;
61
+ },
62
+ children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_ModelTagChip_cjs_namespaceObject.ModelTagChip, {
63
+ disableTooltip: disableTooltip,
64
+ tag: t,
65
+ variants: tagVariants
66
+ })
67
+ }, tagKey(t)))
68
+ }),
69
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
70
+ "aria-hidden": true,
71
+ className: (0, index_cjs_namespaceObject.cn)('ml-1.5 grid whitespace-nowrap', 0 === hiddenCount && 'absolute opacity-0'),
72
+ "data-overflow": "",
73
+ ref: overflowRef,
74
+ children: ordered.map((t, i)=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
75
+ className: (0, index_cjs_namespaceObject.cn)('col-start-1 row-start-1 flex items-center', i + 1 !== hiddenCount && 'invisible'),
76
+ children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_ModelTagChip_cjs_namespaceObject.ModelTagChip, {
77
+ disableTooltip: disableTooltip,
78
+ tag: {
79
+ kind: 'overflow',
80
+ label: labels.hiddenTagCount(i + 1),
81
+ tooltip: i + 1 === hiddenCount ? labels.hiddenTagCountTooltip(hiddenLabels) : void 0,
82
+ variant: 'mini'
83
+ }
84
+ })
85
+ }, tagKey(t)))
86
+ })
87
+ ]
88
+ });
89
+ };
90
+ exports.ModelTagStrip = __webpack_exports__.ModelTagStrip;
91
+ for(var __rspack_i in __webpack_exports__)if (-1 === [
92
+ "ModelTagStrip"
93
+ ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
94
+ Object.defineProperty(exports, '__esModule', {
95
+ value: true
96
+ });
@@ -0,0 +1,10 @@
1
+ import type * as React from 'react';
2
+ import type { ModelPickerLabels } from '../labels';
3
+ import type { ModelTag } from '../types';
4
+ export interface ModelTagStripProps {
5
+ tags: readonly ModelTag[];
6
+ labels: ModelPickerLabels;
7
+ tagVariants?: Record<string, string>;
8
+ disableTooltip?: boolean;
9
+ }
10
+ export declare const ModelTagStrip: React.FC<ModelTagStripProps>;