react-dialogger 1.1.56 → 1.1.59
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/components/Actions.js +14 -3
- package/components/DialogActionBase.d.ts +3 -4
- package/components/DialogActionBase.js +54 -37
- package/components/DialogBase.d.ts +3 -3
- package/components/DialogContent.js +12 -5
- package/components/RippleButton.js +15 -2
- package/helpers/hexToRgb.d.ts +4 -1
- package/helpers/hexToRgb.js +12 -0
- package/package.json +1 -1
- package/styles/dialog.action.css +3 -2
- package/types/DialogActionTypes.d.ts +5 -6
- package/types/DialogTypes.d.ts +1 -1
package/components/Actions.js
CHANGED
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
2
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
14
|
exports.Actions = void 0;
|
|
4
15
|
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
@@ -7,13 +18,13 @@ var Actions = function (_a) {
|
|
|
7
18
|
var actions = _a.actions, dialog = _a.dialog;
|
|
8
19
|
var dialogOptions = dialog.dialogOptions;
|
|
9
20
|
return (0, jsx_runtime_1.jsx)("div", { style: { position: 'relative', display: 'flex', flexDirection: 'row', columnGap: 10, alignItems: 'center' }, children: actions.map(function (action, index) {
|
|
10
|
-
console.log('Actions_action', action, action.getIntent());
|
|
21
|
+
console.log('Actions_action', __assign(__assign({}, action.options), action.getIntent()));
|
|
11
22
|
var referencedAction = dialog.initializeActionRef(action.name);
|
|
12
|
-
return (0, jsx_runtime_1.jsx)(_components_1.DialogActionBase, { name: action.name, ref: referencedAction, dialogBaseComponent: dialog,
|
|
23
|
+
return (0, jsx_runtime_1.jsx)(_components_1.DialogActionBase, { name: action.name, ref: referencedAction, dialogBaseComponent: dialog,
|
|
13
24
|
//onClick={ action.onClickHandler() }
|
|
14
25
|
onClick: action._onCLick,
|
|
15
26
|
// inProcess={action.isInProcess()}
|
|
16
|
-
style: action.options.style, baseStyle: dialogOptions.base.actions.baseStyle, fontFamily: dialogOptions.base.style.fontFamily, stateListener: action._stateListener, intent: action.getIntent() }, index.toString());
|
|
27
|
+
style: action.options.style, baseStyle: dialogOptions.base.actions.baseStyle, fontFamily: dialogOptions.base.style.fontFamily, stateListener: action._stateListener, options: action.options, intent: action.getIntent() }, index.toString());
|
|
17
28
|
}) });
|
|
18
29
|
};
|
|
19
30
|
exports.Actions = Actions;
|
|
@@ -21,9 +21,9 @@ declare class DialogActionBase extends Component<ActionProps, ActionState> {
|
|
|
21
21
|
getInitialClickHandler: () => DialogActionType;
|
|
22
22
|
updateOptions(options: DialogActionOptionsType): this;
|
|
23
23
|
/**
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
|
|
24
|
+
* @deprecated Use `updateOptions` instead.
|
|
25
|
+
* For more info, see: updateOptions
|
|
26
|
+
*/
|
|
27
27
|
setOptions(options: DialogActionOptionsType): this;
|
|
28
28
|
get options(): DialogActionOptionsType;
|
|
29
29
|
updateLabel: (label: string) => DialogActionBase;
|
|
@@ -56,7 +56,6 @@ declare class DialogActionBase extends Component<ActionProps, ActionState> {
|
|
|
56
56
|
isInProcess: () => boolean;
|
|
57
57
|
remove: () => void;
|
|
58
58
|
click: () => void;
|
|
59
|
-
onClickHandler: () => DialogActionType;
|
|
60
59
|
render: () => import("react/jsx-runtime").JSX.Element;
|
|
61
60
|
}
|
|
62
61
|
export default DialogActionBase;
|
|
@@ -67,6 +67,7 @@ var DialogActionBase = /** @class */ (function (_super) {
|
|
|
67
67
|
__extends(DialogActionBase, _super);
|
|
68
68
|
function DialogActionBase(props) {
|
|
69
69
|
if (props === void 0) { props = {}; }
|
|
70
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
70
71
|
var _this = _super.call(this, props) || this; // This ensures that props is treated as readonly
|
|
71
72
|
_this._options = {
|
|
72
73
|
label: 'Button label',
|
|
@@ -80,65 +81,74 @@ var DialogActionBase = /** @class */ (function (_super) {
|
|
|
80
81
|
return _this._initialClickHandler;
|
|
81
82
|
};
|
|
82
83
|
_this.updateLabel = function (label) {
|
|
83
|
-
|
|
84
|
-
|
|
84
|
+
// this._options.label = label;
|
|
85
|
+
// this.forceUpdate();
|
|
86
|
+
_this.setState(function (prevStae) { return (__assign(__assign({}, prevStae), { options: __assign(__assign({}, prevStae.options), { label: label }) })); });
|
|
85
87
|
return _this;
|
|
86
88
|
};
|
|
87
89
|
/**
|
|
88
90
|
* @deprecated use Options*/
|
|
89
91
|
_this.updateVariant = function (variant) {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
+
// this._options.variant = variant;
|
|
93
|
+
// this.forceUpdate();
|
|
94
|
+
_this.setState(function (prevStae) { return (__assign(__assign({}, prevStae), { options: __assign(__assign({}, prevStae.options), { variant: variant }) })); });
|
|
92
95
|
return _this;
|
|
93
96
|
};
|
|
94
97
|
/**
|
|
95
98
|
* @deprecated use Options*/
|
|
96
99
|
_this.getVariant = function () {
|
|
97
|
-
return
|
|
100
|
+
// return this._options.variant;
|
|
101
|
+
return _this.state.options.variant;
|
|
98
102
|
};
|
|
99
103
|
/**
|
|
100
104
|
* @deprecated use Options*/
|
|
101
105
|
_this.updateColor = function (color) {
|
|
102
106
|
// this._color = color;
|
|
103
|
-
|
|
104
|
-
|
|
107
|
+
// this._options.color = color;
|
|
108
|
+
// this.forceUpdate();
|
|
109
|
+
_this.setState(function (prevState) { return (__assign(__assign({}, prevState), { options: __assign(__assign({}, prevState.options), { color: color }) })); });
|
|
105
110
|
return _this;
|
|
106
111
|
};
|
|
107
112
|
/**
|
|
108
113
|
* @deprecated use Options*/
|
|
109
114
|
_this.getColor = function () {
|
|
110
|
-
return
|
|
115
|
+
// return this._options.color;
|
|
116
|
+
return _this.state.options.color;
|
|
111
117
|
};
|
|
112
118
|
/**
|
|
113
119
|
* @deprecated use Options*/
|
|
114
120
|
_this.setDisabled = function (disabled) {
|
|
115
|
-
|
|
116
|
-
|
|
121
|
+
// this._options.disabled = disabled;
|
|
122
|
+
// this.forceUpdate();
|
|
123
|
+
_this.setState(function (prevStae) { return (__assign(__assign({}, prevStae), { options: __assign(__assign({}, prevStae.options), { disabled: disabled }) })); });
|
|
117
124
|
return _this;
|
|
118
125
|
};
|
|
119
126
|
/**
|
|
120
127
|
* @deprecated
|
|
121
128
|
* @see use isDisabled */
|
|
122
129
|
_this.getDisabled = function () {
|
|
123
|
-
return
|
|
130
|
+
// return this._options.disabled;
|
|
131
|
+
return _this.state.options.disabled;
|
|
124
132
|
};
|
|
125
133
|
/**
|
|
126
134
|
* @deprecated use Options*/
|
|
127
135
|
_this.isDisabled = function () {
|
|
128
|
-
return _this.
|
|
136
|
+
return _this.state.options.disabled;
|
|
129
137
|
};
|
|
130
138
|
_this.updateIntent = function (intent) {
|
|
131
139
|
_this.setState(function (prevState) { return (__assign(__assign({}, _this.state), { intent: intent })); });
|
|
132
140
|
return _this;
|
|
133
141
|
};
|
|
134
142
|
_this.setInProcess = function (inProcess) {
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
143
|
+
// this._inProcess = inProcess;
|
|
144
|
+
// this._options.disabled = inProcess;
|
|
145
|
+
// this.forceUpdate();
|
|
146
|
+
_this.setState(function (prevState) { return (__assign(__assign({}, prevState), { options: __assign(__assign({}, prevState.options), { disabled: inProcess }), inProcess: inProcess })); });
|
|
138
147
|
return _this;
|
|
139
148
|
};
|
|
140
149
|
_this.isInProcess = function () {
|
|
141
|
-
return
|
|
150
|
+
// return this._inProcess;
|
|
151
|
+
return _this.state.inProcess;
|
|
142
152
|
};
|
|
143
153
|
_this.remove = function () {
|
|
144
154
|
_this._buttonRef.current.remove();
|
|
@@ -148,25 +158,25 @@ var DialogActionBase = /** @class */ (function (_super) {
|
|
|
148
158
|
_this._rippleButtonRef.current.rippleEffect(_this._buttonRef, 19, 8);
|
|
149
159
|
_this._buttonRef.current.click();
|
|
150
160
|
};
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
}
|
|
161
|
+
// public onClickHandler = () => {
|
|
162
|
+
// return this._onClick;
|
|
163
|
+
// }
|
|
154
164
|
_this.render = function () {
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
//
|
|
158
|
-
|
|
159
|
-
_this._options.label = (_g = ((_f = (_e = (_d = (_c = _this.props.dialogBaseComponent) === null || _c === void 0 ? void 0 : _c.dialogOptions) === null || _d === void 0 ? void 0 : _d.localText) === null || _e === void 0 ? void 0 : _e[converted]) !== null && _f !== void 0 ? _f : converted)) !== null && _g !== void 0 ? _g : 'Button';
|
|
165
|
+
console.log('Dialog_Action_Base_render', _this.state.options, _this._intent);
|
|
166
|
+
// // Set as default converted from action name prop
|
|
167
|
+
// const converted = this.props.name?.replace(/action/i, '') ?? this.props.name;
|
|
168
|
+
// this._options.label = (this.props.dialogBaseComponent?.dialogOptions?.localText?.[converted] ?? converted) ?? 'Button';
|
|
160
169
|
return (0, jsx_runtime_1.jsx)(_components_1.RippleButton, { ref: _this._buttonRef, innerRef: _this._rippleButtonRef,
|
|
161
170
|
// Intent Based
|
|
162
|
-
variant:
|
|
171
|
+
variant: _this.state.options.variant,
|
|
163
172
|
// Intent Based
|
|
164
|
-
color:
|
|
165
|
-
if
|
|
173
|
+
color: _this.state.options.color, disabled: _this.state.options.disabled, onClick: function (e) {
|
|
174
|
+
// if(this.state.options.disabled || this.isInProcess() ) return;
|
|
175
|
+
if (_this.state.options.disabled || _this.state.inProcess)
|
|
166
176
|
return;
|
|
167
177
|
// @ts-ignore
|
|
168
178
|
_this._onClick(_this, _this._dialogBaseComponent);
|
|
169
|
-
}, style: _this.
|
|
179
|
+
}, style: _this.state.options.style, baseStyle: _this.props.baseStyle, fontFamily: _this.props.fontFamily, children: function (buttonRef) {
|
|
170
180
|
if (buttonRef) {
|
|
171
181
|
if (!_this.isInProcess()) {
|
|
172
182
|
buttonRef.style.minWidth = buttonRef.getBoundingClientRect().width + 'px';
|
|
@@ -181,7 +191,7 @@ var DialogActionBase = /** @class */ (function (_super) {
|
|
|
181
191
|
* Daha temiz, daha kısa
|
|
182
192
|
*/
|
|
183
193
|
return (0, jsx_runtime_1.jsxs)(React.Fragment, { children: [(0, jsx_runtime_1.jsx)(_components_1.CircularProgress, { size: 15, inProcess: { inProcess: _this.isInProcess() } }), !_this.isInProcess() &&
|
|
184
|
-
_this.options.label] });
|
|
194
|
+
_this.state.options.label] });
|
|
185
195
|
} });
|
|
186
196
|
};
|
|
187
197
|
_this._options = props.options;
|
|
@@ -191,10 +201,14 @@ var DialogActionBase = /** @class */ (function (_super) {
|
|
|
191
201
|
_this._initialClickHandler = props.onClick;
|
|
192
202
|
_this._dialogBaseComponent = props.dialogBaseComponent;
|
|
193
203
|
_this._inProcess = props.inProcess;
|
|
204
|
+
var converted = (_b = (_a = props.name) === null || _a === void 0 ? void 0 : _a.replace(/action/i, '')) !== null && _b !== void 0 ? _b : props.name;
|
|
205
|
+
var label = (_g = ((_f = (_e = (_d = (_c = _this.props.dialogBaseComponent) === null || _c === void 0 ? void 0 : _c.dialogOptions) === null || _d === void 0 ? void 0 : _d.localText) === null || _e === void 0 ? void 0 : _e[converted]) !== null && _f !== void 0 ? _f : converted)) !== null && _g !== void 0 ? _g : 'Button';
|
|
194
206
|
_this.state = {
|
|
195
207
|
coords: { x: -1, y: -1 },
|
|
196
208
|
isRippling: false,
|
|
197
|
-
intent: props.intent
|
|
209
|
+
// intent: props.intent,
|
|
210
|
+
options: __assign(__assign(__assign({}, props.options), props.intent), { label: label }),
|
|
211
|
+
inProcess: false
|
|
198
212
|
};
|
|
199
213
|
_this._buttonRef = React.createRef();
|
|
200
214
|
_this._rippleButtonRef = React.createRef();
|
|
@@ -231,27 +245,30 @@ var DialogActionBase = /** @class */ (function (_super) {
|
|
|
231
245
|
configurable: true
|
|
232
246
|
});
|
|
233
247
|
DialogActionBase.prototype.updateOptions = function (options) {
|
|
234
|
-
this.
|
|
235
|
-
this.
|
|
248
|
+
this.setState(function (prevState) { return (__assign(__assign({}, prevState), { options: options })); });
|
|
249
|
+
// this._options = {...this._options, ...options};
|
|
250
|
+
// this.forceUpdate();
|
|
236
251
|
return this;
|
|
237
252
|
};
|
|
238
253
|
/**
|
|
239
|
-
*
|
|
240
|
-
*
|
|
241
|
-
|
|
254
|
+
* @deprecated Use `updateOptions` instead.
|
|
255
|
+
* For more info, see: updateOptions
|
|
256
|
+
*/
|
|
242
257
|
DialogActionBase.prototype.setOptions = function (options) {
|
|
243
258
|
this.updateOptions(options);
|
|
244
259
|
return this;
|
|
245
260
|
};
|
|
246
261
|
Object.defineProperty(DialogActionBase.prototype, "options", {
|
|
247
262
|
get: function () {
|
|
248
|
-
return this._options;
|
|
263
|
+
// return this._options;
|
|
264
|
+
return this.state.options;
|
|
249
265
|
},
|
|
250
266
|
enumerable: false,
|
|
251
267
|
configurable: true
|
|
252
268
|
});
|
|
253
269
|
DialogActionBase.prototype.getLabel = function () {
|
|
254
|
-
return this._options.label;
|
|
270
|
+
// return this._options.label;
|
|
271
|
+
return this.state.options.label;
|
|
255
272
|
};
|
|
256
273
|
DialogActionBase.prototype.onClick = function (callback) {
|
|
257
274
|
// @ts-ignore
|
|
@@ -20,7 +20,7 @@ declare class DialogBase<Values extends FormikProps<Values>> extends Component<B
|
|
|
20
20
|
protected _actions: DialogAction[];
|
|
21
21
|
protected _dialogSize: IDialogSize;
|
|
22
22
|
protected _holder?: TInitialHolder;
|
|
23
|
-
protected _formikProps:
|
|
23
|
+
protected _formikProps: FormikProps<any>;
|
|
24
24
|
protected readonly _backdropRef: RefObject<any>;
|
|
25
25
|
protected readonly _dialogRef: RefObject<any>;
|
|
26
26
|
protected readonly _dialogBodyRef: RefObject<any>;
|
|
@@ -52,8 +52,8 @@ declare class DialogBase<Values extends FormikProps<Values>> extends Component<B
|
|
|
52
52
|
initializeActionRef: (key: string) => RefObject<DialogActionBase>;
|
|
53
53
|
get dialogOptions(): DialogOptionsType;
|
|
54
54
|
get holder(): DialogOptionsType;
|
|
55
|
-
get formikProps():
|
|
56
|
-
set formikProps(value:
|
|
55
|
+
get formikProps(): FormikProps<any>;
|
|
56
|
+
set formikProps(value: FormikProps<any>);
|
|
57
57
|
get formikValidate(): Promise<DialogFormikAdapter<any>>;
|
|
58
58
|
set inlineFormikProps(inlineFormikProps: IFormikAdapter);
|
|
59
59
|
get values(): IFormikAdapter['values'];
|
|
@@ -73,6 +73,7 @@ var jumper_animate_1 = require("../utils/effects/jumper-animate");
|
|
|
73
73
|
var _context_1 = require("../context/index.js");
|
|
74
74
|
var DialogContent = function (props) {
|
|
75
75
|
var _a, _b, _c, _d, _e;
|
|
76
|
+
var firstUpdate = React.useRef(true);
|
|
76
77
|
var _f = (0, react_1.useContext)(_context_1.DialogContentContext), dialog = _f.dialog, dialogRef = _f.dialogRef, prevDialogRect = _f.prevDialogRect, backdropRef = _f.backdropRef, snackbarRef = _f.snackbarRef, footerRef = _f.footerRef, resizeableObject = _f.resizeableObject, body = _f.body;
|
|
77
78
|
var dialogOptions = dialog.dialogOptions;
|
|
78
79
|
var baseOptions = dialogOptions.base;
|
|
@@ -92,19 +93,25 @@ var DialogContent = function (props) {
|
|
|
92
93
|
};
|
|
93
94
|
// Effect Listener
|
|
94
95
|
(0, react_1.useEffect)(function () {
|
|
95
|
-
|
|
96
|
+
if (firstUpdate.current) {
|
|
97
|
+
firstUpdate.current = false;
|
|
98
|
+
return; // ilk render'ı atla
|
|
99
|
+
}
|
|
96
100
|
// State Listener Dialog
|
|
97
101
|
if (typeof dialog.props.stateListener === "function") {
|
|
98
102
|
dialog.props.stateListener(dialog.values, dialog);
|
|
99
103
|
}
|
|
104
|
+
// console.log('DialogContent_actions_refs', dialog._actionRefs);
|
|
100
105
|
// State Listener Actions
|
|
101
106
|
for (var actionKey in dialog._actionRefs) {
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
107
|
+
// const action = dialog._actionRefs[actionKey];
|
|
108
|
+
var actionRef = dialog.initializeActionRef(actionKey);
|
|
109
|
+
if (typeof actionRef.current._stateListener === "function") {
|
|
110
|
+
console.log('DialogContent_actions_ref', actionRef.current._stateListener);
|
|
111
|
+
actionRef.current._stateListener(dialog.values, actionRef === null || actionRef === void 0 ? void 0 : actionRef.current, dialog);
|
|
105
112
|
}
|
|
106
113
|
}
|
|
107
|
-
}, [dialog
|
|
114
|
+
}, [dialog.values, dialog._actionRefs]);
|
|
108
115
|
// Listener & Animate
|
|
109
116
|
(0, react_1.useEffect)(function () {
|
|
110
117
|
// setDialogRect();
|
|
@@ -47,6 +47,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
47
47
|
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
48
48
|
var React = __importStar(require("react"));
|
|
49
49
|
var react_1 = require("react");
|
|
50
|
+
var _helpers_1 = require("../helpers/index.js");
|
|
51
|
+
var hexToRgb_1 = require("../helpers/hexToRgb");
|
|
50
52
|
exports.default = React.forwardRef(function (_a, ref) {
|
|
51
53
|
var variant = _a.variant, color = _a.color, children = _a.children, disabled = _a.disabled, onClick = _a.onClick, style = _a.style, baseStyle = _a.baseStyle, innerRef = _a.innerRef, fontFamily = _a.fontFamily;
|
|
52
54
|
var _b = React.useState({ x: -1, y: -1 }), coords = _b[0], setCoords = _b[1];
|
|
@@ -76,7 +78,18 @@ exports.default = React.forwardRef(function (_a, ref) {
|
|
|
76
78
|
(0, react_1.useImperativeHandle)(innerRef, function () { return ({
|
|
77
79
|
rippleEffect: rippleEffect
|
|
78
80
|
}); });
|
|
79
|
-
|
|
81
|
+
var namedColors = ["primary", "success", "error", "warning", "info", "secondary", "default"];
|
|
82
|
+
var isNamedColor = namedColors.includes(color);
|
|
83
|
+
var localColor = null;
|
|
84
|
+
if (!isNamedColor) {
|
|
85
|
+
// Like Yellow
|
|
86
|
+
localColor = color;
|
|
87
|
+
if (!(0, hexToRgb_1.isHexColor)(localColor)) {
|
|
88
|
+
localColor = (0, hexToRgb_1.colorNameToHex)(localColor);
|
|
89
|
+
}
|
|
90
|
+
localColor = (0, _helpers_1.hexToRgb)(localColor, disabled ? .5 : 1);
|
|
91
|
+
}
|
|
92
|
+
console.log('Ripple_button_style', localColor);
|
|
80
93
|
return ((0, jsx_runtime_1.jsxs)("button", { ref: ref, disabled: disabled, className: "ripple-button ripple-button-".concat(variant, " ripple-button-").concat(color, " ").concat(disabled ? 'ripple-button-disabled' : ''), onClick: function (e) {
|
|
81
94
|
//@ts-ignore
|
|
82
95
|
var rect = e.target.getBoundingClientRect();
|
|
@@ -84,5 +97,5 @@ exports.default = React.forwardRef(function (_a, ref) {
|
|
|
84
97
|
setTimeout(function () {
|
|
85
98
|
onClick && onClick(e);
|
|
86
99
|
}, 200);
|
|
87
|
-
}, style: __assign(__assign(__assign({}, baseStyle), style), { fontFamily: fontFamily }), children: [isRippling && (0, jsx_runtime_1.jsx)("span", { className: "ripple", style: { left: coords.x, top: coords.y } }), (0, jsx_runtime_1.jsx)("span", { className: "content", children: children(ref.current) })] }));
|
|
100
|
+
}, style: __assign(__assign(__assign(__assign(__assign({}, baseStyle), style), { fontFamily: fontFamily }), localColor ? { backgroundColor: localColor } : null), variant === 'text' ? { border: "none" } : null), children: [isRippling && (0, jsx_runtime_1.jsx)("span", { className: "ripple", style: { left: coords.x, top: coords.y } }), (0, jsx_runtime_1.jsx)("span", { className: "content", children: children(ref.current) })] }));
|
|
88
101
|
});
|
package/helpers/hexToRgb.d.ts
CHANGED
|
@@ -1,2 +1,5 @@
|
|
|
1
1
|
declare const hexToRgb: (hex: string, opacity: number) => string;
|
|
2
|
-
export
|
|
2
|
+
export type HexColor = `#${string}`;
|
|
3
|
+
declare function isHexColor(color: string): color is HexColor;
|
|
4
|
+
declare function colorNameToHex(colorName: string): string | null;
|
|
5
|
+
export { hexToRgb, colorNameToHex, isHexColor };
|
package/helpers/hexToRgb.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.hexToRgb = void 0;
|
|
4
|
+
exports.colorNameToHex = colorNameToHex;
|
|
5
|
+
exports.isHexColor = isHexColor;
|
|
4
6
|
var hexToRgb = function (hex, opacity) {
|
|
5
7
|
try {
|
|
6
8
|
var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
|
|
@@ -17,3 +19,13 @@ var hexToRgb = function (hex, opacity) {
|
|
|
17
19
|
return '';
|
|
18
20
|
};
|
|
19
21
|
exports.hexToRgb = hexToRgb;
|
|
22
|
+
function isHexColor(color) {
|
|
23
|
+
return /^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/.test(color);
|
|
24
|
+
}
|
|
25
|
+
function colorNameToHex(colorName) {
|
|
26
|
+
var ctx = document.createElement("canvas").getContext("2d");
|
|
27
|
+
if (!ctx)
|
|
28
|
+
return null;
|
|
29
|
+
ctx.fillStyle = colorName;
|
|
30
|
+
return ctx.fillStyle; // canvas, renk ismini hex'e çevirir
|
|
31
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-dialogger",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.59",
|
|
4
4
|
"description": "This package is a continuation of the react-araci package. Due to an error, react-araci was removed, and it has been decided to continue under the new package name react-dialogger",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"author": "Sueleyman Topaloglu",
|
package/styles/dialog.action.css
CHANGED
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
width: auto;
|
|
11
11
|
transition: width 1s;
|
|
12
12
|
display: inline-block;
|
|
13
|
+
border: none;
|
|
13
14
|
}
|
|
14
15
|
.ripple-button .ripple {
|
|
15
16
|
width: 20px;
|
|
@@ -50,14 +51,14 @@
|
|
|
50
51
|
}
|
|
51
52
|
|
|
52
53
|
.ripple-button-outlined {
|
|
53
|
-
border-width: 1px;
|
|
54
|
+
border-width: 1px !important;
|
|
54
55
|
border-style: solid;
|
|
55
56
|
box-shadow: 0 0 2px #a8a8a8;
|
|
56
57
|
background: none !important;
|
|
57
58
|
}
|
|
58
59
|
|
|
59
60
|
.ripple-button-text {
|
|
60
|
-
border: none;
|
|
61
|
+
border: none !important;
|
|
61
62
|
background: none !important;
|
|
62
63
|
}
|
|
63
64
|
|
|
@@ -5,9 +5,7 @@ import { DialogAction, ACTION_INTENTS } from "../models/index.js";
|
|
|
5
5
|
import { CSSProperties } from "react";
|
|
6
6
|
export type ActionDialogDef = Omit<IDialogApiDef, 'switchFullScreen'>;
|
|
7
7
|
export type ActionDef = Pick<DialogAction, 'onClick' | 'setOptions' | 'name'>;
|
|
8
|
-
export type ActionBaseDef = Pick<DialogActionBase
|
|
9
|
-
/**@deprecated use updateOptions*/
|
|
10
|
-
'setOptions' | 'setInProcess' | 'getLabel' | 'options' | 'click' | 'remove' | 'name'>;
|
|
8
|
+
export type ActionBaseDef = Pick<InstanceType<typeof DialogActionBase>, 'updateOptions' | 'updateColor' | 'updateVariant' | 'updateLabel' | 'updateIntent' | 'setOptions' | 'setInProcess' | 'getLabel' | 'options' | 'click' | 'remove' | 'name'>;
|
|
11
9
|
export interface IDialogActionDef extends ActionBaseDef {
|
|
12
10
|
}
|
|
13
11
|
export type DialogActionType = (button: ActionBaseDef, dialog: Omit<IDialogApiDef, 'switchFullScreen'>) => void;
|
|
@@ -50,10 +48,11 @@ export interface ActionProps {
|
|
|
50
48
|
export interface ActionState {
|
|
51
49
|
isRippling: boolean;
|
|
52
50
|
coords: ICoords;
|
|
53
|
-
|
|
51
|
+
options?: DialogActionOptionsType;
|
|
52
|
+
inProcess?: ActionProps['inProcess'];
|
|
54
53
|
}
|
|
55
54
|
export type TBVariant = "contained" | "outlined" | "text";
|
|
56
|
-
export type TBColor = "primary" | "success" | "error" | "warning" | "info" | "secondary" | "default";
|
|
55
|
+
export type TBColor = "primary" | "success" | "error" | "warning" | "info" | "secondary" | "default" | CSSProperties['color'];
|
|
57
56
|
export type DialogActionOptionsType = {
|
|
58
57
|
label?: string;
|
|
59
58
|
variant?: TBVariant;
|
|
@@ -63,7 +62,7 @@ export type DialogActionOptionsType = {
|
|
|
63
62
|
style?: React.CSSProperties;
|
|
64
63
|
baseStyle?: React.CSSProperties;
|
|
65
64
|
};
|
|
66
|
-
type TListenerButtonType = Pick<DialogActionBase, Exclude<keyof
|
|
65
|
+
type TListenerButtonType = Pick<DialogActionBase, Exclude<keyof ActionBaseDef, 'onClick' | 'getStateListener' | 'name'>>;
|
|
67
66
|
export type TDialogStateListenerForActionCallbackType = (values: TValues, button: TListenerButtonType, dialog: IListenerDialogDef) => void;
|
|
68
67
|
export interface IContentFooterProps {
|
|
69
68
|
}
|
package/types/DialogTypes.d.ts
CHANGED
|
@@ -18,7 +18,7 @@ export interface BaseDialogState {
|
|
|
18
18
|
prevDialogRect: WithBackdrop['prevDialogRect'];
|
|
19
19
|
body: TDialogCallbackFn;
|
|
20
20
|
}
|
|
21
|
-
export interface DialogFormikAdapter<Values> {
|
|
21
|
+
export interface DialogFormikAdapter<Values> extends Omit<FormikProps<any>, 'values' | 'setValues' | 'setFieldValue' | 'validateForm' | 'errors'> {
|
|
22
22
|
values: Values;
|
|
23
23
|
setValues(values: Values): void;
|
|
24
24
|
setFieldValue(field: keyof Values | string, value: any): void;
|