@particle-network/ui-react 0.4.5-beta.18 → 0.4.5-beta.19
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,10 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type
|
|
2
|
+
import { type ThemeId } from '@particle-network/ui-shared';
|
|
3
|
+
import { type UXModalProps } from '../UXModal';
|
|
3
4
|
export interface UXThemeSwitchModalProps extends Pick<UXModalProps, 'isOpen' | 'onClose' | 'onOpenChange' | 'backdrop'> {
|
|
4
5
|
as?: 'modal' | 'drawer';
|
|
6
|
+
omitThemes?: ThemeId[];
|
|
5
7
|
}
|
|
6
8
|
export declare const UXThemeSwitchModal: React.FC<UXThemeSwitchModalProps>;
|
|
7
|
-
export interface UXThemeSwitchProps extends Pick<UXThemeSwitchModalProps, 'as' | 'backdrop'> {
|
|
9
|
+
export interface UXThemeSwitchProps extends Pick<UXThemeSwitchModalProps, 'as' | 'omitThemes' | 'backdrop'> {
|
|
8
10
|
children?: (onOpen: () => void) => React.ReactNode;
|
|
9
11
|
}
|
|
10
12
|
export declare const UXThemeSwitch: React.FC<UXThemeSwitchProps>;
|
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useState } from "react";
|
|
2
|
+
import { useMemo, useState } from "react";
|
|
3
3
|
import { cn } from "@heroui/theme";
|
|
4
4
|
import { useDisclosure } from "@heroui/use-disclosure";
|
|
5
5
|
import { ChartColorSwitchIcon, CopyIcon } from "@particle-network/icons/web";
|
|
6
6
|
import { themeData } from "@particle-network/ui-shared";
|
|
7
7
|
import { useI18n } from "../../hooks/index.js";
|
|
8
|
-
import { UXCopy, UXTooltip } from "../index.js";
|
|
9
8
|
import { HStack, VStack } from "../layout/index.js";
|
|
10
9
|
import { Text } from "../typography/Text.js";
|
|
11
10
|
import { UXButton } from "../UXButton/index.js";
|
|
11
|
+
import { UXCopy } from "../UXCopy/index.js";
|
|
12
12
|
import { UXDivider } from "../UXDivider/index.js";
|
|
13
13
|
import { UXDrawer } from "../UXDrawer/index.js";
|
|
14
14
|
import { UXInput } from "../UXInput/index.js";
|
|
15
15
|
import { UXModal } from "../UXModal/index.js";
|
|
16
16
|
import { UXSpinner } from "../UXSpinner/index.js";
|
|
17
|
+
import { UXTooltip } from "../UXTooltip/index.js";
|
|
17
18
|
import { ThemeItem } from "./theme-item.js";
|
|
18
19
|
import { useTheme } from "./use-theme.js";
|
|
19
20
|
const FONT_EXAMPLES = [
|
|
@@ -30,11 +31,14 @@ const FONT_EXAMPLES = [
|
|
|
30
31
|
url: 'https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100..900;1,100..900&display=swap'
|
|
31
32
|
}
|
|
32
33
|
];
|
|
33
|
-
const UXThemeSwitchModal = ({ as = 'modal', backdrop, isOpen, onClose, onOpenChange })=>{
|
|
34
|
+
const UXThemeSwitchModal = ({ as = 'modal', omitThemes = [], backdrop, isOpen, onClose, onOpenChange })=>{
|
|
34
35
|
const i18n = useI18n();
|
|
35
36
|
const { theme: selectedTheme, setTheme, fontUrl, setFontUrl, fontName, fontLoadStatus, clearFontUrl } = useTheme();
|
|
36
37
|
const [isFontExampleOpen, setIsFontExampleOpen] = useState(false);
|
|
37
38
|
const Component = 'modal' === as ? UXModal : UXDrawer;
|
|
39
|
+
const themes = useMemo(()=>themeData.filter((theme)=>!omitThemes.includes(theme.id)), [
|
|
40
|
+
omitThemes
|
|
41
|
+
]);
|
|
38
42
|
return /*#__PURE__*/ jsx(Component, {
|
|
39
43
|
isOpen: isOpen,
|
|
40
44
|
classNames: {
|
|
@@ -55,7 +59,7 @@ const UXThemeSwitchModal = ({ as = 'modal', backdrop, isOpen, onClose, onOpenCha
|
|
|
55
59
|
children: [
|
|
56
60
|
/*#__PURE__*/ jsx("div", {
|
|
57
61
|
className: "grid grid-cols-3 gap-y-5 pt-1",
|
|
58
|
-
children:
|
|
62
|
+
children: themes.map((theme)=>/*#__PURE__*/ jsx(ThemeItem, {
|
|
59
63
|
isSelected: selectedTheme.id === theme.id,
|
|
60
64
|
onClick: ()=>setTheme(theme),
|
|
61
65
|
...theme
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@particle-network/ui-react",
|
|
3
|
-
"version": "0.4.5-beta.
|
|
3
|
+
"version": "0.4.5-beta.19",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -49,8 +49,8 @@
|
|
|
49
49
|
"ahooks": "^3.9.4",
|
|
50
50
|
"copy-to-clipboard": "^3.3.3",
|
|
51
51
|
"zustand": "^5.0.8",
|
|
52
|
-
"@particle-network/icons": "0.4.2-beta.
|
|
53
|
-
"@particle-network/ui-shared": "0.3.2-beta.
|
|
52
|
+
"@particle-network/icons": "0.4.2-beta.8",
|
|
53
|
+
"@particle-network/ui-shared": "0.3.2-beta.4"
|
|
54
54
|
},
|
|
55
55
|
"scripts": {
|
|
56
56
|
"build": "rslib build",
|