@ankhorage/zora 2.11.0 → 2.13.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 +12 -0
- package/README.md +2 -2
- package/dist/components/button/Button.d.ts.map +1 -1
- package/dist/components/button/Button.js +4 -2
- package/dist/components/button/Button.js.map +1 -1
- package/dist/components/button/meta.d.ts +3 -6
- package/dist/components/button/meta.d.ts.map +1 -1
- package/dist/components/button/meta.js +9 -15
- package/dist/components/button/meta.js.map +1 -1
- package/dist/components/button/resolveButtonThemeRecipe.d.ts +9 -0
- package/dist/components/button/resolveButtonThemeRecipe.d.ts.map +1 -0
- package/dist/components/button/resolveButtonThemeRecipe.js +30 -0
- package/dist/components/button/resolveButtonThemeRecipe.js.map +1 -0
- package/dist/components/button/themeRecipeMeta.d.ts +4 -10
- package/dist/components/button/themeRecipeMeta.d.ts.map +1 -1
- package/dist/components/button/themeRecipeMeta.js +5 -10
- package/dist/components/button/themeRecipeMeta.js.map +1 -1
- package/dist/components/card/Card.d.ts.map +1 -1
- package/dist/components/card/Card.js +8 -4
- package/dist/components/card/Card.js.map +1 -1
- package/dist/components/card/meta.d.ts +22 -3
- package/dist/components/card/meta.d.ts.map +1 -1
- package/dist/components/card/meta.js +14 -15
- package/dist/components/card/meta.js.map +1 -1
- package/dist/components/card/resolveCardThemeRecipe.d.ts +15 -0
- package/dist/components/card/resolveCardThemeRecipe.d.ts.map +1 -0
- package/dist/components/card/resolveCardThemeRecipe.js +22 -0
- package/dist/components/card/resolveCardThemeRecipe.js.map +1 -0
- package/dist/components/card/themeRecipeMeta.d.ts +1 -1
- package/dist/components/card/themeRecipeMeta.js +1 -1
- package/dist/components/card/themeRecipeMeta.js.map +1 -1
- package/dist/components/card/types.d.ts +2 -0
- package/dist/components/card/types.d.ts.map +1 -1
- package/dist/components/card/types.js.map +1 -1
- package/dist/components/heading/Heading.d.ts.map +1 -1
- package/dist/components/heading/Heading.js +14 -15
- package/dist/components/heading/Heading.js.map +1 -1
- package/dist/components/heading/meta.d.ts +6 -1
- package/dist/components/heading/meta.d.ts.map +1 -1
- package/dist/components/heading/meta.js +13 -22
- package/dist/components/heading/meta.js.map +1 -1
- package/dist/components/heading/resolveHeadingThemeRecipe.d.ts +11 -0
- package/dist/components/heading/resolveHeadingThemeRecipe.d.ts.map +1 -0
- package/dist/components/heading/resolveHeadingThemeRecipe.js +46 -0
- package/dist/components/heading/resolveHeadingThemeRecipe.js.map +1 -0
- package/dist/components/heading/themeRecipeMeta.d.ts +39 -0
- package/dist/components/heading/themeRecipeMeta.d.ts.map +1 -0
- package/dist/components/heading/themeRecipeMeta.js +32 -0
- package/dist/components/heading/themeRecipeMeta.js.map +1 -0
- package/dist/components/image/meta.d.ts +24 -3
- package/dist/components/image/meta.d.ts.map +1 -1
- package/dist/components/image/meta.js +18 -3
- package/dist/components/image/meta.js.map +1 -1
- package/dist/components/text/Text.d.ts +0 -1
- package/dist/components/text/Text.d.ts.map +1 -1
- package/dist/components/text/Text.js +14 -16
- package/dist/components/text/Text.js.map +1 -1
- package/dist/components/text/meta.d.ts +6 -5
- package/dist/components/text/meta.d.ts.map +1 -1
- package/dist/components/text/meta.js +13 -25
- package/dist/components/text/meta.js.map +1 -1
- package/dist/components/text/resolveTextThemeRecipe.d.ts +11 -0
- package/dist/components/text/resolveTextThemeRecipe.d.ts.map +1 -0
- package/dist/components/text/resolveTextThemeRecipe.js +46 -0
- package/dist/components/text/resolveTextThemeRecipe.js.map +1 -0
- package/dist/components/text/themeRecipeMeta.d.ts +15 -7
- package/dist/components/text/themeRecipeMeta.d.ts.map +1 -1
- package/dist/components/text/themeRecipeMeta.js +12 -11
- package/dist/components/text/themeRecipeMeta.js.map +1 -1
- package/dist/metadata/bindableComponentMeta.d.ts +22 -7
- package/dist/metadata/bindableComponentMeta.d.ts.map +1 -1
- package/dist/metadata/bindableComponentMeta.js +3 -13
- package/dist/metadata/bindableComponentMeta.js.map +1 -1
- package/dist/metadata/themeRecipeMeta.d.ts.map +1 -1
- package/dist/metadata/themeRecipeMeta.js +2 -0
- package/dist/metadata/themeRecipeMeta.js.map +1 -1
- package/dist/metadata/themeRecipeTypes.d.ts +3 -3
- package/dist/metadata/themeRecipeTypes.d.ts.map +1 -1
- package/dist/metadata/themeRecipeTypes.js.map +1 -1
- package/dist/metadata/types.d.ts +4 -2
- package/dist/metadata/types.d.ts.map +1 -1
- package/dist/metadata/types.js.map +1 -1
- package/dist/patterns/panel/Panel.d.ts +0 -2
- package/dist/patterns/panel/Panel.d.ts.map +1 -1
- package/dist/patterns/panel/Panel.js +6 -4
- package/dist/patterns/panel/Panel.js.map +1 -1
- package/dist/patterns/panel/meta.d.ts +22 -3
- package/dist/patterns/panel/meta.d.ts.map +1 -1
- package/dist/patterns/panel/meta.js +14 -15
- package/dist/patterns/panel/meta.js.map +1 -1
- package/dist/patterns/panel/themeRecipeMeta.d.ts +1 -1
- package/dist/patterns/panel/themeRecipeMeta.js +1 -1
- package/dist/patterns/panel/themeRecipeMeta.js.map +1 -1
- package/dist/patterns/panel/types.d.ts +2 -0
- package/dist/patterns/panel/types.d.ts.map +1 -1
- package/dist/patterns/panel/types.js.map +1 -1
- package/dist/theme/ZoraProvider.d.ts +4 -12
- package/dist/theme/ZoraProvider.d.ts.map +1 -1
- package/dist/theme/ZoraProvider.js +5 -14
- package/dist/theme/ZoraProvider.js.map +1 -1
- package/dist/theme/ZoraThemeRuntimeContext.d.ts +1 -2
- package/dist/theme/ZoraThemeRuntimeContext.d.ts.map +1 -1
- package/dist/theme/ZoraThemeRuntimeContext.js +0 -1
- package/dist/theme/ZoraThemeRuntimeContext.js.map +1 -1
- package/dist/theme/ZoraThemeScope.d.ts.map +1 -1
- package/dist/theme/ZoraThemeScope.js +4 -10
- package/dist/theme/ZoraThemeScope.js.map +1 -1
- package/dist/theme/resolveZoraThemeRecipe.d.ts +16 -0
- package/dist/theme/resolveZoraThemeRecipe.d.ts.map +1 -0
- package/dist/theme/resolveZoraThemeRecipe.js +56 -0
- package/dist/theme/resolveZoraThemeRecipe.js.map +1 -0
- package/dist/theme/useZoraTheme.d.ts +1 -1
- package/dist/theme/useZoraThemeRecipe.d.ts +2 -0
- package/dist/theme/useZoraThemeRecipe.d.ts.map +1 -0
- package/dist/theme/useZoraThemeRecipe.js +7 -0
- package/dist/theme/useZoraThemeRecipe.js.map +1 -0
- package/package.json +4 -4
- package/src/components/button/Button.tsx +4 -2
- package/src/components/button/meta.ts +10 -15
- package/src/components/button/resolveButtonThemeRecipe.test.ts +25 -0
- package/src/components/button/resolveButtonThemeRecipe.ts +41 -0
- package/src/components/button/themeRecipeMeta.ts +5 -10
- package/src/components/card/Card.tsx +13 -7
- package/src/components/card/meta.ts +15 -15
- package/src/components/card/resolveCardThemeRecipe.test.ts +28 -0
- package/src/components/card/resolveCardThemeRecipe.ts +33 -0
- package/src/components/card/themeRecipeMeta.ts +1 -1
- package/src/components/card/types.ts +2 -0
- package/src/components/contentFallback.test.ts +4 -4
- package/src/components/heading/Heading.tsx +18 -28
- package/src/components/heading/meta.ts +14 -22
- package/src/components/heading/resolveHeadingThemeRecipe.ts +55 -0
- package/src/components/heading/themeRecipeMeta.ts +33 -0
- package/src/components/image/meta.ts +18 -3
- package/src/components/text/Text.tsx +16 -25
- package/src/components/text/meta.ts +14 -25
- package/src/components/text/resolveTextThemeRecipe.ts +48 -0
- package/src/components/text/themeRecipeMeta.ts +12 -11
- package/src/metadata/authoringMeta.test.ts +18 -44
- package/src/metadata/bindableComponentMeta.test.ts +13 -0
- package/src/metadata/bindableComponentMeta.ts +4 -13
- package/src/metadata/componentMeta.test.ts +14 -0
- package/src/metadata/themeRecipeMeta.test.ts +41 -39
- package/src/metadata/themeRecipeMeta.ts +2 -0
- package/src/metadata/themeRecipeTypes.ts +3 -3
- package/src/metadata/types.ts +11 -24
- package/src/patterns/panel/Panel.tsx +14 -4
- package/src/patterns/panel/meta.ts +15 -15
- package/src/patterns/panel/themeRecipeMeta.ts +1 -1
- package/src/patterns/panel/types.ts +2 -0
- package/src/theme/ZoraProvider.tsx +10 -13
- package/src/theme/ZoraThemeRuntimeContext.tsx +1 -3
- package/src/theme/ZoraThemeScope.tsx +5 -25
- package/src/theme/resolveZoraThemeRecipe.test.ts +72 -0
- package/src/theme/resolveZoraThemeRecipe.ts +91 -0
- package/src/theme/themeConfigScope.test.ts +25 -0
- package/src/theme/useZoraThemeRecipe.ts +7 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 2.13.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 04e4124: Make Image a first-class manifest-authoring node backed by canonical media metadata, with image-kind constraints and shared static metadata across the standard and bindable registries.
|
|
8
|
+
|
|
9
|
+
## 2.12.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- 7524b66: Resolve canonical persisted theme recipe overrides through ZORA-owned metadata, preserve full ThemeConfig across theme scopes, and make explicit component props override inherited recipe defaults without pinning theme-owned values into new manifest blueprints.
|
|
14
|
+
|
|
3
15
|
## 2.11.0
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
# ZORA
|
|
5
5
|
|
|
6
|
-
         
