@ankhorage/zora 1.5.0 → 2.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 +29 -0
- package/README.md +125 -123
- package/dist/components/app-bar/AppBar.js +4 -4
- package/dist/components/app-bar/AppBar.js.map +1 -1
- package/dist/components/avatar/Avatar.d.ts.map +1 -1
- package/dist/components/avatar/Avatar.js +19 -9
- package/dist/components/avatar/Avatar.js.map +1 -1
- package/dist/components/avatar/types.d.ts +2 -2
- package/dist/components/avatar/types.d.ts.map +1 -1
- package/dist/components/avatar/types.js.map +1 -1
- package/dist/components/avatar-group/AvatarGroup.js +2 -2
- package/dist/components/avatar-group/AvatarGroup.js.map +1 -1
- package/dist/components/avatar-group/types.d.ts +2 -2
- package/dist/components/avatar-group/types.d.ts.map +1 -1
- package/dist/components/avatar-group/types.js.map +1 -1
- package/dist/components/badge/Badge.js +3 -3
- package/dist/components/badge/Badge.js.map +1 -1
- package/dist/components/badge/types.d.ts +4 -4
- package/dist/components/badge/types.d.ts.map +1 -1
- package/dist/components/badge/types.js.map +1 -1
- package/dist/components/button/Button.js +3 -3
- package/dist/components/button/Button.js.map +1 -1
- package/dist/components/button/meta.d.ts +7 -7
- package/dist/components/button/meta.d.ts.map +1 -1
- package/dist/components/button/meta.js +8 -7
- package/dist/components/button/meta.js.map +1 -1
- package/dist/components/button/types.d.ts +4 -4
- package/dist/components/button/types.d.ts.map +1 -1
- package/dist/components/button/types.js.map +1 -1
- package/dist/components/card/Card.js +2 -2
- package/dist/components/card/Card.js.map +1 -1
- package/dist/components/checkbox/CheckboxGroup.js +5 -5
- package/dist/components/checkbox/CheckboxGroup.js.map +1 -1
- package/dist/components/checkbox/types.d.ts +1 -1
- package/dist/components/checkbox/types.d.ts.map +1 -1
- package/dist/components/checkbox/types.js.map +1 -1
- package/dist/components/chip/Chip.d.ts.map +1 -1
- package/dist/components/chip/Chip.js +9 -10
- package/dist/components/chip/Chip.js.map +1 -1
- package/dist/components/chip/resolveChipColors.d.ts +3 -3
- package/dist/components/chip/resolveChipColors.d.ts.map +1 -1
- package/dist/components/chip/resolveChipColors.js +14 -4
- package/dist/components/chip/resolveChipColors.js.map +1 -1
- package/dist/components/chip/types.d.ts +2 -2
- package/dist/components/chip/types.d.ts.map +1 -1
- package/dist/components/chip/types.js.map +1 -1
- package/dist/components/chip-group/ChipGroup.js +2 -2
- package/dist/components/chip-group/ChipGroup.js.map +1 -1
- package/dist/components/chip-group/types.d.ts +2 -2
- package/dist/components/chip-group/types.d.ts.map +1 -1
- package/dist/components/chip-group/types.js.map +1 -1
- package/dist/components/drawer/Drawer.js +1 -1
- package/dist/components/drawer/Drawer.js.map +1 -1
- package/dist/components/form/FormError.js +1 -1
- package/dist/components/form/FormError.js.map +1 -1
- package/dist/components/form/FormField.js +1 -1
- package/dist/components/form/FormField.js.map +1 -1
- package/dist/components/heading/Heading.d.ts.map +1 -1
- package/dist/components/heading/Heading.js +5 -3
- package/dist/components/heading/Heading.js.map +1 -1
- package/dist/components/heading/index.d.ts +1 -1
- package/dist/components/heading/index.d.ts.map +1 -1
- package/dist/components/heading/index.js.map +1 -1
- package/dist/components/heading/meta.d.ts +9 -3
- package/dist/components/heading/meta.d.ts.map +1 -1
- package/dist/components/heading/meta.js +10 -3
- package/dist/components/heading/meta.js.map +1 -1
- package/dist/components/heading/resolveHeadingRecipe.d.ts +4 -3
- package/dist/components/heading/resolveHeadingRecipe.d.ts.map +1 -1
- package/dist/components/heading/resolveHeadingRecipe.js +33 -12
- package/dist/components/heading/resolveHeadingRecipe.js.map +1 -1
- package/dist/components/heading/types.d.ts +5 -2
- package/dist/components/heading/types.d.ts.map +1 -1
- package/dist/components/heading/types.js.map +1 -1
- package/dist/components/icon-button/IconButton.js +3 -3
- package/dist/components/icon-button/IconButton.js.map +1 -1
- package/dist/components/icon-button/types.d.ts +3 -3
- package/dist/components/icon-button/types.d.ts.map +1 -1
- package/dist/components/icon-button/types.js.map +1 -1
- package/dist/components/input/Input.js +1 -1
- package/dist/components/input/Input.js.map +1 -1
- package/dist/components/media-card/MediaCard.js +2 -2
- package/dist/components/media-card/MediaCard.js.map +1 -1
- package/dist/components/metric-card/MetricCard.js +5 -5
- package/dist/components/metric-card/MetricCard.js.map +1 -1
- package/dist/components/metric-card/types.d.ts +2 -2
- package/dist/components/metric-card/types.d.ts.map +1 -1
- package/dist/components/metric-card/types.js.map +1 -1
- package/dist/components/modal/Modal.js +1 -1
- package/dist/components/modal/Modal.js.map +1 -1
- package/dist/components/progress/Progress.js +2 -2
- package/dist/components/progress/Progress.js.map +1 -1
- package/dist/components/progress/types.d.ts +3 -3
- package/dist/components/progress/types.d.ts.map +1 -1
- package/dist/components/progress/types.js +12 -2
- package/dist/components/progress/types.js.map +1 -1
- package/dist/components/radio/RadioGroup.js +5 -5
- package/dist/components/radio/RadioGroup.js.map +1 -1
- package/dist/components/radio/types.d.ts +1 -1
- package/dist/components/radio/types.d.ts.map +1 -1
- package/dist/components/radio/types.js.map +1 -1
- package/dist/components/rating/Rating.js +2 -2
- package/dist/components/rating/Rating.js.map +1 -1
- package/dist/components/rating/types.d.ts +3 -3
- package/dist/components/rating/types.d.ts.map +1 -1
- package/dist/components/rating/types.js +12 -2
- package/dist/components/rating/types.js.map +1 -1
- package/dist/components/tabs/Tabs.d.ts.map +1 -1
- package/dist/components/tabs/Tabs.js +4 -4
- package/dist/components/tabs/Tabs.js.map +1 -1
- package/dist/components/text/Text.d.ts.map +1 -1
- package/dist/components/text/Text.js +3 -2
- package/dist/components/text/Text.js.map +1 -1
- package/dist/components/text/index.d.ts +1 -1
- package/dist/components/text/index.d.ts.map +1 -1
- package/dist/components/text/index.js.map +1 -1
- package/dist/components/text/meta.d.ts +10 -4
- package/dist/components/text/meta.d.ts.map +1 -1
- package/dist/components/text/meta.js +11 -4
- package/dist/components/text/meta.js.map +1 -1
- package/dist/components/text/resolveTextRecipe.d.ts +4 -3
- package/dist/components/text/resolveTextRecipe.d.ts.map +1 -1
- package/dist/components/text/resolveTextRecipe.js +35 -13
- package/dist/components/text/resolveTextRecipe.js.map +1 -1
- package/dist/components/text/types.d.ts +5 -2
- package/dist/components/text/types.d.ts.map +1 -1
- package/dist/components/text/types.js.map +1 -1
- package/dist/components/toolbar/ToolbarAction.js +1 -1
- package/dist/components/toolbar/ToolbarAction.js.map +1 -1
- package/dist/index.d.ts +4 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/internal/colorModel.d.ts +10 -0
- package/dist/internal/colorModel.d.ts.map +1 -0
- package/dist/internal/colorModel.js +25 -0
- package/dist/internal/colorModel.js.map +1 -0
- package/dist/internal/recipes.d.ts +12 -11
- package/dist/internal/recipes.d.ts.map +1 -1
- package/dist/internal/recipes.js +6 -6
- package/dist/internal/recipes.js.map +1 -1
- package/dist/layout/screen/Screen.d.ts.map +1 -1
- package/dist/layout/screen/Screen.js +7 -3
- package/dist/layout/screen/Screen.js.map +1 -1
- package/dist/patterns/auth/ForgotPasswordForm.js +2 -2
- package/dist/patterns/auth/ForgotPasswordForm.js.map +1 -1
- package/dist/patterns/auth/OtpForm.js +2 -2
- package/dist/patterns/auth/OtpForm.js.map +1 -1
- package/dist/patterns/auth/SignInForm.js +4 -4
- package/dist/patterns/auth/SignInForm.js.map +1 -1
- package/dist/patterns/auth/SignUpForm.js +2 -2
- package/dist/patterns/auth/SignUpForm.js.map +1 -1
- package/dist/patterns/chat-list-item/ChatListItem.d.ts.map +1 -1
- package/dist/patterns/chat-list-item/ChatListItem.js +6 -6
- package/dist/patterns/chat-list-item/ChatListItem.js.map +1 -1
- package/dist/patterns/chat-list-item/types.d.ts +2 -2
- package/dist/patterns/chat-list-item/types.d.ts.map +1 -1
- package/dist/patterns/chat-list-item/types.js.map +1 -1
- package/dist/patterns/collection-editor/CollectionEditor.js +5 -5
- package/dist/patterns/collection-editor/CollectionEditor.js.map +1 -1
- package/dist/patterns/confirm-dialog/ConfirmDialog.js +3 -3
- package/dist/patterns/confirm-dialog/ConfirmDialog.js.map +1 -1
- package/dist/patterns/confirm-dialog/types.d.ts +3 -3
- package/dist/patterns/confirm-dialog/types.d.ts.map +1 -1
- package/dist/patterns/confirm-dialog/types.js.map +1 -1
- package/dist/patterns/disclosure-section/DisclosureSection.js +1 -1
- package/dist/patterns/disclosure-section/DisclosureSection.js.map +1 -1
- package/dist/patterns/empty-state/EmptyState.js +2 -2
- package/dist/patterns/empty-state/EmptyState.js.map +1 -1
- package/dist/patterns/empty-state/types.d.ts +3 -3
- package/dist/patterns/empty-state/types.d.ts.map +1 -1
- package/dist/patterns/empty-state/types.js.map +1 -1
- package/dist/patterns/form-field/FormField.js +1 -1
- package/dist/patterns/form-field/FormField.js.map +1 -1
- package/dist/patterns/hero/Hero.js +3 -3
- package/dist/patterns/hero/Hero.js.map +1 -1
- package/dist/patterns/hero/types.d.ts +3 -3
- package/dist/patterns/hero/types.d.ts.map +1 -1
- package/dist/patterns/hero/types.js.map +1 -1
- package/dist/patterns/image-preview/ImagePreview.js +1 -1
- package/dist/patterns/image-preview/ImagePreview.js.map +1 -1
- package/dist/patterns/image-upload-field/ImageUploadField.js +7 -7
- package/dist/patterns/image-upload-field/ImageUploadField.js.map +1 -1
- package/dist/patterns/list/ListRow.js +2 -2
- package/dist/patterns/list/ListRow.js.map +1 -1
- package/dist/patterns/message-bubble/MessageBubble.d.ts.map +1 -1
- package/dist/patterns/message-bubble/MessageBubble.js +6 -6
- package/dist/patterns/message-bubble/MessageBubble.js.map +1 -1
- package/dist/patterns/message-bubble/types.d.ts +2 -2
- package/dist/patterns/message-bubble/types.d.ts.map +1 -1
- package/dist/patterns/message-bubble/types.js.map +1 -1
- package/dist/patterns/notice/Notice.js +2 -2
- package/dist/patterns/notice/Notice.js.map +1 -1
- package/dist/patterns/notice/types.d.ts +2 -2
- package/dist/patterns/notice/types.d.ts.map +1 -1
- package/dist/patterns/notice/types.js.map +1 -1
- package/dist/patterns/post-card/PostCard.js +4 -4
- package/dist/patterns/post-card/PostCard.js.map +1 -1
- package/dist/patterns/post-card/types.d.ts +2 -2
- package/dist/patterns/post-card/types.d.ts.map +1 -1
- package/dist/patterns/post-card/types.js.map +1 -1
- package/dist/patterns/section-header/SectionHeader.js +2 -2
- package/dist/patterns/section-header/SectionHeader.js.map +1 -1
- package/dist/patterns/settings-row/SettingsRow.js +1 -1
- package/dist/patterns/settings-row/SettingsRow.js.map +1 -1
- package/dist/patterns/theme-composer/ThemeComposer.js +14 -14
- package/dist/patterns/theme-composer/ThemeComposer.js.map +1 -1
- package/dist/patterns/tile-grid/PaletteItem.js +1 -1
- package/dist/patterns/tile-grid/PaletteItem.js.map +1 -1
- package/dist/patterns/timeline/Timeline.d.ts.map +1 -1
- package/dist/patterns/timeline/Timeline.js +14 -4
- package/dist/patterns/timeline/Timeline.js.map +1 -1
- package/dist/patterns/timeline/types.d.ts +2 -2
- package/dist/patterns/timeline/types.d.ts.map +1 -1
- package/dist/patterns/timeline/types.js.map +1 -1
- package/dist/patterns/tree-view/TreeItem.js +1 -1
- package/dist/patterns/tree-view/TreeItem.js.map +1 -1
- package/dist/patterns/zora-tab-bar/ZoraTabBar.d.ts.map +1 -1
- package/dist/patterns/zora-tab-bar/ZoraTabBar.js +64 -15
- package/dist/patterns/zora-tab-bar/ZoraTabBar.js.map +1 -1
- package/package.json +2 -2
- package/src/components/app-bar/AppBar.tsx +6 -6
- package/src/components/avatar/Avatar.tsx +21 -11
- package/src/components/avatar/types.ts +2 -2
- package/src/components/avatar-group/AvatarGroup.tsx +2 -2
- package/src/components/avatar-group/types.ts +2 -2
- package/src/components/badge/Badge.tsx +4 -4
- package/src/components/badge/types.ts +4 -4
- package/src/components/button/Button.tsx +4 -4
- package/src/components/button/meta.ts +8 -7
- package/src/components/button/types.ts +4 -4
- package/src/components/card/Card.tsx +2 -2
- package/src/components/checkbox/CheckboxGroup.tsx +6 -6
- package/src/components/checkbox/types.ts +1 -1
- package/src/components/chip/Chip.tsx +9 -10
- package/src/components/chip/resolveChipColors.ts +16 -6
- package/src/components/chip/types.ts +2 -2
- package/src/components/chip-group/ChipGroup.tsx +2 -2
- package/src/components/chip-group/types.ts +2 -2
- package/src/components/drawer/Drawer.tsx +1 -1
- package/src/components/form/FormError.tsx +1 -1
- package/src/components/form/FormField.tsx +1 -1
- package/src/components/heading/Heading.tsx +6 -3
- package/src/components/heading/index.ts +2 -1
- package/src/components/heading/meta.ts +10 -3
- package/src/components/heading/resolveHeadingRecipe.test.ts +13 -10
- package/src/components/heading/resolveHeadingRecipe.ts +58 -15
- package/src/components/heading/types.ts +5 -10
- package/src/components/icon-button/IconButton.tsx +4 -4
- package/src/components/icon-button/types.ts +3 -3
- package/src/components/input/Input.tsx +2 -2
- package/src/components/media-card/MediaCard.tsx +2 -2
- package/src/components/metric-card/MetricCard.tsx +6 -6
- package/src/components/metric-card/types.ts +2 -2
- package/src/components/modal/Modal.tsx +1 -1
- package/src/components/progress/Progress.tsx +2 -2
- package/src/components/progress/types.ts +14 -4
- package/src/components/radio/RadioGroup.tsx +6 -6
- package/src/components/radio/types.ts +1 -1
- package/src/components/rating/Rating.tsx +2 -2
- package/src/components/rating/types.ts +14 -4
- package/src/components/tabs/Tabs.tsx +11 -7
- package/src/components/text/Text.tsx +4 -2
- package/src/components/text/index.ts +8 -1
- package/src/components/text/meta.ts +11 -4
- package/src/components/text/resolveTextRecipe.test.ts +18 -14
- package/src/components/text/resolveTextRecipe.ts +42 -15
- package/src/components/text/types.ts +5 -10
- package/src/components/toolbar/ToolbarAction.tsx +2 -2
- package/src/index.ts +22 -2
- package/src/internal/colorModel.ts +39 -0
- package/src/internal/recipes.test.ts +2 -2
- package/src/internal/recipes.ts +18 -18
- package/src/layout/screen/Screen.tsx +11 -3
- package/src/patterns/auth/ForgotPasswordForm.tsx +2 -2
- package/src/patterns/auth/OtpForm.tsx +2 -2
- package/src/patterns/auth/SignInForm.tsx +4 -4
- package/src/patterns/auth/SignUpForm.tsx +2 -2
- package/src/patterns/chat-list-item/ChatListItem.tsx +7 -6
- package/src/patterns/chat-list-item/types.ts +2 -2
- package/src/patterns/collection-editor/CollectionEditor.tsx +6 -6
- package/src/patterns/confirm-dialog/ConfirmDialog.tsx +4 -4
- package/src/patterns/confirm-dialog/types.ts +3 -3
- package/src/patterns/disclosure-section/DisclosureSection.tsx +2 -2
- package/src/patterns/empty-state/EmptyState.tsx +4 -4
- package/src/patterns/empty-state/types.ts +3 -3
- package/src/patterns/form-field/FormField.tsx +1 -1
- package/src/patterns/hero/Hero.tsx +4 -4
- package/src/patterns/hero/types.ts +3 -3
- package/src/patterns/image-preview/ImagePreview.tsx +1 -1
- package/src/patterns/image-upload-field/ImageUploadField.tsx +8 -8
- package/src/patterns/list/ListRow.tsx +2 -2
- package/src/patterns/message-bubble/MessageBubble.tsx +10 -6
- package/src/patterns/message-bubble/types.ts +2 -2
- package/src/patterns/notice/Notice.tsx +2 -2
- package/src/patterns/notice/types.ts +2 -2
- package/src/patterns/post-card/PostCard.tsx +5 -5
- package/src/patterns/post-card/types.ts +2 -2
- package/src/patterns/section-header/SectionHeader.tsx +2 -2
- package/src/patterns/settings-row/SettingsRow.tsx +1 -1
- package/src/patterns/theme-composer/ThemeComposer.tsx +15 -15
- package/src/patterns/tile-grid/PaletteItem.tsx +1 -1
- package/src/patterns/timeline/Timeline.tsx +15 -5
- package/src/patterns/timeline/types.ts +2 -2
- package/src/patterns/tree-view/TreeItem.tsx +1 -1
- package/src/patterns/zora-tab-bar/ZoraTabBar.tsx +104 -15
|
@@ -28,8 +28,8 @@ function AppBarInner({ themeId: _themeId, mode: _mode, title, subtitle, leading,
|
|
|
28
28
|
const resolvedMode = resolveMode(appMode);
|
|
29
29
|
const isSelectionMode = resolvedMode.type === 'selection';
|
|
30
30
|
const resolvedLeading = leading ??
|
|
31
|
-
(isSelectionMode ? (<IconButton icon={resolvedMode.cancelIcon ?? DEFAULT_CANCEL_ICON} label={resolveCancelLabel(resolvedMode)}
|
|
32
|
-
const overflowButton = overflow?.onPress ? (<IconButton disabled={overflow.disabled} icon={overflow.icon ?? DEFAULT_OVERFLOW_ICON} label={resolveOverflowLabel(overflow)}
|
|
31
|
+
(isSelectionMode ? (<IconButton icon={resolvedMode.cancelIcon ?? DEFAULT_CANCEL_ICON} label={resolveCancelLabel(resolvedMode)} variant="ghost" size="m" color="neutral" onPress={resolvedMode.onCancel}/>) : undefined);
|
|
32
|
+
const overflowButton = overflow?.onPress ? (<IconButton disabled={overflow.disabled} icon={overflow.icon ?? DEFAULT_OVERFLOW_ICON} label={resolveOverflowLabel(overflow)} variant="ghost" size="m" color="neutral" onPress={overflow.onPress}/>) : null;
|
|
33
33
|
const resolvedTrailing = actions || overflowButton ? (<Inline align="center" gap="s" wrap="nowrap">
|
|
34
34
|
{actions}
|
|
35
35
|
{overflowButton}
|
|
@@ -39,7 +39,7 @@ function AppBarInner({ themeId: _themeId, mode: _mode, title, subtitle, leading,
|
|
|
39
39
|
return children;
|
|
40
40
|
}
|
|
41
41
|
if (isSelectionMode) {
|
|
42
|
-
return (<Text numberOfLines={1}
|
|
42
|
+
return (<Text numberOfLines={1} emphasis="default" variant="label" weight="semiBold">
|
|
43
43
|
{resolveSelectionLabel(resolvedMode)}
|
|
44
44
|
</Text>);
|
|
45
45
|
}
|
|
@@ -50,7 +50,7 @@ function AppBarInner({ themeId: _themeId, mode: _mode, title, subtitle, leading,
|
|
|
50
50
|
{title != null ? (<Heading ellipsizeMode="tail" level={3} numberOfLines={1} size="h5">
|
|
51
51
|
{title}
|
|
52
52
|
</Heading>) : null}
|
|
53
|
-
{subtitle != null ? (<Text ellipsizeMode="tail" numberOfLines={1}
|
|
53
|
+
{subtitle != null ? (<Text ellipsizeMode="tail" numberOfLines={1} emphasis="muted" variant="bodySmall">
|
|
54
54
|
{subtitle}
|
|
55
55
|
</Text>) : null}
|
|
56
56
|
</Stack>);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppBar.js","sourceRoot":"","sources":["../../../src/components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Aa,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CACjE;YAAA,CAAC,KAAK,CACR;UAAA,EAAE,OAAO,CAAC,CACX,CAAC,CAAC,CAAC,IAAI,CACR;QAAA,CAAC,QAAQ,IAAI,IAAI,CAAC,CAAC,CAAC,CAClB,CAAC,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,WAAW,CAC/E;YAAA,CAAC,QAAQ,CACX;UAAA,EAAE,IAAI,CAAC,CACR,CAAC,CAAC,CAAC,IAAI,CACV;MAAA,EAAE,KAAK,CAAC,CACT,CAAC;IACJ,CAAC,CAAC,EAAE,CAAC;IAEL,OAAO,CACL,CAAC,aAAa,CACZ,EAAE,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,CACxE,OAAO,CAAC,CAAC,OAAO,CAAC,CACjB,OAAO,CAAC,CAAC,eAAe,CAAC,CACzB,WAAW,CAAC,CAAC,WAAW,CAAC,CACzB,MAAM,CAAC,CAAC,MAAM,CAAC,CACf,QAAQ,CAAC,CAAC,gBAAgB,CAAC,CAE3B;MAAA,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,cAAc,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAC9E;IAAA,EAAE,aAAa,CAAC,CACjB,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,MAAM,GAAG,kBAAkB,CAAC,WAAW,CAAC,CAAC","sourcesContent":["import { AppBar as SurfaceAppBar } from '@ankhorage/surface';\nimport React from 'react';\n\nimport { Box, Inline, Stack } from '../../foundation';\nimport { useZoraTheme } from '../../theme/useZoraTheme';\nimport { withZoraThemeScope } from '../../theme/withZoraThemeScope';\nimport { Heading } from '../heading';\nimport { IconButton } from '../icon-button';\nimport { Text } from '../text';\nimport type { AppBarMode, AppBarOverflowAction, AppBarProps } from './types';\n\nconst DEFAULT_CANCEL_ICON = { name: 'close-outline' };\nconst DEFAULT_OVERFLOW_ICON = { name: 'ellipsis-vertical' };\n\nfunction resolveMode(mode: AppBarMode | undefined): AppBarMode {\n return mode ?? { type: 'default' };\n}\n\nfunction resolveSelectionLabel({ count, label }: { count?: number; label: string }): string {\n if (count === undefined) {\n return label;\n }\n\n return `${label} (${count})`;\n}\n\nfunction resolveOverflowLabel(overflow: AppBarOverflowAction): string {\n return overflow.label ?? 'More options';\n}\n\nfunction resolveCancelLabel(mode: Extract<AppBarMode, { type: 'selection' }>): string {\n return mode.cancelLabel ?? 'Cancel selection';\n}\n\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}: AppBarProps) {\n const { theme } = useZoraTheme();\n const resolvedMode = resolveMode(appMode);\n const isSelectionMode = resolvedMode.type === 'selection';\n\n const resolvedLeading =\n leading ??\n (isSelectionMode ? (\n <IconButton\n icon={resolvedMode.cancelIcon ?? DEFAULT_CANCEL_ICON}\n label={resolveCancelLabel(resolvedMode)}\n variant=\"ghost\"\n size=\"m\"\n color=\"neutral\"\n onPress={resolvedMode.onCancel}\n />\n ) : undefined);\n\n const overflowButton = overflow?.onPress ? (\n <IconButton\n disabled={overflow.disabled}\n icon={overflow.icon ?? DEFAULT_OVERFLOW_ICON}\n label={resolveOverflowLabel(overflow)}\n variant=\"ghost\"\n size=\"m\"\n color=\"neutral\"\n onPress={overflow.onPress}\n />\n ) : null;\n\n const resolvedTrailing =\n actions || overflowButton ? (\n <Inline align=\"center\" gap=\"s\" wrap=\"nowrap\">\n {actions}\n {overflowButton}\n </Inline>\n ) : undefined;\n\n const resolvedCenter = (() => {\n if (children !== undefined) {\n return children;\n }\n\n if (isSelectionMode) {\n return (\n <Text numberOfLines={1} emphasis=\"default\" variant=\"label\" weight=\"semiBold\">\n {resolveSelectionLabel(resolvedMode)}\n </Text>\n );\n }\n\n if (title == null && subtitle == null) {\n return null;\n }\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\" numberOfLines={1} emphasis=\"muted\" variant=\"bodySmall\">\n {subtitle}\n </Text>\n ) : null}\n </Stack>\n );\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\nexport const AppBar = withZoraThemeScope(AppBarInner);\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Avatar.d.ts","sourceRoot":"","sources":["../../../src/components/avatar/Avatar.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAU1B,OAAO,KAAK,EAAE,WAAW,EAA2B,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"Avatar.d.ts","sourceRoot":"","sources":["../../../src/components/avatar/Avatar.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAU1B,OAAO,KAAK,EAAE,WAAW,EAA2B,MAAM,SAAS,CAAC;AAmIpE,eAAO,MAAM,MAAM,mDAAkC,CAAC"}
|
|
@@ -13,10 +13,20 @@ const AVATAR_SIZES = {
|
|
|
13
13
|
l: 48,
|
|
14
14
|
xl: 64,
|
|
15
15
|
};
|
|
16
|
-
function resolveRoleSemantics(theme,
|
|
17
|
-
switch (
|
|
16
|
+
function resolveRoleSemantics(theme, color) {
|
|
17
|
+
switch (color) {
|
|
18
|
+
case 'secondary':
|
|
19
|
+
return theme.semantics.secondary;
|
|
20
|
+
case 'tertiary':
|
|
21
|
+
return theme.semantics.accent;
|
|
22
|
+
case 'quaternary':
|
|
23
|
+
return theme.semantics.highlight;
|
|
18
24
|
case 'primary':
|
|
19
25
|
return theme.semantics.action.primary;
|
|
26
|
+
case 'error':
|
|
27
|
+
return theme.semantics.error;
|
|
28
|
+
case 'info':
|
|
29
|
+
return theme.semantics.info;
|
|
20
30
|
case 'danger':
|
|
21
31
|
return theme.semantics.action.danger;
|
|
22
32
|
case 'success':
|
|
@@ -28,8 +38,8 @@ function resolveRoleSemantics(theme, tone) {
|
|
|
28
38
|
return theme.semantics.action.neutral;
|
|
29
39
|
}
|
|
30
40
|
}
|
|
31
|
-
function
|
|
32
|
-
return
|
|
41
|
+
function resolveTextColor(color) {
|
|
42
|
+
return color === 'neutral' ? undefined : color;
|
|
33
43
|
}
|
|
34
44
|
function resolveTextVariant(size) {
|
|
35
45
|
switch (size) {
|
|
@@ -48,17 +58,17 @@ function resolveTextVariant(size) {
|
|
|
48
58
|
function resolveRadius(shape) {
|
|
49
59
|
return shape === 'circle' ? 'full' : 'l';
|
|
50
60
|
}
|
|
51
|
-
function AvatarInner({ themeId: _themeId, mode: _mode, testID, source, name, initials, iconFallback, label, size = 'm', shape = 'circle',
|
|
61
|
+
function AvatarInner({ themeId: _themeId, mode: _mode, testID, source, name, initials, iconFallback, label, size = 'm', shape = 'circle', color = 'neutral', }) {
|
|
52
62
|
const { theme } = useZoraTheme();
|
|
53
63
|
const resolvedSize = AVATAR_SIZES[size];
|
|
54
64
|
const resolvedInitials = initials ?? resolveAvatarInitials(name);
|
|
55
|
-
const role = resolveRoleSemantics(theme,
|
|
56
|
-
const backgroundColor =
|
|
57
|
-
const contentColor =
|
|
65
|
+
const role = resolveRoleSemantics(theme, color);
|
|
66
|
+
const backgroundColor = color === 'neutral' ? theme.semantics.neutral.surface : role.softBg;
|
|
67
|
+
const contentColor = color === 'neutral' ? theme.semantics.content.default : role.base;
|
|
58
68
|
const radius = resolveRadius(shape);
|
|
59
69
|
const renderFallback = () => {
|
|
60
70
|
if (resolvedInitials) {
|
|
61
|
-
return (<Text
|
|
71
|
+
return (<Text color={resolveTextColor(color)} variant={resolveTextVariant(size)} weight="semiBold">
|
|
62
72
|
{resolvedInitials}
|
|
63
73
|
</Text>);
|
|
64
74
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Avatar.js","sourceRoot":"","sources":["../../../src/components/avatar/Avatar.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAErC,OAAO,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AAEvC,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,EAAE,IAAI,
|
|
1
|
+
{"version":3,"file":"Avatar.js","sourceRoot":"","sources":["../../../src/components/avatar/Avatar.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAErC,OAAO,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AAEvC,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,EAAE,IAAI,EAAoB,MAAM,SAAS,CAAC;AACjD,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAGhE,MAAM,YA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AACJ,CAAC;AAED,MAAM,CAAC,MAAM,MAAM,GAAG,kBAAkB,CAAC,WAAW,CAAC,CAAC","sourcesContent":["import type { RoleSemantics, SurfaceTheme } from '@ankhorage/surface';\nimport React from 'react';\nimport { Image } from 'react-native';\n\nimport { Box } from '../../foundation';\nimport type { ZoraColor } from '../../internal/recipes';\nimport { useZoraTheme } from '../../theme/useZoraTheme';\nimport { withZoraThemeScope } from '../../theme/withZoraThemeScope';\nimport { Icon } from '../icon';\nimport { Text, type TextVariant } from '../text';\nimport { resolveAvatarInitials } from './resolveAvatarInitials';\nimport type { AvatarProps, AvatarShape, AvatarSize } from './types';\n\nconst AVATAR_SIZES: Record<AvatarSize, number> = {\n xs: 24,\n s: 32,\n m: 40,\n l: 48,\n xl: 64,\n};\n\nfunction resolveRoleSemantics(theme: SurfaceTheme, color: ZoraColor): RoleSemantics {\n switch (color) {\n case 'secondary':\n return theme.semantics.secondary;\n case 'tertiary':\n return theme.semantics.accent;\n case 'quaternary':\n return theme.semantics.highlight;\n case 'primary':\n return theme.semantics.action.primary;\n case 'error':\n return theme.semantics.error;\n case 'info':\n return theme.semantics.info;\n case 'danger':\n return theme.semantics.action.danger;\n case 'success':\n return theme.semantics.success;\n case 'warning':\n return theme.semantics.warning;\n case 'neutral':\n default:\n return theme.semantics.action.neutral;\n }\n}\n\nfunction resolveTextColor(color: ZoraColor): ZoraColor | undefined {\n return color === 'neutral' ? undefined : color;\n}\n\nfunction resolveTextVariant(size: AvatarSize): TextVariant {\n switch (size) {\n case 'xs':\n case 's':\n return 'caption';\n case 'l':\n return 'bodySmall';\n case 'xl':\n return 'lead';\n case 'm':\n default:\n return 'label';\n }\n}\n\nfunction resolveRadius(shape: AvatarShape): 'full' | 'l' {\n return shape === 'circle' ? 'full' : 'l';\n}\n\nfunction AvatarInner({\n themeId: _themeId,\n mode: _mode,\n testID,\n source,\n name,\n initials,\n iconFallback,\n label,\n size = 'm',\n shape = 'circle',\n color = 'neutral',\n}: AvatarProps) {\n const { theme } = useZoraTheme();\n const resolvedSize = AVATAR_SIZES[size];\n const resolvedInitials = initials ?? resolveAvatarInitials(name);\n const role = resolveRoleSemantics(theme, color);\n const backgroundColor = color === 'neutral' ? theme.semantics.neutral.surface : role.softBg;\n const contentColor = color === 'neutral' ? theme.semantics.content.default : role.base;\n const radius = resolveRadius(shape);\n\n const renderFallback = () => {\n if (resolvedInitials) {\n return (\n <Text color={resolveTextColor(color)} variant={resolveTextVariant(size)} weight=\"semiBold\">\n {resolvedInitials}\n </Text>\n );\n }\n\n if (iconFallback) {\n const iconSize = Math.max(16, Math.round(resolvedSize * 0.48));\n return (\n <Icon\n color={contentColor}\n name={iconFallback.name}\n provider={iconFallback.provider}\n size={iconSize}\n />\n );\n }\n\n return null;\n };\n\n return (\n <Box\n accessibilityLabel={label}\n bg={backgroundColor}\n height={resolvedSize}\n radius={radius}\n testID={testID}\n width={resolvedSize}\n style={{\n alignItems: 'center',\n justifyContent: 'center',\n overflow: 'hidden',\n }}\n >\n {source ? (\n <Image\n accessibilityLabel={label}\n source={source}\n style={{ height: '100%', width: '100%' }}\n />\n ) : (\n renderFallback()\n )}\n </Box>\n );\n}\n\nexport const Avatar = withZoraThemeScope(AvatarInner);\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ButtonIconSpec } from '@ankhorage/surface';
|
|
2
2
|
import type { ImageSourcePropType } from 'react-native';
|
|
3
|
-
import type {
|
|
3
|
+
import type { ZoraColor } from '../../internal/recipes';
|
|
4
4
|
import type { ZoraBaseProps } from '../../theme/ZoraBaseProps';
|
|
5
5
|
export type AvatarSize = 'xs' | 's' | 'm' | 'l' | 'xl';
|
|
6
6
|
export type AvatarShape = 'circle' | 'rounded';
|
|
@@ -12,6 +12,6 @@ export interface AvatarProps extends ZoraBaseProps {
|
|
|
12
12
|
label?: string;
|
|
13
13
|
size?: AvatarSize;
|
|
14
14
|
shape?: AvatarShape;
|
|
15
|
-
|
|
15
|
+
color?: ZoraColor;
|
|
16
16
|
}
|
|
17
17
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/avatar/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAExD,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/avatar/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAExD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAE/D,MAAM,MAAM,UAAU,GAAG,IAAI,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,IAAI,CAAC;AAEvD,MAAM,MAAM,WAAW,GAAG,QAAQ,GAAG,SAAS,CAAC;AAE/C,MAAM,WAAW,WAAY,SAAQ,aAAa;IAChD,MAAM,CAAC,EAAE,mBAAmB,CAAC;IAC7B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,cAAc,CAAC;IAC9B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,KAAK,CAAC,EAAE,SAAS,CAAC;CACnB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/components/avatar/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ButtonIconSpec } from '@ankhorage/surface';\nimport type { ImageSourcePropType } from 'react-native';\n\nimport type {
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/components/avatar/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ButtonIconSpec } from '@ankhorage/surface';\nimport type { ImageSourcePropType } from 'react-native';\n\nimport type { ZoraColor } from '../../internal/recipes';\nimport type { ZoraBaseProps } from '../../theme/ZoraBaseProps';\n\nexport type AvatarSize = 'xs' | 's' | 'm' | 'l' | 'xl';\n\nexport type AvatarShape = 'circle' | 'rounded';\n\nexport interface AvatarProps extends ZoraBaseProps {\n source?: ImageSourcePropType;\n name?: string;\n initials?: string;\n iconFallback?: ButtonIconSpec;\n label?: string;\n size?: AvatarSize;\n shape?: AvatarShape;\n color?: ZoraColor;\n}\n"]}
|
|
@@ -13,12 +13,12 @@ function AvatarGroupInner({ themeId: _themeId, mode: _mode, testID, items, max =
|
|
|
13
13
|
const overlap = size === 'xs' ? 8 : size === 's' ? 10 : size === 'm' ? 12 : size === 'l' ? 14 : 16;
|
|
14
14
|
const borderColor = theme.semantics.surface.default;
|
|
15
15
|
const renderItem = (item, index) => (<Box key={item.id ?? `${index}`} ml={index === 0 ? 0 : -overlap} radius="full" borderWidth={2} borderColor={borderColor}>
|
|
16
|
-
<Avatar iconFallback={item.iconFallback} initials={item.initials} label={item.label} name={item.name} shape={shape} size={size} source={item.source}
|
|
16
|
+
<Avatar iconFallback={item.iconFallback} initials={item.initials} label={item.label} name={item.name} shape={shape} size={size} source={item.source} color={item.color}/>
|
|
17
17
|
</Box>);
|
|
18
18
|
return (<Stack align="center" direction="row" testID={testID} wrap="nowrap">
|
|
19
19
|
{visibleItems.map(renderItem)}
|
|
20
20
|
{overflowCount > 0 ? (<Box ml={visibleItems.length === 0 ? 0 : -overlap} radius="full" borderWidth={2} borderColor={borderColor}>
|
|
21
|
-
<Avatar initials={overflowLabel(overflowCount)} size={size} shape={shape}
|
|
21
|
+
<Avatar initials={overflowLabel(overflowCount)} size={size} shape={shape} color="neutral"/>
|
|
22
22
|
</Box>) : null}
|
|
23
23
|
</Stack>);
|
|
24
24
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AvatarGroup.js","sourceRoot":"","sources":["../../../src/components/avatar-group/AvatarGroup.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAGnC,SAAS,oBAAoB,CAAC,aAAqB;IACjD,OAAO,IAAI,aAAa,EAAE,CAAC;AAC7B,CAAC;AAED,SAAS,gBAAgB,CAAC,EACxB,OAAO,EAAE,QAAQ,EACjB,IAAI,EAAE,KAAK,EACX,MAAM,EACN,KAAK,EACL,GAAG,GAAG,CAAC,EACP,IAAI,GAAG,GAAG,EACV,KAAK,GAAG,QAAQ,EAChB,aAAa,GAAG,oBAAoB,GACnB;IACjB,MAAM,EAAE,KAAK,EAAE,GAAG,YAAY,EAAE,CAAC;IAEjC,MAAM,YAAY,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IACzC,MAAM,aAAa,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC;IACtE,MAAM,OAAO,GACX,IAAI,KAAK,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,KAAK,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAA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raTheme';\nimport { withZoraThemeScope } from '../../theme/withZoraThemeScope';\nimport { Avatar } from '../avatar';\nimport type { AvatarGroupItem, AvatarGroupProps } from './types';\n\nfunction defaultOverflowLabel(overflowCount: number): string {\n return `+${overflowCount}`;\n}\n\nfunction AvatarGroupInner({\n themeId: _themeId,\n mode: _mode,\n testID,\n items,\n max = 4,\n size = 's',\n shape = 'circle',\n overflowLabel = defaultOverflowLabel,\n}: AvatarGroupProps) {\n const { theme } = useZoraTheme();\n\n const visibleItems = items.slice(0, max);\n const overflowCount = Math.max(0, items.length - visibleItems.length);\n const overlap =\n size === 'xs' ? 8 : size === 's' ? 10 : size === 'm' ? 12 : size === 'l' ? 14 : 16;\n const borderColor = theme.semantics.surface.default;\n\n const renderItem = (item: AvatarGroupItem, index: number) => (\n <Box\n key={item.id ?? `${index}`}\n ml={index === 0 ? 0 : -overlap}\n radius=\"full\"\n borderWidth={2}\n borderColor={borderColor}\n >\n <Avatar\n iconFallback={item.iconFallback}\n initials={item.initials}\n label={item.label}\n name={item.name}\n shape={shape}\n size={size}\n source={item.source}\n color={item.color}\n />\n </Box>\n );\n\n return (\n <Stack align=\"center\" direction=\"row\" testID={testID} wrap=\"nowrap\">\n {visibleItems.map(renderItem)}\n {overflowCount > 0 ? (\n <Box\n ml={visibleItems.length === 0 ? 0 : -overlap}\n radius=\"full\"\n borderWidth={2}\n borderColor={borderColor}\n >\n <Avatar\n initials={overflowLabel(overflowCount)}\n size={size}\n shape={shape}\n color=\"neutral\"\n />\n </Box>\n ) : null}\n </Stack>\n );\n}\n\nexport const AvatarGroup = withZoraThemeScope(AvatarGroupInner);\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ButtonIconSpec } from '@ankhorage/surface';
|
|
2
2
|
import type { ImageSourcePropType } from 'react-native';
|
|
3
|
-
import type {
|
|
3
|
+
import type { ZoraColor } from '../../internal/recipes';
|
|
4
4
|
import type { ZoraBaseProps } from '../../theme/ZoraBaseProps';
|
|
5
5
|
import type { AvatarShape, AvatarSize } from '../avatar';
|
|
6
6
|
export interface AvatarGroupItem {
|
|
@@ -10,7 +10,7 @@ export interface AvatarGroupItem {
|
|
|
10
10
|
initials?: string;
|
|
11
11
|
iconFallback?: ButtonIconSpec;
|
|
12
12
|
label?: string;
|
|
13
|
-
|
|
13
|
+
color?: ZoraColor;
|
|
14
14
|
}
|
|
15
15
|
export interface AvatarGroupProps extends ZoraBaseProps {
|
|
16
16
|
items: readonly AvatarGroupItem[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/avatar-group/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAExD,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/avatar-group/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAExD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAEzD,MAAM,WAAW,eAAe;IAC9B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE,mBAAmB,CAAC;IAC7B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,cAAc,CAAC;IAC9B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,SAAS,CAAC;CACnB;AAED,MAAM,WAAW,gBAAiB,SAAQ,aAAa;IACrD,KAAK,EAAE,SAAS,eAAe,EAAE,CAAC;IAClC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,aAAa,CAAC,EAAE,CAAC,aAAa,EAAE,MAAM,KAAK,MAAM,CAAC;CACnD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/components/avatar-group/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ButtonIconSpec } from '@ankhorage/surface';\nimport type { ImageSourcePropType } from 'react-native';\n\nimport type {
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/components/avatar-group/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ButtonIconSpec } from '@ankhorage/surface';\nimport type { ImageSourcePropType } from 'react-native';\n\nimport type { ZoraColor } from '../../internal/recipes';\nimport type { ZoraBaseProps } from '../../theme/ZoraBaseProps';\nimport type { AvatarShape, AvatarSize } from '../avatar';\n\nexport interface AvatarGroupItem {\n id?: string;\n source?: ImageSourcePropType;\n name?: string;\n initials?: string;\n iconFallback?: ButtonIconSpec;\n label?: string;\n color?: ZoraColor;\n}\n\nexport interface AvatarGroupProps extends ZoraBaseProps {\n items: readonly AvatarGroupItem[];\n max?: number;\n size?: AvatarSize;\n shape?: AvatarShape;\n overflowLabel?: (overflowCount: number) => string;\n}\n"]}
|
|
@@ -2,9 +2,9 @@ import { Badge as SurfaceBadge } from '@ankhorage/surface';
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { resolveBadgeRecipe } from '../../internal/recipes';
|
|
4
4
|
import { withZoraThemeScope } from '../../theme/withZoraThemeScope';
|
|
5
|
-
function BadgeInner({ themeId: _themeId, mode: _mode, children,
|
|
6
|
-
const recipe = resolveBadgeRecipe({
|
|
7
|
-
return (<SurfaceBadge {...props} content={children}
|
|
5
|
+
function BadgeInner({ themeId: _themeId, mode: _mode, children, color, variant, size, ...props }) {
|
|
6
|
+
const recipe = resolveBadgeRecipe({ color, variant, size });
|
|
7
|
+
return (<SurfaceBadge {...props} content={children} color={recipe.color} size={recipe.size} variant={recipe.variant}/>);
|
|
8
8
|
}
|
|
9
9
|
export const Badge = withZoraThemeScope(BadgeInner);
|
|
10
10
|
//# sourceMappingURL=Badge.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Badge.js","sourceRoot":"","sources":["../../../src/components/badge/Badge.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,IAAI,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAGpE,SAAS,UAAU,CAAC,EAClB,OAAO,EAAE,QAAQ,EACjB,IAAI,EAAE,KAAK,EACX,QAAQ,EACR,
|
|
1
|
+
{"version":3,"file":"Badge.js","sourceRoot":"","sources":["../../../src/components/badge/Badge.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,IAAI,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAGpE,SAAS,UAAU,CAAC,EAClB,OAAO,EAAE,QAAQ,EACjB,IAAI,EAAE,KAAK,EACX,QAAQ,EACR,KAAK,EACL,OAAO,EACP,IAAI,EACJ,GAAG,KAAK,EACG;IACX,MAAM,MAAM,GAAG,kBAAkB,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;IAE5D,OAAO,CACL,CAAC,YAAY,CACX,IAAI,KAAK,CAAC,CACV,OAAO,CAAC,CAAC,QAAQ,CAAC,CAClB,KAAK,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CACpB,IAAI,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAClB,OAAO,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,EACxB,CACH,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,KAAK,GAAG,kBAAkB,CAAC,UAAU,CAAC,CAAC","sourcesContent":["import { Badge as SurfaceBadge } from '@ankhorage/surface';\nimport React from 'react';\n\nimport { resolveBadgeRecipe } from '../../internal/recipes';\nimport { withZoraThemeScope } from '../../theme/withZoraThemeScope';\nimport type { BadgeProps } from './types';\n\nfunction BadgeInner({\n themeId: _themeId,\n mode: _mode,\n children,\n color,\n variant,\n size,\n ...props\n}: BadgeProps) {\n const recipe = resolveBadgeRecipe({ color, variant, size });\n\n return (\n <SurfaceBadge\n {...props}\n content={children}\n color={recipe.color}\n size={recipe.size}\n variant={recipe.variant}\n />\n );\n}\n\nexport const Badge = withZoraThemeScope(BadgeInner);\n"]}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { BadgeProps as SurfaceBadgeProps } from '@ankhorage/surface';
|
|
2
2
|
import type React from 'react';
|
|
3
|
-
import type {
|
|
3
|
+
import type { ZoraBadgeVariant, ZoraColor, ZoraControlSize } from '../../internal/recipes';
|
|
4
4
|
import type { ZoraBaseProps } from '../../theme/ZoraBaseProps';
|
|
5
|
-
export interface BadgeProps extends ZoraBaseProps, Omit<SurfaceBadgeProps, 'content' | 'size' | '
|
|
5
|
+
export interface BadgeProps extends ZoraBaseProps, Omit<SurfaceBadgeProps, 'content' | 'size' | 'color' | 'variant' | 'mode' | 'themeId'> {
|
|
6
6
|
children?: React.ReactNode;
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
color?: ZoraColor;
|
|
8
|
+
variant?: ZoraBadgeVariant;
|
|
9
9
|
size?: ZoraControlSize;
|
|
10
10
|
}
|
|
11
11
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/badge/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,IAAI,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAC1E,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/badge/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,IAAI,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAC1E,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,gBAAgB,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAC3F,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAE/D,MAAM,WAAW,UACf,SACE,aAAa,EACb,IAAI,CAAC,iBAAiB,EAAE,SAAS,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAAC;IACxF,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,OAAO,CAAC,EAAE,gBAAgB,CAAC;IAC3B,IAAI,CAAC,EAAE,eAAe,CAAC;CACxB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/components/badge/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { BadgeProps as SurfaceBadgeProps } from '@ankhorage/surface';\nimport type React from 'react';\n\nimport type {
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/components/badge/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { BadgeProps as SurfaceBadgeProps } from '@ankhorage/surface';\nimport type React from 'react';\n\nimport type { ZoraBadgeVariant, ZoraColor, ZoraControlSize } from '../../internal/recipes';\nimport type { ZoraBaseProps } from '../../theme/ZoraBaseProps';\n\nexport interface BadgeProps\n extends\n ZoraBaseProps,\n Omit<SurfaceBadgeProps, 'content' | 'size' | 'color' | 'variant' | 'mode' | 'themeId'> {\n children?: React.ReactNode;\n color?: ZoraColor;\n variant?: ZoraBadgeVariant;\n size?: ZoraControlSize;\n}\n"]}
|
|
@@ -2,9 +2,9 @@ import { Button as SurfaceButton } from '@ankhorage/surface';
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { resolveButtonRecipe } from '../../internal/recipes';
|
|
4
4
|
import { withZoraThemeScope } from '../../theme/withZoraThemeScope';
|
|
5
|
-
function ButtonInner({ themeId: _themeId, mode: _mode,
|
|
6
|
-
const recipe = resolveButtonRecipe({
|
|
7
|
-
return (<SurfaceButton {...props}
|
|
5
|
+
function ButtonInner({ themeId: _themeId, mode: _mode, color, variant, size, ...props }) {
|
|
6
|
+
const recipe = resolveButtonRecipe({ color, variant, size });
|
|
7
|
+
return (<SurfaceButton {...props} color={recipe.color} size={recipe.size} variant={recipe.variant}/>);
|
|
8
8
|
}
|
|
9
9
|
export const Button = withZoraThemeScope(ButtonInner);
|
|
10
10
|
//# sourceMappingURL=Button.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.js","sourceRoot":"","sources":["../../../src/components/button/Button.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAGpE,SAAS,WAAW,CAAC,EACnB,OAAO,EAAE,QAAQ,EACjB,IAAI,EAAE,KAAK,EACX,
|
|
1
|
+
{"version":3,"file":"Button.js","sourceRoot":"","sources":["../../../src/components/button/Button.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAGpE,SAAS,WAAW,CAAC,EACnB,OAAO,EAAE,QAAQ,EACjB,IAAI,EAAE,KAAK,EACX,KAAK,EACL,OAAO,EACP,IAAI,EACJ,GAAG,KAAK,EACI;IACZ,MAAM,MAAM,GAAG,mBAAmB,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;IAE7D,OAAO,CACL,CAAC,aAAa,CAAC,IAAI,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,EAAG,CAC9F,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,MAAM,GAAG,kBAAkB,CAAC,WAAW,CAAC,CAAC","sourcesContent":["import { Button as SurfaceButton } from '@ankhorage/surface';\nimport React from 'react';\n\nimport { resolveButtonRecipe } from '../../internal/recipes';\nimport { withZoraThemeScope } from '../../theme/withZoraThemeScope';\nimport type { ButtonProps } from './types';\n\nfunction ButtonInner({\n themeId: _themeId,\n mode: _mode,\n color,\n variant,\n size,\n ...props\n}: ButtonProps) {\n const recipe = resolveButtonRecipe({ color, variant, size });\n\n return (\n <SurfaceButton {...props} color={recipe.color} size={recipe.size} variant={recipe.variant} />\n );\n}\n\nexport const Button = withZoraThemeScope(ButtonInner);\n"]}
|
|
@@ -7,8 +7,8 @@ export declare const buttonMeta: {
|
|
|
7
7
|
readonly label: "Button";
|
|
8
8
|
readonly defaultProps: {
|
|
9
9
|
readonly children: "Continue";
|
|
10
|
-
readonly
|
|
11
|
-
readonly
|
|
10
|
+
readonly color: "primary";
|
|
11
|
+
readonly variant: "solid";
|
|
12
12
|
readonly size: "m";
|
|
13
13
|
};
|
|
14
14
|
};
|
|
@@ -19,17 +19,17 @@ export declare const buttonMeta: {
|
|
|
19
19
|
readonly label: "Label";
|
|
20
20
|
readonly default: "Continue";
|
|
21
21
|
};
|
|
22
|
-
readonly
|
|
22
|
+
readonly color: {
|
|
23
23
|
readonly type: "enum";
|
|
24
24
|
readonly category: "Style";
|
|
25
|
-
readonly label: "
|
|
26
|
-
readonly enum: readonly ["primary", "
|
|
25
|
+
readonly label: "Color";
|
|
26
|
+
readonly enum: readonly ["primary", "secondary", "tertiary", "quaternary", "neutral", "success", "warning", "error", "info", "danger"];
|
|
27
27
|
readonly default: "primary";
|
|
28
28
|
};
|
|
29
|
-
readonly
|
|
29
|
+
readonly variant: {
|
|
30
30
|
readonly type: "enum";
|
|
31
31
|
readonly category: "Style";
|
|
32
|
-
readonly label: "
|
|
32
|
+
readonly label: "Variant";
|
|
33
33
|
readonly enum: readonly ["solid", "outline", "ghost", "soft"];
|
|
34
34
|
readonly default: "solid";
|
|
35
35
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"meta.d.ts","sourceRoot":"","sources":["../../../src/components/button/meta.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"meta.d.ts","sourceRoot":"","sources":["../../../src/components/button/meta.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2Ce,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ZORA_COLORS } from '../../internal/colorModel';
|
|
1
2
|
export const buttonMeta = {
|
|
2
3
|
name: 'Button',
|
|
3
4
|
category: 'component',
|
|
@@ -7,8 +8,8 @@ export const buttonMeta = {
|
|
|
7
8
|
label: 'Button',
|
|
8
9
|
defaultProps: {
|
|
9
10
|
children: 'Continue',
|
|
10
|
-
|
|
11
|
-
|
|
11
|
+
color: 'primary',
|
|
12
|
+
variant: 'solid',
|
|
12
13
|
size: 'm',
|
|
13
14
|
},
|
|
14
15
|
},
|
|
@@ -19,17 +20,17 @@ export const buttonMeta = {
|
|
|
19
20
|
label: 'Label',
|
|
20
21
|
default: 'Continue',
|
|
21
22
|
},
|
|
22
|
-
|
|
23
|
+
color: {
|
|
23
24
|
type: 'enum',
|
|
24
25
|
category: 'Style',
|
|
25
|
-
label: '
|
|
26
|
-
enum: [
|
|
26
|
+
label: 'Color',
|
|
27
|
+
enum: [...ZORA_COLORS],
|
|
27
28
|
default: 'primary',
|
|
28
29
|
},
|
|
29
|
-
|
|
30
|
+
variant: {
|
|
30
31
|
type: 'enum',
|
|
31
32
|
category: 'Style',
|
|
32
|
-
label: '
|
|
33
|
+
label: 'Variant',
|
|
33
34
|
enum: ['solid', 'outline', 'ghost', 'soft'],
|
|
34
35
|
default: 'solid',
|
|
35
36
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"meta.js","sourceRoot":"","sources":["../../../src/components/button/meta.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"meta.js","sourceRoot":"","sources":["../../../src/components/button/meta.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAGxD,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,IAAI,EAAE,QAAQ;IACd,QAAQ,EAAE,WAAW;IACrB,kBAAkB,EAAE,IAAI;IACxB,eAAe,EAAE,EAAE;IACnB,SAAS,EAAE;QACT,KAAK,EAAE,QAAQ;QACf,YAAY,EAAE;YACZ,QAAQ,EAAE,UAAU;YACpB,KAAK,EAAE,SAAS;YAChB,OAAO,EAAE,OAAO;YAChB,IAAI,EAAE,GAAG;SACV;KACF;IACD,KAAK,EAAE;QACL,QAAQ,EAAE;YACR,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,SAAS;YACnB,KAAK,EAAE,OAAO;YACd,OAAO,EAAE,UAAU;SACpB;QACD,KAAK,EAAE;YACL,IAAI,EAAE,MAAM;YACZ,QAAQ,EAAE,OAAO;YACjB,KAAK,EAAE,OAAO;YACd,IAAI,EAAE,CAAC,GAAG,WAAW,CAAC;YACtB,OAAO,EAAE,SAAS;SACnB;QACD,OAAO,EAAE;YACP,IAAI,EAAE,MAAM;YACZ,QAAQ,EAAE,OAAO;YACjB,KAAK,EAAE,SAAS;YAChB,IAAI,EAAE,CAAC,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,CAAC;YAC3C,OAAO,EAAE,OAAO;SACjB;QACD,IAAI,EAAE;YACJ,IAAI,EAAE,MAAM;YACZ,QAAQ,EAAE,OAAO;YACjB,KAAK,EAAE,MAAM;YACb,IAAI,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC;YACrB,OAAO,EAAE,GAAG;SACb;KACF;CACmC,CAAC","sourcesContent":["import { ZORA_COLORS } from '../../internal/colorModel';\nimport type { ZoraComponentMeta } from '../../metadata';\n\nexport const buttonMeta = {\n name: 'Button',\n category: 'component',\n directManifestNode: true,\n allowedChildren: [],\n blueprint: {\n label: 'Button',\n defaultProps: {\n children: 'Continue',\n color: 'primary',\n variant: 'solid',\n size: 'm',\n },\n },\n props: {\n children: {\n type: 'string',\n category: 'Content',\n label: 'Label',\n default: 'Continue',\n },\n color: {\n type: 'enum',\n category: 'Style',\n label: 'Color',\n enum: [...ZORA_COLORS],\n default: 'primary',\n },\n variant: {\n type: 'enum',\n category: 'Style',\n label: 'Variant',\n enum: ['solid', 'outline', 'ghost', 'soft'],\n default: 'solid',\n },\n size: {\n type: 'enum',\n category: 'Style',\n label: 'Size',\n enum: ['s', 'm', 'l'],\n default: 'm',\n },\n },\n} as const satisfies ZoraComponentMeta;\n"]}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { ButtonIconSpec, ButtonProps as SurfaceButtonProps } from '@ankhorage/surface';
|
|
2
2
|
import type React from 'react';
|
|
3
|
-
import type {
|
|
3
|
+
import type { ZoraButtonVariant, ZoraColor, ZoraControlSize } from '../../internal/recipes';
|
|
4
4
|
import type { ZoraBaseProps } from '../../theme/ZoraBaseProps';
|
|
5
|
-
export interface ButtonProps extends ZoraBaseProps, Omit<SurfaceButtonProps, 'children' | 'size' | '
|
|
5
|
+
export interface ButtonProps extends ZoraBaseProps, Omit<SurfaceButtonProps, 'children' | 'size' | 'color' | 'variant'> {
|
|
6
6
|
children?: React.ReactNode;
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
color?: ZoraColor;
|
|
8
|
+
variant?: ZoraButtonVariant;
|
|
9
9
|
size?: ZoraControlSize;
|
|
10
10
|
leadingIcon?: ButtonIconSpec;
|
|
11
11
|
trailingIcon?: ButtonIconSpec;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/button/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,IAAI,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAC5F,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/button/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,IAAI,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAC5F,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,iBAAiB,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAC5F,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAE/D,MAAM,WAAW,WACf,SAAQ,aAAa,EAAE,IAAI,CAAC,kBAAkB,EAAE,UAAU,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC;IAC1F,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,OAAO,CAAC,EAAE,iBAAiB,CAAC;IAC5B,IAAI,CAAC,EAAE,eAAe,CAAC;IACvB,WAAW,CAAC,EAAE,cAAc,CAAC;IAC7B,YAAY,CAAC,EAAE,cAAc,CAAC;CAC/B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/components/button/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ButtonIconSpec, ButtonProps as SurfaceButtonProps } from '@ankhorage/surface';\nimport type React from 'react';\n\nimport type {
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/components/button/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ButtonIconSpec, ButtonProps as SurfaceButtonProps } from '@ankhorage/surface';\nimport type React from 'react';\n\nimport type { ZoraButtonVariant, ZoraColor, ZoraControlSize } from '../../internal/recipes';\nimport type { ZoraBaseProps } from '../../theme/ZoraBaseProps';\n\nexport interface ButtonProps\n extends ZoraBaseProps, Omit<SurfaceButtonProps, 'children' | 'size' | 'color' | 'variant'> {\n children?: React.ReactNode;\n color?: ZoraColor;\n variant?: ZoraButtonVariant;\n size?: ZoraControlSize;\n leadingIcon?: ButtonIconSpec;\n trailingIcon?: ButtonIconSpec;\n}\n"]}
|
|
@@ -15,11 +15,11 @@ function CardInner({ themeId: _themeId, mode: _mode, children, title, descriptio
|
|
|
15
15
|
{hasHeader ? (<Stack align={{ base: 'flex-start', md: 'center' }} direction={{ base: 'column', md: 'row' }} gap="m" justify="space-between">
|
|
16
16
|
<Box flex={{ md: 1 }} width={{ base: '100%', md: 'auto' }}>
|
|
17
17
|
<Stack gap="xs">
|
|
18
|
-
{eyebrow ? (<Text
|
|
18
|
+
{eyebrow ? (<Text emphasis="muted" variant="caption" weight="semiBold">
|
|
19
19
|
{eyebrow}
|
|
20
20
|
</Text>) : null}
|
|
21
21
|
{title ? <Heading level={compact ? 4 : 3}>{title}</Heading> : null}
|
|
22
|
-
{description ? (<Text
|
|
22
|
+
{description ? (<Text emphasis="muted" variant="bodySmall">
|
|
23
23
|
{description}
|
|
24
24
|
</Text>) : null}
|
|
25
25
|
</Stack>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Card.js","sourceRoot":"","sources":["../../../src/components/card/Card.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,IAAI,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAG/B,SAAS,SAAS,CAAC,EACjB,OAAO,EAAE,QAAQ,EACjB,IAAI,EAAE,KAAK,EACX,QAAQ,EACR,KAAK,EACL,WAAW,EACX,OAAO,EACP,OAAO,EACP,MAAM,EACN,IAAI,GAAG,SAAS,EAChB,OAAO,GAAG,KAAK,EACf,OAAO,EACP,GAAG,KAAK,EACE;IACV,MAAM,SAAS,GAAG,CAAC,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,IAAI,IAAI,CAAC,CAAC;IACtF,MAAM,SAAS,GAAG,MAAM,KAAK,SAAS,CAAC;IACvC,MAAM,GAAG,GAAG,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC;IAChC,MAAM,aAAa,GAAG,OAAO,CAAC,OAA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Q,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAExC;;QAAA,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CACjD;MAAA,EAAE,KAAK,CACT;IAAA,EAAE,WAAW,CAAC,CACf,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,IAAI,GAAG,kBAAkB,CAAC,SAAS,CAAC,CAAC","sourcesContent":["import { Card as SurfaceCard } from '@ankhorage/surface';\nimport React from 'react';\n\nimport { Box, Stack } from '../../foundation';\nimport { resolveCardVariant } from '../../internal/recipes';\nimport { withZoraThemeScope } from '../../theme/withZoraThemeScope';\nimport { Heading } from '../heading';\nimport { Text } from '../text';\nimport type { CardProps } from './types';\n\nfunction CardInner({\n themeId: _themeId,\n mode: _mode,\n children,\n title,\n description,\n eyebrow,\n actions,\n footer,\n tone = 'default',\n compact = false,\n onPress,\n ...props\n}: CardProps) {\n const hasHeader = [eyebrow, title, description, actions].some((item) => item != null);\n const hasFooter = footer !== undefined;\n const gap = compact ? 's' : 'm';\n const isInteractive = Boolean(onPress) && !actions;\n\n return (\n <SurfaceCard\n {...props}\n onPress={isInteractive ? onPress : undefined}\n p={compact ? 'm' : 'l'}\n radius=\"l\"\n variant={resolveCardVariant(tone)}\n >\n <Stack gap={gap}>\n {hasHeader ? (\n <Stack\n align={{ base: 'flex-start', md: 'center' }}\n direction={{ base: 'column', md: 'row' }}\n gap=\"m\"\n justify=\"space-between\"\n >\n <Box flex={{ md: 1 }} width={{ base: '100%', md: 'auto' }}>\n <Stack gap=\"xs\">\n {eyebrow ? (\n <Text emphasis=\"muted\" variant=\"caption\" weight=\"semiBold\">\n {eyebrow}\n </Text>\n ) : null}\n {title ? <Heading level={compact ? 4 : 3}>{title}</Heading> : null}\n {description ? (\n <Text emphasis=\"muted\" variant=\"bodySmall\">\n {description}\n </Text>\n ) : null}\n </Stack>\n </Box>\n {actions ? <Box>{actions}</Box> : null}\n </Stack>\n ) : null}\n\n {children ? <Box>{children}</Box> : null}\n\n {hasFooter ? <Box pt=\"xs\">{footer}</Box> : null}\n </Stack>\n </SurfaceCard>\n );\n}\n\nexport const Card = withZoraThemeScope(CardInner);\n"]}
|
|
@@ -4,7 +4,7 @@ import { View } from 'react-native';
|
|
|
4
4
|
import { Stack } from '../../foundation';
|
|
5
5
|
import { withZoraThemeScope } from '../../theme/withZoraThemeScope';
|
|
6
6
|
import { Text } from '../text';
|
|
7
|
-
function CheckboxGroupInner({ themeId: _themeId, mode: _mode, value, onValueChange, options, orientation = 'vertical', gap = 's',
|
|
7
|
+
function CheckboxGroupInner({ themeId: _themeId, mode: _mode, value, onValueChange, options, orientation = 'vertical', gap = 's', color = 'primary', size = 'm', invalid = false, readOnly = false, disabled = false, testID, }) {
|
|
8
8
|
const selectedValues = new Set(value);
|
|
9
9
|
const isHorizontal = orientation === 'horizontal';
|
|
10
10
|
return (<View testID={testID} style={{
|
|
@@ -12,13 +12,13 @@ function CheckboxGroupInner({ themeId: _themeId, mode: _mode, value, onValueChan
|
|
|
12
12
|
flexWrap: isHorizontal ? 'wrap' : 'nowrap',
|
|
13
13
|
}}>
|
|
14
14
|
<Stack direction={isHorizontal ? 'row' : 'column'} gap={gap} wrap={isHorizontal ? 'wrap' : 'nowrap'}>
|
|
15
|
-
{options.map((option) => (<CheckboxGroupItem key={option.value} option={option} checked={selectedValues.has(option.value)} disabled={disabled || option.disabled === true} invalid={invalid} readOnly={readOnly} size={size}
|
|
15
|
+
{options.map((option) => (<CheckboxGroupItem key={option.value} option={option} checked={selectedValues.has(option.value)} disabled={disabled || option.disabled === true} invalid={invalid} readOnly={readOnly} size={size} color={color} value={value} onValueChange={onValueChange}/>))}
|
|
16
16
|
</Stack>
|
|
17
17
|
</View>);
|
|
18
18
|
}
|
|
19
19
|
export const CheckboxGroup = withZoraThemeScope(CheckboxGroupInner);
|
|
20
|
-
function CheckboxGroupItem({ option, checked, disabled, invalid, readOnly, size,
|
|
21
|
-
return (<Checkbox checked={checked} disabled={disabled} invalid={invalid} readOnly={readOnly} size={size}
|
|
20
|
+
function CheckboxGroupItem({ option, checked, disabled, invalid, readOnly, size, color, value, onValueChange, }) {
|
|
21
|
+
return (<Checkbox checked={checked} disabled={disabled} invalid={invalid} readOnly={readOnly} size={size} color={color} testID={option.testID} onCheckedChange={(nextChecked) => {
|
|
22
22
|
const nextValue = nextChecked
|
|
23
23
|
? [...value, option.value]
|
|
24
24
|
: value.filter((currentValue) => currentValue !== option.value);
|
|
@@ -26,7 +26,7 @@ function CheckboxGroupItem({ option, checked, disabled, invalid, readOnly, size,
|
|
|
26
26
|
}}>
|
|
27
27
|
<Stack gap="xs">
|
|
28
28
|
<Text>{option.label}</Text>
|
|
29
|
-
{option.description ? (<Text
|
|
29
|
+
{option.description ? (<Text emphasis="muted" variant="caption">
|
|
30
30
|
{option.description}
|
|
31
31
|
</Text>) : null}
|
|
32
32
|
</Stack>
|