@ufoui/core 0.0.5 → 0.0.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.
Files changed (57) hide show
  1. package/assets/icons.d.ts +3 -0
  2. package/components/accordion/accordion.d.ts +31 -3
  3. package/components/accordion/accordionItem.d.ts +31 -3
  4. package/components/base/boxBase.d.ts +15 -37
  5. package/components/base/buttonBase.d.ts +1 -1
  6. package/components/base/dialogBase.d.ts +9 -7
  7. package/components/base/fieldBase.d.ts +2 -3
  8. package/components/base/textBase.d.ts +1 -2
  9. package/components/breadcrumbs/breadcrumbs.d.ts +48 -0
  10. package/components/calendar/calendar.d.ts +23 -0
  11. package/components/calendar/calendarUtils.d.ts +18 -0
  12. package/components/collapse/collapse.d.ts +15 -20
  13. package/components/dialogs/dialog.d.ts +1 -1
  14. package/components/dialogs/dialogTitle.d.ts +1 -1
  15. package/components/dialogs/drawer.d.ts +1 -1
  16. package/components/fieldset/fieldset.d.ts +1 -1
  17. package/components/link/link.d.ts +58 -0
  18. package/components/list/list.d.ts +1 -1
  19. package/components/rating/rating.d.ts +68 -0
  20. package/components/slider/slider.d.ts +11 -0
  21. package/components/switch/switch.d.ts +1 -9
  22. package/components/toast/toast.d.ts +18 -4
  23. package/components/toast/toastViewport.d.ts +4 -3
  24. package/components/toolbar/toolbar.d.ts +1 -1
  25. package/context/selectionContext.d.ts +18 -17
  26. package/hooks/index.d.ts +3 -1
  27. package/hooks/useAnimate.d.ts +36 -16
  28. package/hooks/useFocusTrap.d.ts +32 -0
  29. package/hooks/useFocusVisible.d.ts +16 -14
  30. package/hooks/useResizeObserver.d.ts +7 -3
  31. package/hooks/useRovingFocus.d.ts +30 -0
  32. package/hooks/useSelection.d.ts +10 -7
  33. package/hooks/useSelectionState.d.ts +29 -0
  34. package/hooks/useSliderKeys.d.ts +41 -0
  35. package/index.css +1 -1
  36. package/index.d.ts +4 -8
  37. package/index.js +4881 -0
  38. package/internal/controlGrid/controlGrid.d.ts +32 -0
  39. package/internal/controlLabel/controlLabel.d.ts +31 -0
  40. package/internal/description/description.d.ts +18 -0
  41. package/internal/index.d.ts +6 -0
  42. package/internal/inlineTooltip/index.d.ts +1 -0
  43. package/internal/inlineTooltip/inlineTooltipManager.d.ts +1 -1
  44. package/internal/slots/slot.d.ts +44 -0
  45. package/internal/stateLayer/stateLayer.d.ts +33 -0
  46. package/package.json +12 -3
  47. package/utils/color.d.ts +0 -102
  48. package/utils/getWrapperStyle.d.ts +53 -0
  49. package/utils/index.d.ts +1 -0
  50. package/utils/toasts/ensureViewport.d.ts +6 -1
  51. package/utils/toasts/toast.d.ts +66 -10
  52. package/utils/toasts/toastStore.d.ts +55 -1
  53. package/utils/utils.d.ts +65 -53
  54. package/hooks/useFocusState.d.ts +0 -16
  55. package/index.mjs +0 -4649
  56. package/internal/inlineTooltip/inlineTooltip.d.ts +0 -11
  57. package/internal/inlineTooltip/inlineTooltip2.d.ts +0 -10
package/utils/utils.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- import { default as React } from 'react';
2
1
  export type ElementSize = 'extraSmall' | 'small' | 'medium' | 'large' | 'extraLarge';
3
2
  export type ElementInset = 'none' | 'left' | 'right' | 'top' | 'bottom' | 'middle';
