@bifrostui/react 1.3.1-beta.0 → 1.3.1-beta.1
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/Modal/Modal.miniapp.d.ts +1 -1
- package/dist/Popover/Popover.d.ts +1 -1
- package/dist/Popover/Popover.js +4 -4
- package/dist/Popover/Popover.types.d.ts +0 -1
- package/dist/ThemeProvider/ThemeProvider.js +3 -2
- package/dist/Tooltip/Tooltip.d.ts +1 -1
- package/dist/Tooltip/Tooltip.js +3 -5
- package/dist/Tooltip/Tooltip.types.d.ts +0 -1
- package/es/Modal/Modal.miniapp.d.ts +1 -1
- package/es/Popover/Popover.d.ts +1 -1
- package/es/Popover/Popover.js +10 -6
- package/es/Popover/Popover.types.d.ts +0 -1
- package/es/ThemeProvider/ThemeProvider.js +4 -3
- package/es/Tooltip/Tooltip.d.ts +1 -1
- package/es/Tooltip/Tooltip.js +8 -6
- package/es/Tooltip/Tooltip.types.d.ts +0 -1
- package/package.json +5 -5
|
@@ -12,5 +12,5 @@ declare const Modal: React.ForwardRefExoticComponent<Omit<ViewProps & {
|
|
|
12
12
|
keepMounted?: boolean;
|
|
13
13
|
} & import("@bifrostui/types").ICommonProps & Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
14
14
|
ref?: React.Ref<HTMLDivElement>;
|
|
15
|
-
}, "
|
|
15
|
+
}, keyof import("@bifrostui/types").ICommonProps | "container" | "open" | "disablePortal" | "hideBackdrop" | "BackdropProps" | "onClose" | "disableScrollLock" | "keepMounted">, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
16
16
|
export default Modal;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import './Popover.less';
|
|
3
3
|
import { PopoverProps } from './Popover.types';
|
|
4
|
-
declare const Popover: React.ForwardRefExoticComponent<Omit<PopoverProps<"div", {}>, "ref"> & React.RefAttributes<
|
|
4
|
+
declare const Popover: React.ForwardRefExoticComponent<Omit<PopoverProps<"div", {}>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
5
5
|
export default Popover;
|
package/dist/Popover/Popover.js
CHANGED
|
@@ -107,7 +107,7 @@ const Popover = /* @__PURE__ */ import_react.default.forwardRef((props, ref) =>
|
|
|
107
107
|
const [arrowDirection, setArrowDirection] = (0, import_react.useState)(direction);
|
|
108
108
|
const [arrowLocation, setArrowLocation] = (0, import_react.useState)(location);
|
|
109
109
|
const [tooltyles, setTooltyles] = (0, import_react.useState)({});
|
|
110
|
-
const ttId = (0,
|
|
110
|
+
const ttId = (0, import_utils.useUniqueId)();
|
|
111
111
|
const onRootElementMouted = () => {
|
|
112
112
|
const result = (0, import_utils.getStylesAndLocation)({
|
|
113
113
|
childrenRef,
|
|
@@ -142,7 +142,7 @@ const Popover = /* @__PURE__ */ import_react.default.forwardRef((props, ref) =>
|
|
|
142
142
|
const showPopover = (event) => {
|
|
143
143
|
changeOpenStatus(event, true);
|
|
144
144
|
};
|
|
145
|
-
if (!
|
|
145
|
+
if (!title && !content)
|
|
146
146
|
return null;
|
|
147
147
|
const triggerEventOption = (0, import_utils.triggerEventTransform)({
|
|
148
148
|
trigger,
|
|
@@ -153,7 +153,7 @@ const Popover = /* @__PURE__ */ import_react.default.forwardRef((props, ref) =>
|
|
|
153
153
|
const childrenOptions = __spreadValues({
|
|
154
154
|
ref: childrenRef
|
|
155
155
|
}, triggerEventOption);
|
|
156
|
-
return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null,
|
|
156
|
+
return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, open || openStatus ? /* @__PURE__ */ import_react.default.createElement(
|
|
157
157
|
import_Portal.default,
|
|
158
158
|
__spreadProps(__spreadValues({
|
|
159
159
|
onRootElementMouted
|
|
@@ -180,7 +180,7 @@ const Popover = /* @__PURE__ */ import_react.default.forwardRef((props, ref) =>
|
|
|
180
180
|
) : null,
|
|
181
181
|
/* @__PURE__ */ import_react.default.createElement("div", { className: "bui-popover-content" }, title ? /* @__PURE__ */ import_react.default.createElement("div", { className: "bui-popover-title" }, title) : null, content ? /* @__PURE__ */ import_react.default.createElement("div", { className: "bui-popover-inner-content" }, content) : null)
|
|
182
182
|
)
|
|
183
|
-
) : null, import_react.default.cloneElement(children, childrenOptions));
|
|
183
|
+
) : null, import_react.default.isValidElement(children) ? import_react.default.cloneElement(children, childrenOptions) : children);
|
|
184
184
|
});
|
|
185
185
|
Popover.displayName = "BuiPopover";
|
|
186
186
|
var Popover_default = Popover;
|
|
@@ -4,7 +4,6 @@ import { PortalCoreProps } from '../Portal/Portal.types';
|
|
|
4
4
|
type triggerType = 'click' | 'hover';
|
|
5
5
|
export type PopoverProps<D extends React.ElementType = 'div', P = {}> = OverrideProps<{
|
|
6
6
|
props: P & {
|
|
7
|
-
children: React.ReactElement;
|
|
8
7
|
/**
|
|
9
8
|
* 默认是否显隐
|
|
10
9
|
* @default false
|
|
@@ -31,6 +31,7 @@ __export(ThemeProvider_exports, {
|
|
|
31
31
|
});
|
|
32
32
|
module.exports = __toCommonJS(ThemeProvider_exports);
|
|
33
33
|
var import_react = __toESM(require("react"));
|
|
34
|
+
var import_utils = require("@bifrostui/utils");
|
|
34
35
|
var import_hooks = require("./hooks");
|
|
35
36
|
var import_constants = require("./utils/constants");
|
|
36
37
|
var import_mountTokens = require("./utils/mountTokens");
|
|
@@ -48,13 +49,13 @@ const ThemeProvider = /* @__PURE__ */ import_react.default.forwardRef(
|
|
|
48
49
|
token,
|
|
49
50
|
children
|
|
50
51
|
} = props;
|
|
51
|
-
let containerId = (
|
|
52
|
+
let containerId = (0, import_utils.useUniqueId)();
|
|
52
53
|
containerId = `${import_constants.BUI_VAR_PREFIX}${containerId}`;
|
|
53
54
|
const theme = (0, import_react.useMemo)(() => {
|
|
54
55
|
return { locale };
|
|
55
56
|
}, [locale]);
|
|
56
57
|
let childrenNode = children;
|
|
57
|
-
if (import_react.default.isValidElement(children)) {
|
|
58
|
+
if (!isRoot && import_react.default.isValidElement(children)) {
|
|
58
59
|
childrenNode = import_react.default.cloneElement(children, {
|
|
59
60
|
className: `${containerId} ${((_a = children == null ? void 0 : children.props) == null ? void 0 : _a.className) || ""}`.trim()
|
|
60
61
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import './Tooltip.less';
|
|
3
2
|
import { TooltipProps } from './Tooltip.types';
|
|
3
|
+
import './Tooltip.less';
|
|
4
4
|
declare const Tooltip: React.ForwardRefExoticComponent<Omit<TooltipProps<"div", {}>, "ref"> & React.RefAttributes<HTMLElement>>;
|
|
5
5
|
export default Tooltip;
|
package/dist/Tooltip/Tooltip.js
CHANGED
|
@@ -63,7 +63,7 @@ var import_clsx = __toESM(require("clsx"));
|
|
|
63
63
|
var import_react = __toESM(require("react"));
|
|
64
64
|
var import_utils = require("@bifrostui/utils");
|
|
65
65
|
var import_Portal = __toESM(require("../Portal"));
|
|
66
|
-
var
|
|
66
|
+
var import_Tooltip2 = require("./Tooltip.css");
|
|
67
67
|
const prefixCls = "bui-tooltip";
|
|
68
68
|
const Tooltip = /* @__PURE__ */ import_react.default.forwardRef((props, ref) => {
|
|
69
69
|
const _a = props, {
|
|
@@ -103,7 +103,7 @@ const Tooltip = /* @__PURE__ */ import_react.default.forwardRef((props, ref) =>
|
|
|
103
103
|
const [arrowDirection, setArrowDirection] = (0, import_react.useState)(direction);
|
|
104
104
|
const [arrowLocation, setArrowLocation] = (0, import_react.useState)(location);
|
|
105
105
|
const [tooltyles, setTooltyles] = (0, import_react.useState)({});
|
|
106
|
-
const ttId = (0,
|
|
106
|
+
const ttId = (0, import_utils.useUniqueId)();
|
|
107
107
|
const onRootElementMouted = () => {
|
|
108
108
|
const result = (0, import_utils.getStylesAndLocation)({
|
|
109
109
|
childrenRef,
|
|
@@ -147,8 +147,6 @@ const Tooltip = /* @__PURE__ */ import_react.default.forwardRef((props, ref) =>
|
|
|
147
147
|
const childrenOptions = __spreadValues({
|
|
148
148
|
ref: childrenRef
|
|
149
149
|
}, triggerEventOption);
|
|
150
|
-
if (!children || !title)
|
|
151
|
-
return null;
|
|
152
150
|
return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, (open || openStatus) && title ? /* @__PURE__ */ import_react.default.createElement(
|
|
153
151
|
import_Portal.default,
|
|
154
152
|
__spreadProps(__spreadValues({
|
|
@@ -171,7 +169,7 @@ const Tooltip = /* @__PURE__ */ import_react.default.forwardRef((props, ref) =>
|
|
|
171
169
|
),
|
|
172
170
|
/* @__PURE__ */ import_react.default.createElement("div", { className: "bui-tooltip-content" }, title)
|
|
173
171
|
)
|
|
174
|
-
) : null, import_react.default.cloneElement(children, childrenOptions));
|
|
172
|
+
) : null, import_react.default.isValidElement(children) ? import_react.default.cloneElement(children, childrenOptions) : children);
|
|
175
173
|
});
|
|
176
174
|
Tooltip.displayName = "BuiTooltip";
|
|
177
175
|
var Tooltip_default = Tooltip;
|
|
@@ -12,5 +12,5 @@ declare const Modal: React.ForwardRefExoticComponent<Omit<ViewProps & {
|
|
|
12
12
|
keepMounted?: boolean;
|
|
13
13
|
} & import("@bifrostui/types").ICommonProps & Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
14
14
|
ref?: React.Ref<HTMLDivElement>;
|
|
15
|
-
}, keyof import("@bifrostui/types").ICommonProps | "container" | "
|
|
15
|
+
}, "open" | keyof import("@bifrostui/types").ICommonProps | "container" | "onClose" | "keepMounted" | "disablePortal" | "hideBackdrop" | "BackdropProps" | "disableScrollLock">, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
16
16
|
export default Modal;
|
package/es/Popover/Popover.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import './Popover.less';
|
|
3
3
|
import { PopoverProps } from './Popover.types';
|
|
4
|
-
declare const Popover: React.ForwardRefExoticComponent<Omit<PopoverProps<"div", {}>, "ref"> & React.RefAttributes<
|
|
4
|
+
declare const Popover: React.ForwardRefExoticComponent<Omit<PopoverProps<"div", {}>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
5
5
|
export default Popover;
|
package/es/Popover/Popover.js
CHANGED
|
@@ -30,8 +30,12 @@ var __objRest = (source, exclude) => {
|
|
|
30
30
|
return target;
|
|
31
31
|
};
|
|
32
32
|
import clsx from "clsx";
|
|
33
|
-
import React, { useState, useRef
|
|
34
|
-
import {
|
|
33
|
+
import React, { useState, useRef } from "react";
|
|
34
|
+
import {
|
|
35
|
+
getStylesAndLocation,
|
|
36
|
+
triggerEventTransform,
|
|
37
|
+
useUniqueId
|
|
38
|
+
} from "@bifrostui/utils";
|
|
35
39
|
import Portal from "../Portal";
|
|
36
40
|
import "./Popover.css";
|
|
37
41
|
const prefixCls = "bui-popover";
|
|
@@ -77,7 +81,7 @@ const Popover = /* @__PURE__ */ React.forwardRef((props, ref) => {
|
|
|
77
81
|
const [arrowDirection, setArrowDirection] = useState(direction);
|
|
78
82
|
const [arrowLocation, setArrowLocation] = useState(location);
|
|
79
83
|
const [tooltyles, setTooltyles] = useState({});
|
|
80
|
-
const ttId =
|
|
84
|
+
const ttId = useUniqueId();
|
|
81
85
|
const onRootElementMouted = () => {
|
|
82
86
|
const result = getStylesAndLocation({
|
|
83
87
|
childrenRef,
|
|
@@ -112,7 +116,7 @@ const Popover = /* @__PURE__ */ React.forwardRef((props, ref) => {
|
|
|
112
116
|
const showPopover = (event) => {
|
|
113
117
|
changeOpenStatus(event, true);
|
|
114
118
|
};
|
|
115
|
-
if (!
|
|
119
|
+
if (!title && !content)
|
|
116
120
|
return null;
|
|
117
121
|
const triggerEventOption = triggerEventTransform({
|
|
118
122
|
trigger,
|
|
@@ -123,7 +127,7 @@ const Popover = /* @__PURE__ */ React.forwardRef((props, ref) => {
|
|
|
123
127
|
const childrenOptions = __spreadValues({
|
|
124
128
|
ref: childrenRef
|
|
125
129
|
}, triggerEventOption);
|
|
126
|
-
return /* @__PURE__ */ React.createElement(React.Fragment, null,
|
|
130
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, open || openStatus ? /* @__PURE__ */ React.createElement(
|
|
127
131
|
Portal,
|
|
128
132
|
__spreadProps(__spreadValues({
|
|
129
133
|
onRootElementMouted
|
|
@@ -150,7 +154,7 @@ const Popover = /* @__PURE__ */ React.forwardRef((props, ref) => {
|
|
|
150
154
|
) : null,
|
|
151
155
|
/* @__PURE__ */ React.createElement("div", { className: "bui-popover-content" }, title ? /* @__PURE__ */ React.createElement("div", { className: "bui-popover-title" }, title) : null, content ? /* @__PURE__ */ React.createElement("div", { className: "bui-popover-inner-content" }, content) : null)
|
|
152
156
|
)
|
|
153
|
-
) : null, React.cloneElement(children, childrenOptions));
|
|
157
|
+
) : null, React.isValidElement(children) ? React.cloneElement(children, childrenOptions) : children);
|
|
154
158
|
});
|
|
155
159
|
Popover.displayName = "BuiPopover";
|
|
156
160
|
var Popover_default = Popover;
|
|
@@ -4,7 +4,6 @@ import { PortalCoreProps } from '../Portal/Portal.types';
|
|
|
4
4
|
type triggerType = 'click' | 'hover';
|
|
5
5
|
export type PopoverProps<D extends React.ElementType = 'div', P = {}> = OverrideProps<{
|
|
6
6
|
props: P & {
|
|
7
|
-
children: React.ReactElement;
|
|
8
7
|
/**
|
|
9
8
|
* 默认是否显隐
|
|
10
9
|
* @default false
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import React, { useMemo,
|
|
1
|
+
import React, { useMemo, useEffect } from "react";
|
|
2
|
+
import { useUniqueId } from "@bifrostui/utils";
|
|
2
3
|
import { ThemeContext } from "./hooks";
|
|
3
4
|
import { BUI_VAR_PREFIX } from "./utils/constants";
|
|
4
5
|
import { mountTokens } from "./utils/mountTokens";
|
|
@@ -16,13 +17,13 @@ const ThemeProvider = /* @__PURE__ */ React.forwardRef(
|
|
|
16
17
|
token,
|
|
17
18
|
children
|
|
18
19
|
} = props;
|
|
19
|
-
let containerId = (
|
|
20
|
+
let containerId = useUniqueId();
|
|
20
21
|
containerId = `${BUI_VAR_PREFIX}${containerId}`;
|
|
21
22
|
const theme = useMemo(() => {
|
|
22
23
|
return { locale };
|
|
23
24
|
}, [locale]);
|
|
24
25
|
let childrenNode = children;
|
|
25
|
-
if (React.isValidElement(children)) {
|
|
26
|
+
if (!isRoot && React.isValidElement(children)) {
|
|
26
27
|
childrenNode = React.cloneElement(children, {
|
|
27
28
|
className: `${containerId} ${((_a = children == null ? void 0 : children.props) == null ? void 0 : _a.className) || ""}`.trim()
|
|
28
29
|
});
|
package/es/Tooltip/Tooltip.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import './Tooltip.less';
|
|
3
2
|
import { TooltipProps } from './Tooltip.types';
|
|
3
|
+
import './Tooltip.less';
|
|
4
4
|
declare const Tooltip: React.ForwardRefExoticComponent<Omit<TooltipProps<"div", {}>, "ref"> & React.RefAttributes<HTMLElement>>;
|
|
5
5
|
export default Tooltip;
|
package/es/Tooltip/Tooltip.js
CHANGED
|
@@ -30,8 +30,12 @@ var __objRest = (source, exclude) => {
|
|
|
30
30
|
return target;
|
|
31
31
|
};
|
|
32
32
|
import clsx from "clsx";
|
|
33
|
-
import React, { useState, useRef
|
|
34
|
-
import {
|
|
33
|
+
import React, { useState, useRef } from "react";
|
|
34
|
+
import {
|
|
35
|
+
getStylesAndLocation,
|
|
36
|
+
triggerEventTransform,
|
|
37
|
+
useUniqueId
|
|
38
|
+
} from "@bifrostui/utils";
|
|
35
39
|
import Portal from "../Portal";
|
|
36
40
|
import "./Tooltip.css";
|
|
37
41
|
const prefixCls = "bui-tooltip";
|
|
@@ -73,7 +77,7 @@ const Tooltip = /* @__PURE__ */ React.forwardRef((props, ref) => {
|
|
|
73
77
|
const [arrowDirection, setArrowDirection] = useState(direction);
|
|
74
78
|
const [arrowLocation, setArrowLocation] = useState(location);
|
|
75
79
|
const [tooltyles, setTooltyles] = useState({});
|
|
76
|
-
const ttId =
|
|
80
|
+
const ttId = useUniqueId();
|
|
77
81
|
const onRootElementMouted = () => {
|
|
78
82
|
const result = getStylesAndLocation({
|
|
79
83
|
childrenRef,
|
|
@@ -117,8 +121,6 @@ const Tooltip = /* @__PURE__ */ React.forwardRef((props, ref) => {
|
|
|
117
121
|
const childrenOptions = __spreadValues({
|
|
118
122
|
ref: childrenRef
|
|
119
123
|
}, triggerEventOption);
|
|
120
|
-
if (!children || !title)
|
|
121
|
-
return null;
|
|
122
124
|
return /* @__PURE__ */ React.createElement(React.Fragment, null, (open || openStatus) && title ? /* @__PURE__ */ React.createElement(
|
|
123
125
|
Portal,
|
|
124
126
|
__spreadProps(__spreadValues({
|
|
@@ -141,7 +143,7 @@ const Tooltip = /* @__PURE__ */ React.forwardRef((props, ref) => {
|
|
|
141
143
|
),
|
|
142
144
|
/* @__PURE__ */ React.createElement("div", { className: "bui-tooltip-content" }, title)
|
|
143
145
|
)
|
|
144
|
-
) : null, React.cloneElement(children, childrenOptions));
|
|
146
|
+
) : null, React.isValidElement(children) ? React.cloneElement(children, childrenOptions) : children);
|
|
145
147
|
});
|
|
146
148
|
Tooltip.displayName = "BuiTooltip";
|
|
147
149
|
var Tooltip_default = Tooltip;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bifrostui/react",
|
|
3
|
-
"version": "1.3.1-beta.
|
|
3
|
+
"version": "1.3.1-beta.1",
|
|
4
4
|
"description": "React components for building mobile application",
|
|
5
5
|
"homepage": "http://bui.taopiaopiao.com",
|
|
6
6
|
"license": "MIT",
|
|
@@ -33,10 +33,10 @@
|
|
|
33
33
|
"clsx": "^1.2.1",
|
|
34
34
|
"dayjs": "^1.11.7",
|
|
35
35
|
"swiper": "^8.1.5",
|
|
36
|
-
"@bifrostui/icons": "1.3.1-beta.
|
|
37
|
-
"@bifrostui/
|
|
38
|
-
"@bifrostui/types": "1.3.1-beta.
|
|
39
|
-
"@bifrostui/
|
|
36
|
+
"@bifrostui/icons": "1.3.1-beta.1",
|
|
37
|
+
"@bifrostui/utils": "1.3.1-beta.1",
|
|
38
|
+
"@bifrostui/types": "1.3.1-beta.1",
|
|
39
|
+
"@bifrostui/styles": "1.3.1-beta.1"
|
|
40
40
|
},
|
|
41
41
|
"peerDependencies": {
|
|
42
42
|
"@tarojs/components": "^3.0.0",
|