@cleartrip/ct-design-dialog 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 +75 -0
- package/dist/Dialog.d.ts +3 -4
- package/dist/Dialog.d.ts.map +1 -1
- package/dist/Dialog.native.d.ts +5 -0
- package/dist/Dialog.native.d.ts.map +1 -0
- package/dist/DialogAction/DialogAction.d.ts +5 -6
- package/dist/DialogAction/DialogAction.d.ts.map +1 -1
- package/dist/DialogAction/DialogAction.native.d.ts +7 -0
- package/dist/DialogAction/DialogAction.native.d.ts.map +1 -0
- package/dist/DialogContent/DialogContent.d.ts +5 -6
- package/dist/DialogContent/DialogContent.d.ts.map +1 -1
- package/dist/DialogContent/DialogContent.native.d.ts +7 -0
- package/dist/DialogContent/DialogContent.native.d.ts.map +1 -0
- package/dist/constants.d.ts +9 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/ct-design-dialog.browser.cjs.js +1 -1
- package/dist/ct-design-dialog.browser.cjs.js.map +1 -1
- package/dist/ct-design-dialog.browser.esm.js +1 -1
- package/dist/ct-design-dialog.browser.esm.js.map +1 -1
- package/dist/ct-design-dialog.cjs.js +67 -39
- package/dist/ct-design-dialog.cjs.js.map +1 -1
- package/dist/ct-design-dialog.esm.js +69 -41
- package/dist/ct-design-dialog.esm.js.map +1 -1
- package/dist/ct-design-dialog.umd.js +70 -79
- package/dist/ct-design-dialog.umd.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.native.d.ts +6 -0
- package/dist/index.native.d.ts.map +1 -0
- package/dist/type.d.ts +41 -33
- package/dist/type.d.ts.map +1 -1
- package/package.json +23 -14
- package/src/Dialog.native.tsx +83 -0
- package/src/Dialog.tsx +130 -0
- package/src/DialogAction/DialogAction.native.tsx +69 -0
- package/src/DialogAction/DialogAction.tsx +77 -0
- package/src/DialogContent/DialogContent.native.tsx +39 -0
- package/src/DialogContent/DialogContent.tsx +42 -0
- package/src/constants.ts +9 -0
- package/src/index.native.ts +5 -0
- package/src/index.ts +5 -0
- package/src/type.ts +185 -0
- package/dist/style.d.ts +0 -43
- package/dist/style.d.ts.map +0 -1
package/src/type.ts
ADDED
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
import type { Styles } from '@cleartrip/ct-design-types';
|
|
4
|
+
import type { IModalProps } from '@cleartrip/ct-design-modal';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Legacy close-affordance config preserved from aldenui. Each flag
|
|
8
|
+
* maps to a specific actionButton variant + alignment on the
|
|
9
|
+
* underlying Modal:
|
|
10
|
+
* - `isBack` → back arrow, aligned left
|
|
11
|
+
* - `showCloseIcon`→ cross icon, aligned right
|
|
12
|
+
* - `isCenter` → cross icon, centered
|
|
13
|
+
*
|
|
14
|
+
* TODO(deprecate): callers should set `actionButtonType` and
|
|
15
|
+
* `actionButtonAlignment` on the inherited `IModalProps` surface
|
|
16
|
+
* directly. The overlayCloseIcon shim is retained for API parity with
|
|
17
|
+
* aldenui consumers and will be removed once downstream migrates.
|
|
18
|
+
*/
|
|
19
|
+
export type OverlayCloseIconProps = {
|
|
20
|
+
show: boolean;
|
|
21
|
+
isBack?: boolean;
|
|
22
|
+
isCenter?: boolean;
|
|
23
|
+
isTop?: boolean;
|
|
24
|
+
showCloseIcon?: boolean;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* `styleConfig` slots exposed by `Dialog`. These are forwarded onto
|
|
29
|
+
* the Modal's own `styleConfig` — `root` lands on the outer modal
|
|
30
|
+
* positioner, `modalWrapperStyles` on the inner content container.
|
|
31
|
+
* `modalContentStyles` is accepted for aldenui parity but intentionally
|
|
32
|
+
* mirrors `modalWrapperStyles` (both point at the same Modal slot).
|
|
33
|
+
*/
|
|
34
|
+
export interface IStyleConfigProps {
|
|
35
|
+
/**
|
|
36
|
+
* Styles applied to the modal's root slot (outer positioner).
|
|
37
|
+
*/
|
|
38
|
+
root?: Styles[];
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Styles applied to the modal's inner content slot. Alias for
|
|
42
|
+
* `modalWrapperStyles` — retained for aldenui parity.
|
|
43
|
+
*/
|
|
44
|
+
modalContentStyles?: Styles[];
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Styles applied to the modal's inner content slot (padding /
|
|
48
|
+
* width / background overrides).
|
|
49
|
+
*/
|
|
50
|
+
modalWrapperStyles?: Styles[];
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Props for the `Dialog` component. Extends `IModalProps` directly so
|
|
55
|
+
* every Modal-level control (variant, placement, blur, size,
|
|
56
|
+
* actionButtonType, etc.) is available unchanged at the Dialog call
|
|
57
|
+
* site.
|
|
58
|
+
*/
|
|
59
|
+
export interface IDialogProps extends IModalProps {
|
|
60
|
+
/**
|
|
61
|
+
* `styleConfig` slots for fine-grained style overrides forwarded to
|
|
62
|
+
* the underlying Modal.
|
|
63
|
+
*/
|
|
64
|
+
styleConfig?: IStyleConfigProps;
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Legacy close-icon configuration. See `OverlayCloseIconProps` for
|
|
68
|
+
* how each flag maps onto Modal's `actionButton*` surface.
|
|
69
|
+
*/
|
|
70
|
+
overlayCloseIcon?: OverlayCloseIconProps;
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Whether clicking the backdrop should invoke `onClose`. Defaults
|
|
74
|
+
* to the Modal default when omitted.
|
|
75
|
+
*/
|
|
76
|
+
allowBackdropClose?: boolean;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Props for `DialogContent`, the top slot inside a Dialog body that
|
|
81
|
+
* renders the header icon, title, and supporting description.
|
|
82
|
+
*/
|
|
83
|
+
export interface IDialogContentProps {
|
|
84
|
+
/**
|
|
85
|
+
* Optional icon displayed above the title. Accepts any ReactNode so
|
|
86
|
+
* callers can supply an SVG, Image, or a themed wrapper component.
|
|
87
|
+
*/
|
|
88
|
+
headIcon?: ReactNode;
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Title rendered below `headIcon`. Required.
|
|
92
|
+
*/
|
|
93
|
+
title: ReactNode;
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Optional supporting copy rendered beneath the title.
|
|
97
|
+
*/
|
|
98
|
+
description?: ReactNode;
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* `styleConfig` slot for the outer DialogContent wrapper.
|
|
102
|
+
*/
|
|
103
|
+
styleConfig?: {
|
|
104
|
+
root?: Styles[];
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Row vs. column flex layout for the DialogAction button group.
|
|
110
|
+
* `row` is typically used for 2-action confirmations ("Cancel" /
|
|
111
|
+
* "Confirm"); `column` stacks actions for the common 3+ vertical
|
|
112
|
+
* list layout.
|
|
113
|
+
*/
|
|
114
|
+
import { DialogAlignmentTypes, DialogTypes } from './constants';
|
|
115
|
+
|
|
116
|
+
export type DialogAlignmentType = `${DialogAlignmentTypes}`;
|
|
117
|
+
|
|
118
|
+
export type DialogType = `${DialogTypes}`;
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* A single entry in `DialogAction`'s `actionButtons` list.
|
|
122
|
+
*/
|
|
123
|
+
export interface IDialogAction {
|
|
124
|
+
/**
|
|
125
|
+
* Label rendered inside the action. Accepts any ReactNode so
|
|
126
|
+
* callers can supply i18n-wrapped strings, icons, or composed
|
|
127
|
+
* content.
|
|
128
|
+
*/
|
|
129
|
+
label: ReactNode;
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Invoked when the action is pressed. Receives the raw DOM event
|
|
133
|
+
* on web; the native implementation invokes it with no arguments.
|
|
134
|
+
*/
|
|
135
|
+
onClick: (e?: Event) => void;
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Typography `color` variant applied to the label. Defaults to the
|
|
139
|
+
* Typography default when omitted.
|
|
140
|
+
*/
|
|
141
|
+
type?: DialogType;
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* `styleConfig` slot for the per-button wrapper.
|
|
145
|
+
*/
|
|
146
|
+
styleConfig?: { root?: Styles[] };
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* Props for `DialogAction`, the bottom slot inside a Dialog that
|
|
151
|
+
* renders the stacked or inline action buttons.
|
|
152
|
+
*/
|
|
153
|
+
export interface IDialogActionProps {
|
|
154
|
+
/**
|
|
155
|
+
* Flex direction for the action row. Defaults to `'column'` to
|
|
156
|
+
* match the aldenui vertical stack.
|
|
157
|
+
*/
|
|
158
|
+
alignment?: DialogAlignmentType;
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* Ordered list of actions to render. Empty array is a no-op.
|
|
162
|
+
*/
|
|
163
|
+
actionButtons: IDialogAction[];
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* `styleConfig` slot for the outer DialogAction wrapper.
|
|
167
|
+
*/
|
|
168
|
+
styleConfig?: {
|
|
169
|
+
root?: Styles[];
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
// ---------------------------------------------------------------------
|
|
174
|
+
// Legacy aliases retained so existing type imports keep compiling while
|
|
175
|
+
// downstream consumers migrate to the `I*Props` naming.
|
|
176
|
+
// ---------------------------------------------------------------------
|
|
177
|
+
|
|
178
|
+
/** @deprecated use `IDialogProps` */
|
|
179
|
+
export type DialogProps = IDialogProps;
|
|
180
|
+
/** @deprecated use `IDialogContentProps` */
|
|
181
|
+
export type DialogContentProps = IDialogContentProps;
|
|
182
|
+
/** @deprecated use `IDialogActionProps` */
|
|
183
|
+
export type DialogActionProps = IDialogActionProps;
|
|
184
|
+
/** @deprecated use `IDialogAction` */
|
|
185
|
+
export type DialogAction = IDialogAction;
|
package/dist/style.d.ts
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { Theme } from '@cleartrip/ct-design-theme';
|
|
2
|
-
export declare const getDialogActionStyles: (theme: Theme) => {
|
|
3
|
-
border: string;
|
|
4
|
-
borderTop?: undefined;
|
|
5
|
-
borderBottom?: undefined;
|
|
6
|
-
borderLeft?: undefined;
|
|
7
|
-
borderRight?: undefined;
|
|
8
|
-
padding: string;
|
|
9
|
-
height: string;
|
|
10
|
-
} | {
|
|
11
|
-
borderTop: string;
|
|
12
|
-
border?: undefined;
|
|
13
|
-
borderBottom?: undefined;
|
|
14
|
-
borderLeft?: undefined;
|
|
15
|
-
borderRight?: undefined;
|
|
16
|
-
padding: string;
|
|
17
|
-
height: string;
|
|
18
|
-
} | {
|
|
19
|
-
borderBottom: string;
|
|
20
|
-
border?: undefined;
|
|
21
|
-
borderTop?: undefined;
|
|
22
|
-
borderLeft?: undefined;
|
|
23
|
-
borderRight?: undefined;
|
|
24
|
-
padding: string;
|
|
25
|
-
height: string;
|
|
26
|
-
} | {
|
|
27
|
-
borderLeft: string;
|
|
28
|
-
border?: undefined;
|
|
29
|
-
borderTop?: undefined;
|
|
30
|
-
borderBottom?: undefined;
|
|
31
|
-
borderRight?: undefined;
|
|
32
|
-
padding: string;
|
|
33
|
-
height: string;
|
|
34
|
-
} | {
|
|
35
|
-
borderRight: string;
|
|
36
|
-
border?: undefined;
|
|
37
|
-
borderTop?: undefined;
|
|
38
|
-
borderBottom?: undefined;
|
|
39
|
-
borderLeft?: undefined;
|
|
40
|
-
padding: string;
|
|
41
|
-
height: string;
|
|
42
|
-
};
|
|
43
|
-
//# sourceMappingURL=style.d.ts.map
|
package/dist/style.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"style.d.ts","sourceRoot":"","sources":["../packages/components/Dialog/src/style.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AAEnD,eAAO,MAAM,qBAAqB,UAAW,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAOjD,CAAC"}
|