@epam/ai-dial-ui-kit 0.15.0-dev.51 → 0.15.0-dev.52

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.
package/dist/CHANGELOG.md CHANGED
@@ -21,6 +21,10 @@ Versions match the git tags on the `development` branch.
21
21
 
22
22
  - **`InteractiveTooltip` (2.0) — `trigger`, to open the panel by click or tap** — the panel opens on hover or focus and renders nothing on a mobile screen, so a trigger whose only job is to reveal it, such as an info chip, showed nothing on a phone ([ai-dial-chat#9250](https://github.com/epam/ai-dial-chat/issues/9250)). `trigger={InteractiveTooltipTrigger.Click}` opens the panel on a click or tap and keeps it open until a second click on the trigger, a press outside or Escape. It works on every screen size and ignores hover and focus; with a controlled `open` it still reports through `onOpenChange`. The default, `InteractiveTooltipTrigger.Hover`, changes nothing, so the `InteractiveTooltip`s inside `Select` and `Dropdown` and every host that does not pass it are unchanged. Do not use `Click` on a trigger that has its own action, since the same tap would run both. Additive.
23
23
 
24
+ - **`AutocompleteTagInput` (2.0) — `openOnFocus`** — focusing or clicking the input opens the list of every suggestion that is not yet a tag, uncapped by `maxSuggestions`, so a short list can be browsed without typing. Nothing is highlighted in that list, so Enter adds nothing the user did not choose; ArrowDown lands on the first suggestion and ArrowUp on the last. The list stays open after a pick, and typing filters and caps it as before. Opt-in; without it nothing changes. Additive.
25
+
26
+ - **`Slider` (2.0) — `showValueInput`, `valueInputAriaLabel`** — a compact, 24px `NumberInput` after the track, so the slider stays as tall as its track row, synced with the slider: typing reports the value snapped to `step` (the field already refuses values outside `min`/`max`), the text being typed is kept until the field loses focus, and it is disabled with the slider. Named by `valueInputAriaLabel`, or by a string `labelProps.label`. Takes the place of `rightContent`, which a caller no longer needs to wire by hand for this case. Additive.
27
+
24
28
  - **`Slider` (2.0) — `showTooltip`, `showTicks`, `leftContent`, `rightContent`** — the rest of the new slider design. `showTooltip` shows the formatted value in a bubble above the thumb; `showTicks` marks every step on the unfilled track for a discrete slider. Both are hidden while disabled. The bubble is `aria-hidden`, because the input already announces the value through `aria-valuetext`. `leftContent` and `rightContent` are the slider container's side slots, centred on the track: an icon on the left, a `NumberInput` or the value as text on the right. The kit does not sync a `NumberInput` placed there; the caller passes it the same `value` and setter. All four are opt-in.
25
29
 
26
30
  - **`SchemaRenderer` (2.0)** — a JSON Schema form built only from 2.0 controls. `DialSchemaRenderer` exists only in 1.0, so a 2.0 screen that renders a schema-driven form had to mix in 1.0 inputs, selects and the 1.0 `Dropdown` surface. The 2.0 renderer keeps the 1.0 props, except `jsonEditorTheme`: the three variants, `oneOf`/`anyOf` with select or radio selectors, arrays with discriminator types, key-value maps, `dial:resource` options, `skipUntouched`, `renderField` and `texts`. Primitives render as `Input`, `NumberInput`, `PasswordInput`, `Select`, `Switch` or `RadioGroup`. Values the schema does not describe are edited as JSON in a monospace `Textarea`, not in Monaco, so the form loads no editor bundle. Section headers are real toggle buttons with `aria-expanded`, and the remove and info buttons sit next to the toggle instead of inside it. Every control has an accessible name, including array items and key-value rows. `renderField` replaces only the control, so the field keeps its label and error. Stamps `DIAL_KIT_CLASS.schemaRenderer` (`dial-kit-schema-renderer`) on the root and `DIAL_KIT_CLASS.schemaRendererSection` (`dial-kit-schema-renderer-section`) on each section card. The schema types, enums and utils are shared with 1.0 from neutral modules; the 1.0 import paths still work. Additive.
@@ -69,6 +73,8 @@ Versions match the git tags on the `development` branch.
69
73
 
70
74
  ### Changed
71
75
 
76
+ - **`Slider` (2.0) — ticks** — ticks are drawn in the `Controls/Stroke/Accent-focus` token (`--stroke-accent-focus`, was the neutral control grey), and there is one per step after `min`: a 0–1 slider at 0.1 now draws exactly 10. The tick at `min` was always under the thumb or the fill, so nothing visible is lost. Visual only; no props change.
77
+
72
78
  - **`StarterButton` (2.0) — a sparkles icon by default** — the design puts a sparkles glyph before every starter label, so each host was passing the same `iconBefore`. `iconBefore` now defaults to a 20px `IconSparkles` at the 1.5 stroke, `aria-hidden`, and stroked with the starter gradient like any other icon. A caller-supplied `iconBefore` replaces it; `iconBefore={null}` keeps a label-only pill. A `StarterButton` that passed no `iconBefore` now draws the icon; no other API changes.
73
79
 
74
80
  - **`Select` (2.0) — multi-select tags are 24px, and the field wraps them with an 8px gap** — the tags in a multi-select field used the 32px pill of `Tag`, taller than the design's field chip. They are now 24px with a `rounded-md` shape, a `layer-sunken` fill and a `stroke-secondary` rim, and the wrapped field pads 8px vertically with 8px between tags, so one row of tags still fills the 40px field. `Tag` itself is unchanged. Visual only; no API changes.
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("react/jsx-runtime"),u=require("./editor-BH6_A1k2.cjs"),d=require("@monaco-editor/react");function f(e){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const a=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(o,t,a.get?a:{enumerable:!0,get:()=>e[t]})}}return o.default=e,Object.freeze(o)}const m=f(d),b=({value:e,onChange:o,onValidateJSON:t,options:a,currentTheme:n,themesConfig:i=u.EDITOR_THEMES_CONFIG})=>{function s(r){r?.editor?.defineTheme(n,i[n]),r.languages.json.jsonDefaults.setDiagnosticsOptions({validate:!0,enableSchemaRequest:!1,schemas:[{uri:"http://custom-schema/object-required.json",fileMatch:["*"],schema:{type:"object",description:"Top-level value must be an object",additionalProperties:!0}}]})}const{Editor:l}=m;return c.jsx(l,{beforeMount:s,height:"100%",defaultLanguage:"json",value:e,onChange:o,theme:n,onValidate:t,options:{minimap:{enabled:!1},formatOnType:!0,formatOnPaste:!0,selectOnLineNumbers:!1,automaticLayout:!0,scrollBeyondLastLine:!1,wordWrap:"on",smoothScrolling:!0,overviewRulerLanes:0,scrollbar:{horizontal:"hidden",verticalScrollbarSize:4,verticalSliderSize:4},...a??{}}})};exports.DialJsonEditor=b;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),b=require("react"),O=require("@uiw/react-md-editor"),_=require("./lazy-_W6FYhKg.cjs"),k=require("./merge-classes-BEJXjzkx.cjs"),o=require("@tabler/icons-react"),p=require("./icon-DhjrDQ8I.cjs"),f=require("./icon-CrGVkVpG.cjs");function E(n){const i=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const r in n)if(r!=="default"){const c=Object.getOwnPropertyDescriptor(n,r);Object.defineProperty(i,r,c.get?c:{enumerable:!0,get:()=>n[r]})}}return i.default=n,Object.freeze(i)}const h=E(O),L=f.DIAL_ICON_SIZE.SM,t={size:L,stroke:p.DIAL_KIT_ICON_STROKE},s=(n,i)=>({...n,icon:i}),M=()=>{const{bold:n,code:i,divider:r,group:c,heading1:a,heading2:d,heading3:u,italic:l,link:m,orderedListCommand:I,quote:g,strikethrough:x,table:j,unorderedListCommand:C}=h;return[s(n,e.jsx(o.IconBold,{...t})),s(l,e.jsx(o.IconItalic,{...t})),s(x,e.jsx(o.IconStrikethrough,{...t})),r,c([a,d,u],{name:"heading",groupName:"heading",icon:e.jsx(o.IconTextSize,{...t}),buttonProps:{"aria-label":"Text style",title:"Text style"}}),r,s(C,e.jsx(o.IconList,{...t})),s(I,e.jsx(o.IconListNumbers,{...t})),r,s(g,e.jsx(o.IconQuote,{...t})),s(m,e.jsx(o.IconLink,{...t})),s(i,e.jsx(o.IconCode,{...t})),r,s(j,e.jsx(o.IconTable,{...t}))]},S=()=>{const{codeEdit:n,codeLive:i,codePreview:r,divider:c,fullscreen:a}=h;return[s(n,e.jsx(o.IconPencil,{...t})),s(i,e.jsx(o.IconLayoutColumns,{...t})),s(r,e.jsx(o.IconEye,{...t})),c,s(a,e.jsx(o.IconMaximize,{...t}))]},T=({value:n,onChange:i,height:r=300,theme:c=_.EditorThemes.light,className:a,placeholder:d,defaultPreview:u="edit",id:l,ariaLabel:m,showDragbar:I=!0})=>{const g=b.useMemo(()=>M(),[]),x=b.useMemo(()=>S(),[]);return e.jsx("div",{"data-color-mode":c,className:k.mergeClasses("dial-kit-markdown-editor",a),children:e.jsx(O,{value:n,onChange:j=>i?.(j||""),height:r,preview:u,visibleDragbar:I,commands:g,extraCommands:x,textareaProps:{placeholder:d,id:l,"aria-label":m}})})};exports.MarkdownEditor=T;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),b=require("react"),O=require("@uiw/react-md-editor"),_=require("./lazy-DMVYJhUR.cjs"),k=require("./merge-classes-BEJXjzkx.cjs"),o=require("@tabler/icons-react"),p=require("./icon-DhjrDQ8I.cjs"),f=require("./icon-CrGVkVpG.cjs");function E(n){const i=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const r in n)if(r!=="default"){const c=Object.getOwnPropertyDescriptor(n,r);Object.defineProperty(i,r,c.get?c:{enumerable:!0,get:()=>n[r]})}}return i.default=n,Object.freeze(i)}const h=E(O),L=f.DIAL_ICON_SIZE.SM,t={size:L,stroke:p.DIAL_KIT_ICON_STROKE},s=(n,i)=>({...n,icon:i}),M=()=>{const{bold:n,code:i,divider:r,group:c,heading1:a,heading2:d,heading3:u,italic:l,link:m,orderedListCommand:I,quote:g,strikethrough:x,table:j,unorderedListCommand:C}=h;return[s(n,e.jsx(o.IconBold,{...t})),s(l,e.jsx(o.IconItalic,{...t})),s(x,e.jsx(o.IconStrikethrough,{...t})),r,c([a,d,u],{name:"heading",groupName:"heading",icon:e.jsx(o.IconTextSize,{...t}),buttonProps:{"aria-label":"Text style",title:"Text style"}}),r,s(C,e.jsx(o.IconList,{...t})),s(I,e.jsx(o.IconListNumbers,{...t})),r,s(g,e.jsx(o.IconQuote,{...t})),s(m,e.jsx(o.IconLink,{...t})),s(i,e.jsx(o.IconCode,{...t})),r,s(j,e.jsx(o.IconTable,{...t}))]},S=()=>{const{codeEdit:n,codeLive:i,codePreview:r,divider:c,fullscreen:a}=h;return[s(n,e.jsx(o.IconPencil,{...t})),s(i,e.jsx(o.IconLayoutColumns,{...t})),s(r,e.jsx(o.IconEye,{...t})),c,s(a,e.jsx(o.IconMaximize,{...t}))]},T=({value:n,onChange:i,height:r=300,theme:c=_.EditorThemes.light,className:a,placeholder:d,defaultPreview:u="edit",id:l,ariaLabel:m,showDragbar:I=!0})=>{const g=b.useMemo(()=>M(),[]),x=b.useMemo(()=>S(),[]);return e.jsx("div",{"data-color-mode":c,className:k.mergeClasses("dial-kit-markdown-editor",a),children:e.jsx(O,{value:n,onChange:j=>i?.(j||""),height:r,preview:u,visibleDragbar:I,commands:g,extraCommands:x,textareaProps:{placeholder:d,id:l,"aria-label":m}})})};exports.MarkdownEditor=T;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),m=require("@uiw/react-md-editor"),u=require("./lazy-_W6FYhKg.cjs"),x=require("./merge-classes-BEJXjzkx.cjs"),g=({value:r,onChange:s,height:o=300,preview:i="edit",theme:a=u.EditorThemes.dark,className:n,placeholder:t,showDragbar:d=!0})=>{const l=t!==void 0&&!r;return e.jsxs("div",{"data-color-mode":a,className:x.mergeClasses("relative",n),children:[e.jsx(m,{value:r,onChange:c=>s?.(c||""),height:o,preview:i,visibleDragbar:d}),l&&e.jsx("div",{className:"pointer-events-none absolute left-0 top-8 px-2 dial-small-text text-secondary opacity-40",children:t})]})};exports.DialMarkdownEditor=g;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),m=require("@uiw/react-md-editor"),u=require("./lazy-DMVYJhUR.cjs"),x=require("./merge-classes-BEJXjzkx.cjs"),g=({value:r,onChange:s,height:o=300,preview:i="edit",theme:a=u.EditorThemes.dark,className:n,placeholder:t,showDragbar:d=!0})=>{const l=t!==void 0&&!r;return e.jsxs("div",{"data-color-mode":a,className:x.mergeClasses("relative",n),children:[e.jsx(m,{value:r,onChange:c=>s?.(c||""),height:o,preview:i,visibleDragbar:d}),l&&e.jsx("div",{className:"pointer-events-none absolute left-0 top-8 px-2 dial-small-text text-secondary opacity-40",children:t})]})};exports.DialMarkdownEditor=g;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),n=require("react");require("./editor-BH6_A1k2.cjs");const N=require("./lazy-DMVYJhUR.cjs");require("@monaco-editor/react");const m=require("./Switch-DE6MrcqJ.cjs"),b=require("./MarkdownEditor-Dav_pp0T.cjs"),g=({value:o,onChangeValue:l,label:i,headerContent:a,switcherLabel:d,height:c=300,theme:u=N.EditorThemes.dark,onValidateJSON:x,preview:j="edit",showDragbar:w=!0})=>{const C=n.useId(),[t,p]=n.useState(!1),[f,S]=n.useState(null);n.useEffect(()=>{t&&typeof window<"u"&&Promise.resolve().then(()=>require("./JsonEditor-eAV7SaKu.cjs")).then(s=>{S(()=>s.DialJsonEditor)})},[t]);const h=n.useCallback(s=>{l?.(s)},[l]),E=n.useCallback(s=>{x?.(s)},[x]),r=!!d;return e.jsx("div",{className:"size-full flex flex-col",children:e.jsx("div",{className:"flex flex-col gap-8",children:e.jsxs("div",{children:[(i||a||r)&&e.jsxs("div",{className:"flex justify-between items-center mb-2",children:[i&&e.jsx(m.DialLabel,{label:i}),e.jsxs("div",{className:"flex items-center gap-2 flex-1 justify-end",children:[a,r&&e.jsx("label",{className:"flex items-center gap-2 cursor-pointer",children:e.jsx(m.DialSwitch,{isOn:t,label:d,switchId:C,onChange:s=>p(s)})})]})]}),r&&t?e.jsx("div",{className:"border border-primary rounded",style:{height:`${c}px`},children:f&&e.jsx(f,{value:o,onChange:h,onValidateJSON:E,currentTheme:u})}):e.jsx(b.DialMarkdownEditor,{value:o,onChange:h,height:c,preview:j,showDragbar:w,theme:u})]})})})};exports.DialMarkdownEditorContainer=g;
@@ -1,27 +1,29 @@
1
1
  import { jsx as e, jsxs as r } from "react/jsx-runtime";
