@ankhorage/zora 12.1.0 → 14.0.0
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 +16 -0
- package/README.md +11 -5
- package/dist/features/accordion/accordionItemMeta.d.ts +53 -0
- package/dist/features/accordion/accordionItemMeta.d.ts.map +1 -0
- package/dist/features/accordion/accordionItemMeta.js +45 -0
- package/dist/features/accordion/accordionItemMeta.js.map +1 -0
- package/dist/features/accordion/accordionMeta.d.ts +36 -0
- package/dist/features/accordion/accordionMeta.d.ts.map +1 -0
- package/dist/features/accordion/accordionMeta.js +33 -0
- package/dist/features/accordion/accordionMeta.js.map +1 -0
- package/dist/features/accordion/adapters/inbound/Accordion.d.ts +5 -0
- package/dist/features/accordion/adapters/inbound/Accordion.d.ts.map +1 -0
- package/dist/features/accordion/adapters/inbound/Accordion.js +41 -0
- package/dist/features/accordion/adapters/inbound/Accordion.js.map +1 -0
- package/dist/features/accordion/adapters/inbound/AccordionItem.d.ts +5 -0
- package/dist/features/accordion/adapters/inbound/AccordionItem.d.ts.map +1 -0
- package/dist/features/accordion/adapters/inbound/AccordionItem.js +52 -0
- package/dist/features/accordion/adapters/inbound/AccordionItem.js.map +1 -0
- package/dist/features/accordion/composition/AccordionPresentationContext.d.ts +4 -0
- package/dist/features/accordion/composition/AccordionPresentationContext.d.ts.map +1 -0
- package/dist/features/accordion/composition/AccordionPresentationContext.js +3 -0
- package/dist/features/accordion/composition/AccordionPresentationContext.js.map +1 -0
- package/dist/features/accordion/public.d.ts +4 -0
- package/dist/features/accordion/public.d.ts.map +1 -0
- package/dist/features/accordion/public.js +3 -0
- package/dist/features/accordion/public.js.map +1 -0
- package/dist/features/bottom-sheet/bottomSheetMeta.d.ts +1 -1
- package/dist/features/card/cardMeta.d.ts +1 -1
- package/dist/features/card/mediaCardMeta.d.ts +1 -1
- package/dist/features/card/postCardMeta.d.ts +1 -1
- 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/gradient/gradientMeta.d.ts +1 -1
- package/dist/features/keyboard-avoiding-view/keyboardAvoidingViewMeta.d.ts +1 -1
- package/dist/features/layout/boxMeta.d.ts +1 -1
- package/dist/features/layout/containerMeta.d.ts +1 -1
- package/dist/features/layout/gridMeta.d.ts +1 -1
- package/dist/features/layout/stackMeta.d.ts +1 -1
- package/dist/features/list/flatListMeta.d.ts +1 -1
- package/dist/features/list/sectionListMeta.d.ts +1 -1
- package/dist/features/surface/surfaceMeta.d.ts +1 -1
- 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 +3 -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/screen/meta.d.ts +1 -1
- package/dist/layout/screen-section/meta.d.ts +1 -1
- package/dist/metadata/allowedChildren.d.ts +3 -3
- package/dist/metadata/allowedChildren.d.ts.map +1 -1
- package/dist/metadata/allowedChildren.js +1 -0
- package/dist/metadata/allowedChildren.js.map +1 -1
- package/dist/metadata/bindableComponentMeta.d.ts +2 -2
- package/dist/metadata/componentMeta.d.ts.map +1 -1
- package/dist/metadata/componentMeta.js +6 -3
- package/dist/metadata/componentMeta.js.map +1 -1
- package/dist/patterns/message-bubble/meta.d.ts +1 -1
- package/dist/patterns/notice/meta.d.ts +1 -1
- package/dist/patterns/panel/meta.d.ts +1 -1
- package/dist/patterns/reader/meta.d.ts +2 -2
- package/dist/patterns/scanner/meta.d.ts +2 -2
- 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.d.ts.map +1 -1
- package/dist/registry.js +4 -3
- 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/types/accordion.d.ts +23 -0
- package/dist/types/accordion.d.ts.map +1 -0
- package/dist/types/accordion.js +2 -0
- package/dist/types/accordion.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/accordionItemMeta.ts +46 -0
- package/src/features/accordion/accordionMeta.ts +34 -0
- package/src/features/accordion/adapters/inbound/Accordion.tsx +94 -0
- package/src/features/accordion/adapters/inbound/AccordionItem.tsx +86 -0
- package/src/features/accordion/composition/AccordionPresentationContext.ts +6 -0
- package/src/features/accordion/public.ts +9 -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 +17 -4
- package/src/metadata/allowedChildren.ts +1 -0
- package/src/metadata/componentMeta.test.ts +9 -0
- package/src/metadata/componentMeta.ts +6 -3
- package/src/patterns/selection/SelectionProvider.tsx +4 -6
- package/src/registry.ts +4 -3
- package/src/showcaseCoverage.test.ts +2 -1
- 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 +27 -18
- package/src/types/accordion.ts +38 -0
- package/src/types/provider.ts +22 -0
- package/src/{components/toast/types.ts → types/toast.ts} +5 -7
- 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/dist/patterns/disclosure-section/DisclosureSection.d.ts +0 -9
- package/dist/patterns/disclosure-section/DisclosureSection.d.ts.map +0 -1
- package/dist/patterns/disclosure-section/DisclosureSection.js +0 -86
- package/dist/patterns/disclosure-section/DisclosureSection.js.map +0 -1
- package/dist/patterns/disclosure-section/index.d.ts +0 -3
- package/dist/patterns/disclosure-section/index.d.ts.map +0 -1
- package/dist/patterns/disclosure-section/index.js +0 -3
- package/dist/patterns/disclosure-section/index.js.map +0 -1
- package/dist/patterns/disclosure-section/meta.d.ts +0 -9
- package/dist/patterns/disclosure-section/meta.d.ts.map +0 -1
- package/dist/patterns/disclosure-section/meta.js +0 -9
- package/dist/patterns/disclosure-section/meta.js.map +0 -1
- package/dist/patterns/disclosure-section/types.d.ts +0 -15
- package/dist/patterns/disclosure-section/types.d.ts.map +0 -1
- package/dist/patterns/disclosure-section/types.js +0 -2
- package/dist/patterns/disclosure-section/types.js.map +0 -1
- 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/patterns/disclosure-section/DisclosureSection.tsx +0 -130
- package/src/patterns/disclosure-section/index.ts +0 -2
- package/src/patterns/disclosure-section/meta.ts +0 -10
- package/src/patterns/disclosure-section/types.ts +0 -16
|
@@ -5,5 +5,6 @@ export interface ZoraThemeScopeProps {
|
|
|
5
5
|
themeId?: ZoraThemeId;
|
|
6
6
|
mode?: ZoraThemeMode;
|
|
7
7
|
}
|
|
8
|
+
/*** Applies nested ZORA theme overrides without installing another Surface theme runtime. */
|
|
8
9
|
export declare function ZoraThemeScope({ children, themeId, mode }: ZoraThemeScopeProps): string | number | bigint | boolean | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> | React.JSX.Element | null | undefined;
|
|
9
10
|
//# sourceMappingURL=ZoraThemeScope.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ZoraThemeScope.d.ts","sourceRoot":"","sources":["../../src/theme/ZoraThemeScope.tsx"],"names":[],"mappings":"AACA,OAAO,KAAkB,MAAM,OAAO,CAAC;AAGvC,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAG1D,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB,IAAI,CAAC,EAAE,aAAa,CAAC;CACtB;
|
|
1
|
+
{"version":3,"file":"ZoraThemeScope.d.ts","sourceRoot":"","sources":["../../src/theme/ZoraThemeScope.tsx"],"names":[],"mappings":"AACA,OAAO,KAAkB,MAAM,OAAO,CAAC;AAGvC,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAG1D,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB,IAAI,CAAC,EAAE,aAAa,CAAC;CACtB;AAED,6FAA6F;AAC7F,wBAAgB,cAAc,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,mBAAmB,mSAO9E"}
|
|
@@ -2,6 +2,15 @@ import { createTheme, ThemeContext, useFontContext, useTheme } from '@ankhorage/
|
|
|
2
2
|
import React, { useMemo } from 'react';
|
|
3
3
|
import { resolveZoraScopedThemeId } from './resolveZoraScopedThemeId';
|
|
4
4
|
import { useZoraThemeRuntime, ZoraThemeRuntimeContext } from './ZoraThemeRuntimeContext';
|
|
5
|
+
/*** Applies nested ZORA theme overrides without installing another Surface theme runtime. */
|
|
6
|
+
export function ZoraThemeScope({ children, themeId, mode }) {
|
|
7
|
+
if (mode === undefined && themeId === undefined)
|
|
8
|
+
return children;
|
|
9
|
+
return (<ZoraThemeScopeInner mode={mode} themeId={themeId}>
|
|
10
|
+
{children}
|
|
11
|
+
</ZoraThemeScopeInner>);
|
|
12
|
+
}
|
|
13
|
+
/*** Resolves and provides the scoped Surface and ZORA theme runtime values. */
|
|
5
14
|
function ZoraThemeScopeInner({ children, themeId, mode }) {
|
|
6
15
|
const parentSurface = useTheme();
|
|
7
16
|
const parentRuntime = useZoraThemeRuntime();
|
|
@@ -21,15 +30,8 @@ function ZoraThemeScopeInner({ children, themeId, mode }) {
|
|
|
21
30
|
_hasProvider: true,
|
|
22
31
|
}), [parentSurface.setMode, parentSurface.setThemeConfig, scopedMode, scopedTheme]);
|
|
23
32
|
const scopedRuntimeValue = useMemo(() => ({ themeId: scopedThemeId }), [scopedThemeId]);
|
|
24
|
-
return (<ZoraThemeRuntimeContext
|
|
25
|
-
<ThemeContext
|
|
26
|
-
</ZoraThemeRuntimeContext
|
|
27
|
-
}
|
|
28
|
-
export function ZoraThemeScope({ children, themeId, mode }) {
|
|
29
|
-
if (mode === undefined && themeId === undefined)
|
|
30
|
-
return children;
|
|
31
|
-
return (<ZoraThemeScopeInner mode={mode} themeId={themeId}>
|
|
32
|
-
{children}
|
|
33
|
-
</ZoraThemeScopeInner>);
|
|
33
|
+
return (<ZoraThemeRuntimeContext value={scopedRuntimeValue}>
|
|
34
|
+
<ThemeContext value={scopedSurfaceValue}>{children}</ThemeContext>
|
|
35
|
+
</ZoraThemeRuntimeContext>);
|
|
34
36
|
}
|
|
35
37
|
//# sourceMappingURL=ZoraThemeScope.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ZoraThemeScope.js","sourceRoot":"","sources":["../../src/theme/ZoraThemeScope.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AACzF,OAAO,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AAEtE,OAAO,EAAE,mBAAmB,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAQzF,SAAS,mBAAmB,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAuB;IAC3E,MAAM,aAAa,GAAG,QAAQ,EAAE,CAAC;IACjC,MAAM,aAAa,GAAG,mBAAmB,EAAE,CAAC;IAC5C,MAAM,EAAE,YAAY,EAAE,GAAG,cAAc,EAAE,CAAC;IAC1C,MAAM,aAAa,GAAG,wBAAwB,CAAC;QAC7C,cAAc,EAAE,OAAO;QACvB,gBAAgB,EAAE,aAAa,CAAC,OAAO;KACxC,CAAC,CAAC;IACH,MAAM,UAAU,GAAG,IAAI,IAAI,aAAa,CAAC,IAAI,CAAC;IAC9C,MAAM,YAAY,GAAG,aAAa,CAAC,KAAK,CAAC,MAAM,CAAC;IAChD,MAAM,WAAW,GAAG,OAAO,CACzB,GAAG,EAAE,CAAC,WAAW,CAAC,YAAY,EAAE,UAAU,EAAE,YAAY,CAAC,EACzD,CAAC,YAAY,EAAE,UAAU,EAAE,YAAY,CAAC,CACzC,CAAC;IACF,MAAM,kBAAkB,GAAG,OAAO,CAChC,GAAG,EAAE,CAAC,CAAC;QACL,KAAK,EAAE,WAAW;QAClB,IAAI,EAAE,UAAU;QAChB,OAAO,EAAE,aAAa,CAAC,OAAO;QAC9B,cAAc,EAAE,aAAa,CAAC,cAAc;QAC5C,YAAY,EAAE,IAAI;KACnB,CAAC,EACF,CAAC,aAAa,CAAC,OAAO,EAAE,aAAa,CAAC,cAAc,EAAE,UAAU,EAAE,WAAW,CAAC,CAC/E,CAAC;IACF,MAAM,kBAAkB,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,aAAa,EAAE,CAAC,EAAE,CAAC,aAAa,CAAC,CAAC,CAAC;IAExF,OAAO,CACL,CAAC,uBAAuB,CAAC,
|
|
1
|
+
{"version":3,"file":"ZoraThemeScope.js","sourceRoot":"","sources":["../../src/theme/ZoraThemeScope.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AACzF,OAAO,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AAEtE,OAAO,EAAE,mBAAmB,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAQzF,6FAA6F;AAC7F,MAAM,UAAU,cAAc,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAuB;IAC7E,IAAI,IAAI,KAAK,SAAS,IAAI,OAAO,KAAK,SAAS;QAAE,OAAO,QAAQ,CAAC;IACjE,OAAO,CACL,CAAC,mBAAmB,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,CAChD;MAAA,CAAC,QAAQ,CACX;IAAA,EAAE,mBAAmB,CAAC,CACvB,CAAC;AACJ,CAAC;AAED,+EAA+E;AAC/E,SAAS,mBAAmB,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAuB;IAC3E,MAAM,aAAa,GAAG,QAAQ,EAAE,CAAC;IACjC,MAAM,aAAa,GAAG,mBAAmB,EAAE,CAAC;IAC5C,MAAM,EAAE,YAAY,EAAE,GAAG,cAAc,EAAE,CAAC;IAC1C,MAAM,aAAa,GAAG,wBAAwB,CAAC;QAC7C,cAAc,EAAE,OAAO;QACvB,gBAAgB,EAAE,aAAa,CAAC,OAAO;KACxC,CAAC,CAAC;IACH,MAAM,UAAU,GAAG,IAAI,IAAI,aAAa,CAAC,IAAI,CAAC;IAC9C,MAAM,YAAY,GAAG,aAAa,CAAC,KAAK,CAAC,MAAM,CAAC;IAChD,MAAM,WAAW,GAAG,OAAO,CACzB,GAAG,EAAE,CAAC,WAAW,CAAC,YAAY,EAAE,UAAU,EAAE,YAAY,CAAC,EACzD,CAAC,YAAY,EAAE,UAAU,EAAE,YAAY,CAAC,CACzC,CAAC;IACF,MAAM,kBAAkB,GAAG,OAAO,CAChC,GAAG,EAAE,CAAC,CAAC;QACL,KAAK,EAAE,WAAW;QAClB,IAAI,EAAE,UAAU;QAChB,OAAO,EAAE,aAAa,CAAC,OAAO;QAC9B,cAAc,EAAE,aAAa,CAAC,cAAc;QAC5C,YAAY,EAAE,IAAI;KACnB,CAAC,EACF,CAAC,aAAa,CAAC,OAAO,EAAE,aAAa,CAAC,cAAc,EAAE,UAAU,EAAE,WAAW,CAAC,CAC/E,CAAC;IACF,MAAM,kBAAkB,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,aAAa,EAAE,CAAC,EAAE,CAAC,aAAa,CAAC,CAAC,CAAC;IAExF,OAAO,CACL,CAAC,uBAAuB,CAAC,KAAK,CAAC,CAAC,kBAAkB,CAAC,CACjD;MAAA,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,YAAY,CACnE;IAAA,EAAE,uBAAuB,CAAC,CAC3B,CAAC;AACJ,CAAC","sourcesContent":["import { createTheme, ThemeContext, useFontContext, useTheme } from '@ankhorage/surface';\nimport React, { useMemo } from 'react';\n\nimport { resolveZoraScopedThemeId } from './resolveZoraScopedThemeId';\nimport type { ZoraThemeId, ZoraThemeMode } from './types';\nimport { useZoraThemeRuntime, ZoraThemeRuntimeContext } from './ZoraThemeRuntimeContext';\n\nexport interface ZoraThemeScopeProps {\n children: React.ReactNode;\n themeId?: ZoraThemeId;\n mode?: ZoraThemeMode;\n}\n\n/*** Applies nested ZORA theme overrides without installing another Surface theme runtime. */\nexport function ZoraThemeScope({ children, themeId, mode }: ZoraThemeScopeProps) {\n if (mode === undefined && themeId === undefined) return children;\n return (\n <ZoraThemeScopeInner mode={mode} themeId={themeId}>\n {children}\n </ZoraThemeScopeInner>\n );\n}\n\n/*** Resolves and provides the scoped Surface and ZORA theme runtime values. */\nfunction ZoraThemeScopeInner({ children, themeId, mode }: ZoraThemeScopeProps) {\n const parentSurface = useTheme();\n const parentRuntime = useZoraThemeRuntime();\n const { activeFontId } = useFontContext();\n const scopedThemeId = resolveZoraScopedThemeId({\n desiredThemeId: themeId,\n inheritedThemeId: parentRuntime.themeId,\n });\n const scopedMode = mode ?? parentSurface.mode;\n const sourceConfig = parentSurface.theme.config;\n const scopedTheme = useMemo(\n () => createTheme(sourceConfig, scopedMode, activeFontId),\n [sourceConfig, scopedMode, activeFontId],\n );\n const scopedSurfaceValue = useMemo(\n () => ({\n theme: scopedTheme,\n mode: scopedMode,\n setMode: parentSurface.setMode,\n setThemeConfig: parentSurface.setThemeConfig,\n _hasProvider: true,\n }),\n [parentSurface.setMode, parentSurface.setThemeConfig, scopedMode, scopedTheme],\n );\n const scopedRuntimeValue = useMemo(() => ({ themeId: scopedThemeId }), [scopedThemeId]);\n\n return (\n <ZoraThemeRuntimeContext value={scopedRuntimeValue}>\n <ThemeContext value={scopedSurfaceValue}>{children}</ThemeContext>\n </ZoraThemeRuntimeContext>\n );\n}\n"]}
|
package/dist/theme/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ export type { ThemeModeToggleProps } from './ThemeModeToggleProps';
|
|
|
4
4
|
export { useZoraTheme } from './useZoraTheme';
|
|
5
5
|
export { withZoraThemeScope } from './withZoraThemeScope';
|
|
6
6
|
export type { ZoraBaseProps } from './ZoraBaseProps';
|
|
7
|
-
export type { ZoraProviderProps } from './ZoraProvider';
|
|
7
|
+
export type { ZoraProviderProps, ZoraToastCapability } from './ZoraProvider';
|
|
8
8
|
export { ZoraProvider } from './ZoraProvider';
|
|
9
9
|
export type { ZoraThemeScopeProps } from './ZoraThemeScope';
|
|
10
10
|
export { ZoraThemeScope } from './ZoraThemeScope';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/theme/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,YAAY,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,YAAY,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACrD,YAAY,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/theme/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,YAAY,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,YAAY,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACrD,YAAY,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAC7E,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,YAAY,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC"}
|
package/dist/theme/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/theme/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAG1D,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC","sourcesContent":["export * from './public';\nexport { ThemeModeToggle } from './ThemeModeToggle';\nexport type { ThemeModeToggleProps } from './ThemeModeToggleProps';\nexport { useZoraTheme } from './useZoraTheme';\nexport { withZoraThemeScope } from './withZoraThemeScope';\nexport type { ZoraBaseProps } from './ZoraBaseProps';\nexport type { ZoraProviderProps } from './ZoraProvider';\nexport { ZoraProvider } from './ZoraProvider';\nexport type { ZoraThemeScopeProps } from './ZoraThemeScope';\nexport { ZoraThemeScope } from './ZoraThemeScope';\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/theme/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAG1D,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC","sourcesContent":["export * from './public';\nexport { ThemeModeToggle } from './ThemeModeToggle';\nexport type { ThemeModeToggleProps } from './ThemeModeToggleProps';\nexport { useZoraTheme } from './useZoraTheme';\nexport { withZoraThemeScope } from './withZoraThemeScope';\nexport type { ZoraBaseProps } from './ZoraBaseProps';\nexport type { ZoraProviderProps, ZoraToastCapability } from './ZoraProvider';\nexport { ZoraProvider } from './ZoraProvider';\nexport type { ZoraThemeScopeProps } from './ZoraThemeScope';\nexport { ZoraThemeScope } from './ZoraThemeScope';\n"]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { AccordionItemProps as SurfaceAccordionItemProps, AccordionMode, AccordionMultipleProps as SurfaceAccordionMultipleProps, AccordionSingleProps as SurfaceAccordionSingleProps, ButtonIconSpec } from '@ankhorage/surface';
|
|
2
|
+
import type React from 'react';
|
|
3
|
+
import type { ZoraBaseProps } from '../theme/ZoraBaseProps';
|
|
4
|
+
export type { AccordionMode } from '@ankhorage/surface';
|
|
5
|
+
export type AccordionSingleProps = ZoraBaseProps & Omit<SurfaceAccordionSingleProps, 'children'> & {
|
|
6
|
+
children?: React.ReactNode;
|
|
7
|
+
};
|
|
8
|
+
export type AccordionMultipleProps = ZoraBaseProps & Omit<SurfaceAccordionMultipleProps, 'children'> & {
|
|
9
|
+
children?: React.ReactNode;
|
|
10
|
+
};
|
|
11
|
+
export type AccordionProps = AccordionSingleProps | AccordionMultipleProps;
|
|
12
|
+
export type AccordionItemProps = ZoraBaseProps & Omit<SurfaceAccordionItemProps, 'children'> & {
|
|
13
|
+
title: React.ReactNode;
|
|
14
|
+
description?: React.ReactNode;
|
|
15
|
+
icon?: ButtonIconSpec;
|
|
16
|
+
actions?: React.ReactNode;
|
|
17
|
+
children?: React.ReactNode;
|
|
18
|
+
};
|
|
19
|
+
export interface AccordionPresentationContextValue {
|
|
20
|
+
mode: AccordionMode;
|
|
21
|
+
openValues: readonly string[];
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=accordion.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"accordion.d.ts","sourceRoot":"","sources":["../../src/types/accordion.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,kBAAkB,IAAI,yBAAyB,EAC/C,aAAa,EACb,sBAAsB,IAAI,6BAA6B,EACvD,oBAAoB,IAAI,2BAA2B,EACnD,cAAc,EACf,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAE5D,YAAY,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAExD,MAAM,MAAM,oBAAoB,GAAG,aAAa,GAC9C,IAAI,CAAC,2BAA2B,EAAE,UAAU,CAAC,GAAG;IAC9C,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B,CAAC;AAEJ,MAAM,MAAM,sBAAsB,GAAG,aAAa,GAChD,IAAI,CAAC,6BAA6B,EAAE,UAAU,CAAC,GAAG;IAChD,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B,CAAC;AAEJ,MAAM,MAAM,cAAc,GAAG,oBAAoB,GAAG,sBAAsB,CAAC;AAE3E,MAAM,MAAM,kBAAkB,GAAG,aAAa,GAC5C,IAAI,CAAC,yBAAyB,EAAE,UAAU,CAAC,GAAG;IAC5C,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC9B,IAAI,CAAC,EAAE,cAAc,CAAC;IACtB,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B,CAAC;AAEJ,MAAM,WAAW,iCAAiC;IAChD,IAAI,EAAE,aAAa,CAAC;IACpB,UAAU,EAAE,SAAS,MAAM,EAAE,CAAC;CAC/B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"accordion.js","sourceRoot":"","sources":["../../src/types/accordion.ts"],"names":[],"mappings":"","sourcesContent":["import type {\n AccordionItemProps as SurfaceAccordionItemProps,\n AccordionMode,\n AccordionMultipleProps as SurfaceAccordionMultipleProps,\n AccordionSingleProps as SurfaceAccordionSingleProps,\n ButtonIconSpec,\n} from '@ankhorage/surface';\nimport type React from 'react';\n\nimport type { ZoraBaseProps } from '../theme/ZoraBaseProps';\n\nexport type { AccordionMode } from '@ankhorage/surface';\n\nexport type AccordionSingleProps = ZoraBaseProps &\n Omit<SurfaceAccordionSingleProps, 'children'> & {\n children?: React.ReactNode;\n };\n\nexport type AccordionMultipleProps = ZoraBaseProps &\n Omit<SurfaceAccordionMultipleProps, 'children'> & {\n children?: React.ReactNode;\n };\n\nexport type AccordionProps = AccordionSingleProps | AccordionMultipleProps;\n\nexport type AccordionItemProps = ZoraBaseProps &\n Omit<SurfaceAccordionItemProps, 'children'> & {\n title: React.ReactNode;\n description?: React.ReactNode;\n icon?: ButtonIconSpec;\n actions?: React.ReactNode;\n children?: React.ReactNode;\n };\n\nexport interface AccordionPresentationContextValue {\n mode: AccordionMode;\n openValues: readonly string[];\n}\n"]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ThemeConfig } from '@ankhorage/contracts';
|
|
2
|
+
import type { ToastProviderProps as SurfaceToastProviderProps } from '@ankhorage/surface';
|
|
3
|
+
import type React from 'react';
|
|
4
|
+
import type { ZoraTheme, ZoraThemeMode } from '../theme/types';
|
|
5
|
+
export type ZoraToastCapability = boolean | Omit<SurfaceToastProviderProps, 'children'>;
|
|
6
|
+
export interface ZoraProviderProps {
|
|
7
|
+
children: React.ReactNode;
|
|
8
|
+
theme?: ZoraTheme;
|
|
9
|
+
themeConfig?: ThemeConfig;
|
|
10
|
+
initialMode?: ZoraThemeMode;
|
|
11
|
+
toast?: ZoraToastCapability;
|
|
12
|
+
bottomSheet?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export interface ZoraRuntimeCapabilitiesProps {
|
|
15
|
+
children: React.ReactNode;
|
|
16
|
+
toast?: ZoraToastCapability;
|
|
17
|
+
bottomSheet?: boolean;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=provider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../src/types/provider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,KAAK,EAAE,kBAAkB,IAAI,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAC1F,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAE/D,MAAM,MAAM,mBAAmB,GAAG,OAAO,GAAG,IAAI,CAAC,yBAAyB,EAAE,UAAU,CAAC,CAAC;AAExF,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,WAAW,CAAC,EAAE,aAAa,CAAC;IAC5B,KAAK,CAAC,EAAE,mBAAmB,CAAC;IAC5B,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,MAAM,WAAW,4BAA4B;IAC3C,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,KAAK,CAAC,EAAE,mBAAmB,CAAC;IAC5B,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provider.js","sourceRoot":"","sources":["../../src/types/provider.ts"],"names":[],"mappings":"","sourcesContent":["import type { ThemeConfig } from '@ankhorage/contracts';\nimport type { ToastProviderProps as SurfaceToastProviderProps } from '@ankhorage/surface';\nimport type React from 'react';\n\nimport type { ZoraTheme, ZoraThemeMode } from '../theme/types';\n\nexport type ZoraToastCapability = boolean | Omit<SurfaceToastProviderProps, 'children'>;\n\nexport interface ZoraProviderProps {\n children: React.ReactNode;\n theme?: ZoraTheme;\n themeConfig?: ThemeConfig;\n initialMode?: ZoraThemeMode;\n toast?: ZoraToastCapability;\n bottomSheet?: boolean;\n}\n\nexport interface ZoraRuntimeCapabilitiesProps {\n children: React.ReactNode;\n toast?: ZoraToastCapability;\n bottomSheet?: boolean;\n}\n"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ToastController as SurfaceToastController, ToastOptions as SurfaceToastOptions, ToastProps as SurfaceToastProps, ToastProviderProps as SurfaceToastProviderProps, ToastStatus as SurfaceToastStatus } from '@ankhorage/surface';
|
|
2
|
+
import type { ZoraBaseProps } from '../theme/ZoraBaseProps';
|
|
3
|
+
export type ToastStatus = SurfaceToastStatus;
|
|
4
|
+
export type ToastOptions = SurfaceToastOptions;
|
|
5
|
+
export type ToastController = SurfaceToastController;
|
|
6
|
+
export type ToastProviderProps = SurfaceToastProviderProps;
|
|
7
|
+
export interface ToastProps extends ZoraBaseProps, Omit<SurfaceToastProps, 'testID'> {
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=toast.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toast.d.ts","sourceRoot":"","sources":["../../src/types/toast.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,eAAe,IAAI,sBAAsB,EACzC,YAAY,IAAI,mBAAmB,EACnC,UAAU,IAAI,iBAAiB,EAC/B,kBAAkB,IAAI,yBAAyB,EAC/C,WAAW,IAAI,kBAAkB,EAClC,MAAM,oBAAoB,CAAC;AAE5B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAE5D,MAAM,MAAM,WAAW,GAAG,kBAAkB,CAAC;AAC7C,MAAM,MAAM,YAAY,GAAG,mBAAmB,CAAC;AAC/C,MAAM,MAAM,eAAe,GAAG,sBAAsB,CAAC;AACrD,MAAM,MAAM,kBAAkB,GAAG,yBAAyB,CAAC;AAE3D,MAAM,WAAW,UAAW,SAAQ,aAAa,EAAE,IAAI,CAAC,iBAAiB,EAAE,QAAQ,CAAC;CAAG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toast.js","sourceRoot":"","sources":["../../src/types/toast.ts"],"names":[],"mappings":"","sourcesContent":["import type {\n ToastController as SurfaceToastController,\n ToastOptions as SurfaceToastOptions,\n ToastProps as SurfaceToastProps,\n ToastProviderProps as SurfaceToastProviderProps,\n ToastStatus as SurfaceToastStatus,\n} from '@ankhorage/surface';\n\nimport type { ZoraBaseProps } from '../theme/ZoraBaseProps';\n\nexport type ToastStatus = SurfaceToastStatus;\nexport type ToastOptions = SurfaceToastOptions;\nexport type ToastController = SurfaceToastController;\nexport type ToastProviderProps = SurfaceToastProviderProps;\n\nexport interface ToastProps extends ZoraBaseProps, Omit<SurfaceToastProps, 'testID'> {}\n"]}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ankhorage/zora",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "14.0.0",
|
|
5
5
|
"description": "Opinionated React Native and React Native Web UI kit built on @ankhorage/surface.",
|
|
6
6
|
"homepage": "https://github.com/ankhorage/zora#readme",
|
|
7
7
|
"bugs": {
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"@ankhorage/color-theory": "^0.3.0",
|
|
44
44
|
"@ankhorage/contracts": "^12.0.1",
|
|
45
|
-
"@ankhorage/surface": "^4.
|
|
45
|
+
"@ankhorage/surface": "^4.4.0",
|
|
46
46
|
"@ankhorage/utility": "^0.8.0",
|
|
47
47
|
"expo-document-picker": "~57.0.1",
|
|
48
48
|
"expo-image-picker": "~57.0.16"
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { ZoraComponentMeta } from '../../metadata';
|
|
2
|
+
import { CONTAINER_ALLOWED_CHILDREN } from '../../metadata/allowedChildren';
|
|
3
|
+
|
|
4
|
+
export const accordionItemMeta = {
|
|
5
|
+
name: 'AccordionItem',
|
|
6
|
+
category: 'component',
|
|
7
|
+
description: 'One expandable accordion item with authored content and optional actions.',
|
|
8
|
+
directManifestNode: true,
|
|
9
|
+
allowedChildren: [...CONTAINER_ALLOWED_CHILDREN],
|
|
10
|
+
blueprint: {
|
|
11
|
+
label: 'Accordion item',
|
|
12
|
+
defaultProps: { value: 'item', title: 'Accordion item' },
|
|
13
|
+
},
|
|
14
|
+
slots: {
|
|
15
|
+
actions: {
|
|
16
|
+
label: 'Actions',
|
|
17
|
+
allowedChildren: ['Button', 'ButtonGroup', 'IconButton'],
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
props: {
|
|
21
|
+
value: {
|
|
22
|
+
type: 'string',
|
|
23
|
+
category: 'Behavior',
|
|
24
|
+
label: 'Value',
|
|
25
|
+
authoring: { authority: 'instance' },
|
|
26
|
+
},
|
|
27
|
+
title: {
|
|
28
|
+
type: 'string',
|
|
29
|
+
category: 'Content',
|
|
30
|
+
label: 'Title',
|
|
31
|
+
authoring: { authority: 'instance' },
|
|
32
|
+
},
|
|
33
|
+
description: {
|
|
34
|
+
type: 'string',
|
|
35
|
+
category: 'Content',
|
|
36
|
+
label: 'Description',
|
|
37
|
+
authoring: { authority: 'instance' },
|
|
38
|
+
},
|
|
39
|
+
disabled: {
|
|
40
|
+
type: 'boolean',
|
|
41
|
+
category: 'State',
|
|
42
|
+
label: 'Disabled',
|
|
43
|
+
default: false,
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
} as const satisfies ZoraComponentMeta;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { ZoraComponentMeta } from '../../metadata';
|
|
2
|
+
|
|
3
|
+
export const accordionMeta = {
|
|
4
|
+
name: 'Accordion',
|
|
5
|
+
category: 'component',
|
|
6
|
+
description: 'Groups expandable content items with single or multiple expansion behavior.',
|
|
7
|
+
directManifestNode: true,
|
|
8
|
+
allowedChildren: ['AccordionItem'],
|
|
9
|
+
blueprint: {
|
|
10
|
+
label: 'Accordion',
|
|
11
|
+
defaultProps: { type: 'single', collapsible: true },
|
|
12
|
+
},
|
|
13
|
+
props: {
|
|
14
|
+
type: {
|
|
15
|
+
type: 'enum',
|
|
16
|
+
category: 'Behavior',
|
|
17
|
+
label: 'Expansion mode',
|
|
18
|
+
enum: ['single', 'multiple'],
|
|
19
|
+
default: 'single',
|
|
20
|
+
},
|
|
21
|
+
collapsible: {
|
|
22
|
+
type: 'boolean',
|
|
23
|
+
category: 'Behavior',
|
|
24
|
+
label: 'Collapsible',
|
|
25
|
+
default: true,
|
|
26
|
+
},
|
|
27
|
+
disabled: {
|
|
28
|
+
type: 'boolean',
|
|
29
|
+
category: 'State',
|
|
30
|
+
label: 'Disabled',
|
|
31
|
+
default: false,
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
} as const satisfies ZoraComponentMeta;
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { Accordion as SurfaceAccordion } from '@ankhorage/surface';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
|
|
4
|
+
import { withZoraThemeScope } from '../../../../theme/withZoraThemeScope';
|
|
5
|
+
import type {
|
|
6
|
+
AccordionMultipleProps,
|
|
7
|
+
AccordionProps,
|
|
8
|
+
AccordionSingleProps,
|
|
9
|
+
} from '../../../../types/accordion';
|
|
10
|
+
import { AccordionPresentationContext } from '../../composition/AccordionPresentationContext';
|
|
11
|
+
|
|
12
|
+
/*** Renders a ZORA accordion backed by Surface expansion and accessibility mechanics. */
|
|
13
|
+
export const Accordion = withZoraThemeScope(AccordionInner);
|
|
14
|
+
|
|
15
|
+
/*** Routes the public accordion union to its single or multiple Surface contract. */
|
|
16
|
+
function AccordionInner(props: AccordionProps) {
|
|
17
|
+
if (props.type === 'multiple') {
|
|
18
|
+
return <MultipleAccordion {...props} />;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return <SingleAccordion {...props} />;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/*** Mirrors Surface multiple-value state for ZORA presentation only. */
|
|
25
|
+
function MultipleAccordion({
|
|
26
|
+
themeId: _themeId,
|
|
27
|
+
mode: _mode,
|
|
28
|
+
children,
|
|
29
|
+
defaultValue,
|
|
30
|
+
interactionPolicy,
|
|
31
|
+
onValueChange,
|
|
32
|
+
value,
|
|
33
|
+
...surfaceProps
|
|
34
|
+
}: AccordionMultipleProps) {
|
|
35
|
+
const [presentationValues, setPresentationValues] = React.useState<readonly string[]>(
|
|
36
|
+
() => value ?? defaultValue ?? [],
|
|
37
|
+
);
|
|
38
|
+
const openValues = value ?? presentationValues;
|
|
39
|
+
|
|
40
|
+
return (
|
|
41
|
+
<AccordionPresentationContext value={{ mode: 'multiple', openValues }}>
|
|
42
|
+
<SurfaceAccordion
|
|
43
|
+
{...surfaceProps}
|
|
44
|
+
defaultValue={defaultValue}
|
|
45
|
+
interactionPolicy={interactionPolicy}
|
|
46
|
+
onValueChange={(nextValues) => {
|
|
47
|
+
setPresentationValues(nextValues);
|
|
48
|
+
onValueChange?.(nextValues);
|
|
49
|
+
}}
|
|
50
|
+
type="multiple"
|
|
51
|
+
value={value}
|
|
52
|
+
>
|
|
53
|
+
{children}
|
|
54
|
+
</SurfaceAccordion>
|
|
55
|
+
</AccordionPresentationContext>
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/*** Mirrors Surface single-value state for ZORA presentation only. */
|
|
60
|
+
function SingleAccordion({
|
|
61
|
+
themeId: _themeId,
|
|
62
|
+
mode: _mode,
|
|
63
|
+
children,
|
|
64
|
+
defaultValue,
|
|
65
|
+
interactionPolicy,
|
|
66
|
+
onValueChange,
|
|
67
|
+
type: _type,
|
|
68
|
+
value,
|
|
69
|
+
...surfaceProps
|
|
70
|
+
}: AccordionSingleProps) {
|
|
71
|
+
const [presentationValue, setPresentationValue] = React.useState<string | undefined>(
|
|
72
|
+
() => value ?? defaultValue,
|
|
73
|
+
);
|
|
74
|
+
const openValue = value ?? presentationValue;
|
|
75
|
+
const openValues = openValue === undefined ? [] : [openValue];
|
|
76
|
+
|
|
77
|
+
return (
|
|
78
|
+
<AccordionPresentationContext value={{ mode: 'single', openValues }}>
|
|
79
|
+
<SurfaceAccordion
|
|
80
|
+
{...surfaceProps}
|
|
81
|
+
defaultValue={defaultValue}
|
|
82
|
+
interactionPolicy={interactionPolicy}
|
|
83
|
+
onValueChange={(nextValue) => {
|
|
84
|
+
setPresentationValue(nextValue);
|
|
85
|
+
onValueChange?.(nextValue);
|
|
86
|
+
}}
|
|
87
|
+
type="single"
|
|
88
|
+
value={value}
|
|
89
|
+
>
|
|
90
|
+
{children}
|
|
91
|
+
</SurfaceAccordion>
|
|
92
|
+
</AccordionPresentationContext>
|
|
93
|
+
);
|
|
94
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AccordionContent as SurfaceAccordionContent,
|
|
3
|
+
AccordionItem as SurfaceAccordionItem,
|
|
4
|
+
AccordionTrigger as SurfaceAccordionTrigger,
|
|
5
|
+
} from '@ankhorage/surface';
|
|
6
|
+
import React from 'react';
|
|
7
|
+
import type { ViewStyle } from 'react-native';
|
|
8
|
+
|
|
9
|
+
import { withZoraThemeScope } from '../../../../theme/withZoraThemeScope';
|
|
10
|
+
import type { AccordionItemProps } from '../../../../types/accordion';
|
|
11
|
+
import { Icon } from '../../../icon/public';
|
|
12
|
+
import { Box, Divider, Stack } from '../../../layout/public';
|
|
13
|
+
import { Heading, Text } from '../../../typography/public';
|
|
14
|
+
import { AccordionPresentationContext } from '../../composition/AccordionPresentationContext';
|
|
15
|
+
|
|
16
|
+
/*** Renders one opinionated ZORA accordion item over Surface trigger/content primitives. */
|
|
17
|
+
export const AccordionItem = withZoraThemeScope(AccordionItemInner);
|
|
18
|
+
|
|
19
|
+
const triggerStyle: ViewStyle = { flex: 1 };
|
|
20
|
+
|
|
21
|
+
/*** Composes the item header, optional actions, expanded content, and separator. */
|
|
22
|
+
function AccordionItemInner({
|
|
23
|
+
themeId: _themeId,
|
|
24
|
+
mode: _mode,
|
|
25
|
+
actions,
|
|
26
|
+
children,
|
|
27
|
+
description,
|
|
28
|
+
disabled,
|
|
29
|
+
icon,
|
|
30
|
+
interactionPolicy,
|
|
31
|
+
testID,
|
|
32
|
+
title,
|
|
33
|
+
value,
|
|
34
|
+
...surfaceItemProps
|
|
35
|
+
}: AccordionItemProps) {
|
|
36
|
+
const presentation = React.use(AccordionPresentationContext);
|
|
37
|
+
if (!presentation) {
|
|
38
|
+
throw new Error('AccordionItem must be rendered inside Accordion.');
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const open = presentation.openValues.includes(value);
|
|
42
|
+
|
|
43
|
+
return (
|
|
44
|
+
<SurfaceAccordionItem
|
|
45
|
+
{...surfaceItemProps}
|
|
46
|
+
disabled={disabled}
|
|
47
|
+
interactionPolicy={interactionPolicy}
|
|
48
|
+
testID={testID}
|
|
49
|
+
value={value}
|
|
50
|
+
>
|
|
51
|
+
<Stack gap="none">
|
|
52
|
+
<Stack align="center" direction="row" gap="s">
|
|
53
|
+
<Box flex={1}>
|
|
54
|
+
<SurfaceAccordionTrigger interactionPolicy={interactionPolicy} style={triggerStyle}>
|
|
55
|
+
<Box px="m" py="m">
|
|
56
|
+
<Stack align="center" direction="row" gap="m">
|
|
57
|
+
{icon ? <Icon {...icon} /> : null}
|
|
58
|
+
<Box flex={1}>
|
|
59
|
+
<Stack gap="xs">
|
|
60
|
+
<Heading level={4}>{title}</Heading>
|
|
61
|
+
{description ? (
|
|
62
|
+
<Text emphasis="muted" variant="bodySmall">
|
|
63
|
+
{description}
|
|
64
|
+
</Text>
|
|
65
|
+
) : null}
|
|
66
|
+
</Stack>
|
|
67
|
+
</Box>
|
|
68
|
+
<Icon name={open ? 'chevron-up-outline' : 'chevron-down-outline'} size="m" />
|
|
69
|
+
</Stack>
|
|
70
|
+
</Box>
|
|
71
|
+
</SurfaceAccordionTrigger>
|
|
72
|
+
</Box>
|
|
73
|
+
{actions ? <Box pr="m">{actions}</Box> : null}
|
|
74
|
+
</Stack>
|
|
75
|
+
|
|
76
|
+
<SurfaceAccordionContent>
|
|
77
|
+
<Box px="m" pb="m">
|
|
78
|
+
<Stack gap="m">{children}</Stack>
|
|
79
|
+
</Box>
|
|
80
|
+
</SurfaceAccordionContent>
|
|
81
|
+
|
|
82
|
+
<Divider />
|
|
83
|
+
</Stack>
|
|
84
|
+
</SurfaceAccordionItem>
|
|
85
|
+
);
|
|
86
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export type {
|
|
2
|
+
AccordionItemProps,
|
|
3
|
+
AccordionMode,
|
|
4
|
+
AccordionMultipleProps,
|
|
5
|
+
AccordionProps,
|
|
6
|
+
AccordionSingleProps,
|
|
7
|
+
} from '../../types/accordion';
|
|
8
|
+
export { Accordion } from './adapters/inbound/Accordion';
|
|
9
|
+
export { AccordionItem } from './adapters/inbound/AccordionItem';
|
|
@@ -22,18 +22,21 @@ describe('ZORA BottomSheet public contract', () => {
|
|
|
22
22
|
expect(workletsPeer).toBeDefined();
|
|
23
23
|
});
|
|
24
24
|
|
|
25
|
-
test('installs
|
|
26
|
-
const [provider,
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
25
|
+
test('installs BottomSheet only in the enabled native runtime capability host', async () => {
|
|
26
|
+
const [provider, nativeCapabilities, webCapabilities, nativeDatePicker, nativeTimePicker] =
|
|
27
|
+
await Promise.all([
|
|
28
|
+
Bun.file('src/theme/ZoraProvider.tsx').text(),
|
|
29
|
+
Bun.file('src/theme/ZoraRuntimeCapabilities.native.tsx').text(),
|
|
30
|
+
Bun.file('src/theme/ZoraRuntimeCapabilities.web.tsx').text(),
|
|
31
|
+
Bun.file('src/features/date-picker/adapters/inbound/DatePicker.native.tsx').text(),
|
|
32
|
+
Bun.file('src/features/time-picker/adapters/inbound/TimePicker.native.tsx').text(),
|
|
33
|
+
]);
|
|
31
34
|
|
|
32
|
-
expect(provider).toContain('<
|
|
33
|
-
expect(provider).not.toContain('
|
|
34
|
-
expect(
|
|
35
|
-
expect(
|
|
36
|
-
expect(
|
|
37
|
-
expect(
|
|
35
|
+
expect(provider).toContain('<ZoraRuntimeCapabilities');
|
|
36
|
+
expect(provider).not.toContain('BottomSheetProvider');
|
|
37
|
+
expect(nativeCapabilities).toContain('<BottomSheetProvider>');
|
|
38
|
+
expect(webCapabilities).not.toContain('BottomSheetProvider');
|
|
39
|
+
expect(nativeDatePicker).toContain('useBottomSheet()');
|
|
40
|
+
expect(nativeTimePicker).toContain('useBottomSheet()');
|
|
38
41
|
});
|
|
39
42
|
});
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import { withZoraThemeScope } from '../../../../theme/withZoraThemeScope';
|
|
4
|
+
import type { DatePickerProps } from '../../../../types/date-picker';
|
|
5
|
+
import { useBottomSheet } from '../../../bottom-sheet/public';
|
|
6
|
+
import { DatePickerContent } from '../../composition/DatePickerContent';
|
|
7
|
+
import { DatePickerField } from '../../composition/DatePickerField';
|
|
8
|
+
import { DatePickerTrigger } from '../../composition/DatePickerTrigger';
|
|
9
|
+
import { formatLocalDate } from '../../utils/localDate';
|
|
10
|
+
|
|
11
|
+
/*** Renders DatePicker with native BottomSheet presentation. */
|
|
12
|
+
export const DatePicker = withZoraThemeScope(DatePickerInner);
|
|
13
|
+
|
|
14
|
+
/*** Connects the shared DatePicker field and content to the native BottomSheet host. */
|
|
15
|
+
function DatePickerInner({ themeId: _themeId, mode: _mode, ...props }: DatePickerProps) {
|
|
16
|
+
const { dismiss, present } = useBottomSheet();
|
|
17
|
+
|
|
18
|
+
const openPicker = React.useCallback(() => {
|
|
19
|
+
if (props.interactionPolicy === 'passive') return;
|
|
20
|
+
|
|
21
|
+
present({
|
|
22
|
+
content: (
|
|
23
|
+
<DatePickerContent
|
|
24
|
+
description={props.description}
|
|
25
|
+
interactionPolicy={props.interactionPolicy}
|
|
26
|
+
label={props.label}
|
|
27
|
+
maxDate={props.maxDate}
|
|
28
|
+
minDate={props.minDate}
|
|
29
|
+
onDismiss={dismiss}
|
|
30
|
+
onSelect={(date) => {
|
|
31
|
+
props.onValueChange?.(formatLocalDate(date));
|
|
32
|
+
dismiss();
|
|
33
|
+
}}
|
|
34
|
+
testID={props.testID}
|
|
35
|
+
value={props.value}
|
|
36
|
+
/>
|
|
37
|
+
),
|
|
38
|
+
});
|
|
39
|
+
}, [dismiss, present, props]);
|
|
40
|
+
|
|
41
|
+
return (
|
|
42
|
+
<DatePickerField {...props}>
|
|
43
|
+
<DatePickerTrigger {...props} onPress={openPicker} />
|
|
44
|
+
</DatePickerField>
|
|
45
|
+
);
|
|
46
|
+
}
|