@streamoid/ui 0.6.30 → 0.6.31

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/dist/index.mjs CHANGED
@@ -119,7 +119,7 @@ function ScAppCardForCopilot({
119
119
 
120
120
  // src/SC-AppSwitch/ScAppSwitchPanel.tsx
121
121
  import { useState } from "react";
122
- import { SiconExternalLink, SiconRight as SiconRight2 } from "@streamoid/icons";
122
+ import { SiconCheck, SiconExternalLink, SiconRight as SiconRight2 } from "@streamoid/icons";
123
123
  import { Fragment, jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
124
124
  var STREAMOID_CHANGELOG_URLS = {
125
125
  tactix: "https://streamoid.com/tactix/changelog",
@@ -221,21 +221,27 @@ function orderIndex(item) {
221
221
  const index = productBrandIndex(item.key, item.name);
222
222
  return index === -1 ? PRODUCT_BRANDS.length : index;
223
223
  }
224
+ function scAppSwitchOrder(apps) {
225
+ return [...apps].sort((a, b) => orderIndex(a) - orderIndex(b));
226
+ }
224
227
  var ScAppSwitchRow = ({
225
228
  item
226
229
  }) => {
227
230
  const [hover, setHover] = useState(false);
228
231
  const [focused, setFocused] = useState(false);
229
- const interactive = hover || focused;
232
+ const current = item.current === true;
233
+ const interactive = !current && (hover || focused);
230
234
  const brand = matchProductBrand(item.key, item.name);
231
235
  const description = rowDescription(item, brand);
232
- const labelColor = interactive ? T.primary : T.secondary;
236
+ const labelColor = interactive || current ? T.primary : T.secondary;
233
237
  return /* @__PURE__ */ jsxs3(
234
238
  "button",
235
239
  {
236
240
  type: "button",
237
- "aria-label": `Switch to ${item.name}`,
238
- onClick: item.onSelect,
241
+ "aria-label": current ? `${item.name}, current app` : `Switch to ${item.name}`,
242
+ "aria-current": current ? "true" : void 0,
243
+ "aria-disabled": current ? true : void 0,
244
+ onClick: current ? void 0 : item.onSelect,
239
245
  onMouseEnter: () => setHover(true),
240
246
  onMouseLeave: () => setHover(false),
241
247
  onFocus: () => setFocused(true),
@@ -247,12 +253,16 @@ var ScAppSwitchRow = ({
247
253
  width: "100%",
248
254
  height: 60,
249
255
  padding: "var(--spacing-md, 8px) var(--spacing-xl, 12px) var(--spacing-md, 8px) var(--spacing-3xl, 16px)",
250
- background: interactive ? "var(--alias-fill-neutral-neutral, #f5f5f5)" : "transparent",
256
+ /* A FILL, NOT A SURFACE, for the selected row: every
257
+ `--alias-surface-*` token is #ffffff in the light theme (elevation
258
+ there is shadow and border, which a 60px row inside a flyout has
259
+ neither of), so a surface token would make it invisible on light. */
260
+ background: current ? "var(--alias-fill-neutral-neutralselected, #ededed)" : interactive ? "var(--alias-fill-neutral-neutral, #f5f5f5)" : "transparent",
251
261
  border: "1px solid transparent",
252
262
  borderRadius: "var(--radius-xl, 12px)",
253
263
  boxShadow: focused ? "inset 0 0 0 1px var(--alias-border-default, #cfcfcf)" : "none",
254
264
  outline: "none",
255
- cursor: "pointer",
265
+ cursor: current ? "default" : "pointer",
256
266
  fontFamily: T.font,
257
267
  transition: "background-color 120ms ease, box-shadow 120ms ease"
258
268
  },
@@ -350,10 +360,10 @@ var ScAppSwitchRow = ({
350
360
  alignItems: "center",
351
361
  justifyContent: "center",
352
362
  flexShrink: 0,
353
- opacity: interactive ? 1 : 0.45,
363
+ opacity: current || interactive ? 1 : 0.45,
354
364
  transition: "opacity 120ms ease"
355
365
  },
356
- children: /* @__PURE__ */ jsx4(SiconRight2, { size: 24, color: "var(--alias-text---icons-primary)" })
366
+ children: current ? /* @__PURE__ */ jsx4(SiconCheck, { size: 24, color: "var(--alias-text---icons-primary)" }) : /* @__PURE__ */ jsx4(SiconRight2, { size: 24, color: "var(--alias-text---icons-primary)" })
357
367
  }
358
368
  )
359
369
  ]
@@ -420,7 +430,7 @@ var ScAppSwitchPanel = ({
420
430
  className,
421
431
  style
422
432
  }) => {
423
- const ordered = [...apps].sort((a, b) => orderIndex(a) - orderIndex(b));
433
+ const ordered = scAppSwitchOrder(apps);
424
434
  const resolvedSystemItems = systemItems ?? (utilities ? createStreamoidAppSwitchUtilities(utilities) : []);
425
435
  return /* @__PURE__ */ jsxs3(
426
436
  "div",
@@ -5660,11 +5670,101 @@ function useStreamoidSidebarPreference(options = {}) {
5660
5670
  return { expanded, setExpanded, toggle };
5661
5671
  }
5662
5672
 
5663
- // src/SC-SidebarShell/useStreamoidSidebarPopoverPosition.ts
5673
+ // src/SC-SidebarShell/useStreamoidAnchoredPopoverPosition.ts
5664
5674
  import {
5665
5675
  useLayoutEffect,
5666
5676
  useState as useState13
5667
5677
  } from "react";
5678
+ var DEFAULT_GAP = 8;
5679
+ var DEFAULT_INSET = 16;
5680
+ function resolveAnchoredPopoverPosition({
5681
+ anchor,
5682
+ viewportWidth,
5683
+ viewportHeight,
5684
+ width,
5685
+ height,
5686
+ gap,
5687
+ inset
5688
+ }) {
5689
+ const available = Math.max(0, viewportWidth - inset * 2);
5690
+ const panelWidth = Math.min(width, available);
5691
+ const rightOfAnchor = anchor.right + gap;
5692
+ const leftOfAnchor = anchor.left - gap - panelWidth;
5693
+ const fitsRight = rightOfAnchor + panelWidth <= viewportWidth - inset;
5694
+ const preferredLeft = fitsRight ? rightOfAnchor : leftOfAnchor >= inset ? leftOfAnchor : rightOfAnchor;
5695
+ const left = Math.max(
5696
+ inset,
5697
+ Math.min(preferredLeft, Math.max(inset, viewportWidth - panelWidth - inset))
5698
+ );
5699
+ const panelHeight = height ?? 0;
5700
+ const downwardTop = anchor.top;
5701
+ const fitsDown = downwardTop + panelHeight <= viewportHeight - inset;
5702
+ const upwardTop = anchor.bottom - panelHeight;
5703
+ const preferredTop = fitsDown ? downwardTop : upwardTop;
5704
+ const top = Math.max(
5705
+ inset,
5706
+ Math.min(preferredTop, Math.max(inset, viewportHeight - panelHeight - inset))
5707
+ );
5708
+ return { left, top, width: panelWidth };
5709
+ }
5710
+ function useStreamoidAnchoredPopoverPosition(anchorRef, panelRef, { width, gap = DEFAULT_GAP, inset = DEFAULT_INSET }) {
5711
+ const [position, setPosition] = useState13({
5712
+ position: "fixed",
5713
+ left: 0,
5714
+ top: 0,
5715
+ width,
5716
+ maxWidth: `calc(100vw - ${inset * 2}px)`,
5717
+ maxHeight: `calc(100dvh - ${inset * 2}px)`,
5718
+ visibility: "hidden"
5719
+ });
5720
+ useLayoutEffect(() => {
5721
+ const anchor = anchorRef.current;
5722
+ if (!anchor || typeof window === "undefined") return;
5723
+ const measure = () => {
5724
+ const bounds = anchor.getBoundingClientRect();
5725
+ const panelHeight = panelRef.current?.offsetHeight;
5726
+ const { left, top, width: panelWidth } = resolveAnchoredPopoverPosition({
5727
+ anchor: bounds,
5728
+ viewportWidth: window.innerWidth,
5729
+ viewportHeight: window.innerHeight,
5730
+ width,
5731
+ height: panelHeight,
5732
+ gap,
5733
+ inset
5734
+ });
5735
+ const next = {
5736
+ position: "fixed",
5737
+ left,
5738
+ top,
5739
+ width: panelWidth,
5740
+ maxWidth: `calc(100vw - ${inset * 2}px)`,
5741
+ maxHeight: `calc(100dvh - ${inset * 2}px)`,
5742
+ visibility: "visible"
5743
+ };
5744
+ setPosition(
5745
+ (prev) => prev.left === next.left && prev.top === next.top && prev.width === next.width && prev.visibility === next.visibility ? prev : next
5746
+ );
5747
+ };
5748
+ measure();
5749
+ window.addEventListener("resize", measure);
5750
+ window.addEventListener("scroll", measure, true);
5751
+ const resizeObserver = typeof ResizeObserver === "undefined" ? null : new ResizeObserver(measure);
5752
+ resizeObserver?.observe(anchor);
5753
+ if (panelRef.current) resizeObserver?.observe(panelRef.current);
5754
+ return () => {
5755
+ window.removeEventListener("resize", measure);
5756
+ window.removeEventListener("scroll", measure, true);
5757
+ resizeObserver?.disconnect();
5758
+ };
5759
+ }, [anchorRef, panelRef, width, gap, inset]);
5760
+ return position;
5761
+ }
5762
+
5763
+ // src/SC-SidebarShell/useStreamoidSidebarPopoverPosition.ts
5764
+ import {
5765
+ useLayoutEffect as useLayoutEffect2,
5766
+ useState as useState14
5767
+ } from "react";
5668
5768
  var VIEWPORT_INSET = 16;
5669
5769
  function useStreamoidSidebarPopoverPosition(sidebarRef, {
5670
5770
  placement,
@@ -5672,7 +5772,7 @@ function useStreamoidSidebarPopoverPosition(sidebarRef, {
5672
5772
  gap = 8,
5673
5773
  inset = 0
5674
5774
  }) {
5675
- const [position, setPosition] = useState13({
5775
+ const [position, setPosition] = useState14({
5676
5776
  position: "fixed",
5677
5777
  left: 0,
5678
5778
  top: 0,
@@ -5681,7 +5781,7 @@ function useStreamoidSidebarPopoverPosition(sidebarRef, {
5681
5781
  maxHeight: `calc(100dvh - ${VIEWPORT_INSET * 2}px)`,
5682
5782
  visibility: "hidden"
5683
5783
  });
5684
- useLayoutEffect(() => {
5784
+ useLayoutEffect2(() => {
5685
5785
  const sidebar = sidebarRef.current;
5686
5786
  if (!sidebar || typeof window === "undefined") return;
5687
5787
  const findCard = () => (sidebar.matches("[data-streamoid-sidebar-card]") ? sidebar : sidebar.querySelector(
@@ -5744,7 +5844,7 @@ function useStreamoidSidebarPopoverPosition(sidebarRef, {
5744
5844
  // src/SC-Artifax-Sidebar/ScArtifaxSidebar.tsx
5745
5845
  import {
5746
5846
  useCallback as useCallback3,
5747
- useState as useState14
5847
+ useState as useState15
5748
5848
  } from "react";
5749
5849
 
5750
5850
  // src/SC-Artifax-Sidebar/ScArtifaxSidebar.module.css
@@ -5852,7 +5952,7 @@ var ScArtifaxSidebar = ({
5852
5952
  }
5853
5953
  };
5854
5954
  const isControlled = !!openSections;
5855
- const [internalOpen, setInternalOpen] = useState14(
5955
+ const [internalOpen, setInternalOpen] = useState15(
5856
5956
  () => {
5857
5957
  const init = {};
5858
5958
  sections.forEach((s) => {
@@ -6069,7 +6169,7 @@ var ScArtifaxSidebar = ({
6069
6169
  };
6070
6170
 
6071
6171
  // src/SC-Catalogix-Sidebar/ScCatalogixSidebar.tsx
6072
- import { useState as useState15 } from "react";
6172
+ import { useState as useState16 } from "react";
6073
6173
 
6074
6174
  // src/SC-Sidebar Switch menu/ScSidebarSwitchMenu.module.css
6075
6175
  var ScSidebarSwitchMenu_default = {
@@ -6717,7 +6817,7 @@ var ScCatalogixSidebar = ({
6717
6817
  className,
6718
6818
  style
6719
6819
  }) => {
6720
- const [appListOpen, setAppListOpen] = useState15(false);
6820
+ const [appListOpen, setAppListOpen] = useState16(false);
6721
6821
  const handleSwitch = () => {
6722
6822
  setAppListOpen((prev) => !prev);
6723
6823
  onLogoClick?.();
@@ -8577,7 +8677,7 @@ var ScWorkspaceCard = ({
8577
8677
  };
8578
8678
 
8579
8679
  // src/SC-WorkspaceSwitchCard/ScWorkspaceSwitchCard.tsx
8580
- import { useState as useState16 } from "react";
8680
+ import { useState as useState17 } from "react";
8581
8681
  import { SiconSwitch as SiconSwitch3, SiconSettings as SiconSettings3, SiconLogout as SiconLogout3 } from "@streamoid/icons";
8582
8682
 
8583
8683
  // src/SC-WorkspaceSwitchCard/ScWorkspaceSwitchCard.module.css
@@ -8618,7 +8718,7 @@ function ScWorkspaceSwitchCard({
8618
8718
  onSettings,
8619
8719
  onLeave
8620
8720
  }) {
8621
- const [internalHover, setInternalHover] = useState16(false);
8721
+ const [internalHover, setInternalHover] = useState17(false);
8622
8722
  const isHover = hover !== void 0 ? hover : internalHover;
8623
8723
  const isCurrent = type === "currentWS";
8624
8724
  const isOther = type === "otherWS";
@@ -8928,7 +9028,7 @@ var ScTabs = ({
8928
9028
  };
8929
9029
 
8930
9030
  // src/SC-Counter/ScCounter.tsx
8931
- import { useState as useState17 } from "react";
9031
+ import { useState as useState18 } from "react";
8932
9032
  import { SiconMinus, SiconPlus as SiconPlus2 } from "@streamoid/icons";
8933
9033
 
8934
9034
  // src/SC-Counter/ScCounter.module.css
@@ -8950,7 +9050,7 @@ var ScCounter = ({
8950
9050
  className,
8951
9051
  style
8952
9052
  }) => {
8953
- const [showInput, setShowInput] = useState17(false);
9053
+ const [showInput, setShowInput] = useState18(false);
8954
9054
  const set = (n) => {
8955
9055
  let v = n;
8956
9056
  if (min !== void 0) v = Math.max(min, v);
@@ -9441,7 +9541,7 @@ import {
9441
9541
  SiconPlus as SiconPlus3,
9442
9542
  SiconRight as SiconRight6,
9443
9543
  SiconWarning,
9444
- SiconCheck,
9544
+ SiconCheck as SiconCheck2,
9445
9545
  SiconClose as SiconClose4
9446
9546
  } from "@streamoid/icons";
9447
9547
 
@@ -9602,7 +9702,7 @@ var ScMappingCard = ({
9602
9702
  className: [ScMappingCard_default.statusLabel, ScMappingCard_default.statusSuccess].join(" "),
9603
9703
  children: [
9604
9704
  /* @__PURE__ */ jsx97("span", { className: ScMappingCard_default.statusIcon, children: /* @__PURE__ */ jsx97(
9605
- SiconCheck,
9705
+ SiconCheck2,
9606
9706
  {
9607
9707
  size: 24,
9608
9708
  color: "var(--alias-text-and-icons-success, #00b96b)"
@@ -10045,7 +10145,7 @@ var ScSelectionList = ({
10045
10145
  };
10046
10146
 
10047
10147
  // src/SC-textArea/ScTextArea.tsx
10048
- import { useState as useState18 } from "react";
10148
+ import { useState as useState19 } from "react";
10049
10149
 
10050
10150
  // src/SC-textArea/ScTextArea.module.css
10051
10151
  var ScTextArea_default = {
@@ -10075,7 +10175,7 @@ var ScTextArea = ({
10075
10175
  style,
10076
10176
  ...props
10077
10177
  }) => {
10078
- const [focused, setFocused] = useState18(false);
10178
+ const [focused, setFocused] = useState19(false);
10079
10179
  const derivedState = state ?? (props.disabled ? "disabled" : focused ? "active" : (props.value !== void 0 ? String(props.value).length > 0 : false) ? "filled" : "default");
10080
10180
  const stateClass = ScTextArea_default["state-" + derivedState];
10081
10181
  const labelGroupClass = ScTextArea_default["label-group-" + (labelGroup || "none")];
@@ -10117,7 +10217,7 @@ var ScTextArea = ({
10117
10217
  };
10118
10218
 
10119
10219
  // src/SC-select/ScSelect.tsx
10120
- import { useState as useState19, useRef as useRef8, useEffect as useEffect8 } from "react";
10220
+ import { useState as useState20, useRef as useRef8, useEffect as useEffect8 } from "react";
10121
10221
 
10122
10222
  // src/SC-select/ScSelect.module.css
10123
10223
  var ScSelect_default = {
@@ -10154,7 +10254,7 @@ var ScSelect = (props) => {
10154
10254
  disabled = false,
10155
10255
  className
10156
10256
  } = props;
10157
- const [open, setOpen] = useState19(false);
10257
+ const [open, setOpen] = useState20(false);
10158
10258
  const rootRef = useRef8(null);
10159
10259
  useEffect8(() => {
10160
10260
  if (!open) return;
@@ -10404,7 +10504,7 @@ var ScFileField = (props) => {
10404
10504
  };
10405
10505
 
10406
10506
  // src/SC-mediaApproval/ScMediaApproval.tsx
10407
- import { useState as useState20, useEffect as useEffect9 } from "react";
10507
+ import { useState as useState21, useEffect as useEffect9 } from "react";
10408
10508
 
10409
10509
  // src/SC-mediaApproval/ScMediaApproval.module.css
10410
10510
  var ScMediaApproval_default = {
@@ -10451,8 +10551,8 @@ var ScMediaApproval = (props) => {
10451
10551
  className
10452
10552
  } = props;
10453
10553
  const total = mediaUrls.length;
10454
- const [index, setIndex] = useState20(activeIndex ?? 0);
10455
- const [mediaLoading, setMediaLoading] = useState20(false);
10554
+ const [index, setIndex] = useState21(activeIndex ?? 0);
10555
+ const [mediaLoading, setMediaLoading] = useState21(false);
10456
10556
  useEffect9(() => {
10457
10557
  if (typeof activeIndex === "number") {
10458
10558
  setIndex(activeIndex);
@@ -10713,7 +10813,7 @@ var ScMediaSelect = (props) => {
10713
10813
  };
10714
10814
 
10715
10815
  // src/SC-todoList/ScTodoList.tsx
10716
- import { useState as useState21 } from "react";
10816
+ import { useState as useState22 } from "react";
10717
10817
 
10718
10818
  // src/SC-todoList/ScTodoList.module.css
10719
10819
  var ScTodoList_default = {
@@ -10746,9 +10846,9 @@ var ScTodoList = ({
10746
10846
  addPlaceholder = "Add an item",
10747
10847
  className
10748
10848
  }) => {
10749
- const [editingId, setEditingId] = useState21(null);
10750
- const [editValue, setEditValue] = useState21("");
10751
- const [newValue, setNewValue] = useState21("");
10849
+ const [editingId, setEditingId] = useState22(null);
10850
+ const [editValue, setEditValue] = useState22("");
10851
+ const [newValue, setNewValue] = useState22("");
10752
10852
  const total = items.length;
10753
10853
  const completed = items.filter((i) => i.status === "completed").length;
10754
10854
  const startEditing = (item) => {
@@ -12239,10 +12339,13 @@ export {
12239
12339
  createStreamoidAppSwitchUtilities,
12240
12340
  formatSubAgentLabel,
12241
12341
  hasCollapsedMark,
12342
+ resolveAnchoredPopoverPosition,
12242
12343
  resolvePanelResize,
12243
12344
  resolvePanelResizeKey,
12345
+ scAppSwitchOrder,
12244
12346
  streamoidAppSwitchTagline,
12245
12347
  streamoidChangelogUrl,
12348
+ useStreamoidAnchoredPopoverPosition,
12246
12349
  useStreamoidPanelWidth,
12247
12350
  useStreamoidSidebarPopoverPosition,
12248
12351
  useStreamoidSidebarPreference,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@streamoid/ui",
3
- "version": "0.6.30",
3
+ "version": "0.6.31",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.mjs",
6
6
  "types": "./dist/index.d.ts",