@zag-js/pin-input 0.0.0-dev-20221208144218 → 0.0.0-dev-20221209151930

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
@@ -795,57 +795,57 @@ declare const anatomy: Omit<{
795
795
  }>;
796
796
  }, "parts">;
797
797
  extendWith: <V_20 extends string>(...parts: V_20[]) => Omit<any, "parts">;
798
- build: () => Record<"root" | "label" | "hiddenInput" | "input" | V_10 | V_11 | V_12 | V_13 | V_14 | V_15 | V_16 | V_17 | V_18 | V_19, {
798
+ build: () => Record<"root" | "label" | "hiddenInput" | "input" | "control" | V_10 | V_11 | V_12 | V_13 | V_14 | V_15 | V_16 | V_17 | V_18 | V_19, {
799
799
  selector: string;
800
800
  attrs: Record<"data-scope" | "data-part", string>;
801
801
  }>;
802
802
  }, "parts">;
803
- build: () => Record<"root" | "label" | "hiddenInput" | "input" | V_10 | V_11 | V_12 | V_13 | V_14 | V_15 | V_16 | V_17 | V_18, {
803
+ build: () => Record<"root" | "label" | "hiddenInput" | "input" | "control" | V_10 | V_11 | V_12 | V_13 | V_14 | V_15 | V_16 | V_17 | V_18, {
804
804
  selector: string;
805
805
  attrs: Record<"data-scope" | "data-part", string>;
806
806
  }>;
807
807
  }, "parts">;
808
- build: () => Record<"root" | "label" | "hiddenInput" | "input" | V_10 | V_11 | V_12 | V_13 | V_14 | V_15 | V_16 | V_17, {
808
+ build: () => Record<"root" | "label" | "hiddenInput" | "input" | "control" | V_10 | V_11 | V_12 | V_13 | V_14 | V_15 | V_16 | V_17, {
809
809
  selector: string;
810
810
  attrs: Record<"data-scope" | "data-part", string>;
811
811
  }>;
812
812
  }, "parts">;
813
- build: () => Record<"root" | "label" | "hiddenInput" | "input" | V_10 | V_11 | V_12 | V_13 | V_14 | V_15 | V_16, {
813
+ build: () => Record<"root" | "label" | "hiddenInput" | "input" | "control" | V_10 | V_11 | V_12 | V_13 | V_14 | V_15 | V_16, {
814
814
  selector: string;
815
815
  attrs: Record<"data-scope" | "data-part", string>;
816
816
  }>;
817
817
  }, "parts">;
818
- build: () => Record<"root" | "label" | "hiddenInput" | "input" | V_10 | V_11 | V_12 | V_13 | V_14 | V_15, {
818
+ build: () => Record<"root" | "label" | "hiddenInput" | "input" | "control" | V_10 | V_11 | V_12 | V_13 | V_14 | V_15, {
819
819
  selector: string;
820
820
  attrs: Record<"data-scope" | "data-part", string>;
821
821
  }>;
822
822
  }, "parts">;
823
- build: () => Record<"root" | "label" | "hiddenInput" | "input" | V_10 | V_11 | V_12 | V_13 | V_14, {
823
+ build: () => Record<"root" | "label" | "hiddenInput" | "input" | "control" | V_10 | V_11 | V_12 | V_13 | V_14, {
824
824
  selector: string;
825
825
  attrs: Record<"data-scope" | "data-part", string>;
826
826
  }>;
827
827
  }, "parts">;
828
- build: () => Record<"root" | "label" | "hiddenInput" | "input" | V_10 | V_11 | V_12 | V_13, {
828
+ build: () => Record<"root" | "label" | "hiddenInput" | "input" | "control" | V_10 | V_11 | V_12 | V_13, {
829
829
  selector: string;
830
830
  attrs: Record<"data-scope" | "data-part", string>;
831
831
  }>;
832
832
  }, "parts">;
833
- build: () => Record<"root" | "label" | "hiddenInput" | "input" | V_10 | V_11 | V_12, {
833
+ build: () => Record<"root" | "label" | "hiddenInput" | "input" | "control" | V_10 | V_11 | V_12, {
834
834
  selector: string;
835
835
  attrs: Record<"data-scope" | "data-part", string>;
836
836
  }>;
837
837
  }, "parts">;
838
- build: () => Record<"root" | "label" | "hiddenInput" | "input" | V_10 | V_11, {
838
+ build: () => Record<"root" | "label" | "hiddenInput" | "input" | "control" | V_10 | V_11, {
839
839
  selector: string;
840
840
  attrs: Record<"data-scope" | "data-part", string>;
841
841
  }>;
842
842
  }, "parts">;
843
- build: () => Record<"root" | "label" | "hiddenInput" | "input" | V_10, {
843
+ build: () => Record<"root" | "label" | "hiddenInput" | "input" | "control" | V_10, {
844
844
  selector: string;
845
845
  attrs: Record<"data-scope" | "data-part", string>;
846
846
  }>;
847
847
  }, "parts">;
