@pzerelles/headlessui-svelte 2.1.2-next.12 → 2.1.2-next.13

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.
@@ -234,7 +234,7 @@ function useResolvePxValue(options) {
234
234
  const immediateValue = $derived(computeValue(input, element)[0]);
235
235
  let explicitValue = $state();
236
236
  const setValue = (value) => (explicitValue = value);
237
- const value = explicitValue ?? immediateValue;
237
+ const value = $derived(explicitValue ?? immediateValue);
238
238
  $effect(() => {
239
239
  const [value, watcher] = computeValue(input, element);
240
240
  setValue(value);
@@ -27,7 +27,8 @@ let {
27
27
  const usedInSelectedOption = getContext("SelectedOptionContext") === true;
28
28
  const data = useData("ListboxOption");
29
29
  const actions = useActions("ListboxOption");
30
- const active = $derived(data.activeOptionIndex !== null ? data.options[data.activeOptionIndex].id === id : false);
30
+ const { activeOptionIndex, options } = $derived(data);
31
+ const active = $derived(activeOptionIndex !== null ? options[activeOptionIndex].id === id : false);
31
32
  const selected = $derived(data.isSelected(value));
32
33
  const getTextValue = useTextValue({
33
34
  get element() {
@@ -245,13 +245,65 @@ const ourProps = $derived({
245
245
  }),
246
246
  ...transitionDataAttributes(transitionData)
247
247
  });
248
- const derivedData = {
248
+ const derivedData = $derived({
249
249
  ...data,
250
250
  get isSelected() {
251
251
  return data.mode === ValueMode.Multi ? data.isSelected : isSelected;
252
252
  }
253
- };
254
- setContext("ListboxDataContext", derivedData);
253
+ });
254
+ setContext("ListboxDataContext", {
255
+ get value() {
256
+ return data.value;
257
+ },
258
+ get disabled() {
259
+ return data.disabled;
260
+ },
261
+ get invalid() {
262
+ return data.invalid;
263
+ },
264
+ get mode() {
265
+ return data.mode;
266
+ },
267
+ get orientation() {
268
+ return data.orientation;
269
+ },
270
+ get activeOptionIndex() {
271
+ return data.activeOptionIndex;
272
+ },
273
+ get compare() {
274
+ return data.compare;
275
+ },
276
+ get isSelected() {
277
+ return data.mode === ValueMode.Multi ? data.isSelected : isSelected;
278
+ },
279
+ get optionsProps() {
280
+ return data.optionsProps;
281
+ },
282
+ get listElements() {
283
+ return data.listElements;
284
+ },
285
+ get buttonElement() {
286
+ return data.buttonElement;
287
+ },
288
+ get optionsElement() {
289
+ return data.optionsElement;
290
+ },
291
+ get listboxState() {
292
+ return data.listboxState;
293
+ },
294
+ get options() {
295
+ return data.options;
296
+ },
297
+ get searchQuery() {
298
+ return data.searchQuery;
299
+ },
300
+ get activationTrigger() {
301
+ return data.activationTrigger;
302
+ },
303
+ get __demoMode() {
304
+ return data.__demoMode;
305
+ }
306
+ });
255
307
  </script>
256
308
 
257
309
  <Portal enabled={portal ? theirProps.static || visible : false}>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pzerelles/headlessui-svelte",
3
- "version": "2.1.2-next.12",
3
+ "version": "2.1.2-next.13",
4
4
  "exports": {
5
5
  ".": {
6
6
  "types": "./dist/index.d.ts",