@particle-network/ui-react 0.4.0-beta.3 → 0.4.0-beta.31

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 (56) hide show
  1. package/dist/components/ProgressWrapper/index.d.ts +1 -1
  2. package/dist/components/ProgressWrapper/index.js +18 -3
  3. package/dist/components/UXAutocomplete/index.d.ts +5 -0
  4. package/dist/components/UXAutocomplete/index.js +72 -0
  5. package/dist/components/UXButton/button-theme.js +15 -23
  6. package/dist/components/UXButton/use-button.js +2 -1
  7. package/dist/components/UXCheckbox/checkbox.extend.js +3 -3
  8. package/dist/components/UXDatePicker/index.js +1 -1
  9. package/dist/components/UXDateRangePicker/index.js +1 -1
  10. package/dist/components/UXDivider/divider.extend.d.ts +2 -2
  11. package/dist/components/UXDrawer/index.d.ts +9 -0
  12. package/dist/components/UXDrawer/index.js +89 -0
  13. package/dist/components/UXDropdown/dropdown-item.js +1 -1
  14. package/dist/components/UXEmpty/index.d.ts +2 -1
  15. package/dist/components/UXEmpty/index.js +8 -2
  16. package/dist/components/UXHint/index.js +1 -1
  17. package/dist/components/UXInput/index.d.ts +33 -33
  18. package/dist/components/UXInput/input.extend.d.ts +33 -33
  19. package/dist/components/UXModal/index.d.ts +1 -1
  20. package/dist/components/UXModal/index.js +7 -6
  21. package/dist/components/UXSelect/index.js +3 -3
  22. package/dist/components/UXSwitch/index.d.ts +22 -22
  23. package/dist/components/UXSwitch/switch.extend.d.ts +22 -22
  24. package/dist/components/UXTable/index.d.ts +19 -19
  25. package/dist/components/UXTable/table.extend.d.ts +19 -19
  26. package/dist/components/UXTabs/tabs.classes.js +7 -7
  27. package/dist/components/UXThemeSwitch/index.d.ts +0 -1
  28. package/dist/components/UXThemeSwitch/index.js +0 -1
  29. package/dist/components/UXThemeSwitch/theme-item.d.ts +1 -1
  30. package/dist/components/UXThemeSwitch/theme-item.js +4 -5
  31. package/dist/components/UXThemeSwitch/theme-switch.d.ts +3 -3
  32. package/dist/components/UXThemeSwitch/theme-switch.js +134 -101
  33. package/dist/components/UXThemeSwitch/use-color-scheme.d.ts +1 -1
  34. package/dist/components/UXThemeSwitch/use-color-scheme.js +3 -3
  35. package/dist/components/UXThemeSwitch/use-theme-color.d.ts +1 -19
  36. package/dist/components/UXThemeSwitch/use-theme-color.js +3 -3
  37. package/dist/components/UXThemeSwitch/use-theme-store.d.ts +5 -20
  38. package/dist/components/UXThemeSwitch/use-theme-store.js +14 -28
  39. package/dist/components/UXThemeSwitch/use-theme.d.ts +7 -12
  40. package/dist/components/UXThemeSwitch/use-theme.js +73 -80
  41. package/dist/components/UXToast/index.d.ts +7 -4
  42. package/dist/components/UXToast/index.js +21 -17
  43. package/dist/components/UXTooltip/tooltip.extend.d.ts +21 -21
  44. package/dist/components/UXTooltip/tooltip.extend.js +2 -1
  45. package/dist/components/index.d.ts +2 -0
  46. package/dist/components/index.js +2 -0
  47. package/dist/hooks/useI18n.d.ts +6 -2
  48. package/dist/hooks/useI18n.js +15 -7
  49. package/dist/utils/detect.js +1 -2
  50. package/dist/utils/variants.js +16 -16
  51. package/package.json +6 -7
  52. package/tailwind-preset.js +192 -93
  53. package/dist/components/UXThemeSwitch/theme-data.d.ts +0 -29
  54. package/dist/components/UXThemeSwitch/theme-data.js +0 -304
  55. package/dist/icons/index.d.ts +0 -14
  56. package/dist/icons/index.js +0 -120
@@ -1,8 +1,19 @@
1
1
  import { useEffect } from "react";
2
+ import { themeKeys } from "@particle-network/ui-shared";
2
3
  import { useDebounceFn } from "ahooks";
