@ankhorage/zora 13.0.0 → 14.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/README.md +182 -6
- package/dist/features/accordion/adapters/inbound/Accordion.js +4 -4
- package/dist/features/accordion/adapters/inbound/Accordion.js.map +1 -1
- package/dist/features/accordion/adapters/inbound/AccordionItem.js +1 -1
- package/dist/features/accordion/adapters/inbound/AccordionItem.js.map +1 -1
- package/dist/features/app-bar/adapters/inbound/AppBar.d.ts +5 -0
- package/dist/features/app-bar/adapters/inbound/AppBar.d.ts.map +1 -0
- package/dist/features/app-bar/adapters/inbound/AppBar.js +91 -0
- package/dist/features/app-bar/adapters/inbound/AppBar.js.map +1 -0
- package/dist/{components/app-bar/meta.d.ts → features/app-bar/appBarMeta.d.ts} +1 -1
- package/dist/features/app-bar/appBarMeta.d.ts.map +1 -0
- package/dist/{components/app-bar/meta.js → features/app-bar/appBarMeta.js} +1 -1
- package/dist/features/app-bar/appBarMeta.js.map +1 -0
- package/dist/features/app-bar/public.d.ts +3 -0
- package/dist/features/app-bar/public.d.ts.map +1 -0
- package/dist/features/app-bar/public.js +2 -0
- package/dist/features/app-bar/public.js.map +1 -0
- package/dist/features/date-picker/adapters/inbound/DatePicker.d.ts +1 -6
- package/dist/features/date-picker/adapters/inbound/DatePicker.d.ts.map +1 -1
- package/dist/features/date-picker/adapters/inbound/DatePicker.js +1 -175
- package/dist/features/date-picker/adapters/inbound/DatePicker.js.map +1 -1
- package/dist/features/date-picker/adapters/inbound/DatePicker.native.d.ts +5 -0
- package/dist/features/date-picker/adapters/inbound/DatePicker.native.d.ts.map +1 -0
- package/dist/features/date-picker/adapters/inbound/DatePicker.native.js +27 -0
- package/dist/features/date-picker/adapters/inbound/DatePicker.native.js.map +1 -0
- package/dist/features/date-picker/adapters/inbound/DatePicker.web.d.ts +5 -0
- package/dist/features/date-picker/adapters/inbound/DatePicker.web.d.ts.map +1 -0
- package/dist/features/date-picker/adapters/inbound/DatePicker.web.js +25 -0
- package/dist/features/date-picker/adapters/inbound/DatePicker.web.js.map +1 -0
- package/dist/features/date-picker/composition/DatePickerContent.d.ts +10 -0
- package/dist/features/date-picker/composition/DatePickerContent.d.ts.map +1 -0
- package/dist/features/date-picker/composition/DatePickerContent.js +129 -0
- package/dist/features/date-picker/composition/DatePickerContent.js.map +1 -0
- package/dist/features/date-picker/composition/DatePickerField.d.ts +9 -0
- package/dist/features/date-picker/composition/DatePickerField.d.ts.map +1 -0
- package/dist/features/date-picker/composition/DatePickerField.js +21 -0
- package/dist/features/date-picker/composition/DatePickerField.js.map +1 -0
- package/dist/features/date-picker/composition/DatePickerTrigger.d.ts +9 -0
- package/dist/features/date-picker/composition/DatePickerTrigger.d.ts.map +1 -0
- package/dist/features/date-picker/composition/DatePickerTrigger.js +18 -0
- package/dist/features/date-picker/composition/DatePickerTrigger.js.map +1 -0
- package/dist/features/time-picker/adapters/inbound/TimePicker.d.ts +1 -6
- package/dist/features/time-picker/adapters/inbound/TimePicker.d.ts.map +1 -1
- package/dist/features/time-picker/adapters/inbound/TimePicker.js +1 -116
- package/dist/features/time-picker/adapters/inbound/TimePicker.js.map +1 -1
- package/dist/features/time-picker/adapters/inbound/TimePicker.native.d.ts +5 -0
- package/dist/features/time-picker/adapters/inbound/TimePicker.native.d.ts.map +1 -0
- package/dist/features/time-picker/adapters/inbound/TimePicker.native.js +26 -0
- package/dist/features/time-picker/adapters/inbound/TimePicker.native.js.map +1 -0
- package/dist/features/time-picker/adapters/inbound/TimePicker.web.d.ts +5 -0
- package/dist/features/time-picker/adapters/inbound/TimePicker.web.d.ts.map +1 -0
- package/dist/features/time-picker/adapters/inbound/TimePicker.web.js +24 -0
- package/dist/features/time-picker/adapters/inbound/TimePicker.web.js.map +1 -0
- package/dist/features/time-picker/composition/TimePickerContent.d.ts +10 -0
- package/dist/features/time-picker/composition/TimePickerContent.d.ts.map +1 -0
- package/dist/features/time-picker/composition/TimePickerContent.js +78 -0
- package/dist/features/time-picker/composition/TimePickerContent.js.map +1 -0
- package/dist/features/time-picker/composition/TimePickerField.d.ts +9 -0
- package/dist/features/time-picker/composition/TimePickerField.d.ts.map +1 -0
- package/dist/features/time-picker/composition/TimePickerField.js +21 -0
- package/dist/features/time-picker/composition/TimePickerField.js.map +1 -0
- package/dist/features/time-picker/composition/TimePickerTrigger.d.ts +8 -0
- package/dist/features/time-picker/composition/TimePickerTrigger.d.ts.map +1 -0
- package/dist/features/time-picker/composition/TimePickerTrigger.js +9 -0
- package/dist/features/time-picker/composition/TimePickerTrigger.js.map +1 -0
- package/dist/features/toast/adapters/inbound/Toast.d.ts +5 -0
- package/dist/features/toast/adapters/inbound/Toast.d.ts.map +1 -0
- package/dist/features/toast/adapters/inbound/Toast.js +10 -0
- package/dist/features/toast/adapters/inbound/Toast.js.map +1 -0
- package/dist/features/toast/adapters/inbound/ToastProvider.d.ts +5 -0
- package/dist/features/toast/adapters/inbound/ToastProvider.d.ts.map +1 -0
- package/dist/features/toast/adapters/inbound/ToastProvider.js +7 -0
- package/dist/features/toast/adapters/inbound/ToastProvider.js.map +1 -0
- package/dist/features/toast/public.d.ts +5 -0
- package/dist/features/toast/public.d.ts.map +1 -0
- package/dist/features/toast/public.js +4 -0
- package/dist/features/toast/public.js.map +1 -0
- package/dist/features/toast/toastMeta.d.ts +9 -0
- package/dist/features/toast/toastMeta.d.ts.map +1 -0
- package/dist/features/toast/toastMeta.js +9 -0
- package/dist/features/toast/toastMeta.js.map +1 -0
- package/dist/features/toast/toastProviderMeta.d.ts +9 -0
- package/dist/features/toast/toastProviderMeta.d.ts.map +1 -0
- package/dist/features/toast/toastProviderMeta.js +9 -0
- package/dist/features/toast/toastProviderMeta.js.map +1 -0
- package/dist/index.d.ts +4 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/layout/settings-layout/SettingsLayout.d.ts +0 -2
- package/dist/layout/settings-layout/SettingsLayout.d.ts.map +1 -1
- package/dist/layout/settings-layout/SettingsLayout.js +1 -3
- package/dist/layout/settings-layout/SettingsLayout.js.map +1 -1
- package/dist/metadata/componentMeta.d.ts.map +1 -1
- package/dist/metadata/componentMeta.js +3 -2
- package/dist/metadata/componentMeta.js.map +1 -1
- package/dist/patterns/reader/ReaderSurface.js +1 -1
- package/dist/patterns/reader/ReaderSurface.js.map +1 -1
- package/dist/patterns/selection/SelectionProvider.d.ts +0 -4
- package/dist/patterns/selection/SelectionProvider.d.ts.map +1 -1
- package/dist/patterns/selection/SelectionProvider.js +4 -6
- package/dist/patterns/selection/SelectionProvider.js.map +1 -1
- package/dist/registry.js +2 -2
- package/dist/registry.js.map +1 -1
- package/dist/theme/ZoraProvider.d.ts +4 -10
- package/dist/theme/ZoraProvider.d.ts.map +1 -1
- package/dist/theme/ZoraProvider.js +8 -6
- package/dist/theme/ZoraProvider.js.map +1 -1
- package/dist/theme/ZoraRuntimeCapabilities.d.ts +2 -0
- package/dist/theme/ZoraRuntimeCapabilities.d.ts.map +1 -0
- package/dist/theme/ZoraRuntimeCapabilities.js +2 -0
- package/dist/theme/ZoraRuntimeCapabilities.js.map +1 -0
- package/dist/theme/ZoraRuntimeCapabilities.native.d.ts +4 -0
- package/dist/theme/ZoraRuntimeCapabilities.native.d.ts.map +1 -0
- package/dist/theme/ZoraRuntimeCapabilities.native.js +8 -0
- package/dist/theme/ZoraRuntimeCapabilities.native.js.map +1 -0
- package/dist/theme/ZoraRuntimeCapabilities.web.d.ts +4 -0
- package/dist/theme/ZoraRuntimeCapabilities.web.d.ts.map +1 -0
- package/dist/theme/ZoraRuntimeCapabilities.web.js +8 -0
- package/dist/theme/ZoraRuntimeCapabilities.web.js.map +1 -0
- package/dist/theme/ZoraThemeRuntimeContext.d.ts +1 -0
- package/dist/theme/ZoraThemeRuntimeContext.d.ts.map +1 -1
- package/dist/theme/ZoraThemeRuntimeContext.js +3 -2
- package/dist/theme/ZoraThemeRuntimeContext.js.map +1 -1
- package/dist/theme/ZoraThemeScope.d.ts +1 -0
- package/dist/theme/ZoraThemeScope.d.ts.map +1 -1
- package/dist/theme/ZoraThemeScope.js +12 -10
- package/dist/theme/ZoraThemeScope.js.map +1 -1
- package/dist/theme/index.d.ts +1 -1
- package/dist/theme/index.d.ts.map +1 -1
- package/dist/theme/index.js.map +1 -1
- package/dist/{components/app-bar/types.d.ts → types/app-bar.d.ts} +2 -2
- package/dist/types/app-bar.d.ts.map +1 -0
- package/dist/types/app-bar.js +2 -0
- package/dist/types/app-bar.js.map +1 -0
- package/dist/types/provider.d.ts +19 -0
- package/dist/types/provider.d.ts.map +1 -0
- package/dist/types/provider.js +2 -0
- package/dist/types/provider.js.map +1 -0
- package/dist/types/toast.d.ts +9 -0
- package/dist/types/toast.d.ts.map +1 -0
- package/dist/types/toast.js +2 -0
- package/dist/types/toast.js.map +1 -0
- package/package.json +2 -2
- package/src/features/accordion/adapters/inbound/Accordion.tsx +4 -4
- package/src/features/accordion/adapters/inbound/AccordionItem.tsx +1 -1
- package/src/features/app-bar/adapters/inbound/AppBar.tsx +176 -0
- package/src/features/app-bar/public.ts +2 -0
- package/src/features/bottom-sheet/public.test.ts +15 -12
- package/src/features/date-picker/adapters/inbound/DatePicker.native.tsx +46 -0
- package/src/features/date-picker/adapters/inbound/DatePicker.tsx +1 -356
- package/src/features/date-picker/adapters/inbound/DatePicker.web.tsx +48 -0
- package/src/features/date-picker/composition/DatePickerContent.tsx +256 -0
- package/src/features/date-picker/composition/DatePickerField.tsx +53 -0
- package/src/features/date-picker/composition/DatePickerTrigger.tsx +47 -0
- package/src/features/date-picker/public.test.ts +14 -4
- package/src/features/time-picker/adapters/inbound/TimePicker.native.tsx +47 -0
- package/src/features/time-picker/adapters/inbound/TimePicker.tsx +1 -258
- package/src/features/time-picker/adapters/inbound/TimePicker.web.tsx +49 -0
- package/src/features/time-picker/composition/TimePickerContent.tsx +164 -0
- package/src/features/time-picker/composition/TimePickerField.tsx +53 -0
- package/src/features/time-picker/composition/TimePickerTrigger.tsx +35 -0
- package/src/features/time-picker/public.test.ts +14 -3
- package/src/features/toast/adapters/inbound/Toast.tsx +13 -0
- package/src/features/toast/adapters/inbound/ToastProvider.tsx +9 -0
- package/src/features/toast/public.test.ts +19 -0
- package/src/features/toast/public.ts +10 -0
- package/src/features/toast/toastMeta.ts +10 -0
- package/src/features/toast/toastProviderMeta.ts +10 -0
- package/src/index.ts +10 -4
- package/src/interactionPolicy.test.ts +7 -3
- package/src/layout/settings-layout/SettingsLayout.tsx +1 -3
- package/src/metadata/componentMeta.ts +3 -2
- package/src/patterns/reader/ReaderSurface.tsx +1 -1
- package/src/patterns/selection/SelectionProvider.tsx +4 -6
- package/src/registry.ts +2 -2
- package/src/theme/ZoraProvider.tsx +11 -13
- package/src/theme/ZoraRuntimeCapabilities.native.tsx +19 -0
- package/src/theme/ZoraRuntimeCapabilities.tsx +1 -0
- package/src/theme/ZoraRuntimeCapabilities.web.tsx +10 -0
- package/src/theme/ZoraThemeRuntimeContext.tsx +3 -2
- package/src/theme/ZoraThemeScope.tsx +14 -12
- package/src/theme/index.ts +1 -1
- package/src/theme/themeConfigScope.test.ts +4 -1
- package/src/theme/themeScopeStructure.test.ts +26 -18
- package/src/{components/app-bar/types.ts → types/app-bar.ts} +1 -1
- package/src/types/provider.ts +22 -0
- package/src/{components/toast/types.ts → types/toast.ts} +5 -7
- package/dist/components/app-bar/AppBar.d.ts +0 -7
- package/dist/components/app-bar/AppBar.d.ts.map +0 -1
- package/dist/components/app-bar/AppBar.js +0 -67
- package/dist/components/app-bar/AppBar.js.map +0 -1
- package/dist/components/app-bar/index.d.ts +0 -3
- package/dist/components/app-bar/index.d.ts.map +0 -1
- package/dist/components/app-bar/index.js +0 -3
- package/dist/components/app-bar/index.js.map +0 -1
- package/dist/components/app-bar/meta.d.ts.map +0 -1
- package/dist/components/app-bar/meta.js.map +0 -1
- package/dist/components/app-bar/types.d.ts.map +0 -1
- package/dist/components/app-bar/types.js +0 -2
- package/dist/components/app-bar/types.js.map +0 -1
- package/dist/components/toast/Toast.d.ts +0 -9
- package/dist/components/toast/Toast.d.ts.map +0 -1
- package/dist/components/toast/Toast.js +0 -13
- package/dist/components/toast/Toast.js.map +0 -1
- package/dist/components/toast/ToastProvider.d.ts +0 -9
- package/dist/components/toast/ToastProvider.d.ts.map +0 -1
- package/dist/components/toast/ToastProvider.js +0 -14
- package/dist/components/toast/ToastProvider.js.map +0 -1
- package/dist/components/toast/index.d.ts +0 -5
- package/dist/components/toast/index.d.ts.map +0 -1
- package/dist/components/toast/index.js +0 -4
- package/dist/components/toast/index.js.map +0 -1
- package/dist/components/toast/meta.d.ts +0 -17
- package/dist/components/toast/meta.d.ts.map +0 -1
- package/dist/components/toast/meta.js +0 -17
- package/dist/components/toast/meta.js.map +0 -1
- package/dist/components/toast/types.d.ts +0 -12
- package/dist/components/toast/types.d.ts.map +0 -1
- package/dist/components/toast/types.js +0 -2
- package/dist/components/toast/types.js.map +0 -1
- package/src/components/app-bar/AppBar.tsx +0 -140
- package/src/components/app-bar/index.ts +0 -2
- package/src/components/toast/Toast.tsx +0 -16
- package/src/components/toast/ToastProvider.tsx +0 -17
- package/src/components/toast/index.ts +0 -4
- package/src/components/toast/meta.ts +0 -19
- /package/src/{components/app-bar/meta.ts → features/app-bar/appBarMeta.ts} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 14.0.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- be83fc0: Move AppBar into canonical `src/features/app-bar` ownership while preserving the public root API, and expand the Paradox Usage source with toast, adaptive picker, and direct native BottomSheet examples.
|
|
8
|
+
|
|
9
|
+
## 14.0.0
|
|
10
|
+
|
|
11
|
+
### Major Changes
|
|
12
|
+
|
|
13
|
+
- 1b21ad4: Make toast and native bottom-sheet runtime hosts explicit `ZoraProvider` capabilities, migrate Toast to feature ownership, and render DatePicker/TimePicker through platform-specific hosts with BottomSheet on native and Popover on web.
|
|
14
|
+
|
|
15
|
+
BREAKING CHANGE: `ZoraProvider` no longer installs `BottomSheetProvider` automatically. Native apps using BottomSheet-backed interactions must enable `<ZoraProvider bottomSheet>`. Enable `<ZoraProvider toast>` or pass toast provider options when descendants use `useToast()`.
|
|
16
|
+
|
|
3
17
|
## 13.0.0
|
|
4
18
|
|
|
5
19
|
### Major Changes
|
package/README.md
CHANGED
|
@@ -3,16 +3,17 @@
|
|
|
3
3
|
|
|
4
4
|
# @ankhorage/zora
|
|
5
5
|
|
|
6
|
-
         
