@mich8060/unified-design-system 0.2.8 → 0.2.10
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/LICENSE +21 -0
- package/README.md +11 -0
- package/dist/_virtual/_commonjsHelpers.cjs +1 -0
- package/dist/_virtual/_commonjsHelpers.js +1 -0
- package/dist/_virtual/prism.cjs +1 -0
- package/dist/_virtual/prism.js +1 -0
- package/dist/_virtual/prism2.cjs +1 -0
- package/dist/_virtual/prism2.js +1 -0
- package/dist/assets/svg/comphealth-symbol.svg.cjs +6 -0
- package/dist/assets/svg/comphealth-symbol.svg.js +6 -0
- package/dist/assets/svg/comphealth.svg.cjs +15 -0
- package/dist/assets/svg/comphealth.svg.js +15 -0
- package/dist/assets/svg/connect-symbol.svg.cjs +5 -0
- package/dist/assets/svg/connect-symbol.svg.js +5 -0
- package/dist/assets/svg/connect.svg.cjs +15 -0
- package/dist/assets/svg/connect.svg.js +15 -0
- package/dist/assets/svg/design-system-symbol.svg.cjs +4 -0
- package/dist/assets/svg/design-system-symbol.svg.js +4 -0
- package/dist/assets/svg/design-system.svg.cjs +13 -0
- package/dist/assets/svg/design-system.svg.js +13 -0
- package/dist/assets/svg/locumsmart-symbol.svg.cjs +8 -0
- package/dist/assets/svg/locumsmart-symbol.svg.js +8 -0
- package/dist/assets/svg/locumsmart.svg.cjs +18 -0
- package/dist/assets/svg/locumsmart.svg.js +18 -0
- package/dist/assets/svg/modio-symbol.svg.cjs +4 -0
- package/dist/assets/svg/modio-symbol.svg.js +4 -0
- package/dist/assets/svg/modio.svg.cjs +9 -0
- package/dist/assets/svg/modio.svg.js +9 -0
- package/dist/assets/svg/weatherby-symbol.svg.cjs +5 -0
- package/dist/assets/svg/weatherby-symbol.svg.js +5 -0
- package/dist/assets/svg/weatherby.svg.cjs +14 -0
- package/dist/assets/svg/weatherby.svg.js +14 -0
- package/dist/assets/svg/wireframe-symbol.svg.cjs +7 -0
- package/dist/assets/svg/wireframe-symbol.svg.js +7 -0
- package/dist/assets/svg/wireframe.svg.cjs +17 -0
- package/dist/assets/svg/wireframe.svg.js +17 -0
- package/dist/components/Accordion/Accordion.cjs +1 -0
- package/dist/components/Accordion/Accordion.js +1 -0
- package/dist/components/ActionMenu/ActionMenu.cjs +1 -0
- package/dist/components/ActionMenu/ActionMenu.js +1 -0
- package/dist/components/Avatar/Avatar.cjs +1 -0
- package/dist/components/Avatar/Avatar.js +1 -0
- package/dist/components/Badge/Badge.cjs +1 -0
- package/dist/components/Badge/Badge.js +1 -0
- package/dist/components/Branding/Branding.cjs +1 -0
- package/dist/components/Branding/Branding.js +1 -0
- package/dist/components/Breadcrumb/Breadcrumb.cjs +1 -0
- package/dist/components/Breadcrumb/Breadcrumb.js +1 -0
- package/dist/components/Button/Button.cjs +1 -0
- package/dist/components/Button/Button.js +1 -0
- package/dist/components/Calendar/Calendar.cjs +1 -0
- package/dist/components/Calendar/Calendar.js +1 -0
- package/dist/components/Card/Card.cjs +1 -0
- package/dist/components/Card/Card.js +1 -0
- package/dist/components/Checkbox/Checkbox.cjs +1 -0
- package/dist/components/Checkbox/Checkbox.js +1 -0
- package/dist/components/Chip/Chip.cjs +1 -0
- package/dist/components/Chip/Chip.js +1 -0
- package/dist/components/Code/Code.cjs +1 -0
- package/dist/components/Code/Code.js +1 -0
- package/dist/components/Container/Container.cjs +1 -0
- package/dist/components/Container/Container.js +1 -0
- package/dist/components/Datepicker/Datepicker.cjs +1 -0
- package/dist/components/Datepicker/Datepicker.js +1 -0
- package/dist/components/Dialog/Dialog.cjs +1 -0
- package/dist/components/Dialog/Dialog.js +1 -0
- package/dist/components/Divider/Divider.cjs +1 -0
- package/dist/components/Divider/Divider.js +1 -0
- package/dist/components/DotStatus/DotStatus.cjs +1 -0
- package/dist/components/DotStatus/DotStatus.js +1 -0
- package/dist/components/Dropdown/Dropdown.cjs +1 -0
- package/dist/components/Dropdown/Dropdown.js +1 -0
- package/dist/components/EmptyState/EmptyState.cjs +1 -0
- package/dist/components/EmptyState/EmptyState.js +1 -0
- package/dist/components/EventCard/EventCard.cjs +1 -0
- package/dist/components/EventCard/EventCard.js +1 -0
- package/dist/components/Field/Field.cjs +1 -0
- package/dist/components/Field/Field.js +1 -0
- package/dist/components/FileUpload/FileUpload.cjs +1 -0
- package/dist/components/FileUpload/FileUpload.js +1 -0
- package/dist/components/Flex/Flex.cjs +1 -0
- package/dist/components/Flex/Flex.js +1 -0
- package/dist/components/Icon/Icon.cjs +1 -0
- package/dist/components/Icon/Icon.js +1 -0
- package/dist/components/ImageAspect/ImageAspect.cjs +1 -0
- package/dist/components/ImageAspect/ImageAspect.js +1 -0
- package/dist/components/Key/Key.cjs +1 -0
- package/dist/components/Key/Key.js +1 -0
- package/dist/components/Menu/Menu.cjs +1 -0
- package/dist/components/Menu/Menu.js +1 -0
- package/dist/components/MicroCalendar/MicroCalendar.cjs +1 -0
- package/dist/components/MicroCalendar/MicroCalendar.js +1 -0
- package/dist/components/Modal/Modal.cjs +1 -0
- package/dist/components/Modal/Modal.js +1 -0
- package/dist/components/Pagination/Pagination.cjs +1 -0
- package/dist/components/Pagination/Pagination.js +1 -0
- package/dist/components/PillToggle/PillToggle.cjs +1 -0
- package/dist/components/PillToggle/PillToggle.js +1 -0
- package/dist/components/Playground/Playground.cjs +9 -0
- package/dist/components/Playground/Playground.js +9 -0
- package/dist/components/ProgressCircle/ProgressCircle.cjs +1 -0
- package/dist/components/ProgressCircle/ProgressCircle.js +1 -0
- package/dist/components/ProgressIndicator/ProgressIndicator.cjs +1 -0
- package/dist/components/ProgressIndicator/ProgressIndicator.js +1 -0
- package/dist/components/Radio/Radio.cjs +1 -0
- package/dist/components/Radio/Radio.js +1 -0
- package/dist/components/Slider/Slider.cjs +1 -0
- package/dist/components/Slider/Slider.js +1 -0
- package/dist/components/Status/Status.cjs +1 -0
- package/dist/components/Status/Status.js +1 -0
- package/dist/components/Steps/Steps.cjs +1 -0
- package/dist/components/Steps/Steps.js +1 -0
- package/dist/components/Table/Table.cjs +1 -0
- package/dist/components/Table/Table.js +1 -0
- package/dist/components/Tabs/TabItem.cjs +1 -0
- package/dist/components/Tabs/TabItem.js +1 -0
- package/dist/components/Tabs/Tabs.cjs +1 -0
- package/dist/components/Tabs/Tabs.js +1 -0
- package/dist/components/Tag/Tag.cjs +1 -0
- package/dist/components/Tag/Tag.js +1 -0
- package/dist/components/Text/Text.cjs +1 -0
- package/dist/components/Text/Text.js +1 -0
- package/dist/components/Text/Text.spec.cjs +1 -0
- package/dist/components/Text/Text.spec.js +1 -0
- package/dist/components/TextInput/TextInput.cjs +1 -0
- package/dist/components/TextInput/TextInput.js +1 -0
- package/dist/components/Textarea/Textarea.cjs +1 -0
- package/dist/components/Textarea/Textarea.js +1 -0
- package/dist/components/Toast/Toast.cjs +1 -0
- package/dist/components/Toast/Toast.js +1 -0
- package/dist/components/Toggle/Toggle.cjs +1 -0
- package/dist/components/Toggle/Toggle.js +1 -0
- package/dist/components/Tooltip/Tooltip.cjs +1 -0
- package/dist/components/Tooltip/Tooltip.js +1 -0
- package/dist/constants.cjs +1 -0
- package/dist/constants.js +1 -0
- package/dist/design-system/components/Badge/Badge.d.ts +4 -2
- package/dist/design-system/components/Badge/Badge.types.d.ts +5 -1
- package/dist/design-system/components/Container/Container.d.ts +3 -0
- package/dist/design-system/components/Container/Container.types.d.ts +7 -0
- package/dist/design-system/components/Container/index.d.ts +2 -0
- package/dist/design-system/components/Dropdown/Dropdown.d.ts +4 -1
- package/dist/design-system/components/EmptyState/EmptyState.d.ts +3 -0
- package/dist/design-system/components/EmptyState/EmptyState.types.d.ts +11 -0
- package/dist/design-system/components/EmptyState/index.d.ts +2 -0
- package/dist/design-system/components/Icon/Icon.d.ts +8 -1
- package/dist/design-system/components/Menu/Menu.d.ts +1 -30
- package/dist/design-system/components/Menu/Menu.types.d.ts +2 -0
- package/dist/design-system/components/Modal/Modal.d.ts +3 -1
- package/dist/design-system/components/Table/Table.d.ts +6 -11
- package/dist/design-system/components/Tabs/TabItem.d.ts +4 -2
- package/dist/design-system/components/Tabs/Tabs.d.ts +4 -1
- package/dist/design-system/components/TextInput/index.d.ts +1 -0
- package/dist/design-system/index.d.ts +3 -0
- package/dist/design-system/theme/ThemeProvider.d.ts +13 -0
- package/dist/design-system/theme/createBrand.d.ts +7 -0
- package/dist/design-system/theme/createTheme.d.ts +2 -0
- package/dist/design-system/theme/index.d.ts +4 -0
- package/dist/design-system/theme/theme.types.d.ts +55 -0
- package/dist/index.cjs +1 -162
- package/dist/index.js +1 -6677
- package/dist/node_modules/prismjs/prism.cjs +9 -0
- package/dist/node_modules/prismjs/prism.js +9 -0
- package/dist/src/app-shell/AppShell.cjs +1 -0
- package/dist/src/app-shell/AppShell.js +1 -0
- package/dist/src/app-shell/layout.types.cjs +1 -0
- package/dist/src/app-shell/layout.types.js +1 -0
- package/dist/style.css +1 -0
- package/dist/theme/ThemeProvider.cjs +1 -0
- package/dist/theme/ThemeProvider.js +1 -0
- package/dist/theme/createBrand.cjs +1 -0
- package/dist/theme/createBrand.js +1 -0
- package/dist/theme/createTheme.cjs +1 -0
- package/dist/theme/createTheme.js +1 -0
- package/dist/tokens/color.d.ts +40 -0
- package/dist/tokens/color.js +81 -0
- package/dist/tokens/generateCss.d.ts +2 -0
- package/dist/tokens/generateCss.js +34 -0
- package/dist/tokens/index.d.ts +475 -0
- package/dist/tokens/index.js +29 -0
- package/dist/tokens/motion.d.ts +14 -0
- package/dist/tokens/motion.js +15 -0
- package/dist/tokens/radius.d.ts +14 -0
- package/dist/tokens/radius.js +15 -0
- package/dist/tokens/shadow.d.ts +22 -0
- package/dist/tokens/shadow.js +24 -0
- package/dist/tokens/spacing.d.ts +21 -0
- package/dist/tokens/spacing.js +22 -0
- package/dist/tokens/tokens.css +421 -0
- package/dist/tokens/types.d.ts +21 -0
- package/dist/tokens/types.js +1 -0
- package/dist/tokens/typography.d.ts +87 -0
- package/dist/tokens/typography.js +95 -0
- package/package.json +330 -11
- package/dist/unified-design-system.css +0 -1
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { HTMLAttributes, ReactNode } from "react";
|
|
2
|
+
export type EmptyStateAlign = "left" | "center";
|
|
3
|
+
export interface EmptyStateProps extends HTMLAttributes<HTMLDivElement> {
|
|
4
|
+
title: ReactNode;
|
|
5
|
+
description?: ReactNode;
|
|
6
|
+
icon?: string;
|
|
7
|
+
iconSize?: number;
|
|
8
|
+
action?: ReactNode;
|
|
9
|
+
secondaryAction?: ReactNode;
|
|
10
|
+
align?: EmptyStateAlign;
|
|
11
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import React from "react";
|
|
1
2
|
import "./_icon.scss";
|
|
2
3
|
import type { IconProps } from "./Icon.types";
|
|
3
4
|
/**
|
|
@@ -7,4 +8,10 @@ import type { IconProps } from "./Icon.types";
|
|
|
7
8
|
* @param {string} appearance - Optional: "regular" | "bold" | "thin" | "light" | "duotone" | "fill" (default: "regular")
|
|
8
9
|
* @param {object} props - Additional props to pass to the icon component
|
|
9
10
|
*/
|
|
10
|
-
|
|
11
|
+
declare function Icon({ name, size, appearance, ...props }: IconProps): React.ReactElement<{
|
|
12
|
+
size?: number;
|
|
13
|
+
weight?: string;
|
|
14
|
+
className?: string;
|
|
15
|
+
} & Record<string, unknown>, string | React.JSXElementConstructor<any>> | null;
|
|
16
|
+
declare const _default: React.MemoExoticComponent<typeof Icon>;
|
|
17
|
+
export default _default;
|
|
@@ -1,37 +1,8 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import PropTypes from "prop-types";
|
|
3
2
|
import "./_menu.scss";
|
|
4
3
|
import type { MenuProps } from "./Menu.types";
|
|
5
|
-
declare function Menu({ title, className, navItems, brands, activeBrand, onBrandChange, activeMode, onModeChange, showBrand, showSearch, showBrandSwitcher, showNav, showModeToggle, showUser, userName, userInitials, userAvatarSrc, accountMenuItems, identity, }: MenuProps): import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
declare function Menu({ title, className, navItems, brands, activeBrand, onBrandChange, activeMode, onModeChange, showBrand, showSearch, showBrandSwitcher, showNav, showModeToggle, showUser, userName, userInitials, userAvatarSrc, accountMenuItems, identity, defaultExpanded, }: MenuProps): import("react/jsx-runtime").JSX.Element;
|
|
6
5
|
declare namespace Menu {
|
|
7
|
-
var propTypes: {
|
|
8
|
-
title: PropTypes.Requireable<string>;
|
|
9
|
-
className: PropTypes.Requireable<string>;
|
|
10
|
-
navItems: PropTypes.Requireable<(PropTypes.InferProps<{
|
|
11
|
-
label: PropTypes.Validator<string>;
|
|
12
|
-
icon: PropTypes.Validator<string>;
|
|
13
|
-
path: PropTypes.Requireable<string>;
|
|
14
|
-
children: PropTypes.Requireable<(PropTypes.InferProps<{
|
|
15
|
-
label: PropTypes.Validator<string>;
|
|
16
|
-
path: PropTypes.Validator<string>;
|
|
17
|
-
}> | null | undefined)[]>;
|
|
18
|
-
}> | null | undefined)[]>;
|
|
19
|
-
brands: PropTypes.Requireable<(string | null | undefined)[]>;
|
|
20
|
-
activeBrand: PropTypes.Requireable<string>;
|
|
21
|
-
onBrandChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
22
|
-
activeMode: PropTypes.Requireable<string>;
|
|
23
|
-
onModeChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
24
|
-
showBrand: PropTypes.Requireable<boolean>;
|
|
25
|
-
showSearch: PropTypes.Requireable<boolean>;
|
|
26
|
-
showBrandSwitcher: PropTypes.Requireable<boolean>;
|
|
27
|
-
showNav: PropTypes.Requireable<boolean>;
|
|
28
|
-
showModeToggle: PropTypes.Requireable<boolean>;
|
|
29
|
-
showUser: PropTypes.Requireable<boolean>;
|
|
30
|
-
userName: PropTypes.Requireable<string>;
|
|
31
|
-
userInitials: PropTypes.Requireable<string>;
|
|
32
|
-
userAvatarSrc: PropTypes.Requireable<string>;
|
|
33
|
-
accountMenuItems: PropTypes.Requireable<any[]>;
|
|
34
|
-
};
|
|
35
6
|
var defaultProps: {
|
|
36
7
|
title: string;
|
|
37
8
|
};
|
|
@@ -23,4 +23,6 @@ import type { ModalProps } from "./Modal.types";
|
|
|
23
23
|
* @param {React.ReactNode} children - Modal body content
|
|
24
24
|
* @param {object} props - Additional props spread onto the dialog element
|
|
25
25
|
*/
|
|
26
|
-
|
|
26
|
+
declare function Modal({ open, onClose, title, subtitle, badge, header, footer, size, closeOnBackdrop, closeOnEscape, container, className, children, ...props }: ModalProps): React.ReactPortal | null;
|
|
27
|
+
declare const _default: React.MemoExoticComponent<typeof Modal>;
|
|
28
|
+
export default _default;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import React from "react";
|
|
1
2
|
import "./_table.scss";
|
|
2
3
|
import type { TableProps } from "./Table.types";
|
|
3
4
|
/**
|
|
@@ -8,10 +9,6 @@ import type { TableProps } from "./Table.types";
|
|
|
8
9
|
* @param {object} props - Additional props to pass to the table element
|
|
9
10
|
*/
|
|
10
11
|
declare function Table({ columns, data, className, bodyWeight, ...props }: TableProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
-
declare namespace Table {
|
|
12
|
-
var Cell: typeof TableCell;
|
|
13
|
-
}
|
|
14
|
-
export default Table;
|
|
15
12
|
/**
|
|
16
13
|
* TableCell component - flexible cell that can render different content types
|
|
17
14
|
* @param {string} type - Cell type: 'header' or 'cell'
|
|
@@ -20,10 +17,8 @@ export default Table;
|
|
|
20
17
|
* @param {number} rowIndex - Row index
|
|
21
18
|
* @param {number} colIndex - Column index
|
|
22
19
|
*/
|
|
23
|
-
declare
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
colIndex: any;
|
|
29
|
-
}): import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
declare const TableCell: React.NamedExoticComponent<object>;
|
|
21
|
+
declare const MemoizedTable: typeof Table & {
|
|
22
|
+
Cell: typeof TableCell;
|
|
23
|
+
};
|
|
24
|
+
export default MemoizedTable;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import React from "react";
|
|
1
2
|
interface TabItemProps {
|
|
2
3
|
label?: string | number;
|
|
3
4
|
appearance?: "underline" | "block" | "block-inverted";
|
|
@@ -9,5 +10,6 @@ interface TabItemProps {
|
|
|
9
10
|
onClick?: (...args: unknown[]) => void;
|
|
10
11
|
[key: string]: unknown;
|
|
11
12
|
}
|
|
12
|
-
|
|
13
|
-
|
|
13
|
+
declare function TabItem({ label, active, icon, tag, tagVariant, className, onClick, ...props }: TabItemProps): import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
declare const _default: React.MemoExoticComponent<typeof TabItem>;
|
|
15
|
+
export default _default;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import React from "react";
|
|
1
2
|
import "./_tabs.scss";
|
|
2
3
|
import type { TabsProps } from "./Tabs.types";
|
|
3
4
|
/**
|
|
@@ -12,4 +13,6 @@ import type { TabsProps } from "./Tabs.types";
|
|
|
12
13
|
* @param {string} className - Additional CSS classes
|
|
13
14
|
* @param {object} props - Additional props to pass to the tabs container
|
|
14
15
|
*/
|
|
15
|
-
|
|
16
|
+
declare function Tabs({ tabs, appearance, activeTab, fill, scrollable, onTabChange, className, ...props }: TabsProps): import("react/jsx-runtime").JSX.Element | null;
|
|
17
|
+
declare const _default: React.MemoExoticComponent<typeof Tabs>;
|
|
18
|
+
export default _default;
|
|
@@ -11,11 +11,13 @@ export * from "./components/Card";
|
|
|
11
11
|
export * from "./components/Checkbox";
|
|
12
12
|
export * from "./components/Chip";
|
|
13
13
|
export * from "./components/Code";
|
|
14
|
+
export * from "./components/Container";
|
|
14
15
|
export * from "./components/Datepicker";
|
|
15
16
|
export * from "./components/Dialog";
|
|
16
17
|
export * from "./components/Divider";
|
|
17
18
|
export * from "./components/DotStatus";
|
|
18
19
|
export * from "./components/Dropdown";
|
|
20
|
+
export * from "./components/EmptyState";
|
|
19
21
|
export * from "./components/EventCard";
|
|
20
22
|
export * from "./components/Field";
|
|
21
23
|
export * from "./components/FileUpload";
|
|
@@ -49,3 +51,4 @@ export type { MenuProps, MenuNavItem, MenuChildItem, MenuMode } from "./componen
|
|
|
49
51
|
export { AppShell } from "../app-shell/AppShell";
|
|
50
52
|
export type { AppShellProps, AppShellSlots, AppShellSectionProps } from "../app-shell/AppShell";
|
|
51
53
|
export type { ShellLayoutConfig, ContainerMode, DensityMode, PaddingMode, } from "../app-shell/layout.types";
|
|
54
|
+
export * from "./theme";
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { ColorMode, ResolvedTheme, ThemeController, ThemeEngine } from "./theme.types";
|
|
3
|
+
interface ThemeProviderProps<BrandName extends string> {
|
|
4
|
+
theme: ThemeEngine<BrandName>;
|
|
5
|
+
initialBrand?: BrandName;
|
|
6
|
+
initialMode?: ColorMode;
|
|
7
|
+
target?: HTMLElement | null;
|
|
8
|
+
children: React.ReactNode;
|
|
9
|
+
}
|
|
10
|
+
export declare function ThemeProvider<BrandName extends string>({ theme, initialBrand, initialMode, target, children, }: ThemeProviderProps<BrandName>): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export declare function useThemeController<BrandName extends string = string>(): ThemeController<BrandName>;
|
|
12
|
+
export declare function useTheme<BrandName extends string = string>(): ResolvedTheme<BrandName>;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { BrandDefinition, ColorMode, CssVarMap } from "./theme.types";
|
|
2
|
+
export interface CreateBrandOptions {
|
|
3
|
+
className?: string;
|
|
4
|
+
tokens?: CssVarMap;
|
|
5
|
+
modeTokens?: Partial<Record<ColorMode, CssVarMap>>;
|
|
6
|
+
}
|
|
7
|
+
export declare function createBrand<BrandName extends string>(name: BrandName, options?: CreateBrandOptions): BrandDefinition<BrandName>;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { createBrand } from "./createBrand";
|
|
2
|
+
export { createTheme } from "./createTheme";
|
|
3
|
+
export { ThemeProvider, useTheme, useThemeController } from "./ThemeProvider";
|
|
4
|
+
export type { BrandDefinition, ColorMode, CssVarMap, CssVarName, ModeDefinition, ResolvedTheme, Theme, ThemeController, ThemeDefinition, ThemeEngine, } from "./theme.types";
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
export type CssVarName = `--${string}`;
|
|
2
|
+
export type CssVarMap = Readonly<Record<CssVarName, string>>;
|
|
3
|
+
export type ColorMode = "light" | "dark";
|
|
4
|
+
export interface BrandDefinition<BrandName extends string = string> {
|
|
5
|
+
name: BrandName;
|
|
6
|
+
className: string;
|
|
7
|
+
tokens?: CssVarMap;
|
|
8
|
+
modeTokens?: Partial<Record<ColorMode, CssVarMap>>;
|
|
9
|
+
}
|
|
10
|
+
export interface ModeDefinition {
|
|
11
|
+
name: ColorMode;
|
|
12
|
+
className: string;
|
|
13
|
+
tokens?: CssVarMap;
|
|
14
|
+
}
|
|
15
|
+
export interface ThemeDefinition<BrandName extends string = string> {
|
|
16
|
+
baseTokens?: CssVarMap;
|
|
17
|
+
brands: Record<BrandName, BrandDefinition<BrandName>>;
|
|
18
|
+
modes?: Partial<Record<ColorMode, ModeDefinition>>;
|
|
19
|
+
defaultBrand: BrandName;
|
|
20
|
+
defaultMode?: ColorMode;
|
|
21
|
+
}
|
|
22
|
+
export interface ResolvedTheme<BrandName extends string = string> {
|
|
23
|
+
brand: BrandName;
|
|
24
|
+
mode: ColorMode;
|
|
25
|
+
classNames: {
|
|
26
|
+
brand: string;
|
|
27
|
+
mode: string;
|
|
28
|
+
};
|
|
29
|
+
cssVars: CssVarMap;
|
|
30
|
+
}
|
|
31
|
+
export interface ThemeEngine<BrandName extends string = string> {
|
|
32
|
+
readonly definition: ThemeDefinition<BrandName>;
|
|
33
|
+
resolve(input?: {
|
|
34
|
+
brand?: BrandName;
|
|
35
|
+
mode?: ColorMode;
|
|
36
|
+
overrides?: CssVarMap;
|
|
37
|
+
}): ResolvedTheme<BrandName>;
|
|
38
|
+
applyToElement(element: HTMLElement, theme: ResolvedTheme<BrandName>): void;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Public theme API type returned by createTheme().
|
|
42
|
+
* This alias keeps naming concise for consumers while remaining backwards compatible.
|
|
43
|
+
*/
|
|
44
|
+
export type Theme<BrandName extends string = string> = ThemeEngine<BrandName>;
|
|
45
|
+
export interface ThemeController<BrandName extends string = string> {
|
|
46
|
+
getSnapshot(): ResolvedTheme<BrandName>;
|
|
47
|
+
subscribe(listener: () => void): () => void;
|
|
48
|
+
setBrand(brand: BrandName): void;
|
|
49
|
+
setMode(mode: ColorMode): void;
|
|
50
|
+
setTheme(next: {
|
|
51
|
+
brand?: BrandName;
|
|
52
|
+
mode?: ColorMode;
|
|
53
|
+
}): void;
|
|
54
|
+
setTarget(element: HTMLElement | null): void;
|
|
55
|
+
}
|