@ledgerhq/lumen-ui-rnative 0.1.37 → 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.
Files changed (129) hide show
  1. package/dist/module/lib/Components/AmountInput/AmountInput.js +109 -72
  2. package/dist/module/lib/Components/AmountInput/AmountInput.js.map +1 -1
  3. package/dist/module/lib/Components/AmountInput/AmountInput.mdx +12 -0
  4. package/dist/module/lib/Components/AmountInput/AmountInput.stories.js +53 -0
  5. package/dist/module/lib/Components/AmountInput/AmountInput.stories.js.map +1 -1
  6. package/dist/module/lib/Components/Avatar/Avatar.js +6 -5
  7. package/dist/module/lib/Components/Avatar/Avatar.js.map +1 -1
  8. package/dist/module/lib/Components/Avatar/Avatar.mdx +2 -0
  9. package/dist/module/lib/Components/Avatar/Avatar.test.js +10 -13
  10. package/dist/module/lib/Components/Avatar/Avatar.test.js.map +1 -1
  11. package/dist/module/lib/Components/DotIcon/DotIcon.js +7 -4
  12. package/dist/module/lib/Components/DotIcon/DotIcon.js.map +1 -1
  13. package/dist/module/lib/Components/DotIcon/DotIcon.stories.js +10 -0
  14. package/dist/module/lib/Components/DotIcon/DotIcon.stories.js.map +1 -1
  15. package/dist/module/lib/Components/DotIndicator/DotIndicator.js +5 -5
  16. package/dist/module/lib/Components/DotIndicator/DotIndicator.js.map +1 -1
  17. package/dist/module/lib/Components/DotIndicator/DotIndicator.mdx +4 -4
  18. package/dist/module/lib/Components/DotIndicator/DotIndicator.stories.js +3 -3
  19. package/dist/module/lib/Components/DotIndicator/DotIndicator.test.js +12 -2
  20. package/dist/module/lib/Components/DotIndicator/DotIndicator.test.js.map +1 -1
  21. package/dist/module/lib/Components/DotSymbol/DotSymbol.js +7 -4
  22. package/dist/module/lib/Components/DotSymbol/DotSymbol.js.map +1 -1
  23. package/dist/module/lib/Components/DotSymbol/DotSymbol.stories.js +19 -0
  24. package/dist/module/lib/Components/DotSymbol/DotSymbol.stories.js.map +1 -1
  25. package/dist/module/lib/Components/Label/Label.js +1 -1
  26. package/dist/module/lib/Components/MediaButton/MediaButton.js +2 -2
  27. package/dist/module/lib/Components/MediaButton/MediaButton.mdx +2 -2
  28. package/dist/module/lib/Components/MediaImage/MediaImage.js +4 -2
  29. package/dist/module/lib/Components/MediaImage/MediaImage.js.map +1 -1
  30. package/dist/module/lib/Components/MediaImage/MediaImage.mdx +1 -1
  31. package/dist/module/lib/Components/MediaImage/MediaImage.stories.js +12 -0
  32. package/dist/module/lib/Components/MediaImage/MediaImage.stories.js.map +1 -1
  33. package/dist/module/lib/Components/OptionList/OptionList.mdx +1 -1
  34. package/dist/module/lib/Components/ThemeProvider/ThemeProvider.js +2 -5
  35. package/dist/module/lib/Components/ThemeProvider/ThemeProvider.js.map +1 -1
  36. package/dist/module/lib/Components/index.js +0 -1
  37. package/dist/module/lib/Components/index.js.map +1 -1
  38. package/dist/module/lib/Symbols/Icons/Lightbulb.js +3 -3
  39. package/dist/module/lib/Symbols/Icons/Lightbulb.js.map +1 -1
  40. package/dist/typescript/src/lib/Components/AmountInput/AmountInput.d.ts +1 -1
  41. package/dist/typescript/src/lib/Components/AmountInput/AmountInput.d.ts.map +1 -1
  42. package/dist/typescript/src/lib/Components/AmountInput/types.d.ts +12 -0
  43. package/dist/typescript/src/lib/Components/AmountInput/types.d.ts.map +1 -1
  44. package/dist/typescript/src/lib/Components/Avatar/Avatar.d.ts +1 -1
  45. package/dist/typescript/src/lib/Components/Avatar/Avatar.d.ts.map +1 -1
  46. package/dist/typescript/src/lib/Components/DotIcon/DotIcon.d.ts +2 -1
  47. package/dist/typescript/src/lib/Components/DotIcon/DotIcon.d.ts.map +1 -1
  48. package/dist/typescript/src/lib/Components/DotIcon/types.d.ts +1 -1
  49. package/dist/typescript/src/lib/Components/DotIcon/types.d.ts.map +1 -1
  50. package/dist/typescript/src/lib/Components/DotIndicator/types.d.ts +2 -2
  51. package/dist/typescript/src/lib/Components/DotSymbol/DotSymbol.d.ts.map +1 -1
  52. package/dist/typescript/src/lib/Components/DotSymbol/types.d.ts +1 -1
  53. package/dist/typescript/src/lib/Components/DotSymbol/types.d.ts.map +1 -1
  54. package/dist/typescript/src/lib/Components/Label/Label.d.ts +1 -1
  55. package/dist/typescript/src/lib/Components/MediaButton/MediaButton.d.ts +2 -2
  56. package/dist/typescript/src/lib/Components/MediaImage/MediaImage.d.ts.map +1 -1
  57. package/dist/typescript/src/lib/Components/MediaImage/types.d.ts +1 -1
  58. package/dist/typescript/src/lib/Components/MediaImage/types.d.ts.map +1 -1
  59. package/dist/typescript/src/lib/Components/ThemeProvider/ThemeProvider.d.ts.map +1 -1
  60. package/dist/typescript/src/lib/Components/index.d.ts +0 -1
  61. package/dist/typescript/src/lib/Components/index.d.ts.map +1 -1
  62. package/package.json +3 -3
  63. package/src/lib/Components/AmountInput/AmountInput.mdx +12 -0
  64. package/src/lib/Components/AmountInput/AmountInput.stories.tsx +68 -1
  65. package/src/lib/Components/AmountInput/AmountInput.tsx +118 -75
  66. package/src/lib/Components/AmountInput/types.ts +14 -0
  67. package/src/lib/Components/Avatar/Avatar.mdx +2 -0
  68. package/src/lib/Components/Avatar/Avatar.test.tsx +16 -18
  69. package/src/lib/Components/Avatar/Avatar.tsx +9 -8
  70. package/src/lib/Components/DotIcon/DotIcon.stories.tsx +8 -0
  71. package/src/lib/Components/DotIcon/DotIcon.tsx +4 -1
  72. package/src/lib/Components/DotIcon/types.ts +1 -1
  73. package/src/lib/Components/DotIndicator/DotIndicator.mdx +4 -4
  74. package/src/lib/Components/DotIndicator/DotIndicator.stories.tsx +2 -2
  75. package/src/lib/Components/DotIndicator/DotIndicator.test.tsx +12 -2
  76. package/src/lib/Components/DotIndicator/DotIndicator.tsx +5 -5
  77. package/src/lib/Components/DotIndicator/types.ts +2 -2
  78. package/src/lib/Components/DotSymbol/DotSymbol.stories.tsx +15 -0
  79. package/src/lib/Components/DotSymbol/DotSymbol.tsx +4 -1
  80. package/src/lib/Components/DotSymbol/types.ts +1 -1
  81. package/src/lib/Components/Label/Label.tsx +1 -1
  82. package/src/lib/Components/MediaButton/MediaButton.mdx +2 -2
  83. package/src/lib/Components/MediaButton/MediaButton.tsx +2 -2
  84. package/src/lib/Components/MediaImage/MediaImage.mdx +1 -1
  85. package/src/lib/Components/MediaImage/MediaImage.stories.tsx +3 -0
  86. package/src/lib/Components/MediaImage/MediaImage.tsx +2 -0
  87. package/src/lib/Components/MediaImage/types.ts +1 -1
  88. package/src/lib/Components/OptionList/OptionList.mdx +1 -1
  89. package/src/lib/Components/ThemeProvider/ThemeProvider.tsx +1 -4
  90. package/src/lib/Components/index.ts +0 -1
  91. package/src/lib/Symbols/Icons/Lightbulb.tsx +3 -3
  92. package/dist/module/lib/Components/Select/GlobalSelectBottomSheet.js +0 -155
  93. package/dist/module/lib/Components/Select/GlobalSelectBottomSheet.js.map +0 -1
  94. package/dist/module/lib/Components/Select/GlobalSelectContext.js +0 -78
  95. package/dist/module/lib/Components/Select/GlobalSelectContext.js.map +0 -1
  96. package/dist/module/lib/Components/Select/Select.js +0 -366
  97. package/dist/module/lib/Components/Select/Select.js.map +0 -1
  98. package/dist/module/lib/Components/Select/Select.mdx +0 -596
  99. package/dist/module/lib/Components/Select/Select.stories.js +0 -304
  100. package/dist/module/lib/Components/Select/Select.stories.js.map +0 -1
  101. package/dist/module/lib/Components/Select/Select.test.js +0 -123
  102. package/dist/module/lib/Components/Select/Select.test.js.map +0 -1
  103. package/dist/module/lib/Components/Select/SelectContext.js +0 -38
  104. package/dist/module/lib/Components/Select/SelectContext.js.map +0 -1
  105. package/dist/module/lib/Components/Select/index.js +0 -6
  106. package/dist/module/lib/Components/Select/index.js.map +0 -1
  107. package/dist/module/lib/Components/Select/types.js +0 -4
  108. package/dist/module/lib/Components/Select/types.js.map +0 -1
  109. package/dist/typescript/src/lib/Components/Select/GlobalSelectBottomSheet.d.ts +0 -20
  110. package/dist/typescript/src/lib/Components/Select/GlobalSelectBottomSheet.d.ts.map +0 -1
  111. package/dist/typescript/src/lib/Components/Select/GlobalSelectContext.d.ts +0 -44
  112. package/dist/typescript/src/lib/Components/Select/GlobalSelectContext.d.ts.map +0 -1
  113. package/dist/typescript/src/lib/Components/Select/Select.d.ts +0 -52
  114. package/dist/typescript/src/lib/Components/Select/Select.d.ts.map +0 -1
  115. package/dist/typescript/src/lib/Components/Select/SelectContext.d.ts +0 -36
  116. package/dist/typescript/src/lib/Components/Select/SelectContext.d.ts.map +0 -1
  117. package/dist/typescript/src/lib/Components/Select/index.d.ts +0 -4
  118. package/dist/typescript/src/lib/Components/Select/index.d.ts.map +0 -1
  119. package/dist/typescript/src/lib/Components/Select/types.d.ts +0 -130
  120. package/dist/typescript/src/lib/Components/Select/types.d.ts.map +0 -1
  121. package/src/lib/Components/Select/GlobalSelectBottomSheet.tsx +0 -180
  122. package/src/lib/Components/Select/GlobalSelectContext.tsx +0 -103
  123. package/src/lib/Components/Select/Select.mdx +0 -596
  124. package/src/lib/Components/Select/Select.stories.tsx +0 -266
  125. package/src/lib/Components/Select/Select.test.tsx +0 -117
  126. package/src/lib/Components/Select/Select.tsx +0 -469
  127. package/src/lib/Components/Select/SelectContext.tsx +0 -68
  128. package/src/lib/Components/Select/index.ts +0 -3
  129. 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,4 +0,0 @@
