@ufoui/core 0.0.1
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/LICENSE +150 -0
- package/README.md +37 -0
- package/TRADEMARK.md +10 -0
- package/components/article/article.d.ts +25 -0
- package/components/aside/aside.d.ts +27 -0
- package/components/avatar/avatar.d.ts +35 -0
- package/components/badge/badge.d.ts +57 -0
- package/components/base/boxBase/boxBase.d.ts +126 -0
- package/components/base/buttonBase/buttonBase.d.ts +126 -0
- package/components/base/checkboxBase/checkboxBase.d.ts +124 -0
- package/components/base/dialogBase/dialog.d.ts +35 -0
- package/components/base/fieldBase/fieldBase.d.ts +50 -0
- package/components/base/inlineBase/inlineBase.d.ts +62 -0
- package/components/button/button.d.ts +24 -0
- package/components/card/card.d.ts +15 -0
- package/components/checkbox/checkbox.d.ts +31 -0
- package/components/chip/chip.d.ts +7 -0
- package/components/content/content.d.ts +28 -0
- package/components/dateInput/dateInput.d.ts +2 -0
- package/components/dateTimeInput/dateTimeInput.d.ts +2 -0
- package/components/dialog/dialogActions.d.ts +15 -0
- package/components/dialog/dialogContent.d.ts +9 -0
- package/components/dialog/dialogTitle.d.ts +16 -0
- package/components/div/div.d.ts +29 -0
- package/components/divider/divider.d.ts +70 -0
- package/components/divider/divider.guards.d.ts +15 -0
- package/components/emailInput/emailInput.d.ts +2 -0
- package/components/fab/fab.d.ts +29 -0
- package/components/fieldset/fieldset.d.ts +45 -0
- package/components/flex/flex.d.ts +36 -0
- package/components/footer/footer.d.ts +27 -0
- package/components/grid/grid.d.ts +38 -0
- package/components/header/header.d.ts +27 -0
- package/components/iconButton/iconButton.d.ts +27 -0
- package/components/listItem/listItem.d.ts +179 -0
- package/components/listItem/listItem.guards.d.ts +15 -0
- package/components/main/main.d.ts +27 -0
- package/components/menu/menu.d.ts +177 -0
- package/components/menu/menu.guards.d.ts +15 -0
- package/components/menuItem/menuItem.d.ts +179 -0
- package/components/menuItem/menuItem.guards.d.ts +15 -0
- package/components/nav/nav.d.ts +27 -0
- package/components/numberInput/numberInput.d.ts +2 -0
- package/components/option/option.d.ts +6 -0
- package/components/option/option.guards.d.ts +16 -0
- package/components/radio/radio.d.ts +31 -0
- package/components/radiogroup/radioGroup.d.ts +47 -0
- package/components/section/section.d.ts +27 -0
- package/components/select/select.d.ts +32 -0
- package/components/spinner/spinner.d.ts +7 -0
- package/components/switch/switch.d.ts +102 -0
- package/components/telInput/telInput.d.ts +2 -0
- package/components/textField/textField.d.ts +9 -0
- package/components/themeProvider/themeProvider.d.ts +54 -0
- package/components/timeInput/timeInput.d.ts +2 -0
- package/components/toggleButton/toggleButton.d.ts +6 -0
- package/components/tooltip/tooltip.d.ts +8 -0
- package/components/urlInput/urlInput.d.ts +2 -0
- package/context/fieldsetContext.d.ts +22 -0
- package/context/radioGroupContext.d.ts +28 -0
- package/context/themeContext.d.ts +61 -0
- package/hooks/useAnimate.d.ts +55 -0
- package/hooks/useClickOutside.d.ts +36 -0
- package/hooks/useEscapeHandler.d.ts +1 -0
- package/hooks/useFocusState.d.ts +16 -0
- package/hooks/useFocusVisible.d.ts +20 -0
- package/hooks/useTheme.d.ts +12 -0
- package/index.css +1 -0
- package/index.d.ts +53 -0
- package/index.mjs +3300 -0
- package/internal/inlineTooltip/inlineTooltip.d.ts +11 -0
- package/internal/inlineTooltip/inlineTooltip2.d.ts +10 -0
- package/internal/inlineTooltip/inlineTooltipManager.d.ts +12 -0
- package/package.json +38 -0
- package/types/index.d.ts +2 -0
- package/types/motion.d.ts +17 -0
- package/types/theme.d.ts +246 -0
- package/utils/calculateFloatingPosition.d.ts +68 -0
- package/utils/color.d.ts +415 -0
- package/utils/generateMaterialColors.d.ts +31 -0
- package/utils/generateSchemes.d.ts +32 -0
- package/utils/inputhMethod.d.ts +17 -0
- package/utils/utils.d.ts +202 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
9
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
10
|
+
|
|
11
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
12
|
+
the copyright owner that is granting the License.
|
|
13
|
+
|
|
14
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
15
|
+
other entities that control, are controlled by, or are under common
|
|
16
|
+
control with that entity. For the purposes of this definition,
|
|
17
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
18
|
+
direction or management of such entity, whether by contract or
|
|
19
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
20
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
21
|
+
|
|
22
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
23
|
+
exercising permissions granted by this License.
|
|
24
|
+
|
|
25
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
26
|
+
including but not limited to software source code, documentation
|
|
27
|
+
source, and configuration files.
|
|
28
|
+
|
|
29
|
+
"Object" form shall mean any form resulting from mechanical
|
|
30
|
+
transformation or translation of a Source form, including but
|
|
31
|
+
not limited to compiled object code, generated documentation,
|
|
32
|
+
and conversions to other media types.
|
|
33
|
+
|
|
34
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
35
|
+
Object form, made available under the License, as indicated by a
|
|
36
|
+
copyright notice that is included in or attached to the work
|
|
37
|
+
(an example is provided in the Appendix below).
|
|
38
|
+
|
|
39
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
40
|
+
form, that is based on (or derived from) the Work and for which the
|
|
41
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
42
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
43
|
+
of this License, Derivative Works shall not include works that remain
|
|
44
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
45
|
+
the Work and Derivative Works thereof.
|
|
46
|
+
|
|
47
|
+
"Contribution" shall mean any work of authorship, including
|
|
48
|
+
the original version of the Work and any modifications or additions
|
|
49
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
50
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
51
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
52
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
53
|
+
means any form of electronic, verbal, or written communication sent
|
|
54
|
+
to the Licensor or its representatives, including but not limited to
|
|
55
|
+
communication on electronic mailing lists, source code control systems,
|
|
56
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
57
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
58
|
+
excluding communication that is conspicuously marked or otherwise
|
|
59
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
60
|
+
|
|
61
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
62
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
63
|
+
subsequently incorporated within the Work.
|
|
64
|
+
|
|
65
|
+
2. Grant of Copyright License.
|
|
66
|
+
Subject to the terms and conditions of this License, each Contributor
|
|
67
|
+
hereby grants to You a perpetual, worldwide, non-exclusive, no-charge,
|
|
68
|
+
royalty-free, irrevocable copyright license to reproduce, prepare
|
|
69
|
+
Derivative Works of, publicly display, publicly perform, sublicense,
|
|
70
|
+
and distribute the Work and such Derivative Works in Source or Object
|
|
71
|
+
form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License.
|
|
74
|
+
Subject to the terms and conditions of this License, each Contributor
|
|
75
|
+
hereby grants to You a perpetual, worldwide, non-exclusive, no-charge,
|
|
76
|
+
royalty-free, irrevocable (except as stated in this section) patent
|
|
77
|
+
license to make, have made, use, offer to sell, sell, import, and
|
|
78
|
+
otherwise transfer the Work, where such license applies only to those
|
|
79
|
+
patent claims licensable by such Contributor that are necessarily
|
|
80
|
+
infringed by their Contribution(s) alone or by combination of their
|
|
81
|
+
Contribution(s) with the Work to which such Contribution(s) was
|
|
82
|
+
submitted.
|
|
83
|
+
|
|
84
|
+
4. Redistribution.
|
|
85
|
+
You may reproduce and distribute copies of the Work or Derivative
|
|
86
|
+
Works thereof in any medium, with or without modifications, and in
|
|
87
|
+
Source or Object form, provided that You meet the following conditions:
|
|
88
|
+
|
|
89
|
+
(a) You must give any other recipients of the Work or
|
|
90
|
+
Derivative Works a copy of this License; and
|
|
91
|
+
|
|
92
|
+
(b) You must cause any modified files to carry prominent notices
|
|
93
|
+
stating that You changed the files; and
|
|
94
|
+
|
|
95
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
96
|
+
that You distribute, all copyright, patent, trademark, and
|
|
97
|
+
attribution notices from the Source form of the Work,
|
|
98
|
+
excluding those notices that do not pertain to any part of
|
|
99
|
+
the Derivative Works; and
|
|
100
|
+
|
|
101
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
102
|
+
distribution, then any Derivative Works that You distribute must
|
|
103
|
+
include a readable copy of the attribution notices contained
|
|
104
|
+
within such NOTICE file, excluding those notices that do not
|
|
105
|
+
pertain to any part of the Derivative Works, in at least one
|
|
106
|
+
of the following places: within a NOTICE text file distributed
|
|
107
|
+
as part of the Derivative Works; within the Source form or
|
|
108
|
+
documentation, if provided along with the Derivative Works; or,
|
|
109
|
+
within a display generated by the Derivative Works, if and
|
|
110
|
+
wherever such third-party notices normally appear. The contents
|
|
111
|
+
of the NOTICE file are for informational purposes only and
|
|
112
|
+
do not modify the License. You may add Your own attribution
|
|
113
|
+
notices within Derivative Works that You distribute, alongside
|
|
114
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
115
|
+
that such additional attribution notices cannot be construed
|
|
116
|
+
as modifying the License.
|
|
117
|
+
|
|
118
|
+
5. Submission of Contributions.
|
|
119
|
+
Unless You explicitly state otherwise, any Contribution intentionally
|
|
120
|
+
submitted for inclusion in the Work by You to the Licensor shall be
|
|
121
|
+
under the terms and conditions of this License, without any additional
|
|
122
|
+
terms or conditions.
|
|
123
|
+
|
|
124
|
+
6. Trademarks.
|
|
125
|
+
This License does not grant permission to use the trade names,
|
|
126
|
+
trademarks, service marks, or product names of the Licensor,
|
|
127
|
+
except as required for reasonable and customary use in describing the
|
|
128
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
129
|
+
|
|
130
|
+
7. Disclaimer of Warranty.
|
|
131
|
+
Unless required by applicable law or agreed to in writing, Licensor
|
|
132
|
+
provides the Work (and each Contributor provides its Contributions)
|
|
133
|
+
on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
|
134
|
+
either express or implied.
|
|
135
|
+
|
|
136
|
+
8. Limitation of Liability.
|
|
137
|
+
In no event and under no legal theory, whether in tort (including
|
|
138
|
+
negligence), contract, or otherwise, unless required by applicable
|
|
139
|
+
law (such as deliberate and grossly negligent acts) or agreed to in
|
|
140
|
+
writing, shall any Contributor be liable to You for damages.
|
|
141
|
+
|
|
142
|
+
9. Accepting Warranty or Additional Liability.
|
|
143
|
+
While redistributing the Work or Derivative Works thereof, You may
|
|
144
|
+
choose to offer, and charge a fee for, acceptance of support,
|
|
145
|
+
warranty, indemnity, or other liability obligations and/or rights
|
|
146
|
+
consistent with this License.
|
|
147
|
+
|
|
148
|
+
END OF TERMS AND CONDITIONS
|
|
149
|
+
|
|
150
|
+
Copyright 2026 UFOUI Project
|
package/README.md
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# UFOUI
|
|
2
|
+
|
|
3
|
+
UFOUI is a React UI component library implementing Material Design 3.
|
|
4
|
+
It focuses on simplicity, low dependency count, and small bundle size.
|
|
5
|
+
|
|
6
|
+
The library is designed to be used as a single import, without additional required packages beyond React.
|
|
7
|
+
|
|
8
|
+
## Goals
|
|
9
|
+
- Full Material Design 3 implementation
|
|
10
|
+
- Minimal bundle size
|
|
11
|
+
- No heavy runtime dependencies
|
|
12
|
+
- Suitable for both open-source and commercial products
|
|
13
|
+
|
|
14
|
+
## Status
|
|
15
|
+
This project is currently in early development (v0.x).
|
|
16
|
+
The API may change.
|
|
17
|
+
|
|
18
|
+
## Installation
|
|
19
|
+
```bash
|
|
20
|
+
pnpm add @ufoui/core
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Usage
|
|
24
|
+
```ts
|
|
25
|
+
import { Button } from '@ufoui/core';
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
```ts
|
|
29
|
+
import '@ufoui/core/style.css';
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## License
|
|
33
|
+
Apache License 2.0
|
|
34
|
+
|
|
35
|
+
## Trademark
|
|
36
|
+
“UFOUI” and the UFOUI logo are trademarks of the UFOUI project.
|
|
37
|
+
Use of the name or logo requires permission.
|
package/TRADEMARK.md
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# Trademark
|
|
2
|
+
|
|
3
|
+
“UFOUI” and the UFOUI logo are trademarks of the UFOUI Project.
|
|
4
|
+
|
|
5
|
+
The Apache License 2.0 applies to the source code only.
|
|
6
|
+
This license does not grant permission to use the UFOUI name,
|
|
7
|
+
logo, or branding for commercial products, forks, or derivative works
|
|
8
|
+
without prior written permission.
|
|
9
|
+
|
|
10
|
+
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { BoxBaseProps } from '../core';
|
|
2
|
+
/**
|
|
3
|
+
* Props for {@link Article}.
|
|
4
|
+
* Extends {@link BoxBaseProps} except for `elementClass` and `component`.
|
|
5
|
+
*
|
|
6
|
+
* @category Box
|
|
7
|
+
*/
|
|
8
|
+
export type ArticleProps = Omit<BoxBaseProps, 'elementClass' | 'component'>;
|
|
9
|
+
/**
|
|
10
|
+
* Semantic layout wrapper for the native `<article>` element.
|
|
11
|
+
* Intended for self-contained content units composed of Sections and optional Aside.
|
|
12
|
+
*
|
|
13
|
+
* Built on top of {@link BoxBase}, inheriting its layout and styling props.
|
|
14
|
+
* Defaults to a column layout (`direction="col"`) and applies
|
|
15
|
+
* the semantic UUI class `"uui-article"`.
|
|
16
|
+
*
|
|
17
|
+
* @function
|
|
18
|
+
* @example
|
|
19
|
+
* <Article elevation={1} shape="rounded">
|
|
20
|
+
* <Section />
|
|
21
|
+
* </Article>
|
|
22
|
+
*
|
|
23
|
+
* @category Box
|
|
24
|
+
*/
|
|
25
|
+
export declare const Article: import('react').ForwardRefExoticComponent<ArticleProps & import('react').RefAttributes<HTMLElement>>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { BoxBaseProps } from '../core';
|
|
2
|
+
/**
|
|
3
|
+
* Props for {@link Aside}.
|
|
4
|
+
* Extends {@link BoxBaseProps} except for `elementClass` and `component`.
|
|
5
|
+
*
|
|
6
|
+
* @category Box
|
|
7
|
+
*/
|
|
8
|
+
export type AsideProps = Omit<BoxBaseProps, 'elementClass' | 'component'>;
|
|
9
|
+
/**
|
|
10
|
+
* Semantic layout wrapper for the native `<aside>` element.
|
|
11
|
+
*
|
|
12
|
+
* Built on top of {@link BoxBase}, inheriting its layout and styling props.
|
|
13
|
+
* Defaults to a column layout (`direction="col"`) and applies
|
|
14
|
+
* the semantic UUI class `"uui-aside"`.
|
|
15
|
+
*
|
|
16
|
+
* Use for complementary or contextual content adjacent to the main content.
|
|
17
|
+
*
|
|
18
|
+
* @function
|
|
19
|
+
* @param props - All layout and style props inherited from {@link BoxBase}.
|
|
20
|
+
* @example
|
|
21
|
+
* <Aside elevation={1} shape="rounded">
|
|
22
|
+
* <SidebarContent />
|
|
23
|
+
* </Aside>
|
|
24
|
+
*
|
|
25
|
+
* @category Box
|
|
26
|
+
*/
|
|
27
|
+
export declare const Aside: import('react').ForwardRefExoticComponent<AsideProps & import('react').RefAttributes<HTMLElement>>;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { HTMLProps } from 'react';
|
|
2
|
+
import { ElementBorder, ElementElevation, ElementShape, ElementSize } from '../utils';
|
|
3
|
+
import { BorderColor, SemanticColor } from '../../utils/color';
|
|
4
|
+
/**
|
|
5
|
+
* Props for the {@link Badge} component.
|
|
6
|
+
*
|
|
7
|
+
* @remarks
|
|
8
|
+
* Badge displays a status or value in a small decorative label.
|
|
9
|
+
* Supports customization of color, border, elevation, shape, size, and position.
|
|
10
|
+
*
|
|
11
|
+
* @category Component properties
|
|
12
|
+
*/
|
|
13
|
+
export interface AvatarProps extends Omit<HTMLProps<HTMLDivElement>, 'ref' | 'size'> {
|
|
14
|
+
/** The value displayed inside the badge (e.g. a number or label). */
|
|
15
|
+
label: string;
|
|
16
|
+
/** Semantic color of the badge background (e.g. `'error'`, `'info'`). */
|
|
17
|
+
color?: SemanticColor;
|
|
18
|
+
/** Border width, e.g. `1` or `2`. Ignored if `outlined` is not set.
|
|
19
|
+
* @default 1
|
|
20
|
+
* */
|
|
21
|
+
border?: ElementBorder;
|
|
22
|
+
/** Color of the border when `outlined` is true. */
|
|
23
|
+
borderColor?: BorderColor;
|
|
24
|
+
/** Elevation depth if `raised` is true. */
|
|
25
|
+
elevation?: ElementElevation;
|
|
26
|
+
/** Size of the badge (`small`, `medium`, `large`). */
|
|
27
|
+
size?: ElementSize;
|
|
28
|
+
/** Shape of the badge, e.g. `'round'`, `'square'`. */
|
|
29
|
+
shape?: ElementShape;
|
|
30
|
+
/** If true, adds elevation shadow. */
|
|
31
|
+
raised?: boolean;
|
|
32
|
+
/** If true, renders the badge as outlined. */
|
|
33
|
+
outlined?: boolean;
|
|
34
|
+
}
|
|
35
|
+
export declare const Avatar: import('react').ForwardRefExoticComponent<AvatarProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { HTMLAttributes } from 'react';
|
|
2
|
+
import { ElementAlign, ElementBorder, ElementElevation, ElementFont, ElementShape, ElementSize } from '../utils';
|
|
3
|
+
import { BorderColor, SemanticColor } from '../../utils/color';
|
|
4
|
+
/**
|
|
5
|
+
* Props for the Badge component.
|
|
6
|
+
*
|
|
7
|
+
* Small visual indicator used to display a value or status.
|
|
8
|
+
*
|
|
9
|
+
* @category Badge
|
|
10
|
+
*/
|
|
11
|
+
export interface BadgeProps extends Omit<HTMLAttributes<HTMLSpanElement>, 'ref' | 'size'> {
|
|
12
|
+
/** Position relative to the parent element. */
|
|
13
|
+
align?: ElementAlign;
|
|
14
|
+
/** Accessible label for screen readers when badge conveys information. */
|
|
15
|
+
ariaLabel?: string;
|
|
16
|
+
/** Border width when outlined. */
|
|
17
|
+
border?: ElementBorder;
|
|
18
|
+
/** Border color when outlined. */
|
|
19
|
+
borderColor?: BorderColor;
|
|
20
|
+
/** Semantic background color. */
|
|
21
|
+
color?: SemanticColor;
|
|
22
|
+
/** Elevation level for raised appearance. */
|
|
23
|
+
elevation?: ElementElevation;
|
|
24
|
+
/** Font token applied to the badge text. */
|
|
25
|
+
font?: ElementFont;
|
|
26
|
+
/** Visual offset applied to the badge position. */
|
|
27
|
+
offset?: number;
|
|
28
|
+
/** Shape of the badge. */
|
|
29
|
+
shape?: ElementShape;
|
|
30
|
+
/** Visual size of the badge. */
|
|
31
|
+
size?: ElementSize;
|
|
32
|
+
/** Value displayed inside the badge. */
|
|
33
|
+
value: string | number;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Displays a small badge with a value or indicator.
|
|
37
|
+
*
|
|
38
|
+
* Can be rendered standalone or attached to a child element.
|
|
39
|
+
* When size is small or extraSmall, the value is hidden.
|
|
40
|
+
*
|
|
41
|
+
* @function Badge
|
|
42
|
+
* @param props Component properties.
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* <Badge value={3} color="info" />
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* <Badge value={5} color="warning">
|
|
49
|
+
* <Button />
|
|
50
|
+
* </Badge>
|
|
51
|
+
*
|
|
52
|
+
* @category Badge
|
|
53
|
+
*/
|
|
54
|
+
export declare const Badge: {
|
|
55
|
+
(props: BadgeProps): import("react/jsx-runtime").JSX.Element;
|
|
56
|
+
displayName: string;
|
|
57
|
+
};
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { default as React, HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
import { ElementBorder, ElementElevation, ElementShape } from '../../utils';
|
|
3
|
+
import { BorderColor, SurfaceColor } from '../../../utils/color';
|
|
4
|
+
/**
|
|
5
|
+
* Layout mode for {@link BoxBase}.
|
|
6
|
+
*
|
|
7
|
+
* @remarks
|
|
8
|
+
* Determines how children are arranged:
|
|
9
|
+
* - `'flex'` — flex container
|
|
10
|
+
* - `'grid'` — grid container
|
|
11
|
+
* - `'block'` — block or inline-block element
|
|
12
|
+
*
|
|
13
|
+
* @category Box
|
|
14
|
+
*/
|
|
15
|
+
export type BoxType = 'flex' | 'grid' | 'block';
|
|
16
|
+
/**
|
|
17
|
+
* Direction value used by layout-related props.
|
|
18
|
+
*
|
|
19
|
+
* @category Box
|
|
20
|
+
*/
|
|
21
|
+
export type BoxDirection = 'row' | 'col';
|
|
22
|
+
/**
|
|
23
|
+
* Props for {@link BoxBase}.
|
|
24
|
+
*
|
|
25
|
+
* @remarks
|
|
26
|
+
* Provides full control over layout, spacing, shape, elevation,
|
|
27
|
+
* borders and flex/grid behaviour. All props are optional.
|
|
28
|
+
*
|
|
29
|
+
* @category Box
|
|
30
|
+
*/
|
|
31
|
+
export interface BoxBaseProps extends Omit<HTMLAttributes<HTMLElement>, 'color'> {
|
|
32
|
+
/** Maps to `align-content` (grid/flex-wrap content alignment). */
|
|
33
|
+
alignContent?: React.CSSProperties['alignContent'];
|
|
34
|
+
/** Maps to `align-items` (cross-axis alignment). */
|
|
35
|
+
alignItems?: React.CSSProperties['alignItems'];
|
|
36
|
+
/** Border width (0–5). */
|
|
37
|
+
border?: ElementBorder;
|
|
38
|
+
/** Border color token. */
|
|
39
|
+
borderColor?: BorderColor;
|
|
40
|
+
/** React children inside the box. */
|
|
41
|
+
children?: ReactNode;
|
|
42
|
+
/** Layout direction shortcut. Same as `direction="col"`. */
|
|
43
|
+
col?: boolean;
|
|
44
|
+
/** Surface background token. Default: `'surface'`. */
|
|
45
|
+
color?: SurfaceColor;
|
|
46
|
+
/** Grid template columns (`3` → `repeat(3, 1fr)`). */
|
|
47
|
+
cols?: number | string;
|
|
48
|
+
/** Custom HTML element/component. Default: `div`. */
|
|
49
|
+
component?: React.ElementType;
|
|
50
|
+
/** Layout direction (`row` or `col`) for flex. Ignored if `row` or `col` is set. */
|
|
51
|
+
direction?: BoxDirection;
|
|
52
|
+
/** Native disabled attribute. Applied when supported by the rendered element. */
|
|
53
|
+
disabled?: boolean;
|
|
54
|
+
/** Semantic UUI element class (e.g. 'uui-section', 'uui-footer'). */
|
|
55
|
+
elementClass?: string;
|
|
56
|
+
/** Elevation level (0–5). */
|
|
57
|
+
elevation?: ElementElevation;
|
|
58
|
+
/** Auto-placement flow direction for grid layouts. */
|
|
59
|
+
flow?: BoxDirection;
|
|
60
|
+
/** Forces full width (100%). */
|
|
61
|
+
fullWidth?: boolean;
|
|
62
|
+
/** Gap between children (flex/grid). */
|
|
63
|
+
gap?: number | string;
|
|
64
|
+
/** Horizontal gap (`column-gap`). */
|
|
65
|
+
gapX?: number | string;
|
|
66
|
+
/** Vertical gap (`row-gap`). */
|
|
67
|
+
gapY?: number | string;
|
|
68
|
+
/** Enables flex-grow (fills remaining space). */
|
|
69
|
+
grow?: boolean;
|
|
70
|
+
/** Renders as `inline-flex`, `inline-grid` or `inline-block`. */
|
|
71
|
+
inline?: boolean;
|
|
72
|
+
/** Maps to `justify-content` (main-axis alignment). */
|
|
73
|
+
justifyContent?: React.CSSProperties['justifyContent'];
|
|
74
|
+
/** Padding (all sides). */
|
|
75
|
+
p?: number | string;
|
|
76
|
+
/** Padding bottom. */
|
|
77
|
+
pb?: number | string;
|
|
78
|
+
/** Padding left. */
|
|
79
|
+
pl?: number | string;
|
|
80
|
+
/** Maps to `place-items` (grid shortcut for align+justify items). */
|
|
81
|
+
placeItems?: React.CSSProperties['placeItems'];
|
|
82
|
+
/** Padding right. */
|
|
83
|
+
pr?: number | string;
|
|
84
|
+
/** Padding top. */
|
|
85
|
+
pt?: number | string;
|
|
86
|
+
/** Horizontal padding (`padding-left` + `padding-right`). */
|
|
87
|
+
px?: number | string;
|
|
88
|
+
/** Vertical padding (`padding-top` + `padding-bottom`). */
|
|
89
|
+
py?: number | string;
|
|
90
|
+
/** Layout direction shortcut. Same as `direction="row"`. */
|
|
91
|
+
row?: boolean;
|
|
92
|
+
/** Grid template rows (`2` → `repeat(2, 1fr)`). */
|
|
93
|
+
rows?: number | string;
|
|
94
|
+
/** Shape/border-radius token (round, rounded, smooth, square). */
|
|
95
|
+
shape?: ElementShape;
|
|
96
|
+
/** Layout mode (`flex`, `grid`, `block`). Default: `flex`. */
|
|
97
|
+
type?: BoxType;
|
|
98
|
+
/** Enables wrapping (`flex-wrap: wrap`). */
|
|
99
|
+
wrap?: boolean;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* `BoxBase` — core layout primitive powering all semantic containers
|
|
103
|
+
* (`Box`, `Section`, `Article`, `Aside`, `Header`, `Footer`, `Nav`).
|
|
104
|
+
*
|
|
105
|
+
* Provides low-level control over layout (flex, grid, block),
|
|
106
|
+
* spacing, alignment, wrapping, elevation, borders, shape, and surface color.
|
|
107
|
+
* This component does **not** impose visual design — higher-level
|
|
108
|
+
* components add semantics, but rely on `BoxBase` for structure.
|
|
109
|
+
*
|
|
110
|
+
* Accepts both semantic styling props (color, shape, elevation)
|
|
111
|
+
* and layout utilities (padding, gap, direction, wrap, justify, align).
|
|
112
|
+
*
|
|
113
|
+
* @function
|
|
114
|
+
* @param props - Component properties.
|
|
115
|
+
*
|
|
116
|
+
* @example
|
|
117
|
+
* ```tsx
|
|
118
|
+
* <BoxBase p={16} gap={8} direction="col" elevation={2}>
|
|
119
|
+
* <Item />
|
|
120
|
+
* <Item />
|
|
121
|
+
* </BoxBase>
|
|
122
|
+
* ```
|
|
123
|
+
*
|
|
124
|
+
* @category Box
|
|
125
|
+
*/
|
|
126
|
+
export declare const BoxBase: React.ForwardRefExoticComponent<BoxBaseProps & React.RefAttributes<HTMLElement>>;
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { default as React, ReactNode } from 'react';
|
|
2
|
+
import { ElementAlign, ElementDensity, ElementElevation, ElementFocusEffect, ElementFont, ElementHoverEffect, ElementOutline, ElementPressedEffect, ElementSelectedEffect, ElementShape, ElementSize, ElementTouchEffect } from '../../utils';
|
|
3
|
+
import { BorderColor, SemanticColor, SurfaceColor } from '../../../utils/color';
|
|
4
|
+
/**
|
|
5
|
+
* Props for the ButtonBase component.
|
|
6
|
+
*
|
|
7
|
+
* @category Base components
|
|
8
|
+
*/
|
|
9
|
+
export interface ButtonBaseProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'color' | 'size'> {
|
|
10
|
+
/** Outline thickness when outlined. Default: 1 */
|
|
11
|
+
border?: ElementOutline;
|
|
12
|
+
/** Border color when outlined. */
|
|
13
|
+
borderColor?: BorderColor;
|
|
14
|
+
/** Custom content. Overrides label, icons, and layout. */
|
|
15
|
+
children?: ReactNode;
|
|
16
|
+
/** Semantic color theme. Default: primary */
|
|
17
|
+
color?: SemanticColor;
|
|
18
|
+
/** Initial selected state for uncontrolled toggle buttons. */
|
|
19
|
+
defaultSelected?: boolean;
|
|
20
|
+
/** Visual density of the button. */
|
|
21
|
+
density?: ElementDensity;
|
|
22
|
+
/** Disables the button. */
|
|
23
|
+
disabled?: boolean;
|
|
24
|
+
/** Required root class name. */
|
|
25
|
+
elementClass: string;
|
|
26
|
+
/** Enables elevated style. */
|
|
27
|
+
elevated?: boolean;
|
|
28
|
+
/** Explicit elevation level. */
|
|
29
|
+
elevation?: ElementElevation;
|
|
30
|
+
/** Icon rendered at the end of the button. */
|
|
31
|
+
endIcon?: React.ReactElement;
|
|
32
|
+
/** Enables filled style. */
|
|
33
|
+
filled?: boolean;
|
|
34
|
+
/** Disables elevation and elevation effects. */
|
|
35
|
+
flat?: boolean;
|
|
36
|
+
/** Focus visual effects. */
|
|
37
|
+
focusEffects?: ElementFocusEffect[];
|
|
38
|
+
/** Font token for label and content. */
|
|
39
|
+
font?: ElementFont;
|
|
40
|
+
/** Expands button to full width. */
|
|
41
|
+
fullWidth?: boolean;
|
|
42
|
+
/** Hover visual effects. */
|
|
43
|
+
hoverEffects?: ElementHoverEffect[];
|
|
44
|
+
/** Icon rendered at the start of the button. */
|
|
45
|
+
icon?: React.ReactElement;
|
|
46
|
+
/** DOM id. Auto-generated if not provided. */
|
|
47
|
+
id?: string;
|
|
48
|
+
/** Text label for the button. */
|
|
49
|
+
label?: string;
|
|
50
|
+
/** Custom leading content. */
|
|
51
|
+
leading?: ReactNode;
|
|
52
|
+
/** Imperative link trigger element. */
|
|
53
|
+
link?: React.ReactElement;
|
|
54
|
+
/** Shows loading spinner and disables interaction. */
|
|
55
|
+
loading?: boolean;
|
|
56
|
+
/** DOM name attribute. */
|
|
57
|
+
name?: string;
|
|
58
|
+
/** Blur event handler. */
|
|
59
|
+
onBlur?: React.FocusEventHandler<HTMLButtonElement>;
|
|
60
|
+
/** Change event handler (toggle buttons). */
|
|
61
|
+
onChange?: React.ChangeEventHandler<HTMLButtonElement>;
|
|
62
|
+
/** Click event handler. */
|
|
63
|
+
onClick?: React.MouseEventHandler<HTMLButtonElement>;
|
|
64
|
+
/** Change handler for file upload input. */
|
|
65
|
+
onUploadChange?: React.ChangeEventHandler<HTMLInputElement>;
|
|
66
|
+
/** Enables outlined style. */
|
|
67
|
+
outlined?: boolean;
|
|
68
|
+
/** Pressed visual effects. */
|
|
69
|
+
pressedEffects?: ElementPressedEffect[];
|
|
70
|
+
/** Controlled selected state for toggle buttons. */
|
|
71
|
+
selected?: boolean;
|
|
72
|
+
/** Semantic color override when selected. */
|
|
73
|
+
selectedColor?: SemanticColor;
|
|
74
|
+
/** Visual effects applied when selected. */
|
|
75
|
+
selectedEffects?: ElementSelectedEffect[];
|
|
76
|
+
/** Icon displayed when selected. */
|
|
77
|
+
selectedIcon?: React.ReactElement;
|
|
78
|
+
/** Shape override when selected. */
|
|
79
|
+
selectedShape?: ElementShape;
|
|
80
|
+
/** Text color override when selected. */
|
|
81
|
+
selectedTextColor?: SurfaceColor;
|
|
82
|
+
/** Shape of the button. */
|
|
83
|
+
shape?: ElementShape;
|
|
84
|
+
/** Predefined button size. Default: medium */
|
|
85
|
+
size?: ElementSize;
|
|
86
|
+
/** Text color override. */
|
|
87
|
+
textColor?: SurfaceColor;
|
|
88
|
+
/** Tooltip text and accessibility label fallback. */
|
|
89
|
+
title?: string;
|
|
90
|
+
/** Enables toggle button behavior. */
|
|
91
|
+
toggle?: boolean;
|
|
92
|
+
/** Enables tonal style. */
|
|
93
|
+
tonal?: boolean;
|
|
94
|
+
/** Tooltip alignment relative to the button. */
|
|
95
|
+
tooltipAlign?: ElementAlign;
|
|
96
|
+
/** Touch and click visual effects. */
|
|
97
|
+
touchEffects?: ElementTouchEffect[];
|
|
98
|
+
/** Custom trailing content. */
|
|
99
|
+
trailing?: ReactNode;
|
|
100
|
+
/** Native button type. Default: button */
|
|
101
|
+
type?: 'submit' | 'reset' | 'button';
|
|
102
|
+
/** Enables file upload trigger behavior. */
|
|
103
|
+
upload?: boolean;
|
|
104
|
+
/** Accepted MIME types for file upload. */
|
|
105
|
+
uploadAccept?: string;
|
|
106
|
+
/** Enables multi-file upload. */
|
|
107
|
+
uploadMultiple?: boolean;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Low-level base component for all button variants.
|
|
111
|
+
*
|
|
112
|
+
* Supports Material Design 3 styles, toggle behavior, loading state,
|
|
113
|
+
* file upload trigger, icons, and semantic colors.
|
|
114
|
+
*
|
|
115
|
+
* @param props - Component properties.
|
|
116
|
+
* @function
|
|
117
|
+
*
|
|
118
|
+
* @example
|
|
119
|
+
* <ButtonBase label="Save" filled icon={<SaveIcon />} />
|
|
120
|
+
*
|
|
121
|
+
* @example
|
|
122
|
+
* <ButtonBase upload label="Upload" onUploadChange={handleUpload} />
|
|
123
|
+
*
|
|
124
|
+
* @category Base components
|
|
125
|
+
*/
|
|
126
|
+
export declare const ButtonBase: React.ForwardRefExoticComponent<ButtonBaseProps & React.RefAttributes<HTMLButtonElement>>;
|