@ariakit/core 0.1.4 → 0.2.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.
Files changed (90) hide show
  1. package/CHANGELOG.md +66 -0
  2. package/cjs/__chunks/{QYB6XH64.cjs → 27ZAGOYG.cjs} +17 -13
  3. package/cjs/__chunks/6455U47T.cjs +37 -0
  4. package/cjs/__chunks/{ZPOXPO2L.cjs → 6SPJEESB.cjs} +33 -21
  5. package/cjs/__chunks/CNODBYSG.cjs +58 -0
  6. package/cjs/__chunks/{2YFRPUZP.cjs → DBHIHK7C.cjs} +6 -6
  7. package/cjs/__chunks/{W5IHD6VG.cjs → EUJ6NNA6.cjs} +56 -43
  8. package/cjs/__chunks/{4DQ3OTE7.cjs → FXEBKN6G.cjs} +22 -17
  9. package/cjs/__chunks/{ZJEEK57E.cjs → HEFJPUYD.cjs} +2 -2
  10. package/cjs/__chunks/{QNEPGQLL.cjs → M6ZA7XUP.cjs} +6 -2
  11. package/cjs/__chunks/RD3S4VKY.cjs +60 -0
  12. package/cjs/__chunks/{OFNGELMA.cjs → ZNW4LSWU.cjs} +8 -6
  13. package/cjs/checkbox/checkbox-store.cjs +14 -10
  14. package/cjs/collection/collection-store.cjs +6 -5
  15. package/cjs/combobox/combobox-store.cjs +49 -48
  16. package/cjs/composite/composite-overflow-store.cjs +7 -6
  17. package/cjs/composite/composite-store.cjs +7 -6
  18. package/cjs/dialog/dialog-store.cjs +6 -5
  19. package/cjs/disclosure/disclosure-store.cjs +5 -4
  20. package/cjs/disclosure/disclosure-store.d.ts +8 -0
  21. package/cjs/form/form-store.cjs +38 -35
  22. package/cjs/hovercard/hovercard-store.cjs +8 -7
  23. package/cjs/hovercard/hovercard-store.d.ts +3 -2
  24. package/cjs/index.cjs +3 -1
  25. package/cjs/menu/menu-bar-store.cjs +17 -13
  26. package/cjs/menu/menu-store.cjs +41 -43
  27. package/cjs/popover/popover-store.cjs +7 -6
  28. package/cjs/popover/popover-store.d.ts +8 -89
  29. package/cjs/radio/radio-store.cjs +25 -24
  30. package/cjs/select/select-store.cjs +42 -42
  31. package/cjs/tab/tab-store.cjs +29 -28
  32. package/cjs/tab/tab-store.d.ts +9 -0
  33. package/cjs/toolbar/toolbar-store.cjs +17 -13
  34. package/cjs/tooltip/tooltip-store.cjs +31 -79
  35. package/cjs/tooltip/tooltip-store.d.ts +20 -15
  36. package/cjs/tsconfig.build.tsbuildinfo +1 -1
  37. package/cjs/utils/array.cjs +1 -0
  38. package/cjs/utils/dom.cjs +3 -2
  39. package/cjs/utils/events.cjs +14 -9
  40. package/cjs/utils/focus.cjs +24 -14
  41. package/cjs/utils/misc.cjs +3 -2
  42. package/cjs/utils/platform.cjs +4 -3
  43. package/cjs/utils/store.cjs +4 -3
  44. package/esm/__chunks/3BAGFTL5.js +58 -0
  45. package/esm/__chunks/4BKCJXBM.js +37 -0
  46. package/esm/__chunks/{NA5BK7DD.js → BOKMNDR7.js} +22 -10
  47. package/esm/__chunks/{WFGVC6LE.js → EWHSN7GO.js} +17 -12
  48. package/esm/__chunks/{4T5RHRE5.js → MNNKHNLW.js} +1 -1
  49. package/esm/__chunks/{UVCATTRC.js → N6JW4ITM.js} +7 -5
  50. package/esm/__chunks/{RMD7SNCC.js → NWU4GBZ6.js} +5 -1
  51. package/esm/__chunks/{X7MJ3FB5.js → R6VHFWTV.js} +49 -36
  52. package/esm/__chunks/{DXA3K2FY.js → TFBCK4JB.js} +1 -1
  53. package/esm/__chunks/Z5IDQSMV.js +60 -0
  54. package/esm/__chunks/{IOAGNCXX.js → ZV2GEGPL.js} +14 -10
  55. package/esm/checkbox/checkbox-store.js +11 -7
  56. package/esm/collection/collection-store.js +5 -4
  57. package/esm/combobox/combobox-store.js +34 -33
  58. package/esm/composite/composite-overflow-store.js +6 -5
  59. package/esm/composite/composite-store.js +6 -5
  60. package/esm/dialog/dialog-store.js +5 -4
  61. package/esm/disclosure/disclosure-store.d.ts +8 -0
  62. package/esm/disclosure/disclosure-store.js +4 -3
  63. package/esm/form/form-store.js +24 -21
  64. package/esm/hovercard/hovercard-store.d.ts +3 -2
  65. package/esm/hovercard/hovercard-store.js +7 -6
  66. package/esm/index.js +2 -0
  67. package/esm/menu/menu-bar-store.js +15 -11
  68. package/esm/menu/menu-store.js +31 -33
  69. package/esm/popover/popover-store.d.ts +8 -89
  70. package/esm/popover/popover-store.js +6 -5
  71. package/esm/radio/radio-store.js +22 -21
  72. package/esm/select/select-store.js +29 -29
  73. package/esm/tab/tab-store.d.ts +9 -0
  74. package/esm/tab/tab-store.js +23 -22
  75. package/esm/toolbar/toolbar-store.js +15 -11
  76. package/esm/tooltip/tooltip-store.d.ts +20 -15
  77. package/esm/tooltip/tooltip-store.js +32 -80
  78. package/esm/tsconfig.build.tsbuildinfo +1 -1
  79. package/esm/utils/array.js +1 -0
  80. package/esm/utils/dom.js +2 -1
  81. package/esm/utils/events.js +10 -5
  82. package/esm/utils/focus.js +14 -4
  83. package/esm/utils/misc.js +2 -1
  84. package/esm/utils/platform.js +3 -2
  85. package/esm/utils/store.js +3 -2
  86. package/package.json +1 -1
  87. package/cjs/__chunks/DQHU5K4Q.cjs +0 -57
  88. package/cjs/__chunks/HLVPXX7H.cjs +0 -1491
  89. package/esm/__chunks/6HMPWUDT.js +0 -57
  90. package/esm/__chunks/6PEWNRTN.js +0 -1491