3
- import { themeKeys } from "./theme-data.js";
4
4
  import { useThemeStore } from "./use-theme-store.js";
5
- const DEFAULT_FONT_FAMILY = 'ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji';
5
+ const DEFAULT_FONT_FAMILY = 'Inter,system-ui,sans-serif,"Microsoft YaHei"';
6
+ const PRELOAD_FONTS_URL = 'https://fonts.googleapis.com/css2?family=Geist:wght@100..900&family=IBM+Plex+Sans:ital,wght@0,100..700;1,100..700&display=swap';
7
+ const preloadFonts = ()=>{
8
+ if ('undefined' == typeof window) return;
9
+ const existingLink = document.getElementById('ux-preload-fonts-link');
10
+ if (existingLink) return;
11
+ const linkElement = document.createElement('link');
12
+ linkElement.id = 'ux-preload-fonts-link';
13
+ linkElement.rel = 'stylesheet';
14
+ linkElement.href = PRELOAD_FONTS_URL;
15
+ document.head.appendChild(linkElement);
16
+ };
6
17
  const applyTheme = (theme)=>{
7
18
  if ('undefined' == typeof window) return;
8
19
  const root = document.documentElement;
@@ -11,6 +22,8 @@ const applyTheme = (theme)=>{
11
22
  themeKeys.forEach((key)=>{
12
23
  root.classList.remove(key);
13
24
  });
25
+ root.classList.remove('dark');
26
+ root.classList.remove('light');
14
27
  root.classList.add(theme.id);
15
28
  };
16
29
  const extractFontFamilyFromLink = (link)=>{
@@ -19,107 +32,87 @@ const extractFontFamilyFromLink = (link)=>{
19
32
  const url = new URL(link);
20
33
  const familyParam = url.searchParams.get('family');
21
34
  if (!familyParam) return null;
22
- const fontName = familyParam.split(':')[0].replace(/\+/g, ' ');
23
- return fontName;
35
+ const firstFamily = familyParam.split('&family=')[0].split(':')[0].replace(/\+/g, ' ');
36
+ return firstFamily;
24
37
  } catch {
25
38
  return null;
26
39
  }
27
40
  };
28
- const loadGoogleFont = (link, options)=>{
29
- const { setFontLoadStatus, setFontLoadError, setFontName } = options;
41
+ const applyFont = (fontName)=>{
30
42
  if ('undefined' == typeof window) return;
31
- const existingLink = document.getElementById('ux-google-font-link');
32
- if (existingLink) existingLink.remove();
33
- if (!link?.trim()) {
43
+ if (fontName) {
44
+ document.documentElement.style.setProperty('--ux-font-family', `"${fontName}", ${DEFAULT_FONT_FAMILY}`);
45
+ document.body.style.fontFamily = `"${fontName}", ${DEFAULT_FONT_FAMILY}`;
46
+ } else {
34
47
  document.documentElement.style.setProperty('--ux-font-family', DEFAULT_FONT_FAMILY);
35
48
  document.body.style.fontFamily = DEFAULT_FONT_FAMILY;
36
- setFontLoadStatus('idle');
37
- setFontLoadError(null);
38
- setFontName('');
39
- return;
40
49
  }
41
- setFontLoadStatus('loading');
42
- setFontLoadError(null);
43
- const linkElement = document.createElement('link');
44
- linkElement.id = 'ux-google-font-link';
45
- linkElement.rel = 'stylesheet';
46
- linkElement.href = link;
47
- linkElement.onload = ()=>{
48
- setFontLoadStatus('success');
49
- setFontLoadError(null);
50
- const fontFamily = extractFontFamilyFromLink(link);
51
- if (fontFamily) {
52
- document.documentElement.style.setProperty('--ux-font-family', `"${fontFamily}", ${DEFAULT_FONT_FAMILY}`);
53
- document.body.style.fontFamily = `"${fontFamily}", ${DEFAULT_FONT_FAMILY}`;
54
- setFontName(fontFamily);
55
- }
56
- };
57
- linkElement.onerror = ()=>{
58
- const errorMessage = '字体加载失败,请检查链接是否正确';
59
- setFontLoadStatus('error');
60
- setFontLoadError(errorMessage);
61
- setFontName('');
62
- document.documentElement.style.setProperty('--ux-font-family', DEFAULT_FONT_FAMILY);
63
- document.body.style.fontFamily = DEFAULT_FONT_FAMILY;
64
- };
65
- document.head.appendChild(linkElement);
66
50
  };
67
51
  const useTheme = ()=>{
68
- const selectedTheme = useThemeStore((state)=>state.selectedTheme);
69
- const savedTheme = useThemeStore((state)=>state.savedTheme);
70
- const selectedFontLink = useThemeStore((state)=>state.selectedFontLink);
71
- const savedFontLink = useThemeStore((state)=>state.savedFontLink);
52
+ const theme = useThemeStore((state)=>state.theme);
53
+ const fontUrl = useThemeStore((state)=>state.fontUrl);
72
54
  const fontName = useThemeStore((state)=>state.fontName);
73
55
  const fontLoadStatus = useThemeStore((state)=>state.fontLoadStatus);
74
- const fontLoadError = useThemeStore((state)=>state.fontLoadError);
75
- const storeSetSelectedTheme = useThemeStore((state)=>state.setSelectedTheme);
76
- const storeSetSavedTheme = useThemeStore((state)=>state.setSavedTheme);
77
- const storeSetSelectedFontLink = useThemeStore((state)=>state.setSelectedFontLink);
78
- const storeSetSavedFontLink = useThemeStore((state)=>state.setSavedFontLink);
56
+ const storeSetTheme = useThemeStore((state)=>state.setTheme);
57
+ const storeSetFontUrl = useThemeStore((state)=>state.setFontUrl);
79
58
  const storeSetFontLoadStatus = useThemeStore((state)=>state.setFontLoadStatus);
80
- const storeSetFontLoadError = useThemeStore((state)=>state.setFontLoadError);
81
59
  const storeSetFontName = useThemeStore((state)=>state.setFontName);
82
- const { run: debouncedLoadGoogleFont } = useDebounceFn((link)=>loadGoogleFont(link, {
83
- setFontLoadStatus: storeSetFontLoadStatus,
84
- setFontLoadError: storeSetFontLoadError,
85
- setFontName: storeSetFontName
86
- }), {
87
- wait: 500
60
+ const applyFontWithStatus = (customFontUrl, themeFontName)=>{
61
+ if ('undefined' == typeof window) return;
62
+ const url = customFontUrl?.trim();
63
+ if (!url) return void applyFont(themeFontName);
64
+ const existingLink = document.getElementById('ux-google-font-link');
65
+ if (existingLink) existingLink.remove();
66
+ storeSetFontLoadStatus('loading');
67
+ const linkElement = document.createElement('link');
68
+ linkElement.id = 'ux-google-font-link';
69
+ linkElement.rel = 'stylesheet';
70
+ linkElement.href = url;
71
+ linkElement.onload = ()=>{
72
+ storeSetFontLoadStatus('success');
73
+ const fontFamily = extractFontFamilyFromLink(url);
74
+ if (fontFamily) {
75
+ applyFont(fontFamily);
76
+ storeSetFontName(fontFamily);
77
+ }
78
+ };
79
+ linkElement.onerror = ()=>{
80
+ storeSetFontLoadStatus('error');
81
+ storeSetFontName('');
82
+ applyFont(themeFontName);
83
+ };
84
+ document.head.appendChild(linkElement);
85
+ };
86
+ const { run: debouncedApplyFont } = useDebounceFn((customFontLink, themeFontName)=>applyFontWithStatus(customFontLink, themeFontName), {
87
+ wait: 300
88
88
  });
89
89
  useEffect(()=>{
90
- applyTheme(savedTheme);
91
- debouncedLoadGoogleFont(savedFontLink);
92
- }, [
93
- savedTheme,
94
- savedFontLink
95
- ]);
96
- const setSelectedTheme = (theme)=>{
97
- storeSetSelectedTheme(theme);
90
+ preloadFonts();
98
91
  applyTheme(theme);
99
- };
100
- const setSavedTheme = (theme)=>{
101
- storeSetSavedTheme(theme);
92
+ debouncedApplyFont(fontUrl, theme.fontName);
93
+ }, []);
94
+ const setTheme = (theme)=>{
95
+ storeSetTheme(theme);
102
96
  applyTheme(theme);
97
+ debouncedApplyFont(fontUrl, theme.fontName);
103
98
  };
104
- const setSelectedFontLink = (link)=>{
105
- storeSetSelectedFontLink(link);
106
- debouncedLoadGoogleFont(link);
99
+ const setFontUrl = (link)=>{
100
+ storeSetFontUrl(link);
101
+ debouncedApplyFont(link, theme.fontName);
107
102
  };
108
- const setSavedFontLink = (link)=>{
109
- storeSetSavedFontLink(link);
110
- debouncedLoadGoogleFont(link);
103
+ const clearFontUrl = ()=>{
104
+ storeSetFontUrl('');
105
+ storeSetFontName('');
106
+ storeSetFontLoadStatus('idle');
107
+ debouncedApplyFont('', theme.fontName);
111
108
  };
112
109
  return {
113
- selectedTheme,
114
- setSelectedTheme,
115
- savedTheme,
116
- setSavedTheme,
117
- selectedFontLink,
118
- setSelectedFontLink,
119
- savedFontLink,
120
- setSavedFontLink,
110
+ theme,
111
+ setTheme,
112
+ fontUrl,
113
+ setFontUrl,
114
+ clearFontUrl,
121
115
  fontLoadStatus,
122
- fontLoadError,
123
116
  fontName
124
117
  };
125
118
  };
@@ -1,13 +1,16 @@
1
+ import type { ReactNode } from 'react';
1
2
  import type { ToastProps } from '@heroui/toast';
2
- export type UXToastType = 'success' | 'error' | 'loading';
3
+ export { addToast, closeAll, closeToast, getToastQueue, isToastClosing } from '@heroui/toast';
4
+ export type UXToastType = 'success' | 'error' | 'loading' | 'info';
3
5
  export type UXToastProps = Partial<ToastProps> & {
4
6
  type: UXToastType;
5
7
  };
6
8
  export declare const UXToastProvider: () => import("react/jsx-runtime").JSX.Element;
7
9
  export declare const toast: {
8
- success: (message: string, props?: Partial<ToastProps>) => string | null;
9
- error: (message: string, props?: Partial<ToastProps>) => string | null;
10
- loading: (message: string, props?: Partial<ToastProps>) => string | null;
10
+ info: (message: ReactNode, props?: Partial<ToastProps>) => string | null;
11
+ success: (message: ReactNode, props?: Partial<ToastProps>) => string | null;
12
+ error: (message: ReactNode, props?: Partial<ToastProps>) => string | null;
13
+ loading: (message: ReactNode, props?: Partial<ToastProps>) => string | null;
11
14
  show: (props?: Partial<ToastProps> & {
12
15
  type: UXToastType;
13
16
  }) => string | null;
@@ -1,5 +1,5 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
- import { ToastProvider, addToast, closeAll, closeToast } from "@heroui/toast";
2
+ import { ToastProvider, addToast, closeAll, closeToast, getToastQueue, isToastClosing } from "@heroui/toast";
3
3
  import CircleCheckIcon from "@particle-network/icons/web/CircleCheckIcon";
4
4
  import CircleCloseIcon from "@particle-network/icons/web/CircleCloseIcon";
5
5
  import CloseIcon from "@particle-network/icons/web/CloseIcon";
@@ -9,33 +9,35 @@ const UXToastProvider = ()=>/*#__PURE__*/ jsx(ToastProvider, {
9
9
  disableAnimation: true,
10
10
  placement: "top-center",
11
11
  maxVisibleToasts: 4,
12
- toastOffset: 40,
13
12
  toastProps: {
14
13
  timeout: 4000
15
14
  },
16
15
  regionProps: {
17
- className: 'items-center py-10'
16
+ className: 'items-center mt-12 p-0 gap-2'
18
17
  }
19
18
  });
20
19
  const getIcon = (type)=>{
21
20
  if ('success' === type) return /*#__PURE__*/ jsx(CircleCheckIcon, {
22
- size: 18
21
+ size: 18,
22
+ color: "success"
23
23
  });
24
24
  if ('error' === type) return /*#__PURE__*/ jsx(CircleCloseIcon, {
25
- size: 18
25
+ size: 18,
26
+ color: "danger"
26
27
  });
27
28
  if ('loading' === type) return /*#__PURE__*/ jsx(UXSpinner, {
29
+ color: "primary",
28
30
  size: 18
29
31
  });
30
32
  return null;
31
33
  };
32
34
  const show = (props)=>{
33
- const { type, hideCloseButton, variant, classNames, description, ...toastProps } = props ?? {};
34
- const { base, description: descriptionClassName, icon, loadingComponent, content, closeButton, ...restClassNames } = classNames ?? {};
35
+ const { type, hideCloseButton, icon, variant, classNames, description, ...toastProps } = props ?? {};
36
+ const { base, description: descriptionClassName, icon: iconClassName, loadingComponent, content, closeButton, ...restClassNames } = classNames ?? {};
35
37
  return addToast({
36
38
  classNames: {
37
39
  base: [
38
- 'bg-tertiary rounded-xl px-3.5 py-3 shadow-none border-none !w-fit max-w-[90vw] md:max-w-[400px]',
40
+ 'bg-tertiary rounded-xl px-3.5 py-3 shadow-none border-none !w-fit max-w-[90vw] md:max-w-[400px] m-0',
39
41
  !hideCloseButton && 'pr-12',
40
42
  'flat' === variant && 'success' === type && 'bg-[#0E3728]',
41
43
  'flat' === variant && 'error' === type && 'bg-[#501D1D]',
@@ -48,11 +50,8 @@ const show = (props)=>{
48
50
  descriptionClassName
49
51
  ],
50
52
  icon: [
51
- 'shrink-0 h-5 w-5',
52
- 'success' === type && 'text-success',
53
- 'error' === type && 'text-danger',
54
- 'loading' === type && 'text-primary',
55
- icon
53
+ 'h-fit w-fit shrink-0',
54
+ iconClassName
56
55
  ],
57
56
  loadingComponent: [
58
57
  'text-primary h-5 w-5',
@@ -70,18 +69,24 @@ const show = (props)=>{
70
69
  ...restClassNames
71
70
  },
72
71
  description,
73
- icon: getIcon(type),
72
+ icon: icon ?? getIcon(type),
73
+ hideIcon: !icon && !getIcon(type),
74
74
  closeIcon: /*#__PURE__*/ jsx(CloseIcon, {
75
75
  className: 'flat' === variant ? 'text-white' : 'text-foreground'
76
76
  }),
77
77
  loadingComponent: /*#__PURE__*/ jsx(UXSpinner, {
78
78
  size: 18
79
79
  }),
80
- timeout: 'loading' === type ? 1 / 0 : 3000,
80
+ timeout: 'loading' === type ? 1 / 0 : 4000,
81
81
  ...toastProps
82
82
  });
83
83
  };
84
84
  const toast = {
85
+ info: (message, props)=>show({
86
+ type: 'info',
87
+ description: message,
88
+ ...props
89
+ }),
85
90
  success: (message, props)=>show({
86
91
  type: 'success',
87
92
  description: message,
@@ -95,11 +100,10 @@ const toast = {
95
100
  loading: (message, props)=>show({
96
101
  type: 'loading',
97
102
  description: message,
98
- timeout: 1 / 0,
99
103
  ...props
100
104
  }),
101
105
  show,
102
106
  closeAll: closeAll,
103
107
  close: closeToast
104
108
  };
105
- export { UXToastProvider, toast };
109
+ export { UXToastProvider, addToast, closeAll, closeToast, getToastQueue, isToastClosing, toast };
@@ -39,7 +39,7 @@ declare const ExtendedTooltip: import("react").ForwardRefExoticComponent<Omit<{
39
39
  vocab?: string | undefined;
40
40
  autoCorrect?: string | undefined;
41
41
  autoSave?: string | undefined;
42
- color?: "default" | "foreground" | "secondary" | "primary" | "success" | "danger" | "warning" | undefined;
42
+ color?: "default" | "success" | "foreground" | "secondary" | "primary" | "danger" | "warning" | undefined;
43
43
  itemProp?: string | undefined;
44
44
  itemScope?: boolean | undefined;
45
45
  itemType?: string | undefined;
@@ -282,33 +282,33 @@ declare const ExtendedTooltip: import("react").ForwardRefExoticComponent<Omit<{
282
282
  onTransitionStartCapture?: import("react").TransitionEventHandler<HTMLDivElement> | undefined;
283
283
  size?: "sm" | "md" | "lg" | undefined;
284
284
  radius?: "sm" | "md" | "lg" | "none" | "full" | undefined;
285
- offset?: number | undefined;
286
- key?: import("react").Key | null | undefined;
287
- disableAnimation?: boolean | undefined;
285
+ classNames?: import("@heroui/theme").SlotsToClasses<"content" | "base" | "arrow"> | undefined;
288
286
  isDisabled?: boolean | undefined;
289
- shadow?: "sm" | "md" | "lg" | "none" | undefined;
287
+ disableAnimation?: boolean | undefined;
290
288
  as?: import("@heroui/system-rsc").As<any> | undefined;
289
+ key?: import("react").Key | null | undefined;
290
+ onOpenChange?: ((isOpen: boolean) => void) | undefined;
291
+ shouldCloseOnBlur?: boolean | undefined;
291
292
  onClose?: ((() => void) & (() => void)) | undefined;
292
- classNames?: import("@heroui/theme").SlotsToClasses<"content" | "base" | "arrow"> | undefined;
293
+ isOpen?: boolean | undefined;
293
294
  placement?: import("@heroui/aria-utils").OverlayPlacement | undefined;
294
- motionProps?: Omit<import("framer-motion").HTMLMotionProps<"div">, "ref"> | undefined;
295
- delay?: number | undefined;
295
+ containerPadding?: number | undefined;
296
+ offset?: number | undefined;
297
+ crossOffset?: number | undefined;
298
+ shouldFlip?: boolean | undefined;
299
+ isKeyboardDismissDisabled?: boolean | undefined;
300
+ shouldCloseOnInteractOutside?: ((element: Element) => boolean) | undefined;
301
+ isDismissable?: boolean | undefined;
302
+ showArrow?: boolean | undefined;
303
+ updatePositionDeps?: any[] | undefined;
304
+ shadow?: "sm" | "md" | "lg" | "none" | undefined;
296
305
  triggerScaleOnOpen?: boolean | undefined;
297
306
  isTriggerDisabled?: boolean | undefined;
298
- closeDelay?: number | undefined;
299
- trigger?: "focus" | undefined;
307
+ motionProps?: Omit<import("framer-motion").HTMLMotionProps<"div">, "ref"> | undefined;
300
308
  portalContainer?: Element | undefined;
301
- updatePositionDeps?: any[] | undefined;
302
- isOpen?: boolean | undefined;
303
- isDismissable?: boolean | undefined;
304
- shouldCloseOnBlur?: boolean | undefined;
305
- isKeyboardDismissDisabled?: boolean | undefined;
306
- shouldCloseOnInteractOutside?: ((element: Element) => boolean) | undefined;
307
309
  defaultOpen?: boolean | undefined;
308
- onOpenChange?: ((isOpen: boolean) => void) | undefined;
309
- showArrow?: boolean | undefined;
310
- crossOffset?: number | undefined;
311
- shouldFlip?: boolean | undefined;
312
- containerPadding?: number | undefined;
310
+ trigger?: "focus" | undefined;
311
+ delay?: number | undefined;
312
+ closeDelay?: number | undefined;
313
313
  }, "ref"> & import("react").RefAttributes<import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>>>;
314
314
  export default ExtendedTooltip;
@@ -26,7 +26,8 @@ const ExtendedTooltip = extendVariants(Tooltip, {
26
26
  size: 'md',
27
27
  shadow: 'md',
28
28
  backdrop: 'transparent',
29
- delay: 300
29
+ delay: 300,
30
+ closeDelay: 200
30
31
  }
31
32
  });
32
33
  const tooltip_extend = ExtendedTooltip;
@@ -1,6 +1,7 @@
1
1
  export * from './layout';
2
2
  export * from './ProgressWrapper';
3
3
  export * from './typography/Text';
4
+ export * from './UXAutocomplete';
4
5
  export * from './UXButton';
5
6
  export * from './UXCalendar';
6
7
  export * from './UXCheckbox';
@@ -9,6 +10,7 @@ export * from './UXCopy';
9
10
  export * from './UXDatePicker';
10
11
  export * from './UXDateRangePicker';
11
12
  export * from './UXDivider';
13
+ export * from './UXDrawer';
12
14
  export * from './UXDropdown';
13
15
  export * from './UXEmpty';
14
16
  export * from './UXHint';
@@ -1,6 +1,7 @@
1
1
  export * from "./layout/index.js";
2
2
  export * from "./ProgressWrapper/index.js";
3
3
  export * from "./typography/Text.js";
4
+ export * from "./UXAutocomplete/index.js";
4
5
  export * from "./UXButton/index.js";
5
6
  export * from "./UXCalendar/index.js";
6
7
  export * from "./UXCheckbox/index.js";
@@ -9,6 +10,7 @@ export * from "./UXCopy/index.js";
9
10
  export * from "./UXDatePicker/index.js";
10
11
  export * from "./UXDateRangePicker/index.js";
11
12
  export * from "./UXDivider/index.js";
13
+ export * from "./UXDrawer/index.js";
12
14
  export * from "./UXDropdown/index.js";
13
15
  export * from "./UXEmpty/index.js";
14
16
  export * from "./UXHint/index.js";
@@ -10,14 +10,18 @@ export declare const useI18n: () => {
10
10
  };
11
11
  theme: {
12
12
  title: string;
13
- reset: string;
14
- apply: string;
13
+ done: string;
15
14
  font: {
16
15
  title: string;
17
16
  placeholder: string;
18
17
  loading: string;
19
18
  success: string;
20
19
  error: string;
20
+ hint: string;
21
+ example: {
22
+ show: string;
23
+ hide: string;
24
+ };
21
25
  };
22
26
  };
23
27
  };
@@ -11,14 +11,18 @@ const en = {
11
11
  },
12
12
  theme: {
13
13
  title: 'Theme',
14
- reset: 'Reset',
15
- apply: 'Apply Theme',
14
+ done: 'Finish',
16
15
  font: {
17
16
  title: 'Custom Font',
18
17
  placeholder: 'Enter Google Fonts URL or custom font URL',
19
18
  loading: 'Loading font...',
20
19
  success: 'Font loaded: ',
21
- error: 'Failed to load font'
20
+ error: 'Failed to load font',
21
+ hint: 'Try Google Fonts: ',
22
+ example: {
23
+ show: 'Show example',
24
+ hide: 'Hide example'
25
+ }
22
26
  }
23
27
  }
24
28
  };
@@ -34,14 +38,18 @@ const zh = {
34
38
  },
35
39
  theme: {
36
40
  title: '主题',
37
- reset: '重置',
38
- apply: '应用主题',
41
+ done: '完成',
39
42
  font: {
40
43
  title: '自定义字体',
41
44
  placeholder: '输入 Google Fonts 或自定义字体链接',
42
45
  loading: '正在加载字体...',
43
- success: '字体加载成功:',
44
- error: '字体加载失败'
46
+ success: '已加载字体:',
47
+ error: '字体加载失败',
48
+ hint: '参考 Google Fonts: ',
49
+ example: {
50
+ show: '显示示例',
51
+ hide: '隐藏示例'
52
+ }
45
53
  }
46
54
  }
47
55
  };
@@ -1,7 +1,6 @@
1
1
  const hasLongWord = (text)=>{
2
2
  if ('string' != typeof text) return false;
3
- const englishWords = text.match(/[a-zA-Z0-9_-]+/g);
4
- if (!englishWords) return false;
3
+ const englishWords = text.split(' ');
5
4
  return englishWords.some((word)=>word.length > 30);
6
5
  };
7
6
  export { hasLongWord };
@@ -1,7 +1,7 @@
1
1
  const solid = {
2
2
  default: 'bg-background-200 text-foreground',
3
3
  primary: 'bg-primary text-primary-foreground',
4
- secondary: 'bg-background-200 text-foreground-300',
4
+ secondary: 'bg-background-200 text-secondary',
5
5
  success: 'bg-success text-success-foreground',
6
6
  warning: 'bg-warning text-warning-foreground',
7
7
  danger: 'bg-danger text-danger-foreground',
@@ -22,9 +22,9 @@ const shadow = {
22
22
  bearish: 'shadow-lg shadow-bearish/40 bg-bearish text-foreground'
23
23
  };
24
24
  const bordered = {
25
- default: 'bg-transparent border-foreground-100 text-foreground',
25
+ default: 'bg-transparent border-foreground text-foreground',
26
26
  primary: 'bg-transparent border-primary text-primary',
27
- secondary: 'bg-transparent border-foreground-100 text-foreground-300',
27
+ secondary: 'bg-transparent border-secondary text-secondary',
28
28
  success: 'bg-transparent border-success text-success',
29
29
  warning: 'bg-transparent border-warning text-warning',
30
30
  danger: 'bg-transparent border-danger text-danger',
@@ -33,9 +33,9 @@ const bordered = {
33
33
  bearish: 'bg-transparent border-bearish text-bearish'
34
34
  };
35
35
  const flat = {
36
- default: 'bg-background-300 text-default-foreground',
36
+ default: 'bg-background-300 text-foreground',
37
37
  primary: 'bg-primary/20 text-primary',
38
- secondary: 'bg-background-300 text-foreground-300',
38
+ secondary: 'bg-background-300 text-secondary',
39
39
  success: 'bg-success/20 text-success',
40
40
  warning: 'bg-warning/20 text-warning',
41
41
  danger: 'bg-danger/20 text-danger',
@@ -55,15 +55,15 @@ const faded = {
55
55
  bearish: 'border-bearish bg-bearish text-foreground'
56
56
  };
57
57
  const light = {
58
- default: 'bg-transparent text-default-foreground',
59
- primary: 'bg-transparent text-primary',
60
- secondary: 'bg-transparent text-foreground-300',
61
- success: 'bg-transparent text-success',
62
- warning: 'bg-transparent text-warning',
63
- danger: 'bg-transparent text-danger',
64
- foreground: 'bg-transparent text-foreground',
65
- bullish: 'bg-transparent text-bullish',
66
- bearish: 'bg-transparent text-bearish'
58
+ default: 'bg-transparent text-foreground data-[hover=true]:bg-background-200/50',
59
+ primary: 'bg-transparent text-primary data-[hover=true]:bg-primary/20',
60
+ secondary: 'bg-transparent text-secondary data-[hover=true]:bg-background-200/50',
61
+ success: 'bg-transparent text-success data-[hover=true]:bg-success/20',
62
+ warning: 'bg-transparent text-warning data-[hover=true]:bg-warning/20',
63
+ danger: 'bg-transparent text-danger data-[hover=true]:bg-danger/20',
64
+ foreground: 'bg-transparent text-foreground data-[hover=true]:bg-foreground/20',
65
+ bullish: 'bg-transparent text-bullish data-[hover=true]:bg-bullish/20',
66
+ bearish: 'bg-transparent text-bearish data-[hover=true]:bg-bearish/20'
67
67
  };
68
68
  const ghost = {
69
69
  default: 'border-default text-default-foreground',
@@ -77,9 +77,9 @@ const ghost = {
77
77
  bearish: 'border-bearish text-foreground hover:!bg-bearish'
78
78
  };
79
79
  const variants_text = {
80
- default: 'bg-transparent text-default-foreground',
80
+ default: 'bg-transparent text-foreground',
81
81
  primary: 'bg-transparent text-primary',
82
- secondary: 'bg-transparent text-foreground-300',
82
+ secondary: 'bg-transparent text-secondary',
83
83
  success: 'bg-transparent text-success',
84
84
  warning: 'bg-transparent text-warning',
85
85
  danger: 'bg-transparent text-danger',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@particle-network/ui-react",
3
- "version": "0.4.0-beta.3",
3
+ "version": "0.4.0-beta.31",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
@@ -38,9 +38,8 @@
38
38
  "@rslib/core": "^0.12.3",
39
39
  "@types/react": "^19.1.10",
40
40
  "react": "^19.1.0",
41
- "typescript": "^5.8.3",
42
- "@particle-network/eslint-config": "0.3.0",
43
- "@particle-network/lintstaged-config": "0.1.0"
41
+ "@particle-network/lintstaged-config": "0.1.0",
42
+ "@particle-network/eslint-config": "0.3.0"
44
43
  },
45
44
  "peerDependencies": {
46
45
  "react": ">=16.9.0",
@@ -50,13 +49,13 @@
50
49
  "ahooks": "^3.9.4",
51
50
  "copy-to-clipboard": "^3.3.3",
52
51
  "zustand": "^5.0.8",
53
- "@particle-network/icons": "0.4.0-beta.1",
54
- "@particle-network/ui-shared": "0.3.0-beta.0"
52
+ "@particle-network/icons": "0.4.0-beta.14",
53
+ "@particle-network/ui-shared": "0.3.0-beta.6"
55
54
  },
56
55
  "scripts": {
57
56
  "build": "rslib build",
58
57
  "dev": "rslib build --watch",
59
- "type-check": "npx tsc --noEmit -p ./tsconfig.json",
58
+ "type-check": "npx tsgo --noEmit -p ./tsconfig.json",
60
59
  "lint": "eslint . --no-error-on-unmatched-pattern --quiet",
61
60
  "lint:fix": "eslint . --fix --no-error-on-unmatched-pattern --quiet",
62
61
  "clean": "rm -rf .turbo node_modules dist"