@zag-js/number-input 0.0.0-dev-20220627213111 → 0.0.0-dev-20220703123907

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 CHANGED
@@ -220,16 +220,6 @@ function decimalOperation(a, op, b) {
220
220
  }
221
221
  var nf = new Intl.NumberFormat("en-US", { style: "decimal", maximumFractionDigits: 20 });
222
222
 
223
- // ../../types/dist/index.mjs
224
- function createNormalizer(fn) {
225
- return new Proxy({}, {
226
- get() {
227
- return fn;
228
- }
229
- });
230
- }
231
- var normalizeProp = createNormalizer((v) => v);
232
-
233
223
  // ../../utilities/core/dist/index.mjs
234
224
  var isDom = () => typeof window !== "undefined";
235
225
  function getPlatform() {
@@ -381,7 +371,7 @@ var utils = {
381
371
  };
382
372
 
383
373
  // src/number-input.connect.ts
384
- function connect(state, send, normalize = normalizeProp) {
374
+ function connect(state, send, normalize) {
385
375
  const isFocused = state.hasTag("focus");
386
376
  const isInvalid = state.context.isOutOfRange || !!state.context.invalid;
387
377
  const isDisabled = !!state.context.disabled;
@@ -871,7 +861,7 @@ function machine(ctx = {}) {
871
861
  setValue(ctx2, evt) {
872
862
  var _a, _b;
873
863
  const value = (_b = (_a = evt.target) == null ? void 0 : _a.value) != null ? _b : evt.value;
874
- ctx2.value = utils.sanitize(ctx2, utils.parse(ctx2, value));
864
+ ctx2.value = utils.sanitize(ctx2, utils.parse(ctx2, value.toString()));
875
865
  },
876
866
  clearValue(ctx2) {
877
867
  ctx2.value = "";
package/dist/index.mjs CHANGED
@@ -197,16 +197,6 @@ function decimalOperation(a, op, b) {
197
197
  }
198
198
  var nf = new Intl.NumberFormat("en-US", { style: "decimal", maximumFractionDigits: 20 });
199
199
 
200
- // ../../types/dist/index.mjs
201
- function createNormalizer(fn) {
202
- return new Proxy({}, {
203
- get() {
204
- return fn;
205
- }
206
- });
207
- }
208
- var normalizeProp = createNormalizer((v) => v);
209
-
210
200
  // ../../utilities/core/dist/index.mjs
211
201
  var isDom = () => typeof window !== "undefined";
212
202
  function getPlatform() {
@@ -358,7 +348,7 @@ var utils = {
358
348
  };
359
349
 
360
350
  // src/number-input.connect.ts
361
- function connect(state, send, normalize = normalizeProp) {
351
+ function connect(state, send, normalize) {
362
352
  const isFocused = state.hasTag("focus");
363
353
  const isInvalid = state.context.isOutOfRange || !!state.context.invalid;
364
354
  const isDisabled = !!state.context.disabled;
@@ -848,7 +838,7 @@ function machine(ctx = {}) {
848
838
  setValue(ctx2, evt) {
849
839
  var _a, _b;
850
840
  const value = (_b = (_a = evt.target) == null ? void 0 : _a.value) != null ? _b : evt.value;
851
- ctx2.value = utils.sanitize(ctx2, utils.parse(ctx2, value));
841
+ ctx2.value = utils.sanitize(ctx2, utils.parse(ctx2, value.toString()));
852
842
  },
853
843
  clearValue(ctx2) {
854
844
  ctx2.value = "";
@@ -1,6 +1,6 @@
1
- import { PropTypes, ReactPropTypes } from "@zag-js/types";
1
+ import type { NormalizeProps, PropTypes } from "@zag-js/types";
2
2
  import { Send, State } from "./number-input.types";
3
- export declare function connect<T extends PropTypes = ReactPropTypes>(state: State, send: Send, normalize?: import("@zag-js/types").NormalizeProps): {
3
+ export declare function connect<T extends PropTypes>(state: State, send: Send, normalize: NormalizeProps<T>): {
4
4
  isFocused: boolean;
5
5
  isInvalid: boolean;
6
6
  value: string;
@@ -1,4 +1,3 @@
1
- import type { KeyboardEvent } from "react";
2
1
  import type { MachineContext as Ctx } from "./number-input.types";
3
2
  export declare const utils: {
4
3
  isValidNumericEvent: (ctx: Ctx, event: KeyboardEvent) => boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zag-js/number-input",
3
- "version": "0.0.0-dev-20220627213111",
3
+ "version": "0.0.0-dev-20220703123907",
4
4
  "description": "Core logic for the number-input widget implemented as a state machine",
5
5
  "keywords": [
6
6
  "js",
@@ -29,10 +29,10 @@
29
29
  "url": "https://github.com/chakra-ui/zag/issues"
30
30
  },
31
31
  "dependencies": {
32
- "@zag-js/core": "0.0.0-dev-20220627213111",
33
- "@zag-js/dom-utils": "0.0.0-dev-20220627213111",
32
+ "@zag-js/core": "0.0.0-dev-20220703123907",
33
+ "@zag-js/dom-utils": "0.0.0-dev-20220703123907",
34
34
  "@zag-js/number-utils": "0.1.2",
35
- "@zag-js/types": "0.2.0",
35
+ "@zag-js/types": "0.0.0-dev-20220703123907",
36
36
  "@zag-js/utils": "0.1.2"
37
37
  },
38
38
  "scripts": {