@ariakit/core 0.4.4 → 0.4.5

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.
Files changed (65) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/cjs/__chunks/{7DU6YMLQ.cjs → 2D5LEVE7.cjs} +6 -6
  3. package/cjs/__chunks/{UKR6TQI3.cjs → IMYW2UAC.cjs} +36 -20
  4. package/cjs/__chunks/{Y7KNI5NS.cjs → KL74MAHB.cjs} +5 -5
  5. package/cjs/__chunks/LPDHSEHU.cjs +71 -0
  6. package/cjs/__chunks/{SU2BSHGB.cjs → MHZQJPY3.cjs} +2 -2
  7. package/cjs/__chunks/{FFZYCAXA.cjs → QD2A4YF6.cjs} +2 -2
  8. package/cjs/collection/collection-store.cjs +3 -3
  9. package/cjs/combobox/combobox-store.cjs +40 -21
  10. package/cjs/combobox/combobox-store.d.cts +16 -5
  11. package/cjs/combobox/combobox-store.d.ts +16 -5
  12. package/cjs/composite/composite-store.cjs +5 -5
  13. package/cjs/form/form-store.cjs +3 -3
  14. package/cjs/menu/menu-bar-store.cjs +6 -6
  15. package/cjs/menu/menu-store.cjs +7 -7
  16. package/cjs/menubar/menubar-store.cjs +6 -6
  17. package/cjs/radio/radio-store.cjs +5 -5
  18. package/cjs/select/select-store.cjs +9 -9
  19. package/cjs/tab/tab-store.cjs +6 -6
  20. package/cjs/tag/tag-store.cjs +90 -0
  21. package/cjs/tag/tag-store.d.cts +80 -0
  22. package/cjs/tag/tag-store.d.ts +80 -0
  23. package/cjs/toolbar/toolbar-store.cjs +5 -5
  24. package/cjs/utils/dom.cjs +6 -2
  25. package/cjs/utils/dom.d.cts +14 -5
  26. package/cjs/utils/dom.d.ts +14 -5
  27. package/cjs/utils/events.cjs +17 -6
  28. package/cjs/utils/events.d.cts +6 -0
  29. package/cjs/utils/events.d.ts +6 -0
  30. package/cjs/utils/focus.cjs +13 -13
  31. package/cjs/utils/platform.cjs +3 -3
  32. package/cjs/utils/undo.cjs +10 -0
  33. package/cjs/utils/undo.d.cts +19 -0
  34. package/cjs/utils/undo.d.ts +19 -0
  35. package/esm/__chunks/{URUD7X4C.js → ABMC67JW.js} +1 -1
  36. package/esm/__chunks/EKIWAN6A.js +71 -0
  37. package/esm/__chunks/{RRSZHCH6.js → IUORCTET.js} +36 -20
  38. package/esm/__chunks/{PXYVPXSS.js → K7A7LTR3.js} +1 -1
  39. package/esm/__chunks/{VDNATJW2.js → QAI5BPCY.js} +1 -1
  40. package/esm/__chunks/{2H5K47H4.js → YVUNPQHS.js} +5 -5
  41. package/esm/collection/collection-store.js +2 -2
  42. package/esm/combobox/combobox-store.d.ts +16 -5
  43. package/esm/combobox/combobox-store.js +40 -21
  44. package/esm/composite/composite-store.js +4 -4
  45. package/esm/form/form-store.js +2 -2
  46. package/esm/menu/menu-bar-store.js +5 -5
  47. package/esm/menu/menu-store.js +6 -6
  48. package/esm/menubar/menubar-store.js +5 -5
  49. package/esm/radio/radio-store.js +4 -4
  50. package/esm/select/select-store.js +8 -8
  51. package/esm/tab/tab-store.js +4 -4
  52. package/esm/tag/tag-store.d.ts +80 -0
  53. package/esm/tag/tag-store.js +90 -0
  54. package/esm/toolbar/toolbar-store.js +4 -4
  55. package/esm/utils/dom.d.ts +14 -5
  56. package/esm/utils/dom.js +5 -1
  57. package/esm/utils/events.d.ts +6 -0
  58. package/esm/utils/events.js +13 -2
  59. package/esm/utils/focus.js +1 -1
  60. package/esm/utils/platform.js +2 -2
  61. package/esm/utils/undo.d.ts +19 -0
  62. package/esm/utils/undo.js +10 -0
  63. package/package.json +15 -1
  64. package/tag/tag-store/package.json +8 -0
  65. package/utils/undo/package.json +8 -0
