@sovereignfs/ui 0.107.0 → 0.107.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/CHANGELOG.md CHANGED
@@ -5,6 +5,25 @@ versions follow [semver](https://semver.org/). A version's section is written in
5
5
  and becomes the release notes when the version is published. This file starts at 0.96.0; earlier versions are in the repository's
6
6
  history and tags.
7
7
 
8
+ ## [0.107.3] - 2026-11-25
9
+
10
+ This version carries 0.107.1 and 0.107.2, which were set on `develop` and never published.
11
+
12
+ ### Fixed
13
+
14
+ - `IconPicker`'s panel is no longer cut off when the picker is at the left of a page. It opened leftwards from its trigger always, which
15
+ a scrolling page beside a sidebar clips; it now opens on the side with room, rightwards from a trigger at the left. `Popover`'s `align`
16
+ takes `auto` for this (`right`, its default side, where the panel fits, else `left`, counting as room only what is visible: the
17
+ viewport less what a scrolling ancestor would clip), and `IconPicker` has an `align` that defaults to `auto`. An explicit `left` or
18
+ `right` is unchanged, and so is every `Popover` that has one.
19
+
20
+ ### Changed
21
+
22
+ - `AppFrame`: the header's menu button draws its icon at 24px with a heavier stroke, in place of the 20px icon at the default weight, so it
23
+ stands beside an app's wordmark and reads as a button. Nothing else changes.
24
+ - `SettingsDialog`'s title row is compact: 49px on a desktop in place of 69, with the title at 18px in place of 20 and a 2rem close button (the × is where it was). A phone keeps the 44px
25
+ touch target and is 61px in place of 69. Only this dialog's header changes: `Dialog`, `Drawer` and `Sheet` have the shared one as before.
26
+
8
27
  ## [0.107.0] - 2026-11-23
9
28
 
10
29
  ### Added
@@ -41,6 +41,12 @@
41
41
  cursor: pointer;
42
42
  }
43
43
 
