@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.
Files changed (175) hide show
  1. package/build/commonjs/AppBar/AppBar.js +6 -1
  2. package/build/commonjs/AppBar/AppBar.js.map +1 -1
  3. package/build/commonjs/Badge/Badge.js +4 -3
  4. package/build/commonjs/Badge/Badge.js.map +1 -1
  5. package/build/commonjs/Badge/BadgeProps.js.map +1 -1
  6. package/build/commonjs/ButtonBase/index.js +2 -2
  7. package/build/commonjs/ButtonBase/index.js.map +1 -1
  8. package/build/commonjs/Chip/Chip.js +21 -14
  9. package/build/commonjs/Chip/Chip.js.map +1 -1
  10. package/build/commonjs/Chip/ChipProps.js +3 -1
  11. package/build/commonjs/Chip/ChipProps.js.map +1 -1
  12. package/build/commonjs/Chip/index.js +6 -0
  13. package/build/commonjs/Chip/index.js.map +1 -1
  14. package/build/commonjs/Chip/useChipStyle.js +29 -19
  15. package/build/commonjs/Chip/useChipStyle.js.map +1 -1
  16. package/build/commonjs/Dialog/Dialog.js +7 -8
  17. package/build/commonjs/Dialog/Dialog.js.map +1 -1
  18. package/build/commonjs/Dialog/DialogProps.js +1 -1
  19. package/build/commonjs/Dialog/DialogProps.js.map +1 -1
  20. package/build/commonjs/Dialog/useDialogSectionStyle.js +6 -4
  21. package/build/commonjs/Dialog/useDialogSectionStyle.js.map +1 -1
  22. package/build/commonjs/Dialog/useDialogStyle.js +9 -8
  23. package/build/commonjs/Dialog/useDialogStyle.js.map +1 -1
  24. package/build/commonjs/DialogTitle/DialogLargeTitle.js +80 -0
  25. package/build/commonjs/DialogTitle/DialogLargeTitle.js.map +1 -0
  26. package/build/commonjs/DialogTitle/DialogTitle.js +8 -4
  27. package/build/commonjs/DialogTitle/DialogTitle.js.map +1 -1
  28. package/build/commonjs/Divider/Divider.js +17 -9
  29. package/build/commonjs/Divider/Divider.js.map +1 -1
  30. package/build/commonjs/Divider/DividerProps.js +1 -1
  31. package/build/commonjs/Divider/DividerProps.js.map +1 -1
  32. package/build/commonjs/ListItem/ListItem.js +3 -13
  33. package/build/commonjs/ListItem/ListItem.js.map +1 -1
  34. package/build/commonjs/Pagination/Pagination.js +2 -0
  35. package/build/commonjs/Pagination/Pagination.js.map +1 -1
  36. package/build/commonjs/Pagination/PaginationProps.js +3 -1
  37. package/build/commonjs/Pagination/PaginationProps.js.map +1 -1
  38. package/build/commonjs/Pagination/index.js +6 -0
  39. package/build/commonjs/Pagination/index.js.map +1 -1
  40. package/build/commonjs/PaginationItem/PaginationItem.js +32 -22
  41. package/build/commonjs/PaginationItem/PaginationItem.js.map +1 -1
  42. package/build/commonjs/PaginationItem/PaginationItemProps.js.map +1 -1
  43. package/build/commonjs/Tab/Tab.js +11 -3
  44. package/build/commonjs/Tab/Tab.js.map +1 -1
  45. package/build/commonjs/Tabs/useTabsStyle.js +7 -4
  46. package/build/commonjs/Tabs/useTabsStyle.js.map +1 -1
  47. package/build/commonjs/Toolbar/BackButton/BackButton.js +47 -0
  48. package/build/commonjs/Toolbar/BackButton/BackButton.js.map +1 -0
  49. package/build/commonjs/Toolbar/BackButton/BackButtonProps.js +2 -0
  50. package/build/commonjs/Toolbar/BackButton/BackButtonProps.js.map +1 -0
  51. package/build/commonjs/Toolbar/BackButton/index.js +16 -0
  52. package/build/commonjs/Toolbar/BackButton/index.js.map +1 -0
  53. package/build/commonjs/Toolbar/Toolbar.js +8 -4
  54. package/build/commonjs/Toolbar/Toolbar.js.map +1 -1
  55. package/build/commonjs/internal/icons/ChevronLeft.js +4 -2
  56. package/build/commonjs/internal/icons/ChevronLeft.js.map +1 -1
  57. package/build/commonjs/internal/icons/ChevronRight.js +4 -2
  58. package/build/commonjs/internal/icons/ChevronRight.js.map +1 -1
  59. package/build/commonjs/internal/icons/Close.js +4 -2
  60. package/build/commonjs/internal/icons/Close.js.map +1 -1
  61. package/build/module/AppBar/AppBar.js +5 -1
  62. package/build/module/AppBar/AppBar.js.map +1 -1
  63. package/build/module/Badge/Badge.js +4 -3
  64. package/build/module/Badge/Badge.js.map +1 -1
  65. package/build/module/Badge/BadgeProps.js.map +1 -1
  66. package/build/module/ButtonBase/index.js +1 -1
  67. package/build/module/ButtonBase/index.js.map +1 -1
  68. package/build/module/Chip/Chip.js +17 -13
  69. package/build/module/Chip/Chip.js.map +1 -1
  70. package/build/module/Chip/ChipProps.js +1 -0
  71. package/build/module/Chip/ChipProps.js.map +1 -1
  72. package/build/module/Chip/index.js +1 -1
  73. package/build/module/Chip/index.js.map +1 -1
  74. package/build/module/Chip/useChipStyle.js +29 -19
  75. package/build/module/Chip/useChipStyle.js.map +1 -1
  76. package/build/module/Dialog/Dialog.js +7 -8
  77. package/build/module/Dialog/Dialog.js.map +1 -1
  78. package/build/module/Dialog/DialogProps.js +1 -1
  79. package/build/module/Dialog/DialogProps.js.map +1 -1
  80. package/build/module/Dialog/useDialogSectionStyle.js +6 -4
  81. package/build/module/Dialog/useDialogSectionStyle.js.map +1 -1
  82. package/build/module/Dialog/useDialogStyle.js +9 -8
  83. package/build/module/Dialog/useDialogStyle.js.map +1 -1
  84. package/build/module/DialogTitle/DialogLargeTitle.js +65 -0
  85. package/build/module/DialogTitle/DialogLargeTitle.js.map +1 -0
  86. package/build/module/DialogTitle/DialogTitle.js +6 -3
  87. package/build/module/DialogTitle/DialogTitle.js.map +1 -1
  88. package/build/module/Divider/Divider.js +7 -0
  89. package/build/module/Divider/Divider.js.map +1 -1
  90. package/build/module/Divider/DividerProps.js +1 -1
  91. package/build/module/Divider/DividerProps.js.map +1 -1
  92. package/build/module/ListItem/ListItem.js +3 -13
  93. package/build/module/ListItem/ListItem.js.map +1 -1
  94. package/build/module/Pagination/Pagination.js +2 -0
  95. package/build/module/Pagination/Pagination.js.map +1 -1
  96. package/build/module/Pagination/PaginationProps.js +1 -0
  97. package/build/module/Pagination/PaginationProps.js.map +1 -1
  98. package/build/module/Pagination/index.js +1 -1
  99. package/build/module/Pagination/index.js.map +1 -1
  100. package/build/module/PaginationItem/PaginationItem.js +28 -21
  101. package/build/module/PaginationItem/PaginationItem.js.map +1 -1
  102. package/build/module/PaginationItem/PaginationItemProps.js.map +1 -1
  103. package/build/module/Tab/Tab.js +11 -3
  104. package/build/module/Tab/Tab.js.map +1 -1
  105. package/build/module/Tabs/useTabsStyle.js +6 -4
  106. package/build/module/Tabs/useTabsStyle.js.map +1 -1
  107. package/build/module/Toolbar/BackButton/BackButton.js +32 -0
  108. package/build/module/Toolbar/BackButton/BackButton.js.map +1 -0
  109. package/build/module/Toolbar/BackButton/BackButtonProps.js +2 -0
  110. package/build/module/Toolbar/BackButton/BackButtonProps.js.map +1 -0
  111. package/build/module/Toolbar/BackButton/index.js +2 -0
  112. package/build/module/Toolbar/BackButton/index.js.map +1 -0
  113. package/build/module/Toolbar/Toolbar.js +7 -3
  114. package/build/module/Toolbar/Toolbar.js.map +1 -1
  115. package/build/module/internal/icons/ChevronLeft.js +4 -2
  116. package/build/module/internal/icons/ChevronLeft.js.map +1 -1
  117. package/build/module/internal/icons/ChevronRight.js +4 -2
  118. package/build/module/internal/icons/ChevronRight.js.map +1 -1
  119. package/build/module/internal/icons/Close.js +4 -2
  120. package/build/module/internal/icons/Close.js.map +1 -1
  121. package/build/typescript/Badge/BadgeProps.d.ts +10 -5
  122. package/build/typescript/ButtonBase/index.d.ts +1 -1
  123. package/build/typescript/Chip/ChipProps.d.ts +11 -4
  124. package/build/typescript/Chip/index.d.ts +1 -1
  125. package/build/typescript/Chip/useChipStyle.d.ts +4 -3
  126. package/build/typescript/Dialog/DialogProps.d.ts +1 -6
  127. package/build/typescript/Dialog/useDialogStyle.d.ts +1 -1
  128. package/build/typescript/DialogTitle/DialogLargeTitle.d.ts +9 -0
  129. package/build/typescript/DialogTitle/DialogTitle.d.ts +6 -1
  130. package/build/typescript/Divider/DividerProps.d.ts +1 -1
  131. package/build/typescript/Pagination/PaginationProps.d.ts +12 -0
  132. package/build/typescript/Pagination/index.d.ts +2 -2
  133. package/build/typescript/PaginationItem/PaginationItemProps.d.ts +6 -0
  134. package/build/typescript/Toolbar/BackButton/BackButton.d.ts +3 -0
  135. package/build/typescript/Toolbar/BackButton/BackButtonProps.d.ts +4 -0
  136. package/build/typescript/Toolbar/BackButton/index.d.ts +2 -0
  137. package/build/typescript/Toolbar/Toolbar.d.ts +6 -1
  138. package/package.json +3 -3
  139. package/src/AppBar/AppBar.tsx +4 -0
  140. package/src/Badge/Badge.tsx +4 -3
  141. package/src/Badge/BadgeProps.ts +12 -6
  142. package/src/ButtonBase/index.ts +1 -1
  143. package/src/Chip/Chip.tsx +20 -13
  144. package/src/Chip/ChipProps.ts +13 -4
  145. package/src/Chip/index.ts +1 -1
  146. package/src/Chip/useChipStyle.ts +34 -17
  147. package/src/Dialog/Dialog.tsx +7 -8
  148. package/src/Dialog/DialogProps.ts +1 -7
  149. package/src/Dialog/useDialogSectionStyle.ts +6 -4
  150. package/src/Dialog/useDialogStyle.ts +9 -7
  151. package/src/DialogTitle/DialogLargeTitle.tsx +95 -0
  152. package/src/DialogTitle/DialogTitle.tsx +6 -1
  153. package/src/Divider/Divider.tsx +5 -0
  154. package/src/Divider/DividerProps.ts +1 -1
  155. package/src/ListItem/ListItem.tsx +3 -13
  156. package/src/Pagination/Pagination.tsx +3 -2
  157. package/src/Pagination/PaginationProps.ts +15 -0
  158. package/src/Pagination/index.ts +2 -2
  159. package/src/PaginationItem/PaginationItem.tsx +31 -24
  160. package/src/PaginationItem/PaginationItemProps.ts +7 -0
  161. package/src/Tab/Tab.tsx +20 -6
  162. package/src/Tabs/useTabsStyle.ts +7 -4
  163. package/src/Toolbar/BackButton/BackButton.tsx +42 -0
  164. package/src/Toolbar/BackButton/BackButtonProps.ts +4 -0
  165. package/src/Toolbar/BackButton/index.ts +2 -0
  166. package/src/Toolbar/Toolbar.tsx +6 -1
  167. package/src/internal/icons/ChevronLeft.tsx +4 -1
  168. package/src/internal/icons/ChevronRight.tsx +4 -1
  169. package/src/internal/icons/Close.tsx +4 -1
  170. package/build/commonjs/ButtonBase/LegacyButtonBase.js +0 -126
  171. package/build/commonjs/ButtonBase/LegacyButtonBase.js.map +0 -1
  172. package/build/module/ButtonBase/LegacyButtonBase.js +0 -106
  173. package/build/module/ButtonBase/LegacyButtonBase.js.map +0 -1
  174. package/build/typescript/ButtonBase/LegacyButtonBase.d.ts +0 -5
  175. 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
