@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
package/dist/theme/types.d.ts
CHANGED
|
@@ -55,6 +55,8 @@ export interface ThemeSemantics {
|
|
|
55
55
|
danger: RoleSemantics;
|
|
56
56
|
success: RoleSemantics;
|
|
57
57
|
warning: RoleSemantics;
|
|
58
|
+
error: RoleSemantics;
|
|
59
|
+
info: RoleSemantics;
|
|
58
60
|
surface: SurfaceSemantics;
|
|
59
61
|
content: ContentSemantics;
|
|
60
62
|
border: BorderSemantics;
|
|
@@ -67,6 +69,8 @@ export interface ThemeTokens {
|
|
|
67
69
|
secondary: string;
|
|
68
70
|
accent: string;
|
|
69
71
|
highlight: string;
|
|
72
|
+
tertiary: string;
|
|
73
|
+
quaternary: string;
|
|
70
74
|
background: string;
|
|
71
75
|
surface: string;
|
|
72
76
|
text: string;
|
|
@@ -75,6 +79,7 @@ export interface ThemeTokens {
|
|
|
75
79
|
error: string;
|
|
76
80
|
success: string;
|
|
77
81
|
warning: string;
|
|
82
|
+
info: string;
|
|
78
83
|
[key: string]: string;
|
|
79
84
|
};
|
|
80
85
|
swatches: GeneratedThemeSwatches;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/theme/types.ts"],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B,QAAQ,EAAE,UAAU,CAAC;YACrB,IAAI,EAAE,UAAU,CAAC;YACjB,SAAS,EAAE,UAAU,CAAC;YACtB,KAAK,EAAE,UAAU,CAAC;SACnB,CAAC;QACF,KAAK,EAAE;YACL,wDAAwD;YACxD,MAAM,EAAE,MAAM,CAAC,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;YAC/C,wDAAwD;YACxD,MAAM,EAAE,MAAM,CAAC,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;SAChD,CAAC;KACH,CAAC;IACF,OAAO,EAAE;QACP,IAAI,EAAE,MAAM,CAAC;QACb,MAAM,EAAE,MAAM,CAAC;QACf,IAAI,EAAE,MAAM,CAAC;QACb,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC;KACvB,CAAC;CACH;AAED,MAAM,WAAW,YAAa,SAAQ,WAAW;IAC/C,MAAM,EAAE,oBAAoB,CAAC;CAC9B"}
|
package/dist/theme/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/theme/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { GeneratedThemeSwatches } from '@ankhorage/color-theory';\nimport type { ThemeConfig as ContractsThemeConfig } from '@ankhorage/contracts';\n\nexport type {\n ColorHarmony,\n ColorSwatch,\n ColorSwatchStep,\n GeneratedColorRole,\n GeneratedThemeModeColors,\n GeneratedThemeSwatches,\n HexColor,\n SemanticColorReferenceMap,\n SemanticColorToken,\n} from '@ankhorage/color-theory';\nexport type { ThemeConfig, ThemeModeConfig } from '@ankhorage/contracts';\n\nexport interface NeutralSemantics {\n bg: string;\n bgSubtle: string;\n surface: string;\n surfaceHover: string;\n surfaceActive: string;\n border: string;\n borderStrong: string;\n divider: string;\n text: string;\n textMuted: string;\n textSubtle: string;\n}\n\nexport interface RoleSemantics {\n base: string;\n hover: string;\n strong: string;\n softBg: string;\n softHover: string;\n softActive: string;\n outline: string;\n onSolidText: string;\n}\n\nexport interface SurfaceSemantics {\n default: string;\n subtle: string;\n raised: string;\n}\n\nexport interface ContentSemantics {\n default: string;\n muted: string;\n subtle: string;\n inverse: string;\n}\n\nexport interface BorderSemantics {\n default: string;\n strong: string;\n focus: string;\n}\n\nexport interface ActionSemantics {\n primary: RoleSemantics;\n neutral: RoleSemantics;\n danger: RoleSemantics;\n}\n\nexport interface ThemeSemantics {\n neutral: NeutralSemantics;\n brand: RoleSemantics;\n secondary: RoleSemantics;\n accent: RoleSemantics;\n highlight: RoleSemantics;\n danger: RoleSemantics;\n success: RoleSemantics;\n warning: RoleSemantics;\n surface: SurfaceSemantics;\n content: ContentSemantics;\n border: BorderSemantics;\n action: ActionSemantics;\n}\n\nexport type FontWeight =\n | '100'\n | '200'\n | '300'\n | '400'\n | '500'\n | '600'\n | '700'\n | '800'\n | '900'\n | 'bold'\n | 'normal';\n\nexport interface ThemeTokens {\n colors: {\n primary: string;\n secondary: string;\n accent: string;\n highlight: string;\n background: string;\n surface: string;\n text: string;\n textSecondary: string;\n border: string;\n error: string;\n success: string;\n warning: string;\n [key: string]: string;\n };\n swatches: GeneratedThemeSwatches;\n semantics: ThemeSemantics;\n spacing: {\n none: 0;\n xs: number;\n s: number;\n m: number;\n l: number;\n xl: number;\n xxl: number;\n [key: string]: number;\n };\n radii: {\n none: 0;\n s: number;\n m: number;\n l: number;\n full: number;\n };\n typography: {\n headings: Record<\n 1 | 2 | 3 | 4 | 5 | 6,\n {\n size: number;\n lineHeight: number;\n weight: 'regular' | 'medium' | 'semiBold' | 'bold';\n }\n >;\n sizes: {\n xs: number;\n s: number;\n m: number;\n l: number;\n xl: number;\n xxl: number;\n '3xl': number;\n h1: number;\n h2: number;\n h3: number;\n h4: number;\n h5: number;\n h6: number;\n [key: string]: number;\n };\n weights: {\n thin: FontWeight;\n extraLight: FontWeight;\n light: FontWeight;\n regular: FontWeight;\n medium: FontWeight;\n semiBold: FontWeight;\n bold: FontWeight;\n extraBold: FontWeight;\n black: FontWeight;\n };\n fonts: {\n /** Map of weight -> fontFamily name for normal style */\n normal: Record<FontWeight, string | undefined>;\n /** Map of weight -> fontFamily name for italic style */\n italic: Record<FontWeight, string | undefined>;\n };\n };\n shadows: {\n soft: number;\n medium: number;\n hard: number;\n [key: string]: number;\n };\n}\n\nexport interface SurfaceTheme extends ThemeTokens {\n config: ContractsThemeConfig;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/theme/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { GeneratedThemeSwatches } from '@ankhorage/color-theory';\nimport type { ThemeConfig as ContractsThemeConfig } from '@ankhorage/contracts';\n\nexport type {\n ColorHarmony,\n ColorSwatch,\n ColorSwatchStep,\n GeneratedColorRole,\n GeneratedThemeModeColors,\n GeneratedThemeSwatches,\n HexColor,\n SemanticColorReferenceMap,\n SemanticColorToken,\n} from '@ankhorage/color-theory';\nexport type { ThemeConfig, ThemeModeConfig } from '@ankhorage/contracts';\n\nexport interface NeutralSemantics {\n bg: string;\n bgSubtle: string;\n surface: string;\n surfaceHover: string;\n surfaceActive: string;\n border: string;\n borderStrong: string;\n divider: string;\n text: string;\n textMuted: string;\n textSubtle: string;\n}\n\nexport interface RoleSemantics {\n base: string;\n hover: string;\n strong: string;\n softBg: string;\n softHover: string;\n softActive: string;\n outline: string;\n onSolidText: string;\n}\n\nexport interface SurfaceSemantics {\n default: string;\n subtle: string;\n raised: string;\n}\n\nexport interface ContentSemantics {\n default: string;\n muted: string;\n subtle: string;\n inverse: string;\n}\n\nexport interface BorderSemantics {\n default: string;\n strong: string;\n focus: string;\n}\n\nexport interface ActionSemantics {\n primary: RoleSemantics;\n neutral: RoleSemantics;\n danger: RoleSemantics;\n}\n\nexport interface ThemeSemantics {\n neutral: NeutralSemantics;\n brand: RoleSemantics;\n secondary: RoleSemantics;\n accent: RoleSemantics;\n highlight: RoleSemantics;\n danger: RoleSemantics;\n success: RoleSemantics;\n warning: RoleSemantics;\n error: RoleSemantics;\n info: RoleSemantics;\n surface: SurfaceSemantics;\n content: ContentSemantics;\n border: BorderSemantics;\n action: ActionSemantics;\n}\n\nexport type FontWeight =\n | '100'\n | '200'\n | '300'\n | '400'\n | '500'\n | '600'\n | '700'\n | '800'\n | '900'\n | 'bold'\n | 'normal';\n\nexport interface ThemeTokens {\n colors: {\n primary: string;\n secondary: string;\n accent: string;\n highlight: string;\n tertiary: string;\n quaternary: string;\n background: string;\n surface: string;\n text: string;\n textSecondary: string;\n border: string;\n error: string;\n success: string;\n warning: string;\n info: string;\n [key: string]: string;\n };\n swatches: GeneratedThemeSwatches;\n semantics: ThemeSemantics;\n spacing: {\n none: 0;\n xs: number;\n s: number;\n m: number;\n l: number;\n xl: number;\n xxl: number;\n [key: string]: number;\n };\n radii: {\n none: 0;\n s: number;\n m: number;\n l: number;\n full: number;\n };\n typography: {\n headings: Record<\n 1 | 2 | 3 | 4 | 5 | 6,\n {\n size: number;\n lineHeight: number;\n weight: 'regular' | 'medium' | 'semiBold' | 'bold';\n }\n >;\n sizes: {\n xs: number;\n s: number;\n m: number;\n l: number;\n xl: number;\n xxl: number;\n '3xl': number;\n h1: number;\n h2: number;\n h3: number;\n h4: number;\n h5: number;\n h6: number;\n [key: string]: number;\n };\n weights: {\n thin: FontWeight;\n extraLight: FontWeight;\n light: FontWeight;\n regular: FontWeight;\n medium: FontWeight;\n semiBold: FontWeight;\n bold: FontWeight;\n extraBold: FontWeight;\n black: FontWeight;\n };\n fonts: {\n /** Map of weight -> fontFamily name for normal style */\n normal: Record<FontWeight, string | undefined>;\n /** Map of weight -> fontFamily name for italic style */\n italic: Record<FontWeight, string | undefined>;\n };\n };\n shadows: {\n soft: number;\n medium: number;\n hard: number;\n [key: string]: number;\n };\n}\n\nexport interface SurfaceTheme extends ThemeTokens {\n config: ContractsThemeConfig;\n}\n"]}
|
package/package.json
CHANGED
|
@@ -9,7 +9,7 @@ import type { BadgeProps } from './types';
|
|
|
9
9
|
export function Badge({
|
|
10
10
|
content,
|
|
11
11
|
variant = 'soft',
|
|
12
|
-
|
|
12
|
+
color = 'primary',
|
|
13
13
|
size = 's',
|
|
14
14
|
testID,
|
|
15
15
|
}: BadgeProps) {
|
|
@@ -17,7 +17,7 @@ export function Badge({
|
|
|
17
17
|
const controlSize = resolveControlSize(theme, size);
|
|
18
18
|
const colors = resolveButtonColors(theme, {
|
|
19
19
|
variant,
|
|
20
|
-
|
|
20
|
+
color,
|
|
21
21
|
state: {
|
|
22
22
|
disabled: false,
|
|
23
23
|
focused: false,
|
|
@@ -39,7 +39,12 @@ export function Badge({
|
|
|
39
39
|
}}
|
|
40
40
|
testID={testID}
|
|
41
41
|
>
|
|
42
|
-
<Text
|
|
42
|
+
<Text
|
|
43
|
+
color={color}
|
|
44
|
+
emphasis={variant === 'solid' ? 'inverse' : 'default'}
|
|
45
|
+
variant="bodySmall"
|
|
46
|
+
weight="medium"
|
|
47
|
+
>
|
|
43
48
|
{content}
|
|
44
49
|
</Text>
|
|
45
50
|
</Box>
|
|
@@ -2,12 +2,12 @@ import type React from 'react';
|
|
|
2
2
|
|
|
3
3
|
import type { ControlSize } from '../../internal/resolvers/resolveControlSize';
|
|
4
4
|
import type { ButtonVariant } from '../../internal/resolvers/resolveInteractiveColors';
|
|
5
|
-
import type {
|
|
5
|
+
import type { SurfaceColor } from '../../surfaceColor';
|
|
6
6
|
|
|
7
7
|
export interface BadgeProps {
|
|
8
8
|
content?: React.ReactNode;
|
|
9
9
|
variant?: Extract<ButtonVariant, 'solid' | 'soft' | 'outline'>;
|
|
10
|
-
|
|
10
|
+
color?: SurfaceColor;
|
|
11
11
|
size?: ControlSize;
|
|
12
12
|
testID?: string;
|
|
13
13
|
}
|
|
@@ -12,7 +12,7 @@ import type { ButtonProps } from './types';
|
|
|
12
12
|
export function Button({
|
|
13
13
|
children,
|
|
14
14
|
variant = 'solid',
|
|
15
|
-
|
|
15
|
+
color = 'primary',
|
|
16
16
|
size = 'm',
|
|
17
17
|
disabled = false,
|
|
18
18
|
loading = false,
|
|
@@ -41,9 +41,14 @@ export function Button({
|
|
|
41
41
|
{(state) => {
|
|
42
42
|
const colors = resolveButtonColors(theme, {
|
|
43
43
|
variant,
|
|
44
|
-
|
|
44
|
+
color,
|
|
45
45
|
state,
|
|
46
46
|
});
|
|
47
|
+
const textEmphasis =
|
|
48
|
+
colors.contentColor === theme.semantics.content.muted ? 'muted' : 'default';
|
|
49
|
+
const resolvedTextColor = textEmphasis === 'muted' ? undefined : color;
|
|
50
|
+
const resolvedTextEmphasis =
|
|
51
|
+
textEmphasis === 'muted' ? 'muted' : variant === 'solid' ? 'inverse' : 'default';
|
|
47
52
|
const iconSize = resolveIconSize(theme, size);
|
|
48
53
|
|
|
49
54
|
return (
|
|
@@ -78,7 +83,8 @@ export function Button({
|
|
|
78
83
|
</View>
|
|
79
84
|
) : null}
|
|
80
85
|
<Text
|
|
81
|
-
color={
|
|
86
|
+
color={resolvedTextColor}
|
|
87
|
+
emphasis={resolvedTextEmphasis}
|
|
82
88
|
variant={controlSize.textVariant}
|
|
83
89
|
weight="semiBold"
|
|
84
90
|
>
|
|
@@ -2,9 +2,9 @@ import type React from 'react';
|
|
|
2
2
|
|
|
3
3
|
import type { ControlSize } from '../../internal/resolvers/resolveControlSize';
|
|
4
4
|
import type { ButtonVariant } from '../../internal/resolvers/resolveInteractiveColors';
|
|
5
|
-
import type { ComponentTone } from '../../internal/resolvers/resolveTone';
|
|
6
5
|
import type { ButtonBaseProps } from '../../primitives/button-base';
|
|
7
6
|
import type { IconProps } from '../../primitives/icon';
|
|
7
|
+
import type { SurfaceColor } from '../../surfaceColor';
|
|
8
8
|
|
|
9
9
|
export interface ButtonIconSpec {
|
|
10
10
|
name: IconProps['name'];
|
|
@@ -17,7 +17,7 @@ export interface ButtonProps extends Omit<
|
|
|
17
17
|
> {
|
|
18
18
|
children?: React.ReactNode;
|
|
19
19
|
variant?: ButtonVariant;
|
|
20
|
-
|
|
20
|
+
color?: SurfaceColor;
|
|
21
21
|
size?: ControlSize;
|
|
22
22
|
loading?: boolean;
|
|
23
23
|
leadingIcon?: ButtonIconSpec;
|
|
@@ -18,7 +18,7 @@ export function Checkbox({
|
|
|
18
18
|
checked,
|
|
19
19
|
defaultChecked = false,
|
|
20
20
|
onCheckedChange,
|
|
21
|
-
|
|
21
|
+
color = 'primary',
|
|
22
22
|
size = 'm',
|
|
23
23
|
disabled = false,
|
|
24
24
|
invalid = false,
|
|
@@ -69,8 +69,12 @@ export function Checkbox({
|
|
|
69
69
|
fieldState,
|
|
70
70
|
hovered: interactionState.hovered,
|
|
71
71
|
pressed: interactionState.pressed,
|
|
72
|
-
|
|
72
|
+
color,
|
|
73
73
|
});
|
|
74
|
+
const labelEmphasis =
|
|
75
|
+
colors.labelColor === theme.semantics.content.muted ? 'muted' : 'default';
|
|
76
|
+
const indicatorColor = fieldState.invalid ? 'error' : color;
|
|
77
|
+
const indicatorEmphasis = disabled ? 'muted' : 'inverse';
|
|
74
78
|
|
|
75
79
|
return (
|
|
76
80
|
<Box
|
|
@@ -93,14 +97,19 @@ export function Checkbox({
|
|
|
93
97
|
}}
|
|
94
98
|
>
|
|
95
99
|
{isChecked ? (
|
|
96
|
-
<Text
|
|
100
|
+
<Text
|
|
101
|
+
color={disabled ? undefined : indicatorColor}
|
|
102
|
+
emphasis={indicatorEmphasis}
|
|
103
|
+
variant="caption"
|
|
104
|
+
weight="bold"
|
|
105
|
+
>
|
|
97
106
|
✓
|
|
98
107
|
</Text>
|
|
99
108
|
) : null}
|
|
100
109
|
</Box>
|
|
101
110
|
{children ? (
|
|
102
111
|
<Box ml="s">
|
|
103
|
-
<Text
|
|
112
|
+
<Text emphasis={labelEmphasis}>{children}</Text>
|
|
104
113
|
</Box>
|
|
105
114
|
) : null}
|
|
106
115
|
</Box>
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
2
|
|
|
3
3
|
import type { ControlSize } from '../../internal/resolvers/resolveControlSize';
|
|
4
|
-
import type { ComponentTone } from '../../internal/resolvers/resolveTone';
|
|
5
4
|
import type { ButtonBaseProps } from '../../primitives/button-base';
|
|
5
|
+
import type { SurfaceColor } from '../../surfaceColor';
|
|
6
6
|
|
|
7
7
|
export interface CheckboxProps extends Omit<
|
|
8
8
|
ButtonBaseProps,
|
|
@@ -12,7 +12,7 @@ export interface CheckboxProps extends Omit<
|
|
|
12
12
|
checked?: boolean;
|
|
13
13
|
defaultChecked?: boolean;
|
|
14
14
|
onCheckedChange?: ((checked: boolean) => void) | undefined;
|
|
15
|
-
|
|
15
|
+
color?: SurfaceColor;
|
|
16
16
|
size?: ControlSize;
|
|
17
17
|
invalid?: boolean;
|
|
18
18
|
readOnly?: boolean;
|
|
@@ -28,15 +28,23 @@ export function Field({
|
|
|
28
28
|
return (
|
|
29
29
|
<Stack gap="xs" testID={testID}>
|
|
30
30
|
{label ? (
|
|
31
|
-
<Label
|
|
31
|
+
<Label
|
|
32
|
+
color={presentation.labelColor}
|
|
33
|
+
emphasis={presentation.labelEmphasis}
|
|
34
|
+
required={required}
|
|
35
|
+
>
|
|
32
36
|
{label}
|
|
33
37
|
</Label>
|
|
34
38
|
) : null}
|
|
35
39
|
<Box>{children}</Box>
|
|
36
40
|
{hasErrorText ? (
|
|
37
|
-
<HelperText
|
|
41
|
+
<HelperText color={presentation.helperColor} emphasis={presentation.helperEmphasis}>
|
|
42
|
+
{errorText}
|
|
43
|
+
</HelperText>
|
|
38
44
|
) : helperText ? (
|
|
39
|
-
<HelperText
|
|
45
|
+
<HelperText color={presentation.helperColor} emphasis={presentation.helperEmphasis}>
|
|
46
|
+
{helperText}
|
|
47
|
+
</HelperText>
|
|
40
48
|
) : null}
|
|
41
49
|
</Stack>
|
|
42
50
|
);
|
|
@@ -3,9 +3,9 @@ import React from 'react';
|
|
|
3
3
|
import { Text } from '../../primitives/text';
|
|
4
4
|
import type { HelperTextProps } from './types';
|
|
5
5
|
|
|
6
|
-
export function HelperText({ children,
|
|
6
|
+
export function HelperText({ children, emphasis = 'muted', color, testID }: HelperTextProps) {
|
|
7
7
|
return (
|
|
8
|
-
<Text
|
|
8
|
+
<Text color={color} emphasis={emphasis} testID={testID} variant="caption">
|
|
9
9
|
{children}
|
|
10
10
|
</Text>
|
|
11
11
|
);
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
2
|
|
|
3
|
-
import type {
|
|
3
|
+
import type { SurfaceColor, SurfaceEmphasis } from '../../surfaceColor';
|
|
4
4
|
|
|
5
5
|
export interface HelperTextProps {
|
|
6
6
|
children?: React.ReactNode;
|
|
7
|
-
|
|
7
|
+
emphasis?: Extract<SurfaceEmphasis, 'default' | 'muted'>;
|
|
8
|
+
color?: Extract<SurfaceColor, 'error'>;
|
|
8
9
|
testID?: string;
|
|
9
10
|
}
|
|
@@ -11,7 +11,7 @@ export function IconButton({
|
|
|
11
11
|
icon,
|
|
12
12
|
accessibilityLabel,
|
|
13
13
|
variant = 'ghost',
|
|
14
|
-
|
|
14
|
+
color = 'primary',
|
|
15
15
|
size = 'm',
|
|
16
16
|
disabled = false,
|
|
17
17
|
onPress,
|
|
@@ -30,7 +30,7 @@ export function IconButton({
|
|
|
30
30
|
testID={testID}
|
|
31
31
|
>
|
|
32
32
|
{(state) => {
|
|
33
|
-
const colors = resolveButtonColors(theme, {
|
|
33
|
+
const colors = resolveButtonColors(theme, { color, state, variant });
|
|
34
34
|
|
|
35
35
|
return (
|
|
36
36
|
<Box
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { ControlSize } from '../../internal/resolvers/resolveControlSize';
|
|
2
2
|
import type { ButtonVariant } from '../../internal/resolvers/resolveInteractiveColors';
|
|
3
|
-
import type { ComponentTone } from '../../internal/resolvers/resolveTone';
|
|
4
3
|
import type { ButtonBaseProps } from '../../primitives/button-base';
|
|
5
4
|
import type { IconProps } from '../../primitives/icon';
|
|
5
|
+
import type { SurfaceColor } from '../../surfaceColor';
|
|
6
6
|
|
|
7
7
|
export interface IconButtonProps extends Omit<
|
|
8
8
|
ButtonBaseProps,
|
|
@@ -14,6 +14,6 @@ export interface IconButtonProps extends Omit<
|
|
|
14
14
|
};
|
|
15
15
|
accessibilityLabel: string;
|
|
16
16
|
variant?: ButtonVariant;
|
|
17
|
-
|
|
17
|
+
color?: SurfaceColor;
|
|
18
18
|
size?: ControlSize;
|
|
19
19
|
}
|
|
@@ -3,12 +3,18 @@ import React from 'react';
|
|
|
3
3
|
import { Text } from '../../primitives/text';
|
|
4
4
|
import type { LabelProps } from './types';
|
|
5
5
|
|
|
6
|
-
export function Label({
|
|
6
|
+
export function Label({
|
|
7
|
+
children,
|
|
8
|
+
required = false,
|
|
9
|
+
emphasis = 'default',
|
|
10
|
+
color,
|
|
11
|
+
testID,
|
|
12
|
+
}: LabelProps) {
|
|
7
13
|
return (
|
|
8
|
-
<Text
|
|
14
|
+
<Text color={color} emphasis={emphasis} testID={testID} variant="label" weight="medium">
|
|
9
15
|
{children}
|
|
10
16
|
{required ? (
|
|
11
|
-
<Text
|
|
17
|
+
<Text color="error" variant="label" weight="medium">
|
|
12
18
|
{' *'}
|
|
13
19
|
</Text>
|
|
14
20
|
) : null}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
2
|
|
|
3
|
-
import type {
|
|
3
|
+
import type { SurfaceColor, SurfaceEmphasis } from '../../surfaceColor';
|
|
4
4
|
|
|
5
5
|
export interface LabelProps {
|
|
6
6
|
children?: React.ReactNode;
|
|
7
7
|
required?: boolean;
|
|
8
|
-
|
|
8
|
+
emphasis?: Extract<SurfaceEmphasis, 'default' | 'muted'>;
|
|
9
|
+
color?: Extract<SurfaceColor, 'error'>;
|
|
9
10
|
testID?: string;
|
|
10
11
|
}
|
|
@@ -156,14 +156,7 @@ export function Menu({ trigger, items, onDismiss, closeOnSelect = true, testID }
|
|
|
156
156
|
}}
|
|
157
157
|
testID={testID ? `${testID}-item-${item.id}` : undefined}
|
|
158
158
|
>
|
|
159
|
-
<Text
|
|
160
|
-
color={
|
|
161
|
-
selected
|
|
162
|
-
? theme.semantics.action.neutral.base
|
|
163
|
-
: theme.semantics.content.default
|
|
164
|
-
}
|
|
165
|
-
variant="bodySmall"
|
|
166
|
-
>
|
|
159
|
+
<Text color={selected ? 'neutral' : undefined} variant="bodySmall">
|
|
167
160
|
{item.label}
|
|
168
161
|
</Text>
|
|
169
162
|
</Box>
|
|
@@ -60,7 +60,8 @@ export function NavigationItem({ item, compact = false, testID }: NavigationItem
|
|
|
60
60
|
) : null}
|
|
61
61
|
<Box flex={1}>
|
|
62
62
|
<Text
|
|
63
|
-
color={
|
|
63
|
+
color={active && !disabled ? 'primary' : undefined}
|
|
64
|
+
emphasis={disabled ? 'muted' : 'default'}
|
|
64
65
|
numberOfLines={1}
|
|
65
66
|
variant={compact ? 'bodySmall' : 'body'}
|
|
66
67
|
weight="medium"
|
|
@@ -66,7 +66,8 @@ export function TabBarItem({ item, compact = false, testID }: TabBarItemProps) {
|
|
|
66
66
|
) : null}
|
|
67
67
|
{item.label ? (
|
|
68
68
|
<Text
|
|
69
|
-
color={
|
|
69
|
+
color={active && !disabled ? 'primary' : undefined}
|
|
70
|
+
emphasis={active && !disabled ? 'default' : 'muted'}
|
|
70
71
|
numberOfLines={1}
|
|
71
72
|
variant={compact ? 'bodySmall' : 'label'}
|
|
72
73
|
weight="medium"
|
|
@@ -18,7 +18,7 @@ export function Radio({
|
|
|
18
18
|
checked,
|
|
19
19
|
defaultChecked = false,
|
|
20
20
|
onCheckedChange,
|
|
21
|
-
|
|
21
|
+
color = 'primary',
|
|
22
22
|
size = 'm',
|
|
23
23
|
disabled = false,
|
|
24
24
|
invalid = false,
|
|
@@ -69,8 +69,10 @@ export function Radio({
|
|
|
69
69
|
fieldState,
|
|
70
70
|
hovered: interactionState.hovered,
|
|
71
71
|
pressed: interactionState.pressed,
|
|
72
|
-
|
|
72
|
+
color,
|
|
73
73
|
});
|
|
74
|
+
const labelEmphasis =
|
|
75
|
+
colors.labelColor === theme.semantics.content.muted ? 'muted' : 'default';
|
|
74
76
|
|
|
75
77
|
return (
|
|
76
78
|
<Box
|
|
@@ -105,7 +107,7 @@ export function Radio({
|
|
|
105
107
|
</Box>
|
|
106
108
|
{children ? (
|
|
107
109
|
<Box ml="s">
|
|
108
|
-
<Text
|
|
110
|
+
<Text emphasis={labelEmphasis}>{children}</Text>
|
|
109
111
|
</Box>
|
|
110
112
|
) : null}
|
|
111
113
|
</Box>
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
2
|
|
|
3
3
|
import type { ControlSize } from '../../internal/resolvers/resolveControlSize';
|
|
4
|
-
import type { ComponentTone } from '../../internal/resolvers/resolveTone';
|
|
5
4
|
import type { ButtonBaseProps } from '../../primitives/button-base';
|
|
5
|
+
import type { SurfaceColor } from '../../surfaceColor';
|
|
6
6
|
|
|
7
7
|
export interface RadioProps extends Omit<
|
|
8
8
|
ButtonBaseProps,
|
|
@@ -12,7 +12,7 @@ export interface RadioProps extends Omit<
|
|
|
12
12
|
checked?: boolean;
|
|
13
13
|
defaultChecked?: boolean;
|
|
14
14
|
onCheckedChange?: ((checked: boolean) => void) | undefined;
|
|
15
|
-
|
|
15
|
+
color?: SurfaceColor;
|
|
16
16
|
size?: ControlSize;
|
|
17
17
|
invalid?: boolean;
|
|
18
18
|
readOnly?: boolean;
|
|
@@ -18,7 +18,7 @@ export function Switch({
|
|
|
18
18
|
checked,
|
|
19
19
|
defaultChecked = false,
|
|
20
20
|
onCheckedChange,
|
|
21
|
-
|
|
21
|
+
color = 'primary',
|
|
22
22
|
size = 'm',
|
|
23
23
|
disabled = false,
|
|
24
24
|
invalid = false,
|
|
@@ -69,8 +69,10 @@ export function Switch({
|
|
|
69
69
|
fieldState,
|
|
70
70
|
hovered: interactionState.hovered,
|
|
71
71
|
pressed: interactionState.pressed,
|
|
72
|
-
|
|
72
|
+
color,
|
|
73
73
|
});
|
|
74
|
+
const labelEmphasis =
|
|
75
|
+
colors.labelColor === theme.semantics.content.muted ? 'muted' : 'default';
|
|
74
76
|
|
|
75
77
|
return (
|
|
76
78
|
<Box
|
|
@@ -105,7 +107,7 @@ export function Switch({
|
|
|
105
107
|
</Box>
|
|
106
108
|
{children ? (
|
|
107
109
|
<Box ml="s">
|
|
108
|
-
<Text
|
|
110
|
+
<Text emphasis={labelEmphasis}>{children}</Text>
|
|
109
111
|
</Box>
|
|
110
112
|
) : null}
|
|
111
113
|
</Box>
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
2
|
|
|
3
3
|
import type { ControlSize } from '../../internal/resolvers/resolveControlSize';
|
|
4
|
-
import type { ComponentTone } from '../../internal/resolvers/resolveTone';
|
|
5
4
|
import type { ButtonBaseProps } from '../../primitives/button-base';
|
|
5
|
+
import type { SurfaceColor } from '../../surfaceColor';
|
|
6
6
|
|
|
7
7
|
export interface SwitchProps extends Omit<
|
|
8
8
|
ButtonBaseProps,
|
|
@@ -12,7 +12,7 @@ export interface SwitchProps extends Omit<
|
|
|
12
12
|
checked?: boolean;
|
|
13
13
|
defaultChecked?: boolean;
|
|
14
14
|
onCheckedChange?: ((checked: boolean) => void) | undefined;
|
|
15
|
-
|
|
15
|
+
color?: SurfaceColor;
|
|
16
16
|
size?: ControlSize;
|
|
17
17
|
invalid?: boolean;
|
|
18
18
|
readOnly?: boolean;
|
|
@@ -69,11 +69,7 @@ export function Tab({ value, children, disabled = false, testID }: TabProps) {
|
|
|
69
69
|
opacity: disabled ? 0.64 : 1,
|
|
70
70
|
}}
|
|
71
71
|
>
|
|
72
|
-
<Text
|
|
73
|
-
color={selected ? theme.semantics.action.primary.base : theme.semantics.content.default}
|
|
74
|
-
variant="label"
|
|
75
|
-
weight="medium"
|
|
76
|
-
>
|
|
72
|
+
<Text color={selected ? 'primary' : undefined} variant="label" weight="medium">
|
|
77
73
|
{children}
|
|
78
74
|
</Text>
|
|
79
75
|
</Box>
|
|
@@ -3,23 +3,51 @@ import { Pressable } from 'react-native';
|
|
|
3
3
|
|
|
4
4
|
import { Box, Inline, Surface } from '../../layout';
|
|
5
5
|
import { Text } from '../../primitives/text';
|
|
6
|
+
import type { SurfaceColor } from '../../surfaceColor';
|
|
6
7
|
import { useTheme } from '../../theme/ThemeContext';
|
|
8
|
+
import type { SurfaceTheme } from '../../theme/types';
|
|
7
9
|
import type { ToastProps } from './types';
|
|
8
10
|
|
|
9
|
-
|
|
11
|
+
function resolveToastStatusColor(theme: SurfaceTheme, status: ToastProps['status']) {
|
|
12
|
+
switch (status) {
|
|
13
|
+
case 'success':
|
|
14
|
+
return theme.semantics.success.base;
|
|
15
|
+
case 'warning':
|
|
16
|
+
return theme.semantics.warning.base;
|
|
17
|
+
case 'error':
|
|
18
|
+
return theme.semantics.error.base;
|
|
19
|
+
case 'info':
|
|
20
|
+
return theme.semantics.info.base;
|
|
21
|
+
default:
|
|
22
|
+
return theme.semantics.action.primary.base;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function resolveToastStatusTextColor(status: ToastProps['status']): SurfaceColor {
|
|
27
|
+
switch (status) {
|
|
28
|
+
case 'success':
|
|
29
|
+
return 'success';
|
|
30
|
+
case 'warning':
|
|
31
|
+
return 'warning';
|
|
32
|
+
case 'error':
|
|
33
|
+
return 'error';
|
|
34
|
+
case 'info':
|
|
35
|
+
return 'info';
|
|
36
|
+
default:
|
|
37
|
+
return 'primary';
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export function Toast({ title, description, status = 'default', onDismiss, testID }: ToastProps) {
|
|
10
42
|
const { theme } = useTheme();
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
? theme.semantics.success.base
|
|
14
|
-
: tone === 'danger'
|
|
15
|
-
? theme.semantics.danger.base
|
|
16
|
-
: theme.semantics.action.primary.base;
|
|
43
|
+
const statusColor = resolveToastStatusColor(theme, status);
|
|
44
|
+
const statusTextColor = resolveToastStatusTextColor(status);
|
|
17
45
|
|
|
18
46
|
return (
|
|
19
47
|
<Surface
|
|
20
48
|
p="m"
|
|
21
49
|
style={{
|
|
22
|
-
borderLeftColor:
|
|
50
|
+
borderLeftColor: statusColor,
|
|
23
51
|
borderLeftWidth: 3,
|
|
24
52
|
minWidth: 280,
|
|
25
53
|
shadowOpacity: 0.14,
|
|
@@ -36,7 +64,7 @@ export function Toast({ title, description, tone = 'default', onDismiss, testID
|
|
|
36
64
|
{title}
|
|
37
65
|
</Text>
|
|
38
66
|
) : null}
|
|
39
|
-
{description ? <Text
|
|
67
|
+
{description ? <Text emphasis="muted">{description}</Text> : null}
|
|
40
68
|
</Box>
|
|
41
69
|
{onDismiss ? (
|
|
42
70
|
<Pressable
|
|
@@ -45,7 +73,7 @@ export function Toast({ title, description, tone = 'default', onDismiss, testID
|
|
|
45
73
|
onPress={onDismiss}
|
|
46
74
|
testID={testID ? `${testID}-dismiss` : undefined}
|
|
47
75
|
>
|
|
48
|
-
<Text color={
|
|
76
|
+
<Text color={statusTextColor}>×</Text>
|
|
49
77
|
</Pressable>
|
|
50
78
|
) : null}
|
|
51
79
|
</Inline>
|