@ufoui/core 0.0.4 → 0.0.5

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 (127) hide show
  1. package/README.md +9 -3
  2. package/assets/icons.d.ts +8 -0
  3. package/assets/index.d.ts +1 -0
  4. package/components/accordion/accordion.d.ts +24 -0
  5. package/components/accordion/accordionItem.d.ts +37 -0
  6. package/components/accordion/accordionItem.guards.d.ts +15 -0
  7. package/components/accordion/index.d.ts +2 -0
  8. package/components/avatar/avatar.d.ts +26 -29
  9. package/components/avatar/avatar.guards.d.ts +15 -0
  10. package/components/avatar/avatarGroup.d.ts +29 -0
  11. package/components/avatar/index.d.ts +2 -0
  12. package/components/badge/badge.d.ts +1 -1
  13. package/components/base/{boxBase/boxBase.d.ts → boxBase.d.ts} +32 -3
  14. package/components/base/{buttonBase/buttonBase.d.ts → buttonBase.d.ts} +1 -2
  15. package/components/base/{checkboxBase/checkboxBase.d.ts → checkboxBase.d.ts} +2 -3
  16. package/components/base/{dialogBase/dialog.d.ts → dialogBase.d.ts} +5 -8
  17. package/components/base/{fieldBase/fieldBase.d.ts → fieldBase.d.ts} +2 -2
  18. package/components/base/index.d.ts +6 -0
  19. package/components/base/textBase.d.ts +45 -0
  20. package/components/button/button.d.ts +1 -1
  21. package/components/checkbox/checkbox.d.ts +1 -1
  22. package/components/chip/chip.d.ts +1 -1
  23. package/components/collapse/collapse.d.ts +38 -0
  24. package/components/dialogs/bottomSheet.d.ts +23 -0
  25. package/components/dialogs/dialog.d.ts +21 -0
  26. package/components/{dialog → dialogs}/dialogActions.d.ts +1 -2
  27. package/components/{dialog → dialogs}/dialogTitle.d.ts +1 -2
  28. package/components/dialogs/drawer.d.ts +23 -0
  29. package/components/dialogs/index.d.ts +6 -0
  30. package/components/divider/divider.d.ts +1 -1
  31. package/components/divider/divider.guards.d.ts +1 -1
  32. package/components/fab/fab.d.ts +1 -1
  33. package/components/fields/dateField.d.ts +24 -0
  34. package/components/fields/dateTimeField.d.ts +24 -0
  35. package/components/fields/emailField.d.ts +24 -0
  36. package/components/fields/index.d.ts +11 -0
  37. package/components/fields/monthField.d.ts +24 -0
  38. package/components/fields/numberField.d.ts +24 -0
  39. package/components/fields/passwordField.d.ts +24 -0
  40. package/components/fields/phoneField.d.ts +24 -0
  41. package/components/fields/textField.d.ts +24 -0
  42. package/components/fields/timeField.d.ts +24 -0
  43. package/components/fields/urlField.d.ts +24 -0
  44. package/components/fields/weekField.d.ts +24 -0
  45. package/components/fieldset/fieldset.d.ts +2 -1
  46. package/components/iconButton/iconButton.d.ts +1 -1
  47. package/components/{article → layout}/article.d.ts +1 -1
  48. package/components/{aside → layout}/aside.d.ts +1 -1
  49. package/components/{content → layout}/content.d.ts +1 -1
  50. package/components/{div → layout}/div.d.ts +1 -1
  51. package/components/{flex → layout}/flex.d.ts +1 -1
  52. package/components/{footer → layout}/footer.d.ts +1 -1
  53. package/components/{grid → layout}/grid.d.ts +1 -1
  54. package/components/{header → layout}/header.d.ts +1 -1
  55. package/components/layout/index.d.ts +11 -0
  56. package/components/{main → layout}/main.d.ts +1 -1
  57. package/components/{nav → layout}/nav.d.ts +1 -1
  58. package/components/{section → layout}/section.d.ts +1 -1
  59. package/components/list/list.d.ts +8 -0
  60. package/components/{listItem → list}/listItem.d.ts +2 -3
  61. package/components/{listItem → list}/listItem.guards.d.ts +1 -1
  62. package/components/menu/menu.d.ts +2 -4
  63. package/components/menu/menu.guards.d.ts +1 -1
  64. package/components/menuItem/menuItem.d.ts +2 -3
  65. package/components/menuItem/menuItem.guards.d.ts +1 -1
  66. package/components/option/option.d.ts +1 -1
  67. package/components/option/option.guards.d.ts +1 -1
  68. package/components/progress/progress.d.ts +27 -0
  69. package/components/radio/radio.d.ts +1 -1
  70. package/components/radiogroup/radioGroup.d.ts +1 -1
  71. package/components/select/select.d.ts +1 -1
  72. package/components/switch/switch.d.ts +1 -2
  73. package/components/tabs/index.d.ts +2 -0
  74. package/components/tabs/tab.d.ts +37 -0
  75. package/components/tabs/tab.guards.d.ts +15 -0
  76. package/components/tabs/tabs.d.ts +7 -0
  77. package/components/toast/index.d.ts +2 -0
  78. package/components/toast/toast.d.ts +38 -0
  79. package/components/toast/toastViewport.d.ts +6 -0
  80. package/components/toggleButton/toggleButton.d.ts +1 -1
  81. package/components/toolbar/toolbar.d.ts +51 -0
  82. package/components/tooltip/tooltip.d.ts +1 -1
  83. package/components/typography/h1.d.ts +18 -0
  84. package/components/typography/h2.d.ts +18 -0
  85. package/components/typography/h3.d.ts +18 -0
  86. package/components/typography/h4.d.ts +18 -0
  87. package/components/typography/h5.d.ts +18 -0
  88. package/components/typography/h6.d.ts +18 -0
  89. package/components/typography/index.d.ts +9 -0
  90. package/components/typography/label.d.ts +18 -0
  91. package/components/typography/p.d.ts +18 -0
  92. package/components/typography/span.d.ts +18 -0
  93. package/context/index.d.ts +4 -0
  94. package/context/selectionContext.d.ts +31 -0
  95. package/context/themeContext.d.ts +2 -2
  96. package/hooks/index.d.ts +8 -0
  97. package/hooks/useAnimate.d.ts +2 -2
  98. package/hooks/useResizeObserver.d.ts +26 -0
  99. package/hooks/useSelection.d.ts +13 -0
  100. package/index.css +1 -1
  101. package/index.d.ts +26 -36
  102. package/index.mjs +3818 -3001
  103. package/internal/inlineTooltip/inlineTooltipManager.d.ts +1 -1
  104. package/package.json +1 -1
  105. package/utils/calculateFloatingPosition.d.ts +1 -1
  106. package/utils/color.d.ts +2 -92
  107. package/utils/controlStyle.d.ts +67 -0
  108. package/utils/generateMaterialColors.d.ts +1 -1
  109. package/utils/generateSchemes.d.ts +1 -1
  110. package/utils/index.d.ts +9 -0
  111. package/utils/{inputhMethod.d.ts → interactionMode.d.ts} +1 -1
  112. package/utils/toasts/ensureViewport.d.ts +2 -0
  113. package/utils/toasts/index.d.ts +1 -0
  114. package/utils/toasts/toast.d.ts +29 -0
  115. package/utils/toasts/toastStore.d.ts +11 -0
  116. package/utils/uniqueID.d.ts +14 -0
  117. package/utils/utils.d.ts +17 -29
  118. package/components/base/inlineBase/inlineBase.d.ts +0 -62
  119. package/components/dateInput/dateInput.d.ts +0 -2
  120. package/components/dateTimeInput/dateTimeInput.d.ts +0 -2
  121. package/components/emailInput/emailInput.d.ts +0 -2
  122. package/components/numberInput/numberInput.d.ts +0 -2
  123. package/components/telInput/telInput.d.ts +0 -2
  124. package/components/textField/textField.d.ts +0 -9
  125. package/components/timeInput/timeInput.d.ts +0 -2
  126. package/components/urlInput/urlInput.d.ts +0 -2
  127. /package/components/{dialog → dialogs}/dialogContent.d.ts +0 -0
