@cloud-ru/ds-uikit-product-card-predefined 1.0.0
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/CHANGELOG.md +8 -0
- package/LICENSE +201 -0
- package/README.md +808 -0
- package/dist/cjs/components/CardBanner/CardBanner.d.ts +31 -0
- package/dist/cjs/components/CardBanner/CardBanner.js +26 -0
- package/dist/cjs/components/CardBanner/index.d.ts +1 -0
- package/dist/cjs/components/CardBanner/index.js +17 -0
- package/dist/cjs/components/CardBanner/styles.module.css +52 -0
- package/dist/cjs/components/CardCustom/Body/Body.d.ts +15 -0
- package/dist/cjs/components/CardCustom/Body/Body.js +17 -0
- package/dist/cjs/components/CardCustom/Body/index.d.ts +1 -0
- package/dist/cjs/components/CardCustom/Body/index.js +17 -0
- package/dist/cjs/components/CardCustom/Body/styles.module.css +18 -0
- package/dist/cjs/components/CardCustom/CardCustom.d.ts +22 -0
- package/dist/cjs/components/CardCustom/CardCustom.js +19 -0
- package/dist/cjs/components/CardCustom/Footer/components/Action/Action.d.ts +14 -0
- package/dist/cjs/components/CardCustom/Footer/components/Action/Action.js +17 -0
- package/dist/cjs/components/CardCustom/Footer/components/Action/index.d.ts +1 -0
- package/dist/cjs/components/CardCustom/Footer/components/Action/index.js +17 -0
- package/dist/cjs/components/CardCustom/Footer/components/Action/styles.module.css +25 -0
- package/dist/cjs/components/CardCustom/Footer/components/CallToAction/CallToAction.d.ts +14 -0
- package/dist/cjs/components/CardCustom/Footer/components/CallToAction/CallToAction.js +17 -0
- package/dist/cjs/components/CardCustom/Footer/components/CallToAction/index.d.ts +1 -0
- package/dist/cjs/components/CardCustom/Footer/components/CallToAction/index.js +17 -0
- package/dist/cjs/components/CardCustom/Footer/components/CallToAction/styles.module.css +40 -0
- package/dist/cjs/components/CardCustom/Footer/components/Promo/Dimension/Dimension.d.ts +12 -0
- package/dist/cjs/components/CardCustom/Footer/components/Promo/Dimension/Dimension.js +16 -0
- package/dist/cjs/components/CardCustom/Footer/components/Promo/Dimension/constants.d.ts +3 -0
- package/dist/cjs/components/CardCustom/Footer/components/Promo/Dimension/constants.js +9 -0
- package/dist/cjs/components/CardCustom/Footer/components/Promo/Dimension/index.d.ts +1 -0
- package/dist/cjs/components/CardCustom/Footer/components/Promo/Dimension/index.js +17 -0
- package/dist/cjs/components/CardCustom/Footer/components/Promo/Dimension/styles.module.css +28 -0
- package/dist/cjs/components/CardCustom/Footer/components/Promo/Promo.d.ts +18 -0
- package/dist/cjs/components/CardCustom/Footer/components/Promo/Promo.js +19 -0
- package/dist/cjs/components/CardCustom/Footer/components/Promo/index.d.ts +1 -0
- package/dist/cjs/components/CardCustom/Footer/components/Promo/index.js +17 -0
- package/dist/cjs/components/CardCustom/Footer/components/Promo/styles.module.css +24 -0
- package/dist/cjs/components/CardCustom/Footer/components/index.d.ts +3 -0
- package/dist/cjs/components/CardCustom/Footer/components/index.js +9 -0
- package/dist/cjs/components/CardCustom/Footer/index.d.ts +9 -0
- package/dist/cjs/components/CardCustom/Footer/index.js +10 -0
- package/dist/cjs/components/CardCustom/FunctionBadge/FunctionBadge.d.ts +19 -0
- package/dist/cjs/components/CardCustom/FunctionBadge/FunctionBadge.js +47 -0
- package/dist/cjs/components/CardCustom/FunctionBadge/index.d.ts +1 -0
- package/dist/cjs/components/CardCustom/FunctionBadge/index.js +17 -0
- package/dist/cjs/components/CardCustom/FunctionBadge/styles.module.css +38 -0
- package/dist/cjs/components/CardCustom/Header/Header.d.ts +33 -0
- package/dist/cjs/components/CardCustom/Header/Header.js +22 -0
- package/dist/cjs/components/CardCustom/Header/constants.d.ts +9 -0
- package/dist/cjs/components/CardCustom/Header/constants.js +19 -0
- package/dist/cjs/components/CardCustom/Header/index.d.ts +1 -0
- package/dist/cjs/components/CardCustom/Header/index.js +17 -0
- package/dist/cjs/components/CardCustom/Header/styles.module.css +62 -0
- package/dist/cjs/components/CardCustom/Image/Image.d.ts +18 -0
- package/dist/cjs/components/CardCustom/Image/Image.js +16 -0
- package/dist/cjs/components/CardCustom/Image/constants.d.ts +5 -0
- package/dist/cjs/components/CardCustom/Image/constants.js +8 -0
- package/dist/cjs/components/CardCustom/Image/index.d.ts +2 -0
- package/dist/cjs/components/CardCustom/Image/index.js +17 -0
- package/dist/cjs/components/CardCustom/Image/styles.module.css +73 -0
- package/dist/cjs/components/CardCustom/Image/types.d.ts +3 -0
- package/dist/cjs/components/CardCustom/Image/types.js +2 -0
- package/dist/cjs/components/CardCustom/index.d.ts +1 -0
- package/dist/cjs/components/CardCustom/index.js +17 -0
- package/dist/cjs/components/CardCustom/shared.module.css +0 -0
- package/dist/cjs/components/CardService/CardService.d.ts +26 -0
- package/dist/cjs/components/CardService/CardService.js +19 -0
- package/dist/cjs/components/CardService/index.d.ts +1 -0
- package/dist/cjs/components/CardService/index.js +17 -0
- package/dist/cjs/components/CardService/styles.module.css +30 -0
- package/dist/cjs/components/CardServiceInfo/CardServiceInfo.d.ts +43 -0
- package/dist/cjs/components/CardServiceInfo/CardServiceInfo.js +70 -0
- package/dist/cjs/components/CardServiceInfo/index.d.ts +1 -0
- package/dist/cjs/components/CardServiceInfo/index.js +17 -0
- package/dist/cjs/components/CardServiceLight/CardServiceLight.d.ts +38 -0
- package/dist/cjs/components/CardServiceLight/CardServiceLight.js +49 -0
- package/dist/cjs/components/CardServiceLight/index.d.ts +1 -0
- package/dist/cjs/components/CardServiceLight/index.js +17 -0
- package/dist/cjs/components/CardServiceLight/styles.module.css +69 -0
- package/dist/cjs/components/CardServiceSmall/CardServiceSmall.d.ts +51 -0
- package/dist/cjs/components/CardServiceSmall/CardServiceSmall.js +48 -0
- package/dist/cjs/components/CardServiceSmall/index.d.ts +1 -0
- package/dist/cjs/components/CardServiceSmall/index.js +17 -0
- package/dist/cjs/components/CardServiceSmall/styles.module.css +61 -0
- package/dist/cjs/components/CardSuggest/CardSuggest.d.ts +43 -0
- package/dist/cjs/components/CardSuggest/CardSuggest.js +20 -0
- package/dist/cjs/components/CardSuggest/index.d.ts +1 -0
- package/dist/cjs/components/CardSuggest/index.js +17 -0
- package/dist/cjs/components/CardSuggest/styles.module.css +35 -0
- package/dist/cjs/components/index.d.ts +6 -0
- package/dist/cjs/components/index.js +22 -0
- package/dist/cjs/constants.d.ts +31 -0
- package/dist/cjs/constants.js +34 -0
- package/dist/cjs/functionBadgeContext.d.ts +6 -0
- package/dist/cjs/functionBadgeContext.js +8 -0
- package/dist/cjs/helperComponents/CardAction/CardAction.d.ts +9 -0
- package/dist/cjs/helperComponents/CardAction/CardAction.js +14 -0
- package/dist/cjs/helperComponents/CardAction/index.d.ts +1 -0
- package/dist/cjs/helperComponents/CardAction/index.js +17 -0
- package/dist/cjs/helperComponents/CardAction/styles.module.css +7 -0
- package/dist/cjs/helperComponents/CardActionsSurface/CardActionsSurface.d.ts +31 -0
- package/dist/cjs/helperComponents/CardActionsSurface/CardActionsSurface.js +34 -0
- package/dist/cjs/helperComponents/CardActionsSurface/index.d.ts +2 -0
- package/dist/cjs/helperComponents/CardActionsSurface/index.js +18 -0
- package/dist/cjs/helperComponents/CardActionsSurface/utils.d.ts +23 -0
- package/dist/cjs/helperComponents/CardActionsSurface/utils.js +45 -0
- package/dist/cjs/helperComponents/Emblem/Emblem.d.ts +8 -0
- package/dist/cjs/helperComponents/Emblem/Emblem.js +25 -0
- package/dist/cjs/helperComponents/Emblem/index.d.ts +1 -0
- package/dist/cjs/helperComponents/Emblem/index.js +17 -0
- package/dist/cjs/helperComponents/Emblem/styles.module.css +23 -0
- package/dist/cjs/helperComponents/FunctionBadgeWrapper/FunctionBadgeWrapper.d.ts +7 -0
- package/dist/cjs/helperComponents/FunctionBadgeWrapper/FunctionBadgeWrapper.js +15 -0
- package/dist/cjs/helperComponents/FunctionBadgeWrapper/index.d.ts +1 -0
- package/dist/cjs/helperComponents/FunctionBadgeWrapper/index.js +17 -0
- package/dist/cjs/helperComponents/FunctionBadgeWrapper/styles.module.css +43 -0
- package/dist/cjs/helperComponents/index.d.ts +3 -0
- package/dist/cjs/helperComponents/index.js +19 -0
- package/dist/cjs/index.d.ts +3 -0
- package/dist/cjs/index.js +19 -0
- package/dist/cjs/package.json +3 -0
- package/dist/cjs/style.css +629 -0
- package/dist/cjs/types.d.ts +17 -0
- package/dist/cjs/types.js +2 -0
- package/dist/esm/components/CardBanner/CardBanner.d.ts +31 -0
- package/dist/esm/components/CardBanner/CardBanner.js +20 -0
- package/dist/esm/components/CardBanner/index.d.ts +1 -0
- package/dist/esm/components/CardBanner/index.js +1 -0
- package/dist/esm/components/CardBanner/styles.module.css +52 -0
- package/dist/esm/components/CardCustom/Body/Body.d.ts +15 -0
- package/dist/esm/components/CardCustom/Body/Body.js +11 -0
- package/dist/esm/components/CardCustom/Body/index.d.ts +1 -0
- package/dist/esm/components/CardCustom/Body/index.js +1 -0
- package/dist/esm/components/CardCustom/Body/styles.module.css +18 -0
- package/dist/esm/components/CardCustom/CardCustom.d.ts +22 -0
- package/dist/esm/components/CardCustom/CardCustom.js +15 -0
- package/dist/esm/components/CardCustom/Footer/components/Action/Action.d.ts +14 -0
- package/dist/esm/components/CardCustom/Footer/components/Action/Action.js +11 -0
- package/dist/esm/components/CardCustom/Footer/components/Action/index.d.ts +1 -0
- package/dist/esm/components/CardCustom/Footer/components/Action/index.js +1 -0
- package/dist/esm/components/CardCustom/Footer/components/Action/styles.module.css +25 -0
- package/dist/esm/components/CardCustom/Footer/components/CallToAction/CallToAction.d.ts +14 -0
- package/dist/esm/components/CardCustom/Footer/components/CallToAction/CallToAction.js +11 -0
- package/dist/esm/components/CardCustom/Footer/components/CallToAction/index.d.ts +1 -0
- package/dist/esm/components/CardCustom/Footer/components/CallToAction/index.js +1 -0
- package/dist/esm/components/CardCustom/Footer/components/CallToAction/styles.module.css +40 -0
- package/dist/esm/components/CardCustom/Footer/components/Promo/Dimension/Dimension.d.ts +12 -0
- package/dist/esm/components/CardCustom/Footer/components/Promo/Dimension/Dimension.js +10 -0
- package/dist/esm/components/CardCustom/Footer/components/Promo/Dimension/constants.d.ts +3 -0
- package/dist/esm/components/CardCustom/Footer/components/Promo/Dimension/constants.js +6 -0
- package/dist/esm/components/CardCustom/Footer/components/Promo/Dimension/index.d.ts +1 -0
- package/dist/esm/components/CardCustom/Footer/components/Promo/Dimension/index.js +1 -0
- package/dist/esm/components/CardCustom/Footer/components/Promo/Dimension/styles.module.css +28 -0
- package/dist/esm/components/CardCustom/Footer/components/Promo/Promo.d.ts +18 -0
- package/dist/esm/components/CardCustom/Footer/components/Promo/Promo.js +13 -0
- package/dist/esm/components/CardCustom/Footer/components/Promo/index.d.ts +1 -0
- package/dist/esm/components/CardCustom/Footer/components/Promo/index.js +1 -0
- package/dist/esm/components/CardCustom/Footer/components/Promo/styles.module.css +24 -0
- package/dist/esm/components/CardCustom/Footer/components/index.d.ts +3 -0
- package/dist/esm/components/CardCustom/Footer/components/index.js +3 -0
- package/dist/esm/components/CardCustom/Footer/index.d.ts +9 -0
- package/dist/esm/components/CardCustom/Footer/index.js +7 -0
- package/dist/esm/components/CardCustom/FunctionBadge/FunctionBadge.d.ts +19 -0
- package/dist/esm/components/CardCustom/FunctionBadge/FunctionBadge.js +41 -0
- package/dist/esm/components/CardCustom/FunctionBadge/index.d.ts +1 -0
- package/dist/esm/components/CardCustom/FunctionBadge/index.js +1 -0
- package/dist/esm/components/CardCustom/FunctionBadge/styles.module.css +38 -0
- package/dist/esm/components/CardCustom/Header/Header.d.ts +33 -0
- package/dist/esm/components/CardCustom/Header/Header.js +16 -0
- package/dist/esm/components/CardCustom/Header/constants.d.ts +9 -0
- package/dist/esm/components/CardCustom/Header/constants.js +16 -0
- package/dist/esm/components/CardCustom/Header/index.d.ts +1 -0
- package/dist/esm/components/CardCustom/Header/index.js +1 -0
- package/dist/esm/components/CardCustom/Header/styles.module.css +62 -0
- package/dist/esm/components/CardCustom/Image/Image.d.ts +18 -0
- package/dist/esm/components/CardCustom/Image/Image.js +10 -0
- package/dist/esm/components/CardCustom/Image/constants.d.ts +5 -0
- package/dist/esm/components/CardCustom/Image/constants.js +5 -0
- package/dist/esm/components/CardCustom/Image/index.d.ts +2 -0
- package/dist/esm/components/CardCustom/Image/index.js +1 -0
- package/dist/esm/components/CardCustom/Image/styles.module.css +73 -0
- package/dist/esm/components/CardCustom/Image/types.d.ts +3 -0
- package/dist/esm/components/CardCustom/Image/types.js +1 -0
- package/dist/esm/components/CardCustom/index.d.ts +1 -0
- package/dist/esm/components/CardCustom/index.js +1 -0
- package/dist/esm/components/CardCustom/shared.module.css +0 -0
- package/dist/esm/components/CardService/CardService.d.ts +26 -0
- package/dist/esm/components/CardService/CardService.js +13 -0
- package/dist/esm/components/CardService/index.d.ts +1 -0
- package/dist/esm/components/CardService/index.js +1 -0
- package/dist/esm/components/CardService/styles.module.css +30 -0
- package/dist/esm/components/CardServiceInfo/CardServiceInfo.d.ts +43 -0
- package/dist/esm/components/CardServiceInfo/CardServiceInfo.js +64 -0
- package/dist/esm/components/CardServiceInfo/index.d.ts +1 -0
- package/dist/esm/components/CardServiceInfo/index.js +1 -0
- package/dist/esm/components/CardServiceLight/CardServiceLight.d.ts +38 -0
- package/dist/esm/components/CardServiceLight/CardServiceLight.js +43 -0
- package/dist/esm/components/CardServiceLight/index.d.ts +1 -0
- package/dist/esm/components/CardServiceLight/index.js +1 -0
- package/dist/esm/components/CardServiceLight/styles.module.css +69 -0
- package/dist/esm/components/CardServiceSmall/CardServiceSmall.d.ts +51 -0
- package/dist/esm/components/CardServiceSmall/CardServiceSmall.js +42 -0
- package/dist/esm/components/CardServiceSmall/index.d.ts +1 -0
- package/dist/esm/components/CardServiceSmall/index.js +1 -0
- package/dist/esm/components/CardServiceSmall/styles.module.css +61 -0
- package/dist/esm/components/CardSuggest/CardSuggest.d.ts +43 -0
- package/dist/esm/components/CardSuggest/CardSuggest.js +14 -0
- package/dist/esm/components/CardSuggest/index.d.ts +1 -0
- package/dist/esm/components/CardSuggest/index.js +1 -0
- package/dist/esm/components/CardSuggest/styles.module.css +35 -0
- package/dist/esm/components/index.d.ts +6 -0
- package/dist/esm/components/index.js +6 -0
- package/dist/esm/constants.d.ts +31 -0
- package/dist/esm/constants.js +31 -0
- package/dist/esm/functionBadgeContext.d.ts +6 -0
- package/dist/esm/functionBadgeContext.js +5 -0
- package/dist/esm/helperComponents/CardAction/CardAction.d.ts +9 -0
- package/dist/esm/helperComponents/CardAction/CardAction.js +8 -0
- package/dist/esm/helperComponents/CardAction/index.d.ts +1 -0
- package/dist/esm/helperComponents/CardAction/index.js +1 -0
- package/dist/esm/helperComponents/CardAction/styles.module.css +7 -0
- package/dist/esm/helperComponents/CardActionsSurface/CardActionsSurface.d.ts +31 -0
- package/dist/esm/helperComponents/CardActionsSurface/CardActionsSurface.js +28 -0
- package/dist/esm/helperComponents/CardActionsSurface/index.d.ts +2 -0
- package/dist/esm/helperComponents/CardActionsSurface/index.js +2 -0
- package/dist/esm/helperComponents/CardActionsSurface/utils.d.ts +23 -0
- package/dist/esm/helperComponents/CardActionsSurface/utils.js +42 -0
- package/dist/esm/helperComponents/Emblem/Emblem.d.ts +8 -0
- package/dist/esm/helperComponents/Emblem/Emblem.js +19 -0
- package/dist/esm/helperComponents/Emblem/index.d.ts +1 -0
- package/dist/esm/helperComponents/Emblem/index.js +1 -0
- package/dist/esm/helperComponents/Emblem/styles.module.css +23 -0
- package/dist/esm/helperComponents/FunctionBadgeWrapper/FunctionBadgeWrapper.d.ts +7 -0
- package/dist/esm/helperComponents/FunctionBadgeWrapper/FunctionBadgeWrapper.js +9 -0
- package/dist/esm/helperComponents/FunctionBadgeWrapper/index.d.ts +1 -0
- package/dist/esm/helperComponents/FunctionBadgeWrapper/index.js +1 -0
- package/dist/esm/helperComponents/FunctionBadgeWrapper/styles.module.css +43 -0
- package/dist/esm/helperComponents/index.d.ts +3 -0
- package/dist/esm/helperComponents/index.js +3 -0
- package/dist/esm/index.d.ts +3 -0
- package/dist/esm/index.js +3 -0
- package/dist/esm/style.css +629 -0
- package/dist/esm/types.d.ts +17 -0
- package/dist/esm/types.js +1 -0
- package/dist/tsconfig.cjs.tsbuildinfo +1 -0
- package/dist/tsconfig.esm.tsbuildinfo +1 -0
- package/package.json +53 -0
- package/src/components/CardBanner/CardBanner.tsx +112 -0
- package/src/components/CardBanner/index.ts +1 -0
- package/src/components/CardBanner/styles.module.scss +59 -0
- package/src/components/CardCustom/Body/Body.tsx +28 -0
- package/src/components/CardCustom/Body/index.ts +1 -0
- package/src/components/CardCustom/Body/styles.module.scss +16 -0
- package/src/components/CardCustom/CardCustom.ts +37 -0
- package/src/components/CardCustom/Footer/components/Action/Action.tsx +36 -0
- package/src/components/CardCustom/Footer/components/Action/index.ts +1 -0
- package/src/components/CardCustom/Footer/components/Action/styles.module.scss +20 -0
- package/src/components/CardCustom/Footer/components/CallToAction/CallToAction.tsx +31 -0
- package/src/components/CardCustom/Footer/components/CallToAction/index.ts +1 -0
- package/src/components/CardCustom/Footer/components/CallToAction/styles.module.scss +36 -0
- package/src/components/CardCustom/Footer/components/Promo/Dimension/Dimension.tsx +42 -0
- package/src/components/CardCustom/Footer/components/Promo/Dimension/constants.ts +8 -0
- package/src/components/CardCustom/Footer/components/Promo/Dimension/index.ts +1 -0
- package/src/components/CardCustom/Footer/components/Promo/Dimension/styles.module.scss +32 -0
- package/src/components/CardCustom/Footer/components/Promo/Promo.tsx +34 -0
- package/src/components/CardCustom/Footer/components/Promo/index.ts +1 -0
- package/src/components/CardCustom/Footer/components/Promo/styles.module.scss +18 -0
- package/src/components/CardCustom/Footer/components/index.ts +3 -0
- package/src/components/CardCustom/Footer/index.ts +17 -0
- package/src/components/CardCustom/FunctionBadge/FunctionBadge.tsx +92 -0
- package/src/components/CardCustom/FunctionBadge/index.ts +1 -0
- package/src/components/CardCustom/FunctionBadge/styles.module.scss +52 -0
- package/src/components/CardCustom/Header/Header.tsx +94 -0
- package/src/components/CardCustom/Header/constants.ts +20 -0
- package/src/components/CardCustom/Header/index.ts +1 -0
- package/src/components/CardCustom/Header/styles.module.scss +55 -0
- package/src/components/CardCustom/Image/Image.tsx +36 -0
- package/src/components/CardCustom/Image/constants.ts +5 -0
- package/src/components/CardCustom/Image/index.ts +2 -0
- package/src/components/CardCustom/Image/styles.module.scss +79 -0
- package/src/components/CardCustom/Image/types.ts +5 -0
- package/src/components/CardCustom/index.ts +1 -0
- package/src/components/CardCustom/shared.module.scss +18 -0
- package/src/components/CardService/CardService.tsx +77 -0
- package/src/components/CardService/index.ts +1 -0
- package/src/components/CardService/styles.module.scss +32 -0
- package/src/components/CardServiceLight/CardServiceLight.tsx +160 -0
- package/src/components/CardServiceLight/index.ts +1 -0
- package/src/components/CardServiceLight/styles.module.scss +91 -0
- package/src/components/CardServiceSmall/CardServiceSmall.tsx +179 -0
- package/src/components/CardServiceSmall/index.ts +1 -0
- package/src/components/CardServiceSmall/styles.module.scss +74 -0
- package/src/components/CardSuggest/CardSuggest.tsx +102 -0
- package/src/components/CardSuggest/index.ts +1 -0
- package/src/components/CardSuggest/styles.module.scss +45 -0
- package/src/components/index.ts +6 -0
- package/src/constants.ts +34 -0
- package/src/functionBadgeContext.tsx +11 -0
- package/src/helperComponents/CardAction/CardAction.tsx +25 -0
- package/src/helperComponents/CardAction/index.ts +1 -0
- package/src/helperComponents/CardAction/styles.module.scss +11 -0
- package/src/helperComponents/Emblem/Emblem.tsx +48 -0
- package/src/helperComponents/Emblem/index.ts +1 -0
- package/src/helperComponents/Emblem/styles.module.scss +30 -0
- package/src/helperComponents/FunctionBadgeWrapper/FunctionBadgeWrapper.tsx +25 -0
- package/src/helperComponents/FunctionBadgeWrapper/index.ts +1 -0
- package/src/helperComponents/FunctionBadgeWrapper/styles.module.scss +60 -0
- package/src/helperComponents/index.ts +3 -0
- package/src/index.ts +3 -0
- package/src/types.ts +20 -0
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { Button } from '@cloud-ru/ds-button';
|
|
2
|
+
import { Card, PolymorphicRef } from '@cloud-ru/ds-card';
|
|
3
|
+
import { CrossSVG } from '@cloud-ru/ds-icons/interface/system';
|
|
4
|
+
import { TruncateString } from '@cloud-ru/ds-truncate-string';
|
|
5
|
+
import { Typography } from '@cloud-ru/ds-typography';
|
|
6
|
+
import { withInnerRefSupport } from '@cloud-ru/ds-utils';
|
|
7
|
+
import cn from 'classnames';
|
|
8
|
+
import { ComponentPropsWithoutRef, ElementType, MouseEventHandler, ReactElement, useCallback } from 'react';
|
|
9
|
+
|
|
10
|
+
import { TEST_IDS } from '../../constants';
|
|
11
|
+
import { CardAction } from '../../helperComponents';
|
|
12
|
+
import styles from './styles.module.scss';
|
|
13
|
+
|
|
14
|
+
type BaseCardBannerProps = {
|
|
15
|
+
/** Заголовок карточки */
|
|
16
|
+
title: string;
|
|
17
|
+
/** Описание */
|
|
18
|
+
content: string;
|
|
19
|
+
/** Текст кнопки действия */
|
|
20
|
+
actionLabel: string;
|
|
21
|
+
/** Изображение */
|
|
22
|
+
image: {
|
|
23
|
+
src: string;
|
|
24
|
+
alt: string;
|
|
25
|
+
};
|
|
26
|
+
/** Колбэк закрытия. При наличии отображается кнопка «Закрыть» */
|
|
27
|
+
onClose?: MouseEventHandler<HTMLElement>;
|
|
28
|
+
/** Неактивное состояние */
|
|
29
|
+
disabled?: boolean;
|
|
30
|
+
/** CSS-класс корневого элемента */
|
|
31
|
+
className?: string;
|
|
32
|
+
/** Support prop для тестов */
|
|
33
|
+
'data-test-id'?: string;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export type CardBannerProps<T extends ElementType = 'div'> = BaseCardBannerProps & {
|
|
37
|
+
/** Полиморфный элемент: `'div'`, `'a'`, `{Link}` и т.д. */
|
|
38
|
+
as?: T;
|
|
39
|
+
/** Ref на реальный DOM-элемент / инстанс */
|
|
40
|
+
innerRef?: PolymorphicRef<T>;
|
|
41
|
+
} & Omit<ComponentPropsWithoutRef<T>, keyof BaseCardBannerProps | 'as' | 'ref'>;
|
|
42
|
+
|
|
43
|
+
export function CardBanner<T extends ElementType = 'div'>({
|
|
44
|
+
title,
|
|
45
|
+
content,
|
|
46
|
+
actionLabel,
|
|
47
|
+
image,
|
|
48
|
+
onClose,
|
|
49
|
+
disabled,
|
|
50
|
+
className,
|
|
51
|
+
as,
|
|
52
|
+
innerRef,
|
|
53
|
+
'data-test-id': dataTestId,
|
|
54
|
+
...rest
|
|
55
|
+
}: CardBannerProps<T>): ReactElement | null {
|
|
56
|
+
const handleClose: MouseEventHandler<HTMLButtonElement> = useCallback(
|
|
57
|
+
e => {
|
|
58
|
+
e.stopPropagation();
|
|
59
|
+
onClose?.(e);
|
|
60
|
+
},
|
|
61
|
+
[onClose],
|
|
62
|
+
);
|
|
63
|
+
|
|
64
|
+
return (
|
|
65
|
+
<Card<T>
|
|
66
|
+
as={as}
|
|
67
|
+
innerRef={innerRef}
|
|
68
|
+
disabled={disabled}
|
|
69
|
+
interactive
|
|
70
|
+
className={cn(styles.root, className)}
|
|
71
|
+
data-test-id={dataTestId ?? TEST_IDS.cardBanner}
|
|
72
|
+
{...(rest as ComponentPropsWithoutRef<T>)}
|
|
73
|
+
>
|
|
74
|
+
{onClose && (
|
|
75
|
+
<div className={styles.closeButton}>
|
|
76
|
+
<Button
|
|
77
|
+
view='tonal'
|
|
78
|
+
appearance='neutral'
|
|
79
|
+
size='s'
|
|
80
|
+
icon={<CrossSVG />}
|
|
81
|
+
onClick={handleClose}
|
|
82
|
+
data-test-id={TEST_IDS.cardBannerClose}
|
|
83
|
+
/>
|
|
84
|
+
</div>
|
|
85
|
+
)}
|
|
86
|
+
|
|
87
|
+
<div className={styles.content}>
|
|
88
|
+
<div className={styles.left}>
|
|
89
|
+
<Typography as='p' variant='title' size='m' className={styles.title}>
|
|
90
|
+
<TruncateString key={title} text={title} maxLines={2} variant='end' />
|
|
91
|
+
</Typography>
|
|
92
|
+
|
|
93
|
+
<Typography as='p' variant='body' size='m' className={styles.description}>
|
|
94
|
+
<TruncateString
|
|
95
|
+
key={content}
|
|
96
|
+
text={content}
|
|
97
|
+
maxLines={2}
|
|
98
|
+
variant='end'
|
|
99
|
+
data-test-id={TEST_IDS.cardBannerContent}
|
|
100
|
+
/>
|
|
101
|
+
</Typography>
|
|
102
|
+
|
|
103
|
+
<CardAction actionLabel={actionLabel} />
|
|
104
|
+
</div>
|
|
105
|
+
|
|
106
|
+
<img src={image.src} alt={image.alt} className={styles.image} data-test-id={TEST_IDS.cardBannerImage} />
|
|
107
|
+
</div>
|
|
108
|
+
</Card>
|
|
109
|
+
);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
withInnerRefSupport(CardBanner);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './CardBanner';
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
@use '@cloud-ru/ds-figma-variables/build/scss/styles/styles.module' as base;
|
|
2
|
+
|
|
3
|
+
.root {
|
|
4
|
+
position: relative;
|
|
5
|
+
box-sizing: border-box;
|
|
6
|
+
padding: base.$sn-primitive-dimension-16;
|
|
7
|
+
text-decoration: none;
|
|
8
|
+
|
|
9
|
+
.closeButton {
|
|
10
|
+
position: absolute;
|
|
11
|
+
top: base.$sn-primitive-dimension-8;
|
|
12
|
+
right: base.$sn-primitive-dimension-8;
|
|
13
|
+
visibility: hidden;
|
|
14
|
+
|
|
15
|
+
@media (hover: none) {
|
|
16
|
+
visibility: visible;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
&:hover,
|
|
21
|
+
&:focus-within {
|
|
22
|
+
.closeButton {
|
|
23
|
+
visibility: visible;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.content {
|
|
29
|
+
display: flex;
|
|
30
|
+
flex-direction: row;
|
|
31
|
+
gap: base.$sn-primitive-dimension-16;
|
|
32
|
+
align-items: flex-start;
|
|
33
|
+
|
|
34
|
+
width: 100%;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.left {
|
|
38
|
+
display: flex;
|
|
39
|
+
flex: 1;
|
|
40
|
+
flex-direction: column;
|
|
41
|
+
gap: base.$sn-primitive-dimension-12;
|
|
42
|
+
|
|
43
|
+
min-width: 0;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.title {
|
|
47
|
+
color: base.$sn-theme-color-available-version-textMain;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.description {
|
|
51
|
+
color: base.$sn-theme-color-available-version-textSecondary;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.image {
|
|
55
|
+
flex-shrink: 0;
|
|
56
|
+
width: base.$sn-primitive-dimension-96;
|
|
57
|
+
height: base.$sn-primitive-dimension-96;
|
|
58
|
+
object-fit: cover;
|
|
59
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Size, useCardContext } from '@cloud-ru/ds-card';
|
|
2
|
+
import { extractSupportProps, WithSupportProps } from '@cloud-ru/ds-utils';
|
|
3
|
+
import cn from 'classnames';
|
|
4
|
+
import { ReactNode } from 'react';
|
|
5
|
+
|
|
6
|
+
import styles from './styles.module.scss';
|
|
7
|
+
|
|
8
|
+
export type BodyProps = WithSupportProps<{
|
|
9
|
+
/** Произвольное содержимое тела карточки */
|
|
10
|
+
children: ReactNode;
|
|
11
|
+
/** CSS-класс */
|
|
12
|
+
className?: string;
|
|
13
|
+
/** Размер */
|
|
14
|
+
size?: Size;
|
|
15
|
+
}>;
|
|
16
|
+
|
|
17
|
+
export function Body({ children, className, size: sizeProp, ...rest }: BodyProps) {
|
|
18
|
+
const { radius } = useCardContext();
|
|
19
|
+
const size = sizeProp ?? radius;
|
|
20
|
+
|
|
21
|
+
return (
|
|
22
|
+
<div className={cn(styles.body, className)} {...extractSupportProps(rest)} data-size={size}>
|
|
23
|
+
{children}
|
|
24
|
+
</div>
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
Body.displayName = 'CardCustom.Body';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Body';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
@use '@cloud-ru/ds-figma-variables/build/scss/styles/styles.module' as base;
|
|
2
|
+
@use '../shared.module' as shared;
|
|
3
|
+
|
|
4
|
+
.body {
|
|
5
|
+
box-sizing: border-box;
|
|
6
|
+
width: 100%;
|
|
7
|
+
min-width: 0;
|
|
8
|
+
max-width: 100%;
|
|
9
|
+
|
|
10
|
+
@each $size in shared.$sizes {
|
|
11
|
+
&[data-size='#{$size}'] {
|
|
12
|
+
padding-right: base.simple-var(shared.$size-to-content-padding, $size);
|
|
13
|
+
padding-left: base.simple-var(shared.$size-to-content-padding, $size);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Body, BodyProps as BodyComponentProps } from './Body';
|
|
2
|
+
import { Footer } from './Footer';
|
|
3
|
+
import { FunctionBadge, FunctionBadgeProps as FunctionBadgeComponentProps } from './FunctionBadge';
|
|
4
|
+
import { Header, HeaderProps as HeaderComponentProps } from './Header';
|
|
5
|
+
import { Image, ImageProps as ImageComponentProps } from './Image';
|
|
6
|
+
|
|
7
|
+
export { MODE } from './Image/constants';
|
|
8
|
+
|
|
9
|
+
// import/export: declaration merging — const и одноимённый namespace `CardCustom`
|
|
10
|
+
// (compound API), правило видит два экспорта одного имени и не понимает слияние.
|
|
11
|
+
// eslint-disable-next-line import/export
|
|
12
|
+
export const CardCustom = {} as {
|
|
13
|
+
Header: typeof Header;
|
|
14
|
+
Body: typeof Body;
|
|
15
|
+
Footer: typeof Footer;
|
|
16
|
+
Image: typeof Image;
|
|
17
|
+
FunctionBadge: typeof FunctionBadge;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
CardCustom.Header = Header;
|
|
21
|
+
CardCustom.Body = Body;
|
|
22
|
+
CardCustom.Footer = Footer;
|
|
23
|
+
CardCustom.Image = Image;
|
|
24
|
+
CardCustom.FunctionBadge = FunctionBadge;
|
|
25
|
+
|
|
26
|
+
// import/export: тот же declaration merging — namespace дополняет const `CardCustom`
|
|
27
|
+
// публичными типами-членами компаунда.
|
|
28
|
+
// eslint-disable-next-line import/export
|
|
29
|
+
export namespace CardCustom {
|
|
30
|
+
export type HeaderProps = HeaderComponentProps;
|
|
31
|
+
export type BodyProps = BodyComponentProps;
|
|
32
|
+
export type FooterActionProps = Footer.ActionProps;
|
|
33
|
+
export type FooterPromoProps = Footer.PromoProps;
|
|
34
|
+
export type FooterCallToActionProps = Footer.CallToActionProps;
|
|
35
|
+
export type ImageProps = ImageComponentProps;
|
|
36
|
+
export type FunctionBadgeProps = FunctionBadgeComponentProps;
|
|
37
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { APPEARANCE, Button, ButtonProps, SIZE, VIEW } from '@cloud-ru/ds-button';
|
|
2
|
+
import { useCardContext } from '@cloud-ru/ds-card';
|
|
3
|
+
import { extractSupportProps, WithSupportProps } from '@cloud-ru/ds-utils';
|
|
4
|
+
import cn from 'classnames';
|
|
5
|
+
|
|
6
|
+
import styles from './styles.module.scss';
|
|
7
|
+
|
|
8
|
+
export type FooterActionProps = WithSupportProps<{
|
|
9
|
+
/** Параметры для основной кнопки */
|
|
10
|
+
button: Pick<ButtonProps, 'label' | 'onClick' | 'loading' | 'icon'>;
|
|
11
|
+
/** Параметры для вторичной кнопки */
|
|
12
|
+
secondaryButton?: Pick<ButtonProps, 'label' | 'onClick' | 'loading' | 'icon'>;
|
|
13
|
+
/** CSS-класс для элемента с контентом */
|
|
14
|
+
className?: string;
|
|
15
|
+
}>;
|
|
16
|
+
|
|
17
|
+
export function FooterAction({ button, secondaryButton, className, ...rest }: FooterActionProps) {
|
|
18
|
+
const { disabled, radius } = useCardContext();
|
|
19
|
+
|
|
20
|
+
return (
|
|
21
|
+
<div className={cn(styles.action, className)} data-size={radius} {...extractSupportProps(rest)}>
|
|
22
|
+
<Button {...button} view={VIEW.Filled} appearance={APPEARANCE.Primary} size={SIZE.M} disabled={disabled} />
|
|
23
|
+
{secondaryButton && (
|
|
24
|
+
<Button
|
|
25
|
+
{...secondaryButton}
|
|
26
|
+
view={VIEW.Tonal}
|
|
27
|
+
appearance={APPEARANCE.Neutral}
|
|
28
|
+
size={SIZE.M}
|
|
29
|
+
disabled={disabled}
|
|
30
|
+
/>
|
|
31
|
+
)}
|
|
32
|
+
</div>
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
FooterAction.displayName = 'CardCustom.Footer.Action';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Action';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
@use '@cloud-ru/ds-figma-variables/build/scss/styles/styles.module' as base;
|
|
2
|
+
@use '../../../shared.module' as shared;
|
|
3
|
+
|
|
4
|
+
.action {
|
|
5
|
+
display: flex;
|
|
6
|
+
gap: base.$sn-primitive-dimension-16;
|
|
7
|
+
align-items: center;
|
|
8
|
+
justify-content: flex-start;
|
|
9
|
+
|
|
10
|
+
box-sizing: border-box;
|
|
11
|
+
|
|
12
|
+
@each $size in shared.$sizes {
|
|
13
|
+
&[data-size='#{$size}'] {
|
|
14
|
+
margin-top: base.simple-var(shared.$size-to-content-gap, $size);
|
|
15
|
+
padding-right: base.simple-var(shared.$size-to-content-padding, $size);
|
|
16
|
+
padding-bottom: base.simple-var(shared.$size-to-content-padding, $size);
|
|
17
|
+
padding-left: base.simple-var(shared.$size-to-content-padding, $size);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { useCardContext } from '@cloud-ru/ds-card';
|
|
2
|
+
import { Typography, VARIANT } from '@cloud-ru/ds-typography';
|
|
3
|
+
import { extractSupportProps, WithSupportProps } from '@cloud-ru/ds-utils';
|
|
4
|
+
import cn from 'classnames';
|
|
5
|
+
import { ReactNode } from 'react';
|
|
6
|
+
|
|
7
|
+
import styles from './styles.module.scss';
|
|
8
|
+
|
|
9
|
+
export type FooterCallToActionProps = WithSupportProps<{
|
|
10
|
+
/** Лейбл */
|
|
11
|
+
label: string;
|
|
12
|
+
/** Иконка */
|
|
13
|
+
icon?: ReactNode;
|
|
14
|
+
/** CSS-класс для элемента с контентом */
|
|
15
|
+
className?: string;
|
|
16
|
+
}>;
|
|
17
|
+
|
|
18
|
+
export function FooterCallToAction({ label, icon, className, ...rest }: FooterCallToActionProps) {
|
|
19
|
+
const { radius } = useCardContext();
|
|
20
|
+
|
|
21
|
+
return (
|
|
22
|
+
<div className={cn(styles.callToAction, className)} data-size={radius} {...extractSupportProps(rest)}>
|
|
23
|
+
<Typography as='span' variant={VARIANT.label} size='l' className={styles.label}>
|
|
24
|
+
{label}
|
|
25
|
+
</Typography>
|
|
26
|
+
{icon && <span className={styles.icon}>{icon}</span>}
|
|
27
|
+
</div>
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
FooterCallToAction.displayName = 'CardCustom.Footer.CallToAction';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './CallToAction';
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
@use '@cloud-ru/ds-figma-variables/build/scss/styles/styles.module' as base;
|
|
2
|
+
@use '../../../shared.module' as shared;
|
|
3
|
+
|
|
4
|
+
.callToAction {
|
|
5
|
+
display: flex;
|
|
6
|
+
gap: base.$sn-primitive-dimension-4;
|
|
7
|
+
align-items: center;
|
|
8
|
+
justify-content: flex-start;
|
|
9
|
+
|
|
10
|
+
box-sizing: border-box;
|
|
11
|
+
|
|
12
|
+
@each $size in shared.$sizes {
|
|
13
|
+
&[data-size='#{$size}'] {
|
|
14
|
+
margin-top: base.simple-var(shared.$size-to-content-gap, $size);
|
|
15
|
+
padding-right: base.simple-var(shared.$size-to-content-padding, $size);
|
|
16
|
+
padding-bottom: base.simple-var(shared.$size-to-content-padding, $size);
|
|
17
|
+
padding-left: base.simple-var(shared.$size-to-content-padding, $size);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.icon {
|
|
23
|
+
display: flex;
|
|
24
|
+
align-items: center;
|
|
25
|
+
justify-content: center;
|
|
26
|
+
color: base.$sn-theme-color-primary-text;
|
|
27
|
+
|
|
28
|
+
svg {
|
|
29
|
+
width: base.$sn-density-size-icon-s !important; /* stylelint-disable-line declaration-no-important */
|
|
30
|
+
height: base.$sn-density-size-icon-s !important; /* stylelint-disable-line declaration-no-important */
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.label {
|
|
35
|
+
color: base.$sn-theme-color-primary-text;
|
|
36
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Size, useCardContext } from '@cloud-ru/ds-card';
|
|
2
|
+
import { Typography, VARIANT } from '@cloud-ru/ds-typography';
|
|
3
|
+
|
|
4
|
+
import { TYPOGRAPHY_SIZE_MAP } from './constants';
|
|
5
|
+
import styles from './styles.module.scss';
|
|
6
|
+
|
|
7
|
+
export type DimensionProps = {
|
|
8
|
+
/** Единица измерения */
|
|
9
|
+
dimension?: string;
|
|
10
|
+
/** Текущее значение */
|
|
11
|
+
currentValue: string;
|
|
12
|
+
/** Старое значение */
|
|
13
|
+
oldValue?: string;
|
|
14
|
+
/** Размер */
|
|
15
|
+
size?: Size;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export function Dimension({ dimension, currentValue, oldValue, size: sizeProp }: DimensionProps) {
|
|
19
|
+
const { radius } = useCardContext();
|
|
20
|
+
const size = TYPOGRAPHY_SIZE_MAP[sizeProp ?? radius];
|
|
21
|
+
|
|
22
|
+
return (
|
|
23
|
+
<div className={styles.wrapper}>
|
|
24
|
+
{dimension && (
|
|
25
|
+
<Typography as='span' variant={VARIANT.title} size={size} className={styles.dimension}>
|
|
26
|
+
{dimension}
|
|
27
|
+
</Typography>
|
|
28
|
+
)}
|
|
29
|
+
<div className={styles.valueContainer}>
|
|
30
|
+
<Typography as='span' variant={VARIANT.title} size={size} className={styles.currentValue}>
|
|
31
|
+
{currentValue}
|
|
32
|
+
</Typography>
|
|
33
|
+
|
|
34
|
+
{oldValue && (
|
|
35
|
+
<Typography as='span' variant={VARIANT.body} size='s' className={styles.oldValue}>
|
|
36
|
+
{oldValue}
|
|
37
|
+
</Typography>
|
|
38
|
+
)}
|
|
39
|
+
</div>
|
|
40
|
+
</div>
|
|
41
|
+
);
|
|
42
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Dimension';
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
@use '@cloud-ru/ds-figma-variables/build/scss/styles/styles.module' as base;
|
|
2
|
+
|
|
3
|
+
.wrapper {
|
|
4
|
+
display: flex;
|
|
5
|
+
flex: 1 0 auto;
|
|
6
|
+
gap: base.$sn-primitive-dimension-4;
|
|
7
|
+
justify-content: flex-end;
|
|
8
|
+
|
|
9
|
+
box-sizing: border-box;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.valueContainer {
|
|
13
|
+
display: flex;
|
|
14
|
+
flex-direction: column;
|
|
15
|
+
align-items: flex-end;
|
|
16
|
+
justify-content: flex-start;
|
|
17
|
+
|
|
18
|
+
box-sizing: border-box;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.currentValue {
|
|
22
|
+
color: base.$sn-theme-color-available-version-textMain;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.oldValue {
|
|
26
|
+
color: base.$sn-theme-color-available-version-textSecondary;
|
|
27
|
+
text-decoration: line-through;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.dimension {
|
|
31
|
+
color: base.$sn-theme-color-available-version-textSecondary;
|
|
32
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { APPEARANCE, Button, ButtonProps, SIZE, VIEW } from '@cloud-ru/ds-button';
|
|
2
|
+
import { Size, useCardContext } from '@cloud-ru/ds-card';
|
|
3
|
+
import { extractSupportProps, WithSupportProps } from '@cloud-ru/ds-utils';
|
|
4
|
+
import cn from 'classnames';
|
|
5
|
+
|
|
6
|
+
import { Dimension, DimensionProps } from './Dimension';
|
|
7
|
+
import styles from './styles.module.scss';
|
|
8
|
+
|
|
9
|
+
export type FooterPromoProps = WithSupportProps<{
|
|
10
|
+
/** Параметры для блока значений */
|
|
11
|
+
volume?: DimensionProps;
|
|
12
|
+
/** Параметры для основной кнопки */
|
|
13
|
+
button?: Pick<ButtonProps, 'label' | 'onClick' | 'loading' | 'icon'>;
|
|
14
|
+
/** CSS-класс для элемента с контентом */
|
|
15
|
+
className?: string;
|
|
16
|
+
/** Размер */
|
|
17
|
+
size?: Size;
|
|
18
|
+
}>;
|
|
19
|
+
|
|
20
|
+
export function FooterPromo({ volume, button, className, size, ...rest }: FooterPromoProps) {
|
|
21
|
+
const { disabled, radius } = useCardContext();
|
|
22
|
+
const footerSize = size ?? radius;
|
|
23
|
+
|
|
24
|
+
return (
|
|
25
|
+
<div className={cn(styles.promo, className)} data-size={footerSize} {...extractSupportProps(rest)}>
|
|
26
|
+
{button && (
|
|
27
|
+
<Button {...button} view={VIEW.Filled} appearance={APPEARANCE.Primary} size={SIZE.M} disabled={disabled} />
|
|
28
|
+
)}
|
|
29
|
+
{volume && <Dimension {...volume} size={size} />}
|
|
30
|
+
</div>
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
FooterPromo.displayName = 'CardCustom.Footer.Promo';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Promo';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
@use '@cloud-ru/ds-figma-variables/build/scss/styles/styles.module' as base;
|
|
2
|
+
@use '../../../shared.module' as shared;
|
|
3
|
+
|
|
4
|
+
.promo {
|
|
5
|
+
display: flex;
|
|
6
|
+
align-items: center;
|
|
7
|
+
justify-content: flex-end;
|
|
8
|
+
box-sizing: border-box;
|
|
9
|
+
|
|
10
|
+
@each $size in shared.$sizes {
|
|
11
|
+
&[data-size='#{$size}'] {
|
|
12
|
+
margin-top: base.simple-var(shared.$size-to-content-gap, $size);
|
|
13
|
+
padding-right: base.simple-var(shared.$size-to-content-padding, $size);
|
|
14
|
+
padding-bottom: base.simple-var(shared.$size-to-content-padding, $size);
|
|
15
|
+
padding-left: base.simple-var(shared.$size-to-content-padding, $size);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import {
|
|
2
|
+
FooterAction,
|
|
3
|
+
FooterActionProps,
|
|
4
|
+
FooterCallToAction,
|
|
5
|
+
FooterCallToActionProps,
|
|
6
|
+
FooterPromo,
|
|
7
|
+
FooterPromoProps,
|
|
8
|
+
} from './components';
|
|
9
|
+
|
|
10
|
+
export namespace Footer {
|
|
11
|
+
export const Promo = FooterPromo;
|
|
12
|
+
export const Action = FooterAction;
|
|
13
|
+
export const CallToAction = FooterCallToAction;
|
|
14
|
+
export type PromoProps = FooterPromoProps;
|
|
15
|
+
export type ActionProps = FooterActionProps;
|
|
16
|
+
export type CallToActionProps = FooterCallToActionProps;
|
|
17
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { TEST_IDS, useCardContext } from '@cloud-ru/ds-card';
|
|
2
|
+
import { KebabSVG } from '@cloud-ru/ds-icons/interface/system';
|
|
3
|
+
import { BaseItemProps, Droplist } from '@cloud-ru/ds-list';
|
|
4
|
+
import { Tag } from '@cloud-ru/ds-tag';
|
|
5
|
+
import { useLayoutEffect } from '@cloud-ru/ds-utils';
|
|
6
|
+
import { MouseEvent, ReactElement, ReactNode, useCallback, useContext, useRef, useState } from 'react';
|
|
7
|
+
|
|
8
|
+
import { FunctionBadgeContext } from '../../../functionBadgeContext';
|
|
9
|
+
import { FunctionBadgeWrapper } from '../../../helperComponents/FunctionBadgeWrapper';
|
|
10
|
+
import styles from './styles.module.scss';
|
|
11
|
+
|
|
12
|
+
type Option = {
|
|
13
|
+
tagLabel?: string;
|
|
14
|
+
icon?: ReactElement;
|
|
15
|
+
} & Pick<BaseItemProps, 'onClick' | 'content' | 'disabled'>;
|
|
16
|
+
|
|
17
|
+
export type FunctionBadgeProps = {
|
|
18
|
+
/** Иконка */
|
|
19
|
+
icon?: ReactNode;
|
|
20
|
+
/** Вложенные опции */
|
|
21
|
+
options: Option[];
|
|
22
|
+
/** Всегда показывать FunctionBadge */
|
|
23
|
+
alwaysVisible?: boolean;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
function FunctionBadgeButton({ icon, options }: Pick<FunctionBadgeProps, 'icon' | 'options'>) {
|
|
27
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
28
|
+
const buttonRef = useRef<HTMLButtonElement>(null);
|
|
29
|
+
const { setVisible } = useContext(FunctionBadgeContext);
|
|
30
|
+
|
|
31
|
+
useLayoutEffect(() => {
|
|
32
|
+
setVisible?.(isOpen);
|
|
33
|
+
}, [isOpen, setVisible]);
|
|
34
|
+
|
|
35
|
+
const onClick = useCallback((e: MouseEvent<HTMLButtonElement>) => {
|
|
36
|
+
e.stopPropagation();
|
|
37
|
+
setIsOpen(open => !open);
|
|
38
|
+
}, []);
|
|
39
|
+
|
|
40
|
+
return (
|
|
41
|
+
<span className={styles.wrapper}>
|
|
42
|
+
<Droplist
|
|
43
|
+
size='m'
|
|
44
|
+
trigger='clickAndFocusVisible'
|
|
45
|
+
open={isOpen}
|
|
46
|
+
onOpenChange={setIsOpen}
|
|
47
|
+
widthStrategy='gte'
|
|
48
|
+
scroll
|
|
49
|
+
data-test-id={TEST_IDS.droplist}
|
|
50
|
+
placement='bottom-end'
|
|
51
|
+
triggerElemRef={buttonRef}
|
|
52
|
+
items={options.map(({ icon: optionIcon, tagLabel, onClick: onItemClick, ...item }) => ({
|
|
53
|
+
...item,
|
|
54
|
+
className: styles.item,
|
|
55
|
+
beforeContent: optionIcon,
|
|
56
|
+
afterContent: tagLabel ? <Tag label={tagLabel} /> : undefined,
|
|
57
|
+
onClick: e => {
|
|
58
|
+
e.stopPropagation();
|
|
59
|
+
setIsOpen(false);
|
|
60
|
+
onItemClick?.(e);
|
|
61
|
+
},
|
|
62
|
+
}))}
|
|
63
|
+
>
|
|
64
|
+
<button
|
|
65
|
+
type='button'
|
|
66
|
+
data-test-id={TEST_IDS.functionBadge}
|
|
67
|
+
className={styles.button}
|
|
68
|
+
onClick={onClick}
|
|
69
|
+
ref={buttonRef}
|
|
70
|
+
>
|
|
71
|
+
{icon || <KebabSVG />}
|
|
72
|
+
</button>
|
|
73
|
+
</Droplist>
|
|
74
|
+
</span>
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export function FunctionBadge({ icon, options, alwaysVisible }: FunctionBadgeProps) {
|
|
79
|
+
const { disabled } = useCardContext();
|
|
80
|
+
|
|
81
|
+
if (disabled) {
|
|
82
|
+
return null;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
return (
|
|
86
|
+
<FunctionBadgeWrapper alwaysVisible={alwaysVisible}>
|
|
87
|
+
<FunctionBadgeButton icon={icon} options={options} />
|
|
88
|
+
</FunctionBadgeWrapper>
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
FunctionBadge.displayName = 'CardCustom.FunctionBadge';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './FunctionBadge';
|