@ankhorage/surface 1.3.1 → 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 +35 -0
- package/dist/components/badge/Badge.d.ts +1 -1
- package/dist/components/badge/Badge.d.ts.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 +2 -2
- package/dist/components/badge/types.d.ts.map +1 -1
- package/dist/components/badge/types.js.map +1 -1
- package/dist/components/button/Button.d.ts +1 -1
- package/dist/components/button/Button.d.ts.map +1 -1
- package/dist/components/button/Button.js +6 -3
- package/dist/components/button/Button.js.map +1 -1
- package/dist/components/button/types.d.ts +2 -2
- package/dist/components/button/types.d.ts.map +1 -1
- package/dist/components/button/types.js.map +1 -1
- package/dist/components/checkbox/Checkbox.d.ts +1 -1
- package/dist/components/checkbox/Checkbox.d.ts.map +1 -1
- package/dist/components/checkbox/Checkbox.js +7 -4
- package/dist/components/checkbox/Checkbox.js.map +1 -1
- package/dist/components/checkbox/types.d.ts +2 -2
- package/dist/components/checkbox/types.d.ts.map +1 -1
- package/dist/components/checkbox/types.js.map +1 -1
- package/dist/components/field/Field.d.ts.map +1 -1
- package/dist/components/field/Field.js +6 -2
- package/dist/components/field/Field.js.map +1 -1
- package/dist/components/helper-text/HelperText.d.ts +1 -1
- package/dist/components/helper-text/HelperText.d.ts.map +1 -1
- package/dist/components/helper-text/HelperText.js +2 -2
- package/dist/components/helper-text/HelperText.js.map +1 -1
- package/dist/components/helper-text/types.d.ts +3 -2
- package/dist/components/helper-text/types.d.ts.map +1 -1
- package/dist/components/helper-text/types.js.map +1 -1
- package/dist/components/icon-button/IconButton.d.ts +1 -1
- package/dist/components/icon-button/IconButton.d.ts.map +1 -1
- package/dist/components/icon-button/IconButton.js +2 -2
- package/dist/components/icon-button/IconButton.js.map +1 -1
- package/dist/components/icon-button/types.d.ts +2 -2
- package/dist/components/icon-button/types.d.ts.map +1 -1
- package/dist/components/icon-button/types.js.map +1 -1
- package/dist/components/label/Label.d.ts +1 -1
- package/dist/components/label/Label.d.ts.map +1 -1
- package/dist/components/label/Label.js +3 -3
- package/dist/components/label/Label.js.map +1 -1
- package/dist/components/label/types.d.ts +3 -2
- package/dist/components/label/types.d.ts.map +1 -1
- package/dist/components/label/types.js.map +1 -1
- package/dist/components/list-item/ListItem.js +1 -1
- package/dist/components/list-item/ListItem.js.map +1 -1
- package/dist/components/menu/Menu.d.ts.map +1 -1
- package/dist/components/menu/Menu.js +1 -3
- package/dist/components/menu/Menu.js.map +1 -1
- package/dist/components/navigation/NavigationItem.d.ts.map +1 -1
- package/dist/components/navigation/NavigationItem.js +1 -1
- package/dist/components/navigation/NavigationItem.js.map +1 -1
- package/dist/components/navigation/TabBarItem.d.ts.map +1 -1
- package/dist/components/navigation/TabBarItem.js +1 -1
- package/dist/components/navigation/TabBarItem.js.map +1 -1
- package/dist/components/radio/Radio.d.ts +1 -1
- package/dist/components/radio/Radio.d.ts.map +1 -1
- package/dist/components/radio/Radio.js +4 -3
- package/dist/components/radio/Radio.js.map +1 -1
- package/dist/components/radio/types.d.ts +2 -2
- package/dist/components/radio/types.d.ts.map +1 -1
- package/dist/components/radio/types.js.map +1 -1
- package/dist/components/switch/Switch.d.ts +1 -1
- package/dist/components/switch/Switch.d.ts.map +1 -1
- package/dist/components/switch/Switch.js +4 -3
- package/dist/components/switch/Switch.js.map +1 -1
- package/dist/components/switch/types.d.ts +2 -2
- package/dist/components/switch/types.d.ts.map +1 -1
- package/dist/components/switch/types.js.map +1 -1
- package/dist/components/tabs/Tab.d.ts.map +1 -1
- package/dist/components/tabs/Tab.js +1 -1
- package/dist/components/tabs/Tab.js.map +1 -1
- package/dist/components/toast/Toast.d.ts +1 -1
- package/dist/components/toast/Toast.d.ts.map +1 -1
- package/dist/components/toast/Toast.js +34 -9
- package/dist/components/toast/Toast.js.map +1 -1
- package/dist/components/toast/ToastProvider.js +1 -1
- package/dist/components/toast/ToastProvider.js.map +1 -1
- package/dist/components/toast/index.d.ts +1 -1
- package/dist/components/toast/index.d.ts.map +1 -1
- package/dist/components/toast/index.js.map +1 -1
- package/dist/components/toast/types.d.ts +3 -2
- package/dist/components/toast/types.d.ts.map +1 -1
- package/dist/components/toast/types.js.map +1 -1
- package/dist/components/tooltip/Tooltip.js +1 -1
- package/dist/components/tooltip/Tooltip.js.map +1 -1
- package/dist/examples/DocsExamples.js +4 -4
- package/dist/examples/DocsExamples.js.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/internal/resolvers/index.d.ts +1 -1
- package/dist/internal/resolvers/index.d.ts.map +1 -1
- package/dist/internal/resolvers/index.js +1 -1
- package/dist/internal/resolvers/index.js.map +1 -1
- package/dist/internal/resolvers/resolveFieldPresentation.d.ts +5 -5
- package/dist/internal/resolvers/resolveFieldPresentation.d.ts.map +1 -1
- package/dist/internal/resolvers/resolveFieldPresentation.js +8 -6
- package/dist/internal/resolvers/resolveFieldPresentation.js.map +1 -1
- package/dist/internal/resolvers/resolveInteractiveColors.d.ts +3 -3
- package/dist/internal/resolvers/resolveInteractiveColors.d.ts.map +1 -1
- package/dist/internal/resolvers/resolveInteractiveColors.js +4 -6
- package/dist/internal/resolvers/resolveInteractiveColors.js.map +1 -1
- package/dist/internal/resolvers/resolveSelectionControlColors.d.ts +3 -3
- package/dist/internal/resolvers/resolveSelectionControlColors.d.ts.map +1 -1
- package/dist/internal/resolvers/resolveSelectionControlColors.js +4 -4
- package/dist/internal/resolvers/resolveSelectionControlColors.js.map +1 -1
- package/dist/internal/resolvers/resolveSurfaceColor.d.ts +4 -0
- package/dist/internal/resolvers/resolveSurfaceColor.d.ts.map +1 -0
- package/dist/internal/resolvers/resolveSurfaceColor.js +26 -0
- package/dist/internal/resolvers/resolveSurfaceColor.js.map +1 -0
- package/dist/internal/resolvers/resolveTextColor.d.ts +2 -3
- package/dist/internal/resolvers/resolveTextColor.d.ts.map +1 -1
- package/dist/internal/resolvers/resolveTextColor.js +7 -11
- package/dist/internal/resolvers/resolveTextColor.js.map +1 -1
- package/dist/layout/ScrollArea.d.ts +9 -0
- package/dist/layout/ScrollArea.d.ts.map +1 -0
- package/dist/layout/ScrollArea.js +52 -0
- package/dist/layout/ScrollArea.js.map +1 -0
- package/dist/layout/index.d.ts +2 -0
- package/dist/layout/index.d.ts.map +1 -1
- package/dist/layout/index.js +1 -0
- package/dist/layout/index.js.map +1 -1
- package/dist/primitives/heading/Heading.d.ts.map +1 -1
- package/dist/primitives/heading/Heading.js +2 -2
- package/dist/primitives/heading/Heading.js.map +1 -1
- package/dist/primitives/heading/resolveHeadingStyle.d.ts +2 -1
- package/dist/primitives/heading/resolveHeadingStyle.d.ts.map +1 -1
- package/dist/primitives/heading/resolveHeadingStyle.js +2 -2
- package/dist/primitives/heading/resolveHeadingStyle.js.map +1 -1
- package/dist/primitives/heading/types.d.ts +3 -0
- package/dist/primitives/heading/types.d.ts.map +1 -1
- package/dist/primitives/heading/types.js.map +1 -1
- package/dist/primitives/text/Text.d.ts +1 -1
- package/dist/primitives/text/Text.d.ts.map +1 -1
- package/dist/primitives/text/Text.js +2 -2
- package/dist/primitives/text/Text.js.map +1 -1
- package/dist/primitives/text/types.d.ts +3 -3
- package/dist/primitives/text/types.d.ts.map +1 -1
- package/dist/primitives/text/types.js.map +1 -1
- package/dist/surfaceColor.d.ts +9 -0
- package/dist/surfaceColor.d.ts.map +1 -0
- package/dist/surfaceColor.js +15 -0
- package/dist/surfaceColor.js.map +1 -0
- package/dist/theme/colorEngine.d.ts.map +1 -1
- package/dist/theme/colorEngine.js +9 -1
- package/dist/theme/colorEngine.js.map +1 -1
- package/dist/theme/types.d.ts +5 -0
- package/dist/theme/types.d.ts.map +1 -1
- package/dist/theme/types.js.map +1 -1
- package/package.json +1 -1
- package/src/components/badge/Badge.tsx +8 -3
- package/src/components/badge/types.ts +2 -2
- package/src/components/button/Button.tsx +9 -3
- package/src/components/button/types.ts +2 -2
- package/src/components/checkbox/Checkbox.tsx +13 -4
- package/src/components/checkbox/types.ts +2 -2
- package/src/components/field/Field.tsx +11 -3
- package/src/components/helper-text/HelperText.tsx +2 -2
- package/src/components/helper-text/types.ts +3 -2
- package/src/components/icon-button/IconButton.tsx +2 -2
- package/src/components/icon-button/types.ts +2 -2
- package/src/components/label/Label.tsx +9 -3
- package/src/components/label/types.ts +3 -2
- package/src/components/list-item/ListItem.tsx +1 -1
- package/src/components/menu/Menu.tsx +1 -8
- package/src/components/navigation/NavigationItem.tsx +2 -1
- package/src/components/navigation/TabBarItem.tsx +2 -1
- package/src/components/radio/Radio.tsx +5 -3
- package/src/components/radio/types.ts +2 -2
- package/src/components/switch/Switch.tsx +5 -3
- package/src/components/switch/types.ts +2 -2
- package/src/components/tabs/Tab.tsx +1 -5
- package/src/components/toast/Toast.tsx +38 -10
- package/src/components/toast/ToastProvider.tsx +1 -1
- package/src/components/toast/index.ts +1 -1
- package/src/components/toast/types.ts +4 -2
- package/src/components/tooltip/Tooltip.tsx +1 -1
- package/src/examples/DocsExamples.tsx +4 -4
- package/src/index.test.ts +1 -0
- package/src/index.ts +13 -1
- package/src/internal/resolvers/index.ts +1 -1
- package/src/internal/resolvers/resolveFieldPresentation.test.ts +12 -10
- package/src/internal/resolvers/resolveFieldPresentation.ts +13 -11
- package/src/internal/resolvers/resolveInteractiveColors.test.ts +4 -4
- package/src/internal/resolvers/resolveInteractiveColors.ts +6 -7
- package/src/internal/resolvers/resolveSelectionControlColors.test.ts +8 -8
- package/src/internal/resolvers/resolveSelectionControlColors.ts +6 -5
- package/src/internal/resolvers/resolveSurfaceColor.test.ts +21 -0
- package/src/internal/resolvers/resolveSurfaceColor.ts +31 -0
- package/src/internal/resolvers/resolveTextColor.test.ts +16 -5
- package/src/internal/resolvers/resolveTextColor.ts +10 -22
- package/src/layout/ScrollArea.tsx +115 -0
- package/src/layout/index.ts +2 -0
- package/src/primitives/heading/Heading.tsx +3 -1
- package/src/primitives/heading/resolveHeadingStyle.test.ts +1 -1
- package/src/primitives/heading/resolveHeadingStyle.ts +4 -1
- package/src/primitives/heading/types.ts +4 -0
- package/src/primitives/text/Text.tsx +2 -2
- package/src/primitives/text/types.ts +3 -3
- package/src/surfaceColor.test.ts +46 -0
- package/src/surfaceColor.ts +22 -0
- package/src/theme/colorEngine.test.ts +6 -0
- package/src/theme/colorEngine.ts +9 -1
- package/src/theme/types.ts +5 -0
- package/dist/internal/resolvers/resolveTone.d.ts +0 -4
- package/dist/internal/resolvers/resolveTone.d.ts.map +0 -1
- package/dist/internal/resolvers/resolveTone.js +0 -16
- package/dist/internal/resolvers/resolveTone.js.map +0 -1
- package/src/internal/resolvers/resolveTone.ts +0 -19
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolveSelectionControlColors.js","sourceRoot":"","sources":["../../../src/internal/resolvers/resolveSelectionControlColors.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"resolveSelectionControlColors.js","sourceRoot":"","sources":["../../../src/internal/resolvers/resolveSelectionControlColors.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAY5D,MAAM,UAAU,6BAA6B,CAC3C,KAAmB,EACnB,EACE,KAAK,GAAG,SAAS,EACjB,UAAU,EACV,OAAO,EACP,OAAO,GAAG,KAAK,EACf,OAAO,GAAG,KAAK,GAOhB;IAED,MAAM,YAAY,GAAG,mBAAmB,CAAC,KAAK,EAAE,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;IACtF,MAAM,OAAO,GAAG,UAAU,CAAC,QAAQ,CAAC;IACpC,MAAM,qBAAqB,GAAG,UAAU,CAAC,QAAQ,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC;IAE1E,IAAI,OAAO,EAAE,CAAC;QACZ,OAAO;YACL,eAAe,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,CAAC,YAAY,CAAC,KAAK;YACpB,CAAC,CAAC,YAAY,CAAC,IAAI,CAAC;IACxB,MAAM,iBAAiB,GAAG,OAAO;QAC/B,CAAC,CAAC,YAAY,CAAC,MAAM;QACrB,CAAC,CAAC,OAAO;YACP,CAAC,CAAC,YAAY,CAAC,KAAK;YACpB,CAAC,CAAC,YAAY,CAAC,IAAI,CAAC;IAExB,OAAO;QACL,eAAe,EAAE,OAAO,CAAC,CAAC,CAAC,sBAAsB,CAAC,CAAC,CAAC,wBAAwB;QAC5E,WAAW,EAAE,OAAO,CAAC,CAAC,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,oBAAoB;QAC/D,cAAc,EAAE,OAAO,CAAC,CAAC,CAAC,YAAY,CAAC,WAAW,CAAC,CAAC,CAAC,aAAa;QAClE,UAAU,EAAE,qBAAqB;YAC/B,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,KAAK;YAC/B,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,OAAO;QACnC,UAAU,EAAE,OAAO,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,oBAAoB;QAC9D,UAAU,EAAE,OAAO,CAAC,CAAC,CAAC,YAAY,CAAC,WAAW,CAAC,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,OAAO;QAChF,OAAO,EAAE,qBAAqB,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;KAC1C,CAAC;AACJ,CAAC","sourcesContent":["import type { SurfaceColor } from '../../surfaceColor';\nimport type { SurfaceTheme } from '../../theme/types';\nimport type { FieldState } from './resolveFieldState';\nimport { resolveSurfaceColor } from './resolveSurfaceColor';\n\nexport interface ResolvedSelectionControlColors {\n backgroundColor: string;\n borderColor: string;\n indicatorColor: string;\n labelColor: string;\n trackColor: string;\n thumbColor: string;\n opacity?: number;\n}\n\nexport function resolveSelectionControlColors(\n theme: SurfaceTheme,\n {\n color = 'primary',\n fieldState,\n checked,\n hovered = false,\n pressed = false,\n }: {\n color?: SurfaceColor;\n fieldState: FieldState;\n checked: boolean;\n hovered?: boolean;\n pressed?: boolean;\n },\n): ResolvedSelectionControlColors {\n const semanticTone = resolveSurfaceColor(theme, fieldState.invalid ? 'error' : color);\n const isMuted = fieldState.disabled;\n const isInteractiveReadOnly = fieldState.readOnly && !fieldState.disabled;\n\n if (isMuted) {\n return {\n backgroundColor: checked\n ? theme.semantics.neutral.surfaceActive\n : theme.semantics.surface.subtle,\n borderColor: theme.semantics.border.default,\n indicatorColor: checked ? theme.semantics.content.muted : 'transparent',\n labelColor: theme.semantics.content.muted,\n trackColor: checked ? theme.semantics.neutral.surfaceActive : theme.semantics.neutral.border,\n thumbColor: theme.semantics.surface.default,\n opacity: 0.72,\n };\n }\n\n const uncheckedBorderColor = fieldState.invalid\n ? theme.semantics.error.outline\n : fieldState.focused\n ? theme.semantics.border.focus\n : theme.semantics.border.strong;\n const uncheckedBackgroundColor = pressed\n ? theme.semantics.neutral.surfaceActive\n : hovered\n ? theme.semantics.neutral.surfaceHover\n : theme.semantics.surface.default;\n const checkedBackgroundColor = pressed\n ? semanticTone.strong\n : hovered\n ? semanticTone.hover\n : semanticTone.base;\n const checkedTrackColor = pressed\n ? semanticTone.strong\n : hovered\n ? semanticTone.hover\n : semanticTone.base;\n\n return {\n backgroundColor: checked ? checkedBackgroundColor : uncheckedBackgroundColor,\n borderColor: checked ? semanticTone.base : uncheckedBorderColor,\n indicatorColor: checked ? semanticTone.onSolidText : 'transparent',\n labelColor: isInteractiveReadOnly\n ? theme.semantics.content.muted\n : theme.semantics.content.default,\n trackColor: checked ? checkedTrackColor : uncheckedBorderColor,\n thumbColor: checked ? semanticTone.onSolidText : theme.semantics.surface.default,\n opacity: isInteractiveReadOnly ? 0.88 : 1,\n };\n}\n"]}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { SurfaceColor } from '../../surfaceColor';
|
|
2
|
+
import type { RoleSemantics, SurfaceTheme } from '../../theme/types';
|
|
3
|
+
export declare function resolveSurfaceColor(theme: SurfaceTheme, color?: SurfaceColor): RoleSemantics;
|
|
4
|
+
//# sourceMappingURL=resolveSurfaceColor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveSurfaceColor.d.ts","sourceRoot":"","sources":["../../../src/internal/resolvers/resolveSurfaceColor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAErE,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,YAAY,EACnB,KAAK,GAAE,YAAwB,GAC9B,aAAa,CAwBf"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export function resolveSurfaceColor(theme, color = 'primary') {
|
|
2
|
+
switch (color) {
|
|
3
|
+
case 'secondary':
|
|
4
|
+
return theme.semantics.secondary;
|
|
5
|
+
case 'tertiary':
|
|
6
|
+
return theme.semantics.accent;
|
|
7
|
+
case 'quaternary':
|
|
8
|
+
return theme.semantics.highlight;
|
|
9
|
+
case 'neutral':
|
|
10
|
+
return theme.semantics.action.neutral;
|
|
11
|
+
case 'error':
|
|
12
|
+
return theme.semantics.error;
|
|
13
|
+
case 'info':
|
|
14
|
+
return theme.semantics.info;
|
|
15
|
+
case 'danger':
|
|
16
|
+
return theme.semantics.action.danger;
|
|
17
|
+
case 'success':
|
|
18
|
+
return theme.semantics.success;
|
|
19
|
+
case 'warning':
|
|
20
|
+
return theme.semantics.warning;
|
|
21
|
+
case 'primary':
|
|
22
|
+
default:
|
|
23
|
+
return theme.semantics.action.primary;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=resolveSurfaceColor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveSurfaceColor.js","sourceRoot":"","sources":["../../../src/internal/resolvers/resolveSurfaceColor.ts"],"names":[],"mappings":"AAGA,MAAM,UAAU,mBAAmB,CACjC,KAAmB,EACnB,QAAsB,SAAS;IAE/B,QAAQ,KAAK,EAAE,CAAC;QACd,KAAK,WAAW;YACd,OAAO,KAAK,CAAC,SAAS,CAAC,SAAS,CAAC;QACnC,KAAK,UAAU;YACb,OAAO,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC;QAChC,KAAK,YAAY;YACf,OAAO,KAAK,CAAC,SAAS,CAAC,SAAS,CAAC;QACnC,KAAK,SAAS;YACZ,OAAO,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,OAAO,CAAC;QACxC,KAAK,OAAO;YACV,OAAO,KAAK,CAAC,SAAS,CAAC,KAAK,CAAC;QAC/B,KAAK,MAAM;YACT,OAAO,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC;QAC9B,KAAK,QAAQ;YACX,OAAO,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,MAAM,CAAC;QACvC,KAAK,SAAS;YACZ,OAAO,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC;QACjC,KAAK,SAAS;YACZ,OAAO,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC;QACjC,KAAK,SAAS,CAAC;QACf;YACE,OAAO,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,OAAO,CAAC;IAC1C,CAAC;AACH,CAAC","sourcesContent":["import type { SurfaceColor } from '../../surfaceColor';\nimport type { RoleSemantics, SurfaceTheme } from '../../theme/types';\n\nexport function resolveSurfaceColor(\n theme: SurfaceTheme,\n color: SurfaceColor = 'primary',\n): 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 'neutral':\n return theme.semantics.action.neutral;\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 'primary':\n default:\n return theme.semantics.action.primary;\n }\n}\n"]}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
+
import type { SurfaceColor, SurfaceEmphasis } from '../../surfaceColor';
|
|
1
2
|
import type { SurfaceTheme } from '../../theme/types';
|
|
2
|
-
export
|
|
3
|
-
export type TextColorValue = keyof SurfaceTheme['colors'] | string;
|
|
4
|
-
export declare function resolveTextColor(theme: SurfaceTheme, tone?: TextTone, color?: TextColorValue): string;
|
|
3
|
+
export declare function resolveTextColor(theme: SurfaceTheme, emphasis?: SurfaceEmphasis, color?: SurfaceColor): string;
|
|
5
4
|
//# sourceMappingURL=resolveTextColor.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolveTextColor.d.ts","sourceRoot":"","sources":["../../../src/internal/resolvers/resolveTextColor.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"resolveTextColor.d.ts","sourceRoot":"","sources":["../../../src/internal/resolvers/resolveTextColor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACxE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAGtD,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,YAAY,EACnB,QAAQ,GAAE,eAA2B,EACrC,KAAK,CAAC,EAAE,YAAY,GACnB,MAAM,CAmBR"}
|
|
@@ -1,22 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export function resolveTextColor(theme,
|
|
1
|
+
import { resolveSurfaceColor } from './resolveSurfaceColor';
|
|
2
|
+
export function resolveTextColor(theme, emphasis = 'default', color) {
|
|
3
3
|
if (color) {
|
|
4
|
-
|
|
4
|
+
if (emphasis === 'inverse') {
|
|
5
|
+
return resolveSurfaceColor(theme, color).onSolidText;
|
|
6
|
+
}
|
|
7
|
+
return resolveSurfaceColor(theme, color).base;
|
|
5
8
|
}
|
|
6
|
-
switch (
|
|
9
|
+
switch (emphasis) {
|
|
7
10
|
case 'muted':
|
|
8
11
|
return theme.semantics.content.muted;
|
|
9
12
|
case 'subtle':
|
|
10
13
|
return theme.semantics.content.subtle;
|
|
11
14
|
case 'inverse':
|
|
12
15
|
return theme.semantics.content.inverse;
|
|
13
|
-
case 'danger':
|
|
14
|
-
return theme.semantics.danger.base;
|
|
15
|
-
case 'success':
|
|
16
|
-
return theme.semantics.success.base;
|
|
17
|
-
case 'warning':
|
|
18
|
-
return theme.semantics.warning.base;
|
|
19
|
-
case 'default':
|
|
20
16
|
default:
|
|
21
17
|
return theme.semantics.content.default;
|
|
22
18
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolveTextColor.js","sourceRoot":"","sources":["../../../src/internal/resolvers/resolveTextColor.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"resolveTextColor.js","sourceRoot":"","sources":["../../../src/internal/resolvers/resolveTextColor.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAE5D,MAAM,UAAU,gBAAgB,CAC9B,KAAmB,EACnB,WAA4B,SAAS,EACrC,KAAoB;IAEpB,IAAI,KAAK,EAAE,CAAC;QACV,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;YAC3B,OAAO,mBAAmB,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,WAAW,CAAC;QACvD,CAAC;QAED,OAAO,mBAAmB,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,IAAI,CAAC;IAChD,CAAC;IAED,QAAQ,QAAQ,EAAE,CAAC;QACjB,KAAK,OAAO;YACV,OAAO,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,KAAK,CAAC;QACvC,KAAK,QAAQ;YACX,OAAO,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,MAAM,CAAC;QACxC,KAAK,SAAS;YACZ,OAAO,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,OAAO,CAAC;QACzC;YACE,OAAO,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,OAAO,CAAC;IAC3C,CAAC;AACH,CAAC","sourcesContent":["import type { SurfaceColor, SurfaceEmphasis } from '../../surfaceColor';\nimport type { SurfaceTheme } from '../../theme/types';\nimport { resolveSurfaceColor } from './resolveSurfaceColor';\n\nexport function resolveTextColor(\n theme: SurfaceTheme,\n emphasis: SurfaceEmphasis = 'default',\n color?: SurfaceColor,\n): string {\n if (color) {\n if (emphasis === 'inverse') {\n return resolveSurfaceColor(theme, color).onSolidText;\n }\n\n return resolveSurfaceColor(theme, color).base;\n }\n\n switch (emphasis) {\n case 'muted':\n return theme.semantics.content.muted;\n case 'subtle':\n return theme.semantics.content.subtle;\n case 'inverse':\n return theme.semantics.content.inverse;\n default:\n return theme.semantics.content.default;\n }\n}\n"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type ScrollViewProps as ReactNativeScrollViewProps, type StyleProp, type ViewStyle } from 'react-native';
|
|
3
|
+
import { type BoxStyleProps } from './helpers';
|
|
4
|
+
export interface ScrollAreaProps extends BoxStyleProps, Omit<ReactNativeScrollViewProps, 'children' | 'contentContainerStyle' | 'style'> {
|
|
5
|
+
children?: React.ReactNode;
|
|
6
|
+
contentContainerStyle?: StyleProp<ViewStyle>;
|
|
7
|
+
}
|
|
8
|
+
export declare function ScrollArea({ children, contentContainerStyle, p, px, py, pt, pb, pl, pr, m, mx, my, mt, mb, ml, mr, bg, radius, borderWidth, borderColor, width, height, minWidth, maxWidth, minHeight, maxHeight, flex, flexGrow, flexShrink, flexBasis, alignSelf, position, top, bottom, left, right, overflow, zIndex, opacity, style, ...scrollProps }: ScrollAreaProps): React.JSX.Element;
|
|
9
|
+
//# sourceMappingURL=ScrollArea.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ScrollArea.d.ts","sourceRoot":"","sources":["../../src/layout/ScrollArea.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAEL,KAAK,eAAe,IAAI,0BAA0B,EAClD,KAAK,SAAS,EACd,KAAK,SAAS,EACf,MAAM,cAAc,CAAC;AAItB,OAAO,EAAE,KAAK,aAAa,EAAoB,MAAM,WAAW,CAAC;AAEjE,MAAM,WAAW,eACf,SACE,aAAa,EACb,IAAI,CAAC,0BAA0B,EAAE,UAAU,GAAG,uBAAuB,GAAG,OAAO,CAAC;IAClF,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,qBAAqB,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CAC9C;AAED,wBAAgB,UAAU,CAAC,EACzB,QAAQ,EACR,qBAAqB,EACrB,CAAC,EACD,EAAE,EACF,EAAE,EACF,EAAE,EACF,EAAE,EACF,EAAE,EACF,EAAE,EACF,CAAC,EACD,EAAE,EACF,EAAE,EACF,EAAE,EACF,EAAE,EACF,EAAE,EACF,EAAE,EACF,EAAE,EACF,MAAM,EACN,WAAW,EACX,WAAW,EACX,KAAK,EACL,MAAM,EACN,QAAQ,EACR,QAAQ,EACR,SAAS,EACT,SAAS,EACT,IAAI,EACJ,QAAQ,EACR,UAAU,EACV,SAAS,EACT,SAAS,EACT,QAAQ,EACR,GAAG,EACH,MAAM,EACN,IAAI,EACJ,KAAK,EACL,QAAQ,EACR,MAAM,EACN,OAAO,EACP,KAAK,EACL,GAAG,WAAW,EACf,EAAE,eAAe,qBAoDjB"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ScrollView, } from 'react-native';
|
|
3
|
+
import { useResponsiveRuntime } from '../core/responsive';
|
|
4
|
+
import { useTheme } from '../theme/ThemeContext';
|
|
5
|
+
import { resolveBoxStyles } from './helpers';
|
|
6
|
+
export function ScrollArea({ children, contentContainerStyle, p, px, py, pt, pb, pl, pr, m, mx, my, mt, mb, ml, mr, bg, radius, borderWidth, borderColor, width, height, minWidth, maxWidth, minHeight, maxHeight, flex, flexGrow, flexShrink, flexBasis, alignSelf, position, top, bottom, left, right, overflow, zIndex, opacity, style, ...scrollProps }) {
|
|
7
|
+
const { theme } = useTheme();
|
|
8
|
+
const { breakpoint } = useResponsiveRuntime();
|
|
9
|
+
const resolved = resolveBoxStyles(theme, breakpoint, {
|
|
10
|
+
p,
|
|
11
|
+
px,
|
|
12
|
+
py,
|
|
13
|
+
pt,
|
|
14
|
+
pb,
|
|
15
|
+
pl,
|
|
16
|
+
pr,
|
|
17
|
+
m,
|
|
18
|
+
mx,
|
|
19
|
+
my,
|
|
20
|
+
mt,
|
|
21
|
+
mb,
|
|
22
|
+
ml,
|
|
23
|
+
mr,
|
|
24
|
+
bg,
|
|
25
|
+
radius,
|
|
26
|
+
borderWidth,
|
|
27
|
+
borderColor,
|
|
28
|
+
width,
|
|
29
|
+
height,
|
|
30
|
+
minWidth,
|
|
31
|
+
maxWidth,
|
|
32
|
+
minHeight,
|
|
33
|
+
maxHeight,
|
|
34
|
+
flex,
|
|
35
|
+
flexGrow,
|
|
36
|
+
flexShrink,
|
|
37
|
+
flexBasis,
|
|
38
|
+
alignSelf,
|
|
39
|
+
position,
|
|
40
|
+
top,
|
|
41
|
+
bottom,
|
|
42
|
+
left,
|
|
43
|
+
right,
|
|
44
|
+
overflow,
|
|
45
|
+
zIndex,
|
|
46
|
+
opacity,
|
|
47
|
+
});
|
|
48
|
+
return (<ScrollView {...scrollProps} contentContainerStyle={contentContainerStyle} style={[resolved, style]}>
|
|
49
|
+
{children}
|
|
50
|
+
</ScrollView>);
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=ScrollArea.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ScrollArea.js","sourceRoot":"","sources":["../../src/layout/ScrollArea.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EACL,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QACJ,KAAK;QACL,QAAQ;QACR,MAAM;QACN,OAAO;KACR,CAAC,CAAC;IAEH,OAAO,CACL,CAAC,UAAU,CACT,IAAI,WAAW,CAAC,CAChB,qBAAqB,CAAC,CAAC,qBAAqB,CAAC,CAC7C,KAAK,CAAC,CAAC,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC,CAEzB;MAAA,CAAC,QAAQ,CACX;IAAA,EAAE,UAAU,CAAC,CACd,CAAC;AACJ,CAAC","sourcesContent":["import React from 'react';\nimport {\n ScrollView,\n type ScrollViewProps as ReactNativeScrollViewProps,\n type StyleProp,\n type ViewStyle,\n} from 'react-native';\n\nimport { useResponsiveRuntime } from '../core/responsive';\nimport { useTheme } from '../theme/ThemeContext';\nimport { type BoxStyleProps, resolveBoxStyles } from './helpers';\n\nexport interface ScrollAreaProps\n extends\n BoxStyleProps,\n Omit<ReactNativeScrollViewProps, 'children' | 'contentContainerStyle' | 'style'> {\n children?: React.ReactNode;\n contentContainerStyle?: StyleProp<ViewStyle>;\n}\n\nexport function ScrollArea({\n children,\n contentContainerStyle,\n p,\n px,\n py,\n pt,\n pb,\n pl,\n pr,\n m,\n mx,\n my,\n mt,\n mb,\n ml,\n mr,\n bg,\n radius,\n borderWidth,\n borderColor,\n width,\n height,\n minWidth,\n maxWidth,\n minHeight,\n maxHeight,\n flex,\n flexGrow,\n flexShrink,\n flexBasis,\n alignSelf,\n position,\n top,\n bottom,\n left,\n right,\n overflow,\n zIndex,\n opacity,\n style,\n ...scrollProps\n}: ScrollAreaProps) {\n const { theme } = useTheme();\n const { breakpoint } = useResponsiveRuntime();\n const resolved = resolveBoxStyles(theme, breakpoint, {\n p,\n px,\n py,\n pt,\n pb,\n pl,\n pr,\n m,\n mx,\n my,\n mt,\n mb,\n ml,\n mr,\n bg,\n radius,\n borderWidth,\n borderColor,\n width,\n height,\n minWidth,\n maxWidth,\n minHeight,\n maxHeight,\n flex,\n flexGrow,\n flexShrink,\n flexBasis,\n alignSelf,\n position,\n top,\n bottom,\n left,\n right,\n overflow,\n zIndex,\n opacity,\n });\n\n return (\n <ScrollView\n {...scrollProps}\n contentContainerStyle={contentContainerStyle}\n style={[resolved, style]}\n >\n {children}\n </ScrollView>\n );\n}\n"]}
|
package/dist/layout/index.d.ts
CHANGED
|
@@ -12,6 +12,8 @@ export type { GridProps } from './Grid';
|
|
|
12
12
|
export { Grid } from './Grid';
|
|
13
13
|
export type { InlineProps } from './Inline';
|
|
14
14
|
export { Inline } from './Inline';
|
|
15
|
+
export type { ScrollAreaProps } from './ScrollArea';
|
|
16
|
+
export { ScrollArea } from './ScrollArea';
|
|
15
17
|
export type { ShowProps } from './Show';
|
|
16
18
|
export { Show } from './Show';
|
|
17
19
|
export type { SpacerProps } from './Spacer';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/layout/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,YAAY,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAC5B,YAAY,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,YAAY,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,YAAY,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,YAAY,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACxC,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,YAAY,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,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C;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,YAAY,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,YAAY,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACxC,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,YAAY,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,YAAY,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAC1C,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,YAAY,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC9D,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,YAAY,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC"}
|
package/dist/layout/index.js
CHANGED
|
@@ -5,6 +5,7 @@ export { Container } from './Container';
|
|
|
5
5
|
export { Divider } from './Divider';
|
|
6
6
|
export { Grid } from './Grid';
|
|
7
7
|
export { Inline } from './Inline';
|
|
8
|
+
export { ScrollArea } from './ScrollArea';
|
|
8
9
|
export { Show } from './Show';
|
|
9
10
|
export { Spacer } from './Spacer';
|
|
10
11
|
export { Stack } from './Stack';
|
package/dist/layout/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/layout/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAE5B,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAE9B,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAE9B,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC","sourcesContent":["export type { AppBarProps } from './AppBar';\nexport { AppBar } from './AppBar';\nexport type { BoxProps } from './Box';\nexport { Box } from './Box';\nexport type { CenterProps } from './Center';\nexport { Center } from './Center';\nexport type { ContainerProps } from './Container';\nexport { Container } from './Container';\nexport type { DividerProps } from './Divider';\nexport { Divider } from './Divider';\nexport type { GridProps } from './Grid';\nexport { Grid } from './Grid';\nexport type { InlineProps } from './Inline';\nexport { Inline } from './Inline';\nexport type { ShowProps } from './Show';\nexport { Show } from './Show';\nexport type { SpacerProps } from './Spacer';\nexport { Spacer } from './Spacer';\nexport type { StackProps } from './Stack';\nexport { Stack } from './Stack';\nexport type { SurfaceProps, SurfaceVariant } from './Surface';\nexport { Surface } from './Surface';\nexport type { TemplateProps } from './Template';\nexport { Template } from './Template';\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/layout/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAE5B,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAE9B,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAE9B,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC","sourcesContent":["export type { AppBarProps } from './AppBar';\nexport { AppBar } from './AppBar';\nexport type { BoxProps } from './Box';\nexport { Box } from './Box';\nexport type { CenterProps } from './Center';\nexport { Center } from './Center';\nexport type { ContainerProps } from './Container';\nexport { Container } from './Container';\nexport type { DividerProps } from './Divider';\nexport { Divider } from './Divider';\nexport type { GridProps } from './Grid';\nexport { Grid } from './Grid';\nexport type { InlineProps } from './Inline';\nexport { Inline } from './Inline';\nexport type { ScrollAreaProps } from './ScrollArea';\nexport { ScrollArea } from './ScrollArea';\nexport type { ShowProps } from './Show';\nexport { Show } from './Show';\nexport type { SpacerProps } from './Spacer';\nexport { Spacer } from './Spacer';\nexport type { StackProps } from './Stack';\nexport { Stack } from './Stack';\nexport type { SurfaceProps, SurfaceVariant } from './Surface';\nexport { Surface } from './Surface';\nexport type { TemplateProps } from './Template';\nexport { Template } from './Template';\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Heading.d.ts","sourceRoot":"","sources":["../../../src/primitives/heading/Heading.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAM1B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AA8B5C,eAAO,MAAM,OAAO,EAAE,KAAK,CAAC,EAAE,CAAC,YAAY,
|
|
1
|
+
{"version":3,"file":"Heading.d.ts","sourceRoot":"","sources":["../../../src/primitives/heading/Heading.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAM1B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AA8B5C,eAAO,MAAM,OAAO,EAAE,KAAK,CAAC,EAAE,CAAC,YAAY,CAyB1C,CAAC"}
|
|
@@ -19,11 +19,11 @@ function resolveHeadingContent({ text, children, i18nKey, translate, }) {
|
|
|
19
19
|
}
|
|
20
20
|
return content;
|
|
21
21
|
}
|
|
22
|
-
export const Heading = ({ text, children, level = 2, align, numberOfLines, i18nKey, testID, }) => {
|
|
22
|
+
export const Heading = ({ text, children, level = 2, align, color, emphasis = 'default', numberOfLines, i18nKey, testID, }) => {
|
|
23
23
|
const { theme } = useTheme();
|
|
24
24
|
const { t } = useTranslationContext();
|
|
25
25
|
const content = resolveHeadingContent({ text, children, i18nKey, translate: t });
|
|
26
|
-
return (<Text accessibilityRole="header" testID={testID} numberOfLines={numberOfLines} style={resolveHeadingTextStyle(theme, level, align)}>
|
|
26
|
+
return (<Text accessibilityRole="header" testID={testID} numberOfLines={numberOfLines} style={resolveHeadingTextStyle(theme, level, align, emphasis, color)}>
|
|
27
27
|
{content}
|
|
28
28
|
</Text>);
|
|
29
29
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Heading.js","sourceRoot":"","sources":["../../../src/primitives/heading/Heading.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEpC,OAAO,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AACzE,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACpD,OAAO,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAGhE,SAAS,qBAAqB,CAAC,EAC7B,IAAI,EACJ,QAAQ,EACR,OAAO,EACP,SAAS,GAMV;IACC,IAAI,OAAO,GA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E,KAAK,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC,CAErE;MAAA,CAAC,OAAO,CACV;IAAA,EAAE,IAAI,CAAC,CACR,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import React from 'react';\nimport { Text } from 'react-native';\n\nimport { useTranslationContext } from '../../context/TranslationContext';\nimport { useTheme } from '../../theme/ThemeContext';\nimport { resolveHeadingTextStyle } from './resolveHeadingStyle';\nimport type { HeadingProps } from './types';\n\nfunction resolveHeadingContent({\n text,\n children,\n i18nKey,\n translate,\n}: {\n text: HeadingProps['text'];\n children: HeadingProps['children'];\n i18nKey: HeadingProps['i18nKey'];\n translate: (key: string) => string;\n}) {\n let content = text ?? children;\n if (!i18nKey) {\n return content;\n }\n\n try {\n const translated = translate(i18nKey);\n if (translated && translated !== i18nKey) {\n content = translated;\n }\n } catch (error) {\n console.warn('[Heading] Translation error:', error);\n }\n\n return content;\n}\n\nexport const Heading: React.FC<HeadingProps> = ({\n text,\n children,\n level = 2,\n align,\n color,\n emphasis = 'default',\n numberOfLines,\n i18nKey,\n testID,\n}) => {\n const { theme } = useTheme();\n const { t } = useTranslationContext();\n const content = resolveHeadingContent({ text, children, i18nKey, translate: t });\n\n return (\n <Text\n accessibilityRole=\"header\"\n testID={testID}\n numberOfLines={numberOfLines}\n style={resolveHeadingTextStyle(theme, level, align, emphasis, color)}\n >\n {content}\n </Text>\n );\n};\n"]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { TextStyle } from 'react-native';
|
|
2
|
+
import type { SurfaceColor, SurfaceEmphasis } from '../../surfaceColor';
|
|
2
3
|
import type { SurfaceTheme } from '../../theme/types';
|
|
3
4
|
import type { HeadingLevel, HeadingProps } from './types';
|
|
4
|
-
export declare function resolveHeadingTextStyle(theme: SurfaceTheme, level: HeadingLevel, align?: HeadingProps['align']): TextStyle;
|
|
5
|
+
export declare function resolveHeadingTextStyle(theme: SurfaceTheme, level: HeadingLevel, align?: HeadingProps['align'], emphasis?: SurfaceEmphasis, color?: SurfaceColor): TextStyle;
|
|
5
6
|
//# sourceMappingURL=resolveHeadingStyle.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolveHeadingStyle.d.ts","sourceRoot":"","sources":["../../../src/primitives/heading/resolveHeadingStyle.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAI9C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE1D,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,YAAY,EACnB,KAAK,EAAE,YAAY,EACnB,KAAK,CAAC,EAAE,YAAY,CAAC,OAAO,CAAC,
|
|
1
|
+
{"version":3,"file":"resolveHeadingStyle.d.ts","sourceRoot":"","sources":["../../../src/primitives/heading/resolveHeadingStyle.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAI9C,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACxE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE1D,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,YAAY,EACnB,KAAK,EAAE,YAAY,EACnB,KAAK,CAAC,EAAE,YAAY,CAAC,OAAO,CAAC,EAC7B,QAAQ,GAAE,eAA2B,EACrC,KAAK,CAAC,EAAE,YAAY,GACnB,SAAS,CAKX"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { resolveTextColor } from '../../internal/resolvers/resolveTextColor';
|
|
2
2
|
import { resolveTextStyles } from '../../internal/resolvers/resolveTextStyles';
|
|
3
|
-
export function resolveHeadingTextStyle(theme, level, align) {
|
|
3
|
+
export function resolveHeadingTextStyle(theme, level, align, emphasis = 'default', color) {
|
|
4
4
|
return {
|
|
5
5
|
...resolveTextStyles(theme, { align, level }),
|
|
6
|
-
color: resolveTextColor(theme,
|
|
6
|
+
color: resolveTextColor(theme, emphasis, color),
|
|
7
7
|
};
|
|
8
8
|
}
|
|
9
9
|
//# sourceMappingURL=resolveHeadingStyle.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolveHeadingStyle.js","sourceRoot":"","sources":["../../../src/primitives/heading/resolveHeadingStyle.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,2CAA2C,CAAC;AAC7E,OAAO,EAAE,iBAAiB,EAAE,MAAM,4CAA4C,CAAC;
|
|
1
|
+
{"version":3,"file":"resolveHeadingStyle.js","sourceRoot":"","sources":["../../../src/primitives/heading/resolveHeadingStyle.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,2CAA2C,CAAC;AAC7E,OAAO,EAAE,iBAAiB,EAAE,MAAM,4CAA4C,CAAC;AAK/E,MAAM,UAAU,uBAAuB,CACrC,KAAmB,EACnB,KAAmB,EACnB,KAA6B,EAC7B,WAA4B,SAAS,EACrC,KAAoB;IAEpB,OAAO;QACL,GAAG,iBAAiB,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;QAC7C,KAAK,EAAE,gBAAgB,CAAC,KAAK,EAAE,QAAQ,EAAE,KAAK,CAAC;KAChD,CAAC;AACJ,CAAC","sourcesContent":["import type { TextStyle } from 'react-native';\n\nimport { resolveTextColor } from '../../internal/resolvers/resolveTextColor';\nimport { resolveTextStyles } from '../../internal/resolvers/resolveTextStyles';\nimport type { SurfaceColor, SurfaceEmphasis } from '../../surfaceColor';\nimport type { SurfaceTheme } from '../../theme/types';\nimport type { HeadingLevel, HeadingProps } from './types';\n\nexport function resolveHeadingTextStyle(\n theme: SurfaceTheme,\n level: HeadingLevel,\n align?: HeadingProps['align'],\n emphasis: SurfaceEmphasis = 'default',\n color?: SurfaceColor,\n): TextStyle {\n return {\n ...resolveTextStyles(theme, { align, level }),\n color: resolveTextColor(theme, emphasis, color),\n };\n}\n"]}
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
|
+
import type { SurfaceColor, SurfaceEmphasis } from '../../surfaceColor';
|
|
2
3
|
export type HeadingLevel = 1 | 2 | 3 | 4 | 5 | 6;
|
|
3
4
|
export interface HeadingProps {
|
|
4
5
|
text?: string;
|
|
5
6
|
children?: React.ReactNode;
|
|
6
7
|
level?: HeadingLevel;
|
|
7
8
|
align?: 'auto' | 'left' | 'right' | 'center' | 'justify';
|
|
9
|
+
color?: SurfaceColor;
|
|
10
|
+
emphasis?: SurfaceEmphasis;
|
|
8
11
|
numberOfLines?: number;
|
|
9
12
|
i18nKey?: string;
|
|
10
13
|
testID?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/primitives/heading/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,MAAM,MAAM,YAAY,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAEjD,MAAM,WAAW,YAAY;IAC3B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,KAAK,CAAC,EAAE,YAAY,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,GAAG,SAAS,CAAC;IACzD,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB"}
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/primitives/heading/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAExE,MAAM,MAAM,YAAY,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAEjD,MAAM,WAAW,YAAY;IAC3B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,KAAK,CAAC,EAAE,YAAY,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,GAAG,SAAS,CAAC;IACzD,KAAK,CAAC,EAAE,YAAY,CAAC;IACrB,QAAQ,CAAC,EAAE,eAAe,CAAC;IAC3B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/primitives/heading/types.ts"],"names":[],"mappings":"","sourcesContent":["import type React from 'react';\n\nexport type HeadingLevel = 1 | 2 | 3 | 4 | 5 | 6;\n\nexport interface HeadingProps {\n text?: string;\n children?: React.ReactNode;\n level?: HeadingLevel;\n align?: 'auto' | 'left' | 'right' | 'center' | 'justify';\n numberOfLines?: number;\n i18nKey?: string;\n testID?: string;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/primitives/heading/types.ts"],"names":[],"mappings":"","sourcesContent":["import type React from 'react';\n\nimport type { SurfaceColor, SurfaceEmphasis } from '../../surfaceColor';\n\nexport type HeadingLevel = 1 | 2 | 3 | 4 | 5 | 6;\n\nexport interface HeadingProps {\n text?: string;\n children?: React.ReactNode;\n level?: HeadingLevel;\n align?: 'auto' | 'left' | 'right' | 'center' | 'justify';\n color?: SurfaceColor;\n emphasis?: SurfaceEmphasis;\n numberOfLines?: number;\n i18nKey?: string;\n testID?: string;\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { TextProps } from './types';
|
|
3
|
-
export declare function Text({ children, i18nKey, variant,
|
|
3
|
+
export declare function Text({ children, i18nKey, variant, emphasis, color, align, weight, italic, numberOfLines, testID, }: TextProps): React.JSX.Element;
|
|
4
4
|
//# sourceMappingURL=Text.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Text.d.ts","sourceRoot":"","sources":["../../../src/primitives/text/Text.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAM1B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAwBzC,wBAAgB,IAAI,CAAC,EACnB,QAAQ,EACR,OAAO,EACP,OAAgB,EAChB,
|
|
1
|
+
{"version":3,"file":"Text.d.ts","sourceRoot":"","sources":["../../../src/primitives/text/Text.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAM1B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAwBzC,wBAAgB,IAAI,CAAC,EACnB,QAAQ,EACR,OAAO,EACP,OAAgB,EAChB,QAAoB,EACpB,KAAK,EACL,KAAK,EACL,MAAM,EACN,MAAc,EACd,aAAa,EACb,MAAM,GACP,EAAE,SAAS,qBAwBX"}
|
|
@@ -19,7 +19,7 @@ function resolveTextContent(children, i18nKey, translate) {
|
|
|
19
19
|
return i18nKey;
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
|
-
export function Text({ children, i18nKey, variant = 'body',
|
|
22
|
+
export function Text({ children, i18nKey, variant = 'body', emphasis = 'default', color, align, weight, italic = false, numberOfLines, testID, }) {
|
|
23
23
|
const { theme } = useTheme();
|
|
24
24
|
const { t } = useTranslationContext();
|
|
25
25
|
const content = resolveTextContent(children, i18nKey, t);
|
|
@@ -31,7 +31,7 @@ export function Text({ children, i18nKey, variant = 'body', tone = 'default', co
|
|
|
31
31
|
weight,
|
|
32
32
|
}),
|
|
33
33
|
{
|
|
34
|
-
color: resolveTextColor(theme,
|
|
34
|
+
color: resolveTextColor(theme, emphasis, color),
|
|
35
35
|
},
|
|
36
36
|
]}>
|
|
37
37
|
{content}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Text.js","sourceRoot":"","sources":["../../../src/primitives/text/Text.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,IAAI,IAAI,eAAe,EAAE,MAAM,cAAc,CAAC;AAEvD,OAAO,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AACzE,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC/E,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAGpD,SAAS,kBAAkB,CACzB,QAA+B,EAC/B,OAA6B,EAC7B,SAAkC;IAElC,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;QAC3B,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAI,CAAC;QACH,MAAM,UAAU,GAAG,SAAS,CAAC,OAAO,CAAC,CAAC;QACtC,OAAO,UAAU,IAAI,UAAU,KAAK,OAAO,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC;IACrE,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,IAAI,CAAC,2BAA2B,EAAE,KAAK,CAAC,CAAC;QACjD,OAAO,OAAO,CAAC;IACjB,CAAC;AACH,CAAC;AAED,MAAM,UAAU,IAAI,CAAC,EACnB,QAAQ,EACR,OAAO,EACP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BAAkB,CAAC,QAAQ,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC;IAEzD,OAAO,CACL,CAAC,eAAe,CACd,aAAa,CAAC,CAAC,aAAa,CAAC,CAC7B,MAAM,CAAC,CAAC,MAAM,CAAC,CACf,KAAK,CAAC,CAAC;YACL,iBAAiB,CAAC,KAAK,EAAE;gBACvB,KAAK;gBACL,MAAM;gBACN,OAAO;gBACP,MAAM;aACP,CAAC;YACF;gBACE,KAAK,EAAE,gBAAgB,CAAC,KAAK,EAAE,QAAQ,EAAE,KAAK,CAAC;aAChD;SACF,CAAC,CAEF;MAAA,CAAC,OAAO,CACV;IAAA,EAAE,eAAe,CAAC,CACnB,CAAC;AACJ,CAAC","sourcesContent":["import React from 'react';\nimport { Text as ReactNativeText } from 'react-native';\n\nimport { useTranslationContext } from '../../context/TranslationContext';\nimport { resolveTextColor, resolveTextStyles } from '../../internal/resolvers';\nimport { useTheme } from '../../theme/ThemeContext';\nimport type { TextProps } from './types';\n\nfunction resolveTextContent(\n children: TextProps['children'],\n i18nKey: TextProps['i18nKey'],\n translate: (key: string) => string,\n) {\n if (children !== undefined) {\n return children;\n }\n\n if (!i18nKey) {\n return null;\n }\n\n try {\n const translated = translate(i18nKey);\n return translated && translated !== i18nKey ? translated : i18nKey;\n } catch (error) {\n console.warn('[Text] Translation error:', error);\n return i18nKey;\n }\n}\n\nexport function Text({\n children,\n i18nKey,\n variant = 'body',\n emphasis = 'default',\n color,\n align,\n weight,\n italic = false,\n numberOfLines,\n testID,\n}: TextProps) {\n const { theme } = useTheme();\n const { t } = useTranslationContext();\n const content = resolveTextContent(children, i18nKey, t);\n\n return (\n <ReactNativeText\n numberOfLines={numberOfLines}\n testID={testID}\n style={[\n resolveTextStyles(theme, {\n align,\n italic,\n variant,\n weight,\n }),\n {\n color: resolveTextColor(theme, emphasis, color),\n },\n ]}\n >\n {content}\n </ReactNativeText>\n );\n}\n"]}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
2
|
import type { TextStyle } from 'react-native';
|
|
3
|
-
import type { TextColorValue, TextTone } from '../../internal/resolvers/resolveTextColor';
|
|
4
3
|
import type { TextVariant, TextWeight } from '../../internal/resolvers/resolveTextStyles';
|
|
4
|
+
import type { SurfaceColor, SurfaceEmphasis } from '../../surfaceColor';
|
|
5
5
|
export interface TextProps {
|
|
6
6
|
children?: React.ReactNode;
|
|
7
7
|
i18nKey?: string;
|
|
8
8
|
variant?: TextVariant;
|
|
9
|
-
|
|
10
|
-
color?:
|
|
9
|
+
emphasis?: SurfaceEmphasis;
|
|
10
|
+
color?: SurfaceColor;
|
|
11
11
|
align?: TextStyle['textAlign'];
|
|
12
12
|
weight?: TextWeight;
|
|
13
13
|
italic?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/primitives/text/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9C,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/primitives/text/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9C,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,4CAA4C,CAAC;AAC1F,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAExE,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB,QAAQ,CAAC,EAAE,eAAe,CAAC;IAC3B,KAAK,CAAC,EAAE,YAAY,CAAC;IACrB,KAAK,CAAC,EAAE,SAAS,CAAC,WAAW,CAAC,CAAC;IAC/B,MAAM,CAAC,EAAE,UAAU,CAAC;IACpB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/primitives/text/types.ts"],"names":[],"mappings":"","sourcesContent":["import type React from 'react';\nimport type { TextStyle } from 'react-native';\n\nimport type {
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/primitives/text/types.ts"],"names":[],"mappings":"","sourcesContent":["import type React from 'react';\nimport type { TextStyle } from 'react-native';\n\nimport type { TextVariant, TextWeight } from '../../internal/resolvers/resolveTextStyles';\nimport type { SurfaceColor, SurfaceEmphasis } from '../../surfaceColor';\n\nexport interface TextProps {\n children?: React.ReactNode;\n i18nKey?: string;\n variant?: TextVariant;\n emphasis?: SurfaceEmphasis;\n color?: SurfaceColor;\n align?: TextStyle['textAlign'];\n weight?: TextWeight;\n italic?: boolean;\n numberOfLines?: number;\n testID?: string;\n}\n"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const SURFACE_PALETTE_COLORS: readonly ["primary", "secondary", "tertiary", "quaternary", "neutral"];
|
|
2
|
+
export declare const SURFACE_STATUS_COLORS: readonly ["success", "warning", "error", "info"];
|
|
3
|
+
export declare const SURFACE_COLORS: readonly ["primary", "secondary", "tertiary", "quaternary", "neutral", "success", "warning", "error", "info", "danger"];
|
|
4
|
+
export declare const SURFACE_EMPHASES: readonly ["default", "muted", "subtle", "inverse"];
|
|
5
|
+
export type SurfacePaletteColor = (typeof SURFACE_PALETTE_COLORS)[number];
|
|
6
|
+
export type SurfaceStatusColor = (typeof SURFACE_STATUS_COLORS)[number];
|
|
7
|
+
export type SurfaceColor = (typeof SURFACE_COLORS)[number];
|
|
8
|
+
export type SurfaceEmphasis = (typeof SURFACE_EMPHASES)[number];
|
|
9
|
+
//# sourceMappingURL=surfaceColor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"surfaceColor.d.ts","sourceRoot":"","sources":["../src/surfaceColor.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,sBAAsB,wEAMzB,CAAC;AAEX,eAAO,MAAM,qBAAqB,kDAAmD,CAAC;AAEtF,eAAO,MAAM,cAAc,yHAIjB,CAAC;AAEX,eAAO,MAAM,gBAAgB,oDAAqD,CAAC;AAEnF,MAAM,MAAM,mBAAmB,GAAG,CAAC,OAAO,sBAAsB,CAAC,CAAC,MAAM,CAAC,CAAC;AAC1E,MAAM,MAAM,kBAAkB,GAAG,CAAC,OAAO,qBAAqB,CAAC,CAAC,MAAM,CAAC,CAAC;AACxE,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,CAAC,CAAC;AAC3D,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,CAAC,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export const SURFACE_PALETTE_COLORS = [
|
|
2
|
+
'primary',
|
|
3
|
+
'secondary',
|
|
4
|
+
'tertiary',
|
|
5
|
+
'quaternary',
|
|
6
|
+
'neutral',
|
|
7
|
+
];
|
|
8
|
+
export const SURFACE_STATUS_COLORS = ['success', 'warning', 'error', 'info'];
|
|
9
|
+
export const SURFACE_COLORS = [
|
|
10
|
+
...SURFACE_PALETTE_COLORS,
|
|
11
|
+
...SURFACE_STATUS_COLORS,
|
|
12
|
+
'danger',
|
|
13
|
+
];
|
|
14
|
+
export const SURFACE_EMPHASES = ['default', 'muted', 'subtle', 'inverse'];
|
|
15
|
+
//# sourceMappingURL=surfaceColor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"surfaceColor.js","sourceRoot":"","sources":["../src/surfaceColor.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACpC,SAAS;IACT,WAAW;IACX,UAAU;IACV,YAAY;IACZ,SAAS;CACD,CAAC;AAEX,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,CAAU,CAAC;AAEtF,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,GAAG,sBAAsB;IACzB,GAAG,qBAAqB;IACxB,QAAQ;CACA,CAAC;AAEX,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,CAAU,CAAC","sourcesContent":["export const SURFACE_PALETTE_COLORS = [\n 'primary',\n 'secondary',\n 'tertiary',\n 'quaternary',\n 'neutral',\n] as const;\n\nexport const SURFACE_STATUS_COLORS = ['success', 'warning', 'error', 'info'] as const;\n\nexport const SURFACE_COLORS = [\n ...SURFACE_PALETTE_COLORS,\n ...SURFACE_STATUS_COLORS,\n 'danger',\n] as const;\n\nexport const SURFACE_EMPHASES = ['default', 'muted', 'subtle', 'inverse'] as const;\n\nexport type SurfacePaletteColor = (typeof SURFACE_PALETTE_COLORS)[number];\nexport type SurfaceStatusColor = (typeof SURFACE_STATUS_COLORS)[number];\nexport type SurfaceColor = (typeof SURFACE_COLORS)[number];\nexport type SurfaceEmphasis = (typeof SURFACE_EMPHASES)[number];\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"colorEngine.d.ts","sourceRoot":"","sources":["../../src/theme/colorEngine.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,wBAAwB,EACxB,sBAAsB,EACtB,QAAQ,EACR,yBAAyB,EACzB,kBAAkB,EACnB,MAAM,yBAAyB,CAAC;AAOjC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAExD,OAAO,KAAK,EAOV,cAAc,EACf,MAAM,SAAS,CAAC;AAEjB;;;GAGG;AACH,MAAM,MAAM,qBAAqB,GAAG,MAAM,CAAC,kBAAkB,EAAE,QAAQ,CAAC,CAAC;AAEzE,wBAAgB,qBAAqB,CACnC,SAAS,EAAE,wBAAwB,EACnC,UAAU,EAAE,yBAAyB,GACpC,qBAAqB,CAUvB;AA8DD,wBAAgB,eAAe,CAC7B,MAAM,EAAE,WAAW,EACnB,IAAI,GAAE,OAAO,GAAG,MAAgB,GAC/B;IACD,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/B,QAAQ,EAAE,sBAAsB,CAAC;IACjC,SAAS,EAAE,cAAc,CAAC;CAC3B,
|
|
1
|
+
{"version":3,"file":"colorEngine.d.ts","sourceRoot":"","sources":["../../src/theme/colorEngine.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,wBAAwB,EACxB,sBAAsB,EACtB,QAAQ,EACR,yBAAyB,EACzB,kBAAkB,EACnB,MAAM,yBAAyB,CAAC;AAOjC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAExD,OAAO,KAAK,EAOV,cAAc,EACf,MAAM,SAAS,CAAC;AAEjB;;;GAGG;AACH,MAAM,MAAM,qBAAqB,GAAG,MAAM,CAAC,kBAAkB,EAAE,QAAQ,CAAC,CAAC;AAEzE,wBAAgB,qBAAqB,CACnC,SAAS,EAAE,wBAAwB,EACnC,UAAU,EAAE,yBAAyB,GACpC,qBAAqB,CAUvB;AA8DD,wBAAgB,eAAe,CAC7B,MAAM,EAAE,WAAW,EACnB,IAAI,GAAE,OAAO,GAAG,MAAgB,GAC/B;IACD,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/B,QAAQ,EAAE,sBAAsB,CAAC;IACjC,SAAS,EAAE,cAAc,CAAC;CAC3B,CA4FA"}
|
|
@@ -82,6 +82,9 @@ export function generatePalette(config, mode = 'light') {
|
|
|
82
82
|
const danger = buildRoleSemantics(semanticStatusSwatches.danger, isDark);
|
|
83
83
|
const success = buildRoleSemantics(semanticStatusSwatches.success, isDark);
|
|
84
84
|
const warning = buildRoleSemantics(semanticStatusSwatches.warning, isDark);
|
|
85
|
+
// Keep destructive action and feedback error aligned until a dedicated error status swatch is introduced.
|
|
86
|
+
const error = danger;
|
|
87
|
+
const info = buildRoleSemantics(secondarySwatch, isDark);
|
|
85
88
|
const surfaceSemantics = {
|
|
86
89
|
default: neutral.surface,
|
|
87
90
|
subtle: neutral.bgSubtle,
|
|
@@ -108,14 +111,17 @@ export function generatePalette(config, mode = 'light') {
|
|
|
108
111
|
secondary: secondarySwatch[500],
|
|
109
112
|
accent: tertiarySwatch[500],
|
|
110
113
|
highlight: quaternarySwatch[500],
|
|
114
|
+
tertiary: tertiarySwatch[500],
|
|
115
|
+
quaternary: quaternarySwatch[500],
|
|
111
116
|
background: neutral.bg,
|
|
112
117
|
surface: neutral.surface,
|
|
113
118
|
text: neutral.text,
|
|
114
119
|
textSecondary: neutral.textMuted,
|
|
115
120
|
border: neutral.border,
|
|
116
|
-
error:
|
|
121
|
+
error: error.base,
|
|
117
122
|
success: success.base,
|
|
118
123
|
warning: warning.base,
|
|
124
|
+
info: info.base,
|
|
119
125
|
};
|
|
120
126
|
return {
|
|
121
127
|
colors,
|
|
@@ -129,6 +135,8 @@ export function generatePalette(config, mode = 'light') {
|
|
|
129
135
|
danger,
|
|
130
136
|
success,
|
|
131
137
|
warning,
|
|
138
|
+
error,
|
|
139
|
+
info,
|
|
132
140
|
surface: surfaceSemantics,
|
|
133
141
|
content,
|
|
134
142
|
border,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"colorEngine.js","sourceRoot":"","sources":["../../src/theme/colorEngine.ts"],"names":[],"mappings":"AAQA,OAAO,EACL,mCAAmC,EACnC,uBAAuB,EACvB,qBAAqB,EACrB,oBAAoB,GACrB,MAAM,yBAAyB,CAAC;AAmBjC,MAAM,UAAU,qBAAqB,CACnC,SAAm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AAM;YACN,OAAO;YACP,OAAO;YACP,OAAO,EAAE,gBAAgB;YACzB,OAAO;YACP,MAAM;YACN,MAAM;SACP;KACF,CAAC;AACJ,CAAC","sourcesContent":["import type {\n ColorSwatch,\n GeneratedThemeModeColors,\n GeneratedThemeSwatches,\n HexColor,\n SemanticColorReferenceMap,\n SemanticColorToken,\n} from '@ankhorage/color-theory';\nimport {\n createDefaultSemanticStatusSwatches,\n generateThemeModeColors,\n getReadableForeground,\n parseHexColorOrThrow,\n} from '@ankhorage/color-theory';\nimport type { ThemeConfig } from '@ankhorage/contracts';\n\nimport type {\n ActionSemantics,\n BorderSemantics,\n ContentSemantics,\n NeutralSemantics,\n RoleSemantics,\n SurfaceSemantics,\n ThemeSemantics,\n} from './types';\n\n/**\n * Surface semantic resolver: maps color-theory SemanticColorToken references\n * to hex values from the generated swatches.\n */\nexport type SurfaceSemanticColors = Record<SemanticColorToken, HexColor>;\n\nexport function resolveSemanticColors(\n generated: GeneratedThemeModeColors,\n references: SemanticColorReferenceMap,\n): SurfaceSemanticColors {\n return Object.fromEntries(\n Object.entries(references).map(([token, ref]) => {\n const swatch = generated.swatches[ref.role];\n if (!swatch) {\n throw new Error(`Missing swatch for role '${ref.role}' (token: '${token}')`);\n }\n return [token, swatch[ref.step]];\n }),\n ) as SurfaceSemanticColors;\n}\n\nfunction buildNeutralSemantics(neutralSwatch: ColorSwatch, isDark: boolean): NeutralSemantics {\n if (isDark) {\n return {\n bg: neutralSwatch[950],\n bgSubtle: neutralSwatch[900],\n surface: neutralSwatch[900],\n surfaceHover: neutralSwatch[800],\n surfaceActive: neutralSwatch[700],\n border: neutralSwatch[800],\n borderStrong: neutralSwatch[600],\n divider: neutralSwatch[800],\n text: neutralSwatch[50],\n textMuted: neutralSwatch[200],\n textSubtle: neutralSwatch[300],\n };\n }\n return {\n bg: neutralSwatch[50],\n bgSubtle: neutralSwatch[100],\n surface: neutralSwatch[100],\n surfaceHover: neutralSwatch[200],\n surfaceActive: neutralSwatch[300],\n border: neutralSwatch[200],\n borderStrong: neutralSwatch[300],\n divider: neutralSwatch[200],\n text: neutralSwatch[900],\n textMuted: neutralSwatch[700],\n textSubtle: neutralSwatch[600],\n };\n}\n\nfunction buildRoleSemantics(swatch: ColorSwatch, isDark: boolean): RoleSemantics {\n const base = swatch[500];\n const { foreground: onSolidText } = getReadableForeground(base);\n\n if (isDark) {\n return {\n base,\n hover: swatch[400],\n strong: swatch[300],\n softBg: swatch[900],\n softHover: swatch[800],\n softActive: swatch[700],\n outline: swatch[500],\n onSolidText,\n };\n }\n\n return {\n base,\n hover: swatch[600],\n strong: swatch[700],\n softBg: swatch[100],\n softHover: swatch[200],\n softActive: swatch[300],\n outline: swatch[400],\n onSolidText,\n };\n}\n\nexport function generatePalette(\n config: ThemeConfig,\n mode: 'light' | 'dark' = 'light',\n): {\n colors: Record<string, string>;\n swatches: GeneratedThemeSwatches;\n semantics: ThemeSemantics;\n} {\n const modeConfig = mode === 'dark' ? config.dark : config.light;\n const isDark = mode === 'dark';\n\n // Throws deterministically on invalid primary color\n parseHexColorOrThrow(modeConfig.primaryColor);\n\n const generated = generateThemeModeColors(modeConfig);\n\n const { swatches } = generated;\n const neutralSwatch = swatches.neutral;\n\n const neutral = buildNeutralSemantics(neutralSwatch, isDark);\n const brand = buildRoleSemantics(swatches.primary, isDark);\n\n // Fallback to primary swatch for missing ordinal roles\n const secondarySwatch = swatches.secondary ?? swatches.primary;\n const tertiarySwatch = swatches.tertiary ?? swatches.primary;\n const quaternarySwatch = swatches.quaternary ?? swatches.primary;\n\n const semanticStatusSwatches = createDefaultSemanticStatusSwatches().swatches;\n\n const danger = buildRoleSemantics(semanticStatusSwatches.danger, isDark);\n const success = buildRoleSemantics(semanticStatusSwatches.success, isDark);\n const warning = buildRoleSemantics(semanticStatusSwatches.warning, isDark);\n\n const surfaceSemantics: SurfaceSemantics = {\n default: neutral.surface,\n subtle: neutral.bgSubtle,\n raised: neutral.surface,\n };\n\n const content: ContentSemantics = {\n default: neutral.text,\n muted: neutral.textMuted,\n subtle: neutral.textSubtle,\n inverse: brand.onSolidText,\n };\n\n const border: BorderSemantics = {\n default: neutral.border,\n strong: neutral.borderStrong,\n focus: brand.outline,\n };\n\n const action: ActionSemantics = {\n primary: brand,\n neutral: buildRoleSemantics(neutralSwatch, isDark),\n danger,\n };\n\n const colors: Record<string, string> = {\n primary: brand.base,\n secondary: secondarySwatch[500],\n accent: tertiarySwatch[500],\n highlight: quaternarySwatch[500],\n background: neutral.bg,\n surface: neutral.surface,\n text: neutral.text,\n textSecondary: neutral.textMuted,\n border: neutral.border,\n error: danger.base,\n success: success.base,\n warning: warning.base,\n };\n\n return {\n colors,\n swatches,\n semantics: {\n neutral,\n brand,\n secondary: buildRoleSemantics(secondarySwatch, isDark),\n accent: buildRoleSemantics(tertiarySwatch, isDark),\n highlight: buildRoleSemantics(quaternarySwatch, isDark),\n danger,\n success,\n warning,\n surface: surfaceSemantics,\n content,\n border,\n action,\n },\n };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"colorEngine.js","sourceRoot":"","sources":["../../src/theme/colorEngine.ts"],"names":[],"mappings":"AAQA,OAAO,EACL,mCAAmC,EACnC,uBAAuB,EACvB,qBAAqB,EACrB,oBAAoB,GACrB,MAAM,yBAAyB,CAAC;AAmBjC,MAAM,UAAU,qBAAqB,CACnC,SAAmC,EACnC,UAAqC;IAErC,OAAO,MAAM,CAAC,WAAW,CACvB,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,EAAE,GAAG,CAAC,EAAE,EAAE;QAC9C,MAAM,MAAM,GAAG,SAAS,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAC5C,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,MAAM,IAAI,KAAK,CAAC,4BAA4B,GAAG,CAAC,IAAI,cAAc,KAAK,IAAI,CAAC,CAAC;QAC/E,CAAC;QACD,OAAO,CAAC,KAAK,EAAE,M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Swatch,\n GeneratedThemeModeColors,\n GeneratedThemeSwatches,\n HexColor,\n SemanticColorReferenceMap,\n SemanticColorToken,\n} from '@ankhorage/color-theory';\nimport {\n createDefaultSemanticStatusSwatches,\n generateThemeModeColors,\n getReadableForeground,\n parseHexColorOrThrow,\n} from '@ankhorage/color-theory';\nimport type { ThemeConfig } from '@ankhorage/contracts';\n\nimport type {\n ActionSemantics,\n BorderSemantics,\n ContentSemantics,\n NeutralSemantics,\n RoleSemantics,\n SurfaceSemantics,\n ThemeSemantics,\n} from './types';\n\n/**\n * Surface semantic resolver: maps color-theory SemanticColorToken references\n * to hex values from the generated swatches.\n */\nexport type SurfaceSemanticColors = Record<SemanticColorToken, HexColor>;\n\nexport function resolveSemanticColors(\n generated: GeneratedThemeModeColors,\n references: SemanticColorReferenceMap,\n): SurfaceSemanticColors {\n return Object.fromEntries(\n Object.entries(references).map(([token, ref]) => {\n const swatch = generated.swatches[ref.role];\n if (!swatch) {\n throw new Error(`Missing swatch for role '${ref.role}' (token: '${token}')`);\n }\n return [token, swatch[ref.step]];\n }),\n ) as SurfaceSemanticColors;\n}\n\nfunction buildNeutralSemantics(neutralSwatch: ColorSwatch, isDark: boolean): NeutralSemantics {\n if (isDark) {\n return {\n bg: neutralSwatch[950],\n bgSubtle: neutralSwatch[900],\n surface: neutralSwatch[900],\n surfaceHover: neutralSwatch[800],\n surfaceActive: neutralSwatch[700],\n border: neutralSwatch[800],\n borderStrong: neutralSwatch[600],\n divider: neutralSwatch[800],\n text: neutralSwatch[50],\n textMuted: neutralSwatch[200],\n textSubtle: neutralSwatch[300],\n };\n }\n return {\n bg: neutralSwatch[50],\n bgSubtle: neutralSwatch[100],\n surface: neutralSwatch[100],\n surfaceHover: neutralSwatch[200],\n surfaceActive: neutralSwatch[300],\n border: neutralSwatch[200],\n borderStrong: neutralSwatch[300],\n divider: neutralSwatch[200],\n text: neutralSwatch[900],\n textMuted: neutralSwatch[700],\n textSubtle: neutralSwatch[600],\n };\n}\n\nfunction buildRoleSemantics(swatch: ColorSwatch, isDark: boolean): RoleSemantics {\n const base = swatch[500];\n const { foreground: onSolidText } = getReadableForeground(base);\n\n if (isDark) {\n return {\n base,\n hover: swatch[400],\n strong: swatch[300],\n softBg: swatch[900],\n softHover: swatch[800],\n softActive: swatch[700],\n outline: swatch[500],\n onSolidText,\n };\n }\n\n return {\n base,\n hover: swatch[600],\n strong: swatch[700],\n softBg: swatch[100],\n softHover: swatch[200],\n softActive: swatch[300],\n outline: swatch[400],\n onSolidText,\n };\n}\n\nexport function generatePalette(\n config: ThemeConfig,\n mode: 'light' | 'dark' = 'light',\n): {\n colors: Record<string, string>;\n swatches: GeneratedThemeSwatches;\n semantics: ThemeSemantics;\n} {\n const modeConfig = mode === 'dark' ? config.dark : config.light;\n const isDark = mode === 'dark';\n\n // Throws deterministically on invalid primary color\n parseHexColorOrThrow(modeConfig.primaryColor);\n\n const generated = generateThemeModeColors(modeConfig);\n\n const { swatches } = generated;\n const neutralSwatch = swatches.neutral;\n\n const neutral = buildNeutralSemantics(neutralSwatch, isDark);\n const brand = buildRoleSemantics(swatches.primary, isDark);\n\n // Fallback to primary swatch for missing ordinal roles\n const secondarySwatch = swatches.secondary ?? swatches.primary;\n const tertiarySwatch = swatches.tertiary ?? swatches.primary;\n const quaternarySwatch = swatches.quaternary ?? swatches.primary;\n\n const semanticStatusSwatches = createDefaultSemanticStatusSwatches().swatches;\n\n const danger = buildRoleSemantics(semanticStatusSwatches.danger, isDark);\n const success = buildRoleSemantics(semanticStatusSwatches.success, isDark);\n const warning = buildRoleSemantics(semanticStatusSwatches.warning, isDark);\n // Keep destructive action and feedback error aligned until a dedicated error status swatch is introduced.\n const error = danger;\n const info = buildRoleSemantics(secondarySwatch, isDark);\n\n const surfaceSemantics: SurfaceSemantics = {\n default: neutral.surface,\n subtle: neutral.bgSubtle,\n raised: neutral.surface,\n };\n\n const content: ContentSemantics = {\n default: neutral.text,\n muted: neutral.textMuted,\n subtle: neutral.textSubtle,\n inverse: brand.onSolidText,\n };\n\n const border: BorderSemantics = {\n default: neutral.border,\n strong: neutral.borderStrong,\n focus: brand.outline,\n };\n\n const action: ActionSemantics = {\n primary: brand,\n neutral: buildRoleSemantics(neutralSwatch, isDark),\n danger,\n };\n\n const colors: Record<string, string> = {\n primary: brand.base,\n secondary: secondarySwatch[500],\n accent: tertiarySwatch[500],\n highlight: quaternarySwatch[500],\n tertiary: tertiarySwatch[500],\n quaternary: quaternarySwatch[500],\n background: neutral.bg,\n surface: neutral.surface,\n text: neutral.text,\n textSecondary: neutral.textMuted,\n border: neutral.border,\n error: error.base,\n success: success.base,\n warning: warning.base,\n info: info.base,\n };\n\n return {\n colors,\n swatches,\n semantics: {\n neutral,\n brand,\n secondary: buildRoleSemantics(secondarySwatch, isDark),\n accent: buildRoleSemantics(tertiarySwatch, isDark),\n highlight: buildRoleSemantics(quaternarySwatch, isDark),\n danger,\n success,\n warning,\n error,\n info,\n surface: surfaceSemantics,\n content,\n border,\n action,\n },\n };\n}\n"]}
|