- }, style]);
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,GAAGjB,SAAS,EAAxB;EAEA,MAAMkB,kBAA+C,GAAG;IACpDC,OAAO,EAAElB,KAAK,CAACmB,OAAN,CAAcC,UAAd,CAAyBF,OADkB;IAEpDG,GAAG,EAAErB,KAAK,CAACmB,OAAN,CAAcC,UAAd,CAAyBC;EAFsB,CAAxD;EAKA,MAAMC,UAAU,GAAG,IAAAC,WAAA,EAAI,CACnBP,MAAM,CAACd,IADY,EAEnB;IAAEsB,eAAe,EAAEP,kBAAkB,CAACJ,KAAD;EAArC,CAFmB,EAGnBC,KAHmB,CAAJ,CAAnB;EAMA,oBACI,6BAAC,iBAAD;IACI,GAAG,EAAEF,GADT;IAEI,KAAK,EAAEU;EAFX,GAGQP,UAHR,EADJ;AAOH,CA7Bc,CAAf;;eA+BeP,M"}
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]: offset,
45
- [position.horizontal]: offset
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","offset","variant","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 invisible = false,\n position = defaultPosition,\n size = 'medium' as BadgeSize,\n style: styleProp,\n offset = 0,\n variant = 'dot' as BadgeVariant,\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]: offset,\n [position.horizontal]: offset,\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,SAAS,GAAG,KAJV;IAKFC,QAAQ,GAAGT,eALT;IAMFU,IAAI,GAAG,QANL;IAOFC,KAAK,EAAEC,SAPL;IAQFC,MAAM,GAAG,CARP;IASFC,OAAO,GAAG,KATR;IAUF,GAAGC;EAVD,IAWFX,KAXJ;EAaA,MAAM;IACFY,KAAK,EAAEC,cADL;IAEFC,WAAW,EAAEC;EAFX,IAGF,IAAAC,2BAAA,EAAmBN,OAAnB,EAA4BJ,IAA5B,EAAkCJ,KAAlC,CAHJ;EAKA,MAAMe,SAAS,GAAG,IAAAC,WAAA,EAAI,CAClBV,SADkB,CAAJ,CAAlB;EAIA,MAAMW,UAAU,GAAG,IAAAD,WAAA,EAAI,CACnBL,cADmB,EAEnB;IACI,CAACR,QAAQ,CAACR,QAAV,GAAqBY,MADzB;IAEI,CAACJ,QAAQ,CAACP,UAAV,GAAuBW;EAF3B,CAFmB,CAAJ,CAAnB;EAQA,oBACI,6BAAC,iBAAD;IACI,KAAK,EAAEQ;EADX,GAEQN,UAFR,GAIKV,QAJL,EAMK,CAACG,SAAD,gBACG,6BAAC,iBAAD;IAAM,KAAK,EAAEe;EAAb,GACKhB,OAAO,KAAKiB,SAAZ,IAAyBjB,OAAO,KAAK,IAArC,gBACG,6BAAC,iBAAD;IAAM,KAAK,EAAEY;EAAb,GAAgCZ,OAAhC,CADH,GAEG,IAHR,CADH,GAMG,IAZR,CADJ;AAgBH;;AAAA"}
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 * The offset of the badge.\n * @default 0\n */\n offset?: number;\n\n /**\n *\n */\n size?: BadgeSize;\n\n /**\n *\n * @default 'dot'\n */\n variant?: BadgeVariant;\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"}
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 _LegacyButtonBase.default;
9
+ return _ButtonBase.default;
10
10
  }
