@cleartrip/ct-design-alert-callout 4.0.0 → 5.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/README.md +88 -0
- package/dist/AlertCallout.d.ts +3 -4
- package/dist/AlertCallout.d.ts.map +1 -1
- package/dist/constants.d.ts +11 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/ct-design-alert-callout.browser.cjs.js +1 -1
- package/dist/ct-design-alert-callout.browser.cjs.js.map +1 -1
- package/dist/ct-design-alert-callout.browser.esm.js +1 -1
- package/dist/ct-design-alert-callout.browser.esm.js.map +1 -1
- package/dist/ct-design-alert-callout.cjs.js +76 -30
- package/dist/ct-design-alert-callout.cjs.js.map +1 -1
- package/dist/ct-design-alert-callout.esm.js +77 -26
- package/dist/ct-design-alert-callout.esm.js.map +1 -1
- package/dist/ct-design-alert-callout.umd.js +78 -136
- package/dist/ct-design-alert-callout.umd.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/style.d.ts +36 -4
- package/dist/style.d.ts.map +1 -1
- package/dist/type.d.ts +15 -21
- package/dist/type.d.ts.map +1 -1
- package/package.json +27 -9
- package/src/AlertCallout.tsx +98 -0
- package/src/constants.ts +10 -0
- package/src/index.ts +3 -0
- package/src/style.ts +63 -0
- package/src/type.ts +78 -0
package/README.md
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
# AlertCallout
|
|
2
|
+
|
|
3
|
+
A prominent alert component used to display important information or notifications.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install @cleartrip/ct-design-alert-callout
|
|
11
|
+
# or
|
|
12
|
+
pnpm add @cleartrip/ct-design-alert-callout
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
### Peer dependencies
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
# Required for all targets
|
|
19
|
+
npm install react
|
|
20
|
+
|
|
21
|
+
# Web only
|
|
22
|
+
npm install react-dom
|
|
23
|
+
|
|
24
|
+
# React Native only
|
|
25
|
+
npm install react-native
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## Usage
|
|
31
|
+
|
|
32
|
+
### Basic
|
|
33
|
+
|
|
34
|
+
```tsx
|
|
35
|
+
import { AlertCallout } from '@cleartrip/ct-design-alert-callout';
|
|
36
|
+
|
|
37
|
+
function Example() {
|
|
38
|
+
return (
|
|
39
|
+
<AlertCallout>
|
|
40
|
+
{/* Basic usage */}
|
|
41
|
+
</AlertCallout>
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
## Props
|
|
49
|
+
|
|
50
|
+
| Prop | Type | Default | Required | Description |
|
|
51
|
+
|------|------|---------|----------|-------------|
|
|
52
|
+
| `variant` | `AlertCalloutVariant` | — | No | The variant of the alert callout. |
|
|
53
|
+
| `prefixIconNode` | `ReactNode` | — | No | Prefix icon rendered on the leading edge of the callout. |
|
|
54
|
+
| `textNode` | `ReactNode` | — | ✅ Yes | Main content of the callout. When a string is provided, it is rendered |
|
|
55
|
+
| `rightActionNode` | `ReactNode` | — | No | Action node rendered on the trailing edge of the callout. |
|
|
56
|
+
| `description` | `ReactNode` | — | No | Optional description content rendered below the main callout row. |
|
|
57
|
+
| `onClick` | `() => void` | — | No | Callback fired when the root container is clicked. |
|
|
58
|
+
| `styleConfig` | `IAlertCalloutStyleConfig` | — | No | Style configuration overrides for each internal container. |
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
## AlertCalloutVariants
|
|
63
|
+
|
|
64
|
+
- `SUCCESS` — success
|
|
65
|
+
- `ERROR` — error
|
|
66
|
+
- `WARNING` — warning
|
|
67
|
+
- `INFO` — info
|
|
68
|
+
- `NEUTRAL` — neutral
|
|
69
|
+
- `BONVOY_BRIEF` — bonvoy_brief
|
|
70
|
+
- `BONVOY_COMPACT` — bonvoy_compact
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
## Accessibility
|
|
74
|
+
|
|
75
|
+
- The component follows accessibility best practices
|
|
76
|
+
- Ensure proper ARIA attributes are provided where needed
|
|
77
|
+
- Test with screen readers to ensure usability
|
|
78
|
+
|
|
79
|
+
---
|
|
80
|
+
|
|
81
|
+
## Migration
|
|
82
|
+
|
|
83
|
+
If migrating from a previous version:
|
|
84
|
+
|
|
85
|
+
```diff
|
|
86
|
+
- import { AlertCallout } from 'yagami/core/components';
|
|
87
|
+
+ import { AlertCallout } from '@cleartrip/ct-design-alert-callout';
|
|
88
|
+
```
|
package/dist/AlertCallout.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { IAlertCalloutProps } from './type';
|
|
3
|
-
|
|
4
|
-
declare const AlertCallout: PolymorphicAlertCallout;
|
|
1
|
+
import { ContainerRef } from '@cleartrip/ct-design-container';
|
|
2
|
+
import type { IAlertCalloutProps } from './type';
|
|
3
|
+
declare const AlertCallout: import("react").ForwardRefExoticComponent<IAlertCalloutProps & import("react").RefAttributes<ContainerRef>>;
|
|
5
4
|
export default AlertCallout;
|
|
6
5
|
//# sourceMappingURL=AlertCallout.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AlertCallout.d.ts","sourceRoot":"","sources":["../packages/components/AlertCallout/src/AlertCallout.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AlertCallout.d.ts","sourceRoot":"","sources":["../packages/components/AlertCallout/src/AlertCallout.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAa,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAIzE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,QAAQ,CAAC;AAGjD,QAAA,MAAM,YAAY,6GAqFjB,CAAC;AAGF,eAAe,YAAY,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare enum AlertCalloutVariants {
|
|
2
|
+
SUCCESS = "success",
|
|
3
|
+
ERROR = "error",
|
|
4
|
+
WARNING = "warning",
|
|
5
|
+
WARNING_LIGHT = "warningLight",
|
|
6
|
+
INFO = "info",
|
|
7
|
+
NEUTRAL = "neutral",
|
|
8
|
+
BONVOY_BRIEF = "bonvoy_brief",
|
|
9
|
+
BONVOY_COMPACT = "bonvoy_compact"
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../packages/components/AlertCallout/src/constants.ts"],"names":[],"mappings":"AAAA,oBAAY,oBAAoB;IAC9B,OAAO,YAAY;IACnB,KAAK,UAAU;IACf,OAAO,YAAY;IACnB,aAAa,iBAAiB;IAC9B,IAAI,SAAS;IACb,OAAO,YAAY;IACnB,YAAY,iBAAiB;IAC7B,cAAc,mBAAmB;CAClC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var e
|
|
1
|
+
"use strict";var e,r=require("react/jsx-runtime"),t=require("react"),o=require("@cleartrip/ct-design-container"),n=require("@cleartrip/ct-design-typography"),i=require("@cleartrip/ct-design-style-manager"),a=require("@cleartrip/ct-design-theme");exports.AlertCalloutVariants=void 0,(e=exports.AlertCalloutVariants||(exports.AlertCalloutVariants={})).SUCCESS="success",e.ERROR="error",e.WARNING="warning",e.WARNING_LIGHT="warningLight",e.INFO="info",e.NEUTRAL="neutral",e.BONVOY_BRIEF="bonvoy_brief",e.BONVOY_COMPACT="bonvoy_compact";const l=i.makeStyles(e=>({rootContainer:{display:"flex",flexDirection:"column",justifyContent:"center",paddingVertical:e.spacing[2],paddingHorizontal:e.spacing[3],borderRadius:e.border.radius[8]},flexRowBetween:{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},flexRow:{display:"flex",flexDirection:"row",alignItems:"center"},flexMiddle:{display:"flex",alignItems:"center"},prefixIconSpacing:{flexShrink:0,marginRight:e.spacing[2]},rightActionSpacing:{flexShrink:0,marginLeft:e.spacing[3]}})),s={[exports.AlertCalloutVariants.SUCCESS]:a.BaseTheme.color.alert.success,[exports.AlertCalloutVariants.ERROR]:a.BaseTheme.color.alert.error,[exports.AlertCalloutVariants.WARNING]:a.BaseTheme.color.alert.warning,[exports.AlertCalloutVariants.WARNING_LIGHT]:a.BaseTheme.color.alert.warningLight,[exports.AlertCalloutVariants.INFO]:a.BaseTheme.color.alert.info,[exports.AlertCalloutVariants.NEUTRAL]:a.BaseTheme.color.alert.neutral};function c(e){var r;const t=null!=e?e:exports.AlertCalloutVariants.SUCCESS;return null!==(r=s[t])&&void 0!==r?r:s[exports.AlertCalloutVariants.SUCCESS]||""}const C=t.forwardRef(({textNode:e,rightActionNode:t,prefixIconNode:a,variant:s,description:C,onClick:p,styleConfig:g},x)=>{const{root:d=[],rootContainer:f=[],prefixIconContainer:u=[],textNodeContainerWrapper:y=[],textNodeContainer:A=[],rightActionContainer:h=[]}=g||{},N=i.useStyles(()=>({variantBackground:{backgroundColor:c(s)}}),[s]);return r.jsxs(o.Container,{ref:x,onClick:p,styleConfig:{root:[l.rootContainer,N.variantBackground,...Array.isArray(d)?d:d?[d]:[]]},children:[r.jsxs(o.Container,{styleConfig:{root:[l.flexRowBetween]},children:[r.jsxs(o.Container,{styleConfig:{root:[l.flexRow,...Array.isArray(f)?f:f?[f]:[]]},children:[!!a&&r.jsx(o.Container,{styleConfig:{root:[l.flexMiddle,l.prefixIconSpacing,...u]},children:a}),r.jsx(o.Container,{styleConfig:{root:[l.flexMiddle,...y]},children:"string"==typeof e?r.jsx(n.Typography,{variant:n.TypographyVariant.P3,styleConfig:{root:[...A]},children:e}):e})]}),!!t&&r.jsx(o.Container,{styleConfig:{root:[l.rightActionSpacing,...h]},children:t})]}),!!C&&C]})});C.displayName="AlertCallout",exports.AlertCallout=C;
|
|
2
2
|
//# sourceMappingURL=ct-design-alert-callout.browser.cjs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ct-design-alert-callout.browser.cjs.js","sources":["../packages/components/AlertCallout/src/
|
|
1
|
+
{"version":3,"file":"ct-design-alert-callout.browser.cjs.js","sources":["../packages/components/AlertCallout/src/constants.ts","../packages/components/AlertCallout/src/style.ts","../packages/components/AlertCallout/src/AlertCallout.tsx"],"sourcesContent":[null,null,null],"names":["AlertCalloutVariants","alertCalloutStaticStyles","makeStyles","theme","rootContainer","display","flexDirection","justifyContent","paddingVertical","spacing","paddingHorizontal","borderRadius","border","radius","flexRowBetween","alignItems","flexRow","flexMiddle","prefixIconSpacing","flexShrink","marginRight","rightActionSpacing","marginLeft","COLOR_MAPPING","SUCCESS","BaseTheme","color","alert","success","ERROR","error","WARNING","warning","WARNING_LIGHT","warningLight","INFO","info","NEUTRAL","neutral","getAlertCalloutColourCode","variant","resolved","AlertCallout","forwardRef","textNode","rightActionNode","prefixIconNode","description","onClick","styleConfig","forwardedRef","root","prefixIconContainer","textNodeContainerWrapper","textNodeContainer","rightActionContainer","dynamicStyles","useStyles","variantBackground","backgroundColor","_jsxs","Container","ref","staticStyles","Array","isArray","children","_jsx","jsx","Typography","TypographyVariant","P3","displayName"],"mappings":"iBAAYA,qOAAAA,QASXA,0BAAA,GATWA,EAAAA,QAAoBA,uBAApBA,6BASX,CAAA,IARC,QAAA,UACAA,EAAA,MAAA,QACAA,EAAA,QAAA,UACAA,EAAA,cAAA,eACAA,EAAA,KAAA,OACAA,EAAA,QAAA,UACAA,EAAA,aAAA,eACAA,EAAA,eAAA,iBCKF,MAAMC,EAA2BC,EAAAA,WAAYC,IAAW,CACtDC,cAAe,CACbC,QAAS,OACTC,cAAe,SACfC,eAAgB,SAChBC,gBAAiBL,EAAMM,QAAQ,GAC/BC,kBAAmBP,EAAMM,QAAQ,GACjCE,aAAcR,EAAMS,OAAOC,OAAO,IAGpCC,eAAgB,CACdT,QAAS,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EAAa3D,cACboD,EAAcE,qBACVM,MAAMC,QAAQd,GAAQA,EAAOA,EAAO,CAACA,GAAQ,KAEpDe,SAAA,CAEDN,OAACC,EAASA,UAAA,CAACZ,YAAa,CAAEE,KAAM,CAACY,EAAajD,iBAAiBoD,SAAA,CAC7DN,EAAAA,KAACC,EAAAA,UAAS,CACRZ,YAAa,CACXE,KAAM,CACJY,EAAa/C,WACTgD,MAAMC,QAAQ7D,GAAiBA,EAAgBA,EAAgB,CAACA,GAAiB,KAIxF8D,SAAA,GAAEpB,GACDqB,EAAAA,IAACN,EAAAA,UACC,CAAAZ,YAAa,CACXE,KAAM,CAACY,EAAa9C,WAAY8C,EAAa7C,qBAAsBkC,IAGpEc,SAAApB,IAILqB,EAAAA,IAACN,EAAAA,UAAS,CACRZ,YAAa,CACXE,KAAM,CAACY,EAAa9C,cAAeoC,IACpCa,SAEoB,iBAAbtB,EACNuB,EAAAC,IAACC,aAAU,CACT7B,QAAS8B,EAAAA,kBAAkBC,GAC3BtB,YAAa,CACXE,KAAM,IAAIG,IAGXY,SAAAtB,IAGH,SAKHC,GACDsB,EAACC,IAAAP,EAASA,UACR,CAAAZ,YAAa,CACXE,KAAM,CAACY,EAAa1C,sBAAuBkC,IAC5CW,SAEArB,SAIJE,GAAeA,OAM1BL,EAAa8B,YAAc"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{jsxs as r,jsx as e}from"react/jsx-runtime";import{forwardRef as o}from"react";import{Container as n}from"@cleartrip/ct-design-container";import{Typography as t,TypographyVariant as i}from"@cleartrip/ct-design-typography";import{makeStyles as a,useStyles as l}from"@cleartrip/ct-design-style-manager";import{BaseTheme as c}from"@cleartrip/ct-design-theme";var s;!function(r){r.SUCCESS="success",r.ERROR="error",r.WARNING="warning",r.WARNING_LIGHT="warningLight",r.INFO="info",r.NEUTRAL="neutral",r.BONVOY_BRIEF="bonvoy_brief",r.BONVOY_COMPACT="bonvoy_compact"}(s||(s={}));const f=a(r=>({rootContainer:{display:"flex",flexDirection:"column",justifyContent:"center",paddingVertical:r.spacing[2],paddingHorizontal:r.spacing[3],borderRadius:r.border.radius[8]},flexRowBetween:{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},flexRow:{display:"flex",flexDirection:"row",alignItems:"center"},flexMiddle:{display:"flex",alignItems:"center"},prefixIconSpacing:{flexShrink:0,marginRight:r.spacing[2]},rightActionSpacing:{flexShrink:0,marginLeft:r.spacing[3]}})),g={[s.SUCCESS]:c.color.alert.success,[s.ERROR]:c.color.alert.error,[s.WARNING]:c.color.alert.warning,[s.WARNING_LIGHT]:c.color.alert.warningLight,[s.INFO]:c.color.alert.info,[s.NEUTRAL]:c.color.alert.neutral};function d(r){var e;const o=null!=r?r:s.SUCCESS;return null!==(e=g[o])&&void 0!==e?e:g[s.SUCCESS]||""}const p=o(({textNode:o,rightActionNode:a,prefixIconNode:c,variant:s,description:g,onClick:p,styleConfig:C},x)=>{const{root:y=[],rootContainer:m=[],prefixIconContainer:u=[],textNodeContainerWrapper:N=[],textNodeContainer:R=[],rightActionContainer:h=[]}=C||{},S=l(()=>({variantBackground:{backgroundColor:d(s)}}),[s]);return r(n,{ref:x,onClick:p,styleConfig:{root:[f.rootContainer,S.variantBackground,...Array.isArray(y)?y:y?[y]:[]]},children:[r(n,{styleConfig:{root:[f.flexRowBetween]},children:[r(n,{styleConfig:{root:[f.flexRow,...Array.isArray(m)?m:m?[m]:[]]},children:[!!c&&e(n,{styleConfig:{root:[f.flexMiddle,f.prefixIconSpacing,...u]},children:c}),e(n,{styleConfig:{root:[f.flexMiddle,...N]},children:"string"==typeof o?e(t,{variant:i.P3,styleConfig:{root:[...R]},children:o}):o})]}),!!a&&e(n,{styleConfig:{root:[f.rightActionSpacing,...h]},children:a})]}),!!g&&g]})});p.displayName="AlertCallout";export{p as AlertCallout,s as AlertCalloutVariants};
|
|
2
2
|
//# sourceMappingURL=ct-design-alert-callout.browser.esm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ct-design-alert-callout.browser.esm.js","sources":["../packages/components/AlertCallout/src/
|
|
1
|
+
{"version":3,"file":"ct-design-alert-callout.browser.esm.js","sources":["../packages/components/AlertCallout/src/constants.ts","../packages/components/AlertCallout/src/style.ts","../packages/components/AlertCallout/src/AlertCallout.tsx"],"sourcesContent":[null,null,null],"names":["AlertCalloutVariants","alertCalloutStaticStyles","makeStyles","theme","rootContainer","display","flexDirection","justifyContent","paddingVertical","spacing","paddingHorizontal","borderRadius","border","radius","flexRowBetween","alignItems","flexRow","flexMiddle","prefixIconSpacing","flexShrink","marginRight","rightActionSpacing","marginLeft","COLOR_MAPPING","SUCCESS","BaseTheme","color","alert","success","ERROR","error","WARNING","warning","WARNING_LIGHT","warningLight","INFO","info","NEUTRAL","neutral","getAlertCalloutColourCode","variant","resolved","AlertCallout","forwardRef","textNode","rightActionNode","prefixIconNode","description","onClick","styleConfig","forwardedRef","root","prefixIconContainer","textNodeContainerWrapper","textNodeContainer","rightActionContainer","dynamicStyles","useStyles","variantBackground","backgroundColor","_jsxs","Container","ref","staticStyles","Array","isArray","children","_jsx","Typography","TypographyVariant","P3","displayName"],"mappings":"8WAAYA,GAAZ,SAAYA,GACVA,EAAA,QAAA,UACAA,EAAA,MAAA,QACAA,EAAA,QAAA,UACAA,EAAA,cAAA,eACAA,EAAA,KAAA,OACAA,EAAA,QAAA,UACAA,EAAA,aAAA,eACAA,EAAA,eAAA,gBACD,CATD,CAAYA,IAAAA,EASX,CAAA,ICID,MAAMC,EAA2BC,EAAYC,IAAW,CACtDC,cAAe,CACbC,QAAS,OACTC,cAAe,SACfC,eAAgB,SAChBC,gBAAiBL,EAAMM,QAAQ,GAC/BC,kBAAmBP,EAAMM,QAAQ,GACjCE,aAAcR,EAAMS,OAAOC,OAAO,IAGpCC,eAAgB,CACdT,QAAS,OACTC,cAAe,MACfS,WAAY,SACZR,eAAgB,iBAElBS,QAAS,CACPX,QAAS,OACTC,cAAe,MACfS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CACXE,KAAM,CACJY,EAAa/C,WACTgD,MAAMC,QAAQ7D,GAAiBA,EAAgBA,EAAgB,CAACA,GAAiB,KAIxF8D,SAAA,GAAEpB,GACDqB,EAACN,EACC,CAAAZ,YAAa,CACXE,KAAM,CAACY,EAAa9C,WAAY8C,EAAa7C,qBAAsBkC,IAGpEc,SAAApB,IAILqB,EAACN,EAAS,CACRZ,YAAa,CACXE,KAAM,CAACY,EAAa9C,cAAeoC,IACpCa,SAEoB,iBAAbtB,EACNuB,EAACC,EAAU,CACT5B,QAAS6B,EAAkBC,GAC3BrB,YAAa,CACXE,KAAM,IAAIG,IAGXY,SAAAtB,IAGH,SAKHC,GACDsB,EAACN,EACC,CAAAZ,YAAa,CACXE,KAAM,CAACY,EAAa1C,sBAAuBkC,IAC5CW,SAEArB,SAIJE,GAAeA,OAM1BL,EAAa6B,YAAc"}
|
|
@@ -1,54 +1,100 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var tslib = require('tslib');
|
|
4
3
|
var jsxRuntime = require('react/jsx-runtime');
|
|
5
4
|
var react = require('react');
|
|
6
|
-
var styled = require('styled-components');
|
|
7
5
|
var ctDesignContainer = require('@cleartrip/ct-design-container');
|
|
6
|
+
var ctDesignTypography = require('@cleartrip/ct-design-typography');
|
|
7
|
+
var ctDesignStyleManager = require('@cleartrip/ct-design-style-manager');
|
|
8
8
|
var ctDesignTheme = require('@cleartrip/ct-design-theme');
|
|
9
|
-
var classNames = require('classnames');
|
|
10
|
-
|
|
11
|
-
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
|
-
|
|
13
|
-
var styled__default = /*#__PURE__*/_interopDefault(styled);
|
|
14
|
-
var classNames__default = /*#__PURE__*/_interopDefault(classNames);
|
|
15
9
|
|
|
16
10
|
exports.AlertCalloutVariants = void 0;
|
|
17
11
|
(function (AlertCalloutVariants) {
|
|
18
12
|
AlertCalloutVariants["SUCCESS"] = "success";
|
|
19
13
|
AlertCalloutVariants["ERROR"] = "error";
|
|
20
14
|
AlertCalloutVariants["WARNING"] = "warning";
|
|
15
|
+
AlertCalloutVariants["WARNING_LIGHT"] = "warningLight";
|
|
21
16
|
AlertCalloutVariants["INFO"] = "info";
|
|
22
17
|
AlertCalloutVariants["NEUTRAL"] = "neutral";
|
|
18
|
+
AlertCalloutVariants["BONVOY_BRIEF"] = "bonvoy_brief";
|
|
19
|
+
AlertCalloutVariants["BONVOY_COMPACT"] = "bonvoy_compact";
|
|
23
20
|
})(exports.AlertCalloutVariants || (exports.AlertCalloutVariants = {}));
|
|
24
21
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
22
|
+
const alertCalloutStaticStyles = ctDesignStyleManager.makeStyles((theme) => ({
|
|
23
|
+
rootContainer: {
|
|
24
|
+
display: 'flex',
|
|
25
|
+
flexDirection: 'column',
|
|
26
|
+
justifyContent: 'center',
|
|
27
|
+
paddingVertical: theme.spacing[2],
|
|
28
|
+
paddingHorizontal: theme.spacing[3],
|
|
29
|
+
borderRadius: theme.border.radius[8],
|
|
30
|
+
},
|
|
31
|
+
flexRowBetween: {
|
|
32
|
+
display: 'flex',
|
|
33
|
+
flexDirection: 'row',
|
|
34
|
+
alignItems: 'center',
|
|
35
|
+
justifyContent: 'space-between',
|
|
36
|
+
},
|
|
37
|
+
flexRow: {
|
|
38
|
+
display: 'flex',
|
|
39
|
+
flexDirection: 'row',
|
|
40
|
+
alignItems: 'center',
|
|
41
|
+
},
|
|
42
|
+
flexMiddle: {
|
|
43
|
+
display: 'flex',
|
|
44
|
+
alignItems: 'center',
|
|
45
|
+
},
|
|
46
|
+
prefixIconSpacing: {
|
|
47
|
+
flexShrink: 0,
|
|
48
|
+
marginRight: theme.spacing[2],
|
|
49
|
+
},
|
|
50
|
+
rightActionSpacing: {
|
|
51
|
+
flexShrink: 0,
|
|
52
|
+
marginLeft: theme.spacing[3],
|
|
53
|
+
},
|
|
54
|
+
}));
|
|
55
|
+
const COLOR_MAPPING = {
|
|
56
|
+
[exports.AlertCalloutVariants.SUCCESS]: ctDesignTheme.BaseTheme.color.alert.success,
|
|
57
|
+
[exports.AlertCalloutVariants.ERROR]: ctDesignTheme.BaseTheme.color.alert.error,
|
|
58
|
+
[exports.AlertCalloutVariants.WARNING]: ctDesignTheme.BaseTheme.color.alert.warning,
|
|
59
|
+
[exports.AlertCalloutVariants.WARNING_LIGHT]: ctDesignTheme.BaseTheme.color.alert.warningLight,
|
|
60
|
+
[exports.AlertCalloutVariants.INFO]: ctDesignTheme.BaseTheme.color.alert.info,
|
|
61
|
+
[exports.AlertCalloutVariants.NEUTRAL]: ctDesignTheme.BaseTheme.color.alert.neutral,
|
|
62
|
+
};
|
|
33
63
|
function getAlertCalloutColourCode(variant) {
|
|
34
64
|
var _a;
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
function getAlertCalloutDefaultStyles(_a) {
|
|
38
|
-
var theme = _a.theme, variant = _a.variant, css = _a.css;
|
|
39
|
-
return tslib.__assign({ display: 'flex', justifyContent: 'center', flexDirection: 'column', backgroundColor: getAlertCalloutColourCode(variant), padding: '8px 12px', borderRadius: theme.border.radius[8] }, css);
|
|
65
|
+
const resolved = variant !== null && variant !== void 0 ? variant : exports.AlertCalloutVariants.SUCCESS;
|
|
66
|
+
return (_a = COLOR_MAPPING[resolved]) !== null && _a !== void 0 ? _a : (COLOR_MAPPING[exports.AlertCalloutVariants.SUCCESS] || '');
|
|
40
67
|
}
|
|
41
68
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
69
|
+
const AlertCallout = react.forwardRef(({ textNode, rightActionNode, prefixIconNode, variant, description, onClick, styleConfig }, forwardedRef) => {
|
|
70
|
+
const { root = [], rootContainer = [], prefixIconContainer = [], textNodeContainerWrapper = [], textNodeContainer = [], rightActionContainer = [], } = styleConfig || {};
|
|
71
|
+
const dynamicStyles = ctDesignStyleManager.useStyles(() => ({
|
|
72
|
+
variantBackground: {
|
|
73
|
+
backgroundColor: getAlertCalloutColourCode(variant),
|
|
74
|
+
},
|
|
75
|
+
}), [variant]);
|
|
76
|
+
return (jsxRuntime.jsxs(ctDesignContainer.Container, { ref: forwardedRef, onClick: onClick, styleConfig: {
|
|
77
|
+
root: [
|
|
78
|
+
alertCalloutStaticStyles.rootContainer,
|
|
79
|
+
dynamicStyles.variantBackground,
|
|
80
|
+
...(Array.isArray(root) ? root : root ? [root] : []),
|
|
81
|
+
],
|
|
82
|
+
}, children: [jsxRuntime.jsxs(ctDesignContainer.Container, { styleConfig: { root: [alertCalloutStaticStyles.flexRowBetween] }, children: [jsxRuntime.jsxs(ctDesignContainer.Container, { styleConfig: {
|
|
83
|
+
root: [
|
|
84
|
+
alertCalloutStaticStyles.flexRow,
|
|
85
|
+
...(Array.isArray(rootContainer) ? rootContainer : rootContainer ? [rootContainer] : []),
|
|
86
|
+
],
|
|
87
|
+
}, children: [!!prefixIconNode && (jsxRuntime.jsx(ctDesignContainer.Container, { styleConfig: {
|
|
88
|
+
root: [alertCalloutStaticStyles.flexMiddle, alertCalloutStaticStyles.prefixIconSpacing, ...prefixIconContainer],
|
|
89
|
+
}, children: prefixIconNode })), jsxRuntime.jsx(ctDesignContainer.Container, { styleConfig: {
|
|
90
|
+
root: [alertCalloutStaticStyles.flexMiddle, ...textNodeContainerWrapper],
|
|
91
|
+
}, children: typeof textNode === 'string' ? (jsxRuntime.jsx(ctDesignTypography.Typography, { variant: ctDesignTypography.TypographyVariant.P3, styleConfig: {
|
|
92
|
+
root: [...textNodeContainer],
|
|
93
|
+
}, children: textNode })) : (textNode) })] }), !!rightActionNode && (jsxRuntime.jsx(ctDesignContainer.Container, { styleConfig: {
|
|
94
|
+
root: [alertCalloutStaticStyles.rightActionSpacing, ...rightActionContainer],
|
|
95
|
+
}, children: rightActionNode }))] }), !!description && description] }));
|
|
51
96
|
});
|
|
97
|
+
AlertCallout.displayName = 'AlertCallout';
|
|
52
98
|
|
|
53
99
|
exports.AlertCallout = AlertCallout;
|
|
54
100
|
//# sourceMappingURL=ct-design-alert-callout.cjs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ct-design-alert-callout.cjs.js","sources":["../packages/components/AlertCallout/src/
|
|
1
|
+
{"version":3,"file":"ct-design-alert-callout.cjs.js","sources":["../packages/components/AlertCallout/src/constants.ts","../packages/components/AlertCallout/src/style.ts","../packages/components/AlertCallout/src/AlertCallout.tsx"],"sourcesContent":[null,null,null],"names":["AlertCalloutVariants","makeStyles","BaseTheme","forwardRef","useStyles","_jsxs","Container","staticStyles","_jsx","Typography","TypographyVariant"],"mappings":";;;;;;;;;AAAYA,sCASX;AATD,CAAA,UAAY,oBAAoB,EAAA;AAC9B,IAAA,oBAAA,CAAA,SAAA,CAAA,GAAA,SAAmB,CAAA;AACnB,IAAA,oBAAA,CAAA,OAAA,CAAA,GAAA,OAAe,CAAA;AACf,IAAA,oBAAA,CAAA,SAAA,CAAA,GAAA,SAAmB,CAAA;AACnB,IAAA,oBAAA,CAAA,eAAA,CAAA,GAAA,cAA8B,CAAA;AAC9B,IAAA,oBAAA,CAAA,MAAA,CAAA,GAAA,MAAa,CAAA;AACb,IAAA,oBAAA,CAAA,SAAA,CAAA,GAAA,SAAmB,CAAA;AACnB,IAAA,oBAAA,CAAA,cAAA,CAAA,GAAA,cAA6B,CAAA;AAC7B,IAAA,oBAAA,CAAA,gBAAA,CAAA,GAAA,gBAAiC,CAAA;AACnC,CAAC,EATWA,4BAAoB,KAApBA,4BAAoB,GAS/B,EAAA,CAAA,CAAA;;ACID,MAAM,wBAAwB,GAAGC,+BAAU,CAAC,CAAC,KAAK,MAAM;AACtD,IAAA,aAAa,EAAE;AACb,QAAA,OAAO,EAAE,MAAM;AACf,QAAA,aAAa,EAAE,QAAQ;AACvB,QAAA,cAAc,EAAE,QAAQ;A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B,EAAE,GAAG,oBAAoB,CAAC;AACjE,yBAAA,EAAA,QAAA,EAEA,eAAe,EAAA,CACN,CACb,CAAA,EAAA,CACS,EACX,CAAC,CAAC,WAAW,IAAI,WAAW,CACnB,EAAA,CAAA,EACZ;AACJ,CAAC,EACD;AAEF,YAAY,CAAC,WAAW,GAAG,cAAc;;;;"}
|
|
@@ -1,47 +1,98 @@
|
|
|
1
|
-
import { __assign, __rest } from 'tslib';
|
|
2
1
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
2
|
import { forwardRef } from 'react';
|
|
4
|
-
import styled from 'styled-components';
|
|
5
3
|
import { Container } from '@cleartrip/ct-design-container';
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
4
|
+
import { Typography, TypographyVariant } from '@cleartrip/ct-design-typography';
|
|
5
|
+
import { makeStyles, useStyles } from '@cleartrip/ct-design-style-manager';
|
|
6
|
+
import { BaseTheme } from '@cleartrip/ct-design-theme';
|
|
8
7
|
|
|
9
8
|
var AlertCalloutVariants;
|
|
10
9
|
(function (AlertCalloutVariants) {
|
|
11
10
|
AlertCalloutVariants["SUCCESS"] = "success";
|
|
12
11
|
AlertCalloutVariants["ERROR"] = "error";
|
|
13
12
|
AlertCalloutVariants["WARNING"] = "warning";
|
|
13
|
+
AlertCalloutVariants["WARNING_LIGHT"] = "warningLight";
|
|
14
14
|
AlertCalloutVariants["INFO"] = "info";
|
|
15
15
|
AlertCalloutVariants["NEUTRAL"] = "neutral";
|
|
16
|
+
AlertCalloutVariants["BONVOY_BRIEF"] = "bonvoy_brief";
|
|
17
|
+
AlertCalloutVariants["BONVOY_COMPACT"] = "bonvoy_compact";
|
|
16
18
|
})(AlertCalloutVariants || (AlertCalloutVariants = {}));
|
|
17
19
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
20
|
+
const alertCalloutStaticStyles = makeStyles((theme) => ({
|
|
21
|
+
rootContainer: {
|
|
22
|
+
display: 'flex',
|
|
23
|
+
flexDirection: 'column',
|
|
24
|
+
justifyContent: 'center',
|
|
25
|
+
paddingVertical: theme.spacing[2],
|
|
26
|
+
paddingHorizontal: theme.spacing[3],
|
|
27
|
+
borderRadius: theme.border.radius[8],
|
|
28
|
+
},
|
|
29
|
+
flexRowBetween: {
|
|
30
|
+
display: 'flex',
|
|
31
|
+
flexDirection: 'row',
|
|
32
|
+
alignItems: 'center',
|
|
33
|
+
justifyContent: 'space-between',
|
|
34
|
+
},
|
|
35
|
+
flexRow: {
|
|
36
|
+
display: 'flex',
|
|
37
|
+
flexDirection: 'row',
|
|
38
|
+
alignItems: 'center',
|
|
39
|
+
},
|
|
40
|
+
flexMiddle: {
|
|
41
|
+
display: 'flex',
|
|
42
|
+
alignItems: 'center',
|
|
43
|
+
},
|
|
44
|
+
prefixIconSpacing: {
|
|
45
|
+
flexShrink: 0,
|
|
46
|
+
marginRight: theme.spacing[2],
|
|
47
|
+
},
|
|
48
|
+
rightActionSpacing: {
|
|
49
|
+
flexShrink: 0,
|
|
50
|
+
marginLeft: theme.spacing[3],
|
|
51
|
+
},
|
|
52
|
+
}));
|
|
53
|
+
const COLOR_MAPPING = {
|
|
54
|
+
[AlertCalloutVariants.SUCCESS]: BaseTheme.color.alert.success,
|
|
55
|
+
[AlertCalloutVariants.ERROR]: BaseTheme.color.alert.error,
|
|
56
|
+
[AlertCalloutVariants.WARNING]: BaseTheme.color.alert.warning,
|
|
57
|
+
[AlertCalloutVariants.WARNING_LIGHT]: BaseTheme.color.alert.warningLight,
|
|
58
|
+
[AlertCalloutVariants.INFO]: BaseTheme.color.alert.info,
|
|
59
|
+
[AlertCalloutVariants.NEUTRAL]: BaseTheme.color.alert.neutral,
|
|
60
|
+
};
|
|
26
61
|
function getAlertCalloutColourCode(variant) {
|
|
27
62
|
var _a;
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
function getAlertCalloutDefaultStyles(_a) {
|
|
31
|
-
var theme = _a.theme, variant = _a.variant, css = _a.css;
|
|
32
|
-
return __assign({ display: 'flex', justifyContent: 'center', flexDirection: 'column', backgroundColor: getAlertCalloutColourCode(variant), padding: '8px 12px', borderRadius: theme.border.radius[8] }, css);
|
|
63
|
+
const resolved = variant !== null && variant !== void 0 ? variant : AlertCalloutVariants.SUCCESS;
|
|
64
|
+
return (_a = COLOR_MAPPING[resolved]) !== null && _a !== void 0 ? _a : (COLOR_MAPPING[AlertCalloutVariants.SUCCESS] || '');
|
|
33
65
|
}
|
|
34
66
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
67
|
+
const AlertCallout = forwardRef(({ textNode, rightActionNode, prefixIconNode, variant, description, onClick, styleConfig }, forwardedRef) => {
|
|
68
|
+
const { root = [], rootContainer = [], prefixIconContainer = [], textNodeContainerWrapper = [], textNodeContainer = [], rightActionContainer = [], } = styleConfig || {};
|
|
69
|
+
const dynamicStyles = useStyles(() => ({
|
|
70
|
+
variantBackground: {
|
|
71
|
+
backgroundColor: getAlertCalloutColourCode(variant),
|
|
72
|
+
},
|
|
73
|
+
}), [variant]);
|
|
74
|
+
return (jsxs(Container, { ref: forwardedRef, onClick: onClick, styleConfig: {
|
|
75
|
+
root: [
|
|
76
|
+
alertCalloutStaticStyles.rootContainer,
|
|
77
|
+
dynamicStyles.variantBackground,
|
|
78
|
+
...(Array.isArray(root) ? root : root ? [root] : []),
|
|
79
|
+
],
|
|
80
|
+
}, children: [jsxs(Container, { styleConfig: { root: [alertCalloutStaticStyles.flexRowBetween] }, children: [jsxs(Container, { styleConfig: {
|
|
81
|
+
root: [
|
|
82
|
+
alertCalloutStaticStyles.flexRow,
|
|
83
|
+
...(Array.isArray(rootContainer) ? rootContainer : rootContainer ? [rootContainer] : []),
|
|
84
|
+
],
|
|
85
|
+
}, children: [!!prefixIconNode && (jsx(Container, { styleConfig: {
|
|
86
|
+
root: [alertCalloutStaticStyles.flexMiddle, alertCalloutStaticStyles.prefixIconSpacing, ...prefixIconContainer],
|
|
87
|
+
}, children: prefixIconNode })), jsx(Container, { styleConfig: {
|
|
88
|
+
root: [alertCalloutStaticStyles.flexMiddle, ...textNodeContainerWrapper],
|
|
89
|
+
}, children: typeof textNode === 'string' ? (jsx(Typography, { variant: TypographyVariant.P3, styleConfig: {
|
|
90
|
+
root: [...textNodeContainer],
|
|
91
|
+
}, children: textNode })) : (textNode) })] }), !!rightActionNode && (jsx(Container, { styleConfig: {
|
|
92
|
+
root: [alertCalloutStaticStyles.rightActionSpacing, ...rightActionContainer],
|
|
93
|
+
}, children: rightActionNode }))] }), !!description && description] }));
|
|
44
94
|
});
|
|
95
|
+
AlertCallout.displayName = 'AlertCallout';
|
|
45
96
|
|
|
46
97
|
export { AlertCallout, AlertCalloutVariants };
|
|
47
98
|
//# sourceMappingURL=ct-design-alert-callout.esm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ct-design-alert-callout.esm.js","sources":["../packages/components/AlertCallout/src/
|
|
1
|
+
{"version":3,"file":"ct-design-alert-callout.esm.js","sources":["../packages/components/AlertCallout/src/constants.ts","../packages/components/AlertCallout/src/style.ts","../packages/components/AlertCallout/src/AlertCallout.tsx"],"sourcesContent":[null,null,null],"names":["_jsxs","staticStyles","_jsx"],"mappings":";;;;;;;IAAY,qBASX;AATD,CAAA,UAAY,oBAAoB,EAAA;AAC9B,IAAA,oBAAA,CAAA,SAAA,CAAA,GAAA,SAAmB,CAAA;AACnB,IAAA,oBAAA,CAAA,OAAA,CAAA,GAAA,OAAe,CAAA;AACf,IAAA,oBAAA,CAAA,SAAA,CAAA,GAAA,SAAmB,CAAA;AACnB,IAAA,oBAAA,CAAA,eAAA,CAAA,GAAA,cAA8B,CAAA;AAC9B,IAAA,oBAAA,CAAA,MAAA,CAAA,GAAA,MAAa,CAAA;AACb,IAAA,oBAAA,CAAA,SAAA,CAAA,GA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