@oxyhq/bloom 0.4.0 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +105 -90
- package/lib/commonjs/bottom-sheet/index.js +2 -2
- package/lib/commonjs/context-menu/index.js +18 -19
- package/lib/commonjs/context-menu/index.js.map +1 -1
- package/lib/commonjs/dialog/BloomDialogProvider.js +61 -0
- package/lib/commonjs/dialog/BloomDialogProvider.js.map +1 -0
- package/lib/commonjs/dialog/BloomDialogProvider.web.js +45 -0
- package/lib/commonjs/dialog/BloomDialogProvider.web.js.map +1 -0
- package/lib/commonjs/dialog/Dialog.js +197 -100
- package/lib/commonjs/dialog/Dialog.js.map +1 -1
- package/lib/commonjs/dialog/Dialog.web.js +194 -84
- package/lib/commonjs/dialog/Dialog.web.js.map +1 -1
- package/lib/commonjs/dialog/SheetShell.js +149 -0
- package/lib/commonjs/dialog/SheetShell.js.map +1 -0
- package/lib/commonjs/dialog/alert-store.js +116 -0
- package/lib/commonjs/dialog/alert-store.js.map +1 -0
- package/lib/commonjs/dialog/alert.js +38 -0
- package/lib/commonjs/dialog/alert.js.map +1 -0
- package/lib/commonjs/dialog/context.js +10 -2
- package/lib/commonjs/dialog/context.js.map +1 -1
- package/lib/commonjs/dialog/index.js +8 -24
- package/lib/commonjs/dialog/index.js.map +1 -1
- package/lib/commonjs/dialog/index.web.js +10 -20
- package/lib/commonjs/dialog/index.web.js.map +1 -1
- package/lib/commonjs/fonts/FontLoader.js +6 -5
- package/lib/commonjs/fonts/FontLoader.js.map +1 -1
- package/lib/commonjs/fonts/apply-font-faces.js +4 -4
- package/lib/commonjs/fonts/apply-font-faces.web.js +13 -12
- package/lib/commonjs/fonts/apply-font-faces.web.js.map +1 -1
- package/lib/commonjs/fonts/font-assets.js +2 -2
- package/lib/commonjs/fonts/font-data.web.js +22 -0
- package/lib/commonjs/fonts/font-data.web.js.map +1 -0
- package/lib/commonjs/index.js +101 -66
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/index.web.js +101 -66
- package/lib/commonjs/index.web.js.map +1 -1
- package/lib/commonjs/menu/index.js +21 -23
- package/lib/commonjs/menu/index.js.map +1 -1
- package/lib/commonjs/select/index.js +26 -27
- package/lib/commonjs/select/index.js.map +1 -1
- package/lib/commonjs/toast/index.js +42 -13
- package/lib/commonjs/toast/index.js.map +1 -1
- package/lib/commonjs/toast/index.web.js +19 -15
- package/lib/commonjs/toast/index.web.js.map +1 -1
- package/lib/module/bottom-sheet/index.js +2 -2
- package/lib/module/context-menu/index.js +15 -16
- package/lib/module/context-menu/index.js.map +1 -1
- package/lib/module/dialog/BloomDialogProvider.js +57 -0
- package/lib/module/dialog/BloomDialogProvider.js.map +1 -0
- package/lib/module/dialog/BloomDialogProvider.web.js +41 -0
- package/lib/module/dialog/BloomDialogProvider.web.js.map +1 -0
- package/lib/module/dialog/Dialog.js +199 -87
- package/lib/module/dialog/Dialog.js.map +1 -1
- package/lib/module/dialog/Dialog.web.js +195 -70
- package/lib/module/dialog/Dialog.web.js.map +1 -1
- package/lib/module/dialog/SheetShell.js +143 -0
- package/lib/module/dialog/SheetShell.js.map +1 -0
- package/lib/module/dialog/alert-store.js +107 -0
- package/lib/module/dialog/alert-store.js.map +1 -0
- package/lib/module/dialog/alert.js +35 -0
- package/lib/module/dialog/alert.js.map +1 -0
- package/lib/module/dialog/context.js +10 -2
- package/lib/module/dialog/context.js.map +1 -1
- package/lib/module/dialog/index.js +3 -1
- package/lib/module/dialog/index.js.map +1 -1
- package/lib/module/dialog/index.web.js +9 -7
- package/lib/module/dialog/index.web.js.map +1 -1
- package/lib/module/fonts/FontLoader.js +6 -5
- package/lib/module/fonts/FontLoader.js.map +1 -1
- package/lib/module/fonts/apply-font-faces.js +4 -4
- package/lib/module/fonts/apply-font-faces.web.js +13 -10
- package/lib/module/fonts/apply-font-faces.web.js.map +1 -1
- package/lib/module/fonts/font-assets.js +2 -2
- package/lib/module/fonts/font-data.web.js +18 -0
- package/lib/module/fonts/font-data.web.js.map +1 -0
- package/lib/module/fonts/index.web.js +4 -4
- package/lib/module/index.js +2 -3
- package/lib/module/index.js.map +1 -1
- package/lib/module/index.web.js +2 -3
- package/lib/module/index.web.js.map +1 -1
- package/lib/module/menu/index.js +11 -13
- package/lib/module/menu/index.js.map +1 -1
- package/lib/module/select/index.js +27 -28
- package/lib/module/select/index.js.map +1 -1
- package/lib/module/toast/index.js +41 -11
- package/lib/module/toast/index.js.map +1 -1
- package/lib/module/toast/index.web.js +18 -13
- package/lib/module/toast/index.web.js.map +1 -1
- package/lib/typescript/commonjs/bottom-sheet/index.d.ts +1 -1
- package/lib/typescript/commonjs/context-menu/index.d.ts +4 -3
- package/lib/typescript/commonjs/context-menu/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/dialog/BloomDialogProvider.d.ts +27 -0
- package/lib/typescript/commonjs/dialog/BloomDialogProvider.d.ts.map +1 -0
- package/lib/typescript/commonjs/dialog/BloomDialogProvider.web.d.ts +15 -0
- package/lib/typescript/commonjs/dialog/BloomDialogProvider.web.d.ts.map +1 -0
- package/lib/typescript/commonjs/dialog/Dialog.d.ts +37 -10
- package/lib/typescript/commonjs/dialog/Dialog.d.ts.map +1 -1
- package/lib/typescript/commonjs/dialog/Dialog.web.d.ts +26 -10
- package/lib/typescript/commonjs/dialog/Dialog.web.d.ts.map +1 -1
- package/lib/typescript/commonjs/dialog/SheetShell.d.ts +31 -0
- package/lib/typescript/commonjs/dialog/SheetShell.d.ts.map +1 -0
- package/lib/typescript/commonjs/dialog/alert-store.d.ts +70 -0
- package/lib/typescript/commonjs/dialog/alert-store.d.ts.map +1 -0
- package/lib/typescript/commonjs/dialog/alert.d.ts +27 -0
- package/lib/typescript/commonjs/dialog/alert.d.ts.map +1 -0
- package/lib/typescript/commonjs/dialog/context.d.ts +7 -0
- package/lib/typescript/commonjs/dialog/context.d.ts.map +1 -1
- package/lib/typescript/commonjs/dialog/index.d.ts +5 -2
- package/lib/typescript/commonjs/dialog/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/dialog/index.web.d.ts +5 -2
- package/lib/typescript/commonjs/dialog/index.web.d.ts.map +1 -1
- package/lib/typescript/commonjs/dialog/types.d.ts +70 -15
- package/lib/typescript/commonjs/dialog/types.d.ts.map +1 -1
- package/lib/typescript/commonjs/fonts/FontLoader.d.ts.map +1 -1
- package/lib/typescript/commonjs/fonts/apply-font-faces.web.d.ts +8 -1
- package/lib/typescript/commonjs/fonts/apply-font-faces.web.d.ts.map +1 -1
- package/lib/typescript/commonjs/fonts/font-data.web.d.ts +5 -0
- package/lib/typescript/commonjs/fonts/font-data.web.d.ts.map +1 -0
- package/lib/typescript/commonjs/index.d.ts +3 -3
- package/lib/typescript/commonjs/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/index.web.d.ts +3 -3
- package/lib/typescript/commonjs/index.web.d.ts.map +1 -1
- package/lib/typescript/commonjs/menu/index.d.ts +4 -4
- package/lib/typescript/commonjs/menu/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/select/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/toast/index.d.ts +32 -3
- package/lib/typescript/commonjs/toast/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/toast/index.web.d.ts +14 -7
- package/lib/typescript/commonjs/toast/index.web.d.ts.map +1 -1
- package/lib/typescript/module/bottom-sheet/index.d.ts +1 -1
- package/lib/typescript/module/context-menu/index.d.ts +4 -3
- package/lib/typescript/module/context-menu/index.d.ts.map +1 -1
- package/lib/typescript/module/dialog/BloomDialogProvider.d.ts +27 -0
- package/lib/typescript/module/dialog/BloomDialogProvider.d.ts.map +1 -0
- package/lib/typescript/module/dialog/BloomDialogProvider.web.d.ts +15 -0
- package/lib/typescript/module/dialog/BloomDialogProvider.web.d.ts.map +1 -0
- package/lib/typescript/module/dialog/Dialog.d.ts +37 -10
- package/lib/typescript/module/dialog/Dialog.d.ts.map +1 -1
- package/lib/typescript/module/dialog/Dialog.web.d.ts +26 -10
- package/lib/typescript/module/dialog/Dialog.web.d.ts.map +1 -1
- package/lib/typescript/module/dialog/SheetShell.d.ts +31 -0
- package/lib/typescript/module/dialog/SheetShell.d.ts.map +1 -0
- package/lib/typescript/module/dialog/alert-store.d.ts +70 -0
- package/lib/typescript/module/dialog/alert-store.d.ts.map +1 -0
- package/lib/typescript/module/dialog/alert.d.ts +27 -0
- package/lib/typescript/module/dialog/alert.d.ts.map +1 -0
- package/lib/typescript/module/dialog/context.d.ts +7 -0
- package/lib/typescript/module/dialog/context.d.ts.map +1 -1
- package/lib/typescript/module/dialog/index.d.ts +5 -2
- package/lib/typescript/module/dialog/index.d.ts.map +1 -1
- package/lib/typescript/module/dialog/index.web.d.ts +5 -2
- package/lib/typescript/module/dialog/index.web.d.ts.map +1 -1
- package/lib/typescript/module/dialog/types.d.ts +70 -15
- package/lib/typescript/module/dialog/types.d.ts.map +1 -1
- package/lib/typescript/module/fonts/FontLoader.d.ts.map +1 -1
- package/lib/typescript/module/fonts/apply-font-faces.web.d.ts +8 -1
- package/lib/typescript/module/fonts/apply-font-faces.web.d.ts.map +1 -1
- package/lib/typescript/module/fonts/font-data.web.d.ts +5 -0
- package/lib/typescript/module/fonts/font-data.web.d.ts.map +1 -0
- package/lib/typescript/module/index.d.ts +3 -3
- package/lib/typescript/module/index.d.ts.map +1 -1
- package/lib/typescript/module/index.web.d.ts +3 -3
- package/lib/typescript/module/index.web.d.ts.map +1 -1
- package/lib/typescript/module/menu/index.d.ts +4 -4
- package/lib/typescript/module/menu/index.d.ts.map +1 -1
- package/lib/typescript/module/select/index.d.ts.map +1 -1
- package/lib/typescript/module/toast/index.d.ts +32 -3
- package/lib/typescript/module/toast/index.d.ts.map +1 -1
- package/lib/typescript/module/toast/index.web.d.ts +14 -7
- package/lib/typescript/module/toast/index.web.d.ts.map +1 -1
- package/package.json +38 -18
- package/src/__tests__/Dialog.test.tsx +177 -0
- package/src/avatar/Avatar.stories.tsx +69 -0
- package/src/bottom-sheet/BottomSheet.stories.tsx +92 -0
- package/src/bottom-sheet/index.tsx +3 -3
- package/src/button/Button.stories.tsx +94 -0
- package/src/context-menu/ContextMenu.stories.tsx +71 -0
- package/src/context-menu/index.tsx +12 -12
- package/src/dialog/BloomDialogProvider.tsx +61 -0
- package/src/dialog/BloomDialogProvider.web.tsx +46 -0
- package/src/dialog/Dialog.stories.tsx +112 -0
- package/src/dialog/Dialog.tsx +217 -64
- package/src/dialog/Dialog.web.tsx +240 -75
- package/src/dialog/SheetShell.tsx +154 -0
- package/src/dialog/alert-store.ts +126 -0
- package/src/dialog/alert.ts +42 -0
- package/src/dialog/context.ts +14 -3
- package/src/dialog/index.ts +14 -2
- package/src/dialog/index.web.ts +20 -8
- package/src/dialog/types.ts +73 -16
- package/src/fonts/FontLoader.tsx +6 -5
- package/src/fonts/apply-font-faces.ts +4 -4
- package/src/fonts/apply-font-faces.web.ts +18 -10
- package/src/fonts/font-assets.ts +2 -2
- package/src/fonts/font-data.web.ts +15 -0
- package/src/fonts/index.web.ts +4 -4
- package/src/index.ts +17 -3
- package/src/index.web.ts +17 -3
- package/src/loading/Loading.stories.tsx +60 -0
- package/src/menu/Menu.stories.tsx +79 -0
- package/src/menu/index.tsx +13 -17
- package/src/prompt-input/PromptInput.stories.tsx +82 -0
- package/src/select/Select.stories.tsx +84 -0
- package/src/select/index.tsx +30 -30
- package/src/settings-list/SettingsList.stories.tsx +106 -0
- package/src/text-field/TextField.stories.tsx +90 -0
- package/src/toast/Toast.stories.tsx +109 -0
- package/src/toast/index.tsx +55 -11
- package/src/toast/index.web.tsx +33 -13
- package/lib/commonjs/fonts/assets/BlomusModernus-Bold.woff2 +0 -0
- package/lib/commonjs/fonts/assets/BlomusModernus-Regular.woff2 +0 -0
- package/lib/commonjs/fonts/assets/GeistMono-Variable.woff2 +0 -0
- package/lib/commonjs/fonts/assets/InterVariable.woff2 +0 -0
- package/lib/commonjs/prompt/Prompt.js +0 -267
- package/lib/commonjs/prompt/Prompt.js.map +0 -1
- package/lib/commonjs/prompt/index.js +0 -61
- package/lib/commonjs/prompt/index.js.map +0 -1
- package/lib/module/fonts/assets/BlomusModernus-Bold.woff2 +0 -0
- package/lib/module/fonts/assets/BlomusModernus-Regular.woff2 +0 -0
- package/lib/module/fonts/assets/GeistMono-Variable.woff2 +0 -0
- package/lib/module/fonts/assets/InterVariable.woff2 +0 -0
- package/lib/module/prompt/Prompt.js +0 -250
- package/lib/module/prompt/Prompt.js.map +0 -1
- package/lib/module/prompt/index.js +0 -4
- package/lib/module/prompt/index.js.map +0 -1
- package/lib/typescript/commonjs/__tests__/BloomThemeProvider.fonts-web.test.d.ts +0 -5
- package/lib/typescript/commonjs/__tests__/BloomThemeProvider.fonts-web.test.d.ts.map +0 -1
- package/lib/typescript/commonjs/__tests__/BloomThemeProvider.test.d.ts +0 -2
- package/lib/typescript/commonjs/__tests__/BloomThemeProvider.test.d.ts.map +0 -1
- package/lib/typescript/commonjs/__tests__/BottomSheet.test.d.ts +0 -2
- package/lib/typescript/commonjs/__tests__/BottomSheet.test.d.ts.map +0 -1
- package/lib/typescript/commonjs/__tests__/Button.test.d.ts +0 -2
- package/lib/typescript/commonjs/__tests__/Button.test.d.ts.map +0 -1
- package/lib/typescript/commonjs/__tests__/Code.test.d.ts +0 -2
- package/lib/typescript/commonjs/__tests__/Code.test.d.ts.map +0 -1
- package/lib/typescript/commonjs/__tests__/FontLoader.native.test.d.ts +0 -2
- package/lib/typescript/commonjs/__tests__/FontLoader.native.test.d.ts.map +0 -1
- package/lib/typescript/commonjs/__tests__/Pre.test.d.ts +0 -2
- package/lib/typescript/commonjs/__tests__/Pre.test.d.ts.map +0 -1
- package/lib/typescript/commonjs/__tests__/SettingsList.test.d.ts +0 -2
- package/lib/typescript/commonjs/__tests__/SettingsList.test.d.ts.map +0 -1
- package/lib/typescript/commonjs/__tests__/apply-font-faces.test.d.ts +0 -5
- package/lib/typescript/commonjs/__tests__/apply-font-faces.test.d.ts.map +0 -1
- package/lib/typescript/commonjs/__tests__/theme.test.d.ts +0 -2
- package/lib/typescript/commonjs/__tests__/theme.test.d.ts.map +0 -1
- package/lib/typescript/commonjs/prompt/Prompt.d.ts +0 -42
- package/lib/typescript/commonjs/prompt/Prompt.d.ts.map +0 -1
- package/lib/typescript/commonjs/prompt/index.d.ts +0 -3
- package/lib/typescript/commonjs/prompt/index.d.ts.map +0 -1
- package/lib/typescript/module/__tests__/BloomThemeProvider.fonts-web.test.d.ts +0 -5
- package/lib/typescript/module/__tests__/BloomThemeProvider.fonts-web.test.d.ts.map +0 -1
- package/lib/typescript/module/__tests__/BloomThemeProvider.test.d.ts +0 -2
- package/lib/typescript/module/__tests__/BloomThemeProvider.test.d.ts.map +0 -1
- package/lib/typescript/module/__tests__/BottomSheet.test.d.ts +0 -2
- package/lib/typescript/module/__tests__/BottomSheet.test.d.ts.map +0 -1
- package/lib/typescript/module/__tests__/Button.test.d.ts +0 -2
- package/lib/typescript/module/__tests__/Button.test.d.ts.map +0 -1
- package/lib/typescript/module/__tests__/Code.test.d.ts +0 -2
- package/lib/typescript/module/__tests__/Code.test.d.ts.map +0 -1
- package/lib/typescript/module/__tests__/FontLoader.native.test.d.ts +0 -2
- package/lib/typescript/module/__tests__/FontLoader.native.test.d.ts.map +0 -1
- package/lib/typescript/module/__tests__/Pre.test.d.ts +0 -2
- package/lib/typescript/module/__tests__/Pre.test.d.ts.map +0 -1
- package/lib/typescript/module/__tests__/SettingsList.test.d.ts +0 -2
- package/lib/typescript/module/__tests__/SettingsList.test.d.ts.map +0 -1
- package/lib/typescript/module/__tests__/apply-font-faces.test.d.ts +0 -5
- package/lib/typescript/module/__tests__/apply-font-faces.test.d.ts.map +0 -1
- package/lib/typescript/module/__tests__/theme.test.d.ts +0 -2
- package/lib/typescript/module/__tests__/theme.test.d.ts.map +0 -1
- package/lib/typescript/module/prompt/Prompt.d.ts +0 -42
- package/lib/typescript/module/prompt/Prompt.d.ts.map +0 -1
- package/lib/typescript/module/prompt/index.d.ts +0 -3
- package/lib/typescript/module/prompt/index.d.ts.map +0 -1
- package/src/prompt/Prompt.tsx +0 -247
- package/src/prompt/index.ts +0 -13
package/src/fonts/index.web.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// Web variant of the `./fonts` barrel.
|
|
2
2
|
//
|
|
3
3
|
// The default barrel (`./index.ts`) re-exports `applyFontFaces` from
|
|
4
|
-
// `./apply-font-faces`, which on native
|
|
5
|
-
//
|
|
6
|
-
//
|
|
7
|
-
//
|
|
4
|
+
// `./apply-font-faces`, which on native is a no-op stub. The web fork
|
|
5
|
+
// explicitly reaches for `./apply-font-faces.web`, which performs the real
|
|
6
|
+
// `@font-face` injection using inlined base64 data URLs (see
|
|
7
|
+
// `font-data.web.ts`).
|
|
8
8
|
//
|
|
9
9
|
// Web bundlers select this file via the `"browser"` condition in
|
|
10
10
|
// `package.json`'s `exports['./fonts']`; native bundlers fall through to
|
package/src/index.ts
CHANGED
|
@@ -18,8 +18,22 @@ export { type Props as IconProps, sizes as iconSizes, useCommonSVGProps } from '
|
|
|
18
18
|
|
|
19
19
|
// Core components
|
|
20
20
|
export * from './portal';
|
|
21
|
-
export
|
|
22
|
-
|
|
21
|
+
export {
|
|
22
|
+
Dialog,
|
|
23
|
+
BloomDialogProvider,
|
|
24
|
+
alert,
|
|
25
|
+
useDialogContext,
|
|
26
|
+
useDialogControl,
|
|
27
|
+
} from './dialog';
|
|
28
|
+
export type {
|
|
29
|
+
AlertButton,
|
|
30
|
+
AlertButtonStyle,
|
|
31
|
+
DialogAction,
|
|
32
|
+
DialogActionColor,
|
|
33
|
+
DialogContextProps,
|
|
34
|
+
DialogControlProps,
|
|
35
|
+
DialogProps,
|
|
36
|
+
} from './dialog';
|
|
23
37
|
export * from './button';
|
|
24
38
|
export * from './grouped-buttons';
|
|
25
39
|
export * from './divider';
|
|
@@ -31,7 +45,7 @@ export * from './avatar';
|
|
|
31
45
|
export * from './loading';
|
|
32
46
|
export * as PromptInput from './prompt-input';
|
|
33
47
|
export * from './switch';
|
|
34
|
-
export
|
|
48
|
+
export { toast, type Toast } from './toast';
|
|
35
49
|
|
|
36
50
|
// Typography
|
|
37
51
|
export * as Typography from './typography';
|
package/src/index.web.ts
CHANGED
|
@@ -23,8 +23,22 @@ export { type Props as IconProps, sizes as iconSizes, useCommonSVGProps } from '
|
|
|
23
23
|
|
|
24
24
|
// Core components
|
|
25
25
|
export * from './portal/index.web';
|
|
26
|
-
export
|
|
27
|
-
|
|
26
|
+
export {
|
|
27
|
+
Dialog,
|
|
28
|
+
BloomDialogProvider,
|
|
29
|
+
alert,
|
|
30
|
+
useDialogContext,
|
|
31
|
+
useDialogControl,
|
|
32
|
+
} from './dialog/index.web';
|
|
33
|
+
export type {
|
|
34
|
+
AlertButton,
|
|
35
|
+
AlertButtonStyle,
|
|
36
|
+
DialogAction,
|
|
37
|
+
DialogActionColor,
|
|
38
|
+
DialogContextProps,
|
|
39
|
+
DialogControlProps,
|
|
40
|
+
DialogProps,
|
|
41
|
+
} from './dialog/index.web';
|
|
28
42
|
export * from './button';
|
|
29
43
|
export * from './grouped-buttons';
|
|
30
44
|
export * from './divider';
|
|
@@ -36,7 +50,7 @@ export * from './avatar';
|
|
|
36
50
|
export * from './loading';
|
|
37
51
|
export * as PromptInput from './prompt-input';
|
|
38
52
|
export * from './switch';
|
|
39
|
-
export
|
|
53
|
+
export { toast, type Toast } from './toast/index.web';
|
|
40
54
|
|
|
41
55
|
// Typography
|
|
42
56
|
export * as Typography from './typography';
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { View } from 'react-native';
|
|
3
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
4
|
+
|
|
5
|
+
import { Loading } from './Loading';
|
|
6
|
+
|
|
7
|
+
const meta: Meta<typeof Loading> = {
|
|
8
|
+
title: 'Components/Loading',
|
|
9
|
+
component: Loading,
|
|
10
|
+
argTypes: {
|
|
11
|
+
variant: {
|
|
12
|
+
control: 'select',
|
|
13
|
+
options: ['spinner', 'top', 'skeleton', 'inline'],
|
|
14
|
+
},
|
|
15
|
+
size: {
|
|
16
|
+
control: 'select',
|
|
17
|
+
options: ['small', 'medium', 'large'],
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export default meta;
|
|
23
|
+
|
|
24
|
+
type Story = StoryObj<typeof Loading>;
|
|
25
|
+
|
|
26
|
+
export const Basic: Story = {
|
|
27
|
+
args: { variant: 'spinner' },
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export const Spinner: Story = {
|
|
31
|
+
args: { variant: 'spinner', text: 'Loading…', showText: true },
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export const Inline: Story = {
|
|
35
|
+
args: { variant: 'inline', text: 'Saving' },
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export const Skeleton: Story = {
|
|
39
|
+
args: { variant: 'skeleton', lines: 4 },
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export const Sizes: Story = {
|
|
43
|
+
render: () => (
|
|
44
|
+
<View style={{ flexDirection: 'row', gap: 24, alignItems: 'center' }}>
|
|
45
|
+
<Loading variant="spinner" size="small" />
|
|
46
|
+
<Loading variant="spinner" size="medium" />
|
|
47
|
+
<Loading variant="spinner" size="large" />
|
|
48
|
+
</View>
|
|
49
|
+
),
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export const Composition: Story = {
|
|
53
|
+
render: () => (
|
|
54
|
+
<View style={{ gap: 24, alignItems: 'flex-start' }}>
|
|
55
|
+
<Loading variant="spinner" size="small" text="Small" />
|
|
56
|
+
<Loading variant="inline" text="Saving changes" />
|
|
57
|
+
<Loading variant="skeleton" lines={3} />
|
|
58
|
+
</View>
|
|
59
|
+
),
|
|
60
|
+
};
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { View } from 'react-native';
|
|
3
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
4
|
+
|
|
5
|
+
import { Button } from '../button';
|
|
6
|
+
import * as Menu from './index';
|
|
7
|
+
|
|
8
|
+
const meta: Meta = {
|
|
9
|
+
title: 'Components/Menu',
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export default meta;
|
|
13
|
+
|
|
14
|
+
type Story = StoryObj;
|
|
15
|
+
|
|
16
|
+
function BasicMenu() {
|
|
17
|
+
return (
|
|
18
|
+
<Menu.Root>
|
|
19
|
+
<Menu.Trigger label="Open menu">
|
|
20
|
+
{({ props }) => (
|
|
21
|
+
<Button onPress={props.onPress}>Open menu</Button>
|
|
22
|
+
)}
|
|
23
|
+
</Menu.Trigger>
|
|
24
|
+
<Menu.Outer>
|
|
25
|
+
<Menu.Group>
|
|
26
|
+
<Menu.Item label="Profile" onPress={() => {}}>
|
|
27
|
+
<Menu.ItemText>Profile</Menu.ItemText>
|
|
28
|
+
</Menu.Item>
|
|
29
|
+
<Menu.Item label="Settings" onPress={() => {}}>
|
|
30
|
+
<Menu.ItemText>Settings</Menu.ItemText>
|
|
31
|
+
</Menu.Item>
|
|
32
|
+
<Menu.Item label="Sign out" onPress={() => {}}>
|
|
33
|
+
<Menu.ItemText>Sign out</Menu.ItemText>
|
|
34
|
+
</Menu.Item>
|
|
35
|
+
</Menu.Group>
|
|
36
|
+
</Menu.Outer>
|
|
37
|
+
</Menu.Root>
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function MenuWithDisabledItem() {
|
|
42
|
+
return (
|
|
43
|
+
<Menu.Root>
|
|
44
|
+
<Menu.Trigger label="Open menu with disabled item">
|
|
45
|
+
{({ props }) => <Button onPress={props.onPress}>Open</Button>}
|
|
46
|
+
</Menu.Trigger>
|
|
47
|
+
<Menu.Outer>
|
|
48
|
+
<Menu.Group>
|
|
49
|
+
<Menu.Item label="Edit" onPress={() => {}}>
|
|
50
|
+
<Menu.ItemText>Edit</Menu.ItemText>
|
|
51
|
+
</Menu.Item>
|
|
52
|
+
<Menu.Item label="Duplicate" onPress={() => {}} disabled>
|
|
53
|
+
<Menu.ItemText>Duplicate (disabled)</Menu.ItemText>
|
|
54
|
+
</Menu.Item>
|
|
55
|
+
<Menu.Item label="Delete" onPress={() => {}}>
|
|
56
|
+
<Menu.ItemText>Delete</Menu.ItemText>
|
|
57
|
+
</Menu.Item>
|
|
58
|
+
</Menu.Group>
|
|
59
|
+
</Menu.Outer>
|
|
60
|
+
</Menu.Root>
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export const Basic: Story = {
|
|
65
|
+
render: () => <BasicMenu />,
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
export const WithDisabled: Story = {
|
|
69
|
+
render: () => <MenuWithDisabledItem />,
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
export const Composition: Story = {
|
|
73
|
+
render: () => (
|
|
74
|
+
<View style={{ gap: 12, alignItems: 'flex-start' }}>
|
|
75
|
+
<BasicMenu />
|
|
76
|
+
<MenuWithDisabledItem />
|
|
77
|
+
</View>
|
|
78
|
+
),
|
|
79
|
+
};
|
package/src/menu/index.tsx
CHANGED
|
@@ -4,7 +4,9 @@ import { Pressable, StyleSheet, View, type StyleProp, type ViewStyle } from 'rea
|
|
|
4
4
|
import { useTheme } from '../theme/use-theme';
|
|
5
5
|
import { Text } from '../typography';
|
|
6
6
|
import { Button } from '../button';
|
|
7
|
-
import
|
|
7
|
+
import { useDialogControl } from '../dialog/context';
|
|
8
|
+
import { SheetShell } from '../dialog/SheetShell';
|
|
9
|
+
import type { DialogControlProps } from '../dialog/types';
|
|
8
10
|
import {
|
|
9
11
|
MenuContext,
|
|
10
12
|
ItemContext,
|
|
@@ -20,17 +22,17 @@ import type {
|
|
|
20
22
|
TriggerProps,
|
|
21
23
|
} from './types';
|
|
22
24
|
|
|
23
|
-
export type { DialogControlProps as MenuControlProps } from '../dialog';
|
|
24
|
-
export { useDialogControl as useMenuControl } from '../dialog';
|
|
25
|
+
export type { DialogControlProps as MenuControlProps } from '../dialog/types';
|
|
26
|
+
export { useDialogControl as useMenuControl } from '../dialog/context';
|
|
25
27
|
export { useMenuContext };
|
|
26
28
|
|
|
27
29
|
export function Root({
|
|
28
30
|
children,
|
|
29
31
|
control,
|
|
30
32
|
}: React.PropsWithChildren<{
|
|
31
|
-
control?:
|
|
33
|
+
control?: DialogControlProps;
|
|
32
34
|
}>) {
|
|
33
|
-
const defaultControl =
|
|
35
|
+
const defaultControl = useDialogControl();
|
|
34
36
|
const context = useMemo<MenuContextType>(
|
|
35
37
|
() => ({
|
|
36
38
|
control: control ?? defaultControl,
|
|
@@ -83,20 +85,14 @@ export function Outer({
|
|
|
83
85
|
const context = useMenuContext();
|
|
84
86
|
|
|
85
87
|
return (
|
|
86
|
-
<
|
|
87
|
-
control={context.control}
|
|
88
|
-
preventExpansion
|
|
89
|
-
>
|
|
90
|
-
<Dialog.Handle />
|
|
88
|
+
<SheetShell control={context.control} label="Menu">
|
|
91
89
|
<MenuContext.Provider value={context}>
|
|
92
|
-
<
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
</View>
|
|
97
|
-
</Dialog.ScrollableInner>
|
|
90
|
+
<View style={styles.outerContent}>
|
|
91
|
+
{children}
|
|
92
|
+
{showCancel && <Cancel />}
|
|
93
|
+
</View>
|
|
98
94
|
</MenuContext.Provider>
|
|
99
|
-
</
|
|
95
|
+
</SheetShell>
|
|
100
96
|
);
|
|
101
97
|
}
|
|
102
98
|
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { View } from 'react-native';
|
|
3
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
4
|
+
|
|
5
|
+
import { PromptInput } from './PromptInput';
|
|
6
|
+
|
|
7
|
+
const meta: Meta<typeof PromptInput> = {
|
|
8
|
+
title: 'Components/PromptInput',
|
|
9
|
+
component: PromptInput,
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export default meta;
|
|
13
|
+
|
|
14
|
+
type Story = StoryObj<typeof PromptInput>;
|
|
15
|
+
|
|
16
|
+
function BasicPrompt() {
|
|
17
|
+
const [value, setValue] = useState('');
|
|
18
|
+
return (
|
|
19
|
+
<View style={{ width: 480 }}>
|
|
20
|
+
<PromptInput
|
|
21
|
+
value={value}
|
|
22
|
+
onValueChange={setValue}
|
|
23
|
+
placeholder="Ask anything"
|
|
24
|
+
onSubmit={() => {
|
|
25
|
+
// submitted
|
|
26
|
+
setValue('');
|
|
27
|
+
}}
|
|
28
|
+
/>
|
|
29
|
+
</View>
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function LoadingPrompt() {
|
|
34
|
+
const [value, setValue] = useState('Generating response...');
|
|
35
|
+
return (
|
|
36
|
+
<View style={{ width: 480 }}>
|
|
37
|
+
<PromptInput
|
|
38
|
+
value={value}
|
|
39
|
+
onValueChange={setValue}
|
|
40
|
+
placeholder="Ask anything"
|
|
41
|
+
isLoading
|
|
42
|
+
onSubmit={() => {}}
|
|
43
|
+
onStop={() => {}}
|
|
44
|
+
/>
|
|
45
|
+
</View>
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function DisabledPrompt() {
|
|
50
|
+
return (
|
|
51
|
+
<View style={{ width: 480 }}>
|
|
52
|
+
<PromptInput
|
|
53
|
+
value=""
|
|
54
|
+
placeholder="Disabled"
|
|
55
|
+
disabled
|
|
56
|
+
onSubmit={() => {}}
|
|
57
|
+
/>
|
|
58
|
+
</View>
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export const Basic: Story = {
|
|
63
|
+
render: () => <BasicPrompt />,
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
export const Loading: Story = {
|
|
67
|
+
render: () => <LoadingPrompt />,
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
export const Disabled: Story = {
|
|
71
|
+
render: () => <DisabledPrompt />,
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
export const Composition: Story = {
|
|
75
|
+
render: () => (
|
|
76
|
+
<View style={{ gap: 16 }}>
|
|
77
|
+
<BasicPrompt />
|
|
78
|
+
<LoadingPrompt />
|
|
79
|
+
<DisabledPrompt />
|
|
80
|
+
</View>
|
|
81
|
+
),
|
|
82
|
+
};
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { View } from 'react-native';
|
|
3
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
4
|
+
|
|
5
|
+
import * as Select from './index';
|
|
6
|
+
|
|
7
|
+
const meta: Meta = {
|
|
8
|
+
title: 'Components/Select',
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export default meta;
|
|
12
|
+
|
|
13
|
+
type Story = StoryObj;
|
|
14
|
+
|
|
15
|
+
type Option = { value: string; label: string };
|
|
16
|
+
|
|
17
|
+
const FRUITS: Option[] = [
|
|
18
|
+
{ value: 'apple', label: 'Apple' },
|
|
19
|
+
{ value: 'banana', label: 'Banana' },
|
|
20
|
+
{ value: 'cherry', label: 'Cherry' },
|
|
21
|
+
{ value: 'durian', label: 'Durian' },
|
|
22
|
+
{ value: 'elderberry', label: 'Elderberry' },
|
|
23
|
+
];
|
|
24
|
+
|
|
25
|
+
function BasicSelect() {
|
|
26
|
+
const [value, setValue] = useState<string>('apple');
|
|
27
|
+
return (
|
|
28
|
+
<Select.Root value={value} onValueChange={setValue}>
|
|
29
|
+
<Select.Trigger label="Pick a fruit">
|
|
30
|
+
<Select.ValueText placeholder="Pick a fruit" />
|
|
31
|
+
<Select.Icon />
|
|
32
|
+
</Select.Trigger>
|
|
33
|
+
<Select.Content
|
|
34
|
+
label="Pick a fruit"
|
|
35
|
+
items={FRUITS}
|
|
36
|
+
renderItem={(item) => (
|
|
37
|
+
<Select.Item value={item.value} label={item.label}>
|
|
38
|
+
<Select.ItemIndicator />
|
|
39
|
+
<Select.ItemText>{item.label}</Select.ItemText>
|
|
40
|
+
</Select.Item>
|
|
41
|
+
)}
|
|
42
|
+
/>
|
|
43
|
+
</Select.Root>
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function UncontrolledSelect() {
|
|
48
|
+
const [value, setValue] = useState<string | undefined>(undefined);
|
|
49
|
+
return (
|
|
50
|
+
<Select.Root value={value} onValueChange={setValue}>
|
|
51
|
+
<Select.Trigger label="Pick a fruit">
|
|
52
|
+
<Select.ValueText placeholder="No fruit selected" />
|
|
53
|
+
<Select.Icon />
|
|
54
|
+
</Select.Trigger>
|
|
55
|
+
<Select.Content
|
|
56
|
+
label="Pick a fruit"
|
|
57
|
+
items={FRUITS}
|
|
58
|
+
renderItem={(item) => (
|
|
59
|
+
<Select.Item value={item.value} label={item.label}>
|
|
60
|
+
<Select.ItemIndicator />
|
|
61
|
+
<Select.ItemText>{item.label}</Select.ItemText>
|
|
62
|
+
</Select.Item>
|
|
63
|
+
)}
|
|
64
|
+
/>
|
|
65
|
+
</Select.Root>
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export const Basic: Story = {
|
|
70
|
+
render: () => <BasicSelect />,
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
export const WithPlaceholder: Story = {
|
|
74
|
+
render: () => <UncontrolledSelect />,
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
export const Composition: Story = {
|
|
78
|
+
render: () => (
|
|
79
|
+
<View style={{ gap: 16 }}>
|
|
80
|
+
<BasicSelect />
|
|
81
|
+
<UncontrolledSelect />
|
|
82
|
+
</View>
|
|
83
|
+
),
|
|
84
|
+
};
|
package/src/select/index.tsx
CHANGED
|
@@ -11,7 +11,9 @@ import { FlatList, Pressable, StyleSheet, View } from 'react-native';
|
|
|
11
11
|
import { useTheme } from '../theme/use-theme';
|
|
12
12
|
import { Text } from '../typography';
|
|
13
13
|
import { Button } from '../button';
|
|
14
|
-
import
|
|
14
|
+
import { useDialogContext, useDialogControl } from '../dialog/context';
|
|
15
|
+
import { SheetShell } from '../dialog/SheetShell';
|
|
16
|
+
import type { DialogControlProps } from '../dialog/types';
|
|
15
17
|
import { RadioIndicator } from '../radio-indicator';
|
|
16
18
|
import { useInteractionState } from '../hooks/useInteractionState';
|
|
17
19
|
import {
|
|
@@ -37,7 +39,7 @@ export { useItemContext };
|
|
|
37
39
|
// ---------------------------------------------------------------------------
|
|
38
40
|
|
|
39
41
|
type SelectContextValue = {
|
|
40
|
-
control:
|
|
42
|
+
control: DialogControlProps;
|
|
41
43
|
} & Pick<RootProps, 'value' | 'onValueChange' | 'disabled'>;
|
|
42
44
|
|
|
43
45
|
const SelectContext = createContext<SelectContextValue | null>(null);
|
|
@@ -61,7 +63,7 @@ function useSelectContext(): SelectContextValue {
|
|
|
61
63
|
// ---------------------------------------------------------------------------
|
|
62
64
|
|
|
63
65
|
export function Root({ children, value, onValueChange, disabled }: RootProps) {
|
|
64
|
-
const control =
|
|
66
|
+
const control = useDialogControl();
|
|
65
67
|
const valueStoreState = useState<unknown>(undefined);
|
|
66
68
|
|
|
67
69
|
const ctx = useMemo<SelectContextValue>(
|
|
@@ -187,23 +189,21 @@ export function Content<T>({
|
|
|
187
189
|
}, [items, context.value, valueExtractor, setStoredValue]);
|
|
188
190
|
|
|
189
191
|
return (
|
|
190
|
-
<
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
/>
|
|
200
|
-
</Dialog.Outer>
|
|
192
|
+
<ContentInner
|
|
193
|
+
control={control}
|
|
194
|
+
items={items}
|
|
195
|
+
valueExtractor={valueExtractor}
|
|
196
|
+
{...props}
|
|
197
|
+
value={context.value}
|
|
198
|
+
onValueChange={context.onValueChange}
|
|
199
|
+
disabled={context.disabled}
|
|
200
|
+
/>
|
|
201
201
|
);
|
|
202
202
|
}
|
|
203
203
|
|
|
204
204
|
type ContentInnerProps<T> = ContentProps<T> &
|
|
205
205
|
Pick<RootProps, 'value' | 'onValueChange' | 'disabled'> & {
|
|
206
|
-
control:
|
|
206
|
+
control: DialogControlProps;
|
|
207
207
|
};
|
|
208
208
|
|
|
209
209
|
function ContentInner<T>({
|
|
@@ -234,26 +234,26 @@ function ContentInner<T>({
|
|
|
234
234
|
);
|
|
235
235
|
|
|
236
236
|
return (
|
|
237
|
-
<
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
<
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
>
|
|
237
|
+
<SheetShell
|
|
238
|
+
control={control}
|
|
239
|
+
label={label}
|
|
240
|
+
header={
|
|
241
|
+
<View style={styles.contentHeader}>
|
|
242
|
+
<Text style={[styles.contentHeaderText, { color: theme.colors.text }]}>
|
|
243
|
+
{label}
|
|
244
|
+
</Text>
|
|
245
|
+
</View>
|
|
246
|
+
}
|
|
247
|
+
>
|
|
248
|
+
<SelectContext.Provider value={ctx}>
|
|
249
249
|
<FlatList
|
|
250
250
|
data={items}
|
|
251
251
|
renderItem={render}
|
|
252
252
|
keyExtractor={valueExtractor}
|
|
253
253
|
style={styles.flatList}
|
|
254
254
|
/>
|
|
255
|
-
</
|
|
256
|
-
</
|
|
255
|
+
</SelectContext.Provider>
|
|
256
|
+
</SheetShell>
|
|
257
257
|
);
|
|
258
258
|
}
|
|
259
259
|
|
|
@@ -267,7 +267,7 @@ function ContentInner<T>({
|
|
|
267
267
|
|
|
268
268
|
export function Item({ children, value, label, style }: ItemProps) {
|
|
269
269
|
const theme = useTheme();
|
|
270
|
-
const { close } =
|
|
270
|
+
const { close } = useDialogContext();
|
|
271
271
|
const { value: selectedValue, onValueChange } = useSelectContext();
|
|
272
272
|
const { state: focused, onIn: onFocus, onOut: onBlur } = useInteractionState();
|
|
273
273
|
const {
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { View } from 'react-native';
|
|
3
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
4
|
+
|
|
5
|
+
import { Switch } from '../switch';
|
|
6
|
+
import {
|
|
7
|
+
SettingsListGroup,
|
|
8
|
+
SettingsListItem,
|
|
9
|
+
SettingsListDivider,
|
|
10
|
+
} from './SettingsList';
|
|
11
|
+
|
|
12
|
+
const meta: Meta = {
|
|
13
|
+
title: 'Components/SettingsList',
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export default meta;
|
|
17
|
+
|
|
18
|
+
type Story = StoryObj;
|
|
19
|
+
|
|
20
|
+
function BasicList() {
|
|
21
|
+
return (
|
|
22
|
+
<View style={{ width: 360 }}>
|
|
23
|
+
<SettingsListGroup title="Account">
|
|
24
|
+
<SettingsListItem
|
|
25
|
+
title="Profile"
|
|
26
|
+
description="Manage your account profile"
|
|
27
|
+
onPress={() => {}}
|
|
28
|
+
/>
|
|
29
|
+
<SettingsListItem
|
|
30
|
+
title="Email"
|
|
31
|
+
value="nate@oxy.so"
|
|
32
|
+
onPress={() => {}}
|
|
33
|
+
/>
|
|
34
|
+
<SettingsListItem
|
|
35
|
+
title="Sign out"
|
|
36
|
+
destructive
|
|
37
|
+
onPress={() => {}}
|
|
38
|
+
/>
|
|
39
|
+
</SettingsListGroup>
|
|
40
|
+
</View>
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function WithToggles() {
|
|
45
|
+
const [notifs, setNotifs] = useState(true);
|
|
46
|
+
const [dark, setDark] = useState(false);
|
|
47
|
+
return (
|
|
48
|
+
<View style={{ width: 360 }}>
|
|
49
|
+
<SettingsListGroup title="Preferences" footer="Changes apply immediately.">
|
|
50
|
+
<SettingsListItem
|
|
51
|
+
title="Push notifications"
|
|
52
|
+
rightElement={
|
|
53
|
+
<Switch value={notifs} onValueChange={setNotifs} />
|
|
54
|
+
}
|
|
55
|
+
showChevron={false}
|
|
56
|
+
/>
|
|
57
|
+
<SettingsListItem
|
|
58
|
+
title="Dark mode"
|
|
59
|
+
rightElement={<Switch value={dark} onValueChange={setDark} />}
|
|
60
|
+
showChevron={false}
|
|
61
|
+
/>
|
|
62
|
+
</SettingsListGroup>
|
|
63
|
+
</View>
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function DescriptionList() {
|
|
68
|
+
return (
|
|
69
|
+
<View style={{ width: 360 }}>
|
|
70
|
+
<SettingsListGroup title="Security">
|
|
71
|
+
<SettingsListItem
|
|
72
|
+
title="Two-factor authentication"
|
|
73
|
+
description="Add an extra layer of security to your account."
|
|
74
|
+
onPress={() => {}}
|
|
75
|
+
/>
|
|
76
|
+
<SettingsListItem
|
|
77
|
+
title="Active sessions"
|
|
78
|
+
description="View where your account is signed in."
|
|
79
|
+
onPress={() => {}}
|
|
80
|
+
/>
|
|
81
|
+
</SettingsListGroup>
|
|
82
|
+
</View>
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export const Basic: Story = {
|
|
87
|
+
render: () => <BasicList />,
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
export const WithRightElements: Story = {
|
|
91
|
+
render: () => <WithToggles />,
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
export const WithDescriptions: Story = {
|
|
95
|
+
render: () => <DescriptionList />,
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
export const Composition: Story = {
|
|
99
|
+
render: () => (
|
|
100
|
+
<View style={{ gap: 24, width: 360 }}>
|
|
101
|
+
<DescriptionList />
|
|
102
|
+
<SettingsListDivider />
|
|
103
|
+
<WithToggles />
|
|
104
|
+
</View>
|
|
105
|
+
),
|
|
106
|
+
};
|