@dynamic-framework/ui-react 1.13.0 → 1.14.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/dist/css/dynamic-ui-non-root.css +2 -2
- package/dist/css/dynamic-ui-non-root.min.css +1 -1
- package/dist/css/dynamic-ui.css +2 -2
- package/dist/css/dynamic-ui.min.css +1 -1
- package/dist/index.esm.js +158 -137
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +158 -136
- package/dist/index.js.map +1 -1
- package/dist/types/components/DIcon/DIcon.d.ts +4 -15
- package/dist/types/components/DIconBase/DIconBase.d.ts +17 -0
- package/dist/types/components/DIconBase/index.d.ts +2 -0
- package/dist/types/components/index.d.ts +1 -0
- package/dist/types/contexts/DContext.d.ts +6 -1
- package/package.json +2 -2
- package/src/style/components/_d-icon.scss +4 -2
package/dist/index.esm.js
CHANGED
|
@@ -58,10 +58,10 @@ const ALERT_TYPE_ICON = {
|
|
|
58
58
|
secondary: 'info-circle',
|
|
59
59
|
};
|
|
60
60
|
|
|
61
|
-
function
|
|
61
|
+
function DIconBase({ icon, theme, style, className, size = '1.5rem', loading = false, loadingDuration = 1.8, hasCircle = false, circleSize = `calc(var(--${PREFIX_BS}icon-component-size) * 1)`, color, backgroundColor, materialStyle = false, familyClass = 'bi', familyPrefix = 'bi-', }) {
|
|
62
62
|
const colorStyle = useMemo(() => {
|
|
63
63
|
if (color) {
|
|
64
|
-
return { [`--${PREFIX_BS}component-color`]: color };
|
|
64
|
+
return { [`--${PREFIX_BS}icon-component-color`]: color };
|
|
65
65
|
}
|
|
66
66
|
if (theme) {
|
|
67
67
|
return { [`--${PREFIX_BS}icon-component-color`]: `var(--${PREFIX_BS}${theme})` };
|
|
@@ -87,139 +87,17 @@ function DIcon({ icon, theme, style, className, size = '1.5rem', loading = false
|
|
|
87
87
|
return { [`--${PREFIX_BS}icon-component-padding`]: '0' };
|
|
88
88
|
}, [circleSize, hasCircle]);
|
|
89
89
|
const generateStyleVariables = useMemo(() => (Object.assign(Object.assign(Object.assign(Object.assign({ [`--${PREFIX_BS}icon-component-size`]: size, [`--${PREFIX_BS}icon-component-loading-duration`]: `${loadingDuration}s` }, colorStyle), backgroundStyle), circleSizeStyle), style)), [size, loadingDuration, colorStyle, backgroundStyle, circleSizeStyle, style]);
|
|
90
|
-
const generateClasses = useMemo(() => (Object.assign({ 'd-icon': true, [familyClass]: true,
|
|
91
|
-
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
const generateStyleVariables = useMemo(() => (Object.assign(Object.assign({}, style), { [`--${PREFIX_BS}alert-component-separator-opacity`]: '0.3' })), [style]);
|
|
102
|
-
return (jsxs("div", { className: classNames(generateClasses), style: generateStyleVariables, role: "alert", id: id, children: [(showIcon || icon) && (jsx(DIcon, Object.assign({ className: "alert-icon", icon: getIcon }, iconFamilyClass && { familyClass: iconFamilyClass }, iconFamilyPrefix && { familyPrefix: iconFamilyPrefix }))), jsx("div", { className: "alert-text", children: children }), showClose && (jsx("div", { className: "alert-separator" })), showClose && (jsx("button", { type: "button", className: "btn-close", "aria-label": "Close", onClick: onClose, children: jsx(DIcon, { className: "alert-close-icon", icon: "x-lg", familyClass: iconFamilyClass, familyPrefix: iconFamilyPrefix }) }))] }));
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
function DBoxFile(_a) {
|
|
106
|
-
var { icon = 'cloud-upload', iconFamilyClass, iconFamilyPrefix, disabled = false, children, className, style } = _a, dropzoneOptions = __rest(_a, ["icon", "iconFamilyClass", "iconFamilyPrefix", "disabled", "children", "className", "style"]);
|
|
107
|
-
const { acceptedFiles, getRootProps, getInputProps, } = useDropzone(Object.assign({ disabled }, dropzoneOptions));
|
|
108
|
-
return (jsxs("section", { className: classNames('d-box-file', {
|
|
109
|
-
'd-box-file-selected': !!acceptedFiles.length,
|
|
110
|
-
}, className), style: style, children: [jsxs("div", Object.assign({}, getRootProps({
|
|
111
|
-
className: classNames('d-box-file-dropzone', {
|
|
112
|
-
disabled,
|
|
113
|
-
}),
|
|
114
|
-
}), { children: [jsx("input", Object.assign({}, getInputProps())), jsx(DIcon, { icon: icon, familyClass: iconFamilyClass, familyPrefix: iconFamilyPrefix }), jsx("div", { className: "d-box-content", children: children })] })), !!acceptedFiles.length && (jsx("aside", { className: "d-box-files", children: acceptedFiles.map((file) => (jsx("div", { className: "d-box-files-text", children: `${file.name} - ${file.size} bytes` }, file.name))) }))] }));
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
function DButton({ theme = 'primary', size, variant, state, text = '', ariaLabel, iconStart, iconStartFamilyClass, iconStartFamilyPrefix, iconEnd, iconEndFamilyClass, iconEndFamilyPrefix, value, type = 'button', pill = false, loading = false, loadingAriaLabel, disabled = false, stopPropagationEnabled = true, className, form, onClick, }) {
|
|
118
|
-
const generateClasses = useMemo(() => {
|
|
119
|
-
const variantClass = variant
|
|
120
|
-
? `btn-${variant}-${theme}`
|
|
121
|
-
: `btn-${theme}`;
|
|
122
|
-
return Object.assign(Object.assign(Object.assign({ btn: true, [variantClass]: true }, size && { [`btn-${size}`]: true }), (state && state !== 'disabled') && { [state]: true }), { loading });
|
|
123
|
-
}, [variant, theme, size, state, loading]);
|
|
124
|
-
const generateStyleVariables = useMemo(() => {
|
|
125
|
-
if (pill) {
|
|
126
|
-
return {
|
|
127
|
-
[`--${PREFIX_BS}btn-component-border-radius`]: `var(--${PREFIX_BS}border-radius-pill)`,
|
|
128
|
-
[`--${PREFIX_BS}btn-component-lg-border-radius`]: `var(--${PREFIX_BS}border-radius-pill)`,
|
|
129
|
-
[`--${PREFIX_BS}btn-component-sm-border-radius`]: `var(--${PREFIX_BS}border-radius-pill)`,
|
|
130
|
-
};
|
|
131
|
-
}
|
|
132
|
-
return {};
|
|
133
|
-
}, [pill]);
|
|
134
|
-
const clickHandler = useCallback((event) => {
|
|
135
|
-
if (stopPropagationEnabled) {
|
|
136
|
-
event.stopPropagation();
|
|
137
|
-
}
|
|
138
|
-
onClick === null || onClick === void 0 ? void 0 : onClick(event);
|
|
139
|
-
}, [stopPropagationEnabled, onClick]);
|
|
140
|
-
const isDisabled = useMemo(() => (state === 'disabled' || loading || disabled), [state, loading, disabled]);
|
|
141
|
-
const newAriaLabel = useMemo(() => (loading
|
|
142
|
-
? (loadingAriaLabel || ariaLabel || text)
|
|
143
|
-
: (ariaLabel || text)), [loading, loadingAriaLabel, ariaLabel, text]);
|
|
144
|
-
return (jsxs("button", Object.assign({ className: classNames(generateClasses, className), style: generateStyleVariables, type: type, disabled: isDisabled, onClick: clickHandler, "aria-label": newAriaLabel, form: form }, value && { value }, { children: [iconStart && (jsx(DIcon, { icon: iconStart, familyClass: iconStartFamilyClass, familyPrefix: iconStartFamilyPrefix })), (text && !loading) && (jsx("span", { children: text })), loading && (jsx("span", { className: "spinner-border spinner-border-sm", role: "status", "aria-hidden": "true", children: jsx("span", { className: "visually-hidden", children: "Loading..." }) })), iconEnd && (jsx(DIcon, { icon: iconEnd, familyClass: iconEndFamilyClass, familyPrefix: iconEndFamilyPrefix }))] })));
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
function DCardHeader({ className, style, children, }) {
|
|
148
|
-
return (jsx("div", { className: classNames('card-header', className), style: style, children: children }));
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
function DCardBody({ className, style, children, }) {
|
|
152
|
-
return (jsx("div", { className: classNames('card-body', className), style: style, children: children }));
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
function DCardFooter({ className, style, children, }) {
|
|
156
|
-
return (jsx("div", { className: classNames('card-footer', className), style: style, children: children }));
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
function DCard({ className, style, children, }) {
|
|
160
|
-
return (jsx("div", { style: style, className: classNames('card', className), children: children }));
|
|
161
|
-
}
|
|
162
|
-
var DCard$1 = Object.assign(DCard, {
|
|
163
|
-
Header: DCardHeader,
|
|
164
|
-
Body: DCardBody,
|
|
165
|
-
Footer: DCardFooter,
|
|
166
|
-
});
|
|
167
|
-
|
|
168
|
-
function DCardAccount({ className, style, icon, theme, name, number, balance, balanceText, onClick, actionText, }) {
|
|
169
|
-
return (jsx(DCard$1, { className: classNames('d-card-account', className), style: style, children: jsxs(DCard$1.Body, { children: [jsxs("div", { className: "d-flex gap-3 align-items-center", children: [jsx(DIcon, { icon: icon, hasCircle: true, theme: theme, size: "1.5rem" }), jsxs("div", { className: "d-block flex-grow-1", children: [jsx("p", { className: "text-gray-700", children: name }), jsx("small", { className: "text-gray-500", children: number })] })] }), jsxs("div", { className: "d-block", children: [jsx("p", { className: "fw-bold fs-6 text-body", children: balance }), jsx("small", { className: "text-gray-700", children: balanceText })] }), jsx("div", { className: "d-flex justify-content-end", children: jsx(DButton, { text: actionText, variant: "link", size: "sm", theme: "secondary", iconEnd: "chevron-right", onClick: onClick }) })] }) }));
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
function DCarouselSlide(_a) {
|
|
173
|
-
var { className } = _a, props = __rest(_a, ["className"]);
|
|
174
|
-
return (jsx(SplideSlide, Object.assign({ className: classNames('d-carousel-slide', className) }, props)));
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
function DCarousel(_a) {
|
|
178
|
-
var { children, className, style, options } = _a, props = __rest(_a, ["children", "className", "style", "options"]);
|
|
179
|
-
return (jsx(Splide, Object.assign({ className: classNames('d-carousel', className), style: style, options: Object.assign(Object.assign({}, options), { classes: {
|
|
180
|
-
// Arrows
|
|
181
|
-
arrows: 'splide__arrows d-carousel-arrows',
|
|
182
|
-
arrow: 'splide__arrow d-carousel-arrow',
|
|
183
|
-
prev: 'splide__arrow--prev d-carousel-arrow-prev',
|
|
184
|
-
next: 'splide__arrow--next d-carousel-arrow-next',
|
|
185
|
-
// Paginator
|
|
186
|
-
pagination: 'splide__pagination d-carousel-pagination',
|
|
187
|
-
page: 'splide__pagination__page d-carousel-pagination-page',
|
|
188
|
-
} }) }, props, { children: children })));
|
|
189
|
-
}
|
|
190
|
-
var DCarousel$1 = Object.assign(DCarousel, {
|
|
191
|
-
Slide: DCarouselSlide,
|
|
192
|
-
});
|
|
193
|
-
|
|
194
|
-
function DChip({ theme = 'primary', text, icon, iconFamilyClass, iconFamilyPrefix, showClose = false, closeAriaLabel = 'close', className, style, onClose, }) {
|
|
195
|
-
const generateClasses = useMemo(() => ({
|
|
196
|
-
'd-chip': true,
|
|
197
|
-
[`d-chip-${theme}`]: !!theme,
|
|
198
|
-
}), [theme]);
|
|
199
|
-
return (jsxs("span", { className: classNames(generateClasses, className), style: style, children: [icon && (jsx("div", { className: "d-chip-icon-container", children: jsx(DIcon, { icon: icon, familyClass: iconFamilyClass, familyPrefix: iconFamilyPrefix }) })), jsx("span", { children: text }), showClose && (jsx("button", { type: "button", className: "d-chip-icon-container", onClick: onClose, "aria-label": closeAriaLabel, children: jsx(DIcon, { icon: "x-lg" }) }))] }));
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
function DCollapse({ id, className, style, Component, hasSeparator = false, defaultCollapsed = false, onChange, children, }) {
|
|
203
|
-
const [toggle, setToggle] = useState(defaultCollapsed);
|
|
204
|
-
const onChangeCollapse = () => setToggle((prev) => !prev);
|
|
205
|
-
useEffect(() => {
|
|
206
|
-
if (onChange) {
|
|
207
|
-
onChange(toggle);
|
|
208
|
-
}
|
|
209
|
-
}, [toggle, onChange]);
|
|
210
|
-
useEffect(() => {
|
|
211
|
-
setToggle(defaultCollapsed);
|
|
212
|
-
}, [defaultCollapsed]);
|
|
213
|
-
const generateStyles = useMemo(() => ({
|
|
214
|
-
[`--${PREFIX_BS}collapse-separator-display`]: hasSeparator ? 'block' : 'none',
|
|
215
|
-
}), [hasSeparator]);
|
|
216
|
-
return (jsxs("div", { id: id, className: classNames('collapse-container', className), style: style, children: [jsxs("button", { className: "collapse-button", type: "button", onClick: onChangeCollapse, children: [jsx("div", { className: "flex-grow-1", children: Component }), jsx(DIcon, { color: `var(--${PREFIX_BS}gray)`, size: `var(--${PREFIX_BS}ref-fs-small)`, icon: toggle ? 'chevron-up' : 'chevron-down' })] }), toggle && (jsx("div", { className: classNames({
|
|
217
|
-
'collapse-body': true,
|
|
218
|
-
}), style: generateStyles, children: children }))] }));
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
function DCollapseIconText({ children, icon, iconSize = '1.5rem', iconTheme = 'primary', title, iconFamilyClass, iconFamilyPrefix, className, style, }) {
|
|
222
|
-
return (jsx(DCollapse, { defaultCollapsed: true, className: classNames('d-collapse-icon-text', className), style: style, Component: (jsxs("div", { className: "d-collapse-icon-text-header", children: [jsx(DIcon, { icon: icon, size: iconSize, theme: iconTheme, familyClass: iconFamilyClass, familyPrefix: iconFamilyPrefix, hasCircle: true }), jsx("span", { className: "d-collapse-icon-text-title", children: title })] })), children: children }));
|
|
90
|
+
const generateClasses = useMemo(() => (Object.assign(Object.assign({ 'd-icon': true, [familyClass]: true, 'd-icon-loading': loading }, !materialStyle && {
|
|
91
|
+
[`${familyPrefix}${icon}`]: true,
|
|
92
|
+
}), className && { [className]: true })), [
|
|
93
|
+
familyClass,
|
|
94
|
+
loading,
|
|
95
|
+
className,
|
|
96
|
+
materialStyle,
|
|
97
|
+
familyPrefix,
|
|
98
|
+
icon,
|
|
99
|
+
]);
|
|
100
|
+
return (jsx("i", { className: classNames(generateClasses), style: generateStyleVariables, children: materialStyle && icon }));
|
|
223
101
|
}
|
|
224
102
|
|
|
225
103
|
const defaultState = {
|
|
@@ -230,13 +108,19 @@ const defaultState = {
|
|
|
230
108
|
separator: ',',
|
|
231
109
|
decimal: '.',
|
|
232
110
|
},
|
|
111
|
+
icon: {
|
|
112
|
+
familyClass: 'bi',
|
|
113
|
+
familyPrefix: 'bi-',
|
|
114
|
+
materialStyle: false,
|
|
115
|
+
},
|
|
233
116
|
setContext: () => { },
|
|
234
117
|
};
|
|
235
118
|
const DContext = createContext(defaultState);
|
|
236
|
-
function DContextProvider({ language = defaultState.language, currency = defaultState.currency, children, }) {
|
|
119
|
+
function DContextProvider({ language = defaultState.language, currency = defaultState.currency, icon = defaultState.icon, children, }) {
|
|
237
120
|
const [internalContext, setInternalContext,] = useState({
|
|
238
121
|
language,
|
|
239
122
|
currency,
|
|
123
|
+
icon,
|
|
240
124
|
});
|
|
241
125
|
const value = useMemo(() => (Object.assign(Object.assign({}, internalContext), { setContext: (newValue) => setInternalContext(newValue) })), [internalContext]);
|
|
242
126
|
return (jsx(DContext.Provider, { value: value, children: children }));
|
|
@@ -399,6 +283,143 @@ function useDOffcanvasContext() {
|
|
|
399
283
|
return context;
|
|
400
284
|
}
|
|
401
285
|
|
|
286
|
+
function DIcon(_a) {
|
|
287
|
+
var { familyClass: propFamilyClass, familyPrefix: propFamilyPrefix, materialStyle: propMaterialStyle } = _a, props = __rest(_a, ["familyClass", "familyPrefix", "materialStyle"]);
|
|
288
|
+
const { icon: { familyClass, familyPrefix, materialStyle, }, } = useDContext();
|
|
289
|
+
return (jsx(DIconBase, Object.assign({ familyClass: propFamilyClass || familyClass, familyPrefix: propFamilyPrefix || familyPrefix, materialStyle: propMaterialStyle || materialStyle }, props)));
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
function DSummaryCard({ title, description, icon, iconSize, iconTheme, Summary, }) {
|
|
293
|
+
return (jsxs("div", { children: [jsx("h6", { className: "fw-bold fs-6", children: title }), jsx("p", { className: "fs-8", children: description }), jsxs("div", { className: "bg-white rounded p-4 d-flex gap-3 shadow-sm text-gray-700 fs-8", children: [jsx(DIcon, { icon: icon, theme: iconTheme, size: iconSize }), Summary] })] }));
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
function DAlert({ type = 'success', icon, iconFamilyClass, iconFamilyPrefix, showIcon = true, soft = false, showClose, onClose, children, id, className, style, }) {
|
|
297
|
+
const generateClasses = useMemo(() => (Object.assign({ alert: true, [`alert-${type}`]: true, 'fade show': !!showClose, 'alert-soft': soft }, className && { [className]: true })), [type, showClose, soft, className]);
|
|
298
|
+
const getIcon = useMemo(() => icon || ALERT_TYPE_ICON[type] || '', [icon, type]);
|
|
299
|
+
const generateStyleVariables = useMemo(() => (Object.assign(Object.assign({}, style), { [`--${PREFIX_BS}alert-component-separator-opacity`]: '0.3' })), [style]);
|
|
300
|
+
return (jsxs("div", { className: classNames(generateClasses), style: generateStyleVariables, role: "alert", id: id, children: [(showIcon || icon) && (jsx(DIcon, Object.assign({ className: "alert-icon", icon: getIcon }, iconFamilyClass && { familyClass: iconFamilyClass }, iconFamilyPrefix && { familyPrefix: iconFamilyPrefix }))), jsx("div", { className: "alert-text", children: children }), showClose && (jsx("div", { className: "alert-separator" })), showClose && (jsx("button", { type: "button", className: "btn-close", "aria-label": "Close", onClick: onClose, children: jsx(DIcon, { className: "alert-close-icon", icon: "x-lg", familyClass: iconFamilyClass, familyPrefix: iconFamilyPrefix }) }))] }));
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
function DBoxFile(_a) {
|
|
304
|
+
var { icon = 'cloud-upload', iconFamilyClass, iconFamilyPrefix, disabled = false, children, className, style } = _a, dropzoneOptions = __rest(_a, ["icon", "iconFamilyClass", "iconFamilyPrefix", "disabled", "children", "className", "style"]);
|
|
305
|
+
const { acceptedFiles, getRootProps, getInputProps, } = useDropzone(Object.assign({ disabled }, dropzoneOptions));
|
|
306
|
+
return (jsxs("section", { className: classNames('d-box-file', {
|
|
307
|
+
'd-box-file-selected': !!acceptedFiles.length,
|
|
308
|
+
}, className), style: style, children: [jsxs("div", Object.assign({}, getRootProps({
|
|
309
|
+
className: classNames('d-box-file-dropzone', {
|
|
310
|
+
disabled,
|
|
311
|
+
}),
|
|
312
|
+
}), { children: [jsx("input", Object.assign({}, getInputProps())), jsx(DIcon, { icon: icon, familyClass: iconFamilyClass, familyPrefix: iconFamilyPrefix }), jsx("div", { className: "d-box-content", children: children })] })), !!acceptedFiles.length && (jsx("aside", { className: "d-box-files", children: acceptedFiles.map((file) => (jsx("div", { className: "d-box-files-text", children: `${file.name} - ${file.size} bytes` }, file.name))) }))] }));
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
function DButton({ theme = 'primary', size, variant, state, text = '', ariaLabel, iconStart, iconStartFamilyClass, iconStartFamilyPrefix, iconEnd, iconEndFamilyClass, iconEndFamilyPrefix, value, type = 'button', pill = false, loading = false, loadingAriaLabel, disabled = false, stopPropagationEnabled = true, className, form, onClick, }) {
|
|
316
|
+
const generateClasses = useMemo(() => {
|
|
317
|
+
const variantClass = variant
|
|
318
|
+
? `btn-${variant}-${theme}`
|
|
319
|
+
: `btn-${theme}`;
|
|
320
|
+
return Object.assign(Object.assign(Object.assign({ btn: true, [variantClass]: true }, size && { [`btn-${size}`]: true }), (state && state !== 'disabled') && { [state]: true }), { loading });
|
|
321
|
+
}, [variant, theme, size, state, loading]);
|
|
322
|
+
const generateStyleVariables = useMemo(() => {
|
|
323
|
+
if (pill) {
|
|
324
|
+
return {
|
|
325
|
+
[`--${PREFIX_BS}btn-component-border-radius`]: `var(--${PREFIX_BS}border-radius-pill)`,
|
|
326
|
+
[`--${PREFIX_BS}btn-component-lg-border-radius`]: `var(--${PREFIX_BS}border-radius-pill)`,
|
|
327
|
+
[`--${PREFIX_BS}btn-component-sm-border-radius`]: `var(--${PREFIX_BS}border-radius-pill)`,
|
|
328
|
+
};
|
|
329
|
+
}
|
|
330
|
+
return {};
|
|
331
|
+
}, [pill]);
|
|
332
|
+
const clickHandler = useCallback((event) => {
|
|
333
|
+
if (stopPropagationEnabled) {
|
|
334
|
+
event.stopPropagation();
|
|
335
|
+
}
|
|
336
|
+
onClick === null || onClick === void 0 ? void 0 : onClick(event);
|
|
337
|
+
}, [stopPropagationEnabled, onClick]);
|
|
338
|
+
const isDisabled = useMemo(() => (state === 'disabled' || loading || disabled), [state, loading, disabled]);
|
|
339
|
+
const newAriaLabel = useMemo(() => (loading
|
|
340
|
+
? (loadingAriaLabel || ariaLabel || text)
|
|
341
|
+
: (ariaLabel || text)), [loading, loadingAriaLabel, ariaLabel, text]);
|
|
342
|
+
return (jsxs("button", Object.assign({ className: classNames(generateClasses, className), style: generateStyleVariables, type: type, disabled: isDisabled, onClick: clickHandler, "aria-label": newAriaLabel, form: form }, value && { value }, { children: [iconStart && (jsx(DIcon, { icon: iconStart, familyClass: iconStartFamilyClass, familyPrefix: iconStartFamilyPrefix })), (text && !loading) && (jsx("span", { children: text })), loading && (jsx("span", { className: "spinner-border spinner-border-sm", role: "status", "aria-hidden": "true", children: jsx("span", { className: "visually-hidden", children: "Loading..." }) })), iconEnd && (jsx(DIcon, { icon: iconEnd, familyClass: iconEndFamilyClass, familyPrefix: iconEndFamilyPrefix }))] })));
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
function DCardHeader({ className, style, children, }) {
|
|
346
|
+
return (jsx("div", { className: classNames('card-header', className), style: style, children: children }));
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
function DCardBody({ className, style, children, }) {
|
|
350
|
+
return (jsx("div", { className: classNames('card-body', className), style: style, children: children }));
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
function DCardFooter({ className, style, children, }) {
|
|
354
|
+
return (jsx("div", { className: classNames('card-footer', className), style: style, children: children }));
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
function DCard({ className, style, children, }) {
|
|
358
|
+
return (jsx("div", { style: style, className: classNames('card', className), children: children }));
|
|
359
|
+
}
|
|
360
|
+
var DCard$1 = Object.assign(DCard, {
|
|
361
|
+
Header: DCardHeader,
|
|
362
|
+
Body: DCardBody,
|
|
363
|
+
Footer: DCardFooter,
|
|
364
|
+
});
|
|
365
|
+
|
|
366
|
+
function DCardAccount({ className, style, icon, theme, name, number, balance, balanceText, onClick, actionText, }) {
|
|
367
|
+
return (jsx(DCard$1, { className: classNames('d-card-account', className), style: style, children: jsxs(DCard$1.Body, { children: [jsxs("div", { className: "d-flex gap-3 align-items-center", children: [jsx(DIcon, { icon: icon, hasCircle: true, theme: theme, size: "1.5rem" }), jsxs("div", { className: "d-block flex-grow-1", children: [jsx("p", { className: "text-gray-700", children: name }), jsx("small", { className: "text-gray-500", children: number })] })] }), jsxs("div", { className: "d-block", children: [jsx("p", { className: "fw-bold fs-6 text-body", children: balance }), jsx("small", { className: "text-gray-700", children: balanceText })] }), jsx("div", { className: "d-flex justify-content-end", children: jsx(DButton, { text: actionText, variant: "link", size: "sm", theme: "secondary", iconEnd: "chevron-right", onClick: onClick }) })] }) }));
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
function DCarouselSlide(_a) {
|
|
371
|
+
var { className } = _a, props = __rest(_a, ["className"]);
|
|
372
|
+
return (jsx(SplideSlide, Object.assign({ className: classNames('d-carousel-slide', className) }, props)));
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
function DCarousel(_a) {
|
|
376
|
+
var { children, className, style, options } = _a, props = __rest(_a, ["children", "className", "style", "options"]);
|
|
377
|
+
return (jsx(Splide, Object.assign({ className: classNames('d-carousel', className), style: style, options: Object.assign(Object.assign({}, options), { classes: {
|
|
378
|
+
// Arrows
|
|
379
|
+
arrows: 'splide__arrows d-carousel-arrows',
|
|
380
|
+
arrow: 'splide__arrow d-carousel-arrow',
|
|
381
|
+
prev: 'splide__arrow--prev d-carousel-arrow-prev',
|
|
382
|
+
next: 'splide__arrow--next d-carousel-arrow-next',
|
|
383
|
+
// Paginator
|
|
384
|
+
pagination: 'splide__pagination d-carousel-pagination',
|
|
385
|
+
page: 'splide__pagination__page d-carousel-pagination-page',
|
|
386
|
+
} }) }, props, { children: children })));
|
|
387
|
+
}
|
|
388
|
+
var DCarousel$1 = Object.assign(DCarousel, {
|
|
389
|
+
Slide: DCarouselSlide,
|
|
390
|
+
});
|
|
391
|
+
|
|
392
|
+
function DChip({ theme = 'primary', text, icon, iconFamilyClass, iconFamilyPrefix, showClose = false, closeAriaLabel = 'close', className, style, onClose, }) {
|
|
393
|
+
const generateClasses = useMemo(() => ({
|
|
394
|
+
'd-chip': true,
|
|
395
|
+
[`d-chip-${theme}`]: !!theme,
|
|
396
|
+
}), [theme]);
|
|
397
|
+
return (jsxs("span", { className: classNames(generateClasses, className), style: style, children: [icon && (jsx("div", { className: "d-chip-icon-container", children: jsx(DIcon, { icon: icon, familyClass: iconFamilyClass, familyPrefix: iconFamilyPrefix }) })), jsx("span", { children: text }), showClose && (jsx("button", { type: "button", className: "d-chip-icon-container", onClick: onClose, "aria-label": closeAriaLabel, children: jsx(DIcon, { icon: "x-lg" }) }))] }));
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
function DCollapse({ id, className, style, Component, hasSeparator = false, defaultCollapsed = false, onChange, children, }) {
|
|
401
|
+
const [toggle, setToggle] = useState(defaultCollapsed);
|
|
402
|
+
const onChangeCollapse = () => setToggle((prev) => !prev);
|
|
403
|
+
useEffect(() => {
|
|
404
|
+
if (onChange) {
|
|
405
|
+
onChange(toggle);
|
|
406
|
+
}
|
|
407
|
+
}, [toggle, onChange]);
|
|
408
|
+
useEffect(() => {
|
|
409
|
+
setToggle(defaultCollapsed);
|
|
410
|
+
}, [defaultCollapsed]);
|
|
411
|
+
const generateStyles = useMemo(() => ({
|
|
412
|
+
[`--${PREFIX_BS}collapse-separator-display`]: hasSeparator ? 'block' : 'none',
|
|
413
|
+
}), [hasSeparator]);
|
|
414
|
+
return (jsxs("div", { id: id, className: classNames('collapse-container', className), style: style, children: [jsxs("button", { className: "collapse-button", type: "button", onClick: onChangeCollapse, children: [jsx("div", { className: "flex-grow-1", children: Component }), jsx(DIcon, { color: `var(--${PREFIX_BS}gray)`, size: `var(--${PREFIX_BS}ref-fs-small)`, icon: toggle ? 'chevron-up' : 'chevron-down' })] }), toggle && (jsx("div", { className: classNames({
|
|
415
|
+
'collapse-body': true,
|
|
416
|
+
}), style: generateStyles, children: children }))] }));
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
function DCollapseIconText({ children, icon, iconSize = '1.5rem', iconTheme = 'primary', title, iconFamilyClass, iconFamilyPrefix, className, style, }) {
|
|
420
|
+
return (jsx(DCollapse, { defaultCollapsed: true, className: classNames('d-collapse-icon-text', className), style: style, Component: (jsxs("div", { className: "d-collapse-icon-text-header", children: [jsx(DIcon, { icon: icon, size: iconSize, theme: iconTheme, familyClass: iconFamilyClass, familyPrefix: iconFamilyPrefix, hasCircle: true }), jsx("span", { className: "d-collapse-icon-text-title", children: title })] })), children: children }));
|
|
421
|
+
}
|
|
422
|
+
|
|
402
423
|
function formatCurrency(amount, options) {
|
|
403
424
|
return currency(amount, options).format();
|
|
404
425
|
}
|
|
@@ -1229,5 +1250,5 @@ async function configureI8n(resources, _a = {}) {
|
|
|
1229
1250
|
.then((t) => t);
|
|
1230
1251
|
}
|
|
1231
1252
|
|
|
1232
|
-
export { DAlert, DBadge, DBoxFile, DButton, DCard$1 as DCard, DCardAccount, DCardBody, DCardFooter, DCardHeader, DCarousel$1 as DCarousel, DCarouselSlide, DChip, DCollapse, DCollapseIconText, DContext, DContextProvider, DCurrencyText, DDatePicker, DIcon, DInput$1 as DInput, DInputCheck, DInputCounter$1 as DInputCounter, DInputCurrency$1 as DInputCurrency, DInputCurrencyBase$1 as DInputCurrencyBase, DInputMask$1 as DInputMask, DInputPassword$1 as DInputPassword, DInputPin, DInputSearch$1 as DInputSearch, DInputSelect, DInputSwitch, DList$1 as DList, DListItem, DModal$1 as DModal, DModalBody, DModalContext, DModalContextProvider, DModalFooter, DModalHeader, DOffcanvas$1 as DOffcanvas, DOffcanvasBody, DOffcanvasContext, DOffcanvasContextProvider, DOffcanvasFooter, DOffcanvasHeader, DPaginator, DPermissionGroup, DPermissionItem, DPopover, DProgress, DQuickActionButton, DQuickActionCheck, DQuickActionSelect, DQuickActionSwitch, DSkeleton, DStepper, DStepper$2 as DStepperDesktop, DStepper$1 as DStepperMobile, DSummaryCard, DTabContent, DTabs$1 as DTabs, DToastContainer, DTooltip, configureI8n as configureI18n, formatCurrency, useDContext, useDModalContext, useDOffcanvasContext, useDisableBodyScrollEffect, useFormatCurrency, useInputCurrency, usePortal, useProvidedRefOrCreate, useStackState, useTabContext, useToast };
|
|
1253
|
+
export { DAlert, DBadge, DBoxFile, DButton, DCard$1 as DCard, DCardAccount, DCardBody, DCardFooter, DCardHeader, DCarousel$1 as DCarousel, DCarouselSlide, DChip, DCollapse, DCollapseIconText, DContext, DContextProvider, DCurrencyText, DDatePicker, DIcon, DIconBase, DInput$1 as DInput, DInputCheck, DInputCounter$1 as DInputCounter, DInputCurrency$1 as DInputCurrency, DInputCurrencyBase$1 as DInputCurrencyBase, DInputMask$1 as DInputMask, DInputPassword$1 as DInputPassword, DInputPin, DInputSearch$1 as DInputSearch, DInputSelect, DInputSwitch, DList$1 as DList, DListItem, DModal$1 as DModal, DModalBody, DModalContext, DModalContextProvider, DModalFooter, DModalHeader, DOffcanvas$1 as DOffcanvas, DOffcanvasBody, DOffcanvasContext, DOffcanvasContextProvider, DOffcanvasFooter, DOffcanvasHeader, DPaginator, DPermissionGroup, DPermissionItem, DPopover, DProgress, DQuickActionButton, DQuickActionCheck, DQuickActionSelect, DQuickActionSwitch, DSkeleton, DStepper, DStepper$2 as DStepperDesktop, DStepper$1 as DStepperMobile, DSummaryCard, DTabContent, DTabs$1 as DTabs, DToastContainer, DTooltip, configureI8n as configureI18n, formatCurrency, useDContext, useDModalContext, useDOffcanvasContext, useDisableBodyScrollEffect, useFormatCurrency, useInputCurrency, usePortal, useProvidedRefOrCreate, useStackState, useTabContext, useToast };
|
|
1233
1254
|
//# sourceMappingURL=index.esm.js.map
|