@particle-network/ui-react 0.5.1-beta.5 → 0.5.1-beta.6
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/dist/components/ProgressWrapper/index.d.ts +2 -2
- package/dist/components/UXButton/button.js +1 -1
- package/dist/components/UXInput/index.d.ts +4 -4
- package/dist/components/UXInput/input.extend.d.ts +4 -4
- package/dist/components/UXSpinner/spinner.d.ts +1 -5
- package/dist/components/UXSpinner/spinner.js +2 -3
- package/dist/components/UXSwitch/index.d.ts +2 -2
- package/dist/components/UXSwitch/switch.extend.d.ts +2 -2
- package/dist/components/UXTable/index.d.ts +2 -2
- package/dist/components/UXTable/table.extend.d.ts +2 -2
- package/dist/components/layout/Box/box-theme.d.ts +1808 -0
- package/dist/components/layout/Box/box-theme.js +328 -0
- package/dist/components/layout/Box/box.d.ts +14 -0
- package/dist/components/layout/Box/box.js +90 -0
- package/dist/components/layout/Circle.js +2 -3
- package/dist/components/layout/Flex.d.ts +3 -27
- package/dist/components/layout/Flex.js +6 -19
- package/dist/components/layout/HStack.d.ts +1 -1
- package/dist/components/layout/Square.js +5 -3
- package/dist/components/layout/VStack.d.ts +1 -1
- package/dist/components/layout/VStack.js +2 -2
- package/dist/components/layout/index.d.ts +1 -0
- package/dist/components/layout/index.js +1 -0
- package/dist/components/typography/Text.js +21 -6
- package/dist/components/typography/Text.type.d.ts +3 -26
- package/dist/components/typography/Text.type.js +0 -46
- package/dist/components/typography/text-theme.d.ts +178 -0
- package/dist/components/typography/text-theme.js +79 -0
- package/package.json +3 -3
|
@@ -0,0 +1,328 @@
|
|
|
1
|
+
import { tv } from "@heroui/theme";
|
|
2
|
+
const spacingClasses = (prefix)=>({
|
|
3
|
+
px: `${prefix}-px`,
|
|
4
|
+
0: `${prefix}-0`,
|
|
5
|
+
1: `${prefix}-1`,
|
|
6
|
+
2: `${prefix}-2`,
|
|
7
|
+
3: `${prefix}-3`,
|
|
8
|
+
4: `${prefix}-4`,
|
|
9
|
+
5: `${prefix}-5`,
|
|
10
|
+
6: `${prefix}-6`,
|
|
11
|
+
7: `${prefix}-7`,
|
|
12
|
+
8: `${prefix}-8`,
|
|
13
|
+
9: `${prefix}-9`,
|
|
14
|
+
10: `${prefix}-10`,
|
|
15
|
+
xs: `${prefix}-xs`,
|
|
16
|
+
sm: `${prefix}-sm`,
|
|
17
|
+
md: `${prefix}-md`,
|
|
18
|
+
lg: `${prefix}-lg`
|
|
19
|
+
});
|
|
20
|
+
const sizingClasses = (prefix)=>({
|
|
21
|
+
auto: `${prefix}-auto`,
|
|
22
|
+
px: `${prefix}-px`,
|
|
23
|
+
full: `${prefix}-full`,
|
|
24
|
+
screen: `${prefix}-screen`,
|
|
25
|
+
dvw: `${prefix}-dvw`,
|
|
26
|
+
dvh: `${prefix}-dvh`,
|
|
27
|
+
lvw: `${prefix}-lvw`,
|
|
28
|
+
lvh: `${prefix}-lvh`,
|
|
29
|
+
svw: `${prefix}-svw`,
|
|
30
|
+
svh: `${prefix}-svh`,
|
|
31
|
+
min: `${prefix}-min`,
|
|
32
|
+
max: `${prefix}-max`,
|
|
33
|
+
fit: `${prefix}-fit`
|
|
34
|
+
});
|
|
35
|
+
const sizingPresets = [
|
|
36
|
+
'auto',
|
|
37
|
+
'px',
|
|
38
|
+
'full',
|
|
39
|
+
'screen',
|
|
40
|
+
'dvw',
|
|
41
|
+
'dvh',
|
|
42
|
+
'lvw',
|
|
43
|
+
'lvh',
|
|
44
|
+
'svw',
|
|
45
|
+
'svh',
|
|
46
|
+
'min',
|
|
47
|
+
'max',
|
|
48
|
+
'fit'
|
|
49
|
+
];
|
|
50
|
+
const bgClasses = {
|
|
51
|
+
current: 'bg-current',
|
|
52
|
+
transparent: 'bg-transparent',
|
|
53
|
+
default: 'bg-default',
|
|
54
|
+
pure: 'light:bg-white dark:bg-black',
|
|
55
|
+
bg100: 'bg-background-100',
|
|
56
|
+
bg200: 'bg-background-200',
|
|
57
|
+
bg300: 'bg-background-300',
|
|
58
|
+
bg400: 'bg-background-400',
|
|
59
|
+
overlay: 'bg-overlay',
|
|
60
|
+
divider: 'bg-divider',
|
|
61
|
+
foreground: 'bg-foreground',
|
|
62
|
+
secondary: 'bg-secondary',
|
|
63
|
+
tertiary: 'bg-tertiary',
|
|
64
|
+
primary: 'bg-primary',
|
|
65
|
+
success: 'bg-success',
|
|
66
|
+
warning: 'bg-warning',
|
|
67
|
+
danger: 'bg-danger',
|
|
68
|
+
alert: 'bg-alert',
|
|
69
|
+
bullish: 'bg-bullish',
|
|
70
|
+
bearish: 'bg-bearish'
|
|
71
|
+
};
|
|
72
|
+
const colorClasses = {
|
|
73
|
+
current: 'text-current',
|
|
74
|
+
transparent: 'text-transparent',
|
|
75
|
+
divider: 'text-divider',
|
|
76
|
+
foreground: 'text-foreground',
|
|
77
|
+
secondary: 'text-secondary',
|
|
78
|
+
tertiary: 'text-tertiary',
|
|
79
|
+
primary: 'text-primary',
|
|
80
|
+
success: 'text-success',
|
|
81
|
+
warning: 'text-warning',
|
|
82
|
+
danger: 'text-danger',
|
|
83
|
+
alert: 'text-alert',
|
|
84
|
+
bullish: 'text-bullish',
|
|
85
|
+
bearish: 'text-bearish'
|
|
86
|
+
};
|
|
87
|
+
const borderColorClasses = {
|
|
88
|
+
transparent: 'border-transparent',
|
|
89
|
+
divider: 'border-divider',
|
|
90
|
+
foreground: 'border-foreground',
|
|
91
|
+
secondary: 'border-secondary',
|
|
92
|
+
tertiary: 'border-tertiary',
|
|
93
|
+
primary: 'border-primary',
|
|
94
|
+
success: 'border-success',
|
|
95
|
+
warning: 'border-warning',
|
|
96
|
+
danger: 'border-danger',
|
|
97
|
+
alert: 'border-alert',
|
|
98
|
+
bullish: 'border-bullish',
|
|
99
|
+
bearish: 'border-bearish'
|
|
100
|
+
};
|
|
101
|
+
const roundedClasses = {
|
|
102
|
+
none: 'rounded-none',
|
|
103
|
+
sm: 'rounded-sm',
|
|
104
|
+
md: 'rounded-md',
|
|
105
|
+
lg: 'rounded-lg',
|
|
106
|
+
xl: 'rounded-xl',
|
|
107
|
+
small: 'rounded-small',
|
|
108
|
+
medium: 'rounded-medium',
|
|
109
|
+
large: 'rounded-large',
|
|
110
|
+
full: 'rounded-full'
|
|
111
|
+
};
|
|
112
|
+
const boxVariants = tv({
|
|
113
|
+
base: 'ux-box',
|
|
114
|
+
variants: {
|
|
115
|
+
position: {
|
|
116
|
+
static: 'static',
|
|
117
|
+
relative: 'relative',
|
|
118
|
+
absolute: 'absolute',
|
|
119
|
+
fixed: 'fixed',
|
|
120
|
+
sticky: 'sticky'
|
|
121
|
+
},
|
|
122
|
+
display: {
|
|
123
|
+
flex: 'flex',
|
|
124
|
+
inlineFlex: 'inline-flex',
|
|
125
|
+
block: 'block',
|
|
126
|
+
hidden: 'hidden',
|
|
127
|
+
grid: 'grid',
|
|
128
|
+
inlineGrid: 'inline-grid'
|
|
129
|
+
},
|
|
130
|
+
aspect: {
|
|
131
|
+
square: 'aspect-square',
|
|
132
|
+
video: 'aspect-video',
|
|
133
|
+
auto: 'aspect-auto'
|
|
134
|
+
},
|
|
135
|
+
overflow: {
|
|
136
|
+
visible: 'overflow-visible',
|
|
137
|
+
hidden: 'overflow-hidden',
|
|
138
|
+
clip: 'overflow-clip',
|
|
139
|
+
scroll: 'overflow-scroll',
|
|
140
|
+
auto: 'overflow-auto'
|
|
141
|
+
},
|
|
142
|
+
zIndex: {
|
|
143
|
+
auto: 'z-auto',
|
|
144
|
+
0: 'z-0',
|
|
145
|
+
10: 'z-10',
|
|
146
|
+
20: 'z-20',
|
|
147
|
+
30: 'z-30',
|
|
148
|
+
40: 'z-40',
|
|
149
|
+
50: 'z-50',
|
|
150
|
+
60: 'z-60',
|
|
151
|
+
70: 'z-70',
|
|
152
|
+
80: 'z-80',
|
|
153
|
+
90: 'z-90',
|
|
154
|
+
100: 'z-100'
|
|
155
|
+
},
|
|
156
|
+
direction: {
|
|
157
|
+
row: 'flex-row',
|
|
158
|
+
column: 'flex-col',
|
|
159
|
+
'row-reverse': 'flex-row-reverse',
|
|
160
|
+
'col-reverse': 'flex-col-reverse'
|
|
161
|
+
},
|
|
162
|
+
items: {
|
|
163
|
+
start: 'items-start',
|
|
164
|
+
center: 'items-center',
|
|
165
|
+
end: 'items-end',
|
|
166
|
+
baseline: 'items-baseline',
|
|
167
|
+
stretch: 'items-stretch',
|
|
168
|
+
normal: 'items-normal'
|
|
169
|
+
},
|
|
170
|
+
justify: {
|
|
171
|
+
start: 'justify-start',
|
|
172
|
+
center: 'justify-center',
|
|
173
|
+
end: 'justify-end',
|
|
174
|
+
between: 'justify-between',
|
|
175
|
+
around: 'justify-around',
|
|
176
|
+
evenly: 'justify-evenly',
|
|
177
|
+
stretch: 'justify-stretch',
|
|
178
|
+
baseline: 'justify-baseline',
|
|
179
|
+
normal: 'justify-normal'
|
|
180
|
+
},
|
|
181
|
+
gap: spacingClasses('gap'),
|
|
182
|
+
wrap: {
|
|
183
|
+
true: 'flex-wrap',
|
|
184
|
+
wrap: 'flex-wrap',
|
|
185
|
+
nowrap: 'flex-nowrap',
|
|
186
|
+
'wrap-reverse': 'flex-wrap-reverse'
|
|
187
|
+
},
|
|
188
|
+
self: {
|
|
189
|
+
auto: 'self-auto',
|
|
190
|
+
start: 'self-start',
|
|
191
|
+
end: 'self-end',
|
|
192
|
+
center: 'self-center',
|
|
193
|
+
stretch: 'self-stretch',
|
|
194
|
+
baseline: 'self-baseline',
|
|
195
|
+
normal: 'self-normal'
|
|
196
|
+
},
|
|
197
|
+
grow: {
|
|
198
|
+
true: 'grow',
|
|
199
|
+
0: 'grow-0',
|
|
200
|
+
1: 'grow-1',
|
|
201
|
+
2: 'grow-2',
|
|
202
|
+
3: 'grow-3'
|
|
203
|
+
},
|
|
204
|
+
shrink: {
|
|
205
|
+
true: 'shrink',
|
|
206
|
+
0: 'shrink-0',
|
|
207
|
+
1: 'shrink-1',
|
|
208
|
+
2: 'shrink-2',
|
|
209
|
+
3: 'shrink-3'
|
|
210
|
+
},
|
|
211
|
+
order: {
|
|
212
|
+
first: 'order-first',
|
|
213
|
+
last: 'order-last',
|
|
214
|
+
none: 'order-none',
|
|
215
|
+
0: 'order-0',
|
|
216
|
+
1: 'order-1',
|
|
217
|
+
2: 'order-2',
|
|
218
|
+
3: 'order-3',
|
|
219
|
+
4: 'order-4',
|
|
220
|
+
5: 'order-5',
|
|
221
|
+
6: 'order-6',
|
|
222
|
+
7: 'order-7',
|
|
223
|
+
8: 'order-8',
|
|
224
|
+
9: 'order-9',
|
|
225
|
+
10: 'order-10'
|
|
226
|
+
},
|
|
227
|
+
fill: {
|
|
228
|
+
true: 'flex-1'
|
|
229
|
+
},
|
|
230
|
+
vertical: {
|
|
231
|
+
true: 'flex-col'
|
|
232
|
+
},
|
|
233
|
+
horizontal: {
|
|
234
|
+
true: 'flex-row'
|
|
235
|
+
},
|
|
236
|
+
center: {
|
|
237
|
+
true: 'items-center justify-center'
|
|
238
|
+
},
|
|
239
|
+
p: spacingClasses('p'),
|
|
240
|
+
pt: spacingClasses('pt'),
|
|
241
|
+
pr: spacingClasses('pr'),
|
|
242
|
+
pb: spacingClasses('pb'),
|
|
243
|
+
pl: spacingClasses('pl'),
|
|
244
|
+
ps: spacingClasses('ps'),
|
|
245
|
+
pe: spacingClasses('pe'),
|
|
246
|
+
px: spacingClasses('px'),
|
|
247
|
+
py: spacingClasses('py'),
|
|
248
|
+
m: spacingClasses('m'),
|
|
249
|
+
mt: spacingClasses('mt'),
|
|
250
|
+
mr: spacingClasses('mr'),
|
|
251
|
+
mb: spacingClasses('mb'),
|
|
252
|
+
ml: spacingClasses('ml'),
|
|
253
|
+
ms: spacingClasses('ms'),
|
|
254
|
+
me: spacingClasses('me'),
|
|
255
|
+
mx: spacingClasses('mx'),
|
|
256
|
+
my: spacingClasses('my'),
|
|
257
|
+
w: sizingClasses('w'),
|
|
258
|
+
h: sizingClasses('h'),
|
|
259
|
+
minW: sizingClasses('min-w'),
|
|
260
|
+
maxW: sizingClasses('max-w'),
|
|
261
|
+
minH: sizingClasses('min-h'),
|
|
262
|
+
maxH: sizingClasses('max-h'),
|
|
263
|
+
fullWidth: {
|
|
264
|
+
true: 'w-full'
|
|
265
|
+
},
|
|
266
|
+
fullHeight: {
|
|
267
|
+
true: 'h-full'
|
|
268
|
+
},
|
|
269
|
+
bg: bgClasses,
|
|
270
|
+
opacity: {
|
|
271
|
+
disabled: 'opacity-disabled',
|
|
272
|
+
hover: 'opacity-hover'
|
|
273
|
+
},
|
|
274
|
+
shadow: {
|
|
275
|
+
true: 'shadow-box',
|
|
276
|
+
box: 'shadow-box',
|
|
277
|
+
none: 'shadow-none',
|
|
278
|
+
sm: 'shadow-sm',
|
|
279
|
+
md: 'shadow-md',
|
|
280
|
+
lg: 'shadow-lg',
|
|
281
|
+
xl: 'shadow-xl'
|
|
282
|
+
},
|
|
283
|
+
rounded: roundedClasses,
|
|
284
|
+
radius: roundedClasses,
|
|
285
|
+
borderStyle: {
|
|
286
|
+
solid: 'border-solid',
|
|
287
|
+
dashed: 'border-dashed',
|
|
288
|
+
dotted: 'border-dotted',
|
|
289
|
+
double: 'border-double'
|
|
290
|
+
},
|
|
291
|
+
borderColor: borderColorClasses,
|
|
292
|
+
borderWidth: {
|
|
293
|
+
none: 'border-none',
|
|
294
|
+
'0.5': 'border-[0.5px]',
|
|
295
|
+
1: 'border-px',
|
|
296
|
+
'1.5': 'border-[1.5px]',
|
|
297
|
+
2: 'border-2'
|
|
298
|
+
},
|
|
299
|
+
cursor: {
|
|
300
|
+
auto: 'cursor-auto',
|
|
301
|
+
default: 'cursor-default',
|
|
302
|
+
pointer: 'cursor-pointer',
|
|
303
|
+
wait: 'cursor-wait',
|
|
304
|
+
help: 'cursor-help',
|
|
305
|
+
notAllowed: 'cursor-not-allowed'
|
|
306
|
+
},
|
|
307
|
+
color: colorClasses,
|
|
308
|
+
fontWeight: {
|
|
309
|
+
normal: 'font-normal',
|
|
310
|
+
medium: 'font-medium',
|
|
311
|
+
semibold: 'font-semibold',
|
|
312
|
+
bold: 'font-bold',
|
|
313
|
+
extrabold: 'font-extrabold'
|
|
314
|
+
},
|
|
315
|
+
lineHeight: {
|
|
316
|
+
1: 'leading-none',
|
|
317
|
+
'1.4': 'leading-[1.4]'
|
|
318
|
+
},
|
|
319
|
+
textAlign: {
|
|
320
|
+
left: 'text-left',
|
|
321
|
+
center: 'text-center',
|
|
322
|
+
right: 'text-right'
|
|
323
|
+
}
|
|
324
|
+
},
|
|
325
|
+
compoundVariants: [],
|
|
326
|
+
defaultVariants: {}
|
|
327
|
+
});
|
|
328
|
+
export { boxVariants, sizingPresets };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { HexColor } from '@particle-network/ui-shared';
|
|
3
|
+
import type { BoxVariants, Sizing } from './box-theme';
|
|
4
|
+
export interface BoxProps<T extends HTMLElement = HTMLDivElement> extends Omit<React.HTMLAttributes<T>, 'color'>, Omit<BoxVariants, 'color' | 'w' | 'h' | 'minW' | 'maxW' | 'minH' | 'maxH'> {
|
|
5
|
+
as?: React.ElementType;
|
|
6
|
+
w?: Sizing | number;
|
|
7
|
+
h?: Sizing | number;
|
|
8
|
+
minW?: Sizing | number;
|
|
9
|
+
maxW?: Sizing | number;
|
|
10
|
+
minH?: Sizing | number;
|
|
11
|
+
maxH?: Sizing | number;
|
|
12
|
+
color?: BoxVariants['color'] | HexColor;
|
|
13
|
+
}
|
|
14
|
+
export declare const Box: React.ForwardRefExoticComponent<BoxProps<HTMLDivElement> & React.RefAttributes<HTMLElement>>;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef, useMemo } from "react";
|
|
3
|
+
import { cn } from "@heroui/theme";
|
|
4
|
+
import { boxVariants } from "./box-theme.js";
|
|
5
|
+
const Box = /*#__PURE__*/ forwardRef(({ as, position, display, aspect, overflow, zIndex, direction, items, justify, gap, wrap, self, fill, vertical, horizontal, center, grow, shrink, order, p, pt, pr, pb, pl, ps, pe, px, py, m, mt, mr, mb, ml, ms, me, mx, my, w, h, minW, maxW, minH, maxH, fullWidth, fullHeight, bg, opacity, shadow, rounded, radius, borderStyle, cursor, color, fontWeight, lineHeight, textAlign, style = {}, className, ...props }, ref)=>{
|
|
6
|
+
const Component = as || 'div';
|
|
7
|
+
const boxStyle = useMemo(()=>({
|
|
8
|
+
width: 'number' == typeof w ? `${w}px` : void 0,
|
|
9
|
+
height: 'number' == typeof h ? `${h}px` : void 0,
|
|
10
|
+
minWidth: 'number' == typeof minW ? `${minW}px` : void 0,
|
|
11
|
+
maxWidth: 'number' == typeof maxW ? `${maxW}px` : void 0,
|
|
12
|
+
minHeight: 'number' == typeof minH ? `${minH}px` : void 0,
|
|
13
|
+
maxHeight: 'number' == typeof maxH ? `${maxH}px` : void 0,
|
|
14
|
+
color: color?.startsWith('#') ? color : void 0,
|
|
15
|
+
...style
|
|
16
|
+
}), [
|
|
17
|
+
w,
|
|
18
|
+
h,
|
|
19
|
+
minW,
|
|
20
|
+
maxW,
|
|
21
|
+
minH,
|
|
22
|
+
maxH,
|
|
23
|
+
color,
|
|
24
|
+
style
|
|
25
|
+
]);
|
|
26
|
+
return /*#__PURE__*/ jsx(Component, {
|
|
27
|
+
ref: ref,
|
|
28
|
+
style: boxStyle,
|
|
29
|
+
className: cn(boxVariants({
|
|
30
|
+
position,
|
|
31
|
+
display,
|
|
32
|
+
aspect,
|
|
33
|
+
overflow,
|
|
34
|
+
zIndex,
|
|
35
|
+
direction,
|
|
36
|
+
items,
|
|
37
|
+
justify,
|
|
38
|
+
gap,
|
|
39
|
+
wrap,
|
|
40
|
+
self,
|
|
41
|
+
fill,
|
|
42
|
+
vertical,
|
|
43
|
+
horizontal,
|
|
44
|
+
center,
|
|
45
|
+
grow,
|
|
46
|
+
shrink,
|
|
47
|
+
order,
|
|
48
|
+
p,
|
|
49
|
+
pt,
|
|
50
|
+
pr,
|
|
51
|
+
pb,
|
|
52
|
+
pl,
|
|
53
|
+
ps,
|
|
54
|
+
pe,
|
|
55
|
+
px,
|
|
56
|
+
py,
|
|
57
|
+
m,
|
|
58
|
+
mt,
|
|
59
|
+
mr,
|
|
60
|
+
mb,
|
|
61
|
+
ml,
|
|
62
|
+
ms,
|
|
63
|
+
me,
|
|
64
|
+
mx,
|
|
65
|
+
my,
|
|
66
|
+
w: w,
|
|
67
|
+
h: h,
|
|
68
|
+
minW: minW,
|
|
69
|
+
maxW: maxW,
|
|
70
|
+
minH: minH,
|
|
71
|
+
maxH: maxH,
|
|
72
|
+
fullWidth,
|
|
73
|
+
fullHeight,
|
|
74
|
+
bg,
|
|
75
|
+
opacity,
|
|
76
|
+
shadow,
|
|
77
|
+
rounded,
|
|
78
|
+
radius,
|
|
79
|
+
borderStyle,
|
|
80
|
+
cursor,
|
|
81
|
+
color: color,
|
|
82
|
+
fontWeight,
|
|
83
|
+
lineHeight,
|
|
84
|
+
textAlign
|
|
85
|
+
}), className),
|
|
86
|
+
...props
|
|
87
|
+
});
|
|
88
|
+
});
|
|
89
|
+
Box.displayName = 'Box';
|
|
90
|
+
export { Box };
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef } from "react";
|
|
3
|
-
import { cn } from "@heroui/theme";
|
|
4
3
|
import { Square } from "./Square.js";
|
|
5
|
-
const Circle = /*#__PURE__*/ forwardRef((
|
|
4
|
+
const Circle = /*#__PURE__*/ forwardRef((props, ref)=>/*#__PURE__*/ jsx(Square, {
|
|
6
5
|
ref: ref,
|
|
7
|
-
|
|
6
|
+
rounded: "full",
|
|
8
7
|
...props
|
|
9
8
|
}));
|
|
10
9
|
Circle.displayName = 'UX.Circle';
|
|
@@ -1,28 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
export type
|
|
4
|
-
export
|
|
5
|
-
export interface FlexProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
6
|
-
fill?: boolean;
|
|
7
|
-
fullWidth?: boolean;
|
|
8
|
-
direction?: 'row' | 'col' | 'row-reverse' | 'col-reverse';
|
|
9
|
-
vertical?: boolean;
|
|
10
|
-
center?: boolean;
|
|
11
|
-
items?: AlignItems;
|
|
12
|
-
justify?: JustifyContent;
|
|
13
|
-
grow?: number | true;
|
|
14
|
-
shrink?: number;
|
|
15
|
-
/**
|
|
16
|
-
* 常用的非标准 gap
|
|
17
|
-
* xs - 2px
|
|
18
|
-
* sm - 6px
|
|
19
|
-
* md - 10px
|
|
20
|
-
* lg - 14px
|
|
21
|
-
*/
|
|
22
|
-
gap?: UXSpacing | number;
|
|
23
|
-
wrap?: 'wrap' | 'nowrap' | 'wrap-reverse' | true;
|
|
24
|
-
order?: number;
|
|
25
|
-
self?: 'auto' | 'start' | 'end' | 'end-safe' | 'center' | 'center-safe' | 'stretch' | 'baseline' | 'baseline-last';
|
|
26
|
-
children?: React.ReactNode;
|
|
27
|
-
}
|
|
28
|
-
export declare const Flex: React.ForwardRefExoticComponent<FlexProps & React.RefAttributes<HTMLDivElement>>;
|
|
2
|
+
import type { BoxProps } from './Box/box';
|
|
3
|
+
export type FlexProps = BoxProps;
|
|
4
|
+
export declare const Flex: React.ForwardRefExoticComponent<BoxProps<HTMLDivElement> & React.RefAttributes<HTMLElement>>;
|
|
@@ -1,23 +1,10 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
const isNil = (value)=>null == value;
|
|
6
|
-
const Flex = /*#__PURE__*/ forwardRef(({ fill, fullWidth, direction, center, items, justify, gap, wrap, vertical, grow, shrink, order, self, className, children, ...props }, ref)=>{
|
|
7
|
-
const gapValue = useMemo(()=>{
|
|
8
|
-
if (!gap) return '';
|
|
9
|
-
if ('number' == typeof gap) return `gap-${gap}`;
|
|
10
|
-
if (!isNil(spacingMap[gap])) return `gap-${gap}`;
|
|
11
|
-
return `gap-[${gap}]`;
|
|
12
|
-
}, [
|
|
13
|
-
gap
|
|
14
|
-
]);
|
|
15
|
-
return /*#__PURE__*/ jsx("div", {
|
|
2
|
+
import { forwardRef } from "react";
|
|
3
|
+
import { Box } from "./Box/box.js";
|
|
4
|
+
const Flex = /*#__PURE__*/ forwardRef((props, ref)=>/*#__PURE__*/ jsx(Box, {
|
|
16
5
|
ref: ref,
|
|
17
|
-
|
|
18
|
-
...props
|
|
19
|
-
|
|
20
|
-
});
|
|
21
|
-
});
|
|
6
|
+
display: "flex",
|
|
7
|
+
...props
|
|
8
|
+
}));
|
|
22
9
|
Flex.displayName = 'UX.Flex';
|
|
23
10
|
export { Flex };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { type FlexProps } from './Flex';
|
|
2
|
-
export type HStackProps = Omit<FlexProps, 'direction' | 'vertical'>;
|
|
2
|
+
export type HStackProps = Omit<FlexProps, 'direction' | 'vertical' | 'horizontal'>;
|
|
3
3
|
export declare const HStack: import("react").ForwardRefExoticComponent<HStackProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef } from "react";
|
|
3
|
-
import { cn } from "@heroui/theme";
|
|
4
3
|
import { Center } from "./Center.js";
|
|
5
|
-
const Square = /*#__PURE__*/ forwardRef(({ size,
|
|
4
|
+
const Square = /*#__PURE__*/ forwardRef(({ size, ...props }, ref)=>/*#__PURE__*/ jsx(Center, {
|
|
6
5
|
ref: ref,
|
|
7
6
|
shrink: 0,
|
|
8
|
-
|
|
7
|
+
style: {
|
|
8
|
+
width: `${size}px`,
|
|
9
|
+
height: `${size}px`
|
|
10
|
+
},
|
|
9
11
|
...props
|
|
10
12
|
}));
|
|
11
13
|
Square.displayName = 'UX.Square';
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { type FlexProps } from './Flex';
|
|
2
|
-
export type VStackProps = Omit<FlexProps, 'direction' | 'vertical'>;
|
|
2
|
+
export type VStackProps = Omit<FlexProps, 'direction' | 'vertical' | 'horizontal'>;
|
|
3
3
|
export declare const VStack: import("react").ForwardRefExoticComponent<VStackProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef } from "react";
|
|
3
3
|
import { Flex } from "./Flex.js";
|
|
4
|
-
const VStack = /*#__PURE__*/ forwardRef((
|
|
4
|
+
const VStack = /*#__PURE__*/ forwardRef((props, ref)=>/*#__PURE__*/ jsx(Flex, {
|
|
5
5
|
ref: ref,
|
|
6
6
|
vertical: true,
|
|
7
|
-
items:
|
|
7
|
+
items: "stretch",
|
|
8
8
|
...props
|
|
9
9
|
}));
|
|
10
10
|
VStack.displayName = 'UX.VStack';
|
|
@@ -1,13 +1,28 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef } from "react";
|
|
3
3
|
import { cn } from "@heroui/theme";
|
|
4
|
-
import {
|
|
5
|
-
|
|
4
|
+
import { Box } from "../layout/index.js";
|
|
5
|
+
import { textVariants } from "./text-theme.js";
|
|
6
|
+
const Text = /*#__PURE__*/ forwardRef(({ variant, className, h1, h2, h3, body1, body1Bold, body2, body2Bold, body3, body3Bold, caption1, caption1Bold, fontWeight, lineHeight, align, textAlign, ...props }, ref)=>/*#__PURE__*/ jsx(Box, {
|
|
6
7
|
ref: ref,
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
as: "span",
|
|
9
|
+
textAlign: textAlign || align,
|
|
10
|
+
className: cn(textVariants({
|
|
11
|
+
variant,
|
|
12
|
+
h1,
|
|
13
|
+
h2,
|
|
14
|
+
h3,
|
|
15
|
+
body1,
|
|
16
|
+
body1Bold,
|
|
17
|
+
body2,
|
|
18
|
+
body2Bold,
|
|
19
|
+
body3,
|
|
20
|
+
body3Bold,
|
|
21
|
+
caption1,
|
|
22
|
+
caption1Bold,
|
|
23
|
+
fontWeight,
|
|
24
|
+
lineHeight
|
|
25
|
+
}), className),
|
|
11
26
|
...props
|
|
12
27
|
}));
|
|
13
28
|
Text.displayName = 'UX.Text';
|
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import type { HexColor, UXForegroundColor } from '@particle-network/ui-shared';
|
|
1
|
+
import type { BoxProps } from '../layout';
|
|
3
2
|
type TextVariant = 'h1' | 'h2' | 'h3' | 'body1' | 'body1Bold' | 'body2' | 'body2Bold' | 'body3' | 'body3Bold' | 'caption1' | 'caption1Bold';
|
|
4
|
-
|
|
5
|
-
type TextLineHeight = '1' | '1.4';
|
|
6
|
-
type TextAlign = 'left' | 'center' | 'right';
|
|
7
|
-
export interface TextProps extends React.HTMLAttributes<HTMLSpanElement> {
|
|
3
|
+
export interface TextProps extends BoxProps<HTMLSpanElement> {
|
|
8
4
|
/**
|
|
9
5
|
* | variant | font-size | font-weight |
|
|
10
6
|
* | :----------- | :-------- | :---------- |
|
|
@@ -65,25 +61,6 @@ export interface TextProps extends React.HTMLAttributes<HTMLSpanElement> {
|
|
|
65
61
|
* `10px 500`
|
|
66
62
|
*/
|
|
67
63
|
caption1Bold?: boolean;
|
|
68
|
-
|
|
69
|
-
* | weight | font-weight |
|
|
70
|
-
* | :-------- | :---------: |
|
|
71
|
-
* | normal | 400 |
|
|
72
|
-
* | medium | 500 |
|
|
73
|
-
* | semibold | 600 |
|
|
74
|
-
* | bold | 700 |
|
|
75
|
-
* | extrabold | 800 |
|
|
76
|
-
*/
|
|
77
|
-
fontWeight?: TextWeight;
|
|
78
|
-
color?: UXForegroundColor | HexColor;
|
|
79
|
-
lineHeight?: TextLineHeight;
|
|
80
|
-
align?: TextAlign;
|
|
64
|
+
align?: BoxProps['textAlign'];
|
|
81
65
|
}
|
|
82
|
-
export declare const textClasses: {
|
|
83
|
-
variant: Record<TextVariant, string>;
|
|
84
|
-
color: Record<UXForegroundColor, string>;
|
|
85
|
-
fontWeight: Record<TextWeight, string>;
|
|
86
|
-
lineHeight: Record<TextLineHeight, string>;
|
|
87
|
-
align: Record<TextAlign, string>;
|
|
88
|
-
};
|
|
89
66
|
export {};
|