@number-flow/react 0.5.3 → 0.5.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/NumberFlow-client-CHWbu7lx.mjs +179 -0
- package/dist/NumberFlow-client-CMnZwURp.js +201 -0
- package/dist/index.d.mts +39 -3
- package/dist/index.d.ts +39 -3
- package/dist/index.js +43 -252
- package/dist/index.mjs +14 -38
- package/package.json +5 -5
- package/dist/NumberFlow.d.mts +0 -40
- package/dist/NumberFlow.d.ts +0 -40
- package/dist/NumberFlow.js +0 -225
- package/dist/NumberFlow.mjs +0 -11
- package/dist/chunk-44AMDIF5.mjs +0 -194
package/dist/index.js
CHANGED
|
@@ -1,259 +1,50 @@
|
|
|
1
|
-
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
21
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
22
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
23
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
24
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
25
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
26
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
27
|
-
mod
|
|
28
|
-
));
|
|
29
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
1
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
30
2
|
|
|
31
|
-
|
|
32
|
-
var
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
NumberFlowGroup: () => NumberFlowGroup,
|
|
36
|
-
default: () => NumberFlow_default,
|
|
37
|
-
useCanAnimate: () => useCanAnimate,
|
|
38
|
-
useIsSupported: () => useIsSupported,
|
|
39
|
-
usePrefersReducedMotion: () => usePrefersReducedMotion
|
|
40
|
-
});
|
|
41
|
-
module.exports = __toCommonJS(index_exports);
|
|
42
|
-
var React2 = __toESM(require("react"));
|
|
43
|
-
var import_number_flow2 = require("number-flow");
|
|
44
|
-
__reExport(index_exports, require("number-flow/plugins"), module.exports);
|
|
3
|
+
var React = require('react');
|
|
4
|
+
var numberFlow = require('number-flow');
|
|
5
|
+
var plugins = require('number-flow/plugins');
|
|
6
|
+
var NumberFlowClient = require('./NumberFlow-client-CMnZwURp.js');
|
|
45
7
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
var
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
var
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
function splitProps(props) {
|
|
63
|
-
const {
|
|
64
|
-
transformTiming,
|
|
65
|
-
spinTiming,
|
|
66
|
-
opacityTiming,
|
|
67
|
-
animated,
|
|
68
|
-
respectMotionPreference,
|
|
69
|
-
trend,
|
|
70
|
-
plugins,
|
|
71
|
-
...rest
|
|
72
|
-
} = props;
|
|
73
|
-
return [
|
|
74
|
-
{
|
|
75
|
-
transformTiming,
|
|
76
|
-
spinTiming,
|
|
77
|
-
opacityTiming,
|
|
78
|
-
animated,
|
|
79
|
-
respectMotionPreference,
|
|
80
|
-
trend,
|
|
81
|
-
plugins
|
|
82
|
-
},
|
|
83
|
-
rest
|
|
84
|
-
];
|
|
85
|
-
}
|
|
86
|
-
var NumberFlowImpl = class extends React.Component {
|
|
87
|
-
constructor(props) {
|
|
88
|
-
super(props);
|
|
89
|
-
this.handleRef = this.handleRef.bind(this);
|
|
90
|
-
}
|
|
91
|
-
// Update the non-`data` props to avoid JSON serialization
|
|
92
|
-
// Data needs to be set in render still:
|
|
93
|
-
updateProperties(prevProps) {
|
|
94
|
-
if (!this.el) return;
|
|
95
|
-
this.el.manual = !this.props.isolate;
|
|
96
|
-
const [nonData] = splitProps(this.props);
|
|
97
|
-
Object.entries(nonData).forEach(([k, v]) => {
|
|
98
|
-
this.el[k] = v ?? NumberFlowElement.defaultProps[k];
|
|
99
|
-
});
|
|
100
|
-
if (prevProps?.onAnimationsStart)
|
|
101
|
-
this.el.removeEventListener("animationsstart", prevProps.onAnimationsStart);
|
|
102
|
-
if (this.props.onAnimationsStart)
|
|
103
|
-
this.el.addEventListener("animationsstart", this.props.onAnimationsStart);
|
|
104
|
-
if (prevProps?.onAnimationsFinish)
|
|
105
|
-
this.el.removeEventListener("animationsfinish", prevProps.onAnimationsFinish);
|
|
106
|
-
if (this.props.onAnimationsFinish)
|
|
107
|
-
this.el.addEventListener("animationsfinish", this.props.onAnimationsFinish);
|
|
108
|
-
}
|
|
109
|
-
componentDidMount() {
|
|
110
|
-
this.updateProperties();
|
|
111
|
-
if (isReact19 && this.el) {
|
|
112
|
-
this.el.digits = this.props.digits;
|
|
113
|
-
this.el.data = this.props.data;
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
getSnapshotBeforeUpdate(prevProps) {
|
|
117
|
-
this.updateProperties(prevProps);
|
|
118
|
-
if (prevProps.data !== this.props.data) {
|
|
119
|
-
if (this.props.group) {
|
|
120
|
-
this.props.group.willUpdate();
|
|
121
|
-
return () => this.props.group?.didUpdate();
|
|
122
|
-
}
|
|
123
|
-
if (!this.props.isolate) {
|
|
124
|
-
this.el?.willUpdate();
|
|
125
|
-
return () => this.el?.didUpdate();
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
return null;
|
|
129
|
-
}
|
|
130
|
-
componentDidUpdate(_, __, didUpdate) {
|
|
131
|
-
didUpdate?.();
|
|
132
|
-
}
|
|
133
|
-
handleRef(el) {
|
|
134
|
-
if (this.props.innerRef) this.props.innerRef.current = el;
|
|
135
|
-
this.el = el;
|
|
136
|
-
}
|
|
137
|
-
render() {
|
|
138
|
-
const [
|
|
139
|
-
_,
|
|
140
|
-
{
|
|
141
|
-
innerRef,
|
|
142
|
-
className,
|
|
143
|
-
data,
|
|
144
|
-
willChange,
|
|
145
|
-
isolate,
|
|
146
|
-
group,
|
|
147
|
-
digits,
|
|
148
|
-
onAnimationsStart,
|
|
149
|
-
onAnimationsFinish,
|
|
150
|
-
...rest
|
|
151
|
-
}
|
|
152
|
-
] = splitProps(this.props);
|
|
153
|
-
return (
|
|
154
|
-
// @ts-expect-error missing types
|
|
155
|
-
/* @__PURE__ */ React.createElement(
|
|
156
|
-
"number-flow-react",
|
|
157
|
-
{
|
|
158
|
-
ref: this.handleRef,
|
|
159
|
-
"data-will-change": willChange ? "" : void 0,
|
|
160
|
-
class: className,
|
|
161
|
-
"aria-label": data.valueAsString,
|
|
162
|
-
...rest,
|
|
163
|
-
role: "img",
|
|
164
|
-
dangerouslySetInnerHTML: { __html: import_esm_env.BROWSER ? "" : (0, import_number_flow.renderInnerHTML)(data) },
|
|
165
|
-
suppressHydrationWarning: true,
|
|
166
|
-
digits: serialize(digits),
|
|
167
|
-
data: serialize(data)
|
|
168
|
-
}
|
|
169
|
-
)
|
|
170
|
-
);
|
|
171
|
-
}
|
|
172
|
-
};
|
|
173
|
-
var NumberFlow = React.forwardRef(function NumberFlow2({ value, locales, format, prefix, suffix, ...props }, _ref) {
|
|
174
|
-
React.useImperativeHandle(_ref, () => ref.current, []);
|
|
175
|
-
const ref = React.useRef();
|
|
176
|
-
const group = React.useContext(NumberFlowGroupContext);
|
|
177
|
-
group?.useRegister(ref);
|
|
178
|
-
const localesString = React.useMemo(() => locales ? JSON.stringify(locales) : "", [locales]);
|
|
179
|
-
const formatString = React.useMemo(() => format ? JSON.stringify(format) : "", [format]);
|
|
180
|
-
const data = React.useMemo(() => {
|
|
181
|
-
const formatter = formatters[`${localesString}:${formatString}`] ??= new Intl.NumberFormat(
|
|
182
|
-
locales,
|
|
183
|
-
format
|
|
184
|
-
);
|
|
185
|
-
return (0, import_number_flow.formatToData)(value, formatter, prefix, suffix);
|
|
186
|
-
}, [value, localesString, formatString, prefix, suffix]);
|
|
187
|
-
return /* @__PURE__ */ React.createElement(NumberFlowImpl, { ...props, group, data, innerRef: ref });
|
|
188
|
-
});
|
|
189
|
-
var NumberFlow_default = NumberFlow;
|
|
190
|
-
var NumberFlowGroupContext = React.createContext(void 0);
|
|
191
|
-
function NumberFlowGroup({ children }) {
|
|
192
|
-
const flows = React.useRef(/* @__PURE__ */ new Set());
|
|
193
|
-
const updating = React.useRef(false);
|
|
194
|
-
const pending = React.useRef(/* @__PURE__ */ new WeakMap());
|
|
195
|
-
const value = React.useMemo(
|
|
196
|
-
() => ({
|
|
197
|
-
useRegister(ref) {
|
|
198
|
-
React.useEffect(() => {
|
|
199
|
-
flows.current.add(ref);
|
|
200
|
-
return () => {
|
|
201
|
-
flows.current.delete(ref);
|
|
202
|
-
};
|
|
203
|
-
}, []);
|
|
204
|
-
},
|
|
205
|
-
willUpdate() {
|
|
206
|
-
if (updating.current) return;
|
|
207
|
-
updating.current = true;
|
|
208
|
-
flows.current.forEach((ref) => {
|
|
209
|
-
const f = ref.current;
|
|
210
|
-
if (!f || !f.created) return;
|
|
211
|
-
f.willUpdate();
|
|
212
|
-
pending.current.set(f, true);
|
|
213
|
-
});
|
|
214
|
-
},
|
|
215
|
-
didUpdate() {
|
|
216
|
-
flows.current.forEach((ref) => {
|
|
217
|
-
const f = ref.current;
|
|
218
|
-
if (!f || !pending.current.get(f)) return;
|
|
219
|
-
f.didUpdate();
|
|
220
|
-
pending.current.delete(f);
|
|
221
|
-
});
|
|
222
|
-
updating.current = false;
|
|
223
|
-
}
|
|
224
|
-
}),
|
|
225
|
-
[]
|
|
226
|
-
);
|
|
227
|
-
return /* @__PURE__ */ React.createElement(NumberFlowGroupContext.Provider, { value }, children);
|
|
8
|
+
function _interopNamespace(e) {
|
|
9
|
+
if (e && e.__esModule) return e;
|
|
10
|
+
var n = Object.create(null);
|
|
11
|
+
if (e) {
|
|
12
|
+
Object.keys(e).forEach(function (k) {
|
|
13
|
+
if (k !== 'default') {
|
|
14
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
15
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
16
|
+
enumerable: true,
|
|
17
|
+
get: function () { return e[k]; }
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
n.default = e;
|
|
23
|
+
return n;
|
|
228
24
|
}
|
|
229
25
|
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
);
|
|
238
|
-
var usePrefersReducedMotion = () => React2.useSyncExternalStore(
|
|
239
|
-
(cb) => {
|
|
240
|
-
import_number_flow2.prefersReducedMotion?.addEventListener("change", cb);
|
|
241
|
-
return () => import_number_flow2.prefersReducedMotion?.removeEventListener("change", cb);
|
|
242
|
-
},
|
|
243
|
-
() => import_number_flow2.prefersReducedMotion.matches,
|
|
244
|
-
() => false
|
|
245
|
-
);
|
|
26
|
+
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
27
|
+
|
|
28
|
+
const useIsSupported = ()=>React__namespace.useSyncExternalStore(()=>()=>{}, ()=>numberFlow.canAnimate, ()=>false);
|
|
29
|
+
const usePrefersReducedMotion = ()=>React__namespace.useSyncExternalStore((cb)=>{
|
|
30
|
+
numberFlow.prefersReducedMotion?.addEventListener('change', cb);
|
|
31
|
+
return ()=>numberFlow.prefersReducedMotion?.removeEventListener('change', cb);
|
|
32
|
+
}, ()=>numberFlow.prefersReducedMotion.matches, ()=>false);
|
|
246
33
|
function useCanAnimate({ respectMotionPreference = true } = {}) {
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
34
|
+
const isSupported = useIsSupported();
|
|
35
|
+
const reducedMotion = usePrefersReducedMotion();
|
|
36
|
+
return isSupported && (!respectMotionPreference || !reducedMotion);
|
|
250
37
|
}
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
38
|
+
|
|
39
|
+
exports.NumberFlowElement = NumberFlowClient.NumberFlowElement;
|
|
40
|
+
exports.NumberFlowGroup = NumberFlowClient.NumberFlowGroup;
|
|
41
|
+
exports.default = NumberFlowClient.NumberFlow;
|
|
42
|
+
exports.useCanAnimate = useCanAnimate;
|
|
43
|
+
exports.useIsSupported = useIsSupported;
|
|
44
|
+
exports.usePrefersReducedMotion = usePrefersReducedMotion;
|
|
45
|
+
Object.keys(plugins).forEach(function (k) {
|
|
46
|
+
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
47
|
+
enumerable: true,
|
|
48
|
+
get: function () { return plugins[k]; }
|
|
49
|
+
});
|
|
259
50
|
});
|
package/dist/index.mjs
CHANGED
|
@@ -1,41 +1,17 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
} from "./chunk-44AMDIF5.mjs";
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { canAnimate, prefersReducedMotion } from 'number-flow';
|
|
3
|
+
export * from 'number-flow/plugins';
|
|
4
|
+
export { a as NumberFlowElement, b as NumberFlowGroup, N as default } from './NumberFlow-client-CHWbu7lx.mjs';
|
|
6
5
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
} from "number-flow";
|
|
13
|
-
export * from "number-flow/plugins";
|
|
14
|
-
var useIsSupported = () => React.useSyncExternalStore(
|
|
15
|
-
() => () => {
|
|
16
|
-
},
|
|
17
|
-
// this value doesn't change, but it's useful to specify a different SSR value:
|
|
18
|
-
() => _canAnimate,
|
|
19
|
-
() => false
|
|
20
|
-
);
|
|
21
|
-
var usePrefersReducedMotion = () => React.useSyncExternalStore(
|
|
22
|
-
(cb) => {
|
|
23
|
-
_prefersReducedMotion?.addEventListener("change", cb);
|
|
24
|
-
return () => _prefersReducedMotion?.removeEventListener("change", cb);
|
|
25
|
-
},
|
|
26
|
-
() => _prefersReducedMotion.matches,
|
|
27
|
-
() => false
|
|
28
|
-
);
|
|
6
|
+
const useIsSupported = ()=>React.useSyncExternalStore(()=>()=>{}, ()=>canAnimate, ()=>false);
|
|
7
|
+
const usePrefersReducedMotion = ()=>React.useSyncExternalStore((cb)=>{
|
|
8
|
+
prefersReducedMotion?.addEventListener('change', cb);
|
|
9
|
+
return ()=>prefersReducedMotion?.removeEventListener('change', cb);
|
|
10
|
+
}, ()=>prefersReducedMotion.matches, ()=>false);
|
|
29
11
|
function useCanAnimate({ respectMotionPreference = true } = {}) {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
12
|
+
const isSupported = useIsSupported();
|
|
13
|
+
const reducedMotion = usePrefersReducedMotion();
|
|
14
|
+
return isSupported && (!respectMotionPreference || !reducedMotion);
|
|
33
15
|
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
NumberFlowGroup,
|
|
37
|
-
NumberFlow_default as default,
|
|
38
|
-
useCanAnimate,
|
|
39
|
-
useIsSupported,
|
|
40
|
-
usePrefersReducedMotion
|
|
41
|
-
};
|
|
16
|
+
|
|
17
|
+
export { useCanAnimate, useIsSupported, usePrefersReducedMotion };
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "0.5.
|
|
6
|
+
"version": "0.5.4",
|
|
7
7
|
"author": {
|
|
8
8
|
"name": "Maxwell Barvian",
|
|
9
9
|
"email": "max@barvian.me",
|
|
@@ -56,17 +56,17 @@
|
|
|
56
56
|
"@types/node": "^22.7.9",
|
|
57
57
|
"@types/react": "^18.3.3",
|
|
58
58
|
"@types/react-dom": "^18.3.0",
|
|
59
|
+
"bunchee": "^6.3.1",
|
|
59
60
|
"react": "^18.3.1",
|
|
60
|
-
"react-dom": "^18.3.1"
|
|
61
|
-
"tsup": "^8.3.5"
|
|
61
|
+
"react-dom": "^18.3.1"
|
|
62
62
|
},
|
|
63
63
|
"peerDependencies": {
|
|
64
64
|
"react": "^18 || ^19",
|
|
65
65
|
"react-dom": "^18 || ^19"
|
|
66
66
|
},
|
|
67
67
|
"scripts": {
|
|
68
|
-
"build": "
|
|
69
|
-
"dev": "
|
|
68
|
+
"build": "bunchee --tsconfig tsconfig.build.json",
|
|
69
|
+
"dev": "bunchee --watch",
|
|
70
70
|
"test": "pnpm -r --workspace-concurrency 1 --filter=\"./test/apps/*\" test"
|
|
71
71
|
}
|
|
72
72
|
}
|
package/dist/NumberFlow.d.mts
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { NumberFlowLite, Value, Format, Props } from 'number-flow';
|
|
3
|
-
|
|
4
|
-
declare const OBSERVED_ATTRIBUTES: readonly ["data", "digits"];
|
|
5
|
-
type ObservedAttribute = (typeof OBSERVED_ATTRIBUTES)[number];
|
|
6
|
-
declare class NumberFlowElement extends NumberFlowLite {
|
|
7
|
-
static observedAttributes: readonly ["data", "digits"] | never[];
|
|
8
|
-
attributeChangedCallback(attr: ObservedAttribute, _oldValue: string, newValue: string): void;
|
|
9
|
-
}
|
|
10
|
-
type BaseProps = React.HTMLAttributes<NumberFlowElement> & Partial<Props> & {
|
|
11
|
-
isolate?: boolean;
|
|
12
|
-
willChange?: boolean;
|
|
13
|
-
onAnimationsStart?: (e: CustomEvent<undefined>) => void;
|
|
14
|
-
onAnimationsFinish?: (e: CustomEvent<undefined>) => void;
|
|
15
|
-
};
|
|
16
|
-
type NumberFlowProps = BaseProps & {
|
|
17
|
-
value: Value;
|
|
18
|
-
locales?: Intl.LocalesArgument;
|
|
19
|
-
format?: Format;
|
|
20
|
-
prefix?: string;
|
|
21
|
-
suffix?: string;
|
|
22
|
-
};
|
|
23
|
-
declare const NumberFlow: React.ForwardRefExoticComponent<React.HTMLAttributes<NumberFlowElement> & Partial<Props> & {
|
|
24
|
-
isolate?: boolean;
|
|
25
|
-
willChange?: boolean;
|
|
26
|
-
onAnimationsStart?: (e: CustomEvent<undefined>) => void;
|
|
27
|
-
onAnimationsFinish?: (e: CustomEvent<undefined>) => void;
|
|
28
|
-
} & {
|
|
29
|
-
value: Value;
|
|
30
|
-
locales?: Intl.LocalesArgument;
|
|
31
|
-
format?: Format;
|
|
32
|
-
prefix?: string;
|
|
33
|
-
suffix?: string;
|
|
34
|
-
} & React.RefAttributes<NumberFlowElement>>;
|
|
35
|
-
|
|
36
|
-
declare function NumberFlowGroup({ children }: {
|
|
37
|
-
children: React.ReactNode;
|
|
38
|
-
}): React.JSX.Element;
|
|
39
|
-
|
|
40
|
-
export { NumberFlowElement, NumberFlowGroup, type NumberFlowProps, NumberFlow as default };
|
package/dist/NumberFlow.d.ts
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { NumberFlowLite, Value, Format, Props } from 'number-flow';
|
|
3
|
-
|
|
4
|
-
declare const OBSERVED_ATTRIBUTES: readonly ["data", "digits"];
|
|
5
|
-
type ObservedAttribute = (typeof OBSERVED_ATTRIBUTES)[number];
|
|
6
|
-
declare class NumberFlowElement extends NumberFlowLite {
|
|
7
|
-
static observedAttributes: readonly ["data", "digits"] | never[];
|
|
8
|
-
attributeChangedCallback(attr: ObservedAttribute, _oldValue: string, newValue: string): void;
|
|
9
|
-
}
|
|
10
|
-
type BaseProps = React.HTMLAttributes<NumberFlowElement> & Partial<Props> & {
|
|
11
|
-
isolate?: boolean;
|
|
12
|
-
willChange?: boolean;
|
|
13
|
-
onAnimationsStart?: (e: CustomEvent<undefined>) => void;
|
|
14
|
-
onAnimationsFinish?: (e: CustomEvent<undefined>) => void;
|
|
15
|
-
};
|
|
16
|
-
type NumberFlowProps = BaseProps & {
|
|
17
|
-
value: Value;
|
|
18
|
-
locales?: Intl.LocalesArgument;
|
|
19
|
-
format?: Format;
|
|
20
|
-
prefix?: string;
|
|
21
|
-
suffix?: string;
|
|
22
|
-
};
|
|
23
|
-
declare const NumberFlow: React.ForwardRefExoticComponent<React.HTMLAttributes<NumberFlowElement> & Partial<Props> & {
|
|
24
|
-
isolate?: boolean;
|
|
25
|
-
willChange?: boolean;
|
|
26
|
-
onAnimationsStart?: (e: CustomEvent<undefined>) => void;
|
|
27
|
-
onAnimationsFinish?: (e: CustomEvent<undefined>) => void;
|
|
28
|
-
} & {
|
|
29
|
-
value: Value;
|
|
30
|
-
locales?: Intl.LocalesArgument;
|
|
31
|
-
format?: Format;
|
|
32
|
-
prefix?: string;
|
|
33
|
-
suffix?: string;
|
|
34
|
-
} & React.RefAttributes<NumberFlowElement>>;
|
|
35
|
-
|
|
36
|
-
declare function NumberFlowGroup({ children }: {
|
|
37
|
-
children: React.ReactNode;
|
|
38
|
-
}): React.JSX.Element;
|
|
39
|
-
|
|
40
|
-
export { NumberFlowElement, NumberFlowGroup, type NumberFlowProps, NumberFlow as default };
|