@ariakit/components 0.1.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 (115) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/dist/checkbox/checkbox-store.d.ts +47 -0
  3. package/dist/checkbox/checkbox-store.d.ts.map +1 -0
  4. package/dist/checkbox/checkbox-store.js +16 -0
  5. package/dist/checkbox/checkbox-store.js.map +1 -0
  6. package/dist/collection/collection-store.d.ts +2 -0
  7. package/dist/collection/collection-store.js +132 -0
  8. package/dist/collection/collection-store.js.map +1 -0
  9. package/dist/collection-store-yNe83BiS.d.ts +81 -0
  10. package/dist/collection-store-yNe83BiS.d.ts.map +1 -0
  11. package/dist/combobox/combobox-store.d.ts +150 -0
  12. package/dist/combobox/combobox-store.d.ts.map +1 -0
  13. package/dist/combobox/combobox-store.js +83 -0
  14. package/dist/combobox/combobox-store.js.map +1 -0
  15. package/dist/composite/composite-overflow-store.d.ts +16 -0
  16. package/dist/composite/composite-overflow-store.d.ts.map +1 -0
  17. package/dist/composite/composite-overflow-store.js +12 -0
  18. package/dist/composite/composite-overflow-store.js.map +1 -0
  19. package/dist/composite/composite-store.d.ts +2 -0
  20. package/dist/composite/composite-store.js +167 -0
  21. package/dist/composite/composite-store.js.map +1 -0
  22. package/dist/composite-store-B-iDEtZZ.d.ts +331 -0
  23. package/dist/composite-store-B-iDEtZZ.d.ts.map +1 -0
  24. package/dist/dialog/dialog-store.d.ts +2 -0
  25. package/dist/dialog/dialog-store.js +12 -0
  26. package/dist/dialog/dialog-store.js.map +1 -0
  27. package/dist/dialog-store-BOLvw2IX.d.ts +16 -0
  28. package/dist/dialog-store-BOLvw2IX.d.ts.map +1 -0
  29. package/dist/disclosure/disclosure-store.d.ts +2 -0
  30. package/dist/disclosure/disclosure-store.js +47 -0
  31. package/dist/disclosure/disclosure-store.js.map +1 -0
  32. package/dist/disclosure-store-xKlQffR0.d.ts +142 -0
  33. package/dist/disclosure-store-xKlQffR0.d.ts.map +1 -0
  34. package/dist/form/form-store.d.ts +247 -0
  35. package/dist/form/form-store.d.ts.map +1 -0
  36. package/dist/form/form-store.js +211 -0
  37. package/dist/form/form-store.js.map +1 -0
  38. package/dist/form/types.d.ts +37 -0
  39. package/dist/form/types.d.ts.map +1 -0
  40. package/dist/form/types.js +0 -0
  41. package/dist/hovercard/hovercard-store.d.ts +65 -0
  42. package/dist/hovercard/hovercard-store.d.ts.map +1 -0
  43. package/dist/hovercard/hovercard-store.js +31 -0
  44. package/dist/hovercard/hovercard-store.js.map +1 -0
  45. package/dist/index.d.ts +5 -0
  46. package/dist/index.d.ts.map +1 -0
  47. package/dist/index.js +6 -0
  48. package/dist/index.js.map +1 -0
  49. package/dist/menu/menu-bar-store.d.ts +16 -0
  50. package/dist/menu/menu-bar-store.d.ts.map +1 -0
  51. package/dist/menu/menu-bar-store.js +12 -0
  52. package/dist/menu/menu-bar-store.js.map +1 -0
  53. package/dist/menu/menu-store.d.ts +100 -0
  54. package/dist/menu/menu-store.d.ts.map +1 -0
  55. package/dist/menu/menu-store.js +74 -0
  56. package/dist/menu/menu-store.js.map +1 -0
  57. package/dist/menubar/menubar-store.d.ts +2 -0
  58. package/dist/menubar/menubar-store.js +24 -0
  59. package/dist/menubar/menubar-store.js.map +1 -0
  60. package/dist/menubar-store-CD3YDYfW.d.ts +16 -0
  61. package/dist/menubar-store-CD3YDYfW.d.ts.map +1 -0
  62. package/dist/popover/popover-store.d.ts +2 -0
  63. package/dist/popover/popover-store.js +44 -0
  64. package/dist/popover/popover-store.js.map +1 -0
  65. package/dist/popover-store-DoCiTmUQ.d.ts +106 -0
  66. package/dist/popover-store-DoCiTmUQ.d.ts.map +1 -0
  67. package/dist/radio/radio-store.d.ts +42 -0
  68. package/dist/radio/radio-store.d.ts.map +1 -0
  69. package/dist/radio/radio-store.js +27 -0
  70. package/dist/radio/radio-store.js.map +1 -0
  71. package/dist/select/select-store.d.ts +116 -0
  72. package/dist/select/select-store.d.ts.map +1 -0
  73. package/dist/select/select-store.js +93 -0
  74. package/dist/select/select-store.js.map +1 -0
  75. package/dist/tab/tab-store.d.ts +127 -0
  76. package/dist/tab/tab-store.d.ts.map +1 -0
  77. package/dist/tab/tab-store.js +107 -0
  78. package/dist/tab/tab-store.js.map +1 -0
  79. package/dist/tag/tag-store.d.ts +2 -0
  80. package/dist/tag/tag-store.js +60 -0
  81. package/dist/tag/tag-store.js.map +1 -0
  82. package/dist/tag-store-D47X5_zA.d.ts +83 -0
  83. package/dist/tag-store-D47X5_zA.d.ts.map +1 -0
  84. package/dist/toolbar/toolbar-store.d.ts +21 -0
  85. package/dist/toolbar/toolbar-store.d.ts.map +1 -0
  86. package/dist/toolbar/toolbar-store.js +18 -0
  87. package/dist/toolbar/toolbar-store.js.map +1 -0
  88. package/dist/tooltip/tooltip-store.d.ts +35 -0
  89. package/dist/tooltip/tooltip-store.d.ts.map +1 -0
  90. package/dist/tooltip/tooltip-store.js +29 -0
  91. package/dist/tooltip/tooltip-store.js.map +1 -0
  92. package/license +21 -0
  93. package/package.json +121 -0
  94. package/readme.md +19 -0
  95. package/src/checkbox/checkbox-store.ts +93 -0
  96. package/src/collection/collection-store.ts +301 -0
  97. package/src/combobox/combobox-store.ts +382 -0
  98. package/src/composite/composite-overflow-store.ts +30 -0
  99. package/src/composite/composite-store.ts +711 -0
  100. package/src/dialog/dialog-store.ts +26 -0
  101. package/src/disclosure/disclosure-store.ts +226 -0
  102. package/src/form/form-store.ts +608 -0
  103. package/src/form/types.ts +44 -0
  104. package/src/hovercard/hovercard-store.ts +112 -0
  105. package/src/index.ts +1 -0
  106. package/src/menu/menu-bar-store.ts +28 -0
  107. package/src/menu/menu-store.ts +263 -0
  108. package/src/menubar/menubar-store.ts +51 -0
  109. package/src/popover/popover-store.ts +170 -0
  110. package/src/radio/radio-store.ts +80 -0
  111. package/src/select/select-store.ts +323 -0
  112. package/src/tab/tab-store.ts +330 -0
  113. package/src/tag/tag-store.ts +170 -0
  114. package/src/toolbar/toolbar-store.ts +47 -0
  115. package/src/tooltip/tooltip-store.ts +93 -0
