@keyfunc/keybricks-ds 2.4.2 → 2.4.6
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/DEPLOY.md +25 -3
- package/DESIGN.md +18 -6
- package/INTEGRATION.md +16 -6
- package/_adherence.oxlintrc.json +7 -0
- package/_scripts/build-index.mjs +2 -2
- package/assets/icons/icon-index.js +1 -1
- package/assets/icons/icon-index.json +1 -1
- package/components/_cards/activity.card.html +1 -1
- package/components/_cards/button-1-base.card.html +1 -1
- package/components/_cards/button-3-sizes-icons.card.html +1 -1
- package/components/_cards/icons-0-usage.card.html +1 -1
- package/components/_cards/icons-1-core.card.html +2 -2
- package/components/_cards/icons-2-feather.card.html +1 -1
- package/components/_cards/icons-2b-lucide.card.html +44 -0
- package/components/_cards/listrow.card.html +2 -2
- package/components/_cards/smart-table.card.html +23 -13
- package/components/_cards/table.card.html +10 -10
- package/components/_cards/tree.card.html +49 -3
- package/components/_shared/src-data.js +1 -1
- package/components/_shared/src-icons.js +1 -1
- package/components/_shared/src-navigation.js +1 -1
- package/components/_vue/index.mjs +2 -0
- package/components/buttons/buttons.prompt.md +1 -1
- package/components/data/SmartTable.d.ts +3 -2
- package/components/data/SmartTable.jsx +11 -6
- package/components/data/SmartTable.vue +10 -5
- package/components/icons/Icon.jsx +81 -5
- package/components/icons/Icon.prompt.md +1 -1
- package/components/icons/Lucide.d.ts +22 -0
- package/components/icons/Lucide.jsx +18 -0
- package/components/icons/Lucide.vue +12 -0
- package/components/icons/icon-paths.js +79 -3
- package/components/icons/lucide-loader.js +27 -0
- package/components/index.d.ts +1 -0
- package/components/index.js +1 -0
- package/components/navigation/Breadcrumb.jsx +1 -1
- package/components/navigation/Sidebar.d.ts +1 -1
- package/components/navigation/ThemeToggle.vue +1 -1
- package/components/navigation/Tree.d.ts +1 -1
- package/components/navigation/Tree.jsx +21 -5
- package/components/navigation/Tree.vue +16 -4
- package/components/navigation/nav-model.js +3 -3
- package/package.json +1 -1
- package/readme.md +1 -1
- package/readme.zh-CN.md +1 -1
- package/tokens/tokens.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<!-- @dsCard group="Components" viewport="
|
|
1
|
+
<!-- @dsCard group="Components" viewport="700x2820" name="Tree" subtitle="Cascading checkboxes · disabled nodes · lines · async load · search · drag · reorder · keyboard" -->
|
|
2
2
|
<!DOCTYPE html>
|
|
3
3
|
<html><head><meta charset="utf-8"><script src="../_shared/frame-theme.js"></script><link rel="stylesheet" href="../../styles.css"><link rel="stylesheet" href="../../tokens/hover.css"><link rel="stylesheet" href="../_shared/card-kit.css">
|
|
4
4
|
<script src="https://unpkg.com/react@18.3.1/umd/react.development.js" integrity="sha384-hD6/rw4ppMLGNu3tX5cjIb+uRZ7UkRJ6BPkLpg4hAu/6onKUg4lLsHAs9EBPT82L" crossorigin="anonymous"></script>
|
|
@@ -94,6 +94,52 @@ function Draggable(){
|
|
|
94
94
|
</div>;
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
+
const REORDER=[
|
|
98
|
+
{key:"recon",title:"Reconciliation",isLeaf:false,children:[
|
|
99
|
+
{key:"bank",title:"Bank statements.xlsx",hue:"green"},
|
|
100
|
+
{key:"ic",title:"Intercompany balances.xlsx",hue:"green"},
|
|
101
|
+
{key:"ar",title:"AR aging.csv",hue:"blue"},
|
|
102
|
+
{key:"ap",title:"AP aging.csv",hue:"blue"}]},
|
|
103
|
+
{key:"adj",title:"Adjustments.docx",hue:"purple"},
|
|
104
|
+
{key:"memo",title:"Close memo.docx",hue:"purple"},
|
|
105
|
+
];
|
|
106
|
+
function Reorderable(){
|
|
107
|
+
const [last,setLast]=React.useState(null);
|
|
108
|
+
return <div>
|
|
109
|
+
<span className="lbl">Reorder — leaf rows are insert targets too</span>
|
|
110
|
+
<Tree items={REORDER} draggable reorder defaultExpanded={["recon"]} onDrop={(i)=>setLast(i.dragKey+" → "+i.position+" "+i.dropKey)}/>
|
|
111
|
+
<div className="hint">{last ? <>Moved <code>{last}</code></> : <>With <code>reorder</code>, drag <em>Bank statements</em> below <em>AR aging</em>: a file’s top half means before, its bottom half after. The insert marker — a 2px line with a dot — sits on the gap between rows and starts at the target’s indent. Folders keep their 20% / 60% / 20% split (before / inside / after).</>}</div>
|
|
112
|
+
</div>;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/* Frozen drop states for reference: each tree gets a synthetic dragstart + dragover after mount, so the real component draws its own indicator. */
|
|
116
|
+
const DS_ITEMS=[{key:"recon",title:"Reconciliation",isLeaf:false,children:[{key:"bank",title:"Bank statements.xlsx",hue:"green"},{key:"ic",title:"Intercompany.xlsx",hue:"green"},{key:"ar",title:"AR aging.csv",hue:"blue"}]},{key:"memo",title:"Close memo.docx",hue:"purple"}];
|
|
117
|
+
function FrozenDrop({from,to,ratio,label,note}){
|
|
118
|
+
const ref=React.useRef(null);
|
|
119
|
+
React.useEffect(()=>{
|
|
120
|
+
const row=(t)=>[...ref.current.querySelectorAll("[role=treeitem]")].find(r=>r.textContent.trim().startsWith(t));
|
|
121
|
+
const fire=(el,type,y)=>{const r=el.getBoundingClientRect();const e=new Event(type,{bubbles:true,cancelable:true});Object.defineProperty(e,"dataTransfer",{value:{effectAllowed:"move",dropEffect:"move",setData(){},getData(){return "";}}});Object.defineProperty(e,"clientY",{value:r.top+r.height*y});el.dispatchEvent(e);};
|
|
122
|
+
const t1=setTimeout(()=>{fire(row(from),"dragstart",.5);},80);
|
|
123
|
+
const t2=setTimeout(()=>{fire(row(to),"dragover",ratio);},200);
|
|
124
|
+
return ()=>{clearTimeout(t1);clearTimeout(t2);};
|
|
125
|
+
},[]);
|
|
126
|
+
return <div ref={ref}>
|
|
127
|
+
<span className="lbl">{label}</span>
|
|
128
|
+
<Tree items={DS_ITEMS} draggable reorder defaultExpanded={["recon"]} defaultSelected={["ic"]}/>
|
|
129
|
+
<div className="hint">{note}</div>
|
|
130
|
+
</div>;
|
|
131
|
+
}
|
|
132
|
+
function DropStates(){
|
|
133
|
+
return <div style={{gridColumn:"1/-1"}}>
|
|
134
|
+
<span className="lbl" style={{color:"var(--text-heading)",fontWeight:"var(--weight-medium)"}}>Drop states — dragging <em>Close memo</em> (frozen for reference)</span>
|
|
135
|
+
<div style={{display:"grid",gridTemplateColumns:"repeat(3,minmax(0,1fr))",gap:20}}>
|
|
136
|
+
<FrozenDrop from="Close memo" to="Intercompany" ratio={.25} label="Before — top half of a file" note="2px line with a 6px dot, between Bank statements above and this row, starting at the file's indent. The selected row keeps its fill."/>
|
|
137
|
+
<FrozenDrop from="Close memo" to="Intercompany" ratio={.75} label="After — bottom half of a file" note="The same marker on the gap below. Its left end at the child indent says the item lands inside Reconciliation."/>
|
|
138
|
+
<FrozenDrop from="Close memo" to="Reconciliation" ratio={.5} label="Inside — middle 60% of a folder" note="Only “inside” fills the row: --soft-bg with a 2px outline. A folder’s outer 20% draws the before / after marker at the folder’s own indent."/>
|
|
139
|
+
</div>
|
|
140
|
+
</div>;
|
|
141
|
+
}
|
|
142
|
+
|
|
97
143
|
function AsyncLoad(){
|
|
98
144
|
const [log,setLog]=React.useState(0);
|
|
99
145
|
const load=(node)=>new Promise(res=>setTimeout(()=>{
|
|
@@ -136,13 +182,13 @@ function Sheet(){return <div className="g">
|
|
|
136
182
|
<Basic/><Checkable/>
|
|
137
183
|
<Strict/><DisabledCase/>
|
|
138
184
|
<Lines/><Multi/>
|
|
139
|
-
<Draggable/><AsyncLoad/>
|
|
185
|
+
<Draggable/><Reorderable/><DropStates/><AsyncLoad/>
|
|
140
186
|
<Searchable/><WithActions/>
|
|
141
187
|
<div className="note">
|
|
142
188
|
<strong>Keyboard.</strong> The tree is a single tab stop. <code>↑ ↓</code> move between visible rows, <code>→</code> opens a branch (or steps into it), <code>←</code> closes it (or jumps to the parent), <code>Enter</code> selects, <code>Space</code> toggles the checkbox. Focus draws the global 2px <code>--focus-ring</code>, never a new colour.
|
|
143
189
|
<br/><br/><strong>Checkbox semantics.</strong> A parent is checked only when every <em>enabled</em> descendant is checked, and indeterminate when some are — so <code>disabled</code> and <code>disableCheckbox</code> rows never block a parent from completing. Use <code>checkStrictly</code> when a branch is a real selectable value rather than a roll-up of its children.
|
|
144
190
|
<br/><br/><strong>Selection vs. expansion.</strong> With <code>selectable={"{false}"}</code> a row click only expands — the right default for a checkbox picker. Otherwise a click both selects and expands, matching the file-tree pattern used in the product sidebar.
|
|
145
|
-
<br/><br/><strong>Dragging moves a node into a folder.</strong> Files are not drop targets — hovering one shows nothing rather than an indicator for a move that can’t happen — and neither is a folder inside the dragged node’s own subtree. Pass <code>reorder</code> when order matters: a folder’s outer 20%
|
|
191
|
+
<br/><br/><strong>Dragging moves a node into a folder.</strong> Files are not drop targets — hovering one shows nothing rather than an indicator for a move that can’t happen — and neither is a folder inside the dragged node’s own subtree. Pass <code>reorder</code> when order matters: a folder’s outer 20% and either half of a file then draw an insert marker — a 2px line with a 6px dot on the gap between rows, starting at the target’s indent so the landing level is visible.
|
|
146
192
|
</div>
|
|
147
193
|
</div>;}
|
|
148
194
|
ReactDOM.createRoot(document.getElementById("root")).render(<Sheet/>);
|