@annondeveloper/ui-kit 0.2.1 → 0.2.3
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/{chunk-2DWZVHZS.js → chunk-H3UQODJH.js} +20 -4
- package/dist/chunk-H3UQODJH.js.map +1 -0
- package/dist/form.js +1 -1
- package/dist/index.d.ts +12 -1
- package/dist/index.js +8 -8
- package/dist/index.js.map +1 -1
- package/package.json +5 -2
- package/src/components/streaming-text.tsx +2 -0
- package/src/utils.ts +33 -0
- package/dist/chunk-2DWZVHZS.js.map +0 -1
|
@@ -5,7 +5,12 @@ import * as RadixSelect from '@radix-ui/react-select';
|
|
|
5
5
|
import { Minus, Check, ChevronDown, ToggleRight, ToggleLeft } from 'lucide-react';
|
|
6
6
|
import { forwardRef } from 'react';
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
9
|
+
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
10
|
+
}) : x)(function(x) {
|
|
11
|
+
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
12
|
+
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
13
|
+
});
|
|
9
14
|
function cn(...inputs) {
|
|
10
15
|
return twMerge(clsx(inputs));
|
|
11
16
|
}
|
|
@@ -89,6 +94,17 @@ function utilColor(pct, colorMap = defaultUtilColorMap) {
|
|
|
89
94
|
if (pct >= colorMap.medium.threshold) return colorMap.medium.className;
|
|
90
95
|
return colorMap.low.className;
|
|
91
96
|
}
|
|
97
|
+
function sanitize(input) {
|
|
98
|
+
try {
|
|
99
|
+
const DOMPurify = __require("isomorphic-dompurify");
|
|
100
|
+
return DOMPurify.sanitize(input, { ALLOWED_TAGS: [], ALLOWED_ATTR: [] });
|
|
101
|
+
} catch {
|
|
102
|
+
return input.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
function isSafeColor(c) {
|
|
106
|
+
return /^#[0-9a-f]{3,8}$/i.test(c) || /^rgba?\(\s*[\d.]+/.test(c) || /^hsla?\(\s*[\d.]+/.test(c) || /^hsl\(var\(--[a-z-]+\)\)$/.test(c);
|
|
107
|
+
}
|
|
92
108
|
var INPUT_CLS = cn(
|
|
93
109
|
"w-full rounded-lg border border-[hsl(var(--border-default))]",
|
|
94
110
|
"bg-[hsl(var(--bg-base))] px-3 py-2 text-sm",
|
|
@@ -265,6 +281,6 @@ function ToggleSwitch({
|
|
|
265
281
|
);
|
|
266
282
|
}
|
|
267
283
|
|
|
268
|
-
export { Checkbox, FormInput, INPUT_CLS, LABEL_CLS, Select, TEXTAREA_CLS, ToggleSwitch, clamp, cn, defaultUtilColorMap, fmtBps, fmtBytes, fmtCompact, fmtDuration, fmtPct, fmtRelative, fmtSpeed, fmtUptime, fmtUtil, stripCidr, utilColor };
|
|
269
|
-
//# sourceMappingURL=chunk-
|
|
270
|
-
//# sourceMappingURL=chunk-
|
|
284
|
+
export { Checkbox, FormInput, INPUT_CLS, LABEL_CLS, Select, TEXTAREA_CLS, ToggleSwitch, clamp, cn, defaultUtilColorMap, fmtBps, fmtBytes, fmtCompact, fmtDuration, fmtPct, fmtRelative, fmtSpeed, fmtUptime, fmtUtil, isSafeColor, sanitize, stripCidr, utilColor };
|
|
285
|
+
//# sourceMappingURL=chunk-H3UQODJH.js.map
|
|
286
|
+
//# sourceMappingURL=chunk-H3UQODJH.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/utils.ts","../src/components/form-input.tsx","../src/components/select.tsx","../src/components/checkbox.tsx","../src/components/toggle-switch.tsx"],"names":["jsxs","jsx","Check"],"mappings":";;;;;;;;;;;;;AAIO,SAAS,MAAM,MAAA,EAA8B;AAClD,EAAA,OAAO,OAAA,CAAQ,IAAA,CAAK,MAAM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,QAAA,EAAU,6CAA6C,GAAG,CAAA,GAC7E;AAAA;AAAA;AACN,KAAA,EACF,CAAA;AAAA,EAEJ;AACF;AAEA,QAAA,CAAS,WAAA,GAAc,UAAA;AChChB,SAAS,YAAA,CAAa;AAAA,EAC3B,OAAA;AAAA,EAAS,QAAA;AAAA,EAAU,IAAA,GAAO,IAAA;AAAA,EAAM,QAAA;AAAA,EAAU,KAAA;AAAA,EAAO;AACnD,CAAA,EAAyC;AACvC,EAAA,MAAM,QAAA,GAAW,IAAA,KAAS,IAAA,GAAO,QAAA,GAAW,QAAA;AAE5C,EAAA,uBACED,GAAAA;AAAA,IAAC,QAAA;AAAA,IAAA;AAAA,MACC,IAAA,EAAK,QAAA;AAAA,MACL,IAAA,EAAK,QAAA;AAAA,MACL,cAAA,EAAc,OAAA;AAAA,MACd,YAAA,EAAY,KAAA;AAAA,MACZ,QAAA;AAAA,MACA,OAAA,EAAS,MAAM,QAAA,CAAS,CAAC,OAAO,CAAA;AAAA,MAChC,SAAA,EAAW,EAAA;AAAA,QACT,4CAAA;AAAA,QACA,yEAAA;AAAA,QACA,iDAAA;AAAA,QACA;AAAA,OACF;AAAA,MAEC,oCACCA,GAAAA,CAAC,WAAA,EAAA,EAAY,SAAA,EAAW,GAAG,QAAA,EAAU,8BAA8B,CAAA,EAAG,CAAA,mBAEtEA,GAAAA,CAAC,UAAA,EAAA,EAAW,WAAW,EAAA,CAAG,QAAA,EAAU,kCAAkC,CAAA,EAAG;AAAA;AAAA,GAE7E;AAEJ","file":"chunk-H3UQODJH.js","sourcesContent":["import { clsx, type ClassValue } from 'clsx'\nimport { twMerge } from 'tailwind-merge'\n\n/** Merge Tailwind CSS class names with conflict resolution. */\nexport function cn(...inputs: ClassValue[]): string {\n return twMerge(clsx(inputs))\n}\n\n/** Format bits/sec into human-readable string (clamps negative to 0). */\nexport function fmtBps(bps: number): string {\n const v = Math.max(0, bps)\n if (v >= 1e12) return `${(v / 1e12).toFixed(1)} Tbps`\n if (v >= 1e9) return `${(v / 1e9).toFixed(1)} Gbps`\n if (v >= 1e6) return `${(v / 1e6).toFixed(1)} Mbps`\n if (v >= 1e3) return `${(v / 1e3).toFixed(1)} Kbps`\n return `${v.toFixed(0)} bps`\n}\n\n/** Format link speed for interface display (e.g. 1000000000 -> \"1G\"). */\nexport function fmtSpeed(bps: number): string {\n if (bps >= 1e12) return `${(bps / 1e12).toFixed(0)}T`\n if (bps >= 1e9) return `${(bps / 1e9).toFixed(0)}G`\n if (bps >= 1e6) return `${(bps / 1e6).toFixed(0)}M`\n if (bps >= 1e3) return `${(bps / 1e3).toFixed(0)}K`\n return `${bps.toFixed(0)}`\n}\n\n/** Format utilization as percentage of link speed. */\nexport function fmtUtil(bps: number, speedBps: number): string {\n if (speedBps <= 0) return '\\u2014'\n const pct = (Math.max(0, bps) / speedBps) * 100\n if (pct < 0.01) return '0%'\n if (pct < 1) return `${pct.toFixed(2)}%`\n if (pct < 10) return `${pct.toFixed(1)}%`\n return `${pct.toFixed(0)}%`\n}\n\n/** Format bytes into human-readable string. */\nexport function fmtBytes(bytes: number): string {\n if (bytes >= 1e12) return `${(bytes / 1e12).toFixed(1)} TB`\n if (bytes >= 1e9) return `${(bytes / 1e9).toFixed(1)} GB`\n if (bytes >= 1e6) return `${(bytes / 1e6).toFixed(1)} MB`\n if (bytes >= 1e3) return `${(bytes / 1e3).toFixed(1)} KB`\n return `${bytes.toFixed(0)} B`\n}\n\n/** Format percent. */\nexport function fmtPct(v: number, decimals = 1): string {\n return `${v.toFixed(decimals)}%`\n}\n\n/** Format duration in seconds to human-readable uptime string. */\nexport function fmtUptime(secs: number): string {\n if (secs < 60) return `${secs}s`\n if (secs < 3600) return `${Math.floor(secs / 60)}m`\n if (secs < 86400) return `${Math.floor(secs / 3600)}h ${Math.floor((secs % 3600) / 60)}m`\n return `${Math.floor(secs / 86400)}d ${Math.floor((secs % 86400) / 3600)}h`\n}\n\n/** Format ISO timestamp to relative time (\"3m ago\"). */\nexport function fmtRelative(isoStr: string): string {\n const diff = (Date.now() - new Date(isoStr).getTime()) / 1000\n if (diff < 60) return 'just now'\n if (diff < 3600) return `${Math.floor(diff / 60)}m ago`\n if (diff < 86400) return `${Math.floor(diff / 3600)}h ago`\n return `${Math.floor(diff / 86400)}d ago`\n}\n\n/** Format large numbers compactly (e.g. 480933305 -> \"480.9M\", 1234 -> \"1.2K\"). */\nexport function fmtCompact(n: number): string {\n const abs = Math.abs(n)\n const sign = n < 0 ? '-' : ''\n if (abs >= 1e12) return `${sign}${(abs / 1e12).toFixed(1)}T`\n if (abs >= 1e9) return `${sign}${(abs / 1e9).toFixed(1)}B`\n if (abs >= 1e6) return `${sign}${(abs / 1e6).toFixed(1)}M`\n if (abs >= 1e3) return `${sign}${(abs / 1e3).toFixed(1)}K`\n if (abs >= 1) return `${sign}${abs.toFixed(0)}`\n if (abs >= 0.01) return `${sign}${abs.toFixed(2)}`\n return `${sign}${abs.toFixed(0)}`\n}\n\n/** Format seconds duration compactly (e.g. for replication lag display). */\nexport function fmtDuration(secs: number): string {\n if (secs < 0.001) return '0s'\n if (secs < 1) return `${(secs * 1000).toFixed(0)}ms`\n if (secs < 60) return `${secs.toFixed(1)}s`\n if (secs < 3600) return `${Math.floor(secs / 60)}m ${Math.floor(secs % 60)}s`\n return `${Math.floor(secs / 3600)}h ${Math.floor((secs % 3600) / 60)}m`\n}\n\n/** Strip CIDR suffix from IP address (e.g. \"10.0.0.1/32\" -> \"10.0.0.1\"). */\nexport function stripCidr(ip: string): string {\n return ip.replace(/\\/\\d+$/, '')\n}\n\n/** Clamp a number between min and max. */\nexport function clamp(v: number, min: number, max: number): number {\n return Math.min(Math.max(v, min), max)\n}\n\n/** Color thresholds for utilization percentage mapping. */\nexport interface UtilColorMap {\n high: { threshold: number; className: string }\n medium: { threshold: number; className: string }\n low: { className: string }\n}\n\n/** Default utilization color map using CSS custom property token classes. */\nexport const defaultUtilColorMap: UtilColorMap = {\n high: { threshold: 80, className: 'text-[hsl(var(--status-critical))]' },\n medium: { threshold: 60, className: 'text-[hsl(var(--status-warning))]' },\n low: { className: 'text-[hsl(var(--status-ok))]' },\n}\n\n/**\n * Get utilization color class from value 0-100.\n * Accepts an optional color map to override the default thresholds and classes.\n */\nexport function utilColor(pct: number, colorMap: UtilColorMap = defaultUtilColorMap): string {\n if (pct >= colorMap.high.threshold) return colorMap.high.className\n if (pct >= colorMap.medium.threshold) return colorMap.medium.className\n return colorMap.low.className\n}\n\n/**\n * Sanitize a string for safe rendering. Uses DOMPurify when available,\n * falls back to basic HTML entity escaping.\n * Import `isomorphic-dompurify` as an optional peer dependency for full sanitization.\n */\nexport function sanitize(input: string): string {\n try {\n // Dynamic import to keep DOMPurify optional\n // eslint-disable-next-line @typescript-eslint/no-require-imports\n const DOMPurify = require('isomorphic-dompurify')\n return DOMPurify.sanitize(input, { ALLOWED_TAGS: [], ALLOWED_ATTR: [] }) as string\n } catch {\n // Fallback: strip all HTML tags and escape entities\n return input\n .replace(/&/g, '&')\n .replace(/</g, '<')\n .replace(/>/g, '>')\n .replace(/\"/g, '"')\n .replace(/'/g, ''')\n }\n}\n\n/**\n * Validate that a string is a safe CSS color value (hex, rgb, hsl).\n * Rejects CSS injection attempts like `expression()` or `url()`.\n */\nexport function isSafeColor(c: string): boolean {\n return /^#[0-9a-f]{3,8}$/i.test(c) ||\n /^rgba?\\(\\s*[\\d.]+/.test(c) ||\n /^hsla?\\(\\s*[\\d.]+/.test(c) ||\n /^hsl\\(var\\(--[a-z-]+\\)\\)$/.test(c)\n}\n","'use client'\n\nimport type React from 'react'\nimport { cn } from '../utils'\n\n// ── Shared class constants ──────────────────────────────────────────────────\n// Import these in any page that needs raw class strings (e.g. for <textarea>)\n\nexport const INPUT_CLS: string = cn(\n 'w-full rounded-lg border border-[hsl(var(--border-default))]',\n 'bg-[hsl(var(--bg-base))] px-3 py-2 text-sm',\n 'text-[hsl(var(--text-primary))] placeholder:text-[hsl(var(--text-tertiary))]',\n 'focus:outline-none focus:ring-2 focus:ring-[hsl(var(--brand-primary))]',\n 'disabled:opacity-50 disabled:cursor-not-allowed',\n)\n\nexport const LABEL_CLS: string = cn(\n 'mb-1.5 block text-xs font-medium uppercase tracking-wider',\n 'text-[hsl(var(--text-secondary))]',\n)\n\nexport const TEXTAREA_CLS: string = cn(\n INPUT_CLS,\n 'resize-none font-mono text-xs leading-relaxed',\n)\n\nexport interface FormInputProps {\n /** Label text displayed above the input. */\n label: string\n /** Current input value. */\n value: string\n /** Callback when value changes. */\n onChange: (value: string) => void\n /** HTML input type. */\n type?: string\n /** Placeholder text. */\n placeholder?: string\n /** Mark the field as required. */\n required?: boolean\n /** Disable the input. */\n disabled?: boolean\n /** Help text shown below the input. */\n hint?: string\n className?: string\n /** HTML autocomplete attribute. */\n autoComplete?: string\n}\n\n/**\n * @description A themed form input with label, validation indicator, and optional hint text.\n * Uses CSS custom property tokens for dark/light mode compatibility.\n */\nexport function FormInput({\n label, value, onChange, type = 'text',\n placeholder, required, disabled, hint, className, autoComplete,\n}: FormInputProps): React.JSX.Element {\n return (\n <div className={cn('space-y-1.5', className)}>\n <label className={LABEL_CLS}>\n {label}\n {required && <span className=\"text-[hsl(var(--status-critical))] ml-0.5\">*</span>}\n </label>\n <input\n type={type}\n value={value}\n onChange={(e) => onChange(e.target.value)}\n placeholder={placeholder}\n required={required}\n disabled={disabled}\n autoComplete={autoComplete}\n className={INPUT_CLS}\n />\n {hint && (\n <p className=\"text-[10px] text-[hsl(var(--text-tertiary))]\">{hint}</p>\n )}\n </div>\n )\n}\n","'use client'\n\nimport type React from 'react'\nimport * as RadixSelect from '@radix-ui/react-select'\nimport { ChevronDown, Check } from 'lucide-react'\nimport { cn } from '../utils'\n\nexport interface SelectOption {\n value: string\n label: string\n}\n\nexport interface SelectProps {\n /** Currently selected value. */\n value: string\n /** Callback when selection changes. */\n onValueChange: (v: string) => void\n /** Available options. */\n options: SelectOption[]\n /** Placeholder text when no value is selected. */\n placeholder?: string\n className?: string\n /** Disable the select. */\n disabled?: boolean\n}\n\n/**\n * @description A themed select dropdown built on Radix UI Select.\n * Supports dark/light mode via CSS custom property tokens.\n */\nexport function Select({\n value, onValueChange, options, placeholder, className, disabled,\n}: SelectProps): React.JSX.Element {\n return (\n <RadixSelect.Root value={value} onValueChange={onValueChange} disabled={disabled}>\n <RadixSelect.Trigger\n suppressHydrationWarning\n className={cn(\n 'flex w-full items-center justify-between gap-2 rounded-lg',\n 'border border-[hsl(var(--border-default))] bg-[hsl(var(--bg-base))]',\n 'px-3 py-2 text-sm text-[hsl(var(--text-primary))]',\n 'hover:border-[hsl(var(--border-strong))] focus:outline-none',\n 'focus:ring-2 focus:ring-[hsl(var(--brand-primary))]',\n 'disabled:opacity-50 disabled:cursor-not-allowed',\n 'data-[placeholder]:text-[hsl(var(--text-tertiary))]',\n className,\n )}\n >\n <RadixSelect.Value placeholder={placeholder} />\n <RadixSelect.Icon>\n <ChevronDown className=\"size-4 text-[hsl(var(--text-tertiary))] shrink-0\" />\n </RadixSelect.Icon>\n </RadixSelect.Trigger>\n\n <RadixSelect.Portal>\n <RadixSelect.Content\n position=\"popper\"\n sideOffset={4}\n className={cn(\n 'z-50 min-w-[var(--radix-select-trigger-width)] overflow-hidden',\n 'rounded-xl border border-[hsl(var(--border-default))]',\n 'bg-[hsl(var(--bg-elevated))] shadow-xl',\n 'data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95',\n 'data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95',\n )}\n >\n <RadixSelect.Viewport className=\"p-1\">\n {options.map((opt) => (\n <RadixSelect.Item\n key={opt.value}\n value={opt.value}\n className={cn(\n 'relative flex cursor-pointer select-none items-center',\n 'rounded-lg py-2 pl-8 pr-3 text-sm',\n 'text-[hsl(var(--text-primary))]',\n 'outline-none',\n 'hover:bg-[hsl(var(--bg-overlay))]',\n 'focus:bg-[hsl(var(--brand-primary))]/10 focus:text-[hsl(var(--brand-primary))]',\n 'data-[state=checked]:text-[hsl(var(--brand-primary))]',\n )}\n >\n <RadixSelect.ItemIndicator className=\"absolute left-2 flex items-center\">\n <Check className=\"size-4\" />\n </RadixSelect.ItemIndicator>\n <RadixSelect.ItemText>{opt.label}</RadixSelect.ItemText>\n </RadixSelect.Item>\n ))}\n </RadixSelect.Viewport>\n </RadixSelect.Content>\n </RadixSelect.Portal>\n </RadixSelect.Root>\n )\n}\n","'use client'\n\nimport type React from 'react'\nimport { forwardRef, type InputHTMLAttributes } from 'react'\nimport { Check, Minus } from 'lucide-react'\nimport { cn } from '../utils'\n\nexport interface CheckboxProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'type' | 'size'> {\n /** Show an indeterminate (minus) indicator instead of a checkmark. */\n indeterminate?: boolean\n /** Size variant. */\n size?: 'sm' | 'md'\n}\n\n/**\n * @description A themed checkbox with indeterminate state support.\n * Uses CSS custom property tokens for dark/light mode compatibility.\n */\nconst Checkbox: React.ForwardRefExoticComponent<CheckboxProps & React.RefAttributes<HTMLInputElement>> = forwardRef<HTMLInputElement, CheckboxProps>(\n ({ indeterminate, checked, size = 'md', className, ...props }, ref): React.JSX.Element => {\n const isChecked = checked || indeterminate\n const sizeClass = size === 'sm' ? 'h-3.5 w-3.5' : 'h-4 w-4'\n const iconSize = size === 'sm' ? 'h-2.5 w-2.5' : 'h-3 w-3'\n\n return (\n <label className={cn('relative inline-flex items-center cursor-pointer', className)}>\n <input\n ref={ref}\n type=\"checkbox\"\n checked={checked}\n className=\"sr-only peer\"\n {...props}\n />\n <div\n className={cn(\n sizeClass,\n 'rounded border transition-colors duration-150',\n 'flex items-center justify-center shrink-0',\n isChecked\n ? 'bg-[hsl(var(--brand-primary))] border-[hsl(var(--brand-primary))]'\n : 'bg-transparent border-[hsl(var(--border-strong))] hover:border-[hsl(var(--brand-primary))]',\n 'peer-focus-visible:ring-2 peer-focus-visible:ring-[hsl(var(--brand-primary))] peer-focus-visible:ring-offset-2 peer-focus-visible:ring-offset-[hsl(var(--bg-base))]',\n 'peer-disabled:opacity-50 peer-disabled:pointer-events-none',\n )}\n >\n {indeterminate ? (\n <Minus className={cn(iconSize, 'text-[hsl(var(--text-on-brand))] stroke-[3]')} />\n ) : checked ? (\n <Check className={cn(iconSize, 'text-[hsl(var(--text-on-brand))] stroke-[3]')} />\n ) : null}\n </div>\n </label>\n )\n },\n)\n\nCheckbox.displayName = 'Checkbox'\n\nexport { Checkbox }\n","'use client'\n\nimport type React from 'react'\nimport { ToggleLeft, ToggleRight } from 'lucide-react'\nimport { cn } from '../utils'\n\nexport interface ToggleSwitchProps {\n /** Whether the toggle is on. */\n enabled: boolean\n /** Callback when toggled. */\n onChange: (enabled: boolean) => void\n /** Size variant. */\n size?: 'sm' | 'md'\n /** Disable the toggle. */\n disabled?: boolean\n /** Accessible label. */\n label?: string\n className?: string\n}\n\n/**\n * @description A themed toggle switch using lucide icons for on/off states.\n * Supports dark/light mode via CSS custom property tokens.\n */\nexport function ToggleSwitch({\n enabled, onChange, size = 'md', disabled, label, className,\n}: ToggleSwitchProps): React.JSX.Element {\n const iconSize = size === 'sm' ? 'size-5' : 'size-6'\n\n return (\n <button\n type=\"button\"\n role=\"switch\"\n aria-checked={enabled}\n aria-label={label}\n disabled={disabled}\n onClick={() => onChange(!enabled)}\n className={cn(\n 'inline-flex items-center transition-colors',\n 'text-[hsl(var(--text-secondary))] hover:text-[hsl(var(--text-primary))]',\n 'disabled:opacity-50 disabled:cursor-not-allowed',\n className,\n )}\n >\n {enabled ? (\n <ToggleRight className={cn(iconSize, 'text-[hsl(var(--status-ok))]')} />\n ) : (\n <ToggleLeft className={cn(iconSize, 'text-[hsl(var(--text-tertiary))]')} />\n )}\n </button>\n )\n}\n"]}
|
package/dist/form.js
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -50,6 +50,17 @@ declare const defaultUtilColorMap: UtilColorMap;
|
|
|
50
50
|
* Accepts an optional color map to override the default thresholds and classes.
|
|
51
51
|
*/
|
|
52
52
|
declare function utilColor(pct: number, colorMap?: UtilColorMap): string;
|
|
53
|
+
/**
|
|
54
|
+
* Sanitize a string for safe rendering. Uses DOMPurify when available,
|
|
55
|
+
* falls back to basic HTML entity escaping.
|
|
56
|
+
* Import `isomorphic-dompurify` as an optional peer dependency for full sanitization.
|
|
57
|
+
*/
|
|
58
|
+
declare function sanitize(input: string): string;
|
|
59
|
+
/**
|
|
60
|
+
* Validate that a string is a safe CSS color value (hex, rgb, hsl).
|
|
61
|
+
* Rejects CSS injection attempts like `expression()` or `url()`.
|
|
62
|
+
*/
|
|
63
|
+
declare function isSafeColor(c: string): boolean;
|
|
53
64
|
|
|
54
65
|
type ButtonVariant = 'primary' | 'secondary' | 'danger' | 'outline' | 'ghost';
|
|
55
66
|
type ButtonSize = 'sm' | 'md' | 'lg' | 'icon';
|
|
@@ -1397,4 +1408,4 @@ interface CopyBlockProps {
|
|
|
1397
1408
|
*/
|
|
1398
1409
|
declare function CopyBlock({ content, language, showLineNumbers, maxHeight, label, className, }: CopyBlockProps): React.JSX.Element;
|
|
1399
1410
|
|
|
1400
|
-
export { AnimatedCounter, type AnimatedCounterProps, Avatar, type AvatarProps, Badge, type BadgeColor, type BadgeProps, type BadgeVariantConfig, Button, type ButtonProps, type ButtonSize, type ButtonVariant, Card, CardContent, CardDescription, CardFooter, CardHeader, type CardProps, type CardSubProps, CardTitle, Checkbox, type CheckboxProps, ColorInput, type ColorInputProps, CommandBar, type CommandBarProps, type CommandItem, ConfidenceBar, type ConfidenceBarProps, ConfirmDialog, type ConfirmDialogProps, CopyBlock, type CopyBlockProps, DataTable, type DataTableProps, type DayStatus, type DayValue, type Density, DiffViewer, type DiffViewerProps, DragHandle, type DragHandleProps, DropdownMenu, type DropdownMenuProps, EmptyState, type EmptyStateProps, type FeedItem, FilterPill, type FilterPillProps, type FilterSuggestion, FormInput, type FormInputProps, HeatmapCalendar, type HeatmapCalendarProps, INPUT_CLS, InfiniteScroll, type InfiniteScrollProps, type KanbanBadgeColor, KanbanColumn, type KanbanColumnProps, type KanbanItem, LABEL_CLS, LiveFeed, type LiveFeedProps, type LogEntry, LogViewer, type LogViewerProps, type MenuItem, MetricCard, type MetricCardProps, type Notification, NotificationStack, type NotificationStackProps, PipelineStage, type PipelineStageProps, Popover, type PopoverProps, type PortStatus, PortStatusGrid, type PortStatusGridProps, Progress, type ProgressProps, type PulseConfig, RadioGroup, type RadioGroupProps, type RadioOption, RealtimeValue, type RealtimeValueProps, SeverityTimeline, type SeverityTimelineProps, Sheet, type SheetProps, Skeleton, SkeletonCard, SkeletonText, type SkeletonTextProps, Slider, type SliderProps, SmartTable, type SmartTableProps, type SortableItem, SortableList, type SortableListProps, Sparkline, type SparklineProps, type StageInfo, StatusBadge, type StatusBadgeProps, type StatusConfig, StatusPulse, type StatusPulseProps, StepWizard, type StepWizardProps, StreamingText, type StreamingTextProps, SuccessCheckmark, type SuccessCheckmarkProps, TEXTAREA_CLS, type Tab, Tabs, type TabsProps, ThresholdGauge, type ThresholdGaugeProps, type TimeRange, TimeRangeSelector, type TimeRangeSelectorProps, type TimelineEvent, Toaster, type ToasterProps, ToggleSwitch, type ToggleSwitchProps, Tooltip, type TooltipProps, TruncatedText, type TruncatedTextProps, TypingIndicator, type TypingIndicatorProps, UptimeTracker, type UptimeTrackerProps, type UtilColorMap, UtilizationBar, type UtilizationBarProps, type WizardStep, clamp, cn, createBadgeVariant, defaultPulseConfigMap, defaultStatusMap, defaultUtilColorMap, fmtBps, fmtBytes, fmtCompact, fmtDuration, fmtPct, fmtRelative, fmtSpeed, fmtUptime, fmtUtil, stripCidr, utilColor };
|
|
1411
|
+
export { AnimatedCounter, type AnimatedCounterProps, Avatar, type AvatarProps, Badge, type BadgeColor, type BadgeProps, type BadgeVariantConfig, Button, type ButtonProps, type ButtonSize, type ButtonVariant, Card, CardContent, CardDescription, CardFooter, CardHeader, type CardProps, type CardSubProps, CardTitle, Checkbox, type CheckboxProps, ColorInput, type ColorInputProps, CommandBar, type CommandBarProps, type CommandItem, ConfidenceBar, type ConfidenceBarProps, ConfirmDialog, type ConfirmDialogProps, CopyBlock, type CopyBlockProps, DataTable, type DataTableProps, type DayStatus, type DayValue, type Density, DiffViewer, type DiffViewerProps, DragHandle, type DragHandleProps, DropdownMenu, type DropdownMenuProps, EmptyState, type EmptyStateProps, type FeedItem, FilterPill, type FilterPillProps, type FilterSuggestion, FormInput, type FormInputProps, HeatmapCalendar, type HeatmapCalendarProps, INPUT_CLS, InfiniteScroll, type InfiniteScrollProps, type KanbanBadgeColor, KanbanColumn, type KanbanColumnProps, type KanbanItem, LABEL_CLS, LiveFeed, type LiveFeedProps, type LogEntry, LogViewer, type LogViewerProps, type MenuItem, MetricCard, type MetricCardProps, type Notification, NotificationStack, type NotificationStackProps, PipelineStage, type PipelineStageProps, Popover, type PopoverProps, type PortStatus, PortStatusGrid, type PortStatusGridProps, Progress, type ProgressProps, type PulseConfig, RadioGroup, type RadioGroupProps, type RadioOption, RealtimeValue, type RealtimeValueProps, SeverityTimeline, type SeverityTimelineProps, Sheet, type SheetProps, Skeleton, SkeletonCard, SkeletonText, type SkeletonTextProps, Slider, type SliderProps, SmartTable, type SmartTableProps, type SortableItem, SortableList, type SortableListProps, Sparkline, type SparklineProps, type StageInfo, StatusBadge, type StatusBadgeProps, type StatusConfig, StatusPulse, type StatusPulseProps, StepWizard, type StepWizardProps, StreamingText, type StreamingTextProps, SuccessCheckmark, type SuccessCheckmarkProps, TEXTAREA_CLS, type Tab, Tabs, type TabsProps, ThresholdGauge, type ThresholdGaugeProps, type TimeRange, TimeRangeSelector, type TimeRangeSelectorProps, type TimelineEvent, Toaster, type ToasterProps, ToggleSwitch, type ToggleSwitchProps, Tooltip, type TooltipProps, TruncatedText, type TruncatedTextProps, TypingIndicator, type TypingIndicatorProps, UptimeTracker, type UptimeTrackerProps, type UtilColorMap, UtilizationBar, type UtilizationBarProps, type WizardStep, clamp, cn, createBadgeVariant, defaultPulseConfigMap, defaultStatusMap, defaultUtilColorMap, fmtBps, fmtBytes, fmtCompact, fmtDuration, fmtPct, fmtRelative, fmtSpeed, fmtUptime, fmtUtil, isSafeColor, sanitize, stripCidr, utilColor };
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { cn, Select, clamp } from './chunk-
|
|
2
|
-
export { Checkbox, FormInput, INPUT_CLS, LABEL_CLS, Select, TEXTAREA_CLS, ToggleSwitch, clamp, cn, defaultUtilColorMap, fmtBps, fmtBytes, fmtCompact, fmtDuration, fmtPct, fmtRelative, fmtSpeed, fmtUptime, fmtUtil, stripCidr, utilColor } from './chunk-
|
|
1
|
+
import { cn, Select, clamp } from './chunk-H3UQODJH.js';
|
|
2
|
+
export { Checkbox, FormInput, INPUT_CLS, LABEL_CLS, Select, TEXTAREA_CLS, ToggleSwitch, clamp, cn, defaultUtilColorMap, fmtBps, fmtBytes, fmtCompact, fmtDuration, fmtPct, fmtRelative, fmtSpeed, fmtUptime, fmtUtil, isSafeColor, sanitize, stripCidr, utilColor } from './chunk-H3UQODJH.js';
|
|
3
3
|
import { forwardRef, useRef, useState, useEffect, useCallback, useMemo } from 'react';
|
|
4
4
|
import { Loader2, Check, Copy, AlertTriangle, Search, X, Filter, List, AlignJustify, LayoutList, Columns3, Download, ChevronUp, ChevronDown, ChevronsUpDown, TrendingUp, TrendingDown, ArrowDown, ChevronRight, Play, Pause, XCircle, CheckCircle2, Info, Plus, Sparkles, Hash, Regex, ArrowUp, Minus, WifiOff, Clock, CornerDownLeft, GripVertical, ChevronLeft, Eye, EyeOff } from 'lucide-react';
|
|
5
5
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
@@ -5068,7 +5068,7 @@ function formatColor(hex, fmt) {
|
|
|
5068
5068
|
const { h, s, l } = rgbToHsl(r, g, b);
|
|
5069
5069
|
return `hsl(${Math.round(h * 360)}, ${Math.round(s * 100)}%, ${Math.round(l * 100)}%)`;
|
|
5070
5070
|
}
|
|
5071
|
-
function
|
|
5071
|
+
function isSafeColor2(c) {
|
|
5072
5072
|
return /^#[0-9a-f]{3,8}$/i.test(c) || /^rgba?\(\s*[\d.]+/.test(c) || /^hsla?\(\s*[\d.]+/.test(c);
|
|
5073
5073
|
}
|
|
5074
5074
|
var RECENT_COLORS_KEY = "ui-kit-recent-colors";
|
|
@@ -5214,7 +5214,7 @@ function ColorInput({
|
|
|
5214
5214
|
"span",
|
|
5215
5215
|
{
|
|
5216
5216
|
className: "h-5 w-5 rounded-md border border-[hsl(var(--border-subtle))]",
|
|
5217
|
-
style: { backgroundColor:
|
|
5217
|
+
style: { backgroundColor: isSafeColor2(safeValue) ? safeValue : void 0 }
|
|
5218
5218
|
}
|
|
5219
5219
|
),
|
|
5220
5220
|
/* @__PURE__ */ jsx("span", { className: "font-mono text-xs text-[hsl(var(--text-primary))]", children: formatColor(value, format) })
|
|
@@ -5252,7 +5252,7 @@ function ColorInput({
|
|
|
5252
5252
|
style: {
|
|
5253
5253
|
left: `${markerX}%`,
|
|
5254
5254
|
top: `${Math.max(0, Math.min(100, markerY))}%`,
|
|
5255
|
-
backgroundColor:
|
|
5255
|
+
backgroundColor: isSafeColor2(safeValue) ? safeValue : void 0
|
|
5256
5256
|
}
|
|
5257
5257
|
}
|
|
5258
5258
|
)
|
|
@@ -5282,7 +5282,7 @@ function ColorInput({
|
|
|
5282
5282
|
onChange: (e) => setAlpha(Number(e.target.value) / 100),
|
|
5283
5283
|
className: "w-full h-3 rounded-full appearance-none cursor-pointer",
|
|
5284
5284
|
style: {
|
|
5285
|
-
background: `linear-gradient(to right, transparent, ${
|
|
5285
|
+
background: `linear-gradient(to right, transparent, ${isSafeColor2(safeValue) ? safeValue : "#000"})`
|
|
5286
5286
|
}
|
|
5287
5287
|
}
|
|
5288
5288
|
) }),
|
|
@@ -5332,7 +5332,7 @@ function ColorInput({
|
|
|
5332
5332
|
"h-6 w-6 rounded-md border transition-all",
|
|
5333
5333
|
value === color ? "border-[hsl(var(--brand-primary))] ring-2 ring-[hsl(var(--brand-primary)/0.3)] scale-110" : "border-[hsl(var(--border-subtle))] hover:scale-110"
|
|
5334
5334
|
),
|
|
5335
|
-
style: { backgroundColor:
|
|
5335
|
+
style: { backgroundColor: isSafeColor2(color) ? color : void 0 },
|
|
5336
5336
|
title: color
|
|
5337
5337
|
},
|
|
5338
5338
|
color
|
|
@@ -5348,7 +5348,7 @@ function ColorInput({
|
|
|
5348
5348
|
"h-6 w-6 rounded-md border border-[hsl(var(--border-subtle))]",
|
|
5349
5349
|
"hover:scale-110 transition-transform"
|
|
5350
5350
|
),
|
|
5351
|
-
style: { backgroundColor:
|
|
5351
|
+
style: { backgroundColor: isSafeColor2(color) ? color : void 0 },
|
|
5352
5352
|
title: color
|
|
5353
5353
|
},
|
|
5354
5354
|
color
|