@@ -1,16 +1,16 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
2
2
 
3
3
 
4
- var _Y7KNI5NScjs = require('../__chunks/Y7KNI5NS.cjs');
5
- require('../__chunks/FFZYCAXA.cjs');
4
+ var _KL74MAHBcjs = require('../__chunks/KL74MAHB.cjs');
5
+ require('../__chunks/QD2A4YF6.cjs');
6
+ require('../__chunks/ULSPM3Y3.cjs');
6
7
 
7
8
 
8
9
  var _B4LYZ4EMcjs = require('../__chunks/B4LYZ4EM.cjs');
9
10
 
10
11
 
11
12
  var _EEDWPDM2cjs = require('../__chunks/EEDWPDM2.cjs');
12
- require('../__chunks/UKR6TQI3.cjs');
13
- require('../__chunks/ULSPM3Y3.cjs');
13
+ require('../__chunks/IMYW2UAC.cjs');
14
14
 
15
15
 
16
16
 
@@ -22,7 +22,7 @@ function createRadioStore(_a = {}) {
22
22
  var props = _AV6KTKLEcjs.__objRest.call(void 0, _a, []);
23
23
  var _a2;
24
24
  const syncState = (_a2 = props.store) == null ? void 0 : _a2.getState();
25
- const composite = _Y7KNI5NScjs.createCompositeStore.call(void 0, _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, props), {
25
+ const composite = _KL74MAHBcjs.createCompositeStore.call(void 0, _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, props), {
26
26
  focusLoop: _EEDWPDM2cjs.defaultValue.call(void 0, props.focusLoop, syncState == null ? void 0 : syncState.focusLoop, true)
27
27
  }));
