@ufoui/core 0.0.2 → 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.
- package/README.md +9 -3
- package/assets/icons.d.ts +8 -0
- package/assets/index.d.ts +1 -0
- package/components/accordion/accordion.d.ts +24 -0
- package/components/accordion/accordionItem.d.ts +37 -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} +32 -3
- package/components/base/{buttonBase/buttonBase.d.ts → buttonBase.d.ts} +1 -2
- package/components/base/{checkboxBase/checkboxBase.d.ts → checkboxBase.d.ts} +2 -3
- package/components/base/{dialogBase/dialog.d.ts → dialogBase.d.ts} +5 -8
- package/components/base/{fieldBase/fieldBase.d.ts → fieldBase.d.ts} +2 -2
- package/components/base/index.d.ts +6 -0
- package/components/base/textBase.d.ts +45 -0
- package/components/button/button.d.ts +1 -1
- package/components/checkbox/checkbox.d.ts +1 -1
- package/components/chip/chip.d.ts +1 -1
- package/components/collapse/collapse.d.ts +38 -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 +2 -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/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/select/select.d.ts +1 -1
- package/components/spinner/spinner.d.ts +1 -1
- package/components/switch/switch.d.ts +1 -2
- 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/themeProvider/themeProvider.d.ts +1 -1
- package/components/toast/index.d.ts +2 -0
- package/components/toast/toast.d.ts +38 -0
- package/components/toast/toastViewport.d.ts +6 -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 +31 -0
- package/context/themeContext.d.ts +2 -2
- package/hooks/index.d.ts +8 -0
- package/hooks/useAnimate.d.ts +2 -2
- package/hooks/useResizeObserver.d.ts +26 -0
- package/hooks/useSelection.d.ts +13 -0
- package/index.css +1 -1
- package/index.d.ts +26 -35
- package/index.mjs +3999 -2554
- package/internal/inlineTooltip/inlineTooltip.d.ts +1 -1
- package/internal/inlineTooltip/inlineTooltipManager.d.ts +2 -2
- package/package.json +1 -1
- package/utils/calculateFloatingPosition.d.ts +1 -1
- package/utils/color.d.ts +2 -92
- package/utils/controlStyle.d.ts +67 -0
- package/utils/generateMaterialColors.d.ts +1 -1
- package/utils/generateSchemes.d.ts +1 -1
- package/utils/index.d.ts +9 -0
- package/utils/{inputhMethod.d.ts → interactionMode.d.ts} +1 -1
- package/utils/toasts/ensureViewport.d.ts +2 -0
- package/utils/toasts/index.d.ts +1 -0
- package/utils/toasts/toast.d.ts +29 -0
- package/utils/toasts/toastStore.d.ts +11 -0
- package/utils/uniqueID.d.ts +14 -0
- package/utils/utils.d.ts +17 -29
- 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/components/{dialog → dialogs}/dialogContent.d.ts +0 -0
|
@@ -5,7 +5,7 @@ interface InlineTooltipProps extends HTMLProps<HTMLSpanElement> {
|
|
|
5
5
|
triggerRef: React.RefObject<HTMLElement>;
|
|
6
6
|
}
|
|
7
7
|
export declare const InlineTooltip: {
|
|
8
|
-
({ id, title, triggerRef }: InlineTooltipProps): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
({ id, title, triggerRef, }: InlineTooltipProps): import("react/jsx-runtime").JSX.Element;
|
|
9
9
|
displayName: string;
|
|
10
10
|
};
|
|
11
11
|
export {};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { default as React, HTMLProps, ReactElement } from 'react';
|
|
2
|
-
import { ElementAlign } from '../../
|
|
2
|
+
import { ElementAlign } from '../../utils';
|
|
3
3
|
interface InlineTooltipManagerProps extends HTMLProps<HTMLSpanElement> {
|
|
4
4
|
triggerRef: React.RefObject<HTMLElement>;
|
|
5
5
|
tooltip: ReactElement;
|
|
6
6
|
align: ElementAlign;
|
|
7
7
|
}
|
|
8
8
|
export declare const InlineTooltipManager: {
|
|
9
|
-
({ tooltip, align, triggerRef }: InlineTooltipManagerProps): React.ReactPortal;
|
|
9
|
+
({ tooltip, align, triggerRef, }: InlineTooltipManagerProps): React.ReactPortal;
|
|
10
10
|
displayName: string;
|
|
11
11
|
};
|
|
12
12
|
export {};
|
package/package.json
CHANGED
package/utils/color.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { ThemeExtendedColorKeys, ThemeSchemeKeys, ThemeSemanticColorKeys, ThemeSurfaceColorKeys } from '../types/index.ts';
|
|
1
|
+
import { ThemeExtendedColorKeys, ThemeSchemeKeys, ThemeSemanticColorKeys, ThemeSurfaceColorKeys } from '../types';
|
|
3
2
|
/**
|
|
4
3
|
* Represents a high-level semantic color token (e.g. `primary`, `error`, `success`).
|
|
5
4
|
* Derived from {@link ThemeSemanticColorKeys}.
|
|
@@ -322,94 +321,5 @@ export declare function getTintOverlayColor(elevation: number, tintColor: string
|
|
|
322
321
|
* @returns Object with fixed color class mappings.
|
|
323
322
|
*/
|
|
324
323
|
export declare const getFixedColorClasses: () => Record<string, string>;
|
|
325
|
-
|
|
326
|
-
* Returns a map of `uui-current-*` classes for the given element color.
|
|
327
|
-
*
|
|
328
|
-
* @param color - The base color name (e.g. 'primary', 'error', etc.)
|
|
329
|
-
* @returns An object with `uui-current-*` class names for various variants.
|
|
330
|
-
*/
|
|
331
|
-
export declare const getCurrentColorClasses: (color: SemanticColor) => {
|
|
332
|
-
[k: string]: `uui-current-${string}` | `uui-current-on-${string}` | `uui-current-${string}-container` | `uui-current-on-${string}-container` | `uui-current-${string}-fixed` | `uui-current-on-${string}-fixed` | `uui-current-${string}-fixed-dim` | `uui-current-on-${string}-fixed-variant`;
|
|
333
|
-
};
|
|
334
|
-
/**
|
|
335
|
-
* Creates a style builder for MD3 color tokens.
|
|
336
|
-
*
|
|
337
|
-
* @remarks
|
|
338
|
-
* The builder provides typed functions for applying theme color tokens
|
|
339
|
-
* to background, text, border, and outline properties using CSS variables.
|
|
340
|
-
*
|
|
341
|
-
* - `bg(color)` — sets background from any ThemeColor
|
|
342
|
-
* - `bg.on(surfaceColor)` — sets background from corresponding `on-*` surface color
|
|
343
|
-
* - `bg.container(semanticColor)` — sets semantic `*-container` background
|
|
344
|
-
* - `bg.onContainer(semanticColor)` — sets semantic `on-*-container` background
|
|
345
|
-
* - `bg.fixed(semanticColor)` — semantic `*-fixed` background
|
|
346
|
-
* - `bg.fixedDim(semanticColor)` — semantic `*-fixed-dim` background
|
|
347
|
-
*
|
|
348
|
-
* - `text(color)` — sets text color from any ThemeColor
|
|
349
|
-
* - `text.on(surfaceColor)` — sets text from `on-*` surface colors
|
|
350
|
-
* - `text.onContainer(semanticColor)` — sets text from semantic `on-*-container`
|
|
351
|
-
*
|
|
352
|
-
* - `border(color)` — sets border-color from any ThemeColor
|
|
353
|
-
* - `outline(color)` — sets outline-color from any ThemeColor
|
|
354
|
-
*
|
|
355
|
-
* The builder accumulates all style operations internally
|
|
356
|
-
* and exposes them via `.get()` as a final React.CSSProperties object.
|
|
357
|
-
*
|
|
358
|
-
* @example
|
|
359
|
-
* const style = ColorStyle();
|
|
360
|
-
* style.bg('surfaceContainerLow');
|
|
361
|
-
* style.text.on('surface');
|
|
362
|
-
* return <button style={style.get()}>Press</button>;
|
|
363
|
-
*/
|
|
364
|
-
/**
|
|
365
|
-
* Creates a strictly typed style builder for MD3 color tokens.
|
|
366
|
-
*
|
|
367
|
-
* @category Color
|
|
368
|
-
*/
|
|
369
|
-
type CSSPropertyKey = Extract<keyof React.CSSProperties, string>;
|
|
370
|
-
type CSSVar = `--${string}`;
|
|
371
|
-
export declare function ControlStyle(initial?: React.CSSProperties): {
|
|
372
|
-
bg: ((color?: ThemeColor) => void) & {
|
|
373
|
-
on(color?: SurfaceColor): void;
|
|
374
|
-
container(color?: SemanticColor): void;
|
|
375
|
-
onContainer(color?: SemanticColor): void;
|
|
376
|
-
fixed(color?: SemanticColor): void;
|
|
377
|
-
fixedDim(color?: SemanticColor): void;
|
|
378
|
-
};
|
|
379
|
-
text: ((color?: ThemeColor) => void) & {
|
|
380
|
-
on(color?: SurfaceColor): void;
|
|
381
|
-
container(color?: SemanticColor): void;
|
|
382
|
-
onContainer(color?: SemanticColor): void;
|
|
383
|
-
fixed(color?: SemanticColor): void;
|
|
384
|
-
fixedDim(color?: SemanticColor): void;
|
|
385
|
-
};
|
|
386
|
-
border: ((color?: ThemeColor) => void) & {
|
|
387
|
-
on(color?: SurfaceColor): void;
|
|
388
|
-
container(color?: SemanticColor): void;
|
|
389
|
-
onContainer(color?: SemanticColor): void;
|
|
390
|
-
fixed(color?: SemanticColor): void;
|
|
391
|
-
fixedDim(color?: SemanticColor): void;
|
|
392
|
-
};
|
|
393
|
-
outline: ((color?: ThemeColor) => void) & {
|
|
394
|
-
on(color?: SurfaceColor): void;
|
|
395
|
-
container(color?: SemanticColor): void;
|
|
396
|
-
onContainer(color?: SemanticColor): void;
|
|
397
|
-
fixed(color?: SemanticColor): void;
|
|
398
|
-
fixedDim(color?: SemanticColor): void;
|
|
399
|
-
};
|
|
400
|
-
current: ((color?: ThemeColor) => void) & {
|
|
401
|
-
on(color?: SurfaceColor): void;
|
|
402
|
-
container(color?: SemanticColor): void;
|
|
403
|
-
onContainer(color?: SemanticColor): void;
|
|
404
|
-
fixed(color?: SemanticColor): void;
|
|
405
|
-
fixedDim(color?: SemanticColor): void;
|
|
406
|
-
};
|
|
407
|
-
set: {
|
|
408
|
-
<K extends CSSPropertyKey>(key: K, value: React.CSSProperties[K]): void;
|
|
409
|
-
(key: CSSVar, value: string): void;
|
|
410
|
-
};
|
|
411
|
-
get(): React.CSSProperties;
|
|
412
|
-
merge(styles?: React.CSSProperties): void;
|
|
413
|
-
};
|
|
324
|
+
export declare function capitalize(s: string): string;
|
|
414
325
|
export declare function getBorderColor(borderColor?: BorderColor): BorderColor;
|
|
415
|
-
export {};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { SemanticColor, SurfaceColor, ThemeColor } from './color';
|
|
3
|
+
/**
|
|
4
|
+
* Creates a strictly typed style builder for MD3 color tokens.
|
|
5
|
+
*
|
|
6
|
+
* @category Color
|
|
7
|
+
*/
|
|
8
|
+
type CSSPropertyKey = Extract<keyof React.CSSProperties, string>;
|
|
9
|
+
type CSSVar = `--${string}`;
|
|
10
|
+
export declare function ControlStyle(initial?: React.CSSProperties): {
|
|
11
|
+
bg: ((color?: ThemeColor) => void) & {
|
|
12
|
+
on(color?: SurfaceColor): void;
|
|
13
|
+
container(color?: SemanticColor): void;
|
|
14
|
+
onContainer(color?: SemanticColor): void;
|
|
15
|
+
fixed(color?: SemanticColor): void;
|
|
16
|
+
fixedDim(color?: SemanticColor): void;
|
|
17
|
+
};
|
|
18
|
+
text: ((color?: ThemeColor) => void) & {
|
|
19
|
+
on(color?: SurfaceColor): void;
|
|
20
|
+
container(color?: SemanticColor): void;
|
|
21
|
+
onContainer(color?: SemanticColor): void;
|
|
22
|
+
fixed(color?: SemanticColor): void;
|
|
23
|
+
fixedDim(color?: SemanticColor): void;
|
|
24
|
+
};
|
|
25
|
+
border: ((color?: ThemeColor) => void) & {
|
|
26
|
+
on(color?: SurfaceColor): void;
|
|
27
|
+
container(color?: SemanticColor): void;
|
|
28
|
+
onContainer(color?: SemanticColor): void;
|
|
29
|
+
fixed(color?: SemanticColor): void;
|
|
30
|
+
fixedDim(color?: SemanticColor): void;
|
|
31
|
+
};
|
|
32
|
+
outline: ((color?: ThemeColor) => void) & {
|
|
33
|
+
on(color?: SurfaceColor): void;
|
|
34
|
+
container(color?: SemanticColor): void;
|
|
35
|
+
onContainer(color?: SemanticColor): void;
|
|
36
|
+
fixed(color?: SemanticColor): void;
|
|
37
|
+
fixedDim(color?: SemanticColor): void;
|
|
38
|
+
};
|
|
39
|
+
current: ((color?: ThemeColor) => void) & {
|
|
40
|
+
on(color?: SurfaceColor): void;
|
|
41
|
+
container(color?: SemanticColor): void;
|
|
42
|
+
onContainer(color?: SemanticColor): void;
|
|
43
|
+
fixed(color?: SemanticColor): void;
|
|
44
|
+
fixedDim(color?: SemanticColor): void;
|
|
45
|
+
};
|
|
46
|
+
stroke: ((color?: ThemeColor) => void) & {
|
|
47
|
+
on(color?: SurfaceColor): void;
|
|
48
|
+
container(color?: SemanticColor): void;
|
|
49
|
+
onContainer(color?: SemanticColor): void;
|
|
50
|
+
fixed(color?: SemanticColor): void;
|
|
51
|
+
fixedDim(color?: SemanticColor): void;
|
|
52
|
+
};
|
|
53
|
+
fill: ((color?: ThemeColor) => void) & {
|
|
54
|
+
on(color?: SurfaceColor): void;
|
|
55
|
+
container(color?: SemanticColor): void;
|
|
56
|
+
onContainer(color?: SemanticColor): void;
|
|
57
|
+
fixed(color?: SemanticColor): void;
|
|
58
|
+
fixedDim(color?: SemanticColor): void;
|
|
59
|
+
};
|
|
60
|
+
set: {
|
|
61
|
+
<K extends CSSPropertyKey>(key: K, value: React.CSSProperties[K]): void;
|
|
62
|
+
(key: CSSVar, value: string): void;
|
|
63
|
+
};
|
|
64
|
+
get(): React.CSSProperties;
|
|
65
|
+
merge(styles?: React.CSSProperties): void;
|
|
66
|
+
};
|
|
67
|
+
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PartialThemeSchemes, ThemeSchemes } from '../types
|
|
1
|
+
import { PartialThemeSchemes, ThemeSchemes } from '../types';
|
|
2
2
|
export type ExtraColorOverrides = Partial<Record<'info' | 'warning' | 'success', string>>;
|
|
3
3
|
/**
|
|
4
4
|
* Generates a full ThemeSchemes object (light and dark modes) based on a seed color,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { PartialThemeSchemes, ThemeSchemes } from '../types/index.ts';
|
|
2
1
|
import { ExtraColorOverrides } from './generateMaterialColors';
|
|
2
|
+
import { PartialThemeSchemes, ThemeSchemes } from '../types';
|
|
3
3
|
/**
|
|
4
4
|
* Generates and injects CSS custom properties for Material Design 3 theme colors.
|
|
5
5
|
*
|
package/utils/index.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from './color';
|
|
2
|
+
export * from './utils';
|
|
3
|
+
export * from './calculateFloatingPosition';
|
|
4
|
+
export * from './interactionMode';
|
|
5
|
+
export * from './generateMaterialColors';
|
|
6
|
+
export * from './generateSchemes';
|
|
7
|
+
export * from './toasts';
|
|
8
|
+
export * from './uniqueID';
|
|
9
|
+
export * from './controlStyle';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './toast';
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { SurfaceColor } from '../index';
|
|
3
|
+
export type ToastStatus = 'success' | 'error' | 'warning' | 'info';
|
|
4
|
+
export interface ToastOptions {
|
|
5
|
+
id?: string;
|
|
6
|
+
title?: string;
|
|
7
|
+
description?: string;
|
|
8
|
+
color?: SurfaceColor;
|
|
9
|
+
status?: ToastStatus;
|
|
10
|
+
icon?: ReactNode;
|
|
11
|
+
action?: ReactNode | ((id: string) => ReactNode);
|
|
12
|
+
duration?: number;
|
|
13
|
+
}
|
|
14
|
+
declare function show(input: string | ToastOptions): string;
|
|
15
|
+
export declare const toast: typeof show & {
|
|
16
|
+
update: (id: string, partial: Partial<ToastOptions>) => void;
|
|
17
|
+
dismiss: (id: string) => void;
|
|
18
|
+
clear: () => void;
|
|
19
|
+
success: (description: string, o?: ToastOptions) => string;
|
|
20
|
+
error: (description: string, o?: ToastOptions) => string;
|
|
21
|
+
info: (description: string, o?: ToastOptions) => string;
|
|
22
|
+
warning: (description: string, o?: ToastOptions) => string;
|
|
23
|
+
promise<T>(p: Promise<T>, m: {
|
|
24
|
+
loading: string;
|
|
25
|
+
success: string | ((v: T) => string);
|
|
26
|
+
error: string | ((e: unknown) => string);
|
|
27
|
+
}): Promise<T>;
|
|
28
|
+
};
|
|
29
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ToastOptions } from './toast';
|
|
2
|
+
export type ToastState = Required<Pick<ToastOptions, 'id'>> & Omit<ToastOptions, 'id'>;
|
|
3
|
+
export type ToastStoreSubscriber = (toasts: ToastState[]) => void;
|
|
4
|
+
export declare const toastStore: {
|
|
5
|
+
subscribe(subscriber: ToastStoreSubscriber): () => void;
|
|
6
|
+
add(toast: ToastState): void;
|
|
7
|
+
update(id: string, partial: Partial<ToastOptions>): void;
|
|
8
|
+
remove(id: string): void;
|
|
9
|
+
clear(): void;
|
|
10
|
+
getState(): ToastState[];
|
|
11
|
+
};
|
|
@@ -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,4 @@
|
|
|
1
|
-
import { default as React
|
|
1
|
+
import { default as React } from 'react';
|
|
2
2
|
export type ElementSize = 'extraSmall' | 'small' | 'medium' | 'large' | 'extraLarge';
|
|
3
3
|
export type ElementInset = 'none' | 'left' | 'right' | 'top' | 'bottom' | 'middle';
|
|
4
4
|
export type ElementShape = 'square' | 'smooth' | 'rounded' | 'round';
|
|
@@ -18,6 +18,22 @@ export type ElementShape = 'square' | 'smooth' | 'rounded' | 'round';
|
|
|
18
18
|
*/
|
|
19
19
|
export type ElementBorder = 0 | 1 | 2 | 3 | 4;
|
|
20
20
|
export type ElementOutline = 0 | 1 | 2 | 3 | 4;
|
|
21
|
+
/**
|
|
22
|
+
* Layout orientation used by axis-based components.
|
|
23
|
+
*
|
|
24
|
+
* @remarks
|
|
25
|
+
* Determines whether a component operates along the vertical
|
|
26
|
+
* (top-to-bottom) or horizontal (left-to-right) axis.
|
|
27
|
+
*
|
|
28
|
+
* Commonly used by components that can render in two directions,
|
|
29
|
+
* such as Collapse, Tabs, Divider, and Accordion.
|
|
30
|
+
*
|
|
31
|
+
* - **vertical** – primary axis is height (Y-axis)
|
|
32
|
+
* - **horizontal** – primary axis is width (X-axis)
|
|
33
|
+
*
|
|
34
|
+
* @category Utils
|
|
35
|
+
*/
|
|
36
|
+
export type ElementOrientation = 'vertical' | 'horizontal';
|
|
21
37
|
/**
|
|
22
38
|
* Elevation (shadow depth) levels used across UUI surfaces.
|
|
23
39
|
*
|
|
@@ -70,7 +86,6 @@ export type ElementFont = 'displayLarge' | 'displayMedium' | 'displaySmall' | 'h
|
|
|
70
86
|
export type ElementTextPlacement = 'start' | 'end' | 'top' | 'bottom';
|
|
71
87
|
export declare const getAlignClass: (position: ElementAlign) => string;
|
|
72
88
|
export declare const getShapeClass: (shape: ElementShape) => "uui-square" | "uui-smooth" | "uui-rounded" | "uui-round" | "";
|
|
73
|
-
export declare const getBodySizeClass: (size: ElementSize) => "uui-font-body-large" | "uui-font-body-medium" | "uui-font-body-small";
|
|
74
89
|
export declare const getSizeClass: (size: ElementSize) => "uui-extra-small" | "uui-small" | "uui-medium" | "uui-large" | "uui-extra-large";
|
|
75
90
|
/**
|
|
76
91
|
* Returns the appropriate CSS class for the given border size.
|
|
@@ -123,20 +138,6 @@ export declare function mergeRefs<T>(...refs: React.Ref<T>[]): React.RefCallback
|
|
|
123
138
|
* @category Utils
|
|
124
139
|
*/
|
|
125
140
|
export declare const createRipple: (el: HTMLElement, event: React.MouseEvent<HTMLElement>, host?: HTMLElement) => void;
|
|
126
|
-
/**
|
|
127
|
-
* Generates a fast, pseudo-random unique ID.
|
|
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
|
/**
|
|
141
142
|
* Converts a camelCase, PascalCase, or acronym-based string into kebab-case.
|
|
142
143
|
*
|
|
@@ -150,19 +151,6 @@ export declare const uniqueID: (prefix: string) => string;
|
|
|
150
151
|
* @category Utils
|
|
151
152
|
*/
|
|
152
153
|
export declare function toKebabCase(str: string): string;
|
|
153
|
-
/**
|
|
154
|
-
* Returns the `displayName` of a React element if available.
|
|
155
|
-
*
|
|
156
|
-
* @param el - A React node to inspect.
|
|
157
|
-
* @returns The component's display name, or `undefined` if not found.
|
|
158
|
-
*
|
|
159
|
-
* @remarks
|
|
160
|
-
* - Works with function components, `memo()`, and `forwardRef()`.
|
|
161
|
-
* - Safe for any `ReactNode` (`string`, `null`, DOM elements, fragments, etc.).
|
|
162
|
-
*
|
|
163
|
-
* @category Utils
|
|
164
|
-
*/
|
|
165
|
-
export declare function getElementDisplayName(el: ReactNode): string | undefined;
|
|
166
154
|
/**
|
|
167
155
|
* Forces focus to behave like :focus-visible on all browsers,
|
|
168
156
|
* including Safari which loses :focus-visible heuristics when
|
|
@@ -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>>;
|
|
File without changes
|