@compsych-ui-components/react-native 4.0.0 → 4.0.13
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/package.json +22 -14
- package/src/components/ActionSheet/index.d.ts +16 -0
- package/src/components/ActionSheet/index.js +256 -0
- package/src/components/ActionSheet/index.js.map +1 -0
- package/src/components/Alert/index.d.ts +24 -0
- package/src/components/Alert/index.js +304 -0
- package/src/components/Alert/index.js.map +1 -0
- package/src/components/Avatar/index.d.ts +22 -0
- package/src/components/Avatar/index.js +253 -0
- package/src/components/Avatar/index.js.map +1 -0
- package/src/components/Badge/index.d.ts +12 -0
- package/src/components/Badge/index.js +206 -0
- package/src/components/Badge/index.js.map +1 -0
- package/src/components/BodyText/index.d.ts +9 -0
- package/src/components/BodyText/index.js +58 -0
- package/src/components/BodyText/index.js.map +1 -0
- package/src/components/Breadcrumb/index.d.ts +24 -0
- package/src/components/Breadcrumb/index.js +194 -0
- package/src/components/Breadcrumb/index.js.map +1 -0
- package/src/components/Button/index.d.ts +16 -0
- package/src/components/Button/index.js +260 -0
- package/src/components/Button/index.js.map +1 -0
- package/src/components/Checkbox/index.d.ts +16 -0
- package/src/components/Checkbox/index.js +196 -0
- package/src/components/Checkbox/index.js.map +1 -0
- package/src/components/Chip/index.d.ts +18 -0
- package/src/components/Chip/index.js +280 -0
- package/src/components/Chip/index.js.map +1 -0
- package/src/components/Divider/index.d.ts +11 -0
- package/src/components/Divider/index.js +59 -0
- package/src/components/Divider/index.js.map +1 -0
- package/src/components/EmptyState/index.d.ts +25 -0
- package/src/components/EmptyState/index.js +376 -0
- package/src/components/EmptyState/index.js.map +1 -0
- package/src/components/HeaderText/index.d.ts +9 -0
- package/src/components/HeaderText/index.js +62 -0
- package/src/components/HeaderText/index.js.map +1 -0
- package/src/components/Input/index.d.ts +13 -0
- package/src/components/Input/index.js +231 -0
- package/src/components/Input/index.js.map +1 -0
- package/src/components/List/index.d.ts +19 -0
- package/src/components/List/index.js +170 -0
- package/src/components/List/index.js.map +1 -0
- package/src/components/Pagination/index.d.ts +15 -0
- package/src/components/Pagination/index.js +322 -0
- package/src/components/Pagination/index.js.map +1 -0
- package/src/components/PlanCard/index.d.ts +27 -0
- package/src/components/PlanCard/index.js +364 -0
- package/src/components/PlanCard/index.js.map +1 -0
- package/src/components/ProgressTracker/index.d.ts +26 -0
- package/src/components/ProgressTracker/index.js +180 -0
- package/src/components/ProgressTracker/index.js.map +1 -0
- package/src/components/PromotionCard/index.d.ts +23 -0
- package/src/components/PromotionCard/index.js +496 -0
- package/src/components/PromotionCard/index.js.map +1 -0
- package/src/components/RadioButton/index.d.ts +15 -0
- package/src/components/RadioButton/index.js +188 -0
- package/src/components/RadioButton/index.js.map +1 -0
- package/src/components/ScreenContainer/index.d.ts +15 -0
- package/src/components/ScreenContainer/index.js +43 -0
- package/src/components/ScreenContainer/index.js.map +1 -0
- package/src/components/SegmentedControl/index.d.ts +16 -0
- package/src/components/SegmentedControl/index.js +115 -0
- package/src/components/SegmentedControl/index.js.map +1 -0
- package/src/components/SelectionCard/index.d.ts +16 -0
- package/src/components/SelectionCard/index.js +222 -0
- package/src/components/SelectionCard/index.js.map +1 -0
- package/src/components/ServiceCard/index.d.ts +22 -0
- package/src/components/ServiceCard/index.js +385 -0
- package/src/components/ServiceCard/index.js.map +1 -0
- package/src/components/Slider/index.d.ts +24 -0
- package/src/components/Slider/index.js +320 -0
- package/src/components/Slider/index.js.map +1 -0
- package/src/components/Snackbar/index.d.ts +13 -0
- package/src/components/Snackbar/index.js +229 -0
- package/src/components/Snackbar/index.js.map +1 -0
- package/src/components/Switch/index.d.ts +14 -0
- package/src/components/Switch/index.js +221 -0
- package/src/components/Switch/index.js.map +1 -0
- package/src/components/Tooltip/index.d.ts +21 -0
- package/src/components/Tooltip/index.js +206 -0
- package/src/components/Tooltip/index.js.map +1 -0
- package/src/icons/AtomIcon.d.ts +2 -0
- package/src/icons/AtomIcon.js +85 -0
- package/src/icons/AtomIcon.js.map +1 -0
- package/src/icons/BinocularsIcon.d.ts +2 -0
- package/src/icons/BinocularsIcon.js +103 -0
- package/src/icons/BinocularsIcon.js.map +1 -0
- package/src/icons/FileChartColumnIncreasingIcon.d.ts +2 -0
- package/src/icons/FileChartColumnIncreasingIcon.js +97 -0
- package/src/icons/FileChartColumnIncreasingIcon.js.map +1 -0
- package/src/icons/FlagIcon.d.ts +2 -0
- package/src/icons/FlagIcon.js +71 -0
- package/src/icons/FlagIcon.js.map +1 -0
- package/src/icons/GlobeIcon.d.ts +2 -0
- package/src/icons/GlobeIcon.js +71 -0
- package/src/icons/GlobeIcon.js.map +1 -0
- package/src/icons/GraduationCapIcon.d.ts +2 -0
- package/src/icons/GraduationCapIcon.js +85 -0
- package/src/icons/GraduationCapIcon.js.map +1 -0
- package/src/icons/HandHeartIcon.d.ts +2 -0
- package/src/icons/HandHeartIcon.js +91 -0
- package/src/icons/HandHeartIcon.js.map +1 -0
- package/src/icons/HandshakeIcon.d.ts +2 -0
- package/src/icons/HandshakeIcon.js +97 -0
- package/src/icons/HandshakeIcon.js.map +1 -0
- package/src/icons/HazeIcon.d.ts +2 -0
- package/src/icons/HazeIcon.js +115 -0
- package/src/icons/HazeIcon.js.map +1 -0
- package/src/icons/HeartHandshakeIcon.d.ts +2 -0
- package/src/icons/HeartHandshakeIcon.js +71 -0
- package/src/icons/HeartHandshakeIcon.js.map +1 -0
- package/src/icons/HourglassIcon.d.ts +2 -0
- package/src/icons/HourglassIcon.js +91 -0
- package/src/icons/HourglassIcon.js.map +1 -0
- package/src/icons/IdCardIcon.d.ts +2 -0
- package/src/icons/IdCardIcon.js +97 -0
- package/src/icons/IdCardIcon.js.map +1 -0
- package/src/icons/MessageCirclePlusIcon.d.ts +2 -0
- package/src/icons/MessageCirclePlusIcon.js +85 -0
- package/src/icons/MessageCirclePlusIcon.js.map +1 -0
- package/src/icons/MountainSnowIcon.d.ts +2 -0
- package/src/icons/MountainSnowIcon.js +79 -0
- package/src/icons/MountainSnowIcon.js.map +1 -0
- package/src/icons/SnowflakeIcon.d.ts +2 -0
- package/src/icons/SnowflakeIcon.js +139 -0
- package/src/icons/SnowflakeIcon.js.map +1 -0
- package/src/icons/StethoscopeIcon.d.ts +2 -0
- package/src/icons/StethoscopeIcon.js +97 -0
- package/src/icons/StethoscopeIcon.js.map +1 -0
- package/src/icons/UserRoundIcon.d.ts +2 -0
- package/src/icons/UserRoundIcon.js +79 -0
- package/src/icons/UserRoundIcon.js.map +1 -0
- package/src/icons/WheatIcon.d.ts +2 -0
- package/src/icons/WheatIcon.js +115 -0
- package/src/icons/WheatIcon.js.map +1 -0
- package/src/icons/index.d.ts +22 -0
- package/src/icons/index.js +109 -0
- package/src/icons/index.js.map +1 -0
- package/src/icons/types.d.ts +16 -0
- package/src/icons/types.js +52 -0
- package/src/icons/types.js.map +1 -0
- package/src/index.d.ts +60 -2
- package/src/index.js +203 -1
- package/src/index.js.map +1 -1
- package/src/theme/ThemeContext.d.ts +258 -0
- package/src/theme/ThemeContext.js +15 -0
- package/src/theme/ThemeContext.js.map +1 -0
- package/src/theme/ThemeProvider.d.ts +27 -0
- package/src/theme/ThemeProvider.js +66 -0
- package/src/theme/ThemeProvider.js.map +1 -0
- package/src/theme/defaultTheme.d.ts +13 -0
- package/src/theme/defaultTheme.js +14 -0
- package/src/theme/defaultTheme.js.map +1 -0
- package/src/theme/index.d.ts +5 -0
- package/src/theme/index.js +26 -0
- package/src/theme/index.js.map +1 -0
- package/src/theme/mergeTheme.d.ts +7 -0
- package/src/theme/mergeTheme.js +40 -0
- package/src/theme/mergeTheme.js.map +1 -0
- package/src/theme/types.d.ts +25 -0
- package/src/theme/types.js +6 -0
- package/src/theme/types.js.map +1 -0
- package/src/theme/useTheme.d.ts +10 -0
- package/src/theme/useTheme.js +17 -0
- package/src/theme/useTheme.js.map +1 -0
- package/src/tokens.d.ts +253 -0
- package/src/tokens.js +265 -0
- package/src/tokens.js.map +1 -0
- package/src/lib/button.d.ts +0 -7
- package/src/lib/button.js +0 -43
- package/src/lib/button.js.map +0 -1
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "BodyText", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return BodyText;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
const _jsxruntime = require("react/jsx-runtime");
|
|
12
|
+
const _react = /*#__PURE__*/ _interop_require_default(require("react"));
|
|
13
|
+
const _reactnative = require("react-native");
|
|
14
|
+
const _expofont = require("expo-font");
|
|
15
|
+
const _theme = require("../../theme");
|
|
16
|
+
function _interop_require_default(obj) {
|
|
17
|
+
return obj && obj.__esModule ? obj : {
|
|
18
|
+
default: obj
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
const FONT_FAMILY = {
|
|
22
|
+
regular: 'GoogleSans_400Regular',
|
|
23
|
+
medium: 'GoogleSans_500Medium',
|
|
24
|
+
semibold: 'GoogleSans_600SemiBold'
|
|
25
|
+
};
|
|
26
|
+
const VARIANT_TOKEN_KEY = {
|
|
27
|
+
large: 'bodyLarge',
|
|
28
|
+
medium: 'bodyMedium',
|
|
29
|
+
small: 'bodySmall',
|
|
30
|
+
labelLarge: 'labelLarge',
|
|
31
|
+
labelMedium: 'labelMedium',
|
|
32
|
+
labelSmall: 'labelSmall'
|
|
33
|
+
};
|
|
34
|
+
function BodyText({ variant = 'medium', emphasized = false, color, style, ...rest }) {
|
|
35
|
+
const { typeScale: ts } = (0, _theme.useTheme)();
|
|
36
|
+
const [fontsLoaded] = (0, _expofont.useFonts)({
|
|
37
|
+
GoogleSans_400Regular: require('../../fonts/GoogleSans_400Regular.ttf'),
|
|
38
|
+
GoogleSans_500Medium: require('../../fonts/GoogleSans_500Medium.ttf'),
|
|
39
|
+
GoogleSans_600SemiBold: require('../../fonts/GoogleSans_600SemiBold.ttf')
|
|
40
|
+
});
|
|
41
|
+
const token = ts[VARIANT_TOKEN_KEY[variant]];
|
|
42
|
+
const weight = emphasized ? token.sysFontWeightEmphasized : token.sysFontWeight;
|
|
43
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_reactnative.Text, {
|
|
44
|
+
style: [
|
|
45
|
+
{
|
|
46
|
+
fontFamily: fontsLoaded ? FONT_FAMILY[weight] : undefined,
|
|
47
|
+
fontSize: token.sysFontSize,
|
|
48
|
+
lineHeight: token.sysLineHeight,
|
|
49
|
+
letterSpacing: token.sysTracking,
|
|
50
|
+
color
|
|
51
|
+
},
|
|
52
|
+
style
|
|
53
|
+
],
|
|
54
|
+
...rest
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../packages/react-native/src/components/BodyText/index.tsx"],"sourcesContent":["import React from 'react';\r\n\r\nimport { Text, type TextProps } from 'react-native';\r\n\r\nimport { useFonts } from 'expo-font';\r\n\r\nimport { useTheme } from '../../theme';\r\n\r\nexport type BodyVariant =\r\n | 'large'\r\n | 'medium'\r\n | 'small'\r\n | 'labelLarge'\r\n | 'labelMedium'\r\n | 'labelSmall';\r\n\r\nexport interface BodyTextProps extends TextProps {\r\n variant?: BodyVariant;\r\n emphasized?: boolean;\r\n color?: string;\r\n}\r\n\r\nconst FONT_FAMILY: Record<string, string> = {\r\n regular: 'GoogleSans_400Regular',\r\n medium: 'GoogleSans_500Medium',\r\n semibold: 'GoogleSans_600SemiBold',\r\n};\r\n\r\nconst VARIANT_TOKEN_KEY: Record<BodyVariant, string> = {\r\n large: 'bodyLarge',\r\n medium: 'bodyMedium',\r\n small: 'bodySmall',\r\n labelLarge: 'labelLarge',\r\n labelMedium: 'labelMedium',\r\n labelSmall: 'labelSmall',\r\n};\r\n\r\nexport function BodyText({\r\n variant = 'medium',\r\n emphasized = false,\r\n color,\r\n style,\r\n ...rest\r\n}: BodyTextProps) {\r\n const { typeScale: ts } = useTheme();\r\n\r\n const [fontsLoaded] = useFonts({\r\n GoogleSans_400Regular: require('../../fonts/GoogleSans_400Regular.ttf'),\r\n GoogleSans_500Medium: require('../../fonts/GoogleSans_500Medium.ttf'),\r\n GoogleSans_600SemiBold: require('../../fonts/GoogleSans_600SemiBold.ttf'),\r\n });\r\n\r\n const token = ts[VARIANT_TOKEN_KEY[variant] as keyof typeof ts];\r\n const weight = emphasized\r\n ? token.sysFontWeightEmphasized\r\n : token.sysFontWeight;\r\n\r\n return (\r\n <Text\r\n style={[\r\n {\r\n fontFamily: fontsLoaded ? FONT_FAMILY[weight] : undefined,\r\n fontSize: token.sysFontSize,\r\n lineHeight: token.sysLineHeight,\r\n letterSpacing: token.sysTracking,\r\n color,\r\n },\r\n style,\r\n ]}\r\n {...rest}\r\n />\r\n );\r\n}\r\n"],"names":["BodyText","FONT_FAMILY","regular","medium","semibold","VARIANT_TOKEN_KEY","large","small","labelLarge","labelMedium","labelSmall","variant","emphasized","color","style","rest","typeScale","ts","useTheme","fontsLoaded","useFonts","GoogleSans_400Regular","require","GoogleSans_500Medium","GoogleSans_600SemiBold","token","weight","sysFontWeightEmphasized","sysFontWeight","Text","fontFamily","undefined","fontSize","sysFontSize","lineHeight","sysLineHeight","letterSpacing","sysTracking"],"mappings":";;;;+BAqCgBA;;;eAAAA;;;;8DArCE;6BAEmB;0BAEZ;uBAEA;;;;;;AAgBzB,MAAMC,cAAsC;IAC1CC,SAAS;IACTC,QAAQ;IACRC,UAAU;AACZ;AAEA,MAAMC,oBAAiD;IACrDC,OAAO;IACPH,QAAQ;IACRI,OAAO;IACPC,YAAY;IACZC,aAAa;IACbC,YAAY;AACd;AAEO,SAASV,SAAS,EACvBW,UAAU,QAAQ,EAClBC,aAAa,KAAK,EAClBC,KAAK,EACLC,KAAK,EACL,GAAGC,MACW;IACd,MAAM,EAAEC,WAAWC,EAAE,EAAE,GAAGC,IAAAA,eAAQ;IAElC,MAAM,CAACC,YAAY,GAAGC,IAAAA,kBAAQ,EAAC;QAC7BC,uBAAuBC,QAAQ;QAC/BC,sBAAsBD,QAAQ;QAC9BE,wBAAwBF,QAAQ;IAClC;IAEA,MAAMG,QAAQR,EAAE,CAACZ,iBAAiB,CAACM,QAAQ,CAAoB;IAC/D,MAAMe,SAASd,aACXa,MAAME,uBAAuB,GAC7BF,MAAMG,aAAa;IAEvB,qBACE,qBAACC,iBAAI;QACHf,OAAO;YACL;gBACEgB,YAAYX,cAAclB,WAAW,CAACyB,OAAO,GAAGK;gBAChDC,UAAUP,MAAMQ,WAAW;gBAC3BC,YAAYT,MAAMU,aAAa;gBAC/BC,eAAeX,MAAMY,WAAW;gBAChCxB;YACF;YACAC;SACD;QACA,GAAGC,IAAI;;AAGd"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { StyleProp, ViewStyle } from 'react-native';
|
|
3
|
+
export type BreadcrumbSize = 'sm' | 'lg';
|
|
4
|
+
export interface BreadcrumbItem {
|
|
5
|
+
/** Display text. Omit when `isHome` is true. */
|
|
6
|
+
label?: string;
|
|
7
|
+
/** Renders the home icon instead of text */
|
|
8
|
+
isHome?: boolean;
|
|
9
|
+
/** Renders "…" — tap to expand hidden crumbs */
|
|
10
|
+
isOverflow?: boolean;
|
|
11
|
+
/** Reduces opacity; non-interactive */
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Press handler. Omit (or leave undefined) for the current/last item —
|
|
15
|
+
* it will automatically render as non-interactive with `sysOnSurface` text.
|
|
16
|
+
*/
|
|
17
|
+
onPress?: () => void;
|
|
18
|
+
}
|
|
19
|
+
export interface BreadcrumbProps {
|
|
20
|
+
items: BreadcrumbItem[];
|
|
21
|
+
size?: BreadcrumbSize;
|
|
22
|
+
style?: StyleProp<ViewStyle>;
|
|
23
|
+
}
|
|
24
|
+
export declare function Breadcrumb({ items, size, style }: BreadcrumbProps): React.JSX.Element;
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "Breadcrumb", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return Breadcrumb;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
const _jsxruntime = require("react/jsx-runtime");
|
|
12
|
+
const _react = /*#__PURE__*/ _interop_require_wildcard(require("react"));
|
|
13
|
+
const _reactnative = require("react-native");
|
|
14
|
+
const _vectoricons = require("@expo/vector-icons");
|
|
15
|
+
const _theme = require("../../theme");
|
|
16
|
+
function _getRequireWildcardCache(nodeInterop) {
|
|
17
|
+
if (typeof WeakMap !== "function") return null;
|
|
18
|
+
var cacheBabelInterop = new WeakMap();
|
|
19
|
+
var cacheNodeInterop = new WeakMap();
|
|
20
|
+
return (_getRequireWildcardCache = function(nodeInterop) {
|
|
21
|
+
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
|
22
|
+
})(nodeInterop);
|
|
23
|
+
}
|
|
24
|
+
function _interop_require_wildcard(obj, nodeInterop) {
|
|
25
|
+
if (!nodeInterop && obj && obj.__esModule) {
|
|
26
|
+
return obj;
|
|
27
|
+
}
|
|
28
|
+
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
|
|
29
|
+
return {
|
|
30
|
+
default: obj
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
var cache = _getRequireWildcardCache(nodeInterop);
|
|
34
|
+
if (cache && cache.has(obj)) {
|
|
35
|
+
return cache.get(obj);
|
|
36
|
+
}
|
|
37
|
+
var newObj = {
|
|
38
|
+
__proto__: null
|
|
39
|
+
};
|
|
40
|
+
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
41
|
+
for(var key in obj){
|
|
42
|
+
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
43
|
+
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
|
44
|
+
if (desc && (desc.get || desc.set)) {
|
|
45
|
+
Object.defineProperty(newObj, key, desc);
|
|
46
|
+
} else {
|
|
47
|
+
newObj[key] = obj[key];
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
newObj.default = obj;
|
|
52
|
+
if (cache) {
|
|
53
|
+
cache.set(obj, newObj);
|
|
54
|
+
}
|
|
55
|
+
return newObj;
|
|
56
|
+
}
|
|
57
|
+
function Breadcrumb({ items, size = 'lg', style }) {
|
|
58
|
+
const { colorRoles: cr, dimensions: dim, typeScale: ts } = (0, _theme.useTheme)();
|
|
59
|
+
const sizeTokens = (0, _react.useMemo)(()=>({
|
|
60
|
+
sm: {
|
|
61
|
+
fontSize: ts.labelSmall.sysFontSize,
|
|
62
|
+
lineHeight: ts.labelSmall.sysLineHeight,
|
|
63
|
+
letterSpacing: ts.labelSmall.sysTracking,
|
|
64
|
+
paddingH: dim.spacing.padding.sysPadding8,
|
|
65
|
+
paddingV: dim.spacing.padding.sysPadding2,
|
|
66
|
+
iconSize: 16,
|
|
67
|
+
dividerWidth: 8
|
|
68
|
+
},
|
|
69
|
+
lg: {
|
|
70
|
+
fontSize: ts.labelMedium.sysFontSize,
|
|
71
|
+
lineHeight: ts.labelMedium.sysLineHeight,
|
|
72
|
+
letterSpacing: ts.labelMedium.sysTracking,
|
|
73
|
+
paddingH: dim.spacing.padding.sysPadding8,
|
|
74
|
+
paddingV: dim.spacing.padding.sysPadding4,
|
|
75
|
+
iconSize: 16,
|
|
76
|
+
dividerWidth: 8
|
|
77
|
+
}
|
|
78
|
+
}), [
|
|
79
|
+
dim,
|
|
80
|
+
ts
|
|
81
|
+
]);
|
|
82
|
+
const s = sizeTokens[size];
|
|
83
|
+
return(// ScrollView lets a long breadcrumb scroll horizontally without clipping
|
|
84
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_reactnative.ScrollView, {
|
|
85
|
+
horizontal: true,
|
|
86
|
+
showsHorizontalScrollIndicator: false,
|
|
87
|
+
contentContainerStyle: styles.row,
|
|
88
|
+
style: style,
|
|
89
|
+
children: items.map((item, index)=>{
|
|
90
|
+
const isLast = index === items.length - 1;
|
|
91
|
+
// Last item is always "current" regardless of whether onPress is set
|
|
92
|
+
const isCurrent = isLast;
|
|
93
|
+
const isInteractive = !isCurrent && !item.disabled;
|
|
94
|
+
const textColor = isCurrent ? cr.surface.surface.sysOnSurface : cr.surface.surface.sysOnSurfaceVariant;
|
|
95
|
+
const content = /*#__PURE__*/ (0, _jsxruntime.jsx)(_reactnative.View, {
|
|
96
|
+
style: [
|
|
97
|
+
styles.content,
|
|
98
|
+
{
|
|
99
|
+
paddingHorizontal: s.paddingH,
|
|
100
|
+
paddingVertical: item.isHome ? dim.spacing.padding.sysPadding2 : s.paddingV,
|
|
101
|
+
gap: item.isHome ? 0 : dim.spacing.padding.sysPadding4
|
|
102
|
+
},
|
|
103
|
+
item.disabled && styles.disabled
|
|
104
|
+
],
|
|
105
|
+
children: item.isHome ? /*#__PURE__*/ (0, _jsxruntime.jsx)(_vectoricons.Ionicons, {
|
|
106
|
+
name: "home",
|
|
107
|
+
size: s.iconSize,
|
|
108
|
+
color: cr.surface.surface.sysOnSurfaceVariant
|
|
109
|
+
}) : /*#__PURE__*/ (0, _jsxruntime.jsx)(_reactnative.Text, {
|
|
110
|
+
style: {
|
|
111
|
+
color: textColor,
|
|
112
|
+
fontSize: s.fontSize,
|
|
113
|
+
lineHeight: s.lineHeight,
|
|
114
|
+
letterSpacing: s.letterSpacing,
|
|
115
|
+
includeFontPadding: false,
|
|
116
|
+
fontWeight: isCurrent ? '500' : '400'
|
|
117
|
+
},
|
|
118
|
+
numberOfLines: 1,
|
|
119
|
+
children: item.isOverflow ? '…' : item.label
|
|
120
|
+
})
|
|
121
|
+
});
|
|
122
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_reactnative.View, {
|
|
123
|
+
style: styles.item,
|
|
124
|
+
children: [
|
|
125
|
+
isInteractive ? /*#__PURE__*/ (0, _jsxruntime.jsx)(_reactnative.Pressable, {
|
|
126
|
+
onPress: item.onPress,
|
|
127
|
+
accessibilityRole: "link",
|
|
128
|
+
accessibilityLabel: item.isHome ? 'Home' : item.label,
|
|
129
|
+
style: ({ pressed })=>[
|
|
130
|
+
styles.pressable,
|
|
131
|
+
pressed && {
|
|
132
|
+
backgroundColor: cr.transparent.neutral.sysBlack10,
|
|
133
|
+
borderRadius: 4
|
|
134
|
+
}
|
|
135
|
+
],
|
|
136
|
+
children: content
|
|
137
|
+
}) : /*#__PURE__*/ (0, _jsxruntime.jsx)(_reactnative.View, {
|
|
138
|
+
accessibilityRole: isCurrent ? 'text' : undefined,
|
|
139
|
+
accessibilityState: isCurrent ? {
|
|
140
|
+
selected: true
|
|
141
|
+
} : undefined,
|
|
142
|
+
children: content
|
|
143
|
+
}),
|
|
144
|
+
!isLast && /*#__PURE__*/ (0, _jsxruntime.jsx)(_reactnative.View, {
|
|
145
|
+
accessible: false,
|
|
146
|
+
style: [
|
|
147
|
+
styles.divider,
|
|
148
|
+
{
|
|
149
|
+
width: s.dividerWidth
|
|
150
|
+
}
|
|
151
|
+
],
|
|
152
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_reactnative.Text, {
|
|
153
|
+
style: {
|
|
154
|
+
color: cr.surface.surface.sysOnSurfaceVariant,
|
|
155
|
+
fontSize: s.fontSize,
|
|
156
|
+
lineHeight: s.lineHeight,
|
|
157
|
+
includeFontPadding: false,
|
|
158
|
+
textAlign: 'center'
|
|
159
|
+
},
|
|
160
|
+
children: "/"
|
|
161
|
+
})
|
|
162
|
+
})
|
|
163
|
+
]
|
|
164
|
+
}, index);
|
|
165
|
+
})
|
|
166
|
+
}));
|
|
167
|
+
}
|
|
168
|
+
const styles = _reactnative.StyleSheet.create({
|
|
169
|
+
row: {
|
|
170
|
+
flexDirection: 'row',
|
|
171
|
+
alignItems: 'center'
|
|
172
|
+
},
|
|
173
|
+
item: {
|
|
174
|
+
flexDirection: 'row',
|
|
175
|
+
alignItems: 'center',
|
|
176
|
+
flexShrink: 0
|
|
177
|
+
},
|
|
178
|
+
pressable: {
|
|
179
|
+
borderRadius: 4
|
|
180
|
+
},
|
|
181
|
+
content: {
|
|
182
|
+
flexDirection: 'row',
|
|
183
|
+
alignItems: 'center'
|
|
184
|
+
},
|
|
185
|
+
disabled: {
|
|
186
|
+
opacity: 0.64
|
|
187
|
+
},
|
|
188
|
+
divider: {
|
|
189
|
+
alignItems: 'center',
|
|
190
|
+
justifyContent: 'center'
|
|
191
|
+
}
|
|
192
|
+
});
|
|
193
|
+
|
|
194
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../packages/react-native/src/components/Breadcrumb/index.tsx"],"sourcesContent":["import React, { useMemo } from 'react';\r\n\r\nimport {\r\n Pressable,\r\n ScrollView,\r\n StyleProp,\r\n StyleSheet,\r\n Text,\r\n View,\r\n ViewStyle,\r\n} from 'react-native';\r\n\r\nimport { Ionicons } from '@expo/vector-icons';\r\n\r\nimport { useTheme } from '../../theme';\r\n\r\nexport type BreadcrumbSize = 'sm' | 'lg';\r\n\r\nexport interface BreadcrumbItem {\r\n /** Display text. Omit when `isHome` is true. */\r\n label?: string;\r\n /** Renders the home icon instead of text */\r\n isHome?: boolean;\r\n /** Renders \"…\" — tap to expand hidden crumbs */\r\n isOverflow?: boolean;\r\n /** Reduces opacity; non-interactive */\r\n disabled?: boolean;\r\n /**\r\n * Press handler. Omit (or leave undefined) for the current/last item —\r\n * it will automatically render as non-interactive with `sysOnSurface` text.\r\n */\r\n onPress?: () => void;\r\n}\r\n\r\nexport interface BreadcrumbProps {\r\n items: BreadcrumbItem[];\r\n size?: BreadcrumbSize;\r\n style?: StyleProp<ViewStyle>;\r\n}\r\n\r\nexport function Breadcrumb({ items, size = 'lg', style }: BreadcrumbProps) {\r\n const { colorRoles: cr, dimensions: dim, typeScale: ts } = useTheme();\r\n\r\n const sizeTokens = useMemo(\r\n () => ({\r\n sm: {\r\n fontSize: ts.labelSmall.sysFontSize,\r\n lineHeight: ts.labelSmall.sysLineHeight,\r\n letterSpacing: ts.labelSmall.sysTracking,\r\n paddingH: dim.spacing.padding.sysPadding8,\r\n paddingV: dim.spacing.padding.sysPadding2,\r\n iconSize: 16,\r\n dividerWidth: 8,\r\n },\r\n lg: {\r\n fontSize: ts.labelMedium.sysFontSize,\r\n lineHeight: ts.labelMedium.sysLineHeight,\r\n letterSpacing: ts.labelMedium.sysTracking,\r\n paddingH: dim.spacing.padding.sysPadding8,\r\n paddingV: dim.spacing.padding.sysPadding4,\r\n iconSize: 16,\r\n dividerWidth: 8,\r\n },\r\n }),\r\n [dim, ts],\r\n );\r\n\r\n const s = sizeTokens[size];\r\n\r\n return (\r\n // ScrollView lets a long breadcrumb scroll horizontally without clipping\r\n <ScrollView\r\n horizontal\r\n showsHorizontalScrollIndicator={false}\r\n contentContainerStyle={styles.row}\r\n style={style}\r\n >\r\n {items.map((item, index) => {\r\n const isLast = index === items.length - 1;\r\n // Last item is always \"current\" regardless of whether onPress is set\r\n const isCurrent = isLast;\r\n const isInteractive = !isCurrent && !item.disabled;\r\n\r\n const textColor = isCurrent\r\n ? cr.surface.surface.sysOnSurface\r\n : cr.surface.surface.sysOnSurfaceVariant;\r\n\r\n const content = (\r\n <View\r\n style={[\r\n styles.content,\r\n {\r\n paddingHorizontal: s.paddingH,\r\n paddingVertical: item.isHome\r\n ? dim.spacing.padding.sysPadding2\r\n : s.paddingV,\r\n gap: item.isHome ? 0 : dim.spacing.padding.sysPadding4,\r\n },\r\n item.disabled && styles.disabled,\r\n ]}\r\n >\r\n {item.isHome ? (\r\n <Ionicons\r\n name=\"home\"\r\n size={s.iconSize}\r\n color={cr.surface.surface.sysOnSurfaceVariant}\r\n />\r\n ) : (\r\n <Text\r\n style={{\r\n color: textColor,\r\n fontSize: s.fontSize,\r\n lineHeight: s.lineHeight,\r\n letterSpacing: s.letterSpacing,\r\n includeFontPadding: false,\r\n fontWeight: isCurrent ? '500' : '400',\r\n }}\r\n numberOfLines={1}\r\n >\r\n {item.isOverflow ? '…' : item.label}\r\n </Text>\r\n )}\r\n </View>\r\n );\r\n\r\n return (\r\n <View key={index} style={styles.item}>\r\n {/* Item — pressable if navigable, plain View if current/disabled */}\r\n {isInteractive ? (\r\n <Pressable\r\n onPress={item.onPress}\r\n accessibilityRole=\"link\"\r\n accessibilityLabel={item.isHome ? 'Home' : item.label}\r\n style={({ pressed }) => [\r\n styles.pressable,\r\n pressed && {\r\n backgroundColor: cr.transparent.neutral.sysBlack10,\r\n borderRadius: 4,\r\n },\r\n ]}\r\n >\r\n {content}\r\n </Pressable>\r\n ) : (\r\n <View\r\n accessibilityRole={isCurrent ? 'text' : undefined}\r\n accessibilityState={isCurrent ? { selected: true } : undefined}\r\n >\r\n {content}\r\n </View>\r\n )}\r\n\r\n {/* Divider — shown after every item except the last */}\r\n {!isLast && (\r\n <View\r\n accessible={false}\r\n style={[styles.divider, { width: s.dividerWidth }]}\r\n >\r\n <Text\r\n style={{\r\n color: cr.surface.surface.sysOnSurfaceVariant,\r\n fontSize: s.fontSize,\r\n lineHeight: s.lineHeight,\r\n includeFontPadding: false,\r\n textAlign: 'center',\r\n }}\r\n >\r\n /\r\n </Text>\r\n </View>\r\n )}\r\n </View>\r\n );\r\n })}\r\n </ScrollView>\r\n );\r\n}\r\n\r\nconst styles = StyleSheet.create({\r\n row: {\r\n flexDirection: 'row',\r\n alignItems: 'center',\r\n },\r\n item: {\r\n flexDirection: 'row',\r\n alignItems: 'center',\r\n flexShrink: 0,\r\n },\r\n pressable: {\r\n borderRadius: 4,\r\n },\r\n content: {\r\n flexDirection: 'row',\r\n alignItems: 'center',\r\n },\r\n disabled: {\r\n opacity: 0.64,\r\n },\r\n divider: {\r\n alignItems: 'center',\r\n justifyContent: 'center',\r\n },\r\n});\r\n"],"names":["Breadcrumb","items","size","style","colorRoles","cr","dimensions","dim","typeScale","ts","useTheme","sizeTokens","useMemo","sm","fontSize","labelSmall","sysFontSize","lineHeight","sysLineHeight","letterSpacing","sysTracking","paddingH","spacing","padding","sysPadding8","paddingV","sysPadding2","iconSize","dividerWidth","lg","labelMedium","sysPadding4","s","ScrollView","horizontal","showsHorizontalScrollIndicator","contentContainerStyle","styles","row","map","item","index","isLast","length","isCurrent","isInteractive","disabled","textColor","surface","sysOnSurface","sysOnSurfaceVariant","content","View","paddingHorizontal","paddingVertical","isHome","gap","Ionicons","name","color","Text","includeFontPadding","fontWeight","numberOfLines","isOverflow","label","Pressable","onPress","accessibilityRole","accessibilityLabel","pressed","pressable","backgroundColor","transparent","neutral","sysBlack10","borderRadius","undefined","accessibilityState","selected","accessible","divider","width","textAlign","StyleSheet","create","flexDirection","alignItems","flexShrink","opacity","justifyContent"],"mappings":";;;;+BAwCgBA;;;eAAAA;;;;+DAxCe;6BAUxB;6BAEkB;uBAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0BlB,SAASA,WAAW,EAAEC,KAAK,EAAEC,OAAO,IAAI,EAAEC,KAAK,EAAmB;IACvE,MAAM,EAAEC,YAAYC,EAAE,EAAEC,YAAYC,GAAG,EAAEC,WAAWC,EAAE,EAAE,GAAGC,IAAAA,eAAQ;IAEnE,MAAMC,aAAaC,IAAAA,cAAO,EACxB,IAAO,CAAA;YACLC,IAAI;gBACFC,UAAUL,GAAGM,UAAU,CAACC,WAAW;gBACnCC,YAAYR,GAAGM,UAAU,CAACG,aAAa;gBACvCC,eAAeV,GAAGM,UAAU,CAACK,WAAW;gBACxCC,UAAUd,IAAIe,OAAO,CAACC,OAAO,CAACC,WAAW;gBACzCC,UAAUlB,IAAIe,OAAO,CAACC,OAAO,CAACG,WAAW;gBACzCC,UAAU;gBACVC,cAAc;YAChB;YACAC,IAAI;gBACFf,UAAUL,GAAGqB,WAAW,CAACd,WAAW;g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MAAM;QACJ8C,eAAe;QACfC,YAAY;QACZC,YAAY;IACd;IACAjB,WAAW;QACTK,cAAc;IAChB;IACAzB,SAAS;QACPmC,eAAe;QACfC,YAAY;IACd;IACAzC,UAAU;QACR2C,SAAS;IACX;IACAR,SAAS;QACPM,YAAY;QACZG,gBAAgB;IAClB;AACF"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type PressableProps } from 'react-native';
|
|
3
|
+
export type ButtonVariant = 'filled' | 'tonal' | 'outlined' | 'elevated' | 'text' | 'danger' | 'danger-outlined' | 'warning';
|
|
4
|
+
export type ButtonSize = 'sm' | 'md' | 'lg' | 'xl';
|
|
5
|
+
export interface ButtonProps extends Omit<PressableProps, 'children' | 'style'> {
|
|
6
|
+
variant?: ButtonVariant;
|
|
7
|
+
size?: ButtonSize;
|
|
8
|
+
label: string;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
loading?: boolean;
|
|
11
|
+
fullWidth?: boolean;
|
|
12
|
+
iconOnly?: boolean;
|
|
13
|
+
leadingIcon?: React.ReactNode;
|
|
14
|
+
trailingIcon?: React.ReactNode;
|
|
15
|
+
}
|
|
16
|
+
export declare function Button({ variant, size, label, disabled, loading, fullWidth, iconOnly, leadingIcon, trailingIcon, onPress, accessibilityLabel, ...rest }: ButtonProps): React.JSX.Element;
|
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "Button", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return Button;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
const _jsxruntime = require("react/jsx-runtime");
|
|
12
|
+
const _react = /*#__PURE__*/ _interop_require_wildcard(require("react"));
|
|
13
|
+
const _reactnative = require("react-native");
|
|
14
|
+
const _theme = require("../../theme");
|
|
15
|
+
function _getRequireWildcardCache(nodeInterop) {
|
|
16
|
+
if (typeof WeakMap !== "function") return null;
|
|
17
|
+
var cacheBabelInterop = new WeakMap();
|
|
18
|
+
var cacheNodeInterop = new WeakMap();
|
|
19
|
+
return (_getRequireWildcardCache = function(nodeInterop) {
|
|
20
|
+
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
|
21
|
+
})(nodeInterop);
|
|
22
|
+
}
|
|
23
|
+
function _interop_require_wildcard(obj, nodeInterop) {
|
|
24
|
+
if (!nodeInterop && obj && obj.__esModule) {
|
|
25
|
+
return obj;
|
|
26
|
+
}
|
|
27
|
+
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
|
|
28
|
+
return {
|
|
29
|
+
default: obj
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
var cache = _getRequireWildcardCache(nodeInterop);
|
|
33
|
+
if (cache && cache.has(obj)) {
|
|
34
|
+
return cache.get(obj);
|
|
35
|
+
}
|
|
36
|
+
var newObj = {
|
|
37
|
+
__proto__: null
|
|
38
|
+
};
|
|
39
|
+
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
40
|
+
for(var key in obj){
|
|
41
|
+
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
42
|
+
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
|
43
|
+
if (desc && (desc.get || desc.set)) {
|
|
44
|
+
Object.defineProperty(newObj, key, desc);
|
|
45
|
+
} else {
|
|
46
|
+
newObj[key] = obj[key];
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
newObj.default = obj;
|
|
51
|
+
if (cache) {
|
|
52
|
+
cache.set(obj, newObj);
|
|
53
|
+
}
|
|
54
|
+
return newObj;
|
|
55
|
+
}
|
|
56
|
+
function Button({ variant = 'filled', size = 'md', label, disabled = false, loading = false, fullWidth = false, iconOnly = false, leadingIcon, trailingIcon, onPress, accessibilityLabel, ...rest }) {
|
|
57
|
+
const { colorRoles: cr, dimensions: dim, typeScale: ts, iconography: ico } = (0, _theme.useTheme)();
|
|
58
|
+
const VARIANT_TOKENS = (0, _react.useMemo)(()=>({
|
|
59
|
+
filled: {
|
|
60
|
+
bg: cr.accent.primary.sysPrimary,
|
|
61
|
+
label: cr.accent.primary.sysOnPrimary,
|
|
62
|
+
borderColor: 'transparent',
|
|
63
|
+
borderWidth: 0
|
|
64
|
+
},
|
|
65
|
+
tonal: {
|
|
66
|
+
bg: cr.addOn.primaryFixed.sysPrimaryFixedDim,
|
|
67
|
+
label: cr.addOn.primaryFixed.sysOnPrimaryFixed,
|
|
68
|
+
borderColor: 'transparent',
|
|
69
|
+
borderWidth: 0
|
|
70
|
+
},
|
|
71
|
+
outlined: {
|
|
72
|
+
bg: 'transparent',
|
|
73
|
+
label: cr.surface.surface.sysOnSurface,
|
|
74
|
+
borderColor: cr.outline.sysOutline,
|
|
75
|
+
borderWidth: dim.borderWidth.sysStrokeThin
|
|
76
|
+
},
|
|
77
|
+
elevated: {
|
|
78
|
+
bg: cr.surface.surfaceContainer.sysSurfaceContainerLowest,
|
|
79
|
+
label: cr.surface.surface.sysOnSurface,
|
|
80
|
+
borderColor: 'transparent',
|
|
81
|
+
borderWidth: 0
|
|
82
|
+
},
|
|
83
|
+
text: {
|
|
84
|
+
bg: 'transparent',
|
|
85
|
+
label: cr.surface.surface.sysOnSurface,
|
|
86
|
+
borderColor: 'transparent',
|
|
87
|
+
borderWidth: 0
|
|
88
|
+
},
|
|
89
|
+
danger: {
|
|
90
|
+
bg: cr.error.sysError,
|
|
91
|
+
label: cr.error.sysOnError,
|
|
92
|
+
borderColor: 'transparent',
|
|
93
|
+
borderWidth: 0
|
|
94
|
+
},
|
|
95
|
+
'danger-outlined': {
|
|
96
|
+
bg: 'transparent',
|
|
97
|
+
label: cr.error.sysError,
|
|
98
|
+
borderColor: cr.error.sysErrorContainer,
|
|
99
|
+
borderWidth: dim.borderWidth.sysStrokeThin
|
|
100
|
+
},
|
|
101
|
+
warning: {
|
|
102
|
+
bg: cr.custom.warning.sysWarning,
|
|
103
|
+
label: cr.custom.warning.sysOnWarning,
|
|
104
|
+
borderColor: 'transparent',
|
|
105
|
+
borderWidth: 0
|
|
106
|
+
}
|
|
107
|
+
}), [
|
|
108
|
+
cr,
|
|
109
|
+
dim
|
|
110
|
+
]);
|
|
111
|
+
const SIZE_TOKENS = (0, _react.useMemo)(()=>({
|
|
112
|
+
sm: {
|
|
113
|
+
height: 32,
|
|
114
|
+
paddingH: dim.spacing.padding.sysPadding12,
|
|
115
|
+
paddingV: dim.spacing.padding.sysPadding4,
|
|
116
|
+
fontSize: ts.labelSmall.sysFontSize,
|
|
117
|
+
lineHeight: ts.labelSmall.sysLineHeight,
|
|
118
|
+
iconSize: ico.sysSizeXs
|
|
119
|
+
},
|
|
120
|
+
md: {
|
|
121
|
+
height: 40,
|
|
122
|
+
paddingH: dim.spacing.padding.sysPadding16,
|
|
123
|
+
paddingV: dim.spacing.padding.sysPadding8,
|
|
124
|
+
fontSize: ts.labelMedium.sysFontSize,
|
|
125
|
+
lineHeight: ts.labelMedium.sysLineHeight,
|
|
126
|
+
iconSize: ico.sysSizeXs
|
|
127
|
+
},
|
|
128
|
+
lg: {
|
|
129
|
+
height: 48,
|
|
130
|
+
paddingH: dim.spacing.padding.sysPadding24,
|
|
131
|
+
paddingV: dim.spacing.padding.sysPadding12,
|
|
132
|
+
fontSize: ts.labelLarge.sysFontSize,
|
|
133
|
+
lineHeight: ts.labelLarge.sysLineHeight,
|
|
134
|
+
iconSize: ico.sysSizeSm
|
|
135
|
+
},
|
|
136
|
+
xl: {
|
|
137
|
+
height: 56,
|
|
138
|
+
paddingH: dim.spacing.padding.sysPadding32,
|
|
139
|
+
paddingV: dim.spacing.padding.sysPadding16,
|
|
140
|
+
fontSize: ts.titleSmall.sysFontSize,
|
|
141
|
+
lineHeight: ts.titleSmall.sysLineHeight,
|
|
142
|
+
iconSize: ico.sysSizeMd
|
|
143
|
+
}
|
|
144
|
+
}), [
|
|
145
|
+
dim,
|
|
146
|
+
ts,
|
|
147
|
+
ico
|
|
148
|
+
]);
|
|
149
|
+
const v = VARIANT_TOKENS[variant];
|
|
150
|
+
const s = SIZE_TOKENS[size];
|
|
151
|
+
const isDisabled = disabled || loading;
|
|
152
|
+
const paddingH = variant === 'text' ? 0 : s.paddingH;
|
|
153
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_reactnative.Pressable, {
|
|
154
|
+
...rest,
|
|
155
|
+
onPress: isDisabled ? undefined : onPress,
|
|
156
|
+
accessibilityRole: "button",
|
|
157
|
+
accessibilityLabel: accessibilityLabel ?? label,
|
|
158
|
+
accessibilityState: {
|
|
159
|
+
disabled: isDisabled,
|
|
160
|
+
busy: loading
|
|
161
|
+
},
|
|
162
|
+
style: ({ pressed })=>[
|
|
163
|
+
styles.root,
|
|
164
|
+
{
|
|
165
|
+
backgroundColor: v.bg,
|
|
166
|
+
borderColor: v.borderColor,
|
|
167
|
+
borderWidth: v.borderWidth,
|
|
168
|
+
borderRadius: dim.borderRadius.sysRadiusFull,
|
|
169
|
+
...iconOnly ? {
|
|
170
|
+
width: s.height,
|
|
171
|
+
height: s.height
|
|
172
|
+
} : variant === 'text' ? {
|
|
173
|
+
// Text variant is content-height (no fixed container). Figma:
|
|
174
|
+
// sm=26px, md=28px, lg=31px, xl=32px — each resolves to
|
|
175
|
+
// lineHeight + 2×paddingV, not the standard fixed height.
|
|
176
|
+
paddingHorizontal: 0,
|
|
177
|
+
paddingVertical: s.paddingV
|
|
178
|
+
} : {
|
|
179
|
+
height: s.height,
|
|
180
|
+
paddingHorizontal: paddingH,
|
|
181
|
+
paddingVertical: s.paddingV
|
|
182
|
+
},
|
|
183
|
+
...fullWidth && !iconOnly ? {
|
|
184
|
+
alignSelf: 'stretch'
|
|
185
|
+
} : {},
|
|
186
|
+
opacity: isDisabled ? 0.48 : pressed ? 0.82 : 1,
|
|
187
|
+
// Elevated: Figma specifies two drop shadows — RN only supports one
|
|
188
|
+
// on iOS, so we use the larger/more visible one (lv2: 0px 4px 16px
|
|
189
|
+
// rgba(0,0,0,0.10)) and fall back to elevation: 2 on Android.
|
|
190
|
+
...variant === 'elevated' ? {
|
|
191
|
+
shadowColor: '#000',
|
|
192
|
+
shadowOffset: {
|
|
193
|
+
width: 0,
|
|
194
|
+
height: 4
|
|
195
|
+
},
|
|
196
|
+
shadowOpacity: 0.1,
|
|
197
|
+
shadowRadius: 16,
|
|
198
|
+
elevation: 2
|
|
199
|
+
} : {}
|
|
200
|
+
}
|
|
201
|
+
],
|
|
202
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsxs)(_reactnative.View, {
|
|
203
|
+
style: [
|
|
204
|
+
styles.content,
|
|
205
|
+
{
|
|
206
|
+
gap: dim.spacing.padding.sysPadding8
|
|
207
|
+
}
|
|
208
|
+
],
|
|
209
|
+
children: [
|
|
210
|
+
loading ? /*#__PURE__*/ (0, _jsxruntime.jsx)(_reactnative.ActivityIndicator, {
|
|
211
|
+
size: s.iconSize,
|
|
212
|
+
color: v.label
|
|
213
|
+
}) : leadingIcon ? /*#__PURE__*/ (0, _jsxruntime.jsx)(_reactnative.View, {
|
|
214
|
+
style: {
|
|
215
|
+
width: s.iconSize,
|
|
216
|
+
height: s.iconSize,
|
|
217
|
+
alignItems: 'center',
|
|
218
|
+
justifyContent: 'center'
|
|
219
|
+
},
|
|
220
|
+
children: leadingIcon
|
|
221
|
+
}) : null,
|
|
222
|
+
!iconOnly && /*#__PURE__*/ (0, _jsxruntime.jsx)(_reactnative.Text, {
|
|
223
|
+
style: {
|
|
224
|
+
color: v.label,
|
|
225
|
+
fontSize: s.fontSize,
|
|
226
|
+
lineHeight: s.lineHeight,
|
|
227
|
+
fontWeight: '600',
|
|
228
|
+
includeFontPadding: false
|
|
229
|
+
},
|
|
230
|
+
numberOfLines: 1,
|
|
231
|
+
children: label
|
|
232
|
+
}),
|
|
233
|
+
trailingIcon && /*#__PURE__*/ (0, _jsxruntime.jsx)(_reactnative.View, {
|
|
234
|
+
style: {
|
|
235
|
+
width: s.iconSize,
|
|
236
|
+
height: s.iconSize,
|
|
237
|
+
alignItems: 'center',
|
|
238
|
+
justifyContent: 'center'
|
|
239
|
+
},
|
|
240
|
+
children: trailingIcon
|
|
241
|
+
})
|
|
242
|
+
]
|
|
243
|
+
})
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
const styles = _reactnative.StyleSheet.create({
|
|
247
|
+
root: {
|
|
248
|
+
flexDirection: 'row',
|
|
249
|
+
justifyContent: 'center',
|
|
250
|
+
alignItems: 'center',
|
|
251
|
+
overflow: 'hidden'
|
|
252
|
+
},
|
|
253
|
+
content: {
|
|
254
|
+
flexDirection: 'row',
|
|
255
|
+
alignItems: 'center',
|
|
256
|
+
justifyContent: 'center'
|
|
257
|
+
}
|
|
258
|
+
});
|
|
259
|
+
|
|
260
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../packages/react-native/src/components/Button/index.tsx"],"sourcesContent":["import React, { useMemo } from 'react';\r\n\r\nimport {\r\n ActivityIndicator,\r\n Pressable,\r\n type PressableProps,\r\n StyleSheet,\r\n Text,\r\n View,\r\n} from 'react-native';\r\n\r\nimport { useTheme } from '../../theme';\r\n\r\nexport type ButtonVariant =\r\n | 'filled'\r\n | 'tonal'\r\n | 'outlined'\r\n | 'elevated'\r\n | 'text'\r\n | 'danger'\r\n | 'danger-outlined'\r\n | 'warning';\r\n\r\nexport type ButtonSize = 'sm' | 'md' | 'lg' | 'xl';\r\n\r\nexport interface ButtonProps extends Omit<\r\n PressableProps,\r\n 'children' | 'style'\r\n> {\r\n variant?: ButtonVariant;\r\n size?: ButtonSize;\r\n label: string;\r\n disabled?: boolean;\r\n loading?: boolean;\r\n fullWidth?: boolean;\r\n iconOnly?: boolean;\r\n leadingIcon?: React.ReactNode;\r\n trailingIcon?: React.ReactNode;\r\n}\r\n\r\nexport function Button({\r\n variant = 'filled',\r\n size = 'md',\r\n label,\r\n disabled = false,\r\n loading = false,\r\n fullWidth = false,\r\n iconOnly = false,\r\n leadingIcon,\r\n trailingIcon,\r\n onPress,\r\n accessibilityLabel,\r\n ...rest\r\n}: ButtonProps) {\r\n const {\r\n colorRoles: cr,\r\n dimensions: dim,\r\n typeScale: ts,\r\n iconography: ico,\r\n } = useTheme();\r\n\r\n const VARIANT_TOKENS = useMemo(\r\n () =>\r\n ({\r\n filled: {\r\n bg: cr.accent.primary.sysPrimary,\r\n label: cr.accent.primary.sysOnPrimary,\r\n borderColor: 'transparent',\r\n borderWidth: 0,\r\n },\r\n tonal: {\r\n bg: cr.addOn.primaryFixed.sysPrimaryFixedDim,\r\n label: cr.addOn.primaryFixed.sysOnPrimaryFixed,\r\n borderColor: 'transparent',\r\n borderWidth: 0,\r\n },\r\n outlined: {\r\n bg: 'transparent',\r\n label: cr.surface.surface.sysOnSurface,\r\n borderColor: cr.outline.sysOutline,\r\n borderWidth: dim.borderWidth.sysStrokeThin,\r\n },\r\n elevated: {\r\n bg: cr.surface.surfaceContainer.sysSurfaceContainerLowest,\r\n label: cr.surface.surface.sysOnSurface,\r\n borderColor: 'transparent',\r\n borderWidth: 0,\r\n },\r\n text: {\r\n bg: 'transparent',\r\n label: cr.surface.surface.sysOnSurface,\r\n borderColor: 'transparent',\r\n borderWidth: 0,\r\n },\r\n danger: {\r\n bg: cr.error.sysError,\r\n label: cr.error.sysOnError,\r\n borderColor: 'transparent',\r\n borderWidth: 0,\r\n },\r\n 'danger-outlined': {\r\n bg: 'transparent',\r\n label: cr.error.sysError,\r\n borderColor: cr.error.sysErrorContainer,\r\n borderWidth: dim.borderWidth.sysStrokeThin,\r\n },\r\n warning: {\r\n bg: cr.custom.warning.sysWarning,\r\n label: cr.custom.warning.sysOnWarning,\r\n borderColor: 'transparent',\r\n borderWidth: 0,\r\n },\r\n }) as Record<\r\n ButtonVariant,\r\n { bg: string; label: string; borderColor: string; borderWidth: number }\r\n >,\r\n [cr, dim],\r\n );\r\n\r\n const SIZE_TOKENS = useMemo(\r\n () => ({\r\n sm: {\r\n height: 32,\r\n paddingH: dim.spacing.padding.sysPadding12,\r\n paddingV: dim.spacing.padding.sysPadding4,\r\n fontSize: ts.labelSmall.sysFontSize,\r\n lineHeight: ts.labelSmall.sysLineHeight,\r\n iconSize: ico.sysSizeXs,\r\n },\r\n md: {\r\n height: 40,\r\n paddingH: dim.spacing.padding.sysPadding16,\r\n paddingV: dim.spacing.padding.sysPadding8,\r\n fontSize: ts.labelMedium.sysFontSize,\r\n lineHeight: ts.labelMedium.sysLineHeight,\r\n iconSize: ico.sysSizeXs,\r\n },\r\n lg: {\r\n height: 48,\r\n paddingH: dim.spacing.padding.sysPadding24,\r\n paddingV: dim.spacing.padding.sysPadding12,\r\n fontSize: ts.labelLarge.sysFontSize,\r\n lineHeight: ts.labelLarge.sysLineHeight,\r\n iconSize: ico.sysSizeSm,\r\n },\r\n xl: {\r\n height: 56,\r\n paddingH: dim.spacing.padding.sysPadding32,\r\n paddingV: dim.spacing.padding.sysPadding16,\r\n fontSize: ts.titleSmall.sysFontSize,\r\n lineHeight: ts.titleSmall.sysLineHeight,\r\n iconSize: ico.sysSizeMd,\r\n },\r\n }),\r\n [dim, ts, ico],\r\n );\r\n\r\n const v = VARIANT_TOKENS[variant];\r\n const s = SIZE_TOKENS[size];\r\n const isDisabled = disabled || loading;\r\n const paddingH = variant === 'text' ? 0 : s.paddingH;\r\n\r\n return (\r\n <Pressable\r\n {...rest}\r\n onPress={isDisabled ? undefined : onPress}\r\n accessibilityRole=\"button\"\r\n accessibilityLabel={accessibilityLabel ?? label}\r\n accessibilityState={{ disabled: isDisabled, busy: loading }}\r\n style={({ pressed }) => [\r\n styles.root,\r\n {\r\n backgroundColor: v.bg,\r\n borderColor: v.borderColor,\r\n borderWidth: v.borderWidth,\r\n borderRadius: dim.borderRadius.sysRadiusFull,\r\n ...(iconOnly\r\n ? { width: s.height, height: s.height }\r\n : variant === 'text'\r\n ? {\r\n // Text variant is content-height (no fixed container). Figma:\r\n // sm=26px, md=28px, lg=31px, xl=32px — each resolves to\r\n // lineHeight + 2×paddingV, not the standard fixed height.\r\n paddingHorizontal: 0,\r\n paddingVertical: s.paddingV,\r\n }\r\n : {\r\n height: s.height,\r\n paddingHorizontal: paddingH,\r\n paddingVertical: s.paddingV,\r\n }),\r\n ...(fullWidth && !iconOnly ? { alignSelf: 'stretch' } : {}),\r\n opacity: isDisabled ? 0.48 : pressed ? 0.82 : 1,\r\n // Elevated: Figma specifies two drop shadows — RN only supports one\r\n // on iOS, so we use the larger/more visible one (lv2: 0px 4px 16px\r\n // rgba(0,0,0,0.10)) and fall back to elevation: 2 on Android.\r\n ...(variant === 'elevated'\r\n ? {\r\n shadowColor: '#000',\r\n shadowOffset: { width: 0, height: 4 },\r\n shadowOpacity: 0.1,\r\n shadowRadius: 16,\r\n elevation: 2,\r\n }\r\n : {}),\r\n },\r\n ]}\r\n >\r\n <View style={[styles.content, { gap: dim.spacing.padding.sysPadding8 }]}>\r\n {loading ? (\r\n <ActivityIndicator size={s.iconSize} color={v.label} />\r\n ) : leadingIcon ? (\r\n <View\r\n style={{\r\n width: s.iconSize,\r\n height: s.iconSize,\r\n alignItems: 'center',\r\n justifyContent: 'center',\r\n }}\r\n >\r\n {leadingIcon}\r\n </View>\r\n ) : null}\r\n\r\n {!iconOnly && (\r\n <Text\r\n style={{\r\n color: v.label,\r\n fontSize: s.fontSize,\r\n lineHeight: s.lineHeight,\r\n fontWeight: '600',\r\n includeFontPadding: false,\r\n }}\r\n numberOfLines={1}\r\n >\r\n {label}\r\n </Text>\r\n )}\r\n\r\n {trailingIcon && (\r\n <View\r\n style={{\r\n width: s.iconSize,\r\n height: s.iconSize,\r\n alignItems: 'center',\r\n justifyContent: 'center',\r\n }}\r\n >\r\n {trailingIcon}\r\n </View>\r\n )}\r\n </View>\r\n </Pressable>\r\n );\r\n}\r\n\r\nconst styles = StyleSheet.create({\r\n root: {\r\n flexDirection: 'row',\r\n justifyContent: 'center',\r\n alignItems: 'center',\r\n overflow: 'hidden',\r\n },\r\n content: {\r\n flexDirection: 'row',\r\n alignItems: 'center',\r\n justifyContent: 'center',\r\n },\r\n});\r\n"],"names":["Button","variant","size","label","disabled","loading","fullWidth","iconOnly","leadingIcon","trailingIcon","onPress","accessibilityLabel","rest","colorRoles","cr","dimensions","dim","typeScale","ts","iconography","ico","useTheme","VARIANT_TOKENS","useMemo","filled","bg","accent","primary","sysPrimary","sysOnPrimary","borderColor","borderWidth","tonal","addOn","primaryFixed","sysPrimaryFixedDim","sysOnPrimaryFixed","outlined","surface","sysOnSurface","outline","sysOutline","sysStrokeThin","elevated","surfaceContainer","sysSurfaceContainerLowest","text","danger","error","sysError","sysOnError","sysErrorContainer","warning","custom","sysWarning","sysOnWarning","SIZE_TOKENS","sm","height","paddingH","spacing","padding","sysPadding12","paddingV","sysPadding4","fontSize","labelSmall","sysFontSize","lineHeight","sysLineHeight","iconSize","sysSizeXs","md","sysPadding16","sysPadding8","labelMedium","lg","sysPadding24","labelLarge","sysSizeSm","xl","sysPadding32","titleSmall","sysSizeMd","v","s","isDisabled","Pressable","undefined","accessibilityRole","accessibilityState","busy","style","pressed","styles","root","backgroundColor","borderRadius","sysRadiusFull","width","paddingHorizontal","paddingVertical","alignSelf","opacity","shadowColor","shadowOffset","shadowOpacity","shadowRadius","elevation","View","content","gap","ActivityIndicator","color","alignItems","justifyContent","Text","fontWeight","includeFontPadding","numberOfLines","StyleSheet","create","flexDirection","overflow"],"mappings":";;;;+BAwCgBA;;;eAAAA;;;;+DAxCe;6BASxB;uBAEkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BlB,SAASA,OAAO,EACrBC,UAAU,QAAQ,EAClBC,OAAO,IAAI,EACXC,KAAK,EACLC,WAAW,KAAK,EAChBC,UAAU,KAAK,EACfC,YAAY,KAAK,EACjBC,WAAW,KAAK,EAChBC,WAAW,EACXC,Y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AI5F,YAAY,aACZ;wBACEuG,aAAa;wBACbC,cAAc;4BAAEN,OAAO;4BAAGzC,QAAQ;wBAAE;wBACpCgD,eAAe;wBACfC,cAAc;wBACdC,WAAW;oBACb,IACA,CAAC,CAAC;gBACR;aACD;kBAED,cAAA,sBAACC,iBAAI;YAACjB,OAAO;gBAACE,OAAOgB,OAAO;gBAAE;oBAAEC,KAAK/F,IAAI4C,OAAO,CAACC,OAAO,CAACa,WAAW;gBAAC;aAAE;;gBACpErE,wBACC,qBAAC2G,8BAAiB;oBAAC9G,MAAMmF,EAAEf,QAAQ;oBAAE2C,OAAO7B,EAAEjF,KAAK;qBACjDK,4BACF,qBAACqG,iBAAI;oBACHjB,OAAO;wBACLO,OAAOd,EAAEf,QAAQ;wBACjBZ,QAAQ2B,EAAEf,QAAQ;wBAClB4C,YAAY;wBACZC,gBAAgB;oBAClB;8BAEC3G;qBAED;gBAEH,CAACD,0BACA,qBAAC6G,iBAAI;oBACHxB,OAAO;wBACLqB,OAAO7B,EAAEjF,KAAK;wBACd8D,UAAUoB,EAAEpB,QAAQ;wBACpBG,YAAYiB,EAAEjB,UAAU;wBACxBiD,YAAY;wBACZC,oBAAoB;oBACtB;oBACAC,eAAe;8BAEdpH;;gBAIJM,8BACC,qBAACoG,iBAAI;oBACHjB,OAAO;wBACLO,OAAOd,EAAEf,QAAQ;wBACjBZ,QAAQ2B,EAAEf,QAAQ;wBAClB4C,YAAY;wBACZC,gBAAgB;oBAClB;8BAEC1G;;;;;AAMb;AAEA,MAAMqF,SAAS0B,uBAAU,CAACC,MAAM,CAAC;IAC/B1B,MAAM;QACJ2B,eAAe;QACfP,gBAAgB;QAChBD,YAAY;QACZS,UAAU;IACZ;IACAb,SAAS;QACPY,eAAe;QACfR,YAAY;QACZC,gBAAgB;IAClB;AACF"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { StyleProp, ViewStyle } from 'react-native';
|
|
3
|
+
export type CheckboxSize = 'sm' | 'md';
|
|
4
|
+
export type CheckboxCheckedState = boolean | 'indeterminate';
|
|
5
|
+
export interface CheckboxProps {
|
|
6
|
+
checked?: CheckboxCheckedState;
|
|
7
|
+
defaultChecked?: boolean;
|
|
8
|
+
onChange?: (checked: boolean) => void;
|
|
9
|
+
size?: CheckboxSize;
|
|
10
|
+
label?: string;
|
|
11
|
+
description?: string;
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
invalid?: boolean;
|
|
14
|
+
style?: StyleProp<ViewStyle>;
|
|
15
|
+
}
|
|
16
|
+
export declare function Checkbox({ checked: checkedProp, defaultChecked, onChange, size, label, description, disabled, invalid, style, }: CheckboxProps): React.JSX.Element;
|