@ufoui/core 0.0.12 → 0.0.40
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/assets/icons.d.ts +5 -2
- package/components/accordion/accordion.d.ts +2 -2
- package/components/badge/badge.d.ts +2 -2
- package/components/base/boxBase.d.ts +4 -4
- package/components/base/buttonBase.d.ts +5 -5
- package/components/base/checkboxBase.d.ts +2 -2
- package/components/base/dialogBase.d.ts +105 -9
- package/components/base/fieldBase.d.ts +1 -1
- package/components/card/card.d.ts +2 -2
- package/components/dialogs/dialogActions.d.ts +19 -7
- package/components/dialogs/dialogActions.guards.d.ts +15 -0
- package/components/dialogs/dialogContent.d.ts +7 -1
- package/components/dialogs/dialogHeader.d.ts +60 -0
- package/components/dialogs/dialogTitle.d.ts +9 -5
- package/components/dialogs/index.d.ts +1 -0
- package/components/menu/menu.d.ts +2 -2
- package/components/rating/rating.d.ts +2 -2
- package/components/switch/switch.d.ts +2 -2
- package/components/themeProvider/themeProvider.d.ts +10 -15
- package/components/toolbar/toolbar.d.ts +1 -1
- package/components/tooltip/tooltip.d.ts +2 -2
- package/index.css +1 -1
- package/index.js +2934 -3033
- package/internal/icon/icon.d.ts +28 -0
- package/internal/index.d.ts +1 -0
- package/internal/inlineTooltip/inlineTooltipManager.d.ts +3 -3
- package/internal/slots/slot.d.ts +1 -1
- package/package.json +1 -1
- package/types/dialog.d.ts +37 -0
- package/types/index.d.ts +1 -0
- package/types/motion.d.ts +2 -2
- package/types/theme.d.ts +0 -30
- package/utils/applyThemeTokens.d.ts +10 -0
- package/utils/calculateFloatingPosition.d.ts +3 -3
- package/utils/color.d.ts +78 -131
- package/utils/colorRegistry.d.ts +44 -0
- package/utils/controlStyle.d.ts +8 -8
- package/utils/flatChildren.d.ts +17 -0
- package/utils/generateMaterialColors.d.ts +7 -7
- package/utils/index.d.ts +4 -1
- package/utils/renderPortal.d.ts +30 -0
- package/utils/utils.d.ts +2 -2
- package/utils/generateSchemes.d.ts +0 -32
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { ReactNode, ReactPortal } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Returns the portal host element `#id`, creating it when missing.
|
|
4
|
+
*
|
|
5
|
+
* @remarks
|
|
6
|
+
* If the element is missing, a `div` with the given `id` is appended to `document.body`.
|
|
7
|
+
* The portal mounts **into** that host — `document.body` itself is never used as the
|
|
8
|
+
* direct portal container.
|
|
9
|
+
*
|
|
10
|
+
* @param rootId - `id` of the root node (e.g. `'dialog-root'`).
|
|
11
|
+
*
|
|
12
|
+
* @returns The host element, or `null` when `document` is unavailable (e.g. SSR).
|
|
13
|
+
*
|
|
14
|
+
* @category Utils
|
|
15
|
+
*/
|
|
16
|
+
export declare function ensurePortalRoot(rootId: string): HTMLElement | null;
|
|
17
|
+
/**
|
|
18
|
+
* Renders children into a dedicated portal root, creating that node when absent.
|
|
19
|
+
*
|
|
20
|
+
* @remarks
|
|
21
|
+
* Uses {@link ensurePortalRoot}; returns `null` when the document is not available.
|
|
22
|
+
*
|
|
23
|
+
* @param rootId - `id` of the portal host (e.g. `'dialog-root'`).
|
|
24
|
+
* @param children - Tree to render into the host.
|
|
25
|
+
*
|
|
26
|
+
* @returns A {@link https://react.dev/reference/react-dom/createPortal | React portal}, or `null`.
|
|
27
|
+
*
|
|
28
|
+
* @category Utils
|
|
29
|
+
*/
|
|
30
|
+
export declare function renderPortal(rootId: string, children: ReactNode): ReactPortal | null;
|
package/utils/utils.d.ts
CHANGED
|
@@ -74,7 +74,7 @@ export type ElementElevation = 0 | 1 | 2 | 3 | 4 | 5;
|
|
|
74
74
|
*
|
|
75
75
|
* @category Utils
|
|
76
76
|
*/
|
|
77
|
-
export type
|
|
77
|
+
export type ElementPlacement = 'topLeft' | 'topCenter' | 'topRight' | 'centerLeft' | 'center' | 'centerRight' | 'bottomLeft' | 'bottomCenter' | 'bottomRight' | 'topRightOut' | 'topLeftOut' | 'auto';
|
|
78
78
|
export type ElementDensity = 'comfortable' | 'compact' | 'dense';
|
|
79
79
|
export type ElementFocusEffect = 'ring' | 'overlay';
|
|
80
80
|
export type ElementPressedEffect = 'elevate' | 'overlay' | 'scale';
|
|
@@ -112,7 +112,7 @@ export declare function toKebabCase(str: string): string;
|
|
|
112
112
|
* @category Utils
|
|
113
113
|
*/
|
|
114
114
|
export declare function clampInt(min: number, max: number, value: unknown, fallback?: number): number | undefined;
|
|
115
|
-
export declare const
|
|
115
|
+
export declare const getPlacementClass: (position: ElementPlacement) => string;
|
|
116
116
|
/**
|
|
117
117
|
* Returns the appropriate CSS class for the given shape token.
|
|
118
118
|
*
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { ExtraColorOverrides } from './generateMaterialColors';
|
|
2
|
-
import { PartialThemeSchemes, ThemeSchemes } from '../types';
|
|
3
|
-
/**
|
|
4
|
-
* Generates and injects CSS custom properties for Material Design 3 theme colors.
|
|
5
|
-
*
|
|
6
|
-
* This function calls `generateMaterialColors()` to resolve a complete light/dark
|
|
7
|
-
* `ThemeSchemes` object based on a seed color, optional extra semantic colors
|
|
8
|
-
* (`info`, `warning`, `success`), and optional overrides for individual color tokens.
|
|
9
|
-
*
|
|
10
|
-
* All resolved tokens are converted to CSS variables using kebab-case, e.g.:
|
|
11
|
-
* `--uui-color-primary`, `--uui-color-on-surface`, etc.
|
|
12
|
-
*
|
|
13
|
-
* Light mode tokens are injected into `:root`, dark mode tokens into `.dark`.
|
|
14
|
-
* Variables are injected once into a single `<style>` tag with ID `ufo-ui-theme`.
|
|
15
|
-
*
|
|
16
|
-
* @param seedColor - The base seed color used to generate MD3 tonal palettes.
|
|
17
|
-
* Defaults to `#6750A4` if not provided.
|
|
18
|
-
* @param extraColors - Optional map of base semantic colors for `info`, `warning`, and `success`.
|
|
19
|
-
* These override the default values.
|
|
20
|
-
* @param schemes - Optional overrides for light and dark color tokens.
|
|
21
|
-
* Partial values will be merged with the generated ones.
|
|
22
|
-
*
|
|
23
|
-
* @returns A fully resolved `ThemeSchemes` object containing all tokens for light and dark modes.
|
|
24
|
-
*
|
|
25
|
-
* @example
|
|
26
|
-
* ```ts
|
|
27
|
-
* const schemes = generateSchemes('#6200ee', { info: '#0288d1' }, { light: { primary: '#ff5722' } });
|
|
28
|
-
* ```
|
|
29
|
-
*
|
|
30
|
-
* @category Theme
|
|
31
|
-
*/
|
|
32
|
-
export declare function generateSchemes(seedColor?: string, extraColors?: ExtraColorOverrides, schemes?: PartialThemeSchemes): ThemeSchemes;
|