@epam/ai-dial-ui-kit 0.13.0-dev.42 → 0.13.0-dev.44

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.
@@ -74,13 +74,24 @@ var ENTITY_KINDS = [
74
74
  "theming"
75
75
  ];
76
76
  var ENTITY_HINT = ENTITY_KINDS.join(" | ");
77
+ function cell(value) {
78
+ return value.replace(/\s*\n\s*/g, " ").replace(/\\/g, "\\\\").replace(/\|/g, "\\|").trim();
79
+ }
80
+ var GENERATION_GUIDANCE = "Components come in two generations. Generation 2.0 is the current design system \u2014 prefer it. Reach for a 1.0 component only when it has no 2.0 equivalent (no `supersededBy` on the entry).";
77
81
  function formatComponent(comp) {
78
82
  const lines = [
79
83
  `# ${comp.name}`,
80
84
  `**Category:** ${comp.category}`,
85
+ `**Generation:** ${comp.generation}`,
81
86
  `**Source:** \`${comp.sourceFile}\``,
82
87
  ""
83
88
  ];
89
+ if (comp.supersededBy) {
90
+ lines.push(
91
+ `> \u26A0\uFE0F **Generation 1.0 \u2014 superseded by \`${comp.supersededBy}\`.** Use \`${comp.supersededBy}\` for new code and prefer it when touching existing code; see getEntityDetails(entity: "component", name: "${comp.supersededBy}"). Only stay on \`${comp.name}\` if the 2.0 replacement is missing something you need.`,
92
+ ""
93
+ );
94
+ }
84
95
  if (comp.description) lines.push(comp.description, "");
85
96
  if (comp.lazy) {
86
97
  lines.push("## Lazy Loading", "");
@@ -171,6 +182,7 @@ function collectTypeRefs(comp) {
171
182
  }
172
183
  return [...refs].sort();
173
184
  }
185
+ var GENERATION_2_0_BONUS = 30;
174
186
  function searchComponents(query) {
175
187
  if (!query.trim()) return manifest.components.slice(0, 20);
176
188
  const q = query.toLowerCase();
@@ -184,6 +196,7 @@ function searchComponents(query) {
184
196
  else if (name.includes(q)) score = 60;
185
197
  if (desc.includes(q)) score += 20;
186
198
  if (cat.includes(q)) score += 10;
199
+ if (score > 0 && c.generation === "2.0") score += GENERATION_2_0_BONUS;
187
200
  return { c, score };
188
201
  }).filter((s) => s.score > 0).sort((a, b) => b.score - a.score).map((s) => s.c);
189
202
  }
