@fountain-ui/core 3.0.0-alpha.10 → 3.0.0-alpha.11
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/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 +5 -5
- 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/BackButton.js +47 -0
- package/build/commonjs/DialogTitle/BackButton.js.map +1 -0
- package/build/commonjs/DialogTitle/CloseButton.js +45 -0
- package/build/commonjs/DialogTitle/CloseButton.js.map +1 -0
- package/build/commonjs/DialogTitle/DialogTitle.js +11 -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/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/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/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 +5 -5
- 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/BackButton.js +32 -0
- package/build/module/DialogTitle/BackButton.js.map +1 -0
- package/build/module/DialogTitle/CloseButton.js +30 -0
- package/build/module/DialogTitle/CloseButton.js.map +1 -0
- package/build/module/DialogTitle/DialogTitle.js +8 -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/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/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/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/BackButton.d.ts +6 -0
- package/build/typescript/DialogTitle/CloseButton.d.ts +6 -0
- package/build/typescript/DialogTitle/DialogTitle.d.ts +8 -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 +2 -2
- package/src/AppBar/AppBar.tsx +4 -0
- 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 +4 -4
- package/src/Dialog/useDialogStyle.ts +9 -7
- package/src/DialogTitle/BackButton.tsx +44 -0
- package/src/DialogTitle/CloseButton.tsx +42 -0
- package/src/DialogTitle/DialogTitle.tsx +9 -1
- package/src/Divider/Divider.tsx +5 -0
- package/src/Divider/DividerProps.ts +1 -1
- 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/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
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import { useMemo } from 'react';
|
|
2
|
+
import { useBreakpointUp } from '../hooks';
|
|
2
3
|
import { useTheme } from '../styles';
|
|
3
4
|
export default function useTabsStyle(variant) {
|
|
4
5
|
const theme = useTheme();
|
|
6
|
+
const isDesktop = useBreakpointUp('md', true, false);
|
|
5
7
|
return useMemo(() => {
|
|
6
8
|
switch (variant) {
|
|
7
9
|
case 'circular':
|
|
8
10
|
return {
|
|
9
11
|
container: {
|
|
10
|
-
paddingBottom:
|
|
11
|
-
paddingHorizontal:
|
|
12
|
+
paddingBottom: 8,
|
|
13
|
+
paddingHorizontal: isDesktop ? 20 : 12
|
|
12
14
|
}
|
|
13
15
|
};
|
|
14
16
|
|
|
@@ -21,10 +23,10 @@ export default function useTabsStyle(variant) {
|
|
|
21
23
|
default:
|
|
22
24
|
return {
|
|
23
25
|
container: {
|
|
24
|
-
paddingHorizontal:
|
|
26
|
+
paddingHorizontal: isDesktop ? 14 : 6
|
|
25
27
|
}
|
|
26
28
|
};
|
|
27
29
|
}
|
|
28
|
-
}, [theme, variant]);
|
|
30
|
+
}, [theme, variant, isDesktop]);
|
|
29
31
|
}
|
|
30
32
|
//# sourceMappingURL=useTabsStyle.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useMemo","useTheme","useTabsStyle","variant","theme","
|
|
1
|
+
{"version":3,"names":["useMemo","useBreakpointUp","useTheme","useTabsStyle","variant","theme","isDesktop","container","paddingBottom","paddingHorizontal"],"sources":["useTabsStyle.ts"],"sourcesContent":["import { useMemo } from 'react';\nimport type { FountainUiStyle } from '@fountain-ui/styles';\nimport { useBreakpointUp } from '../hooks';\nimport { useTheme } from '../styles';\nimport type { TabVariant } from '../Tab';\n\ninterface TabsStyle {\n container: FountainUiStyle;\n}\n\nexport default function useTabsStyle(variant: TabVariant) {\n const theme = useTheme();\n\n const isDesktop = useBreakpointUp('md', true, false);\n\n return useMemo<TabsStyle>(() => {\n switch (variant) {\n case 'circular':\n return {\n container: {\n paddingBottom: 8,\n paddingHorizontal: isDesktop ? 20 : 12,\n },\n };\n case 'bottom-navigation':\n return {\n container: {},\n };\n case 'default':\n default:\n return {\n container: {\n paddingHorizontal: isDesktop ? 14 : 6,\n },\n };\n }\n }, [theme, variant, isDesktop]);\n}\n"],"mappings":"AAAA,SAASA,OAAT,QAAwB,OAAxB;AAEA,SAASC,eAAT,QAAgC,UAAhC;AACA,SAASC,QAAT,QAAyB,WAAzB;AAOA,eAAe,SAASC,YAAT,CAAsBC,OAAtB,EAA2C;EACtD,MAAMC,KAAK,GAAGH,QAAQ,EAAtB;EAEA,MAAMI,SAAS,GAAGL,eAAe,CAAC,IAAD,EAAO,IAAP,EAAa,KAAb,CAAjC;EAEA,OAAOD,OAAO,CAAY,MAAM;IAC5B,QAAQI,OAAR;MACI,KAAK,UAAL;QACI,OAAO;UACHG,SAAS,EAAE;YACPC,aAAa,EAAE,CADR;YAEPC,iBAAiB,EAAEH,SAAS,GAAG,EAAH,GAAQ;UAF7B;QADR,CAAP;;MAMJ,KAAK,mBAAL;QACI,OAAO;UACHC,SAAS,EAAE;QADR,CAAP;;MAGJ,KAAK,SAAL;MACA;QACI,OAAO;UACHA,SAAS,EAAE;YACPE,iBAAiB,EAAEH,SAAS,GAAG,EAAH,GAAQ;UAD7B;QADR,CAAP;IAdR;EAoBH,CArBa,EAqBX,CAACD,KAAD,EAAQD,OAAR,EAAiBE,SAAjB,CArBW,CAAd;AAsBH"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
+
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { StyleSheet } from 'react-native';
|
|
5
|
+
import IconButton from '../../IconButton';
|
|
6
|
+
import { ChevronLeft } from '../../internal';
|
|
7
|
+
import { css } from '@fountain-ui/styles';
|
|
8
|
+
const styles = StyleSheet.create({
|
|
9
|
+
root: {
|
|
10
|
+
height: 40,
|
|
11
|
+
left: 4,
|
|
12
|
+
paddingLeft: 5,
|
|
13
|
+
paddingRight: 11,
|
|
14
|
+
paddingVertical: 8,
|
|
15
|
+
position: 'absolute',
|
|
16
|
+
width: 40
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
export default function BackButton(props) {
|
|
20
|
+
const {
|
|
21
|
+
style: styleProp,
|
|
22
|
+
...otherProps
|
|
23
|
+
} = props;
|
|
24
|
+
const rootStyle = css([styles.root, styleProp]);
|
|
25
|
+
return /*#__PURE__*/React.createElement(IconButton, _extends({
|
|
26
|
+
style: rootStyle
|
|
27
|
+
}, otherProps), /*#__PURE__*/React.createElement(ChevronLeft, {
|
|
28
|
+
color: 'strong',
|
|
29
|
+
size: 'large'
|
|
30
|
+
}));
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=BackButton.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","StyleSheet","IconButton","ChevronLeft","css","styles","create","root","height","left","paddingLeft","paddingRight","paddingVertical","position","width","BackButton","props","style","styleProp","otherProps","rootStyle"],"sources":["BackButton.tsx"],"sourcesContent":["import React from 'react';\nimport { StyleSheet } from 'react-native';\nimport IconButton from '../../IconButton';\nimport { ChevronLeft } from '../../internal';\nimport type BackButtonProps from './BackButtonProps';\nimport { css } from '@fountain-ui/styles';\n\nconst styles = StyleSheet.create({\n root: {\n height: 40,\n left: 4,\n paddingLeft: 5,\n paddingRight: 11,\n paddingVertical: 8,\n position: 'absolute',\n width: 40,\n },\n});\n\nexport default function BackButton(props: BackButtonProps) {\n const {\n style: styleProp,\n ...otherProps\n } = props;\n\n const rootStyle = css([\n styles.root,\n styleProp,\n ]);\n\n return (\n <IconButton\n style={rootStyle}\n {...otherProps}\n >\n <ChevronLeft\n color={'strong'}\n size={'large'}\n />\n </IconButton>\n );\n}\n"],"mappings":";;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,SAASC,UAAT,QAA2B,cAA3B;AACA,OAAOC,UAAP,MAAuB,kBAAvB;AACA,SAASC,WAAT,QAA4B,gBAA5B;AAEA,SAASC,GAAT,QAAoB,qBAApB;AAEA,MAAMC,MAAM,GAAGJ,UAAU,CAACK,MAAX,CAAkB;EAC7BC,IAAI,EAAE;IACFC,MAAM,EAAE,EADN;IAEFC,IAAI,EAAE,CAFJ;IAGFC,WAAW,EAAE,CAHX;IAIFC,YAAY,EAAE,EAJZ;IAKFC,eAAe,EAAE,CALf;IAMFC,QAAQ,EAAE,UANR;IAOFC,KAAK,EAAE;EAPL;AADuB,CAAlB,CAAf;AAYA,eAAe,SAASC,UAAT,CAAoBC,KAApB,EAA4C;EACvD,MAAM;IACFC,KAAK,EAAEC,SADL;IAEF,GAAGC;EAFD,IAGFH,KAHJ;EAKA,MAAMI,SAAS,GAAGhB,GAAG,CAAC,CAClBC,MAAM,CAACE,IADW,EAElBW,SAFkB,CAAD,CAArB;EAKA,oBACI,oBAAC,UAAD;IACI,KAAK,EAAEE;EADX,GAEQD,UAFR,gBAII,oBAAC,WAAD;IACI,KAAK,EAAE,QADX;IAEI,IAAI,EAAE;EAFV,EAJJ,CADJ;AAWH"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sources":["BackButtonProps.ts"],"sourcesContent":["import type { IconButtonProps } from '../../IconButton';\nimport type { OverridableComponentProps } from '../../types';\n\nexport default interface BackButtonProps extends OverridableComponentProps<Omit<IconButtonProps, 'children'>, {}> {}\n"],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["default"],"sources":["index.ts"],"sourcesContent":["export { default } from './BackButton';\nexport type { default as BackButtonProps } from './BackButtonProps';\n"],"mappings":"AAAA,SAASA,OAAT,QAAwB,cAAxB"}
|
|
@@ -3,6 +3,7 @@ function _extends() { _extends = Object.assign ? Object.assign.bind() : function
|
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import Row from '../Row';
|
|
5
5
|
import { css, useTheme } from '../styles';
|
|
6
|
+
import BackButton from './BackButton';
|
|
6
7
|
|
|
7
8
|
const useStyles = function () {
|
|
8
9
|
const theme = useTheme();
|
|
@@ -28,7 +29,8 @@ const sizeMap = {
|
|
|
28
29
|
height: 56
|
|
29
30
|
}
|
|
30
31
|
};
|
|
31
|
-
|
|
32
|
+
|
|
33
|
+
const Toolbar = props => {
|
|
32
34
|
const {
|
|
33
35
|
disableGutters = false,
|
|
34
36
|
size = 'medium',
|
|
@@ -39,6 +41,8 @@ export default function Toolbar(props) {
|
|
|
39
41
|
return /*#__PURE__*/React.createElement(Row, _extends({
|
|
40
42
|
style: css([styles.root, !disableGutters ? styles.gutters : undefined, sizeMap[size], style])
|
|
41
43
|
}, otherProps));
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
Toolbar.BackButton = BackButton;
|
|
47
|
+
export default Toolbar;
|
|
44
48
|
//# sourceMappingURL=Toolbar.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","Row","css","useTheme","useStyles","theme","root","alignItems","flexWrap","gutters","paddingHorizontal","spacing","sizeMap","small","height","medium","large","Toolbar","props","disableGutters","size","style","otherProps","styles","undefined"],"sources":["Toolbar.tsx"],"sourcesContent":["import React from 'react';\nimport type { FountainUiStyle, NamedStylesStringUnion, UseStyles } from '@fountain-ui/styles';\nimport Row from '../Row';\nimport { css, useTheme } from '../styles';\nimport type ToolbarProps from './ToolbarProps';\nimport type { ToolbarSize } from './ToolbarProps';\n\ntype ToolbarStyles = NamedStylesStringUnion<'root' | 'gutters'>;\n\nconst useStyles: UseStyles<ToolbarStyles> = function (): ToolbarStyles {\n const theme = useTheme();\n\n return {\n root: {\n alignItems: 'center',\n flexWrap: 'nowrap',\n },\n gutters: {\n paddingHorizontal: theme.spacing(4),\n },\n };\n};\n\nconst sizeMap: Record<ToolbarSize, FountainUiStyle> = {\n small: { height: 48 },\n medium: { height: 50 },\n large: { height: 56 },\n};\n\
|
|
1
|
+
{"version":3,"names":["React","Row","css","useTheme","BackButton","useStyles","theme","root","alignItems","flexWrap","gutters","paddingHorizontal","spacing","sizeMap","small","height","medium","large","Toolbar","props","disableGutters","size","style","otherProps","styles","undefined"],"sources":["Toolbar.tsx"],"sourcesContent":["import React from 'react';\nimport type { FountainUiStyle, NamedStylesStringUnion, UseStyles } from '@fountain-ui/styles';\nimport Row from '../Row';\nimport { css, useTheme } from '../styles';\nimport BackButton from './BackButton';\nimport type ToolbarProps from './ToolbarProps';\nimport type { ToolbarSize } from './ToolbarProps';\n\ntype ToolbarStyles = NamedStylesStringUnion<'root' | 'gutters'>;\n\nconst useStyles: UseStyles<ToolbarStyles> = function (): ToolbarStyles {\n const theme = useTheme();\n\n return {\n root: {\n alignItems: 'center',\n flexWrap: 'nowrap',\n },\n gutters: {\n paddingHorizontal: theme.spacing(4),\n },\n };\n};\n\nconst sizeMap: Record<ToolbarSize, FountainUiStyle> = {\n small: { height: 48 },\n medium: { height: 50 },\n large: { height: 56 },\n};\n\nconst Toolbar = (props: ToolbarProps) => {\n const {\n disableGutters = false,\n size = 'medium',\n style,\n ...otherProps\n } = props;\n\n const styles = useStyles();\n\n return (\n <Row\n style={css([\n styles.root,\n !disableGutters ? styles.gutters : undefined,\n sizeMap[size],\n style,\n ])}\n {...otherProps}\n />\n );\n};\n\nToolbar.BackButton = BackButton;\n\nexport default Toolbar;\n"],"mappings":";;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AAEA,OAAOC,GAAP,MAAgB,QAAhB;AACA,SAASC,GAAT,EAAcC,QAAd,QAA8B,WAA9B;AACA,OAAOC,UAAP,MAAuB,cAAvB;;AAMA,MAAMC,SAAmC,GAAG,YAA2B;EACnE,MAAMC,KAAK,GAAGH,QAAQ,EAAtB;EAEA,OAAO;IACHI,IAAI,EAAE;MACFC,UAAU,EAAE,QADV;MAEFC,QAAQ,EAAE;IAFR,CADH;IAKHC,OAAO,EAAE;MACLC,iBAAiB,EAAEL,KAAK,CAACM,OAAN,CAAc,CAAd;IADd;EALN,CAAP;AASH,CAZD;;AAcA,MAAMC,OAA6C,GAAG;EAClDC,KAAK,EAAE;IAAEC,MAAM,EAAE;EAAV,CAD2C;EAElDC,MAAM,EAAE;IAAED,MAAM,EAAE;EAAV,CAF0C;EAGlDE,KAAK,EAAE;IAAEF,MAAM,EAAE;EAAV;AAH2C,CAAtD;;AAMA,MAAMG,OAAO,GAAIC,KAAD,IAAyB;EACrC,MAAM;IACFC,cAAc,GAAG,KADf;IAEFC,IAAI,GAAG,QAFL;IAGFC,KAHE;IAIF,GAAGC;EAJD,IAKFJ,KALJ;EAOA,MAAMK,MAAM,GAAGnB,SAAS,EAAxB;EAEA,oBACI,oBAAC,GAAD;IACI,KAAK,EAAEH,GAAG,CAAC,CACPsB,MAAM,CAACjB,IADA,EAEP,CAACa,cAAD,GAAkBI,MAAM,CAACd,OAAzB,GAAmCe,SAF5B,EAGPZ,OAAO,CAACQ,IAAD,CAHA,EAIPC,KAJO,CAAD;EADd,GAOQC,UAPR,EADJ;AAWH,CArBD;;AAuBAL,OAAO,CAACd,UAAR,GAAqBA,UAArB;AAEA,eAAec,OAAf"}
|
|
@@ -2,6 +2,8 @@ import React from 'react';
|
|
|
2
2
|
import { Path } from 'react-native-svg';
|
|
3
3
|
import { createSvgIcon } from '../../utils';
|
|
4
4
|
export default createSvgIcon( /*#__PURE__*/React.createElement(Path, {
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
fillRule: "evenodd",
|
|
6
|
+
clipRule: "evenodd",
|
|
7
|
+
d: "M0 12C3.16267e-09 11.7348 0.105357 11.4804 0.292893 11.2929L6.29289 5.29289C6.68342 4.90237 7.31658 4.90237 7.70711 5.29289C8.09763 5.68342 8.09763 6.31658 7.70711 6.70711L2.41421 12L7.70711 17.2929C8.09763 17.6834 8.09763 18.3166 7.70711 18.7071C7.31658 19.0976 6.68342 19.0976 6.29289 18.7071L0.292893 12.7071C0.105357 12.5196 -3.16267e-09 12.2652 0 12Z"
|
|
8
|
+
}), 'ChevronLeft', '0 0 8 24');
|
|
7
9
|
//# sourceMappingURL=ChevronLeft.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","Path","createSvgIcon"],"sources":["ChevronLeft.tsx"],"sourcesContent":["import React from 'react';\nimport { Path } from 'react-native-svg';\nimport { createSvgIcon } from '../../utils';\n\nexport default createSvgIcon(\n <Path\n d=\"
|
|
1
|
+
{"version":3,"names":["React","Path","createSvgIcon"],"sources":["ChevronLeft.tsx"],"sourcesContent":["import React from 'react';\nimport { Path } from 'react-native-svg';\nimport { createSvgIcon } from '../../utils';\n\nexport default createSvgIcon(\n <Path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M0 12C3.16267e-09 11.7348 0.105357 11.4804 0.292893 11.2929L6.29289 5.29289C6.68342 4.90237 7.31658 4.90237 7.70711 5.29289C8.09763 5.68342 8.09763 6.31658 7.70711 6.70711L2.41421 12L7.70711 17.2929C8.09763 17.6834 8.09763 18.3166 7.70711 18.7071C7.31658 19.0976 6.68342 19.0976 6.29289 18.7071L0.292893 12.7071C0.105357 12.5196 -3.16267e-09 12.2652 0 12Z\"\n />,\n 'ChevronLeft',\n '0 0 8 24',\n);\n"],"mappings":"AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,SAASC,IAAT,QAAqB,kBAArB;AACA,SAASC,aAAT,QAA8B,aAA9B;AAEA,eAAeA,aAAa,eACxB,oBAAC,IAAD;EACI,QAAQ,EAAC,SADb;EAEI,QAAQ,EAAC,SAFb;EAGI,CAAC,EAAC;AAHN,EADwB,EAMxB,aANwB,EAOxB,UAPwB,CAA5B"}
|
|
@@ -2,6 +2,8 @@ import React from 'react';
|
|
|
2
2
|
import { Path } from 'react-native-svg';
|
|
3
3
|
import { createSvgIcon } from '../../utils';
|
|
4
4
|
export default createSvgIcon( /*#__PURE__*/React.createElement(Path, {
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
fillRule: "evenodd",
|
|
6
|
+
clipRule: "evenodd",
|
|
7
|
+
d: "M8 12C8 12.2652 7.89464 12.5196 7.70711 12.7071L1.70711 18.7071C1.31658 19.0976 0.683417 19.0976 0.292892 18.7071C-0.0976309 18.3166 -0.0976309 17.6834 0.292893 17.2929L5.58579 12L0.292894 6.70711C-0.0976304 6.31658 -0.0976304 5.68342 0.292895 5.29289C0.683418 4.90237 1.31658 4.90237 1.70711 5.29289L7.70711 11.2929C7.89464 11.4804 8 11.7348 8 12Z"
|
|
8
|
+
}), 'ChevronRight', '0 0 8 24');
|
|
7
9
|
//# sourceMappingURL=ChevronRight.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","Path","createSvgIcon"],"sources":["ChevronRight.tsx"],"sourcesContent":["import React from 'react';\nimport { Path } from 'react-native-svg';\nimport { createSvgIcon } from '../../utils';\n\nexport default createSvgIcon(\n <Path\n d=\"
|
|
1
|
+
{"version":3,"names":["React","Path","createSvgIcon"],"sources":["ChevronRight.tsx"],"sourcesContent":["import React from 'react';\nimport { Path } from 'react-native-svg';\nimport { createSvgIcon } from '../../utils';\n\nexport default createSvgIcon(\n <Path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M8 12C8 12.2652 7.89464 12.5196 7.70711 12.7071L1.70711 18.7071C1.31658 19.0976 0.683417 19.0976 0.292892 18.7071C-0.0976309 18.3166 -0.0976309 17.6834 0.292893 17.2929L5.58579 12L0.292894 6.70711C-0.0976304 6.31658 -0.0976304 5.68342 0.292895 5.29289C0.683418 4.90237 1.31658 4.90237 1.70711 5.29289L7.70711 11.2929C7.89464 11.4804 8 11.7348 8 12Z\"\n />,\n 'ChevronRight',\n '0 0 8 24',\n);\n"],"mappings":"AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,SAASC,IAAT,QAAqB,kBAArB;AACA,SAASC,aAAT,QAA8B,aAA9B;AAEA,eAAeA,aAAa,eACxB,oBAAC,IAAD;EACI,QAAQ,EAAC,SADb;EAEI,QAAQ,EAAC,SAFb;EAGI,CAAC,EAAC;AAHN,EADwB,EAMxB,cANwB,EAOxB,UAPwB,CAA5B"}
|
|
@@ -2,6 +2,8 @@ import React from 'react';
|
|
|
2
2
|
import { Path } from 'react-native-svg';
|
|
3
3
|
import { createSvgIcon } from '../../utils';
|
|
4
4
|
export default createSvgIcon( /*#__PURE__*/React.createElement(Path, {
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
fillRule: "evenodd",
|
|
6
|
+
clipRule: "evenodd",
|
|
7
|
+
d: "M0.292893 5.29289C0.683417 4.90237 1.31658 4.90237 1.70711 5.29289L7 10.5858L12.2929 5.29289C12.6834 4.90237 13.3166 4.90237 13.7071 5.29289C14.0976 5.68342 14.0976 6.31658 13.7071 6.70711L8.41421 12L13.7071 17.2929C14.0976 17.6834 14.0976 18.3166 13.7071 18.7071C13.3166 19.0976 12.6834 19.0976 12.2929 18.7071L7 13.4142L1.70711 18.7071C1.31658 19.0976 0.683417 19.0976 0.292893 18.7071C-0.0976311 18.3166 -0.0976311 17.6834 0.292893 17.2929L5.58579 12L0.292893 6.70711C-0.0976311 6.31658 -0.0976311 5.68342 0.292893 5.29289Z"
|
|
8
|
+
}), 'Close', '0 0 14 24');
|
|
7
9
|
//# sourceMappingURL=Close.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","Path","createSvgIcon"],"sources":["Close.tsx"],"sourcesContent":["import React from 'react';\nimport { Path } from 'react-native-svg';\nimport { createSvgIcon } from '../../utils';\n\nexport default createSvgIcon(\n <Path\n d=\"
|
|
1
|
+
{"version":3,"names":["React","Path","createSvgIcon"],"sources":["Close.tsx"],"sourcesContent":["import React from 'react';\nimport { Path } from 'react-native-svg';\nimport { createSvgIcon } from '../../utils';\n\nexport default createSvgIcon(\n <Path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M0.292893 5.29289C0.683417 4.90237 1.31658 4.90237 1.70711 5.29289L7 10.5858L12.2929 5.29289C12.6834 4.90237 13.3166 4.90237 13.7071 5.29289C14.0976 5.68342 14.0976 6.31658 13.7071 6.70711L8.41421 12L13.7071 17.2929C14.0976 17.6834 14.0976 18.3166 13.7071 18.7071C13.3166 19.0976 12.6834 19.0976 12.2929 18.7071L7 13.4142L1.70711 18.7071C1.31658 19.0976 0.683417 19.0976 0.292893 18.7071C-0.0976311 18.3166 -0.0976311 17.6834 0.292893 17.2929L5.58579 12L0.292893 6.70711C-0.0976311 6.31658 -0.0976311 5.68342 0.292893 5.29289Z\"\n />,\n 'Close',\n '0 0 14 24',\n);\n"],"mappings":"AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,SAASC,IAAT,QAAqB,kBAArB;AACA,SAASC,aAAT,QAA8B,aAA9B;AAEA,eAAeA,aAAa,eACxB,oBAAC,IAAD;EACI,QAAQ,EAAC,SADb;EAEI,QAAQ,EAAC,SAFb;EAGI,CAAC,EAAC;AAHN,EADwB,EAMxB,OANwB,EAOxB,WAPwB,CAA5B"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { default } from './
|
|
1
|
+
export { default } from './ButtonBase';
|
|
2
2
|
export type { default as ButtonBaseProps } from './ButtonBaseProps';
|
|
@@ -1,23 +1,30 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { OverridableComponentProps } from '../types';
|
|
3
3
|
import type { ButtonBaseProps } from '../ButtonBase';
|
|
4
|
+
export declare const chipColors: readonly ["default", "white"];
|
|
5
|
+
export declare type ChipColor = typeof chipColors[number];
|
|
4
6
|
export declare const chipSizes: readonly ["large", "small"];
|
|
5
7
|
export declare type ChipSize = typeof chipSizes[number];
|
|
6
8
|
export declare const chipStartElementVariants: readonly ["default", "avatar", "image", "icon"];
|
|
7
9
|
export declare type ChipStartElementVariant = typeof chipStartElementVariants[number];
|
|
8
10
|
export default interface ChipProps extends OverridableComponentProps<ButtonBaseProps, {
|
|
9
|
-
/**
|
|
10
|
-
* Element placed after the children.
|
|
11
|
-
*/
|
|
12
|
-
endElement?: React.ReactElement;
|
|
13
11
|
/**
|
|
14
12
|
* The content of the component.
|
|
15
13
|
*/
|
|
16
14
|
children: string;
|
|
15
|
+
/**
|
|
16
|
+
* Set backgroundColor of the component.
|
|
17
|
+
* @default 'default'
|
|
18
|
+
*/
|
|
19
|
+
color?: ChipColor;
|
|
17
20
|
/**
|
|
18
21
|
* Number of lines of children.
|
|
19
22
|
*/
|
|
20
23
|
numberOfLines?: number;
|
|
24
|
+
/**
|
|
25
|
+
* If `true`, showing a close icon and applying a highlighted style.
|
|
26
|
+
*/
|
|
27
|
+
selected?: boolean;
|
|
21
28
|
/**
|
|
22
29
|
* Determines size of component.
|
|
23
30
|
* @default 'small'
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import type { TextStyle } from 'react-native';
|
|
2
2
|
import type { FountainUiStyle } from '@fountain-ui/styles';
|
|
3
|
-
import type { ChipSize, ChipStartElementVariant } from './ChipProps';
|
|
3
|
+
import type { ChipColor, ChipSize, ChipStartElementVariant } from './ChipProps';
|
|
4
4
|
interface ChipStyle {
|
|
5
5
|
container: FountainUiStyle;
|
|
6
|
-
|
|
6
|
+
closeButton?: FountainUiStyle;
|
|
7
7
|
label: TextStyle;
|
|
8
8
|
startElement?: FountainUiStyle;
|
|
9
|
+
startElementContainer?: FountainUiStyle;
|
|
9
10
|
}
|
|
10
|
-
export default function useChipStyle(size: ChipSize, startElementVariant: ChipStartElementVariant,
|
|
11
|
+
export default function useChipStyle(size: ChipSize, startElementVariant: ChipStartElementVariant, color: ChipColor, selected: boolean): ChipStyle;
|
|
11
12
|
export {};
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import type { ModalProps } from '../Modal';
|
|
3
3
|
import type { OverridableComponentProps } from '../types';
|
|
4
4
|
import { ANIMATION_TYPE } from '../Modal';
|
|
5
|
-
export declare const dialogSizes: readonly ["small", "medium", "large"];
|
|
5
|
+
export declare const dialogSizes: readonly ["small", "medium", "large", "full"];
|
|
6
6
|
export declare type DialogSize = typeof dialogSizes[number];
|
|
7
7
|
export default interface DialogProps extends OverridableComponentProps<ModalProps, {
|
|
8
8
|
/**
|
|
@@ -14,11 +14,6 @@ export default interface DialogProps extends OverridableComponentProps<ModalProp
|
|
|
14
14
|
* Dialog children, usually the included sub-components.
|
|
15
15
|
*/
|
|
16
16
|
children?: React.ReactNode;
|
|
17
|
-
/**
|
|
18
|
-
* If `true`, the dialog is full-screen.
|
|
19
|
-
* @default false
|
|
20
|
-
*/
|
|
21
|
-
fullScreen?: boolean;
|
|
22
17
|
/**
|
|
23
18
|
* Determines the minWidth of the Dialog.
|
|
24
19
|
* @default 'medium'
|
|
@@ -2,5 +2,5 @@ import type { NamedStylesStringUnion } from '@fountain-ui/styles';
|
|
|
2
2
|
import type { DialogSize } from './DialogProps';
|
|
3
3
|
declare type DialogStyleKeys = 'root' | 'container' | 'paper' | 'topElementContainer' | 'topElementContent';
|
|
4
4
|
declare type DialogStyles = NamedStylesStringUnion<DialogStyleKeys>;
|
|
5
|
-
export default function useDialogStyle(size: DialogSize
|
|
5
|
+
export default function useDialogStyle(size: DialogSize): DialogStyles;
|
|
6
6
|
export {};
|
|
@@ -1,3 +1,10 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
import BackButton from './BackButton';
|
|
3
|
+
import CloseButton from './CloseButton';
|
|
2
4
|
import type DialogTitleProps from './DialogTitleProps';
|
|
3
|
-
|
|
5
|
+
declare const DialogTitle: {
|
|
6
|
+
(props: DialogTitleProps): JSX.Element;
|
|
7
|
+
BackButton: typeof BackButton;
|
|
8
|
+
CloseButton: typeof CloseButton;
|
|
9
|
+
};
|
|
10
|
+
export default DialogTitle;
|
|
@@ -3,7 +3,7 @@ import type { ViewProps } from 'react-native';
|
|
|
3
3
|
import type { OverridableComponentProps } from '../types';
|
|
4
4
|
export declare const dividerElementAligns: readonly ["start", "center", "end"];
|
|
5
5
|
export declare type DividerElementAlign = typeof dividerElementAligns[number];
|
|
6
|
-
export declare const dividerVariants: readonly ["base", "strong"];
|
|
6
|
+
export declare const dividerVariants: readonly ["base", "strong", "baseStatic", "strongStatic"];
|
|
7
7
|
export declare type DividerVariant = typeof dividerVariants[number];
|
|
8
8
|
export default interface DividerProps extends OverridableComponentProps<ViewProps, {
|
|
9
9
|
/**
|
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { ViewProps } from 'react-native';
|
|
3
3
|
import type { OverridableComponentProps } from '../types';
|
|
4
|
+
export declare const paginationColors: readonly ["base", "static"];
|
|
5
|
+
export declare type PaginationColor = typeof paginationColors[number];
|
|
4
6
|
export declare const paginationVariants: readonly ["dot", "number"];
|
|
5
7
|
export declare type PaginationVariant = typeof paginationVariants[number];
|
|
6
8
|
export interface PaginationRenderItemParams {
|
|
9
|
+
/**
|
|
10
|
+
* Set color of dot.
|
|
11
|
+
* @default 'base'
|
|
12
|
+
*/
|
|
13
|
+
color?: PaginationColor;
|
|
7
14
|
/**
|
|
8
15
|
* Index of the pagination item.
|
|
9
16
|
*/
|
|
@@ -27,6 +34,11 @@ export default interface PaginationProps extends OverridableComponentProps<ViewP
|
|
|
27
34
|
* The pagination will be added relative to this node.
|
|
28
35
|
*/
|
|
29
36
|
children?: React.ReactNode;
|
|
37
|
+
/**
|
|
38
|
+
* Set color of dot.
|
|
39
|
+
* @default 'base'
|
|
40
|
+
*/
|
|
41
|
+
color?: PaginationColor;
|
|
30
42
|
/**
|
|
31
43
|
* The total number of pages.
|
|
32
44
|
*/
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { default } from './Pagination';
|
|
2
|
-
export type { default as PaginationProps } from './PaginationProps';
|
|
3
|
-
export { paginationVariants } from './PaginationProps';
|
|
2
|
+
export type { default as PaginationProps, PaginationColor, PaginationVariant } from './PaginationProps';
|
|
3
|
+
export { paginationColors, paginationVariants } from './PaginationProps';
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import type { ViewProps } from 'react-native';
|
|
2
2
|
import type { OverridableComponentProps } from '../types';
|
|
3
|
+
import { PaginationColor } from '../Pagination';
|
|
3
4
|
export default interface PaginationItemProps extends OverridableComponentProps<ViewProps, {
|
|
5
|
+
/**
|
|
6
|
+
* Set color of dot.
|
|
7
|
+
* @default 'base'
|
|
8
|
+
*/
|
|
9
|
+
color?: PaginationColor;
|
|
4
10
|
/**
|
|
5
11
|
* If `true`, the pagination item is disabled.
|
|
6
12
|
* @default false
|
|
@@ -1,3 +1,8 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
import BackButton from './BackButton';
|
|
2
3
|
import type ToolbarProps from './ToolbarProps';
|
|
3
|
-
|
|
4
|
+
declare const Toolbar: {
|
|
5
|
+
(props: ToolbarProps): JSX.Element;
|
|
6
|
+
BackButton: typeof BackButton;
|
|
7
|
+
};
|
|
8
|
+
export default Toolbar;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fountain-ui/core",
|
|
3
|
-
"version": "3.0.0-alpha.
|
|
3
|
+
"version": "3.0.0-alpha.11",
|
|
4
4
|
"author": "Fountain-UI Team",
|
|
5
5
|
"description": "React components that implement Tappytoon's Fountain Design.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -67,5 +67,5 @@
|
|
|
67
67
|
"publishConfig": {
|
|
68
68
|
"access": "public"
|
|
69
69
|
},
|
|
70
|
-
"gitHead": "
|
|
70
|
+
"gitHead": "3261dc43532e6f39bbddce1a59eddd677d84dc3c"
|
|
71
71
|
}
|
package/src/AppBar/AppBar.tsx
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { View } from 'react-native';
|
|
3
3
|
import { NamedStylesStringUnion, UseStyles } from '@fountain-ui/styles';
|
|
4
|
+
import { useBreakpointUp } from '../hooks';
|
|
4
5
|
import { css, useTheme } from '../styles';
|
|
5
6
|
import type AppBarProps from './AppBarProps';
|
|
6
7
|
import type { AppBarColor } from './AppBarProps';
|
|
@@ -31,6 +32,8 @@ const AppBar = React.forwardRef<View, AppBarProps>(function AppBar(props, ref) {
|
|
|
31
32
|
|
|
32
33
|
const theme = useTheme();
|
|
33
34
|
|
|
35
|
+
const isDesktop = useBreakpointUp('md', true, false);
|
|
36
|
+
|
|
34
37
|
const styles = useStyles();
|
|
35
38
|
|
|
36
39
|
const backgroundColorMap: Record<AppBarColor, string> = {
|
|
@@ -41,6 +44,7 @@ const AppBar = React.forwardRef<View, AppBarProps>(function AppBar(props, ref) {
|
|
|
41
44
|
const paperStyle = css([
|
|
42
45
|
styles.root,
|
|
43
46
|
{ backgroundColor: backgroundColorMap[color] },
|
|
47
|
+
isDesktop ? { paddingHorizontal: 8 } : undefined,
|
|
44
48
|
style,
|
|
45
49
|
]);
|
|
46
50
|
|
package/src/ButtonBase/index.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { default } from './
|
|
1
|
+
export { default } from './ButtonBase';
|
|
2
2
|
export type { default as ButtonBaseProps } from './ButtonBaseProps';
|
package/src/Chip/Chip.tsx
CHANGED
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Text, View } from 'react-native';
|
|
3
|
+
import ButtonBase from '../ButtonBase';
|
|
4
|
+
import { Close } from '../internal';
|
|
3
5
|
import { css } from '../styles';
|
|
4
6
|
import { cloneElementSafely } from '../utils';
|
|
5
|
-
import ButtonBase from '../ButtonBase/ButtonBase';
|
|
6
7
|
import type ChipProps from './ChipProps';
|
|
7
|
-
import type { ChipSize } from './ChipProps';
|
|
8
|
+
import type { ChipColor, ChipSize } from './ChipProps';
|
|
8
9
|
import useChipStyle from './useChipStyle';
|
|
9
10
|
|
|
10
11
|
export default function Chip(props: ChipProps) {
|
|
11
12
|
const {
|
|
12
13
|
children,
|
|
13
|
-
|
|
14
|
+
color = 'default' as ChipColor,
|
|
14
15
|
numberOfLines,
|
|
15
16
|
onPress,
|
|
17
|
+
selected = false,
|
|
16
18
|
size = 'small' as ChipSize,
|
|
17
19
|
startElement: startElementProp,
|
|
18
20
|
startElementVariant = 'default',
|
|
@@ -22,26 +24,26 @@ export default function Chip(props: ChipProps) {
|
|
|
22
24
|
|
|
23
25
|
const {
|
|
24
26
|
container: containerStyle,
|
|
25
|
-
|
|
27
|
+
closeButton: closeButtonStyle,
|
|
26
28
|
label: labelStyle,
|
|
27
29
|
startElement: startElementStyle,
|
|
28
|
-
|
|
30
|
+
startElementContainer: startElementContainerStyle,
|
|
31
|
+
} = useChipStyle(size, startElementVariant, color, selected);
|
|
29
32
|
|
|
30
33
|
const chipStyle = css([
|
|
31
34
|
containerStyle,
|
|
32
35
|
styleProp,
|
|
33
36
|
]);
|
|
34
37
|
|
|
35
|
-
const startElement =
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
) : cloneElementSafely(startElementProp, { style: startElementStyle });
|
|
41
|
-
const endElement = cloneElementSafely(endElementProp, { style: endElementStyle });
|
|
38
|
+
const startElement = (
|
|
39
|
+
<View style={startElementContainerStyle}>
|
|
40
|
+
{cloneElementSafely(startElementProp, { style: startElementStyle })}
|
|
41
|
+
</View>
|
|
42
|
+
);
|
|
42
43
|
|
|
43
44
|
return (
|
|
44
45
|
<ButtonBase
|
|
46
|
+
disabled={!onPress}
|
|
45
47
|
onPress={onPress}
|
|
46
48
|
style={chipStyle}
|
|
47
49
|
{...otherProps}
|
|
@@ -54,7 +56,12 @@ export default function Chip(props: ChipProps) {
|
|
|
54
56
|
style={labelStyle}
|
|
55
57
|
/>
|
|
56
58
|
|
|
57
|
-
{
|
|
59
|
+
{selected ? (
|
|
60
|
+
<Close
|
|
61
|
+
color={'baseInverse'}
|
|
62
|
+
style={closeButtonStyle}
|
|
63
|
+
/>
|
|
64
|
+
) : null}
|
|
58
65
|
</ButtonBase>
|
|
59
66
|
);
|
|
60
67
|
}
|
package/src/Chip/ChipProps.ts
CHANGED
|
@@ -2,6 +2,9 @@ import React from 'react';
|
|
|
2
2
|
import { OverridableComponentProps } from '../types';
|
|
3
3
|
import type { ButtonBaseProps } from '../ButtonBase';
|
|
4
4
|
|
|
5
|
+
export const chipColors = ['default', 'white'] as const;
|
|
6
|
+
export type ChipColor = typeof chipColors[number];
|
|
7
|
+
|
|
5
8
|
export const chipSizes = ['large', 'small'] as const;
|
|
6
9
|
export type ChipSize = typeof chipSizes[number];
|
|
7
10
|
|
|
@@ -10,20 +13,26 @@ export type ChipStartElementVariant = typeof chipStartElementVariants[number];
|
|
|
10
13
|
|
|
11
14
|
export default interface ChipProps extends OverridableComponentProps<ButtonBaseProps, {
|
|
12
15
|
/**
|
|
13
|
-
*
|
|
16
|
+
* The content of the component.
|
|
14
17
|
*/
|
|
15
|
-
|
|
18
|
+
children: string;
|
|
16
19
|
|
|
17
20
|
/**
|
|
18
|
-
*
|
|
21
|
+
* Set backgroundColor of the component.
|
|
22
|
+
* @default 'default'
|
|
19
23
|
*/
|
|
20
|
-
|
|
24
|
+
color?: ChipColor;
|
|
21
25
|
|
|
22
26
|
/**
|
|
23
27
|
* Number of lines of children.
|
|
24
28
|
*/
|
|
25
29
|
numberOfLines?: number;
|
|
26
30
|
|
|
31
|
+
/**
|
|
32
|
+
* If `true`, showing a close icon and applying a highlighted style.
|
|
33
|
+
*/
|
|
34
|
+
selected?: boolean;
|
|
35
|
+
|
|
27
36
|
/**
|
|
28
37
|
* Determines size of component.
|
|
29
38
|
* @default 'small'
|
package/src/Chip/index.ts
CHANGED