@procore/core-react 12.36.0 → 12.37.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/CHANGELOG.md +25 -0
- package/dist/AnchorNavigation/AnchorNavigation.styles.js +3 -3
- package/dist/Avatar/Avatar.styles.js +5 -5
- package/dist/AvatarStack/AvatarStack.styles.js +7 -7
- package/dist/Badge/Badge.styles.js +2 -2
- package/dist/BadgePill/BadgePill.styles.js +4 -4
- package/dist/Banner/Banner.styles.js +10 -10
- package/dist/Box/Box.styles.js +1 -1
- package/dist/Breadcrumbs/Breadcrumbs.styles.js +4 -4
- package/dist/Button/Button.js +0 -1
- package/dist/Button/Button.js.map +1 -1
- package/dist/Button/Button.styles.js +5 -5
- package/dist/Calendar/Calendar.styles.js +9 -9
- package/dist/Card/Card.styles.js +1 -1
- package/dist/Checkbox/Checkbox.styles.js +6 -6
- package/dist/Checkbox/CheckboxTooltip.js +1 -1
- package/dist/ContactItem/ContactItem.styles.js +5 -5
- package/dist/Content/Content.styles.js +2 -2
- package/dist/DateInput/DateInput.js +2 -3
- package/dist/DateInput/DateInput.js.map +1 -1
- package/dist/DateInput/DateInput.styles.js +6 -6
- package/dist/DateSelect/DateSelect.js +1 -1
- package/dist/DateSelect/DateSelect.js.map +1 -1
- package/dist/DetailPage/DetailPage.styles.js +7 -7
- package/dist/Dropdown/Dropdown.js +0 -4
- package/dist/Dropdown/Dropdown.js.map +1 -1
- package/dist/Dropdown/Dropdown.styles.js +3 -3
- package/dist/DropdownFlyout/DropdownFlyout.js +8 -3
- package/dist/DropdownFlyout/DropdownFlyout.js.map +1 -1
- package/dist/DropdownFlyout/DropdownFlyout.styles.js +4 -4
- package/dist/DropdownFlyout/DropdownFlyout.types.d.ts +1 -0
- package/dist/DropdownFlyout/DropdownFlyout.types.js.map +1 -1
- package/dist/Dropzone/Dropzone.js +1 -1
- package/dist/Dropzone/Dropzone.styles.js +9 -9
- package/dist/EmptyState/EmptyState.styles.js +6 -6
- package/dist/Field/Field.styles.js +3 -3
- package/dist/FileList/FileList.styles.js +4 -4
- package/dist/FileSelect/FileExplorer/FileExplorer.styles.js +9 -9
- package/dist/FileSelect/FileExplorer/FileExplorerSidebar.styles.js +3 -3
- package/dist/FileSelect/FileSelect.styles.js +2 -2
- package/dist/FileSelect/FileSelectDropzone/FileSelectDropzone.styles.js +3 -3
- package/dist/FileSelect/FileTokenList/FileTokenList.styles.js +2 -2
- package/dist/FileSelect/GridSource/GridSource.js +2 -1
- package/dist/FileSelect/GridSource/GridSource.js.map +1 -1
- package/dist/FileSelect/GridSource/GridSource.styles.js +6 -6
- package/dist/FileSelect/LocalSource/LocalSource.styles.js +4 -4
- package/dist/FileSelect/SourceItem/SourceItem.js +19 -16
- package/dist/FileSelect/SourceItem/SourceItem.js.map +1 -1
- package/dist/FileSelect/SourceItem/SourceItem.styles.js +3 -3
- package/dist/FileSelect/ThumbnailList/ThumbnailList.styles.js +6 -6
- package/dist/FileSelect/TreeSource/TreeSource.styles.js +1 -1
- package/dist/FileToken/FileToken.styles.js +4 -4
- package/dist/FilterToken/FilterToken.styles.js +5 -5
- package/dist/FlexList/FlexList.styles.js +1 -1
- package/dist/Form/Form.styles.js +14 -14
- package/dist/Form/StyledFormikForm.styles.js +2 -2
- package/dist/GhostPlaceholder/GhostPlaceholder.styles.js +2 -2
- package/dist/Grid/Grid.styles.js +2 -2
- package/dist/GroupSelect/GroupSelect.styles.js +1 -1
- package/dist/Input/Input.styles.js +1 -1
- package/dist/Link/Link.styles.js +1 -1
- package/dist/ListPage/ListPage.styles.js +8 -8
- package/dist/Loader/Loader.styles.js +2 -2
- package/dist/MenuImperative/MenuImperative.styles.js +10 -10
- package/dist/Modal/Modal.styles.js +13 -13
- package/dist/MultiSelect/MultiSelect.js +3 -3
- package/dist/MultiSelect/MultiSelect.js.map +1 -1
- package/dist/MultiSelect/MultiSelect.styles.d.ts +7 -4
- package/dist/MultiSelect/MultiSelect.styles.js +18 -10
- package/dist/MultiSelect/MultiSelect.styles.js.map +1 -1
- package/dist/NextMenu/NextMenu.styles.js +3 -3
- package/dist/Notation/Notation.js +1 -1
- package/dist/NumberInput/NumberInput.styles.js +7 -7
- package/dist/Overlay/OverlayArrow.styles.js +1 -1
- package/dist/PageLayout/PageLayout.styles.js +16 -16
- package/dist/PageTemplate/PageFooterTemplate/PageFooterTemplate.styles.js +1 -1
- package/dist/PageTemplate/PageHeaderTemplate/PageHeaderTemplate.styles.js +3 -3
- package/dist/PageTemplate/PagePaneTemplate/PagePaneTemplate.styles.js +2 -2
- package/dist/PageTemplate/PageTemplate/PageTemplate.styles.js +3 -3
- package/dist/Pagination/Pagination.styles.js +5 -5
- package/dist/Panel/Panel.styles.js +11 -11
- package/dist/Pill/Pill.styles.js +3 -3
- package/dist/PillSelect/PillSelect.styles.js +4 -4
- package/dist/Popover/Popover.styles.js +2 -2
- package/dist/Portal/Portal.styles.js +1 -1
- package/dist/ProgressBar/ProgressBar.styles.js +2 -2
- package/dist/RadioButton/RadioButton.styles.js +3 -3
- package/dist/Required/Required.styles.js +3 -3
- package/dist/Search/Search.styles.js +5 -5
- package/dist/Section/Section.styles.js +7 -7
- package/dist/SegmentedController/SegmentedController.js +1 -1
- package/dist/SegmentedController/SegmentedController.js.map +1 -1
- package/dist/SegmentedController/SegmentedController.styles.js +4 -4
- package/dist/Select/Select.js +15 -11
- package/dist/Select/Select.js.map +1 -1
- package/dist/Select/Select.styles.d.ts +5 -1
- package/dist/Select/Select.styles.js +45 -35
- package/dist/Select/Select.styles.js.map +1 -1
- package/dist/Semantic/Semantic.styles.d.ts +4 -4
- package/dist/Semantic/Semantic.styles.js +9 -9
- package/dist/Slider/Slider.styles.js +5 -5
- package/dist/Spinner/Spinner.styles.js +7 -7
- package/dist/SplitViewCard/SplitViewCard.styles.js +8 -8
- package/dist/SuperSelect/SuperSelect.components.js +16 -9
- package/dist/SuperSelect/SuperSelect.components.js.map +1 -1
- package/dist/SuperSelect/SuperSelect.js +1 -1
- package/dist/SuperSelect/SuperSelect.js.map +1 -1
- package/dist/SuperSelect/SuperSelect.presets.styles.js +1 -1
- package/dist/SuperSelect/SuperSelect.styles.js +39 -39
- package/dist/SuperSelect/SuperSelect.styles.js.map +1 -1
- package/dist/SuperSelect/SuperSelect.types.d.ts +4 -0
- package/dist/SuperSelect/SuperSelect.types.js.map +1 -1
- package/dist/SuperSelect/SuperSelect.utils.d.ts +2 -1
- package/dist/SuperSelect/SuperSelect.utils.js +17 -0
- package/dist/SuperSelect/SuperSelect.utils.js.map +1 -1
- package/dist/SuperSelect/useSuperSelect.d.ts +1 -1
- package/dist/SuperSelect/useSuperSelect.js +70 -41
- package/dist/SuperSelect/useSuperSelect.js.map +1 -1
- package/dist/Switch/Switch.styles.js +4 -4
- package/dist/Table/Table.styles.js +62 -59
- package/dist/Table/Table.styles.js.map +1 -1
- package/dist/TableShelf/TableShelf.styles.js +5 -5
- package/dist/Tabs/Tabs.styles.js +15 -15
- package/dist/Tearsheet/Tearsheet.styles.js +5 -5
- package/dist/TextArea/TextArea.styles.js +1 -1
- package/dist/TextEditorOutput/TextEditorOutput.styles.js +1 -1
- package/dist/Thumbnail/Thumbnail.styles.js +17 -17
- package/dist/ThumbnailGrid/ThumbnailGrid.styles.js +7 -7
- package/dist/TieredSelect/TierSelectionTieredSelect.js +12 -2
- package/dist/TieredSelect/TierSelectionTieredSelect.js.map +1 -1
- package/dist/TieredSelect/TieredSelect.js +18 -5
- package/dist/TieredSelect/TieredSelect.js.map +1 -1
- package/dist/TieredSelect/TieredSelect.styles.js +9 -9
- package/dist/TieredSelect/TieredSelectMenu.js +9 -2
- package/dist/TieredSelect/TieredSelectMenu.js.map +1 -1
- package/dist/Tile/Tile.styles.js +8 -8
- package/dist/Title/Title.styles.js +7 -7
- package/dist/Toast/Toast.styles.js +3 -3
- package/dist/ToggleButton/ToggleButton.styles.js +1 -1
- package/dist/Token/Token.styles.js +3 -3
- package/dist/ToolHeader/ToolHeader.styles.js +6 -6
- package/dist/ToolLandingPage/ToolLandingPage.styles.js +3 -3
- package/dist/Tooltip/Tooltip.styles.js +2 -2
- package/dist/Tooltip/Tooltip.types.d.ts +4 -0
- package/dist/Tooltip/Tooltip.types.js.map +1 -1
- package/dist/Tree/Tree.js +1 -1
- package/dist/Tree/Tree.styles.js +10 -10
- package/dist/Typeahead/Typeahead.styles.js +3 -3
- package/dist/Typography/Typography.styles.js +1 -1
- package/dist/Typography/Typography.table.story.js +2 -2
- package/dist/_hooks/I18n.d.ts +0 -22
- package/dist/_locales/de-DE.json +2 -2
- package/dist/_locales/en-AU.json +1 -1
- package/dist/_locales/en-CA.json +1 -1
- package/dist/_locales/en-GB.json +1 -1
- package/dist/_locales/es-ES.json +1 -1
- package/dist/_locales/es.json +3 -3
- package/dist/_locales/fr-CA.json +2 -2
- package/dist/_locales/fr-FR.json +4 -4
- package/dist/_locales/is-IS.json +2 -2
- package/dist/_locales/it-IT.json +47 -47
- package/dist/_locales/ja-JP.json +4 -4
- package/dist/_locales/pl-PL.json +1 -1
- package/dist/_locales/pt-BR.json +4 -4
- package/dist/_locales/pt-PT.json +11 -11
- package/dist/_locales/th-TH.json +4 -4
- package/dist/_locales/zh-SG.json +1 -1
- package/dist/_locales/zh-TW.json +5 -5
- package/dist/_storyHelpers_/components/Deprecation.styles.js +1 -1
- package/dist/_storyHelpers_/components/StoryGrid.js +3 -3
- package/dist/_styles/colors.js +7 -3
- package/dist/_styles/colors.js.map +1 -1
- package/dist/_typedoc/AnchorNavigation/AnchorNavigation.types.json +3 -3
- package/dist/_typedoc/Avatar/Avatar.types.json +20 -20
- package/dist/_typedoc/AvatarStack/AvatarStack.types.json +24 -24
- package/dist/_typedoc/Badge/Badge.types.json +6 -6
- package/dist/_typedoc/Banner/Banner.types.json +13 -13
- package/dist/_typedoc/Box/Box.types.json +68 -68
- package/dist/_typedoc/Breadcrumbs/Breadcrumbs.types.json +10 -10
- package/dist/_typedoc/Button/Button.types.json +13 -13
- package/dist/_typedoc/Calendar/Calendar.types.json +80 -80
- package/dist/_typedoc/Card/Card.types.json +6 -6
- package/dist/_typedoc/Checkbox/Checkbox.types.json +8 -8
- package/dist/_typedoc/ContactItem/ContactItem.types.json +9 -9
- package/dist/_typedoc/DateInput/DateInput.types.json +35 -35
- package/dist/_typedoc/DateSelect/DateSelect.types.json +13 -13
- package/dist/_typedoc/DetailPage/DetailPage.types.json +5 -5
- package/dist/_typedoc/Dropdown/Dropdown.types.json +37 -37
- package/dist/_typedoc/DropdownFlyout/DropdownFlyout.types.json +40 -30
- package/dist/_typedoc/Dropzone/Dropzone.types.json +44 -44
- package/dist/_typedoc/EmptyState/EmptyState.types.json +16 -16
- package/dist/_typedoc/FileList/FileList.types.json +9 -9
- package/dist/_typedoc/FileSelect/FileSelect.types.json +27 -27
- package/dist/_typedoc/FileSelect/GridSource/GridSource.types.json +20 -20
- package/dist/_typedoc/FileSelect/LocalSource/LocalSource.types.json +14 -14
- package/dist/_typedoc/FileSelect/TreeSource/TreeSource.types.json +9 -9
- package/dist/_typedoc/Flex/Flex.types.json +27 -27
- package/dist/_typedoc/FlexList/FlexList.types.json +30 -30
- package/dist/_typedoc/Form/Form.types.json +750 -750
- package/dist/_typedoc/GhostPlaceholder/GhostPlaceholder.types.json +12 -12
- package/dist/_typedoc/Grid/Grid.types.json +8 -8
- package/dist/_typedoc/GroupSelect/GroupSelect.types.json +52 -52
- package/dist/_typedoc/Input/Input.types.json +2 -2
- package/dist/_typedoc/Link/Link.types.json +1 -1
- package/dist/_typedoc/ListPage/ListPage.types.json +13 -13
- package/dist/_typedoc/Menu/Menu.types.json +62 -62
- package/dist/_typedoc/MenuImperative/MenuImperative.types.json +77 -77
- package/dist/_typedoc/Modal/Modal.types.json +46 -46
- package/dist/_typedoc/MultiSelect/MultiSelect.types.json +31 -31
- package/dist/_typedoc/NextTile/NextTile.types.json +32 -32
- package/dist/_typedoc/Notation/Notation.types.json +4 -4
- package/dist/_typedoc/NumberInput/NumberInput.types.json +48 -48
- package/dist/_typedoc/OverlayTrigger/OverlayTrigger.types.json +32 -32
- package/dist/_typedoc/PageLayout/PageLayout.types.json +26 -26
- package/dist/_typedoc/Pagination/Pagination.types.json +7 -7
- package/dist/_typedoc/Panel/Panel.types.json +30 -30
- package/dist/_typedoc/Pill/Pill.types.json +2 -2
- package/dist/_typedoc/PillSelect/PillSelect.types.json +49 -49
- package/dist/_typedoc/Popover/Popover.types.json +15 -15
- package/dist/_typedoc/ProgressBar/ProgressBar.types.json +7 -7
- package/dist/_typedoc/RadioButton/RadioButton.types.json +6 -6
- package/dist/_typedoc/Required/Required.types.json +5 -5
- package/dist/_typedoc/Search/Search.types.json +18 -18
- package/dist/_typedoc/Section/Section.types.json +15 -15
- package/dist/_typedoc/SegmentedController/SegmentedController.types.json +21 -21
- package/dist/_typedoc/Select/Select.types.json +60 -60
- package/dist/_typedoc/SettingsPage/SettingsPage.types.json +10 -10
- package/dist/_typedoc/Slider/Slider.types.json +6 -6
- package/dist/_typedoc/Spinner/Spinner.types.json +9 -9
- package/dist/_typedoc/SplitViewCard/SplitViewCard.types.json +14 -14
- package/dist/_typedoc/Table/Table.types.json +102 -102
- package/dist/_typedoc/Tabs/Tabs.types.json +20 -20
- package/dist/_typedoc/Tearsheet/Tearsheet.types.json +17 -17
- package/dist/_typedoc/TextArea/TextArea.types.json +3 -3
- package/dist/_typedoc/TextEditor/TextEditor.types.json +11 -11
- package/dist/_typedoc/TextEditorOutput/TextEditorOutput.types.json +4 -4
- package/dist/_typedoc/Thumbnail/Thumbnail.types.json +19 -19
- package/dist/_typedoc/TieredDropdown/TieredDropdown.types.json +43 -43
- package/dist/_typedoc/TieredSelect/TieredSelect.types.json +29 -29
- package/dist/_typedoc/Tile/Tile.types.json +8 -8
- package/dist/_typedoc/Title/Title.types.json +1 -1
- package/dist/_typedoc/Toast/Toast.types.json +4 -4
- package/dist/_typedoc/ToggleButton/ToggleButton.types.json +4 -4
- package/dist/_typedoc/Token/Token.types.json +7 -7
- package/dist/_typedoc/ToolHeader/ToolHeader.types.json +10 -10
- package/dist/_typedoc/ToolLandingPage/ToolLandingPage.types.json +8 -8
- package/dist/_typedoc/Tooltip/Tooltip.types.json +23 -13
- package/dist/_typedoc/Tree/Tree.types.json +88 -88
- package/dist/_typedoc/Typeahead/Typeahead.types.json +2 -2
- package/dist/_typedoc/Typography/Typography.types.json +9 -9
- package/dist/_typedoc/_utils/types.json +3 -3
- package/dist/_utils/storybookTooltip.d.ts +2 -0
- package/dist/_utils/storybookTooltip.js +12 -0
- package/dist/_utils/storybookTooltip.js.map +1 -0
- package/dist/_utils/triggerListeners.js +2 -2
- package/dist/_utils/triggerListeners.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { SuperSelectApi, SuperSelectConfig } from './SuperSelect.types';
|
|
3
|
-
export declare function useSuperSelect({ block, components: customComponents, defaultValue, disabled, draggable, emptyMessage, selectAllEnabled, error, footer, getOptionGroup, getOptionIsBatch, getOptionIsDisabled, getOptionLabel, getOptionIsPartiallySelected, getOptionIsSelected, getOptionValue, onScrollBottom, onOpenChange, header, loading, multiple, onChange, onManualSort, onSelectAll, options: sourceOptions, placeholder, preset, presetProps, search, selectionStyle, setOptionGroup, sort, tabIndex, value: value_, overlayMatchesTriggerWidth, 'aria-label': ariaLabel, }: SuperSelectConfig): SuperSelectApi;
|
|
3
|
+
export declare function useSuperSelect({ block, components: customComponents, defaultValue, disabled, draggable, emptyMessage, selectAllEnabled, error, footer, getOptionGroup, getOptionIsBatch, getOptionIsDisabled, getOptionLabel, getOptionIsPartiallySelected, getOptionIsSelected, getOptionValue, onScrollBottom, onOpenChange, header, loading, multiple, onChange, onManualSort, onUnselectAll, onSelectAll, options: sourceOptions, placeholder, preset, presetProps, search, selectionStyle, setOptionGroup, sort, tabIndex, value: value_, overlayMatchesTriggerWidth, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy, }: SuperSelectConfig): SuperSelectApi;
|
|
4
4
|
export declare const SuperSelectContext: React.Context<SuperSelectApi | null>;
|
|
5
5
|
export declare function useSuperSelectContext(): SuperSelectApi;
|
|
@@ -26,7 +26,7 @@ import { spacing } from '../_styles/spacing';
|
|
|
26
26
|
import * as defaultComponents from './SuperSelect.components';
|
|
27
27
|
import { draggableOptionIdSymbol, isOptSelectAllSymbol } from './SuperSelect.constants';
|
|
28
28
|
import { extendedSelectMenuWidth } from './SuperSelect.styles';
|
|
29
|
-
import { collectGroupsInOrderOfOccurrence, createOptgroup, getBatchOptionFormatter, getIsAllOptionsUngrouped, getOptionIsOptgroup, getOptionIsOptSelectAll, getOptionsSortingAlgorithm, isMultiple, removeEmptyOptGroups, reorder, sortOptgroups } from './SuperSelect.utils';
|
|
29
|
+
import { collectGroupsInOrderOfOccurrence, createOptgroup, defaultOnUnselectAll, getBatchOptionFormatter, getIsAllOptionsUngrouped, getOptionIsOptgroup, getOptionIsOptSelectAll, getOptionsSortingAlgorithm, isMultiple, removeEmptyOptGroups, reorder, sortOptgroups } from './SuperSelect.utils';
|
|
30
30
|
var listContainerVerticalPadding = spacing.sm * 2;
|
|
31
31
|
function noop() {}
|
|
32
32
|
function defaultGetOptionValue(option) {
|
|
@@ -169,6 +169,8 @@ export function useSuperSelect(_ref3) {
|
|
|
169
169
|
multiple = _ref3$multiple === void 0 ? false : _ref3$multiple,
|
|
170
170
|
onChange = _ref3.onChange,
|
|
171
171
|
onManualSort = _ref3.onManualSort,
|
|
172
|
+
_ref3$onUnselectAll = _ref3.onUnselectAll,
|
|
173
|
+
onUnselectAll = _ref3$onUnselectAll === void 0 ? defaultOnUnselectAll : _ref3$onUnselectAll,
|
|
172
174
|
onSelectAll = _ref3.onSelectAll,
|
|
173
175
|
_ref3$options = _ref3.options,
|
|
174
176
|
sourceOptions = _ref3$options === void 0 ? [] : _ref3$options,
|
|
@@ -189,7 +191,11 @@ export function useSuperSelect(_ref3) {
|
|
|
189
191
|
value_ = _ref3.value,
|
|
190
192
|
_ref3$overlayMatchesT = _ref3.overlayMatchesTriggerWidth,
|
|
191
193
|
overlayMatchesTriggerWidth = _ref3$overlayMatchesT === void 0 ? true : _ref3$overlayMatchesT,
|
|
192
|
-
ariaLabel = _ref3['aria-label']
|
|
194
|
+
ariaLabel = _ref3['aria-label'],
|
|
195
|
+
ariaLabelledBy = _ref3['aria-labelledby'];
|
|
196
|
+
var valueId = useId();
|
|
197
|
+
var labelId = useId();
|
|
198
|
+
var computedLabelledBy = ariaLabel ? undefined : ariaLabelledBy !== null && ariaLabelledBy !== void 0 ? ariaLabelledBy : labelId;
|
|
193
199
|
React.useEffect(function () {
|
|
194
200
|
if (!draggable) {
|
|
195
201
|
return;
|
|
@@ -227,12 +233,10 @@ export function useSuperSelect(_ref3) {
|
|
|
227
233
|
var isProcessingAutoSelectionRef = React.useRef(false);
|
|
228
234
|
|
|
229
235
|
/**
|
|
230
|
-
* Stores a snapshot of previously
|
|
231
|
-
*
|
|
232
|
-
* Value: The SuperSelectOption object
|
|
233
|
-
* Used to detect newly added options for auto-selection when Select All is active.
|
|
236
|
+
* Stores a snapshot of previously selected values to compare against
|
|
237
|
+
* current options for auto-selection.
|
|
234
238
|
*/
|
|
235
|
-
var
|
|
239
|
+
var previousSelectedValuesRef = React.useRef([]);
|
|
236
240
|
function setValue(v) {
|
|
237
241
|
if (!value_) {
|
|
238
242
|
setVal(v);
|
|
@@ -313,39 +317,31 @@ export function useSuperSelect(_ref3) {
|
|
|
313
317
|
if (!isSelectAllActive || !multiple || !Array.isArray(currentValue) || isProcessingAutoSelectionRef.current) {
|
|
314
318
|
return;
|
|
315
319
|
}
|
|
316
|
-
|
|
317
|
-
return !getOptionIsOptgroup(opt);
|
|
318
|
-
});
|
|
319
|
-
var currentOptionKeys = new Set();
|
|
320
|
+
previousSelectedValuesRef.current = currentValue;
|
|
320
321
|
var newlyAddedOptions = [];
|
|
322
|
+
var currentValueSet = new Set(currentValue);
|
|
321
323
|
var _iterator2 = _createForOfIteratorHelper(selectableOptions),
|
|
322
324
|
_step2;
|
|
323
325
|
try {
|
|
324
326
|
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
325
327
|
var _option = _step2.value;
|
|
326
|
-
var
|
|
327
|
-
|
|
328
|
-
|
|
328
|
+
var _optionValues = getOptionValuesFlat(_option);
|
|
329
|
+
var hasNewValue = _optionValues.some(function (val) {
|
|
330
|
+
return !currentValueSet.has(val);
|
|
331
|
+
});
|
|
332
|
+
if (hasNewValue) {
|
|
329
333
|
newlyAddedOptions.push(_option);
|
|
330
334
|
}
|
|
331
335
|
}
|
|
332
|
-
|
|
333
|
-
// Update reference for next comparison
|
|
334
336
|
} catch (err) {
|
|
335
337
|
_iterator2.e(err);
|
|
336
338
|
} finally {
|
|
337
339
|
_iterator2.f();
|
|
338
340
|
}
|
|
339
|
-
previousSelectableOptionsRef.current = currentOptionKeys;
|
|
340
|
-
|
|
341
|
-
// No new options to auto-select
|
|
342
341
|
if (newlyAddedOptions.length === 0) {
|
|
343
342
|
return;
|
|
344
343
|
}
|
|
345
|
-
|
|
346
|
-
// Set processing flag to prevent recursive calls
|
|
347
344
|
isProcessingAutoSelectionRef.current = true;
|
|
348
|
-
var currentValueSet = new Set(currentValue);
|
|
349
345
|
var newValuesToAdd = [];
|
|
350
346
|
|
|
351
347
|
// Collect new values that aren't already selected
|
|
@@ -644,6 +640,23 @@ export function useSuperSelect(_ref3) {
|
|
|
644
640
|
var selectedLabel = React.useMemo(function () {
|
|
645
641
|
return selectedOption ? getOptionLabel(selectedOption) : '';
|
|
646
642
|
}, [selectedOption]);
|
|
643
|
+
|
|
644
|
+
// Active option id calculation - ensures aria-activedescendant matches the active option
|
|
645
|
+
// in the combined navigation list, including SelectAll.
|
|
646
|
+
var activeOptionId = React.useMemo(function () {
|
|
647
|
+
if (activeMenuIndex === null) {
|
|
648
|
+
return undefined;
|
|
649
|
+
}
|
|
650
|
+
var baseOptions = selectAllEnabled && multiple ? allOptionsWithSelectAll : options;
|
|
651
|
+
var option = baseOptions[activeMenuIndex];
|
|
652
|
+
if (!option) {
|
|
653
|
+
return undefined;
|
|
654
|
+
}
|
|
655
|
+
var val = getOptionValue(option);
|
|
656
|
+
return "item-".concat(val);
|
|
657
|
+
}, [activeMenuIndex, selectAllEnabled, multiple, allOptionsWithSelectAll, options, getOptionValue]);
|
|
658
|
+
var isInitialSelectedOpen = open && selectedIndex !== null && activeMenuIndex === selectedIndex;
|
|
659
|
+
var activeDescendantId = open && !isInitialSelectedOpen && activeOptionId ? activeOptionId : undefined;
|
|
647
660
|
function isSelectableOption(o) {
|
|
648
661
|
return !getOptionIsOptgroup(o) && !getOptionIsDisabled(o);
|
|
649
662
|
}
|
|
@@ -675,12 +688,12 @@ export function useSuperSelect(_ref3) {
|
|
|
675
688
|
return getIsSelected(opt);
|
|
676
689
|
});
|
|
677
690
|
if (allSelected) {
|
|
678
|
-
|
|
691
|
+
var newValue = onUnselectAll(value, options, searchValue, getOptionValuesFlat);
|
|
692
|
+
setValue(newValue);
|
|
679
693
|
} else {
|
|
680
694
|
if (onSelectAll) {
|
|
681
695
|
onSelectAll(selectableOptions);
|
|
682
696
|
}
|
|
683
|
-
// Ensure we're working with an array for multiple selection
|
|
684
697
|
var currentValue = Array.isArray(value) ? value : [];
|
|
685
698
|
var valueSet = new Set(currentValue);
|
|
686
699
|
selectableOptions.forEach(function (opt) {
|
|
@@ -706,17 +719,15 @@ export function useSuperSelect(_ref3) {
|
|
|
706
719
|
|
|
707
720
|
// Centralize select all active state
|
|
708
721
|
React.useEffect(function () {
|
|
709
|
-
var
|
|
710
|
-
return !getOptionIsOptgroup(opt);
|
|
711
|
-
});
|
|
712
|
-
var shouldBeActive = shouldActivateSelectAll(selectableOptions) && selectableOptions.length && value.length;
|
|
722
|
+
var shouldBeActive = shouldActivateSelectAll(selectableOptions) && selectableOptions.length && !!value.length;
|
|
713
723
|
|
|
714
724
|
// When Select All is already active and new selectable options are added,
|
|
715
725
|
// skip updating the Select All active state here. This allows the existing
|
|
716
726
|
// auto-selection logic to handle newly added options without triggering
|
|
717
727
|
// unnecessary state changes in this effect.
|
|
718
|
-
var hasNewOptions = selectableOptions.length >
|
|
719
|
-
|
|
728
|
+
var hasNewOptions = selectableOptions.length > previousSelectedValuesRef.current.length;
|
|
729
|
+
var hasRemovedValue = (value || []).length < previousSelectedValuesRef.current.length;
|
|
730
|
+
if (isSelectAllActive && hasNewOptions && !hasRemovedValue && value.length) {
|
|
720
731
|
return;
|
|
721
732
|
}
|
|
722
733
|
if (shouldBeActive) {
|
|
@@ -929,22 +940,22 @@ export function useSuperSelect(_ref3) {
|
|
|
929
940
|
$multiple: multiple,
|
|
930
941
|
$open: open,
|
|
931
942
|
$placeholder: !selectedLabel,
|
|
932
|
-
'aria-controls':
|
|
943
|
+
'aria-controls': overlayId,
|
|
933
944
|
'aria-expanded': open,
|
|
934
|
-
'aria-
|
|
945
|
+
'aria-describedby': valueId,
|
|
946
|
+
'aria-labelledby': computedLabelledBy
|
|
935
947
|
}, ariaLabel && {
|
|
936
948
|
'aria-label': ariaLabel
|
|
937
949
|
}), {}, {
|
|
938
950
|
onKeyDown: function onKeyDown() {
|
|
939
951
|
setPointer(false);
|
|
940
952
|
},
|
|
941
|
-
role: '
|
|
953
|
+
role: 'button',
|
|
942
954
|
search: search,
|
|
943
955
|
tabIndex: disabled ? -1 : tabIndex
|
|
944
956
|
}),
|
|
945
957
|
// TODO fix type
|
|
946
958
|
floating: {
|
|
947
|
-
role: search ? 'dialog' : 'none',
|
|
948
959
|
id: overlayId,
|
|
949
960
|
onKeyDown: function onKeyDown() {
|
|
950
961
|
setPointer(false);
|
|
@@ -967,15 +978,24 @@ export function useSuperSelect(_ref3) {
|
|
|
967
978
|
getItemProps = _useInteractions.getItemProps;
|
|
968
979
|
function getLabelProps() {
|
|
969
980
|
return {
|
|
970
|
-
$hoverable: false
|
|
981
|
+
$hoverable: false,
|
|
982
|
+
id: labelId
|
|
971
983
|
};
|
|
972
984
|
}
|
|
973
985
|
function getMultiInputProps() {
|
|
974
|
-
return {
|
|
986
|
+
return _objectSpread(_objectSpread({
|
|
975
987
|
ref: searchRef,
|
|
976
988
|
placeholder: isEmpty() ? placeholder : '',
|
|
977
989
|
disabled: disabled,
|
|
990
|
+
role: 'combobox',
|
|
991
|
+
'aria-expanded': open,
|
|
978
992
|
'aria-controls': listId,
|
|
993
|
+
'aria-haspopup': 'listbox',
|
|
994
|
+
'aria-labelledby': computedLabelledBy,
|
|
995
|
+
'aria-activedescendant': activeDescendantId
|
|
996
|
+
}, ariaLabel && {
|
|
997
|
+
'aria-label': ariaLabel
|
|
998
|
+
}), {}, {
|
|
979
999
|
onKeyDown: function onKeyDown(e) {
|
|
980
1000
|
if (e.key === 'Tab') {
|
|
981
1001
|
if (open) {
|
|
@@ -993,7 +1013,7 @@ export function useSuperSelect(_ref3) {
|
|
|
993
1013
|
style: {
|
|
994
1014
|
opacity: activeTokenIndex === null ? 1 : 0
|
|
995
1015
|
}
|
|
996
|
-
};
|
|
1016
|
+
});
|
|
997
1017
|
}
|
|
998
1018
|
function getMultiValueProps(index) {
|
|
999
1019
|
return {
|
|
@@ -1017,14 +1037,22 @@ export function useSuperSelect(_ref3) {
|
|
|
1017
1037
|
};
|
|
1018
1038
|
}
|
|
1019
1039
|
function getSearchProps() {
|
|
1020
|
-
return {
|
|
1040
|
+
return _objectSpread(_objectSpread({
|
|
1041
|
+
role: 'combobox',
|
|
1042
|
+
'aria-haspopup': 'listbox',
|
|
1043
|
+
'aria-expanded': open,
|
|
1021
1044
|
'aria-controls': listId,
|
|
1045
|
+
'aria-labelledby': computedLabelledBy,
|
|
1046
|
+
'aria-activedescendant': activeDescendantId
|
|
1047
|
+
}, ariaLabel && {
|
|
1048
|
+
'aria-label': ariaLabel
|
|
1049
|
+
}), {}, {
|
|
1022
1050
|
onChange: function onChange(value) {
|
|
1023
1051
|
setSearchValue(value);
|
|
1024
1052
|
setActiveTokenIndex(null);
|
|
1025
1053
|
},
|
|
1026
1054
|
placeholder: i18n.t('core.select.search')
|
|
1027
|
-
};
|
|
1055
|
+
});
|
|
1028
1056
|
}
|
|
1029
1057
|
function getHeaderProps() {
|
|
1030
1058
|
return {
|
|
@@ -1051,7 +1079,6 @@ export function useSuperSelect(_ref3) {
|
|
|
1051
1079
|
}
|
|
1052
1080
|
function getClearProps() {
|
|
1053
1081
|
return {
|
|
1054
|
-
'aria-hidden': true,
|
|
1055
1082
|
'aria-label': i18n.t('core.select.clear'),
|
|
1056
1083
|
onClick: function onClick(e) {
|
|
1057
1084
|
// prevent the menu from closing
|
|
@@ -1078,7 +1105,7 @@ export function useSuperSelect(_ref3) {
|
|
|
1078
1105
|
};
|
|
1079
1106
|
return {
|
|
1080
1107
|
role: 'listbox',
|
|
1081
|
-
id:
|
|
1108
|
+
id: listId,
|
|
1082
1109
|
data: draggable ? queriedDraggableOptions : options,
|
|
1083
1110
|
components: {
|
|
1084
1111
|
Item: components === null || components === void 0 ? void 0 : components.Item // TODO fix type
|
|
@@ -1237,6 +1264,8 @@ export function useSuperSelect(_ref3) {
|
|
|
1237
1264
|
setActiveMenuIndex: setActiveMenuIndex,
|
|
1238
1265
|
sourceOptions: sourceOptions,
|
|
1239
1266
|
value: value,
|
|
1267
|
+
labelId: labelId,
|
|
1268
|
+
valueId: valueId,
|
|
1240
1269
|
width: width
|
|
1241
1270
|
},
|
|
1242
1271
|
props: {
|