@fountain-ui/core 3.0.0-alpha.10 → 3.0.0-alpha.12
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/build/commonjs/AppBar/AppBar.js +6 -1
- package/build/commonjs/AppBar/AppBar.js.map +1 -1
- package/build/commonjs/Badge/Badge.js +4 -3
- package/build/commonjs/Badge/Badge.js.map +1 -1
- package/build/commonjs/Badge/BadgeProps.js.map +1 -1
- package/build/commonjs/ButtonBase/index.js +2 -2
- package/build/commonjs/ButtonBase/index.js.map +1 -1
- package/build/commonjs/Chip/Chip.js +21 -14
- package/build/commonjs/Chip/Chip.js.map +1 -1
- package/build/commonjs/Chip/ChipProps.js +3 -1
- package/build/commonjs/Chip/ChipProps.js.map +1 -1
- package/build/commonjs/Chip/index.js +6 -0
- package/build/commonjs/Chip/index.js.map +1 -1
- package/build/commonjs/Chip/useChipStyle.js +29 -19
- package/build/commonjs/Chip/useChipStyle.js.map +1 -1
- package/build/commonjs/Dialog/Dialog.js +7 -8
- package/build/commonjs/Dialog/Dialog.js.map +1 -1
- package/build/commonjs/Dialog/DialogProps.js +1 -1
- package/build/commonjs/Dialog/DialogProps.js.map +1 -1
- package/build/commonjs/Dialog/useDialogSectionStyle.js +6 -4
- package/build/commonjs/Dialog/useDialogSectionStyle.js.map +1 -1
- package/build/commonjs/Dialog/useDialogStyle.js +9 -8
- package/build/commonjs/Dialog/useDialogStyle.js.map +1 -1
- package/build/commonjs/DialogTitle/DialogLargeTitle.js +80 -0
- package/build/commonjs/DialogTitle/DialogLargeTitle.js.map +1 -0
- package/build/commonjs/DialogTitle/DialogTitle.js +8 -4
- package/build/commonjs/DialogTitle/DialogTitle.js.map +1 -1
- package/build/commonjs/Divider/Divider.js +17 -9
- package/build/commonjs/Divider/Divider.js.map +1 -1
- package/build/commonjs/Divider/DividerProps.js +1 -1
- package/build/commonjs/Divider/DividerProps.js.map +1 -1
- package/build/commonjs/ListItem/ListItem.js +3 -13
- package/build/commonjs/ListItem/ListItem.js.map +1 -1
- package/build/commonjs/Pagination/Pagination.js +2 -0
- package/build/commonjs/Pagination/Pagination.js.map +1 -1
- package/build/commonjs/Pagination/PaginationProps.js +3 -1
- package/build/commonjs/Pagination/PaginationProps.js.map +1 -1
- package/build/commonjs/Pagination/index.js +6 -0
- package/build/commonjs/Pagination/index.js.map +1 -1
- package/build/commonjs/PaginationItem/PaginationItem.js +32 -22
- package/build/commonjs/PaginationItem/PaginationItem.js.map +1 -1
- package/build/commonjs/PaginationItem/PaginationItemProps.js.map +1 -1
- package/build/commonjs/Tab/Tab.js +11 -3
- package/build/commonjs/Tab/Tab.js.map +1 -1
- package/build/commonjs/Tabs/useTabsStyle.js +7 -4
- package/build/commonjs/Tabs/useTabsStyle.js.map +1 -1
- package/build/commonjs/Toolbar/BackButton/BackButton.js +47 -0
- package/build/commonjs/Toolbar/BackButton/BackButton.js.map +1 -0
- package/build/commonjs/Toolbar/BackButton/BackButtonProps.js +2 -0
- package/build/commonjs/Toolbar/BackButton/BackButtonProps.js.map +1 -0
- package/build/commonjs/Toolbar/BackButton/index.js +16 -0
- package/build/commonjs/Toolbar/BackButton/index.js.map +1 -0
- package/build/commonjs/Toolbar/Toolbar.js +8 -4
- package/build/commonjs/Toolbar/Toolbar.js.map +1 -1
- package/build/commonjs/internal/icons/ChevronLeft.js +4 -2
- package/build/commonjs/internal/icons/ChevronLeft.js.map +1 -1
- package/build/commonjs/internal/icons/ChevronRight.js +4 -2
- package/build/commonjs/internal/icons/ChevronRight.js.map +1 -1
- package/build/commonjs/internal/icons/Close.js +4 -2
- package/build/commonjs/internal/icons/Close.js.map +1 -1
- package/build/module/AppBar/AppBar.js +5 -1
- package/build/module/AppBar/AppBar.js.map +1 -1
- package/build/module/Badge/Badge.js +4 -3
- package/build/module/Badge/Badge.js.map +1 -1
- package/build/module/Badge/BadgeProps.js.map +1 -1
- package/build/module/ButtonBase/index.js +1 -1
- package/build/module/ButtonBase/index.js.map +1 -1
- package/build/module/Chip/Chip.js +17 -13
- package/build/module/Chip/Chip.js.map +1 -1
- package/build/module/Chip/ChipProps.js +1 -0
- package/build/module/Chip/ChipProps.js.map +1 -1
- package/build/module/Chip/index.js +1 -1
- package/build/module/Chip/index.js.map +1 -1
- package/build/module/Chip/useChipStyle.js +29 -19
- package/build/module/Chip/useChipStyle.js.map +1 -1
- package/build/module/Dialog/Dialog.js +7 -8
- package/build/module/Dialog/Dialog.js.map +1 -1
- package/build/module/Dialog/DialogProps.js +1 -1
- package/build/module/Dialog/DialogProps.js.map +1 -1
- package/build/module/Dialog/useDialogSectionStyle.js +6 -4
- package/build/module/Dialog/useDialogSectionStyle.js.map +1 -1
- package/build/module/Dialog/useDialogStyle.js +9 -8
- package/build/module/Dialog/useDialogStyle.js.map +1 -1
- package/build/module/DialogTitle/DialogLargeTitle.js +65 -0
- package/build/module/DialogTitle/DialogLargeTitle.js.map +1 -0
- package/build/module/DialogTitle/DialogTitle.js +6 -3
- package/build/module/DialogTitle/DialogTitle.js.map +1 -1
- package/build/module/Divider/Divider.js +7 -0
- package/build/module/Divider/Divider.js.map +1 -1
- package/build/module/Divider/DividerProps.js +1 -1
- package/build/module/Divider/DividerProps.js.map +1 -1
- package/build/module/ListItem/ListItem.js +3 -13
- package/build/module/ListItem/ListItem.js.map +1 -1
- package/build/module/Pagination/Pagination.js +2 -0
- package/build/module/Pagination/Pagination.js.map +1 -1
- package/build/module/Pagination/PaginationProps.js +1 -0
- package/build/module/Pagination/PaginationProps.js.map +1 -1
- package/build/module/Pagination/index.js +1 -1
- package/build/module/Pagination/index.js.map +1 -1
- package/build/module/PaginationItem/PaginationItem.js +28 -21
- package/build/module/PaginationItem/PaginationItem.js.map +1 -1
- package/build/module/PaginationItem/PaginationItemProps.js.map +1 -1
- package/build/module/Tab/Tab.js +11 -3
- package/build/module/Tab/Tab.js.map +1 -1
- package/build/module/Tabs/useTabsStyle.js +6 -4
- package/build/module/Tabs/useTabsStyle.js.map +1 -1
- package/build/module/Toolbar/BackButton/BackButton.js +32 -0
- package/build/module/Toolbar/BackButton/BackButton.js.map +1 -0
- package/build/module/Toolbar/BackButton/BackButtonProps.js +2 -0
- package/build/module/Toolbar/BackButton/BackButtonProps.js.map +1 -0
- package/build/module/Toolbar/BackButton/index.js +2 -0
- package/build/module/Toolbar/BackButton/index.js.map +1 -0
- package/build/module/Toolbar/Toolbar.js +7 -3
- package/build/module/Toolbar/Toolbar.js.map +1 -1
- package/build/module/internal/icons/ChevronLeft.js +4 -2
- package/build/module/internal/icons/ChevronLeft.js.map +1 -1
- package/build/module/internal/icons/ChevronRight.js +4 -2
- package/build/module/internal/icons/ChevronRight.js.map +1 -1
- package/build/module/internal/icons/Close.js +4 -2
- package/build/module/internal/icons/Close.js.map +1 -1
- package/build/typescript/Badge/BadgeProps.d.ts +10 -5
- package/build/typescript/ButtonBase/index.d.ts +1 -1
- package/build/typescript/Chip/ChipProps.d.ts +11 -4
- package/build/typescript/Chip/index.d.ts +1 -1
- package/build/typescript/Chip/useChipStyle.d.ts +4 -3
- package/build/typescript/Dialog/DialogProps.d.ts +1 -6
- package/build/typescript/Dialog/useDialogStyle.d.ts +1 -1
- package/build/typescript/DialogTitle/DialogLargeTitle.d.ts +9 -0
- package/build/typescript/DialogTitle/DialogTitle.d.ts +6 -1
- package/build/typescript/Divider/DividerProps.d.ts +1 -1
- package/build/typescript/Pagination/PaginationProps.d.ts +12 -0
- package/build/typescript/Pagination/index.d.ts +2 -2
- package/build/typescript/PaginationItem/PaginationItemProps.d.ts +6 -0
- package/build/typescript/Toolbar/BackButton/BackButton.d.ts +3 -0
- package/build/typescript/Toolbar/BackButton/BackButtonProps.d.ts +4 -0
- package/build/typescript/Toolbar/BackButton/index.d.ts +2 -0
- package/build/typescript/Toolbar/Toolbar.d.ts +6 -1
- package/package.json +3 -3
- package/src/AppBar/AppBar.tsx +4 -0
- package/src/Badge/Badge.tsx +4 -3
- package/src/Badge/BadgeProps.ts +12 -6
- package/src/ButtonBase/index.ts +1 -1
- package/src/Chip/Chip.tsx +20 -13
- package/src/Chip/ChipProps.ts +13 -4
- package/src/Chip/index.ts +1 -1
- package/src/Chip/useChipStyle.ts +34 -17
- package/src/Dialog/Dialog.tsx +7 -8
- package/src/Dialog/DialogProps.ts +1 -7
- package/src/Dialog/useDialogSectionStyle.ts +6 -4
- package/src/Dialog/useDialogStyle.ts +9 -7
- package/src/DialogTitle/DialogLargeTitle.tsx +95 -0
- package/src/DialogTitle/DialogTitle.tsx +6 -1
- package/src/Divider/Divider.tsx +5 -0
- package/src/Divider/DividerProps.ts +1 -1
- package/src/ListItem/ListItem.tsx +3 -13
- package/src/Pagination/Pagination.tsx +3 -2
- package/src/Pagination/PaginationProps.ts +15 -0
- package/src/Pagination/index.ts +2 -2
- package/src/PaginationItem/PaginationItem.tsx +31 -24
- package/src/PaginationItem/PaginationItemProps.ts +7 -0
- package/src/Tab/Tab.tsx +20 -6
- package/src/Tabs/useTabsStyle.ts +7 -4
- package/src/Toolbar/BackButton/BackButton.tsx +42 -0
- package/src/Toolbar/BackButton/BackButtonProps.ts +4 -0
- package/src/Toolbar/BackButton/index.ts +2 -0
- package/src/Toolbar/Toolbar.tsx +6 -1
- package/src/internal/icons/ChevronLeft.tsx +4 -1
- package/src/internal/icons/ChevronRight.tsx +4 -1
- package/src/internal/icons/Close.tsx +4 -1
- package/build/commonjs/ButtonBase/LegacyButtonBase.js +0 -126
- package/build/commonjs/ButtonBase/LegacyButtonBase.js.map +0 -1
- package/build/module/ButtonBase/LegacyButtonBase.js +0 -106
- package/build/module/ButtonBase/LegacyButtonBase.js.map +0 -1
- package/build/typescript/ButtonBase/LegacyButtonBase.d.ts +0 -5
- package/src/ButtonBase/LegacyButtonBase.tsx +0 -135
|
@@ -9,6 +9,8 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
9
9
|
|
|
10
10
|
var _reactNative = require("react-native");
|
|
11
11
|
|
|
12
|
+
var _hooks = require("../hooks");
|
|
13
|
+
|
|
12
14
|
var _styles = require("../styles");
|
|
13
15
|
|
|
14
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -34,6 +36,7 @@ const AppBar = /*#__PURE__*/_react.default.forwardRef(function AppBar(props, ref
|
|
|
34
36
|
...otherProps
|
|
35
37
|
} = props;
|
|
36
38
|
const theme = (0, _styles.useTheme)();
|
|
39
|
+
const isDesktop = (0, _hooks.useBreakpointUp)('md', true, false);
|
|
37
40
|
const styles = useStyles();
|
|
38
41
|
const backgroundColorMap = {
|
|
39
42
|
default: theme.palette.background.default,
|
|
@@ -41,7 +44,9 @@ const AppBar = /*#__PURE__*/_react.default.forwardRef(function AppBar(props, ref
|
|
|
41
44
|
};
|
|
42
45
|
const paperStyle = (0, _styles.css)([styles.root, {
|
|
43
46
|
backgroundColor: backgroundColorMap[color]
|
|
44
|
-
},
|
|
47
|
+
}, isDesktop ? {
|
|
48
|
+
paddingHorizontal: 8
|
|
49
|
+
} : undefined, style]);
|
|
45
50
|
return /*#__PURE__*/_react.default.createElement(_reactNative.View, _extends({
|
|
46
51
|
ref: ref,
|
|
47
52
|
style: paperStyle
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useStyles","theme","useTheme","root","flexDirection","flexShrink","width","zIndex","appBar","AppBar","React","forwardRef","props","ref","color","style","otherProps","styles","backgroundColorMap","default","palette","background","alt","paperStyle","css","backgroundColor"],"sources":["AppBar.tsx"],"sourcesContent":["import React from 'react';\nimport { View } from 'react-native';\nimport { NamedStylesStringUnion, UseStyles } from '@fountain-ui/styles';\nimport { css, useTheme } from '../styles';\nimport type AppBarProps from './AppBarProps';\nimport type { AppBarColor } from './AppBarProps';\n\ntype AppBarStyleKeys = 'root';\n\ntype AppBarStyles = NamedStylesStringUnion<AppBarStyleKeys>;\n\nconst useStyles: UseStyles<AppBarStyles> = function (): AppBarStyles {\n const theme = useTheme();\n\n return {\n root: {\n flexDirection: 'column',\n flexShrink: 0,\n width: '100%',\n zIndex: theme.zIndex.appBar,\n },\n };\n};\n\nconst AppBar = React.forwardRef<View, AppBarProps>(function AppBar(props, ref) {\n const {\n color = 'default',\n style,\n ...otherProps\n } = props;\n\n const theme = useTheme();\n\n const styles = useStyles();\n\n const backgroundColorMap: Record<AppBarColor, string> = {\n default: theme.palette.background.default,\n alt: theme.palette.background.alt,\n };\n\n const paperStyle = css([\n styles.root,\n { backgroundColor: backgroundColorMap[color] },\n style,\n ]);\n\n return (\n <View\n ref={ref}\n style={paperStyle}\n {...otherProps}\n />\n );\n});\n\nexport default AppBar;\n"],"mappings":";;;;;;;AAAA;;AACA;;AAEA;;;;;;AAQA,MAAMA,SAAkC,GAAG,YAA0B;EACjE,MAAMC,KAAK,GAAG,IAAAC,gBAAA,GAAd;EAEA,OAAO;IACHC,IAAI,EAAE;MACFC,aAAa,EAAE,QADb;MAEFC,UAAU,EAAE,CAFV;MAGFC,KAAK,EAAE,MAHL;MAIFC,MAAM,EAAEN,KAAK,CAACM,MAAN,CAAaC;IAJnB;EADH,CAAP;AAQH,CAXD;;AAaA,MAAMC,MAAM,gBAAGC,cAAA,CAAMC,UAAN,CAAoC,SAASF,MAAT,CAAgBG,KAAhB,EAAuBC,GAAvB,EAA4B;EAC3E,MAAM;IACFC,KAAK,GAAG,SADN;IAEFC,KAFE;IAGF,GAAGC;EAHD,IAIFJ,KAJJ;EAMA,MAAMX,KAAK,GAAG,IAAAC,gBAAA,GAAd;EAEA,MAAMe,MAAM,
|
|
1
|
+
{"version":3,"names":["useStyles","theme","useTheme","root","flexDirection","flexShrink","width","zIndex","appBar","AppBar","React","forwardRef","props","ref","color","style","otherProps","isDesktop","useBreakpointUp","styles","backgroundColorMap","default","palette","background","alt","paperStyle","css","backgroundColor","paddingHorizontal","undefined"],"sources":["AppBar.tsx"],"sourcesContent":["import React from 'react';\nimport { View } from 'react-native';\nimport { NamedStylesStringUnion, UseStyles } from '@fountain-ui/styles';\nimport { useBreakpointUp } from '../hooks';\nimport { css, useTheme } from '../styles';\nimport type AppBarProps from './AppBarProps';\nimport type { AppBarColor } from './AppBarProps';\n\ntype AppBarStyleKeys = 'root';\n\ntype AppBarStyles = NamedStylesStringUnion<AppBarStyleKeys>;\n\nconst useStyles: UseStyles<AppBarStyles> = function (): AppBarStyles {\n const theme = useTheme();\n\n return {\n root: {\n flexDirection: 'column',\n flexShrink: 0,\n width: '100%',\n zIndex: theme.zIndex.appBar,\n },\n };\n};\n\nconst AppBar = React.forwardRef<View, AppBarProps>(function AppBar(props, ref) {\n const {\n color = 'default',\n style,\n ...otherProps\n } = props;\n\n const theme = useTheme();\n\n const isDesktop = useBreakpointUp('md', true, false);\n\n const styles = useStyles();\n\n const backgroundColorMap: Record<AppBarColor, string> = {\n default: theme.palette.background.default,\n alt: theme.palette.background.alt,\n };\n\n const paperStyle = css([\n styles.root,\n { backgroundColor: backgroundColorMap[color] },\n isDesktop ? { paddingHorizontal: 8 } : undefined,\n style,\n ]);\n\n return (\n <View\n ref={ref}\n style={paperStyle}\n {...otherProps}\n />\n );\n});\n\nexport default AppBar;\n"],"mappings":";;;;;;;AAAA;;AACA;;AAEA;;AACA;;;;;;AAQA,MAAMA,SAAkC,GAAG,YAA0B;EACjE,MAAMC,KAAK,GAAG,IAAAC,gBAAA,GAAd;EAEA,OAAO;IACHC,IAAI,EAAE;MACFC,aAAa,EAAE,QADb;MAEFC,UAAU,EAAE,CAFV;MAGFC,KAAK,EAAE,MAHL;MAIFC,MAAM,EAAEN,KAAK,CAACM,MAAN,CAAaC;IAJnB;EADH,CAAP;AAQH,CAXD;;AAaA,MAAMC,MAAM,gBAAGC,cAAA,CAAMC,UAAN,CAAoC,SAASF,MAAT,CAAgBG,KAAhB,EAAuBC,GAAvB,EAA4B;EAC3E,MAAM;IACFC,KAAK,GAAG,SADN;IAEFC,KAFE;IAGF,GAAGC;EAHD,IAIFJ,KAJJ;EAMA,MAAMX,KAAK,GAAG,IAAAC,gBAAA,GAAd;EAEA,MAAMe,SAAS,GAAG,IAAAC,sBAAA,EAAgB,IAAhB,EAAsB,IAAtB,EAA4B,KAA5B,CAAlB;EAEA,MAAMC,MAAM,GAAGnB,SAAS,EAAxB;EAEA,MAAMoB,kBAA+C,GAAG;IACpDC,OAAO,EAAEpB,KAAK,CAACqB,OAAN,CAAcC,UAAd,CAAyBF,OADkB;IAEpDG,GAAG,EAAEvB,KAAK,CAACqB,OAAN,CAAcC,UAAd,CAAyBC;EAFsB,CAAxD;EAKA,MAAMC,UAAU,GAAG,IAAAC,WAAA,EAAI,CACnBP,MAAM,CAAChB,IADY,EAEnB;IAAEwB,eAAe,EAAEP,kBAAkB,CAACN,KAAD;EAArC,CAFmB,EAGnBG,SAAS,GAAG;IAAEW,iBAAiB,EAAE;EAArB,CAAH,GAA8BC,SAHpB,EAInBd,KAJmB,CAAJ,CAAnB;EAOA,oBACI,6BAAC,iBAAD;IACI,GAAG,EAAEF,GADT;IAEI,KAAK,EAAEY;EAFX,GAGQT,UAHR,EADJ;AAOH,CAhCc,CAAf;;eAkCeP,M"}
|
|
@@ -27,12 +27,13 @@ function Badge(props) {
|
|
|
27
27
|
children,
|
|
28
28
|
color = 'accent',
|
|
29
29
|
content,
|
|
30
|
+
horizontalOffset = 0,
|
|
30
31
|
invisible = false,
|
|
31
32
|
position = defaultPosition,
|
|
32
33
|
size = 'medium',
|
|
33
34
|
style: styleProp,
|
|
34
|
-
offset = 0,
|
|
35
35
|
variant = 'dot',
|
|
36
|
+
verticalOffset = 0,
|
|
36
37
|
...otherProps
|
|
37
38
|
} = props;
|
|
38
39
|
const {
|
|
@@ -41,8 +42,8 @@ function Badge(props) {
|
|
|
41
42
|
} = (0, _useVariantStyleMap.default)(variant, size, color);
|
|
42
43
|
const rootStyle = (0, _styles.css)([styleProp]);
|
|
43
44
|
const badgeStyle = (0, _styles.css)([baseBadgeStyle, {
|
|
44
|
-
[position.vertical]:
|
|
45
|
-
[position.horizontal]:
|
|
45
|
+
[position.vertical]: verticalOffset,
|
|
46
|
+
[position.horizontal]: horizontalOffset
|
|
46
47
|
}]);
|
|
47
48
|
return /*#__PURE__*/_react.default.createElement(_reactNative.View, _extends({
|
|
48
49
|
style: rootStyle
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["defaultPosition","vertical","horizontal","Badge","props","children","color","content","invisible","position","size","style","styleProp","
|
|
1
|
+
{"version":3,"names":["defaultPosition","vertical","horizontal","Badge","props","children","color","content","horizontalOffset","invisible","position","size","style","styleProp","variant","verticalOffset","otherProps","badge","baseBadgeStyle","contentFont","contentFontStyle","useVariantStyleMap","rootStyle","css","badgeStyle","undefined"],"sources":["Badge.tsx"],"sourcesContent":["import React from 'react';\nimport { Text, View } from 'react-native';\nimport { css } from '../styles';\nimport type BadgeProps from './BadgeProps';\nimport type { BadgeColor, BadgePosition, BadgeSize, BadgeVariant } from './BadgeProps';\nimport useVariantStyleMap from './useVariantStyleMap';\n\nconst defaultPosition: BadgePosition = {\n vertical: 'top',\n horizontal: 'right',\n};\n\nexport default function Badge(props: BadgeProps) {\n const {\n children,\n color = 'accent' as BadgeColor,\n content,\n horizontalOffset = 0,\n invisible = false,\n position = defaultPosition,\n size = 'medium' as BadgeSize,\n style: styleProp,\n variant = 'dot' as BadgeVariant,\n verticalOffset = 0,\n ...otherProps\n } = props;\n\n const {\n badge: baseBadgeStyle,\n contentFont: contentFontStyle,\n } = useVariantStyleMap(variant, size, color);\n\n const rootStyle = css([\n styleProp,\n ]);\n\n const badgeStyle = css([\n baseBadgeStyle,\n {\n [position.vertical]: verticalOffset,\n [position.horizontal]: horizontalOffset,\n },\n ]);\n\n return (\n <View\n style={rootStyle}\n {...otherProps}\n >\n {children}\n\n {!invisible ? (\n <View style={badgeStyle}>\n {content !== undefined && content !== null ? (\n <Text style={contentFontStyle}>{content}</Text>\n ) : null}\n </View>\n ) : null}\n </View>\n );\n};\n"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AAGA;;;;;;AAEA,MAAMA,eAA8B,GAAG;EACnCC,QAAQ,EAAE,KADyB;EAEnCC,UAAU,EAAE;AAFuB,CAAvC;;AAKe,SAASC,KAAT,CAAeC,KAAf,EAAkC;EAC7C,MAAM;IACFC,QADE;IAEFC,KAAK,GAAG,QAFN;IAGFC,OAHE;IAIFC,gBAAgB,GAAG,CAJjB;IAKFC,SAAS,GAAG,KALV;IAMFC,QAAQ,GAAGV,eANT;IAOFW,IAAI,GAAG,QAPL;IAQFC,KAAK,EAAEC,SARL;IASFC,OAAO,GAAG,KATR;IAUFC,cAAc,GAAG,CAVf;IAWF,GAAGC;EAXD,IAYFZ,KAZJ;EAcA,MAAM;IACFa,KAAK,EAAEC,cADL;IAEFC,WAAW,EAAEC;EAFX,IAGF,IAAAC,2BAAA,EAAmBP,OAAnB,EAA4BH,IAA5B,EAAkCL,KAAlC,CAHJ;EAKA,MAAMgB,SAAS,GAAG,IAAAC,WAAA,EAAI,CAClBV,SADkB,CAAJ,CAAlB;EAIA,MAAMW,UAAU,GAAG,IAAAD,WAAA,EAAI,CACnBL,cADmB,EAEnB;IACI,CAACR,QAAQ,CAACT,QAAV,GAAqBc,cADzB;IAEI,CAACL,QAAQ,CAACR,UAAV,GAAuBM;EAF3B,CAFmB,CAAJ,CAAnB;EAQA,oBACI,6BAAC,iBAAD;IACI,KAAK,EAAEc;EADX,GAEQN,UAFR,GAIKX,QAJL,EAMK,CAACI,SAAD,gBACG,6BAAC,iBAAD;IAAM,KAAK,EAAEe;EAAb,GACKjB,OAAO,KAAKkB,SAAZ,IAAyBlB,OAAO,KAAK,IAArC,gBACG,6BAAC,iBAAD;IAAM,KAAK,EAAEa;EAAb,GAAgCb,OAAhC,CADH,GAEG,IAHR,CADH,GAMG,IAZR,CADJ;AAgBH;;AAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["badgeHorizontalPositions","badgeVerticalPositions","badgeColors","badgeSizes","badgeVariants"],"sources":["BadgeProps.ts"],"sourcesContent":["import React from 'react';\nimport type { ViewProps } from 'react-native';\nimport type { OverridableComponentProps } from '../types';\n\nexport const badgeHorizontalPositions = ['right', 'left'] as const;\nexport type BadgeHorizontalPosition = typeof badgeHorizontalPositions[number];\n\nexport const badgeVerticalPositions = ['top', 'bottom'] as const;\nexport type BadgeVerticalPosition = typeof badgeVerticalPositions[number];\n\nexport interface BadgePosition {\n vertical: BadgeVerticalPosition;\n horizontal: BadgeHorizontalPosition;\n}\n\nexport const badgeColors = ['accent', 'danger'] as const;\nexport type BadgeColor = typeof badgeColors[number];\n\nexport const badgeSizes = ['large', 'medium'] as const;\nexport type BadgeSize = typeof badgeSizes[number];\n\nexport const badgeVariants = ['dot', 'number'] as const;\nexport type BadgeVariant = typeof badgeVariants[number];\n\nexport default interface BadgeProps extends OverridableComponentProps<ViewProps, {\n /**\n * The badge will be added relative to this node.\n */\n children?: React.ReactNode;\n\n /**\n *\n * @default 'accent'\n */\n color?: BadgeColor;\n\n /**\n * (only number variant)\n */\n content?: number;\n\n /**\n * If `true`, the badge is invisible.\n * @default false\n */\n invisible?: boolean;\n\n /**\n * The position of the badge.\n * @default {\n * vertical: 'top',\n * horizontal: 'right',\n * }\n */\n position?: BadgePosition;\n\n /**\n
|
|
1
|
+
{"version":3,"names":["badgeHorizontalPositions","badgeVerticalPositions","badgeColors","badgeSizes","badgeVariants"],"sources":["BadgeProps.ts"],"sourcesContent":["import React from 'react';\nimport type { ViewProps } from 'react-native';\nimport type { OverridableComponentProps } from '../types';\n\nexport const badgeHorizontalPositions = ['right', 'left'] as const;\nexport type BadgeHorizontalPosition = typeof badgeHorizontalPositions[number];\n\nexport const badgeVerticalPositions = ['top', 'bottom'] as const;\nexport type BadgeVerticalPosition = typeof badgeVerticalPositions[number];\n\nexport interface BadgePosition {\n vertical: BadgeVerticalPosition;\n horizontal: BadgeHorizontalPosition;\n}\n\nexport const badgeColors = ['accent', 'danger'] as const;\nexport type BadgeColor = typeof badgeColors[number];\n\nexport const badgeSizes = ['large', 'medium'] as const;\nexport type BadgeSize = typeof badgeSizes[number];\n\nexport const badgeVariants = ['dot', 'number'] as const;\nexport type BadgeVariant = typeof badgeVariants[number];\n\nexport default interface BadgeProps extends OverridableComponentProps<ViewProps, {\n /**\n * The badge will be added relative to this node.\n */\n children?: React.ReactNode;\n\n /**\n *\n * @default 'accent'\n */\n color?: BadgeColor;\n\n /**\n * (only number variant)\n */\n content?: number;\n\n /**\n * The horizontal offset of the badge.\n * @default 0\n */\n horizontalOffset?: number;\n\n /**\n * If `true`, the badge is invisible.\n * @default false\n */\n invisible?: boolean;\n\n /**\n * The position of the badge.\n * @default {\n * vertical: 'top',\n * horizontal: 'right',\n * }\n */\n position?: BadgePosition;\n\n /**\n *\n */\n size?: BadgeSize;\n\n /**\n *\n * @default 'dot'\n */\n variant?: BadgeVariant;\n\n /**\n * The vertical offset of the badge.\n * @default 0\n */\n verticalOffset?: number;\n}> {}\n"],"mappings":";;;;;;AAIO,MAAMA,wBAAwB,GAAG,CAAC,OAAD,EAAU,MAAV,CAAjC;;AAGA,MAAMC,sBAAsB,GAAG,CAAC,KAAD,EAAQ,QAAR,CAA/B;;AAQA,MAAMC,WAAW,GAAG,CAAC,QAAD,EAAW,QAAX,CAApB;;AAGA,MAAMC,UAAU,GAAG,CAAC,OAAD,EAAU,QAAV,CAAnB;;AAGA,MAAMC,aAAa,GAAG,CAAC,KAAD,EAAQ,QAAR,CAAtB"}
|
|
@@ -6,11 +6,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
Object.defineProperty(exports, "default", {
|
|
7
7
|
enumerable: true,
|
|
8
8
|
get: function () {
|
|
9
|
-
return
|
|
9
|
+
return _ButtonBase.default;
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
12
|
|
|
13
|
-
var
|
|
13
|
+
var _ButtonBase = _interopRequireDefault(require("./ButtonBase"));
|
|
14
14
|
|
|
15
15
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
16
16
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export { default } from './
|
|
1
|
+
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export { default } from './ButtonBase';\nexport type { default as ButtonBaseProps } from './ButtonBaseProps';\n"],"mappings":";;;;;;;;;;;;AAAA"}
|
|
@@ -9,12 +9,14 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
9
9
|
|
|
10
10
|
var _reactNative = require("react-native");
|
|
11
11
|
|
|
12
|
+
var _ButtonBase = _interopRequireDefault(require("../ButtonBase"));
|
|
13
|
+
|
|
14
|
+
var _internal = require("../internal");
|
|
15
|
+
|
|
12
16
|
var _styles = require("../styles");
|
|
13
17
|
|
|
14
18
|
var _utils = require("../utils");
|
|
15
19
|
|
|
16
|
-
var _ButtonBase = _interopRequireDefault(require("../ButtonBase/ButtonBase"));
|
|
17
|
-
|
|
18
20
|
var _useChipStyle = _interopRequireDefault(require("./useChipStyle"));
|
|
19
21
|
|
|
20
22
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -24,9 +26,10 @@ function _extends() { _extends = Object.assign ? Object.assign.bind() : function
|
|
|
24
26
|
function Chip(props) {
|
|
25
27
|
const {
|
|
26
28
|
children,
|
|
27
|
-
|
|
29
|
+
color = 'default',
|
|
28
30
|
numberOfLines,
|
|
29
31
|
onPress,
|
|
32
|
+
selected = false,
|
|
30
33
|
size = 'small',
|
|
31
34
|
startElement: startElementProp,
|
|
32
35
|
startElementVariant = 'default',
|
|
@@ -35,26 +38,30 @@ function Chip(props) {
|
|
|
35
38
|
} = props;
|
|
36
39
|
const {
|
|
37
40
|
container: containerStyle,
|
|
38
|
-
|
|
41
|
+
closeButton: closeButtonStyle,
|
|
39
42
|
label: labelStyle,
|
|
40
|
-
startElement: startElementStyle
|
|
41
|
-
|
|
43
|
+
startElement: startElementStyle,
|
|
44
|
+
startElementContainer: startElementContainerStyle
|
|
45
|
+
} = (0, _useChipStyle.default)(size, startElementVariant, color, selected);
|
|
42
46
|
const chipStyle = (0, _styles.css)([containerStyle, styleProp]);
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
47
|
+
|
|
48
|
+
const startElement = /*#__PURE__*/_react.default.createElement(_reactNative.View, {
|
|
49
|
+
style: startElementContainerStyle
|
|
50
|
+
}, (0, _utils.cloneElementSafely)(startElementProp, {
|
|
46
51
|
style: startElementStyle
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
style: endElementStyle
|
|
50
|
-
});
|
|
52
|
+
}));
|
|
53
|
+
|
|
51
54
|
return /*#__PURE__*/_react.default.createElement(_ButtonBase.default, _extends({
|
|
55
|
+
disabled: !onPress,
|
|
52
56
|
onPress: onPress,
|
|
53
57
|
style: chipStyle
|
|
54
58
|
}, otherProps), startElement, /*#__PURE__*/_react.default.createElement(_reactNative.Text, {
|
|
55
59
|
children: children,
|
|
56
60
|
numberOfLines: numberOfLines,
|
|
57
61
|
style: labelStyle
|
|
58
|
-
}),
|
|
62
|
+
}), selected ? /*#__PURE__*/_react.default.createElement(_internal.Close, {
|
|
63
|
+
color: 'baseInverse',
|
|
64
|
+
style: closeButtonStyle
|
|
65
|
+
}) : null);
|
|
59
66
|
}
|
|
60
67
|
//# sourceMappingURL=Chip.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Chip","props","children","
|
|
1
|
+
{"version":3,"names":["Chip","props","children","color","numberOfLines","onPress","selected","size","startElement","startElementProp","startElementVariant","style","styleProp","otherProps","container","containerStyle","closeButton","closeButtonStyle","label","labelStyle","startElementStyle","startElementContainer","startElementContainerStyle","useChipStyle","chipStyle","css","cloneElementSafely"],"sources":["Chip.tsx"],"sourcesContent":["import React from 'react';\nimport { Text, View } from 'react-native';\nimport ButtonBase from '../ButtonBase';\nimport { Close } from '../internal';\nimport { css } from '../styles';\nimport { cloneElementSafely } from '../utils';\nimport type ChipProps from './ChipProps';\nimport type { ChipColor, ChipSize } from './ChipProps';\nimport useChipStyle from './useChipStyle';\n\nexport default function Chip(props: ChipProps) {\n const {\n children,\n color = 'default' as ChipColor,\n numberOfLines,\n onPress,\n selected = false,\n size = 'small' as ChipSize,\n startElement: startElementProp,\n startElementVariant = 'default',\n style: styleProp,\n ...otherProps\n } = props;\n\n const {\n container: containerStyle,\n closeButton: closeButtonStyle,\n label: labelStyle,\n startElement: startElementStyle,\n startElementContainer: startElementContainerStyle,\n } = useChipStyle(size, startElementVariant, color, selected);\n\n const chipStyle = css([\n containerStyle,\n styleProp,\n ]);\n\n const startElement = (\n <View style={startElementContainerStyle}>\n {cloneElementSafely(startElementProp, { style: startElementStyle })}\n </View>\n );\n\n return (\n <ButtonBase\n disabled={!onPress}\n onPress={onPress}\n style={chipStyle}\n {...otherProps}\n >\n {startElement}\n\n <Text\n children={children}\n numberOfLines={numberOfLines}\n style={labelStyle}\n />\n\n {selected ? (\n <Close\n color={'baseInverse'}\n style={closeButtonStyle}\n />\n ) : null}\n </ButtonBase>\n );\n}\n"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAGA;;;;;;AAEe,SAASA,IAAT,CAAcC,KAAd,EAAgC;EAC3C,MAAM;IACFC,QADE;IAEFC,KAAK,GAAG,SAFN;IAGFC,aAHE;IAIFC,OAJE;IAKFC,QAAQ,GAAG,KALT;IAMFC,IAAI,GAAG,OANL;IAOFC,YAAY,EAAEC,gBAPZ;IAQFC,mBAAmB,GAAG,SARpB;IASFC,KAAK,EAAEC,SATL;IAUF,GAAGC;EAVD,IAWFZ,KAXJ;EAaA,MAAM;IACFa,SAAS,EAAEC,cADT;IAEFC,WAAW,EAAEC,gBAFX;IAGFC,KAAK,EAAEC,UAHL;IAIFX,YAAY,EAAEY,iBAJZ;IAKFC,qBAAqB,EAAEC;EALrB,IAMF,IAAAC,qBAAA,EAAahB,IAAb,EAAmBG,mBAAnB,EAAwCP,KAAxC,EAA+CG,QAA/C,CANJ;EAQA,MAAMkB,SAAS,GAAG,IAAAC,WAAA,EAAI,CAClBV,cADkB,EAElBH,SAFkB,CAAJ,CAAlB;;EAKA,MAAMJ,YAAY,gBACd,6BAAC,iBAAD;IAAM,KAAK,EAAEc;EAAb,GACK,IAAAI,yBAAA,EAAmBjB,gBAAnB,EAAqC;IAAEE,KAAK,EAAES;EAAT,CAArC,CADL,CADJ;;EAMA,oBACI,6BAAC,mBAAD;IACI,QAAQ,EAAE,CAACf,OADf;IAEI,OAAO,EAAEA,OAFb;IAGI,KAAK,EAAEmB;EAHX,GAIQX,UAJR,GAMKL,YANL,eAQI,6BAAC,iBAAD;IACI,QAAQ,EAAEN,QADd;IAEI,aAAa,EAAEE,aAFnB;IAGI,KAAK,EAAEe;EAHX,EARJ,EAcKb,QAAQ,gBACL,6BAAC,eAAD;IACI,KAAK,EAAE,aADX;IAEI,KAAK,EAAEW;EAFX,EADK,GAKL,IAnBR,CADJ;AAuBH"}
|
|
@@ -3,7 +3,9 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.chipStartElementVariants = exports.chipSizes = void 0;
|
|
6
|
+
exports.chipStartElementVariants = exports.chipSizes = exports.chipColors = void 0;
|
|
7
|
+
const chipColors = ['default', 'white'];
|
|
8
|
+
exports.chipColors = chipColors;
|
|
7
9
|
const chipSizes = ['large', 'small'];
|
|
8
10
|
exports.chipSizes = chipSizes;
|
|
9
11
|
const chipStartElementVariants = ['default', 'avatar', 'image', 'icon'];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["chipSizes","chipStartElementVariants"],"sources":["ChipProps.ts"],"sourcesContent":["import React from 'react';\nimport { OverridableComponentProps } from '../types';\nimport type { ButtonBaseProps } from '../ButtonBase';\n\nexport const chipSizes = ['large', 'small'] as const;\nexport type ChipSize = typeof chipSizes[number];\n\nexport const chipStartElementVariants = ['default', 'avatar', 'image', 'icon'] as const;\nexport type ChipStartElementVariant = typeof chipStartElementVariants[number];\n\nexport default interface ChipProps extends OverridableComponentProps<ButtonBaseProps, {\n /**\n *
|
|
1
|
+
{"version":3,"names":["chipColors","chipSizes","chipStartElementVariants"],"sources":["ChipProps.ts"],"sourcesContent":["import React from 'react';\nimport { OverridableComponentProps } from '../types';\nimport type { ButtonBaseProps } from '../ButtonBase';\n\nexport const chipColors = ['default', 'white'] as const;\nexport type ChipColor = typeof chipColors[number];\n\nexport const chipSizes = ['large', 'small'] as const;\nexport type ChipSize = typeof chipSizes[number];\n\nexport const chipStartElementVariants = ['default', 'avatar', 'image', 'icon'] as const;\nexport type ChipStartElementVariant = typeof chipStartElementVariants[number];\n\nexport default interface ChipProps extends OverridableComponentProps<ButtonBaseProps, {\n /**\n * The content of the component.\n */\n children: string;\n\n /**\n * Set backgroundColor of the component.\n * @default 'default'\n */\n color?: ChipColor;\n\n /**\n * Number of lines of children.\n */\n numberOfLines?: number;\n\n /**\n * If `true`, showing a close icon and applying a highlighted style.\n */\n selected?: boolean;\n\n /**\n * Determines size of component.\n * @default 'small'\n */\n size?: ChipSize;\n\n /**\n * Element placed before the children.\n */\n startElement?: React.ReactElement;\n\n /**\n * Determines the style of the start element.\n */\n startElementVariant?: ChipStartElementVariant;\n}> {}\n"],"mappings":";;;;;;AAIO,MAAMA,UAAU,GAAG,CAAC,SAAD,EAAY,OAAZ,CAAnB;;AAGA,MAAMC,SAAS,GAAG,CAAC,OAAD,EAAU,OAAV,CAAlB;;AAGA,MAAMC,wBAAwB,GAAG,CAAC,SAAD,EAAY,QAAZ,EAAsB,OAAtB,EAA+B,MAA/B,CAAjC"}
|
|
@@ -3,6 +3,12 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
Object.defineProperty(exports, "chipColors", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _ChipProps.chipColors;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
6
12
|
Object.defineProperty(exports, "chipSizes", {
|
|
7
13
|
enumerable: true,
|
|
8
14
|
get: function () {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export { default } from './Chip';\nexport type { default as ChipProps } from './ChipProps';\nexport { chipSizes, chipStartElementVariants } from './ChipProps';\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export { default } from './Chip';\nexport type { default as ChipProps } from './ChipProps';\nexport { chipColors, chipSizes, chipStartElementVariants } from './ChipProps';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AAEA"}
|
|
@@ -10,36 +10,36 @@ var _react = require("react");
|
|
|
10
10
|
var _styles = require("../styles");
|
|
11
11
|
|
|
12
12
|
// TODO: need to refactoring...
|
|
13
|
-
function useChipStyle(size, startElementVariant,
|
|
13
|
+
function useChipStyle(size, startElementVariant, color, selected) {
|
|
14
14
|
const theme = (0, _styles.useTheme)();
|
|
15
15
|
return (0, _react.useMemo)(() => {
|
|
16
|
-
var _variantStyleMap$star, _variantStyleMap$star2;
|
|
16
|
+
var _variantStyleMap$star, _variantStyleMap$star2, _variantStyleMap$star3;
|
|
17
17
|
|
|
18
18
|
const fontStyleMap = {
|
|
19
19
|
small: (0, _styles.createFontStyle)(theme, {
|
|
20
20
|
selector: typography => typography.caption1.medium,
|
|
21
|
-
color: theme.palette.text.strong
|
|
21
|
+
color: selected ? theme.palette.text.strongInverse : theme.palette.text.strong
|
|
22
22
|
}),
|
|
23
23
|
large: (0, _styles.createFontStyle)(theme, {
|
|
24
24
|
selector: typography => typography.body2.medium,
|
|
25
|
-
color: theme.palette.text.strong
|
|
25
|
+
color: selected ? theme.palette.text.strongInverse : theme.palette.text.strong
|
|
26
26
|
})
|
|
27
27
|
};
|
|
28
|
-
const
|
|
28
|
+
const closeButtonStyleMap = {
|
|
29
29
|
small: {
|
|
30
30
|
height: 14,
|
|
31
31
|
marginLeft: theme.spacing(2),
|
|
32
32
|
width: 8.17
|
|
33
33
|
},
|
|
34
34
|
large: {
|
|
35
|
-
height:
|
|
35
|
+
height: 17,
|
|
36
36
|
marginLeft: theme.spacing(2.5),
|
|
37
37
|
width: 9
|
|
38
38
|
}
|
|
39
39
|
};
|
|
40
40
|
const baseContainerStyle = {
|
|
41
41
|
alignItems: 'center',
|
|
42
|
-
backgroundColor: theme.palette.fill.weaker,
|
|
42
|
+
backgroundColor: selected ? theme.palette.fill.base : color === 'white' ? theme.palette.surface.base : theme.palette.fill.weaker,
|
|
43
43
|
borderRadius: theme.shape.radius.full,
|
|
44
44
|
flexDirection: 'row',
|
|
45
45
|
overflow: 'hidden'
|
|
@@ -54,9 +54,11 @@ function useChipStyle(size, startElementVariant, isEndElement) {
|
|
|
54
54
|
},
|
|
55
55
|
startElement: {
|
|
56
56
|
borderRadius: theme.shape.radius.full,
|
|
57
|
-
height: isLarge ?
|
|
58
|
-
|
|
59
|
-
|
|
57
|
+
height: isLarge ? 26 : 23,
|
|
58
|
+
width: isLarge ? 26 : 23
|
|
59
|
+
},
|
|
60
|
+
startElementContainer: {
|
|
61
|
+
marginRight: theme.spacing(isLarge ? 1.5 : 1.25)
|
|
60
62
|
}
|
|
61
63
|
},
|
|
62
64
|
icon: {
|
|
@@ -66,11 +68,16 @@ function useChipStyle(size, startElementVariant, isEndElement) {
|
|
|
66
68
|
paddingVertical: theme.spacing(isLarge ? 1.5 : 1.25)
|
|
67
69
|
},
|
|
68
70
|
startElement: {
|
|
71
|
+
color: selected ? theme.palette.icon.strongInverse : theme.palette.icon.strong,
|
|
72
|
+
height: isLarge ? 17 : 16,
|
|
73
|
+
width: isLarge ? 17 : 16
|
|
74
|
+
},
|
|
75
|
+
startElementContainer: {
|
|
69
76
|
alignItems: 'center',
|
|
70
|
-
height: isLarge ?
|
|
77
|
+
height: isLarge ? 24 : 21,
|
|
71
78
|
justifyContent: 'center',
|
|
72
79
|
marginRight: theme.spacing(isLarge ? 1 : 0.75),
|
|
73
|
-
width: isLarge ?
|
|
80
|
+
width: isLarge ? 24 : 21
|
|
74
81
|
}
|
|
75
82
|
},
|
|
76
83
|
image: {
|
|
@@ -80,9 +87,11 @@ function useChipStyle(size, startElementVariant, isEndElement) {
|
|
|
80
87
|
},
|
|
81
88
|
startElement: {
|
|
82
89
|
borderRadius: theme.shape.radius.full,
|
|
83
|
-
height: isLarge ?
|
|
84
|
-
|
|
85
|
-
|
|
90
|
+
height: isLarge ? 36 : 31,
|
|
91
|
+
width: isLarge ? 48 : 40
|
|
92
|
+
},
|
|
93
|
+
startElementContainer: {
|
|
94
|
+
marginRight: theme.spacing(1.5)
|
|
86
95
|
}
|
|
87
96
|
},
|
|
88
97
|
default: {
|
|
@@ -96,14 +105,15 @@ function useChipStyle(size, startElementVariant, isEndElement) {
|
|
|
96
105
|
return {
|
|
97
106
|
container: { ...baseContainerStyle,
|
|
98
107
|
...((_variantStyleMap$star = variantStyleMap[startElementVariant]) === null || _variantStyleMap$star === void 0 ? void 0 : _variantStyleMap$star.container),
|
|
99
|
-
...(
|
|
108
|
+
...(selected ? {
|
|
100
109
|
paddingRight: theme.spacing(isLarge ? 2.5 : 2.25)
|
|
101
110
|
} : {})
|
|
102
111
|
},
|
|
103
|
-
|
|
112
|
+
closeButton: closeButtonStyleMap[size],
|
|
104
113
|
label: fontStyleMap[size],
|
|
105
|
-
startElement: (_variantStyleMap$star2 = variantStyleMap[startElementVariant]) === null || _variantStyleMap$star2 === void 0 ? void 0 : _variantStyleMap$star2.startElement
|
|
114
|
+
startElement: (_variantStyleMap$star2 = variantStyleMap[startElementVariant]) === null || _variantStyleMap$star2 === void 0 ? void 0 : _variantStyleMap$star2.startElement,
|
|
115
|
+
startElementContainer: (_variantStyleMap$star3 = variantStyleMap[startElementVariant]) === null || _variantStyleMap$star3 === void 0 ? void 0 : _variantStyleMap$star3.startElementContainer
|
|
106
116
|
};
|
|
107
|
-
}, [theme, size, startElementVariant]);
|
|
117
|
+
}, [theme, size, startElementVariant, color, selected]);
|
|
108
118
|
}
|
|
109
119
|
//# sourceMappingURL=useChipStyle.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useChipStyle","size","startElementVariant","
|
|
1
|
+
{"version":3,"names":["useChipStyle","size","startElementVariant","color","selected","theme","useTheme","useMemo","fontStyleMap","small","createFontStyle","selector","typography","caption1","medium","palette","text","strongInverse","strong","large","body2","closeButtonStyleMap","height","marginLeft","spacing","width","baseContainerStyle","alignItems","backgroundColor","fill","base","surface","weaker","borderRadius","shape","radius","full","flexDirection","overflow","isLarge","variantStyleMap","avatar","container","paddingLeft","paddingRight","paddingVertical","startElement","startElementContainer","marginRight","icon","justifyContent","image","default","paddingBottom","paddingHorizontal","paddingTop","closeButton","label"],"sources":["useChipStyle.ts"],"sourcesContent":["import { useMemo } from 'react';\nimport type { TextStyle } from 'react-native';\nimport type { FountainUiStyle } from '@fountain-ui/styles';\nimport { createFontStyle, useTheme } from '../styles';\nimport type { ChipColor, ChipSize, ChipStartElementVariant } from './ChipProps';\n\ninterface ChipStyle {\n container: FountainUiStyle;\n closeButton?: FountainUiStyle;\n label: TextStyle;\n startElement?: FountainUiStyle;\n startElementContainer?: FountainUiStyle;\n}\n\ntype VariantStyleMap = Record<ChipStartElementVariant, Partial<ChipStyle>>;\n\n// TODO: need to refactoring...\nexport default function useChipStyle(\n size: ChipSize,\n startElementVariant: ChipStartElementVariant,\n color: ChipColor,\n selected: boolean,\n): ChipStyle {\n const theme = useTheme();\n\n return useMemo<ChipStyle>(() => {\n const fontStyleMap: Record<ChipSize, TextStyle> = {\n small: createFontStyle(theme, {\n selector: (typography) => typography.caption1.medium,\n color: selected ? theme.palette.text.strongInverse : theme.palette.text.strong,\n }),\n large: createFontStyle(theme, {\n selector: (typography) => typography.body2.medium,\n color: selected ? theme.palette.text.strongInverse : theme.palette.text.strong,\n }),\n };\n\n const closeButtonStyleMap: Record<ChipSize, FountainUiStyle> = {\n small: {\n height: 14,\n marginLeft: theme.spacing(2),\n width: 8.17,\n },\n large: {\n height: 17,\n marginLeft: theme.spacing(2.5),\n width: 9,\n },\n };\n\n const baseContainerStyle: FountainUiStyle = {\n alignItems: 'center',\n backgroundColor: selected ? theme.palette.fill.base\n : color === 'white'\n ? theme.palette.surface.base\n : theme.palette.fill.weaker,\n borderRadius: theme.shape.radius.full,\n flexDirection: 'row',\n overflow: 'hidden',\n };\n\n const isLarge = size === 'large';\n\n const variantStyleMap: VariantStyleMap = {\n avatar: {\n container: {\n paddingLeft: theme.spacing(isLarge ? 1.5 : 1.25),\n paddingRight: theme.spacing(isLarge ? 3.5 : 3),\n paddingVertical: theme.spacing(isLarge ? 1.25 : 1),\n },\n startElement: {\n borderRadius: theme.shape.radius.full,\n height: isLarge ? 26 : 23,\n width: isLarge ? 26 : 23,\n },\n startElementContainer: {\n marginRight: theme.spacing(isLarge ? 1.5 : 1.25),\n },\n },\n icon: {\n container: {\n paddingLeft: theme.spacing(1.5),\n paddingRight: theme.spacing(isLarge ? 3.5 : 3),\n paddingVertical: theme.spacing(isLarge ? 1.5 : 1.25),\n },\n startElement: {\n color: selected\n ? theme.palette.icon.strongInverse\n : theme.palette.icon.strong,\n height: isLarge ? 17 : 16,\n width: isLarge ? 17 : 16,\n },\n startElementContainer: {\n alignItems: 'center',\n height: isLarge ? 24 : 21,\n justifyContent: 'center',\n marginRight: theme.spacing(isLarge ? 1 : 0.75),\n width: isLarge ? 24 : 21,\n },\n },\n image: {\n container: {\n alignItems: 'center',\n paddingRight: theme.spacing(isLarge ? 3.5 : 3),\n },\n startElement: {\n borderRadius: theme.shape.radius.full,\n height: isLarge ? 36 : 31,\n width: isLarge ? 48 : 40,\n },\n startElementContainer: {\n marginRight: theme.spacing(1.5),\n },\n },\n default: {\n container: {\n paddingBottom: theme.spacing(1.75),\n paddingHorizontal: theme.spacing(isLarge ? 3.5 : 3),\n paddingTop: theme.spacing(1.5),\n },\n },\n };\n\n return {\n container: {\n ...baseContainerStyle,\n ...variantStyleMap[startElementVariant]?.container,\n ...(selected ? { paddingRight: theme.spacing(isLarge ? 2.5 : 2.25) } : {}),\n },\n closeButton: closeButtonStyleMap[size],\n label: fontStyleMap[size],\n startElement: variantStyleMap[startElementVariant]?.startElement,\n startElementContainer: variantStyleMap[startElementVariant]?.startElementContainer,\n };\n }, [theme, size, startElementVariant, color, selected]);\n}\n"],"mappings":";;;;;;;AAAA;;AAGA;;AAaA;AACe,SAASA,YAAT,CACXC,IADW,EAEXC,mBAFW,EAGXC,KAHW,EAIXC,QAJW,EAKF;EACT,MAAMC,KAAK,GAAG,IAAAC,gBAAA,GAAd;EAEA,OAAO,IAAAC,cAAA,EAAmB,MAAM;IAAA;;IAC5B,MAAMC,YAAyC,GAAG;MAC9CC,KAAK,EAAE,IAAAC,uBAAA,EAAgBL,KAAhB,EAAuB;QAC1BM,QAAQ,EAAGC,UAAD,IAAgBA,UAAU,CAACC,QAAX,CAAoBC,MADpB;QAE1BX,KAAK,EAAEC,QAAQ,GAAGC,KAAK,CAACU,OAAN,CAAcC,IAAd,CAAmBC,aAAtB,GAAsCZ,KAAK,CAACU,OAAN,CAAcC,IAAd,CAAmBE;MAF9C,CAAvB,CADuC;MAK9CC,KAAK,EAAE,IAAAT,uBAAA,EAAgBL,KAAhB,EAAuB;QAC1BM,QAAQ,EAAGC,UAAD,IAAgBA,UAAU,CAACQ,KAAX,CAAiBN,MADjB;QAE1BX,KAAK,EAAEC,QAAQ,GAAGC,KAAK,CAACU,OAAN,CAAcC,IAAd,CAAmBC,aAAtB,GAAsCZ,KAAK,CAACU,OAAN,CAAcC,IAAd,CAAmBE;MAF9C,CAAvB;IALuC,CAAlD;IAWA,MAAMG,mBAAsD,GAAG;MAC3DZ,KAAK,EAAE;QACHa,MAAM,EAAE,EADL;QAEHC,UAAU,EAAElB,KAAK,CAACmB,OAAN,CAAc,CAAd,CAFT;QAGHC,KAAK,EAAE;MAHJ,CADoD;MAM3DN,KAAK,EAAE;QACHG,MAAM,EAAE,EADL;QAEHC,UAAU,EAAElB,KAAK,CAACmB,OA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a,EAAEhD,KAAK,CAACmB,OAAN,CAAc,IAAd,CADR;UAEP8B,iBAAiB,EAAEjD,KAAK,CAACmB,OAAN,CAAce,OAAO,GAAG,GAAH,GAAS,CAA9B,CAFZ;UAGPgB,UAAU,EAAElD,KAAK,CAACmB,OAAN,CAAc,GAAd;QAHL;MADN;IAnD4B,CAAzC;IA4DA,OAAO;MACHkB,SAAS,EAAE,EACP,GAAGhB,kBADI;QAEP,6BAAGc,eAAe,CAACtC,mBAAD,CAAlB,0DAAG,sBAAsCwC,SAAzC,CAFO;QAGP,IAAItC,QAAQ,GAAG;UAAEwC,YAAY,EAAEvC,KAAK,CAACmB,OAAN,CAAce,OAAO,GAAG,GAAH,GAAS,IAA9B;QAAhB,CAAH,GAA2D,EAAvE;MAHO,CADR;MAMHiB,WAAW,EAAEnC,mBAAmB,CAACpB,IAAD,CAN7B;MAOHwD,KAAK,EAAEjD,YAAY,CAACP,IAAD,CAPhB;MAQH6C,YAAY,4BAAEN,eAAe,CAACtC,mBAAD,CAAjB,2DAAE,uBAAsC4C,YARjD;MASHC,qBAAqB,4BAAEP,eAAe,CAACtC,mBAAD,CAAjB,2DAAE,uBAAsC6C;IAT1D,CAAP;EAWH,CA7GM,EA6GJ,CAAC1C,KAAD,EAAQJ,IAAR,EAAcC,mBAAd,EAAmCC,KAAnC,EAA0CC,QAA1C,CA7GI,CAAP;AA8GH"}
|
|
@@ -35,7 +35,6 @@ function Dialog(props) {
|
|
|
35
35
|
const {
|
|
36
36
|
animationType = _Modal.ANIMATION_TYPE.SLIDE,
|
|
37
37
|
children,
|
|
38
|
-
fullScreen = false,
|
|
39
38
|
hideBackdrop,
|
|
40
39
|
onClose,
|
|
41
40
|
style: styleProp,
|
|
@@ -44,7 +43,7 @@ function Dialog(props) {
|
|
|
44
43
|
topElement,
|
|
45
44
|
...otherProps
|
|
46
45
|
} = props;
|
|
47
|
-
const styles = (0, _useDialogStyle.default)(size
|
|
46
|
+
const styles = (0, _useDialogStyle.default)(size);
|
|
48
47
|
const {
|
|
49
48
|
height: screenHeight
|
|
50
49
|
} = (0, _reactNative.useWindowDimensions)();
|
|
@@ -73,7 +72,7 @@ function Dialog(props) {
|
|
|
73
72
|
toValue: 0,
|
|
74
73
|
type: _Modal.ANIMATION_TYPE.FADE
|
|
75
74
|
}];
|
|
76
|
-
} else if (animationType === _Modal.ANIMATION_TYPE.SLIDE
|
|
75
|
+
} else if (animationType === _Modal.ANIMATION_TYPE.SLIDE) {
|
|
77
76
|
return [{
|
|
78
77
|
toValue: screenHeight,
|
|
79
78
|
type: _Modal.ANIMATION_TYPE.SLIDE
|
|
@@ -89,14 +88,14 @@ function Dialog(props) {
|
|
|
89
88
|
toValue: screenHeight,
|
|
90
89
|
type: _Modal.ANIMATION_TYPE.SLIDE
|
|
91
90
|
}];
|
|
92
|
-
}, [animationType,
|
|
91
|
+
}, [animationType, screenHeight]);
|
|
93
92
|
const openAnimation = (0, _react.useMemo)(() => {
|
|
94
93
|
if (animationType === _Modal.ANIMATION_TYPE.FADE) {
|
|
95
94
|
return [{
|
|
96
95
|
toValue: 1,
|
|
97
96
|
type: _Modal.ANIMATION_TYPE.FADE
|
|
98
97
|
}];
|
|
99
|
-
} else if (animationType === _Modal.ANIMATION_TYPE.SLIDE
|
|
98
|
+
} else if (animationType === _Modal.ANIMATION_TYPE.SLIDE) {
|
|
100
99
|
return [{
|
|
101
100
|
toValue: 0,
|
|
102
101
|
type: _Modal.ANIMATION_TYPE.SLIDE
|
|
@@ -112,8 +111,8 @@ function Dialog(props) {
|
|
|
112
111
|
toValue: 0,
|
|
113
112
|
type: _Modal.ANIMATION_TYPE.SLIDE
|
|
114
113
|
}];
|
|
115
|
-
}, [animationType
|
|
116
|
-
const initialOpacity = animationType === _Modal.ANIMATION_TYPE.SLIDE
|
|
114
|
+
}, [animationType]);
|
|
115
|
+
const initialOpacity = animationType === _Modal.ANIMATION_TYPE.SLIDE ? 1 : undefined;
|
|
117
116
|
const initialTranslateY = animationType === _Modal.ANIMATION_TYPE.FADE ? 0 : undefined;
|
|
118
117
|
const paperStyle = (0, _styles.css)([styles.paper, styleProp]);
|
|
119
118
|
return /*#__PURE__*/_react.default.createElement(_Modal.default, _extends({
|
|
@@ -132,7 +131,7 @@ function Dialog(props) {
|
|
|
132
131
|
size
|
|
133
132
|
}
|
|
134
133
|
}, topElement ? /*#__PURE__*/_react.default.createElement(_Column.default, {
|
|
135
|
-
style:
|
|
134
|
+
style: styles.topElementContainer
|
|
136
135
|
}, /*#__PURE__*/_react.default.createElement(_Column.default, {
|
|
137
136
|
style: styles.topElementContent,
|
|
138
137
|
onLayout: handleTopElementLayout
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["TOP_ELEMENT_OFFSET","Dialog","props","animationType","ANIMATION_TYPE","SLIDE","children","
|
|
1
|
+
{"version":3,"names":["TOP_ELEMENT_OFFSET","Dialog","props","animationType","ANIMATION_TYPE","SLIDE","children","hideBackdrop","onClose","style","styleProp","size","visible","topElement","otherProps","styles","useDialogStyle","height","screenHeight","useWindowDimensions","topElementHeight","setTopElementHeight","useState","handleTopElementLayout","event","nativeEvent","layout","offsetAnimation","useMemo","toValue","type","closeAnimation","FADE","duration","openAnimation","delay","initialOpacity","undefined","initialTranslateY","paperStyle","css","paper","container","root","topElementContainer","topElementContent"],"sources":["Dialog.tsx"],"sourcesContent":["import React, { useMemo, useState } from 'react';\nimport { LayoutChangeEvent, useWindowDimensions } from 'react-native';\nimport { css } from '@fountain-ui/styles';\nimport Column from '../Column';\nimport Modal, { ANIMATION_TYPE, AnimationUnit } from '../Modal';\nimport ShadowView from '../ShadowView';\nimport type DialogProps from './DialogProps';\nimport { DialogProvider } from './DialogContext';\nimport useDialogStyle from './useDialogStyle';\n\nconst TOP_ELEMENT_OFFSET = 20;\n\nexport default function Dialog(props: DialogProps) {\n const {\n animationType = ANIMATION_TYPE.SLIDE,\n children,\n hideBackdrop,\n onClose,\n style: styleProp,\n size = 'medium',\n visible,\n topElement,\n ...otherProps\n } = props;\n\n const styles = useDialogStyle(size);\n\n const { height: screenHeight } = useWindowDimensions();\n\n const [topElementHeight, setTopElementHeight] = useState(0);\n const handleTopElementLayout = (event: LayoutChangeEvent) => {\n const { height } = event.nativeEvent.layout;\n setTopElementHeight(height);\n };\n\n const offsetAnimation = useMemo<AnimationUnit[]>(() => {\n if (topElementHeight === 0) {\n return [];\n }\n\n return [{\n toValue: (topElementHeight - TOP_ELEMENT_OFFSET) / 2,\n type: ANIMATION_TYPE.SLIDE,\n }];\n }, [topElementHeight]);\n\n const closeAnimation = useMemo<AnimationUnit[]>(() => {\n if (animationType === ANIMATION_TYPE.FADE) {\n return [{\n toValue: 0,\n type: ANIMATION_TYPE.FADE,\n }];\n } else if (animationType === ANIMATION_TYPE.SLIDE) {\n return [\n {\n toValue: screenHeight,\n type: ANIMATION_TYPE.SLIDE,\n },\n {\n duration: 150,\n toValue: 0,\n type: ANIMATION_TYPE.FADE,\n },\n ];\n }\n\n return [{\n duration: 150,\n toValue: screenHeight,\n type: ANIMATION_TYPE.SLIDE,\n }];\n }, [animationType, screenHeight]);\n\n const openAnimation = useMemo<AnimationUnit[]>(() => {\n if (animationType === ANIMATION_TYPE.FADE) {\n return [{\n toValue: 1,\n type: ANIMATION_TYPE.FADE,\n }];\n } else if (animationType === ANIMATION_TYPE.SLIDE) {\n return [\n {\n toValue: 0,\n type: ANIMATION_TYPE.SLIDE,\n },\n {\n delay: 50,\n duration: 150,\n toValue: 1,\n type: ANIMATION_TYPE.FADE,\n },\n ];\n }\n\n return [{\n toValue: 0,\n type: ANIMATION_TYPE.SLIDE,\n }];\n }, [animationType]);\n\n const initialOpacity = animationType === ANIMATION_TYPE.SLIDE ? 1 : undefined;\n\n const initialTranslateY = animationType === ANIMATION_TYPE.FADE ? 0 : undefined;\n\n const paperStyle = css([\n styles.paper,\n styleProp,\n ]);\n\n return (\n <Modal\n animationStyle={styles.container}\n closeAnimation={closeAnimation}\n hideBackdrop={hideBackdrop || animationType === ANIMATION_TYPE.FADE}\n initialOpacity={initialOpacity}\n initialTranslateY={initialTranslateY}\n onClose={onClose}\n openAnimation={openAnimation}\n offsetAnimation={offsetAnimation}\n visible={visible}\n style={styles.root}\n {...otherProps}\n >\n <DialogProvider value={{ size }}>\n {topElement ? (\n <Column style={styles.topElementContainer}>\n <Column\n style={styles.topElementContent}\n onLayout={handleTopElementLayout}\n >\n {topElement}\n </Column>\n </Column>\n ) : null}\n\n <ShadowView\n variant={600}\n style={paperStyle}\n >\n {children}\n </ShadowView>\n </DialogProvider>\n </Modal>\n );\n};\n"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA;;AACA;;;;;;;;;;AAEA,MAAMA,kBAAkB,GAAG,EAA3B;;AAEe,SAASC,MAAT,CAAgBC,KAAhB,EAAoC;EAC/C,MAAM;IACFC,aAAa,GAAGC,qBAAA,CAAeC,KAD7B;IAEFC,QAFE;IAGFC,YAHE;IAIFC,OAJE;IAKFC,KAAK,EAAEC,SALL;IAMFC,IAAI,GAAG,QANL;IAOFC,OAPE;IAQFC,UARE;IASF,GAAGC;EATD,IAUFZ,KAVJ;EAYA,MAAMa,MAAM,GAAG,IAAAC,uBAAA,EAAeL,IAAf,CAAf;EAEA,MAAM;IAAEM,MAAM,EAAEC;EAAV,IAA2B,IAAAC,gCAAA,GAAjC;EAEA,MAAM,CAACC,gBAAD,EAAmBC,mBAAnB,IAA0C,IAAAC,eAAA,EAAS,CAAT,CAAhD;;EACA,MAAMC,sBAAsB,GAAIC,KAAD,IAA8B;IACzD,MAAM;MAAEP;IAAF,IAAaO,KAAK,CAACC,WAAN,CAAkBC,MAArC;IACAL,mBAAmB,CAACJ,MAAD,CAAnB;EACH,CAHD;;EAKA,MAAMU,eAAe,GAAG,IAAAC,cAAA,EAAyB,MAAM;IACnD,IAAIR,gBAAgB,KAAK,CAAzB,EAA4B;MACxB,OAAO,EAAP;IACH;;IAED,OAAO,CAAC;MACJS,OAAO,EAAE,CAACT,gBAAgB,G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JL,CAZJ,CAbJ,CADJ;AAmCH;;AAAA"}
|
|
@@ -4,6 +4,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.dialogSizes = void 0;
|
|
7
|
-
const dialogSizes = ['small', 'medium', 'large'];
|
|
7
|
+
const dialogSizes = ['small', 'medium', 'large', 'full'];
|
|
8
8
|
exports.dialogSizes = dialogSizes;
|
|
9
9
|
//# sourceMappingURL=DialogProps.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["dialogSizes"],"sources":["DialogProps.ts"],"sourcesContent":["import React from 'react';\nimport type { ModalProps } from '../Modal';\nimport type { OverridableComponentProps } from '../types';\nimport { ANIMATION_TYPE } from '../Modal';\n\nexport const dialogSizes = ['small', 'medium', 'large'] as const;\nexport type DialogSize = typeof dialogSizes[number];\n\nexport default interface DialogProps extends OverridableComponentProps<ModalProps, {\n /**\n * Type of animation used when the dialog opens and closes.\n * @default 'slide'\n */\n animationType?: ANIMATION_TYPE;\n\n /**\n * Dialog children, usually the included sub-components.\n */\n children?: React.ReactNode;\n\n /**\n *
|
|
1
|
+
{"version":3,"names":["dialogSizes"],"sources":["DialogProps.ts"],"sourcesContent":["import React from 'react';\nimport type { ModalProps } from '../Modal';\nimport type { OverridableComponentProps } from '../types';\nimport { ANIMATION_TYPE } from '../Modal';\n\nexport const dialogSizes = ['small', 'medium', 'large', 'full'] as const;\nexport type DialogSize = typeof dialogSizes[number];\n\nexport default interface DialogProps extends OverridableComponentProps<ModalProps, {\n /**\n * Type of animation used when the dialog opens and closes.\n * @default 'slide'\n */\n animationType?: ANIMATION_TYPE;\n\n /**\n * Dialog children, usually the included sub-components.\n */\n children?: React.ReactNode;\n\n /**\n * Determines the minWidth of the Dialog.\n * @default 'medium'\n */\n size?: DialogSize;\n\n /**\n * Top element for displaying additional information on the dialog.\n */\n topElement?: React.ReactNode;\n}> {}\n"],"mappings":";;;;;;AAKO,MAAMA,WAAW,GAAG,CAAC,OAAD,EAAU,QAAV,EAAoB,OAApB,EAA6B,MAA7B,CAApB"}
|
|
@@ -24,14 +24,16 @@ function useDialogSectionStyle() {
|
|
|
24
24
|
return (0, _react.useMemo)(() => {
|
|
25
25
|
const sizePaddingHorizontalMap = {
|
|
26
26
|
small: {
|
|
27
|
-
paddingHorizontal:
|
|
27
|
+
paddingHorizontal: 24
|
|
28
28
|
},
|
|
29
29
|
medium: {
|
|
30
|
-
|
|
31
|
-
paddingHorizontal: theme.spacing(windowWidth >= 448 ? 8 : 6)
|
|
30
|
+
paddingHorizontal: windowWidth >= 448 ? 32 : 24
|
|
32
31
|
},
|
|
33
32
|
large: {
|
|
34
|
-
paddingHorizontal:
|
|
33
|
+
paddingHorizontal: 32
|
|
34
|
+
},
|
|
35
|
+
full: {
|
|
36
|
+
paddingHorizontal: windowWidth >= 448 ? 32 : 24
|
|
35
37
|
}
|
|
36
38
|
};
|
|
37
39
|
return sizePaddingHorizontalMap[size];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useDialogSectionStyle","size","useDialogContext","width","windowWidth","useWindowDimensions","theme","useTheme","useMemo","sizePaddingHorizontalMap","small","paddingHorizontal","
|
|
1
|
+
{"version":3,"names":["useDialogSectionStyle","size","useDialogContext","width","windowWidth","useWindowDimensions","theme","useTheme","useMemo","sizePaddingHorizontalMap","small","paddingHorizontal","medium","large","full"],"sources":["useDialogSectionStyle.ts"],"sourcesContent":["import { useMemo } from 'react';\nimport { useWindowDimensions } from 'react-native';\nimport type { FountainUiStyle } from '@fountain-ui/styles';\nimport { useTheme } from '../styles';\nimport { useDialogContext } from './DialogContext';\nimport type { DialogSize } from './DialogProps';\n\nexport default function useDialogSectionStyle() {\n const { size } = useDialogContext();\n\n const { width: windowWidth } = useWindowDimensions();\n\n const theme = useTheme();\n\n return useMemo<FountainUiStyle>(() => {\n const sizePaddingHorizontalMap: Record<DialogSize, FountainUiStyle> = {\n small: {\n paddingHorizontal: 24,\n },\n medium: {\n paddingHorizontal: windowWidth >= 448 ? 32 : 24,\n },\n large: {\n paddingHorizontal: 32,\n },\n full: {\n paddingHorizontal: windowWidth >= 448 ? 32 : 24,\n },\n };\n\n return sizePaddingHorizontalMap[size];\n }, [size, theme, windowWidth]);\n}\n"],"mappings":";;;;;;;AAAA;;AACA;;AAEA;;AACA;;AAGe,SAASA,qBAAT,GAAiC;EAC5C,MAAM;IAAEC;EAAF,IAAW,IAAAC,+BAAA,GAAjB;EAEA,MAAM;IAAEC,KAAK,EAAEC;EAAT,IAAyB,IAAAC,gCAAA,GAA/B;EAEA,MAAMC,KAAK,GAAG,IAAAC,gBAAA,GAAd;EAEA,OAAO,IAAAC,cAAA,EAAyB,MAAM;IAClC,MAAMC,wBAA6D,GAAG;MAClEC,KAAK,EAAE;QACHC,iBAAiB,EAAE;MADhB,CAD2D;MAIlEC,MAAM,EAAE;QACJD,iBAAiB,EAAEP,WAAW,IAAI,GAAf,GAAqB,EAArB,GAA0B;MADzC,CAJ0D;MAOlES,KAAK,EAAE;QACHF,iBAAiB,EAAE;MADhB,CAP2D;MAUlEG,IAAI,EAAE;QACFH,iBAAiB,EAAEP,WAAW,IAAI,GAAf,GAAqB,EAArB,GAA0B;MAD3C;IAV4D,CAAtE;IAeA,OAAOK,wBAAwB,CAACR,IAAD,CAA/B;EACH,CAjBM,EAiBJ,CAACA,IAAD,EAAOK,KAAP,EAAcF,WAAd,CAjBI,CAAP;AAkBH"}
|