|
|
7
7
|
|
|
8
8
|
Opinionated React Native and React Native Web UI kit built on @ankhorage/surface.
|
|
9
9
|
|
|
10
10
|
## Usage
|
|
11
11
|
|
|
12
|
-
###
|
|
12
|
+
### ZORA app root with optional runtime capabilities and adaptive UI.
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
Enable only the runtime capabilities the app uses. `toast` installs the host consumed by
|
|
15
|
+
`useToast()`. `bottomSheet` installs the native BottomSheet host; DatePicker and TimePicker use
|
|
16
|
+
that host on native and automatically use Popover on web.
|
|
16
17
|
|
|
17
18
|
Source: `examples/basic-app/App.tsx`
|
|
18
19
|
|
|
@@ -20,12 +21,19 @@ Source: `examples/basic-app/App.tsx`
|
|
|
20
21
|
import {
|
|
21
22
|
AppBar,
|
|
22
23
|
AppShell,
|
|
24
|
+
BottomSheet,
|
|
25
|
+
Button,
|
|
26
|
+
DatePicker,
|
|
23
27
|
Screen,
|
|
24
28
|
ScreenSection,
|
|
29
|
+
Stack,
|
|
25
30
|
Text,
|
|
31
|
+
TimePicker,
|
|
32
|
+
useToast,
|
|
26
33
|
ZoraProvider,
|
|
27
34
|
type ZoraTheme,
|
|
28
35
|
} from '@ankhorage/zora';
|
|
36
|
+
import React from 'react';
|
|
29
37
|
import { GestureHandlerRootView } from 'react-native-gesture-handler';
|
|
30
38
|
|
|
31
39
|
const basicTheme: ZoraTheme = {
|
|
@@ -39,11 +47,16 @@ const basicTheme: ZoraTheme = {
|
|
|
39
47
|
export default function BasicApp() {
|
|
40
48
|
return (
|
|
41
49
|
<GestureHandlerRootView style={{ flex: 1 }}>
|
|
42
|
-
<ZoraProvider
|
|
50
|
+
<ZoraProvider
|
|
51
|
+
bottomSheet
|
|
52
|
+
initialMode="light"
|
|
53
|
+
theme={basicTheme}
|
|
54
|
+
toast={{ defaultDuration: 4000 }}
|
|
55
|
+
>
|
|
43
56
|
<AppShell header={<AppBar title="Dashboard" subtitle="Welcome to ZORA" />}>
|
|
44
57
|
<Screen>
|
|
45
58
|
<ScreenSection>
|
|
46
|
-
<
|
|
59
|
+
<UsageContent />
|
|
47
60
|
</ScreenSection>
|
|
48
61
|
</Screen>
|
|
49
62
|
</AppShell>
|
|
@@ -51,6 +64,169 @@ export default function BasicApp() {
|
|
|
51
64
|
</GestureHandlerRootView>
|
|
52
65
|
);
|
|
53
66
|
}
|
|
67
|
+
|
|
68
|
+
/*** Demonstrates toast feedback and adaptive picker presentation. */
|
|
69
|
+
function UsageContent() {
|
|
70
|
+
const { showToast } = useToast();
|
|
71
|
+
const [date, setDate] = React.useState<string | null>(null);
|
|
72
|
+
const [time, setTime] = React.useState<string | null>(null);
|
|
73
|
+
|
|
74
|
+
return (
|
|
75
|
+
<Stack gap="m">
|
|
76
|
+
<Text variant="lead">Runtime capabilities are opt-in at the app root.</Text>
|
|
77
|
+
<Button
|
|
78
|
+
onPress={() =>
|
|
79
|
+
showToast({
|
|
80
|
+
description: 'ToastProvider is installed by ZoraProvider.',
|
|
81
|
+
status: 'success',
|
|
82
|
+
title: 'Saved',
|
|
83
|
+
})
|
|
84
|
+
}
|
|
85
|
+
>
|
|
86
|
+
Show toast
|
|
87
|
+
</Button>
|
|
88
|
+
<DatePicker label="Date" onValueChange={setDate} value={date} />
|
|
89
|
+
<TimePicker label="Time" onValueChange={setTime} value={time} />
|
|
90
|
+
</Stack>
|
|
91
|
+
);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/***
|
|
95
|
+
* Direct native BottomSheet usage.
|
|
96
|
+
*
|
|
97
|
+
* Render this inside `<ZoraProvider bottomSheet>` on native. Web pickers do not need this host;
|
|
98
|
+
* their platform adapters use Popover instead.
|
|
99
|
+
*
|
|
100
|
+
* @usage
|
|
101
|
+
* @readme
|
|
102
|
+
*/
|
|
103
|
+
export function NativeBottomSheetExample() {
|
|
104
|
+
const [open, setOpen] = React.useState(false);
|
|
105
|
+
|
|
106
|
+
return (
|
|
107
|
+
<Stack gap="m">
|
|
108
|
+
<Button onPress={() => setOpen(true)}>Open native bottom sheet</Button>
|
|
109
|
+
<BottomSheet onDismiss={() => setOpen(false)} open={open}>
|
|
110
|
+
<Stack gap="s" p="m">
|
|
111
|
+
<Text variant="label">Bottom sheet content</Text>
|
|
112
|
+
<Button onPress={() => setOpen(false)} variant="ghost">
|
|
113
|
+
Close
|
|
114
|
+
</Button>
|
|
115
|
+
</Stack>
|
|
116
|
+
</BottomSheet>
|
|
117
|
+
</Stack>
|
|
118
|
+
);
|
|
119
|
+
}
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
### Direct native BottomSheet usage.
|
|
123
|
+
|
|
124
|
+
Render this inside `<ZoraProvider bottomSheet>` on native. Web pickers do not need this host;
|
|
125
|
+
their platform adapters use Popover instead.
|
|
126
|
+
|
|
127
|
+
Source: `examples/basic-app/App.tsx`
|
|
128
|
+
|
|
129
|
+
```tsx
|
|
130
|
+
import {
|
|
131
|
+
AppBar,
|
|
132
|
+
AppShell,
|
|
133
|
+
BottomSheet,
|
|
134
|
+
Button,
|
|
135
|
+
DatePicker,
|
|
136
|
+
Screen,
|
|
137
|
+
ScreenSection,
|
|
138
|
+
Stack,
|
|
139
|
+
Text,
|
|
140
|
+
TimePicker,
|
|
141
|
+
useToast,
|
|
142
|
+
ZoraProvider,
|
|
143
|
+
type ZoraTheme,
|
|
144
|
+
} from '@ankhorage/zora';
|
|
145
|
+
import React from 'react';
|
|
146
|
+
import { GestureHandlerRootView } from 'react-native-gesture-handler';
|
|
147
|
+
|
|
148
|
+
const basicTheme: ZoraTheme = {
|
|
149
|
+
id: 'basic-app',
|
|
150
|
+
name: 'Basic app',
|
|
151
|
+
appCategory: 'developer_tools',
|
|
152
|
+
primaryColor: '#0b6e99',
|
|
153
|
+
harmony: 'analogous',
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
/***
|
|
157
|
+
* ZORA app root with optional runtime capabilities and adaptive UI.
|
|
158
|
+
*
|
|
159
|
+
* Enable only the runtime capabilities the app uses. `toast` installs the host consumed by
|
|
160
|
+
* `useToast()`. `bottomSheet` installs the native BottomSheet host; DatePicker and TimePicker use
|
|
161
|
+
* that host on native and automatically use Popover on web.
|
|
162
|
+
*
|
|
163
|
+
* @usage
|
|
164
|
+
* @readme
|
|
165
|
+
*/
|
|
166
|
+
export default function BasicApp() {
|
|
167
|
+
return (
|
|
168
|
+
<GestureHandlerRootView style={{ flex: 1 }}>
|
|
169
|
+
<ZoraProvider
|
|
170
|
+
bottomSheet
|
|
171
|
+
initialMode="light"
|
|
172
|
+
theme={basicTheme}
|
|
173
|
+
toast={{ defaultDuration: 4000 }}
|
|
174
|
+
>
|
|
175
|
+
<AppShell header={<AppBar title="Dashboard" subtitle="Welcome to ZORA" />}>
|
|
176
|
+
<Screen>
|
|
177
|
+
<ScreenSection>
|
|
178
|
+
<UsageContent />
|
|
179
|
+
</ScreenSection>
|
|
180
|
+
</Screen>
|
|
181
|
+
</AppShell>
|
|
182
|
+
</ZoraProvider>
|
|
183
|
+
</GestureHandlerRootView>
|
|
184
|
+
);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/*** Demonstrates toast feedback and adaptive picker presentation. */
|
|
188
|
+
function UsageContent() {
|
|
189
|
+
const { showToast } = useToast();
|
|
190
|
+
const [date, setDate] = React.useState<string | null>(null);
|
|
191
|
+
const [time, setTime] = React.useState<string | null>(null);
|
|
192
|
+
|
|
193
|
+
return (
|
|
194
|
+
<Stack gap="m">
|
|
195
|
+
<Text variant="lead">Runtime capabilities are opt-in at the app root.</Text>
|
|
196
|
+
<Button
|
|
197
|
+
onPress={() =>
|
|
198
|
+
showToast({
|
|
199
|
+
description: 'ToastProvider is installed by ZoraProvider.',
|
|
200
|
+
status: 'success',
|
|
201
|
+
title: 'Saved',
|
|
202
|
+
})
|
|
203
|
+
}
|
|
204
|
+
>
|
|
205
|
+
Show toast
|
|
206
|
+
</Button>
|
|
207
|
+
<DatePicker label="Date" onValueChange={setDate} value={date} />
|
|
208
|
+
<TimePicker label="Time" onValueChange={setTime} value={time} />
|
|
209
|
+
</Stack>
|
|
210
|
+
);
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
export function NativeBottomSheetExample() {
|
|
214
|
+
const [open, setOpen] = React.useState(false);
|
|
215
|
+
|
|
216
|
+
return (
|
|
217
|
+
<Stack gap="m">
|
|
218
|
+
<Button onPress={() => setOpen(true)}>Open native bottom sheet</Button>
|
|
219
|
+
<BottomSheet onDismiss={() => setOpen(false)} open={open}>
|
|
220
|
+
<Stack gap="s" p="m">
|
|
221
|
+
<Text variant="label">Bottom sheet content</Text>
|
|
222
|
+
<Button onPress={() => setOpen(false)} variant="ghost">
|
|
223
|
+
Close
|
|
224
|
+
</Button>
|
|
225
|
+
</Stack>
|
|
226
|
+
</BottomSheet>
|
|
227
|
+
</Stack>
|
|
228
|
+
);
|
|
229
|
+
}
|
|
54
230
|
```
|
|
55
231
|
|
|
56
232
|
## Generated documentation
|
|
@@ -15,27 +15,27 @@ function AccordionInner(props) {
|
|
|
15
15
|
function MultipleAccordion({ themeId: _themeId, mode: _mode, children, defaultValue, interactionPolicy, onValueChange, value, ...surfaceProps }) {
|
|
16
16
|
const [presentationValues, setPresentationValues] = React.useState(() => value ?? defaultValue ?? []);
|
|
17
17
|
const openValues = value ?? presentationValues;
|
|
18
|
-
return (<AccordionPresentationContext
|
|
18
|
+
return (<AccordionPresentationContext value={{ mode: 'multiple', openValues }}>
|
|
19
19
|
<SurfaceAccordion {...surfaceProps} defaultValue={defaultValue} interactionPolicy={interactionPolicy} onValueChange={(nextValues) => {
|
|
20
20
|
setPresentationValues(nextValues);
|
|
21
21
|
onValueChange?.(nextValues);
|
|
22
22
|
}} type="multiple" value={value}>
|
|
23
23
|
{children}
|
|
24
24
|
</SurfaceAccordion>
|
|
25
|
-
</AccordionPresentationContext
|
|
25
|
+
</AccordionPresentationContext>);
|
|
26
26
|
}
|
|
27
27
|
/*** Mirrors Surface single-value state for ZORA presentation only. */
|
|
28
28
|
function SingleAccordion({ themeId: _themeId, mode: _mode, children, defaultValue, interactionPolicy, onValueChange, type: _type, value, ...surfaceProps }) {
|
|
29
29
|
const [presentationValue, setPresentationValue] = React.useState(() => value ?? defaultValue);
|
|
30
30
|
const openValue = value ?? presentationValue;
|
|
31
31
|
const openValues = openValue === undefined ? [] : [openValue];
|
|
32
|
-
return (<AccordionPresentationContext
|
|
32
|
+
return (<AccordionPresentationContext value={{ mode: 'single', openValues }}>
|
|
33
33
|
<SurfaceAccordion {...surfaceProps} defaultValue={defaultValue} interactionPolicy={interactionPolicy} onValueChange={(nextValue) => {
|
|
34
34
|
setPresentationValue(nextValue);
|
|
35
35
|
onValueChange?.(nextValue);
|
|
36
36
|
}} type="single" value={value}>
|
|
37
37
|
{children}
|
|
38
38
|
</SurfaceAccordion>
|
|
39
|
-
</AccordionPresentationContext
|
|
39
|
+
</AccordionPresentationContext>);
|
|
40
40
|
}
|
|
41
41
|
//# sourceMappingURL=Accordion.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Accordion.js","sourceRoot":"","sources":["../../../../../src/features/accordion/adapters/inbound/Accordion.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,IAAI,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACnE,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAM1E,OAAO,EAAE,4BAA4B,EAAE,MAAM,gDAAgD,CAAC;AAE9F,yFAAyF;AACzF,MAAM,CAAC,MAAM,SAAS,GAAG,kBAAkB,CAAC,cAAc,CAAC,CAAC;AAE5D,qFAAqF;AACrF,SAAS,cAAc,CAAC,KAAqB;IAC3C,IAAI,KAAK,CAAC,IAAI,KAAK,UAAU,EAAE,CAAC;QAC9B,OAAO,CAAC,iBAAiB,CAAC,IAAI,KAAK,CAAC,EAAG,CAAC;IAC1C,CAAC;IAED,OAAO,CAAC,eAAe,CAAC,IAAI,KAAK,CAAC,EAAG,CAAC;AACxC,CAAC;AAED,wEAAwE;AACxE,SAAS,iBAAiB,CAAC,EACzB,OAAO,EAAE,QAAQ,EACjB,IAAI,EAAE,KAAK,EACX,QAAQ,EACR,YAAY,EACZ,iBAAiB,EACjB,aAAa,EACb,KAAK,EACL,GAAG,YAAY,EACQ;IACvB,MAAM,CAAC,kBAAkB,EAAE,qBAAqB,CAAC,GAAG,KAAK,CAAC,QAAQ,CAChE,GAAG,EAAE,CAAC,KAAK,IAAI,YAAY,IAAI,EAAE,CAClC,CAAC;IACF,MAAM,UAAU,GAAG,KAAK,IAAI,kBAAkB,CAAC;IAE/C,OAAO,CACL,CAAC,4BAA4B,CAAC,
|
|
1
|
+
{"version":3,"file":"Accordion.js","sourceRoot":"","sources":["../../../../../src/features/accordion/adapters/inbound/Accordion.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,IAAI,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACnE,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAM1E,OAAO,EAAE,4BAA4B,EAAE,MAAM,gDAAgD,CAAC;AAE9F,yFAAyF;AACzF,MAAM,CAAC,MAAM,SAAS,GAAG,kBAAkB,CAAC,cAAc,CAAC,CAAC;AAE5D,qFAAqF;AACrF,SAAS,cAAc,CAAC,KAAqB;IAC3C,I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AAa,EACb,IAAI,EAAE,KAAK,EACX,KAAK,EACL,GAAG,YAAY,EACM;IACrB,MAAM,CAAC,iBAAiB,EAAE,oBAAoB,CAAC,GAAG,KAAK,CAAC,QAAQ,CAC9D,GAAG,EAAE,CAAC,KAAK,IAAI,YAAY,CAC5B,CAAC;IACF,MAAM,SAAS,GAAG,KAAK,IAAI,iBAAiB,CAAC;IAC7C,MAAM,UAAU,GAAG,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;IAE9D,OAAO,CACL,CAAC,4BAA4B,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,CAAC,CAClE;MAAA,CAAC,gBAAgB,CACf,IAAI,YAAY,CAAC,CACjB,YAAY,CAAC,CAAC,YAAY,CAAC,CAC3B,iBAAiB,CAAC,CAAC,iBAAiB,CAAC,CACrC,aAAa,CAAC,CAAC,CAAC,SAAS,EAAE,EAAE;YAC3B,oBAAoB,CAAC,SAAS,CAAC,CAAC;YAChC,aAAa,EAAE,CAAC,SAAS,CAAC,CAAC;QAC7B,CAAC,CAAC,CACF,IAAI,CAAC,QAAQ,CACb,KAAK,CAAC,CAAC,KAAK,CAAC,CAEb;QAAA,CAAC,QAAQ,CACX;MAAA,EAAE,gBAAgB,CACpB;IAAA,EAAE,4BAA4B,CAAC,CAChC,CAAC;AACJ,CAAC","sourcesContent":["import { Accordion as SurfaceAccordion } from '@ankhorage/surface';\nimport React from 'react';\n\nimport { withZoraThemeScope } from '../../../../theme/withZoraThemeScope';\nimport type {\n AccordionMultipleProps,\n AccordionProps,\n AccordionSingleProps,\n} from '../../../../types/accordion';\nimport { AccordionPresentationContext } from '../../composition/AccordionPresentationContext';\n\n/*** Renders a ZORA accordion backed by Surface expansion and accessibility mechanics. */\nexport const Accordion = withZoraThemeScope(AccordionInner);\n\n/*** Routes the public accordion union to its single or multiple Surface contract. */\nfunction AccordionInner(props: AccordionProps) {\n if (props.type === 'multiple') {\n return <MultipleAccordion {...props} />;\n }\n\n return <SingleAccordion {...props} />;\n}\n\n/*** Mirrors Surface multiple-value state for ZORA presentation only. */\nfunction MultipleAccordion({\n themeId: _themeId,\n mode: _mode,\n children,\n defaultValue,\n interactionPolicy,\n onValueChange,\n value,\n ...surfaceProps\n}: AccordionMultipleProps) {\n const [presentationValues, setPresentationValues] = React.useState<readonly string[]>(\n () => value ?? defaultValue ?? [],\n );\n const openValues = value ?? presentationValues;\n\n return (\n <AccordionPresentationContext value={{ mode: 'multiple', openValues }}>\n <SurfaceAccordion\n {...surfaceProps}\n defaultValue={defaultValue}\n interactionPolicy={interactionPolicy}\n onValueChange={(nextValues) => {\n setPresentationValues(nextValues);\n onValueChange?.(nextValues);\n }}\n type=\"multiple\"\n value={value}\n >\n {children}\n </SurfaceAccordion>\n </AccordionPresentationContext>\n );\n}\n\n/*** Mirrors Surface single-value state for ZORA presentation only. */\nfunction SingleAccordion({\n themeId: _themeId,\n mode: _mode,\n children,\n defaultValue,\n interactionPolicy,\n onValueChange,\n type: _type,\n value,\n ...surfaceProps\n}: AccordionSingleProps) {\n const [presentationValue, setPresentationValue] = React.useState<string | undefined>(\n () => value ?? defaultValue,\n );\n const openValue = value ?? presentationValue;\n const openValues = openValue === undefined ? [] : [openValue];\n\n return (\n <AccordionPresentationContext value={{ mode: 'single', openValues }}>\n <SurfaceAccordion\n {...surfaceProps}\n defaultValue={defaultValue}\n interactionPolicy={interactionPolicy}\n onValueChange={(nextValue) => {\n setPresentationValue(nextValue);\n onValueChange?.(nextValue);\n }}\n type=\"single\"\n value={value}\n >\n {children}\n </SurfaceAccordion>\n </AccordionPresentationContext>\n );\n}\n"]}
|
|
@@ -10,7 +10,7 @@ export const AccordionItem = withZoraThemeScope(AccordionItemInner);
|
|
|
10
10
|
const triggerStyle = { flex: 1 };
|
|
11
11
|
/*** Composes the item header, optional actions, expanded content, and separator. */
|
|
12
12
|
function AccordionItemInner({ themeId: _themeId, mode: _mode, actions, children, description, disabled, icon, interactionPolicy, testID, title, value, ...surfaceItemProps }) {
|
|
13
|
-
const presentation = React.
|
|
13
|
+
const presentation = React.use(AccordionPresentationContext);
|
|
14
14
|
if (!presentation) {
|
|
15
15
|
throw new Error('AccordionItem must be rendered inside Accordion.');
|
|
16
16
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AccordionItem.js","sourceRoot":"","sources":["../../../../../src/features/accordion/adapters/inbound/AccordionItem.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,IAAI,uBAAuB,EAC3C,aAAa,IAAI,oBAAoB,EACrC,gBAAgB,IAAI,uBAAuB,GAC5C,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAE1E,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAC5C,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,4BAA4B,EAAE,MAAM,gDAAgD,CAAC;AAE9F,4FAA4F;AAC5F,MAAM,CAAC,MAAM,aAAa,GAAG,kBAAkB,CAAC,kBAAkB,CAAC,CAAC;AAEpE,MAAM,YAAY,GAAc,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC;AAE5C,oFAAoF;AACpF,SAAS,kBAAkB,CAAC,EAC1B,OAAO,EAAE,QAAQ,EACjB,IAAI,EAAE,KAAK,EACX,OAAO,EACP,QAAQ,EACR,WAAW,EACX,QAAQ,EACR,IAAI,EACJ,iBAAiB,EACjB,MAAM,EACN,KAAK,EACL,KAAK,EACL,GAAG,gBAAgB,EACA;IACnB,MAAM,YAAY,GAAG,KAAK,CAAC,
|
|
1
|
+
{"version":3,"file":"AccordionItem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AC,oBAAoB,CAAC,CAAC,CAAC,sBAAsB,CAAC,CAAC,IAAI,CAAC,GAAG,EAC5E;gBAAA,EAAE,KAAK,CACT;cAAA,EAAE,GAAG,CACP;YAAA,EAAE,uBAAuB,CAC3B;UAAA,EAAE,GAAG,CACL;UAAA,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAC/C;QAAA,EAAE,KAAK,CAEP;;QAAA,CAAC,uBAAuB,CACtB;UAAA,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAChB;YAAA,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,EAAE,KAAK,CAClC;UAAA,EAAE,GAAG,CACP;QAAA,EAAE,uBAAuB,CAEzB;;QAAA,CAAC,OAAO,CAAC,AAAD,EACV;MAAA,EAAE,KAAK,CACT;IAAA,EAAE,oBAAoB,CAAC,CACxB,CAAC;AACJ,CAAC","sourcesContent":["import {\n AccordionContent as SurfaceAccordionContent,\n AccordionItem as SurfaceAccordionItem,\n AccordionTrigger as SurfaceAccordionTrigger,\n} from '@ankhorage/surface';\nimport React from 'react';\nimport type { ViewStyle } from 'react-native';\n\nimport { withZoraThemeScope } from '../../../../theme/withZoraThemeScope';\nimport type { AccordionItemProps } from '../../../../types/accordion';\nimport { Icon } from '../../../icon/public';\nimport { Box, Divider, Stack } from '../../../layout/public';\nimport { Heading, Text } from '../../../typography/public';\nimport { AccordionPresentationContext } from '../../composition/AccordionPresentationContext';\n\n/*** Renders one opinionated ZORA accordion item over Surface trigger/content primitives. */\nexport const AccordionItem = withZoraThemeScope(AccordionItemInner);\n\nconst triggerStyle: ViewStyle = { flex: 1 };\n\n/*** Composes the item header, optional actions, expanded content, and separator. */\nfunction AccordionItemInner({\n themeId: _themeId,\n mode: _mode,\n actions,\n children,\n description,\n disabled,\n icon,\n interactionPolicy,\n testID,\n title,\n value,\n ...surfaceItemProps\n}: AccordionItemProps) {\n const presentation = React.use(AccordionPresentationContext);\n if (!presentation) {\n throw new Error('AccordionItem must be rendered inside Accordion.');\n }\n\n const open = presentation.openValues.includes(value);\n\n return (\n <SurfaceAccordionItem\n {...surfaceItemProps}\n disabled={disabled}\n interactionPolicy={interactionPolicy}\n testID={testID}\n value={value}\n >\n <Stack gap=\"none\">\n <Stack align=\"center\" direction=\"row\" gap=\"s\">\n <Box flex={1}>\n <SurfaceAccordionTrigger interactionPolicy={interactionPolicy} style={triggerStyle}>\n <Box px=\"m\" py=\"m\">\n <Stack align=\"center\" direction=\"row\" gap=\"m\">\n {icon ? <Icon {...icon} /> : null}\n <Box flex={1}>\n <Stack gap=\"xs\">\n <Heading level={4}>{title}</Heading>\n {description ? (\n <Text emphasis=\"muted\" variant=\"bodySmall\">\n {description}\n </Text>\n ) : null}\n </Stack>\n </Box>\n <Icon name={open ? 'chevron-up-outline' : 'chevron-down-outline'} size=\"m\" />\n </Stack>\n </Box>\n </SurfaceAccordionTrigger>\n </Box>\n {actions ? <Box pr=\"m\">{actions}</Box> : null}\n </Stack>\n\n <SurfaceAccordionContent>\n <Box px=\"m\" pb=\"m\">\n <Stack gap=\"m\">{children}</Stack>\n </Box>\n </SurfaceAccordionContent>\n\n <Divider />\n </Stack>\n </SurfaceAccordionItem>\n );\n}\n"]}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { AppBarProps } from '../../../../types/app-bar';
|
|
3
|
+
/*** Renders a top app bar with title/subtitle and optional leading/trailing actions. */
|
|
4
|
+
export declare const AppBar: (props: AppBarProps) => React.ReactElement | null;
|
|
5
|
+
//# sourceMappingURL=AppBar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AppBar.d.ts","sourceRoot":"","sources":["../../../../../src/features/app-bar/adapters/inbound/AppBar.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,OAAO,KAAK,EAAoC,WAAW,EAAE,MAAM,2BAA2B,CAAC;AA6B/F,wFAAwF;AACxF,eAAO,MAAM,MAAM,mDAAkC,CAAC"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { AppBar as SurfaceAppBar } from '@ankhorage/surface';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { Inline } from '../../../../foundation';
|
|
4
|
+
import { useZoraTheme } from '../../../../theme/useZoraTheme';
|
|
5
|
+
import { withZoraThemeScope } from '../../../../theme/withZoraThemeScope';
|
|
6
|
+
import { IconButton } from '../../../button/public';
|
|
7
|
+
import { Box, Stack } from '../../../layout/public';
|
|
8
|
+
import { Heading, Text } from '../../../typography/public';
|
|
9
|
+
const DEFAULT_CANCEL_ICON = { name: 'close-outline' };
|
|
10
|
+
const DEFAULT_OVERFLOW_ICON = { name: 'ellipsis-vertical' };
|
|
11
|
+
/*** Resolves the effective AppBar mode. */
|
|
12
|
+
function resolveMode(mode) {
|
|
13
|
+
return mode ?? { type: 'default' };
|
|
14
|
+
}
|
|
15
|
+
/*** Formats the active selection label with its optional count. */
|
|
16
|
+
function resolveSelectionLabel({ count, label }) {
|
|
17
|
+
if (count === undefined)
|
|
18
|
+
return label;
|
|
19
|
+
return `${label} (${count})`;
|
|
20
|
+
}
|
|
21
|
+
/*** Resolves the accessible label for the overflow action. */
|
|
22
|
+
function resolveOverflowLabel(overflow) {
|
|
23
|
+
return overflow.label ?? 'More options';
|
|
24
|
+
}
|
|
25
|
+
/*** Resolves the accessible label for leaving selection mode. */
|
|
26
|
+
function resolveCancelLabel(mode) {
|
|
27
|
+
return mode.cancelLabel ?? 'Cancel selection';
|
|
28
|
+
}
|
|
29
|
+
/*** Renders a top app bar with title/subtitle and optional leading/trailing actions. */
|
|
30
|
+
export const AppBar = withZoraThemeScope(AppBarInner);
|
|
31
|
+
/*** Composes the opinionated ZORA AppBar over the Surface layout primitive. */
|
|
32
|
+
function AppBarInner({ themeId: _themeId, mode: _mode, title, subtitle, leading, actions, overflow, appMode, children, safeAreaTop = true, divider = true, testID, interactionPolicy, }) {
|
|
33
|
+
const { theme } = useZoraTheme();
|
|
34
|
+
const resolvedMode = resolveMode(appMode);
|
|
35
|
+
const isSelectionMode = resolvedMode.type === 'selection';
|
|
36
|
+
const resolvedLeading = leading ?? resolveSelectionLeading(resolvedMode, interactionPolicy);
|
|
37
|
+
const overflowButton = resolveOverflowButton(overflow, interactionPolicy);
|
|
38
|
+
const resolvedTrailing = resolveTrailing(actions, overflowButton);
|
|
39
|
+
const resolvedCenter = resolveCenter({
|
|
40
|
+
children,
|
|
41
|
+
isSelectionMode,
|
|
42
|
+
resolvedMode,
|
|
43
|
+
subtitle,
|
|
44
|
+
title,
|
|
45
|
+
});
|
|
46
|
+
return (<SurfaceAppBar bg={isSelectionMode ? theme.semantics.action.primary.softBg : undefined} divider={divider} leading={resolvedLeading} safeAreaTop={safeAreaTop} testID={testID} trailing={resolvedTrailing}>
|
|
47
|
+
{resolvedCenter ? <Box style={{ minWidth: 0 }}>{resolvedCenter}</Box> : null}
|
|
48
|
+
</SurfaceAppBar>);
|
|
49
|
+
}
|
|
50
|
+
/*** Resolves the selection action shown at the leading edge. */
|
|
51
|
+
function resolveSelectionLeading(mode, interactionPolicy) {
|
|
52
|
+
if (mode.type !== 'selection')
|
|
53
|
+
return undefined;
|
|
54
|
+
return (<IconButton color="neutral" icon={mode.cancelIcon ?? DEFAULT_CANCEL_ICON} interactionPolicy={interactionPolicy} label={resolveCancelLabel(mode)} onPress={mode.onCancel} size="m" variant="ghost"/>);
|
|
55
|
+
}
|
|
56
|
+
/*** Resolves the optional overflow action. */
|
|
57
|
+
function resolveOverflowButton(overflow, interactionPolicy) {
|
|
58
|
+
if (!overflow?.onPress)
|
|
59
|
+
return null;
|
|
60
|
+
return (<IconButton color="neutral" disabled={overflow.disabled} icon={overflow.icon ?? DEFAULT_OVERFLOW_ICON} interactionPolicy={interactionPolicy} label={resolveOverflowLabel(overflow)} onPress={overflow.onPress} size="m" variant="ghost"/>);
|
|
61
|
+
}
|
|
62
|
+
/*** Composes trailing actions and overflow controls. */
|
|
63
|
+
function resolveTrailing(actions, overflowButton) {
|
|
64
|
+
if (!actions && !overflowButton)
|
|
65
|
+
return undefined;
|
|
66
|
+
return (<Inline align="center" gap="s" wrap="nowrap">
|
|
67
|
+
{actions}
|
|
68
|
+
{overflowButton}
|
|
69
|
+
</Inline>);
|
|
70
|
+
}
|
|
71
|
+
/*** Resolves the center content for default and selection modes. */
|
|
72
|
+
function resolveCenter({ children, isSelectionMode, resolvedMode, subtitle, title, }) {
|
|
73
|
+
if (children !== undefined)
|
|
74
|
+
return children;
|
|
75
|
+
if (isSelectionMode && resolvedMode.type === 'selection') {
|
|
76
|
+
return (<Text emphasis="default" numberOfLines={1} variant="label" weight="semiBold">
|
|
77
|
+
{resolveSelectionLabel(resolvedMode)}
|
|
78
|
+
</Text>);
|
|
79
|
+
}
|
|
80
|
+
if (title == null && subtitle == null)
|
|
81
|
+
return null;
|
|
82
|
+
return (<Stack gap="xs">
|
|
83
|
+
{title != null ? (<Heading ellipsizeMode="tail" level={3} numberOfLines={1} size="h5">
|
|
84
|
+
{title}
|
|
85
|
+
</Heading>) : null}
|
|
86
|
+
{subtitle != null ? (<Text ellipsizeMode="tail" emphasis="muted" numberOfLines={1} variant="bodySmall">
|
|
87
|
+
{subtitle}
|
|
88
|
+
</Text>) : null}
|
|
89
|
+
</Stack>);
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=AppBar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AppBar.js","sourceRoot":"","sources":["../../../../../src/features/app-bar/adapters/inbound/AppBar.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,aAAa,EAAuB,MAAM,oBAAoB,CAAC;AAClF,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO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Bar, type ButtonIconSpec } from '@ankhorage/surface';\nimport React from 'react';\n\nimport { Inline } from '../../../../foundation';\nimport { useZoraTheme } from '../../../../theme/useZoraTheme';\nimport { withZoraThemeScope } from '../../../../theme/withZoraThemeScope';\nimport type { AppBarMode, AppBarOverflowAction, AppBarProps } from '../../../../types/app-bar';\nimport { IconButton } from '../../../button/public';\nimport { Box, Stack } from '../../../layout/public';\nimport { Heading, Text } from '../../../typography/public';\n\nconst DEFAULT_CANCEL_ICON = { name: 'close-outline' } satisfies ButtonIconSpec;\nconst DEFAULT_OVERFLOW_ICON = { name: 'ellipsis-vertical' } satisfies ButtonIconSpec;\n\n/*** Resolves the effective AppBar mode. */\nfunction resolveMode(mode: AppBarMode | undefined): AppBarMode {\n return mode ?? { type: 'default' };\n}\n\n/*** Formats the active selection label with its optional count. */\nfunction resolveSelectionLabel({ count, label }: { count?: number; label: string }): string {\n if (count === undefined) return label;\n return `${label} (${count})`;\n}\n\n/*** Resolves the accessible label for the overflow action. */\nfunction resolveOverflowLabel(overflow: AppBarOverflowAction): string {\n return overflow.label ?? 'More options';\n}\n\n/*** Resolves the accessible label for leaving selection mode. */\nfunction resolveCancelLabel(mode: Extract<AppBarMode, { type: 'selection' }>): string {\n return mode.cancelLabel ?? 'Cancel selection';\n}\n\n/*** Renders a top app bar with title/subtitle and optional leading/trailing actions. */\nexport const AppBar = withZoraThemeScope(AppBarInner);\n\n/*** Composes the opinionated ZORA AppBar over the Surface layout primitive. */\nfunction AppBarInner({\n themeId: _themeId,\n mode: _mode,\n title,\n subtitle,\n leading,\n actions,\n overflow,\n appMode,\n children,\n safeAreaTop = true,\n divider = true,\n testID,\n interactionPolicy,\n}: AppBarProps) {\n const { theme } = useZoraTheme();\n const resolvedMode = resolveMode(appMode);\n const isSelectionMode = resolvedMode.type === 'selection';\n const resolvedLeading = leading ?? resolveSelectionLeading(resolvedMode, interactionPolicy);\n const overflowButton = resolveOverflowButton(overflow, interactionPolicy);\n const resolvedTrailing = resolveTrailing(actions, overflowButton);\n const resolvedCenter = resolveCenter({\n children,\n isSelectionMode,\n resolvedMode,\n subtitle,\n title,\n });\n\n return (\n <SurfaceAppBar\n bg={isSelectionMode ? theme.semantics.action.primary.softBg : undefined}\n divider={divider}\n leading={resolvedLeading}\n safeAreaTop={safeAreaTop}\n testID={testID}\n trailing={resolvedTrailing}\n >\n {resolvedCenter ? <Box style={{ minWidth: 0 }}>{resolvedCenter}</Box> : null}\n </SurfaceAppBar>\n );\n}\n\n/*** Resolves the selection action shown at the leading edge. */\nfunction resolveSelectionLeading(\n mode: AppBarMode,\n interactionPolicy: AppBarProps['interactionPolicy'],\n): React.ReactNode | undefined {\n if (mode.type !== 'selection') return undefined;\n\n return (\n <IconButton\n color=\"neutral\"\n icon={mode.cancelIcon ?? DEFAULT_CANCEL_ICON}\n interactionPolicy={interactionPolicy}\n label={resolveCancelLabel(mode)}\n onPress={mode.onCancel}\n size=\"m\"\n variant=\"ghost\"\n />\n );\n}\n\n/*** Resolves the optional overflow action. */\nfunction resolveOverflowButton(\n overflow: AppBarOverflowAction | undefined,\n interactionPolicy: AppBarProps['interactionPolicy'],\n): React.ReactNode {\n if (!overflow?.onPress) return null;\n\n return (\n <IconButton\n color=\"neutral\"\n disabled={overflow.disabled}\n icon={overflow.icon ?? DEFAULT_OVERFLOW_ICON}\n interactionPolicy={interactionPolicy}\n label={resolveOverflowLabel(overflow)}\n onPress={overflow.onPress}\n size=\"m\"\n variant=\"ghost\"\n />\n );\n}\n\n/*** Composes trailing actions and overflow controls. */\nfunction resolveTrailing(\n actions: React.ReactNode,\n overflowButton: React.ReactNode,\n): React.ReactNode {\n if (!actions && !overflowButton) return undefined;\n return (\n <Inline align=\"center\" gap=\"s\" wrap=\"nowrap\">\n {actions}\n {overflowButton}\n </Inline>\n );\n}\n\n/*** Resolves the center content for default and selection modes. */\nfunction resolveCenter({\n children,\n isSelectionMode,\n resolvedMode,\n subtitle,\n title,\n}: {\n children: React.ReactNode;\n isSelectionMode: boolean;\n resolvedMode: AppBarMode;\n subtitle: React.ReactNode;\n title: React.ReactNode;\n}): React.ReactNode {\n if (children !== undefined) return children;\n if (isSelectionMode && resolvedMode.type === 'selection') {\n return (\n <Text emphasis=\"default\" numberOfLines={1} variant=\"label\" weight=\"semiBold\">\n {resolveSelectionLabel(resolvedMode)}\n </Text>\n );\n }\n if (title == null && subtitle == null) return null;\n\n return (\n <Stack gap=\"xs\">\n {title != null ? (\n <Heading ellipsizeMode=\"tail\" level={3} numberOfLines={1} size=\"h5\">\n {title}\n </Heading>\n ) : null}\n {subtitle != null ? (\n <Text ellipsizeMode=\"tail\" emphasis=\"muted\" numberOfLines={1} variant=\"bodySmall\">\n {subtitle}\n </Text>\n ) : null}\n </Stack>\n );\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"appBarMeta.d.ts","sourceRoot":"","sources":["../../../src/features/app-bar/appBarMeta.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,UAAU;;;;;;;CAOe,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"appBarMeta.js","sourceRoot":"","sources":["../../../src/features/app-bar/appBarMeta.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,IAAI,EAAE,QAAQ;IACd,QAAQ,EAAE,WAAW;IACrB,kBAAkB,EAAE,KAAK;IACzB,eAAe,EAAE,EAAE;IACnB,IAAI,EAAE,yEAAyE;IAC/E,KAAK,EAAE,EAAE;CAC2B,CAAC","sourcesContent":["import type { ZoraComponentMeta } from '../../metadata';\n\nexport const appBarMeta = {\n name: 'AppBar',\n category: 'component',\n directManifestNode: false,\n allowedChildren: [],\n note: 'Application chrome component; not represented as a manifest node in v1.',\n props: {},\n} as const satisfies ZoraComponentMeta;\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../../src/features/app-bar/public.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,UAAU,EAAE,oBAAoB,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACzF,OAAO,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"public.js","sourceRoot":"","sources":["../../../src/features/app-bar/public.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAC","sourcesContent":["export type { AppBarMode, AppBarOverflowAction, AppBarProps } from '../../types/app-bar';\nexport { AppBar } from './adapters/inbound/AppBar';\n"]}
|
|
@@ -1,7 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import type { DatePickerProps } from '../../../../types/date-picker';
|
|
3
|
-
/***
|
|
4
|
-
* Date input control with calendar selection and formatted display value.
|
|
5
|
-
*/
|
|
6
|
-
export declare const DatePicker: (props: DatePickerProps) => React.ReactElement | null;
|
|
1
|
+
export { DatePicker } from './DatePicker.web';
|
|
7
2
|
//# sourceMappingURL=DatePicker.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DatePicker.d.ts","sourceRoot":"","sources":["../../../../../src/features/date-picker/adapters/inbound/DatePicker.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"DatePicker.d.ts","sourceRoot":"","sources":["../../../../../src/features/date-picker/adapters/inbound/DatePicker.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC"}
|