28
28
  const initialState = _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, composite.getState()), {
@@ -1,15 +1,18 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
2
2
 
3
3
 
4
+ var _KL74MAHBcjs = require('../__chunks/KL74MAHB.cjs');
5
+ require('../__chunks/QD2A4YF6.cjs');
6
+
7
+
8
+ var _ULSPM3Y3cjs = require('../__chunks/ULSPM3Y3.cjs');
9
+
10
+
4
11
  var _5JEQEZFRcjs = require('../__chunks/5JEQEZFR.cjs');
5
12
  require('../__chunks/LTLFSC4X.cjs');
6
13
  require('../__chunks/AETQC2AR.cjs');
7
14
 
8
15
 
9
- var _Y7KNI5NScjs = require('../__chunks/Y7KNI5NS.cjs');
10
- require('../__chunks/FFZYCAXA.cjs');
11
-
12
-
13
16
 
14
17
 
15
18
 
@@ -20,10 +23,7 @@ var _B4LYZ4EMcjs = require('../__chunks/B4LYZ4EM.cjs');
20
23
 
21
24
 
22
25
  var _EEDWPDM2cjs = require('../__chunks/EEDWPDM2.cjs');
23
- require('../__chunks/UKR6TQI3.cjs');
24
-
25
-
26
- var _ULSPM3Y3cjs = require('../__chunks/ULSPM3Y3.cjs');
26
+ require('../__chunks/IMYW2UAC.cjs');
27
27
 
28
28
 
29
29
 
@@ -53,7 +53,7 @@ function createSelectStore(_a = {}) {
53
53
  );
54
54
  _B4LYZ4EMcjs.throwOnConflictingProps.call(void 0, props, store);
55
55
  const syncState = store.getState();
56
- const composite = _Y7KNI5NScjs.createCompositeStore.call(void 0, _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, props), {
56
+ const composite = _KL74MAHBcjs.createCompositeStore.call(void 0, _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, props), {
57
57
  store,
58
58
  virtualFocus: _EEDWPDM2cjs.defaultValue.call(void 0,
59
59
  props.virtualFocus,
@@ -1,10 +1,11 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
2
2
 
3
3
 
4
- var _Y7KNI5NScjs = require('../__chunks/Y7KNI5NS.cjs');
4
+ var _KL74MAHBcjs = require('../__chunks/KL74MAHB.cjs');
5
5
 
6
6
 
7
- var _FFZYCAXAcjs = require('../__chunks/FFZYCAXA.cjs');
7
+ var _QD2A4YF6cjs = require('../__chunks/QD2A4YF6.cjs');
8
+ require('../__chunks/ULSPM3Y3.cjs');
8
9
 
9
10
 
10
11
 
@@ -16,8 +17,7 @@ var _B4LYZ4EMcjs = require('../__chunks/B4LYZ4EM.cjs');
16
17
 
17
18
 
18
19
  var _EEDWPDM2cjs = require('../__chunks/EEDWPDM2.cjs');
19
- require('../__chunks/UKR6TQI3.cjs');
20
- require('../__chunks/ULSPM3Y3.cjs');
20
+ require('../__chunks/IMYW2UAC.cjs');
21
21
 
22
22
 
23
23
 
@@ -49,7 +49,7 @@ function createTabStore(_a = {}) {
49
49
  _B4LYZ4EMcjs.omit.call(void 0, combobox, independentKeys)
50
50
  );
51
51
  const syncState = store == null ? void 0 : store.getState();
52
- const composite = _Y7KNI5NScjs.createCompositeStore.call(void 0, _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, props), {
52
+ const composite = _KL74MAHBcjs.createCompositeStore.call(void 0, _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, props), {
53
53
  orientation: _EEDWPDM2cjs.defaultValue.call(void 0,
54
54
  props.orientation,
55
55
  syncState == null ? void 0 : syncState.orientation,
@@ -57,7 +57,7 @@ function createTabStore(_a = {}) {
57
57
  ),
58
58
  focusLoop: _EEDWPDM2cjs.defaultValue.call(void 0, props.focusLoop, syncState == null ? void 0 : syncState.focusLoop, true)
59
59
  }));
60
- const panels = _FFZYCAXAcjs.createCollectionStore.call(void 0, );
60
+ const panels = _QD2A4YF6cjs.createCollectionStore.call(void 0, );
61
61
  const initialState = _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, composite.getState()), {
62
62
  selectedId: _EEDWPDM2cjs.defaultValue.call(void 0,
63
63
  props.selectedId,
@@ -0,0 +1,90 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
2
+
3
+
4
+ var _KL74MAHBcjs = require('../__chunks/KL74MAHB.cjs');
5
+ require('../__chunks/QD2A4YF6.cjs');
6
+ require('../__chunks/ULSPM3Y3.cjs');
7
+
8
+
9
+ var _LPDHSEHUcjs = require('../__chunks/LPDHSEHU.cjs');
10
+
11
+
12
+
13
+
14
+ var _B4LYZ4EMcjs = require('../__chunks/B4LYZ4EM.cjs');
15
+
16
+
17
+
18
+ var _EEDWPDM2cjs = require('../__chunks/EEDWPDM2.cjs');
19
+ require('../__chunks/IMYW2UAC.cjs');
20
+
21
+
22
+
23
+ var _AV6KTKLEcjs = require('../__chunks/AV6KTKLE.cjs');
24
+
25
+ // src/tag/tag-store.ts
26
+ function createTagStore(props = {}) {
27
+ var _a;
28
+ const syncState = (_a = props.store) == null ? void 0 : _a.getState();
29
+ const composite = _KL74MAHBcjs.createCompositeStore.call(void 0, props);
30
+ const initialState = _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, composite.getState()), {
31
+ inputElement: _EEDWPDM2cjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.inputElement, null),
32
+ labelElement: _EEDWPDM2cjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.labelElement, null),
33
+ value: _EEDWPDM2cjs.defaultValue.call(void 0, props.value, syncState == null ? void 0 : syncState.value, props.defaultValue, ""),
34
+ values: _EEDWPDM2cjs.defaultValue.call(void 0,
35
+ props.values,
36
+ syncState == null ? void 0 : syncState.values,
37
+ props.defaultValues,
38
+ []
39
+ )
40
+ });
41
+ const tag = _B4LYZ4EMcjs.createStore.call(void 0, initialState, composite, props.store);
42
+ _B4LYZ4EMcjs.setup.call(void 0,
43
+ tag,
44
+ () => _B4LYZ4EMcjs.sync.call(void 0, tag, ["inputElement", "activeId"], (state) => {
45
+ if (!state.inputElement)
46
+ return;
47
+ if (state.activeId !== void 0)
48
+ return;
49
+ tag.setState("activeId", state.inputElement.id);
50
+ })
51
+ );
52
+ const setValues = (values) => {
53
+ const { values: previousValues } = tag.getState();
54
+ _LPDHSEHUcjs.UndoManager.execute(() => {
55
+ let changed = true;
56
+ tag.setState("values", (prev) => {
57
+ const next = _EEDWPDM2cjs.applyState.call(void 0, values, prev);
58
+ if (next === prev) {
59
+ changed = false;
60
+ }
61
+ return next;
62
+ });
63
+ if (!changed)
64
+ return;
65
+ return () => {
66
+ var _a2;
67
+ tag.setState("values", previousValues);
68
+ composite.move((_a2 = tag.getState().inputElement) == null ? void 0 : _a2.id);
69
+ };
70
+ });
71
+ };
72
+ return _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, composite), tag), {
73
+ setInputElement: (inputElement) => tag.setState("inputElement", inputElement),
74
+ setLabelElement: (labelElement) => tag.setState("labelElement", labelElement),
75
+ setValue: (value) => tag.setState("value", value),
76
+ resetValue: () => tag.setState("value", initialState.value),
77
+ setValues,
78
+ addValue: (value) => {
79
+ setValues((values) => {
80
+ if (values.includes(value))
81
+ return values;
82
+ return [...values, value];
83
+ });
84
+ },
85
+ removeValue: (value) => setValues((values) => values.filter((v) => v !== value))
86
+ });
87
+ }
88
+
89
+
90
+ exports.createTagStore = createTagStore;
@@ -0,0 +1,80 @@
1
+ import type { CompositeStoreFunctions, CompositeStoreItem, CompositeStoreOptions, CompositeStoreState } from "../composite/composite-store.js";
2
+ import type { Store, StoreOptions, StoreProps } from "../utils/store.js";
3
+ import type { SetState } from "../utils/types.js";
4
+ /**
5
+ * Creates a tag store.
6
+ */
7
+ export declare function createTagStore(props?: TagStoreProps): TagStore;
8
+ export interface TagStoreItem extends CompositeStoreItem {
9
+ value?: string;
10
+ }
11
+ export interface TagStoreState extends CompositeStoreState<TagStoreItem> {
12
+ /**
13
+ * The input element.
14
+ */
15
+ inputElement: HTMLElement | null;
16
+ /**
17
+ * The label element.
18
+ */
19
+ labelElement: HTMLElement | null;
20
+ /**
21
+ * The value of the tag input.
22
+ * @default ""
23
+ */
24
+ value: string;
25
+ /**
26
+ * The values of the selected tags.
27
+ * @default []
28
+ */
29
+ values: string[];
30
+ }
31
+ export interface TagStoreFunctions extends CompositeStoreFunctions<TagStoreItem> {
32
+ /**
33
+ * Sets the `inputElement` state.
34
+ */
35
+ setInputElement: SetState<TagStoreState["inputElement"]>;
36
+ /**
37
+ * Sets the `labelElement` state.
38
+ */
39
+ setLabelElement: SetState<TagStoreState["labelElement"]>;
40
+ /**
41
+ * Sets the [`value`](https://ariakit.org/reference/tag-provider#value) state.
42
+ */
43
+ setValue: SetState<TagStoreState["value"]>;
44
+ /**
45
+ * Resets the [`value`](https://ariakit.org/reference/tag-provider#value)
46
+ * state to its initial value.
47
+ */
48
+ resetValue: () => void;
49
+ /**
50
+ * Sets the [`values`](https://ariakit.org/reference/tag-provider#values) state.
51
+ */
52
+ setValues: SetState<TagStoreState["values"]>;
53
+ /**
54
+ * Add a new value to the
55
+ * [`values`](https://ariakit.org/reference/tag-provider#values) state if it
56
+ * doesn't already exist.
57
+ */
58
+ addValue: (value: string) => void;
59
+ /**
60
+ * Remove a value from the
61
+ * [`values`](https://ariakit.org/reference/tag-provider#values) state.
62
+ */
63
+ removeValue: (value: string) => void;
64
+ }
65
+ export interface TagStoreOptions extends StoreOptions<TagStoreState, "value" | "values">, CompositeStoreOptions<TagStoreItem> {
66
+ /**
67
+ * The initial value of the tag input.
68
+ * @default ""
69
+ */
70
+ defaultValue?: TagStoreState["value"];
71
+ /**
72
+ * The initial selected tag values.
73
+ * @default []
74
+ */
75
+ defaultValues?: TagStoreState["values"];
76
+ }
77
+ export interface TagStoreProps extends TagStoreOptions, StoreProps<TagStoreState> {
78
+ }
79
+ export interface TagStore extends TagStoreFunctions, Store<TagStoreState> {
80
+ }
@@ -0,0 +1,80 @@
1
+ import type { CompositeStoreFunctions, CompositeStoreItem, CompositeStoreOptions, CompositeStoreState } from "../composite/composite-store.js";
2
+ import type { Store, StoreOptions, StoreProps } from "../utils/store.js";
3
+ import type { SetState } from "../utils/types.js";
4
+ /**
5
+ * Creates a tag store.
6
+ */
7
+ export declare function createTagStore(props?: TagStoreProps): TagStore;
8
+ export interface TagStoreItem extends CompositeStoreItem {
9
+ value?: string;
10
+ }
11
+ export interface TagStoreState extends CompositeStoreState<TagStoreItem> {
12
+ /**
13
+ * The input element.
14
+ */
15
+ inputElement: HTMLElement | null;
16
+ /**
17
+ * The label element.
18
+ */
19
+ labelElement: HTMLElement | null;
20
+ /**
21
+ * The value of the tag input.
22
+ * @default ""
23
+ */
24
+ value: string;
25
+ /**
26
+ * The values of the selected tags.
27
+ * @default []
28
+ */
29
+ values: string[];
30
+ }
31
+ export interface TagStoreFunctions extends CompositeStoreFunctions<TagStoreItem> {
32
+ /**
33
+ * Sets the `inputElement` state.
34
+ */
35
+ setInputElement: SetState<TagStoreState["inputElement"]>;
36
+ /**
37
+ * Sets the `labelElement` state.
38
+ */
39
+ setLabelElement: SetState<TagStoreState["labelElement"]>;
40
+ /**
41
+ * Sets the [`value`](https://ariakit.org/reference/tag-provider#value) state.
42
+ */
43
+ setValue: SetState<TagStoreState["value"]>;
44
+ /**
45
+ * Resets the [`value`](https://ariakit.org/reference/tag-provider#value)
46
+ * state to its initial value.
47
+ */
48
+ resetValue: () => void;
49
+ /**
50
+ * Sets the [`values`](https://ariakit.org/reference/tag-provider#values) state.
51
+ */
52
+ setValues: SetState<TagStoreState["values"]>;
53
+ /**
54
+ * Add a new value to the
55
+ * [`values`](https://ariakit.org/reference/tag-provider#values) state if it
56
+ * doesn't already exist.
57
+ */
58
+ addValue: (value: string) => void;
59
+ /**
60
+ * Remove a value from the
61
+ * [`values`](https://ariakit.org/reference/tag-provider#values) state.
62
+ */
63
+ removeValue: (value: string) => void;
64
+ }
65
+ export interface TagStoreOptions extends StoreOptions<TagStoreState, "value" | "values">, CompositeStoreOptions<TagStoreItem> {
66
+ /**
67
+ * The initial value of the tag input.
68
+ * @default ""
69
+ */
70
+ defaultValue?: TagStoreState["value"];
71
+ /**
72
+ * The initial selected tag values.
73
+ * @default []
74
+ */
75
+ defaultValues?: TagStoreState["values"];
76
+ }
77
+ export interface TagStoreProps extends TagStoreOptions, StoreProps<TagStoreState> {
78
+ }
79
+ export interface TagStore extends TagStoreFunctions, Store<TagStoreState> {
80
+ }
@@ -1,14 +1,14 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
2
2
 
