@assure-one/design-system 1.17.0 → 1.17.2

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.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  import * as React38 from 'react';
3
- import { forwardRef, useId, useRef, useState, useEffect, useCallback, useImperativeHandle, useMemo, createContext, useContext } from 'react';
3
+ import { forwardRef, useId, useRef, useState, useEffect, useCallback, useImperativeHandle, useMemo, createContext, Fragment as Fragment$1, useContext } from 'react';
4
4
  import * as AccordionPrimitive from '@radix-ui/react-accordion';
5
5
  import { clsx } from 'clsx';
6
6
  import { twMerge } from 'tailwind-merge';
@@ -5834,7 +5834,8 @@ LoadingRows.displayName = "LoadingRows";
5834
5834
  var sizeStyles = {
5835
5835
  sm: { icon: 20, text: "text-sm", gap: "gap-2", assetHeight: 24 },
5836
5836
  md: { icon: 24, text: "text-[17px]", gap: "gap-2.5", assetHeight: 30 },
5837
- lg: { icon: 32, text: "text-xl", gap: "gap-3", assetHeight: 40 }
5837
+ lg: { icon: 32, text: "text-xl", gap: "gap-3", assetHeight: 40 },
5838
+ xl: { icon: 40, text: "text-2xl", gap: "gap-3.5", assetHeight: 48 }
5838
5839
  };