11
11
  });
12
12
 
13
- var _LegacyButtonBase = _interopRequireDefault(require("./LegacyButtonBase"));
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 './LegacyButtonBase';\nexport type { default as ButtonBaseProps } from './ButtonBaseProps';\n"],"mappings":";;;;;;;;;;;;AAAA"}
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
- endElement: endElementProp,
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
- endElement: endElementStyle,
41
+ closeButton: closeButtonStyle,
39
42
  label: labelStyle,
40
- startElement: startElementStyle
41
- } = (0, _useChipStyle.default)(size, startElementVariant, !!endElementProp);
43
+ startElement: startElementStyle,
44
+ startElementContainer: startElementContainerStyle
45
+ } = (0, _useChipStyle.default)(size, startElementVariant, color, selected);
42
46
  const chipStyle = (0, _styles.css)([containerStyle, styleProp]);
43
- const startElement = startElementVariant === 'icon' ? /*#__PURE__*/_react.default.createElement(_reactNative.View, {
44
- style: startElementStyle
45
- }, (0, _utils.cloneElementSafely)(startElementProp)) : (0, _utils.cloneElementSafely)(startElementProp, {
47
+
48
+ const startElement = /*#__PURE__*/_react.default.createElement(_reactNative.View, {
49
+ style: startElementContainerStyle
50
+ }, (0, _utils.cloneElementSafely)(startElementProp, {
46
51
  style: startElementStyle
47
- });
48
- const endElement = (0, _utils.cloneElementSafely)(endElementProp, {
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
- }), endElement);
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","endElement","endElementProp","numberOfLines","onPress","size","startElement","startElementProp","startElementVariant","style","styleProp","otherProps","container","containerStyle","endElementStyle","label","labelStyle","startElementStyle","useChipStyle","chipStyle","css","cloneElementSafely"],"sources":["Chip.tsx"],"sourcesContent":["import React from 'react';\nimport { Text, View } from 'react-native';\nimport { css } from '../styles';\nimport { cloneElementSafely } from '../utils';\nimport ButtonBase from '../ButtonBase/ButtonBase';\nimport type ChipProps from './ChipProps';\nimport type { ChipSize } from './ChipProps';\nimport useChipStyle from './useChipStyle';\n\nexport default function Chip(props: ChipProps) {\n const {\n children,\n endElement: endElementProp,\n numberOfLines,\n onPress,\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 endElement: endElementStyle,\n label: labelStyle,\n startElement: startElementStyle,\n } = useChipStyle(size, startElementVariant, !!endElementProp);\n\n const chipStyle = css([\n containerStyle,\n styleProp,\n ]);\n\n const startElement = startElementVariant === 'icon'\n ? (\n <View style={startElementStyle}>\n {cloneElementSafely(startElementProp)}\n </View>\n ) : cloneElementSafely(startElementProp, { style: startElementStyle });\n const endElement = cloneElementSafely(endElementProp, { style: endElementStyle });\n\n return (\n <ButtonBase\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 {endElement}\n </ButtonBase>\n );\n}\n"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AAGA;;;;;;AAEe,SAASA,IAAT,CAAcC,KAAd,EAAgC;EAC3C,MAAM;IACFC,QADE;IAEFC,UAAU,EAAEC,cAFV;IAGFC,aAHE;IAIFC,OAJE;IAKFC,IAAI,GAAG,OALL;IAMFC,YAAY,EAAEC,gBANZ;IAOFC,mBAAmB,GAAG,SAPpB;IAQFC,KAAK,EAAEC,SARL;IASF,GAAGC;EATD,IAUFZ,KAVJ;EAYA,MAAM;IACFa,SAAS,EAAEC,cADT;IAEFZ,UAAU,EAAEa,eAFV;IAGFC,KAAK,EAAEC,UAHL;IAIFV,YAAY,EAAEW;EAJZ,IAKF,IAAAC,qBAAA,EAAab,IAAb,EAAmBG,mBAAnB,EAAwC,CAAC,CAACN,cAA1C,CALJ;EAOA,MAAMiB,SAAS,GAAG,IAAAC,WAAA,EAAI,CAClBP,cADkB,EAElBH,SAFkB,CAAJ,CAAlB;EAKA,MAAMJ,YAAY,GAAGE,mBAAmB,KAAK,MAAxB,gBAEb,6BAAC,iBAAD;IAAM,KAAK,EAAES;EAAb,GACK,IAAAI,yBAAA,EAAmBd,gBAAnB,CADL,CAFa,GAKb,IAAAc,yBAAA,EAAmBd,gBAAnB,EAAqC;IAAEE,KAAK,EAAEQ;EAAT,CAArC,CALR;EAMA,MAAMhB,UAAU,GAAG,IAAAoB,yBAAA,EAAmBnB,cAAnB,EAAmC;IAAEO,KAAK,EAAEK;EAAT,CAAnC,CAAnB;EAEA,oBACI,6BAAC,mBAAD;IACI,OAAO,EAAEV,OADb;IAEI,KAAK,EAAEe;EAFX,GAGQR,UAHR,GAKKL,YALL,eAOI,6BAAC,iBAAD;IACI,QAAQ,EAAEN,QADd;IAEI,aAAa,EAAEG,aAFnB;IAGI,KAAK,EAAEa;EAHX,EAPJ,EAaKf,UAbL,CADJ;AAiBH"}
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 * Element placed after the children.\n */\n endElement?: React.ReactElement;\n\n /**\n * The content of the component.\n */\n children: string;\n\n /**\n * Number of lines of children.\n */\n numberOfLines?: number;\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,SAAS,GAAG,CAAC,OAAD,EAAU,OAAV,CAAlB;;AAGA,MAAMC,wBAAwB,GAAG,CAAC,SAAD,EAAY,QAAZ,EAAsB,OAAtB,EAA+B,MAA/B,CAAjC"}
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":";;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AAEA"}
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, isEndElement) {
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 endElementStyleMap = {
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: 16,
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 ? 24 : 22,
58
- marginRight: theme.spacing(isLarge ? 1.5 : 1.25),
59
- width: isLarge ? 24 : 22
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 ? 22 : 20,
77
+ height: isLarge ? 24 : 21,
71
78
  justifyContent: 'center',
72
79
  marginRight: theme.spacing(isLarge ? 1 : 0.75),
73
- width: isLarge ? 22 : 20
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 ? 34 : 30,
84
- marginRight: theme.spacing(1.5),
85
- width: isLarge ? 45 : 40
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
- ...(isEndElement ? {
108
+ ...(selected ? {
100
109
  paddingRight: theme.spacing(isLarge ? 2.5 : 2.25)
101
110
  } : {})
102
111
  },
103
- endElement: endElementStyleMap[size],
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","isEndElement","theme","useTheme","useMemo","fontStyleMap","small","createFontStyle","selector","typography","caption1","medium","color","palette","text","strong","large","body2","endElementStyleMap","height","marginLeft","spacing","width","baseContainerStyle","alignItems","backgroundColor","fill","weaker","borderRadius","shape","radius","full","flexDirection","overflow","isLarge","variantStyleMap","avatar","container","paddingLeft","paddingRight","paddingVertical","startElement","marginRight","icon","justifyContent","image","default","paddingBottom","paddingHorizontal","paddingTop","endElement","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 { ChipSize, ChipStartElementVariant } from './ChipProps';\n\ninterface ChipStyle {\n container: FountainUiStyle;\n endElement?: FountainUiStyle;\n label: TextStyle;\n startElement?: 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 isEndElement: 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: theme.palette.text.strong,\n }),\n large: createFontStyle(theme, {\n selector: (typography) => typography.body2.medium,\n color: theme.palette.text.strong,\n }),\n };\n\n const endElementStyleMap: Record<ChipSize, FountainUiStyle> = {\n small: {\n height: 14,\n marginLeft: theme.spacing(2),\n width: 8.17,\n },\n large: {\n height: 16,\n marginLeft: theme.spacing(2.5),\n width: 9,\n },\n };\n\n const baseContainerStyle: FountainUiStyle = {\n alignItems: 'center',\n backgroundColor: 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 ? 24 : 22,\n marginRight: theme.spacing(isLarge ? 1.5 : 1.25),\n width: isLarge ? 24 : 22,\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 alignItems: 'center',\n height: isLarge ? 22 : 20,\n justifyContent: 'center',\n marginRight: theme.spacing(isLarge ? 1 : 0.75),\n width: isLarge ? 22 : 20,\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 ? 34 : 30,\n marginRight: theme.spacing(1.5),\n width: isLarge ? 45 : 40,\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 ...(isEndElement ? { paddingRight: theme.spacing(isLarge ? 2.5 : 2.25) } : {}),\n },\n endElement: endElementStyleMap[size],\n label: fontStyleMap[size],\n startElement: variantStyleMap[startElementVariant]?.startElement,\n };\n }, [theme, size, startElementVariant]);\n}\n"],"mappings":";;;;;;;AAAA;;AAGA;;AAYA;AACe,SAASA,YAAT,CACXC,IADW,EAEXC,mBAFW,EAGXC,YAHW,EAIF;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;QAE1BC,KAAK,EAAEV,KAAK,CAACW,OAAN,CAAcC,IAAd,CAAmBC;MAFA,CAAvB,CADuC;MAK9CC,KAAK,EAAE,IAAAT,uBAAA,EAAgBL,KAAhB,EAAuB;QAC1BM,QAAQ,EAAGC,UAAD,IAAgBA,UAAU,CAACQ,KAAX,CAAiBN,MADjB;QAE1BC,KAAK,EAAEV,KAAK,CAACW,OAAN,CAAcC,IAAd,CAAmBC;MAFA,CAAvB;IALuC,CAAlD;IAWA,MAAMG,kBAAqD,GAAG;MAC1DZ,KAAK,EAAE;QACHa,MAAM,EAAE,EADL;QAEHC,UAAU,EAAElB,KAAK,CAACmB,OA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pC,YAAY,GAAG;UAAEsC,YAAY,EAAErC,KAAK,CAACmB,OAAN,CAAca,OAAO,GAAG,GAAH,GAAS,IAA9B;QAAhB,CAAH,GAA2D,EAA3E;MAHO,CADR;MAMHgB,UAAU,EAAEhC,kBAAkB,CAACnB,IAAD,CAN3B;MAOHoD,KAAK,EAAE9C,YAAY,CAACN,IAAD,CAPhB;MAQH0C,YAAY,4BAAEN,eAAe,CAACnC,mBAAD,CAAjB,2DAAE,uBAAsCyC;IARjD,CAAP;EAUH,CA9FM,EA8FJ,CAACvC,KAAD,EAAQH,IAAR,EAAcC,mBAAd,CA9FI,CAAP;AA+FH"}
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,CAA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
  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, fullScreen);
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 && !fullScreen) {
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, fullScreen, screenHeight]);
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 && !fullScreen) {
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, fullScreen]);
116
- const initialOpacity = animationType === _Modal.ANIMATION_TYPE.SLIDE && fullScreen ? 1 : undefined;
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: fullScreen ? undefined : styles.topElementContainer
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","fullScreen","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 fullScreen = false,\n hideBackdrop,\n onClose,\n style: styleProp,\n size = 'medium',\n visible,\n topElement,\n ...otherProps\n } = props;\n\n const styles = useDialogStyle(size, fullScreen);\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 && !fullScreen) {\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, fullScreen, 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 && !fullScreen) {\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, fullScreen]);\n\n const initialOpacity = animationType === ANIMATION_TYPE.SLIDE && fullScreen ? 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={fullScreen ? undefined : 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,UAAU,GAAG,KAHX;IAIFC,YAJE;IAKFC,OALE;IAMFC,KAAK,EAAEC,SANL;IAOFC,IAAI,GAAG,QAPL;IAQFC,OARE;IASFC,UATE;IAUF,GAAGC;EAVD,IAWFb,KAXJ;EAaA,MAAMc,MAAM,GAAG,IAAAC,uBAAA,EAAeL,IAAf,EAAqBL,UAArB,CAAf;EAEA,MAAM;IAAEW,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,GAAGrB,k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KV,UAJL,CADJ,CADO,GASP,IAVR,eAYI,6BAAC,mBAAD;IACI,OAAO,EAAE,GADb;IAEI,KAAK,EAAE0B;EAFX,GAIKlC,QAJL,CAZJ,CAbJ,CADJ;AAmCH;;AAAA"}
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"],"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nC,aAAa,KAAKC,qBAAA,CAAe4B,IAAjC,GAAwC,CAAxC,GAA4CK,SAAtE;EAEA,MAAME,UAAU,GAAG,IAAAC,WAAA,EAAI,CACnBzB,MAAM,CAAC0B,KADY,EAEnB/B,SAFmB,CAAJ,CAAnB;EAKA,oBACI,6BAAC,cAAD;IACI,cAAc,EAAEK,MAAM,CAAC2B,SAD3B;IAEI,cAAc,EAAEX,cAFpB;IAGI,YAAY,EAAExB,YAAY,IAAIJ,aAAa,KAAKC,qBAAA,CAAe4B,IAHnE;IAII,cAAc,EAAEI,cAJpB;IAKI,iBAAiB,EAAEE,iBALvB;IAMI,OAAO,EAAE9B,OANb;IAOI,aAAa,EAAE0B,aAPnB;IAQI,eAAe,EAAEP,eARrB;IASI,OAAO,EAAEf,OATb;IAUI,KAAK,EAAEG,MAAM,CAAC4B;EAVlB,GAWQ7B,UAXR,gBAaI,6BAAC,6BAAD;IAAgB,KAAK,EAAE;MAAEH;IAAF;EAAvB,GACKE,UAAU,gBACP,6BAAC,eAAD;IAAQ,KAAK,EAAEE,MAAM,CAAC6B;EAAtB,gBACI,6BAAC,eAAD;IACI,KAAK,EAAE7B,MAAM,CAAC8B,iBADlB;IAEI,QAAQ,EAAEtB;EAFd,GAIKV,UAJL,CADJ,CADO,GASP,IAVR,eAYI,6BAAC,mBAAD;IACI,OAAO,EAAE,GADb;IAEI,KAAK,EAAE0B;EAFX,GAIKjC,QAJL,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 * If `true`, the dialog is full-screen.\n * @default false\n */\n fullScreen?: boolean;\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,CAApB"}
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: theme.spacing(6)
27
+ paddingHorizontal: 24
28
28
  },