@@ -223,7 +236,7 @@ server.setRequestHandler(import_types.ListToolsRequestSchema, async () => ({
223
236
  tools: [
224
237
  {
225
238
  name: "searchEntity",
226
- description: 'Search for UI kit entities (components, hooks, utils, types, constants) by name or description. Returns a summary list of matches. For typography and theming, returns the full reference content regardless of query.\n\nExamples:\n searchEntity("component", "button") \u2192 lists Button-related components\n searchEntity("hook", "click") \u2192 lists hooks with "click" in name/description\n searchEntity("typography") \u2192 returns full typography CSS class reference',
239
+ description: 'Search for UI kit entities (components, hooks, utils, types, constants) by name or description. Returns a summary list of matches. For typography and theming, returns the full reference content regardless of query.\n\nComponents come in two generations and results are ranked 2.0 first. Generation 2.0 is the current design system (exported without the `Dial` prefix \u2014 `Button`, `Input`, `Select`); generation 1.0 is the legacy set (`Dial*`). Default to the 2.0 component. A 1.0 result carries "Use instead" when a 2.0 replacement exists \u2014 pick that replacement. Only use a 1.0 component when it has no replacement listed.\n\nExamples:\n searchEntity("component", "button") \u2192 Button (2.0) ranked above DialButton (1.0)\n searchEntity("hook", "click") \u2192 lists hooks with "click" in name/description\n searchEntity("typography") \u2192 returns full typography CSS class reference',
227
240
  inputSchema: {
228
241
  type: "object",
229
242
  properties: {
@@ -243,7 +256,7 @@ server.setRequestHandler(import_types.ListToolsRequestSchema, async () => ({
243
256
  },
244
257
  {
245
258
  name: "getEntityDetails",
246
- description: 'Get full documentation for a specific UI kit entity by exact name \u2014 props table, examples, signatures, type members, etc. For typography and theming, returns the full reference content (name not required).\n\nExamples:\n getEntityDetails("component", "DialButton") \u2192 full props + examples\n getEntityDetails("type", "ButtonSize") \u2192 enum values\n getEntityDetails("hook", "useClickOutside") \u2192 signature + description\n getEntityDetails("theming") \u2192 full CSS variable and token reference',
259
+ description: 'Get full documentation for a specific UI kit entity by exact name \u2014 props table, examples, signatures, type members, etc. For typography and theming, returns the full reference content (name not required).\n\nA component response states its generation. If it reports being superseded by a 2.0 component, look that one up instead of using the 1.0 entry.\n\nExamples:\n getEntityDetails("component", "Button") \u2192 full props + examples for the 2.0 button\n getEntityDetails("component", "DialButton") \u2192 1.0 button, flagged as superseded by `Button`\n getEntityDetails("type", "ButtonSize") \u2192 enum values\n getEntityDetails("hook", "useClickOutside") \u2192 signature + description\n getEntityDetails("theming") \u2192 full CSS variable and token reference',
247
260
  inputSchema: {
248
261
  type: "object",
249
262
  properties: {
@@ -310,7 +323,7 @@ server.setRequestHandler(import_types.CallToolRequestSchema, async (request) =>
310
323
  ]
311
324
  };
312
325
  }
313
- const header2 = query ? `Found ${results2.length} component(s) matching "${query}":` : `First ${results2.length} components (pass a query to filter):`;
326
+ const header2 = query ? `Found ${results2.length} component(s) matching "${query}", best match first:` : `First ${results2.length} components, generation 2.0 first (pass a query to filter):`;
314
327
  return {
315
328
  content: [
316
329
  {
@@ -318,10 +331,12 @@ server.setRequestHandler(import_types.CallToolRequestSchema, async (request) =>
318
331
  text: [
319
332
  header2,
320
333
  "",
321
- "| Name | Category | Description |",
322
- "|------|----------|-------------|",
334
+ GENERATION_GUIDANCE,
335
+ "",
336
+ "| Name | Gen | Use instead | Category | Description |",
337
+ "|------|-----|-------------|----------|-------------|",
323
338
  ...results2.map(
324
- (c) => `| \`${c.name}\` | ${c.category} | ${c.description} |`
339
+ (c) => `| \`${c.name}\` | ${c.generation} | ${c.supersededBy ? `\`${c.supersededBy}\`` : "\u2014"} | ${cell(c.category)} | ${cell(c.description)} |`
325
340
  ),
326
341
  "",
327
342
  'Use getEntityDetails(entity: "component", name: "...") for full props and examples.'
@@ -353,7 +368,7 @@ server.setRequestHandler(import_types.CallToolRequestSchema, async (request) =>
353
368
  "| Name | Kind | Description |",
354
369
  "|------|------|-------------|",
355
370
  ...results2.map(
356
- (t) => `| \`${t.name}\` | ${t.kind} | ${t.description ?? ""} |`
371
+ (t) => `| \`${t.name}\` | ${t.kind} | ${cell(t.description ?? "")} |`
357
372
  ),
358
373
  "",
359
374
  'Use getEntityDetails(entity: "type", name: "...") for members and values.'
@@ -384,7 +399,9 @@ server.setRequestHandler(import_types.CallToolRequestSchema, async (request) =>
384
399
  "",
385
400
  "| Name | Description |",
386
401
  "|------|-------------|",
387
- ...results.map((e) => `| \`${e.name}\` | ${e.description ?? ""} |`),
402
+ ...results.map(
403
+ (e) => `| \`${e.name}\` | ${cell(e.description ?? "")} |`
404
+ ),
388
405
  "",
389
406
  `Use getEntityDetails(entity: "${entity}", name: "...") for full signature.`
390
407
  ].join("\n")
@@ -406,8 +423,11 @@ server.setRequestHandler(import_types.CallToolRequestSchema, async (request) =>
406
423
  if (entity === "component") {
407
424
  const comp = manifest.components.find((c) => c.name === entityName);
408
425
  if (!comp) {
426
+ const alt = manifest.components.find(
427
+ (c) => c.name === `Dial${entityName}` || c.name === entityName.replace(/^Dial/, "")
428
+ );
409
429
  throw new Error(
410
- `Component "${entityName}" not found. Use searchEntity(entity: "component") to browse available components.`
430
+ `Component "${entityName}" not found.${alt ? ` Did you mean "${alt.name}" (generation ${alt.generation})?` : ""} Use searchEntity(entity: "component") to browse available components.`
411
431
  );
412
432
  }
413
433
  return { content: [{ type: "text", text: formatComponent(comp) }] };
@@ -1,5 +1,6 @@
1
1
  export declare const dropdownBaseClassName: string;
2
2
  export declare const dropdownListBaseClassName: string;
3
+ export declare const dropdownSubMenuClassName: string;
3
4
  export declare const dropdownItemBaseClassName: string;
4
5
  export declare const dropdownItemDisabledClassName: string;
5
6
  export declare const dropdownItemDangerClassName = "text-error";
@@ -15,6 +15,9 @@ export declare const selectListWidthClassName = "!max-w-[var(--reference-width)]
15
15
  export declare const selectOptionDisabledClassName = "opacity-75";
16
16
  export declare const dropdownMenuMaxHeight = 352;
17
17
  export declare const selectSubMenuGap = 4;
18
+ export declare const selectSubMenuClassName: string;
19
+ /** Marks an option that opens a nested list. Matches the dropdown's caret. */
20
+ export declare const selectSubMenuCaretIcon: import("react/jsx-runtime").JSX.Element;
18
21
  /** Classes for the chevron rendered as the field's trailing icon. */
19
22
  export declare const selectFieldIconClassName = "text-secondary transition-transform";
20
23
  /**
@@ -5,6 +5,13 @@
5
5
  */
6
6
  /** The floating panel itself: rounded raised card with a one-unit inset. */
7
7
  export declare const overlaySurfaceClassName = "rounded-xl bg-layer-raised p-1 shadow-md";
8
+ /**
9
+ * A nested panel opened from a row of the surface above it. It is the same
10
+ * object as its parent panel, so it reads from `overlaySurfaceClassName` too —
11
+ * only the width behaviour differs, since a submenu is sized by its own content
12
+ * rather than by the trigger further up.
13
+ */
14
+ export declare const overlaySubMenuClassName: string;
8
15
  /**
9
16
  * A selectable row inside the panel. Keeps a visible focus ring: these rows are
10
17
  * reached by keyboard, and the 1.0 versions suppressed the ring outright.
@@ -11,9 +11,21 @@ export interface LazyComponentEntry {
11
11
  ssr: false;
12
12
  nextDynamicExample: string;
13
13
  }
14
+ /**
15
+ * Component generation. `2.0` components live under `src/components/New/` and
16
+ * are exported without the `Dial` prefix; everything else is `1.0`.
17
+ */
18
+ export type ComponentGeneration = '1.0' | '2.0';
14
19
  export interface ComponentEntry {
15
20
  name: string;
16
21
  category: string;
22
+ /** `2.0` components are the current design system and should be preferred. */
23
+ generation: ComponentGeneration;
24
+ /**
25
+ * Present on `1.0` components that have a `2.0` replacement — the name of
26
+ * that replacement (e.g. `DialButton` → `Button`).
27
+ */
28
+ supersededBy?: string;
17
29
  description: string;
18
30
  props: PropEntry[];
19
31
  examples: string[];
@@ -39,6 +39,12 @@ interface SubMenuPanelProps {
39
39
  context: ReturnType<typeof useSubMenuFloating>['context'];
40
40
  getFloatingProps: ReturnType<typeof useSubMenuFloating>['getFloatingProps'];
41
41
  role: 'menu' | 'listbox';
42
+ /**
43
+ * Replaces the surface tokens — radius, background, shadow, inset. The 2.0
44
+ * menus pass their own overlay surface so a submenu is the same object as the
45
+ * panel that opened it; the 1.0 menus keep the default.
46
+ */
47
+ surfaceClassName?: string;
42
48
  /** Extra classes appended to the default floating container classes. */
43
49
  className?: string;
44
50
  children: ReactNode;
@@ -47,5 +53,5 @@ interface SubMenuPanelProps {
47
53
  * Shared floating panel wrapper (FloatingPortal → FloatingFocusManager → container div).
48
54
  * Used by DropdownSubMenuItem and SelectSubMenuItem.
49
55
  */
50
- export declare const SubMenuPanel: ({ refs, floatingStyles, context, getFloatingProps, role, className, children, }: SubMenuPanelProps) => import("react/jsx-runtime").JSX.Element;
56
+ export declare const SubMenuPanel: ({ refs, floatingStyles, context, getFloatingProps, role, surfaceClassName, className, children, }: SubMenuPanelProps) => import("react/jsx-runtime").JSX.Element;
51
57
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@epam/ai-dial-ui-kit",
3
- "version": "0.13.0-dev.42",
3
+ "version": "0.13.0-dev.44",
4
4
  "type": "module",
5
5
  "license": "Apache-2.0",
6
6
  "description": "A modern UI kit for building AI DIAL interfaces with React",