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

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.
Files changed (44) hide show
  1. package/dist/components/ProgressWrapper/index.js +1 -2
  2. package/dist/components/UXAutocomplete/index.js +1 -2
  3. package/dist/components/UXCheckbox/checkbox.extend.js +15 -12
  4. package/dist/components/UXColorPicker/color-picker.js +42 -30
  5. package/dist/components/UXColorPicker/types.d.ts +4 -0
  6. package/dist/components/UXHint/index.js +1 -1
  7. package/dist/components/UXModal/index.d.ts +1 -1
  8. package/dist/components/UXRangeInput/index.d.ts +42 -0
  9. package/dist/components/UXRangeInput/index.js +94 -0
  10. package/dist/components/UXThemeSwitch/custom-theme-config.d.ts +4 -1
  11. package/dist/components/UXThemeSwitch/custom-theme-config.js +4 -3
  12. package/dist/components/UXThemeSwitch/index.d.ts +2 -2
  13. package/dist/components/UXThemeSwitch/index.js +2 -2
  14. package/dist/components/UXThemeSwitch/theme-item.js +3 -4
  15. package/dist/components/UXThemeSwitch/theme-switch.d.ts +8 -1
  16. package/dist/components/UXThemeSwitch/theme-switch.js +11 -17
  17. package/dist/components/UXThemeSwitch/use-theme.d.ts +2 -1
  18. package/dist/components/UXThemeSwitch/use-theme.js +4 -9
  19. package/dist/components/UXThemeSwitch/utils.js +43 -6
  20. package/dist/components/UXToast/index.d.ts +1 -1
  21. package/dist/components/UXToast/index.js +22 -10
  22. package/dist/components/UXTooltip/index.js +4 -12
  23. package/dist/components/WrapText/index.d.ts +6 -0
  24. package/dist/components/WrapText/index.js +15 -0
  25. package/dist/components/index.d.ts +2 -0
  26. package/dist/components/index.js +2 -0
  27. package/dist/components/layout/Box/box-theme.d.ts +0 -12
  28. package/dist/components/layout/Box/box-theme.js +4 -8
  29. package/dist/components/layout/Box/box.js +10 -1
  30. package/dist/components/typography/Text.js +14 -4
  31. package/dist/components/typography/Text.type.d.ts +1 -0
  32. package/dist/hooks/useI18n.d.ts +8 -0
  33. package/dist/hooks/useI18n.js +8 -0
  34. package/dist/utils/cn.js +3 -11
  35. package/dist/utils/common.d.ts +4 -0
  36. package/dist/utils/common.js +13 -0
  37. package/package.json +3 -3
  38. package/tailwind-preset.js +6 -6
  39. package/dist/components/UXThemeSwitch/use-color-scheme.d.ts +0 -5
  40. package/dist/components/UXThemeSwitch/use-color-scheme.js +0 -14
  41. package/dist/components/UXThemeSwitch/use-theme-color.d.ts +0 -1
  42. package/dist/components/UXThemeSwitch/use-theme-color.js +0 -6
  43. package/dist/components/UXThemeSwitch/use-theme-store.d.ts +0 -46
  44. package/dist/components/UXThemeSwitch/use-theme-store.js +0 -36
@@ -1,4 +1,4 @@
1
- import { hexColorToHSLValue, themeKeys } from "@particle-network/ui-shared";
1
+ import { hexColorToHSLValue, objectEntries, themeData, themeKeys } from "@particle-network/ui-shared";
2
2
  import { readableColor } from "color2k";
3
3
  import { generateThemeColor } from "../../heroui/utils/colors.js";
4
4
  import { DEFAULT_FONT_FAMILY, PRELOAD_FONTS_URL } from "./constants.js";
@@ -12,10 +12,17 @@ const getCSSProperties = (theme)=>{
12
12
  ]
13
13
  ],
14
14
  secondary: [
15
- ...generateThemeColor(colorVariables.secondary, 'secondary', theme.colorScheme).cssVariables,
15
+ [
16
+ '--heroui-secondary',
17
+ colorVariables.secondary
18
+ ],
16
19
  [
17
20
  '--heroui-foreground-300',
18
21
  colorVariables.secondary
22
+ ],
23
+ [
24
+ '--heroui-secondary-foreground',
25
+ readableColor(colorVariables.secondary)
19
26
  ]
20
27
  ],
