@galaxy-io/dls 1.4.10 → 1.4.12
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/accordion/Accordion.d.ts +19 -2
- package/dist/accordion/Accordion.js +8 -0
- package/dist/avatar/Avatar.d.ts +9 -0
- package/dist/avatar/Avatar.js +4 -0
- package/dist/avatar/AvatarShimmer.d.ts +2 -0
- package/dist/avatar/AvatarShimmer.js +1 -0
- package/dist/backgrounds/CellGridBackground.d.ts +12 -1
- package/dist/backgrounds/CellGridBackground.js +5 -0
- package/dist/backgrounds/CrossGridBackground.d.ts +13 -1
- package/dist/backgrounds/CrossGridBackground.js +4 -0
- package/dist/backgrounds/DotGridBackground.d.ts +12 -1
- package/dist/backgrounds/DotGridBackground.js +4 -0
- package/dist/badge/Badge.d.ts +12 -0
- package/dist/badge/Badge.js +7 -0
- package/dist/beacons/Beacon.d.ts +7 -13
- package/dist/beacons/Beacon.js +3 -0
- package/dist/buttons/Button.d.ts +18 -0
- package/dist/buttons/Button.js +10 -1
- package/dist/charts/BarChart.d.ts +4 -1
- package/dist/charts/BarChart.js +17 -8
- package/dist/charts/ChartCategoryTargets.d.ts +5 -12
- package/dist/charts/ChartCategoryTargets.js +1 -2
- package/dist/charts/ChartFrame.d.ts +3 -4
- package/dist/charts/ChartFrame.js +10 -25
- package/dist/charts/ChartLegend.js +26 -23
- package/dist/charts/ChartPrimitives.d.ts +38 -17
- package/dist/charts/ChartPrimitives.js +74 -73
- package/dist/charts/DashboardProvider.d.ts +57 -0
- package/dist/charts/DashboardProvider.js +30 -0
- package/dist/charts/LineChart.js +2 -1
- package/dist/charts/PieChart.js +1 -1
- package/dist/charts/ProgressBar.d.ts +13 -1
- package/dist/charts/ProgressBar.js +7 -0
- package/dist/charts/StatChart.d.ts +10 -1
- package/dist/charts/StatChart.js +5 -0
- package/dist/charts/constants.d.ts +20 -24
- package/dist/charts/constants.js +21 -25
- package/dist/charts/types.d.ts +10 -2
- package/dist/charts/types.js +9 -1
- package/dist/charts/useChartInteraction.d.ts +37 -10
- package/dist/charts/useChartInteraction.js +72 -12
- package/dist/chips/Chip.d.ts +20 -1
- package/dist/chips/Chip.js +9 -1
- package/dist/containers/FlexItem.d.ts +14 -12
- package/dist/containers/FlexItem.js +4 -0
- package/dist/containers/FlexWrapper.d.ts +29 -96
- package/dist/containers/FlexWrapper.js +12 -0
- package/dist/containers/GridWrapper.d.ts +25 -66
- package/dist/containers/GridWrapper.js +8 -0
- package/dist/containers/Spacing.d.ts +10 -0
- package/dist/containers/Spacing.js +7 -0
- package/dist/containers/Wrapper.d.ts +11 -1
- package/dist/containers/Wrapper.js +4 -0
- package/dist/dividers/HorizontalDivider.d.ts +2 -0
- package/dist/dividers/HorizontalDivider.js +1 -0
- package/dist/dividers/VerticalDivider.d.ts +4 -0
- package/dist/dividers/VerticalDivider.js +4 -0
- package/dist/drawer/Drawer.d.ts +11 -4
- package/dist/drawer/Drawer.js +7 -0
- package/dist/dropdown/Dropdown.d.ts +24 -0
- package/dist/dropdown/Dropdown.js +9 -0
- package/dist/editor/CodeEditor.d.ts +23 -42
- package/dist/editor/CodeEditor.js +9 -1
- package/dist/hooks/useDismiss.d.ts +6 -0
- package/dist/hooks/useDismiss.js +6 -0
- package/dist/hooks/useElementClientSize.d.ts +2 -2
- package/dist/hooks/useResize.d.ts +5 -2
- package/dist/icons/GalaxyLogomark.d.ts +9 -1
- package/dist/icons/GalaxyLogomark.js +7 -1
- package/dist/icons/GalaxyLogomark3D.d.ts +15 -0
- package/dist/icons/GalaxyLogomark3D.js +9 -0
- package/dist/icons/GalaxyLogomarkAnimation.d.ts +10 -0
- package/dist/icons/GalaxyLogomarkAnimation.js +7 -1
- package/dist/icons/GalaxyWordmark.d.ts +7 -1
- package/dist/icons/GalaxyWordmark.js +5 -1
- package/dist/icons/Icon.d.ts +10 -0
- package/dist/icons/Icon.js +5 -0
- package/dist/inputs/CheckboxInput.d.ts +13 -0
- package/dist/inputs/CheckboxInput.js +8 -0
- package/dist/inputs/ColorInput.d.ts +15 -0
- package/dist/inputs/ColorInput.js +6 -0
- package/dist/inputs/CopyInput.d.ts +9 -0
- package/dist/inputs/CopyInput.js +4 -0
- package/dist/inputs/DateInput.d.ts +13 -0
- package/dist/inputs/DateInput.js +5 -0
- package/dist/inputs/Input.d.ts +37 -0
- package/dist/inputs/Input.js +13 -0
- package/dist/inputs/MultiSelectInput.d.ts +26 -0
- package/dist/inputs/MultiSelectInput.js +6 -0
- package/dist/inputs/MultiTextInput.d.ts +16 -0
- package/dist/inputs/MultiTextInput.js +9 -0
- package/dist/inputs/NumberInput.d.ts +7 -1
- package/dist/inputs/NumberInput.js +5 -0
- package/dist/inputs/PasswordInput.d.ts +9 -1
- package/dist/inputs/PasswordInput.js +4 -0
- package/dist/inputs/RadioInput.d.ts +13 -0
- package/dist/inputs/RadioInput.js +8 -0
- package/dist/inputs/SelectInput.d.ts +30 -0
- package/dist/inputs/SelectInput.js +8 -0
- package/dist/inputs/SliderInput.d.ts +15 -0
- package/dist/inputs/SliderInput.js +6 -0
- package/dist/inputs/SwitcherInput.d.ts +10 -1
- package/dist/inputs/SwitcherInput.js +4 -0
- package/dist/inputs/TextAreaInput.d.ts +24 -0
- package/dist/inputs/TextAreaInput.js +9 -0
- package/dist/inputs/TextInput.d.ts +8 -1
- package/dist/inputs/TextInput.js +6 -0
- package/dist/inputs/ToggleInput.d.ts +11 -0
- package/dist/inputs/ToggleInput.js +6 -0
- package/dist/lists/BulletedList.d.ts +4 -0
- package/dist/lists/BulletedList.js +2 -0
- package/dist/modal/Modal.d.ts +8 -0
- package/dist/modal/Modal.js +6 -0
- package/dist/overlay/OverlayProvider.d.ts +11 -0
- package/dist/overlay/OverlayProvider.js +7 -0
- package/dist/overlay/constants.d.ts +1 -0
- package/dist/overlay/constants.js +1 -0
- package/dist/overlay/useOverlay.d.ts +11 -0
- package/dist/overlay/useOverlay.js +9 -0
- package/dist/resizable/HorizontalResizeHandle.d.ts +8 -1
- package/dist/resizable/HorizontalResizeHandle.js +6 -0
- package/dist/resizable/VerticalResizeHandle.d.ts +8 -1
- package/dist/resizable/VerticalResizeHandle.js +6 -0
- package/dist/shapes/Circle.d.ts +4 -1
- package/dist/shapes/Circle.js +1 -0
- package/dist/shapes/Square.d.ts +4 -1
- package/dist/shapes/Square.js +1 -0
- package/dist/styles.css +14 -14
- package/dist/table/InfiniteSpreadsheet.d.ts +7 -0
- package/dist/table/InfiniteSpreadsheet.js +7 -0
- package/dist/table/InfiniteTable.d.ts +8 -0
- package/dist/table/InfiniteTable.js +8 -0
- package/dist/table/VirtualizedInfiniteTable.d.ts +7 -0
- package/dist/table/VirtualizedInfiniteTable.js +7 -0
- package/dist/text/Bold.d.ts +4 -0
- package/dist/text/Bold.js +4 -0
- package/dist/text/Code.d.ts +4 -0
- package/dist/text/Code.js +4 -0
- package/dist/text/EditableText.d.ts +10 -1
- package/dist/text/EditableText.js +7 -0
- package/dist/text/Ellipsis.d.ts +6 -4
- package/dist/text/Ellipsis.js +4 -0
- package/dist/text/HotKeys.d.ts +10 -0
- package/dist/text/HotKeys.js +6 -0
- package/dist/text/MarkdownText.d.ts +9 -1
- package/dist/text/MarkdownText.js +6 -0
- package/dist/text/Paragraph.d.ts +17 -0
- package/dist/text/Paragraph.js +7 -0
- package/dist/text/RequiredMarker.d.ts +3 -1
- package/dist/text/RequiredMarker.js +1 -0
- package/dist/text/Selectable.d.ts +4 -0
- package/dist/text/Selectable.js +4 -0
- package/dist/text/Text.d.ts +19 -0
- package/dist/text/Text.js +10 -0
- package/dist/text/TextShimmer.d.ts +7 -0
- package/dist/text/TextShimmer.js +4 -0
- package/dist/theme/GalaxyTheme.d.ts +35 -4
- package/dist/theme/GalaxyTheme.js +13 -1
- package/dist/theme/constants.d.ts +1 -6
- package/dist/theme/constants.js +10 -15
- package/dist/theme/index.js +2 -1
- package/dist/theme/types.d.ts +21 -0
- package/dist/theme/types.js +10 -0
- package/dist/toast/Toast.d.ts +11 -0
- package/dist/toast/Toast.js +5 -0
- package/dist/toast/ToastProvider.d.ts +9 -0
- package/dist/toast/ToastProvider.js +4 -0
- package/dist/toast/useToast.d.ts +7 -0
- package/dist/toast/useToast.js +7 -0
- package/dist/tooltip/Tooltip.d.ts +19 -1
- package/dist/tooltip/Tooltip.js +9 -0
- package/dist/transform/Fade.d.ts +7 -0
- package/dist/transform/Fade.js +6 -0
- package/dist/transform/Flash.d.ts +4 -0
- package/dist/transform/Flash.js +4 -0
- package/dist/transform/Rotate.d.ts +7 -0
- package/dist/transform/Rotate.js +4 -0
- package/dist/transform/ScaleFade.d.ts +7 -0
- package/dist/transform/ScaleFade.js +6 -0
- package/dist/transform/Spin.d.ts +7 -0
- package/dist/transform/Spin.js +5 -0
- package/dist/widget/Widget.d.ts +18 -1
- package/dist/widget/Widget.js +5 -0
- package/package.json +1 -1
package/dist/text/HotKeys.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/** Key-cap contrast. Step it down when the shortcut is secondary to its label. */
|
|
1
2
|
export declare enum HotKeysVariant {
|
|
2
3
|
BASE = "BASE",
|
|
3
4
|
PRIMARY = "PRIMARY",
|
|
@@ -5,16 +6,25 @@ export declare enum HotKeysVariant {
|
|
|
5
6
|
TERTIARY = "TERTIARY",
|
|
6
7
|
DISABLED = "DISABLED"
|
|
7
8
|
}
|
|
9
|
+
/** Key-cap size — 14 / 16 / 18px minimum width. Match the adjacent text. */
|
|
8
10
|
export declare enum HotKeysSize {
|
|
9
11
|
SMALL = "SMALL",
|
|
10
12
|
MEDIUM = "MEDIUM",
|
|
11
13
|
LARGE = "LARGE"
|
|
12
14
|
}
|
|
13
15
|
export interface HotKeysProps {
|
|
16
|
+
/** One cap per entry, in press order — e.g. `["⌘", "K"]`. Rendered verbatim. */
|
|
14
17
|
hotKeys: string[];
|
|
18
|
+
/** @default HotKeysVariant.BASE */
|
|
15
19
|
variant?: HotKeysVariant;
|
|
20
|
+
/** @default HotKeysSize.MEDIUM */
|
|
16
21
|
size?: HotKeysSize;
|
|
22
|
+
/** Render caps in the mono family. */
|
|
17
23
|
isMonospace?: boolean;
|
|
18
24
|
}
|
|
25
|
+
/**
|
|
26
|
+
* Renders a keyboard shortcut as a row of key caps. Display only — it does not
|
|
27
|
+
* bind anything; wire the actual handler yourself.
|
|
28
|
+
*/
|
|
19
29
|
declare const HotKeys: ({ hotKeys, variant, size, isMonospace, }: HotKeysProps) => import("react").JSX.Element;
|
|
20
30
|
export default HotKeys;
|
package/dist/text/HotKeys.js
CHANGED
|
@@ -4,6 +4,7 @@ import { styled } from "@linaria/react";
|
|
|
4
4
|
import { match } from "ts-pattern";
|
|
5
5
|
import { jsx } from "react/jsx-runtime";
|
|
6
6
|
//#region src/text/HotKeys.tsx
|
|
7
|
+
/** Key-cap contrast. Step it down when the shortcut is secondary to its label. */
|
|
7
8
|
var HotKeysVariant = /* @__PURE__ */ function(HotKeysVariant) {
|
|
8
9
|
HotKeysVariant["BASE"] = "BASE";
|
|
9
10
|
HotKeysVariant["PRIMARY"] = "PRIMARY";
|
|
@@ -12,6 +13,7 @@ var HotKeysVariant = /* @__PURE__ */ function(HotKeysVariant) {
|
|
|
12
13
|
HotKeysVariant["DISABLED"] = "DISABLED";
|
|
13
14
|
return HotKeysVariant;
|
|
14
15
|
}({});
|
|
16
|
+
/** Key-cap size — 14 / 16 / 18px minimum width. Match the adjacent text. */
|
|
15
17
|
var HotKeysSize = /* @__PURE__ */ function(HotKeysSize) {
|
|
16
18
|
HotKeysSize["SMALL"] = "SMALL";
|
|
17
19
|
HotKeysSize["MEDIUM"] = "MEDIUM";
|
|
@@ -56,6 +58,10 @@ var StyledHotKey = withTheme(/*#__PURE__*/ styled("div")({
|
|
|
56
58
|
"sl247mt-7": [_exp9()]
|
|
57
59
|
}
|
|
58
60
|
}));
|
|
61
|
+
/**
|
|
62
|
+
* Renders a keyboard shortcut as a row of key caps. Display only — it does not
|
|
63
|
+
* bind anything; wire the actual handler yourself.
|
|
64
|
+
*/
|
|
59
65
|
var HotKeys = ({ hotKeys, variant, size = "MEDIUM", isMonospace = false }) => {
|
|
60
66
|
return /* @__PURE__ */ jsx(HotKeysWrapper, { children: hotKeys.map((hotKey) => /* @__PURE__ */ jsx(StyledHotKey, {
|
|
61
67
|
$variant: variant,
|
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
import { type Components } from "react-markdown";
|
|
2
|
-
interface MarkdownTextProps {
|
|
2
|
+
export interface MarkdownTextProps {
|
|
3
|
+
/** Markdown source. GitHub-flavored, and raw HTML is allowed through. */
|
|
3
4
|
content: string;
|
|
5
|
+
/** Replace the renderer for specific tags. Merged over the DLS defaults. */
|
|
4
6
|
componentOverrides?: Partial<Components>;
|
|
5
7
|
}
|
|
8
|
+
/**
|
|
9
|
+
* Renders Markdown using DLS components — headings, lists, tables and code all
|
|
10
|
+
* come out on theme tokens rather than browser defaults.
|
|
11
|
+
*
|
|
12
|
+
* Raw HTML in `content` is rendered, not escaped. Don't pass untrusted input.
|
|
13
|
+
*/
|
|
6
14
|
declare const MarkdownText: ({ content, componentOverrides }: MarkdownTextProps) => import("react").JSX.Element;
|
|
7
15
|
export default MarkdownText;
|
|
@@ -297,6 +297,12 @@ var markdownComponents = {
|
|
|
297
297
|
children
|
|
298
298
|
})
|
|
299
299
|
};
|
|
300
|
+
/**
|
|
301
|
+
* Renders Markdown using DLS components — headings, lists, tables and code all
|
|
302
|
+
* come out on theme tokens rather than browser defaults.
|
|
303
|
+
*
|
|
304
|
+
* Raw HTML in `content` is rendered, not escaped. Don't pass untrusted input.
|
|
305
|
+
*/
|
|
300
306
|
var MarkdownText = ({ content, componentOverrides }) => {
|
|
301
307
|
const components = componentOverrides ? {
|
|
302
308
|
...markdownComponents,
|
package/dist/text/Paragraph.d.ts
CHANGED
|
@@ -1,16 +1,33 @@
|
|
|
1
1
|
import type { CSSProperties, PropsWithChildren } from "react";
|
|
2
2
|
import { TextSize, TextVariant, TextWeight } from "./Text";
|
|
3
3
|
export interface ParagraphProps {
|
|
4
|
+
/** Color role. @default TextVariant.PRIMARY */
|
|
4
5
|
variant?: TextVariant;
|
|
6
|
+
/** Type scale step. @default TextSize.BODY_MD */
|
|
5
7
|
size?: TextSize;
|
|
8
|
+
/** @default TextWeight.REGULAR */
|
|
6
9
|
weight?: TextWeight;
|
|
10
|
+
/** @default "left" */
|
|
7
11
|
align?: CSSProperties["textAlign"];
|
|
12
|
+
/** Cursor over the text. Inherits from the parent when unset. */
|
|
8
13
|
cursor?: CSSProperties["cursor"];
|
|
14
|
+
/** Raw color that bypasses `variant`. Escape hatch — prefer `variant`. */
|
|
9
15
|
hex?: string;
|
|
16
|
+
/** Render in the mono family (Berkeley Mono) instead of sans. */
|
|
10
17
|
isMonospace?: boolean;
|
|
18
|
+
/** Let the user select the text. Off by default so UI chrome isn't selectable. */
|
|
11
19
|
isSelectable?: boolean;
|
|
20
|
+
/** Truncate after this many lines with an ellipsis. Omit to let it run. */
|
|
12
21
|
lineClamp?: number;
|
|
22
|
+
/** Reserve height so clamped copy doesn't shift layout. Defaults to `lineClamp` em. */
|
|
13
23
|
minHeight?: string;
|
|
14
24
|
}
|
|
25
|
+
/**
|
|
26
|
+
* Multi-line body copy. Same tokens as `Text`, but with a 1.25× line height for
|
|
27
|
+
* readability and `lineClamp` instead of single-line ellipsis.
|
|
28
|
+
*
|
|
29
|
+
* Use `Text` for labels and single-line UI strings; reach for this when the copy
|
|
30
|
+
* is a real paragraph.
|
|
31
|
+
*/
|
|
15
32
|
declare const Paragraph: ({ children, size, variant, weight, align, cursor, isMonospace, isSelectable, lineClamp, minHeight, hex, }: PropsWithChildren<ParagraphProps>) => import("react").JSX.Element;
|
|
16
33
|
export default Paragraph;
|
package/dist/text/Paragraph.js
CHANGED
|
@@ -57,6 +57,13 @@ var StyledParagraph = withTheme(/*#__PURE__*/ styled("span")({
|
|
|
57
57
|
"sts1mtj-14": [_exp16()]
|
|
58
58
|
}
|
|
59
59
|
}));
|
|
60
|
+
/**
|
|
61
|
+
* Multi-line body copy. Same tokens as `Text`, but with a 1.25× line height for
|
|
62
|
+
* readability and `lineClamp` instead of single-line ellipsis.
|
|
63
|
+
*
|
|
64
|
+
* Use `Text` for labels and single-line UI strings; reach for this when the copy
|
|
65
|
+
* is a real paragraph.
|
|
66
|
+
*/
|
|
60
67
|
var Paragraph = ({ children, size = TextSize.BODY_MD, variant = TextVariant.PRIMARY, weight = TextWeight.REGULAR, align = "left", cursor, isMonospace = false, isSelectable = false, lineClamp, minHeight, hex }) => {
|
|
61
68
|
return /* @__PURE__ */ jsx(StyledParagraph, {
|
|
62
69
|
$size: size,
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { TextSize } from "./Text";
|
|
2
|
-
interface RequiredMarkerProps {
|
|
2
|
+
export interface RequiredMarkerProps {
|
|
3
|
+
/** Match the size of the label it sits beside. @default TextSize.BODY_MD */
|
|
3
4
|
size?: TextSize;
|
|
4
5
|
}
|
|
6
|
+
/** The red asterisk marking a required field. Inputs render it from `isRequired`. */
|
|
5
7
|
declare const RequiredMarker: ({ size }: RequiredMarkerProps) => import("react").JSX.Element;
|
|
6
8
|
export default RequiredMarker;
|
|
@@ -34,6 +34,7 @@ var StyledRequiredMarker = withTheme(/*#__PURE__*/ styled("span")({
|
|
|
34
34
|
"s1i18c6k-5": [_exp6()]
|
|
35
35
|
}
|
|
36
36
|
}));
|
|
37
|
+
/** The red asterisk marking a required field. Inputs render it from `isRequired`. */
|
|
37
38
|
var RequiredMarker = ({ size = TextSize.BODY_MD }) => {
|
|
38
39
|
return /* @__PURE__ */ jsx(StyledRequiredMarker, {
|
|
39
40
|
$size: size,
|
|
@@ -1,3 +1,7 @@
|
|
|
1
1
|
import type { PropsWithChildren } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* Makes its children selectable. DLS text is `user-select: none` by default so
|
|
4
|
+
* UI chrome doesn't highlight — wrap the parts a user should be able to copy.
|
|
5
|
+
*/
|
|
2
6
|
declare const Selectable: ({ children }: PropsWithChildren) => import("react").JSX.Element;
|
|
3
7
|
export default Selectable;
|
package/dist/text/Selectable.js
CHANGED
|
@@ -8,6 +8,10 @@ var StyledSelectable = withTheme(/*#__PURE__*/ styled("span")({
|
|
|
8
8
|
class: "sfziwh",
|
|
9
9
|
propsAsIs: false
|
|
10
10
|
}));
|
|
11
|
+
/**
|
|
12
|
+
* Makes its children selectable. DLS text is `user-select: none` by default so
|
|
13
|
+
* UI chrome doesn't highlight — wrap the parts a user should be able to copy.
|
|
14
|
+
*/
|
|
11
15
|
var Selectable = ({ children }) => {
|
|
12
16
|
return /* @__PURE__ */ jsx(StyledSelectable, { children });
|
|
13
17
|
};
|
package/dist/text/Text.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { CSSProperties, PropsWithChildren } from "react";
|
|
2
|
+
/** Text color role. Resolves to a `theme.color.text.*` token in both themes. */
|
|
2
3
|
export declare enum TextVariant {
|
|
3
4
|
PRIMARY = "PRIMARY",
|
|
4
5
|
PRIMARY_ALT = "PRIMARY_ALT",
|
|
@@ -18,6 +19,7 @@ export declare enum TextVariant {
|
|
|
18
19
|
PURPLE = "PURPLE",
|
|
19
20
|
DISABLED = "DISABLED"
|
|
20
21
|
}
|
|
22
|
+
/** Type scale step. Sets font-size, line-height and letter-spacing together. */
|
|
21
23
|
export declare enum TextSize {
|
|
22
24
|
CAPTION = "CAPTION",
|
|
23
25
|
BODY_SM = "BODY_SM",
|
|
@@ -27,21 +29,38 @@ export declare enum TextSize {
|
|
|
27
29
|
HEADING_MD = "HEADING_MD",
|
|
28
30
|
HEADING_LG = "HEADING_LG"
|
|
29
31
|
}
|
|
32
|
+
/** Font weight. Two steps by design — hierarchy comes from size, not weight. */
|
|
30
33
|
export declare enum TextWeight {
|
|
31
34
|
REGULAR = "REGULAR",
|
|
32
35
|
MEDIUM = "MEDIUM"
|
|
33
36
|
}
|
|
34
37
|
export interface TextProps {
|
|
38
|
+
/** Color role. @default TextVariant.PRIMARY */
|
|
35
39
|
variant?: TextVariant;
|
|
40
|
+
/** Type scale step. @default TextSize.BODY_MD */
|
|
36
41
|
size?: TextSize;
|
|
42
|
+
/** @default TextWeight.REGULAR */
|
|
37
43
|
weight?: TextWeight;
|
|
44
|
+
/** @default "left" */
|
|
38
45
|
align?: CSSProperties["textAlign"];
|
|
46
|
+
/** Cursor over the text. Inherits from the parent when unset. */
|
|
39
47
|
cursor?: CSSProperties["cursor"];
|
|
48
|
+
/** Raw color that bypasses `variant`. Escape hatch — prefer `variant`. */
|
|
40
49
|
hex?: string;
|
|
50
|
+
/** Render in the mono family (Berkeley Mono) instead of sans. */
|
|
41
51
|
isMonospace?: boolean;
|
|
52
|
+
/** Let the user select the text. Off by default so UI chrome isn't selectable. */
|
|
42
53
|
isSelectable?: boolean;
|
|
43
54
|
isUnderlined?: boolean;
|
|
55
|
+
/** Truncate to one line with an ellipsis. Needs a width-bounded parent. */
|
|
44
56
|
isEllipsis?: boolean;
|
|
45
57
|
}
|
|
58
|
+
/**
|
|
59
|
+
* The text primitive. Every string in a Galaxy UI renders through it, so color,
|
|
60
|
+
* size and weight always resolve from theme tokens rather than raw CSS.
|
|
61
|
+
*
|
|
62
|
+
* Renders a `<p>`. For inline treatments nest `Bold`, `Code`, `Selectable` or
|
|
63
|
+
* `HotKeys` inside it rather than reaching for a raw tag.
|
|
64
|
+
*/
|
|
46
65
|
declare const Text: ({ children, size, variant, weight, align, cursor, isMonospace, isSelectable, isUnderlined, isEllipsis, hex, }: PropsWithChildren<TextProps>) => import("react").JSX.Element;
|
|
47
66
|
export default Text;
|
package/dist/text/Text.js
CHANGED
|
@@ -4,6 +4,7 @@ import { styled } from "@linaria/react";
|
|
|
4
4
|
import { match } from "ts-pattern";
|
|
5
5
|
import { jsx } from "react/jsx-runtime";
|
|
6
6
|
//#region src/text/Text.tsx
|
|
7
|
+
/** Text color role. Resolves to a `theme.color.text.*` token in both themes. */
|
|
7
8
|
var TextVariant = /* @__PURE__ */ function(TextVariant) {
|
|
8
9
|
TextVariant["PRIMARY"] = "PRIMARY";
|
|
9
10
|
TextVariant["PRIMARY_ALT"] = "PRIMARY_ALT";
|
|
@@ -24,6 +25,7 @@ var TextVariant = /* @__PURE__ */ function(TextVariant) {
|
|
|
24
25
|
TextVariant["DISABLED"] = "DISABLED";
|
|
25
26
|
return TextVariant;
|
|
26
27
|
}({});
|
|
28
|
+
/** Type scale step. Sets font-size, line-height and letter-spacing together. */
|
|
27
29
|
var TextSize = /* @__PURE__ */ function(TextSize) {
|
|
28
30
|
TextSize["CAPTION"] = "CAPTION";
|
|
29
31
|
TextSize["BODY_SM"] = "BODY_SM";
|
|
@@ -34,6 +36,7 @@ var TextSize = /* @__PURE__ */ function(TextSize) {
|
|
|
34
36
|
TextSize["HEADING_LG"] = "HEADING_LG";
|
|
35
37
|
return TextSize;
|
|
36
38
|
}({});
|
|
39
|
+
/** Font weight. Two steps by design — hierarchy comes from size, not weight. */
|
|
37
40
|
var TextWeight = /* @__PURE__ */ function(TextWeight) {
|
|
38
41
|
TextWeight["REGULAR"] = "REGULAR";
|
|
39
42
|
TextWeight["MEDIUM"] = "MEDIUM";
|
|
@@ -85,6 +88,13 @@ var StyledText = withTheme(/*#__PURE__*/ styled("p")({
|
|
|
85
88
|
"shbcgkd-13": [_exp15()]
|
|
86
89
|
}
|
|
87
90
|
}));
|
|
91
|
+
/**
|
|
92
|
+
* The text primitive. Every string in a Galaxy UI renders through it, so color,
|
|
93
|
+
* size and weight always resolve from theme tokens rather than raw CSS.
|
|
94
|
+
*
|
|
95
|
+
* Renders a `<p>`. For inline treatments nest `Bold`, `Code`, `Selectable` or
|
|
96
|
+
* `HotKeys` inside it rather than reaching for a raw tag.
|
|
97
|
+
*/
|
|
88
98
|
var Text = ({ children, size = "BODY_MD", variant = "PRIMARY", weight = "REGULAR", align = "left", cursor, isMonospace = false, isSelectable = false, isUnderlined = false, isEllipsis = false, hex }) => {
|
|
89
99
|
return /* @__PURE__ */ jsx(StyledText, {
|
|
90
100
|
$size: size,
|
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
export interface TextShimmerProps {
|
|
2
|
+
/** A number is px. Match the line height of the text being stood in for. */
|
|
2
3
|
height: number | string;
|
|
4
|
+
/** A number is px. */
|
|
3
5
|
width: number | string;
|
|
6
|
+
/** Render square corners instead of the default 4px radius. */
|
|
4
7
|
noBorderRadius?: boolean;
|
|
5
8
|
}
|
|
9
|
+
/**
|
|
10
|
+
* A shimmering placeholder bar for text that hasn't loaded. Size it to the copy
|
|
11
|
+
* it replaces so the layout doesn't jump when the real text arrives.
|
|
12
|
+
*/
|
|
6
13
|
declare const TextShimmer: ({ height, width, noBorderRadius }: TextShimmerProps) => import("react").JSX.Element;
|
|
7
14
|
export default TextShimmer;
|
package/dist/text/TextShimmer.js
CHANGED
|
@@ -19,6 +19,10 @@ var StyledTextShimmer = withTheme(/*#__PURE__*/ styled("span")({
|
|
|
19
19
|
"s1p67zkf-3": [_exp6()]
|
|
20
20
|
}
|
|
21
21
|
}));
|
|
22
|
+
/**
|
|
23
|
+
* A shimmering placeholder bar for text that hasn't loaded. Size it to the copy
|
|
24
|
+
* it replaces so the layout doesn't jump when the real text arrives.
|
|
25
|
+
*/
|
|
22
26
|
var TextShimmer = ({ height, width, noBorderRadius }) => {
|
|
23
27
|
return /* @__PURE__ */ jsx(StyledTextShimmer, {
|
|
24
28
|
$height: height,
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { type PropsWithChildren } from "react";
|
|
2
|
-
import { GalaxyTheme } from "./
|
|
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
|
-
|
|
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 {
|
|
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
|
|
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[];
|
package/dist/theme/constants.js
CHANGED
|
@@ -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:
|
|
17
|
+
id: GalaxyTheme.SYSTEM,
|
|
23
18
|
label: "System",
|
|
24
|
-
value:
|
|
19
|
+
value: GalaxyTheme.SYSTEM
|
|
25
20
|
},
|
|
26
21
|
{
|
|
27
|
-
id:
|
|
22
|
+
id: GalaxyTheme.DARK,
|
|
28
23
|
label: "Dark",
|
|
29
|
-
value:
|
|
24
|
+
value: GalaxyTheme.DARK
|
|
30
25
|
},
|
|
31
26
|
{
|
|
32
|
-
id:
|
|
27
|
+
id: GalaxyTheme.LIGHT,
|
|
33
28
|
label: "Light",
|
|
34
|
-
value:
|
|
29
|
+
value: GalaxyTheme.LIGHT
|
|
35
30
|
}
|
|
36
31
|
];
|
|
37
32
|
var GALAXY_THEME_MAP = {
|
|
38
|
-
[
|
|
39
|
-
[
|
|
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
|
|
38
|
+
export { DEFAULT_THEME, GALAXY_DARK_THEME, GALAXY_LIGHT_THEME, GALAXY_THEME_MAP, GALAXY_THEME_OPTIONS, GALAXY_THEME_STORAGE_KEY };
|
package/dist/theme/index.js
CHANGED
|
@@ -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
|
|
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 };
|
package/dist/theme/types.d.ts
CHANGED
|
@@ -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
|
};
|
package/dist/theme/types.js
CHANGED
|
@@ -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 };
|
package/dist/toast/Toast.d.ts
CHANGED
|
@@ -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;
|
package/dist/toast/Toast.js
CHANGED
|
@@ -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, {
|