@datatechsolutions/ui 3.8.0 → 3.8.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.
@@ -2785,6 +2785,84 @@ var DIFFICULTY_OPTIONS = [
2785
2785
  { id: "expert", emoji: "\u{1F9E0}", accent: "from-rose-500 to-purple-600" }
2786
2786
  ];
2787
2787
  var EMOJI_PALETTE = ["\u{1F4BC}", "\u{1F3A7}", "\u{1F4CA}", "\u{1F6E1}\uFE0F", "\u{1F52C}", "\u2728", "\u{1F916}", "\u26A1", "\u{1F3AF}", "\u{1F680}", "\u{1F9E0}", "\u{1F9BE}", "\u{1F4E1}", "\u{1F52E}", "\u{1F310}", "\u{1F5C2}\uFE0F"];
2788
+ function RangeSliderField({
2789
+ sliderId,
2790
+ label,
2791
+ value,
2792
+ onChange,
2793
+ min,
2794
+ max,
2795
+ step,
2796
+ zones,
2797
+ trackGradient,
2798
+ formatValue,
2799
+ ariaLabel
2800
+ }) {
2801
+ const percent = (value - min) / (max - min) * 100;
2802
+ const activeZone = zones?.find((z) => value <= z.max) ?? zones?.[zones.length - 1];
2803
+ const thumbColor = activeZone?.thumbColor ?? "#6366f1";
2804
+ const glow = hexToGlow(thumbColor);
2805
+ const displayValue = formatValue ? formatValue(value) : value.toString();
2806
+ const ariaText = activeZone ? `${displayValue} \u2014 ${activeZone.label}` : displayValue;
2807
+ return /* @__PURE__ */ jsxs("div", { children: [
2808
+ /* @__PURE__ */ jsxs("div", { className: "mb-2 flex items-center justify-between", children: [
2809
+ /* @__PURE__ */ jsx("label", { htmlFor: sliderId, className: "text-xs font-medium text-gray-500 dark:text-gray-400", children: label }),
2810
+ /* @__PURE__ */ jsx("span", { className: "text-sm font-bold tabular-nums text-gray-900 dark:text-white", children: displayValue })
2811
+ ] }),
2812
+ /* @__PURE__ */ jsxs("div", { className: "relative", children: [
2813
+ /* @__PURE__ */ jsx("div", { className: "absolute inset-x-0 top-1/2 h-2 -translate-y-1/2 overflow-hidden rounded-full bg-gray-200 dark:bg-gray-700", children: /* @__PURE__ */ jsx(
2814
+ "div",
2815
+ {
2816
+ className: "h-full rounded-full transition-all duration-300 ease-out motion-reduce:transition-none",
2817
+ style: {
2818
+ width: `${Math.max(0, Math.min(100, percent))}%`,
2819
+ background: trackGradient ?? `linear-gradient(90deg, ${thumbColor}, ${thumbColor})`
2820
+ }
2821
+ }
2822
+ ) }),
2823
+ /* @__PURE__ */ jsx(
2824
+ "input",
2825
+ {
2826
+ id: sliderId,
2827
+ "data-slider-id": sliderId,
2828
+ type: "range",
2829
+ min,
2830
+ max,
2831
+ step,
2832
+ value,
2833
+ onChange: (e) => onChange(parseFloat(e.target.value)),
2834
+ "aria-label": ariaLabel ?? label,
2835
+ "aria-valuemin": min,
2836
+ "aria-valuemax": max,
2837
+ "aria-valuenow": value,
2838
+ "aria-valuetext": ariaText,
2839
+ className: "relative z-10 h-5 w-full cursor-pointer appearance-none bg-transparent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-2 [&::-webkit-slider-thumb]:h-5 [&::-webkit-slider-thumb]:w-5 [&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:border-2 [&::-webkit-slider-thumb]:border-white [&::-webkit-slider-thumb]:shadow-lg dark:[&::-webkit-slider-thumb]:border-gray-900"
2840
+ }
2841
+ ),
2842
+ /* @__PURE__ */ jsx("style", { children: `[data-slider-id="${sliderId}"]::-webkit-slider-thumb { background: ${thumbColor}; box-shadow: 0 0 8px ${glow}; } [data-slider-id="${sliderId}"]::-moz-range-thumb { background: ${thumbColor}; border: 2px solid white; box-shadow: 0 0 8px ${glow}; }` })
2843
+ ] }),
2844
+ zones && zones.length > 0 && /* @__PURE__ */ jsx("div", { className: "mt-1 flex items-center justify-between", children: zones.map((z) => {
2845
+ const isActive = z.label === activeZone?.label;
2846
+ return /* @__PURE__ */ jsx(
2847
+ "span",
2848
+ {
2849
+ className: `text-[10px] font-medium transition-colors motion-reduce:transition-none ${isActive ? z.color : "text-gray-400 dark:text-gray-500"}`,
2850
+ children: z.label
2851
+ },
2852
+ z.label
2853
+ );
2854
+ }) })
2855
+ ] });
2856
+ }
2857
+ function hexToGlow(hex) {
2858
+ const m = /^#?([0-9a-f]{6})$/i.exec(hex);
2859
+ if (!m) return "rgba(99,102,241,0.5)";
2860
+ const int = parseInt(m[1], 16);
2861
+ const r = int >> 16 & 255;
2862
+ const g = int >> 8 & 255;
2863
+ const b = int & 255;
2864
+ return `rgba(${r},${g},${b},0.5)`;
2865
+ }
2788
2866
  function CreateAgentDialog({
2789
2867
  labels,
2790
2868
  models,
@@ -3054,75 +3132,136 @@ function CreateAgentDialog({
3054
3132
  subtitle: labels.behaviorSubtitle ?? "System prompt shapes how the agent thinks"
3055
3133
  },
3056
3134
  children: /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
3135
+ /* @__PURE__ */ jsxs("div", { children: [
3136
+ /* @__PURE__ */ jsxs("div", { className: "mb-1 flex items-center justify-between", children: [
3137
+ /* @__PURE__ */ jsx("label", { htmlFor: "create-agent-system-prompt", className: "text-xs font-medium text-gray-500 dark:text-gray-400", children: labels.promptSystemPrompt ?? "System prompt" }),
3138
+ /* @__PURE__ */ jsxs("span", { className: "text-[10px] text-gray-400 dark:text-gray-500", children: [
3139
+ systemPrompt.length,
3140
+ " chars"
3141
+ ] })
3142
+ ] }),
3143
+ /* @__PURE__ */ jsx(
3144
+ "textarea",
3145
+ {
3146
+ id: "create-agent-system-prompt",
3147
+ value: systemPrompt,
3148
+ onChange: (e) => setSystemPrompt(e.target.value),
3149
+ rows: 8,
3150
+ className: "w-full resize-y rounded-lg border border-gray-200/50 bg-gray-50/50 px-3 py-2.5 font-mono text-xs leading-relaxed text-gray-700 outline-none transition-colors placeholder:text-gray-400 focus:border-indigo-300/50 focus:ring-1 focus:ring-indigo-300/30 motion-reduce:transition-none dark:border-white/10 dark:bg-white/5 dark:text-gray-300 dark:placeholder:text-gray-500 dark:focus:border-indigo-500/30 dark:focus:ring-indigo-500/20",
3151
+ placeholder: labels.promptPlaceholder ?? "You are a helpful assistant\u2026"
3152
+ }
3153
+ )
3154
+ ] }),
3155
+ /* @__PURE__ */ jsxs("div", { children: [
3156
+ /* @__PURE__ */ jsxs("div", { className: "mb-1 flex items-center justify-between", children: [
3157
+ /* @__PURE__ */ jsx("label", { htmlFor: "create-agent-user-prompt", className: "text-xs font-medium text-gray-500 dark:text-gray-400", children: labels.userPromptLabel ?? "User prompt template" }),
3158
+ /* @__PURE__ */ jsxs("span", { className: "text-[10px] text-gray-400 dark:text-gray-500", children: [
3159
+ userPrompt.length,
3160
+ " chars"
3161
+ ] })
3162
+ ] }),
3163
+ /* @__PURE__ */ jsx(
3164
+ "textarea",
3165
+ {
3166
+ id: "create-agent-user-prompt",
3167
+ value: userPrompt,
3168
+ onChange: (e) => setUserPrompt(e.target.value),
3169
+ rows: 5,
3170
+ className: "w-full resize-y rounded-lg border border-gray-200/50 bg-gray-50/50 px-3 py-2.5 font-mono text-xs leading-relaxed text-gray-700 outline-none transition-colors placeholder:text-gray-400 focus:border-indigo-300/50 focus:ring-1 focus:ring-indigo-300/30 motion-reduce:transition-none dark:border-white/10 dark:bg-white/5 dark:text-gray-300 dark:placeholder:text-gray-500 dark:focus:border-indigo-500/30 dark:focus:ring-indigo-500/20",
3171
+ placeholder: labels.userPromptPlaceholder ?? "Analyze {{ nodeId.path }} and produce a summary."
3172
+ }
3173
+ )
3174
+ ] }),
3057
3175
  /* @__PURE__ */ jsx(
3058
- FormTextarea,
3176
+ RangeSliderField,
3059
3177
  {
3060
- label: labels.promptSystemPrompt ?? "System prompt",
3061
- value: systemPrompt,
3062
- onValueChange: setSystemPrompt,
3063
- rows: 5,
3064
- placeholder: labels.promptPlaceholder ?? "You are a helpful assistant\u2026"
3178
+ sliderId: "create-agent-temperature",
3179
+ label: labels.temperature,
3180
+ value: temperature,
3181
+ onChange: setTemperature,
3182
+ min: 0,
3183
+ max: 1,
3184
+ step: 0.05,
3185
+ trackGradient: "linear-gradient(90deg, #3b82f6, #8b5cf6 50%, #ec4899)",
3186
+ formatValue: (v) => v.toFixed(2),
3187
+ zones: [
3188
+ { label: "Precise", max: 0.3, color: "text-blue-500", thumbColor: "#3b82f6" },
3189
+ { label: "Balanced", max: 0.7, color: "text-purple-500", thumbColor: "#8b5cf6" },
3190
+ { label: "Creative", max: 1, color: "text-pink-500", thumbColor: "#ec4899" }
3191
+ ]
3065
3192
  }
3066
3193
  ),
3067
3194
  /* @__PURE__ */ jsx(
3068
- FormTextarea,
3195
+ RangeSliderField,
3069
3196
  {
3070
- label: labels.userPromptLabel ?? "User prompt template",
3071
- value: userPrompt,
3072
- onValueChange: setUserPrompt,
3073
- rows: 4,
3074
- placeholder: labels.userPromptPlaceholder ?? "Analyze {{ nodeId.path }} and produce a summary."
3197
+ sliderId: "create-agent-top-p",
3198
+ label: labels.topPLabel ?? "Top-P",
3199
+ value: topP,
3200
+ onChange: setTopP,
3201
+ min: 0,
3202
+ max: 1,
3203
+ step: 0.05,
3204
+ trackGradient: "linear-gradient(90deg, #6366f1, #8b5cf6)",
3205
+ formatValue: (v) => v.toFixed(2),
3206
+ zones: [
3207
+ { label: "Top-P", max: 1, color: "text-violet-500", thumbColor: "#8b5cf6" }
3208
+ ]
3075
3209
  }
3076
3210
  ),
3077
- /* @__PURE__ */ jsxs(FormGrid, { children: [
3078
- /* @__PURE__ */ jsx(
3079
- FormInput,
3080
- {
3081
- label: `${labels.temperature} (${temperature.toFixed(2)})`,
3082
- type: "number",
3083
- value: String(temperature),
3084
- onValueChange: (v) => setTemperature(Number(v) || 0),
3085
- step: 0.1,
3086
- min: 0,
3087
- max: 2
3088
- }
3089
- ),
3211
+ /* @__PURE__ */ jsx(
3212
+ RangeSliderField,
3213
+ {
3214
+ sliderId: "create-agent-top-k",
3215
+ label: labels.topKLabel ?? "Top-K",
3216
+ value: topK,
3217
+ onChange: (v) => setTopK(Math.max(0, Math.floor(v))),
3218
+ min: 0,
3219
+ max: 500,
3220
+ step: 1,
3221
+ trackGradient: "linear-gradient(90deg, #10b981, #14b8a6)",
3222
+ formatValue: (v) => v.toString(),
3223
+ zones: [
3224
+ { label: "Top-K", max: 500, color: "text-emerald-500", thumbColor: "#10b981" }
3225
+ ]
3226
+ }
3227
+ ),
3228
+ /* @__PURE__ */ jsxs("div", { children: [
3229
+ /* @__PURE__ */ jsxs("div", { className: "mb-2 flex items-center justify-between", children: [
3230
+ /* @__PURE__ */ jsx("label", { htmlFor: "create-agent-max-tokens", className: "text-xs font-medium text-gray-500 dark:text-gray-400", children: labels.maxTokens }),
3231
+ /* @__PURE__ */ jsx("span", { className: "text-sm font-bold tabular-nums text-gray-900 dark:text-white", children: maxTokens.toLocaleString() })
3232
+ ] }),
3090
3233
  /* @__PURE__ */ jsx(
3091
- FormInput,
3234
+ "input",
3092
3235
  {
3093
- label: labels.maxTokens,
3236
+ id: "create-agent-max-tokens",
3094
3237
  type: "number",
3095
- value: String(maxTokens),
3096
- onValueChange: (v) => setMaxTokens(Number(v) || 0),
3238
+ value: maxTokens,
3239
+ onChange: (e) => setMaxTokens(Math.max(1, Math.floor(Number(e.target.value) || 0))),
3097
3240
  min: 1,
3098
- max: 32e3
3099
- }
3100
- ),
3101
- /* @__PURE__ */ jsx(
3102
- FormInput,
3103
- {
3104
- label: `${labels.topPLabel ?? "Top-P"} (${topP.toFixed(2)})`,
3105
- type: "number",
3106
- value: String(topP),
3107
- onValueChange: (v) => setTopP(Number(v) || 0),
3108
- step: 0.05,
3109
- min: 0,
3110
- max: 1
3111
- }
3112
- ),
3113
- /* @__PURE__ */ jsx(
3114
- FormInput,
3115
- {
3116
- label: labels.topKLabel ?? "Top-K",
3117
- type: "number",
3118
- value: String(topK),
3119
- onValueChange: (v) => setTopK(Math.max(0, Math.floor(Number(v) || 0))),
3241
+ max: 32e3,
3120
3242
  step: 1,
3121
- min: 0,
3122
- max: 500
3243
+ className: "w-full rounded-lg border border-gray-200/50 bg-gray-50/50 px-3 py-2.5 text-sm tabular-nums text-gray-700 outline-none transition-colors focus:border-indigo-300/50 focus:ring-1 focus:ring-indigo-300/30 motion-reduce:transition-none dark:border-white/10 dark:bg-white/5 dark:text-gray-300 dark:focus:border-indigo-500/30 dark:focus:ring-indigo-500/20"
3123
3244
  }
3124
3245
  )
3125
- ] })
3246
+ ] }),
3247
+ /* @__PURE__ */ jsx("div", { className: "overflow-hidden rounded-lg border border-gray-200/30 dark:border-white/10", children: /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-3 gap-px bg-gray-200/30 dark:bg-white/10", children: [
3248
+ /* @__PURE__ */ jsxs("div", { className: "bg-white/60 px-3 py-2 dark:bg-gray-900/60", children: [
3249
+ /* @__PURE__ */ jsx("p", { className: "text-[9px] uppercase tracking-wider text-gray-400 dark:text-gray-500", children: labels.model }),
3250
+ /* @__PURE__ */ jsx("p", { className: "truncate text-xs font-semibold text-gray-900 dark:text-white", children: matchingModels.find((m) => m.id === modelId)?.name ?? labels.modelEmpty })
3251
+ ] }),
3252
+ /* @__PURE__ */ jsxs("div", { className: "bg-white/60 px-3 py-2 dark:bg-gray-900/60", children: [
3253
+ /* @__PURE__ */ jsx("p", { className: "text-[9px] uppercase tracking-wider text-gray-400 dark:text-gray-500", children: labels.maxTokens }),
3254
+ /* @__PURE__ */ jsx("p", { className: "text-xs font-semibold text-gray-900 dark:text-white", children: maxTokens.toLocaleString() })
3255
+ ] }),
3256
+ /* @__PURE__ */ jsxs("div", { className: "bg-white/60 px-3 py-2 dark:bg-gray-900/60", children: [
3257
+ /* @__PURE__ */ jsx("p", { className: "text-[9px] uppercase tracking-wider text-gray-400 dark:text-gray-500", children: labels.temperature }),
3258
+ /* @__PURE__ */ jsxs("p", { className: `text-xs font-semibold ${temperature <= 0.3 ? "text-blue-500" : temperature <= 0.7 ? "text-purple-500" : "text-pink-500"}`, children: [
3259
+ temperature.toFixed(2),
3260
+ " \xB7 ",
3261
+ temperature <= 0.3 ? "Precise" : temperature <= 0.7 ? "Balanced" : "Creative"
3262
+ ] })
3263
+ ] })
3264
+ ] }) })
3126
3265
  ] })
3127
3266
  }
3128
3267
  ),