@zag-js/types 0.10.5 → 0.11.0

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.
@@ -1,4 +1,5 @@
1
- import type * as CSS from "csstype";
1
+ import * as CSS from 'csstype';
2
+
2
3
  type NativeAnimationEvent = AnimationEvent;
3
4
  type NativeClipboardEvent = ClipboardEvent;
4
5
  type NativeCompositionEvent = CompositionEvent;
@@ -11,8 +12,8 @@ type NativePointerEvent = PointerEvent;
11
12
  type NativeTransitionEvent = TransitionEvent;
12
13
  type NativeUIEvent = UIEvent;
13
14
  type NativeWheelEvent = WheelEvent;
14
- type Booleanish = boolean | "true" | "false";
15
- export declare namespace JSX {
15
+ type Booleanish$1 = boolean | "true" | "false";
16
+ declare namespace JSX {
16
17
  export interface BaseSyntheticEvent<E = object, C = any, T = any> {
17
18
  nativeEvent: E;
18
19
  currentTarget: C;
@@ -255,14 +256,14 @@ export declare namespace JSX {
255
256
  /** Identifies the currently active element when DOM focus is on a composite widget, textbox, group, or application. */
256
257
  "aria-activedescendant"?: string | undefined;
257
258
  /** Indicates whether assistive technologies will present all, or only parts of, the changed region based on the change notifications defined by the aria-relevant attribute. */
258
- "aria-atomic"?: Booleanish | undefined;
259
+ "aria-atomic"?: Booleanish$1 | undefined;
259
260
  /**
260
261
  * Indicates whether inputting text could trigger display of one or more predictions of the user's intended value for an input and specifies how predictions would be
261
262
  * presented if they are made.
262
263
  */
263
264
  "aria-autocomplete"?: "none" | "inline" | "list" | "both" | undefined;
264
265
  /** Indicates an element is being modified and that assistive technologies MAY want to wait until the modifications are complete before exposing them to the user. */
265
- "aria-busy"?: Booleanish | undefined;
266
+ "aria-busy"?: Booleanish$1 | undefined;
266
267
  /**
267
268
  * Indicates the current "checked" state of checkboxes, radio buttons, and other widgets.
268
269
  * @see aria-pressed @see aria-selected.
@@ -304,7 +305,7 @@ export declare namespace JSX {
304
305
  * Indicates that the element is perceivable but disabled, so it is not editable or otherwise operable.
305
306
  * @see aria-hidden @see aria-readonly.
306
307
  */
307
- "aria-disabled"?: Booleanish | undefined;
308
+ "aria-disabled"?: Booleanish$1 | undefined;
308
309
  /**
309
310
  * Indicates what functions can be performed when a dragged object is released on the drop target.
310
311
  * @deprecated in ARIA 1.1
@@ -316,7 +317,7 @@ export declare namespace JSX {
316
317
  */
317
318
  "aria-errormessage"?: string | undefined;
318
319
  /** Indicates whether the element, or another grouping element it controls, is currently expanded or collapsed. */
319
- "aria-expanded"?: Booleanish | undefined;
320
+ "aria-expanded"?: Booleanish$1 | undefined;
320
321
  /**
321
322
  * Identifies the next element (or elements) in an alternate reading order of content which, at the user's discretion,
322
323
  * allows assistive technology to override the general default of reading in document source order.
@@ -326,14 +327,14 @@ export declare namespace JSX {
326
327
  * Indicates an element's "grabbed" state in a drag-and-drop operation.
327
328
  * @deprecated in ARIA 1.1
328
329
  */
329
- "aria-grabbed"?: Booleanish | undefined;
330
+ "aria-grabbed"?: Booleanish$1 | undefined;
330
331
  /** Indicates the availability and type of interactive popup element, such as menu or dialog, that can be triggered by an element. */
331
332
  "aria-haspopup"?: boolean | "false" | "true" | "menu" | "listbox" | "tree" | "grid" | "dialog" | undefined;
332
333
  /**
333
334
  * Indicates whether the element is exposed to an accessibility API.
334
335
  * @see aria-disabled.
335
336
  */
336
- "aria-hidden"?: Booleanish | undefined;
337
+ "aria-hidden"?: Booleanish$1 | undefined;
337
338
  /**
338
339
  * Indicates the entered value does not conform to the format expected by the application.
339
340
  * @see aria-errormessage.
@@ -356,11 +357,11 @@ export declare namespace JSX {
356
357
  /** Indicates that an element will be updated, and describes the types of updates the user agents, assistive technologies, and user can expect from the live region. */
357
358
  "aria-live"?: "off" | "assertive" | "polite" | undefined;
358
359
  /** Indicates whether an element is modal when displayed. */
359
- "aria-modal"?: Booleanish | undefined;
360
+ "aria-modal"?: Booleanish$1 | undefined;
360
361
  /** Indicates whether a text box accepts multiple lines of input or only a single line. */
361
- "aria-multiline"?: Booleanish | undefined;
362
+ "aria-multiline"?: Booleanish$1 | undefined;
362
363
  /** Indicates that the user may select more than one item from the current selectable descendants. */
363
- "aria-multiselectable"?: Booleanish | undefined;
364
+ "aria-multiselectable"?: Booleanish$1 | undefined;
364
365
  /** Indicates whether the element's orientation is horizontal, vertical, or unknown/ambiguous. */
365
366
  "aria-orientation"?: "horizontal" | "vertical" | undefined;
366
367
  /**
@@ -388,14 +389,14 @@ export declare namespace JSX {
388
389
  * Indicates that the element is not editable, but is otherwise operable.
389
390
  * @see aria-disabled.
390
391
  */
391
- "aria-readonly"?: Booleanish | undefined;
392
+ "aria-readonly"?: Booleanish$1 | undefined;
392
393
  /**
393
394
  * Indicates what notifications the user agent will trigger when the accessibility tree within a live region is modified.
394
395
  * @see aria-atomic.
395
396
  */
396
397
  "aria-relevant"?: "additions" | "additions removals" | "additions text" | "all" | "removals" | "removals additions" | "removals text" | "text" | "text additions" | "text removals" | undefined;
397
398
  /** Indicates that user input is required on the element before a form may be submitted. */
398
- "aria-required"?: Booleanish | undefined;
399
+ "aria-required"?: Booleanish$1 | undefined;
399
400
  /** Defines a human-readable, author-localized description for the role of an element. */
400
401
  "aria-roledescription"?: string | undefined;
401
402
  /**
@@ -417,7 +418,7 @@ export declare namespace JSX {
417
418
  * Indicates the current "selected" state of various widgets.
418
419
  * @see aria-checked @see aria-pressed.
419
420
  */
420
- "aria-selected"?: Booleanish | undefined;
421
+ "aria-selected"?: Booleanish$1 | undefined;
421
422
  /**
422
423
  * Defines the number of items in the current set of listitems or treeitems. Not required if all elements in the set are present in the DOM.
423
424
  * @see aria-posinset.
@@ -445,16 +446,16 @@ export declare namespace JSX {
445
446
  suppressHydrationWarning?: boolean | undefined;
446
447
  accessKey?: string | undefined;
447
448
  className?: string | undefined;
448
- contentEditable?: Booleanish | "inherit" | undefined;
449
+ contentEditable?: Booleanish$1 | "inherit" | undefined;
449
450
  contextMenu?: string | undefined;
450
451
  dir?: string | undefined;
451
- draggable?: Booleanish | undefined;
452
+ draggable?: Booleanish$1 | undefined;
452
453
  hidden?: boolean | undefined;
453
454
  id?: string | undefined;
454
455
  lang?: string | undefined;
455
456
  placeholder?: string | undefined;
456
457
  slot?: string | undefined;
457
- spellCheck?: Booleanish | undefined;
458
+ spellCheck?: Booleanish$1 | undefined;
458
459
  style?: CSSProperties | undefined;
459
460
  tabIndex?: number | undefined;
460
461
  title?: string | undefined;
@@ -1109,4 +1110,91 @@ export declare namespace JSX {
1109
1110
  }
1110
1111
  export {};
1111
1112
  }
1112
- export {};
1113
+
1114
+ type Dict<T = any> = Record<string, T>;
1115
+ type Booleanish = boolean | "true" | "false";
1116
+ type DataAttr = {
1117
+ "data-selected"?: Booleanish;
1118
+ "data-expanded"?: Booleanish;
1119
+ "data-highlighted"?: Booleanish;
1120
+ "data-readonly"?: Booleanish;
1121
+ "data-indeterminate"?: Booleanish;
1122
+ "data-invalid"?: Booleanish;
1123
+ "data-hover"?: Booleanish;
1124
+ "data-active"?: Booleanish;
1125
+ "data-focus"?: Booleanish;
1126
+ "data-disabled"?: Booleanish;
1127
+ "data-open"?: Booleanish;
1128
+ "data-checked"?: Booleanish;
1129
+ "data-pressed"?: Booleanish;
1130
+ "data-complete"?: Booleanish;
1131
+ "data-empty"?: Booleanish;
1132
+ "data-placeholder-shown"?: Booleanish;
1133
+ "data-half"?: Booleanish;
1134
+ "data-scope"?: string;
1135
+ "data-uid"?: string;
1136
+ "data-name"?: string;
1137
+ "data-ownedby"?: string;
1138
+ "data-type"?: string;
1139
+ "data-valuetext"?: string;
1140
+ "data-placement"?: string;
1141
+ "data-controls"?: string;
1142
+ "data-part"?: string;
1143
+ "data-label"?: string;
1144
+ "data-state"?: string | null;
1145
+ "data-value"?: string | number;
1146
+ "data-orientation"?: "horizontal" | "vertical";
1147
+ "data-count"?: number;
1148
+ "data-index"?: number;
1149
+ } & {
1150
+ [key in `data-${string}`]?: string | number | Booleanish;
1151
+ };
1152
+ type PropTypes<T = Dict> = Record<"button" | "label" | "input" | "img" | "output" | "element" | "select" | "style", T>;
1153
+ type NormalizeProps<T extends PropTypes> = {
1154
+ [K in keyof T]: (props: K extends keyof JSX.IntrinsicElements ? DataAttr & JSX.IntrinsicElements[K] : never) => T[K];
1155
+ } & {
1156
+ element(props: DataAttr & JSX.HTMLAttributes<HTMLElement>): T["element"];
1157
+ style: JSX.CSSProperties;
1158
+ };
1159
+ declare function createNormalizer<T extends PropTypes>(fn: (props: Dict) => Dict): NormalizeProps<T>;
1160
+
1161
+ type RequiredBy<T, K extends keyof T> = Partial<Omit<T, K>> & Required<Pick<T, K>>;
1162
+ type Direction = "ltr" | "rtl";
1163
+ type Orientation = "horizontal" | "vertical";
1164
+ type MaybeElement<T extends HTMLElement = HTMLElement> = T | null;
1165
+ type DirectionProperty = {
1166
+ /**
1167
+ * The document's text/writing direction.
1168
+ * @default "ltr"
1169
+ */
1170
+ dir?: "ltr" | "rtl";
1171
+ };
1172
+ type CommonProperties = {
1173
+ /**
1174
+ * The unique identifier of the machine.
1175
+ */
1176
+ id: string;
1177
+ /**
1178
+ * A root node to correctly resolve document in custom environments. E.x.: Iframes, Electron.
1179
+ */
1180
+ getRootNode?: () => ShadowRoot | Document | Node;
1181
+ };
1182
+ type RootProperties = {
1183
+ /**
1184
+ * The owner document of the machine.
1185
+ */
1186
+ doc?: Document;
1187
+ /**
1188
+ * The root node of the machine. Useful for shadow DOM.
1189
+ */
1190
+ rootNode?: ShadowRoot;
1191
+ /**
1192
+ * The related target when the element is blurred.
1193
+ * Used as a polyfill for `e.relatedTarget`
1194
+ */
1195
+ pointerdownNode?: HTMLElement | null;
1196
+ };
1197
+ type Context<T> = T & RootProperties;
1198
+ type Style = JSX.CSSProperties;
1199
+
1200
+ export { CommonProperties, Context, Direction, DirectionProperty, JSX, MaybeElement, NormalizeProps, Orientation, PropTypes, RequiredBy, RootProperties, Style, createNormalizer };