1
- export * from './Select';
2
- export * from './GlobalSelectBottomSheet';
3
- export * from './types';
4
- //# sourceMappingURL=index.d.ts.map
@@ -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":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,KAAK,EACV,eAAe,EACf,oBAAoB,EACpB,eAAe,EAChB,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C,MAAM,MAAM,WAAW,GAAG;IACxB;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAC;IACpB;;;OAGG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IACf;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;OAEG;IACH,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACvC;;;;OAIG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACzC,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B;;OAEG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,GAAG,IAAI,CAAC,oBAAoB,EAAE,UAAU,CAAC,CAAC;AAE3C,MAAM,MAAM,kBAAkB,GAAG;IAC/B;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAC;CACrB,GAAG,eAAe,CAAC;AAEpB,MAAM,MAAM,gBAAgB,GAAG;IAC7B;;;OAGG;IACH,QAAQ,EAAE,SAAS,CAAC;CACrB,GAAG,eAAe,CAAC;AAEpB,MAAM,MAAM,eAAe,GAAG;IAC5B;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,QAAQ,EAAE,SAAS,CAAC;IACpB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,GAAG,IAAI,CAAC,cAAc,EAAE,UAAU,GAAG,SAAS,GAAG,UAAU,CAAC,CAAC;AAE9D,MAAM,MAAM,mBAAmB,GAAG;IAChC;;;OAGG;IACH,QAAQ,EAAE,SAAS,CAAC;CACrB,GAAG,eAAe,CAAC;AAEpB,MAAM,MAAM,oBAAoB,GAAG,EAAE,GAAG,QAAQ,CAAC;AAEjD,MAAM,MAAM,cAAc,GAAG;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,IAAI,EAAE,aAAa,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,IAAI,EAAE,WAAW,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,iBAAiB,GACzB,cAAc,GACd,eAAe,GACf,mBAAmB,CAAC;AAExB,MAAM,MAAM,UAAU,GAAG;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,iBAAiB,EAAE,CAAC;IAC3B,aAAa,EAAE,MAAM,GAAG,SAAS,CAAC;IAClC,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IAClC,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC"}
@@ -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
- };