2
2
  import { useId as J, useState as u, useEffect as S, useCallback as x } from "react";
3
- import { DialSwitch as b } from "../Switch/Switch.js";
4
- import { EditorThemes as v } from "../../types/editor.js";
3
+ import "../../constants/editor.js";
4
+ import { EditorThemes as b } from "../../types/editor.js";
5
+ import "@monaco-editor/react";
6
+ import { DialSwitch as v } from "../Switch/Switch.js";
5
7
  import { DialMarkdownEditor as y } from "./MarkdownEditor.js";
6
8
  import { DialLabel as j } from "../Label/Label.js";
7
- const B = ({
9
+ const q = ({
8
10
  value: s,
9
11
  onChangeValue: l,
10
- label: t,
12
+ label: i,
11
13
  headerContent: d,
12
14
  switcherLabel: a,
13
15
  height: c = 300,
14
- theme: m = v.dark,
16
+ theme: m = b.dark,
15
17
  onValidateJSON: f,
16
18
  preview: C = "edit",
17
19
  showDragbar: N = !0
18
20
  }) => {
19
- const w = J(), [n, D] = u(!1), [p, E] = u(null);
21
+ const w = J(), [t, D] = u(!1), [p, E] = u(null);
20
22
  S(() => {
21
- n && typeof window < "u" && import("../JsonEditor/JsonEditor.js").then((o) => {
23
+ t && typeof window < "u" && import("../JsonEditor/JsonEditor.js").then((o) => {
22
24
  E(() => o.DialJsonEditor);
23
25
  });
24
- }, [n]);
26
+ }, [t]);
25
27
  const h = x(
26
28
  (o) => {
27
29
  l?.(o);
@@ -32,16 +34,16 @@ const B = ({
32
34
  f?.(o);
33
35
  },
34
36
  [f]
35
- ), i = !!a;
37
+ ), n = !!a;
36
38
  return /* @__PURE__ */ e("div", { className: "size-full flex flex-col", children: /* @__PURE__ */ e("div", { className: "flex flex-col gap-8", children: /* @__PURE__ */ r("div", { children: [
37
- (t || d || i) && /* @__PURE__ */ r("div", { className: "flex justify-between items-center mb-2", children: [
38
- t && /* @__PURE__ */ e(j, { label: t }),
39
+ (i || d || n) && /* @__PURE__ */ r("div", { className: "flex justify-between items-center mb-2", children: [
40
+ i && /* @__PURE__ */ e(j, { label: i }),
39
41
  /* @__PURE__ */ r("div", { className: "flex items-center gap-2 flex-1 justify-end", children: [
40
42
  d,
41
- i && /* @__PURE__ */ e("label", { className: "flex items-center gap-2 cursor-pointer", children: /* @__PURE__ */ e(
42
- b,
43
+ n && /* @__PURE__ */ e("label", { className: "flex items-center gap-2 cursor-pointer", children: /* @__PURE__ */ e(
44
+ v,
43
45
  {
44
- isOn: n,
46
+ isOn: t,
45
47
  label: a,
46
48
  switchId: w,
47
49
  onChange: (o) => D(o)
@@ -49,7 +51,7 @@ const B = ({
49
51
  ) })
50
52
  ] })
51
53
  ] }),
52
- i && n ? /* @__PURE__ */ e(
54
+ n && t ? /* @__PURE__ */ e(
53
55
  "div",
54
56
  {
55
57
  className: "border border-primary rounded",
@@ -78,5 +80,5 @@ const B = ({
78
80
  ] }) }) });
79
81
  };
80
82
  export {
81
- B as DialMarkdownEditorContainer
83
+ q as DialMarkdownEditorContainer
82
84
  };
@@ -1,159 +1,166 @@
1
- import { jsxs as le, Fragment as se, jsx as l } from "react/jsx-runtime";
2
- import { useFloating as ne, autoUpdate as ie, offset as ce, flip as me, size as pe, FloatingPortal as de } from "@floating-ui/react";
3
- import { useId as fe, useState as f, useMemo as ue, useCallback as he } from "react";
4
- import { Input as ge } from "../Input/Input.js";
5
- import { MenuItem as we } from "../MenuItem/MenuItem.js";
6
- import { selectTagClassName as ve } from "../Select/MultiSelectTags.js";
7
- import { Tag as Ie } from "../Tag/Tag.js";
8
- import { useThemeScope as xe } from "../ThemeScope/ThemeScope.js";
9
- import { overlayGap as T, overlayListClassName as Te, overlaySurfaceClassName as Se } from "../constants/overlay.js";
10
- import { DIAL_KIT_CLASS as be } from "../../../constants/public-class-names.js";
11
- import { MenuItemMark as ye } from "../../../types/menu-item.js";
12
- import { ElementSize as U } from "../../../types/size.js";
13
- import { mergeClasses as i } from "../../../utils/merge-classes.js";
14
- import { filterAutocompleteSuggestions as De } from "./utils.js";
15
- const Ce = 5, Re = ({
16
- id: z,
17
- value: S,
18
- defaultValue: _,
19
- suggestions: b,
20
- maxSuggestions: y = Ce,
21
- size: D = U.Standard,
22
- labelProps: $,
23
- placeholder: B,
24
- caption: G,
25
- error: K,
26
- invalid: C = !1,
27
- disabled: u = !1,
28
- readOnly: h = !1,
29
- ariaLabel: R,
30
- tagListLabel: M = "Tags",
31
- getRemoveTagLabel: j,
32
- className: H,
33
- fieldClassName: O,
34
- tagClassName: V,
35
- listClassName: P,
36
- onChange: A
1
+ import { jsxs as ce, Fragment as me, jsx as c } from "react/jsx-runtime";
2
+ import { useFloating as pe, autoUpdate as fe, offset as de, flip as ue, size as he, FloatingPortal as ge } from "@floating-ui/react";
3
+ import { useId as we, useState as h, useMemo as ve, useCallback as xe } from "react";
4
+ import { Input as Ie } from "../Input/Input.js";
5
+ import { MenuItem as Te } from "../MenuItem/MenuItem.js";
6
+ import { selectTagClassName as Se } from "../Select/MultiSelectTags.js";
7
+ import { Tag as be } from "../Tag/Tag.js";
8
+ import { useThemeScope as ye } from "../ThemeScope/ThemeScope.js";
9
+ import { overlayGap as y, overlayListClassName as Ce, overlaySurfaceClassName as De } from "../constants/overlay.js";
10
+ import { DIAL_KIT_CLASS as Me } from "../../../constants/public-class-names.js";
11
+ import { MenuItemMark as Ae } from "../../../types/menu-item.js";
12
+ import { ElementSize as F } from "../../../types/size.js";
13
+ import { mergeClasses as f } from "../../../utils/merge-classes.js";
14
+ import { filterAutocompleteSuggestions as Ne } from "./utils.js";
15
+ const ke = 5, Pe = ({
16
+ id: G,
17
+ value: C,
18
+ defaultValue: K,
19
+ suggestions: g,
20
+ maxSuggestions: D = ke,
21
+ openOnFocus: m = !1,
22
+ size: M = F.Standard,
23
+ labelProps: R,
24
+ placeholder: j,
25
+ caption: H,
26
+ error: V,
27
+ invalid: A = !1,
28
+ disabled: w = !1,
29
+ readOnly: v = !1,
30
+ ariaLabel: P,
31
+ tagListLabel: N = "Tags",
32
+ getRemoveTagLabel: X,
33
+ className: q,
34
+ fieldClassName: J,
35
+ tagClassName: Q,
36
+ listClassName: W,
37
+ onChange: k
37
38
  }) => {
38
- const X = fe(), N = z || X, g = `${N}-listbox`, q = xe(), J = D === U.Small, w = S !== void 0, [Q, W] = f(
39
- _ ?? []
40
- ), a = w ? S : Q, c = a.length > 0, m = !h && !u, [s, E] = f(""), [Y, v] = f(!1), [Z, p] = f(0), r = ue(
41
- () => De(
42
- b,
39
+ const Y = we(), E = G || Y, x = `${E}-listbox`, Z = ye(), O = M === F.Small, I = C !== void 0, [ee, te] = h(
40
+ K ?? []
41
+ ), a = I ? C : ee, d = a.length > 0, p = !v && !w, [s, L] = h(""), [oe, u] = h(!1), [ae, l] = h(0), T = !s.trim(), n = ve(
42
+ () => Ne(
43
+ g,
43
44
  s,
44
45
  a,
45
- y
46
+ // The list opened on focus is meant to show every choice.
47
+ m && T ? g.length : D
46
48
  ),
47
- [s, y, b, a]
48
- ), o = Y && m && r.length > 0, d = Math.min(Z, r.length - 1), k = (e) => `${g}-option-${e}`, { refs: F, floatingStyles: ee } = ne({
49
- open: o,
49
+ [s, T, D, m, g, a]
50
+ ), r = oe && p && n.length > 0, i = Math.min(ae, n.length - 1), U = r && i >= 0, z = (e) => `${x}-option-${e}`, { refs: B, floatingStyles: re } = pe({
51
+ open: r,
50
52
  placement: "bottom-start",
51
- whileElementsMounted: ie,
53
+ whileElementsMounted: fe,
52
54
  middleware: [
53
- ce(T),
54
- me({ padding: T }),
55
- pe({
56
- padding: T,
57
- apply({ rects: e, availableHeight: t, elements: n }) {
58
- n.floating.style.width = `${Math.round(e.reference.width)}px`, n.floating.style.maxHeight = `${Math.floor(t)}px`;
55
+ de(y),
56
+ ue({ padding: y }),
57
+ he({
58
+ padding: y,
59
+ apply({ rects: e, availableHeight: t, elements: o }) {
60
+ o.floating.style.width = `${Math.round(e.reference.width)}px`, o.floating.style.maxHeight = `${Math.floor(t)}px`;
59
61
  }
60
62
  })
61
63
  ]
62
- }), I = he(
64
+ }), S = xe(
63
65
  (e) => {
64
- w || W(e), A?.(e);
66
+ I || te(e), k?.(e);
65
67
  },
66
- [w, A]
67
- ), x = () => {
68
- v(!1), p(0);
69
- }, L = (e) => {
68
+ [I, k]
69
+ ), b = () => {
70
+ u(!1), l(0);
71
+ }, _ = () => {
72
+ !m || !p || (u(!0), l(T ? -1 : 0));
73
+ }, $ = (e) => {
70
74
  const t = e.trim();
71
- t && !a.includes(t) && I([...a, t]), E(""), x();
72
- }, te = (e) => I(a.filter((t) => t !== e)), oe = (e) => {
73
- const t = e ?? "";
74
- E(t), v(!!t.trim()), p(0);
75
- }, ae = (e) => {
76
- if (m)
75
+ t && !a.includes(t) && S([...a, t]), L(""), m ? l(-1) : b();
76
+ }, le = (e) => S(a.filter((t) => t !== e)), se = (e) => {
77
+ const t = e ?? "", o = !!t.trim();
78
+ L(t), u(o || m), l(o ? 0 : -1);
79
+ }, ne = (e) => {
80
+ if (p)
77
81
  switch (e.key) {
78
82
  case "ArrowDown":
79
83
  case "ArrowUp": {
80
- if (e.preventDefault(), v(!0), !o) return;
81
- const t = e.key === "ArrowDown" ? 1 : -1;
82
- p(
83
- (d + t + r.length) % r.length
84
- );
84
+ if (e.preventDefault(), !r) {
85
+ u(!0), l(0);
86
+ return;
87
+ }
88
+ const t = e.key === "ArrowDown" ? 1 : -1, o = i < 0 ? Math.min(-t, 0) : i;
89
+ l((o + t + n.length) % n.length);
85
90
  return;
86
91
  }
87
92
  case "Enter":
88
93
  case ",":
89
- e.preventDefault(), L(o ? r[d].value : s);
94
+ e.preventDefault(), $(U ? n[i].value : s);
90
95
  return;
91
96
  case "Escape":
92
- o && e.preventDefault(), x();
97
+ r && e.preventDefault(), b();
93
98
  return;
94
99
  case "Backspace":
95
- !s && c && (e.preventDefault(), I(a.slice(0, -1)));
100
+ !s && d && (e.preventDefault(), S(a.slice(0, -1)));
96
101
  return;
97
102
  }
98
- }, re = (e) => e.preventDefault();
99
- return /* @__PURE__ */ le(se, { children: [
100
- /* @__PURE__ */ l(
101
- ge,
103
+ }, ie = (e) => e.preventDefault();
104
+ return /* @__PURE__ */ ce(me, { children: [
105
+ /* @__PURE__ */ c(
106
+ Ie,
102
107
  {
103
- id: N,
108
+ id: E,
104
109
  role: "combobox",
105
110
  "aria-autocomplete": "list",
106
- "aria-expanded": o,
107
- "aria-controls": g,
108
- "aria-activedescendant": o ? k(d) : void 0,
109
- "aria-invalid": C || void 0,
110
- "aria-label": R,
111
- size: D,
112
- labelProps: $,
113
- caption: G,
114
- error: K,
115
- invalid: C,
116
- disabled: u,
117
- readOnly: h,
111
+ "aria-expanded": r,
112
+ "aria-controls": x,
113
+ "aria-activedescendant": U ? z(i) : void 0,
114
+ "aria-invalid": A || void 0,
115
+ "aria-label": P,
116
+ size: M,
117
+ labelProps: R,
118
+ caption: H,
119
+ error: V,
120
+ invalid: A,
121
+ disabled: w,
122
+ readOnly: v,
118
123
  value: s,
119
- placeholder: c ? void 0 : B,
120
- wrapperRef: F.setReference,
121
- onChange: oe,
122
- onKeyDown: ae,
123
- onBlur: x,
124
- containerClassName: i("w-full", H),
125
- wrapperClassName: i(
126
- c && [
124
+ placeholder: d ? void 0 : j,
125
+ wrapperRef: B.setReference,
126
+ onChange: se,
127
+ onKeyDown: ne,
128
+ onFocus: _,
129
+ onClick: _,
130
+ onBlur: b,
131
+ containerClassName: f("w-full", q),
132
+ wrapperClassName: f(
133
+ d && [
127
134
  "!h-auto flex-wrap gap-1 py-2",
128
- J ? "min-h-[24px]" : "min-h-[40px]"
135
+ O ? "min-h-[24px]" : "min-h-[40px]"
129
136
  ],
130
- O,
131
- be.autocompleteTagInput
137
+ J,
138
+ Me.autocompleteTagInput
132
139
  ),
133
- className: i(
140
+ className: f(
134
141
  "w-auto min-w-[100px] flex-1",
135
- h && "cursor-default"
142
+ v && "cursor-default"
136
143
  ),
137
- children: c && /* @__PURE__ */ l(
144
+ children: d && /* @__PURE__ */ c(
138
145
  "span",
139
146
  {
140
147
  role: "list",
141
- "aria-label": M,
148
+ "aria-label": N,
142
149
  className: "flex min-w-0 flex-wrap items-center gap-1",
143
- children: a.map((e) => /* @__PURE__ */ l(
144
- Ie,
150
+ children: a.map((e) => /* @__PURE__ */ c(
151
+ be,
145
152
  {
146
153
  role: "listitem",
147
154
  label: e,
148
- className: i(
149
- ve,
155
+ className: f(
156
+ Se,
150
157
  "min-w-0",
151
- V
158
+ Q
152
159
  ),
153
- disabled: u,
154
- closable: m,
155
- removeLabel: j?.(e),
156
- onRemove: m ? () => te(e) : void 0
160
+ disabled: w,
161
+ closable: p,
162
+ removeLabel: X?.(e),
163
+ onRemove: p ? () => le(e) : void 0
157
164
  },
158
165
  e
159
166
  ))
@@ -161,39 +168,39 @@ const Ce = 5, Re = ({
161
168
  )
162
169
  }
163
170
  ),
164
- /* @__PURE__ */ l(de, { children: /* @__PURE__ */ l(
171
+ /* @__PURE__ */ c(ge, { children: /* @__PURE__ */ c(
165
172
  "div",
166
173
  {
167
- ref: F.setFloating,
168
- id: g,
174
+ ref: B.setFloating,
175
+ id: x,
169
176
  role: "listbox",
170
- "aria-label": M,
171
- hidden: !o,
172
- style: ee,
173
- className: i(
177
+ "aria-label": N,
178
+ hidden: !r,
179
+ style: re,
180
+ className: f(
174
181
  "z-floating overflow-y-auto",
175
- Se,
176
- Te,
177
- !o && "hidden",
178
- q,
179
- P
182
+ De,
183
+ Ce,
184
+ !r && "hidden",
185
+ Z,
186
+ W
180
187
  ),
181
- children: o && r.map((e, t) => {
182
- const n = t === d;
183
- return /* @__PURE__ */ l(
184
- we,
188
+ children: r && n.map((e, t) => {
189
+ const o = t === i;
190
+ return /* @__PURE__ */ c(
191
+ Te,
185
192
  {
186
- id: k(t),
193
+ id: z(t),
187
194
  role: "option",
188
- "aria-selected": n,
195
+ "aria-selected": o,
189
196
  tabIndex: -1,
190
197
  label: e.label,
191
198
  description: e.description,
192
- mark: ye.Tint,
193
- selected: n,
194
- onMouseDown: re,
195
- onMouseEnter: () => p(t),
196
- onClick: () => L(e.value)
199
+ mark: Ae.Tint,
200
+ selected: o,
201
+ onMouseDown: ie,
202
+ onMouseEnter: () => l(t),
203
+ onClick: () => $(e.value)
197
204
  },
198
205
  e.value
199
206
  );
@@ -203,5 +210,5 @@ const Ce = 5, Re = ({
203
210
  ] });
204
211
  };
205
212
  export {
206
- Re as AutocompleteTagInput
213
+ Pe as AutocompleteTagInput
207
214
  };