@galaxy-io/dls 1.4.10 → 1.4.11

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.
Files changed (177) hide show
  1. package/dist/accordion/Accordion.d.ts +19 -2
  2. package/dist/accordion/Accordion.js +8 -0
  3. package/dist/avatar/Avatar.d.ts +9 -0
  4. package/dist/avatar/Avatar.js +4 -0
  5. package/dist/avatar/AvatarShimmer.d.ts +2 -0
  6. package/dist/avatar/AvatarShimmer.js +1 -0
  7. package/dist/backgrounds/CellGridBackground.d.ts +12 -1
  8. package/dist/backgrounds/CellGridBackground.js +5 -0
  9. package/dist/backgrounds/CrossGridBackground.d.ts +13 -1
  10. package/dist/backgrounds/CrossGridBackground.js +4 -0
  11. package/dist/backgrounds/DotGridBackground.d.ts +12 -1
  12. package/dist/backgrounds/DotGridBackground.js +4 -0
  13. package/dist/badge/Badge.d.ts +12 -0
  14. package/dist/badge/Badge.js +7 -0
  15. package/dist/beacons/Beacon.d.ts +7 -13
  16. package/dist/beacons/Beacon.js +3 -0
  17. package/dist/buttons/Button.d.ts +18 -0
  18. package/dist/buttons/Button.js +10 -1
  19. package/dist/charts/BarChart.js +3 -1
  20. package/dist/charts/ChartFrame.js +5 -7
  21. package/dist/charts/ChartLegend.js +1 -5
  22. package/dist/charts/ChartPrimitives.d.ts +1 -14
  23. package/dist/charts/ChartPrimitives.js +50 -69
  24. package/dist/charts/DashboardProvider.d.ts +47 -0
  25. package/dist/charts/DashboardProvider.js +52 -0
  26. package/dist/charts/LineChart.js +1 -0
  27. package/dist/charts/ProgressBar.d.ts +13 -1
  28. package/dist/charts/ProgressBar.js +7 -0
  29. package/dist/charts/StatChart.d.ts +10 -1
  30. package/dist/charts/StatChart.js +5 -0
  31. package/dist/charts/constants.d.ts +4 -18
  32. package/dist/charts/constants.js +5 -19
  33. package/dist/charts/useChartInteraction.d.ts +25 -8
  34. package/dist/charts/useChartInteraction.js +61 -6
  35. package/dist/chips/Chip.d.ts +20 -1
  36. package/dist/chips/Chip.js +9 -1
  37. package/dist/containers/FlexItem.d.ts +14 -12
  38. package/dist/containers/FlexItem.js +4 -0
  39. package/dist/containers/FlexWrapper.d.ts +29 -96
  40. package/dist/containers/FlexWrapper.js +12 -0
  41. package/dist/containers/GridWrapper.d.ts +25 -66
  42. package/dist/containers/GridWrapper.js +8 -0
  43. package/dist/containers/Spacing.d.ts +10 -0
  44. package/dist/containers/Spacing.js +7 -0
  45. package/dist/containers/Wrapper.d.ts +11 -1
  46. package/dist/containers/Wrapper.js +4 -0
  47. package/dist/dividers/HorizontalDivider.d.ts +2 -0
  48. package/dist/dividers/HorizontalDivider.js +1 -0
  49. package/dist/dividers/VerticalDivider.d.ts +4 -0
  50. package/dist/dividers/VerticalDivider.js +4 -0
  51. package/dist/drawer/Drawer.d.ts +11 -4
  52. package/dist/drawer/Drawer.js +7 -0
  53. package/dist/dropdown/Dropdown.d.ts +24 -0
  54. package/dist/dropdown/Dropdown.js +9 -0
  55. package/dist/editor/CodeEditor.d.ts +23 -42
  56. package/dist/editor/CodeEditor.js +9 -1
  57. package/dist/hooks/useDismiss.d.ts +6 -0
  58. package/dist/hooks/useDismiss.js +6 -0
  59. package/dist/hooks/useElementClientSize.d.ts +2 -2
  60. package/dist/hooks/useResize.d.ts +5 -2
  61. package/dist/icons/GalaxyLogomark.d.ts +9 -1
  62. package/dist/icons/GalaxyLogomark.js +7 -1
  63. package/dist/icons/GalaxyLogomark3D.d.ts +15 -0
  64. package/dist/icons/GalaxyLogomark3D.js +9 -0
  65. package/dist/icons/GalaxyLogomarkAnimation.d.ts +10 -0
  66. package/dist/icons/GalaxyLogomarkAnimation.js +7 -1
  67. package/dist/icons/GalaxyWordmark.d.ts +7 -1
  68. package/dist/icons/GalaxyWordmark.js +5 -1
  69. package/dist/icons/Icon.d.ts +10 -0
  70. package/dist/icons/Icon.js +5 -0
  71. package/dist/inputs/CheckboxInput.d.ts +13 -0
  72. package/dist/inputs/CheckboxInput.js +8 -0
  73. package/dist/inputs/ColorInput.d.ts +15 -0
  74. package/dist/inputs/ColorInput.js +6 -0
  75. package/dist/inputs/CopyInput.d.ts +9 -0
  76. package/dist/inputs/CopyInput.js +4 -0
  77. package/dist/inputs/DateInput.d.ts +13 -0
  78. package/dist/inputs/DateInput.js +5 -0
  79. package/dist/inputs/Input.d.ts +37 -0
  80. package/dist/inputs/Input.js +13 -0
  81. package/dist/inputs/MultiSelectInput.d.ts +26 -0
  82. package/dist/inputs/MultiSelectInput.js +6 -0
  83. package/dist/inputs/MultiTextInput.d.ts +16 -0
  84. package/dist/inputs/MultiTextInput.js +9 -0
  85. package/dist/inputs/NumberInput.d.ts +7 -1
  86. package/dist/inputs/NumberInput.js +5 -0
  87. package/dist/inputs/PasswordInput.d.ts +9 -1
  88. package/dist/inputs/PasswordInput.js +4 -0
  89. package/dist/inputs/RadioInput.d.ts +13 -0
  90. package/dist/inputs/RadioInput.js +8 -0
  91. package/dist/inputs/SelectInput.d.ts +30 -0
  92. package/dist/inputs/SelectInput.js +8 -0
  93. package/dist/inputs/SliderInput.d.ts +15 -0
  94. package/dist/inputs/SliderInput.js +6 -0
  95. package/dist/inputs/SwitcherInput.d.ts +10 -1
  96. package/dist/inputs/SwitcherInput.js +4 -0
  97. package/dist/inputs/TextAreaInput.d.ts +24 -0
  98. package/dist/inputs/TextAreaInput.js +9 -0
  99. package/dist/inputs/TextInput.d.ts +8 -1
  100. package/dist/inputs/TextInput.js +6 -0
  101. package/dist/inputs/ToggleInput.d.ts +11 -0
  102. package/dist/inputs/ToggleInput.js +6 -0
  103. package/dist/lists/BulletedList.d.ts +4 -0
  104. package/dist/lists/BulletedList.js +2 -0
  105. package/dist/modal/Modal.d.ts +8 -0
  106. package/dist/modal/Modal.js +6 -0
  107. package/dist/overlay/OverlayProvider.d.ts +11 -0
  108. package/dist/overlay/OverlayProvider.js +7 -0
  109. package/dist/overlay/constants.d.ts +1 -0
  110. package/dist/overlay/constants.js +1 -0
  111. package/dist/overlay/useOverlay.d.ts +11 -0
  112. package/dist/overlay/useOverlay.js +9 -0
  113. package/dist/resizable/HorizontalResizeHandle.d.ts +8 -1
  114. package/dist/resizable/HorizontalResizeHandle.js +6 -0
  115. package/dist/resizable/VerticalResizeHandle.d.ts +8 -1
  116. package/dist/resizable/VerticalResizeHandle.js +6 -0
  117. package/dist/shapes/Circle.d.ts +4 -1
  118. package/dist/shapes/Circle.js +1 -0
  119. package/dist/shapes/Square.d.ts +4 -1
  120. package/dist/shapes/Square.js +1 -0
  121. package/dist/styles.css +20 -21
  122. package/dist/table/InfiniteSpreadsheet.d.ts +7 -0
  123. package/dist/table/InfiniteSpreadsheet.js +7 -0
  124. package/dist/table/InfiniteTable.d.ts +8 -0
  125. package/dist/table/InfiniteTable.js +8 -0
  126. package/dist/table/VirtualizedInfiniteTable.d.ts +7 -0
  127. package/dist/table/VirtualizedInfiniteTable.js +7 -0
  128. package/dist/text/Bold.d.ts +4 -0
  129. package/dist/text/Bold.js +4 -0
  130. package/dist/text/Code.d.ts +4 -0
  131. package/dist/text/Code.js +4 -0
  132. package/dist/text/EditableText.d.ts +10 -1
  133. package/dist/text/EditableText.js +7 -0
  134. package/dist/text/Ellipsis.d.ts +6 -4
  135. package/dist/text/Ellipsis.js +4 -0
  136. package/dist/text/HotKeys.d.ts +10 -0
  137. package/dist/text/HotKeys.js +6 -0
  138. package/dist/text/MarkdownText.d.ts +9 -1
  139. package/dist/text/MarkdownText.js +6 -0
  140. package/dist/text/Paragraph.d.ts +17 -0
  141. package/dist/text/Paragraph.js +7 -0
  142. package/dist/text/RequiredMarker.d.ts +3 -1
  143. package/dist/text/RequiredMarker.js +1 -0
  144. package/dist/text/Selectable.d.ts +4 -0
  145. package/dist/text/Selectable.js +4 -0
  146. package/dist/text/Text.d.ts +19 -0
  147. package/dist/text/Text.js +10 -0
  148. package/dist/text/TextShimmer.d.ts +7 -0
  149. package/dist/text/TextShimmer.js +4 -0
  150. package/dist/theme/GalaxyTheme.d.ts +35 -4
  151. package/dist/theme/GalaxyTheme.js +13 -1
  152. package/dist/theme/constants.d.ts +1 -6
  153. package/dist/theme/constants.js +10 -15
  154. package/dist/theme/index.js +2 -1
  155. package/dist/theme/types.d.ts +21 -0
  156. package/dist/theme/types.js +10 -0
  157. package/dist/toast/Toast.d.ts +11 -0
  158. package/dist/toast/Toast.js +5 -0
  159. package/dist/toast/ToastProvider.d.ts +9 -0
  160. package/dist/toast/ToastProvider.js +4 -0
  161. package/dist/toast/useToast.d.ts +7 -0
  162. package/dist/toast/useToast.js +7 -0
  163. package/dist/tooltip/Tooltip.d.ts +19 -1
  164. package/dist/tooltip/Tooltip.js +9 -0
  165. package/dist/transform/Fade.d.ts +7 -0
  166. package/dist/transform/Fade.js +6 -0
  167. package/dist/transform/Flash.d.ts +4 -0
  168. package/dist/transform/Flash.js +4 -0
  169. package/dist/transform/Rotate.d.ts +7 -0
  170. package/dist/transform/Rotate.js +4 -0
  171. package/dist/transform/ScaleFade.d.ts +7 -0
  172. package/dist/transform/ScaleFade.js +6 -0
  173. package/dist/transform/Spin.d.ts +7 -0
  174. package/dist/transform/Spin.js +5 -0
  175. package/dist/widget/Widget.d.ts +18 -1
  176. package/dist/widget/Widget.js +5 -0
  177. package/package.json +1 -1