4
3
  export type ElementShape = 'square' | 'smooth' | 'rounded' | 'round';
@@ -84,9 +83,50 @@ export type ElementSelectedEffect = 'color' | 'morph' | 'border' | 'overlay';
84
83
  export type ElementTouchEffect = 'ripple';
85
84
  export type ElementFont = 'displayLarge' | 'displayMedium' | 'displaySmall' | 'headlineLarge' | 'headlineMedium' | 'headlineSmall' | 'titleLarge' | 'titleMedium' | 'titleSmall' | 'labelLarge' | 'labelMedium' | 'labelSmall' | 'bodyLarge' | 'bodyMedium' | 'bodySmall' | 'caption' | 'overline';
86
85
  export type ElementTextPlacement = 'start' | 'end' | 'top' | 'bottom';
86
+ /**
87
+ * Converts a camelCase, PascalCase, or acronym-based string into kebab-case.
88
+ *
89
+ * @param str - Input string to convert.
90
+ * @returns The kebab-case version of the string.
91
+ *
92
+ * @example
93
+ * toKebabCase("myVariableName"); // "my-variable-name"
94
+ * toKebabCase("URLParser"); // "url-parser"
95
+ *
96
+ * @category Utils
97
+ */
98
+ export declare function toKebabCase(str: string): string;
99
+ /**
100
+ * Clamps a numeric value to an integer range with a fallback.
101
+ *
102
+ * Converts the input to a number, rounds it to an integer,
103
+ * then clamps it between `min` and `max`.
104
+ * If the value is not a finite number, returns `fallback`.
105
+ *
106
+ * @param min - Minimum allowed value.
107
+ * @param max - Maximum allowed value.
108
+ * @param value - Input value to clamp. Can be any type.
109
+ * @param fallback - Value returned when input is invalid.
110
+ * @returns A clamped integer within the given range.
111
+ *
112
+ * @category Utils
113
+ */
114
+ export declare function clampInt(min: number, max: number, value: unknown, fallback?: number): number | undefined;
87
115
  export declare const getAlignClass: (position: ElementAlign) => string;
88
- export declare const getShapeClass: (shape: ElementShape) => "uui-square" | "uui-smooth" | "uui-rounded" | "uui-round" | "";
89
- export declare const getSizeClass: (size: ElementSize) => "uui-extra-small" | "uui-small" | "uui-medium" | "uui-large" | "uui-extra-large";
116
+ /**
117
+ * Returns the appropriate CSS class for the given shape token.
118
+ *
119
+ * @param shape Shape token.
120
+ * @returns CSS class for shape variant.
121
+ */
122
+ export declare const getShapeClass: (shape?: ElementShape) => string;
123
+ /**
124
+ * Returns the CSS class for the given size token.
125
+ *
126
+ * @param size Size token.
127
+ * @returns CSS class for size variant.
128
+ */
129
+ export declare const getSizeClass: (size: ElementSize) => string;
90
130
  /**
91
131
  * Returns the appropriate CSS class for the given border size.
92
132
  *
@@ -95,14 +135,25 @@ export declare const getSizeClass: (size: ElementSize) => "uui-extra-small" | "u
95
135
  */
96
136
  export declare const getBorderClass: (border?: ElementBorder) => string;
97
137
  /**
98
- * Returns the appropriate CSS class for the given outline size.
138
+ * Returns the appropriate CSS class for the given elevation level.
139
+ *
140
+ * @param elevation Elevation token.
141
+ * @returns CSS class in the form uui-elevation-X.
142
+ */
143
+ export declare const getElevationClass: (elevation?: ElementElevation) => string;
144
+ /**
145
+ * Returns the appropriate CSS class for the given density token.
146
+ *
147
+ * @param density Density token.
148
+ * @returns CSS class for density variant.
149
+ */
150
+ export declare const getDensityClass: (density?: ElementDensity) => string;
151
+ /**
152
+ * Returns the CSS class for the given typography token.
99
153
  *
100
- * @param size - Outline size (0 to 4)
101
- * @returns A class name like 'uui-outline-2'
154
+ * @param font Typography token.
155
+ * @returns CSS class in the form uui-font-<token>.
102
156
  */
