@stackone/malachite 2.122.1 → 2.123.1

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/COMPONENTS.md CHANGED
@@ -53,7 +53,7 @@ The catalog of components exported from `@stackone/malachite`. **Reach for one o
53
53
  - **`LoadingBar`** — Indeterminate full-width loading line; the variant colour sweeps across a pale track for work of unknown duration. Toggle `active` rather than unmounting, so the reserved height prevents layout shift. _Key props:_ `active`, `LoadingBarVariant` (`default` | `warning` | `error`), `LoadingBarSize` (`small` | `medium` | `large`), `aria-label`, `aria-labelledby`, `className`, `style`.
54
54
  - **`LoadingScreen`** — The whole viewport while an app has nothing to show yet: the StackOne wordmark over a bar scanning back and forth, on the sunken page background, in either theme. It matches the screen unified-cloud paints before its bundle loads, so a page handing over to it, or from it, reads as one wait (an IdP page a sign-out passes through, say). Fixed to the viewport; render it as the page, not inside a card. Reduced motion stops the scan at full width. For loading inside a page use `LoadingBar` or `Skeleton`. _Key props:_ `aria-label` (default "Loading"), `aria-labelledby`, `className`.
55
55
  - **`ToastProvider`** — Transient top-centre toasts for the outcome of an action. Wrap the app once in `ToastProvider` and call `useToast().show({ message, variant })` anywhere beneath it. Corners match a medium button. Each toast auto-dismisses, pauses while hovered and dismisses on click; at most three show at once. Toasts are announced through always-mounted live regions (`status` for success, `alert` for error), and the pills themselves are hidden from assistive tech and never take focus, so they cannot fight a dialog's focus trap. The host mounts on the first toast and joins the top layer, so toasts paint above elevated side panels. _Key props:_ `ToastProvider`: `children`, `duration` (ms, default 3000). `useToast()` → `show({ message, variant })`, `ToastVariant` (`success` | `error`, default `success`).
56
- - **`Spinner`** — Loading spinner.
56
+ - **`Spinner`** — Loading spinner, decorative unless labelled: an `aria-label` or `aria-labelledby` makes it a busy `progressbar`, as `LoadingBar` and `LoadingScreen` are. `fillViewport` centres it in a viewport-sized box, for a page with nothing else on it that keeps its own background; for an app-level splash use `LoadingScreen`. _Key props:_ `size` (`xxxsmall` to `large`, default `medium`), `aria-label`, `aria-labelledby`, `fillViewport`, `className`, `style`.
57
57
  - **`Skeleton`** — Loading placeholders. Includes `Skeleton.Avatar` and `Skeleton.Input`. The shimmer stops under `prefers-reduced-motion`, leaving the plain placeholder.
58
58
  - **`Tooltip`** — Hover/focus tooltip; also works on disabled controls (see CLAUDE.md). It describes its trigger once shown, so `describesTrigger={false}` where the same sentence is already on screen and referenced — otherwise a screen reader reads it twice. _Key props:_ `text`, `placement`, `delay`, `maxWidth`, `shouldShow`, `triggerAs`, `describesTrigger`, `isShrinkable`, `fill`, `wrapChildren`, `suppressed` (holds the tooltip back, e.g. while the popup its trigger opens is up), `showOnFocus` (false where script can move focus onto the trigger, e.g. an option a panel focuses on open), `focusableTrigger` (makes a trigger that cannot take focus — text, a static `Tag` — a tab stop, so the tooltip is not mouse-only; not for focusable children).
59
59
  - **`TruncatedTooltip`** — Shows a tooltip only when its text is truncated.
@@ -1,38 +1,38 @@
1
- import { jsx as e } from "react/jsx-runtime";
2
- import { useRef as w, useCallback as F, useState as R, useEffect as u } from "react";
1
+ import { jsx as n } from "react/jsx-runtime";
2
+ import { useRef as F, useCallback as R, useState as g, useEffect as u } from "react";
3
3
  import { createPortal as I } from "react-dom";
4
4
  import { ensureDroppedFocusTracking as S } from "./components/droppedFocus.js";
5
- import { useFontInjection as g, FontInjectionProvider as j } from "./fontInjection.js";
5
+ import { useFontInjection as j, FontInjectionProvider as T } from "./fontInjection.js";
6
6
  import { ensureInterFontFace as v } from "./inter-font.js";
7
7
  import { adoptTailwindSheet as y } from "./tailwindSheet.js";