848
- build: () => Record<"root" | "label" | "hiddenInput" | "input", {
848
+ build: () => Record<"root" | "label" | "hiddenInput" | "input" | "control", {
849
849
  selector: string;
850
850
  attrs: Record<"data-scope" | "data-part", string>;
851
851
  }>;
@@ -858,6 +858,7 @@ declare type ElementIds = Partial<{
858
858
  root: string;
859
859
  hiddenInput: string;
860
860
  label: string;
861
+ control: string;
861
862
  input(id: string): string;
862
863
  }>;
863
864
  declare type PublicContext = DirectionProperty & CommonProperties & {
@@ -990,6 +991,7 @@ declare function connect<T extends PropTypes>(state: State, send: Send, normaliz
990
991
  rootProps: T["element"];
991
992
  labelProps: T["label"];
992
993
  hiddenInputProps: T["input"];
994
+ controlProps: T["element"];
993
995
  getInputProps({ index }: {
994
996
  index: number;
995
997
  }): T["input"];
package/dist/index.js CHANGED
@@ -28,7 +28,7 @@ module.exports = __toCommonJS(src_exports);
28
28
 
29
29
  // src/pin-input.anatomy.ts
30
30
  var import_anatomy = require("@zag-js/anatomy");
31
- var anatomy = (0, import_anatomy.createAnatomy)("pinInput").parts("root", "label", "hiddenInput", "input");
31
+ var anatomy = (0, import_anatomy.createAnatomy)("pinInput").parts("root", "label", "hiddenInput", "input", "control");
32
32
  var parts = anatomy.build();
33
33
 
34
34
  // ../../utilities/dom/dist/index.mjs
@@ -177,6 +177,10 @@ var dom = defineDomHelpers({
177
177
  var _a, _b;
178
178
  return (_b = (_a = ctx.ids) == null ? void 0 : _a.label) != null ? _b : `pin-input:${ctx.id}:label`;
179
179
  },
180
+ getControlId: (ctx) => {
181
+ var _a, _b;
182
+ return (_b = (_a = ctx.ids) == null ? void 0 : _a.control) != null ? _b : `pin-input:${ctx.id}:control`;
183
+ },
180
184
  getRootEl: (ctx) => dom.getById(ctx, dom.getRootId(ctx)),
181
185
  getElements: (ctx) => {
182
186
  const ownerId = CSS.escape(dom.getRootId(ctx));
@@ -247,6 +251,10 @@ function connect(state, send, normalize) {
247
251
  maxLength: state.context.valueLength,
248
252
  defaultValue: state.context.valueAsString
249
253
  }),
254
+ controlProps: normalize.element({
255
+ ...parts.control.attrs,
256
+ id: dom.getControlId(state.context)
257
+ }),
250
258
  getInputProps({ index }) {
251
259
  const inputType = state.context.type === "numeric" ? "tel" : "text";
252
260
  return normalize.input({
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  // src/pin-input.anatomy.ts
2
2
  import { createAnatomy } from "@zag-js/anatomy";
3
- var anatomy = createAnatomy("pinInput").parts("root", "label", "hiddenInput", "input");
3
+ var anatomy = createAnatomy("pinInput").parts("root", "label", "hiddenInput", "input", "control");
4
4
  var parts = anatomy.build();
5
5
 
6
6
  // ../../utilities/dom/dist/index.mjs
@@ -149,6 +149,10 @@ var dom = defineDomHelpers({
149
149
  var _a, _b;
150
150
  return (_b = (_a = ctx.ids) == null ? void 0 : _a.label) != null ? _b : `pin-input:${ctx.id}:label`;
151
151
  },
152
+ getControlId: (ctx) => {
153
+ var _a, _b;
154
+ return (_b = (_a = ctx.ids) == null ? void 0 : _a.control) != null ? _b : `pin-input:${ctx.id}:control`;
155
+ },
152
156
  getRootEl: (ctx) => dom.getById(ctx, dom.getRootId(ctx)),
153
157
  getElements: (ctx) => {
154
158
  const ownerId = CSS.escape(dom.getRootId(ctx));
@@ -219,6 +223,10 @@ function connect(state, send, normalize) {
219
223
  maxLength: state.context.valueLength,
220
224
  defaultValue: state.context.valueAsString
221
225
  }),
226
+ controlProps: normalize.element({
227
+ ...parts.control.attrs,
228
+ id: dom.getControlId(state.context)
229
+ }),
222
230
  getInputProps({ index }) {
223
231
  const inputType = state.context.type === "numeric" ? "tel" : "text";
224
232
  return normalize.input({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zag-js/pin-input",
3
- "version": "0.0.0-dev-20221208144218",
3
+ "version": "0.0.0-dev-20221209151930",
4
4
  "description": "Core logic for the pin-input widget implemented as a state machine",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",