5839
5840
  var productLogoAssets = {
5840
5841
  Pro: { src: "/brand/assure-pro.svg", width: 384, height: 90 },
@@ -5869,69 +5870,66 @@ function Logo({
5869
5870
  const asset = productName ? productLogoAssets[productName] : void 0;
5870
5871
  const markAsset = productName ? productMarkAssets[productName] : void 0;
5871
5872
  const Glyph = productName ? productGlyphs[productName] : void 0;
5872
- return /* @__PURE__ */ jsxs(
5873
- Link,
5874
- {
5875
- href,
5876
- className: cn("inline-flex items-center", s.gap, className),
5877
- "aria-label": ariaLabel,
5878
- children: [
5879
- asset && showText ? /* @__PURE__ */ jsx(
5880
- Image2,
5881
- {
5882
- src: asset.src,
5883
- alt: "",
5884
- width: asset.width,
5885
- height: asset.height,
5886
- priority: true,
5887
- className: cn("h-auto flex-shrink-0", inverted && "brightness-0 invert", iconClassName),
5888
- style: { width: Math.round(asset.width / asset.height * s.assetHeight) }
5889
- }
5890
- ) : markAsset ? /* @__PURE__ */ jsx(
5891
- Image2,
5892
- {
5893
- src: markAsset.src,
5894
- alt: "",
5895
- width: markAsset.width,
5896
- height: markAsset.height,
5897
- priority: true,
5898
- className: cn("h-auto flex-shrink-0", inverted && "brightness-0 invert", iconClassName),
5899
- style: { width: Math.round(markAsset.width / markAsset.height * s.icon) }
5900
- }
5901
- ) : /* @__PURE__ */ jsx(Fragment, { children: Glyph ? /* @__PURE__ */ jsx(Glyph, { size: s.icon, "aria-hidden": "true", className: iconClassName }) : /* @__PURE__ */ jsx(
5902
- "span",
5903
- {
5904
- "aria-hidden": "true",
5905
- className: cn(
5906
- "bg-pro-fg grid shrink-0 place-items-center rounded-[5px] text-[10px] font-bold text-white",
5907
- iconClassName
5908
- ),
5909
- style: { width: s.icon, height: s.icon },
5910
- children: "A"
5911
- }
5912
- ) }),
5913
- showText && /* @__PURE__ */ jsxs(
5914
- "span",
5915
- {
5916
- className: cn(
5917
- "font-display font-semibold tracking-[-0.025em]",
5918
- s.text,
5919
- inverted ? "text-white" : "text-fg",
5920
- asset && "sr-only",
5921
- textClassName
5922
- ),
5923
- children: [
5924
- /* @__PURE__ */ jsx("span", { children: "Assure" }),
5925
- productName && /* @__PURE__ */ jsxs(Fragment, { children: [
5926
- " ",
5927
- /* @__PURE__ */ jsx("span", { className: cn("font-medium", inverted ? "text-[#d8cfff]" : "text-pro-fg"), children: productName })
5928
- ] })
5929
- ]
5930
- }
5931
- )
5932
- ]
5933
- }
5934
- );
5873
+ const wrapperClassName = cn("inline-flex items-center", s.gap, className);
5874
+ const content = /* @__PURE__ */ jsxs(Fragment, { children: [
5875
+ asset && showText ? /* @__PURE__ */ jsx(
5876
+ Image2,
5877
+ {
5878
+ src: asset.src,
5879
+ alt: "",
5880
+ width: asset.width,
5881
+ height: asset.height,
5882
+ priority: true,
5883
+ className: cn("h-auto flex-shrink-0", inverted && "brightness-0 invert", iconClassName),
5884
+ style: { width: Math.round(asset.width / asset.height * s.assetHeight) }
5885
+ }
5886
+ ) : markAsset ? /* @__PURE__ */ jsx(
5887
+ Image2,
5888
+ {
5889
+ src: markAsset.src,
5890
+ alt: "",
5891
+ width: markAsset.width,
5892
+ height: markAsset.height,
5893
+ priority: true,
5894
+ className: cn("h-auto flex-shrink-0", inverted && "brightness-0 invert", iconClassName),
5895
+ style: { width: Math.round(markAsset.width / markAsset.height * s.icon) }
5896
+ }
5897
+ ) : /* @__PURE__ */ jsx(Fragment, { children: Glyph ? /* @__PURE__ */ jsx(Glyph, { size: s.icon, "aria-hidden": "true", className: iconClassName }) : /* @__PURE__ */ jsx(
5898
+ "span",
5899
+ {
5900
+ "aria-hidden": "true",
5901
+ className: cn(
5902
+ "bg-pro-fg grid shrink-0 place-items-center rounded-[5px] text-[10px] font-bold text-white",
5903
+ iconClassName
5904
+ ),
5905
+ style: { width: s.icon, height: s.icon },
5906
+ children: "A"
5907
+ }
5908
+ ) }),
5909
+ showText && /* @__PURE__ */ jsxs(
5910
+ "span",
5911
+ {
5912
+ className: cn(
5913
+ "font-display font-semibold tracking-[-0.025em]",
5914
+ s.text,
5915
+ inverted ? "text-white" : "text-fg",
5916
+ asset && "sr-only",
5917
+ textClassName
5918
+ ),
5919
+ children: [
5920
+ /* @__PURE__ */ jsx("span", { children: "Assure" }),
5921
+ productName && /* @__PURE__ */ jsxs(Fragment, { children: [
5922
+ " ",
5923
+ /* @__PURE__ */ jsx("span", { className: cn("font-medium", inverted ? "text-[#d8cfff]" : "text-pro-fg"), children: productName })
5924
+ ] })
5925
+ ]
5926
+ }
5927
+ )
5928
+ ] });
5929
+ if (href === null) {
5930
+ return /* @__PURE__ */ jsx("span", { className: wrapperClassName, children: content });
5931
+ }
5932
+ return /* @__PURE__ */ jsx(Link, { href, className: wrapperClassName, "aria-label": ariaLabel, children: content });
5935
5933
  }
5936
5934
  var MasterDetailLayout = forwardRef(
5937
5935
  function MasterDetailLayout2({
@@ -11430,17 +11428,29 @@ var Questions = forwardRef(function Questions2({
11430
11428
  value = "",
11431
11429
  values = [],
11432
11430
  placeholder,
11431
+ help,
11433
11432
  addressValue = {},
11433
+ nameValue = {},
11434
+ showSuffix = true,
11434
11435
  tableColumns = [],
11435
11436
  tableRows = [],
11437
+ labeledColumns = [],
11438
+ labeledRows = [],
11439
+ labeledValue = {},
11436
11440
  files = [],
11437
11441
  accept,
11438
11442
  maxSize,
11439
11443
  multiple,
11440
11444
  currencySymbol = "$",
11445
+ min = 0,
11446
+ max,
11447
+ step = 1,
11448
+ countLabel,
11441
11449
  onValueChange,
11442
11450
  onValuesChange,
11443
11451
  onAddressChange,
11452
+ onNameChange,
11453
+ onLabeledChange,
11444
11454
  onTableRowsChange,
11445
11455
  onFilesSelected,
11446
11456
  className,
@@ -11457,21 +11467,36 @@ var Questions = forwardRef(function Questions2({
11457
11467
  const updateAddress = (key, nextValue) => {
11458
11468
  onAddressChange?.({ ...addressValue, [key]: nextValue });
11459
11469
  };
11470
+ const updateName = (key, nextValue) => {
11471
+ onNameChange?.({ ...nameValue, [key]: nextValue });
11472
+ };
11473
+ const updateCell = (rowKey, colKey, nextValue) => {
11474
+ onLabeledChange?.({
11475
+ ...labeledValue,
11476
+ [rowKey]: { ...labeledValue[rowKey] ?? {}, [colKey]: nextValue }
11477
+ });
11478
+ };
11460
11479
  const updateRow = (rowIndex, key, nextValue) => {
11461
11480
  onTableRowsChange?.(
11462
11481
  tableRows.map((row, index2) => index2 === rowIndex ? { ...row, [key]: nextValue } : row)
11463
11482
  );
11464
11483
  };
11484
+ const emptyRow = () => tableColumns.reduce((row, column) => ({ ...row, [column.key]: "" }), {});
11465
11485
  const addRow = () => {
11466
- const emptyRow = tableColumns.reduce(
11467
- (row, column) => ({ ...row, [column.key]: "" }),
11468
- {}
11469
- );
11470
- onTableRowsChange?.([...tableRows, emptyRow]);
11486
+ onTableRowsChange?.([...tableRows, emptyRow()]);
11471
11487
  };
11472
11488
  const removeRow = (rowIndex) => {
11473
11489
  onTableRowsChange?.(tableRows.filter((_, index2) => index2 !== rowIndex));
11474
11490
  };
11491
+ const setRowCount = (nextCount) => {
11492
+ const clamped = Math.max(min, max != null ? Math.min(nextCount, max) : nextCount);
11493
+ if (clamped > tableRows.length) {
11494
+ const added = Array.from({ length: clamped - tableRows.length }, emptyRow);
11495
+ onTableRowsChange?.([...tableRows, ...added]);
11496
+ } else if (clamped < tableRows.length) {
11497
+ onTableRowsChange?.(tableRows.slice(0, clamped));
11498
+ }
11499
+ };
11475
11500
  return /* @__PURE__ */ jsxs(
11476
11501
  "section",
11477
11502
  {
@@ -11505,6 +11530,7 @@ var Questions = forwardRef(function Questions2({
11505
11530
  children: title
11506
11531
  }
11507
11532
  ),
11533
+ help && /* @__PURE__ */ jsx(HelpTip, { title: help.title ?? title, body: help.body }),
11508
11534
  required && /* @__PURE__ */ jsx("span", { className: "bg-pro-bg text-pro-fg rounded-full px-2 py-0.5 text-[11px] font-bold", children: "Required" })
11509
11535
  ] }),
11510
11536
  description && type !== "consent-checkbox" && /* @__PURE__ */ jsx("p", { className: "text-fg-3 mt-1 text-[13px] leading-5", children: description })
@@ -11575,6 +11601,17 @@ var Questions = forwardRef(function Questions2({
11575
11601
  className: "h-11 rounded-[12px] text-[14px]"
11576
11602
  }
11577
11603
  ),
11604
+ type === "number-stepper" && /* @__PURE__ */ jsx(
11605
+ NumberStepper,
11606
+ {
11607
+ value: Number(value) || 0,
11608
+ onValueChange: (next) => onValueChange?.(String(next)),
11609
+ min,
11610
+ max,
11611
+ step,
11612
+ ariaLabel: title
11613
+ }
11614
+ ),
11578
11615
  type === "currency" && /* @__PURE__ */ jsx(
11579
11616
  Input,
11580
11617
  {
@@ -11719,6 +11756,89 @@ var Questions = forwardRef(function Questions2({
11719
11756
  }
11720
11757
  )
11721
11758
  ] }),
11759
+ type === "name" && /* @__PURE__ */ jsxs("div", { className: "grid gap-3 sm:grid-cols-6", children: [
11760
+ /* @__PURE__ */ jsx(
11761
+ Input,
11762
+ {
11763
+ value: nameValue.first ?? "",
11764
+ onChange: (event) => updateName("first", event.target.value),
11765
+ placeholder: "First name",
11766
+ "aria-label": `${title} first name`,
11767
+ className: "h-11 rounded-[12px] text-[14px] sm:col-span-2"
11768
+ }
11769
+ ),
11770
+ /* @__PURE__ */ jsx(
11771
+ Input,
11772
+ {
11773
+ value: nameValue.middle ?? "",
11774
+ onChange: (event) => updateName("middle", event.target.value),
11775
+ placeholder: "Middle",
11776
+ "aria-label": `${title} middle name`,
11777
+ className: "h-11 rounded-[12px] text-[14px] sm:col-span-1"
11778
+ }
11779
+ ),
11780
+ /* @__PURE__ */ jsx(
11781
+ Input,
11782
+ {
11783
+ value: nameValue.last ?? "",
11784
+ onChange: (event) => updateName("last", event.target.value),
11785
+ placeholder: "Last name",
11786
+ "aria-label": `${title} last name`,
11787
+ className: cn(
11788
+ "h-11 rounded-[12px] text-[14px]",
11789
+ showSuffix ? "sm:col-span-2" : "sm:col-span-3"
11790
+ )
11791
+ }
11792
+ ),
11793
+ showSuffix && /* @__PURE__ */ jsx(
11794
+ Input,
11795
+ {
11796
+ value: nameValue.suffix ?? "",
11797
+ onChange: (event) => updateName("suffix", event.target.value),
11798
+ placeholder: "Suffix",
11799
+ "aria-label": `${title} suffix`,
11800
+ className: "h-11 rounded-[12px] text-[14px] sm:col-span-1"
11801
+ }
11802
+ )
11803
+ ] }),
11804
+ type === "labeled-table" && /* @__PURE__ */ jsx("div", { className: "overflow-x-auto", children: /* @__PURE__ */ jsxs(
11805
+ "div",
11806
+ {
11807
+ role: "table",
11808
+ "aria-label": title,
11809
+ className: "grid min-w-[560px] gap-2",
11810
+ style: {
11811
+ gridTemplateColumns: `minmax(120px,max-content) ${labeledColumns.map((column) => `minmax(0, ${column.width ?? 1}fr)`).join(" ")}`
11812
+ },
11813
+ children: [
11814
+ /* @__PURE__ */ jsx("span", { "aria-hidden": "true" }),
11815
+ labeledColumns.map((column) => /* @__PURE__ */ jsx(
11816
+ "span",
11817
+ {
11818
+ className: "text-fg-3 flex items-end px-1 text-[12px] font-semibold",
11819
+ children: column.title
11820
+ },
11821
+ column.key
11822
+ )),
11823
+ labeledRows.map((row) => /* @__PURE__ */ jsxs(Fragment$1, { children: [
11824
+ /* @__PURE__ */ jsx("span", { className: "text-fg flex items-center text-[13px] font-semibold", children: row.title }),
11825
+ labeledColumns.map((column) => /* @__PURE__ */ jsx(
11826
+ Input,
11827
+ {
11828
+ type: column.inputType === "date" ? "date" : "text",
11829
+ value: labeledValue[row.key]?.[column.key] ?? "",
11830
+ onChange: (event) => updateCell(row.key, column.key, event.target.value),
11831
+ "aria-label": `${title} ${row.title} ${column.title}`,
11832
+ className: "h-11 rounded-[12px] text-[14px]",
11833
+ inputMode: column.inputType === "number" || column.inputType === "currency" ? "decimal" : void 0,
11834
+ prefixIcon: column.inputType === "currency" ? /* @__PURE__ */ jsx("span", { className: "text-xs font-semibold", children: currencySymbol }) : void 0
11835
+ },
11836
+ column.key
11837
+ ))
11838
+ ] }, row.key))
11839
+ ]
11840
+ }
11841
+ ) }),
11722
11842
  type === "file-upload" && /* @__PURE__ */ jsxs("div", { className: "grid gap-3", children: [
11723
11843
  /* @__PURE__ */ jsx(
11724
11844
  FileUpload,
@@ -11740,6 +11860,20 @@ var Questions = forwardRef(function Questions2({
11740
11860
  )) })
11741
11861
  ] }),
11742
11862
  (type === "table" || type === "repeater") && /* @__PURE__ */ jsxs("div", { className: "grid gap-3", children: [
11863
+ countLabel && /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center justify-between gap-3", children: [
11864
+ /* @__PURE__ */ jsx("span", { className: "text-fg text-[13px] font-semibold", children: countLabel }),
11865
+ /* @__PURE__ */ jsx(
11866
+ NumberStepper,
11867
+ {
11868
+ value: tableRows.length,
11869
+ onValueChange: setRowCount,
11870
+ min,
11871
+ max,
11872
+ step,
11873
+ ariaLabel: countLabel
11874
+ }
11875
+ )
11876
+ ] }),
11743
11877
  tableRows.map((row, rowIndex) => /* @__PURE__ */ jsxs("div", { className: "border-rule bg-surface-2 rounded-[16px] border p-4", children: [
11744
11878
  /* @__PURE__ */ jsxs("div", { className: "mb-3 flex items-center justify-between gap-3", children: [
11745
11879
  /* @__PURE__ */ jsxs("span", { className: "text-fg text-[13px] font-semibold", children: [
@@ -11747,7 +11881,7 @@ var Questions = forwardRef(function Questions2({
11747
11881
  " ",
11748
11882
  rowIndex + 1
11749
11883
  ] }),
11750
- tableRows.length > 1 && /* @__PURE__ */ jsx(
11884
+ !countLabel && tableRows.length > 1 && /* @__PURE__ */ jsx(
11751
11885
  Button,
11752
11886
  {
11753
11887
  type: "button",
@@ -11774,7 +11908,7 @@ var Questions = forwardRef(function Questions2({
11774
11908
  column.key
11775
11909
  )) })
11776
11910
  ] }, rowIndex)),
11777
- /* @__PURE__ */ jsxs(
11911
+ !countLabel && /* @__PURE__ */ jsxs(
11778
11912
  Button,
11779
11913
  {
11780
11914
  type: "button",
@@ -11855,25 +11989,7 @@ function QuestionOptionButton({
11855
11989
  ),
11856
11990
  /* @__PURE__ */ jsxs("span", { className: "flex min-w-0 flex-1 items-center gap-1.5", children: [
11857
11991
  /* @__PURE__ */ jsx("span", { className: cn("truncate font-bold", compact ? "text-[13px]" : "text-[15px]"), children: option.label }),
11858
- option.helpText && /* @__PURE__ */ jsxs(Tooltip, { children: [
11859
- /* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: cn("inline-flex shrink-0 cursor-help", "text-pro-fg"), children: /* @__PURE__ */ jsx(HelpCircleIcon, { size: 14, "aria-hidden": "true" }) }) }),
11860
- /* @__PURE__ */ jsxs(
11861
- TooltipContent,
11862
- {
11863
- side: "top",
11864
- align: "center",
11865
- sideOffset: 12,
11866
- className: cn(
11867
- "border-rule bg-surface shadow-pop relative max-w-[352px] rounded-[7px] p-5 text-left",
11868
- "after:border-rule after:bg-surface after:absolute after:top-full after:left-1/2 after:size-4 after:-translate-x-1/2 after:-translate-y-1/2 after:rotate-45 after:border-r after:border-b after:content-['']"
11869
- ),
11870
- children: [
11871
- /* @__PURE__ */ jsx("div", { className: "text-fg text-[15px] leading-5 font-bold", children: option.label }),
11872
- /* @__PURE__ */ jsx("p", { className: "text-fg-2 mt-3 text-[14px] leading-6", children: option.helpText })
11873
- ]
11874
- }
11875
- )
11876
- ] })
11992
+ option.helpText && /* @__PURE__ */ jsx(HelpTip, { title: option.label, body: option.helpText })
11877
11993
  ] }),
11878
11994
  option.formLabel && !compact && /* @__PURE__ */ jsx(
11879
11995
  "span",
@@ -11894,6 +12010,90 @@ function formatBytes2(bytes) {
11894
12010
  if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`;
11895
12011
  return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
11896
12012
  }
12013
+ function HelpTip({ title, body }) {
12014
+ return /* @__PURE__ */ jsxs(Tooltip, { children: [
12015
+ /* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "text-pro-fg inline-flex shrink-0 cursor-help", children: /* @__PURE__ */ jsx(HelpCircleIcon, { size: 14, "aria-hidden": "true" }) }) }),
12016
+ /* @__PURE__ */ jsxs(
12017
+ TooltipContent,
12018
+ {
12019
+ side: "top",
12020
+ align: "center",
12021
+ sideOffset: 12,
12022
+ className: cn(
12023
+ "border-rule bg-surface shadow-pop relative max-w-[352px] rounded-[7px] p-5 text-left",
12024
+ "after:border-rule after:bg-surface after:absolute after:top-full after:left-1/2 after:size-4 after:-translate-x-1/2 after:-translate-y-1/2 after:rotate-45 after:border-r after:border-b after:content-['']"
12025
+ ),
12026
+ children: [
12027
+ /* @__PURE__ */ jsx("div", { className: "text-fg text-[15px] leading-5 font-bold", children: title }),
12028
+ /* @__PURE__ */ jsx("p", { className: "text-fg-2 mt-3 text-[14px] leading-6", children: body })
12029
+ ]
12030
+ }
12031
+ )
12032
+ ] });
12033
+ }
12034
+ function NumberStepper({
12035
+ value,
12036
+ onValueChange,
12037
+ min = 0,
12038
+ max,
12039
+ step = 1,
12040
+ ariaLabel
12041
+ }) {
12042
+ const clamp = (next) => Math.max(min, max != null ? Math.min(next, max) : next);
12043
+ const current = clamp(Number.isFinite(value) ? value : min);
12044
+ const atMin = current <= min;
12045
+ const atMax = max != null && current >= max;
12046
+ return /* @__PURE__ */ jsxs(
12047
+ "div",
12048
+ {
12049
+ className: "inline-flex items-center gap-2",
12050
+ role: "spinbutton",
12051
+ "aria-valuenow": current,
12052
+ "aria-valuemin": min,
12053
+ "aria-valuemax": max,
12054
+ "aria-label": ariaLabel,
12055
+ children: [
12056
+ /* @__PURE__ */ jsx(
12057
+ Button,
12058
+ {
12059
+ type: "button",
12060
+ variant: "secondary",
12061
+ size: "icon-sm",
12062
+ onClick: () => onValueChange(clamp(current - step)),
12063
+ disabled: atMin,
12064
+ "aria-label": "Decrease",
12065
+ children: /* @__PURE__ */ jsx(MinusIcon, { size: 14, "aria-hidden": "true" })
12066
+ }
12067
+ ),
12068
+ /* @__PURE__ */ jsx(
12069
+ Input,
12070
+ {
12071
+ value: String(current),
12072
+ onChange: (event) => {
12073
+ const parsed = Number(event.target.value.replace(/[^0-9-]/g, ""));
12074
+ onValueChange(clamp(Number.isFinite(parsed) ? parsed : min));
12075
+ },
12076
+ inputMode: "numeric",
12077
+ "aria-label": ariaLabel,
12078
+ className: "h-11 w-14 rounded-[12px] text-center text-[14px] tabular-nums"
12079
+ }
12080
+ ),
12081
+ /* @__PURE__ */ jsx(
12082
+ Button,
12083
+ {
12084
+ type: "button",
12085
+ variant: "secondary",
12086
+ size: "icon-sm",
12087
+ onClick: () => onValueChange(clamp(current + step)),
12088
+ disabled: atMax,
12089
+ "aria-label": "Increase",
12090
+ children: /* @__PURE__ */ jsx(PlusIcon, { size: 14, "aria-hidden": "true" })
12091
+ }
12092
+ )
12093
+ ]
12094
+ }
12095
+ );
12096
+ }
11897
12097
  function AiSpark({ size = 16, className }) {
11898
12098
  const id = useId();
11899
12099
  return /* @__PURE__ */ jsxs(
@@ -13802,6 +14002,8 @@ var SidebarBrandSwitcher = React38.forwardRef(
13802
14002
  current,
13803
14003
  items,
13804
14004
  onLaunch,
14005
+ extras,
14006
+ isLaunching,
13805
14007
  currentSectionLabel = "Currently using",
13806
14008
  switchSectionLabel = "Switch to",
13807
14009
  menuLabel = "Suite",
@@ -13811,6 +14013,7 @@ var SidebarBrandSwitcher = React38.forwardRef(
13811
14013
  className,
13812
14014
  triggerClassName,
13813
14015
  contentClassName,
14016
+ rowClassName,
13814
14017
  trailing
13815
14018
  }, ref) {
13816
14019
  const [open, setOpen] = React38.useState(false);
@@ -13871,7 +14074,14 @@ var SidebarBrandSwitcher = React38.forwardRef(
13871
14074
  children: [
13872
14075
  /* @__PURE__ */ jsx(DropdownMenuLabel, { className: "px-2 pt-1 pb-1.5", children: menuLabel }),
13873
14076
  /* @__PURE__ */ jsx(SidebarBrandSwitcherSectionLabel, { children: currentSectionLabel }),
13874
- /* @__PURE__ */ jsx(SidebarBrandSwitcherCurrentRow, { item: current, badge: currentBadge }),
14077
+ /* @__PURE__ */ jsx(
14078
+ SidebarBrandSwitcherCurrentRow,
14079
+ {
14080
+ item: current,
14081
+ badge: currentBadge,
14082
+ rowClassName
14083
+ }
14084
+ ),
13875
14085
  /* @__PURE__ */ jsx(DropdownMenuSeparator, { className: "my-1.5" }),
13876
14086
  /* @__PURE__ */ jsx(SidebarBrandSwitcherSectionLabel, { children: switchSectionLabel }),
13877
14087
  others.map((p) => /* @__PURE__ */ jsx(
@@ -13879,10 +14089,13 @@ var SidebarBrandSwitcher = React38.forwardRef(
13879
14089
  {
13880
14090
  item: p,
13881
14091
  onLaunch,
13882
- unavailableBadge
14092
+ unavailableBadge,
14093
+ rowClassName,
14094
+ isLaunching
13883
14095
  },
13884
14096
  p.id
13885
- ))
14097
+ )),
14098
+ extras?.map((extra) => /* @__PURE__ */ jsx(SidebarBrandSwitcherExtraRow, { extra }, extra.id))
13886
14099
  ]
13887
14100
  }
13888
14101
  )
@@ -13914,28 +14127,53 @@ function SidebarBrandSwitcherTile({ item }) {
13914
14127
  }
13915
14128
  );
13916
14129
  }
13917
- function SidebarBrandSwitcherCurrentRow({
13918
- item,
13919
- badge
13920
- }) {
13921
- return /* @__PURE__ */ jsxs("div", { className: "mx-0 flex cursor-default items-center gap-2.5 rounded-md bg-bg-2 px-2 py-1.5", children: [
14130
+ function SidebarBrandSwitcherIdentity({ item }) {
14131
+ if (item.identity) {
14132
+ return /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-1 flex-col gap-0.5", children: [
14133
+ item.identity,
14134
+ item.tagline && /* @__PURE__ */ jsx("span", { className: "text-fg-3 text-[11px] leading-tight", children: item.tagline })
14135
+ ] });
14136
+ }
14137
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
13922
14138
  /* @__PURE__ */ jsx(SidebarBrandSwitcherTile, { item }),
13923
14139
  /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-1 flex-col", children: [
13924
14140
  /* @__PURE__ */ jsx("span", { className: "text-fg text-[13px] font-medium", children: item.name }),
13925
14141
  item.tagline && /* @__PURE__ */ jsx("span", { className: "text-fg-3 text-[11px]", children: item.tagline })
13926
- ] }),
13927
- badge && /* @__PURE__ */ jsx("span", { className: "rounded-sm px-1.5 py-0.5 text-[10px] font-medium tracking-wider uppercase text-pro-fg ring-1 ring-pro-fg/30", children: badge })
14142
+ ] })
13928
14143
  ] });
13929
14144
  }
14145
+ function SidebarBrandSwitcherCurrentRow({
14146
+ item,
14147
+ badge,
14148
+ rowClassName
14149
+ }) {
14150
+ return /* @__PURE__ */ jsxs(
14151
+ "div",
14152
+ {
14153
+ className: cn(
14154
+ "mx-0 flex cursor-default items-center gap-2.5 rounded-md bg-bg-2 px-2 py-1.5",
14155
+ rowClassName
14156
+ ),
14157
+ children: [
14158
+ /* @__PURE__ */ jsx(SidebarBrandSwitcherIdentity, { item }),
14159
+ badge && /* @__PURE__ */ jsx("span", { className: "rounded-sm px-1.5 py-0.5 text-[10px] font-medium tracking-wider uppercase text-pro-fg ring-1 ring-pro-fg/30", children: badge })
14160
+ ]
14161
+ }
14162
+ );
14163
+ }
13930
14164
  function SidebarBrandSwitcherOtherRow({
13931
14165
  item,
13932
14166
  onLaunch,
13933
- unavailableBadge
14167
+ unavailableBadge,
14168
+ rowClassName,
14169
+ isLaunching
13934
14170
  }) {
13935
14171
  const reachable = item.available !== false;
13936
14172
  const [launching, setLaunching] = React38.useState(false);
14173
+ const externalLaunching = isLaunching?.(item) ?? false;
14174
+ const busy = launching || externalLaunching;
13937
14175
  const handleSelect = async () => {
13938
- if (!reachable || launching || !onLaunch) return;
14176
+ if (!reachable || busy || !onLaunch) return;
13939
14177
  setLaunching(true);
13940
14178
  try {
13941
14179
  await onLaunch(item);
@@ -13955,15 +14193,28 @@ function SidebarBrandSwitcherOtherRow({
13955
14193
  void handleSelect();
13956
14194
  },
13957
14195
  "data-item": item.dataAttr ?? item.id,
14196
+ className: cn("flex items-center gap-2.5 rounded-md px-2 py-1.5", rowClassName),
14197
+ children: [
14198
+ /* @__PURE__ */ jsx(SidebarBrandSwitcherIdentity, { item }),
14199
+ !reachable && unavailableBadge && /* @__PURE__ */ jsx("span", { className: "rounded-sm bg-bg-3 px-1.5 py-0.5 text-[10px] font-medium tracking-wider uppercase text-fg-4", children: unavailableBadge }),
14200
+ reachable && busy && /* @__PURE__ */ jsx("span", { className: "rounded-sm bg-bg-3 px-1.5 py-0.5 text-[10px] font-medium tracking-wider uppercase text-fg-4", children: "Opening\u2026" })
14201
+ ]
14202
+ }
14203
+ );
14204
+ }
14205
+ function SidebarBrandSwitcherExtraRow({ extra }) {
14206
+ return /* @__PURE__ */ jsxs(
14207
+ DropdownMenuItem,
14208
+ {
14209
+ onSelect: () => extra.onSelect(),
14210
+ "data-item": extra.dataAttr ?? extra.id,
13958
14211
  className: "flex items-center gap-2.5 rounded-md px-2 py-1.5",
13959
14212
  children: [
13960
- /* @__PURE__ */ jsx(SidebarBrandSwitcherTile, { item }),
14213
+ extra.glyph,
13961
14214
  /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-1 flex-col", children: [
13962
- /* @__PURE__ */ jsx("span", { className: "text-fg text-[13px] font-medium", children: item.name }),
13963
- item.tagline && /* @__PURE__ */ jsx("span", { className: "text-fg-3 text-[11px]", children: item.tagline })
13964
- ] }),
13965
- !reachable && unavailableBadge && /* @__PURE__ */ jsx("span", { className: "rounded-sm bg-bg-3 px-1.5 py-0.5 text-[10px] font-medium tracking-wider uppercase text-fg-4", children: unavailableBadge }),
13966
- reachable && launching && /* @__PURE__ */ jsx("span", { className: "rounded-sm bg-bg-3 px-1.5 py-0.5 text-[10px] font-medium tracking-wider uppercase text-fg-4", children: "Opening\u2026" })
14215
+ /* @__PURE__ */ jsx("span", { className: "text-fg text-[13px] font-medium", children: extra.name }),
14216
+ extra.tagline && /* @__PURE__ */ jsx("span", { className: "text-fg-3 text-[11px]", children: extra.tagline })
14217
+ ] })
13967
14218
  ]
13968
14219
  }
13969
14220
  );