@particle-network/ui-react 0.5.1-beta.2 → 0.5.1-beta.20
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/ProgressWrapper/index.js +2 -3
- package/dist/components/UXAutocomplete/index.js +1 -2
- package/dist/components/UXButton/button-theme.js +2 -2
- package/dist/components/UXButton/button.js +1 -1
- package/dist/components/UXCheckbox/checkbox.extend.js +16 -13
- package/dist/components/UXChip/chip.extend.d.ts +2 -1
- package/dist/components/UXChip/index.d.ts +1 -1
- package/dist/components/UXColorPicker/color-input.js +1 -1
- package/dist/components/UXColorPicker/color-picker.js +51 -33
- package/dist/components/UXColorPicker/types.d.ts +15 -0
- package/dist/components/UXCopy/index.js +1 -1
- package/dist/components/UXEmpty/index.js +1 -1
- package/dist/components/UXHint/index.js +1 -1
- package/dist/components/UXInput/index.d.ts +6 -6
- package/dist/components/UXInput/input.extend.d.ts +6 -6
- package/dist/components/UXModal/index.d.ts +1 -1
- package/dist/components/UXRadio/radio.extend.js +3 -3
- package/dist/components/UXSlider/use-slider.js +1 -1
- package/dist/components/UXSpinner/spinner.d.ts +1 -5
- package/dist/components/UXSpinner/spinner.js +3 -4
- package/dist/components/UXSwitch/index.d.ts +2 -2
- package/dist/components/UXSwitch/switch.extend.d.ts +2 -2
- package/dist/components/UXSwitch/switch.extend.js +6 -6
- package/dist/components/UXTabs/tabs.classes.js +4 -4
- package/dist/components/UXThemeSwitch/constants.d.ts +9 -0
- package/dist/components/UXThemeSwitch/constants.js +3 -0
- package/dist/components/UXThemeSwitch/custom-theme-config.d.ts +5 -0
- package/dist/components/UXThemeSwitch/custom-theme-config.js +172 -0
- package/dist/components/UXThemeSwitch/index.d.ts +2 -2
- package/dist/components/UXThemeSwitch/index.js +2 -2
- package/dist/components/UXThemeSwitch/theme-item.js +93 -15
- package/dist/components/UXThemeSwitch/theme-switch.d.ts +8 -1
- package/dist/components/UXThemeSwitch/theme-switch.js +20 -5
- package/dist/components/UXThemeSwitch/use-theme.d.ts +4 -1
- package/dist/components/UXThemeSwitch/use-theme.js +9 -57
- package/dist/components/UXThemeSwitch/utils.d.ts +28 -0
- package/dist/components/UXThemeSwitch/utils.js +260 -0
- package/dist/components/UXToast/index.d.ts +1 -1
- package/dist/components/UXToast/index.js +23 -11
- package/dist/components/UXTooltip/index.js +4 -12
- package/dist/components/WrapText/index.d.ts +6 -0
- package/dist/components/WrapText/index.js +15 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +1 -0
- package/dist/components/layout/Box/box-theme.d.ts +2213 -0
- package/dist/components/layout/Box/box-theme.js +344 -0
- package/dist/components/layout/Box/box.d.ts +14 -0
- package/dist/components/layout/Box/box.js +99 -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 +3 -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 +35 -10
- package/dist/components/typography/Text.type.d.ts +4 -26
- package/dist/components/typography/Text.type.js +0 -47
- package/dist/components/typography/text-theme.d.ts +178 -0
- package/dist/components/typography/text-theme.js +79 -0
- package/dist/heroui/constants.d.ts +18 -0
- package/dist/heroui/constants.js +98 -0
- package/dist/heroui/types.d.ts +91 -0
- package/dist/heroui/types.js +0 -0
- package/dist/heroui/utils/colors.d.ts +34 -0
- package/dist/heroui/utils/colors.js +121 -0
- package/dist/heroui/utils/object.d.ts +1 -0
- package/dist/heroui/utils/object.js +17 -0
- package/dist/hooks/useI18n.d.ts +133 -25
- package/dist/hooks/useI18n.js +84 -2
- package/dist/hooks/useLang.d.ts +5 -1
- package/dist/hooks/useLang.js +13 -1
- package/dist/utils/cn.d.ts +2 -0
- package/dist/utils/cn.js +250 -0
- package/dist/utils/common.d.ts +1 -0
- package/dist/utils/common.js +4 -0
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/index.js +3 -1
- package/dist/utils/input-classes.js +2 -2
- package/package.json +7 -5
- package/tailwind-preset.js +84 -160
- package/dist/components/UXThemeSwitch/use-color-scheme.d.ts +0 -5
- package/dist/components/UXThemeSwitch/use-color-scheme.js +0 -11
- package/dist/components/UXThemeSwitch/use-theme-color.d.ts +0 -22
- package/dist/components/UXThemeSwitch/use-theme-color.js +0 -10
- package/dist/components/UXThemeSwitch/use-theme-store.d.ts +0 -41
- package/dist/components/UXThemeSwitch/use-theme-store.js +0 -31
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { type
|
|
2
|
+
import { type HexColor, type UXComponentColor, type UXRadius } from '@particle-network/ui-shared';
|
|
3
3
|
export interface ProgressWrapperProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
4
4
|
/**
|
|
5
5
|
* 进度 (%)
|
|
@@ -24,7 +24,7 @@ export interface ProgressWrapperProps extends React.HTMLAttributes<HTMLDivElemen
|
|
|
24
24
|
/**
|
|
25
25
|
* 进度条颜色
|
|
26
26
|
*/
|
|
27
|
-
color?:
|
|
27
|
+
color?: UXComponentColor | 'transparent' | HexColor;
|
|
28
28
|
/**
|
|
29
29
|
* 进度条 SVG 样式
|
|
30
30
|
*/
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useMemo, useRef } from "react";
|
|
4
|
-
import {
|
|
5
|
-
import { radiusMap } from "@particle-network/ui-shared";
|
|
4
|
+
import { radiusMap, useThemeColor } from "@particle-network/ui-shared";
|
|
6
5
|
import { useSize } from "ahooks";
|
|
6
|
+
import { cn } from "../../utils/index.js";
|
|
7
7
|
import { Center } from "../layout/index.js";
|
|
8
|
-
import { useThemeColor } from "../UXThemeSwitch/use-theme-color.js";
|
|
9
8
|
const ProgressWrapper = ({ className, value = 0, width, height, radius = 'sm', strokeWidth = 1, color = 'primary', children, svgClassName, ...restProps })=>{
|
|
10
9
|
const uxColors = useThemeColor();
|
|
11
10
|
const autoLayout = !width && !height;
|
|
@@ -3,10 +3,9 @@ import "react";
|
|
|
3
3
|
import { Autocomplete, AutocompleteItem, AutocompleteSection } from "@heroui/autocomplete";
|
|
4
4
|
import ChevronDownIcon from "@particle-network/icons/web/ChevronDownIcon";
|
|
5
5
|
const UXAutocomplete = (props)=>{
|
|
6
|
-
const {
|
|
6
|
+
const { classNames = {}, radius = 'sm', labelPlacement = 'outside-top', ...restProps } = props;
|
|
7
7
|
const { base, popoverContent, selectorButton, endContentWrapper, clearButton, listboxWrapper } = classNames;
|
|
8
8
|
return /*#__PURE__*/ jsx(Autocomplete, {
|
|
9
|
-
fullWidth: fullWidth,
|
|
10
9
|
classNames: {
|
|
11
10
|
base: [
|
|
12
11
|
'ux-base',
|
|
@@ -381,13 +381,13 @@ const button_theme_button = tv({
|
|
|
381
381
|
isSelected: true,
|
|
382
382
|
color: 'default',
|
|
383
383
|
variant: 'solid',
|
|
384
|
-
class: 'bg-
|
|
384
|
+
class: 'bg-cursor text-cursor-foreground'
|
|
385
385
|
},
|
|
386
386
|
{
|
|
387
387
|
isSelected: true,
|
|
388
388
|
color: 'secondary',
|
|
389
389
|
variant: 'solid',
|
|
390
|
-
class: 'bg-
|
|
390
|
+
class: 'bg-cursor text-cursor-foreground'
|
|
391
391
|
},
|
|
392
392
|
{
|
|
393
393
|
isSelected: true,
|
|
@@ -5,7 +5,7 @@ import { UXSpinner } from "../UXSpinner/index.js";
|
|
|
5
5
|
import { useButton } from "./use-button.js";
|
|
6
6
|
const Button = forwardRef((props, ref)=>{
|
|
7
7
|
const { Component, domRef, children, spinnerSize, spinner = /*#__PURE__*/ jsx(UXSpinner, {
|
|
8
|
-
color: "
|
|
8
|
+
color: "current",
|
|
9
9
|
size: spinnerSize
|
|
10
10
|
}), spinnerPlacement, startContent, endContent, isLoading, disableRipple, getButtonProps, getRippleProps, isIconOnly } = useButton({
|
|
11
11
|
...props,
|
|
@@ -7,7 +7,7 @@ const ExtendedCheckbox = extendVariants(Checkbox, {
|
|
|
7
7
|
wrapper: 'after:bg-primary after:text-primary-foreground text-primary-foreground'
|
|
8
8
|
},
|
|
9
9
|
secondary: {
|
|
10
|
-
wrapper: 'after:bg-
|
|
10
|
+
wrapper: 'after:bg-cursor after:text-cursor-foreground text-cursor-foreground'
|
|
11
11
|
},
|
|
12
12
|
success: {
|
|
13
13
|
wrapper: 'after:bg-success after:text-success-foreground text-success-foreground'
|
|
@@ -27,34 +27,37 @@ const ExtendedCheckbox = extendVariants(Checkbox, {
|
|
|
27
27
|
},
|
|
28
28
|
size: {
|
|
29
29
|
sm: {
|
|
30
|
+
base: 'gap-1.5',
|
|
30
31
|
wrapper: [
|
|
31
32
|
'w-3.5 h-3.5 me-0',
|
|
32
33
|
'rounded-[calc(theme(borderRadius.medium)*0.2)]',
|
|
33
34
|
'before:rounded-[calc(theme(borderRadius.medium)*0.2)] before:border-secondary before:border-1',
|
|
34
35
|
'after:rounded-[calc(theme(borderRadius.medium)*0.2)]'
|
|
35
36
|
],
|
|
36
|
-
label: '!text-
|
|
37
|
-
icon: 'h-2
|
|
37
|
+
label: '!text-body2 font-medium',
|
|
38
|
+
icon: 'h-2'
|
|
38
39
|
},
|
|
39
40
|
md: {
|
|
41
|
+
base: 'gap-2',
|
|
40
42
|
wrapper: [
|
|
41
43
|
'w-4 h-4 me-0',
|
|
42
|
-
'rounded-[calc(theme(borderRadius.medium)*0.
|
|
43
|
-
'before:rounded-[calc(theme(borderRadius.medium)*0.
|
|
44
|
-
'after:rounded-[calc(theme(borderRadius.medium)*0.
|
|
44
|
+
'rounded-[calc(theme(borderRadius.medium)*0.3)]',
|
|
45
|
+
'before:rounded-[calc(theme(borderRadius.medium)*0.3)] before:border-secondary before:border-1.5',
|
|
46
|
+
'after:rounded-[calc(theme(borderRadius.medium)*0.3)]'
|
|
45
47
|
],
|
|
46
48
|
label: '!text-body2 font-medium',
|
|
47
|
-
icon: 'h-
|
|
49
|
+
icon: 'h-2.5'
|
|
48
50
|
},
|
|
49
51
|
lg: {
|
|
52
|
+
base: 'gap-2',
|
|
50
53
|
wrapper: [
|
|
51
54
|
'w-[18px] h-[18px] me-0',
|
|
52
|
-
'rounded-[calc(theme(borderRadius.medium)*0.
|
|
53
|
-
'before:rounded-[calc(theme(borderRadius.medium)*0.
|
|
54
|
-
'after:rounded-[calc(theme(borderRadius.medium)*0.
|
|
55
|
+
'rounded-[calc(theme(borderRadius.medium)*0.4)]',
|
|
56
|
+
'before:rounded-[calc(theme(borderRadius.medium)*0.4)] before:border-secondary before:border-1.5',
|
|
57
|
+
'after:rounded-[calc(theme(borderRadius.medium)*0.4)]'
|
|
55
58
|
],
|
|
56
59
|
label: '!text-body1 font-medium',
|
|
57
|
-
icon: 'h-3
|
|
60
|
+
icon: 'h-3'
|
|
58
61
|
}
|
|
59
62
|
},
|
|
60
63
|
radius: {
|
|
@@ -144,10 +147,10 @@ const ExtendedCheckbox = extendVariants(Checkbox, {
|
|
|
144
147
|
},
|
|
145
148
|
labelPlacement: {
|
|
146
149
|
left: {
|
|
147
|
-
base: 'flex-row-reverse
|
|
150
|
+
base: 'flex-row-reverse'
|
|
148
151
|
},
|
|
149
152
|
right: {
|
|
150
|
-
base: 'flex-row
|
|
153
|
+
base: 'flex-row'
|
|
151
154
|
}
|
|
152
155
|
}
|
|
153
156
|
},
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
2
|
import { type ChipProps } from '@heroui/chip';
|
|
3
|
+
import type { HexColor } from '@particle-network/ui-shared';
|
|
3
4
|
type ExtendedChipProps = Omit<ChipProps, 'color'> & {
|
|
4
|
-
color?: 'default' | 'primary' | 'secondary' | 'success' | 'warning' | 'alert' | 'danger' | 'bullish' | 'bearish' |
|
|
5
|
+
color?: 'default' | 'primary' | 'secondary' | 'success' | 'warning' | 'alert' | 'danger' | 'bullish' | 'bearish' | HexColor;
|
|
5
6
|
};
|
|
6
7
|
declare const ExtendedChip: React.ForwardRefExoticComponent<ExtendedChipProps>;
|
|
7
8
|
export default ExtendedChip;
|
|
@@ -2,5 +2,5 @@ import React from 'react';
|
|
|
2
2
|
import ExtendedChip from './chip.extend';
|
|
3
3
|
export type UXChipProps = React.ComponentPropsWithRef<typeof ExtendedChip>;
|
|
4
4
|
export declare const UXChip: import("@heroui/system-rsc").InternalForwardRefRenderFunction<"div", Omit<import("@heroui/chip").ChipProps, "color"> & {
|
|
5
|
-
color?: "default" | "primary" | "secondary" | "success" | "warning" | "alert" | "danger" | "bullish" | "bearish" |
|
|
5
|
+
color?: "default" | "primary" | "secondary" | "success" | "warning" | "alert" | "danger" | "bullish" | "bearish" | import("@particle-network/ui-shared").HexColor;
|
|
6
6
|
}, never>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import "react";
|
|
3
3
|
import { ColorField, Input } from "react-aria-components";
|
|
4
|
-
import { cn } from "
|
|
4
|
+
import { cn } from "../../utils/index.js";
|
|
5
5
|
const inputClassName = 'w-full h-[30px] rounded-small border-none bg-background-200 px-2.5 text-tiny text-foreground focus:outline-none focus:ring-1 focus:ring-foreground text-center';
|
|
6
6
|
const ColorInput = (props)=>/*#__PURE__*/ jsx(ColorField, {
|
|
7
7
|
...props,
|
|
@@ -1,20 +1,23 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
4
4
|
import { ColorArea, ColorPicker, ColorSlider, ColorSwatch, ColorThumb, SliderTrack, parseColor } from "react-aria-components";
|
|
5
|
-
import { cn } from "@heroui/theme";
|
|
6
5
|
import ColorPickerIcon from "@particle-network/icons/web/ColorPickerIcon";
|
|
7
6
|
import RefreshCcwIcon from "@particle-network/icons/web/RefreshCcwIcon";
|
|
7
|
+
import { cn } from "../../utils/index.js";
|
|
8
8
|
import { HStack } from "../layout/index.js";
|
|
9
9
|
import { UXButton } from "../UXButton/index.js";
|
|
10
10
|
import { UXPopover, UXPopoverContent, UXPopoverTrigger } from "../UXPopover/index.js";
|
|
11
|
+
import { useThemeColor } from "../UXThemeSwitch/index.js";
|
|
11
12
|
import { ColorFields } from "./color-fields.js";
|
|
12
13
|
import { ColorInput } from "./color-input.js";
|
|
13
14
|
import { normalizeColor } from "./utils.js";
|
|
14
|
-
const UXColorPicker = ({ className, value, defaultValue, onChange, onChangeEnd, onValueChange, onValueChangeEnd,
|
|
15
|
+
const UXColorPicker = ({ className, isDisabled, isIconOnly, placement = 'bottom-start', value, defaultValue, onChange, onChangeEnd, onValueChange, onValueChangeEnd, isChanged, onReset })=>{
|
|
16
|
+
const colors = useThemeColor();
|
|
15
17
|
const isControlled = void 0 !== value;
|
|
16
18
|
const [pickerKey, setPickerKey] = useState(0);
|
|
17
19
|
const [isInputFocused, setIsInputFocused] = useState(false);
|
|
20
|
+
const [isInteracting, setIsInteracting] = useState(false);
|
|
18
21
|
const getInitialColor = ()=>{
|
|
19
22
|
if (isControlled && value) return normalizeColor(value);
|
|
20
23
|
if (defaultValue) return normalizeColor(defaultValue);
|
|
@@ -29,12 +32,13 @@ const UXColorPicker = ({ className, value, defaultValue, onChange, onChangeEnd,
|
|
|
29
32
|
return parseColor('#000000');
|
|
30
33
|
});
|
|
31
34
|
const currentColor = useMemo(()=>{
|
|
32
|
-
if (isControlled && value) return normalizeColor(value);
|
|
35
|
+
if (isControlled && value && !isInteracting) return normalizeColor(value);
|
|
33
36
|
return internalColor;
|
|
34
37
|
}, [
|
|
35
38
|
value,
|
|
36
39
|
internalColor,
|
|
37
|
-
isControlled
|
|
40
|
+
isControlled,
|
|
41
|
+
isInteracting
|
|
38
42
|
]);
|
|
39
43
|
useEffect(()=>{
|
|
40
44
|
const initialColor = getInitialColor();
|
|
@@ -60,7 +64,10 @@ const UXColorPicker = ({ className, value, defaultValue, onChange, onChangeEnd,
|
|
|
60
64
|
]);
|
|
61
65
|
const handleChange = useCallback((color)=>{
|
|
62
66
|
if (color) {
|
|
63
|
-
|
|
67
|
+
if (isControlled) {
|
|
68
|
+
setInternalColor(color);
|
|
69
|
+
setIsInteracting(true);
|
|
70
|
+
} else setInternalColor(color);
|
|
64
71
|
onChange?.(color);
|
|
65
72
|
onValueChange?.(color.toString('hex'));
|
|
66
73
|
}
|
|
@@ -84,6 +91,7 @@ const UXColorPicker = ({ className, value, defaultValue, onChange, onChangeEnd,
|
|
|
84
91
|
]);
|
|
85
92
|
const handleChangeEnd = useCallback((color)=>{
|
|
86
93
|
if (color) {
|
|
94
|
+
setIsInteracting(false);
|
|
87
95
|
onChangeEnd?.(color);
|
|
88
96
|
onValueChangeEnd?.(color.toString('hex'));
|
|
89
97
|
}
|
|
@@ -92,13 +100,16 @@ const UXColorPicker = ({ className, value, defaultValue, onChange, onChangeEnd,
|
|
|
92
100
|
onValueChangeEnd
|
|
93
101
|
]);
|
|
94
102
|
const hasChanged = useMemo(()=>{
|
|
103
|
+
if (void 0 !== isChanged) return isChanged;
|
|
95
104
|
const initialHex = initialColorRef.current.toString('hex');
|
|
96
105
|
const currentHex = currentColor.toString('hex');
|
|
97
106
|
return initialHex !== currentHex;
|
|
98
107
|
}, [
|
|
99
|
-
currentColor
|
|
108
|
+
currentColor,
|
|
109
|
+
isChanged
|
|
100
110
|
]);
|
|
101
111
|
const handleReset = ()=>{
|
|
112
|
+
if (onReset) return void onReset();
|
|
102
113
|
const resetColor = initialColorRef.current;
|
|
103
114
|
if (!isControlled) {
|
|
104
115
|
setInternalColor(resetColor);
|
|
@@ -118,22 +129,23 @@ const UXColorPicker = ({ className, value, defaultValue, onChange, onChangeEnd,
|
|
|
118
129
|
handleChangeEnd
|
|
119
130
|
]);
|
|
120
131
|
return /*#__PURE__*/ jsx(ColorPicker, {
|
|
121
|
-
value:
|
|
132
|
+
value: currentColor,
|
|
122
133
|
defaultValue: !isControlled && pickerKey > 0 ? internalColor : defaultValue,
|
|
123
134
|
onChange: handleChange,
|
|
124
135
|
children: /*#__PURE__*/ jsxs(HStack, {
|
|
125
136
|
gap: 2,
|
|
126
|
-
className: cn('rounded-small bg-background-200
|
|
137
|
+
className: cn(!isIconOnly && 'px-md rounded-small bg-background-200 h-[30px] w-[8.5rem]', isDisabled && 'opacity-disabled', isInputFocused && 'ring-foreground ring-1', className),
|
|
127
138
|
children: [
|
|
128
139
|
/*#__PURE__*/ jsxs(UXPopover, {
|
|
129
140
|
placement: placement,
|
|
130
141
|
children: [
|
|
131
142
|
/*#__PURE__*/ jsx(UXPopoverTrigger, {
|
|
132
143
|
children: /*#__PURE__*/ jsx(UXButton, {
|
|
144
|
+
radius: "none",
|
|
133
145
|
size: "auto",
|
|
134
146
|
isDisabled: isDisabled,
|
|
135
147
|
children: /*#__PURE__*/ jsx(ColorSwatch, {
|
|
136
|
-
className:
|
|
148
|
+
className: cn('h-4 w-4 rounded-[4px]', internalColor.toString('hex') === colors.bg200 && 'border-foreground/10 border')
|
|
137
149
|
})
|
|
138
150
|
})
|
|
139
151
|
}),
|
|
@@ -147,9 +159,10 @@ const UXColorPicker = ({ className, value, defaultValue, onChange, onChangeEnd,
|
|
|
147
159
|
xChannel: "saturation",
|
|
148
160
|
yChannel: "brightness",
|
|
149
161
|
className: "aspect-square w-full overflow-hidden rounded-lg",
|
|
162
|
+
onChange: handleChange,
|
|
150
163
|
onChangeEnd: handleChangeEnd,
|
|
151
164
|
children: /*#__PURE__*/ jsx(ColorThumb, {
|
|
152
|
-
className: "
|
|
165
|
+
className: "h-4 w-4 rounded-full border-2 border-white shadow-[0_2px_4px_rgba(0,0,0,0.2)]"
|
|
153
166
|
})
|
|
154
167
|
}),
|
|
155
168
|
/*#__PURE__*/ jsxs(HStack, {
|
|
@@ -173,11 +186,12 @@ const UXColorPicker = ({ className, value, defaultValue, onChange, onChangeEnd,
|
|
|
173
186
|
className: "min-w-0 flex-1",
|
|
174
187
|
colorSpace: "hsl",
|
|
175
188
|
orientation: "horizontal",
|
|
189
|
+
onChange: handleChange,
|
|
176
190
|
onChangeEnd: handleChangeEnd,
|
|
177
191
|
children: /*#__PURE__*/ jsx(SliderTrack, {
|
|
178
192
|
className: "h-3 rounded-full",
|
|
179
193
|
children: /*#__PURE__*/ jsx(ColorThumb, {
|
|
180
|
-
className: "top-[50%] z-10 h-4 w-4 rounded-full border-2 border-white"
|
|
194
|
+
className: "top-[50%] z-10 h-4 w-4 rounded-full border-2 border-white shadow-[0_2px_4px_rgba(0,0,0,0.2)]"
|
|
181
195
|
})
|
|
182
196
|
})
|
|
183
197
|
})
|
|
@@ -185,7 +199,7 @@ const UXColorPicker = ({ className, value, defaultValue, onChange, onChangeEnd,
|
|
|
185
199
|
}),
|
|
186
200
|
/*#__PURE__*/ jsx(ColorFields, {
|
|
187
201
|
defaultValue: !isControlled && pickerKey > 0 ? internalColor : defaultValue,
|
|
188
|
-
value:
|
|
202
|
+
value: currentColor,
|
|
189
203
|
onChange: handleColorFieldsChange
|
|
190
204
|
})
|
|
191
205
|
]
|
|
@@ -193,26 +207,30 @@ const UXColorPicker = ({ className, value, defaultValue, onChange, onChangeEnd,
|
|
|
193
207
|
})
|
|
194
208
|
]
|
|
195
209
|
}),
|
|
196
|
-
/*#__PURE__*/
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
210
|
+
!isIconOnly && /*#__PURE__*/ jsxs(Fragment, {
|
|
211
|
+
children: [
|
|
212
|
+
/*#__PURE__*/ jsx(ColorInput, {
|
|
213
|
+
isDisabled: isDisabled,
|
|
214
|
+
inputClassName: "focus:ring-0 px-0 text-left flex-1 relative bg-transparent",
|
|
215
|
+
value: currentColor,
|
|
216
|
+
defaultValue: !isControlled && pickerKey > 0 ? internalColor : defaultValue,
|
|
217
|
+
onChange: handleColorFieldsChange,
|
|
218
|
+
onFocus: ()=>setIsInputFocused(true),
|
|
219
|
+
onBlur: ()=>setIsInputFocused(false)
|
|
220
|
+
}),
|
|
221
|
+
hasChanged ? /*#__PURE__*/ jsx(UXButton, {
|
|
222
|
+
isIconOnly: true,
|
|
223
|
+
"aria-label": "Reset color",
|
|
224
|
+
isDisabled: isDisabled,
|
|
225
|
+
size: "sm",
|
|
226
|
+
variant: "light",
|
|
227
|
+
color: "secondary",
|
|
228
|
+
onPress: handleReset,
|
|
229
|
+
children: /*#__PURE__*/ jsx(RefreshCcwIcon, {})
|
|
230
|
+
}) : /*#__PURE__*/ jsx("div", {
|
|
231
|
+
className: "size-4 shrink-0"
|
|
232
|
+
})
|
|
233
|
+
]
|
|
216
234
|
})
|
|
217
235
|
]
|
|
218
236
|
})
|
|
@@ -26,11 +26,26 @@ export interface UXColorPickerProps {
|
|
|
26
26
|
* HEX 格式颜色变化结束回调(释放时调用)
|
|
27
27
|
*/
|
|
28
28
|
onValueChangeEnd?: (color: string) => void;
|
|
29
|
+
/**
|
|
30
|
+
* 是否已改变(展示 reset 按钮)
|
|
31
|
+
*/
|
|
32
|
+
isChanged?: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* 重置回调
|
|
35
|
+
*/
|
|
36
|
+
onReset?: () => void;
|
|
29
37
|
/**
|
|
30
38
|
* 是否禁用
|
|
31
39
|
*/
|
|
32
40
|
isDisabled?: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Popover 位置
|
|
43
|
+
*/
|
|
33
44
|
placement?: UXPopoverProps['placement'];
|
|
45
|
+
/**
|
|
46
|
+
* 是否只显示图标
|
|
47
|
+
*/
|
|
48
|
+
isIconOnly?: boolean;
|
|
34
49
|
}
|
|
35
50
|
export interface ColorFieldsProps extends Pick<UXColorPickerProps, 'value' | 'defaultValue'> {
|
|
36
51
|
/**
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import react from "react";
|
|
3
|
-
import { cn } from "@heroui/theme";
|
|
4
3
|
import CopyIcon from "@particle-network/icons/web/CopyIcon";
|
|
5
4
|
import copy_to_clipboard from "copy-to-clipboard";
|
|
6
5
|
import { useI18n } from "../../hooks/useI18n.js";
|
|
6
|
+
import { cn } from "../../utils/index.js";
|
|
7
7
|
import { toast } from "../UXToast/index.js";
|
|
8
8
|
import { UXTooltip } from "../UXTooltip/index.js";
|
|
9
9
|
import { shortAddress } from "./utils.js";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import "react";
|
|
3
3
|
import { forwardRef } from "@heroui/system";
|
|
4
|
-
import { cn } from "@heroui/theme";
|
|
5
4
|
import EmptyIcon from "@particle-network/icons/web/EmptyIcon";
|
|
6
5
|
import { useI18n } from "../../hooks/useI18n.js";
|
|
6
|
+
import { cn } from "../../utils/index.js";
|
|
7
7
|
import { VStack } from "../layout/index.js";
|
|
8
8
|
import { Text } from "../typography/Text.js";
|
|
9
9
|
const UXEmpty = forwardRef((props, ref)=>{
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import "react";
|
|
3
|
-
import { cn } from "@heroui/theme";
|
|
4
3
|
import CircleQuestionIcon from "@particle-network/icons/web/CircleQuestionIcon";
|
|
5
4
|
import { Center, UXPopover, UXPopoverContent, UXPopoverTrigger, UXTooltip } from "../index.js";
|
|
5
|
+
import { cn } from "../../utils/index.js";
|
|
6
6
|
const UXHint = (props)=>{
|
|
7
7
|
const { content, children, buttonClassName, iconClassName, triggerType = 'hover', ...restProps } = props;
|
|
8
8
|
const renderTriggerContent = ()=>/*#__PURE__*/ jsx(Center, {
|
|
@@ -5,11 +5,11 @@ export declare const UXInput: React.ForwardRefExoticComponent<(Omit<Omit<import(
|
|
|
5
5
|
as?: import("@heroui/system-rsc").As<any> | undefined;
|
|
6
6
|
} & {
|
|
7
7
|
variant?: "flat" | "bordered" | undefined;
|
|
8
|
-
textAlign?: "
|
|
8
|
+
textAlign?: "right" | "left" | "center" | undefined;
|
|
9
9
|
isColorText?: boolean | undefined;
|
|
10
|
-
color?: "
|
|
10
|
+
color?: "secondary" | "primary" | "success" | "warning" | "danger" | "bullish" | "bearish" | "default" | undefined;
|
|
11
11
|
size?: "sm" | "md" | "lg" | undefined;
|
|
12
|
-
radius?: "
|
|
12
|
+
radius?: "full" | "sm" | "md" | "lg" | "none" | undefined;
|
|
13
13
|
labelPlacement?: "inside" | undefined;
|
|
14
14
|
fullWidth?: boolean | undefined;
|
|
15
15
|
isClearable?: boolean | undefined;
|
|
@@ -21,11 +21,11 @@ export declare const UXInput: React.ForwardRefExoticComponent<(Omit<Omit<import(
|
|
|
21
21
|
as?: import("@heroui/system-rsc").As<any> | undefined;
|
|
22
22
|
} & {
|
|
23
23
|
variant?: "flat" | "bordered" | undefined;
|
|
24
|
-
textAlign?: "
|
|
24
|
+
textAlign?: "right" | "left" | "center" | undefined;
|
|
25
25
|
isColorText?: boolean | undefined;
|
|
26
|
-
color?: "
|
|
26
|
+
color?: "secondary" | "primary" | "success" | "warning" | "danger" | "bullish" | "bearish" | "default" | undefined;
|
|
27
27
|
size?: "sm" | "md" | "lg" | undefined;
|
|
28
|
-
radius?: "
|
|
28
|
+
radius?: "full" | "sm" | "md" | "lg" | "none" | undefined;
|
|
29
29
|
labelPlacement?: "inside" | undefined;
|
|
30
30
|
fullWidth?: boolean | undefined;
|
|
31
31
|
isClearable?: boolean | undefined;
|
|
@@ -2,11 +2,11 @@ declare const ExtendedInput: import("react").ForwardRefExoticComponent<(Omit<imp
|
|
|
2
2
|
as?: import("@heroui/system-rsc").As<any> | undefined;
|
|
3
3
|
} & {
|
|
4
4
|
variant?: "flat" | "bordered" | undefined;
|
|
5
|
-
textAlign?: "
|
|
5
|
+
textAlign?: "right" | "left" | "center" | undefined;
|
|
6
6
|
isColorText?: boolean | undefined;
|
|
7
|
-
color?: "
|
|
7
|
+
color?: "secondary" | "primary" | "success" | "warning" | "danger" | "bullish" | "bearish" | "default" | undefined;
|
|
8
8
|
size?: "sm" | "md" | "lg" | undefined;
|
|
9
|
-
radius?: "
|
|
9
|
+
radius?: "full" | "sm" | "md" | "lg" | "none" | undefined;
|
|
10
10
|
labelPlacement?: "inside" | undefined;
|
|
11
11
|
fullWidth?: boolean | undefined;
|
|
12
12
|
isClearable?: boolean | undefined;
|
|
@@ -18,11 +18,11 @@ declare const ExtendedInput: import("react").ForwardRefExoticComponent<(Omit<imp
|
|
|
18
18
|
as?: import("@heroui/system-rsc").As<any> | undefined;
|
|
19
19
|
} & {
|
|
20
20
|
variant?: "flat" | "bordered" | undefined;
|
|
21
|
-
textAlign?: "
|
|
21
|
+
textAlign?: "right" | "left" | "center" | undefined;
|
|
22
22
|
isColorText?: boolean | undefined;
|
|
23
|
-
color?: "
|
|
23
|
+
color?: "secondary" | "primary" | "success" | "warning" | "danger" | "bullish" | "bearish" | "default" | undefined;
|
|
24
24
|
size?: "sm" | "md" | "lg" | undefined;
|
|
25
|
-
radius?: "
|
|
25
|
+
radius?: "full" | "sm" | "md" | "lg" | "none" | undefined;
|
|
26
26
|
labelPlacement?: "inside" | undefined;
|
|
27
27
|
fullWidth?: boolean | undefined;
|
|
28
28
|
isClearable?: boolean | undefined;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { type ModalProps } from '@heroui/modal';
|
|
3
|
-
export type UXModalProps = Omit<ModalProps, 'closeButton'> & {
|
|
3
|
+
export type UXModalProps = Omit<ModalProps, 'closeButton' | 'title'> & {
|
|
4
4
|
title?: React.ReactNode;
|
|
5
5
|
footer?: React.ReactNode;
|
|
6
6
|
tip?: React.ReactNode;
|
|
@@ -40,21 +40,21 @@ const ExtendedRadio = extendVariants(Radio, {
|
|
|
40
40
|
sm: {
|
|
41
41
|
wrapper: 'w-2.5 h-2.5 border-small',
|
|
42
42
|
control: 'w-1.5 h-1.5',
|
|
43
|
-
labelWrapper: '
|
|
43
|
+
labelWrapper: 'ms-1',
|
|
44
44
|
label: '!text-body3 font-medium',
|
|
45
45
|
description: 'text-tiny text-foreground-100'
|
|
46
46
|
},
|
|
47
47
|
md: {
|
|
48
48
|
wrapper: 'w-3 h-3 border-small',
|
|
49
49
|
control: 'w-1.5 h-1.5',
|
|
50
|
-
labelWrapper: '
|
|
50
|
+
labelWrapper: 'ms-1',
|
|
51
51
|
label: '!text-body2 font-medium',
|
|
52
52
|
description: 'text-tiny text-foreground-100'
|
|
53
53
|
},
|
|
54
54
|
lg: {
|
|
55
55
|
wrapper: 'w-[14px] h-[14px] border-small',
|
|
56
56
|
control: 'w-2 h-2',
|
|
57
|
-
labelWrapper: '
|
|
57
|
+
labelWrapper: 'ms-1',
|
|
58
58
|
label: '!text-body1 font-medium',
|
|
59
59
|
description: 'text-small text-foreground-100'
|
|
60
60
|
}
|
|
@@ -2,11 +2,11 @@ import { useCallback, useMemo, useRef } from "react";
|
|
|
2
2
|
import { filterDOMProps, useDOMRef } from "@heroui/react-utils";
|
|
3
3
|
import { mergeProps, objectToDeps, warn } from "@heroui/shared-utils";
|
|
4
4
|
import { mapPropsVariants, useProviderContext } from "@heroui/system";
|
|
5
|
-
import { cn } from "@heroui/theme";
|
|
6
5
|
import { useLocale, useNumberFormatter } from "@react-aria/i18n";
|
|
7
6
|
import { useHover } from "@react-aria/interactions";
|
|
8
7
|
import { useSlider } from "@react-aria/slider";
|
|
9
8
|
import { useSliderState } from "@react-stately/slider";
|
|
9
|
+
import { cn } from "../../utils/index.js";
|
|
10
10
|
import { slider } from "./slider-theme.js";
|
|
11
11
|
function use_slider_useSlider(originalProps) {
|
|
12
12
|
const globalContext = useProviderContext();
|
|
@@ -1,15 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { type UXForegroundColor } from '@particle-network/ui-shared';
|
|
3
2
|
import { type SquareProps } from '../layout';
|
|
4
3
|
export interface UXSpinnerProps extends SquareProps {
|
|
5
|
-
/**
|
|
6
|
-
* 颜色
|
|
7
|
-
*/
|
|
8
|
-
color?: UXForegroundColor | 'currentColor';
|
|
9
4
|
/**
|
|
10
5
|
* 动画持续时间(毫秒)
|
|
11
6
|
* @default 400
|
|
12
7
|
*/
|
|
13
8
|
duration?: number;
|
|
9
|
+
iconClassName?: string;
|
|
14
10
|
}
|
|
15
11
|
export declare const UXSpinner: React.FC<UXSpinnerProps>;
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useEffect, useRef, useState } from "react";
|
|
3
|
-
import { cn } from "
|
|
4
|
-
import { colorToClassName } from "@particle-network/ui-shared";
|
|
3
|
+
import { cn } from "../../utils/index.js";
|
|
5
4
|
import { Square } from "../layout/index.js";
|
|
6
5
|
import { SpinnerIcon } from "./SpinnerIcon.js";
|
|
7
|
-
const UXSpinner = ({ size = 18,
|
|
6
|
+
const UXSpinner = ({ size = 18, duration = 400, className, iconClassName, style, ...restProps })=>{
|
|
8
7
|
const [currentIndex, setCurrentIndex] = useState(0);
|
|
9
8
|
const animationRef = useRef(null);
|
|
10
|
-
const iconClassName = 'currentColor' === color ? void 0 : colorToClassName[color];
|
|
11
9
|
useEffect(()=>{
|
|
12
10
|
const stepDuration = duration / 12;
|
|
13
11
|
const animate = ()=>{
|
|
@@ -23,6 +21,7 @@ const UXSpinner = ({ size = 18, color = 'primary', duration = 400, className, st
|
|
|
23
21
|
]);
|
|
24
22
|
return /*#__PURE__*/ jsx(Square, {
|
|
25
23
|
size: size,
|
|
24
|
+
color: "primary",
|
|
26
25
|
className: cn('inline-flex', className),
|
|
27
26
|
style: style,
|
|
28
27
|
...restProps,
|
|
@@ -4,14 +4,14 @@ export type UXSwitchProps = React.ComponentPropsWithRef<typeof ExtendedSwitch>;
|
|
|
4
4
|
export declare const UXSwitch: React.ForwardRefExoticComponent<(Omit<Omit<import("@heroui/system-rsc").OmitCommonProps<Omit<React.DetailedHTMLProps<React.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "ref">, keyof import("@heroui/switch").SwitchProps> & import("@heroui/switch").SwitchProps & {
|
|
5
5
|
as?: import("@heroui/system-rsc").As<any> | undefined;
|
|
6
6
|
} & {
|
|
7
|
-
color?: "
|
|
7
|
+
color?: "primary" | "success" | "warning" | "danger" | "bullish" | "bearish" | "contrast" | undefined;
|
|
8
8
|
size?: "sm" | "md" | "lg" | undefined;
|
|
9
9
|
isDisabled?: boolean | undefined;
|
|
10
10
|
disableAnimation?: boolean | undefined;
|
|
11
11
|
}, "ref"> & React.RefAttributes<HTMLInputElement>, "ref"> | Omit<Omit<import("@heroui/system-rsc").OmitCommonProps<Omit<Omit<any, "ref">, never>, keyof import("@heroui/switch").SwitchProps> & import("@heroui/switch").SwitchProps & {
|
|
12
12
|
as?: import("@heroui/system-rsc").As<any> | undefined;
|
|
13
13
|
} & {
|
|
14
|
-
color?: "
|
|
14
|
+
color?: "primary" | "success" | "warning" | "danger" | "bullish" | "bearish" | "contrast" | undefined;
|
|
15
15
|
size?: "sm" | "md" | "lg" | undefined;
|
|
16
16
|
isDisabled?: boolean | undefined;
|
|
17
17
|
disableAnimation?: boolean | undefined;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
declare const ExtendedSwitch: import("react").ForwardRefExoticComponent<(Omit<import("@heroui/system-rsc").OmitCommonProps<Omit<import("react").DetailedHTMLProps<import("react").InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "ref">, keyof import("@heroui/switch").SwitchProps> & import("@heroui/switch").SwitchProps & {
|
|
2
2
|
as?: import("@heroui/system-rsc").As<any> | undefined;
|
|
3
3
|
} & {
|
|
4
|
-
color?: "
|
|
4
|
+
color?: "primary" | "success" | "warning" | "danger" | "bullish" | "bearish" | "contrast" | undefined;
|
|
5
5
|
size?: "sm" | "md" | "lg" | undefined;
|
|
6
6
|
isDisabled?: boolean | undefined;
|
|
7
7
|
disableAnimation?: boolean | undefined;
|
|
8
8
|
}, "ref"> | Omit<import("@heroui/system-rsc").OmitCommonProps<Omit<Omit<any, "ref">, never>, keyof import("@heroui/switch").SwitchProps> & import("@heroui/switch").SwitchProps & {
|
|
9
9
|
as?: import("@heroui/system-rsc").As<any> | undefined;
|
|
10
10
|
} & {
|
|
11
|
-
color?: "
|
|
11
|
+
color?: "primary" | "success" | "warning" | "danger" | "bullish" | "bearish" | "contrast" | undefined;
|
|
12
12
|
size?: "sm" | "md" | "lg" | undefined;
|
|
13
13
|
isDisabled?: boolean | undefined;
|
|
14
14
|
disableAnimation?: boolean | undefined;
|