@particle-network/ui-react 0.5.1-beta.8 → 0.5.1-beta.9

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.
@@ -1,9 +1,9 @@
1
1
  'use client';
2
2
  import { jsx, jsxs } from "react/jsx-runtime";
3
3
  import { useMemo, useRef } from "react";
4
- import { cn } from "@heroui/theme";
5
4
  import { radiusMap } 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
8
  import { useThemeColor } from "../UXThemeSwitch/use-theme-color.js";
9
9
  const ProgressWrapper = ({ className, value = 0, width, height, radius = 'sm', strokeWidth = 1, color = 'primary', children, svgClassName, ...restProps })=>{
@@ -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 "@heroui/theme";
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,
@@ -2,9 +2,9 @@
2
2
  import { 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";
@@ -13,7 +13,7 @@ import { ColorFields } from "./color-fields.js";
13
13
  import { ColorInput } from "./color-input.js";
14
14
  import { normalizeColor } from "./utils.js";
15
15
  const UXColorPicker = ({ className, isDisabled, placement = 'bottom-start', value, defaultValue, onChange, onChangeEnd, onValueChange, onValueChangeEnd, isChanged, onReset })=>{
16
- const { 'bg-200': bg200 } = useThemeColor();
16
+ const { bg200: bg200 } = useThemeColor();
17
17
  const isControlled = void 0 !== value;
18
18
  const [pickerKey, setPickerKey] = useState(0);
19
19
  const [isInputFocused, setIsInputFocused] = useState(false);
@@ -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, {
@@ -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,6 +1,6 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { useEffect, useRef, useState } from "react";
3
- import { cn } from "@heroui/theme";
3
+ import { cn } from "../../utils/index.js";
4
4
  import { Square } from "../layout/index.js";
5
5
  import { SpinnerIcon } from "./SpinnerIcon.js";
6
6
  const UXSpinner = ({ size = 18, duration = 400, className, iconClassName, style, ...restProps })=>{
@@ -48,9 +48,9 @@ const ExtendedSwitch = extendVariants(Switch, {
48
48
  },
49
49
  size: {
50
50
  sm: {
51
- wrapper: 'w-5 h-3 px-0.5',
51
+ wrapper: 'w-5 h-3 px-0.5 bg-cursor',
52
52
  thumb: [
53
- 'w-2 h-2 text-tiny',
53
+ 'w-2 h-2 text-tiny shadow-none',
54
54
  'group-data-[selected=true]:ms-2'
55
55
  ],
56
56
  endContent: 'text-tiny',
@@ -58,9 +58,9 @@ const ExtendedSwitch = extendVariants(Switch, {
58
58
  label: 'text-body3 font-medium ms-sm'
59
59
  },
60
60
  md: {
61
- wrapper: 'w-6 h-3.5 px-[3px]',
61
+ wrapper: 'w-6 h-3.5 px-[3px] bg-cursor',
62
62
  thumb: [
63
- 'w-2.5 h-2.5 text-small',
63
+ 'w-2.5 h-2.5 text-small shadow-none',
64
64
  'group-data-[selected=true]:ms-2'
65
65
  ],
66
66
  endContent: 'text-small',
@@ -68,9 +68,9 @@ const ExtendedSwitch = extendVariants(Switch, {
68
68
  label: 'text-body3 font-medium ms-sm'
69
69
  },
70
70
  lg: {
71
- wrapper: 'w-[34px] h-5 px-[3px]',
71
+ wrapper: 'w-[34px] h-5 px-[3px] bg-cursor',
72
72
  thumb: [
73
- 'w-3.5 h-3.5 text-medium',
73
+ 'w-3.5 h-3.5 text-medium shadow-none',
74
74
  'group-data-[selected=true]:ms-3.5'
75
75
  ],
76
76
  endContent: 'text-medium',
@@ -17,10 +17,10 @@ const COLOR_CATEGORIES = {
17
17
  'bearish'
18
18
  ],
19
19
  background: [
20
- 'bg-default',
21
- 'bg-400',
22
- 'bg-300',
23
- 'bg-200',
20
+ 'bgDefault',
21
+ 'bg400',
22
+ 'bg300',
23
+ 'bg200',
24
24
  'cursor',
25
25
  'overlay',
26
26
  'divider'
@@ -1,7 +1,7 @@
1
1
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
2
  import "react";
3
- import { cn } from "@heroui/theme";
4
3
  import { useLang } from "../../hooks/index.js";
4
+ import { cn } from "../../utils/index.js";
5
5
  import { VStack } from "../layout/index.js";
6
6
  import { Text } from "../typography/Text.js";
7
7
  import { useTheme } from "./use-theme.js";
@@ -57,7 +57,7 @@ const ThemeItem = ({ id, zhName, enName, isSelected, onClick })=>{
57
57
  fill: "currentColor",
58
58
  className: "text-background",
59
59
  style: {
60
- color: 'custom' === id ? customColors['bg-default'] : void 0
60
+ color: 'custom' === id ? customColors.bgDefault : void 0
61
61
  }
62
62
  })
63
63
  }),
@@ -72,7 +72,7 @@ const ThemeItem = ({ id, zhName, enName, isSelected, onClick })=>{
72
72
  fill: "currentColor",
73
73
  className: "text-background",
74
74
  style: {
75
- color: 'custom' === id ? customColors['bg-default'] : void 0
75
+ color: 'custom' === id ? customColors.bgDefault : void 0
76
76
  }
77
77
  })
78
78
  }),
@@ -1,10 +1,10 @@
1
1
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
2
  import { useMemo, useState } from "react";
3
- import { cn } from "@heroui/theme";
4
3
  import { useDisclosure } from "@heroui/use-disclosure";
5
4
  import { ChartColorSwitchIcon, CopyIcon } from "@particle-network/icons/web";
6
5
  import { DEFAULT_THEME_ID, themeData } from "@particle-network/ui-shared";
7
6
  import { useI18n } from "../../hooks/index.js";
7
+ import { cn } from "../../utils/index.js";
8
8
  import { HStack, VStack } from "../layout/index.js";
9
9
  import { Text } from "../typography/Text.js";
10
10
  import { UXButton } from "../UXButton/index.js";
@@ -24,7 +24,7 @@ const useThemeStore = create()(persist((set)=>({
24
24
  })
25
25
  }), {
26
26
  name: 'ux-preference-theme',
27
- version: 1,
27
+ version: 2,
28
28
  storage: createJSONStorage(()=>'undefined' != typeof window ? window.localStorage : {}),
29
29
  partialize: (state)=>({
30
30
  theme: state.theme,
@@ -56,32 +56,32 @@ const getCSSProperties = (theme)=>{
56
56
  readableColor(colorVariables.blue)
57
57
  ]
58
58
  ],
59
- 'bg-default': [
59
+ bgDefault: [
60
60
  [
61
61
  '--heroui-background',
62
- colorVariables['bg-default']
62
+ colorVariables.bgDefault
63
63
  ],
64
64
  [
65
65
  '--heroui-background-500',
66
- colorVariables['bg-default']
66
+ colorVariables.bgDefault
67
67
  ]
68
68
  ],
69
- 'bg-200': [
69
+ bg200: [
70
70
  [
71
71
  '--heroui-background-200',
72
- colorVariables['bg-200']
72
+ colorVariables.bg200
73
73
  ]
74
74
  ],
75
- 'bg-300': [
75
+ bg300: [
76
76
  [
77
77
  '--heroui-background-300',
78
- colorVariables['bg-300']
78
+ colorVariables.bg300
79
79
  ]
80
80
  ],
81
- 'bg-400': [
81
+ bg400: [
82
82
  [
83
83
  '--heroui-background-400',
84
- colorVariables['bg-400']
84
+ colorVariables.bg400
85
85
  ]
86
86
  ],
87
87
  cursor: [
@@ -608,8 +608,8 @@ export declare const boxVariants: import("tailwind-variants").TVReturnType<{
608
608
  bg: {
609
609
  current: string;
610
610
  transparent: string;
611
- default: string;
612
- pure: string;
611
+ bgDefault: string;
612
+ bgPure: string;
613
613
  bg100: string;
614
614
  bg200: string;
615
615
  bg300: string;
@@ -705,15 +705,25 @@ export declare const boxVariants: import("tailwind-variants").TVReturnType<{
705
705
  divider: string;
706
706
  foreground: string;
707
707
  secondary: string;
708
+ secondaryForeground: string;
708
709
  tertiary: string;
710
+ tertiaryForeground: string;
709
711
  cursor: string;
712
+ cursorForeground: string;
710
713
  primary: string;
714
+ primaryForeground: string;
711
715
  success: string;
716
+ successForeground: string;
712
717
  warning: string;
718
+ warningForeground: string;
713
719
  danger: string;
720
+ dangerForeground: string;
714
721
  alert: string;
722
+ alertForeground: string;
715
723
  bullish: string;
724
+ bullishForeground: string;
716
725
  bearish: string;
726
+ bearishForeground: string;
717
727
  };
718
728
  fontWeight: {
719
729
  normal: string;
@@ -1338,8 +1348,8 @@ export declare const boxVariants: import("tailwind-variants").TVReturnType<{
1338
1348
  bg: {
1339
1349
  current: string;
1340
1350
  transparent: string;
1341
- default: string;
1342
- pure: string;
1351
+ bgDefault: string;
1352
+ bgPure: string;
1343
1353
  bg100: string;
1344
1354
  bg200: string;
1345
1355
  bg300: string;
@@ -1435,15 +1445,25 @@ export declare const boxVariants: import("tailwind-variants").TVReturnType<{
1435
1445
  divider: string;
1436
1446
  foreground: string;
1437
1447
  secondary: string;
1448
+ secondaryForeground: string;
1438
1449
  tertiary: string;
1450
+ tertiaryForeground: string;
1439
1451
  cursor: string;
1452
+ cursorForeground: string;
1440
1453
  primary: string;
1454
+ primaryForeground: string;
1441
1455
  success: string;
1456
+ successForeground: string;
1442
1457
  warning: string;
1458
+ warningForeground: string;
1443
1459
  danger: string;
1460
+ dangerForeground: string;
1444
1461
  alert: string;
1462
+ alertForeground: string;
1445
1463
  bullish: string;
1464
+ bullishForeground: string;
1446
1465
  bearish: string;
1466
+ bearishForeground: string;
1447
1467
  };
1448
1468
  fontWeight: {
1449
1469
  normal: string;
@@ -2068,8 +2088,8 @@ export declare const boxVariants: import("tailwind-variants").TVReturnType<{
2068
2088
  bg: {
2069
2089
  current: string;
2070
2090
  transparent: string;
2071
- default: string;
2072
- pure: string;
2091
+ bgDefault: string;
2092
+ bgPure: string;
2073
2093
  bg100: string;
2074
2094
  bg200: string;
2075
2095
  bg300: string;
@@ -2165,15 +2185,25 @@ export declare const boxVariants: import("tailwind-variants").TVReturnType<{
2165
2185
  divider: string;
2166
2186
  foreground: string;
2167
2187
  secondary: string;
2188
+ secondaryForeground: string;
2168
2189
  tertiary: string;
2190
+ tertiaryForeground: string;
2169
2191
  cursor: string;
2192
+ cursorForeground: string;
2170
2193
  primary: string;
2194
+ primaryForeground: string;
2171
2195
  success: string;
2196
+ successForeground: string;
2172
2197
  warning: string;
2198
+ warningForeground: string;
2173
2199
  danger: string;
2200
+ dangerForeground: string;
2174
2201
  alert: string;
2202
+ alertForeground: string;
2175
2203
  bullish: string;
2204
+ bullishForeground: string;
2176
2205
  bearish: string;
2206
+ bearishForeground: string;
2177
2207
  };
2178
2208
  fontWeight: {
2179
2209
  normal: string;
@@ -50,8 +50,8 @@ const sizingPresets = [
50
50
  const bgClasses = {
51
51
  current: 'bg-current',
52
52
  transparent: 'bg-transparent',
53
- default: 'bg-default',
54
- pure: 'light:bg-white dark:bg-black',
53
+ bgDefault: 'bg-background',
54
+ bgPure: 'light:bg-white dark:bg-black',
55
55
  bg100: 'bg-background-100',
56
56
  bg200: 'bg-background-200',
57
57
  bg300: 'bg-background-300',
@@ -61,14 +61,14 @@ const bgClasses = {
61
61
  foreground: 'bg-foreground',
62
62
  secondary: 'bg-secondary',
63
63
  tertiary: 'bg-tertiary',
64
- cursor: 'bg-cursor',
65
- primary: 'bg-primary',
66
- success: 'bg-success',
67
- warning: 'bg-warning',
68
- danger: 'bg-danger',
69
- alert: 'bg-alert',
70
- bullish: 'bg-bullish',
71
- bearish: 'bg-bearish'
64
+ cursor: 'bg-cursor text-cursor-foreground',
65
+ primary: 'bg-primary text-primary-foreground',
66
+ success: 'bg-success text-success-foreground',
67
+ warning: 'bg-warning text-warning-foreground',
68
+ danger: 'bg-danger text-danger-foreground',
69
+ alert: 'bg-alert text-alert-foreground',
70
+ bullish: 'bg-bullish text-bullish-foreground',
71
+ bearish: 'bg-bearish text-bearish-foreground'
72
72
  };
73
73
  const colorClasses = {
74
74
  current: 'text-current',
@@ -76,15 +76,25 @@ const colorClasses = {
76
76
  divider: 'text-divider',
77
77
  foreground: 'text-foreground',
78
78
  secondary: 'text-secondary',
79
+ secondaryForeground: 'text-secondary-foreground',
79
80
  tertiary: 'text-tertiary',
81
+ tertiaryForeground: 'text-tertiary-foreground',
80
82
  cursor: 'text-cursor',
83
+ cursorForeground: 'text-cursor-foreground',
81
84
  primary: 'text-primary',
85
+ primaryForeground: 'text-primary-foreground',
82
86
  success: 'text-success',
87
+ successForeground: 'text-success-foreground',
83
88
  warning: 'text-warning',
89
+ warningForeground: 'text-warning-foreground',
84
90
  danger: 'text-danger',
91
+ dangerForeground: 'text-danger-foreground',
85
92
  alert: 'text-alert',
93
+ alertForeground: 'text-alert-foreground',
86
94
  bullish: 'text-bullish',
87
- bearish: 'text-bearish'
95
+ bullishForeground: 'text-bullish-foreground',
96
+ bearish: 'text-bearish',
97
+ bearishForeground: 'text-bearish-foreground'
88
98
  };
89
99
  const borderColorClasses = {
90
100
  transparent: 'border-transparent',
@@ -1,6 +1,5 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { forwardRef, useMemo } from "react";
3
- import { cn } from "@heroui/theme";
4
3
  import { boxVariants } from "./box-theme.js";
5
4
  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
5
  const Component = as || 'div';
@@ -26,7 +25,7 @@ const Box = /*#__PURE__*/ forwardRef(({ as, position, display, aspect, overflow,
26
25
  return /*#__PURE__*/ jsx(Component, {
27
26
  ref: ref,
28
27
  style: boxStyle,
29
- className: cn(boxVariants({
28
+ className: boxVariants({
30
29
  position,
31
30
  display,
32
31
  aspect,
@@ -81,8 +80,9 @@ const Box = /*#__PURE__*/ forwardRef(({ as, position, display, aspect, overflow,
81
80
  color: color,
82
81
  fontWeight,
83
82
  lineHeight,
84
- textAlign
85
- }), className),
83
+ textAlign,
84
+ className
85
+ }),
86
86
  ...props
87
87
  });
88
88
  });
@@ -4,10 +4,8 @@ import { Center } from "./Center.js";
4
4
  const Square = /*#__PURE__*/ forwardRef(({ size, ...props }, ref)=>/*#__PURE__*/ jsx(Center, {
5
5
  ref: ref,
6
6
  shrink: 0,
7
- style: {
8
- width: `${size}px`,
9
- height: `${size}px`
10
- },
7
+ w: size,
8
+ aspect: "square",
11
9
  ...props
12
10
  }));
13
11
  Square.displayName = 'UX.Square';
@@ -1,13 +1,12 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { forwardRef } from "react";
3
- import { cn } from "@heroui/theme";
4
3
  import { Box } from "../layout/index.js";
5
4
  import { textVariants } from "./text-theme.js";
6
5
  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, {
7
6
  ref: ref,
8
7
  as: "span",
9
8
  textAlign: textAlign || align,
10
- className: cn(textVariants({
9
+ className: textVariants({
11
10
  variant,
12
11
  h1,
13
12
  h2,
@@ -21,8 +20,9 @@ const Text = /*#__PURE__*/ forwardRef(({ variant, className, h1, h2, h3, body1,
21
20
  caption1,
22
21
  caption1Bold,
23
22
  fontWeight,
24
- lineHeight
25
- }), className),
23
+ lineHeight,
24
+ className
25
+ }),
26
26
  ...props
27
27
  }));
28
28
  Text.displayName = 'UX.Text';
@@ -40,12 +40,12 @@ export declare const useI18n: () => {
40
40
  readonly primary: "Primary";
41
41
  readonly bullish: "Positive";
42
42
  readonly bearish: "Negative";
43
- readonly 'bg-default': "Background Primary";
44
- readonly 'bg-200': "Background Quaternary";
45
- readonly 'bg-300': "Background Tertiary";
46
- readonly 'bg-400': "Background Secondary";
47
- readonly cursor: "Selected";
48
- readonly overlay: "Overlay";
43
+ readonly bgDefault: "Background Primary";
44
+ readonly bg200: "Background Quaternary";
45
+ readonly bg300: "Background Tertiary";
46
+ readonly bg400: "Background Secondary";
47
+ readonly cursor: "Background Selected";
48
+ readonly overlay: "Background Overlay";
49
49
  readonly default: "Default";
50
50
  readonly foreground: "Text Primary";
51
51
  readonly secondary: "Text Secondary";
@@ -109,10 +109,10 @@ export declare const useI18n: () => {
109
109
  readonly primary: "主要色";
110
110
  readonly bullish: "上涨色";
111
111
  readonly bearish: "下跌色";
112
- readonly 'bg-default': "一级背景色";
113
- readonly 'bg-200': "四级背景色";
114
- readonly 'bg-300': "三级背景色";
115
- readonly 'bg-400': "二级背景色";
112
+ readonly bgDefault: "一级背景色";
113
+ readonly bg200: "四级背景色";
114
+ readonly bg300: "三级背景色";
115
+ readonly bg400: "二级背景色";
116
116
  readonly cursor: "选中背景色";
117
117
  readonly overlay: "浮窗背景色";
118
118
  readonly default: "默认";
@@ -42,12 +42,12 @@ const en = {
42
42
  primary: 'Primary',
43
43
  bullish: 'Positive',
44
44
  bearish: 'Negative',
45
- 'bg-default': 'Background Primary',
46
- 'bg-200': 'Background Quaternary',
47
- 'bg-300': 'Background Tertiary',
48
- 'bg-400': 'Background Secondary',
49
- cursor: 'Selected',
50
- overlay: 'Overlay',
45
+ bgDefault: 'Background Primary',
46
+ bg200: 'Background Quaternary',
47
+ bg300: 'Background Tertiary',
48
+ bg400: 'Background Secondary',
49
+ cursor: 'Background Selected',
50
+ overlay: 'Background Overlay',
51
51
  default: 'Default',
52
52
  foreground: 'Text Primary',
53
53
  secondary: 'Text Secondary',
@@ -112,10 +112,10 @@ const zh = {
112
112
  primary: '主要色',
113
113
  bullish: '上涨色',
114
114
  bearish: '下跌色',
115
- 'bg-default': '一级背景色',
116
- 'bg-200': '四级背景色',
117
- 'bg-300': '三级背景色',
118
- 'bg-400': '二级背景色',
115
+ bgDefault: '一级背景色',
116
+ bg200: '四级背景色',
117
+ bg300: '三级背景色',
118
+ bg400: '二级背景色',
119
119
  cursor: '选中背景色',
120
120
  overlay: '浮窗背景色',
121
121
  default: '默认',
@@ -0,0 +1,2 @@
1
+ import { type ClassValue } from 'clsx';
2
+ export declare function cn(...inputs: ClassValue[]): string;
@@ -0,0 +1,258 @@
1
+ import { clsx } from "clsx";
2
+ import { extendTailwindMerge, twMerge } from "tailwind-merge";
3
+ const COMMON_UNITS = [
4
+ 'small',
5
+ 'medium',
6
+ 'large'
7
+ ];
8
+ const FONT_SIZE = [
9
+ 'xxs',
10
+ 'tiny',
11
+ 'caption1',
12
+ 'body3',
13
+ 'body2',
14
+ 'body1',
15
+ 'h4',
16
+ 'h3',
17
+ 'h2',
18
+ 'h1'
19
+ ];
20
+ const COMMON_SPACING = [
21
+ 'xs',
22
+ 'sm',
23
+ 'md',
24
+ 'lg'
25
+ ];
26
+ const OPACITY = [
27
+ 'disabled',
28
+ 'hover'
29
+ ];
30
+ const cn_twMerge = extendTailwindMerge({
31
+ extend: {
32
+ classGroups: {
33
+ 'font-size': [
34
+ {
35
+ text: [
36
+ ...FONT_SIZE,
37
+ ...COMMON_UNITS
38
+ ]
39
+ }
40
+ ],
41
+ px: [
42
+ {
43
+ px: COMMON_SPACING
44
+ }
45
+ ],
46
+ py: [
47
+ {
48
+ py: COMMON_SPACING
49
+ }
50
+ ],
51
+ pt: [
52
+ {
53
+ pt: COMMON_SPACING
54
+ }
55
+ ],
56
+ pb: [
57
+ {
58
+ pb: COMMON_SPACING
59
+ }
60
+ ],
61
+ pl: [
62
+ {
63
+ pl: COMMON_SPACING
64
+ }
65
+ ],
66
+ pr: [
67
+ {
68
+ pr: COMMON_SPACING
69
+ }
70
+ ],
71
+ ps: [
72
+ {
73
+ ps: COMMON_SPACING
74
+ }
75
+ ],
76
+ pe: [
77
+ {
78
+ pe: COMMON_SPACING
79
+ }
80
+ ],
81
+ p: [
82
+ {
83
+ p: COMMON_SPACING
84
+ }
85
+ ],
86
+ m: [
87
+ {
88
+ m: COMMON_SPACING
89
+ }
90
+ ],
91
+ mx: [
92
+ {
93
+ mx: COMMON_SPACING
94
+ }
95
+ ],
96
+ my: [
97
+ {
98
+ my: COMMON_SPACING
99
+ }
100
+ ],
101
+ mt: [
102
+ {
103
+ mt: COMMON_SPACING
104
+ }
105
+ ],
106
+ mb: [
107
+ {
108
+ mb: COMMON_SPACING
109
+ }
110
+ ],
111
+ ml: [
112
+ {
113
+ ml: COMMON_SPACING
114
+ }
115
+ ],
116
+ mr: [
117
+ {
118
+ mr: COMMON_SPACING
119
+ }
120
+ ],
121
+ ms: [
122
+ {
123
+ ms: COMMON_SPACING
124
+ }
125
+ ],
126
+ me: [
127
+ {
128
+ me: COMMON_SPACING
129
+ }
130
+ ],
131
+ gap: [
132
+ {
133
+ gap: COMMON_SPACING
134
+ }
135
+ ],
136
+ 'gap-x': [
137
+ {
138
+ 'gap-x': COMMON_SPACING
139
+ }
140
+ ],
141
+ 'gap-y': [
142
+ {
143
+ 'gap-y': COMMON_SPACING
144
+ }
145
+ ],
146
+ rounded: [
147
+ {
148
+ rounded: COMMON_UNITS
149
+ }
150
+ ],
151
+ 'rounded-s': [
152
+ {
153
+ 'rounded-s': COMMON_UNITS
154
+ }
155
+ ],
156
+ 'rounded-e': [
157
+ {
158
+ 'rounded-e': COMMON_UNITS
159
+ }
160
+ ],
161
+ 'rounded-t': [
162
+ {
163
+ 'rounded-t': COMMON_UNITS
164
+ }
165
+ ],
166
+ 'rounded-r': [
167
+ {
168
+ 'rounded-r': COMMON_UNITS
169
+ }
170
+ ],
171
+ 'rounded-b': [
172
+ {
173
+ 'rounded-b': COMMON_UNITS
174
+ }
175
+ ],
176
+ 'rounded-l': [
177
+ {
178
+ 'rounded-l': COMMON_UNITS
179
+ }
180
+ ],
181
+ top: [
182
+ {
183
+ top: COMMON_SPACING
184
+ }
185
+ ],
186
+ right: [
187
+ {
188
+ right: COMMON_SPACING
189
+ }
190
+ ],
191
+ bottom: [
192
+ {
193
+ bottom: COMMON_SPACING
194
+ }
195
+ ],
196
+ left: [
197
+ {
198
+ left: COMMON_SPACING
199
+ }
200
+ ],
201
+ inset: [
202
+ {
203
+ inset: COMMON_SPACING
204
+ }
205
+ ],
206
+ 'inset-x': [
207
+ {
208
+ 'inset-x': COMMON_SPACING
209
+ }
210
+ ],
211
+ 'inset-y': [
212
+ {
213
+ 'inset-y': COMMON_SPACING
214
+ }
215
+ ],
216
+ start: [
217
+ {
218
+ start: COMMON_SPACING
219
+ }
220
+ ],
221
+ end: [
222
+ {
223
+ end: COMMON_SPACING
224
+ }
225
+ ],
226
+ opacity: [
227
+ {
228
+ opacity: OPACITY
229
+ }
230
+ ],
231
+ 'border-w': [
232
+ {
233
+ border: COMMON_UNITS
234
+ }
235
+ ],
236
+ shadow: [
237
+ {
238
+ shadow: [
239
+ 'box',
240
+ ...COMMON_UNITS
241
+ ]
242
+ }
243
+ ]
244
+ }
245
+ }
246
+ });
247
+ function cn(...inputs) {
248
+ return cn_twMerge(clsx(inputs));
249
+ }
250
+ console.log(cn('text-red-500 text-brand text-h1'), '|', twMerge('text-red-500 text-brand text-h1'));
251
+ console.log(cn('text-red-500 text-sm text-h1'), '|', twMerge('text-red-500 text-sm text-h1'));
252
+ console.log(cn('px-2 px-md'), '|', twMerge('px-2 px-md'));
253
+ console.log(cn('gap-2 gap-md'), '|', twMerge('gap-2 gap-md'));
254
+ console.log(cn('rounded-sm rounded-small'), '|', twMerge('rounded-sm rounded-small'));
255
+ console.log(cn('top-1 top-md'), '|', twMerge('top-1 top-md'));
256
+ console.log(cn('opacity-0 opacity-disabled opacity-hover'), '|', twMerge('opacity-0 opacity-disabled opacity-hover'));
257
+ console.log(cn('border-1 border-large'), '|', twMerge('border-1 border-large'));
258
+ export { cn };
@@ -1,4 +1,5 @@
1
1
  export { absoluteFullClasses, baseStyles, collapseAdjacentVariantBorders, dataFocusVisibleClasses, focusVisibleClasses, groupDataFocusVisibleClasses, hiddenInputClasses, ringClasses, translateCenterClasses, } from './classes';
2
+ export { cn } from './cn';
2
3
  export * from './detect';
3
4
  export * from './input-classes';
4
5
  export { colorVariants } from './variants';
@@ -1,5 +1,6 @@
1
1
  import { absoluteFullClasses, baseStyles, collapseAdjacentVariantBorders, dataFocusVisibleClasses, focusVisibleClasses, groupDataFocusVisibleClasses, hiddenInputClasses, ringClasses, translateCenterClasses } from "./classes.js";
2
+ import { cn } from "./cn.js";
2
3
  import { colorVariants } from "./variants.js";
3
4
  export * from "./detect.js";
4
5
  export * from "./input-classes.js";
5
- export { absoluteFullClasses, baseStyles, collapseAdjacentVariantBorders, colorVariants, dataFocusVisibleClasses, focusVisibleClasses, groupDataFocusVisibleClasses, hiddenInputClasses, ringClasses, translateCenterClasses };
6
+ export { absoluteFullClasses, baseStyles, cn, collapseAdjacentVariantBorders, colorVariants, dataFocusVisibleClasses, focusVisibleClasses, groupDataFocusVisibleClasses, hiddenInputClasses, ringClasses, translateCenterClasses };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@particle-network/ui-react",
3
- "version": "0.5.1-beta.8",
3
+ "version": "0.5.1-beta.9",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
@@ -38,8 +38,8 @@
38
38
  "@rslib/core": "^0.12.3",
39
39
  "@types/react": "^19.1.10",
40
40
  "react": "^19.1.0",
41
- "@particle-network/lintstaged-config": "0.1.0",
42
- "@particle-network/eslint-config": "0.3.0"
41
+ "@particle-network/eslint-config": "0.3.0",
42
+ "@particle-network/lintstaged-config": "0.1.0"
43
43
  },
44
44
  "peerDependencies": {
45
45
  "react": ">=16.9.0",
@@ -52,8 +52,8 @@
52
52
  "react-aria-components": "^1.14.0",
53
53
  "values.js": "^2.1.1",
54
54
  "zustand": "^5.0.8",
55
- "@particle-network/icons": "0.5.1-beta.4",
56
- "@particle-network/ui-shared": "0.4.1-beta.3"
55
+ "@particle-network/ui-shared": "0.4.1-beta.4",
56
+ "@particle-network/icons": "0.5.1-beta.5"
57
57
  },
58
58
  "scripts": {
59
59
  "build": "rslib build",
@@ -148,7 +148,7 @@ module.exports = {
148
148
  },
149
149
  tertiary: {
150
150
  DEFAULT: '#75757E',
151
- foreground: '#FFFFFF',
151
+ foreground: '#000000',
152
152
  },
153
153
  cursor: {
154
154
  DEFAULT: '#4E4E56',
@@ -231,7 +231,7 @@ module.exports = {
231
231
  },
232
232
  tertiary: {
233
233
  DEFAULT: '#83878D',
234
- foreground: '#000000',
234
+ foreground: '#FFFFFF',
235
235
  },
236
236
  cursor: {
237
237
  DEFAULT: '#D8D8DE',
@@ -314,7 +314,7 @@ module.exports = {
314
314
  },
315
315
  tertiary: {
316
316
  DEFAULT: '#75757E',
317
- foreground: '#FFFFFF',
317
+ foreground: '#000000',
318
318
  },
319
319
  cursor: {
320
320
  DEFAULT: '#4E4E56',
@@ -397,7 +397,7 @@ module.exports = {
397
397
  },
398
398
  tertiary: {
399
399
  DEFAULT: '#83878D',
400
- foreground: '#000000',
400
+ foreground: '#FFFFFF',
401
401
  },
402
402
  cursor: {
403
403
  DEFAULT: '#D8D8DE',
@@ -480,7 +480,7 @@ module.exports = {
480
480
  },
481
481
  tertiary: {
482
482
  DEFAULT: '#888891',
483
- foreground: '#FFFFFF',
483
+ foreground: '#000000',
484
484
  },
485
485
  cursor: {
486
486
  DEFAULT: '#4E4E56',
@@ -563,7 +563,7 @@ module.exports = {
563
563
  },
564
564
  tertiary: {
565
565
  DEFAULT: '#7A7E84',
566
- foreground: '#000000',
566
+ foreground: '#FFFFFF',
567
567
  },
568
568
  cursor: {
569
569
  DEFAULT: '#CFCFD7',
@@ -646,7 +646,7 @@ module.exports = {
646
646
  },
647
647
  tertiary: {
648
648
  DEFAULT: '#757E80',
649
- foreground: '#FFFFFF',
649
+ foreground: '#000000',
650
650
  },
651
651
  cursor: {
652
652
  DEFAULT: '#5D6466',
@@ -729,7 +729,7 @@ module.exports = {
729
729
  },
730
730
  tertiary: {
731
731
  DEFAULT: '#777A8C',
732
- foreground: '#FFFFFF',
732
+ foreground: '#000000',
733
733
  },
734
734
  cursor: {
735
735
  DEFAULT: '#4A4D5E',
@@ -812,7 +812,7 @@ module.exports = {
812
812
  },
813
813
  tertiary: {
814
814
  DEFAULT: '#949E9C',
815
- foreground: '#FFFFFF',
815
+ foreground: '#000000',
816
816
  },
817
817
  cursor: {
818
818
  DEFAULT: '#5D6466',
@@ -895,7 +895,7 @@ module.exports = {
895
895
  },
896
896
  tertiary: {
897
897
  DEFAULT: '#717373',
898
- foreground: '#FFFFFF',
898
+ foreground: '#000000',
899
899
  },
900
900
  cursor: {
901
901
  DEFAULT: '#54515E',
@@ -978,7 +978,7 @@ module.exports = {
978
978
  },
979
979
  tertiary: {
980
980
  DEFAULT: '#707A8A',
981
- foreground: '#FFFFFF',
981
+ foreground: '#000000',
982
982
  },
983
983
  cursor: {
984
984
  DEFAULT: '#444A56',
@@ -1061,7 +1061,7 @@ module.exports = {
1061
1061
  },
1062
1062
  tertiary: {
1063
1063
  DEFAULT: '#686A6D',
1064
- foreground: '#FFFFFF',
1064
+ foreground: '#000000',
1065
1065
  },
1066
1066
  cursor: {
1067
1067
  DEFAULT: '#4B4D51',