@@ -1,16 +1,20 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _4DQ3OTE7cjs = require('../__chunks/4DQ3OTE7.cjs');
3
+ var _FXEBKN6Gcjs = require('../__chunks/FXEBKN6G.cjs');
4
4
 
5
5
 
6
- var _ZPOXPO2Lcjs = require('../__chunks/ZPOXPO2L.cjs');
6
+ var _6SPJEESBcjs = require('../__chunks/6SPJEESB.cjs');
7
7
 
8
8
 
9
9
 
10
10
 
11
11
 
12
- var _QNEPGQLLcjs = require('../__chunks/QNEPGQLL.cjs');
13
- require('../__chunks/OFNGELMA.cjs');
12
+ var _M6ZA7XUPcjs = require('../__chunks/M6ZA7XUP.cjs');
13
+ require('../__chunks/ZNW4LSWU.cjs');
14
+
15
+
16
+
17
+ var _6455U47Tcjs = require('../__chunks/6455U47T.cjs');
14
18
 
15
19
  // src/form/form-store.ts
16
20
  function nextFrame() {
@@ -18,19 +22,20 @@ function nextFrame() {
18
22
  }
19
23
  function hasMessages(object) {
20
24
  return Object.keys(object).some((key) => {
21
- if (_QNEPGQLLcjs.isObject.call(void 0, object[key])) {
25
+ if (_M6ZA7XUPcjs.isObject.call(void 0, object[key])) {
22
26
  return hasMessages(object[key]);
23
27
  }
24
28
  return !!object[key];
25
29
  });
26
30
  }
27
31
  function get(values, path, defaultValue2) {
32
+ var _a;
28
33
  const [key, ...rest] = Array.isArray(path) ? path : `${path}`.split(".");
29
34
  if (key == null || !values) {
30
35
  return defaultValue2;
31
36
  }
32
37
  if (!rest.length) {
33
- return _nullishCoalesce(values[key], () => ( defaultValue2));
38
+ return (_a = values[key]) != null ? _a : defaultValue2;
34
39
  }
35
40
  return get(values[key], rest, defaultValue2);
36
41
  }
@@ -39,10 +44,10 @@ function set(values, path, value) {
39
44
  if (k == null)
40
45
  return values;
41
46
  const key = k;
42
- const isIntegerKey = _QNEPGQLLcjs.isInteger.call(void 0, key);
47
+ const isIntegerKey = _M6ZA7XUPcjs.isInteger.call(void 0, key);
43
48
  const nextValues = isIntegerKey ? values || [] : values || {};
44
49
  const nestedValues = nextValues[key];
45
- const result = rest.length && (Array.isArray(nestedValues) || _QNEPGQLLcjs.isObject.call(void 0, nestedValues)) ? set(nestedValues, rest, value) : value;
50
+ const result = rest.length && (Array.isArray(nestedValues) || _M6ZA7XUPcjs.isObject.call(void 0, nestedValues)) ? set(nestedValues, rest, value) : value;
46
51
  if (isIntegerKey) {
47
52
  const index = Number(key);
48
53
  if (values) {
@@ -56,7 +61,7 @@ function set(values, path, value) {
56
61
  nextValues2[index] = result;
57
62
  return nextValues2;
58
63
  }
59
- return { ...values, [key]: result };
64
+ return _6455U47Tcjs.__spreadProps.call(void 0, _6455U47Tcjs.__spreadValues.call(void 0, {}, values), { [key]: result });
60
65
  }
61
66
  function setAll(values, value) {
62
67
  const result = {};
@@ -65,12 +70,12 @@ function setAll(values, value) {
65
70
  const currentValue = values[key];
66
71
  if (Array.isArray(currentValue)) {
67
72
  result[key] = currentValue.map((v) => {
68
- if (_QNEPGQLLcjs.isObject.call(void 0, v)) {
73
+ if (_M6ZA7XUPcjs.isObject.call(void 0, v)) {
69
74
  return setAll(v, value);
70
75
  }
71
76
  return value;
72
77
  });
73
- } else if (_QNEPGQLLcjs.isObject.call(void 0, currentValue)) {
78
+ } else if (_M6ZA7XUPcjs.isObject.call(void 0, currentValue)) {
74
79
  result[key] = setAll(currentValue, value);
75
80
  } else {
76
81
  result[key] = value;
@@ -101,38 +106,38 @@ function createNames() {
101
106
  return new Proxy(/* @__PURE__ */ Object.create(null), getNameHandler(cache));
102
107
  }
103
108
  function createFormStore(props = {}) {
104
- const syncState = _optionalChain([props, 'access', _ => _.store, 'optionalAccess', _2 => _2.getState, 'call', _3 => _3()]);
105
- const collection = _4DQ3OTE7cjs.createCollectionStore.call(void 0, props);
106
- const values = _QNEPGQLLcjs.defaultValue.call(void 0,
109
+ var _a;
110
+ const syncState = (_a = props.store) == null ? void 0 : _a.getState();
111
+ const collection = _FXEBKN6Gcjs.createCollectionStore.call(void 0, props);
112
+ const values = _M6ZA7XUPcjs.defaultValue.call(void 0,
107
113
  props.values,
108
- _optionalChain([syncState, 'optionalAccess', _4 => _4.values]),
114
+ syncState == null ? void 0 : syncState.values,
109
115
  props.defaultValues,
110
116
  {}
111
117
  );
112
- const errors = _QNEPGQLLcjs.defaultValue.call(void 0,
118
+ const errors = _M6ZA7XUPcjs.defaultValue.call(void 0,
113
119
  props.errors,
114
- _optionalChain([syncState, 'optionalAccess', _5 => _5.errors]),
120
+ syncState == null ? void 0 : syncState.errors,
115
121
  props.defaultErrors,
116
122
  {}
117
123
  );
118
- const touched = _QNEPGQLLcjs.defaultValue.call(void 0,
124
+ const touched = _M6ZA7XUPcjs.defaultValue.call(void 0,
119
125
  props.touched,
120
- _optionalChain([syncState, 'optionalAccess', _6 => _6.touched]),
126
+ syncState == null ? void 0 : syncState.touched,
121
127
  props.defaultTouched,
122
128
  {}
123
129
  );
124
- const initialState = {
125
- ...collection.getState(),
130
+ const initialState = _6455U47Tcjs.__spreadProps.call(void 0, _6455U47Tcjs.__spreadValues.call(void 0, {}, collection.getState()), {
126
131
  values,
127
132
  errors,
128
133
  touched,
129
- validating: _QNEPGQLLcjs.defaultValue.call(void 0, _optionalChain([syncState, 'optionalAccess', _7 => _7.validating]), false),
130
- submitting: _QNEPGQLLcjs.defaultValue.call(void 0, _optionalChain([syncState, 'optionalAccess', _8 => _8.submitting]), false),
131
- submitSucceed: _QNEPGQLLcjs.defaultValue.call(void 0, _optionalChain([syncState, 'optionalAccess', _9 => _9.submitSucceed]), 0),
132
- submitFailed: _QNEPGQLLcjs.defaultValue.call(void 0, _optionalChain([syncState, 'optionalAccess', _10 => _10.submitFailed]), 0),
134
+ validating: _M6ZA7XUPcjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.validating, false),
135
+ submitting: _M6ZA7XUPcjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.submitting, false),
136
+ submitSucceed: _M6ZA7XUPcjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.submitSucceed, 0),
137
+ submitFailed: _M6ZA7XUPcjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.submitFailed, 0),
133
138
  valid: !hasMessages(errors)
134
- };
135
- const form = _ZPOXPO2Lcjs.createStore.call(void 0, initialState, collection, props.store);
139
+ });
140
+ const form = _6SPJEESBcjs.createStore.call(void 0, initialState, collection, props.store);
136
141
  const validateCallbacks = /* @__PURE__ */ new Set();
137
142
  const submitCallbacks = /* @__PURE__ */ new Set();
138
143
  const validate = async () => {
@@ -148,15 +153,13 @@ function createFormStore(props = {}) {
148
153
  form.setState("validating", false);
149
154
  }
150
155
  };
151
- return {
152
- ...collection,
153
- ...form,
156
+ return _6455U47Tcjs.__spreadProps.call(void 0, _6455U47Tcjs.__spreadValues.call(void 0, _6455U47Tcjs.__spreadValues.call(void 0, {}, collection), form), {
154
157
  names: createNames(),
155
158
  setValues: (values2) => form.setState("values", values2),
156
159
  getValue: (name) => get(form.getState().values, name),
157
160
  setValue: (name, value) => form.setState("values", (values2) => {
158
161
  const prevValue = get(values2, name);
159
- const nextValue = _QNEPGQLLcjs.applyState.call(void 0, value, prevValue);
162
+ const nextValue = _M6ZA7XUPcjs.applyState.call(void 0, value, prevValue);
160
163
  if (nextValue === prevValue)
161
164
  return values2;
162
165
  return set(values2, name, nextValue);
@@ -177,7 +180,7 @@ function createFormStore(props = {}) {
177
180
  getError: (name) => get(form.getState().errors, name),
178
181
  setError: (name, error) => form.setState("errors", (errors2) => {
179
182
  const prevError = get(errors2, name);
180
- const nextError = _QNEPGQLLcjs.applyState.call(void 0, error, prevError);
183
+ const nextError = _M6ZA7XUPcjs.applyState.call(void 0, error, prevError);
181
184
  if (nextError === prevError)
182
185
  return errors2;
183
186
  return set(errors2, name, nextError);
@@ -186,7 +189,7 @@ function createFormStore(props = {}) {
186
189
  getFieldTouched: (name) => !!get(form.getState().touched, name),
187
190
  setFieldTouched: (name, value) => form.setState("touched", (touched2) => {
188
191
  const prevValue = get(touched2, name);
189
- const nextValue = _QNEPGQLLcjs.applyState.call(void 0, value, prevValue);
192
+ const nextValue = _M6ZA7XUPcjs.applyState.call(void 0, value, prevValue);
190
193
  if (nextValue === prevValue)
191
194
  return touched2;
192
195
  return set(touched2, name, nextValue);
@@ -232,7 +235,7 @@ function createFormStore(props = {}) {
232
235
  form.setState("submitSucceed", 0);
233
236
  form.setState("submitFailed", 0);
234
237
  }
235
- };
238
+ });
236
239
  }
237
240
 
238
241
 
@@ -1,11 +1,12 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _DQHU5K4Qcjs = require('../__chunks/DQHU5K4Q.cjs');
4
- require('../__chunks/HLVPXX7H.cjs');
5
- require('../__chunks/ZJEEK57E.cjs');
6
- require('../__chunks/QYB6XH64.cjs');
7
- require('../__chunks/ZPOXPO2L.cjs');
8
- require('../__chunks/QNEPGQLL.cjs');
3
+ var _CNODBYSGcjs = require('../__chunks/CNODBYSG.cjs');
4
+ require('../__chunks/RD3S4VKY.cjs');
5
+ require('../__chunks/HEFJPUYD.cjs');
6
+ require('../__chunks/27ZAGOYG.cjs');
7
+ require('../__chunks/6SPJEESB.cjs');
8
+ require('../__chunks/M6ZA7XUP.cjs');
9
+ require('../__chunks/6455U47T.cjs');
9
10
 
10
11
 
11
- exports.createHovercardStore = _DQHU5K4Qcjs.createHovercardStore;
12
+ exports.createHovercardStore = _CNODBYSGcjs.createHovercardStore;
@@ -11,8 +11,9 @@ export interface HovercardStoreState extends PopoverStoreState {
11
11
  */
12
12
  placement: PopoverStoreState["placement"];
13
13
  /**
14
- * The amount of time in milliseconds to wait before showing or hiding the
15
- * popover.
14
+ * The amount of time in milliseconds to wait before showing and hiding the
15
+ * popover. To control the delay for showing and hiding separately, use
16
+ * `showTimeout` and `hideTimeout`.
16
17
  * @default 500
17
18
  */
18
19
  timeout: number;
package/cjs/index.cjs CHANGED
@@ -1,4 +1,6 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/index.ts
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});require('./__chunks/6455U47T.cjs');
2
+
3
+ // src/index.ts
2
4
  var src_default = {};
3
5
 
4
6
 
@@ -1,26 +1,30 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _W5IHD6VGcjs = require('../__chunks/W5IHD6VG.cjs');
4
- require('../__chunks/4DQ3OTE7.cjs');
5
- require('../__chunks/ZPOXPO2L.cjs');
3
+ var _EUJ6NNA6cjs = require('../__chunks/EUJ6NNA6.cjs');
4
+ require('../__chunks/FXEBKN6G.cjs');
5
+ require('../__chunks/6SPJEESB.cjs');
6
6
 
7
7
 
8
- var _QNEPGQLLcjs = require('../__chunks/QNEPGQLL.cjs');
9
- require('../__chunks/OFNGELMA.cjs');
8
+ var _M6ZA7XUPcjs = require('../__chunks/M6ZA7XUP.cjs');
9
+ require('../__chunks/ZNW4LSWU.cjs');
10
10
  require('../__chunks/GDZQUFNP.cjs');
11
11
 
12
+
13
+
14
+ var _6455U47Tcjs = require('../__chunks/6455U47T.cjs');
15
+
12
16
  // src/menu/menu-bar-store.ts
13
17
  function createMenuBarStore(props = {}) {
14
- const syncState = _optionalChain([props, 'access', _ => _.store, 'optionalAccess', _2 => _2.getState, 'call', _3 => _3()]);
15
- return _W5IHD6VGcjs.createCompositeStore.call(void 0, {
16
- ...props,
17
- orientation: _QNEPGQLLcjs.defaultValue.call(void 0,
18
+ var _a;
19
+ const syncState = (_a = props.store) == null ? void 0 : _a.getState();
20
+ return _EUJ6NNA6cjs.createCompositeStore.call(void 0, _6455U47Tcjs.__spreadProps.call(void 0, _6455U47Tcjs.__spreadValues.call(void 0, {}, props), {
21
+ orientation: _M6ZA7XUPcjs.defaultValue.call(void 0,
18
22
  props.orientation,
19
- _optionalChain([syncState, 'optionalAccess', _4 => _4.orientation]),
23
+ syncState == null ? void 0 : syncState.orientation,
20
24
  "horizontal"
21
25
  ),
22
- focusLoop: _QNEPGQLLcjs.defaultValue.call(void 0, props.focusLoop, _optionalChain([syncState, 'optionalAccess', _5 => _5.focusLoop]), true)
23
- });
26
+ focusLoop: _M6ZA7XUPcjs.defaultValue.call(void 0, props.focusLoop, syncState == null ? void 0 : syncState.focusLoop, true)
27
+ }));
24
28
  }
25
29
 
26
30
 
@@ -1,72 +1,74 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _DQHU5K4Qcjs = require('../__chunks/DQHU5K4Q.cjs');
4
- require('../__chunks/HLVPXX7H.cjs');
5
- require('../__chunks/ZJEEK57E.cjs');
6
- require('../__chunks/QYB6XH64.cjs');
3
+ var _CNODBYSGcjs = require('../__chunks/CNODBYSG.cjs');
4
+ require('../__chunks/RD3S4VKY.cjs');
5
+ require('../__chunks/HEFJPUYD.cjs');
6
+ require('../__chunks/27ZAGOYG.cjs');
7
7
 
8
8
 
9
- var _W5IHD6VGcjs = require('../__chunks/W5IHD6VG.cjs');
10
- require('../__chunks/4DQ3OTE7.cjs');
9
+ var _EUJ6NNA6cjs = require('../__chunks/EUJ6NNA6.cjs');
10
+ require('../__chunks/FXEBKN6G.cjs');
11
11
 
12
12
 
13
13
 
14
- var _ZPOXPO2Lcjs = require('../__chunks/ZPOXPO2L.cjs');
14
+ var _6SPJEESBcjs = require('../__chunks/6SPJEESB.cjs');
15
15
 
16
16
 
17
17
 
18
- var _QNEPGQLLcjs = require('../__chunks/QNEPGQLL.cjs');
19
- require('../__chunks/OFNGELMA.cjs');
18
+ var _M6ZA7XUPcjs = require('../__chunks/M6ZA7XUP.cjs');
19
+ require('../__chunks/ZNW4LSWU.cjs');
20
20
  require('../__chunks/GDZQUFNP.cjs');
21
21
 
22
+
23
+
24
+
25
+ var _6455U47Tcjs = require('../__chunks/6455U47T.cjs');
26
+
22
27
  // src/menu/menu-store.ts
23
- function createMenuStore({
24
- combobox,
25
- ...props
26
- } = {}) {
27
- const store = _ZPOXPO2Lcjs.mergeStore.call(void 0,
28
+ function createMenuStore(_a = {}) {
29
+ var _b = _a, {
30
+ combobox
31
+ } = _b, props = _6455U47Tcjs.__objRest.call(void 0, _b, [
32
+ "combobox"
33
+ ]);
34
+ const store = _6SPJEESBcjs.mergeStore.call(void 0,
28
35
  props.store,
29
- _optionalChain([combobox, 'optionalAccess', _ => _.omit, 'call', _2 => _2(
30
- "baseElement",
36
+ combobox == null ? void 0 : combobox.omit(
31
37
  "arrowElement",
32
38
  "anchorElement",
33
39
  "contentElement",
34
40
  "popoverElement",
35
41
  "disclosureElement"
36
- )])
42
+ )
37
43
  );
38
44
  const syncState = store.getState();
39
- const composite = _W5IHD6VGcjs.createCompositeStore.call(void 0, {
40
- ...props,
45
+ const composite = _EUJ6NNA6cjs.createCompositeStore.call(void 0, _6455U47Tcjs.__spreadProps.call(void 0, _6455U47Tcjs.__spreadValues.call(void 0, {}, props), {
41
46
  store,
42
- orientation: _QNEPGQLLcjs.defaultValue.call(void 0,
47
+ orientation: _M6ZA7XUPcjs.defaultValue.call(void 0,
43
48
  props.orientation,
44
49
  syncState.orientation,
45
50
  "vertical"
46
51
  )
47
- });
48
- const hovercard = _DQHU5K4Qcjs.createHovercardStore.call(void 0, {
49
- ...props,
52
+ }));
53
+ const hovercard = _CNODBYSGcjs.createHovercardStore.call(void 0, _6455U47Tcjs.__spreadProps.call(void 0, _6455U47Tcjs.__spreadValues.call(void 0, {}, props), {
50
54
  store,
51
- placement: _QNEPGQLLcjs.defaultValue.call(void 0,
55
+ placement: _M6ZA7XUPcjs.defaultValue.call(void 0,
52
56
  props.placement,
53
57
  syncState.placement,
54
58
  "bottom-start"
55
59
  ),
56
- hideTimeout: _QNEPGQLLcjs.defaultValue.call(void 0, props.hideTimeout, syncState.hideTimeout, 0)
57
- });
58
- const initialState = {
59
- ...composite.getState(),
60
- ...hovercard.getState(),
61
- initialFocus: _QNEPGQLLcjs.defaultValue.call(void 0, syncState.initialFocus, "container"),
62
- values: _QNEPGQLLcjs.defaultValue.call(void 0,
60
+ hideTimeout: _M6ZA7XUPcjs.defaultValue.call(void 0, props.hideTimeout, syncState.hideTimeout, 0)
61
+ }));
62
+ const initialState = _6455U47Tcjs.__spreadProps.call(void 0, _6455U47Tcjs.__spreadValues.call(void 0, _6455U47Tcjs.__spreadValues.call(void 0, {}, composite.getState()), hovercard.getState()), {
63
+ initialFocus: _M6ZA7XUPcjs.defaultValue.call(void 0, syncState.initialFocus, "container"),
64
+ values: _M6ZA7XUPcjs.defaultValue.call(void 0,
63
65
  props.values,
64
66
  syncState.values,
65
67
  props.defaultValues,
66
68
  {}
67
69
  )
68
- };
69
- const menu = _ZPOXPO2Lcjs.createStore.call(void 0, initialState, composite, hovercard, store);
70
+ });
71
+ const menu = _6SPJEESBcjs.createStore.call(void 0, initialState, composite, hovercard, store);
70
72
  menu.setup(
71
73
  () => menu.sync(
72
74
  (state) => {
@@ -77,10 +79,7 @@ function createMenuStore({
77
79
  ["mounted"]
78
80
  )
79
81
  );
80
- return {
81
- ...composite,
82
- ...hovercard,
83
- ...menu,
82
+ return _6455U47Tcjs.__spreadProps.call(void 0, _6455U47Tcjs.__spreadValues.call(void 0, _6455U47Tcjs.__spreadValues.call(void 0, _6455U47Tcjs.__spreadValues.call(void 0, {}, composite), hovercard), menu), {
84
83
  setInitialFocus: (value) => menu.setState("initialFocus", value),
85
84
  setValues: (values) => menu.setState("values", values),
86
85
  setValue: (name, value) => {
@@ -92,16 +91,15 @@ function createMenuStore({
92
91
  return;
93
92
  menu.setState("values", (values) => {
94
93
  const prevValue = values[name];
95
- const nextValue = _QNEPGQLLcjs.applyState.call(void 0, value, prevValue);
94
+ const nextValue = _M6ZA7XUPcjs.applyState.call(void 0, value, prevValue);
96
95
  if (nextValue === prevValue)
97
96
  return values;
98
- return {
99
- ...values,
97
+ return _6455U47Tcjs.__spreadProps.call(void 0, _6455U47Tcjs.__spreadValues.call(void 0, {}, values), {
100
98
  [name]: nextValue !== void 0 && nextValue
101
- };
99
+ });
102
100
  });
103
101
  }
104
- };
102
+ });
105
103
  }
106
104
 
107
105
 
@@ -1,10 +1,11 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _HLVPXX7Hcjs = require('../__chunks/HLVPXX7H.cjs');
4
- require('../__chunks/ZJEEK57E.cjs');
5
- require('../__chunks/QYB6XH64.cjs');
6
- require('../__chunks/ZPOXPO2L.cjs');
7
- require('../__chunks/QNEPGQLL.cjs');
3
+ var _RD3S4VKYcjs = require('../__chunks/RD3S4VKY.cjs');
4
+ require('../__chunks/HEFJPUYD.cjs');
5
+ require('../__chunks/27ZAGOYG.cjs');
6
+ require('../__chunks/6SPJEESB.cjs');
7
+ require('../__chunks/M6ZA7XUP.cjs');
8
+ require('../__chunks/6455U47T.cjs');
8
9
 
9
10
 
10
- exports.createPopoverStore = _HLVPXX7Hcjs.createPopoverStore;
11
+ exports.createPopoverStore = _RD3S4VKYcjs.createPopoverStore;
@@ -3,27 +3,10 @@ import type { Store, StoreOptions, StoreProps } from "../utils/store.js";
3
3
  import type { SetState } from "../utils/types.js";
4
4
  type BasePlacement = "top" | "bottom" | "left" | "right";
5
5
  type Placement = BasePlacement | `${BasePlacement}-start` | `${BasePlacement}-end`;
6
- type AnchorRect = {
7
- x?: number;
8
- y?: number;
9
- width?: number;
10
- height?: number;
11
- };
12
6
  /**
13
7
  * Creates a popover store.
14
8
  */
15
- export declare function createPopoverStore({ getAnchorRect, renderCallback, popover: otherPopover, ...props }?: PopoverStoreProps): PopoverStore;
16
- export interface PopoverStoreRenderCallbackProps extends Pick<PopoverStoreState, "anchorElement" | "popoverElement" | "arrowElement" | "mounted" | "placement" | "fixed" | "gutter" | "shift" | "overlap" | "flip" | "sameWidth" | "fitViewport" | "arrowPadding" | "overflowPadding"> {
17
- /**
18
- * A method that updates the `currentPlacement` state.
19
- */
20
- setPlacement: SetState<Placement>;
21
- /**
22
- * The default render callback that will be called when the `renderCallback`
23
- * prop is not provided.
24
- */
25
- defaultRenderCallback: () => () => void;
26
- }
9
+ export declare function createPopoverStore({ popover: otherPopover, ...props }?: PopoverStoreProps): PopoverStore;
27
10
  export interface PopoverStoreState extends DialogStoreState {
28
11
  /**
29
12
  * The anchor element.
@@ -49,64 +32,10 @@ export interface PopoverStoreState extends DialogStoreState {
49
32
  */
50
33
  placement: Placement;
51
34
  /**
52
- * Whether the popover has `position: fixed` or not.
53
- * @default false
54
- */
55
- fixed: boolean;
56
- /**
57
- * The distance between the popover and the anchor element. By default, it's 0
58
- * plus half of the arrow offset, if it exists.
35
+ * A symbol that's used to recompute the popover position when the `render`
36
+ * method is called.
59
37
  */
60
- gutter: number | undefined;
61
- /**
62
- * The skidding of the popover along the anchor element.
63
- * @default 0
64
- */
65
- shift: number;
66
- /**
67
- * Controls the behavior of the popover when it overflows the viewport:
68
- * - If a `boolean`, specifies whether the popover should flip to the
69
- * opposite side when it overflows.
70
- * - If a `string`, indicates the preferred fallback placements when it
71
- * overflows. The placements must be spaced-delimited, e.g. "top left".
72
- * @default true
73
- */
74
- flip: boolean | string;
75
- /**
76
- * Whether the popover should slide when it overflows.
77
- * @default true
78
- */
79
- slide: boolean;
80
- /**
81
- * Whether the popover can overlap the anchor element when it overflows.
82
- * @default false
83
- */
84
- overlap: boolean;
85
- /**
86
- * Whether the popover should have the same width as the anchor element. This
87
- * will be exposed to CSS as `--popover-anchor-width`.
88
- * @default false
89
- */
90
- sameWidth: boolean;
91
- /**
92
- * Whether the popover should fit the viewport. If this is set to true, the
93
- * popover wrapper will have `maxWidth` and `maxHeight` set to the viewport
94
- * size. This will be exposed to CSS as `--popover-available-width` and
95
- * `--popover-available-height`.
96
- * @default false
97
- */
98
- fitViewport: boolean;
99
- /**
100
- * The minimum padding between the arrow and the popover corner.
101
- * @default 4
102
- */
103
- arrowPadding: number;
104
- /**
105
- * The minimum padding between the popover and the viewport edge. This will be
106
- * exposed to CSS as `--popover-overflow-padding`.
107
- * @default 8
108
- */
109
- overflowPadding: number;
38
+ rendered: symbol;
110
39
  }
111
40
  export interface PopoverStoreFunctions extends DialogStoreFunctions {
112
41
  /**
@@ -122,23 +51,13 @@ export interface PopoverStoreFunctions extends DialogStoreFunctions {
122
51
  */
123
52
  setArrowElement: SetState<PopoverStoreState["arrowElement"]>;
124
53
  /**
125
- * Function that returns the anchor element's DOMRect. If this is explicitly
126
- * passed, it will override the anchor `getBoundingClientRect` method.
127
- * @param anchor The anchor element.
128
- */
129
- getAnchorRect?: (anchor: HTMLElement | null) => AnchorRect | null;
130
- /**
131
- * A function that will be called when the popover needs to calculate its
132
- * styles. It will override the internal behavior.
133
- */
134
- renderCallback?: (props: PopoverStoreRenderCallbackProps) => void | (() => void);
135
- /**
136
- * A function that can be used to recompute the popover styles. This is useful
137
- * when the popover anchor changes in a way that affects the popover position.
54
+ * A function that can be used to recompute the popover position. This is
55
+ * useful when the popover anchor changes in a way that affects the popover
56
+ * position.
138
57
  */
139
58
  render: () => void;
140
59
  }
141
- export interface PopoverStoreOptions extends StoreOptions<PopoverStoreState, "placement" | "fixed" | "gutter" | "shift" | "flip" | "slide" | "overlap" | "sameWidth" | "fitViewport" | "arrowPadding" | "overflowPadding">, Partial<Pick<PopoverStoreFunctions, "getAnchorRect" | "renderCallback">>, DialogStoreOptions {
60
+ export interface PopoverStoreOptions extends StoreOptions<PopoverStoreState, "placement">, DialogStoreOptions {
142
61
  /**
143
62
  * A reference to another popover store that's controlling another popover to
144
63
  * keep them in sync.
@@ -1,40 +1,41 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _W5IHD6VGcjs = require('../__chunks/W5IHD6VG.cjs');
4
- require('../__chunks/4DQ3OTE7.cjs');
3
+ var _EUJ6NNA6cjs = require('../__chunks/EUJ6NNA6.cjs');
4
+ require('../__chunks/FXEBKN6G.cjs');
5
5
 
6
6
 
7
- var _ZPOXPO2Lcjs = require('../__chunks/ZPOXPO2L.cjs');
7
+ var _6SPJEESBcjs = require('../__chunks/6SPJEESB.cjs');
8
8
 
9
9
 
10
- var _QNEPGQLLcjs = require('../__chunks/QNEPGQLL.cjs');
11
- require('../__chunks/OFNGELMA.cjs');
10
+ var _M6ZA7XUPcjs = require('../__chunks/M6ZA7XUP.cjs');
11
+ require('../__chunks/ZNW4LSWU.cjs');
12
12
  require('../__chunks/GDZQUFNP.cjs');
13
13
 
14
+
15
+
16
+
17
+ var _6455U47Tcjs = require('../__chunks/6455U47T.cjs');
18
+
14
19
  // src/radio/radio-store.ts
15
- function createRadioStore({
16
- ...props
17
- } = {}) {
18
- const syncState = _optionalChain([props, 'access', _ => _.store, 'optionalAccess', _2 => _2.getState, 'call', _3 => _3()]);
19
- const composite = _W5IHD6VGcjs.createCompositeStore.call(void 0, {
20
- ...props,
21
- focusLoop: _QNEPGQLLcjs.defaultValue.call(void 0, props.focusLoop, _optionalChain([syncState, 'optionalAccess', _4 => _4.focusLoop]), true)
22
- });
23
- const initialState = {
24
- ...composite.getState(),
25
- value: _QNEPGQLLcjs.defaultValue.call(void 0,
20
+ function createRadioStore(_a = {}) {
21
+ var props = _6455U47Tcjs.__objRest.call(void 0, _a, []);
22
+ var _a2;
23
+ const syncState = (_a2 = props.store) == null ? void 0 : _a2.getState();
24
+ const composite = _EUJ6NNA6cjs.createCompositeStore.call(void 0, _6455U47Tcjs.__spreadProps.call(void 0, _6455U47Tcjs.__spreadValues.call(void 0, {}, props), {
25
+ focusLoop: _M6ZA7XUPcjs.defaultValue.call(void 0, props.focusLoop, syncState == null ? void 0 : syncState.focusLoop, true)
26
+ }));
27
+ const initialState = _6455U47Tcjs.__spreadProps.call(void 0, _6455U47Tcjs.__spreadValues.call(void 0, {}, composite.getState()), {
28
+ value: _M6ZA7XUPcjs.defaultValue.call(void 0,
26
29
  props.value,
27
- _optionalChain([syncState, 'optionalAccess', _5 => _5.value]),
30
+ syncState == null ? void 0 : syncState.value,
28
31
  props.defaultValue,
29
32
  null
30
33
  )
31
- };
32
- const radio = _ZPOXPO2Lcjs.createStore.call(void 0, initialState, composite, props.store);
33
- return {
34
- ...composite,
35
- ...radio,
34
+ });
35
+ const radio = _6SPJEESBcjs.createStore.call(void 0, initialState, composite, props.store);
36
+ return _6455U47Tcjs.__spreadProps.call(void 0, _6455U47Tcjs.__spreadValues.call(void 0, _6455U47Tcjs.__spreadValues.call(void 0, {}, composite), radio), {
36
37
  setValue: (value) => radio.setState("value", value)
37
- };
38
+ });
38
39
  }
39
40
 
40
41