@antimatter-audio/antimatter-ui 9.0.6 → 9.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.
package/dist/index.d.ts CHANGED
@@ -79,10 +79,10 @@ declare namespace Button {
79
79
 
80
80
  interface DropdownProps {
81
81
  id: string;
82
- items: Array<string>;
82
+ items?: Array<string>;
83
83
  className?: string;
84
84
  style?: React__default.CSSProperties;
85
- onChange?: (event: any) => {};
85
+ onChange?: (event: any) => any;
86
86
  }
87
87
  declare function Dropdown({ items, className, id, style }: DropdownProps): React__default.JSX.Element;
88
88
 
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import React__default, { useState, useRef, useCallback, useEffect } from 'react';
2
+ import React__default, { useState, useEffect, useRef, useCallback } from 'react';
3
3
  import classnames from 'classnames';
4
4
  import { TabGroup, TabList, Tab, Listbox, ListboxButton, ListboxOptions, ListboxOption } from '@headlessui/react';
5
5
  import './assets/src/common/styles/base.css.ts.vanilla-aBQSVOsn.css';
@@ -356,14 +356,34 @@ function _unsupported_iterable_to_array$4(o, minLen) {
356
356
  }
357
357
  function Dropdown(param) {
358
358
  var items = param.items, className = param.className, id = param.id, style = param.style;
359
- var _useState = _sliced_to_array$4(useState(0), 2), selectedIndex = _useState[0], setSelectedIndex = _useState[1];
360
- var dropdownState = Juce.getComboBoxState(id);
361
- var handleChange = function(val) {
362
- setSelectedIndex(val);
363
- dropdownState.setChoiceIndex(val);
359
+ var comboBoxState = Juce.getComboBoxState(id);
360
+ var _useState = _sliced_to_array$4(useState(comboBoxState.getChoiceIndex()), 2), value = _useState[0], setValue = _useState[1];
361
+ var _useState1 = _sliced_to_array$4(useState(comboBoxState.properties), 2), properties = _useState1[0], setProperties = _useState1[1];
362
+ var handleChange = function(event) {
363
+ comboBoxState.setChoiceIndex(event);
364
+ setValue(event);
364
365
  };
366
+ useEffect(function() {
367
+ var comboBoxState = Juce.getComboBoxState(id);
368
+ setValue(comboBoxState.getChoiceIndex());
369
+ }, [
370
+ id
371
+ ]);
372
+ useEffect(function() {
373
+ var valueListenerId = comboBoxState.valueChangedEvent.addListener(function() {
374
+ setValue(comboBoxState.getChoiceIndex());
375
+ });
376
+ var propertiesListenerId = comboBoxState.propertiesChangedEvent.addListener(function() {
377
+ setProperties(comboBoxState.properties);
378
+ });
379
+ return function cleanup() {
380
+ comboBoxState.valueChangedEvent.removeListener(valueListenerId);
381
+ comboBoxState.propertiesChangedEvent.removeListener(propertiesListenerId);
382
+ };
383
+ });
384
+ var _properties_choices, _properties_choices1;
365
385
  return /*#__PURE__*/ React__default.createElement(Listbox, {
366
- value: selectedIndex,
386
+ value: value,
367
387
  onChange: handleChange
368
388
  }, /*#__PURE__*/ React__default.createElement(ListboxButton, {
369
389
  className: classnames('Dropdown-button', DropdownButtonStyle, className),
@@ -372,16 +392,17 @@ function Dropdown(param) {
372
392
  onChange: function(value) {
373
393
  return console.log(value);
374
394
  }
375
- }, items[selectedIndex]), /*#__PURE__*/ React__default.createElement(ListboxOptions, {
395
+ }, ((_properties_choices = properties.choices) !== null && _properties_choices !== void 0 ? _properties_choices : items)[value]), /*#__PURE__*/ React__default.createElement(ListboxOptions, {
376
396
  anchor: "bottom",
377
397
  portal: false,
378
398
  className: classnames(DropdownMenuStyle)
379
- }, items.map(function(item, i) {
380
- return /*#__PURE__*/ React__default.createElement(ListboxOption, {
399
+ }, ((_properties_choices1 = properties.choices) !== null && _properties_choices1 !== void 0 ? _properties_choices1 : items).map(function(item, i) {
400
+ var _properties_choices;
401
+ return React__default.createElement(ListboxOption, {
381
402
  className: classnames(DropdownMenuItemStyle),
382
403
  key: item,
383
404
  value: i
384
- }, items[i]);
405
+ }, ((_properties_choices = properties.choices) !== null && _properties_choices !== void 0 ? _properties_choices : items)[i]);
385
406
  })));
386
407
  }
387
408
 
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mapp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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antimatter-audio/antimatter-ui",
3
- "version": "9.0.6",
3
+ "version": "9.1.0",
4
4
  "description": "React UI component library for Antimatter Audio.",
5
5
  "repository": {
6
6
  "type": "git",