@@ -1,6 +1,5 @@
1
1
  import { type PropsWithChildren } from "react";
2
- import { GalaxyTheme } from "./constants";
3
- import type { Theme } from "./types";
2
+ import { GalaxyTheme, type Theme } from "./types";
4
3
  declare const ThemeProvider: import("react").ComponentType<{
5
4
  children: React.ReactNode;
6
5
  theme?: Theme | undefined;
@@ -9,28 +8,60 @@ declare const ThemeProvider: import("react").ComponentType<{
9
8
  }, C>(WrappedComponent: import("react").ComponentType<Props> & C) => import("react").ComponentType<import("@callstack/react-theme-provider").$Without<Props, "theme"> & {
10
9
  theme?: import("@callstack/react-theme-provider").$DeepPartial<Theme> | undefined;
11
10
  }> & import("@callstack/react-theme-provider/typings/hoist-non-react-statics").NonReactStatics<import("react").ComponentType<Props> & C, {}>, useTheme: <T = Theme>(overrides?: import("@callstack/react-theme-provider").$DeepPartial<T> | undefined) => T;
11
+ /**
12
+ * How the provider learns the OS theme. Supply your own on platforms where
13
+ * `prefers-color-scheme` isn't the source of truth (Electron, React Native).
14
+ */
12
15
  export interface ThemeDetector {
16
+ /** Read the OS theme once, at mount. */
13
17
  detectInitialTheme(): Promise<GalaxyTheme.DARK | GalaxyTheme.LIGHT>;
18
+ /** Subscribe to OS theme changes. Returns an unsubscribe function. */
14
19
  onThemeChange(callback: (theme: GalaxyTheme.DARK | GalaxyTheme.LIGHT) => void): () => void;
15
20
  }
21
+ /** Default detector — reads `prefers-color-scheme`. Falls back to DARK off-browser. */
16
22
  export declare const BrowserThemeDetector: ThemeDetector;
17
- interface GalaxyThemeContextValue {
23
+ /** What `useGalaxyTheme()` returns. */
24
+ export interface GalaxyThemeContextValue {
25
+ /** The resolved token set. Read colors and fonts from here. */
18
26
  theme: Theme;
27
+ /** The theme actually rendering. Never `SYSTEM` — that's already resolved. */
19
28
  activeTheme: Exclude<GalaxyTheme, GalaxyTheme.SYSTEM>;
29
+ /** The user's stored preference. Can be `SYSTEM`. Bind theme pickers to this. */
20
30
  selectedTheme: GalaxyTheme;
31
+ /** What the OS reports. Use it to label "System (Dark)" in a picker. */
21
32
  systemTheme: GalaxyTheme.DARK | GalaxyTheme.LIGHT;
33
+ /** Whether the detector can read an OS theme at all. */
22
34
  isSystemThemeSupported: boolean;
35
+ /** Update the preference. Persists through `storage` when one is supplied. */
23
36
  setTheme: (theme: GalaxyTheme) => void;
24
37
  }
25
- interface GalaxyThemeProviderProps {
38
+ export interface GalaxyThemeProviderProps {
39
+ /** Theme to start on when nothing is stored. @default GalaxyTheme.SYSTEM */
26
40
  initialTheme?: GalaxyTheme;
41
+ /** Key the preference is stored under. @default "galaxy-theme" */
27
42
  storageKey?: string;
43
+ /** How the OS theme is read. @default BrowserThemeDetector */
28
44
  themeDetector?: ThemeDetector;
45
+ /**
46
+ * Where the preference persists. Omit and the choice is lost on reload.
47
+ * Pass your own adapter — DLS never touches `localStorage` directly, so it
48
+ * stays safe to render on a server.
49
+ */
29
50
  storage?: {
30
51
  get: (key: string) => GalaxyTheme | null;
31
52
  set: (key: string, theme: GalaxyTheme) => void;
32
53
  };
33
54
  }
55
+ /**
56
+ * Root provider. Wrap the app once, above everything that renders DLS.
57
+ *
58
+ * Resolves `SYSTEM` to the OS theme and feeds the token set to every
59
+ * `withTheme(styled.x)` component. Without it `useGalaxyTheme()` throws.
60
+ */
34
61
  declare const GalaxyThemeProvider: ({ children, initialTheme, storageKey, themeDetector, storage, }: PropsWithChildren<GalaxyThemeProviderProps>) => import("react").JSX.Element;
62
+ /**
63
+ * Read the active theme, the user's preference, and `setTheme`.
64
+ * Throws when called outside a `GalaxyThemeProvider`.
65
+ */
35
66
  export declare const useGalaxyTheme: () => GalaxyThemeContextValue;
36
67
  export { GalaxyThemeProvider, ThemeProvider, useTheme, withTheme };
@@ -1,9 +1,11 @@
1
- import { DEFAULT_THEME, GALAXY_THEME_MAP, GALAXY_THEME_STORAGE_KEY, GalaxyTheme } from "./constants.js";
1
+ import { GalaxyTheme } from "./types.js";
2
+ import { DEFAULT_THEME, GALAXY_THEME_MAP, GALAXY_THEME_STORAGE_KEY } from "./constants.js";
2
3
  import { createContext, useCallback, useContext, useEffect, useMemo, useState } from "react";
3
4
  import { createTheming } from "@callstack/react-theme-provider";
4
5
  import { jsx } from "react/jsx-runtime";
5
6
  //#region src/theme/GalaxyTheme.tsx
6
7
  var { ThemeProvider, withTheme, useTheme } = createTheming(DEFAULT_THEME);
8
+ /** Default detector — reads `prefers-color-scheme`. Falls back to DARK off-browser. */
7
9
  var BrowserThemeDetector = {
8
10
  detectInitialTheme: () => {
9
11
  if (typeof window !== "undefined" && window.matchMedia) {
@@ -26,6 +28,12 @@ var BrowserThemeDetector = {
26
28
  }
27
29
  };
28
30
  var GalaxyThemeContext = createContext(void 0);
31
+ /**
32
+ * Root provider. Wrap the app once, above everything that renders DLS.
33
+ *
34
+ * Resolves `SYSTEM` to the OS theme and feeds the token set to every
35
+ * `withTheme(styled.x)` component. Without it `useGalaxyTheme()` throws.
36
+ */
29
37
  var GalaxyThemeProvider = ({ children, initialTheme, storageKey = GALAXY_THEME_STORAGE_KEY, themeDetector = BrowserThemeDetector, storage }) => {
30
38
  const [systemTheme, setSystemTheme] = useState(() => {
31
39
  return GalaxyTheme.DARK;
@@ -98,6 +106,10 @@ var GalaxyThemeProvider = ({ children, initialTheme, storageKey = GALAXY_THEME_S
98
106
  })
99
107
  });
100
108
  };
109
+ /**
110
+ * Read the active theme, the user's preference, and `setTheme`.
111
+ * Throws when called outside a `GalaxyThemeProvider`.
112
+ */
101
113
  var useGalaxyTheme = () => {
102
114
  const context = useContext(GalaxyThemeContext);
103
115
  if (context === void 0) throw new Error("useGalaxyTheme must be used within a GalaxyThemeProvider");
@@ -1,11 +1,6 @@
1
1
  import type { SelectInputOption } from "../inputs/SelectInput";
2
- import type { Theme } from "./types";
2
+ import { GalaxyTheme, type Theme } from "./types";
3
3
  export declare const GALAXY_THEME_STORAGE_KEY = "galaxy:theme";
4
- export declare enum GalaxyTheme {
5
- SYSTEM = "SYSTEM",
6
- DARK = "DARK",
7
- LIGHT = "LIGHT"
8
- }
9
4
  export declare const GALAXY_DARK_THEME: Theme;
10
5
  export declare const GALAXY_LIGHT_THEME: Theme;
11
6
  export declare const GALAXY_THEME_OPTIONS: SelectInputOption[];
@@ -1,14 +1,9 @@
1
+ import { GalaxyTheme } from "./types.js";
1
2
  import { GALAXY_FONT } from "./typography.js";
2
3
  import { GALAXY_DARK_COLOR } from "./variants/dark.js";
3
4
  import { GALAXY_LIGHT_COLOR } from "./variants/light.js";
4
5
  //#region src/theme/constants.ts
5
6
  var GALAXY_THEME_STORAGE_KEY = "galaxy:theme";
6
- var GalaxyTheme = /* @__PURE__ */ function(GalaxyTheme) {
7
- GalaxyTheme["SYSTEM"] = "SYSTEM";
8
- GalaxyTheme["DARK"] = "DARK";
9
- GalaxyTheme["LIGHT"] = "LIGHT";
10
- return GalaxyTheme;
11
- }({});
12
7
  var GALAXY_DARK_THEME = {
13
8
  color: GALAXY_DARK_COLOR,
14
9
  font: GALAXY_FONT
@@ -19,25 +14,25 @@ var GALAXY_LIGHT_THEME = {
19
14
  };
20
15
  var GALAXY_THEME_OPTIONS = [
21
16
  {
22
- id: "SYSTEM",
17
+ id: GalaxyTheme.SYSTEM,
23
18
  label: "System",
24
- value: "SYSTEM"
19
+ value: GalaxyTheme.SYSTEM
25
20
  },
26
21
  {
27
- id: "DARK",
22
+ id: GalaxyTheme.DARK,
28
23
  label: "Dark",
29
- value: "DARK"
24
+ value: GalaxyTheme.DARK
30
25
  },
31
26
  {
32
- id: "LIGHT",
27
+ id: GalaxyTheme.LIGHT,
33
28
  label: "Light",
34
- value: "LIGHT"
29
+ value: GalaxyTheme.LIGHT
35
30
  }
36
31
  ];
37
32
  var GALAXY_THEME_MAP = {
38
- ["DARK"]: GALAXY_DARK_THEME,
39
- ["LIGHT"]: GALAXY_LIGHT_THEME
33
+ [GalaxyTheme.DARK]: GALAXY_DARK_THEME,
34
+ [GalaxyTheme.LIGHT]: GALAXY_LIGHT_THEME
40
35
  };
41
36
  var DEFAULT_THEME = GALAXY_DARK_THEME;
42
37
  //#endregion
43
- export { DEFAULT_THEME, GALAXY_DARK_THEME, GALAXY_LIGHT_THEME, GALAXY_THEME_MAP, GALAXY_THEME_OPTIONS, GALAXY_THEME_STORAGE_KEY, GalaxyTheme };
38
+ export { DEFAULT_THEME, GALAXY_DARK_THEME, GALAXY_LIGHT_THEME, GALAXY_THEME_MAP, GALAXY_THEME_OPTIONS, GALAXY_THEME_STORAGE_KEY };
@@ -1,6 +1,7 @@
1
+ import { GalaxyTheme } from "./types.js";
1
2
  import { GALAXY_FONT } from "./typography.js";
2
3
  import { GALAXY_DARK_COLOR } from "./variants/dark.js";
3
4
  import { GALAXY_LIGHT_COLOR } from "./variants/light.js";
4
- import { DEFAULT_THEME, GALAXY_DARK_THEME, GALAXY_LIGHT_THEME, GALAXY_THEME_MAP, GALAXY_THEME_OPTIONS, GALAXY_THEME_STORAGE_KEY, GalaxyTheme } from "./constants.js";
5
+ import { DEFAULT_THEME, GALAXY_DARK_THEME, GALAXY_LIGHT_THEME, GALAXY_THEME_MAP, GALAXY_THEME_OPTIONS, GALAXY_THEME_STORAGE_KEY } from "./constants.js";
5
6
  import { BrowserThemeDetector, GalaxyThemeProvider, ThemeProvider, useGalaxyTheme, useTheme, withTheme } from "./GalaxyTheme.js";
6
7
  export { BrowserThemeDetector, DEFAULT_THEME, GALAXY_DARK_COLOR, GALAXY_DARK_THEME, GALAXY_FONT, GALAXY_LIGHT_COLOR, GALAXY_LIGHT_THEME, GALAXY_THEME_MAP, GALAXY_THEME_OPTIONS, GALAXY_THEME_STORAGE_KEY, GalaxyTheme, GalaxyThemeProvider, ThemeProvider, useGalaxyTheme, useTheme, withTheme };
@@ -1,3 +1,10 @@
1
+ /** Theme preference. `SYSTEM` follows the OS and resolves to `DARK` or `LIGHT`. */
2
+ export declare enum GalaxyTheme {
3
+ SYSTEM = "SYSTEM",
4
+ DARK = "DARK",
5
+ LIGHT = "LIGHT"
6
+ }
7
+ /** Text colors. Target of `TextVariant`; `*Alt` inverts against the theme. */
1
8
  export type ThemeTextColor = {
2
9
  primary: string;
3
10
  primaryAlt: string;
@@ -20,6 +27,7 @@ export type ThemeTextColor = {
20
27
  galaxy: string;
21
28
  galaxyAlt: string;
22
29
  };
30
+ /** Surface colors. `base`/`primary`/`secondary` are the neutral stack; accents are for status only. */
23
31
  export type ThemeBackgroundColor = {
24
32
  base: string;
25
33
  baseAlt: string;
@@ -54,6 +62,7 @@ export type ThemeBackgroundColor = {
54
62
  galaxy: string;
55
63
  galaxyAlt: string;
56
64
  };
65
+ /** Border colors. Always paired with a `0.5px solid` hairline — DLS uses borders, not shadows. */
57
66
  export type ThemeBorderColor = {
58
67
  primary: string;
59
68
  secondary: string;
@@ -73,6 +82,7 @@ export type ThemeBorderColor = {
73
82
  galaxy: string;
74
83
  galaxyAlt: string;
75
84
  };
85
+ /** Icon colors. Target of `IconVariant`. */
76
86
  export type ThemeIconColor = {
77
87
  primary: string;
78
88
  primaryAlt: string;
@@ -94,6 +104,7 @@ export type ThemeIconColor = {
94
104
  galaxy: string;
95
105
  galaxyAlt: string;
96
106
  };
107
+ /** Black/white overlay tints. `bw<N>` is N% opacity; `*Alt` is the inverse. */
97
108
  export type ThemeOpacityColor = {
98
109
  bw100: string;
99
110
  bw100Alt: string;
@@ -118,10 +129,12 @@ export type ThemeOpacityColor = {
118
129
  bw0: string;
119
130
  bw0Alt: string;
120
131
  };
132
+ /** Numeric font weights. Target of `TextWeight`. */
121
133
  export type ThemeFontWeight = {
122
134
  regular: number;
123
135
  medium: number;
124
136
  };
137
+ /** Font sizes per `TextSize` step. */
125
138
  export type ThemeFontSize = {
126
139
  caption: string;
127
140
  body_sm: string;
@@ -131,6 +144,7 @@ export type ThemeFontSize = {
131
144
  heading_md: string;
132
145
  heading_lg: string;
133
146
  };
147
+ /** Line heights per `TextSize` step. */
134
148
  export type ThemeFontHeight = {
135
149
  caption: string;
136
150
  body_sm: string;
@@ -140,6 +154,7 @@ export type ThemeFontHeight = {
140
154
  heading_md: string;
141
155
  heading_lg: string;
142
156
  };
157
+ /** Letter spacing per `TextSize` step. */
143
158
  export type ThemeFontSpacing = {
144
159
  caption: string;
145
160
  body_sm: string;
@@ -149,6 +164,7 @@ export type ThemeFontSpacing = {
149
164
  heading_md: string;
150
165
  heading_lg: string;
151
166
  };
167
+ /** One font family plus its full metric scale. */
152
168
  export type ThemeFont = {
153
169
  family: string;
154
170
  weight: ThemeFontWeight;
@@ -156,6 +172,10 @@ export type ThemeFont = {
156
172
  height: ThemeFontHeight;
157
173
  spacing: ThemeFontSpacing;
158
174
  };
175
+ /**
176
+ * The resolved token set for the active theme. Reach it via `useGalaxyTheme()`,
177
+ * or as the `theme` prop inside a `withTheme(styled.x)` component.
178
+ */
159
179
  export type Theme = {
160
180
  color: {
161
181
  text: ThemeTextColor;
@@ -169,6 +189,7 @@ export type Theme = {
169
189
  mono: ThemeFont;
170
190
  };
171
191
  };
192
+ /** Adds the injected `theme` prop to a styled component's own props. */
172
193
  export type PropsWithTheme<P = unknown> = P & {
173
194
  theme: Theme;
174
195
  };
@@ -0,0 +1,10 @@
1
+ //#region src/theme/types.ts
2
+ /** Theme preference. `SYSTEM` follows the OS and resolves to `DARK` or `LIGHT`. */
3
+ var GalaxyTheme = /* @__PURE__ */ function(GalaxyTheme) {
4
+ GalaxyTheme["SYSTEM"] = "SYSTEM";
5
+ GalaxyTheme["DARK"] = "DARK";
6
+ GalaxyTheme["LIGHT"] = "LIGHT";
7
+ return GalaxyTheme;
8
+ }({});
9
+ //#endregion
10
+ export { GalaxyTheme };
@@ -1,5 +1,6 @@
1
1
  import type { Icon as PhosphorIcon } from "@phosphor-icons/react";
2
2
  import { ButtonProps } from "../buttons/Button";
3
+ /** Severity. Sets the border tint and the default icon. */
3
4
  export declare enum ToastVariant {
4
5
  PRIMARY = "PRIMARY",
5
6
  SUCCESS = "SUCCESS",
@@ -7,12 +8,22 @@ export declare enum ToastVariant {
7
8
  ERROR = "ERROR"
8
9
  }
9
10
  export interface ToastProps {
11
+ /** @default ToastVariant.PRIMARY */
10
12
  variant?: ToastVariant;
13
+ /** Overrides the icon the variant would pick. Pass the component, not an element. */
11
14
  icon?: PhosphorIcon;
15
+ /** Headline. A string is wrapped in `Text`; a node renders as-is. */
12
16
  header: string | React.ReactNode;
17
+ /** Supporting line under the header. */
13
18
  subheader: string | React.ReactNode;
19
+ /** Buttons in a row along the bottom. Each entry is full `ButtonProps`. */
14
20
  actions?: ButtonProps[];
21
+ /** Adds a dismiss ×. `ToastProvider` supplies this — don't set it by hand. */
15
22
  onClose?: () => void;
16
23
  }
24
+ /**
25
+ * The toast card itself. You rarely render this directly — call `showToast`
26
+ * from `useToast()` and let `ToastProvider` mount, stack and time it out.
27
+ */
17
28
  declare const Toast: ({ variant, icon, header, subheader, actions, onClose, }: ToastProps) => import("react").JSX.Element;
18
29
  export default Toast;
@@ -10,6 +10,7 @@ import { match } from "ts-pattern";
10
10
  import { jsx, jsxs } from "react/jsx-runtime";
11
11
  import { CheckCircleIcon, SpinnerGapIcon, WarningIcon, XIcon } from "@phosphor-icons/react";
12
12
  //#region src/toast/Toast.tsx
13
+ /** Severity. Sets the border tint and the default icon. */
13
14
  var ToastVariant = /* @__PURE__ */ function(ToastVariant) {
14
15
  ToastVariant["PRIMARY"] = "PRIMARY";
15
16
  ToastVariant["SUCCESS"] = "SUCCESS";
@@ -30,6 +31,10 @@ var StyledToast = withTheme(/*#__PURE__*/ styled("div")({
30
31
  "sgmrm4-2": [_exp3()]
31
32
  }
32
33
  }));
34
+ /**
35
+ * The toast card itself. You rarely render this directly — call `showToast`
36
+ * from `useToast()` and let `ToastProvider` mount, stack and time it out.
37
+ */
33
38
  var Toast = ({ variant = "PRIMARY", icon, header, subheader, actions, onClose }) => {
34
39
  const renderIcon = () => {
35
40
  if (icon) return /* @__PURE__ */ jsx(Icon, {
@@ -1,16 +1,25 @@
1
1
  import { PropsWithChildren } from "react";
2
2
  import { ToastVariant, type ToastProps } from "./Toast";
3
+ /** What you pass to `showToast`. Every `ToastProps` field except `onClose`, which the provider owns. */
3
4
  export type ShowToastProps = Omit<ToastProps, "onClose"> & {
5
+ /** Milliseconds before auto-dismiss. Pass `0` to make it stay. @default 3000 */
4
6
  timeout?: number;
7
+ /** Viewport offset. Toasts sharing the same four values stack together. */
5
8
  top?: number | string;
6
9
  left?: number | string;
7
10
  right?: number | string;
8
11
  bottom?: number | string;
9
12
  };
10
13
  export interface ToastContextProps {
14
+ /** Queue a toast. Returns its id, for dismissing it early via `hideToast`. */
11
15
  showToast: (options: ShowToastProps) => string;
16
+ /** Dismiss one toast by id, or every toast when called with no argument. */
12
17
  hideToast: (id?: string) => void;
13
18
  }
14
19
  export declare const ToastContext: import("react").Context<ToastContextProps | undefined>;
20
+ /**
21
+ * Owns the toast queue. Mount it once near the root, then call `showToast` from
22
+ * `useToast()` anywhere below. Handles stacking, timers and dismissal.
23
+ */
15
24
  export declare const ToastProvider: ({ children }: PropsWithChildren) => import("react").JSX.Element;
16
25
  export { ToastVariant };
@@ -16,6 +16,10 @@ var positionKey = (toast) => JSON.stringify([
16
16
  toast.bottom,
17
17
  toast.left
18
18
  ]);
19
+ /**
20
+ * Owns the toast queue. Mount it once near the root, then call `showToast` from
21
+ * `useToast()` anywhere below. Handles stacking, timers and dismissal.
22
+ */
19
23
  var ToastProvider = ({ children }) => {
20
24
  const [toasts, setToasts] = useState([]);
21
25
  const timeoutRefs = useRef(/* @__PURE__ */ new Map());
@@ -1 +1,8 @@
1
+ /**
2
+ * Returns `{ showToast, hideToast }`. `showToast` returns the new toast's id,
3
+ * which you can pass to `hideToast` to dismiss that one early — call it with no
4
+ * argument to clear them all.
5
+ *
6
+ * Throws when called outside a `ToastProvider`.
7
+ */
1
8
  export declare const useToast: () => import("./ToastProvider").ToastContextProps;
@@ -1,6 +1,13 @@
1
1
  import { ToastContext } from "./ToastProvider.js";
2
2
  import { useContext } from "react";
3
3
  //#region src/toast/useToast.ts
4
+ /**
5
+ * Returns `{ showToast, hideToast }`. `showToast` returns the new toast's id,
6
+ * which you can pass to `hideToast` to dismiss that one early — call it with no
7
+ * argument to clear them all.
8
+ *
9
+ * Throws when called outside a `ToastProvider`.
10
+ */
4
11
  var useToast = () => {
5
12
  const context = useContext(ToastContext);
6
13
  if (!context) throw new Error("useToast must be used within a ToastProvider");
@@ -1,4 +1,5 @@
1
1
  import type { PropsWithChildren } from "react";
2
+ /** Placement relative to the trigger. The `AUTO_*` values pick a side that fits. */
2
3
  export declare enum TooltipPosition {
3
4
  TOP = "top",
4
5
  BOTTOM = "bottom",
@@ -16,22 +17,39 @@ export declare enum TooltipPosition {
16
17
  AUTO_START = "auto-start",
17
18
  AUTO_END = "auto-end"
18
19
  }
20
+ /** Surface treatment of the tooltip bubble. */
19
21
  export declare enum TooltipVariant {
20
22
  BASE = "BASE",
21
23
  PRIMARY = "PRIMARY",
22
24
  SECONDARY = "SECONDARY",
23
25
  TERTIARY = "TERTIARY"
24
26
  }
25
- interface TooltipProps {
27
+ export interface TooltipProps {
28
+ /** Tooltip content. A string is wrapped in `Text`; a node renders as-is. */
26
29
  body: string | React.ReactNode;
30
+ /** @default TooltipVariant.SECONDARY */
27
31
  variant?: TooltipVariant;
32
+ /** @default TooltipPosition.TOP */
28
33
  position?: TooltipPosition;
34
+ /** Milliseconds to hover before it appears. @default 0 */
29
35
  delay?: number;
36
+ /** `[skidding, distance]` in px from the trigger. @default [0, 4] */
30
37
  offset?: [number, number];
38
+ /** Keep it open while the pointer is over it, so links inside stay reachable. */
31
39
  isInteractive?: boolean;
40
+ /** Drop the 8px inset — for tooltips that host their own layout. */
32
41
  noPadding?: boolean;
42
+ /** Drop the hairline border. */
33
43
  noBorder?: boolean;
44
+ /** Render children bare, with no tooltip at all. */
34
45
  isDisabled?: boolean;
35
46
  }
47
+ /**
48
+ * Wraps a trigger and shows `body` on hover or keyboard focus. Children are the
49
+ * trigger, wrapped in an inline-block span.
50
+ *
51
+ * Sits at z-index 10000, above modals and drawers. Set `isInteractive` if the
52
+ * body contains anything clickable.
53
+ */
36
54
  declare const Tooltip: ({ children, variant, body, position, delay, offset, isInteractive, noPadding, noBorder, isDisabled, }: PropsWithChildren<TooltipProps>) => string | number | boolean | Iterable<import("react").ReactNode> | import("react").JSX.Element | null | undefined;
37
55
  export default Tooltip;
@@ -6,6 +6,7 @@ import { match } from "ts-pattern";
6
6
  import { jsx } from "react/jsx-runtime";
7
7
  import Tippy from "@tippyjs/react";
8
8
  //#region src/tooltip/Tooltip.tsx
9
+ /** Placement relative to the trigger. The `AUTO_*` values pick a side that fits. */
9
10
  var TooltipPosition = /* @__PURE__ */ function(TooltipPosition) {
10
11
  TooltipPosition["TOP"] = "top";
11
12
  TooltipPosition["BOTTOM"] = "bottom";
@@ -24,6 +25,7 @@ var TooltipPosition = /* @__PURE__ */ function(TooltipPosition) {
24
25
  TooltipPosition["AUTO_END"] = "auto-end";
25
26
  return TooltipPosition;
26
27
  }({});
28
+ /** Surface treatment of the tooltip bubble. */
27
29
  var TooltipVariant = /* @__PURE__ */ function(TooltipVariant) {
28
30
  TooltipVariant["BASE"] = "BASE";
29
31
  TooltipVariant["PRIMARY"] = "PRIMARY";
@@ -54,6 +56,13 @@ var TooltipContent = withTheme(/*#__PURE__*/ styled("span")({
54
56
  "tjda4tq-2": [_exp3()]
55
57
  }
56
58
  }));
59
+ /**
60
+ * Wraps a trigger and shows `body` on hover or keyboard focus. Children are the
61
+ * trigger, wrapped in an inline-block span.
62
+ *
63
+ * Sits at z-index 10000, above modals and drawers. Set `isInteractive` if the
64
+ * body contains anything clickable.
65
+ */
57
66
  var Tooltip = ({ children, variant = "SECONDARY", body, position = "top", delay = 0, offset = [0, 4], isInteractive = false, noPadding = false, noBorder = false, isDisabled = false }) => {
58
67
  if (isDisabled) return children;
59
68
  return /* @__PURE__ */ jsx(Tippy, {
@@ -1,6 +1,13 @@
1
1
  import type { PropsWithChildren } from "react";
2
2
  export interface FadeProps {
3
+ /** Seconds to wait before starting. @default 0 */
3
4
  delay?: number;
4
5
  }
6
+ /**
7
+ * Fades children in on mount and out on unmount, over 200ms.
8
+ *
9
+ * The exit half only runs inside a framer-motion `AnimatePresence`. Fills its
10
+ * parent (100% × 100%).
11
+ */
5
12
  declare const Fade: ({ children, delay }: PropsWithChildren<FadeProps>) => import("react").JSX.Element;
6
13
  export default Fade;
@@ -1,6 +1,12 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { motion } from "framer-motion";
3
3
  //#region src/transform/Fade.tsx
4
+ /**
5
+ * Fades children in on mount and out on unmount, over 200ms.
6
+ *
7
+ * The exit half only runs inside a framer-motion `AnimatePresence`. Fills its
8
+ * parent (100% × 100%).
9
+ */
4
10
  var Fade = ({ children, delay = 0 }) => {
5
11
  return /* @__PURE__ */ jsx(motion.div, {
6
12
  initial: { opacity: 0 },
@@ -1,3 +1,7 @@
1
1
  import { PropsWithChildren } from "react";
2
+ /**
3
+ * Pulses children between full and 40% opacity, forever, on a 1s cycle.
4
+ * Signals "in progress" — pair it with a real completion state.
5
+ */
2
6
  declare const Flash: ({ children }: PropsWithChildren) => import("react").JSX.Element;
3
7
  export default Flash;
@@ -7,6 +7,10 @@ var StyledFlash = /*#__PURE__*/ styled("span")({
7
7
  class: "s18o9ih0",
8
8
  propsAsIs: false
9
9
  });
10
+ /**
11
+ * Pulses children between full and 40% opacity, forever, on a 1s cycle.
12
+ * Signals "in progress" — pair it with a real completion state.
13
+ */
10
14
  var Flash = ({ children }) => {
11
15
  return /* @__PURE__ */ jsx(StyledFlash, { children });
12
16
  };
@@ -1,8 +1,15 @@
1
1
  import type { PropsWithChildren } from "react";
2
2
  export interface RotateProps {
3
+ /** Rotated to `deg` when true, back to 0 when false. */
3
4
  isRotated: boolean;
5
+ /** Angle in degrees at the rotated end. @default 180 */
4
6
  deg?: number;
7
+ /** Transition duration in seconds. @default 0.075 */
5
8
  speed?: number;
6
9
  }
10
+ /**
11
+ * Tweens children between 0° and `deg` as `isRotated` flips. State-driven, not
12
+ * looping — the usual case is a chevron on an expand/collapse toggle.
13
+ */
7
14
  declare const Rotate: ({ children, isRotated, deg, speed }: PropsWithChildren<RotateProps>) => import("react").JSX.Element;
8
15
  export default Rotate;
@@ -16,6 +16,10 @@ var RotateWrapper = /*#__PURE__*/ styled("div")({
16
16
  "r530s5l-1": [_exp2()]
17
17
  }
18
18
  });
19
+ /**
20
+ * Tweens children between 0° and `deg` as `isRotated` flips. State-driven, not
21
+ * looping — the usual case is a chevron on an expand/collapse toggle.
22
+ */
19
23
  var Rotate = ({ children, isRotated, deg = 180, speed }) => {
20
24
  return /* @__PURE__ */ jsx(RotateWrapper, {
21
25
  $isRotated: isRotated,
@@ -1,6 +1,13 @@
1
1
  import type { PropsWithChildren } from "react";
2
2
  export interface ScaleFadeProps {
3
+ /** Seconds to wait before starting. @default 0 */
3
4
  delay?: number;
4
5
  }
6
+ /**
7
+ * Fades children in while scaling from 95% to 100%, over 200ms. The entrance for
8
+ * things that pop: menus, popovers, toasts.
9
+ *
10
+ * The exit half only runs inside a framer-motion `AnimatePresence`.
11
+ */
5
12
  declare const ScaleFade: ({ children, delay }: PropsWithChildren<ScaleFadeProps>) => import("react").JSX.Element;
6
13
  export default ScaleFade;
@@ -1,6 +1,12 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { motion } from "framer-motion";
3
3
  //#region src/transform/ScaleFade.tsx
4
+ /**
5
+ * Fades children in while scaling from 95% to 100%, over 200ms. The entrance for
6
+ * things that pop: menus, popovers, toasts.
7
+ *
8
+ * The exit half only runs inside a framer-motion `AnimatePresence`.
9
+ */
4
10
  var ScaleFade = ({ children, delay = 0 }) => {
5
11
  return /* @__PURE__ */ jsx(motion.div, {
6
12
  initial: {
@@ -1,7 +1,14 @@
1
1
  import type { PropsWithChildren } from "react";
2
2
  export interface SpinProps {
3
+ /** Rotations per second. Higher is faster. @default 1 */
3
4
  speed?: number;
5
+ /** @default true */
4
6
  isSpinning?: boolean;
5
7
  }
8
+ /**
9
+ * Rotates children continuously — the loading spinner, usually wrapping an
10
+ * `Icon`. When `isSpinning` is false the children render bare, with no wrapper
11
+ * element, so toggling it does not shift layout.
12
+ */
6
13
  declare const Spin: ({ children, speed, isSpinning }: PropsWithChildren<SpinProps>) => import("react").JSX.Element;
7
14
  export default Spin;
@@ -9,6 +9,11 @@ var StyledSpin = /*#__PURE__*/ styled("div")({
9
9
  propsAsIs: false,
10
10
  vars: { "sonzivr-0": [_exp(), "s"] }
11
11
  });
12
+ /**
13
+ * Rotates children continuously — the loading spinner, usually wrapping an
14
+ * `Icon`. When `isSpinning` is false the children render bare, with no wrapper
15
+ * element, so toggling it does not shift layout.
16
+ */
12
17
  var Spin = ({ children, speed = 1, isSpinning = true }) => {
13
18
  if (isSpinning) return /* @__PURE__ */ jsx(StyledSpin, {
14
19
  $speed: speed,