@@ -0,0 +1,38 @@
1
+ import { default as React, ReactNode } from 'react';
2
+ import { ElementElevation, ElementShape, SurfaceColor } from '../../utils';
3
+ import { BoxBaseProps } from '../base';
4
+ import { ToastStatus } from '../../utils/toasts/toast';
5
+ /**
6
+ * Props for Toast component.
7
+ *
8
+ * @category Toast
9
+ */
10
+ export interface ToastProps extends Omit<BoxBaseProps, 'children'> {
11
+ /** Primary heading text. */
12
+ title?: string;
13
+ /** Secondary supporting text. */
14
+ description?: string;
15
+ /** Surface color token overriding default background and text. */
16
+ color?: SurfaceColor;
17
+ /** Leading visual element. */
18
+ icon?: ReactNode;
19
+ /** Action element rendered below content. */
20
+ action?: ReactNode;
21
+ /** Full content override replacing internal layout. */
22
+ content?: ReactNode;
23
+ /** Elevation token. Default: 3 */
24
+ elevation?: ElementElevation;
25
+ /** Status variant applied as CSS modifier class. */
26
+ status?: ToastStatus;
27
+ /** Shape token. Default: smooth */
28
+ shape?: ElementShape;
29
+ }
30
+ /**
31
+ * Toast overlay container.
32
+ *
33
+ * @function
34
+ * @param props Component props.
35
+ *
36
+ * @category Toast
37
+ */
38
+ export declare const Toast: React.ForwardRefExoticComponent<ToastProps & React.RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,6 @@
1
+ export type ToastPosition = 'top-right' | 'top-left' | 'bottom-right' | 'bottom-left';
2
+ export interface ToastViewportProps {
3
+ position?: ToastPosition;
4
+ gap?: number;
5
+ }
6
+ export declare const ToastViewport: ({ position, gap, }: ToastViewportProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,4 +1,4 @@
1
- import { ButtonBaseProps } from '../../index.ts';
1
+ import { ButtonBaseProps } from '../base/buttonBase';
2
2
  export interface ToggleButtonProps extends Omit<ButtonBaseProps, 'filled' | 'controlClass' | 'iconClass'> {
3
3
  selected?: boolean;
4
4
  iconPosition?: 'start' | 'end';
@@ -0,0 +1,51 @@
1
+ import { default as React } from 'react';
2
+ import { ElementDensity, ElementElevation, ElementOrientation, ElementShape, SurfaceColor } from '../../utils';
3
+ import { BoxBaseProps } from '../base/boxBase';
4
+ /**
5
+ * Props for {@link Toolbar}.
6
+ * Extends {@link BoxBaseProps} except for `component` and `elementClass`.
7
+ *
8
+ * @category Toolbar
9
+ */
10
+ export interface ToolbarProps extends Omit<BoxBaseProps, 'component' | 'elementClass' | 'direction' | 'row' | 'col'> {
11
+ /** Visual variant of the toolbar. */
12
+ variant?: 'docked' | 'floating';
13
+ /** Surface color token applied to container. */
14
+ color?: SurfaceColor;
15
+ /** Elevation token. */
16
+ elevation?: ElementElevation;
17
+ /** Shape token. */
18
+ shape?: ElementShape;
19
+ /** Density token. */
20
+ density?: ElementDensity;
21
+ /** Makes toolbar full width. */
22
+ fullWidth?: boolean;
23
+ /** Positions floating toolbar. */
24
+ placement?: 'top' | 'bottom' | 'left' | 'right' | 'center';
25
+ /** Makes floating toolbar fixed. */
26
+ fixed?: boolean;
27
+ /** Main content area. */
28
+ children?: React.ReactNode;
29
+ /** Adds divider line below toolbar. */
30
+ divider?: boolean;
31
+ orientation?: ElementOrientation;
32
+ /** Additional root class name. */
33
+ className?: string;
34
+ }
35
+ /**
36
+ * Expressive contextual action container based on MD3 Toolbar.
37
+ *
38
+ * Supports docked and floating variants.
39
+ *
40
+ * @function
41
+ * @example
42
+ * <Toolbar
43
+ * variant="floating"
44
+ * >
45
+ * <IconButton />
46
+ * <IconButton />
47
+ * </Toolbar>
48
+ *
49
+ * @category Toolbar
50
+ */
51
+ export declare const Toolbar: React.ForwardRefExoticComponent<ToolbarProps & React.RefAttributes<HTMLDivElement>>;
@@ -1,5 +1,5 @@
1
1
  import { HTMLProps, ReactNode } from 'react';
2
- import { ElementAlign } from '../../utils/utils.ts';
2
+ import { ElementAlign } from '../../utils';
3
3
  export interface TooltipProps extends HTMLProps<HTMLDivElement> {
4
4
  title: string;
5
5
  children?: ReactNode;
@@ -0,0 +1,18 @@
1
+ import { TextBaseProps } from '../base/textBase';
2
+ /**
3
+ * Props for H1.
4
+ * Extends TextBaseProps except component.
5
+ *
6
+ * @category Typography
7
+ */
8
+ export type H1Props = Omit<TextBaseProps, 'component'>;
9
+ /**
10
+ * H1 semantic heading.
11
+ * Renders native h1 element with default headlineLarge font.
12
+ *
13
+ * @function
14
+ * @param props - Typography props.
15
+ *
16
+ * @category Typography
17
+ */
18
+ export declare const H1: import('react').ForwardRefExoticComponent<H1Props & import('react').RefAttributes<HTMLElement>>;
@@ -0,0 +1,18 @@
1
+ import { TextBaseProps } from '../base/textBase';
2
+ /**
3
+ * Props for H2.
4
+ * Extends TextBaseProps except component.
5
+ *
6
+ * @category Typography
7
+ */
8
+ export type H2Props = Omit<TextBaseProps, 'component'>;
9
+ /**
10
+ * H2 semantic heading.
11
+ * Renders native h2 element with default headlineMedium font.
12
+ *
13
+ * @function
14
+ * @param props - Typography props.
15
+ *
16
+ * @category Typography
17
+ */
18
+ export declare const H2: import('react').ForwardRefExoticComponent<H2Props & import('react').RefAttributes<HTMLElement>>;
@@ -0,0 +1,18 @@
1
+ import { TextBaseProps } from '../base/textBase';
2
+ /**
3
+ * Props for H3.
4
+ * Extends TextBaseProps except component.
5
+ *
6
+ * @category Typography
7
+ */
8
+ export type H3Props = Omit<TextBaseProps, 'component'>;
9
+ /**
10
+ * H3 semantic heading.
11
+ * Renders native h3 element with default headlineSmall font.
12
+ *
13
+ * @function
14
+ * @param props - Typography props.
15
+ *
16
+ * @category Typography
17
+ */
18
+ export declare const H3: import('react').ForwardRefExoticComponent<H3Props & import('react').RefAttributes<HTMLElement>>;
@@ -0,0 +1,18 @@
1
+ import { TextBaseProps } from '../base/textBase';
2
+ /**
3
+ * Props for H4.
4
+ * Extends TextBaseProps except component.
5
+ *
6
+ * @category Typography
7
+ */
8
+ export type H4Props = Omit<TextBaseProps, 'component'>;
9
+ /**
10
+ * H4 semantic heading.
11
+ * Renders native h4 element with default titleLarge font.
12
+ *
13
+ * @function
14
+ * @param props - Typography props.
15
+ *
16
+ * @category Typography
17
+ */
18
+ export declare const H4: import('react').ForwardRefExoticComponent<H4Props & import('react').RefAttributes<HTMLElement>>;
@@ -0,0 +1,18 @@
1
+ import { TextBaseProps } from '../base/textBase';
2
+ /**
3
+ * Props for H5.
4
+ * Extends TextBaseProps except component.
5
+ *
6
+ * @category Typography
7
+ */
8
+ export type H5Props = Omit<TextBaseProps, 'component'>;
9
+ /**
10
+ * H5 semantic heading.
11
+ * Renders native h5 element with default titleMedium font.
12
+ *
13
+ * @function
14
+ * @param props - Typography props.
15
+ *
16
+ * @category Typography
17
+ */
18
+ export declare const H5: import('react').ForwardRefExoticComponent<H5Props & import('react').RefAttributes<HTMLElement>>;
@@ -0,0 +1,18 @@
1
+ import { TextBaseProps } from '../base/textBase';
2
+ /**
3
+ * Props for H6.
4
+ * Extends TextBaseProps except component.
5
+ *
6
+ * @category Typography
7
+ */
8
+ export type H6Props = Omit<TextBaseProps, 'component'>;
9
+ /**
10
+ * H6 semantic heading.
11
+ * Renders native h6 element with default titleSmall font.
12
+ *
13
+ * @function
14
+ * @param props - Typography props.
15
+ *
16
+ * @category Typography
17
+ */
18
+ export declare const H6: import('react').ForwardRefExoticComponent<H6Props & import('react').RefAttributes<HTMLElement>>;
@@ -0,0 +1,9 @@
1
+ export * from './h1';
2
+ export * from './h2';
3
+ export * from './h3';
4
+ export * from './h4';
5
+ export * from './h5';
6
+ export * from './h6';
7
+ export * from './p';
8
+ export * from './span';
9
+ export * from './label';
@@ -0,0 +1,18 @@
1
+ import { TextBaseProps } from '../base/textBase';
2
+ /**
3
+ * Props for Label.
4
+ * Extends TextBaseProps except component.
5
+ *
6
+ * @category Typography
7
+ */
8
+ export type LabelProps = Omit<TextBaseProps, 'component'>;
9
+ /**
10
+ * Label semantic text.
11
+ * Renders native label element with default labelLarge font.
12
+ *
13
+ * @function
14
+ * @param props - Typography props.
15
+ *
16
+ * @category Typography
17
+ */
18
+ export declare const Label: import('react').ForwardRefExoticComponent<LabelProps & import('react').RefAttributes<HTMLElement>>;
@@ -0,0 +1,18 @@
1
+ import { TextBaseProps } from '../base/textBase';
2
+ /**
3
+ * Props for P.
4
+ * Extends TextBaseProps except component.
5
+ *
6
+ * @category Typography
7
+ */
8
+ export type PProps = Omit<TextBaseProps, 'component'>;
9
+ /**
10
+ * P semantic paragraph.
11
+ * Renders native p element.
12
+ *
13
+ * @function
14
+ * @param props - Typography props.
15
+ *
16
+ * @category Typography
17
+ */
18
+ export declare const P: import('react').ForwardRefExoticComponent<PProps & import('react').RefAttributes<HTMLElement>>;
@@ -0,0 +1,18 @@
1
+ import { TextBaseProps } from '../base/textBase';
2
+ /**
3
+ * Props for Span.
4
+ * Extends TextBaseProps except component.
5
+ *
6
+ * @category Typography
7
+ */
8
+ export type SpanProps = Omit<TextBaseProps, 'component'>;
9
+ /**
10
+ * Span semantic inline text wrapper.
11
+ * Renders native span element.
12
+ *
13
+ * @function
14
+ * @param props - Typography props.
15
+ *
16
+ * @category Typography
17
+ */
18
+ export declare const Span: import('react').ForwardRefExoticComponent<SpanProps & import('react').RefAttributes<HTMLElement>>;
@@ -0,0 +1,4 @@
1
+ export * from './radioGroupContext';
2
+ export * from './fieldsetContext';
3
+ export * from './selectionContext';
4
+ export * from './themeContext';
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Context value shared by components that rely on selection behavior.
3
+ *
4
+ * Provides state and control logic for managing single or multiple
5
+ * selected values.
6
+ *
7
+ * @category Contexts
8
+ */
9
+ export interface SelectionContextValue {
10
+ /** Currently selected values. */
11
+ values: string[];
12
+ /** Selection mode: single or multiple. */
13
+ mode: 'single' | 'multiple';
14
+ /** Toggles selection state for a given value. */
15
+ toggle: (value: string) => void;
16
+ /** Sets a value directly (primarily for single mode). */
17
+ set: (value: string) => void;
18
+ /** Clears all selected values. */
19
+ clear: () => void;
20
+ }
21
+ /**
22
+ * SelectionContext provides access to shared selection state.
23
+ *
24
+ * Used by components such as Accordion, Tabs, RadioGroup,
25
+ * and similar patterns that require controlled selection logic.
26
+ *
27
+ * Returns `null` if used outside a provider.
28
+ *
29
+ * @category Contexts
30
+ */
31
+ export declare const SelectionContext: import('react').Context<SelectionContextValue | null>;
@@ -1,5 +1,5 @@
1
- import { Theme } from '../types/index.ts';
2
- import { ThemeColor } from '../index.ts';
1
+ import { Theme } from '../types';
2
+ import { ThemeColor } from '../utils';
3
3
  /**
4
4
  * Provides shape for the theme context shared across the application.
5
5
  * Allows reading and updating theme configuration and resolving token values.
@@ -0,0 +1,8 @@
1
+ export * from './useAnimate';
2
+ export * from './useClickOutside';
3
+ export * from './useEscapeHandler';
4
+ export * from './useFocusState';
5
+ export * from './useFocusVisible';
6
+ export * from './useResizeObserver';
7
+ export * from './useSelection';
8
+ export * from './useTheme';
@@ -10,8 +10,8 @@ export interface UseAnimateOptions {
10
10
  t2?: number;
11
11
  /** Enables one-shot animation behavior. */
12
12
  oneShot?: boolean;
13
- /** One-time start command executed on mount. */
14
- action?: 'idle' | 'open' | 'close';
13
+ /** Initial phase on mount. */
14
+ initial?: 'idle' | 'open' | 'closed';
15
15
  }
16
16
  /**
17
17
  * Result returned by the useAnimate hook.
@@ -0,0 +1,26 @@
1
+ import { RefObject } from 'react';
2
+ /**
3
+ * Size information reported by ResizeObserver.
4
+ *
5
+ * @category Hooks
6
+ */
7
+ export interface ObservedElementSize {
8
+ /** Element width in pixels. */
9
+ width: number;
10
+ /** Element height in pixels. */
11
+ height: number;
12
+ }
13
+ /**
14
+ * Observes a single DOM element using ResizeObserver
15
+ * and invokes a callback when its content box size changes.
16
+ *
17
+ * Does not trigger component re-render.
18
+ *
19
+ * @function
20
+ * @param ref Reference to the observed HTMLElement.
21
+ * @param onResize Called when size changes.
22
+ * @param enabled Enables or disables observation. Default: true.
23
+ *
24
+ * @category Hooks
25
+ */
26
+ export declare function useResizeObserver<T extends HTMLElement>(ref: RefObject<T>, onResize: (size: ObservedElementSize) => void, enabled?: boolean): void;
@@ -0,0 +1,13 @@
1
+ import { SelectionContextValue } from '../context/selectionContext';
2
+ /**
3
+ * Hook to access the current selection context.
4
+ *
5
+ * Must be used within a component that provides SelectionContext.
6
+ * If used outside, it will throw an error.
7
+ *
8
+ * @throws Error if the context is unavailable.
9
+ * @returns The current SelectionContextValue.
10
+ *
11
+ * @category Hooks
12
+ */
13
+ export declare function useSelection(): SelectionContextValue;