hi-tm 0.6.4 → 0.6.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -137,6 +137,10 @@ function CreatableSelect({ options = [], value, onChange, onClick, onValueChange
137
137
  (0, react_1.useEffect)(() => {
138
138
  selectedValuesRef.current = selectedValues;
139
139
  }, [selectedValues]);
140
+ // Debug: Log when selectedValues changes
141
+ (0, react_1.useEffect)(() => {
142
+ console.log('selectedValues changed to:', selectedValues);
143
+ }, [selectedValues]);
140
144
  // Sync external value prop with internal selectedValues state
141
145
  (0, react_1.useEffect)(() => {
142
146
  // Don't sync if user is actively interacting with the component
@@ -322,11 +326,15 @@ function CreatableSelect({ options = [], value, onChange, onClick, onValueChange
322
326
  emitSelection(next);
323
327
  }, [selectedValues, deriveValue, emitSelection]);
324
328
  const selectOption = (0, react_1.useCallback)((option) => {
329
+ console.log('selectOption called with:', option);
330
+ console.log('Current selectedValues:', selectedValues);
331
+ console.log('isMultiSelect:', isMultiSelect);
325
332
  if (isMultiSelect) {
326
333
  const next = [...selectedValues];
327
334
  if (!next.some((val) => deriveValue(val) === deriveValue(option))) {
328
335
  next.push(option);
329
336
  }
337
+ console.log('New selectedValues (multi):', next);
330
338
  setSelectedValues(next);
331
339
  emitSelection(next);
332
340
  // In multi-select mode, keep the input open and clear input for next search
@@ -336,6 +344,7 @@ function CreatableSelect({ options = [], value, onChange, onClick, onValueChange
336
344
  }
337
345
  else {
338
346
  const next = [option];
347
+ console.log('New selectedValues (single):', next);
339
348
  setSelectedValues(next);
340
349
  emitSelection(next);
341
350
  setInputValue('');
@@ -361,18 +370,18 @@ function CreatableSelect({ options = [], value, onChange, onClick, onValueChange
361
370
  react_1.default.createElement("button", { onClick: (e) => clearValue(e, val), className: styles.clearButton }, renderIcon(icons.clear, styles.icon))))),
362
371
  react_1.default.createElement("input", { ref: inputRef, type: "text", className: `${styles.input} ${isDisabled ? 'bg-gray-100' : ''} min-w-[80px] flex-shrink-0`, placeholder: selectedValues.length > 0 ? '' : placeholder, value: inputValue, onChange: handleInputChange, disabled: isDisabled, onClick: (e) => e.stopPropagation() }))),
363
372
  react_1.default.createElement("div", { className: "flex-shrink-0 flex items-center gap-1 ml-2" },
364
- showLoading && renderIcon(iconSrc.loading, `animate-spin ${styles.icon}`),
365
- iconSrc.hasAdd && (react_1.default.createElement("button", { onClick: handleAddIconClick, className: styles.clearButton }, renderIcon(iconSrc.hasAdd, styles.icon))),
373
+ showLoading && renderIcon(icons.loading, `animate-spin ${styles.icon}`),
374
+ icons.hasAdd && onAddClick !== undefined && (react_1.default.createElement("button", { onClick: handleAddIconClick, className: styles.clearButton }, renderIcon(icons.hasAdd, styles.icon))),
366
375
  styles.separator && react_1.default.createElement("div", { className: styles.separator }),
367
376
  isOpen
368
- ? renderIcon(iconSrc.dropdownOpen, `${styles.icon} ${styles.spinAnimation || ''}`)
369
- : renderIcon(iconSrc.dropdownClosed, styles.icon))),
377
+ ? renderIcon(icons.dropdownOpen, `${styles.icon} ${styles.spinAnimation || ''}`)
378
+ : renderIcon(icons.dropdownClosed, styles.icon))),
370
379
  isOpen && (react_1.default.createElement("div", { className: styles.dropdown }, showLoading ? (react_1.default.createElement("div", { className: styles.loadingState },
371
- renderIcon(iconSrc.loading, `animate-spin mr-2 ${styles.icon}`),
380
+ renderIcon(icons.loading, `animate-spin mr-2 ${styles.icon}`),
372
381
  loadingMessage)) : (react_1.default.createElement(react_1.default.Fragment, null,
373
382
  filteredOptions.length > 0 && (react_1.default.createElement(react_1.default.Fragment, null, filteredOptions.map((option, index) => (react_1.default.createElement("div", { key: deriveValue(option), className: `${styles.option} ${index === highlightedIndex ? styles.highlightedOption : 'hover:bg-gray-50'}`, onClick: () => selectOption(option), onMouseEnter: () => setHighlightedIndex(index) },
374
383
  selectedValues.some((val) => deriveValue(val) === deriveValue(option)) &&
375
- renderIcon(iconSrc.checkmark, 'w-4 h-4 mr-2 text-blue-500'),
384
+ renderIcon(icons.checkmark, 'w-4 h-4 mr-2 text-blue-500'),
376
385
  react_1.default.createElement("span", { className: selectedValues.some((val) => deriveValue(val) === deriveValue(option))
377
386
  ? styles.selectedOption
378
387
  : '' }, deriveLabel(option) || deriveValue(option))))))),
@@ -380,11 +389,11 @@ function CreatableSelect({ options = [], value, onChange, onClick, onValueChange
380
389
  filteredOptions.length === 0 &&
381
390
  inputValue &&
382
391
  hasSearched &&
383
- renderNoResults(noResultsFound, styles.noResults ?? '', iconSrc.create),
392
+ renderNoResults(noResultsFound, styles.noResults ?? '', icons.create),
384
393
  isCreatable &&
385
394
  inputValue &&
386
395
  !options?.some((o) => deriveLabel(o) === inputValue) && (react_1.default.createElement("div", { className: styles.createOption, onClick: handleCreateOption },
387
- renderIcon(iconSrc.create, styles.icon),
396
+ renderIcon(icons.create, styles.icon),
388
397
  react_1.default.createElement("span", null,
389
398
  createOptionMessage,
390
399
  ": ",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hi-tm",
3
- "version": "0.6.4",
3
+ "version": "0.6.5",
4
4
  "styles": "dist/styles/globals.css",
5
5
  "main": "dist/index.js",
6
6
  "exports": {