@fountain-ui/core 3.0.0-alpha.43 → 3.0.0-alpha.45
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/Button/useVariantStyleMap.js +9 -0
- package/build/commonjs/Button/useVariantStyleMap.js.map +1 -1
- package/build/commonjs/Image/Image.js +11 -2
- package/build/commonjs/Image/Image.js.map +1 -1
- package/build/commonjs/Image/ImageProps.js.map +1 -1
- package/build/commonjs/Image/OverlayCloseButton/OverlayCloseButton.js +46 -0
- package/build/commonjs/Image/OverlayCloseButton/OverlayCloseButton.js.map +1 -0
- package/build/commonjs/Image/OverlayCloseButton/OverlayCloseButtonProps.js +2 -0
- package/build/commonjs/Image/OverlayCloseButton/OverlayCloseButtonProps.js.map +1 -0
- package/build/commonjs/Image/OverlayCloseButton/index.js +16 -0
- package/build/commonjs/Image/OverlayCloseButton/index.js.map +1 -0
- package/build/commonjs/Image/preload.js +10 -0
- package/build/commonjs/Image/preload.js.map +1 -0
- package/build/commonjs/Image/preload.native.js +22 -0
- package/build/commonjs/Image/preload.native.js.map +1 -0
- package/build/commonjs/ImageCore/ImageCoreNative.js +10 -7
- package/build/commonjs/ImageCore/ImageCoreNative.js.map +1 -1
- package/build/commonjs/ImageCore/ImageCoreProps.js.map +1 -1
- package/build/commonjs/Radio/Radio.js +15 -2
- package/build/commonjs/Radio/Radio.js.map +1 -1
- package/build/commonjs/Radio/RadioProps.js.map +1 -1
- package/build/commonjs/TextField/TextField.js +33 -3
- package/build/commonjs/TextField/TextField.js.map +1 -1
- package/build/commonjs/Tooltip/Tooltip.js +5 -1
- package/build/commonjs/Tooltip/Tooltip.js.map +1 -1
- package/build/commonjs/internal/icons/CloseCircleFillPierced.js +23 -0
- package/build/commonjs/internal/icons/CloseCircleFillPierced.js.map +1 -0
- package/build/commonjs/internal/icons/index.js +8 -0
- package/build/commonjs/internal/icons/index.js.map +1 -1
- package/build/module/Button/useVariantStyleMap.js +9 -0
- package/build/module/Button/useVariantStyleMap.js.map +1 -1
- package/build/module/Image/Image.js +9 -2
- package/build/module/Image/Image.js.map +1 -1
- package/build/module/Image/ImageProps.js.map +1 -1
- package/build/module/Image/OverlayCloseButton/OverlayCloseButton.js +31 -0
- package/build/module/Image/OverlayCloseButton/OverlayCloseButton.js.map +1 -0
- package/build/module/Image/OverlayCloseButton/OverlayCloseButtonProps.js +2 -0
- package/build/module/Image/OverlayCloseButton/OverlayCloseButtonProps.js.map +1 -0
- package/build/module/Image/OverlayCloseButton/index.js +2 -0
- package/build/module/Image/OverlayCloseButton/index.js.map +1 -0
- package/build/module/Image/preload.js +3 -0
- package/build/module/Image/preload.js.map +1 -0
- package/build/module/Image/preload.native.js +12 -0
- package/build/module/Image/preload.native.js.map +1 -0
- package/build/module/ImageCore/ImageCoreNative.js +11 -7
- package/build/module/ImageCore/ImageCoreNative.js.map +1 -1
- package/build/module/ImageCore/ImageCoreProps.js.map +1 -1
- package/build/module/Radio/Radio.js +13 -2
- package/build/module/Radio/Radio.js.map +1 -1
- package/build/module/Radio/RadioProps.js.map +1 -1
- package/build/module/TextField/TextField.js +33 -4
- package/build/module/TextField/TextField.js.map +1 -1
- package/build/module/Tooltip/Tooltip.js +6 -2
- package/build/module/Tooltip/Tooltip.js.map +1 -1
- package/build/module/internal/icons/CloseCircleFillPierced.js +9 -0
- package/build/module/internal/icons/CloseCircleFillPierced.js.map +1 -0
- package/build/module/internal/icons/index.js +1 -0
- package/build/module/internal/icons/index.js.map +1 -1
- package/build/typescript/Image/Image.d.ts +6 -1
- package/build/typescript/Image/ImageProps.d.ts +6 -0
- package/build/typescript/Image/OverlayCloseButton/OverlayCloseButton.d.ts +2 -0
- package/build/typescript/Image/OverlayCloseButton/OverlayCloseButtonProps.d.ts +3 -0
- package/build/typescript/Image/OverlayCloseButton/index.d.ts +2 -0
- package/build/typescript/Image/preload.d.ts +2 -0
- package/build/typescript/Image/preload.native.d.ts +2 -0
- package/build/typescript/ImageCore/ImageCoreProps.d.ts +1 -0
- package/build/typescript/Radio/RadioProps.d.ts +4 -0
- package/build/typescript/internal/icons/CloseCircleFillPierced.d.ts +358 -0
- package/build/typescript/internal/icons/index.d.ts +1 -0
- package/package.json +3 -3
- package/src/Button/useVariantStyleMap.ts +9 -0
- package/src/Image/Image.tsx +11 -2
- package/src/Image/ImageProps.ts +7 -0
- package/src/Image/OverlayCloseButton/OverlayCloseButton.tsx +41 -0
- package/src/Image/OverlayCloseButton/OverlayCloseButtonProps.ts +3 -0
- package/src/Image/OverlayCloseButton/index.ts +2 -0
- package/src/Image/preload.native.ts +6 -0
- package/src/Image/preload.ts +5 -0
- package/src/ImageCore/ImageCoreNative.tsx +10 -7
- package/src/ImageCore/ImageCoreProps.ts +1 -0
- package/src/Radio/Radio.tsx +27 -10
- package/src/Radio/RadioProps.ts +6 -0
- package/src/TextField/TextField.tsx +33 -3
- package/src/Tooltip/Tooltip.tsx +6 -1
- package/src/internal/icons/CloseCircleFillPierced.tsx +13 -0
- package/src/internal/icons/index.ts +1 -0
|
@@ -171,6 +171,15 @@ function useVariantStyleMap(variant, color) {
|
|
|
171
171
|
},
|
|
172
172
|
labelColor: theme.palette.text.accent,
|
|
173
173
|
iconColor: theme.palette.icon.accent
|
|
174
|
+
},
|
|
175
|
+
danger: {
|
|
176
|
+
container: {
|
|
177
|
+
borderColor: theme.palette.status.danger,
|
|
178
|
+
borderRadius: theme.shape.radius.full,
|
|
179
|
+
borderWidth: 1
|
|
180
|
+
},
|
|
181
|
+
labelColor: theme.palette.status.danger,
|
|
182
|
+
iconColor: theme.palette.status.danger
|
|
174
183
|
}
|
|
175
184
|
}
|
|
176
185
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useVariantStyleMap","variant","color","theme","useTheme","useMemo","palette","variantStyleMap","solid","accent","container","backgroundColor","fill","labelColor","commonColors","static","strongInverse","iconColor","primary","base","text","icon","danger","status","disabled","onDisabled","outlined","borderColor","border","borderWidth","disabledLabel","strong","secondary","accentAlt","capsuleSolid","borderRadius","shape","radius","full","capsuleOutlined","process","env","NODE_ENV","console","warn"],"sources":["useVariantStyleMap.ts"],"sourcesContent":["import { useMemo } from 'react';\nimport type { FountainUiStyle } from '@fountain-ui/styles';\nimport { commonColors } from '@fountain-ui/styles';\nimport { useTheme } from '../styles';\nimport { ButtonColor, ButtonVariant } from './ButtonProps';\n\ntype UseVariantStyleMapReturns = {\n container?: FountainUiStyle;\n iconColor?: string;\n labelColor?: string;\n}\n\ntype VariantStyleMap = {\n [variant in ButtonVariant]: {\n [color in ButtonColor]?: UseVariantStyleMapReturns;\n }\n};\n\nexport default function useVariantStyleMap(variant: ButtonVariant, color: ButtonColor): UseVariantStyleMapReturns {\n const theme = useTheme();\n\n return useMemo(() => {\n const { palette } = theme;\n\n const variantStyleMap: VariantStyleMap = {\n solid: {\n accent: {\n container: {\n backgroundColor: palette.fill.accent,\n },\n labelColor: commonColors.static.strongInverse,\n iconColor: commonColors.static.strongInverse,\n },\n primary: {\n container: {\n backgroundColor: palette.fill.base,\n },\n labelColor: palette.text.strongInverse,\n iconColor: palette.icon.strongInverse,\n },\n danger: {\n container: {\n backgroundColor: palette.status.danger,\n },\n labelColor: commonColors.static.strongInverse,\n iconColor: commonColors.static.strongInverse,\n },\n disabled: {\n container: {\n backgroundColor: palette.status.disabled,\n },\n labelColor: palette.status.onDisabled,\n iconColor: palette.status.onDisabled,\n },\n },\n outlined: {\n accent: {\n container: {\n borderColor: palette.border.accent,\n borderWidth: 1,\n },\n labelColor: palette.text.accent,\n iconColor: palette.icon.accent,\n },\n primary: {\n container: {\n borderColor: palette.border.base,\n borderWidth: 1,\n },\n labelColor: palette.text.base,\n iconColor: palette.icon.base,\n },\n disabled: {\n container: {\n borderColor: palette.status.disabled,\n borderWidth: 1,\n },\n labelColor: palette.status.disabledLabel,\n iconColor: palette.status.disabledLabel,\n },\n },\n text: {\n primary: {\n labelColor: palette.text.strong,\n iconColor: palette.icon.strong,\n },\n secondary: {\n labelColor: palette.text.base,\n iconColor: palette.icon.base,\n },\n accent: {\n labelColor: palette.text.accent,\n iconColor: palette.icon.accent,\n },\n accentAlt: {\n labelColor: palette.text.accentAlt,\n iconColor: palette.icon.accentAlt,\n },\n danger: {\n labelColor: palette.status.danger,\n iconColor: palette.status.danger,\n },\n disabled: {\n labelColor: palette.status.disabledLabel,\n iconColor: palette.status.disabledLabel,\n },\n },\n capsuleSolid: {\n accent: {\n container: {\n backgroundColor: theme.palette.fill.accent,\n borderRadius: theme.shape.radius.full,\n },\n labelColor: commonColors.static.strongInverse,\n iconColor: commonColors.static.strongInverse,\n },\n primary: {\n container: {\n backgroundColor: theme.palette.fill.base,\n borderRadius: theme.shape.radius.full,\n },\n labelColor: palette.text.strongInverse,\n iconColor: palette.icon.strongInverse,\n },\n danger: {\n container: {\n backgroundColor: theme.palette.status.danger,\n borderRadius: theme.shape.radius.full,\n },\n labelColor: commonColors.static.strongInverse,\n iconColor: commonColors.static.strongInverse,\n },\n secondary: {\n container: {\n backgroundColor: commonColors.static.strongInverse,\n borderRadius: theme.shape.radius.full,\n },\n labelColor: theme.palette.text.strong,\n iconColor: theme.palette.icon.strong,\n },\n disabled: {\n container: {\n backgroundColor: theme.palette.status.disabled,\n borderRadius: theme.shape.radius.full,\n },\n labelColor: theme.palette.status.onDisabled,\n iconColor: theme.palette.status.onDisabled,\n },\n },\n capsuleOutlined: {\n primary: {\n container: {\n borderColor: theme.palette.border.base,\n borderRadius: theme.shape.radius.full,\n borderWidth: 1,\n },\n labelColor: theme.palette.text.strong,\n iconColor: theme.palette.icon.strong,\n },\n disabled: {\n container: {\n borderColor: theme.palette.status.disabled,\n borderRadius: theme.shape.radius.full,\n borderWidth: 1,\n },\n labelColor: theme.palette.status.disabledLabel,\n iconColor: theme.palette.status.disabledLabel,\n },\n accent: {\n container: {\n borderColor: theme.palette.border.accent,\n borderRadius: theme.shape.radius.full,\n borderWidth: 1,\n },\n labelColor: theme.palette.text.accent,\n iconColor: theme.palette.icon.accent,\n },\n },\n };\n\n if (variantStyleMap[variant]?.[color]) {\n return variantStyleMap[variant][color] as UseVariantStyleMapReturns;\n }\n\n if (process.env.NODE_ENV !== 'production') {\n console.warn('The selected color is not supported for the chosen variant.');\n }\n\n return {};\n }, [theme, variant, color]);\n}\n"],"mappings":";;;;;;;AAAA;;AAEA;;AACA;;AAee,SAASA,kBAAT,CAA4BC,OAA5B,EAAoDC,KAApD,EAAmG;EAC9G,MAAMC,KAAK,GAAG,IAAAC,iBAAA,GAAd;EAEA,OAAO,IAAAC,cAAA,EAAQ,MAAM;IAAA;;IACjB,MAAM;MAAEC;IAAF,IAAcH,KAApB;IAEA,MAAMI,eAAgC,GAAG;MACrCC,KAAK,EAAE;QACHC,MAAM,EAAE;UACJC,SAAS,EAAE;YACPC,eAAe,EAAEL,OAAO,CAACM,IAAR,CAAaH;UADvB,CADP;UAIJI,UAAU,EAAEC,oBAAA,CAAaC,MAAb,CAAoBC,aAJ5B;UAKJC,SAAS,EAAEH,oBAAA,CAAaC,MAAb,CAAoBC;QAL3B,CADL;QAQHE,OAAO,EAAE;UACLR,SAAS,EAAE;YACPC,eAAe,EAAEL,OAAO,CAACM,IAAR,CAAaO;UADvB,CADN;UAILN,UAAU,EAAEP,OAAO,CAACc,IAAR,CAAaJ,aAJpB;UAKLC,SAAS,EAAEX,OAAO,CAACe,IAAR,CAAaL;QALnB,CARN;QAeHM,MAAM,EAAE;UACJZ,SAAS,EAAE;YACPC,eAAe,EAAEL,OAAO,CAACiB,MAAR,CAAeD;UADzB,CADP;UAIJT,UAAU,EAAEC,oBAAA,CAAaC,MAAb,CAAoBC,aAJ5B;UAKJC,SAAS,EAAEH,oBAAA,CAAaC,MAAb,CAAoBC;QAL3B,CAfL;QAsBHQ,QAAQ,EAAE;UACNd,SAAS,EAAE;YACPC,eAAe,EAAEL,OAAO,CAACiB,MAAR,CAAeC;UADzB,CADL;UAINX,UAAU,EAAEP,OAAO,CAACiB,MAAR,CAAeE,UAJrB;UAKNR,SAA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AF1B;YAGPT,WAAW,EAAE;UAHN,CADL;UAMNhB,UAAU,EAAEV,KAAK,CAACG,OAAN,CAAciB,MAAd,CAAqBO,aAN3B;UAONb,SAAS,EAAEd,KAAK,CAACG,OAAN,CAAciB,MAAd,CAAqBO;QAP1B,CAVG;QAmBbrB,MAAM,EAAE;UACJC,SAAS,EAAE;YACPiB,WAAW,EAAExB,KAAK,CAACG,OAAN,CAAcsB,MAAd,CAAqBnB,MAD3B;YAEP0B,YAAY,EAAEhC,KAAK,CAACiC,KAAN,CAAYC,MAAZ,CAAmBC,IAF1B;YAGPT,WAAW,EAAE;UAHN,CADP;UAMJhB,UAAU,EAAEV,KAAK,CAACG,OAAN,CAAcc,IAAd,CAAmBX,MAN3B;UAOJQ,SAAS,EAAEd,KAAK,CAACG,OAAN,CAAce,IAAd,CAAmBZ;QAP1B;MAnBK;IA7HoB,CAAzC;;IA4JA,6BAAIF,eAAe,CAACN,OAAD,CAAnB,kDAAI,sBAA2BC,KAA3B,CAAJ,EAAuC;MACnC,OAAOK,eAAe,CAACN,OAAD,CAAf,CAAyBC,KAAzB,CAAP;IACH;;IAED,IAAIsC,OAAO,CAACC,GAAR,CAAYC,QAAZ,KAAyB,YAA7B,EAA2C;MACvCC,OAAO,CAACC,IAAR,CAAa,6DAAb;IACH;;IAED,OAAO,EAAP;EACH,CAxKM,EAwKJ,CAACzC,KAAD,EAAQF,OAAR,EAAiBC,KAAjB,CAxKI,CAAP;AAyKH"}
|
|
1
|
+
{"version":3,"names":["useVariantStyleMap","variant","color","theme","useTheme","useMemo","palette","variantStyleMap","solid","accent","container","backgroundColor","fill","labelColor","commonColors","static","strongInverse","iconColor","primary","base","text","icon","danger","status","disabled","onDisabled","outlined","borderColor","border","borderWidth","disabledLabel","strong","secondary","accentAlt","capsuleSolid","borderRadius","shape","radius","full","capsuleOutlined","process","env","NODE_ENV","console","warn"],"sources":["useVariantStyleMap.ts"],"sourcesContent":["import { useMemo } from 'react';\nimport type { FountainUiStyle } from '@fountain-ui/styles';\nimport { commonColors } from '@fountain-ui/styles';\nimport { useTheme } from '../styles';\nimport { ButtonColor, ButtonVariant } from './ButtonProps';\n\ntype UseVariantStyleMapReturns = {\n container?: FountainUiStyle;\n iconColor?: string;\n labelColor?: string;\n}\n\ntype VariantStyleMap = {\n [variant in ButtonVariant]: {\n [color in ButtonColor]?: UseVariantStyleMapReturns;\n }\n};\n\nexport default function useVariantStyleMap(variant: ButtonVariant, color: ButtonColor): UseVariantStyleMapReturns {\n const theme = useTheme();\n\n return useMemo(() => {\n const { palette } = theme;\n\n const variantStyleMap: VariantStyleMap = {\n solid: {\n accent: {\n container: {\n backgroundColor: palette.fill.accent,\n },\n labelColor: commonColors.static.strongInverse,\n iconColor: commonColors.static.strongInverse,\n },\n primary: {\n container: {\n backgroundColor: palette.fill.base,\n },\n labelColor: palette.text.strongInverse,\n iconColor: palette.icon.strongInverse,\n },\n danger: {\n container: {\n backgroundColor: palette.status.danger,\n },\n labelColor: commonColors.static.strongInverse,\n iconColor: commonColors.static.strongInverse,\n },\n disabled: {\n container: {\n backgroundColor: palette.status.disabled,\n },\n labelColor: palette.status.onDisabled,\n iconColor: palette.status.onDisabled,\n },\n },\n outlined: {\n accent: {\n container: {\n borderColor: palette.border.accent,\n borderWidth: 1,\n },\n labelColor: palette.text.accent,\n iconColor: palette.icon.accent,\n },\n primary: {\n container: {\n borderColor: palette.border.base,\n borderWidth: 1,\n },\n labelColor: palette.text.base,\n iconColor: palette.icon.base,\n },\n disabled: {\n container: {\n borderColor: palette.status.disabled,\n borderWidth: 1,\n },\n labelColor: palette.status.disabledLabel,\n iconColor: palette.status.disabledLabel,\n },\n },\n text: {\n primary: {\n labelColor: palette.text.strong,\n iconColor: palette.icon.strong,\n },\n secondary: {\n labelColor: palette.text.base,\n iconColor: palette.icon.base,\n },\n accent: {\n labelColor: palette.text.accent,\n iconColor: palette.icon.accent,\n },\n accentAlt: {\n labelColor: palette.text.accentAlt,\n iconColor: palette.icon.accentAlt,\n },\n danger: {\n labelColor: palette.status.danger,\n iconColor: palette.status.danger,\n },\n disabled: {\n labelColor: palette.status.disabledLabel,\n iconColor: palette.status.disabledLabel,\n },\n },\n capsuleSolid: {\n accent: {\n container: {\n backgroundColor: theme.palette.fill.accent,\n borderRadius: theme.shape.radius.full,\n },\n labelColor: commonColors.static.strongInverse,\n iconColor: commonColors.static.strongInverse,\n },\n primary: {\n container: {\n backgroundColor: theme.palette.fill.base,\n borderRadius: theme.shape.radius.full,\n },\n labelColor: palette.text.strongInverse,\n iconColor: palette.icon.strongInverse,\n },\n danger: {\n container: {\n backgroundColor: theme.palette.status.danger,\n borderRadius: theme.shape.radius.full,\n },\n labelColor: commonColors.static.strongInverse,\n iconColor: commonColors.static.strongInverse,\n },\n secondary: {\n container: {\n backgroundColor: commonColors.static.strongInverse,\n borderRadius: theme.shape.radius.full,\n },\n labelColor: theme.palette.text.strong,\n iconColor: theme.palette.icon.strong,\n },\n disabled: {\n container: {\n backgroundColor: theme.palette.status.disabled,\n borderRadius: theme.shape.radius.full,\n },\n labelColor: theme.palette.status.onDisabled,\n iconColor: theme.palette.status.onDisabled,\n },\n },\n capsuleOutlined: {\n primary: {\n container: {\n borderColor: theme.palette.border.base,\n borderRadius: theme.shape.radius.full,\n borderWidth: 1,\n },\n labelColor: theme.palette.text.strong,\n iconColor: theme.palette.icon.strong,\n },\n disabled: {\n container: {\n borderColor: theme.palette.status.disabled,\n borderRadius: theme.shape.radius.full,\n borderWidth: 1,\n },\n labelColor: theme.palette.status.disabledLabel,\n iconColor: theme.palette.status.disabledLabel,\n },\n accent: {\n container: {\n borderColor: theme.palette.border.accent,\n borderRadius: theme.shape.radius.full,\n borderWidth: 1,\n },\n labelColor: theme.palette.text.accent,\n iconColor: theme.palette.icon.accent,\n },\n danger: {\n container: {\n borderColor: theme.palette.status.danger,\n borderRadius: theme.shape.radius.full,\n borderWidth: 1,\n },\n labelColor: theme.palette.status.danger,\n iconColor: theme.palette.status.danger,\n },\n },\n };\n\n if (variantStyleMap[variant]?.[color]) {\n return variantStyleMap[variant][color] as UseVariantStyleMapReturns;\n }\n\n if (process.env.NODE_ENV !== 'production') {\n console.warn('The selected color is not supported for the chosen variant.');\n }\n\n return {};\n }, [theme, variant, color]);\n}\n"],"mappings":";;;;;;;AAAA;;AAEA;;AACA;;AAee,SAASA,kBAAT,CAA4BC,OAA5B,EAAoDC,KAApD,EAAmG;EAC9G,MAAMC,KAAK,GAAG,IAAAC,iBAAA,GAAd;EAEA,OAAO,IAAAC,cAAA,EAAQ,MAAM;IAAA;;IACjB,MAAM;MAAEC;IAAF,IAAcH,KAApB;IAEA,MAAMI,eAAgC,GAAG;MACrCC,KAAK,EAAE;QACHC,MAAM,EAAE;UACJC,SAAS,EAAE;YACPC,eAAe,EAAEL,OAAO,CAACM,IAAR,CAAaH;UADvB,CADP;UAIJI,UAAU,EAAEC,oBAAA,CAAaC,MAAb,CAAoBC,aAJ5B;UAKJC,SAAS,EAAEH,oBAAA,CAAaC,MAAb,CAAoBC;QAL3B,CADL;QAQHE,OAAO,EAAE;UACLR,SAAS,EAAE;YACPC,eAAe,EAAEL,OAAO,CAACM,IAAR,CAAaO;UADvB,CADN;UAILN,UAAU,EAAEP,OAAO,CAACc,IAAR,CAAaJ,aAJpB;UAKLC,SAAS,EAAEX,OAAO,CAACe,IAAR,CAAaL;QALnB,CARN;QAeHM,MAAM,EAAE;UACJZ,SAAS,EAAE;YACPC,eAAe,EAAEL,OAAO,CAACiB,MAAR,CAAeD;UADzB,CADP;UAIJT,UAAU,EAAEC,oBAAA,CAAaC,MAAb,CAAoBC,aAJ5B;UAKJC,SAAS,EAAEH,oBAAA,CAAaC,MAAb,CAAoBC;QAL3B,CAfL;QAsBHQ,QAAQ,EAAE;UACNd,SAAS,EAAE;YACPC,eAAe,EAAEL,OAAO,CAACiB,MAAR,CAAeC;UADzB,CADL;UAINX,UAAU,EAAEP,OAAO,CAACiB,MAAR,CAAeE,UAJrB;UAKNR,SAAS,EAAEX,OAAO,C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;AAkLH"}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.default =
|
|
6
|
+
exports.default = void 0;
|
|
7
7
|
|
|
8
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
9
|
|
|
@@ -13,6 +13,10 @@ var _ImageCore = _interopRequireDefault(require("../ImageCore"));
|
|
|
13
13
|
|
|
14
14
|
var _styles = require("../styles");
|
|
15
15
|
|
|
16
|
+
var _OverlayCloseButton = _interopRequireDefault(require("./OverlayCloseButton"));
|
|
17
|
+
|
|
18
|
+
var _preload = _interopRequireDefault(require("./preload"));
|
|
19
|
+
|
|
16
20
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
21
|
|
|
18
22
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
@@ -67,6 +71,7 @@ function Image(props) {
|
|
|
67
71
|
alt,
|
|
68
72
|
cache = 'immutable',
|
|
69
73
|
disableDrag,
|
|
74
|
+
disableFadeIn,
|
|
70
75
|
disableLongClick,
|
|
71
76
|
disableOutline,
|
|
72
77
|
disablePlaceholder,
|
|
@@ -111,6 +116,7 @@ function Image(props) {
|
|
|
111
116
|
alt: alt,
|
|
112
117
|
cache: cache,
|
|
113
118
|
disableDrag: disableDrag,
|
|
119
|
+
disableFadeIn: disableFadeIn,
|
|
114
120
|
disableLongClick: disableLongClick,
|
|
115
121
|
height: '100%',
|
|
116
122
|
loading: loading,
|
|
@@ -124,5 +130,8 @@ function Image(props) {
|
|
|
124
130
|
}, overlaidChildren) : null);
|
|
125
131
|
}
|
|
126
132
|
|
|
127
|
-
;
|
|
133
|
+
Image.OverlayCloseButton = _OverlayCloseButton.default;
|
|
134
|
+
Image.preload = _preload.default;
|
|
135
|
+
var _default = Image;
|
|
136
|
+
exports.default = _default;
|
|
128
137
|
//# sourceMappingURL=Image.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useStyles","theme","useTheme","root","rounded","borderRadius","shape","roundness","overflow","placeholder","backgroundColor","palette","paper","grey","outlined","borderWidth","borderStyle","borderColor","border","weak","error","alignItems","height","justifyContent","width","errorText","color","text","primary","fontFamily","fontSize","letterSpacing","lineHeight","textAlign","determinePlaceholderMode","props","disablePlaceholder","Image","alt","cache","disableDrag","disableLongClick","disableOutline","loading","onError","onErrorProp","onLoad","onLoadProp","overlaidChildren","resizeMode","source","style","square","otherProps","failed","setFailed","useState","styles","placeholderMode","css","undefined","StyleSheet","absoluteFill","zIndex","uri"],"sources":["Image.tsx"],"sourcesContent":["import React, { useState } from 'react';\nimport { Text, View } from 'react-native';\nimport type { NamedStylesStringUnion, UseStyles } from '@fountain-ui/styles';\nimport type { ImageCoreProps } from '../ImageCore';\nimport ImageCore from '../ImageCore';\nimport { css, StyleSheet, useTheme } from '../styles';\nimport type ImageProps from './ImageProps';\n\ntype PlaceholderMode =\n | 'default'\n | 'custom'\n | 'none';\n\ntype ImageStyleKeys =\n | 'root'\n | 'rounded'\n | 'placeholder'\n | 'outlined'\n | 'error'\n | 'errorText';\n\ntype ImageStyles = NamedStylesStringUnion<ImageStyleKeys>;\n\nconst useStyles: UseStyles<ImageStyles> = function (): ImageStyles {\n const theme = useTheme();\n\n return {\n root: {},\n rounded: {\n borderRadius: theme.shape.roundness,\n overflow: 'hidden',\n },\n placeholder: {\n backgroundColor: theme.palette.paper.grey,\n },\n outlined: {\n borderWidth: 0.5,\n borderStyle: 'solid',\n borderColor: theme.palette.border.weak,\n },\n error: {\n alignItems: 'center',\n height: '100%',\n justifyContent: 'center',\n width: '100%',\n },\n errorText: {\n color: theme.palette.text.primary,\n fontFamily: 'Inter-Medium',\n fontSize: 12,\n letterSpacing: 0,\n lineHeight: 18,\n textAlign: 'center',\n },\n };\n};\n\nfunction determinePlaceholderMode(props: ImageProps): PlaceholderMode {\n if (props.disablePlaceholder) {\n return 'none';\n }\n\n return props.placeholder ? 'custom' : 'default';\n}\n\
|
|
1
|
+
{"version":3,"names":["useStyles","theme","useTheme","root","rounded","borderRadius","shape","roundness","overflow","placeholder","backgroundColor","palette","paper","grey","outlined","borderWidth","borderStyle","borderColor","border","weak","error","alignItems","height","justifyContent","width","errorText","color","text","primary","fontFamily","fontSize","letterSpacing","lineHeight","textAlign","determinePlaceholderMode","props","disablePlaceholder","Image","alt","cache","disableDrag","disableFadeIn","disableLongClick","disableOutline","loading","onError","onErrorProp","onLoad","onLoadProp","overlaidChildren","resizeMode","source","style","square","otherProps","failed","setFailed","useState","styles","placeholderMode","css","undefined","StyleSheet","absoluteFill","zIndex","uri","OverlayCloseButton","preload"],"sources":["Image.tsx"],"sourcesContent":["import React, { useState } from 'react';\nimport { Text, View } from 'react-native';\nimport type { NamedStylesStringUnion, UseStyles } from '@fountain-ui/styles';\nimport type { ImageCoreProps } from '../ImageCore';\nimport ImageCore from '../ImageCore';\nimport { css, StyleSheet, useTheme } from '../styles';\nimport type ImageProps from './ImageProps';\nimport OverlayCloseButton from './OverlayCloseButton';\nimport preload from './preload';\n\ntype PlaceholderMode =\n | 'default'\n | 'custom'\n | 'none';\n\ntype ImageStyleKeys =\n | 'root'\n | 'rounded'\n | 'placeholder'\n | 'outlined'\n | 'error'\n | 'errorText';\n\ntype ImageStyles = NamedStylesStringUnion<ImageStyleKeys>;\n\nconst useStyles: UseStyles<ImageStyles> = function (): ImageStyles {\n const theme = useTheme();\n\n return {\n root: {},\n rounded: {\n borderRadius: theme.shape.roundness,\n overflow: 'hidden',\n },\n placeholder: {\n backgroundColor: theme.palette.paper.grey,\n },\n outlined: {\n borderWidth: 0.5,\n borderStyle: 'solid',\n borderColor: theme.palette.border.weak,\n },\n error: {\n alignItems: 'center',\n height: '100%',\n justifyContent: 'center',\n width: '100%',\n },\n errorText: {\n color: theme.palette.text.primary,\n fontFamily: 'Inter-Medium',\n fontSize: 12,\n letterSpacing: 0,\n lineHeight: 18,\n textAlign: 'center',\n },\n };\n};\n\nfunction determinePlaceholderMode(props: ImageProps): PlaceholderMode {\n if (props.disablePlaceholder) {\n return 'none';\n }\n\n return props.placeholder ? 'custom' : 'default';\n}\n\nfunction Image(props: ImageProps) {\n const {\n alt,\n cache = 'immutable',\n disableDrag,\n disableFadeIn,\n disableLongClick,\n disableOutline,\n disablePlaceholder,\n error,\n loading = 'lazy',\n onError: onErrorProp,\n onLoad: onLoadProp,\n overlaidChildren,\n placeholder,\n resizeMode = 'cover',\n source,\n style,\n square = false,\n ...otherProps\n } = props;\n\n const [failed, setFailed] = useState(false);\n\n const styles = useStyles();\n\n const onLoad: ImageCoreProps['onLoad'] = () => {\n setFailed(false);\n\n onLoadProp?.();\n };\n\n const onError: ImageCoreProps['onError'] = () => {\n setFailed(true);\n\n onErrorProp?.();\n };\n\n const placeholderMode = determinePlaceholderMode(props);\n\n return (\n <View\n style={css([\n styles.root,\n !disableOutline ? styles.outlined : undefined,\n !square ? styles.rounded : undefined,\n placeholderMode === 'default' ? styles.placeholder : undefined,\n style,\n ])}\n {...otherProps}\n >\n {placeholderMode === 'custom' ? (\n <View\n style={css([\n StyleSheet.absoluteFill,\n { zIndex: -1 },\n ])}\n >\n {placeholder}\n </View>\n ) : null}\n\n {failed ? (\n <View style={styles.error}>\n {error ?? (\n <Text\n children={alt}\n style={styles.errorText}\n />\n )}\n </View>\n ) : source.uri ? (\n <ImageCore\n alt={alt}\n cache={cache}\n disableDrag={disableDrag}\n disableFadeIn={disableFadeIn}\n disableLongClick={disableLongClick}\n height={'100%'}\n loading={loading}\n onError={onError}\n onLoad={onLoad}\n resizeMode={resizeMode}\n source={source}\n width={'100%'}\n />\n ) : null}\n\n {overlaidChildren ? (\n <View style={StyleSheet.absoluteFill}>\n {overlaidChildren}\n </View>\n ) : null}\n </View>\n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IAnBR,EAqBK8C,MAAM,gBACH,6BAAC,iBAAD;IAAM,KAAK,EAAEG,MAAM,CAACtC;EAApB,GACKA,KAAK,iBACF,6BAAC,iBAAD;IACI,QAAQ,EAAEkB,GADd;IAEI,KAAK,EAAEoB,MAAM,CAACjC;EAFlB,EAFR,CADG,GASH0B,MAAM,CAACc,GAAP,gBACA,6BAAC,kBAAD;IACI,GAAG,EAAE3B,GADT;IAEI,KAAK,EAAEC,KAFX;IAGI,WAAW,EAAEC,WAHjB;IAII,aAAa,EAAEC,aAJnB;IAKI,gBAAgB,EAAEC,gBALtB;IAMI,MAAM,EAAE,MANZ;IAOI,OAAO,EAAEE,OAPb;IAQI,OAAO,EAAEC,OARb;IASI,MAAM,EAAEE,MATZ;IAUI,UAAU,EAAEG,UAVhB;IAWI,MAAM,EAAEC,MAXZ;IAYI,KAAK,EAAE;EAZX,EADA,GAeA,IA7CR,EA+CKF,gBAAgB,gBACb,6BAAC,iBAAD;IAAM,KAAK,EAAEa,kBAAA,CAAWC;EAAxB,GACKd,gBADL,CADa,GAIb,IAnDR,CADJ;AAuDH;;AAEDZ,KAAK,CAAC6B,kBAAN,GAA2BA,2BAA3B;AACA7B,KAAK,CAAC8B,OAAN,GAAgBA,gBAAhB;eAEe9B,K"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["ImageProps.ts"],"sourcesContent":["import React from 'react';\nimport type { ViewProps } from 'react-native';\nimport type { OverridableComponentProps } from '../types';\nimport type { ImageSource, Loading, ResizeMode, CacheControl } from '../ImageCore';\n\n/**\n * Image file quality.\n * Request image by query string.\n */\nexport type ImageQuality = 'small' | 'medium' | 'large';\n\nexport default interface ImageProps extends OverridableComponentProps<ViewProps, {\n /**\n * Indicating the alternate fallback content to be displayed\n * if the image has not been loaded.\n */\n alt?: string;\n\n /**\n * Disable drag event for web.\n * @default false\n */\n disableDrag?: boolean,\n\n /**\n * Disable Long click event for web.\n * @default false\n */\n disableLongClick?: boolean,\n\n /**\n * If `true`, the image outline is not rendered.\n * @default false\n */\n disableOutline?: boolean;\n\n /**\n * If `true`, the placeholder is not rendered.\n * @default false\n */\n disablePlaceholder?: boolean;\n\n /**\n * Custom error element. Default is simple alt text.\n */\n error?: React.ReactElement | null;\n\n /**\n * Web only. Loading the document by determining whether to load\n * the image immediately (`eager`) or on an as-needed basis (`lazy`).\n * On React Native, it always works as `lazy`.\n * @default 'lazy'\n */\n loading?: Loading;\n\n /**\n * error event handler\n */\n onError?: () => void;\n\n /**\n * image loaded event handler\n */\n onLoad?: () => void;\n\n /**\n * The children on top this image.\n */\n overlaidChildren?: React.ReactElement;\n\n /**\n * Custom placeholder element.\n */\n placeholder?: React.ReactElement;\n\n /**\n * Determines how to resize the image when the frame doesn't match the raw image dimensions.\n * @default 'cover'\n */\n resizeMode?: ResizeMode;\n\n /**\n * The image source.\n */\n source: ImageSource;\n\n /**\n * If `true`, rounded corners are disabled.\n * @default false\n */\n square?: boolean;\n\n /***\n * FastImage cache control value.\n * @default 'immutable'\n */\n cache?: CacheControl;\n}> {}\n"],"mappings":""}
|
|
1
|
+
{"version":3,"names":[],"sources":["ImageProps.ts"],"sourcesContent":["import React from 'react';\nimport type { ViewProps } from 'react-native';\nimport type { OverridableComponentProps } from '../types';\nimport type { ImageSource, Loading, ResizeMode, CacheControl } from '../ImageCore';\n\n/**\n * Image file quality.\n * Request image by query string.\n */\nexport type ImageQuality = 'small' | 'medium' | 'large';\n\nexport default interface ImageProps extends OverridableComponentProps<ViewProps, {\n /**\n * Indicating the alternate fallback content to be displayed\n * if the image has not been loaded.\n */\n alt?: string;\n\n /**\n * Disable drag event for web.\n * @default false\n */\n disableDrag?: boolean,\n\n /**\n * Disable Long click event for web.\n * @default false\n */\n disableLongClick?: boolean,\n\n /**\n * If true, disables the fade-in opacity animation on image load.\n * Only affects native platforms.\n * @default false\n */\n disableFadeIn?: boolean;\n\n /**\n * If `true`, the image outline is not rendered.\n * @default false\n */\n disableOutline?: boolean;\n\n /**\n * If `true`, the placeholder is not rendered.\n * @default false\n */\n disablePlaceholder?: boolean;\n\n /**\n * Custom error element. Default is simple alt text.\n */\n error?: React.ReactElement | null;\n\n /**\n * Web only. Loading the document by determining whether to load\n * the image immediately (`eager`) or on an as-needed basis (`lazy`).\n * On React Native, it always works as `lazy`.\n * @default 'lazy'\n */\n loading?: Loading;\n\n /**\n * error event handler\n */\n onError?: () => void;\n\n /**\n * image loaded event handler\n */\n onLoad?: () => void;\n\n /**\n * The children on top this image.\n */\n overlaidChildren?: React.ReactElement;\n\n /**\n * Custom placeholder element.\n */\n placeholder?: React.ReactElement;\n\n /**\n * Determines how to resize the image when the frame doesn't match the raw image dimensions.\n * @default 'cover'\n */\n resizeMode?: ResizeMode;\n\n /**\n * The image source.\n */\n source: ImageSource;\n\n /**\n * If `true`, rounded corners are disabled.\n * @default false\n */\n square?: boolean;\n\n /***\n * FastImage cache control value.\n * @default 'immutable'\n */\n cache?: CacheControl;\n}> {}\n"],"mappings":""}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = OverlayCloseButton;
|
|
7
|
+
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
|
|
10
|
+
var _styles = require("@fountain-ui/styles");
|
|
11
|
+
|
|
12
|
+
var _IconButton = _interopRequireDefault(require("../../IconButton"));
|
|
13
|
+
|
|
14
|
+
var _internal = require("../../internal");
|
|
15
|
+
|
|
16
|
+
var _styles2 = require("../../styles");
|
|
17
|
+
|
|
18
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
|
+
|
|
20
|
+
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); }
|
|
21
|
+
|
|
22
|
+
const styles = _styles2.StyleSheet.create({
|
|
23
|
+
root: {
|
|
24
|
+
height: 40,
|
|
25
|
+
left: 8,
|
|
26
|
+
position: 'absolute',
|
|
27
|
+
top: 8,
|
|
28
|
+
width: 40
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
function OverlayCloseButton(props) {
|
|
33
|
+
const {
|
|
34
|
+
style: styleProp,
|
|
35
|
+
...otherProps
|
|
36
|
+
} = props;
|
|
37
|
+
const rootStyle = (0, _styles2.css)([styles.root, styleProp]);
|
|
38
|
+
return /*#__PURE__*/_react.default.createElement(_IconButton.default, _extends({
|
|
39
|
+
style: rootStyle
|
|
40
|
+
}, otherProps), /*#__PURE__*/_react.default.createElement(_internal.CloseCircleFillPierced, {
|
|
41
|
+
fill: _styles.commonColors.static.baseOpacityInverse,
|
|
42
|
+
height: 21,
|
|
43
|
+
width: 21
|
|
44
|
+
}));
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=OverlayCloseButton.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["styles","StyleSheet","create","root","height","left","position","top","width","OverlayCloseButton","props","style","styleProp","otherProps","rootStyle","css","commonColors","static","baseOpacityInverse"],"sources":["OverlayCloseButton.tsx"],"sourcesContent":["import React from 'react';\nimport { commonColors } from '@fountain-ui/styles';\nimport IconButton from '../../IconButton';\nimport { CloseCircleFillPierced } from '../../internal';\nimport { css, StyleSheet } from '../../styles';\nimport type OverlayCloseButtonProps from './OverlayCloseButtonProps';\n\nconst styles = StyleSheet.create({\n root: {\n height: 40,\n left: 8,\n position: 'absolute',\n top: 8,\n width: 40,\n },\n});\n\nexport default function OverlayCloseButton(props: OverlayCloseButtonProps) {\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 <CloseCircleFillPierced\n fill={commonColors.static.baseOpacityInverse}\n height={21}\n width={21}\n />\n </IconButton>\n );\n}\n"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;;;;;AAGA,MAAMA,MAAM,GAAGC,mBAAA,CAAWC,MAAX,CAAkB;EAC7BC,IAAI,EAAE;IACFC,MAAM,EAAE,EADN;IAEFC,IAAI,EAAE,CAFJ;IAGFC,QAAQ,EAAE,UAHR;IAIFC,GAAG,EAAE,CAJH;IAKFC,KAAK,EAAE;EALL;AADuB,CAAlB,CAAf;;AAUe,SAASC,kBAAT,CAA4BC,KAA5B,EAA4D;EACvE,MAAM;IACFC,KAAK,EAAEC,SADL;IAEF,GAAGC;EAFD,IAGFH,KAHJ;EAKA,MAAMI,SAAS,GAAG,IAAAC,YAAA,EAAI,CAClBf,MAAM,CAACG,IADW,EAElBS,SAFkB,CAAJ,CAAlB;EAKA,oBACI,6BAAC,mBAAD;IACI,KAAK,EAAEE;EADX,GAEQD,UAFR,gBAII,6BAAC,gCAAD;IACI,IAAI,EAAEG,oBAAA,CAAaC,MAAb,CAAoBC,kBAD9B;IAEI,MAAM,EAAE,EAFZ;IAGI,KAAK,EAAE;EAHX,EAJJ,CADJ;AAYH"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sources":["OverlayCloseButtonProps.ts"],"sourcesContent":["import type { IconButtonProps } from '../../IconButton';\n\nexport default interface OverlayCloseButtonProps extends Omit<IconButtonProps, 'children'> {}"],"mappings":""}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "default", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _OverlayCloseButton.default;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
var _OverlayCloseButton = _interopRequireDefault(require("./OverlayCloseButton"));
|
|
14
|
+
|
|
15
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
16
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export { default } from './OverlayCloseButton';\nexport type { default as OverlayCloseButtonProps } from './OverlayCloseButtonProps';"],"mappings":";;;;;;;;;;;;AAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["preload","_sources"],"sources":["preload.ts"],"sourcesContent":["import type { ImageSource } from '../ImageCore';\n\nexport default function preload(_sources: ImageSource[]) {\n // No-op on web\n}\n"],"mappings":";;;;;;;AAEe,SAASA,OAAT,CAAiBC,QAAjB,EAA0C,CACrD;AACH"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = preload;
|
|
7
|
+
|
|
8
|
+
var _reactNativeFastImage = _interopRequireDefault(require("@d11/react-native-fast-image"));
|
|
9
|
+
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
+
|
|
12
|
+
function preload(sources) {
|
|
13
|
+
_reactNativeFastImage.default.preload(sources.map(_ref => {
|
|
14
|
+
let {
|
|
15
|
+
uri
|
|
16
|
+
} = _ref;
|
|
17
|
+
return {
|
|
18
|
+
uri
|
|
19
|
+
};
|
|
20
|
+
}));
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=preload.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["preload","sources","FastImage","map","uri"],"sources":["preload.native.ts"],"sourcesContent":["import FastImage from '@d11/react-native-fast-image';\nimport type { ImageSource } from '../ImageCore';\n\nexport default function preload(sources: ImageSource[]) {\n FastImage.preload(sources.map(({ uri }) => ({ uri })));\n}\n"],"mappings":";;;;;;;AAAA;;;;AAGe,SAASA,OAAT,CAAiBC,OAAjB,EAAyC;EACpDC,6BAAA,CAAUF,OAAV,CAAkBC,OAAO,CAACE,GAAR,CAAY;IAAA,IAAC;MAAEC;IAAF,CAAD;IAAA,OAAc;MAAEA;IAAF,CAAd;EAAA,CAAZ,CAAlB;AACH"}
|
|
@@ -33,6 +33,7 @@ const ANIMATION_DURATION = 200;
|
|
|
33
33
|
function ImageCore(props) {
|
|
34
34
|
const {
|
|
35
35
|
cache,
|
|
36
|
+
disableFadeIn,
|
|
36
37
|
height,
|
|
37
38
|
onError,
|
|
38
39
|
onLoad,
|
|
@@ -40,17 +41,19 @@ function ImageCore(props) {
|
|
|
40
41
|
source,
|
|
41
42
|
width
|
|
42
43
|
} = props;
|
|
43
|
-
const opacity = (0, _hooks.useAnimatedValue)(INITIAL_OPACITY);
|
|
44
|
+
const opacity = (0, _hooks.useAnimatedValue)(disableFadeIn ? LOADED_OPACITY : INITIAL_OPACITY);
|
|
44
45
|
const acceptHeader = (0, _react.useContext)(_ImageFileExtensionContext.default);
|
|
45
46
|
const handleLoad = (0, _react.useCallback)(() => {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
47
|
+
if (!disableFadeIn) {
|
|
48
|
+
_reactNative.Animated.timing(opacity, {
|
|
49
|
+
toValue: LOADED_OPACITY,
|
|
50
|
+
duration: ANIMATION_DURATION,
|
|
51
|
+
useNativeDriver: _utils.isNotAndroid12
|
|
52
|
+
}).start();
|
|
53
|
+
}
|
|
51
54
|
|
|
52
55
|
onLoad === null || onLoad === void 0 ? void 0 : onLoad();
|
|
53
|
-
}, [onLoad]);
|
|
56
|
+
}, [disableFadeIn, onLoad]);
|
|
54
57
|
return /*#__PURE__*/_react.default.createElement(AnimatedFastImage, {
|
|
55
58
|
onError: onError,
|
|
56
59
|
onLoad: handleLoad,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["AnimatedFastImage","Animated","createAnimatedComponent","FastImage","INITIAL_OPACITY","LOADED_OPACITY","ANIMATION_DURATION","ImageCore","props","cache","height","onError","onLoad","resizeMode","source","width","opacity","useAnimatedValue","acceptHeader","useContext","ImageFileExtensionContext","handleLoad","useCallback","timing","toValue","duration","useNativeDriver","isNotAndroid12","start","uri","headers"],"sources":["ImageCoreNative.tsx"],"sourcesContent":["import React, { useCallback, useContext } from 'react';\nimport { Animated, DimensionValue } from 'react-native';\nimport FastImage from '@d11/react-native-fast-image';\nimport { useAnimatedValue } from '../hooks';\nimport { isNotAndroid12 } from '../utils';\nimport type ImageCoreProps from './ImageCoreProps';\nimport ImageFileExtensionContext from './ImageFileExtensionContext';\n\n// @ts-ignore\nconst AnimatedFastImage = Animated.createAnimatedComponent(FastImage);\n\nconst INITIAL_OPACITY = 0;\nconst LOADED_OPACITY = 1;\n\nconst ANIMATION_DURATION = 200;\n\nexport default function ImageCore(props: ImageCoreProps) {\n const {\n cache,\n height,\n onError,\n onLoad,\n resizeMode,\n source,\n width,\n } = props;\n\n const opacity = useAnimatedValue(INITIAL_OPACITY);\n\n const acceptHeader = useContext(ImageFileExtensionContext);\n\n const handleLoad = useCallback(() => {\n Animated.timing(opacity, {\n
|
|
1
|
+
{"version":3,"names":["AnimatedFastImage","Animated","createAnimatedComponent","FastImage","INITIAL_OPACITY","LOADED_OPACITY","ANIMATION_DURATION","ImageCore","props","cache","disableFadeIn","height","onError","onLoad","resizeMode","source","width","opacity","useAnimatedValue","acceptHeader","useContext","ImageFileExtensionContext","handleLoad","useCallback","timing","toValue","duration","useNativeDriver","isNotAndroid12","start","uri","headers"],"sources":["ImageCoreNative.tsx"],"sourcesContent":["import React, { useCallback, useContext } from 'react';\nimport { Animated, DimensionValue } from 'react-native';\nimport FastImage from '@d11/react-native-fast-image';\nimport { useAnimatedValue } from '../hooks';\nimport { isNotAndroid12 } from '../utils';\nimport type ImageCoreProps from './ImageCoreProps';\nimport ImageFileExtensionContext from './ImageFileExtensionContext';\n\n// @ts-ignore\nconst AnimatedFastImage = Animated.createAnimatedComponent(FastImage);\n\nconst INITIAL_OPACITY = 0;\nconst LOADED_OPACITY = 1;\n\nconst ANIMATION_DURATION = 200;\n\nexport default function ImageCore(props: ImageCoreProps) {\n const {\n cache,\n disableFadeIn,\n height,\n onError,\n onLoad,\n resizeMode,\n source,\n width,\n } = props;\n\n const opacity = useAnimatedValue(disableFadeIn ? LOADED_OPACITY : INITIAL_OPACITY);\n\n const acceptHeader = useContext(ImageFileExtensionContext);\n\n const handleLoad = useCallback(() => {\n if (!disableFadeIn) {\n Animated.timing(opacity, {\n toValue: LOADED_OPACITY,\n duration: ANIMATION_DURATION,\n useNativeDriver: isNotAndroid12,\n }).start();\n }\n\n onLoad?.();\n }, [disableFadeIn, onLoad]);\n\n return (\n <AnimatedFastImage\n onError={onError}\n onLoad={handleLoad}\n resizeMode={resizeMode}\n source={{\n cache,\n uri: source.uri,\n headers: {\n 'Accept': acceptHeader,\n },\n }}\n style={[\n { opacity },\n { width: width as DimensionValue, height: height as DimensionValue },\n ]}\n />\n );\n};\n"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AAEA;;;;;;;;AAEA;AACA,MAAMA,iBAAiB,GAAGC,qBAAA,CAASC,uBAAT,CAAiCC,6BAAjC,CAA1B;;AAEA,MAAMC,eAAe,GAAG,CAAxB;AACA,MAAMC,cAAc,GAAG,CAAvB;AAEA,MAAMC,kBAAkB,GAAG,GAA3B;;AAEe,SAASC,SAAT,CAAmBC,KAAnB,EAA0C;EACrD,MAAM;IACFC,KADE;IAEFC,aAFE;IAGFC,MAHE;IAIFC,OAJE;IAKFC,MALE;IAMFC,UANE;IAOFC,MAPE;IAQFC;EARE,IASFR,KATJ;EAWA,MAAMS,OAAO,GAAG,IAAAC,uBAAA,EAAiBR,aAAa,GAAGL,cAAH,GAAoBD,eAAlD,CAAhB;EAEA,MAAMe,YAAY,GAAG,IAAAC,iBAAA,EAAWC,kCAAX,CAArB;EAEA,MAAMC,UAAU,GAAG,IAAAC,kBAAA,EAAY,MAAM;IACjC,IAAI,CAACb,aAAL,EAAoB;MAChBT,qBAAA,CAASuB,MAAT,CAAgBP,OAAhB,EAAyB;QACrBQ,OAAO,EAAEpB,cADY;QAErBqB,QAAQ,EAAEpB,kBAFW;QAGrBqB,eAAe,EAAEC;MAHI,CAAzB,EAIGC,KAJH;IAKH;;IAEDhB,MAAM,SAAN,IAAAA,MAAM,WAAN,YAAAA,MAAM;EACT,CAVkB,EAUhB,CAACH,aAAD,EAAgBG,MAAhB,CAVgB,CAAnB;EAYA,oBACI,6BAAC,iBAAD;IACI,OAAO,EAAED,OADb;IAEI,MAAM,EAAEU,UAFZ;IAGI,UAAU,EAAER,UAHhB;IAII,MAAM,EAAE;MACJL,KADI;MAEJqB,GAAG,EAAEf,MAAM,CAACe,GAFR;MAGJC,OAAO,EAAE;QACL,UAAUZ;MADL;IAHL,CAJZ;IAWI,KAAK,EAAE,CACH;MAAEF;IAAF,CADG,EAEH;MAAED,KAAK,EAAEA,KAAT;MAAkCL,MAAM,EAAEA;IAA1C,CAFG;EAXX,EADJ;AAkBH;;AAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["ImageCoreProps.ts"],"sourcesContent":["export interface ImageSource {\n uri?: string;\n}\n\nexport type ResizeMode = 'cover' | 'contain';\n\nexport type Loading = 'lazy' | 'eager';\n\nexport type CacheControl = 'immutable' | 'web' | 'cacheOnly';\n\nexport default interface ImageCoreProps extends Readonly<{\n alt?: string;\n cache?: CacheControl;\n disableDrag?: boolean,\n disableLongClick?: boolean,\n height?: number | string;\n loading: Loading;\n onError?: () => void;\n onLoad?: () => void;\n resizeMode: ResizeMode;\n source: ImageSource;\n width?: number | string;\n}> {}"],"mappings":""}
|
|
1
|
+
{"version":3,"names":[],"sources":["ImageCoreProps.ts"],"sourcesContent":["export interface ImageSource {\n uri?: string;\n}\n\nexport type ResizeMode = 'cover' | 'contain';\n\nexport type Loading = 'lazy' | 'eager';\n\nexport type CacheControl = 'immutable' | 'web' | 'cacheOnly';\n\nexport default interface ImageCoreProps extends Readonly<{\n alt?: string;\n cache?: CacheControl;\n disableDrag?: boolean,\n disableFadeIn?: boolean,\n disableLongClick?: boolean,\n height?: number | string;\n loading: Loading;\n onError?: () => void;\n onLoad?: () => void;\n resizeMode: ResizeMode;\n source: ImageSource;\n width?: number | string;\n}> {}"],"mappings":""}
|
|
@@ -11,6 +11,8 @@ var _reactNative = require("react-native");
|
|
|
11
11
|
|
|
12
12
|
var _ButtonBase = _interopRequireDefault(require("../ButtonBase"));
|
|
13
13
|
|
|
14
|
+
var _Column = _interopRequireDefault(require("../Column"));
|
|
15
|
+
|
|
14
16
|
var _internal = require("../internal");
|
|
15
17
|
|
|
16
18
|
var _Row = _interopRequireDefault(require("../Row"));
|
|
@@ -21,6 +23,8 @@ var _utils = require("../utils");
|
|
|
21
23
|
|
|
22
24
|
var _RadioContextProvider = require("../RadioGroup/RadioContextProvider");
|
|
23
25
|
|
|
26
|
+
var _Typography = _interopRequireDefault(require("../Typography"));
|
|
27
|
+
|
|
24
28
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
25
29
|
|
|
26
30
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
@@ -60,6 +64,7 @@ function Radio(props) {
|
|
|
60
64
|
startIcon: startIconProp,
|
|
61
65
|
style,
|
|
62
66
|
value,
|
|
67
|
+
description,
|
|
63
68
|
...otherProps
|
|
64
69
|
} = props;
|
|
65
70
|
const theme = (0, _styles.useTheme)();
|
|
@@ -96,13 +101,21 @@ function Radio(props) {
|
|
|
96
101
|
disabled: disabled,
|
|
97
102
|
onPress: handlePress,
|
|
98
103
|
style: rootStyle
|
|
99
|
-
}, otherProps), /*#__PURE__*/_react.default.createElement(
|
|
104
|
+
}, otherProps), /*#__PURE__*/_react.default.createElement(_Column.default, {
|
|
105
|
+
gap: 2,
|
|
106
|
+
flexShrink: 1
|
|
107
|
+
}, /*#__PURE__*/_react.default.createElement(_Row.default, {
|
|
100
108
|
alignItems: 'center',
|
|
101
109
|
style: styles.content
|
|
102
110
|
}, startIcon, /*#__PURE__*/_react.default.createElement(_reactNative.Text, {
|
|
103
111
|
children: children,
|
|
104
112
|
style: fontStyle
|
|
105
|
-
})),
|
|
113
|
+
})), description ? /*#__PURE__*/_react.default.createElement(_Typography.default, {
|
|
114
|
+
variant: 'body3',
|
|
115
|
+
color: 'base',
|
|
116
|
+
weight: 'regular',
|
|
117
|
+
children: description
|
|
118
|
+
}) : null), icon);
|
|
106
119
|
}
|
|
107
120
|
|
|
108
121
|
;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["DEFAULT_START_ICON_SIZE","useStyles","theme","useTheme","root","alignItems","borderBottomColor","palette","border","weak","borderBottomWidth","flexDirection","gap","justifyContent","paddingVertical","content","minHeight","Radio","props","checked","children","checkedIcon","checkIconProp","disabled","onChange","onChangeProp","startIcon","startIconProp","style","value","otherProps","styles","context","useContext","RadioContext","handlePress","isChecked","defaultCheckedIcon","icon","cloneElementSafely","color","height","width","rootStyle","css","fontStyle","createFontStyle","selector","typography","body1","regular","text","strong"],"sources":["Radio.tsx"],"sourcesContent":["import React, { useContext } from 'react';\nimport { Text } from 'react-native';\nimport type { NamedStylesStringUnion, UseStyles } from '@fountain-ui/styles';\nimport ButtonBase from '../ButtonBase';\nimport { Check as CheckedIcon } from '../internal';\nimport Row from '../Row';\nimport { createFontStyle, css, useTheme } from '../styles';\nimport { cloneElementSafely } from '../utils';\nimport { RadioContext } from '../RadioGroup/RadioContextProvider';\nimport type RadioProps from './RadioProps';\n\nconst DEFAULT_START_ICON_SIZE = 21;\n\ntype RadioStyles = NamedStylesStringUnion<'root' | 'content'>;\n\nconst useStyles: UseStyles<RadioStyles> = function (): RadioStyles {\n const theme = useTheme();\n\n return {\n root: {\n alignItems: 'center',\n borderBottomColor: theme.palette.border.weak,\n borderBottomWidth: 0.5,\n flexDirection: 'row',\n gap: 32,\n justifyContent: 'space-between',\n paddingVertical: 14,\n },\n content: {\n gap: 8,\n minHeight: 20,\n },\n };\n};\n\nexport default function Radio(props: RadioProps) {\n const {\n checked = false,\n children,\n checkedIcon: checkIconProp,\n disabled = false,\n onChange: onChangeProp,\n startIcon: startIconProp,\n style,\n value,\n ...otherProps\n } = props;\n\n const theme = useTheme();\n\n const styles = useStyles();\n\n const context = useContext(RadioContext);\n\n const handlePress = () => {\n const onChange = context?.onChange ?? onChangeProp;\n if (onChange) {\n onChange(value);\n }\n };\n\n const isChecked = context?.value === value ?? checked;\n\n const defaultCheckedIcon = (\n <CheckedIcon color={'accent'}/>\n );\n\n const checkedIcon = checkIconProp ?? defaultCheckedIcon;\n const icon = isChecked ? checkedIcon : null;\n\n const startIcon = cloneElementSafely(startIconProp, {\n color: 'strong',\n height: DEFAULT_START_ICON_SIZE,\n width: DEFAULT_START_ICON_SIZE,\n });\n\n const rootStyle = css([\n styles.root,\n style,\n ]);\n\n const fontStyle = createFontStyle(theme, {\n selector: (typography) => typography.body1.regular,\n color: theme.palette.text.strong,\n });\n\n return (\n <ButtonBase\n disabled={disabled}\n onPress={handlePress}\n style={rootStyle}\n {...otherProps}\n >\n <Row\n
|
|
1
|
+
{"version":3,"names":["DEFAULT_START_ICON_SIZE","useStyles","theme","useTheme","root","alignItems","borderBottomColor","palette","border","weak","borderBottomWidth","flexDirection","gap","justifyContent","paddingVertical","content","minHeight","Radio","props","checked","children","checkedIcon","checkIconProp","disabled","onChange","onChangeProp","startIcon","startIconProp","style","value","description","otherProps","styles","context","useContext","RadioContext","handlePress","isChecked","defaultCheckedIcon","icon","cloneElementSafely","color","height","width","rootStyle","css","fontStyle","createFontStyle","selector","typography","body1","regular","text","strong"],"sources":["Radio.tsx"],"sourcesContent":["import React, { useContext } from 'react';\nimport { Text } from 'react-native';\nimport type { NamedStylesStringUnion, UseStyles } from '@fountain-ui/styles';\nimport ButtonBase from '../ButtonBase';\nimport Column from '../Column';\nimport { Check as CheckedIcon } from '../internal';\nimport Row from '../Row';\nimport { createFontStyle, css, useTheme } from '../styles';\nimport { cloneElementSafely } from '../utils';\nimport { RadioContext } from '../RadioGroup/RadioContextProvider';\nimport type RadioProps from './RadioProps';\nimport Typography from '../Typography';\n\nconst DEFAULT_START_ICON_SIZE = 21;\n\ntype RadioStyles = NamedStylesStringUnion<'root' | 'content'>;\n\nconst useStyles: UseStyles<RadioStyles> = function (): RadioStyles {\n const theme = useTheme();\n\n return {\n root: {\n alignItems: 'center',\n borderBottomColor: theme.palette.border.weak,\n borderBottomWidth: 0.5,\n flexDirection: 'row',\n gap: 32,\n justifyContent: 'space-between',\n paddingVertical: 14,\n },\n content: {\n gap: 8,\n minHeight: 20,\n },\n };\n};\n\nexport default function Radio(props: RadioProps) {\n const {\n checked = false,\n children,\n checkedIcon: checkIconProp,\n disabled = false,\n onChange: onChangeProp,\n startIcon: startIconProp,\n style,\n value,\n description,\n ...otherProps\n } = props;\n\n const theme = useTheme();\n\n const styles = useStyles();\n\n const context = useContext(RadioContext);\n\n const handlePress = () => {\n const onChange = context?.onChange ?? onChangeProp;\n if (onChange) {\n onChange(value);\n }\n };\n\n const isChecked = context?.value === value ?? checked;\n\n const defaultCheckedIcon = (\n <CheckedIcon color={'accent'}/>\n );\n\n const checkedIcon = checkIconProp ?? defaultCheckedIcon;\n const icon = isChecked ? checkedIcon : null;\n\n const startIcon = cloneElementSafely(startIconProp, {\n color: 'strong',\n height: DEFAULT_START_ICON_SIZE,\n width: DEFAULT_START_ICON_SIZE,\n });\n\n const rootStyle = css([\n styles.root,\n style,\n ]);\n\n const fontStyle = createFontStyle(theme, {\n selector: (typography) => typography.body1.regular,\n color: theme.palette.text.strong,\n });\n\n return (\n <ButtonBase\n disabled={disabled}\n onPress={handlePress}\n style={rootStyle}\n {...otherProps}\n >\n <Column\n gap={2}\n flexShrink={1}\n >\n <Row\n alignItems={'center'}\n style={styles.content}\n >\n {startIcon}\n\n <Text\n children={children}\n style={fontStyle}\n />\n </Row>\n\n {description ? (\n <Typography\n variant={'body3'}\n color={'base'}\n weight={'regular'}\n children={description}\n />\n ) : null}\n </Column>\n\n {icon}\n </ButtonBase>\n );\n};\n"],"mappings":";;;;;;;AAAA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA;;;;;;;;;;AAEA,MAAMA,uBAAuB,GAAG,EAAhC;;AAIA,MAAMC,SAAiC,GAAG,YAAyB;EAC/D,MAAMC,KAAK,GAAG,IAAAC,gBAAA,GAAd;EAEA,OAAO;IACHC,IAAI,EAAE;MACFC,UAAU,EAAE,QADV;MAEFC,iBAAiB,EAAEJ,KAAK,CAACK,OAAN,CAAcC,MAAd,CAAqBC,IAFtC;MAGFC,iBAAiB,EAAE,GAHjB;MAIFC,aAAa,EAAE,KAJb;MAKFC,GAAG,EAAE,EALH;MAMFC,cAAc,EAAE,eANd;MAOFC,eAAe,EAAE;IAPf,CADH;IAUHC,OAAO,EAAE;MACLH,GAAG,EAAE,CADA;MAELI,SAAS,EAAE;IAFN;EAVN,CAAP;AAeH,CAlBD;;AAoBe,SAASC,KAAT,CAAeC,KAAf,EAAkC;EAC7C,MAAM;IACFC,OAAO,GAAG,KADR;IAEFC,QAFE;IAGFC,WAAW,EAAEC,aAHX;IAIFC,QAAQ,GAAG,KAJT;IAKFC,QAAQ,EAAEC,YALR;IAMFC,SAAS,EAAEC,aANT;IAOFC,KAPE;IAQFC,KARE;IASFC,WATE;IAUF,GAAGC;EAVD,IAWFb,KAXJ;EAaA,MAAMhB,KAAK,GAAG,IAAAC,gBAAA,GAAd;EAEA,MAAM6B,MAAM,GAAG/B,SAAS,EAAxB;EAEA,MAAMgC,O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AFhB,gBAII,6BAAC,YAAD;IACI,UAAU,EAAE,QADhB;IAEI,KAAK,EAAEC,MAAM,CAACjB;EAFlB,GAIKW,SAJL,eAMI,6BAAC,iBAAD;IACI,QAAQ,EAAEN,QADd;IAEI,KAAK,EAAE0B;EAFX,EANJ,CAJJ,EAgBKhB,WAAW,gBACR,6BAAC,mBAAD;IACI,OAAO,EAAE,OADb;IAEI,KAAK,EAAE,MAFX;IAGI,MAAM,EAAE,SAHZ;IAII,QAAQ,EAAEA;EAJd,EADQ,GAOR,IAvBR,CANJ,EAgCKS,IAhCL,CADJ;AAoCH;;AAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["RadioProps.ts"],"sourcesContent":["import React from 'react';\nimport type { OverridableComponentProps } from '../types';\nimport type { ButtonBaseProps } from '../ButtonBase';\n\ntype BaseProps = Omit<ButtonBaseProps, 'onPress' | 'children'>;\n\nexport default interface RadioProps extends OverridableComponentProps<BaseProps, {\n /**\n * If `true`, the component is checked.\n * @default false\n */\n checked?: boolean;\n\n /**\n * Custom icon element to display when the radio is checked.\n */\n checkedIcon?: React.ReactNode;\n\n /**\n * Content which is sharing pressable next to radio.\n */\n children?: string;\n\n /**\n * If `true`, the radio is disabled.\n * @default false\n */\n disabled?: boolean;\n\n /**\n * Callback fired when the component is pressed.\n */\n onChange?: (newValue: string) => void;\n\n /**\n * Element placed before the children.\n */\n startIcon?: React.ReactElement;\n\n /**\n * Value of the component.\n */\n value: string;\n}> {}\n"],"mappings":""}
|
|
1
|
+
{"version":3,"names":[],"sources":["RadioProps.ts"],"sourcesContent":["import React from 'react';\nimport type { OverridableComponentProps } from '../types';\nimport type { ButtonBaseProps } from '../ButtonBase';\n\ntype BaseProps = Omit<ButtonBaseProps, 'onPress' | 'children'>;\n\nexport default interface RadioProps extends OverridableComponentProps<BaseProps, {\n /**\n * If `true`, the component is checked.\n * @default false\n */\n checked?: boolean;\n\n /**\n * Custom icon element to display when the radio is checked.\n */\n checkedIcon?: React.ReactNode;\n\n /**\n * Content which is sharing pressable next to radio.\n */\n children?: string;\n\n /**\n * If `true`, the radio is disabled.\n * @default false\n */\n disabled?: boolean;\n\n /**\n * Callback fired when the component is pressed.\n */\n onChange?: (newValue: string) => void;\n\n /**\n * Element placed before the children.\n */\n startIcon?: React.ReactElement;\n\n /**\n * Value of the component.\n */\n value: string;\n\n\n /**\n * Helper text displayed below the children.\n */\n description?: string;\n}> {}\n"],"mappings":""}
|
|
@@ -29,6 +29,8 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
29
29
|
|
|
30
30
|
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); }
|
|
31
31
|
|
|
32
|
+
const isWeb = _reactNative.Platform.OS === 'web';
|
|
33
|
+
|
|
32
34
|
const styles = _reactNative.StyleSheet.create({
|
|
33
35
|
root: {
|
|
34
36
|
alignItems: 'center',
|
|
@@ -74,6 +76,7 @@ const TextField = /*#__PURE__*/_react.default.forwardRef(function TextField(prop
|
|
|
74
76
|
const {
|
|
75
77
|
autoFocus,
|
|
76
78
|
containerStyle: containerStyleProp,
|
|
79
|
+
multiline,
|
|
77
80
|
editable = true,
|
|
78
81
|
hint,
|
|
79
82
|
isLoading,
|
|
@@ -96,6 +99,16 @@ const TextField = /*#__PURE__*/_react.default.forwardRef(function TextField(prop
|
|
|
96
99
|
const theme = (0, _styles2.useTheme)();
|
|
97
100
|
const [isFocused, setIsFocused] = (0, _react.useState)(autoFocus ?? false);
|
|
98
101
|
const [secureTextEntry, setSecureTextEntry] = (0, _react.useState)(secureTextEntryProp ?? false);
|
|
102
|
+
const internalRef = (0, _react.useRef)(null);
|
|
103
|
+
const mergedRef = (0, _react.useCallback)(node => {
|
|
104
|
+
internalRef.current = node;
|
|
105
|
+
|
|
106
|
+
if (typeof ref === 'function') {
|
|
107
|
+
ref(node);
|
|
108
|
+
} else if (ref) {
|
|
109
|
+
ref.current = node;
|
|
110
|
+
}
|
|
111
|
+
}, [ref]);
|
|
99
112
|
const variantStyles = (0, _useVariantStyleMap.default)(variant, status, isFocused);
|
|
100
113
|
|
|
101
114
|
const handleBlur = event => {
|
|
@@ -112,6 +125,22 @@ const TextField = /*#__PURE__*/_react.default.forwardRef(function TextField(prop
|
|
|
112
125
|
setSecureTextEntry(current => !current);
|
|
113
126
|
};
|
|
114
127
|
|
|
128
|
+
const resizeHeight = (0, _react.useCallback)(() => {
|
|
129
|
+
const el = internalRef.current;
|
|
130
|
+
|
|
131
|
+
if (el) {
|
|
132
|
+
el.style.height = 'auto';
|
|
133
|
+
el.style.height = `${el.scrollHeight}px`;
|
|
134
|
+
}
|
|
135
|
+
}, []);
|
|
136
|
+
(0, _react.useLayoutEffect)(() => {
|
|
137
|
+
const shouldResizeHeight = multiline && isWeb;
|
|
138
|
+
|
|
139
|
+
if (shouldResizeHeight) {
|
|
140
|
+
resizeHeight();
|
|
141
|
+
}
|
|
142
|
+
}, [resizeHeight, multiline, value]);
|
|
143
|
+
|
|
115
144
|
const handleChangeText = text => {
|
|
116
145
|
onChangeTextProp === null || onChangeTextProp === void 0 ? void 0 : onChangeTextProp(text);
|
|
117
146
|
};
|
|
@@ -125,7 +154,7 @@ const TextField = /*#__PURE__*/_react.default.forwardRef(function TextField(prop
|
|
|
125
154
|
selector: typography => typography.caption1['semiBold'],
|
|
126
155
|
color: theme.palette.text.strong
|
|
127
156
|
});
|
|
128
|
-
const inputStyle = (0, _styles.css)([styles.input, variantStyles.inputStyle, variantStyles.inputFontStyle,
|
|
157
|
+
const inputStyle = (0, _styles.css)([styles.input, variantStyles.inputStyle, variantStyles.inputFontStyle, isWeb ? {
|
|
129
158
|
outlineWidth: 0
|
|
130
159
|
} : {}, styleProp]);
|
|
131
160
|
const placeholderFontStyle = (0, _styles.css)([variantStyles.inputFontStyle, {
|
|
@@ -162,10 +191,11 @@ const TextField = /*#__PURE__*/_react.default.forwardRef(function TextField(prop
|
|
|
162
191
|
onBlur: handleBlur,
|
|
163
192
|
onChangeText: handleChangeText,
|
|
164
193
|
onFocus: handleFocus,
|
|
165
|
-
ref:
|
|
194
|
+
ref: mergedRef,
|
|
166
195
|
secureTextEntry: secureTextEntry,
|
|
167
196
|
style: inputStyle,
|
|
168
|
-
value: value
|
|
197
|
+
value: value,
|
|
198
|
+
multiline: multiline
|
|
169
199
|
}, otherProps)))), showClearButton && value !== null && value !== void 0 && value.length && value.length > 0 ? /*#__PURE__*/_react.default.createElement(_IconButton.default, {
|
|
170
200
|
color: 'base',
|
|
171
201
|
children: /*#__PURE__*/_react.default.createElement(_icons.Clear, {
|