funuicss 3.6.14 → 3.6.16
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/css/fun.css +6740 -6605
- package/package.json +1 -1
- package/ui/button/Button.d.ts +8 -2
- package/ui/button/Button.js +123 -86
- package/ui/card/Card.d.ts +51 -1
- package/ui/card/Card.js +188 -18
- package/ui/input/Input.d.ts +5 -5
- package/ui/input/Input.js +127 -39
- package/ui/richtext/RichText.d.ts +0 -1
- package/ui/richtext/RichText.js +20 -15
- package/ui/select/Select.d.ts +2 -0
- package/ui/select/Select.js +12 -2
- package/ui/text/Text.d.ts +2 -0
- package/ui/text/Text.js +6 -4
- package/ui/vista/Vista.d.ts +15 -0
- package/ui/vista/Vista.js +20 -5
- package/utils/getDynamicIcon.d.ts +2 -0
- package/utils/getDynamicIcon.js +112 -0
package/ui/input/Input.js
CHANGED
|
@@ -65,6 +65,13 @@ var pi_1 = require("react-icons/pi");
|
|
|
65
65
|
var Button_1 = __importDefault(require("../button/Button"));
|
|
66
66
|
var theme_1 = require("../theme/theme");
|
|
67
67
|
var componentUtils_1 = require("../../utils/componentUtils");
|
|
68
|
+
// Status icons mapping
|
|
69
|
+
var statusIcons = {
|
|
70
|
+
success: react_1.default.createElement(pi_1.PiCheckCircle, null),
|
|
71
|
+
warning: react_1.default.createElement(pi_1.PiWarning, null),
|
|
72
|
+
danger: react_1.default.createElement(pi_1.PiX, null),
|
|
73
|
+
info: react_1.default.createElement(pi_1.PiInfo, null)
|
|
74
|
+
};
|
|
68
75
|
// Utility function to generate CSS classes
|
|
69
76
|
var generateInputClasses = function (_a) {
|
|
70
77
|
var status = _a.status, rounded = _a.rounded, bg = _a.bg, funcss = _a.funcss, flat = _a.flat, leftRounded = _a.leftRounded, rightRounded = _a.rightRounded, bordered = _a.bordered, borderless = _a.borderless, _b = _a.additionalClasses, additionalClasses = _b === void 0 ? '' : _b;
|
|
@@ -76,26 +83,47 @@ var generateInputClasses = function (_a) {
|
|
|
76
83
|
var borderClass = bordered ? 'borderedInput' : borderless ? 'borderless' : (!bordered && !borderless ? 'borderedInput' : '');
|
|
77
84
|
return "\n ".concat(statusClass, "\n ").concat(roundedClass, "\n ").concat(bgClass, "\n ").concat(funcss || '', "\n ").concat(flatClass, "\n ").concat(cornerClass, "\n ").concat(borderClass, "\n ").concat(additionalClasses, "\n input\n ").trim().replace(/\s+/g, ' ');
|
|
78
85
|
};
|
|
79
|
-
// Iconic Input Wrapper Component
|
|
86
|
+
// Iconic Input Wrapper Component - Updated to support both prefix/suffix and startIcon/endIcon
|
|
80
87
|
var IconicInputWrapper = function (_a) {
|
|
81
|
-
var startIcon = _a.startIcon, endIcon = _a.endIcon, iconicBg = _a.iconicBg, funcss = _a.funcss, children = _a.children;
|
|
82
|
-
if
|
|
88
|
+
var startIcon = _a.startIcon, endIcon = _a.endIcon, prefix = _a.prefix, suffix = _a.suffix, iconicBg = _a.iconicBg, funcss = _a.funcss, children = _a.children;
|
|
89
|
+
// Use prefix/suffix if provided, otherwise fall back to startIcon/endIcon
|
|
90
|
+
var effectiveStartIcon = prefix !== undefined ? prefix : startIcon;
|
|
91
|
+
var effectiveEndIcon = suffix !== undefined ? suffix : endIcon;
|
|
92
|
+
if (!effectiveStartIcon && !effectiveEndIcon) {
|
|
83
93
|
return react_1.default.createElement(react_1.default.Fragment, null, children);
|
|
84
94
|
}
|
|
85
|
-
return (react_1.default.createElement("div", { className: "icon-container ".concat(funcss || '') },
|
|
86
|
-
|
|
95
|
+
return (react_1.default.createElement("div", { className: "icon-container ".concat(effectiveStartIcon ? 'has-left-icon' : '', " ").concat(funcss || '') },
|
|
96
|
+
effectiveStartIcon && (react_1.default.createElement("div", { className: "leftIcon", style: {
|
|
87
97
|
backgroundColor: iconicBg || '',
|
|
88
98
|
border: iconicBg ? "0.1rem ".concat(iconicBg, " solid") : '',
|
|
89
|
-
} },
|
|
90
|
-
|
|
91
|
-
|
|
99
|
+
} }, effectiveStartIcon)),
|
|
100
|
+
children,
|
|
101
|
+
effectiveEndIcon && (react_1.default.createElement("div", { className: "rightIcon", style: { backgroundColor: iconicBg || '' } }, effectiveEndIcon))));
|
|
102
|
+
};
|
|
103
|
+
// Input Container with Floating Label
|
|
104
|
+
var InputContainer = function (_a) {
|
|
105
|
+
var label = _a.label, status = _a.status, helperText = _a.helperText, children = _a.children, isFocused = _a.isFocused, hasValue = _a.hasValue, fullWidth = _a.fullWidth, id = _a.id, startIcon = _a.startIcon, prefix = _a.prefix;
|
|
106
|
+
var showFloatingLabel = label && (isFocused || hasValue);
|
|
107
|
+
return (react_1.default.createElement("div", { className: "input-wrapper ".concat(fullWidth ? 'full-width' : '') },
|
|
108
|
+
react_1.default.createElement("div", { className: "input-container-with-label" },
|
|
109
|
+
label && (react_1.default.createElement("label", { htmlFor: id, className: "floating-label ".concat(startIcon || prefix ? "label-left" : "", " ").concat(showFloatingLabel ? 'active' : '', " ").concat(status ? "label-".concat(status) : '') }, label)),
|
|
110
|
+
children),
|
|
111
|
+
(helperText || status) && (react_1.default.createElement("div", { className: "input-helper-text ".concat(status ? "helper-".concat(status) : '') },
|
|
112
|
+
status && statusIcons[status] && (react_1.default.createElement("span", { className: "helper-icon" }, statusIcons[status])),
|
|
113
|
+
react_1.default.createElement("span", null, helperText)))));
|
|
92
114
|
};
|
|
93
115
|
// Text Input Component
|
|
94
116
|
var TextInput = function (_a) {
|
|
95
|
-
var id = _a.id, name = _a.name, value = _a.value, defaultValue = _a.defaultValue, onChange = _a.onChange, status = _a.status, funcss = _a.funcss, bg = _a.bg, _b = _a.fullWidth, fullWidth = _b === void 0 ? true : _b, flat = _a.flat, bordered = _a.bordered, borderless = _a.borderless, rounded = _a.rounded, leftRounded = _a.leftRounded, rightRounded = _a.rightRounded, startIcon = _a.startIcon, endIcon = _a.endIcon, iconicBg = _a.iconicBg, _c = _a.type, type = _c === void 0 ? 'text' : _c, label = _a.label, _d = _a.variant, variant = _d === void 0 ? '' : _d, rest = __rest(_a, ["id", "name", "value", "defaultValue", "onChange", "status", "funcss", "bg", "fullWidth", "flat", "bordered", "borderless", "rounded", "leftRounded", "rightRounded", "startIcon", "endIcon", "iconicBg", "type", "label", "variant"]);
|
|
96
|
-
|
|
117
|
+
var id = _a.id, name = _a.name, value = _a.value, defaultValue = _a.defaultValue, onChange = _a.onChange, status = _a.status, funcss = _a.funcss, bg = _a.bg, _b = _a.fullWidth, fullWidth = _b === void 0 ? true : _b, flat = _a.flat, bordered = _a.bordered, borderless = _a.borderless, rounded = _a.rounded, leftRounded = _a.leftRounded, rightRounded = _a.rightRounded, startIcon = _a.startIcon, endIcon = _a.endIcon, prefix = _a.prefix, suffix = _a.suffix, iconicBg = _a.iconicBg, _c = _a.type, type = _c === void 0 ? 'text' : _c, label = _a.label, helperText = _a.helperText, _d = _a.variant, variant = _d === void 0 ? '' : _d, rest = __rest(_a, ["id", "name", "value", "defaultValue", "onChange", "status", "funcss", "bg", "fullWidth", "flat", "bordered", "borderless", "rounded", "leftRounded", "rightRounded", "startIcon", "endIcon", "prefix", "suffix", "iconicBg", "type", "label", "helperText", "variant"]);
|
|
118
|
+
var _e = (0, react_1.useState)(false), isFocused = _e[0], setIsFocused = _e[1];
|
|
119
|
+
var _f = (0, react_1.useState)(value || defaultValue || ''), inputValue = _f[0], setInputValue = _f[1];
|
|
120
|
+
var inputRef = (0, react_1.useRef)(null);
|
|
121
|
+
(0, react_1.useEffect)(function () {
|
|
122
|
+
if (value !== undefined) {
|
|
123
|
+
setInputValue(value);
|
|
124
|
+
}
|
|
125
|
+
}, [value]);
|
|
97
126
|
var mergeWithLocal = (0, componentUtils_1.useComponentConfiguration)('Input', variant).mergeWithLocal;
|
|
98
|
-
// Merge config with local props - local props override config
|
|
99
127
|
var mergedProps = mergeWithLocal({
|
|
100
128
|
status: status,
|
|
101
129
|
funcss: funcss,
|
|
@@ -109,9 +137,10 @@ var TextInput = function (_a) {
|
|
|
109
137
|
rightRounded: rightRounded,
|
|
110
138
|
startIcon: startIcon,
|
|
111
139
|
endIcon: endIcon,
|
|
140
|
+
prefix: prefix,
|
|
141
|
+
suffix: suffix,
|
|
112
142
|
iconicBg: iconicBg,
|
|
113
143
|
}).props;
|
|
114
|
-
// Use theme variant for fallback
|
|
115
144
|
var themeVariant = (0, theme_1.useVariant)().variant;
|
|
116
145
|
var className = generateInputClasses({
|
|
117
146
|
status: mergedProps.status,
|
|
@@ -125,16 +154,39 @@ var TextInput = function (_a) {
|
|
|
125
154
|
borderless: mergedProps.borderless,
|
|
126
155
|
});
|
|
127
156
|
var style = mergedProps.fullWidth ? { width: '100%' } : undefined;
|
|
128
|
-
var
|
|
129
|
-
|
|
157
|
+
var handleChange = function (e) {
|
|
158
|
+
setInputValue(e.target.value);
|
|
159
|
+
if (onChange)
|
|
160
|
+
onChange(e);
|
|
161
|
+
};
|
|
162
|
+
var handleFocus = function (e) {
|
|
163
|
+
setIsFocused(true);
|
|
164
|
+
if (rest.onFocus)
|
|
165
|
+
rest.onFocus(e);
|
|
166
|
+
};
|
|
167
|
+
var handleBlur = function (e) {
|
|
168
|
+
setIsFocused(false);
|
|
169
|
+
if (rest.onBlur)
|
|
170
|
+
rest.onBlur(e);
|
|
171
|
+
};
|
|
172
|
+
var inputElement = (react_1.default.createElement("input", __assign({ ref: inputRef, id: id, name: name, className: className, onChange: handleChange, onFocus: handleFocus, onBlur: handleBlur, defaultValue: defaultValue, type: type, placeholder: !label ? rest.placeholder : '', style: style, value: value }, rest)));
|
|
173
|
+
var wrappedInput = (react_1.default.createElement(IconicInputWrapper, { startIcon: mergedProps.startIcon, endIcon: mergedProps.endIcon, prefix: mergedProps.prefix, suffix: mergedProps.suffix, iconicBg: mergedProps.iconicBg, funcss: mergedProps.funcss }, inputElement));
|
|
174
|
+
return (react_1.default.createElement(InputContainer, { startIcon: startIcon, prefix: prefix, label: label, status: mergedProps.status, helperText: helperText, isFocused: isFocused, hasValue: !!inputValue, fullWidth: mergedProps.fullWidth, id: id }, wrappedInput));
|
|
130
175
|
};
|
|
131
176
|
exports.TextInput = TextInput;
|
|
132
177
|
// Select Component
|
|
133
178
|
var SelectInput = function (_a) {
|
|
134
|
-
var id = _a.id, name = _a.name, value = _a.value, defaultValue = _a.defaultValue, onChange = _a.onChange, status = _a.status, funcss = _a.funcss, bg = _a.bg, fullWidth = _a.fullWidth, flat = _a.flat, bordered = _a.bordered, borderless = _a.borderless, rounded = _a.rounded, leftRounded = _a.leftRounded, rightRounded = _a.rightRounded, startIcon = _a.startIcon, endIcon = _a.endIcon, iconicBg = _a.iconicBg, _b = _a.options, options = _b === void 0 ? [] : _b, _c = _a.variant, variant = _c === void 0 ? '' : _c, rest = __rest(_a, ["id", "name", "value", "defaultValue", "onChange", "status", "funcss", "bg", "fullWidth", "flat", "bordered", "borderless", "rounded", "leftRounded", "rightRounded", "startIcon", "endIcon", "iconicBg", "options", "variant"]);
|
|
135
|
-
|
|
179
|
+
var id = _a.id, name = _a.name, value = _a.value, defaultValue = _a.defaultValue, onChange = _a.onChange, status = _a.status, funcss = _a.funcss, bg = _a.bg, fullWidth = _a.fullWidth, flat = _a.flat, bordered = _a.bordered, borderless = _a.borderless, rounded = _a.rounded, leftRounded = _a.leftRounded, rightRounded = _a.rightRounded, startIcon = _a.startIcon, endIcon = _a.endIcon, prefix = _a.prefix, suffix = _a.suffix, iconicBg = _a.iconicBg, _b = _a.options, options = _b === void 0 ? [] : _b, label = _a.label, helperText = _a.helperText, _c = _a.variant, variant = _c === void 0 ? '' : _c, rest = __rest(_a, ["id", "name", "value", "defaultValue", "onChange", "status", "funcss", "bg", "fullWidth", "flat", "bordered", "borderless", "rounded", "leftRounded", "rightRounded", "startIcon", "endIcon", "prefix", "suffix", "iconicBg", "options", "label", "helperText", "variant"]);
|
|
180
|
+
var _d = (0, react_1.useState)(false), isFocused = _d[0], setIsFocused = _d[1];
|
|
181
|
+
var _e = (0, react_1.useState)(value || defaultValue || ''), selectValue = _e[0], setSelectValue = _e[1];
|
|
182
|
+
(0, react_1.useEffect)(function () {
|
|
183
|
+
if (value !== undefined) {
|
|
184
|
+
setSelectValue(value);
|
|
185
|
+
}
|
|
186
|
+
}, [value]);
|
|
187
|
+
// For select inputs, label should always be active when there's a label
|
|
188
|
+
var selectHasValue = true; // Always true for select to keep label at top
|
|
136
189
|
var mergeWithLocal = (0, componentUtils_1.useComponentConfiguration)('Input', variant).mergeWithLocal;
|
|
137
|
-
// Merge config with local props
|
|
138
190
|
var mergedProps = mergeWithLocal({
|
|
139
191
|
status: status,
|
|
140
192
|
funcss: funcss,
|
|
@@ -148,9 +200,10 @@ var SelectInput = function (_a) {
|
|
|
148
200
|
rightRounded: rightRounded,
|
|
149
201
|
startIcon: startIcon,
|
|
150
202
|
endIcon: endIcon,
|
|
203
|
+
prefix: prefix,
|
|
204
|
+
suffix: suffix,
|
|
151
205
|
iconicBg: iconicBg,
|
|
152
206
|
}).props;
|
|
153
|
-
// Use theme variant for fallback
|
|
154
207
|
var themeVariant = (0, theme_1.useVariant)().variant;
|
|
155
208
|
var className = generateInputClasses({
|
|
156
209
|
status: mergedProps.status,
|
|
@@ -164,16 +217,37 @@ var SelectInput = function (_a) {
|
|
|
164
217
|
borderless: mergedProps.borderless,
|
|
165
218
|
});
|
|
166
219
|
var style = mergedProps.fullWidth ? { width: '100%' } : undefined;
|
|
167
|
-
var
|
|
168
|
-
|
|
220
|
+
var handleChange = function (e) {
|
|
221
|
+
setSelectValue(e.target.value);
|
|
222
|
+
if (onChange)
|
|
223
|
+
onChange(e);
|
|
224
|
+
};
|
|
225
|
+
var handleFocus = function (e) {
|
|
226
|
+
setIsFocused(true);
|
|
227
|
+
if (rest.onFocus)
|
|
228
|
+
rest.onFocus(e);
|
|
229
|
+
};
|
|
230
|
+
var handleBlur = function (e) {
|
|
231
|
+
setIsFocused(false);
|
|
232
|
+
if (rest.onBlur)
|
|
233
|
+
rest.onBlur(e);
|
|
234
|
+
};
|
|
235
|
+
var selectElement = (react_1.default.createElement("select", __assign({ id: id, name: name, className: className, onChange: handleChange, onFocus: handleFocus, onBlur: handleBlur, defaultValue: defaultValue, value: value, style: style }, rest), options.map(function (option) { return (react_1.default.createElement("option", { key: option.value, value: option.value }, option.text)); })));
|
|
236
|
+
var wrappedSelect = (react_1.default.createElement(IconicInputWrapper, { startIcon: mergedProps.startIcon, endIcon: mergedProps.endIcon, prefix: mergedProps.prefix, suffix: mergedProps.suffix, iconicBg: mergedProps.iconicBg, funcss: mergedProps.funcss }, selectElement));
|
|
237
|
+
return (react_1.default.createElement(InputContainer, { startIcon: startIcon, prefix: prefix, label: label, status: mergedProps.status, helperText: helperText, isFocused: isFocused, hasValue: selectHasValue, fullWidth: mergedProps.fullWidth, id: id }, wrappedSelect));
|
|
169
238
|
};
|
|
170
239
|
exports.SelectInput = SelectInput;
|
|
171
240
|
// Textarea Component
|
|
172
241
|
var TextareaInput = function (_a) {
|
|
173
|
-
var id = _a.id, name = _a.name, value = _a.value, defaultValue = _a.defaultValue, onChange = _a.onChange, status = _a.status, funcss = _a.funcss, bg = _a.bg, fullWidth = _a.fullWidth, flat = _a.flat, bordered = _a.bordered, borderless = _a.borderless, rounded = _a.rounded, leftRounded = _a.leftRounded, rightRounded = _a.rightRounded, startIcon = _a.startIcon, endIcon = _a.endIcon, iconicBg = _a.iconicBg, label = _a.label, _b = _a.rows, rows = _b === void 0 ? 2 : _b, _c = _a.variant, variant = _c === void 0 ? '' : _c, rest = __rest(_a, ["id", "name", "value", "defaultValue", "onChange", "status", "funcss", "bg", "fullWidth", "flat", "bordered", "borderless", "rounded", "leftRounded", "rightRounded", "startIcon", "endIcon", "iconicBg", "label", "rows", "variant"]);
|
|
174
|
-
|
|
242
|
+
var id = _a.id, name = _a.name, value = _a.value, defaultValue = _a.defaultValue, onChange = _a.onChange, status = _a.status, funcss = _a.funcss, bg = _a.bg, fullWidth = _a.fullWidth, flat = _a.flat, bordered = _a.bordered, borderless = _a.borderless, rounded = _a.rounded, leftRounded = _a.leftRounded, rightRounded = _a.rightRounded, startIcon = _a.startIcon, endIcon = _a.endIcon, prefix = _a.prefix, suffix = _a.suffix, iconicBg = _a.iconicBg, label = _a.label, helperText = _a.helperText, _b = _a.rows, rows = _b === void 0 ? 2 : _b, _c = _a.variant, variant = _c === void 0 ? '' : _c, rest = __rest(_a, ["id", "name", "value", "defaultValue", "onChange", "status", "funcss", "bg", "fullWidth", "flat", "bordered", "borderless", "rounded", "leftRounded", "rightRounded", "startIcon", "endIcon", "prefix", "suffix", "iconicBg", "label", "helperText", "rows", "variant"]);
|
|
243
|
+
var _d = (0, react_1.useState)(false), isFocused = _d[0], setIsFocused = _d[1];
|
|
244
|
+
var _e = (0, react_1.useState)(value || defaultValue || ''), textValue = _e[0], setTextValue = _e[1];
|
|
245
|
+
(0, react_1.useEffect)(function () {
|
|
246
|
+
if (value !== undefined) {
|
|
247
|
+
setTextValue(value);
|
|
248
|
+
}
|
|
249
|
+
}, [value]);
|
|
175
250
|
var mergeWithLocal = (0, componentUtils_1.useComponentConfiguration)('Input', variant).mergeWithLocal;
|
|
176
|
-
// Merge config with local props
|
|
177
251
|
var mergedProps = mergeWithLocal({
|
|
178
252
|
status: status,
|
|
179
253
|
funcss: funcss,
|
|
@@ -187,9 +261,10 @@ var TextareaInput = function (_a) {
|
|
|
187
261
|
rightRounded: rightRounded,
|
|
188
262
|
startIcon: startIcon,
|
|
189
263
|
endIcon: endIcon,
|
|
264
|
+
prefix: prefix,
|
|
265
|
+
suffix: suffix,
|
|
190
266
|
iconicBg: iconicBg,
|
|
191
267
|
}).props;
|
|
192
|
-
// Use theme variant for fallback
|
|
193
268
|
var themeVariant = (0, theme_1.useVariant)().variant;
|
|
194
269
|
var className = generateInputClasses({
|
|
195
270
|
status: mergedProps.status,
|
|
@@ -203,17 +278,31 @@ var TextareaInput = function (_a) {
|
|
|
203
278
|
borderless: mergedProps.borderless,
|
|
204
279
|
});
|
|
205
280
|
var style = mergedProps.fullWidth ? { width: '100%' } : undefined;
|
|
206
|
-
var
|
|
207
|
-
|
|
281
|
+
var handleChange = function (e) {
|
|
282
|
+
setTextValue(e.target.value);
|
|
283
|
+
if (onChange)
|
|
284
|
+
onChange(e);
|
|
285
|
+
};
|
|
286
|
+
var handleFocus = function (e) {
|
|
287
|
+
setIsFocused(true);
|
|
288
|
+
if (rest.onFocus)
|
|
289
|
+
rest.onFocus(e);
|
|
290
|
+
};
|
|
291
|
+
var handleBlur = function (e) {
|
|
292
|
+
setIsFocused(false);
|
|
293
|
+
if (rest.onBlur)
|
|
294
|
+
rest.onBlur(e);
|
|
295
|
+
};
|
|
296
|
+
var textareaElement = (react_1.default.createElement("textarea", __assign({ id: id, name: name, className: className, onChange: handleChange, onFocus: handleFocus, onBlur: handleBlur, defaultValue: defaultValue, placeholder: !label ? rest.placeholder : '', style: style, value: value, rows: rows }, rest)));
|
|
297
|
+
var wrappedTextarea = (react_1.default.createElement(IconicInputWrapper, { startIcon: mergedProps.startIcon, endIcon: mergedProps.endIcon, prefix: mergedProps.prefix, suffix: mergedProps.suffix, iconicBg: mergedProps.iconicBg, funcss: mergedProps.funcss }, textareaElement));
|
|
298
|
+
return (react_1.default.createElement(InputContainer, { startIcon: startIcon, prefix: prefix, label: label, status: mergedProps.status, helperText: helperText, isFocused: isFocused, hasValue: !!textValue, fullWidth: mergedProps.fullWidth, id: id }, wrappedTextarea));
|
|
208
299
|
};
|
|
209
300
|
exports.TextareaInput = TextareaInput;
|
|
210
301
|
// File Input Component
|
|
211
302
|
var FileInput = function (_a) {
|
|
212
|
-
var _b = _a.id, id = _b === void 0 ? 'fileInput' : _b, name = _a.name, onChange = _a.onChange, status = _a.status, funcss = _a.funcss, bg = _a.bg, fullWidth = _a.fullWidth, flat = _a.flat, rounded = _a.rounded, leftRounded = _a.leftRounded, rightRounded = _a.rightRounded, startIcon = _a.startIcon, endIcon = _a.endIcon, iconicBg = _a.iconicBg, _c = _a.label, label = _c === void 0 ? 'Upload File' : _c, icon = _a.icon, extra = _a.extra, button = _a.button, btn = _a.btn, value = _a.value, _d = _a.variant, variant = _d === void 0 ? '' : _d, rest = __rest(_a, ["id", "name", "onChange", "status", "funcss", "bg", "fullWidth", "flat", "rounded", "leftRounded", "rightRounded", "startIcon", "endIcon", "iconicBg", "label", "icon", "extra", "button", "btn", "value", "variant"]);
|
|
303
|
+
var _b = _a.id, id = _b === void 0 ? 'fileInput' : _b, name = _a.name, onChange = _a.onChange, status = _a.status, funcss = _a.funcss, bg = _a.bg, fullWidth = _a.fullWidth, flat = _a.flat, rounded = _a.rounded, leftRounded = _a.leftRounded, rightRounded = _a.rightRounded, startIcon = _a.startIcon, endIcon = _a.endIcon, prefix = _a.prefix, suffix = _a.suffix, iconicBg = _a.iconicBg, _c = _a.label, label = _c === void 0 ? 'Upload File' : _c, helperText = _a.helperText, icon = _a.icon, extra = _a.extra, button = _a.button, btn = _a.btn, value = _a.value, _d = _a.variant, variant = _d === void 0 ? '' : _d, rest = __rest(_a, ["id", "name", "onChange", "status", "funcss", "bg", "fullWidth", "flat", "rounded", "leftRounded", "rightRounded", "startIcon", "endIcon", "prefix", "suffix", "iconicBg", "label", "helperText", "icon", "extra", "button", "btn", "value", "variant"]);
|
|
213
304
|
var _e = (0, react_1.useState)(''), fileName = _e[0], setFileName = _e[1];
|
|
214
|
-
// Use the component config hook
|
|
215
305
|
var mergeWithLocal = (0, componentUtils_1.useComponentConfiguration)('Input', variant).mergeWithLocal;
|
|
216
|
-
// Merge config with local props
|
|
217
306
|
var mergedProps = mergeWithLocal({
|
|
218
307
|
status: status,
|
|
219
308
|
funcss: funcss,
|
|
@@ -225,11 +314,12 @@ var FileInput = function (_a) {
|
|
|
225
314
|
rightRounded: rightRounded,
|
|
226
315
|
startIcon: startIcon,
|
|
227
316
|
endIcon: endIcon,
|
|
317
|
+
prefix: prefix,
|
|
318
|
+
suffix: suffix,
|
|
228
319
|
iconicBg: iconicBg,
|
|
229
320
|
bordered: rest.bordered,
|
|
230
321
|
borderless: rest.borderless,
|
|
231
322
|
}).props;
|
|
232
|
-
// Use theme variant for fallback
|
|
233
323
|
var themeVariant = (0, theme_1.useVariant)().variant;
|
|
234
324
|
var handleChange = function (e) {
|
|
235
325
|
var _a;
|
|
@@ -256,8 +346,9 @@ var FileInput = function (_a) {
|
|
|
256
346
|
var style = mergedProps.fullWidth ? { width: '100%' } : undefined;
|
|
257
347
|
var fileInputElement = (react_1.default.createElement("div", { className: "fileInput" },
|
|
258
348
|
button || (react_1.default.createElement(Button_1.default, { funcss: mergedProps.funcss, startIcon: icon || react_1.default.createElement(pi_1.PiCloudArrowUp, null), bg: "primary", fullWidth: true, raised: true }, fileName || label)),
|
|
259
|
-
react_1.default.createElement("input", __assign({ id: id, name: name, className: className, onChange: handleChange, type: "file", style: style, value: value }, rest
|
|
260
|
-
|
|
349
|
+
react_1.default.createElement("input", __assign({ id: id, name: name, className: className, onChange: handleChange, type: "file", style: style, value: value }, rest))));
|
|
350
|
+
var wrappedFileInput = (react_1.default.createElement(IconicInputWrapper, { startIcon: mergedProps.startIcon, endIcon: mergedProps.endIcon, prefix: mergedProps.prefix, suffix: mergedProps.suffix, iconicBg: mergedProps.iconicBg, funcss: mergedProps.funcss }, fileInputElement));
|
|
351
|
+
return (react_1.default.createElement(InputContainer, { startIcon: startIcon, prefix: prefix, label: undefined, status: mergedProps.status, helperText: helperText, isFocused: false, hasValue: !!fileName, fullWidth: mergedProps.fullWidth, id: id }, wrappedFileInput));
|
|
261
352
|
}
|
|
262
353
|
var uploadElement = (react_1.default.createElement("div", { className: "_upload_container" },
|
|
263
354
|
react_1.default.createElement("label", { htmlFor: id, className: "_upload_label" },
|
|
@@ -270,17 +361,14 @@ var FileInput = function (_a) {
|
|
|
270
361
|
width: '100%',
|
|
271
362
|
} }, fileName || label),
|
|
272
363
|
extra && react_1.default.createElement("div", { className: "text-small opacity-3" }, extra)),
|
|
273
|
-
react_1.default.createElement("input", __assign({ onChange: handleChange, type: "file", id: id, className: "_upload_input" }, rest
|
|
274
|
-
return (react_1.default.createElement(
|
|
364
|
+
react_1.default.createElement("input", __assign({ onChange: handleChange, type: "file", id: id, className: "_upload_input" }, rest))));
|
|
365
|
+
return (react_1.default.createElement(InputContainer, { startIcon: startIcon, prefix: prefix, label: undefined, status: mergedProps.status, helperText: helperText, isFocused: false, hasValue: !!fileName, fullWidth: mergedProps.fullWidth, id: id }, uploadElement));
|
|
275
366
|
};
|
|
276
367
|
exports.FileInput = FileInput;
|
|
277
368
|
var Input = function (_a) {
|
|
278
|
-
var select = _a.select, multiline = _a.multiline, file = _a.file, noBorder = _a.noBorder, startIcon = _a.startIcon, endIcon = _a.endIcon, iconicBg = _a.iconicBg, _b = _a.variant, variant = _b === void 0 ? '' : _b, props = __rest(_a, ["select", "multiline", "file", "noBorder", "startIcon", "endIcon", "iconicBg", "variant"]);
|
|
279
|
-
// Use the component config hook for the main Input component
|
|
369
|
+
var select = _a.select, multiline = _a.multiline, file = _a.file, noBorder = _a.noBorder, startIcon = _a.startIcon, endIcon = _a.endIcon, prefix = _a.prefix, suffix = _a.suffix, iconicBg = _a.iconicBg, _b = _a.variant, variant = _b === void 0 ? '' : _b, props = __rest(_a, ["select", "multiline", "file", "noBorder", "startIcon", "endIcon", "prefix", "suffix", "iconicBg", "variant"]);
|
|
280
370
|
var mergeWithLocal = (0, componentUtils_1.useComponentConfiguration)('Input', variant).mergeWithLocal;
|
|
281
|
-
|
|
282
|
-
var mergedProps = mergeWithLocal(__assign(__assign({}, props), { startIcon: startIcon, endIcon: endIcon, iconicBg: iconicBg })).props;
|
|
283
|
-
// Handle legacy noBorder prop
|
|
371
|
+
var mergedProps = mergeWithLocal(__assign(__assign({}, props), { startIcon: startIcon, endIcon: endIcon, prefix: prefix, suffix: suffix, iconicBg: iconicBg })).props;
|
|
284
372
|
var inputProps = __assign(__assign(__assign({}, props), mergedProps), { variant: variant, borderless: noBorder !== undefined ? noBorder : (props.borderless !== undefined ? props.borderless : mergedProps.borderless) });
|
|
285
373
|
if (select) {
|
|
286
374
|
return react_1.default.createElement(exports.SelectInput, __assign({}, inputProps));
|
package/ui/richtext/RichText.js
CHANGED
|
@@ -66,19 +66,21 @@ var RichText = function (_a) {
|
|
|
66
66
|
savedRange.current = range;
|
|
67
67
|
};
|
|
68
68
|
var handleTextChange = function () {
|
|
69
|
+
var _a, _b, _c;
|
|
69
70
|
if (!quill)
|
|
70
71
|
return;
|
|
71
|
-
var plainText = quill.getText();
|
|
72
|
-
|
|
73
|
-
if (maxValue &&
|
|
74
|
-
var truncated =
|
|
72
|
+
var plainText = quill.getText().trim();
|
|
73
|
+
// --- Enforce maxValue if needed ---
|
|
74
|
+
if (maxValue && plainText.length > maxValue) {
|
|
75
|
+
var truncated = plainText.slice(0, maxValue);
|
|
75
76
|
quill.setText(truncated);
|
|
76
77
|
quill.setSelection(truncated.length);
|
|
77
|
-
onChange(quill.root.innerHTML);
|
|
78
|
-
}
|
|
79
|
-
else {
|
|
80
|
-
onChange(quill.root.innerHTML);
|
|
81
78
|
}
|
|
79
|
+
// --- Clean the HTML output ---
|
|
80
|
+
var cleanedHTML = (_c = (_b = (_a = quill.root.innerHTML) === null || _a === void 0 ? void 0 : _a.replace(/<p><br><\/p>/g, '') // remove empty paragraphs
|
|
81
|
+
) === null || _b === void 0 ? void 0 : _b.replace(/\s+/g, ' ') // collapse multiple spaces
|
|
82
|
+
) === null || _c === void 0 ? void 0 : _c.trim(); // remove leading/trailing spaces
|
|
83
|
+
onChange(cleanedHTML || '');
|
|
82
84
|
};
|
|
83
85
|
quill.on('selection-change', handleSelectionChange);
|
|
84
86
|
quill.on('text-change', handleTextChange);
|
|
@@ -88,8 +90,11 @@ var RichText = function (_a) {
|
|
|
88
90
|
};
|
|
89
91
|
}, [quill, onChange, maxValue]);
|
|
90
92
|
(0, react_1.useEffect)(function () {
|
|
93
|
+
var _a, _b;
|
|
91
94
|
if (quill && value !== quill.root.innerHTML) {
|
|
92
|
-
|
|
95
|
+
// clean before setting editor value
|
|
96
|
+
var cleanedValue = (_b = (_a = value === null || value === void 0 ? void 0 : value.replace(/<p><br><\/p>/g, '')) === null || _a === void 0 ? void 0 : _a.replace(/\s+/g, ' ')) === null || _b === void 0 ? void 0 : _b.trim();
|
|
97
|
+
quill.root.innerHTML = cleanedValue || '';
|
|
93
98
|
}
|
|
94
99
|
}, [quill, value]);
|
|
95
100
|
var insertEmoji = function (emoji) {
|
|
@@ -104,15 +109,15 @@ var RichText = function (_a) {
|
|
|
104
109
|
var renderEmojiSection = function (title, emojis) { return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
105
110
|
react_1.default.createElement("div", { className: "mb-2 mt-2 text-sm" }, title),
|
|
106
111
|
react_1.default.createElement(RowFlex_1.default, { gap: 0.3 }, emojis.map(function (emoji, i) { return (react_1.default.createElement("span", { key: i, className: "h6 pointer", onClick: function () { return insertEmoji(emoji); } }, emoji)); })))); };
|
|
107
|
-
return (react_1.default.createElement("div", { className: "fit round-edge ".concat(funcss), style: { position:
|
|
112
|
+
return (react_1.default.createElement("div", { className: "fit round-edge ".concat(funcss), style: { position: 'relative', overflow: 'visible' } },
|
|
108
113
|
react_1.default.createElement("div", { id: "editor-container", className: "bubble-editor-container p-0" },
|
|
109
114
|
react_1.default.createElement("div", { ref: quillRef, className: theme === 'bubble' ? 'bubble-editor' : 'snow-editor', style: {
|
|
110
115
|
fontFamily: fontFamily || 'inherit',
|
|
111
116
|
} })),
|
|
112
|
-
(showEmojis || maxValue) && (react_1.default.createElement("div", { className:
|
|
113
|
-
react_1.default.createElement(Flex_1.default, { justify:
|
|
117
|
+
(showEmojis || maxValue) && (react_1.default.createElement("div", { className: "p-1", style: { height: 'fit-content', top: "calc(100%)", width: '100%' } },
|
|
118
|
+
react_1.default.createElement(Flex_1.default, { justify: "space-between", gap: 1, alignItems: "center", width: "100%" },
|
|
114
119
|
(showEmojis || afterEmoji) ? (react_1.default.createElement("div", null,
|
|
115
|
-
react_1.default.createElement(Flex_1.default, { width:
|
|
120
|
+
react_1.default.createElement(Flex_1.default, { width: "100%", gap: 0.5, alignItems: "center" },
|
|
116
121
|
showEmojis && (react_1.default.createElement(Dropdown_1.default, { closableOnlyOutside: true, direction: "dropdown", openOnHover: false, button: react_1.default.createElement(ToolTip_1.default, null,
|
|
117
122
|
react_1.default.createElement(Circle_1.default, { size: 2, funcss: "bg border" },
|
|
118
123
|
react_1.default.createElement(md_1.MdOutlineEmojiEmotions, null)),
|
|
@@ -128,9 +133,9 @@ var RichText = function (_a) {
|
|
|
128
133
|
},
|
|
129
134
|
] })),
|
|
130
135
|
afterEmoji))) : (react_1.default.createElement("div", null)),
|
|
131
|
-
|
|
136
|
+
maxValue && quill ? (react_1.default.createElement("div", { className: "text-xs text-right" },
|
|
132
137
|
react_1.default.createElement("span", { className: "text-primary" }, quill.getText().trim().length),
|
|
133
|
-
"
|
|
138
|
+
"/",
|
|
134
139
|
maxValue)) : (react_1.default.createElement("div", null)))))));
|
|
135
140
|
};
|
|
136
141
|
exports.default = RichText;
|
package/ui/select/Select.d.ts
CHANGED
package/ui/select/Select.js
CHANGED
|
@@ -32,9 +32,13 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
32
32
|
return result;
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
35
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
39
|
var react_1 = __importStar(require("react"));
|
|
37
40
|
var theme_1 = require("../theme/theme");
|
|
41
|
+
var Flex_1 = __importDefault(require("../flex/Flex"));
|
|
38
42
|
var Select = function (_a) {
|
|
39
43
|
var id = _a.id, name = _a.name, value = _a.value, defaultValue = _a.defaultValue, _b = _a.label, label = _b === void 0 ? 'Select an option' : _b, _c = _a.options, options = _c === void 0 ? [] : _c, onChange = _a.onChange, onBlur = _a.onBlur, _d = _a.searchable, searchable = _d === void 0 ? true : _d, _e = _a.disabled, disabled = _e === void 0 ? false : _e, _f = _a.bordered, bordered = _f === void 0 ? false : _f, _g = _a.borderless, borderless = _g === void 0 ? false : _g, _h = _a.rounded, rounded = _h === void 0 ? false : _h, _j = _a.flat, flat = _j === void 0 ? false : _j, _k = _a.fullWidth, fullWidth = _k === void 0 ? false : _k, _l = _a.status, status = _l === void 0 ? '' : _l, _m = _a.className, className = _m === void 0 ? '' : _m, _o = _a.funcss, funcss = _o === void 0 ? '' : _o, _p = _a.style, style = _p === void 0 ? {} : _p, _q = _a.searchAutoFocus, searchAutoFocus = _q === void 0 ? false : _q, _r = _a.required, required = _r === void 0 ? false : _r;
|
|
40
44
|
var _s = (0, react_1.useState)(false), isOpen = _s[0], setIsOpen = _s[1];
|
|
@@ -211,7 +215,13 @@ var Select = function (_a) {
|
|
|
211
215
|
react_1.default.createElement("svg", { width: "16", height: "16", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24" },
|
|
212
216
|
react_1.default.createElement("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2", d: "M19 9l-7 7-7-7" })))),
|
|
213
217
|
react_1.default.createElement("div", { className: "select-dropdown ".concat(isOpen ? 'open' : '', " ") },
|
|
214
|
-
searchable && (react_1.default.createElement("input", { ref: searchInputRef, type: "text", className: "select-search", placeholder: "Search options...", value: searchQuery, onChange: function (e) { return setSearchQuery(e.target.value); }, onKeyDown: handleSearchKeyDown })),
|
|
215
|
-
react_1.default.createElement("div", { className: "select-options", role: "listbox" }, filteredOptions.length === 0 ? (react_1.default.createElement("div", { className: "select-option no-results" }, "No options found")) : (filteredOptions.map(function (option, index) { return (react_1.default.createElement("button", { key: option.value, type: "button", className: "select-option ".concat((selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.value) === option.value ? 'selected' : '', " ").concat(index === focusedIndex ? 'focused' : ''), onClick: function () { return selectOption(option); }, role: "option", "aria-selected": (selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.value) === option.value },
|
|
218
|
+
searchable && (react_1.default.createElement("input", { ref: searchInputRef, type: "text", className: "select-search", placeholder: "Search options...", style: { borderRadius: 0 }, value: searchQuery, onChange: function (e) { return setSearchQuery(e.target.value); }, onKeyDown: handleSearchKeyDown })),
|
|
219
|
+
react_1.default.createElement("div", { className: "select-options", role: "listbox" }, filteredOptions.length === 0 ? (react_1.default.createElement("div", { className: "select-option no-results" }, "No options found")) : (filteredOptions.map(function (option, index) { return (react_1.default.createElement("button", { style: { borderRadius: 0 }, key: option.value, type: "button", className: "select-option ".concat((selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.value) === option.value ? 'selected' : '', " ").concat(index === focusedIndex ? 'focused' : ''), onClick: function () { return selectOption(option); }, role: "option", "aria-selected": (selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.value) === option.value },
|
|
220
|
+
react_1.default.createElement(Flex_1.default, { width: '100%', gap: 0.5 }, option === null || option === void 0 ? void 0 :
|
|
221
|
+
option.prefix,
|
|
222
|
+
" ",
|
|
223
|
+
option.text,
|
|
224
|
+
" ", option === null || option === void 0 ? void 0 :
|
|
225
|
+
option.suffix))); }))))));
|
|
216
226
|
};
|
|
217
227
|
exports.default = Select;
|
package/ui/text/Text.d.ts
CHANGED
|
@@ -40,6 +40,8 @@ type TypographyProps = {
|
|
|
40
40
|
onClick?: () => void;
|
|
41
41
|
children?: React.ReactNode;
|
|
42
42
|
variant?: string;
|
|
43
|
+
margin?: string;
|
|
44
|
+
padding?: string;
|
|
43
45
|
size?: "xs" | "sm" | "base" | "lg" | "xl" | "2xl" | "3xl" | "4xl" | "5xl" | "6xl" | "7xl" | "8xl" | "9xl" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6";
|
|
44
46
|
};
|
|
45
47
|
declare const Text: React.FC<TypographyProps>;
|
package/ui/text/Text.js
CHANGED
|
@@ -31,12 +31,14 @@ var pi_1 = require("react-icons/pi");
|
|
|
31
31
|
var getCssVariable_1 = require("../../utils/getCssVariable");
|
|
32
32
|
var componentUtils_1 = require("../../utils/componentUtils");
|
|
33
33
|
var Text = function (_a) {
|
|
34
|
-
var id = _a.id, bg = _a.bg, color = _a.color, children = _a.children, hoverBg = _a.hoverBg, hoverText = _a.hoverText, text = _a.text, funcss = _a.funcss, emp = _a.emp, bold = _a.bold, block = _a.block, body = _a.body, article = _a.article, light = _a.light, lighter = _a.lighter, italic = _a.italic, weight = _a.weight, underline = _a.underline, align = _a.align, lineHeight = _a.lineHeight, letterSpacing = _a.letterSpacing, uppercase = _a.uppercase, lowercase = _a.lowercase, capitalize = _a.capitalize, textDecoration = _a.textDecoration, textTransform = _a.textTransform, whiteSpace = _a.whiteSpace, wordBreak = _a.wordBreak, fontFamily = _a.fontFamily, truncate = _a.truncate, textShadow = _a.textShadow, textAlign = _a.textAlign, customStyles = _a.customStyles, monospace = _a.monospace, quote = _a.quote, opacity = _a.opacity, _b = _a.variant, variant = _b === void 0 ? '' : _b, _c = _a.size, size = _c === void 0 ? 'base' : _c, rest = __rest(_a, ["id", "bg", "color", "children", "hoverBg", "hoverText", "text", "funcss", "emp", "bold", "block", "body", "article", "light", "lighter", "italic", "weight", "underline", "align", "lineHeight", "letterSpacing", "uppercase", "lowercase", "capitalize", "textDecoration", "textTransform", "whiteSpace", "wordBreak", "fontFamily", "truncate", "textShadow", "textAlign", "customStyles", "monospace", "quote", "opacity", "variant", "size"]);
|
|
34
|
+
var id = _a.id, bg = _a.bg, color = _a.color, children = _a.children, hoverBg = _a.hoverBg, hoverText = _a.hoverText, text = _a.text, funcss = _a.funcss, emp = _a.emp, bold = _a.bold, block = _a.block, body = _a.body, article = _a.article, light = _a.light, lighter = _a.lighter, italic = _a.italic, weight = _a.weight, underline = _a.underline, align = _a.align, lineHeight = _a.lineHeight, letterSpacing = _a.letterSpacing, uppercase = _a.uppercase, lowercase = _a.lowercase, capitalize = _a.capitalize, textDecoration = _a.textDecoration, textTransform = _a.textTransform, whiteSpace = _a.whiteSpace, wordBreak = _a.wordBreak, fontFamily = _a.fontFamily, truncate = _a.truncate, textShadow = _a.textShadow, textAlign = _a.textAlign, customStyles = _a.customStyles, monospace = _a.monospace, quote = _a.quote, opacity = _a.opacity, _b = _a.variant, variant = _b === void 0 ? '' : _b, _c = _a.size, size = _c === void 0 ? 'base' : _c, margin = _a.margin, padding = _a.padding, rest = __rest(_a, ["id", "bg", "color", "children", "hoverBg", "hoverText", "text", "funcss", "emp", "bold", "block", "body", "article", "light", "lighter", "italic", "weight", "underline", "align", "lineHeight", "letterSpacing", "uppercase", "lowercase", "capitalize", "textDecoration", "textTransform", "whiteSpace", "wordBreak", "fontFamily", "truncate", "textShadow", "textAlign", "customStyles", "monospace", "quote", "opacity", "variant", "size", "margin", "padding"]);
|
|
35
35
|
// Use the component config hook
|
|
36
36
|
var mergeWithLocal = (0, componentUtils_1.useComponentConfiguration)('Text', variant).mergeWithLocal;
|
|
37
37
|
// Merge config with local props - local props override config
|
|
38
|
-
var mergedProps = mergeWithLocal(__assign({ bg: bg, color: color, funcss: funcss, emp: emp, bold: bold, block: block, body: body, article: article, light: light, lighter: lighter, italic: italic, weight: weight, underline: underline, align: align, lineHeight: lineHeight, letterSpacing: letterSpacing, uppercase: uppercase, lowercase: lowercase, capitalize: capitalize, textDecoration: textDecoration, textTransform: textTransform, whiteSpace: whiteSpace, wordBreak: wordBreak, fontFamily: fontFamily, truncate: truncate, textShadow: textShadow, textAlign: textAlign, monospace: monospace, quote: quote, opacity: opacity, size: size }, rest)).props;
|
|
39
|
-
|
|
38
|
+
var mergedProps = mergeWithLocal(__assign({ bg: bg, color: color, funcss: funcss, emp: emp, bold: bold, block: block, body: body, article: article, light: light, lighter: lighter, italic: italic, weight: weight, underline: underline, align: align, lineHeight: lineHeight, letterSpacing: letterSpacing, uppercase: uppercase, lowercase: lowercase, capitalize: capitalize, textDecoration: textDecoration, textTransform: textTransform, whiteSpace: whiteSpace, wordBreak: wordBreak, fontFamily: fontFamily, truncate: truncate, textShadow: textShadow, textAlign: textAlign, monospace: monospace, quote: quote, opacity: opacity, size: size, margin: margin, padding: padding }, rest)).props;
|
|
39
|
+
// If margin is provided, force block display
|
|
40
|
+
var shouldBeBlock = mergedProps.block || !!mergedProps.margin;
|
|
41
|
+
var Tag = shouldBeBlock ? 'div' : 'span';
|
|
40
42
|
var sizeClass = "".concat(mergedProps.size === 'h1' ? "h1" :
|
|
41
43
|
mergedProps.size === 'h2' ? "h2" :
|
|
42
44
|
mergedProps.size === 'h3' ? "h3" :
|
|
@@ -45,7 +47,7 @@ var Text = function (_a) {
|
|
|
45
47
|
mergedProps.size === 'h6' ? "h6" :
|
|
46
48
|
"text-".concat(mergedProps.size));
|
|
47
49
|
var bdFontWeight = (0, getCssVariable_1.getCssVariableValue)('bd-font-weight');
|
|
48
|
-
var mergedStyles = __assign(__assign({ display:
|
|
50
|
+
var mergedStyles = __assign(__assign({ display: shouldBeBlock ? 'block' : undefined, fontWeight: mergedProps.bold ? 'bold' : mergedProps.weight ? mergedProps.weight : Number(bdFontWeight), lineHeight: mergedProps.lineHeight, letterSpacing: mergedProps.letterSpacing, textTransform: mergedProps.textTransform, textDecoration: mergedProps.textDecoration, fontFamily: mergedProps.fontFamily, textShadow: mergedProps.textShadow, textAlign: mergedProps.textAlign, whiteSpace: mergedProps.whiteSpace, wordBreak: mergedProps.wordBreak, transform: mergedProps.transform, margin: mergedProps.margin, padding: mergedProps.padding }, customStyles), (mergedProps.truncate
|
|
49
51
|
? {
|
|
50
52
|
display: '-webkit-box',
|
|
51
53
|
WebkitBoxOrient: 'vertical',
|
package/ui/vista/Vista.d.ts
CHANGED
|
@@ -61,6 +61,21 @@ type VistaProps = {
|
|
|
61
61
|
ctaPrimaryText?: string;
|
|
62
62
|
ctaSecondaryText?: string;
|
|
63
63
|
ctaAccentText?: string;
|
|
64
|
+
ctaPrimaryRounded?: boolean;
|
|
65
|
+
ctaPrimaryFlat?: boolean;
|
|
66
|
+
ctaPrimaryPrefix?: string;
|
|
67
|
+
ctaPrimarySuffix?: string;
|
|
68
|
+
primaryIconSize?: number;
|
|
69
|
+
ctaSecondaryRounded?: boolean;
|
|
70
|
+
ctaSecondaryFlat?: boolean;
|
|
71
|
+
ctaSecondaryPrefix?: string;
|
|
72
|
+
ctaSecondarySuffix?: string;
|
|
73
|
+
secondaryIconSize?: number;
|
|
74
|
+
ctaAccentRounded?: boolean;
|
|
75
|
+
ctaAccentFlat?: boolean;
|
|
76
|
+
ctaAccentPrefix?: string;
|
|
77
|
+
ctaAccentSuffix?: string;
|
|
78
|
+
accentIconSize?: number;
|
|
64
79
|
ctaGap?: number;
|
|
65
80
|
ctaFlexJustify?: 'flex-start' | 'center' | 'flex-end' | 'space-between' | 'space-around';
|
|
66
81
|
};
|
package/ui/vista/Vista.js
CHANGED
|
@@ -34,7 +34,7 @@ var Vista = function (_a) {
|
|
|
34
34
|
// New CTA Button Props
|
|
35
35
|
_19 = _a.showPrimaryCTA,
|
|
36
36
|
// New CTA Button Props
|
|
37
|
-
showPrimaryCTA = _19 === void 0 ? false : _19, _20 = _a.showSecondaryCTA, showSecondaryCTA = _20 === void 0 ? false : _20, _21 = _a.showAccentCTA, showAccentCTA = _21 === void 0 ? false : _21, _22 = _a.primaryButtonOutlined, primaryButtonOutlined = _22 === void 0 ? false : _22, _23 = _a.secondaryButtonOutlined, secondaryButtonOutlined = _23 === void 0 ? false : _23, _24 = _a.accentButtonOutlined, accentButtonOutlined = _24 === void 0 ? false : _24, _25 = _a.ctaPrimaryUrl, ctaPrimaryUrl = _25 === void 0 ? '' : _25, _26 = _a.ctaSecondaryUrl, ctaSecondaryUrl = _26 === void 0 ? '' : _26, _27 = _a.ctaAccentUrl, ctaAccentUrl = _27 === void 0 ? '' : _27, _28 = _a.ctaPrimaryText, ctaPrimaryText = _28 === void 0 ? 'Primary Action' : _28, _29 = _a.ctaSecondaryText, ctaSecondaryText = _29 === void 0 ? 'Secondary Action' : _29, _30 = _a.ctaAccentText, ctaAccentText = _30 === void 0 ? 'Accent Action' : _30, _31 = _a.ctaGap, ctaGap = _31 === void 0 ? 1 : _31, _32 = _a.ctaFlexJustify, ctaFlexJustify = _32 === void 0 ? 'center' : _32;
|
|
37
|
+
showPrimaryCTA = _19 === void 0 ? false : _19, _20 = _a.showSecondaryCTA, showSecondaryCTA = _20 === void 0 ? false : _20, _21 = _a.showAccentCTA, showAccentCTA = _21 === void 0 ? false : _21, _22 = _a.primaryButtonOutlined, primaryButtonOutlined = _22 === void 0 ? false : _22, _23 = _a.secondaryButtonOutlined, secondaryButtonOutlined = _23 === void 0 ? false : _23, _24 = _a.accentButtonOutlined, accentButtonOutlined = _24 === void 0 ? false : _24, _25 = _a.ctaPrimaryUrl, ctaPrimaryUrl = _25 === void 0 ? '' : _25, _26 = _a.ctaSecondaryUrl, ctaSecondaryUrl = _26 === void 0 ? '' : _26, _27 = _a.ctaAccentUrl, ctaAccentUrl = _27 === void 0 ? '' : _27, _28 = _a.ctaPrimaryText, ctaPrimaryText = _28 === void 0 ? 'Primary Action' : _28, _29 = _a.ctaSecondaryText, ctaSecondaryText = _29 === void 0 ? 'Secondary Action' : _29, _30 = _a.ctaAccentText, ctaAccentText = _30 === void 0 ? 'Accent Action' : _30, _31 = _a.ctaGap, ctaGap = _31 === void 0 ? 1 : _31, _32 = _a.ctaFlexJustify, ctaFlexJustify = _32 === void 0 ? 'center' : _32, _33 = _a.ctaPrimaryRounded, ctaPrimaryRounded = _33 === void 0 ? false : _33, _34 = _a.ctaPrimaryFlat, ctaPrimaryFlat = _34 === void 0 ? false : _34, _35 = _a.ctaPrimaryPrefix, ctaPrimaryPrefix = _35 === void 0 ? '' : _35, _36 = _a.ctaPrimarySuffix, ctaPrimarySuffix = _36 === void 0 ? '' : _36, _37 = _a.ctaSecondaryRounded, ctaSecondaryRounded = _37 === void 0 ? false : _37, _38 = _a.ctaSecondaryFlat, ctaSecondaryFlat = _38 === void 0 ? false : _38, _39 = _a.ctaSecondaryPrefix, ctaSecondaryPrefix = _39 === void 0 ? '' : _39, _40 = _a.ctaSecondarySuffix, ctaSecondarySuffix = _40 === void 0 ? '' : _40, _41 = _a.ctaAccentRounded, ctaAccentRounded = _41 === void 0 ? false : _41, _42 = _a.ctaAccentFlat, ctaAccentFlat = _42 === void 0 ? false : _42, _43 = _a.ctaAccentPrefix, ctaAccentPrefix = _43 === void 0 ? '' : _43, _44 = _a.ctaAccentSuffix, ctaAccentSuffix = _44 === void 0 ? '' : _44, primaryIconSize = _a.primaryIconSize, secondaryIconSize = _a.secondaryIconSize, accentIconSize = _a.accentIconSize;
|
|
38
38
|
// Use the component config hook
|
|
39
39
|
var mergeWithLocal = (0, componentUtils_1.useComponentConfiguration)('Vista', variant).mergeWithLocal;
|
|
40
40
|
// Merge config with local props - local props should override config
|
|
@@ -102,6 +102,21 @@ var Vista = function (_a) {
|
|
|
102
102
|
ctaAccentText: ctaAccentText,
|
|
103
103
|
ctaGap: ctaGap,
|
|
104
104
|
ctaFlexJustify: ctaFlexJustify,
|
|
105
|
+
ctaPrimaryRounded: ctaPrimaryRounded,
|
|
106
|
+
ctaPrimaryFlat: ctaPrimaryFlat,
|
|
107
|
+
ctaPrimaryPrefix: ctaPrimaryPrefix,
|
|
108
|
+
ctaPrimarySuffix: ctaPrimarySuffix,
|
|
109
|
+
ctaSecondaryRounded: ctaSecondaryRounded,
|
|
110
|
+
ctaSecondaryFlat: ctaSecondaryFlat,
|
|
111
|
+
ctaSecondaryPrefix: ctaSecondaryPrefix,
|
|
112
|
+
ctaSecondarySuffix: ctaSecondarySuffix,
|
|
113
|
+
ctaAccentRounded: ctaAccentRounded,
|
|
114
|
+
ctaAccentFlat: ctaAccentFlat,
|
|
115
|
+
ctaAccentPrefix: ctaAccentPrefix,
|
|
116
|
+
ctaAccentSuffix: ctaAccentSuffix,
|
|
117
|
+
primaryIconSize: primaryIconSize,
|
|
118
|
+
secondaryIconSize: secondaryIconSize,
|
|
119
|
+
accentIconSize: accentIconSize,
|
|
105
120
|
}).props;
|
|
106
121
|
var layoutClass = [
|
|
107
122
|
mergedProps.layout,
|
|
@@ -116,15 +131,15 @@ var Vista = function (_a) {
|
|
|
116
131
|
if (!hasCTAs)
|
|
117
132
|
return null;
|
|
118
133
|
return (react_1.default.createElement(Flex_1.default, { gap: mergedProps.ctaGap, justify: mergedProps.ctaFlexJustify, className: "mt-6 ".concat(mergedProps.ctaClass), wrap: "wrap", width: '100%' },
|
|
119
|
-
mergedProps.showPrimaryCTA && (react_1.default.createElement(Button_1.default, { bg: "primary", outlined: mergedProps.primaryButtonOutlined, onClick: function () { return window.location.href = mergedProps.ctaPrimaryUrl; } }, mergedProps.ctaPrimaryText)),
|
|
120
|
-
mergedProps.showSecondaryCTA && (react_1.default.createElement(Button_1.default, { bg: "secondary", outlined: mergedProps.secondaryButtonOutlined, onClick: function () { return window.location.href = mergedProps.ctaSecondaryUrl; } }, mergedProps.ctaSecondaryText)),
|
|
121
|
-
mergedProps.showAccentCTA && (react_1.default.createElement(Button_1.default, { bg: "accent", outlined: mergedProps.accentButtonOutlined, onClick: function () { return window.location.href = mergedProps.ctaAccentUrl; } }, mergedProps.ctaAccentText))));
|
|
134
|
+
mergedProps.showPrimaryCTA && (react_1.default.createElement(Button_1.default, { bg: "primary", outlined: mergedProps.primaryButtonOutlined, onClick: function () { return window.location.href = mergedProps.ctaPrimaryUrl; }, rounded: mergedProps.ctaPrimaryRounded, flat: mergedProps.ctaPrimaryFlat, stringPrefix: mergedProps.ctaPrimaryPrefix, stringSuffix: mergedProps.ctaPrimarySuffix, iconSize: mergedProps.primaryIconSize }, mergedProps.ctaPrimaryText)),
|
|
135
|
+
mergedProps.showSecondaryCTA && (react_1.default.createElement(Button_1.default, { bg: "secondary", outlined: mergedProps.secondaryButtonOutlined, onClick: function () { return window.location.href = mergedProps.ctaSecondaryUrl; }, rounded: mergedProps.ctaSecondaryRounded, flat: mergedProps.ctaSecondaryFlat, stringPrefix: mergedProps.ctaSecondaryPrefix, stringSuffix: mergedProps.ctaSecondarySuffix, iconSize: mergedProps.secondaryIconSize }, mergedProps.ctaSecondaryText)),
|
|
136
|
+
mergedProps.showAccentCTA && (react_1.default.createElement(Button_1.default, { bg: "accent", outlined: mergedProps.accentButtonOutlined, onClick: function () { return window.location.href = mergedProps.ctaAccentUrl; }, rounded: mergedProps.ctaAccentRounded, flat: mergedProps.ctaAccentFlat, stringPrefix: mergedProps.ctaAccentPrefix, stringSuffix: mergedProps.ctaAccentSuffix, iconSize: mergedProps.accentIconSize }, mergedProps.ctaAccentText))));
|
|
122
137
|
};
|
|
123
138
|
// Enhanced Text Content with flexible styling
|
|
124
139
|
var TextContent = (react_1.default.createElement("div", { className: "vista-text ".concat(mergedProps.layout === 'centered' ? "text-center" : "", " ").concat(mergedProps.textWrapperClass) },
|
|
125
140
|
mergedProps.heading && (react_1.default.createElement(Text_1.default, { block: true, size: mergedProps.headingSize, weight: mergedProps.headingWeight, color: mergedProps.headingColor, funcss: mergedProps.headingClass }, mergedProps.heading)),
|
|
126
141
|
mergedProps.subheading && (react_1.default.createElement(Text_1.default, { block: true, size: mergedProps.subheadingSize, weight: mergedProps.subheadingWeight, color: mergedProps.subheadingColor, funcss: "mt-2 ".concat(mergedProps.subheadingClass) }, mergedProps.subheading)),
|
|
127
|
-
mergedProps.content && (react_1.default.createElement(Text_1.default, { block: true, size: mergedProps.contentSize, weight: mergedProps.contentWeight, color: mergedProps.contentColor, funcss: "mt-4 ".concat(mergedProps.contentClass), article: true }, mergedProps.content
|
|
142
|
+
mergedProps.content && (react_1.default.createElement(Text_1.default, { block: true, size: mergedProps.contentSize, weight: mergedProps.contentWeight, color: mergedProps.contentColor, funcss: "mt-4 ".concat(mergedProps.contentClass), article: true }, children || (typeof mergedProps.content === 'string' ? react_1.default.createElement("div", { dangerouslySetInnerHTML: { __html: mergedProps.content } }) : mergedProps.content))),
|
|
128
143
|
mergedProps.cta ? (react_1.default.createElement("div", { className: "mt-6 ".concat(mergedProps.ctaClass) }, mergedProps.cta)) : (react_1.default.createElement(CTAButtons, null))));
|
|
129
144
|
// Enhanced Image Content - uses imageUrl if no image component provided
|
|
130
145
|
var ImageContent = (mergedProps.image || mergedProps.imageUrl) && (react_1.default.createElement("div", { className: "vista-image ".concat(mergedProps.imageWrapperClass) }, mergedProps.image ? (mergedProps.image) : (react_1.default.createElement("img", { src: mergedProps.imageUrl, alt: mergedProps.imageAlt || 'Vista image', className: "".concat(mergedProps.imageClass), style: {
|