@purpur/library 10.1.0 → 10.1.1
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.json +12 -0
- package/CHANGELOG.md +8 -1
- package/dist/components/accordion/src/accordion-item.d.ts +3 -3
- package/dist/components/accordion/src/accordion.d.ts +1 -1
- package/dist/components/alert-badge/src/alert-badge.d.ts +1 -1
- package/dist/components/breadcrumbs/src/breadcrumbs.d.ts +1 -1
- package/dist/components/card/src/card-badge.d.ts +1 -1
- package/dist/components/card/src/card-content-container.d.ts +2 -2
- package/dist/components/card/src/card-content.d.ts +2 -2
- package/dist/components/card/src/card-cta.d.ts +2 -2
- package/dist/components/card/src/card-media-layout.d.ts +1 -1
- package/dist/components/card/src/card-root.d.ts +2 -2
- package/dist/components/container/src/container.d.ts +2 -2
- package/dist/components/counter-badge/src/counter-badge.d.ts +1 -1
- package/dist/components/cta-link/src/cta-link.d.ts +10 -10
- package/dist/components/date-range-field/src/date-range-field.d.ts +1 -1
- package/dist/components/dismissable-chip-group/src/dismissable-chip-group-item.d.ts +2 -2
- package/dist/components/drawer/src/drawer-content.d.ts +2 -2
- package/dist/components/drawer/src/drawer-trigger.d.ts +2 -2
- package/dist/components/drawer/src/drawer.d.ts +1 -1
- package/dist/components/dropdown/src/dropdown-combobox.d.ts.map +1 -1
- package/dist/components/dropdown/src/useDropdown.d.ts +2 -2
- package/dist/components/field-error-text/src/field-error-text.d.ts +1 -1
- package/dist/components/footer/src/footer-social-link.d.ts +1 -1
- package/dist/components/footer/src/footer.d.ts +4 -4
- package/dist/components/grid/src/grid.d.ts +1 -1
- package/dist/components/grid/src/grid.item.d.ts +1 -1
- package/dist/components/heading/src/heading.d.ts +1 -1
- package/dist/components/hero-banner/src/hero-banner-actions.d.ts +2 -2
- package/dist/components/hero-banner/src/hero-banner-media.d.ts +2 -2
- package/dist/components/hero-banner/src/hero-banner-types.d.ts +3 -3
- package/dist/components/label/src/label.d.ts +1 -1
- package/dist/components/listbox/src/listbox-item.d.ts +2 -2
- package/dist/components/logo/src/logo.types.d.ts +1 -1
- package/dist/components/notification/src/notification.d.ts +2 -2
- package/dist/components/pagination/src/pagination-page-selector.d.ts +1 -1
- package/dist/components/pagination/src/pagination-page-size-selector.d.ts +2 -2
- package/dist/components/pagination/src/pagination-page-trigger.d.ts +2 -2
- package/dist/components/pagination/src/pagination-pages.d.ts +1 -1
- package/dist/components/pagination/src/pagination-step-trigger.d.ts +2 -2
- package/dist/components/pagination/src/types.d.ts +2 -2
- package/dist/components/pagination/src/use-page-options.hook.d.ts +2 -2
- package/dist/components/password-field/src/password-strength.d.ts +2 -2
- package/dist/components/product-card/src/product-card.d.ts +3 -3
- package/dist/components/promotion-card/src/promotion-card.d.ts +3 -3
- package/dist/components/quantity-selector/src/quantity-selector.d.ts +1 -1
- package/dist/components/radio-button-group/src/radio-button-group-root.d.ts +3 -3
- package/dist/components/radio-card-group/src/radio-card-group.d.ts +2 -2
- package/dist/components/rich-text/src/types.d.ts +1 -1
- package/dist/components/search-field/src/search-field.d.ts +6 -6
- package/dist/components/select/src/select.d.ts +2 -2
- package/dist/components/spacer/src/spacer.d.ts +1 -1
- package/dist/components/stepper/src/stepper-container.d.ts +1 -1
- package/dist/components/stepper/src/stepper-content.d.ts +2 -2
- package/dist/components/stepper/src/stepper.d.ts +1 -1
- package/dist/components/table/src/cell-types/button-group-cell.d.ts +3 -3
- package/dist/components/table/src/story-utils/table-data.d.ts +4 -4
- package/dist/components/table/src/table-content.d.ts +2 -2
- package/dist/components/table/src/table.d.ts +2 -2
- package/dist/components/table/src/test-utils/table-data.d.ts +3 -3
- package/dist/components/table/src/types.d.ts +1 -1
- package/dist/components/tabs/src/tab-content.d.ts +1 -1
- package/dist/components/text-area/src/text-area.d.ts +1 -1
- package/dist/components/text-field/src/text-field.d.ts +1 -1
- package/dist/country-flag-icon/LICENSE.txt +0 -11
- package/dist/dropdown-B7W5fErJ.js +2 -0
- package/dist/dropdown-B7W5fErJ.js.map +1 -0
- package/dist/{dropdown-DJr5COdU.mjs → dropdown-CxEElxNf.mjs} +359 -352
- package/dist/dropdown-CxEElxNf.mjs.map +1 -0
- package/dist/dropdown.cjs.js +1 -1
- package/dist/dropdown.es.js +1 -1
- package/dist/libraries/library/src/container.d.ts +1 -1
- package/dist/libraries/library/src/content-block.d.ts +1 -1
- package/dist/libraries/library/src/toggle.d.ts +2 -2
- package/dist/libraries/theme/src/ThemeProvider.d.ts +1 -1
- package/dist/library.cjs.js +1 -1
- package/dist/library.es.js +2 -2
- package/dist/{table-CY8rjMoR.mjs → table-7-6k_wGH.mjs} +2 -2
- package/dist/{table-CY8rjMoR.mjs.map → table-7-6k_wGH.mjs.map} +1 -1
- package/dist/{table-BkXNxvjW.js → table-CllIkAkM.js} +2 -2
- package/dist/{table-BkXNxvjW.js.map → table-CllIkAkM.js.map} +1 -1
- package/dist/table.cjs.js +1 -1
- package/dist/table.es.js +1 -1
- package/package.json +21 -21
- package/dist/dropdown-DJr5COdU.mjs.map +0 -1
- package/dist/dropdown-s8FhNU5N.js +0 -2
- package/dist/dropdown-s8FhNU5N.js.map +0 -1
|
@@ -19,7 +19,7 @@ export declare const SearchField: React.ForwardRefExoticComponent<(Omit<{
|
|
|
19
19
|
iconOnlySearchButton?: false;
|
|
20
20
|
searchButtonLabel: string;
|
|
21
21
|
variant: "button-attached";
|
|
22
|
-
} & Omit<import('../../text-field/src/text-field').TextFieldProps, "onChange" | "variant" | "afterField" | "endAdornment" | "startAdornment"> & {
|
|
22
|
+
} & Omit<import('../../text-field/src/text-field.tsx').TextFieldProps, "onChange" | "variant" | "afterField" | "endAdornment" | "startAdornment"> & {
|
|
23
23
|
onSelectSuggestion?: (option: import('@purpur/use-autocomplete').AutocompleteOption) => void;
|
|
24
24
|
openSuggestionsOnFocus?: boolean;
|
|
25
25
|
suggestionsMaxHeight?: string | number;
|
|
@@ -43,7 +43,7 @@ export declare const SearchField: React.ForwardRefExoticComponent<(Omit<{
|
|
|
43
43
|
iconOnlySearchButton: true;
|
|
44
44
|
searchButtonLabel: string;
|
|
45
45
|
variant: "button-attached";
|
|
46
|
-
} & Omit<import('../../text-field/src/text-field').TextFieldProps, "onChange" | "variant" | "afterField" | "endAdornment" | "startAdornment"> & {
|
|
46
|
+
} & Omit<import('../../text-field/src/text-field.tsx').TextFieldProps, "onChange" | "variant" | "afterField" | "endAdornment" | "startAdornment"> & {
|
|
47
47
|
onSelectSuggestion?: (option: import('@purpur/use-autocomplete').AutocompleteOption) => void;
|
|
48
48
|
openSuggestionsOnFocus?: boolean;
|
|
49
49
|
suggestionsMaxHeight?: string | number;
|
|
@@ -66,7 +66,7 @@ export declare const SearchField: React.ForwardRefExoticComponent<(Omit<{
|
|
|
66
66
|
} & {
|
|
67
67
|
searchButtonLabel?: never;
|
|
68
68
|
variant: "no-button";
|
|
69
|
-
} & Omit<import('../../text-field/src/text-field').TextFieldProps, "onChange" | "variant" | "afterField" | "endAdornment" | "startAdornment"> & {
|
|
69
|
+
} & Omit<import('../../text-field/src/text-field.tsx').TextFieldProps, "onChange" | "variant" | "afterField" | "endAdornment" | "startAdornment"> & {
|
|
70
70
|
onSelectSuggestion?: (option: import('@purpur/use-autocomplete').AutocompleteOption) => void;
|
|
71
71
|
openSuggestionsOnFocus?: boolean;
|
|
72
72
|
suggestionsMaxHeight?: string | number;
|
|
@@ -90,7 +90,7 @@ export declare const SearchField: React.ForwardRefExoticComponent<(Omit<{
|
|
|
90
90
|
iconOnlySearchButton?: false;
|
|
91
91
|
searchButtonLabel: string;
|
|
92
92
|
variant: "button-attached";
|
|
93
|
-
} & Omit<import('../../text-field/src/text-field').TextFieldProps, "onChange" | "variant" | "afterField" | "endAdornment" | "startAdornment"> & {
|
|
93
|
+
} & Omit<import('../../text-field/src/text-field.tsx').TextFieldProps, "onChange" | "variant" | "afterField" | "endAdornment" | "startAdornment"> & {
|
|
94
94
|
onSelectSuggestion?: (option: import('@purpur/use-autocomplete').AutocompleteOption) => void;
|
|
95
95
|
openSuggestionsOnFocus?: boolean;
|
|
96
96
|
suggestionsMaxHeight?: string | number;
|
|
@@ -114,7 +114,7 @@ export declare const SearchField: React.ForwardRefExoticComponent<(Omit<{
|
|
|
114
114
|
iconOnlySearchButton: true;
|
|
115
115
|
searchButtonLabel: string;
|
|
116
116
|
variant: "button-attached";
|
|
117
|
-
} & Omit<import('../../text-field/src/text-field').TextFieldProps, "onChange" | "variant" | "afterField" | "endAdornment" | "startAdornment"> & {
|
|
117
|
+
} & Omit<import('../../text-field/src/text-field.tsx').TextFieldProps, "onChange" | "variant" | "afterField" | "endAdornment" | "startAdornment"> & {
|
|
118
118
|
onSelectSuggestion?: (option: import('@purpur/use-autocomplete').AutocompleteOption) => void;
|
|
119
119
|
openSuggestionsOnFocus?: boolean;
|
|
120
120
|
suggestionsMaxHeight?: string | number;
|
|
@@ -137,7 +137,7 @@ export declare const SearchField: React.ForwardRefExoticComponent<(Omit<{
|
|
|
137
137
|
} & {
|
|
138
138
|
searchButtonLabel?: never;
|
|
139
139
|
variant: "no-button";
|
|
140
|
-
} & Omit<import('../../text-field/src/text-field').TextFieldProps, "onChange" | "variant" | "afterField" | "endAdornment" | "startAdornment"> & {
|
|
140
|
+
} & Omit<import('../../text-field/src/text-field.tsx').TextFieldProps, "onChange" | "variant" | "afterField" | "endAdornment" | "startAdornment"> & {
|
|
141
141
|
onSelectSuggestion?: (option: import('@purpur/use-autocomplete').AutocompleteOption) => void;
|
|
142
142
|
openSuggestionsOnFocus?: boolean;
|
|
143
143
|
suggestionsMaxHeight?: string | number;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
-
import { BaseProps } from '../../../libraries/common-types/src/common-types';
|
|
2
|
+
import { BaseProps } from '../../../libraries/common-types/src/common-types.ts';
|
|
3
3
|
export type SelectProps = Omit<BaseProps<"select">, "multiple" | "children"> & {
|
|
4
4
|
label?: string;
|
|
5
5
|
/**
|
|
@@ -76,4 +76,4 @@ export type SelectOptionGroup = {
|
|
|
76
76
|
options: SelectOption[];
|
|
77
77
|
};
|
|
78
78
|
export declare const Select: React.ForwardRefExoticComponent<Omit<SelectProps, "ref"> & React.RefAttributes<HTMLSelectElement>>;
|
|
79
|
-
//# sourceMappingURL=select.d.ts.
|
|
79
|
+
//# sourceMappingURL=select.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
-
import { BaseProps } from '../../../libraries/common-types/src/common-types
|
|
2
|
+
import { BaseProps } from '../../../libraries/common-types/src/common-types';
|
|
3
3
|
export declare const SPACER_SIZE: readonly ["xxxs", "xxs", "xs", "sm", "md", "lg", "xl", "xxl", "xxxl"];
|
|
4
4
|
export type SpacerSize = (typeof SPACER_SIZE)[number];
|
|
5
5
|
export type SpacerProps = Omit<BaseProps, "children"> & {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { default as React, ReactNode } from 'react';
|
|
2
|
-
import { BaseProps } from '../../../libraries/common-types/src/common-types';
|
|
2
|
+
import { BaseProps } from '../../../libraries/common-types/src/common-types.ts';
|
|
3
3
|
import { StepperVariant } from './types';
|
|
4
4
|
export type StepperContainerProps = Omit<BaseProps, "children"> & {
|
|
5
5
|
children: ReactNode;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { default as React, ReactElement, ReactNode } from 'react';
|
|
2
|
-
import { BaseProps } from '../../../libraries/common-types/src/common-types';
|
|
2
|
+
import { BaseProps } from '../../../libraries/common-types/src/common-types.ts';
|
|
3
3
|
import { Optional, Step } from './types';
|
|
4
4
|
export type StepperContentProps = Omit<BaseProps, "children"> & {
|
|
5
5
|
children: ReactNode;
|
|
6
6
|
} & Optional<Step, "disabled" | "finished">;
|
|
7
7
|
export declare const StepperContent: React.ForwardRefExoticComponent<Omit<StepperContentProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
8
8
|
export declare const isStepperContent: (child?: ReactNode) => child is ReactElement<StepperContentProps>;
|
|
9
|
-
//# sourceMappingURL=stepper-content.d.ts.
|
|
9
|
+
//# sourceMappingURL=stepper-content.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { default as React, ReactElement } from 'react';
|
|
2
|
-
import { BaseProps } from '../../../libraries/common-types/src/common-types
|
|
2
|
+
import { BaseProps } from '../../../libraries/common-types/src/common-types';
|
|
3
3
|
import { StepperContent } from './stepper-content';
|
|
4
4
|
import { StepChangeFunction, StepperVariant } from './types';
|
|
5
5
|
export type StepperProps = Omit<BaseProps, "children"> & {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { default as React, ReactElement } from 'react';
|
|
2
|
-
import { ButtonProps } from '../../../button/src/button';
|
|
3
|
-
import { IconProps } from '
|
|
2
|
+
import { ButtonProps } from '../../../button/src/button.tsx';
|
|
3
|
+
import { IconProps } from '@purpur/icon';
|
|
4
4
|
import { Cell, RowData } from '@tanstack/react-table';
|
|
5
5
|
type IconOnlyButtonVariant = Extract<ButtonProps, {
|
|
6
6
|
iconOnly: true;
|
|
@@ -16,4 +16,4 @@ export type ButtonGroupCellProps<TData> = {
|
|
|
16
16
|
};
|
|
17
17
|
export declare const ButtonGroupCell: <TData extends RowData>({ cell }: ButtonGroupCellProps<TData>) => React.JSX.Element;
|
|
18
18
|
export {};
|
|
19
|
-
//# sourceMappingURL=button-group-cell.d.ts.map
|
|
19
|
+
//# sourceMappingURL=button-group-cell.d.ts.maps.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
-
import { BadgeVariant } from '../../../badge/src/badge';
|
|
3
|
-
import { ButtonProps } from '../../../button/src/button';
|
|
4
|
-
import { LinkProps } from '../../../link/src/link';
|
|
2
|
+
import { BadgeVariant } from '../../../badge/src/badge.tsx';
|
|
3
|
+
import { ButtonProps } from '../../../button/src/button.tsx';
|
|
4
|
+
import { LinkProps } from '../../../link/src/link.tsx';
|
|
5
5
|
import { ButtonGroupButtonProp } from '../cell-types/button-group-cell';
|
|
6
6
|
export type TableData = {
|
|
7
7
|
id: number;
|
|
@@ -29,4 +29,4 @@ export type SimpleTableData = {
|
|
|
29
29
|
export declare const tableData: TableData[];
|
|
30
30
|
export declare const simpleTableData: SimpleTableData[];
|
|
31
31
|
export declare const generateLargeTableData: (rowCount: number) => TableData[];
|
|
32
|
-
//# sourceMappingURL=table-data.d.ts.
|
|
32
|
+
//# sourceMappingURL=table-data.d.ts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
2
|
import { UniqueIdentifier } from '@dnd-kit/core';
|
|
3
|
-
import { HeadingTagType } from '../../heading/src/heading';
|
|
3
|
+
import { HeadingTagType } from '../../heading/src/heading.tsx';
|
|
4
4
|
import { Row, Table, RowData } from '@tanstack/react-table';
|
|
5
5
|
type TableContentProps<TData extends RowData> = {
|
|
6
6
|
tanstackTable: Table<TData>;
|
|
@@ -28,4 +28,4 @@ type TableContentProps<TData extends RowData> = {
|
|
|
28
28
|
};
|
|
29
29
|
export declare function TableContent<TData extends RowData>({ tanstackTable, tableRows, fullWidth, tableHeader, loading, skeletonRows, isEmptyTable, stickyFirstColumn, getStickyColumn, isScrolled, showBorder, enableColumnDrag, activeId, getColumnWidths, variant, emptyTableHeadingTag, emptyTableCopy, emptyTableIcon, tableContainerId, }: TableContentProps<TData>): React.JSX.Element;
|
|
30
30
|
export {};
|
|
31
|
-
//# sourceMappingURL=table-content.d.ts.map
|
|
31
|
+
//# sourceMappingURL=table-content.d.ts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { default as React, ReactElement } from 'react';
|
|
2
2
|
import { ColumnDef, ColumnFiltersState, CoreOptions, PaginationState, RowData, RowSelectionState, SortingState, TableOptions, VisibilityState } from '@tanstack/react-table';
|
|
3
|
-
import { PaginationProps } from '../../pagination/src/pagination
|
|
3
|
+
import { PaginationProps } from '../../pagination/src/pagination';
|
|
4
4
|
import { WithActionBarProps, WithColumnDragProps, WithEmptyTableProps, WithLoadingProps, WithoutActionBarProps, WithoutColumnDragProps, WithoutEmptyTableProps, WithoutLoadingProps, WithoutRowSelectionProps, WithoutToolbarProps, WithRowSelectionProps, WithSortingProps, WithToolbarProps } from './types';
|
|
5
5
|
export { createColumnHelper } from '@tanstack/react-table';
|
|
6
6
|
export type { ColumnDef, ColumnFiltersState, CoreOptions, PaginationState, RowData, RowSelectionState, SortingState, TableOptions, VisibilityState, };
|
|
@@ -28,4 +28,4 @@ export declare const Table: {
|
|
|
28
28
|
<TData extends RowData>({ actionbarCopy, actionBarTotalRowCount, className, columns, data, emptyTableCopy, emptyTableHeadingTag, emptyTableIcon, enableActionBar, enableToolbar, exportDrawerCopy, exportFormats, fullWidth, loading, paginationComponent, rowSelectionAriaLabels, settingsDrawerCopy, showOnlySelectedRows, skeletonRows, sortingAriaLabels, state, controlledShowColumnFilters, onShowColumnFiltersChange, controlledStickyFirstColumn, onStickyFirstColumnChange, defaultShowColumnFilters, defaultStickyFirstColumn, stickyFirstColumn: stickyFirstColumnDeprecated, toolbarCopy, toolbarTotalRowCount, variant, getRowId, onExportData, onRowsCountChange, controlledExpanded, defaultExpanded, onToggleExpand, onPrimaryButtonClick, onSecondaryButtonClick, setShowOnlySelectedRows, drawerZIndex, enableColumnDrag, columnDragAriaLabelsCopy, ...props }: TableProps<TData>): React.JSX.Element;
|
|
29
29
|
displayName: string;
|
|
30
30
|
};
|
|
31
|
-
//# sourceMappingURL=table.d.ts.map
|
|
31
|
+
//# sourceMappingURL=table.d.ts.map.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { BadgeVariant } from '../../../badge/src/badge
|
|
2
|
-
import { ButtonProps } from '../../../button/src/button
|
|
1
|
+
import { BadgeVariant } from '../../../badge/src/badge';
|
|
2
|
+
import { ButtonProps } from '../../../button/src/button';
|
|
3
3
|
import { ButtonGroupButtonProp } from '../cell-types/button-group-cell';
|
|
4
4
|
export type TableDataLarge = {
|
|
5
5
|
id: number;
|
|
@@ -29,4 +29,4 @@ export type TableDataSmall = {
|
|
|
29
29
|
age: number;
|
|
30
30
|
};
|
|
31
31
|
export declare const tableDataSmall: TableDataSmall[];
|
|
32
|
-
//# sourceMappingURL=table-data.d.ts.map
|
|
32
|
+
//# sourceMappingURL=table-data.d.ts.mapd.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { default as React, ReactElement, ReactNode } from 'react';
|
|
2
|
-
import { BaseProps } from '../../../libraries/common-types/src/common-types';
|
|
2
|
+
import { BaseProps } from '../../../libraries/common-types/src/common-types.ts';
|
|
3
3
|
export type TabContentProps = Omit<BaseProps, "children"> & {
|
|
4
4
|
/**
|
|
5
5
|
* Content to be rendered inside a `button` element.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
-
import { BaseProps } from '../../../libraries/common-types/src/common-types
|
|
2
|
+
import { BaseProps } from '../../../libraries/common-types/src/common-types';
|
|
3
3
|
export declare const ResizeOption: {
|
|
4
4
|
readonly NONE: "none";
|
|
5
5
|
readonly BOTH: "both";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { default as React, HTMLInputTypeAttribute, ReactElement, ReactNode } from 'react';
|
|
2
|
-
import { BaseProps } from '../../../libraries/common-types/src/common-types
|
|
2
|
+
import { BaseProps } from '../../../libraries/common-types/src/common-types';
|
|
3
3
|
export declare const textFieldVariants: readonly ["default", "ai"];
|
|
4
4
|
export type TextFieldVariant = (typeof textFieldVariants)[number];
|
|
5
5
|
type TextFieldCommonProps = {
|
|
@@ -1,14 +1,3 @@
|
|
|
1
|
-
Name: change-case
|
|
2
|
-
Version: 5.4.4
|
|
3
|
-
License: MIT
|
|
4
|
-
Private: false
|
|
5
|
-
Description: Transform a string between `camelCase`, `PascalCase`, `Capital Case`, `snake_case`, `kebab-case`, `CONSTANT_CASE` and others
|
|
6
|
-
Repository: git://github.com/blakeembrey/change-case.git
|
|
7
|
-
Homepage: https://github.com/blakeembrey/change-case/tree/master/packages/change-case#readme
|
|
8
|
-
Author: Blake Embrey <hello@blakeembrey.com> (http://blakeembrey.me)
|
|
9
|
-
|
|
10
|
-
---
|
|
11
|
-
|
|
12
1
|
Name: classnames
|
|
13
2
|
Version: 2.5.1
|
|
14
3
|
License: MIT
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";const o=require("react/jsx-runtime"),k=require("react"),ue=require("./listbox-lXO21cJV.js"),Te=require("./use-autocomplete.es-BwAzMcau.js"),we=require("./checkbox-qjWQEoa5.js"),ve=require("./dismissable-chip-group-5ALErhD2.js"),Be=require("./field-error-text-FhQulSV5.js"),Fe=require("./field-helper-text-DSKO-Tce.js"),Pe=require("./check-circle-filled.es-5-GXE9l4.js"),qe=require("./chevron-down.es-BMjgiS3F.js"),Ke=require("./label-yHK80hhV.js"),Ve=require("./spinner-tKunS_o-.js"),He=require("./bind-DeUYJ6m9.js"),re=e=>typeof e.label=="string"?e.label:e.value??"",Me={"purpur-dropdown":"_purpur-dropdown_p8b57_1","purpur-dropdown--negative":"_purpur-dropdown--negative_p8b57_14","purpur-dropdown__label":"_purpur-dropdown__label_p8b57_17","purpur-dropdown__field-row":"_purpur-dropdown__field-row_p8b57_22","purpur-dropdown__frame":"_purpur-dropdown__frame_p8b57_26","purpur-dropdown__frame--negative":"_purpur-dropdown__frame--negative_p8b57_33","purpur-dropdown__trigger-container":"_purpur-dropdown__trigger-container_p8b57_36","purpur-dropdown__chip-group":"_purpur-dropdown__chip-group_p8b57_48","purpur-dropdown__trigger-container--has-tags":"_purpur-dropdown__trigger-container--has-tags_p8b57_52","purpur-dropdown__trigger-container--disabled":"_purpur-dropdown__trigger-container--disabled_p8b57_55","purpur-dropdown__trigger-container--readonly":"_purpur-dropdown__trigger-container--readonly_p8b57_55","purpur-dropdown__trigger-container--negative":"_purpur-dropdown__trigger-container--negative_p8b57_62","purpur-dropdown__trigger-container--error":"_purpur-dropdown__trigger-container--error_p8b57_65","purpur-dropdown__trigger-container--is-valid":"_purpur-dropdown__trigger-container--is-valid_p8b57_68","purpur-dropdown__input":"_purpur-dropdown__input_p8b57_71","purpur-dropdown__trigger":"_purpur-dropdown__trigger_p8b57_36","purpur-dropdown__trigger--placeholder":"_purpur-dropdown__trigger--placeholder_p8b57_119","purpur-dropdown__trigger--is-valid":"_purpur-dropdown__trigger--is-valid_p8b57_122","purpur-dropdown__trigger--disabled":"_purpur-dropdown__trigger--disabled_p8b57_125","purpur-dropdown__trigger--readonly":"_purpur-dropdown__trigger--readonly_p8b57_129","purpur-dropdown__trigger--negative":"_purpur-dropdown__trigger--negative_p8b57_133","purpur-dropdown__trigger-text":"_purpur-dropdown__trigger-text_p8b57_146","purpur-dropdown__combobox-container":"_purpur-dropdown__combobox-container_p8b57_152","purpur-dropdown__combobox-container--disabled":"_purpur-dropdown__combobox-container--disabled_p8b57_162","purpur-dropdown__combobox-container--readonly":"_purpur-dropdown__combobox-container--readonly_p8b57_169","purpur-dropdown__combobox-container--error":"_purpur-dropdown__combobox-container--error_p8b57_176","purpur-dropdown__combobox-container--is-valid":"_purpur-dropdown__combobox-container--is-valid_p8b57_179","purpur-dropdown__combobox-container--negative":"_purpur-dropdown__combobox-container--negative_p8b57_182","purpur-dropdown__input--negative":"_purpur-dropdown__input--negative_p8b57_221","purpur-dropdown__chip-group--select":"_purpur-dropdown__chip-group--select_p8b57_244","purpur-dropdown__chip-group-more":"_purpur-dropdown__chip-group-more_p8b57_250","purpur-dropdown__end-adornments":"_purpur-dropdown__end-adornments_p8b57_261","purpur-dropdown__chevron-icon":"_purpur-dropdown__chevron-icon_p8b57_272","purpur-dropdown__chevron-icon--open":"_purpur-dropdown__chevron-icon--open_p8b57_277","purpur-dropdown__chevron-icon--disabled":"_purpur-dropdown__chevron-icon--disabled_p8b57_280","purpur-dropdown__chevron-icon--readonly":"_purpur-dropdown__chevron-icon--readonly_p8b57_283","purpur-dropdown__chevron-icon--negative":"_purpur-dropdown__chevron-icon--negative_p8b57_286","purpur-dropdown__valid-icon":"_purpur-dropdown__valid-icon_p8b57_289","purpur-dropdown__listbox":"_purpur-dropdown__listbox_p8b57_292","purpur-dropdown__checkbox-item-multiple":"_purpur-dropdown__checkbox-item-multiple_p8b57_301","purpur-dropdown__checkbox-container":"_purpur-dropdown__checkbox-container_p8b57_304","purpur-dropdown__checkbox-container--disabled":"_purpur-dropdown__checkbox-container--disabled_p8b57_311","purpur-dropdown__select-all-child":"_purpur-dropdown__select-all-child_p8b57_314"},x=He.c.bind(Me),r="purpur-dropdown",ye=({fieldId:e,htmlForSuffix:n,label:s,getTestId:l,disabled:i,negative:u,required:h})=>s?o.jsxs(Ke.Label,{htmlFor:n?`${e}-${n}`:e,className:x(`${r}__label`),"data-testid":l("label"),disabled:i,negative:u,children:[h&&o.jsx("span",{"aria-hidden":!0,children:"*"}),s]}):null,Se=({getTestId:e,loading:n,disabled:s,negative:l,isValid:i,isOpen:u,readOnly:h,showChevronOpen:m})=>o.jsx("span",{className:x(`${r}__end-adornments`),children:n?o.jsx(Ve.Spinner,{disabled:s,size:"xxs",negative:l,"data-testid":e("spinner")}):o.jsxs(o.Fragment,{children:[i&&o.jsx(Pe.r,{"data-testid":e("valid-icon"),className:x(`${r}__valid-icon`)}),o.jsx(qe.l,{className:x(`${r}__chevron-icon`,{[`${r}__chevron-icon--open`]:m&&u,[`${r}__chevron-icon--disabled`]:s,[`${r}__chevron-icon--readonly`]:h&&!s,[`${r}__chevron-icon--is-valid`]:i,[`${r}__chevron-icon--negative`]:l}),"data-testid":e("dropdown-icon"),size:"sm"})]})}),$e=6,Ie=({selectedItems:e,getTestId:n,disabled:s,negative:l,onRemove:i,isSelect:u,moreOptionsText:h,removeOptionAriaLabel:m})=>{if(!e.length)return null;const p=h!==void 0&&e.length>$e?e.slice(-$e):e,g=e.length-p.length;return o.jsxs(ve.DismissableChipGroup,{className:x(`${r}__chip-group`,{[`${r}__chip-group--select`]:u}),negative:l,"data-testid":n("tags"),size:"sm",children:[p.map(c=>o.jsx(ve.DismissableChipGroup.Item,{id:c.id,"data-testid":n(`tag-${c.id}`),"aria-label":m?`${m} ${re(c)}`:re(c),onDismiss:()=>{i(c)},disabled:s||c.disabled,children:c.label},c.id)),g>0&&o.jsx("li",{className:x(`${r}__chip-group-more`),"data-testid":n("tags-more"),children:`+${g} ${h}`})]})},Ce=({errorText:e,helperText:n,helperTextId:s,negative:l})=>o.jsxs(o.Fragment,{children:[e&&o.jsx(Be.FieldErrorText,{negative:l,children:e}),n&&!e&&o.jsx(Fe.FieldHelperText,{id:s,negative:l,children:n})]}),se="__purpur-dropdown-select-all__",ke=({selectAllLabel:e,multiple:n,options:s,selectedItems:l})=>!e||!n||s.filter(m=>!m.disabled).length===0?!1:!s.filter(m=>m.disabled).some(m=>!l.some(O=>O.id===m.id)),Oe=({optionsToShow:e,getListboxItemProps:n,multiple:s,negative:l,fieldId:i,noOptionsText:u,selectAllLabel:h,selectedItems:m=[]})=>{if(u!==void 0&&!e.length)return o.jsx(ue.Listbox.Item,{noninteractive:!0,children:u});const O=e[0]?.id===se;let p=!1;if(O){const c=e.filter(d=>d.id!==se).filter(d=>!d.disabled),_=c.filter(d=>m.some(v=>v.id===d.id)).length,y=c.length>0&&_===c.length,f=m.length>0;p=y?!0:f?"indeterminate":!1}return e.map((g,c)=>{const{key:_,selected:y,...f}=n(g,c);return g.id===se?o.jsx(ue.Listbox.Item,{...f,"aria-selected":p===!0,className:x(`${r}__checkbox-item-multiple`,`${r}__select-all-item`),hideSelectedIcon:!0,children:o.jsx("span",{className:x(`${r}__checkbox-container`),children:o.jsx(we.Checkbox,{id:`${i}-checkbox-select-all`,checked:p,label:h,negative:l,"aria-hidden":!0})})},_):s?o.jsx(ue.Listbox.Item,{...f,className:x(`${r}__checkbox-item-multiple`,{[`${r}__select-all-child`]:O}),selected:!!y,hideSelectedIcon:!0,children:o.jsx("span",{className:x(`${r}__checkbox-container`,{[`${r}__checkbox-container--disabled`]:g.disabled}),children:o.jsx(we.Checkbox,{id:`${i}-checkbox-${g.id}`,checked:!!y,label:g.label,negative:l,"aria-hidden":!0,disabled:g.disabled})})},_):o.jsx(ue.Listbox.Item,{...f,selected:!!y,children:o.jsx("div",{children:g.label})},_)})},Ue=(e,n,s)=>{if(s)return e.filter(i=>s(n,i));if(!n)return e;const l=n.toUpperCase().split(" ");return e.filter(i=>l.every(u=>(i.value||(typeof i.label=="string"?i.label:"")).toUpperCase().includes(u)))},je=({options:e,searchTerm:n,filterOption:s,selectedOption:l,multiple:i})=>!i&&l&&re(l)===n?e:Ue(e,n,s),De=({controlledInputValue:e,defaultInputValue:n,selectedOption:s,onInputChange:l})=>{const[i,u]=k.useState((typeof e=="string"?e:n??(s?re(s):void 0))??"");return{displayInputValue:typeof e=="string"?e:i,populateInputField:O=>{l?.(O),u(O)}}},Re=k.forwardRef((e,n)=>{const{id:s,label:l,options:i,className:u,errorText:h,helperText:m,placeholder:O,negative:p=!1,readOnly:g=!1,disabled:c=!1,required:_=!1,valid:y,loading:f,multiple:d=!1,selectedOption:v,selectedOptions:L=[],onSelect:S,openOnFocus:de=!1,listboxMaxHeight:N,listboxLabel:_e,filterOption:F,inputValue:te,defaultInputValue:Y,onInputChange:b,noOptionsText:oe,highlightFirstOption:P=!1,selectAllLabel:j,moreOptionsText:Z,removeOptionAriaLabel:E,["data-testid"]:C}=e,G=k.useId(),q=s??G,D=a=>C?`${C}-${a}`:void 0,z=!!y&&!h,W=`${q}-helper-text`,$=d?L:v?[v]:[],{displayInputValue:H,populateInputField:X}=De({controlledInputValue:te,defaultInputValue:Y,selectedOption:v,onInputChange:b}),le=je({options:i,searchTerm:H,filterOption:F,selectedOption:v,multiple:d}),ce=ke({selectAllLabel:j,multiple:d,options:i,selectedItems:$}),ne=ce&&(ce&&!H)?[{id:se,label:j},...le]:le,K=()=>{const a=i.filter(R=>!R.disabled);if(a.every(R=>$.some(B=>B.id===R.id))){const R=$.filter(B=>B.disabled);S?.(void 0,R)}else{const B=[...$.filter(me=>me.disabled),...a];S?.(void 0,B)}X("")},be=a=>{if(a.id===se){K();return}if(d){const R=$.some(B=>B.id===a.id)?$.filter(B=>B.id!==a.id):[...$,a];S?.(a,R),X("")}else S?.(a,[a]),X(re(a))},{rootRef:J,inputRef:ee,inputProps:M,listboxProps:ae,getListboxItemProps:he,isOpen:w,openListbox:U,anchorStyle:A}=Te.te({id:q,options:ne,listboxLabel:_e||l||"Options",selectedOption:d?void 0:v,disabled:c,readOnly:g,openOnFocus:de,listboxMaxHeight:N,highlightFirstOption:P,closeOnSelect:!d,noOptionsText:oe,negative:p,onSelect:be,"data-testid":C}),Q=a=>{J.current=a,typeof n=="function"?n(a):n&&(n.current=a)},ge=(a,I)=>{const R=he(a,I);if(d){const B=$.some(me=>me.id===a.id);return{...R,selected:B,"aria-selected":B}}return R},t=a=>{const I=$.filter(R=>R.id!==a.id);S?.(a,I)},T=a=>{if(d&&a.key==="Backspace"&&a.currentTarget.value===""&&$.length>0){for(let I=$.length-1;I>=0;I--)if(!$[I].disabled){t($[I]);break}}M?.onKeyDown?.(a)},pe=a=>{X(a.target.value),w||U()},V=a=>{M?.onBlur?.(a),!d&&setTimeout(()=>{if(J.current?.contains(document.activeElement))return;const I=v?re(v):"";H!==I&&X(I)})},xe=a=>{if(c||g)return;const I=a.target;if(I===ee.current||I.closest("button"))return;const R=ee.current;R?.dispatchEvent(new MouseEvent("mousedown",{bubbles:!0})),R?.focus()},ie=d&&!!j&&i.length>0&&i.every(a=>$.some(I=>I.id===a.id)),Ae=x(r,u,{[`${r}--negative`]:p});return o.jsxs("div",{ref:Q,className:Ae,children:[o.jsx(ye,{fieldId:q,htmlForSuffix:"input",label:l,getTestId:D,disabled:c,negative:p,required:_}),o.jsx("div",{className:x(`${r}__field-row`),children:o.jsxs("div",{className:x(`${r}__combobox-container`,{[`${r}__combobox-container--error`]:!!h,[`${r}__combobox-container--is-valid`]:z,[`${r}__combobox-container--negative`]:p,[`${r}__combobox-container--disabled`]:c,[`${r}__combobox-container--readonly`]:g&&!c}),style:A,onClick:xe,children:[d&&!ie&&o.jsx(Ie,{selectedItems:$,getTestId:D,disabled:c,negative:p,onRemove:t,moreOptionsText:Z,removeOptionAriaLabel:E}),o.jsx("input",{...M,ref:ee,id:`${q}-input`,"data-testid":D("input"),onKeyDown:T,onChange:pe,onBlur:V,value:ie&&!H?j:H,placeholder:O,className:x(`${r}__input`,{[`${r}__input--negative`]:p}),"aria-describedby":W,"aria-invalid":!!h,disabled:c,readOnly:g}),o.jsx(Se,{getTestId:D,loading:f,disabled:c,negative:p,isValid:z,isOpen:w,showChevronOpen:!0}),o.jsx("span",{className:x(`${r}__frame`,{[`${r}__frame--negative`]:p})})]})}),w&&o.jsx(ue.Listbox,{...ae,className:x(`${r}__listbox`),children:Oe({optionsToShow:ne,getListboxItemProps:ge,multiple:d,negative:p,fieldId:q,noOptionsText:oe,selectAllLabel:j,selectedItems:$})}),o.jsx(Ce,{errorText:h,helperText:m,helperTextId:W,negative:p})]})});Re.displayName="DropdownCombobox";const Ye=({options:e,highlightFirstOption:n})=>{const s=k.useRef(null),l=k.useRef({}),[i,u]=k.useState(n?e[0]:void 0),h=_=>{if(_){const y=_.getBoundingClientRect(),f=s.current?.getBoundingClientRect()||{top:0,bottom:0};(y.top<f.top||y.bottom>f.bottom)&&_.scrollIntoView({block:"nearest"})}};return{highlightedOption:i,listboxRef:s,optionRefs:l,findNextOption:(_,y)=>{const f=y.filter(v=>!v.disabled);if(!f.length)return;const d=i?f.findIndex(v=>v.id===i.id):-1;return _==="ArrowDown"?f[(d+1)%f.length]:f[(d-1+f.length)%f.length]},highlightOption:_=>{u(_?{..._}:void 0),_&&h(l.current[_.id])},highlightByClick:_=>{_.id!==i?.id&&u({..._,isSetByClickEvent:!0})},highlightSelected:(_,y)=>{requestAnimationFrame(()=>{u({..._,isSetByClickEvent:y==="CLICK"}),h(l.current[_.id])})},resetHighlight:()=>{u(void 0)}}},Ge=(e,n)=>{const s=k.useCallback(l=>{e&&!e.contains(l.target)&&n()},[n,e]);k.useEffect(()=>(document.addEventListener("mousedown",s),()=>{document.removeEventListener("mousedown",s)}),[s])},Le=({id:e,variant:n,options:s,listboxLabel:l,multiple:i=!1,selectedOption:u,selectedOptions:h=[],onSelect:m,filterOption:O,inputValue:p,defaultInputValue:g,onInputChange:c,noOptionsText:_,highlightFirstOption:y=!1,openOnFocus:f=!1,listboxMaxHeight:d,negative:v,disabled:L=!1,readOnly:S=!1,["data-testid"]:de})=>{const N=n==="combobox",_e=k.useId(),F=k.useRef(null),te=k.useRef(null),Y=k.useRef(null),b=Ye({options:s,highlightFirstOption:y}),{displayInputValue:oe,populateInputField:P}=De({controlledInputValue:p,defaultInputValue:g,selectedOption:u,onInputChange:c}),[j,Z]=k.useState(!1),E=()=>{Z(!1),b.resetHighlight()};Ge(F.current,E);const C=({eventType:t})=>{Z(!0);const T=i?void 0:u;T&&b.highlightSelected(T,t)},G=i?h:u?[u]:[],q=N?je({options:s,searchTerm:oe,filterOption:O,selectedOption:u,multiple:i}):s,D=j&&(!!q.length||!!_),z=t=>de?`${de}-${t}`:void 0,W=t=>{if(!(!t||t.disabled))if(i){const pe=G.some(V=>V.id===t.id)?G.filter(V=>V.id!==t.id):[...G,t];m?.(t,pe),N&&(P(""),Y.current?.focus())}else m?.(t,[t]),N&&P(re(t)),E(),(N?Y:te).current?.focus()},$=t=>{D||C({eventType:"KEYBOARD"});const T=b.findNextOption(t,q);b.highlightOption(T)},H=t=>{if(!(L||S))switch(t.key){case"ArrowUp":case"ArrowDown":t.preventDefault(),$(t.key);break;case"Enter":{t.preventDefault(),D&&b.highlightedOption?W(b.highlightedOption):D||C({eventType:"KEYBOARD"});break}case" ":{N||(t.preventDefault(),D&&b.highlightedOption?W(b.highlightedOption):D||C({eventType:"KEYBOARD"}));break}case"Escape":t.preventDefault(),E();break;case"Tab":E();break;case"Home":case"End":N&&E();break}},X=t=>{P(t.target.value),b.resetHighlight(),j||C({eventType:"KEYBOARD"})},le=()=>{L||S||(j?E():C({eventType:"CLICK"}))},ce=()=>{!j&&f&&!L&&!S&&C({eventType:"KEYBOARD"}),Y.current?.select()},fe=()=>{setTimeout(()=>{const t=document.activeElement;t!==document.body&&!Y.current?.contains(t)&&!b.listboxRef.current?.contains(t)&&!F.current?.contains(t)&&(E(),N&&!i&&P(u?re(u):""))})},ne=()=>{L||S||(j?E():C({eventType:"CLICK"}))},K=t=>{if(L||S)return;const T=t.target.closest("button");T&&T!==te.current||ne()},be=()=>{!j&&f&&!L&&!S&&C({eventType:"KEYBOARD"})},J=`${e}-listbox`,ee=t=>`${e}-listbox-item-${t.id}`,M=`--purpur-dropdown-${_e.replace(/:/g,"")}`,ae={anchorName:M},he=N?null:{onClick:K},w=k.useCallback(t=>{if(b.listboxRef.current=t,t&&typeof t.showPopover=="function")try{t.showPopover()}catch{}},[b.listboxRef]),U={"aria-label":l,"aria-expanded":D,"data-testid":z("listbox"),id:J,ref:w,onMouseLeave:()=>b.resetHighlight(),popover:"manual",negative:v,style:{...d?{maxHeight:typeof d=="number"?`${d}px`:d}:{},positionAnchor:M}},A=(t,T)=>{const pe=G.some(ie=>ie.id===t.id),{highlightedOption:V}=b,xe=(t.id===V?.id||y&&!V&&T===0)&&!V?.isSetByClickEvent;return{"data-testid":z(`listbox-item-${t.id}`),id:ee(t),key:t.id,onMouseMove:()=>b.highlightByClick(t),onMouseUp:()=>W(t),ref:ie=>{ie&&(b.optionRefs.current[t.id]=ie)},tabIndex:-1,selected:pe,disabled:t.disabled,highlighted:xe,hovered:t.id===V?.id&&!!V?.isSetByClickEvent,"aria-selected":pe}},Q=N?{}:{ref:te,type:"button",role:"combobox","aria-haspopup":"listbox","aria-expanded":D,"aria-controls":J,"aria-disabled":L,"data-testid":z("trigger"),id:`${e}-trigger`,onKeyDown:H,onFocus:be,disabled:L,tabIndex:L?-1:0,style:ae},ge=N?{ref:Y,role:"combobox","aria-autocomplete":"list","aria-expanded":D,"aria-controls":J,"aria-activedescendant":b.highlightedOption?ee(b.highlightedOption):void 0,"data-testid":z("input"),autoComplete:"off",id:`${e}-input`,type:"text",value:oe,onChange:X,onMouseDown:le,onFocus:ce,onBlur:fe,onKeyDown:H,disabled:L,readOnly:S}:null;return{rootRef:F,triggerContainerProps:he,triggerProps:Q,inputProps:ge,listboxProps:U,getListboxItemProps:A,optionsToShow:q,isOpen:D,highlightedOption:b.highlightedOption,selectedItems:G,anchorStyle:ae}},Ne=k.forwardRef((e,n)=>{const{id:s,label:l,options:i,className:u,errorText:h,helperText:m,placeholder:O,negative:p=!1,readOnly:g=!1,disabled:c=!1,required:_=!1,valid:y=!1,loading:f=!1,multiple:d=!1,selectedOption:v,selectedOptions:L=[],onSelect:S,openOnFocus:de=!1,listboxMaxHeight:N,listboxLabel:_e,selectAllLabel:F,moreOptionsText:te,removeOptionAriaLabel:Y,["data-testid"]:b}=e,oe=k.useId(),P=s??oe,j=w=>b?`${b}-${w}`:void 0,Z=!!y&&!h,E=`${P}-helper-text`,C=d?L:v?[v]:[],G=ke({selectAllLabel:F,multiple:d,options:i,selectedItems:C}),q=()=>{const w=i.filter(A=>!A.disabled);if(w.every(A=>C.some(Q=>Q.id===A.id))){const A=C.filter(Q=>Q.disabled);S?.(void 0,A)}else{const Q=[...C.filter(ge=>ge.disabled),...w];S?.(void 0,Q)}},D=(w,U)=>{if(w?.id===se){q();return}S?.(w,U)},z=G?[{id:se,label:F},...i]:i,W=Le({id:P,variant:"select",options:z,listboxLabel:_e||l||"Options",multiple:d,negative:p,selectedOption:v,selectedOptions:L,onSelect:D,openOnFocus:de,listboxMaxHeight:N,disabled:c,readOnly:g,"data-testid":b}),$=w=>{W.rootRef.current=w,typeof n=="function"?n(w):n&&(n.current=w)},{triggerContainerProps:H,triggerProps:X,listboxProps:le,getListboxItemProps:ce,optionsToShow:fe,isOpen:ne,selectedItems:K,anchorStyle:be}=W,J={...X};delete J.style;const ee=w=>{const U=K.filter(A=>A.id!==w.id);S?.(w,U)},M=d&&!!F&&i.length>0&&i.every(w=>K.some(U=>U.id===w.id)),ae=d?M?F:K.length===0&&O||"":v?.label||O||"",he=x(r,u,{[`${r}--negative`]:p});return o.jsxs("div",{ref:$,className:he,children:[o.jsx(ye,{fieldId:P,htmlForSuffix:"trigger",label:l,getTestId:j,disabled:c,negative:p,required:_}),o.jsx("div",{className:x(`${r}__field-row`),children:o.jsxs("div",{...H,className:x(`${r}__trigger-container`,{[`${r}__trigger-container--error`]:!!h,[`${r}__trigger-container--is-valid`]:Z,[`${r}__trigger-container--negative`]:p,[`${r}__trigger-container--disabled`]:c,[`${r}__trigger-container--readonly`]:g&&!c,[`${r}__trigger-container--has-tags`]:d&&K.length>0&&!M}),style:be,children:[d&&!M&&o.jsx(Ie,{selectedItems:K,getTestId:j,disabled:c,negative:p,onRemove:ee,moreOptionsText:te,removeOptionAriaLabel:Y,isSelect:!0}),o.jsx("button",{...J,className:x(`${r}__trigger`,{[`${r}__trigger--is-valid`]:Z,[`${r}__trigger--negative`]:p,[`${r}__trigger--disabled`]:c,[`${r}__trigger--readonly`]:g&&!c,[`${r}__trigger--placeholder`]:!K.length}),"aria-describedby":E,children:o.jsx("span",{className:x(`${r}__trigger-text`),children:ae})}),o.jsx(Se,{getTestId:j,loading:f,disabled:c,negative:p,isValid:Z,isOpen:ne,readOnly:g,showChevronOpen:!0}),o.jsx("span",{className:x(`${r}__frame`,{[`${r}__frame--negative`]:p})})]})}),ne&&o.jsx(ue.Listbox,{...le,className:x(`${r}__listbox`),children:Oe({optionsToShow:fe,getListboxItemProps:ce,multiple:d,negative:p,fieldId:P,selectAllLabel:F,selectedItems:K})}),o.jsx(Ce,{errorText:h,helperText:m,helperTextId:E,negative:p})]})});Ne.displayName="DropdownSelect";const Ee=k.forwardRef((e,n)=>e.combobox?o.jsx(Re,{ref:n,...e}):o.jsx(Ne,{ref:n,...e}));Ee.displayName="Dropdown";exports.Dropdown=Ee;exports.useDropdown=Le;
|
|
2
|
+
//# sourceMappingURL=dropdown-B7W5fErJ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dropdown-B7W5fErJ.js","sources":["../../../components/dropdown/src/dropdown.types.ts","../../../components/dropdown/src/dropdown-shared.tsx","../../../components/dropdown/src/useDropdownFilter.ts","../../../components/dropdown/src/useDropdownInput.ts","../../../components/dropdown/src/dropdown-combobox.tsx","../../../components/dropdown/src/useDropdownHighlight.ts","../../../components/dropdown/src/useOnClickOutside.ts","../../../components/dropdown/src/useDropdown.ts","../../../components/dropdown/src/dropdown-select.tsx","../../../components/dropdown/src/dropdown.tsx"],"sourcesContent":["export type DropdownOption = {\n /**\n * Content rendered for this option in the trigger and listbox. Accepts any `ReactNode`.\n * For `combobox` mode, text-input syncing and the default search filter require a plain\n * `string` — non-string labels fall back to `value` for those, so provide `value`\n * (or a custom `filterOption`) when using a non-string label with `combobox`.\n */\n label: React.ReactNode;\n id: string;\n value?: string;\n disabled?: boolean;\n};\n\n/** Plain-text form of an option's label, for text inputs, search filtering, and ARIA strings. */\nexport const getOptionLabelText = (option: Pick<DropdownOption, \"label\" | \"value\">): string =>\n typeof option.label === \"string\" ? option.label : option.value ?? \"\";\n\n/** Shared props across all variants */\ntype DropdownBaseProps = {\n /** Unique id used to prefix all sub-element ids. */\n id?: string;\n /** Visible label rendered above the field. */\n label?: string;\n /** Accessible label for the listbox popup (required for select/combobox). */\n listboxLabel?: string;\n /** Placeholder text shown when no value is selected. */\n placeholder?: string;\n /** Helper text rendered below the field. */\n helperText?: string;\n /** Error text rendered below the field. Puts the field in an error state. */\n errorText?: string;\n /** Render the field with a valid (success) appearance. */\n valid?: boolean;\n /** Show a loading spinner inside the field. */\n loading?: boolean;\n /** Render on dark backgrounds. */\n negative?: boolean;\n /** Mark the field as required. */\n required?: boolean;\n /** Disable the field. */\n disabled?: boolean;\n /** Make the field read-only. */\n readOnly?: boolean;\n /**\n * Label for the \"Select all\" option. Only effective when `multiple` is `true`.\n * The option is hidden automatically when any disabled option is **not** selected.\n */\n selectAllLabel?: string;\n /** Text appended after the hidden chip count (e.g. `\"+4 more\"`). Only effective when `multiple` is `true`. */\n moreOptionsText?: string;\n className?: string;\n [\"data-testid\"]?: string;\n};\n\n// ── Multi-select variant (moreOptionsText required) ──────────────────\n\ntype DropdownMultipleProps = DropdownBaseProps & {\n multiple: true;\n moreOptionsText: string;\n /** The accessible label for each chip's remove button. */\n removeOptionAriaLabel: string;\n};\n\n// ── Single-select variant (moreOptionsText optional) ─────────────────\n\ntype DropdownSingleProps = DropdownBaseProps & {\n multiple?: false | undefined;\n moreOptionsText?: string;\n removeOptionAriaLabel?: never;\n};\n\n// ── Shared props for select variant ──────────────────────────────────\n\ntype DropdownSelectSharedProps = {\n combobox?: false;\n options: DropdownOption[];\n /** Currently selected option (single-select, controlled). */\n selectedOption?: DropdownOption;\n /** Currently selected options (multi-select, controlled). */\n selectedOptions?: DropdownOption[];\n /** Fired when an option is selected or deselected. */\n onSelect?: (toggledOption: DropdownOption | undefined, selectedOptions: DropdownOption[]) => void;\n /** Open the listbox when the trigger receives focus. */\n openOnFocus?: boolean;\n /** Maximum height of the listbox popup. */\n listboxMaxHeight?: string | number;\n filterOption?: never;\n onInputChange?: never;\n inputValue?: never;\n defaultInputValue?: never;\n noOptionsText?: never;\n highlightFirstOption?: never;\n};\n\n// ── Shared props for combobox variant ────────────────────────────────\n\ntype DropdownComboboxSharedProps = {\n combobox: true;\n options: DropdownOption[];\n /** Currently selected option (single-select, controlled). */\n selectedOption?: DropdownOption;\n /** Currently selected options (multi-select, controlled). */\n selectedOptions?: DropdownOption[];\n /** Fired when an option is selected or deselected. */\n onSelect?: (toggledOption: DropdownOption | undefined, selectedOptions: DropdownOption[]) => void;\n /** Custom filter for autocomplete results. */\n filterOption?: (inputValue: string | undefined, option: DropdownOption) => boolean;\n /** Controlled input value. */\n inputValue?: string;\n /** Default input value (uncontrolled). */\n defaultInputValue?: string;\n /** Fired when the text-input value changes. */\n onInputChange?: (value: string) => void;\n /** Text shown when filtering yields no results. */\n noOptionsText?: React.ReactNode;\n /** Highlight the first option automatically. */\n highlightFirstOption?: boolean;\n /** Open the listbox when the input receives focus. */\n openOnFocus?: boolean;\n /** Maximum height of the listbox popup. */\n listboxMaxHeight?: string | number;\n};\n\n// ── Custom select (single & multi) ────────────────────────────────────\n\nexport type DropdownSelectProps =\n | (DropdownMultipleProps & DropdownSelectSharedProps)\n | (DropdownSingleProps & DropdownSelectSharedProps);\n\n// ── Combobox / autocomplete ──────────────────────────────────────────\n\nexport type DropdownComboboxProps =\n | (DropdownMultipleProps & DropdownComboboxSharedProps)\n | (DropdownSingleProps & DropdownComboboxSharedProps);\n\nexport type DropdownProps = DropdownSelectProps | DropdownComboboxProps;\n","import React from \"react\";\nimport type { CheckedState } from \"@purpur/checkbox\";\nimport { Checkbox } from \"@purpur/checkbox\";\nimport { DismissableChipGroup } from \"@purpur/dismissable-chip-group\";\nimport { FieldErrorText } from \"@purpur/field-error-text\";\nimport { FieldHelperText } from \"@purpur/field-helper-text\";\nimport { IconCheckCircleFilled } from \"@purpur/icon/check-circle-filled\";\nimport { IconChevronDown } from \"@purpur/icon/chevron-down\";\nimport { Label } from \"@purpur/label\";\nimport { Listbox } from \"@purpur/listbox\";\nimport { Spinner } from \"@purpur/spinner\";\nimport c from \"classnames/bind\";\n\nimport styles from \"./dropdown.module.scss\";\nimport type { DropdownOption } from \"./dropdown.types\";\nimport { getOptionLabelText } from \"./dropdown.types\";\n\nconst cx = c.bind(styles);\nexport const rootClassName = \"purpur-dropdown\";\n\ntype GetTestId = (name: string) => string | undefined;\n\ntype DropdownLabelProps = {\n fieldId: string;\n htmlForSuffix?: string;\n label?: string;\n getTestId: GetTestId;\n disabled: boolean;\n negative: boolean;\n required: boolean;\n};\n\nexport const DropdownLabel = ({\n fieldId,\n htmlForSuffix,\n label,\n getTestId,\n disabled,\n negative,\n required,\n}: DropdownLabelProps) => {\n if (!label) return null;\n\n return (\n <Label\n htmlFor={htmlForSuffix ? `${fieldId}-${htmlForSuffix}` : fieldId}\n className={cx(`${rootClassName}__label`)}\n data-testid={getTestId(\"label\")}\n disabled={disabled}\n negative={negative}\n >\n {required && <span aria-hidden>*</span>}\n {label}\n </Label>\n );\n};\n\ntype DropdownEndAdornmentsProps = {\n getTestId: GetTestId;\n loading?: boolean;\n disabled: boolean;\n negative: boolean;\n isValid: boolean;\n isOpen?: boolean;\n readOnly?: boolean;\n showChevronOpen: boolean;\n};\n\nexport const DropdownEndAdornments = ({\n getTestId,\n loading,\n disabled,\n negative,\n isValid,\n isOpen,\n readOnly,\n showChevronOpen,\n}: DropdownEndAdornmentsProps) => (\n <span className={cx(`${rootClassName}__end-adornments`)}>\n {loading ? (\n <Spinner\n disabled={disabled}\n size=\"xxs\"\n negative={negative}\n data-testid={getTestId(\"spinner\")}\n />\n ) : (\n <>\n {isValid && (\n <IconCheckCircleFilled\n data-testid={getTestId(\"valid-icon\")}\n className={cx(`${rootClassName}__valid-icon`)}\n />\n )}\n <IconChevronDown\n className={cx(`${rootClassName}__chevron-icon`, {\n [`${rootClassName}__chevron-icon--open`]: showChevronOpen && isOpen,\n [`${rootClassName}__chevron-icon--disabled`]: disabled,\n [`${rootClassName}__chevron-icon--readonly`]: readOnly && !disabled,\n [`${rootClassName}__chevron-icon--is-valid`]: isValid,\n [`${rootClassName}__chevron-icon--negative`]: negative,\n })}\n data-testid={getTestId(\"dropdown-icon\")}\n size=\"sm\"\n />\n </>\n )}\n </span>\n);\n\nconst MAX_VISIBLE_TAGS = 6;\n\ntype DropdownTagsProps = {\n selectedItems: DropdownOption[];\n getTestId: GetTestId;\n disabled: boolean;\n negative: boolean;\n onRemove: (option: DropdownOption) => void;\n isSelect?: boolean;\n moreOptionsText?: string;\n removeOptionAriaLabel?: string;\n};\n\nexport const DropdownTags = ({\n selectedItems,\n getTestId,\n disabled,\n negative,\n onRemove,\n isSelect,\n moreOptionsText,\n removeOptionAriaLabel,\n}: DropdownTagsProps) => {\n if (!selectedItems.length) return null;\n\n const capEnabled = moreOptionsText !== undefined && selectedItems.length > MAX_VISIBLE_TAGS;\n const visibleItems = capEnabled ? selectedItems.slice(-MAX_VISIBLE_TAGS) : selectedItems;\n const hiddenCount = selectedItems.length - visibleItems.length;\n\n return (\n <DismissableChipGroup\n className={cx(`${rootClassName}__chip-group`, {\n [`${rootClassName}__chip-group--select`]: isSelect,\n })}\n negative={negative}\n data-testid={getTestId(\"tags\")}\n size=\"sm\"\n >\n {visibleItems.map((item) => (\n <DismissableChipGroup.Item\n key={item.id}\n id={item.id}\n data-testid={getTestId(`tag-${item.id}`)}\n aria-label={\n removeOptionAriaLabel\n ? `${removeOptionAriaLabel} ${getOptionLabelText(item)}`\n : getOptionLabelText(item)\n }\n onDismiss={() => {\n onRemove(item);\n }}\n disabled={disabled || item.disabled}\n >\n {item.label}\n </DismissableChipGroup.Item>\n ))}\n {hiddenCount > 0 && (\n <li\n className={cx(`${rootClassName}__chip-group-more`)}\n data-testid={getTestId(\"tags-more\")}\n >\n {`+${hiddenCount} ${moreOptionsText}`}\n </li>\n )}\n </DismissableChipGroup>\n );\n};\n\ntype DropdownFooterProps = {\n errorText?: string;\n helperText?: string;\n helperTextId: string;\n negative: boolean;\n};\n\nexport const DropdownFooter = ({\n errorText,\n helperText,\n helperTextId,\n negative,\n}: DropdownFooterProps) => (\n <>\n {errorText && <FieldErrorText negative={negative}>{errorText}</FieldErrorText>}\n {helperText && !errorText && (\n <FieldHelperText id={helperTextId} negative={negative}>\n {helperText}\n </FieldHelperText>\n )}\n </>\n);\n\nexport const SELECT_ALL_OPTION_ID = \"__purpur-dropdown-select-all__\";\n\ntype ShouldShowSelectAllArgs = {\n selectAllLabel?: string;\n multiple?: boolean;\n options: DropdownOption[];\n selectedItems: DropdownOption[];\n};\n\nexport const shouldShowSelectAll = ({\n selectAllLabel,\n multiple,\n options,\n selectedItems,\n}: ShouldShowSelectAllArgs): boolean => {\n if (!selectAllLabel || !multiple) return false;\n const enabledOptions = options.filter((o) => !o.disabled);\n if (enabledOptions.length === 0) return false;\n const disabledOptions = options.filter((o) => o.disabled);\n const hasDisabledUnselected = disabledOptions.some(\n (o) => !selectedItems.some((s) => s.id === o.id)\n );\n // Hide \"All\" when a disabled option is not selected (can't select everything)\n return !hasDisabledUnselected;\n};\n\ntype DropdownListboxItemsProps = {\n optionsToShow: DropdownOption[];\n getListboxItemProps: (option: DropdownOption, index: number) => Record<string, unknown>;\n multiple?: boolean;\n negative: boolean;\n fieldId: string;\n noOptionsText?: React.ReactNode;\n selectAllLabel?: string;\n selectedItems?: DropdownOption[];\n};\n\nexport const DropdownListboxItems = ({\n optionsToShow,\n getListboxItemProps,\n multiple,\n negative,\n fieldId,\n noOptionsText,\n selectAllLabel,\n selectedItems = [],\n}: DropdownListboxItemsProps) => {\n if (noOptionsText !== undefined && !optionsToShow.length) {\n return <Listbox.Item noninteractive>{noOptionsText}</Listbox.Item>;\n }\n\n const hasSelectAll = optionsToShow[0]?.id === SELECT_ALL_OPTION_ID;\n\n let selectAllCheckedState: CheckedState = false;\n if (hasSelectAll) {\n const realOptions = optionsToShow.filter((o) => o.id !== SELECT_ALL_OPTION_ID);\n const enabledOptions = realOptions.filter((o) => !o.disabled);\n const enabledSelectedCount = enabledOptions.filter((o) =>\n selectedItems.some((s) => s.id === o.id)\n ).length;\n const allEnabledSelected =\n enabledOptions.length > 0 && enabledSelectedCount === enabledOptions.length;\n const someSelected = selectedItems.length > 0;\n selectAllCheckedState = allEnabledSelected ? true : someSelected ? \"indeterminate\" : false;\n }\n\n return optionsToShow.map((option, index) => {\n const { key, selected, ...itemProps } = getListboxItemProps(option, index);\n\n if (option.id === SELECT_ALL_OPTION_ID) {\n return (\n <Listbox.Item\n key={key as string}\n {...itemProps}\n aria-selected={selectAllCheckedState === true}\n className={cx(\n `${rootClassName}__checkbox-item-multiple`,\n `${rootClassName}__select-all-item`\n )}\n hideSelectedIcon\n >\n <span className={cx(`${rootClassName}__checkbox-container`)}>\n <Checkbox\n id={`${fieldId}-checkbox-select-all`}\n checked={selectAllCheckedState}\n label={selectAllLabel}\n negative={negative}\n aria-hidden\n />\n </span>\n </Listbox.Item>\n );\n }\n\n if (multiple) {\n return (\n <Listbox.Item\n key={key as string}\n {...itemProps}\n className={cx(`${rootClassName}__checkbox-item-multiple`, {\n [`${rootClassName}__select-all-child`]: hasSelectAll,\n })}\n selected={!!selected}\n hideSelectedIcon\n >\n <span\n className={cx(`${rootClassName}__checkbox-container`, {\n [`${rootClassName}__checkbox-container--disabled`]: option.disabled,\n })}\n >\n <Checkbox\n id={`${fieldId}-checkbox-${option.id}`}\n checked={!!selected}\n label={option.label}\n negative={negative}\n aria-hidden\n disabled={option.disabled}\n />\n </span>\n </Listbox.Item>\n );\n }\n\n return (\n <Listbox.Item key={key as string} {...itemProps} selected={!!selected}>\n <div>{option.label}</div>\n </Listbox.Item>\n );\n });\n};\n\nexport { cx };\n","import type { DropdownOption } from \"./dropdown.types\";\nimport { getOptionLabelText } from \"./dropdown.types\";\n\nconst filterOptions = (\n options: DropdownOption[],\n searchTerm: string | undefined,\n filterOption?: (inputValue: string | undefined, option: DropdownOption) => boolean\n): DropdownOption[] => {\n if (filterOption) {\n return options.filter((option) => filterOption(searchTerm, option));\n }\n if (!searchTerm) return options;\n const chunks = searchTerm.toUpperCase().split(\" \");\n return options.filter((option) =>\n chunks.every((chunk) =>\n (option.value || (typeof option.label === \"string\" ? option.label : \"\"))\n .toUpperCase()\n .includes(chunk)\n )\n );\n};\n\nexport const getFilteredOptions = ({\n options,\n searchTerm,\n filterOption,\n selectedOption,\n multiple,\n}: {\n options: DropdownOption[];\n searchTerm: string | undefined;\n filterOption?: (inputValue: string | undefined, option: DropdownOption) => boolean;\n selectedOption?: DropdownOption;\n multiple: boolean;\n}): DropdownOption[] => {\n if (!multiple && selectedOption && getOptionLabelText(selectedOption) === searchTerm) {\n return options;\n }\n return filterOptions(options, searchTerm, filterOption);\n};\n","import { useState } from \"react\";\n\nimport type { DropdownOption } from \"./dropdown.types\";\nimport { getOptionLabelText } from \"./dropdown.types\";\n\nexport type UseDropdownInputParams = {\n controlledInputValue?: string;\n defaultInputValue?: string;\n selectedOption?: DropdownOption;\n onInputChange?: (value: string) => void;\n};\n\nexport const useDropdownInput = ({\n controlledInputValue,\n defaultInputValue,\n selectedOption,\n onInputChange,\n}: UseDropdownInputParams) => {\n const [internalInputValue, setInternalInputValue] = useState(\n (typeof controlledInputValue === \"string\"\n ? controlledInputValue\n : defaultInputValue ?? (selectedOption ? getOptionLabelText(selectedOption) : undefined)) ??\n \"\"\n );\n\n const displayInputValue =\n typeof controlledInputValue === \"string\" ? controlledInputValue : internalInputValue;\n\n const populateInputField = (value: string) => {\n onInputChange?.(value);\n setInternalInputValue(value);\n };\n\n return {\n displayInputValue,\n populateInputField,\n };\n};\n","import React, { forwardRef, useId } from \"react\";\nimport { Listbox } from \"@purpur/listbox\";\nimport { useAutocomplete } from \"@purpur/use-autocomplete\";\n\nimport type { DropdownComboboxProps, DropdownOption } from \"./dropdown.types\";\nimport { getOptionLabelText } from \"./dropdown.types\";\nimport {\n cx,\n DropdownEndAdornments,\n DropdownFooter,\n DropdownLabel,\n DropdownListboxItems,\n DropdownTags,\n rootClassName,\n SELECT_ALL_OPTION_ID,\n shouldShowSelectAll,\n} from \"./dropdown-shared\";\nimport { getFilteredOptions } from \"./useDropdownFilter\";\nimport { useDropdownInput } from \"./useDropdownInput\";\n\nexport const DropdownCombobox = forwardRef<HTMLDivElement, DropdownComboboxProps>((props, ref) => {\n const {\n id: propId,\n label,\n options,\n className,\n errorText,\n helperText,\n placeholder,\n negative = false,\n readOnly = false,\n disabled = false,\n required = false,\n valid,\n loading,\n multiple = false,\n selectedOption,\n selectedOptions = [],\n onSelect,\n openOnFocus = false,\n listboxMaxHeight,\n listboxLabel,\n filterOption,\n inputValue,\n defaultInputValue,\n onInputChange,\n noOptionsText,\n highlightFirstOption = false,\n selectAllLabel,\n moreOptionsText,\n removeOptionAriaLabel,\n [\"data-testid\"]: dataTestId,\n } = props;\n\n const randomId = useId();\n const fieldId = propId ?? randomId;\n const getTestId = (name: string) => (dataTestId ? `${dataTestId}-${name}` : undefined);\n const isValid = !!valid && !errorText;\n const helperTextId = `${fieldId}-helper-text`;\n\n const selectedItems = multiple ? selectedOptions : selectedOption ? [selectedOption] : [];\n\n const { displayInputValue, populateInputField } = useDropdownInput({\n controlledInputValue: inputValue,\n defaultInputValue,\n selectedOption,\n onInputChange,\n });\n\n const optionsToShow = getFilteredOptions({\n options,\n searchTerm: displayInputValue,\n filterOption,\n selectedOption,\n multiple,\n });\n\n const showSelectAll = shouldShowSelectAll({\n selectAllLabel,\n multiple,\n options,\n selectedItems,\n });\n\n // Hide \"Select all\" when the user is actively searching/filtering.\n const selectAllMatchesSearch = showSelectAll && !displayInputValue;\n\n // Inject a virtual \"Select all\" option so it participates in keyboard navigation.\n const optionsWithSelectAll =\n showSelectAll && selectAllMatchesSearch\n ? [{ id: SELECT_ALL_OPTION_ID, label: selectAllLabel as string }, ...optionsToShow]\n : optionsToShow;\n\n const handleSelectAll = () => {\n const enabledOptions = options.filter((o) => !o.disabled);\n const allEnabledSelected = enabledOptions.every((o) =>\n selectedItems.some((s) => s.id === o.id)\n );\n if (allEnabledSelected) {\n const next = selectedItems.filter((o) => o.disabled);\n onSelect?.(undefined, next);\n } else {\n const disabledSelected = selectedItems.filter((o) => o.disabled);\n const next = [...disabledSelected, ...enabledOptions];\n onSelect?.(undefined, next);\n }\n populateInputField(\"\");\n };\n\n const handleAutocompleteSelect = (option: DropdownOption) => {\n if (option.id === SELECT_ALL_OPTION_ID) {\n handleSelectAll();\n return;\n }\n if (multiple) {\n const isAlreadySelected = selectedItems.some((o) => o.id === option.id);\n const next = isAlreadySelected\n ? selectedItems.filter((o) => o.id !== option.id)\n : [...selectedItems, option];\n onSelect?.(option, next);\n populateInputField(\"\");\n } else {\n onSelect?.(option, [option]);\n populateInputField(getOptionLabelText(option));\n }\n };\n\n const {\n rootRef,\n inputRef,\n inputProps,\n listboxProps,\n getListboxItemProps,\n isOpen,\n openListbox,\n anchorStyle,\n } = useAutocomplete({\n id: fieldId,\n // useAutocomplete only reads id/disabled, never label's value, so this is safe even though\n // DropdownOption.label can be a ReactNode instead of the string it's typed to require.\n options: optionsWithSelectAll as (DropdownOption & { label: string })[],\n listboxLabel: listboxLabel || label || \"Options\",\n selectedOption: (multiple ? undefined : selectedOption) as\n | (DropdownOption & { label: string })\n | undefined,\n disabled,\n readOnly,\n openOnFocus,\n listboxMaxHeight,\n highlightFirstOption,\n closeOnSelect: !multiple,\n noOptionsText,\n negative,\n onSelect: handleAutocompleteSelect,\n [\"data-testid\"]: dataTestId,\n });\n\n const setRootRef = (node: HTMLDivElement | null) => {\n (rootRef as React.RefObject<HTMLDivElement | null>).current = node;\n if (typeof ref === \"function\") ref(node);\n else if (ref) (ref as React.RefObject<HTMLDivElement | null>).current = node;\n };\n\n // For multi-select the hook doesn't know about selectedOptions, so inject\n // the correct `selected` state here based on selectedItems.\n const getListboxItemPropsWithSelection = (option: DropdownOption, index: number) => {\n const props = getListboxItemProps(option as DropdownOption & { label: string }, index);\n if (multiple) {\n const isSelected = selectedItems.some((o) => o.id === option.id);\n return { ...props, selected: isSelected, \"aria-selected\": isSelected };\n }\n return props;\n };\n\n const handleRemoveTag = (option: DropdownOption) => {\n const next = selectedItems.filter((o) => o.id !== option.id);\n onSelect?.(option, next);\n };\n\n const handleInputKeyDown = (event: React.KeyboardEvent<HTMLInputElement>) => {\n if (\n multiple &&\n event.key === \"Backspace\" &&\n event.currentTarget.value === \"\" &&\n selectedItems.length > 0\n ) {\n // Find the last non-disabled chip to remove; disabled chips cannot be removed.\n for (let i = selectedItems.length - 1; i >= 0; i--) {\n if (!selectedItems[i].disabled) {\n handleRemoveTag(selectedItems[i]);\n break;\n }\n }\n }\n (inputProps as React.InputHTMLAttributes<HTMLInputElement>)?.onKeyDown?.(event);\n };\n\n const handleInputChange: React.ChangeEventHandler<HTMLInputElement> = (e) => {\n populateInputField(e.target.value);\n if (!isOpen) {\n openListbox();\n }\n };\n\n const handleInputBlur: React.FocusEventHandler<HTMLInputElement> = (event) => {\n (inputProps as React.InputHTMLAttributes<HTMLInputElement>)?.onBlur?.(event);\n if (multiple) return;\n // Clicking an option blurs the input before its mouseup selects it, so defer and skip the\n // revert if focus is still in the field — otherwise the list would shift under the click.\n setTimeout(() => {\n if (rootRef.current?.contains(document.activeElement)) return;\n const expectedValue = selectedOption ? getOptionLabelText(selectedOption) : \"\";\n if (displayInputValue !== expectedValue) {\n populateInputField(expectedValue);\n }\n });\n };\n\n const handleContainerClick: React.MouseEventHandler<HTMLDivElement> = (event) => {\n if (disabled || readOnly) return;\n\n const target = event.target as HTMLElement;\n // Ignore clicks on the input (it has its own mousedown handler) or chip dismiss buttons.\n if (\n target === (inputRef as React.RefObject<HTMLInputElement>).current ||\n target.closest(\"button\")\n ) {\n return;\n }\n\n const input = (inputRef as React.RefObject<HTMLInputElement>).current;\n input?.dispatchEvent(new MouseEvent(\"mousedown\", { bubbles: true }));\n input?.focus();\n };\n\n // True when every option (enabled and disabled) is currently selected and a\n // `selectAllLabel` is configured. In that case the field shows the label\n // text instead of a list of chips.\n const allEnabledSelected =\n multiple &&\n !!selectAllLabel &&\n options.length > 0 &&\n options.every((o) => selectedItems.some((s) => s.id === o.id));\n\n const wrapperClassName = cx(rootClassName, className, {\n [`${rootClassName}--negative`]: negative,\n });\n\n return (\n <div ref={setRootRef} className={wrapperClassName}>\n <DropdownLabel\n fieldId={fieldId}\n htmlForSuffix=\"input\"\n label={label}\n getTestId={getTestId}\n disabled={disabled}\n negative={negative}\n required={required}\n />\n <div className={cx(`${rootClassName}__field-row`)}>\n {/* disable eslint rules for this div since it is just visual container and the input inside is still accessible and has its own handlers.*/}\n {/* eslint-disable-next-line jsx-a11y/no-static-element-interactions, jsx-a11y/click-events-have-key-events */}\n <div\n className={cx(`${rootClassName}__combobox-container`, {\n [`${rootClassName}__combobox-container--error`]: !!errorText,\n [`${rootClassName}__combobox-container--is-valid`]: isValid,\n [`${rootClassName}__combobox-container--negative`]: negative,\n [`${rootClassName}__combobox-container--disabled`]: disabled,\n [`${rootClassName}__combobox-container--readonly`]: readOnly && !disabled,\n })}\n style={anchorStyle}\n onClick={handleContainerClick}\n >\n {multiple && !allEnabledSelected && (\n <DropdownTags\n selectedItems={selectedItems}\n getTestId={getTestId}\n disabled={disabled}\n negative={negative}\n onRemove={handleRemoveTag}\n moreOptionsText={moreOptionsText}\n removeOptionAriaLabel={removeOptionAriaLabel}\n />\n )}\n <input\n {...(inputProps as React.InputHTMLAttributes<HTMLInputElement>)}\n ref={inputRef as React.RefObject<HTMLInputElement>}\n id={`${fieldId}-input`}\n data-testid={getTestId(\"input\")}\n onKeyDown={handleInputKeyDown}\n onChange={handleInputChange}\n onBlur={handleInputBlur}\n value={allEnabledSelected && !displayInputValue ? selectAllLabel : displayInputValue}\n placeholder={placeholder}\n className={cx(`${rootClassName}__input`, {\n [`${rootClassName}__input--negative`]: negative,\n })}\n aria-describedby={helperTextId}\n aria-invalid={!!errorText}\n disabled={disabled}\n readOnly={readOnly}\n />\n <DropdownEndAdornments\n getTestId={getTestId}\n loading={loading}\n disabled={disabled}\n negative={negative}\n isValid={isValid}\n isOpen={isOpen}\n showChevronOpen\n />\n <span\n className={cx(`${rootClassName}__frame`, {\n [`${rootClassName}__frame--negative`]: negative,\n })}\n />\n </div>\n </div>\n {isOpen && (\n <Listbox {...listboxProps} className={cx(`${rootClassName}__listbox`)}>\n {DropdownListboxItems({\n optionsToShow: optionsWithSelectAll,\n getListboxItemProps: getListboxItemPropsWithSelection,\n multiple,\n negative,\n fieldId,\n noOptionsText,\n selectAllLabel,\n selectedItems,\n })}\n </Listbox>\n )}\n <DropdownFooter\n errorText={errorText}\n helperText={helperText}\n helperTextId={helperTextId}\n negative={negative}\n />\n </div>\n );\n});\n\nDropdownCombobox.displayName = \"DropdownCombobox\";\n","import { useRef, useState } from \"react\";\n\nimport type { DropdownOption } from \"./dropdown.types\";\n\nexport type HighlightedOption = DropdownOption & { isSetByClickEvent?: boolean };\n\nexport type UseDropdownHighlightParams = {\n options: DropdownOption[];\n highlightFirstOption: boolean;\n};\n\nexport const useDropdownHighlight = ({\n options,\n highlightFirstOption,\n}: UseDropdownHighlightParams) => {\n const listboxRef = useRef<HTMLUListElement>(null);\n const optionRefs = useRef<Record<string, HTMLLIElement>>({});\n\n const [highlightedOption, setHighlightedOption] = useState<HighlightedOption | undefined>(\n highlightFirstOption ? options[0] : undefined\n );\n\n const scrollOptionIntoView = (optionEl: HTMLLIElement | undefined) => {\n if (optionEl) {\n const optionRect = optionEl.getBoundingClientRect();\n const listboxRect = listboxRef.current?.getBoundingClientRect() || { top: 0, bottom: 0 };\n const isOutside = optionRect.top < listboxRect.top || optionRect.bottom > listboxRect.bottom;\n if (isOutside) {\n optionEl.scrollIntoView({ block: \"nearest\" });\n }\n }\n };\n\n const findNextOption = (\n direction: \"ArrowUp\" | \"ArrowDown\",\n optionsToShow: DropdownOption[]\n ): DropdownOption | undefined => {\n const enabledList = optionsToShow.filter((o) => !o.disabled);\n if (!enabledList.length) return undefined;\n\n const currentIndex = highlightedOption\n ? enabledList.findIndex((o) => o.id === highlightedOption.id)\n : -1;\n\n if (direction === \"ArrowDown\") {\n return enabledList[(currentIndex + 1) % enabledList.length];\n }\n return enabledList[(currentIndex - 1 + enabledList.length) % enabledList.length];\n };\n\n const highlightOption = (option: DropdownOption | undefined) => {\n setHighlightedOption(option ? { ...option } : undefined);\n if (option) scrollOptionIntoView(optionRefs.current[option.id]);\n };\n\n const highlightByClick = (option: DropdownOption) => {\n if (option.id !== highlightedOption?.id) {\n setHighlightedOption({ ...option, isSetByClickEvent: true });\n }\n };\n\n const highlightSelected = (option: DropdownOption, eventType: \"CLICK\" | \"KEYBOARD\") => {\n requestAnimationFrame(() => {\n const isSetByClickEvent = eventType === \"CLICK\";\n setHighlightedOption({ ...option, isSetByClickEvent });\n scrollOptionIntoView(optionRefs.current[option.id]);\n });\n };\n\n const resetHighlight = () => {\n setHighlightedOption(undefined);\n };\n\n return {\n highlightedOption,\n listboxRef,\n optionRefs,\n findNextOption,\n highlightOption,\n highlightByClick,\n highlightSelected,\n resetHighlight,\n };\n};\n","import { useCallback, useEffect } from \"react\";\n\nexport const useOnClickOutside = (element: HTMLElement | null, callback: () => void) => {\n const handleClickOutside = useCallback(\n (event: MouseEvent) => {\n if (element && !element.contains(event.target as Node)) {\n callback();\n }\n },\n [callback, element]\n );\n\n useEffect(() => {\n document.addEventListener(\"mousedown\", handleClickOutside);\n return () => {\n document.removeEventListener(\"mousedown\", handleClickOutside);\n };\n }, [handleClickOutside]);\n};\n","import type { CSSProperties } from \"react\";\nimport { useCallback, useId, useRef, useState } from \"react\";\nimport type { ListboxItemProps, ListboxProps } from \"@purpur/listbox\";\n\nimport type { DropdownOption } from \"./dropdown.types\";\nimport { getOptionLabelText } from \"./dropdown.types\";\nimport { getFilteredOptions } from \"./useDropdownFilter\";\nimport { useDropdownHighlight } from \"./useDropdownHighlight\";\nimport { useDropdownInput } from \"./useDropdownInput\";\nimport { useOnClickOutside } from \"./useOnClickOutside\";\n\n// ── Hook params ────────────────────────────────────────────────────────\n\nexport type UseDropdownParams = {\n id: string;\n variant: \"select\" | \"combobox\";\n options: DropdownOption[];\n listboxLabel: string;\n multiple?: boolean;\n\n // Selection\n selectedOption?: DropdownOption;\n selectedOptions?: DropdownOption[];\n onSelect?: (toggledOption: DropdownOption | undefined, selectedOptions: DropdownOption[]) => void;\n\n // Combobox-specific\n filterOption?: (inputValue: string | undefined, option: DropdownOption) => boolean;\n inputValue?: string;\n defaultInputValue?: string;\n onInputChange?: (value: string) => void;\n noOptionsText?: React.ReactNode;\n highlightFirstOption?: boolean;\n\n // Shared behaviour\n negative: boolean;\n openOnFocus?: boolean;\n listboxMaxHeight?: string | number;\n disabled?: boolean;\n readOnly?: boolean;\n\n [\"data-testid\"]?: string;\n};\n\n// ── Return type ────────────────────────────────────────────────────────\n\nexport type UseDropdownReturn = {\n rootRef: React.RefObject<HTMLDivElement | null>;\n triggerContainerProps: Record<string, unknown> | null;\n triggerProps: Record<string, unknown>;\n inputProps: Record<string, unknown> | null;\n listboxProps: ListboxProps;\n getListboxItemProps: (option: DropdownOption, index: number) => ListboxItemProps;\n optionsToShow: DropdownOption[];\n isOpen: boolean;\n highlightedOption: DropdownOption | undefined;\n selectedItems: DropdownOption[];\n anchorStyle: CSSProperties;\n};\n\n// ── Hook ───────────────────────────────────────────────────────────────\n\nexport const useDropdown = ({\n id,\n variant,\n options,\n listboxLabel,\n multiple = false,\n selectedOption,\n selectedOptions = [],\n onSelect,\n filterOption,\n inputValue: controlledInputValue,\n defaultInputValue,\n onInputChange,\n noOptionsText,\n highlightFirstOption = false,\n openOnFocus = false,\n listboxMaxHeight,\n negative,\n disabled = false,\n readOnly = false,\n [\"data-testid\"]: dataTestId,\n}: UseDropdownParams): UseDropdownReturn => {\n const isCombobox = variant === \"combobox\";\n const uniqueId = useId();\n\n // ── Refs ─────────────────────────────────────────────────────────────\n const rootRef = useRef<HTMLDivElement | null>(null);\n const triggerRef = useRef<HTMLButtonElement | null>(null);\n const inputRef = useRef<HTMLInputElement | null>(null);\n\n // ── Sub-hooks ────────────────────────────────────────────────────────\n const highlight = useDropdownHighlight({ options, highlightFirstOption });\n const { displayInputValue, populateInputField } = useDropdownInput({\n controlledInputValue,\n defaultInputValue,\n selectedOption,\n onInputChange,\n });\n\n // ── Open / close ────────────────────────────────────────────────────\n const [isOpen, setIsOpen] = useState(false);\n\n const closeListbox = () => {\n setIsOpen(false);\n highlight.resetHighlight();\n };\n\n useOnClickOutside(rootRef.current, closeListbox);\n\n const openListbox = ({ eventType }: { eventType: \"CLICK\" | \"KEYBOARD\" }) => {\n setIsOpen(true);\n const current = multiple ? undefined : selectedOption;\n if (current) {\n highlight.highlightSelected(current, eventType);\n }\n };\n\n // ── Derived state ───────────────────────────────────────────────────\n const resolvedSelected = multiple ? selectedOptions : selectedOption ? [selectedOption] : [];\n\n const optionsToShow = isCombobox\n ? getFilteredOptions({\n options,\n searchTerm: displayInputValue,\n filterOption,\n selectedOption,\n multiple,\n })\n : options;\n\n const showListbox = isOpen && (!!optionsToShow.length || !!noOptionsText);\n\n // ── Helpers ──────────────────────────────────────────────────────────\n const getTestId = (name: string) => (dataTestId ? `${dataTestId}-${name}` : undefined);\n\n // ── Selection ────────────────────────────────────────────────────────\n const selectOption = (option: DropdownOption | undefined) => {\n if (!option || option.disabled) return;\n\n if (multiple) {\n const isAlreadySelected = resolvedSelected.some((o) => o.id === option.id);\n const next = isAlreadySelected\n ? resolvedSelected.filter((o) => o.id !== option.id)\n : [...resolvedSelected, option];\n onSelect?.(option, next);\n if (isCombobox) {\n populateInputField(\"\");\n inputRef.current?.focus();\n }\n } else {\n onSelect?.(option, [option]);\n if (isCombobox) {\n populateInputField(getOptionLabelText(option));\n }\n closeListbox();\n (isCombobox ? inputRef : triggerRef).current?.focus();\n }\n };\n\n // ── Navigation ───────────────────────────────────────────────────────\n const highlightNextOption = (direction: \"ArrowUp\" | \"ArrowDown\") => {\n if (!showListbox) openListbox({ eventType: \"KEYBOARD\" });\n const next = highlight.findNextOption(direction, optionsToShow);\n highlight.highlightOption(next);\n };\n\n // ── Keyboard ─────────────────────────────────────────────────────────\n const handleKeyDown = (event: React.KeyboardEvent) => {\n if (disabled || readOnly) return;\n\n switch (event.key) {\n case \"ArrowUp\":\n case \"ArrowDown\":\n event.preventDefault();\n highlightNextOption(event.key);\n break;\n case \"Enter\": {\n event.preventDefault();\n if (showListbox && highlight.highlightedOption) {\n selectOption(highlight.highlightedOption);\n } else if (!showListbox) {\n openListbox({ eventType: \"KEYBOARD\" });\n }\n break;\n }\n case \" \": {\n if (!isCombobox) {\n event.preventDefault();\n if (showListbox && highlight.highlightedOption) {\n selectOption(highlight.highlightedOption);\n } else if (!showListbox) {\n openListbox({ eventType: \"KEYBOARD\" });\n }\n }\n break;\n }\n case \"Escape\":\n event.preventDefault();\n closeListbox();\n break;\n case \"Tab\":\n closeListbox();\n break;\n case \"Home\":\n case \"End\":\n if (isCombobox) closeListbox();\n break;\n }\n };\n\n // ── Combobox input handlers ─────────────────────────────────────────\n const handleInputChange: React.ChangeEventHandler<HTMLInputElement> = (e) => {\n populateInputField(e.target.value);\n highlight.resetHighlight();\n if (!isOpen) openListbox({ eventType: \"KEYBOARD\" });\n };\n\n const handleInputMouseDown = () => {\n if (disabled || readOnly) return;\n isOpen ? closeListbox() : openListbox({ eventType: \"CLICK\" });\n };\n\n const handleInputFocus = () => {\n if (!isOpen && openOnFocus && !disabled && !readOnly) {\n openListbox({ eventType: \"KEYBOARD\" });\n }\n inputRef.current?.select();\n };\n\n const handleInputBlur = () => {\n setTimeout(() => {\n const activeEl = document.activeElement;\n // Only close when focus has moved to a real element outside the dropdown.\n // Guarding against document.body prevents a false-positive close when a\n // screen reader navigates with its virtual cursor: the input blurs but no\n // DOM element receives physical focus (activeElement falls back to body).\n if (\n activeEl !== document.body &&\n !inputRef.current?.contains(activeEl) &&\n !highlight.listboxRef.current?.contains(activeEl) &&\n !rootRef.current?.contains(activeEl)\n ) {\n closeListbox();\n if (isCombobox && !multiple) {\n populateInputField(selectedOption ? getOptionLabelText(selectedOption) : \"\");\n }\n }\n });\n };\n\n // ── Select trigger handlers ─────────────────────────────────────────\n const handleTriggerClick = () => {\n if (disabled || readOnly) return;\n isOpen ? closeListbox() : openListbox({ eventType: \"CLICK\" });\n };\n\n const handleTriggerContainerClick: React.MouseEventHandler<HTMLDivElement> = (event) => {\n if (disabled || readOnly) return;\n\n const clickedButton = (event.target as HTMLElement).closest(\"button\");\n if (clickedButton && clickedButton !== triggerRef.current) {\n return;\n }\n\n handleTriggerClick();\n };\n\n const handleTriggerFocus = () => {\n if (!isOpen && openOnFocus && !disabled && !readOnly) {\n openListbox({ eventType: \"KEYBOARD\" });\n }\n };\n\n // ── Build props ──────────────────────────────────────────────────────\n const listboxId = `${id}-listbox`;\n const createListboxItemId = (option: DropdownOption) => `${id}-listbox-item-${option.id}`;\n const anchorName = `--purpur-dropdown-${uniqueId.replace(/:/g, \"\")}`;\n const anchorStyle = { anchorName } as CSSProperties;\n const triggerContainerProps: Record<string, unknown> | null = isCombobox\n ? null\n : {\n onClick: handleTriggerContainerClick,\n };\n\n // ── Popover sync ────────────────────────────────────────────────────\n const listboxCallbackRef = useCallback(\n (node: HTMLUListElement | null) => {\n (highlight.listboxRef as React.MutableRefObject<HTMLUListElement | null>).current = node;\n if (node && typeof node.showPopover === \"function\") {\n try {\n node.showPopover();\n } catch {\n // Popover not supported or already open\n }\n }\n },\n [highlight.listboxRef]\n );\n\n const listboxProps = {\n \"aria-label\": listboxLabel,\n \"aria-expanded\": showListbox,\n \"data-testid\": getTestId(\"listbox\"),\n id: listboxId,\n ref: listboxCallbackRef,\n onMouseLeave: () => highlight.resetHighlight(),\n popover: \"manual\",\n negative,\n style: {\n ...(listboxMaxHeight\n ? {\n maxHeight:\n typeof listboxMaxHeight === \"number\" ? `${listboxMaxHeight}px` : listboxMaxHeight,\n }\n : {}),\n positionAnchor: anchorName,\n } as CSSProperties,\n } as ListboxProps;\n\n const getListboxItemProps = (option: DropdownOption, index: number): ListboxItemProps => {\n const isSelected = resolvedSelected.some((o) => o.id === option.id);\n const { highlightedOption } = highlight;\n\n const highlighted =\n (option.id === highlightedOption?.id ||\n (highlightFirstOption && !highlightedOption && index === 0)) &&\n !highlightedOption?.isSetByClickEvent;\n\n return {\n \"data-testid\": getTestId(`listbox-item-${option.id}`),\n id: createListboxItemId(option),\n key: option.id,\n onMouseMove: () => highlight.highlightByClick(option),\n onMouseUp: () => selectOption(option),\n ref: (el) => {\n if (el) highlight.optionRefs.current[option.id] = el;\n },\n tabIndex: -1,\n selected: isSelected,\n disabled: option.disabled,\n highlighted,\n hovered: option.id === highlightedOption?.id && !!highlightedOption?.isSetByClickEvent,\n \"aria-selected\": isSelected,\n };\n };\n\n const triggerProps: Record<string, unknown> = isCombobox\n ? {}\n : {\n ref: triggerRef,\n type: \"button\" as const,\n role: \"combobox\",\n \"aria-haspopup\": \"listbox\",\n \"aria-expanded\": showListbox,\n \"aria-controls\": listboxId,\n \"aria-disabled\": disabled,\n \"data-testid\": getTestId(\"trigger\"),\n id: `${id}-trigger`,\n onKeyDown: handleKeyDown,\n onFocus: handleTriggerFocus,\n disabled,\n tabIndex: disabled ? -1 : 0,\n style: anchorStyle,\n };\n\n const inputProps: Record<string, unknown> | null = isCombobox\n ? {\n ref: inputRef,\n role: \"combobox\",\n \"aria-autocomplete\": \"list\" as const,\n \"aria-expanded\": showListbox,\n \"aria-controls\": listboxId,\n \"aria-activedescendant\": highlight.highlightedOption\n ? createListboxItemId(highlight.highlightedOption)\n : undefined,\n \"data-testid\": getTestId(\"input\"),\n autoComplete: \"off\",\n id: `${id}-input`,\n type: \"text\",\n value: displayInputValue,\n onChange: handleInputChange,\n onMouseDown: handleInputMouseDown,\n onFocus: handleInputFocus,\n onBlur: handleInputBlur,\n onKeyDown: handleKeyDown,\n disabled,\n readOnly,\n }\n : null;\n\n return {\n rootRef,\n triggerContainerProps,\n triggerProps,\n inputProps,\n listboxProps,\n getListboxItemProps,\n optionsToShow,\n isOpen: showListbox,\n highlightedOption: highlight.highlightedOption,\n selectedItems: resolvedSelected,\n anchorStyle,\n };\n};\n","import React, { forwardRef, useId } from \"react\";\nimport { Listbox } from \"@purpur/listbox\";\n\nimport type { DropdownOption, DropdownSelectProps } from \"./dropdown.types\";\nimport {\n cx,\n DropdownEndAdornments,\n DropdownFooter,\n DropdownLabel,\n DropdownListboxItems,\n DropdownTags,\n rootClassName,\n SELECT_ALL_OPTION_ID,\n shouldShowSelectAll,\n} from \"./dropdown-shared\";\nimport { useDropdown } from \"./useDropdown\";\n\nexport const DropdownSelect = forwardRef<HTMLDivElement, DropdownSelectProps>((props, ref) => {\n const {\n id: propId,\n label,\n options,\n className,\n errorText,\n helperText,\n placeholder,\n negative = false,\n readOnly = false,\n disabled = false,\n required = false,\n valid = false,\n loading = false,\n multiple = false,\n selectedOption,\n selectedOptions = [],\n onSelect,\n openOnFocus = false,\n listboxMaxHeight,\n listboxLabel,\n selectAllLabel,\n moreOptionsText,\n removeOptionAriaLabel,\n [\"data-testid\"]: dataTestId,\n } = props;\n\n const randomId = useId();\n const fieldId = propId ?? randomId;\n const getTestId = (name: string) => (dataTestId ? `${dataTestId}-${name}` : undefined);\n const isValid = !!valid && !errorText;\n const helperTextId = `${fieldId}-helper-text`;\n\n // Resolve selected items up-front so we can decide whether to show the\n // virtual \"Select all\" option.\n const resolvedSelectedItems = multiple ? selectedOptions : selectedOption ? [selectedOption] : [];\n\n const showSelectAll = shouldShowSelectAll({\n selectAllLabel,\n multiple,\n options,\n selectedItems: resolvedSelectedItems,\n });\n\n const handleSelectAll = () => {\n const enabledOptions = options.filter((o) => !o.disabled);\n const allEnabledSelected = enabledOptions.every((o) =>\n resolvedSelectedItems.some((s) => s.id === o.id)\n );\n if (allEnabledSelected) {\n // Deselect all enabled options, keep disabled+selected as-is\n const next = resolvedSelectedItems.filter((o) => o.disabled);\n onSelect?.(undefined, next);\n } else {\n // Select all enabled, keep disabled+selected as-is\n const disabledSelected = resolvedSelectedItems.filter((o) => o.disabled);\n const next = [...disabledSelected, ...enabledOptions];\n onSelect?.(undefined, next);\n }\n };\n\n // Intercept selection of the virtual \"Select all\" option routed through the\n // hook's keyboard/mouse handlers and redirect to the dedicated handler.\n const handleHookSelect = (\n toggledOption: DropdownOption | undefined,\n nextSelected: DropdownOption[]\n ) => {\n if (toggledOption?.id === SELECT_ALL_OPTION_ID) {\n handleSelectAll();\n return;\n }\n onSelect?.(toggledOption, nextSelected);\n };\n\n const hookOptions = showSelectAll\n ? [{ id: SELECT_ALL_OPTION_ID, label: selectAllLabel as string }, ...options]\n : options;\n\n const dropdown = useDropdown({\n id: fieldId,\n variant: \"select\",\n options: hookOptions,\n listboxLabel: listboxLabel || label || \"Options\",\n multiple,\n negative,\n selectedOption,\n selectedOptions,\n onSelect: handleHookSelect,\n openOnFocus,\n listboxMaxHeight,\n disabled,\n readOnly,\n [\"data-testid\"]: dataTestId,\n });\n\n const setRootRef = (node: HTMLDivElement | null) => {\n (dropdown.rootRef as React.RefObject<HTMLDivElement | null>).current = node;\n if (typeof ref === \"function\") ref(node);\n else if (ref) (ref as React.RefObject<HTMLDivElement | null>).current = node;\n };\n\n const {\n triggerContainerProps,\n triggerProps,\n listboxProps,\n getListboxItemProps,\n optionsToShow,\n isOpen,\n selectedItems,\n anchorStyle,\n } = dropdown;\n\n const triggerButtonProps = {\n ...(triggerProps as React.ButtonHTMLAttributes<HTMLButtonElement>),\n };\n delete triggerButtonProps.style;\n\n const handleRemoveTag = (option: DropdownOption) => {\n const next = selectedItems.filter((o) => o.id !== option.id);\n onSelect?.(option, next);\n };\n\n // True when every option (enabled and disabled) is currently selected and a\n // `selectAllLabel` is configured. In that case the field shows the label\n // text instead of a list of chips.\n const allEnabledSelected =\n multiple &&\n !!selectAllLabel &&\n options.length > 0 &&\n options.every((o) => selectedItems.some((s) => s.id === o.id));\n\n const displayLabel = multiple\n ? allEnabledSelected\n ? selectAllLabel\n : selectedItems.length === 0\n ? placeholder || \"\"\n : \"\"\n : selectedOption?.label || placeholder || \"\";\n\n const wrapperClassName = cx(rootClassName, className, {\n [`${rootClassName}--negative`]: negative,\n });\n\n return (\n <div ref={setRootRef} className={wrapperClassName}>\n <DropdownLabel\n fieldId={fieldId}\n htmlForSuffix=\"trigger\"\n label={label}\n getTestId={getTestId}\n disabled={disabled}\n negative={negative}\n required={required}\n />\n <div className={cx(`${rootClassName}__field-row`)}>\n <div\n {...(triggerContainerProps as React.HTMLAttributes<HTMLDivElement>)}\n className={cx(`${rootClassName}__trigger-container`, {\n [`${rootClassName}__trigger-container--error`]: !!errorText,\n [`${rootClassName}__trigger-container--is-valid`]: isValid,\n [`${rootClassName}__trigger-container--negative`]: negative,\n [`${rootClassName}__trigger-container--disabled`]: disabled,\n [`${rootClassName}__trigger-container--readonly`]: readOnly && !disabled,\n [`${rootClassName}__trigger-container--has-tags`]:\n multiple && selectedItems.length > 0 && !allEnabledSelected,\n })}\n style={anchorStyle}\n >\n {multiple && !allEnabledSelected && (\n <DropdownTags\n selectedItems={selectedItems}\n getTestId={getTestId}\n disabled={disabled}\n negative={negative}\n onRemove={handleRemoveTag}\n moreOptionsText={moreOptionsText}\n removeOptionAriaLabel={removeOptionAriaLabel}\n isSelect\n />\n )}\n <button\n {...triggerButtonProps}\n className={cx(`${rootClassName}__trigger`, {\n [`${rootClassName}__trigger--is-valid`]: isValid,\n [`${rootClassName}__trigger--negative`]: negative,\n [`${rootClassName}__trigger--disabled`]: disabled,\n [`${rootClassName}__trigger--readonly`]: readOnly && !disabled,\n [`${rootClassName}__trigger--placeholder`]: !selectedItems.length,\n })}\n aria-describedby={helperTextId}\n >\n <span className={cx(`${rootClassName}__trigger-text`)}>{displayLabel}</span>\n </button>\n <DropdownEndAdornments\n getTestId={getTestId}\n loading={loading}\n disabled={disabled}\n negative={negative}\n isValid={isValid}\n isOpen={isOpen}\n readOnly={readOnly}\n showChevronOpen\n />\n <span\n className={cx(`${rootClassName}__frame`, {\n [`${rootClassName}__frame--negative`]: negative,\n })}\n />\n </div>\n </div>\n {isOpen && (\n <Listbox {...listboxProps} className={cx(`${rootClassName}__listbox`)}>\n {DropdownListboxItems({\n optionsToShow,\n getListboxItemProps,\n multiple,\n negative,\n fieldId,\n selectAllLabel,\n selectedItems,\n })}\n </Listbox>\n )}\n <DropdownFooter\n errorText={errorText}\n helperText={helperText}\n helperTextId={helperTextId}\n negative={negative}\n />\n </div>\n );\n});\n\nDropdownSelect.displayName = \"DropdownSelect\";\n","import React, { forwardRef } from \"react\";\n\nimport type { DropdownComboboxProps, DropdownProps, DropdownSelectProps } from \"./dropdown.types\";\nimport { DropdownCombobox } from \"./dropdown-combobox\";\nimport { DropdownSelect } from \"./dropdown-select\";\n\nexport const Dropdown = forwardRef<HTMLDivElement, DropdownProps>((props, ref) => {\n if (props.combobox) {\n return <DropdownCombobox ref={ref} {...(props as DropdownComboboxProps)} />;\n }\n\n return <DropdownSelect ref={ref} {...(props as DropdownSelectProps)} />;\n});\n\nDropdown.displayName = \"Dropdown\";\n\nexport type {\n DropdownComboboxProps,\n DropdownOption,\n DropdownProps,\n DropdownSelectProps,\n} from \"./dropdown.types\";\nexport { useDropdown } from \"./useDropdown\";\n"],"names":["getOptionLabelText","option","cx","c","styles","rootClassName","DropdownLabel","fieldId","htmlForSuffix","label","getTestId","disabled","negative","required","jsxs","Label","jsx","DropdownEndAdornments","loading","isValid","isOpen","readOnly","showChevronOpen","Spinner","Fragment","IconCheckCircleFilled","IconChevronDown","MAX_VISIBLE_TAGS","DropdownTags","selectedItems","onRemove","isSelect","moreOptionsText","removeOptionAriaLabel","visibleItems","hiddenCount","DismissableChipGroup","item","DropdownFooter","errorText","helperText","helperTextId","FieldErrorText","FieldHelperText","SELECT_ALL_OPTION_ID","shouldShowSelectAll","selectAllLabel","multiple","options","o","s","DropdownListboxItems","optionsToShow","getListboxItemProps","noOptionsText","Listbox","hasSelectAll","selectAllCheckedState","enabledOptions","enabledSelectedCount","allEnabledSelected","someSelected","index","key","selected","itemProps","Checkbox","filterOptions","searchTerm","filterOption","chunks","chunk","getFilteredOptions","selectedOption","useDropdownInput","controlledInputValue","defaultInputValue","onInputChange","internalInputValue","setInternalInputValue","useState","value","DropdownCombobox","forwardRef","props","ref","propId","className","placeholder","valid","selectedOptions","onSelect","openOnFocus","listboxMaxHeight","listboxLabel","inputValue","highlightFirstOption","dataTestId","randomId","useId","name","displayInputValue","populateInputField","showSelectAll","optionsWithSelectAll","handleSelectAll","next","handleAutocompleteSelect","rootRef","inputRef","inputProps","listboxProps","openListbox","anchorStyle","useAutocomplete","setRootRef","node","getListboxItemPropsWithSelection","isSelected","handleRemoveTag","handleInputKeyDown","event","i","handleInputChange","e","handleInputBlur","expectedValue","handleContainerClick","target","input","wrapperClassName","useDropdownHighlight","listboxRef","useRef","optionRefs","highlightedOption","setHighlightedOption","scrollOptionIntoView","optionEl","optionRect","listboxRect","direction","enabledList","currentIndex","eventType","useOnClickOutside","element","callback","handleClickOutside","useCallback","useEffect","useDropdown","id","variant","isCombobox","uniqueId","triggerRef","highlight","setIsOpen","closeListbox","current","resolvedSelected","showListbox","selectOption","highlightNextOption","handleKeyDown","handleInputMouseDown","handleInputFocus","activeEl","handleTriggerClick","handleTriggerContainerClick","clickedButton","handleTriggerFocus","listboxId","createListboxItemId","anchorName","triggerContainerProps","listboxCallbackRef","highlighted","el","triggerProps","DropdownSelect","resolvedSelectedItems","handleHookSelect","toggledOption","nextSelected","hookOptions","dropdown","triggerButtonProps","displayLabel","Dropdown"],"mappings":"khBAcaA,GAAsBC,GACjC,OAAOA,EAAO,OAAU,SAAWA,EAAO,MAAQA,EAAO,OAAS,wmHCE9DC,EAAKC,GAAAA,EAAE,KAAKC,EAAM,EACXC,EAAgB,kBAchBC,GAAgB,CAAC,CAC5B,QAAAC,EACA,cAAAC,EAAA,MACAC,EACA,UAAAC,EACA,SAAAC,EACA,SAAAC,EACA,SAAAC,CACF,IACOJ,EAGHK,EAAAA,KAACC,GAAAA,MAAA,CACC,QAASP,EAAgB,GAAGD,CAAO,IAAIC,CAAa,GAAKD,EACzD,UAAWL,EAAG,GAAGG,CAAa,SAAS,EACvC,cAAaK,EAAU,OAAO,EAC9B,SAAAC,EACA,SAAAC,EAEC,SAAA,CAAAC,GAAYG,EAAAA,IAAC,OAAA,CAAK,cAAW,GAAC,SAAA,IAAC,EAC/BP,CAAA,CAAA,CAAA,EAXc,KA2BRQ,GAAwB,CAAC,CACpC,UAAAP,EACA,QAAAQ,EACA,SAAAP,EACA,SAAAC,EACA,QAAAO,EACA,OAAAC,EACA,SAAAC,EACA,gBAAAC,CACF,IACEN,MAAC,QAAK,UAAWd,EAAG,GAAGG,CAAa,kBAAkB,EACnD,SAAAa,EACCF,EAAAA,IAACO,GAAAA,QAAA,CACC,SAAAZ,EACA,KAAK,MACL,SAAAC,EACA,cAAaF,EAAU,SAAS,CAAA,CAClC,EAEAI,EAAAA,KAAAU,WAAA,CACG,SAAA,CAAAL,GACCH,EAAAA,IAACS,GAAAA,EAAA,CACC,cAAaf,EAAU,YAAY,EACnC,UAAW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