@publishfx/publish-components 2.1.5 → 2.1.6

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.
@@ -37,17 +37,22 @@ const TimePickerSelect = (props)=>{
37
37
  isAllSelected,
38
38
  options
39
39
  ]);
40
+ const sortByTime = useCallback((values)=>[
41
+ ...values
42
+ ].sort((a, b)=>a.localeCompare(b)), []);
40
43
  const handleChange = useCallback((newValue)=>{
41
44
  const normalizedValue = Array.isArray(newValue) ? newValue : void 0 !== newValue ? [
42
45
  newValue
43
46
  ] : [];
44
- const selectedOptions = options.filter((opt)=>normalizedValue.includes(opt.value));
45
- if (!isControlled) setInternalValue(normalizedValue);
46
- onChange?.(normalizedValue, selectedOptions);
47
+ const sortedValue = sortByTime(normalizedValue);
48
+ const selectedOptions = options.filter((opt)=>sortedValue.includes(opt.value)).sort((a, b)=>a.value.localeCompare(b.value));
49
+ if (!isControlled) setInternalValue(sortedValue);
50
+ onChange?.(sortedValue, selectedOptions);
47
51
  }, [
48
52
  onChange,
49
53
  isControlled,
50
- options
54
+ options,
55
+ sortByTime
51
56
  ]);
52
57
  const handleSelectAll = useCallback(()=>{
53
58
  const enabledOptions = options.filter((opt)=>!opt.disabled);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@publishfx/publish-components",
3
- "version": "2.1.5",
3
+ "version": "2.1.6",
4
4
  "description": "A React UI component library for the Publish platform, including ActionButton component",
5
5
  "type": "module",
6
6
  "keywords": [