29
29
  medium: {
30
- // TODO: need to refactor breakpoints.
31
- paddingHorizontal: theme.spacing(windowWidth >= 448 ? 8 : 6)
30
+ paddingHorizontal: windowWidth >= 448 ? 32 : 24
32
31
  },
33
32
  large: {
34
- paddingHorizontal: theme.spacing(8)
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","spacing","medium","large"],"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: theme.spacing(6),\n },\n medium: {\n // TODO: need to refactor breakpoints.\n paddingHorizontal: theme.spacing(windowWidth >= 448 ? 8 : 6),\n },\n large: {\n paddingHorizontal: theme.spacing(8),\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,EAAEL,KAAK,CAACM,OAAN,CAAc,CAAd;MADhB,CAD2D;MAIlEC,MAAM,EAAE;QACJ;QACAF,iBAAiB,EAAEL,KAAK,CAACM,OAAN,CAAcR,WAAW,IAAI,GAAf,GAAqB,CAArB,GAAyB,CAAvC;MAFf,CAJ0D;MAQlEU,KAAK,EAAE;QACHH,iBAAiB,EAAEL,KAAK,CAACM,OAAN,CAAc,CAAd;MADhB;IAR2D,CAAtE;IAaA,OAAOH,wBAAwB,CAACR,IAAD,CAA/B;EACH,CAfM,EAeJ,CAACA,IAAD,EAAOK,KAAP,EAAcF,WAAd,CAfI,CAAP;AAgBH"}
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"}