@liberation-data/desk 0.19.0 → 0.20.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/README.md CHANGED
@@ -263,7 +263,8 @@ Each control carries its own behaviour and accessibility; the look comes only fr
263
263
  style props on purpose. `intent="default"` marks the one action a view leads with. A segmented control is one
264
264
  tab stop whose arrow keys move the selection past disabled options. Tabs look similar and are not the same
265
265
  thing: a segmented control chooses a value and what it governs stays on screen, while tabs switch the view
266
- beneath them, which sits in a panel the selected tab names. A toggle is a `switch` for settings that
266
+ beneath them, which sits in a panel the selected tab names. `actions` puts controls for the whole window,
267
+ such as Refresh, at the end of the strip, so a window with tabs needs no header row above them. A toggle is a `switch` for settings that
267
268
  apply at once — a checkbox is for one that waits for Save. A text field always has a label (`labelHidden`
268
269
  keeps it for screen readers), and an `error` marks it invalid and replaces the help text. A choice group
269
270
  is the handful of cards a setup step turns on — an icon, a label, a line of why — with native radios
@@ -722,14 +722,30 @@
722
722
  * radius, so a tab's hover wash and its underline read as one rounded shape, and a look that
723
723
  * rounds its buttons rounds its tabs to match.
724
724
  */
