@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.
Files changed (43) hide show
  1. package/assets/icons.d.ts +5 -2
  2. package/components/accordion/accordion.d.ts +2 -2
  3. package/components/badge/badge.d.ts +2 -2
  4. package/components/base/boxBase.d.ts +4 -4
  5. package/components/base/buttonBase.d.ts +5 -5
  6. package/components/base/checkboxBase.d.ts +2 -2
  7. package/components/base/dialogBase.d.ts +105 -9
  8. package/components/base/fieldBase.d.ts +1 -1
  9. package/components/card/card.d.ts +2 -2
  10. package/components/dialogs/dialogActions.d.ts +19 -7
  11. package/components/dialogs/dialogActions.guards.d.ts +15 -0
  12. package/components/dialogs/dialogContent.d.ts +7 -1
  13. package/components/dialogs/dialogHeader.d.ts +60 -0
  14. package/components/dialogs/dialogTitle.d.ts +9 -5
  15. package/components/dialogs/index.d.ts +1 -0
  16. package/components/menu/menu.d.ts +2 -2
  17. package/components/rating/rating.d.ts +2 -2
  18. package/components/switch/switch.d.ts +2 -2
  19. package/components/themeProvider/themeProvider.d.ts +10 -15
  20. package/components/toolbar/toolbar.d.ts +1 -1
  21. package/components/tooltip/tooltip.d.ts +2 -2
  22. package/index.css +1 -1
  23. package/index.js +2934 -3033
  24. package/internal/icon/icon.d.ts +28 -0
  25. package/internal/index.d.ts +1 -0
  26. package/internal/inlineTooltip/inlineTooltipManager.d.ts +3 -3
  27. package/internal/slots/slot.d.ts +1 -1
  28. package/package.json +1 -1
  29. package/types/dialog.d.ts +37 -0
  30. package/types/index.d.ts +1 -0
  31. package/types/motion.d.ts +2 -2
  32. package/types/theme.d.ts +0 -30
  33. package/utils/applyThemeTokens.d.ts +10 -0
  34. package/utils/calculateFloatingPosition.d.ts +3 -3
  35. package/utils/color.d.ts +78 -131
  36. package/utils/colorRegistry.d.ts +44 -0
  37. package/utils/controlStyle.d.ts +8 -8
  38. package/utils/flatChildren.d.ts +17 -0
  39. package/utils/generateMaterialColors.d.ts +7 -7
  40. package/utils/index.d.ts +4 -1
  41. package/utils/renderPortal.d.ts +30 -0
  42. package/utils/utils.d.ts +2 -2
  43. 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 ElementAlign = 'topLeft' | 'topCenter' | 'topRight' | 'centerLeft' | 'center' | 'centerRight' | 'bottomLeft' | 'bottomCenter' | 'bottomRight' | 'topRightOut' | 'topLeftOut' | 'auto';
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 getAlignClass: (position: ElementAlign) => string;
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;