3
3
 
4
- var _Y7KNI5NScjs = require('../__chunks/Y7KNI5NS.cjs');
5
- require('../__chunks/FFZYCAXA.cjs');
4
+ var _KL74MAHBcjs = require('../__chunks/KL74MAHB.cjs');
5
+ require('../__chunks/QD2A4YF6.cjs');
6
+ require('../__chunks/ULSPM3Y3.cjs');
6
7
  require('../__chunks/B4LYZ4EM.cjs');
7
8
 
8
9
 
9
10
  var _EEDWPDM2cjs = require('../__chunks/EEDWPDM2.cjs');
10
- require('../__chunks/UKR6TQI3.cjs');
11
- require('../__chunks/ULSPM3Y3.cjs');
11
+ require('../__chunks/IMYW2UAC.cjs');
12
12
 
13
13
 
14
14
 
@@ -18,7 +18,7 @@ var _AV6KTKLEcjs = require('../__chunks/AV6KTKLE.cjs');
18
18
  function createToolbarStore(props = {}) {
19
19
  var _a;
20
20
  const syncState = (_a = props.store) == null ? void 0 : _a.getState();
21
- return _Y7KNI5NScjs.createCompositeStore.call(void 0, _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, props), {
21
+ return _KL74MAHBcjs.createCompositeStore.call(void 0, _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, props), {
22
22
  orientation: _EEDWPDM2cjs.defaultValue.call(void 0,
23
23
  props.orientation,
24
24
  syncState == null ? void 0 : syncState.orientation,
package/cjs/utils/dom.cjs CHANGED
@@ -18,7 +18,9 @@
18
18
 
19
19
 
20
20
 
21
- var _UKR6TQI3cjs = require('../__chunks/UKR6TQI3.cjs');
21
+
22
+
23
+ var _IMYW2UACcjs = require('../__chunks/IMYW2UAC.cjs');
22
24
  require('../__chunks/AV6KTKLE.cjs');
23
25
 
24
26
 
@@ -39,4 +41,6 @@ require('../__chunks/AV6KTKLE.cjs');
39
41
 
40
42
 
41
43
 
42
- exports.canUseDOM = _UKR6TQI3cjs.canUseDOM; exports.closest = _UKR6TQI3cjs.closest; exports.contains = _UKR6TQI3cjs.contains; exports.getActiveElement = _UKR6TQI3cjs.getActiveElement; exports.getDocument = _UKR6TQI3cjs.getDocument; exports.getPopupItemRole = _UKR6TQI3cjs.getPopupItemRole; exports.getPopupRole = _UKR6TQI3cjs.getPopupRole; exports.getScrollingElement = _UKR6TQI3cjs.getScrollingElement; exports.getTextboxSelection = _UKR6TQI3cjs.getTextboxSelection; exports.getWindow = _UKR6TQI3cjs.getWindow; exports.isButton = _UKR6TQI3cjs.isButton; exports.isFrame = _UKR6TQI3cjs.isFrame; exports.isPartiallyHidden = _UKR6TQI3cjs.isPartiallyHidden; exports.isTextField = _UKR6TQI3cjs.isTextField; exports.isVisible = _UKR6TQI3cjs.isVisible; exports.matches = _UKR6TQI3cjs.matches; exports.scrollIntoViewIfNeeded = _UKR6TQI3cjs.scrollIntoViewIfNeeded; exports.setSelectionRange = _UKR6TQI3cjs.setSelectionRange;
44
+
45
+
46
+ exports.canUseDOM = _IMYW2UACcjs.canUseDOM; exports.closest = _IMYW2UACcjs.closest; exports.contains = _IMYW2UACcjs.contains; exports.getActiveElement = _IMYW2UACcjs.getActiveElement; exports.getDocument = _IMYW2UACcjs.getDocument; exports.getPopupItemRole = _IMYW2UACcjs.getPopupItemRole; exports.getPopupRole = _IMYW2UACcjs.getPopupRole; exports.getScrollingElement = _IMYW2UACcjs.getScrollingElement; exports.getTextboxSelection = _IMYW2UACcjs.getTextboxSelection; exports.getTextboxValue = _IMYW2UACcjs.getTextboxValue; exports.getWindow = _IMYW2UACcjs.getWindow; exports.isButton = _IMYW2UACcjs.isButton; exports.isFrame = _IMYW2UACcjs.isFrame; exports.isPartiallyHidden = _IMYW2UACcjs.isPartiallyHidden; exports.isTextField = _IMYW2UACcjs.isTextField; exports.isTextbox = _IMYW2UACcjs.isTextbox; exports.isVisible = _IMYW2UACcjs.isVisible; exports.matches = _IMYW2UACcjs.matches; exports.scrollIntoViewIfNeeded = _IMYW2UACcjs.scrollIntoViewIfNeeded; exports.setSelectionRange = _IMYW2UACcjs.setSelectionRange;
@@ -76,13 +76,14 @@ export declare function closest<T extends Element = Element>(element: Element, s
76
76
  */
77
77
  export declare function isTextField(element: Element): element is HTMLInputElement | HTMLTextAreaElement;
78
78
  /**
79
- * Returns the element's role attribute, if it has one.
79
+ * Check whether the given element is a text field or a content editable
80
+ * element.
80
81
  */
81
- export declare function getPopupRole(element?: Element | null, fallback?: AriaHasPopup): AriaHasPopup;
82
+ export declare function isTextbox(element: HTMLElement): boolean;
82
83
  /**
83
- * Returns the item role attribute based on the popup's role.
84
+ * Returns the value of the text field or content editable element as a string.
84
85
  */
85
- export declare function getPopupItemRole(element?: Element | null, fallback?: AriaRole): string | undefined;
86
+ export declare function getTextboxValue(element: HTMLElement): string;
86
87
  /**
87
88
  * Returns the start and end offsets of the selection in the element.
88
89
  */
@@ -90,6 +91,14 @@ export declare function getTextboxSelection(element: HTMLElement): {
90
91
  start: number;
91
92
  end: number;
92
93
  };
94
+ /**
95
+ * Returns the element's role attribute, if it has one.
96
+ */
97
+ export declare function getPopupRole(element?: Element | null, fallback?: AriaHasPopup): AriaHasPopup;
98
+ /**
99
+ * Returns the item role attribute based on the popup's role.
100
+ */
101
+ export declare function getPopupItemRole(element?: Element | null, fallback?: AriaRole): string | undefined;
93
102
  /**
94
103
  * Calls `element.scrollIntoView()` if the element is hidden or partly hidden in
95
104
  * the viewport.
@@ -112,4 +121,4 @@ export declare function isPartiallyHidden(element: Element): boolean;
112
121
  * @see
113
122
  * https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/setSelectionRange
114
123
  */
115
- export declare function setSelectionRange(element: HTMLInputElement, ...args: Parameters<typeof HTMLInputElement.prototype.setSelectionRange>): void;
124
+ export declare function setSelectionRange(element: HTMLInputElement | HTMLTextAreaElement, ...args: Parameters<typeof HTMLInputElement.prototype.setSelectionRange>): void;
@@ -76,13 +76,14 @@ export declare function closest<T extends Element = Element>(element: Element, s
76
76
  */
77
77
  export declare function isTextField(element: Element): element is HTMLInputElement | HTMLTextAreaElement;
78
78
  /**
79
- * Returns the element's role attribute, if it has one.
79
+ * Check whether the given element is a text field or a content editable
80
+ * element.
80
81
  */
81
- export declare function getPopupRole(element?: Element | null, fallback?: AriaHasPopup): AriaHasPopup;
82
+ export declare function isTextbox(element: HTMLElement): boolean;
82
83
  /**
83
- * Returns the item role attribute based on the popup's role.
84
+ * Returns the value of the text field or content editable element as a string.
84
85
  */
85
- export declare function getPopupItemRole(element?: Element | null, fallback?: AriaRole): string | undefined;
86
+ export declare function getTextboxValue(element: HTMLElement): string;
86
87
  /**
87
88
  * Returns the start and end offsets of the selection in the element.
88
89
  */
@@ -90,6 +91,14 @@ export declare function getTextboxSelection(element: HTMLElement): {
90
91
  start: number;
91
92
  end: number;
92
93
  };
94
+ /**
95
+ * Returns the element's role attribute, if it has one.
96
+ */
97
+ export declare function getPopupRole(element?: Element | null, fallback?: AriaHasPopup): AriaHasPopup;
98
+ /**
99
+ * Returns the item role attribute based on the popup's role.
100
+ */
101
+ export declare function getPopupItemRole(element?: Element | null, fallback?: AriaRole): string | undefined;
93
102
  /**
94
103
  * Calls `element.scrollIntoView()` if the element is hidden or partly hidden in
95
104
  * the viewport.
@@ -112,4 +121,4 @@ export declare function isPartiallyHidden(element: Element): boolean;
112
121
  * @see
113
122
  * https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/setSelectionRange
114
123
  */
115
- export declare function setSelectionRange(element: HTMLInputElement, ...args: Parameters<typeof HTMLInputElement.prototype.setSelectionRange>): void;
124
+ export declare function setSelectionRange(element: HTMLInputElement | HTMLTextAreaElement, ...args: Parameters<typeof HTMLInputElement.prototype.setSelectionRange>): void;
@@ -1,10 +1,10 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
2
2
 
3
3
 
4
- var _7DU6YMLQcjs = require('../__chunks/7DU6YMLQ.cjs');
4
+ var _2D5LEVE7cjs = require('../__chunks/2D5LEVE7.cjs');
5
5
 
6
6
 
7
- var _UKR6TQI3cjs = require('../__chunks/UKR6TQI3.cjs');
7
+ var _IMYW2UACcjs = require('../__chunks/IMYW2UAC.cjs');
8
8
 
9
9
 
10
10
 
@@ -13,7 +13,7 @@ var _AV6KTKLEcjs = require('../__chunks/AV6KTKLE.cjs');
13
13
  // src/utils/events.ts
14
14
  function isPortalEvent(event) {
15
15
  return Boolean(
16
- event.currentTarget && !_UKR6TQI3cjs.contains.call(void 0, event.currentTarget, event.target)
16
+ event.currentTarget && !_IMYW2UACcjs.contains.call(void 0, event.currentTarget, event.target)
17
17
  );
18
18
  }
19
19
  function isSelfTarget(event) {
@@ -23,7 +23,7 @@ function isOpeningInNewTab(event) {
23
23
  const element = event.currentTarget;
24
24
  if (!element)
25
25
  return false;
26
- const isAppleDevice = _7DU6YMLQcjs.isApple.call(void 0, );
26
+ const isAppleDevice = _2D5LEVE7cjs.isApple.call(void 0, );
27
27
  if (isAppleDevice && !event.metaKey)
28
28
  return false;
29
29
  if (!isAppleDevice && !event.ctrlKey)
@@ -81,7 +81,17 @@ function fireClickEvent(element, eventInit) {
81
81
  function isFocusEventOutside(event, container) {
82
82
  const containerElement = container || event.currentTarget;
83
83
  const relatedTarget = event.relatedTarget;
84
- return !relatedTarget || !_UKR6TQI3cjs.contains.call(void 0, containerElement, relatedTarget);
84
+ return !relatedTarget || !_IMYW2UACcjs.contains.call(void 0, containerElement, relatedTarget);
85
+ }
86
+ function getInputType(event) {
87
+ const nativeEvent = "nativeEvent" in event ? event.nativeEvent : event;
88
+ if (!nativeEvent)
89
+ return;
90
+ if (!("inputType" in nativeEvent))
91
+ return;
92
+ if (typeof nativeEvent.inputType !== "string")
93
+ return;
94
+ return nativeEvent.inputType;
85
95
  }
86
96
  function queueBeforeEvent(element, type, callback) {
87
97
  const raf = requestAnimationFrame(() => {
@@ -129,4 +139,5 @@ function addGlobalEventListener(type, listener, options, scope = window) {
129
139
 
130
140
 
131
141
 
132
- exports.addGlobalEventListener = addGlobalEventListener; exports.fireBlurEvent = fireBlurEvent; exports.fireClickEvent = fireClickEvent; exports.fireEvent = fireEvent; exports.fireFocusEvent = fireFocusEvent; exports.fireKeyboardEvent = fireKeyboardEvent; exports.isDownloading = isDownloading; exports.isFocusEventOutside = isFocusEventOutside; exports.isOpeningInNewTab = isOpeningInNewTab; exports.isPortalEvent = isPortalEvent; exports.isSelfTarget = isSelfTarget; exports.queueBeforeEvent = queueBeforeEvent;
142
+
143
+ exports.addGlobalEventListener = addGlobalEventListener; exports.fireBlurEvent = fireBlurEvent; exports.fireClickEvent = fireClickEvent; exports.fireEvent = fireEvent; exports.fireFocusEvent = fireFocusEvent; exports.fireKeyboardEvent = fireKeyboardEvent; exports.getInputType = getInputType; exports.isDownloading = isDownloading; exports.isFocusEventOutside = isFocusEventOutside; exports.isOpeningInNewTab = isOpeningInNewTab; exports.isPortalEvent = isPortalEvent; exports.isSelfTarget = isSelfTarget; exports.queueBeforeEvent = queueBeforeEvent;
@@ -62,6 +62,12 @@ export declare function fireClickEvent(element: Element, eventInit?: PointerEven
62
62
  * });
63
63
  */
64
64
  export declare function isFocusEventOutside(event: Pick<FocusEvent, "currentTarget" | "relatedTarget">, container?: Element | null): boolean;
65
+ /**
66
+ * Returns the `inputType` property of the event, if available.
67
+ */
68
+ export declare function getInputType(event: Event | {
69
+ nativeEvent: Event;
70
+ }): string | undefined;
65
71
  /**
66
72
  * Runs a callback on the next animation frame, but before a certain event.
67
73
  */
@@ -62,6 +62,12 @@ export declare function fireClickEvent(element: Element, eventInit?: PointerEven
62
62
  * });
63
63
  */
64
64
  export declare function isFocusEventOutside(event: Pick<FocusEvent, "currentTarget" | "relatedTarget">, container?: Element | null): boolean;
65
+ /**
66
+ * Returns the `inputType` property of the event, if available.
67
+ */
68
+ export declare function getInputType(event: Event | {
69
+ nativeEvent: Event;
70
+ }): string | undefined;
65
71
  /**
66
72
  * Runs a callback on the next animation frame, but before a certain event.
67
73
  */