725
- .desk-tablist {
725
+ .desk-tabbar {
726
726
  display: flex;
727
727
  flex-wrap: wrap;
728
- gap: 2px;
728
+ align-items: flex-end;
729
+ gap: var(--desk-space-2);
729
730
  border-bottom: 1px solid var(--desk-rule);
730
731
  margin-bottom: var(--desk-space-3);
731
732
  }
732
733
 
734
+ .desk-tablist {
735
+ display: flex;
736
+ flex-wrap: wrap;
737
+ gap: 2px;
738
+ margin-right: auto;
739
+ }
740
+
741
+ /* Sits on the strip's baseline, clear of the rule, without stretching the tabs to its height. */
742
+ .desk-tabs-actions {
743
+ display: flex;
744
+ align-items: center;
745
+ gap: var(--desk-space-2);
746
+ padding-bottom: var(--desk-space-1);
747
+ }
748
+
733
749
  .desk-tab {
734
750
  display: inline-flex;
735
751
  align-items: center;
package/dist/desk.css CHANGED
@@ -1850,14 +1850,30 @@
1850
1850
  * radius, so a tab's hover wash and its underline read as one rounded shape, and a look that
1851
1851
  * rounds its buttons rounds its tabs to match.
1852
1852
  */
1853
- .desk-tablist {
1853
+ .desk-tabbar {
1854
1854
  display: flex;
1855
1855
  flex-wrap: wrap;
1856
- gap: 2px;
1856
+ align-items: flex-end;
1857
+ gap: var(--desk-space-2);
1857
1858
  border-bottom: 1px solid var(--desk-rule);
1858
1859
  margin-bottom: var(--desk-space-3);
1859
1860
  }
1860
1861
 
1862
+ .desk-tablist {
1863
+ display: flex;
1864
+ flex-wrap: wrap;
1865
+ gap: 2px;
1866
+ margin-right: auto;
1867
+ }
1868
+
1869
+ /* Sits on the strip's baseline, clear of the rule, without stretching the tabs to its height. */
1870
+ .desk-tabs-actions {
1871
+ display: flex;
1872
+ align-items: center;
1873
+ gap: var(--desk-space-2);
1874
+ padding-bottom: var(--desk-space-1);
1875
+ }
1876
+
1861
1877
  .desk-tab {
1862
1878
  display: inline-flex;
1863
1879
  align-items: center;
@@ -13,9 +13,14 @@ export interface TabsProps<T extends string> {
13
13
  readonly onChange: (value: T) => void;
14
14
  /** The accessible name for the strip, usually the window's, e.g. "Model Router". */
15
15
  readonly label: string;
16
+ /**
17
+ * Controls for the whole window rather than one view — Refresh, say — at the end of the strip.
18
+ * Outside the tablist, so they are ordinary tab stops and not tabs.
19
+ */
20
+ readonly actions?: ReactNode;
16
21
  /** The selected view. Rendered inside the tabpanel the selected tab controls. */
17
22
  readonly children?: ReactNode;
18
23
  readonly className?: string;
19
24
  }
20
- export declare function Tabs<T extends string>({ tabs, value, onChange, label, children, className }: TabsProps<T>): import("react").JSX.Element;
25
+ export declare function Tabs<T extends string>({ tabs, value, onChange, label, actions, children, className }: TabsProps<T>): import("react").JSX.Element;
21
26
  //# sourceMappingURL=tabs.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"tabs.d.ts","sourceRoot":"","sources":["../../src/react/tabs.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAiB,SAAS,EAAE,MAAM,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,CAAC,EAAE,OAAO,CAAA;CAC5B;AAED,MAAM,WAAW,SAAS,CAAC,CAAC,SAAS,MAAM;IACzC,wEAAwE;IACxE,QAAQ,CAAC,IAAI,EAAE,SAAS,GAAG,CAAC,CAAC,CAAC,EAAE,CAAA;IAChC,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAA;IACjB,QAAQ,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,CAAA;IACrC,oFAAoF;IACpF,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB;;;OAGG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,CAAA;IAC5B,iFAAiF;IACjF,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,CAAA;IAC7B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAC5B;AAID,wBAAgB,IAAI,CAAC,CAAC,SAAS,MAAM,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,EAAE,SAAS,CAAC,CAAC,CAAC,+BAqDlH"}
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useId, useRef } from 'react';
3
3
  const KEYS = { ArrowRight: 1, ArrowLeft: -1, Home: 'first', End: 'last' };
4
- export function Tabs({ tabs, value, onChange, label, children, className }) {
4
+ export function Tabs({ tabs, value, onChange, label, actions, children, className }) {
5
5
  const id = useId();
6
6
  const strip = useRef(null);
7
7
  const tabId = (v) => `${id}-tab-${v}`;
@@ -21,9 +21,9 @@ export function Tabs({ tabs, value, onChange, label, children, className }) {
21
21
  onChange(next.value);
22
22
  strip.current?.querySelector(`[data-value="${CSS.escape(next.value)}"]`)?.focus();
23
23
  };
24
- return (_jsxs("div", { className: ['desk-tabs', className].filter(Boolean).join(' '), children: [_jsx("div", { ref: strip, role: "tablist", "aria-label": label, className: "desk-tablist", onKeyDown: move, children: tabs.map(tab => {
25
- const selected = tab.value === value;
26
- return (_jsxs("button", { id: tabId(tab.value), type: "button", role: "tab", "aria-selected": selected, "aria-controls": selected ? panelId : undefined, "data-value": tab.value, className: "desk-tab", tabIndex: selected ? 0 : -1, disabled: tab.disabled, onClick: () => onChange(tab.value), children: [tab.label, tab.badge != null && _jsx("span", { className: "desk-tab-badge", children: tab.badge })] }, tab.value));
27
- }) }), _jsx("div", { role: "tabpanel", id: panelId, "aria-labelledby": tabId(value), className: "desk-tabpanel", children: children })] }));
24
+ return (_jsxs("div", { className: ['desk-tabs', className].filter(Boolean).join(' '), children: [_jsxs("div", { className: "desk-tabbar", children: [_jsx("div", { ref: strip, role: "tablist", "aria-label": label, className: "desk-tablist", onKeyDown: move, children: tabs.map(tab => {
25
+ const selected = tab.value === value;
26
+ return (_jsxs("button", { id: tabId(tab.value), type: "button", role: "tab", "aria-selected": selected, "aria-controls": selected ? panelId : undefined, "data-value": tab.value, className: "desk-tab", tabIndex: selected ? 0 : -1, disabled: tab.disabled, onClick: () => onChange(tab.value), children: [tab.label, tab.badge != null && _jsx("span", { className: "desk-tab-badge", children: tab.badge })] }, tab.value));
27
+ }) }), actions != null && _jsx("div", { className: "desk-tabs-actions", children: actions })] }), _jsx("div", { role: "tabpanel", id: panelId, "aria-labelledby": tabId(value), className: "desk-tabpanel", children: children })] }));
28
28
  }
29
29
  //# sourceMappingURL=tabs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"tabs.js","sourceRoot":"","sources":["../../src/react/tabs.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,OAAO,CAAA;AAmCrC,MAAM,IAAI,GAAG,EAAE,UAAU,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,EAAW,CAAA;AAElF,MAAM,UAAU,IAAI,CAAmB,EAAE,IAAI,EAAE,KAA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AAC,KAAK,IAAI,IAAI,IAAI,eAAM,SAAS,EAAC,gBAAgB,YAAE,GAAG,CAAC,KAAK,GAAQ,KAbpE,GAAG,CAAC,KAAK,CAcP,CACV,CAAA;wBACH,CAAC,CAAC,GACE,EACL,OAAO,IAAI,IAAI,IAAI,cAAK,SAAS,EAAC,mBAAmB,YAAE,OAAO,GAAO,IAClE,EACN,cAAK,IAAI,EAAC,UAAU,EAAC,EAAE,EAAE,OAAO,qBAAmB,KAAK,CAAC,KAAK,CAAC,EAAE,SAAS,EAAC,eAAe,YACvF,QAAQ,GACL,IACF,CACP,CAAA;AACH,CAAC"}
package/llms.txt CHANGED
@@ -376,7 +376,7 @@ SearchCommand = 'desk.search' // a menu item can open i
376
376
  ```tsx
377
377
  <Button intent?={'normal'|'default'|'quiet'|'destructive'} size?={'regular'|'small'} icon? … />
378
378
  <SegmentedControl options={{value,label,icon?,disabled?}[]} value onChange label size? disabled? width?={fit|fill} />
379
- <Tabs tabs={{value,label,badge?,disabled?}[]} value onChange label>{selected view}</Tabs>
379
+ <Tabs tabs={{value,label,badge?,disabled?}[]} value onChange label actions?>{selected view}</Tabs>
380
380
  // switches the view below; a segmented control chooses
381
381
  <Toggle checked onChange label? description? disabled? aria-label? /> // applies at once
382
382
  <Checkbox checked indeterminate? onChange label? description? disabled? /> // waits for Save
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@liberation-data/desk",
3
- "version": "0.19.0",
3
+ "version": "0.20.0",
4
4
  "description": "A desktop for the web, for React: windows, a dock, menus and commands, controls, tours and setup assistants.",
5
5
  "keywords": [
6
6
  "react",
@@ -721,14 +721,30 @@
721
721
  * radius, so a tab's hover wash and its underline read as one rounded shape, and a look that
722
722
  * rounds its buttons rounds its tabs to match.
723
723
  */
724
- .desk-tablist {
724
+ .desk-tabbar {
725
725
  display: flex;
726
726
  flex-wrap: wrap;
727
- gap: 2px;
727
+ align-items: flex-end;
728
+ gap: var(--desk-space-2);
728
729
  border-bottom: 1px solid var(--desk-rule);
729
730
  margin-bottom: var(--desk-space-3);
730
731
  }
731
732
 
733
+ .desk-tablist {
734
+ display: flex;
735
+ flex-wrap: wrap;
736
+ gap: 2px;
737
+ margin-right: auto;
738
+ }
739
+
740
+ /* Sits on the strip's baseline, clear of the rule, without stretching the tabs to its height. */
741
+ .desk-tabs-actions {
742
+ display: flex;
743
+ align-items: center;
744
+ gap: var(--desk-space-2);
745
+ padding-bottom: var(--desk-space-1);
746
+ }
747
+
732
748
  .desk-tab {
733
749
  display: inline-flex;
734
750
  align-items: center;
@@ -28,6 +28,11 @@ export interface TabsProps<T extends string> {
28
28
  readonly onChange: (value: T) => void
29
29
  /** The accessible name for the strip, usually the window's, e.g. "Model Router". */
30
30
  readonly label: string
31
+ /**
32
+ * Controls for the whole window rather than one view — Refresh, say — at the end of the strip.
33
+ * Outside the tablist, so they are ordinary tab stops and not tabs.
34
+ */
35
+ readonly actions?: ReactNode
31
36
  /** The selected view. Rendered inside the tabpanel the selected tab controls. */
32
37
  readonly children?: ReactNode
33
38
  readonly className?: string
@@ -35,7 +40,7 @@ export interface TabsProps<T extends string> {
35
40
 
36
41
  const KEYS = { ArrowRight: 1, ArrowLeft: -1, Home: 'first', End: 'last' } as const
37
42
 
38
- export function Tabs<T extends string>({ tabs, value, onChange, label, children, className }: TabsProps<T>) {
43
+ export function Tabs<T extends string>({ tabs, value, onChange, label, actions, children, className }: TabsProps<T>) {
39
44
  const id = useId()
40
45
  const strip = useRef<HTMLDivElement>(null)
41
46
  const tabId = (v: T) => `${id}-tab-${v}`
@@ -57,28 +62,31 @@ export function Tabs<T extends string>({ tabs, value, onChange, label, children,
57
62
 
58
63
  return (
59
64
  <div className={['desk-tabs', className].filter(Boolean).join(' ')}>
60
- <div ref={strip} role="tablist" aria-label={label} className="desk-tablist" onKeyDown={move}>
61
- {tabs.map(tab => {
62
- const selected = tab.value === value
63
- return (
64
- <button
65
- key={tab.value}
66
- id={tabId(tab.value)}
67
- type="button"
68
- role="tab"
69
- aria-selected={selected}
70
- aria-controls={selected ? panelId : undefined}
71
- data-value={tab.value}
72
- className="desk-tab"
73
- tabIndex={selected ? 0 : -1}
74
- disabled={tab.disabled}
75
- onClick={() => onChange(tab.value)}
76
- >
77
- {tab.label}
78
- {tab.badge != null && <span className="desk-tab-badge">{tab.badge}</span>}
79
- </button>
80
- )
81
- })}
65
+ <div className="desk-tabbar">
66
+ <div ref={strip} role="tablist" aria-label={label} className="desk-tablist" onKeyDown={move}>
67
+ {tabs.map(tab => {
68
+ const selected = tab.value === value
69
+ return (
70
+ <button
71
+ key={tab.value}
72
+ id={tabId(tab.value)}
73
+ type="button"
74
+ role="tab"
75
+ aria-selected={selected}
76
+ aria-controls={selected ? panelId : undefined}
77
+ data-value={tab.value}
78
+ className="desk-tab"
79
+ tabIndex={selected ? 0 : -1}
80
+ disabled={tab.disabled}
81
+ onClick={() => onChange(tab.value)}
82
+ >
83
+ {tab.label}
84
+ {tab.badge != null && <span className="desk-tab-badge">{tab.badge}</span>}
85
+ </button>
86
+ )
87
+ })}
88
+ </div>
89
+ {actions != null && <div className="desk-tabs-actions">{actions}</div>}
82
90
  </div>
83
91
  <div role="tabpanel" id={panelId} aria-labelledby={tabId(value)} className="desk-tabpanel">
84
92
  {children}