@ledgerhq/lumen-ui-rnative 0.1.36 → 0.1.38
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/dist/module/lib/Animations/Pulse/Pulse.mdx +1 -1
- package/dist/module/lib/Animations/Spin/Spin.mdx +1 -1
- package/dist/module/lib/Components/AddressInput/AddressInput.mdx +1 -1
- package/dist/module/lib/Components/AmountDisplay/AmountDisplay.js +68 -39
- package/dist/module/lib/Components/AmountDisplay/AmountDisplay.js.map +1 -1
- package/dist/module/lib/Components/AmountDisplay/AmountDisplay.mdx +7 -1
- package/dist/module/lib/Components/AmountDisplay/AmountDisplay.stories.js +24 -0
- package/dist/module/lib/Components/AmountDisplay/AmountDisplay.stories.js.map +1 -1
- package/dist/module/lib/Components/AmountDisplay/types.js.map +1 -1
- package/dist/module/lib/Components/AmountInput/AmountInput.js +109 -72
- package/dist/module/lib/Components/AmountInput/AmountInput.js.map +1 -1
- package/dist/module/lib/Components/AmountInput/AmountInput.mdx +13 -1
- package/dist/module/lib/Components/AmountInput/AmountInput.stories.js +53 -0
- package/dist/module/lib/Components/AmountInput/AmountInput.stories.js.map +1 -1
- package/dist/module/lib/Components/Avatar/Avatar.js +6 -5
- package/dist/module/lib/Components/Avatar/Avatar.js.map +1 -1
- package/dist/module/lib/Components/Avatar/Avatar.mdx +3 -1
- package/dist/module/lib/Components/Avatar/Avatar.test.js +10 -13
- package/dist/module/lib/Components/Avatar/Avatar.test.js.map +1 -1
- package/dist/module/lib/Components/Banner/Banner.mdx +1 -1
- package/dist/module/lib/Components/BottomSheet/BottomSheet.mdx +1 -1
- package/dist/module/lib/Components/Button/Button.mdx +1 -1
- package/dist/module/lib/Components/Card/Card.stories.js +4 -9
- package/dist/module/lib/Components/Card/Card.stories.js.map +1 -1
- package/dist/module/lib/Components/CardButton/CardButton.mdx +1 -1
- package/dist/module/lib/Components/Checkbox/Checkbox.mdx +1 -1
- package/dist/module/lib/Components/Divider/Divider.mdx +1 -1
- package/dist/module/lib/Components/DotIcon/DotIcon.js +51 -27
- package/dist/module/lib/Components/DotIcon/DotIcon.js.map +1 -1
- package/dist/module/lib/Components/DotIcon/DotIcon.mdx +92 -0
- package/dist/module/lib/Components/DotIcon/DotIcon.stories.js +57 -0
- package/dist/module/lib/Components/DotIcon/DotIcon.stories.js.map +1 -1
- package/dist/module/lib/Components/DotIndicator/DotIndicator.js +5 -5
- package/dist/module/lib/Components/DotIndicator/DotIndicator.js.map +1 -1
- package/dist/module/lib/Components/DotIndicator/DotIndicator.mdx +4 -4
- package/dist/module/lib/Components/DotIndicator/DotIndicator.stories.js +3 -3
- package/dist/module/lib/Components/DotIndicator/DotIndicator.test.js +12 -2
- package/dist/module/lib/Components/DotIndicator/DotIndicator.test.js.map +1 -1
- package/dist/module/lib/Components/DotSymbol/DotSymbol.js +59 -34
- package/dist/module/lib/Components/DotSymbol/DotSymbol.js.map +1 -1
- package/dist/module/lib/Components/DotSymbol/DotSymbol.mdx +79 -2
- package/dist/module/lib/Components/DotSymbol/DotSymbol.stories.js +60 -0
- package/dist/module/lib/Components/DotSymbol/DotSymbol.stories.js.map +1 -1
- package/dist/module/lib/Components/IconButton/IconButton.mdx +1 -1
- package/dist/module/lib/Components/InteractiveIcon/InteractiveIcon.mdx +1 -1
- package/dist/module/lib/Components/Label/Label.js +1 -1
- package/dist/module/lib/Components/Link/Link.mdx +1 -1
- package/dist/module/lib/Components/MediaBanner/MediaBanner.mdx +1 -1
- package/dist/module/lib/Components/MediaButton/MediaButton.js +19 -19
- package/dist/module/lib/Components/MediaButton/MediaButton.js.map +1 -1
- package/dist/module/lib/Components/MediaButton/MediaButton.mdx +5 -5
- package/dist/module/lib/Components/MediaButton/MediaButton.stories.js +17 -17
- package/dist/module/lib/Components/MediaButton/MediaButton.stories.js.map +1 -1
- package/dist/module/lib/Components/MediaButton/MediaButton.test.js +4 -4
- package/dist/module/lib/Components/MediaButton/MediaButton.test.js.map +1 -1
- package/dist/module/lib/Components/MediaImage/MediaImage.js +24 -6
- package/dist/module/lib/Components/MediaImage/MediaImage.js.map +1 -1
- package/dist/module/lib/Components/MediaImage/MediaImage.mdx +1 -1
- package/dist/module/lib/Components/MediaImage/MediaImage.stories.js +47 -0
- package/dist/module/lib/Components/MediaImage/MediaImage.stories.js.map +1 -1
- package/dist/module/lib/Components/NavBar/CoinCapsule.js +2 -2
- package/dist/module/lib/Components/NavBar/CoinCapsule.js.map +1 -1
- package/dist/module/lib/Components/NavBar/NavBar.js +2 -2
- package/dist/module/lib/Components/NavBar/NavBar.js.map +1 -1
- package/dist/module/lib/Components/NavBar/NavBar.mdx +2 -2
- package/dist/module/lib/Components/NavBar/NavBar.stories.js +1 -1
- package/dist/module/lib/Components/NavBar/NavBar.stories.js.map +1 -1
- package/dist/module/lib/Components/NavBar/NavBar.test.js +3 -3
- package/dist/module/lib/Components/NavBar/NavBar.test.js.map +1 -1
- package/dist/module/lib/Components/OptionList/OptionList.mdx +1 -1
- package/dist/module/lib/Components/OptionList/OptionList.stories.js +4 -4
- package/dist/module/lib/Components/OptionList/OptionList.stories.js.map +1 -1
- package/dist/module/lib/Components/PageIndicator/PageIndicator.js +13 -8
- package/dist/module/lib/Components/PageIndicator/PageIndicator.js.map +1 -1
- package/dist/module/lib/Components/PageIndicator/PageIndicator.test.js +58 -0
- package/dist/module/lib/Components/PageIndicator/PageIndicator.test.js.map +1 -1
- package/dist/module/lib/Components/SearchInput/SearchInput.mdx +1 -1
- package/dist/module/lib/Components/SegmentedControl/SegmentedControl.mdx +1 -1
- package/dist/module/lib/Components/Spinner/Spinner.mdx +1 -1
- package/dist/module/lib/Components/Spot/Spot.mdx +1 -1
- package/dist/module/lib/Components/Stepper/Stepper.mdx +1 -1
- package/dist/module/lib/Components/Subheader/Subheader.mdx +1 -1
- package/dist/module/lib/Components/Switch/Switch.mdx +1 -1
- package/dist/module/lib/Components/TabBar/TabBar.mdx +1 -1
- package/dist/module/lib/Components/TextInput/TextInput.mdx +1 -1
- package/dist/module/lib/Components/ThemeProvider/ThemeProvider.js +2 -5
- package/dist/module/lib/Components/ThemeProvider/ThemeProvider.js.map +1 -1
- package/dist/module/lib/Components/Tile/Tile.mdx +1 -1
- package/dist/module/lib/Components/Tooltip/Tooltip.mdx +1 -1
- package/dist/module/lib/Components/index.js +0 -1
- package/dist/module/lib/Components/index.js.map +1 -1
- package/dist/module/lib/Symbols/Icons/Lightbulb.js +3 -3
- package/dist/module/lib/Symbols/Icons/Lightbulb.js.map +1 -1
- package/dist/typescript/src/lib/Components/AmountDisplay/AmountDisplay.d.ts +1 -1
- package/dist/typescript/src/lib/Components/AmountDisplay/AmountDisplay.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/AmountDisplay/index.d.ts +1 -1
- package/dist/typescript/src/lib/Components/AmountDisplay/index.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/AmountDisplay/types.d.ts +10 -3
- package/dist/typescript/src/lib/Components/AmountDisplay/types.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/AmountInput/AmountInput.d.ts +1 -1
- package/dist/typescript/src/lib/Components/AmountInput/AmountInput.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/AmountInput/types.d.ts +12 -0
- package/dist/typescript/src/lib/Components/AmountInput/types.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/Avatar/Avatar.d.ts +1 -1
- package/dist/typescript/src/lib/Components/Avatar/Avatar.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/DotIcon/DotIcon.d.ts +3 -2
- package/dist/typescript/src/lib/Components/DotIcon/DotIcon.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/DotIcon/types.d.ts +7 -1
- package/dist/typescript/src/lib/Components/DotIcon/types.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/DotIndicator/types.d.ts +2 -2
- package/dist/typescript/src/lib/Components/DotSymbol/DotSymbol.d.ts +1 -1
- package/dist/typescript/src/lib/Components/DotSymbol/DotSymbol.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/DotSymbol/types.d.ts +7 -1
- package/dist/typescript/src/lib/Components/DotSymbol/types.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/Label/Label.d.ts +1 -1
- package/dist/typescript/src/lib/Components/MediaButton/MediaButton.d.ts +5 -5
- package/dist/typescript/src/lib/Components/MediaButton/MediaButton.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/MediaButton/types.d.ts +6 -6
- package/dist/typescript/src/lib/Components/MediaButton/types.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/MediaImage/MediaImage.d.ts +1 -1
- package/dist/typescript/src/lib/Components/MediaImage/MediaImage.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/MediaImage/types.d.ts +7 -1
- package/dist/typescript/src/lib/Components/MediaImage/types.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/NavBar/CoinCapsule.d.ts +1 -1
- package/dist/typescript/src/lib/Components/NavBar/CoinCapsule.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/NavBar/NavBar.d.ts +1 -1
- package/dist/typescript/src/lib/Components/NavBar/NavBar.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/NavBar/types.d.ts +3 -3
- package/dist/typescript/src/lib/Components/NavBar/types.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/PageIndicator/PageIndicator.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/ThemeProvider/ThemeProvider.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/index.d.ts +0 -1
- package/dist/typescript/src/lib/Components/index.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/lib/Animations/Pulse/Pulse.mdx +1 -1
- package/src/lib/Animations/Spin/Spin.mdx +1 -1
- package/src/lib/Components/AddressInput/AddressInput.mdx +1 -1
- package/src/lib/Components/AmountDisplay/AmountDisplay.mdx +7 -1
- package/src/lib/Components/AmountDisplay/AmountDisplay.stories.tsx +18 -0
- package/src/lib/Components/AmountDisplay/AmountDisplay.tsx +71 -40
- package/src/lib/Components/AmountDisplay/index.ts +5 -1
- package/src/lib/Components/AmountDisplay/types.ts +12 -3
- package/src/lib/Components/AmountInput/AmountInput.mdx +13 -1
- package/src/lib/Components/AmountInput/AmountInput.stories.tsx +68 -1
- package/src/lib/Components/AmountInput/AmountInput.tsx +118 -75
- package/src/lib/Components/AmountInput/types.ts +14 -0
- package/src/lib/Components/Avatar/Avatar.mdx +3 -1
- package/src/lib/Components/Avatar/Avatar.test.tsx +16 -18
- package/src/lib/Components/Avatar/Avatar.tsx +9 -8
- package/src/lib/Components/Banner/Banner.mdx +1 -1
- package/src/lib/Components/BottomSheet/BottomSheet.mdx +1 -1
- package/src/lib/Components/Button/Button.mdx +1 -1
- package/src/lib/Components/Card/Card.stories.tsx +1 -3
- package/src/lib/Components/CardButton/CardButton.mdx +1 -1
- package/src/lib/Components/Checkbox/Checkbox.mdx +1 -1
- package/src/lib/Components/Divider/Divider.mdx +1 -1
- package/src/lib/Components/DotIcon/DotIcon.mdx +92 -0
- package/src/lib/Components/DotIcon/DotIcon.stories.tsx +43 -0
- package/src/lib/Components/DotIcon/DotIcon.tsx +35 -15
- package/src/lib/Components/DotIcon/types.ts +7 -1
- package/src/lib/Components/DotIndicator/DotIndicator.mdx +4 -4
- package/src/lib/Components/DotIndicator/DotIndicator.stories.tsx +2 -2
- package/src/lib/Components/DotIndicator/DotIndicator.test.tsx +12 -2
- package/src/lib/Components/DotIndicator/DotIndicator.tsx +5 -5
- package/src/lib/Components/DotIndicator/types.ts +2 -2
- package/src/lib/Components/DotSymbol/DotSymbol.mdx +79 -2
- package/src/lib/Components/DotSymbol/DotSymbol.stories.tsx +32 -0
- package/src/lib/Components/DotSymbol/DotSymbol.tsx +46 -25
- package/src/lib/Components/DotSymbol/types.ts +7 -1
- package/src/lib/Components/IconButton/IconButton.mdx +1 -1
- package/src/lib/Components/InteractiveIcon/InteractiveIcon.mdx +1 -1
- package/src/lib/Components/Label/Label.tsx +1 -1
- package/src/lib/Components/Link/Link.mdx +1 -1
- package/src/lib/Components/MediaBanner/MediaBanner.mdx +1 -1
- package/src/lib/Components/MediaButton/MediaButton.mdx +5 -5
- package/src/lib/Components/MediaButton/MediaButton.stories.tsx +29 -15
- package/src/lib/Components/MediaButton/MediaButton.test.tsx +4 -4
- package/src/lib/Components/MediaButton/MediaButton.tsx +35 -22
- package/src/lib/Components/MediaButton/types.ts +6 -6
- package/src/lib/Components/MediaImage/MediaImage.mdx +1 -1
- package/src/lib/Components/MediaImage/MediaImage.stories.tsx +21 -0
- package/src/lib/Components/MediaImage/MediaImage.tsx +14 -2
- package/src/lib/Components/MediaImage/types.ts +7 -1
- package/src/lib/Components/NavBar/CoinCapsule.tsx +2 -2
- package/src/lib/Components/NavBar/NavBar.mdx +2 -2
- package/src/lib/Components/NavBar/NavBar.stories.tsx +3 -1
- package/src/lib/Components/NavBar/NavBar.test.tsx +3 -3
- package/src/lib/Components/NavBar/NavBar.tsx +2 -2
- package/src/lib/Components/NavBar/types.ts +3 -3
- package/src/lib/Components/OptionList/OptionList.mdx +1 -1
- package/src/lib/Components/OptionList/OptionList.stories.tsx +4 -4
- package/src/lib/Components/PageIndicator/PageIndicator.test.tsx +78 -0
- package/src/lib/Components/PageIndicator/PageIndicator.tsx +15 -7
- package/src/lib/Components/SearchInput/SearchInput.mdx +1 -1
- package/src/lib/Components/SegmentedControl/SegmentedControl.mdx +1 -1
- package/src/lib/Components/Spinner/Spinner.mdx +1 -1
- package/src/lib/Components/Spot/Spot.mdx +1 -1
- package/src/lib/Components/Stepper/Stepper.mdx +1 -1
- package/src/lib/Components/Subheader/Subheader.mdx +1 -1
- package/src/lib/Components/Switch/Switch.mdx +1 -1
- package/src/lib/Components/TabBar/TabBar.mdx +1 -1
- package/src/lib/Components/TextInput/TextInput.mdx +1 -1
- package/src/lib/Components/ThemeProvider/ThemeProvider.tsx +1 -4
- package/src/lib/Components/Tile/Tile.mdx +1 -1
- package/src/lib/Components/Tooltip/Tooltip.mdx +1 -1
- package/src/lib/Components/index.ts +0 -1
- package/src/lib/Symbols/Icons/Lightbulb.tsx +3 -3
- package/dist/module/lib/Components/Select/GlobalSelectBottomSheet.js +0 -155
- package/dist/module/lib/Components/Select/GlobalSelectBottomSheet.js.map +0 -1
- package/dist/module/lib/Components/Select/GlobalSelectContext.js +0 -78
- package/dist/module/lib/Components/Select/GlobalSelectContext.js.map +0 -1
- package/dist/module/lib/Components/Select/Select.js +0 -366
- package/dist/module/lib/Components/Select/Select.js.map +0 -1
- package/dist/module/lib/Components/Select/Select.mdx +0 -596
- package/dist/module/lib/Components/Select/Select.stories.js +0 -304
- package/dist/module/lib/Components/Select/Select.stories.js.map +0 -1
- package/dist/module/lib/Components/Select/Select.test.js +0 -123
- package/dist/module/lib/Components/Select/Select.test.js.map +0 -1
- package/dist/module/lib/Components/Select/SelectContext.js +0 -38
- package/dist/module/lib/Components/Select/SelectContext.js.map +0 -1
- package/dist/module/lib/Components/Select/index.js +0 -6
- package/dist/module/lib/Components/Select/index.js.map +0 -1
- package/dist/module/lib/Components/Select/types.js +0 -4
- package/dist/module/lib/Components/Select/types.js.map +0 -1
- package/dist/typescript/src/lib/Components/Select/GlobalSelectBottomSheet.d.ts +0 -20
- package/dist/typescript/src/lib/Components/Select/GlobalSelectBottomSheet.d.ts.map +0 -1
- package/dist/typescript/src/lib/Components/Select/GlobalSelectContext.d.ts +0 -44
- package/dist/typescript/src/lib/Components/Select/GlobalSelectContext.d.ts.map +0 -1
- package/dist/typescript/src/lib/Components/Select/Select.d.ts +0 -52
- package/dist/typescript/src/lib/Components/Select/Select.d.ts.map +0 -1
- package/dist/typescript/src/lib/Components/Select/SelectContext.d.ts +0 -36
- package/dist/typescript/src/lib/Components/Select/SelectContext.d.ts.map +0 -1
- package/dist/typescript/src/lib/Components/Select/index.d.ts +0 -4
- package/dist/typescript/src/lib/Components/Select/index.d.ts.map +0 -1
- package/dist/typescript/src/lib/Components/Select/types.d.ts +0 -130
- package/dist/typescript/src/lib/Components/Select/types.d.ts.map +0 -1
- package/src/lib/Components/Select/GlobalSelectBottomSheet.tsx +0 -180
- package/src/lib/Components/Select/GlobalSelectContext.tsx +0 -103
- package/src/lib/Components/Select/Select.mdx +0 -596
- package/src/lib/Components/Select/Select.stories.tsx +0 -266
- package/src/lib/Components/Select/Select.test.tsx +0 -117
- package/src/lib/Components/Select/Select.tsx +0 -469
- package/src/lib/Components/Select/SelectContext.tsx +0 -68
- package/src/lib/Components/Select/index.ts +0 -3
- package/src/lib/Components/Select/types.ts +0 -149
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import type { ReactNode } from 'react';
|
|
2
|
-
import type { SelectContentItem } from './types';
|
|
3
|
-
export type SelectContextValue = {
|
|
4
|
-
selectId: string;
|
|
5
|
-
open: boolean;
|
|
6
|
-
setOpen: (open: boolean) => void;
|
|
7
|
-
value: string | undefined;
|
|
8
|
-
onValueChange: (value: string) => void;
|
|
9
|
-
disabled: boolean;
|
|
10
|
-
items: SelectContentItem[];
|
|
11
|
-
setItems: (items: SelectContentItem[]) => void;
|
|
12
|
-
label?: string;
|
|
13
|
-
};
|
|
14
|
-
export declare const useSelectSafeContext: <ContextRequired extends boolean = boolean>({ consumerName, contextRequired, }: {
|
|
15
|
-
consumerName: string;
|
|
16
|
-
contextRequired: ContextRequired;
|
|
17
|
-
}) => ContextRequired extends true ? SelectContextValue : Partial<SelectContextValue>;
|
|
18
|
-
type SelectContextProviderProps = {
|
|
19
|
-
selectId: string;
|
|
20
|
-
open: boolean;
|
|
21
|
-
setOpen: (open: boolean) => void;
|
|
22
|
-
value: string | undefined;
|
|
23
|
-
onValueChange: (value: string) => void;
|
|
24
|
-
disabled: boolean;
|
|
25
|
-
items: SelectContentItem[];
|
|
26
|
-
setItems: (items: SelectContentItem[]) => void;
|
|
27
|
-
label?: string;
|
|
28
|
-
children: ReactNode;
|
|
29
|
-
};
|
|
30
|
-
/**
|
|
31
|
-
* Internal context provider for an individual Select component.
|
|
32
|
-
* This is used automatically by the Select component.
|
|
33
|
-
*/
|
|
34
|
-
export declare const SelectContextProvider: ({ selectId, open, setOpen, value, onValueChange, disabled, items, setItems, label, children, }: SelectContextProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
35
|
-
export {};
|
|
36
|
-
//# sourceMappingURL=SelectContext.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SelectContext.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/Components/Select/SelectContext.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAEjD,MAAM,MAAM,kBAAkB,GAAG;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACjC,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,QAAQ,EAAE,OAAO,CAAC;IAClB,KAAK,EAAE,iBAAiB,EAAE,CAAC;IAC3B,QAAQ,EAAE,CAAC,KAAK,EAAE,iBAAiB,EAAE,KAAK,IAAI,CAAC;IAC/C,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAKF,eAAO,MAAM,oBAAoB;;;qFAAwB,CAAC;AAE1D,KAAK,0BAA0B,GAAG;IAChC,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACjC,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,QAAQ,EAAE,OAAO,CAAC;IAClB,KAAK,EAAE,iBAAiB,EAAE,CAAC;IAC3B,QAAQ,EAAE,CAAC,KAAK,EAAE,iBAAiB,EAAE,KAAK,IAAI,CAAC;IAC/C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,SAAS,CAAC;CACrB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,qBAAqB,GAAI,gGAWnC,0BAA0B,4CAkB5B,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/Components/Select/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,2BAA2B,CAAC;AAC1C,cAAc,SAAS,CAAC"}
|
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
import type { ReactNode } from 'react';
|
|
2
|
-
import type { PressableProps } from 'react-native';
|
|
3
|
-
import type { StyledViewProps, StyledPressableProps, StyledTextProps } from '../../../styles';
|
|
4
|
-
import type { BoxProps } from '../Utility';
|
|
5
|
-
export type SelectProps = {
|
|
6
|
-
/**
|
|
7
|
-
* The children of the select (SelectTrigger, SelectContent)
|
|
8
|
-
*/
|
|
9
|
-
children: ReactNode;
|
|
10
|
-
/**
|
|
11
|
-
* The controlled open state of the select.
|
|
12
|
-
* Must be used in conjunction with onOpenChange.
|
|
13
|
-
*/
|
|
14
|
-
open?: boolean;
|
|
15
|
-
/**
|
|
16
|
-
* The value of the select when initially rendered.
|
|
17
|
-
* Use when you do not need to control the state of the select.
|
|
18
|
-
*/
|
|
19
|
-
defaultValue?: string;
|
|
20
|
-
/**
|
|
21
|
-
* Event handler called when the open state of the select changes.
|
|
22
|
-
*/
|
|
23
|
-
onOpenChange?: (open: boolean) => void;
|
|
24
|
-
/**
|
|
25
|
-
* The open state of the select when it is initially rendered.
|
|
26
|
-
* Use when you do not need to control its open state.
|
|
27
|
-
* @default false
|
|
28
|
-
*/
|
|
29
|
-
defaultOpen?: boolean;
|
|
30
|
-
/**
|
|
31
|
-
* When true, prevents the user from interacting with select.
|
|
32
|
-
*/
|
|
33
|
-
disabled?: boolean;
|
|
34
|
-
/**
|
|
35
|
-
* The controlled value of the select.
|
|
36
|
-
* Should be used in conjunction with onValueChange.
|
|
37
|
-
*/
|
|
38
|
-
value?: string;
|
|
39
|
-
/**
|
|
40
|
-
* Event handler called when the value changes.
|
|
41
|
-
*/
|
|
42
|
-
onValueChange?: (value: string) => void;
|
|
43
|
-
};
|
|
44
|
-
export type SelectTriggerProps = {
|
|
45
|
-
/**
|
|
46
|
-
* The children to render inside the trigger
|
|
47
|
-
*/
|
|
48
|
-
children?: ReactNode;
|
|
49
|
-
/**
|
|
50
|
-
* The label text that floats above the input when focused or filled
|
|
51
|
-
* @example label='Select an option'
|
|
52
|
-
*/
|
|
53
|
-
label?: string;
|
|
54
|
-
/**
|
|
55
|
-
* Change the default rendered element for the one passed as a child,
|
|
56
|
-
* merging their props and behavior.
|
|
57
|
-
* @default false
|
|
58
|
-
*/
|
|
59
|
-
asChild?: boolean;
|
|
60
|
-
} & Omit<StyledPressableProps, 'children'>;
|
|
61
|
-
export type SelectContentProps = {
|
|
62
|
-
/**
|
|
63
|
-
* The children of the select content (SelectItem, SelectGroup, etc.)
|
|
64
|
-
*/
|
|
65
|
-
children: ReactNode;
|
|
66
|
-
};
|
|
67
|
-
export type SelectGroupProps = {
|
|
68
|
-
/**
|
|
69
|
-
* The children of the select group (SelectLabel, SelectItem)
|
|
70
|
-
*/
|
|
71
|
-
children: ReactNode;
|
|
72
|
-
} & StyledViewProps;
|
|
73
|
-
export type SelectLabelProps = {
|
|
74
|
-
/**
|
|
75
|
-
* The children of the select label
|
|
76
|
-
* @required
|
|
77
|
-
*/
|
|
78
|
-
children: ReactNode;
|
|
79
|
-
} & StyledTextProps;
|
|
80
|
-
export type SelectItemProps = {
|
|
81
|
-
/**
|
|
82
|
-
* The value of the select item
|
|
83
|
-
* @required
|
|
84
|
-
*/
|
|
85
|
-
value: string;
|
|
86
|
-
/**
|
|
87
|
-
* The children of the select item
|
|
88
|
-
* @required
|
|
89
|
-
*/
|
|
90
|
-
children: ReactNode;
|
|
91
|
-
/**
|
|
92
|
-
* Optional text used for display. Use this when the content is complex.
|
|
93
|
-
*/
|
|
94
|
-
textValue?: string;
|
|
95
|
-
/**
|
|
96
|
-
* The disabled state of the select item
|
|
97
|
-
*/
|
|
98
|
-
disabled?: boolean;
|
|
99
|
-
} & Omit<PressableProps, 'children' | 'onPress' | 'disabled'>;
|
|
100
|
-
export type SelectItemTextProps = {
|
|
101
|
-
/**
|
|
102
|
-
* The children of the select item text
|
|
103
|
-
* @required
|
|
104
|
-
*/
|
|
105
|
-
children: ReactNode;
|
|
106
|
-
} & StyledTextProps;
|
|
107
|
-
export type SelectSeparatorProps = {} & BoxProps;
|
|
108
|
-
export type SelectItemData = {
|
|
109
|
-
type: 'item';
|
|
110
|
-
value: string;
|
|
111
|
-
label: string;
|
|
112
|
-
disabled?: boolean;
|
|
113
|
-
};
|
|
114
|
-
export type SelectGroupData = {
|
|
115
|
-
type: 'group-label';
|
|
116
|
-
label: string;
|
|
117
|
-
};
|
|
118
|
-
export type SelectSeparatorData = {
|
|
119
|
-
type: 'separator';
|
|
120
|
-
};
|
|
121
|
-
export type SelectContentItem = SelectItemData | SelectGroupData | SelectSeparatorData;
|
|
122
|
-
export type SelectData = {
|
|
123
|
-
id: string;
|
|
124
|
-
items: SelectContentItem[];
|
|
125
|
-
selectedValue: string | undefined;
|
|
126
|
-
onSelectValue: (value: string) => void;
|
|
127
|
-
setOpen?: (open: boolean) => void;
|
|
128
|
-
label?: string;
|
|
129
|
-
};
|
|
130
|
-
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/Components/Select/types.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,180 +0,0 @@
|
|
|
1
|
-
import { useCallback, useEffect } from 'react';
|
|
2
|
-
import { Pressable } from 'react-native';
|
|
3
|
-
import { useStyleSheet } from '../../../styles';
|
|
4
|
-
import { Check } from '../../Symbols';
|
|
5
|
-
import {
|
|
6
|
-
BottomSheet,
|
|
7
|
-
BottomSheetHeader,
|
|
8
|
-
BottomSheetView,
|
|
9
|
-
useBottomSheetRef,
|
|
10
|
-
} from '../BottomSheet';
|
|
11
|
-
import { Divider } from '../Divider';
|
|
12
|
-
import { Box, Text } from '../Utility';
|
|
13
|
-
import { useGlobalSelectSafeContext } from './GlobalSelectContext';
|
|
14
|
-
|
|
15
|
-
const useStyles = () => {
|
|
16
|
-
return useStyleSheet(
|
|
17
|
-
(t) => ({
|
|
18
|
-
bottomSheetView: {
|
|
19
|
-
paddingHorizontal: t.spacings.s8,
|
|
20
|
-
},
|
|
21
|
-
groupLabel: {
|
|
22
|
-
marginBottom: t.spacings.s4,
|
|
23
|
-
paddingHorizontal: t.spacings.s8,
|
|
24
|
-
paddingTop: t.spacings.s8,
|
|
25
|
-
color: t.colors.text.muted,
|
|
26
|
-
...t.typographies.body3SemiBold,
|
|
27
|
-
},
|
|
28
|
-
item: {
|
|
29
|
-
flexDirection: 'row',
|
|
30
|
-
alignItems: 'center',
|
|
31
|
-
borderRadius: t.borderRadius.sm,
|
|
32
|
-
padding: t.spacings.s8,
|
|
33
|
-
backgroundColor: t.colors.bg.baseTransparent,
|
|
34
|
-
},
|
|
35
|
-
itemPressed: {
|
|
36
|
-
backgroundColor: t.colors.bg.baseTransparentPressed,
|
|
37
|
-
},
|
|
38
|
-
itemDisabled: {
|
|
39
|
-
opacity: 0.5,
|
|
40
|
-
},
|
|
41
|
-
itemLabel: {
|
|
42
|
-
flex: 1,
|
|
43
|
-
color: t.colors.text.base,
|
|
44
|
-
...t.typographies.body2,
|
|
45
|
-
},
|
|
46
|
-
itemLabelDisabled: {
|
|
47
|
-
color: t.colors.text.disabled,
|
|
48
|
-
},
|
|
49
|
-
}),
|
|
50
|
-
[],
|
|
51
|
-
);
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* BottomSheet component that displays select options.
|
|
56
|
-
* This should be placed at the root level inside GestureHandlerRootView.
|
|
57
|
-
*
|
|
58
|
-
* @see {@link https://ldls.vercel.app/?path=/docs/components-select-overview--docs Storybook}
|
|
59
|
-
*
|
|
60
|
-
* @example
|
|
61
|
-
* import { GlobalSelectProvider, GlobalSelectBottomSheet } from '@ledgerhq/lumen-ui-rnative';
|
|
62
|
-
*
|
|
63
|
-
* function App() {
|
|
64
|
-
* return (
|
|
65
|
-
* <GestureHandlerRootView>
|
|
66
|
-
* <YourAppContent />
|
|
67
|
-
* <GlobalSelectBottomSheet />
|
|
68
|
-
* </GestureHandlerRootView>
|
|
69
|
-
* );
|
|
70
|
-
* }
|
|
71
|
-
*/
|
|
72
|
-
export const GlobalSelectBottomSheet: React.FC = () => {
|
|
73
|
-
const bottomSheetRef = useBottomSheetRef();
|
|
74
|
-
const styles = useStyles();
|
|
75
|
-
/**
|
|
76
|
-
* This is the only component that subscribes to currentSelect
|
|
77
|
-
* All other components use refs to avoid re-renders
|
|
78
|
-
*/
|
|
79
|
-
const { currentSelect, hideSelectRef } = useGlobalSelectSafeContext({
|
|
80
|
-
consumerName: 'useGlobalSelectBottomSheetContext',
|
|
81
|
-
contextRequired: true,
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
useEffect(() => {
|
|
85
|
-
if (currentSelect) {
|
|
86
|
-
bottomSheetRef.current?.present();
|
|
87
|
-
} else {
|
|
88
|
-
bottomSheetRef.current?.dismiss();
|
|
89
|
-
}
|
|
90
|
-
}, [currentSelect, bottomSheetRef]);
|
|
91
|
-
|
|
92
|
-
const handleClose = useCallback(() => {
|
|
93
|
-
currentSelect?.setOpen?.(false);
|
|
94
|
-
hideSelectRef.current();
|
|
95
|
-
}, [hideSelectRef, currentSelect]);
|
|
96
|
-
|
|
97
|
-
const handleSelectItem = useCallback(
|
|
98
|
-
(value: string) => {
|
|
99
|
-
if (currentSelect) {
|
|
100
|
-
currentSelect.onSelectValue(value);
|
|
101
|
-
currentSelect.setOpen?.(false);
|
|
102
|
-
hideSelectRef.current();
|
|
103
|
-
}
|
|
104
|
-
},
|
|
105
|
-
[currentSelect, hideSelectRef],
|
|
106
|
-
);
|
|
107
|
-
|
|
108
|
-
return (
|
|
109
|
-
<BottomSheet
|
|
110
|
-
ref={bottomSheetRef}
|
|
111
|
-
snapPoints={null}
|
|
112
|
-
backdropPressBehavior='close'
|
|
113
|
-
onClose={handleClose}
|
|
114
|
-
maxDynamicContentSize='fullWithOffset'
|
|
115
|
-
enableDynamicSizing
|
|
116
|
-
enablePanDownToClose
|
|
117
|
-
>
|
|
118
|
-
<BottomSheetView style={styles.bottomSheetView}>
|
|
119
|
-
{currentSelect && (
|
|
120
|
-
<>
|
|
121
|
-
{currentSelect.label && (
|
|
122
|
-
<BottomSheetHeader
|
|
123
|
-
title={currentSelect.label}
|
|
124
|
-
density='compact'
|
|
125
|
-
/>
|
|
126
|
-
)}
|
|
127
|
-
<Box lx={{ gap: 's4' }}>
|
|
128
|
-
{currentSelect.items.map((item, index) => {
|
|
129
|
-
if (item.type === 'separator') {
|
|
130
|
-
return (
|
|
131
|
-
<Divider
|
|
132
|
-
key={`separator-${index}`}
|
|
133
|
-
lx={{ marginVertical: 's4', marginHorizontal: 's8' }}
|
|
134
|
-
/>
|
|
135
|
-
);
|
|
136
|
-
}
|
|
137
|
-
if (item.type === 'group-label') {
|
|
138
|
-
return (
|
|
139
|
-
<Text key={`label-${index}`} style={styles.groupLabel}>
|
|
140
|
-
{item.label}
|
|
141
|
-
</Text>
|
|
142
|
-
);
|
|
143
|
-
}
|
|
144
|
-
const isSelected = currentSelect.selectedValue === item.value;
|
|
145
|
-
return (
|
|
146
|
-
<Pressable
|
|
147
|
-
key={item.value}
|
|
148
|
-
disabled={item.disabled}
|
|
149
|
-
onPress={() => handleSelectItem(item.value)}
|
|
150
|
-
>
|
|
151
|
-
{({ pressed }) => (
|
|
152
|
-
<Box
|
|
153
|
-
style={[
|
|
154
|
-
styles.item,
|
|
155
|
-
pressed && styles.itemPressed,
|
|
156
|
-
item.disabled && styles.itemDisabled,
|
|
157
|
-
]}
|
|
158
|
-
>
|
|
159
|
-
<Text
|
|
160
|
-
style={[
|
|
161
|
-
styles.itemLabel,
|
|
162
|
-
item.disabled && styles.itemLabelDisabled,
|
|
163
|
-
]}
|
|
164
|
-
numberOfLines={1}
|
|
165
|
-
>
|
|
166
|
-
{item.label}
|
|
167
|
-
</Text>
|
|
168
|
-
{isSelected && <Check size={24} color='active' />}
|
|
169
|
-
</Box>
|
|
170
|
-
)}
|
|
171
|
-
</Pressable>
|
|
172
|
-
);
|
|
173
|
-
})}
|
|
174
|
-
</Box>
|
|
175
|
-
</>
|
|
176
|
-
)}
|
|
177
|
-
</BottomSheetView>
|
|
178
|
-
</BottomSheet>
|
|
179
|
-
);
|
|
180
|
-
};
|
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
import { createSafeContext } from '@ledgerhq/lumen-utils-shared';
|
|
2
|
-
import type { ReactNode } from 'react';
|
|
3
|
-
import { useState, useRef, useMemo } from 'react';
|
|
4
|
-
import type { SelectData } from './types';
|
|
5
|
-
|
|
6
|
-
type GlobalSelectBottomSheetContextValue = {
|
|
7
|
-
currentSelect: SelectData | null;
|
|
8
|
-
showSelectRef: React.MutableRefObject<(data: SelectData) => void>;
|
|
9
|
-
hideSelectRef: React.MutableRefObject<() => void>;
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
const [GlobalSelectContextProvider, _useGlobalSelectSafeContext] =
|
|
13
|
-
createSafeContext<GlobalSelectBottomSheetContextValue>('GlobalSelectContext');
|
|
14
|
-
|
|
15
|
-
export const useGlobalSelectSafeContext = _useGlobalSelectSafeContext;
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Hook that provides select actions without subscribing to state changes.
|
|
19
|
-
* This prevents unnecessary re-renders when selects open/close.
|
|
20
|
-
*
|
|
21
|
-
* Use this hook in components that only need to show/hide selects
|
|
22
|
-
* but don't need to know which select is currently active.
|
|
23
|
-
*/
|
|
24
|
-
export const useSelectActions = (): {
|
|
25
|
-
showSelect: (data: SelectData) => void;
|
|
26
|
-
hideSelect: () => void;
|
|
27
|
-
} => {
|
|
28
|
-
const context = useGlobalSelectSafeContext({
|
|
29
|
-
consumerName: 'useSelectActions',
|
|
30
|
-
contextRequired: true,
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
return useMemo(
|
|
34
|
-
() => ({
|
|
35
|
-
showSelect: context.showSelectRef.current,
|
|
36
|
-
hideSelect: context.hideSelectRef.current,
|
|
37
|
-
}),
|
|
38
|
-
[context.showSelectRef, context.hideSelectRef],
|
|
39
|
-
);
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
type GlobalSelectProviderProps = {
|
|
43
|
-
children: ReactNode;
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* Global provider for the select bottom sheet system.
|
|
48
|
-
* This should wrap your app at the root level and include GlobalSelectBottomSheet.
|
|
49
|
-
*
|
|
50
|
-
* @example
|
|
51
|
-
* import { GlobalSelectProvider, GlobalSelectBottomSheet } from '@ledgerhq/lumen-ui-rnative';
|
|
52
|
-
*
|
|
53
|
-
* function App() {
|
|
54
|
-
* return (
|
|
55
|
-
* <GlobalSelectProvider>
|
|
56
|
-
* <YourAppContent />
|
|
57
|
-
* <GlobalSelectBottomSheet />
|
|
58
|
-
* </GlobalSelectProvider>
|
|
59
|
-
* );
|
|
60
|
-
* }
|
|
61
|
-
*/
|
|
62
|
-
export const GlobalSelectProvider = ({
|
|
63
|
-
children,
|
|
64
|
-
}: GlobalSelectProviderProps) => {
|
|
65
|
-
const [currentSelect, setCurrentSelect] = useState<SelectData | null>(null);
|
|
66
|
-
const showSelectRef = useRef<(data: SelectData) => void>(() => {
|
|
67
|
-
return;
|
|
68
|
-
});
|
|
69
|
-
const hideSelectRef = useRef<() => void>(() => {
|
|
70
|
-
return;
|
|
71
|
-
});
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
* Update the ref implementations when needed
|
|
75
|
-
* These closures capture the current setCurrentSelect
|
|
76
|
-
*/
|
|
77
|
-
showSelectRef.current = (data: SelectData) => {
|
|
78
|
-
setCurrentSelect(data);
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
hideSelectRef.current = () => {
|
|
82
|
-
setCurrentSelect(null);
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* Memoize the context value - only currentSelect changes cause re-renders
|
|
87
|
-
* The refs themselves never change
|
|
88
|
-
*/
|
|
89
|
-
const contextValue = useMemo(
|
|
90
|
-
() => ({
|
|
91
|
-
currentSelect,
|
|
92
|
-
showSelectRef,
|
|
93
|
-
hideSelectRef,
|
|
94
|
-
}),
|
|
95
|
-
[currentSelect],
|
|
96
|
-
);
|
|
97
|
-
|
|
98
|
-
return (
|
|
99
|
-
<GlobalSelectContextProvider value={contextValue}>
|
|
100
|
-
{children}
|
|
101
|
-
</GlobalSelectContextProvider>
|
|
102
|
-
);
|
|
103
|
-
};
|