103
- export declare const getOutlineClass: (size: ElementBorder) => string;
104
- export declare const getElevationClass: (elevation?: ElementElevation) => "" | "uui-elevation-0" | "uui-elevation-1" | "uui-elevation-2" | "uui-elevation-3" | "uui-elevation-4" | "uui-elevation-5";
105
- export declare const getDensityClass: (density?: ElementDensity) => "" | "uui-compact" | "uui-dense";
106
157
  export declare const getFontClass: (font: ElementFont) => string;
107
158
  /**
108
159
  * Merges multiple React refs into a single ref callback.
@@ -139,52 +190,13 @@ export declare function mergeRefs<T>(...refs: React.Ref<T>[]): React.RefCallback
139
190
  */
140
191
  export declare const createRipple: (el: HTMLElement, event: React.MouseEvent<HTMLElement>, host?: HTMLElement) => void;
141
192
  /**
142
- * Converts a camelCase, PascalCase, or acronym-based string into kebab-case.
143
- *
144
- * @param str - Input string to convert.
145
- * @returns The kebab-case version of the string.
146
- *
147
- * @example
148
- * toKebabCase("myVariableName"); // "my-variable-name"
149
- * toKebabCase("URLParser"); // "url-parser"
150
- *
151
- * @category Utils
152
- */
153
- export declare function toKebabCase(str: string): string;
154
- /**
155
- * Forces focus to behave like :focus-visible on all browsers,
156
- * including Safari which loses :focus-visible heuristics when
157
- * focus is set programmatically (e.g., in menus or lists).
193
+ * Joins class names into a single string.
158
194
  *
159
- * Adds `.uui-focus-visible` to the element on focus, and
160
- * removes it automatically on blur.
195
+ * Accepts strings or arrays of strings and filters out falsy values.
161
196
  *
162
- * Chrome/Firefox:
163
- * - still rely on native :focus-visible
164
- * - fallback class is ignored (lower specificity)
165
- *
166
- * Safari:
167
- * - native :focus-visible is unreliable
168
- * - fallback `.uui-focus-visible` replaces it
169
- *
170
- * @param el - HTMLElement to focus with visible highlighting.
171
- *
172
- * @category Utils
173
- */
174
- export declare function setFocusVisible(el: HTMLElement | null): void;
175
- /**
176
- * Clamps a numeric value to an integer range with a fallback.
177
- *
178
- * Converts the input to a number, rounds it to an integer,
179
- * then clamps it between `min` and `max`.
180
- * If the value is not a finite number, returns `fallback`.
181
- *
182
- * @param min - Minimum allowed value.
183
- * @param max - Maximum allowed value.
184
- * @param value - Input value to clamp. Can be any type.
185
- * @param fallback - Value returned when input is invalid.
186
- * @returns A clamped integer within the given range.
197
+ * @function
198
+ * @param classes Class names to combine.
187
199
  *
188
200
  * @category Utils
189
201
  */
190
- export declare function clampInt(min: number, max: number, value: unknown, fallback?: number): number | undefined;
202
+ export declare function cn(...classes: (string | false | null | undefined | string[])[]): string;
@@ -1,16 +0,0 @@
1
- /**
2
- * Tracks focus state for a DOM element.
3
- *
4
- * Provides technical focus state and visual focus visibility.
5
- * Designed for components that need focus styling without
6
- * interfering with user-provided focus handlers.
7
- *
8
- * @param ref Reference to the target DOM element.
9
- * @returns Object containing focus state flags.
10
- *
11
- * @category Hooks
12
- */
13
- export declare function useFocusState<T extends HTMLElement>(ref: React.RefObject<T>): {
14
- isFocused: boolean;
15
- focusVisible: boolean;
16
- };