@zag-js/number-input 0.2.0 → 0.2.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/index.d.ts CHANGED
@@ -234,6 +234,6 @@ declare function connect<T extends PropTypes>(state: State, send: Send, normaliz
234
234
  scrubberProps: T["element"];
235
235
  };
236
236
 
237
- declare function machine(ctx: UserDefinedContext): _zag_js_core.Machine<MachineContext, MachineState, _zag_js_core.StateMachine.AnyEventObject>;
237
+ declare function machine(userContext: UserDefinedContext): _zag_js_core.Machine<MachineContext, MachineState, _zag_js_core.StateMachine.AnyEventObject>;
238
238
 
239
239
  export { UserDefinedContext as Context, connect, machine };
package/dist/index.js CHANGED
@@ -633,6 +633,15 @@ var callAll2 = (...fns) => (...a) => {
633
633
  fn == null ? void 0 : fn(...a);
634
634
  });
635
635
  };
636
+ var isArray2 = (v) => Array.isArray(v);
637
+ var isObject2 = (v) => !(v == null || typeof v !== "object" || isArray2(v));
638
+ function compact(obj) {
639
+ if (obj === void 0)
640
+ return obj;
641
+ return Object.fromEntries(
642
+ Object.entries(obj).filter(([, value]) => value !== void 0).map(([key, value]) => [key, isObject2(value) ? compact(value) : value])
643
+ );
644
+ }
636
645
 
637
646
  // ../../utilities/form-utils/dist/index.mjs
638
647
  function getWindow(el) {
@@ -660,7 +669,8 @@ function dispatchInputValueEvent(el, value) {
660
669
 
661
670
  // src/number-input.machine.ts
662
671
  var { not, and } = import_core.guards;
663
- function machine(ctx) {
672
+ function machine(userContext) {
673
+ const ctx = compact(userContext);
664
674
  return (0, import_core.createMachine)(
665
675
  {
666
676
  id: "number-input",
package/dist/index.mjs CHANGED
@@ -606,6 +606,15 @@ var callAll2 = (...fns) => (...a) => {
606
606
  fn == null ? void 0 : fn(...a);
607
607
  });
608
608
  };
609
+ var isArray2 = (v) => Array.isArray(v);
610
+ var isObject2 = (v) => !(v == null || typeof v !== "object" || isArray2(v));
611
+ function compact(obj) {
612
+ if (obj === void 0)
613
+ return obj;
614
+ return Object.fromEntries(
615
+ Object.entries(obj).filter(([, value]) => value !== void 0).map(([key, value]) => [key, isObject2(value) ? compact(value) : value])
616
+ );
617
+ }
609
618
 
610
619
  // ../../utilities/form-utils/dist/index.mjs
611
620
  function getWindow(el) {
@@ -633,7 +642,8 @@ function dispatchInputValueEvent(el, value) {
633
642
 
634
643
  // src/number-input.machine.ts
635
644
  var { not, and } = guards;
636
- function machine(ctx) {
645
+ function machine(userContext) {
646
+ const ctx = compact(userContext);
637
647
  return createMachine(
638
648
  {
639
649
  id: "number-input",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zag-js/number-input",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "Core logic for the number-input widget implemented as a state machine",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -29,14 +29,14 @@
29
29
  "url": "https://github.com/chakra-ui/zag/issues"
30
30
  },
31
31
  "dependencies": {
32
- "@zag-js/core": "0.2.0",
32
+ "@zag-js/core": "0.2.1",
33
33
  "@zag-js/types": "0.3.0"
34
34
  },
35
35
  "devDependencies": {
36
36
  "@zag-js/dom-utils": "0.2.0",
37
37
  "@zag-js/form-utils": "0.2.0",
38
38
  "@zag-js/number-utils": "0.2.0",
39
- "@zag-js/utils": "0.2.0"
39
+ "@zag-js/utils": "0.3.0"
40
40
  },
41
41
  "scripts": {
42
42
  "build-fast": "tsup src/index.ts --format=esm,cjs",