@cosxai/ui 1.0.0-alpha.14 → 1.0.0-alpha.15
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/CHANGELOG.md +4 -0
- package/package.json +1 -1
- package/src/components/ActionBar.tsx +5 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
## 1.0.0-alpha.15
|
|
2
|
+
|
|
3
|
+
- ActionBar `foldable={false}`: always shown in full — no fold button, and a stored fold is ignored (a page whose bar is its whole toolbar, like a document viewer).
|
|
4
|
+
|
|
1
5
|
## 1.0.0-alpha.14
|
|
2
6
|
|
|
3
7
|
- ActionBar: an action can carry `divider` (a rule before it), `iconOnly` (just the icon, label in the tooltip) and `wrap` + `wrapKey` (wrap the button in a menu or popover trigger so it opens something anchored to itself).
|
package/package.json
CHANGED
|
@@ -393,6 +393,8 @@ export type ActionBarProps = {
|
|
|
393
393
|
labels?: ActionBarLabels | undefined;
|
|
394
394
|
/** Lay it out in place (documentation, a demo) instead of floating: no fixed position, no dragging. */
|
|
395
395
|
inline?: boolean | undefined;
|
|
396
|
+
/** false: always shown in full — no fold button, a stored fold is ignored (a page whose bar is its whole toolbar). @default true */
|
|
397
|
+
foldable?: boolean | undefined;
|
|
396
398
|
className?: string | undefined;
|
|
397
399
|
};
|
|
398
400
|
|
|
@@ -409,7 +411,7 @@ const itemCls = cn(
|
|
|
409
411
|
* Narrowing drops shortcuts, then labels, then folds to a handle on the
|
|
410
412
|
* left edge. Drag by the grip; double-click it to reset.
|
|
411
413
|
*/
|
|
412
|
-
export function ActionBar({ presentation, hidden: hiddenProp, maxActions = 6, labels = {}, inline = false, className }: ActionBarProps) {
|
|
414
|
+
export function ActionBar({ presentation, hidden: hiddenProp, maxActions = 6, labels = {}, inline = false, foldable = true, className }: ActionBarProps) {
|
|
413
415
|
const ctx = useCtx();
|
|
414
416
|
const { idle, selection, mode, hidden, activity } = ctx.read();
|
|
415
417
|
const { prefs, setPrefs } = ctx;
|
|
@@ -420,7 +422,7 @@ export function ActionBar({ presentation, hidden: hiddenProp, maxActions = 6, la
|
|
|
420
422
|
const state: ActionBarState = mode ? 'mode' : selection ? 'selection' : 'idle';
|
|
421
423
|
const auto = presentation ?? presentationFor(width);
|
|
422
424
|
// Entering a selection or a mode unfolds it; back in idle the user's fold state returns.
|
|
423
|
-
const folded = state === 'idle' && (auto === 'folded' || (presentation === undefined && prefs.folded));
|
|
425
|
+
const folded = foldable && state === 'idle' && (auto === 'folded' || (presentation === undefined && prefs.folded));
|
|
424
426
|
const shown: Exclude<ActionBarPresentation, 'folded'> = auto === 'folded' ? 'icons' : auto;
|
|
425
427
|
|
|
426
428
|
// Pull the bar back into view when the window shrinks.
|
|
@@ -606,7 +608,7 @@ export function ActionBar({ presentation, hidden: hiddenProp, maxActions = 6, la
|
|
|
606
608
|
</button>
|
|
607
609
|
</>
|
|
608
610
|
)}
|
|
609
|
-
{state === 'idle' && (
|
|
611
|
+
{state === 'idle' && foldable && (
|
|
610
612
|
<Tooltip content={`${labels.fold ?? 'Fold the action bar'} · \\`}>
|
|
611
613
|
<button type="button" aria-label={labels.fold ?? 'Fold the action bar'} onClick={() => setPrefs({ folded: true })} className={cn(itemCls, 'px-2 opacity-60 hover:opacity-100 max-md:hidden')}>
|
|
612
614
|
<ChevronsLeft size={16} aria-hidden />
|