@@ -0,0 +1,211 @@
1
+ import { createCollectionStore } from "../collection/collection-store.js";
2
+ import { createStore, init, setup, sync, throwOnConflictingProps } from "@ariakit/store";
3
+ import { applyState, defaultValue, isInteger, isObject } from "@ariakit/utils";
4
+ //#region src/form/form-store.ts
5
+ function nextFrame() {
6
+ return new Promise((resolve) => requestAnimationFrame(() => resolve()));
7
+ }
8
+ function hasMessages(object) {
9
+ return Object.keys(object).some((key) => {
10
+ if (isObject(object[key])) return hasMessages(object[key]);
11
+ return !!object[key];
12
+ });
13
+ }
14
+ function get(values, path, defaultValue) {
15
+ const [key, ...rest] = Array.isArray(path) ? path : String(path).split(".");
16
+ if (key == null || !values) return defaultValue;
17
+ if (!rest.length) return values[key] ?? defaultValue;
18
+ return get(values[key], rest, defaultValue);
19
+ }
20
+ function getOrCreateNested(nestedValues, nextKey) {
21
+ if (Array.isArray(nestedValues) || isObject(nestedValues)) return nestedValues;
22
+ return isInteger(nextKey) ? [] : {};
23
+ }
24
+ function set(values, path, value) {
25
+ const [k, ...rest] = Array.isArray(path) ? path : String(path).split(".");
26
+ if (k == null) return values;
27
+ const key = k;
28
+ const isIntegerKey = isInteger(key);
29
+ const nestedValues = (isIntegerKey ? values || [] : values || {})[key];
30
+ const nextKey = rest[0];
31
+ const result = rest.length && nextKey != null ? set(getOrCreateNested(nestedValues, nextKey), rest, value) : value;
32
+ if (isIntegerKey) {
33
+ const index = Number(key);
34
+ if (values && Array.isArray(values)) {
35
+ const copy = [...values];
36
+ copy[index] = result;
37
+ return copy;
38
+ }
39
+ const nextValues = [];
40
+ nextValues[index] = result;
41
+ return nextValues;
42
+ }
43
+ return Object.assign({}, values, { [key]: result });
44
+ }
45
+ function setAll(values, value) {
46
+ const result = {};
47
+ const keys = Object.keys(values);
48
+ for (const key of keys) {
49
+ const currentValue = values[key];
50
+ if (Array.isArray(currentValue)) result[key] = currentValue.map((v) => {
51
+ if (isObject(v)) return setAll(v, value);
52
+ return value;
53
+ });
54
+ else if (isObject(currentValue)) result[key] = setAll(currentValue, value);
55
+ else result[key] = value;
56
+ }
57
+ return result;
58
+ }
59
+ function getNameHandler(cache, prevKeys = []) {
60
+ return { get(target, key) {
61
+ if ([
62
+ "toString",
63
+ "valueOf",
64
+ Symbol.toPrimitive
65
+ ].includes(key)) return () => prevKeys.join(".");
66
+ const nextKeys = [...prevKeys, key];
67
+ const nextKey = nextKeys.join(".");
68
+ if (cache[nextKey]) return cache[nextKey];
69
+ const nextProxy = new Proxy(target, getNameHandler(cache, nextKeys));
70
+ cache[nextKey] = nextProxy;
71
+ return nextProxy;
72
+ } };
73
+ }
74
+ function getStoreCallbacks(store) {
75
+ return store?.__unstableCallbacks;
76
+ }
77
+ function createNames() {
78
+ return new Proxy(Object.create(null), getNameHandler(Object.create(null)));
79
+ }
80
+ function createFormStore(props = {}) {
81
+ throwOnConflictingProps(props, props.store);
82
+ const syncState = props.store?.getState();
83
+ const collection = createCollectionStore(props);
84
+ const values = defaultValue(props.values, syncState?.values, props.defaultValues, {});
85
+ const errors = defaultValue(props.errors, syncState?.errors, props.defaultErrors, {});
86
+ const touched = defaultValue(props.touched, syncState?.touched, props.defaultTouched, {});
87
+ const form = createStore({
88
+ ...collection.getState(),
89
+ values,
90
+ errors,
91
+ touched,
92
+ validating: defaultValue(syncState?.validating, false),
93
+ submitting: defaultValue(syncState?.submitting, false),
94
+ submitSucceed: defaultValue(syncState?.submitSucceed, 0),
95
+ submitFailed: defaultValue(syncState?.submitFailed, 0),
96
+ valid: !hasMessages(errors)
97
+ }, collection, props.store);
98
+ const syncCallbacks = getStoreCallbacks(props.store);
99
+ const syncCallbacksState = syncCallbacks?.getState();
100
+ const callbacks = createStore({
101
+ validate: syncCallbacksState?.validate || [],
102
+ submit: syncCallbacksState?.submit || []
103
+ }, syncCallbacks);
104
+ setup(form, () => init(callbacks));
105
+ setup(form, () => sync(form, ["validating", "errors"], (state) => {
106
+ if (state.validating) return;
107
+ form.setState("valid", !hasMessages(state.errors));
108
+ }));
109
+ const validate = async () => {
110
+ form.setState("validating", true);
111
+ form.setState("errors", {});
112
+ const validateCallbacks = callbacks.getState().validate;
113
+ try {
114
+ for (const callback of validateCallbacks) await callback(form.getState());
115
+ await nextFrame();
116
+ return !hasMessages(form.getState().errors);
117
+ } finally {
118
+ form.setState("validating", false);
119
+ }
120
+ };
121
+ return {
122
+ ...collection,
123
+ ...form,
124
+ names: createNames(),
125
+ setValues: (values) => form.setState("values", values),
126
+ getValue: (name) => get(form.getState().values, name),
127
+ setValue: (name, value) => form.setState("values", (values) => {
128
+ const prevValue = get(values, name);
129
+ const nextValue = applyState(value, prevValue);
130
+ if (nextValue === prevValue) return values;
131
+ return set(values, name, nextValue);
132
+ }),
133
+ pushValue: (name, value) => form.setState("values", (values) => {
134
+ return set(values, name, [...get(values, name, []), value]);
135
+ }),
136
+ removeValue: (name, index) => form.setState("values", (values) => {
137
+ const array = get(values, name, []);
138
+ return set(values, name, [
139
+ ...array.slice(0, index),
140
+ null,
141
+ ...array.slice(index + 1)
142
+ ]);
143
+ }),
144
+ setErrors: (errors) => form.setState("errors", errors),
145
+ getError: (name) => get(form.getState().errors, name),
146
+ setError: (name, error) => form.setState("errors", (errors) => {
147
+ const prevError = get(errors, name);
148
+ const nextError = applyState(error, prevError);
149
+ if (nextError === prevError) return errors;
150
+ return set(errors, name, nextError);
151
+ }),
152
+ setTouched: (touched) => form.setState("touched", touched),
153
+ getFieldTouched: (name) => !!get(form.getState().touched, name),
154
+ setFieldTouched: (name, value) => form.setState("touched", (touched) => {
155
+ const prevValue = get(touched, name);
156
+ const nextValue = applyState(value, prevValue);
157
+ if (nextValue === prevValue) return touched;
158
+ return set(touched, name, nextValue);
159
+ }),
160
+ onValidate: (callback) => {
161
+ callbacks.setState("validate", (callbacks) => [...callbacks, callback]);
162
+ return () => {
163
+ callbacks.setState("validate", (callbacks) => callbacks.filter((c) => c !== callback));
164
+ };
165
+ },
166
+ validate,
167
+ onSubmit: (callback) => {
168
+ callbacks.setState("submit", (callbacks) => [...callbacks, callback]);
169
+ return () => {
170
+ callbacks.setState("submit", (callbacks) => callbacks.filter((c) => c !== callback));
171
+ };
172
+ },
173
+ submit: async () => {
174
+ form.setState("submitting", true);
175
+ form.setState("touched", setAll(form.getState().values, true));
176
+ try {
177
+ if (await validate()) {
178
+ const submitCallbacks = callbacks.getState().submit;
179
+ for (const callback of submitCallbacks) await callback(form.getState());
180
+ await nextFrame();
181
+ if (!hasMessages(form.getState().errors)) {
182
+ form.setState("submitSucceed", (count) => count + 1);
183
+ return true;
184
+ }
185
+ }
186
+ form.setState("submitFailed", (count) => count + 1);
187
+ return false;
188
+ } catch (error) {
189
+ form.setState("submitFailed", (count) => count + 1);
190
+ throw error;
191
+ } finally {
192
+ form.setState("submitting", false);
193
+ }
194
+ },
195
+ reset: () => {
196
+ form.setState("values", values);
197
+ form.setState("errors", errors);
198
+ form.setState("touched", touched);
199
+ form.setState("validating", false);
200
+ form.setState("submitting", false);
201
+ form.setState("submitSucceed", 0);
202
+ form.setState("submitFailed", 0);
203
+ form.setState("valid", !hasMessages(errors));
204
+ },
205
+ __unstableCallbacks: callbacks
206
+ };
207
+ }
208
+ //#endregion
209
+ export { createFormStore, get, hasMessages };
210
+
211
+ //# sourceMappingURL=form-store.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"form-store.js","names":[],"sources":["../../src/form/form-store.ts"],"sourcesContent":["import {\n createStore,\n init,\n setup,\n sync,\n throwOnConflictingProps,\n} from \"@ariakit/store\";\nimport type { Store, StoreOptions, StoreProps } from \"@ariakit/store\";\nimport { applyState, defaultValue, isInteger, isObject } from \"@ariakit/utils\";\nimport type {\n AnyObject,\n PickRequired,\n SetState,\n SetStateAction,\n} from \"@ariakit/utils\";\nimport type {\n CollectionStoreFunctions,\n CollectionStoreItem,\n CollectionStoreOptions,\n CollectionStoreState,\n} from \"../collection/collection-store.ts\";\nimport { createCollectionStore } from \"../collection/collection-store.ts\";\nimport type { DeepMap, DeepPartial, Names, StringLike } from \"./types.ts\";\n\ntype ErrorMessage = string | undefined | null;\n\nfunction nextFrame() {\n return new Promise<void>((resolve) => requestAnimationFrame(() => resolve()));\n}\n\nexport function hasMessages(object: FormStoreValues): boolean {\n return Object.keys(object).some((key) => {\n if (isObject(object[key])) {\n return hasMessages(object[key]);\n }\n return !!object[key];\n });\n}\n\nexport function get<T>(\n values: FormStoreValues,\n path: StringLike | string[],\n defaultValue?: T,\n): T {\n const [key, ...rest] = Array.isArray(path) ? path : String(path).split(\".\");\n if (key == null || !values) {\n return defaultValue as T;\n }\n if (!rest.length) {\n return values[key] ?? defaultValue;\n }\n return get(values[key], rest, defaultValue);\n}\n\n// Returns the existing nested value if it is an array or object, otherwise\n// creates a new container based on whether the next key is an integer.\nfunction getOrCreateNested(nestedValues: unknown, nextKey: string) {\n if (Array.isArray(nestedValues) || isObject(nestedValues)) {\n return nestedValues;\n }\n return isInteger(nextKey) ? [] : {};\n}\n\nfunction set<T extends FormStoreValues | unknown[]>(\n values: T,\n path: StringLike | string[],\n value: unknown,\n): T {\n const [k, ...rest] = Array.isArray(path) ? path : String(path).split(\".\");\n if (k == null) return values;\n const key = k as keyof T;\n const isIntegerKey = isInteger(key);\n const nextValues = isIntegerKey ? values || [] : values || {};\n const nestedValues = nextValues[key];\n const nextKey = rest[0];\n const result =\n rest.length && nextKey != null\n ? set(getOrCreateNested(nestedValues, nextKey), rest, value)\n : value;\n if (isIntegerKey) {\n const index = Number(key);\n if (values && Array.isArray(values)) {\n const copy = [...values];\n copy[index] = result;\n return copy as T;\n }\n const nextValues = [] as unknown as T;\n nextValues[index as keyof T] = result as T[keyof T];\n return nextValues;\n }\n return Object.assign({}, values, { [key]: result });\n}\n\nfunction setAll<T extends FormStoreValues, V>(values: T, value: V) {\n const result = {} as FormStoreValues;\n const keys = Object.keys(values);\n for (const key of keys) {\n const currentValue = values[key];\n if (Array.isArray(currentValue)) {\n result[key] = currentValue.map((v) => {\n if (isObject(v)) {\n return setAll(v, value);\n }\n return value;\n });\n } else if (isObject(currentValue)) {\n result[key] = setAll(currentValue, value);\n } else {\n result[key] = value;\n }\n }\n return result as DeepMap<T, V>;\n}\n\nfunction getNameHandler(\n cache: FormStoreValues,\n prevKeys: Array<string | symbol> = [],\n) {\n const handler: ProxyHandler<FormStoreValues> = {\n get(target, key) {\n if ([\"toString\", \"valueOf\", Symbol.toPrimitive].includes(key)) {\n return () => prevKeys.join(\".\");\n }\n const nextKeys = [...prevKeys, key];\n const nextKey = nextKeys.join(\".\");\n if (cache[nextKey]) {\n return cache[nextKey];\n }\n const nextProxy = new Proxy(target, getNameHandler(cache, nextKeys));\n cache[nextKey] = nextProxy;\n return nextProxy;\n },\n };\n return handler;\n}\n\nfunction getStoreCallbacks(\n store?: Store & {\n __unstableCallbacks?: Store<{\n validate: FormStoreCallback[];\n submit: FormStoreCallback[];\n }>;\n },\n) {\n return store?.__unstableCallbacks;\n}\n\nfunction createNames() {\n const cache = Object.create(null);\n return new Proxy(Object.create(null), getNameHandler(cache));\n}\n\n/**\n * Creates a form store.\n */\nexport function createFormStore<T extends FormStoreValues = FormStoreValues>(\n props: PickRequired<\n FormStoreProps<T>,\n | \"values\"\n | \"defaultValues\"\n | \"errors\"\n | \"defaultErrors\"\n | \"touched\"\n | \"defaultTouched\"\n >,\n): FormStore<T>;\n\nexport function createFormStore(props: FormStoreProps): FormStore;\n\nexport function createFormStore(props: FormStoreProps = {}): FormStore {\n throwOnConflictingProps(props, props.store);\n\n const syncState = props.store?.getState();\n const collection = createCollectionStore(props);\n\n const values = defaultValue(\n props.values,\n syncState?.values,\n props.defaultValues,\n {},\n );\n\n const errors = defaultValue(\n props.errors,\n syncState?.errors,\n props.defaultErrors,\n {},\n );\n\n const touched = defaultValue(\n props.touched,\n syncState?.touched,\n props.defaultTouched,\n {},\n );\n\n const initialState: FormStoreState = {\n ...collection.getState(),\n values,\n errors,\n touched,\n validating: defaultValue(syncState?.validating, false),\n submitting: defaultValue(syncState?.submitting, false),\n submitSucceed: defaultValue(syncState?.submitSucceed, 0),\n submitFailed: defaultValue(syncState?.submitFailed, 0),\n valid: !hasMessages(errors),\n };\n const form = createStore(initialState, collection, props.store);\n\n const syncCallbacks = getStoreCallbacks(props.store);\n const syncCallbacksState = syncCallbacks?.getState();\n\n const callbacksInitialState = {\n validate: syncCallbacksState?.validate || [],\n submit: syncCallbacksState?.submit || [],\n };\n\n const callbacks = createStore(callbacksInitialState, syncCallbacks);\n\n setup(form, () => init(callbacks));\n\n setup(form, () =>\n sync(form, [\"validating\", \"errors\"], (state) => {\n if (state.validating) return;\n form.setState(\"valid\", !hasMessages(state.errors));\n }),\n );\n\n const validate = async () => {\n form.setState(\"validating\", true);\n form.setState(\"errors\", {});\n const validateCallbacks = callbacks.getState().validate;\n try {\n // Run all the validation callbacks sequentially so they run in a\n // predictable order. See https://github.com/ariakit/ariakit/issues/2282\n for (const callback of validateCallbacks) {\n await callback(form.getState());\n }\n // Wait for the next frame to allow the errors to be set on the state.\n await nextFrame();\n return !hasMessages(form.getState().errors);\n } finally {\n form.setState(\"validating\", false);\n }\n };\n\n return {\n ...collection,\n ...form,\n names: createNames(),\n\n setValues: (values) => form.setState(\"values\", values),\n getValue: (name) => get(form.getState().values, name),\n setValue: (name, value) =>\n form.setState(\"values\", (values) => {\n const prevValue = get(values, name);\n const nextValue = applyState(value, prevValue);\n if (nextValue === prevValue) return values;\n return set(values, name, nextValue);\n }),\n pushValue: (name, value) =>\n form.setState(\"values\", (values) => {\n const array = get(values, name, [] as unknown[]);\n return set(values, name, [...array, value]);\n }),\n removeValue: (name, index) =>\n form.setState(\"values\", (values) => {\n const array = get(values, name, [] as unknown[]);\n return set(values, name, [\n ...array.slice(0, index),\n null,\n ...array.slice(index + 1),\n ]);\n }),\n\n setErrors: (errors) => form.setState(\"errors\", errors),\n getError: (name) => get(form.getState().errors, name),\n setError: (name, error) =>\n form.setState(\"errors\", (errors) => {\n const prevError = get(errors, name);\n const nextError = applyState(error, prevError);\n if (nextError === prevError) return errors;\n return set(errors, name, nextError);\n }),\n\n setTouched: (touched) => form.setState(\"touched\", touched),\n getFieldTouched: (name) => !!get(form.getState().touched, name),\n setFieldTouched: (name, value) =>\n form.setState(\"touched\", (touched) => {\n const prevValue = get(touched, name);\n const nextValue = applyState(value, prevValue);\n if (nextValue === prevValue) return touched;\n return set(touched, name, nextValue);\n }),\n\n onValidate: (callback) => {\n callbacks.setState(\"validate\", (callbacks) => [...callbacks, callback]);\n return () => {\n callbacks.setState(\"validate\", (callbacks) =>\n callbacks.filter((c) => c !== callback),\n );\n };\n },\n validate,\n\n onSubmit: (callback) => {\n callbacks.setState(\"submit\", (callbacks) => [...callbacks, callback]);\n return () => {\n callbacks.setState(\"submit\", (callbacks) =>\n callbacks.filter((c) => c !== callback),\n );\n };\n },\n submit: async () => {\n form.setState(\"submitting\", true);\n form.setState(\"touched\", setAll(form.getState().values, true));\n try {\n if (await validate()) {\n const submitCallbacks = callbacks.getState().submit;\n // Run all the submit callbacks sequentially so they run in a\n // predictable order. See\n // https://github.com/ariakit/ariakit/issues/2282\n for (const callback of submitCallbacks) {\n await callback(form.getState());\n }\n // Wait for the next frame to allow the errors to be set on the state.\n await nextFrame();\n if (!hasMessages(form.getState().errors)) {\n form.setState(\"submitSucceed\", (count) => count + 1);\n return true;\n }\n }\n form.setState(\"submitFailed\", (count) => count + 1);\n return false;\n } catch (error) {\n form.setState(\"submitFailed\", (count) => count + 1);\n throw error;\n } finally {\n form.setState(\"submitting\", false);\n }\n },\n\n reset: () => {\n form.setState(\"values\", values);\n form.setState(\"errors\", errors);\n form.setState(\"touched\", touched);\n form.setState(\"validating\", false);\n form.setState(\"submitting\", false);\n form.setState(\"submitSucceed\", 0);\n form.setState(\"submitFailed\", 0);\n form.setState(\"valid\", !hasMessages(errors));\n },\n\n // @ts-expect-error Internal\n __unstableCallbacks: callbacks,\n };\n}\n\nexport type FormStoreCallback<T extends FormStoreState = FormStoreState> = (\n state: T,\n) => void | Promise<void>;\n\nexport type FormStoreValues = AnyObject;\n\nexport interface FormStoreItem extends CollectionStoreItem {\n type: \"field\" | \"label\" | \"description\" | \"error\" | \"button\";\n name: string;\n}\n\nexport interface FormStoreState<\n T extends FormStoreValues = FormStoreValues,\n> extends CollectionStoreState<FormStoreItem> {\n /**\n * Form values.\n *\n * Live examples:\n * - [FormRadio](https://ariakit.com/examples/form-radio)\n * - [FormSelect](https://ariakit.com/examples/form-select)\n * @default {}\n */\n values: T;\n /**\n * Form errors.\n */\n errors: DeepPartial<DeepMap<T, ErrorMessage>>;\n /**\n * The touched state of the form.\n */\n touched: DeepPartial<DeepMap<T, boolean>>;\n /**\n * Whether the form is valid.\n */\n valid: boolean;\n /**\n * Whether the form is validating.\n */\n validating: boolean;\n /**\n * Whether the form is submitting.\n */\n submitting: boolean;\n /**\n * The number of times\n * [`submit`](https://ariakit.com/reference/use-form-store#submit) has been\n * called with a successful response.\n */\n submitSucceed: number;\n /**\n * The number of times\n * [`submit`](https://ariakit.com/reference/use-form-store#submit) has been\n * called with an error response.\n */\n submitFailed: number;\n}\n\nexport interface FormStoreFunctions<\n T extends FormStoreValues = FormStoreValues,\n> extends CollectionStoreFunctions<FormStoreItem> {\n /**\n * An object containing the names of the form fields for type safety.\n *\n * Live examples:\n * - [FormRadio](https://ariakit.com/examples/form-radio)\n * - [FormSelect](https://ariakit.com/examples/form-select)\n * @example\n * store.names.name; // \"name\"\n * store.names.name.first; // \"name.first\"\n * store.names.name.last; // \"name.last\"\n */\n names: Names<T>;\n /**\n * Sets the [`values`](https://ariakit.com/reference/form-provider#values)\n * state.\n * @example\n * store.setValues({ name: \"John\" });\n * store.setValues((values) => ({ ...values, name: \"John\" }));\n */\n setValues: SetState<FormStoreState<T>[\"values\"]>;\n /**\n * Retrieves a field value.\n *\n * Live examples:\n * - [FormRadio](https://ariakit.com/examples/form-radio)\n * @example\n * const nameValue = store.getValue(\"name\");\n * // Can also use store.names for type-safety.\n * const emailValue = store.getValue(store.names.email);\n */\n // oxlint-disable-next-line no-unnecessary-type-parameters\n getValue: <T = any>(name: StringLike) => T;\n /**\n * Sets a field value.\n *\n * Live examples:\n * - [FormSelect](https://ariakit.com/examples/form-select)\n * @example\n * store.setValue(\"name\", \"John\");\n * store.setValue(\"name\", (value) => value + \" Doe\");\n * // Can also use store.names for type-safety.\n * store.setValue(store.names.name, \"John\");\n */\n setValue: <T>(name: StringLike, value: SetStateAction<T>) => void;\n /**\n * Pushes a value to an array field.\n * @example\n * store.pushValue(\"tags\", \"new tag\");\n * store.pushValue(\"tags\", { id: 1, name: \"new tag\" });\n * // Can also use store.names for type-safety.\n * store.pushValue(store.names.tags, \"new tag\");\n */\n // oxlint-disable-next-line no-unnecessary-type-parameters\n pushValue: <T>(name: StringLike, value: T) => void;\n /**\n * Removes a value from an array field.\n * @example\n * store.removeValue(\"tags\", 0);\n * store.removeValue(\"tags\", 1);\n * // Can also use store.names for type-safety.\n * store.removeValue(store.names.tags, 0);\n */\n removeValue: (name: StringLike, index: number) => void;\n /**\n * Sets the [`errors`](https://ariakit.com/reference/form-provider#errors)\n * state.\n * @example\n * store.setErrors({ name: \"Name is required\" });\n * store.setErrors((errors) => ({ ...errors, name: \"Name is required\" }));\n */\n setErrors: SetState<FormStoreState<T>[\"errors\"]>;\n /**\n * Retrieves a field error.\n * @example\n * const nameError = store.getError(\"name\");\n * // Can also use store.names for type-safety.\n * const emailError = store.getError(store.names.email);\n */\n getError: (name: StringLike) => ErrorMessage;\n /**\n * Sets a field error.\n *\n * Live examples:\n * - [FormRadio](https://ariakit.com/examples/form-radio)\n * @example\n * store.setError(\"name\", \"Name is required\");\n * store.setError(\"name\", (error) => error + \"!\");\n * // Can also use store.names for type-safety.\n * store.setError(store.names.name, \"Name is required\");\n */\n setError: (name: StringLike, error: SetStateAction<ErrorMessage>) => void;\n /**\n * Sets the [`touched`](https://ariakit.com/reference/form-provider#touched)\n * state.\n * @example\n * store.setTouched({ name: true });\n * store.setTouched((touched) => ({ ...touched, name: true }));\n */\n setTouched: SetState<FormStoreState<T>[\"touched\"]>;\n /**\n * Retrieves a field touched state.\n * @example\n * const nameTouched = store.getFieldTouched(\"name\");\n * // Can also use store.names for type-safety.\n * const emailTouched = store.getFieldTouched(store.names.email);\n */\n getFieldTouched: (name: StringLike) => boolean;\n /**\n * Sets a field touched state.\n * @example\n * store.setFieldTouched(\"name\", true);\n * store.setFieldTouched(\"name\", (value) => !value);\n * // Can also use store.names for type-safety.\n * store.setFieldTouched(store.names.name, true);\n */\n setFieldTouched: (name: StringLike, value: SetStateAction<boolean>) => void;\n /**\n * Function that accepts a callback that will be used to validate the form\n * when [`validate`](https://ariakit.com/reference/use-form-store#validate) is\n * called. It returns a cleanup function that will remove the callback.\n * @example\n * const cleanup = store.onValidate(async (state) => {\n * const errors = await api.validate(state.values);\n * if (errors) {\n * store.setErrors(errors);\n * }\n * });\n */\n onValidate: (callback: FormStoreCallback<FormStoreState<T>>) => () => void;\n /**\n * Function that accepts a callback that will be used to submit the form when\n * [`submit`](https://ariakit.com/reference/use-form-store#submit) is called.\n * It returns a cleanup function that will remove the callback.\n * @param callback The callback function.\n * @example\n * const cleanup = store.onSubmit(async (state) => {\n * try {\n * await api.submit(state.values);\n * } catch (errors) {\n * store.setErrors(errors);\n * }\n * });\n */\n onSubmit: (callback: FormStoreCallback<FormStoreState<T>>) => () => void;\n /**\n * Validates the form.\n * @example\n * if (await store.validate()) {\n * // Form is valid.\n * }\n */\n validate: () => Promise<boolean>;\n /**\n * Submits the form. This also triggers validation.\n * @example\n * if (await form.submit()) {\n * // Form is submitted.\n * }\n */\n submit: () => Promise<boolean>;\n /**\n * Resets the form to its default values.\n */\n reset: () => void;\n}\n\nexport interface FormStoreOptions<T extends FormStoreValues = FormStoreValues>\n extends\n CollectionStoreOptions<FormStoreItem>,\n StoreOptions<FormStoreState<T>, \"values\" | \"errors\" | \"touched\"> {\n /**\n * The default values of the form.\n * @default {}\n */\n defaultValues?: FormStoreState<T>[\"values\"];\n /**\n * The default errors of the form.\n */\n defaultErrors?: FormStoreState<T>[\"errors\"];\n /**\n * The default touched state of the form.\n */\n defaultTouched?: FormStoreState<T>[\"touched\"];\n}\n\nexport interface FormStoreProps<T extends FormStoreValues = FormStoreValues>\n extends FormStoreOptions<T>, StoreProps<FormStoreState<T>> {}\n\nexport interface FormStore<T extends FormStoreValues = FormStoreValues>\n extends FormStoreFunctions<T>, Store<FormStoreState<T>> {}\n"],"mappings":";;;;AA0BA,SAAS,YAAY;CACnB,OAAO,IAAI,SAAe,YAAY,4BAA4B,QAAQ,CAAC,CAAC;AAC9E;AAEA,SAAgB,YAAY,QAAkC;CAC5D,OAAO,OAAO,KAAK,MAAM,EAAE,MAAM,QAAQ;EACvC,IAAI,SAAS,OAAO,IAAI,GACtB,OAAO,YAAY,OAAO,IAAI;EAEhC,OAAO,CAAC,CAAC,OAAO;CAClB,CAAC;AACH;AAEA,SAAgB,IACd,QACA,MACA,cACG;CACH,MAAM,CAAC,KAAK,GAAG,QAAQ,MAAM,QAAQ,IAAI,IAAI,OAAO,OAAO,IAAI,EAAE,MAAM,GAAG;CAC1E,IAAI,OAAO,QAAQ,CAAC,QAClB,OAAO;CAET,IAAI,CAAC,KAAK,QACR,OAAO,OAAO,QAAQ;CAExB,OAAO,IAAI,OAAO,MAAM,MAAM,YAAY;AAC5C;AAIA,SAAS,kBAAkB,cAAuB,SAAiB;CACjE,IAAI,MAAM,QAAQ,YAAY,KAAK,SAAS,YAAY,GACtD,OAAO;CAET,OAAO,UAAU,OAAO,IAAI,CAAC,IAAI,CAAC;AACpC;AAEA,SAAS,IACP,QACA,MACA,OACG;CACH,MAAM,CAAC,GAAG,GAAG,QAAQ,MAAM,QAAQ,IAAI,IAAI,OAAO,OAAO,IAAI,EAAE,MAAM,GAAG;CACxE,IAAI,KAAK,MAAM,OAAO;CACtB,MAAM,MAAM;CACZ,MAAM,eAAe,UAAU,GAAG;CAElC,MAAM,gBADa,eAAe,UAAU,CAAC,IAAI,UAAU,CA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,SAAS,cAAc,KAAK;GACnC;EACF;EAEA,aAAa;GACX,KAAK,SAAS,UAAU,MAAM;GAC9B,KAAK,SAAS,UAAU,MAAM;GAC9B,KAAK,SAAS,WAAW,OAAO;GAChC,KAAK,SAAS,cAAc,KAAK;GACjC,KAAK,SAAS,cAAc,KAAK;GACjC,KAAK,SAAS,iBAAiB,CAAC;GAChC,KAAK,SAAS,gBAAgB,CAAC;GAC/B,KAAK,SAAS,SAAS,CAAC,YAAY,MAAM,CAAC;EAC7C;EAGA,qBAAqB;CACvB;AACF"}
@@ -0,0 +1,37 @@
1
+ import { AnyObject } from "@ariakit/utils";
2
+
3
+ //#region src/form/types.d.ts
4
+ /**
5
+ * An object or primitive value that can be converted to a string.
6
+ */
7
+ interface StringLike {
8
+ toString: () => string;
9
+ valueOf: () => string;
10
+ }
11
+ /**
12
+ * Maps through an object `T` or array and defines the leaf values to the given
13
+ * type `V`.
14
+ * @template T Object
15
+ * @template V Value
16
+ */
17
+ type DeepMap<T, V> = { [K in keyof T]: T[K] extends AnyObject ? DeepMap<T[K], V> : V };
18
+ /**
19
+ * Similar to `Partial<T>`, but recursively maps through the object and makes
20
+ * nested object properties optional.
21
+ * @template T Object
22
+ */
23
+ type DeepPartial<T> = { [K in keyof T]?: T[K] extends AnyObject ? DeepPartial<T[K]> : T[K] };
24
+ /**
25
+ * Maps through the values object `T` and defines all properties into a string
26
+ * like type. That is, a type that is an object that can contain other
27
+ * properties but can also be converted into a string with the path name.
28
+ * @template T Values object
29
+ */
30
+ type Names<T> = { [K in keyof T]: T[K] extends Array<infer U> ? U extends AnyObject ? {
31
+ [key: number]: Names<U>;
32
+ } & StringLike : {
33
+ [key: number]: U & StringLike;
34
+ } & StringLike : T[K] extends AnyObject ? Names<T[K]> : StringLike };
35
+ //#endregion
36
+ export { DeepMap, DeepPartial, Names, StringLike };
37
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","names":["AnyObject","StringLike","toString","valueOf","DeepMap","T","V","K","DeepPartial","Names","Array","U","key"],"sources":["../../src/form/types.d.ts"],"mappings":";;;;;AAIA;UAAiBC,UAAAA;EACbC,QAAAA;EACAC,OAAO;AAAA;AAQX;;;;;;AAAA,KAAYC,OAAAA,uBACIC,CAAAA,GAAIA,CAAAA,CAAEE,CAAAA,UAAWP,SAAAA,GAAYI,OAAAA,CAAQC,CAAAA,CAAEE,CAAAA,GAAID,CAAAA,IAAKA,CAAAA;;;;;;KAOpDE,WAAAA,oBACIH,CAAAA,IAAKA,CAAAA,CAAEE,CAAAA,UAAWP,SAAAA,GAAYQ,WAAAA,CAAYH,CAAAA,CAAEE,CAAAA,KAAMF,CAAAA,CAAEE,CAAAA;;;;;;;KAQxDE,KAAAA,oBACIJ,CAAAA,GAAIA,CAAAA,CAAEE,CAAAA,UAAWG,KAAAA,YAAiBC,CAAAA,SAAUX,SAAAA;EAAAA,CACnDY,GAAAA,WAAcH,KAAAA,CAAME,CAAAA;AAAAA,IACrBV,UAAAA;EAAAA,CACCW,GAAAA,WAAcD,CAAAA,GAAIV,UAAAA;AAAAA,IACnBA,UAAAA,GAAaI,CAAAA,CAAEE,CAAAA,UAAWP,SAAAA,GAAYS,KAAAA,CAAMJ,CAAAA,CAAEE,CAAAA,KAAMN,UAAAA"}
File without changes
@@ -0,0 +1,65 @@
1
+ import { a as PopoverStoreState, n as PopoverStoreFunctions, r as PopoverStoreOptions } from "../popover-store-DoCiTmUQ.js";
2
+ import { Store, StoreOptions, StoreProps } from "@ariakit/store";
3
+ import { SetState } from "@ariakit/utils";
4
+
5
+ //#region src/hovercard/hovercard-store.d.ts
6
+ /**
7
+ * Creates a hovercard store.
8
+ */
9
+ declare function createHovercardStore(props?: HovercardStoreProps): HovercardStore;
10
+ interface HovercardStoreState extends PopoverStoreState {
11
+ /** @default "bottom" */
12
+ placement: PopoverStoreState["placement"];
13
+ /**
14
+ * The amount of time in milliseconds to wait before showing and hiding the
15
+ * popup. To control the delay for showing and hiding separately, use
16
+ * [`showTimeout`](https://ariakit.com/reference/hovercard-provider#showtimeout)
17
+ * and
18
+ * [`hideTimeout`](https://ariakit.com/reference/hovercard-provider#hidetimeout).
19
+ * @default 500
20
+ */
21
+ timeout: number;
22
+ /**
23
+ * The amount of time in milliseconds to wait before _showing_ the popup. It
24
+ * defaults to the value passed to
25
+ * [`timeout`](https://ariakit.com/reference/hovercard-provider#timeout).
26
+ *
27
+ * Live examples:
28
+ * - [Navigation Menubar](https://ariakit.com/examples/menubar-navigation)
29
+ * - [Submenu with
30
+ * Combobox](https://ariakit.com/examples/menu-nested-combobox)
31
+ */
32
+ showTimeout?: number;
33
+ /**
34
+ * The amount of time in milliseconds to wait before _hiding_ the popup. It
35
+ * defaults to the value passed to
36
+ * [`timeout`](https://ariakit.com/reference/hovercard-provider#timeout).
37
+ *
38
+ * Live examples:
39
+ * - [Navigation Menubar](https://ariakit.com/examples/menubar-navigation)
40
+ * - [Tooltip with
41
+ * Motion](https://ariakit.com/examples/tooltip-framer-motion)
42
+ */
43
+ hideTimeout?: number;
44
+ /**
45
+ * Whether the popup or an element inside it should be focused when it is
46
+ * shown.
47
+ * @default false
48
+ */
49
+ autoFocusOnShow: boolean;
50
+ }
51
+ interface HovercardStoreFunctions extends PopoverStoreFunctions {
52
+ /**
53
+ * Sets the `autoFocusOnShow` state.
54
+ *
55
+ * Live examples:
56
+ * - [Sliding Menu](https://ariakit.com/examples/menu-slide)
57
+ */
58
+ setAutoFocusOnShow: SetState<HovercardStoreState["autoFocusOnShow"]>;
59
+ }
60
+ interface HovercardStoreOptions extends StoreOptions<HovercardStoreState, "placement" | "timeout" | "showTimeout" | "hideTimeout">, PopoverStoreOptions {}
61
+ interface HovercardStoreProps extends HovercardStoreOptions, StoreProps<HovercardStoreState> {}
62
+ interface HovercardStore extends HovercardStoreFunctions, Store<HovercardStoreState> {}
63
+ //#endregion
64
+ export { HovercardStore, HovercardStoreFunctions, HovercardStoreOptions, HovercardStoreProps, HovercardStoreState, createHovercardStore };
65
+ //# sourceMappingURL=hovercard-store.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hovercard-store.d.ts","names":["Store","StoreOptions","StoreProps","SetState","PopoverStoreFunctions","PopoverStoreOptions","PopoverStoreState","createHovercardStore","HovercardStoreProps","HovercardStore","props","HovercardStoreState","placement","timeout","showTimeout","hideTimeout","autoFocusOnShow","HovercardStoreFunctions","setAutoFocusOnShow","HovercardStoreOptions"],"sources":["../../src/hovercard/hovercard-store.d.ts"],"mappings":";;;;;;;AAMA;iBAAwBO,oBAAAA,CAAqBG,KAAAA,GAAQF,mBAAAA,GAAsBC,cAAc;AAAA,UACxEE,mBAAAA,SAA4BL,iBAAiB;EAD2B;EAGrFM,SAAAA,EAAWN,iBAAAA;EAH8BI;;;AAA4C;AACzF;;;;EAWIG,OAAAA;EATAD;;;;;;;AAqCe;AAEnB;;EAnBIE,WAAAA;EA0B6BH;;;;;;;;;;EAf7BI,WAAAA;EAiBaI;;;;;EAXbH,eAAAA;AAAAA;AAAAA,UAEaC,uBAAAA,SAAgCb,qBAAAA;EASFH;;;;AAA+G;AAE9J;EAJIiB,kBAAAA,EAAoBf,QAAAA,CAASQ,mBAAAA;AAAAA;AAAAA,UAEhBQ,qBAAAA,SAA8BlB,YAAAA,CAAaU,mBAAAA,4DAA+EN,mBAAAA;AAAAA,UAE1HG,mBAAAA,SAA4BW,qBAAAA,EAAuBjB,UAAAA,CAAWS,mBAAAA;AAAAA,UAE9DF,cAAAA,SAAuBQ,uBAAAA,EAAyBjB,KAAAA,CAAMW,mBAAAA"}
@@ -0,0 +1,31 @@
1
+ import { createPopoverStore } from "../popover/popover-store.js";
2
+ import { createStore } from "@ariakit/store";
3
+ import { defaultValue } from "@ariakit/utils";
4
+ //#region src/hovercard/hovercard-store.ts
5
+ /**
6
+ * Creates a hovercard store.
7
+ */
8
+ function createHovercardStore(props = {}) {
9
+ const syncState = props.store?.getState();
10
+ const popover = createPopoverStore({
11
+ ...props,
12
+ placement: defaultValue(props.placement, syncState?.placement, "bottom")
13
+ });
14
+ const timeout = defaultValue(props.timeout, syncState?.timeout, 500);
15
+ const hovercard = createStore({
16
+ ...popover.getState(),
17
+ timeout,
18
+ showTimeout: defaultValue(props.showTimeout, syncState?.showTimeout),
19
+ hideTimeout: defaultValue(props.hideTimeout, syncState?.hideTimeout),
20
+ autoFocusOnShow: defaultValue(syncState?.autoFocusOnShow, false)
21
+ }, popover, props.store);
22
+ return {
23
+ ...popover,
24
+ ...hovercard,
25
+ setAutoFocusOnShow: (value) => hovercard.setState("autoFocusOnShow", value)
26
+ };
27
+ }
28
+ //#endregion
29
+ export { createHovercardStore };
30
+
31
+ //# sourceMappingURL=hovercard-store.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hovercard-store.js","names":[],"sources":["../../src/hovercard/hovercard-store.ts"],"sourcesContent":["import { createStore } from \"@ariakit/store\";\nimport type { Store, StoreOptions, StoreProps } from \"@ariakit/store\";\nimport { defaultValue } from \"@ariakit/utils\";\nimport type { SetState } from \"@ariakit/utils\";\nimport type {\n PopoverStoreFunctions,\n PopoverStoreOptions,\n PopoverStoreState,\n} from \"../popover/popover-store.ts\";\nimport { createPopoverStore } from \"../popover/popover-store.ts\";\n\n/**\n * Creates a hovercard store.\n */\nexport function createHovercardStore(\n props: HovercardStoreProps = {},\n): HovercardStore {\n const syncState = props.store?.getState();\n\n const popover = createPopoverStore({\n ...props,\n placement: defaultValue(\n props.placement,\n syncState?.placement,\n \"bottom\" as const,\n ),\n });\n\n const timeout = defaultValue(props.timeout, syncState?.timeout, 500);\n\n const initialState: HovercardStoreState = {\n ...popover.getState(),\n timeout,\n showTimeout: defaultValue(props.showTimeout, syncState?.showTimeout),\n hideTimeout: defaultValue(props.hideTimeout, syncState?.hideTimeout),\n autoFocusOnShow: defaultValue(syncState?.autoFocusOnShow, false),\n };\n\n const hovercard = createStore(initialState, popover, props.store);\n\n return {\n ...popover,\n ...hovercard,\n setAutoFocusOnShow: (value) => hovercard.setState(\"autoFocusOnShow\", value),\n };\n}\n\nexport interface HovercardStoreState extends PopoverStoreState {\n /** @default \"bottom\" */\n placement: PopoverStoreState[\"placement\"];\n /**\n * The amount of time in milliseconds to wait before showing and hiding the\n * popup. To control the delay for showing and hiding separately, use\n * [`showTimeout`](https://ariakit.com/reference/hovercard-provider#showtimeout)\n * and\n * [`hideTimeout`](https://ariakit.com/reference/hovercard-provider#hidetimeout).\n * @default 500\n */\n timeout: number;\n /**\n * The amount of time in milliseconds to wait before _showing_ the popup. It\n * defaults to the value passed to\n * [`timeout`](https://ariakit.com/reference/hovercard-provider#timeout).\n *\n * Live examples:\n * - [Navigation Menubar](https://ariakit.com/examples/menubar-navigation)\n * - [Submenu with\n * Combobox](https://ariakit.com/examples/menu-nested-combobox)\n */\n showTimeout?: number;\n /**\n * The amount of time in milliseconds to wait before _hiding_ the popup. It\n * defaults to the value passed to\n * [`timeout`](https://ariakit.com/reference/hovercard-provider#timeout).\n *\n * Live examples:\n * - [Navigation Menubar](https://ariakit.com/examples/menubar-navigation)\n * - [Tooltip with\n * Motion](https://ariakit.com/examples/tooltip-framer-motion)\n */\n hideTimeout?: number;\n /**\n * Whether the popup or an element inside it should be focused when it is\n * shown.\n * @default false\n */\n autoFocusOnShow: boolean;\n}\n\nexport interface HovercardStoreFunctions extends PopoverStoreFunctions {\n /**\n * Sets the `autoFocusOnShow` state.\n *\n * Live examples:\n * - [Sliding Menu](https://ariakit.com/examples/menu-slide)\n */\n setAutoFocusOnShow: SetState<HovercardStoreState[\"autoFocusOnShow\"]>;\n}\n\nexport interface HovercardStoreOptions\n extends\n StoreOptions<\n HovercardStoreState,\n \"placement\" | \"timeout\" | \"showTimeout\" | \"hideTimeout\"\n >,\n PopoverStoreOptions {}\n\nexport interface HovercardStoreProps\n extends HovercardStoreOptions, StoreProps<HovercardStoreState> {}\n\nexport interface HovercardStore\n extends HovercardStoreFunctions, Store<HovercardStoreState> {}\n"],"mappings":";;;;;;;AAcA,SAAgB,qBACd,QAA6B,CAAC,GACd;CAChB,MAAM,YAAY,MAAM,OAAO,SAAS;CAExC,MAAM,UAAU,mBAAmB;EACjC,GAAG;EACH,WAAW,aACT,MAAM,WACN,WAAW,WACX,QACF;CACF,CAAC;CAED,MAAM,UAAU,aAAa,MAAM,SAAS,WAAW,SAAS,GAAG;CAUnE,MAAM,YAAY,YAAY;EAP5B,GAAG,QAAQ,SAAS;EACpB;EACA,aAAa,aAAa,MAAM,aAAa,WAAW,WAAW;EACnE,aAAa,aAAa,MAAM,aAAa,WAAW,WAAW;EACnE,iBAAiB,aAAa,WAAW,iBAAiB,KAAK;CAGxB,GAAG,SAAS,MAAM,KAAK;CAEhE,OAAO;EACL,GAAG;EACH,GAAG;EACH,qBAAqB,UAAU,UAAU,SAAS,mBAAmB,KAAK;CAC5E;AACF"}
@@ -0,0 +1,5 @@
1
+ //#region src/index.d.ts
2
+ declare const _default: {};
3
+ //#endregion
4
+ export { _default as default };
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","names":["_default","default"],"sources":["../src/index.d.ts"],"mappings":";cAAcA,QAAAA"}
package/dist/index.js ADDED
@@ -0,0 +1,6 @@
1
+ //#region src/index.ts
2
+ var src_default = {};
3
+ //#endregion
4
+ export { src_default as default };
5
+
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["export default {};\n"],"mappings":";AAAA,IAAA,cAAe,CAAC"}
@@ -0,0 +1,16 @@
1
+ import { a as MenubarStoreState, n as MenubarStoreFunctions, r as MenubarStoreOptions } from "../menubar-store-CD3YDYfW.js";
2
+ import { Store, StoreProps } from "@ariakit/store";
3
+
4
+ //#region src/menu/menu-bar-store.d.ts
5
+ /**
6
+ * Creates a menu bar store.
7
+ */
8
+ declare function createMenuBarStore(props?: MenuBarStoreProps): MenuBarStore;
9
+ interface MenuBarStoreState extends MenubarStoreState {}
10
+ interface MenuBarStoreFunctions extends MenubarStoreFunctions {}
11
+ interface MenuBarStoreOptions extends MenubarStoreOptions {}
12
+ interface MenuBarStoreProps extends MenuBarStoreOptions, StoreProps<MenuBarStoreState> {}
13
+ interface MenuBarStore extends MenuBarStoreFunctions, Store<MenuBarStoreState> {}
14
+ //#endregion
15
+ export { MenuBarStore, MenuBarStoreFunctions, MenuBarStoreOptions, MenuBarStoreProps, MenuBarStoreState, createMenuBarStore };
16
+ //# sourceMappingURL=menu-bar-store.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"menu-bar-store.d.ts","names":["Store","StoreProps","MenubarStoreFunctions","MenubarStoreOptions","MenubarStoreState","createMenuBarStore","MenuBarStoreProps","MenuBarStore","props","MenuBarStoreState","MenuBarStoreFunctions","MenuBarStoreOptions"],"sources":["../../src/menu/menu-bar-store.d.ts"],"mappings":";;;;;;AAKA;iBAAwBK,kBAAAA,CAAmBG,KAAAA,GAAQF,iBAAAA,GAAoBC,YAAY;AAAA,UAClEE,iBAAAA,SAA0BL,iBAAiB;AAAA,UAE3CM,qBAAAA,SAA8BR,qBAAqB;AAAA,UAEnDS,mBAAAA,SAA4BR,mBAAmB;AAAA,UAE/CG,iBAAAA,SAA0BK,mBAAAA,EAAqBV,UAAAA,CAAWQ,iBAAAA;AAAAA,UAE1DF,YAAAA,SAAqBG,qBAAAA,EAAuBV,KAAAA,CAAMS,iBAAAA"}
@@ -0,0 +1,12 @@
1
+ import { createMenubarStore } from "../menubar/menubar-store.js";
2
+ //#region src/menu/menu-bar-store.ts
3
+ /**
4
+ * Creates a menu bar store.
5
+ */
6
+ function createMenuBarStore(props = {}) {
7
+ return createMenubarStore(props);
8
+ }
9
+ //#endregion
10
+ export { createMenuBarStore };
11
+
12
+ //# sourceMappingURL=menu-bar-store.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"menu-bar-store.js","names":[],"sources":["../../src/menu/menu-bar-store.ts"],"sourcesContent":["import type { Store, StoreProps } from \"@ariakit/store\";\nimport type {\n MenubarStoreFunctions,\n MenubarStoreOptions,\n MenubarStoreState,\n} from \"../menubar/menubar-store.ts\";\nimport { createMenubarStore } from \"../menubar/menubar-store.ts\";\n\n/**\n * Creates a menu bar store.\n */\nexport function createMenuBarStore(\n props: MenuBarStoreProps = {},\n): MenuBarStore {\n return createMenubarStore(props);\n}\n\nexport interface MenuBarStoreState extends MenubarStoreState {}\n\nexport interface MenuBarStoreFunctions extends MenubarStoreFunctions {}\n\nexport interface MenuBarStoreOptions extends MenubarStoreOptions {}\n\nexport interface MenuBarStoreProps\n extends MenuBarStoreOptions, StoreProps<MenuBarStoreState> {}\n\nexport interface MenuBarStore\n extends MenuBarStoreFunctions, Store<MenuBarStoreState> {}\n"],"mappings":";;;;;AAWA,SAAgB,mBACd,QAA2B,CAAC,GACd;CACd,OAAO,mBAAmB,KAAK;AACjC"}
@@ -0,0 +1,100 @@
1
+ import { i as CompositeStoreOptions, n as CompositeStoreFunctions, s as CompositeStoreState } from "../composite-store-B-iDEtZZ.js";
2
+ import { ComboboxStore } from "../combobox/combobox-store.js";
3
+ import { HovercardStoreFunctions, HovercardStoreOptions, HovercardStoreState } from "../hovercard/hovercard-store.js";
4
+ import { MenuBarStore } from "./menu-bar-store.js";
5
+ import { Store, StoreOptions, StoreProps } from "@ariakit/store";
6
+ import { BivariantCallback, PickRequired, SetState, SetStateAction } from "@ariakit/utils";
7
+
8
+ //#region src/menu/menu-store.d.ts
9
+ declare function createMenuStore<T extends MenuStoreValues = MenuStoreValues>(props: PickRequired<MenuStoreProps<T>, "values" | "defaultValues">): MenuStore<T>;
10
+ declare function createMenuStore(props?: MenuStoreProps): MenuStore;
11
+ type MenuStoreValues = Record<string, string | boolean | number | ReadonlyArray<string | number>>;
12
+ interface MenuStoreState<T extends MenuStoreValues = MenuStoreValues> extends CompositeStoreState, HovercardStoreState {
13
+ /** @default "vertical" */
14
+ orientation: CompositeStoreState["orientation"];
15
+ /** @default "bottom-start" */
16
+ placement: HovercardStoreState["placement"];
17
+ /** @default 0 */
18
+ hideTimeout?: HovercardStoreState["hideTimeout"];
19
+ /**
20
+ * Determines the element that should be focused when the menu is opened.
21
+ */
22
+ initialFocus: "container" | "first" | "last";
23
+ /**
24
+ * A map of names and values that will be used by the
25
+ * [`MenuItemCheckbox`](https://ariakit.com/reference/menu-item-checkbox) and
26
+ * [`MenuItemRadio`](https://ariakit.com/reference/menu-item-radio)
27
+ * components.
28
+ *
29
+ * Live examples:
30
+ * - [MenuItemCheckbox](https://ariakit.com/examples/menu-item-checkbox)
31
+ * - [Submenu with
32
+ * Combobox](https://ariakit.com/examples/menu-nested-combobox)
33
+ */
34
+ values: T;
35
+ }
36
+ interface MenuStoreFunctions<T extends MenuStoreValues = MenuStoreValues> extends CompositeStoreFunctions, HovercardStoreFunctions, Pick<MenuStoreOptions, "combobox" | "parent" | "menubar"> {
37
+ /**
38
+ * Hides the menu and all its parent menus.
39
+ *
40
+ * Live examples:
41
+ * - [Submenu with
42
+ * Combobox](https://ariakit.com/examples/menu-nested-combobox)
43
+ */
44
+ hideAll: () => void;
45
+ /**
46
+ * Sets the `initialFocus` state.
47
+ */
48
+ setInitialFocus: SetState<MenuStoreState<T>["initialFocus"]>;
49
+ /**
50
+ * Sets the [`values`](https://ariakit.com/reference/menu-provider#values)
51
+ * state.
52
+ * @example
53
+ * store.setValues({ watching: ["issues"] });
54
+ * store.setValues((values) => ({ ...values, watching: ["issues"] }));
55
+ */
56
+ setValues: SetState<MenuStoreState<T>["values"]>;
57
+ /**
58
+ * Sets a specific menu value.
59
+ *
60
+ * Live examples:
61
+ * - [Submenu with
62
+ * Combobox](https://ariakit.com/examples/menu-nested-combobox)
63
+ * @example
64
+ * store.setValue("watching", ["issues"]);
65
+ * store.setValue("watching", (value) => [...value, "issues"]);
66
+ */
67
+ setValue: BivariantCallback<(name: string, value: SetStateAction<MenuStoreState<T>["values"][string]>) => void>;
68
+ }
69
+ interface MenuStoreOptions<T extends MenuStoreValues = MenuStoreValues> extends StoreOptions<MenuStoreState<T>, "orientation" | "placement" | "hideTimeout" | "values">, CompositeStoreOptions, HovercardStoreOptions {
70
+ /**
71
+ * A reference to a combobox store. This is used when combining the combobox
72
+ * with a menu (e.g., dropdown menu with a search input). The stores will
73
+ * share the same state.
74
+ */
75
+ combobox?: ComboboxStore | null;
76
+ /**
77
+ * A reference to a parent menu store. This is used on nested menus.
78
+ */
79
+ parent?: MenuStore | null;
80
+ /**
81
+ * A reference to a menubar store. This is used when rendering menus inside a
82
+ * menubar.
83
+ */
84
+ menubar?: MenuBarStore | null;
85
+ /**
86
+ * The default values for the
87
+ * [`values`](https://ariakit.com/reference/menu-provider#values) state.
88
+ *
89
+ * Live examples:
90
+ * - [MenuItemCheckbox](https://ariakit.com/examples/menu-item-checkbox)
91
+ * - [MenuItemRadio](https://ariakit.com/examples/menu-item-radio)
92
+ * @default {}
93
+ */
94
+ defaultValues?: MenuStoreState<T>["values"];
95
+ }
96
+ interface MenuStoreProps<T extends MenuStoreValues = MenuStoreValues> extends MenuStoreOptions<T>, StoreProps<MenuStoreState<T>> {}
97
+ interface MenuStore<T extends MenuStoreValues = MenuStoreValues> extends MenuStoreFunctions<T>, Store<MenuStoreState<T>> {}
98
+ //#endregion
99
+ export { MenuStore, MenuStoreFunctions, MenuStoreOptions, MenuStoreProps, MenuStoreState, MenuStoreValues, createMenuStore };
100
+ //# sourceMappingURL=menu-store.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"menu-store.d.ts","names":["Store","StoreOptions","StoreProps","BivariantCallback","PickRequired","SetState","SetStateAction","ComboboxStore","CompositeStoreFunctions","CompositeStoreOptions","CompositeStoreState","HovercardStoreFunctions","HovercardStoreOptions","HovercardStoreState","MenuBarStore","createMenuStore","T","MenuStoreValues","MenuStoreProps","MenuStore","props","ReadonlyArray","Record","MenuStoreState","orientation","placement","hideTimeout","initialFocus","values","MenuStoreFunctions","MenuStoreOptions","Pick","hideAll","setInitialFocus","setValues","setValue","name","value","combobox","parent","menubar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