@ufoui/core 0.0.4 → 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.
- package/README.md +9 -3
- package/assets/icons.d.ts +11 -0
- package/assets/index.d.ts +1 -0
- package/components/accordion/accordion.d.ts +52 -0
- package/components/accordion/accordionItem.d.ts +65 -0
- package/components/accordion/accordionItem.guards.d.ts +15 -0
- package/components/accordion/index.d.ts +2 -0
- package/components/avatar/avatar.d.ts +26 -29
- package/components/avatar/avatar.guards.d.ts +15 -0
- package/components/avatar/avatarGroup.d.ts +29 -0
- package/components/avatar/index.d.ts +2 -0
- package/components/badge/badge.d.ts +1 -1
- package/components/base/{boxBase/boxBase.d.ts → boxBase.d.ts} +18 -11
- package/components/base/{buttonBase/buttonBase.d.ts → buttonBase.d.ts} +2 -3
- package/components/base/{checkboxBase/checkboxBase.d.ts → checkboxBase.d.ts} +2 -3
- package/components/base/dialogBase.d.ts +34 -0
- package/components/base/{fieldBase/fieldBase.d.ts → fieldBase.d.ts} +2 -3
- package/components/base/index.d.ts +6 -0
- package/components/base/textBase.d.ts +44 -0
- package/components/breadcrumbs/breadcrumbs.d.ts +48 -0
- package/components/button/button.d.ts +1 -1
- package/components/calendar/calendar.d.ts +23 -0
- package/components/calendar/calendarUtils.d.ts +18 -0
- package/components/checkbox/checkbox.d.ts +1 -1
- package/components/chip/chip.d.ts +1 -1
- package/components/collapse/collapse.d.ts +33 -0
- package/components/dialogs/bottomSheet.d.ts +23 -0
- package/components/dialogs/dialog.d.ts +21 -0
- package/components/{dialog → dialogs}/dialogActions.d.ts +1 -2
- package/components/{dialog → dialogs}/dialogTitle.d.ts +2 -3
- package/components/dialogs/drawer.d.ts +23 -0
- package/components/dialogs/index.d.ts +6 -0
- package/components/divider/divider.d.ts +1 -1
- package/components/divider/divider.guards.d.ts +1 -1
- package/components/fab/fab.d.ts +1 -1
- package/components/fields/dateField.d.ts +24 -0
- package/components/fields/dateTimeField.d.ts +24 -0
- package/components/fields/emailField.d.ts +24 -0
- package/components/fields/index.d.ts +11 -0
- package/components/fields/monthField.d.ts +24 -0
- package/components/fields/numberField.d.ts +24 -0
- package/components/fields/passwordField.d.ts +24 -0
- package/components/fields/phoneField.d.ts +24 -0
- package/components/fields/textField.d.ts +24 -0
- package/components/fields/timeField.d.ts +24 -0
- package/components/fields/urlField.d.ts +24 -0
- package/components/fields/weekField.d.ts +24 -0
- package/components/fieldset/fieldset.d.ts +2 -1
- package/components/iconButton/iconButton.d.ts +1 -1
- package/components/{article → layout}/article.d.ts +1 -1
- package/components/{aside → layout}/aside.d.ts +1 -1
- package/components/{content → layout}/content.d.ts +1 -1
- package/components/{div → layout}/div.d.ts +1 -1
- package/components/{flex → layout}/flex.d.ts +1 -1
- package/components/{footer → layout}/footer.d.ts +1 -1
- package/components/{grid → layout}/grid.d.ts +1 -1
- package/components/{header → layout}/header.d.ts +1 -1
- package/components/layout/index.d.ts +11 -0
- package/components/{main → layout}/main.d.ts +1 -1
- package/components/{nav → layout}/nav.d.ts +1 -1
- package/components/{section → layout}/section.d.ts +1 -1
- package/components/link/link.d.ts +58 -0
- package/components/list/list.d.ts +8 -0
- package/components/{listItem → list}/listItem.d.ts +2 -3
- package/components/{listItem → list}/listItem.guards.d.ts +1 -1
- package/components/menu/menu.d.ts +2 -4
- package/components/menu/menu.guards.d.ts +1 -1
- package/components/menuItem/menuItem.d.ts +2 -3
- package/components/menuItem/menuItem.guards.d.ts +1 -1
- package/components/option/option.d.ts +1 -1
- package/components/option/option.guards.d.ts +1 -1
- package/components/progress/progress.d.ts +27 -0
- package/components/radio/radio.d.ts +1 -1
- package/components/radiogroup/radioGroup.d.ts +1 -1
- package/components/rating/rating.d.ts +68 -0
- package/components/select/select.d.ts +1 -1
- package/components/slider/slider.d.ts +11 -0
- package/components/switch/switch.d.ts +1 -10
- package/components/tabs/index.d.ts +2 -0
- package/components/tabs/tab.d.ts +37 -0
- package/components/tabs/tab.guards.d.ts +15 -0
- package/components/tabs/tabs.d.ts +7 -0
- package/components/toast/index.d.ts +2 -0
- package/components/toast/toast.d.ts +52 -0
- package/components/toast/toastViewport.d.ts +7 -0
- package/components/toggleButton/toggleButton.d.ts +1 -1
- package/components/toolbar/toolbar.d.ts +51 -0
- package/components/tooltip/tooltip.d.ts +1 -1
- package/components/typography/h1.d.ts +18 -0
- package/components/typography/h2.d.ts +18 -0
- package/components/typography/h3.d.ts +18 -0
- package/components/typography/h4.d.ts +18 -0
- package/components/typography/h5.d.ts +18 -0
- package/components/typography/h6.d.ts +18 -0
- package/components/typography/index.d.ts +9 -0
- package/components/typography/label.d.ts +18 -0
- package/components/typography/p.d.ts +18 -0
- package/components/typography/span.d.ts +18 -0
- package/context/index.d.ts +4 -0
- package/context/selectionContext.d.ts +32 -0
- package/context/themeContext.d.ts +2 -2
- package/hooks/index.d.ts +10 -0
- package/hooks/useAnimate.d.ts +38 -18
- package/hooks/useFocusTrap.d.ts +32 -0
- package/hooks/useFocusVisible.d.ts +16 -14
- package/hooks/useResizeObserver.d.ts +30 -0
- package/hooks/useRovingFocus.d.ts +30 -0
- package/hooks/useSelection.d.ts +16 -0
- package/hooks/useSelectionState.d.ts +29 -0
- package/hooks/useSliderKeys.d.ts +41 -0
- package/index.css +1 -1
- package/index.d.ts +22 -36
- package/index.js +4881 -0
- package/internal/controlGrid/controlGrid.d.ts +32 -0
- package/internal/controlLabel/controlLabel.d.ts +31 -0
- package/internal/description/description.d.ts +18 -0
- package/internal/index.d.ts +6 -0
- package/internal/inlineTooltip/index.d.ts +1 -0
- package/internal/inlineTooltip/inlineTooltipManager.d.ts +2 -2
- package/internal/slots/slot.d.ts +44 -0
- package/internal/stateLayer/stateLayer.d.ts +33 -0
- package/package.json +12 -3
- package/utils/calculateFloatingPosition.d.ts +1 -1
- package/utils/color.d.ts +2 -194
- package/utils/controlStyle.d.ts +67 -0
- package/utils/generateMaterialColors.d.ts +1 -1
- package/utils/generateSchemes.d.ts +1 -1
- package/utils/getWrapperStyle.d.ts +53 -0
- package/utils/index.d.ts +10 -0
- package/utils/{inputhMethod.d.ts → interactionMode.d.ts} +1 -1
- package/utils/toasts/ensureViewport.d.ts +7 -0
- package/utils/toasts/index.d.ts +1 -0
- package/utils/toasts/toast.d.ts +85 -0
- package/utils/toasts/toastStore.d.ts +65 -0
- package/utils/uniqueID.d.ts +14 -0
- package/utils/utils.d.ts +81 -81
- package/components/base/dialogBase/dialog.d.ts +0 -35
- package/components/base/inlineBase/inlineBase.d.ts +0 -62
- package/components/dateInput/dateInput.d.ts +0 -2
- package/components/dateTimeInput/dateTimeInput.d.ts +0 -2
- package/components/emailInput/emailInput.d.ts +0 -2
- package/components/numberInput/numberInput.d.ts +0 -2
- package/components/telInput/telInput.d.ts +0 -2
- package/components/textField/textField.d.ts +0 -9
- package/components/timeInput/timeInput.d.ts +0 -2
- package/components/urlInput/urlInput.d.ts +0 -2
- package/hooks/useFocusState.d.ts +0 -16
- package/index.mjs +0 -3832
- package/internal/inlineTooltip/inlineTooltip.d.ts +0 -11
- package/internal/inlineTooltip/inlineTooltip2.d.ts +0 -10
- /package/components/{dialog → dialogs}/dialogContent.d.ts +0 -0
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { SurfaceColor } from '../index';
|
|
3
|
+
/**
|
|
4
|
+
* Status variant applied to a toast.
|
|
5
|
+
*
|
|
6
|
+
* @category Toast
|
|
7
|
+
*/
|
|
8
|
+
export type ToastStatus = 'success' | 'error' | 'warning' | 'info';
|
|
9
|
+
/**
|
|
10
|
+
* Options used to create or update a toast.
|
|
11
|
+
*
|
|
12
|
+
* @category Toast
|
|
13
|
+
*/
|
|
14
|
+
export interface ToastOptions {
|
|
15
|
+
/** Action element rendered inside the toast. */
|
|
16
|
+
action?: ReactNode | ((id: string) => ReactNode);
|
|
17
|
+
/** Surface color token overriding background and text colors. */
|
|
18
|
+
color?: SurfaceColor;
|
|
19
|
+
/** Full custom content replacing default layout. */
|
|
20
|
+
content?: ReactNode;
|
|
21
|
+
/** Supporting message text. */
|
|
22
|
+
description?: string;
|
|
23
|
+
/** Leading visual element such as an icon. */
|
|
24
|
+
icon?: ReactNode;
|
|
25
|
+
/** Optional identifier. Generated automatically if not provided. */
|
|
26
|
+
id?: string;
|
|
27
|
+
/** Priority toasts appear before normal queued toasts. */
|
|
28
|
+
priority?: boolean;
|
|
29
|
+
/** Status variant applied as CSS modifier class. */
|
|
30
|
+
status?: ToastStatus;
|
|
31
|
+
/** Time in milliseconds before the toast is automatically dismissed. */
|
|
32
|
+
timeout?: number;
|
|
33
|
+
/** Primary heading text. */
|
|
34
|
+
title?: string;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Message descriptor used by promise helper.
|
|
38
|
+
*
|
|
39
|
+
* @category Toast
|
|
40
|
+
*/
|
|
41
|
+
type ToastPromiseMessage<T> = string | ToastOptions | ((v: T) => string | ToastOptions);
|
|
42
|
+
/**
|
|
43
|
+
* Creates and displays a toast.
|
|
44
|
+
*
|
|
45
|
+
* Accepts either a message string or a ToastOptions object.
|
|
46
|
+
*
|
|
47
|
+
* @function
|
|
48
|
+
*/
|
|
49
|
+
declare function show(input: string | ToastOptions): string;
|
|
50
|
+
/**
|
|
51
|
+
* Toast API used to create, update and manage notifications.
|
|
52
|
+
*
|
|
53
|
+
* @category Toast
|
|
54
|
+
*/
|
|
55
|
+
export declare const toast: typeof show & {
|
|
56
|
+
/** Updates an existing toast. */
|
|
57
|
+
update: (id: string, partial: import('./toastStore').ToastUpdate) => void;
|
|
58
|
+
/** Removes a toast by id. */
|
|
59
|
+
dismiss: (id: string) => void;
|
|
60
|
+
/** Removes all toasts. */
|
|
61
|
+
clear: () => void;
|
|
62
|
+
/** Creates a success toast. */
|
|
63
|
+
success: (description: string, o?: ToastOptions) => string;
|
|
64
|
+
/** Creates an error toast. */
|
|
65
|
+
error: (description: string, o?: ToastOptions) => string;
|
|
66
|
+
/** Creates an informational toast. */
|
|
67
|
+
info: (description: string, o?: ToastOptions) => string;
|
|
68
|
+
/** Creates a warning toast. */
|
|
69
|
+
warning: (description: string, o?: ToastOptions) => string;
|
|
70
|
+
/**
|
|
71
|
+
* Displays toast lifecycle bound to a promise.
|
|
72
|
+
*
|
|
73
|
+
* Promise toasts use priority so the user immediately
|
|
74
|
+
* sees feedback for the triggered action.
|
|
75
|
+
*
|
|
76
|
+
* @category Toast
|
|
77
|
+
* @function
|
|
78
|
+
*/
|
|
79
|
+
promise<T>(p: Promise<T>, m: {
|
|
80
|
+
loading: ToastPromiseMessage<void>;
|
|
81
|
+
success: ToastPromiseMessage<T>;
|
|
82
|
+
error: ToastPromiseMessage<unknown>;
|
|
83
|
+
}): Promise<T>;
|
|
84
|
+
};
|
|
85
|
+
export {};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { ToastOptions } from './toast';
|
|
2
|
+
/**
|
|
3
|
+
* Internal toast state stored in the toast store.
|
|
4
|
+
*
|
|
5
|
+
* @category Toast
|
|
6
|
+
*/
|
|
7
|
+
export type ToastState = Required<Pick<ToastOptions, 'id'>> & Omit<ToastOptions, 'id'>;
|
|
8
|
+
/**
|
|
9
|
+
* Partial update object used when modifying a toast.
|
|
10
|
+
*
|
|
11
|
+
* @category Toast
|
|
12
|
+
*/
|
|
13
|
+
export type ToastUpdate = Partial<Omit<ToastOptions, 'id'>>;
|
|
14
|
+
/**
|
|
15
|
+
* Subscriber function receiving current toast list.
|
|
16
|
+
*
|
|
17
|
+
* @category Toast
|
|
18
|
+
*/
|
|
19
|
+
export type ToastStoreSubscriber = (toasts: ToastState[]) => void;
|
|
20
|
+
/**
|
|
21
|
+
* Internal store managing toast lifecycle and subscriptions.
|
|
22
|
+
*
|
|
23
|
+
* @category Toast
|
|
24
|
+
*/
|
|
25
|
+
export declare const toastStore: {
|
|
26
|
+
/**
|
|
27
|
+
* Subscribes to toast state updates.
|
|
28
|
+
*
|
|
29
|
+
* @function
|
|
30
|
+
*/
|
|
31
|
+
subscribe(subscriber: ToastStoreSubscriber): () => void;
|
|
32
|
+
/**
|
|
33
|
+
* Adds a new toast to the store.
|
|
34
|
+
*
|
|
35
|
+
* Priority toasts are inserted at the beginning
|
|
36
|
+
* so they appear before normal queued toasts.
|
|
37
|
+
*
|
|
38
|
+
* @function
|
|
39
|
+
*/
|
|
40
|
+
add(toast: ToastState): void;
|
|
41
|
+
/**
|
|
42
|
+
* Updates an existing toast.
|
|
43
|
+
*
|
|
44
|
+
* @function
|
|
45
|
+
*/
|
|
46
|
+
update(id: string, partial: ToastUpdate): void;
|
|
47
|
+
/**
|
|
48
|
+
* Removes a toast from the store.
|
|
49
|
+
*
|
|
50
|
+
* @function
|
|
51
|
+
*/
|
|
52
|
+
remove(id: string): void;
|
|
53
|
+
/**
|
|
54
|
+
* Removes all toasts.
|
|
55
|
+
*
|
|
56
|
+
* @function
|
|
57
|
+
*/
|
|
58
|
+
clear(): void;
|
|
59
|
+
/**
|
|
60
|
+
* Returns current toast list snapshot.
|
|
61
|
+
*
|
|
62
|
+
* @function
|
|
63
|
+
*/
|
|
64
|
+
getState(): ToastState[];
|
|
65
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generates a fast, pseudo-random unique ID.
|
|
3
|
+
*
|
|
4
|
+
* @param prefix - String prepended to the generated ID.
|
|
5
|
+
* @returns A unique ID in the form `${prefix}_xxxx`.
|
|
6
|
+
*
|
|
7
|
+
* @remarks
|
|
8
|
+
* - Uses `Math.random()` → extremely fast, ideal for UI/runtime IDs.
|
|
9
|
+
* - Not cryptographically secure.
|
|
10
|
+
* - Suitable for components, form fields, ripple effects, etc.
|
|
11
|
+
*
|
|
12
|
+
* @category Utils
|
|
13
|
+
*/
|
|
14
|
+
export declare const uniqueID: (prefix: string) => string;
|
package/utils/utils.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { default as React, ReactNode } 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';
|
|
@@ -18,6 +17,22 @@ export type ElementShape = 'square' | 'smooth' | 'rounded' | 'round';
|
|
|
18
17
|
*/
|
|
19
18
|
export type ElementBorder = 0 | 1 | 2 | 3 | 4;
|
|
20
19
|
export type ElementOutline = 0 | 1 | 2 | 3 | 4;
|
|
20
|
+
/**
|
|
21
|
+
* Layout orientation used by axis-based components.
|
|
22
|
+
*
|
|
23
|
+
* @remarks
|
|
24
|
+
* Determines whether a component operates along the vertical
|
|
25
|
+
* (top-to-bottom) or horizontal (left-to-right) axis.
|
|
26
|
+
*
|
|
27
|
+
* Commonly used by components that can render in two directions,
|
|
28
|
+
* such as Collapse, Tabs, Divider, and Accordion.
|
|
29
|
+
*
|
|
30
|
+
* - **vertical** – primary axis is height (Y-axis)
|
|
31
|
+
* - **horizontal** – primary axis is width (X-axis)
|
|
32
|
+
*
|
|
33
|
+
* @category Utils
|
|
34
|
+
*/
|
|
35
|
+
export type ElementOrientation = 'vertical' | 'horizontal';
|
|
21
36
|
/**
|
|
22
37
|
* Elevation (shadow depth) levels used across UUI surfaces.
|
|
23
38
|
*
|
|
@@ -68,10 +83,50 @@ export type ElementSelectedEffect = 'color' | 'morph' | 'border' | 'overlay';
|
|
|
68
83
|
export type ElementTouchEffect = 'ripple';
|
|
69
84
|
export type ElementFont = 'displayLarge' | 'displayMedium' | 'displaySmall' | 'headlineLarge' | 'headlineMedium' | 'headlineSmall' | 'titleLarge' | 'titleMedium' | 'titleSmall' | 'labelLarge' | 'labelMedium' | 'labelSmall' | 'bodyLarge' | 'bodyMedium' | 'bodySmall' | 'caption' | 'overline';
|
|
70
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;
|
|
71
115
|
export declare const getAlignClass: (position: ElementAlign) => string;
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
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;
|
|
75
130
|
/**
|
|
76
131
|
* Returns the appropriate CSS class for the given border size.
|
|
77
132
|
*
|
|
@@ -80,14 +135,25 @@ export declare const getSizeClass: (size: ElementSize) => "uui-extra-small" | "u
|
|
|
80
135
|
*/
|
|
81
136
|
export declare const getBorderClass: (border?: ElementBorder) => string;
|
|
82
137
|
/**
|
|
83
|
-
* Returns the appropriate CSS class for the given
|
|
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.
|
|
84
153
|
*
|
|
85
|
-
* @param
|
|
86
|
-
* @returns
|
|
154
|
+
* @param font Typography token.
|
|
155
|
+
* @returns CSS class in the form uui-font-<token>.
|
|
87
156
|
*/
|
|
88
|
-
export declare const getOutlineClass: (size: ElementBorder) => string;
|
|
89
|
-
export declare const getElevationClass: (elevation?: ElementElevation) => "" | "uui-elevation-0" | "uui-elevation-1" | "uui-elevation-2" | "uui-elevation-3" | "uui-elevation-4" | "uui-elevation-5";
|
|
90
|
-
export declare const getDensityClass: (density?: ElementDensity) => "" | "uui-compact" | "uui-dense";
|
|
91
157
|
export declare const getFontClass: (font: ElementFont) => string;
|
|
92
158
|
/**
|
|
93
159
|
* Merges multiple React refs into a single ref callback.
|
|
@@ -124,79 +190,13 @@ export declare function mergeRefs<T>(...refs: React.Ref<T>[]): React.RefCallback
|
|
|
124
190
|
*/
|
|
125
191
|
export declare const createRipple: (el: HTMLElement, event: React.MouseEvent<HTMLElement>, host?: HTMLElement) => void;
|
|
126
192
|
/**
|
|
127
|
-
*
|
|
128
|
-
*
|
|
129
|
-
* @param prefix - String prepended to the generated ID.
|
|
130
|
-
* @returns A unique ID in the form `${prefix}_xxxx`.
|
|
131
|
-
*
|
|
132
|
-
* @remarks
|
|
133
|
-
* - Uses `Math.random()` → extremely fast, ideal for UI/runtime IDs.
|
|
134
|
-
* - Not cryptographically secure.
|
|
135
|
-
* - Suitable for components, form fields, ripple effects, etc.
|
|
136
|
-
*
|
|
137
|
-
* @category Utils
|
|
138
|
-
*/
|
|
139
|
-
export declare const uniqueID: (prefix: string) => string;
|
|
140
|
-
/**
|
|
141
|
-
* Converts a camelCase, PascalCase, or acronym-based string into kebab-case.
|
|
142
|
-
*
|
|
143
|
-
* @param str - Input string to convert.
|
|
144
|
-
* @returns The kebab-case version of the string.
|
|
145
|
-
*
|
|
146
|
-
* @example
|
|
147
|
-
* toKebabCase("myVariableName"); // "my-variable-name"
|
|
148
|
-
* toKebabCase("URLParser"); // "url-parser"
|
|
149
|
-
*
|
|
150
|
-
* @category Utils
|
|
151
|
-
*/
|
|
152
|
-
export declare function toKebabCase(str: string): string;
|
|
153
|
-
/**
|
|
154
|
-
* Returns the `displayName` of a React element if available.
|
|
193
|
+
* Joins class names into a single string.
|
|
155
194
|
*
|
|
156
|
-
*
|
|
157
|
-
* @returns The component's display name, or `undefined` if not found.
|
|
195
|
+
* Accepts strings or arrays of strings and filters out falsy values.
|
|
158
196
|
*
|
|
159
|
-
* @
|
|
160
|
-
*
|
|
161
|
-
* - Safe for any `ReactNode` (`string`, `null`, DOM elements, fragments, etc.).
|
|
197
|
+
* @function
|
|
198
|
+
* @param classes Class names to combine.
|
|
162
199
|
*
|
|
163
200
|
* @category Utils
|
|
164
201
|
*/
|
|
165
|
-
export declare function
|
|
166
|
-
/**
|
|
167
|
-
* Forces focus to behave like :focus-visible on all browsers,
|
|
168
|
-
* including Safari which loses :focus-visible heuristics when
|
|
169
|
-
* focus is set programmatically (e.g., in menus or lists).
|
|
170
|
-
*
|
|
171
|
-
* Adds `.uui-focus-visible` to the element on focus, and
|
|
172
|
-
* removes it automatically on blur.
|
|
173
|
-
*
|
|
174
|
-
* Chrome/Firefox:
|
|
175
|
-
* - still rely on native :focus-visible
|
|
176
|
-
* - fallback class is ignored (lower specificity)
|
|
177
|
-
*
|
|
178
|
-
* Safari:
|
|
179
|
-
* - native :focus-visible is unreliable
|
|
180
|
-
* - fallback `.uui-focus-visible` replaces it
|
|
181
|
-
*
|
|
182
|
-
* @param el - HTMLElement to focus with visible highlighting.
|
|
183
|
-
*
|
|
184
|
-
* @category Utils
|
|
185
|
-
*/
|
|
186
|
-
export declare function setFocusVisible(el: HTMLElement | null): void;
|
|
187
|
-
/**
|
|
188
|
-
* Clamps a numeric value to an integer range with a fallback.
|
|
189
|
-
*
|
|
190
|
-
* Converts the input to a number, rounds it to an integer,
|
|
191
|
-
* then clamps it between `min` and `max`.
|
|
192
|
-
* If the value is not a finite number, returns `fallback`.
|
|
193
|
-
*
|
|
194
|
-
* @param min - Minimum allowed value.
|
|
195
|
-
* @param max - Maximum allowed value.
|
|
196
|
-
* @param value - Input value to clamp. Can be any type.
|
|
197
|
-
* @param fallback - Value returned when input is invalid.
|
|
198
|
-
* @returns A clamped integer within the given range.
|
|
199
|
-
*
|
|
200
|
-
* @category Utils
|
|
201
|
-
*/
|
|
202
|
-
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,35 +0,0 @@
|
|
|
1
|
-
import { default as React, ReactNode } from 'react';
|
|
2
|
-
import { ElementElevation, ElementOutline, ElementShape, ElementSize } from '../../../utils/utils.ts';
|
|
3
|
-
import { MotionAnimation, MotionStyle } from '../../../types/index.ts';
|
|
4
|
-
import { BorderColor, SurfaceColor } from '../../../utils/color';
|
|
5
|
-
export type DialogType = 'basic' | 'fullscreen' | 'dockRight' | 'dockLeft' | 'dockTop' | 'dockBottom';
|
|
6
|
-
export type DialogAnimation = 'auto' | 'none' | MotionAnimation;
|
|
7
|
-
export interface DialogProps {
|
|
8
|
-
open: boolean;
|
|
9
|
-
onClose?: () => void;
|
|
10
|
-
type?: DialogType;
|
|
11
|
-
color?: SurfaceColor;
|
|
12
|
-
elevation?: ElementElevation;
|
|
13
|
-
size?: ElementSize;
|
|
14
|
-
shape?: ElementShape;
|
|
15
|
-
border?: ElementOutline;
|
|
16
|
-
borderColor?: BorderColor;
|
|
17
|
-
animation?: DialogAnimation;
|
|
18
|
-
duration?: number;
|
|
19
|
-
disableBackdropClose?: boolean;
|
|
20
|
-
disableEscapeKey?: boolean;
|
|
21
|
-
children?: ReactNode;
|
|
22
|
-
className?: string;
|
|
23
|
-
motionStyle?: MotionStyle;
|
|
24
|
-
modal?: boolean;
|
|
25
|
-
title?: string;
|
|
26
|
-
actions?: ReactNode[];
|
|
27
|
-
icon?: ReactNode;
|
|
28
|
-
showCloseButton?: boolean;
|
|
29
|
-
showHandle?: boolean;
|
|
30
|
-
autoFocus?: boolean;
|
|
31
|
-
}
|
|
32
|
-
export declare const Dialog: {
|
|
33
|
-
({ open, onClose, type, color, elevation, shape, border, borderColor, size, animation, duration, disableBackdropClose, disableEscapeKey, children, className, motionStyle, modal, }: DialogProps): React.ReactPortal | null;
|
|
34
|
-
displayName: string;
|
|
35
|
-
};
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import { default as React, HTMLAttributes, ReactNode } from 'react';
|
|
2
|
-
import { ElementBorder, ElementElevation, ElementFont, ElementShape } from '../../../utils/utils.ts';
|
|
3
|
-
import { BorderColor, SurfaceColor } from '../../../utils/color';
|
|
4
|
-
/**
|
|
5
|
-
* Props for {@link InlineBase}.
|
|
6
|
-
*
|
|
7
|
-
* @remarks
|
|
8
|
-
* Defines visual and typographic styling for inline-level elements
|
|
9
|
-
* without imposing any layout behaviour.
|
|
10
|
-
*
|
|
11
|
-
* @category Inline
|
|
12
|
-
*/
|
|
13
|
-
export interface InlineBaseProps extends Omit<HTMLAttributes<HTMLElement>, 'color'> {
|
|
14
|
-
/** Custom HTML element/component. Default: `span`. */
|
|
15
|
-
component?: React.ElementType;
|
|
16
|
-
/** Font token controlling typography (size, weight, line-height). */
|
|
17
|
-
font?: ElementFont;
|
|
18
|
-
/** Surface background token. */
|
|
19
|
-
color?: SurfaceColor;
|
|
20
|
-
/** Elevation level (0–5). */
|
|
21
|
-
elevation?: ElementElevation;
|
|
22
|
-
/** Shape/border-radius token. */
|
|
23
|
-
shape?: ElementShape;
|
|
24
|
-
/** Border width (0–5). */
|
|
25
|
-
border?: ElementBorder;
|
|
26
|
-
/** Border color token. */
|
|
27
|
-
borderColor?: BorderColor;
|
|
28
|
-
/** Renders as `inline-block` instead of `inline`. */
|
|
29
|
-
inlineBlock?: boolean;
|
|
30
|
-
/** Semantic UUI element class (e.g. 'uui-text', 'uui-heading'). */
|
|
31
|
-
elementClass?: string;
|
|
32
|
-
/** Inline content. */
|
|
33
|
-
children?: ReactNode;
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* `InlineBase` — core primitive for inline semantic components.
|
|
37
|
-
*
|
|
38
|
-
* Provides typography, color, border, shape and elevation styling
|
|
39
|
-
* for inline-level elements without introducing layout semantics.
|
|
40
|
-
*
|
|
41
|
-
* Intended as a foundation for components such as `Text`, `Heading`,
|
|
42
|
-
* `Label`, `Code`, or inline UI tokens.
|
|
43
|
-
*
|
|
44
|
-
* @category Inline
|
|
45
|
-
* @function
|
|
46
|
-
* @param props - Inline styling and typography props.
|
|
47
|
-
*
|
|
48
|
-
* @example
|
|
49
|
-
* ```tsx
|
|
50
|
-
* <InlineBase font="bodyMedium">
|
|
51
|
-
* Inline text
|
|
52
|
-
* </InlineBase>
|
|
53
|
-
* ```
|
|
54
|
-
*
|
|
55
|
-
* @example
|
|
56
|
-
* ```tsx
|
|
57
|
-
* <InlineBase component="h2" font="headlineSmall">
|
|
58
|
-
* Section title
|
|
59
|
-
* </InlineBase>
|
|
60
|
-
* ```
|
|
61
|
-
*/
|
|
62
|
-
export declare const InlineBase: React.ForwardRefExoticComponent<InlineBaseProps & React.RefAttributes<HTMLElement>>;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { FieldBaseProps } from '../../index.ts';
|
|
2
|
-
/**
|
|
3
|
-
* Props for {@link TextField}.
|
|
4
|
-
* Extends {@link FieldBaseProps}.
|
|
5
|
-
*
|
|
6
|
-
* @category Field
|
|
7
|
-
*/
|
|
8
|
-
export type FieldProps = Omit<FieldBaseProps, 'elementClass'>;
|
|
9
|
-
export declare const TextField: import('react').ForwardRefExoticComponent<FieldProps & import('react').RefAttributes<HTMLInputElement>>;
|
package/hooks/useFocusState.d.ts
DELETED
|
@@ -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
|
-
};
|