@ledgerhq/lumen-ui-react 0.1.16 → 0.1.18
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/ai-rules/RULES.md +7 -1
- package/dist/index.js +148 -142
- package/dist/lib/Components/AddressInput/AddressInput.d.ts +1 -4
- package/dist/lib/Components/AddressInput/AddressInput.d.ts.map +1 -1
- package/dist/lib/Components/AddressInput/AddressInput.js +21 -21
- package/dist/lib/Components/AmountDisplay/AmountDisplay.d.ts +1 -4
- package/dist/lib/Components/AmountDisplay/AmountDisplay.d.ts.map +1 -1
- package/dist/lib/Components/AmountDisplay/AmountDisplay.js +32 -29
- package/dist/lib/Components/AmountInput/AmountInput.d.ts +1 -4
- package/dist/lib/Components/AmountInput/AmountInput.d.ts.map +1 -1
- package/dist/lib/Components/AmountInput/AmountInput.js +13 -14
- package/dist/lib/Components/Avatar/Avatar.d.ts +1 -4
- package/dist/lib/Components/Avatar/Avatar.d.ts.map +1 -1
- package/dist/lib/Components/Avatar/Avatar.js +8 -9
- package/dist/lib/Components/BaseInput/BaseInput.d.ts +1 -4
- package/dist/lib/Components/BaseInput/BaseInput.d.ts.map +1 -1
- package/dist/lib/Components/BaseInput/BaseInput.js +66 -73
- package/dist/lib/Components/Button/BaseButton.d.ts +1 -4
- package/dist/lib/Components/Button/BaseButton.d.ts.map +1 -1
- package/dist/lib/Components/Button/BaseButton.js +14 -15
- package/dist/lib/Components/Button/Button.d.ts +1 -4
- package/dist/lib/Components/Button/Button.d.ts.map +1 -1
- package/dist/lib/Components/Button/Button.js +6 -7
- package/dist/lib/Components/Card/Card.d.ts +10 -40
- package/dist/lib/Components/Card/Card.d.ts.map +1 -1
- package/dist/lib/Components/Card/Card.js +115 -134
- package/dist/lib/Components/CardButton/CardButton.d.ts +1 -4
- package/dist/lib/Components/CardButton/CardButton.d.ts.map +1 -1
- package/dist/lib/Components/CardButton/CardButton.js +10 -11
- package/dist/lib/Components/Checkbox/Checkbox.d.ts +1 -4
- package/dist/lib/Components/Checkbox/Checkbox.d.ts.map +1 -1
- package/dist/lib/Components/Checkbox/Checkbox.js +2 -3
- package/dist/lib/Components/ContentBanner/ContentBanner.d.ts +4 -16
- package/dist/lib/Components/ContentBanner/ContentBanner.d.ts.map +1 -1
- package/dist/lib/Components/ContentBanner/ContentBanner.js +48 -54
- package/dist/lib/Components/DataTable/DataTable.d.ts +3 -12
- package/dist/lib/Components/DataTable/DataTable.d.ts.map +1 -1
- package/dist/lib/Components/DataTable/DataTable.js +84 -97
- package/dist/lib/Components/Dialog/Dialog.d.ts +3 -12
- package/dist/lib/Components/Dialog/Dialog.d.ts.map +1 -1
- package/dist/lib/Components/Dialog/Dialog.js +44 -50
- package/dist/lib/Components/Dialog/DialogHeader/DialogHeader.d.ts +1 -4
- package/dist/lib/Components/Dialog/DialogHeader/DialogHeader.d.ts.map +1 -1
- package/dist/lib/Components/Dialog/DialogHeader/DialogHeader.js +31 -34
- package/dist/lib/Components/Divider/Divider.d.ts +1 -4
- package/dist/lib/Components/Divider/Divider.d.ts.map +1 -1
- package/dist/lib/Components/Divider/Divider.js +10 -11
- package/dist/lib/Components/Icon/Icon.d.ts +1 -4
- package/dist/lib/Components/Icon/Icon.d.ts.map +1 -1
- package/dist/lib/Components/Icon/Icon.js +6 -7
- package/dist/lib/Components/IconButton/IconButton.d.ts +1 -4
- package/dist/lib/Components/IconButton/IconButton.d.ts.map +1 -1
- package/dist/lib/Components/IconButton/IconButton.js +5 -6
- package/dist/lib/Components/InteractiveIcon/InteractiveIcon.d.ts +3 -11
- package/dist/lib/Components/InteractiveIcon/InteractiveIcon.d.ts.map +1 -1
- package/dist/lib/Components/InteractiveIcon/InteractiveIcon.js +24 -22
- package/dist/lib/Components/InteractiveIcon/types.d.ts +14 -9
- package/dist/lib/Components/InteractiveIcon/types.d.ts.map +1 -1
- package/dist/lib/Components/Link/Link.d.ts +1 -4
- package/dist/lib/Components/Link/Link.d.ts.map +1 -1
- package/dist/lib/Components/Link/Link.js +13 -14
- package/dist/lib/Components/ListItem/ListItem.d.ts +7 -28
- package/dist/lib/Components/ListItem/ListItem.d.ts.map +1 -1
- package/dist/lib/Components/ListItem/ListItem.js +60 -63
- package/dist/lib/Components/MediaBanner/MediaBanner.d.ts +3 -12
- package/dist/lib/Components/MediaBanner/MediaBanner.d.ts.map +1 -1
- package/dist/lib/Components/MediaBanner/MediaBanner.js +39 -43
- package/dist/lib/Components/MediaCard/MediaCard.d.ts +2 -8
- package/dist/lib/Components/MediaCard/MediaCard.d.ts.map +1 -1
- package/dist/lib/Components/MediaCard/MediaCard.js +38 -40
- package/dist/lib/Components/MediaImage/MediaImage.d.ts +16 -0
- package/dist/lib/Components/MediaImage/MediaImage.d.ts.map +1 -0
- package/dist/lib/Components/MediaImage/MediaImage.js +74 -0
- package/dist/lib/Components/MediaImage/index.d.ts +3 -0
- package/dist/lib/Components/MediaImage/index.d.ts.map +1 -0
- package/dist/lib/Components/MediaImage/types.d.ts +38 -0
- package/dist/lib/Components/MediaImage/types.d.ts.map +1 -0
- package/dist/lib/Components/Menu/Menu.d.ts +11 -38
- package/dist/lib/Components/Menu/Menu.d.ts.map +1 -1
- package/dist/lib/Components/Menu/Menu.js +100 -116
- package/dist/lib/Components/NavBar/CoinCapsule.d.ts +1 -4
- package/dist/lib/Components/NavBar/CoinCapsule.d.ts.map +1 -1
- package/dist/lib/Components/NavBar/CoinCapsule.js +8 -9
- package/dist/lib/Components/NavBar/NavBar.d.ts +7 -22
- package/dist/lib/Components/NavBar/NavBar.d.ts.map +1 -1
- package/dist/lib/Components/NavBar/NavBar.js +25 -34
- package/dist/lib/Components/PageIndicator/PageIndicator.d.ts +1 -4
- package/dist/lib/Components/PageIndicator/PageIndicator.d.ts.map +1 -1
- package/dist/lib/Components/PageIndicator/PageIndicator.js +15 -16
- package/dist/lib/Components/Popover/Popover.d.ts +1 -4
- package/dist/lib/Components/Popover/Popover.d.ts.map +1 -1
- package/dist/lib/Components/Popover/Popover.js +5 -7
- package/dist/lib/Components/SearchInput/SearchInput.d.ts +1 -4
- package/dist/lib/Components/SearchInput/SearchInput.d.ts.map +1 -1
- package/dist/lib/Components/SearchInput/SearchInput.js +23 -20
- package/dist/lib/Components/SearchInput/types.d.ts +1 -1
- package/dist/lib/Components/SearchInput/types.d.ts.map +1 -1
- package/dist/lib/Components/SegmentedControl/SegmentedControl.d.ts +0 -6
- package/dist/lib/Components/SegmentedControl/SegmentedControl.d.ts.map +1 -1
- package/dist/lib/Components/SegmentedControl/SegmentedControl.js +19 -21
- package/dist/lib/Components/Select/Select.d.ts +13 -28
- package/dist/lib/Components/Select/Select.d.ts.map +1 -1
- package/dist/lib/Components/Select/Select.js +339 -207
- package/dist/lib/Components/Select/SelectContext.d.ts +3 -1
- package/dist/lib/Components/Select/SelectContext.d.ts.map +1 -1
- package/dist/lib/Components/Select/index.d.ts +1 -1
- package/dist/lib/Components/Select/index.d.ts.map +1 -1
- package/dist/lib/Components/Select/types.d.ts +171 -140
- package/dist/lib/Components/Select/types.d.ts.map +1 -1
- package/dist/lib/Components/Select/useSelectItems/index.d.ts +2 -0
- package/dist/lib/Components/Select/useSelectItems/index.d.ts.map +1 -0
- package/dist/lib/Components/Select/useSelectItems/useSelectItems.d.ts +30 -0
- package/dist/lib/Components/Select/useSelectItems/useSelectItems.d.ts.map +1 -0
- package/dist/lib/Components/Select/useSelectItems/useSelectItems.js +42 -0
- package/dist/lib/Components/Select/utils/groupItems.d.ts +13 -0
- package/dist/lib/Components/Select/utils/groupItems.d.ts.map +1 -0
- package/dist/lib/Components/Select/utils/groupItems.js +16 -0
- package/dist/lib/Components/Select/utils/index.d.ts +2 -0
- package/dist/lib/Components/Select/utils/index.d.ts.map +1 -0
- package/dist/lib/Components/SideBar/SideBar.d.ts +5 -20
- package/dist/lib/Components/SideBar/SideBar.d.ts.map +1 -1
- package/dist/lib/Components/SideBar/SideBar.js +44 -53
- package/dist/lib/Components/Skeleton/Skeleton.d.ts +1 -4
- package/dist/lib/Components/Skeleton/Skeleton.d.ts.map +1 -1
- package/dist/lib/Components/Skeleton/Skeleton.js +15 -22
- package/dist/lib/Components/Spot/Spot.d.ts +1 -4
- package/dist/lib/Components/Spot/Spot.d.ts.map +1 -1
- package/dist/lib/Components/Spot/Spot.js +11 -12
- package/dist/lib/Components/Stepper/Stepper.d.ts +1 -4
- package/dist/lib/Components/Stepper/Stepper.d.ts.map +1 -1
- package/dist/lib/Components/Stepper/Stepper.js +10 -11
- package/dist/lib/Components/Subheader/Subheader.d.ts +1 -4
- package/dist/lib/Components/Subheader/Subheader.d.ts.map +1 -1
- package/dist/lib/Components/Subheader/Subheader.js +14 -15
- package/dist/lib/Components/Subheader/types.d.ts +1 -1
- package/dist/lib/Components/Subheader/types.d.ts.map +1 -1
- package/dist/lib/Components/Switch/Switch.d.ts +1 -4
- package/dist/lib/Components/Switch/Switch.d.ts.map +1 -1
- package/dist/lib/Components/Switch/Switch.js +2 -3
- package/dist/lib/Components/Table/Table.d.ts +16 -64
- package/dist/lib/Components/Table/Table.d.ts.map +1 -1
- package/dist/lib/Components/Table/Table.js +146 -176
- package/dist/lib/Components/Tag/Tag.d.ts +1 -4
- package/dist/lib/Components/Tag/Tag.d.ts.map +1 -1
- package/dist/lib/Components/Tag/Tag.js +10 -11
- package/dist/lib/Components/TextInput/TextInput.d.ts +1 -4
- package/dist/lib/Components/TextInput/TextInput.d.ts.map +1 -1
- package/dist/lib/Components/TextInput/TextInput.js +4 -5
- package/dist/lib/Components/Tile/Tile.d.ts +6 -24
- package/dist/lib/Components/Tile/Tile.d.ts.map +1 -1
- package/dist/lib/Components/Tile/Tile.js +58 -71
- package/dist/lib/Components/TileButton/TileButton.d.ts +1 -4
- package/dist/lib/Components/TileButton/TileButton.d.ts.map +1 -1
- package/dist/lib/Components/TileButton/TileButton.js +12 -13
- package/dist/lib/Components/TriggerButton/TriggerButton.d.ts +1 -4
- package/dist/lib/Components/TriggerButton/TriggerButton.d.ts.map +1 -1
- package/dist/lib/Components/TriggerButton/TriggerButton.js +11 -12
- package/dist/lib/Components/index.d.ts +1 -0
- package/dist/lib/Components/index.d.ts.map +1 -1
- package/dist/libs/utils-shared/dist/index.js +151 -124
- package/dist/node_modules/@base-ui/react/esm/combobox/chips/ComboboxChipsContext.js +10 -0
- package/dist/node_modules/@base-ui/react/esm/combobox/collection/ComboboxCollection.js +17 -0
- package/dist/node_modules/@base-ui/react/esm/combobox/collection/GroupCollectionContext.js +23 -0
- package/dist/node_modules/@base-ui/react/esm/combobox/empty/ComboboxEmpty.js +26 -0
- package/dist/node_modules/@base-ui/react/esm/combobox/group/ComboboxGroup.js +34 -0
- package/dist/node_modules/@base-ui/react/esm/combobox/group/ComboboxGroupContext.js +14 -0
- package/dist/node_modules/@base-ui/react/esm/combobox/group-label/ComboboxGroupLabel.js +27 -0
- package/dist/node_modules/@base-ui/react/esm/combobox/input/ComboboxInput.js +221 -0
- package/dist/node_modules/@base-ui/react/esm/combobox/item/ComboboxItem.js +113 -0
- package/dist/node_modules/@base-ui/react/esm/combobox/item/ComboboxItemContext.js +14 -0
- package/dist/node_modules/@base-ui/react/esm/combobox/item-indicator/ComboboxItemIndicator.js +52 -0
- package/dist/node_modules/@base-ui/react/esm/combobox/list/ComboboxList.js +65 -0
- package/dist/node_modules/@base-ui/react/esm/combobox/popup/ComboboxPopup.js +76 -0
- package/dist/node_modules/@base-ui/react/esm/combobox/portal/ComboboxPortal.js +24 -0
- package/dist/node_modules/@base-ui/react/esm/combobox/portal/ComboboxPortalContext.js +14 -0
- package/dist/node_modules/@base-ui/react/esm/combobox/positioner/ComboboxPositioner.js +102 -0
- package/dist/node_modules/@base-ui/react/esm/combobox/positioner/ComboboxPositionerContext.js +14 -0
- package/dist/node_modules/@base-ui/react/esm/combobox/root/AriaCombobox.js +596 -0
- package/dist/node_modules/@base-ui/react/esm/combobox/root/ComboboxRoot.js +23 -0
- package/dist/node_modules/@base-ui/react/esm/combobox/root/ComboboxRootContext.js +41 -0
- package/dist/node_modules/@base-ui/react/esm/combobox/root/utils/constants.js +8 -0
- package/dist/node_modules/@base-ui/react/esm/combobox/root/utils/index.js +23 -0
- package/dist/node_modules/@base-ui/react/esm/combobox/root/utils/useFilter.js +43 -0
- package/dist/node_modules/@base-ui/react/esm/combobox/row/ComboboxRowContext.js +10 -0
- package/dist/node_modules/@base-ui/react/esm/combobox/store.js +74 -0
- package/dist/node_modules/@base-ui/react/esm/combobox/trigger/ComboboxTrigger.js +135 -0
- package/dist/node_modules/@base-ui/react/esm/combobox/utils/ComboboxInternalDismissButton.js +32 -0
- package/dist/node_modules/@base-ui/react/esm/combobox/utils/stateAttributesMapping.js +15 -0
- package/dist/node_modules/@base-ui/react/esm/combobox/value/ComboboxValue.js +19 -0
- package/dist/node_modules/@base-ui/react/esm/composite/list/CompositeList.js +81 -0
- package/dist/node_modules/@base-ui/react/esm/composite/list/CompositeListContext.js +23 -0
- package/dist/node_modules/@base-ui/react/esm/composite/list/useCompositeListItem.js +55 -0
- package/dist/node_modules/@base-ui/react/esm/field/control/FieldControlDataAttributes.js +6 -0
- package/dist/node_modules/@base-ui/react/esm/field/root/FieldRootContext.js +53 -0
- package/dist/node_modules/@base-ui/react/esm/field/useField.js +51 -0
- package/dist/node_modules/@base-ui/react/esm/field/utils/constants.js +37 -0
- package/dist/node_modules/@base-ui/react/esm/field/utils/getCombinedFieldValidityData.js +12 -0
- package/dist/node_modules/@base-ui/react/esm/floating-ui-react/hooks/useListNavigation.js +287 -0
- package/dist/node_modules/@base-ui/react/esm/floating-ui-react/hooks/useTypeahead.js +71 -0
- package/dist/node_modules/@base-ui/react/esm/floating-ui-react/utils/composite.js +218 -4
- package/dist/node_modules/@base-ui/react/esm/floating-ui-react/utils/constants.js +7 -3
- package/dist/node_modules/@base-ui/react/esm/floating-ui-react/utils/element.js +3 -3
- package/dist/node_modules/@base-ui/react/esm/form/FormContext.js +23 -0
- package/dist/node_modules/@base-ui/react/esm/labelable-provider/LabelableContext.js +19 -0
- package/dist/node_modules/@base-ui/react/esm/labelable-provider/useLabelableId.js +44 -0
- package/dist/node_modules/@base-ui/react/esm/utils/constants.js +11 -8
- package/dist/node_modules/@base-ui/react/esm/utils/createBaseUIEventDetails.js +22 -13
- package/dist/node_modules/@base-ui/react/esm/utils/getPseudoElementBounds.js +18 -0
- package/dist/node_modules/@base-ui/react/esm/utils/itemEquality.js +20 -0
- package/dist/node_modules/@base-ui/react/esm/utils/reason-parts.js +13 -6
- package/dist/node_modules/@base-ui/react/esm/utils/resolveAriaLabelledBy.js +6 -0
- package/dist/node_modules/@base-ui/react/esm/utils/resolveValueLabel.js +73 -0
- package/dist/node_modules/@base-ui/react/esm/utils/serializeValue.js +14 -0
- package/dist/node_modules/@base-ui/utils/esm/detectBrowser.js +8 -7
- package/dist/node_modules/@base-ui/utils/esm/empty.js +3 -2
- package/dist/node_modules/@base-ui/utils/esm/useControlled.js +31 -0
- package/dist/node_modules/@base-ui/utils/esm/visuallyHidden.js +5 -1
- package/dist/package.json +1 -2
- package/package.json +1 -2
|
@@ -1,78 +1,144 @@
|
|
|
1
1
|
import { ComponentPropsWithRef, ReactElement, ReactNode } from 'react';
|
|
2
|
+
import { SearchInputProps } from '../SearchInput/types';
|
|
2
3
|
import { TriggerButtonProps } from '../TriggerButton';
|
|
3
|
-
type
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
export type SelectItemData<Meta = Record<string, unknown>> = {
|
|
5
|
+
/** Unique string identifier for this item, used for selection tracking. */
|
|
6
|
+
value: string;
|
|
7
|
+
/** Display text used in the trigger. Also the field matched against by the default search filter. */
|
|
8
|
+
label: string;
|
|
9
|
+
/** When true, the item cannot be selected or focused. */
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
/** Secondary text displayed below the label inside the item. */
|
|
12
|
+
description?: string;
|
|
13
|
+
/**
|
|
14
|
+
* Optional group name. Items with the same `group` are grouped together
|
|
15
|
+
* with automatic headers, separators, and per-group filtering.
|
|
16
|
+
* The group name is used as the displayed group label.
|
|
17
|
+
*
|
|
18
|
+
* Groups are ordered by first occurrence in the `items` array.
|
|
19
|
+
* Ungrouped items are collected together at the position of the first ungrouped item.
|
|
20
|
+
*/
|
|
21
|
+
group?: string;
|
|
22
|
+
/**
|
|
23
|
+
* Optional bag of arbitrary data attached to this item.
|
|
24
|
+
* Use it to carry extra fields (icons, tickers, IDs, etc.)
|
|
25
|
+
* that your render function or custom filter needs.
|
|
26
|
+
*/
|
|
27
|
+
meta?: Meta;
|
|
28
|
+
};
|
|
29
|
+
/** @internal A named group of select items, used to represent a resolved group with its header label and child items. */
|
|
30
|
+
export type SelectItemGroup = {
|
|
31
|
+
/** The displayed group name, matching the `group` field on each child item. */
|
|
32
|
+
label: string;
|
|
33
|
+
/** The items belonging to this group. */
|
|
34
|
+
items: SelectItemData[];
|
|
35
|
+
};
|
|
7
36
|
export type SelectTriggerRenderProps = {
|
|
8
37
|
/**
|
|
9
|
-
* The currently selected value, or
|
|
38
|
+
* The currently selected value, or null if nothing is selected.
|
|
10
39
|
*/
|
|
11
|
-
selectedValue: string;
|
|
40
|
+
selectedValue: string | null;
|
|
12
41
|
/**
|
|
13
|
-
* A ReactNode that renders the selected item's content via
|
|
42
|
+
* A ReactNode that renders the selected item's content via `Combobox.Value`.
|
|
14
43
|
*/
|
|
15
44
|
selectedContent: ReactNode;
|
|
16
45
|
};
|
|
17
46
|
export type SelectProps = {
|
|
18
47
|
/**
|
|
19
|
-
* The children of the select
|
|
48
|
+
* The children of the select.
|
|
20
49
|
*/
|
|
21
50
|
children: ReactNode;
|
|
22
51
|
/**
|
|
23
|
-
* The
|
|
24
|
-
*
|
|
52
|
+
* The items displayed in the dropdown list.
|
|
53
|
+
* Each item must have a `value` (unique string identifier) and a `label`
|
|
54
|
+
* (display text for search and trigger). Use the optional `meta` field to
|
|
55
|
+
* attach arbitrary data (icons, tickers, IDs, etc.) accessible in the
|
|
56
|
+
* render function and custom filters.
|
|
57
|
+
*
|
|
58
|
+
* When items include a `group` field, the component automatically groups
|
|
59
|
+
* them by that value, rendering group headers, separators, and per-group
|
|
60
|
+
* collection iteration internally.
|
|
25
61
|
*/
|
|
26
|
-
|
|
62
|
+
items: SelectItemData[];
|
|
63
|
+
/**
|
|
64
|
+
* Filter function used to match items against a search query.
|
|
65
|
+
* When `SelectSearch` is rendered inside the content, a default case-insensitive
|
|
66
|
+
* label filter is applied automatically. Pass a custom function to override it,
|
|
67
|
+
* or `null` to disable filtering entirely.
|
|
68
|
+
*
|
|
69
|
+
* When items include a `group` field, the filter is applied to individual
|
|
70
|
+
* items within each group. Empty groups are automatically hidden.
|
|
71
|
+
* @default undefined
|
|
72
|
+
*/
|
|
73
|
+
filter?: null | ((item: SelectItemData, query: string) => boolean);
|
|
27
74
|
/**
|
|
28
|
-
*
|
|
29
|
-
*
|
|
75
|
+
* Pre-filtered items to display in the list. When provided, the component uses
|
|
76
|
+
* these items directly instead of filtering `items` internally. Use alongside
|
|
77
|
+
* `onSearchValueChange` for async/remote search where the server handles filtering.
|
|
30
78
|
*/
|
|
31
|
-
|
|
79
|
+
filteredItems?: SelectItemData[];
|
|
80
|
+
/**
|
|
81
|
+
* The controlled search input value.
|
|
82
|
+
* Should be used in conjunction with `onSearchValueChange`.
|
|
83
|
+
*/
|
|
84
|
+
searchValue?: string;
|
|
85
|
+
/**
|
|
86
|
+
* The search input value when initially rendered (uncontrolled).
|
|
87
|
+
* @default ''
|
|
88
|
+
*/
|
|
89
|
+
defaultSearchValue?: string;
|
|
90
|
+
/**
|
|
91
|
+
* Callback fired when the search input value changes.
|
|
92
|
+
* Use to trigger async fetches or track the current query externally.
|
|
93
|
+
*/
|
|
94
|
+
onSearchValueChange?: (value: string) => void;
|
|
32
95
|
/**
|
|
33
|
-
*
|
|
96
|
+
* Whether the popup is open. Use for controlled open state.
|
|
97
|
+
* Must be used in conjunction with `onOpenChange`.
|
|
34
98
|
*/
|
|
35
|
-
|
|
99
|
+
open?: boolean;
|
|
36
100
|
/**
|
|
37
|
-
* The open state of the
|
|
101
|
+
* The open state of the popup when initially rendered.
|
|
38
102
|
* Use when you do not need to control its open state.
|
|
39
103
|
* @default false
|
|
40
104
|
*/
|
|
41
105
|
defaultOpen?: boolean;
|
|
42
106
|
/**
|
|
43
|
-
* The
|
|
44
|
-
* If omitted, inherits globally from DirectionProvider or assumes LTR (left-to-right) reading mode.
|
|
107
|
+
* The value of the select when initially rendered (uncontrolled).
|
|
45
108
|
*/
|
|
46
|
-
|
|
109
|
+
defaultValue?: string;
|
|
47
110
|
/**
|
|
48
|
-
*
|
|
49
|
-
* Submitted with its owning form as part of a name/value pair.
|
|
111
|
+
* Event handler called when the open state of the popup changes.
|
|
50
112
|
*/
|
|
51
|
-
|
|
113
|
+
onOpenChange?: (open: boolean) => void;
|
|
52
114
|
/**
|
|
53
|
-
*
|
|
115
|
+
* The controlled value of the select.
|
|
116
|
+
* Should be used in conjunction with `onValueChange`.
|
|
54
117
|
*/
|
|
55
|
-
|
|
118
|
+
value?: string | null;
|
|
56
119
|
/**
|
|
57
|
-
*
|
|
58
|
-
*
|
|
120
|
+
* Event handler called when the selected value changes.
|
|
121
|
+
* Receives `null` when the selection is cleared (e.g. combobox clear behavior).
|
|
59
122
|
*/
|
|
60
|
-
|
|
123
|
+
onValueChange?: (value: string | null) => void;
|
|
61
124
|
/**
|
|
62
|
-
* The
|
|
63
|
-
|
|
125
|
+
* The name of the select for form submission.
|
|
126
|
+
*/
|
|
127
|
+
name?: string;
|
|
128
|
+
/**
|
|
129
|
+
* When true, prevents the user from interacting with the select.
|
|
64
130
|
*/
|
|
65
|
-
|
|
131
|
+
disabled?: boolean;
|
|
66
132
|
/**
|
|
67
|
-
*
|
|
133
|
+
* Whether the select is required for form validation.
|
|
134
|
+
* @default false
|
|
68
135
|
*/
|
|
69
|
-
|
|
136
|
+
required?: boolean;
|
|
70
137
|
};
|
|
71
138
|
export type SelectTriggerProps = {
|
|
72
139
|
/**
|
|
73
140
|
* Render function that replaces the default input-style trigger.
|
|
74
|
-
* When provided,
|
|
75
|
-
* delegates rendering to this function.
|
|
141
|
+
* When provided, the trigger delegates rendering to this function.
|
|
76
142
|
* Can be a preset component (e.g. `SelectTriggerButton`) or a custom render function.
|
|
77
143
|
*
|
|
78
144
|
* @example render={(props) => <SelectTriggerButton {...props} label="Label" />}
|
|
@@ -80,176 +146,142 @@ export type SelectTriggerProps = {
|
|
|
80
146
|
*/
|
|
81
147
|
render?: (props: SelectTriggerRenderProps) => ReactElement;
|
|
82
148
|
/**
|
|
83
|
-
* Extra class names to apply to the trigger element
|
|
84
|
-
* @example className='text-error'
|
|
149
|
+
* Extra class names to apply to the trigger element.
|
|
85
150
|
*/
|
|
86
151
|
className?: string;
|
|
87
152
|
/**
|
|
88
|
-
* The label text that floats above the input when focused or filled
|
|
89
|
-
* @example label='Label'
|
|
153
|
+
* The label text that floats above the input when focused or filled.
|
|
90
154
|
*/
|
|
91
155
|
label?: string;
|
|
92
|
-
/**
|
|
93
|
-
*
|
|
156
|
+
/**
|
|
157
|
+
* Additional class names to apply to the label element.
|
|
94
158
|
*/
|
|
95
159
|
labelClassName?: string;
|
|
96
160
|
} & ComponentPropsWithRef<'button'>;
|
|
97
161
|
export type SelectContentProps = {
|
|
98
162
|
/**
|
|
99
|
-
* The children of the select content
|
|
163
|
+
* The children of the select content.
|
|
100
164
|
*/
|
|
101
165
|
children: ReactNode;
|
|
102
166
|
/**
|
|
103
|
-
*
|
|
104
|
-
* @default false
|
|
105
|
-
*/
|
|
106
|
-
asChild?: boolean;
|
|
107
|
-
/**
|
|
108
|
-
* Event handler called when focus moves to the trigger after closing.
|
|
109
|
-
* It can be prevented by calling event.preventDefault.
|
|
110
|
-
*/
|
|
111
|
-
onCloseAutoFocus?: (event: Event) => void;
|
|
112
|
-
/**
|
|
113
|
-
* Event handler called when the escape key is down.
|
|
114
|
-
* It can be prevented by calling event.preventDefault.
|
|
115
|
-
*/
|
|
116
|
-
onEscapeKeyDown?: (event: KeyboardEvent) => void;
|
|
117
|
-
/**
|
|
118
|
-
* Event handler called when a pointer event occurs outside the bounds of the component.
|
|
119
|
-
* It can be prevented by calling event.preventDefault.
|
|
120
|
-
*/
|
|
121
|
-
onPointerDownOutside?: (event: PointerDownOutsideEvent) => void;
|
|
122
|
-
/**
|
|
123
|
-
* The positioning mode to use.
|
|
124
|
-
* we are using popper by default to position the content relative to the trigger.
|
|
125
|
-
* @default "popper"
|
|
126
|
-
*/
|
|
127
|
-
position?: 'item-aligned' | 'popper';
|
|
128
|
-
/**
|
|
129
|
-
* The preferred side of the anchor to render against when open. Will be reversed when collisions occur and avoidCollisions is enabled.
|
|
130
|
-
* This is only available when position is set to popper.
|
|
167
|
+
* The preferred side of the anchor to render against when open.
|
|
131
168
|
* @default "bottom"
|
|
132
169
|
*/
|
|
133
170
|
side?: 'top' | 'right' | 'bottom' | 'left';
|
|
134
171
|
/**
|
|
135
|
-
* The distance in pixels from the trigger
|
|
136
|
-
* @default
|
|
172
|
+
* The distance in pixels from the trigger.
|
|
173
|
+
* @default 8
|
|
137
174
|
*/
|
|
138
175
|
sideOffset?: number;
|
|
139
176
|
/**
|
|
140
|
-
* The preferred alignment against the trigger
|
|
177
|
+
* The preferred alignment against the trigger.
|
|
141
178
|
* @default "start"
|
|
142
179
|
*/
|
|
143
180
|
align?: 'start' | 'center' | 'end';
|
|
144
181
|
/**
|
|
145
|
-
*
|
|
146
|
-
* @default 0
|
|
182
|
+
* Extra class names to apply to the content element.
|
|
147
183
|
*/
|
|
148
|
-
|
|
149
|
-
/**
|
|
150
|
-
* When true, overrides the side and align preferences to prevent collisions with boundary edges
|
|
151
|
-
* @default true
|
|
152
|
-
*/
|
|
153
|
-
avoidCollisions?: boolean;
|
|
184
|
+
className?: string;
|
|
154
185
|
/**
|
|
155
|
-
*
|
|
156
|
-
* @default
|
|
186
|
+
* When true, the search input receives focus automatically when the dropdown opens.
|
|
187
|
+
* @default false
|
|
157
188
|
*/
|
|
158
|
-
|
|
189
|
+
autoFocusSearch?: boolean;
|
|
190
|
+
} & ComponentPropsWithRef<'div'>;
|
|
191
|
+
export type SelectListProps = {
|
|
159
192
|
/**
|
|
160
|
-
*
|
|
161
|
-
*
|
|
193
|
+
* A render function that receives each item and its index, returning a ReactNode.
|
|
194
|
+
*
|
|
195
|
+
* When items are grouped, this render function is used for individual items
|
|
196
|
+
* within each group — the group scaffolding (headers, separators, collection)
|
|
197
|
+
* is handled automatically by `SelectList`.
|
|
198
|
+
* @example renderItem={(item) => <SelectItem value={item.value}>{item.label}</SelectItem>}
|
|
162
199
|
*/
|
|
163
|
-
|
|
164
|
-
top?: number;
|
|
165
|
-
right?: number;
|
|
166
|
-
bottom?: number;
|
|
167
|
-
left?: number;
|
|
168
|
-
};
|
|
200
|
+
renderItem: (item: SelectItemData, index: number) => ReactNode;
|
|
169
201
|
/**
|
|
170
|
-
*
|
|
171
|
-
* @default "partial"
|
|
202
|
+
* Extra class names to apply to the list element.
|
|
172
203
|
*/
|
|
173
|
-
|
|
204
|
+
className?: string;
|
|
205
|
+
} & ComponentPropsWithRef<'div'>;
|
|
206
|
+
export type SelectLabelProps = {
|
|
174
207
|
/**
|
|
175
|
-
*
|
|
176
|
-
* @default false
|
|
208
|
+
* The children of the select label.
|
|
177
209
|
*/
|
|
178
|
-
|
|
210
|
+
children: ReactNode;
|
|
179
211
|
/**
|
|
180
|
-
* Extra class names to apply to the
|
|
181
|
-
* @example className='text-error'
|
|
212
|
+
* Extra class names to apply to the label element.
|
|
182
213
|
*/
|
|
183
214
|
className?: string;
|
|
184
215
|
} & ComponentPropsWithRef<'div'>;
|
|
185
|
-
export type
|
|
216
|
+
export type SelectItemTextProps = {
|
|
186
217
|
/**
|
|
187
|
-
* The
|
|
218
|
+
* The text content of the item.
|
|
188
219
|
*/
|
|
189
220
|
children: ReactNode;
|
|
190
|
-
};
|
|
191
|
-
export type SelectLabelProps = {
|
|
192
221
|
/**
|
|
193
|
-
*
|
|
194
|
-
* @example children={<SelectLabel>Option</SelectLabel>}
|
|
195
|
-
* @required
|
|
222
|
+
* Extra class names to apply to the item text element.
|
|
196
223
|
*/
|
|
197
|
-
|
|
224
|
+
className?: string;
|
|
225
|
+
} & ComponentPropsWithRef<'span'>;
|
|
226
|
+
export type SelectItemProps = {
|
|
198
227
|
/**
|
|
199
|
-
* The
|
|
228
|
+
* The unique string value associated with this item.
|
|
200
229
|
*/
|
|
201
|
-
|
|
202
|
-
} & ComponentPropsWithRef<'div'>;
|
|
203
|
-
export type SelectItemTextProps = {
|
|
230
|
+
value: string;
|
|
204
231
|
/**
|
|
205
|
-
* The children of the select item
|
|
206
|
-
*
|
|
207
|
-
* @required
|
|
232
|
+
* The children of the select item. Supports custom content
|
|
233
|
+
* (icons, tags, descriptions, etc.) alongside `SelectItemText`.
|
|
208
234
|
*/
|
|
209
235
|
children: ReactNode;
|
|
210
236
|
/**
|
|
211
|
-
*
|
|
212
|
-
* @
|
|
237
|
+
* Whether the item is disabled.
|
|
238
|
+
* @default false
|
|
239
|
+
*/
|
|
240
|
+
disabled?: boolean;
|
|
241
|
+
/**
|
|
242
|
+
* Extra class names to apply to the item element.
|
|
213
243
|
*/
|
|
214
244
|
className?: string;
|
|
215
245
|
} & ComponentPropsWithRef<'div'>;
|
|
216
|
-
export type
|
|
246
|
+
export type SelectSeparatorProps = {
|
|
217
247
|
/**
|
|
218
|
-
*
|
|
219
|
-
* @example value='option1'
|
|
220
|
-
* @required
|
|
248
|
+
* Extra class names to apply to the separator element.
|
|
221
249
|
*/
|
|
222
|
-
|
|
250
|
+
className?: string;
|
|
251
|
+
} & ComponentPropsWithRef<'div'>;
|
|
252
|
+
export type SelectSearchProps = Pick<SearchInputProps, 'placeholder' | 'className' | 'errorMessage' | 'aria-invalid' | 'suffix' | 'onClear' | 'hideClearButton'>;
|
|
253
|
+
export type SelectEmptyStateProps = {
|
|
223
254
|
/**
|
|
224
|
-
* The
|
|
225
|
-
* @example children={<SelectItemText>Option</SelectItemText>}
|
|
226
|
-
* @required
|
|
255
|
+
* The primary heading displayed in the empty state (e.g. "No results found").
|
|
227
256
|
*/
|
|
228
|
-
|
|
257
|
+
title?: ReactNode;
|
|
229
258
|
/**
|
|
230
|
-
*
|
|
231
|
-
* @example textValue='Option'
|
|
259
|
+
* Secondary text displayed below the title (e.g. a hint or explanation).
|
|
232
260
|
*/
|
|
233
|
-
|
|
261
|
+
description?: ReactNode;
|
|
234
262
|
/**
|
|
235
|
-
*
|
|
236
|
-
* @example disabled={true}
|
|
263
|
+
* Extra class names to apply to the empty state element.
|
|
237
264
|
*/
|
|
238
|
-
|
|
265
|
+
className?: string;
|
|
266
|
+
} & ComponentPropsWithRef<'div'>;
|
|
267
|
+
export type SelectItemContentProps = {
|
|
239
268
|
/**
|
|
240
|
-
*
|
|
241
|
-
*
|
|
269
|
+
* The content of the item, typically `SelectItemText` and optionally
|
|
270
|
+
* `SelectItemDescription` stacked vertically.
|
|
271
|
+
*/
|
|
272
|
+
children: ReactNode;
|
|
273
|
+
/**
|
|
274
|
+
* Extra class names to apply to the content wrapper.
|
|
242
275
|
*/
|
|
243
276
|
className?: string;
|
|
244
277
|
} & ComponentPropsWithRef<'div'>;
|
|
245
|
-
export type
|
|
278
|
+
export type SelectItemDescriptionProps = {
|
|
246
279
|
/**
|
|
247
|
-
*
|
|
248
|
-
* @default false
|
|
280
|
+
* Secondary text displayed below the item label.
|
|
249
281
|
*/
|
|
250
|
-
|
|
282
|
+
children: ReactNode;
|
|
251
283
|
/**
|
|
252
|
-
* Extra class names to apply to the
|
|
284
|
+
* Extra class names to apply to the description element.
|
|
253
285
|
*/
|
|
254
286
|
className?: string;
|
|
255
287
|
} & ComponentPropsWithRef<'div'>;
|
|
@@ -260,5 +292,4 @@ export type SelectTriggerButtonProps = SelectTriggerRenderProps & Omit<TriggerBu
|
|
|
260
292
|
*/
|
|
261
293
|
label: string;
|
|
262
294
|
};
|
|
263
|
-
export {};
|
|
264
295
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/lib/Components/Select/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAC5E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAE3D,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/lib/Components/Select/types.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/Select/useSelectItems/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { SelectItemData, SelectItemGroup } from '../types';
|
|
2
|
+
type UseSelectItemsParams = {
|
|
3
|
+
items: SelectItemData[];
|
|
4
|
+
filter?: null | ((item: SelectItemData, query: string) => boolean);
|
|
5
|
+
filteredItems?: SelectItemData[];
|
|
6
|
+
searchValue?: string;
|
|
7
|
+
defaultSearchValue?: string;
|
|
8
|
+
onSearchValueChange?: (value: string) => void;
|
|
9
|
+
};
|
|
10
|
+
type UseSelectItemsReturn = {
|
|
11
|
+
isGrouped: boolean;
|
|
12
|
+
groupedItems: SelectItemGroup[] | null;
|
|
13
|
+
filteredItemsForRoot: SelectItemData[] | SelectItemGroup[];
|
|
14
|
+
resolvedSearchValue: string;
|
|
15
|
+
registerSearch: () => () => void;
|
|
16
|
+
handleSearchValueChange: (val: string) => void;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Manages item grouping, filtering, and search-mount lifecycle for the Select.
|
|
20
|
+
*
|
|
21
|
+
* - Automatically groups items when any item has a `group` field.
|
|
22
|
+
* - Applies the default case-insensitive label filter when `SelectSearch`
|
|
23
|
+
* is mounted and no custom `filter` is provided.
|
|
24
|
+
* - Allows external/async filtering via `filteredItems`, bypassing
|
|
25
|
+
* the internal filter entirely.
|
|
26
|
+
* - Supports controlled and uncontrolled `searchValue` via `useControllableState`.
|
|
27
|
+
*/
|
|
28
|
+
export declare function useSelectItems({ items, filter, filteredItems: filteredItemsProp, searchValue: searchValueProp, defaultSearchValue, onSearchValueChange: onSearchValueChangeProp, }: UseSelectItemsParams): UseSelectItemsReturn;
|
|
29
|
+
export {};
|
|
30
|
+
//# sourceMappingURL=useSelectItems.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSelectItems.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/Select/useSelectItems/useSelectItems.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAGhE,KAAK,oBAAoB,GAAG;IAC1B,KAAK,EAAE,cAAc,EAAE,CAAC;IACxB,MAAM,CAAC,EAAE,IAAI,GAAG,CAAC,CAAC,IAAI,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,CAAC;IACnE,aAAa,CAAC,EAAE,cAAc,EAAE,CAAC;IACjC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,mBAAmB,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CAC/C,CAAC;AAEF,KAAK,oBAAoB,GAAG;IAC1B,SAAS,EAAE,OAAO,CAAC;IACnB,YAAY,EAAE,eAAe,EAAE,GAAG,IAAI,CAAC;IACvC,oBAAoB,EAAE,cAAc,EAAE,GAAG,eAAe,EAAE,CAAC;IAC3D,mBAAmB,EAAE,MAAM,CAAC;IAC5B,cAAc,EAAE,MAAM,MAAM,IAAI,CAAC;IACjC,uBAAuB,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;CAChD,CAAC;AAEF;;;;;;;;;GASG;AACH,wBAAgB,cAAc,CAAC,EAC7B,KAAK,EACL,MAAM,EACN,aAAa,EAAE,iBAAiB,EAChC,WAAW,EAAE,eAAe,EAC5B,kBAAkB,EAClB,mBAAmB,EAAE,uBAAuB,GAC7C,EAAE,oBAAoB,GAAG,oBAAoB,CAuE7C"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { useState as b, useCallback as f, useMemo as u } from "react";
|
|
2
|
+
import { useControllableState as x } from "../../../../utils/useControllableState/useControllableState.js";
|
|
3
|
+
import { groupItemsByKey as i, defaultLabelFilter as G } from "../utils/groupItems.js";
|
|
4
|
+
function B({
|
|
5
|
+
items: r,
|
|
6
|
+
filter: s,
|
|
7
|
+
filteredItems: o,
|
|
8
|
+
searchValue: m,
|
|
9
|
+
defaultSearchValue: d,
|
|
10
|
+
onSearchValueChange: p
|
|
11
|
+
}) {
|
|
12
|
+
const [S, c] = b(!1), [t, h] = x({
|
|
13
|
+
prop: m,
|
|
14
|
+
defaultProp: d ?? "",
|
|
15
|
+
onChange: p
|
|
16
|
+
}), g = f(() => (c(!0), () => c(!1)), []), V = f(
|
|
17
|
+
(e) => {
|
|
18
|
+
h(e);
|
|
19
|
+
},
|
|
20
|
+
[h]
|
|
21
|
+
), a = S ? s === void 0 ? G : s : null, n = u(
|
|
22
|
+
() => r.some((e) => e.group != null),
|
|
23
|
+
[r]
|
|
24
|
+
), l = u(
|
|
25
|
+
() => n ? i(r) : null,
|
|
26
|
+
[r, n]
|
|
27
|
+
), C = u(() => !a || !t.trim() ? l ?? r : l ? l.map((e) => ({
|
|
28
|
+
...e,
|
|
29
|
+
items: e.items.filter((F) => a(F, t))
|
|
30
|
+
})).filter((e) => e.items.length > 0) : r.filter((e) => a(e, t)), [l, r, t, a]), I = u(() => o ? n ? i(o) : o : null, [o, n]) ?? C;
|
|
31
|
+
return {
|
|
32
|
+
isGrouped: n,
|
|
33
|
+
groupedItems: l,
|
|
34
|
+
filteredItemsForRoot: I,
|
|
35
|
+
resolvedSearchValue: t,
|
|
36
|
+
registerSearch: g,
|
|
37
|
+
handleSearchValueChange: V
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
export {
|
|
41
|
+
B as useSelectItems
|
|
42
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { SelectItemData, SelectItemGroup } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Groups a flat list of items by their `group` field, preserving
|
|
4
|
+
* the insertion order of the first occurrence of each group key.
|
|
5
|
+
* Items without a `group` value are collected under an empty-string key.
|
|
6
|
+
*/
|
|
7
|
+
export declare function groupItemsByKey(items: SelectItemData[]): SelectItemGroup[];
|
|
8
|
+
/**
|
|
9
|
+
* Case-insensitive substring match on `item.label`.
|
|
10
|
+
* Returns `true` for empty/whitespace-only queries so all items are shown.
|
|
11
|
+
*/
|
|
12
|
+
export declare const defaultLabelFilter: (item: SelectItemData, query: string) => boolean;
|
|
13
|
+
//# sourceMappingURL=groupItems.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"groupItems.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/Select/utils/groupItems.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAEhE;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,cAAc,EAAE,GAAG,eAAe,EAAE,CAY1E;AAED;;;GAGG;AACH,eAAO,MAAM,kBAAkB,GAC7B,MAAM,cAAc,EACpB,OAAO,MAAM,KACZ,OAIF,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
function s(n) {
|
|
2
|
+
const r = [], e = {};
|
|
3
|
+
for (const t of n) {
|
|
4
|
+
const o = t.group ?? "";
|
|
5
|
+
e[o] || (r.push(o), e[o] = []), e[o].push(t);
|
|
6
|
+
}
|
|
7
|
+
return r.map((t) => ({ label: t, items: e[t] }));
|
|
8
|
+
}
|
|
9
|
+
const u = (n, r) => {
|
|
10
|
+
const e = r.trim().toLowerCase();
|
|
11
|
+
return e ? n.label.toLowerCase().includes(e) : !0;
|
|
12
|
+
};
|
|
13
|
+
export {
|
|
14
|
+
u as defaultLabelFilter,
|
|
15
|
+
s as groupItemsByKey
|
|
16
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/Select/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -19,27 +19,18 @@ import { SideBarProps, SideBarLeadingProps, SideBarTrailingProps, SideBarItemPro
|
|
|
19
19
|
* </SideBarTrailing>
|
|
20
20
|
* </SideBar>
|
|
21
21
|
*/
|
|
22
|
-
export declare const SideBar: {
|
|
23
|
-
({ ref, collapsed: controlledCollapsed, defaultCollapsed, onCollapsedChange, active: controlledActive, defaultActive, onActiveChange, children, className, ...props }: SideBarProps): import("react/jsx-runtime").JSX.Element;
|
|
24
|
-
displayName: string;
|
|
25
|
-
};
|
|
22
|
+
export declare const SideBar: ({ ref, collapsed: controlledCollapsed, defaultCollapsed, onCollapsedChange, active: controlledActive, defaultActive, onActiveChange, children, className, ...props }: SideBarProps) => import("react/jsx-runtime").JSX.Element;
|
|
26
23
|
/**
|
|
27
24
|
* Container for the leading (top) section of the sidebar.
|
|
28
25
|
* Typically contains the main navigation items.
|
|
29
26
|
*/
|
|
30
|
-
export declare const SideBarLeading: {
|
|
31
|
-
({ ref, children, className, ...props }: SideBarLeadingProps): import("react/jsx-runtime").JSX.Element;
|
|
32
|
-
displayName: string;
|
|
33
|
-
};
|
|
27
|
+
export declare const SideBarLeading: ({ ref, children, className, ...props }: SideBarLeadingProps) => import("react/jsx-runtime").JSX.Element;
|
|
34
28
|
/**
|
|
35
29
|
* Container for the trailing (bottom) section of the sidebar.
|
|
36
30
|
* Typically contains secondary navigation items and settings.
|
|
37
31
|
* Uses `mt-auto` to push itself and the footer to the bottom.
|
|
38
32
|
*/
|
|
39
|
-
export declare const SideBarTrailing: {
|
|
40
|
-
({ ref, children, className, ...props }: SideBarTrailingProps): import("react/jsx-runtime").JSX.Element;
|
|
41
|
-
displayName: string;
|
|
42
|
-
};
|
|
33
|
+
export declare const SideBarTrailing: ({ ref, children, className, ...props }: SideBarTrailingProps) => import("react/jsx-runtime").JSX.Element;
|
|
43
34
|
/**
|
|
44
35
|
* A navigation item within the sidebar.
|
|
45
36
|
* Supports active state via value matching, icons, labels, and optional click handling.
|
|
@@ -62,10 +53,7 @@ export declare const SideBarTrailing: {
|
|
|
62
53
|
* tooltipContent="Wallet"
|
|
63
54
|
* />
|
|
64
55
|
*/
|
|
65
|
-
export declare const SideBarItem: {
|
|
66
|
-
({ ref, value, icon: Icon, activeIcon: ActiveIcon, label, tooltipContent: tooltipContentProp, disabled: disabledProp, className, onClick, ...props }: SideBarItemProps): import("react/jsx-runtime").JSX.Element;
|
|
67
|
-
displayName: string;
|
|
68
|
-
};
|
|
56
|
+
export declare const SideBarItem: ({ ref, value, icon: Icon, activeIcon: ActiveIcon, label, tooltipContent: tooltipContentProp, disabled: disabledProp, className, onClick, ...props }: SideBarItemProps) => import("react/jsx-runtime").JSX.Element;
|
|
69
57
|
/**
|
|
70
58
|
* Collapse toggle button for the sidebar.
|
|
71
59
|
* Place inside SideBarTrailing to allow users to collapse/expand the sidebar.
|
|
@@ -75,8 +63,5 @@ export declare const SideBarItem: {
|
|
|
75
63
|
* <SideBarCollapseToggle />
|
|
76
64
|
* </SideBarTrailing>
|
|
77
65
|
*/
|
|
78
|
-
export declare const SideBarCollapseToggle: {
|
|
79
|
-
({ className, tooltipContent: tooltipContentProp, ...props }: SideBarCollapseToggleProps): import("react/jsx-runtime").JSX.Element;
|
|
80
|
-
displayName: string;
|
|
81
|
-
};
|
|
66
|
+
export declare const SideBarCollapseToggle: ({ className, tooltipContent: tooltipContentProp, ...props }: SideBarCollapseToggleProps) => import("react/jsx-runtime").JSX.Element;
|
|
82
67
|
//# sourceMappingURL=SideBar.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SideBar.d.ts","sourceRoot":"","sources":["../../../../src/lib/Components/SideBar/SideBar.tsx"],"names":[],"mappings":"AAWA,OAAO,EAEL,YAAY,EACZ,mBAAmB,EACnB,oBAAoB,EACpB,gBAAgB,EAChB,0BAA0B,EAC3B,MAAM,SAAS,CAAC;AAmDjB;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,OAAO
|
|
1
|
+
{"version":3,"file":"SideBar.d.ts","sourceRoot":"","sources":["../../../../src/lib/Components/SideBar/SideBar.tsx"],"names":[],"mappings":"AAWA,OAAO,EAEL,YAAY,EACZ,mBAAmB,EACnB,oBAAoB,EACpB,gBAAgB,EAChB,0BAA0B,EAC3B,MAAM,SAAS,CAAC;AAmDjB;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,OAAO,GAAI,sKAWrB,YAAY,4CA4Bd,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,cAAc,GAAI,wCAK5B,mBAAmB,4CAUrB,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,eAAe,GAAI,wCAK7B,oBAAoB,4CAUtB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,WAAW,GAAI,qJAWzB,gBAAgB,4CAuDlB,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,qBAAqB,GAAI,6DAInC,0BAA0B,4CA2C5B,CAAC"}
|