21
28
  tertiary: [
@@ -33,8 +40,26 @@ const getCSSProperties = (theme)=>{
33
40
  ]
34
41
  ],
35
42
  primary: generateThemeColor(colorVariables.primary, 'primary', theme.colorScheme).cssVariables,
36
- success: generateThemeColor(colorVariables.success, 'success', theme.colorScheme).cssVariables,
37
- danger: generateThemeColor(colorVariables.danger, 'danger', theme.colorScheme).cssVariables,
43
+ success: [
44
+ [
45
+ '--heroui-success',
46
+ colorVariables.success
47
+ ],
48
+ [
49
+ '--heroui-success-foreground',
50
+ readableColor(colorVariables.success)
51
+ ]
52
+ ],
53
+ danger: [
54
+ [
55
+ '--heroui-danger',
56
+ colorVariables.danger
57
+ ],
58
+ [
59
+ '--heroui-danger-foreground',
60
+ readableColor(colorVariables.danger)
61
+ ]
62
+ ],
38
63
  alert: [
39
64
  [
40
65
  '--heroui-alert',
@@ -45,7 +70,16 @@ const getCSSProperties = (theme)=>{
45
70
  readableColor(colorVariables.alert)
46
71
  ]
47
72
  ],
48
- warning: generateThemeColor(colorVariables.warning, 'warning', theme.colorScheme).cssVariables,
73
+ warning: [
74
+ [
75
+ '--heroui-warning',
76
+ colorVariables.warning
77
+ ],
78
+ [
79
+ '--heroui-warning-foreground',
80
+ readableColor(colorVariables.warning)
81
+ ]
82
+ ],
49
83
  blue: [
50
84
  [
51
85
  '--heroui-blue',
@@ -161,8 +195,11 @@ const setCSSProperty = (property, value)=>{
161
195
  };
162
196
  const applyCustomThemeColors = (theme)=>{
163
197
  if ('undefined' == typeof window) return;
198
+ const baseThemeColors = themeData.find((t)=>t.id === theme.baseThemeId).colorVariables;
199
+ const customThemeColors = theme.colorVariables;
164
200
  const cssProperties = getCSSProperties(theme);
165
- Object.entries(cssProperties).forEach(([, value])=>{
201
+ objectEntries(cssProperties).forEach(([colorKey, value])=>{
202
+ if (baseThemeColors[colorKey] === customThemeColors[colorKey]) return;
166
203
  value.forEach(([variable, value])=>{
167
204
  setCSSProperty(variable, value);
168
205
  });
@@ -12,7 +12,7 @@ export declare const toast: {
12
12
  error: (message: ReactNode, props?: Partial<ToastProps>) => string | null;
13
13
  loading: (message: ReactNode, props?: Partial<ToastProps>) => string | null;
14
14
  show: (props?: Partial<ToastProps> & {
15
- type: UXToastType;
15
+ type?: UXToastType;
16
16
  }) => string | null;
17
17
  closeAll: () => void;
18
18
  close: (key: string) => void;
@@ -5,6 +5,7 @@ import CircleCloseIcon from "@particle-network/icons/web/CircleCloseIcon";
5
5
  import CloseIcon from "@particle-network/icons/web/CloseIcon";
6
6
  import { hasLongWord } from "../../utils/index.js";
7
7
  import { UXSpinner } from "../UXSpinner/index.js";
8
+ import { WrapText } from "../WrapText/index.js";
8
9
  const UXToastProvider = ()=>/*#__PURE__*/ jsx(ToastProvider, {
9
10
  disableAnimation: true,
10
11
  placement: "top-center",
@@ -13,7 +14,7 @@ const UXToastProvider = ()=>/*#__PURE__*/ jsx(ToastProvider, {
13
14
  timeout: 4000
14
15
  },
15
16
  regionProps: {
16
- className: 'items-center mt-12 p-0 gap-2'
17
+ className: 'items-center mt-12 p-0 gap-2 z-[9999999999]'
17
18
  }
18
19
  });
19
20
  const getIcon = (type)=>{
@@ -32,19 +33,25 @@ const getIcon = (type)=>{
32
33
  return null;
33
34
  };
34
35
  const show = (props)=>{
35
- const { type, hideCloseButton, icon, variant, classNames, description, ...toastProps } = props ?? {};
36
- const { base, description: descriptionClassName, icon: iconClassName, loadingComponent, content, closeButton, ...restClassNames } = classNames ?? {};
36
+ const { type = 'info', hideCloseButton, icon, variant, classNames, title, description, ...toastProps } = props ?? {};
37
+ const { base, title: titleClassName, description: descriptionClassName, icon: iconClassName, loadingComponent, content, closeButton, ...restClassNames } = classNames ?? {};
37
38
  return addToast({
38
39
  classNames: {
39
40
  base: [
40
- 'bg-cursor rounded-xl px-3.5 py-3 shadow-none border-none !w-fit max-w-[90vw] md:max-w-[400px] m-0',
41
+ 'bg-cursor rounded-xl px-3.5 shadow-none min-h-11 border-none !w-fit max-w-[90vw] md:max-w-[400px] m-0',
41
42
  !hideCloseButton && 'pr-12',
42
43
  'flat' === variant && 'success' === type && 'bg-[#0E3728]',
43
44
  'flat' === variant && 'error' === type && 'bg-[#501D1D]',
44
45
  base
45
46
  ],
47
+ title: [
48
+ 'text-cursor-foreground text-xs font-medium leading-4 !whitespace-normal me-0 line-clamp-2',
49
+ hasLongWord(title) && 'break-all',
50
+ 'flat' === variant && 'text-white',
51
+ titleClassName
52
+ ],
46
53
  description: [
47
- 'text-cursor-foreground text-xs font-medium me-0 leading-4 line-clamp-4',
54
+ 'text-secondary !text-body3 me-0 leading-4',
48
55
  'flat' === variant && 'text-white',
49
56
  hasLongWord(description) && 'break-all',
50
57
  descriptionClassName
@@ -68,7 +75,12 @@ const show = (props)=>{
68
75
  ],
69
76
  ...restClassNames
70
77
  },
71
- description,
78
+ title: /*#__PURE__*/ jsx(WrapText, {
79
+ children: title
80
+ }),
81
+ description: /*#__PURE__*/ jsx(WrapText, {
82
+ children: description
83
+ }),
72
84
  icon: icon ?? getIcon(type),
73
85
  hideIcon: !icon && !getIcon(type),
74
86
  closeIcon: /*#__PURE__*/ jsx(CloseIcon, {
@@ -84,22 +96,22 @@ const show = (props)=>{
84
96
  const toast = {
85
97
  info: (message, props)=>show({
86
98
  type: 'info',
87
- description: message,
99
+ title: message,
88
100
  ...props
89
101
  }),
90
102
  success: (message, props)=>show({
91
103
  type: 'success',
92
- description: message,
104
+ title: message,
93
105
  ...props
94
106
  }),
95
107
  error: (message, props)=>show({
96
108
  type: 'error',
97
- description: message,
109
+ title: message,
98
110
  ...props
99
111
  }),
100
112
  loading: (message, props)=>show({
101
113
  type: 'loading',
102
- description: message,
114
+ title: message,
103
115
  ...props
104
116
  }),
105
117
  show,
@@ -1,23 +1,15 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import "react";
3
3
  import { hasLongWord } from "../../utils/index.js";
4
+ import { WrapText } from "../WrapText/index.js";
4
5
  import tooltip_extend from "./tooltip.extend.js";
5
- const renderContent = (content)=>{
6
- if (!content) return null;
7
- if ('string' != typeof content) return content;
8
- if (!content.includes('\n')) return content;
9
- return content.split('\n').flatMap((x, i, arr)=>i < arr.length - 1 ? [
10
- x,
11
- /*#__PURE__*/ jsx("br", {}, i)
12
- ] : [
13
- x
14
- ]);
15
- };
16
6
  const UXTooltip = (props)=>{
17
7
  const { content, classNames, ...restProps } = props;
18
8
  const { content: contentClassName, ...restClassNames } = classNames ?? {};
19
9
  return /*#__PURE__*/ jsx(tooltip_extend, {
20
- content: renderContent(content),
10
+ content: /*#__PURE__*/ jsx(WrapText, {
11
+ children: content
12
+ }),
21
13
  classNames: {
22
14
  content: [
23
15
  hasLongWord(content) && 'break-all',
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ interface WarpTextProps {
3
+ children: React.ReactNode;
4
+ }
5
+ export declare const WrapText: (props: WarpTextProps) => string | number | bigint | true | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> | (string | import("react/jsx-runtime").JSX.Element)[] | null;
6
+ export {};
@@ -0,0 +1,15 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import "react";
3
+ const WrapText = (props)=>{
4
+ const { children } = props;
5
+ if (!children) return null;
6
+ if ('string' != typeof children) return children;
7
+ if (!children.includes('\n')) return children;
8
+ return children.split('\n').flatMap((x, i, arr)=>i < arr.length - 1 ? [
9
+ x,
10
+ /*#__PURE__*/ jsx("br", {}, i)
11
+ ] : [
12
+ x
13
+ ]);
14
+ };
15
+ export { WrapText };
@@ -21,6 +21,7 @@ export * from './UXNumberInput';
21
21
  export * from './UXPagination';
22
22
  export * from './UXPopover';
23
23
  export * from './UXRadio';
24
+ export * from './UXRangeInput';
24
25
  export * from './UXSelect';
25
26
  export * from './UXSlider';
26
27
  export * from './UXSpinner';
@@ -32,3 +33,4 @@ export * from './UXTextarea';
32
33
  export * from './UXThemeSwitch';
33
34
  export * from './UXToast';
34
35
  export * from './UXTooltip';
36
+ export * from './WrapText';
@@ -21,6 +21,7 @@ export * from "./UXNumberInput/index.js";
21
21
  export * from "./UXPagination/index.js";
22
22
  export * from "./UXPopover/index.js";
23
23
  export * from "./UXRadio/index.js";
24
+ export * from "./UXRangeInput/index.js";
24
25
  export * from "./UXSelect/index.js";
25
26
  export * from "./UXSlider/index.js";
26
27
  export * from "./UXSpinner/index.js";
@@ -32,3 +33,4 @@ export * from "./UXTextarea/index.js";
32
33
  export * from "./UXThemeSwitch/index.js";
33
34
  export * from "./UXToast/index.js";
34
35
  export * from "./UXTooltip/index.js";
36
+ export * from "./WrapText/index.js";
@@ -231,15 +231,11 @@ export declare const boxVariants: import("tailwind-variants").TVReturnType<{
231
231
  true: string;
232
232
  0: string;
233
233
  1: string;
234
- 2: string;
235
- 3: string;
236
234
  };
237
235
  shrink: {
238
236
  true: string;
239
237
  0: string;
240
238
  1: string;
241
- 2: string;
242
- 3: string;
243
239
  };
244
240
  order: {
245
241
  first: string;
@@ -971,15 +967,11 @@ export declare const boxVariants: import("tailwind-variants").TVReturnType<{
971
967
  true: string;
972
968
  0: string;
973
969
  1: string;
974
- 2: string;
975
- 3: string;
976
970
  };
977
971
  shrink: {
978
972
  true: string;
979
973
  0: string;
980
974
  1: string;
981
- 2: string;
982
- 3: string;
983
975
  };
984
976
  order: {
985
977
  first: string;
@@ -1711,15 +1703,11 @@ export declare const boxVariants: import("tailwind-variants").TVReturnType<{
1711
1703
  true: string;
1712
1704
  0: string;
1713
1705
  1: string;
1714
- 2: string;
1715
- 3: string;
1716
1706
  };
1717
1707
  shrink: {
1718
1708
  true: string;
1719
1709
  0: string;
1720
1710
  1: string;
1721
- 2: string;
1722
- 3: string;
1723
1711
  };
1724
1712
  order: {
1725
1713
  first: string;
@@ -217,16 +217,12 @@ const boxVariants = tv({
217
217
  grow: {
218
218
  true: 'grow',
219
219
  0: 'grow-0',
220
- 1: 'grow-1',
221
- 2: 'grow-2',
222
- 3: 'grow-3'
220
+ 1: 'grow'
223
221
  },
224
222
  shrink: {
225
223
  true: 'shrink',
226
224
  0: 'shrink-0',
227
- 1: 'shrink-1',
228
- 2: 'shrink-2',
229
- 3: 'shrink-3'
225
+ 1: 'shrink'
230
226
  },
231
227
  order: {
232
228
  first: 'order-first',
@@ -312,9 +308,9 @@ const boxVariants = tv({
312
308
  borderWidth: {
313
309
  none: 'border-none',
314
310
  '0.5': 'border-[0.5px]',
315
- 1: 'border-px',
311
+ 1: 'border-[1px]',
316
312
  '1.5': 'border-[1.5px]',
317
- 2: 'border-2'
313
+ 2: 'border-[2px]'
318
314
  },
319
315
  cursor: {
320
316
  auto: 'cursor-auto',
@@ -1,7 +1,7 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { forwardRef, useMemo } from "react";
3
3
  import { boxVariants } from "./box-theme.js";
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)=>{
4
+ const Box = /*#__PURE__*/ forwardRef(({ as, position, top, right, bottom, left, start, end, inset, 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, borderColor, borderWidth, cursor, color, fontWeight, lineHeight, textAlign, style = {}, className, ...props }, ref)=>{
5
5
  const Component = as || 'div';
6
6
  const boxStyle = useMemo(()=>({
7
7
  width: 'number' == typeof w ? `${w}px` : void 0,
@@ -27,6 +27,13 @@ const Box = /*#__PURE__*/ forwardRef(({ as, position, display, aspect, overflow,
27
27
  style: boxStyle,
28
28
  className: boxVariants({
29
29
  position,
30
+ top,
31
+ right,
32
+ bottom,
33
+ left,
34
+ start,
35
+ end,
36
+ inset,
30
37
  display,
31
38
  aspect,
32
39
  overflow,
@@ -76,6 +83,8 @@ const Box = /*#__PURE__*/ forwardRef(({ as, position, display, aspect, overflow,
76
83
  rounded,
77
84
  radius,
78
85
  borderStyle,
86
+ borderColor,
87
+ borderWidth,
79
88
  cursor,
80
89
  color: color,
81
90
  fontWeight,
@@ -1,8 +1,16 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
- import { forwardRef } from "react";
2
+ import { forwardRef, useMemo } from "react";
3
3
  import { Box } from "../layout/index.js";
4
+ import { WrapText } from "../WrapText/index.js";
4
5
  import { textVariants } from "./text-theme.js";
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, {
6
+ const Text = /*#__PURE__*/ forwardRef(({ variant, className, h1, h2, h3, body1, body1Bold, body2, body2Bold, body3, body3Bold, caption1, caption1Bold, fontWeight, lineHeight, align, textAlign, wrapText, children, ...props }, ref)=>{
7
+ const content = useMemo(()=>wrapText ? /*#__PURE__*/ jsx(WrapText, {
8
+ children: children
9
+ }) : children, [
10
+ children,
11
+ wrapText
12
+ ]);
13
+ return /*#__PURE__*/ jsx(Box, {
6
14
  ref: ref,
7
15
  as: "span",
8
16
  textAlign: textAlign || align,
@@ -23,7 +31,9 @@ const Text = /*#__PURE__*/ forwardRef(({ variant, className, h1, h2, h3, body1,
23
31
  lineHeight,
24
32
  className
25
33
  }),
26
- ...props
27
- }));
34
+ ...props,
35
+ children: content
36
+ });
37
+ });
28
38
  Text.displayName = 'UX.Text';
29
39
  export { Text };
@@ -62,5 +62,6 @@ export interface TextProps extends BoxProps<HTMLSpanElement> {
62
62
  */
63
63
  caption1Bold?: boolean;
64
64
  align?: BoxProps['textAlign'];
65
+ wrapText?: boolean;
65
66
  }
66
67
  export {};
@@ -67,6 +67,10 @@ export declare const useI18n: () => {
67
67
  readonly on: "On";
68
68
  readonly off: "Off";
69
69
  };
70
+ readonly rangeInput: {
71
+ readonly min: "Min";
72
+ readonly max: "Max";
73
+ };
70
74
  } | {
71
75
  readonly table: {
72
76
  readonly emptyContent: "暂无数据";
@@ -136,4 +140,8 @@ export declare const useI18n: () => {
136
140
  readonly on: "开";
137
141
  readonly off: "关";
138
142
  };
143
+ readonly rangeInput: {
144
+ readonly min: "最小";
145
+ readonly max: "最大";
146
+ };
139
147
  };
@@ -68,6 +68,10 @@ const en = {
68
68
  switch: {
69
69
  on: 'On',
70
70
  off: 'Off'
71
+ },
72
+ rangeInput: {
73
+ min: 'Min',
74
+ max: 'Max'
71
75
  }
72
76
  };
73
77
  const zh = {
@@ -138,6 +142,10 @@ const zh = {
138
142
  switch: {
139
143
  on: '开',
140
144
  off: '关'
145
+ },
146
+ rangeInput: {
147
+ min: '最小',
148
+ max: '最大'
141
149
  }
142
150
  };
143
151
  const useI18n = ()=>{
package/dist/utils/cn.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { clsx } from "clsx";
2
- import { extendTailwindMerge, twMerge } from "tailwind-merge";
2
+ import { extendTailwindMerge } from "tailwind-merge";
3
3
  const COMMON_UNITS = [
4
4
  'small',
5
5
  'medium',
@@ -27,7 +27,7 @@ const OPACITY = [
27
27
  'disabled',
28
28
  'hover'
29
29
  ];
30
- const cn_twMerge = extendTailwindMerge({
30
+ const twMerge = extendTailwindMerge({
31
31
  extend: {
32
32
  classGroups: {
33
33
  'font-size': [
@@ -245,14 +245,6 @@ const cn_twMerge = extendTailwindMerge({
245
245
  }
246
246
  });
247
247
  function cn(...inputs) {
248
- return cn_twMerge(clsx(inputs));
248
+ return twMerge(clsx(inputs));
249
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
250
  export { cn };
@@ -0,0 +1,4 @@
1
+ export declare function objectEntries<T extends object>(obj: T): [keyof T & string, T[keyof T & string]][];
2
+ export declare function objectKeys<T extends object>(obj: T): (keyof T & string)[];
3
+ export declare function objectValues<T extends object>(obj: T): T[keyof T & string][];
4
+ export declare function objectFromEntries<T extends object>(entries: [keyof T & string, T[keyof T & string]][]): T;
@@ -0,0 +1,13 @@
1
+ function objectEntries(obj) {
2
+ return Object.entries(obj);
3
+ }
4
+ function objectKeys(obj) {
5
+ return Object.keys(obj);
6
+ }
7
+ function objectValues(obj) {
8
+ return Object.values(obj);
9
+ }
10
+ function objectFromEntries(entries) {
11
+ return Object.fromEntries(entries);
12
+ }
13
+ export { objectEntries, objectFromEntries, objectKeys, objectValues };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@particle-network/ui-react",
3
- "version": "0.5.1-beta.9",
3
+ "version": "0.6.0",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
@@ -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/ui-shared": "0.4.1-beta.4",
56
- "@particle-network/icons": "0.5.1-beta.5"
55
+ "@particle-network/icons": "0.6.0",
56
+ "@particle-network/ui-shared": "0.5.0"
57
57
  },
58
58
  "scripts": {
59
59
  "build": "rslib build",
@@ -986,11 +986,11 @@ module.exports = {
986
986
  },
987
987
  success: {
988
988
  DEFAULT: '#2EBD85',
989
- foreground: '#000000',
989
+ foreground: '#FFFFFF',
990
990
  },
991
991
  danger: {
992
- DEFAULT: '#F6465D',
993
- foreground: '#000000',
992
+ DEFAULT: '#F5465D',
993
+ foreground: '#FFFFFF',
994
994
  },
995
995
  warning: {
996
996
  DEFAULT: '#F0B90B',
@@ -1006,11 +1006,11 @@ module.exports = {
1006
1006
  },
1007
1007
  bullish: {
1008
1008
  DEFAULT: '#2EBD85',
1009
- foreground: '#000000',
1009
+ foreground: '#FFFFFF',
1010
1010
  },
1011
1011
  bearish: {
1012
- DEFAULT: '#F6465D',
1013
- foreground: '#000000',
1012
+ DEFAULT: '#F5465D',
1013
+ foreground: '#FFFFFF',
1014
1014
  },
1015
1015
  },
1016
1016
  },
@@ -1,5 +0,0 @@
1
- export declare const useColorScheme: () => {
2
- colorScheme: import("@particle-network/ui-shared").ColorScheme;
3
- isDark: boolean;
4
- isLight: boolean;
5
- };
@@ -1,14 +0,0 @@
1
- import { useMemo } from "react";
2
- import { useThemeStore } from "./use-theme-store.js";
3
- const useColorScheme = ()=>{
4
- const { colorScheme } = useThemeStore((state)=>state.theme);
5
- const scheme = useMemo(()=>({
6
- colorScheme,
7
- isDark: 'dark' === colorScheme,
8
- isLight: 'light' === colorScheme
9
- }), [
10
- colorScheme
11
- ]);
12
- return scheme;
13
- };
14
- export { useColorScheme };
@@ -1 +0,0 @@
1
- export declare const useThemeColor: () => Record<import("@particle-network/ui-shared").ThemeColorVariable, string>;
@@ -1,6 +0,0 @@
1
- import { useThemeStore } from "./use-theme-store.js";
2
- const useThemeColor = ()=>{
3
- const { colorVariables } = useThemeStore((state)=>state.theme);
4
- return colorVariables;
5
- };
6
- export { useThemeColor };
@@ -1,46 +0,0 @@
1
- import { type ThemeItemType } from '@particle-network/ui-shared';
2
- export type FontLoadStatus = 'idle' | 'loading' | 'success' | 'error';
3
- interface State {
4
- /**
5
- * 保存的主题
6
- */
7
- theme: ThemeItemType;
8
- /**
9
- * 保存的自定义主题配置(当切换到其他主题时保存,切回 custom 时恢复)
10
- */
11
- customTheme: ThemeItemType;
12
- /**
13
- * 保存的字体链接
14
- */
15
- fontUrl: string;
16
- /**
17
- * 应用的字体名称
18
- */
19
- fontName: string;
20
- /**
21
- * 字体加载状态
22
- */
23
- fontLoadStatus: FontLoadStatus;
24
- }
25
- interface Actions {
26
- setTheme: (theme: ThemeItemType) => void;
27
- setCustomTheme: (customTheme: ThemeItemType) => void;
28
- setFontUrl: (fontUrl: string) => void;
29
- setFontLoadStatus: (status: FontLoadStatus) => void;
30
- setFontName: (name: string) => void;
31
- }
32
- type ThemeStore = State & Actions;
33
- export declare const useThemeStore: import("zustand").UseBoundStore<Omit<import("zustand").StoreApi<ThemeStore>, "setState" | "persist"> & {
34
- setState(partial: ThemeStore | Partial<ThemeStore> | ((state: ThemeStore) => ThemeStore | Partial<ThemeStore>), replace?: false | undefined): unknown;
35
- setState(state: ThemeStore | ((state: ThemeStore) => ThemeStore), replace: true): unknown;
36
- persist: {
37
- setOptions: (options: Partial<import("zustand/middleware").PersistOptions<ThemeStore, unknown, unknown>>) => void;
38
- clearStorage: () => void;
39
- rehydrate: () => Promise<void> | void;
40
- hasHydrated: () => boolean;
41
- onHydrate: (fn: (state: ThemeStore) => void) => () => void;
42
- onFinishHydration: (fn: (state: ThemeStore) => void) => () => void;
43
- getOptions: () => Partial<import("zustand/middleware").PersistOptions<ThemeStore, unknown, unknown>>;
44
- };
45
- }>;
46
- export {};