|
|
7
7
|
|
|
8
8
|
Opinionated React Native and React Native Web UI kit built on @ankhorage/surface.
|
|
9
9
|
|
|
@@ -64,7 +64,7 @@ export default function BasicApp() {
|
|
|
64
64
|
- [resolveOAuthProviderLabel sequence](././paradox/diagrams/sequences/resolve-oauth-provider-label.mmd)
|
|
65
65
|
- [SelectableItem sequence](././paradox/diagrams/sequences/selectable-item.mmd)
|
|
66
66
|
- [SelectionProvider sequence](././paradox/diagrams/sequences/selection-provider.mmd)
|
|
67
|
+
- [ThemeModeToggle sequence](././paradox/diagrams/sequences/theme-mode-toggle.mmd)
|
|
67
68
|
- [useZoraTheme sequence](././paradox/diagrams/sequences/use-zora-theme.mmd)
|
|
68
69
|
- [validateField sequence](././paradox/diagrams/sequences/validate-field.mmd)
|
|
69
70
|
- [validateFields sequence](././paradox/diagrams/sequences/validate-fields.mmd)
|
|
70
|
-
- [ZoraProvider sequence](././paradox/diagrams/sequences/zora-provider.mmd)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../../src/components/button/Button.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../../src/components/button/Button.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAyB3C;;;;;;;;;;GAUG;AACH,eAAO,MAAM,MAAM,mDAAkC,CAAC"}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { Button as SurfaceButton } from '@ankhorage/surface';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import {
|
|
3
|
+
import { useZoraThemeRecipe } from '../../theme/useZoraThemeRecipe';
|
|
4
4
|
import { withZoraThemeScope } from '../../theme/withZoraThemeScope';
|
|
5
|
+
import { resolveButtonThemeRecipe } from './resolveButtonThemeRecipe';
|
|
5
6
|
function ButtonInner({ themeId: _themeId, mode: _mode, color, variant, size, interactionPolicy, ...props }) {
|
|
6
|
-
const
|
|
7
|
+
const themeFields = useZoraThemeRecipe('Button');
|
|
8
|
+
const recipe = resolveButtonThemeRecipe({ color, variant, size, themeFields });
|
|
7
9
|
return (<SurfaceButton {...props} color={recipe.color} size={recipe.size} variant={recipe.variant} interactionPolicy={interactionPolicy}/>);
|
|
8
10
|
}
|
|
9
11
|
/***
|
|
@@ -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,
|
|
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,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AAGtE,SAAS,WAAW,CAAC,EACnB,OAAO,EAAE,QAAQ,EACjB,IAAI,EAAE,KAAK,EACX,KAAK,EACL,OAAO,EACP,IAAI,EACJ,iBAAiB,EACjB,GAAG,KAAK,EACI;IACZ,MAAM,WAAW,GAAG,kBAAkB,CAAC,QAAQ,CAAC,CAAC;IACjD,MAAM,MAAM,GAAG,wBAAwB,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC,CAAC;IAE/E,OAAO,CACL,CAAC,aAAa,CACZ,IAAI,KAAK,CAAC,CACV,KAAK,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CACpB,IAAI,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAClB,OAAO,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CACxB,iBAAiB,CAAC,CAAC,iBAAiB,CAAC,EACrC,CACH,CAAC;AACJ,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,kBAAkB,CAAC,WAAW,CAAC,CAAC","sourcesContent":["import { Button as SurfaceButton } from '@ankhorage/surface';\nimport React from 'react';\n\nimport { useZoraThemeRecipe } from '../../theme/useZoraThemeRecipe';\nimport { withZoraThemeScope } from '../../theme/withZoraThemeScope';\nimport { resolveButtonThemeRecipe } from './resolveButtonThemeRecipe';\nimport type { ButtonProps } from './types';\n\nfunction ButtonInner({\n themeId: _themeId,\n mode: _mode,\n color,\n variant,\n size,\n interactionPolicy,\n ...props\n}: ButtonProps) {\n const themeFields = useZoraThemeRecipe('Button');\n const recipe = resolveButtonThemeRecipe({ color, variant, size, themeFields });\n\n return (\n <SurfaceButton\n {...props}\n color={recipe.color}\n size={recipe.size}\n variant={recipe.variant}\n interactionPolicy={interactionPolicy}\n />\n );\n}\n\n/***\n * Theme-aware action control for primary, secondary, destructive, and neutral actions.\n *\n * Use `Button` for explicit user actions that should follow ZORA's semantic color,\n * variant, and size recipes across React Native and React Native Web.\n *\n * @example Basic action\n * ```tsx\n * <Button color=\"primary\" variant=\"solid\" onPress={save}>Save</Button>\n * ```\n */\nexport const Button = withZoraThemeScope(ButtonInner);\n"]}
|
|
@@ -7,9 +7,6 @@ export declare const buttonMeta: {
|
|
|
7
7
|
readonly label: "Button";
|
|
8
8
|
readonly defaultProps: {
|
|
9
9
|
readonly children: "Continue";
|
|
10
|
-
readonly color: "primary";
|
|
11
|
-
readonly variant: "solid";
|
|
12
|
-
readonly size: "m";
|
|
13
10
|
};
|
|
14
11
|
};
|
|
15
12
|
readonly events: {
|
|
@@ -35,10 +32,10 @@ export declare const buttonMeta: {
|
|
|
35
32
|
readonly category: "Style";
|
|
36
33
|
readonly label: "Color";
|
|
37
34
|
readonly enum: readonly ["primary", "secondary", "tertiary", "quaternary", "neutral", "success", "warning", "error", "info", "danger"];
|
|
38
|
-
readonly default: "primary";
|
|
39
35
|
readonly authoring: {
|
|
40
36
|
readonly authority: "theme";
|
|
41
37
|
readonly scope: "component";
|
|
38
|
+
readonly allowInstanceOverride: true;
|
|
42
39
|
};
|
|
43
40
|
};
|
|
44
41
|
readonly variant: {
|
|
@@ -46,10 +43,10 @@ export declare const buttonMeta: {
|
|
|
46
43
|
readonly category: "Style";
|
|
47
44
|
readonly label: "Variant";
|
|
48
45
|
readonly enum: readonly ["solid", "outline", "ghost", "soft"];
|
|
49
|
-
readonly default: "solid";
|
|
50
46
|
readonly authoring: {
|
|
51
47
|
readonly authority: "theme";
|
|
52
48
|
readonly scope: "component";
|
|
49
|
+
readonly allowInstanceOverride: true;
|
|
53
50
|
};
|
|
54
51
|
};
|
|
55
52
|
readonly size: {
|
|
@@ -57,10 +54,10 @@ export declare const buttonMeta: {
|
|
|
57
54
|
readonly category: "Style";
|
|
58
55
|
readonly label: "Size";
|
|
59
56
|
readonly enum: readonly ["s", "m", "l"];
|
|
60
|
-
readonly default: "m";
|
|
61
57
|
readonly authoring: {
|
|
62
58
|
readonly authority: "theme";
|
|
63
59
|
readonly scope: "component";
|
|
60
|
+
readonly allowInstanceOverride: true;
|
|
64
61
|
};
|
|
65
62
|
};
|
|
66
63
|
};
|
|
@@ -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":"AASA,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4Ce,CAAC"}
|
|
@@ -1,18 +1,15 @@
|
|
|
1
1
|
import { ZORA_COLORS } from '../../internal/colorModel';
|
|
2
|
+
const themeAuthoring = {
|
|
3
|
+
authority: 'theme',
|
|
4
|
+
scope: 'component',
|
|
5
|
+
allowInstanceOverride: true,
|
|
6
|
+
};
|
|
2
7
|
export const buttonMeta = {
|
|
3
8
|
name: 'Button',
|
|
4
9
|
category: 'component',
|
|
5
10
|
directManifestNode: true,
|
|
6
11
|
allowedChildren: [],
|
|
7
|
-
blueprint: {
|
|
8
|
-
label: 'Button',
|
|
9
|
-
defaultProps: {
|
|
10
|
-
children: 'Continue',
|
|
11
|
-
color: 'primary',
|
|
12
|
-
variant: 'solid',
|
|
13
|
-
size: 'm',
|
|
14
|
-
},
|
|
15
|
-
},
|
|
12
|
+
blueprint: { label: 'Button', defaultProps: { children: 'Continue' } },
|
|
16
13
|
events: {
|
|
17
14
|
press: {
|
|
18
15
|
label: 'Press',
|
|
@@ -34,24 +31,21 @@ export const buttonMeta = {
|
|
|
34
31
|
category: 'Style',
|
|
35
32
|
label: 'Color',
|
|
36
33
|
enum: [...ZORA_COLORS],
|
|
37
|
-
|
|
38
|
-
authoring: { authority: 'theme', scope: 'component' },
|
|
34
|
+
authoring: themeAuthoring,
|
|
39
35
|
},
|
|
40
36
|
variant: {
|
|
41
37
|
type: 'enum',
|
|
42
38
|
category: 'Style',
|
|
43
39
|
label: 'Variant',
|
|
44
40
|
enum: ['solid', 'outline', 'ghost', 'soft'],
|
|
45
|
-
|
|
46
|
-
authoring: { authority: 'theme', scope: 'component' },
|
|
41
|
+
authoring: themeAuthoring,
|
|
47
42
|
},
|
|
48
43
|
size: {
|
|
49
44
|
type: 'enum',
|
|
50
45
|
category: 'Style',
|
|
51
46
|
label: 'Size',
|
|
52
47
|
enum: ['s', 'm', 'l'],
|
|
53
|
-
|
|
54
|
-
authoring: { authority: 'theme', scope: 'component' },
|
|
48
|
+
authoring: themeAuthoring,
|
|
55
49
|
},
|
|
56
50
|
},
|
|
57
51
|
};
|
|
@@ -1 +1 @@
|
|
|
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
|
|
1
|
+
{"version":3,"file":"meta.js","sourceRoot":"","sources":["../../../src/components/button/meta.ts"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AG,CAAC;YACrB,SAAS,EAAE,cAAc;SAC1B;KACF;CACmC,CAAC","sourcesContent":["import { ZORA_COLORS } from '../../internal/colorModel';\nimport type { ZoraComponentMeta } from '../../metadata';\n\nconst themeAuthoring = {\n authority: 'theme',\n scope: 'component',\n allowInstanceOverride: true,\n} as const;\n\nexport const buttonMeta = {\n name: 'Button',\n category: 'component',\n directManifestNode: true,\n allowedChildren: [],\n blueprint: { label: 'Button', defaultProps: { children: 'Continue' } },\n events: {\n press: {\n label: 'Press',\n eventType: 'button.press',\n description: 'Emitted when the button action runs.',\n payloadFields: [],\n },\n },\n props: {\n children: {\n type: 'string',\n category: 'Content',\n label: 'Label',\n default: 'Continue',\n authoring: { authority: 'instance' },\n },\n color: {\n type: 'enum',\n category: 'Style',\n label: 'Color',\n enum: [...ZORA_COLORS],\n authoring: themeAuthoring,\n },\n variant: {\n type: 'enum',\n category: 'Style',\n label: 'Variant',\n enum: ['solid', 'outline', 'ghost', 'soft'],\n authoring: themeAuthoring,\n },\n size: {\n type: 'enum',\n category: 'Style',\n label: 'Size',\n enum: ['s', 'm', 'l'],\n authoring: themeAuthoring,\n },\n },\n} as const satisfies ZoraComponentMeta;\n"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ThemeRecipeOverrideValue } from '@ankhorage/contracts';
|
|
2
|
+
import { type ZoraButtonVariant, type ZoraColor, type ZoraControlSize } from '../../internal/recipes';
|
|
3
|
+
export declare function resolveButtonThemeRecipe(input: {
|
|
4
|
+
readonly color?: ZoraColor;
|
|
5
|
+
readonly variant?: ZoraButtonVariant;
|
|
6
|
+
readonly size?: ZoraControlSize;
|
|
7
|
+
readonly themeFields: Readonly<Record<string, ThemeRecipeOverrideValue>>;
|
|
8
|
+
}): Pick<import("@ankhorage/surface").ButtonProps, "variant" | "size" | "color">;
|
|
9
|
+
//# sourceMappingURL=resolveButtonThemeRecipe.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveButtonThemeRecipe.d.ts","sourceRoot":"","sources":["../../../src/components/button/resolveButtonThemeRecipe.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAErE,OAAO,EAEL,KAAK,iBAAiB,EACtB,KAAK,SAAS,EACd,KAAK,eAAe,EACrB,MAAM,wBAAwB,CAAC;AAEhC,wBAAgB,wBAAwB,CAAC,KAAK,EAAE;IAC9C,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,CAAC;IAC3B,QAAQ,CAAC,OAAO,CAAC,EAAE,iBAAiB,CAAC;IACrC,QAAQ,CAAC,IAAI,CAAC,EAAE,eAAe,CAAC;IAChC,QAAQ,CAAC,WAAW,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,wBAAwB,CAAC,CAAC,CAAC;CAC1E,gFAMA"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { resolveButtonRecipe, } from '../../internal/recipes';
|
|
2
|
+
export function resolveButtonThemeRecipe(input) {
|
|
3
|
+
return resolveButtonRecipe({
|
|
4
|
+
color: input.color ?? readColor(input.themeFields.color),
|
|
5
|
+
variant: input.variant ?? readVariant(input.themeFields.variant),
|
|
6
|
+
size: input.size ?? readSize(input.themeFields.size),
|
|
7
|
+
});
|
|
8
|
+
}
|
|
9
|
+
function readColor(value) {
|
|
10
|
+
if (typeof value !== 'string')
|
|
11
|
+
return undefined;
|
|
12
|
+
if (value === 'primary' || value === 'secondary' || value === 'tertiary')
|
|
13
|
+
return value;
|
|
14
|
+
if (value === 'quaternary' || value === 'neutral' || value === 'danger')
|
|
15
|
+
return value;
|
|
16
|
+
if (value === 'success' || value === 'warning' || value === 'error' || value === 'info')
|
|
17
|
+
return value;
|
|
18
|
+
return undefined;
|
|
19
|
+
}
|
|
20
|
+
function readVariant(value) {
|
|
21
|
+
if (value === 'solid' || value === 'outline' || value === 'ghost' || value === 'soft')
|
|
22
|
+
return value;
|
|
23
|
+
return undefined;
|
|
24
|
+
}
|
|
25
|
+
function readSize(value) {
|
|
26
|
+
if (value === 's' || value === 'm' || value === 'l')
|
|
27
|
+
return value;
|
|
28
|
+
return undefined;
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=resolveButtonThemeRecipe.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveButtonThemeRecipe.js","sourceRoot":"","sources":["../../../src/components/button/resolveButtonThemeRecipe.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,mBAAmB,GAIpB,MAAM,wBAAwB,CAAC;AAEhC,MAAM,UAAU,wBAAwB,CAAC,KAKxC;IACC,OAAO,mBAAmB,CAAC;QACzB,KAAK,EAAE,KAAK,CAAC,KAAK,IAAI,SAAS,CAAC,KAAK,CAAC,WAAW,CAAC,KAAK,CAAC;QACxD,OAAO,EAAE,KAAK,CAAC,OAAO,IAAI,WAAW,CAAC,KAAK,CAAC,WAAW,CAAC,OAAO,CAAC;QAChE,IAAI,EAAE,KAAK,CAAC,IAAI,IAAI,QAAQ,CAAC,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC;KACrD,CAAC,CAAC;AACL,CAAC;AAED,SAAS,SAAS,CAAC,KAA2C;IAC5D,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,SAAS,CAAC;IAChD,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,WAAW,IAAI,KAAK,KAAK,UAAU;QAAE,OAAO,KAAK,CAAC;IACvF,IAAI,KAAK,KAAK,YAAY,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IACtF,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,OAAO,IAAI,KAAK,KAAK,MAAM;QACrF,OAAO,KAAK,CAAC;IACf,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,SAAS,WAAW,CAAC,KAA2C;IAC9D,IAAI,KAAK,KAAK,OAAO,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,OAAO,IAAI,KAAK,KAAK,MAAM;QACnF,OAAO,KAAK,CAAC;IACf,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,SAAS,QAAQ,CAAC,KAA2C;IAC3D,IAAI,KAAK,KAAK,GAAG,IAAI,KAAK,KAAK,GAAG,IAAI,KAAK,KAAK,GAAG;QAAE,OAAO,KAAK,CAAC;IAClE,OAAO,SAAS,CAAC;AACnB,CAAC","sourcesContent":["import type { ThemeRecipeOverrideValue } from '@ankhorage/contracts';\n\nimport {\n resolveButtonRecipe,\n type ZoraButtonVariant,\n type ZoraColor,\n type ZoraControlSize,\n} from '../../internal/recipes';\n\nexport function resolveButtonThemeRecipe(input: {\n readonly color?: ZoraColor;\n readonly variant?: ZoraButtonVariant;\n readonly size?: ZoraControlSize;\n readonly themeFields: Readonly<Record<string, ThemeRecipeOverrideValue>>;\n}) {\n return resolveButtonRecipe({\n color: input.color ?? readColor(input.themeFields.color),\n variant: input.variant ?? readVariant(input.themeFields.variant),\n size: input.size ?? readSize(input.themeFields.size),\n });\n}\n\nfunction readColor(value: ThemeRecipeOverrideValue | undefined): ZoraColor | undefined {\n if (typeof value !== 'string') return undefined;\n if (value === 'primary' || value === 'secondary' || value === 'tertiary') return value;\n if (value === 'quaternary' || value === 'neutral' || value === 'danger') return value;\n if (value === 'success' || value === 'warning' || value === 'error' || value === 'info')\n return value;\n return undefined;\n}\n\nfunction readVariant(value: ThemeRecipeOverrideValue | undefined): ZoraButtonVariant | undefined {\n if (value === 'solid' || value === 'outline' || value === 'ghost' || value === 'soft')\n return value;\n return undefined;\n}\n\nfunction readSize(value: ThemeRecipeOverrideValue | undefined): ZoraControlSize | undefined {\n if (value === 's' || value === 'm' || value === 'l') return value;\n return undefined;\n}\n"]}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
export declare const buttonThemeRecipeMeta: {
|
|
2
2
|
readonly name: "Button";
|
|
3
3
|
readonly kind: "component";
|
|
4
|
-
readonly description: "Maps shared
|
|
4
|
+
readonly description: "Maps shared semantic choices into Button presentation defaults.";
|
|
5
5
|
readonly fields: {
|
|
6
6
|
readonly color: {
|
|
7
|
-
readonly type: "
|
|
8
|
-
readonly tokenFamily: "colors";
|
|
7
|
+
readonly type: "choice";
|
|
9
8
|
readonly label: "Color";
|
|
9
|
+
readonly options: readonly ["primary", "secondary", "tertiary", "quaternary", "neutral", "success", "warning", "error", "info", "danger"];
|
|
10
10
|
readonly default: "primary";
|
|
11
11
|
};
|
|
12
12
|
readonly variant: {
|
|
@@ -20,13 +20,7 @@ export declare const buttonThemeRecipeMeta: {
|
|
|
20
20
|
readonly label: "Size";
|
|
21
21
|
readonly description: "A Button-specific semantic scale, not a universal pixel size.";
|
|
22
22
|
readonly options: readonly ["s", "m", "l"];
|
|
23
|
-
readonly default: "
|
|
24
|
-
};
|
|
25
|
-
readonly radius: {
|
|
26
|
-
readonly type: "token";
|
|
27
|
-
readonly tokenFamily: "radii";
|
|
28
|
-
readonly label: "Corner radius";
|
|
29
|
-
readonly default: "m";
|
|
23
|
+
readonly default: "l";
|
|
30
24
|
};
|
|
31
25
|
};
|
|
32
26
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"themeRecipeMeta.d.ts","sourceRoot":"","sources":["../../../src/components/button/themeRecipeMeta.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"themeRecipeMeta.d.ts","sourceRoot":"","sources":["../../../src/components/button/themeRecipeMeta.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;CAyBM,CAAC"}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
+
import { ZORA_COLORS } from '../../internal/colorModel';
|
|
1
2
|
export const buttonThemeRecipeMeta = {
|
|
2
3
|
name: 'Button',
|
|
3
4
|
kind: 'component',
|
|
4
|
-
description: 'Maps shared
|
|
5
|
+
description: 'Maps shared semantic choices into Button presentation defaults.',
|
|
5
6
|
fields: {
|
|
6
7
|
color: {
|
|
7
|
-
type: '
|
|
8
|
-
tokenFamily: 'colors',
|
|
8
|
+
type: 'choice',
|
|
9
9
|
label: 'Color',
|
|
10
|
+
options: ZORA_COLORS,
|
|
10
11
|
default: 'primary',
|
|
11
12
|
},
|
|
12
13
|
variant: {
|
|
@@ -20,13 +21,7 @@ export const buttonThemeRecipeMeta = {
|
|
|
20
21
|
label: 'Size',
|
|
21
22
|
description: 'A Button-specific semantic scale, not a universal pixel size.',
|
|
22
23
|
options: ['s', 'm', 'l'],
|
|
23
|
-
default: '
|
|
24
|
-
},
|
|
25
|
-
radius: {
|
|
26
|
-
type: 'token',
|
|
27
|
-
tokenFamily: 'radii',
|
|
28
|
-
label: 'Corner radius',
|
|
29
|
-
default: 'm',
|
|
24
|
+
default: 'l',
|
|
30
25
|
},
|
|
31
26
|
},
|
|
32
27
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"themeRecipeMeta.js","sourceRoot":"","sources":["../../../src/components/button/themeRecipeMeta.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"themeRecipeMeta.js","sourceRoot":"","sources":["../../../src/components/button/themeRecipeMeta.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAGxD,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,IAAI,EAAE,QAAQ;IACd,IAAI,EAAE,WAAW;IACjB,WAAW,EAAE,iEAAiE;IAC9E,MAAM,EAAE;QACN,KAAK,EAAE;YACL,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,OAAO;YACd,OAAO,EAAE,WAAW;YACpB,OAAO,EAAE,SAAS;SACnB;QACD,OAAO,EAAE;YACP,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,SAAS;YAChB,OAAO,EAAE,CAAC,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,CAAC;YAC9C,OAAO,EAAE,OAAO;SACjB;QACD,IAAI,EAAE;YACJ,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,MAAM;YACb,WAAW,EAAE,+DAA+D;YAC5E,OAAO,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC;YACxB,OAAO,EAAE,GAAG;SACb;KACF;CACqC,CAAC","sourcesContent":["import { ZORA_COLORS } from '../../internal/colorModel';\nimport type { ZoraThemeRecipeMeta } from '../../metadata/themeRecipeTypes';\n\nexport const buttonThemeRecipeMeta = {\n name: 'Button',\n kind: 'component',\n description: 'Maps shared semantic choices into Button presentation defaults.',\n fields: {\n color: {\n type: 'choice',\n label: 'Color',\n options: ZORA_COLORS,\n default: 'primary',\n },\n variant: {\n type: 'choice',\n label: 'Variant',\n options: ['solid', 'outline', 'ghost', 'soft'],\n default: 'solid',\n },\n size: {\n type: 'choice',\n label: 'Size',\n description: 'A Button-specific semantic scale, not a universal pixel size.',\n options: ['s', 'm', 'l'],\n default: 'l',\n },\n },\n} as const satisfies ZoraThemeRecipeMeta;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Card.d.ts","sourceRoot":"","sources":["../../../src/components/card/Card.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"Card.d.ts","sourceRoot":"","sources":["../../../src/components/card/Card.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAS1B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAsEzC;;;;;;;;;;GAUG;AACH,eAAO,MAAM,IAAI,iDAAgC,CAAC"}
|
|
@@ -2,16 +2,20 @@ import { Card as SurfaceCard } from '@ankhorage/surface';
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { Box, Stack } from '../../foundation';
|
|
4
4
|
import { resolveCardVariant } from '../../internal/recipes';
|
|
5
|
+
import { useZoraThemeRecipe } from '../../theme/useZoraThemeRecipe';
|
|
5
6
|
import { withZoraThemeScope } from '../../theme/withZoraThemeScope';
|
|
6
7
|
import { Heading } from '../heading';
|
|
7
8
|
import { Text } from '../text';
|
|
8
|
-
|
|
9
|
+
import { resolveCardThemeRecipe } from './resolveCardThemeRecipe';
|
|
10
|
+
function CardInner({ themeId: _themeId, mode: _mode, children, title, description, eyebrow, actions, footer, tone, compact, padding, radius, onPress, interactionPolicy, ...props }) {
|
|
11
|
+
const themeFields = useZoraThemeRecipe('Card');
|
|
12
|
+
const recipe = resolveCardThemeRecipe({ tone, compact, padding, radius, themeFields });
|
|
9
13
|
const hasHeader = [eyebrow, title, description, actions].some((item) => item != null);
|
|
10
14
|
const hasFooter = footer !== undefined;
|
|
11
|
-
const gap = compact ? 's' : 'm';
|
|
15
|
+
const gap = recipe.compact ? 's' : 'm';
|
|
12
16
|
const isInteractive = Boolean(onPress) && !actions;
|
|
13
17
|
const passive = interactionPolicy === 'passive';
|
|
14
|
-
return (<SurfaceCard {...props} onPress={isInteractive && !passive ? onPress : undefined} p={
|
|
18
|
+
return (<SurfaceCard {...props} onPress={isInteractive && !passive ? onPress : undefined} p={recipe.padding} radius={recipe.radius} variant={resolveCardVariant(recipe.tone)}>
|
|
15
19
|
<Stack gap={gap}>
|
|
16
20
|
{hasHeader ? (<Stack align={{ base: 'flex-start', md: 'center' }} direction={{ base: 'column', md: 'row' }} gap="m" justify="space-between">
|
|
17
21
|
<Box flex={{ md: 1 }} width={{ base: '100%', md: 'auto' }}>
|
|
@@ -19,7 +23,7 @@ function CardInner({ themeId: _themeId, mode: _mode, children, title, descriptio
|
|
|
19
23
|
{eyebrow ? (<Text emphasis="muted" variant="caption" weight="semiBold">
|
|
20
24
|
{eyebrow}
|
|
21
25
|
</Text>) : null}
|
|
22
|
-
{title ? <Heading level={compact ? 4 : 3}>{title}</Heading> : null}
|
|
26
|
+
{title ? <Heading level={recipe.compact ? 4 : 3}>{title}</Heading> : null}
|
|
23
27
|
{description ? (<Text emphasis="muted" variant="bodySmall">
|
|
24
28
|
{description}
|
|
25
29
|
</Text>) : null}
|
|
@@ -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;
|
|
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,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAGlE,SAAS,SAAS,CAAC,EACjB,OAAO,EAAE,QAAQ,EACjB,IAAI,EAAE,KAAK,EACX,QAAQ,EACR,KAAK,EACL,WAAW,EACX,OAAO,EACP,OAAO,EACP,MAAM,EACN,IA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AC,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;;;;;;;;;;GAUG;AACH,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 { useZoraThemeRecipe } from '../../theme/useZoraThemeRecipe';\nimport { withZoraThemeScope } from '../../theme/withZoraThemeScope';\nimport { Heading } from '../heading';\nimport { Text } from '../text';\nimport { resolveCardThemeRecipe } from './resolveCardThemeRecipe';\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,\n compact,\n padding,\n radius,\n onPress,\n interactionPolicy,\n ...props\n}: CardProps) {\n const themeFields = useZoraThemeRecipe('Card');\n const recipe = resolveCardThemeRecipe({ tone, compact, padding, radius, themeFields });\n const hasHeader = [eyebrow, title, description, actions].some((item) => item != null);\n const hasFooter = footer !== undefined;\n const gap = recipe.compact ? 's' : 'm';\n const isInteractive = Boolean(onPress) && !actions;\n const passive = interactionPolicy === 'passive';\n\n return (\n <SurfaceCard\n {...props}\n onPress={isInteractive && !passive ? onPress : undefined}\n p={recipe.padding}\n radius={recipe.radius}\n variant={resolveCardVariant(recipe.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={recipe.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\n/***\n * Structured content container with built-in heading, description, actions, and footer slots.\n *\n * Use `Card` for reusable content blocks that should inherit ZORA spacing,\n * radius, tone, and responsive header layout without hand-assembling primitives.\n *\n * @example Content card\n * ```tsx\n * <Card title=\"Project\" description=\"Latest activity\">...</Card>\n * ```\n */\nexport const Card = withZoraThemeScope(CardInner);\n"]}
|
|
@@ -7,7 +7,6 @@ export declare const cardMeta: {
|
|
|
7
7
|
readonly label: "Card";
|
|
8
8
|
readonly defaultProps: {
|
|
9
9
|
readonly title: "Card";
|
|
10
|
-
readonly tone: "default";
|
|
11
10
|
};
|
|
12
11
|
};
|
|
13
12
|
readonly props: {
|
|
@@ -40,20 +39,40 @@ export declare const cardMeta: {
|
|
|
40
39
|
readonly category: "Style";
|
|
41
40
|
readonly label: "Tone";
|
|
42
41
|
readonly enum: readonly ["default", "subtle", "outline"];
|
|
43
|
-
readonly default: "default";
|
|
44
42
|
readonly authoring: {
|
|
45
43
|
readonly authority: "theme";
|
|
46
44
|
readonly scope: "component";
|
|
45
|
+
readonly allowInstanceOverride: true;
|
|
47
46
|
};
|
|
48
47
|
};
|
|
49
48
|
readonly compact: {
|
|
50
49
|
readonly type: "boolean";
|
|
51
50
|
readonly category: "Layout";
|
|
52
51
|
readonly label: "Compact";
|
|
53
|
-
readonly default: false;
|
|
54
52
|
readonly authoring: {
|
|
55
53
|
readonly authority: "theme";
|
|
56
54
|
readonly scope: "component";
|
|
55
|
+
readonly allowInstanceOverride: true;
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
readonly padding: {
|
|
59
|
+
readonly type: "spacing";
|
|
60
|
+
readonly category: "Layout";
|
|
61
|
+
readonly label: "Padding";
|
|
62
|
+
readonly authoring: {
|
|
63
|
+
readonly authority: "theme";
|
|
64
|
+
readonly scope: "component";
|
|
65
|
+
readonly allowInstanceOverride: true;
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
readonly radius: {
|
|
69
|
+
readonly type: "radius";
|
|
70
|
+
readonly category: "Style";
|
|
71
|
+
readonly label: "Corner radius";
|
|
72
|
+
readonly authoring: {
|
|
73
|
+
readonly authority: "theme";
|
|
74
|
+
readonly scope: "component";
|
|
75
|
+
readonly allowInstanceOverride: true;
|
|
57
76
|
};
|
|
58
77
|
};
|
|
59
78
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"meta.d.ts","sourceRoot":"","sources":["../../../src/components/card/meta.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"meta.d.ts","sourceRoot":"","sources":["../../../src/components/card/meta.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyCiB,CAAC"}
|
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
import { CONTAINER_ALLOWED_CHILDREN } from '../../metadata/allowedChildren';
|
|
2
|
+
const themeAuthoring = {
|
|
3
|
+
authority: 'theme',
|
|
4
|
+
scope: 'component',
|
|
5
|
+
allowInstanceOverride: true,
|
|
6
|
+
};
|
|
2
7
|
export const cardMeta = {
|
|
3
8
|
name: 'Card',
|
|
4
9
|
category: 'component',
|
|
5
10
|
directManifestNode: true,
|
|
6
11
|
allowedChildren: [...CONTAINER_ALLOWED_CHILDREN],
|
|
7
|
-
blueprint: {
|
|
8
|
-
label: 'Card',
|
|
9
|
-
defaultProps: {
|
|
10
|
-
title: 'Card',
|
|
11
|
-
tone: 'default',
|
|
12
|
-
},
|
|
13
|
-
},
|
|
12
|
+
blueprint: { label: 'Card', defaultProps: { title: 'Card' } },
|
|
14
13
|
props: {
|
|
15
14
|
title: {
|
|
16
15
|
type: 'string',
|
|
@@ -35,15 +34,15 @@ export const cardMeta = {
|
|
|
35
34
|
category: 'Style',
|
|
36
35
|
label: 'Tone',
|
|
37
36
|
enum: ['default', 'subtle', 'outline'],
|
|
38
|
-
|
|
39
|
-
authoring: { authority: 'theme', scope: 'component' },
|
|
37
|
+
authoring: themeAuthoring,
|
|
40
38
|
},
|
|
41
|
-
compact: {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
39
|
+
compact: { type: 'boolean', category: 'Layout', label: 'Compact', authoring: themeAuthoring },
|
|
40
|
+
padding: { type: 'spacing', category: 'Layout', label: 'Padding', authoring: themeAuthoring },
|
|
41
|
+
radius: {
|
|
42
|
+
type: 'radius',
|
|
43
|
+
category: 'Style',
|
|
44
|
+
label: 'Corner radius',
|
|
45
|
+
authoring: themeAuthoring,
|
|
47
46
|
},
|
|
48
47
|
},
|
|
49
48
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"meta.js","sourceRoot":"","sources":["../../../src/components/card/meta.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,0BAA0B,EAAE,MAAM,gCAAgC,CAAC;AAE5E,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB,IAAI,EAAE,MAAM;IACZ,QAAQ,EAAE,WAAW;IACrB,kBAAkB,EAAE,IAAI;IACxB,eAAe,EAAE,CAAC,GAAG,0BAA0B,CAAC;IAChD,SAAS,EAAE
|
|
1
|
+
{"version":3,"file":"meta.js","sourceRoot":"","sources":["../../../src/components/card/meta.ts"],"names":[],"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AAE,QAAQ,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,cAAc,EAAE;QAC7F,MAAM,EAAE;YACN,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,OAAO;YACjB,KAAK,EAAE,eAAe;YACtB,SAAS,EAAE,cAAc;SAC1B;KACF;CACmC,CAAC","sourcesContent":["import type { ZoraComponentMeta } from '../../metadata';\nimport { CONTAINER_ALLOWED_CHILDREN } from '../../metadata/allowedChildren';\n\nconst themeAuthoring = {\n authority: 'theme',\n scope: 'component',\n allowInstanceOverride: true,\n} as const;\n\nexport const cardMeta = {\n name: 'Card',\n category: 'component',\n directManifestNode: true,\n allowedChildren: [...CONTAINER_ALLOWED_CHILDREN],\n blueprint: { label: 'Card', defaultProps: { title: 'Card' } },\n props: {\n title: {\n type: 'string',\n category: 'Content',\n label: 'Title',\n authoring: { authority: 'instance' },\n },\n description: {\n type: 'string',\n category: 'Content',\n label: 'Description',\n authoring: { authority: 'instance' },\n },\n eyebrow: {\n type: 'string',\n category: 'Content',\n label: 'Eyebrow',\n authoring: { authority: 'instance' },\n },\n tone: {\n type: 'enum',\n category: 'Style',\n label: 'Tone',\n enum: ['default', 'subtle', 'outline'],\n authoring: themeAuthoring,\n },\n compact: { type: 'boolean', category: 'Layout', label: 'Compact', authoring: themeAuthoring },\n padding: { type: 'spacing', category: 'Layout', label: 'Padding', authoring: themeAuthoring },\n radius: {\n type: 'radius',\n category: 'Style',\n label: 'Corner radius',\n authoring: themeAuthoring,\n },\n },\n} as const satisfies ZoraComponentMeta;\n"]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ThemeRecipeOverrideValue } from '@ankhorage/contracts';
|
|
2
|
+
import type { ZoraCardTone } from '../../internal/recipes';
|
|
3
|
+
export declare function resolveCardThemeRecipe(input: {
|
|
4
|
+
readonly tone?: ZoraCardTone;
|
|
5
|
+
readonly compact?: boolean;
|
|
6
|
+
readonly padding?: string;
|
|
7
|
+
readonly radius?: string;
|
|
8
|
+
readonly themeFields: Readonly<Record<string, ThemeRecipeOverrideValue>>;
|
|
9
|
+
}): {
|
|
10
|
+
tone: ZoraCardTone;
|
|
11
|
+
compact: boolean;
|
|
12
|
+
padding: string;
|
|
13
|
+
radius: string;
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=resolveCardThemeRecipe.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveCardThemeRecipe.d.ts","sourceRoot":"","sources":["../../../src/components/card/resolveCardThemeRecipe.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAErE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAE3D,wBAAgB,sBAAsB,CAAC,KAAK,EAAE;IAC5C,QAAQ,CAAC,IAAI,CAAC,EAAE,YAAY,CAAC;IAC7B,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,WAAW,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,wBAAwB,CAAC,CAAC,CAAC;CAC1E;;;;;EASA"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export function resolveCardThemeRecipe(input) {
|
|
2
|
+
const tone = input.tone ?? readTone(input.themeFields.tone) ?? 'default';
|
|
3
|
+
const compact = input.compact ?? readBoolean(input.themeFields.compact) ?? false;
|
|
4
|
+
return {
|
|
5
|
+
tone,
|
|
6
|
+
compact,
|
|
7
|
+
padding: input.padding ?? readString(input.themeFields.padding) ?? (compact ? 'm' : 'l'),
|
|
8
|
+
radius: input.radius ?? readString(input.themeFields.radius) ?? 'l',
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
function readTone(value) {
|
|
12
|
+
if (value === 'default' || value === 'subtle' || value === 'outline')
|
|
13
|
+
return value;
|
|
14
|
+
return undefined;
|
|
15
|
+
}
|
|
16
|
+
function readBoolean(value) {
|
|
17
|
+
return typeof value === 'boolean' ? value : undefined;
|
|
18
|
+
}
|
|
19
|
+
function readString(value) {
|
|
20
|
+
return typeof value === 'string' ? value : undefined;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=resolveCardThemeRecipe.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveCardThemeRecipe.js","sourceRoot":"","sources":["../../../src/components/card/resolveCardThemeRecipe.ts"],"names":[],"mappings":"AAIA,MAAM,UAAU,sBAAsB,CAAC,KAMtC;IACC,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,IAAI,QAAQ,CAAC,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,SAAS,CAAC;IACzE,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,IAAI,WAAW,CAAC,KAAK,CAAC,WAAW,CAAC,OAAO,CAAC,IAAI,KAAK,CAAC;IACjF,OAAO;QACL,IAAI;QACJ,OAAO;QACP,OAAO,EAAE,KAAK,CAAC,OAAO,IAAI,UAAU,CAAC,KAAK,CAAC,WAAW,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC;QACxF,MAAM,EAAE,KAAK,CAAC,MAAM,IAAI,UAAU,CAAC,KAAK,CAAC,WAAW,CAAC,MAAM,CAAC,IAAI,GAAG;KACpE,CAAC;AACJ,CAAC;AAED,SAAS,QAAQ,CAAC,KAA2C;IAC3D,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,KAAK,CAAC;IACnF,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,SAAS,WAAW,CAAC,KAA2C;IAC9D,OAAO,OAAO,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;AACxD,CAAC;AAED,SAAS,UAAU,CAAC,KAA2C;IAC7D,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;AACvD,CAAC","sourcesContent":["import type { ThemeRecipeOverrideValue } from '@ankhorage/contracts';\n\nimport type { ZoraCardTone } from '../../internal/recipes';\n\nexport function resolveCardThemeRecipe(input: {\n readonly tone?: ZoraCardTone;\n readonly compact?: boolean;\n readonly padding?: string;\n readonly radius?: string;\n readonly themeFields: Readonly<Record<string, ThemeRecipeOverrideValue>>;\n}) {\n const tone = input.tone ?? readTone(input.themeFields.tone) ?? 'default';\n const compact = input.compact ?? readBoolean(input.themeFields.compact) ?? false;\n return {\n tone,\n compact,\n padding: input.padding ?? readString(input.themeFields.padding) ?? (compact ? 'm' : 'l'),\n radius: input.radius ?? readString(input.themeFields.radius) ?? 'l',\n };\n}\n\nfunction readTone(value: ThemeRecipeOverrideValue | undefined): ZoraCardTone | undefined {\n if (value === 'default' || value === 'subtle' || value === 'outline') return value;\n return undefined;\n}\n\nfunction readBoolean(value: ThemeRecipeOverrideValue | undefined): boolean | undefined {\n return typeof value === 'boolean' ? value : undefined;\n}\n\nfunction readString(value: ThemeRecipeOverrideValue | undefined): string | undefined {\n return typeof value === 'string' ? value : undefined;\n}\n"]}
|
|
@@ -13,7 +13,7 @@ export declare const cardThemeRecipeMeta: {
|
|
|
13
13
|
readonly type: "token";
|
|
14
14
|
readonly tokenFamily: "spacing";
|
|
15
15
|
readonly label: "Padding";
|
|
16
|
-
readonly
|
|
16
|
+
readonly description: "When unset, Card keeps its compact-aware spacing default.";
|
|
17
17
|
};
|
|
18
18
|
readonly radius: {
|
|
19
19
|
readonly type: "token";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"themeRecipeMeta.js","sourceRoot":"","sources":["../../../src/components/card/themeRecipeMeta.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,IAAI,EAAE,MAAM;IACZ,IAAI,EAAE,WAAW;IACjB,WAAW,EAAE,+DAA+D;IAC5E,MAAM,EAAE;QACN,IAAI,EAAE;YACJ,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,MAAM;YACb,OAAO,EAAE,CAAC,SAAS,EAAE,QAAQ,EAAE,SAAS,CAAC;YACzC,OAAO,EAAE,SAAS;SACnB;QACD,OAAO,EAAE;YACP,IAAI,EAAE,OAAO;YACb,WAAW,EAAE,SAAS;YACtB,KAAK,EAAE,SAAS;YAChB,
|
|
1
|
+
{"version":3,"file":"themeRecipeMeta.js","sourceRoot":"","sources":["../../../src/components/card/themeRecipeMeta.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,IAAI,EAAE,MAAM;IACZ,IAAI,EAAE,WAAW;IACjB,WAAW,EAAE,+DAA+D;IAC5E,MAAM,EAAE;QACN,IAAI,EAAE;YACJ,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,MAAM;YACb,OAAO,EAAE,CAAC,SAAS,EAAE,QAAQ,EAAE,SAAS,CAAC;YACzC,OAAO,EAAE,SAAS;SACnB;QACD,OAAO,EAAE;YACP,IAAI,EAAE,OAAO;YACb,WAAW,EAAE,SAAS;YACtB,KAAK,EAAE,SAAS;YAChB,WAAW,EAAE,2DAA2D;SACzE;QACD,MAAM,EAAE;YACN,IAAI,EAAE,OAAO;YACb,WAAW,EAAE,OAAO;YACpB,KAAK,EAAE,eAAe;YACtB,OAAO,EAAE,GAAG;SACb;QACD,OAAO,EAAE;YACP,IAAI,EAAE,SAAS;YACf,KAAK,EAAE,SAAS;YAChB,OAAO,EAAE,KAAK;SACf;KACF;CACqC,CAAC","sourcesContent":["import type { ZoraThemeRecipeMeta } from '../../metadata/themeRecipeTypes';\n\nexport const cardThemeRecipeMeta = {\n name: 'Card',\n kind: 'component',\n description: 'Maps global rhythm and surface tokens into Card presentation.',\n fields: {\n tone: {\n type: 'choice',\n label: 'Tone',\n options: ['default', 'subtle', 'outline'],\n default: 'default',\n },\n padding: {\n type: 'token',\n tokenFamily: 'spacing',\n label: 'Padding',\n description: 'When unset, Card keeps its compact-aware spacing default.',\n },\n radius: {\n type: 'token',\n tokenFamily: 'radii',\n label: 'Corner radius',\n default: 'l',\n },\n compact: {\n type: 'boolean',\n label: 'Compact',\n default: false,\n },\n },\n} as const satisfies ZoraThemeRecipeMeta;\n"]}
|