8
- import { ensureThemeInitialized as T, applyThemeVars as k, registerShadowRoot as b, unregisterShadowRoot as E } from "./theme.js";
8
+ import { ensureThemeInitialized as k, applyThemeVars as l, getCurrentThemeMode as b, registerShadowRoot as C, unregisterShadowRoot as E } from "./theme.js";
9
9
  const A = ({
10
- children: l,
11
- theme: n,
10
+ children: f,
11
+ theme: t,
12
12
  hostStyle: a,
13
13
  hostProps: c,
14
14
  hostRef: i,
15
- fillHeight: f = !1,
15
+ fillHeight: p = !1,
16
16
  injectFonts: h
17
17
  }) => {
18
- const p = g(), s = h ?? p, t = w(null), d = F(
18
+ const m = j(), s = h ?? m, e = F(null), d = R(
19
19
  (r) => {
20
- t.current = r, i && (i.current = r);
20
+ e.current = r, i && (i.current = r);
21
21
  },
22
22
  [i]
23
- ), [o, m] = R(null);
23
+ ), [o, w] = g(null);
24
24
  return u(() => {
25
- if (t.current && !o) {
26
- const r = t.current.shadowRoot ?? t.current.attachShadow({ mode: "open" });
27
- y(r), m(r);
25
+ if (e.current && !o) {
26
+ const r = e.current.shadowRoot ?? e.current.attachShadow({ mode: "open" });
27
+ y(r), k(), l(r, t ?? b()), w(r);
28
28
  }
29
- }, [o]), u(() => {
29
+ }, [o, t]), u(() => {
30
30
  if (o) {
31
- if (T(), S(), s && v(), n) {
32
- k(o, n);
31
+ if (S(), s && v(), t) {
32
+ l(o, t);
33
33
  return;
34
34
  }
35
- return b(o), () => {
35
+ return C(o), () => {
36
36
  try {
37
37
  E(o);
38
38
  } catch (r) {
@@ -40,7 +40,7 @@ const A = ({
40
40
  }
41
41
  };
42
42
  }
43
- }, [o, n, s]), o === null ? /* @__PURE__ */ e(
43
+ }, [o, t, s]), o === null ? /* @__PURE__ */ n(
44
44
  "div",
45
45
  {
46
46
  ...c,
@@ -48,12 +48,12 @@ const A = ({
48
48
  "data-testid": "shadow-root-wrapper",
49
49
  style: a
50
50
  }
51
- ) : /* @__PURE__ */ e("div", { ...c, ref: d, style: a, children: o && I(
52
- /* @__PURE__ */ e(j, { enabled: s, children: /* @__PURE__ */ e(
51
+ ) : /* @__PURE__ */ n("div", { ...c, ref: d, style: a, children: o && I(
52
+ /* @__PURE__ */ n(T, { enabled: s, children: /* @__PURE__ */ n(
53
53
  "div",
54
54
  {
55
- style: f ? { isolation: "isolate", height: "100%" } : { isolation: "isolate" },
56
- children: l
55
+ style: p ? { isolation: "isolate", height: "100%" } : { isolation: "isolate" },
56
+ children: f
57
57
  }
58
58
  ) }),
59
59
  o
@@ -1 +1 @@
1
- {"version":3,"file":"ShadowRootWrapper.js","sources":["../src/ShadowRootWrapper.tsx"],"sourcesContent":["import React, { useCallback, useEffect, useRef, useState } from 'react';\nimport { createPortal } from 'react-dom';\nimport { ensureDroppedFocusTracking } from './components/droppedFocus';\nimport { FontInjectionProvider, useFontInjection } from './fontInjection';\nimport { ensureInterFontFace } from './inter-font';\nimport { adoptTailwindSheet } from './tailwindSheet';\nimport {\n type ThemeMode,\n applyThemeVars,\n ensureThemeInitialized,\n registerShadowRoot,\n unregisterShadowRoot,\n} from './theme';\n\nexport const ShadowRootWrapper: React.FC<{\n children: React.ReactNode;\n theme?: ThemeMode;\n hostStyle?: React.CSSProperties;\n /** Identity for the shadow host, so host CSS matching unclassed `body` children cannot\n * blanket-hide a portaled one. Narrow on purpose: a wider type would let a caller\n * clobber `style`, `ref` or `data-testid` through the spread below. */\n hostProps?: { className?: string } & Record<`data-${string}`, string>;\n /** Reads back the shadow host, which a caller needs to promote it into the top layer. */\n hostRef?: { current: HTMLDivElement | null };\n /** Stretches the portal's inner wrapper div (inside the shadow root) to 100% height, to\n * match a `hostStyle` height a caller supplies on the host itself — without this, a tall\n * host div still collapses to content height one level in, because this wrapper div has\n * no height of its own. Off by default: sizing it for every consumer would change layout\n * for callers that rely on it hugging its content. */\n fillHeight?: boolean;\n /** Set `false` to skip Malachite's font injection (Inter, and Geist / Stack Sans for the\n * components that use them), for a consumer that loads the fonts itself. Inherited from an\n * enclosing wrapper when omitted, otherwise on. */\n injectFonts?: boolean;\n}> = ({\n children,\n theme,\n hostStyle,\n hostProps,\n hostRef: externalHostRef,\n fillHeight = false,\n injectFonts,\n}) => {\n const inheritedInjectFonts = useFontInjection();\n const shouldInjectFonts = injectFonts ?? inheritedInjectFonts;\n const hostRef = useRef<HTMLDivElement | null>(null);\n const takeHost = useCallback(\n (node: HTMLDivElement | null) => {\n hostRef.current = node;\n if (externalHostRef) {\n externalHostRef.current = node;\n }\n },\n [externalHostRef],\n );\n const [shadowRoot, setShadowRoot] = useState<ShadowRoot | null>(null);\n\n useEffect(() => {\n if (hostRef.current && !shadowRoot) {\n const shadow =\n hostRef.current.shadowRoot ?? hostRef.current.attachShadow({ mode: 'open' });\n // Adopt the stylesheet before setShadowRoot triggers the render that\n // portals children in: adopting in a later effect leaves a window where\n // the browser can paint the children unstyled (e.g. hover-hidden\n // controls flash fully visible on page load until `opacity: 0` lands).\n adoptTailwindSheet(shadow);\n setShadowRoot(shadow);\n }\n }, [shadowRoot]);\n\n useEffect(() => {\n if (!shadowRoot) {\n return;\n }\n // Both of these belong to the document, not the shadow root: @font-face does not\n // load fonts from inside a shadow root, and the theme's custom properties are set on\n // documentElement so light-DOM content and portals resolve them too.\n ensureThemeInitialized();\n ensureDroppedFocusTracking();\n if (shouldInjectFonts) {\n ensureInterFontFace();\n }\n if (theme) {\n applyThemeVars(shadowRoot, theme);\n return;\n }\n registerShadowRoot(shadowRoot);\n return () => {\n try {\n unregisterShadowRoot(shadowRoot);\n } catch (error) {\n // Silently handle cleanup errors during hot reloading\n console.warn('Error during shadow root cleanup:', error);\n }\n };\n }, [shadowRoot, theme, shouldInjectFonts]);\n\n if (shadowRoot === null) {\n // Initial render, attach shadow root first\n return (\n <div\n {...hostProps}\n ref={takeHost}\n data-testid=\"shadow-root-wrapper\"\n style={hostStyle}\n />\n );\n }\n\n // Container div inside the shadow root keeps React context working across the portal.\n return (\n <div {...hostProps} ref={takeHost} style={hostStyle}>\n {shadowRoot &&\n createPortal(\n <FontInjectionProvider enabled={shouldInjectFonts}>\n <div\n style={\n fillHeight\n ? { isolation: 'isolate', height: '100%' }\n : { isolation: 'isolate' }\n }\n >\n {children}\n </div>\n </FontInjectionProvider>,\n shadowRoot,\n )}\n </div>\n );\n};\n"],"names":["ShadowRootWrapper","children","theme","hostStyle","hostProps","externalHostRef","fillHeight","injectFonts","inheritedInjectFonts","useFontInjection","shouldInjectFonts","hostRef","useRef","takeHost","useCallback","node","shadowRoot","setShadowRoot","useState","useEffect","shadow","adoptTailwindSheet","ensureThemeInitialized","ensureDroppedFocusTracking","ensureInterFontFace","applyThemeVars","registerShadowRoot","unregisterShadowRoot","error","jsx","createPortal","FontInjectionProvider"],"mappings":";;;;;;;;AAcO,MAAMA,IAoBR,CAAC;AAAA,EACF,UAAAC;AAAA,EACA,OAAAC;AAAA,EACA,WAAAC;AAAA,EACA,WAAAC;AAAA,EACA,SAASC;AAAA,EACT,YAAAC,IAAa;AAAA,EACb,aAAAC;AACJ,MAAM;AACF,QAAMC,IAAuBC,EAAA,GACvBC,IAAoBH,KAAeC,GACnCG,IAAUC,EAA8B,IAAI,GAC5CC,IAAWC;AAAA,IACb,CAACC,MAAgC;AAC7B,MAAAJ,EAAQ,UAAUI,GACdV,MACAA,EAAgB,UAAUU;AAAA,IAElC;AAAA,IACA,CAACV,CAAe;AAAA,EAAA,GAEd,CAACW,GAAYC,CAAa,IAAIC,EAA4B,IAAI;AA0CpE,SAxCAC,EAAU,MAAM;AACZ,QAAIR,EAAQ,WAAW,CAACK,GAAY;AAChC,YAAMI,IACFT,EAAQ,QAAQ,cAAcA,EAAQ,QAAQ,aAAa,EAAE,MAAM,QAAQ;AAK/E,MAAAU,EAAmBD,CAAM,GACzBH,EAAcG,CAAM;AAAA,IACxB;AAAA,EACJ,GAAG,CAACJ,CAAU,CAAC,GAEfG,EAAU,MAAM;AACZ,QAAKH,GAWL;AAAA,UALAM,EAAA,GACAC,EAAA,GACIb,KACAc,EAAA,GAEAtB,GAAO;AACP,QAAAuB,EAAeT,GAAYd,CAAK;AAChC;AAAA,MACJ;AACA,aAAAwB,EAAmBV,CAAU,GACtB,MAAM;AACT,YAAI;AACA,UAAAW,EAAqBX,CAAU;AAAA,QACnC,SAASY,GAAO;AAEZ,kBAAQ,KAAK,qCAAqCA,CAAK;AAAA,QAC3D;AAAA,MACJ;AAAA;AAAA,EACJ,GAAG,CAACZ,GAAYd,GAAOQ,CAAiB,CAAC,GAErCM,MAAe,OAGX,gBAAAa;AAAA,IAAC;AAAA,IAAA;AAAA,MACI,GAAGzB;AAAA,MACJ,KAAKS;AAAA,MACL,eAAY;AAAA,MACZ,OAAOV;AAAA,IAAA;AAAA,EAAA,IAOf,gBAAA0B,EAAC,SAAK,GAAGzB,GAAW,KAAKS,GAAU,OAAOV,GACrC,UAAAa,KACGc;AAAA,IACI,gBAAAD,EAACE,GAAA,EAAsB,SAASrB,GAChC,UAAA,gBAAAmB;AAAA,MAAC;AAAA,MAAA;AAAA,QACG,OACIvB,IACM,EAAE,WAAW,WAAW,QAAQ,OAAA,IAChC,EAAE,WAAW,UAAA;AAAA,QAGtB,UAAAL;AAAA,MAAA;AAAA,IAAA,GAEL;AAAA,IACAe;AAAA,EAAA,GAEZ;AAER;"}
1
+ {"version":3,"file":"ShadowRootWrapper.js","sources":["../src/ShadowRootWrapper.tsx"],"sourcesContent":["import React, { useCallback, useEffect, useRef, useState } from 'react';\nimport { createPortal } from 'react-dom';\nimport { ensureDroppedFocusTracking } from './components/droppedFocus';\nimport { FontInjectionProvider, useFontInjection } from './fontInjection';\nimport { ensureInterFontFace } from './inter-font';\nimport { adoptTailwindSheet } from './tailwindSheet';\nimport {\n type ThemeMode,\n applyThemeVars,\n ensureThemeInitialized,\n getCurrentThemeMode,\n registerShadowRoot,\n unregisterShadowRoot,\n} from './theme';\n\nexport const ShadowRootWrapper: React.FC<{\n children: React.ReactNode;\n theme?: ThemeMode;\n hostStyle?: React.CSSProperties;\n /** Identity for the shadow host, so host CSS matching unclassed `body` children cannot\n * blanket-hide a portaled one. Narrow on purpose: a wider type would let a caller\n * clobber `style`, `ref` or `data-testid` through the spread below. */\n hostProps?: { className?: string } & Record<`data-${string}`, string>;\n /** Reads back the shadow host, which a caller needs to promote it into the top layer. */\n hostRef?: { current: HTMLDivElement | null };\n /** Stretches the portal's inner wrapper div (inside the shadow root) to 100% height, to\n * match a `hostStyle` height a caller supplies on the host itself — without this, a tall\n * host div still collapses to content height one level in, because this wrapper div has\n * no height of its own. Off by default: sizing it for every consumer would change layout\n * for callers that rely on it hugging its content. */\n fillHeight?: boolean;\n /** Set `false` to skip Malachite's font injection (Inter, and Geist / Stack Sans for the\n * components that use them), for a consumer that loads the fonts itself. Inherited from an\n * enclosing wrapper when omitted, otherwise on. */\n injectFonts?: boolean;\n}> = ({\n children,\n theme,\n hostStyle,\n hostProps,\n hostRef: externalHostRef,\n fillHeight = false,\n injectFonts,\n}) => {\n const inheritedInjectFonts = useFontInjection();\n const shouldInjectFonts = injectFonts ?? inheritedInjectFonts;\n const hostRef = useRef<HTMLDivElement | null>(null);\n const takeHost = useCallback(\n (node: HTMLDivElement | null) => {\n hostRef.current = node;\n if (externalHostRef) {\n externalHostRef.current = node;\n }\n },\n [externalHostRef],\n );\n const [shadowRoot, setShadowRoot] = useState<ShadowRoot | null>(null);\n\n useEffect(() => {\n if (hostRef.current && !shadowRoot) {\n const shadow =\n hostRef.current.shadowRoot ?? hostRef.current.attachShadow({ mode: 'open' });\n // Adopt the stylesheet and theme before setShadowRoot triggers the render that\n // portals children in: adopting in a later effect leaves a window where\n // the browser can paint the children unstyled (e.g. hover-hidden\n // controls flash fully visible on page load until `opacity: 0` lands).\n adoptTailwindSheet(shadow);\n ensureThemeInitialized();\n applyThemeVars(shadow, theme ?? getCurrentThemeMode());\n setShadowRoot(shadow);\n }\n }, [shadowRoot, theme]);\n\n useEffect(() => {\n if (!shadowRoot) {\n return;\n }\n ensureDroppedFocusTracking();\n // @font-face belongs to the document, not the shadow root: it does not load fonts\n // from inside a shadow root.\n if (shouldInjectFonts) {\n ensureInterFontFace();\n }\n if (theme) {\n applyThemeVars(shadowRoot, theme);\n return;\n }\n registerShadowRoot(shadowRoot);\n return () => {\n try {\n unregisterShadowRoot(shadowRoot);\n } catch (error) {\n // Silently handle cleanup errors during hot reloading\n console.warn('Error during shadow root cleanup:', error);\n }\n };\n }, [shadowRoot, theme, shouldInjectFonts]);\n\n if (shadowRoot === null) {\n // Initial render, attach shadow root first\n return (\n <div\n {...hostProps}\n ref={takeHost}\n data-testid=\"shadow-root-wrapper\"\n style={hostStyle}\n />\n );\n }\n\n // Container div inside the shadow root keeps React context working across the portal.\n return (\n <div {...hostProps} ref={takeHost} style={hostStyle}>\n {shadowRoot &&\n createPortal(\n <FontInjectionProvider enabled={shouldInjectFonts}>\n <div\n style={\n fillHeight\n ? { isolation: 'isolate', height: '100%' }\n : { isolation: 'isolate' }\n }\n >\n {children}\n </div>\n </FontInjectionProvider>,\n shadowRoot,\n )}\n </div>\n );\n};\n"],"names":["ShadowRootWrapper","children","theme","hostStyle","hostProps","externalHostRef","fillHeight","injectFonts","inheritedInjectFonts","useFontInjection","shouldInjectFonts","hostRef","useRef","takeHost","useCallback","node","shadowRoot","setShadowRoot","useState","useEffect","shadow","adoptTailwindSheet","ensureThemeInitialized","applyThemeVars","getCurrentThemeMode","ensureDroppedFocusTracking","ensureInterFontFace","registerShadowRoot","unregisterShadowRoot","error","jsx","createPortal","FontInjectionProvider"],"mappings":";;;;;;;;AAeO,MAAMA,IAoBR,CAAC;AAAA,EACF,UAAAC;AAAA,EACA,OAAAC;AAAA,EACA,WAAAC;AAAA,EACA,WAAAC;AAAA,EACA,SAASC;AAAA,EACT,YAAAC,IAAa;AAAA,EACb,aAAAC;AACJ,MAAM;AACF,QAAMC,IAAuBC,EAAA,GACvBC,IAAoBH,KAAeC,GACnCG,IAAUC,EAA8B,IAAI,GAC5CC,IAAWC;AAAA,IACb,CAACC,MAAgC;AAC7B,MAAAJ,EAAQ,UAAUI,GACdV,MACAA,EAAgB,UAAUU;AAAA,IAElC;AAAA,IACA,CAACV,CAAe;AAAA,EAAA,GAEd,CAACW,GAAYC,CAAa,IAAIC,EAA4B,IAAI;AA0CpE,SAxCAC,EAAU,MAAM;AACZ,QAAIR,EAAQ,WAAW,CAACK,GAAY;AAChC,YAAMI,IACFT,EAAQ,QAAQ,cAAcA,EAAQ,QAAQ,aAAa,EAAE,MAAM,QAAQ;AAK/E,MAAAU,EAAmBD,CAAM,GACzBE,EAAA,GACAC,EAAeH,GAAQlB,KAASsB,GAAqB,GACrDP,EAAcG,CAAM;AAAA,IACxB;AAAA,EACJ,GAAG,CAACJ,GAAYd,CAAK,CAAC,GAEtBiB,EAAU,MAAM;AACZ,QAAKH,GASL;AAAA,UANAS,EAAA,GAGIf,KACAgB,EAAA,GAEAxB,GAAO;AACP,QAAAqB,EAAeP,GAAYd,CAAK;AAChC;AAAA,MACJ;AACA,aAAAyB,EAAmBX,CAAU,GACtB,MAAM;AACT,YAAI;AACA,UAAAY,EAAqBZ,CAAU;AAAA,QACnC,SAASa,GAAO;AAEZ,kBAAQ,KAAK,qCAAqCA,CAAK;AAAA,QAC3D;AAAA,MACJ;AAAA;AAAA,EACJ,GAAG,CAACb,GAAYd,GAAOQ,CAAiB,CAAC,GAErCM,MAAe,OAGX,gBAAAc;AAAA,IAAC;AAAA,IAAA;AAAA,MACI,GAAG1B;AAAA,MACJ,KAAKS;AAAA,MACL,eAAY;AAAA,MACZ,OAAOV;AAAA,IAAA;AAAA,EAAA,IAOf,gBAAA2B,EAAC,SAAK,GAAG1B,GAAW,KAAKS,GAAU,OAAOV,GACrC,UAAAa,KACGe;AAAA,IACI,gBAAAD,EAACE,GAAA,EAAsB,SAAStB,GAChC,UAAA,gBAAAoB;AAAA,MAAC;AAAA,MAAA;AAAA,QACG,OACIxB,IACM,EAAE,WAAW,WAAW,QAAQ,OAAA,IAChC,EAAE,WAAW,UAAA;AAAA,QAGtB,UAAAL;AAAA,MAAA;AAAA,IAAA,GAEL;AAAA,IACAe;AAAA,EAAA,GAEZ;AAER;"}
@@ -6,7 +6,7 @@ import Jt from "./CustomIcons/CaretDownIcon.js";
6
6
  import ae from "./CustomIcons/CloseIcon.js";
7
7
  import { FieldMessage as we } from "./FieldMessage.js";
8
8
  import It from "./LoadingInput.js";
9
- import Se from "./Spinner.js";
9
+ import { Spinner as Se } from "./Spinner.js";
10
10
  import { Tag as Te } from "./Tag.js";
11
11
  import Pt from "./Tooltip.js";
12
12
  import Ee from "./Typography/MarkdownBlock.js";
@@ -8,7 +8,7 @@ import St from "./CustomIcons/FilterIcon.js";
8
8
  import Ze from "./CustomIcons/SearchIcon.js";
9
9
  import { FilterSearchPanel as Nt } from "./FilterSearchPanel.js";
10
10
  import { Popover as Et } from "./Popover.js";
11
- import Pe from "./Spinner.js";
11
+ import { Spinner as Pe } from "./Spinner.js";
12
12
  import { CONTROL_TEXT_SIZE_CLASS as ce, CONTROL_TEXT_SIZE as $t } from "./controlTextSize.js";
13
13
  import { controlWidthStyle as Rt } from "./controlWidth.js";
14
14
  import { getTriggerVisual as Ct, DROPDOWN_TRIGGER_ATTR as It } from "./dropdownTriggerStyle.js";
@@ -8,7 +8,7 @@ import Lt from "./CustomIcons/SearchIcon.js";
8
8
  import { FieldMessage as Ot } from "./FieldMessage.js";
9
9
  import { FormItem as Nt } from "./FormItem.js";
10
10
  import Ge from "./LoadingInput.js";
11
- import At from "./Spinner.js";
11
+ import { Spinner as At } from "./Spinner.js";
12
12
  import { Tag as Mt } from "./Tag.js";
13
13
  import ze from "./Tooltip.js";
14
14
  import { getDeepActiveNode as Ke } from "./activeElement.js";
@@ -1,7 +1,7 @@
1
1
  import { jsxs as E, jsx as d } from "react/jsx-runtime";
2
2
  import { useId as wt, useState as T, useRef as b, useCallback as H, useLayoutEffect as k, useEffect as yt, useInsertionEffect as vt } from "react";
3
3
  import { createPortal as St } from "react-dom";
4
- import Et from "./Spinner.js";
4
+ import { Spinner as Et } from "./Spinner.js";
5
5
  import { CONTROL_TEXT_SIZE as W, CONTROL_TEXT_SIZE_CLASS as rt } from "./controlTextSize.js";
6
6
  import { pushEscapeLayer as Tt } from "./escapeLayers.js";
7
7
  import { ensureMultiSelectPanelStyles as kt } from "./optionRowStyles.js";
@@ -1,5 +1,5 @@
1
- import { jsx as r, jsxs as c } from "react/jsx-runtime";
2
- const l = (e) => {
1
+ import { jsx as r, jsxs as x } from "react/jsx-runtime";
2
+ const h = (e) => {
3
3
  switch (e) {
4
4
  case "xxxsmall":
5
5
  return "w-3.5 h-3.5";
@@ -22,7 +22,7 @@ const l = (e) => {
22
22
  default:
23
23
  return "w-48 h-48";
24
24
  }
25
- }, i = (e) => {
25
+ }, d = (e) => {
26
26
  switch (e) {
27
27
  case "xxxsmall":
28
28
  return "min-h-[14px]";
@@ -39,17 +39,28 @@ const l = (e) => {
39
39
  default:
40
40
  return "min-h-[200px]";
41
41
  }
42
- }, o = ({ size: e = "medium", className: s = "", style: t = {} }) => {
43
- const a = l(e), n = i(e);
42
+ }, w = ({
43
+ size: e = "medium",
44
+ "aria-label": s,
45
+ "aria-labelledby": t,
46
+ fillViewport: n = !1,
47
+ className: o = "",
48
+ style: l = {}
49
+ }) => {
50
+ const m = h(e), u = n ? "" : d(e), a = (s == null ? void 0 : s.trim()) || void 0, c = (t == null ? void 0 : t.trim()) || void 0, i = !!(a || c);
44
51
  return /* @__PURE__ */ r(
45
52
  "div",
46
53
  {
47
- className: `flex items-center justify-center ${n} ${s}`,
48
- style: t,
49
- children: /* @__PURE__ */ c(
54
+ className: `flex items-center justify-center ${u} ${o}`,
55
+ style: n ? { minHeight: "100dvh", width: "100%", ...l } : l,
56
+ role: i ? "progressbar" : void 0,
57
+ "aria-busy": i || void 0,
58
+ "aria-label": a,
59
+ "aria-labelledby": c,
60
+ children: /* @__PURE__ */ x(
50
61
  "svg",
51
62
  {
52
- className: `animate-spin motion-reduce:animate-none ${a}`,
63
+ className: `animate-spin motion-reduce:animate-none ${m}`,
53
64
  xmlns: "http://www.w3.org/2000/svg",
54
65
  fill: "none",
55
66
  viewBox: "0 0 24 24",
@@ -81,6 +92,7 @@ const l = (e) => {
81
92
  );
82
93
  };
83
94
  export {
84
- o as default
95
+ w as Spinner,
96
+ w as default
85
97
  };
86
98
  //# sourceMappingURL=Spinner.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Spinner.js","sources":["../../src/components/Spinner.tsx"],"sourcesContent":["import React from 'react';\n\ninterface SpinnerProps {\n size?: 'xxxsmall' | 'xxsmall' | 'xsmall' | 'small' | 'medium' | 'large';\n className?: string;\n style?: React.CSSProperties;\n}\n\nconst getSizeClasses = (size: SpinnerProps['size']) => {\n switch (size) {\n case 'xxxsmall':\n return 'w-3.5 h-3.5'; // 14px\n case 'xxsmall':\n return 'w-6 h-6'; // 24px (close to 25px)\n case 'xsmall':\n return 'w-12 h-12'; // 48px (close to 50px)\n case 'small':\n return 'w-24 h-24'; // 96px (close to 100px)\n case 'medium':\n return 'w-48 h-48'; // 192px (close to 200px)\n case 'large':\n return 'w-96 h-96'; // 384px (close to 400px)\n default:\n return 'w-48 h-48'; // 192px default\n }\n};\n\nconst getContainerSize = (size: SpinnerProps['size']) => {\n switch (size) {\n case 'xxxsmall':\n return 'min-h-[14px]';\n case 'xxsmall':\n return 'min-h-[25px]';\n case 'xsmall':\n return 'min-h-[50px]';\n case 'small':\n return 'min-h-[100px]';\n case 'medium':\n return 'min-h-[200px]';\n case 'large':\n return 'min-h-[400px]';\n default:\n return 'min-h-[200px]';\n }\n};\n\nconst Spinner: React.FC<SpinnerProps> = ({ size = 'medium', className = '', style = {} }) => {\n const sizeClasses = getSizeClasses(size);\n const containerSizeClasses = getContainerSize(size);\n\n return (\n <div\n className={`flex items-center justify-center ${containerSizeClasses} ${className}`}\n style={style}\n >\n {/* Looping motion can cause nausea and dizziness for users with vestibular\n disorders, and a spinner loops with nothing to look away from. Under reduced\n motion the arc gives way to the full ring: still plainly busy, and a complete\n circle rather than an arc frozen mid-turn, which would read as a stalled\n animation. Same trade as LoadingBar's solid full-width line. */}\n <svg\n className={`animate-spin motion-reduce:animate-none ${sizeClasses}`}\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n style={{ color: 'var(--malachite-text-dimmed)' }}\n >\n <circle\n className=\"opacity-25 motion-reduce:opacity-100\"\n cx=\"12\"\n cy=\"12\"\n r=\"10\"\n stroke=\"currentColor\"\n strokeWidth=\"4\"\n />\n <path\n className=\"opacity-75 motion-reduce:opacity-0\"\n fill=\"currentColor\"\n d=\"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z\"\n />\n </svg>\n </div>\n );\n};\n\nexport default Spinner;\n"],"names":["getSizeClasses","size","getContainerSize","Spinner","className","style","sizeClasses","containerSizeClasses","jsx","jsxs"],"mappings":";AAQA,MAAMA,IAAiB,CAACC,MAA+B;AACnD,UAAQA,GAAA;AAAA,IACJ,KAAK;AACD,aAAO;AAAA;AAAA,IACX,KAAK;AACD,aAAO;AAAA;AAAA,IACX,KAAK;AACD,aAAO;AAAA;AAAA,IACX,KAAK;AACD,aAAO;AAAA;AAAA,IACX,KAAK;AACD,aAAO;AAAA;AAAA,IACX,KAAK;AACD,aAAO;AAAA;AAAA,IACX;AACI,aAAO;AAAA,EAAA;AAEnB,GAEMC,IAAmB,CAACD,MAA+B;AACrD,UAAQA,GAAA;AAAA,IACJ,KAAK;AACD,aAAO;AAAA,IACX,KAAK;AACD,aAAO;AAAA,IACX,KAAK;AACD,aAAO;AAAA,IACX,KAAK;AACD,aAAO;AAAA,IACX,KAAK;AACD,aAAO;AAAA,IACX,KAAK;AACD,aAAO;AAAA,IACX;AACI,aAAO;AAAA,EAAA;AAEnB,GAEME,IAAkC,CAAC,EAAE,MAAAF,IAAO,UAAU,WAAAG,IAAY,IAAI,OAAAC,IAAQ,CAAA,QAAS;AACzF,QAAMC,IAAcN,EAAeC,CAAI,GACjCM,IAAuBL,EAAiBD,CAAI;AAElD,SACI,gBAAAO;AAAA,IAAC;AAAA,IAAA;AAAA,MACG,WAAW,oCAAoCD,CAAoB,IAAIH,CAAS;AAAA,MAChF,OAAAC;AAAA,MAOA,UAAA,gBAAAI;AAAA,QAAC;AAAA,QAAA;AAAA,UACG,WAAW,2CAA2CH,CAAW;AAAA,UACjE,OAAM;AAAA,UACN,MAAK;AAAA,UACL,SAAQ;AAAA,UACR,OAAO,EAAE,OAAO,+BAAA;AAAA,UAEhB,UAAA;AAAA,YAAA,gBAAAE;AAAA,cAAC;AAAA,cAAA;AAAA,gBACG,WAAU;AAAA,gBACV,IAAG;AAAA,gBACH,IAAG;AAAA,gBACH,GAAE;AAAA,gBACF,QAAO;AAAA,gBACP,aAAY;AAAA,cAAA;AAAA,YAAA;AAAA,YAEhB,gBAAAA;AAAA,cAAC;AAAA,cAAA;AAAA,gBACG,WAAU;AAAA,gBACV,MAAK;AAAA,gBACL,GAAE;AAAA,cAAA;AAAA,YAAA;AAAA,UACN;AAAA,QAAA;AAAA,MAAA;AAAA,IACJ;AAAA,EAAA;AAGZ;"}
1
+ {"version":3,"file":"Spinner.js","sources":["../../src/components/Spinner.tsx"],"sourcesContent":["import React from 'react';\n\nexport interface SpinnerProps {\n size?: 'xxxsmall' | 'xxsmall' | 'xsmall' | 'small' | 'medium' | 'large';\n /** Names the wait: the spinner becomes a busy progressbar, as LoadingBar is. Without this or `aria-labelledby`, it stays decorative. */\n 'aria-label'?: string;\n /** Names the wait from visible text; assistive tech prefers it over `aria-label`. */\n 'aria-labelledby'?: string;\n /** Fills the viewport's height, so a page that is only waiting shows the spinner in its middle. */\n fillViewport?: boolean;\n className?: string;\n style?: React.CSSProperties;\n}\n\nconst getSizeClasses = (size: SpinnerProps['size']) => {\n switch (size) {\n case 'xxxsmall':\n return 'w-3.5 h-3.5'; // 14px\n case 'xxsmall':\n return 'w-6 h-6'; // 24px (close to 25px)\n case 'xsmall':\n return 'w-12 h-12'; // 48px (close to 50px)\n case 'small':\n return 'w-24 h-24'; // 96px (close to 100px)\n case 'medium':\n return 'w-48 h-48'; // 192px (close to 200px)\n case 'large':\n return 'w-96 h-96'; // 384px (close to 400px)\n default:\n return 'w-48 h-48'; // 192px default\n }\n};\n\nconst getContainerSize = (size: SpinnerProps['size']) => {\n switch (size) {\n case 'xxxsmall':\n return 'min-h-[14px]';\n case 'xxsmall':\n return 'min-h-[25px]';\n case 'xsmall':\n return 'min-h-[50px]';\n case 'small':\n return 'min-h-[100px]';\n case 'medium':\n return 'min-h-[200px]';\n case 'large':\n return 'min-h-[400px]';\n default:\n return 'min-h-[200px]';\n }\n};\n\nconst Spinner: React.FC<SpinnerProps> = ({\n size = 'medium',\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n fillViewport = false,\n className = '',\n style = {},\n}) => {\n const sizeClasses = getSizeClasses(size);\n const containerSizeClasses = fillViewport ? '' : getContainerSize(size);\n const label = ariaLabel?.trim() || undefined;\n const labelledBy = ariaLabelledBy?.trim() || undefined;\n const labelled = Boolean(label || labelledBy);\n\n return (\n <div\n className={`flex items-center justify-center ${containerSizeClasses} ${className}`}\n style={fillViewport ? { minHeight: '100dvh', width: '100%', ...style } : style}\n role={labelled ? 'progressbar' : undefined}\n aria-busy={labelled || undefined}\n aria-label={label}\n aria-labelledby={labelledBy}\n >\n {/* Looping motion can cause nausea and dizziness for users with vestibular\n disorders, and a spinner loops with nothing to look away from. Under reduced\n motion the arc gives way to the full ring: still plainly busy, and a complete\n circle rather than an arc frozen mid-turn, which would read as a stalled\n animation. Same trade as LoadingBar's solid full-width line. */}\n <svg\n className={`animate-spin motion-reduce:animate-none ${sizeClasses}`}\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n style={{ color: 'var(--malachite-text-dimmed)' }}\n >\n <circle\n className=\"opacity-25 motion-reduce:opacity-100\"\n cx=\"12\"\n cy=\"12\"\n r=\"10\"\n stroke=\"currentColor\"\n strokeWidth=\"4\"\n />\n <path\n className=\"opacity-75 motion-reduce:opacity-0\"\n fill=\"currentColor\"\n d=\"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z\"\n />\n </svg>\n </div>\n );\n};\n\nexport default Spinner;\nexport { Spinner };\n"],"names":["getSizeClasses","size","getContainerSize","Spinner","ariaLabel","ariaLabelledBy","fillViewport","className","style","sizeClasses","containerSizeClasses","label","labelledBy","labelled","jsx","jsxs"],"mappings":";AAcA,MAAMA,IAAiB,CAACC,MAA+B;AACnD,UAAQA,GAAA;AAAA,IACJ,KAAK;AACD,aAAO;AAAA;AAAA,IACX,KAAK;AACD,aAAO;AAAA;AAAA,IACX,KAAK;AACD,aAAO;AAAA;AAAA,IACX,KAAK;AACD,aAAO;AAAA;AAAA,IACX,KAAK;AACD,aAAO;AAAA;AAAA,IACX,KAAK;AACD,aAAO;AAAA;AAAA,IACX;AACI,aAAO;AAAA,EAAA;AAEnB,GAEMC,IAAmB,CAACD,MAA+B;AACrD,UAAQA,GAAA;AAAA,IACJ,KAAK;AACD,aAAO;AAAA,IACX,KAAK;AACD,aAAO;AAAA,IACX,KAAK;AACD,aAAO;AAAA,IACX,KAAK;AACD,aAAO;AAAA,IACX,KAAK;AACD,aAAO;AAAA,IACX,KAAK;AACD,aAAO;AAAA,IACX;AACI,aAAO;AAAA,EAAA;AAEnB,GAEME,IAAkC,CAAC;AAAA,EACrC,MAAAF,IAAO;AAAA,EACP,cAAcG;AAAA,EACd,mBAAmBC;AAAA,EACnB,cAAAC,IAAe;AAAA,EACf,WAAAC,IAAY;AAAA,EACZ,OAAAC,IAAQ,CAAA;AACZ,MAAM;AACF,QAAMC,IAAcT,EAAeC,CAAI,GACjCS,IAAuBJ,IAAe,KAAKJ,EAAiBD,CAAI,GAChEU,KAAQP,KAAA,gBAAAA,EAAW,WAAU,QAC7BQ,KAAaP,KAAA,gBAAAA,EAAgB,WAAU,QACvCQ,IAAW,GAAQF,KAASC;AAElC,SACI,gBAAAE;AAAA,IAAC;AAAA,IAAA;AAAA,MACG,WAAW,oCAAoCJ,CAAoB,IAAIH,CAAS;AAAA,MAChF,OAAOD,IAAe,EAAE,WAAW,UAAU,OAAO,QAAQ,GAAGE,EAAA,IAAUA;AAAA,MACzE,MAAMK,IAAW,gBAAgB;AAAA,MACjC,aAAWA,KAAY;AAAA,MACvB,cAAYF;AAAA,MACZ,mBAAiBC;AAAA,MAOjB,UAAA,gBAAAG;AAAA,QAAC;AAAA,QAAA;AAAA,UACG,WAAW,2CAA2CN,CAAW;AAAA,UACjE,OAAM;AAAA,UACN,MAAK;AAAA,UACL,SAAQ;AAAA,UACR,OAAO,EAAE,OAAO,+BAAA;AAAA,UAEhB,UAAA;AAAA,YAAA,gBAAAK;AAAA,cAAC;AAAA,cAAA;AAAA,gBACG,WAAU;AAAA,gBACV,IAAG;AAAA,gBACH,IAAG;AAAA,gBACH,GAAE;AAAA,gBACF,QAAO;AAAA,gBACP,aAAY;AAAA,cAAA;AAAA,YAAA;AAAA,YAEhB,gBAAAA;AAAA,cAAC;AAAA,cAAA;AAAA,gBACG,WAAU;AAAA,gBACV,MAAK;AAAA,gBACL,GAAE;AAAA,cAAA;AAAA,YAAA;AAAA,UACN;AAAA,QAAA;AAAA,MAAA;AAAA,IACJ;AAAA,EAAA;AAGZ;"}
@@ -3,7 +3,7 @@ import u from "./CustomIcons/CheckCircleFilled.js";
3
3
  import x from "./CustomIcons/ErrorCircleFilled.js";
4
4
  import g from "./CustomIcons/InfoCircleFilled.js";
5
5
  import f from "./CustomIcons/WarningCircleFilled.js";
6
- import h from "./Spinner.js";
6
+ import { Spinner as h } from "./Spinner.js";
7
7
  const b = {
8
8
  success: "bg-[var(--malachite-alert-success-background)] text-[var(--malachite-alert-success-foreground)] supports-[color:color-mix(in_srgb,red,red)]:text-[color-mix(in_srgb,var(--malachite-alert-success-foreground)_70%,var(--malachite-text-primary))]",
9
9
  neutral: "bg-[var(--malachite-alert-info-background)] text-[var(--malachite-alert-info-foreground)]",
@@ -1,6 +1,6 @@
1
1
  import { jsx as i, jsxs as C } from "react/jsx-runtime";
2
2
  import { useState as N, useRef as Dt, useId as kt, useLayoutEffect as Ct, useMemo as rt } from "react";
3
- import Nt from "../Spinner.js";
3
+ import { Spinner as Nt } from "../Spinner.js";
4
4
  import { FOCUS_RING as Pt } from "../focusRing.js";
5
5
  import Et from "./TimeBarChartAxes.js";
6
6
  import St from "./TimeBarChartBars.js";
package/dist/index.d.ts CHANGED
@@ -5759,8 +5759,14 @@ export declare const SparkleIcon: React.FC<IconProps_110>;
5759
5759
 
5760
5760
  export declare const Spinner: default_2.FC<SpinnerProps>;
5761
5761
 
5762
- declare interface SpinnerProps {
5762
+ export declare interface SpinnerProps {
5763
5763
  size?: 'xxxsmall' | 'xxsmall' | 'xsmall' | 'small' | 'medium' | 'large';
5764
+ /** Names the wait: the spinner becomes a busy progressbar, as LoadingBar is. Without this or `aria-labelledby`, it stays decorative. */
5765
+ 'aria-label'?: string;
5766
+ /** Names the wait from visible text; assistive tech prefers it over `aria-label`. */
5767
+ 'aria-labelledby'?: string;
5768
+ /** Fills the viewport's height, so a page that is only waiting shows the spinner in its middle. */
5769
+ fillViewport?: boolean;
5764
5770
  className?: string;
5765
5771
  style?: default_2.CSSProperties;
5766
5772
  }
package/dist/index.js CHANGED
@@ -72,7 +72,7 @@ import { StepList as Je } from "./components/StepList.js";
72
72
  import { ChoiceGroup as Ye } from "./components/ChoiceGroup.js";
73
73
  import { LinkCard as qe } from "./components/LinkCard.js";
74
74
  import { ResourceCard as $e } from "./components/ResourceCard.js";
75
- import { default as er } from "./components/Spinner.js";
75
+ import { Spinner as er } from "./components/Spinner.js";
76
76
  import { NumberTag as tr } from "./components/NumberTag.js";
77
77
  import { Tag as fr } from "./components/Tag.js";
78
78
  import { default as mr } from "./components/Tabs.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stackone/malachite",
3
- "version": "2.122.1",
3
+ "version": "2.123.1",
4
4
  "description": "StackOne's themeable React component library — Shadow DOM isolated, scoped Tailwind, theme-token driven.",
5
5
  "license": "MIT",
6
6
  "author": "StackOne",