@number-flow/react 0.3.3 → 0.3.4
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/index.js +18 -4
- package/dist/index.mjs +19 -5
- package/package.json +3 -2
package/dist/index.js
CHANGED
|
@@ -45,6 +45,7 @@ __export(src_exports, {
|
|
|
45
45
|
module.exports = __toCommonJS(src_exports);
|
|
46
46
|
var React = __toESM(require("react"));
|
|
47
47
|
var import_number_flow = require("number-flow");
|
|
48
|
+
var import_esm_env = require("esm-env");
|
|
48
49
|
var REACT_MAJOR = parseInt(React.version.match(/^(\d+)\./)?.[1]);
|
|
49
50
|
var isReact19 = REACT_MAJOR >= 19;
|
|
50
51
|
var OBSERVED_ATTRIBUTES = ["data"];
|
|
@@ -131,7 +132,19 @@ var NumberFlowImpl = class extends React.Component {
|
|
|
131
132
|
__privateSet(this, _el, el);
|
|
132
133
|
}
|
|
133
134
|
render() {
|
|
134
|
-
const [
|
|
135
|
+
const [
|
|
136
|
+
_,
|
|
137
|
+
{
|
|
138
|
+
innerRef,
|
|
139
|
+
className,
|
|
140
|
+
data,
|
|
141
|
+
willChange,
|
|
142
|
+
isolate,
|
|
143
|
+
onAnimationsStart,
|
|
144
|
+
onAnimationsFinish,
|
|
145
|
+
...rest
|
|
146
|
+
}
|
|
147
|
+
] = splitProps(this.props);
|
|
135
148
|
return (
|
|
136
149
|
// @ts-expect-error missing types
|
|
137
150
|
/* @__PURE__ */ React.createElement(
|
|
@@ -140,10 +153,11 @@ var NumberFlowImpl = class extends React.Component {
|
|
|
140
153
|
ref: this.handleRef,
|
|
141
154
|
"data-will-change": willChange ? "" : void 0,
|
|
142
155
|
class: className,
|
|
156
|
+
"aria-label": data.valueAsString,
|
|
143
157
|
...rest,
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
158
|
+
role: "img",
|
|
159
|
+
dangerouslySetInnerHTML: { __html: import_esm_env.BROWSER ? "" : (0, import_number_flow.renderInnerHTML)(data) },
|
|
160
|
+
suppressHydrationWarning: true,
|
|
147
161
|
data: serializeData(data)
|
|
148
162
|
}
|
|
149
163
|
)
|
package/dist/index.mjs
CHANGED
|
@@ -10,13 +10,14 @@ var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "
|
|
|
10
10
|
// src/index.tsx
|
|
11
11
|
import * as React from "react";
|
|
12
12
|
import {
|
|
13
|
-
|
|
13
|
+
renderInnerHTML,
|
|
14
14
|
formatToData,
|
|
15
15
|
NumberFlowLite,
|
|
16
16
|
prefersReducedMotion,
|
|
17
17
|
canAnimate as _canAnimate,
|
|
18
18
|
define
|
|
19
19
|
} from "number-flow";
|
|
20
|
+
import { BROWSER } from "esm-env";
|
|
20
21
|
var REACT_MAJOR = parseInt(React.version.match(/^(\d+)\./)?.[1]);
|
|
21
22
|
var isReact19 = REACT_MAJOR >= 19;
|
|
22
23
|
var OBSERVED_ATTRIBUTES = ["data"];
|
|
@@ -103,7 +104,19 @@ var NumberFlowImpl = class extends React.Component {
|
|
|
103
104
|
__privateSet(this, _el, el);
|
|
104
105
|
}
|
|
105
106
|
render() {
|
|
106
|
-
const [
|
|
107
|
+
const [
|
|
108
|
+
_,
|
|
109
|
+
{
|
|
110
|
+
innerRef,
|
|
111
|
+
className,
|
|
112
|
+
data,
|
|
113
|
+
willChange,
|
|
114
|
+
isolate,
|
|
115
|
+
onAnimationsStart,
|
|
116
|
+
onAnimationsFinish,
|
|
117
|
+
...rest
|
|
118
|
+
}
|
|
119
|
+
] = splitProps(this.props);
|
|
107
120
|
return (
|
|
108
121
|
// @ts-expect-error missing types
|
|
109
122
|
/* @__PURE__ */ React.createElement(
|
|
@@ -112,10 +125,11 @@ var NumberFlowImpl = class extends React.Component {
|
|
|
112
125
|
ref: this.handleRef,
|
|
113
126
|
"data-will-change": willChange ? "" : void 0,
|
|
114
127
|
class: className,
|
|
128
|
+
"aria-label": data.valueAsString,
|
|
115
129
|
...rest,
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
130
|
+
role: "img",
|
|
131
|
+
dangerouslySetInnerHTML: { __html: BROWSER ? "" : renderInnerHTML(data) },
|
|
132
|
+
suppressHydrationWarning: true,
|
|
119
133
|
data: serializeData(data)
|
|
120
134
|
}
|
|
121
135
|
)
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "0.3.
|
|
6
|
+
"version": "0.3.4",
|
|
7
7
|
"author": {
|
|
8
8
|
"name": "Maxwell Barvian",
|
|
9
9
|
"email": "max@barvian.me",
|
|
@@ -48,7 +48,8 @@
|
|
|
48
48
|
}
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"
|
|
51
|
+
"esm-env": "^1.1.4",
|
|
52
|
+
"number-flow": "0.3.9"
|
|
52
53
|
},
|
|
53
54
|
"devDependencies": {
|
|
54
55
|
"@playwright/test": "^1.48.0",
|