44
+ /* The menu icon is the heaviest control in the header's corner, so it is drawn bolder than the icons around it (the Icon's stroke is 2),
45
+ * to stand beside the wordmark and to read as a button. Its size is the Icon's `lg`, set in the component. */
46
+ .toggle svg {
47
+ stroke-width: 2.5;
48
+ }
49
+
44
50
  @media (hover: hover) {
45
51
  .toggle:hover {
46
52
  background: var(--sv-color-surface-sunken);
@@ -1,6 +1,26 @@
1
1
  /* SettingsDialog — a side navigation and a section, inside a flush `Dialog`. The frame never changes size: the
2
2
  * navigation and the section each scroll on their own. Tokens only. */
3
3
 
4
+ /* The title row, compact. In a dialog that is all navigation and content the title only names it, so the row is as tall as its close button and no
5
+ * more: the shared header's own is a 44px touch target with a row's padding round it, and the title a size larger. Through `Dialog`'s `rowClassName` and
6
+ * `titleClassName`, so that no other dialog, drawer or sheet changes. Where the pointer is a mouse the button is 2rem, its × as far from the edge as it
7
+ * was; where it is a finger it keeps the touch target. */
8
+ .headerRow {
9
+ padding-block: var(--sv-space-2);
10
+ }
11
+
12
+ .headerTitle {
13
+ font-size: var(--sv-font-size-lg);
14
+ }
15
+
16
+ @media (pointer: fine) {
17
+ .headerRow button {
18
+ width: 2rem;
19
+ height: 2rem;
20
+ margin-right: calc(-1 * (2rem - var(--sv-icon-size-sm)) / 2);
21
+ }
22
+ }
23
+
4
24
  .frame {
5
25
  display: flex;
6
26
  flex: 1 1 auto;
package/dist/index.d.ts CHANGED
@@ -639,8 +639,13 @@ interface PopoverProps {
639
639
  trigger: ReactElement;
640
640
  open: boolean;
641
641
  onClose: () => void;
642
- /** Which edge of the trigger the panel aligns to. Default: 'right'. */
643
- align?: 'left' | 'right';
642
+ /**
643
+ * Which edge of the trigger the panel aligns to: `'right'` opens it leftwards from the trigger, `'left'` rightwards.
644
+ * `'auto'` is `'right'` where the panel fits on that side and the other side where it does not, counting as room only
645
+ * what is visible: the viewport, less whatever a scrolling ancestor would clip (a trigger at the left of a page beside
646
+ * a sidebar has none to its left, though the viewport has). Default: 'right'.
647
+ */
648
+ align?: 'left' | 'right' | 'auto';
644
649
  /** Panel width in px, or `'trigger'` to match the trigger element's own
645
650
  * rendered width exactly (e.g. a dropdown under a full-width form field,
646
651
  * where a fixed pixel width would either overflow or leave a gap
@@ -3328,6 +3333,12 @@ interface IconPickerProps {
3328
3333
  triggerLabel?: string;
3329
3334
  disabled?: boolean;
3330
3335
  className?: string;
3336
+ /**
3337
+ * Which edge of the trigger the panel aligns to (`Popover`'s `align`). Default `'auto'`: opens leftwards from the
3338
+ * trigger where there is room for it, and rightwards where there is not, so a picker at the left of a page, or of a
3339
+ * row, is never cut off.
3340
+ */
3341
+ align?: 'left' | 'right' | 'auto';
3331
3342
  }
3332
3343
  /**
3333
3344
  * IconPicker — a trigger button showing the current icon that opens a
@@ -3335,10 +3346,13 @@ interface IconPickerProps {
3335
3346
  * bounded icon set (e.g. Sovereign Shopper's grocery category icons,
3336
3347
  * SHP-05) rather than the full design-system icon library.
3337
3348
  *
3349
+ * The panel opens on the side of the trigger that has room (`align`), so the picker can sit
3350
+ * at either end of a row.
3351
+ *
3338
3352
  * Selecting an icon both closes the picker and calls `onChange` — a
3339
3353
  * consumer's `onChange` never needs to close the picker itself.
3340
3354
  */
3341
- declare function IconPicker({ value, onChange, options, 'aria-label': ariaLabel, triggerLabel, disabled, className, }: IconPickerProps): react.JSX.Element;
3355
+ declare function IconPicker({ value, onChange, options, 'aria-label': ariaLabel, triggerLabel, disabled, className, align, }: IconPickerProps): react.JSX.Element;
3342
3356
 
3343
3357
  interface ColorPickerSwatch {
3344
3358
  /** Accessible name and tooltip, e.g. "Sky". */
package/dist/index.js CHANGED
@@ -5274,6 +5274,18 @@ import styles34 from "./Popover.module.css";
5274
5274
  import { jsx as jsx177, jsxs as jsxs148 } from "react/jsx-runtime";
5275
5275
  var TRIGGER_GAP = 8;
5276
5276
  var VIEWPORT_MARGIN = 4;
5277
+ function visibleSpan(element) {
5278
+ let left = 0;
5279
+ let right = window.innerWidth;
5280
+ for (let ancestor = element.parentElement; ancestor && ancestor !== document.documentElement; ancestor = ancestor.parentElement) {
5281
+ const overflow = window.getComputedStyle(ancestor).overflowX;
5282
+ if (overflow === "visible" || overflow === "") continue;
5283
+ const rect = ancestor.getBoundingClientRect();
5284
+ left = Math.max(left, rect.left);
5285
+ right = Math.min(right, rect.right);
5286
+ }
5287
+ return { left, right };
5288
+ }
5277
5289
  function Popover({
5278
5290
  trigger,
5279
5291
  open,
@@ -5291,6 +5303,8 @@ function Popover({
5291
5303
  const [openUpward, setOpenUpward] = useState11(false);
5292
5304
  const [maxHeight, setMaxHeight] = useState11(null);
5293
5305
  const [horizontalOffset, setHorizontalOffset] = useState11(null);
5306
+ const [autoSide, setAutoSide] = useState11("right");
5307
+ const side = align === "auto" ? autoSide : align;
5294
5308
  const overlayIdRef = useRef4(null);
5295
5309
  useEffect2(() => {
5296
5310
  if (!open) return;
@@ -5318,6 +5332,7 @@ function Popover({
5318
5332
  setOpenUpward(false);
5319
5333
  setMaxHeight(null);
5320
5334
  setHorizontalOffset(null);
5335
+ setAutoSide("right");
5321
5336
  return;
5322
5337
  }
5323
5338
  const container = containerRef.current;
@@ -5343,7 +5358,17 @@ function Popover({
5343
5358
  setMaxHeight(panelHeight > available ? Math.max(available, 0) : null);
5344
5359
  const containerRect = container.getBoundingClientRect();
5345
5360
  const panelWidth = panel.getBoundingClientRect().width;
5346
- const naturalLeft = align === "right" ? containerRect.right - panelWidth : containerRect.left;
5361
+ let chosen = align === "left" ? "left" : "right";
5362
+ if (align === "auto" && panelWidth > 0) {
5363
+ const visible = visibleSpan(container);
5364
+ const fitsRight = containerRect.right - panelWidth >= visible.left + VIEWPORT_MARGIN;
5365
+ const fitsLeft = containerRect.left + panelWidth <= visible.right - VIEWPORT_MARGIN;
5366
+ const roomRight = containerRect.right - visible.left;
5367
+ const roomLeft = visible.right - containerRect.left;
5368
+ chosen = !fitsRight && (fitsLeft || roomLeft > roomRight) ? "left" : "right";
5369
+ setAutoSide(chosen);
5370
+ }
5371
+ const naturalLeft = chosen === "right" ? containerRect.right - panelWidth : containerRect.left;
5347
5372
  const clampedLeft = Math.min(
5348
5373
  Math.max(naturalLeft, VIEWPORT_MARGIN),
5349
5374
  window.innerWidth - VIEWPORT_MARGIN - panelWidth
@@ -5380,7 +5405,7 @@ function Popover({
5380
5405
  role: "dialog",
5381
5406
  "aria-label": ariaLabel,
5382
5407
  "aria-modal": false,
5383
- className: [styles34.panel, styles34[align], openUpward ? styles34.upward : ""].filter(Boolean).join(" "),
5408
+ className: [styles34.panel, styles34[side], openUpward ? styles34.upward : ""].filter(Boolean).join(" "),
5384
5409
  style: {
5385
5410
  width: width === "trigger" ? triggerWidth ?? void 0 : width,
5386
5411
  maxHeight: maxHeight ?? void 0,
@@ -8735,7 +8760,7 @@ function AppFrame({
8735
8760
  "aria-label": hidden ? words.showSidebar : words.hideSidebar,
8736
8761
  "aria-expanded": !hidden,
8737
8762
  onClick: sidebar.toggleHidden,
8738
- children: /* @__PURE__ */ jsx214(Icon, { name: "menu", "aria-hidden": true })
8763
+ children: /* @__PURE__ */ jsx214(Icon, { name: "menu", size: "lg", "aria-hidden": true })
8739
8764
  }
8740
8765
  );
8741
8766
  const menuButton = /* @__PURE__ */ jsx214(
@@ -8747,7 +8772,7 @@ function AppFrame({
8747
8772
  "aria-haspopup": "dialog",
8748
8773
  "aria-expanded": navOpen,
8749
8774
  onClick: () => setNavOpen(true),
8750
- children: /* @__PURE__ */ jsx214(Icon, { name: "menu", "aria-hidden": true })
8775
+ children: /* @__PURE__ */ jsx214(Icon, { name: "menu", size: "lg", "aria-hidden": true })
8751
8776
  }
8752
8777
  );
8753
8778
  return /* @__PURE__ */ jsxs178("div", { id: "sv-app-shell", className: styles68.shell, children: [
@@ -8852,83 +8877,96 @@ function SettingsDialog({
8852
8877
  ...group,
8853
8878
  sections: needle ? group.sections.filter((section) => section.label.toLocaleLowerCase().includes(needle)) : group.sections
8854
8879
  })).filter((group) => group.sections.length > 0);
8855
- return /* @__PURE__ */ jsx215(Dialog, { open, onClose, size: size2, header: title, "aria-label": title, flush: true, children: /* @__PURE__ */ jsxs179("div", { className: styles69.frame, "data-view": active === null ? "sections" : "section", children: [
8856
- /* @__PURE__ */ jsxs179("div", { className: styles69.sidebar, children: [
8857
- search && /* @__PURE__ */ jsx215("div", { className: styles69.search, children: /* @__PURE__ */ jsx215(
8858
- Input,
8859
- {
8860
- type: "search",
8861
- value: query,
8862
- onChange: (event) => setQuery(event.target.value),
8863
- placeholder: searchLabel,
8864
- "aria-label": searchLabel,
8865
- "aria-controls": navId
8866
- }
8867
- ) }),
8868
- /* @__PURE__ */ jsx215("nav", { id: navId, className: styles69.nav, "aria-label": title, children: visible.map((group) => /* @__PURE__ */ jsx215("ul", { className: styles69.group, children: group.sections.map((section) => {
8869
- const current2 = active !== null && section.id === shown?.id;
8870
- const className = [styles69.row, section.id === shown?.id ? styles69.rowActive : ""].filter(Boolean).join(" ");
8871
- const children = /* @__PURE__ */ jsxs179(Fragment17, { children: [
8872
- /* @__PURE__ */ jsx215(Icon, { name: section.icon, size: "sm", "aria-hidden": true, className: styles69.icon }),
8873
- /* @__PURE__ */ jsx215("span", { className: styles69.label, children: section.label }),
8874
- /* @__PURE__ */ jsx215(Icon, { name: "chevron-right", size: "sm", "aria-hidden": true, className: styles69.chevron })
8875
- ] });
8876
- const select = () => onSelect(section.id);
8877
- let row;
8878
- if (section.href !== void 0 && renderLink) {
8879
- row = renderLink(section, {
8880
- href: section.href,
8881
- className,
8882
- "aria-current": current2 ? "page" : void 0,
8883
- onClick: select,
8884
- children
8885
- });
8886
- } else if (section.href !== void 0) {
8887
- row = /* @__PURE__ */ jsx215(
8888
- "a",
8880
+ return /* @__PURE__ */ jsx215(
8881
+ Dialog,
8882
+ {
8883
+ open,
8884
+ onClose,
8885
+ size: size2,
8886
+ header: title,
8887
+ "aria-label": title,
8888
+ rowClassName: styles69.headerRow,
8889
+ titleClassName: styles69.headerTitle,
8890
+ flush: true,
8891
+ children: /* @__PURE__ */ jsxs179("div", { className: styles69.frame, "data-view": active === null ? "sections" : "section", children: [
8892
+ /* @__PURE__ */ jsxs179("div", { className: styles69.sidebar, children: [
8893
+ search && /* @__PURE__ */ jsx215("div", { className: styles69.search, children: /* @__PURE__ */ jsx215(
8894
+ Input,
8889
8895
  {
8890
- href: section.href,
8891
- className,
8892
- "aria-current": current2 ? "page" : void 0,
8893
- onClick: (event) => {
8894
- event.preventDefault();
8895
- select();
8896
- },
8897
- children
8896
+ type: "search",
8897
+ value: query,
8898
+ onChange: (event) => setQuery(event.target.value),
8899
+ placeholder: searchLabel,
8900
+ "aria-label": searchLabel,
8901
+ "aria-controls": navId
8898
8902
  }
8899
- );
8900
- } else {
8901
- row = /* @__PURE__ */ jsx215(
8902
- "button",
8903
- {
8904
- type: "button",
8905
- className,
8906
- "aria-current": current2 ? "page" : void 0,
8907
- onClick: select,
8908
- children
8903
+ ) }),
8904
+ /* @__PURE__ */ jsx215("nav", { id: navId, className: styles69.nav, "aria-label": title, children: visible.map((group) => /* @__PURE__ */ jsx215("ul", { className: styles69.group, children: group.sections.map((section) => {
8905
+ const current2 = active !== null && section.id === shown?.id;
8906
+ const className = [styles69.row, section.id === shown?.id ? styles69.rowActive : ""].filter(Boolean).join(" ");
8907
+ const children = /* @__PURE__ */ jsxs179(Fragment17, { children: [
8908
+ /* @__PURE__ */ jsx215(Icon, { name: section.icon, size: "sm", "aria-hidden": true, className: styles69.icon }),
8909
+ /* @__PURE__ */ jsx215("span", { className: styles69.label, children: section.label }),
8910
+ /* @__PURE__ */ jsx215(Icon, { name: "chevron-right", size: "sm", "aria-hidden": true, className: styles69.chevron })
8911
+ ] });
8912
+ const select = () => onSelect(section.id);
8913
+ let row;
8914
+ if (section.href !== void 0 && renderLink) {
8915
+ row = renderLink(section, {
8916
+ href: section.href,
8917
+ className,
8918
+ "aria-current": current2 ? "page" : void 0,
8919
+ onClick: select,
8920
+ children
8921
+ });
8922
+ } else if (section.href !== void 0) {
8923
+ row = /* @__PURE__ */ jsx215(
8924
+ "a",
8925
+ {
8926
+ href: section.href,
8927
+ className,
8928
+ "aria-current": current2 ? "page" : void 0,
8929
+ onClick: (event) => {
8930
+ event.preventDefault();
8931
+ select();
8932
+ },
8933
+ children
8934
+ }
8935
+ );
8936
+ } else {
8937
+ row = /* @__PURE__ */ jsx215(
8938
+ "button",
8939
+ {
8940
+ type: "button",
8941
+ className,
8942
+ "aria-current": current2 ? "page" : void 0,
8943
+ onClick: select,
8944
+ children
8945
+ }
8946
+ );
8909
8947
  }
8910
- );
8911
- }
8912
- return /* @__PURE__ */ jsx215("li", { children: row }, section.id);
8913
- }) }, group.id)) })
8914
- ] }),
8915
- shown && /* @__PURE__ */ jsxs179("section", { className: styles69.section, "aria-label": shown.label, children: [
8916
- /* @__PURE__ */ jsxs179("div", { className: styles69.back, children: [
8917
- /* @__PURE__ */ jsx215(
8918
- "button",
8919
- {
8920
- type: "button",
8921
- className: styles69.backButton,
8922
- "aria-label": backLabel,
8923
- onClick: () => onSelect(null),
8924
- children: /* @__PURE__ */ jsx215(Icon, { name: "chevron-left", size: "sm", "aria-hidden": true })
8925
- }
8926
- ),
8927
- /* @__PURE__ */ jsx215("span", { className: styles69.backTitle, children: shown.label })
8928
- ] }),
8929
- /* @__PURE__ */ jsx215("div", { className: styles69.body, children: shown.content })
8930
- ] })
8931
- ] }) });
8948
+ return /* @__PURE__ */ jsx215("li", { children: row }, section.id);
8949
+ }) }, group.id)) })
8950
+ ] }),
8951
+ shown && /* @__PURE__ */ jsxs179("section", { className: styles69.section, "aria-label": shown.label, children: [
8952
+ /* @__PURE__ */ jsxs179("div", { className: styles69.back, children: [
8953
+ /* @__PURE__ */ jsx215(
8954
+ "button",
8955
+ {
8956
+ type: "button",
8957
+ className: styles69.backButton,
8958
+ "aria-label": backLabel,
8959
+ onClick: () => onSelect(null),
8960
+ children: /* @__PURE__ */ jsx215(Icon, { name: "chevron-left", size: "sm", "aria-hidden": true })
8961
+ }
8962
+ ),
8963
+ /* @__PURE__ */ jsx215("span", { className: styles69.backTitle, children: shown.label })
8964
+ ] }),
8965
+ /* @__PURE__ */ jsx215("div", { className: styles69.body, children: shown.content })
8966
+ ] })
8967
+ ] })
8968
+ }
8969
+ );
8932
8970
  }
8933
8971
 
8934
8972
  // src/components/DeviceOnlyGate/DeviceOnlyGate.tsx
@@ -11636,7 +11674,8 @@ function IconPicker({
11636
11674
  "aria-label": ariaLabel,
11637
11675
  triggerLabel,
11638
11676
  disabled = false,
11639
- className
11677
+ className,
11678
+ align = "auto"
11640
11679
  }) {
11641
11680
  const [open, setOpen] = useState47(false);
11642
11681
  const trigger = /* @__PURE__ */ jsxs205(
@@ -11661,6 +11700,7 @@ function IconPicker({
11661
11700
  trigger,
11662
11701
  open,
11663
11702
  onClose: () => setOpen(false),
11703
+ align,
11664
11704
  width: 240,
11665
11705
  "aria-label": `${ariaLabel} options`,
11666
11706
  children: /* @__PURE__ */ jsx260("div", { className: styles108.grid, role: "listbox", "aria-label": ariaLabel, children: options.map((name) => /* @__PURE__ */ jsx260(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sovereignfs/ui",
3
- "version": "0.107.0",
3
+ "version": "0.107.3",
4
4
  "type": "module",
5
5
  "description": "Sovereign Design System — design tokens and React components.",
6
6
  "keywords": [