@devalok/shilp-sutra 0.52.0 → 0.53.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.
- package/MIGRATION.md +6 -0
- package/dist/_chunks/motion-provider.js +7 -6
- package/dist/_chunks/motion-provider.js.map +1 -1
- package/dist/_chunks/success.js +53 -53
- package/dist/ai/command-bar.js +158 -158
- package/dist/ai/command-bar.js.map +1 -1
- package/dist/ai/conversation.js +5 -5
- package/dist/composed/command-palette.js +17 -17
- package/dist/composed/command-palette.js.map +1 -1
- package/dist/composed/priority-indicator.d.ts +15 -6
- package/dist/composed/priority-indicator.d.ts.map +1 -1
- package/dist/composed/priority-indicator.js +37 -88
- package/dist/composed/priority-indicator.js.map +1 -1
- package/dist/composed/schedule-view.d.ts +17 -2
- package/dist/composed/schedule-view.d.ts.map +1 -1
- package/dist/composed/schedule-view.js +163 -64
- package/dist/composed/schedule-view.js.map +1 -1
- package/dist/motion/motion-provider.d.ts.map +1 -1
- package/dist/shell/bottom-navbar.d.ts +32 -6
- package/dist/shell/bottom-navbar.d.ts.map +1 -1
- package/dist/shell/bottom-navbar.js +156 -129
- package/dist/shell/bottom-navbar.js.map +1 -1
- package/dist/tokens/primitives.css +6 -2
- package/dist/tokens/utilities.css +6 -0
- package/dist/ui/autocomplete.d.ts +34 -32
- package/dist/ui/autocomplete.d.ts.map +1 -1
- package/dist/ui/autocomplete.js +115 -110
- package/dist/ui/autocomplete.js.map +1 -1
- package/dist/ui/combobox.js +4 -4
- package/dist/ui/index.js +30 -30
- package/dist/ui/search-input.js +4 -4
- package/dist/ui/sidebar.js +7 -7
- package/docs/components/composed/priority-indicator.md +22 -11
- package/docs/components/composed/schedule-view.md +20 -5
- package/docs/components/shell/bottom-navbar.md +24 -5
- package/docs/components/ui/autocomplete.md +26 -10
- package/llms.txt +1 -1
- package/mcp-manifest.json +179 -26
- package/package.json +1 -1
- package/skill/SKILL.md +1 -1
- package/skill/references/components.md +1 -1
package/dist/ui/autocomplete.js
CHANGED
|
@@ -1,29 +1,30 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { autoUpdate as e, flip as t, offset as n, shift as r, size as i, useFloating as a } from "../_chunks/primitives.js";
|
|
3
|
-
import {
|
|
4
|
-
import { cn as
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import
|
|
3
|
+
import { tweens as o } from "./lib/motion.js";
|
|
4
|
+
import { cn as s } from "./lib/utils.js";
|
|
5
|
+
import { Spinner as c } from "./spinner.js";
|
|
6
|
+
import { useMotion as l } from "../_chunks/motion-provider.js";
|
|
7
|
+
import { useFormField as u } from "./form.js";
|
|
8
|
+
import { Input as ee } from "./input.js";
|
|
9
|
+
import * as d from "react";
|
|
10
|
+
import { Fragment as f, jsx as p, jsxs as m } from "react/jsx-runtime";
|
|
11
|
+
import { createPortal as h } from "react-dom";
|
|
12
|
+
import { AnimatePresence as g, motion as _ } from "framer-motion";
|
|
10
13
|
//#region src/ui/autocomplete.tsx
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
let D = u.useId(), O = w || D, k = `${O}-listbox`, A = `${O}-option`, [j, M] = u.useState(v?.label ?? ""), [N, P] = u.useState(!1), [F, I] = u.useState(-1), L = u.useRef(null), R = u.useRef(null), z = u.useRef(null), B = u.useRef(null), { refs: V, floatingStyles: H } = a({
|
|
26
|
-
open: N,
|
|
14
|
+
function v({ label: e, query: t }) {
|
|
15
|
+
let n = t ? e.toLowerCase().indexOf(t.toLowerCase()) : -1;
|
|
16
|
+
return n === -1 ? /* @__PURE__ */ p(f, { children: e }) : /* @__PURE__ */ m(f, { children: [
|
|
17
|
+
e.slice(0, n),
|
|
18
|
+
/* @__PURE__ */ p("span", {
|
|
19
|
+
className: "font-semibold text-accent-11",
|
|
20
|
+
children: e.slice(n, n + t.length)
|
|
21
|
+
}),
|
|
22
|
+
e.slice(n + t.length)
|
|
23
|
+
] });
|
|
24
|
+
}
|
|
25
|
+
var y = d.forwardRef(({ options: f, value: y, defaultValue: b = null, onValueChange: x, placeholder: S, emptyText: C = "No options", disabled: w, size: T, state: E, isLoading: D = !1, loadingText: O = "Loading…", renderOption: k, className: A, id: j, ...M }, N) => {
|
|
26
|
+
let te = d.useId(), P = j || te, F = `${P}-listbox`, I = `${P}-option`, L = y !== void 0, [R, z] = d.useState(b), B = L ? y : R, [V, H] = d.useState(B?.label ?? ""), [U, W] = d.useState(!1), [G, K] = d.useState(-1), q = d.useRef(null), J = d.useRef(null), Y = d.useRef(null), { reducedMotion: X } = l(), { refs: Z, floatingStyles: ne } = a({
|
|
27
|
+
open: U,
|
|
27
28
|
placement: "bottom-start",
|
|
28
29
|
whileElementsMounted: e,
|
|
29
30
|
middleware: [
|
|
@@ -37,110 +38,114 @@ var g = {
|
|
|
37
38
|
});
|
|
38
39
|
} })
|
|
39
40
|
]
|
|
40
|
-
}),
|
|
41
|
-
|
|
42
|
-
}, [
|
|
43
|
-
|
|
44
|
-
}, [
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
41
|
+
}), re = d.useCallback((e) => {
|
|
42
|
+
J.current = e, Z.setReference(e);
|
|
43
|
+
}, [Z]), ie = d.useCallback((e) => {
|
|
44
|
+
q.current = e, typeof N == "function" ? N(e) : N && (N.current = e);
|
|
45
|
+
}, [N]), ae = d.useCallback((e) => {
|
|
46
|
+
Y.current = e, Z.setFloating(e);
|
|
47
|
+
}, [Z]);
|
|
48
|
+
d.useEffect(() => {
|
|
49
|
+
H(B?.label ?? "");
|
|
50
|
+
}, [B]);
|
|
51
|
+
let Q = d.useMemo(() => V ? f.filter((e) => e.label.toLowerCase().includes(V.toLowerCase())) : f, [f, V]), $ = d.useCallback((e) => {
|
|
52
|
+
H(e.label), W(!1), K(-1), L || z(e), x?.(e);
|
|
53
|
+
}, [L, x]), oe = d.useCallback((e) => {
|
|
54
|
+
if (!w) {
|
|
55
|
+
if (!U) {
|
|
56
|
+
(e.key === "ArrowDown" || e.key === "Enter") && W(!0);
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
switch (e.key) {
|
|
60
|
+
case "ArrowDown":
|
|
61
|
+
e.preventDefault(), K((e) => Math.min(e + 1, Q.length - 1));
|
|
62
|
+
break;
|
|
63
|
+
case "ArrowUp":
|
|
64
|
+
e.preventDefault(), K((e) => Math.max(e - 1, 0));
|
|
65
|
+
break;
|
|
66
|
+
case "Home":
|
|
67
|
+
e.preventDefault(), K(0);
|
|
68
|
+
break;
|
|
69
|
+
case "End":
|
|
70
|
+
e.preventDefault(), K(Q.length - 1);
|
|
71
|
+
break;
|
|
72
|
+
case "Enter":
|
|
73
|
+
e.preventDefault(), G >= 0 && Q[G] && $(Q[G]);
|
|
74
|
+
break;
|
|
75
|
+
case "Escape":
|
|
76
|
+
W(!1), K(-1);
|
|
77
|
+
break;
|
|
78
|
+
}
|
|
74
79
|
}
|
|
75
80
|
}, [
|
|
76
|
-
|
|
81
|
+
w,
|
|
82
|
+
U,
|
|
83
|
+
Q,
|
|
77
84
|
G,
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
ref: U,
|
|
85
|
+
$
|
|
86
|
+
]), se = u(), ce = !!(j || se.inputId), le = G >= 0 ? `${I}-${G}` : void 0;
|
|
87
|
+
return /* @__PURE__ */ m("div", {
|
|
88
|
+
ref: re,
|
|
89
|
+
className: s("relative", A),
|
|
90
|
+
...M,
|
|
91
|
+
children: [/* @__PURE__ */ p(ee, {
|
|
92
|
+
ref: ie,
|
|
87
93
|
type: "text",
|
|
88
94
|
role: "combobox",
|
|
89
|
-
|
|
90
|
-
|
|
95
|
+
size: T,
|
|
96
|
+
state: E,
|
|
97
|
+
id: j,
|
|
98
|
+
value: V,
|
|
99
|
+
placeholder: S,
|
|
100
|
+
disabled: w,
|
|
101
|
+
"aria-expanded": U,
|
|
91
102
|
"aria-autocomplete": "list",
|
|
92
|
-
"aria-controls":
|
|
93
|
-
"aria-activedescendant":
|
|
94
|
-
"aria-
|
|
95
|
-
"
|
|
96
|
-
"aria-required": Z || void 0,
|
|
97
|
-
"aria-label": w || J.inputId ? void 0 : b,
|
|
98
|
-
value: j,
|
|
99
|
-
placeholder: b,
|
|
100
|
-
disabled: S,
|
|
101
|
-
className: c("flex h-ds-md w-full rounded-control border border-surface-border-strong bg-surface-raised-hover px-ds-04 py-ds-03 font-sans text-body-md text-surface-fg placeholder:text-surface-fg-subtle", "outline-hidden focus-visible:ring-2 focus-visible:ring-accent-9 focus-visible:ring-offset-[var(--border-focus-offset)]", "transition-colors duration-fast-01", S && "opacity-action-disabled cursor-not-allowed"),
|
|
103
|
+
"aria-controls": U ? F : void 0,
|
|
104
|
+
"aria-activedescendant": le,
|
|
105
|
+
"aria-label": ce ? void 0 : S,
|
|
106
|
+
endSection: D ? /* @__PURE__ */ p(c, { size: "sm" }) : void 0,
|
|
102
107
|
onChange: (e) => {
|
|
103
|
-
|
|
108
|
+
H(e.target.value), W(!0), K(-1);
|
|
104
109
|
},
|
|
105
|
-
onFocus: () =>
|
|
110
|
+
onFocus: () => W(!0),
|
|
106
111
|
onBlur: (e) => {
|
|
107
112
|
let t = e.relatedTarget;
|
|
108
|
-
!
|
|
113
|
+
!J.current?.contains(t) && !Y.current?.contains(t) && W(!1);
|
|
109
114
|
},
|
|
110
|
-
onKeyDown:
|
|
111
|
-
}), typeof document < "u" &&
|
|
112
|
-
id:
|
|
113
|
-
ref:
|
|
115
|
+
onKeyDown: oe
|
|
116
|
+
}), typeof document < "u" && h(/* @__PURE__ */ p(g, { children: U && /* @__PURE__ */ p(_.ul, {
|
|
117
|
+
id: F,
|
|
118
|
+
ref: ae,
|
|
114
119
|
role: "listbox",
|
|
115
|
-
initial:
|
|
116
|
-
animate:
|
|
117
|
-
exit:
|
|
118
|
-
|
|
119
|
-
style:
|
|
120
|
-
className:
|
|
121
|
-
children:
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
120
|
+
initial: !X && { opacity: 0 },
|
|
121
|
+
animate: { opacity: 1 },
|
|
122
|
+
exit: X ? { opacity: 1 } : { opacity: 0 },
|
|
123
|
+
transition: X ? { duration: 0 } : o.fade,
|
|
124
|
+
style: ne,
|
|
125
|
+
className: "z-popover overflow-auto rounded-overlay bg-surface-overlay shadow-raised-hover",
|
|
126
|
+
children: D ? /* @__PURE__ */ m("li", {
|
|
127
|
+
className: "flex items-center gap-ds-03 px-ds-04 py-ds-03 text-body-md text-surface-fg-muted",
|
|
128
|
+
children: [/* @__PURE__ */ p(c, { size: "sm" }), O]
|
|
129
|
+
}) : Q.length === 0 ? /* @__PURE__ */ p("li", {
|
|
125
130
|
className: "px-ds-04 py-ds-03 text-body-md text-surface-fg-muted",
|
|
126
|
-
children:
|
|
127
|
-
}) :
|
|
128
|
-
id: `${
|
|
131
|
+
children: C
|
|
132
|
+
}) : Q.map((e, t) => /* @__PURE__ */ p("li", {
|
|
133
|
+
id: `${I}-${t}`,
|
|
129
134
|
role: "option",
|
|
130
|
-
"aria-selected":
|
|
131
|
-
|
|
132
|
-
className:
|
|
135
|
+
"aria-selected": G === t,
|
|
136
|
+
title: e.label,
|
|
137
|
+
className: s("cursor-pointer truncate px-ds-04 py-ds-03 text-body-md text-surface-fg transition-colors duration-fast-01", G === t && "bg-accent-3", B?.value === e.value && "font-semibold"),
|
|
133
138
|
onMouseDown: (e) => e.preventDefault(),
|
|
134
|
-
onClick: () =>
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
139
|
+
onClick: () => $(e),
|
|
140
|
+
onMouseEnter: () => K(t),
|
|
141
|
+
children: k ? k(e, V) : /* @__PURE__ */ p(v, {
|
|
142
|
+
label: e.label,
|
|
143
|
+
query: V
|
|
144
|
+
})
|
|
140
145
|
}, e.value))
|
|
141
146
|
}) }), document.body)]
|
|
142
147
|
});
|
|
143
148
|
});
|
|
144
|
-
|
|
149
|
+
y.displayName = "Autocomplete";
|
|
145
150
|
//#endregion
|
|
146
|
-
export {
|
|
151
|
+
export { y as Autocomplete };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"autocomplete.js","names":[],"sources":["../../src/ui/autocomplete.tsx"],"sourcesContent":["'use client'\n\nimport { autoUpdate,flip, offset, shift, size, useFloating } from '@floating-ui/react-dom'\nimport { AnimatePresence,motion } from 'framer-motion'\nimport * as React from 'react'\nimport { createPortal } from 'react-dom'\n\nimport { useFormField } from './form'\nimport { springs, tweens } from './lib/motion'\nimport { cn } from './lib/utils'\n\nconst listVariants = {\n hidden: {},\n visible: { transition: { staggerChildren: 0.03 } },\n}\n\nconst itemVariants = {\n hidden: { opacity: 0, y: 4 },\n visible: { opacity: 1, y: 0, transition: springs.snappy },\n}\n\ntype AutocompleteOption = {\n label: string\n value: string\n}\n\n/**\n * Props for Autocomplete — a free-text input with a live-filtered dropdown list, keyboard\n * navigation, and ARIA combobox semantics. Suitable for \"type to search\" fields where the\n * full list is known ahead of time (client-side filtering only).\n *\n * **Key distinction from Combobox:** Autocomplete allows free-text input (no forced selection),\n * while `<Combobox>` enforces selection from the list. Use Autocomplete for search-as-you-type\n * with suggestions; use Combobox for structured single or multi-select dropdowns.\n *\n * **`value`:** A full `AutocompleteOption` object (or null), not just the string value.\n * The input's text is synced to `value.label` on mount.\n *\n * @example\n * // City search autocomplete:\n * <Autocomplete\n * options={[{ value: 'mumbai', label: 'Mumbai' }, { value: 'delhi', label: 'Delhi' }]}\n * value={selectedCity}\n * onValueChange={(opt) => setSelectedCity(opt)}\n * placeholder=\"Search cities...\"\n * />\n *\n * @example\n * // Employee name lookup with custom empty text:\n * <Autocomplete\n * options={employees.map(e => ({ value: e.id, label: e.fullName }))}\n * onValueChange={(opt) => setAssignee(opt.value)}\n * emptyText=\"No employees found\"\n * placeholder=\"Search employees...\"\n * />\n * // These are just a few ways — feel free to combine props creatively!\n */\ntype AutocompleteProps = React.HTMLAttributes<HTMLDivElement> & {\n options: AutocompleteOption[]\n value?: AutocompleteOption | null\n onValueChange?: (option: AutocompleteOption) => void\n placeholder?: string\n emptyText?: string\n disabled?: boolean\n className?: string\n id?: string\n}\n\nconst Autocomplete = React.forwardRef<HTMLInputElement, AutocompleteProps>(\n (\n {\n options,\n value,\n onValueChange,\n placeholder,\n emptyText = 'No options',\n disabled,\n className,\n id: externalId,\n ...props\n },\n ref,\n ) => {\n const internalId = React.useId()\n const baseId = externalId || internalId\n const listboxId = `${baseId}-listbox`\n const optionIdPrefix = `${baseId}-option`\n\n const [query, setQuery] = React.useState(value?.label ?? '')\n const [isOpen, setIsOpen] = React.useState(false)\n const [highlightedIndex, setHighlightedIndex] = React.useState(-1)\n const internalRef = React.useRef<HTMLInputElement>(null)\n const listRef = React.useRef<HTMLUListElement>(null)\n const containerRef = React.useRef<HTMLDivElement>(null)\n const floatingRef = React.useRef<HTMLUListElement>(null)\n\n // Floating UI positioning\n const { refs, floatingStyles } = useFloating({\n open: isOpen,\n placement: 'bottom-start',\n whileElementsMounted: autoUpdate,\n middleware: [\n offset(4),\n flip(),\n shift(),\n size({\n apply({ availableHeight, rects, elements }) {\n Object.assign(elements.floating.style, {\n maxHeight: `${Math.min(availableHeight, 240)}px`,\n width: `${rects.reference.width}px`,\n })\n },\n }),\n ],\n })\n\n // Compose external + internal ref + floating reference ref for input\n const composedRef = React.useCallback(\n (node: HTMLInputElement | null) => {\n (internalRef as React.MutableRefObject<HTMLInputElement | null>).current = node\n refs.setReference(node)\n if (typeof ref === 'function') ref(node)\n else if (ref) (ref as React.MutableRefObject<HTMLInputElement | null>).current = node\n },\n [ref, refs],\n )\n\n // Compose floating ref + listRef\n const composedFloatingRef = React.useCallback(\n (node: HTMLUListElement | null) => {\n (listRef as React.MutableRefObject<HTMLUListElement | null>).current = node\n ;(floatingRef as React.MutableRefObject<HTMLUListElement | null>).current = node\n refs.setFloating(node)\n },\n [refs],\n )\n\n // Sync query when value changes externally\n React.useEffect(() => {\n setQuery(value?.label ?? '')\n }, [value])\n\n // Cleanup blur timeout on unmount\n React.useEffect(() => {\n return () => {\n // Option selected — close and blur handled by relatedTarget check\n }\n }, [])\n\n const filtered = React.useMemo(\n () =>\n query\n ? options.filter((o) => o.label.toLowerCase().includes(query.toLowerCase()))\n : options,\n [options, query],\n )\n\n const handleSelect = React.useCallback(\n (option: AutocompleteOption) => {\n setQuery(option.label)\n setIsOpen(false)\n setHighlightedIndex(-1)\n onValueChange?.(option)\n },\n [onValueChange],\n )\n\n const handleKeyDown = React.useCallback(\n (e: React.KeyboardEvent) => {\n if (!isOpen) {\n if (e.key === 'ArrowDown' || e.key === 'Enter') setIsOpen(true)\n return\n }\n switch (e.key) {\n case 'ArrowDown':\n e.preventDefault()\n setHighlightedIndex((i) => Math.min(i + 1, filtered.length - 1))\n break\n case 'ArrowUp':\n e.preventDefault()\n setHighlightedIndex((i) => Math.max(i - 1, 0))\n break\n case 'Home':\n e.preventDefault()\n setHighlightedIndex(0)\n break\n case 'End':\n e.preventDefault()\n setHighlightedIndex(filtered.length - 1)\n break\n case 'Enter':\n e.preventDefault()\n if (highlightedIndex >= 0 && filtered[highlightedIndex]) {\n handleSelect(filtered[highlightedIndex])\n }\n break\n case 'Escape':\n setIsOpen(false)\n setHighlightedIndex(-1)\n break\n }\n },\n [isOpen, filtered, highlightedIndex, handleSelect],\n )\n\n const fieldCtx = useFormField()\n const isError = fieldCtx.state === 'error'\n const ariaDescribedBy = fieldCtx.helperTextId\n const ariaRequired = fieldCtx.required\n\n const highlightedOptionId =\n highlightedIndex >= 0 ? `${optionIdPrefix}-${highlightedIndex}` : undefined\n\n return (\n <div ref={containerRef} className={cn('relative', className)} {...props}>\n <input\n ref={composedRef}\n type=\"text\"\n role=\"combobox\"\n // Explicit id wins; otherwise adopt FormField's inputId so <Label htmlFor> resolves.\n id={externalId ?? fieldCtx.inputId}\n aria-expanded={isOpen}\n aria-autocomplete=\"list\"\n aria-controls={isOpen ? listboxId : undefined}\n aria-activedescendant={highlightedOptionId}\n aria-invalid={isError || undefined}\n aria-describedby={ariaDescribedBy}\n aria-required={ariaRequired || undefined}\n // Named by the associated <Label> (FormField) or an external label via id.\n // Only when there's no association mechanism, fall back to placeholder.\n aria-label={externalId || fieldCtx.inputId ? undefined : placeholder}\n value={query}\n placeholder={placeholder}\n disabled={disabled}\n className={cn(\n 'flex h-ds-md w-full rounded-control border border-surface-border-strong bg-surface-raised-hover px-ds-04 py-ds-03 font-sans text-body-md text-surface-fg placeholder:text-surface-fg-subtle',\n 'outline-hidden focus-visible:ring-2 focus-visible:ring-accent-9 focus-visible:ring-offset-[var(--border-focus-offset)]',\n 'transition-colors duration-fast-01',\n disabled && 'opacity-action-disabled cursor-not-allowed',\n )}\n onChange={(e) => {\n setQuery(e.target.value)\n setIsOpen(true)\n setHighlightedIndex(-1)\n }}\n onFocus={() => setIsOpen(true)}\n onBlur={(e) => {\n // Close only if focus moved outside both the container and the portal dropdown\n const target = e.relatedTarget as Node | null\n if (\n !containerRef.current?.contains(target) &&\n !floatingRef.current?.contains(target)\n ) {\n setIsOpen(false)\n }\n }}\n onKeyDown={handleKeyDown}\n />\n {typeof document !== 'undefined' &&\n createPortal(\n <AnimatePresence>\n {isOpen && (\n <motion.ul\n id={listboxId}\n ref={composedFloatingRef}\n role=\"listbox\"\n initial=\"hidden\"\n animate=\"visible\"\n exit=\"hidden\"\n variants={listVariants}\n style={floatingStyles}\n className={cn(\n 'z-popover overflow-auto rounded-overlay bg-surface-overlay shadow-raised-hover',\n )}\n >\n {filtered.length === 0 ? (\n <motion.li\n initial={{ opacity: 0 }}\n animate={{ opacity: 1 }}\n transition={tweens.fade}\n className=\"px-ds-04 py-ds-03 text-body-md text-surface-fg-muted\"\n >\n {emptyText}\n </motion.li>\n ) : (\n filtered.map((option, index) => (\n <motion.li\n key={option.value}\n id={`${optionIdPrefix}-${index}`}\n role=\"option\"\n aria-selected={highlightedIndex === index}\n variants={itemVariants}\n className={cn(\n 'cursor-pointer px-ds-04 py-ds-03 text-body-md text-surface-fg transition-colors duration-fast-01',\n highlightedIndex === index && 'bg-accent-3',\n value?.value === option.value && 'font-semibold',\n )}\n onMouseDown={(e) => e.preventDefault()}\n onClick={() => handleSelect(option)}\n onKeyDown={(e) => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault()\n handleSelect(option)\n }\n }}\n onMouseEnter={() => setHighlightedIndex(index)}\n >\n {option.label}\n </motion.li>\n ))\n )}\n </motion.ul>\n )}\n </AnimatePresence>,\n document.body,\n )}\n </div>\n )\n },\n)\nAutocomplete.displayName = 'Autocomplete'\n\nexport { Autocomplete, type AutocompleteOption,type AutocompleteProps }\n"],"mappings":";;;;;;;;;;AAWA,IAAM,IAAe;CACnB,QAAQ,CAAC;CACT,SAAS,EAAE,YAAY,EAAE,iBAAiB,IAAK,EAAE;AACnD,GAEM,IAAe;CACnB,QAAQ;EAAE,SAAS;EAAG,GAAG;CAAE;CAC3B,SAAS;EAAE,SAAS;EAAG,GAAG;EAAG,YAAY,EAAQ;CAAO;AAC1D,GAiDM,IAAe,EAAM,YAEvB,EACE,YACA,UACA,kBACA,gBACA,eAAY,cACZ,aACA,cACA,IAAI,GACJ,GAAG,KAEL,MACG;CACH,IAAM,IAAa,EAAM,MAAM,GACz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H,CACZ;EAEM,CAAA,EAEE,CAAA,GACjB,SAAS,IACX,CACC;;AAET,CACF;AACA,EAAa,cAAc"}
|
|
1
|
+
{"version":3,"file":"autocomplete.js","names":[],"sources":["../../src/ui/autocomplete.tsx"],"sourcesContent":["'use client'\n\nimport { autoUpdate, flip, offset, shift, size as sizeMiddleware, useFloating } from '@floating-ui/react-dom'\nimport { AnimatePresence, motion } from 'framer-motion'\nimport * as React from 'react'\nimport { createPortal } from 'react-dom'\n\nimport { useMotion } from '../motion/motion-provider'\nimport { useFormField } from './form'\nimport { Input, type InputProps } from './input'\nimport { tweens } from './lib/motion'\nimport { cn } from './lib/utils'\nimport { Spinner } from './spinner'\n\nexport type AutocompleteOption = {\n label: string\n value: string\n}\n\n/**\n * A free-text input with a live-filtered dropdown, keyboard navigation, and\n * combobox ARIA. The field itself is the DS `Input`, so it inherits size,\n * error/state painting, read-only, hover, and FormField wiring.\n *\n * Free-text (no forced selection) — for enforced selection use `Combobox`.\n * `value`/`defaultValue` are a full `AutocompleteOption` (or null).\n */\nexport type AutocompleteProps = Omit<React.HTMLAttributes<HTMLDivElement>, 'onChange'> & {\n options: AutocompleteOption[]\n /** Controlled selection. */\n value?: AutocompleteOption | null\n /** Initial selection for uncontrolled mode. */\n defaultValue?: AutocompleteOption | null\n onValueChange?: (option: AutocompleteOption) => void\n placeholder?: string\n emptyText?: string\n disabled?: boolean\n /** Input size (forwarded to the composed `Input`). */\n size?: InputProps['size']\n /** Field state (forwarded to `Input`); overrides FormField auto-consumption. */\n state?: InputProps['state']\n /** Show a loading spinner + `loadingText` (async \"type to search\"). */\n isLoading?: boolean\n loadingText?: string\n /** Custom option renderer. Receives the option and the current query. */\n renderOption?: (option: AutocompleteOption, query: string) => React.ReactNode\n className?: string\n id?: string\n}\n\n/** Bold the matched substring inside an option label. */\nfunction HighlightMatch({ label, query }: { label: string; query: string }) {\n const idx = query ? label.toLowerCase().indexOf(query.toLowerCase()) : -1\n if (idx === -1) return <>{label}</>\n return (\n <>\n {label.slice(0, idx)}\n <span className=\"font-semibold text-accent-11\">{label.slice(idx, idx + query.length)}</span>\n {label.slice(idx + query.length)}\n </>\n )\n}\n\nconst Autocomplete = React.forwardRef<HTMLInputElement, AutocompleteProps>(\n (\n {\n options,\n value,\n defaultValue = null,\n onValueChange,\n placeholder,\n emptyText = 'No options',\n disabled,\n size,\n state,\n isLoading = false,\n loadingText = 'Loading…',\n renderOption,\n className,\n id: externalId,\n ...props\n },\n ref,\n ) => {\n const internalId = React.useId()\n const baseId = externalId || internalId\n const listboxId = `${baseId}-listbox`\n const optionIdPrefix = `${baseId}-option`\n\n // Controlled / uncontrolled selection\n const isControlled = value !== undefined\n const [internalValue, setInternalValue] = React.useState<AutocompleteOption | null>(defaultValue)\n const selected = isControlled ? value : internalValue\n\n const [query, setQuery] = React.useState(selected?.label ?? '')\n const [isOpen, setIsOpen] = React.useState(false)\n const [highlightedIndex, setHighlightedIndex] = React.useState(-1)\n const internalRef = React.useRef<HTMLInputElement>(null)\n const containerRef = React.useRef<HTMLDivElement>(null)\n const floatingRef = React.useRef<HTMLUListElement>(null)\n const { reducedMotion } = useMotion()\n\n // Floating UI — anchor the dropdown to the whole field (container width)\n const { refs, floatingStyles } = useFloating({\n open: isOpen,\n placement: 'bottom-start',\n whileElementsMounted: autoUpdate,\n middleware: [\n offset(4),\n flip(),\n shift(),\n sizeMiddleware({\n apply({ availableHeight, rects, elements }) {\n Object.assign(elements.floating.style, {\n maxHeight: `${Math.min(availableHeight, 240)}px`,\n width: `${rects.reference.width}px`,\n })\n },\n }),\n ],\n })\n\n const setContainer = React.useCallback(\n (node: HTMLDivElement | null) => {\n containerRef.current = node\n refs.setReference(node)\n },\n [refs],\n )\n\n const composedInputRef = React.useCallback(\n (node: HTMLInputElement | null) => {\n internalRef.current = node\n if (typeof ref === 'function') ref(node)\n else if (ref) (ref as React.MutableRefObject<HTMLInputElement | null>).current = node\n },\n [ref],\n )\n\n const setFloating = React.useCallback(\n (node: HTMLUListElement | null) => {\n floatingRef.current = node\n refs.setFloating(node)\n },\n [refs],\n )\n\n // Sync query when the selection changes externally\n React.useEffect(() => {\n setQuery(selected?.label ?? '')\n }, [selected])\n\n const filtered = React.useMemo(\n () =>\n query\n ? options.filter((o) => o.label.toLowerCase().includes(query.toLowerCase()))\n : options,\n [options, query],\n )\n\n const handleSelect = React.useCallback(\n (option: AutocompleteOption) => {\n setQuery(option.label)\n setIsOpen(false)\n setHighlightedIndex(-1)\n if (!isControlled) setInternalValue(option)\n onValueChange?.(option)\n },\n [isControlled, onValueChange],\n )\n\n const handleKeyDown = React.useCallback(\n (e: React.KeyboardEvent) => {\n if (disabled) return\n if (!isOpen) {\n if (e.key === 'ArrowDown' || e.key === 'Enter') setIsOpen(true)\n return\n }\n switch (e.key) {\n case 'ArrowDown':\n e.preventDefault()\n setHighlightedIndex((i) => Math.min(i + 1, filtered.length - 1))\n break\n case 'ArrowUp':\n e.preventDefault()\n setHighlightedIndex((i) => Math.max(i - 1, 0))\n break\n case 'Home':\n e.preventDefault()\n setHighlightedIndex(0)\n break\n case 'End':\n e.preventDefault()\n setHighlightedIndex(filtered.length - 1)\n break\n case 'Enter':\n e.preventDefault()\n if (highlightedIndex >= 0 && filtered[highlightedIndex]) handleSelect(filtered[highlightedIndex])\n break\n case 'Escape':\n setIsOpen(false)\n setHighlightedIndex(-1)\n break\n }\n },\n [disabled, isOpen, filtered, highlightedIndex, handleSelect],\n )\n\n // FormField wiring is auto-consumed by Input; only used here to decide the\n // standalone accessible-name fallback + the combobox aria-controls id.\n const fieldCtx = useFormField()\n const hasFieldName = !!(externalId || fieldCtx.inputId)\n const highlightedOptionId = highlightedIndex >= 0 ? `${optionIdPrefix}-${highlightedIndex}` : undefined\n\n return (\n <div ref={setContainer} className={cn('relative', className)} {...props}>\n <Input\n ref={composedInputRef}\n type=\"text\"\n role=\"combobox\"\n size={size}\n state={state}\n id={externalId}\n value={query}\n placeholder={placeholder}\n disabled={disabled}\n aria-expanded={isOpen}\n aria-autocomplete=\"list\"\n aria-controls={isOpen ? listboxId : undefined}\n aria-activedescendant={highlightedOptionId}\n aria-label={hasFieldName ? undefined : placeholder}\n endSection={isLoading ? <Spinner size=\"sm\" /> : undefined}\n onChange={(e) => {\n setQuery(e.target.value)\n setIsOpen(true)\n setHighlightedIndex(-1)\n }}\n onFocus={() => setIsOpen(true)}\n onBlur={(e) => {\n const target = e.relatedTarget as Node | null\n if (!containerRef.current?.contains(target) && !floatingRef.current?.contains(target)) {\n setIsOpen(false)\n }\n }}\n onKeyDown={handleKeyDown}\n />\n {typeof document !== 'undefined' &&\n createPortal(\n <AnimatePresence>\n {isOpen && (\n <motion.ul\n id={listboxId}\n ref={setFloating}\n role=\"listbox\"\n initial={reducedMotion ? false : { opacity: 0 }}\n animate={{ opacity: 1 }}\n exit={reducedMotion ? { opacity: 1 } : { opacity: 0 }}\n transition={reducedMotion ? { duration: 0 } : tweens.fade}\n style={floatingStyles}\n className=\"z-popover overflow-auto rounded-overlay bg-surface-overlay shadow-raised-hover\"\n >\n {isLoading ? (\n <li className=\"flex items-center gap-ds-03 px-ds-04 py-ds-03 text-body-md text-surface-fg-muted\">\n <Spinner size=\"sm\" />\n {loadingText}\n </li>\n ) : filtered.length === 0 ? (\n <li className=\"px-ds-04 py-ds-03 text-body-md text-surface-fg-muted\">{emptyText}</li>\n ) : (\n filtered.map((option, index) => (\n // eslint-disable-next-line jsx-a11y/click-events-have-key-events -- WAI-ARIA combobox: keyboard nav is on the input via aria-activedescendant; options are pointer affordances, not focusable tab stops\n <li\n key={option.value}\n id={`${optionIdPrefix}-${index}`}\n role=\"option\"\n aria-selected={highlightedIndex === index}\n title={option.label}\n className={cn(\n 'cursor-pointer truncate px-ds-04 py-ds-03 text-body-md text-surface-fg transition-colors duration-fast-01',\n highlightedIndex === index && 'bg-accent-3',\n selected?.value === option.value && 'font-semibold',\n )}\n onMouseDown={(e) => e.preventDefault()}\n onClick={() => handleSelect(option)}\n onMouseEnter={() => setHighlightedIndex(index)}\n >\n {renderOption ? renderOption(option, query) : <HighlightMatch label={option.label} query={query} />}\n </li>\n ))\n )}\n </motion.ul>\n )}\n </AnimatePresence>,\n document.body,\n )}\n </div>\n )\n },\n)\nAutocomplete.displayName = 'Autocomplete'\n\nexport { Autocomplete }\n"],"mappings":";;;;;;;;;;;;;AAmDA,SAAS,EAAe,EAAE,UAAO,YAA2C;CAC1E,IAAM,IAAM,IAAQ,EAAM,YAAY,CAAC,CAAC,QAAQ,EAAM,YAAY,CAAC,IAAI;CAEvE,OADI,MAAQ,KAAW,kBAAA,GAAA,EAAA,UAAG,EAAQ,CAAA,IAEhC,kBAAA,GAAA,EAAA,UAAA;EACG,EAAM,MAAM,GAAG,CAAG;EACnB,kBAAC,QAAD;GAAM,WAAU;aAAgC,EAAM,MAAM,GAAK,IAAM,EAAM,MAAM;EAAQ,CAAA;EAC1F,EAAM,MAAM,IAAM,EAAM,MAAM;CAC/B,EAAA,CAAA;AAEN;AAEA,IAAM,IAAe,EAAM,YAEvB,EACE,YACA,UACA,kBAAe,MACf,kBACA,gBACA,eAAY,cACZ,aACA,MAAA,GACA,UACA,eAAY,IACZ,iBAAc,YACd,iBACA,cACA,IAAI,GACJ,GAAG,KAEL,MACG;CACH,IAAM,KAAa,EAAM,MAAM,GACzB,IAAS,KAAc,IACvB,IAAY,GAAG,EAAO,WACtB,IAAiB,GAAG,EAAO,UAG3B,IAAe,MAAU,KAAA,GACzB,CAAC,GAAe,KAAoB,EAAM,SAAoC,CAAY,GAC1F,IAAW,IAAe,IAAQ,GAElC,CAAC,GAAO,KAAY,EAAM,SAAS,GAAU,SAAS,EAAE,GACxD,CAAC,GAAQ,KAAa,EAAM,SAAS,EAAK,GAC1C,CAAC,GAAkB,KAAuB,EAAM,SAAS,EAAE,GAC3D,IAAc,EAAM,OAAyB,IAAI,GACjD,IAAe,EAAM,OAAuB,IAAI,GAChD,IAAc,EAAM,OAAyB,IAAI,GACjD,EAAE,qBAAkB,EAAU,GAG9B,EAAE,SAAM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AS,SAAS,CAAM,KAAK,CAAC,EAAY,SAAS,SAAS,CAAM,KAClF,EAAU,EAAK;GAEnB;GACA,WAAW;EACZ,CAAA,GACA,OAAO,WAAa,OACnB,EACE,kBAAC,GAAD,EAAA,UACG,KACC,kBAAC,EAAO,IAAR;GACE,IAAI;GACJ,KAAK;GACL,MAAK;GACL,SAAS,MAAwB,EAAE,SAAS,EAAE;GAC9C,SAAS,EAAE,SAAS,EAAE;GACtB,MAAM,IAAgB,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE;GACpD,YAAY,IAAgB,EAAE,UAAU,EAAE,IAAI,EAAO;GACrD,OAAO;GACP,WAAU;aAET,IACC,kBAAC,MAAD;IAAI,WAAU;cAAd,CACE,kBAAC,GAAD,EAAS,MAAK,KAAM,CAAA,GACnB,CACC;QACF,EAAS,WAAW,IACtB,kBAAC,MAAD;IAAI,WAAU;cAAwD;GAAc,CAAA,IAEpF,EAAS,KAAK,GAAQ,MAEpB,kBAAC,MAAD;IAEE,IAAI,GAAG,EAAe,GAAG;IACzB,MAAK;IACL,iBAAe,MAAqB;IACpC,OAAO,EAAO;IACd,WAAW,EACT,6GACA,MAAqB,KAAS,eAC9B,GAAU,UAAU,EAAO,SAAS,eACtC;IACA,cAAc,MAAM,EAAE,eAAe;IACrC,eAAe,EAAa,CAAM;IAClC,oBAAoB,EAAoB,CAAK;cAE5C,IAAe,EAAa,GAAQ,CAAK,IAAI,kBAAC,GAAD;KAAgB,OAAO,EAAO;KAAc;IAAQ,CAAA;GAChG,GAfG,EAAO,KAeV,CACL;EAEM,CAAA,EAEE,CAAA,GACjB,SAAS,IACX,CACC;;AAET,CACF;AACA,EAAa,cAAc"}
|
package/dist/ui/combobox.js
CHANGED
|
@@ -6,8 +6,8 @@ import { cva as o } from "../_chunks/vendor-utils.js";
|
|
|
6
6
|
import { cn as s } from "./lib/utils.js";
|
|
7
7
|
import { Icon as c } from "./icon.js";
|
|
8
8
|
import { useFormField as te } from "./form.js";
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
9
|
+
import { resolveFieldState as ne } from "../_chunks/field-state.js";
|
|
10
|
+
import { normalizeIcon as re } from "../_chunks/normalize-icon.js";
|
|
11
11
|
import * as l from "react";
|
|
12
12
|
import { Fragment as u, jsx as d, jsxs as f } from "react/jsx-runtime";
|
|
13
13
|
import { IconCheck as p, IconChevronDown as m, IconSearch as ie, IconX as ae } from "@tabler/icons-react";
|
|
@@ -166,7 +166,7 @@ var se = {
|
|
|
166
166
|
className: "min-w-0 flex-1 truncate text-left text-surface-fg-subtle",
|
|
167
167
|
children: C
|
|
168
168
|
});
|
|
169
|
-
}, Q = te(), $ =
|
|
169
|
+
}, Q = te(), $ = ne(N, Q.state), ve = $ === "error", ye = Q.helperTextId, be = Q.required;
|
|
170
170
|
return /* @__PURE__ */ d(n, {
|
|
171
171
|
open: L,
|
|
172
172
|
onOpenChange: fe,
|
|
@@ -270,7 +270,7 @@ var se = {
|
|
|
270
270
|
className: "flex h-ico-sm w-ico-sm items-center justify-center shrink-0",
|
|
271
271
|
children: /* @__PURE__ */ d(ee, {
|
|
272
272
|
size: Z,
|
|
273
|
-
children:
|
|
273
|
+
children: re(e.icon)
|
|
274
274
|
})
|
|
275
275
|
}),
|
|
276
276
|
/* @__PURE__ */ d("span", {
|
package/dist/ui/index.js
CHANGED
|
@@ -9,35 +9,35 @@ import { AlertDialog as d, AlertDialogAction as f, AlertDialogCancel as p, Alert
|
|
|
9
9
|
import { Alert as S, alertVariants as C } from "./alert.js";
|
|
10
10
|
import { AspectRatio as w } from "./aspect-ratio.js";
|
|
11
11
|
import { FormField as T, FormHelperText as E, useFormField as D } from "./form.js";
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
30
|
-
import {
|
|
31
|
-
import {
|
|
32
|
-
import {
|
|
33
|
-
import {
|
|
34
|
-
import {
|
|
35
|
-
import {
|
|
36
|
-
import {
|
|
37
|
-
import {
|
|
38
|
-
import {
|
|
39
|
-
import {
|
|
40
|
-
import {
|
|
12
|
+
import { Input as O, inputWrapperVariants as k } from "./input.js";
|
|
13
|
+
import { Autocomplete as A } from "./autocomplete.js";
|
|
14
|
+
import { Dot as j, dotVariants as M } from "./dot.js";
|
|
15
|
+
import { Skeleton as N, SkeletonAvatar as P, SkeletonButton as F, SkeletonChart as I, SkeletonGroup as L, SkeletonImage as R, SkeletonInput as z, SkeletonText as B, skeletonVariants as V } from "./skeleton.js";
|
|
16
|
+
import { Avatar as H, AvatarFallback as U, AvatarImage as W, avatarVariants as G } from "./avatar.js";
|
|
17
|
+
import { BadgeIndicator as K } from "./badge-indicator.js";
|
|
18
|
+
import { BadgeCompound as q, BadgeGroup as J, badgeVariants as Y } from "../_chunks/badge-group.js";
|
|
19
|
+
import { Banner as X, bannerVariants as Z } from "./banner.js";
|
|
20
|
+
import { Breadcrumb as re, BreadcrumbEllipsis as ie, BreadcrumbItem as ae, BreadcrumbLink as oe, BreadcrumbList as se, BreadcrumbPage as ce, BreadcrumbSeparator as le } from "./breadcrumb.js";
|
|
21
|
+
import { ButtonGroup as ue, useButtonGroup as de } from "./button-group.js";
|
|
22
|
+
import { Button as fe, buttonVariants as pe } from "./button.js";
|
|
23
|
+
import { Card as me, CardAction as he, CardBleed as ge, CardContent as _e, CardDescription as ve, CardFooter as ye, CardHeader as be, CardSection as xe, CardTitle as Se, cardVariants as Ce } from "./card.js";
|
|
24
|
+
import { Checkbox as we } from "./checkbox.js";
|
|
25
|
+
import { Code as Te } from "./code.js";
|
|
26
|
+
import { Collapsible as Ee, CollapsibleContent as De, CollapsibleTrigger as Oe } from "./collapsible.js";
|
|
27
|
+
import { Popover as ke, PopoverAnchor as Ae, PopoverContent as je, PopoverTrigger as Me } from "../_chunks/popover.js";
|
|
28
|
+
import { ColorInput as Ne } from "./color-input.js";
|
|
29
|
+
import { ColorSwatch as Pe } from "./color-swatch.js";
|
|
30
|
+
import { Combobox as Fe, comboboxTriggerVariants as Ie } from "./combobox.js";
|
|
31
|
+
import { Container as Le } from "./container.js";
|
|
32
|
+
import { ContextMenu as Re, ContextMenuCheckboxItem as ze, ContextMenuContent as Be, ContextMenuGroup as Ve, ContextMenuItem as He, ContextMenuLabel as Ue, ContextMenuPortal as We, ContextMenuRadioGroup as Ge, ContextMenuRadioItem as Ke, ContextMenuSeparator as qe, ContextMenuShortcut as Je, ContextMenuSub as Ye, ContextMenuSubContent as Xe, ContextMenuSubTrigger as Ze, ContextMenuTrigger as Qe } from "./context-menu.js";
|
|
33
|
+
import { Table as $e, TableBody as et, TableCaption as tt, TableCell as nt, TableFooter as rt, TableHead as it, TableHeader as at, TableRow as ot, TableRowActions as st } from "./table.js";
|
|
34
|
+
import { DropdownMenu as ct, DropdownMenuCheckboxItem as lt, DropdownMenuContent as ut, DropdownMenuGroup as dt, DropdownMenuItem as ft, DropdownMenuLabel as pt, DropdownMenuPortal as mt, DropdownMenuRadioGroup as ht, DropdownMenuRadioItem as gt, DropdownMenuSeparator as _t, DropdownMenuShortcut as vt, DropdownMenuSub as yt, DropdownMenuSubContent as bt, DropdownMenuSubTrigger as xt, DropdownMenuTrigger as St } from "./dropdown-menu.js";
|
|
35
|
+
import { DevalokGrain as Ct } from "./devalok-grain.js";
|
|
36
|
+
import { Dialog as wt, DialogClose as Tt, DialogContent as Et, DialogContentRaw as Dt, DialogDescription as Ot, DialogFooter as kt, DialogHeader as At, DialogOverlay as jt, DialogPortal as Mt, DialogTitle as Nt, DialogTrigger as Pt } from "./dialog.js";
|
|
37
|
+
import { FileUpload as Ft } from "./file-upload.js";
|
|
38
|
+
import { HoverCard as It, HoverCardContent as Lt, HoverCardTrigger as Rt } from "./hover-card.js";
|
|
39
|
+
import { IconButton as zt } from "./icon-button.js";
|
|
40
|
+
import { IconGroup as Bt } from "./icon-group.js";
|
|
41
41
|
import { Label as Vt } from "./label.js";
|
|
42
42
|
import { Separator as Ht } from "./separator.js";
|
|
43
43
|
import { SplitButton as Ut } from "./split-button.js";
|
|
@@ -90,4 +90,4 @@ function Oi() {
|
|
|
90
90
|
//#region src/ui/index.ts
|
|
91
91
|
Oi();
|
|
92
92
|
//#endregion
|
|
93
|
-
export { s as Accordion, c as AccordionContent, l as AccordionItem, u as AccordionTrigger, S as Alert, d as AlertDialog, f as AlertDialogAction, p as AlertDialogCancel, m as AlertDialogContent, h as AlertDialogDescription, g as AlertDialogFooter, _ as AlertDialogHeader, v as AlertDialogOverlay, y as AlertDialogPortal, b as AlertDialogTitle, x as AlertDialogTrigger, w as AspectRatio,
|
|
93
|
+
export { s as Accordion, c as AccordionContent, l as AccordionItem, u as AccordionTrigger, S as Alert, d as AlertDialog, f as AlertDialogAction, p as AlertDialogCancel, m as AlertDialogContent, h as AlertDialogDescription, g as AlertDialogFooter, _ as AlertDialogHeader, v as AlertDialogOverlay, y as AlertDialogPortal, b as AlertDialogTitle, x as AlertDialogTrigger, w as AspectRatio, A as Autocomplete, H as Avatar, U as AvatarFallback, W as AvatarImage, q as Badge, J as BadgeGroup, K as BadgeIndicator, X as Banner, re as Breadcrumb, ie as BreadcrumbEllipsis, ae as BreadcrumbItem, oe as BreadcrumbLink, se as BreadcrumbList, ce as BreadcrumbPage, le as BreadcrumbSeparator, fe as Button, ue as ButtonGroup, me as Card, he as CardAction, ge as CardBleed, _e as CardContent, ve as CardDescription, ye as CardFooter, be as CardHeader, xe as CardSection, Se as CardTitle, we as Checkbox, Te as Code, Ee as Collapsible, De as CollapsibleContent, Oe as CollapsibleTrigger, Ne as ColorInput, Pe as ColorSwatch, Fe as Combobox, Le as Container, Re as ContextMenu, ze as ContextMenuCheckboxItem, Be as ContextMenuContent, Ve as ContextMenuGroup, He as ContextMenuItem, Ue as ContextMenuLabel, We as ContextMenuPortal, Ge as ContextMenuRadioGroup, Ke as ContextMenuRadioItem, qe as ContextMenuSeparator, Je as ContextMenuShortcut, Ye as ContextMenuSub, Xe as ContextMenuSubContent, Ze as ContextMenuSubTrigger, Qe as ContextMenuTrigger, ui as DateSeparator, Ct as DevalokGrain, wt as Dialog, Tt as DialogClose, Et as DialogContent, Dt as DialogContentRaw, Ot as DialogDescription, kt as DialogFooter, At as DialogHeader, jt as DialogOverlay, Mt as DialogPortal, Nt as DialogTitle, Pt as DialogTrigger, j as Dot, ct as DropdownMenu, lt as DropdownMenuCheckboxItem, ut as DropdownMenuContent, dt as DropdownMenuGroup, ft as DropdownMenuItem, pt as DropdownMenuLabel, mt as DropdownMenuPortal, ht as DropdownMenuRadioGroup, gt as DropdownMenuRadioItem, _t as DropdownMenuSeparator, vt as DropdownMenuShortcut, yt as DropdownMenuSub, bt as DropdownMenuSubContent, xt as DropdownMenuSubTrigger, St as DropdownMenuTrigger, Ft as FileUpload, T as FormField, E as FormHelperText, It as HoverCard, Lt as HoverCardContent, Rt as HoverCardTrigger, o as Icon, zt as IconButton, ee as IconContext, Bt as IconGroup, te as IconProvider, O as Input, Vt as Label, vi as Link, Jn as Menubar, Yn as MenubarCheckboxItem, Xn as MenubarContent, Zn as MenubarGroup, Qn as MenubarItem, $n as MenubarLabel, er as MenubarMenu, tr as MenubarPortal, nr as MenubarRadioGroup, rr as MenubarRadioItem, ir as MenubarSeparator, ar as MenubarShortcut, or as MenubarSub, sr as MenubarSubContent, cr as MenubarSubTrigger, lr as MenubarTrigger, di as Message, fi as MessageInput, pi as MessageList, Vn as MultiProgressRing, ur as NavigationMenu, dr as NavigationMenuContent, fr as NavigationMenuIndicator, pr as NavigationMenuItem, mr as NavigationMenuLink, hr as NavigationMenuList, gr as NavigationMenuTrigger, _r as NavigationMenuViewport, Gt as NumberInput, yi as OAuth, bi as OAuthButton, xi as OAuthConnectionRow, Si as OAuthDivider, Ci as OAuthGlyph, wi as OAuthGroup, vr as PaginationContent, yr as PaginationEllipsis, br as PaginationItem, xr as PaginationLink, Sr as PaginationNav, Cr as PaginationNext, wr as PaginationPrevious, Tr as PaginationRoot, ke as Popover, Ae as PopoverAnchor, je as PopoverContent, Me as PopoverTrigger, Mn as Progress, Nn as ProgressIndicator, Pn as ProgressLabel, Hn as ProgressRing, Fn as ProgressRoot, In as ProgressSegment, Ln as ProgressTrack, Rn as ProgressValue, qt as RadioGroup, Jt as RadioGroupItem, Yt as SearchInput, li as SegmentedControl, Xt as Select, Zt as SelectContent, Qt as SelectGroup, $t as SelectItem, en as SelectLabel, tn as SelectScrollDownButton, nn as SelectScrollUpButton, rn as SelectSeparator, Q as SelectTrigger, an as SelectValue, Ht as Separator, Sn as Sheet, Cn as SheetClose, wn as SheetContent, Tn as SheetDescription, En as SheetFooter, Dn as SheetHeader, On as SheetOverlay, kn as SheetPortal, An as SheetTitle, jn as SheetTrigger, Dr as Sidebar, Or as SidebarContent, kr as SidebarFooter, Ar as SidebarGroup, jr as SidebarGroupAction, Mr as SidebarGroupContent, Nr as SidebarGroupLabel, Pr as SidebarHeader, Fr as SidebarInput, Ir as SidebarInset, Lr as SidebarMenu, Rr as SidebarMenuAction, zr as SidebarMenuBadge, Br as SidebarMenuButton, Vr as SidebarMenuItem, Hr as SidebarMenuSkeleton, Ur as SidebarMenuSub, Wr as SidebarMenuSubButton, Gr as SidebarMenuSubItem, Kr as SidebarProvider, qr as SidebarRail, Jr as SidebarSeparator, Yr as SidebarTrigger, N as Skeleton, P as SkeletonAvatar, F as SkeletonButton, I as SkeletonChart, L as SkeletonGroup, R as SkeletonImage, z as SkeletonInput, B as SkeletonText, sn as Slider, a as Spinner, Ut as SplitButton, ai as Stack, Wn as StatCard, Un as StatFlash, ti as Step, ni as Stepper, Gn as Surface, un as Switch, mi as SystemMessage, $e as Table, et as TableBody, tt as TableCaption, nt as TableCell, rt as TableFooter, it as TableHead, at as TableHeader, ot as TableRow, st as TableRowActions, qn as TableRowLink, Zr as Tabs, Qr as TabsContent, $r as TabsList, ei as TabsTrigger, ri as Text, dn as Textarea, pn as Toggle, hn as ToggleGroup, gn as ToggleGroupItem, _n as Tooltip, vn as TooltipContent, yn as TooltipProvider, bn as TooltipTrigger, oi as TreeItem, si as TreeView, xn as TruncatedText, hi as TypingIndicator, gi as UnreadSeparator, Wt as VisuallyHidden, C as alertVariants, G as avatarVariants, Y as badgeVariants, Z as bannerVariants, pe as buttonVariants, Ce as cardVariants, i as cn, Ie as comboboxTriggerVariants, M as dotVariants, Di as formatRelativeTime, Er as generatePagination, Ti as getOAuthLabel, Ei as getOAuthName, k as inputWrapperVariants, Kt as numberInputWrapperVariants, zn as progressIndicatorVariants, Bn as progressTrackVariants, on as selectTriggerVariants, V as skeletonVariants, cn as sliderThumbVariants, ln as sliderTrackVariants, e as springs, t as stagger, Kn as surfaceVariants, ii as textVariants, fn as textareaVariants, mn as toggleVariants, n as tweens, de as useButtonGroup, D as useFormField, ne as useIconContext, _i as useMessageContext, Xr as useSidebar, ci as useTree, r as withReducedMotion };
|
package/dist/ui/search-input.js
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
import { springs as e } from "./lib/motion.js";
|
|
3
3
|
import { Spinner as t } from "./spinner.js";
|
|
4
4
|
import { Icon as n } from "./icon.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { Input as r } from "./input.js";
|
|
6
|
+
import { Button as i } from "./button.js";
|
|
7
7
|
import * as a from "react";
|
|
8
8
|
import { jsx as o } from "react/jsx-runtime";
|
|
9
9
|
import { IconSearch as s, IconX as c } from "@tabler/icons-react";
|
|
@@ -25,7 +25,7 @@ var d = a.forwardRef(({ className: a, value: d, onClear: f, loading: p, size: m
|
|
|
25
25
|
scale: .8
|
|
26
26
|
},
|
|
27
27
|
transition: e.snappy,
|
|
28
|
-
children: /* @__PURE__ */ o(
|
|
28
|
+
children: /* @__PURE__ */ o(i, {
|
|
29
29
|
type: "button",
|
|
30
30
|
variant: "ghost",
|
|
31
31
|
size: "icon-xs",
|
|
@@ -35,7 +35,7 @@ var d = a.forwardRef(({ className: a, value: d, onClear: f, loading: p, size: m
|
|
|
35
35
|
children: /* @__PURE__ */ o(n, { icon: c })
|
|
36
36
|
})
|
|
37
37
|
}) });
|
|
38
|
-
return /* @__PURE__ */ o(
|
|
38
|
+
return /* @__PURE__ */ o(r, {
|
|
39
39
|
ref: _,
|
|
40
40
|
size: m,
|
|
41
41
|
startSection: /* @__PURE__ */ o(n, { icon: s }),
|
package/dist/ui/sidebar.js
CHANGED
|
@@ -5,9 +5,9 @@ import { cva as n } from "../_chunks/vendor-utils.js";
|
|
|
5
5
|
import { cn as r } from "./lib/utils.js";
|
|
6
6
|
import { Icon as i } from "./icon.js";
|
|
7
7
|
import { useIsMobile as a } from "../hooks/use-mobile.js";
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
8
|
+
import { Input as o } from "./input.js";
|
|
9
|
+
import { Skeleton as s } from "./skeleton.js";
|
|
10
|
+
import { Button as c } from "./button.js";
|
|
11
11
|
import { Separator as l } from "./separator.js";
|
|
12
12
|
import { Tooltip as u, TooltipContent as d, TooltipProvider as f, TooltipTrigger as p } from "./tooltip.js";
|
|
13
13
|
import { Sheet as m, SheetContent as h } from "./sheet.js";
|
|
@@ -139,7 +139,7 @@ var M = _(({ side: e = "left", variant: t = "sidebar", collapsible: n = "offcanv
|
|
|
139
139
|
M.displayName = "Sidebar";
|
|
140
140
|
var N = _(({ className: e, onClick: t, ...n }, a) => {
|
|
141
141
|
let { toggleSidebar: o } = A();
|
|
142
|
-
return /* @__PURE__ */ E(
|
|
142
|
+
return /* @__PURE__ */ E(c, {
|
|
143
143
|
ref: a,
|
|
144
144
|
"data-sidebar": "trigger",
|
|
145
145
|
variant: "ghost",
|
|
@@ -179,7 +179,7 @@ var F = _(({ className: e, ...t }, n) => /* @__PURE__ */ T("main", {
|
|
|
179
179
|
...t
|
|
180
180
|
}));
|
|
181
181
|
F.displayName = "SidebarInset";
|
|
182
|
-
var I = _(({ className: e, wrapperClassName: t, ...n }, i) => /* @__PURE__ */ T(
|
|
182
|
+
var I = _(({ className: e, wrapperClassName: t, ...n }, i) => /* @__PURE__ */ T(o, {
|
|
183
183
|
ref: i,
|
|
184
184
|
"data-sidebar": "input",
|
|
185
185
|
size: "sm",
|
|
@@ -326,10 +326,10 @@ var X = _(({ className: e, showIcon: t = !1, ...n }, i) => {
|
|
|
326
326
|
"data-sidebar": "menu-skeleton",
|
|
327
327
|
className: r("flex h-ds-sm items-center gap-ds-03 rounded-control px-ds-03", e),
|
|
328
328
|
...n,
|
|
329
|
-
children: [t && /* @__PURE__ */ T(
|
|
329
|
+
children: [t && /* @__PURE__ */ T(s, {
|
|
330
330
|
className: "h-ico-sm w-ico-sm rounded-control",
|
|
331
331
|
"data-sidebar": "menu-skeleton-icon"
|
|
332
|
-
}), /* @__PURE__ */ T(
|
|
332
|
+
}), /* @__PURE__ */ T(s, {
|
|
333
333
|
className: "h-4 max-w-(--skeleton-width) flex-1",
|
|
334
334
|
"data-sidebar": "menu-skeleton-text",
|
|
335
335
|
style: { "--skeleton-width": a }
|
|
@@ -1,37 +1,48 @@
|
|
|
1
1
|
# PriorityIndicator
|
|
2
2
|
|
|
3
3
|
- Import: @devalok/shilp-sutra/composed/priority-indicator
|
|
4
|
-
- Server-safe:
|
|
4
|
+
- Server-safe: No
|
|
5
5
|
- Category: composed
|
|
6
6
|
|
|
7
7
|
## Props
|
|
8
8
|
priority: Priority
|
|
9
|
-
|
|
9
|
+
iconOnly?: boolean (icon-only chip, no visible text)
|
|
10
|
+
display?: "compact" | "full" (@deprecated — use iconOnly)
|
|
11
|
+
children?: ReactNode (override the label, e.g. i18n)
|
|
10
12
|
|
|
11
13
|
Priority = 'LOW' | 'MEDIUM' | 'HIGH' | 'URGENT' | 'low' | 'medium' | 'high' | 'urgent'
|
|
12
14
|
|
|
13
15
|
## Defaults
|
|
14
|
-
|
|
16
|
+
iconOnly: false
|
|
15
17
|
|
|
16
18
|
## Example
|
|
17
19
|
```jsx
|
|
18
20
|
<PriorityIndicator priority="HIGH" />
|
|
19
|
-
<PriorityIndicator priority="low"
|
|
21
|
+
<PriorityIndicator priority="low" iconOnly />
|
|
22
|
+
<PriorityIndicator priority="URGENT">Critical</PriorityIndicator>
|
|
20
23
|
```
|
|
21
24
|
|
|
22
25
|
## Composability
|
|
23
|
-
- **
|
|
26
|
+
- **Composes `Badge`** — radius, color semantics, a11y labelling, and reduced-motion handling all come from one place (no bespoke re-roll).
|
|
24
27
|
- **Composes inside list rows, DataTable cells, Card headers, task panels** — anywhere a priority flag fits.
|
|
25
|
-
-
|
|
26
|
-
- **
|
|
27
|
-
-
|
|
28
|
+
- **`iconOnly`** shows only the icon with a real accessible name (`role="img"` + `aria-label`), for tight cells. Omit it (default) for icon + label.
|
|
29
|
+
- **Severity by weight, not motion** — URGENT renders as a solid fill so the top tier reads at a glance; the others are soft. No animation (removes the prior perpetual pulse).
|
|
30
|
+
- **Case-insensitive priority** — accepts both UPPERCASE and lowercase; unknown values fall back to MEDIUM instead of throwing.
|
|
31
|
+
- **`children`** overrides the label for i18n / custom copy.
|
|
32
|
+
- Color semantics: LOW = slate (neutral), MEDIUM = warning, HIGH = error (soft), URGENT = error (solid).
|
|
28
33
|
|
|
29
34
|
## Gotchas
|
|
30
|
-
- Case-insensitive — "low" and "LOW" both work
|
|
31
|
-
-
|
|
32
|
-
- `
|
|
35
|
+
- Case-insensitive — "low" and "LOW" both work; unknown values fall back to MEDIUM
|
|
36
|
+
- `iconOnly` shows only the icon (accessible-named); default shows icon + text label
|
|
37
|
+
- `display` is deprecated — use `iconOnly`
|
|
33
38
|
|
|
34
39
|
## Changes
|
|
40
|
+
### v0.53.0
|
|
41
|
+
- **Changed** Recomposed on the `Badge` primitive (was a bespoke re-rolled chip): inherits pill radius, color semantics, accessible labelling.
|
|
42
|
+
- **Changed** URGENT is now a solid static fill; the perpetual scale-pulse is removed (was unguarded infinite motion, WCAG 2.2.2). Severity reads without animation.
|
|
43
|
+
- **Added** `iconOnly` (replaces deprecated `display`) and `children` (label override for i18n).
|
|
44
|
+
- **Fixed** Icon-only chip now has a real accessible name (`role="img"` + `aria-label`), not a mouse-only `title`. Unknown priority no longer throws.
|
|
45
|
+
|
|
35
46
|
### v0.2.0
|
|
36
47
|
- **Added** Identified as server-safe component
|
|
37
48
|
|