@chotot/clad-ui 0.16.1
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/LICENSE +201 -0
- package/README.md +75 -0
- package/brand/ChototLogoText.d.ts +5 -0
- package/brand/CtC2C.d.ts +5 -0
- package/brand/CtProperty.d.ts +5 -0
- package/brand/CtVehicle.d.ts +5 -0
- package/brand/Tot.d.ts +5 -0
- package/brand/index.d.ts +5 -0
- package/components/Announcer/Announcer.d.ts +30 -0
- package/components/Announcer/Announcer.js +163 -0
- package/components/Announcer/Announcer.stories.js +388 -0
- package/components/Announcer/Announcer.styles.d.ts +20 -0
- package/components/Announcer/Announcer.styles.js +214 -0
- package/components/Box/Box.d.ts +79 -0
- package/components/Box/Box.js +314 -0
- package/components/Box/Box.spec.js +425 -0
- package/components/Box/Box.stories.js +491 -0
- package/components/Box/Box.styles.d.ts +5 -0
- package/components/Box/Box.styles.js +71 -0
- package/components/Breadcrumbs/Breadcrumbs.d.ts +20 -0
- package/components/Breadcrumbs/Breadcrumbs.js +92 -0
- package/components/Breadcrumbs/Breadcrumbs.stories.js +170 -0
- package/components/Breadcrumbs/Breadcrumbs.styles.d.ts +6 -0
- package/components/Breadcrumbs/Breadcrumbs.styles.js +44 -0
- package/components/Button/Button.d.ts +34 -0
- package/components/Button/Button.js +165 -0
- package/components/Button/Button.stories.js +370 -0
- package/components/Button/Button.styles.d.ts +2 -0
- package/components/Button/Button.styles.js +327 -0
- package/components/Button/ButtonLink.d.ts +29 -0
- package/components/Button/ButtonLink.js +89 -0
- package/components/Button/ButtonLink.stories.js +31 -0
- package/components/Button/IconButton.d.ts +28 -0
- package/components/Button/IconButton.js +81 -0
- package/components/Button/IconButton.stories.js +62 -0
- package/components/Checkbox/Checkbox.d.ts +30 -0
- package/components/Checkbox/Checkbox.js +106 -0
- package/components/Checkbox/Checkbox.stories.js +194 -0
- package/components/Checkbox/Checkbox.styles.d.ts +4 -0
- package/components/Checkbox/Checkbox.styles.js +112 -0
- package/components/Chip/Chip.d.ts +26 -0
- package/components/Chip/Chip.js +84 -0
- package/components/Chip/Chip.stories.js +130 -0
- package/components/Chip/Chip.styles.d.ts +5 -0
- package/components/Chip/Chip.styles.js +41 -0
- package/components/CurrencyInput/CurrencyInput.d.ts +53 -0
- package/components/CurrencyInput/CurrencyInput.js +369 -0
- package/components/CurrencyInput/CurrencyInput.spec.js +151 -0
- package/components/CurrencyInput/CurrencyInput.stories.js +202 -0
- package/components/CurrencyInput/CurrencyInput.styles.d.ts +18 -0
- package/components/CurrencyInput/CurrencyInput.styles.js +169 -0
- package/components/CurrencyInput/utils/_cleanValue.d.ts +11 -0
- package/components/CurrencyInput/utils/_cleanValue.js +55 -0
- package/components/CurrencyInput/utils/_cleanValue.spec.js +20 -0
- package/components/CurrencyInput/utils/_formatValue.d.ts +5 -0
- package/components/CurrencyInput/utils/_formatValue.js +99 -0
- package/components/CurrencyInput/utils/_formatValue.spec.js +32 -0
- package/components/Dropdown/Dropdown.d.ts +47 -0
- package/components/Dropdown/Dropdown.js +214 -0
- package/components/Dropdown/Dropdown.stories.js +323 -0
- package/components/Grid/Col.d.ts +30 -0
- package/components/Grid/Col.js +93 -0
- package/components/Grid/Col.spec.js +249 -0
- package/components/Grid/Grid.d.ts +36 -0
- package/components/Grid/Grid.js +180 -0
- package/components/Grid/Grid.spec.js +524 -0
- package/components/Grid/Grid.styles.d.ts +12 -0
- package/components/Grid/Grid.styles.js +228 -0
- package/components/Grid/aGrid.stories.js +577 -0
- package/components/Grid/bCol.stories.js +217 -0
- package/components/Input/Input.d.ts +50 -0
- package/components/Input/Input.js +342 -0
- package/components/Input/Input.spec.js +177 -0
- package/components/Input/Input.stories.js +424 -0
- package/components/Input/Input.styles.d.ts +20 -0
- package/components/Input/Input.styles.js +236 -0
- package/components/RadioButton/RadioButton.d.ts +30 -0
- package/components/RadioButton/RadioButton.js +107 -0
- package/components/RadioButton/RadioButton.stories.js +208 -0
- package/components/ShapeIcon/ShapeIcon.d.ts +36 -0
- package/components/ShapeIcon/ShapeIcon.js +74 -0
- package/components/ShapeIcon/ShapeIcon.stories.js +94 -0
- package/components/Snack/Snack.d.ts +20 -0
- package/components/Snack/Snack.js +82 -0
- package/components/Snack/Snack.spec.js +24 -0
- package/components/Snack/Snack.stories.js +235 -0
- package/components/Snack/Snack.styles.d.ts +6 -0
- package/components/Snack/Snack.styles.js +69 -0
- package/components/Tabs/Tab.d.ts +34 -0
- package/components/Tabs/Tab.js +145 -0
- package/components/Tabs/Tabs.d.ts +24 -0
- package/components/Tabs/Tabs.js +107 -0
- package/components/Tabs/Tabs.spec.js +57 -0
- package/components/Tabs/Tabs.stories.js +165 -0
- package/components/Tabs/Tabs.styles.d.ts +18 -0
- package/components/Tabs/Tabs.styles.js +86 -0
- package/components/TextArea/TextArea.d.ts +48 -0
- package/components/TextArea/TextArea.js +211 -0
- package/components/TextArea/TextArea.stories.js +411 -0
- package/components/TextArea/TextArea.styles.d.ts +16 -0
- package/components/TextArea/TextArea.styles.js +150 -0
- package/components/Tooltip/Tooltip.d.ts +34 -0
- package/components/Tooltip/Tooltip.js +188 -0
- package/components/Tooltip/Tooltip.spec.js +26 -0
- package/components/Tooltip/Tooltip.stories.js +467 -0
- package/components/Tooltip/Tooltip.styles.d.ts +5 -0
- package/components/Tooltip/Tooltip.styles.js +57 -0
- package/components/components-index.spec.js +29 -0
- package/components/index.d.ts +20 -0
- package/components/index.js +20 -0
- package/css/__snapshots__/baseline.spec.js.snap +3 -0
- package/css/baseline.d.ts +14 -0
- package/css/baseline.js +420 -0
- package/css/baseline.spec.js +32 -0
- package/declarations.d.ts +1 -0
- package/docs/1.1-intro.stories.mdx +18 -0
- package/docs/1.2-getting-started.stories.mdx +111 -0
- package/docs/1.3-theming.stories.mdx +193 -0
- package/docs/1.4-development-guide.stories.mdx +448 -0
- package/docs/1.5-contribution-guide.stories.mdx +19 -0
- package/docs/1.6-solution-rationale.stories.mdx +155 -0
- package/docs/1.7-team-members.stories.mdx +138 -0
- package/docs/2.1-tokens-intro.stories.mdx +51 -0
- package/docs/2.2-colors.stories.mdx +124 -0
- package/docs/2.2-typography.stories.mdx +126 -0
- package/docs/2.4-others.stories.mdx +180 -0
- package/docs/2.5-icons.stories.mdx +64 -0
- package/docs/2.6-baselinecss.stories.mdx +439 -0
- package/docs/2.7-layout-breakpoints.stories.mdx +185 -0
- package/icons/ArrowDown.d.ts +5 -0
- package/icons/ArrowDown.js +21 -0
- package/icons/ArrowDownB.d.ts +5 -0
- package/icons/ArrowDownB.js +21 -0
- package/icons/ArrowLeft.d.ts +5 -0
- package/icons/ArrowLeft.js +24 -0
- package/icons/ArrowRight.d.ts +5 -0
- package/icons/ArrowRight.js +24 -0
- package/icons/Back.d.ts +5 -0
- package/icons/Back.js +21 -0
- package/icons/Bell.d.ts +5 -0
- package/icons/Bell.js +21 -0
- package/icons/BellOutline.d.ts +5 -0
- package/icons/BellOutline.js +21 -0
- package/icons/BinOutline.d.ts +5 -0
- package/icons/BinOutline.js +25 -0
- package/icons/Bookmark.d.ts +5 -0
- package/icons/Bookmark.js +21 -0
- package/icons/BookmarkOutline.d.ts +5 -0
- package/icons/BookmarkOutline.js +21 -0
- package/icons/BoyFace.d.ts +5 -0
- package/icons/BoyFace.js +25 -0
- package/icons/BoyFaceOutline.d.ts +5 -0
- package/icons/BoyFaceOutline.js +21 -0
- package/icons/Bump.d.ts +5 -0
- package/icons/Bump.js +33 -0
- package/icons/BumpTime.d.ts +5 -0
- package/icons/BumpTime.js +35 -0
- package/icons/CallOutline.d.ts +5 -0
- package/icons/CallOutline.js +24 -0
- package/icons/Camera.d.ts +5 -0
- package/icons/Camera.js +31 -0
- package/icons/CardPayment.d.ts +5 -0
- package/icons/CardPayment.js +21 -0
- package/icons/Certificate.d.ts +5 -0
- package/icons/Certificate.js +25 -0
- package/icons/Chart.d.ts +5 -0
- package/icons/Chart.js +27 -0
- package/icons/ChartImpression.d.ts +5 -0
- package/icons/ChartImpression.js +28 -0
- package/icons/ChartView.d.ts +5 -0
- package/icons/ChartView.js +27 -0
- package/icons/Chat.d.ts +5 -0
- package/icons/Chat.js +29 -0
- package/icons/Check.d.ts +5 -0
- package/icons/Check.js +18 -0
- package/icons/CircleCheck.d.ts +5 -0
- package/icons/CircleCheck.js +27 -0
- package/icons/CircleCopylink.d.ts +5 -0
- package/icons/CircleCopylink.js +23 -0
- package/icons/CircleFacebook.d.ts +5 -0
- package/icons/CircleFacebook.js +22 -0
- package/icons/CircleMessenger.d.ts +5 -0
- package/icons/CircleMessenger.js +19 -0
- package/icons/CircleSms.d.ts +5 -0
- package/icons/CircleSms.js +22 -0
- package/icons/CircleUser.d.ts +5 -0
- package/icons/CircleUser.js +24 -0
- package/icons/CircleViber.d.ts +5 -0
- package/icons/CircleViber.js +28 -0
- package/icons/CircleZalo.d.ts +5 -0
- package/icons/CircleZalo.js +63 -0
- package/icons/Clock.d.ts +5 -0
- package/icons/Clock.js +21 -0
- package/icons/Close.d.ts +5 -0
- package/icons/Close.js +21 -0
- package/icons/CtCoin.d.ts +5 -0
- package/icons/CtCoin.js +218 -0
- package/icons/Download.d.ts +5 -0
- package/icons/Download.js +25 -0
- package/icons/Edit.d.ts +5 -0
- package/icons/Edit.js +23 -0
- package/icons/EditAd.d.ts +5 -0
- package/icons/EditAd.js +22 -0
- package/icons/Ellipsis.d.ts +5 -0
- package/icons/Ellipsis.js +21 -0
- package/icons/EllipsisOutline.d.ts +5 -0
- package/icons/EllipsisOutline.js +21 -0
- package/icons/FacebookOutline.d.ts +5 -0
- package/icons/FacebookOutline.js +32 -0
- package/icons/Follow.d.ts +5 -0
- package/icons/Follow.js +38 -0
- package/icons/Gallery.d.ts +5 -0
- package/icons/Gallery.js +24 -0
- package/icons/Gift.d.ts +5 -0
- package/icons/Gift.js +24 -0
- package/icons/GiftOutline.d.ts +5 -0
- package/icons/GiftOutline.js +21 -0
- package/icons/Heart.d.ts +5 -0
- package/icons/Heart.js +23 -0
- package/icons/HeartOutline.d.ts +5 -0
- package/icons/HeartOutline.js +23 -0
- package/icons/HideAd.d.ts +5 -0
- package/icons/HideAd.js +22 -0
- package/icons/Hot.d.ts +5 -0
- package/icons/Hot.js +21 -0
- package/icons/House.d.ts +5 -0
- package/icons/House.js +21 -0
- package/icons/HouseOutline.d.ts +5 -0
- package/icons/HouseOutline.js +21 -0
- package/icons/Impression.d.ts +5 -0
- package/icons/Impression.js +56 -0
- package/icons/Info.d.ts +5 -0
- package/icons/Info.js +21 -0
- package/icons/InsertAd.d.ts +5 -0
- package/icons/InsertAd.js +21 -0
- package/icons/InternationalPayment.d.ts +5 -0
- package/icons/InternationalPayment.js +43 -0
- package/icons/Label.d.ts +5 -0
- package/icons/Label.js +24 -0
- package/icons/Loan.d.ts +5 -0
- package/icons/Loan.js +48 -0
- package/icons/Location.d.ts +5 -0
- package/icons/Location.js +25 -0
- package/icons/LocationOutline.d.ts +5 -0
- package/icons/LocationOutline.js +27 -0
- package/icons/MailOutline.d.ts +5 -0
- package/icons/MailOutline.js +32 -0
- package/icons/Medal.d.ts +5 -0
- package/icons/Medal.js +21 -0
- package/icons/Msg.d.ts +5 -0
- package/icons/Msg.js +42 -0
- package/icons/PageIndicator.d.ts +5 -0
- package/icons/PageIndicator.js +25 -0
- package/icons/PaymentInfo.d.ts +5 -0
- package/icons/PaymentInfo.js +42 -0
- package/icons/PercentMsg.d.ts +5 -0
- package/icons/PercentMsg.js +51 -0
- package/icons/PhoneOutline.d.ts +5 -0
- package/icons/PhoneOutline.js +21 -0
- package/icons/Profile.d.ts +5 -0
- package/icons/Profile.js +29 -0
- package/icons/Search.d.ts +5 -0
- package/icons/Search.js +21 -0
- package/icons/Selected.d.ts +5 -0
- package/icons/Selected.js +34 -0
- package/icons/SellFaster.d.ts +5 -0
- package/icons/SellFaster.js +32 -0
- package/icons/Shop.d.ts +5 -0
- package/icons/Shop.js +22 -0
- package/icons/ShopFree.d.ts +5 -0
- package/icons/ShopFree.js +49 -0
- package/icons/ShopOutline.d.ts +5 -0
- package/icons/ShopOutline.js +24 -0
- package/icons/SpeechBubbles.d.ts +5 -0
- package/icons/SpeechBubbles.js +25 -0
- package/icons/SpeechBubblesOutline.d.ts +5 -0
- package/icons/SpeechBubblesOutline.js +21 -0
- package/icons/Star.d.ts +5 -0
- package/icons/Star.js +22 -0
- package/icons/StarOutline.d.ts +5 -0
- package/icons/StarOutline.js +23 -0
- package/icons/Stats.d.ts +5 -0
- package/icons/Stats.js +25 -0
- package/icons/Sticky.d.ts +5 -0
- package/icons/Sticky.js +29 -0
- package/icons/Suitcase.d.ts +5 -0
- package/icons/Suitcase.js +25 -0
- package/icons/Tot.d.ts +5 -0
- package/icons/Tot.js +21 -0
- package/icons/UnhideOutline.d.ts +5 -0
- package/icons/UnhideOutline.js +25 -0
- package/icons/User.d.ts +5 -0
- package/icons/User.js +138 -0
- package/icons/UserOutline.d.ts +5 -0
- package/icons/UserOutline.js +22 -0
- package/icons/Users.d.ts +5 -0
- package/icons/Users.js +44 -0
- package/icons/Verification.d.ts +5 -0
- package/icons/Verification.js +22 -0
- package/icons/VerifiedHouse.d.ts +5 -0
- package/icons/VerifiedHouse.js +30 -0
- package/icons/ViewMore.d.ts +5 -0
- package/icons/ViewMore.js +25 -0
- package/icons/Wallet.d.ts +5 -0
- package/icons/Wallet.js +35 -0
- package/icons/Warning.d.ts +5 -0
- package/icons/Warning.js +33 -0
- package/icons/index.d.ts +88 -0
- package/icons/index.js +88 -0
- package/index.d.ts +25 -0
- package/index.js +25 -0
- package/index.spec.js +50 -0
- package/package.json +178 -0
- package/patterns/Dialog/Dialog.d.ts +32 -0
- package/patterns/Dialog/Dialog.js +130 -0
- package/patterns/Dialog/Dialog.stories.js +388 -0
- package/patterns/Dialog/Dialog.styles.d.ts +14 -0
- package/patterns/Dialog/Dialog.styles.js +194 -0
- package/patterns/InputGroup/InputGroup.d.ts +18 -0
- package/patterns/InputGroup/InputGroup.js +52 -0
- package/patterns/InputGroup/InputGroup.spec.js +58 -0
- package/patterns/InputGroup/InputGroup.stories.js +203 -0
- package/patterns/InputGroup/InputGroup.styles.d.ts +6 -0
- package/patterns/InputGroup/InputGroup.styles.js +83 -0
- package/patterns/Popup/Popup.d.ts +41 -0
- package/patterns/Popup/Popup.js +175 -0
- package/patterns/Popup/Popup.spec.js +74 -0
- package/patterns/Popup/Popup.stories.js +548 -0
- package/patterns/Popup/Popup.styles.d.ts +20 -0
- package/patterns/Popup/Popup.styles.js +230 -0
- package/patterns/SearchInput/SearchInput.d.ts +66 -0
- package/patterns/SearchInput/SearchInput.js +355 -0
- package/patterns/SearchInput/SearchInput.stories.js +505 -0
- package/patterns/SearchInput/SearchInput.styles.d.ts +2 -0
- package/patterns/SearchInput/SearchInput.styles.js +49 -0
- package/patterns/TagCloud/TagCloud.d.ts +37 -0
- package/patterns/TagCloud/TagCloud.js +120 -0
- package/patterns/TagCloud/TagCloud.spec.js +163 -0
- package/patterns/TagCloud/TagCloud.stories.js +364 -0
- package/patterns/TagCloud/TagCloud.styles.d.ts +10 -0
- package/patterns/TagCloud/TagCloud.styles.js +39 -0
- package/patterns/TagCloud/TagCloudMultiActive.d.ts +42 -0
- package/patterns/TagCloud/TagCloudMultiActive.js +116 -0
- package/patterns/TagCloud/TagCloudSingleActive.d.ts +29 -0
- package/patterns/TagCloud/TagCloudSingleActive.js +64 -0
- package/patterns/index.d.ts +5 -0
- package/patterns/index.js +5 -0
- package/patterns/patterns-index.spec.js +25 -0
- package/scripts/create-badge-svg.d.ts +2 -0
- package/scripts/template-icons-index.d.ts +2 -0
- package/scripts/template-svg-icon.d.ts +16 -0
- package/shared/global.d.ts +12 -0
- package/shared/global.js +17 -0
- package/storybook/components/Bar.d.ts +10 -0
- package/storybook/components/BorderRadius.d.ts +12 -0
- package/storybook/components/BorderWidth.d.ts +10 -0
- package/storybook/components/Gradient.d.ts +16 -0
- package/storybook/components/GuideImage.d.ts +22 -0
- package/storybook/components/Icons.d.ts +2 -0
- package/storybook/components/Member.d.ts +26 -0
- package/storybook/components/Shadow.d.ts +10 -0
- package/storybook/components/Square.d.ts +10 -0
- package/storybook/components/Swatch.d.ts +10 -0
- package/storybook/components/Transition.d.ts +10 -0
- package/storybook/components/Type.d.ts +42 -0
- package/storybook/main.d.ts +3 -0
- package/storybook/manager.d.ts +1 -0
- package/storybook/preview.d.ts +76 -0
- package/storybook/theme-clad.d.ts +2 -0
- package/storybook/utils/jsonStringify.d.ts +8 -0
- package/storybook/utils/loadFontsForStorybook.d.ts +1 -0
- package/theme/__snapshots__/chotot.spec.js.snap +262 -0
- package/theme/__snapshots__/mudah.spec.js.snap +161 -0
- package/theme/chotot.d.ts +555 -0
- package/theme/chotot.js +937 -0
- package/theme/chotot.spec.js +72 -0
- package/theme/index.d.ts +2 -0
- package/theme/index.js +7 -0
- package/theme/mudah.d.ts +214 -0
- package/theme/mudah.js +333 -0
- package/theme/mudah.spec.js +9 -0
- package/types.d.ts +14 -0
- package/utils/_normalizeArrowKey.d.ts +9 -0
- package/utils/_normalizeArrowKey.js +17 -0
- package/utils/_simulateChangeEvent.d.ts +9 -0
- package/utils/_simulateChangeEvent.js +34 -0
- package/utils/_simulateChangeEvent.spec.js +54 -0
- package/utils/cleanHtml.d.ts +8 -0
- package/utils/cleanHtml.js +14 -0
- package/utils/cleanHtml.spec.js +45 -0
- package/utils/createUniversalPortal.d.ts +10 -0
- package/utils/createUniversalPortal.js +22 -0
- package/utils/createUniversalPortal.server.spec.js +13 -0
- package/utils/createUniversalPortal.spec.js +13 -0
- package/utils/getBreakpointsValues.d.ts +10 -0
- package/utils/getBreakpointsValues.js +24 -0
- package/utils/getBreakpointsValues.test.js +89 -0
- package/utils/index.d.ts +5 -0
- package/utils/index.js +5 -0
- package/utils/noop.d.ts +8 -0
- package/utils/noop.js +9 -0
- package/utils/noop.spec.js +12 -0
- package/utils/sx.d.ts +3770 -0
- package/utils/sx.js +95 -0
- package/utils/sx.spec.js +53 -0
|
@@ -0,0 +1,388 @@
|
|
|
1
|
+
import React, { useState, useEffect } from 'react';
|
|
2
|
+
import Button from '../Button/Button';
|
|
3
|
+
import Announcer from './Announcer';
|
|
4
|
+
import Grid from '../Grid/Grid';
|
|
5
|
+
import Col from '../Grid/Col';
|
|
6
|
+
import GuideImage from '../../storybook/components/GuideImage';
|
|
7
|
+
|
|
8
|
+
const announcerStories = {
|
|
9
|
+
title: 'Components/Announcer',
|
|
10
|
+
component: Announcer,
|
|
11
|
+
parameters: {
|
|
12
|
+
docs: {
|
|
13
|
+
description: {
|
|
14
|
+
component: `Announcer box is used to displayed system messages, which can be dismissed.
|
|
15
|
+
|
|
16
|
+
\`🧪 Beta\` [\`💎 Sketch Specs\`](https://www.sketch.com/s/061b5b52-f0d0-439f-9fde-2bfbcfaaf97e/a/09xl9VA)
|
|
17
|
+
|
|
18
|
+
## How to use
|
|
19
|
+
|
|
20
|
+
Announcer can be used to display:
|
|
21
|
+
|
|
22
|
+
- Information/Tips: Common information or notification, tips or usage guide.
|
|
23
|
+
|
|
24
|
+
- Time Information/Pending/Reviewing: Time-related information.
|
|
25
|
+
|
|
26
|
+
- Gift/Promotion: Gift or promotion that can be claimed.
|
|
27
|
+
|
|
28
|
+
- Soft Warning/Reminder: Caution, warning or reminder that needs user's attention.
|
|
29
|
+
|
|
30
|
+
- Success: Success message after performing an action.
|
|
31
|
+
|
|
32
|
+
- Hard Warning/Error/Expired: Inform user about issues or something has just gone wrong.
|
|
33
|
+
`,
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
argTypes: {
|
|
38
|
+
title: { defaultValue: '[Thông báo] Nâng cấp hệ thống' },
|
|
39
|
+
children: {
|
|
40
|
+
control: {
|
|
41
|
+
type: 'text',
|
|
42
|
+
},
|
|
43
|
+
defaultValue:
|
|
44
|
+
'Chợ Tốt đang thực hiện nâng cấp hệ thống nên có thể ảnh hưởng tới một số tính năng liên quan đến quản lý và hiển thị tin đăng, chúng tôi sẽ cập nhật thông tin ngay khi hoàn thành. Xin lỗi Quý khách vì sự bất tiện này!',
|
|
45
|
+
},
|
|
46
|
+
type: {},
|
|
47
|
+
btnLabel: { defaultValue: 'Xem thêm' },
|
|
48
|
+
compact: {},
|
|
49
|
+
open: { defaultValue: true },
|
|
50
|
+
onClose: { control: null },
|
|
51
|
+
onButtonClick: { control: null },
|
|
52
|
+
dangerousHtml: { control: null },
|
|
53
|
+
},
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
export default announcerStories;
|
|
57
|
+
|
|
58
|
+
const onActionBtnClick = () => {
|
|
59
|
+
// eslint-disable-next-line no-alert
|
|
60
|
+
alert('Action button clicked.');
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
export const Overview = (args) => {
|
|
64
|
+
const [open, setOpen] = useState(true);
|
|
65
|
+
const handleOpen = () => {
|
|
66
|
+
setOpen(true);
|
|
67
|
+
};
|
|
68
|
+
const handleClose = () => {
|
|
69
|
+
setOpen(false);
|
|
70
|
+
};
|
|
71
|
+
useEffect(() => {
|
|
72
|
+
setOpen(args.open);
|
|
73
|
+
}, [args.open]);
|
|
74
|
+
return (
|
|
75
|
+
<>
|
|
76
|
+
{!open && <Button onClick={handleOpen}>Reopen Announcer</Button>}
|
|
77
|
+
<Announcer {...args} open={open} onClose={handleClose} onButtonClick={onActionBtnClick} />
|
|
78
|
+
</>
|
|
79
|
+
);
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
export const WithoutTitle = () => {
|
|
83
|
+
const [open, setOpen] = useState(true);
|
|
84
|
+
const handleOpen = () => {
|
|
85
|
+
setOpen(true);
|
|
86
|
+
};
|
|
87
|
+
const handleClose = () => {
|
|
88
|
+
setOpen(false);
|
|
89
|
+
};
|
|
90
|
+
return (
|
|
91
|
+
<>
|
|
92
|
+
{!open && <Button onClick={handleOpen}>Reopen Announcer</Button>}
|
|
93
|
+
<Announcer
|
|
94
|
+
btnLabel="Xem thêm"
|
|
95
|
+
open={open}
|
|
96
|
+
onClose={handleClose}
|
|
97
|
+
onButtonClick={onActionBtnClick}
|
|
98
|
+
>
|
|
99
|
+
Chợ Tốt đang thực hiện nâng cấp hệ thống nên có thể ảnh hưởng tới một số tính năng liên quan
|
|
100
|
+
đến quản lý và hiển thị tin đăng, chúng tôi sẽ cập nhật thông tin ngay khi hoàn thành. Xin
|
|
101
|
+
lỗi Quý khách vì sự bất tiện này!
|
|
102
|
+
</Announcer>
|
|
103
|
+
</>
|
|
104
|
+
);
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
WithoutTitle.storyName = 'Without title';
|
|
108
|
+
WithoutTitle.parameters = {
|
|
109
|
+
docs: {
|
|
110
|
+
description: {
|
|
111
|
+
story:
|
|
112
|
+
"Announcer won't have title if `title` prop is not found. Announcer's children will occupy the empty space.",
|
|
113
|
+
},
|
|
114
|
+
},
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
export const WithoutButton = () => {
|
|
118
|
+
const [open, setOpen] = useState(true);
|
|
119
|
+
const handleOpen = () => {
|
|
120
|
+
setOpen(true);
|
|
121
|
+
};
|
|
122
|
+
const handleClose = () => {
|
|
123
|
+
setOpen(false);
|
|
124
|
+
};
|
|
125
|
+
return (
|
|
126
|
+
<>
|
|
127
|
+
{!open && <Button onClick={handleOpen}>Reopen Announcer</Button>}
|
|
128
|
+
<Announcer
|
|
129
|
+
title="[Thông báo] Nâng cấp hệ thống"
|
|
130
|
+
open={open}
|
|
131
|
+
onClose={handleClose}
|
|
132
|
+
onButtonClick={onActionBtnClick}
|
|
133
|
+
>
|
|
134
|
+
Chợ Tốt đang thực hiện nâng cấp hệ thống nên có thể ảnh hưởng tới một số tính năng liên quan
|
|
135
|
+
đến quản lý và hiển thị tin đăng, chúng tôi sẽ cập nhật thông tin ngay khi hoàn thành. Xin
|
|
136
|
+
lỗi Quý khách vì sự bất tiện này!
|
|
137
|
+
</Announcer>
|
|
138
|
+
</>
|
|
139
|
+
);
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
WithoutButton.storyName = 'Without btnLabel';
|
|
143
|
+
WithoutButton.parameters = {
|
|
144
|
+
docs: {
|
|
145
|
+
description: {
|
|
146
|
+
story:
|
|
147
|
+
"Announcer won't have action button at the bottom if `btnLabel` prop is not found. Announcer's children will occupy the empty space. On mobile viewport, if children's number of line is more than 4, it will be truncated into 2 with an expand button.",
|
|
148
|
+
},
|
|
149
|
+
},
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
export const WithoutCloseButton = () => (
|
|
153
|
+
<Announcer title="[Thông báo] Nâng cấp hệ thống" open>
|
|
154
|
+
Chợ Tốt đang thực hiện nâng cấp hệ thống nên có thể ảnh hưởng tới một số tính năng liên quan đến
|
|
155
|
+
quản lý và hiển thị tin đăng, chúng tôi sẽ cập nhật thông tin ngay khi hoàn thành. Xin lỗi Quý
|
|
156
|
+
khách vì sự bất tiện này!
|
|
157
|
+
</Announcer>
|
|
158
|
+
);
|
|
159
|
+
|
|
160
|
+
WithoutCloseButton.storyName = 'Without btnClose';
|
|
161
|
+
WithoutCloseButton.parameters = {
|
|
162
|
+
docs: {
|
|
163
|
+
description: {
|
|
164
|
+
story:
|
|
165
|
+
"Announcer won't have the close button at the top-right if the `onClose` prop is not a function.",
|
|
166
|
+
},
|
|
167
|
+
},
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
export const WithType = () => (
|
|
171
|
+
<>
|
|
172
|
+
<p>
|
|
173
|
+
<em>Open and close functionality are disabled in this story.</em>
|
|
174
|
+
</p>
|
|
175
|
+
<p>type="info"</p>
|
|
176
|
+
<Announcer
|
|
177
|
+
type="info"
|
|
178
|
+
title="[Thông báo] Nâng cấp hệ thống"
|
|
179
|
+
btnLabel="Xem thêm"
|
|
180
|
+
open
|
|
181
|
+
onButtonClick={onActionBtnClick}
|
|
182
|
+
>
|
|
183
|
+
Chợ Tốt đang thực hiện nâng cấp hệ thống nên có thể ảnh hưởng tới một số tính năng liên quan
|
|
184
|
+
đến quản lý và hiển thị tin đăng, chúng tôi sẽ cập nhật thông tin ngay khi hoàn thành. Xin lỗi
|
|
185
|
+
Quý khách vì sự bất tiện này!
|
|
186
|
+
</Announcer>
|
|
187
|
+
<br />
|
|
188
|
+
<p>type="time"</p>
|
|
189
|
+
<Announcer
|
|
190
|
+
type="time"
|
|
191
|
+
title="Tin của bạn đang được duyệt"
|
|
192
|
+
open
|
|
193
|
+
onButtonClick={onActionBtnClick}
|
|
194
|
+
>
|
|
195
|
+
Bạn có thể cập nhật thông báo tình trạng tin đăng tại mục Quản lý tin đăng
|
|
196
|
+
</Announcer>
|
|
197
|
+
<br />
|
|
198
|
+
<p>type="gift"</p>
|
|
199
|
+
<Announcer
|
|
200
|
+
type="gift"
|
|
201
|
+
title="Chương trình giảm giá đặc biệt"
|
|
202
|
+
btnLabel="Mua dịch vụ"
|
|
203
|
+
open
|
|
204
|
+
onButtonClick={onActionBtnClick}
|
|
205
|
+
>
|
|
206
|
+
Bán nhanh hơn với dịch vụ đẩy tin của Chợ Tốt. Chương trình khuyến mãi chỉ dành cho người dùng
|
|
207
|
+
nhận được thông báo này.
|
|
208
|
+
</Announcer>
|
|
209
|
+
<br />
|
|
210
|
+
<p>type="warning"</p>
|
|
211
|
+
<Announcer
|
|
212
|
+
type="warning"
|
|
213
|
+
title="Cửa hàng Điện tử sắp hết hạn"
|
|
214
|
+
btnLabel="Gia hạn cửa hàng"
|
|
215
|
+
open
|
|
216
|
+
onButtonClick={onActionBtnClick}
|
|
217
|
+
>
|
|
218
|
+
Chợ Tốt đang thực hiện nâng cấp hệ thống nên có thể ảnh hưởng tới một số tính năng liên quan
|
|
219
|
+
đến quản lý và hiển thị tin đăng, chúng tôi sẽ cập nhật thông tin ngay khi hoàn thành. Xin lỗi
|
|
220
|
+
Quý khách vì sự bất tiện này!
|
|
221
|
+
</Announcer>
|
|
222
|
+
<br />
|
|
223
|
+
<p>type="success"</p>
|
|
224
|
+
<Announcer
|
|
225
|
+
type="success"
|
|
226
|
+
title="Cửa hàng Điện tử được duyệt thành công!"
|
|
227
|
+
btnLabel="Bán nhanh hơn"
|
|
228
|
+
open
|
|
229
|
+
onButtonClick={onActionBtnClick}
|
|
230
|
+
>
|
|
231
|
+
Chúc mừng, Cửa hàng Điện tử của bạn đã đi vào hoạt động! Đăng tin ngay để thu hút nhiều Người
|
|
232
|
+
mua đến với Cửa hàng. Xem Hướng dẫn quản lý Cửa hàng.
|
|
233
|
+
</Announcer>
|
|
234
|
+
<br />
|
|
235
|
+
<p>type="error"</p>
|
|
236
|
+
<Announcer
|
|
237
|
+
type="error"
|
|
238
|
+
title="Cửa hàng điện tử đã hết hạn"
|
|
239
|
+
btnLabel="Gia hạn cửa hàng"
|
|
240
|
+
open
|
|
241
|
+
onButtonClick={onActionBtnClick}
|
|
242
|
+
>
|
|
243
|
+
Cửa hàng Điện tử của bạn đã hết hạn. Để tiếp tục việc kinh doanh, gia hạn Cửa hàng ngay bạn
|
|
244
|
+
nhé.
|
|
245
|
+
</Announcer>
|
|
246
|
+
</>
|
|
247
|
+
);
|
|
248
|
+
|
|
249
|
+
WithType.storyName = 'With type';
|
|
250
|
+
WithType.parameters = {
|
|
251
|
+
docs: {
|
|
252
|
+
description: {
|
|
253
|
+
story:
|
|
254
|
+
'Announcer comes with various different types. Each has an unique icon, a suitable theme color and serves different purposes.',
|
|
255
|
+
},
|
|
256
|
+
},
|
|
257
|
+
};
|
|
258
|
+
|
|
259
|
+
export const EmptyState = () => (
|
|
260
|
+
<>
|
|
261
|
+
<p>type="neutral"</p>
|
|
262
|
+
<Announcer type="neutral">Rất tiếc, chưa có tin đăng nào được cập nhật</Announcer>
|
|
263
|
+
</>
|
|
264
|
+
);
|
|
265
|
+
|
|
266
|
+
EmptyState.storyName = 'With type="neutral"';
|
|
267
|
+
EmptyState.parameters = {
|
|
268
|
+
docs: {
|
|
269
|
+
description: {
|
|
270
|
+
story:
|
|
271
|
+
'`type="neutral"` is a special Announcer type. Setting this will turn Announcer to empty state Announcer, which can\'t be dismissed via user\'s interaction. Empty state Announcer does not depend on `open` prop to appear and will ignore `title`, `btnLabel` and `compact` props.',
|
|
272
|
+
},
|
|
273
|
+
},
|
|
274
|
+
};
|
|
275
|
+
|
|
276
|
+
export const WithCompact = () => (
|
|
277
|
+
<>
|
|
278
|
+
<p>
|
|
279
|
+
<em>Open and close functionality are disabled in this story.</em>
|
|
280
|
+
</p>
|
|
281
|
+
<Announcer type="info" compact open>
|
|
282
|
+
Info
|
|
283
|
+
</Announcer>
|
|
284
|
+
<br />
|
|
285
|
+
<Announcer type="time" compact open>
|
|
286
|
+
Time
|
|
287
|
+
</Announcer>
|
|
288
|
+
<br />
|
|
289
|
+
<Announcer type="gift" compact open>
|
|
290
|
+
Gift
|
|
291
|
+
</Announcer>
|
|
292
|
+
<br />
|
|
293
|
+
<Announcer type="warning" compact open>
|
|
294
|
+
Warning
|
|
295
|
+
</Announcer>
|
|
296
|
+
<br />
|
|
297
|
+
<Announcer type="success" compact open>
|
|
298
|
+
Success
|
|
299
|
+
</Announcer>
|
|
300
|
+
<br />
|
|
301
|
+
<Announcer type="error" compact open>
|
|
302
|
+
Error
|
|
303
|
+
</Announcer>
|
|
304
|
+
</>
|
|
305
|
+
);
|
|
306
|
+
|
|
307
|
+
WithCompact.storyName = 'With compact';
|
|
308
|
+
WithCompact.parameters = {
|
|
309
|
+
docs: {
|
|
310
|
+
description: {
|
|
311
|
+
story:
|
|
312
|
+
'Setting `compact` prop to turn Announcer to single line. Useful when Announcer description is short and action button is not required.',
|
|
313
|
+
},
|
|
314
|
+
},
|
|
315
|
+
};
|
|
316
|
+
|
|
317
|
+
export const HtmlContentExample = () => (
|
|
318
|
+
<>
|
|
319
|
+
<p>
|
|
320
|
+
<em>Open and close functionality are disabled in this story.</em>
|
|
321
|
+
</p>
|
|
322
|
+
<p>type="info"</p>
|
|
323
|
+
<Announcer
|
|
324
|
+
type="info"
|
|
325
|
+
title="[Thông báo] Nâng cấp hệ thống"
|
|
326
|
+
btnLabel="Xem thêm"
|
|
327
|
+
open
|
|
328
|
+
onButtonClick={onActionBtnClick}
|
|
329
|
+
dangerousHtml="<p><strong>Chợ Tốt</strong> đang thực hiện nâng cấp hệ thống nên có thể ảnh hưởng tới một số tính năng liên quan
|
|
330
|
+
đến quản lý và hiển thị tin đăng, chúng tôi sẽ cập nhật thông tin ngay khi hoàn thành. Xin lỗi
|
|
331
|
+
Quý khách vì sự bất tiện này!</p>"
|
|
332
|
+
/>
|
|
333
|
+
<br />
|
|
334
|
+
<p>type="neutral"</p>
|
|
335
|
+
<Announcer type="neutral" dangerousHtml="<p>Rất tiếc, chưa có tin đăng nào được cập nhật</p>" />
|
|
336
|
+
<br />
|
|
337
|
+
<p>With compact prop enabled</p>
|
|
338
|
+
<Announcer type="info" compact open dangerousHtml="<p>Info</p>" />
|
|
339
|
+
</>
|
|
340
|
+
);
|
|
341
|
+
|
|
342
|
+
HtmlContentExample.storyName = 'Ex: HTML content';
|
|
343
|
+
HtmlContentExample.parameters = {
|
|
344
|
+
docs: {
|
|
345
|
+
description: {
|
|
346
|
+
story:
|
|
347
|
+
"Announcer component has a special `dangerousHtml` prop which accepts HTML string which will be lightly sanitized (so it's still dangerous), automatically wrapped in `{__html}` and passed to `dangerouslySetInnerHTML` of the rendered styled container. Avoid passing user's input directly to this prop and the HTML string should be properly sanitized at server side.",
|
|
348
|
+
},
|
|
349
|
+
},
|
|
350
|
+
};
|
|
351
|
+
|
|
352
|
+
export const UsageGuide = () => (
|
|
353
|
+
<>
|
|
354
|
+
<h4>Collapsed on mobile</h4>
|
|
355
|
+
<p>
|
|
356
|
+
On mobile viewport, when Announcer description (a.k.a children or dangerousHtml prop) number
|
|
357
|
+
of line is more than 4, it will be truncated into 2 with an expand button.
|
|
358
|
+
</p>
|
|
359
|
+
<GuideImage src="./announcer-collapsed.png" alt="Announcer - Collapsed" />
|
|
360
|
+
<br />
|
|
361
|
+
<h4>DO's</h4>
|
|
362
|
+
<Grid rowCols={[1, 1, 2]} gutterx="sm" align="center">
|
|
363
|
+
<Col>
|
|
364
|
+
<GuideImage isGood src="./announcer-do-1.png" alt="Announcer - Do_1" />
|
|
365
|
+
</Col>
|
|
366
|
+
<Col>
|
|
367
|
+
<GuideImage isGood src="./announcer-do-2.png" alt="Announcer - Do_2" />
|
|
368
|
+
</Col>
|
|
369
|
+
</Grid>
|
|
370
|
+
<br />
|
|
371
|
+
<h4>DON'Ts</h4>
|
|
372
|
+
<Grid rowCols={[1, 1, 2]} gutterx="sm" align="center">
|
|
373
|
+
<Col>
|
|
374
|
+
<GuideImage isBad src="./announcer-dont-1.png" alt="Announcer - Dont_1" />
|
|
375
|
+
<p>Wrong icon as well as background-color.</p>
|
|
376
|
+
</Col>
|
|
377
|
+
<Col>
|
|
378
|
+
<GuideImage isBad src="./announcer-dont-2.png" alt="Announcer - Dont_2" />
|
|
379
|
+
<p>Wrong color on both regular Announcer and empty state Announcer.</p>
|
|
380
|
+
</Col>
|
|
381
|
+
</Grid>
|
|
382
|
+
</>
|
|
383
|
+
);
|
|
384
|
+
UsageGuide.parameters = {
|
|
385
|
+
docs: {
|
|
386
|
+
source: { code: [] },
|
|
387
|
+
},
|
|
388
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export const typeIconClass: string;
|
|
2
|
+
export const EmptyStateAnnouncer: import("linaria/lib/StyledMeta").StyledMeta & import("react").FunctionComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & {
|
|
3
|
+
as?: import("react").ElementType<any>;
|
|
4
|
+
}>;
|
|
5
|
+
export const StyledAnnouncer: import("linaria/lib/StyledMeta").StyledMeta & import("react").FunctionComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & {
|
|
6
|
+
as?: import("react").ElementType<any>;
|
|
7
|
+
}>;
|
|
8
|
+
export const lineLimitClass: string;
|
|
9
|
+
export const ExpandButton: import("linaria/lib/StyledMeta").StyledMeta & import("react").FunctionComponent<import("react").ClassAttributes<HTMLButtonElement> & import("react").ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
10
|
+
as?: import("react").ElementType<any>;
|
|
11
|
+
}>;
|
|
12
|
+
export const ActionButton: import("linaria/lib/StyledMeta").StyledMeta & import("react").FunctionComponent<import("react").ClassAttributes<HTMLButtonElement> & import("react").ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
13
|
+
as?: import("react").ElementType<any>;
|
|
14
|
+
}>;
|
|
15
|
+
export const CloseButton: import("linaria/lib/StyledMeta").StyledMeta & import("react").FunctionComponent<import("react").ClassAttributes<HTMLButtonElement> & import("react").ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
16
|
+
as?: import("react").ElementType<any>;
|
|
17
|
+
}>;
|
|
18
|
+
export const ChildrenWrapper: import("linaria/lib/StyledMeta").StyledMeta & import("react").FunctionComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & {
|
|
19
|
+
as?: import("react").ElementType<any>;
|
|
20
|
+
}>;
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
import { css } from 'linaria';
|
|
2
|
+
import { styled } from 'linaria/react';
|
|
3
|
+
import theme from '@clad-ui/theme';
|
|
4
|
+
|
|
5
|
+
const { space, sizes, colors, radii, fontSizes, fontWeights, mediaQueries, borders } = theme;
|
|
6
|
+
|
|
7
|
+
const typeIconClass = css`
|
|
8
|
+
position: absolute;
|
|
9
|
+
top: ${space.md};
|
|
10
|
+
left: ${space.md};
|
|
11
|
+
font-size: ${sizes.xs};
|
|
12
|
+
color: ${colors.info};
|
|
13
|
+
|
|
14
|
+
&.warning {
|
|
15
|
+
color: ${colors.orange2};
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
&.success {
|
|
19
|
+
color: ${colors.positive};
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
&.error {
|
|
23
|
+
color: ${colors.critical};
|
|
24
|
+
}
|
|
25
|
+
`;
|
|
26
|
+
|
|
27
|
+
const EmptyStateAnnouncer = styled.div`
|
|
28
|
+
background-color: ${colors.background};
|
|
29
|
+
padding: ${space.md};
|
|
30
|
+
font-size: ${fontSizes.xs};
|
|
31
|
+
line-height: 16px;
|
|
32
|
+
color: ${colors.neutralDark};
|
|
33
|
+
text-align: center;
|
|
34
|
+
border-radius: ${radii.sm};
|
|
35
|
+
|
|
36
|
+
@media ${mediaQueries.tablet} {
|
|
37
|
+
font-size: ${fontSizes.sm};
|
|
38
|
+
line-height: 20px;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/* reset all default margin in children's last wrapper element to make sure content is always centered */
|
|
42
|
+
& > *:last-child {
|
|
43
|
+
margin-bottom: 0;
|
|
44
|
+
}
|
|
45
|
+
`;
|
|
46
|
+
|
|
47
|
+
/* limit description to 2 lines */
|
|
48
|
+
const lineLimitClass = css`
|
|
49
|
+
max-height: ${sizes.lg};
|
|
50
|
+
overflow: hidden;
|
|
51
|
+
|
|
52
|
+
@media ${mediaQueries.tablet} {
|
|
53
|
+
max-height: none;
|
|
54
|
+
}
|
|
55
|
+
`;
|
|
56
|
+
|
|
57
|
+
const ChildrenWrapper = styled.div`
|
|
58
|
+
font-size: ${fontSizes.xs};
|
|
59
|
+
line-height: 16px;
|
|
60
|
+
margin-bottom: ${space.xs};
|
|
61
|
+
|
|
62
|
+
/* reset all default margin in children's last wrapper element to make sure content is always centered */
|
|
63
|
+
& > *:last-child {
|
|
64
|
+
margin-bottom: 0;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
@media ${mediaQueries.tablet} {
|
|
68
|
+
font-size: ${fontSizes.body};
|
|
69
|
+
line-height: 20px;
|
|
70
|
+
}
|
|
71
|
+
`;
|
|
72
|
+
|
|
73
|
+
const StyledAnnouncer = styled.div`
|
|
74
|
+
position: relative;
|
|
75
|
+
padding: ${space.md} ${space.md} ${space.md} ${space.xxl};
|
|
76
|
+
border-radius: ${radii.sm};
|
|
77
|
+
text-align: right;
|
|
78
|
+
background-color: ${colors.infoBGLight};
|
|
79
|
+
|
|
80
|
+
&.warning {
|
|
81
|
+
background-color: ${colors.orange5};
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
&.success {
|
|
85
|
+
background-color: ${colors.positiveBGLight};
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
&.error {
|
|
89
|
+
background-color: ${colors.criticalBG};
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
& > * {
|
|
93
|
+
text-align: left;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
& > h6 {
|
|
97
|
+
font-size: ${fontSizes.h6};
|
|
98
|
+
font-weight: ${fontWeights.bold};
|
|
99
|
+
line-height: 20px;
|
|
100
|
+
margin: 0 ${space.md} ${space.xxs} 0;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
&.compact {
|
|
104
|
+
display: flex;
|
|
105
|
+
align-items: center;
|
|
106
|
+
height: 40px;
|
|
107
|
+
padding: 0 ${space.xl} 0 ${space.xxl};
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
&.compact > .${typeIconClass} {
|
|
111
|
+
top: 10px;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
&.no-button > ${ChildrenWrapper} {
|
|
115
|
+
margin-bottom: 0;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
&.compact > ${ChildrenWrapper} {
|
|
119
|
+
white-space: nowrap;
|
|
120
|
+
overflow: hidden;
|
|
121
|
+
text-overflow: ellipsis;
|
|
122
|
+
margin-bottom: 0;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
@media ${mediaQueries.tablet} {
|
|
126
|
+
padding-right: ${space.xl};
|
|
127
|
+
|
|
128
|
+
& > h6 {
|
|
129
|
+
margin-right: 0;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
`;
|
|
133
|
+
|
|
134
|
+
const ExpandButton = styled.button`
|
|
135
|
+
position: absolute;
|
|
136
|
+
bottom: 15px;
|
|
137
|
+
right: ${space.md};
|
|
138
|
+
color: ${colors.link};
|
|
139
|
+
text-decoration: underline;
|
|
140
|
+
background-color: inherit;
|
|
141
|
+
font-size: ${fontSizes.xs};
|
|
142
|
+
line-height: 16px;
|
|
143
|
+
padding-right: ${space.xxxl};
|
|
144
|
+
|
|
145
|
+
&:focus {
|
|
146
|
+
outline: none;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
&::before {
|
|
150
|
+
content: '...';
|
|
151
|
+
position: absolute;
|
|
152
|
+
bottom: 1px;
|
|
153
|
+
left: -${space.sm};
|
|
154
|
+
padding-left: ${space.xxs};
|
|
155
|
+
color: ${colors.text};
|
|
156
|
+
background-color: inherit;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
@media ${mediaQueries.tablet} {
|
|
160
|
+
display: none;
|
|
161
|
+
}
|
|
162
|
+
`;
|
|
163
|
+
|
|
164
|
+
const ActionButton = styled.button`
|
|
165
|
+
background-color: transparent;
|
|
166
|
+
border: ${borders.none};
|
|
167
|
+
/* increase hit box */
|
|
168
|
+
padding: ${space.xxs} ${space.sm};
|
|
169
|
+
margin: -${space.xxs} -${space.sm};
|
|
170
|
+
font-weight: bold;
|
|
171
|
+
font-size: ${fontSizes.xs};
|
|
172
|
+
line-height: 16px;
|
|
173
|
+
text-transform: uppercase;
|
|
174
|
+
color: ${colors.info};
|
|
175
|
+
|
|
176
|
+
&.warning {
|
|
177
|
+
color: ${colors.orange2};
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
&.success {
|
|
181
|
+
color: ${colors.positive};
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
&.error {
|
|
185
|
+
color: ${colors.critical};
|
|
186
|
+
}
|
|
187
|
+
`;
|
|
188
|
+
|
|
189
|
+
const CloseButton = styled.button`
|
|
190
|
+
position: absolute;
|
|
191
|
+
top: ${space.sm};
|
|
192
|
+
right: ${space.sm};
|
|
193
|
+
/* increase hit box */
|
|
194
|
+
padding: ${space.xs};
|
|
195
|
+
margin: -${space.xs};
|
|
196
|
+
background-color: transparent;
|
|
197
|
+
font-size: ${sizes.xxxs};
|
|
198
|
+
height: ${sizes.md};
|
|
199
|
+
|
|
200
|
+
&:focus {
|
|
201
|
+
outline: none;
|
|
202
|
+
}
|
|
203
|
+
`;
|
|
204
|
+
|
|
205
|
+
export {
|
|
206
|
+
typeIconClass,
|
|
207
|
+
EmptyStateAnnouncer,
|
|
208
|
+
StyledAnnouncer,
|
|
209
|
+
lineLimitClass,
|
|
210
|
+
ExpandButton,
|
|
211
|
+
ActionButton,
|
|
212
|
+
CloseButton,
|
|
213
|
+
ChildrenWrapper,
|
|
214
|
+
};
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
export default Box;
|
|
2
|
+
/**
|
|
3
|
+
* @param {string | string[]} value
|
|
4
|
+
* @param {string} defaultValue
|
|
5
|
+
*/
|
|
6
|
+
export function getSpaces(value: string | string[], defaultValue: string): any[];
|
|
7
|
+
/**
|
|
8
|
+
* @param {string | string[]} value
|
|
9
|
+
* @param {string} defaultValue
|
|
10
|
+
*/
|
|
11
|
+
export function getSizes(value: string | string[], defaultValue: string): any[];
|
|
12
|
+
/**
|
|
13
|
+
* @param {string | string[]} value
|
|
14
|
+
* @param {string} defaultValue
|
|
15
|
+
*/
|
|
16
|
+
export function getBorderWidth(value: string | string[], defaultValue: string): string[];
|
|
17
|
+
/**
|
|
18
|
+
* @param {string | string[]} value
|
|
19
|
+
* @param {string} defaultValue
|
|
20
|
+
*/
|
|
21
|
+
export function getRadiis(value: string | string[], defaultValue: string): any[];
|
|
22
|
+
/**
|
|
23
|
+
* @param {string | string[]} value
|
|
24
|
+
* @param {string} defaultValue
|
|
25
|
+
*/
|
|
26
|
+
export function getShadows(value: string | string[], defaultValue: string): any[];
|
|
27
|
+
/**
|
|
28
|
+
* Clad-UI-s theme-aware replacement for \<div \/\> HTML element
|
|
29
|
+
*
|
|
30
|
+
* `🧪Beta`
|
|
31
|
+
*
|
|
32
|
+
* @type {React.FC<{
|
|
33
|
+
* as?: any,
|
|
34
|
+
* className?: string,
|
|
35
|
+
* borderColor?: string,
|
|
36
|
+
* alignItems?: string,
|
|
37
|
+
* justifyContent?: string,
|
|
38
|
+
* textAlign?: string,
|
|
39
|
+
* color: string,
|
|
40
|
+
* backgroundColor?: string,
|
|
41
|
+
* backgroundImage?: string,
|
|
42
|
+
* style?: any,
|
|
43
|
+
* padding?: string | string[],
|
|
44
|
+
* paddingx?: string | string[],
|
|
45
|
+
* paddingy?: string | string[],
|
|
46
|
+
* width?: string | string[],
|
|
47
|
+
* maxWidth?: string | string[],
|
|
48
|
+
* height?: string | string[],
|
|
49
|
+
* borderWidth?: string | string[],
|
|
50
|
+
* borderRadius?: string | string[],
|
|
51
|
+
* boxShadow?: string | string[],
|
|
52
|
+
* children?: any,
|
|
53
|
+
* dangerousHtml?: string,
|
|
54
|
+
* }>}
|
|
55
|
+
*/
|
|
56
|
+
declare const Box: React.FC<{
|
|
57
|
+
as?: any;
|
|
58
|
+
className?: string;
|
|
59
|
+
borderColor?: string;
|
|
60
|
+
alignItems?: string;
|
|
61
|
+
justifyContent?: string;
|
|
62
|
+
textAlign?: string;
|
|
63
|
+
color: string;
|
|
64
|
+
backgroundColor?: string;
|
|
65
|
+
backgroundImage?: string;
|
|
66
|
+
style?: any;
|
|
67
|
+
padding?: string | string[];
|
|
68
|
+
paddingx?: string | string[];
|
|
69
|
+
paddingy?: string | string[];
|
|
70
|
+
width?: string | string[];
|
|
71
|
+
maxWidth?: string | string[];
|
|
72
|
+
height?: string | string[];
|
|
73
|
+
borderWidth?: string | string[];
|
|
74
|
+
borderRadius?: string | string[];
|
|
75
|
+
boxShadow?: string | string[];
|
|
76
|
+
children?: any;
|
|
77
|
+
dangerousHtml?: string;
|
|
78
|
+
}>;
|
|
79
|
+
import React from "react";
|